@blueprint-chart/lib 1.8.1 → 1.8.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.
@@ -2245,12 +2245,17 @@ function sn(e, t, n, r, i = {}) {
2245
2245
  } else s.text(t);
2246
2246
  }
2247
2247
  function cn(e, t, n) {
2248
- let r = t.split(/\s+/), i = "", a = 0;
2249
- for (let t of r) {
2250
- let r = i ? `${i} ${t}` : t;
2251
- i && r.length * 7 > n ? (e.append("tspan").attr("x", e.attr("x")).attr("dy", a === 0 ? "0" : "1.2em").text(i), i = t, a++) : i = r;
2248
+ let r = 0, i = (t) => {
2249
+ e.append("tspan").attr("x", e.attr("x")).attr("dy", r === 0 ? "0" : "1.2em").text(t), r++;
2250
+ };
2251
+ for (let e of t.split("\n")) {
2252
+ let t = "";
2253
+ for (let r of e.split(/\s+/).filter(Boolean)) {
2254
+ let e = t ? `${t} ${r}` : r;
2255
+ t && e.length * 7 > n ? (i(t), t = r) : t = e;
2256
+ }
2257
+ i(t);
2252
2258
  }
2253
- i && e.append("tspan").attr("x", e.attr("x")).attr("dy", a === 0 ? "0" : "1.2em").text(i);
2254
2259
  }
2255
2260
  function ln(e, t, n = A.Center) {
2256
2261
  if ("bandwidth" in t) {
@@ -2323,7 +2328,7 @@ function mn(e, t, n, r) {
2323
2328
  let e = fn(d - u.x);
2324
2329
  sn(o, t.text, g, _ - 4, {
2325
2330
  textColor: t.textColor,
2326
- maxWidth: $(t.maxWidth, n.width),
2331
+ maxWidth: $(t.maxWidth, n.width) ?? n.width * .4,
2327
2332
  textAnchor: e,
2328
2333
  backgroundColor: n.backgroundColor,
2329
2334
  textOutline: t.textOutline
@@ -2412,7 +2417,7 @@ function gn(e, t, n, r) {
2412
2417
  if (t.text) {
2413
2418
  sn(i, t.text, o, s, {
2414
2419
  textColor: t.textColor,
2415
- maxWidth: $(t.maxWidth, n.width),
2420
+ maxWidth: $(t.maxWidth, n.width) ?? n.width * .4,
2416
2421
  textAnchor: "middle",
2417
2422
  backgroundColor: n.backgroundColor,
2418
2423
  textOutline: t.textOutline
@@ -6627,14 +6632,22 @@ Ji(_.AreaStacked, ki, [
6627
6632
  ...go
6628
6633
  ]);
6629
6634
  //#endregion
6630
- //#region src/charts/chart-helpers.ts
6635
+ //#region src/charts/number-parse.ts
6631
6636
  function wo(e) {
6632
- let t = e?.trim();
6637
+ return e.replace(/(\d)\s+(?=\d)/g, "$1");
6638
+ }
6639
+ function To(e) {
6640
+ return wo(e.replace(/^"(.*)"$/, "$1")).replace(/%$/, "").trim();
6641
+ }
6642
+ function Eo(e) {
6643
+ let t = To(e?.trim() ?? "");
6633
6644
  if (!t) return;
6634
- let n = Number.parseFloat(t);
6645
+ let n = Number(t);
6635
6646
  return Number.isFinite(n) ? n : void 0;
6636
6647
  }
6637
- function To(e) {
6648
+ //#endregion
6649
+ //#region src/charts/chart-helpers.ts
6650
+ function Do(e) {
6638
6651
  let t = e.split("\n").map((e) => e.trim()).filter(Boolean), n = [], r = [], i = t[0]?.match(/^series\s*=\s*(.+)$/);
6639
6652
  if (i) {
6640
6653
  let e = i[1].trim(), r = e.includes("\",\"") ? e.split(",").map((e) => e.trim().replace(/^"|"$/g, "")) : e.replace(/^"|"$/g, "").split(",").map((e) => e.trim()), a = r.map(() => []);
@@ -6643,7 +6656,7 @@ function To(e) {
6643
6656
  if (o) {
6644
6657
  n.push(o[1]);
6645
6658
  let e = o[2].split(",");
6646
- for (let t = 0; t < r.length; t++) a[t].push(wo(e[t]));
6659
+ for (let t = 0; t < r.length; t++) a[t].push(Eo(e[t]));
6647
6660
  }
6648
6661
  }
6649
6662
  let o = r.map((e, t) => ({
@@ -6658,36 +6671,36 @@ function To(e) {
6658
6671
  }
6659
6672
  for (let e of t) {
6660
6673
  let t = e.match(/^"([^"]+)"\s*=\s*(.+)$/);
6661
- t && (n.push(t[1]), r.push(wo(t[2])));
6674
+ t && (n.push(t[1]), r.push(Eo(t[2])));
6662
6675
  }
6663
6676
  return {
6664
6677
  labels: n,
6665
6678
  values: r
6666
6679
  };
6667
6680
  }
6668
- function Eo(e, t) {
6681
+ function Oo(e, t) {
6669
6682
  let n = {}, r = Ot(e.colorPalette);
6670
6683
  return r ? n.colors = r : e.colors && e.colors.length > 0 && (n.colors = e.colors), e.autoContrast && t && n.colors && (n.colors = ve(n.colors, t)), e.allowDarkMode !== void 0 && (n.allowDarkMode = e.allowDarkMode), n;
6671
6684
  }
6672
- function Do(e) {
6685
+ function ko(e) {
6673
6686
  let t = {};
6674
6687
  return e.legend !== void 0 && (t.legend = e.legend), e.legendPosition !== void 0 && (t.legendPosition = e.legendPosition), e.legendAnchor !== void 0 && (t.legendAnchor = e.legendAnchor), e.directLabelling !== void 0 && (t.directLabelling = e.directLabelling), e.directLabelAnchor !== void 0 && (t.directLabelAnchor = e.directLabelAnchor), t;
6675
6688
  }
6676
- function Oo(e) {
6689
+ function Ao(e) {
6677
6690
  if (!(e.showVerticalTicks !== void 0 || e.verticalGridStyle !== void 0 || e.verticalNumberFormat !== void 0 || e.showVerticalAxis !== void 0 || e.verticalAxisDirection !== void 0 || e.verticalScaleType !== void 0 || e.verticalLabelPosition !== void 0 || e.verticalRangeMin || e.verticalRangeMax)) return {};
6678
6691
  let t = {};
6679
6692
  e.showVerticalTicks !== void 0 && (t.showTicks = e.showVerticalTicks), e.verticalAxisDirection !== void 0 && (t.direction = e.verticalAxisDirection), e.verticalGridStyle !== void 0 && (t.gridStyle = e.verticalGridStyle), e.verticalNumberFormat !== void 0 && (t.numberFormat = e.verticalNumberFormat), e.showVerticalAxis !== void 0 && (t.showAxis = e.showVerticalAxis), e.verticalScaleType !== void 0 && (t.scaleType = e.verticalScaleType), e.verticalLabelPosition !== void 0 && (t.labelPosition = e.verticalLabelPosition);
6680
6693
  let n = $e(e.verticalRangeMin ?? ""), r = $e(e.verticalRangeMax ?? "");
6681
6694
  return (n !== void 0 || r !== void 0) && (t.range = {}, n !== void 0 && (t.range.min = n), r !== void 0 && (t.range.max = r)), { verticalAxis: t };
6682
6695
  }
6683
- function ko(e) {
6696
+ function jo(e) {
6684
6697
  if (!(e.showHorizontalTicks !== void 0 || e.horizontalGridStyle !== void 0 || e.horizontalNumberFormat !== void 0 || e.showHorizontalAxis !== void 0 || e.horizontalScaleType !== void 0 || e.horizontalLabelPosition !== void 0 || e.horizontalLabelRotation !== void 0 || e.horizontalRangeMin || e.horizontalRangeMax)) return {};
6685
6698
  let t = {};
6686
6699
  e.showHorizontalTicks !== void 0 && (t.showTicks = e.showHorizontalTicks), e.horizontalGridStyle !== void 0 && (t.gridStyle = e.horizontalGridStyle), e.horizontalNumberFormat !== void 0 && (t.numberFormat = e.horizontalNumberFormat), e.showHorizontalAxis !== void 0 && (t.showAxis = e.showHorizontalAxis), e.horizontalScaleType !== void 0 && (t.scaleType = e.horizontalScaleType), e.horizontalLabelPosition !== void 0 && (t.labelPosition = e.horizontalLabelPosition), e.horizontalLabelRotation !== void 0 && (t.labelRotation = e.horizontalLabelRotation);
6687
6700
  let n = $e(e.horizontalRangeMin ?? ""), r = $e(e.horizontalRangeMax ?? "");
6688
6701
  return (n !== void 0 || r !== void 0) && (t.range = {}, n !== void 0 && (t.range.min = n), r !== void 0 && (t.range.max = r)), { horizontalAxis: t };
6689
6702
  }
6690
- function Ao(e) {
6703
+ function Mo(e) {
6691
6704
  return e.lineSymbols ? { lineSymbols: {
6692
6705
  symbol: e.lineSymbolShape ?? M.Circle,
6693
6706
  showOn: e.lineSymbolShowOn ?? N.FirstLast,
@@ -6696,13 +6709,13 @@ function Ao(e) {
6696
6709
  opacity: parseFloat(e.lineSymbolOpacity ?? "1") || 1
6697
6710
  } } : {};
6698
6711
  }
6699
- function jo(e, t) {
6712
+ function No(e, t) {
6700
6713
  let n = {
6701
- ...Eo(e, t),
6702
- ...Do(e),
6703
- ...Oo(e),
6714
+ ...Oo(e, t),
6704
6715
  ...ko(e),
6705
- ...Ao(e)
6716
+ ...Ao(e),
6717
+ ...jo(e),
6718
+ ...Mo(e)
6706
6719
  };
6707
6720
  e.interpolation !== void 0 && (n.interpolation = e.interpolation), e.valueLabels !== void 0 && (n.valueLabels = e.valueLabels), e.valueLabelPosition !== void 0 && (n.valueLabelPosition = e.valueLabelPosition), e.tooltips !== void 0 && (n.tooltips = e.tooltips), e.crosshair !== void 0 && (n.crosshair = e.crosshair), e.crosshairDirection && (n.crosshairDirection = e.crosshairDirection), e.crosshairStyle && (n.crosshairStyle = e.crosshairStyle), e.crosshairColor && (n.crosshairColor = e.crosshairColor), e.displayAsPercentage !== void 0 && (n.displayAsPercentage = e.displayAsPercentage), e.showTotal !== void 0 && (n.showTotal = e.showTotal), e.showLabels !== void 0 && (n.showLabels = e.showLabels), e.showValues !== void 0 && (n.showValues = e.showValues), e.swapLabelValue !== void 0 && (n.swapLabelValue = e.swapLabelValue);
6708
6721
  let r = parseInt(e.sliceMax ?? "", 10);
@@ -6716,17 +6729,17 @@ function jo(e, t) {
6716
6729
  }
6717
6730
  //#endregion
6718
6731
  //#region src/charts/resolve.ts
6719
- var Mo = Object.create(null);
6720
- function No(e) {
6721
- if (!Mo[e]) {
6732
+ var Po = Object.create(null);
6733
+ function Fo(e) {
6734
+ if (!Po[e]) {
6722
6735
  let t = {};
6723
6736
  for (let n of Xi(e)) n.default !== void 0 && (t[n.key] = n.default);
6724
- Mo[e] = t;
6737
+ Po[e] = t;
6725
6738
  }
6726
- return Mo[e];
6739
+ return Po[e];
6727
6740
  }
6728
- function Po(e, t) {
6729
- let n = No(e);
6741
+ function Io(e, t) {
6742
+ let n = Fo(e);
6730
6743
  return t.colors?.length ? {
6731
6744
  ...n,
6732
6745
  colorPalette: void 0,
@@ -6738,12 +6751,12 @@ function Po(e, t) {
6738
6751
  }
6739
6752
  //#endregion
6740
6753
  //#region src/dsl/grammar.js
6741
- function Fo(e) {
6754
+ function Lo(e) {
6742
6755
  let t = 0;
6743
6756
  for (let n of e) n.type === "data" && t++;
6744
6757
  return t;
6745
6758
  }
6746
- function Io(e) {
6759
+ function Ro(e) {
6747
6760
  let t = {
6748
6761
  properties: [],
6749
6762
  data: null,
@@ -6784,7 +6797,7 @@ function Io(e) {
6784
6797
  }
6785
6798
  return t;
6786
6799
  }
6787
- function Lo(e) {
6800
+ function zo(e) {
6788
6801
  let t = {
6789
6802
  properties: [],
6790
6803
  data: null,
@@ -6821,7 +6834,7 @@ function Lo(e) {
6821
6834
  }
6822
6835
  return t;
6823
6836
  }
6824
- var Ro = class extends SyntaxError {
6837
+ var Bo = class extends SyntaxError {
6825
6838
  constructor(e, t, n, r) {
6826
6839
  super(e), this.expected = t, this.found = n, this.location = r, this.name = "SyntaxError";
6827
6840
  }
@@ -6892,7 +6905,7 @@ var Ro = class extends SyntaxError {
6892
6905
  return "Expected " + l(e) + " but " + u(t) + " found.";
6893
6906
  }
6894
6907
  };
6895
- function zo(e, t) {
6908
+ function Vo(e, t) {
6896
6909
  t = t === void 0 ? {} : t;
6897
6910
  let n = {}, r = t.grammarSource, i = { Chart: jt }, a = jt, o = "chart", s = "data", c = "colorize", l = "highlight", u = "area-fill", d = "annotation", f = "range", p = "note", m = "series", h = "scene", g = "transform", _ = /^[ \t]/, v = /^[^\t\n\r{}=]/, y = /^[a-zA-Z_#]/, b = /^[a-zA-Z0-9_#\-]/, x = /^[0-9]/, S = /^[eE]/, C = /^[+\-]/, w = /^[^"\\]/, T = /^[0-9a-fA-F]/, E = /^[^\n]/, D = /^[ \t\n\r]/, O = St("chart", !1), k = St("{", !1), A = St("}", !1), j = Ct([" ", " "], !1, !1, !1), M = St("data", !1), N = St("=", !1), P = St(",", !1), F = St(" ", !1), I = Ct([
6898
6911
  " ",
@@ -6924,8 +6937,8 @@ function zo(e, t) {
6924
6937
  "\r"
6925
6938
  ], !1, !1, !1), xe = Et("whitespace");
6926
6939
  function Se(e, t) {
6927
- Fo(t) > 1 && bt("duplicate data block — a chart or scene may define at most one data { } block");
6928
- let n = Io(t);
6940
+ Lo(t) > 1 && bt("duplicate data block — a chart or scene may define at most one data { } block");
6941
+ let n = Ro(t);
6929
6942
  return {
6930
6943
  type: "chart",
6931
6944
  chartType: e,
@@ -7077,8 +7090,8 @@ function zo(e, t) {
7077
7090
  bt("series needs a quoted name, e.g. series \"Revenue\" { ... }");
7078
7091
  }
7079
7092
  function qe(e, t) {
7080
- Fo(t) > 1 && bt("duplicate data block — a chart or scene may define at most one data { } block");
7081
- let n = Lo(t);
7093
+ Lo(t) > 1 && bt("duplicate data block — a chart or scene may define at most one data { } block");
7094
+ let n = zo(t);
7082
7095
  return {
7083
7096
  type: "scene",
7084
7097
  name: e ?? null,
@@ -7253,10 +7266,10 @@ function zo(e, t) {
7253
7266
  Y < _t || (Y > _t && (_t = Y, vt = []), vt.push(e));
7254
7267
  }
7255
7268
  function kt(e, t) {
7256
- return new Ro(e, null, null, t);
7269
+ return new Bo(e, null, null, t);
7257
7270
  }
7258
7271
  function At(e, t, n) {
7259
- return new Ro(Ro.buildMessage(e, t), e, t, n);
7272
+ return new Bo(Bo.buildMessage(e, t), e, t, n);
7260
7273
  }
7261
7274
  function jt() {
7262
7275
  let t, r, i, a, s, c, l, u;
@@ -7612,9 +7625,9 @@ function zo(e, t) {
7612
7625
  }
7613
7626
  //#endregion
7614
7627
  //#region src/dsl/parser.ts
7615
- function Bo(e) {
7628
+ function Ho(e) {
7616
7629
  try {
7617
- return zo(e);
7630
+ return Vo(e);
7618
7631
  } catch (e) {
7619
7632
  if (e instanceof Error && "location" in e) {
7620
7633
  let t = e.location, n = /* @__PURE__ */ SyntaxError(`${e.message} at ${t.start.line}:${t.start.column}`);
@@ -7625,21 +7638,21 @@ function Bo(e) {
7625
7638
  }
7626
7639
  //#endregion
7627
7640
  //#region src/dsl/converter.ts
7628
- function Vo(e) {
7641
+ function Uo(e) {
7629
7642
  return new Map(e.map((e) => [e.key, e.value]));
7630
7643
  }
7631
- function Ho(e, t) {
7632
- let n = Vo(t), r = Xi(e), i = new Set(r.map((e) => e.key)), a = {};
7644
+ function Wo(e, t) {
7645
+ let n = Uo(t), r = Xi(e), i = new Set(r.map((e) => e.key)), a = {};
7633
7646
  for (let e of r) {
7634
7647
  let t = n.get(e.key);
7635
7648
  t !== void 0 && i.has(e.key) && (e.type === W.Colors ? a[e.key] = String(t).split(",").map((e) => e.trim()).filter(Boolean) : e.type === W.Boolean ? e.key === "valueLabels" && String(t).toLowerCase() === "percent" ? a[e.key] = "percent" : a[e.key] = t === "true" || t === !0 : a[e.key] = String(t));
7636
7649
  }
7637
7650
  return a;
7638
7651
  }
7639
- function Uo(e) {
7652
+ function Go(e) {
7640
7653
  return !(/^-?\d+(\.\d+)?$/.test(e) || /^-?\d+(\.\d+)?%$/.test(e) || /^[a-zA-Z_][a-zA-Z0-9_-]*$/.test(e));
7641
7654
  }
7642
- function Wo(e) {
7655
+ function Ko(e) {
7643
7656
  return e.entries.map((e) => {
7644
7657
  if (e.values && e.values.length > 1) {
7645
7658
  if (e.key === "series" && !e.quotedKey) return `series = ${e.values.map((e) => `"${e}"`).join(",")}`;
@@ -7647,17 +7660,17 @@ function Wo(e) {
7647
7660
  return `"${e.key}" = ${t}`;
7648
7661
  }
7649
7662
  let t = e.isPercentage ? `${e.value}%` : String(e.value);
7650
- return e.key === "series" && !e.quotedKey ? `series = "${t}"` : typeof e.value == "string" && Uo(t) ? `"${e.key}" = "${t}"` : `"${e.key}" = ${t}`;
7663
+ return e.key === "series" && !e.quotedKey ? `series = "${t}"` : typeof e.value == "string" && Go(t) ? `"${e.key}" = "${t}"` : `"${e.key}" = ${t}`;
7651
7664
  }).join("\n");
7652
7665
  }
7653
- function Go(e, t) {
7654
- let n = Vo(e.properties), r = n.get("type"), i = r ?? t;
7666
+ function qo(e, t) {
7667
+ let n = Uo(e.properties), r = n.get("type"), i = r ?? t;
7655
7668
  return {
7656
7669
  name: e.name,
7657
7670
  chartType: r,
7658
7671
  properties: n,
7659
7672
  data: e.data,
7660
- chartTypeOptions: Ho(i, e.properties),
7673
+ chartTypeOptions: Wo(i, e.properties),
7661
7674
  colorizes: e.colorizes,
7662
7675
  highlights: e.highlights,
7663
7676
  areaFills: e.areaFills,
@@ -7666,32 +7679,32 @@ function Go(e, t) {
7666
7679
  transforms: e.transforms
7667
7680
  };
7668
7681
  }
7669
- function Ko(e, t) {
7682
+ function Jo(e, t) {
7670
7683
  let n = e.find((e) => e.key === t);
7671
7684
  return n ? String(n.value) : void 0;
7672
7685
  }
7673
- function qo(e, t) {
7686
+ function Yo(e, t) {
7674
7687
  let n = e.find((e) => e.key === t);
7675
7688
  if (n) return n.isPercentage, n.value;
7676
7689
  }
7677
- function Jo(e) {
7690
+ function Xo(e) {
7678
7691
  let t = e.find((e) => e.key === "maxWidth");
7679
7692
  if (t) return t.isPercentage ? `${t.value}%` : t.value;
7680
7693
  }
7681
- var Yo = (e) => e === "true" || e === !0;
7682
- function Xo(e) {
7694
+ var Zo = (e) => e === "true" || e === !0;
7695
+ function Qo(e) {
7683
7696
  return e.map((e) => ({
7684
7697
  target: e.target,
7685
- color: Ko(e.properties, "color") ?? "#e15759",
7686
- label: Ko(e.properties, "label")
7698
+ color: Jo(e.properties, "color") ?? "#e15759",
7699
+ label: Jo(e.properties, "label")
7687
7700
  }));
7688
7701
  }
7689
- function Zo(e) {
7702
+ function $o(e) {
7690
7703
  return e.map((e) => ({ target: e.target }));
7691
7704
  }
7692
- function Qo(e) {
7705
+ function es(e) {
7693
7706
  return e.map((e) => {
7694
- let t = Vo(e.properties);
7707
+ let t = Uo(e.properties);
7695
7708
  return {
7696
7709
  from: e.from,
7697
7710
  to: e.to,
@@ -7702,64 +7715,64 @@ function Qo(e) {
7702
7715
  };
7703
7716
  });
7704
7717
  }
7705
- function $o(e) {
7718
+ function ts(e) {
7706
7719
  let t = e.get("repeat");
7707
7720
  if (t === !0 || t === "true") return "always";
7708
7721
  if (t === void 0 || t === !1 || t === "false") return;
7709
7722
  let n = Number(t);
7710
7723
  return Number.isInteger(n) && n >= 1 ? n : void 0;
7711
7724
  }
7712
- function es(e) {
7725
+ function ns(e) {
7713
7726
  return e.map((e) => {
7714
- let t = Vo(e.properties), n = e.kind ?? O.Point;
7727
+ let t = Uo(e.properties), n = e.kind ?? O.Point;
7715
7728
  if (n === O.Range) {
7716
7729
  let e = {
7717
7730
  kind: O.Range,
7718
7731
  start: t.has("start") ? isNaN(Number(t.get("start"))) ? String(t.get("start")) : Number(t.get("start")) : 0,
7719
7732
  end: t.has("end") ? isNaN(Number(t.get("end"))) ? String(t.get("end")) : Number(t.get("end")) : 0
7720
7733
  };
7721
- return e.repeat = $o(t), t.has("orientation") && (e.orientation = String(t.get("orientation"))), t.has("startAnchor") && (e.startAnchor = String(t.get("startAnchor"))), t.has("endAnchor") && (e.endAnchor = String(t.get("endAnchor"))), t.has("bgColor") && (e.bgColor = String(t.get("bgColor"))), t.has("bgOpacity") && (e.bgOpacity = Number(t.get("bgOpacity"))), t.has("direction") && (e.direction = String(t.get("direction"))), t.has("text") && (e.text = String(t.get("text"))), t.has("textColor") && (e.textColor = String(t.get("textColor"))), e;
7734
+ return e.repeat = ts(t), t.has("orientation") && (e.orientation = String(t.get("orientation"))), t.has("startAnchor") && (e.startAnchor = String(t.get("startAnchor"))), t.has("endAnchor") && (e.endAnchor = String(t.get("endAnchor"))), t.has("bgColor") && (e.bgColor = String(t.get("bgColor"))), t.has("bgOpacity") && (e.bgOpacity = Number(t.get("bgOpacity"))), t.has("direction") && (e.direction = String(t.get("direction"))), t.has("text") && (e.text = String(t.get("text"))), t.has("textColor") && (e.textColor = String(t.get("textColor"))), e;
7722
7735
  }
7723
7736
  if (n === O.Free) {
7724
7737
  let n = {
7725
7738
  kind: O.Free,
7726
7739
  text: String(t.get("text") ?? ""),
7727
- x: qo(e.properties, "x") ?? 0,
7728
- y: qo(e.properties, "y") ?? 0
7740
+ x: Yo(e.properties, "x") ?? 0,
7741
+ y: Yo(e.properties, "y") ?? 0
7729
7742
  };
7730
- n.repeat = $o(t), t.has("textColor") && (n.textColor = String(t.get("textColor")));
7731
- let r = Jo(e.properties);
7732
- return r !== void 0 && (n.maxWidth = r), t.has("textOutline") && (n.textOutline = Yo(t.get("textOutline"))), n;
7743
+ n.repeat = ts(t), t.has("textColor") && (n.textColor = String(t.get("textColor")));
7744
+ let r = Xo(e.properties);
7745
+ return r !== void 0 && (n.maxWidth = r), t.has("textOutline") && (n.textOutline = Zo(t.get("textOutline"))), n;
7733
7746
  }
7734
7747
  let r = "target" in e ? e.target : "", i = {
7735
7748
  kind: O.Point,
7736
7749
  target: r,
7737
7750
  text: String(t.get("text") ?? "")
7738
7751
  };
7739
- i.repeat = $o(t), t.has("textColor") && (i.textColor = String(t.get("textColor")));
7740
- let a = Jo(e.properties);
7741
- return a !== void 0 && (i.maxWidth = a), t.has("textOutline") && (i.textOutline = Yo(t.get("textOutline"))), t.has("showLine") && (i.showLine = Yo(t.get("showLine"))), t.has("anchorDirection") && (i.anchorDirection = String(t.get("anchorDirection"))), t.has("textOffsetX") && (i.textOffsetX = Number(t.get("textOffsetX"))), t.has("textOffsetY") && (i.textOffsetY = Number(t.get("textOffsetY"))), t.has("lineStyle") && (i.lineStyle = String(t.get("lineStyle"))), t.has("lineWeight") && (i.lineWeight = Number(t.get("lineWeight"))), t.has("showArrow") && (i.showArrow = Yo(t.get("showArrow"))), t.has("lineTargetDistance") && (i.lineTargetDistance = Number(t.get("lineTargetDistance"))), t.has("showCircle") && (i.showCircle = Yo(t.get("showCircle"))), t.has("circleSize") && (i.circleSize = Number(t.get("circleSize"))), t.has("circleStyle") && (i.circleStyle = String(t.get("circleStyle"))), t.has("circleColor") && (i.circleColor = String(t.get("circleColor"))), i;
7752
+ i.repeat = ts(t), t.has("textColor") && (i.textColor = String(t.get("textColor")));
7753
+ let a = Xo(e.properties);
7754
+ return a !== void 0 && (i.maxWidth = a), t.has("textOutline") && (i.textOutline = Zo(t.get("textOutline"))), t.has("showLine") && (i.showLine = Zo(t.get("showLine"))), t.has("anchorDirection") && (i.anchorDirection = String(t.get("anchorDirection"))), t.has("textOffsetX") && (i.textOffsetX = Number(t.get("textOffsetX"))), t.has("textOffsetY") && (i.textOffsetY = Number(t.get("textOffsetY"))), t.has("lineStyle") && (i.lineStyle = String(t.get("lineStyle"))), t.has("lineWeight") && (i.lineWeight = Number(t.get("lineWeight"))), t.has("showArrow") && (i.showArrow = Zo(t.get("showArrow"))), t.has("lineTargetDistance") && (i.lineTargetDistance = Number(t.get("lineTargetDistance"))), t.has("showCircle") && (i.showCircle = Zo(t.get("showCircle"))), t.has("circleSize") && (i.circleSize = Number(t.get("circleSize"))), t.has("circleStyle") && (i.circleStyle = String(t.get("circleStyle"))), t.has("circleColor") && (i.circleColor = String(t.get("circleColor"))), i;
7742
7755
  });
7743
7756
  }
7744
- function ts(e) {
7757
+ function rs(e) {
7745
7758
  return e.map((e) => {
7746
- let t = Vo(e.properties), n = { name: e.name };
7759
+ let t = Uo(e.properties), n = { name: e.name };
7747
7760
  if (t.has("color") && (n.color = String(t.get("color"))), t.has("lineWidth") && (n.lineWidth = Number(t.get("lineWidth"))), t.has("dash") && (n.dash = String(t.get("dash"))), t.has("interpolation") && (n.interpolation = String(t.get("interpolation"))), t.has("labelMode") && (n.labelMode = String(t.get("labelMode"))), t.has("labelText") && (n.labelText = String(t.get("labelText"))), t.has("valueLabels")) {
7748
7761
  let e = t.get("valueLabels");
7749
- n.valueLabels = String(e).toLowerCase() === "percent" ? "percent" : Yo(e);
7762
+ n.valueLabels = String(e).toLowerCase() === "percent" ? "percent" : Zo(e);
7750
7763
  }
7751
- return t.has("lineSymbols") && (n.lineSymbols = Yo(t.get("lineSymbols"))), t.has("hidden") && (n.hidden = Yo(t.get("hidden"))), t.has("symbolShape") && (n.symbolShape = String(t.get("symbolShape"))), t.has("symbolShowOn") && (n.symbolShowOn = String(t.get("symbolShowOn"))), t.has("symbolStyle") && (n.symbolStyle = String(t.get("symbolStyle"))), t.has("symbolSize") && (n.symbolSize = Number(t.get("symbolSize"))), t.has("symbolOpacity") && (n.symbolOpacity = Number(t.get("symbolOpacity"))), n;
7764
+ return t.has("lineSymbols") && (n.lineSymbols = Zo(t.get("lineSymbols"))), t.has("hidden") && (n.hidden = Zo(t.get("hidden"))), t.has("symbolShape") && (n.symbolShape = String(t.get("symbolShape"))), t.has("symbolShowOn") && (n.symbolShowOn = String(t.get("symbolShowOn"))), t.has("symbolStyle") && (n.symbolStyle = String(t.get("symbolStyle"))), t.has("symbolSize") && (n.symbolSize = Number(t.get("symbolSize"))), t.has("symbolOpacity") && (n.symbolOpacity = Number(t.get("symbolOpacity"))), n;
7752
7765
  });
7753
7766
  }
7754
7767
  //#endregion
7755
7768
  //#region src/render/ast-to-definition.ts
7756
- var ns = /* @__PURE__ */ new Set();
7757
- function rs(e, t, n) {
7769
+ var is = /* @__PURE__ */ new Set();
7770
+ function as(e, t, n) {
7758
7771
  let r = t;
7759
- for (let t of e) t.transformType === "sort" ? r = I.Total : ns.has(t.transformType) || (ns.add(t.transformType), console.warn(`[blueprint-chart] Unknown transform "${t.transformType}" in ${n}; ignored.`));
7772
+ for (let t of e) t.transformType === "sort" ? r = I.Total : is.has(t.transformType) || (is.add(t.transformType), console.warn(`[blueprint-chart] Unknown transform "${t.transformType}" in ${n}; ignored.`));
7760
7773
  return r;
7761
7774
  }
7762
- function is(e) {
7775
+ function os(e) {
7763
7776
  let t = (t) => {
7764
7777
  let n = e.get(t);
7765
7778
  return n == null ? void 0 : String(n) || void 0;
@@ -7775,18 +7788,18 @@ function is(e) {
7775
7788
  };
7776
7789
  return Object.values(r).some((e) => e !== void 0) ? r : void 0;
7777
7790
  }
7778
- function as(e) {
7779
- let t = Vo(e.properties), n = To(e.data ? Wo(e.data) : ""), r = t.get("sort"), i = r == null ? void 0 : String(r), a = i === F.Ascending || i === F.Descending ? i : void 0, o = t.get("theme"), s = t.get("sortMode"), c;
7780
- return (s === I.Total || s === I.WithinGroups || s === I.None) && (c = s), c = rs(e.transforms, c, "chart"), {
7791
+ function ss(e) {
7792
+ let t = Uo(e.properties), n = Do(e.data ? Ko(e.data) : ""), r = t.get("sort"), i = r == null ? void 0 : String(r), a = i === F.Ascending || i === F.Descending ? i : void 0, o = t.get("theme"), s = t.get("sortMode"), c;
7793
+ return (s === I.Total || s === I.WithinGroups || s === I.None) && (c = s), c = as(e.transforms, c, "chart"), {
7781
7794
  chartType: e.chartType,
7782
7795
  data: n,
7783
7796
  properties: e.properties,
7784
- frame: is(t),
7785
- colorizes: Xo(e.colorizes),
7786
- highlights: Zo(e.highlights),
7787
- areaFills: Qo(e.areaFills),
7788
- annotations: es(e.annotations),
7789
- seriesOverrides: ts(e.series),
7797
+ frame: os(t),
7798
+ colorizes: Qo(e.colorizes),
7799
+ highlights: $o(e.highlights),
7800
+ areaFills: es(e.areaFills),
7801
+ annotations: ns(e.annotations),
7802
+ seriesOverrides: rs(e.series),
7790
7803
  scenes: e.scenes,
7791
7804
  sort: a,
7792
7805
  sortMode: c,
@@ -7795,13 +7808,13 @@ function as(e) {
7795
7808
  }
7796
7809
  //#endregion
7797
7810
  //#region src/render/resolve-scene.ts
7798
- var os = /* @__PURE__ */ new Set();
7799
- function ss(e, t, n) {
7811
+ var cs = /* @__PURE__ */ new Set();
7812
+ function ls(e, t, n) {
7800
7813
  let r = t;
7801
- for (let t of e) t.transformType === "sort" ? r = I.Total : os.has(t.transformType) || (os.add(t.transformType), console.warn(`[blueprint-chart] Unknown transform "${t.transformType}" in ${n}; ignored.`));
7814
+ for (let t of e) t.transformType === "sort" ? r = I.Total : cs.has(t.transformType) || (cs.add(t.transformType), console.warn(`[blueprint-chart] Unknown transform "${t.transformType}" in ${n}; ignored.`));
7802
7815
  return r;
7803
7816
  }
7804
- function cs() {
7817
+ function us() {
7805
7818
  return {
7806
7819
  properties: /* @__PURE__ */ new Map(),
7807
7820
  chartTypeOptions: {},
@@ -7812,14 +7825,14 @@ function cs() {
7812
7825
  transforms: []
7813
7826
  };
7814
7827
  }
7815
- function ls(e, t, n) {
7816
- let r = cs();
7828
+ function ds(e, t, n) {
7829
+ let r = us();
7817
7830
  for (let i = 0; i <= t; i++) {
7818
- let a = e[i], o = Vo(a.properties), s = o.get("type");
7831
+ let a = e[i], o = Uo(a.properties), s = o.get("type");
7819
7832
  s && (r.chartType = s);
7820
7833
  let c = r.chartType ?? n;
7821
7834
  a.data && (r.data = a.data);
7822
- let l = Ho(c, a.properties);
7835
+ let l = Wo(c, a.properties);
7823
7836
  r.chartTypeOptions = {
7824
7837
  ...r.chartTypeOptions,
7825
7838
  ...l
@@ -7828,11 +7841,11 @@ function ls(e, t, n) {
7828
7841
  }
7829
7842
  return r;
7830
7843
  }
7831
- function us(e, t, n) {
7844
+ function fs(e, t, n) {
7832
7845
  return n < e ? !1 : t === "always" || n <= e + (typeof t == "number" ? t : 0);
7833
7846
  }
7834
- function ds(e, t) {
7835
- let n = e.options ?? (e.properties ? Po(e.chartType, Ho(e.chartType, e.properties)) : {}), r = {
7847
+ function ps(e, t) {
7848
+ let n = e.options ?? (e.properties ? Io(e.chartType, Wo(e.chartType, e.properties)) : {}), r = {
7836
7849
  chartType: e.chartType,
7837
7850
  data: e.data,
7838
7851
  options: n,
@@ -7850,25 +7863,25 @@ function ds(e, t) {
7850
7863
  theme: e.theme
7851
7864
  };
7852
7865
  if (t == null || !e.scenes || t < 0 || t >= e.scenes.length) return r;
7853
- let i = ls(e.scenes, t, e.chartType), a = i.chartType ?? e.chartType, o = i.data ? To(Wo(i.data)) : r.data, s = Object.keys(i.chartTypeOptions).length > 0 ? Po(a, {
7866
+ let i = ds(e.scenes, t, e.chartType), a = i.chartType ?? e.chartType, o = i.data ? Do(Ko(i.data)) : r.data, s = Object.keys(i.chartTypeOptions).length > 0 ? Io(a, {
7854
7867
  ...n,
7855
7868
  ...i.chartTypeOptions
7856
- }) : n, c = i.colorizes.length > 0 ? Xo(i.colorizes) : i.data ? [] : r.colorizes, l = t == null ? r.highlights : Zo(i.highlights), u = i.areaFills.length > 0 ? Qo(i.areaFills) : r.areaFills, d = (e.annotations ?? []).map((e, t) => ({
7869
+ }) : n, c = i.colorizes.length > 0 ? Qo(i.colorizes) : i.data ? [] : r.colorizes, l = t == null ? r.highlights : $o(i.highlights), u = i.areaFills.length > 0 ? es(i.areaFills) : r.areaFills, d = (e.annotations ?? []).map((e, t) => ({
7857
7870
  anchor: -1,
7858
7871
  key: e.key ?? `base:${t}:${e.kind}`,
7859
7872
  config: e
7860
7873
  }));
7861
- for (let n = 0; n <= t; n++) es(e.scenes[n].annotations).forEach((e, t) => {
7874
+ for (let n = 0; n <= t; n++) ns(e.scenes[n].annotations).forEach((e, t) => {
7862
7875
  d.push({
7863
7876
  anchor: n,
7864
7877
  key: e.key ?? `s${n}:${t}:${e.kind}`,
7865
7878
  config: e
7866
7879
  });
7867
7880
  });
7868
- let f = d.filter(({ anchor: e, config: n }) => us(e, n.repeat, t)).map(({ key: e, config: t }) => ({
7881
+ let f = d.filter(({ anchor: e, config: n }) => fs(e, n.repeat, t)).map(({ key: e, config: t }) => ({
7869
7882
  ...t,
7870
7883
  key: e
7871
- })), p = i.seriesOverrides.length > 0 ? ts(i.seriesOverrides) : r.seriesOverrides, m = ss(i.transforms, r.sortMode, `scene ${t}`), h = [
7884
+ })), p = i.seriesOverrides.length > 0 ? rs(i.seriesOverrides) : r.seriesOverrides, m = ls(i.transforms, r.sortMode, `scene ${t}`), h = [
7872
7885
  "title",
7873
7886
  "description",
7874
7887
  "source",
@@ -7900,52 +7913,52 @@ function ds(e, t) {
7900
7913
  }
7901
7914
  //#endregion
7902
7915
  //#region src/render/layout-constraints.ts
7903
- var fs = /* @__PURE__ */ new WeakMap();
7904
- function ps(e) {
7905
- let t = fs.get(e);
7916
+ var ms = /* @__PURE__ */ new WeakMap();
7917
+ function hs(e) {
7918
+ let t = ms.get(e);
7906
7919
  if (!(!t || t.size === 0)) {
7907
7920
  for (let n of t) e.style[n] = "";
7908
7921
  t.clear();
7909
7922
  }
7910
7923
  }
7911
- function ms(e, t) {
7912
- let n = fs.get(e);
7913
- n || (n = /* @__PURE__ */ new Set(), fs.set(e, n)), n.add(t);
7924
+ function gs(e, t) {
7925
+ let n = ms.get(e);
7926
+ n || (n = /* @__PURE__ */ new Set(), ms.set(e, n)), n.add(t);
7914
7927
  }
7915
- function hs(e, t, n) {
7916
- if (ps(e), n.ignoreLayout || !t) return { constrained: !1 };
7917
- let r = Vo(t), i = r.get("heightMode"), a = r.get("aspectRatio"), o = r.get("fixedHeight"), s = !1;
7928
+ function _s(e, t, n) {
7929
+ if (hs(e), n.ignoreLayout || !t) return { constrained: !1 };
7930
+ let r = Uo(t), i = r.get("heightMode"), a = r.get("aspectRatio"), o = r.get("fixedHeight"), s = !1;
7918
7931
  if (i === "aspect-ratio" && a) {
7919
7932
  let t = String(a).split(":").map(Number);
7920
- t.length === 2 && t[0] > 0 && t[1] > 0 && (e.style.aspectRatio = `${t[0]} / ${t[1]}`, e.style.height = "auto", ms(e, "aspectRatio"), ms(e, "height"), s = !0);
7921
- } else i === "fixed" && o && (e.style.height = `${o}px`, ms(e, "height"), s = !0);
7922
- return s && (e.style.display = "flex", e.style.flexDirection = "column", e.style.overflow = "hidden", ms(e, "display"), ms(e, "flexDirection"), ms(e, "overflow")), { constrained: s };
7933
+ t.length === 2 && t[0] > 0 && t[1] > 0 && (e.style.aspectRatio = `${t[0]} / ${t[1]}`, e.style.height = "auto", gs(e, "aspectRatio"), gs(e, "height"), s = !0);
7934
+ } else i === "fixed" && o && (e.style.height = `${o}px`, gs(e, "height"), s = !0);
7935
+ return s && (e.style.display = "flex", e.style.flexDirection = "column", e.style.overflow = "hidden", gs(e, "display"), gs(e, "flexDirection"), gs(e, "overflow")), { constrained: s };
7923
7936
  }
7924
7937
  //#endregion
7925
7938
  //#region src/render/cross-type-fade.ts
7926
- var gs = /* @__PURE__ */ new WeakMap();
7927
- function _s(e) {
7939
+ var vs = /* @__PURE__ */ new WeakMap();
7940
+ function ys(e) {
7928
7941
  e.querySelectorAll("[data-bc-fade-overlay]").forEach((e) => {
7929
7942
  typeof e.getAnimations == "function" && e.getAnimations().forEach((e) => e.cancel()), e.remove();
7930
7943
  });
7931
7944
  }
7932
- function vs(e, t, n) {
7945
+ function bs(e, t, n) {
7933
7946
  if (!n) return null;
7934
- let r = gs.get(e);
7935
- return !r || r === t ? null : (_s(e), He(e));
7947
+ let r = vs.get(e);
7948
+ return !r || r === t ? null : (ys(e), He(e));
7936
7949
  }
7937
- function ys(e, t, n) {
7938
- if (gs.set(e, t), n) {
7950
+ function xs(e, t, n) {
7951
+ if (vs.set(e, t), n) {
7939
7952
  let t = e.querySelector(".bc-frame .bc-frame-body");
7940
7953
  t && Ve(t), Ue(e, n);
7941
7954
  }
7942
7955
  }
7943
- function bs(e) {
7944
- gs.delete(e), _s(e);
7956
+ function Ss(e) {
7957
+ vs.delete(e), ys(e);
7945
7958
  }
7946
7959
  //#endregion
7947
7960
  //#region src/render/post-render.ts
7948
- function xs(e, t, n) {
7961
+ function Cs(e, t, n) {
7949
7962
  let r = e.querySelector(".bc-frame");
7950
7963
  if (!r) return;
7951
7964
  let i = [];
@@ -7957,9 +7970,9 @@ function xs(e, t, n) {
7957
7970
  }
7958
7971
  //#endregion
7959
7972
  //#region src/render/render-chart.ts
7960
- function Ss(e, t, n = {}) {
7961
- if (n.transition || (zn(e).interrupt(), e.replaceChildren(), bs(e)), t.data.labels.length === 0) {
7962
- n.transition && (zn(e).interrupt(), e.replaceChildren(), bs(e));
7973
+ function ws(e, t, n = {}) {
7974
+ if (n.transition || (zn(e).interrupt(), e.replaceChildren(), Ss(e)), t.data.labels.length === 0) {
7975
+ n.transition && (zn(e).interrupt(), e.replaceChildren(), Ss(e));
7963
7976
  return;
7964
7977
  }
7965
7978
  let r = t;
@@ -7971,11 +7984,11 @@ function Ss(e, t, n = {}) {
7971
7984
  }
7972
7985
  r = e;
7973
7986
  }
7974
- let i = hs(e, r.properties, n), a = ds(r, n.sceneIndex), o = Yi(a.chartType);
7987
+ let i = _s(e, r.properties, n), a = ps(r, n.sceneIndex), o = Yi(a.chartType);
7975
7988
  if (!o) return;
7976
- let s = vs(e, a.chartType, !!n.transition);
7989
+ let s = bs(e, a.chartType, !!n.transition);
7977
7990
  s && e.replaceChildren();
7978
- let c = pe(e), l = jo(a.options, c), u;
7991
+ let c = pe(e), l = No(a.options, c), u;
7979
7992
  if (n.thumbnail) u = null;
7980
7993
  else {
7981
7994
  let e = a.frame?.padding ?? n.padding ?? "16px";
@@ -7998,31 +8011,31 @@ function Ss(e, t, n = {}) {
7998
8011
  }, !!n.transition), n.transition && d.commit({
7999
8012
  duration: Be(),
8000
8013
  mode: n.transitionMode
8001
- }), xs(e, { theme: n.theme ?? a.theme }, i), ys(e, a.chartType, s);
8014
+ }), Cs(e, { theme: n.theme ?? a.theme }, i), xs(e, a.chartType, s);
8002
8015
  }
8003
8016
  //#endregion
8004
8017
  //#region src/render/render-bpc.ts
8005
- function Cs(e, t, n) {
8018
+ function Ts(e, t, n) {
8006
8019
  let r = document.createElement("div");
8007
8020
  r.style.cssText = "color: #888; font-family: monospace; padding: 0.75rem; white-space: pre-wrap;", r.textContent = `Blueprint Chart: ${t}\n${n}`, e.replaceChildren(r);
8008
8021
  }
8009
- function ws(e, t, n) {
8022
+ function Es(e, t, n) {
8010
8023
  if (!t) {
8011
8024
  n?.transition || e.replaceChildren();
8012
8025
  return;
8013
8026
  }
8014
8027
  let r;
8015
8028
  try {
8016
- r = Bo(t);
8029
+ r = Ho(t);
8017
8030
  } catch (t) {
8018
- Cs(e, "could not parse chart", t instanceof Error ? t.message : String(t));
8031
+ Ts(e, "could not parse chart", t instanceof Error ? t.message : String(t));
8019
8032
  return;
8020
8033
  }
8021
8034
  try {
8022
- Ss(e, as(r), n);
8035
+ ws(e, ss(r), n);
8023
8036
  } catch (t) {
8024
- Cs(e, "could not render chart", t instanceof Error ? t.message : String(t));
8037
+ Ts(e, "could not render chart", t instanceof Error ? t.message : String(t));
8025
8038
  }
8026
8039
  }
8027
8040
  //#endregion
8028
- export { v as $, Fn as A, Ve as B, Br as C, P as Ct, Wn as D, Zn as E, Ot as F, pe as G, He as H, Tt as I, re as J, ue as K, yt as L, At as M, jt as N, Vn as O, Q as P, E as Q, qe as R, Ji as S, N as St, zr as T, z as Tt, Ie as U, Le as V, ve as W, R as X, k as Y, O as Z, jo as _, F as _t, es as a, G as at, Xi as b, D as bt, Zo as c, b as ct, Ho as d, S as dt, W as et, Go as f, L as ft, Po as g, y as gt, No as h, A as ht, as as i, V as it, On as j, zn as k, ts as l, K as lt, Bo as m, j as mt, Ss as n, T as nt, Qo as o, q as ot, Vo as p, U as pt, de as q, ds as r, B as rt, Xo as s, w as st, ws as t, _ as tt, Wo as u, x as ut, To as v, I as vt, Ir as w, C as wt, Zi as x, M as xt, Yi as y, H as yt, Ue as z };
8041
+ export { E as $, zn as A, Ue as B, Ji as C, N as Ct, Zn as D, zr as E, z as Et, Q as F, ve as G, Le as H, Ot as I, de as J, pe as K, Tt as L, On as M, At as N, Wn as O, jt as P, O as Q, yt as R, Zi as S, M as St, Ir as T, C as Tt, He as U, Ve as V, Ie as W, k as X, re as Y, R as Z, No as _, y as _t, ns as a, V as at, Yi as b, H as bt, $o as c, w as ct, Wo as d, x as dt, v as et, qo as f, S as ft, Io as g, A as gt, Fo as h, j as ht, ss as i, B as it, Fn as j, Vn as k, rs as l, b as lt, Ho as m, U as mt, ws as n, _ as nt, es as o, G as ot, Uo as p, L as pt, ue as q, ps as r, T as rt, Qo as s, q as st, Es as t, W as tt, Ko as u, K as ut, Do as v, F as vt, Br as w, P as wt, Xi as x, D as xt, wo as y, I as yt, qe as z };