@graphysdk/viz-engine 0.0.1-plugins.2 → 0.0.1-plugins.3

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.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { i as Nn, G as F, e as v, V as we, C as Kt, a as J, p as ee, d as Rr, D as ge, b as Ge, s as en, P as b, c as h, R as je, f as Ma, g as T, h as La, I as Pr, r as Nr, v as W, S as dt, j as Or } from "./geom.utils-BbMUNkrO.js";
1
+ import { i as Nn, G as F, e as v, V as we, C as Kt, a as J, p as ee, d as Rr, D as ge, b as Ge, s as en, P as g, c as h, R as je, f as Ma, g as T, h as La, I as Pr, r as Nr, v as W, S as dt, j as Or } from "./geom.utils-BbMUNkrO.js";
2
2
  import { m as Gy } from "./geom.utils-BbMUNkrO.js";
3
3
  import { isValid as Y, isBefore as Va, parse as Ne, differenceInDays as ka, isWithinInterval as Ia, addDays as Br } from "date-fns";
4
4
  import { isInteger as Ea, merge as Ae } from "lodash-es";
@@ -9,7 +9,7 @@ import Ur from "lodash-es/merge";
9
9
  import { regressionLoess as $a, regressionPoly as Ua, regressionPow as Ya, regressionQuad as Wa, regressionLog as Ha, regressionExp as Ka, regressionLinear as za } from "d3-regression";
10
10
  import Xa from "humanize-duration";
11
11
  import { Delaunay as qa } from "d3-delaunay";
12
- typeof window < "u" && (window.__GRAPHY_SDK__ ??= {}, window.__GRAPHY_SDK__.vizEngine = "0.0.1-plugins.2");
12
+ typeof window < "u" && (window.__GRAPHY_SDK__ ??= {}, window.__GRAPHY_SDK__.vizEngine = "0.0.1-plugins.3");
13
13
  function $e(e, t) {
14
14
  return Yr(
15
15
  e,
@@ -414,7 +414,7 @@ class vs {
414
414
  return t.layers;
415
415
  }
416
416
  }
417
- class xs {
417
+ class Ss {
418
418
  constructor(t) {
419
419
  this.geomRegistry = t, this.coordType = "flip";
420
420
  }
@@ -430,7 +430,7 @@ class xs {
430
430
  y: { position: "bottom", geometry: "linear" }
431
431
  }
432
432
  },
433
- scales: Ss(t.scales, t.layers)
433
+ scales: xs(t.scales, t.layers)
434
434
  };
435
435
  }
436
436
  transform(t) {
@@ -440,7 +440,7 @@ class xs {
440
440
  });
441
441
  }
442
442
  }
443
- const Bn = ee("flipSwap"), Ss = (e, t) => ws(t) ? e.map((n) => n.scaledAesthetic !== "x" || n.scaleType !== "continuous" && n.scaleType !== "datetime" && n.scaleType !== "discrete" ? n : { ...n, reverse: !n.reverse }) : e, ws = (e) => {
443
+ const Bn = ee("flipSwap"), xs = (e, t) => ws(t) ? e.map((n) => n.scaledAesthetic !== "x" || n.scaleType !== "continuous" && n.scaleType !== "datetime" && n.scaleType !== "discrete" ? n : { ...n, reverse: !n.reverse }) : e, ws = (e) => {
444
444
  for (const t of e) {
445
445
  const n = v(t.mapping.x);
446
446
  if (!n || !t.data.hasVariable(n)) continue;
@@ -515,7 +515,7 @@ function ks(e, t) {
515
515
  }
516
516
  class Is extends Me {
517
517
  constructor(t) {
518
- super("coord"), this.register("cartesian", new vs()), this.register("flip", new xs(t)), this.register("polar", new Ts(t));
518
+ super("coord"), this.register("cartesian", new vs()), this.register("flip", new Ss(t)), this.register("polar", new Ts(t));
519
519
  }
520
520
  }
521
521
  class zr {
@@ -998,34 +998,34 @@ class ui extends Ge {
998
998
  ], this.swatchShape = "area", this.highlightStrategy = "overlay-anchor", this.spatialKind = "buckets", this.directLabelPositions = ["identity", "stack", "dodge", "fill"], this.supportsPerGroupHeadline = !0;
999
999
  }
1000
1000
  compile({ data: t, mapping: n }) {
1001
- if (t = en(t, n), t.hasVariable(b.yMin) || (t = t.addConstantVariable(b.yMin, "numeric", 0)), !t.hasVariable(b.yMax)) {
1001
+ if (t = en(t, n), t.hasVariable(g.yMin) || (t = t.addConstantVariable(g.yMin, "numeric", 0)), !t.hasVariable(g.yMax)) {
1002
1002
  const r = v(n.y);
1003
- h(r) && t.hasVariable(r) && (t = t.addVariable(b.yMax, "numeric", t.getValues(r, { type: "numeric" })));
1003
+ h(r) && t.hasVariable(r) && (t = t.addVariable(g.yMax, "numeric", t.getValues(r, { type: "numeric" })));
1004
1004
  }
1005
1005
  return { data: t, mapping: {} };
1006
1006
  }
1007
1007
  }
1008
1008
  const fo = 0.7, di = 0.1;
1009
1009
  function Ke(e) {
1010
- return e[b.x];
1010
+ return e[g.x];
1011
1011
  }
1012
1012
  function te(e) {
1013
- return e[b.y];
1013
+ return e[g.y];
1014
1014
  }
1015
1015
  function mt(e) {
1016
- return e[b.xMin];
1016
+ return e[g.xMin];
1017
1017
  }
1018
1018
  function Pe(e) {
1019
- return e[b.xMax];
1019
+ return e[g.xMax];
1020
1020
  }
1021
- function xe(e) {
1022
- return e[b.yMin];
1021
+ function Se(e) {
1022
+ return e[g.yMin];
1023
1023
  }
1024
1024
  function Q(e) {
1025
- return e[b.yMax];
1025
+ return e[g.yMax];
1026
1026
  }
1027
1027
  function mi(e) {
1028
- return e[b.yRaw];
1028
+ return e[g.yRaw];
1029
1029
  }
1030
1030
  class pi extends Ge {
1031
1031
  constructor() {
@@ -1043,12 +1043,12 @@ class pi extends Ge {
1043
1043
  }, this.emitsGrandTotal = !0, this.emitsStackTotals = !0, this.supportsPerGroupHeadline = !0;
1044
1044
  }
1045
1045
  compile({ data: t, mapping: n }) {
1046
- if (t = en(t, n), t.hasVariable(b.yMin) || (t = t.addConstantVariable(b.yMin, "numeric", 0)), !t.hasVariable(b.yMax)) {
1046
+ if (t = en(t, n), t.hasVariable(g.yMin) || (t = t.addConstantVariable(g.yMin, "numeric", 0)), !t.hasVariable(g.yMax)) {
1047
1047
  const o = v(n.y);
1048
- h(o) && t.hasVariable(o) && (t = t.addVariable(b.yMax, "numeric", t.getValues(o, { type: "numeric" })));
1048
+ h(o) && t.hasVariable(o) && (t = t.addVariable(g.yMax, "numeric", t.getValues(o, { type: "numeric" })));
1049
1049
  }
1050
1050
  const r = fo / 2;
1051
- return t = t.addConstantVariable(b.xMin, "numeric", -r).addConstantVariable(b.xMax, "numeric", r), { data: t, mapping: {} };
1051
+ return t = t.addConstantVariable(g.xMin, "numeric", -r).addConstantVariable(g.xMax, "numeric", r), { data: t, mapping: {} };
1052
1052
  }
1053
1053
  /**
1054
1054
  * Cartesian: the top-edge midpoint of the bar (the right-edge midpoint when flipped). Polar (pie
@@ -1057,7 +1057,7 @@ class pi extends Ge {
1057
1057
  */
1058
1058
  resolveAnchorPosition(t, n) {
1059
1059
  if (n.type === "polar") {
1060
- const s = mt(t), i = Pe(t), c = xe(t), l = Q(t);
1060
+ const s = mt(t), i = Pe(t), c = Se(t), l = Q(t);
1061
1061
  if (s === null || i === null || c === null || l === null) return null;
1062
1062
  const u = (s + i) / 2, d = (c + l) / 2;
1063
1063
  return {
@@ -1070,7 +1070,7 @@ class pi extends Ge {
1070
1070
  const s = mt(t), i = Pe(t), c = Q(t) ?? te(t);
1071
1071
  return s === null || i === null || c === null ? null : { x: (s + i) / 2, y: c, geom: "bar" };
1072
1072
  }
1073
- const r = xe(t), o = Q(t), a = Pe(t) ?? Ke(t);
1073
+ const r = Se(t), o = Q(t), a = Pe(t) ?? Ke(t);
1074
1074
  return r === null || o === null || a === null ? null : { x: a, y: (r + o) / 2, geom: "bar" };
1075
1075
  }
1076
1076
  }
@@ -1187,20 +1187,20 @@ const ho = /* @__PURE__ */ new Set([
1187
1187
  "x",
1188
1188
  "y",
1189
1189
  "ySecondary"
1190
- ]), xt = /* @__PURE__ */ new Set([
1190
+ ]), St = /* @__PURE__ */ new Set([
1191
1191
  "color",
1192
1192
  "size",
1193
1193
  "alpha",
1194
1194
  "strokeWidth",
1195
1195
  "lineType"
1196
- ]), St = (e) => ho.has(e), vi = (e) => xt.has(e), xi = (e) => St(e) || vi(e);
1196
+ ]), xt = (e) => ho.has(e), vi = (e) => St.has(e), Si = (e) => xt(e) || vi(e);
1197
1197
  function wt(e) {
1198
1198
  return e === "secondary" ? "ySecondary" : "y";
1199
1199
  }
1200
1200
  function H(e) {
1201
1201
  return e === "ySecondary" ? "y" : e;
1202
1202
  }
1203
- const Si = (e) => {
1203
+ const xi = (e) => {
1204
1204
  if (e === void 0) return {};
1205
1205
  const t = {};
1206
1206
  for (const n of e.columns)
@@ -1499,7 +1499,7 @@ function vo({
1499
1499
  layers: n,
1500
1500
  coordSystem: r
1501
1501
  }) {
1502
- const o = Wi({ layers: n, coordSystem: r, aesthetics: t }), a = xo({ layers: n, aesthetics: t });
1502
+ const o = Wi({ layers: n, coordSystem: r, aesthetics: t }), a = So({ layers: n, aesthetics: t });
1503
1503
  return e.domain.map((s) => ({
1504
1504
  value: s,
1505
1505
  swatchShape: o(s),
@@ -1511,13 +1511,13 @@ function Wi({
1511
1511
  coordSystem: t,
1512
1512
  aesthetics: n
1513
1513
  }) {
1514
- const r = xo({ layers: e, aesthetics: n }), o = e.find((s) => n.some((i) => h(s.mapping[i]))), a = o ? Be(o.swatchShape, t) : "square";
1514
+ const r = So({ layers: e, aesthetics: n }), o = e.find((s) => n.some((i) => h(s.mapping[i]))), a = o ? Be(o.swatchShape, t) : "square";
1515
1515
  return (s) => {
1516
1516
  const i = r(s);
1517
1517
  return i ? Be(i.layer.swatchShape, t) : a;
1518
1518
  };
1519
1519
  }
1520
- function xo({
1520
+ function So({
1521
1521
  layers: e,
1522
1522
  aesthetics: t,
1523
1523
  layerFilter: n
@@ -1546,7 +1546,7 @@ function Hi({ scales: e, layers: t, coordSystem: n, valueLabels: r }) {
1546
1546
  if (o === void 0 || !cn(o)) return [];
1547
1547
  if (!t.some((u) => h(u.mapping.color))) return [];
1548
1548
  const a = ce(t, "color");
1549
- if (So({
1549
+ if (xo({
1550
1550
  colorVariableName: a,
1551
1551
  xVariableName: ce(t, "x"),
1552
1552
  mapsColorAcrossMultipleLayers: zi(t) > 1,
@@ -1569,7 +1569,7 @@ function Hi({ scales: e, layers: t, coordSystem: n, valueLabels: r }) {
1569
1569
  };
1570
1570
  });
1571
1571
  }
1572
- const So = ({
1572
+ const xo = ({
1573
1573
  colorVariableName: e,
1574
1574
  xVariableName: t,
1575
1575
  mapsColorAcrossMultipleLayers: n,
@@ -1577,7 +1577,7 @@ const So = ({
1577
1577
  }) => r ? !1 : e === null || La(e) ? !n : t !== null && e === t;
1578
1578
  function Ki(e, t, n) {
1579
1579
  if (n === null) return !1;
1580
- for (const r of xt) {
1580
+ for (const r of St) {
1581
1581
  if (r === "color") continue;
1582
1582
  const o = e[r];
1583
1583
  if (!(o === void 0 || !cn(o)) && ce(t, r) === n)
@@ -1681,17 +1681,17 @@ function ec({ group: e, show: t, compareWith: n, layers: r, scales: o }) {
1681
1681
  layers: [a],
1682
1682
  scaleType: d ? "datetime" : o.x?.spec.scaleType ?? "discrete",
1683
1683
  variableName: i
1684
- }), p = oc(a.data, i), f = p.getValues(s, { type: "numeric" }), y = i !== null ? p.getValues(i) : [], g = c !== null ? p.getValues(c) : null, S = Xn(f, g, e.value), x = Xn(y, g, e.value);
1684
+ }), p = oc(a.data, i), f = p.getValues(s, { type: "numeric" }), y = i !== null ? p.getValues(i) : [], b = c !== null ? p.getValues(c) : null, x = Xn(f, b, e.value), S = Xn(y, b, e.value);
1685
1685
  return {
1686
1686
  value: e.value,
1687
1687
  swatch: e.swatch,
1688
- aggregate: qi(S, t),
1688
+ aggregate: qi(x, t),
1689
1689
  valueFormat: u,
1690
1690
  groupLabelFormat: e.groupLabelFormat,
1691
1691
  mainValueFormat: m,
1692
1692
  label: e.label,
1693
- observationLabel: tc(t, d, x),
1694
- comparison: nc(t, n, d, x, S)
1693
+ observationLabel: tc(t, d, S),
1694
+ comparison: nc(t, n, d, S, x)
1695
1695
  };
1696
1696
  }
1697
1697
  function tc(e, t, n) {
@@ -1732,17 +1732,17 @@ function lc({
1732
1732
  geomCompiler: s
1733
1733
  }) {
1734
1734
  if (t.legend.position === "none") return [];
1735
- const i = new Map(a.map((g) => [T(g.value), g])), c = mc({ scales: e, layers: n, geomCompiler: s }), l = gc(c), u = ce(n, "x"), d = l.map((g) => {
1736
- if (hc(g, u, n)) return null;
1737
- const S = vc({ group: g, variableLabels: o, layers: n, coordSystem: r, colorGroupsByValue: i });
1738
- return S.items.length === 0 ? null : { group: g, built: S };
1735
+ const i = new Map(a.map((b) => [T(b.value), b])), c = mc({ scales: e, layers: n, geomCompiler: s }), l = gc(c), u = ce(n, "x"), d = l.map((b) => {
1736
+ if (hc(b, u, n)) return null;
1737
+ const x = vc({ group: b, variableLabels: o, layers: n, coordSystem: r, colorGroupsByValue: i });
1738
+ return x.items.length === 0 ? null : { group: b, built: x };
1739
1739
  }).filter(h);
1740
1740
  if (d.length === 0) return [];
1741
1741
  const m = uc(d);
1742
1742
  if (t.legend.position === "auto" && Tc(m, n, r))
1743
1743
  return [];
1744
1744
  const p = Mc(t.legend.position, m, n, r), f = Vc(t.legend.display, p, n, r, s), y = f === "direct" ? Ec(n) : null;
1745
- return d.map(({ built: g }) => dc(g, p, f, y));
1745
+ return d.map(({ built: b }) => dc(b, p, f, y));
1746
1746
  }
1747
1747
  function uc(e) {
1748
1748
  return e.reduce((t, { group: n, built: r }) => {
@@ -1763,7 +1763,7 @@ function dc(e, t, n, r) {
1763
1763
  }
1764
1764
  function mc(e) {
1765
1765
  const { scales: t, layers: n, geomCompiler: r } = e, o = pc(n, r), a = [];
1766
- for (const s of xt) {
1766
+ for (const s of St) {
1767
1767
  if (!o.has(s)) continue;
1768
1768
  const i = t[s];
1769
1769
  if (i === void 0 || i.kind === "identity" || !fc(s, n)) continue;
@@ -1785,7 +1785,7 @@ function fc(e, t) {
1785
1785
  }
1786
1786
  function hc(e, t, n) {
1787
1787
  const [r] = e;
1788
- return r.scaleAestheticKey !== "color" ? !1 : So({
1788
+ return r.scaleAestheticKey !== "color" ? !1 : xo({
1789
1789
  colorVariableName: r.variableName,
1790
1790
  xVariableName: t,
1791
1791
  mapsColorAcrossMultipleLayers: yc(r.scaleAestheticKey, n),
@@ -1830,24 +1830,24 @@ function vc({
1830
1830
  return {
1831
1831
  aesthetics: e.map((u) => u.scaleAestheticKey),
1832
1832
  title: c,
1833
- items: i.map((u) => xc(u, e, s, l, o))
1833
+ items: i.map((u) => Sc(u, e, s, l, o))
1834
1834
  };
1835
1835
  }
1836
- function xc(e, t, n, r, o) {
1836
+ function Sc(e, t, n, r, o) {
1837
1837
  const a = {};
1838
1838
  for (const i of t)
1839
1839
  bc(a, i.scaleAestheticKey, i.scale.map(e.value));
1840
1840
  const s = wc(e, t, n, r, o);
1841
1841
  return {
1842
1842
  value: e.value,
1843
- label: Sc(t, e, o),
1843
+ label: xc(t, e, o),
1844
1844
  visual: a,
1845
1845
  normalizedY: null,
1846
1846
  swatchShape: e.swatchShape,
1847
1847
  valueFormat: s
1848
1848
  };
1849
1849
  }
1850
- function Sc(e, t, n) {
1850
+ function xc(e, t, n) {
1851
1851
  return e[0].scaleAestheticKey !== "color" ? null : n.get(T(t.value))?.label ?? null;
1852
1852
  }
1853
1853
  function wc(e, t, n, r, o) {
@@ -1921,7 +1921,7 @@ function Ec(e) {
1921
1921
  if (!o) return;
1922
1922
  const a = Ue(o);
1923
1923
  if (!h(a)) return;
1924
- const s = xe(o), i = Q(o) ?? te(o);
1924
+ const s = Se(o), i = Q(o) ?? te(o);
1925
1925
  if (!h(i)) return;
1926
1926
  const c = h(s) ? (s + i) / 2 : i;
1927
1927
  n.set(String(a), c);
@@ -1944,7 +1944,7 @@ class Cc extends ne {
1944
1944
  ];
1945
1945
  }
1946
1946
  run(t) {
1947
- const n = Si(t.originalData), r = Hi({
1947
+ const n = xi(t.originalData), r = Hi({
1948
1948
  scales: t.scales,
1949
1949
  layers: t.layers,
1950
1950
  coordSystem: t.coordSystem,
@@ -1988,7 +1988,7 @@ const Dc = (e, t) => e?.kind !== "perGroup" || t.some((r) => r.display === "dire
1988
1988
  return null;
1989
1989
  }
1990
1990
  } : () => null;
1991
- }, Ao = (e, t) => z(e, t.x), _c = (e, t) => z(e, t.y), sy = (e, t) => z(e, t.label), Rc = (e, t) => z(e, t.color), iy = (e, t) => z(e, t.size), cy = (e, t) => z(e, t.alpha), ly = (e, t) => z(e, t.group), uy = (e, t) => z(e, t.strokeWidth), jn = { variable: b.yRaw };
1991
+ }, Ao = (e, t) => z(e, t.x), _c = (e, t) => z(e, t.y), sy = (e, t) => z(e, t.label), Rc = (e, t) => z(e, t.color), iy = (e, t) => z(e, t.size), cy = (e, t) => z(e, t.alpha), ly = (e, t) => z(e, t.group), uy = (e, t) => z(e, t.strokeWidth), jn = { variable: g.yRaw };
1992
1992
  function At(e, t) {
1993
1993
  return K(e) ? jn : t.y ?? jn;
1994
1994
  }
@@ -2139,11 +2139,11 @@ function $c({
2139
2139
  predicate: at(A.predicate, a),
2140
2140
  scope: A.scope
2141
2141
  })
2142
- ), i = s.some(({ scope: A }) => A === "series"), c = s.some(({ scope: A }) => A === "x-value"), l = r === "overlay-anchor", u = e.data.size(), d = i ? new Array(u) : null, m = c ? new Array(u) : null, p = l ? new Array(u) : null, f = new Uint8Array(u), y = /* @__PURE__ */ new Set(), g = /* @__PURE__ */ new Set();
2143
- let S = !1, x = 0;
2142
+ ), i = s.some(({ scope: A }) => A === "series"), c = s.some(({ scope: A }) => A === "x-value"), l = r === "overlay-anchor", u = e.data.size(), d = i ? new Array(u) : null, m = c ? new Array(u) : null, p = l ? new Array(u) : null, f = new Uint8Array(u), y = /* @__PURE__ */ new Set(), b = /* @__PURE__ */ new Set();
2143
+ let x = !1, S = 0;
2144
2144
  for (const A of e.data) {
2145
2145
  let X, oe;
2146
- d !== null && (X = Fc(A), d[x] = X), m !== null && (oe = un(A, o), m[x] = oe), p !== null && (p[x] = A);
2146
+ d !== null && (X = Fc(A), d[S] = X), m !== null && (oe = un(A, o), m[S] = oe), p !== null && (p[S] = A);
2147
2147
  for (const { predicate: Xe, scope: qe } of s)
2148
2148
  if (Xe(A))
2149
2149
  switch (qe) {
@@ -2151,20 +2151,20 @@ function $c({
2151
2151
  X !== void 0 && y.add(X);
2152
2152
  break;
2153
2153
  case "x-value":
2154
- oe !== void 0 && g.add(oe);
2154
+ oe !== void 0 && b.add(oe);
2155
2155
  break;
2156
2156
  case "data-point":
2157
- f[x] = 1, S = !0;
2157
+ f[S] = 1, x = !0;
2158
2158
  break;
2159
2159
  }
2160
- x++;
2160
+ S++;
2161
2161
  }
2162
- if (y.size === 0 && g.size === 0 && !S)
2162
+ if (y.size === 0 && b.size === 0 && !x)
2163
2163
  return Mo();
2164
2164
  const w = new Uint8Array(u), M = [];
2165
2165
  let V = 0;
2166
2166
  for (let A = 0; A < u; A++) {
2167
- const X = d?.[A], oe = m?.[A], Xe = X !== void 0 && y.has(X), qe = oe !== void 0 && g.has(oe), Rn = f[A] === 1;
2167
+ const X = d?.[A], oe = m?.[A], Xe = X !== void 0 && y.has(X), qe = oe !== void 0 && b.has(oe), Rn = f[A] === 1;
2168
2168
  if (r === "observation-rerender")
2169
2169
  (Xe || Rn || qe) && (w[A] = 1, V++);
2170
2170
  else if (Xe)
@@ -2228,7 +2228,7 @@ function Kc(e, t, n) {
2228
2228
  const r = v(t[e]);
2229
2229
  return r === null ? null : { valueVariable: r, formatVariable: r };
2230
2230
  }
2231
- const zc = Object.values(b);
2231
+ const zc = Object.values(g);
2232
2232
  function Jn(e) {
2233
2233
  const t = new ge({});
2234
2234
  return {
@@ -2347,7 +2347,8 @@ class Vo extends Error {
2347
2347
  const n = t.map((r) => `- ${r.message}`).join(`
2348
2348
  `);
2349
2349
  super(`Spec validation failed:
2350
- ${n}`), this.issues = t, this.name = "SpecValidationError";
2350
+ ${n}`), this.issues = t, this.name = "SpecValidationError", console.warn(`Spec validation failed:
2351
+ ${n}`);
2351
2352
  }
2352
2353
  }
2353
2354
  class el {
@@ -2466,10 +2467,10 @@ const tr = ee("__ungrouped__"), nl = (e, t) => t === null ? !0 : e.some(
2466
2467
  skipNulls: !0
2467
2468
  }), i = s.length === 0, c = i ? [tr] : s, l = e.getValues(a), u = e.getValues(o, { type: "numeric" }), d = e.getValues(F.group, { type: "categorical" }), m = e.size(), p = /* @__PURE__ */ new Map();
2468
2469
  for (let f = 0; f < m; f++) {
2469
- const y = l[f] ?? null, g = d[f], S = i ? tr : g;
2470
- if (!h(S)) continue;
2471
- let x = p.get(y);
2472
- x || (x = /* @__PURE__ */ new Map(), p.set(y, x)), x.set(S, f);
2470
+ const y = l[f] ?? null, b = d[f], x = i ? tr : b;
2471
+ if (!h(x)) continue;
2472
+ let S = p.get(y);
2473
+ S || (S = /* @__PURE__ */ new Map(), p.set(y, S)), S.set(x, f);
2473
2474
  }
2474
2475
  return { values: u, observationIndexByPartitionAndGroup: p, uniqueGroupKeys: c, observationCount: m };
2475
2476
  };
@@ -2515,10 +2516,10 @@ class ol extends Tt {
2515
2516
  for (let f = 0; f < a; f++) {
2516
2517
  const y = s[f];
2517
2518
  if (!h(y)) continue;
2518
- const g = l(String(y));
2519
- h(g) && (d[f] = g, m[f] = g + u);
2519
+ const b = l(String(y));
2520
+ h(b) && (d[f] = b, m[f] = b + u);
2520
2521
  }
2521
- return { data: t.addVariable(b.xMin, "numeric", d).addVariable(b.xMax, "numeric", m), mapping: {} };
2522
+ return { data: t.addVariable(g.xMin, "numeric", d).addVariable(g.xMax, "numeric", m), mapping: {} };
2522
2523
  }
2523
2524
  }
2524
2525
  class al extends Tt {
@@ -2535,33 +2536,33 @@ class al extends Tt {
2535
2536
  const { values: a, observationIndexByPartitionAndGroup: s, uniqueGroupKeys: i, observationCount: c } = o, l = [...a], u = new Array(c).fill(0);
2536
2537
  for (const [, m] of s) {
2537
2538
  let p = 0, f = 0;
2538
- for (const S of i) {
2539
- const x = m.get(S);
2540
- if (x === void 0) continue;
2541
- const w = a[x];
2539
+ for (const x of i) {
2540
+ const S = m.get(x);
2541
+ if (S === void 0) continue;
2542
+ const w = a[S];
2542
2543
  w != null && (w >= 0 ? p += w : f -= w);
2543
2544
  }
2544
- let y = 0, g = 0;
2545
- for (const S of i) {
2546
- const x = m.get(S);
2547
- if (x === void 0) continue;
2548
- const w = a[x];
2545
+ let y = 0, b = 0;
2546
+ for (const x of i) {
2547
+ const S = m.get(x);
2548
+ if (S === void 0) continue;
2549
+ const w = a[S];
2549
2550
  if (w === void 0) continue;
2550
2551
  if (w === null) {
2551
- u[x] = null, l[x] = null;
2552
+ u[S] = null, l[S] = null;
2552
2553
  continue;
2553
2554
  }
2554
2555
  const M = w >= 0 ? p : f;
2555
2556
  if (M === 0) {
2556
- u[x] = 0, l[x] = 0;
2557
+ u[S] = 0, l[S] = 0;
2557
2558
  continue;
2558
2559
  }
2559
2560
  const V = w / M;
2560
- w >= 0 ? (u[x] = y, l[x] = y += V) : (l[x] = g, u[x] = g += V);
2561
+ w >= 0 ? (u[S] = y, l[S] = y += V) : (l[S] = b, u[S] = b += V);
2561
2562
  }
2562
2563
  }
2563
2564
  let d = t.addVariable(W(r, "lower"), "numeric", u).addVariable(W(r, "upper"), "numeric", l);
2564
- return r === "y" && (d = d.addVariable(b.yRaw, "numeric", a)), { data: d, mapping: {} };
2565
+ return r === "y" && (d = d.addVariable(g.yRaw, "numeric", a)), { data: d, mapping: {} };
2565
2566
  }
2566
2567
  }
2567
2568
  class sl extends Tt {
@@ -2589,21 +2590,21 @@ class il extends Tt {
2589
2590
  const { values: a, observationIndexByPartitionAndGroup: s, uniqueGroupKeys: i, observationCount: c } = o, l = [...a], u = new Array(c).fill(0);
2590
2591
  for (const [, p] of s) {
2591
2592
  let f = 0, y = 0;
2592
- for (const g of i) {
2593
- const S = p.get(g);
2594
- if (S === void 0) continue;
2595
- const x = a[S];
2596
- if (x !== void 0) {
2597
- if (x === null) {
2598
- u[S] = null, l[S] = null;
2593
+ for (const b of i) {
2594
+ const x = p.get(b);
2595
+ if (x === void 0) continue;
2596
+ const S = a[x];
2597
+ if (S !== void 0) {
2598
+ if (S === null) {
2599
+ u[x] = null, l[x] = null;
2599
2600
  continue;
2600
2601
  }
2601
- x >= 0 ? (u[S] = f, l[S] = f += x) : (l[S] = y, u[S] = y += x);
2602
+ S >= 0 ? (u[x] = f, l[x] = f += S) : (l[x] = y, u[x] = y += S);
2602
2603
  }
2603
2604
  }
2604
2605
  }
2605
2606
  let d = t.addVariable(W(r, "lower"), "numeric", u).addVariable(W(r, "upper"), "numeric", l);
2606
- r === "y" && (d = d.addVariable(b.yRaw, "numeric", a));
2607
+ r === "y" && (d = d.addVariable(g.yRaw, "numeric", a));
2607
2608
  const m = v(n[r]);
2608
2609
  return m !== null && (d = d.addVariable(m, "numeric", l)), { data: d, mapping: {} };
2609
2610
  }
@@ -2671,8 +2672,8 @@ function hl(e, t, n, r, o) {
2671
2672
  if (!n.bandwidth || !t.hasVariable(a)) return t;
2672
2673
  const s = n.bandwidth, i = t.getValues(a, { type: "numeric" }), c = t.getValues(r, { type: "numeric" }), l = t.getValues(o, { type: "numeric" }), u = t.size(), d = new Array(u), m = new Array(u);
2673
2674
  for (let p = 0; p < u; p++) {
2674
- const f = i[p], y = c[p], g = l[p];
2675
- h(f) && h(y) && h(g) ? (d[p] = f + y * s, m[p] = f + g * s) : (d[p] = null, m[p] = null);
2675
+ const f = i[p], y = c[p], b = l[p];
2676
+ h(f) && h(y) && h(b) ? (d[p] = f + y * s, m[p] = f + b * s) : (d[p] = null, m[p] = null);
2676
2677
  }
2677
2678
  return t.addVariable(r, "numeric", d).addVariable(o, "numeric", m);
2678
2679
  }
@@ -2759,7 +2760,7 @@ class bl extends ne {
2759
2760
  for (const o of t)
2760
2761
  for (const [a, s] of Object.entries(o.mapping)) {
2761
2762
  const i = a, c = i === "y" ? wt(o.yScaleType) : i;
2762
- if (!xi(c) || !n.has(c)) continue;
2763
+ if (!Si(c) || !n.has(c)) continue;
2763
2764
  const l = this.resolveVariables(i, s, o.data);
2764
2765
  this.collectFromVariables(o.data, l, c, r);
2765
2766
  }
@@ -2773,12 +2774,12 @@ class bl extends ne {
2773
2774
  */
2774
2775
  resolveVariables(t, n, r) {
2775
2776
  if (t === "y" && this.hasPositionAdjustedY(r))
2776
- return [b.yMin, b.yMax];
2777
+ return [g.yMin, g.yMax];
2777
2778
  const o = v(n);
2778
2779
  return !o || !r.hasVariable(o) ? [] : [o];
2779
2780
  }
2780
2781
  hasPositionAdjustedY(t) {
2781
- return t.hasVariable(b.yMin) && t.hasVariable(b.yMax);
2782
+ return t.hasVariable(g.yMin) && t.hasVariable(g.yMax);
2782
2783
  }
2783
2784
  collectFromVariables(t, n, r, o) {
2784
2785
  if (n.length === 0) return;
@@ -2814,7 +2815,7 @@ class vl extends ze {
2814
2815
  compile(t, n) {
2815
2816
  if (t.scaleType !== "continuous")
2816
2817
  throw new Error("ContinuousScale.compile received non-continuous spec");
2817
- const r = St(t.scaledAesthetic), o = this.computeDataDomain(n, t);
2818
+ const r = xt(t.scaledAesthetic), o = this.computeDataDomain(n, t);
2818
2819
  return r ? this.buildPositionScale(o, t) : this.buildVisualScale(o, t);
2819
2820
  }
2820
2821
  computeDataDomain(t, n) {
@@ -2825,7 +2826,7 @@ class vl extends ze {
2825
2826
  }
2826
2827
  createD3Scale(t, n, r) {
2827
2828
  let o = [r.domainMin ?? t[0], r.domainMax ?? t[1]];
2828
- const a = r.transform === "log" && xl(o), s = a ? Na() : r.transform === "sqrt" ? Oa() : Ba();
2829
+ const a = r.transform === "log" && Sl(o), s = a ? Na() : r.transform === "sqrt" ? Oa() : Ba();
2829
2830
  return r.nice && !a && (o = s.copy().domain(o).nice().domain()), s.domain([r.domainMin ?? o[0], r.domainMax ?? o[1]]).range(n).clamp(r.clamp);
2830
2831
  }
2831
2832
  buildPositionScale(t, n) {
@@ -2846,18 +2847,18 @@ class vl extends ze {
2846
2847
  });
2847
2848
  }
2848
2849
  }
2849
- const xl = (e) => {
2850
+ const Sl = (e) => {
2850
2851
  const [t, n] = e;
2851
2852
  return t > 0 && n > 0 || t < 0 && n < 0;
2852
2853
  };
2853
- class Sl extends ze {
2854
+ class xl extends ze {
2854
2855
  constructor() {
2855
2856
  super(...arguments), this.compatibleDataTypes = ["temporal"];
2856
2857
  }
2857
2858
  compile(t, n) {
2858
2859
  if (t.scaleType !== "datetime")
2859
2860
  throw new Error("DatetimeScale.compile received non-datetime spec");
2860
- const r = St(t.scaledAesthetic), o = this.computeDataDomain(n);
2861
+ const r = xt(t.scaledAesthetic), o = this.computeDataDomain(n);
2861
2862
  if (!r)
2862
2863
  throw new Error("Datetime scale is not supported for non-position aesthetics");
2863
2864
  return this.buildScale(o, t, this.collectInputDates(n));
@@ -2937,7 +2938,7 @@ class Tl extends ze {
2937
2938
  compile(t, n) {
2938
2939
  if (t.scaleType !== "discrete")
2939
2940
  throw new Error("DiscreteScale.compile received non-discrete spec");
2940
- const r = St(t.scaledAesthetic), o = this.computeDataDomain(n, t);
2941
+ const r = xt(t.scaledAesthetic), o = this.computeDataDomain(n, t);
2941
2942
  return r ? this.buildPositionScale(o, t) : this.buildVisualScale(o, t);
2942
2943
  }
2943
2944
  computeDataDomain(t, n) {
@@ -3252,7 +3253,7 @@ class Nl extends ze {
3252
3253
  }
3253
3254
  class Ol extends Me {
3254
3255
  constructor() {
3255
- super("scale"), this.register("continuous", new vl()), this.register("discrete", new Tl()), this.register("datetime", new Sl()), this.register("identity", new Ml()), this.register("palette", new Nl());
3256
+ super("scale"), this.register("continuous", new vl()), this.register("discrete", new Tl()), this.register("datetime", new xl()), this.register("identity", new Ml()), this.register("palette", new Nl());
3256
3257
  }
3257
3258
  }
3258
3259
  const Bl = (e) => !("layers" in e), I = {
@@ -3518,8 +3519,8 @@ const uu = "#E5E5E5", du = { x: "top", y: "left" }, mu = /* @__PURE__ */ new Set
3518
3519
  function pu(e) {
3519
3520
  return lu({
3520
3521
  legend: bu(e.legend),
3521
- axes: xu(e.axes),
3522
- headline: Su(e),
3522
+ axes: Su(e.axes),
3523
+ headline: xu(e),
3523
3524
  numberFormat: wu(e.appearance),
3524
3525
  content: Au(e.content),
3525
3526
  appearance: fu(e.appearance, e.themeOverrides)
@@ -3568,7 +3569,7 @@ function vu(e) {
3568
3569
  ...e.label !== void 0 ? { label: e.label } : void 0
3569
3570
  };
3570
3571
  }
3571
- function xu(e) {
3572
+ function Su(e) {
3572
3573
  if (e)
3573
3574
  return {
3574
3575
  x: ar("x", e.x, e.showGridLines),
@@ -3576,7 +3577,7 @@ function xu(e) {
3576
3577
  ...e.y2 ? { ySecondary: vu(e.y2) } : void 0
3577
3578
  };
3578
3579
  }
3579
- function Su(e) {
3580
+ function xu(e) {
3580
3581
  const { headlineNumbers: t, options: n, type: r } = e, o = r !== void 0 && mu.has(r) ? n?.pieTotalPosition : void 0;
3581
3582
  if (t === void 0 && o === void 0) return;
3582
3583
  const a = {};
@@ -3641,7 +3642,7 @@ const P = {
3641
3642
  format: "absolute",
3642
3643
  showStackTotals: !1,
3643
3644
  showCategoryLabels: !1,
3644
- labelSource: { variable: b.yRaw }
3645
+ labelSource: { variable: g.yRaw }
3645
3646
  }, it = {
3646
3647
  stat: { type: "identity" },
3647
3648
  position: "identity",
@@ -3961,23 +3962,23 @@ const ve = {
3961
3962
  ...t ? { yScaleType: "secondary" } : void 0
3962
3963
  });
3963
3964
  }, Fu = (e, t, n) => {
3964
- const { numeric: r, categorical: o, temporal: a } = e.dataset.groupVariableNamesByType(), s = mn(e.dataset), i = [...o, ...a], c = r.filter((g) => g !== s), l = t?.comboType ?? "grouped-bars", u = l === "lines";
3965
+ const { numeric: r, categorical: o, temporal: a } = e.dataset.groupVariableNamesByType(), s = mn(e.dataset), i = [...o, ...a], c = r.filter((b) => b !== s), l = t?.comboType ?? "grouped-bars", u = l === "lines";
3965
3966
  if (c.length === 1)
3966
3967
  return u ? Fo(e, t, n) : ae(e, "dodge", P.cartesian(), t, n);
3967
3968
  const d = e.axes?.hasDualYAxis === !0, m = u ? [] : c.slice(0, -1), p = u ? c : c.slice(-1), f = [], y = [];
3968
3969
  if (m.length > 0) {
3969
- const g = l === "stacked-bars" ? "stack" : "dodge", S = m.length === 1 ? m[0] : null;
3970
- h(S) ? f.push(
3970
+ const b = l === "stacked-bars" ? "stack" : "dodge", x = m.length === 1 ? m[0] : null;
3971
+ h(x) ? f.push(
3971
3972
  I.bar({
3972
3973
  transforms: [
3973
3974
  be.constant({
3974
3975
  variableName: ir,
3975
3976
  type: "categorical",
3976
- value: S
3977
+ value: x
3977
3978
  })
3978
3979
  ],
3979
- aes: { y: S, color: ir },
3980
- position: g
3980
+ aes: { y: x, color: ir },
3981
+ position: b
3981
3982
  })
3982
3983
  ) : f.push(
3983
3984
  I.bar({
@@ -3990,40 +3991,40 @@ const ve = {
3990
3991
  })
3991
3992
  ],
3992
3993
  aes: { y: j, color: N },
3993
- position: g
3994
+ position: b
3994
3995
  })
3995
3996
  );
3996
3997
  }
3997
3998
  if (u && p.length >= 2) {
3998
- const g = d ? p.slice(0, -1) : p, S = g.length === 1 ? g[0] : null;
3999
- if (h(S))
4000
- f.push(Ft(S, !1, n));
3999
+ const b = d ? p.slice(0, -1) : p, x = b.length === 1 ? b[0] : null;
4000
+ if (h(x))
4001
+ f.push(Ft(x, !1, n));
4001
4002
  else {
4002
- const x = fn({
4003
+ const S = fn({
4003
4004
  appearance: n,
4004
- seriesVariables: g
4005
+ seriesVariables: b
4005
4006
  });
4006
4007
  f.push(
4007
4008
  I.line({
4008
4009
  transforms: [
4009
4010
  be.reshape({
4010
4011
  keep: i,
4011
- reshape: g,
4012
+ reshape: b,
4012
4013
  keyName: N,
4013
4014
  valueName: j
4014
4015
  })
4015
4016
  ],
4016
- aes: { y: j, color: N, ...x.mapping }
4017
+ aes: { y: j, color: N, ...S.mapping }
4017
4018
  })
4018
- ), y.push(...x.scales);
4019
+ ), y.push(...S.scales);
4019
4020
  }
4020
4021
  if (d) {
4021
- const x = p[p.length - 1];
4022
- h(x) && f.push(Ft(x, !0, n));
4022
+ const S = p[p.length - 1];
4023
+ h(S) && f.push(Ft(S, !0, n));
4023
4024
  }
4024
4025
  } else
4025
- for (const g of p)
4026
- f.push(Ft(g, d, n));
4026
+ for (const b of p)
4027
+ f.push(Ft(b, d, n));
4027
4028
  return {
4028
4029
  dataset: e.dataset,
4029
4030
  layers: f,
@@ -4336,7 +4337,7 @@ const Rt = {
4336
4337
  coordinates: e.coordinates.map((n) => nd(n, t)),
4337
4338
  params: e.params ?? {},
4338
4339
  zOrder: e.zOrder ?? null
4339
- }), nd = (e, t) => "observation" in e ? { observation: Se(e.observation, t) } : e, rd = (e) => ({
4340
+ }), nd = (e, t) => "observation" in e ? { observation: xe(e.observation, t) } : e, rd = (e) => ({
4340
4341
  id: e.id ?? crypto.randomUUID(),
4341
4342
  content: e.content,
4342
4343
  x: e.x,
@@ -4346,13 +4347,13 @@ const Rt = {
4346
4347
  backgroundColorStyle: e.backgroundColorStyle ?? mr.backgroundColorStyle
4347
4348
  }), od = (e, t) => ({
4348
4349
  id: e.id ?? crypto.randomUUID(),
4349
- start: Se(e.start, t),
4350
- end: Se(e.end, t),
4350
+ start: xe(e.start, t),
4351
+ end: xe(e.end, t),
4351
4352
  label: e.label,
4352
4353
  color: e.color ?? Rt.color,
4353
4354
  size: e.size ?? Rt.size,
4354
4355
  labelCrossPosition: e.labelCrossPosition ?? Rt.labelCrossPosition
4355
- }), Se = (e, t) => {
4356
+ }), xe = (e, t) => {
4356
4357
  if (e.layerIndex === void 0)
4357
4358
  return { anchorValue: e.anchorValue, groupValue: e.groupValue };
4358
4359
  const n = t[e.layerIndex]?.id;
@@ -4363,14 +4364,14 @@ const Rt = {
4363
4364
  return { layerId: n, anchorValue: e.anchorValue, groupValue: e.groupValue };
4364
4365
  }, ad = (e, t) => ({
4365
4366
  id: e.id ?? crypto.randomUUID(),
4366
- anchor: Se(e.anchor, t),
4367
+ anchor: xe(e.anchor, t),
4367
4368
  sticker: e.sticker
4368
4369
  }), sd = (e, t) => ({
4369
4370
  id: e.id ?? crypto.randomUUID(),
4370
- anchor: Se(e.anchor, t)
4371
+ anchor: xe(e.anchor, t)
4371
4372
  }), id = (e, t) => ({
4372
4373
  id: e.id ?? crypto.randomUUID(),
4373
- anchor: Se(e.anchor, t),
4374
+ anchor: xe(e.anchor, t),
4374
4375
  content: e.content
4375
4376
  }), cd = (e) => ({
4376
4377
  id: e.id ?? crypto.randomUUID(),
@@ -4507,7 +4508,7 @@ function Ve(e, t) {
4507
4508
  return { type: r };
4508
4509
  }
4509
4510
  function bd(e, t, n) {
4510
- if (!Sd(n))
4511
+ if (!xd(n))
4511
4512
  return wd(e, t, n);
4512
4513
  switch (n.geom) {
4513
4514
  case "point":
@@ -4526,7 +4527,7 @@ function vd(e, t, n) {
4526
4527
  const r = n.map((o) => bd(e, t, o));
4527
4528
  return kd(r);
4528
4529
  }
4529
- const xd = (e, t, n) => n.label !== void 0 ? n.label : Id(e, t, n), Sd = (e) => ic(e.geom);
4530
+ const Sd = (e, t, n) => n.label !== void 0 ? n.label : Id(e, t, n), xd = (e) => ic(e.geom);
4530
4531
  function wd(e, t, n) {
4531
4532
  const r = n.position ?? "identity";
4532
4533
  return {
@@ -4544,7 +4545,7 @@ function wd(e, t, n) {
4544
4545
  };
4545
4546
  }
4546
4547
  const ke = (e, t, n, r) => {
4547
- const o = { ...e, ...t.mapping }, a = xd(t.geom, n, o);
4548
+ const o = { ...e, ...t.mapping }, a = Sd(t.geom, n, o);
4548
4549
  return {
4549
4550
  ...Lu(t.geom, r),
4550
4551
  ...t.dataLabels,
@@ -5078,11 +5079,11 @@ const nm = ({ layer: e }) => {
5078
5079
  }, rm = ({ layer: e }) => {
5079
5080
  if (e.position !== "stack") return;
5080
5081
  const t = v(e.mapping.x);
5081
- if (t === null || !e.data.hasVariable(b.yMin) || !e.data.hasVariable(b.yMax))
5082
+ if (t === null || !e.data.hasVariable(g.yMin) || !e.data.hasVariable(g.yMax))
5082
5083
  return;
5083
5084
  const n = /* @__PURE__ */ new Map();
5084
5085
  for (const o of e.data) {
5085
- const a = o[t], s = xe(o), i = Q(o), c = mt(o), l = Pe(o), u = mi(o);
5086
+ const a = o[t], s = Se(o), i = Q(o), c = mt(o), l = Pe(o), u = mi(o);
5086
5087
  if (!h(a) || !h(s) || !h(i) || !h(c) || !h(l) || !h(u))
5087
5088
  continue;
5088
5089
  const d = u >= 0;
@@ -5223,7 +5224,7 @@ class mm extends Te {
5223
5224
  super(), this.geomCompiler = t;
5224
5225
  }
5225
5226
  dependencies(t) {
5226
- return [...xt].map((n) => t.scales[n]);
5227
+ return [...St].map((n) => t.scales[n]);
5227
5228
  }
5228
5229
  compileLayer(t, n) {
5229
5230
  const r = this.geomCompiler.getVisualAesthetics(t.geom), o = pm(t.data, t.mapping, r, n.scales);
@@ -5425,7 +5426,7 @@ const hn = "–", Uo = "n/a", D = { timeZone: "UTC" }, C = (e) => (t) => {
5425
5426
  } catch {
5426
5427
  return Uo;
5427
5428
  }
5428
- }, re = (e) => (t) => L(t) ? e(t) : hn, yn = (e) => (t) => Ye(t) ? t : hn, ym = 2, gm = 3, bm = 2, vm = 0, xm = 1, Sm = 2, wm = Xa.humanizer({
5429
+ }, re = (e) => (t) => L(t) ? e(t) : hn, yn = (e) => (t) => Ye(t) ? t : hn, ym = 2, gm = 3, bm = 2, vm = 0, Sm = 1, xm = 2, wm = Xa.humanizer({
5429
5430
  language: "en",
5430
5431
  spacer: "",
5431
5432
  delimiter: " ",
@@ -5447,7 +5448,7 @@ const hn = "–", Uo = "n/a", D = { timeZone: "UTC" }, C = (e) => (t) => {
5447
5448
  numberFormat: n,
5448
5449
  intlOptions: r
5449
5450
  }) => re((o) => {
5450
- const a = typeof n.decimals == "number" ? n.decimals : ym, s = xn(o, a), { base: i, suffix: c } = vn(o, n.abbreviation), l = {
5451
+ const a = typeof n.decimals == "number" ? n.decimals : ym, s = Sn(o, a), { base: i, suffix: c } = vn(o, n.abbreviation), l = {
5451
5452
  ...s,
5452
5453
  ...jr(e) ? { style: "currency", currencyDisplay: "narrowSymbol", currency: e.iso } : {},
5453
5454
  ...r
@@ -5458,7 +5459,7 @@ const hn = "–", Uo = "n/a", D = { timeZone: "UTC" }, C = (e) => (t) => {
5458
5459
  numberFormat: t,
5459
5460
  intlOptions: n
5460
5461
  }) => re((r) => {
5461
- const { base: o, suffix: a } = vn(r, t.abbreviation), i = { ...xn(o, t.decimals), ...n };
5462
+ const { base: o, suffix: a } = vn(r, t.abbreviation), i = { ...Sn(o, t.decimals), ...n };
5462
5463
  return `${Intl.NumberFormat(e, i).format(o)}${a}`;
5463
5464
  }), bn = (e) => re((t) => wm(t)), Wo = ({ locale: e, intlOptions: t }) => re(
5464
5465
  (n) => Intl.NumberFormat(e, { maximumFractionDigits: 0, ...t }).format(n)
@@ -5467,7 +5468,7 @@ const hn = "–", Uo = "n/a", D = { timeZone: "UTC" }, C = (e) => (t) => {
5467
5468
  numberFormat: t,
5468
5469
  intlOptions: n
5469
5470
  }) => re((r) => {
5470
- const o = xn(r, t.decimals);
5471
+ const o = Sn(r, t.decimals);
5471
5472
  return Intl.NumberFormat(e, { ...o, ...n, style: "percent" }).format(r);
5472
5473
  }), vn = (e, t = "none") => {
5473
5474
  switch (t) {
@@ -5480,10 +5481,10 @@ const hn = "–", Uo = "n/a", D = { timeZone: "UTC" }, C = (e) => (t) => {
5480
5481
  default:
5481
5482
  return { base: e / Re[t], suffix: t };
5482
5483
  }
5483
- }, xn = (e, t) => {
5484
+ }, Sn = (e, t) => {
5484
5485
  if (typeof t == "number")
5485
5486
  return { minimumFractionDigits: t, maximumFractionDigits: t };
5486
- const n = Math.ceil(Math.log10(Math.abs(e))), r = n >= gm ? vm : n === bm ? xm : Sm;
5487
+ const n = Math.ceil(Math.log10(Math.abs(e))), r = n >= gm ? vm : n === bm ? Sm : xm;
5487
5488
  return {
5488
5489
  minimumFractionDigits: t === "auto" ? 0 : r,
5489
5490
  maximumFractionDigits: r
@@ -5510,7 +5511,7 @@ const hn = "–", Uo = "n/a", D = { timeZone: "UTC" }, C = (e) => (t) => {
5510
5511
  }).format(n)
5511
5512
  ), zo = ({ locale: e, intlOptions: t }) => C(
5512
5513
  (n) => Intl.DateTimeFormat(e, { month: "long", ...D, ...t }).format(n)
5513
- ), Sn = ({ locale: e, intlOptions: t }) => C(
5514
+ ), xn = ({ locale: e, intlOptions: t }) => C(
5514
5515
  (n) => Intl.DateTimeFormat(e, {
5515
5516
  month: "short",
5516
5517
  year: "numeric",
@@ -5630,7 +5631,7 @@ const hn = "–", Uo = "n/a", D = { timeZone: "UTC" }, C = (e) => (t) => {
5630
5631
  case "month":
5631
5632
  return Pm(e);
5632
5633
  case "month_year":
5633
- return Sn(e);
5634
+ return xn(e);
5634
5635
  case "percentage":
5635
5636
  return Fm(e);
5636
5637
  case "quarter":
@@ -5816,7 +5817,7 @@ const hn = "–", Uo = "n/a", D = { timeZone: "UTC" }, C = (e) => (t) => {
5816
5817
  case "month":
5817
5818
  return zo(e);
5818
5819
  case "month_year":
5819
- return Sn(e);
5820
+ return xn(e);
5820
5821
  case "percentage":
5821
5822
  return Ho(e);
5822
5823
  case "quarter":
@@ -5879,9 +5880,9 @@ const hn = "–", Uo = "n/a", D = { timeZone: "UTC" }, C = (e) => (t) => {
5879
5880
  height: e.containerSize.height
5880
5881
  };
5881
5882
  }, Jm = (e) => {
5882
- const t = vr(e.rows, e.height), n = vr(e.cols, e.width), r = xr(t), o = xr(n), a = /* @__PURE__ */ new Map();
5883
+ const t = vr(e.rows, e.height), n = vr(e.cols, e.width), r = Sr(t), o = Sr(n), a = /* @__PURE__ */ new Map();
5883
5884
  for (const s of e.placements) {
5884
- const i = s.rowSpan ?? 1, c = s.colSpan ?? 1, l = o[s.col] ?? 0, u = r[s.row] ?? 0, d = Sr(n, s.col, c), m = Sr(t, s.row, i);
5885
+ const i = s.rowSpan ?? 1, c = s.colSpan ?? 1, l = o[s.col] ?? 0, u = r[s.row] ?? 0, d = xr(n, s.col, c), m = xr(t, s.row, i);
5885
5886
  a.set(s.name, { x: l, y: u, width: Math.max(0, d), height: Math.max(0, m) });
5886
5887
  }
5887
5888
  return a;
@@ -5925,13 +5926,13 @@ const hn = "–", Uo = "n/a", D = { timeZone: "UTC" }, C = (e) => (t) => {
5925
5926
  a.type === "fixed" ? n += a.pixels : r += a.weight;
5926
5927
  const o = Math.max(0, t - n);
5927
5928
  return e.map((a) => a.type === "fixed" ? a.pixels : r === 0 ? 0 : a.weight / r * o);
5928
- }, xr = (e) => {
5929
+ }, Sr = (e) => {
5929
5930
  const t = new Array(e.length);
5930
5931
  let n = 0;
5931
5932
  for (let r = 0; r < e.length; r++)
5932
5933
  t[r] = n, n += e[r] ?? 0;
5933
5934
  return t;
5934
- }, Sr = (e, t, n) => {
5935
+ }, xr = (e, t, n) => {
5935
5936
  let r = 0;
5936
5937
  const o = Math.min(t + n, e.length);
5937
5938
  for (let a = t; a < o; a++)
@@ -6017,19 +6018,19 @@ const hn = "–", Uo = "n/a", D = { timeZone: "UTC" }, C = (e) => (t) => {
6017
6018
  const i = t === "y", c = n.height + s.top, l = n.width + s.right;
6018
6019
  let u = 0, d = 0;
6019
6020
  for (const m of e.differenceArrows) {
6020
- const { start: p, end: f, size: y, label: g } = m;
6021
+ const { start: p, end: f, size: y, label: b } = m;
6021
6022
  if (!wr(p.x, p.y) || !wr(f.x, f.y)) continue;
6022
- const S = Jo(y, r), x = S.offsetFromHigherObservation + S.arrowheadSize + S.arrowEndGap, w = ea({
6023
+ const x = Jo(y, r), S = x.offsetFromHigherObservation + x.arrowheadSize + x.arrowEndGap, w = ea({
6023
6024
  locale: o,
6024
- kind: g,
6025
+ kind: b,
6025
6026
  startValue: p.measurementValue,
6026
6027
  endValue: f.measurementValue
6027
6028
  }), M = a(w, y);
6028
6029
  if (i) {
6029
- const V = Math.max(p.x, f.x), B = x + M.width / 2 + S.labelPaddingX;
6030
+ const V = Math.max(p.x, f.x), B = S + M.width / 2 + x.labelPaddingX;
6030
6031
  d = Math.max(d, Ar(B, V, l));
6031
6032
  } else {
6032
- const V = Math.max(p.y, f.y), B = x + S.labelLineHeight / 2 + S.labelPaddingY;
6033
+ const V = Math.max(p.y, f.y), B = S + x.labelLineHeight / 2 + x.labelPaddingY;
6033
6034
  u = Math.max(u, Ar(B, V, c));
6034
6035
  }
6035
6036
  }
@@ -6115,90 +6116,128 @@ class hy {
6115
6116
  this.measurer = t;
6116
6117
  }
6117
6118
  compile(t) {
6118
- const n = t.formattingLocale ?? t.parsingLocale, r = t.axes.filter((l) => l.geometry === "linear"), a = t.axes.filter((l) => l.geometry !== "linear").map(
6119
- (l) => gp(l, Lr(l, n, t.numberFormat))
6120
- ), s = bp(a, this.measurer.measureTickLabel), { formattedAxes: i, layout: c } = bt({
6121
- axes: r,
6119
+ const n = bt({
6120
+ axes: t.axes,
6122
6121
  numberFormat: t.numberFormat,
6123
6122
  formattedLegends: t.formattedLegends,
6124
6123
  containerSize: t.containerSize,
6125
6124
  externalMeasurements: t.externalMeasurements,
6126
6125
  annotationOverflow: Vn,
6127
6126
  headline: t.headline,
6128
- locale: n
6129
- }).pipe(({ axes: l, numberFormat: u, locale: d }) => ({
6130
- axisBundles: l.map((m) => ({
6131
- axis: m,
6132
- resolveFormatter: Lr(m, d, u),
6133
- formatted: this.seedAxis(m)
6127
+ locale: t.formattingLocale ?? t.parsingLocale
6128
+ }).pipe(({ axes: r, numberFormat: o, locale: a }) => {
6129
+ const s = r.filter((i) => i.geometry !== "linear").map((i) => gp(i, Lr(i, a, o)));
6130
+ return {
6131
+ cartesianAxes: r.filter((i) => i.geometry === "linear"),
6132
+ formattedPolarAxes: s,
6133
+ polarMargin: bp(s, this.measurer.measureTickLabel)
6134
+ };
6135
+ }).pipe(({ cartesianAxes: r, numberFormat: o, locale: a }) => ({
6136
+ axisBundles: r.map((s) => ({
6137
+ axis: s,
6138
+ resolveFormatter: Lr(s, a, o),
6139
+ formatted: this.seedAxis(s)
6134
6140
  }))
6135
- })).pipe(({ axisBundles: l, formattedLegends: u, containerSize: d, externalMeasurements: m, annotationOverflow: p, headline: f }) => ({
6136
- layout: this.resolveLayout({
6137
- axes: l.map((y) => y.formatted),
6138
- formattedLegends: u,
6139
- containerSize: d,
6140
- externalMeasurements: m,
6141
- annotationOverflow: p,
6142
- headline: f,
6143
- polarMargin: s
6141
+ })).pipe(
6142
+ ({
6143
+ axisBundles: r,
6144
+ formattedLegends: o,
6145
+ containerSize: a,
6146
+ externalMeasurements: s,
6147
+ annotationOverflow: i,
6148
+ headline: c,
6149
+ polarMargin: l
6150
+ }) => ({
6151
+ layout: this.resolveLayout({
6152
+ axes: r.map((u) => u.formatted),
6153
+ formattedLegends: o,
6154
+ containerSize: a,
6155
+ externalMeasurements: s,
6156
+ annotationOverflow: i,
6157
+ headline: c,
6158
+ polarMargin: l
6159
+ })
6144
6160
  })
6145
- })).pipe(({ axisBundles: l, layout: u }) => ({
6146
- axisBundles: l.map(
6147
- (d) => Tr(d.axis.position) ? { ...d, formatted: this.finalizeAxis(d.axis, d.resolveFormatter, u.panel) } : d
6161
+ ).pipe(({ axisBundles: r, layout: o }) => ({
6162
+ axisBundles: r.map(
6163
+ (a) => Mr(a.axis.position) ? { ...a, formatted: this.finalizeAxis(a.axis, a.resolveFormatter, o.panel) } : a
6148
6164
  )
6149
- })).pipe(({ axisBundles: l, formattedLegends: u, containerSize: d, externalMeasurements: m, annotationOverflow: p, headline: f }) => ({
6150
- layout: this.resolveLayout({
6151
- axes: l.map((y) => y.formatted),
6152
- formattedLegends: u,
6153
- containerSize: d,
6154
- externalMeasurements: m,
6155
- annotationOverflow: p,
6156
- headline: f,
6157
- polarMargin: s
6165
+ })).pipe(
6166
+ ({
6167
+ axisBundles: r,
6168
+ formattedLegends: o,
6169
+ containerSize: a,
6170
+ externalMeasurements: s,
6171
+ annotationOverflow: i,
6172
+ headline: c,
6173
+ polarMargin: l
6174
+ }) => ({
6175
+ layout: this.resolveLayout({
6176
+ axes: r.map((u) => u.formatted),
6177
+ formattedLegends: o,
6178
+ containerSize: a,
6179
+ externalMeasurements: s,
6180
+ annotationOverflow: i,
6181
+ headline: c,
6182
+ polarMargin: l
6183
+ })
6158
6184
  })
6159
- })).pipe(({ axisBundles: l, layout: u }) => ({
6160
- formattedAxes: l.map(
6161
- (d) => Tr(d.axis.position) ? d.formatted : this.finalizeAxis(d.axis, d.resolveFormatter, u.panel)
6185
+ ).pipe(({ axisBundles: r, layout: o }) => ({
6186
+ formattedAxes: r.map(
6187
+ (a) => Mr(a.axis.position) ? a.formatted : this.finalizeAxis(a.axis, a.resolveFormatter, o.panel)
6162
6188
  )
6163
6189
  })).pipe(
6164
- ({ formattedAxes: l, formattedLegends: u, containerSize: d, externalMeasurements: m, annotationOverflow: p, headline: f }) => ({
6190
+ ({
6191
+ formattedAxes: r,
6192
+ formattedLegends: o,
6193
+ containerSize: a,
6194
+ externalMeasurements: s,
6195
+ annotationOverflow: i,
6196
+ headline: c,
6197
+ polarMargin: l
6198
+ }) => ({
6165
6199
  layout: this.resolveLayout({
6166
- axes: l,
6167
- formattedLegends: u,
6168
- containerSize: d,
6169
- externalMeasurements: m,
6170
- annotationOverflow: p,
6171
- headline: f,
6172
- polarMargin: s
6200
+ axes: r,
6201
+ formattedLegends: o,
6202
+ containerSize: a,
6203
+ externalMeasurements: s,
6204
+ annotationOverflow: i,
6205
+ headline: c,
6206
+ polarMargin: l
6173
6207
  })
6174
6208
  })
6175
6209
  ).pipe(
6176
6210
  ({
6177
- formattedAxes: l,
6178
- formattedLegends: u,
6179
- containerSize: d,
6180
- externalMeasurements: m,
6181
- layout: p,
6182
- annotationOverflow: f,
6183
- headline: y,
6184
- locale: g
6211
+ formattedAxes: r,
6212
+ formattedLegends: o,
6213
+ containerSize: a,
6214
+ externalMeasurements: s,
6215
+ layout: i,
6216
+ annotationOverflow: c,
6217
+ headline: l,
6218
+ polarMargin: u,
6219
+ locale: d
6185
6220
  }) => {
6186
- const S = this.measureAnnotationOverflow(t, p.panel, g, f);
6187
- return S === f ? { formattedAxes: l, layout: p } : {
6188
- formattedAxes: l,
6221
+ const m = this.measureAnnotationOverflow(t, i.panel, d, c);
6222
+ return m === c ? { formattedAxes: r, layout: i } : {
6223
+ formattedAxes: r,
6189
6224
  layout: this.resolveLayout({
6190
- axes: l,
6191
- formattedLegends: u,
6192
- containerSize: d,
6193
- externalMeasurements: m,
6194
- annotationOverflow: S,
6195
- headline: y,
6196
- polarMargin: s
6225
+ axes: r,
6226
+ formattedLegends: o,
6227
+ containerSize: a,
6228
+ externalMeasurements: s,
6229
+ annotationOverflow: m,
6230
+ headline: l,
6231
+ polarMargin: u
6197
6232
  })
6198
6233
  };
6199
6234
  }
6200
6235
  ).result();
6201
- return { formattedAxes: i, layout: c, formattedPolarAxes: a };
6236
+ return {
6237
+ formattedAxes: n.formattedAxes,
6238
+ layout: n.layout,
6239
+ formattedPolarAxes: n.formattedPolarAxes
6240
+ };
6202
6241
  }
6203
6242
  /**
6204
6243
  * Computes the panel pad needed so annotation labels stay inside the graph and don't overlap the panel edges.
@@ -6295,11 +6334,11 @@ class hy {
6295
6334
  return t === void 0 ? 0 : pp({ headline: t, containerSize: n, measurer: this.measurer });
6296
6335
  }
6297
6336
  }
6298
- const Tr = (e) => e === "left" || e === "right", Mr = 5, tt = 8, yp = (e) => {
6337
+ const Tr = 5, tt = 8, Mr = (e) => e === "left" || e === "right", yp = (e) => {
6299
6338
  const [t, ...n] = e.tickCandidates;
6300
6339
  if (t)
6301
6340
  return e.geometry === "circular" ? t : n.reduce(
6302
- (r, o) => Math.abs(o.ticks.length - Mr) < Math.abs(r.ticks.length - Mr) ? o : r,
6341
+ (r, o) => Math.abs(o.ticks.length - Tr) < Math.abs(r.ticks.length - Tr) ? o : r,
6303
6342
  t
6304
6343
  );
6305
6344
  }, gp = (e, t) => {
@@ -6374,7 +6413,7 @@ function yt(e, t) {
6374
6413
  function kn(e, t) {
6375
6414
  return e === "x" ? t.y : t.x;
6376
6415
  }
6377
- function xp(e, t) {
6416
+ function Sp(e, t) {
6378
6417
  return {
6379
6418
  main: yt(e, t),
6380
6419
  cross: kn(e, t)
@@ -6383,7 +6422,7 @@ function xp(e, t) {
6383
6422
  function gy(e) {
6384
6423
  return e.type === "cartesian";
6385
6424
  }
6386
- const In = 12, Sp = 4, wp = (e) => {
6425
+ const In = 12, xp = 4, wp = (e) => {
6387
6426
  const t = [];
6388
6427
  if (!e.layer.dataLabels.showDataLabels) return t;
6389
6428
  for (const n of e.layer.data) {
@@ -6480,8 +6519,8 @@ const In = 12, Sp = 4, wp = (e) => {
6480
6519
  if (m === "") continue;
6481
6520
  const { width: p, height: f } = r("dataLabel", m), y = aa(d, n);
6482
6521
  p > y.width && (c = !0);
6483
- const g = l === null ? null : u[l], S = L(g) && g < 0;
6484
- i.push({ key: s(u), isNegative: S, text: m, labelWidth: p, labelHeight: f, bounds: y });
6522
+ const b = l === null ? null : u[l], x = L(b) && b < 0;
6523
+ i.push({ key: s(u), isNegative: x, text: m, labelWidth: p, labelHeight: f, bounds: y });
6485
6524
  }
6486
6525
  return { entries: i, shouldRotate: !a && c };
6487
6526
  }, aa = (e, t) => ({
@@ -6497,7 +6536,7 @@ const In = 12, Sp = 4, wp = (e) => {
6497
6536
  let a = t, s = n - t;
6498
6537
  return s < 0 && (a += s, s = -s), { x: a, y: 1 - o, width: s, height: o - r };
6499
6538
  }, Vp = (e, t) => {
6500
- const n = mt(t), r = Pe(t), o = xe(t), a = Q(t) ?? te(t);
6539
+ const n = mt(t), r = Pe(t), o = Se(t), a = Q(t) ?? te(t);
6501
6540
  return n === null || r === null || o === null || a === null ? null : sa(e, n, r, o, a);
6502
6541
  }, kp = (e, t) => {
6503
6542
  const { xMin: n, xMax: r, yMin: o, yMax: a } = t.anchor;
@@ -6543,19 +6582,19 @@ const In = 12, Sp = 4, wp = (e) => {
6543
6582
  panelWidth: a,
6544
6583
  panelHeight: s
6545
6584
  }) => {
6546
- const i = e === "top" || e === "bottom", c = t.x + t.width / 2, l = t.y + t.height / 2, u = ia(n, r, o), d = i ? u.height : u.width, m = i ? u.width : u.height, p = i ? t.height : t.width, f = i ? t.width : t.height, y = d / 2, { edgeCoord: g, outwardSign: S, panelExtent: x } = Dp(e, t, a, s);
6585
+ const i = e === "top" || e === "bottom", c = t.x + t.width / 2, l = t.y + t.height / 2, u = ia(n, r, o), d = i ? u.height : u.width, m = i ? u.width : u.height, p = i ? t.height : t.width, f = i ? t.width : t.height, y = d / 2, { edgeCoord: b, outwardSign: x, panelExtent: S } = Dp(e, t, a, s);
6547
6586
  if (d + Ht < p) {
6548
6587
  if (m > f) return null;
6549
6588
  if (o) return { x: c, y: l, isRotated: !0, position: "inside" };
6550
- const M = g - S * (y + Ht);
6589
+ const M = b - x * (y + Ht);
6551
6590
  return {
6552
6591
  ...i ? { x: c, y: M } : { x: M, y: l },
6553
6592
  isRotated: !1,
6554
6593
  position: "inside"
6555
6594
  };
6556
6595
  }
6557
- const w = g + S * (y + Ht);
6558
- return w - y < 0 || w + y > x ? null : {
6596
+ const w = b + x * (y + Ht);
6597
+ return w - y < 0 || w + y > S ? null : {
6559
6598
  ...i ? { x: c, y: w } : { x: w, y: l },
6560
6599
  isRotated: o,
6561
6600
  position: "outside"
@@ -6642,14 +6681,14 @@ const In = 12, Sp = 4, wp = (e) => {
6642
6681
  };
6643
6682
  function Bp(e) {
6644
6683
  return {
6645
- startAngle: e[b.xMin],
6646
- endAngle: e[b.xMax]
6684
+ startAngle: e[g.xMin],
6685
+ endAngle: e[g.xMax]
6647
6686
  };
6648
6687
  }
6649
6688
  function Gp(e) {
6650
6689
  return {
6651
- innerRadius: e[b.yMin],
6652
- outerRadius: e[b.yMax] ?? e[b.y]
6690
+ innerRadius: e[g.yMin],
6691
+ outerRadius: e[g.yMax] ?? e[g.y]
6653
6692
  };
6654
6693
  }
6655
6694
  const $p = " · ", Up = (e) => typeof e == "string" ? e : e instanceof Date ? e.toISOString() : String(e), Yp = (e, t) => {
@@ -6664,11 +6703,11 @@ const $p = " · ", Up = (e) => typeof e == "string" ? e : e instanceof Date ? e.
6664
6703
  if (i === null || c === null || l === null) continue;
6665
6704
  const u = e.formatLabel(s);
6666
6705
  if (u === "") continue;
6667
- const d = n === null ? null : n(s), m = d === null ? u : `${Up(d)}${$p}${u}`, { width: p, height: f } = e.measureDataLabel("dataLabel", m), y = (i + c) / 2, g = Math.abs(Math.sin(y)) * (p / 2) + Math.abs(Math.cos(y)) * (f / 2), S = l * a + Sp + g, x = r + Math.sin(y) * S, w = o - Math.cos(y) * S, M = p / 2, V = f / 2;
6668
- x - M < 0 || x + M > e.panelRect.width || w - V < 0 || w + V > e.panelRect.height || t.push({
6706
+ const d = n === null ? null : n(s), m = d === null ? u : `${Up(d)}${$p}${u}`, { width: p, height: f } = e.measureDataLabel("dataLabel", m), y = (i + c) / 2, b = Math.abs(Math.sin(y)) * (p / 2) + Math.abs(Math.cos(y)) * (f / 2), x = l * a + xp + b, S = r + Math.sin(y) * x, w = o - Math.cos(y) * x, M = p / 2, V = f / 2;
6707
+ S - M < 0 || S + M > e.panelRect.width || w - V < 0 || w + V > e.panelRect.height || t.push({
6669
6708
  layerId: e.layer.id,
6670
6709
  key: e.getObservationKey(s),
6671
- x,
6710
+ x: S,
6672
6711
  y: w,
6673
6712
  text: m,
6674
6713
  width: p,
@@ -6752,7 +6791,7 @@ const Xp = ({
6752
6791
  }, Zp = (e) => {
6753
6792
  const t = To(e);
6754
6793
  return (n) => {
6755
- const r = xe(n), o = Q(n);
6794
+ const r = Se(n), o = Q(n);
6756
6795
  if (!L(r) || !L(o)) return null;
6757
6796
  const a = Math.abs(o - r);
6758
6797
  if (a === 0) return null;
@@ -6925,7 +6964,7 @@ const Xp = ({
6925
6964
  labelStrokeWidth: l.labelStrokeWidth,
6926
6965
  labelFontWeight: l.labelFontWeight
6927
6966
  };
6928
- }, df = 100, xy = ({
6967
+ }, df = 100, Sy = ({
6929
6968
  items: e,
6930
6969
  containerHeight: t,
6931
6970
  labelHeight: n
@@ -6951,7 +6990,7 @@ const Xp = ({
6951
6990
  break;
6952
6991
  }
6953
6992
  return { placements: r.filter((l) => l.y >= 0 && l.y <= t).map((l) => ({ y: l.y, anchorY: l.anchorY, payload: l.payload })), hasOverlap: a };
6954
- }, Sy = ({
6993
+ }, xy = ({
6955
6994
  headline: e,
6956
6995
  show: t,
6957
6996
  numberFormat: n,
@@ -7019,12 +7058,12 @@ const Ty = ({ guides: e, numberFormat: t, layer: n, locale: r }) => {
7019
7058
  if (i === null) return null;
7020
7059
  const c = a ? wt(n.yScaleType) : "x", l = En(e, c)?.valueFormat ?? { type: "decimal" };
7021
7060
  return E({ valueFormat: l, locale: r, numberFormat: t })(i);
7022
- }, vf = 800, Vr = 400, xf = {
7061
+ }, vf = 800, Vr = 400, Sf = {
7023
7062
  thin: { strokeWidth: { minValue: 1.5, targetValue: 2 }, arrowheadLength: { minValue: 7, targetValue: 8 } },
7024
7063
  medium: { strokeWidth: { minValue: 3, targetValue: 4 }, arrowheadLength: { minValue: 14, targetValue: 16 } },
7025
7064
  thick: { strokeWidth: { minValue: 6, targetValue: 8 }, arrowheadLength: { minValue: 28, targetValue: 32 } }
7026
- }, Sf = (e) => Math.max(1, (e - Vr) / (vf - Vr) + 1), wf = (e, t) => {
7027
- const n = Sf(t), r = xf[e];
7065
+ }, xf = (e) => Math.max(1, (e - Vr) / (vf - Vr) + 1), wf = (e, t) => {
7066
+ const n = xf(t), r = Sf[e];
7028
7067
  return {
7029
7068
  strokeWidth: Math.min(r.strokeWidth.targetValue, r.strokeWidth.minValue * n),
7030
7069
  arrowheadLength: Math.min(r.arrowheadLength.targetValue, r.arrowheadLength.minValue * n)
@@ -7252,10 +7291,10 @@ function Bf(e) {
7252
7291
  function Gf(e) {
7253
7292
  const t = e.data;
7254
7293
  if (t.size() === 0) return [];
7255
- const n = [b.xMin, b.xMax, b.yMin, b.yMax];
7294
+ const n = [g.xMin, g.xMax, g.yMin, g.yMax];
7256
7295
  for (const l of n)
7257
7296
  if (!t.hasVariable(l)) return [];
7258
- const r = t.getValues(b.xMin, { type: "numeric" }), o = t.getValues(b.xMax, { type: "numeric" }), a = t.getValues(b.yMin, { type: "numeric" }), s = t.getValues(b.yMax, { type: "numeric" }), i = [];
7297
+ const r = t.getValues(g.xMin, { type: "numeric" }), o = t.getValues(g.xMax, { type: "numeric" }), a = t.getValues(g.yMin, { type: "numeric" }), s = t.getValues(g.yMax, { type: "numeric" }), i = [];
7259
7298
  let c = 0;
7260
7299
  for (const l of t) {
7261
7300
  const u = r[c], d = o[c], m = a[c], p = s[c];
@@ -7294,43 +7333,43 @@ function Uf(e, t) {
7294
7333
  function Yf(e, t) {
7295
7334
  const n = e.data;
7296
7335
  if (n.size() === 0) return [];
7297
- const o = n.hasVariable(b.x), a = n.hasVariable(b.y);
7336
+ const o = n.hasVariable(g.x), a = n.hasVariable(g.y);
7298
7337
  if (!o || !a) return [];
7299
- const s = n.getValues(b.x, { type: "numeric" }), i = n.getValues(b.y, { type: "numeric" }), c = t === "y", l = c ? b.xMin : b.yMin, u = c ? b.xMax : b.yMax, d = K(e.position), m = d ? n.getValues(l, { type: "numeric" }) : null, p = d ? n.getValues(u, { type: "numeric" }) : null, f = n.hasVariable(F.group) ? n.getValues(F.group, { type: "categorical" }) : null, y = [];
7300
- let g = 0;
7301
- for (const S of n) {
7302
- const x = s[g], w = i[g];
7303
- if (!h(x) || !h(w)) {
7304
- g += 1;
7338
+ const s = n.getValues(g.x, { type: "numeric" }), i = n.getValues(g.y, { type: "numeric" }), c = t === "y", l = c ? g.xMin : g.yMin, u = c ? g.xMax : g.yMax, d = K(e.position), m = d ? n.getValues(l, { type: "numeric" }) : null, p = d ? n.getValues(u, { type: "numeric" }) : null, f = n.hasVariable(F.group) ? n.getValues(F.group, { type: "categorical" }) : null, y = [];
7339
+ let b = 0;
7340
+ for (const x of n) {
7341
+ const S = s[b], w = i[b];
7342
+ if (!h(S) || !h(w)) {
7343
+ b += 1;
7305
7344
  continue;
7306
7345
  }
7307
- const M = f?.[g] ?? null, V = c ? w : x;
7346
+ const M = f?.[b] ?? null, V = c ? w : S;
7308
7347
  if (d) {
7309
- const B = m?.[g], Ie = p?.[g];
7348
+ const B = m?.[b], Ie = p?.[b];
7310
7349
  if (!h(B) || !h(Ie)) {
7311
- g += 1;
7350
+ b += 1;
7312
7351
  continue;
7313
7352
  }
7314
- const A = c ? Ie : x, X = c ? w : Ie;
7353
+ const A = c ? Ie : S, X = c ? w : Ie;
7315
7354
  y.push({
7316
7355
  main: V,
7317
7356
  entry: {
7318
7357
  isStacked: d,
7319
- pointIndex: g,
7358
+ pointIndex: b,
7320
7359
  x: A,
7321
7360
  y: X,
7322
7361
  stackMin: B,
7323
7362
  stackMax: Ie,
7324
7363
  groupKey: M,
7325
- observation: S
7364
+ observation: x
7326
7365
  }
7327
7366
  });
7328
7367
  } else
7329
7368
  y.push({
7330
7369
  main: V,
7331
- entry: { isStacked: d, pointIndex: g, x, y: w, groupKey: M, observation: S }
7370
+ entry: { isStacked: d, pointIndex: b, x: S, y: w, groupKey: M, observation: x }
7332
7371
  });
7333
- g += 1;
7372
+ b += 1;
7334
7373
  }
7335
7374
  return y;
7336
7375
  }
@@ -7362,8 +7401,8 @@ function ua(e, t) {
7362
7401
  function Kf(e) {
7363
7402
  const t = e.data;
7364
7403
  if (t.size() === 0) return [];
7365
- if (!t.hasVariable(b.x) || !t.hasVariable(b.y)) return [];
7366
- const n = t.getValues(b.x, { type: "numeric" }), r = t.getValues(b.y, { type: "numeric" }), o = [];
7404
+ if (!t.hasVariable(g.x) || !t.hasVariable(g.y)) return [];
7405
+ const n = t.getValues(g.x, { type: "numeric" }), r = t.getValues(g.y, { type: "numeric" }), o = [];
7367
7406
  let a = 0;
7368
7407
  for (const s of t) {
7369
7408
  const i = n[a], c = r[a];
@@ -7382,8 +7421,8 @@ function zf(e) {
7382
7421
  function Xf(e) {
7383
7422
  const t = e.data;
7384
7423
  if (t.size() === 0) return [];
7385
- if (!t.hasVariable(b.x) || !t.hasVariable(b.y)) return [];
7386
- const n = t.getValues(b.x, { type: "numeric" }), r = t.getValues(b.y, { type: "numeric" }), o = [];
7424
+ if (!t.hasVariable(g.x) || !t.hasVariable(g.y)) return [];
7425
+ const n = t.getValues(g.x, { type: "numeric" }), r = t.getValues(g.y, { type: "numeric" }), o = [];
7387
7426
  let a = 0;
7388
7427
  for (const s of t) {
7389
7428
  const i = n[a], c = r[a];
@@ -7425,25 +7464,25 @@ function Er(e) {
7425
7464
  function Qf(e, t) {
7426
7465
  const n = e.data;
7427
7466
  if (n.size() === 0) return [];
7428
- if (!(n.hasVariable(b.xMin) && n.hasVariable(b.xMax) && n.hasVariable(b.yMin) && n.hasVariable(b.yMax))) return [];
7429
- const o = n.getValues(b.xMin, { type: "numeric" }), a = n.getValues(b.xMax, { type: "numeric" }), s = n.getValues(b.yMin, { type: "numeric" }), i = n.getValues(b.yMax, { type: "numeric" }), c = t === "y", l = c ? b.y : b.x, u = n.hasVariable(l) ? n.getValues(l, { type: "numeric" }) : null, d = n.hasVariable(F.group) ? n.getValues(F.group, { type: "categorical" }) : null, m = [];
7467
+ if (!(n.hasVariable(g.xMin) && n.hasVariable(g.xMax) && n.hasVariable(g.yMin) && n.hasVariable(g.yMax))) return [];
7468
+ const o = n.getValues(g.xMin, { type: "numeric" }), a = n.getValues(g.xMax, { type: "numeric" }), s = n.getValues(g.yMin, { type: "numeric" }), i = n.getValues(g.yMax, { type: "numeric" }), c = t === "y", l = c ? g.y : g.x, u = n.hasVariable(l) ? n.getValues(l, { type: "numeric" }) : null, d = n.hasVariable(F.group) ? n.getValues(F.group, { type: "categorical" }) : null, m = [];
7430
7469
  let p = 0;
7431
7470
  for (const f of n) {
7432
- const y = o[p], g = a[p], S = s[p], x = i[p];
7433
- if (!h(y) || !h(g) || !h(S) || !h(x)) {
7471
+ const y = o[p], b = a[p], x = s[p], S = i[p];
7472
+ if (!h(y) || !h(b) || !h(x) || !h(S)) {
7434
7473
  p++;
7435
7474
  continue;
7436
7475
  }
7437
- const w = c ? (S + x) / 2 : (y + g) / 2, M = u?.[p] ?? w;
7476
+ const w = c ? (x + S) / 2 : (y + b) / 2, M = u?.[p] ?? w;
7438
7477
  m.push({
7439
7478
  mainMid: w,
7440
7479
  bandCenter: M,
7441
7480
  entry: {
7442
7481
  pointIndex: p,
7443
7482
  xMin: y,
7444
- xMax: g,
7445
- yMin: S,
7446
- yMax: x,
7483
+ xMax: b,
7484
+ yMin: x,
7485
+ yMax: S,
7447
7486
  segmentKey: d?.[p] ?? null,
7448
7487
  observation: f
7449
7488
  }
@@ -7559,7 +7598,7 @@ function oh(e, t, n) {
7559
7598
  }
7560
7599
  function ah(e, t, n) {
7561
7600
  if (e.buckets.length === 0) return null;
7562
- const { main: r, cross: o } = xp(e.mainAxis, t), a = la(e, r), s = a?.entries ?? [];
7601
+ const { main: r, cross: o } = Sp(e.mainAxis, t), a = la(e, r), s = a?.entries ?? [];
7563
7602
  if (!a || !Or(s)) return null;
7564
7603
  const i = lh(s, o, e.mainAxis);
7565
7604
  return {
@@ -7854,7 +7893,7 @@ const bh = ({
7854
7893
  case "month":
7855
7894
  return zo(e);
7856
7895
  case "month_year":
7857
- return Sn(e);
7896
+ return xn(e);
7858
7897
  case "percentage":
7859
7898
  return Ho(e);
7860
7899
  case "quarter":
@@ -7876,7 +7915,7 @@ const bh = ({
7876
7915
  throw new Error(`Unhandled value format: ${n.type}`);
7877
7916
  }
7878
7917
  }
7879
- }, xh = { type: "decimal" }, Vy = ({
7918
+ }, Sh = { type: "decimal" }, Vy = ({
7880
7919
  layers: e,
7881
7920
  coordSystem: t,
7882
7921
  scales: n,
@@ -7890,11 +7929,11 @@ const bh = ({
7890
7929
  if (c === null) return null;
7891
7930
  const l = i ?? a;
7892
7931
  return {
7893
- header: Sh({ layers: e, coordSystem: t, guides: r, primary: c, locale: l, numberFormat: o }),
7932
+ header: xh({ layers: e, coordSystem: t, guides: r, primary: c, locale: l, numberFormat: o }),
7894
7933
  rows: wh({ layers: e, coordSystem: t, scales: n, guides: r, hover: s, locale: l, numberFormat: o })
7895
7934
  };
7896
7935
  };
7897
- function Sh(e) {
7936
+ function xh(e) {
7898
7937
  if (e.coordSystem.type !== "cartesian") return null;
7899
7938
  const t = En(e.guides, "x");
7900
7939
  if (!t) return null;
@@ -7937,12 +7976,12 @@ function wh(e) {
7937
7976
  numberFormat: e.numberFormat
7938
7977
  }), u = Vh(e.guides, o), d = o.mapping.color !== void 0, m = Be(o.swatchShape, e.coordSystem);
7939
7978
  for (const p of i) {
7940
- const f = d ? s(p.observation) : null, y = Kr(p.observation) ?? null, g = rs(p.observation), S = d && f !== null ? r(f) : u, x = Ih(c, p), w = x === null ? "" : l(x, p.observation);
7979
+ const f = d ? s(p.observation) : null, y = Kr(p.observation) ?? null, b = rs(p.observation), x = d && f !== null ? r(f) : u, S = Ih(c, p), w = S === null ? "" : l(S, p.observation);
7941
7980
  t.push({
7942
7981
  swatchColor: y,
7943
7982
  swatchShape: m,
7944
- swatchLineType: g,
7945
- label: S,
7983
+ swatchLineType: b,
7984
+ label: x,
7946
7985
  value: w,
7947
7986
  isPrimary: p === e.hover.primary,
7948
7987
  key: `${p.layerId}:${p.pointIndex}`
@@ -8006,7 +8045,7 @@ function Vh(e, t) {
8006
8045
  return En(e, n)?.label ?? "";
8007
8046
  }
8008
8047
  function kh(e) {
8009
- return e.semanticMap.encodings.find((n) => n.aesthetic === "y")?.valueFormat ?? xh;
8048
+ return e.semanticMap.encodings.find((n) => n.aesthetic === "y")?.valueFormat ?? Sh;
8010
8049
  }
8011
8050
  function Ih(e, t) {
8012
8051
  return e(t.observation).encodings.find((r) => r.aesthetic === "y")?.value ?? null;
@@ -8391,7 +8430,7 @@ class va {
8391
8430
  return { spec: a, revert: i };
8392
8431
  }
8393
8432
  }
8394
- const xa = 500, Sa = "normal", wa = {
8433
+ const Sa = 500, xa = "normal", wa = {
8395
8434
  thin: 100,
8396
8435
  hairline: 100,
8397
8436
  extraLight: 200,
@@ -8410,9 +8449,9 @@ const xa = 500, Sa = "normal", wa = {
8410
8449
  extraBlack: 950,
8411
8450
  ultraBlack: 950
8412
8451
  }, _y = (e) => {
8413
- const t = e.style ?? Sa, n = e.weight ?? xa, r = e.family.includes(",") ? e.family : `'${e.family}'`;
8452
+ const t = e.style ?? xa, n = e.weight ?? Sa, r = e.family.includes(",") ? e.family : `'${e.family}'`;
8414
8453
  return `${t} ${n} ${e.size}px ${r}`;
8415
- }, Ry = (e) => typeof e == "string" ? e : Aa(e), Aa = (e) => e.text !== void 0 ? e.text : e.content ? e.content.map(Aa).join("") : "", Ta = (e) => typeof e != "string" ? e ?? xa : wa[e], Gh = "\0";
8454
+ }, Ry = (e) => typeof e == "string" ? e : Aa(e), Aa = (e) => e.text !== void 0 ? e.text : e.content ? e.content.map(Aa).join("") : "", Ta = (e) => typeof e != "string" ? e ?? Sa : wa[e], Gh = "\0";
8416
8455
  class Py {
8417
8456
  constructor(t) {
8418
8457
  this.inner = t, this.cache = /* @__PURE__ */ new Map();
@@ -8425,7 +8464,7 @@ class Py {
8425
8464
  return this.cache.set(r, a), a;
8426
8465
  }
8427
8466
  getCacheKey(t, n) {
8428
- return [n.family, n.size, Ta(n.weight), n.style ?? Sa, t].join(Gh);
8467
+ return [n.family, n.size, Ta(n.weight), n.style ?? xa, t].join(Gh);
8429
8468
  }
8430
8469
  }
8431
8470
  const $h = {
@@ -8549,8 +8588,8 @@ export {
8549
8588
  Fy as CommandStackManager,
8550
8589
  hm as Compiler,
8551
8590
  Io as DEFAULT_COLOR_PALETTE,
8552
- Sa as DEFAULT_FONT_STYLE,
8553
- xa as DEFAULT_FONT_WEIGHT,
8591
+ xa as DEFAULT_FONT_STYLE,
8592
+ Sa as DEFAULT_FONT_WEIGHT,
8554
8593
  tn as DEFAULT_LOCALE,
8555
8594
  ge as Dataset,
8556
8595
  ac as GEOM_NAMES,
@@ -8561,7 +8600,7 @@ export {
8561
8600
  hy as LayoutCompiler,
8562
8601
  Ll as MONO_BASES,
8563
8602
  Vl as NEON_BASES,
8564
- b as POSITION_VARIABLES,
8603
+ g as POSITION_VARIABLES,
8565
8604
  ye as RESTING_HOVER_STATE,
8566
8605
  pa as SetAxisPositionCommand,
8567
8606
  fa as SetContentCaptionCommand,
@@ -8578,7 +8617,7 @@ export {
8578
8617
  zp as buildLayerYValueFormatter,
8579
8618
  Vy as buildTooltipContent,
8580
8619
  vy as computeDifferenceArrow,
8581
- xy as computeDirectLabelsLayout,
8620
+ Sy as computeDirectLabelsLayout,
8582
8621
  My as computeFreeformArrow,
8583
8622
  lu as config,
8584
8623
  Dy as convertSpecToInput,
@@ -8601,7 +8640,7 @@ export {
8601
8640
  Ry as extractPlainText,
8602
8641
  En as findAxisGuide,
8603
8642
  Ay as findLegendForAesthetic,
8604
- Sy as formatHeadline,
8643
+ xy as formatHeadline,
8605
8644
  wy as formatLegends,
8606
8645
  Ty as formatRuleValue,
8607
8646
  I as geom,
@@ -8622,7 +8661,7 @@ export {
8622
8661
  mt as getXMin,
8623
8662
  te as getY,
8624
8663
  Q as getYMax,
8625
- xe as getYMin,
8664
+ Se as getYMin,
8626
8665
  mi as getYRaw,
8627
8666
  Cy as highlight,
8628
8667
  ic as isBuiltinGeomName,