phoria2 1.1.0 → 1.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (81) hide show
  1. package/README.md +70 -13
  2. package/dist/bloom.js +4 -4
  3. package/dist/bloom.js.map +1 -1
  4. package/dist/charts.js +538 -508
  5. package/dist/charts.js.map +1 -1
  6. package/dist/core.js +4270 -3652
  7. package/dist/core.js.map +1 -1
  8. package/dist/edit.js +65 -65
  9. package/dist/edit.js.map +1 -1
  10. package/dist/explain.js +6 -2
  11. package/dist/explain.js.map +1 -1
  12. package/dist/gltf.js +116 -116
  13. package/dist/gltf.js.map +1 -1
  14. package/dist/keyboard.js +188 -0
  15. package/dist/keyboard.js.map +1 -0
  16. package/dist/motion.js +35 -35
  17. package/dist/motion.js.map +1 -1
  18. package/dist/particles.js +188 -115
  19. package/dist/particles.js.map +1 -1
  20. package/dist/passes.js +29 -29
  21. package/dist/passes.js.map +1 -1
  22. package/dist/phoria2.js +1 -1
  23. package/dist/picking.js +32 -16
  24. package/dist/picking.js.map +1 -1
  25. package/dist/snapshot.js +1 -1
  26. package/dist/tooltip.js +1 -1
  27. package/dist/types/OrbitControl.d.ts +6 -2
  28. package/dist/types/Raycaster.d.ts +10 -0
  29. package/dist/types/View.d.ts +70 -1
  30. package/dist/types/area.d.ts +18 -0
  31. package/dist/types/charts/Chart.d.ts +7 -0
  32. package/dist/types/explain.d.ts +3 -0
  33. package/dist/types/frame.d.ts +7 -0
  34. package/dist/types/geometry/Geometry.d.ts +24 -2
  35. package/dist/types/index.d.ts +2 -0
  36. package/dist/types/keyboard.d.ts +48 -0
  37. package/dist/types/labels.d.ts +4 -0
  38. package/dist/types/material/Material.d.ts +15 -0
  39. package/dist/types/material/Texture.d.ts +18 -2
  40. package/dist/types/particles/Emitter.d.ts +39 -2
  41. package/dist/types/scene/Node.d.ts +19 -14
  42. package/dist/types/scene/drawables.d.ts +54 -15
  43. package/dist/types/scene/lights.d.ts +16 -2
  44. package/dist/types/shadow.d.ts +2 -1
  45. package/dist/types/types.d.ts +14 -0
  46. package/dist/types/value/Color.d.ts +0 -4
  47. package/dist/types/value/Quat.d.ts +4 -2
  48. package/dist/types/webgl/resources.d.ts +12 -2
  49. package/dist/types/webgl/shaders.d.ts +7 -2
  50. package/llms-full.txt +106 -10
  51. package/package.json +4 -1
  52. package/schema/scene.schema.json +67 -1
  53. package/src/OrbitControl.js +7 -3
  54. package/src/Raycaster.js +58 -0
  55. package/src/View.js +220 -41
  56. package/src/area.js +131 -0
  57. package/src/charts/Chart.js +20 -2
  58. package/src/charts/marks.js +29 -2
  59. package/src/explain.js +6 -2
  60. package/src/frame.js +29 -9
  61. package/src/geometry/Geometry.js +32 -4
  62. package/src/index.js +1 -0
  63. package/src/keyboard.js +298 -0
  64. package/src/labels.js +4 -1
  65. package/src/material/Material.js +9 -2
  66. package/src/material/Texture.js +55 -2
  67. package/src/particles/Emitter.js +121 -10
  68. package/src/scene/Node.js +20 -9
  69. package/src/scene/Scene.js +2 -0
  70. package/src/scene/cameras.js +4 -1
  71. package/src/scene/drawables.js +115 -15
  72. package/src/scene/lights.js +40 -6
  73. package/src/shadow.js +27 -4
  74. package/src/types.js +6 -0
  75. package/src/value/Color.js +21 -0
  76. package/src/value/Quat.js +15 -6
  77. package/src/watch.js +14 -2
  78. package/src/webgl/WebGLRenderer.js +36 -5
  79. package/src/webgl/picking.js +22 -1
  80. package/src/webgl/resources.js +168 -14
  81. package/src/webgl/shaders.js +110 -11
package/dist/charts.js CHANGED
@@ -1,32 +1,32 @@
1
- import { At as e, C as t, Ft as n, Ot as r, R as i, S as a, Tt as o, Z as s, _t as c, b as l, it as u, kt as d, l as f, m as p, n as m, rt as h, w as g, x as _ } from "./core.js";
1
+ import { $ as e, At as t, Et as n, It as r, Q as i, V as a, Z as o, et as s, it as c, jt as l, kt as u, l as d, lt as f, m as p, n as m, rt as h, st as g, tt as _, vt as v } from "./core.js";
2
2
  // src/charts/axes.js
3
- var v = .97, y = .08, b = /* @__PURE__ */ new Float32Array(16);
4
- function x(e, t, r) {
3
+ var y = .97, b = .08, x = /* @__PURE__ */ new Float32Array(16);
4
+ function S(e, t, n) {
5
5
  let i = t.worldPosition;
6
- n(b, e.worldMatrix);
7
- let a = b[0] * i[0] + b[4] * i[1] + b[8] * i[2] + b[12], o = b[1] * i[0] + b[5] * i[1] + b[9] * i[2] + b[13] - r, s = b[2] * i[0] + b[6] * i[1] + b[10] * i[2] + b[14], c = Math.hypot(a, o, s) || 1;
6
+ r(x, e.worldMatrix);
7
+ let a = x[0] * i[0] + x[4] * i[1] + x[8] * i[2] + x[12], o = x[1] * i[0] + x[5] * i[1] + x[9] * i[2] + x[13] - n, s = x[2] * i[0] + x[6] * i[1] + x[10] * i[2] + x[14], c = Math.hypot(a, o, s) || 1;
8
8
  return [
9
9
  a / c,
10
10
  o / c,
11
11
  s / c
12
12
  ];
13
13
  }
14
- function S({ box: e, axes: t, theme: n, overlap: r }) {
15
- let [o, s, c] = e, l = new h({
14
+ function C({ box: t, axes: n, theme: r, overlap: a }) {
15
+ let [o, s, c] = t, l = new h({
16
16
  name: "axes",
17
17
  pickable: !1
18
- }), u = (e) => x(l, e, s / 2), d = n === "light" ? "#c3c8d2" : "#3a3d47", f = (e) => {
18
+ }), u = (e) => S(l, e, s / 2), d = r === "light" ? "#c3c8d2" : "#3a3d47", p = (e) => {
19
19
  let t = e.channel?.axis?.ticks;
20
20
  if (!Array.isArray(t)) return e.scale.kind === "band" ? e.scale.ticks() : e.scale.ticks(t ?? 5);
21
21
  let [n, r] = e.scale.range, i = Math.min(n, r), a = Math.max(n, r);
22
22
  return t.filter((t) => e.scale(t) >= i - 1e-9 && e.scale(t) <= a + 1e-9);
23
- }, p = (e) => e && e.scale.kind !== "band" && e.channel?.axis !== !1 ? f(e) : [], m = p(t.x), g = p(t.y), b = p(t.z), S = (e, n) => {
24
- let r = [], f = (e, t) => r.push(...e, ...t), p = (e) => n < 0 ? -e / 2 : e / 2;
25
- if (e === "y") {
26
- let e = n < 0 ? 0 : s;
27
- for (let n of m) {
28
- let r = t.x.scale(n);
29
- f([
23
+ }, m = (e) => e && e.scale.kind !== "band" && e.channel?.axis !== !1 ? p(e) : [], g = m(n.x), _ = m(n.y), v = m(n.z), x = (t, r) => {
24
+ let i = [], a = (e, t) => i.push(...e, ...t), p = (e) => r < 0 ? -e / 2 : e / 2;
25
+ if (t === "y") {
26
+ let e = r < 0 ? 0 : s;
27
+ for (let t of g) {
28
+ let r = n.x.scale(t);
29
+ a([
30
30
  r,
31
31
  e,
32
32
  -c / 2
@@ -36,9 +36,9 @@ function S({ box: e, axes: t, theme: n, overlap: r }) {
36
36
  c / 2
37
37
  ]);
38
38
  }
39
- for (let n of b) {
40
- let r = t.z.scale(n);
41
- f([
39
+ for (let t of v) {
40
+ let r = n.z.scale(t);
41
+ a([
42
42
  -o / 2,
43
43
  e,
44
44
  r
@@ -48,7 +48,7 @@ function S({ box: e, axes: t, theme: n, overlap: r }) {
48
48
  r
49
49
  ]);
50
50
  }
51
- C(f, [
51
+ w(a, [
52
52
  -o / 2,
53
53
  e,
54
54
  -c / 2
@@ -65,11 +65,11 @@ function S({ box: e, axes: t, theme: n, overlap: r }) {
65
65
  e,
66
66
  c / 2
67
67
  ]);
68
- } else if (e === "x") {
68
+ } else if (t === "x") {
69
69
  let e = p(o);
70
- for (let n of g) {
71
- let r = t.y.scale(n);
72
- f([
70
+ for (let t of _) {
71
+ let r = n.y.scale(t);
72
+ a([
73
73
  e,
74
74
  r,
75
75
  -c / 2
@@ -79,9 +79,9 @@ function S({ box: e, axes: t, theme: n, overlap: r }) {
79
79
  c / 2
80
80
  ]);
81
81
  }
82
- for (let n of b) {
83
- let r = t.z.scale(n);
84
- f([
82
+ for (let t of v) {
83
+ let r = n.z.scale(t);
84
+ a([
85
85
  e,
86
86
  0,
87
87
  r
@@ -91,7 +91,7 @@ function S({ box: e, axes: t, theme: n, overlap: r }) {
91
91
  r
92
92
  ]);
93
93
  }
94
- C(f, [
94
+ w(a, [
95
95
  e,
96
96
  0,
97
97
  -c / 2
@@ -110,9 +110,9 @@ function S({ box: e, axes: t, theme: n, overlap: r }) {
110
110
  ]);
111
111
  } else {
112
112
  let e = p(c);
113
- for (let n of g) {
114
- let r = t.y.scale(n);
115
- f([
113
+ for (let t of _) {
114
+ let r = n.y.scale(t);
115
+ a([
116
116
  -o / 2,
117
117
  r,
118
118
  e
@@ -122,9 +122,9 @@ function S({ box: e, axes: t, theme: n, overlap: r }) {
122
122
  e
123
123
  ]);
124
124
  }
125
- for (let n of m) {
126
- let r = t.x.scale(n);
127
- f([
125
+ for (let t of g) {
126
+ let r = n.x.scale(t);
127
+ a([
128
128
  r,
129
129
  0,
130
130
  e
@@ -134,7 +134,7 @@ function S({ box: e, axes: t, theme: n, overlap: r }) {
134
134
  e
135
135
  ]);
136
136
  }
137
- C(f, [
137
+ w(a, [
138
138
  -o / 2,
139
139
  0,
140
140
  e
@@ -152,43 +152,43 @@ function S({ box: e, axes: t, theme: n, overlap: r }) {
152
152
  e
153
153
  ]);
154
154
  }
155
- let h = "xyz".indexOf(e);
156
- l.add(new a({
157
- geometry: new i({ positions: r }),
155
+ let m = "xyz".indexOf(t);
156
+ l.add(new e({
157
+ geometry: new f({ positions: i }),
158
158
  material: { color: d },
159
159
  pickable: !1,
160
- showFrom: (e) => -n * u(e)[h] > y
160
+ showFrom: (e) => -r * u(e)[m] > b
161
161
  }));
162
162
  };
163
163
  for (let e of [
164
164
  "x",
165
165
  "y",
166
166
  "z"
167
- ]) for (let t of [-1, 1]) S(e, t);
168
- let w = Math.max(o, s, c) * .04, T = (e) => `phoria-axis-${e} phoria-${n}`, E = (e, n, i) => {
169
- let a = t[e];
170
- if (!a || a.channel?.axis === !1) return;
171
- let o = "xyz".indexOf(e), s = f(a);
172
- for (let e of n) {
167
+ ]) for (let t of [-1, 1]) x(e, t);
168
+ let C = Math.max(o, s, c) * .04, T = (e) => `phoria-axis-${e} phoria-${r}`, E = (e, t, r) => {
169
+ let o = n[e];
170
+ if (!o || o.channel?.axis === !1) return;
171
+ let s = "xyz".indexOf(e), c = p(o);
172
+ for (let e of t) {
173
173
  let t = l.add(new h({ showFrom: (t) => {
174
174
  let n = u(t);
175
- return Math.abs(n[o]) < v && e.when(n);
175
+ return Math.abs(n[s]) < y && e.when(n);
176
176
  } }));
177
- for (let n of s) t.add(new _({
178
- text: a.scale.format(n),
179
- position: e.at(a.scale(n), w),
180
- place: i,
177
+ for (let n of c) t.add(new i({
178
+ text: o.scale.format(n),
179
+ position: e.at(o.scale(n), C),
180
+ place: r,
181
181
  className: T("tick"),
182
182
  priority: 1,
183
- overlap: r
183
+ overlap: a
184
184
  }));
185
- a.title && t.add(new _({
186
- text: a.title,
187
- position: e.title(w),
188
- place: i,
185
+ o.title && t.add(new i({
186
+ text: o.title,
187
+ position: e.title(C),
188
+ place: r,
189
189
  className: T("title"),
190
190
  priority: 2,
191
- overlap: r
191
+ overlap: a
192
192
  }));
193
193
  }
194
194
  }, D = (e) => e[1] >= -.08, O = (e) => e >= -.1 ? 1 : -1;
@@ -230,37 +230,37 @@ function S({ box: e, axes: t, theme: n, overlap: r }) {
230
230
  ]
231
231
  }))), "left"), l;
232
232
  }
233
- function C(e, t, n, r, i) {
233
+ function w(e, t, n, r, i) {
234
234
  e(t, n), e(n, r), e(r, i), e(i, t);
235
235
  }
236
236
  // src/charts/scales.js
237
- var w = Math.log(10);
238
- function T(e, t) {
239
- let n = e / Math.max(1, t), r = 10 ** Math.floor(Math.log(n) / w), i = n / r;
237
+ var T = Math.log(10);
238
+ function E(e, t) {
239
+ let n = e / Math.max(1, t), r = 10 ** Math.floor(Math.log(n) / T), i = n / r;
240
240
  return r * (i >= 7.07 ? 10 : i >= 3.16 ? 5 : i >= 1.41 ? 2 : 1);
241
241
  }
242
- function E(t, n, i = !1) {
243
- if (typeof t == "function") return t;
244
- if (t && typeof t == "object") {
245
- let e = i ? new Intl.DateTimeFormat(void 0, t) : new Intl.NumberFormat(void 0, t);
246
- return (t) => e.format(t);
242
+ function D(e, t, n = !1) {
243
+ if (typeof e == "function") return e;
244
+ if (e && typeof e == "object") {
245
+ let t = n ? new Intl.DateTimeFormat(void 0, e) : new Intl.NumberFormat(void 0, e);
246
+ return (e) => t.format(e);
247
247
  }
248
- return t !== void 0 && e("charts", `'format' must be Intl format options or a function, got ${r(t)}`), n;
248
+ return e !== void 0 && l("charts", `'format' must be Intl format options or a function, got ${u(e)}`), t;
249
249
  }
250
- function D(e, t) {
251
- let n = Math.max(0, Math.min(6, -Math.floor(Math.log(e || 1) / w))), r = new Intl.NumberFormat(void 0, { maximumFractionDigits: n }), i = new Intl.NumberFormat(void 0, {
250
+ function O(e, t) {
251
+ let n = Math.max(0, Math.min(6, -Math.floor(Math.log(e || 1) / T))), r = new Intl.NumberFormat(void 0, { maximumFractionDigits: n }), i = new Intl.NumberFormat(void 0, {
252
252
  notation: "compact",
253
253
  maximumFractionDigits: 1
254
254
  }), a = Math.abs(t) >= 1e4 && e >= Math.abs(t) / 100;
255
255
  return (e) => (a ? i : r).format(e);
256
256
  }
257
- function O(t, n) {
258
- return Array.isArray(t) && t.length === 2 && t.every((e) => typeof e == "number" && Number.isFinite(e)) || e("charts", `'${n}' must be [min, max] numbers, got ${r(t)}`), [t[0], t[1]];
257
+ function k(e, t) {
258
+ return Array.isArray(e) && e.length === 2 && e.every((e) => typeof e == "number" && Number.isFinite(e)) || l("charts", `'${t}' must be [min, max] numbers, got ${u(e)}`), [e[0], e[1]];
259
259
  }
260
- function k({ domain: e, range: t = [0, 1], nice: n = !1, zero: r = !1, clamp: i = !1, format: a }) {
261
- let [o, s] = O(e, "domain"), [c, l] = O(t, "range");
260
+ function A({ domain: e, range: t = [0, 1], nice: n = !1, zero: r = !1, clamp: i = !1, format: a }) {
261
+ let [o, s] = k(e, "domain"), [c, l] = k(t, "range");
262
262
  if (r && (o = Math.min(0, o), s = Math.max(0, s)), o === s && (o -= o ? Math.abs(o) * .5 : 1, s += s ? Math.abs(s) * .5 : 1), n) {
263
- let e = T(s - o, 5);
263
+ let e = E(s - o, 5);
264
264
  o = Math.floor(o / e) * e, s = Math.ceil(s / e) * e;
265
265
  }
266
266
  let u = (l - c) / (s - o), d = ((e) => {
@@ -268,93 +268,93 @@ function k({ domain: e, range: t = [0, 1], nice: n = !1, zero: r = !1, clamp: i
268
268
  return i ? Math.min(Math.max(t, Math.min(c, l)), Math.max(c, l)) : t;
269
269
  });
270
270
  return d.kind = "linear", d.domain = [o, s], d.range = [c, l], d.invert = (e) => o + (e - c) / u, d.ticks = (e = 5) => {
271
- let t = T(s - o, e), n = [];
271
+ let t = E(s - o, e), n = [];
272
272
  for (let e = Math.ceil(o / t) * t; e <= s + t * 1e-9; e += t) n.push(+e.toFixed(12));
273
273
  return n;
274
- }, d.format = E(a, D(T(s - o, 5), Math.max(Math.abs(o), Math.abs(s)))), d;
274
+ }, d.format = D(a, O(E(s - o, 5), Math.max(Math.abs(o), Math.abs(s)))), d;
275
275
  }
276
- function A({ domain: t, range: n = [0, 1], format: r }) {
277
- let [i, a] = O(t, "domain");
278
- (i <= 0 || a <= 0) && e("charts", `a log scale needs a domain above 0, got [${i}, ${a}] - use a linear scale for zero or negative values`);
279
- let o = k({
280
- domain: [Math.log10(i), Math.log10(a)],
281
- range: n
282
- }), s = ((e) => o(Math.log10(e)));
283
- return s.kind = "log", s.domain = [i, a], s.range = o.range, s.invert = (e) => 10 ** o.invert?.(e), s.ticks = () => {
276
+ function j({ domain: e, range: t = [0, 1], format: n }) {
277
+ let [r, i] = k(e, "domain");
278
+ (r <= 0 || i <= 0) && l("charts", `a log scale needs a domain above 0, got [${r}, ${i}] - use a linear scale for zero or negative values`);
279
+ let a = A({
280
+ domain: [Math.log10(r), Math.log10(i)],
281
+ range: t
282
+ }), o = ((e) => a(Math.log10(e)));
283
+ return o.kind = "log", o.domain = [r, i], o.range = a.range, o.invert = (e) => 10 ** a.invert?.(e), o.ticks = () => {
284
284
  let e = [];
285
- for (let t = Math.floor(Math.log10(i)); t <= Math.ceil(Math.log10(a)); t++) for (let n of [
285
+ for (let t = Math.floor(Math.log10(r)); t <= Math.ceil(Math.log10(i)); t++) for (let n of [
286
286
  1,
287
287
  2,
288
288
  5
289
289
  ]) {
290
- let r = n * 10 ** t;
291
- r >= i * .999 && r <= a * 1.001 && e.push(r);
290
+ let a = n * 10 ** t;
291
+ a >= r * .999 && a <= i * 1.001 && e.push(a);
292
292
  }
293
293
  return e;
294
- }, s.format = E(r, (e) => new Intl.NumberFormat(void 0, {
294
+ }, o.format = D(n, (e) => new Intl.NumberFormat(void 0, {
295
295
  notation: "compact",
296
296
  maximumFractionDigits: 1
297
- }).format(e)), s;
297
+ }).format(e)), o;
298
298
  }
299
- var j = 1e3, M = 60 * j, N = 60 * M, P = 24 * N, F = [
300
- [j, "s"],
301
- [5 * j, "s"],
302
- [15 * j, "s"],
303
- [30 * j, "s"],
304
- [M, "m"],
305
- [5 * M, "m"],
306
- [15 * M, "m"],
307
- [30 * M, "m"],
308
- [N, "h"],
309
- [3 * N, "h"],
310
- [6 * N, "h"],
311
- [12 * N, "h"],
312
- [P, "d"],
313
- [2 * P, "d"],
314
- [7 * P, "w"],
315
- [30 * P, "M"],
316
- [91 * P, "Q"],
317
- [365 * P, "Y"]
299
+ var M = 1e3, N = 60 * M, P = 60 * N, F = 24 * P, I = [
300
+ [M, "s"],
301
+ [5 * M, "s"],
302
+ [15 * M, "s"],
303
+ [30 * M, "s"],
304
+ [N, "m"],
305
+ [5 * N, "m"],
306
+ [15 * N, "m"],
307
+ [30 * N, "m"],
308
+ [P, "h"],
309
+ [3 * P, "h"],
310
+ [6 * P, "h"],
311
+ [12 * P, "h"],
312
+ [F, "d"],
313
+ [2 * F, "d"],
314
+ [7 * F, "w"],
315
+ [30 * F, "M"],
316
+ [91 * F, "Q"],
317
+ [365 * F, "Y"]
318
318
  ], ee = {
319
319
  s: [
320
320
  (e) => e.getSeconds(),
321
321
  (e, t) => e.setSeconds(t),
322
- j
322
+ M
323
323
  ],
324
324
  m: [
325
325
  (e) => e.getMinutes(),
326
326
  (e, t) => e.setMinutes(t),
327
- M
327
+ N
328
328
  ],
329
329
  h: [
330
330
  (e) => e.getHours(),
331
331
  (e, t) => e.setHours(t),
332
- N
332
+ P
333
333
  ],
334
334
  d: [
335
335
  (e) => e.getDate(),
336
336
  (e, t) => e.setDate(t),
337
- P
337
+ F
338
338
  ],
339
339
  w: [
340
340
  (e) => e.getDate(),
341
341
  (e, t) => e.setDate(t),
342
- P
342
+ F
343
343
  ],
344
344
  M: [
345
345
  (e) => e.getMonth(),
346
346
  (e, t) => e.setMonth(t),
347
- 30 * P
347
+ 30 * F
348
348
  ],
349
349
  Q: [
350
350
  (e) => e.getMonth(),
351
351
  (e, t) => e.setMonth(t),
352
- 30 * P
352
+ 30 * F
353
353
  ],
354
354
  Y: [
355
355
  (e) => e.getFullYear(),
356
356
  (e, t) => e.setFullYear(t),
357
- 365 * P
357
+ 365 * F
358
358
  ]
359
359
  }, te = {
360
360
  s: {
@@ -388,15 +388,15 @@ var j = 1e3, M = 60 * j, N = 60 * M, P = 24 * N, F = [
388
388
  },
389
389
  Y: { year: "numeric" }
390
390
  };
391
- function I(t) {
392
- let n = t instanceof Date ? t : new Date(t);
393
- return Number.isNaN(n.getTime()) && e("charts", `${r(t)} isn't a date - use Date objects, timestamps or ISO strings like '2026-10-25'`), n;
391
+ function L(e) {
392
+ let t = e instanceof Date ? e : new Date(e);
393
+ return Number.isNaN(t.getTime()) && l("charts", `${u(e)} isn't a date - use Date objects, timestamps or ISO strings like '2026-10-25'`), t;
394
394
  }
395
395
  function ne({ domain: e, range: t = [0, 1], format: n }) {
396
- let r = I(e[0]).getTime(), i = I(e[1]).getTime(), a = k({
396
+ let r = L(e[0]).getTime(), i = L(e[1]).getTime(), a = A({
397
397
  domain: [r, i],
398
398
  range: t
399
- }), o = Math.max(1, i - r), s = (e) => F.find(([t]) => o / t <= e) ?? F[F.length - 1], c = ((e) => a(I(e).getTime()));
399
+ }), o = Math.max(1, i - r), s = (e) => I.find(([t]) => o / t <= e) ?? I[I.length - 1], c = ((e) => a(L(e).getTime()));
400
400
  c.kind = "time", c.domain = [new Date(r), new Date(i)], c.range = a.range, c.invert = (e) => new Date(a.invert?.(e)), c.ticks = (e = 5) => {
401
401
  let [t, n] = s(e), [a, c, l] = ee[n], u = Math.max(1, Math.round(t / l));
402
402
  if (n === "Y") {
@@ -417,17 +417,17 @@ function ne({ domain: e, range: t = [0, 1], format: n }) {
417
417
  return p;
418
418
  };
419
419
  let l = new Intl.DateTimeFormat(void 0, te[s(6)[1]]);
420
- return c.format = E(n, (e) => l.format(I(e)), !0), c;
420
+ return c.format = D(n, (e) => l.format(L(e)), !0), c;
421
421
  }
422
- function re({ domain: t, range: n = [0, 1], padding: i = .2, format: a }) {
423
- Array.isArray(t) || e("charts", `a band scale's domain is a list of categories, got ${r(t)}`);
424
- let [o, s] = O(n, "range"), c = new Map(t.map((e, t) => [String(e), t])), l = (s - o) / Math.max(1, t.length), u = ((e) => {
425
- let t = c.get(String(e));
426
- return t === void 0 ? NaN : o + l * (t + .5);
422
+ function re({ domain: e, range: t = [0, 1], padding: n = .2, format: r }) {
423
+ Array.isArray(e) || l("charts", `a band scale's domain is a list of categories, got ${u(e)}`);
424
+ let [i, a] = k(t, "range"), o = new Map(e.map((e, t) => [String(e), t])), s = (a - i) / Math.max(1, e.length), c = ((e) => {
425
+ let t = o.get(String(e));
426
+ return t === void 0 ? NaN : i + s * (t + .5);
427
427
  });
428
- return u.kind = "band", u.domain = t, u.range = [o, s], u.step = l, u.bandwidth = Math.abs(l) * (1 - i), u.ticks = () => t, u.format = E(a, (e) => String(e)), u;
428
+ return c.kind = "band", c.domain = e, c.range = [i, a], c.step = s, c.bandwidth = Math.abs(s) * (1 - n), c.ticks = () => e, c.format = D(r, (e) => String(e)), c;
429
429
  }
430
- var L = {
430
+ var R = {
431
431
  category: [
432
432
  "#4e79a7",
433
433
  "#f28e2b",
@@ -476,33 +476,33 @@ var L = {
476
476
  "#2166ac"
477
477
  ]
478
478
  };
479
- function R({ domain: t, scheme: n, range: i, kind: a }) {
480
- n !== void 0 && !(n in L) && e("charts", `colour scheme '${n}' isn't one we have - use ${Object.keys(L).map((e) => `'${e}'`).join(", ")}, or a range of colours`);
481
- let o = a ? a === "sequential" : t.length === 2 && t.every((e) => typeof e == "number");
482
- o && (t.length < 2 || t.some((e) => typeof e != "number")) && e("charts", `a sequential colour scale needs two or more numbers in its domain, got ${r(t)}`);
483
- let s = (i ?? L[n ?? (o ? "viridis" : "category")]).map((e) => c.fromInput(e, "charts")), l;
484
- if (o) {
485
- let e = (e) => {
486
- let n = t.length - 1, r = 0;
487
- for (; r < n - 1 && e > t[r + 1];) r++;
488
- let i = (e - t[r]) / (t[r + 1] - t[r] || 1);
479
+ function z({ domain: e, scheme: t, range: n, kind: r }) {
480
+ t !== void 0 && !(t in R) && l("charts", `colour scheme '${t}' isn't one we have - use ${Object.keys(R).map((e) => `'${e}'`).join(", ")}, or a range of colours`);
481
+ let i = r ? r === "sequential" : e.length === 2 && e.every((e) => typeof e == "number");
482
+ i && (e.length < 2 || e.some((e) => typeof e != "number")) && l("charts", `a sequential colour scale needs two or more numbers in its domain, got ${u(e)}`);
483
+ let a = (n ?? R[t ?? (i ? "viridis" : "category")]).map((e) => v.fromInput(e, "charts")), o;
484
+ if (i) {
485
+ let t = (t) => {
486
+ let n = e.length - 1, r = 0;
487
+ for (; r < n - 1 && t > e[r + 1];) r++;
488
+ let i = (t - e[r]) / (e[r + 1] - e[r] || 1);
489
489
  return Math.min(1, Math.max(0, (r + i) / n));
490
490
  };
491
- l = ((t) => {
492
- if (s.length < 2) return s[0].clone();
493
- let n = e(t) * (s.length - 1), r = Math.min(s.length - 2, Math.floor(n));
494
- return s[r].clone().lerp(s[r + 1], n - r);
495
- }), l.kind = "sequential", l.colors = () => [];
491
+ o = ((e) => {
492
+ if (a.length < 2) return a[0].clone();
493
+ let n = t(e) * (a.length - 1), r = Math.min(a.length - 2, Math.floor(n));
494
+ return a[r].clone().lerp(a[r + 1], n - r);
495
+ }), o.kind = "sequential", o.colors = () => [];
496
496
  } else {
497
- let e = new Map(t.map((e, t) => [String(e), t]));
498
- l = ((t) => s[(e.get(String(t)) ?? 0) % s.length].clone()), l.kind = "categorical", l.colors = () => t.map((e) => ({
497
+ let t = new Map(e.map((e, t) => [String(e), t]));
498
+ o = ((e) => a[(t.get(String(e)) ?? 0) % a.length].clone()), o.kind = "categorical", o.colors = () => e.map((e) => ({
499
499
  value: e,
500
- color: l(e)
500
+ color: o(e)
501
501
  }));
502
502
  }
503
- return l.domain = t, l.range = s.map((e) => e.getStyle()), l;
503
+ return o.domain = e, o.range = a.map((e) => e.getStyle()), o;
504
504
  }
505
- function z(e) {
505
+ function B(e) {
506
506
  let t = [...new Map(e.map((e) => [e instanceof Date ? e.getTime() : e, e])).values()];
507
507
  return typeof t[0] == "number" || t[0] instanceof Date ? t.sort((e, t) => +e - t) : t;
508
508
  }
@@ -520,7 +520,7 @@ function ie(e, { title: t, theme: n, position: r = "top-right", format: i, ticks
520
520
  r.className = "phoria-legend-swatch", r.style.background = n.getStyle(), e.append(r, i(t)), e.addEventListener("click", () => o?.(t, !e.classList.toggle("off"))), s.append(e);
521
521
  }
522
522
  else {
523
- let t = e.domain[0], n = e.domain[e.domain.length - 1], r = k({
523
+ let t = e.domain[0], n = e.domain[e.domain.length - 1], r = A({
524
524
  domain: [t, n],
525
525
  range: [0, 100]
526
526
  }), o = document.createElement("div");
@@ -543,12 +543,12 @@ function ie(e, { title: t, theme: n, position: r = "top-right", format: i, ticks
543
543
  return s;
544
544
  }
545
545
  // src/charts/marks.js
546
- function B(e, t, n) {
546
+ function V(e, t, n) {
547
547
  let r = e.x?.get(t);
548
548
  return `${r instanceof Date ? r.getTime() : r}|${e.z ? e.z.get(t) : ""}|${n < 0 ? "-" : "+"}`;
549
549
  }
550
550
  var ae = (e) => `phoria-value phoria-${e.theme}`;
551
- function V(e, t) {
551
+ function H(e, t) {
552
552
  let n = e.spec.channels.label;
553
553
  if (!n) return null;
554
554
  let r = n.priority, i = typeof r == "function" ? r : typeof r == "string" ? (e) => Number(e[r]) || 0 : r ?? 0;
@@ -561,21 +561,21 @@ function V(e, t) {
561
561
  overlap: e.overlap
562
562
  };
563
563
  }
564
- var H = (e, t, n) => e && t ? e(t.get(n)) : 0;
564
+ var U = (e, t, n) => e && t ? e(t.get(n)) : 0;
565
565
  function oe(e) {
566
- let t = U(64, e), n = {
566
+ let t = se(64, e), n = {
567
567
  nodes: [t],
568
568
  layout(t) {
569
569
  let { x: n, y: r, z: i } = e.scales, a = e.spec.channels, o = e.spec.options.width ?? .7, s = (n.bandwidth ?? e.box[0] / 20) * o / .8, c = i?.bandwidth === void 0 ? Math.min(s, e.box[2] * .8) : i.bandwidth * o / .8, l = r(Math.max(r.domain[0], Math.min(0, r.domain[1]))), u = /* @__PURE__ */ new Map(), d = new Float32Array(t.length * 9);
570
570
  return t.forEach((t, o) => {
571
571
  let f = Number(a.y.get(t)) || 0, p = l, m = r(f);
572
572
  if (e.spec.options.stack) {
573
- let e = B(a, t, f), n = u.get(e) ?? 0;
573
+ let e = V(a, t, f), n = u.get(e) ?? 0;
574
574
  p = r(n), m = r(n + f), u.set(e, n + f);
575
575
  }
576
576
  d.set([
577
- H(n, a.x, t),
578
- H(i, a.z, t),
577
+ U(n, a.x, t),
578
+ U(i, a.z, t),
579
579
  p,
580
580
  m,
581
581
  s,
@@ -584,7 +584,7 @@ function oe(e) {
584
584
  ], o * 9);
585
585
  }), {
586
586
  rows: t,
587
- keys: W(e, t),
587
+ keys: ce(e, t),
588
588
  state: d,
589
589
  stride: 9
590
590
  };
@@ -592,7 +592,7 @@ function oe(e) {
592
592
  apply(r, i) {
593
593
  let a = r.length / i.stride;
594
594
  if (a > t.instanceMatrices.length / 16) {
595
- let r = U(a * 2, e);
595
+ let r = se(a * 2, e);
596
596
  t.parent?.add(r), t.parent?.remove(t), t.dispose(), n.nodes[0] = t = r;
597
597
  }
598
598
  t.count = a, t.data = i.rows;
@@ -623,50 +623,53 @@ function oe(e) {
623
623
  };
624
624
  return n;
625
625
  }
626
- function U(e, t) {
627
- let n = new l({
628
- geometry: f(1),
626
+ function se(e, t) {
627
+ let n = new o({
628
+ geometry: d(1),
629
629
  material: { roughness: .55 },
630
630
  count: e,
631
- labels: V(t, "above")
631
+ labels: H(t, "above")
632
632
  });
633
633
  return n.count = 0, n;
634
634
  }
635
- function W(e, t) {
635
+ function ce(e, t) {
636
636
  let n = e.spec.channels.key;
637
637
  return n ? t.map((e) => n.get(e)) : t.length && t[0] && "id" in t[0] ? t.map((e) => e.id) : t.map((e, t) => t);
638
638
  }
639
- function se(e) {
639
+ function le(e) {
640
640
  let t = !!e.spec.channels.size?.field, n = Math.min(...e.box) / 40, r = e.spec.channels.opacity?.value, i = {
641
641
  roughness: .4,
642
642
  ...r === void 0 ? {} : { opacity: r }
643
- }, a = t ? new l({
643
+ }, a = t ? new o({
644
644
  geometry: p({
645
645
  radius: 1,
646
646
  detail: 1
647
647
  }),
648
648
  material: i,
649
649
  count: 64,
650
- labels: V(e, "above")
651
- }) : new g({
650
+ labels: H(e, "above")
651
+ }) : new _({
652
652
  geometry: G(64),
653
653
  material: {
654
654
  size: e.spec.channels.size?.value ?? n * 1.4,
655
655
  vertexColors: !0,
656
+ map: ue(),
657
+ depthWrite: !1,
656
658
  ...i
657
659
  },
658
- labels: V(e, "above")
660
+ sort: !0,
661
+ labels: H(e, "above")
659
662
  });
660
663
  t && (a.count = 0);
661
- let o = {
664
+ let s = {
662
665
  nodes: [a],
663
666
  layout(n) {
664
667
  let { x: r, y: i, z: a } = e.scales, o = e.spec.channels, s = t ? 7 : 6, c = new Float32Array(n.length * s);
665
668
  return n.forEach((n, l) => {
666
669
  let u = [
667
- H(r, o.x, n),
668
- H(i, o.y, n),
669
- H(a, o.z, n)
670
+ U(r, o.x, n),
671
+ U(i, o.y, n),
672
+ U(a, o.z, n)
670
673
  ];
671
674
  c.set(t ? [
672
675
  ...u,
@@ -675,7 +678,7 @@ function se(e) {
675
678
  ] : [...u, ...e.rgb(n)], l * s);
676
679
  }), {
677
680
  rows: n,
678
- keys: W(e, n),
681
+ keys: ce(e, n),
679
682
  state: c,
680
683
  stride: s
681
684
  };
@@ -684,13 +687,13 @@ function se(e) {
684
687
  let r = e.length / n.stride;
685
688
  if (a.data = n.rows, t) {
686
689
  if (r > a.instanceMatrices.length / 16) {
687
- let e = new l({
690
+ let e = new o({
688
691
  geometry: a.geometry,
689
692
  material: a.material,
690
693
  count: r * 2,
691
694
  labels: a.labels
692
695
  });
693
- a.parent?.add(e), a.parent?.remove(a), o.nodes[0] = a = e;
696
+ a.parent?.add(e), a.parent?.remove(a), s.nodes[0] = a = e;
694
697
  }
695
698
  a.count = r;
696
699
  for (let t = 0; t < r; t++) {
@@ -713,26 +716,40 @@ function se(e) {
713
716
  }
714
717
  let i = a.geometry;
715
718
  r > i.vertexCount && (a.geometry = G(r * 2));
716
- let s = a.geometry.positions, c = a.geometry.colors;
717
- for (let t = 0; t < r; t++) s.set(e.subarray(t * 6, t * 6 + 3), t * 3), c.set(e.subarray(t * 6 + 3, t * 6 + 6), t * 3);
719
+ let c = a.geometry.positions, l = a.geometry.colors;
720
+ for (let t = 0; t < r; t++) c.set(e.subarray(t * 6, t * 6 + 3), t * 3), l.set(e.subarray(t * 6 + 3, t * 6 + 6), t * 3);
718
721
  a.geometry.drawCount = r, a.geometry.needsUpdate(), a.geometry !== i && i.dispose();
719
722
  },
720
723
  enter(e) {
721
724
  t ? e[3] = 0 : e[1] = 0;
722
725
  }
723
726
  };
724
- return o;
727
+ return s;
728
+ }
729
+ var W = null;
730
+ function ue() {
731
+ if (W) return W;
732
+ let e = /* @__PURE__ */ new Uint8Array(16384);
733
+ for (let t = 0; t < 64; t++) for (let n = 0; n < 64; n++) {
734
+ let r = Math.hypot(n + .5 - 32, t + .5 - 32) / 32, i = r < .78 ? 1 : 1 - (r - .78) / .22 * .38, a = Math.min(1, Math.max(0, (1 - r) * 32 / 1.5)), o = (t * 64 + n) * 4;
735
+ e[o] = e[o + 1] = e[o + 2] = Math.round(i * 255), e[o + 3] = Math.round(a * 255);
736
+ }
737
+ return W = new g({ image: {
738
+ data: e,
739
+ width: 64,
740
+ height: 64
741
+ } });
725
742
  }
726
743
  function G(e) {
727
- let t = new i({
744
+ let t = new f({
728
745
  positions: new Float32Array(e * 3),
729
746
  colors: new Float32Array(e * 3)
730
747
  });
731
748
  return t.drawCount = 0, t;
732
749
  }
733
- function ce(e, n) {
734
- let r = new a({
735
- geometry: new i({ positions: [
750
+ function de(t, n) {
751
+ let r = new e({
752
+ geometry: new f({ positions: [
736
753
  0,
737
754
  0,
738
755
  0,
@@ -745,16 +762,16 @@ function ce(e, n) {
745
762
  vertexColors: !0
746
763
  },
747
764
  pickable: !1
748
- }), o = new g({
765
+ }), i = new _({
749
766
  geometry: G(8),
750
767
  material: {
751
768
  size: 7,
752
769
  sizeAttenuation: !1,
753
770
  vertexColors: !0
754
771
  },
755
- labels: V(e, "above")
756
- }), s = n ? new t({
757
- geometry: new i({ positions: [
772
+ labels: H(t, "above")
773
+ }), a = n ? new s({
774
+ geometry: new f({ positions: [
758
775
  0,
759
776
  0,
760
777
  0,
@@ -774,24 +791,24 @@ function ce(e, n) {
774
791
  pickable: !1
775
792
  }) : null;
776
793
  return {
777
- nodes: s ? [
778
- s,
794
+ nodes: a ? [
795
+ a,
779
796
  r,
780
- o
781
- ] : [r, o],
782
- layout(t) {
783
- let { x: n, y: r, z: i } = e.scales, a = e.spec.channels, o = a.color?.field ? a.color : a.detail ?? (a.z?.field ? a.z : null), s = /* @__PURE__ */ new Map();
784
- for (let e of t) {
785
- let t = o ? String(o.get(e)) : "";
786
- s.has(t) || s.set(t, []), s.get(t).push(e);
797
+ i
798
+ ] : [r, i],
799
+ layout(e) {
800
+ let { x: n, y: r, z: i } = t.scales, a = t.spec.channels, o = a.color?.field ? a.color : a.detail ?? (a.z?.field ? a.z : null), s = /* @__PURE__ */ new Map();
801
+ for (let t of e) {
802
+ let e = o ? String(o.get(t)) : "";
803
+ s.has(e) || s.set(e, []), s.get(e).push(t);
787
804
  }
788
805
  let c = [...s.values()].map((e) => e.sort((e, t) => n(a.x.get(e)) - n(a.x.get(t)))), l = /* @__PURE__ */ new Map(), u = c.flat(), d = new Float32Array(u.length * 4), f = 0;
789
- for (let t of c) for (let o of t) {
790
- let t = a.x.get(o), s = Number(a.y.get(o)) || 0, c = B(a, o, s), u = e.spec.options.stack ? l.get(c) ?? 0 : 0;
791
- e.spec.options.stack && l.set(c, u + s), d.set([
792
- n(t),
806
+ for (let e of c) for (let o of e) {
807
+ let e = a.x.get(o), s = Number(a.y.get(o)) || 0, c = V(a, o, s), u = t.spec.options.stack ? l.get(c) ?? 0 : 0;
808
+ t.spec.options.stack && l.set(c, u + s), d.set([
809
+ n(e),
793
810
  r(u + s),
794
- H(i, a.z, o),
811
+ U(i, a.z, o),
795
812
  r(u)
796
813
  ], f * 4), f++;
797
814
  }
@@ -802,23 +819,23 @@ function ce(e, n) {
802
819
  stride: 4,
803
820
  shape: {
804
821
  lengths: c.map((e) => e.length),
805
- colors: c.map((t) => e.rgb(t[0]))
822
+ colors: c.map((e) => t.rgb(e[0]))
806
823
  }
807
824
  };
808
825
  },
809
826
  apply(e, t) {
810
- let { lengths: n, colors: i } = t.shape, a = [], c = [], l = [], u = [], d = [], f = [], p = [], m = 0;
827
+ let { lengths: n, colors: o } = t.shape, s = [], c = [], l = [], u = [], d = [], f = [], p = [], m = 0;
811
828
  n.forEach((t, n) => {
812
- let r = i[n];
829
+ let r = o[n];
813
830
  for (let n = 0; n < t; n++, m++) {
814
831
  let [t, i, o, h] = e.subarray(m * 4, m * 4 + 4);
815
- if (l.push(t, i, o), u.push(...r), n > 0 && (a.push(...e.subarray((m - 1) * 4, (m - 1) * 4 + 3), t, i, o), c.push(...r, ...r)), s) {
832
+ if (l.push(t, i, o), u.push(...r), n > 0 && (s.push(...e.subarray((m - 1) * 4, (m - 1) * 4 + 3), t, i, o), c.push(...r, ...r)), a) {
816
833
  let e = f.length / 3;
817
834
  d.push(t, i, o, t, h, o), f.push(...r, ...r), n > 0 && p.push(e - 2, e - 1, e, e - 1, e + 1, e);
818
835
  }
819
836
  }
820
- }), r.geometry = K(r.geometry, a.length ? {
821
- positions: a,
837
+ }), r.geometry = K(r.geometry, s.length ? {
838
+ positions: s,
822
839
  colors: c
823
840
  } : { positions: [
824
841
  0,
@@ -827,7 +844,7 @@ function ce(e, n) {
827
844
  0,
828
845
  0,
829
846
  0
830
- ] }), o.geometry = K(o.geometry, {
847
+ ] }), i.geometry = K(i.geometry, {
831
848
  positions: l.length ? l : [
832
849
  0,
833
850
  0,
@@ -838,7 +855,7 @@ function ce(e, n) {
838
855
  0,
839
856
  0
840
857
  ]
841
- }), o.geometry.drawCount = l.length / 3, o.material.size = Math.max(...n, 0) > 40 ? 4 : 7, o.data = t.rows, s && (s.geometry = K(s.geometry, p.length ? {
858
+ }), i.geometry.drawCount = l.length / 3, i.material.size = Math.max(...n, 0) > 40 ? 4 : 7, i.data = t.rows, a && (a.geometry = K(a.geometry, p.length ? {
842
859
  positions: d,
843
860
  colors: f,
844
861
  indices: p
@@ -857,11 +874,11 @@ function ce(e, n) {
857
874
  };
858
875
  }
859
876
  function K(e, t) {
860
- return e.dispose(), new i(t);
877
+ return e.dispose(), new f(t);
861
878
  }
862
- function le(n) {
863
- let r = new t({
864
- geometry: new i({ positions: [
879
+ function fe(e) {
880
+ let t = new s({
881
+ geometry: new f({ positions: [
865
882
  0,
866
883
  0,
867
884
  0,
@@ -879,21 +896,21 @@ function le(n) {
879
896
  }
880
897
  });
881
898
  return {
882
- nodes: [r],
899
+ nodes: [t],
883
900
  layout(t) {
884
- let { x: r, y: i, z: a } = n.scales, o = n.spec.channels, s = z(t.map((e) => o.x.get(e))), c = z(t.map((e) => o.z.get(e))), l = new Map(t.map((e) => [`${+o.x.get(e)}|${+o.z.get(e)}|${o.x.get(e)}|${o.z.get(e)}`, e])), u = (e, t) => l.get(`${+e}|${+t}|${e}|${t}`), d = s.length * c.length - l.size;
901
+ let { x: n, y: r, z: i } = e.scales, a = e.spec.channels, o = B(t.map((e) => a.x.get(e))), s = B(t.map((e) => a.z.get(e))), c = new Map(t.map((e) => [`${+a.x.get(e)}|${+a.z.get(e)}|${a.x.get(e)}|${a.z.get(e)}`, e])), u = (e, t) => c.get(`${+e}|${+t}|${e}|${t}`), d = o.length * s.length - c.size;
885
902
  if (d > 0) {
886
- let t = s.flatMap((e) => c.map((t) => [e, t])).find(([e, t]) => !u(e, t));
887
- e("chart()", `a surface needs a value for every x and z pair - ${d} of ${s.length * c.length} are missing (first: x ${t[0]}, z ${t[1]})`);
903
+ let e = o.flatMap((e) => s.map((t) => [e, t])).find(([e, t]) => !u(e, t));
904
+ l("chart()", `a surface needs a value for every x and z pair - ${d} of ${o.length * s.length} are missing (first: x ${e[0]}, z ${e[1]})`);
888
905
  }
889
- let f = [], p = new Float32Array(s.length * c.length * 6), m = 0;
890
- for (let e of c) for (let t of s) {
891
- let s = u(t, e);
892
- f.push(s), p.set([
893
- r(t),
894
- i(Number(o.y.get(s)) || 0),
895
- a(e),
896
- ...n.rgb(s)
906
+ let f = [], p = new Float32Array(o.length * s.length * 6), m = 0;
907
+ for (let t of s) for (let s of o) {
908
+ let o = u(s, t);
909
+ f.push(o), p.set([
910
+ n(s),
911
+ r(Number(a.y.get(o)) || 0),
912
+ i(t),
913
+ ...e.rgb(o)
897
914
  ], m++ * 6);
898
915
  }
899
916
  return {
@@ -902,52 +919,52 @@ function le(n) {
902
919
  state: p,
903
920
  stride: 6,
904
921
  shape: {
905
- nx: s.length,
906
- nz: c.length
922
+ nx: o.length,
923
+ nz: s.length
907
924
  }
908
925
  };
909
926
  },
910
- apply(e, t) {
911
- let { nx: n, nz: i } = t.shape, a = [], o = [], s = [];
912
- for (let t = 0; t < n * i; t++) a.push(...e.subarray(t * 6, t * 6 + 3)), o.push(...e.subarray(t * 6 + 3, t * 6 + 6));
913
- for (let e = 0; e < i - 1; e++) for (let t = 0; t < n - 1; t++) {
914
- let r = e * n + t, i = r + 1, a = r + n, o = a + 1;
915
- s.push(r, a, i, i, a, o);
927
+ apply(e, n) {
928
+ let { nx: r, nz: i } = n.shape, a = [], o = [], s = [];
929
+ for (let t = 0; t < r * i; t++) a.push(...e.subarray(t * 6, t * 6 + 3)), o.push(...e.subarray(t * 6 + 3, t * 6 + 6));
930
+ for (let e = 0; e < i - 1; e++) for (let t = 0; t < r - 1; t++) {
931
+ let n = e * r + t, i = n + 1, a = n + r, o = a + 1;
932
+ s.push(n, a, i, i, a, o);
916
933
  }
917
- r.geometry = K(r.geometry, {
934
+ t.geometry = K(t.geometry, {
918
935
  positions: a,
919
936
  colors: o,
920
937
  indices: s
921
- }), r.data = t.rows;
938
+ }), t.data = n.rows;
922
939
  }
923
940
  };
924
941
  }
925
942
  // src/charts/network.js
926
- function ue(e) {
943
+ function pe(e) {
927
944
  return () => {
928
945
  e = e + 1831565813 | 0;
929
946
  let t = Math.imul(e ^ e >>> 15, 1 | e);
930
947
  return t = t + Math.imul(t ^ t >>> 7, 61 | t) ^ t, ((t ^ t >>> 14) >>> 0) / 4294967296;
931
948
  };
932
949
  }
933
- var de = [
950
+ var me = [
934
951
  1.2,
935
952
  2.5,
936
953
  4.5
937
954
  ];
938
- function fe(t) {
939
- let n = t.spec.options, o = me(t), s = t.spec.link, u = n.source ?? "source", d = n.target ?? "target", f = /* @__PURE__ */ new Map(), m = (e) => new l({
955
+ function he(t) {
956
+ let n = t.spec.options, r = _e(t), i = t.spec.link, a = n.source ?? "source", s = n.target ?? "target", c = /* @__PURE__ */ new Map(), d = (e) => new o({
940
957
  geometry: p({
941
958
  radius: 1,
942
959
  detail: 2
943
960
  }),
944
961
  material: { roughness: .35 },
945
962
  count: e,
946
- labels: V(t, "above")
947
- }), h = m(Math.max(8, t.spec.rows.length * 2));
948
- h.count = 0;
949
- let _ = de.map((e) => new a({
950
- geometry: new i({ positions: [
963
+ labels: H(t, "above")
964
+ }), m = d(Math.max(8, t.spec.rows.length * 2));
965
+ m.count = 0;
966
+ let h = me.map((t) => new e({
967
+ geometry: new f({ positions: [
951
968
  0,
952
969
  0,
953
970
  0,
@@ -956,20 +973,20 @@ function fe(t) {
956
973
  0
957
974
  ] }),
958
975
  material: {
959
- width: e,
976
+ width: t,
960
977
  vertexColors: !0
961
978
  },
962
979
  data: []
963
- })), v = new a({
964
- geometry: new i({ positions: [] }),
980
+ })), g = new e({
981
+ geometry: new f({ positions: [] }),
965
982
  material: {
966
983
  width: 4,
967
984
  color: "#7fd3ff"
968
985
  },
969
986
  pickable: !1,
970
987
  visible: !1
971
- }), y = s.flow ? new g({
972
- geometry: new i({ positions: [] }),
988
+ }), y = i.flow ? new _({
989
+ geometry: new f({ positions: [] }),
973
990
  material: {
974
991
  size: .012 * Math.min(...t.box),
975
992
  color: "#bff0ff"
@@ -977,38 +994,38 @@ function fe(t) {
977
994
  pickable: !1
978
995
  }) : null, b = [], x = [], S = [], C = [], w = null, T = {
979
996
  nodes: [
980
- ..._,
981
- v,
982
- h,
997
+ ...h,
998
+ g,
999
+ m,
983
1000
  ...y ? [y] : []
984
1001
  ],
985
- layout(n) {
986
- let i = n.map(o), a = new Map(i.map((e, t) => [e, t]));
987
- S = t.spec.links.filter((n, i) => {
988
- let s = n[u], c = n[d];
989
- return (s === void 0 || c === void 0) && e("chart()", `link ${i} has no '${s === void 0 ? u : d}' - links name their ends with source: '${u}', target: '${d}' (set 'source' and 'target' to your field names)`), t.spec.rows.some((e) => o(e) === s) || e("chart()", `link ${i}: ${u} ${r(s)} names no node`), t.spec.rows.some((e) => o(e) === c) || e("chart()", `link ${i}: ${d} ${r(c)} names no node`), a.has(s) && a.has(c);
1002
+ layout(e) {
1003
+ let n = e.map(r), i = new Map(n.map((e, t) => [e, t]));
1004
+ S = t.spec.links.filter((e, n) => {
1005
+ let o = e[a], c = e[s];
1006
+ return (o === void 0 || c === void 0) && l("chart()", `link ${n} has no '${o === void 0 ? a : s}' - links name their ends with source: '${a}', target: '${s}' (set 'source' and 'target' to your field names)`), t.spec.rows.some((e) => r(e) === o) || l("chart()", `link ${n}: ${a} ${u(o)} names no node`), t.spec.rows.some((e) => r(e) === c) || l("chart()", `link ${n}: ${s} ${u(c)} names no node`), i.has(o) && i.has(c);
990
1007
  });
991
- let s = N(n, i, S.map((e) => [a.get(e[u]), a.get(e[d])])), c = new Float32Array(n.length * 7);
992
- return n.forEach((e, n) => c.set([
993
- ...s[n],
1008
+ let o = N(e, n, S.map((e) => [i.get(e[a]), i.get(e[s])])), c = new Float32Array(e.length * 7);
1009
+ return e.forEach((e, n) => c.set([
1010
+ ...o[n],
994
1011
  t.size ? t.size(t.spec.channels.size.get(e)) : .06 * Math.min(...t.box),
995
1012
  ...t.rgb(e)
996
1013
  ], n * 7)), {
997
- rows: n,
998
- keys: i,
1014
+ rows: e,
1015
+ keys: n,
999
1016
  state: c,
1000
1017
  stride: 7,
1001
- shape: { pairs: S.map((e) => [e[u], e[d]]) }
1018
+ shape: { pairs: S.map((e) => [e[a], e[s]]) }
1002
1019
  };
1003
1020
  },
1004
1021
  apply(e, t) {
1005
1022
  let n = e.length / t.stride;
1006
- if (C = t.rows, w !== null && !C.some((e) => o(e) === w) && (w = null, v.visible = !1), n > h.instanceMatrices.length / 16) {
1007
- let e = m(n * 2);
1008
- E && e.on("hover", D), h.parent?.add(e), h.parent?.remove(h), h.dispose(), T.nodes[T.nodes.indexOf(h)] = e, h = e;
1023
+ if (C = t.rows, w !== null && !C.some((e) => r(e) === w) && (w = null, g.visible = !1), n > m.instanceMatrices.length / 16) {
1024
+ let e = d(n * 2);
1025
+ E && e.on("hover", D), m.parent?.add(e), m.parent?.remove(m), m.dispose(), T.nodes[T.nodes.indexOf(m)] = e, m = e;
1009
1026
  }
1010
- h.count = n, h.data = t.rows;
1011
- let r = t.rows.map(o), a = new Map(r.map((e, t) => [e, t]));
1027
+ m.count = n, m.data = t.rows;
1028
+ let o = t.rows.map(r), c = new Map(o.map((e, t) => [e, t]));
1012
1029
  x = [];
1013
1030
  for (let t = 0; t < n; t++) {
1014
1031
  let [n, r, i, a, o, s, c] = e.subarray(t * 7, t * 7 + 7);
@@ -1016,7 +1033,7 @@ function fe(t) {
1016
1033
  n,
1017
1034
  r,
1018
1035
  i
1019
- ]), h.setInstance(t, {
1036
+ ]), m.setInstance(t, {
1020
1037
  position: [
1021
1038
  n,
1022
1039
  r,
@@ -1030,24 +1047,24 @@ function fe(t) {
1030
1047
  ])
1031
1048
  });
1032
1049
  }
1033
- let c = de.map(() => ({
1050
+ let l = me.map(() => ({
1034
1051
  positions: [],
1035
1052
  colors: [],
1036
1053
  rows: []
1037
1054
  }));
1038
1055
  b = [], S.forEach((e, t) => {
1039
- let n = a.get(e[u]), r = a.get(e[d]);
1056
+ let n = c.get(e[a]), r = c.get(e[s]);
1040
1057
  if (n === void 0 || r === void 0) return;
1041
- let i = c[A(e)], o = j(e);
1042
- i.positions.push(...x[n], ...x[r]), i.colors.push(...o, ...o), i.rows.push(e), s.flow && b.push({
1058
+ let o = l[A(e)], u = j(e);
1059
+ o.positions.push(...x[n], ...x[r]), o.colors.push(...u, ...u), o.rows.push(e), i.flow && b.push({
1043
1060
  a: n,
1044
1061
  b: r,
1045
1062
  speed: M(e),
1046
1063
  phase: t * .618 % 1
1047
1064
  });
1048
- }), _.forEach((e, t) => {
1049
- let n = c[t];
1050
- e.geometry.dispose(), e.geometry = new i(n.positions.length ? {
1065
+ }), h.forEach((e, t) => {
1066
+ let n = l[t];
1067
+ e.geometry.dispose(), e.geometry = new f(n.positions.length ? {
1051
1068
  positions: n.positions,
1052
1069
  colors: n.colors
1053
1070
  } : { positions: [
@@ -1070,68 +1087,68 @@ function fe(t) {
1070
1087
  n.phase = (n.phase + e * n.speed) % 1;
1071
1088
  let i = x[n.a], a = x[n.b];
1072
1089
  for (let e = 0; e < 3; e++) t[r * 3 + e] = i[e] + (a[e] - i[e]) * n.phase;
1073
- }), y.geometry.vertexCount === b.length ? (y.geometry.positions.set(t), y.geometry.needsUpdate()) : (y.geometry.dispose(), y.geometry = new i({ positions: t }));
1090
+ }), y.geometry.vertexCount === b.length ? (y.geometry.positions.set(t), y.geometry.needsUpdate()) : (y.geometry.dispose(), y.geometry = new f({ positions: t }));
1074
1091
  },
1075
1092
  tooltipRows(e) {
1076
- return _.includes(e.node) ? "link" : "node";
1093
+ return h.includes(e.node) ? "link" : "node";
1077
1094
  }
1078
1095
  }, E = (n.highlight ?? "neighbours") === "neighbours";
1079
- E && h.on("hover", D);
1096
+ E && m.on("hover", D);
1080
1097
  function D(e) {
1081
- let n = e && e.node === h && e.instance !== null ? o(C[e.instance]) : null;
1098
+ let n = e && e.node === m && e.instance !== null ? r(C[e.instance]) : null;
1082
1099
  if (n !== w) {
1083
- w = n, v.visible = n !== null, n !== null && O(n);
1084
- for (let e = 0; e < h.count; e++) h.setColor(e, k(e, t.rgb(C[e])));
1100
+ w = n, g.visible = n !== null, n !== null && O(n);
1101
+ for (let e = 0; e < m.count; e++) m.setColor(e, k(e, t.rgb(C[e])));
1085
1102
  }
1086
1103
  }
1087
1104
  function O(e) {
1088
1105
  let t = [];
1089
1106
  for (let n of S) {
1090
- if (n[u] !== e && n[d] !== e) continue;
1091
- let r = C.findIndex((e) => o(e) === n[u]), i = C.findIndex((e) => o(e) === n[d]);
1092
- r >= 0 && i >= 0 && t.push(...x[r], ...x[i]);
1107
+ if (n[a] !== e && n[s] !== e) continue;
1108
+ let i = C.findIndex((e) => r(e) === n[a]), o = C.findIndex((e) => r(e) === n[s]);
1109
+ i >= 0 && o >= 0 && t.push(...x[i], ...x[o]);
1093
1110
  }
1094
- v.geometry.dispose(), v.geometry = new i({ positions: t });
1111
+ g.geometry.dispose(), g.geometry = new f({ positions: t });
1095
1112
  }
1096
1113
  function k(e, n) {
1097
1114
  if (w === null || !E) return n;
1098
- let r = o(C[e]);
1099
- return r === w || S.some((e) => e[u] === w && e[d] === r || e[d] === w && e[u] === r) ? n : new c().setSRGB(n[0], n[1], n[2]).lerp(t.theme === "light" ? "#ffffff" : "#202024", .65).toSRGB();
1115
+ let i = r(C[e]);
1116
+ return i === w || S.some((e) => e[a] === w && e[s] === i || e[s] === w && e[a] === i) ? n : new v().setSRGB(n[0], n[1], n[2]).lerp(t.theme === "light" ? "#ffffff" : "#202024", .65).toSRGB();
1100
1117
  }
1101
1118
  function A(e) {
1102
- let n = s.width;
1119
+ let n = i.width;
1103
1120
  if (!n) return 0;
1104
1121
  if (n.field === null) return n.value >= 3.5 ? 2 : +(n.value >= 2);
1105
- let r = t.spec.links.map((e) => Number(n.get(e)) || 0), i = Math.max(...r) || 1;
1106
- return Math.min(2, Math.floor((Number(n.get(e)) || 0) / i * 2.999));
1122
+ let r = t.spec.links.map((e) => Number(n.get(e)) || 0), a = Math.max(...r) || 1;
1123
+ return Math.min(2, Math.floor((Number(n.get(e)) || 0) / a * 2.999));
1107
1124
  }
1108
1125
  function j(e) {
1109
- let n = s.color, r = t.theme === "light" ? "#9aa3b2" : "#4a5266";
1110
- return n ? n.field === null ? c.fromInput(n.value).toSRGB() : t.linkColor(n.get(e)).toSRGB() : c.fromInput(r).toSRGB();
1126
+ let n = i.color, r = t.theme === "light" ? "#9aa3b2" : "#4a5266";
1127
+ return n ? n.field === null ? v.fromInput(n.value).toSRGB() : t.linkColor(n.get(e)).toSRGB() : v.fromInput(r).toSRGB();
1111
1128
  }
1112
1129
  function M(e) {
1113
- let n = s.flow;
1130
+ let n = i.flow;
1114
1131
  if (n.field === null) return .4;
1115
1132
  let r = Math.max(...t.spec.links.map((e) => Number(n.get(e)) || 0)) || 1;
1116
1133
  return .15 + .6 * (Number(n.get(e)) || 0) / r;
1117
1134
  }
1118
- function N(i, a, o) {
1119
- let [s, c, l] = t.box, u = n.layout ?? "force";
1120
- if (u === "given") {
1121
- let { x: e, y: n, z: r } = t.scales, a = t.spec.channels;
1122
- return i.map((t) => [
1123
- e && a.x ? e(a.x.get(t)) : 0,
1124
- n && a.y ? n(a.y.get(t)) : c / 2,
1125
- r && a.z ? r(a.z.get(t)) : 0
1135
+ function N(e, r, i) {
1136
+ let [a, o, s] = t.box, c = n.layout ?? "force";
1137
+ if (c === "given") {
1138
+ let { x: n, y: r, z: i } = t.scales, a = t.spec.channels;
1139
+ return e.map((e) => [
1140
+ n && a.x ? n(a.x.get(e)) : 0,
1141
+ r && a.y ? r(a.y.get(e)) : o / 2,
1142
+ i && a.z ? i(a.z.get(e)) : 0
1126
1143
  ]);
1127
1144
  }
1128
- if (u && typeof u == "object" && "tiers" in u) return pe(i, a, o, u, [
1129
- s,
1130
- c,
1131
- l
1145
+ if (c && typeof c == "object" && "tiers" in c) return ge(e, r, i, c, [
1146
+ a,
1147
+ o,
1148
+ s
1132
1149
  ]);
1133
- u !== "force" && e("chart()", `layout ${r(u)} - expected 'force', 'given' or { tiers: 'field' }`);
1134
- let d = P(a, o), f = [
1150
+ c !== "force" && l("chart()", `layout ${u(c)} - expected 'force', 'given' or { tiers: 'field' }`);
1151
+ let d = P(r, i), f = [
1135
1152
  Infinity,
1136
1153
  Infinity,
1137
1154
  Infinity
@@ -1141,40 +1158,40 @@ function fe(t) {
1141
1158
  -Infinity
1142
1159
  ];
1143
1160
  for (let e of d) for (let t = 0; t < 3; t++) f[t] = Math.min(f[t], e[t]), p[t] = Math.max(p[t], e[t]);
1144
- let m = Math.max(...p.map((e, t) => e - f[t]), 1e-6), h = Math.min(s, n.flat ? l : Math.min(c, l)) * .9 / m, g = p.map((e, t) => (e + f[t]) / 2);
1161
+ let m = Math.max(...p.map((e, t) => e - f[t]), 1e-6), h = Math.min(a, n.flat ? s : Math.min(o, s)) * .9 / m, g = p.map((e, t) => (e + f[t]) / 2);
1145
1162
  return d.map((e) => [
1146
1163
  (e[0] - g[0]) * h,
1147
- n.flat ? 0 : (e[1] - g[1]) * h + c / 2,
1164
+ n.flat ? 0 : (e[1] - g[1]) * h + o / 2,
1148
1165
  (e[2] - g[2]) * h
1149
1166
  ]);
1150
1167
  }
1151
1168
  function P(e, t) {
1152
- let r = e.length, i = ue(n.seed ?? 1), a = n.flat ? [0, 2] : [
1169
+ let r = e.length, i = pe(n.seed ?? 1), a = n.flat ? [0, 2] : [
1153
1170
  0,
1154
1171
  1,
1155
1172
  2
1156
- ], o = e.some((e) => f.has(e)), s = n.steps ?? (o ? 60 : 300), c = e.map(() => []);
1157
- for (let [e, n] of t) c[e].push(n), c[n].push(e);
1158
- let l = new Float32Array(r * r).fill(Infinity), u = 1;
1173
+ ], o = e.some((e) => c.has(e)), s = n.steps ?? (o ? 60 : 300), l = e.map(() => []);
1174
+ for (let [e, n] of t) l[e].push(n), l[n].push(e);
1175
+ let u = new Float32Array(r * r).fill(Infinity), d = 1;
1159
1176
  for (let e = 0; e < r; e++) {
1160
1177
  let t = [e];
1161
- l[e * r + e] = 0;
1178
+ u[e * r + e] = 0;
1162
1179
  for (let n = 0; n < t.length; n++) {
1163
- let i = t[n], a = l[e * r + i] + 1;
1164
- for (let n of c[i]) l[e * r + n] === Infinity && (l[e * r + n] = a, u = Math.max(u, a), t.push(n));
1180
+ let i = t[n], a = u[e * r + i] + 1;
1181
+ for (let n of l[i]) u[e * r + n] === Infinity && (u[e * r + n] = a, d = Math.max(d, a), t.push(n));
1165
1182
  }
1166
1183
  }
1167
- let d = e.map((t, a) => {
1168
- if (f.has(t)) return [...f.get(t)];
1169
- let o = c[a].find((t) => f.has(e[t])), s = o === void 0 ? [
1184
+ let f = e.map((t, a) => {
1185
+ if (c.has(t)) return [...c.get(t)];
1186
+ let o = l[a].find((t) => c.has(e[t])), s = o === void 0 ? [
1170
1187
  0,
1171
1188
  0,
1172
1189
  0
1173
- ] : f.get(e[o]), l = o === void 0 ? Math.sqrt(r) : .5;
1190
+ ] : c.get(e[o]), u = o === void 0 ? Math.sqrt(r) : .5;
1174
1191
  return [
1175
- s[0] + (i() - .5) * l,
1176
- n.flat ? 0 : s[1] + (i() - .5) * l,
1177
- s[2] + (i() - .5) * l
1192
+ s[0] + (i() - .5) * u,
1193
+ n.flat ? 0 : s[1] + (i() - .5) * u,
1194
+ s[2] + (i() - .5) * u
1178
1195
  ];
1179
1196
  }), p = [
1180
1197
  0,
@@ -1186,40 +1203,40 @@ function fe(t) {
1186
1203
  let t = 0;
1187
1204
  for (let n = 0; n < r; n++) {
1188
1205
  if (e === n) continue;
1189
- let i = l[e * r + n], a = i === Infinity ? u + 1 : i, o = 1 / (a * a), s = d[e][0] - d[n][0], c = d[e][1] - d[n][1], f = d[e][2] - d[n][2], m = Math.hypot(s, c, f) || 1e-6;
1190
- p[0] += o * (d[n][0] + a * s / m), p[1] += o * (d[n][1] + a * c / m), p[2] += o * (d[n][2] + a * f / m), t += o;
1206
+ let i = u[e * r + n], a = i === Infinity ? d + 1 : i, o = 1 / (a * a), s = f[e][0] - f[n][0], c = f[e][1] - f[n][1], l = f[e][2] - f[n][2], m = Math.hypot(s, c, l) || 1e-6;
1207
+ p[0] += o * (f[n][0] + a * s / m), p[1] += o * (f[n][1] + a * c / m), p[2] += o * (f[n][2] + a * l / m), t += o;
1191
1208
  }
1192
- if (t) for (let n of a) d[e][n] = p[n] / t;
1209
+ if (t) for (let n of a) f[e][n] = p[n] / t;
1193
1210
  }
1194
- return f = new Map(e.map((e, t) => [e, d[t]])), d;
1211
+ return c = new Map(e.map((e, t) => [e, f[t]])), f;
1195
1212
  }
1196
1213
  return T;
1197
1214
  }
1198
- function pe(t, n, r, i, [a, o, s]) {
1199
- let c = i.tiers;
1200
- if (!t.length) return [];
1201
- c in t[0] || e("chart()", `layout: { tiers: '${c}' } - '${c}' isn't a node field`);
1202
- let l = i.order ?? [...new Set(t.map((e) => e[c]))], u = t.map((e) => Math.max(0, l.indexOf(e[c]))), d = Math.max(...u) + 1, f = Array(t.length).fill(0), p = Array(t.length), m = Math.min(a, s) / 2 * .92;
1203
- for (let e = 0; e < d; e++) {
1204
- let n = t.map((e, t) => t).filter((t) => u[t] === e), i = (t) => {
1205
- let i = r.filter(([e, n]) => e === t || n === t).map(([e, n]) => e === t ? n : e).filter((t) => u[t] < e);
1206
- return i.length ? i.reduce((e, t) => e + f[t], 0) / i.length : n.indexOf(t);
1215
+ function ge(e, t, n, r, [i, a, o]) {
1216
+ let s = r.tiers;
1217
+ if (!e.length) return [];
1218
+ s in e[0] || l("chart()", `layout: { tiers: '${s}' } - '${s}' isn't a node field`);
1219
+ let c = r.order ?? [...new Set(e.map((e) => e[s]))], u = e.map((e) => Math.max(0, c.indexOf(e[s]))), d = Math.max(...u) + 1, f = Array(e.length).fill(0), p = Array(e.length), m = Math.min(i, o) / 2 * .92;
1220
+ for (let t = 0; t < d; t++) {
1221
+ let r = e.map((e, t) => t).filter((e) => u[e] === t), i = (e) => {
1222
+ let i = n.filter(([t, n]) => t === e || n === e).map(([t, n]) => t === e ? n : t).filter((e) => u[e] < t);
1223
+ return i.length ? i.reduce((e, t) => e + f[t], 0) / i.length : r.indexOf(e);
1207
1224
  };
1208
- e > 0 && n.sort((e, t) => i(e) - i(t));
1209
- let a = n.length === 1 ? 0 : e === 0 ? m * .25 : m * (.35 + .65 * e / Math.max(1, d - 1));
1210
- n.forEach((t, r) => {
1211
- f[t] = (r + .5) / n.length * Math.PI * 2, p[t] = [
1212
- Math.cos(f[t]) * a,
1213
- o * (1 - e / Math.max(1, d - 1)),
1214
- Math.sin(f[t]) * a
1225
+ t > 0 && r.sort((e, t) => i(e) - i(t));
1226
+ let o = r.length === 1 ? 0 : t === 0 ? m * .25 : m * (.35 + .65 * t / Math.max(1, d - 1));
1227
+ r.forEach((e, n) => {
1228
+ f[e] = (n + .5) / r.length * Math.PI * 2, p[e] = [
1229
+ Math.cos(f[e]) * o,
1230
+ a * (1 - t / Math.max(1, d - 1)),
1231
+ Math.sin(f[e]) * o
1215
1232
  ];
1216
1233
  });
1217
1234
  }
1218
1235
  return p;
1219
1236
  }
1220
- function me(t) {
1221
- let n = t.spec.channels.key;
1222
- return n ? (e) => n.get(e) : (t.spec.rows.length && !("id" in t.spec.rows[0]) && e("chart()", "network nodes need an 'id' field, or key: 'yourIdField' - links name nodes by it"), (e) => e.id);
1237
+ function _e(e) {
1238
+ let t = e.spec.channels.key;
1239
+ return t ? (e) => t.get(e) : (e.spec.rows.length && !("id" in e.spec.rows[0]) && l("chart()", "network nodes need an 'id' field, or key: 'yourIdField' - links name nodes by it"), (e) => e.id);
1223
1240
  }
1224
1241
  // src/charts/spec.js
1225
1242
  var q = [
@@ -1263,7 +1280,7 @@ var q = [
1263
1280
  "$schema",
1264
1281
  "description",
1265
1282
  ...J
1266
- ], he = [
1283
+ ], ve = [
1267
1284
  "field",
1268
1285
  "type",
1269
1286
  "title",
@@ -1273,7 +1290,7 @@ var q = [
1273
1290
  "value",
1274
1291
  "priority",
1275
1292
  "legend"
1276
- ], ge = {
1293
+ ], ye = {
1277
1294
  series: "phoria2 charts map fields to channels instead of listing series - e.g. { mark: 'bar', x: 'month', y: 'sales', color: 'region' }",
1278
1295
  xAxis: "axes come from the channels - use x: { field, axis: { title } }",
1279
1296
  yAxis: "axes come from the channels - use y: { field, axis: { title } }",
@@ -1293,7 +1310,7 @@ var q = [
1293
1310
  colors: "use color: { field, scale: { range: [...] } }",
1294
1311
  nodes: "a network's nodes and links go in data: { nodes, links }",
1295
1312
  links: "a network's nodes and links go in data: { nodes, links }"
1296
- }, _e = {
1313
+ }, be = {
1297
1314
  scatter: "point",
1298
1315
  scatter3d: "point",
1299
1316
  circle: "point",
@@ -1308,7 +1325,7 @@ var q = [
1308
1325
  ribbon: "area",
1309
1326
  lines: "line",
1310
1327
  rect: "bar"
1311
- }, ve = {
1328
+ }, xe = {
1312
1329
  overlap: "set overlap on the chart - { overlap: 'dim' | 'hide' | 'show' } - it applies to all the chart's labels",
1313
1330
  aggregate: "aggregate the rows first (e.g. sum per month) - charts draw rows as given",
1314
1331
  bin: "bin the rows first - charts draw rows as given",
@@ -1316,143 +1333,143 @@ var q = [
1316
1333
  sort: "sort with scale: { domain: [...] } in the order you want",
1317
1334
  stack: "stacking is the chart's option: stack: true"
1318
1335
  };
1319
- function ye(t) {
1320
- (!t || typeof t != "object" || Array.isArray(t)) && e("chart()", `expected a spec such as { mark: 'bar', data, x, y }, got ${r(t)}`);
1321
- for (let n of Object.keys(t)) Y.includes(n) || e("chart()", `unknown option '${n}' - ${ge[n] ?? `expected ${Y.filter((e) => e[0] !== "$").join(", ")}${d(n, Y)}`}`);
1322
- typeof t.width == "number" && t.width > 1 && e("chart()", "'width' is a bar's share of its band (0-1); in Vega-Lite it is pixels - here the canvas sets the size");
1323
- let n = be(t.mark), { rows: i, links: a } = xe(t.data, n), s = Se(i), c = { ...t.encoding ?? {} };
1324
- for (let t of Object.keys(c)) !J.includes(t) && t !== "tooltip" && e("chart()", `encoding '${t}' isn't a channel we have - channels are ${J.join(", ")}, tooltip`);
1325
- let l = {};
1326
- for (let e of J) {
1327
- let n = t[e] ?? c[e];
1328
- n != null && (l[e] = X(e, n, i, s));
1336
+ function Se(e) {
1337
+ (!e || typeof e != "object" || Array.isArray(e)) && l("chart()", `expected a spec such as { mark: 'bar', data, x, y }, got ${u(e)}`);
1338
+ for (let n of Object.keys(e)) Y.includes(n) || l("chart()", `unknown option '${n}' - ${ye[n] ?? `expected ${Y.filter((e) => e[0] !== "$").join(", ")}${t(n, Y)}`}`);
1339
+ typeof e.width == "number" && e.width > 1 && l("chart()", "'width' is a bar's share of its band (0-1); in Vega-Lite it is pixels - here the canvas sets the size");
1340
+ let r = Ce(e.mark), { rows: i, links: a } = we(e.data, r), o = Te(i), s = { ...e.encoding ?? {} };
1341
+ for (let e of Object.keys(s)) !J.includes(e) && e !== "tooltip" && l("chart()", `encoding '${e}' isn't a channel we have - channels are ${J.join(", ")}, tooltip`);
1342
+ let c = {};
1343
+ for (let t of J) {
1344
+ let n = e[t] ?? s[t];
1345
+ n != null && (c[t] = X(t, n, i, o));
1329
1346
  }
1330
- if (n === "network") for (let n of [
1347
+ if (r === "network") for (let t of [
1331
1348
  "x",
1332
1349
  "y",
1333
1350
  "z"
1334
- ]) l[n] && t.layout !== "given" && e("chart()", `${n} on a 'network' places its nodes - add layout: 'given' to use positions from the data`);
1335
- else for (let t of n === "surface" ? [
1351
+ ]) c[t] && e.layout !== "given" && l("chart()", `${t} on a 'network' places its nodes - add layout: 'given' to use positions from the data`);
1352
+ else for (let e of r === "surface" ? [
1336
1353
  "x",
1337
1354
  "z",
1338
1355
  "y"
1339
- ] : ["x", "y"]) l[t] || e("chart()", `a '${n}' chart needs ${t} - e.g. ${t}: '${s[0] ?? "field"}'`), n !== "point" && l[t].field === null && e("chart()", `${t} on a '${n}' chart lays its marks out along a scale - it needs a field, not a constant value - e.g. ${t}: '${s[0] ?? "field"}'`);
1340
- let u = t.tooltip ?? c.tooltip, f = typeof t.mark == "object" ? t.mark.tooltip : void 0, p = Ee(u ?? (f !== !1 && void 0), l, i, s), m = {};
1341
- if (t.link !== void 0) {
1342
- n !== "network" && e("chart()", "'link' sets a network's link channels - it needs mark: 'network'");
1343
- let r = Se(a);
1344
- for (let [n, i] of Object.entries(t.link)) [
1356
+ ] : ["x", "y"]) c[e] || l("chart()", `a '${r}' chart needs ${e} - e.g. ${e}: '${o[0] ?? "field"}'`), r !== "point" && c[e].field === null && l("chart()", `${e} on a '${r}' chart lays its marks out along a scale - it needs a field, not a constant value - e.g. ${e}: '${o[0] ?? "field"}'`);
1357
+ let d = e.tooltip ?? s.tooltip, f = typeof e.mark == "object" ? e.mark.tooltip : void 0, p = ke(d ?? (f !== !1 && void 0), c, i, o), m = {};
1358
+ if (e.link !== void 0) {
1359
+ r !== "network" && l("chart()", "'link' sets a network's link channels - it needs mark: 'network'");
1360
+ let t = Te(a);
1361
+ for (let [n, r] of Object.entries(e.link)) [
1345
1362
  "width",
1346
1363
  "color",
1347
1364
  "opacity",
1348
1365
  "flow",
1349
1366
  "tooltip"
1350
- ].includes(n) || e("chart()", `link has no '${n}' - link channels are width, color, opacity, flow, tooltip`), n !== "tooltip" && (m[n] = X(`link.${n}`, i, a, r));
1351
- t.link.tooltip !== void 0 && (m.tooltip = Ee(t.link.tooltip, {}, a, r));
1367
+ ].includes(n) || l("chart()", `link has no '${n}' - link channels are width, color, opacity, flow, tooltip`), n !== "tooltip" && (m[n] = X(`link.${n}`, r, a, t));
1368
+ e.link.tooltip !== void 0 && (m.tooltip = ke(e.link.tooltip, {}, a, t));
1352
1369
  }
1353
1370
  let h = {};
1354
- for (let e of Y) !J.includes(e) && ![
1371
+ for (let t of Y) !J.includes(t) && ![
1355
1372
  "mark",
1356
1373
  "data",
1357
1374
  "encoding",
1358
1375
  "tooltip",
1359
1376
  "link"
1360
- ].includes(e) && t[e] !== void 0 && (h[e] = t[e]);
1361
- return h.steps !== void 0 && (!Number.isInteger(h.steps) || h.steps < 1) && e("chart()", `'steps' is how many steps the force layout takes, a whole number of 1 or more, got ${r(h.steps)}`), h.seed !== void 0 && o("chart()", "seed", h.seed), h.legend?.ticks !== void 0 && we("legend", h.legend.ticks), h.box === void 0 || Array.isArray(h.box) && h.box.length === 3 && h.box.every((e) => e > 0) || e("chart()", `'box' is the chart's size in the scene, [x, y, z] above 0, got ${r(h.box)}`), {
1362
- mark: n,
1377
+ ].includes(t) && e[t] !== void 0 && (h[t] = e[t]);
1378
+ return h.steps !== void 0 && (!Number.isInteger(h.steps) || h.steps < 1) && l("chart()", `'steps' is how many steps the force layout takes, a whole number of 1 or more, got ${u(h.steps)}`), h.seed !== void 0 && n("chart()", "seed", h.seed), h.legend?.ticks !== void 0 && De("legend", h.legend.ticks), h.box === void 0 || Array.isArray(h.box) && h.box.length === 3 && h.box.every((e) => e > 0) || l("chart()", `'box' is the chart's size in the scene, [x, y, z] above 0, got ${u(h.box)}`), {
1379
+ mark: r,
1363
1380
  rows: i,
1364
1381
  links: a,
1365
- fields: s,
1366
- channels: l,
1382
+ fields: o,
1383
+ channels: c,
1367
1384
  tooltip: p,
1368
1385
  link: m,
1369
1386
  options: h
1370
1387
  };
1371
1388
  }
1372
- function be(t) {
1373
- let n = t;
1389
+ function Ce(e) {
1390
+ let n = e;
1374
1391
  if (n && typeof n == "object") {
1375
- for (let t of Object.keys(n)) t !== "type" && t !== "tooltip" && e("chart()", `mark option '${t}' isn't supported - use the chart's options (width, stack, ...) or style the chart's nodes`);
1392
+ for (let e of Object.keys(n)) e !== "type" && e !== "tooltip" && l("chart()", `mark option '${e}' isn't supported - use the chart's options (width, stack, ...) or style the chart's nodes`);
1376
1393
  n = n.type;
1377
1394
  }
1378
- if (typeof n != "string" && e("chart()", `'mark' is required: one of ${q.map((e) => `'${e}'`).join(", ")}`), !q.includes(n)) {
1379
- let t = _e[n];
1380
- (n === "pie" || n === "arc" || n === "donut") && e("chart()", "pie and donut charts aren't supported - in 3D they distort values; use mark: 'bar'"), e("chart()", `mark '${n}' - ${t ? `use '${t}'` : `expected one of ${q.map((e) => `'${e}'`).join(", ")}${d(n, q)}`}`);
1395
+ if (typeof n != "string" && l("chart()", `'mark' is required: one of ${q.map((e) => `'${e}'`).join(", ")}`), !q.includes(n)) {
1396
+ let e = be[n];
1397
+ (n === "pie" || n === "arc" || n === "donut") && l("chart()", "pie and donut charts aren't supported - in 3D they distort values; use mark: 'bar'"), l("chart()", `mark '${n}' - ${e ? `use '${e}'` : `expected one of ${q.map((e) => `'${e}'`).join(", ")}${t(n, q)}`}`);
1381
1398
  }
1382
1399
  return n;
1383
1400
  }
1384
- function xe(t, n) {
1385
- if (t && typeof t == "object" && !Array.isArray(t) && "url" in t && e("chart()", "data: { url } isn't loaded for you - fetch the rows and pass data: rows"), n === "network") return t && Array.isArray(t.nodes) && Array.isArray(t.links) || e("chart()", `a network's data is { nodes: [...], links: [...] }, got ${r(t)}`), {
1386
- rows: t.nodes,
1387
- links: t.links
1401
+ function we(e, t) {
1402
+ if (e && typeof e == "object" && !Array.isArray(e) && "url" in e && l("chart()", "data: { url } isn't loaded for you - fetch the rows and pass data: rows"), t === "network") return e && Array.isArray(e.nodes) && Array.isArray(e.links) || l("chart()", `a network's data is { nodes: [...], links: [...] }, got ${u(e)}`), {
1403
+ rows: e.nodes,
1404
+ links: e.links
1388
1405
  };
1389
- let i = Array.isArray(t) ? t : t && Array.isArray(t.values) ? t.values : null;
1390
- return i || e("chart()", `'data' must be an array of rows (objects), or { values: [...] }, got ${r(t)}`), i.some((e) => !e || typeof e != "object") && e("chart()", "every row in 'data' must be an object, such as { month: 'Jan', sales: 41 }"), {
1391
- rows: i,
1406
+ let n = Array.isArray(e) ? e : e && Array.isArray(e.values) ? e.values : null;
1407
+ return n || l("chart()", `'data' must be an array of rows (objects), or { values: [...] }, got ${u(e)}`), n.some((e) => !e || typeof e != "object") && l("chart()", "every row in 'data' must be an object, such as { month: 'Jan', sales: 41 }"), {
1408
+ rows: n,
1392
1409
  links: []
1393
1410
  };
1394
1411
  }
1395
- function Se(e) {
1412
+ function Te(e) {
1396
1413
  let t = /* @__PURE__ */ new Set();
1397
1414
  for (let n of e.slice(0, 50)) for (let e of Object.keys(n)) t.add(e);
1398
1415
  return [...t];
1399
1416
  }
1400
- function Ce(e, t) {
1417
+ function Ee(e, t) {
1401
1418
  let n = e.find((e) => e[t] !== null && e[t] !== void 0)?.[t];
1402
1419
  return typeof n == "number" ? "quantitative" : n instanceof Date || typeof n == "string" && /^\d{4}-\d{2}(-\d{2})?([T ][\d:.]+Z?)?$/.test(n) ? "temporal" : "nominal";
1403
1420
  }
1404
- function X(t, n, i, a) {
1405
- let o = "chart()", s;
1406
- if (typeof n == "string") a.includes(n) ? s = { field: n } : /color|colour/.test(t) && Te(n) ? s = { value: n } : e(o, `${t}: field '${n}' isn't in the data - fields are ${a.join(", ") || "(none)"}${d(n, a)}`);
1421
+ function X(e, n, r, i) {
1422
+ let a = "chart()", o;
1423
+ if (typeof n == "string") i.includes(n) ? o = { field: n } : /color|colour/.test(e) && Oe(n) ? o = { value: n } : l(a, `${e}: field '${n}' isn't in the data - fields are ${i.join(", ") || "(none)"}${t(n, i)}`);
1407
1424
  else if (typeof n == "number" && [
1408
1425
  "size",
1409
1426
  "opacity",
1410
1427
  "link.width",
1411
1428
  "link.opacity",
1412
1429
  "link.flow"
1413
- ].includes(t)) s = { value: n };
1430
+ ].includes(e)) o = { value: n };
1414
1431
  else if (n && typeof n == "object" && !Array.isArray(n)) {
1415
- s = n;
1416
- for (let n of Object.keys(s)) he.includes(n) || e(o, `${t}: '${n}' - ${ve[n] ?? `unknown; a channel takes ${he.join(", ")}`}`);
1417
- s.field !== void 0 && !a.includes(s.field) && e(o, `${t}: field '${s.field}' isn't in the data - fields are ${a.join(", ") || "(none)"}${d(String(s.field), a)}`), s.field === void 0 && s.value === void 0 && e(o, `${t} needs a field (or a constant value)`);
1418
- } else return t === "size" && Array.isArray(n) && e(o, "'size' is a channel - the chart's size in the scene is 'box: [x, y, z]'"), e(o, `${t} must be a field name or { field, ... }, got ${r(n)}`);
1419
- s.axis?.ticks !== void 0 && we(`${t}: axis`, s.axis.ticks);
1420
- let c = s.field ?? null, l = s.type ?? (c ? Ce(i, c) : "nominal");
1432
+ o = n;
1433
+ for (let t of Object.keys(o)) ve.includes(t) || l(a, `${e}: '${t}' - ${xe[t] ?? `unknown; a channel takes ${ve.join(", ")}`}`);
1434
+ o.field !== void 0 && !i.includes(o.field) && l(a, `${e}: field '${o.field}' isn't in the data - fields are ${i.join(", ") || "(none)"}${t(String(o.field), i)}`), o.field === void 0 && o.value === void 0 && l(a, `${e} needs a field (or a constant value)`);
1435
+ } else return e === "size" && Array.isArray(n) && l(a, "'size' is a channel - the chart's size in the scene is 'box: [x, y, z]'"), l(a, `${e} must be a field name or { field, ... }, got ${u(n)}`);
1436
+ o.axis?.ticks !== void 0 && De(`${e}: axis`, o.axis.ticks);
1437
+ let s = o.field ?? null, c = o.type ?? (s ? Ee(r, s) : "nominal");
1421
1438
  [
1422
1439
  "quantitative",
1423
1440
  "nominal",
1424
1441
  "ordinal",
1425
1442
  "temporal"
1426
- ].includes(l) || e(o, `${t}: type '${l}' - expected 'quantitative', 'nominal', 'ordinal' or 'temporal'${d(String(l), [
1443
+ ].includes(c) || l(a, `${e}: type '${c}' - expected 'quantitative', 'nominal', 'ordinal' or 'temporal'${t(String(c), [
1427
1444
  "quantitative",
1428
1445
  "nominal",
1429
1446
  "ordinal",
1430
1447
  "temporal"
1431
1448
  ])}`);
1432
- let u = c === null ? () => s.value : l === "temporal" ? (e) => I(e[c]) : (e) => e[c];
1449
+ let d = s === null ? () => o.value : c === "temporal" ? (e) => L(e[s]) : (e) => e[s];
1433
1450
  return {
1434
- field: c,
1435
- value: s.value,
1436
- type: l,
1437
- title: s.title ?? c ?? t,
1438
- format: s.format,
1439
- scale: s.scale ?? {},
1440
- axis: s.axis ?? {},
1441
- get: u,
1442
- priority: s.priority
1451
+ field: s,
1452
+ value: o.value,
1453
+ type: c,
1454
+ title: o.title ?? s ?? e,
1455
+ format: o.format,
1456
+ scale: o.scale ?? {},
1457
+ axis: o.axis ?? {},
1458
+ get: d,
1459
+ priority: o.priority
1443
1460
  };
1444
1461
  }
1445
- function we(t, n) {
1446
- Array.isArray(n) || Number.isInteger(n) && n > 0 || e("chart()", `${t} ticks are a list of the values to mark, such as [0, 25, 50, 75, 100], or about how many, got ${r(n)}`);
1462
+ function De(e, t) {
1463
+ Array.isArray(t) || Number.isInteger(t) && t > 0 || l("chart()", `${e} ticks are a list of the values to mark, such as [0, 25, 50, 75, 100], or about how many, got ${u(t)}`);
1447
1464
  }
1448
- function Te(e) {
1465
+ function Oe(e) {
1449
1466
  try {
1450
- return c.fromInput(e), !0;
1467
+ return v.fromInput(e), !0;
1451
1468
  } catch {
1452
1469
  return !1;
1453
1470
  }
1454
1471
  }
1455
- function Ee(e, t, n, r) {
1472
+ function ke(e, t, n, r) {
1456
1473
  if (e === !1 || e === null) return null;
1457
1474
  if (typeof e == "function") return e;
1458
1475
  if (e === void 0 || e === !0) {
@@ -1463,25 +1480,25 @@ function Ee(e, t, n, r) {
1463
1480
  return i.map((e) => a(e) || X("tooltip", e, n, r));
1464
1481
  }
1465
1482
  // src/charts/style.js
1466
- var De = "\n/* ticks are bare text: the padding is breathing room, so the overlap the label layout allows never runs them together */\n:where(.phoria-axis-tick) { padding: 0 4px; color: #8b909c; font: 11px/1.2 system-ui, sans-serif; font-variant-numeric: tabular-nums; }\n:where(.phoria-axis-title) { color: #c8ccd4; font: 600 12px/1.2 system-ui, sans-serif; }\n:where(.phoria-value) { padding: 1px 5px; border-radius: 4px; background: rgba(16, 16, 20, 0.72); color: #eee;\n font: 11px/1.3 system-ui, sans-serif; font-variant-numeric: tabular-nums; }\n:where(.phoria-light.phoria-axis-tick) { color: #5d6370; }\n:where(.phoria-light.phoria-axis-title) { color: #2b2f37; }\n:where(.phoria-light.phoria-value) { background: rgba(255, 255, 255, 0.85); color: #222; }\n:where(.phoria-legend) { position: absolute; display: flex; flex-direction: column; gap: 3px; padding: 8px 10px;\n border-radius: 8px; background: rgba(20, 20, 24, 0.78); color: #e6e6e6; font: 12px/1.3 system-ui, sans-serif;\n pointer-events: auto; max-height: calc(100% - 24px); overflow: auto; }\n:where(.phoria-light.phoria-legend) { background: rgba(255, 255, 255, 0.88); color: #222; }\n:where(.phoria-legend-top-right) { top: 12px; right: 12px; }\n:where(.phoria-legend-top-left) { top: 12px; left: 12px; }\n:where(.phoria-legend-bottom-right) { bottom: 12px; right: 12px; }\n:where(.phoria-legend-bottom-left) { bottom: 12px; left: 12px; }\n:where(.phoria-legend-title) { opacity: 0.7; font-size: 11px; margin-bottom: 2px; }\n:where(.phoria-legend-item) { display: flex; align-items: center; gap: 6px; padding: 0; border: 0; background: none;\n color: inherit; font: inherit; text-align: left; cursor: pointer; }\n:where(.phoria-legend-item.off) { opacity: 0.35; }\n:where(.phoria-legend-swatch) { width: 10px; height: 10px; border-radius: 2px; flex: none; }\n/* a number key is up to 140px tall and gives way in a short view, so the legend never scrolls; its\n values share one grid cell, so the widest sets the key's width, each raised to its place */\n:where(.phoria-legend-key) { display: flex; gap: 6px; margin: 6px 0; flex: 0 1 140px; min-height: 48px; }\n:where(.phoria-legend-ramp) { width: 10px; border-radius: 2px; flex: none; }\n:where(.phoria-legend-scale) { display: grid; font-size: 11px; font-variant-numeric: tabular-nums; }\n:where(.phoria-legend-scale > span) { grid-area: 1 / 1; align-self: end; position: relative; transform: translateY(50%);\n white-space: nowrap; opacity: 0.8; }\n";
1467
- function Oe() {
1483
+ var Ae = "\n/* ticks are bare text: the padding is breathing room, so the overlap the label layout allows never runs them together */\n:where(.phoria-axis-tick) { padding: 0 4px; color: #8b909c; font: 11px/1.2 system-ui, sans-serif; font-variant-numeric: tabular-nums; }\n:where(.phoria-axis-title) { color: #c8ccd4; font: 600 12px/1.2 system-ui, sans-serif; }\n:where(.phoria-value) { padding: 1px 5px; border-radius: 4px; background: rgba(16, 16, 20, 0.72); color: #eee;\n font: 11px/1.3 system-ui, sans-serif; font-variant-numeric: tabular-nums; }\n:where(.phoria-light.phoria-axis-tick) { color: #5d6370; }\n:where(.phoria-light.phoria-axis-title) { color: #2b2f37; }\n:where(.phoria-light.phoria-value) { background: rgba(255, 255, 255, 0.85); color: #222; }\n:where(.phoria-legend) { position: absolute; display: flex; flex-direction: column; gap: 3px; padding: 8px 10px;\n border-radius: 8px; background: rgba(20, 20, 24, 0.78); color: #e6e6e6; font: 12px/1.3 system-ui, sans-serif;\n pointer-events: auto; max-height: calc(100% - 24px); overflow: auto; }\n:where(.phoria-light.phoria-legend) { background: rgba(255, 255, 255, 0.88); color: #222; }\n:where(.phoria-legend-top-right) { top: 12px; right: 12px; }\n:where(.phoria-legend-top-left) { top: 12px; left: 12px; }\n:where(.phoria-legend-bottom-right) { bottom: 12px; right: 12px; }\n:where(.phoria-legend-bottom-left) { bottom: 12px; left: 12px; }\n:where(.phoria-legend-title) { opacity: 0.7; font-size: 11px; margin-bottom: 2px; }\n:where(.phoria-legend-item) { display: flex; align-items: center; gap: 6px; padding: 0; border: 0; background: none;\n color: inherit; font: inherit; text-align: left; cursor: pointer; }\n:where(.phoria-legend-item.off) { opacity: 0.35; }\n:where(.phoria-legend-swatch) { width: 10px; height: 10px; border-radius: 2px; flex: none; }\n/* a number key is up to 140px tall and gives way in a short view, so the legend never scrolls; its\n values share one grid cell, so the widest sets the key's width, each raised to its place */\n:where(.phoria-legend-key) { display: flex; gap: 6px; margin: 6px 0; flex: 0 1 140px; min-height: 48px; }\n:where(.phoria-legend-ramp) { width: 10px; border-radius: 2px; flex: none; }\n:where(.phoria-legend-scale) { display: grid; font-size: 11px; font-variant-numeric: tabular-nums; }\n:where(.phoria-legend-scale > span) { grid-area: 1 / 1; align-self: end; position: relative; transform: translateY(50%);\n white-space: nowrap; opacity: 0.8; }\n";
1484
+ function je() {
1468
1485
  if (typeof document > "u" || document.getElementById("phoria-chart-style")) return;
1469
1486
  let e = document.createElement("style");
1470
- e.id = "phoria-chart-style", e.textContent = De, document.head.prepend(e);
1487
+ e.id = "phoria-chart-style", e.textContent = Ae, document.head.prepend(e);
1471
1488
  }
1472
1489
  // src/charts/Chart.js
1473
- var ke = u.filter((e) => ![
1490
+ var Me = c.filter((e) => ![
1474
1491
  "children",
1475
1492
  "tooltip",
1476
1493
  "highlight"
1477
1494
  ].includes(e));
1478
- function Ae(e) {
1495
+ function Ne(e) {
1479
1496
  return new Z(e);
1480
1497
  }
1481
- var Z = class t extends h {
1498
+ var Z = class e extends h {
1482
1499
  static type = "chart";
1483
1500
  static get OPTIONS() {
1484
- return u;
1501
+ return c;
1485
1502
  }
1486
1503
  scales = {};
1487
1504
  #e;
@@ -1496,11 +1513,11 @@ var Z = class t extends h {
1496
1513
  #l = null;
1497
1514
  #u = null;
1498
1515
  #d = null;
1499
- constructor(t) {
1500
- (!t || typeof t != "object" || Array.isArray(t)) && e("chart()", `expected a spec such as { mark: 'bar', data, x, y }, got ${r(t)}`);
1501
- let n = {}, i = {};
1502
- for (let [e, r] of Object.entries(t)) (ke.includes(e) ? n : i)[e] = r;
1503
- t.children && e("chart()", "a chart makes its own children - add other nodes to a Group beside it"), super(n), Oe(), this.#e = i, this.#i = {}, this.#f(!0), this.onUpdate((e, t) => this.#_(t));
1516
+ constructor(e) {
1517
+ (!e || typeof e != "object" || Array.isArray(e)) && l("chart()", `expected a spec such as { mark: 'bar', data, x, y }, got ${u(e)}`);
1518
+ let t = {}, n = {};
1519
+ for (let [r, i] of Object.entries(e)) (Me.includes(r) ? t : n)[r] = i;
1520
+ e.children && l("chart()", "a chart makes its own children - add other nodes to a Group beside it"), super(t), je(), this.#e = n, this.#i = {}, this.#f(!0), this.onUpdate((e, t) => this.#_(t));
1504
1521
  }
1505
1522
  get spec() {
1506
1523
  let e = this.#t;
@@ -1526,8 +1543,8 @@ var Z = class t extends h {
1526
1543
  ...e
1527
1544
  }, this.#f(!0), this;
1528
1545
  }
1529
- filter(t) {
1530
- return t !== null && typeof t != "function" && e("Chart", `filter() takes (row) => boolean, or null, got ${r(t)}`), this.#c = t, this.#f(!0), this;
1546
+ filter(e) {
1547
+ return e !== null && typeof e != "function" && l("Chart", `filter() takes (row) => boolean, or null, got ${u(e)}`), this.#c = e, this.#f(!0), this;
1531
1548
  }
1532
1549
  explain() {
1533
1550
  let e = this.#t, t = [
@@ -1540,6 +1557,18 @@ var Z = class t extends h {
1540
1557
  }), n = this.#u?.rows.length ?? 0;
1541
1558
  return `Chart (${e.mark}): ${n} of ${e.rows.length} rows shown${t.length ? `; ${t.join(", ")}` : ""}${e.links.length ? `; ${e.links.length} links` : ""}`;
1542
1559
  }
1560
+ summary() {
1561
+ let e = this.#t, t = e.options;
1562
+ if (t.description) return String(t.description);
1563
+ let n = [...new Set([
1564
+ "x",
1565
+ "y",
1566
+ "z",
1567
+ "color",
1568
+ "size"
1569
+ ].map((t) => e.channels[t]).filter((e) => e?.field).map((e) => e.title))], r = (e, t) => `${e} ${e === 1 ? t : `${t}s`}`, i = `${e.mark} chart of ${r(e.rows.length, "row")}${n.length ? ` by ${n.join(", ")}` : ""}${e.links.length ? ` and ${r(e.links.length, "link")}` : ""}`;
1570
+ return t.title ? `${t.title}: ${i}` : i;
1571
+ }
1543
1572
  jsonOptions() {
1544
1573
  return { ...this.#e };
1545
1574
  }
@@ -1548,9 +1577,9 @@ var Z = class t extends h {
1548
1577
  return delete e.children, this.#e.highlight === void 0 && delete e.highlight, e;
1549
1578
  }
1550
1579
  clone() {
1551
- let { name: e, position: n, quaternion: r, scale: i, visible: a, pickable: o, highlightWhole: s, onHover: c, onClick: l, showFrom: u, clip: d, onDrag: f, outline: p } = super.cloneOptions(), m = new t({
1580
+ let { name: t, position: n, quaternion: r, scale: i, visible: a, pickable: o, highlightWhole: s, onHover: c, onClick: l, showFrom: u, clip: d, onDrag: f, outline: p } = super.cloneOptions(), m = new e({
1552
1581
  ...this.#e,
1553
- name: e,
1582
+ name: t,
1554
1583
  position: n,
1555
1584
  quaternion: r,
1556
1585
  scale: i,
@@ -1566,34 +1595,34 @@ var Z = class t extends h {
1566
1595
  });
1567
1596
  return m.userData = structuredClone(this.userData), m.matrixAutoUpdate = this.matrixAutoUpdate, m.matrixAutoUpdate || m.matrix.copy(this.matrix), m;
1568
1597
  }
1569
- #f(t) {
1570
- let n = ye(this.#e), r = n.options, i = n.channels;
1571
- this.#t = n;
1572
- let a = r.box ?? Ne(n), o = r.theme ?? "dark";
1573
- o !== "dark" && o !== "light" && e("chart()", `theme '${o}' - expected 'dark' or 'light'`);
1574
- let s = r.overlap ?? "dim";
1598
+ #f(e) {
1599
+ let t = Se(this.#e), n = t.options, r = t.channels;
1600
+ this.#t = t;
1601
+ let a = n.box ?? Ie(t), o = n.theme ?? "dark";
1602
+ o !== "dark" && o !== "light" && l("chart()", `theme '${o}' - expected 'dark' or 'light'`);
1603
+ let s = n.overlap ?? "dim";
1575
1604
  [
1576
1605
  "dim",
1577
1606
  "hide",
1578
1607
  "show"
1579
- ].includes(s) || e("chart()", `overlap '${s}' - expected 'dim', 'hide' or 'show'`);
1580
- let l = n.rows.filter((e) => (!this.#c || this.#c(e)) && (!i.color?.field || !this.#s.has(String(i.color.get(e)))));
1581
- this.scales = Le(n, a);
1582
- let u = this.scales.color, d = c.fromInput(i.color?.field ? L.category[0] : i.color?.value ?? L.category[0], "chart()").toSRGB(), f = n.link.color?.field ? Fe(n.link.color, n.links.map((e) => n.link.color.get(e))) : null;
1608
+ ].includes(s) || l("chart()", `overlap '${s}' - expected 'dim', 'hide' or 'show'`);
1609
+ let c = t.rows.filter((e) => (!this.#c || this.#c(e)) && (!r.color?.field || !this.#s.has(String(r.color.get(e)))));
1610
+ this.scales = Be(t, a);
1611
+ let u = this.scales.color, d = v.fromInput(r.color?.field ? R.category[0] : r.color?.value ?? R.category[0], "chart()").toSRGB(), f = t.link.color?.field ? Re(t.link.color, t.links.map((e) => t.link.color.get(e))) : null;
1583
1612
  Object.assign(this.#i, {
1584
- spec: n,
1613
+ spec: t,
1585
1614
  box: a,
1586
1615
  theme: o,
1587
1616
  overlap: s,
1588
1617
  scales: this.scales,
1589
1618
  size: this.scales.size ?? null,
1590
- rgb: (e) => u ? u(Ie(n, e)).toSRGB() : d,
1619
+ rgb: (e) => u ? u(ze(t, e)).toSRGB() : d,
1591
1620
  format: $,
1592
1621
  linkColor: (e) => f(e)
1593
1622
  });
1594
1623
  let p = JSON.stringify([
1595
- n.mark,
1596
- Object.entries(i).map(([e, t]) => [
1624
+ t.mark,
1625
+ Object.entries(r).map(([e, t]) => [
1597
1626
  e,
1598
1627
  t.field,
1599
1628
  t.type
@@ -1601,23 +1630,23 @@ var Z = class t extends h {
1601
1630
  a,
1602
1631
  o,
1603
1632
  s,
1604
- r.stack,
1605
- r.layout,
1606
- r.flat,
1607
- Object.keys(n.link)
1633
+ n.stack,
1634
+ n.layout,
1635
+ n.flat,
1636
+ Object.keys(t.link)
1608
1637
  ]);
1609
1638
  if (p !== this.#r) {
1610
- this.#r = p, this.#n && this.remove(...this.#n.nodes), this.#n = Me(n.mark, this.#i);
1639
+ this.#r = p, this.#n && this.remove(...this.#n.nodes), this.#n = Fe(t.mark, this.#i);
1611
1640
  for (let e of this.#n.nodes) this.add(e);
1612
1641
  this.#l = this.#u = null, this.#d = null;
1613
1642
  }
1614
- this.#a && this.remove(this.#a), this.#a = n.mark === "network" && r.layout !== "given" ? null : this.add(S({
1643
+ this.#a && this.remove(this.#a), this.#a = t.mark === "network" && n.layout !== "given" ? null : this.add(C({
1615
1644
  box: a,
1616
1645
  theme: o,
1617
1646
  overlap: s,
1618
- axes: ze(n, this.scales)
1619
- })), this.#o && this.remove(this.#o), this.#o = r.title ? this.add(new _({
1620
- text: String(r.title),
1647
+ axes: He(t, this.scales)
1648
+ })), this.#o && this.remove(this.#o), this.#o = n.title ? this.add(new i({
1649
+ text: String(n.title),
1621
1650
  position: [
1622
1651
  0,
1623
1652
  a[1] * 1.12,
@@ -1625,31 +1654,31 @@ var Z = class t extends h {
1625
1654
  ],
1626
1655
  className: `phoria-axis-title phoria-${o}`,
1627
1656
  overlap: "show"
1628
- })) : null, this.#p(n, o), this.tooltip = n.tooltip === null && !n.link.tooltip ? null : (e) => this.#m(e);
1629
- let m = r.highlight;
1630
- this.highlight = m === !1 ? null : c.fromInput(m === void 0 || m === "neighbours" || m === "node" ? "#ffffff" : m, "chart()"), this.#h(this.#n.layout(l), t && r.transition !== !1);
1657
+ })) : null, this.#p(t, o), this.tooltip = t.tooltip === null && !t.link.tooltip ? null : (e) => this.#m(e);
1658
+ let m = n.highlight;
1659
+ this.highlight = m === !1 ? null : v.fromInput(m === void 0 || m === "neighbours" || m === "node" ? "#ffffff" : m, "chart()"), this.#h(this.#n.layout(c), e && n.transition !== !1);
1631
1660
  }
1632
- #p(t, n) {
1661
+ #p(e, t) {
1633
1662
  this.overlay?.remove(), this.overlay = null;
1634
- let i = t.channels.color, a = t.options.legend;
1635
- if (!i?.field || a === !1 || !this.scales.color || typeof document > "u") return;
1636
- let o = ie(this.scales.color, {
1637
- title: i.title,
1638
- theme: n,
1639
- position: a?.position,
1640
- ticks: a?.ticks,
1641
- format: (e) => $(i, e),
1663
+ let n = e.channels.color, r = e.options.legend;
1664
+ if (!n?.field || r === !1 || !this.scales.color || typeof document > "u") return;
1665
+ let i = ie(this.scales.color, {
1666
+ title: n.title,
1667
+ theme: t,
1668
+ position: r?.position,
1669
+ ticks: r?.ticks,
1670
+ format: (e) => $(n, e),
1642
1671
  onToggle: (e, t) => {
1643
1672
  t ? this.#s.delete(String(e)) : this.#s.add(String(e)), this.#f(!0);
1644
1673
  }
1645
1674
  });
1646
- o.querySelectorAll(".phoria-legend-item").forEach((e, t) => {
1675
+ i.querySelectorAll(".phoria-legend-item").forEach((e, t) => {
1647
1676
  this.#s.has(String(this.scales.color?.domain[t])) && e.classList.add("off");
1648
1677
  });
1649
- let s = a?.container;
1650
- if (s) {
1651
- let t = typeof s == "string" ? document.querySelector(s) : s;
1652
- t || e("chart()", `legend container ${r(s)} not found`), o.classList.remove(`phoria-legend-${a?.position ?? "top-right"}`), Object.assign(o.style, {
1678
+ let a = r?.container;
1679
+ if (a) {
1680
+ let e = typeof a == "string" ? document.querySelector(a) : a;
1681
+ e || l("chart()", `legend container ${u(a)} not found`), i.classList.remove(`phoria-legend-${r?.position ?? "top-right"}`), Object.assign(i.style, {
1653
1682
  position: "static",
1654
1683
  flexDirection: "row",
1655
1684
  flexWrap: "wrap",
@@ -1657,8 +1686,8 @@ var Z = class t extends h {
1657
1686
  columnGap: "12px",
1658
1687
  maxHeight: "none",
1659
1688
  overflow: "visible"
1660
- }), t.replaceChildren(o);
1661
- } else this.overlay = o;
1689
+ }), e.replaceChildren(i);
1690
+ } else this.overlay = i;
1662
1691
  }
1663
1692
  #m(e) {
1664
1693
  let t = this.#t, n = e.datum;
@@ -1700,7 +1729,7 @@ var Z = class t extends h {
1700
1729
  keys: [...e.keys, ...d.map((e) => r.keys[e])],
1701
1730
  state: s
1702
1731
  };
1703
- } else if (r && i && i.length === e.state.length && r.stride === a && je(r.shape, e.shape)) o = i.slice(), s = e.state;
1732
+ } else if (r && i && i.length === e.state.length && r.stride === a && Pe(r.shape, e.shape)) o = i.slice(), s = e.state;
1704
1733
  else return this.#g(e.state, e, e);
1705
1734
  this.#d = {
1706
1735
  from: o,
@@ -1713,20 +1742,21 @@ var Z = class t extends h {
1713
1742
  #g(e, t, n) {
1714
1743
  this.#n.apply(e, t), this.#l = e.slice(), this.#u = n;
1715
1744
  }
1716
- #_(t) {
1717
- this.#n?.tick?.(t);
1745
+ #_(e) {
1746
+ let t = this.root.motionReduced === !0;
1747
+ t || this.#n?.tick?.(e);
1718
1748
  let n = this.#d;
1719
1749
  if (!n) return;
1720
- let r = this.#e.transition ?? {}, i = r.duration ?? .5, a = s[r.ease ?? "out"];
1721
- a || e("chart()", `transition ease '${r.ease}' - expected ${Object.keys(s).map((e) => `'${e}'`).join(", ")}`), n.t = Math.min(1, n.t + t / i);
1722
- let o = a(n.t), c = new Float32Array(n.from.length);
1723
- for (let e = 0; e < c.length; e++) c[e] = n.from[e] + (n.to[e] - n.from[e]) * o;
1750
+ let r = this.#e.transition ?? {}, i = r.duration ?? .5, o = a[r.ease ?? "out"];
1751
+ o || l("chart()", `transition ease '${r.ease}' - expected ${Object.keys(a).map((e) => `'${e}'`).join(", ")}`), n.t = t ? 1 : Math.min(1, n.t + e / i);
1752
+ let s = o(n.t), c = new Float32Array(n.from.length);
1753
+ for (let e = 0; e < c.length; e++) c[e] = n.from[e] + (n.to[e] - n.from[e]) * s;
1724
1754
  if (n.t < 1) return this.#g(c, n.frame, n.frame);
1725
1755
  this.#d = null, this.#g(n.final.state, n.final, n.final);
1726
1756
  }
1727
1757
  };
1728
1758
  m(Z);
1729
- function je(e, t) {
1759
+ function Pe(e, t) {
1730
1760
  let n = (e) => JSON.stringify(e ? {
1731
1761
  lengths: e.lengths,
1732
1762
  nx: e.nx,
@@ -1734,10 +1764,10 @@ function je(e, t) {
1734
1764
  } : null);
1735
1765
  return n(e) === n(t);
1736
1766
  }
1737
- function Me(e, t) {
1738
- return e === "bar" ? oe(t) : e === "point" ? se(t) : e === "line" || e === "area" ? ce(t, e === "area") : e === "surface" ? le(t) : fe(t);
1767
+ function Fe(e, t) {
1768
+ return e === "bar" ? oe(t) : e === "point" ? le(t) : e === "line" || e === "area" ? de(t, e === "area") : e === "surface" ? fe(t) : he(t);
1739
1769
  }
1740
- function Ne(e) {
1770
+ function Ie(e) {
1741
1771
  let t = !!e.channels.z;
1742
1772
  return e.mark === "surface" ? [
1743
1773
  10,
@@ -1769,29 +1799,29 @@ function Q(e) {
1769
1799
  }
1770
1800
  return t === Infinity ? [0, 1] : [t, n];
1771
1801
  }
1772
- function Pe(e) {
1802
+ function Le(e) {
1773
1803
  return {
1774
1804
  scheme: e.scale.scheme,
1775
1805
  range: e.scale.range
1776
1806
  };
1777
1807
  }
1778
- function Fe(e, t, n) {
1779
- return e.type === "quantitative" ? R({
1808
+ function Re(e, t, n) {
1809
+ return e.type === "quantitative" ? z({
1780
1810
  kind: "sequential",
1781
1811
  domain: e.scale.domain ?? Q(t),
1782
- ...Pe(e),
1812
+ ...Le(e),
1783
1813
  scheme: e.scale.scheme ?? n
1784
- }) : R({
1814
+ }) : z({
1785
1815
  kind: "categorical",
1786
- domain: e.scale.domain ?? z(t),
1787
- ...Pe(e)
1816
+ domain: e.scale.domain ?? B(t),
1817
+ ...Le(e)
1788
1818
  });
1789
1819
  }
1790
- function Ie(e, t) {
1820
+ function ze(e, t) {
1791
1821
  let n = e.channels.color;
1792
1822
  return n?.field ? n.get(t) : e.channels.y.get(t);
1793
1823
  }
1794
- function Le(e, t) {
1824
+ function Be(e, t) {
1795
1825
  let [n, r, i] = t, a = e.channels, o = e.rows, s = {}, c = {
1796
1826
  x: [-n / 2, n / 2],
1797
1827
  y: [0, r],
@@ -1809,22 +1839,22 @@ function Le(e, t) {
1809
1839
  format: (n.axis && n.axis.format) ?? n.format
1810
1840
  };
1811
1841
  if (n.type === "nominal" || n.type === "ordinal" || e.mark === "bar" && t !== "y") s[t] = re({
1812
- domain: n.scale.domain ?? z(i),
1842
+ domain: n.scale.domain ?? B(i),
1813
1843
  padding: .2,
1814
1844
  ...l
1815
1845
  });
1816
1846
  else if (n.type === "temporal") {
1817
- let [e, r] = Q(i.map((e) => I(e).getTime()));
1847
+ let [e, r] = Q(i.map((e) => L(e).getTime()));
1818
1848
  s[t] = ne({
1819
1849
  domain: n.scale.domain ?? [e, r],
1820
1850
  ...l
1821
1851
  });
1822
1852
  } else {
1823
1853
  let r = n.scale.domain ?? Q(i);
1824
- t === "y" && e.options.stack && (r = Q([0, ...Re(e)])), s[t] = n.scale.type === "log" ? A({
1854
+ t === "y" && e.options.stack && (r = Q([0, ...Ve(e)])), s[t] = n.scale.type === "log" ? j({
1825
1855
  domain: r,
1826
1856
  ...l
1827
- }) : k({
1857
+ }) : A({
1828
1858
  domain: r,
1829
1859
  nice: n.scale.nice ?? !0,
1830
1860
  zero: n.scale.zero ?? (t === "y" && ["bar", "area"].includes(e.mark)),
@@ -1835,27 +1865,27 @@ function Le(e, t) {
1835
1865
  let l = a.color;
1836
1866
  if (l?.field || e.mark === "surface") {
1837
1867
  let t = l?.field ? l : a.y, n = e.options.legend?.ticks;
1838
- s.color = Fe(t, [...o.map((e) => t.get(e)), ...t.type === "quantitative" && Array.isArray(n) ? n : []], e.mark === "surface" && !l?.field ? "viridis" : void 0);
1868
+ s.color = Re(t, [...o.map((e) => t.get(e)), ...t.type === "quantitative" && Array.isArray(n) ? n : []], e.mark === "surface" && !l?.field ? "viridis" : void 0);
1839
1869
  }
1840
1870
  let u = a.size;
1841
1871
  if (u?.field) {
1842
1872
  let n = Math.min(...t) / 40, r = e.mark === "network" ? [n * .6, n * 1.8] : [n * .5, n * 2];
1843
- s.size = k({
1873
+ s.size = A({
1844
1874
  domain: Q(o.map((e) => u.get(e))),
1845
1875
  range: u.scale.range ?? r
1846
1876
  });
1847
1877
  }
1848
1878
  return s;
1849
1879
  }
1850
- function Re(e) {
1880
+ function Ve(e) {
1851
1881
  let t = e.channels, n = /* @__PURE__ */ new Map();
1852
1882
  for (let r of e.rows) {
1853
- let e = Number(t.y.get(r)) || 0, i = B(t, r, e);
1883
+ let e = Number(t.y.get(r)) || 0, i = V(t, r, e);
1854
1884
  n.set(i, (n.get(i) ?? 0) + e);
1855
1885
  }
1856
1886
  return [...n.values()];
1857
1887
  }
1858
- function ze(e, t) {
1888
+ function He(e, t) {
1859
1889
  let n = {};
1860
1890
  for (let r of [
1861
1891
  "x",
@@ -1871,10 +1901,10 @@ function ze(e, t) {
1871
1901
  }
1872
1902
  return n;
1873
1903
  }
1874
- var Be = new Intl.NumberFormat(void 0, { maximumFractionDigits: 2 }), Ve = new Intl.NumberFormat(void 0, {
1904
+ var Ue = new Intl.NumberFormat(void 0, { maximumFractionDigits: 2 }), We = new Intl.NumberFormat(void 0, {
1875
1905
  notation: "compact",
1876
1906
  maximumFractionDigits: 1
1877
- }), He = new Intl.DateTimeFormat(void 0, {
1907
+ }), Ge = new Intl.DateTimeFormat(void 0, {
1878
1908
  year: "numeric",
1879
1909
  month: "short",
1880
1910
  day: "numeric"
@@ -1882,8 +1912,8 @@ var Be = new Intl.NumberFormat(void 0, { maximumFractionDigits: 2 }), Ve = new I
1882
1912
  function $(e, t) {
1883
1913
  if (t == null) return "";
1884
1914
  let n = e.format;
1885
- return typeof n == "function" ? String(n(t)) : t instanceof Date ? n ? new Intl.DateTimeFormat(void 0, n).format(t) : He.format(t) : typeof t == "number" ? n ? new Intl.NumberFormat(void 0, n).format(t) : (Math.abs(t) >= 1e4 ? Ve : Be).format(t) : String(t);
1915
+ return typeof n == "function" ? String(n(t)) : t instanceof Date ? n ? new Intl.DateTimeFormat(void 0, n).format(t) : Ge.format(t) : typeof t == "number" ? n ? new Intl.NumberFormat(void 0, n).format(t) : (Math.abs(t) >= 1e4 ? We : Ue).format(t) : String(t);
1886
1916
  }
1887
- export { Z as Chart, L as SCHEMES, Ae as chart, $ as formatValue, re as scaleBand, R as scaleColor, k as scaleLinear, A as scaleLog, ne as scaleTime, T as tickStep };
1917
+ export { Z as Chart, R as SCHEMES, Ne as chart, $ as formatValue, re as scaleBand, z as scaleColor, A as scaleLinear, j as scaleLog, ne as scaleTime, E as tickStep };
1888
1918
 
1889
1919
  //# sourceMappingURL=charts.js.map