@webority/ui-elements 0.32.0 → 0.34.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/ui-chart.js CHANGED
@@ -32725,8 +32725,8 @@ function Mq(e, t, n, r) {
32725
32725
  var Nq = (e, t) => {
32726
32726
  let n = e.filter((e) => e != null && Number.isFinite(e));
32727
32727
  return [Math.min(...t ? [0, ...n] : n), Math.max(...t ? [0, ...n] : n)];
32728
- }, Pq = 24, Fq = 4;
32729
- function Iq(e) {
32728
+ }, Pq = 24, Fq = 4, Iq = .6, Lq = (e, t) => String(e).length * t * Iq;
32729
+ function Rq(e) {
32730
32730
  let t = String(e ?? "").trim(), n = /^#([0-9a-f]{3}|[0-9a-f]{6})$/i.exec(t);
32731
32731
  if (n) {
32732
32732
  let e = n[1].length === 3 ? [...n[1]].map((e) => e + e).join("") : n[1];
@@ -32739,24 +32739,24 @@ function Iq(e) {
32739
32739
  let r = /^rgba?\(\s*([\d.]+)[\s,]+([\d.]+)[\s,]+([\d.]+)/i.exec(t);
32740
32740
  return r ? r.slice(1, 4).map(Number) : null;
32741
32741
  }
32742
- function Lq(e, t) {
32743
- let n = Iq(e);
32742
+ function zq(e, t) {
32743
+ let n = Rq(e);
32744
32744
  return n ? `rgba(${n.join(",")},${t})` : String(e ?? "").trim();
32745
32745
  }
32746
- function Rq(e, t, n) {
32747
- let r = Iq(e), i = Iq(t);
32746
+ function Bq(e, t, n) {
32747
+ let r = Rq(e), i = Rq(t);
32748
32748
  return r && i ? `rgb(${r.map((e, t) => Math.round(e + (i[t] - e) * n)).join(",")})` : e;
32749
32749
  }
32750
- var zq = (e) => e.map((e) => e / 255).map((e) => e <= .03928 ? e / 12.92 : ((e + .055) / 1.055) ** 2.4).reduce((e, t, n) => e + t * [
32750
+ var Vq = (e) => e.map((e) => e / 255).map((e) => e <= .03928 ? e / 12.92 : ((e + .055) / 1.055) ** 2.4).reduce((e, t, n) => e + t * [
32751
32751
  .2126,
32752
32752
  .7152,
32753
32753
  .0722
32754
- ][n], 0), Bq = (e, t) => (Math.max(e, t) + .05) / (Math.min(e, t) + .05);
32755
- function Vq(e, t) {
32756
- let n = Iq(e), r = Iq(t.text), i = Iq(t.surface);
32757
- return !n || !r || !i || Bq(zq(n), zq(r)) >= Bq(zq(n), zq(i)) ? t.text : t.surface;
32754
+ ][n], 0), Hq = (e, t) => (Math.max(e, t) + .05) / (Math.min(e, t) + .05);
32755
+ function Uq(e, t) {
32756
+ let n = Rq(e), r = Rq(t.text), i = Rq(t.surface);
32757
+ return !n || !r || !i || Hq(Vq(n), Vq(r)) >= Hq(Vq(n), Vq(i)) ? t.text : t.surface;
32758
32758
  }
32759
- var Hq = (e, t) => ({
32759
+ var Wq = (e, t) => ({
32760
32760
  type: "linear",
32761
32761
  x: 0,
32762
32762
  y: 0,
@@ -32764,13 +32764,13 @@ var Hq = (e, t) => ({
32764
32764
  y2: 1,
32765
32765
  colorStops: [{
32766
32766
  offset: 0,
32767
- color: Lq(e, t)
32767
+ color: zq(e, t)
32768
32768
  }, {
32769
32769
  offset: 1,
32770
- color: Lq(e, 0)
32770
+ color: zq(e, 0)
32771
32771
  }]
32772
- }), Uq = (e) => e + xG;
32773
- function Wq(e) {
32772
+ }), Gq = (e) => e + xG;
32773
+ function Kq(e) {
32774
32774
  let t = e.x.format?.pattern;
32775
32775
  return (e) => {
32776
32776
  let n = e - xG;
@@ -32779,7 +32779,7 @@ function Wq(e) {
32779
32779
  return r.hour || r.minute ? BG(n, { pattern: "time" }) : VG(n);
32780
32780
  };
32781
32781
  }
32782
- function Gq(e, t, n) {
32782
+ function qq(e, t, n) {
32783
32783
  let r = Fq, i = (e) => n ? e ? [
32784
32784
  r,
32785
32785
  0,
@@ -32816,7 +32816,7 @@ function Gq(e, t, n) {
32816
32816
  return a;
32817
32817
  });
32818
32818
  }
32819
- function Kq(e, t, n, r) {
32819
+ function Jq(e, t, n, r) {
32820
32820
  let i = n.width < 576, a = r.animation !== !1 && !t.reducedMotion && BK(e) <= 5e3, o = HK(e), s = Object.fromEntries(o.map((e) => [e, !r.hidden.has(e)])), c = {
32821
32821
  palette: t.palette,
32822
32822
  neutral: t.neutral,
@@ -32858,9 +32858,9 @@ function Kq(e, t, n, r) {
32858
32858
  colours: c,
32859
32859
  compact: i,
32860
32860
  animate: a
32861
- }, f = AJ[e.type];
32861
+ }, f = FJ[e.type];
32862
32862
  if (f) return f(e, t, n, r, d);
32863
- let p = e.type === "bar", m = e.x.kind === "time", h = e.stack === "percent" ? GK(e, r.hidden) : null, g = p || e.type === "column" ? Gq(e, r.hidden, p) : null, _ = e.series.length === 1, v = r.renderer === "canvas", [y, b] = Nq(e.series.flatMap((t) => e.data.map((n, r) => Q(e, t.key, r))), !0), x = e.stack === "percent" ? Sq(e) : Mq(e.y.format, e.y.min ?? y, e.y.max ?? b, i ? 3 : 4), S = h?.some((e) => Object.values(e).some((e) => e != null && e < 0)) ? -1 : 0, C = e.series.findIndex((e) => !r.hidden.has(e.key)), w = {
32863
+ let p = e.type === "bar", m = e.x.kind === "time", h = e.stack === "percent" ? GK(e, r.hidden) : null, g = p || e.type === "column" ? qq(e, r.hidden, p) : null, _ = e.series.length === 1, v = r.renderer === "canvas", [y, b] = Nq(e.series.flatMap((t) => e.data.map((n, r) => Q(e, t.key, r))), !0), x = e.stack === "percent" ? Sq(e) : Mq(e.y.format, e.y.min ?? y, e.y.max ?? b, i ? 3 : 4), S = h?.some((e) => Object.values(e).some((e) => e != null && e < 0)) ? -1 : 0, C = e.series.findIndex((e) => !r.hidden.has(e.key)), w = {
32864
32864
  type: m ? "time" : "category",
32865
32865
  boundaryGap: !m && (e.type === "column" || p),
32866
32866
  inverse: p,
@@ -32875,7 +32875,7 @@ function Kq(e, t, n, r) {
32875
32875
  fontSize: 11,
32876
32876
  margin: 12,
32877
32877
  hideOverlap: !0,
32878
- ...m ? { formatter: Wq(e) } : {}
32878
+ ...m ? { formatter: Kq(e) } : {}
32879
32879
  },
32880
32880
  ...m ? {} : { data: e.data.map((t, n) => $(e, n)) }
32881
32881
  }, T = {
@@ -32909,7 +32909,7 @@ function Kq(e, t, n, r) {
32909
32909
  }, E = e.zoom, D = _ && e.type !== "column" && !p && !i, O = e.series.map((n, r) => {
32910
32910
  let o = t.palette[r], s = e.data.some((t, r) => Q(e, n.key, r) != null && Q(e, n.key, r - 1) == null && Q(e, n.key, r + 1) == null), c = (t) => {
32911
32911
  let r = Q(e, n.key, t), i = h ? h[t][n.key] : r;
32912
- return m ? [Uq(FK(e, t)), i] : i;
32912
+ return m ? [Gq(FK(e, t)), i] : i;
32913
32913
  }, l = {
32914
32914
  id: n.key,
32915
32915
  name: n.key,
@@ -32940,7 +32940,7 @@ function Kq(e, t, n, r) {
32940
32940
  width: 2,
32941
32941
  color: o,
32942
32942
  ..._ && !v ? {
32943
- shadowColor: Lq(o, .35),
32943
+ shadowColor: zq(o, .35),
32944
32944
  shadowBlur: 10,
32945
32945
  shadowOffsetY: 6
32946
32946
  } : {}
@@ -32950,7 +32950,7 @@ function Kq(e, t, n, r) {
32950
32950
  borderColor: t.surface,
32951
32951
  borderWidth: 2
32952
32952
  },
32953
- areaStyle: n ? { color: Hq(o, n) } : void 0,
32953
+ areaStyle: n ? { color: Wq(o, n) } : void 0,
32954
32954
  endLabel: D ? {
32955
32955
  show: !0,
32956
32956
  formatter: (e) => Z(Array.isArray(e.value) ? e.value[1] : e.value, x),
@@ -32961,7 +32961,7 @@ function Kq(e, t, n, r) {
32961
32961
  fontFamily: t.font,
32962
32962
  valueAnimation: a
32963
32963
  } : void 0,
32964
- markLine: r === C ? qq(e, t, !1, a) : void 0
32964
+ markLine: r === C ? Yq(e, t, !1, a) : void 0
32965
32965
  };
32966
32966
  }
32967
32967
  return {
@@ -32979,7 +32979,7 @@ function Kq(e, t, n, r) {
32979
32979
  value: c(t),
32980
32980
  itemStyle: { borderRadius: g[t][n.key] }
32981
32981
  })),
32982
- markLine: r === C ? qq(e, t, p, a) : void 0
32982
+ markLine: r === C ? Yq(e, t, p, a) : void 0
32983
32983
  };
32984
32984
  });
32985
32985
  return {
@@ -32992,7 +32992,7 @@ function Kq(e, t, n, r) {
32992
32992
  bottom: E ? 44 : 4,
32993
32993
  outerBoundsMode: "same"
32994
32994
  },
32995
- dataZoom: E ? DJ(e, t, t.palette[0], r.zoom) : void 0,
32995
+ dataZoom: E ? MJ(e, t, t.palette[0], r.zoom) : void 0,
32996
32996
  tooltip: {
32997
32997
  ...l,
32998
32998
  trigger: "axis",
@@ -33001,7 +33001,7 @@ function Kq(e, t, n, r) {
33001
33001
  lineStyle: { color: t.axis }
33002
33002
  } : {
33003
33003
  type: "shadow",
33004
- shadowStyle: { color: Lq(t.neutral, t.dark ? .12 : .1) }
33004
+ shadowStyle: { color: zq(t.neutral, t.dark ? .12 : .1) }
33005
33005
  },
33006
33006
  formatter: (t) => dq(cq(e, (Array.isArray(t) ? t : [t])[0]?.dataIndex ?? 0, r.hidden, c))
33007
33007
  },
@@ -33010,7 +33010,7 @@ function Kq(e, t, n, r) {
33010
33010
  series: O
33011
33011
  };
33012
33012
  }
33013
- function qq(e, t, n, r) {
33013
+ function Yq(e, t, n, r) {
33014
33014
  if (!e.target) return;
33015
33015
  let i = e.series[0].format;
33016
33016
  return {
@@ -33035,7 +33035,7 @@ function qq(e, t, n, r) {
33035
33035
  data: [n ? { xAxis: e.target.value } : { yAxis: e.target.value }]
33036
33036
  };
33037
33037
  }
33038
- function Jq(e, t, n, r, { base: i, tooltipBase: a, colours: o, compact: s }) {
33038
+ function Xq(e, t, n, r, { base: i, tooltipBase: a, colours: o, compact: s }) {
33039
33039
  let c = e.series[0], l = e.data.map((t, n) => $(e, n)), u = e.data.reduce((t, n, i) => t + (r.hidden.has(l[i]) ? 0 : Q(e, c.key, i) ?? 0), 0);
33040
33040
  return {
33041
33041
  ...i,
@@ -33128,15 +33128,15 @@ function Jq(e, t, n, r, { base: i, tooltipBase: a, colours: o, compact: s }) {
33128
33128
  }]
33129
33129
  };
33130
33130
  }
33131
- var Yq = (e) => [...new Set(e)], Xq = (e, t) => e.data.map((n, r) => Q(e, t, r));
33132
- function Zq(e, t) {
33131
+ var Zq = (e) => [...new Set(e)], Qq = (e, t) => e.data.map((n, r) => Q(e, t, r));
33132
+ function $q(e, t) {
33133
33133
  return {
33134
33134
  ...e,
33135
33135
  trigger: "item",
33136
33136
  formatter: (e) => t(e)
33137
33137
  };
33138
33138
  }
33139
- var Qq = (e, t, n = {}) => ({
33139
+ var eJ = (e, t, n = {}) => ({
33140
33140
  type: "category",
33141
33141
  data: t,
33142
33142
  axisLine: { lineStyle: { color: e.axis } },
@@ -33148,7 +33148,7 @@ var Qq = (e, t, n = {}) => ({
33148
33148
  hideOverlap: !0
33149
33149
  },
33150
33150
  ...n
33151
- }), $q = (e, t, n = {}) => ({
33151
+ }), tJ = (e, t, n = {}) => ({
33152
33152
  type: "value",
33153
33153
  splitNumber: 4,
33154
33154
  axisLine: { show: !1 },
@@ -33165,7 +33165,7 @@ var Qq = (e, t, n = {}) => ({
33165
33165
  },
33166
33166
  ...n
33167
33167
  });
33168
- function eJ(e, t, n) {
33168
+ function nJ(e, t, n) {
33169
33169
  return {
33170
33170
  type: "piecewise",
33171
33171
  orient: "horizontal",
@@ -33192,8 +33192,8 @@ function eJ(e, t, n) {
33192
33192
  ...n
33193
33193
  };
33194
33194
  }
33195
- function tJ(e, t, n, r, i) {
33196
- let a = e.series[0], o = Yq(e.data.map((t, n) => $(e, n))), s = zK(e), c = QK(Xq(e, a.key), t.seq);
33195
+ function rJ(e, t, n, r, i) {
33196
+ let a = e.series[0], o = Zq(e.data.map((t, n) => $(e, n))), s = zK(e), c = QK(Qq(e, a.key), t.seq);
33197
33197
  return {
33198
33198
  ...i.base,
33199
33199
  grid: {
@@ -33203,16 +33203,16 @@ function tJ(e, t, n, r, i) {
33203
33203
  bottom: 40,
33204
33204
  outerBoundsMode: "same"
33205
33205
  },
33206
- tooltip: Zq(i.tooltipBase, (t) => dq(cq(e, t.dataIndex, r.hidden, i.colours))),
33207
- xAxis: Qq(t, o, {
33206
+ tooltip: $q(i.tooltipBase, (t) => dq(cq(e, t.dataIndex, r.hidden, i.colours))),
33207
+ xAxis: eJ(t, o, {
33208
33208
  axisLine: { show: !1 },
33209
33209
  splitArea: { show: !1 }
33210
33210
  }),
33211
- yAxis: Qq(t, s, {
33211
+ yAxis: eJ(t, s, {
33212
33212
  inverse: !0,
33213
33213
  axisLine: { show: !1 }
33214
33214
  }),
33215
- visualMap: eJ(t, c),
33215
+ visualMap: nJ(t, c),
33216
33216
  series: [{
33217
33217
  type: "heatmap",
33218
33218
  data: e.data.map((t, n) => [
@@ -33234,27 +33234,27 @@ function tJ(e, t, n, r, i) {
33234
33234
  }]
33235
33235
  };
33236
33236
  }
33237
- var nJ = 7 * 864e5, rJ = (e) => {
33237
+ var iJ = 7 * 864e5, aJ = (e) => {
33238
33238
  let t = zG(e);
33239
33239
  return `${t.year}-${String(t.month + 1).padStart(2, "0")}-${String(t.day).padStart(2, "0")}`;
33240
33240
  };
33241
- function iJ(e, t) {
33242
- let n = e.data.map((t, n) => FK(e, n)).filter(Number.isFinite), r = aJ(n), i = oJ(n), a = Math.ceil((i - r) / nJ) + 1, o = Math.floor((t.height - 62) / 7), s = Math.max(sJ, Math.min(cJ, o, Math.floor((t.width - 44) / a))), c = Math.max(1, Math.floor((t.width - 44) / s));
33241
+ function oJ(e, t) {
33242
+ let n = e.data.map((t, n) => FK(e, n)).filter(Number.isFinite), r = sJ(n), i = cJ(n), a = Math.ceil((i - r) / iJ) + 1, o = Math.floor((t.height - 62) / 7), s = Math.max(lJ, Math.min(uJ, o, Math.floor((t.width - 44) / a))), c = Math.max(1, Math.floor((t.width - 44) / s));
33243
33243
  return {
33244
33244
  cell: s,
33245
- from: a > c ? i - (c - 1) * nJ : r,
33245
+ from: a > c ? i - (c - 1) * iJ : r,
33246
33246
  to: i
33247
33247
  };
33248
33248
  }
33249
- var aJ = (e) => e.reduce((e, t) => t < e ? t : e, Infinity), oJ = (e) => e.reduce((e, t) => t > e ? t : e, -Infinity), sJ = 9, cJ = 24;
33250
- function lJ(e, t, n, r, i) {
33251
- let a = e.series[0], { cell: o, from: s, to: c } = iJ(e, n), l = QK(Xq(e, a.key), t.seq);
33249
+ var sJ = (e) => e.reduce((e, t) => t < e ? t : e, Infinity), cJ = (e) => e.reduce((e, t) => t > e ? t : e, -Infinity), lJ = 9, uJ = 24;
33250
+ function dJ(e, t, n, r, i) {
33251
+ let a = e.series[0], { cell: o, from: s, to: c } = oJ(e, n), l = QK(Qq(e, a.key), t.seq);
33252
33252
  return {
33253
33253
  ...i.base,
33254
- tooltip: Zq(i.tooltipBase, (t) => dq(cq(e, t.dataIndex, r.hidden, i.colours))),
33255
- visualMap: eJ(t, l, { right: 4 }),
33254
+ tooltip: $q(i.tooltipBase, (t) => dq(cq(e, t.dataIndex, r.hidden, i.colours))),
33255
+ visualMap: nJ(t, l, { right: 4 }),
33256
33256
  calendar: {
33257
- range: [rJ(s), rJ(c)],
33257
+ range: [aJ(s), aJ(c)],
33258
33258
  top: 24,
33259
33259
  left: 34,
33260
33260
  cellSize: [o, o],
@@ -33291,7 +33291,7 @@ function lJ(e, t, n, r, i) {
33291
33291
  series: [{
33292
33292
  type: "heatmap",
33293
33293
  coordinateSystem: "calendar",
33294
- data: e.data.map((t, n) => [rJ(FK(e, n)), Q(e, a.key, n) ?? "-"]),
33294
+ data: e.data.map((t, n) => [aJ(FK(e, n)), Q(e, a.key, n) ?? "-"]),
33295
33295
  itemStyle: {
33296
33296
  borderRadius: 3,
33297
33297
  borderColor: t.surface,
@@ -33304,11 +33304,11 @@ function lJ(e, t, n, r, i) {
33304
33304
  }]
33305
33305
  };
33306
33306
  }
33307
- function uJ(e, t, n, r, i) {
33307
+ function fJ(e, t, n, r, i) {
33308
33308
  let a = e.series[0], o = eq(e.data.length, t.seq), s = Q(e, a.key, 0);
33309
33309
  return {
33310
33310
  ...i.base,
33311
- tooltip: Zq(i.tooltipBase, (t) => dq(cq(e, t.dataIndex, r.hidden, i.colours))),
33311
+ tooltip: $q(i.tooltipBase, (t) => dq(cq(e, t.dataIndex, r.hidden, i.colours))),
33312
33312
  series: [{
33313
33313
  type: "funnel",
33314
33314
  sort: "none",
@@ -33337,7 +33337,7 @@ function uJ(e, t, n, r, i) {
33337
33337
  lineHeight: 17
33338
33338
  },
33339
33339
  data: e.data.map((n, r) => {
33340
- let i = Vq(o[r], t), c = Q(e, a.key, r), l = r ? `${ZK(c, Q(e, a.key, r - 1))} of previous step` : `${ZK(c, s)} of ${jq($(e, 0))}`;
33340
+ let i = Uq(o[r], t), c = Q(e, a.key, r), l = r ? `${ZK(c, Q(e, a.key, r - 1))} of previous step` : `${ZK(c, s)} of ${jq($(e, 0))}`;
33341
33341
  return {
33342
33342
  name: $(e, r),
33343
33343
  value: c ?? 0,
@@ -33358,7 +33358,7 @@ function uJ(e, t, n, r, i) {
33358
33358
  fontFamily: t.font
33359
33359
  },
33360
33360
  p: {
33361
- color: Lq(i, .78),
33361
+ color: zq(i, .78),
33362
33362
  fontSize: 11,
33363
33363
  fontFamily: t.font
33364
33364
  }
@@ -33369,11 +33369,11 @@ function uJ(e, t, n, r, i) {
33369
33369
  }]
33370
33370
  };
33371
33371
  }
33372
- function dJ(e, t, n, r, i) {
33372
+ function pJ(e, t, n, r, i) {
33373
33373
  let a = e.series[0], { min: o, max: s } = rq(e), c = Q(e, a.key, 0), l = c ?? o, u = c == null ? null : tq(e, c), d = t.palette[0], f = s - o || 1, p = e.bands.length ? e.bands.map((e, n) => [Math.min(1, Math.max(0, (e.upTo - o) / f)), t.seq[1 + Math.min(n, 3)]]) : [[1, t.grid]];
33374
33374
  return e.bands.length && p[p.length - 1][0] < 1 && p.push([1, t.grid]), {
33375
33375
  ...i.base,
33376
- tooltip: Zq(i.tooltipBase, () => dq(cq(e, 0, r.hidden, i.colours))),
33376
+ tooltip: $q(i.tooltipBase, () => dq(cq(e, 0, r.hidden, i.colours))),
33377
33377
  series: [{
33378
33378
  type: "gauge",
33379
33379
  startAngle: 215,
@@ -33392,7 +33392,7 @@ function dJ(e, t, n, r, i) {
33392
33392
  itemStyle: {
33393
33393
  color: d,
33394
33394
  shadowBlur: i.animate ? 12 : 0,
33395
- shadowColor: Lq(d, .35)
33395
+ shadowColor: zq(d, .35)
33396
33396
  }
33397
33397
  },
33398
33398
  axisLine: {
@@ -33460,8 +33460,8 @@ function dJ(e, t, n, r, i) {
33460
33460
  }]
33461
33461
  };
33462
33462
  }
33463
- function fJ(e) {
33464
- let t = oJ(e.map((e) => e.level).concat(e.map((e) => e.from), e.map((e) => e.to))), n = aJ(e.filter((e) => !e.total).map((e) => Math.min(e.from, e.to)).concat(e.filter((e) => e.total).map((e) => e.value))), r = oJ(e.filter((e) => !e.total).map((e) => Math.abs(e.value)));
33463
+ function mJ(e) {
33464
+ let t = cJ(e.map((e) => e.level).concat(e.map((e) => e.from), e.map((e) => e.to))), n = sJ(e.filter((e) => !e.total).map((e) => Math.min(e.from, e.to)).concat(e.filter((e) => e.total).map((e) => e.value))), r = cJ(e.filter((e) => !e.total).map((e) => Math.abs(e.value)));
33465
33465
  if (!(t > 0) || !(n > t * .4) || !(r < t * .15)) return null;
33466
33466
  let i = 10 ** Math.floor(Math.log10(t)) / 10, a = Math.round(t * .08 / i) * i, o = Math.floor(n * .965 / i) * i;
33467
33467
  return o > a ? {
@@ -33469,8 +33469,28 @@ function fJ(e) {
33469
33469
  end: o
33470
33470
  } : null;
33471
33471
  }
33472
- function pJ(e, t, n, r, i) {
33473
- let a = e.series[0], o = iq(e), s = Sq(e), c = fJ(o), l = (t) => sq(e, t.index, i.colours), u = o.map((t) => $(e, t.index));
33472
+ var hJ = 4, gJ = 72;
33473
+ function _J(e, t, n, r) {
33474
+ let i = r ? 10 : 11, a = r ? 10.5 : 12, o = Math.floor(n / Math.max(1, e.length) - hJ);
33475
+ return {
33476
+ nameSize: i,
33477
+ valueSize: a,
33478
+ category: cJ(e.flatMap((e) => String(e).split(/\s+/)).map((e) => Lq(e, i))) <= o ? {
33479
+ interval: 0,
33480
+ width: o,
33481
+ overflow: "break"
33482
+ } : {
33483
+ interval: 0,
33484
+ rotate: 45,
33485
+ width: gJ,
33486
+ overflow: "truncate",
33487
+ hideOverlap: !0
33488
+ },
33489
+ showValues: t.every((e) => Lq(e, a) <= o)
33490
+ };
33491
+ }
33492
+ function vJ(e, t, n, r, i) {
33493
+ let a = e.series[0], o = iq(e), s = Sq(e), c = mJ(o), l = (t) => sq(e, t.index, i.colours), u = o.map((t) => $(e, t.index)), d = o.map((e) => e.total ? Z(e.value, s) : lq(e.value, s)), f = o.flatMap((e) => [e.from, e.to]), p = Math.max(Lq(Z(cJ(f), s), 11), Lq(Z(sJ(f), s), 11)) + 8, m = _J(u, d, n.width - p - 12, i.compact);
33474
33494
  return {
33475
33495
  ...i.base,
33476
33496
  grid: {
@@ -33485,19 +33505,17 @@ function pJ(e, t, n, r, i) {
33485
33505
  trigger: "axis",
33486
33506
  axisPointer: {
33487
33507
  type: "shadow",
33488
- shadowStyle: { color: Lq(t.neutral, .1) }
33508
+ shadowStyle: { color: zq(t.neutral, .1) }
33489
33509
  },
33490
33510
  formatter: (t) => dq(cq(e, (Array.isArray(t) ? t : [t])[0]?.dataIndex ?? 0, r.hidden, i.colours))
33491
33511
  },
33492
- xAxis: Qq(t, u, { axisLabel: {
33512
+ xAxis: eJ(t, u, { axisLabel: {
33493
33513
  color: t.label,
33494
- fontSize: i.compact ? 10 : 11,
33514
+ fontSize: m.nameSize,
33495
33515
  margin: 12,
33496
- interval: 0,
33497
- width: Math.max(40, Math.floor((n.width - 40) / u.length)),
33498
- overflow: "break"
33516
+ ...m.category
33499
33517
  } }),
33500
- yAxis: $q(t, (e) => Z(e, s), {
33518
+ yAxis: tJ(t, (e) => Z(e, s), {
33501
33519
  min: 0,
33502
33520
  splitNumber: 5,
33503
33521
  ...c ? {
@@ -33560,17 +33578,14 @@ function pJ(e, t, n, r, i) {
33560
33578
  } },
33561
33579
  animationDelay: i.animate ? (e) => e * 140 : 0,
33562
33580
  label: {
33563
- show: !0,
33581
+ show: m.showValues,
33564
33582
  position: "top",
33565
33583
  distance: 6,
33566
33584
  fontFamily: t.font,
33567
- fontSize: i.compact ? 10.5 : 12,
33585
+ fontSize: m.valueSize,
33568
33586
  fontWeight: 600,
33569
33587
  color: t.text,
33570
- formatter: (e) => {
33571
- let t = o[e.dataIndex];
33572
- return t.total ? Z(t.value, s) : lq(t.value, s);
33573
- }
33588
+ formatter: (e) => d[e.dataIndex]
33574
33589
  },
33575
33590
  data: o.map((e) => ({
33576
33591
  value: Math.abs(e.to - e.from),
@@ -33580,16 +33595,19 @@ function pJ(e, t, n, r, i) {
33580
33595
  ]
33581
33596
  };
33582
33597
  }
33583
- function mJ(e) {
33598
+ function yJ(e) {
33584
33599
  let t = e.series[0].key;
33585
33600
  return zK(e).map((n) => ({
33586
33601
  name: n,
33587
33602
  rows: e.data.map((e, t) => t).filter((t) => IK(e, t) === n).sort((n, r) => Q(e, t, r) - Q(e, t, n) || n - r)
33588
33603
  }));
33589
33604
  }
33590
- function hJ(e, t, n, r, i) {
33591
- let a = e.series[0], o = oq(e), s = [...o.values()].reduce((e, t) => e + t, 0), c = (e) => e / s * n.width * n.height * .82 > 5200, l = mJ(e).map(({ name: n, rows: r }, i) => {
33592
- let s = o.get(n), l = t.palette[i % t.palette.length], u = Vq(l, t);
33605
+ function bJ(e, t, n, r, i) {
33606
+ let a = e.series[0], o = oq(e), s = [...o.values()].reduce((e, t) => e + t, 0), c = (e, t) => {
33607
+ let r = e / s * n.width * n.height * .82;
33608
+ return r > 5200 && Math.max(Lq(t[0], 12), Lq(t[1], 11.5)) + 20 <= Math.sqrt(r);
33609
+ }, l = yJ(e).map(({ name: n, rows: r }, i) => {
33610
+ let s = o.get(n), l = t.palette[i % t.palette.length], u = Uq(l, t);
33593
33611
  return {
33594
33612
  name: n,
33595
33613
  value: s,
@@ -33609,20 +33627,20 @@ function hJ(e, t, n, r, i) {
33609
33627
  },
33610
33628
  v: {
33611
33629
  fontSize: 12,
33612
- color: Lq(u, .8),
33630
+ color: zq(u, .8),
33613
33631
  fontFamily: t.font
33614
33632
  }
33615
33633
  }
33616
33634
  },
33617
33635
  children: r.map((n, r) => {
33618
- let i = Rq(l, t.surface, Math.min(.55, r * .14)), o = Vq(i, t), s = Q(e, a.key, n);
33636
+ let i = Bq(l, t.surface, Math.min(.55, r * .14)), o = Uq(i, t), s = Q(e, a.key, n);
33619
33637
  return {
33620
33638
  name: $(e, n),
33621
33639
  value: s,
33622
33640
  row: n,
33623
33641
  itemStyle: { color: i },
33624
33642
  label: {
33625
- show: c(s),
33643
+ show: c(s, [$(e, n), Z(s, a.format)]),
33626
33644
  formatter: `{n|${jq($(e, n))}}\n{v|${jq(Z(s, a.format))}}`,
33627
33645
  rich: {
33628
33646
  n: {
@@ -33633,7 +33651,7 @@ function hJ(e, t, n, r, i) {
33633
33651
  lineHeight: 16
33634
33652
  },
33635
33653
  v: {
33636
- color: Lq(o, .82),
33654
+ color: zq(o, .82),
33637
33655
  fontSize: 11.5,
33638
33656
  fontFamily: t.font
33639
33657
  }
@@ -33645,7 +33663,7 @@ function hJ(e, t, n, r, i) {
33645
33663
  });
33646
33664
  return {
33647
33665
  ...i.base,
33648
- tooltip: Zq(i.tooltipBase, (t) => t.data?.row == null ? dq({
33666
+ tooltip: $q(i.tooltipBase, (t) => t.data?.row == null ? dq({
33649
33667
  title: t.name,
33650
33668
  rows: [{
33651
33669
  color: t.color,
@@ -33707,13 +33725,13 @@ function hJ(e, t, n, r, i) {
33707
33725
  }]
33708
33726
  };
33709
33727
  }
33710
- function gJ(e) {
33728
+ function xJ(e) {
33711
33729
  let t = e.data.map((t) => [String(t[e.x.key]), String(t[e.to.key])]), n = new Map(t.flatMap(([e, t]) => [[e, 0], [t, 0]]));
33712
33730
  for (let e = 0; e < n.size; e += 1) for (let [e, r] of t) n.set(r, Math.max(n.get(r), n.get(e) + 1));
33713
33731
  return n;
33714
33732
  }
33715
- function _J(e, t, n, r, i) {
33716
- let a = e.series[0], o = aq(e, t.palette), s = gJ(e), c = oJ([...s.values()]), l = /* @__PURE__ */ new Map(), u = /* @__PURE__ */ new Map();
33733
+ function SJ(e, t, n, r, i) {
33734
+ let a = e.series[0], o = aq(e, t.palette), s = xJ(e), c = cJ([...s.values()]), l = /* @__PURE__ */ new Map(), u = /* @__PURE__ */ new Map();
33717
33735
  e.data.forEach((t, n) => {
33718
33736
  let r = Q(e, a.key, n) ?? 0;
33719
33737
  l.set(String(t[e.x.key]), (l.get(String(t[e.x.key])) ?? 0) + r), u.set(String(t[e.to.key]), (u.get(String(t[e.to.key])) ?? 0) + r);
@@ -33740,7 +33758,7 @@ function _J(e, t, n, r, i) {
33740
33758
  });
33741
33759
  return {
33742
33760
  ...i.base,
33743
- tooltip: Zq(i.tooltipBase, (t) => dq(t.dataType === "edge" ? cq(e, t.dataIndex, r.hidden, i.colours) : {
33761
+ tooltip: $q(i.tooltipBase, (t) => dq(t.dataType === "edge" ? cq(e, t.dataIndex, r.hidden, i.colours) : {
33744
33762
  title: t.name,
33745
33763
  rows: [{
33746
33764
  color: t.color,
@@ -33790,23 +33808,23 @@ function _J(e, t, n, r, i) {
33790
33808
  }]
33791
33809
  };
33792
33810
  }
33793
- function vJ(e) {
33811
+ function CJ(e) {
33794
33812
  let t = e.length, n = e.reduce((e, t) => e + t[0], 0) / t, r = e.reduce((e, t) => e + t[1], 0) / t, i = e.reduce((e, t) => e + (t[0] - n) ** 2, 0);
33795
33813
  if (!t || !i) return null;
33796
- let a = e.reduce((e, t) => e + (t[0] - n) * (t[1] - r), 0) / i, o = aJ(e.map((e) => e[1])), s = oJ(e.map((e) => e[1])), c = (e) => {
33814
+ let a = e.reduce((e, t) => e + (t[0] - n) * (t[1] - r), 0) / i, o = sJ(e.map((e) => e[1])), s = cJ(e.map((e) => e[1])), c = (e) => {
33797
33815
  let t = r + a * (e - n);
33798
33816
  return t < o ? [e + (o - t) / a, o] : t > s ? [e + (s - t) / a, s] : [e, t];
33799
33817
  };
33800
- return [c(aJ(e.map((e) => e[0]))), c(oJ(e.map((e) => e[0])))];
33818
+ return [c(sJ(e.map((e) => e[0]))), c(cJ(e.map((e) => e[0])))];
33801
33819
  }
33802
- var yJ = 44, bJ = 28, xJ = 8;
33803
- function SJ(e, t, n, r, i) {
33804
- let a = e.series[0], o = zK(e), s = e.type === "bubble", c = oJ(s ? e.data.map((t) => t[e.size.key]) : []), l = (e) => Math.max(xJ, (i.compact ? bJ : yJ) * Math.sqrt(e / c)), u = (t) => e.data.map((e, t) => t).filter((n) => !e.group || IK(e, n) === t), d = (e.group ? o : [null]).filter((e) => e == null || !r.hidden.has(e)).flatMap((e) => u(e)), f = e.trend ? vJ(d.map((t) => [e.data[t][e.x.key], Q(e, a.key, t)])) : null, p = e.data.map((t) => t[e.x.key]), m = e.data.map((t, n) => Q(e, a.key, n)), [h, g] = Nq(p, !1), [_, v] = Nq(m, !1), y = Mq(e.y.format, e.y.min ?? _, e.y.max ?? v, 4), b = Mq(e.x.format, h, g, 4), x = (e.group ? o : [null]).map((n, r) => ({
33820
+ var wJ = 44, TJ = 28, EJ = 8;
33821
+ function DJ(e, t, n, r, i) {
33822
+ let a = e.series[0], o = zK(e), s = e.type === "bubble", c = cJ(s ? e.data.map((t) => t[e.size.key]) : []), l = (e) => Math.max(EJ, (i.compact ? TJ : wJ) * Math.sqrt(e / c)), u = (t) => e.data.map((e, t) => t).filter((n) => !e.group || IK(e, n) === t), d = (e.group ? o : [null]).filter((e) => e == null || !r.hidden.has(e)).flatMap((e) => u(e)), f = e.trend ? CJ(d.map((t) => [e.data[t][e.x.key], Q(e, a.key, t)])) : null, p = e.data.map((t) => t[e.x.key]), m = e.data.map((t, n) => Q(e, a.key, n)), [h, g] = Nq(p, !1), [_, v] = Nq(m, !1), y = Mq(e.y.format, e.y.min ?? _, e.y.max ?? v, 4), b = Mq(e.x.format, h, g, 4), x = (e.group ? o : [null]).map((n, r) => ({
33805
33823
  name: n ?? a.key,
33806
33824
  type: "scatter",
33807
33825
  symbolSize: s ? (e) => l(e[2]) : i.compact ? 8 : 10,
33808
33826
  itemStyle: {
33809
- color: Lq(t.palette[r], .85),
33827
+ color: zq(t.palette[r], .85),
33810
33828
  borderColor: t.surface,
33811
33829
  borderWidth: 1.5
33812
33830
  },
@@ -33857,8 +33875,8 @@ function SJ(e, t, n, r, i) {
33857
33875
  bottom: e.x.label ? 24 : 4,
33858
33876
  outerBoundsMode: "same"
33859
33877
  },
33860
- tooltip: Zq(i.tooltipBase, (t) => t.data?.row == null ? "" : dq(cq(e, t.data.row, r.hidden, i.colours))),
33861
- xAxis: $q(t, (e) => Z(e, b), {
33878
+ tooltip: $q(i.tooltipBase, (t) => t.data?.row == null ? "" : dq(cq(e, t.data.row, r.hidden, i.colours))),
33879
+ xAxis: tJ(t, (e) => Z(e, b), {
33862
33880
  scale: !0,
33863
33881
  splitLine: { show: !1 },
33864
33882
  axisLine: {
@@ -33876,7 +33894,7 @@ function SJ(e, t, n, r, i) {
33876
33894
  }
33877
33895
  } : {}
33878
33896
  }),
33879
- yAxis: $q(t, (e) => Z(e, y), {
33897
+ yAxis: tJ(t, (e) => Z(e, y), {
33880
33898
  min: e.y.min,
33881
33899
  max: e.y.max,
33882
33900
  ...e.y.label ? {
@@ -33894,10 +33912,10 @@ function SJ(e, t, n, r, i) {
33894
33912
  series: x
33895
33913
  };
33896
33914
  }
33897
- var CJ = 32, wJ = 8, TJ = 26;
33898
- function EJ(e, t, n, r, i) {
33899
- let a = e.x.kind === "time", o = e.series.length, s = (n.height - 6 - TJ) / o, c = s - CJ - wJ, l = t.palette[0], u = e.data.map((t, n) => $(e, n)), d = e.series.flatMap((n, r) => {
33900
- let i = Xq(e, n.key).filter((e) => e != null).pop();
33915
+ var OJ = 32, kJ = 8, AJ = 26;
33916
+ function jJ(e, t, n, r, i) {
33917
+ let a = e.x.kind === "time", o = e.series.length, s = (n.height - 6 - AJ) / o, c = s - OJ - kJ, l = t.palette[0], u = e.data.map((t, n) => $(e, n)), d = e.series.flatMap((n, r) => {
33918
+ let i = Qq(e, n.key).filter((e) => e != null).pop();
33901
33919
  return [{
33902
33920
  text: n.label,
33903
33921
  left: 0,
@@ -33921,7 +33939,7 @@ function EJ(e, t, n, r, i) {
33921
33939
  }];
33922
33940
  }), f = (t, n) => {
33923
33941
  let r = Q(e, t.key, n);
33924
- return a ? [Uq(FK(e, n)), r] : r;
33942
+ return a ? [Gq(FK(e, n)), r] : r;
33925
33943
  };
33926
33944
  return {
33927
33945
  ...i.base,
@@ -33930,7 +33948,7 @@ function EJ(e, t, n, r, i) {
33930
33948
  grid: e.series.map((e, t) => ({
33931
33949
  left: 52,
33932
33950
  right: 8,
33933
- top: 6 + t * s + CJ,
33951
+ top: 6 + t * s + OJ,
33934
33952
  height: c
33935
33953
  })),
33936
33954
  axisPointer: {
@@ -33948,7 +33966,7 @@ function EJ(e, t, n, r, i) {
33948
33966
  formatter: (t) => dq(cq(e, (Array.isArray(t) ? t : [t])[0]?.dataIndex ?? 0, r.hidden, i.colours))
33949
33967
  },
33950
33968
  xAxis: e.series.map((n, r) => ({
33951
- ...a ? { type: "time" } : Qq(t, u, { boundaryGap: !1 }),
33969
+ ...a ? { type: "time" } : eJ(t, u, { boundaryGap: !1 }),
33952
33970
  gridIndex: r,
33953
33971
  axisLine: { lineStyle: { color: r === o - 1 ? t.axis : t.grid } },
33954
33972
  axisTick: { show: !1 },
@@ -33959,12 +33977,12 @@ function EJ(e, t, n, r, i) {
33959
33977
  fontSize: 11,
33960
33978
  hideOverlap: !0,
33961
33979
  margin: 10,
33962
- ...a ? { formatter: Wq(e) } : {}
33980
+ ...a ? { formatter: Kq(e) } : {}
33963
33981
  }
33964
33982
  })),
33965
33983
  yAxis: e.series.map((n, r) => {
33966
- let [i, a] = Nq(Xq(e, n.key), !1), o = Mq(n.format, e.y.min ?? i, e.y.max ?? a, 2);
33967
- return $q(t, (e) => Z(e, o), {
33984
+ let [i, a] = Nq(Qq(e, n.key), !1), o = Mq(n.format, e.y.min ?? i, e.y.max ?? a, 2);
33985
+ return tJ(t, (e) => Z(e, o), {
33968
33986
  gridIndex: r,
33969
33987
  splitNumber: 2,
33970
33988
  scale: e.y.min == null,
@@ -33997,13 +34015,13 @@ function EJ(e, t, n, r, i) {
33997
34015
  borderColor: t.surface,
33998
34016
  borderWidth: 2
33999
34017
  },
34000
- areaStyle: { color: Hq(l, t.dark ? .26 : .16) },
34018
+ areaStyle: { color: Wq(l, t.dark ? .26 : .16) },
34001
34019
  animationDelay: i.animate ? r * 160 : 0,
34002
34020
  emphasis: { disabled: !0 }
34003
34021
  }))
34004
34022
  };
34005
34023
  }
34006
- function DJ(e, t, n, r) {
34024
+ function MJ(e, t, n, r) {
34007
34025
  let i = r?.start ?? (e.data.length > 5e3 ? 70 : 0), a = r?.end ?? 100;
34008
34026
  return [{
34009
34027
  type: "inside",
@@ -34020,7 +34038,7 @@ function DJ(e, t, n, r) {
34020
34038
  borderColor: "transparent",
34021
34039
  backgroundColor: t.grid,
34022
34040
  borderRadius: 6,
34023
- fillerColor: Lq(n, t.dark ? .22 : .12),
34041
+ fillerColor: zq(n, t.dark ? .22 : .12),
34024
34042
  handleStyle: {
34025
34043
  color: t.surface,
34026
34044
  borderColor: t.axis
@@ -34032,14 +34050,14 @@ function DJ(e, t, n, r) {
34032
34050
  color: t.axis,
34033
34051
  width: .75
34034
34052
  },
34035
- areaStyle: { color: Lq(t.neutral, .15) }
34053
+ areaStyle: { color: zq(t.neutral, .15) }
34036
34054
  },
34037
34055
  selectedDataBackground: {
34038
34056
  lineStyle: {
34039
34057
  color: n,
34040
34058
  width: .75
34041
34059
  },
34042
- areaStyle: { color: Lq(n, .18) }
34060
+ areaStyle: { color: zq(n, .18) }
34043
34061
  },
34044
34062
  textStyle: {
34045
34063
  color: t.label,
@@ -34048,7 +34066,7 @@ function DJ(e, t, n, r) {
34048
34066
  }
34049
34067
  }];
34050
34068
  }
34051
- function OJ(e, t, n) {
34069
+ function NJ(e, t, n) {
34052
34070
  switch (e.type) {
34053
34071
  case "scatter":
34054
34072
  case "bubble": {
@@ -34074,7 +34092,7 @@ function OJ(e, t, n) {
34074
34092
  };
34075
34093
  case "treemap": {
34076
34094
  let t = 1;
34077
- for (let r of mJ(e)) {
34095
+ for (let r of yJ(e)) {
34078
34096
  let e = r.rows.indexOf(n);
34079
34097
  if (e >= 0) return {
34080
34098
  seriesIndex: 0,
@@ -34101,7 +34119,7 @@ function OJ(e, t, n) {
34101
34119
  };
34102
34120
  }
34103
34121
  }
34104
- function kJ(e, t) {
34122
+ function PJ(e, t) {
34105
34123
  switch (e.type) {
34106
34124
  case "scatter":
34107
34125
  case "bubble": return t.data?.row == null ? null : {
@@ -34134,20 +34152,20 @@ function kJ(e, t) {
34134
34152
  };
34135
34153
  }
34136
34154
  }
34137
- var AJ = {
34138
- donut: Jq,
34139
- heatmap: tJ,
34140
- calendar: lJ,
34141
- funnel: uJ,
34142
- gauge: dJ,
34143
- waterfall: pJ,
34144
- treemap: hJ,
34145
- sankey: _J,
34146
- scatter: SJ,
34147
- bubble: SJ,
34148
- multiples: EJ
34155
+ var FJ = {
34156
+ donut: Xq,
34157
+ heatmap: rJ,
34158
+ calendar: dJ,
34159
+ funnel: fJ,
34160
+ gauge: pJ,
34161
+ waterfall: vJ,
34162
+ treemap: bJ,
34163
+ sankey: SJ,
34164
+ scatter: DJ,
34165
+ bubble: DJ,
34166
+ multiples: jJ
34149
34167
  };
34150
- function jJ(e, t, n, r, { pixelRatio: i = 2 } = {}) {
34168
+ function IJ(e, t, n, r, { pixelRatio: i = 2 } = {}) {
34151
34169
  let a = document.createElement("div");
34152
34170
  a.style.cssText = `position:fixed;left:-10000px;top:0;width:${n.width}px;height:${n.height}px;`, document.body.append(a);
34153
34171
  let o = _j(a, null, {
@@ -34157,7 +34175,7 @@ function jJ(e, t, n, r, { pixelRatio: i = 2 } = {}) {
34157
34175
  height: n.height
34158
34176
  });
34159
34177
  try {
34160
- return o.setOption(Kq(e, t, n, {
34178
+ return o.setOption(Jq(e, t, n, {
34161
34179
  ...r,
34162
34180
  renderer: "canvas",
34163
34181
  animation: !1
@@ -34170,7 +34188,7 @@ function jJ(e, t, n, r, { pixelRatio: i = 2 } = {}) {
34170
34188
  o.dispose(), a.remove();
34171
34189
  }
34172
34190
  }
34173
- function MJ(e, { renderer: t }) {
34191
+ function LJ(e, { renderer: t }) {
34174
34192
  let n = _j(e, null, { renderer: t }), r = !1, i = null;
34175
34193
  return {
34176
34194
  renderer: t,
@@ -34178,14 +34196,14 @@ function MJ(e, { renderer: t }) {
34178
34196
  let c = r && !s ? n.getOption()?.dataZoom?.[0] : null, l = Number.isFinite(c?.start) && Number.isFinite(c?.end) ? {
34179
34197
  start: c.start,
34180
34198
  end: c.end
34181
- } : null, u = Kq(e, t, a, {
34199
+ } : null, u = Jq(e, t, a, {
34182
34200
  ...o,
34183
34201
  zoom: l
34184
34202
  });
34185
34203
  i = e, n.setOption(u, s || !r ? { notMerge: !0 } : { replaceMerge: Aq }), r = !0;
34186
34204
  },
34187
34205
  focusPoint(e, t) {
34188
- let { tip: r = !0, ...a } = OJ(i, e, t);
34206
+ let { tip: r = !0, ...a } = NJ(i, e, t);
34189
34207
  n.dispatchAction({ type: "downplay" }), n.dispatchAction({
34190
34208
  type: "highlight",
34191
34209
  ...a
@@ -34203,7 +34221,7 @@ function MJ(e, { renderer: t }) {
34203
34221
  onSelect(e) {
34204
34222
  n.on("click", (t) => {
34205
34223
  if (t.componentType !== "series") return;
34206
- let n = kJ(i, t);
34224
+ let n = PJ(i, t);
34207
34225
  n && e({
34208
34226
  seriesIndex: n.series,
34209
34227
  dataIndex: n.row
@@ -34220,7 +34238,7 @@ function MJ(e, { renderer: t }) {
34220
34238
  }
34221
34239
  //#endregion
34222
34240
  //#region src/elementBase.js
34223
- var NJ = typeof HTMLElement > "u" ? class {} : HTMLElement, PJ = "wui-chart:select", FJ = "wui-chart:legend-change", IJ = "wui-chart:ready", LJ = [
34241
+ var RJ = typeof HTMLElement > "u" ? class {} : HTMLElement, zJ = "wui-chart:select", BJ = "wui-chart:legend-change", VJ = "wui-chart:ready", HJ = [
34224
34242
  "ArrowLeft",
34225
34243
  "ArrowRight",
34226
34244
  "ArrowUp",
@@ -34228,8 +34246,8 @@ var NJ = typeof HTMLElement > "u" ? class {} : HTMLElement, PJ = "wui-chart:sele
34228
34246
  "Home",
34229
34247
  "End",
34230
34248
  "Escape"
34231
- ], RJ = "(prefers-color-scheme: dark)", zJ = "(prefers-reduced-motion: reduce)", BJ = (e) => typeof window.matchMedia == "function" ? window.matchMedia(e) : null, VJ = !1;
34232
- function HJ(e) {
34249
+ ], UJ = "(prefers-color-scheme: dark)", WJ = "(prefers-reduced-motion: reduce)", GJ = (e) => typeof window.matchMedia == "function" ? window.matchMedia(e) : null, KJ = !1;
34250
+ function qJ(e) {
34233
34251
  let t = getComputedStyle(e), n = (e) => t.getPropertyValue(e).trim(), r = e.closest("[data-bs-theme], [data-theme]") ?? document.documentElement, i = r.getAttribute("data-bs-theme") || r.getAttribute("data-theme"), a = {
34234
34252
  palette: [
34235
34253
  1,
@@ -34260,16 +34278,16 @@ function HJ(e) {
34260
34278
  textMuted: n("--color-text-muted"),
34261
34279
  shadow: n("--wui-shadow-overlay"),
34262
34280
  font: t.fontFamily,
34263
- dark: i === "dark" || i === "auto" && !!BJ(RJ)?.matches,
34264
- reducedMotion: !!BJ(zJ)?.matches
34281
+ dark: i === "dark" || i === "auto" && !!GJ(UJ)?.matches,
34282
+ reducedMotion: !!GJ(WJ)?.matches
34265
34283
  };
34266
- return !a.palette[0] && !VJ && (VJ = !0, console.warn("[@webority/ui-elements] <wui-chart> found no --wui-chart-* colours: load @webority/theme on the page.")), a;
34284
+ return !a.palette[0] && !KJ && (KJ = !0, console.warn("[@webority/ui-elements] <wui-chart> found no --wui-chart-* colours: load @webority/theme on the page.")), a;
34267
34285
  }
34268
- var UJ = /* @__PURE__ */ new Set(), WJ = null;
34269
- function GJ(e) {
34270
- if (UJ.add(e), WJ) return;
34286
+ var JJ = /* @__PURE__ */ new Set(), YJ = null;
34287
+ function XJ(e) {
34288
+ if (JJ.add(e), YJ) return;
34271
34289
  let t = () => {
34272
- for (let e of UJ) e._themeChanged();
34290
+ for (let e of JJ) e._themeChanged();
34273
34291
  }, n = new MutationObserver(t);
34274
34292
  n.observe(document.documentElement, {
34275
34293
  attributes: !0,
@@ -34285,30 +34303,30 @@ function GJ(e) {
34285
34303
  subtree: !0,
34286
34304
  attributeFilter: ["data-theme", "data-bs-theme"]
34287
34305
  });
34288
- let i = [BJ(RJ), BJ(zJ)].filter(Boolean);
34306
+ let i = [GJ(UJ), GJ(WJ)].filter(Boolean);
34289
34307
  for (let e of i) e.addEventListener?.("change", t);
34290
- WJ = () => {
34308
+ YJ = () => {
34291
34309
  n.disconnect(), r.disconnect();
34292
34310
  for (let e of i) e.removeEventListener?.("change", t);
34293
- WJ = null;
34311
+ YJ = null;
34294
34312
  };
34295
34313
  }
34296
- function KJ(e) {
34297
- UJ.delete(e), UJ.size || WJ?.();
34314
+ function ZJ(e) {
34315
+ JJ.delete(e), JJ.size || YJ?.();
34298
34316
  }
34299
- function qJ(e, t) {
34317
+ function QJ(e, t) {
34300
34318
  let n = document.createElement("a");
34301
34319
  n.href = e, n.download = t, document.body.append(n), n.click(), n.remove();
34302
34320
  }
34303
- var JJ = (e, t, n) => {
34321
+ var $J = (e, t, n) => {
34304
34322
  let r = document.createElement(e);
34305
34323
  return t && (r.className = t), n != null && (r.textContent = n), r;
34306
- }, YJ = 0, XJ = class extends NJ {
34324
+ }, eY = 0, tY = class extends RJ {
34307
34325
  static get observedAttributes() {
34308
34326
  return ["view"];
34309
34327
  }
34310
34328
  constructor() {
34311
- super(), YJ += 1, this.uid = `wui-chart-${YJ}`, this._spec = null, this._normal = null, this._hidden = /* @__PURE__ */ new Set(), this._focus = null;
34329
+ super(), eY += 1, this.uid = `wui-chart-${eY}`, this._spec = null, this._normal = null, this._hidden = /* @__PURE__ */ new Set(), this._focus = null;
34312
34330
  }
34313
34331
  get spec() {
34314
34332
  return this._spec;
@@ -34329,12 +34347,12 @@ var JJ = (e, t, n) => {
34329
34347
  }
34330
34348
  this._spec ??= this._readScript(), this._spec == null && !this.querySelector(":scope > script[type='application/json']") && (this._awaitingSpec = !0, queueMicrotask(() => {
34331
34349
  this._awaitingSpec = !1, this._parts && this._update();
34332
- })), this._build(), GJ(this), this._theme = HJ(this), this._width = this.clientWidth, this._resizeObserver = new ResizeObserver(() => this._resized()), this._resizeObserver.observe(this), typeof IntersectionObserver == "function" ? (this._visible = !1, this._intersection = new IntersectionObserver((e) => {
34350
+ })), this._build(), XJ(this), this._theme = qJ(this), this._width = this.clientWidth, this._resizeObserver = new ResizeObserver(() => this._resized()), this._resizeObserver.observe(this), typeof IntersectionObserver == "function" ? (this._visible = !1, this._intersection = new IntersectionObserver((e) => {
34333
34351
  e.some((e) => e.isIntersecting) && (this._intersection.disconnect(), this._visible = !0, this._update());
34334
34352
  }, { threshold: .05 }), this._intersection.observe(this)) : this._visible = !0, this._update();
34335
34353
  }
34336
34354
  disconnectedCallback() {
34337
- KJ(this), this._resizeObserver?.disconnect(), this._intersection?.disconnect(), this._engine?.dispose(), this._engine = null, this._drawn = !1, this._parts = null;
34355
+ ZJ(this), this._resizeObserver?.disconnect(), this._intersection?.disconnect(), this._engine?.dispose(), this._engine = null, this._drawn = !1, this._parts = null;
34338
34356
  }
34339
34357
  attributeChangedCallback(e, t, n) {
34340
34358
  t === n || !this._parts || (TK("view", n, JG), this._update());
@@ -34345,18 +34363,18 @@ var JJ = (e, t, n) => {
34345
34363
  }
34346
34364
  toPng() {
34347
34365
  let { spec: e } = this._normalized();
34348
- return e ? jJ(e, this._theme ?? HJ(this), this._size(e), {
34366
+ return e ? IJ(e, this._theme ?? qJ(this), this._size(e), {
34349
34367
  hidden: this._hidden,
34350
34368
  renderer: VK(e)
34351
34369
  }) : "";
34352
34370
  }
34353
34371
  exportCsv(e) {
34354
34372
  let t = URL.createObjectURL(new Blob([this.toCsv()], { type: "text/csv;charset=utf-8" }));
34355
- qJ(t, e ?? `${vq(this._normalized().spec)}.csv`), setTimeout(() => URL.revokeObjectURL(t), 2e3);
34373
+ QJ(t, e ?? `${vq(this._normalized().spec)}.csv`), setTimeout(() => URL.revokeObjectURL(t), 2e3);
34356
34374
  }
34357
34375
  exportPng(e) {
34358
34376
  let t = this.toPng();
34359
- t && qJ(t, e ?? `${vq(this._normalized().spec)}.png`);
34377
+ t && QJ(t, e ?? `${vq(this._normalized().spec)}.png`);
34360
34378
  }
34361
34379
  _readScript() {
34362
34380
  let e = this.querySelector(":scope > script[type=\"application/json\"]");
@@ -34371,20 +34389,20 @@ var JJ = (e, t, n) => {
34371
34389
  return this._normal ??= AK(this._spec), this._normal;
34372
34390
  }
34373
34391
  _build() {
34374
- let e = JJ("div", "wui-chart-legend");
34392
+ let e = $J("div", "wui-chart-legend");
34375
34393
  e.setAttribute("role", "group"), e.setAttribute("aria-label", "Legend"), e.hidden = !0, e.addEventListener("click", (e) => {
34376
34394
  let t = e.target.closest?.(".wui-chart-legend-item");
34377
34395
  t && this._toggle(t.dataset.key);
34378
34396
  });
34379
- let t = JJ("div", "wui-chart-surface");
34397
+ let t = $J("div", "wui-chart-surface");
34380
34398
  t.tabIndex = 0, t.setAttribute("role", "group"), t.setAttribute("aria-roledescription", "chart"), t.addEventListener("keydown", (e) => this._onKey(e)), t.addEventListener("blur", () => this._clearFocus());
34381
- let n = JJ("div", "wui-chart-canvas");
34399
+ let n = $J("div", "wui-chart-canvas");
34382
34400
  n.setAttribute("aria-hidden", "true"), t.append(n);
34383
- let r = JJ("div", "wui-chart-state");
34401
+ let r = $J("div", "wui-chart-state");
34384
34402
  r.setAttribute("role", "status"), r.hidden = !0;
34385
- let i = JJ("div", "wui-chart-table-wrap visually-hidden"), a = JJ("p", "visually-hidden");
34403
+ let i = $J("div", "wui-chart-table-wrap visually-hidden"), a = $J("p", "visually-hidden");
34386
34404
  a.id = `${this.uid}-summary`;
34387
- let o = JJ("div", "visually-hidden");
34405
+ let o = $J("div", "visually-hidden");
34388
34406
  o.setAttribute("aria-live", "polite"), this.replaceChildren(e, t, r, i, a, o), this.setAttribute("role", "figure"), this.setAttribute("aria-describedby", a.id), this._parts = {
34389
34407
  legend: e,
34390
34408
  surface: t,
@@ -34421,7 +34439,7 @@ var JJ = (e, t, n) => {
34421
34439
  i.replaceChildren();
34422
34440
  return;
34423
34441
  }
34424
- i.style.height = n, e === "loading" ? i.replaceChildren(JJ("div", "skeleton wui-chart-skeleton"), JJ("span", "visually-hidden", "Loading chart")) : i.replaceChildren(JJ("p", "wui-chart-state-text", t));
34442
+ i.style.height = n, e === "loading" ? i.replaceChildren($J("div", "skeleton wui-chart-skeleton"), $J("span", "visually-hidden", "Loading chart")) : i.replaceChildren($J("p", "wui-chart-state-text", t));
34425
34443
  }
34426
34444
  _colour(e, t) {
34427
34445
  return e.type === "donut" ? sq(e, t, this._theme) : this._theme.palette[t];
@@ -34436,40 +34454,40 @@ var JJ = (e, t, n) => {
34436
34454
  o
34437
34455
  ]);
34438
34456
  s !== this._legendSignature && (this._legendSignature = s, n.replaceChildren(...r.map((t, n) => {
34439
- let r = JJ("button", "wui-chart-legend-item");
34457
+ let r = $J("button", "wui-chart-legend-item");
34440
34458
  r.type = "button", r.dataset.key = t;
34441
- let i = JJ("span", e.type === "line" ? "wui-chart-legend-swatch wui-chart-legend-swatch-line" : "wui-chart-legend-swatch");
34442
- return i.style.background = o[n], r.append(i, JJ("span", "wui-chart-legend-label", a[n])), r;
34459
+ let i = $J("span", e.type === "line" ? "wui-chart-legend-swatch wui-chart-legend-swatch-line" : "wui-chart-legend-swatch");
34460
+ return i.style.background = o[n], r.append(i, $J("span", "wui-chart-legend-label", a[n])), r;
34443
34461
  })));
34444
34462
  for (let e of n.children) e.setAttribute("aria-pressed", String(!this._hidden.has(e.dataset.key)));
34445
34463
  }
34446
34464
  _renderTable(e) {
34447
34465
  if (this._tableSpec === e) return;
34448
34466
  this._tableSpec = e;
34449
- let t = mq(e), n = JJ("table", "wui-chart-table");
34450
- n.append(JJ("caption", "visually-hidden", t.caption));
34451
- let r = JJ("tr");
34467
+ let t = mq(e), n = $J("table", "wui-chart-table");
34468
+ n.append($J("caption", "visually-hidden", t.caption));
34469
+ let r = $J("tr");
34452
34470
  t.head.forEach((e, t) => {
34453
- let n = JJ("th", t ? "wui-chart-num" : null, e);
34471
+ let n = $J("th", t ? "wui-chart-num" : null, e);
34454
34472
  n.scope = "col", r.append(n);
34455
34473
  });
34456
- let i = JJ("thead");
34474
+ let i = $J("thead");
34457
34475
  i.append(r), n.append(i);
34458
- let a = JJ("tbody");
34476
+ let a = $J("tbody");
34459
34477
  for (let e of t.rows) {
34460
- let t = JJ("tr"), n = JJ("th", null, e.head);
34461
- n.scope = "row", t.append(n, ...e.cells.map((e) => JJ("td", "wui-chart-num", e))), a.append(t);
34478
+ let t = $J("tr"), n = $J("th", null, e.head);
34479
+ n.scope = "row", t.append(n, ...e.cells.map((e) => $J("td", "wui-chart-num", e))), a.append(t);
34462
34480
  }
34463
34481
  n.append(a);
34464
34482
  let o = [n];
34465
- t.truncated && o.push(JJ("p", "wui-chart-table-note", `Showing the first ${t.rows.length} of ${t.total} rows. Download the CSV for all of them.`)), this._parts.tableWrap.replaceChildren(...o);
34483
+ t.truncated && o.push($J("p", "wui-chart-table-note", `Showing the first ${t.rows.length} of ${t.total} rows. Download the CSV for all of them.`)), this._parts.tableWrap.replaceChildren(...o);
34466
34484
  }
34467
34485
  _draw() {
34468
34486
  let { spec: e } = this._normalized(), t = VK(e), n = e.type !== this._drawnType;
34469
34487
  this._engine && this._engine.renderer !== t && (this._engine.dispose(), this._engine = null);
34470
34488
  let r = `${e.height}px`, i = this._parts.canvas.style.height !== r;
34471
- this._parts.canvas.style.height = r, i && this._engine?.resize(), this._engine || (this._engine = MJ(this._parts.canvas, { renderer: t }), this._engine.onSelect(({ seriesIndex: e, dataIndex: t }) => this._select(e, t)), this._engine.onFinished(() => {
34472
- this._announcedReady || (this._announcedReady = !0, this.dispatchEvent(new CustomEvent(IJ, {
34489
+ this._parts.canvas.style.height = r, i && this._engine?.resize(), this._engine || (this._engine = LJ(this._parts.canvas, { renderer: t }), this._engine.onSelect(({ seriesIndex: e, dataIndex: t }) => this._select(e, t)), this._engine.onFinished(() => {
34490
+ this._announcedReady || (this._announcedReady = !0, this.dispatchEvent(new CustomEvent(VJ, {
34473
34491
  bubbles: !0,
34474
34492
  detail: { renderer: t }
34475
34493
  })));
@@ -34480,7 +34498,7 @@ var JJ = (e, t, n) => {
34480
34498
  }
34481
34499
  _themeChanged() {
34482
34500
  if (!this._parts) return;
34483
- let e = HJ(this);
34501
+ let e = qJ(this);
34484
34502
  JSON.stringify(e) !== JSON.stringify(this._theme) && (this._theme = e, this._update());
34485
34503
  }
34486
34504
  _resized() {
@@ -34492,7 +34510,7 @@ var JJ = (e, t, n) => {
34492
34510
  if (!t || e == null) return;
34493
34511
  this._hidden.has(e) ? this._hidden.delete(e) : this._hidden.add(e), this._clearFocus(), this._update();
34494
34512
  let n = Object.fromEntries(HK(t).map((e) => [e, !this._hidden.has(e)]));
34495
- this.dispatchEvent(new CustomEvent(FJ, {
34513
+ this.dispatchEvent(new CustomEvent(BJ, {
34496
34514
  bubbles: !0,
34497
34515
  detail: { visible: n }
34498
34516
  }));
@@ -34505,7 +34523,7 @@ var JJ = (e, t, n) => {
34505
34523
  e.preventDefault(), this._select(this._focus.series, this._focus.index);
34506
34524
  return;
34507
34525
  }
34508
- if (!LJ.includes(e.key) || e.key === "Escape" && !this._focus) return;
34526
+ if (!HJ.includes(e.key) || e.key === "Escape" && !this._focus) return;
34509
34527
  e.preventDefault();
34510
34528
  let n = Oq(t, this._focus, e.key, this._hidden);
34511
34529
  if (!n) {
@@ -34525,7 +34543,7 @@ var JJ = (e, t, n) => {
34525
34543
  let { spec: n } = this._normalized(), r = n?.series[iK(n.type) ? 0 : e];
34526
34544
  if (!r) return;
34527
34545
  let i = n.data[t] ?? null;
34528
- this.dispatchEvent(new CustomEvent(PJ, {
34546
+ this.dispatchEvent(new CustomEvent(zJ, {
34529
34547
  bubbles: !0,
34530
34548
  detail: {
34531
34549
  series: r.key,
@@ -34540,6 +34558,6 @@ var JJ = (e, t, n) => {
34540
34558
  };
34541
34559
  //#endregion
34542
34560
  //#region src/chart.js
34543
- typeof customElements < "u" && !customElements.get("wui-chart") && customElements.define("wui-chart", XJ);
34561
+ typeof customElements < "u" && !customElements.get("wui-chart") && customElements.define("wui-chart", tY);
34544
34562
  //#endregion
34545
- export { qG as CHART_STATES, UG as CHART_TYPES, JG as CHART_VIEWS, YG as MAX_SERIES, XG as MAX_SLICES, KG as RENDERERS, WG as STACK_MODES, XJ as WuiChart, GG as X_KINDS, Z as formatValue, AK as normalizeSpec };
34563
+ export { qG as CHART_STATES, UG as CHART_TYPES, JG as CHART_VIEWS, YG as MAX_SERIES, XG as MAX_SLICES, KG as RENDERERS, WG as STACK_MODES, tY as WuiChart, GG as X_KINDS, Z as formatValue, AK as normalizeSpec };