@pixerate/editor 0.52.0 → 0.53.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.
Files changed (59) hide show
  1. package/dist/agent/index.cjs +23 -23
  2. package/dist/agent/index.js +4 -4
  3. package/dist/chart/index.cjs +174 -131
  4. package/dist/chart/index.cjs.map +1 -1
  5. package/dist/chart/index.d.cts +68 -21
  6. package/dist/chart/index.d.ts +68 -21
  7. package/dist/chart/index.js +64 -21
  8. package/dist/chart/index.js.map +1 -1
  9. package/dist/{chunk-UAW5FEMD.js → chunk-3S72F46R.js} +66 -8
  10. package/dist/chunk-3S72F46R.js.map +1 -0
  11. package/dist/{chunk-5TWIN7ZJ.js → chunk-47WWV3LI.js} +34 -4
  12. package/dist/chunk-47WWV3LI.js.map +1 -0
  13. package/dist/{chunk-OV7UAKIY.js → chunk-633QC34G.js} +172 -1
  14. package/dist/chunk-633QC34G.js.map +1 -0
  15. package/dist/{chunk-5N6AQCVB.js → chunk-BQQZ6MOI.js} +3 -3
  16. package/dist/{chunk-M5Z77GFH.cjs → chunk-C3JHII3M.cjs} +53 -53
  17. package/dist/{chunk-M5Z77GFH.cjs.map → chunk-C3JHII3M.cjs.map} +1 -1
  18. package/dist/{chunk-JOX6MJW4.cjs → chunk-CKRNELPO.cjs} +176 -5
  19. package/dist/chunk-CKRNELPO.cjs.map +1 -0
  20. package/dist/{chunk-TGBCBQFV.cjs → chunk-DK6QBGCS.cjs} +45 -15
  21. package/dist/chunk-DK6QBGCS.cjs.map +1 -0
  22. package/dist/{chunk-GTZXF4BI.cjs → chunk-NK3WL5TJ.cjs} +298 -133
  23. package/dist/chunk-NK3WL5TJ.cjs.map +1 -0
  24. package/dist/{chunk-3ZBAXET6.cjs → chunk-NN3JGUSX.cjs} +80 -22
  25. package/dist/chunk-NN3JGUSX.cjs.map +1 -0
  26. package/dist/{chunk-YMKPMXZ4.js → chunk-OIKYP7XC.js} +4 -4
  27. package/dist/{chunk-FEMIVHN3.cjs → chunk-P43HUQRX.cjs} +16 -16
  28. package/dist/{chunk-FEMIVHN3.cjs.map → chunk-P43HUQRX.cjs.map} +1 -1
  29. package/dist/{chunk-QFTVLEVN.js → chunk-RIXTW3C4.js} +3 -3
  30. package/dist/{chunk-WBOAXDKD.js → chunk-VODBAO32.js} +222 -57
  31. package/dist/chunk-VODBAO32.js.map +1 -0
  32. package/dist/{chunk-2DEBI6KU.cjs → chunk-YZZMX6V7.cjs} +10 -10
  33. package/dist/{chunk-2DEBI6KU.cjs.map → chunk-YZZMX6V7.cjs.map} +1 -1
  34. package/dist/{controller-DS3drIvy.d.cts → controller-CX0QfSv0.d.cts} +53 -2
  35. package/dist/{controller-BdKzaxs2.d.ts → controller-DscWQbjO.d.ts} +53 -2
  36. package/dist/export/index.cjs +4 -4
  37. package/dist/export/index.js +3 -3
  38. package/dist/extensions/index.cjs +6 -6
  39. package/dist/extensions/index.d.cts +2 -2
  40. package/dist/extensions/index.d.ts +2 -2
  41. package/dist/extensions/index.js +5 -5
  42. package/dist/{index-Dt9lzydb.d.ts → index-CALDD35B.d.ts} +1 -1
  43. package/dist/{index-DOy9HzfC.d.cts → index-DIWB6xMf.d.cts} +1 -1
  44. package/dist/index.cjs +13 -13
  45. package/dist/index.d.cts +3 -3
  46. package/dist/index.d.ts +3 -3
  47. package/dist/index.js +6 -6
  48. package/package.json +1 -1
  49. package/dist/chunk-3ZBAXET6.cjs.map +0 -1
  50. package/dist/chunk-5TWIN7ZJ.js.map +0 -1
  51. package/dist/chunk-GTZXF4BI.cjs.map +0 -1
  52. package/dist/chunk-JOX6MJW4.cjs.map +0 -1
  53. package/dist/chunk-OV7UAKIY.js.map +0 -1
  54. package/dist/chunk-TGBCBQFV.cjs.map +0 -1
  55. package/dist/chunk-UAW5FEMD.js.map +0 -1
  56. package/dist/chunk-WBOAXDKD.js.map +0 -1
  57. /package/dist/{chunk-5N6AQCVB.js.map → chunk-BQQZ6MOI.js.map} +0 -0
  58. /package/dist/{chunk-YMKPMXZ4.js.map → chunk-OIKYP7XC.js.map} +0 -0
  59. /package/dist/{chunk-QFTVLEVN.js.map → chunk-RIXTW3C4.js.map} +0 -0
@@ -18,7 +18,9 @@
18
18
 
19
19
 
20
20
 
21
- var _chunkJOX6MJW4cjs = require('./chunk-JOX6MJW4.cjs');
21
+
22
+
23
+ var _chunkCKRNELPOcjs = require('./chunk-CKRNELPO.cjs');
22
24
 
23
25
 
24
26
  var _chunkXP5IUZUOcjs = require('./chunk-XP5IUZUO.cjs');
@@ -57,7 +59,7 @@ function splitOutside(text, sep) {
57
59
  return out;
58
60
  }
59
61
  function chartMermaidFamily(spec) {
60
- const family = _chunkJOX6MJW4cjs.chartFamily.call(void 0, spec);
62
+ const family = _chunkCKRNELPOcjs.chartFamily.call(void 0, spec);
61
63
  if (family === "pie" || family === "funnel" || family === "treemap") return "pie";
62
64
  if (family === "radar") return "radar";
63
65
  return "xychart";
@@ -219,8 +221,8 @@ function chartFromMermaid(text, options = {}) {
219
221
  let title = _nullishCoalesce(frontTitle, () => ( ""));
220
222
  const categories = [];
221
223
  const series = [];
222
- const xAxis = _chunkJOX6MJW4cjs.defaultChartAxis.call(void 0, false);
223
- const yAxis = _chunkJOX6MJW4cjs.defaultChartAxis.call(void 0, true);
224
+ const xAxis = _chunkCKRNELPOcjs.defaultChartAxis.call(void 0, false);
225
+ const yAxis = _chunkCKRNELPOcjs.defaultChartAxis.call(void 0, true);
224
226
  const radarAxes = [];
225
227
  const pieSlices = [];
226
228
  let legendShow = true;
@@ -372,7 +374,7 @@ function chartFromMermaid(text, options = {}) {
372
374
  input.series = metaSeries.map((extra, i) => ({ ..._nullishCoalesce(base[i], () => ( {})), ..._nullishCoalesce(extra, () => ( {})) }));
373
375
  }
374
376
  }
375
- const { spec, issues: specIssues } = _chunkJOX6MJW4cjs.normalizeChartSpec.call(void 0, input);
377
+ const { spec, issues: specIssues } = _chunkCKRNELPOcjs.normalizeChartSpec.call(void 0, input);
376
378
  if (!family && !partial && !issues.length) issues.push({ path: "header", message: "The text is empty: expected a chart header (xychart-beta, pie or radar-beta)." });
377
379
  return { spec, issues: [...issues, ...specIssues], family, hasMeta: !!meta };
378
380
  }
@@ -639,6 +641,50 @@ function linearMap(value, domain, range) {
639
641
  if (d1 === d0) return (r0 + r1) / 2;
640
642
  return r0 + (value - d0) / (d1 - d0) * (r1 - r0);
641
643
  }
644
+ var tidy = (n) => n === 0 ? 0 : Number(n.toPrecision(12));
645
+ function niceLogScale(lo, hi, count = 5, base = 10, fixedMin = null, fixedMax = null) {
646
+ if (!(base > 1) || !Number.isFinite(base)) base = 10;
647
+ if (fixedMin !== null && !(fixedMin > 0 && Number.isFinite(fixedMin))) fixedMin = null;
648
+ if (fixedMax !== null && !(fixedMax > 0 && Number.isFinite(fixedMax))) fixedMax = null;
649
+ if (!(lo > 0) || !Number.isFinite(lo)) lo = hi > 0 && Number.isFinite(hi) ? hi : _nullishCoalesce(fixedMin, () => ( 1));
650
+ if (!(hi > 0) || !Number.isFinite(hi)) hi = Math.max(lo, _nullishCoalesce(fixedMax, () => ( lo * base)));
651
+ if (lo > hi) [lo, hi] = [hi, lo];
652
+ const log = (v) => Math.log(v) / Math.log(base);
653
+ const e0 = Math.floor(log(_nullishCoalesce(fixedMin, () => ( lo))) + 1e-9);
654
+ let e1 = Math.ceil(log(_nullishCoalesce(fixedMax, () => ( hi))) - 1e-9);
655
+ if (e1 <= e0) e1 = e0 + 1;
656
+ let min = _nullishCoalesce(fixedMin, () => ( tidy(Math.pow(base, e0))));
657
+ let max = _nullishCoalesce(fixedMax, () => ( tidy(Math.pow(base, e1))));
658
+ if (!(max > min)) {
659
+ if (fixedMax === null) max = tidy(min * base);
660
+ else min = tidy(max / base);
661
+ }
662
+ if (!Number.isFinite(max)) max = Number.MAX_VALUE;
663
+ if (!(min > 0)) min = Number.MIN_VALUE;
664
+ const inside = (t) => t >= min * (1 - 1e-9) && t <= max * (1 + 1e-9);
665
+ const decades = Math.max(1, log(max) - log(min));
666
+ let ticks = [];
667
+ const first = Math.ceil(log(min) - 1e-9);
668
+ const last = Math.floor(log(max) + 1e-9);
669
+ if (base === 10 && decades * 3 <= count + 1) {
670
+ for (let e = first - 1; e <= last; e++) for (const m of [1, 2, 5]) ticks.push(tidy(m * Math.pow(10, e)));
671
+ } else {
672
+ const every = Math.max(1, Math.ceil((last - first + 1) / (count + 2)));
673
+ for (let e = Math.ceil(first / every) * every; e <= last && ticks.length < 1e3; e += every) ticks.push(tidy(Math.pow(base, e)));
674
+ }
675
+ ticks = ticks.filter((t) => Number.isFinite(t) && t > 0 && inside(t));
676
+ if (ticks.length < 2) ticks = niceScale(min, max, count, min, max).ticks.filter((t) => t > 0);
677
+ return { min, max, step: base, ticks: [...new Set(ticks)].sort((a, b) => a - b) };
678
+ }
679
+ function chartScaleToPixel(value, scale) {
680
+ if (!scale.logBase) return linearMap(value, scale.domain, scale.range);
681
+ if (!(value > 0)) return NaN;
682
+ return linearMap(Math.log(value), [Math.log(scale.domain[0]), Math.log(scale.domain[1])], scale.range);
683
+ }
684
+ function chartScaleFromPixel(px, scale) {
685
+ if (!scale.logBase) return linearMap(px, scale.range, scale.domain);
686
+ return Math.exp(linearMap(px, scale.range, [Math.log(scale.domain[0]), Math.log(scale.domain[1])]));
687
+ }
642
688
 
643
689
  // src/chart/layout-shared.ts
644
690
  var estimateChartTextWidth = (text, size, weight = 400) => text.length * size * (weight >= 600 ? 0.6 : 0.56);
@@ -752,6 +798,7 @@ var tickCount = (length) => Math.max(2, Math.min(10, Math.round(length / 56)));
752
798
  function axisScale(lo, hi, length, axis, frozen, headroom = false) {
753
799
  const fixedMin = frozen && Number.isFinite(frozen.min) ? frozen.min : axis.min;
754
800
  const fixedMax = frozen && Number.isFinite(frozen.max) ? frozen.max : axis.max;
801
+ if (axis.scale === "log") return niceLogScale(lo, hi, tickCount(length), _nullishCoalesce(axis.logBase, () => ( 10)), fixedMin, fixedMax);
755
802
  const step = axis.step;
756
803
  if (step && step > 0 && Number.isFinite(lo) && Number.isFinite(hi)) {
757
804
  let min = _nullishCoalesce(fixedMin, () => ( Math.floor(lo / step + 1e-9) * step));
@@ -1179,11 +1226,14 @@ function chartSupportsTrendlines(type, stacking) {
1179
1226
  var MAX_CHART_DATA_LABELS = 200;
1180
1227
  var MAX_CHART_LINE_POINTS = 2e3;
1181
1228
  var MAX_CHART_MARKERS = 1e3;
1182
- function scaleInfo(scale, range, format) {
1183
- const domain = [scale.min, scale.max];
1184
- const raw = (v) => linearMap(v, domain, range);
1185
- const px = (v) => raw(Math.min(scale.max, Math.max(scale.min, v)));
1186
- return { scale, range, px, raw, zero: px(0), format, tickText: (t) => formatChartNumber(t, format, _nullishCoalesce(format.decimals, () => ( stepDecimals(scale.step)))) };
1229
+ function scaleInfo(scale, range, format, axis) {
1230
+ const logBase = _optionalChain([axis, 'optionalAccess', _10 => _10.scale]) === "log" ? _nullishCoalesce(axis.logBase, () => ( 10)) : void 0;
1231
+ const r = _optionalChain([axis, 'optionalAccess', _11 => _11.reverse]) ? [range[1], range[0]] : range;
1232
+ const vs = { domain: [scale.min, scale.max], range: r, logBase };
1233
+ const raw = (v) => chartScaleToPixel(v, vs);
1234
+ const px = (v) => logBase && !(v > 0) ? r[0] : raw(Math.min(scale.max, Math.max(scale.min, v)));
1235
+ const tickText = (t) => formatChartNumber(t, format, logBase ? format.decimals : _nullishCoalesce(format.decimals, () => ( stepDecimals(scale.step))));
1236
+ return { scale, range: r, px, raw, zero: px(0), format, tickText, ...logBase ? { logBase } : {} };
1187
1237
  }
1188
1238
  function categoryFrame(ctx, area, input) {
1189
1239
  const { spec, theme, measure, fs, marks } = ctx;
@@ -1194,12 +1244,12 @@ function categoryFrame(ctx, area, input) {
1194
1244
  const labelTarget = _nullishCoalesce(input.labelTarget, () => ( ((i) => ({ kind: "category", index: i }))));
1195
1245
  const estimate = (v, length) => {
1196
1246
  const s = axisScale(v.lo, v.hi, length, v.axis, v.frozen, v.headroom);
1197
- const info = scaleInfo(s, [0, 1], v.format);
1247
+ const info = scaleInfo(s, [0, 1], v.format, v.axis);
1198
1248
  return Math.max(0, ...s.ticks.map((t) => measure(info.tickText(t), fs)));
1199
1249
  };
1200
1250
  const valueLen0 = horizontal ? area.width : area.height;
1201
1251
  const valueLabelWidth = primary.axis.show ? estimate(primary, valueLen0) : 0;
1202
- const valueLabelWidth2 = _optionalChain([secondary, 'optionalAccess', _10 => _10.axis, 'access', _11 => _11.show]) ? estimate(secondary, valueLen0) : 0;
1252
+ const valueLabelWidth2 = _optionalChain([secondary, 'optionalAccess', _12 => _12.axis, 'access', _13 => _13.show]) ? estimate(secondary, valueLen0) : 0;
1203
1253
  const catLabelWidth = Math.max(0, ...labels.map((c) => measure(c, fs)));
1204
1254
  let left;
1205
1255
  let bottom;
@@ -1232,12 +1282,12 @@ function categoryFrame(ctx, area, input) {
1232
1282
  };
1233
1283
  const valueLen = horizontal ? plot.width : plot.height;
1234
1284
  const range = horizontal ? [plot.x, plot.x + plot.width] : [plot.y + plot.height, plot.y];
1235
- const value = scaleInfo(axisScale(primary.lo, primary.hi, valueLen, primary.axis, primary.frozen, primary.headroom), range, primary.format);
1236
- const value2 = secondary ? scaleInfo(axisScale(secondary.lo, secondary.hi, valueLen, secondary.axis, secondary.frozen, secondary.headroom), range, secondary.format) : void 0;
1285
+ const value = scaleInfo(axisScale(primary.lo, primary.hi, valueLen, primary.axis, primary.frozen, primary.headroom), range, primary.format, primary.axis);
1286
+ const value2 = secondary ? scaleInfo(axisScale(secondary.lo, secondary.hi, valueLen, secondary.axis, secondary.frozen, secondary.headroom), range, secondary.format, secondary.axis) : void 0;
1237
1287
  const catStart = horizontal ? plot.y : plot.x;
1238
1288
  const catLen = horizontal ? plot.height : plot.width;
1239
1289
  const band = catLen / n;
1240
- const catCenter = (i) => catStart + band * (i + 0.5);
1290
+ const catCenter = (i) => catStart + band * (xAxis.reverse ? n - i - 0.5 : i + 0.5);
1241
1291
  const map = (p) => horizontal ? [p.v, p.c] : [p.c, p.v];
1242
1292
  const gridAt = (info, key) => info.scale.ticks.forEach((t, i) => {
1243
1293
  const p = info.px(t);
@@ -1323,7 +1373,7 @@ function categoryFrame(ctx, area, input) {
1323
1373
  marks.push({ kind: "text", key: `axis-title-${horizontal ? "y" : "x"}`, role: "axis-title", x: plot.x + plot.width / 2, y: area.y + area.height, text: bottomTitle, anchor: "middle", baseline: "bottom", size: fs + 1, weight: 500, fill: theme.text, target: horizontal ? yTarget : xTarget });
1324
1374
  if (leftTitle)
1325
1375
  marks.push({ kind: "text", key: `axis-title-${horizontal ? "x" : "y"}`, role: "axis-title", x: area.x, y: plot.y + plot.height / 2, text: leftTitle, anchor: "middle", baseline: "top", size: fs + 1, weight: 500, fill: theme.text, rotate: -90, target: horizontal ? xTarget : yTarget });
1326
- if (_optionalChain([secondary, 'optionalAccess', _12 => _12.axis, 'access', _13 => _13.title])) {
1376
+ if (_optionalChain([secondary, 'optionalAccess', _14 => _14.axis, 'access', _15 => _15.title])) {
1327
1377
  const target = { kind: "axis", axis: "y2" };
1328
1378
  if (horizontal) marks.push({ kind: "text", key: "axis-title-y2", role: "axis-title", x: plot.x + plot.width / 2, y: area.y, text: secondary.axis.title, anchor: "middle", baseline: "top", size: fs + 1, weight: 500, fill: theme.text, target });
1329
1379
  else marks.push({ kind: "text", key: "axis-title-y2", role: "axis-title", x: area.x + area.width, y: plot.y + plot.height / 2, text: secondary.axis.title, anchor: "middle", baseline: "top", size: fs + 1, weight: 500, fill: theme.text, rotate: 90, target });
@@ -1341,20 +1391,29 @@ function categoryFrame(ctx, area, input) {
1341
1391
  }
1342
1392
  return { plot, horizontal, n, band, catStart, catLen, catCenter, map, value, value2 };
1343
1393
  }
1344
- var toValueScale = (info, axis) => ({ axis, domain: [info.scale.min, info.scale.max], range: info.range, ticks: info.scale.ticks });
1394
+ var toValueScale = (info, axis) => ({ axis, domain: [info.scale.min, info.scale.max], range: info.range, ticks: info.scale.ticks, ...info.logBase ? { logBase: info.logBase } : {} });
1395
+ function errorBarPath(map, c, a, b, width, capA, capB) {
1396
+ if (!Number.isFinite(a) || !Number.isFinite(b) || !Number.isFinite(c) || Math.abs(a - b) < 0.01 && !capA && !capB) return "";
1397
+ const at = (across, along) => map({ c: across, v: along }).map(r2).join(",");
1398
+ let d = `M${at(c, a)}L${at(c, b)}`;
1399
+ if (capA) d += `M${at(c - width / 2, a)}L${at(c + width / 2, a)}`;
1400
+ if (capB) d += `M${at(c - width / 2, b)}L${at(c + width / 2, b)}`;
1401
+ return d;
1402
+ }
1345
1403
  var order = (t) => t === "area" ? 0 : t === "bar" ? 1 : t === "line" ? 2 : 3;
1346
1404
  function pointMark(base, shape, cx, cy, r, fill, stroke, strokeWidth) {
1347
1405
  if (shape === "circle" || shape === "hit" || shape === "none") return { kind: "circle", role: "point", ...base, cx, cy, r, fill, ...stroke ? { stroke, strokeWidth } : {} };
1348
1406
  const closed = shape !== "cross";
1349
1407
  return { kind: "path", role: "point", ...base, d: markerPath(shape, cx, cy, r), fill: closed ? fill : "none", stroke: _nullishCoalesce(stroke, () => ( fill)), strokeWidth: _nullishCoalesce(strokeWidth, () => ( 2)) };
1350
1408
  }
1351
- function drawTrendlines(ctx, plot, series, color, points, toPx, labels) {
1409
+ function drawTrendlines(ctx, plot, series, color, points, toPx, labels, logAxis = false) {
1352
1410
  (_nullishCoalesce(series.trendlines, () => ( []))).forEach((t, ti) => {
1353
1411
  const target = { kind: "trendline", seriesId: series.id, index: ti };
1354
1412
  const selected = ctx.isSelected(target);
1355
1413
  const stroke = _nullishCoalesce(t.color, () => ( color));
1356
1414
  let px = [];
1357
- if (t.type === "moving-average") px = chartMovingAverage(points, _nullishCoalesce(t.period, () => ( 2))).map(([x, y]) => toPx(x, y));
1415
+ const finitePx = (q) => Number.isFinite(q[0]) && Number.isFinite(q[1]);
1416
+ if (t.type === "moving-average") px = chartMovingAverage(points, _nullishCoalesce(t.period, () => ( 2))).map(([x, y]) => toPx(x, y)).filter(finitePx);
1358
1417
  else {
1359
1418
  const fit = fitChartTrendline(t, points);
1360
1419
  if (!fit) {
@@ -1364,11 +1423,12 @@ function drawTrendlines(ctx, plot, series, color, points, toPx, labels) {
1364
1423
  const xs = points.map((p) => p[0]);
1365
1424
  const lo = Math.min(...xs) - (_nullishCoalesce(t.backward, () => ( 0)));
1366
1425
  const hi = Math.max(...xs) + (_nullishCoalesce(t.forward, () => ( 0)));
1367
- const steps = t.type === "linear" ? 1 : 200;
1426
+ const steps = t.type === "linear" && !logAxis ? 1 : 200;
1368
1427
  for (let k = 0; k <= steps; k++) {
1369
1428
  const x = lo + (hi - lo) * k / steps;
1370
1429
  const y = fit.evaluate(x);
1371
- if (y !== null) px.push(toPx(x, y));
1430
+ const q = y === null ? null : toPx(x, y);
1431
+ if (q && finitePx(q)) px.push(q);
1372
1432
  }
1373
1433
  if (t.showEquation) labels.push({ text: fit.equation, color: stroke, target });
1374
1434
  if (t.showR2) labels.push({ text: fit.r2 === null ? "R\xB2 = #N/A" : `R\xB2 = ${trendNumberText(fit.r2)}`, color: stroke, target });
@@ -1414,7 +1474,7 @@ function layoutCartesian(ctx, area, visible) {
1414
1474
  const { spec, theme, marks, measure, fs } = ctx;
1415
1475
  const horizontal = spec.orientation === "horizontal";
1416
1476
  const n = spec.categories.length;
1417
- const types = new Map(visible.map((s) => [s.id, _chunkJOX6MJW4cjs.chartSeriesType.call(void 0, spec, s)]));
1477
+ const types = new Map(visible.map((s) => [s.id, _chunkCKRNELPOcjs.chartSeriesType.call(void 0, spec, s)]));
1418
1478
  const stacked = spec.stacking !== "none";
1419
1479
  const percent = spec.stacking === "percent";
1420
1480
  const onSecondary = (s) => s.axis === "secondary";
@@ -1444,10 +1504,29 @@ function layoutCartesian(ctx, area, visible) {
1444
1504
  }
1445
1505
  }
1446
1506
  }
1507
+ const logOf = (secondary) => (secondary ? spec.yAxis2 : spec.yAxis).scale === "log";
1508
+ const errors = /* @__PURE__ */ new Map();
1509
+ for (const s of visible) {
1510
+ if (!s.errorBars) continue;
1511
+ const stack = stacks.get(s.id);
1512
+ errors.set(
1513
+ s.id,
1514
+ _chunkCKRNELPOcjs.chartErrorAmounts.call(void 0, s.errorBars, s.values).map((e, i) => {
1515
+ const raw = s.values[i];
1516
+ const seg = _optionalChain([stack, 'optionalAccess', _16 => _16.segments, 'access', _17 => _17[i]]);
1517
+ if (!e || raw === null || stack && !seg) return null;
1518
+ const k = seg && percent ? raw ? (seg[1] - seg[0]) / raw : 0 : 1;
1519
+ const center = (seg ? seg[1] : raw) + (e.center - raw) * k;
1520
+ return { center, lo: center - e.minus * k, hi: center + e.plus * k };
1521
+ })
1522
+ );
1523
+ }
1447
1524
  const range = (secondary) => {
1448
1525
  let lo = Infinity;
1449
1526
  let hi = -Infinity;
1527
+ const log = logOf(secondary);
1450
1528
  const see = (v) => {
1529
+ if (!Number.isFinite(v) || log && !(v > 0)) return;
1451
1530
  lo = Math.min(lo, v);
1452
1531
  hi = Math.max(hi, v);
1453
1532
  };
@@ -1455,13 +1534,18 @@ function layoutCartesian(ctx, area, visible) {
1455
1534
  for (const s of group) {
1456
1535
  const stack = stacks.get(s.id);
1457
1536
  if (stack) stack.segments.forEach((seg) => seg && (see(seg[0]), see(seg[1])));
1458
- else s.values.forEach((v) => v !== null && Number.isFinite(v) && see(v));
1537
+ else s.values.forEach((v) => v !== null && see(v));
1538
+ _optionalChain([errors, 'access', _18 => _18.get, 'call', _19 => _19(s.id), 'optionalAccess', _20 => _20.forEach, 'call', _21 => _21((e) => e && (see(e.lo), see(e.hi)))]);
1539
+ }
1540
+ if (log) {
1541
+ const skipped = group.reduce((t, s) => t + s.values.filter((v) => v !== null && Number.isFinite(v) && v <= 0).length, 0);
1542
+ if (skipped) ctx.warn("values-skipped", `${skipped} value${skipped === 1 ? "" : "s"} of 0 or less cannot be drawn on the logarithmic ${secondary ? "secondary " : ""}value axis and ${skipped === 1 ? "was" : "were"} skipped.`);
1459
1543
  }
1460
1544
  if (!Number.isFinite(lo)) {
1461
- lo = 0;
1462
- hi = 1;
1545
+ lo = log ? 1 : 0;
1546
+ hi = log ? 10 : 1;
1463
1547
  }
1464
- if (group.some((s) => types.get(s.id) === "bar" || types.get(s.id) === "area")) {
1548
+ if (!log && group.some((s) => types.get(s.id) === "bar" || types.get(s.id) === "area")) {
1465
1549
  lo = Math.min(lo, 0);
1466
1550
  hi = Math.max(hi, 0);
1467
1551
  }
@@ -1487,19 +1571,21 @@ function layoutCartesian(ctx, area, visible) {
1487
1571
  const barWidth = slots ? groupWidth / (slots - (slots - 1) * o) : 0;
1488
1572
  const slotOf = (s) => stacked ? barAxes.indexOf(onSecondary(s)) : bars.indexOf(s);
1489
1573
  const labelMarks = [];
1574
+ const errorMarks = [];
1490
1575
  const trendLabels = [];
1491
1576
  let hiddenLabels = 0;
1492
1577
  const trendsAllowed = chartSupportsTrendlines(spec.type, spec.stacking);
1493
1578
  const drawOrder = [...visible].sort((a, b) => order(types.get(a.id)) - order(types.get(b.id)));
1494
1579
  for (const s of drawOrder) {
1495
1580
  const si = spec.series.indexOf(s);
1496
- const color = _chunkJOX6MJW4cjs.chartSeriesColor.call(void 0, spec, si);
1581
+ const color = _chunkCKRNELPOcjs.chartSeriesColor.call(void 0, spec, si);
1497
1582
  const type = types.get(s.id);
1498
1583
  const stack = stacks.get(s.id);
1499
1584
  const selSeries = ctx.seriesSelected(s.id);
1500
1585
  const seriesTarget = { kind: "series", seriesId: s.id };
1501
1586
  const info = infoOf(s);
1502
1587
  const valuePx = info.px;
1588
+ const log = logOf(onSecondary(s));
1503
1589
  const labelsOn = (_nullishCoalesce(s.dataLabels, () => ( spec.dataLabels))) && s.values.length <= MAX_CHART_DATA_LABELS;
1504
1590
  if ((_nullishCoalesce(s.dataLabels, () => ( spec.dataLabels))) && !labelsOn) ctx.warn("data-labels-hidden", `Data labels are off for "${s.name}": it has more than ${MAX_CHART_DATA_LABELS} points.`);
1505
1591
  const labelFormat = _nullishCoalesce(s.format, () => ( info.format));
@@ -1509,6 +1595,7 @@ function layoutCartesian(ctx, area, visible) {
1509
1595
  s.values.forEach((raw, i) => {
1510
1596
  const seg = stack ? stack.segments[i] : raw === null ? null : [0, raw];
1511
1597
  if (!seg || raw === null || !Number.isFinite(raw)) return;
1598
+ if (log && (raw <= 0 || seg[1] <= 0)) return;
1512
1599
  const a = valuePx(seg[0]);
1513
1600
  const b = valuePx(seg[1]);
1514
1601
  const c0 = catCenter(i) - groupWidth / 2 + slot * barWidth * (1 - o);
@@ -1517,7 +1604,7 @@ function layoutCartesian(ctx, area, visible) {
1517
1604
  const selected = ctx.isSelected(target);
1518
1605
  const [x, y] = map({ c: c0, v: Math.min(a, b) });
1519
1606
  const rect = horizontal ? { x: Math.min(a, b), y: c0, width: Math.abs(b - a), height: cw } : { x, y, width: cw, height: Math.abs(b - a) };
1520
- const fill = _chunkJOX6MJW4cjs.chartPointColor.call(void 0, spec, si, i);
1607
+ const fill = _chunkCKRNELPOcjs.chartPointColor.call(void 0, spec, si, i);
1521
1608
  marks.push({
1522
1609
  kind: "rect",
1523
1610
  key: `bar-${s.id}-${i}`,
@@ -1533,7 +1620,8 @@ function layoutCartesian(ctx, area, visible) {
1533
1620
  if (labelsOn) {
1534
1621
  const v = percent ? seg[1] - seg[0] : raw;
1535
1622
  const text = dataLabel(v);
1536
- const at = barLabel(ctx, text, rect, horizontal, seg[1] >= seg[0], stacked, fill, plot);
1623
+ const grows = horizontal ? b >= a : b <= a;
1624
+ const at = barLabel(ctx, text, rect, horizontal, grows, stacked, fill, plot);
1537
1625
  if (!at) {
1538
1626
  hiddenLabels++;
1539
1627
  return;
@@ -1544,8 +1632,8 @@ function layoutCartesian(ctx, area, visible) {
1544
1632
  } else {
1545
1633
  const curve = _nullishCoalesce(s.curve, () => ( spec.curve));
1546
1634
  const pointValue = (i) => {
1547
- const v = stack ? _nullishCoalesce(_optionalChain([stack, 'access', _14 => _14.segments, 'access', _15 => _15[i], 'optionalAccess', _16 => _16[1]]), () => ( null)) : s.values[i];
1548
- return v !== null && Number.isFinite(v) ? v : null;
1635
+ const v = stack ? _nullishCoalesce(_optionalChain([stack, 'access', _22 => _22.segments, 'access', _23 => _23[i], 'optionalAccess', _24 => _24[1]]), () => ( null)) : s.values[i];
1636
+ return v !== null && Number.isFinite(v) && !(log && (v <= 0 || (_nullishCoalesce(s.values[i], () => ( 0))) <= 0)) ? v : null;
1549
1637
  };
1550
1638
  const runs = [];
1551
1639
  let run = [];
@@ -1556,7 +1644,7 @@ function layoutCartesian(ctx, area, visible) {
1556
1644
  run = [];
1557
1645
  continue;
1558
1646
  }
1559
- run.push({ c: catCenter(i), v: valuePx(v) });
1647
+ run.push({ c: catCenter(i), v: valuePx(v), i });
1560
1648
  }
1561
1649
  if (run.length) runs.push(run);
1562
1650
  const thin = (r) => {
@@ -1568,7 +1656,7 @@ function layoutCartesian(ctx, area, visible) {
1568
1656
  const drawn = runs.map(thin);
1569
1657
  if (type === "area") {
1570
1658
  const parts = drawn.map((r) => {
1571
- const baseline = stack ? r.map((pt) => ({ c: pt.c, v: valuePx(_nullishCoalesce(_optionalChain([stack, 'access', _17 => _17.segments, 'access', _18 => _18[Math.round((pt.c - catStart) / band - 0.5)], 'optionalAccess', _19 => _19[0]]), () => ( 0))) })).reverse() : [
1659
+ const baseline = stack ? r.map((pt) => ({ c: pt.c, v: valuePx(_nullishCoalesce(_optionalChain([stack, 'access', _25 => _25.segments, 'access', _26 => _26[pt.i], 'optionalAccess', _27 => _27[0]]), () => ( 0))) })).reverse() : [
1572
1660
  { c: r[r.length - 1].c, v: info.zero },
1573
1661
  { c: r[0].c, v: info.zero }
1574
1662
  ];
@@ -1595,7 +1683,7 @@ function layoutCartesian(ctx, area, visible) {
1595
1683
  const target = { kind: "point", seriesId: s.id, index: i };
1596
1684
  const selected = ctx.isSelected(target);
1597
1685
  const r = type === "scatter" ? 4.5 : 3.5;
1598
- const pointColor = _chunkJOX6MJW4cjs.chartPointColor.call(void 0, spec, si, i);
1686
+ const pointColor = _chunkCKRNELPOcjs.chartPointColor.call(void 0, spec, si, i);
1599
1687
  const fill = showDots ? type === "scatter" ? pointColor : theme.surface : "transparent";
1600
1688
  marks.push(
1601
1689
  pointMark({ key: `point-${s.id}-${i}`, target, selected: selected || selSeries, opacity: type === "scatter" ? 0.85 : void 0 }, showDots ? marker : "hit", cx, cy, showDots ? r : 6, fill, showDots ? pointColor : void 0, 2)
@@ -1620,14 +1708,26 @@ function layoutCartesian(ctx, area, visible) {
1620
1708
  }
1621
1709
  }
1622
1710
  }
1623
- if (trendsAllowed && _optionalChain([s, 'access', _20 => _20.trendlines, 'optionalAccess', _21 => _21.length])) {
1711
+ const errs = errors.get(s.id);
1712
+ if (errs) {
1713
+ const slot = type === "bar" ? slotOf(s) : 0;
1714
+ const capWidth = type === "bar" ? Math.min(10, barWidth * 0.5) : 8;
1715
+ const cap = s.errorBars.cap !== false;
1716
+ errs.forEach((e, i) => {
1717
+ if (!e || log && !((_nullishCoalesce(s.values[i], () => ( 0))) > 0)) return;
1718
+ const c = type === "bar" ? catCenter(i) - groupWidth / 2 + slot * barWidth * (1 - o) + barWidth / 2 : catCenter(i);
1719
+ const d = errorBarPath(map, c, valuePx(e.lo), valuePx(e.hi), capWidth, cap && e.lo < e.center, cap && e.hi > e.center);
1720
+ if (d) errorMarks.push({ kind: "path", key: `error-bar-${s.id}-${i}`, role: "error-bar", d, fill: "none", stroke: type === "bar" ? theme.text : color, strokeWidth: selSeries ? 2 : 1.25, target: seriesTarget, selected: selSeries });
1721
+ });
1722
+ }
1723
+ if (trendsAllowed && _optionalChain([s, 'access', _28 => _28.trendlines, 'optionalAccess', _29 => _29.length])) {
1624
1724
  const points = [];
1625
1725
  s.values.forEach((v, i) => v !== null && Number.isFinite(v) && points.push([i + 1, v]));
1626
- const toPx = (x, y) => map({ c: catStart + band * (x - 0.5), v: info.raw(y) });
1627
- drawTrendlines(ctx, plot, s, color, points, toPx, trendLabels);
1726
+ const toPx = (x, y) => map({ c: catCenter(x - 1), v: info.raw(y) });
1727
+ drawTrendlines(ctx, plot, s, color, points, toPx, trendLabels, !!info.logBase);
1628
1728
  }
1629
1729
  }
1630
- marks.push(...labelMarks);
1730
+ marks.push(...errorMarks, ...labelMarks);
1631
1731
  drawTrendLabels(ctx, plot, trendLabels);
1632
1732
  if (hiddenLabels) ctx.warn("data-labels-hidden", `${hiddenLabels} data label${hiddenLabels === 1 ? "" : "s"} did not fit and ${hiddenLabels === 1 ? "is" : "are"} hidden.`);
1633
1733
  return {
@@ -1640,33 +1740,60 @@ function layoutCartesian(ctx, area, visible) {
1640
1740
  function layoutXy(ctx, area, visible) {
1641
1741
  const { spec, theme, marks, measure, fs } = ctx;
1642
1742
  const bubble = spec.type === "bubble";
1643
- const pointsOf = (s) => s.values.map((y, i) => ({ i, x: _nullishCoalesce(_optionalChain([s, 'access', _22 => _22.x, 'optionalAccess', _23 => _23[i]]), () => ( (bubble || !s.x ? i + 1 : null))), y, size: _nullishCoalesce(_optionalChain([s, 'access', _24 => _24.sizes, 'optionalAccess', _25 => _25[i]]), () => ( null)) })).filter((p) => p.x !== null && p.y !== null && Number.isFinite(p.x) && Number.isFinite(p.y));
1743
+ const yAxis = spec.yAxis;
1744
+ const xAxis = spec.xAxis;
1745
+ const xLog = xAxis.scale === "log";
1746
+ const yLog = yAxis.scale === "log";
1747
+ let skipped = 0;
1748
+ const pointsOf = (s) => s.values.map((y, i) => ({ i, x: _nullishCoalesce(_optionalChain([s, 'access', _30 => _30.x, 'optionalAccess', _31 => _31[i]]), () => ( (bubble || !s.x ? i + 1 : null))), y, size: _nullishCoalesce(_optionalChain([s, 'access', _32 => _32.sizes, 'optionalAccess', _33 => _33[i]]), () => ( null)) })).filter((p) => {
1749
+ if (p.x === null || p.y === null || !Number.isFinite(p.x) || !Number.isFinite(p.y)) return false;
1750
+ if (xLog && p.x <= 0 || yLog && p.y <= 0) return skipped++, false;
1751
+ return true;
1752
+ });
1644
1753
  const all = visible.map((s) => ({ s, pts: pointsOf(s) }));
1754
+ if (skipped) ctx.warn("values-skipped", `${skipped} point${skipped === 1 ? "" : "s"} with a value of 0 or less cannot be drawn on the logarithmic ${xLog && yLog ? "axes" : xLog ? "x axis" : "value axis"} and ${skipped === 1 ? "was" : "were"} skipped.`);
1755
+ const yErrors = /* @__PURE__ */ new Map();
1756
+ const xErrors = /* @__PURE__ */ new Map();
1757
+ for (const { s } of all) {
1758
+ if (s.errorBars) yErrors.set(s.id, _chunkCKRNELPOcjs.chartErrorAmounts.call(void 0, s.errorBars, s.values));
1759
+ if (s.xErrorBars) xErrors.set(s.id, _chunkCKRNELPOcjs.chartErrorAmounts.call(void 0, s.xErrorBars, s.values.map((_, i) => _nullishCoalesce(_optionalChain([s, 'access', _34 => _34.x, 'optionalAccess', _35 => _35[i]]), () => ( (bubble || !s.x ? i + 1 : null))))));
1760
+ }
1645
1761
  let xlo = Infinity;
1646
1762
  let xhi = -Infinity;
1647
1763
  let ylo = Infinity;
1648
1764
  let yhi = -Infinity;
1649
1765
  let maxSize = 0;
1766
+ const seeX = (v) => {
1767
+ if (!Number.isFinite(v) || xLog && !(v > 0)) return;
1768
+ xlo = Math.min(xlo, v);
1769
+ xhi = Math.max(xhi, v);
1770
+ };
1771
+ const seeY = (v) => {
1772
+ if (!Number.isFinite(v) || yLog && !(v > 0)) return;
1773
+ ylo = Math.min(ylo, v);
1774
+ yhi = Math.max(yhi, v);
1775
+ };
1650
1776
  for (const { s, pts } of all) {
1651
1777
  for (const p of pts) {
1652
- xlo = Math.min(xlo, p.x);
1653
- xhi = Math.max(xhi, p.x);
1654
- ylo = Math.min(ylo, p.y);
1655
- yhi = Math.max(yhi, p.y);
1778
+ seeX(p.x);
1779
+ seeY(p.y);
1656
1780
  if (p.size !== null && p.size > maxSize) maxSize = p.size;
1781
+ const ey = _optionalChain([yErrors, 'access', _36 => _36.get, 'call', _37 => _37(s.id), 'optionalAccess', _38 => _38[p.i]]);
1782
+ if (ey) seeY(ey.center - ey.minus), seeY(ey.center + ey.plus);
1783
+ const ex = _optionalChain([xErrors, 'access', _39 => _39.get, 'call', _40 => _40(s.id), 'optionalAccess', _41 => _41[p.i]]);
1784
+ if (ex) seeX(ex.center - ex.minus), seeX(ex.center + ex.plus);
1657
1785
  }
1658
1786
  for (const t of _nullishCoalesce(s.trendlines, () => ( []))) {
1659
1787
  if (!pts.length) continue;
1660
- xlo = Math.min(xlo, Math.min(...pts.map((p) => p.x)) - (_nullishCoalesce(t.backward, () => ( 0))));
1661
- xhi = Math.max(xhi, Math.max(...pts.map((p) => p.x)) + (_nullishCoalesce(t.forward, () => ( 0))));
1788
+ seeX(Math.min(...pts.map((p) => p.x)) - (_nullishCoalesce(t.backward, () => ( 0))));
1789
+ seeX(Math.max(...pts.map((p) => p.x)) + (_nullishCoalesce(t.forward, () => ( 0))));
1662
1790
  }
1663
1791
  }
1664
- if (!Number.isFinite(xlo)) [xlo, xhi, ylo, yhi] = [0, 1, 0, 1];
1792
+ if (!Number.isFinite(xlo)) [xlo, xhi] = xLog ? [1, 10] : [0, 1];
1793
+ if (!Number.isFinite(ylo)) [ylo, yhi] = yLog ? [1, 10] : [0, 1];
1665
1794
  const titleBand = fs * 1.3 + 6;
1666
- const yAxis = spec.yAxis;
1667
- const xAxis = spec.xAxis;
1668
1795
  const yEst = axisScale(ylo, yhi, area.height, yAxis, ctx.options.valueDomain, true);
1669
- const yText = (t, step) => formatChartNumber(t, yAxis.format, _nullishCoalesce(yAxis.format.decimals, () => ( stepDecimals(step))));
1796
+ const yText = (t, step) => formatChartNumber(t, yAxis.format, _nullishCoalesce(yAxis.format.decimals, () => ( (yLog ? void 0 : stepDecimals(step)))));
1670
1797
  const left = (yAxis.show ? Math.max(0, ...yEst.ticks.map((t) => measure(yText(t, yEst.step), fs))) + 8 : 2) + (yAxis.title ? titleBand : 0);
1671
1798
  const bottom = (xAxis.show ? fs * 1.6 : 2) + (xAxis.title ? titleBand : 0);
1672
1799
  const plot = { x: area.x + left, y: area.y + fs / 2 + 2, width: Math.max(1, area.width - left - 12), height: Math.max(1, area.height - bottom - fs / 2 - 2) };
@@ -1676,21 +1803,21 @@ function layoutXy(ctx, area, visible) {
1676
1803
  const xScale = axisScale(xlo, xhi, plot.width, xAxis, ctx.options.xDomain, true);
1677
1804
  const xRange = [plot.x + inset, plot.x + plot.width - inset];
1678
1805
  const yRange = [plot.y + plot.height - inset, plot.y + inset];
1679
- const xRaw = (x) => linearMap(x, [xScale.min, xScale.max], xRange);
1680
- const yRaw = (y) => linearMap(y, [yScale.min, yScale.max], yRange);
1681
- const xPx = (x) => xRaw(Math.min(xScale.max, Math.max(xScale.min, x)));
1682
- const yPx = (y) => yRaw(Math.min(yScale.max, Math.max(yScale.min, y)));
1806
+ const xInfo = scaleInfo(xScale, xRange, xAxis.format, xAxis);
1807
+ const yInfo = scaleInfo(yScale, yRange, yAxis.format, yAxis);
1808
+ const { raw: xRaw, px: xPx } = xInfo;
1809
+ const { raw: yRaw, px: yPx } = yInfo;
1683
1810
  const xTarget = { kind: "axis", axis: "x" };
1684
1811
  const yTarget = { kind: "axis", axis: "y" };
1685
1812
  if (yAxis.gridlines) yScale.ticks.forEach((t, i) => marks.push({ kind: "line", key: `grid-y-${i}`, role: "grid", x1: plot.x, y1: yPx(t), x2: plot.x + plot.width, y2: yPx(t), stroke: theme.grid, strokeWidth: 1 }));
1686
1813
  if (xAxis.gridlines) xScale.ticks.forEach((t, i) => marks.push({ kind: "line", key: `grid-x-${i}`, role: "grid", x1: xPx(t), y1: plot.y, x2: xPx(t), y2: plot.y + plot.height, stroke: theme.grid, strokeWidth: 1 }));
1687
1814
  if (yAxis.show) yScale.ticks.forEach((t, i) => marks.push({ kind: "text", key: `tick-y-${i}`, role: "tick-label", x: plot.x - 8, y: yPx(t), text: yText(t, yScale.step), anchor: "end", baseline: "middle", size: fs, fill: theme.mutedText, target: yTarget }));
1688
1815
  if (xAxis.show) {
1689
- const y0 = yScale.min <= 0 && yScale.max >= 0 ? yPx(0) : plot.y + plot.height;
1816
+ const y0 = !yLog && yScale.min <= 0 && yScale.max >= 0 ? yPx(0) : yAxis.reverse ? plot.y : plot.y + plot.height;
1690
1817
  marks.push({ kind: "line", key: "axis-x", role: "axis", x1: plot.x, y1: y0, x2: plot.x + plot.width, y2: y0, stroke: theme.axis, strokeWidth: 1, target: xTarget });
1691
- const texts = xScale.ticks.map((t) => formatChartNumber(t, xAxis.format, _nullishCoalesce(xAxis.format.decimals, () => ( stepDecimals(xScale.step)))));
1818
+ const texts = xScale.ticks.map((t) => formatChartNumber(t, xAxis.format, _nullishCoalesce(xAxis.format.decimals, () => ( (xLog ? void 0 : stepDecimals(xScale.step))))));
1692
1819
  const widest = Math.max(0, ...texts.map((t) => measure(t, fs)));
1693
- const spacing = xScale.ticks.length > 1 ? Math.abs(xPx(xScale.ticks[1]) - xPx(xScale.ticks[0])) : Infinity;
1820
+ const spacing = Math.min(Infinity, ...xScale.ticks.slice(1).map((t, i) => Math.abs(xPx(t) - xPx(xScale.ticks[i]))));
1694
1821
  const every = Math.max(1, Math.ceil((widest + 8) / spacing));
1695
1822
  xScale.ticks.forEach((t, i) => {
1696
1823
  if (i % every) return;
@@ -1704,11 +1831,12 @@ function layoutXy(ctx, area, visible) {
1704
1831
  ctx.outline(`axis-${axis}-selection`, axis === "y" ? { x: area.x, y: plot.y - fs / 2, width: left - 2, height: plot.height + fs } : { x: plot.x - 4, y: plot.y + plot.height + 2, width: plot.width + 8, height: area.y + area.height - plot.y - plot.height - 2 });
1705
1832
  }
1706
1833
  const labelMarks = [];
1834
+ const errorMarks = [];
1707
1835
  const trendLabels = [];
1708
1836
  for (const { s, pts } of all) {
1709
1837
  const si = spec.series.indexOf(s);
1710
- const color = _chunkJOX6MJW4cjs.chartSeriesColor.call(void 0, spec, si);
1711
- const type = _chunkJOX6MJW4cjs.chartSeriesType.call(void 0, spec, s);
1838
+ const color = _chunkCKRNELPOcjs.chartSeriesColor.call(void 0, spec, si);
1839
+ const type = _chunkCKRNELPOcjs.chartSeriesType.call(void 0, spec, s);
1712
1840
  const selSeries = ctx.seriesSelected(s.id);
1713
1841
  const seriesTarget = { kind: "series", seriesId: s.id };
1714
1842
  if (type === "line" || type === "area") {
@@ -1733,21 +1861,39 @@ function layoutXy(ctx, area, visible) {
1733
1861
  }
1734
1862
  const target = { kind: "point", seriesId: s.id, index: p.i };
1735
1863
  const selected = ctx.isSelected(target);
1736
- const pointColor = _chunkJOX6MJW4cjs.chartPointColor.call(void 0, spec, si, p.i);
1864
+ const pointColor = _chunkCKRNELPOcjs.chartPointColor.call(void 0, spec, si, p.i);
1737
1865
  const r = bubble ? maxSize > 0 && p.size !== null && p.size > 0 ? Math.max(2, Math.sqrt(p.size / maxSize) * maxR) : 2 : 4.5;
1738
1866
  if (bubble) marks.push({ kind: "circle", key: `point-${s.id}-${p.i}`, role: "point", cx, cy, r, fill: pointColor, stroke: pointColor, strokeWidth: 1, opacity: 0.6, target, selected: selected || selSeries });
1739
1867
  else marks.push(pointMark({ key: `point-${s.id}-${p.i}`, target, selected: selected || selSeries, opacity: 0.85 }, marker === "none" ? "hit" : marker, cx, cy, marker === "none" ? 6 : r, marker === "none" ? "transparent" : pointColor, marker === "none" ? void 0 : pointColor, 2));
1740
1868
  if (selected) marks.push({ kind: "circle", key: `point-${s.id}-${p.i}-selection`, role: "selection", cx, cy, r: r + 3.5, fill: "none", stroke: theme.selection, strokeWidth: 1.5 });
1741
1869
  if (labelsOn) labelMarks.push({ kind: "text", key: `label-${s.id}-${p.i}`, role: "data-label", x: cx, y: cy - r - 4, text: formatChartNumber(p.y, labelFormat), anchor: "middle", baseline: "bottom", size: fs - 1, fill: theme.text, target });
1742
1870
  }
1743
- if (_optionalChain([s, 'access', _26 => _26.trendlines, 'optionalAccess', _27 => _27.length])) drawTrendlines(ctx, plot, s, color, pts.map((p) => [p.x, p.y]), (x, y) => [xRaw(x), yRaw(y)], trendLabels);
1871
+ const stroke = color;
1872
+ const errorBar = (key, d) => d && errorMarks.push({ kind: "path", key, role: "error-bar", d, fill: "none", stroke, strokeWidth: selSeries ? 2 : 1.25, target: seriesTarget, selected: selSeries });
1873
+ for (const p of pts) {
1874
+ const ey = _optionalChain([yErrors, 'access', _42 => _42.get, 'call', _43 => _43(s.id), 'optionalAccess', _44 => _44[p.i]]);
1875
+ if (ey) {
1876
+ const lo = ey.center - ey.minus;
1877
+ const hi = ey.center + ey.plus;
1878
+ const cap = s.errorBars.cap !== false;
1879
+ errorBar(`error-bar-${s.id}-${p.i}`, errorBarPath((q) => [q.c, q.v], xPx(p.x), yPx(lo), yPx(hi), 8, cap && lo < ey.center, cap && hi > ey.center));
1880
+ }
1881
+ const ex = _optionalChain([xErrors, 'access', _45 => _45.get, 'call', _46 => _46(s.id), 'optionalAccess', _47 => _47[p.i]]);
1882
+ if (ex) {
1883
+ const lo = ex.center - ex.minus;
1884
+ const hi = ex.center + ex.plus;
1885
+ const cap = s.xErrorBars.cap !== false;
1886
+ errorBar(`error-bar-x-${s.id}-${p.i}`, errorBarPath((q) => [q.v, q.c], yPx(p.y), xPx(lo), xPx(hi), 8, cap && lo < ex.center, cap && hi > ex.center));
1887
+ }
1888
+ }
1889
+ if (_optionalChain([s, 'access', _48 => _48.trendlines, 'optionalAccess', _49 => _49.length])) drawTrendlines(ctx, plot, s, color, pts.map((p) => [p.x, p.y]), (x, y) => [xRaw(x), yRaw(y)], trendLabels, xLog || yLog);
1744
1890
  }
1745
- marks.push(...labelMarks);
1891
+ marks.push(...errorMarks, ...labelMarks);
1746
1892
  drawTrendLabels(ctx, plot, trendLabels);
1747
1893
  return {
1748
1894
  plot,
1749
- valueScale: { axis: "y", domain: [yScale.min, yScale.max], range: yRange, ticks: yScale.ticks },
1750
- xScale: { axis: "x", domain: [xScale.min, xScale.max], range: xRange, ticks: xScale.ticks }
1895
+ valueScale: toValueScale(yInfo, "y"),
1896
+ xScale: toValueScale(xInfo, "x")
1751
1897
  };
1752
1898
  }
1753
1899
  function trendlineLegendItems(spec, color) {
@@ -1758,7 +1904,7 @@ function trendlineLegendItems(spec, color) {
1758
1904
  }
1759
1905
 
1760
1906
  // src/chart/layout-families.ts
1761
- var sliceColor = (ctx, series, i) => _optionalChain([series, 'access', _28 => _28.pointColors, 'optionalAccess', _29 => _29[i]]) || _chunkJOX6MJW4cjs.chartSliceColor.call(void 0, ctx.spec, i);
1907
+ var sliceColor = (ctx, series, i) => _optionalChain([series, 'access', _50 => _50.pointColors, 'optionalAccess', _51 => _51[i]]) || _chunkCKRNELPOcjs.chartSliceColor.call(void 0, ctx.spec, i);
1762
1908
  function layoutPie(ctx, area, series) {
1763
1909
  const { spec, theme, marks, fs, selection } = ctx;
1764
1910
  const values = spec.categories.map((_, i) => {
@@ -1788,7 +1934,7 @@ function layoutPie(ctx, area, series) {
1788
1934
  angle = end;
1789
1935
  const target = { kind: "point", seriesId: series.id, index: i };
1790
1936
  const selected = ctx.isSelected(target) || ctx.isSelected({ kind: "category", index: i });
1791
- const seriesSel = _optionalChain([selection, 'optionalAccess', _30 => _30.kind]) === "series" && selection.seriesId === series.id;
1937
+ const seriesSel = _optionalChain([selection, 'optionalAccess', _52 => _52.kind]) === "series" && selection.seriesId === series.id;
1792
1938
  const mid = (start + end) / 2;
1793
1939
  const off = selected ? 6 : 0;
1794
1940
  const ox = cx + off * Math.sin(mid);
@@ -1865,7 +2011,7 @@ function layoutRadar(ctx, area, visible) {
1865
2011
  });
1866
2012
  for (const s of visible) {
1867
2013
  const si = spec.series.indexOf(s);
1868
- const color = _chunkJOX6MJW4cjs.chartSeriesColor.call(void 0, spec, si);
2014
+ const color = _chunkCKRNELPOcjs.chartSeriesColor.call(void 0, spec, si);
1869
2015
  const selSeries = ctx.seriesSelected(s.id);
1870
2016
  const pts = s.values.map((v, i) => v !== null && Number.isFinite(v) ? at(i, rOf(v)) : null);
1871
2017
  const present = pts.filter((p) => p !== null);
@@ -1915,7 +2061,7 @@ function layoutWaterfall(ctx, area, series) {
1915
2061
  });
1916
2062
  const { band, catCenter, map, value } = frame;
1917
2063
  const w = band * (1 - spec.gapWidth);
1918
- const color = _chunkJOX6MJW4cjs.chartSeriesColor.call(void 0, spec, spec.series.indexOf(series));
2064
+ const color = _chunkCKRNELPOcjs.chartSeriesColor.call(void 0, spec, spec.series.indexOf(series));
1919
2065
  const format = _nullishCoalesce(series.format, () => ( spec.yAxis.format));
1920
2066
  const labelsOn = _nullishCoalesce(series.dataLabels, () => ( spec.dataLabels));
1921
2067
  let prevEnd = null;
@@ -1974,7 +2120,7 @@ function layoutHistogram(ctx, area, visible) {
1974
2120
  const gap = k > 1 ? band * spec.gapWidth * 0.5 : 0;
1975
2121
  const w = (band - gap) / k;
1976
2122
  visible.forEach((s, si) => {
1977
- const color = _chunkJOX6MJW4cjs.chartSeriesColor.call(void 0, spec, spec.series.indexOf(s));
2123
+ const color = _chunkCKRNELPOcjs.chartSeriesColor.call(void 0, spec, spec.series.indexOf(s));
1978
2124
  const target = { kind: "series", seriesId: s.id };
1979
2125
  const selected = ctx.seriesSelected(s.id);
1980
2126
  counts[si].forEach((c, b) => {
@@ -2005,7 +2151,7 @@ function layoutBox(ctx, area, visible) {
2005
2151
  visible.forEach((s, i) => {
2006
2152
  const st = stats[i];
2007
2153
  if (!st) return;
2008
- const color = _chunkJOX6MJW4cjs.chartSeriesColor.call(void 0, spec, spec.series.indexOf(s));
2154
+ const color = _chunkCKRNELPOcjs.chartSeriesColor.call(void 0, spec, spec.series.indexOf(s));
2009
2155
  const target = { kind: "series", seriesId: s.id };
2010
2156
  const selected = ctx.seriesSelected(s.id);
2011
2157
  const c = catCenter(i);
@@ -2091,13 +2237,13 @@ function layoutTreemap(ctx, area, series) {
2091
2237
 
2092
2238
  // src/chart/layout.ts
2093
2239
  function legendItems(spec, ctx) {
2094
- const family = _chunkJOX6MJW4cjs.chartFamily.call(void 0, spec);
2240
+ const family = _chunkCKRNELPOcjs.chartFamily.call(void 0, spec);
2095
2241
  if (spec.type === "funnel") return [];
2096
- if (_chunkJOX6MJW4cjs.chartColorsByCategory.call(void 0, spec.type)) {
2242
+ if (_chunkCKRNELPOcjs.chartColorsByCategory.call(void 0, spec.type)) {
2097
2243
  const first = spec.series.find((s) => !s.hidden);
2098
2244
  return spec.categories.map((c, i) => ({
2099
2245
  label: c,
2100
- color: _optionalChain([first, 'optionalAccess', _31 => _31.pointColors, 'optionalAccess', _32 => _32[i]]) || _chunkJOX6MJW4cjs.chartSliceColor.call(void 0, spec, i),
2246
+ color: _optionalChain([first, 'optionalAccess', _53 => _53.pointColors, 'optionalAccess', _54 => _54[i]]) || _chunkCKRNELPOcjs.chartSliceColor.call(void 0, spec, i),
2101
2247
  target: { kind: "category", index: i },
2102
2248
  faded: false,
2103
2249
  selected: ctx.isSelected({ kind: "category", index: i }),
@@ -2111,17 +2257,17 @@ function legendItems(spec, ctx) {
2111
2257
  return [
2112
2258
  { label: "Increase", color: ctx.theme.positive, target, faded: false, selected: false, shape: "square" },
2113
2259
  { label: "Decrease", color: ctx.theme.negative, target, faded: false, selected: false, shape: "square" },
2114
- { label: "Total", color: _chunkJOX6MJW4cjs.chartSeriesColor.call(void 0, spec, spec.series.indexOf(first)), target, faded: false, selected: false, shape: "square" }
2260
+ { label: "Total", color: _chunkCKRNELPOcjs.chartSeriesColor.call(void 0, spec, spec.series.indexOf(first)), target, faded: false, selected: false, shape: "square" }
2115
2261
  ];
2116
2262
  }
2117
2263
  if (family === "box") return [];
2118
- const trends = trendlineLegendItems(spec, (i) => _chunkJOX6MJW4cjs.chartSeriesColor.call(void 0, spec, i));
2264
+ const trends = trendlineLegendItems(spec, (i) => _chunkCKRNELPOcjs.chartSeriesColor.call(void 0, spec, i));
2119
2265
  const items = [];
2120
2266
  spec.series.forEach((s, i) => {
2121
- const type = _chunkJOX6MJW4cjs.chartSeriesType.call(void 0, spec, s);
2267
+ const type = _chunkCKRNELPOcjs.chartSeriesType.call(void 0, spec, s);
2122
2268
  items.push({
2123
2269
  label: s.name,
2124
- color: _chunkJOX6MJW4cjs.chartSeriesColor.call(void 0, spec, i),
2270
+ color: _chunkCKRNELPOcjs.chartSeriesColor.call(void 0, spec, i),
2125
2271
  target: { kind: "series", seriesId: s.id },
2126
2272
  faded: !!s.hidden,
2127
2273
  selected: ctx.seriesSelected(s.id),
@@ -2134,7 +2280,7 @@ function legendItems(spec, ctx) {
2134
2280
  function layoutChart(spec, options) {
2135
2281
  const width = Math.max(1, Number.isFinite(options.width) ? options.width : 1);
2136
2282
  const height = Math.max(1, Number.isFinite(options.height) ? options.height : 1);
2137
- const theme = { ..._chunkJOX6MJW4cjs.DEFAULT_CHART_THEME, ...options.theme };
2283
+ const theme = { ..._chunkCKRNELPOcjs.DEFAULT_CHART_THEME, ...options.theme };
2138
2284
  const selection = _nullishCoalesce(options.selection, () => ( null));
2139
2285
  const marks = [];
2140
2286
  const warnings = [];
@@ -2150,7 +2296,7 @@ function layoutChart(spec, options) {
2150
2296
  warnings,
2151
2297
  selection,
2152
2298
  isSelected: (target) => sameChartSelection(selection, target),
2153
- seriesSelected: (id) => _optionalChain([selection, 'optionalAccess', _33 => _33.kind]) === "series" && selection.seriesId === id,
2299
+ seriesSelected: (id) => _optionalChain([selection, 'optionalAccess', _55 => _55.kind]) === "series" && selection.seriesId === id,
2154
2300
  outline: (key, box) => marks.push({ kind: "rect", key, role: "selection", ...box, fill: "none", stroke: theme.selection, strokeWidth: 1, radius: 3 }),
2155
2301
  warn: (code, message) => {
2156
2302
  if (!warnings.some((w) => w.code === code && w.message === message)) warnings.push({ code, message });
@@ -2173,7 +2319,7 @@ function layoutChart(spec, options) {
2173
2319
  if (spec.title) titleMark("title", spec.title, theme.titleSize, 600, theme.text);
2174
2320
  if (spec.subtitle) titleMark("subtitle", spec.subtitle, fs + 1, 400, theme.mutedText);
2175
2321
  if (spec.title || spec.subtitle) top += 6;
2176
- const family = _chunkJOX6MJW4cjs.chartFamily.call(void 0, spec);
2322
+ const family = _chunkCKRNELPOcjs.chartFamily.call(void 0, spec);
2177
2323
  const visible = spec.series.filter((s) => !s.hidden);
2178
2324
  const items = legendItems(spec, ctx);
2179
2325
  let area = { x: pad, y: top, width: width - pad * 2, height: height - top - pad };
@@ -2307,9 +2453,9 @@ function layoutLegend(items, position, area, ctx, legendSelected) {
2307
2453
  function addReadout(ctx, readout, plot) {
2308
2454
  const { spec, marks, theme, fs, measure } = ctx;
2309
2455
  const series = spec.series.find((s) => s.id === readout.seriesId);
2310
- const value = _optionalChain([series, 'optionalAccess', _34 => _34.values, 'access', _35 => _35[readout.index]]);
2456
+ const value = _optionalChain([series, 'optionalAccess', _56 => _56.values, 'access', _57 => _57[readout.index]]);
2311
2457
  if (!series || value === null || value === void 0) return;
2312
- const mark = marks.find((m) => (m.role === "point" || m.role === "bar") && _optionalChain([m, 'access', _36 => _36.target, 'optionalAccess', _37 => _37.kind]) === "point" && m.target.seriesId === readout.seriesId && m.target.index === readout.index);
2458
+ const mark = marks.find((m) => (m.role === "point" || m.role === "bar") && _optionalChain([m, 'access', _58 => _58.target, 'optionalAccess', _59 => _59.kind]) === "point" && m.target.seriesId === readout.seriesId && m.target.index === readout.index);
2313
2459
  if (!mark) return;
2314
2460
  let ax;
2315
2461
  let ay;
@@ -2321,8 +2467,8 @@ function addReadout(ctx, readout, plot) {
2321
2467
  ay = mark.cy - mark.r;
2322
2468
  } else return;
2323
2469
  const axis = series.axis === "secondary" ? spec.yAxis2 : spec.yAxis;
2324
- const x = _optionalChain([series, 'access', _38 => _38.x, 'optionalAccess', _39 => _39[readout.index]]);
2325
- const text = x !== null && x !== void 0 && _chunkJOX6MJW4cjs.chartFamily.call(void 0, spec) === "xy" ? `${formatChartNumber(x, spec.xAxis.format)}, ${formatChartNumber(value, axis.format)}` : `${_nullishCoalesce(spec.categories[readout.index], () => ( ""))}: ${formatChartNumber(value, _nullishCoalesce(series.format, () => ( axis.format)))}`;
2470
+ const x = _optionalChain([series, 'access', _60 => _60.x, 'optionalAccess', _61 => _61[readout.index]]);
2471
+ const text = x !== null && x !== void 0 && _chunkCKRNELPOcjs.chartFamily.call(void 0, spec) === "xy" ? `${formatChartNumber(x, spec.xAxis.format)}, ${formatChartNumber(value, axis.format)}` : `${_nullishCoalesce(spec.categories[readout.index], () => ( ""))}: ${formatChartNumber(value, _nullishCoalesce(series.format, () => ( axis.format)))}`;
2326
2472
  const w = measure(text, fs, 600) + 10;
2327
2473
  const h = fs + 8;
2328
2474
  const bx = Math.max(plot.x, Math.min(plot.x + plot.width - w, ax - w / 2));
@@ -2364,14 +2510,15 @@ function chartValueAtPoint(scene, point, secondary = false) {
2364
2510
  const scale = secondary ? _nullishCoalesce(scene.valueScale2, () => ( scene.valueScale)) : scene.valueScale;
2365
2511
  if (!scale || scene.percent) return void 0;
2366
2512
  const px = scale.axis === "y" ? point.y : point.x;
2367
- return linearMap(px, scale.range, scale.domain);
2513
+ return chartScaleFromPixel(px, scale);
2368
2514
  }
2369
2515
  function chartXAtPoint(scene, point) {
2370
2516
  const scale = scene.xScale;
2371
2517
  if (!scale) return void 0;
2372
- return linearMap(point.x, scale.range, scale.domain);
2518
+ return chartScaleFromPixel(point.x, scale);
2373
2519
  }
2374
- function snapChartValue(scene, value, step, ticks = _nullishCoalesce(_optionalChain([scene, 'access', _40 => _40.valueScale, 'optionalAccess', _41 => _41.ticks]), () => ( []))) {
2520
+ function snapChartValue(scene, value, step, ticks = _nullishCoalesce(_optionalChain([scene, 'access', _62 => _62.valueScale, 'optionalAccess', _63 => _63.ticks]), () => ( [])), logBase) {
2521
+ if (logBase && step === void 0) return value > 0 && Number.isFinite(value) ? Number(value.toPrecision(2)) : value;
2375
2522
  const unit = _nullishCoalesce(step, () => ( (ticks.length > 1 ? (ticks[1] - ticks[0]) / 10 : 1)));
2376
2523
  if (!(unit > 0)) return value;
2377
2524
  const snapped = Math.round(value / unit) * unit;
@@ -2382,26 +2529,26 @@ function snapChartValue(scene, value, step, ticks = _nullishCoalesce(_optionalCh
2382
2529
  function summarizeChart(spec, size = { width: 640, height: 400 }, scene = layoutChart(spec, { ...size, selection: null })) {
2383
2530
  const visible = spec.series.filter((s) => !s.hidden);
2384
2531
  const series = visible.map((s) => summarizeChartSeries(s, spec.categories));
2385
- const colors = _chunkJOX6MJW4cjs.chartColorsByCategory.call(void 0, spec.type) ? spec.categories.map((_, i) => _optionalChain([visible, 'access', _42 => _42[0], 'optionalAccess', _43 => _43.pointColors, 'optionalAccess', _44 => _44[i]]) || _chunkJOX6MJW4cjs.chartSliceColor.call(void 0, spec, i)) : visible.map((s) => _chunkJOX6MJW4cjs.chartSeriesColor.call(void 0, spec, spec.series.indexOf(s)));
2386
- const check = _chunkJOX6MJW4cjs.checkChartColors.call(void 0, colors, { surface: scene.theme.surface.startsWith("var(") ? "#ffffff" : scene.theme.surface });
2387
- const axis = (s) => s ? { min: s.domain[0], max: s.domain[1], ticks: [...s.ticks] } : void 0;
2532
+ const colors = _chunkCKRNELPOcjs.chartColorsByCategory.call(void 0, spec.type) ? spec.categories.map((_, i) => _optionalChain([visible, 'access', _64 => _64[0], 'optionalAccess', _65 => _65.pointColors, 'optionalAccess', _66 => _66[i]]) || _chunkCKRNELPOcjs.chartSliceColor.call(void 0, spec, i)) : visible.map((s) => _chunkCKRNELPOcjs.chartSeriesColor.call(void 0, spec, spec.series.indexOf(s)));
2533
+ const check = _chunkCKRNELPOcjs.checkChartColors.call(void 0, colors, { surface: scene.theme.surface.startsWith("var(") ? "#ffffff" : scene.theme.surface });
2534
+ const axis = (s, a) => s ? { min: s.domain[0], max: s.domain[1], ticks: [...s.ticks], ...s.logBase ? { logBase: s.logBase } : {}, ...a.reverse ? { reversed: true } : {} } : void 0;
2388
2535
  return {
2389
2536
  type: spec.type,
2390
2537
  title: spec.title,
2391
2538
  categories: spec.categories.length,
2392
2539
  series,
2393
- ...scene.valueScale ? { valueAxis: axis(scene.valueScale) } : {},
2394
- ...scene.valueScale2 ? { secondaryAxis: axis(scene.valueScale2) } : {},
2395
- ...scene.xScale ? { xAxis: axis(scene.xScale) } : {},
2540
+ ...scene.valueScale ? { valueAxis: axis(scene.valueScale, spec.yAxis) } : {},
2541
+ ...scene.valueScale2 ? { secondaryAxis: axis(scene.valueScale2, spec.yAxis2) } : {},
2542
+ ...scene.xScale ? { xAxis: axis(scene.xScale, spec.xAxis) } : {},
2396
2543
  warnings: scene.warnings,
2397
2544
  colors: { ok: check.ok, issues: check.issues },
2398
2545
  description: describeChart(spec, series)
2399
2546
  };
2400
2547
  }
2401
2548
  function describeChart(spec, series = spec.series.filter((s) => !s.hidden).map((s) => summarizeChartSeries(s, spec.categories))) {
2402
- const kind = _chunkJOX6MJW4cjs.CHART_TYPE_LABELS[spec.type].toLowerCase();
2549
+ const kind = _chunkCKRNELPOcjs.CHART_TYPE_LABELS[spec.type].toLowerCase();
2403
2550
  const parts = [];
2404
- const family = _chunkJOX6MJW4cjs.chartFamily.call(void 0, spec);
2551
+ const family = _chunkCKRNELPOcjs.chartFamily.call(void 0, spec);
2405
2552
  const format = spec.yAxis.format;
2406
2553
  const fmt = (v) => v === null ? "blank" : formatChartNumber(v, format);
2407
2554
  const head = spec.title ? `${spec.title}: a ${kind} chart` : `A ${kind} chart`;
@@ -2439,6 +2586,21 @@ function describeChart(spec, series = spec.series.filter((s) => !s.hidden).map((
2439
2586
  parts.push(`${s.name} ranges from ${fmt(s.min)} (${s.minAt}) to ${fmt(s.max)} (${s.maxAt})${trend}.`);
2440
2587
  }
2441
2588
  if (series.length > 8) parts.push(`${series.length - 8} more series are not described.`);
2589
+ const axes = [];
2590
+ for (const [a, name] of [
2591
+ [spec.yAxis, "value axis"],
2592
+ [spec.yAxis2, "secondary value axis"],
2593
+ [spec.xAxis, family === "xy" ? "x axis" : "category axis"]
2594
+ ]) {
2595
+ if (name === "secondary value axis" && !spec.series.some((s) => !s.hidden && s.axis === "secondary")) continue;
2596
+ const log = a.scale === "log" && name !== "category axis";
2597
+ if (log || a.reverse) axes.push(`The ${name} is ${[log ? `logarithmic (base ${_nullishCoalesce(a.logBase, () => ( 10))})` : "", a.reverse ? "reversed" : ""].filter(Boolean).join(" and ")}.`);
2598
+ }
2599
+ parts.push(...axes);
2600
+ for (const s of spec.series.filter((x) => !x.hidden && (x.errorBars || x.xErrorBars)).slice(0, 8)) {
2601
+ const bars = [s.errorBars ? _chunkCKRNELPOcjs.describeChartErrorBars.call(void 0, s.errorBars) : "", s.xErrorBars ? `x ${_chunkCKRNELPOcjs.describeChartErrorBars.call(void 0, s.xErrorBars)}` : ""].filter(Boolean).join(" and ");
2602
+ parts.push(`${s.name} has ${bars}.`);
2603
+ }
2442
2604
  return parts.join(" ");
2443
2605
  }
2444
2606
 
@@ -2539,10 +2701,10 @@ var CHART_LAYOUT_PRESETS = [
2539
2701
  ];
2540
2702
  function monochromeChartPalette(base, count = 6) {
2541
2703
  const steps = count <= 1 ? [0] : Array.from({ length: count }, (_, i) => -0.45 + 1.05 * i / (count - 1));
2542
- return steps.map((t) => _chunkJOX6MJW4cjs.shadeChartColor.call(void 0, base, t));
2704
+ return steps.map((t) => _chunkCKRNELPOcjs.shadeChartColor.call(void 0, base, t));
2543
2705
  }
2544
2706
  var CHART_COLOR_SCHEMES = [
2545
- { id: "default", label: "Default", description: "Ten distinct colours, readable on light and dark backgrounds.", palette: _chunkJOX6MJW4cjs.DEFAULT_CHART_PALETTE },
2707
+ { id: "default", label: "Default", description: "Ten distinct colours, readable on light and dark backgrounds.", palette: _chunkCKRNELPOcjs.DEFAULT_CHART_PALETTE },
2546
2708
  { id: "okabe-ito", label: "Okabe\u2013Ito", description: "Eight colours chosen to stay distinct with colour-blindness.", palette: ["#e69f00", "#56b4e9", "#009e73", "#f0e442", "#0072b2", "#d55e00", "#cc79a7", "#000000"] },
2547
2709
  { id: "office", label: "Office", description: "The six accent colours of the default Office theme.", palette: ["#4472c4", "#ed7d31", "#a5a5a5", "#ffc000", "#5b9bd5", "#70ad47"] },
2548
2710
  { id: "warm", label: "Warm", description: "Reds, oranges and yellows.", palette: ["#b2182b", "#d6604d", "#f4a582", "#e08214", "#fdb863", "#8c510a"] },
@@ -2601,14 +2763,14 @@ var ChartController = (_class = class {
2601
2763
  constructor(options = {}) {;_class.prototype.__init.call(this);_class.prototype.__init2.call(this);_class.prototype.__init3.call(this);_class.prototype.__init4.call(this);_class.prototype.__init5.call(this);_class.prototype.__init6.call(this);_class.prototype.__init7.call(this);_class.prototype.__init8.call(this);_class.prototype.__init9.call(this);_class.prototype.__init10.call(this);
2602
2764
  this.history = _nullishCoalesce(options.history, () => ( new (0, _chunkQKLRAA4Tcjs.HistoryManager)()));
2603
2765
  this.onChange = options.onChange;
2604
- const { spec, issues } = _chunkJOX6MJW4cjs.normalizeChartSpec.call(void 0, _nullishCoalesce(options.spec, () => ( {})));
2766
+ const { spec, issues } = _chunkCKRNELPOcjs.normalizeChartSpec.call(void 0, _nullishCoalesce(options.spec, () => ( {})));
2605
2767
  this.spec = spec;
2606
2768
  this.issues = issues;
2607
2769
  this.state = this.computeState();
2608
2770
  this.connect();
2609
2771
  }
2610
2772
  connect() {
2611
- _optionalChain([this, 'access', _45 => _45.unsubscribeHistory, 'optionalCall', _46 => _46()]);
2773
+ _optionalChain([this, 'access', _67 => _67.unsubscribeHistory, 'optionalCall', _68 => _68()]);
2612
2774
  this.unsubscribeHistory = this.history.subscribe((h) => {
2613
2775
  const s = this.state;
2614
2776
  if (this.applying || s.canUndo === h.canUndo && s.canRedo === h.canRedo && s.undoLabel === h.undoName && s.redoLabel === h.redoName) return;
@@ -2638,12 +2800,12 @@ var ChartController = (_class = class {
2638
2800
  computeState() {
2639
2801
  const h = this.history.getState();
2640
2802
  const sel = this.selection;
2641
- const seriesId = _optionalChain([sel, 'optionalAccess', _47 => _47.kind]) === "series" || _optionalChain([sel, 'optionalAccess', _48 => _48.kind]) === "point" || _optionalChain([sel, 'optionalAccess', _49 => _49.kind]) === "trendline" ? sel.seriesId : null;
2803
+ const seriesId = _optionalChain([sel, 'optionalAccess', _69 => _69.kind]) === "series" || _optionalChain([sel, 'optionalAccess', _70 => _70.kind]) === "point" || _optionalChain([sel, 'optionalAccess', _71 => _71.kind]) === "trendline" ? sel.seriesId : null;
2642
2804
  return {
2643
2805
  spec: this.spec,
2644
2806
  selection: sel,
2645
2807
  selectedSeries: seriesId ? _nullishCoalesce(this.spec.series.find((s) => s.id === seriesId), () => ( null)) : null,
2646
- selectedIndex: _optionalChain([sel, 'optionalAccess', _50 => _50.kind]) === "point" || _optionalChain([sel, 'optionalAccess', _51 => _51.kind]) === "category" ? sel.index : null,
2808
+ selectedIndex: _optionalChain([sel, 'optionalAccess', _72 => _72.kind]) === "point" || _optionalChain([sel, 'optionalAccess', _73 => _73.kind]) === "category" ? sel.index : null,
2647
2809
  issues: this.issues,
2648
2810
  gesture: this.gestureKey,
2649
2811
  canUndo: h.canUndo,
@@ -2656,7 +2818,7 @@ var ChartController = (_class = class {
2656
2818
  notify(specChanged) {
2657
2819
  this.revision++;
2658
2820
  this.state = this.computeState();
2659
- if (specChanged) _optionalChain([this, 'access', _52 => _52.onChange, 'optionalCall', _53 => _53(this.spec)]);
2821
+ if (specChanged) _optionalChain([this, 'access', _74 => _74.onChange, 'optionalCall', _75 => _75(this.spec)]);
2660
2822
  const state = this.state;
2661
2823
  this.listeners.forEach((listener) => {
2662
2824
  try {
@@ -2680,7 +2842,7 @@ var ChartController = (_class = class {
2680
2842
  case "category":
2681
2843
  return sel.index < spec.categories.length ? sel : null;
2682
2844
  case "trendline":
2683
- return _optionalChain([spec, 'access', _54 => _54.series, 'access', _55 => _55.find, 'call', _56 => _56((s) => s.id === sel.seriesId), 'optionalAccess', _57 => _57.trendlines, 'optionalAccess', _58 => _58[sel.index]]) ? sel : null;
2845
+ return _optionalChain([spec, 'access', _76 => _76.series, 'access', _77 => _77.find, 'call', _78 => _78((s) => s.id === sel.seriesId), 'optionalAccess', _79 => _79.trendlines, 'optionalAccess', _80 => _80[sel.index]]) ? sel : null;
2684
2846
  case "title":
2685
2847
  return spec.title ? sel : null;
2686
2848
  case "subtitle":
@@ -2727,7 +2889,7 @@ var ChartController = (_class = class {
2727
2889
  }
2728
2890
  /** A copy of the spec with `edit` applied (series and categories copied as needed). */
2729
2891
  edited(edit) {
2730
- const draft = _chunkJOX6MJW4cjs.cloneChartSpec.call(void 0, this.spec);
2892
+ const draft = _chunkCKRNELPOcjs.cloneChartSpec.call(void 0, this.spec);
2731
2893
  edit(draft);
2732
2894
  return draft;
2733
2895
  }
@@ -2757,7 +2919,7 @@ var ChartController = (_class = class {
2757
2919
  legend: patch.legend ? { ...s.legend, ...patch.legend } : s.legend,
2758
2920
  version: 1
2759
2921
  };
2760
- const { spec, issues } = _chunkJOX6MJW4cjs.normalizeChartSpec.call(void 0, merged);
2922
+ const { spec, issues } = _chunkCKRNELPOcjs.normalizeChartSpec.call(void 0, merged);
2761
2923
  if (issues.length) return this.reject(issues.map((i) => i.message).join(" "), issues);
2762
2924
  if (JSON.stringify(spec) === JSON.stringify(s)) return { ok: true };
2763
2925
  this.commit(_nullishCoalesce(options.label, () => ( updateLabel(patch))), spec);
@@ -2808,7 +2970,7 @@ var ChartController = (_class = class {
2808
2970
  const series = this.getSeries(seriesId);
2809
2971
  if (!series) return this.unknownSeries(seriesId);
2810
2972
  if (!Number.isInteger(index) || index < 0 || index >= this.spec.categories.length) return this.badIndex(index);
2811
- const parsed = _chunkJOX6MJW4cjs.parseChartValue.call(void 0, value);
2973
+ const parsed = _chunkCKRNELPOcjs.parseChartValue.call(void 0, value);
2812
2974
  if (parsed === void 0) return this.reject(`"${String(value)}" is not a number; enter a number or leave the cell blank.`, [{ path: `${seriesId}[${index}]`, message: `"${String(value)}" is not a number.` }]);
2813
2975
  if (series.values[index] === parsed) {
2814
2976
  if (this.issues.length) {
@@ -2831,7 +2993,7 @@ var ChartController = (_class = class {
2831
2993
  if (!this.getSeries(cell.seriesId)) issues.push({ path: cell.seriesId, message: this.unknownSeries(cell.seriesId).message });
2832
2994
  else if (!Number.isInteger(cell.index) || cell.index < 0 || cell.index >= this.spec.categories.length) issues.push({ path: `${cell.seriesId}[${cell.index}]`, message: this.badIndex(cell.index).message });
2833
2995
  else {
2834
- const value = _chunkJOX6MJW4cjs.parseChartValue.call(void 0, cell.value);
2996
+ const value = _chunkCKRNELPOcjs.parseChartValue.call(void 0, cell.value);
2835
2997
  if (value === void 0) issues.push({ path: `${cell.seriesId}[${cell.index}]`, message: `"${String(cell.value)}" is not a number.` });
2836
2998
  else parsed.push({ seriesId: cell.seriesId, index: cell.index, value });
2837
2999
  }
@@ -2845,12 +3007,12 @@ var ChartController = (_class = class {
2845
3007
  }
2846
3008
  /** Adds a series (values padded to the categories) and selects it. Returns its id. */
2847
3009
  addSeries(input = {}, options = {}) {
2848
- const id = input.id && !this.getSeries(input.id) ? input.id : _chunkJOX6MJW4cjs.uniqueChartSeriesId.call(void 0, this.spec.series);
3010
+ const id = input.id && !this.getSeries(input.id) ? input.id : _chunkCKRNELPOcjs.uniqueChartSeriesId.call(void 0, this.spec.series);
2849
3011
  const name = _nullishCoalesce(input.name, () => ( `Series ${this.spec.series.length + 1}`));
2850
3012
  const at = Math.max(0, Math.min(this.spec.series.length, _nullishCoalesce(options.at, () => ( this.spec.series.length))));
2851
3013
  const series = [...this.spec.series];
2852
3014
  series.splice(at, 0, { ...input, id, name, values: _nullishCoalesce(input.values, () => ( [])) });
2853
- const { spec, issues } = _chunkJOX6MJW4cjs.normalizeChartSpec.call(void 0, { ...this.spec, series });
3015
+ const { spec, issues } = _chunkCKRNELPOcjs.normalizeChartSpec.call(void 0, { ...this.spec, series });
2854
3016
  if (issues.length) return this.reject(issues.map((i) => i.message).join(" "), issues);
2855
3017
  this.commit(`Add series "${name}"`, spec, { kind: "series", seriesId: id });
2856
3018
  return { ok: true, id };
@@ -2869,7 +3031,7 @@ var ChartController = (_class = class {
2869
3031
  updateSeries(id, patch) {
2870
3032
  const series = this.getSeries(id);
2871
3033
  if (!series) return this.unknownSeries(id);
2872
- const next = _chunkJOX6MJW4cjs.cloneChartSeries.call(void 0, series);
3034
+ const next = _chunkCKRNELPOcjs.cloneChartSeries.call(void 0, series);
2873
3035
  if (patch.name !== void 0) next.name = String(patch.name);
2874
3036
  if (patch.color === null || patch.color === "") delete next.color;
2875
3037
  else if (patch.color !== void 0) next.color = patch.color;
@@ -2879,7 +3041,7 @@ var ChartController = (_class = class {
2879
3041
  if (patch.hidden) next.hidden = true;
2880
3042
  else delete next.hidden;
2881
3043
  }
2882
- const resettable = ["axis", "x", "sizes", "pointColors", "marker", "curve", "dataLabels", "format"];
3044
+ const resettable = ["axis", "x", "sizes", "pointColors", "marker", "curve", "dataLabels", "format", "errorBars", "xErrorBars"];
2883
3045
  for (const key of resettable) {
2884
3046
  if (!(key in patch) || patch[key] === void 0) continue;
2885
3047
  if (patch[key] === null) delete next[key];
@@ -2887,7 +3049,7 @@ var ChartController = (_class = class {
2887
3049
  }
2888
3050
  if (next.axis === "primary") delete next.axis;
2889
3051
  const series2 = this.spec.series.map((s) => s.id === id ? next : s);
2890
- const { spec, issues } = _chunkJOX6MJW4cjs.normalizeChartSpec.call(void 0, { ...this.spec, series: series2 });
3052
+ const { spec, issues } = _chunkCKRNELPOcjs.normalizeChartSpec.call(void 0, { ...this.spec, series: series2 });
2891
3053
  if (issues.length) return this.reject(issues.map((i) => i.message).join(" "), issues);
2892
3054
  if (JSON.stringify(spec.series) === JSON.stringify(this.spec.series)) return { ok: true };
2893
3055
  const label = patch.hidden !== void 0 && Object.keys(patch).length === 1 ? `${patch.hidden ? "Hide" : "Show"} "${series.name}"` : patch.name !== void 0 && Object.keys(patch).length === 1 ? "Rename series" : `Change series "${series.name}"`;
@@ -2980,7 +3142,7 @@ var ChartController = (_class = class {
2980
3142
  const width = Math.max(...rows.map((r) => r.length));
2981
3143
  const lastSeries = column + width - 1;
2982
3144
  while (d.series.length <= lastSeries) {
2983
- const id = _chunkJOX6MJW4cjs.uniqueChartSeriesId.call(void 0, d.series);
3145
+ const id = _chunkCKRNELPOcjs.uniqueChartSeriesId.call(void 0, d.series);
2984
3146
  d.series.push({ id, name: `Series ${d.series.length + 1}`, values: d.categories.map(() => null) });
2985
3147
  }
2986
3148
  const lastRow = row + rows.length - 1;
@@ -2994,7 +3156,7 @@ var ChartController = (_class = class {
2994
3156
  const index = row + r;
2995
3157
  if (col < 0) d.categories[index] = cell === null || cell === void 0 ? "" : String(cell).trim();
2996
3158
  else {
2997
- const parsed = _chunkJOX6MJW4cjs.parseChartValue.call(void 0, cell);
3159
+ const parsed = _chunkCKRNELPOcjs.parseChartValue.call(void 0, cell);
2998
3160
  if (parsed === void 0) issues.push({ path: `${d.series[col].id}[${index}]`, message: `"${String(cell)}" is not a number; it was left blank.` });
2999
3161
  d.series[col].values[index] = _nullishCoalesce(parsed, () => ( null));
3000
3162
  }
@@ -3013,14 +3175,14 @@ var ChartController = (_class = class {
3013
3175
  * colours and types are kept by name.
3014
3176
  */
3015
3177
  importTable(rows, options = {}) {
3016
- const data = _chunkJOX6MJW4cjs.chartDataFromTable.call(void 0, rows, options);
3178
+ const data = _chunkCKRNELPOcjs.chartDataFromTable.call(void 0, rows, options);
3017
3179
  if (!data.categories.length || !data.series.length) return this.reject("There is no data to import: expected a header row and at least one row of values.");
3018
3180
  const byName = new Map(this.spec.series.map((s) => [s.name, s]));
3019
3181
  const series = data.series.map((s) => {
3020
3182
  const old = byName.get(s.name);
3021
- return { ...s, ..._optionalChain([old, 'optionalAccess', _59 => _59.color]) ? { color: old.color } : {}, ..._optionalChain([old, 'optionalAccess', _60 => _60.type]) ? { type: old.type } : {}, ...old ? { id: old.id } : {} };
3183
+ return { ...s, ..._optionalChain([old, 'optionalAccess', _81 => _81.color]) ? { color: old.color } : {}, ..._optionalChain([old, 'optionalAccess', _82 => _82.type]) ? { type: old.type } : {}, ...old ? { id: old.id } : {} };
3022
3184
  });
3023
- const { spec } = _chunkJOX6MJW4cjs.normalizeChartSpec.call(void 0, { ...this.spec, categories: data.categories, series });
3185
+ const { spec } = _chunkCKRNELPOcjs.normalizeChartSpec.call(void 0, { ...this.spec, categories: data.categories, series });
3024
3186
  this.commit("Import data", spec);
3025
3187
  if (data.issues.length) {
3026
3188
  this.issues = data.issues;
@@ -3044,9 +3206,9 @@ var ChartController = (_class = class {
3044
3206
  if (!chartSupportsTrendlines(this.spec.type, this.spec.stacking))
3045
3207
  return this.reject(`Trendlines need an unstacked bar, line, area, scatter or bubble chart; this is a ${this.spec.stacking !== "none" ? `${this.spec.stacking} ` : ""}${this.spec.type} chart.`);
3046
3208
  const issues = [];
3047
- const line = _chunkJOX6MJW4cjs.normalizeChartTrendline.call(void 0, input, "trendline", issues);
3209
+ const line = _chunkCKRNELPOcjs.normalizeChartTrendline.call(void 0, input, "trendline", issues);
3048
3210
  if (!line || issues.length) return this.reject(issues.map((i) => i.message).join(" ") || "The trendline is not valid.", issues);
3049
- const index = _nullishCoalesce(_optionalChain([series, 'access', _61 => _61.trendlines, 'optionalAccess', _62 => _62.length]), () => ( 0));
3211
+ const index = _nullishCoalesce(_optionalChain([series, 'access', _83 => _83.trendlines, 'optionalAccess', _84 => _84.length]), () => ( 0));
3050
3212
  const next = this.edited((d) => {
3051
3213
  const s = d.series.find((x) => x.id === seriesId);
3052
3214
  s.trendlines = [..._nullishCoalesce(s.trendlines, () => ( [])), line];
@@ -3058,12 +3220,12 @@ var ChartController = (_class = class {
3058
3220
  updateTrendline(seriesId, index, patch) {
3059
3221
  const series = this.getSeries(seriesId);
3060
3222
  if (!series) return this.unknownSeries(seriesId);
3061
- const current = _optionalChain([series, 'access', _63 => _63.trendlines, 'optionalAccess', _64 => _64[index]]);
3062
- if (!current) return fail(`"${series.name}" has no trendline ${index}; ${_optionalChain([series, 'access', _65 => _65.trendlines, 'optionalAccess', _66 => _66.length]) ? `expected 0 to ${series.trendlines.length - 1}` : "it has none yet"}.`);
3223
+ const current = _optionalChain([series, 'access', _85 => _85.trendlines, 'optionalAccess', _86 => _86[index]]);
3224
+ if (!current) return fail(`"${series.name}" has no trendline ${index}; ${_optionalChain([series, 'access', _87 => _87.trendlines, 'optionalAccess', _88 => _88.length]) ? `expected 0 to ${series.trendlines.length - 1}` : "it has none yet"}.`);
3063
3225
  const issues = [];
3064
3226
  const merged = { ...current, ...patch };
3065
3227
  for (const [k, v] of Object.entries(patch)) if (v === null) delete merged[k];
3066
- const line = _chunkJOX6MJW4cjs.normalizeChartTrendline.call(void 0, merged, "trendline", issues);
3228
+ const line = _chunkCKRNELPOcjs.normalizeChartTrendline.call(void 0, merged, "trendline", issues);
3067
3229
  if (!line || issues.length) return this.reject(issues.map((i) => i.message).join(" "), issues);
3068
3230
  this.commit(
3069
3231
  "Change trendline",
@@ -3076,7 +3238,7 @@ var ChartController = (_class = class {
3076
3238
  removeTrendline(seriesId, index) {
3077
3239
  const series = this.getSeries(seriesId);
3078
3240
  if (!series) return this.unknownSeries(seriesId);
3079
- if (!_optionalChain([series, 'access', _67 => _67.trendlines, 'optionalAccess', _68 => _68[index]])) return fail(`"${series.name}" has no trendline ${index}.`);
3241
+ if (!_optionalChain([series, 'access', _89 => _89.trendlines, 'optionalAccess', _90 => _90[index]])) return fail(`"${series.name}" has no trendline ${index}.`);
3080
3242
  this.commit(
3081
3243
  "Delete trendline",
3082
3244
  this.edited((d) => {
@@ -3091,23 +3253,23 @@ var ChartController = (_class = class {
3091
3253
  trendlinePoints(seriesId) {
3092
3254
  const series = this.getSeries(seriesId);
3093
3255
  if (!series) return [];
3094
- const xy = _chunkJOX6MJW4cjs.chartFamily.call(void 0, this.spec) === "xy";
3256
+ const xy = _chunkCKRNELPOcjs.chartFamily.call(void 0, this.spec) === "xy";
3095
3257
  const out = [];
3096
3258
  series.values.forEach((v, i) => {
3097
- const x = xy ? _nullishCoalesce(_optionalChain([series, 'access', _69 => _69.x, 'optionalAccess', _70 => _70[i]]), () => ( (this.spec.type === "bubble" ? i + 1 : null))) : i + 1;
3259
+ const x = xy ? _nullishCoalesce(_optionalChain([series, 'access', _91 => _91.x, 'optionalAccess', _92 => _92[i]]), () => ( (this.spec.type === "bubble" ? i + 1 : null))) : i + 1;
3098
3260
  if (v !== null && x !== null && Number.isFinite(v) && Number.isFinite(x)) out.push([x, v]);
3099
3261
  });
3100
3262
  return out;
3101
3263
  }
3102
3264
  /** The fitted coefficients, R² and equation of a trendline (null for moving averages or unfittable data). */
3103
3265
  trendlineFit(seriesId, index) {
3104
- const line = _optionalChain([this, 'access', _71 => _71.getSeries, 'call', _72 => _72(seriesId), 'optionalAccess', _73 => _73.trendlines, 'optionalAccess', _74 => _74[index]]);
3266
+ const line = _optionalChain([this, 'access', _93 => _93.getSeries, 'call', _94 => _94(seriesId), 'optionalAccess', _95 => _95.trendlines, 'optionalAccess', _96 => _96[index]]);
3105
3267
  if (!line) return null;
3106
3268
  return fitChartTrendline(line, this.trendlinePoints(seriesId));
3107
3269
  }
3108
3270
  /** The moving-average points of a trendline (empty for other kinds). */
3109
3271
  trendlineMovingAverage(seriesId, index) {
3110
- const line = _optionalChain([this, 'access', _75 => _75.getSeries, 'call', _76 => _76(seriesId), 'optionalAccess', _77 => _77.trendlines, 'optionalAccess', _78 => _78[index]]);
3272
+ const line = _optionalChain([this, 'access', _97 => _97.getSeries, 'call', _98 => _98(seriesId), 'optionalAccess', _99 => _99.trendlines, 'optionalAccess', _100 => _100[index]]);
3111
3273
  if (!line || line.type !== "moving-average") return [];
3112
3274
  return chartMovingAverage(this.trendlinePoints(seriesId), _nullishCoalesce(line.period, () => ( 2)));
3113
3275
  }
@@ -3128,7 +3290,7 @@ var ChartController = (_class = class {
3128
3290
  used.add(id);
3129
3291
  return { id, name, values: s.series.map((x) => _nullishCoalesce(x.values[i], () => ( null))) };
3130
3292
  });
3131
- const { spec } = _chunkJOX6MJW4cjs.normalizeChartSpec.call(void 0, { ...s, categories: s.series.map((x) => x.name), series });
3293
+ const { spec } = _chunkCKRNELPOcjs.normalizeChartSpec.call(void 0, { ...s, categories: s.series.map((x) => x.name), series });
3132
3294
  this.commit("Switch rows and columns", spec, null);
3133
3295
  return { ok: true };
3134
3296
  }
@@ -3213,14 +3375,14 @@ var ChartController = (_class = class {
3213
3375
  // -------------------------------------------------------------------------
3214
3376
  /** The spec, for saving (a copy). */
3215
3377
  toJSON() {
3216
- return _chunkJOX6MJW4cjs.cloneChartSpec.call(void 0, this.spec);
3378
+ return _chunkCKRNELPOcjs.cloneChartSpec.call(void 0, this.spec);
3217
3379
  }
3218
3380
  /**
3219
3381
  * Replaces the chart without an undo step (e.g. when opening a document). Problems are
3220
3382
  * fixed with defaults and reported in `state.issues` (and returned).
3221
3383
  */
3222
3384
  load(input, options = {}) {
3223
- const { spec, issues } = _chunkJOX6MJW4cjs.normalizeChartSpec.call(void 0, input);
3385
+ const { spec, issues } = _chunkCKRNELPOcjs.normalizeChartSpec.call(void 0, input);
3224
3386
  this.spec = spec;
3225
3387
  this.issues = issues;
3226
3388
  this.selection = this.validSelection(this.selection, spec);
@@ -3245,7 +3407,7 @@ var ChartController = (_class = class {
3245
3407
  }
3246
3408
  /** Stops listening to the history (reconnected by the next `subscribe`). */
3247
3409
  destroy() {
3248
- _optionalChain([this, 'access', _79 => _79.unsubscribeHistory, 'optionalCall', _80 => _80()]);
3410
+ _optionalChain([this, 'access', _101 => _101.unsubscribeHistory, 'optionalCall', _102 => _102()]);
3249
3411
  this.unsubscribeHistory = void 0;
3250
3412
  this.listeners.clear();
3251
3413
  }
@@ -3290,7 +3452,7 @@ function layoutSparkline(values, options) {
3290
3452
  const h = Number.isFinite(options.height) ? Math.max(1, options.height) : 1;
3291
3453
  const color = _nullishCoalesce(options.color, () => ( "#4269d0"));
3292
3454
  const negative = _nullishCoalesce(options.negativeColor, () => ( "#e5484d"));
3293
- const theme = { ..._chunkJOX6MJW4cjs.DEFAULT_CHART_THEME, background: "transparent" };
3455
+ const theme = { ..._chunkCKRNELPOcjs.DEFAULT_CHART_THEME, background: "transparent" };
3294
3456
  const marks = [];
3295
3457
  const scene = { width: w, height: h, plot: { x: 0, y: 0, width: w, height: h }, marks, percent: false, theme, warnings: [] };
3296
3458
  const vals = values.slice(0, MAX_POINTS).map((v) => v !== null && Number.isFinite(v) ? Math.max(-1e300, Math.min(1e300, v)) : null);
@@ -3420,5 +3582,8 @@ function sparklineToSvg(values, options) {
3420
3582
 
3421
3583
 
3422
3584
 
3423
- exports.CHART_MERMAID_META_PREFIX = CHART_MERMAID_META_PREFIX; exports.chartMermaidFamily = chartMermaidFamily; exports.chartToMermaid = chartToMermaid; exports.chartFromMermaid = chartFromMermaid; exports.findMermaidCharts = findMermaidCharts; exports.parseChartDate = parseChartDate; exports.CHART_DATE_STEPS = CHART_DATE_STEPS; exports.formatChartDate = formatChartDate; exports.chartDateLabels = chartDateLabels; exports.compileChartFormatCode = compileChartFormatCode; exports.formatChartValueWithCode = formatChartValueWithCode; exports.chartSerialToDate = chartSerialToDate; exports.chartDateToSerial = chartDateToSerial; exports.niceStep = niceStep; exports.niceScale = niceScale; exports.stepDecimals = stepDecimals; exports.formatChartNumber = formatChartNumber; exports.linearMap = linearMap; exports.estimateChartTextWidth = estimateChartTextWidth; exports.sameChartSelection = sameChartSelection; exports.contrastingTextColor = contrastingTextColor; exports.chartHistogram = chartHistogram; exports.chartQuantile = chartQuantile; exports.chartBoxStats = chartBoxStats; exports.chartSquarify = chartSquarify; exports.decimateChartPoints = decimateChartPoints; exports.summarizeChartSeries = summarizeChartSeries; exports.fitChartTrendline = fitChartTrendline; exports.trendNumberText = trendNumberText; exports.chartMovingAverage = chartMovingAverage; exports.chartTrendlineName = chartTrendlineName; exports.chartSupportsTrendlines = chartSupportsTrendlines; exports.MAX_CHART_DATA_LABELS = MAX_CHART_DATA_LABELS; exports.MAX_CHART_LINE_POINTS = MAX_CHART_LINE_POINTS; exports.MAX_CHART_MARKERS = MAX_CHART_MARKERS; exports.layoutChart = layoutChart; exports.chartValueAtPoint = chartValueAtPoint; exports.chartXAtPoint = chartXAtPoint; exports.snapChartValue = snapChartValue; exports.summarizeChart = summarizeChart; exports.describeChart = describeChart; exports.chartTextBaseline = chartTextBaseline; exports.chartTextTransform = chartTextTransform; exports.chartSceneToSvg = chartSceneToSvg; exports.chartToSvg = chartToSvg; exports.chartSceneToDomSpec = chartSceneToDomSpec; exports.CHART_LAYOUT_PRESETS = CHART_LAYOUT_PRESETS; exports.monochromeChartPalette = monochromeChartPalette; exports.CHART_COLOR_SCHEMES = CHART_COLOR_SCHEMES; exports.chartPresetPatch = chartPresetPatch; exports.ChartController = ChartController; exports.createChartController = createChartController; exports.layoutSparkline = layoutSparkline; exports.sparklineToSvg = sparklineToSvg;
3424
- //# sourceMappingURL=chunk-GTZXF4BI.cjs.map
3585
+
3586
+
3587
+
3588
+ exports.CHART_MERMAID_META_PREFIX = CHART_MERMAID_META_PREFIX; exports.chartMermaidFamily = chartMermaidFamily; exports.chartToMermaid = chartToMermaid; exports.chartFromMermaid = chartFromMermaid; exports.findMermaidCharts = findMermaidCharts; exports.parseChartDate = parseChartDate; exports.CHART_DATE_STEPS = CHART_DATE_STEPS; exports.formatChartDate = formatChartDate; exports.chartDateLabels = chartDateLabels; exports.compileChartFormatCode = compileChartFormatCode; exports.formatChartValueWithCode = formatChartValueWithCode; exports.chartSerialToDate = chartSerialToDate; exports.chartDateToSerial = chartDateToSerial; exports.niceStep = niceStep; exports.niceScale = niceScale; exports.stepDecimals = stepDecimals; exports.formatChartNumber = formatChartNumber; exports.linearMap = linearMap; exports.niceLogScale = niceLogScale; exports.chartScaleToPixel = chartScaleToPixel; exports.chartScaleFromPixel = chartScaleFromPixel; exports.estimateChartTextWidth = estimateChartTextWidth; exports.sameChartSelection = sameChartSelection; exports.contrastingTextColor = contrastingTextColor; exports.chartHistogram = chartHistogram; exports.chartQuantile = chartQuantile; exports.chartBoxStats = chartBoxStats; exports.chartSquarify = chartSquarify; exports.decimateChartPoints = decimateChartPoints; exports.summarizeChartSeries = summarizeChartSeries; exports.fitChartTrendline = fitChartTrendline; exports.trendNumberText = trendNumberText; exports.chartMovingAverage = chartMovingAverage; exports.chartTrendlineName = chartTrendlineName; exports.chartSupportsTrendlines = chartSupportsTrendlines; exports.MAX_CHART_DATA_LABELS = MAX_CHART_DATA_LABELS; exports.MAX_CHART_LINE_POINTS = MAX_CHART_LINE_POINTS; exports.MAX_CHART_MARKERS = MAX_CHART_MARKERS; exports.layoutChart = layoutChart; exports.chartValueAtPoint = chartValueAtPoint; exports.chartXAtPoint = chartXAtPoint; exports.snapChartValue = snapChartValue; exports.summarizeChart = summarizeChart; exports.describeChart = describeChart; exports.chartTextBaseline = chartTextBaseline; exports.chartTextTransform = chartTextTransform; exports.chartSceneToSvg = chartSceneToSvg; exports.chartToSvg = chartToSvg; exports.chartSceneToDomSpec = chartSceneToDomSpec; exports.CHART_LAYOUT_PRESETS = CHART_LAYOUT_PRESETS; exports.monochromeChartPalette = monochromeChartPalette; exports.CHART_COLOR_SCHEMES = CHART_COLOR_SCHEMES; exports.chartPresetPatch = chartPresetPatch; exports.ChartController = ChartController; exports.createChartController = createChartController; exports.layoutSparkline = layoutSparkline; exports.sparklineToSvg = sparklineToSvg;
3589
+ //# sourceMappingURL=chunk-NK3WL5TJ.cjs.map