@divami-artefacts/ai-design-system 1.0.53 → 1.0.55

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 (49) hide show
  1. package/dist/ai-design-system.css +1 -1
  2. package/dist/canvas/canvasUtils.d.ts +6 -3
  3. package/dist/canvas/useCanvasInteraction.d.ts +5 -2
  4. package/dist/canvas/useContainerWidth.d.ts +1 -0
  5. package/dist/components/areaLineChart/AreaLineChart.d.ts +1 -1
  6. package/dist/components/areaLineChart/types.d.ts +1 -1
  7. package/dist/components/balanceScaleChart/BalanceScaleChart.d.ts +1 -1
  8. package/dist/components/balanceScaleChart/types.d.ts +5 -2
  9. package/dist/components/common/ChartEmptyState.d.ts +2 -2
  10. package/dist/components/common/ToggleButton.d.ts +2 -2
  11. package/dist/components/dotMatrixChart/DotMatrixChart.d.ts +1 -1
  12. package/dist/components/dotMatrixChart/types.d.ts +1 -1
  13. package/dist/components/horizontalBarChart/HorizontalBarChart.d.ts +1 -1
  14. package/dist/components/horizontalBarChart/types.d.ts +4 -1
  15. package/dist/components/hubAndSpokeRadialChart/HubAndSpokeRadialChart.d.ts +1 -1
  16. package/dist/components/hubAndSpokeRadialChart/types.d.ts +1 -1
  17. package/dist/components/multiMetricConstellationChart/MultiMetricConstellationChart.d.ts +1 -1
  18. package/dist/components/multiMetricConstellationChart/types.d.ts +1 -1
  19. package/dist/components/multiSegmentHorizontalBarChart/MultiSegmentHorizontalBarChart.d.ts +1 -1
  20. package/dist/components/multiSegmentHorizontalBarChart/types.d.ts +1 -1
  21. package/dist/components/progressRaceChart/ProgressRaceChart.d.ts +1 -1
  22. package/dist/components/progressRaceChart/types.d.ts +5 -2
  23. package/dist/components/proportionalBandChart/ProportionalBandChart.d.ts +1 -1
  24. package/dist/components/proportionalBandChart/types.d.ts +3 -2
  25. package/dist/components/radialFanTreeChart/RadialFanTreeChart.d.ts +1 -1
  26. package/dist/components/radialFanTreeChart/types.d.ts +10 -2
  27. package/dist/components/rankedCardLeaderboard/RankedCardLeaderboard.d.ts +1 -1
  28. package/dist/components/rankedCardLeaderboard/types.d.ts +3 -2
  29. package/dist/components/segmentedSplitBarChart/SegmentedSplitBarChart.d.ts +1 -1
  30. package/dist/components/segmentedSplitBarChart/types.d.ts +5 -2
  31. package/dist/components/semiCircularGaugeChart/SemiCircularGaugeChart.d.ts +1 -1
  32. package/dist/components/semiCircularGaugeChart/types.d.ts +11 -1
  33. package/dist/components/stackedHorizontalBarChart/StackedHorizontalBarChart.d.ts +1 -1
  34. package/dist/components/stackedHorizontalBarChart/types.d.ts +5 -2
  35. package/dist/components/trend/Trend.d.ts +1 -1
  36. package/dist/components/trend/types.d.ts +3 -1
  37. package/dist/components/visualizationGroup/VisualizationGroup.d.ts +2 -0
  38. package/dist/components/visualizationRenderer/VisualizationRenderer.d.ts +1 -1
  39. package/dist/components/weeklyFlow/WeeklyFlow.d.ts +1 -1
  40. package/dist/components/weeklyFlow/types.d.ts +3 -2
  41. package/dist/constants.d.ts +37 -0
  42. package/dist/index.cjs +1 -1
  43. package/dist/index.d.ts +2 -1
  44. package/dist/index.js +1457 -1018
  45. package/dist/pages/interactiveDemo/InteractiveDemoPage.d.ts +1 -0
  46. package/dist/pages/interactiveDemo/styles.d.ts +2 -0
  47. package/dist/types/index.d.ts +60 -20
  48. package/package.json +21 -21
  49. package/dist/components/constants.d.ts +0 -6
package/dist/index.js CHANGED
@@ -24,6 +24,7 @@ var u = {
24
24
  amber: "#EEBF3B",
25
25
  teal: "#69DFE9",
26
26
  tealDark: "#00818F",
27
+ barBg: "#7DB9DF",
27
28
  t1: "#F7F9FA",
28
29
  t2: "#B3B5B6",
29
30
  t3: "#94979C",
@@ -59,31 +60,43 @@ var u = {
59
60
  u.green,
60
61
  u.red
61
62
  ], m = [
62
- u.teal,
63
- u.purple,
64
- u.amber,
65
- u.blue,
66
- u.green
67
- ], h = {
63
+ d.teal,
64
+ d.mint,
65
+ d.sky,
66
+ d.blue,
67
+ d.royal,
68
+ d.purple,
69
+ d.violet,
70
+ d.magenta
71
+ ], h = [
72
+ f.teal,
73
+ f.mint,
74
+ f.sky,
75
+ f.blue,
76
+ f.royal,
77
+ f.purple,
78
+ f.violet,
79
+ f.magenta
80
+ ], g = {
68
81
  font: "400 16px 'Satoshi Variable', 'DM Sans', sans-serif",
69
82
  color: "#F7F7F7",
70
83
  letterSpacing: "0px"
71
- }, g = {
84
+ }, _ = {
72
85
  font: "500 16px 'Satoshi Variable', 'DM Sans', sans-serif",
73
86
  color: "#F7F7F7"
74
- }, _ = {
87
+ }, v = {
75
88
  font: "400 18px 'Satoshi Variable', 'DM Sans', sans-serif",
76
89
  color: "#B3B5B6",
77
90
  letterSpacing: "0px"
78
91
  };
79
- function v(e, t = 1) {
92
+ function y(e, t = 1) {
80
93
  let n = e.replace("#", "");
81
94
  return `rgba(${parseInt(n.substring(0, 2), 16)},${parseInt(n.substring(2, 4), 16)},${parseInt(n.substring(4, 6), 16)},${t})`;
82
95
  }
83
- function y(e, t, n) {
96
+ function b(e, t, n) {
84
97
  return e + (t - e) * n;
85
98
  }
86
- function b(e, t, n) {
99
+ function x(e, t, n) {
87
100
  let r = (e) => {
88
101
  let t = e.replace("#", "");
89
102
  return [
@@ -93,34 +106,34 @@ function b(e, t, n) {
93
106
  ];
94
107
  }, [i, a, o] = r(e), [s, c, l] = r(t), u = (e) => Math.max(0, Math.min(255, Math.round(e)));
95
108
  return [
96
- u(y(i, s, n)),
97
- u(y(a, c, n)),
98
- u(y(o, l, n))
109
+ u(b(i, s, n)),
110
+ u(b(a, c, n)),
111
+ u(b(o, l, n))
99
112
  ].map((e) => e.toString(16).padStart(2, "0")).join("").replace(/^/, "#");
100
113
  }
101
- function x(e, t, n, r = 2) {
114
+ function S(e, t, n, r = 2) {
102
115
  e.width = t * r, e.height = n * r;
103
116
  let i = e.getContext("2d");
104
117
  return i.scale(r, r), i;
105
118
  }
106
- function S(e, t, n, r, i, a = .3) {
119
+ function C(e, t, n, r, i, a = .3) {
107
120
  let o = e.createRadialGradient(t, n, 0, t, n, r);
108
- o.addColorStop(0, v(i, a)), o.addColorStop(1, v(i, 0)), e.fillStyle = o, e.beginPath(), e.arc(t, n, r, 0, Math.PI * 2), e.fill();
121
+ o.addColorStop(0, y(i, a)), o.addColorStop(1, y(i, 0)), e.fillStyle = o, e.beginPath(), e.arc(t, n, r, 0, Math.PI * 2), e.fill();
109
122
  }
110
- function C(e, t, n, r, i = 50, a = v(u.blue, .05)) {
123
+ function w(e, t, n, r, i = 50, a = y(u.blue, .05)) {
111
124
  for (let o = 0; o < i; o++) e.beginPath(), e.arc((Math.sin(r * .001 + o * 23) * .5 + .5) * t, (Math.cos(r * 8e-4 + o * 37) * .5 + .5) * n, .6, 0, Math.PI * 2), e.fillStyle = a, e.fill();
112
125
  }
113
- function w(e, t, n, r, i = .015) {
126
+ function T(e, t, n, r, i = .015) {
114
127
  e.fillStyle = `rgba(0,0,0,${i})`;
115
128
  let a = r * .5 % 6;
116
129
  for (let r = a; r < n; r += 3) e.fillRect(0, r, t, 1);
117
130
  }
118
- function T(e, t, n, r, i = v(u.t1, .08)) {
131
+ function E(e, t, n, r, i = y(u.t1, .08)) {
119
132
  e.strokeStyle = i, e.lineWidth = 1, e.setLineDash([3, 3]), e.beginPath(), e.moveTo(t, n), e.lineTo(t, r), e.stroke(), e.setLineDash([]);
120
133
  }
121
134
  //#endregion
122
135
  //#region src/canvas/CanvasTooltip.tsx
123
- function E({ visible: e, x: t, y: n, content: i, parentW: o, parentH: l }) {
136
+ function D({ visible: e, x: t, y: n, content: i, parentW: o, parentH: l }) {
124
137
  let d = a(null);
125
138
  if (r(() => {
126
139
  let r = d.current;
@@ -193,7 +206,7 @@ function E({ visible: e, x: t, y: n, content: i, parentW: o, parentH: l }) {
193
206
  }
194
207
  //#endregion
195
208
  //#region src/canvas/useCanvasInteraction.ts
196
- function D(e, { width: r, height: i, onClick: s, enabled: c = !0 }) {
209
+ function O(e, { width: r, height: i, onClick: s, enabled: c = !0 }) {
197
210
  let l = a({
198
211
  x: -1,
199
212
  y: -1,
@@ -240,7 +253,17 @@ function D(e, { width: r, height: i, onClick: s, enabled: c = !0 }) {
240
253
  }, o = () => {
241
254
  if (u.current && s) {
242
255
  let e = d.current.find((e) => e.id === u.current);
243
- e && s(e.id, e.data);
256
+ if (e) {
257
+ let n = t.getBoundingClientRect(), a = n.top + e.centerY * (n.height / i), o = n.left + e.centerX * (n.width / r), c = e.sourceY == null ? void 0 : n.top + e.sourceY * (n.height / i);
258
+ t.dispatchEvent(new CustomEvent("viz-item-click", {
259
+ bubbles: !0,
260
+ detail: {
261
+ centerClientY: a,
262
+ centerClientX: o,
263
+ sourceClientY: c
264
+ }
265
+ })), s(e.id, e.data);
266
+ }
244
267
  }
245
268
  };
246
269
  return t.addEventListener("mousemove", n), t.addEventListener("mouseleave", a), t.addEventListener("click", o), () => {
@@ -263,30 +286,35 @@ function D(e, { width: r, height: i, onClick: s, enabled: c = !0 }) {
263
286
  hitZonesRef: d
264
287
  };
265
288
  }
266
- function O(e, t, n, r, i, a) {
289
+ function k(e, t, n, r, i, a, o) {
267
290
  e.push({
268
291
  id: t,
269
292
  data: a,
293
+ centerY: r,
294
+ centerX: o ?? n,
270
295
  test: (e, t) => (e - n) ** 2 + (t - r) ** 2 <= i * i
271
296
  });
272
297
  }
273
- function k(e, t, n, r, i, a, o) {
298
+ function A(e, t, n, r, i, a, o, s, c, l) {
274
299
  e.push({
275
300
  id: t,
276
301
  data: o,
302
+ centerY: s ?? r + a / 2,
303
+ centerX: c ?? n + i / 2,
304
+ sourceY: l,
277
305
  test: (e, t) => e >= n && e <= n + i && t >= r && t <= r + a
278
306
  });
279
307
  }
280
308
  //#endregion
281
309
  //#region src/canvas/easing.ts
282
- var A = (e) => 1 - (1 - e) ** 3, j = (e) => 1 - (1 - e) ** 4, M = (e) => e === 1 ? 1 : 1 - 2 ** (-10 * e), N = (e) => {
310
+ var j = (e) => 1 - (1 - e) ** 3, M = (e) => 1 - (1 - e) ** 4, N = (e) => e === 1 ? 1 : 1 - 2 ** (-10 * e), P = (e) => {
283
311
  let t = 1.70158;
284
312
  return 1 + (t + 1) * (e - 1) ** 3 + t * (e - 1) ** 2;
285
- }, P = (e, t = .04, n = .001) => Math.sin(e * t) * Math.exp(-Math.min(e * n, 4)), F = (e, t, n, r = A) => {
313
+ }, F = (e, t = .04, n = .001) => Math.sin(e * t) * Math.exp(-Math.min(e * n, 4)), I = (e, t, n, r = j) => {
286
314
  let i = Math.min(.06, .5 / n), a = t * i, o = 1 - (n - 1) * i;
287
315
  return r(Math.max(0, Math.min((e - a) / o, 1)));
288
316
  };
289
- function I(e, t, n = .12) {
317
+ function L(e, t, n = .12) {
290
318
  e.forEach((r, i) => {
291
319
  let a = i === t ? 1 : 0, o = r + (a - r) * n;
292
320
  Math.abs(o - a) < .005 ? a === 0 ? e.delete(i) : e.set(i, 1) : e.set(i, o);
@@ -294,66 +322,66 @@ function I(e, t, n = .12) {
294
322
  }
295
323
  //#endregion
296
324
  //#region src/components/common/SeriesChart.tsx
297
- var L = 760, ee = 250;
298
- function te({ rows: e = [], variant: t, className: r, colors: i }) {
299
- let o = a(null), d = a(/* @__PURE__ */ new Map()), f = a(0), { mouseRef: p, hoveredRef: m, tooltip: h, hitZonesRef: g } = D(o, {
300
- width: L,
301
- height: ee
325
+ var R = 760, z = 250;
326
+ function B({ rows: e = [], variant: t, className: r, colors: i }) {
327
+ let o = a(null), d = a(/* @__PURE__ */ new Map()), f = a(0), { mouseRef: p, hoveredRef: m, tooltip: h, hitZonesRef: g } = O(o, {
328
+ width: R,
329
+ height: z
302
330
  });
303
331
  return n(() => {
304
332
  let n = o.current;
305
333
  if (!n) return;
306
- let r = x(n, L, ee);
334
+ let r = S(n, R, z);
307
335
  f.current = 0;
308
336
  let a = i?.line ?? u.blue, s = i?.point ?? u.blue, c = i?.axisLine ?? u.bd, l = i?.areaFill ?? u.blue, h = {
309
337
  top: 24,
310
338
  right: 24,
311
339
  bottom: 44,
312
340
  left: 24
313
- }, _ = L - h.left - h.right, y = ee - h.top - h.bottom, b, C = () => {
341
+ }, _ = R - h.left - h.right, v = z - h.top - h.bottom, b, x = () => {
314
342
  f.current++;
315
343
  let n = f.current;
316
- if (r.clearRect(0, 0, L, ee), e.length < 2) {
317
- b = requestAnimationFrame(C);
344
+ if (r.clearRect(0, 0, R, z), e.length < 2) {
345
+ b = requestAnimationFrame(x);
318
346
  return;
319
347
  }
320
- let i = e.map((e) => e.pricing ?? 0), o = Math.max(100, ...i), x = (t) => h.left + t / (e.length - 1) * _, w = (e) => h.top + (1 - e / o) * y, E = M(Math.min(n / 48, 1)), D = Math.max(2, Math.floor(E * e.length));
321
- I(d.current, m.current), g.current = [], r.strokeStyle = v(u.bd, .2), r.lineWidth = .5;
348
+ let i = e.map((e) => e.pricing ?? 0), o = Math.max(100, ...i), S = (t) => h.left + t / (e.length - 1) * _, w = (e) => h.top + (1 - e / o) * v, T = N(Math.min(n / 48, 1)), D = Math.max(2, Math.floor(T * e.length));
349
+ L(d.current, m.current), g.current = [], r.strokeStyle = y(u.bd, .2), r.lineWidth = .5;
322
350
  for (let e = 0; e <= 4; e++) {
323
- let t = h.top + e / 4 * y;
351
+ let t = h.top + e / 4 * v;
324
352
  r.beginPath(), r.moveTo(h.left, t), r.lineTo(h.left + _, t), r.stroke();
325
353
  }
326
- if (r.strokeStyle = v(c, .4), r.lineWidth = 1, r.setLineDash([]), r.beginPath(), r.moveTo(h.left, w(0)), r.lineTo(h.left + _, w(0)), r.stroke(), p.current.over && m.current) {
354
+ if (r.strokeStyle = y(c, .4), r.lineWidth = 1, r.setLineDash([]), r.beginPath(), r.moveTo(h.left, w(0)), r.lineTo(h.left + _, w(0)), r.stroke(), p.current.over && m.current) {
327
355
  let e = parseInt(m.current.split("-")[1]);
328
- isNaN(e) || T(r, x(e), h.top, h.top + y);
356
+ isNaN(e) || E(r, S(e), h.top, h.top + v);
329
357
  }
330
358
  if (t === "area" && D > 1) {
331
- let t = r.createLinearGradient(0, h.top, 0, h.top + y);
332
- t.addColorStop(0, v(l, .12)), t.addColorStop(1, v(l, 0)), r.fillStyle = t, r.beginPath(), r.moveTo(x(0), h.top + y);
333
- for (let t = 0; t < D; t++) r.lineTo(x(t), w(e[t].pricing ?? 0));
334
- r.lineTo(x(D - 1), h.top + y), r.closePath(), r.fill();
359
+ let t = r.createLinearGradient(0, h.top, 0, h.top + v);
360
+ t.addColorStop(0, y(l, .12)), t.addColorStop(1, y(l, 0)), r.fillStyle = t, r.beginPath(), r.moveTo(S(0), h.top + v);
361
+ for (let t = 0; t < D; t++) r.lineTo(S(t), w(e[t].pricing ?? 0));
362
+ r.lineTo(S(D - 1), h.top + v), r.closePath(), r.fill();
335
363
  }
336
364
  if (D > 1) {
337
- r.strokeStyle = v(a, .85), r.lineWidth = 2, r.setLineDash([]), r.beginPath();
365
+ r.strokeStyle = y(a, .85), r.lineWidth = 2, r.setLineDash([]), r.beginPath();
338
366
  for (let t = 0; t < D; t++) {
339
- let n = x(t), i = w(e[t].pricing ?? 0);
367
+ let n = S(t), i = w(e[t].pricing ?? 0);
340
368
  t === 0 ? r.moveTo(n, i) : r.lineTo(n, i);
341
369
  }
342
370
  r.stroke();
343
371
  }
344
372
  for (let i = 0; i < D; i++) {
345
- let a = x(i), o = w(e[i].pricing ?? 0), c = `sc-${i}`, l = d.current.get(c) ?? 0, f = i === e.length - 1;
346
- O(g.current, c, a, o, 12, {
373
+ let a = S(i), o = w(e[i].pricing ?? 0), c = `sc-${i}`, l = d.current.get(c) ?? 0, f = i === e.length - 1;
374
+ k(g.current, c, a, o, 12, {
347
375
  label: e[i].vendor,
348
376
  value: String(e[i].pricing ?? 0),
349
377
  color: f ? u.red : s
350
- }), l > 0 && S(r, a, o, 16 * l, s, .2 * l);
351
- let p = f ? P(n, .05, 5e-4) : 0, m = t === "area" ? 5 : 6;
352
- f ? (r.shadowColor = v(u.red, .5), r.shadowBlur = (8 + p * 4) * (1 + l * .5), r.fillStyle = u.red, r.beginPath(), r.arc(a, o, (m + p * 1.5) * (1 + l * .3), 0, Math.PI * 2), r.fill(), r.shadowBlur = 0) : (r.fillStyle = v(s, .7 + l * .3), r.beginPath(), r.arc(a, o, m + l * 2, 0, Math.PI * 2), r.fill()), r.font = "10px 'JetBrains Mono', monospace", r.fillStyle = v(u.t3, .6 + l * .3), r.textAlign = "center", r.fillText(e[i].vendor, a, ee - 14);
378
+ }), l > 0 && C(r, a, o, 16 * l, s, .2 * l);
379
+ let p = f ? F(n, .05, 5e-4) : 0, m = t === "area" ? 5 : 6;
380
+ f ? (r.shadowColor = y(u.red, .5), r.shadowBlur = (8 + p * 4) * (1 + l * .5), r.fillStyle = u.red, r.beginPath(), r.arc(a, o, (m + p * 1.5) * (1 + l * .3), 0, Math.PI * 2), r.fill(), r.shadowBlur = 0) : (r.fillStyle = y(s, .7 + l * .3), r.beginPath(), r.arc(a, o, m + l * 2, 0, Math.PI * 2), r.fill()), r.font = "10px 'JetBrains Mono', monospace", r.fillStyle = y(u.t3, .6 + l * .3), r.textAlign = "center", r.fillText(e[i].vendor, a, z - 14);
353
381
  }
354
- b = requestAnimationFrame(C);
382
+ b = requestAnimationFrame(x);
355
383
  };
356
- return C(), () => cancelAnimationFrame(b);
384
+ return x(), () => cancelAnimationFrame(b);
357
385
  }, [
358
386
  e,
359
387
  t,
@@ -363,31 +391,31 @@ function te({ rows: e = [], variant: t, className: r, colors: i }) {
363
391
  children: /* @__PURE__ */ c("div", {
364
392
  style: {
365
393
  position: "relative",
366
- width: L,
367
- height: ee
394
+ width: R,
395
+ height: z
368
396
  },
369
397
  children: [/* @__PURE__ */ s("canvas", {
370
398
  ref: o,
371
399
  role: "img",
372
400
  "aria-label": `${t} chart`,
373
401
  style: {
374
- width: L,
375
- height: ee,
402
+ width: R,
403
+ height: z,
376
404
  display: "block",
377
405
  borderRadius: 8
378
406
  }
379
- }), /* @__PURE__ */ s(E, {
407
+ }), /* @__PURE__ */ s(D, {
380
408
  ...h,
381
- parentW: L,
382
- parentH: ee
409
+ parentW: R,
410
+ parentH: z
383
411
  })]
384
412
  })
385
413
  });
386
414
  }
387
415
  //#endregion
388
416
  //#region src/components/areaChart/AreaChart.tsx
389
- function ne({ rows: e = [], className: t, colors: n }) {
390
- return /* @__PURE__ */ s(te, {
417
+ function V({ rows: e = [], className: t, colors: n }) {
418
+ return /* @__PURE__ */ s(B, {
391
419
  rows: e,
392
420
  variant: "area",
393
421
  className: t,
@@ -396,76 +424,90 @@ function ne({ rows: e = [], className: t, colors: n }) {
396
424
  }
397
425
  //#endregion
398
426
  //#region src/components/barChart/BarChart.tsx
399
- var re = 760, ie = 280;
400
- function ae({ rows: e = [], className: t, colors: r }) {
401
- let i = a(null), o = a(/* @__PURE__ */ new Map()), d = a(0), { hoveredRef: f, tooltip: m, hitZonesRef: h } = D(i, {
402
- width: re,
403
- height: ie
427
+ var H = 760, U = 280;
428
+ function W({ rows: e = [], className: t, colors: r }) {
429
+ let i = a(null), o = a(/* @__PURE__ */ new Map()), d = a(0), { hoveredRef: f, tooltip: m, hitZonesRef: h } = O(i, {
430
+ width: H,
431
+ height: U
404
432
  });
405
433
  return n(() => {
406
434
  let t = i.current;
407
435
  if (!t) return;
408
- let n = x(t, re, ie);
436
+ let n = S(t, H, U);
409
437
  d.current = 0;
410
438
  let a = r?.bars ?? p, s = r?.axisLine ?? u.bd, c = r?.valueLabel ?? u.t2, l = {
411
439
  top: 24,
412
440
  right: 24,
413
441
  bottom: 56,
414
442
  left: 24
415
- }, m = ie - l.top - l.bottom, g = (re - l.left - l.right) / Math.max(e.length, 1), _ = Math.max(100, ...e.map((e) => e.pricing ?? 0)), y = l.top + m, b, C = () => {
443
+ }, m = U - l.top - l.bottom, g = (H - l.left - l.right) / Math.max(e.length, 1), _ = Math.max(100, ...e.map((e) => e.pricing ?? 0)), v = l.top + m, b, x = () => {
416
444
  d.current++;
417
445
  let t = d.current;
418
- n.clearRect(0, 0, re, ie);
419
- let r = j(Math.min(t / 48, 1));
420
- I(o.current, f.current), h.current = [], n.strokeStyle = v(s, .4), n.lineWidth = 1, n.setLineDash([]), n.beginPath(), n.moveTo(l.left, y), n.lineTo(re - l.right, y), n.stroke(), e.forEach((t, i) => {
421
- let s = l.left + i * g, d = F(r, i, e.length, j), f = _ > 0 ? (t.pricing ?? 0) / _ * m : 0, p = Math.max(f > 0 ? 4 : 0, f * d), b = a[i % a.length], x = o.current.get(t.id ?? `bar-${i}`) ?? 0;
422
- k(h.current, t.id ?? `bar-${i}`, s + 4, y - p, g - 8, p, {
446
+ n.clearRect(0, 0, H, U);
447
+ let r = M(Math.min(t / 48, 1));
448
+ L(o.current, f.current), h.current = [], n.strokeStyle = y(s, .4), n.lineWidth = 1, n.setLineDash([]), n.beginPath(), n.moveTo(l.left, v), n.lineTo(H - l.right, v), n.stroke(), e.forEach((t, i) => {
449
+ let s = l.left + i * g, d = I(r, i, e.length, M), f = _ > 0 ? (t.pricing ?? 0) / _ * m : 0, p = Math.max(f > 0 ? 4 : 0, f * d), b = a[i % a.length], x = o.current.get(t.id ?? `bar-${i}`) ?? 0;
450
+ A(h.current, t.id ?? `bar-${i}`, s + 4, v - p, g - 8, p, {
423
451
  label: t.vendor,
424
452
  value: String(t.pricing ?? 0),
425
453
  color: b
426
- }), p > 0 && (x > 0 && S(n, s + g / 2, y - p / 2, g * .8, b, .12 * x), n.shadowColor = v(b, .2 * (x > 0 ? x : 0)), n.shadowBlur = x > 0 ? 6 : 0, n.fillStyle = v(b, .5 + x * .25), n.beginPath(), n.roundRect(s + 4, y - p, g - 8, p, [
454
+ }), p > 0 && (x > 0 && C(n, s + g / 2, v - p / 2, g * .8, b, .12 * x), n.shadowColor = y(b, .2 * (x > 0 ? x : 0)), n.shadowBlur = x > 0 ? 6 : 0, n.fillStyle = y(b, .5 + x * .25), n.beginPath(), n.roundRect(s + 4, v - p, g - 8, p, [
427
455
  4,
428
456
  4,
429
457
  0,
430
458
  0
431
- ]), n.fill(), n.shadowBlur = 0, x > 0 && (n.strokeStyle = v(b, .4 * x), n.lineWidth = 1, n.beginPath(), n.roundRect(s + 4, y - p, g - 8, p, [
459
+ ]), n.fill(), n.shadowBlur = 0, x > 0 && (n.strokeStyle = y(b, .4 * x), n.lineWidth = 1, n.beginPath(), n.roundRect(s + 4, v - p, g - 8, p, [
432
460
  4,
433
461
  4,
434
462
  0,
435
463
  0
436
- ]), n.stroke())), d > .5 && p > 0 && (n.globalAlpha = Math.min(1, (d - .5) * 2), n.font = "bold 10px 'JetBrains Mono', monospace", n.fillStyle = x > 0 ? b : v(c, .7), n.textAlign = "center", n.fillText(String(t.pricing ?? ""), s + g / 2, y - p - 6), n.globalAlpha = 1), n.font = `${x > 0 ? "bold " : ""}9px 'JetBrains Mono', monospace`, n.fillStyle = x > 0 ? b : v(u.t3, .6), n.textAlign = "center", n.fillText(t.vendor, s + g / 2, ie - 14);
437
- }), b = requestAnimationFrame(C);
464
+ ]), n.stroke())), d > .5 && p > 0 && (n.globalAlpha = Math.min(1, (d - .5) * 2), n.font = "bold 10px 'JetBrains Mono', monospace", n.fillStyle = x > 0 ? b : y(c, .7), n.textAlign = "center", n.fillText(String(t.pricing ?? ""), s + g / 2, v - p - 6), n.globalAlpha = 1), n.font = `${x > 0 ? "bold " : ""}9px 'JetBrains Mono', monospace`, n.fillStyle = x > 0 ? b : y(u.t3, .6), n.textAlign = "center", n.fillText(t.vendor, s + g / 2, U - 14);
465
+ }), b = requestAnimationFrame(x);
438
466
  };
439
- return C(), () => cancelAnimationFrame(b);
467
+ return x(), () => cancelAnimationFrame(b);
440
468
  }, [e, r]), /* @__PURE__ */ s(l, {
441
469
  className: t,
442
470
  children: /* @__PURE__ */ c("div", {
443
471
  style: {
444
472
  position: "relative",
445
- width: re,
446
- height: ie
473
+ width: H,
474
+ height: U
447
475
  },
448
476
  children: [/* @__PURE__ */ s("canvas", {
449
477
  ref: i,
450
478
  role: "img",
451
479
  "aria-label": "bar chart",
452
480
  style: {
453
- width: re,
454
- height: ie,
481
+ width: H,
482
+ height: U,
455
483
  display: "block",
456
484
  borderRadius: 8
457
485
  }
458
- }), /* @__PURE__ */ s(E, {
486
+ }), /* @__PURE__ */ s(D, {
459
487
  ...m,
460
- parentW: re,
461
- parentH: ie
488
+ parentW: H,
489
+ parentH: U
462
490
  })]
463
491
  })
464
492
  });
465
493
  }
466
494
  //#endregion
495
+ //#region src/canvas/useContainerWidth.ts
496
+ function ee(e) {
497
+ let t = a(null), [r, i] = o(e);
498
+ return n(() => {
499
+ let e = t.current;
500
+ if (!e) return;
501
+ let n = new ResizeObserver((e) => {
502
+ let t = e[0]?.contentRect.width;
503
+ t && t > 0 && i(Math.floor(t));
504
+ });
505
+ return n.observe(e), () => n.disconnect();
506
+ }, []), [t, r];
507
+ }
508
+ //#endregion
467
509
  //#region src/components/common/ChartEmptyState.tsx
468
- function R({ width: e, height: t, message: n = "No data available", "data-testid": r }) {
510
+ function G({ width: e, height: t, message: n = "No data available", testID: r }) {
469
511
  return /* @__PURE__ */ s("div", {
470
512
  "data-testid": r,
471
513
  style: {
@@ -485,7 +527,7 @@ function R({ width: e, height: t, message: n = "No data available", "data-testid
485
527
  }
486
528
  //#endregion
487
529
  //#region src/components/common/ToggleButton.tsx
488
- function oe({ expanded: e, onToggle: t, labelExpanded: n = "View Less", labelCollapsed: r = "View More", "data-testid": i }) {
530
+ function te({ expanded: e, onToggle: t, labelExpanded: n = "View Less", labelCollapsed: r = "View More", testID: i }) {
489
531
  return /* @__PURE__ */ c("button", {
490
532
  type: "button",
491
533
  "data-testid": i,
@@ -528,7 +570,7 @@ function oe({ expanded: e, onToggle: t, labelExpanded: n = "View Less", labelCol
528
570
  }
529
571
  //#endregion
530
572
  //#region src/utils/numberFormat.ts
531
- var se = [
573
+ var ne = [
532
574
  {
533
575
  value: 0xe8d4a51000,
534
576
  suffix: "T",
@@ -550,103 +592,113 @@ var se = [
550
592
  divisor: 1e3
551
593
  }
552
594
  ];
553
- function z(e, t = 1) {
595
+ function K(e, t = 1) {
554
596
  let n = Math.abs(e), r = e < 0 ? "-" : "";
555
- for (let e of se) if (n >= e.value) return `${r}${(n / e.divisor).toFixed(t)}${e.suffix}`;
597
+ for (let e of ne) if (n >= e.value) return `${r}${(n / e.divisor).toFixed(t)}${e.suffix}`;
556
598
  return `${r}${n.toFixed(0)}`;
557
599
  }
558
600
  //#endregion
559
601
  //#region src/components/progressRaceChart/ProgressRaceChart.tsx
560
- var B = 660, ce = 6, le = 30, ue = 24, de = 24, fe = 8;
561
- function pe(e, t, n) {
602
+ var re = 660, ie = 4, ae = 30, oe = ae / 2, se = ae / 2, ce = 8;
603
+ function le(e, t, n) {
562
604
  if (e.measureText(t).width <= n) return t;
563
605
  let r = t;
564
606
  for (; r.length > 0 && e.measureText(r + "…").width > n;) r = r.slice(0, -1);
565
607
  return r + "…";
566
608
  }
567
- function me({ items: e = [], colorOffset: t = 0, "data-testid": r }) {
568
- let l = a(null), d = a(0), f = a(/* @__PURE__ */ new Map()), [p, _] = o(!1), y = i(() => e.filter((e) => typeof e == "object" && !!e), [e]), b = i(() => [...y].sort((e, t) => (t.percentage ?? 0) - (e.percentage ?? 0)), [y]), T = i(() => p ? b : b.slice(0, fe), [b, p]), j = T.length, M = ue + de + j * ce + Math.max(0, j - 1) * le, { hoveredRef: N, tooltip: P, hitZonesRef: F } = D(l, {
569
- width: B,
570
- height: M
609
+ function ue({ items: e = [], itemsByEntity: r, onItemClick: l, selectedId: d, colorOffset: f = 0, testID: p }) {
610
+ let [h, v] = ee(re), b = a(null), x = a(0), E = a(/* @__PURE__ */ new Map()), M = a(d);
611
+ M.current = d;
612
+ let N = a([]), P = t((e, t) => {
613
+ let n = typeof t == "object" ? t.label ?? e : e, r = N.current.find((t) => t.id === e);
614
+ l?.(e, n, r?.subentity);
615
+ }, [l]), [F, I] = o(!1), L = !!(d && r?.[d]), R = L ? r[d] : e, z = i(() => e.filter((e) => typeof e == "object" && !!e), [e]), B = i(() => R.filter((e) => typeof e == "object" && !!e), [R]), V = i(() => [...B].sort((e, t) => (t.percentage ?? 0) - (e.percentage ?? 0)), [B]), H = i(() => F ? V : V.slice(0, ce), [V, F]);
616
+ N.current = H;
617
+ let U = H.length, W = oe + se + U * ie + Math.max(0, U - 1) * ae, { hoveredRef: ne, tooltip: ue, hitZonesRef: de } = O(b, {
618
+ width: v,
619
+ height: W,
620
+ onClick: l ? P : void 0
571
621
  });
572
622
  return n(() => {
573
- let e = l.current;
623
+ let e = b.current;
574
624
  if (!e) return;
575
- let n = x(e, B, M);
576
- d.current = 0;
577
- let r = B - 150 - 100, i = m[t % m.length], a, o = () => {
578
- d.current++;
579
- let e = d.current;
580
- n.clearRect(0, 0, B, M), n.letterSpacing = h.letterSpacing, F.current = [], f.current.forEach((e, t) => {
581
- let n = t === N.current ? 1 : 0, r = e + (n - e) * .12;
582
- Math.abs(r - n) < .005 ? n === 0 ? f.current.delete(t) : f.current.set(t, 1) : f.current.set(t, r);
583
- }), N.current && !f.current.has(N.current) && f.current.set(N.current, 0), C(n, B, M, e, 40, v(u.blue, .04));
584
- let t = Math.max(...T.map((e) => e.total ?? 0), 1);
585
- T.forEach((a, o) => {
586
- let s = f.current.get(a.id) ?? 0, c = ue + o * (ce + le), l = n.createLinearGradient(150, 0, 150 + r, 0);
587
- l.addColorStop(0, v(u.tealDark, .55 + s * .1)), l.addColorStop(1, v(u.tealDark, .22 + s * .08)), n.fillStyle = l, n.beginPath(), n.rect(150, c, r, ce), n.fill();
588
- let d = (a.total ?? 0) / t, p = 150 + r * Math.min(d, d * A(Math.min(1, e * .005)));
589
- if (p > 152) {
590
- let e = n.createLinearGradient(150, 0, p, 0);
591
- e.addColorStop(0, v(i, .55)), e.addColorStop(1, v(i, .9)), n.fillStyle = e, n.beginPath(), n.rect(150, c, p - 150, ce), n.fill();
625
+ let t = S(e, v, W);
626
+ x.current = 0, t.font = g.font, t.letterSpacing = g.letterSpacing;
627
+ let n = H.reduce((e, n) => Math.max(e, t.measureText(n.name ?? n.abbreviation ?? "").width), 0);
628
+ t.font = _.font;
629
+ let r = H.reduce((e, n) => Math.max(e, t.measureText(K(n.total ?? 0)).width), 0), i = Math.max(Math.min(n + 20, v * .3), 40), a = Math.max(r + 20, 28), o = v - i - a, [s, c] = m[f % m.length], l, d = () => {
630
+ x.current++;
631
+ let e = x.current;
632
+ t.clearRect(0, 0, v, W), t.letterSpacing = g.letterSpacing, de.current = [], E.current.forEach((e, t) => {
633
+ let n = t === ne.current ? 1 : 0, r = e + (n - e) * .12;
634
+ Math.abs(r - n) < .005 ? n === 0 ? E.current.delete(t) : E.current.set(t, 1) : E.current.set(t, r);
635
+ }), ne.current && !E.current.has(ne.current) && E.current.set(ne.current, 0), w(t, v, W, e, 40, y(c, .04));
636
+ let n = Math.max(...H.map((e) => e.total ?? 0), 1);
637
+ H.forEach((a, l) => {
638
+ let d = E.current.get(a.id) ?? 0, f = !L && M.current && a.id !== M.current ? .6 : 1, p = oe + l * (ie + ae);
639
+ t.fillStyle = y(u.barBg, .2), t.beginPath(), t.rect(i, p, o, ie), t.fill();
640
+ let m = (a.total ?? 0) / n, h = i + o * Math.min(m, m * j(Math.min(1, e * .005)));
641
+ if (h > i + 2) {
642
+ let e = t.createLinearGradient(i, 0, h, 0);
643
+ e.addColorStop(0, y(s, .75 * f)), e.addColorStop(1, y(c, .95 * f)), t.fillStyle = e, t.beginPath(), t.rect(i, p, h - i, ie), t.fill();
592
644
  }
593
- s > 0 && S(n, p, c + ce / 2, 12 * s, i, .35 * s);
594
- let m = {
645
+ d > 0 && C(t, h, p + ie / 2, 12 * d, c, .35 * d);
646
+ let v = {
595
647
  label: a.name,
596
- sublabel: a.totalLabel ?? (a.total == null ? void 0 : z(a.total)),
597
- color: i
648
+ sublabel: a.totalLabel ?? (a.total == null ? void 0 : K(a.total)),
649
+ color: c
598
650
  };
599
- k(F.current, a.id, 0, c - le / 2, 150 + r, ce + le, m), O(F.current, a.id, p, c + ce / 2, 10, m), n.font = g.font, n.fillStyle = s > 0 ? v(i, 1) : v(u.t1, .85), n.textAlign = "left", n.textBaseline = "middle", n.fillText(z(a.total ?? 0), 150 + r + 12, c + ce / 2), n.font = h.font, n.fillStyle = s > 0 ? v(i, 1) : h.color, n.textAlign = "right", n.fillText(pe(n, a.name ?? a.abbreviation ?? "", 134), 142, c + ce / 2);
600
- }), w(n, B, M, e, .015), a = requestAnimationFrame(o);
651
+ A(de.current, a.id, 0, p - ae / 2, i + o, ie + ae, v, void 0, i + o + 12 + r + 14), k(de.current, a.id, h, p + ie / 2, 10, v), t.font = _.font, t.fillStyle = d > 0 ? y(c, 1 * f) : y(u.t1, .85 * f), t.textAlign = "left", t.textBaseline = "middle", t.fillText(K(a.total ?? 0), i + o + 12, p + ie / 2), t.font = g.font, t.fillStyle = d > 0 ? y(c, 1 * f) : y(u.t2, .85 * f), t.textAlign = "right", t.fillText(le(t, a.name ?? a.abbreviation ?? "", i - 16), i - 8, p + ie / 2);
652
+ }), T(t, v, W, e, .015), l = requestAnimationFrame(d);
601
653
  };
602
- return o(), () => cancelAnimationFrame(a);
654
+ return d(), () => cancelAnimationFrame(l);
603
655
  }, [
604
- T,
605
- M,
606
- t
607
- ]), b.length === 0 ? /* @__PURE__ */ s(R, {
608
- width: B,
609
- height: 160,
610
- "data-testid": r
656
+ H,
657
+ W,
658
+ f,
659
+ v
660
+ ]), V.length === 0 ? /* @__PURE__ */ s("div", {
661
+ ref: h,
662
+ style: { width: "100%" },
663
+ children: /* @__PURE__ */ s(G, {
664
+ width: v,
665
+ height: 160,
666
+ testID: p
667
+ })
611
668
  }) : /* @__PURE__ */ c("div", {
612
- "data-testid": r,
613
- style: { width: B },
669
+ ref: h,
670
+ "data-testid": p,
671
+ style: { width: "100%" },
614
672
  children: [/* @__PURE__ */ c("div", {
615
673
  style: { position: "relative" },
616
674
  children: [/* @__PURE__ */ s("canvas", {
617
- ref: l,
675
+ ref: b,
618
676
  role: "img",
619
677
  "aria-label": "Commitment race — contractors ranked by commitment percentage",
620
678
  style: {
621
- width: B,
622
- height: M,
679
+ width: "100%",
680
+ height: W,
623
681
  display: "block",
624
682
  borderRadius: 8
625
683
  }
626
- }), /* @__PURE__ */ s(E, {
627
- ...P,
628
- parentW: B,
629
- parentH: M
684
+ }), /* @__PURE__ */ s(D, {
685
+ ...ue,
686
+ parentW: v,
687
+ parentH: W
630
688
  })]
631
- }), y.length > fe && /* @__PURE__ */ s("div", {
689
+ }), z.length > ce && /* @__PURE__ */ s("div", {
632
690
  style: { marginTop: 8 },
633
- children: /* @__PURE__ */ s(oe, {
634
- expanded: p,
635
- onToggle: () => _((e) => !e)
691
+ children: /* @__PURE__ */ s(te, {
692
+ expanded: F,
693
+ onToggle: () => I((e) => !e)
636
694
  })
637
695
  })]
638
696
  });
639
697
  }
640
698
  //#endregion
641
699
  //#region src/components/semiCircularGaugeChart/SemiCircularGaugeChart.tsx
642
- var he = 480, ge = 310, _e = 18, ve = [
643
- "#00818F",
644
- "#5C42B8",
645
- "#C87B0A",
646
- "#2563EB",
647
- "#166534"
648
- ];
649
- function ye(e, t, n) {
700
+ var de = 480, fe = 310, pe = 18;
701
+ function me(e, t, n) {
650
702
  let r = t.split(" "), i = [], a = "";
651
703
  for (let t of r) {
652
704
  let r = a ? `${a} ${t}` : t;
@@ -654,64 +706,89 @@ function ye(e, t, n) {
654
706
  }
655
707
  return a && i.push(a), i;
656
708
  }
657
- function be({ confirmed: e, total: t, label: r, colorOffset: i = 0, "data-testid": o }) {
658
- let c = a(null), l = a(0);
709
+ function he({ confirmed: e, total: r, label: i, colorOffset: o = 0, selectedId: l, selectedLabel: d, gaugeByEntity: f, onItemClick: p, subentity: h, testID: _ }) {
710
+ let b = a(null), x = a(0), w = l && f?.[l] ? f[l] : {
711
+ confirmed: e,
712
+ total: r
713
+ }, T = w.confirmed, E = w.total, k = t(() => {
714
+ p?.("confirmed", i ?? "confirmed", h);
715
+ }, [
716
+ p,
717
+ i,
718
+ h
719
+ ]), { tooltip: M, hitZonesRef: N } = O(b, {
720
+ width: de,
721
+ height: fe,
722
+ onClick: p ? k : void 0
723
+ });
659
724
  return n(() => {
660
- let n = c.current;
661
- if (!n) return;
662
- let a = x(n, he, ge);
663
- l.current = 0;
664
- let o = i % m.length, s = m[o], d = ve[o], f = he / 2, p = Math.PI, g = 2 * Math.PI, y = Math.PI, b, C = () => {
665
- l.current++;
666
- let n = l.current;
667
- a.clearRect(0, 0, he, ge), a.letterSpacing = h.letterSpacing;
668
- let i = A(Math.min(n / 80, 1)), o = N(Math.min(n / 72, 1)), c = Math.round((e ?? 0) / (t || 1) * 100), m = p + c / 100 * y * i;
669
- a.beginPath(), a.arc(f, 175, 148, p, g), a.strokeStyle = v(s, .28), a.lineWidth = 4, a.lineCap = "round", a.stroke(), a.lineCap = "butt", a.beginPath(), a.moveTo(f, 175), a.arc(f, 175, 133, p, m), a.closePath(), a.fillStyle = v(d, .35 * i), a.fill();
670
- let x = f + Math.cos(m) * 148, w = 175 + Math.sin(m) * 148;
671
- S(a, x, w, 10, s, .3 * i);
672
- let T = a.createLinearGradient(f + Math.cos(p) * 148, 175 + Math.sin(p) * 148, x, w);
673
- T.addColorStop(0, v(d, .9 * i)), T.addColorStop(1, v(s, 1 * i)), a.beginPath(), a.arc(f, 175, 148, p, m), a.strokeStyle = T, a.lineWidth = 4, a.lineCap = "round", a.stroke(), a.lineCap = "butt";
674
- let E = p + c / 100 * y * o, D = f + Math.cos(E) * 133, O = 175 + Math.sin(E) * 133, k = f - Math.cos(E) * 24, j = 175 - Math.sin(E) * 24, M = -Math.sin(E), P = Math.cos(E), F = 2.5 * o;
675
- a.beginPath(), a.moveTo(D, O), a.lineTo(f + M * F, 175 + P * F), a.lineTo(k + M * 1, j + P * 1), a.lineTo(k - M * 1, j - P * 1), a.lineTo(f - M * F, 175 - P * F), a.closePath(), a.fillStyle = v(u.t1, o), a.fill(), a.beginPath(), a.arc(f, 175, 11, 0, Math.PI * 2), a.strokeStyle = v(s, .85 * o), a.lineWidth = 2, a.stroke(), a.beginPath(), a.arc(f, 175, 9, 0, Math.PI * 2), a.fillStyle = u.t1, a.fill(), [
725
+ let e = b.current;
726
+ if (!e) return;
727
+ let t = S(e, de, fe);
728
+ x.current = 0;
729
+ let [n, r] = m[o % m.length], a = de / 2, s = Math.PI, c = 2 * Math.PI, l = Math.PI, d, f = () => {
730
+ x.current++;
731
+ let e = x.current;
732
+ t.clearRect(0, 0, de, fe), t.letterSpacing = g.letterSpacing, N.current = [], A(N.current, "confirmed", a - 148, 27, 296, 148, {
733
+ label: i ?? "Confirmed",
734
+ value: `${K(T ?? 0)} / ${K(E ?? 0)}`,
735
+ sublabel: `${Math.round((T ?? 0) / (E || 1) * 100)}%`,
736
+ color: r
737
+ });
738
+ let o = j(Math.min(e / 80, 1)), p = P(Math.min(e / 72, 1)), m = Math.round((T ?? 0) / (E || 1) * 100), h = s + m / 100 * l * o;
739
+ t.beginPath(), t.arc(a, 175, 148, s, c), t.strokeStyle = y(r, .28), t.lineWidth = 4, t.lineCap = "round", t.stroke(), t.lineCap = "butt", t.beginPath(), t.moveTo(a, 175), t.arc(a, 175, 133, s, h), t.closePath(), t.fillStyle = y(n, .35 * o), t.fill();
740
+ let _ = a + Math.cos(h) * 148, b = 175 + Math.sin(h) * 148;
741
+ C(t, _, b, 10, r, .3 * o);
742
+ let S = t.createLinearGradient(a + Math.cos(s) * 148, 175 + Math.sin(s) * 148, _, b);
743
+ S.addColorStop(0, y(n, .9 * o)), S.addColorStop(1, y(r, 1 * o)), t.beginPath(), t.arc(a, 175, 148, s, h), t.strokeStyle = S, t.lineWidth = 4, t.lineCap = "round", t.stroke(), t.lineCap = "butt";
744
+ let w = s + m / 100 * l * p, D = a + Math.cos(w) * 133, O = 175 + Math.sin(w) * 133, k = a - Math.cos(w) * 24, M = 175 - Math.sin(w) * 24, F = -Math.sin(w), I = Math.cos(w), L = 2.5 * p;
745
+ t.beginPath(), t.moveTo(D, O), t.lineTo(a + F * L, 175 + I * L), t.lineTo(k + F * 1, M + I * 1), t.lineTo(k - F * 1, M - I * 1), t.lineTo(a - F * L, 175 - I * L), t.closePath(), t.fillStyle = y(u.t1, p), t.fill(), t.beginPath(), t.arc(a, 175, 11, 0, Math.PI * 2), t.strokeStyle = y(r, .85 * p), t.lineWidth = 2, t.stroke(), t.beginPath(), t.arc(a, 175, 9, 0, Math.PI * 2), t.fillStyle = u.t1, t.fill(), [
676
746
  [0, "0%"],
677
747
  [.5, "50%"],
678
748
  [1, "100%"]
679
- ].forEach(([e, t]) => {
680
- let n = p + e * y, r = e === 1 ? 184 : 168, i = f + Math.cos(n) * r, o = 175 + Math.sin(n) * r;
681
- a.font = h.font, a.fillStyle = h.color, a.textAlign = "center", a.fillText(t, i, o + 4);
682
- }), i > .4 && (a.globalAlpha = Math.min(1, (i - .4) / .4), a.font = "700 32px 'Satoshi Variable', 'DM Sans', sans-serif", a.fillStyle = u.t1, a.textAlign = "center", a.fillText(`${Math.round(c * o)}%`, f, 247), a.globalAlpha = 1), i > .7 && r && (a.globalAlpha = Math.min(1, (i - .7) / .3), a.font = _.font, a.fillStyle = _.color, a.textAlign = "center", ye(a, `${z(e ?? 0)} of ${z(t ?? 0)} ${r}`, he - 40).forEach((e, t) => {
683
- a.fillText(e, f, 287 + t * _e);
684
- }), a.globalAlpha = 1), b = requestAnimationFrame(C);
749
+ ].forEach(([e, n]) => {
750
+ let r = s + e * l, i = e === 1 ? 184 : 168, o = a + Math.cos(r) * i, c = 175 + Math.sin(r) * i;
751
+ t.font = g.font, t.fillStyle = g.color, t.textAlign = "center", t.fillText(n, o, c + 4);
752
+ }), o > .4 && (t.globalAlpha = Math.min(1, (o - .4) / .4), t.font = "700 32px 'Satoshi Variable', 'DM Sans', sans-serif", t.fillStyle = u.t1, t.textAlign = "center", t.fillText(`${Math.round(m * p)}%`, a, 247), t.globalAlpha = 1), o > .7 && i && (t.globalAlpha = Math.min(1, (o - .7) / .3), t.font = v.font, t.fillStyle = v.color, t.textAlign = "center", me(t, `${K(T ?? 0)} of ${K(E ?? 0)} ${i}`, de - 40).forEach((e, n) => {
753
+ t.fillText(e, a, 287 + n * pe);
754
+ }), t.globalAlpha = 1), d = requestAnimationFrame(f);
685
755
  };
686
- return C(), () => cancelAnimationFrame(b);
756
+ return f(), () => cancelAnimationFrame(d);
687
757
  }, [
688
- e,
689
- t,
690
- r,
691
- i
692
- ]), /* @__PURE__ */ s("div", {
693
- "data-testid": o,
758
+ T,
759
+ E,
760
+ i,
761
+ o,
762
+ l,
763
+ d
764
+ ]), /* @__PURE__ */ c("div", {
765
+ "data-testid": _,
694
766
  style: {
695
767
  position: "relative",
696
- width: he,
697
- height: ge
768
+ width: "100%",
769
+ maxWidth: de,
770
+ margin: "0 auto"
698
771
  },
699
- children: /* @__PURE__ */ s("canvas", {
700
- ref: c,
772
+ children: [/* @__PURE__ */ s("canvas", {
773
+ ref: b,
701
774
  role: "img",
702
- "aria-label": `Compensation event gauge — ${Math.round((e ?? 0) / (t || 1) * 100)}% of NCEs confirmed as compensation events`,
775
+ "aria-label": `Compensation event gauge — ${Math.round((T ?? 0) / (E || 1) * 100)}% of NCEs confirmed as compensation events`,
703
776
  style: {
704
- width: he,
705
- height: ge,
777
+ width: "100%",
778
+ aspectRatio: `${de} / ${fe}`,
706
779
  display: "block"
707
780
  }
708
- })
781
+ }), /* @__PURE__ */ s(D, {
782
+ ...M,
783
+ parentW: de,
784
+ parentH: fe
785
+ })]
709
786
  });
710
787
  }
711
788
  //#endregion
712
789
  //#region src/canvas/useCanvasLoop.ts
713
- function xe(e, t, r, i, o = !0, s = {}) {
714
- let c = a(0), { easing: l = A, durationFrames: u = 48 } = s;
790
+ function ge(e, t, r, i, o = !0, s = {}) {
791
+ let c = a(0), { easing: l = j, durationFrames: u = 48 } = s;
715
792
  n(() => {
716
793
  let n = e.current;
717
794
  if (!n || !t || !r) return;
@@ -742,28 +819,28 @@ function xe(e, t, r, i, o = !0, s = {}) {
742
819
  }
743
820
  //#endregion
744
821
  //#region src/components/multiMetricConstellationChart/MultiMetricConstellationChart.tsx
745
- var V = 780, Se = 234, Ce = 130, we = 52, Te = [
822
+ var q = 780, _e = 234, ve = 130, ye = 52, be = [
746
823
  u.blue,
747
824
  u.amber,
748
825
  u.purple,
749
826
  u.green
750
- ], Ee = [
827
+ ], xe = [
751
828
  "Base Value",
752
829
  "Variations",
753
830
  "Commitment"
754
- ], De = [
831
+ ], Se = [
755
832
  "Base",
756
833
  "Var",
757
834
  "Commit"
758
835
  ];
759
- function Oe({ items: e = [], "data-testid": t }) {
760
- let n = a(null), r = a(/* @__PURE__ */ new Map()), { hoveredRef: o, tooltip: l, hitZonesRef: d } = D(n, {
761
- width: V,
762
- height: Se
836
+ function Ce({ items: e = [], testID: t }) {
837
+ let n = a(null), r = a(/* @__PURE__ */ new Map()), { hoveredRef: o, tooltip: l, hitZonesRef: d } = O(n, {
838
+ width: q,
839
+ height: _e
763
840
  }), f = i(() => e.filter((e) => typeof e == "object" && !!e), [e]), p = i(() => {
764
841
  let e = Math.max(...f.map((e) => e.base ?? 0)), t = Math.max(...f.map((e) => e.variation ?? 0));
765
842
  return f.map((n, r) => {
766
- let i = V * (.12 + r * .19), a = Ce, o = Math.min(V * .075, we), s = Te[r % Te.length], c = [
843
+ let i = q * (.12 + r * .19), a = ve, o = Math.min(q * .075, ye), s = be[r % be.length], c = [
767
844
  (n.base ?? 0) / (e || 1) * 100,
768
845
  (n.variation ?? 0) / (t || 1) * 100,
769
846
  n.percentage ?? 0
@@ -772,10 +849,10 @@ function Oe({ items: e = [], "data-testid": t }) {
772
849
  n.variationLabel ?? String(n.variation ?? 0),
773
850
  `${n.percentage ?? 0}%`
774
851
  ], u = c.map((e, t) => {
775
- let n = -Math.PI / 2 + t / Ee.length * Math.PI * 2, r = e / 100, s = o * Math.max(.08, r);
852
+ let n = -Math.PI / 2 + t / xe.length * Math.PI * 2, r = e / 100, s = o * Math.max(.08, r);
776
853
  return {
777
- name: Ee[t],
778
- short: De[t],
854
+ name: xe[t],
855
+ short: Se[t],
779
856
  label: l[t],
780
857
  val: Math.round(e),
781
858
  x: i + Math.cos(n) * s,
@@ -795,307 +872,338 @@ function Oe({ items: e = [], "data-testid": t }) {
795
872
  };
796
873
  });
797
874
  }, [f]);
798
- return xe(n, V, Se, (e, t, n) => {
799
- I(r.current, o.current), d.current = [], C(e, V, Se, n, 30), p.forEach((t, i) => {
875
+ return ge(n, q, _e, (e, t, n) => {
876
+ L(r.current, o.current), d.current = [], w(e, q, _e, n, 30), p.forEach((t, i) => {
800
877
  let a = t.color, o = `constellation-${i}`, s = r.current.get(o) ?? 0;
801
- e.beginPath(), e.arc(t.cx, t.cy, t.baseR + 5, 0, Math.PI * 2), e.strokeStyle = v(u.bd, .08 + .08 * s), e.lineWidth = .5, e.stroke(), e.beginPath(), t.stars.forEach((t, n) => {
878
+ e.beginPath(), e.arc(t.cx, t.cy, t.baseR + 5, 0, Math.PI * 2), e.strokeStyle = y(u.bd, .08 + .08 * s), e.lineWidth = .5, e.stroke(), e.beginPath(), t.stars.forEach((t, n) => {
802
879
  n === 0 ? e.moveTo(t.x, t.y) : e.lineTo(t.x, t.y);
803
- }), e.closePath(), e.fillStyle = v(a, .04 + .03 * s), e.fill(), e.strokeStyle = v(a, .15 + .1 * s), e.lineWidth = .8, e.stroke(), t.stars.forEach((o, s) => {
804
- let c = P(n, .05, 5e-4) * .3 + .7, l = 3.5 * c, u = `star-${i}-${s}`, f = r.current.get(u) ?? 0, p = e.createRadialGradient(o.x, o.y, 0, o.x, o.y, l * 4);
805
- p.addColorStop(0, v(a, (.2 + .1 * f) * c)), p.addColorStop(1, v(a, 0)), e.fillStyle = p, e.beginPath(), e.arc(o.x, o.y, l * 4, 0, Math.PI * 2), e.fill(), e.beginPath(), e.arc(o.x, o.y, l + f * 2, 0, Math.PI * 2), e.fillStyle = v(a, (.8 + .2 * f) * c), e.fill();
880
+ }), e.closePath(), e.fillStyle = y(a, .04 + .03 * s), e.fill(), e.strokeStyle = y(a, .15 + .1 * s), e.lineWidth = .8, e.stroke(), t.stars.forEach((o, s) => {
881
+ let c = F(n, .05, 5e-4) * .3 + .7, l = 3.5 * c, u = `star-${i}-${s}`, f = r.current.get(u) ?? 0, p = e.createRadialGradient(o.x, o.y, 0, o.x, o.y, l * 4);
882
+ p.addColorStop(0, y(a, (.2 + .1 * f) * c)), p.addColorStop(1, y(a, 0)), e.fillStyle = p, e.beginPath(), e.arc(o.x, o.y, l * 4, 0, Math.PI * 2), e.fill(), e.beginPath(), e.arc(o.x, o.y, l + f * 2, 0, Math.PI * 2), e.fillStyle = y(a, (.8 + .2 * f) * c), e.fill();
806
883
  let m = Math.sin(o.angle) < -.3;
807
- e.textAlign = "center", e.textBaseline = "middle", m ? (e.font = h.font, e.fillStyle = v(a, .5 + .15 * f), e.fillText(o.short, o.x, o.y - 24), e.font = h.font, e.fillStyle = v(a, .8 + .15 * f), e.fillText(o.label, o.x, o.y - 11)) : (e.font = h.font, e.fillStyle = v(a, .5 + .15 * f), e.fillText(o.short, o.x, o.y + 11), e.font = h.font, e.fillStyle = v(a, .8 + .15 * f), e.fillText(o.label, o.x, o.y + 24)), O(d.current, u, o.x, o.y, l * 4 + 2, {
884
+ e.textAlign = "center", e.textBaseline = "middle", m ? (e.font = g.font, e.fillStyle = y(a, .5 + .15 * f), e.fillText(o.short, o.x, o.y - 24), e.font = g.font, e.fillStyle = y(a, .8 + .15 * f), e.fillText(o.label, o.x, o.y - 11)) : (e.font = g.font, e.fillStyle = y(a, .5 + .15 * f), e.fillText(o.short, o.x, o.y + 11), e.font = g.font, e.fillStyle = y(a, .8 + .15 * f), e.fillText(o.label, o.x, o.y + 24)), k(d.current, u, o.x, o.y, l * 4 + 2, {
808
885
  label: o.name,
809
886
  value: o.label,
810
887
  sublabel: t.abbreviation ?? t.name.slice(0, 6),
811
888
  color: a
812
889
  });
813
- }), s > 0 && S(e, t.cx, t.cy, 16 * s, a, .15 * s), e.beginPath(), e.arc(t.cx, t.cy, t.baseR + 12, 0, Math.PI * 2), e.strokeStyle = v(a, .1 + P(n, .03, 5e-4) * .05), e.lineWidth = 1, e.stroke(), e.font = h.font, e.textAlign = "center", e.textBaseline = "alphabetic", e.fillStyle = s > 0 ? t.color : h.color, e.fillText(t.abbreviation ?? t.name.slice(0, 6), t.cx, t.cy + t.baseR + 26), O(d.current, o, t.cx, t.cy, t.baseR + 5, {
890
+ }), s > 0 && C(e, t.cx, t.cy, 16 * s, a, .15 * s), e.beginPath(), e.arc(t.cx, t.cy, t.baseR + 12, 0, Math.PI * 2), e.strokeStyle = y(a, .1 + F(n, .03, 5e-4) * .05), e.lineWidth = 1, e.stroke(), e.font = g.font, e.textAlign = "center", e.textBaseline = "alphabetic", e.fillStyle = s > 0 ? t.color : g.color, e.fillText(t.abbreviation ?? t.name.slice(0, 6), t.cx, t.cy + t.baseR + 26), k(d.current, o, t.cx, t.cy, t.baseR + 5, {
814
891
  label: t.name,
815
892
  value: `${t.totalLabel ?? String(t.total ?? 0)} total`,
816
893
  sublabel: `${t.percentage ?? 0}% committed · scatter ${t.scatter.toFixed(1)}`,
817
894
  color: a
818
895
  });
819
- }), e.font = _.font, e.textAlign = "center", e.textBaseline = "middle", e.fillStyle = _.color, e.fillText("▲ top = Base value · ▼▸ lower-right = Variations · ◂▼ lower-left = Commitment % · hover stars for details", V / 2, Se - 14), w(e, V, Se, n, .012);
820
- }, !0), p.length === 0 ? /* @__PURE__ */ s(R, {
821
- width: V,
822
- height: Se,
823
- "data-testid": t
896
+ }), e.font = v.font, e.textAlign = "center", e.textBaseline = "middle", e.fillStyle = v.color, e.fillText("▲ top = Base value · ▼▸ lower-right = Variations · ◂▼ lower-left = Commitment % · hover stars for details", q / 2, _e - 14), T(e, q, _e, n, .012);
897
+ }, !0), p.length === 0 ? /* @__PURE__ */ s(G, {
898
+ width: q,
899
+ height: _e,
900
+ testID: t
824
901
  }) : /* @__PURE__ */ c("div", {
825
902
  "data-testid": t,
826
903
  style: {
827
904
  position: "relative",
828
- width: V,
829
- height: Se
905
+ width: q,
906
+ height: _e
830
907
  },
831
908
  children: [/* @__PURE__ */ s("canvas", {
832
909
  ref: n,
833
910
  role: "img",
834
911
  "aria-label": "Contract value breakdown per contractor — multi-KPI constellation chart",
835
912
  style: {
836
- width: V,
837
- height: Se,
913
+ width: q,
914
+ height: _e,
838
915
  display: "block"
839
916
  }
840
- }), /* @__PURE__ */ s(E, {
917
+ }), /* @__PURE__ */ s(D, {
841
918
  ...l,
842
- parentW: V,
843
- parentH: Se
919
+ parentW: q,
920
+ parentH: _e
844
921
  })]
845
922
  });
846
923
  }
847
924
  //#endregion
848
925
  //#region src/components/stackedHorizontalBarChart/StackedHorizontalBarChart.tsx
849
- var ke = 680, Ae = 220, je = 8, Me = [u.teal], H = {
926
+ var we = 680, Te = 220, Ee = 8, De = [u.teal], J = {
850
927
  left: 8,
851
928
  right: 100,
852
929
  top: 16,
853
930
  bottom: 38
854
- }, Ne = 150, U = 6;
855
- function Pe(e, t, n) {
931
+ }, Oe = 150, ke = 6;
932
+ function Ae(e, t, n) {
856
933
  if (e.measureText(t).width <= n) return t;
857
934
  let r = t;
858
935
  for (; r.length > 0 && e.measureText(r + "…").width > n;) r = r.slice(0, -1);
859
936
  return r + "…";
860
937
  }
861
- function Fe(e) {
938
+ function je(e) {
862
939
  let t = Math.abs(e), n = e < 0 ? "-" : "";
863
940
  return t >= 1e6 ? `${n}£${(t / 1e6).toFixed(1)}M` : t >= 1e3 ? `${n}£${(t / 1e3).toFixed(1)}K` : `${n}£${t.toFixed(0)}`;
864
941
  }
865
- function Ie({ data: e, "data-testid": t }) {
866
- let n = a(null), r = a(/* @__PURE__ */ new Map()), [i, l] = o(!1), { items: d = [], totals: f } = e, p = d.filter((e) => typeof e == "object" && !!e), m = [...p].sort((e, t) => (t.total ?? 0) - (e.total ?? 0)), y = i ? m : m.slice(0, je), b = y.length, x = Math.max(...m.map((e) => Math.abs(e.total ?? 0)), 1), C = b * U + Math.max(0, b - 1) * 38, w = H.top + H.bottom + C, T = ke - H.left - Ne - H.right, O = p.length === 0, { hoveredRef: A, tooltip: M, hitZonesRef: N } = D(n, {
867
- width: ke,
868
- height: w
942
+ function Me({ data: e, dataByEntity: n, onItemClick: r, selectedId: i, testID: l }) {
943
+ let [d, f] = ee(we), p = a(null), m = a(/* @__PURE__ */ new Map()), h = a(i);
944
+ h.current = i;
945
+ let b = t((e, t) => {
946
+ let n = typeof t == "object" ? t.label ?? e : e, i = V.current.visibleItems.find((t) => t.id === e);
947
+ r?.(e, n, i?.subentity);
948
+ }, [r]), [x, S] = o(!1), w = !!(i && n?.[i]), { items: T = [], totals: E } = w ? n[i] : e, k = T.filter((e) => typeof e == "object" && !!e), j = [...k].sort((e, t) => (t.total ?? 0) - (e.total ?? 0)), N = x ? j : j.slice(0, Ee), P = N.length, F = Math.max(...j.map((e) => Math.abs(e.total ?? 0)), 1), R = P * ke + Math.max(0, P - 1) * 38, z = J.top + J.bottom + R, B = f - J.left - Oe - J.right, V = a({
949
+ visibleItems: N,
950
+ maxCommitment: F,
951
+ totals: E,
952
+ barArea: B,
953
+ BAR_GAP: 38,
954
+ n: P,
955
+ dynamicH: z,
956
+ isDrillMode: w
957
+ });
958
+ V.current = {
959
+ visibleItems: N,
960
+ maxCommitment: F,
961
+ totals: E,
962
+ barArea: B,
963
+ BAR_GAP: 38,
964
+ n: P,
965
+ dynamicH: z,
966
+ isDrillMode: w
967
+ };
968
+ let H = (e.items ?? []).filter((e) => typeof e == "object" && !!e).length === 0, { hoveredRef: U, tooltip: W, hitZonesRef: ne } = O(p, {
969
+ width: f,
970
+ height: z,
971
+ onClick: r ? b : void 0
869
972
  });
870
- return xe(n, ke, w, (e, t) => {
871
- I(r.current, A.current), N.current = [], y.forEach((n, i) => {
872
- let a = Me[i % Me.length], o = F(t, i, b, j), s = H.top + i * (U + 38), c = H.left + Ne, l = r.current.get(n.id) ?? 0, d = Math.max(n.total ?? 0, 0) / x * T * o;
873
- if (e.font = h.font, e.fillStyle = l > 0 ? a : h.color, e.textAlign = "right", e.textBaseline = "middle", e.fillText(Pe(e, n.name ?? "", Ne - 16), c - 8, s + U / 2), k(N.current, n.id, 0, s, c, U, {
973
+ return ge(p, f, z, (e, t) => {
974
+ let { visibleItems: n, maxCommitment: r, totals: i, barArea: a, BAR_GAP: o, n: s, dynamicH: c, isDrillMode: l } = V.current;
975
+ L(m.current, U.current), ne.current = [], n.forEach((n, i) => {
976
+ let c = De[i % De.length], d = I(t, i, s, M), f = J.top + i * (ke + o), p = J.left + Oe, v = m.current.get(n.id) ?? 0, b = !l && h.current && n.id !== h.current ? .2 : 1, x = Math.max(n.total ?? 0, 0) / r * a * d;
977
+ if (e.font = g.font, e.fillStyle = v > 0 ? c : g.color, e.textAlign = "right", e.textBaseline = "middle", e.fillText(Ae(e, n.name ?? "", Oe - 16), p - 8, f + ke / 2), A(ne.current, n.id, 0, f, p, ke, {
874
978
  label: n.name,
875
- value: `${n.totalLabel ?? Fe(n.total ?? 0)} total`,
876
- sublabel: `Base ${n.baseLabel ?? Fe(n.base ?? 0)} + Var ${n.variationLabel ?? Fe(n.variation ?? 0)}`,
877
- color: a
878
- }), d > 0) {
879
- l > 0 && S(e, c + d / 2, s + U / 2, d * .15, u.teal, .12 * l);
880
- let t = e.createLinearGradient(c, 0, c + d, 0);
881
- t.addColorStop(0, v(u.tealDark, .85)), t.addColorStop(1, v(u.teal, 1)), e.fillStyle = t, e.beginPath(), e.rect(c, s, d, U), e.fill();
882
- }
883
- let f = T * o, p = c + d, m = f - d;
884
- if (m > 2) {
885
- let t = e.createLinearGradient(p, 0, c + f, 0);
886
- t.addColorStop(0, v(u.tealDark, .55)), t.addColorStop(1, v(u.tealDark, .22)), e.fillStyle = t, e.beginPath(), e.rect(p, s, m, U), e.fill();
979
+ value: `${n.totalLabel ?? je(n.total ?? 0)} total`,
980
+ sublabel: `Base ${n.baseLabel ?? je(n.base ?? 0)} + Var ${n.variationLabel ?? je(n.variation ?? 0)}`,
981
+ color: c
982
+ }), x > 0) {
983
+ v > 0 && C(e, p + x / 2, f + ke / 2, x * .15, u.teal, .12 * v);
984
+ let t = e.createLinearGradient(p, 0, p + x, 0);
985
+ t.addColorStop(0, y(u.tealDark, .85 * b)), t.addColorStop(1, y(u.teal, 1 * b)), e.fillStyle = t, e.beginPath(), e.rect(p, f, x, ke), e.fill();
887
986
  }
888
- if (d > 4) {
889
- let t = c + d, n = s + U;
890
- e.strokeStyle = v(u.t4, .9 * o), e.lineWidth = 4, e.beginPath(), e.moveTo(t, s), e.lineTo(t, n), e.stroke();
987
+ let S = B * d, w = p + x, T = S - x;
988
+ if (T > 2 && (e.fillStyle = y(u.barBg, .2), e.beginPath(), e.rect(w, f, T, ke), e.fill()), x > 4) {
989
+ let t = p + x, n = f + ke;
990
+ e.strokeStyle = y(u.t4, .9 * d), e.lineWidth = 4, e.beginPath(), e.moveTo(t, f), e.lineTo(t, n), e.stroke();
891
991
  let r = n + 3, i = {
892
992
  x: t,
893
993
  y: r
894
994
  }, a = {
895
995
  x: t + 10,
896
996
  y: r + 12
897
- }, l = {
997
+ }, o = {
898
998
  x: t - 10,
899
999
  y: r + 12
900
1000
  };
901
- e.fillStyle = v(u.t1, o), e.beginPath(), e.moveTo((i.x + a.x) / 2, (i.y + a.y) / 2), e.arcTo(a.x, a.y, l.x, l.y, 1), e.arcTo(l.x, l.y, i.x, i.y, 1), e.arcTo(i.x, i.y, a.x, a.y, 1), e.closePath(), e.fill();
1001
+ e.fillStyle = y(u.t1, d), e.beginPath(), e.moveTo((i.x + a.x) / 2, (i.y + a.y) / 2), e.arcTo(a.x, a.y, o.x, o.y, 1), e.arcTo(o.x, o.y, i.x, i.y, 1), e.arcTo(i.x, i.y, a.x, a.y, 1), e.closePath(), e.fill();
902
1002
  }
903
- o > .35 && (e.globalAlpha = Math.min(1, (o - .35) / .4), e.font = g.font, e.fillStyle = l > 0 ? a : g.color, e.textAlign = "left", e.textBaseline = "middle", e.fillText(n.totalLabel ?? Fe(n.total ?? 0), c + T + 28, s + U / 2), e.globalAlpha = 1), k(N.current, n.id, c, s, Math.max(d, 1), U, {
1003
+ d > .35 && (e.globalAlpha = Math.min(1, (d - .35) / .4) * b, e.font = _.font, e.fillStyle = v > 0 ? c : _.color, e.textAlign = "left", e.textBaseline = "middle", e.fillText(n.totalLabel ?? je(n.total ?? 0), p + a + 28, f + ke / 2), e.globalAlpha = 1), A(ne.current, n.id, p, f, Math.max(x, 1), ke, {
904
1004
  label: n.name,
905
- value: n.totalLabel ?? Fe(n.total ?? 0),
906
- sublabel: `${n.baseLabel ?? Fe(n.base ?? 0)} + ${n.variationLabel ?? Fe(n.variation ?? 0)}`,
907
- color: a
1005
+ value: n.totalLabel ?? je(n.total ?? 0),
1006
+ sublabel: `${n.baseLabel ?? je(n.base ?? 0)} + ${n.variationLabel ?? je(n.variation ?? 0)}`,
1007
+ color: c
908
1008
  });
909
1009
  });
910
- let n = w - 14;
911
- e.textBaseline = "middle", e.font = _.font, e.textAlign = "left";
912
- let i = e.createLinearGradient(H.left + Ne, 0, H.left + Ne + 14, 0);
913
- i.addColorStop(0, v(u.tealDark, .85)), i.addColorStop(1, v(u.teal, 1)), e.fillStyle = i, e.beginPath(), e.rect(H.left + Ne, n - 6, 12, 12), e.fill(), e.fillStyle = _.color, e.fillText("base value", H.left + Ne + 16, n), e.fillStyle = v(u.teal, .35), e.beginPath(), e.rect(H.left + Ne + 160, n - 6, 12, 12), e.fill(), e.fillStyle = _.color, e.fillText("approved variations", H.left + Ne + 176, n), e.font = _.font, e.textAlign = "right", e.fillStyle = _.color, e.fillText(`Portfolio: ${Fe(f?.total ?? 0)}`, ke - 8, n);
914
- }, !0, { easing: j }), O ? /* @__PURE__ */ s(R, {
915
- width: ke,
916
- height: Ae,
917
- message: "No contract data available",
918
- "data-testid": t
1010
+ let d = c - 14;
1011
+ e.textBaseline = "middle", e.font = v.font, e.textAlign = "left";
1012
+ let p = e.createLinearGradient(J.left + Oe, 0, J.left + Oe + 14, 0);
1013
+ p.addColorStop(0, y(u.tealDark, .85)), p.addColorStop(1, y(u.teal, 1)), e.fillStyle = p, e.beginPath(), e.rect(J.left + Oe, d - 6, 12, 12), e.fill(), e.fillStyle = v.color, e.fillText("base value", J.left + Oe + 16, d), e.fillStyle = y(u.teal, .35), e.beginPath(), e.rect(J.left + Oe + 160, d - 6, 12, 12), e.fill(), e.fillStyle = v.color, e.fillText("approved variations", J.left + Oe + 176, d), e.font = v.font, e.textAlign = "right", e.fillStyle = v.color, e.fillText(`Portfolio: ${je(i?.total ?? 0)}`, f - 8, d);
1014
+ }, !0, { easing: M }), H ? /* @__PURE__ */ s("div", {
1015
+ ref: d,
1016
+ style: { width: "100%" },
1017
+ children: /* @__PURE__ */ s(G, {
1018
+ width: f,
1019
+ height: Te,
1020
+ message: "No contract data available",
1021
+ testID: l
1022
+ })
919
1023
  }) : /* @__PURE__ */ c("div", {
920
- "data-testid": t,
921
- style: {
922
- width: ke,
923
- transition: "all 0.25s ease"
924
- },
1024
+ ref: d,
1025
+ "data-testid": l,
1026
+ style: { width: "100%" },
925
1027
  children: [/* @__PURE__ */ c("div", {
926
1028
  style: { position: "relative" },
927
1029
  children: [/* @__PURE__ */ s("canvas", {
928
- ref: n,
1030
+ ref: p,
929
1031
  role: "img",
930
1032
  "aria-label": "Total contract value per contractor — horizontal bar chart",
931
1033
  style: {
932
- width: ke,
933
- height: w,
1034
+ width: "100%",
1035
+ height: z,
934
1036
  display: "block",
935
1037
  borderRadius: 8
936
1038
  }
937
- }), /* @__PURE__ */ s(E, {
938
- ...M,
939
- parentW: ke,
940
- parentH: w
1039
+ }), /* @__PURE__ */ s(D, {
1040
+ ...W,
1041
+ parentW: f,
1042
+ parentH: z
941
1043
  })]
942
- }), p.length > je && /* @__PURE__ */ s("div", {
1044
+ }), k.length > Ee && /* @__PURE__ */ s("div", {
943
1045
  style: { marginTop: 8 },
944
- children: /* @__PURE__ */ s(oe, {
945
- expanded: i,
946
- onToggle: () => l((e) => !e)
1046
+ children: /* @__PURE__ */ s(te, {
1047
+ expanded: x,
1048
+ onToggle: () => S((e) => !e)
947
1049
  })
948
1050
  })]
949
1051
  });
950
1052
  }
951
1053
  //#endregion
952
1054
  //#region src/components/rankedCardLeaderboard/RankedCardLeaderboard.tsx
953
- var Le = 780, W = 240, Re = 12, ze = 10, Be = 5, Ve = (Le - 2 * Re - (Be - 1) * ze) / Be;
954
- function He({ items: e = [], "data-testid": t }) {
955
- let r = a(null), o = a(0), l = a(/* @__PURE__ */ new Map()), d = [...i(() => e.filter((e) => typeof e == "object" && !!e), [e])].sort((e, t) => (t.count ?? 0) - (e.count ?? 0)).slice(0, 5), f = d.reduce((e, t) => e + (t.count ?? 0), 0), m = Math.min(Be, d.length), _ = m > 0 ? 2 * Re + m * Ve + (m - 1) * ze : Le, { hoveredRef: y, tooltip: b, hitZonesRef: C } = D(r, {
956
- width: _,
957
- height: W
1055
+ var Ne = 780, Pe = 240, Fe = 12, Ie = 10, Le = 5;
1056
+ function Re({ items: e = [], onItemClick: r, testID: o }) {
1057
+ let [l, d] = ee(Ne), f = a(null), m = a(0), h = a(/* @__PURE__ */ new Map()), v = [...i(() => e.filter((e) => typeof e == "object" && !!e), [e])].sort((e, t) => (t.count ?? 0) - (e.count ?? 0)).slice(0, 5), b = v.reduce((e, t) => e + (t.count ?? 0), 0), x = a(v);
1058
+ x.current = v;
1059
+ let w = t((e, t) => {
1060
+ let n = typeof t == "object" ? t.label ?? e : e, i = x.current.find((t) => t.id === e);
1061
+ r?.(e, n, i?.subentity);
1062
+ }, [r]), E = Math.min(Le, v.length), k = E > 0 ? (d - 2 * Fe - (E - 1) * Ie) / E : (d - 2 * Fe) / Le, { hoveredRef: j, tooltip: M, hitZonesRef: N } = O(f, {
1063
+ width: d,
1064
+ height: Pe,
1065
+ onClick: r ? w : void 0
958
1066
  });
959
1067
  return n(() => {
960
- let e = r.current;
1068
+ let e = f.current;
961
1069
  if (!e) return;
962
- let t = x(e, _, W);
963
- o.current = 0;
964
- let n = Ve, i = W * .84, a = W * .08, s = Re, c, m = () => {
965
- o.current++;
966
- let e = o.current;
967
- t.clearRect(0, 0, _, W), t.letterSpacing = h.letterSpacing, C.current = [], l.current.forEach((e, t) => {
968
- let n = t === y.current ? 1 : 0, r = e + (n - e) * .12;
969
- Math.abs(r - n) < .005 ? n === 0 ? l.current.delete(t) : l.current.set(t, 1) : l.current.set(t, r);
970
- }), y.current && !l.current.has(y.current) && l.current.set(y.current, 0), d.forEach((r, o) => {
971
- let c = o === 0, d = o === 0 ? u.red : o === 1 ? u.amber : p[o % p.length], m = s + o * (n + ze), h = l.current.get(r.id) ?? 0, _ = h * 8, y = m - _ / 2, b = n + _, x = c ? P(e, .04, 3e-4) * .06 + .06 : 0;
972
- t.fillStyle = v(d, .08 + h * .07), t.beginPath(), t.roundRect(y, a, b, i, 6), t.fill(), t.strokeStyle = v(d, .2 + h * .4 + x), t.lineWidth = c ? 1.5 : 1, t.stroke(), (h > .01 || c) && S(t, y + b / 2, a + i / 2, b * .55, d, x + h * .14), t.font = g.font, t.textAlign = "left", t.textBaseline = "top", t.fillStyle = v(d, .5 + h * .35), t.fillText(`#${o + 1}`, y + 7, a + 6);
973
- let w = Math.min(n * .28, i * .32, 72), T = y + b / 2, E = a + i * .38, D = t.createRadialGradient(T, E - w * .2, 0, T, E, w);
974
- D.addColorStop(0, v(d, .5 + h * .2)), D.addColorStop(1, v(d, .2 + h * .1)), t.beginPath(), t.arc(T, E, w, 0, Math.PI * 2), t.fillStyle = D, t.fill(), t.strokeStyle = v(d, .4 + h * .3), t.lineWidth = 1, t.stroke(), t.font = g.font, t.textAlign = "center", t.textBaseline = "middle", t.fillStyle = v(u.t1, .9);
975
- let O = r.abbreviation ?? r.name ?? "", A = w * 1.7, j = O;
976
- for (; t.measureText(j).width > A && j.length > 1;) j = j.slice(0, -1);
977
- j !== O && (j = j.slice(0, -1) + "…"), t.fillText(j, T, E);
978
- let M = r.count == null ? null : z(r.count), N = r.label ?? M;
979
- if (N) {
980
- t.font = g.font, t.textBaseline = "alphabetic", t.fillStyle = v(d, .9 + h * .1);
981
- let e = b - 16, n = N;
982
- for (; t.measureText(n).width > e && n.length > 1;) n = n.slice(0, -1);
983
- n !== N && (n = n.slice(0, -1) + "…"), t.fillText(n, T, a + i * .74);
1070
+ let t = S(e, d, Pe);
1071
+ m.current = 0;
1072
+ let n = Pe * .84, r = Pe * .08, i = Fe, a, o = () => {
1073
+ m.current++;
1074
+ let e = m.current;
1075
+ t.clearRect(0, 0, d, Pe), t.letterSpacing = g.letterSpacing, N.current = [], h.current.forEach((e, t) => {
1076
+ let n = t === j.current ? 1 : 0, r = e + (n - e) * .12;
1077
+ Math.abs(r - n) < .005 ? n === 0 ? h.current.delete(t) : h.current.set(t, 1) : h.current.set(t, r);
1078
+ }), j.current && !h.current.has(j.current) && h.current.set(j.current, 0), v.forEach((a, o) => {
1079
+ let s = o === 0, c = o === 0 ? u.red : o === 1 ? u.amber : p[o % p.length], l = i + o * (k + Ie), d = h.current.get(a.id) ?? 0, f = d * 8, m = l - f / 2, g = k + f, v = s ? F(e, .04, 3e-4) * .06 + .06 : 0;
1080
+ t.fillStyle = y(c, .08 + d * .07), t.beginPath(), t.roundRect(m, r, g, n, 6), t.fill(), t.strokeStyle = y(c, .2 + d * .4 + v), t.lineWidth = s ? 1.5 : 1, t.stroke(), (d > .01 || s) && C(t, m + g / 2, r + n / 2, g * .55, c, v + d * .14), t.font = _.font, t.textAlign = "left", t.textBaseline = "top", t.fillStyle = y(c, .5 + d * .35), t.fillText(`#${o + 1}`, m + 7, r + 6);
1081
+ let x = Math.min(k * .28, n * .32, 72), S = m + g / 2, w = r + n * .38, T = t.createRadialGradient(S, w - x * .2, 0, S, w, x);
1082
+ T.addColorStop(0, y(c, .5 + d * .2)), T.addColorStop(1, y(c, .2 + d * .1)), t.beginPath(), t.arc(S, w, x, 0, Math.PI * 2), t.fillStyle = T, t.fill(), t.strokeStyle = y(c, .4 + d * .3), t.lineWidth = 1, t.stroke(), t.font = _.font, t.textAlign = "center", t.textBaseline = "middle", t.fillStyle = y(u.t1, .9);
1083
+ let E = a.abbreviation ?? a.name ?? "", D = x * 1.7, O = E;
1084
+ for (; t.measureText(O).width > D && O.length > 1;) O = O.slice(0, -1);
1085
+ O !== E && (O = O.slice(0, -1) + "…"), t.fillText(O, S, w);
1086
+ let j = a.count == null ? null : K(a.count), M = a.label ?? j;
1087
+ if (M) {
1088
+ t.font = _.font, t.textBaseline = "alphabetic", t.fillStyle = y(c, .9 + d * .1);
1089
+ let e = g - 16, i = M;
1090
+ for (; t.measureText(i).width > e && i.length > 1;) i = i.slice(0, -1);
1091
+ i !== M && (i = i.slice(0, -1) + "…"), t.fillText(i, S, r + n * .74);
984
1092
  }
985
- let F = Math.round((r.count ?? 0) / (f || 1) * 100);
986
- k(C.current, r.id, m, a, n, i, {
987
- label: r.name,
988
- value: `${N} · ${F}% of total`,
1093
+ let P = Math.round((a.count ?? 0) / (b || 1) * 100);
1094
+ A(N.current, a.id, l, r, k, n, {
1095
+ label: a.name,
1096
+ value: `${M} · ${P}% of total`,
989
1097
  sublabel: `Rank #${o + 1}`,
990
- color: d
1098
+ color: c
991
1099
  });
992
- }), w(t, _, W, e, .015), c = requestAnimationFrame(m);
1100
+ }), T(t, d, Pe, e, .015), a = requestAnimationFrame(o);
993
1101
  };
994
- return m(), () => cancelAnimationFrame(c);
1102
+ return o(), () => cancelAnimationFrame(a);
995
1103
  }, [
996
- d,
997
- f,
998
- _
999
- ]), d.length === 0 ? /* @__PURE__ */ s(R, {
1000
- width: _,
1001
- height: W,
1002
- "data-testid": t
1104
+ v,
1105
+ b,
1106
+ d
1107
+ ]), v.length === 0 ? /* @__PURE__ */ s(G, {
1108
+ width: d,
1109
+ height: Pe,
1110
+ testID: o
1003
1111
  }) : /* @__PURE__ */ c("div", {
1004
- "data-testid": t,
1112
+ "data-testid": o,
1005
1113
  style: {
1006
1114
  position: "relative",
1007
- width: _,
1008
- height: W
1115
+ width: d,
1116
+ height: Pe
1009
1117
  },
1010
1118
  children: [/* @__PURE__ */ s("canvas", {
1011
- ref: r,
1119
+ ref: f,
1012
1120
  role: "img",
1013
1121
  "aria-label": "Contractor rank — open EW count per contractor",
1014
1122
  style: {
1015
- width: _,
1016
- height: W,
1123
+ width: d,
1124
+ height: Pe,
1017
1125
  display: "block",
1018
1126
  borderRadius: 8
1019
1127
  }
1020
- }), /* @__PURE__ */ s(E, {
1021
- ...b,
1022
- parentW: _,
1023
- parentH: W
1128
+ }), /* @__PURE__ */ s(D, {
1129
+ ...M,
1130
+ parentW: d,
1131
+ parentH: Pe
1024
1132
  })]
1025
1133
  });
1026
1134
  }
1027
1135
  //#endregion
1028
1136
  //#region src/components/dotMatrixChart/DotMatrixChart.tsx
1029
- var G = 680, K = 260;
1030
- function Ue({ items: e = [], "data-testid": t }) {
1031
- let r = a(null), o = a(0), l = a(/* @__PURE__ */ new Map()), { hoveredRef: d, tooltip: f, hitZonesRef: p } = D(r, {
1032
- width: G,
1033
- height: K
1137
+ var ze = 680, Be = 260;
1138
+ function Ve({ items: e = [], testID: t }) {
1139
+ let r = a(null), o = a(0), l = a(/* @__PURE__ */ new Map()), { hoveredRef: d, tooltip: f, hitZonesRef: p } = O(r, {
1140
+ width: ze,
1141
+ height: Be
1034
1142
  }), m = i(() => e.filter((e) => typeof e == "object" && !!e), [e]);
1035
1143
  return n(() => {
1036
1144
  let e = r.current;
1037
1145
  if (!e) return;
1038
- let t = x(e, G, K);
1146
+ let t = S(e, ze, Be);
1039
1147
  o.current = 0;
1040
- let n = m.length, i = Math.max(...m.map((e) => e.count), 1), a = i, s = G * .05, c = K * .1, f = G * .9 / n, g = K * .7 / a, _ = m.reduce((e, t) => e + t.count, 0), y, b = () => {
1148
+ let n = m.length, i = Math.max(...m.map((e) => e.count), 1), a = i, s = ze * .05, c = Be * .1, f = ze * .9 / n, h = Be * .7 / a, _ = m.reduce((e, t) => e + t.count, 0), v, b = () => {
1041
1149
  o.current++;
1042
1150
  let e = o.current;
1043
- t.clearRect(0, 0, G, K), p.current = [], l.current.forEach((e, t) => {
1151
+ t.clearRect(0, 0, ze, Be), p.current = [], l.current.forEach((e, t) => {
1044
1152
  let n = t === d.current ? 1 : 0, r = e + (n - e) * .12;
1045
1153
  Math.abs(r - n) < .005 ? n === 0 ? l.current.delete(t) : l.current.set(t, 1) : l.current.set(t, r);
1046
- }), d.current && !l.current.has(d.current) && l.current.set(d.current, 0), C(t, G, K, e, 40, v(u.blue, .04)), m.forEach((n, r) => {
1154
+ }), d.current && !l.current.has(d.current) && l.current.set(d.current, 0), w(t, ze, Be, e, 40, y(u.blue, .04)), m.forEach((n, r) => {
1047
1155
  let o = n.count === i, d = u.blue, m = l.current.get(`${n.category}-col`) ?? 0;
1048
1156
  for (let u = 0; u < a; u++) {
1049
- let a = s + r * f + f / 2, h = c + u * g + g / 2, y = Math.min(f, g) * .38;
1157
+ let a = s + r * f + f / 2, g = c + u * h + h / 2, v = Math.min(f, h) * .38;
1050
1158
  if (u >= i - n.count) {
1051
- let i = y * (1 + (P(e, .04, 5e-4) + Math.sin(r * .6 + u * 1.2) * .3) * .12);
1052
- (o || m > .01) && S(t, a, h, i * 3, d, (o ? .2 : .1) + m * .1), t.beginPath(), t.arc(a, h, i, 0, Math.PI * 2), t.fillStyle = v(d, o ? .8 : .5 + m * .2), t.fill();
1159
+ let i = v * (1 + (F(e, .04, 5e-4) + Math.sin(r * .6 + u * 1.2) * .3) * .12);
1160
+ (o || m > .01) && C(t, a, g, i * 3, d, (o ? .2 : .1) + m * .1), t.beginPath(), t.arc(a, g, i, 0, Math.PI * 2), t.fillStyle = y(d, o ? .8 : .5 + m * .2), t.fill();
1053
1161
  let s = `${n.category}-${u}`;
1054
- O(p.current, s, a, h, y + 4, {
1162
+ k(p.current, s, a, g, v + 4, {
1055
1163
  label: n.fullName,
1056
1164
  value: `${n.count} Early Warnings`,
1057
1165
  sublabel: `${Math.round(n.count / _ * 100)}% of total`,
1058
1166
  color: d
1059
1167
  }), l.current.get(`${n.category}-col`);
1060
- } else t.beginPath(), t.arc(a, h, 1, 0, Math.PI * 2), t.fillStyle = v(d, .08), t.fill();
1168
+ } else t.beginPath(), t.arc(a, g, 1, 0, Math.PI * 2), t.fillStyle = y(d, .08), t.fill();
1061
1169
  }
1062
- let y = c + a * g + 16;
1063
- t.font = h.font, t.textAlign = "center", t.textBaseline = "alphabetic", t.fillStyle = o ? u.blue : v(u.t2, .65), t.fillText(n.category, s + r * f + f / 2, y);
1064
- }), w(t, G, K, e, .015), y = requestAnimationFrame(b);
1170
+ let v = c + a * h + 16;
1171
+ t.font = g.font, t.textAlign = "center", t.textBaseline = "alphabetic", t.fillStyle = o ? u.blue : y(u.t2, .65), t.fillText(n.category, s + r * f + f / 2, v);
1172
+ }), T(t, ze, Be, e, .015), v = requestAnimationFrame(b);
1065
1173
  };
1066
- return b(), () => cancelAnimationFrame(y);
1067
- }, [m]), m.length === 0 ? /* @__PURE__ */ s(R, {
1068
- width: G,
1069
- height: K,
1070
- "data-testid": t
1174
+ return b(), () => cancelAnimationFrame(v);
1175
+ }, [m]), m.length === 0 ? /* @__PURE__ */ s(G, {
1176
+ width: ze,
1177
+ height: Be,
1178
+ testID: t
1071
1179
  }) : /* @__PURE__ */ c("div", {
1072
1180
  "data-testid": t,
1073
1181
  style: {
1074
1182
  position: "relative",
1075
- width: G,
1076
- height: K
1183
+ width: ze,
1184
+ height: Be
1077
1185
  },
1078
1186
  children: [/* @__PURE__ */ s("canvas", {
1079
1187
  ref: r,
1080
1188
  role: "img",
1081
1189
  "aria-label": "Early Warning count by category — breathing dot grid",
1082
1190
  style: {
1083
- width: G,
1084
- height: K,
1191
+ width: ze,
1192
+ height: Be,
1085
1193
  display: "block",
1086
1194
  borderRadius: 8
1087
1195
  }
1088
- }), /* @__PURE__ */ s(E, {
1196
+ }), /* @__PURE__ */ s(D, {
1089
1197
  ...f,
1090
- parentW: G,
1091
- parentH: K
1198
+ parentW: ze,
1199
+ parentH: Be
1092
1200
  })]
1093
1201
  });
1094
1202
  }
1095
1203
  //#endregion
1096
1204
  //#region src/components/lineChart/LineChart.tsx
1097
- function We({ rows: e = [], className: t, colors: n }) {
1098
- return /* @__PURE__ */ s(te, {
1205
+ function He({ rows: e = [], className: t, colors: n }) {
1206
+ return /* @__PURE__ */ s(B, {
1099
1207
  rows: e,
1100
1208
  variant: "line",
1101
1209
  className: t,
@@ -1103,8 +1211,33 @@ function We({ rows: e = [], className: t, colors: n }) {
1103
1211
  });
1104
1212
  }
1105
1213
  //#endregion
1106
- //#region src/components/constants.ts
1107
- var Ge = [
1214
+ //#region src/constants.ts
1215
+ var Y = {
1216
+ LINE: "line",
1217
+ AREA: "area",
1218
+ BAR: "bar",
1219
+ PIE: "pie",
1220
+ DONUT: "donut",
1221
+ SANKEY: "sankey",
1222
+ FLOW: "flow",
1223
+ TREND: "trend",
1224
+ MINI_BARS: "mini-bars",
1225
+ STACKED_HORIZONTAL_BAR: "stacked-horizontal-bar-chart",
1226
+ MULTI_METRIC_CONSTELLATION: "multi-metric-constellation-chart",
1227
+ PROGRESS_RACE: "progress-race-chart",
1228
+ HUB_AND_SPOKE_RADIAL: "hub-and-spoke-radial-chart",
1229
+ DOT_MATRIX: "dot-matrix-chart",
1230
+ RANKED_CARD_LEADERBOARD: "ranked-card-leaderboard",
1231
+ PROPORTIONAL_BAND: "proportional-band-chart",
1232
+ RADIAL_FAN_TREE: "radial-fan-tree-chart",
1233
+ SEMI_CIRCULAR_GAUGE: "semi-circular-gauge-chart",
1234
+ SEGMENTED_SPLIT_BAR: "segmented-split-bar-chart",
1235
+ BALANCE_SCALE: "balance-scale-chart",
1236
+ AREA_LINE: "area-line-chart",
1237
+ TREND_VIEW: "trend-view",
1238
+ WEEKLY_FLOW: "weekly-flow",
1239
+ HORIZONTAL_BAR: "horizontal-bar-chart"
1240
+ }, Ue = [
1108
1241
  "#4C93D9",
1109
1242
  "#5DA537",
1110
1243
  "#F3862C",
@@ -1112,7 +1245,7 @@ var Ge = [
1112
1245
  "#A0B724",
1113
1246
  "#EEBF3B",
1114
1247
  "#3C45D1"
1115
- ], Ke = {
1248
+ ], We = {
1116
1249
  nodes: [
1117
1250
  {
1118
1251
  id: "supplier-x",
@@ -1155,8 +1288,8 @@ var Ge = [
1155
1288
  };
1156
1289
  //#endregion
1157
1290
  //#region src/components/miniBars/MiniBars.tsx
1158
- function qe({ rows: e = [], className: t, colors: n }) {
1159
- let r = n?.slices ?? Ge;
1291
+ function Ge({ rows: e = [], className: t, colors: n }) {
1292
+ let r = n?.slices ?? Ue;
1160
1293
  return /* @__PURE__ */ s("div", {
1161
1294
  className: ["d3-mini-bars", t].filter(Boolean).join(" "),
1162
1295
  children: e.map(([e, t, n], i) => /* @__PURE__ */ c("div", {
@@ -1182,7 +1315,7 @@ function qe({ rows: e = [], className: t, colors: n }) {
1182
1315
  width: Math.max(0, Math.min(100, t)),
1183
1316
  height: "12",
1184
1317
  rx: "6",
1185
- className: `d3-mini-fill tone-${i % Ge.length}`,
1318
+ className: `d3-mini-fill tone-${i % Ue.length}`,
1186
1319
  fill: r[i % r.length]
1187
1320
  })]
1188
1321
  })
@@ -1194,137 +1327,152 @@ function qe({ rows: e = [], className: t, colors: n }) {
1194
1327
  }
1195
1328
  //#endregion
1196
1329
  //#region src/components/radialFanTreeChart/RadialFanTreeChart.tsx
1197
- var Je = 770, Ye = 320, Xe = 60, Ze = 28;
1198
- function Qe({ total: e = 0, totalLabel: t, items: r = [], width: o = Je, colorOffset: l = 0, "data-testid": d }) {
1199
- let f = a(null), p = a(/* @__PURE__ */ new Map()), _ = a(0), y = i(() => r.filter((e) => typeof e == "object" && !!e), [r]), b = i(() => Math.max(Ye, Xe + Math.max(0, y.length - 1) * Ze), [y.length]), C = b, { hoveredRef: w, tooltip: T, hitZonesRef: k } = D(f, {
1200
- width: o,
1201
- height: b
1330
+ var Ke = 770, qe = 320, Je = 60, Ye = 28;
1331
+ function Xe({ total: e = 0, totalLabel: r, items: o = [], dataByEntity: l, onItemClick: d, selectedId: f, colorOffset: p = 0, testID: m }) {
1332
+ let [v, b] = ee(Ke), x = a(null), w = a(/* @__PURE__ */ new Map()), T = a(0), E = a(f);
1333
+ E.current = f;
1334
+ let A = a([]), M = t((e, t) => {
1335
+ if (e === "__root__") return;
1336
+ let n = typeof t == "object" ? t.label ?? e : e, r = A.current.find((t) => t.id === e);
1337
+ d?.(e, n, r?.subentity);
1338
+ }, [d]), N = !!(f && l?.[f]), P = N ? l[f] : null, F = P ? P.total : e, R = P ? P.totalLabel : r, z = P ? P.items : o, B = i(() => z.filter((e) => typeof e == "object" && !!e), [z]);
1339
+ A.current = B;
1340
+ let V = i(() => Math.max(qe, Je + Math.max(0, B.length - 1) * Ye), [B.length]), H = V, { hoveredRef: U, tooltip: W, hitZonesRef: te } = O(x, {
1341
+ width: b,
1342
+ height: V,
1343
+ onClick: d ? M : void 0
1202
1344
  });
1203
1345
  return n(() => {
1204
- let n = f.current;
1205
- if (!n) return;
1206
- let r = x(n, o, C);
1207
- _.current = 0;
1208
- let i = b / 2, a = o - 200, s = Math.max(...y.map((e) => e.count ?? 0), 1), c = y.length > 1 ? (b - 60) / (y.length - 1) : 0, d = a + 22 + 10, T = y.map((e, t) => ({
1209
- x: a,
1210
- y: 30 + t * c
1211
- })), E, D = () => {
1212
- _.current++;
1213
- let n = _.current;
1214
- r.clearRect(0, 0, o, C), r.letterSpacing = h.letterSpacing;
1215
- let c = A(Math.min(n / 72, 1));
1216
- I(p.current, w.current), k.current = [];
1217
- let f = m[l % m.length], b = 120 + 60 * Math.min(1, c * 2.5), x = r.createLinearGradient(120, 0, b, 0);
1218
- x.addColorStop(0, v(f, .8)), x.addColorStop(1, v(f, .7)), r.beginPath(), r.moveTo(120, i), r.lineTo(b, i), r.strokeStyle = x, r.lineWidth = 1.33, r.stroke(), y.forEach((t, n) => {
1219
- let o = F(c, n, y.length, A), l = T[n], m = p.current.get(t.id) ?? 0;
1220
- if (o < .01) return;
1221
- let _ = 180 + (a - 180) * .35, b = i, x = 180 + (a - 180) * .65, C = l.y;
1222
- r.beginPath();
1346
+ let e = x.current;
1347
+ if (!e) return;
1348
+ let t = S(e, b, H);
1349
+ T.current = 0;
1350
+ let n = V / 2, r = b - 140, i = Math.max(...B.map((e) => e.count ?? 0), 1), a = B.length > 1 ? (V - 60) / (B.length - 1) : 60, o = Math.min(22, a / 2 - 3), s = Math.min(8, Math.max(3, o - 6)), c = r + o + 10, l = B.map((e, t) => ({
1351
+ x: r,
1352
+ y: 30 + t * a
1353
+ })), d, f = () => {
1354
+ T.current++;
1355
+ let e = T.current;
1356
+ t.clearRect(0, 0, b, H), t.letterSpacing = g.letterSpacing;
1357
+ let a = j(Math.min(e / 72, 1));
1358
+ L(w.current, U.current), te.current = [];
1359
+ let m = h[p % h.length], v = 100 + 60 * Math.min(1, a * 2.5), x = t.createLinearGradient(100, 0, v, 0);
1360
+ x.addColorStop(0, y(m, .8)), x.addColorStop(1, y(m, .7)), t.beginPath(), t.moveTo(100, n), t.lineTo(v, n), t.strokeStyle = x, t.lineWidth = 1.33, t.stroke(), B.forEach((e, d) => {
1361
+ let f = I(a, d, B.length, j), p = l[d], h = w.current.get(e.id) ?? 0, v = !N && E.current && e.id !== E.current ? .6 : 1;
1362
+ if (f < .01) return;
1363
+ let x = 160 + (r - 160) * .35, S = n, T = 160 + (r - 160) * .65, D = p.y;
1364
+ t.beginPath();
1223
1365
  for (let e = 0; e <= 40; e++) {
1224
- let t = e / 40 * o, n = (1 - t) ** 3 * 180 + 3 * (1 - t) ** 2 * t * _ + 3 * (1 - t) * t ** 2 * x + t ** 3 * l.x, a = (1 - t) ** 3 * i + 3 * (1 - t) ** 2 * t * b + 3 * (1 - t) * t ** 2 * C + t ** 3 * l.y;
1225
- e === 0 ? r.moveTo(n, a) : r.lineTo(n, a);
1366
+ let r = e / 40 * f, i = (1 - r) ** 3 * 160 + 3 * (1 - r) ** 2 * r * x + 3 * (1 - r) * r ** 2 * T + r ** 3 * p.x, a = (1 - r) ** 3 * n + 3 * (1 - r) ** 2 * r * S + 3 * (1 - r) * r ** 2 * D + r ** 3 * p.y;
1367
+ e === 0 ? t.moveTo(i, a) : t.lineTo(i, a);
1226
1368
  }
1227
- let w = r.createLinearGradient(180, i, l.x, l.y);
1228
- if (w.addColorStop(0, v(f, m > 0 ? 1 : .8)), w.addColorStop(1, v(f, m > 0 ? 1 : .7)), r.strokeStyle = w, r.lineWidth = m > 0 ? 2 : 1.33, r.stroke(), o > .85) {
1229
- let n = Math.min(1, (o - .85) / .15), i = 8 + (t.count ?? 0) / s * 14;
1230
- S(r, l.x, l.y, i * 2, f, (.2 + m * .2) * n), r.beginPath(), r.arc(l.x, l.y, i * n, 0, Math.PI * 2), r.fillStyle = v(f, n), r.fill();
1231
- let a = z(t.count ?? 0);
1232
- O(k.current, t.id, l.x, l.y, i + 8, {
1233
- label: t.name,
1369
+ let O = t.createLinearGradient(160, n, p.x, p.y);
1370
+ if (O.addColorStop(0, y(m, (h > 0 ? 1 : .8) * v)), O.addColorStop(1, y(m, (h > 0 ? 1 : .7) * v)), t.strokeStyle = O, t.lineWidth = h > 0 ? 2 : 1.33, t.stroke(), f > .85) {
1371
+ let n = Math.min(1, (f - .85) / .15), r = s + (e.count ?? 0) / i * (o - s);
1372
+ C(t, p.x, p.y, r * 2, m, (.2 + h * .2) * n * v), t.beginPath(), t.arc(p.x, p.y, r * n, 0, Math.PI * 2), t.fillStyle = y(m, n * v), t.fill();
1373
+ let a = K(e.count ?? 0);
1374
+ k(te.current, e.id, p.x, p.y, r + 8, {
1375
+ label: e.name,
1234
1376
  value: a,
1235
- sublabel: `${Math.round((t.count ?? 0) / (e || 1) * 100)}% of total`,
1236
- color: f
1237
- }), r.globalAlpha = n, r.font = h.font, r.textAlign = "left";
1238
- let c = t.abbreviation ?? t.name?.slice(0, 6) ?? "", p = ` ${z(t.count ?? 0)}`, _ = l.y + 4;
1239
- r.fillStyle = m > 0 ? f : v(u.t2, .85), r.fillText(c, d, _);
1240
- let y = r.measureText(c).width;
1241
- r.font = g.font, r.fillStyle = m > 0 ? f : u.t1, r.fillText(p, d + y, _), r.globalAlpha = 1;
1377
+ sublabel: `${Math.round((e.count ?? 0) / (F || 1) * 100)}% of total`,
1378
+ color: m
1379
+ }, b), t.globalAlpha = n * v, t.font = g.font, t.textAlign = "left";
1380
+ let l = e.abbreviation ?? e.name?.slice(0, 6) ?? "", d = ` ${K(e.count ?? 0)}`, x = p.y + 4;
1381
+ t.fillStyle = h > 0 ? m : y(u.t2, .85), t.fillText(l, c, x);
1382
+ let S = t.measureText(l).width;
1383
+ t.font = _.font, t.fillStyle = h > 0 ? m : u.t1, t.fillText(d, c + S, x), t.globalAlpha = 1;
1242
1384
  }
1243
1385
  });
1244
- let j = 32 * c, M = r.createRadialGradient(88, i, 0, 88, i, j);
1245
- if (M.addColorStop(0, v(f, .02 * c)), M.addColorStop(.55, v(f, .02 * c)), M.addColorStop(1, v(f, .15 * c)), r.beginPath(), r.arc(88, i, j, 0, Math.PI * 2), r.fillStyle = M, r.fill(), r.beginPath(), r.arc(88, i, j, 0, Math.PI * 2), r.strokeStyle = v(f, .8 * c), r.lineWidth = 1, r.stroke(), c > .4) {
1246
- r.globalAlpha = Math.min(1, (c - .4) / .4);
1247
- let n = t ?? z(e, 0);
1248
- r.font = "500 16px 'Satoshi Variable', 'DM Sans', sans-serif";
1249
- let a = n;
1250
- for (; r.measureText(a).width > 54.4 && a.length > 1;) a = a.slice(0, -1);
1251
- a !== n && (a = a.slice(0, -1) + "…"), r.fillStyle = u.t1, r.textAlign = "center", r.textBaseline = "middle", r.fillText(a, 88, i), r.textBaseline = "alphabetic", r.globalAlpha = 1;
1386
+ let S = 40 * a, D = t.createRadialGradient(60, n, 0, 60, n, S);
1387
+ if (D.addColorStop(0, y(m, .02 * a)), D.addColorStop(.55, y(m, .02 * a)), D.addColorStop(1, y(m, .15 * a)), t.beginPath(), t.arc(60, n, S, 0, Math.PI * 2), t.fillStyle = D, t.fill(), t.beginPath(), t.arc(60, n, S, 0, Math.PI * 2), t.strokeStyle = y(m, .8 * a), t.lineWidth = 1, t.stroke(), a > .4) {
1388
+ t.globalAlpha = Math.min(1, (a - .4) / .4);
1389
+ let e = R ?? K(F, 0);
1390
+ t.font = "500 16px 'Satoshi Variable', 'DM Sans', sans-serif";
1391
+ let r = e;
1392
+ for (; t.measureText(r).width > 68 && r.length > 1;) r = r.slice(0, -1);
1393
+ r !== e && (r = r.slice(0, -1) + "…"), t.fillStyle = u.t1, t.textAlign = "center", t.textBaseline = "middle", t.fillText(r, 60, n), t.textBaseline = "alphabetic", t.globalAlpha = 1;
1252
1394
  }
1253
- O(k.current, "__root__", 88, i, 32, {
1254
- label: t ?? "Total",
1255
- value: z(e, 0),
1256
- sublabel: `${y.length} items`,
1257
- color: f
1258
- }), E = requestAnimationFrame(D);
1395
+ k(te.current, "__root__", 60, n, 40, {
1396
+ label: R ?? "Total",
1397
+ value: K(F, 0),
1398
+ sublabel: `${B.length} items`,
1399
+ color: m
1400
+ }), d = requestAnimationFrame(f);
1259
1401
  };
1260
- return D(), () => cancelAnimationFrame(E);
1402
+ return f(), () => cancelAnimationFrame(d);
1261
1403
  }, [
1262
- e,
1263
- t,
1264
- y,
1404
+ F,
1405
+ R,
1406
+ B,
1407
+ V,
1265
1408
  b,
1266
- o
1267
- ]), y.length === 0 ? /* @__PURE__ */ s(R, {
1268
- width: o,
1269
- height: Ye,
1270
- "data-testid": d
1409
+ N
1410
+ ]), B.length === 0 ? /* @__PURE__ */ s("div", {
1411
+ ref: v,
1412
+ style: { width: "100%" },
1413
+ children: /* @__PURE__ */ s(G, {
1414
+ width: b,
1415
+ height: qe,
1416
+ testID: m
1417
+ })
1271
1418
  }) : /* @__PURE__ */ c("div", {
1272
- "data-testid": d,
1419
+ ref: v,
1420
+ "data-testid": m,
1273
1421
  style: {
1274
1422
  position: "relative",
1275
- width: o,
1276
- height: C
1423
+ width: "100%",
1424
+ height: H
1277
1425
  },
1278
1426
  children: [/* @__PURE__ */ s("canvas", {
1279
- ref: f,
1427
+ ref: x,
1280
1428
  role: "img",
1281
1429
  "aria-label": "NCE fault tree — NCEs per contractor as branching tree",
1282
1430
  style: {
1283
- width: o,
1284
- height: C,
1431
+ width: "100%",
1432
+ height: H,
1285
1433
  display: "block"
1286
1434
  }
1287
- }), /* @__PURE__ */ s(E, {
1288
- ...T,
1289
- parentW: o,
1290
- parentH: C
1435
+ }), /* @__PURE__ */ s(D, {
1436
+ ...W,
1437
+ parentW: b,
1438
+ parentH: H
1291
1439
  })]
1292
1440
  });
1293
1441
  }
1294
1442
  //#endregion
1295
1443
  //#region src/components/pieChart/PieChart.tsx
1296
- var $e = 192, et = $e, tt = $e + 80;
1297
- function nt({ rows: e = [], variant: t, className: r, colors: i }) {
1298
- let o = a(null), d = a(/* @__PURE__ */ new Map()), f = a(0), m = i?.slices ?? p, { hoveredRef: h, tooltip: g, hitZonesRef: _ } = D(o, {
1299
- width: et,
1300
- height: tt
1444
+ var Ze = 192, Qe = Ze, $e = Ze + 80;
1445
+ function et({ rows: e = [], variant: t, className: r, colors: i }) {
1446
+ let o = a(null), d = a(/* @__PURE__ */ new Map()), f = a(0), m = i?.slices ?? p, { hoveredRef: h, tooltip: g, hitZonesRef: _ } = O(o, {
1447
+ width: Qe,
1448
+ height: $e
1301
1449
  });
1302
1450
  return n(() => {
1303
1451
  let n = o.current;
1304
1452
  if (!n) return;
1305
- let r = x(n, et, tt);
1453
+ let r = S(n, Qe, $e);
1306
1454
  f.current = 0;
1307
- let i = et / 2, a = $e / 2, s = $e * .4, c = t === "donut" ? $e * .21 : 0, l = e.reduce((e, t) => e + (t.pricing ?? 0), 0) || 1, p, g = () => {
1455
+ let i = Qe / 2, a = Ze / 2, s = Ze * .4, c = t === "donut" ? Ze * .21 : 0, l = e.reduce((e, t) => e + (t.pricing ?? 0), 0) || 1, p, g = () => {
1308
1456
  f.current++;
1309
1457
  let n = f.current;
1310
- r.clearRect(0, 0, et, tt);
1458
+ r.clearRect(0, 0, Qe, $e);
1311
1459
  let o = 1 - (1 - Math.min(n / 48, 1)) ** 3;
1312
- I(d.current, h.current), _.current = [];
1313
- let y = -Math.PI / 2;
1460
+ L(d.current, h.current), _.current = [];
1461
+ let v = -Math.PI / 2;
1314
1462
  e.forEach((e, t) => {
1315
- let f = (e.pricing ?? 0) / l, p = f * Math.PI * 2 * o, h = y + p, g = m[t % m.length], b = d.current.get(e.id ?? `sl-${t}`) ?? 0, x = y + p / 2, C = (s + c) / 2, w = i + Math.cos(x) * C, T = a + Math.sin(x) * C, E = (s - c) / 2 + 8;
1316
- O(_.current, e.id ?? `sl-${t}`, w, T, E, {
1463
+ let f = (e.pricing ?? 0) / l, p = f * Math.PI * 2 * o, h = v + p, g = m[t % m.length], b = d.current.get(e.id ?? `sl-${t}`) ?? 0, x = v + p / 2, S = (s + c) / 2, w = i + Math.cos(x) * S, T = a + Math.sin(x) * S, E = (s - c) / 2 + 8;
1464
+ k(_.current, e.id ?? `sl-${t}`, w, T, E, {
1317
1465
  label: e.vendor,
1318
1466
  value: `${e.pricing ?? 0} (${Math.round(f * 100)}%)`,
1319
1467
  color: g
1320
- }), b > 0 && S(r, w, T, E * 2 * b, g, .2 * b);
1321
- let D = P(n, .03, 3e-4), k = s + b * 6 + (b > 0 ? D * 2 : 0);
1322
- r.beginPath(), r.moveTo(i + Math.cos(y) * c, a + Math.sin(y) * c), r.arc(i, a, k, y, h), c > 0 ? r.arc(i, a, c, h, y, !0) : r.lineTo(i, a), r.closePath(), r.fillStyle = v(g, .7 + b * .2), r.fill(), r.strokeStyle = v(u.bg, .8), r.lineWidth = 1.5, r.stroke(), y = h;
1323
- }), t === "donut" && e.length > 0 && S(r, i, a, c * .8, u.blue, .06);
1324
- let x = $e + 12;
1468
+ }), b > 0 && C(r, w, T, E * 2 * b, g, .2 * b);
1469
+ let D = F(n, .03, 3e-4), O = s + b * 6 + (b > 0 ? D * 2 : 0);
1470
+ r.beginPath(), r.moveTo(i + Math.cos(v) * c, a + Math.sin(v) * c), r.arc(i, a, O, v, h), c > 0 ? r.arc(i, a, c, h, v, !0) : r.lineTo(i, a), r.closePath(), r.fillStyle = y(g, .7 + b * .2), r.fill(), r.strokeStyle = y(u.bg, .8), r.lineWidth = 1.5, r.stroke(), v = h;
1471
+ }), t === "donut" && e.length > 0 && C(r, i, a, c * .8, u.blue, .06);
1472
+ let b = Ze + 12;
1325
1473
  e.forEach((e, t) => {
1326
- let n = m[t % m.length], i = (e.pricing ?? 0) / l, a = d.current.get(e.id ?? `sl-${t}`) ?? 0, o = x + t * 18;
1327
- r.fillStyle = v(n, .8 + a * .2), r.fillRect(4, o - 6, 12, 12), r.font = "9px 'JetBrains Mono', monospace", r.fillStyle = v(u.t2, .7 + a * .2), r.textAlign = "left", r.fillText(e.vendor, 18, o + 3.5), r.font = "bold 9px 'JetBrains Mono', monospace", r.fillStyle = b(u.t3, n, a), r.textAlign = "right", r.fillText(`${e.pricing ?? 0} (${Math.round(i * 100)}%)`, et - 4, o + 3.5);
1474
+ let n = m[t % m.length], i = (e.pricing ?? 0) / l, a = d.current.get(e.id ?? `sl-${t}`) ?? 0, o = b + t * 18;
1475
+ r.fillStyle = y(n, .8 + a * .2), r.fillRect(4, o - 6, 12, 12), r.font = "9px 'JetBrains Mono', monospace", r.fillStyle = y(u.t2, .7 + a * .2), r.textAlign = "left", r.fillText(e.vendor, 18, o + 3.5), r.font = "bold 9px 'JetBrains Mono', monospace", r.fillStyle = x(u.t3, n, a), r.textAlign = "right", r.fillText(`${e.pricing ?? 0} (${Math.round(i * 100)}%)`, Qe - 4, o + 3.5);
1328
1476
  }), p = requestAnimationFrame(g);
1329
1477
  };
1330
1478
  return g(), () => cancelAnimationFrame(p);
@@ -1338,30 +1486,30 @@ function nt({ rows: e = [], variant: t, className: r, colors: i }) {
1338
1486
  children: /* @__PURE__ */ c("div", {
1339
1487
  style: {
1340
1488
  position: "relative",
1341
- width: et,
1342
- height: tt
1489
+ width: Qe,
1490
+ height: $e
1343
1491
  },
1344
1492
  children: [/* @__PURE__ */ s("canvas", {
1345
1493
  ref: o,
1346
1494
  role: "img",
1347
1495
  "aria-label": `${t} chart`,
1348
1496
  style: {
1349
- width: et,
1350
- height: tt,
1497
+ width: Qe,
1498
+ height: $e,
1351
1499
  display: "block",
1352
1500
  borderRadius: 8
1353
1501
  }
1354
- }), /* @__PURE__ */ s(E, {
1502
+ }), /* @__PURE__ */ s(D, {
1355
1503
  ...g,
1356
- parentW: et,
1357
- parentH: tt
1504
+ parentW: Qe,
1505
+ parentH: $e
1358
1506
  })]
1359
1507
  })
1360
1508
  });
1361
1509
  }
1362
1510
  //#endregion
1363
1511
  //#region src/components/sankey/SankeySvg.tsx
1364
- function rt(e, t, n, r) {
1512
+ function tt(e, t, n, r) {
1365
1513
  let i = new Set(t.map((e) => e.source)), a = new Set(t.map((e) => e.target)), o = /* @__PURE__ */ new Map(), s = [];
1366
1514
  for (e.forEach((e) => {
1367
1515
  i.has(e.id) && !a.has(e.id) && s.push({
@@ -1406,38 +1554,38 @@ function rt(e, t, n, r) {
1406
1554
  });
1407
1555
  }), f;
1408
1556
  }
1409
- function it({ nodes: e, links: t, width: r = 960, height: o = 280, ariaLabel: d, selectedEntity: f, className: m, colors: h }) {
1410
- let g = a(null), _ = a(/* @__PURE__ */ new Map()), y = a(0), b = a([]), C = h?.nodes ?? p, T = h?.links ?? u.bd, A = h?.activeLinks ?? u.blue, j = h?.activeNodes ?? u.blue, M = i(() => rt(e, t, r, o), [
1557
+ function nt({ nodes: e, links: t, width: r = 960, height: o = 280, ariaLabel: d, selectedEntity: f, className: m, colors: h }) {
1558
+ let g = a(null), _ = a(/* @__PURE__ */ new Map()), v = a(0), b = a([]), x = h?.nodes ?? p, w = h?.links ?? u.bd, E = h?.activeLinks ?? u.blue, j = h?.activeNodes ?? u.blue, M = i(() => tt(e, t, r, o), [
1411
1559
  e,
1412
1560
  t,
1413
1561
  r,
1414
1562
  o
1415
- ]), { hoveredRef: N, tooltip: F, hitZonesRef: L } = D(g, {
1563
+ ]), { hoveredRef: N, tooltip: P, hitZonesRef: I } = O(g, {
1416
1564
  width: r,
1417
1565
  height: o
1418
1566
  });
1419
1567
  return n(() => {
1420
1568
  let n = g.current;
1421
1569
  if (!n) return;
1422
- let i = x(n, r, o);
1423
- y.current = 0, b.current = [];
1570
+ let i = S(n, r, o);
1571
+ v.current = 0, b.current = [];
1424
1572
  let a = t.length > 0 ? Math.max(...t.map((e) => e.value)) : 1, s, c = () => {
1425
- y.current++;
1426
- let n = y.current;
1573
+ v.current++;
1574
+ let n = v.current;
1427
1575
  i.clearRect(0, 0, r, o);
1428
1576
  let l = 1 - (1 - Math.min(n / 56, 1)) ** 3;
1429
- I(_.current, N.current), L.current = [], t.forEach((e, t) => {
1577
+ L(_.current, N.current), I.current = [], t.forEach((e, t) => {
1430
1578
  let r = M.get(e.source), o = M.get(e.target);
1431
1579
  if (!r || !o) return;
1432
- let s = !!f && (e.source === f || e.target === f), c = s ? A : T, d = s ? .5 : .2, p = Math.max(3, e.value / a * 36 * l), m = p / 2, h = r.x + r.w, g = r.y + r.h / 2, _ = o.x, y = o.y + o.h / 2, x = (h + _) / 2;
1580
+ let s = !!f && (e.source === f || e.target === f), c = s ? E : w, d = s ? .5 : .2, p = Math.max(3, e.value / a * 36 * l), m = p / 2, h = r.x + r.w, g = r.y + r.h / 2, _ = o.x, v = o.y + o.h / 2, x = (h + _) / 2;
1433
1581
  for (let e = 0; e < 30; e++) {
1434
- let r = e / 30, a = (e + 1) / 30, o = 1 - r, s = 1 - a, l = o * o * h + 2 * o * r * x + r * r * _, u = o * o * g + 2 * o * r * g + r * r * y, f = s * s * h + 2 * s * a * x + a * a * _, p = s * s * g + 2 * s * a * g + a * a * y, b = P(n + r * 120 + t * 40, .025, 3e-4) * 1.2;
1435
- i.beginPath(), i.moveTo(l, u - m + b), i.lineTo(f, p - m + b), i.lineTo(f, p + m + b), i.lineTo(l, u + m + b), i.closePath(), i.fillStyle = v(c, d * (.5 + r * .5)), i.fill();
1582
+ let r = e / 30, a = (e + 1) / 30, o = 1 - r, s = 1 - a, l = o * o * h + 2 * o * r * x + r * r * _, u = o * o * g + 2 * o * r * g + r * r * v, f = s * s * h + 2 * s * a * x + a * a * _, p = s * s * g + 2 * s * a * g + a * a * v, b = F(n + r * 120 + t * 40, .025, 3e-4) * 1.2;
1583
+ i.beginPath(), i.moveTo(l, u - m + b), i.lineTo(f, p - m + b), i.lineTo(f, p + m + b), i.lineTo(l, u + m + b), i.closePath(), i.fillStyle = y(c, d * (.5 + r * .5)), i.fill();
1436
1584
  }
1437
- O(L.current, `link-${t}`, x, (g + y) / 2, p + 6, {
1585
+ k(I.current, `link-${t}`, x, (g + v) / 2, p + 6, {
1438
1586
  label: `${e.source} → ${e.target}`,
1439
1587
  value: String(e.value),
1440
- color: s ? A : u.blue
1588
+ color: s ? E : u.blue
1441
1589
  }), Math.random() < .08 && b.current.push({
1442
1590
  linkIdx: t,
1443
1591
  prog: 0,
@@ -1448,16 +1596,16 @@ function it({ nodes: e, links: t, width: r = 960, height: o = 280, ariaLabel: d,
1448
1596
  }), e.forEach((e, t) => {
1449
1597
  let r = M.get(e.id);
1450
1598
  if (!r) return;
1451
- let a = f === e.id, o = N.current === `node-${t}`, s = _.current.get(`node-${t}`) ?? 0, c = a ? j : C[t % C.length];
1452
- k(L.current, `node-${t}`, r.x, r.y, r.w, r.h, {
1599
+ let a = f === e.id, o = N.current === `node-${t}`, s = _.current.get(`node-${t}`) ?? 0, c = a ? j : x[t % x.length];
1600
+ A(I.current, `node-${t}`, r.x, r.y, r.w, r.h, {
1453
1601
  label: e.name,
1454
1602
  value: e.valueLabel ?? e.id,
1455
1603
  color: c
1456
- }), (s > 0 || a) && S(i, r.x + r.w / 2, r.y + r.h / 2, r.w * 2, c, .2 * Math.max(s, a ? .6 : 0));
1457
- let l = a ? P(n, .03, 3e-4) * .15 : 0;
1458
- i.fillStyle = v(c, .6 + s * .25 + l), i.beginPath(), i.roundRect(r.x, r.y, r.w, r.h, 4), i.fill(), (a || s > 0) && (i.strokeStyle = v(c, .5 * Math.max(s, a ? 1 : 0)), i.lineWidth = 1, i.beginPath(), i.roundRect(r.x, r.y, r.w, r.h, 4), i.stroke());
1604
+ }), (s > 0 || a) && C(i, r.x + r.w / 2, r.y + r.h / 2, r.w * 2, c, .2 * Math.max(s, a ? .6 : 0));
1605
+ let l = a ? F(n, .03, 3e-4) * .15 : 0;
1606
+ i.fillStyle = y(c, .6 + s * .25 + l), i.beginPath(), i.roundRect(r.x, r.y, r.w, r.h, 4), i.fill(), (a || s > 0) && (i.strokeStyle = y(c, .5 * Math.max(s, a ? 1 : 0)), i.lineWidth = 1, i.beginPath(), i.roundRect(r.x, r.y, r.w, r.h, 4), i.stroke());
1459
1607
  let d = r.x + r.w + 8;
1460
- i.font = `${a || o ? "bold " : ""}10px 'JetBrains Mono', monospace`, i.fillStyle = v(a ? c : u.t2, .7 + s * .2), i.textAlign = "left", i.fillText(e.name, d, r.y + r.h / 2 + 4), e.valueLabel && (i.font = "9px 'JetBrains Mono', monospace", i.fillStyle = v(c, .5 + s * .2), i.fillText(e.valueLabel, d, r.y + r.h / 2 + 17));
1608
+ i.font = `${a || o ? "bold " : ""}10px 'JetBrains Mono', monospace`, i.fillStyle = y(a ? c : u.t2, .7 + s * .2), i.textAlign = "left", i.fillText(e.name, d, r.y + r.h / 2 + 4), e.valueLabel && (i.font = "9px 'JetBrains Mono', monospace", i.fillStyle = y(c, .5 + s * .2), i.fillText(e.valueLabel, d, r.y + r.h / 2 + 17));
1461
1609
  }), b.current = b.current.filter((e) => {
1462
1610
  if (e.prog += e.speed, e.prog > 1) return !1;
1463
1611
  let n = t[e.linkIdx];
@@ -1465,8 +1613,8 @@ function it({ nodes: e, links: t, width: r = 960, height: o = 280, ariaLabel: d,
1465
1613
  let r = M.get(n.source), a = M.get(n.target);
1466
1614
  if (!r || !a) return !1;
1467
1615
  let o = r.x + r.w, s = r.y + r.h / 2, c = a.x, l = a.y + a.h / 2, d = (o + c) / 2, f = 1 - e.prog, p = f * f * o + 2 * f * e.prog * d + e.prog * e.prog * c, m = f * f * s + 2 * f * e.prog * s + e.prog * e.prog * l + e.off, g = Math.sin(e.prog * Math.PI) * .5, _ = h?.links ?? u.blue;
1468
- return i.beginPath(), i.arc(p, m, e.sz, 0, Math.PI * 2), i.fillStyle = v(_, g), i.fill(), !0;
1469
- }), b.current.length > 150 && (b.current = b.current.slice(-150)), w(i, r, o, n, .01), s = requestAnimationFrame(c);
1616
+ return i.beginPath(), i.arc(p, m, e.sz, 0, Math.PI * 2), i.fillStyle = y(_, g), i.fill(), !0;
1617
+ }), b.current.length > 150 && (b.current = b.current.slice(-150)), T(i, r, o, n, .01), s = requestAnimationFrame(c);
1470
1618
  };
1471
1619
  return c(), () => {
1472
1620
  cancelAnimationFrame(s), b.current = [];
@@ -1497,8 +1645,8 @@ function it({ nodes: e, links: t, width: r = 960, height: o = 280, ariaLabel: d,
1497
1645
  display: "block",
1498
1646
  borderRadius: 8
1499
1647
  }
1500
- }), /* @__PURE__ */ s(E, {
1501
- ...F,
1648
+ }), /* @__PURE__ */ s(D, {
1649
+ ...P,
1502
1650
  parentW: r,
1503
1651
  parentH: o
1504
1652
  })]
@@ -1507,7 +1655,7 @@ function it({ nodes: e, links: t, width: r = 960, height: o = 280, ariaLabel: d,
1507
1655
  }
1508
1656
  //#endregion
1509
1657
  //#region src/canvas/CausalFlowCanvas.tsx
1510
- var at = [
1658
+ var rt = [
1511
1659
  {
1512
1660
  x: .13,
1513
1661
  y: .48
@@ -1540,7 +1688,7 @@ var at = [
1540
1688
  x: .92,
1541
1689
  y: .22
1542
1690
  }
1543
- ], ot = [
1691
+ ], it = [
1544
1692
  u.blue,
1545
1693
  u.orange,
1546
1694
  u.red,
@@ -1548,7 +1696,7 @@ var at = [
1548
1696
  u.green,
1549
1697
  u.amber,
1550
1698
  u.t2
1551
- ], st = [
1699
+ ], at = [
1552
1700
  26,
1553
1701
  24,
1554
1702
  24,
@@ -1558,21 +1706,21 @@ var at = [
1558
1706
  22,
1559
1707
  22
1560
1708
  ];
1561
- function ct(e, t) {
1709
+ function ot(e, t) {
1562
1710
  let n = 1 - t;
1563
1711
  return {
1564
1712
  x: n * n * n * e.p0.x + 3 * n * n * t * e.p1.x + 3 * n * t * t * e.p2.x + t * t * t * e.p3.x,
1565
1713
  y: n * n * n * e.p0.y + 3 * n * n * t * e.p1.y + 3 * n * t * t * e.p2.y + t * t * t * e.p3.y
1566
1714
  };
1567
1715
  }
1568
- function lt(e, t) {
1716
+ function st(e, t) {
1569
1717
  let n = 1 - t, r = 3 * n * n * (e.p1.x - e.p0.x) + 6 * n * t * (e.p2.x - e.p1.x) + 3 * t * t * (e.p3.x - e.p2.x), i = 3 * n * n * (e.p1.y - e.p0.y) + 6 * n * t * (e.p2.y - e.p1.y) + 3 * t * t * (e.p3.y - e.p2.y), a = Math.sqrt(r * r + i * i) || 1;
1570
1718
  return {
1571
1719
  x: -i / a,
1572
1720
  y: r / a
1573
1721
  };
1574
1722
  }
1575
- function ut(e, t) {
1723
+ function ct(e, t) {
1576
1724
  let n = t.x - e.x, r = t.y - e.y;
1577
1725
  return {
1578
1726
  p0: {
@@ -1593,46 +1741,46 @@ function ut(e, t) {
1593
1741
  }
1594
1742
  };
1595
1743
  }
1596
- function dt({ nodes: e, links: t, width: r = 960, height: o = 280, selectedEntity: l }) {
1597
- let d = a(null), f = a(0), p = a([]), { hoveredRef: m, tooltip: h, hitZonesRef: g } = D(d, {
1744
+ function lt({ nodes: e, links: t, width: r = 960, height: o = 280, selectedEntity: l }) {
1745
+ let d = a(null), f = a(0), p = a([]), { hoveredRef: m, tooltip: h, hitZonesRef: g } = O(d, {
1598
1746
  width: r,
1599
1747
  height: o
1600
1748
  }), _ = i(() => {
1601
1749
  let t = /* @__PURE__ */ new Map();
1602
1750
  return e.forEach((e, n) => t.set(e.id, n)), t;
1603
- }, [e]), y = i(() => t.length > 0 ? Math.max(...t.map((e) => e.value)) : 100, [t]), T = (e) => y > 1 ? e / 100 : e, k = i(() => e.map((e, t) => {
1604
- let n = at[t % at.length];
1751
+ }, [e]), v = i(() => t.length > 0 ? Math.max(...t.map((e) => e.value)) : 100, [t]), b = (e) => v > 1 ? e / 100 : e, E = i(() => e.map((e, t) => {
1752
+ let n = rt[t % rt.length];
1605
1753
  return {
1606
1754
  id: e.id,
1607
1755
  label: e.name,
1608
1756
  sub: e.valueLabel ?? "",
1609
1757
  x: n.x * r,
1610
1758
  y: n.y * o,
1611
- r: st[t % st.length],
1612
- color: ot[t % ot.length]
1759
+ r: at[t % at.length],
1760
+ color: it[t % it.length]
1613
1761
  };
1614
1762
  }), [
1615
1763
  e,
1616
1764
  r,
1617
1765
  o
1618
- ]), j = i(() => t.map((e) => ({
1766
+ ]), A = i(() => t.map((e) => ({
1619
1767
  fromIdx: _.get(e.source) ?? -1,
1620
1768
  toIdx: _.get(e.target) ?? -1,
1621
- conf: T(e.value)
1769
+ conf: b(e.value)
1622
1770
  })).filter((e) => e.fromIdx >= 0 && e.toIdx >= 0), [t, _]);
1623
1771
  return n(() => {
1624
1772
  let e = d.current;
1625
1773
  if (!e) return;
1626
- let t = x(e, r, o);
1774
+ let t = S(e, r, o);
1627
1775
  f.current = 0, p.current = [];
1628
1776
  let n, i = () => {
1629
1777
  f.current++;
1630
1778
  let e = f.current;
1631
- if (t.clearRect(0, 0, r, o), g.current = [], C(t, r, o, e, 50, v(u.blue, .05)), j.forEach((e, n) => {
1632
- let r = k[e.fromIdx], i = k[e.toIdx];
1779
+ if (t.clearRect(0, 0, r, o), g.current = [], w(t, r, o, e, 50, y(u.blue, .05)), A.forEach((e, n) => {
1780
+ let r = E[e.fromIdx], i = E[e.toIdx];
1633
1781
  if (!r || !i) return;
1634
- let a = !!l && (r.id === l || i.id === l), o = b(r.color, i.color, .5), s = a ? .18 : .05, c = a ? .25 : .1, d = ut(r, i);
1635
- t.beginPath(), t.moveTo(d.p0.x, d.p0.y), t.bezierCurveTo(d.p1.x, d.p1.y, d.p2.x, d.p2.y, d.p3.x, d.p3.y), t.strokeStyle = v(o, s), t.lineWidth = 16, t.lineCap = "round", t.stroke(), t.strokeStyle = v(o, c), t.lineWidth = 1.5, t.stroke();
1782
+ let a = !!l && (r.id === l || i.id === l), o = x(r.color, i.color, .5), s = a ? .18 : .05, c = a ? .25 : .1, d = ct(r, i);
1783
+ t.beginPath(), t.moveTo(d.p0.x, d.p0.y), t.bezierCurveTo(d.p1.x, d.p1.y, d.p2.x, d.p2.y, d.p3.x, d.p3.y), t.strokeStyle = y(o, s), t.lineWidth = 16, t.lineCap = "round", t.stroke(), t.strokeStyle = y(o, c), t.lineWidth = 1.5, t.stroke();
1636
1784
  for (let t = 0; t < e.conf * 2.5; t++) Math.random() < .45 && p.current.push({
1637
1785
  edgeIdx: n,
1638
1786
  t: 0,
@@ -1640,45 +1788,45 @@ function dt({ nodes: e, links: t, width: r = 960, height: o = 280, selectedEntit
1640
1788
  off: (Math.random() - .5) * 13,
1641
1789
  sz: .7 + Math.random() * 2
1642
1790
  });
1643
- let f = ct(d, .5), m = `${Math.round(e.conf * 100)}%`;
1791
+ let f = ot(d, .5), m = `${Math.round(e.conf * 100)}%`;
1644
1792
  t.font = "bold 12px 'JetBrains Mono', monospace", t.textBaseline = "middle";
1645
1793
  let h = t.measureText(m).width + 14;
1646
- t.fillStyle = "rgba(10,16,24,0.88)", t.beginPath(), t.roundRect(f.x - h / 2, f.y - 11, h, 22, 6), t.fill(), t.strokeStyle = v(u.blue, .25), t.lineWidth = 1, t.stroke(), t.fillStyle = v(u.blue, .9), t.textAlign = "center", t.fillText(m, f.x, f.y);
1794
+ t.fillStyle = "rgba(10,16,24,0.88)", t.beginPath(), t.roundRect(f.x - h / 2, f.y - 11, h, 22, 6), t.fill(), t.strokeStyle = y(u.blue, .25), t.lineWidth = 1, t.stroke(), t.fillStyle = y(u.blue, .9), t.textAlign = "center", t.fillText(m, f.x, f.y);
1647
1795
  }), p.current = p.current.filter((e) => {
1648
1796
  if (e.t += e.speed, e.t > 1) return !1;
1649
- let n = j[e.edgeIdx];
1797
+ let n = A[e.edgeIdx];
1650
1798
  if (!n) return !1;
1651
- let r = k[n.fromIdx], i = k[n.toIdx];
1799
+ let r = E[n.fromIdx], i = E[n.toIdx];
1652
1800
  if (!r || !i) return !1;
1653
- let a = ut(r, i), o = ct(a, e.t), s = lt(a, e.t), c = o.x + s.x * e.off, l = o.y + s.y * e.off, u = Math.sin(e.t * Math.PI) * .7, d = b(r.color, i.color, e.t);
1654
- return S(t, c, l, e.sz * 3, d, u * .1), t.beginPath(), t.arc(c, l, e.sz, 0, Math.PI * 2), t.fillStyle = v(d, u), t.fill(), !0;
1655
- }), p.current.length > 350 && (p.current = p.current.slice(-350)), k.forEach((n, r) => {
1656
- let i = l === n.id, a = m.current === `node-${r}`, o = P(e, .03, 3e-4) * .1 + 1, s = n.r * o * (i ? 1.15 : 1);
1657
- t.beginPath(), t.arc(n.x, n.y, s + 6, 0, Math.PI * 2), t.strokeStyle = v(n.color, i ? .3 : .1), t.lineWidth = i ? 1.5 : .7, t.stroke(), S(t, n.x, n.y, s * 3, n.color, i ? .22 : .12);
1801
+ let a = ct(r, i), o = ot(a, e.t), s = st(a, e.t), c = o.x + s.x * e.off, l = o.y + s.y * e.off, u = Math.sin(e.t * Math.PI) * .7, d = x(r.color, i.color, e.t);
1802
+ return C(t, c, l, e.sz * 3, d, u * .1), t.beginPath(), t.arc(c, l, e.sz, 0, Math.PI * 2), t.fillStyle = y(d, u), t.fill(), !0;
1803
+ }), p.current.length > 350 && (p.current = p.current.slice(-350)), E.forEach((n, r) => {
1804
+ let i = l === n.id, a = m.current === `node-${r}`, o = F(e, .03, 3e-4) * .1 + 1, s = n.r * o * (i ? 1.15 : 1);
1805
+ t.beginPath(), t.arc(n.x, n.y, s + 6, 0, Math.PI * 2), t.strokeStyle = y(n.color, i ? .3 : .1), t.lineWidth = i ? 1.5 : .7, t.stroke(), C(t, n.x, n.y, s * 3, n.color, i ? .22 : .12);
1658
1806
  let c = t.createRadialGradient(n.x, n.y - s * .2, 0, n.x, n.y, s);
1659
- if (c.addColorStop(0, v(n.color, i ? 1 : .85)), c.addColorStop(1, v(n.color, i ? .65 : .45)), t.fillStyle = c, t.beginPath(), t.arc(n.x, n.y, s, 0, Math.PI * 2), t.fill(), i || r === k.length - 1) {
1807
+ if (c.addColorStop(0, y(n.color, i ? 1 : .85)), c.addColorStop(1, y(n.color, i ? .65 : .45)), t.fillStyle = c, t.beginPath(), t.arc(n.x, n.y, s, 0, Math.PI * 2), t.fill(), i || r === E.length - 1) {
1660
1808
  let r = s + 16, i = e * .04, a = n.x + Math.cos(i) * r, o = n.y + Math.sin(i) * r;
1661
- S(t, a, o, 6, n.color, .3), t.beginPath(), t.arc(a, o, 2, 0, Math.PI * 2), t.fillStyle = v(n.color, .75), t.fill();
1809
+ C(t, a, o, 6, n.color, .3), t.beginPath(), t.arc(a, o, 2, 0, Math.PI * 2), t.fillStyle = y(n.color, .75), t.fill();
1662
1810
  }
1663
- O(g.current, `node-${r}`, n.x, n.y, s + 8, {
1811
+ k(g.current, `node-${r}`, n.x, n.y, s + 8, {
1664
1812
  label: n.label,
1665
1813
  value: n.sub || n.id,
1666
1814
  color: n.color
1667
- }), t.font = `${i || a ? "bold " : ""}12px 'DM Sans', sans-serif`, t.textAlign = "center", t.textBaseline = "alphabetic", t.fillStyle = v(n.color, i ? 1 : .9), t.fillText(n.label, n.x, n.y + s + 18), n.sub && (t.font = "10px 'JetBrains Mono', monospace", t.fillStyle = v(u.t3, .65), t.fillText(n.sub, n.x, n.y + s + 32));
1668
- }), j.length >= 2) {
1669
- let n = j.reduce((e, t) => e * t.conf, 1), i = o * .92, a = r * .12, s = r * .76, c = A(Math.min(e * .008, 1));
1670
- t.fillStyle = v(u.bd, .35), t.beginPath(), t.roundRect(a, i, s, 5, 3), t.fill(), t.fillStyle = v(u.orange, .6), t.beginPath(), t.roundRect(a, i, s * n * c, 5, 3), t.fill(), t.font = "bold 12px 'JetBrains Mono', monospace", t.textAlign = "left", t.textBaseline = "middle", t.fillStyle = v(u.orange, .85), t.fillText(`${Math.round(n * 100)}% compound confidence`, a + s * n * c + 10, i + 2);
1671
- let l = j.map((e) => e.conf.toFixed(2)).join(" × ");
1672
- t.textAlign = "right", t.font = "9px 'JetBrains Mono', monospace", t.fillStyle = v(u.t4, .6), t.fillText(l, a - 6, i + 2);
1815
+ }), t.font = `${i || a ? "bold " : ""}12px 'DM Sans', sans-serif`, t.textAlign = "center", t.textBaseline = "alphabetic", t.fillStyle = y(n.color, i ? 1 : .9), t.fillText(n.label, n.x, n.y + s + 18), n.sub && (t.font = "10px 'JetBrains Mono', monospace", t.fillStyle = y(u.t3, .65), t.fillText(n.sub, n.x, n.y + s + 32));
1816
+ }), A.length >= 2) {
1817
+ let n = A.reduce((e, t) => e * t.conf, 1), i = o * .92, a = r * .12, s = r * .76, c = j(Math.min(e * .008, 1));
1818
+ t.fillStyle = y(u.bd, .35), t.beginPath(), t.roundRect(a, i, s, 5, 3), t.fill(), t.fillStyle = y(u.orange, .6), t.beginPath(), t.roundRect(a, i, s * n * c, 5, 3), t.fill(), t.font = "bold 12px 'JetBrains Mono', monospace", t.textAlign = "left", t.textBaseline = "middle", t.fillStyle = y(u.orange, .85), t.fillText(`${Math.round(n * 100)}% compound confidence`, a + s * n * c + 10, i + 2);
1819
+ let l = A.map((e) => e.conf.toFixed(2)).join(" × ");
1820
+ t.textAlign = "right", t.font = "9px 'JetBrains Mono', monospace", t.fillStyle = y(u.t4, .6), t.fillText(l, a - 6, i + 2);
1673
1821
  }
1674
- w(t, r, o, e, .012), n = requestAnimationFrame(i);
1822
+ T(t, r, o, e, .012), n = requestAnimationFrame(i);
1675
1823
  };
1676
1824
  return i(), () => {
1677
1825
  cancelAnimationFrame(n), p.current = [];
1678
1826
  };
1679
1827
  }, [
1680
- k,
1681
- j,
1828
+ E,
1829
+ A,
1682
1830
  r,
1683
1831
  o,
1684
1832
  l
@@ -1698,7 +1846,7 @@ function dt({ nodes: e, links: t, width: r = 960, height: o = 280, selectedEntit
1698
1846
  },
1699
1847
  role: "img",
1700
1848
  "aria-label": "causal flow diagram"
1701
- }), /* @__PURE__ */ s(E, {
1849
+ }), /* @__PURE__ */ s(D, {
1702
1850
  ...h,
1703
1851
  parentW: r,
1704
1852
  parentH: o
@@ -1707,10 +1855,10 @@ function dt({ nodes: e, links: t, width: r = 960, height: o = 280, selectedEntit
1707
1855
  }
1708
1856
  //#endregion
1709
1857
  //#region src/components/sankey/ProcessSankey.tsx
1710
- function ft({ selectedEntity: e, colors: t }) {
1711
- return /* @__PURE__ */ s(dt, {
1712
- nodes: Ke.nodes,
1713
- links: Ke.links,
1858
+ function ut({ selectedEntity: e, colors: t }) {
1859
+ return /* @__PURE__ */ s(lt, {
1860
+ nodes: We.nodes,
1861
+ links: We.links,
1714
1862
  width: 960,
1715
1863
  height: 280,
1716
1864
  selectedEntity: e
@@ -1718,7 +1866,7 @@ function ft({ selectedEntity: e, colors: t }) {
1718
1866
  }
1719
1867
  //#endregion
1720
1868
  //#region src/components/sankey/RankingSankey.tsx
1721
- function pt({ rows: e = [], className: t, colors: n }) {
1869
+ function dt({ rows: e = [], className: t, colors: n }) {
1722
1870
  let { nodes: r, links: a } = i(() => {
1723
1871
  let t = e.slice(0, 5);
1724
1872
  return {
@@ -1736,7 +1884,7 @@ function pt({ rows: e = [], className: t, colors: n }) {
1736
1884
  }))
1737
1885
  };
1738
1886
  }, [e]);
1739
- return /* @__PURE__ */ s(it, {
1887
+ return /* @__PURE__ */ s(nt, {
1740
1888
  nodes: r,
1741
1889
  links: a,
1742
1890
  width: 760,
@@ -1748,96 +1896,137 @@ function pt({ rows: e = [], className: t, colors: n }) {
1748
1896
  }
1749
1897
  //#endregion
1750
1898
  //#region src/components/balanceScaleChart/BalanceScaleChart.tsx
1751
- var mt = 780, ht = 420;
1752
- function gt({ left: e, right: t, leftTitle: r = "Accepted", rightTitle: i = "Submitted", unit: o = "quotations", "data-testid": c }) {
1753
- let l = a(null), d = a(0);
1899
+ var ft = 780, pt = 420;
1900
+ function mt({ left: e, right: r, leftTitle: i = "Accepted", rightTitle: o = "Submitted", unit: l = "quotations", selectedId: d, dataByEntity: f, onItemClick: p, testID: m }) {
1901
+ let h = a(null), _ = a(0), v = d && f?.[d] ? f[d] : {
1902
+ left: e,
1903
+ right: r
1904
+ }, b = v.left, x = v.right, w = a({
1905
+ left: b,
1906
+ right: x,
1907
+ leftTitle: i,
1908
+ rightTitle: o
1909
+ });
1910
+ w.current = {
1911
+ left: b,
1912
+ right: x,
1913
+ leftTitle: i,
1914
+ rightTitle: o
1915
+ };
1916
+ let T = a(d);
1917
+ T.current = d;
1918
+ let E = t((e, t) => {
1919
+ let n = typeof t == "object" ? t.label ?? e : e, r = e === "left" ? w.current.left : w.current.right;
1920
+ p?.(e, n, r?.subentity);
1921
+ }, [p]), { hitZonesRef: k, tooltip: M, hoveredRef: N } = O(h, {
1922
+ width: ft,
1923
+ height: pt,
1924
+ onClick: p ? E : void 0
1925
+ });
1754
1926
  return n(() => {
1755
- let n = l.current;
1756
- if (!n) return;
1757
- let a = x(n, mt, ht);
1758
- d.current = 0;
1759
- let s = mt / 2, c = Math.abs(e.value ?? 0), f = Math.abs(t.value ?? 0), p = Math.max(c, f, 1), m = (e.value - t.value) / (2 * p) * 14, g = Math.max(-14, Math.min(14, m)), _ = (e, t, n, r, i) => {
1760
- let o = t - 99 / 2, s = n + 30, c = [
1927
+ let e = h.current;
1928
+ if (!e) return;
1929
+ let t = S(e, ft, pt);
1930
+ _.current = 0;
1931
+ let n = ft / 2, r = Math.abs(b.value ?? 0), a = Math.abs(x.value ?? 0), s = Math.max(r, a, 1), c = (b.value - x.value) / (2 * s) * 14, d = Math.max(-14, Math.min(14, c)), f = (e, n, r, i, a) => {
1932
+ let o = n - 99 / 2, s = r + 30, c = [
1761
1933
  0,
1762
1934
  0,
1763
1935
  10,
1764
1936
  10
1765
1937
  ];
1766
- a.save(), a.beginPath(), a.roundRect(o, s, 99, r, c), a.clip();
1767
- let l = v(e, .27 * i), d = v(e, 0), f = a.createLinearGradient(o, 0, o + 25, 0);
1768
- f.addColorStop(0, l), f.addColorStop(1, d), a.fillStyle = f, a.fillRect(o, s, 25, r);
1769
- let p = a.createLinearGradient(o + 99, 0, o + 99 - 25, 0);
1770
- p.addColorStop(0, l), p.addColorStop(1, d), a.fillStyle = p, a.fillRect(o + 99 - 25, s, 25, r);
1771
- let m = a.createLinearGradient(0, s, 0, s + 25);
1772
- m.addColorStop(0, l), m.addColorStop(1, d), a.fillStyle = m, a.fillRect(o, s, 99, 25);
1773
- let h = a.createLinearGradient(0, s + r, 0, s + r - 25);
1774
- h.addColorStop(0, l), h.addColorStop(1, d), a.fillStyle = h, a.fillRect(o, s + r - 25, 99, 25), a.restore(), a.beginPath(), a.roundRect(o, s, 99, r, c), a.strokeStyle = v(e, 1 * i), a.lineWidth = 1, a.stroke();
1938
+ t.save(), t.beginPath(), t.roundRect(o, s, 99, i, c), t.clip();
1939
+ let l = y(e, .27 * a), d = y(e, 0), f = t.createLinearGradient(o, 0, o + 25, 0);
1940
+ f.addColorStop(0, l), f.addColorStop(1, d), t.fillStyle = f, t.fillRect(o, s, 25, i);
1941
+ let p = t.createLinearGradient(o + 99, 0, o + 99 - 25, 0);
1942
+ p.addColorStop(0, l), p.addColorStop(1, d), t.fillStyle = p, t.fillRect(o + 99 - 25, s, 25, i);
1943
+ let m = t.createLinearGradient(0, s, 0, s + 25);
1944
+ m.addColorStop(0, l), m.addColorStop(1, d), t.fillStyle = m, t.fillRect(o, s, 99, 25);
1945
+ let h = t.createLinearGradient(0, s + i, 0, s + i - 25);
1946
+ h.addColorStop(0, l), h.addColorStop(1, d), t.fillStyle = h, t.fillRect(o, s + i - 25, 99, 25), t.restore(), t.beginPath(), t.roundRect(o, s, 99, i, c), t.strokeStyle = y(e, 1 * a), t.lineWidth = 1, t.stroke();
1775
1947
  let g = o + 99 / 2, _ = s - 5;
1776
- a.strokeStyle = v(u.t2, .5 * i), a.lineWidth = 1, a.beginPath(), a.moveTo(t, n + 4), a.lineTo(g, _), a.stroke(), a.beginPath(), a.moveTo(g, _), a.lineTo(g - 10, s), a.stroke(), a.beginPath(), a.moveTo(g, _), a.lineTo(g + 10, s), a.stroke(), a.beginPath(), a.arc(t, n, 3, 0, Math.PI * 2), a.fillStyle = v(u.t2, .7 * i), a.fill();
1777
- }, y, b = () => {
1778
- d.current++;
1779
- let n = d.current;
1780
- a.clearRect(0, 0, mt, ht), a.letterSpacing = h.letterSpacing;
1781
- let l = A(Math.min(n / 80, 1)), m = g * N(Math.min(n / 80, 1)) * Math.PI / 180, x = {
1782
- x: s - Math.cos(m) * 240,
1783
- y: 100 + Math.sin(-m) * 240
1784
- }, C = {
1785
- x: s + Math.cos(m) * 240,
1786
- y: 100 + Math.sin(m) * 240
1948
+ t.strokeStyle = y(u.t2, .5 * a), t.lineWidth = 1, t.beginPath(), t.moveTo(n, r + 4), t.lineTo(g, _), t.stroke(), t.beginPath(), t.moveTo(g, _), t.lineTo(g - 10, s), t.stroke(), t.beginPath(), t.moveTo(g, _), t.lineTo(g + 10, s), t.stroke(), t.beginPath(), t.arc(n, r, 3, 0, Math.PI * 2), t.fillStyle = y(u.t2, .7 * a), t.fill();
1949
+ }, p, m = () => {
1950
+ _.current++;
1951
+ let e = _.current;
1952
+ t.clearRect(0, 0, ft, pt), t.letterSpacing = g.letterSpacing, k.current = [];
1953
+ let c = j(Math.min(e / 80, 1)), h = d * P(Math.min(e / 80, 1)) * Math.PI / 180, v = {
1954
+ x: n - Math.cos(h) * 240,
1955
+ y: 100 + Math.sin(-h) * 240
1956
+ }, S = {
1957
+ x: n + Math.cos(h) * 240,
1958
+ y: 100 + Math.sin(h) * 240
1787
1959
  };
1788
- a.strokeStyle = v(u.t2, .55 * l), a.lineWidth = 1.5, a.beginPath(), a.moveTo(x.x, x.y), a.lineTo(C.x, C.y), a.stroke(), S(a, s, 100, 18, u.t2, .14 * l), a.beginPath(), a.arc(s, 100, 9 * l, 0, Math.PI * 2), a.fillStyle = v(u.t2, .85 * l), a.fill();
1789
- let w = Math.max(20, c / p * 95 * l), T = Math.max(20, f / p * 95 * l);
1790
- if (_(u.green, x.x, x.y, w, l), _(u.amber, C.x, C.y, T, l), l > .5) {
1791
- a.globalAlpha = Math.min(1, (l - .5) / .5), a.textAlign = "center", a.textBaseline = "top";
1792
- let n = x.y + 30 + w + 14, s = C.y + 30 + T + 14;
1793
- a.font = "700 34px 'Satoshi Variable', 'DM Sans', sans-serif", a.fillStyle = u.t1, a.fillText(e.label, x.x, n), a.font = h.font, a.fillStyle = h.color, a.fillText(`${r} ${e.count} ${o}`, x.x, n + 42), a.font = "700 34px 'Satoshi Variable', 'DM Sans', sans-serif", a.fillStyle = u.t1, a.fillText(t.label, C.x, s), a.font = h.font, a.fillStyle = h.color, a.fillText(`${i} ${t.count} ${o}`, C.x, s + 42), a.globalAlpha = 1, a.textBaseline = "alphabetic";
1960
+ t.strokeStyle = y(u.t2, .55 * c), t.lineWidth = 1.5, t.beginPath(), t.moveTo(v.x, v.y), t.lineTo(S.x, S.y), t.stroke(), C(t, n, 100, 18, u.t2, .14 * c), t.beginPath(), t.arc(n, 100, 9 * c, 0, Math.PI * 2), t.fillStyle = y(u.t2, .85 * c), t.fill();
1961
+ let w = Math.max(20, r / s * 95 * c), E = Math.max(20, a / s * 95 * c), D = T.current === "right" ? .6 : 1, O = T.current === "left" ? .6 : 1;
1962
+ f(u.green, v.x, v.y, w, c * D), f(u.amber, S.x, S.y, E, c * O);
1963
+ let M = v.y + 30 + w, N = S.y + 30 + E;
1964
+ if (A(k.current, "left", v.x - 99 / 2, v.y + 30, 99, w + 90, {
1965
+ label: i,
1966
+ value: b.label,
1967
+ sublabel: `${b.count} ${l}`,
1968
+ color: u.green
1969
+ }, pt, v.x, M + 102), A(k.current, "right", S.x - 99 / 2, S.y + 30, 99, E + 90, {
1970
+ label: o,
1971
+ value: x.label,
1972
+ sublabel: `${x.count} ${l}`,
1973
+ color: u.amber
1974
+ }, pt, S.x, N + 102), c > .5) {
1975
+ let e = Math.min(1, (c - .5) / .5);
1976
+ t.textAlign = "center", t.textBaseline = "top";
1977
+ let n = v.y + 30 + w + 14, r = S.y + 30 + E + 14;
1978
+ t.globalAlpha = e * D, t.font = "700 34px 'Satoshi Variable', 'DM Sans', sans-serif", t.fillStyle = u.t1, t.fillText(b.label, v.x, n), t.font = g.font, t.fillStyle = g.color, t.fillText(`${i} ${b.count} ${l}`, v.x, n + 42), t.globalAlpha = e * O, t.font = "700 34px 'Satoshi Variable', 'DM Sans', sans-serif", t.fillStyle = u.t1, t.fillText(x.label, S.x, r), t.font = g.font, t.fillStyle = g.color, t.fillText(`${o} ${x.count} ${l}`, S.x, r + 42), t.globalAlpha = 1, t.textBaseline = "alphabetic";
1794
1979
  }
1795
- y = requestAnimationFrame(b);
1980
+ p = requestAnimationFrame(m);
1796
1981
  };
1797
- return b(), () => cancelAnimationFrame(y);
1798
- }, [e, t]), /* @__PURE__ */ s("div", {
1799
- "data-testid": c,
1982
+ return m(), () => cancelAnimationFrame(p);
1983
+ }, [b, x]), /* @__PURE__ */ c("div", {
1984
+ "data-testid": m,
1800
1985
  style: {
1801
1986
  position: "relative",
1802
- width: mt,
1803
- height: ht
1987
+ width: "100%",
1988
+ maxWidth: ft
1804
1989
  },
1805
- children: /* @__PURE__ */ s("canvas", {
1806
- ref: l,
1990
+ children: [/* @__PURE__ */ s("canvas", {
1991
+ ref: h,
1807
1992
  role: "img",
1808
1993
  "aria-label": "Quotation balance — accepted vs submitted quotation value",
1809
1994
  style: {
1810
- width: mt,
1811
- height: ht,
1995
+ width: "100%",
1996
+ aspectRatio: `${ft} / ${pt}`,
1812
1997
  display: "block",
1813
1998
  borderRadius: 8
1814
1999
  }
1815
- })
2000
+ }), /* @__PURE__ */ s(D, {
2001
+ ...M,
2002
+ parentW: ft,
2003
+ parentH: pt
2004
+ })]
1816
2005
  });
1817
2006
  }
1818
2007
  //#endregion
1819
2008
  //#region src/components/areaLineChart/AreaLineChart.tsx
1820
- var _t = 780, vt = 360;
1821
- function yt({ points: e = [], "data-testid": t }) {
1822
- let r = a(null), o = a(/* @__PURE__ */ new Map()), l = a(0), { hoveredRef: d, tooltip: f, hitZonesRef: p } = D(r, {
1823
- width: _t,
1824
- height: vt
2009
+ var ht = 780, gt = 360;
2010
+ function _t({ points: e = [], testID: t }) {
2011
+ let r = a(null), o = a(/* @__PURE__ */ new Map()), l = a(0), { hoveredRef: d, tooltip: f, hitZonesRef: p } = O(r, {
2012
+ width: ht,
2013
+ height: gt
1825
2014
  }), m = i(() => e.filter((e) => typeof e == "object" && !!e), [e]);
1826
2015
  return n(() => {
1827
2016
  let e = r.current;
1828
2017
  if (!e) return;
1829
- let t = x(e, _t, vt);
2018
+ let t = S(e, ht, gt);
1830
2019
  l.current = 0;
1831
- let n = _t - 64 - 48, i = vt - 48 - 68, a = Math.max(...m.map((e) => e.count), 1), s = m.length, c = s > 1 ? n / (s - 1) : n, f = m.map((e, t) => ({
2020
+ let n = ht - 64 - 48, i = gt - 48 - 68, a = Math.max(...m.map((e) => e.count), 1), s = m.length, c = s > 1 ? n / (s - 1) : n, f = m.map((e, t) => ({
1832
2021
  x: 64 + t * c,
1833
2022
  y: 48 + i - e.count / a * i,
1834
2023
  point: e
1835
- })), g, _ = () => {
2024
+ })), h, _ = () => {
1836
2025
  l.current++;
1837
2026
  let e = l.current;
1838
- t.clearRect(0, 0, _t, vt), t.letterSpacing = h.letterSpacing;
1839
- let r = A(Math.min(e / 72, 1));
1840
- I(o.current, d.current), p.current = [], [
2027
+ t.clearRect(0, 0, ht, gt), t.letterSpacing = g.letterSpacing;
2028
+ let r = j(Math.min(e / 72, 1));
2029
+ L(o.current, d.current), p.current = [], [
1841
2030
  0,
1842
2031
  .25,
1843
2032
  .5,
@@ -1845,8 +2034,8 @@ function yt({ points: e = [], "data-testid": t }) {
1845
2034
  1
1846
2035
  ].forEach((e) => {
1847
2036
  let r = 48 + i - e * i;
1848
- t.strokeStyle = v(u.bd, .18), t.lineWidth = 1, t.setLineDash([3, 5]), t.beginPath(), t.moveTo(64, r), t.lineTo(64 + n, r), t.stroke(), t.setLineDash([]), t.font = h.font, t.fillStyle = h.color, t.textAlign = "right", t.fillText(String(Math.round(a * e)), 58, r + 3);
1849
- }), t.save(), t.translate(12, 48 + i / 2), t.rotate(-Math.PI / 2), t.font = h.font, t.fillStyle = h.color, t.textAlign = "center", t.fillText("Count", 0, 0), t.restore(), t.strokeStyle = v(u.bd, .3), t.lineWidth = 1, t.setLineDash([]), t.beginPath(), t.moveTo(64, 48 + i), t.lineTo(64 + n, 48 + i), t.stroke();
2037
+ t.strokeStyle = y(u.bd, .18), t.lineWidth = 1, t.setLineDash([3, 5]), t.beginPath(), t.moveTo(64, r), t.lineTo(64 + n, r), t.stroke(), t.setLineDash([]), t.font = g.font, t.fillStyle = g.color, t.textAlign = "right", t.fillText(String(Math.round(a * e)), 58, r + 3);
2038
+ }), t.save(), t.translate(12, 48 + i / 2), t.rotate(-Math.PI / 2), t.font = g.font, t.fillStyle = g.color, t.textAlign = "center", t.fillText("Count", 0, 0), t.restore(), t.strokeStyle = y(u.bd, .3), t.lineWidth = 1, t.setLineDash([]), t.beginPath(), t.moveTo(64, 48 + i), t.lineTo(64 + n, 48 + i), t.stroke();
1850
2039
  let c = r * (s - 1), m = Math.floor(c) + 1;
1851
2040
  if (m >= 2) {
1852
2041
  t.beginPath(), t.moveTo(f[0].x, 48 + i), t.lineTo(f[0].x, f[0].y);
@@ -1857,30 +2046,30 @@ function yt({ points: e = [], "data-testid": t }) {
1857
2046
  let e = f[Math.min(m - 1, s - 1)];
1858
2047
  t.lineTo(e.x, 48 + i), t.closePath();
1859
2048
  let n = t.createLinearGradient(0, 48, 0, 48 + i);
1860
- n.addColorStop(0, v(u.teal, .12)), n.addColorStop(1, v(u.teal, .02)), t.fillStyle = n, t.fill();
2049
+ n.addColorStop(0, y(u.teal, .12)), n.addColorStop(1, y(u.teal, .02)), t.fillStyle = n, t.fill();
1861
2050
  }
1862
2051
  t.beginPath();
1863
2052
  for (let e = 0; e < m; e++) {
1864
2053
  let n = c - Math.floor(c), r = e === m - 1 && e > 0 && e === Math.ceil(c), i = e === 0 || e < m - 1 ? f[e].x : f[e - 1].x + (f[e].x - f[e - 1].x) * (r ? n : 1), a = e === 0 || e < m - 1 ? f[e].y : f[e - 1].y + (f[e].y - f[e - 1].y) * (r ? n : 1);
1865
2054
  e === 0 ? t.moveTo(i, a) : t.lineTo(i, a);
1866
2055
  }
1867
- t.strokeStyle = v(u.teal, .85), t.lineWidth = 2, t.stroke(), f.forEach((e, n) => {
2056
+ t.strokeStyle = y(u.teal, .85), t.lineWidth = 2, t.stroke(), f.forEach((e, n) => {
1868
2057
  if (n >= m) return;
1869
2058
  let r = `pt-${n}`, s = o.current.get(r) ?? 0;
1870
- O(p.current, r, e.x, e.y, 10, {
2059
+ k(p.current, r, e.x, e.y, 10, {
1871
2060
  label: e.point.week,
1872
2061
  value: String(e.point.count),
1873
2062
  color: u.teal
1874
- }), s > 0 && T(t, e.x, 48, 48 + i, v(u.teal, .15 * s));
2063
+ }), s > 0 && E(t, e.x, 48, 48 + i, y(u.teal, .15 * s));
1875
2064
  let c = e.point.count === a;
1876
- (s > 0 || c) && S(t, e.x, e.y, 14, u.teal, (c ? .3 : 0) + s * .25), t.beginPath(), t.arc(e.x, e.y, s > 0 ? 5 : 3.5, 0, Math.PI * 2), t.fillStyle = v(u.teal, s > 0 ? 1 : .8), t.fill(), (s > 0 || c) && (t.font = h.font, t.fillStyle = u.teal, t.textAlign = "center", t.fillText(String(e.point.count), e.x, e.y - 10)), t.font = h.font, t.fillStyle = s > 0 ? u.teal : h.color, t.textAlign = "center", t.fillText(e.point.week, e.x, vt - 68 + 14);
1877
- }), g = requestAnimationFrame(_);
2065
+ (s > 0 || c) && C(t, e.x, e.y, 14, u.teal, (c ? .3 : 0) + s * .25), t.beginPath(), t.arc(e.x, e.y, s > 0 ? 5 : 3.5, 0, Math.PI * 2), t.fillStyle = y(u.teal, s > 0 ? 1 : .8), t.fill(), (s > 0 || c) && (t.font = g.font, t.fillStyle = u.teal, t.textAlign = "center", t.fillText(String(e.point.count), e.x, e.y - 10)), t.font = g.font, t.fillStyle = s > 0 ? u.teal : g.color, t.textAlign = "center", t.fillText(e.point.week, e.x, gt - 68 + 14);
2066
+ }), h = requestAnimationFrame(_);
1878
2067
  };
1879
- return _(), () => cancelAnimationFrame(g);
1880
- }, [m]), m.length < 2 ? /* @__PURE__ */ s(R, {
1881
- width: _t,
1882
- height: vt,
1883
- "data-testid": t
2068
+ return _(), () => cancelAnimationFrame(h);
2069
+ }, [m]), m.length < 2 ? /* @__PURE__ */ s(G, {
2070
+ width: ht,
2071
+ height: gt,
2072
+ testID: t
1884
2073
  }) : /* @__PURE__ */ s("div", {
1885
2074
  "data-testid": t,
1886
2075
  className: "trend-scroll",
@@ -1891,80 +2080,80 @@ function yt({ points: e = [], "data-testid": t }) {
1891
2080
  children: /* @__PURE__ */ c("div", {
1892
2081
  style: {
1893
2082
  position: "relative",
1894
- width: _t,
1895
- height: vt
2083
+ width: ht,
2084
+ height: gt
1896
2085
  },
1897
2086
  children: [/* @__PURE__ */ s("canvas", {
1898
2087
  ref: r,
1899
2088
  role: "img",
1900
2089
  "aria-label": "Trend chart — count over time",
1901
2090
  style: {
1902
- width: _t,
1903
- height: vt,
2091
+ width: ht,
2092
+ height: gt,
1904
2093
  display: "block"
1905
2094
  }
1906
- }), /* @__PURE__ */ s(E, {
2095
+ }), /* @__PURE__ */ s(D, {
1907
2096
  ...f,
1908
- parentW: _t,
1909
- parentH: vt
2097
+ parentW: ht,
2098
+ parentH: gt
1910
2099
  })]
1911
2100
  })
1912
2101
  });
1913
2102
  }
1914
2103
  //#endregion
1915
2104
  //#region src/components/trend/Trend.tsx
1916
- var bt = 680, q = 280, xt = 80, St = 48, Ct = 64, wt = h.font, Tt = 12, Et = Math.PI * 2, Dt = 72, Ot = 20, kt = 5e3;
1917
- function At({ points: e = [], colorOffset: t = 0, "data-testid": r }) {
1918
- let o = a(null), l = a(null), d = a(0), f = i(() => e.filter((e) => typeof e == "object" && !!e), [e]), p = i(() => {
1919
- if (f.length <= 1) return Ct;
2105
+ var vt = 680, X = 280, yt = 80, bt = 48, xt = 64, St = g.font, Ct = 12, wt = Math.PI * 2, Tt = 72, Et = 20, Dt = 5e3;
2106
+ function Ot({ points: e = [], selectedId: t, seriesByEntity: r, colorOffset: o = 0, testID: l }) {
2107
+ let d = a(null), f = a(null), p = a(0), m = t && r?.[t] ? r[t] : e, _ = i(() => m.filter((e) => typeof e == "object" && !!e), [m]), v = i(() => {
2108
+ if (_.length <= 1) return xt;
1920
2109
  let e = document.createElement("canvas").getContext("2d");
1921
- if (!e) return Ct;
1922
- e.font = wt;
1923
- let t = Math.max(1, Math.ceil(f.length / Ot)), n = Math.max(...f.filter((e, n) => n % t === 0).map((t) => e.measureText(t.week).width));
1924
- return Math.max(Ct, n + Tt);
1925
- }, [f]), g = Math.round(p / 2), _ = St + g + Math.max(0, f.length - 1) * p, y = Math.max(bt - xt, Math.min(_, kt)), { tooltip: b, hitZonesRef: S } = D(o, {
1926
- width: y,
1927
- height: q
2110
+ if (!e) return xt;
2111
+ e.font = St;
2112
+ let t = Math.max(1, Math.ceil(_.length / Et)), n = Math.max(..._.filter((e, n) => n % t === 0).map((t) => e.measureText(t.week).width));
2113
+ return Math.max(xt, n + Ct);
2114
+ }, [_]), b = Math.round(v / 2), x = bt + b + Math.max(0, _.length - 1) * v, C = Math.max(vt - yt, Math.min(x, Dt)), { tooltip: w, hitZonesRef: T } = O(d, {
2115
+ width: C,
2116
+ height: X
1928
2117
  });
1929
2118
  return n(() => {
1930
- let e = o.current;
2119
+ let e = d.current;
1931
2120
  if (!e) return;
1932
- let n = x(e, y, q), r = l.current ? x(l.current, xt, q) : null;
1933
- d.current = 0;
1934
- let i = m[t % m.length], a = f.length <= Dt ? Dt : Math.max(24, Math.round(Dt * (Dt / f.length))), s = y - St, c = q - 42 - 54, _ = f.length > 0 ? f.map((e) => e.count) : [0], b = Math.min(..._), C = Math.max(..._), w = C - b || 1, T = f.length, E = T > 1 ? (s - g) / (T - 1) : s - g, D = Math.max(1, Math.ceil(p / E)), k = b < 0, j = k ? 42 + c - -b / w * c : 42 + c, M = f.map((e, t) => ({
1935
- x: g + t * E,
1936
- y: 42 + c - (k ? (e.count - b) / w : e.count / (C || 1)) * c,
2121
+ let t = S(e, C, X), n = f.current ? S(f.current, yt, X) : null;
2122
+ p.current = 0;
2123
+ let r = h[o % h.length], i = _.length <= Tt ? Tt : Math.max(24, Math.round(Tt * (Tt / _.length))), a = C - bt, s = X - 42 - 54, c = _.length > 0 ? _.map((e) => e.count) : [0], l = Math.min(...c), m = Math.max(...c), x = m - l || 1, w = _.length, E = w > 1 ? (a - b) / (w - 1) : 0, D = Math.max(1, Math.ceil(v / E)), O = l < 0, A = O ? 42 + s - -l / x * s : 42 + s, M = b + (a - b) / 2, N = _.map((e, t) => ({
2124
+ x: w === 1 ? M : b + t * E,
2125
+ y: 42 + s - (O ? (e.count - l) / x : e.count / (m || 1)) * s,
1937
2126
  point: e
1938
2127
  }));
1939
- if (r) {
1940
- r.clearRect(0, 0, xt, q), r.letterSpacing = h.letterSpacing;
1941
- let e = k ? [
1942
- b,
1943
- b + w * .25,
1944
- b + w * .5,
1945
- b + w * .75,
1946
- C
2128
+ if (n) {
2129
+ n.clearRect(0, 0, yt, X), n.letterSpacing = g.letterSpacing;
2130
+ let e = O ? [
2131
+ l,
2132
+ l + x * .25,
2133
+ l + x * .5,
2134
+ l + x * .75,
2135
+ m
1947
2136
  ] : [
1948
2137
  0,
1949
- C * .25,
1950
- C * .5,
1951
- C * .75,
1952
- C
2138
+ m * .25,
2139
+ m * .5,
2140
+ m * .75,
2141
+ m
1953
2142
  ];
1954
- e.forEach((t, n) => {
1955
- let i = n / (e.length - 1), a = 42 + c - i * c;
1956
- r.font = h.font, r.fillStyle = h.color, r.textAlign = "right", r.fillText(z(t), xt - 6, a + 3);
1957
- }), r.save(), r.translate(12, 42 + c / 2), r.rotate(-Math.PI / 2), r.font = h.font, r.fillStyle = h.color, r.textAlign = "center", r.fillText("Count", 0, 0), r.restore();
2143
+ e.forEach((t, r) => {
2144
+ let i = r / (e.length - 1), a = 42 + s - i * s;
2145
+ n.font = g.font, n.fillStyle = g.color, n.textAlign = "right", n.fillText(K(t), yt - 6, a + 3);
2146
+ }), n.save(), n.translate(12, 42 + s / 2), n.rotate(-Math.PI / 2), n.font = g.font, n.fillStyle = g.color, n.textAlign = "center", n.fillText("Count", 0, 0), n.restore();
1958
2147
  }
1959
- let N = n.createLinearGradient(0, 42, 0, 42 + c);
1960
- N.addColorStop(0, v(i, .12)), N.addColorStop(1, v(i, .02));
1961
- let P = 0, F, I = (e) => {
1962
- n.font = wt, n.fillStyle = h.color, n.textAlign = "center";
1963
- for (let t = 0; t < e; t++) t % D === 0 && n.fillText(M[t].point.week, M[t].x, q - 54 + 14);
1964
- }, L = () => {
1965
- d.current++;
1966
- let e = Math.min(d.current / a, 1), t = A(e), r = e >= 1;
1967
- n.clearRect(0, 0, y, q), n.letterSpacing = h.letterSpacing, (k ? [
2148
+ let P = t.createLinearGradient(0, 42, 0, 42 + s);
2149
+ P.addColorStop(0, y(r, .12)), P.addColorStop(1, y(r, .02));
2150
+ let F = 0, I, L = (e) => {
2151
+ t.font = St, t.fillStyle = g.color, t.textAlign = "center";
2152
+ for (let n = 0; n < e; n++) n % D === 0 && t.fillText(N[n].point.week, N[n].x, X - 54 + 14);
2153
+ }, R = () => {
2154
+ p.current++;
2155
+ let e = Math.min(p.current / i, 1), n = j(e), o = e >= 1;
2156
+ t.clearRect(0, 0, C, X), t.letterSpacing = g.letterSpacing, (O ? [
1968
2157
  0,
1969
2158
  .25,
1970
2159
  .5,
@@ -1976,61 +2165,61 @@ function At({ points: e = [], colorOffset: t = 0, "data-testid": r }) {
1976
2165
  .75,
1977
2166
  1
1978
2167
  ]).forEach((e) => {
1979
- let t = 42 + c - e * c;
1980
- n.strokeStyle = v(u.bd, .18), n.lineWidth = 1, n.setLineDash([3, 5]), n.beginPath(), n.moveTo(0, t), n.lineTo(s, t), n.stroke(), n.setLineDash([]);
1981
- }), n.font = h.font, n.fillStyle = h.color, n.textAlign = "center", n.fillText("Period", g + (s - g) / 2, q - 6), n.strokeStyle = v(u.bd, k ? .5 : .3), n.lineWidth = k ? 2 : 1, n.beginPath(), n.moveTo(g, k ? j : 42 + c), n.lineTo(s, k ? j : 42 + c), n.stroke();
1982
- let o = t * (T - 1), l = Math.floor(o) + 1;
2168
+ let n = 42 + s - e * s;
2169
+ t.strokeStyle = y(u.bd, .18), t.lineWidth = 1, t.setLineDash([3, 5]), t.beginPath(), t.moveTo(0, n), t.lineTo(a, n), t.stroke(), t.setLineDash([]);
2170
+ }), t.font = g.font, t.fillStyle = g.color, t.textAlign = "center", t.fillText("Period", b + (a - b) / 2, X - 6), t.strokeStyle = y(u.bd, O ? .5 : .3), t.lineWidth = O ? 2 : 1, t.beginPath(), t.moveTo(b, O ? A : 42 + s), t.lineTo(a, O ? A : 42 + s), t.stroke();
2171
+ let c = n * (w - 1), l = Math.floor(c) + 1;
1983
2172
  if (l >= 2) {
1984
- let e = k ? j : 42 + c;
1985
- n.beginPath(), n.moveTo(M[0].x, e), n.lineTo(M[0].x, M[0].y);
2173
+ let e = O ? A : 42 + s;
2174
+ t.beginPath(), t.moveTo(N[0].x, e), t.lineTo(N[0].x, N[0].y);
1986
2175
  for (let e = 1; e < l; e++) {
1987
- let t = o - Math.floor(o), r = e === l - 1 && e === Math.ceil(o) && t > 0, i = r ? M[e - 1].x + (M[e].x - M[e - 1].x) * t : M[e].x, a = r ? M[e - 1].y + (M[e].y - M[e - 1].y) * t : M[e].y;
1988
- n.lineTo(i, a);
2176
+ let n = c - Math.floor(c), r = e === l - 1 && e === Math.ceil(c) && n > 0, i = r ? N[e - 1].x + (N[e].x - N[e - 1].x) * n : N[e].x, a = r ? N[e - 1].y + (N[e].y - N[e - 1].y) * n : N[e].y;
2177
+ t.lineTo(i, a);
1989
2178
  }
1990
- n.lineTo(M[l - 1].x, e), n.closePath(), n.fillStyle = N, n.fill();
2179
+ t.lineTo(N[l - 1].x, e), t.closePath(), t.fillStyle = P, t.fill();
1991
2180
  }
1992
- n.beginPath();
2181
+ t.beginPath();
1993
2182
  for (let e = 0; e < l; e++) {
1994
- let t = o - Math.floor(o), r = e === l - 1 && e > 0 && e === Math.ceil(o) && t > 0, i = r ? M[e - 1].x + (M[e].x - M[e - 1].x) * t : M[e].x, a = r ? M[e - 1].y + (M[e].y - M[e - 1].y) * t : M[e].y;
1995
- e === 0 ? n.moveTo(i, a) : n.lineTo(i, a);
2183
+ let n = c - Math.floor(c), r = e === l - 1 && e > 0 && e === Math.ceil(c) && n > 0, i = r ? N[e - 1].x + (N[e].x - N[e - 1].x) * n : N[e].x, a = r ? N[e - 1].y + (N[e].y - N[e - 1].y) * n : N[e].y;
2184
+ e === 0 ? t.moveTo(i, a) : t.lineTo(i, a);
1996
2185
  }
1997
- n.strokeStyle = v(i, .85), n.lineWidth = 2, n.stroke(), n.fillStyle = v(i, .8), n.beginPath();
1998
- for (let e = 0; e < l; e++) n.moveTo(M[e].x + 3.5, M[e].y), n.arc(M[e].x, M[e].y, 3.5, 0, Et);
1999
- if (n.fill(), l > P) {
2000
- S.current = [];
2001
- for (let e = 0; e < l; e++) O(S.current, `pt-${e}`, M[e].x, M[e].y, 10, {
2002
- label: M[e].point.week,
2003
- value: String(M[e].point.count),
2004
- color: i
2186
+ t.strokeStyle = y(r, .85), t.lineWidth = 2, t.stroke(), t.fillStyle = y(r, .8), t.beginPath();
2187
+ for (let e = 0; e < l; e++) t.moveTo(N[e].x + 3.5, N[e].y), t.arc(N[e].x, N[e].y, 3.5, 0, wt);
2188
+ if (t.fill(), l > F) {
2189
+ T.current = [];
2190
+ for (let e = 0; e < l; e++) k(T.current, `pt-${e}`, N[e].x, N[e].y, 10, {
2191
+ label: N[e].point.week,
2192
+ value: String(N[e].point.count),
2193
+ color: r
2005
2194
  });
2006
- P = l;
2195
+ F = l;
2007
2196
  }
2008
- r && I(T), r || (F = requestAnimationFrame(L));
2197
+ o && L(w), o || (I = requestAnimationFrame(R));
2009
2198
  };
2010
- return L(), () => cancelAnimationFrame(F);
2199
+ return R(), () => cancelAnimationFrame(I);
2011
2200
  }, [
2012
- f,
2013
- y,
2014
- p,
2015
- S,
2016
- t
2017
- ]), f.length < 2 ? /* @__PURE__ */ s(R, {
2018
- width: bt,
2019
- height: q,
2020
- "data-testid": r
2201
+ _,
2202
+ C,
2203
+ v,
2204
+ T,
2205
+ o
2206
+ ]), _.length === 0 ? /* @__PURE__ */ s(G, {
2207
+ width: vt,
2208
+ height: X,
2209
+ testID: l
2021
2210
  }) : /* @__PURE__ */ c("div", {
2022
- "data-testid": r,
2211
+ "data-testid": l,
2023
2212
  style: {
2024
2213
  position: "relative",
2025
2214
  width: "100%",
2026
2215
  display: "flex"
2027
2216
  },
2028
2217
  children: [/* @__PURE__ */ s("canvas", {
2029
- ref: l,
2218
+ ref: f,
2030
2219
  "aria-hidden": "true",
2031
2220
  style: {
2032
- width: xt,
2033
- height: q,
2221
+ width: yt,
2222
+ height: X,
2034
2223
  display: "block",
2035
2224
  flexShrink: 0
2036
2225
  }
@@ -2044,22 +2233,22 @@ function At({ points: e = [], colorOffset: t = 0, "data-testid": r }) {
2044
2233
  children: /* @__PURE__ */ c("div", {
2045
2234
  style: {
2046
2235
  position: "relative",
2047
- width: y,
2048
- height: q
2236
+ width: C,
2237
+ height: X
2049
2238
  },
2050
2239
  children: [/* @__PURE__ */ s("canvas", {
2051
- ref: o,
2240
+ ref: d,
2052
2241
  role: "img",
2053
2242
  "aria-label": "Trend chart — count over time",
2054
2243
  style: {
2055
- width: y,
2056
- height: q,
2244
+ width: C,
2245
+ height: X,
2057
2246
  display: "block"
2058
2247
  }
2059
- }), /* @__PURE__ */ s(E, {
2060
- ...b,
2061
- parentW: y,
2062
- parentH: q
2248
+ }), /* @__PURE__ */ s(D, {
2249
+ ...w,
2250
+ parentW: C,
2251
+ parentH: X
2063
2252
  })]
2064
2253
  })
2065
2254
  })]
@@ -2067,117 +2256,128 @@ function At({ points: e = [], colorOffset: t = 0, "data-testid": r }) {
2067
2256
  }
2068
2257
  //#endregion
2069
2258
  //#region src/components/proportionalBandChart/ProportionalBandChart.tsx
2070
- var jt = 780, Mt = 340, Nt = 28, Pt = 4, Ft = 148;
2071
- function It(e, t, n) {
2259
+ var kt = 780, At = 340, jt = 28, Mt = 4;
2260
+ function Nt(e, t, n) {
2072
2261
  if (e.measureText(t).width <= n) return t;
2073
2262
  let r = t;
2074
2263
  for (; r.length > 0 && e.measureText(`${r}…`).width > n;) r = r.slice(0, -1);
2075
2264
  return `${r}…`;
2076
2265
  }
2077
- function Lt({ severities: e = [], colorOffset: t = 0, "data-testid": r }) {
2078
- let o = a(null), l = a(/* @__PURE__ */ new Map()), d = a(0), f = i(() => e.filter((e) => typeof e == "object" && !!e), [e]), p = f.length > 0 ? Math.min(jt, 2 * Nt + f.length * Ft) : jt, { hoveredRef: g, tooltip: _, hitZonesRef: y } = D(o, {
2079
- width: p,
2080
- height: Mt
2266
+ function Pt({ severities: e = [], colorOffset: r = 0, onItemClick: o, testID: l }) {
2267
+ let [d, f] = ee(kt), p = a(null), m = a(/* @__PURE__ */ new Map()), _ = a(0), v = i(() => e.filter((e) => typeof e == "object" && !!e), [e]), b = a(v);
2268
+ b.current = v;
2269
+ let x = t((e, t) => {
2270
+ let n = typeof t == "object" ? t.label ?? e : e, r = b.current.find((t) => t.severity === e);
2271
+ o?.(e, n, r?.subentity);
2272
+ }, [o]), { hoveredRef: C, tooltip: w, hitZonesRef: T } = O(p, {
2273
+ width: f,
2274
+ height: At,
2275
+ onClick: o ? x : void 0
2081
2276
  });
2082
2277
  return n(() => {
2083
- let e = o.current;
2278
+ let e = p.current;
2084
2279
  if (!e) return;
2085
- let n = x(e, p, Mt);
2086
- d.current = 0;
2087
- let r = f.reduce((e, t) => e + (t.count ?? 0), 0), i = Nt, a = Nt, s = p - i - a, c = Mt - 54 - 54, _ = s - Math.max(0, f.length - 1) * Pt, b = f.map((e) => (e.count ?? 0) / (r || 1) * _), S = m[t % m.length], C, w = () => {
2088
- d.current++;
2089
- let e = d.current;
2090
- n.clearRect(0, 0, p, Mt), n.letterSpacing = h.letterSpacing;
2091
- let t = j(Math.min(e / 60, 1));
2092
- I(l.current, g.current), y.current = [];
2280
+ let t = S(e, f, At);
2281
+ _.current = 0;
2282
+ let n = v.reduce((e, t) => e + (t.count ?? 0), 0), i = jt, a = jt, o = f - i - a, s = At - 54 - 54, c = o - Math.max(0, v.length - 1) * Mt, l = v.map((e) => (e.count ?? 0) / (n || 1) * c), d = h[r % h.length], b, x = () => {
2283
+ _.current++;
2284
+ let e = _.current;
2285
+ t.clearRect(0, 0, f, At), t.letterSpacing = g.letterSpacing;
2286
+ let r = M(Math.min(e / 60, 1));
2287
+ L(m.current, C.current), T.current = [];
2093
2288
  let a = i;
2094
- f.forEach((e, i) => {
2095
- let o = b[i] ?? 0, s = l.current.get(e.severity) ?? 0, d = a + o / 2, f = o * .78, p = o * t, m = f * t, g = d - m / 2;
2096
- if (p > 0) {
2289
+ v.forEach((e, i) => {
2290
+ let o = l[i] ?? 0, c = m.current.get(e.severity) ?? 0, f = a + o / 2, p = o * .78, h = o * r, _ = p * r, v = f - _ / 2;
2291
+ if (h > 0) {
2097
2292
  let e = () => {
2098
- n.beginPath(), n.moveTo(g, 54), n.lineTo(g + m, 54), n.lineTo(a + p, 54 + c), n.lineTo(a, 54 + c), n.closePath();
2099
- }, r = a + o / 2, i = 54 + c / 2, l = Math.sqrt((o / 2) ** 2 + (c / 2) ** 2), u = n.createRadialGradient(r, i, 0, r, i, l);
2100
- u.addColorStop(0, v(S, (.03 + s * .02) * t)), u.addColorStop(.5, v(S, (.12 + s * .04) * t)), u.addColorStop(1, v(S, (.28 + s * .08) * t)), n.save(), e(), n.clip(), e(), n.fillStyle = u, n.fill(), n.restore(), e(), n.strokeStyle = v(S, .9 * t), n.lineWidth = 1, n.stroke();
2293
+ t.beginPath(), t.moveTo(v, 54), t.lineTo(v + _, 54), t.lineTo(a + h, 54 + s), t.lineTo(a, 54 + s), t.closePath();
2294
+ }, n = a + o / 2, i = 54 + s / 2, l = Math.sqrt((o / 2) ** 2 + (s / 2) ** 2), u = t.createRadialGradient(n, i, 0, n, i, l);
2295
+ u.addColorStop(0, y(d, (.03 + c * .02) * r)), u.addColorStop(.5, y(d, (.12 + c * .04) * r)), u.addColorStop(1, y(d, (.28 + c * .08) * r)), t.save(), e(), t.clip(), e(), t.fillStyle = u, t.fill(), t.restore(), e(), t.strokeStyle = y(d, .9 * r), t.lineWidth = 1, t.stroke();
2101
2296
  }
2102
- if (k(y.current, e.severity, a, 54, o, c, {
2297
+ if (A(T.current, e.severity, a, 54, o, s, {
2103
2298
  label: e.severity,
2104
- value: z(e.count ?? 0),
2105
- sublabel: `${Math.round((e.count ?? 0) / (r || 1) * 100)}%`,
2106
- color: S
2107
- }), t > .5) {
2108
- let i = Math.min(1, (t - .5) / .5), l = a + o / 2;
2109
- n.globalAlpha = i, n.font = h.font, n.fillStyle = s > 0 ? S : v(u.t1, .65), n.textAlign = "center", n.fillText(It(n, e.severity, o - 8), l, 40), n.font = "600 22px 'Satoshi Variable', 'DM Sans', sans-serif", n.fillStyle = v(u.t1, .92 + s * .08), n.fillText(z(e.count ?? 0), l, 54 + c / 2 + 8), n.font = h.font, n.fillStyle = s > 0 ? S : v(u.t1, .5), n.fillText(`${Math.round((e.count ?? 0) / (r || 1) * 100)}%`, l, 54 + c + 22), n.globalAlpha = 1;
2299
+ value: K(e.count ?? 0),
2300
+ sublabel: `${Math.round((e.count ?? 0) / (n || 1) * 100)}%`,
2301
+ color: d
2302
+ }), r > .5) {
2303
+ let i = Math.min(1, (r - .5) / .5), l = a + o / 2;
2304
+ t.globalAlpha = i, t.font = g.font, t.fillStyle = c > 0 ? d : y(u.t1, .65), t.textAlign = "center", t.fillText(Nt(t, e.severity, o - 8), l, 40), t.font = "600 22px 'Satoshi Variable', 'DM Sans', sans-serif", t.fillStyle = y(u.t1, .92 + c * .08), t.fillText(K(e.count ?? 0), l, 54 + s / 2 + 8), t.font = g.font, t.fillStyle = c > 0 ? d : y(u.t1, .5), t.fillText(`${Math.round((e.count ?? 0) / (n || 1) * 100)}%`, l, 54 + s + 22), t.globalAlpha = 1;
2110
2305
  }
2111
- a += o + Pt;
2112
- }), C = requestAnimationFrame(w);
2306
+ a += o + Mt;
2307
+ }), b = requestAnimationFrame(x);
2113
2308
  };
2114
- return w(), () => cancelAnimationFrame(C);
2309
+ return x(), () => cancelAnimationFrame(b);
2115
2310
  }, [
2311
+ v,
2116
2312
  f,
2117
- p,
2118
- t
2119
- ]), f.length === 0 ? /* @__PURE__ */ s(R, {
2120
- width: p,
2121
- height: Mt,
2122
- "data-testid": r
2313
+ r
2314
+ ]), v.length === 0 ? /* @__PURE__ */ s("div", {
2315
+ ref: d,
2316
+ style: { width: "100%" },
2317
+ children: /* @__PURE__ */ s(G, {
2318
+ width: f,
2319
+ height: At,
2320
+ testID: l
2321
+ })
2123
2322
  }) : /* @__PURE__ */ c("div", {
2124
- "data-testid": r,
2323
+ ref: d,
2324
+ "data-testid": l,
2125
2325
  style: {
2126
2326
  position: "relative",
2127
- width: p,
2128
- height: Mt
2327
+ width: "100%",
2328
+ height: At
2129
2329
  },
2130
2330
  children: [/* @__PURE__ */ s("canvas", {
2131
- ref: o,
2331
+ ref: p,
2132
2332
  role: "img",
2133
2333
  "aria-label": "Early Warning severity distribution — prism spectrum bands",
2134
2334
  style: {
2135
- width: p,
2136
- height: Mt,
2335
+ width: "100%",
2336
+ height: At,
2137
2337
  display: "block"
2138
2338
  }
2139
- }), /* @__PURE__ */ s(E, {
2140
- ..._,
2141
- parentW: p,
2142
- parentH: Mt
2339
+ }), /* @__PURE__ */ s(D, {
2340
+ ...w,
2341
+ parentW: f,
2342
+ parentH: At
2143
2343
  })]
2144
2344
  });
2145
2345
  }
2146
2346
  //#endregion
2147
2347
  //#region src/components/hubAndSpokeRadialChart/HubAndSpokeRadialChart.tsx
2148
- var J = 300, Y = 280, Rt = 100, zt = {
2348
+ var Ft = 300, It = 280, Lt = 100, Rt = {
2149
2349
  Open: u.red,
2150
2350
  Submitted: u.amber,
2151
2351
  Closed: u.green
2152
2352
  };
2153
- function Bt({ segments: e = [], title: t, unitLabel: r = "", "data-testid": o }) {
2154
- let l = a(null), d = a(0), f = a(/* @__PURE__ */ new Map()), { hoveredRef: p, tooltip: m, hitZonesRef: _ } = D(l, {
2155
- width: J,
2156
- height: Y
2157
- }), y = i(() => e.filter((e) => typeof e == "object" && !!e), [e]);
2353
+ function zt({ segments: e = [], title: t, unitLabel: r = "", testID: o }) {
2354
+ let l = a(null), d = a(0), f = a(/* @__PURE__ */ new Map()), { hoveredRef: p, tooltip: m, hitZonesRef: h } = O(l, {
2355
+ width: Ft,
2356
+ height: It
2357
+ }), v = i(() => e.filter((e) => typeof e == "object" && !!e), [e]);
2158
2358
  return n(() => {
2159
2359
  let e = l.current;
2160
2360
  if (!e) return;
2161
- let n = x(e, J, Y);
2361
+ let n = S(e, Ft, It);
2162
2362
  d.current = 0;
2163
- let i = J * .5, a = Y * .56, o = Rt, s = y.reduce((e, t) => e + (t.count ?? 0), 0), c = Math.max(...y.map((e) => e.count ?? 0), 1), m, b = () => {
2363
+ let i = Ft * .5, a = It * .56, o = Lt, s = v.reduce((e, t) => e + (t.count ?? 0), 0), c = Math.max(...v.map((e) => e.count ?? 0), 1), m, b = () => {
2164
2364
  d.current++;
2165
2365
  let e = d.current;
2166
- n.clearRect(0, 0, J, Y), n.letterSpacing = h.letterSpacing, _.current = [], f.current.forEach((e, t) => {
2366
+ n.clearRect(0, 0, Ft, It), n.letterSpacing = g.letterSpacing, h.current = [], f.current.forEach((e, t) => {
2167
2367
  let n = t === p.current ? 1 : 0, r = e + (n - e) * .12;
2168
2368
  Math.abs(r - n) < .005 ? n === 0 ? f.current.delete(t) : f.current.set(t, 1) : f.current.set(t, r);
2169
- }), p.current && !f.current.has(p.current) && f.current.set(p.current, 0), C(n, J, Y, e, 40, v(u.blue, .04)), y.forEach((t, r) => {
2170
- let s = r / 3 * Math.PI * 2 - Math.PI / 2, l = i + Math.cos(s) * o, d = a + Math.sin(s) * o, f = zt[t.status] ?? u.blue, p = 2 + t.count / c * 8;
2171
- n.beginPath(), n.moveTo(i, a), n.lineTo(l, d), n.strokeStyle = v(f, .08), n.lineWidth = p * 2, n.stroke(), n.beginPath(), n.moveTo(i, a), n.lineTo(l, d), n.strokeStyle = v(f, .25), n.lineWidth = 1, n.stroke();
2172
- let m = (e * .005 + r * .33) % 1, h = i + (l - i) * m, _ = a + (d - a) * m;
2173
- S(n, h, _, 6, f, .4), n.beginPath(), n.arc(h, _, 2, 0, Math.PI * 2), n.fillStyle = v(f, .8), n.fill();
2174
- let y = (i + l) / 2, b = (a + d) / 2;
2175
- n.font = g.font, n.textAlign = "center", n.textBaseline = "middle", n.fillStyle = v(f, .85), n.fillText(String(t.count), y, b);
2176
- }), y.forEach((e, t) => {
2177
- let l = t / 3 * Math.PI * 2 - Math.PI / 2, d = i + Math.cos(l) * o, p = a + Math.sin(l) * o, m = zt[e.status] ?? u.blue, g = 10 + e.count / c * 18, y = f.current.get(e.status) ?? 0;
2178
- S(n, d, p, g * 2.5, m, .2 + y * .15);
2179
- let b = n.createRadialGradient(d, p - g * .2, 0, d, p, g);
2180
- b.addColorStop(0, v(m, .8 + y * .2)), b.addColorStop(1, v(m, .4 + y * .1)), n.beginPath(), n.arc(d, p, g, 0, Math.PI * 2), n.fillStyle = b, n.fill(), n.font = "bold " + h.font, n.textAlign = "center", n.textBaseline = "middle", n.fillStyle = v(u.t1, .9), n.fillText(e.status, d, p), O(_.current, e.status, d, p, g + 6, {
2369
+ }), p.current && !f.current.has(p.current) && f.current.set(p.current, 0), w(n, Ft, It, e, 40, y(u.blue, .04)), v.forEach((t, r) => {
2370
+ let s = r / 3 * Math.PI * 2 - Math.PI / 2, l = i + Math.cos(s) * o, d = a + Math.sin(s) * o, f = Rt[t.status] ?? u.blue, p = 2 + t.count / c * 8;
2371
+ n.beginPath(), n.moveTo(i, a), n.lineTo(l, d), n.strokeStyle = y(f, .08), n.lineWidth = p * 2, n.stroke(), n.beginPath(), n.moveTo(i, a), n.lineTo(l, d), n.strokeStyle = y(f, .25), n.lineWidth = 1, n.stroke();
2372
+ let m = (e * .005 + r * .33) % 1, h = i + (l - i) * m, g = a + (d - a) * m;
2373
+ C(n, h, g, 6, f, .4), n.beginPath(), n.arc(h, g, 2, 0, Math.PI * 2), n.fillStyle = y(f, .8), n.fill();
2374
+ let v = (i + l) / 2, b = (a + d) / 2;
2375
+ n.font = _.font, n.textAlign = "center", n.textBaseline = "middle", n.fillStyle = y(f, .85), n.fillText(String(t.count), v, b);
2376
+ }), v.forEach((e, t) => {
2377
+ let l = t / 3 * Math.PI * 2 - Math.PI / 2, d = i + Math.cos(l) * o, p = a + Math.sin(l) * o, m = Rt[e.status] ?? u.blue, _ = 10 + e.count / c * 18, v = f.current.get(e.status) ?? 0;
2378
+ C(n, d, p, _ * 2.5, m, .2 + v * .15);
2379
+ let b = n.createRadialGradient(d, p - _ * .2, 0, d, p, _);
2380
+ b.addColorStop(0, y(m, .8 + v * .2)), b.addColorStop(1, y(m, .4 + v * .1)), n.beginPath(), n.arc(d, p, _, 0, Math.PI * 2), n.fillStyle = b, n.fill(), n.font = "bold " + g.font, n.textAlign = "center", n.textBaseline = "middle", n.fillStyle = y(u.t1, .9), n.fillText(e.status, d, p), k(h.current, e.status, d, p, _ + 6, {
2181
2381
  label: e.status,
2182
2382
  value: r ? `${e.count} ${r}` : String(e.count),
2183
2383
  sublabel: `${Math.round((e.count ?? 0) / (s || 1) * 100)}%`,
@@ -2185,50 +2385,50 @@ function Bt({ segments: e = [], title: t, unitLabel: r = "", "data-testid": o })
2185
2385
  });
2186
2386
  });
2187
2387
  let l = f.current.get("center") ?? 0;
2188
- S(n, i, a, 36, u.t2, .2 + l * .15);
2388
+ C(n, i, a, 36, u.t2, .2 + l * .15);
2189
2389
  let x = n.createRadialGradient(i, a - 4, 0, i, a, 22);
2190
- x.addColorStop(0, v(u.t2, .9)), x.addColorStop(1, v(u.t2, .5)), n.beginPath(), n.arc(i, a, 22, 0, Math.PI * 2), n.fillStyle = x, n.fill(), n.font = g.font, n.textAlign = "center", n.textBaseline = "middle", n.fillStyle = v(u.t1, .9), n.fillText(t ?? "", i, a - 4), n.font = "bold " + h.font, n.fillStyle = u.t1, n.fillText(String(s), i, a + 8), O(_.current, "center", i, a, 28, {
2390
+ x.addColorStop(0, y(u.t2, .9)), x.addColorStop(1, y(u.t2, .5)), n.beginPath(), n.arc(i, a, 22, 0, Math.PI * 2), n.fillStyle = x, n.fill(), n.font = _.font, n.textAlign = "center", n.textBaseline = "middle", n.fillStyle = y(u.t1, .9), n.fillText(t ?? "", i, a - 4), n.font = "bold " + g.font, n.fillStyle = u.t1, n.fillText(String(s), i, a + 8), k(h.current, "center", i, a, 28, {
2191
2391
  label: t ?? "Total",
2192
2392
  value: r ? `${s} ${r}` : String(s),
2193
2393
  color: u.t2
2194
- }), w(n, J, Y, e, .015), m = requestAnimationFrame(b);
2394
+ }), T(n, Ft, It, e, .015), m = requestAnimationFrame(b);
2195
2395
  };
2196
2396
  return b(), () => cancelAnimationFrame(m);
2197
2397
  }, [
2198
- y,
2398
+ v,
2199
2399
  t,
2200
2400
  r
2201
- ]), y.length === 0 ? /* @__PURE__ */ s(R, {
2202
- width: J,
2203
- height: Y,
2204
- "data-testid": o
2401
+ ]), v.length === 0 ? /* @__PURE__ */ s(G, {
2402
+ width: Ft,
2403
+ height: It,
2404
+ testID: o
2205
2405
  }) : /* @__PURE__ */ c("div", {
2206
2406
  "data-testid": o,
2207
2407
  style: {
2208
2408
  position: "relative",
2209
- width: J,
2210
- height: Y
2409
+ width: Ft,
2410
+ height: It
2211
2411
  },
2212
2412
  children: [/* @__PURE__ */ s("canvas", {
2213
2413
  ref: l,
2214
2414
  role: "img",
2215
2415
  "aria-label": t ?? "EW status arc visualization",
2216
2416
  style: {
2217
- width: J,
2218
- height: Y,
2417
+ width: Ft,
2418
+ height: It,
2219
2419
  display: "block",
2220
2420
  borderRadius: 8
2221
2421
  }
2222
- }), /* @__PURE__ */ s(E, {
2422
+ }), /* @__PURE__ */ s(D, {
2223
2423
  ...m,
2224
- parentW: J,
2225
- parentH: Y
2424
+ parentW: Ft,
2425
+ parentH: It
2226
2426
  })]
2227
2427
  });
2228
2428
  }
2229
2429
  //#endregion
2230
2430
  //#region src/components/trendChart/TrendChart.tsx
2231
- var Vt = 280, X = 96;
2431
+ var Bt = 280, Vt = 96;
2232
2432
  function Ht({ points: e = [], className: t, colors: r }) {
2233
2433
  let o = a(null), d = a(/* @__PURE__ */ new Map()), f = a(0), p = i(() => e.filter(Array.isArray).map(([e, t]) => {
2234
2434
  let n = String(t).match(/-?\d+(\.\d+)?/);
@@ -2236,19 +2436,19 @@ function Ht({ points: e = [], className: t, colors: r }) {
2236
2436
  label: e,
2237
2437
  value: n ? Number(n[0]) : 0
2238
2438
  };
2239
- }), [e]), { mouseRef: m, hoveredRef: h, tooltip: g, hitZonesRef: _ } = D(o, {
2240
- width: Vt,
2241
- height: X
2439
+ }), [e]), { mouseRef: m, hoveredRef: h, tooltip: g, hitZonesRef: _ } = O(o, {
2440
+ width: Bt,
2441
+ height: Vt
2242
2442
  });
2243
2443
  return n(() => {
2244
2444
  let e = o.current;
2245
2445
  if (!e) return;
2246
- let t = x(e, Vt, X);
2446
+ let t = S(e, Bt, Vt);
2247
2447
  f.current = 0;
2248
2448
  let n = r?.line ?? u.teal, i = r?.point ?? u.teal, a = r?.axisLine ?? u.bd, s, c = () => {
2249
2449
  f.current++;
2250
2450
  let e = f.current;
2251
- if (t.clearRect(0, 0, Vt, X), p.length < 2) {
2451
+ if (t.clearRect(0, 0, Bt, Vt), p.length < 2) {
2252
2452
  s = requestAnimationFrame(c);
2253
2453
  return;
2254
2454
  }
@@ -2257,35 +2457,35 @@ function Ht({ points: e = [], className: t, colors: r }) {
2257
2457
  right: 12,
2258
2458
  top: 16,
2259
2459
  bottom: 20
2260
- }, o = Vt - r.left - r.right, l = X - r.top - r.bottom, g = p.map((e) => e.value), y = Math.min(...g), b = Math.max(...g) - y || 1, x = (e) => r.left + e / (p.length - 1) * o, C = (e) => r.top + (1 - (e - y) / b) * l, w = 1 - (1 - Math.min(e / 48, 1)) ** 3, E = Math.max(2, Math.floor(w * p.length));
2261
- if (I(d.current, h.current), _.current = [], t.strokeStyle = v(a, .3), t.lineWidth = .5, t.setLineDash([]), t.beginPath(), t.moveTo(r.left, X - r.bottom), t.lineTo(Vt - r.right, X - r.bottom), t.stroke(), t.font = "9px 'JetBrains Mono', monospace", t.fillStyle = v(u.t4, .9), t.textAlign = "center", p.forEach((e, n) => {
2262
- t.fillText(e.label.replace("Day ", "D"), x(n), X - 4);
2460
+ }, o = Bt - r.left - r.right, l = Vt - r.top - r.bottom, g = p.map((e) => e.value), v = Math.min(...g), b = Math.max(...g) - v || 1, x = (e) => r.left + e / (p.length - 1) * o, S = (e) => r.top + (1 - (e - v) / b) * l, w = 1 - (1 - Math.min(e / 48, 1)) ** 3, T = Math.max(2, Math.floor(w * p.length));
2461
+ if (L(d.current, h.current), _.current = [], t.strokeStyle = y(a, .3), t.lineWidth = .5, t.setLineDash([]), t.beginPath(), t.moveTo(r.left, Vt - r.bottom), t.lineTo(Bt - r.right, Vt - r.bottom), t.stroke(), t.font = "9px 'JetBrains Mono', monospace", t.fillStyle = y(u.t4, .9), t.textAlign = "center", p.forEach((e, n) => {
2462
+ t.fillText(e.label.replace("Day ", "D"), x(n), Vt - 4);
2263
2463
  }), m.current.over && h.current) {
2264
2464
  let e = parseInt(h.current.split("-")[1]);
2265
- isNaN(e) || T(t, x(e), r.top, r.top + l);
2465
+ isNaN(e) || E(t, x(e), r.top, r.top + l);
2266
2466
  }
2267
- if (E > 1) {
2467
+ if (T > 1) {
2268
2468
  let e = t.createLinearGradient(0, r.top, 0, r.top + l);
2269
- e.addColorStop(0, v(n, .15)), e.addColorStop(1, v(n, 0)), t.fillStyle = e, t.beginPath(), t.moveTo(x(0), r.top + l);
2270
- for (let e = 0; e < E; e++) t.lineTo(x(e), C(p[e].value));
2271
- t.lineTo(x(E - 1), r.top + l), t.closePath(), t.fill(), t.strokeStyle = v(n, .8), t.lineWidth = 1.5, t.setLineDash([]), t.beginPath();
2272
- for (let e = 0; e < E; e++) {
2273
- let n = x(e), r = C(p[e].value);
2469
+ e.addColorStop(0, y(n, .15)), e.addColorStop(1, y(n, 0)), t.fillStyle = e, t.beginPath(), t.moveTo(x(0), r.top + l);
2470
+ for (let e = 0; e < T; e++) t.lineTo(x(e), S(p[e].value));
2471
+ t.lineTo(x(T - 1), r.top + l), t.closePath(), t.fill(), t.strokeStyle = y(n, .8), t.lineWidth = 1.5, t.setLineDash([]), t.beginPath();
2472
+ for (let e = 0; e < T; e++) {
2473
+ let n = x(e), r = S(p[e].value);
2274
2474
  e === 0 ? t.moveTo(n, r) : t.lineTo(n, r);
2275
2475
  }
2276
2476
  t.stroke();
2277
2477
  }
2278
- for (let e = 0; e < E; e++) {
2279
- let n = x(e), r = C(p[e].value), a = `tp-${e}`, o = d.current.get(a) ?? 0, s = e === p.length - 1;
2280
- O(_.current, a, n, r, 10, {
2478
+ for (let e = 0; e < T; e++) {
2479
+ let n = x(e), r = S(p[e].value), a = `tp-${e}`, o = d.current.get(a) ?? 0, s = e === p.length - 1;
2480
+ k(_.current, a, n, r, 10, {
2281
2481
  label: p[e].label,
2282
2482
  value: String(p[e].value),
2283
2483
  color: s ? u.red : i
2284
- }), o > 0 && !s && (S(t, n, r, 12 * o, i, .2 * o), t.fillStyle = v(i, .8), t.beginPath(), t.arc(n, r, 3 + o * 2, 0, Math.PI * 2), t.fill());
2484
+ }), o > 0 && !s && (C(t, n, r, 12 * o, i, .2 * o), t.fillStyle = y(i, .8), t.beginPath(), t.arc(n, r, 3 + o * 2, 0, Math.PI * 2), t.fill());
2285
2485
  }
2286
- if (E >= p.length) {
2287
- let n = p.length - 1, r = x(n), i = C(p[n].value), a = d.current.get(`tp-${n}`) ?? 0, o = P(e, .05, 5e-4), s = 1 + a * .5;
2288
- t.shadowColor = v(u.red, .5), t.shadowBlur = (8 + o * 4) * s, t.fillStyle = u.red, t.beginPath(), t.arc(r, i, (3.5 + o * 1.5) * s, 0, Math.PI * 2), t.fill(), t.shadowBlur = 0;
2486
+ if (T >= p.length) {
2487
+ let n = p.length - 1, r = x(n), i = S(p[n].value), a = d.current.get(`tp-${n}`) ?? 0, o = F(e, .05, 5e-4), s = 1 + a * .5;
2488
+ t.shadowColor = y(u.red, .5), t.shadowBlur = (8 + o * 4) * s, t.fillStyle = u.red, t.beginPath(), t.arc(r, i, (3.5 + o * 1.5) * s, 0, Math.PI * 2), t.fill(), t.shadowBlur = 0;
2289
2489
  }
2290
2490
  s = requestAnimationFrame(c);
2291
2491
  };
@@ -2295,23 +2495,23 @@ function Ht({ points: e = [], className: t, colors: r }) {
2295
2495
  children: /* @__PURE__ */ c("div", {
2296
2496
  style: {
2297
2497
  position: "relative",
2298
- width: Vt,
2299
- height: X
2498
+ width: Bt,
2499
+ height: Vt
2300
2500
  },
2301
2501
  children: [/* @__PURE__ */ s("canvas", {
2302
2502
  ref: o,
2303
2503
  role: "img",
2304
2504
  "aria-label": "trend chart",
2305
2505
  style: {
2306
- width: Vt,
2307
- height: X,
2506
+ width: Bt,
2507
+ height: Vt,
2308
2508
  display: "block",
2309
2509
  borderRadius: 8
2310
2510
  }
2311
- }), /* @__PURE__ */ s(E, {
2511
+ }), /* @__PURE__ */ s(D, {
2312
2512
  ...g,
2313
- parentW: Vt,
2314
- parentH: X
2513
+ parentW: Bt,
2514
+ parentH: Vt
2315
2515
  })]
2316
2516
  })
2317
2517
  });
@@ -2324,89 +2524,107 @@ function Ut(e, t, n) {
2324
2524
  for (; r.length > 0 && e.measureText(r + "…").width > n;) r = r.slice(0, -1);
2325
2525
  return r + "…";
2326
2526
  }
2327
- var Wt = 680, Gt = 8, Z = 6, Kt = 8, qt = Z * 2 + Kt, Jt = 36, Yt = 16, Xt = 48;
2328
- function Zt({ items: e = [], labelA: t = "Implemented", labelB: r = "Unimplemented", unit: l = "variations", "data-testid": d }) {
2329
- let f = a(null), p = a(/* @__PURE__ */ new Map()), m = a(0), [y, b] = o(!1), C = i(() => e.filter((e) => typeof e == "object" && !!e), [e]), w = i(() => y ? C : C.slice(0, Gt), [C, y]), T = Yt + Xt + w.length * (qt + Jt) - Jt, { hoveredRef: O, tooltip: A, hitZonesRef: M } = D(f, {
2330
- width: Wt,
2331
- height: T
2527
+ var Wt = 680, Gt = 8, Z = 4, Kt = 8, qt = Z * 2 + Kt, Jt = 36, Yt = Jt / 2, Xt = 48;
2528
+ function Zt({ items: e = [], itemsByEntity: r, onItemClick: l, selectedId: d, labelA: f = "Implemented", labelB: p = "Unimplemented", unit: m = "variations", testID: h }) {
2529
+ let [b, x] = ee(Wt), w = a(null), T = a(/* @__PURE__ */ new Map()), E = a(0), k = a(d);
2530
+ k.current = d;
2531
+ let j = a([]), N = t((e, t) => {
2532
+ let n = e.replace(/-impl$|-un$/, ""), r = typeof t == "object" ? t.label ?? n : n, i = j.current.find((e) => e.id === n);
2533
+ l?.(n, r, i?.subentity);
2534
+ }, [l]), [P, F] = o(!1), R = i(() => e.filter((e) => typeof e == "object" && !!e), [e]), z = !!(d && r?.[d]), B = z ? r[d] : e, V = i(() => B.filter((e) => typeof e == "object" && !!e), [B]), H = i(() => P ? V : V.slice(0, Gt), [V, P]);
2535
+ j.current = H;
2536
+ let U = Yt + Xt + H.length * (qt + Jt) - Jt, { hoveredRef: W, tooltip: ne, hitZonesRef: re } = O(w, {
2537
+ width: x,
2538
+ height: U,
2539
+ onClick: l ? N : void 0
2332
2540
  });
2333
2541
  return n(() => {
2334
- let e = f.current;
2542
+ let e = w.current;
2335
2543
  if (!e) return;
2336
- let n = x(e, Wt, T);
2337
- m.current = 0;
2338
- let i = Wt - 150 - 100, a = Math.max(...w.map((e) => e.implemented ?? 0), ...w.map((e) => e.unimplemented ?? 0), 1), o = w.length * (qt + Jt) - Jt, s = Yt + (T - Yt - Xt - o) / 2, c, d = () => {
2339
- m.current++;
2340
- let e = m.current;
2341
- n.clearRect(0, 0, Wt, T);
2342
- let f = j(Math.min(e / 60, 1));
2343
- I(p.current, O.current), M.current = [], w.forEach((e, o) => {
2344
- let c = F(f, o, w.length, j), d = s + o * (qt + Jt), m = d, _ = d + Z + Kt, y = `${e.id}-impl`, b = `${e.id}-un`, x = p.current.get(y) ?? 0, C = p.current.get(b) ?? 0, T = (e.implemented ?? 0) / a * i * c, E = (e.unimplemented ?? 0) / a * i * c;
2345
- if (n.font = h.font, n.fillStyle = x > 0 || C > 0 ? u.t1 : u.t2, n.textAlign = "right", n.textBaseline = "middle", n.fillText(Ut(n, e.abbreviation ?? e.name ?? "", 134), 142, d + qt / 2), n.textBaseline = "alphabetic", k(M.current, y, 0, d, 150, qt, {
2544
+ let t = S(e, x, U);
2545
+ E.current = 0, t.font = g.font;
2546
+ let n = H.reduce((e, n) => Math.max(e, t.measureText(n.abbreviation ?? n.name ?? "").width), 0);
2547
+ t.font = _.font;
2548
+ let r = H.reduce((e, n) => Math.max(e, t.measureText(K(n.implemented ?? 0)).width, t.measureText(K(n.unimplemented ?? 0)).width), 0), i = Math.max(Math.min(n + 20, x * .3), 40), a = Math.max(r + 24, 32), o = x - i - a, s = Math.max(...H.map((e) => e.implemented ?? 0), ...H.map((e) => e.unimplemented ?? 0), 1), c = H.length * (qt + Jt) - Jt, l = Yt + (U - Yt - Xt - c) / 2, d, h = () => {
2549
+ E.current++;
2550
+ let e = E.current;
2551
+ t.clearRect(0, 0, x, U);
2552
+ let n = M(Math.min(e / 60, 1));
2553
+ L(T.current, W.current), re.current = [], H.forEach((e, a) => {
2554
+ let c = I(n, a, H.length, M), d = l + a * (qt + Jt), h = d, v = d + Z + Kt, b = `${e.id}-impl`, x = `${e.id}-un`, S = T.current.get(b) ?? 0, w = T.current.get(x) ?? 0, E = !z && k.current && e.id !== k.current ? .6 : 1, D = (e.implemented ?? 0) / s * o * c, O = (e.unimplemented ?? 0) / s * o * c;
2555
+ if (t.font = g.font, t.fillStyle = S > 0 || w > 0 ? u.t1 : u.t2, t.textAlign = "right", t.textBaseline = "middle", t.fillText(Ut(t, e.abbreviation ?? e.name ?? "", i - 16), i - 8, d + qt / 2), t.textBaseline = "alphabetic", A(re.current, b, 0, d, i, qt, {
2346
2556
  label: e.name ?? e.abbreviation ?? "",
2347
- value: `${z((e.implemented ?? 0) + (e.unimplemented ?? 0))} total ${l}`,
2348
- sublabel: `${t}: ${z(e.implemented ?? 0)} · ${r}: ${z(e.unimplemented ?? 0)}`,
2557
+ value: `${K((e.implemented ?? 0) + (e.unimplemented ?? 0))} total ${m}`,
2558
+ sublabel: `${f}: ${K(e.implemented ?? 0)} · ${p}: ${K(e.unimplemented ?? 0)}`,
2349
2559
  color: u.green
2350
- }), T > 0) {
2351
- x > 0 && S(n, 150 + T / 2, m + Z / 2, T * .15, u.green, .18 * x);
2352
- let e = n.createLinearGradient(150, 0, 150 + T, 0);
2353
- e.addColorStop(0, v(u.green, .7)), e.addColorStop(1, v(u.green, 1)), n.fillStyle = e, n.beginPath(), n.roundRect(150, m, T, Z, Z / 2), n.fill();
2560
+ }, void 0, i + Math.max(D, O) + 16 + r + 14), D > 0) {
2561
+ S > 0 && C(t, i + D / 2, h + Z / 2, D * .15, u.green, .18 * S);
2562
+ let e = t.createLinearGradient(i, 0, i + D, 0);
2563
+ e.addColorStop(0, y(u.green, .7 * E)), e.addColorStop(1, y(u.green, 1 * E)), t.fillStyle = e, t.beginPath(), t.roundRect(i, h, D, Z, Z / 2), t.fill();
2354
2564
  }
2355
- if (k(M.current, y, 150, m, Math.max(T, 1), Z, {
2565
+ if (A(re.current, b, i, h, Math.max(D, 1), Z, {
2356
2566
  label: e.name,
2357
- value: z(e.implemented ?? 0),
2567
+ value: K(e.implemented ?? 0),
2358
2568
  color: u.green
2359
- }), c > .4 && (n.globalAlpha = Math.min(1, (c - .4) / .4), n.font = g.font, n.fillStyle = u.t1, n.textAlign = "left", n.textBaseline = "middle", n.fillText(z(e.implemented ?? 0), 150 + T + 16, m + Z / 2), n.globalAlpha = 1, n.textBaseline = "alphabetic"), E > 0) {
2360
- C > 0 && S(n, 150 + E / 2, _ + Z / 2, E * .15, u.amber, .18 * C);
2361
- let e = n.createLinearGradient(150, 0, 150 + E, 0);
2362
- e.addColorStop(0, v(u.amber, .5)), e.addColorStop(1, v(u.amber, .9)), n.fillStyle = e, n.beginPath(), n.roundRect(150, _, E, Z, Z / 2), n.fill();
2569
+ }, d + qt / 2, i + Math.max(D, O) + 16 + r + 14), c > .4 && (t.globalAlpha = Math.min(1, (c - .4) / .4), t.font = _.font, t.fillStyle = u.t1, t.textAlign = "left", t.textBaseline = "middle", t.fillText(K(e.implemented ?? 0), i + D + 16, h + Z / 2), t.globalAlpha = 1, t.textBaseline = "alphabetic"), O > 0) {
2570
+ w > 0 && C(t, i + O / 2, v + Z / 2, O * .15, u.amber, .18 * w);
2571
+ let e = t.createLinearGradient(i, 0, i + O, 0);
2572
+ e.addColorStop(0, y(u.amber, .5 * E)), e.addColorStop(1, y(u.amber, .9 * E)), t.fillStyle = e, t.beginPath(), t.roundRect(i, v, O, Z, Z / 2), t.fill();
2363
2573
  }
2364
- k(M.current, b, 150, _, Math.max(E, 1), Z, {
2574
+ A(re.current, x, i, v, Math.max(O, 1), Z, {
2365
2575
  label: e.name,
2366
- value: z(e.unimplemented ?? 0),
2576
+ value: K(e.unimplemented ?? 0),
2367
2577
  color: u.amber
2368
- }), c > .4 && (n.globalAlpha = Math.min(1, (c - .4) / .4), n.font = g.font, n.fillStyle = u.t1, n.textAlign = "left", n.textBaseline = "middle", n.fillText(z(e.unimplemented ?? 0), 150 + E + 16, _ + Z / 2), n.globalAlpha = 1, n.textBaseline = "alphabetic");
2578
+ }, d + qt / 2, i + Math.max(D, O) + 16 + r + 14), c > .4 && (t.globalAlpha = Math.min(1, (c - .4) / .4), t.font = _.font, t.fillStyle = u.t1, t.textAlign = "left", t.textBaseline = "middle", t.fillText(K(e.unimplemented ?? 0), i + O + 16, v + Z / 2), t.globalAlpha = 1, t.textBaseline = "alphabetic");
2369
2579
  });
2370
- let y = s + o + 28;
2371
- n.font = _.font, n.textBaseline = "middle", n.textAlign = "left";
2372
- let b = n.measureText(t).width, x = n.measureText(r).width, C = 18 + b, E = 18 + x, D = (Wt - (C + 24 + E)) / 2, A = n.createLinearGradient(D, 0, D + 12, 0);
2373
- A.addColorStop(0, v(u.green, .7)), A.addColorStop(1, v(u.green, 1)), n.fillStyle = A, n.beginPath(), n.rect(D, y - 6, 12, 12), n.fill(), n.fillStyle = _.color, n.fillText(t, D + 12 + 6, y);
2374
- let N = D + C + 24, P = n.createLinearGradient(N, 0, N + 12, 0);
2375
- P.addColorStop(0, v(u.amber, .5)), P.addColorStop(1, v(u.amber, .9)), n.fillStyle = P, n.beginPath(), n.rect(N, y - 6, 12, 12), n.fill(), n.fillStyle = _.color, n.fillText(r, N + 12 + 6, y), n.textBaseline = "alphabetic", c = requestAnimationFrame(d);
2580
+ let a = l + c + 28;
2581
+ t.font = v.font, t.textBaseline = "middle", t.textAlign = "left";
2582
+ let b = t.measureText(f).width, S = t.measureText(p).width, w = 18 + b, D = 18 + S, O = (x - (w + 24 + D)) / 2, j = t.createLinearGradient(O, 0, O + 12, 0);
2583
+ j.addColorStop(0, y(u.green, .7)), j.addColorStop(1, y(u.green, 1)), t.fillStyle = j, t.beginPath(), t.rect(O, a - 6, 12, 12), t.fill(), t.fillStyle = v.color, t.fillText(f, O + 12 + 6, a);
2584
+ let N = O + w + 24, P = t.createLinearGradient(N, 0, N + 12, 0);
2585
+ P.addColorStop(0, y(u.amber, .5)), P.addColorStop(1, y(u.amber, .9)), t.fillStyle = P, t.beginPath(), t.rect(N, a - 6, 12, 12), t.fill(), t.fillStyle = v.color, t.fillText(p, N + 12 + 6, a), t.textBaseline = "alphabetic", d = requestAnimationFrame(h);
2376
2586
  };
2377
- return d(), () => cancelAnimationFrame(c);
2378
- }, [w, T]), C.length === 0 ? /* @__PURE__ */ s(R, {
2379
- width: Wt,
2380
- height: 160,
2381
- "data-testid": d
2587
+ return h(), () => cancelAnimationFrame(d);
2588
+ }, [
2589
+ H,
2590
+ U,
2591
+ x
2592
+ ]), R.length === 0 ? /* @__PURE__ */ s("div", {
2593
+ ref: b,
2594
+ style: { width: "100%" },
2595
+ children: /* @__PURE__ */ s(G, {
2596
+ width: x,
2597
+ height: 160,
2598
+ testID: h
2599
+ })
2382
2600
  }) : /* @__PURE__ */ c("div", {
2383
- "data-testid": d,
2384
- style: { width: Wt },
2601
+ ref: b,
2602
+ "data-testid": h,
2603
+ style: { width: "100%" },
2385
2604
  children: [/* @__PURE__ */ c("div", {
2386
2605
  style: {
2387
2606
  position: "relative",
2388
- width: Wt,
2389
- height: T
2607
+ height: U
2390
2608
  },
2391
2609
  children: [/* @__PURE__ */ s("canvas", {
2392
- ref: f,
2610
+ ref: w,
2393
2611
  role: "img",
2394
2612
  "aria-label": "Implemented vs unimplemented variations per contractor — split bar",
2395
2613
  style: {
2396
- width: Wt,
2397
- height: T,
2614
+ width: "100%",
2615
+ height: U,
2398
2616
  display: "block"
2399
2617
  }
2400
- }), /* @__PURE__ */ s(E, {
2401
- ...A,
2402
- parentW: Wt,
2403
- parentH: T
2618
+ }), /* @__PURE__ */ s(D, {
2619
+ ...ne,
2620
+ parentW: x,
2621
+ parentH: U
2404
2622
  })]
2405
- }), C.length > Gt && /* @__PURE__ */ s("div", {
2623
+ }), R.length > Gt && /* @__PURE__ */ s("div", {
2406
2624
  style: { marginTop: 8 },
2407
- children: /* @__PURE__ */ s(oe, {
2408
- expanded: y,
2409
- onToggle: () => b((e) => !e)
2625
+ children: /* @__PURE__ */ s(te, {
2626
+ expanded: P,
2627
+ onToggle: () => F((e) => !e)
2410
2628
  })
2411
2629
  })]
2412
2630
  });
@@ -2414,111 +2632,118 @@ function Zt({ items: e = [], labelA: t = "Implemented", labelB: r = "Unimplement
2414
2632
  //#endregion
2415
2633
  //#region src/components/weeklyFlow/WeeklyFlow.tsx
2416
2634
  var Qt = 800, $t = 360;
2417
- function en({ items: e = [], "data-testid": t }) {
2418
- let r = a(null), i = a(/* @__PURE__ */ new Map()), o = a(0), { hoveredRef: l, tooltip: d, hitZonesRef: f } = D(r, {
2419
- width: Qt,
2420
- height: $t
2635
+ function en({ items: e = [], onItemClick: r, testID: i }) {
2636
+ let [o, l] = ee(Qt), d = a(null), f = a(/* @__PURE__ */ new Map()), m = a(0), h = a(e);
2637
+ h.current = e;
2638
+ let v = t((e, t) => {
2639
+ let n = typeof t == "object" ? t.label ?? e : e, i = h.current.find((t) => t.id === e);
2640
+ r?.(e, n, i?.subentity);
2641
+ }, [r]), { hoveredRef: b, tooltip: x, hitZonesRef: w } = O(d, {
2642
+ width: l,
2643
+ height: $t,
2644
+ onClick: r ? v : void 0
2421
2645
  });
2422
2646
  return n(() => {
2423
- let t = r.current;
2647
+ let t = d.current;
2424
2648
  if (!t) return;
2425
- let n = x(t, Qt, $t);
2426
- o.current = 0;
2427
- let a = e.reduce((e, t) => e + (t.base ?? 0), 0), s = e.reduce((e, t) => e + (t.variation ?? 0), 0), c = e.reduce((e, t) => e + (t.total ?? 0), 0), d = $t - 20 - 26, m = d - 6 * (e.length - 1), _ = 20, y = e.map((e, t) => {
2428
- let n = Math.max(24, (e.total ?? 0) / (c || 1) * m), r = {
2429
- x: 100 - 110 / 2,
2430
- y: _,
2649
+ let n = S(t, l, $t);
2650
+ m.current = 0;
2651
+ let r = Math.round(l * .125), i = Math.round(l * .525), a = Math.round(l * .9), o = Math.max(60, Math.round(l * .1375)), s = e.reduce((e, t) => e + (t.base ?? 0), 0), c = e.reduce((e, t) => e + (t.variation ?? 0), 0), h = e.reduce((e, t) => e + (t.total ?? 0), 0), v = $t - 20 - 26, x = v - 6 * (e.length - 1), T = 20, E = e.map((e, t) => {
2652
+ let n = Math.max(24, (e.total ?? 0) / (h || 1) * x), i = {
2653
+ x: r - o / 2,
2654
+ y: T,
2431
2655
  h: n,
2432
- cy: _ + n / 2,
2656
+ cy: T + n / 2,
2433
2657
  c: e,
2434
2658
  color: p[t % p.length]
2435
2659
  };
2436
- return _ += n + 6, r;
2437
- }), b = m - 14, C = Math.max(28, a / (c || 1) * b), w = Math.max(18, s / (c || 1) * b), T = 20 + (d - (C + w + 14)) / 2, E = {
2438
- x: 420 - 110 / 2,
2439
- y: T,
2440
- h: C,
2441
- cy: T + C / 2
2442
- }, D = {
2443
- x: 420 - 110 / 2,
2444
- y: T + C + 14,
2445
- h: w,
2446
- cy: T + C + 14 + w / 2
2447
- }, O = {
2448
- x: 720 - 110 / 2,
2660
+ return T += n + 6, i;
2661
+ }), D = x - 14, O = Math.max(28, s / (h || 1) * D), k = Math.max(18, c / (h || 1) * D), M = 20 + (v - (O + k + 14)) / 2, N = {
2662
+ x: i - o / 2,
2663
+ y: M,
2664
+ h: O,
2665
+ cy: M + O / 2
2666
+ }, P = {
2667
+ x: i - o / 2,
2668
+ y: M + O + 14,
2669
+ h: k,
2670
+ cy: M + O + 14 + k / 2
2671
+ }, F = {
2672
+ x: a - o / 2,
2449
2673
  y: 20,
2450
- h: d,
2451
- cy: 20 + d / 2
2452
- }, j, M = () => {
2453
- o.current++;
2454
- let t = o.current;
2455
- n.clearRect(0, 0, Qt, $t), n.letterSpacing = h.letterSpacing;
2456
- let r = A(Math.min(t / 80, 1));
2457
- if (I(i.current, l.current), f.current = [], e.forEach((t, o) => {
2458
- let c = y[o], l = F(r, o, e.length, A), u = i.current.get(t.id) ?? 0;
2674
+ h: v,
2675
+ cy: 20 + v / 2
2676
+ }, R, z = () => {
2677
+ m.current++;
2678
+ let t = m.current;
2679
+ n.clearRect(0, 0, l, $t), n.letterSpacing = g.letterSpacing;
2680
+ let d = j(Math.min(t / 80, 1));
2681
+ if (L(f.current, b.current), w.current = [], e.forEach((t, r) => {
2682
+ let a = E[r], l = I(d, r, e.length, j), u = f.current.get(t.id) ?? 0;
2459
2683
  if (l < .01) return;
2460
- let d = (t.base ?? 0) / (t.total || 1), f = (t.variation ?? 0) / (t.total || 1), p = c.h * d, m = c.h * f, h = c.y + p / 2, g = c.y + p + m / 2, _ = Math.max(2, (t.base ?? 0) / a * C), v = Math.max(2, (t.variation ?? 0) / s * w), b = E.y + e.slice(0, o).reduce((e, t) => e + (t.base ?? 0) / a * C, 0) + _ / 2, x = D.y + e.slice(0, o).reduce((e, t) => e + (t.variation ?? 0) / s * w, 0) + v / 2, S = u * .2 + .18;
2461
- tn(n, c.x + 110, h, 420 - 110 / 2, b, _ * l, c.color, S), tn(n, c.x + 110, g, 420 - 110 / 2, x, v * l, c.color, S * .75);
2462
- }), r > .3) {
2463
- let e = Math.min(1, (r - .3) / .7), t = O.y + a / c * d / 2, i = O.y + d - s / c * d / 2;
2464
- tn(n, 475, E.cy, 720 - 110 / 2, t, C * e, u.blue, .25 * e), tn(n, 475, D.cy, 720 - 110 / 2, i, w * e, u.amber, .22 * e);
2684
+ let p = (t.base ?? 0) / (t.total || 1), m = (t.variation ?? 0) / (t.total || 1), h = a.h * p, g = a.h * m, _ = a.y + h / 2, v = a.y + h + g / 2, y = Math.max(2, (t.base ?? 0) / s * O), b = Math.max(2, (t.variation ?? 0) / c * k), x = N.y + e.slice(0, r).reduce((e, t) => e + (t.base ?? 0) / s * O, 0) + y / 2, S = P.y + e.slice(0, r).reduce((e, t) => e + (t.variation ?? 0) / c * k, 0) + b / 2, C = u * .2 + .18;
2685
+ tn(n, a.x + o, _, i - o / 2, x, y * l, a.color, C), tn(n, a.x + o, v, i - o / 2, S, b * l, a.color, C * .75);
2686
+ }), d > .3) {
2687
+ let e = Math.min(1, (d - .3) / .7), t = F.y + s / h * v / 2, r = F.y + v - c / h * v / 2;
2688
+ tn(n, i + o / 2, N.cy, a - o / 2, t, O * e, u.blue, .25 * e), tn(n, i + o / 2, P.cy, a - o / 2, r, k * e, u.amber, .22 * e);
2465
2689
  }
2466
2690
  if ([
2467
2691
  "Contractors",
2468
2692
  "Components",
2469
2693
  "Total"
2470
2694
  ].forEach((e, t) => {
2471
- let r = [
2472
- 100,
2473
- 420,
2474
- 720
2695
+ let o = [
2696
+ r,
2697
+ i,
2698
+ a
2475
2699
  ][t];
2476
- n.font = h.font, n.fillStyle = h.color, n.textAlign = "center", n.fillText(e, r, $t - 8);
2477
- }), e.forEach((t, a) => {
2478
- let o = y[a], s = F(r, a, e.length, A), c = i.current.get(t.id) ?? 0;
2479
- k(f.current, t.id, o.x, o.y, 110, o.h, {
2700
+ n.font = g.font, n.fillStyle = g.color, n.textAlign = "center", n.fillText(e, o, $t - 8);
2701
+ }), e.forEach((t, r) => {
2702
+ let i = E[r], a = I(d, r, e.length, j), s = f.current.get(t.id) ?? 0;
2703
+ A(w.current, t.id, i.x, i.y, o, i.h, {
2480
2704
  label: t.name,
2481
2705
  value: t.totalLabel ?? String(t.total ?? 0),
2482
2706
  sublabel: `${t.baseLabel ?? String(t.base ?? 0)} + ${t.variationLabel ?? String(t.variation ?? 0)}`,
2483
- color: o.color
2484
- }), c > 0 && S(n, o.x + 110 / 2, o.cy, 110 * .6, o.color, .12 * c), n.fillStyle = v(o.color, (.3 + c * .15) * s), n.strokeStyle = v(o.color, (.55 + c * .25) * s), n.lineWidth = 1, n.beginPath(), n.roundRect(o.x, o.y, 110 * s, o.h, 4), n.fill(), n.stroke(), s > .6 && o.h >= 24 && (n.globalAlpha = Math.min(1, (s - .6) / .4), n.font = h.font, n.fillStyle = c > 0 ? o.color : v(u.t2, .9), n.textAlign = "center", n.textBaseline = "middle", n.fillText(t.abbreviation ?? t.name?.slice(0, 6) ?? "", o.x + 110 / 2, o.h >= 36 ? o.cy - 5 : o.cy), o.h >= 36 && (n.font = "400 12px 'Satoshi Variable', 'DM Sans', sans-serif", n.fillStyle = v(u.t3, .8), n.fillText(t.totalLabel ?? String(t.total ?? 0), o.x + 110 / 2, o.cy + 7)), n.globalAlpha = 1, n.textBaseline = "alphabetic");
2485
- }), r > .2) {
2486
- let e = Math.min(1, (r - .2) / .4);
2487
- S(n, 420, E.cy, 30, u.blue, .1 * e), n.fillStyle = v(u.blue, .3 * e), n.strokeStyle = v(u.blue, .5 * e), n.lineWidth = 1, n.beginPath(), n.roundRect(E.x, E.y, 110, E.h * e, 4), n.fill(), n.stroke(), n.globalAlpha = e, n.textBaseline = "middle", n.font = h.font, n.fillStyle = u.blue, n.textAlign = "center", n.fillText("Base Value", 420, E.cy - 6), n.font = g.font, n.fillStyle = g.color, n.fillText(z(a), 420, E.cy + 8), n.globalAlpha = 1, n.textBaseline = "alphabetic", S(n, 420, D.cy, 24, u.amber, .1 * e), n.fillStyle = v(u.amber, .22 * e), n.strokeStyle = v(u.amber, .4 * e), n.beginPath(), n.roundRect(D.x, D.y, 110, D.h * e, 4), n.fill(), n.stroke(), n.globalAlpha = e, n.textBaseline = "middle", n.font = h.font, n.fillStyle = u.amber, n.textAlign = "center", n.fillText("Variations", 420, D.cy - 4), n.font = g.font, n.fillStyle = g.color, n.fillText(z(s), 420, D.cy + 8), n.globalAlpha = 1, n.textBaseline = "alphabetic";
2707
+ color: i.color
2708
+ }), s > 0 && C(n, i.x + o / 2, i.cy, o * .6, i.color, .12 * s), n.fillStyle = y(i.color, (.3 + s * .15) * a), n.strokeStyle = y(i.color, (.55 + s * .25) * a), n.lineWidth = 1, n.beginPath(), n.roundRect(i.x, i.y, o * a, i.h, 4), n.fill(), n.stroke(), a > .6 && i.h >= 24 && (n.globalAlpha = Math.min(1, (a - .6) / .4), n.font = g.font, n.fillStyle = s > 0 ? i.color : y(u.t2, .9), n.textAlign = "center", n.textBaseline = "middle", n.fillText(t.abbreviation ?? t.name?.slice(0, 6) ?? "", i.x + o / 2, i.h >= 36 ? i.cy - 5 : i.cy), i.h >= 36 && (n.font = "400 12px 'Satoshi Variable', 'DM Sans', sans-serif", n.fillStyle = y(u.t3, .8), n.fillText(t.totalLabel ?? String(t.total ?? 0), i.x + o / 2, i.cy + 7)), n.globalAlpha = 1, n.textBaseline = "alphabetic");
2709
+ }), d > .2) {
2710
+ let e = Math.min(1, (d - .2) / .4);
2711
+ C(n, i, N.cy, 30, u.blue, .1 * e), n.fillStyle = y(u.blue, .3 * e), n.strokeStyle = y(u.blue, .5 * e), n.lineWidth = 1, n.beginPath(), n.roundRect(N.x, N.y, o, N.h * e, 4), n.fill(), n.stroke(), n.globalAlpha = e, n.textBaseline = "middle", n.font = g.font, n.fillStyle = u.blue, n.textAlign = "center", n.fillText("Base Value", i, N.cy - 6), n.font = _.font, n.fillStyle = _.color, n.fillText(K(s), i, N.cy + 8), n.globalAlpha = 1, n.textBaseline = "alphabetic", C(n, i, P.cy, 24, u.amber, .1 * e), n.fillStyle = y(u.amber, .22 * e), n.strokeStyle = y(u.amber, .4 * e), n.beginPath(), n.roundRect(P.x, P.y, o, P.h * e, 4), n.fill(), n.stroke(), n.globalAlpha = e, n.textBaseline = "middle", n.font = g.font, n.fillStyle = u.amber, n.textAlign = "center", n.fillText("Variations", i, P.cy - 4), n.font = _.font, n.fillStyle = _.color, n.fillText(K(c), i, P.cy + 8), n.globalAlpha = 1, n.textBaseline = "alphabetic";
2488
2712
  }
2489
- if (r > .5) {
2490
- let e = Math.min(1, (r - .5) / .5);
2491
- S(n, 720, O.cy, 44, u.blue, .2 * e), n.fillStyle = v(u.blue, .25 * e), n.strokeStyle = v(u.blue, .6 * e), n.lineWidth = 1.5, n.beginPath(), n.roundRect(O.x, O.y, 110, O.h * e, 6), n.fill(), n.stroke(), n.globalAlpha = e, n.textBaseline = "middle", n.font = h.font, n.fillStyle = u.t2, n.textAlign = "center", n.fillText("Total Commitment", 720, O.cy - 12), n.font = g.font, n.fillStyle = u.blue, n.fillText(z(c), 720, O.cy + 6), n.globalAlpha = 1, n.textBaseline = "alphabetic";
2713
+ if (d > .5) {
2714
+ let e = Math.min(1, (d - .5) / .5);
2715
+ C(n, a, F.cy, 44, u.blue, .2 * e), n.fillStyle = y(u.blue, .25 * e), n.strokeStyle = y(u.blue, .6 * e), n.lineWidth = 1.5, n.beginPath(), n.roundRect(F.x, F.y, o, F.h * e, 6), n.fill(), n.stroke(), n.globalAlpha = e, n.textBaseline = "middle", n.font = g.font, n.fillStyle = u.t2, n.textAlign = "center", n.fillText("Total Commitment", a, F.cy - 12), n.font = _.font, n.fillStyle = u.blue, n.fillText(K(h), a, F.cy + 6), n.globalAlpha = 1, n.textBaseline = "alphabetic";
2492
2716
  }
2493
- j = requestAnimationFrame(M);
2717
+ R = requestAnimationFrame(z);
2494
2718
  };
2495
- return M(), () => cancelAnimationFrame(j);
2496
- }, [e]), /* @__PURE__ */ c("div", {
2497
- "data-testid": t,
2719
+ return z(), () => cancelAnimationFrame(R);
2720
+ }, [e, l]), /* @__PURE__ */ c("div", {
2721
+ ref: o,
2722
+ "data-testid": i,
2498
2723
  style: {
2499
2724
  position: "relative",
2500
- width: Qt,
2725
+ width: "100%",
2501
2726
  height: $t
2502
2727
  },
2503
2728
  children: [/* @__PURE__ */ s("canvas", {
2504
- ref: r,
2729
+ ref: d,
2505
2730
  role: "img",
2506
2731
  "aria-label": "Weekly report flow — base value and variations per contractor flowing to total commitment",
2507
2732
  style: {
2508
- width: Qt,
2733
+ width: "100%",
2509
2734
  height: $t,
2510
2735
  display: "block"
2511
2736
  }
2512
- }), /* @__PURE__ */ s(E, {
2513
- ...d,
2514
- parentW: Qt,
2737
+ }), /* @__PURE__ */ s(D, {
2738
+ ...x,
2739
+ parentW: l,
2515
2740
  parentH: $t
2516
2741
  })]
2517
2742
  });
2518
2743
  }
2519
2744
  function tn(e, t, n, r, i, a, o, s) {
2520
2745
  let c = (t + r) / 2;
2521
- e.beginPath(), e.moveTo(t, n - a / 2), e.bezierCurveTo(c, n - a / 2, c, i - a / 2, r, i - a / 2), e.lineTo(r, i + a / 2), e.bezierCurveTo(c, i + a / 2, c, n + a / 2, t, n + a / 2), e.closePath(), e.fillStyle = v(o, s), e.fill();
2746
+ e.beginPath(), e.moveTo(t, n - a / 2), e.bezierCurveTo(c, n - a / 2, c, i - a / 2, r, i - a / 2), e.lineTo(r, i + a / 2), e.bezierCurveTo(c, i + a / 2, c, n + a / 2, t, n + a / 2), e.closePath(), e.fillStyle = y(o, s), e.fill();
2522
2747
  }
2523
2748
  //#endregion
2524
2749
  //#region src/components/horizontalBarChart/HorizontalBarChart.tsx
@@ -2538,133 +2763,221 @@ function dn(e, t) {
2538
2763
  let n = Math.abs(e), r = e < 0 ? "-" : "";
2539
2764
  return n >= 1e6 ? `${r}${t}${(n / 1e6).toFixed(1)}M` : n >= 1e3 ? `${r}${t}${(n / 1e3).toFixed(1)}K` : `${r}${t}${n.toFixed(0)}`;
2540
2765
  }
2541
- function fn({ rows: e, valuePrefix: t = "$", "data-testid": n }) {
2542
- let r = a(null), i = a(/* @__PURE__ */ new Map()), [l, d] = o(!1), f = e.filter((e) => e != null && typeof e.value == "number"), p = l ? f : f.slice(0, ln), m = p.length, _ = Math.max(...f.map((e) => Math.abs(e.value)), 1), y = nn - an.left - on - an.right, b = m * cn, x = an.top + an.bottom + b, { hoveredRef: C, tooltip: w, hitZonesRef: T } = D(r, {
2543
- width: nn,
2544
- height: x
2766
+ function fn({ rows: e, valuePrefix: n = "$", onItemClick: r, testID: i }) {
2767
+ let [l, d] = ee(nn), f = a(null), p = a(/* @__PURE__ */ new Map()), [m, h] = o(!1), v = a(e);
2768
+ v.current = e;
2769
+ let b = t((e, t) => {
2770
+ let n = typeof t == "object" ? t.label ?? e : e, i = v.current.find((t) => t.id === e);
2771
+ r?.(e, n, i?.subentity);
2772
+ }, [r]), x = e.filter((e) => e != null && typeof e.value == "number"), S = m ? x : x.slice(0, ln), w = S.length, T = Math.max(...x.map((e) => Math.abs(e.value)), 1), E = d - an.left - on - an.right, k = w * cn, j = an.top + an.bottom + k, { hoveredRef: N, tooltip: P, hitZonesRef: F } = O(f, {
2773
+ width: d,
2774
+ height: j,
2775
+ onClick: r ? b : void 0
2545
2776
  });
2546
- return xe(r, nn, x, (e, n) => {
2547
- I(i.current, C.current), T.current = [], p.forEach((r, a) => {
2548
- let o = F(n, a, m, j), s = an.top + a * cn, c = s + (cn - sn) / 2, l = s + cn / 2, d = an.left + on, f = i.current.get(r.id) ?? 0, p = Math.abs(r.value) / _ * y * o, b = r.valueLabel ?? dn(r.value, t);
2549
- if (e.save(), e.font = h.font, e.fillStyle = f > 0 ? u.cyan : h.color, e.textAlign = "right", e.textBaseline = "middle", e.fillText(un(e, r.name, on - 16), d - 8, l), k(T.current, r.id, 0, s, d, cn, {
2777
+ return ge(f, d, j, (e, t) => {
2778
+ L(p.current, N.current), F.current = [], S.forEach((r, i) => {
2779
+ let a = I(t, i, w, M), o = an.top + i * cn, s = o + (cn - sn) / 2, c = o + cn / 2, l = an.left + on, f = p.current.get(r.id) ?? 0, m = Math.abs(r.value) / T * E * a, h = r.valueLabel ?? dn(r.value, n);
2780
+ if (e.save(), e.font = g.font, e.fillStyle = f > 0 ? u.cyan : g.color, e.textAlign = "right", e.textBaseline = "middle", e.fillText(un(e, r.name, on - 16), l - 8, c), A(F.current, r.id, 0, o, l, cn, {
2550
2781
  label: r.name,
2551
- value: b,
2782
+ value: h,
2552
2783
  color: u.cyan
2553
- }), e.fillStyle = v(u.cyan, .1), e.beginPath(), e.roundRect(d, c, y, sn, sn / 2), e.fill(), p > 0) {
2554
- f > 0 && S(e, d + p, c + sn / 2, p * .25, u.cyan, .14 * f);
2555
- let t = e.createLinearGradient(d, c, d + p, c);
2556
- t.addColorStop(0, v(u.cyan, .2 + f * .05)), t.addColorStop(.55, v(u.cyan, .55 + f * .15)), t.addColorStop(1, v(u.cyan, .72 + f * .18)), e.fillStyle = t, e.beginPath(), e.roundRect(d, c, p, sn, sn / 2), e.fill();
2784
+ }), e.fillStyle = y(u.cyan, .1), e.beginPath(), e.roundRect(l, s, E, sn, sn / 2), e.fill(), m > 0) {
2785
+ f > 0 && C(e, l + m, s + sn / 2, m * .25, u.cyan, .14 * f);
2786
+ let t = e.createLinearGradient(l, s, l + m, s);
2787
+ t.addColorStop(0, y(u.cyan, .2 + f * .05)), t.addColorStop(.55, y(u.cyan, .55 + f * .15)), t.addColorStop(1, y(u.cyan, .72 + f * .18)), e.fillStyle = t, e.beginPath(), e.roundRect(l, s, m, sn, sn / 2), e.fill();
2557
2788
  }
2558
- f > 0 && p > 0 && (e.strokeStyle = v(u.cyan, .6 * f), e.lineWidth = 1, e.beginPath(), e.roundRect(d, c, p, sn, sn / 2), e.stroke()), o > .35 && (e.globalAlpha = Math.min(1, (o - .35) / .4), e.font = g.font, e.fillStyle = f > 0 ? u.cyan : g.color, e.textAlign = "right", e.textBaseline = "middle", e.fillText(b, nn - 8, l)), e.restore(), k(T.current, r.id, d, s, Math.max(p, 1), cn, {
2789
+ f > 0 && m > 0 && (e.strokeStyle = y(u.cyan, .6 * f), e.lineWidth = 1, e.beginPath(), e.roundRect(l, s, m, sn, sn / 2), e.stroke()), a > .35 && (e.globalAlpha = Math.min(1, (a - .35) / .4), e.font = _.font, e.fillStyle = f > 0 ? u.cyan : _.color, e.textAlign = "right", e.textBaseline = "middle", e.fillText(h, d - 8, c)), e.restore(), A(F.current, r.id, l, o, Math.max(m, 1), cn, {
2559
2790
  label: r.name,
2560
- value: b,
2791
+ value: h,
2561
2792
  color: u.cyan
2562
2793
  });
2563
2794
  });
2564
- }, !0, { easing: j }), f.length === 0 ? /* @__PURE__ */ s(R, {
2565
- width: nn,
2566
- height: rn,
2567
- message: "No data available",
2568
- "data-testid": n
2795
+ }, !0, { easing: M }), x.length === 0 ? /* @__PURE__ */ s("div", {
2796
+ ref: l,
2797
+ style: { width: "100%" },
2798
+ children: /* @__PURE__ */ s(G, {
2799
+ width: d,
2800
+ height: rn,
2801
+ message: "No data available",
2802
+ testID: i
2803
+ })
2569
2804
  }) : /* @__PURE__ */ c("div", {
2570
- "data-testid": n,
2571
- style: { width: nn },
2805
+ ref: l,
2806
+ "data-testid": i,
2807
+ style: { width: "100%" },
2572
2808
  children: [/* @__PURE__ */ c("div", {
2573
2809
  style: { position: "relative" },
2574
2810
  children: [/* @__PURE__ */ s("canvas", {
2575
- ref: r,
2811
+ ref: f,
2576
2812
  role: "img",
2577
2813
  "aria-label": "Horizontal bar chart",
2578
2814
  style: {
2579
- width: nn,
2580
- height: x,
2815
+ width: "100%",
2816
+ height: j,
2581
2817
  display: "block",
2582
2818
  borderRadius: 8
2583
2819
  }
2584
- }), /* @__PURE__ */ s(E, {
2585
- ...w,
2586
- parentW: nn,
2587
- parentH: x
2820
+ }), /* @__PURE__ */ s(D, {
2821
+ ...P,
2822
+ parentW: d,
2823
+ parentH: j
2588
2824
  })]
2589
- }), f.length > ln && /* @__PURE__ */ s("div", {
2825
+ }), x.length > ln && /* @__PURE__ */ s("div", {
2590
2826
  style: { marginTop: 8 },
2591
- children: /* @__PURE__ */ s(oe, {
2592
- expanded: l,
2593
- onToggle: () => d((e) => !e),
2594
- "data-testid": n ? `${n}-toggle` : void 0
2827
+ children: /* @__PURE__ */ s(te, {
2828
+ expanded: m,
2829
+ onToggle: () => h((e) => !e),
2830
+ "data-testid": i ? `${i}-toggle` : void 0
2595
2831
  })
2596
2832
  })]
2597
2833
  });
2598
2834
  }
2599
2835
  //#endregion
2600
2836
  //#region src/components/visualizationRenderer/VisualizationRenderer.tsx
2601
- function pn({ config: e, className: t, colorOffset: n = 0 }) {
2602
- return e.type === "line" ? /* @__PURE__ */ s(We, {
2837
+ function pn({ config: e, className: t, colorOffset: n = 0, onItemClick: r, selectedId: i, listenerItems: a }) {
2838
+ let o = a ? void 0 : i;
2839
+ if (e.type === Y.LINE) return /* @__PURE__ */ s(He, {
2603
2840
  rows: e.rows,
2604
2841
  className: t
2605
- }) : e.type === "area" ? /* @__PURE__ */ s(ne, {
2842
+ });
2843
+ if (e.type === Y.AREA) return /* @__PURE__ */ s(V, {
2606
2844
  rows: e.rows,
2607
2845
  className: t
2608
- }) : e.type === "bar" ? /* @__PURE__ */ s(ae, {
2846
+ });
2847
+ if (e.type === Y.BAR) return /* @__PURE__ */ s(W, {
2609
2848
  rows: e.rows,
2610
2849
  className: t
2611
- }) : e.type === "pie" ? /* @__PURE__ */ s(nt, {
2850
+ });
2851
+ if (e.type === Y.PIE) return /* @__PURE__ */ s(et, {
2612
2852
  rows: e.rows,
2613
2853
  variant: "pie",
2614
2854
  className: t
2615
- }) : e.type === "donut" ? /* @__PURE__ */ s(nt, {
2855
+ });
2856
+ if (e.type === Y.DONUT) return /* @__PURE__ */ s(et, {
2616
2857
  rows: e.rows,
2617
2858
  variant: "donut",
2618
2859
  className: t
2619
- }) : e.type === "sankey" ? /* @__PURE__ */ s(pt, {
2860
+ });
2861
+ if (e.type === Y.SANKEY) return /* @__PURE__ */ s(dt, {
2620
2862
  rows: e.rows,
2621
2863
  className: t
2622
- }) : e.type === "flow" ? /* @__PURE__ */ s(ft, {
2864
+ });
2865
+ if (e.type === Y.FLOW) return /* @__PURE__ */ s(ut, {
2623
2866
  selectedEntity: e.selectedEntity,
2624
2867
  className: t
2625
- }) : e.type === "trend" ? /* @__PURE__ */ s(Ht, {
2868
+ });
2869
+ if (e.type === Y.TREND) return /* @__PURE__ */ s(Ht, {
2626
2870
  points: e.points,
2627
2871
  className: t
2628
- }) : e.type === "mini-bars" ? /* @__PURE__ */ s(qe, {
2872
+ });
2873
+ if (e.type === Y.MINI_BARS) return /* @__PURE__ */ s(Ge, {
2629
2874
  rows: e.rows,
2630
2875
  className: t
2631
- }) : e.type === "stacked-horizontal-bar-chart" ? /* @__PURE__ */ s(Ie, { data: e.data ?? { items: e.items ?? [] } }) : e.type === "multi-metric-constellation-chart" ? /* @__PURE__ */ s(Oe, { items: e.items }) : e.type === "progress-race-chart" ? /* @__PURE__ */ s(me, {
2632
- items: e.items,
2633
- colorOffset: n
2634
- }) : e.type === "hub-and-spoke-radial-chart" ? /* @__PURE__ */ s(Bt, {
2876
+ });
2877
+ if (e.type === Y.STACKED_HORIZONTAL_BAR) {
2878
+ let t = e.data ?? { items: e.items ?? [] };
2879
+ return /* @__PURE__ */ s(Me, {
2880
+ data: a ? { items: a } : t,
2881
+ dataByEntity: e.dataByEntity,
2882
+ onItemClick: r,
2883
+ selectedId: o
2884
+ });
2885
+ }
2886
+ if (e.type === Y.MULTI_METRIC_CONSTELLATION) return /* @__PURE__ */ s(Ce, { items: e.items });
2887
+ if (e.type === Y.PROGRESS_RACE) return /* @__PURE__ */ s(ue, {
2888
+ items: a || e.items,
2889
+ itemsByEntity: e.itemsByEntity,
2890
+ colorOffset: n,
2891
+ onItemClick: r,
2892
+ selectedId: o
2893
+ });
2894
+ if (e.type === Y.HUB_AND_SPOKE_RADIAL) return /* @__PURE__ */ s(zt, {
2635
2895
  segments: e.segments,
2636
2896
  title: e.title,
2637
2897
  unitLabel: e.unitLabel
2638
- }) : e.type === "dot-matrix-chart" ? /* @__PURE__ */ s(Ue, { items: e.items }) : e.type === "ranked-card-leaderboard" ? /* @__PURE__ */ s(He, { items: e.items }) : e.type === "proportional-band-chart" ? /* @__PURE__ */ s(Lt, {
2639
- severities: e.severities,
2640
- colorOffset: n
2641
- }) : e.type === "radial-fan-tree-chart" ? /* @__PURE__ */ s(Qe, {
2642
- total: e.total,
2643
- totalLabel: e.totalLabel,
2644
- items: e.items,
2645
- colorOffset: n
2646
- }) : e.type === "semi-circular-gauge-chart" ? /* @__PURE__ */ s(be, {
2647
- confirmed: e.confirmed,
2648
- total: e.total,
2649
- label: e.label,
2650
- colorOffset: n
2651
- }) : e.type === "segmented-split-bar-chart" ? /* @__PURE__ */ s(Zt, {
2652
- items: e.items,
2898
+ });
2899
+ if (e.type === Y.DOT_MATRIX) return /* @__PURE__ */ s(Ve, { items: e.items });
2900
+ if (e.type === Y.RANKED_CARD_LEADERBOARD) return /* @__PURE__ */ s(Re, {
2901
+ items: a || e.items,
2902
+ onItemClick: r
2903
+ });
2904
+ if (e.type === Y.PROPORTIONAL_BAND) return /* @__PURE__ */ s(Pt, {
2905
+ severities: a || e.severities,
2906
+ colorOffset: n,
2907
+ onItemClick: r
2908
+ });
2909
+ if (e.type === Y.RADIAL_FAN_TREE) {
2910
+ let t = a && !Array.isArray(a) ? a : null, i = t ? t.items : a || e.items;
2911
+ return /* @__PURE__ */ s(Xe, {
2912
+ total: t ? t.total : a ? a.reduce((e, t) => e + (t.count ?? 0), 0) : e.total,
2913
+ totalLabel: t ? t.totalLabel : e.totalLabel,
2914
+ items: i,
2915
+ dataByEntity: e.dataByEntity,
2916
+ colorOffset: n,
2917
+ onItemClick: r,
2918
+ selectedId: o
2919
+ });
2920
+ }
2921
+ if (e.type === Y.SEMI_CIRCULAR_GAUGE) {
2922
+ let t = Array.isArray(a) ? a[0] : void 0;
2923
+ return /* @__PURE__ */ s(he, {
2924
+ confirmed: t ? Number(t.confirmed ?? 0) : e.confirmed,
2925
+ total: t ? Number(t.total ?? 1) : e.total,
2926
+ label: e.label,
2927
+ gaugeByEntity: e.gaugeByEntity,
2928
+ colorOffset: n,
2929
+ selectedId: o,
2930
+ onItemClick: r,
2931
+ subentity: e.subentity
2932
+ });
2933
+ }
2934
+ if (e.type === Y.SEGMENTED_SPLIT_BAR) return /* @__PURE__ */ s(Zt, {
2935
+ items: a || e.items,
2936
+ itemsByEntity: e.itemsByEntity,
2653
2937
  labelA: e.labelA,
2654
2938
  labelB: e.labelB,
2655
- unit: e.unit
2656
- }) : e.type === "balance-scale-chart" ? /* @__PURE__ */ s(gt, {
2657
- left: e.left,
2658
- right: e.right,
2659
- leftTitle: e.leftTitle,
2660
- rightTitle: e.rightTitle,
2661
- unit: e.unit
2662
- }) : e.type === "area-line-chart" ? /* @__PURE__ */ s(yt, { points: e.points }) : e.type === "trend-view" ? /* @__PURE__ */ s(At, {
2663
- points: e.points,
2939
+ unit: e.unit,
2940
+ onItemClick: r,
2941
+ selectedId: o
2942
+ });
2943
+ if (e.type === Y.BALANCE_SCALE) {
2944
+ let t = e.left, n = e.right;
2945
+ if (a && !Array.isArray(a)) {
2946
+ let e = a;
2947
+ if (e.items?.length >= 2) {
2948
+ let r = Number(e.items[0].count ?? 0), i = Number(e.items[1].count ?? 0);
2949
+ t = {
2950
+ value: r,
2951
+ count: 1,
2952
+ label: "£" + K(r, 2)
2953
+ }, n = {
2954
+ value: i,
2955
+ count: 1,
2956
+ label: "£" + K(i, 2)
2957
+ };
2958
+ }
2959
+ }
2960
+ return /* @__PURE__ */ s(mt, {
2961
+ left: t,
2962
+ right: n,
2963
+ leftTitle: e.leftTitle,
2964
+ rightTitle: e.rightTitle,
2965
+ unit: e.unit,
2966
+ dataByEntity: e.dataByEntity,
2967
+ onItemClick: r,
2968
+ selectedId: o
2969
+ });
2970
+ }
2971
+ return e.type === Y.AREA_LINE ? /* @__PURE__ */ s(_t, { points: e.points }) : e.type === Y.TREND_VIEW ? /* @__PURE__ */ s(Ot, {
2972
+ points: (a && !Array.isArray(a) ? a.points ?? [] : void 0) ?? e.points,
2664
2973
  colorOffset: n
2665
- }) : e.type === "weekly-flow" ? /* @__PURE__ */ s(en, { items: e.items }) : e.type === "horizontal-bar-chart" ? /* @__PURE__ */ s(fn, {
2666
- rows: e.rows,
2667
- valuePrefix: e.valuePrefix
2974
+ }) : e.type === Y.WEEKLY_FLOW ? /* @__PURE__ */ s(en, {
2975
+ items: a || e.items,
2976
+ onItemClick: r
2977
+ }) : e.type === Y.HORIZONTAL_BAR ? /* @__PURE__ */ s(fn, {
2978
+ rows: a || e.rows,
2979
+ valuePrefix: e.valuePrefix,
2980
+ onItemClick: r
2668
2981
  }) : /* @__PURE__ */ s("div", {
2669
2982
  className: "viz-empty",
2670
2983
  children: "Visualization unavailable"
@@ -2702,7 +3015,7 @@ function vn(e) {
2702
3015
  //#endregion
2703
3016
  //#region src/components/donutChart/DonutChart.tsx
2704
3017
  function yn({ rows: e = [], className: t, colors: n }) {
2705
- return /* @__PURE__ */ s(nt, {
3018
+ return /* @__PURE__ */ s(et, {
2706
3019
  rows: e,
2707
3020
  variant: "donut",
2708
3021
  className: t,
@@ -3535,4 +3848,130 @@ function Ln({ text: e }) {
3535
3848
  });
3536
3849
  }
3537
3850
  //#endregion
3538
- export { ne as AreaChart, ae as BarChart, m as CHART_PALETTE, l as ChartFrame, yn as DonutChart, d as GRAD, Pn as KeyHighlights, We as LineChart, qe as MiniBars, p as PALETTE, nt as PieChart, ft as ProcessSankey, pt as RankingSankey, f as SOLID, it as SankeySvg, te as SeriesChart, Ln as Takeaway, At as Trend, Ht as TrendChart, pn as VisualizationRenderer, gn as cleanupVisualizationMounts, _n as hydrateVisualizationMounts, vn as serializeVisualizationConfig };
3851
+ //#region src/assets/ArrowClockwise.svg
3852
+ var Rn = "data:image/svg+xml,%3csvg%20width='20'%20height='20'%20viewBox='0%200%2020%2020'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20clip-path='url(%23clip0_3072_19126)'%3e%3cpath%20d='M14.375%208.125H18.125V4.375'%20stroke='%2369DFE9'%20stroke-linecap='round'%20stroke-linejoin='round'/%3e%3cpath%20d='M14.7188%2015C13.736%2015.9274%2012.5017%2016.5446%2011.1701%2016.7745C9.83859%2017.0044%208.46881%2016.8368%207.23196%2016.2926C5.99511%2015.7485%204.94602%2014.852%204.21579%2013.715C3.48556%2012.5781%203.10656%2011.2511%203.12615%209.90004C3.14574%208.54893%203.56304%207.23355%204.32593%206.11825C5.08881%205.00295%206.16344%204.13719%207.41555%203.62914C8.66765%203.12109%2010.0417%202.99329%2011.366%203.26169C12.6904%203.5301%2013.9062%204.18281%2014.8617%205.13828L18.125%208.125'%20stroke='%2369DFE9'%20stroke-linecap='round'%20stroke-linejoin='round'/%3e%3c/g%3e%3cdefs%3e%3cclipPath%20id='clip0_3072_19126'%3e%3crect%20width='20'%20height='20'%20fill='white'/%3e%3c/clipPath%3e%3c/defs%3e%3c/svg%3e";
3853
+ //#endregion
3854
+ //#region src/components/visualizationGroup/VisualizationGroup.tsx
3855
+ function zn(e) {
3856
+ return e.trim().toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-|-$/g, "");
3857
+ }
3858
+ var Bn = 56;
3859
+ function Vn({ items: e, colorOffset: i = 0, title: l, "data-testid": u }) {
3860
+ let [d, f] = o(void 0), [p, m] = o(void 0), [h, g] = o(null), [_, v] = o(null), [y, b] = o(null), [x, S] = o(null), [C, w] = o(null), [T, E] = o(0), [D, O] = o(0), k = a(null), A = a(null), j = a(null), M = a(null), N = a(null);
3861
+ n(() => {
3862
+ let e = k.current;
3863
+ if (!e) return;
3864
+ let t = (t) => {
3865
+ let { centerClientY: n, centerClientX: r, sourceClientY: i } = t.detail, a = e.getBoundingClientRect(), o = t.target, s = o.getBoundingClientRect();
3866
+ A.current = o, j.current = n - s.top, M.current = r - s.left, N.current = i == null ? null : i - s.top, b(n - a.top), S(r - a.left), w(i == null ? null : i - a.top), E(a.height), O(a.width);
3867
+ };
3868
+ return e.addEventListener("viz-item-click", t), () => e.removeEventListener("viz-item-click", t);
3869
+ }, []), r(() => {
3870
+ if (!h || A.current === null || j.current === null) return;
3871
+ let e = k.current;
3872
+ if (!e) return;
3873
+ let t = A.current.getBoundingClientRect(), n = e.getBoundingClientRect();
3874
+ b(t.top - n.top + j.current), M.current !== null && S(t.left - n.left + M.current), N.current !== null && w(t.top - n.top + N.current), E(n.height), O(n.width);
3875
+ }, [h]);
3876
+ let P = t((e, t, n, r) => {
3877
+ if (!(r != null && (!Array.isArray(r) || r.length > 0))) return;
3878
+ let i = zn(t);
3879
+ f((t) => {
3880
+ let a = t === i ? void 0 : i;
3881
+ return m(a ? n : void 0), a ? (v(e), g(r)) : (g(null), v(null)), a;
3882
+ });
3883
+ }, []), F = t(() => {
3884
+ f(void 0), m(void 0), g(null), v(null), b(null), S(null), w(null), A.current = null, j.current = null, M.current = null, N.current = null;
3885
+ }, []), I = _ !== null && y !== null, L = y ?? T / 2, R = e.length - 1, z = D > 0 ? (D - R * Bn) / e.length : null, B = (t) => I && _ === t && e[t]?.type === Y.BALANCE_SCALE, V = _ !== null && e[_]?.type === Y.BALANCE_SCALE && I && x !== null && C !== null && z !== null;
3886
+ return /* @__PURE__ */ c("div", {
3887
+ className: "viz-group",
3888
+ "data-testid": u,
3889
+ children: [
3890
+ l && /* @__PURE__ */ s("div", {
3891
+ className: "viz-group__title",
3892
+ children: l
3893
+ }),
3894
+ /* @__PURE__ */ s("div", {
3895
+ className: "viz-group__bar",
3896
+ children: d ? /* @__PURE__ */ c("button", {
3897
+ type: "button",
3898
+ className: "viz-group__reset-btn",
3899
+ onClick: F,
3900
+ "aria-label": "Reset selection",
3901
+ children: [/* @__PURE__ */ s("img", {
3902
+ src: Rn,
3903
+ alt: "",
3904
+ className: "viz-group__reset-icon"
3905
+ }), "Reset"]
3906
+ }) : /* @__PURE__ */ s("span", {
3907
+ className: "viz-group__hint",
3908
+ children: "↑ Click a row to drill down"
3909
+ })
3910
+ }),
3911
+ /* @__PURE__ */ c("div", {
3912
+ ref: k,
3913
+ className: "viz-group__charts",
3914
+ children: [e.flatMap((t, n) => {
3915
+ let r = _ === null ? n === e.length - 1 : n !== _, a = B(n) && x !== null && C !== null && z !== null, o = /* @__PURE__ */ c("div", {
3916
+ className: `viz-group__chart viz-group__chart--${t.type}${r ? " viz-group__chart--listener" : ""}`,
3917
+ children: [r && /* @__PURE__ */ s("div", {
3918
+ className: "viz-group__listener-label",
3919
+ children: _ === null ? null : p
3920
+ }), /* @__PURE__ */ s(pn, {
3921
+ config: t,
3922
+ colorOffset: i + n,
3923
+ onItemClick: (e, t, r) => P(n, e, t, r),
3924
+ selectedId: d,
3925
+ listenerItems: n !== _ && h ? h : void 0
3926
+ })]
3927
+ }, n);
3928
+ if (n === e.length - 1) return [o];
3929
+ let l = _ !== null && _ > n, u = l ? -.7 : Bn + .7, f = x !== null && z !== null ? x - z : l ? Bn + 20 : -20, m = `M ${a ? l ? Bn : 0 : f} ${L} H ${u}`;
3930
+ return [o, /* @__PURE__ */ s("div", {
3931
+ className: `viz-group__connector${I ? " viz-group__connector--active" : ""}`,
3932
+ children: /* @__PURE__ */ c("svg", {
3933
+ className: "viz-group__connector-svg",
3934
+ xmlns: "http://www.w3.org/2000/svg",
3935
+ "aria-hidden": "true",
3936
+ children: [
3937
+ !a && /* @__PURE__ */ s("line", {
3938
+ x1: f,
3939
+ y1: L - 7,
3940
+ x2: f,
3941
+ y2: L + 7,
3942
+ className: "viz-group__connector-tick"
3943
+ }),
3944
+ /* @__PURE__ */ s("path", {
3945
+ d: m,
3946
+ className: "viz-group__connector-path"
3947
+ }),
3948
+ /* @__PURE__ */ s("circle", {
3949
+ cx: u,
3950
+ cy: L,
3951
+ r: "4",
3952
+ className: "viz-group__connector-dot"
3953
+ })
3954
+ ]
3955
+ })
3956
+ }, `connector-${n}`)];
3957
+ }), V && /* @__PURE__ */ c("svg", {
3958
+ className: "viz-group__route-svg",
3959
+ xmlns: "http://www.w3.org/2000/svg",
3960
+ "aria-hidden": "true",
3961
+ children: [/* @__PURE__ */ s("line", {
3962
+ x1: x - 7,
3963
+ y1: C,
3964
+ x2: x + 7,
3965
+ y2: C,
3966
+ className: "viz-group__connector-tick"
3967
+ }), /* @__PURE__ */ s("path", {
3968
+ d: `M ${x} ${C} L ${x} ${L} H ${z}`,
3969
+ className: "viz-group__connector-path"
3970
+ })]
3971
+ })]
3972
+ })
3973
+ ]
3974
+ });
3975
+ }
3976
+ //#endregion
3977
+ export { V as AreaChart, W as BarChart, h as CHART_PALETTE, l as ChartFrame, yn as DonutChart, d as GRAD, Pn as KeyHighlights, He as LineChart, Ge as MiniBars, p as PALETTE, et as PieChart, ut as ProcessSankey, dt as RankingSankey, f as SOLID, nt as SankeySvg, B as SeriesChart, Ln as Takeaway, Ot as Trend, Ht as TrendChart, Vn as VisualizationGroup, pn as VisualizationRenderer, gn as cleanupVisualizationMounts, _n as hydrateVisualizationMounts, vn as serializeVisualizationConfig };