@blueprint-chart/lib 2.5.0 → 2.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,8 +1,8 @@
1
- import { $ as e, A as t, At as n, B as r, Bt as i, C as a, Ct as o, D as s, Dt as c, E as l, Et as u, F as d, Ft as f, G as p, Gt as m, H as h, Ht as g, I as _, It as v, J as y, Jt as ee, K as te, Kt as ne, L as re, Lt as ie, M as ae, Mt as oe, N as se, Nt as ce, O as le, Ot as ue, P as b, Pt as de, Q as fe, R as pe, Rt as me, S as he, St as ge, T as _e, Tt as ve, U as x, Ut as ye, V as be, Vt as xe, W as Se, Wt as Ce, X as we, Xt as Te, Y as Ee, Yt as De, Z as Oe, Zt as ke, _ as Ae, _t as je, a as Me, at as Ne, b as Pe, bt as S, c as Fe, ct as Ie, d as Le, dt as Re, et as ze, f as Be, ft as Ve, g as He, gt as Ue, h as We, ht as Ge, i as Ke, it as qe, j as Je, jt as Ye, k as Xe, kt as Ze, l as Qe, lt as $e, m as et, mt as tt, n as nt, nt as rt, o as it, ot as at, p as ot, pt as st, q as ct, qt as lt, r as ut, rt as dt, s as ft, st as pt, t as mt, tt as ht, u as gt, ut as _t, v as vt, vt as yt, w as bt, wt as xt, x as St, xt as Ct, y as wt, yt as Tt, z as C, zt as Et } from "./render-bpc-BnD9HqZ-.js";
2
- import { t as Dt } from "./runtime-gzeMNwqx.js";
3
- import w from "chroma-js";
1
+ import { $ as e, $t as t, A as n, At as r, B as i, Bt as a, C as o, Ct as s, D as c, Dt as l, E as u, Et as d, F as f, Ft as p, G as m, Gt as h, H as g, Ht as ee, I as _, It as v, J as y, Jt as te, K as ne, Kt as re, L as ie, Lt as ae, M as b, Mt as oe, N as se, Nt as ce, O as le, Ot as ue, P as x, Pt as de, Q as fe, Qt as pe, R as me, Rt as he, S as ge, St as _e, T as ve, Tt as ye, U as S, Ut as be, V as xe, Vt as Se, W as Ce, Wt as we, X as C, Xt as Te, Y as Ee, Yt as De, Z as Oe, Zt as ke, _ as Ae, _t as je, a as Me, at as Ne, b as Pe, bt as Fe, c as Ie, ct as Le, d as Re, dt as ze, en as Be, et as Ve, f as He, ft as Ue, g as We, gt as Ge, h as Ke, ht as qe, i as Je, it as Ye, j as Xe, jt as Ze, k as Qe, kt as $e, l as et, lt as tt, m as nt, mt as rt, n as it, nn as at, nt as ot, o as st, ot as ct, p as lt, pt as ut, q as dt, qt as ft, r as pt, rn as mt, rt as ht, s as gt, st as _t, t as vt, tn as yt, tt as bt, u as xt, ut as St, v as Ct, vt as wt, w as Tt, wt as Et, x as Dt, xt as Ot, y as kt, yt as At, z as w, zt as jt } from "./render-bpc-B8L42qjL.js";
2
+ import { t as Mt } from "./runtime-gzeMNwqx.js";
3
+ import T from "chroma-js";
4
4
  //#region src/recommendations/intent.ts
5
- var Ot = [
5
+ var Nt = [
6
6
  {
7
7
  intent: "range",
8
8
  pattern: /\b(range|high and low|high\/low|margin of error|confidence interval|confidence|interval|plus or minus|spread between)\b/i
@@ -19,6 +19,10 @@ var Ot = [
19
19
  intent: "ranking",
20
20
  pattern: /\b(rank|ranked|ranking|top \d+|most|largest|biggest|highest|leading|fewest|smallest)\b/i
21
21
  },
22
+ {
23
+ intent: "relationship",
24
+ pattern: /\b(correlat\w*|relationship|against|related to|tends? to|associated with)\b/i
25
+ },
22
26
  {
23
27
  intent: "trend",
24
28
  pattern: /\b(over time|trend|grew|rose|fell|climbed|declined|increased?|decreased?|change over|year[- ]over[- ]year|overtak\w*|overtook|surpass\w*|crossover|diverg\w*)\b/i
@@ -28,92 +32,97 @@ var Ot = [
28
32
  pattern: /\b(compares?|compared|comparison|versus|vs\.?|more than|difference between|across|than)\b/i
29
33
  }
30
34
  ];
31
- function T(e) {
35
+ function E(e) {
32
36
  if (e === void 0 || e.trim() === "") return "none";
33
- for (let t of Ot) if (t.pattern.test(e)) return t.intent;
37
+ for (let t of Nt) if (t.pattern.test(e)) return t.intent;
34
38
  return "none";
35
39
  }
36
40
  //#endregion
37
41
  //#region src/recommendations/decisionTable.ts
38
- var E = (e, t, n) => ({
42
+ var D = (e, t, n) => ({
39
43
  type: e,
40
44
  fitness: t,
41
45
  reason: n
42
- }), D = {
46
+ }), O = {
43
47
  "1cat+1num": {
44
48
  none: (e) => {
45
- let t = [E("bar-vertical", "best", "1 categorical + 1 numeric — classic bar chart"), E("bar-horizontal", "good", "Horizontal bars work well for long labels")];
46
- return e <= 8 && (t.push(E("donut", "good", `${e} items — suitable for part-of-whole`)), t.push(E("pie", "alternative", "Pie chart for part-of-whole"))), t;
49
+ let t = [D("bar-vertical", "best", "1 categorical + 1 numeric — classic bar chart"), D("bar-horizontal", "good", "Horizontal bars work well for long labels")];
50
+ return e <= 8 && (t.push(D("donut", "good", `${e} items — suitable for part-of-whole`)), t.push(D("pie", "alternative", "Pie chart for part-of-whole"))), t;
47
51
  },
48
- comparison: (e) => D["1cat+1num"].none(e),
49
- ranking: () => [E("bar-horizontal", "best", "Ranked categories read best as horizontal bars"), E("bar-vertical", "good", "Vertical bars also work for ranking")],
52
+ comparison: (e) => O["1cat+1num"].none(e),
53
+ ranking: () => [D("bar-horizontal", "best", "Ranked categories read best as horizontal bars"), D("bar-vertical", "good", "Vertical bars also work for ranking")],
50
54
  "part-to-whole": (e) => e <= 5 ? [
51
- E("pie", "best", `${e} slices — pie reads cleanly for very small N`),
52
- E("donut", "good", "Donut for part-of-whole with a center label"),
53
- E("bar-vertical", "alternative", "Bars if precise comparison matters")
55
+ D("pie", "best", `${e} slices — pie reads cleanly for very small N`),
56
+ D("donut", "good", "Donut for part-of-whole with a center label"),
57
+ D("bar-vertical", "alternative", "Bars if precise comparison matters")
54
58
  ] : e <= 8 ? [
55
- E("donut", "best", `${e} slices — donut for part-of-whole`),
56
- E("pie", "good", "Pie for part-of-whole"),
57
- E("bar-vertical", "alternative", "Bars if precise comparison matters")
58
- ] : [E("bar-vertical", "best", `${e} categories — too many for a readable pie`), E("bar-horizontal", "good", "Horizontal bars for long labels")],
59
- range: () => [E("bar-vertical", "best", "A single numeric column carries no range — plain bars read the value directly"), E("bar-horizontal", "good", "Horizontal bars work well for long labels")]
59
+ D("donut", "best", `${e} slices — donut for part-of-whole`),
60
+ D("pie", "good", "Pie for part-of-whole"),
61
+ D("bar-vertical", "alternative", "Bars if precise comparison matters")
62
+ ] : [D("bar-vertical", "best", `${e} categories — too many for a readable pie`), D("bar-horizontal", "good", "Horizontal bars for long labels")],
63
+ range: () => [D("bar-vertical", "best", "A single numeric column carries no range — plain bars read the value directly"), D("bar-horizontal", "good", "Horizontal bars work well for long labels")]
60
64
  },
61
65
  "1cat+Nnum": {
62
- none: () => [E("bar-multi", "best", "1 categorical + multiple numeric columns — compare groups"), E("line-multi", "good", "Can also show as a multi-line chart")],
63
- comparison: (e) => D["1cat+Nnum"].none(e),
64
- ranking: (e) => D["1cat+Nnum"].none(e),
65
- trend: () => [E("line-multi", "best", "A trend or crossover story reads best as lines, even over categorical periods"), E("bar-multi", "alternative", "Grouped bars if per-period comparison matters more than the trend")],
66
+ none: () => [D("bar-multi", "best", "1 categorical + multiple numeric columns — compare groups"), D("line-multi", "good", "Can also show as a multi-line chart")],
67
+ comparison: (e) => O["1cat+Nnum"].none(e),
68
+ ranking: (e) => O["1cat+Nnum"].none(e),
69
+ trend: () => [D("line-multi", "best", "A trend or crossover story reads best as lines, even over categorical periods"), D("bar-multi", "alternative", "Grouped bars if per-period comparison matters more than the trend")],
66
70
  "part-to-whole": () => [
67
- E("bar-stacked", "best", "Stacked bars show composition within each category"),
68
- E("column-stacked", "good", "Stacked columns for the same composition"),
69
- E("bar-multi", "alternative", "Grouped bars if comparison beats composition")
71
+ D("bar-stacked", "best", "Stacked bars show composition within each category"),
72
+ D("column-stacked", "good", "Stacked columns for the same composition"),
73
+ D("bar-multi", "alternative", "Grouped bars if comparison beats composition")
70
74
  ],
71
75
  "composition-over-time": () => [
72
- E("column-stacked", "best", "Stacked columns show composition across discrete periods"),
73
- E("bar-stacked", "good", "Stacked bars for the same composition"),
74
- E("area-stacked", "alternative", "Stacked area if the periods are continuous time")
76
+ D("column-stacked", "best", "Stacked columns show composition across discrete periods"),
77
+ D("bar-stacked", "good", "Stacked bars for the same composition"),
78
+ D("area-stacked", "alternative", "Stacked area if the periods are continuous time")
75
79
  ],
76
- range: () => [E("bar-split", "best", "Diverging bars show values around a shared baseline"), E("bar-multi", "alternative", "Grouped bars if there is no shared baseline")]
80
+ relationship: () => [D("scatter", "best", "Two numeric columns per item — a scatter plot shows how they move together"), D("line-multi", "alternative", "Lines if the categories have a natural order")],
81
+ range: () => [D("bar-split", "best", "Diverging bars show values around a shared baseline"), D("bar-multi", "alternative", "Grouped bars if there is no shared baseline")]
82
+ },
83
+ "1cat+text+Nnum": {
84
+ none: () => [D("scatter", "best", "A label, a text column and several numbers — plot one number against another"), D("bar-multi", "alternative", "Grouped bars if comparing values per row matters more")],
85
+ relationship: (e) => O["1cat+text+Nnum"].none(e)
77
86
  },
78
87
  "1date+1num": {
79
- none: () => [E("line", "best", "1 date + 1 numeric column — ideal for trend"), E("bar-vertical", "alternative", "Can also show as bars")],
88
+ none: () => [D("line", "best", "1 date + 1 numeric column — ideal for trend"), D("bar-vertical", "alternative", "Can also show as bars")],
80
89
  trend: () => [
81
- E("line", "best", "1 date + 1 numeric column — ideal for trend"),
82
- E("area", "good", "Filled area emphasizes magnitude over time"),
83
- E("bar-vertical", "alternative", "Can also show as bars")
90
+ D("line", "best", "1 date + 1 numeric column — ideal for trend"),
91
+ D("area", "good", "Filled area emphasizes magnitude over time"),
92
+ D("bar-vertical", "alternative", "Can also show as bars")
84
93
  ],
85
- comparison: () => [E("bar-vertical", "best", "Bars for comparing discrete time points"), E("line", "good", "Line if the trend matters more than the comparison")],
86
- ranking: () => [E("bar-vertical", "best", "Bars for ranking discrete time points"), E("line", "good", "Line for the underlying trend")],
87
- "part-to-whole": () => [E("area", "best", "Filled area reads as magnitude/share over time"), E("line", "good", "Line for the underlying trend")],
88
- "composition-over-time": () => [E("area", "best", "Filled area shows magnitude over time"), E("line", "good", "Line for the underlying trend")]
94
+ comparison: () => [D("bar-vertical", "best", "Bars for comparing discrete time points"), D("line", "good", "Line if the trend matters more than the comparison")],
95
+ ranking: () => [D("bar-vertical", "best", "Bars for ranking discrete time points"), D("line", "good", "Line for the underlying trend")],
96
+ "part-to-whole": () => [D("area", "best", "Filled area reads as magnitude/share over time"), D("line", "good", "Line for the underlying trend")],
97
+ "composition-over-time": () => [D("area", "best", "Filled area shows magnitude over time"), D("line", "good", "Line for the underlying trend")]
89
98
  },
90
99
  "1date+Nnum": {
91
- none: () => [E("line-multi", "best", "1 date + multiple numeric columns — compare trends"), E("bar-multi", "alternative", "Can also show as grouped bars")],
92
- trend: (e) => D["1date+Nnum"].none(e),
93
- comparison: (e) => D["1date+Nnum"].none(e),
94
- ranking: (e) => D["1date+Nnum"].none(e),
100
+ none: () => [D("line-multi", "best", "1 date + multiple numeric columns — compare trends"), D("bar-multi", "alternative", "Can also show as grouped bars")],
101
+ trend: (e) => O["1date+Nnum"].none(e),
102
+ comparison: (e) => O["1date+Nnum"].none(e),
103
+ ranking: (e) => O["1date+Nnum"].none(e),
95
104
  "composition-over-time": () => [
96
- E("area-stacked", "best", "Stacked area shows composition over continuous time"),
97
- E("column-stacked", "good", "Stacked columns for the same composition"),
98
- E("line-multi", "alternative", "Multi-line if composition is not the point")
105
+ D("area-stacked", "best", "Stacked area shows composition over continuous time"),
106
+ D("column-stacked", "good", "Stacked columns for the same composition"),
107
+ D("line-multi", "alternative", "Multi-line if composition is not the point")
99
108
  ],
100
- "part-to-whole": () => [E("area-stacked", "best", "Stacked area shows share over time"), E("line-multi", "good", "Multi-line if absolute trends matter more")]
109
+ "part-to-whole": () => [D("area-stacked", "best", "Stacked area shows share over time"), D("line-multi", "good", "Multi-line if absolute trends matter more")]
101
110
  },
102
- other: { none: () => [E("bar-vertical", "good", "Default bar chart recommendation")] }
111
+ other: { none: () => [D("bar-vertical", "good", "Default bar chart recommendation")] }
103
112
  };
104
- function kt(e, t, n) {
105
- let r = D[e], i = r[t] ?? r.none;
106
- return i ? i(n) : [E("bar-vertical", "good", "Default bar chart recommendation")];
113
+ function Pt(e, t, n) {
114
+ let r = O[e], i = r[t] ?? r.none;
115
+ return i ? i(n) : [D("bar-vertical", "good", "Default bar chart recommendation")];
107
116
  }
108
117
  //#endregion
109
118
  //#region src/recommendations/shape.ts
110
- function O(e, t) {
111
- let n = e.filter((e) => e === "string").length, r = e.filter((e) => e === "number").length, i = e.filter((e) => e === "date").length;
112
- return i === 1 && n === 0 && r >= 1 ? r === 1 ? "1date+1num" : "1date+Nnum" : n === 1 && i === 0 && r >= 1 ? r === 1 ? "1cat+1num" : "1cat+Nnum" : "other";
119
+ function Ft(e, t) {
120
+ let n = e[0] === "date", r = e.filter((e) => e === "string").length, i = n ? e.filter((e) => e === "date").length : 0, a = e.filter((e) => e === "number" || e === "date" && !n).length;
121
+ return i === 1 && r === 0 && a >= 1 ? a === 1 ? "1date+1num" : "1date+Nnum" : r === 1 && i === 0 && a >= 1 ? a === 1 ? "1cat+1num" : "1cat+Nnum" : e[0] === "string" && i === 0 && r >= 2 && a >= 2 ? "1cat+text+Nnum" : "other";
113
122
  }
114
123
  //#endregion
115
124
  //#region src/recommendations/types.ts
116
- var At = {
125
+ var It = {
117
126
  "bar-vertical": "Vertical Bar Chart",
118
127
  "bar-horizontal": "Horizontal Bar Chart",
119
128
  "bar-multi": "Grouped Bar Chart",
@@ -126,21 +135,22 @@ var At = {
126
135
  area: "Area Chart",
127
136
  "area-stacked": "Stacked Area Chart",
128
137
  pie: "Pie Chart",
129
- donut: "Donut Chart"
138
+ donut: "Donut Chart",
139
+ scatter: "Scatter Plot"
130
140
  };
131
141
  //#endregion
132
142
  //#region src/recommendations/recommend.ts
133
- function jt(e, t, n) {
134
- return e.length === 0 ? [] : kt(O(e, t), T(n), t).map((e) => ({
143
+ function Lt(e, t, n) {
144
+ return e.length === 0 ? [] : Pt(Ft(e, t), E(n), t).map((e) => ({
135
145
  chartType: e.type,
136
- label: At[e.type] ?? e.type,
146
+ label: It[e.type] ?? e.type,
137
147
  fitness: e.fitness,
138
148
  reason: e.reason
139
149
  }));
140
150
  }
141
151
  //#endregion
142
152
  //#region src/charts/themes/index.ts
143
- var Mt = [
153
+ var Rt = [
144
154
  {
145
155
  name: "blueprint",
146
156
  label: "Blueprint",
@@ -157,16 +167,16 @@ var Mt = [
157
167
  description: "Charts on the blueprint canvas with the full brand palette"
158
168
  }
159
169
  ];
160
- function Nt() {
161
- return Mt;
170
+ function zt() {
171
+ return Rt;
162
172
  }
163
173
  //#endregion
164
174
  //#region src/charts/colorblind.ts
165
- var Pt = {
175
+ var Bt = {
166
176
  protanopia: "Protanopia (no red)",
167
177
  deuteranopia: "Deuteranopia (no green)",
168
178
  tritanopia: "Tritanopia (no blue)"
169
- }, Ft = {
179
+ }, Vt = {
170
180
  protanopia: [
171
181
  .152286,
172
182
  1.052583,
@@ -234,27 +244,27 @@ var Pt = {
234
244
  0
235
245
  ]
236
246
  };
237
- function It(e) {
247
+ function Ht(e) {
238
248
  return `bc-cvd-${e}`;
239
249
  }
240
- function Lt(e) {
250
+ function Ut(e) {
241
251
  let t = "http://www.w3.org/2000/svg", n = document.createElementNS(t, "filter");
242
- n.setAttribute("id", It(e)), n.setAttribute("color-interpolation-filters", "linearRGB");
252
+ n.setAttribute("id", Ht(e)), n.setAttribute("color-interpolation-filters", "linearRGB");
243
253
  let r = document.createElementNS(t, "feColorMatrix");
244
- return r.setAttribute("type", "matrix"), r.setAttribute("values", Ft[e].join(" ")), n.appendChild(r), n;
254
+ return r.setAttribute("type", "matrix"), r.setAttribute("values", Vt[e].join(" ")), n.appendChild(r), n;
245
255
  }
246
- function Rt(e) {
256
+ function Wt(e) {
247
257
  return e <= .04045 ? e / 12.92 : ((e + .055) / 1.055) ** 2.4;
248
258
  }
249
259
  function k(e) {
250
260
  return e <= .0031308 ? 12.92 * e : 1.055 * e ** (1 / 2.4) - .055;
251
261
  }
252
- function zt(e, t) {
253
- let [n, r, i] = (w.valid(e) ? w(e) : w("#000")).rgb().map((e) => Rt(e / 255)), a = Ft[t], o = k(a[0] * n + a[1] * r + a[2] * i), s = k(a[5] * n + a[6] * r + a[7] * i), c = k(a[10] * n + a[11] * r + a[12] * i), l = (e) => Math.min(255, Math.max(0, Math.round(e * 255)));
254
- return w(l(o), l(s), l(c)).hex();
262
+ function Gt(e, t) {
263
+ let [n, r, i] = (T.valid(e) ? T(e) : T("#000")).rgb().map((e) => Wt(e / 255)), a = Vt[t], o = k(a[0] * n + a[1] * r + a[2] * i), s = k(a[5] * n + a[6] * r + a[7] * i), c = k(a[10] * n + a[11] * r + a[12] * i), l = (e) => Math.min(255, Math.max(0, Math.round(e * 255)));
264
+ return T(l(o), l(s), l(c)).hex();
255
265
  }
256
- var Bt = 10;
257
- function Vt(e) {
266
+ var Kt = 10;
267
+ function qt(e) {
258
268
  if (e.length < 2) return [];
259
269
  let t = [
260
270
  "protanopia",
@@ -262,10 +272,10 @@ function Vt(e) {
262
272
  "tritanopia"
263
273
  ], n = [];
264
274
  for (let r of t) {
265
- let t = e.map((e) => zt(e, r)), i = [];
275
+ let t = e.map((e) => Gt(e, r)), i = [];
266
276
  for (let n = 0; n < t.length; n++) for (let r = n + 1; r < t.length; r++) {
267
- let a = w.deltaE(t[n], t[r]);
268
- a < Bt && i.push({
277
+ let a = T.deltaE(t[n], t[r]);
278
+ a < Kt && i.push({
269
279
  a: e[n],
270
280
  b: e[r],
271
281
  deltaE: a
@@ -273,7 +283,7 @@ function Vt(e) {
273
283
  }
274
284
  i.length > 0 && n.push({
275
285
  type: r,
276
- label: Pt[r],
286
+ label: Bt[r],
277
287
  pairs: i
278
288
  });
279
289
  }
@@ -291,152 +301,251 @@ function M(e, t) {
291
301
  return [...A(e.trailingComments, `${t} `), j(`${t}}`, e.trailingComment)];
292
302
  }
293
303
  function N(e) {
294
- return typeof e.value == "number" ? e.isPercentage ? `${e.value}%` : `${e.value}` : typeof e.value == "string" && e.value.startsWith("#") ? C(e.value) : typeof e.value == "string" && /^[a-zA-Z_][a-zA-Z0-9_-]*$/.test(e.value) ? e.value : C(String(e.value));
304
+ return typeof e.value == "number" ? e.isPercentage ? `${e.value}%` : `${e.value}` : typeof e.value == "string" && e.value.startsWith("#") ? w(e.value) : typeof e.value == "string" && /^[a-zA-Z_][a-zA-Z0-9_-]*$/.test(e.value) ? e.value : w(String(e.value));
295
305
  }
296
- function Ht(e) {
297
- return /^[a-zA-Z_][a-zA-Z0-9_-]*$/.test(e) ? e : C(e);
306
+ function P(e) {
307
+ return /^[a-zA-Z_][a-zA-Z0-9_-]*$/.test(e) ? e : w(e);
298
308
  }
299
- function P(e, t) {
300
- let n = j(`${t}${Ht(e.key)} = ${N(e)}`, e.trailingComment);
309
+ function F(e, t) {
310
+ let n = j(`${t}${P(e.key)} = ${N(e)}`, e.trailingComment);
301
311
  return [...A(e.leadingComments, t), n].join("\n");
302
312
  }
303
- function Ut(e, t) {
313
+ function Jt(e, t) {
304
314
  let n;
305
- return n = e.key === "series" && e.quotedKey && !(e.values && e.values.length > 1) ? `${t}"series" = ${N(e)}` : e.values && e.values.length > 1 ? `${t}${e.key === "series" && !e.quotedKey ? e.key : C(e.key)} = ${e.values.map((e) => typeof e == "number" ? `${e}` : C(String(e))).join(",")}` : `${t}${Ht(e.key)} = ${N(e)}`, [...A(e.leadingComments, t), j(n, e.trailingComment)].join("\n");
315
+ return n = e.key === "series" && e.quotedKey && !(e.values && e.values.length > 1) ? `${t}"series" = ${N(e)}` : e.values && e.values.length > 1 ? `${t}${e.key === "series" && !e.quotedKey ? e.key : w(e.key)} = ${e.values.map((e) => typeof e == "number" ? `${e}` : w(String(e))).join(",")}` : `${t}${P(e.key)} = ${N(e)}`, [...A(e.leadingComments, t), j(n, e.trailingComment)].join("\n");
306
316
  }
307
- function F(e, t) {
317
+ function I(e, t) {
308
318
  let n = [...A(e.leadingComments, t), `${t}data {`];
309
- for (let r of e.entries) n.push(Ut(r, `${t} `));
319
+ for (let r of e.entries) n.push(Jt(r, `${t} `));
310
320
  return n.push(...M(e, t)), n.join("\n");
311
321
  }
312
- function I(e, t) {
313
- let n = e.fromHighlight ? "highlight" : "colorize", r = [...A(e.leadingComments, t), `${t}${n} ${C(e.target)} {`];
314
- for (let n of e.properties) r.push(P(n, `${t} `));
315
- return r.push(...M(e, t)), r.join("\n");
316
- }
317
322
  function L(e, t) {
318
- return [...A(e.leadingComments, t), j(`${t}highlight ${C(e.target)}`, e.trailingComment)].join("\n");
323
+ let n = e.fromHighlight ? "highlight" : "colorize", r = [...A(e.leadingComments, t), `${t}${n} ${w(e.target)} {`];
324
+ for (let n of e.properties) r.push(F(n, `${t} `));
325
+ return r.push(...M(e, t)), r.join("\n");
319
326
  }
320
327
  function R(e, t) {
321
- let n = [...A(e.leadingComments, t), `${t}area-fill ${C(e.from)} ${C(e.to)} {`];
322
- for (let r of e.properties) n.push(P(r, `${t} `));
323
- return n.push(...M(e, t)), n.join("\n");
328
+ return [...A(e.leadingComments, t), j(`${t}highlight ${w(e.target)}`, e.trailingComment)].join("\n");
324
329
  }
325
330
  function z(e, t) {
326
- let n = e.kind ?? S.Point;
327
- if (n === S.Range) {
331
+ let n = [...A(e.leadingComments, t), `${t}area-fill ${w(e.from)} ${w(e.to)} {`];
332
+ for (let r of e.properties) n.push(F(r, `${t} `));
333
+ return n.push(...M(e, t)), n.join("\n");
334
+ }
335
+ function B(e, t) {
336
+ let n = e.kind ?? d.Point;
337
+ if (n === d.Range) {
328
338
  let n = [...A(e.leadingComments, t), `${t}range {`];
329
- for (let r of e.properties) n.push(P(r, `${t} `));
339
+ for (let r of e.properties) n.push(F(r, `${t} `));
330
340
  return n.push(...M(e, t)), n.join("\n");
331
341
  }
332
- if (n === S.Free) {
342
+ if (n === d.Free) {
333
343
  let n = [...A(e.leadingComments, t), `${t}note {`];
334
- for (let r of e.properties) n.push(P(r, `${t} `));
344
+ for (let r of e.properties) n.push(F(r, `${t} `));
335
345
  return n.push(...M(e, t)), n.join("\n");
336
346
  }
337
- let r = "target" in e ? e.target : "", i = [...A(e.leadingComments, t), `${t}annotation ${C(r)} {`];
338
- for (let n of e.properties) i.push(P(n, `${t} `));
347
+ let r = "target" in e ? e.target : "", i = [...A(e.leadingComments, t), `${t}annotation ${w(r)} {`];
348
+ for (let n of e.properties) i.push(F(n, `${t} `));
339
349
  return i.push(...M(e, t)), i.join("\n");
340
350
  }
341
- function B(e, t) {
342
- let n = [...A(e.leadingComments, t), `${t}series ${C(e.name)} {`];
343
- for (let r of e.properties) n.push(P(r, `${t} `));
351
+ function V(e, t) {
352
+ let n = [...A(e.leadingComments, t), `${t}series ${w(e.name)} {`];
353
+ for (let r of e.properties) n.push(F(r, `${t} `));
344
354
  return n.push(...M(e, t)), n.join("\n");
345
355
  }
346
- function Wt(e, t) {
347
- let n = e.name == null ? `${t}scene {` : `${t}scene ${C(e.name)} {`, r = [...A(e.leadingComments, t), n];
348
- for (let n of e.properties) r.push(P(n, `${t} `));
349
- e.data && r.push(F(e.data, `${t} `));
350
- for (let n of e.colorizes) r.push(I(n, `${t} `));
351
- for (let n of e.highlights) r.push(L(n, `${t} `));
352
- for (let n of e.areaFills) r.push(R(n, `${t} `));
353
- for (let n of e.annotations) r.push(z(n, `${t} `));
354
- for (let n of e.series) r.push(B(n, `${t} `));
355
- for (let n of e.transforms) r.push(V(n, `${t} `));
356
+ function Yt(e, t) {
357
+ let n = e.name == null ? `${t}scene {` : `${t}scene ${w(e.name)} {`, r = [...A(e.leadingComments, t), n];
358
+ for (let n of e.properties) r.push(F(n, `${t} `));
359
+ e.data && r.push(I(e.data, `${t} `));
360
+ for (let n of e.colorizes) r.push(L(n, `${t} `));
361
+ for (let n of e.highlights) r.push(R(n, `${t} `));
362
+ for (let n of e.areaFills) r.push(z(n, `${t} `));
363
+ for (let n of e.annotations) r.push(B(n, `${t} `));
364
+ for (let n of e.series) r.push(V(n, `${t} `));
365
+ for (let n of e.transforms) r.push(H(n, `${t} `));
356
366
  return r.push(...M(e, t)), r.join("\n");
357
367
  }
358
- function V(e, t) {
368
+ function H(e, t) {
359
369
  let n = [...A(e.leadingComments, t), `${t}transform ${e.transformType} {`];
360
- for (let r of e.properties) n.push(P(r, `${t} `));
370
+ for (let r of e.properties) n.push(F(r, `${t} `));
361
371
  return n.push(...M(e, t)), n.join("\n");
362
372
  }
363
- function Gt(e, t, n) {
364
- let r = h(n).find((t) => t.key === e);
373
+ function Xt(e, t, n) {
374
+ let r = g(n).find((t) => t.key === e);
365
375
  return !r || r.default === void 0 ? !1 : String(r.default) === String(t);
366
376
  }
367
- function Kt(e) {
377
+ function Zt(e) {
368
378
  let t = [`chart ${e.chartType} {`];
369
- for (let n of e.properties) t.push(P(n, " "));
370
- e.data && t.push(F(e.data, " "));
371
- for (let n of e.colorizes) t.push(I(n, " "));
372
- for (let n of e.highlights) t.push(L(n, " "));
373
- for (let n of e.areaFills) t.push(R(n, " "));
374
- for (let n of e.annotations) t.push(z(n, " "));
375
- for (let n of e.series) t.push(B(n, " "));
376
- for (let n of e.scenes) t.push(Wt(n, " "));
377
- for (let n of e.transforms) t.push(V(n, " "));
379
+ for (let n of e.properties) t.push(F(n, " "));
380
+ e.data && t.push(I(e.data, " "));
381
+ for (let n of e.colorizes) t.push(L(n, " "));
382
+ for (let n of e.highlights) t.push(R(n, " "));
383
+ for (let n of e.areaFills) t.push(z(n, " "));
384
+ for (let n of e.annotations) t.push(B(n, " "));
385
+ for (let n of e.series) t.push(V(n, " "));
386
+ for (let n of e.scenes) t.push(Yt(n, " "));
387
+ for (let n of e.transforms) t.push(H(n, " "));
378
388
  return t.push(...A(e.trailingComments, " "), "}"), t.join("\n");
379
389
  }
380
- function qt(e) {
390
+ function Qt(e) {
381
391
  return new Map(e.map((e) => [e.key, e.value]));
382
392
  }
383
- function H(e, t, n, r) {
384
- let i = h(n).find((t) => t.key === e);
393
+ function U(e, t, n, r) {
394
+ let i = g(n).find((t) => t.key === e);
385
395
  return i ? r.has(e) ? String(r.get(e)) === String(t) : i.default !== void 0 && String(i.default) === String(t) : !1;
386
396
  }
387
- function Jt(e, t, n, r) {
388
- let i = [...A(e.leadingComments, t), `${t}series ${C(e.name)} {`];
389
- for (let a of e.properties) (a.isPercentage || !H(a.key, a.value, n, r)) && i.push(P(a, `${t} `));
397
+ function $t(e, t, n, r) {
398
+ let i = [...A(e.leadingComments, t), `${t}series ${w(e.name)} {`];
399
+ for (let a of e.properties) (a.isPercentage || !U(a.key, a.value, n, r)) && i.push(F(a, `${t} `));
390
400
  return i.push(...M(e, t)), i.join("\n");
391
401
  }
392
- function Yt(e, t, n, r) {
393
- let i = e.properties.find((e) => e.key === "type"), a = i ? String(i.value) : n, o = e.name == null ? `${t}scene {` : `${t}scene ${C(e.name)} {`, s = [...A(e.leadingComments, t), o], c = new Map(r);
402
+ function en(e, t, n, r) {
403
+ let i = e.properties.find((e) => e.key === "type"), a = i ? String(i.value) : n, o = e.name == null ? `${t}scene {` : `${t}scene ${w(e.name)} {`, s = [...A(e.leadingComments, t), o], c = new Map(r);
394
404
  for (let n of e.properties) {
395
405
  if (n.key === "type") {
396
- s.push(P(n, `${t} `));
406
+ s.push(F(n, `${t} `));
397
407
  continue;
398
408
  }
399
- c.set(n.key, n.value), (n.isPercentage || !H(n.key, n.value, a, r)) && s.push(P(n, `${t} `));
409
+ c.set(n.key, n.value), (n.isPercentage || !U(n.key, n.value, a, r)) && s.push(F(n, `${t} `));
400
410
  }
401
- e.data && s.push(F(e.data, `${t} `));
402
- for (let n of e.colorizes) s.push(I(n, `${t} `));
403
- for (let n of e.highlights) s.push(L(n, `${t} `));
404
- for (let n of e.areaFills) s.push(R(n, `${t} `));
405
- for (let n of e.annotations) s.push(z(n, `${t} `));
406
- for (let n of e.series) s.push(Jt(n, `${t} `, a, c));
407
- for (let n of e.transforms) s.push(V(n, `${t} `));
411
+ e.data && s.push(I(e.data, `${t} `));
412
+ for (let n of e.colorizes) s.push(L(n, `${t} `));
413
+ for (let n of e.highlights) s.push(R(n, `${t} `));
414
+ for (let n of e.areaFills) s.push(z(n, `${t} `));
415
+ for (let n of e.annotations) s.push(B(n, `${t} `));
416
+ for (let n of e.series) s.push($t(n, `${t} `, a, c));
417
+ for (let n of e.transforms) s.push(H(n, `${t} `));
408
418
  return s.push(...M(e, t)), s.join("\n");
409
419
  }
410
- function Xt(e) {
420
+ function tn(e) {
411
421
  let t = [`chart ${e.chartType} {`], n = /* @__PURE__ */ new Map();
412
- for (let r of e.properties) (r.isPercentage || !H(r.key, r.value, e.chartType, n)) && t.push(P(r, " "));
413
- e.data && t.push(F(e.data, " "));
414
- for (let n of e.colorizes) t.push(I(n, " "));
415
- for (let n of e.highlights) t.push(L(n, " "));
416
- for (let n of e.areaFills) t.push(R(n, " "));
417
- for (let n of e.annotations) t.push(z(n, " "));
418
- let r = qt(e.properties);
419
- for (let n of e.series) t.push(Jt(n, " ", e.chartType, r));
420
- for (let n of e.scenes) t.push(Yt(n, " ", e.chartType, r));
421
- for (let n of e.transforms) t.push(V(n, " "));
422
+ for (let r of e.properties) (r.isPercentage || !U(r.key, r.value, e.chartType, n)) && t.push(F(r, " "));
423
+ e.data && t.push(I(e.data, " "));
424
+ for (let n of e.colorizes) t.push(L(n, " "));
425
+ for (let n of e.highlights) t.push(R(n, " "));
426
+ for (let n of e.areaFills) t.push(z(n, " "));
427
+ for (let n of e.annotations) t.push(B(n, " "));
428
+ let r = Qt(e.properties);
429
+ for (let n of e.series) t.push($t(n, " ", e.chartType, r));
430
+ for (let n of e.scenes) t.push(en(n, " ", e.chartType, r));
431
+ for (let n of e.transforms) t.push(H(n, " "));
422
432
  return t.push(...A(e.trailingComments, " "), "}"), t.join("\n");
423
433
  }
424
- function Zt(e) {
434
+ function nn(e) {
425
435
  let t = [`chart ${e.chartType} {`];
426
- for (let n of e.properties) Gt(n.key, n.value, e.chartType) || t.push(P(n, " "));
427
- e.data && t.push(F(e.data, " "));
428
- for (let n of e.colorizes) t.push(I(n, " "));
429
- for (let n of e.highlights) t.push(L(n, " "));
430
- for (let n of e.areaFills) t.push(R(n, " "));
431
- for (let n of e.annotations) t.push(z(n, " "));
432
- for (let n of e.series) t.push(B(n, " "));
433
- for (let n of e.scenes) t.push(Wt(n, " "));
434
- for (let n of e.transforms) t.push(V(n, " "));
436
+ for (let n of e.properties) Xt(n.key, n.value, e.chartType) || t.push(F(n, " "));
437
+ e.data && t.push(I(e.data, " "));
438
+ for (let n of e.colorizes) t.push(L(n, " "));
439
+ for (let n of e.highlights) t.push(R(n, " "));
440
+ for (let n of e.areaFills) t.push(z(n, " "));
441
+ for (let n of e.annotations) t.push(B(n, " "));
442
+ for (let n of e.series) t.push(V(n, " "));
443
+ for (let n of e.scenes) t.push(Yt(n, " "));
444
+ for (let n of e.transforms) t.push(H(n, " "));
435
445
  return t.push(...A(e.trailingComments, " "), "}"), t.join("\n");
436
446
  }
437
447
  //#endregion
448
+ //#region src/dsl/suggest.ts
449
+ function rn(e, t) {
450
+ let n = [Array.from({ length: t.length + 1 }, (e, t) => t)];
451
+ for (let r = 1; r <= e.length; r++) {
452
+ n.push([r]);
453
+ for (let i = 1; i <= t.length; i++) {
454
+ let a = e[r - 1] === t[i - 1] ? 0 : 1;
455
+ n[r][i] = Math.min(n[r][i - 1] + 1, n[r - 1][i] + 1, n[r - 1][i - 1] + a), r > 1 && i > 1 && e[r - 1] === t[i - 2] && e[r - 2] === t[i - 1] && (n[r][i] = Math.min(n[r][i], n[r - 2][i - 2] + 1));
456
+ }
457
+ }
458
+ return n[e.length][t.length];
459
+ }
460
+ function W(e, t) {
461
+ let n, r = Infinity;
462
+ for (let i of t) {
463
+ let t = rn(e.toLowerCase(), i.toLowerCase());
464
+ t < r && (r = t, n = i);
465
+ }
466
+ if (n === void 0) return;
467
+ let i = Math.max(1, Math.min(3, Math.floor(e.length / 2)));
468
+ return r <= i ? n : void 0;
469
+ }
470
+ //#endregion
471
+ //#region src/charts/types/scatter/issues.ts
472
+ var an = [
473
+ "x",
474
+ "y",
475
+ "size",
476
+ "group"
477
+ ], on = 5, sn = {
478
+ "missing-x": "missing x",
479
+ "missing-y": "missing y",
480
+ "invalid-size": "size must be above 0",
481
+ "non-positive-log-x": "x must be above 0 on a log axis",
482
+ "non-positive-log-y": "y must be above 0 on a log axis"
483
+ }, cn = {
484
+ x: "horizontal",
485
+ y: "vertical"
486
+ };
487
+ function ln(e) {
488
+ return [...Ee(e), ...(e.textColumns ?? []).map((e) => e.name)];
489
+ }
490
+ function un(e, t) {
491
+ let n = ln(e);
492
+ return an.flatMap((e) => {
493
+ let r = t[e];
494
+ return !r || r === "none" || n.includes(r) ? [] : [{
495
+ code: "unknown-column",
496
+ severity: "error",
497
+ key: e,
498
+ message: `${e} names "${r}", which is not a column.`,
499
+ suggestion: W(r, n)
500
+ }];
501
+ });
502
+ }
503
+ function dn(e) {
504
+ if (!e.length) return [];
505
+ let t = e.slice(0, on).map((e) => `"${e.name}" (${sn[e.reason]})`), n = e.length - t.length;
506
+ return [{
507
+ code: "dropped-rows",
508
+ severity: "warning",
509
+ message: `${`${e.length} ${e.length === 1 ? "row" : "rows"}`} not drawn: ${t.join(", ")}${n > 0 ? `, and ${n} more` : ""}.`
510
+ }];
511
+ }
512
+ function fn(e) {
513
+ return e.map((e) => ({
514
+ code: "trend-skipped",
515
+ severity: "warning",
516
+ message: `Trend line skipped${e === "overall" ? "" : ` for ${e}`}: needs at least 3 points.`
517
+ }));
518
+ }
519
+ function pn(e, t) {
520
+ return ["x", "y"].flatMap((n) => ["min", "max"].flatMap((r) => {
521
+ let i = t[n]?.[r];
522
+ return e[n] !== ft.Log || i === void 0 || String(i).trim() === "" || !(Number(i) <= 0) ? [] : [{
523
+ code: "log-range-ignored",
524
+ severity: "warning",
525
+ message: `${`${cn[n]}Range${r === "min" ? "Min" : "Max"}`} must be above 0 on a log axis; it is ignored.`
526
+ }];
527
+ }));
528
+ }
529
+ function mn(e, t, n, r, i) {
530
+ let a = un(e, t), o = C(e, t);
531
+ if (!o.y) return [...a, {
532
+ code: "scatter-missing-y",
533
+ severity: "error",
534
+ key: "y",
535
+ message: "Scatter needs at least two numeric columns."
536
+ }];
537
+ let s = pn(n, r);
538
+ if (a.length) return [...a, ...s];
539
+ let { points: c, dropped: l } = dt(e, o, n), u = m(i) ? ne(c, i, n).skipped : [];
540
+ return [
541
+ ...dn(l),
542
+ ...fn(u),
543
+ ...s
544
+ ];
545
+ }
546
+ //#endregion
438
547
  //#region src/dsl/validate.ts
439
- var Qt = /* @__PURE__ */ new Set([
548
+ var hn = /* @__PURE__ */ new Set([
440
549
  "title",
441
550
  "description",
442
551
  "byline",
@@ -457,8 +566,8 @@ var Qt = /* @__PURE__ */ new Set([
457
566
  "maxWidth",
458
567
  "player",
459
568
  "playerPosition"
460
- ]), $t = /* @__PURE__ */ new Map([
461
- ["theme", Nt().map((e) => e.name)],
569
+ ]), gn = /* @__PURE__ */ new Map([
570
+ ["theme", zt().map((e) => e.name)],
462
571
  ["player", [
463
572
  "buttons",
464
573
  "progress-bar",
@@ -471,13 +580,13 @@ var Qt = /* @__PURE__ */ new Set([
471
580
  "center",
472
581
  "right"
473
582
  ]]
474
- ]), en = /* @__PURE__ */ new Set([
583
+ ]), _n = /* @__PURE__ */ new Set([
475
584
  "lineSymbolSize",
476
585
  "circleSize",
477
586
  "fixedHeight",
478
587
  "fixedWidth",
479
588
  "maxWidth"
480
- ]), U = it, tn = /* @__PURE__ */ new Set([
589
+ ]), G = st, vn = /* @__PURE__ */ new Set([
481
590
  "text",
482
591
  "repeat",
483
592
  "textColor",
@@ -495,7 +604,7 @@ var Qt = /* @__PURE__ */ new Set([
495
604
  "circleSize",
496
605
  "circleStyle",
497
606
  "circleColor"
498
- ]), nn = /* @__PURE__ */ new Set([
607
+ ]), yn = /* @__PURE__ */ new Set([
499
608
  "color",
500
609
  "lineWidth",
501
610
  "dash",
@@ -510,11 +619,11 @@ var Qt = /* @__PURE__ */ new Set([
510
619
  "symbolStyle",
511
620
  "symbolSize",
512
621
  "symbolOpacity"
513
- ]), rn = /* @__PURE__ */ new Map([
622
+ ]), bn = /* @__PURE__ */ new Map([
514
623
  ["symbolShape", "lineSymbolShape"],
515
624
  ["symbolShowOn", "lineSymbolShowOn"],
516
625
  ["symbolStyle", "lineSymbolStyle"]
517
- ]), an = /* @__PURE__ */ new Set([
626
+ ]), xn = /* @__PURE__ */ new Set([
518
627
  "start",
519
628
  "end",
520
629
  "repeat",
@@ -526,7 +635,7 @@ var Qt = /* @__PURE__ */ new Set([
526
635
  "direction",
527
636
  "text",
528
637
  "textColor"
529
- ]), on = /* @__PURE__ */ new Set([
638
+ ]), Sn = /* @__PURE__ */ new Set([
530
639
  "text",
531
640
  "x",
532
641
  "y",
@@ -535,35 +644,10 @@ var Qt = /* @__PURE__ */ new Set([
535
644
  "maxWidth",
536
645
  "textOutline"
537
646
  ]);
538
- function sn(e, t) {
539
- let n = e.length, r = t.length;
540
- if (n === 0) return r;
541
- if (r === 0) return n;
542
- let i = Array.from({ length: r + 1 }, (e, t) => t), a = Array(r + 1);
543
- for (let o = 1; o <= n; o++) {
544
- a[0] = o;
545
- for (let n = 1; n <= r; n++) {
546
- let r = e[o - 1] === t[n - 1] ? 0 : 1;
547
- a[n] = Math.min(a[n - 1] + 1, i[n] + 1, i[n - 1] + r);
548
- }
549
- [i, a] = [a, i];
550
- }
551
- return i[r];
552
- }
553
- function W(e, t) {
554
- let n, r = Infinity;
555
- for (let i of t) {
556
- let t = sn(e.toLowerCase(), i.toLowerCase());
557
- t < r && (r = t, n = i);
558
- }
559
- if (n === void 0) return;
560
- let i = Math.max(1, Math.min(3, Math.floor(e.length / 2)));
561
- return r <= i ? n : void 0;
562
- }
563
- function cn(e, t) {
647
+ function Cn(e, t) {
564
648
  return e.find((e) => e.key === t);
565
649
  }
566
- function G(e, t, n, r, i) {
650
+ function K(e, t, n, r, i) {
567
651
  i.push({
568
652
  code: "invalid-choice",
569
653
  path: r,
@@ -571,8 +655,8 @@ function G(e, t, n, r, i) {
571
655
  suggestion: W(String(t), n.filter((e) => e !== ""))
572
656
  });
573
657
  }
574
- function ln(e, t, n) {
575
- if (!en.has(e.key)) return;
658
+ function wn(e, t, n) {
659
+ if (!_n.has(e.key)) return;
576
660
  let r = parseFloat(String(e.value));
577
661
  Number.isFinite(r) && r < 0 && n.push({
578
662
  code: "invalid-number",
@@ -580,9 +664,9 @@ function ln(e, t, n) {
580
664
  message: `${e.key} must not be negative; got "${e.value}".`
581
665
  });
582
666
  }
583
- function un(e, t, n, r) {
667
+ function Tn(e, t, n, r) {
584
668
  let i = t.value, a = String(i).toLowerCase();
585
- if (e.type === o.Boolean) {
669
+ if (e.type === $e.Boolean) {
586
670
  if (e.key === "valueLabels" && a === "percent" || i === !0 || i === !1 || a === "true" || a === "false") return;
587
671
  r.push({
588
672
  code: "invalid-boolean",
@@ -595,17 +679,17 @@ function un(e, t, n, r) {
595
679
  if (e.choices && e.choices.length > 0) {
596
680
  let t = e.choices.map((e) => e.value);
597
681
  if (t.includes(String(i)) || String(i) === "" && t.includes("")) return;
598
- G(e.key, i, t, n, r);
682
+ K(e.key, i, t, n, r);
599
683
  }
600
684
  }
601
- function dn(e, t, n, r) {
602
- let i = h(e), a = /* @__PURE__ */ new Set([...i.map((e) => e.key), ...Qt]);
685
+ function En(e, t, n, r) {
686
+ let i = g(e), a = /* @__PURE__ */ new Set([...i.map((e) => e.key), ...hn]);
603
687
  for (let o of t) {
604
688
  let t = `${n}.${o.key}`;
605
- ln(o, t, r);
606
- let s = $t.get(o.key);
607
- if (s && String(o.value) !== "" && !s.includes(String(o.value)) && G(o.key, o.value, s, t, r), Qt.has(o.key)) continue;
608
- let c = cn(i, o.key);
689
+ wn(o, t, r);
690
+ let s = gn.get(o.key);
691
+ if (s && String(o.value) !== "" && !s.includes(String(o.value)) && K(o.key, o.value, s, t, r), hn.has(o.key)) continue;
692
+ let c = Cn(i, o.key);
609
693
  if (!c) {
610
694
  r.push({
611
695
  code: "unknown-property",
@@ -615,28 +699,28 @@ function dn(e, t, n, r) {
615
699
  });
616
700
  continue;
617
701
  }
618
- un(c, o, t, r);
702
+ Tn(c, o, t, r);
619
703
  }
620
704
  }
621
- function fn(e) {
622
- return e === S.Range ? an : e === S.Free ? on : tn;
705
+ function Dn(e) {
706
+ return e === d.Range ? xn : e === d.Free ? Sn : vn;
623
707
  }
624
- function pn(e) {
625
- return yt[e];
708
+ function On(e) {
709
+ return Et[e];
626
710
  }
627
- function mn(e, t, n) {
711
+ function kn(e, t, n) {
628
712
  e.forEach((e, r) => {
629
- let i = e.kind ?? S.Point, a = fn(i), o = pn(i);
713
+ let i = e.kind ?? d.Point, a = Dn(i), o = On(i);
630
714
  for (let i of e.properties) {
631
715
  let e = `${t}.${o}[${r}].${i.key}`;
632
- ln(i, e, n), !a.has(i.key) && n.push({
716
+ wn(i, e, n), !a.has(i.key) && n.push({
633
717
  code: "unknown-annotation-property",
634
718
  path: e,
635
719
  message: `Unknown ${o} property "${i.key}"; it will be silently ignored.`,
636
720
  suggestion: W(i.key, a)
637
721
  });
638
722
  }
639
- let s = ae(e.properties).get("repeat");
723
+ let s = b(e.properties).get("repeat");
640
724
  if (s !== void 0) {
641
725
  let e = String(s).toLowerCase();
642
726
  e === "true" || e === "false" || typeof s == "number" && Number.isInteger(s) && s >= 1 || n.push({
@@ -647,36 +731,36 @@ function mn(e, t, n) {
647
731
  }
648
732
  });
649
733
  }
650
- function hn(e, t, n, r) {
651
- let i = h(e);
734
+ function An(e, t, n, r) {
735
+ let i = g(e);
652
736
  t.forEach((e, t) => {
653
737
  for (let a of e.properties) {
654
738
  let e = `${n}.series[${t}].${a.key}`;
655
- if (!nn.has(a.key)) {
739
+ if (!yn.has(a.key)) {
656
740
  r.push({
657
741
  code: "unknown-series-property",
658
742
  path: e,
659
743
  message: `Unknown series property "${a.key}"; it will be silently ignored.`,
660
- suggestion: W(a.key, nn)
744
+ suggestion: W(a.key, yn)
661
745
  });
662
746
  continue;
663
747
  }
664
- let o = cn(i, rn.get(a.key) ?? a.key)?.choices?.map((e) => e.value);
665
- o?.length && !o.includes(String(a.value)) && G(a.key, a.value, o, e, r);
748
+ let o = Cn(i, bn.get(a.key) ?? a.key)?.choices?.map((e) => e.value);
749
+ o?.length && !o.includes(String(a.value)) && K(a.key, a.value, o, e, r);
666
750
  }
667
751
  });
668
752
  }
669
- function gn(e, t, n) {
753
+ function jn(e, t, n) {
670
754
  e.forEach((e, r) => {
671
- U.has(e.transformType) || n.push({
755
+ G.has(e.transformType) || n.push({
672
756
  code: "unknown-transform",
673
757
  path: `${t}.transform[${r}]`,
674
- message: `Unknown transform type "${e.transformType}". Known types: ${[...U].map((e) => `"${e}"`).join(", ")}.`,
675
- suggestion: W(e.transformType, U)
758
+ message: `Unknown transform type "${e.transformType}". Known types: ${[...G].map((e) => `"${e}"`).join(", ")}.`,
759
+ suggestion: W(e.transformType, G)
676
760
  });
677
761
  });
678
762
  }
679
- function _n(e) {
763
+ function Mn(e) {
680
764
  let t = /* @__PURE__ */ new Set();
681
765
  for (let n of [e.data, ...e.scenes.map((e) => e.data)]) for (let e of n?.entries ?? []) {
682
766
  if (e.key === "series" && !e.quotedKey) {
@@ -684,11 +768,12 @@ function _n(e) {
684
768
  continue;
685
769
  }
686
770
  t.add(e.key);
771
+ for (let n of e.values ?? [e.value]) typeof n == "string" && t.add(n);
687
772
  }
688
773
  return t;
689
774
  }
690
- function vn(e, t) {
691
- let n = _n(e);
775
+ function Nn(e, t) {
776
+ let n = Mn(e);
692
777
  if (n.size === 0) return;
693
778
  let r = [
694
779
  {
@@ -720,28 +805,28 @@ function vn(e, t) {
720
805
  });
721
806
  });
722
807
  }
723
- function yn(e) {
724
- let t = [], n = [], r = x(), i = r.includes(e.chartType);
725
- i || t.push({
808
+ function Pn(e) {
809
+ let t = [], n = [], i = S(), a = i.includes(e.chartType);
810
+ a || t.push({
726
811
  code: "unknown-chart-type",
727
812
  path: "chartType",
728
813
  message: `Unknown chart type "${e.chartType}".`,
729
- suggestion: W(e.chartType, r)
730
- }), i && dn(e.chartType, e.properties, "chart", t), gn(e.transforms, "chart", t), mn(e.annotations, "chart", t), i && hn(e.chartType, e.series, "chart", t);
731
- let a = !!e.data && e.data.entries.length > 0, o = e.scenes.some((e) => !!e.data && e.data.entries.length > 0);
732
- return !a && !o && t.push({
814
+ suggestion: W(e.chartType, i)
815
+ }), a && En(e.chartType, e.properties, "chart", t), jn(e.transforms, "chart", t), kn(e.annotations, "chart", t), a && An(e.chartType, e.series, "chart", t);
816
+ let o = !!e.data && e.data.entries.length > 0, s = e.scenes.some((e) => !!e.data && e.data.entries.length > 0);
817
+ return !o && !s && t.push({
733
818
  code: "missing-data",
734
819
  path: "data",
735
820
  message: e.data && e.data.entries.length === 0 ? "Data block is empty." : "Chart has no data."
736
- }), e.data && bn(e.data.entries, n), e.data && xn(e.data.entries, n), vn(e, n), e.scenes.forEach((n, r) => {
737
- Sn(n, e.chartType, r, t);
821
+ }), e.data && Fn(e.data.entries, n), e.data && In(e.data.entries, n), Nn(e, n), e.chartType === r.Scatter && Rn(e.data, e.properties, "chart", "data", t, n), e.scenes.forEach((i, a) => {
822
+ Ln(i, e.chartType, a, t), (i.properties.find((e) => e.key === "type")?.value ?? e.chartType) === r.Scatter && Rn(i.data, [...e.properties, ...i.properties], `scene[${a}]`, `scene[${a}].data`, t, n);
738
823
  }), {
739
824
  valid: t.length === 0,
740
825
  errors: t,
741
826
  warnings: n
742
827
  };
743
828
  }
744
- function bn(e, t) {
829
+ function Fn(e, t) {
745
830
  let n = e.findIndex((e) => e.key === "series" && !e.quotedKey);
746
831
  if (n === -1) return;
747
832
  let r = e[n], i = r.values ?? [r.value];
@@ -757,7 +842,7 @@ function bn(e, t) {
757
842
  suggestion: "Move the series row to the top of the data block."
758
843
  });
759
844
  }
760
- function xn(e, t) {
845
+ function In(e, t) {
761
846
  let n = /* @__PURE__ */ new Map();
762
847
  for (let t of e) t.key === "series" && !t.quotedKey || n.set(t.key, (n.get(t.key) ?? 0) + 1);
763
848
  for (let [e, r] of n) r > 1 && t.push({
@@ -767,25 +852,52 @@ function xn(e, t) {
767
852
  suggestion: `"${e} (2)"`
768
853
  });
769
854
  }
770
- function Sn(e, t, n, r) {
855
+ function Ln(e, t, n, r) {
771
856
  let i = `scene[${n}]`, a = e.properties.find((e) => e.key === "type")?.value, o = a == null ? t : String(a);
772
- a != null && !x().includes(o) ? r.push({
857
+ a != null && !S().includes(o) ? r.push({
773
858
  code: "unknown-chart-type",
774
859
  path: `${i}.type`,
775
860
  message: `Unknown chart type "${o}".`,
776
- suggestion: W(o, x())
777
- }) : (dn(o, e.properties, i, r), hn(o, e.series, i, r)), gn(e.transforms, i, r), mn(e.annotations, i, r);
861
+ suggestion: W(o, S())
862
+ }) : (En(o, e.properties, i, r), An(o, e.series, i, r)), jn(e.transforms, i, r), kn(e.annotations, i, r);
863
+ }
864
+ function Rn(e, t, n, r, i, a) {
865
+ if (!e || e.entries.length === 0) return;
866
+ let o = b(t), s = (e) => o.has(e) ? String(o.get(e)) : void 0, c = (e) => s(e), l = (e) => ({
867
+ min: s(`${e}RangeMin`),
868
+ max: s(`${e}RangeMax`)
869
+ }), u = {
870
+ x: s("x"),
871
+ y: s("y"),
872
+ size: s("size"),
873
+ group: s("group")
874
+ }, d = {
875
+ x: c("horizontalScaleType"),
876
+ y: c("verticalScaleType")
877
+ }, f = {
878
+ x: l("horizontal"),
879
+ y: l("vertical")
880
+ };
881
+ for (let t of mn(me(Qe(e)), u, d, f, s("trend"))) (t.severity === "error" ? i : a).push(zn(t, t.key ? `${n}.${t.key}` : r));
882
+ }
883
+ function zn({ code: e, message: t, suggestion: n }, r) {
884
+ return {
885
+ code: e,
886
+ path: r,
887
+ message: t,
888
+ ...n && { suggestion: n }
889
+ };
778
890
  }
779
891
  //#endregion
780
892
  //#region src/samples/letter-frequency.bpc?raw
781
- var Cn = "chart bar-vertical {\n title = \"E is the most frequent letter in English\"\n description = \"How often each letter appears in typical English text\"\n byline = \"Pierre Romera\"\n source = \"Lewand, Cryptological Mathematics\"\n sourceUrl = \"https://en.wikipedia.org/wiki/Letter_frequency\"\n note = \"Based on analysis of 40,000 words from English prose\"\n colorPalette = \"London\"\n sort = descending\n\n highlight \"E\"\n\n data {\n \"E\" = 12.70\n \"T\" = 9.06\n \"A\" = 8.17\n \"O\" = 7.51\n \"I\" = 6.97\n \"N\" = 6.75\n \"S\" = 6.33\n \"H\" = 6.09\n \"R\" = 5.99\n \"D\" = 4.25\n }\n}\n", wn = "chart bar-vertical {\n // the headline above the chart\n title = \"China emits more CO₂ than the US and India combined\"\n description = \"Annual emissions in billion tonnes, 2023\"\n source = \"Our World in Data\"\n sourceUrl = \"https://ourworldindata.org/co2-emissions\"\n\n // one row per country: \"label\" = value\n data {\n \"China\" = 12.17\n \"United States\" = 4.92\n \"India\" = 3.06\n \"Russia\" = 1.73\n \"Japan\" = 0.99\n \"Germany\" = 0.59\n }\n\n // highlight pops one bar in the accent color\n highlight \"China\"\n\n // an annotation points a callout at a single bar\n annotation \"India\" {\n text = \"Surpassed EU in 2023\"\n showLine = true\n anchorDirection = N\n textOffsetX = 66\n textOffsetY = -41\n lineStyle = curve-left\n showArrow = true\n lineTargetDistance = 26\n showCircle = false\n }\n}\n", Tn = "chart bar-horizontal {\n title = \"Mandarin has nearly twice as many native speakers as Spanish\"\n description = \"Number of native speakers worldwide, in millions\"\n source = \"Ethnologue\"\n sourceUrl = \"https://ethnologue.com\"\n byline = \"Pierre Romera\"\n sort = descending\n\n highlight \"Mandarin\"\n\n data {\n \"Mandarin\" = 988\n \"Spanish\" = 487\n \"English\" = 372\n \"Hindi\" = 347\n \"Bengali\" = 232\n \"Portuguese\" = 252\n \"Russian\" = 133\n \"Japanese\" = 124\n }\n}\n", En = "chart line-multi {\n title = \"China now buys more electric cars than the rest of the world combined\"\n description = \"Electric car sales by region, millions per year\"\n source = \"IEA Global EV Outlook 2024\"\n sourceUrl = \"https://www.iea.org/reports/global-ev-outlook-2024\"\n colorPalette = \"Maya\"\n tooltips = true\n\n data {\n series = \"China\",\"Europe\",\"United States\",\"Rest of world\"\n \"2018\" = 1.1,0.4,0.36,0.1\n \"2020\" = 1.3,1.4,0.30,0.2\n \"2021\" = 3.3,2.3,0.63,0.4\n \"2022\" = 6.0,2.7,1.0,0.7\n \"2023\" = 8.1,3.2,1.4,1.0\n }\n}\n", Dn = "chart bar-multi {\n title = \"USA tops Paris 2024 with 126 medals across all categories\"\n description = \"2024 Paris Summer Games — top six nations\"\n source = \"Olympics.com\"\n sourceUrl = \"https://olympics.com\"\n colors = \"#eeca3b, #c0c0c0, #cd7f32\"\n sort = descending\n\n data {\n series = \"Gold\",\"Silver\",\"Bronze\"\n \"USA\" = 40,44,42\n \"China\" = 40,27,24\n \"Japan\" = 20,12,13\n \"Great Britain\" = 14,22,29\n \"Australia\" = 18,19,16\n \"France\" = 16,26,22\n }\n}\n", On = "chart line {\n title = \"2024 was the hottest year on record\"\n description = \"Deviation from the 1951–1980 average, in °C\"\n source = \"NASA GISS\"\n sourceUrl = \"https://data.giss.nasa.gov/gistemp/\"\n tooltips = true\n crosshair = false\n lineSymbols = true\n\n data {\n \"1980\" = 0.26\n \"1985\" = 0.12\n \"1990\" = 0.45\n \"1995\" = 0.45\n \"2000\" = 0.39\n \"2005\" = 0.68\n \"2010\" = 0.73\n \"2015\" = 0.9\n \"2020\" = 1.01\n \"2024\" = 1.28\n }\n\n annotation \"2015\" {\n text = \"2015 Paris Agreement to limit global warming to 1.5°C \"\n maxWidth = 224\n showLine = true\n lineStyle = curve-right\n showArrow = true\n showCircle = true\n }\n}\n", kn = "chart line {\n title = \"Bitcoin surged past $90,000 in 2024\"\n description = \"USD, year-end closing price\"\n source = \"CoinGecko\"\n sourceUrl = \"https://www.coingecko.com\"\n colors = \"#f7931a\"\n lineSymbols = true\n lineSymbolShowOn = \"all\"\n lineSymbolShape = \"diamond\"\n verticalNumberFormat = \",.0f\"\n tooltips = true\n\n annotation \"2021\" {\n text = \"All-time high cycle\"\n textOffsetY = -12\n showArrow = true\n }\n\n data {\n \"2016\" = 963\n \"2017\" = 14156\n \"2018\" = 3742\n \"2019\" = 7194\n \"2020\" = 29080\n \"2021\" = 46306\n \"2022\" = 16547\n \"2023\" = 42258\n \"2024\" = 93429\n }\n}\n", An = "chart line-multi {\n title = \"The income share of the top 1% has surged since 1980\"\n description = \"Pre-tax national income captured by the top 1%, percent\"\n source = \"World Inequality Database\"\n sourceUrl = \"https://wid.world\"\n colorPalette = \"Egypt\"\n tooltips = true\n lineSymbols = true\n lineSymbolShowOn = \"all\"\n\n data {\n series = \"United States\",\"India\",\"China\",\"France\"\n \"1980\" = 10.4,7.5,6.6,7.5\n \"1990\" = 14.7,10.7,8.3,9.0\n \"2000\" = 17.3,10.5,10.5,11.3\n \"2010\" = 17.9,16.4,15.2,11.0\n \"2021\" = 19.9,22.1,15.7,12.7\n }\n\n scene \"US doubles\" {\n title = \"The US top 1% nearly doubled its income share since 1980\"\n highlight \"United States\"\n }\n\n scene \"India overtakes\" {\n title = \"India is now the most unequal of these major economies\"\n highlight \"India\"\n }\n\n scene \"France's modest rise\" {\n title = \"France's top 1% rose far less than the US or India\"\n highlight \"France\"\n }\n}\n", jn = "chart pie {\n title = \"Asia is home to nearly 60% of the world's population\"\n description = \"Estimated share, 2024\"\n source = \"United Nations\"\n sourceUrl = \"https://population.un.org\"\n colorPalette = \"Klimt\"\n legendPosition = \"right\"\n tooltips = true\n\n data {\n \"Asia\" = 58.9\n \"Africa\" = 18.6\n \"Europe\" = 9.1\n \"Latin America\" = 8.1\n \"North America\" = 4.7\n }\n}\n", Mn = "chart bar-vertical {\n title = \"Brazil produces more coffee than the next three countries combined\"\n description = \"Million 60-kg bags, 2023/24 crop year\"\n source = \"USDA Foreign Agricultural Service\"\n sourceUrl = \"https://www.fas.usda.gov/data/coffee-world-markets-and-trade\"\n colorPalette = \"Harvey\"\n\n data {\n \"Brazil\" = 66.4\n \"Vietnam\" = 27.5\n \"Colombia\" = 12.76\n \"Ethiopia\" = 9.13\n \"Indonesia\" = 7.65\n \"Honduras\" = 5.5\n }\n\n highlight \"Brazil\"\n\n transform sort {\n column = \"value\"\n direction = descending\n }\n}\n", Nn = "chart donut {\n title = \"The richest 1% own more wealth than the entire bottom 90% combined\"\n description = \"Share of global wealth by group, 2021\"\n source = \"World Inequality Report 2022\"\n sourceUrl = \"https://wir2022.wid.world\"\n colorPalette = \"Imperator\"\n legendPosition = \"right\"\n displayAsPercentage = true\n tooltips = true\n\n data {\n \"Top 1%\" = 38\n \"Next 9%\" = 38\n \"Middle 40%\" = 22\n \"Bottom 50%\" = 2\n }\n\n scene \"Top 1% spotlight\" {\n title = \"The top 1% hold 38% of all global wealth\"\n description = \"Share of global wealth by group, 2021\"\n highlight \"Top 1%\"\n }\n\n scene \"Bottom half\" {\n title = \"The bottom half of humanity owns just 2%\"\n description = \"Share of global wealth by group, 2021\"\n highlight \"Bottom 50%\"\n }\n\n scene \"Income tells a softer story\" {\n title = \"Income is concentrated too — but less than wealth\"\n description = \"Share of global income by the same groups, 2021\"\n highlight \"Top 1%\"\n data {\n \"Top 1%\" = 19\n \"Next 9%\" = 33\n \"Middle 40%\" = 39\n \"Bottom 50%\" = 9\n }\n }\n}\n", Pn = "chart area {\n title = \"The US national debt has more than tripled since 2008\"\n description = \"Total federal debt outstanding, trillions of dollars\"\n source = \"U.S. Treasury, Fiscal Data\"\n sourceUrl = \"https://fiscaldata.treasury.gov\"\n\n annotation \"2008\" {\n text = \"Financial crisis\"\n showArrow = true\n textOffsetY = -14\n }\n\n data {\n \"2000\" = 5.7\n \"2004\" = 7.4\n \"2008\" = 10.0\n \"2012\" = 16.1\n \"2016\" = 19.6\n \"2020\" = 26.9\n \"2024\" = 35.5\n }\n}\n", Fn = "chart area-stacked {\n title = \"Renewables' share of global energy has more than doubled since 2000\"\n description = \"Share of global primary energy by source, 2000–2023\"\n source = \"Our World in Data\"\n sourceUrl = \"https://ourworldindata.org/energy-mix\"\n stackPercent = true\n areaSortMode = descending\n\n data {\n series = \"Coal\",\"Oil\",\"Gas\",\"Renewables\"\n \"2000\" = 27456,43017,23994,2997\n \"2005\" = 36201,47017,27439,3510\n \"2010\" = 42016,48193,31593,4868\n \"2015\" = 43695,51294,34780,6400\n \"2020\" = 42316,49101,38704,8569\n \"2023\" = 45319,54839,40151,10325\n }\n}\n", In = "chart column-stacked {\n title = \"Natural gas and renewables pushed coal off the US power grid\"\n description = \"Share of US electricity generation by source, percent\"\n source = \"U.S. Energy Information Administration\"\n sourceUrl = \"https://www.eia.gov/electricity\"\n stackMode = \"percent\"\n\n data {\n series = \"Coal\",\"Natural gas\",\"Nuclear\",\"Renewables\"\n \"2010\" = 45,24,20,10\n \"2015\" = 33,33,20,13\n \"2020\" = 19,39,20,20\n \"2023\" = 16,43,19,21\n }\n}\n", Ln = "chart bar-stacked {\n title = \"India has far more children than China, and a workforce nearly as large\"\n description = \"Millions of people, 2023\"\n source = \"UN Population Division\"\n sourceUrl = \"https://population.un.org\"\n colorPalette = \"London\"\n\n data {\n series = \"0-14\",\"15-64\",\"65+\"\n \"China\" = 232,988,200\n \"India\" = 354,978,97\n \"USA\" = 58,216,59\n \"Indonesia\" = 67,189,21\n \"Brazil\" = 43,148,24\n }\n}\n", Rn = "chart area-stacked {\n title = \"EU subsidies to new members surged after enlargement\"\n description = \"Agricultural subsidies to post-socialist EU members, million euros\"\n source = \"Eurostat\"\n sourceUrl = \"https://ec.europa.eu/eurostat\"\n colorPalette = \"Enara\"\n interpolation = \"linear\"\n heightMode = \"aspect-ratio\"\n aspectRatio = \"1:1\"\n\n data {\n series = \"Indirect subsidies\",\"Direct subsidies\"\n \"2000\" = 370,800\n \"2001\" = 445,896\n \"2002\" = 567,816\n \"2003\" = 641,950\n \"2004\" = 1908,2434\n \"2005\" = 2234,3509\n \"2006\" = 2576,4356\n \"2007\" = 2467,5429\n \"2008\" = 2672,6655\n \"2009\" = 2474,7195\n \"2010\" = 2117,8207\n \"2011\" = 1863,9230\n \"2012\" = 1528,9191\n \"2013\" = 1251,10252\n \"2014\" = 1132,10987\n \"2015\" = 1687,10145\n }\n\n scene \"Indirect subsidies shrank\" {\n title = \"Indirect subsidies were cut under WTO pressure\"\n description = \"Subsidies tied to specific crops fell foul of World Trade Organization rules\"\n\n highlight \"Indirect subsidies\"\n }\n\n scene \"Direct subsidies dominate\" {\n title = \"Direct per-hectare payments now dominate\"\n description = \"The larger the fields, the more money farmers receive\"\n\n highlight \"Direct subsidies\"\n }\n\n scene \"Bulgaria: subsidies explode\" {\n title = \"Bulgarian farmers received almost nothing before 2007 accession\"\n description = \"More than three-quarters of Bulgarian subsidies are direct payments — the highest share among new members\"\n\n data {\n series = \"Indirect subsidies\",\"Direct subsidies\"\n \"2000\" = 0,5\n \"2001\" = 0,33\n \"2002\" = 0,48\n \"2003\" = 0,69\n \"2004\" = 0,67\n \"2005\" = 0,87\n \"2006\" = 0,57\n \"2007\" = 59,250\n \"2008\" = 75,484\n \"2009\" = 97,415\n \"2010\" = 79,466\n \"2011\" = 94,458\n \"2012\" = 120,617\n \"2013\" = 132,852\n \"2014\" = 143,821\n \"2015\" = 213,677\n }\n\n highlight \"Direct subsidies\"\n }\n\n scene \"Bulgarian farms grew\" {\n title = \"Average farm size in Bulgaria quadrupled\"\n description = \"Average farm size in hectares\"\n type = line\n\n data {\n \"2005\" = 5\n \"2007\" = 6\n \"2010\" = 12\n \"2013\" = 18\n }\n }\n\n scene \"Production rose\" {\n title = \"Bulgarian farm production rose from 3 to 4 billion euros\"\n description = \"Total production of Bulgarian farms, million euros\"\n type = area\n\n data {\n \"2000\" = 2933\n \"2001\" = 3240\n \"2002\" = 3051\n \"2003\" = 2816\n \"2004\" = 3049\n \"2005\" = 3011\n \"2006\" = 3111\n \"2007\" = 3038\n \"2008\" = 4148\n \"2009\" = 3437\n \"2010\" = 3486\n \"2011\" = 4038\n \"2012\" = 4161\n \"2013\" = 4115\n \"2014\" = 4138\n \"2015\" = 3915\n }\n }\n\n scene \"Cash crops replaced vegetables\" {\n title = \"Cash crops replaced vegetables in Bulgaria\"\n description = \"Production of Bulgarian farms, million euros\"\n type = area-stacked\n\n data {\n series = \"Vegetables\",\"Cash crops\",\"Other production\"\n \"2000\" = 464,615,1854\n \"2001\" = 458,777,2005\n \"2002\" = 577,850,1624\n \"2003\" = 539,818,1459\n \"2004\" = 483,1103,1463\n \"2005\" = 492,994,1525\n \"2006\" = 510,1083,1518\n \"2007\" = 436,936,1666\n \"2008\" = 541,2045,1563\n \"2009\" = 243,1553,1641\n \"2010\" = 184,2173,1128\n \"2011\" = 120,2853,1065\n \"2012\" = 117,2900,1144\n \"2013\" = 139,2802,1174\n \"2014\" = 143,3082,914\n \"2015\" = 144,2986,785\n }\n\n highlight \"Cash crops\"\n }\n\n scene \"Vegetables collapsed\" {\n title = \"Vegetable production fell by a factor of three\"\n description = \"A traditional Bulgarian cultivation shrank as subsidies favoured large fields\"\n\n highlight \"Vegetables\"\n }\n\n scene \"Every vegetable declined\" {\n title = \"Bulgarian vegetable production collapsed across the board\"\n description = \"Production volume indexed to 2001 = 100\"\n type = line-multi\n lineSymbols = false\n\n data {\n series = \"Cabbages\",\"Tomatoes\",\"Watermelons\",\"Carrots\",\"Onions\",\"Garlic\",\"Strawberries\"\n \"2001\" = 100,100,100,100,100,100,100\n \"2002\" = 79,90,124,64,106,95,100\n \"2003\" = 100,157,177,142,118,98,72\n \"2004\" = 84,87,83,245,124,138,74\n \"2005\" = 50,46,62,30,40,93,42\n \"2006\" = 52,78,113,95,56,80,56\n \"2007\" = 36,49,64,74,29,30,38\n \"2008\" = 47,49,66,97,44,29,55\n \"2009\" = 28,38,74,105,23,39,55\n \"2010\" = 57,42,51,76,53,57,37\n \"2011\" = 32,38,56,86,47,43,45\n \"2012\" = 34,34,46,69,29,43,31\n \"2013\" = 33,43,53,39,36,40,24\n \"2014\" = 31,44,28,69,37,8,27\n \"2015\" = 31,45,50,57,25,18,32\n }\n }\n\n scene \"Jobs disappeared\" {\n title = \"Family farmers disappeared while salaried ag jobs held steady\"\n description = \"EU agricultural employment, thousands of full-time equivalents\"\n type = line-multi\n lineSymbols = false\n\n data {\n series = \"Salaried workers\",\"Non-salaried workers\"\n \"2000\" = 2678,12194\n \"2001\" = 2598,11586\n \"2002\" = 2658,10795\n \"2003\" = 2563,10609\n \"2004\" = 2560,9999\n \"2005\" = 2501,10047\n \"2006\" = 2499,9782\n \"2007\" = 2437,9231\n \"2008\" = 2416,8971\n \"2009\" = 2348,8672\n \"2010\" = 2335,7808\n \"2011\" = 2322,7551\n \"2012\" = 2325,7501\n \"2013\" = 2297,7425\n \"2014\" = 2366,7183\n \"2015\" = 2413,6928\n \"2016\" = 2457,6741\n }\n\n highlight \"Non-salaried workers\"\n }\n}\n", zn = "chart bar-horizontal {\n title = \"China emits more CO₂ than the US and India combined\"\n description = \"Annual emissions in billion tonnes, 2023\"\n source = \"Our World in Data\"\n sourceUrl = \"https://ourworldindata.org/co2-emissions\"\n byline = \"Pierre Romera\"\n\n data {\n \"China\" = 12.17\n \"United States\" = 4.92\n \"India\" = 3.06\n \"Russia\" = 1.73\n \"Japan\" = 0.99\n \"Germany\" = 0.59\n }\n\n scene \"China spotlight\" {\n title = \"China alone emits more than the US and India together\"\n highlight \"China\"\n }\n\n scene \"India rising\" {\n title = \"India passed the EU to become the third-largest emitter\"\n highlight \"India\"\n }\n\n scene \"Japan declining\" {\n title = \"Japan's emissions have fallen since their 2013 peak\"\n highlight \"Japan\"\n }\n\n scene \"Per capita reframe\" {\n title = \"Per person, Gulf states dwarf the biggest emitters\"\n description = \"CO₂ emissions per capita, tonnes per person, 2023\"\n highlight \"Qatar\"\n data {\n \"Qatar\" = 40.13\n \"United Arab Emirates\" = 19.77\n \"United States\" = 14.32\n \"China\" = 8.56\n \"India\" = 2.13\n }\n }\n}\n", Bn = "chart bar-split {\n title = \"CDU/CSU led German polls at 29 % ahead of the 2021 election\"\n description = \"How Germany would vote in the September 2021 federal election, according to polling in the previous June\"\n source = \"FG Wahlen\"\n sourceUrl = \"https://www.forschungsgruppe.de\"\n note = \"Margin of error at 10%: +/- 2 percentage points; at 40%: +/- 3 percentage points\"\n\n data {\n series = \"Poll\",\"High\",\"Low\"\n \"CDU/CSU\" = 29,32,27\n \"Greens\" = 22,25,20\n \"SPD\" = 14,16,12\n \"AfD\" = 10,12,8\n \"FDP\" = 10,12,8\n \"Left\" = 7,9,5\n }\n}\n", Vn = "chart bar-grouped {\n title = \"Asia Pacific holds more renewable capacity than all other regions combined\"\n description = \"Installed capacity in gigawatts (GW), 2023\"\n source = \"IRENA\"\n sourceUrl = \"https://www.irena.org/Publications/2024/Mar/Renewable-capacity-statistics-2024\"\n colorPalette = \"Folklore\"\n\n data {\n series = \"Solar\",\"Wind\",\"Hydro\"\n \"Asia Pacific\" = 870,520,650\n \"Europe\" = 290,260,230\n \"North America\" = 150,170,200\n \"Latin America\" = 50,40,190\n \"Africa\" = 12,9,40\n }\n}\n";
893
+ var Bn = "chart bar-vertical {\n title = \"E is the most frequent letter in English\"\n description = \"How often each letter appears in typical English text\"\n byline = \"Pierre Romera\"\n source = \"Lewand, Cryptological Mathematics\"\n sourceUrl = \"https://en.wikipedia.org/wiki/Letter_frequency\"\n note = \"Based on analysis of 40,000 words from English prose\"\n colorPalette = \"London\"\n sort = descending\n\n highlight \"E\"\n\n data {\n \"E\" = 12.70\n \"T\" = 9.06\n \"A\" = 8.17\n \"O\" = 7.51\n \"I\" = 6.97\n \"N\" = 6.75\n \"S\" = 6.33\n \"H\" = 6.09\n \"R\" = 5.99\n \"D\" = 4.25\n }\n}\n", Vn = "chart bar-vertical {\n // the headline above the chart\n title = \"China emits more CO₂ than the US and India combined\"\n description = \"Annual emissions in billion tonnes, 2023\"\n source = \"Our World in Data\"\n sourceUrl = \"https://ourworldindata.org/co2-emissions\"\n\n // one row per country: \"label\" = value\n data {\n \"China\" = 12.17\n \"United States\" = 4.92\n \"India\" = 3.06\n \"Russia\" = 1.73\n \"Japan\" = 0.99\n \"Germany\" = 0.59\n }\n\n // highlight pops one bar in the accent color\n highlight \"China\"\n\n // an annotation points a callout at a single bar\n annotation \"India\" {\n text = \"Surpassed EU in 2023\"\n showLine = true\n anchorDirection = N\n textOffsetX = 66\n textOffsetY = -41\n lineStyle = curve-left\n showArrow = true\n lineTargetDistance = 26\n showCircle = false\n }\n}\n", Hn = "chart bar-horizontal {\n title = \"Mandarin has nearly twice as many native speakers as Spanish\"\n description = \"Number of native speakers worldwide, in millions\"\n source = \"Ethnologue\"\n sourceUrl = \"https://ethnologue.com\"\n byline = \"Pierre Romera\"\n sort = descending\n\n highlight \"Mandarin\"\n\n data {\n \"Mandarin\" = 988\n \"Spanish\" = 487\n \"English\" = 372\n \"Hindi\" = 347\n \"Bengali\" = 232\n \"Portuguese\" = 252\n \"Russian\" = 133\n \"Japanese\" = 124\n }\n}\n", Un = "chart line-multi {\n title = \"China now buys more electric cars than the rest of the world combined\"\n description = \"Electric car sales by region, millions per year\"\n source = \"IEA Global EV Outlook 2024\"\n sourceUrl = \"https://www.iea.org/reports/global-ev-outlook-2024\"\n colorPalette = \"Maya\"\n tooltips = true\n\n data {\n series = \"China\",\"Europe\",\"United States\",\"Rest of world\"\n \"2018\" = 1.1,0.4,0.36,0.1\n \"2020\" = 1.3,1.4,0.30,0.2\n \"2021\" = 3.3,2.3,0.63,0.4\n \"2022\" = 6.0,2.7,1.0,0.7\n \"2023\" = 8.1,3.2,1.4,1.0\n }\n}\n", Wn = "chart bar-multi {\n title = \"USA tops Paris 2024 with 126 medals across all categories\"\n description = \"2024 Paris Summer Games — top six nations\"\n source = \"Olympics.com\"\n sourceUrl = \"https://olympics.com\"\n colors = \"#eeca3b, #c0c0c0, #cd7f32\"\n sort = descending\n\n data {\n series = \"Gold\",\"Silver\",\"Bronze\"\n \"USA\" = 40,44,42\n \"China\" = 40,27,24\n \"Japan\" = 20,12,13\n \"Great Britain\" = 14,22,29\n \"Australia\" = 18,19,16\n \"France\" = 16,26,22\n }\n}\n", Gn = "chart line {\n title = \"2024 was the hottest year on record\"\n description = \"Deviation from the 1951–1980 average, in °C\"\n source = \"NASA GISS\"\n sourceUrl = \"https://data.giss.nasa.gov/gistemp/\"\n tooltips = true\n crosshair = false\n lineSymbols = true\n\n data {\n \"1980\" = 0.26\n \"1985\" = 0.12\n \"1990\" = 0.45\n \"1995\" = 0.45\n \"2000\" = 0.39\n \"2005\" = 0.68\n \"2010\" = 0.73\n \"2015\" = 0.9\n \"2020\" = 1.01\n \"2024\" = 1.28\n }\n\n annotation \"2015\" {\n text = \"2015 Paris Agreement to limit global warming to 1.5°C \"\n maxWidth = 224\n showLine = true\n lineStyle = curve-right\n showArrow = true\n showCircle = true\n }\n}\n", Kn = "chart line {\n title = \"Bitcoin surged past $90,000 in 2024\"\n description = \"USD, year-end closing price\"\n source = \"CoinGecko\"\n sourceUrl = \"https://www.coingecko.com\"\n colors = \"#f7931a\"\n lineSymbols = true\n lineSymbolShowOn = \"all\"\n lineSymbolShape = \"diamond\"\n verticalNumberFormat = \",.0f\"\n tooltips = true\n\n annotation \"2021\" {\n text = \"All-time high cycle\"\n textOffsetY = -12\n showArrow = true\n }\n\n data {\n \"2016\" = 963\n \"2017\" = 14156\n \"2018\" = 3742\n \"2019\" = 7194\n \"2020\" = 29080\n \"2021\" = 46306\n \"2022\" = 16547\n \"2023\" = 42258\n \"2024\" = 93429\n }\n}\n", qn = "chart line-multi {\n title = \"The income share of the top 1% has surged since 1980\"\n description = \"Pre-tax national income captured by the top 1%, percent\"\n source = \"World Inequality Database\"\n sourceUrl = \"https://wid.world\"\n colorPalette = \"Egypt\"\n tooltips = true\n lineSymbols = true\n lineSymbolShowOn = \"all\"\n\n data {\n series = \"United States\",\"India\",\"China\",\"France\"\n \"1980\" = 10.4,7.5,6.6,7.5\n \"1990\" = 14.7,10.7,8.3,9.0\n \"2000\" = 17.3,10.5,10.5,11.3\n \"2010\" = 17.9,16.4,15.2,11.0\n \"2021\" = 19.9,22.1,15.7,12.7\n }\n\n scene \"US doubles\" {\n title = \"The US top 1% nearly doubled its income share since 1980\"\n highlight \"United States\"\n }\n\n scene \"India overtakes\" {\n title = \"India is now the most unequal of these major economies\"\n highlight \"India\"\n }\n\n scene \"France's modest rise\" {\n title = \"France's top 1% rose far less than the US or India\"\n highlight \"France\"\n }\n}\n", Jn = "chart pie {\n title = \"Asia is home to nearly 60% of the world's population\"\n description = \"Estimated share, 2024\"\n source = \"United Nations\"\n sourceUrl = \"https://population.un.org\"\n colorPalette = \"Klimt\"\n legendPosition = \"right\"\n tooltips = true\n\n data {\n \"Asia\" = 58.9\n \"Africa\" = 18.6\n \"Europe\" = 9.1\n \"Latin America\" = 8.1\n \"North America\" = 4.7\n }\n}\n", Yn = "chart bar-vertical {\n title = \"Brazil produces more coffee than the next three countries combined\"\n description = \"Million 60-kg bags, 2023/24 crop year\"\n source = \"USDA Foreign Agricultural Service\"\n sourceUrl = \"https://www.fas.usda.gov/data/coffee-world-markets-and-trade\"\n colorPalette = \"Harvey\"\n\n data {\n \"Brazil\" = 66.4\n \"Vietnam\" = 27.5\n \"Colombia\" = 12.76\n \"Ethiopia\" = 9.13\n \"Indonesia\" = 7.65\n \"Honduras\" = 5.5\n }\n\n highlight \"Brazil\"\n\n transform sort {\n column = \"value\"\n direction = descending\n }\n}\n", Xn = "chart donut {\n title = \"The richest 1% own more wealth than the entire bottom 90% combined\"\n description = \"Share of global wealth by group, 2021\"\n source = \"World Inequality Report 2022\"\n sourceUrl = \"https://wir2022.wid.world\"\n colorPalette = \"Imperator\"\n legendPosition = \"right\"\n displayAsPercentage = true\n tooltips = true\n\n data {\n \"Top 1%\" = 38\n \"Next 9%\" = 38\n \"Middle 40%\" = 22\n \"Bottom 50%\" = 2\n }\n\n scene \"Top 1% spotlight\" {\n title = \"The top 1% hold 38% of all global wealth\"\n description = \"Share of global wealth by group, 2021\"\n highlight \"Top 1%\"\n }\n\n scene \"Bottom half\" {\n title = \"The bottom half of humanity owns just 2%\"\n description = \"Share of global wealth by group, 2021\"\n highlight \"Bottom 50%\"\n }\n\n scene \"Income tells a softer story\" {\n title = \"Income is concentrated too — but less than wealth\"\n description = \"Share of global income by the same groups, 2021\"\n highlight \"Top 1%\"\n data {\n \"Top 1%\" = 19\n \"Next 9%\" = 33\n \"Middle 40%\" = 39\n \"Bottom 50%\" = 9\n }\n }\n}\n", Zn = "chart area {\n title = \"The US national debt has more than tripled since 2008\"\n description = \"Total federal debt outstanding, trillions of dollars\"\n source = \"U.S. Treasury, Fiscal Data\"\n sourceUrl = \"https://fiscaldata.treasury.gov\"\n\n annotation \"2008\" {\n text = \"Financial crisis\"\n showArrow = true\n textOffsetY = -14\n }\n\n data {\n \"2000\" = 5.7\n \"2004\" = 7.4\n \"2008\" = 10.0\n \"2012\" = 16.1\n \"2016\" = 19.6\n \"2020\" = 26.9\n \"2024\" = 35.5\n }\n}\n", Qn = "chart area-stacked {\n title = \"Renewables' share of global energy has more than doubled since 2000\"\n description = \"Share of global primary energy by source, 2000–2023\"\n source = \"Our World in Data\"\n sourceUrl = \"https://ourworldindata.org/energy-mix\"\n stackPercent = true\n areaSortMode = descending\n\n data {\n series = \"Coal\",\"Oil\",\"Gas\",\"Renewables\"\n \"2000\" = 27456,43017,23994,2997\n \"2005\" = 36201,47017,27439,3510\n \"2010\" = 42016,48193,31593,4868\n \"2015\" = 43695,51294,34780,6400\n \"2020\" = 42316,49101,38704,8569\n \"2023\" = 45319,54839,40151,10325\n }\n}\n", $n = "chart column-stacked {\n title = \"Natural gas and renewables pushed coal off the US power grid\"\n description = \"Share of US electricity generation by source, percent\"\n source = \"U.S. Energy Information Administration\"\n sourceUrl = \"https://www.eia.gov/electricity\"\n stackMode = \"percent\"\n\n data {\n series = \"Coal\",\"Natural gas\",\"Nuclear\",\"Renewables\"\n \"2010\" = 45,24,20,10\n \"2015\" = 33,33,20,13\n \"2020\" = 19,39,20,20\n \"2023\" = 16,43,19,21\n }\n}\n", er = "chart bar-stacked {\n title = \"India has far more children than China, and a workforce nearly as large\"\n description = \"Millions of people, 2023\"\n source = \"UN Population Division\"\n sourceUrl = \"https://population.un.org\"\n colorPalette = \"London\"\n\n data {\n series = \"0-14\",\"15-64\",\"65+\"\n \"China\" = 232,988,200\n \"India\" = 354,978,97\n \"USA\" = 58,216,59\n \"Indonesia\" = 67,189,21\n \"Brazil\" = 43,148,24\n }\n}\n", tr = "chart area-stacked {\n title = \"EU subsidies to new members surged after enlargement\"\n description = \"Agricultural subsidies to post-socialist EU members, million euros\"\n source = \"Eurostat\"\n sourceUrl = \"https://ec.europa.eu/eurostat\"\n colorPalette = \"Enara\"\n interpolation = \"linear\"\n heightMode = \"aspect-ratio\"\n aspectRatio = \"1:1\"\n\n data {\n series = \"Indirect subsidies\",\"Direct subsidies\"\n \"2000\" = 370,800\n \"2001\" = 445,896\n \"2002\" = 567,816\n \"2003\" = 641,950\n \"2004\" = 1908,2434\n \"2005\" = 2234,3509\n \"2006\" = 2576,4356\n \"2007\" = 2467,5429\n \"2008\" = 2672,6655\n \"2009\" = 2474,7195\n \"2010\" = 2117,8207\n \"2011\" = 1863,9230\n \"2012\" = 1528,9191\n \"2013\" = 1251,10252\n \"2014\" = 1132,10987\n \"2015\" = 1687,10145\n }\n\n scene \"Indirect subsidies shrank\" {\n title = \"Indirect subsidies were cut under WTO pressure\"\n description = \"Subsidies tied to specific crops fell foul of World Trade Organization rules\"\n\n highlight \"Indirect subsidies\"\n }\n\n scene \"Direct subsidies dominate\" {\n title = \"Direct per-hectare payments now dominate\"\n description = \"The larger the fields, the more money farmers receive\"\n\n highlight \"Direct subsidies\"\n }\n\n scene \"Bulgaria: subsidies explode\" {\n title = \"Bulgarian farmers received almost nothing before 2007 accession\"\n description = \"More than three-quarters of Bulgarian subsidies are direct payments — the highest share among new members\"\n\n data {\n series = \"Indirect subsidies\",\"Direct subsidies\"\n \"2000\" = 0,5\n \"2001\" = 0,33\n \"2002\" = 0,48\n \"2003\" = 0,69\n \"2004\" = 0,67\n \"2005\" = 0,87\n \"2006\" = 0,57\n \"2007\" = 59,250\n \"2008\" = 75,484\n \"2009\" = 97,415\n \"2010\" = 79,466\n \"2011\" = 94,458\n \"2012\" = 120,617\n \"2013\" = 132,852\n \"2014\" = 143,821\n \"2015\" = 213,677\n }\n\n highlight \"Direct subsidies\"\n }\n\n scene \"Bulgarian farms grew\" {\n title = \"Average farm size in Bulgaria quadrupled\"\n description = \"Average farm size in hectares\"\n type = line\n\n data {\n \"2005\" = 5\n \"2007\" = 6\n \"2010\" = 12\n \"2013\" = 18\n }\n }\n\n scene \"Production rose\" {\n title = \"Bulgarian farm production rose from 3 to 4 billion euros\"\n description = \"Total production of Bulgarian farms, million euros\"\n type = area\n\n data {\n \"2000\" = 2933\n \"2001\" = 3240\n \"2002\" = 3051\n \"2003\" = 2816\n \"2004\" = 3049\n \"2005\" = 3011\n \"2006\" = 3111\n \"2007\" = 3038\n \"2008\" = 4148\n \"2009\" = 3437\n \"2010\" = 3486\n \"2011\" = 4038\n \"2012\" = 4161\n \"2013\" = 4115\n \"2014\" = 4138\n \"2015\" = 3915\n }\n }\n\n scene \"Cash crops replaced vegetables\" {\n title = \"Cash crops replaced vegetables in Bulgaria\"\n description = \"Production of Bulgarian farms, million euros\"\n type = area-stacked\n\n data {\n series = \"Vegetables\",\"Cash crops\",\"Other production\"\n \"2000\" = 464,615,1854\n \"2001\" = 458,777,2005\n \"2002\" = 577,850,1624\n \"2003\" = 539,818,1459\n \"2004\" = 483,1103,1463\n \"2005\" = 492,994,1525\n \"2006\" = 510,1083,1518\n \"2007\" = 436,936,1666\n \"2008\" = 541,2045,1563\n \"2009\" = 243,1553,1641\n \"2010\" = 184,2173,1128\n \"2011\" = 120,2853,1065\n \"2012\" = 117,2900,1144\n \"2013\" = 139,2802,1174\n \"2014\" = 143,3082,914\n \"2015\" = 144,2986,785\n }\n\n highlight \"Cash crops\"\n }\n\n scene \"Vegetables collapsed\" {\n title = \"Vegetable production fell by a factor of three\"\n description = \"A traditional Bulgarian cultivation shrank as subsidies favoured large fields\"\n\n highlight \"Vegetables\"\n }\n\n scene \"Every vegetable declined\" {\n title = \"Bulgarian vegetable production collapsed across the board\"\n description = \"Production volume indexed to 2001 = 100\"\n type = line-multi\n lineSymbols = false\n\n data {\n series = \"Cabbages\",\"Tomatoes\",\"Watermelons\",\"Carrots\",\"Onions\",\"Garlic\",\"Strawberries\"\n \"2001\" = 100,100,100,100,100,100,100\n \"2002\" = 79,90,124,64,106,95,100\n \"2003\" = 100,157,177,142,118,98,72\n \"2004\" = 84,87,83,245,124,138,74\n \"2005\" = 50,46,62,30,40,93,42\n \"2006\" = 52,78,113,95,56,80,56\n \"2007\" = 36,49,64,74,29,30,38\n \"2008\" = 47,49,66,97,44,29,55\n \"2009\" = 28,38,74,105,23,39,55\n \"2010\" = 57,42,51,76,53,57,37\n \"2011\" = 32,38,56,86,47,43,45\n \"2012\" = 34,34,46,69,29,43,31\n \"2013\" = 33,43,53,39,36,40,24\n \"2014\" = 31,44,28,69,37,8,27\n \"2015\" = 31,45,50,57,25,18,32\n }\n }\n\n scene \"Jobs disappeared\" {\n title = \"Family farmers disappeared while salaried ag jobs held steady\"\n description = \"EU agricultural employment, thousands of full-time equivalents\"\n type = line-multi\n lineSymbols = false\n\n data {\n series = \"Salaried workers\",\"Non-salaried workers\"\n \"2000\" = 2678,12194\n \"2001\" = 2598,11586\n \"2002\" = 2658,10795\n \"2003\" = 2563,10609\n \"2004\" = 2560,9999\n \"2005\" = 2501,10047\n \"2006\" = 2499,9782\n \"2007\" = 2437,9231\n \"2008\" = 2416,8971\n \"2009\" = 2348,8672\n \"2010\" = 2335,7808\n \"2011\" = 2322,7551\n \"2012\" = 2325,7501\n \"2013\" = 2297,7425\n \"2014\" = 2366,7183\n \"2015\" = 2413,6928\n \"2016\" = 2457,6741\n }\n\n highlight \"Non-salaried workers\"\n }\n}\n", nr = "chart bar-horizontal {\n title = \"China emits more CO₂ than the US and India combined\"\n description = \"Annual emissions in billion tonnes, 2023\"\n source = \"Our World in Data\"\n sourceUrl = \"https://ourworldindata.org/co2-emissions\"\n byline = \"Pierre Romera\"\n\n data {\n \"China\" = 12.17\n \"United States\" = 4.92\n \"India\" = 3.06\n \"Russia\" = 1.73\n \"Japan\" = 0.99\n \"Germany\" = 0.59\n }\n\n scene \"China spotlight\" {\n title = \"China alone emits more than the US and India together\"\n highlight \"China\"\n }\n\n scene \"India rising\" {\n title = \"India passed the EU to become the third-largest emitter\"\n highlight \"India\"\n }\n\n scene \"Japan declining\" {\n title = \"Japan's emissions have fallen since their 2013 peak\"\n highlight \"Japan\"\n }\n\n scene \"Per capita reframe\" {\n title = \"Per person, Gulf states dwarf the biggest emitters\"\n description = \"CO₂ emissions per capita, tonnes per person, 2023\"\n highlight \"Qatar\"\n data {\n \"Qatar\" = 40.13\n \"United Arab Emirates\" = 19.77\n \"United States\" = 14.32\n \"China\" = 8.56\n \"India\" = 2.13\n }\n }\n}\n", rr = "chart bar-split {\n title = \"CDU/CSU led German polls at 29 % ahead of the 2021 election\"\n description = \"How Germany would vote in the September 2021 federal election, according to polling in the previous June\"\n source = \"FG Wahlen\"\n sourceUrl = \"https://www.forschungsgruppe.de\"\n note = \"Margin of error at 10%: +/- 2 percentage points; at 40%: +/- 3 percentage points\"\n\n data {\n series = \"Poll\",\"High\",\"Low\"\n \"CDU/CSU\" = 29,32,27\n \"Greens\" = 22,25,20\n \"SPD\" = 14,16,12\n \"AfD\" = 10,12,8\n \"FDP\" = 10,12,8\n \"Left\" = 7,9,5\n }\n}\n", ir = "chart bar-grouped {\n title = \"Asia Pacific holds more renewable capacity than all other regions combined\"\n description = \"Installed capacity in gigawatts (GW), 2023\"\n source = \"IRENA\"\n sourceUrl = \"https://www.irena.org/Publications/2024/Mar/Renewable-capacity-statistics-2024\"\n colorPalette = \"Folklore\"\n\n data {\n series = \"Solar\",\"Wind\",\"Hydro\"\n \"Asia Pacific\" = 870,520,650\n \"Europe\" = 290,260,230\n \"North America\" = 150,170,200\n \"Latin America\" = 50,40,190\n \"Africa\" = 12,9,40\n }\n}\n", ar = "chart scatter {\n title = \"Richer countries live longer, but Nigeria lags far behind its wealth\"\n description = \"Life expectancy in years against GDP per capita (PPP, constant international dollars, log scale), 60 countries, bubble size is population in millions\"\n source = \"World Bank, World Development Indicators\"\n sourceUrl = \"https://databank.worldbank.org/source/world-development-indicators\"\n horizontalScaleType = \"log\"\n trend = \"overall\"\n\n data {\n series = \"GDP per capita\",\"Life expectancy\",\"Population\",\"Region\"\n \"Argentina\" = 26630, 76.8, 45.0, \"Americas\"\n \"Australia\" = 58049, 82.9, 25.3, \"East Asia & Pacific\"\n \"Bangladesh\" = 6838, 72.6, 164.9, \"South Asia\"\n \"Bolivia\" = 11931, 67.8, 11.7, \"Americas\"\n \"Brazil\" = 18019, 75.8, 207.5, \"Americas\"\n \"Botswana\" = 18106, 67.2, 2.3, \"Sub-Saharan Africa\"\n \"Canada\" = 57584, 82.2, 37.6, \"Americas\"\n \"Switzerland\" = 81695, 83.9, 8.6, \"Europe & Central Asia\"\n \"Chile\" = 28228, 80.3, 19.2, \"Americas\"\n \"China\" = 18821, 77.9, 1407.7, \"East Asia & Pacific\"\n \"Cote d'Ivoire\" = 5895, 60.3, 28.2, \"Sub-Saharan Africa\"\n \"Colombia\" = 17337, 76.8, 49.9, \"Americas\"\n \"Costa Rica\" = 23497, 80.3, 5.0, \"Americas\"\n \"Germany\" = 62950, 81.3, 83.1, \"Europe & Central Asia\"\n \"Ecuador\" = 13870, 77.3, 17.3, \"Americas\"\n \"Egypt\" = 15027, 71.2, 107.6, \"Middle East, North Africa, Afghanistan & Pakistan\"\n \"Spain\" = 46896, 83.8, 47.1, \"Europe & Central Asia\"\n \"Ethiopia\" = 2438, 65.7, 115.7, \"Sub-Saharan Africa\"\n \"France\" = 53449, 82.8, 67.4, \"Europe & Central Asia\"\n \"United Kingdom\" = 53374, 81.4, 66.6, \"Europe & Central Asia\"\n \"Ghana\" = 6508, 64.5, 31.3, \"Sub-Saharan Africa\"\n \"Greece\" = 33503, 81.6, 10.7, \"Europe & Central Asia\"\n \"Guatemala\" = 11466, 71.6, 17.1, \"Americas\"\n \"Haiti\" = 3362, 64.3, 11.1, \"Americas\"\n \"Indonesia\" = 12758, 70.3, 272.5, \"East Asia & Pacific\"\n \"India\" = 7702, 70.7, 1389.0, \"South Asia\"\n \"Iran\" = 14841, 76.9, 87.1, \"Middle East, North Africa, Afghanistan & Pakistan\"\n \"Israel\" = 44492, 82.8, 9.1, \"Middle East, North Africa, Afghanistan & Pakistan\"\n \"Italy\" = 49691, 83.5, 59.7, \"Europe & Central Asia\"\n \"Jordan\" = 10168, 76.9, 10.7, \"Middle East, North Africa, Afghanistan & Pakistan\"\n \"Japan\" = 46055, 84.4, 126.6, \"East Asia & Pacific\"\n \"Kenya\" = 5172, 62.9, 51.2, \"Sub-Saharan Africa\"\n \"Cambodia\" = 6449, 70.1, 16.5, \"East Asia & Pacific\"\n \"South Korea\" = 49791, 83.2, 51.8, \"East Asia & Pacific\"\n \"Sri Lanka\" = 14637, 76.7, 21.8, \"South Asia\"\n \"Morocco\" = 8768, 74.2, 36.2, \"Middle East, North Africa, Afghanistan & Pakistan\"\n \"Mexico\" = 21704, 74.5, 125.8, \"Americas\"\n \"Malaysia\" = 31301, 75.9, 33.4, \"East Asia & Pacific\"\n \"Nigeria\" = 8362, 53.0, 209.5, \"Sub-Saharan Africa\"\n \"Norway\" = 90773, 83.0, 5.3, \"Europe & Central Asia\"\n \"New Zealand\" = 47392, 82.1, 5.0, \"East Asia & Pacific\"\n \"Pakistan\" = 5296, 66.7, 230.8, \"Middle East, North Africa, Afghanistan & Pakistan\"\n \"Peru\" = 15461, 76.3, 32.4, \"Americas\"\n \"Philippines\" = 9452, 69.7, 110.8, \"East Asia & Pacific\"\n \"Poland\" = 38182, 77.9, 38.0, \"Europe & Central Asia\"\n \"Portugal\" = 40188, 81.7, 10.3, \"Europe & Central Asia\"\n \"Romania\" = 36399, 75.6, 19.4, \"Europe & Central Asia\"\n \"Russia\" = 37319, 73.1, 145.5, \"Europe & Central Asia\"\n \"Rwanda\" = 2754, 66.7, 12.8, \"Sub-Saharan Africa\"\n \"Saudi Arabia\" = 62648, 78.3, 30.1, \"Middle East, North Africa, Afghanistan & Pakistan\"\n \"Senegal\" = 4071, 67.7, 16.4, \"Sub-Saharan Africa\"\n \"Sweden\" = 61071, 83.1, 10.3, \"Europe & Central Asia\"\n \"Thailand\" = 21280, 77.2, 71.5, \"East Asia & Pacific\"\n \"Turkey\" = 28741, 77.7, 82.6, \"Europe & Central Asia\"\n \"Tanzania\" = 3485, 66.0, 59.2, \"Sub-Saharan Africa\"\n \"Ukraine\" = 17637, 73.9, 45.0, \"Europe & Central Asia\"\n \"Uruguay\" = 30011, 77.5, 3.4, \"Americas\"\n \"United States\" = 69121, 78.8, 330.2, \"Americas\"\n \"Vietnam\" = 11629, 74.2, 97.2, \"East Asia & Pacific\"\n \"South Africa\" = 14353, 66.1, 59.6, \"Sub-Saharan Africa\" }\n\n highlight \"Nigeria\"\n\n annotation \"Nigeria\" {\n text = \"17 years below the trend\"\n showLine = true\n anchorDirection = SW\n textOffsetX = -60\n textOffsetY = 50\n lineStyle = elbow\n showArrow = false\n lineTargetDistance = 10\n }\n\n scene \"1990\" {\n title = \"In 1990 the same countries were poorer and lived shorter lives\"\n data {\n series = \"GDP per capita\",\"Life expectancy\",\"Population\",\"Region\"\n \"Argentina\" = 17007, 71.6, 32.8, \"Americas\"\n \"Australia\" = 36268, 77.0, 17.1, \"East Asia & Pacific\"\n \"Bangladesh\" = 2070, 55.8, 111.6, \"South Asia\"\n \"Bolivia\" = 6247, 56.8, 7.1, \"Americas\"\n \"Brazil\" = 12633, 65.9, 149.1, \"Americas\"\n \"Botswana\" = 10521, 60.1, 1.3, \"Sub-Saharan Africa\"\n \"Canada\" = 40475, 77.4, 27.7, \"Americas\"\n \"Switzerland\" = 63921, 77.2, 6.7, \"Europe & Central Asia\"\n \"Chile\" = 10955, 73.7, 13.4, \"Americas\"\n \"China\" = 1667, 68.2, 1135.2, \"East Asia & Pacific\"\n \"Cote d'Ivoire\" = 5256, 52.8, 12.2, \"Sub-Saharan Africa\"\n \"Colombia\" = 9999, 68.7, 32.4, \"Americas\"\n \"Costa Rica\" = 10980, 76.1, 3.1, \"Americas\"\n \"Germany\" = 42355, 75.1, 79.4, \"Europe & Central Asia\"\n \"Ecuador\" = 9105, 68.4, 10.5, \"Americas\"\n \"Egypt\" = 8007, 62.5, 58.4, \"Middle East, North Africa, Afghanistan & Pakistan\"\n \"Spain\" = 31773, 76.8, 38.9, \"Europe & Central Asia\"\n \"Ethiopia\" = 874, 45.1, 47.6, \"Sub-Saharan Africa\"\n \"France\" = 38656, 76.6, 58.3, \"Europe & Central Asia\"\n \"United Kingdom\" = 33531, 75.9, 57.2, \"Europe & Central Asia\"\n \"Ghana\" = 2786, 55.4, 15.4, \"Sub-Saharan Africa\"\n \"Greece\" = 26916, 76.9, 10.2, \"Europe & Central Asia\"\n \"Guatemala\" = 7595, 61.8, 9.0, \"Americas\"\n \"Haiti\" = 3923, 53.2, 6.9, \"Americas\"\n \"Indonesia\" = 4873, 63.2, 183.5, \"East Asia & Pacific\"\n \"India\" = 2140, 58.6, 865.0, \"South Asia\"\n \"Iran\" = 9656, 64.1, 58.4, \"Middle East, North Africa, Afghanistan & Pakistan\"\n \"Israel\" = 25341, 76.6, 4.7, \"Middle East, North Africa, Afghanistan & Pakistan\"\n \"Italy\" = 42657, 77.0, 56.7, \"Europe & Central Asia\"\n \"Jordan\" = 8242, 70.1, 3.6, \"Middle East, North Africa, Afghanistan & Pakistan\"\n \"Japan\" = 36138, 78.8, 123.5, \"East Asia & Pacific\"\n \"Kenya\" = 4177, 58.3, 22.9, \"Sub-Saharan Africa\"\n \"Cambodia\" = 2646, 55.2, 7.4, \"East Asia & Pacific\"\n \"South Korea\" = 14378, 71.6, 42.9, \"East Asia & Pacific\"\n \"Sri Lanka\" = 4562, 69.2, 16.4, \"South Asia\"\n \"Morocco\" = 4419, 62.4, 24.4, \"Middle East, North Africa, Afghanistan & Pakistan\"\n \"Mexico\" = 17170, 69.0, 82.8, \"Americas\"\n \"Malaysia\" = 12014, 71.0, 17.8, \"East Asia & Pacific\"\n \"Nigeria\" = 5424, 45.7, 97.1, \"Sub-Saharan Africa\"\n \"Norway\" = 56608, 76.5, 4.2, \"Europe & Central Asia\"\n \"New Zealand\" = 30786, 75.4, 3.3, \"East Asia & Pacific\"\n \"Pakistan\" = 3200, 59.7, 116.2, \"Middle East, North Africa, Afghanistan & Pakistan\"\n \"Peru\" = 6316, 64.0, 22.0, \"Americas\"\n \"Philippines\" = 4504, 64.4, 62.9, \"East Asia & Pacific\"\n \"Poland\" = 12821, 70.9, 38.1, \"Europe & Central Asia\"\n \"Portugal\" = 27191, 74.0, 10.0, \"Europe & Central Asia\"\n \"Romania\" = 16317, 69.7, 23.2, \"Europe & Central Asia\"\n \"Russia\" = 29644, 68.9, 148.0, \"Europe & Central Asia\"\n \"Rwanda\" = 1166, 47.8, 7.4, \"Sub-Saharan Africa\"\n \"Saudi Arabia\" = 65197, 68.9, 10.6, \"Middle East, North Africa, Afghanistan & Pakistan\"\n \"Senegal\" = 2923, 56.7, 7.7, \"Sub-Saharan Africa\"\n \"Sweden\" = 40200, 77.5, 8.6, \"Europe & Central Asia\"\n \"Thailand\" = 8703, 68.9, 54.7, \"East Asia & Pacific\"\n \"Turkey\" = 12184, 67.8, 56.0, \"Europe & Central Asia\"\n \"Tanzania\" = 1794, 52.0, 26.1, \"Sub-Saharan Africa\"\n \"Ukraine\" = 22816, 70.4, 52.1, \"Europe & Central Asia\"\n \"Uruguay\" = 14061, 73.0, 3.1, \"Americas\"\n \"United States\" = 44384, 75.2, 249.6, \"Americas\"\n \"Vietnam\" = 2468, 69.0, 65.5, \"East Asia & Pacific\"\n \"South Africa\" = 10811, 62.9, 40.7, \"Sub-Saharan Africa\" }\n }\n}\n";
782
894
  //#endregion
783
895
  //#region src/samples.ts
784
- function Hn(e, t) {
896
+ function or(e, t) {
785
897
  let n = e.properties.find((e) => e.key === t);
786
898
  return n ? String(n.value) : "";
787
899
  }
788
- function Un(e) {
900
+ function sr(e) {
789
901
  if (!e.data) return "";
790
902
  let t = e.data.entries, n = t.find((e) => e.key === "series" && !e.quotedKey);
791
903
  return n ? [["category", ...String(n.value).split(",")].join(" "), ...t.filter((e) => !(e.key === "series" && !e.quotedKey)).map((e) => {
@@ -793,59 +905,60 @@ function Un(e) {
793
905
  return [e.key, ...t].join(" ");
794
906
  })].join("\n") : [["label", "value"].join(" "), ...t.map((e) => [e.key, String(e.value)].join(" "))].join("\n");
795
907
  }
796
- function Wn(e) {
908
+ function cr(e) {
797
909
  if (!e.data) return "";
798
910
  let t = e.data.entries, n = t.find((e) => e.key === "series" && !e.quotedKey);
799
911
  return n ? [`series = "${String(n.value)}"`, ...t.filter((e) => !(e.key === "series" && !e.quotedKey)).map((e) => `"${e.key}" = "${String(e.value)}"`)].join("\n") : t.map((e) => `"${e.key}" = ${String(e.value)}`).join("\n");
800
912
  }
801
- function K(e, t) {
802
- let n = b(t);
913
+ function q(e, t) {
914
+ let n = x(t);
803
915
  return {
804
916
  id: e,
805
- title: Hn(n, "title"),
806
- description: Hn(n, "description"),
917
+ title: or(n, "title"),
918
+ description: or(n, "description"),
807
919
  chartType: n.chartType,
808
- tsvData: Un(n),
809
- serializedData: Wn(n),
920
+ tsvData: sr(n),
921
+ serializedData: cr(n),
810
922
  dsl: t
811
923
  };
812
924
  }
813
- var Gn = [
814
- K("letter-frequency", Cn),
815
- K("co2-emissions", wn),
816
- K("coffee-production", Mn),
817
- K("spoken-languages", Tn),
818
- K("quarterly-revenue", En),
819
- K("medal-count", Dn),
820
- K("temperature-anomaly", On),
821
- K("bitcoin-price", kn),
822
- K("unemployment-rates", An),
823
- K("browser-market", Nn),
824
- K("world-population", jn),
825
- K("stock-price-area", Pn),
826
- K("energy-mix-stacked-area", Fn),
827
- K("quarterly-stacked-columns", In),
828
- K("population-stacked-bar", Ln),
829
- K("election-polls", Bn),
830
- K("renewable-capacity", Vn),
831
- K("farm-compass", Rn),
832
- K("co2-emissions-story", zn)
833
- ], Kn = class extends Error {
925
+ var lr = [
926
+ q("letter-frequency", Bn),
927
+ q("co2-emissions", Vn),
928
+ q("coffee-production", Yn),
929
+ q("spoken-languages", Hn),
930
+ q("quarterly-revenue", Un),
931
+ q("medal-count", Wn),
932
+ q("temperature-anomaly", Gn),
933
+ q("bitcoin-price", Kn),
934
+ q("unemployment-rates", qn),
935
+ q("browser-market", Xn),
936
+ q("world-population", Jn),
937
+ q("stock-price-area", Zn),
938
+ q("energy-mix-stacked-area", Qn),
939
+ q("quarterly-stacked-columns", $n),
940
+ q("population-stacked-bar", er),
941
+ q("election-polls", rr),
942
+ q("renewable-capacity", ir),
943
+ q("farm-compass", tr),
944
+ q("co2-emissions-story", nr),
945
+ q("life-expectancy-wealth", ar)
946
+ ], ur = class extends Error {
834
947
  constructor(e, t) {
835
948
  super(e, t), this.name = "ChartParseError";
836
949
  }
837
- }, qn = class extends Error {
950
+ }, dr = class extends Error {
838
951
  constructor(e = "PNG export is only available in Node. Use toSvg() in the browser.") {
839
952
  super(e), this.name = "PngBrowserUnsupportedError";
840
953
  }
841
- }, Jn = class extends Error {
954
+ }, fr = class extends Error {
842
955
  constructor(e) {
843
956
  super(e), this.name = "MissingNodeRenderDepsError";
844
957
  }
845
958
  };
846
959
  //#endregion
847
960
  //#region src/render/backends/dom-backend.ts
848
- function Yn() {
961
+ function pr() {
849
962
  return {
850
963
  kind: "dom",
851
964
  createContainer(e, t) {
@@ -856,7 +969,7 @@ function Yn() {
856
969
  };
857
970
  },
858
971
  renderToContainer(e, t, n) {
859
- nt(e, t, {
972
+ it(e, t, {
860
973
  sceneIndex: n.sceneIndex,
861
974
  thumbnail: n.thumbnail ?? !1,
862
975
  transition: !1,
@@ -875,23 +988,23 @@ function Yn() {
875
988
  throw Error("dom-backend: renderToContainer produced no frame");
876
989
  },
877
990
  rasterizePng() {
878
- return Promise.reject(new qn());
991
+ return Promise.reject(new dr());
879
992
  }
880
993
  };
881
994
  }
882
995
  //#endregion
883
996
  //#region src/render/frame-svg.ts
884
- var Xn = {
997
+ var mr = {
885
998
  background: "#ffffff",
886
999
  color: "#333333"
887
- }, Zn = {
1000
+ }, hr = {
888
1001
  background: "#1c1c1c",
889
1002
  color: "rgba(255, 255, 255, 0.9)"
890
- }, Qn = "sans-serif", $n = 20, q = 14, J = 12, Y = 1.25, er = 4, tr = 8, nr = 12, rr = 40, ir = "16px", ar = "Blueprint Chart", or = "Source: ", sr = " · ", cr = .6;
891
- function lr(e) {
892
- return e === "dark" ? { ...Zn } : { ...Xn };
1003
+ }, gr = "sans-serif", _r = 20, vr = 14, J = 12, Y = 1.25, yr = 4, br = 8, xr = 12, Sr = 40, Cr = "16px", wr = "Blueprint Chart", Tr = "Source: ", Er = " · ", Dr = .6;
1004
+ function Or(e) {
1005
+ return e === "dark" ? { ...hr } : { ...mr };
893
1006
  }
894
- function ur() {
1007
+ function kr() {
895
1008
  if (typeof document > "u") return null;
896
1009
  try {
897
1010
  return document.createElement("canvas").getContext("2d");
@@ -899,11 +1012,11 @@ function ur() {
899
1012
  return null;
900
1013
  }
901
1014
  }
902
- function dr() {
903
- let e = ur();
1015
+ function Ar() {
1016
+ let e = kr();
904
1017
  return (t, n, r) => {
905
- let i = t.length * n * cr;
906
- return e ? (e.font = `${r ? "bold " : ""}${n}px ${Qn}`, Math.max(e.measureText(t).width, i)) : i;
1018
+ let i = t.length * n * Dr;
1019
+ return e ? (e.font = `${r ? "bold " : ""}${n}px ${gr}`, Math.max(e.measureText(t).width, i)) : i;
907
1020
  };
908
1021
  }
909
1022
  function X(e, t, n, r, i) {
@@ -934,37 +1047,37 @@ function Z(e, t, n) {
934
1047
  }), r += n.fontSize * Y;
935
1048
  return r;
936
1049
  }
937
- function fr(e) {
1050
+ function jr(e) {
938
1051
  let t = parseFloat(e) || 0;
939
1052
  return /r?em$/.test(e) ? t * 16 : t;
940
1053
  }
941
- function pr(e) {
942
- let t = e.frame ?? {}, n = lr(e.theme), [r, i, a, o] = je(t.padding ?? ir).map(fr), s = Math.max(e.width - o - i, 1), c = dr(), l = [], u = r;
943
- t.title && (u = Z(l, X(t.title, s, $n, !0, c), {
1054
+ function Mr(e) {
1055
+ let t = e.frame ?? {}, n = Or(e.theme), [r, i, a, o] = s(t.padding ?? Cr).map(jr), c = Math.max(e.width - o - i, 1), l = Ar(), u = [], d = r;
1056
+ t.title && (d = Z(u, X(t.title, c, _r, !0, l), {
944
1057
  x: o,
945
- top: u,
946
- fontSize: $n,
1058
+ top: d,
1059
+ fontSize: _r,
947
1060
  fontWeight: "bold",
948
1061
  fill: n.color
949
- })), t.description && (u = Z(l, X(t.description, s, q, !1, c), {
1062
+ })), t.description && (d = Z(u, X(t.description, c, vr, !1, l), {
950
1063
  x: o,
951
- top: t.title ? u + er : u,
952
- fontSize: q,
1064
+ top: t.title ? d + yr : d,
1065
+ fontSize: vr,
953
1066
  fill: n.color
954
1067
  }));
955
- let d = u, f = t.note ? X(t.note, s, J, !1, c) : [], p = c(ar, J, !1), m = [t.byline, t.source ? or + t.source : ""].filter(Boolean).join(sr), h = m ? X(m, Math.max(s - p - nr, 1), J, !1, c) : [], g = Math.max(h.length, 1), _ = f.length * J * Y + tr + g * J * Y + a, v = Math.max(e.height - d - _, rr), y = d + v;
956
- return y = Z(l, f, {
1068
+ let f = d, p = t.note ? X(t.note, c, J, !1, l) : [], m = l(wr, J, !1), h = [t.byline, t.source ? Tr + t.source : ""].filter(Boolean).join(Er), g = h ? X(h, Math.max(c - m - xr, 1), J, !1, l) : [], ee = Math.max(g.length, 1), _ = p.length * J * Y + br + ee * J * Y + a, v = Math.max(e.height - f - _, Sr), y = f + v;
1069
+ return y = Z(u, p, {
957
1070
  x: o,
958
1071
  top: y,
959
1072
  fontSize: J,
960
1073
  fontStyle: "italic",
961
1074
  fill: n.color
962
- }) + tr, Z(l, h, {
1075
+ }) + br, Z(u, g, {
963
1076
  x: o,
964
1077
  top: y,
965
1078
  fontSize: J,
966
1079
  fill: n.color
967
- }), Z(l, [ar], {
1080
+ }), Z(u, [wr], {
968
1081
  x: e.width - i,
969
1082
  top: y,
970
1083
  fontSize: J,
@@ -976,14 +1089,14 @@ function pr(e) {
976
1089
  height: e.height,
977
1090
  plot: {
978
1091
  x: o,
979
- y: d,
980
- width: s,
1092
+ y: f,
1093
+ width: c,
981
1094
  height: v
982
1095
  },
983
- blocks: l,
1096
+ blocks: u,
984
1097
  background: t.transparentBackground ? null : n.background,
985
1098
  color: n.color,
986
- fontFamily: Qn
1099
+ fontFamily: gr
987
1100
  };
988
1101
  }
989
1102
  function Q(e) {
@@ -992,7 +1105,7 @@ function Q(e) {
992
1105
  function $(e) {
993
1106
  return Q(e).replace(/"/g, "&quot;");
994
1107
  }
995
- function mr(e, t) {
1108
+ function Nr(e, t) {
996
1109
  return [
997
1110
  `<text x="${e.x}" y="${e.y}" font-size="${e.fontSize}px"`,
998
1111
  e.fontFamily ? ` font-family="${$(e.fontFamily)}"` : "",
@@ -1004,7 +1117,7 @@ function mr(e, t) {
1004
1117
  "</text>"
1005
1118
  ].join("");
1006
1119
  }
1007
- function hr(e, t, n) {
1120
+ function Pr(e, t, n) {
1008
1121
  return [
1009
1122
  `<svg xmlns="http://www.w3.org/2000/svg" width="${e.width}" height="${e.height}"`,
1010
1123
  ` viewBox="0 0 ${e.width} ${e.height}" role="img" aria-label="${$(n.label)}"`,
@@ -1012,34 +1125,34 @@ function hr(e, t, n) {
1012
1125
  `<title>${Q(n.label)}</title>`,
1013
1126
  `<desc>${Q(n.description)}</desc>`,
1014
1127
  e.background ? `<rect width="100%" height="100%" fill="${$(e.background)}"></rect>` : "",
1015
- ...e.blocks.map((t) => mr(t, e)),
1128
+ ...e.blocks.map((t) => Nr(t, e)),
1016
1129
  `<g transform="translate(${e.plot.x},${e.plot.y})">${t}</g>`,
1017
1130
  "</svg>"
1018
1131
  ].join("");
1019
1132
  }
1020
1133
  //#endregion
1021
1134
  //#region src/render/public-render.ts
1022
- var gr = 640, _r = 400;
1023
- function vr() {
1135
+ var Fr = 640, Ir = 400;
1136
+ function Lr() {
1024
1137
  return typeof document < "u" && typeof document.createElement == "function";
1025
1138
  }
1026
- async function yr() {
1027
- return vr() ? Yn() : (await import("@blueprint-chart/lib/internal/node-backend")).createNodeBackend();
1139
+ async function Rr() {
1140
+ return Lr() ? pr() : (await import("@blueprint-chart/lib/internal/node-backend")).createNodeBackend();
1028
1141
  }
1029
- async function br(e, t = {}) {
1142
+ async function zr(e, t = {}) {
1030
1143
  let n;
1031
1144
  try {
1032
- n = Me(b(e));
1145
+ n = Me(x(e));
1033
1146
  } catch (e) {
1034
- throw new Kn(e instanceof Error ? e.message : String(e), { cause: e });
1147
+ throw new ur(e instanceof Error ? e.message : String(e), { cause: e });
1035
1148
  }
1036
- let r = await yr(), i = t.frame ?? !0, a = {
1149
+ let r = await Rr(), i = t.frame ?? !0, a = {
1037
1150
  sceneIndex: t.scene,
1038
- width: t.width ?? gr,
1039
- height: t.height ?? _r
1151
+ width: t.width ?? Fr,
1152
+ height: t.height ?? Ir
1040
1153
  };
1041
1154
  function o(e, t) {
1042
- let { background: n, color: r } = lr(t);
1155
+ let { background: n, color: r } = Or(t);
1043
1156
  e.style.backgroundColor = n, e.style.setProperty("--bc-text-color", r);
1044
1157
  }
1045
1158
  function s(e, i) {
@@ -1050,7 +1163,7 @@ async function br(e, t = {}) {
1050
1163
  });
1051
1164
  }
1052
1165
  function c(e) {
1053
- let c = e.width ?? a.width, l = e.height ?? a.height, u = Ke(n, a.sceneIndex), d = t.theme ?? u.theme;
1166
+ let c = e.width ?? a.width, l = e.height ?? a.height, u = Je(n, a.sceneIndex), d = t.theme ?? u.theme;
1054
1167
  if (!i) {
1055
1168
  let { container: e, cleanup: t } = r.createContainer(c, l);
1056
1169
  try {
@@ -1059,7 +1172,7 @@ async function br(e, t = {}) {
1059
1172
  t();
1060
1173
  }
1061
1174
  }
1062
- let f = pr({
1175
+ let f = Mr({
1063
1176
  width: c,
1064
1177
  height: l,
1065
1178
  frame: u.frame,
@@ -1067,8 +1180,8 @@ async function br(e, t = {}) {
1067
1180
  }), { container: p, cleanup: m } = r.createContainer(f.plot.width, f.plot.height);
1068
1181
  try {
1069
1182
  o(p, d), s(p, !0);
1070
- let e = ut(u.chartType, u.frame, u.data);
1071
- return hr(f, r.serializeSvg(p), e);
1183
+ let e = pt(u.chartType, u.frame, u.data);
1184
+ return Pr(f, r.serializeSvg(p), e);
1072
1185
  } finally {
1073
1186
  m();
1074
1187
  }
@@ -1105,4 +1218,4 @@ async function br(e, t = {}) {
1105
1218
  return l;
1106
1219
  }
1107
1220
  //#endregion
1108
- export { yt as ANNOTATION_KIND_KEYWORD, Tt as Anchor, S as AnnotationKind, Ct as AnnotationLineStyle, ge as AxisDirection, fe as BC_TRANSITION_NAME, o as ChartOptionType, Kn as ChartParseError, xt as ChartType, ve as CompassDirection, u as CrosshairDirection, c as CrosshairStyle, tt as DEFAULT_BAR_GAP, ue as DirectLabelMode, Ze as DslNodeType, n as FilterCondition, Ye as FrameSizing, oe as GridStyle, ce as Interpolation, de as LabelPosition, f as LabelRotation, v as LegendPosition, ie as LineStyle, Jn as MissingNodeRenderDepsError, vt as NULL_VALUE, me as Orientation, Et as ParseOperationCategory, qn as PngBrowserUnsupportedError, i as RangeAnchor, xe as ScaleType, we as SceneTransition, g as SortDirection, ye as SortMode, Ce as StackMode, m as StrokeStyle, ne as SymbolShape, lt as SymbolShowOn, ee as SymbolStyle, it as TRANSFORM_TYPES, De as TickPosition, Te as TransformType, ke as ValueLabelPosition, _t as adjustColorsForBackground, ft as applyTransformNodes, Fe as applyTransformNodesToChartData, Qe as applyTransformSteps, Me as astToDefinition, re as buildChartOptions, hr as buildFrameSvg, Dt as buildSrcdoc, Le as chartDataToTable, Vt as checkCvdColors, T as classifyIntent, Be as cleanNumericValue, Ne as commitFadeOut, Zt as compactSerialize, Xt as compactSerializeDeep, bt as convertAnnotations, _e as convertAreaFills, l as convertColorizes, s as convertHighlights, le as convertSeriesOverrides, $e as createCanvas, Lt as createCvdSvgFilter, Ue as createFrame, Xe as dataEntriesToString, ot as detectColumnTypes, t as extractChartTypeOptions, Je as extractSceneOverrides, at as fadeIn, y as featureJoin, e as getCachedChart, be as getChart, h as getChartOptions, d as getChartTypeDefaults, It as getCvdFilterId, Pe as getOutputType, Oe as getSceneTransition, pt as getTransitionDuration, et as isDateValue, We as isNumberValue, p as isSeriesHidden, St as isTypeCompatible, x as listCharts, ze as listPalettes, Nt as listThemes, b as parse, He as parseBpcData, pe as parseData, he as parseOperationMap, a as parseOperations, ae as propertyMap, C as quoteDslString, jt as recommendCharts, Se as registerChart, br as render, mt as renderBpc, nt as renderChart, dt as renderHorizontalAxis, rt as renderLegend, qe as renderVerticalAxis, Re as resolveBackgroundColor, Ge as resolveBarGapPadding, _ as resolveChartTypeOptions, ht as resolvePalette, Ke as resolveScene, te as resolveSeriesColor, ct as resolveSeriesInterpolation, Gn as samples, Kt as serialize, Ae as serializeTableData, O as shapeOf, zt as simulateCvdColor, Ie as snapshotForFadeOut, Ee as snapshotLiveAttrs, r as stripDigitGroupSpaces, se as toBool, gt as transformNodesToSteps, wt as transformValue, yn as validateChart, Ve as wcagContrastRatio, st as wcagLevel };
1221
+ export { Et as ANNOTATION_KIND_KEYWORD, ye as Anchor, d as AnnotationKind, l as AnnotationLineStyle, ue as AxisDirection, Ne as BC_TRANSITION_NAME, $e as ChartOptionType, ur as ChartParseError, r as ChartType, Ze as CompassDirection, oe as CrosshairDirection, ce as CrosshairStyle, Fe as DEFAULT_BAR_GAP, de as DirectLabelMode, p as DslNodeType, v as FilterCondition, ae as FrameSizing, he as GridStyle, jt as Interpolation, a as LabelPosition, Se as LabelRotation, ee as LegendPosition, be as LineStyle, y as MAPPING_NONE, fr as MissingNodeRenderDepsError, Ct as NULL_VALUE, we as Orientation, h as ParseOperationCategory, dr as PngBrowserUnsupportedError, re as RangeAnchor, ft as ScaleType, ot as SceneTransition, te as SortDirection, De as SortMode, Te as StackMode, ke as StrokeStyle, pe as SymbolShape, t as SymbolShowOn, Be as SymbolStyle, st as TRANSFORM_TYPES, yt as TickPosition, at as TransformType, mt as ValueLabelPosition, Ge as adjustColorsForBackground, gt as applyTransformNodes, Ie as applyTransformNodesToChartData, et as applyTransformSteps, Me as astToDefinition, ie as buildChartOptions, Pr as buildFrameSvg, Mt as buildSrcdoc, Re as chartDataToTable, qt as checkCvdColors, E as classifyIntent, He as cleanNumericValue, ze as commitFadeOut, nn as compactSerialize, tn as compactSerializeDeep, Tt as convertAnnotations, ve as convertAreaFills, u as convertColorizes, c as convertHighlights, le as convertSeriesOverrides, qe as createCanvas, Ut as createCvdSvgFilter, _e as createFrame, Qe as dataEntriesToString, lt as detectColumnTypes, n as extractChartTypeOptions, Xe as extractSceneOverrides, Ue as fadeIn, Ve as featureJoin, Ye as getCachedChart, xe as getChart, g as getChartOptions, f as getChartTypeDefaults, Ht as getCvdFilterId, Pe as getOutputType, ht as getSceneTransition, ut as getTransitionDuration, nt as isDateValue, Ke as isNumberValue, Oe as isSeriesHidden, Dt as isTypeCompatible, S as listCharts, ct as listPalettes, zt as listThemes, Ee as numericColumns, x as parse, We as parseBpcData, me as parseData, ge as parseOperationMap, o as parseOperations, b as propertyMap, w as quoteDslString, Lt as recommendCharts, Ce as registerChart, zr as render, vt as renderBpc, it as renderChart, tt as renderHorizontalAxis, Le as renderLegend, St as renderVerticalAxis, je as resolveBackgroundColor, Ot as resolveBarGapPadding, _ as resolveChartTypeOptions, _t as resolvePalette, C as resolveScatterMapping, Je as resolveScene, fe as resolveSeriesColor, e as resolveSeriesInterpolation, lr as samples, Zt as serialize, Ae as serializeTableData, Ft as shapeOf, Gt as simulateCvdColor, rt as snapshotForFadeOut, bt as snapshotLiveAttrs, i as stripDigitGroupSpaces, se as toBool, xt as transformNodesToSteps, kt as transformValue, Pn as validateChart, wt as wcagContrastRatio, At as wcagLevel };