@divami-artefacts/ai-design-system 1.0.1

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 (93) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +315 -0
  3. package/dist/canvas/CanvasTooltip.d.ts +13 -0
  4. package/dist/canvas/CausalFlowCanvas.d.ts +16 -0
  5. package/dist/canvas/canvasUtils.d.ts +38 -0
  6. package/dist/canvas/easing.d.ts +23 -0
  7. package/dist/canvas/useCanvasInteraction.d.ts +45 -0
  8. package/dist/canvas/useCanvasLoop.d.ts +19 -0
  9. package/dist/components/areaChart/AreaChart.d.ts +2 -0
  10. package/dist/components/barChart/BarChart.d.ts +2 -0
  11. package/dist/components/chartFrame/ChartFrame.d.ts +2 -0
  12. package/dist/components/commitmentRace/CommitmentRace.d.ts +2 -0
  13. package/dist/components/commitmentRace/index.d.ts +2 -0
  14. package/dist/components/commitmentRace/styles.d.ts +1 -0
  15. package/dist/components/commitmentRace/types.d.ts +5 -0
  16. package/dist/components/common/SeriesChart.d.ts +2 -0
  17. package/dist/components/compensationGauge/CompensationGauge.d.ts +2 -0
  18. package/dist/components/compensationGauge/index.d.ts +2 -0
  19. package/dist/components/compensationGauge/styles.d.ts +1 -0
  20. package/dist/components/compensationGauge/types.d.ts +6 -0
  21. package/dist/components/constants.d.ts +6 -0
  22. package/dist/components/contractBars/ContractBars.d.ts +2 -0
  23. package/dist/components/contractBars/index.d.ts +2 -0
  24. package/dist/components/contractBars/styles.d.ts +1 -0
  25. package/dist/components/contractBars/types.d.ts +5 -0
  26. package/dist/components/contractValueOrb/ContractValueOrb.d.ts +2 -0
  27. package/dist/components/contractValueOrb/index.d.ts +2 -0
  28. package/dist/components/contractValueOrb/styles.d.ts +1 -0
  29. package/dist/components/contractValueOrb/types.d.ts +5 -0
  30. package/dist/components/contractorRank/ContractorRank.d.ts +2 -0
  31. package/dist/components/contractorRank/index.d.ts +2 -0
  32. package/dist/components/contractorRank/styles.d.ts +1 -0
  33. package/dist/components/contractorRank/types.d.ts +5 -0
  34. package/dist/components/donutChart/DonutChart.d.ts +2 -0
  35. package/dist/components/ewCategory/EWCategory.d.ts +2 -0
  36. package/dist/components/ewCategory/index.d.ts +2 -0
  37. package/dist/components/ewCategory/styles.d.ts +1 -0
  38. package/dist/components/ewCategory/types.d.ts +5 -0
  39. package/dist/components/hooks/useWorkspace.d.ts +6 -0
  40. package/dist/components/keyHighlights/KeyHighlights.d.ts +4 -0
  41. package/dist/components/lineChart/LineChart.d.ts +2 -0
  42. package/dist/components/miniBars/MiniBars.d.ts +2 -0
  43. package/dist/components/nceTree/NCETree.d.ts +2 -0
  44. package/dist/components/nceTree/index.d.ts +2 -0
  45. package/dist/components/nceTree/styles.d.ts +1 -0
  46. package/dist/components/nceTree/types.d.ts +6 -0
  47. package/dist/components/pieChart/PieChart.d.ts +2 -0
  48. package/dist/components/quotationBalance/QuotationBalance.d.ts +2 -0
  49. package/dist/components/quotationBalance/index.d.ts +2 -0
  50. package/dist/components/quotationBalance/styles.d.ts +1 -0
  51. package/dist/components/quotationBalance/types.d.ts +6 -0
  52. package/dist/components/quotationTrend/QuotationTrend.d.ts +2 -0
  53. package/dist/components/quotationTrend/index.d.ts +2 -0
  54. package/dist/components/quotationTrend/styles.d.ts +1 -0
  55. package/dist/components/quotationTrend/types.d.ts +5 -0
  56. package/dist/components/sankey/ProcessSankey.d.ts +2 -0
  57. package/dist/components/sankey/RankingSankey.d.ts +2 -0
  58. package/dist/components/sankey/SankeySvg.d.ts +2 -0
  59. package/dist/components/sankey/index.d.ts +3 -0
  60. package/dist/components/severityBands/SeverityBands.d.ts +2 -0
  61. package/dist/components/severityBands/index.d.ts +2 -0
  62. package/dist/components/severityBands/styles.d.ts +1 -0
  63. package/dist/components/severityBands/types.d.ts +5 -0
  64. package/dist/components/statusArc/StatusArc.d.ts +2 -0
  65. package/dist/components/statusArc/index.d.ts +2 -0
  66. package/dist/components/statusArc/styles.d.ts +1 -0
  67. package/dist/components/statusArc/types.d.ts +9 -0
  68. package/dist/components/trendChart/TrendChart.d.ts +2 -0
  69. package/dist/components/variationSplit/VariationSplit.d.ts +2 -0
  70. package/dist/components/variationSplit/index.d.ts +2 -0
  71. package/dist/components/variationSplit/styles.d.ts +1 -0
  72. package/dist/components/variationSplit/types.d.ts +5 -0
  73. package/dist/components/visualizationRenderer/VisualizationRenderer.d.ts +2 -0
  74. package/dist/components/weeklyFlow/WeeklyFlow.d.ts +2 -0
  75. package/dist/components/weeklyFlow/index.d.ts +2 -0
  76. package/dist/components/weeklyFlow/styles.d.ts +1 -0
  77. package/dist/components/weeklyFlow/types.d.ts +5 -0
  78. package/dist/components/workspaceShell/WorkspaceShell.d.ts +1 -0
  79. package/dist/hooks/useWorkspace.d.ts +6 -0
  80. package/dist/index.cjs +1 -0
  81. package/dist/index.d.ts +14 -0
  82. package/dist/index.js +3019 -0
  83. package/dist/mocks/workspace.mock.d.ts +378 -0
  84. package/dist/pages/chartGallery/ChartGalleryPage.d.ts +1 -0
  85. package/dist/pages/projectDashboard/ProjectDashboardPage.d.ts +1 -0
  86. package/dist/pages/projectDashboard/index.d.ts +2 -0
  87. package/dist/pages/projectDashboard/styles.d.ts +4 -0
  88. package/dist/pages/projectDashboard/types.d.ts +3 -0
  89. package/dist/pages/workspace/WorkspacePage.d.ts +1 -0
  90. package/dist/types/index.d.ts +344 -0
  91. package/dist/utils/mounts.d.ts +4 -0
  92. package/dist/utils/workspace.utils.d.ts +17 -0
  93. package/package.json +53 -0
package/dist/index.js ADDED
@@ -0,0 +1,3019 @@
1
+ import { createRoot as e } from "react-dom/client";
2
+ import { useCallback as t, useEffect as n, useLayoutEffect as r, useMemo as i, useRef as a, useState as o } from "react";
3
+ import { jsx as s, jsxs as c } from "react/jsx-runtime";
4
+ //#region src/components/chartFrame/ChartFrame.tsx
5
+ function l({ children: e, className: t = "" }) {
6
+ return /* @__PURE__ */ s("div", {
7
+ className: `d3-chart ${t}`.trim(),
8
+ children: e
9
+ });
10
+ }
11
+ //#endregion
12
+ //#region src/canvas/canvasUtils.ts
13
+ var u = {
14
+ bg: "#070B12",
15
+ bgL: "#0C1420",
16
+ sf: "#111B28",
17
+ bd: "#1C2D42",
18
+ blue: "#3B8BF6",
19
+ cyan: "#22D3EE",
20
+ orange: "#F0813A",
21
+ red: "#F06060",
22
+ green: "#34D399",
23
+ purple: "#A78BFA",
24
+ amber: "#FBBF24",
25
+ t1: "#F1F5F9",
26
+ t2: "#94A3B8",
27
+ t3: "#64748B",
28
+ t4: "#334155"
29
+ }, d = [
30
+ u.blue,
31
+ u.cyan,
32
+ u.amber,
33
+ u.purple,
34
+ u.green,
35
+ u.red
36
+ ];
37
+ function f(e, t = 1) {
38
+ let n = e.replace("#", "");
39
+ return `rgba(${parseInt(n.substring(0, 2), 16)},${parseInt(n.substring(2, 4), 16)},${parseInt(n.substring(4, 6), 16)},${t})`;
40
+ }
41
+ function p(e, t, n) {
42
+ return e + (t - e) * n;
43
+ }
44
+ function m(e, t, n) {
45
+ let r = (e) => {
46
+ let t = e.replace("#", "");
47
+ return [
48
+ parseInt(t.substring(0, 2), 16),
49
+ parseInt(t.substring(2, 4), 16),
50
+ parseInt(t.substring(4, 6), 16)
51
+ ];
52
+ }, [i, a, o] = r(e), [s, c, l] = r(t), u = (e) => Math.max(0, Math.min(255, Math.round(e)));
53
+ return [
54
+ u(p(i, s, n)),
55
+ u(p(a, c, n)),
56
+ u(p(o, l, n))
57
+ ].map((e) => e.toString(16).padStart(2, "0")).join("").replace(/^/, "#");
58
+ }
59
+ function h(e, t, n, r = 2) {
60
+ e.width = t * r, e.height = n * r;
61
+ let i = e.getContext("2d");
62
+ return i.scale(r, r), i;
63
+ }
64
+ function g(e, t, n, r, i, a = .3) {
65
+ let o = e.createRadialGradient(t, n, 0, t, n, r);
66
+ o.addColorStop(0, f(i, a)), o.addColorStop(1, f(i, 0)), e.fillStyle = o, e.beginPath(), e.arc(t, n, r, 0, Math.PI * 2), e.fill();
67
+ }
68
+ function _(e, t, n, r, i = 50, a = f(u.blue, .05)) {
69
+ 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();
70
+ }
71
+ function v(e, t, n, r, i = .015) {
72
+ e.fillStyle = `rgba(0,0,0,${i})`;
73
+ let a = r * .5 % 6;
74
+ for (let r = a; r < n; r += 3) e.fillRect(0, r, t, 1);
75
+ }
76
+ function y(e, t, n, r, i = f(u.t1, .08)) {
77
+ e.strokeStyle = i, e.lineWidth = 1, e.setLineDash([3, 3]), e.beginPath(), e.moveTo(t, n), e.lineTo(t, r), e.stroke(), e.setLineDash([]);
78
+ }
79
+ //#endregion
80
+ //#region src/canvas/CanvasTooltip.tsx
81
+ function b({ visible: e, x: t, y: n, content: i, parentW: o }) {
82
+ let l = a(null);
83
+ if (r(() => {
84
+ let r = l.current;
85
+ if (!r) return;
86
+ let a = r.offsetWidth, s = t - a / 2, c = n - 58;
87
+ s < 4 && (s = 4), s + a > (o ?? 400) - 4 && (s = (o ?? 400) - a - 4), c < 4 && (c = n + 16), r.style.transform = `translate(${s}px, ${c}px)`, r.style.opacity = e ? "1" : "0";
88
+ let d = i && typeof i == "object" && i.color ? i.color : u.blue;
89
+ r.style.setProperty("--tooltip-accent", d ?? u.blue);
90
+ }, [
91
+ e,
92
+ t,
93
+ n,
94
+ o,
95
+ i
96
+ ]), !i) return null;
97
+ let d = typeof i == "object", f = d ? i.label : null, p = d ? i.value : i, m = d ? i.sublabel : null;
98
+ return /* @__PURE__ */ c("div", {
99
+ ref: l,
100
+ style: {
101
+ position: "absolute",
102
+ top: 0,
103
+ left: 0,
104
+ minWidth: 80,
105
+ pointerEvents: "none",
106
+ background: u.sf,
107
+ border: `1px solid ${u.bd}`,
108
+ borderLeft: "2px solid var(--tooltip-accent)",
109
+ borderRadius: 6,
110
+ padding: "6px 10px",
111
+ opacity: 0,
112
+ transition: "opacity 0.15s ease",
113
+ zIndex: 20,
114
+ fontFamily: "'JetBrains Mono', monospace"
115
+ },
116
+ children: [
117
+ f && /* @__PURE__ */ s("div", {
118
+ style: {
119
+ fontFamily: "'DM Sans', sans-serif",
120
+ fontSize: 10,
121
+ color: u.t3,
122
+ marginBottom: 2,
123
+ whiteSpace: "nowrap"
124
+ },
125
+ children: f
126
+ }),
127
+ /* @__PURE__ */ s("div", {
128
+ style: {
129
+ fontSize: 11,
130
+ color: u.t1,
131
+ fontWeight: 600,
132
+ whiteSpace: "nowrap"
133
+ },
134
+ children: p
135
+ }),
136
+ m && /* @__PURE__ */ s("div", {
137
+ style: {
138
+ fontSize: 9,
139
+ color: "var(--tooltip-accent)",
140
+ marginTop: 2,
141
+ whiteSpace: "nowrap"
142
+ },
143
+ children: m
144
+ })
145
+ ]
146
+ });
147
+ }
148
+ //#endregion
149
+ //#region src/canvas/useCanvasInteraction.ts
150
+ function x(e, { width: r, height: i, onClick: s, enabled: c = !0 }) {
151
+ let l = a({
152
+ x: -1,
153
+ y: -1,
154
+ over: !1
155
+ }), u = a(null), d = a([]), f = a(null), [p, m] = o({
156
+ visible: !1,
157
+ x: 0,
158
+ y: 0,
159
+ content: null
160
+ }), h = t((e, t, n) => {
161
+ f.current && clearTimeout(f.current), f.current = setTimeout(() => {
162
+ m({
163
+ visible: !0,
164
+ x: e,
165
+ y: t,
166
+ content: n
167
+ });
168
+ }, 30);
169
+ }, []), g = t(() => {
170
+ f.current && clearTimeout(f.current), m((e) => e.visible ? {
171
+ visible: !1,
172
+ x: e.x,
173
+ y: e.y,
174
+ content: e.content
175
+ } : e);
176
+ }, []);
177
+ return n(() => {
178
+ let t = e.current;
179
+ if (!t || !c) return;
180
+ let n = (e) => {
181
+ let n = t.getBoundingClientRect(), a = r / n.width, o = i / n.height;
182
+ l.current.x = (e.clientX - n.left) * a, l.current.y = (e.clientY - n.top) * o, l.current.over = !0;
183
+ let s = null, c = d.current;
184
+ for (let e = c.length - 1; e >= 0; e--) if (c[e].test(l.current.x, l.current.y)) {
185
+ s = c[e];
186
+ break;
187
+ }
188
+ let f = u.current;
189
+ u.current = s ? s.id : null, t.style.cursor = s ? "pointer" : "default", s ? h((e.clientX - n.left) * a, (e.clientY - n.top) * o, s.data) : f && g();
190
+ }, a = () => {
191
+ l.current = {
192
+ x: -1,
193
+ y: -1,
194
+ over: !1
195
+ }, u.current && (u.current = null, t.style.cursor = "default", g());
196
+ }, o = () => {
197
+ if (u.current && s) {
198
+ let e = d.current.find((e) => e.id === u.current);
199
+ e && s(e.id, e.data);
200
+ }
201
+ };
202
+ return t.addEventListener("mousemove", n), t.addEventListener("mouseleave", a), t.addEventListener("click", o), () => {
203
+ t.removeEventListener("mousemove", n), t.removeEventListener("mouseleave", a), t.removeEventListener("click", o), f.current && clearTimeout(f.current);
204
+ };
205
+ }, [
206
+ e,
207
+ r,
208
+ i,
209
+ c,
210
+ s,
211
+ h,
212
+ g
213
+ ]), {
214
+ mouseRef: l,
215
+ hoveredRef: u,
216
+ tooltip: p,
217
+ showTooltip: h,
218
+ hideTooltip: g,
219
+ hitZonesRef: d
220
+ };
221
+ }
222
+ function S(e, t, n, r, i, a) {
223
+ e.push({
224
+ id: t,
225
+ data: a,
226
+ test: (e, t) => (e - n) ** 2 + (t - r) ** 2 <= i * i
227
+ });
228
+ }
229
+ function C(e, t, n, r, i, a, o) {
230
+ e.push({
231
+ id: t,
232
+ data: o,
233
+ test: (e, t) => e >= n && e <= n + i && t >= r && t <= r + a
234
+ });
235
+ }
236
+ //#endregion
237
+ //#region src/canvas/easing.ts
238
+ var w = (e) => 1 - (1 - e) ** 3, T = (e) => 1 - (1 - e) ** 4, E = (e) => e === 1 ? 1 : 1 - 2 ** (-10 * e), D = (e) => {
239
+ let t = 1.70158;
240
+ return 1 + (t + 1) * (e - 1) ** 3 + t * (e - 1) ** 2;
241
+ }, O = (e, t = .04, n = .001) => Math.sin(e * t) * Math.exp(-Math.min(e * n, 4)), k = (e, t, n, r = w) => {
242
+ let i = Math.min(.06, .5 / n), a = t * i, o = 1 - (n - 1) * i;
243
+ return r(Math.max(0, Math.min((e - a) / o, 1)));
244
+ };
245
+ function A(e, t, n = .12) {
246
+ e.forEach((r, i) => {
247
+ let a = i === t ? 1 : 0, o = r + (a - r) * n;
248
+ Math.abs(o - a) < .005 ? a === 0 ? e.delete(i) : e.set(i, 1) : e.set(i, o);
249
+ }), t && !e.has(t) && e.set(t, 0);
250
+ }
251
+ //#endregion
252
+ //#region src/components/common/SeriesChart.tsx
253
+ var j = 760, M = 250;
254
+ function N({ rows: e = [], variant: t, className: r, colors: i }) {
255
+ let o = a(null), d = a(/* @__PURE__ */ new Map()), p = a(0), { mouseRef: m, hoveredRef: _, tooltip: v, hitZonesRef: C } = x(o, {
256
+ width: j,
257
+ height: M
258
+ });
259
+ return n(() => {
260
+ let n = o.current;
261
+ if (!n) return;
262
+ let r = h(n, j, M);
263
+ p.current = 0;
264
+ let a = i?.line ?? u.blue, s = i?.point ?? u.blue, c = i?.axisLine ?? u.bd, l = i?.areaFill ?? u.blue, v = {
265
+ top: 24,
266
+ right: 24,
267
+ bottom: 44,
268
+ left: 24
269
+ }, b = j - v.left - v.right, x = M - v.top - v.bottom, w, T = () => {
270
+ p.current++;
271
+ let n = p.current;
272
+ if (r.clearRect(0, 0, j, M), e.length < 2) {
273
+ w = requestAnimationFrame(T);
274
+ return;
275
+ }
276
+ let i = e.map((e) => e.pricing ?? 0), o = Math.max(100, ...i), h = (t) => v.left + t / (e.length - 1) * b, D = (e) => v.top + (1 - e / o) * x, k = E(Math.min(n / 48, 1)), N = Math.max(2, Math.floor(k * e.length));
277
+ A(d.current, _.current), C.current = [], r.strokeStyle = f(u.bd, .2), r.lineWidth = .5;
278
+ for (let e = 0; e <= 4; e++) {
279
+ let t = v.top + e / 4 * x;
280
+ r.beginPath(), r.moveTo(v.left, t), r.lineTo(v.left + b, t), r.stroke();
281
+ }
282
+ if (r.strokeStyle = f(c, .4), r.lineWidth = 1, r.setLineDash([]), r.beginPath(), r.moveTo(v.left, D(0)), r.lineTo(v.left + b, D(0)), r.stroke(), m.current.over && _.current) {
283
+ let e = parseInt(_.current.split("-")[1]);
284
+ isNaN(e) || y(r, h(e), v.top, v.top + x);
285
+ }
286
+ if (t === "area" && N > 1) {
287
+ let t = r.createLinearGradient(0, v.top, 0, v.top + x);
288
+ t.addColorStop(0, f(l, .12)), t.addColorStop(1, f(l, 0)), r.fillStyle = t, r.beginPath(), r.moveTo(h(0), v.top + x);
289
+ for (let t = 0; t < N; t++) r.lineTo(h(t), D(e[t].pricing ?? 0));
290
+ r.lineTo(h(N - 1), v.top + x), r.closePath(), r.fill();
291
+ }
292
+ if (N > 1) {
293
+ r.strokeStyle = f(a, .85), r.lineWidth = 2, r.setLineDash([]), r.beginPath();
294
+ for (let t = 0; t < N; t++) {
295
+ let n = h(t), i = D(e[t].pricing ?? 0);
296
+ t === 0 ? r.moveTo(n, i) : r.lineTo(n, i);
297
+ }
298
+ r.stroke();
299
+ }
300
+ for (let i = 0; i < N; i++) {
301
+ let a = h(i), o = D(e[i].pricing ?? 0), c = `sc-${i}`, l = d.current.get(c) ?? 0, p = i === e.length - 1;
302
+ S(C.current, c, a, o, 12, {
303
+ label: e[i].vendor,
304
+ value: String(e[i].pricing ?? 0),
305
+ color: p ? u.red : s
306
+ }), l > 0 && g(r, a, o, 16 * l, s, .2 * l);
307
+ let m = p ? O(n, .05, 5e-4) : 0, _ = t === "area" ? 5 : 6;
308
+ p ? (r.shadowColor = f(u.red, .5), r.shadowBlur = (8 + m * 4) * (1 + l * .5), r.fillStyle = u.red, r.beginPath(), r.arc(a, o, (_ + m * 1.5) * (1 + l * .3), 0, Math.PI * 2), r.fill(), r.shadowBlur = 0) : (r.fillStyle = f(s, .7 + l * .3), r.beginPath(), r.arc(a, o, _ + l * 2, 0, Math.PI * 2), r.fill()), r.font = "10px 'JetBrains Mono', monospace", r.fillStyle = f(u.t3, .6 + l * .3), r.textAlign = "center", r.fillText(e[i].vendor, a, M - 14);
309
+ }
310
+ w = requestAnimationFrame(T);
311
+ };
312
+ return T(), () => cancelAnimationFrame(w);
313
+ }, [
314
+ e,
315
+ t,
316
+ i
317
+ ]), /* @__PURE__ */ s(l, {
318
+ className: r,
319
+ children: /* @__PURE__ */ c("div", {
320
+ style: {
321
+ position: "relative",
322
+ width: j,
323
+ height: M
324
+ },
325
+ children: [/* @__PURE__ */ s("canvas", {
326
+ ref: o,
327
+ role: "img",
328
+ "aria-label": `${t} chart`,
329
+ style: {
330
+ width: j,
331
+ height: M,
332
+ display: "block",
333
+ borderRadius: 8
334
+ }
335
+ }), /* @__PURE__ */ s(b, {
336
+ ...v,
337
+ parentW: j,
338
+ parentH: M
339
+ })]
340
+ })
341
+ });
342
+ }
343
+ //#endregion
344
+ //#region src/components/areaChart/AreaChart.tsx
345
+ function ee({ rows: e = [], className: t, colors: n }) {
346
+ return /* @__PURE__ */ s(N, {
347
+ rows: e,
348
+ variant: "area",
349
+ className: t,
350
+ colors: n
351
+ });
352
+ }
353
+ //#endregion
354
+ //#region src/components/barChart/BarChart.tsx
355
+ var P = 760, F = 280;
356
+ function te({ rows: e = [], className: t, colors: r }) {
357
+ let i = a(null), o = a(/* @__PURE__ */ new Map()), p = a(0), { hoveredRef: m, tooltip: _, hitZonesRef: v } = x(i, {
358
+ width: P,
359
+ height: F
360
+ });
361
+ return n(() => {
362
+ let t = i.current;
363
+ if (!t) return;
364
+ let n = h(t, P, F);
365
+ p.current = 0;
366
+ let a = r?.bars ?? d, s = r?.axisLine ?? u.bd, c = r?.valueLabel ?? u.t2, l = {
367
+ top: 24,
368
+ right: 24,
369
+ bottom: 56,
370
+ left: 24
371
+ }, _ = F - l.top - l.bottom, y = (P - l.left - l.right) / Math.max(e.length, 1), b = Math.max(100, ...e.map((e) => e.pricing ?? 0)), x = l.top + _, S, w = () => {
372
+ p.current++;
373
+ let t = p.current;
374
+ n.clearRect(0, 0, P, F);
375
+ let r = T(Math.min(t / 48, 1));
376
+ A(o.current, m.current), v.current = [], n.strokeStyle = f(s, .4), n.lineWidth = 1, n.setLineDash([]), n.beginPath(), n.moveTo(l.left, x), n.lineTo(P - l.right, x), n.stroke(), e.forEach((t, i) => {
377
+ let s = l.left + i * y, d = k(r, i, e.length, T), p = b > 0 ? (t.pricing ?? 0) / b * _ : 0, m = Math.max(p > 0 ? 4 : 0, p * d), h = a[i % a.length], S = o.current.get(t.id ?? `bar-${i}`) ?? 0;
378
+ C(v.current, t.id ?? `bar-${i}`, s + 4, x - m, y - 8, m, {
379
+ label: t.vendor,
380
+ value: String(t.pricing ?? 0),
381
+ color: h
382
+ }), m > 0 && (S > 0 && g(n, s + y / 2, x - m / 2, y * .8, h, .12 * S), n.shadowColor = f(h, .2 * (S > 0 ? S : 0)), n.shadowBlur = S > 0 ? 6 : 0, n.fillStyle = f(h, .5 + S * .25), n.beginPath(), n.roundRect(s + 4, x - m, y - 8, m, [
383
+ 4,
384
+ 4,
385
+ 0,
386
+ 0
387
+ ]), n.fill(), n.shadowBlur = 0, S > 0 && (n.strokeStyle = f(h, .4 * S), n.lineWidth = 1, n.beginPath(), n.roundRect(s + 4, x - m, y - 8, m, [
388
+ 4,
389
+ 4,
390
+ 0,
391
+ 0
392
+ ]), n.stroke())), d > .5 && m > 0 && (n.globalAlpha = Math.min(1, (d - .5) * 2), n.font = "bold 10px 'JetBrains Mono', monospace", n.fillStyle = S > 0 ? h : f(c, .7), n.textAlign = "center", n.fillText(String(t.pricing ?? ""), s + y / 2, x - m - 6), n.globalAlpha = 1), n.font = `${S > 0 ? "bold " : ""}9px 'JetBrains Mono', monospace`, n.fillStyle = S > 0 ? h : f(u.t3, .6), n.textAlign = "center", n.fillText(t.vendor, s + y / 2, F - 14);
393
+ }), S = requestAnimationFrame(w);
394
+ };
395
+ return w(), () => cancelAnimationFrame(S);
396
+ }, [e, r]), /* @__PURE__ */ s(l, {
397
+ className: t,
398
+ children: /* @__PURE__ */ c("div", {
399
+ style: {
400
+ position: "relative",
401
+ width: P,
402
+ height: F
403
+ },
404
+ children: [/* @__PURE__ */ s("canvas", {
405
+ ref: i,
406
+ role: "img",
407
+ "aria-label": "bar chart",
408
+ style: {
409
+ width: P,
410
+ height: F,
411
+ display: "block",
412
+ borderRadius: 8
413
+ }
414
+ }), /* @__PURE__ */ s(b, {
415
+ ..._,
416
+ parentW: P,
417
+ parentH: F
418
+ })]
419
+ })
420
+ });
421
+ }
422
+ //#endregion
423
+ //#region src/components/commitmentRace/CommitmentRace.tsx
424
+ var I = 680, L = 300, ne = [
425
+ u.green,
426
+ u.blue,
427
+ u.cyan,
428
+ u.amber,
429
+ u.red
430
+ ];
431
+ function re({ contractors: e, "data-testid": t }) {
432
+ let r = a(null), i = a(0), o = a(/* @__PURE__ */ new Map()), l = [...e].sort((e, t) => t.commitmentPct - e.commitmentPct), { hoveredRef: d, tooltip: p, hitZonesRef: m } = x(r, {
433
+ width: I,
434
+ height: L
435
+ });
436
+ return n(() => {
437
+ let e = r.current;
438
+ if (!e) return;
439
+ let t = h(e, I, L);
440
+ i.current = 0;
441
+ let n = I * .13, a = I * .08, s = L * .08, c = L * .14, p = I - n - a, y, b = () => {
442
+ i.current++;
443
+ let e = i.current;
444
+ t.clearRect(0, 0, I, L), m.current = [], o.current.forEach((e, t) => {
445
+ let n = t === d.current ? 1 : 0, r = e + (n - e) * .12;
446
+ Math.abs(r - n) < .005 ? n === 0 ? o.current.delete(t) : o.current.set(t, 1) : o.current.set(t, r);
447
+ }), d.current && !o.current.has(d.current) && o.current.set(d.current, 0), _(t, I, L, e, 40, f(u.blue, .04)), l.forEach((r, i) => {
448
+ let a = ne[i % ne.length], l = o.current.get(r.id) ?? 0, d = s + i * (c + 10);
449
+ t.fillStyle = f(a, .04 + l * .04), t.beginPath(), t.roundRect(n, d, p, c, 3), t.fill(), t.strokeStyle = f(a, .08), t.lineWidth = 1, t.setLineDash([4, 4]), t.beginPath(), t.moveTo(n, d + c / 2), t.lineTo(n + p, d + c / 2), t.stroke(), t.setLineDash([]);
450
+ let h = r.commitmentPct / 100, _ = n + p * Math.min(h, h * w(Math.min(1, e * .005)));
451
+ if (_ > n + 4) {
452
+ let e = t.createLinearGradient(n, 0, _, 0);
453
+ e.addColorStop(0, f(a, .02)), e.addColorStop(1, f(a, .25 + l * .15)), t.fillStyle = e, t.beginPath(), t.roundRect(n, d + 2, _ - n, c - 4, 2), t.fill();
454
+ }
455
+ g(t, _, d + c / 2, 18 + l * 8, a, .3 + l * .2), t.beginPath(), t.arc(_, d + c / 2, 5 + l * 2, 0, Math.PI * 2), t.fillStyle = f(a, .9), t.fill(), S(m.current, r.id, _, d + c / 2, 14, {
456
+ label: r.name,
457
+ value: `${r.commitmentPct}% commitment`,
458
+ sublabel: `Base: £${r.base}M · Variations: £${r.variations}M`,
459
+ color: a
460
+ }), t.font = "bold 10px 'JetBrains Mono', monospace", t.fillStyle = f(a, .9 + l * .1), t.textAlign = "left", t.textBaseline = "middle", t.fillText(`${r.commitmentPct}%`, _ + 10, d + c / 2), t.font = `${l > 0 ? "bold " : ""}10px 'JetBrains Mono', monospace`, t.fillStyle = l > 0 ? a : f(u.t2, .8), t.textAlign = "right", t.fillText(r.shortName, n - 8, d + c / 2);
461
+ }), t.strokeStyle = f(u.t3, .3), t.lineWidth = 1, t.setLineDash([]), t.beginPath(), t.moveTo(n + p, s), t.lineTo(n + p, s + (l.length - 1) * (c + 10) + c), t.stroke(), v(t, I, L, e, .015), y = requestAnimationFrame(b);
462
+ };
463
+ return b(), () => cancelAnimationFrame(y);
464
+ }, [l]), /* @__PURE__ */ c("div", {
465
+ "data-testid": t,
466
+ style: {
467
+ position: "relative",
468
+ width: I,
469
+ height: L
470
+ },
471
+ children: [/* @__PURE__ */ s("canvas", {
472
+ ref: r,
473
+ role: "img",
474
+ "aria-label": "Commitment race — contractors ranked by commitment percentage",
475
+ style: {
476
+ width: I,
477
+ height: L,
478
+ display: "block",
479
+ borderRadius: 8
480
+ }
481
+ }), /* @__PURE__ */ s(b, {
482
+ ...p,
483
+ parentW: I,
484
+ parentH: L
485
+ })]
486
+ });
487
+ }
488
+ //#endregion
489
+ //#region src/components/compensationGauge/CompensationGauge.tsx
490
+ var ie = 480, ae = 340;
491
+ function oe({ pct: e, confirmed: t, total: r, "data-testid": i }) {
492
+ let o = a(null), c = a(0);
493
+ return n(() => {
494
+ let n = o.current;
495
+ if (!n) return;
496
+ let i = h(n, ie, ae);
497
+ c.current = 0;
498
+ let a = ie / 2, s = Math.PI, l = 2 * Math.PI, d = Math.PI, p, m = () => {
499
+ c.current++;
500
+ let n = c.current;
501
+ i.clearRect(0, 0, ie, ae);
502
+ let o = w(Math.min(n / 80, 1)), h = D(Math.min(n / 72, 1));
503
+ i.beginPath(), i.arc(a, 220, 120, s, l), i.strokeStyle = f(u.bd, .35), i.lineWidth = 46, i.stroke(), [
504
+ {
505
+ start: 0,
506
+ end: .33,
507
+ color: u.red
508
+ },
509
+ {
510
+ start: .33,
511
+ end: .66,
512
+ color: u.amber
513
+ },
514
+ {
515
+ start: .66,
516
+ end: 1,
517
+ color: u.green
518
+ }
519
+ ].forEach((e) => {
520
+ let t = s + e.start * d, n = s + e.end * d;
521
+ i.beginPath(), i.arc(a, 220, 194 / 2, t, n), i.strokeStyle = f(e.color, .12), i.lineWidth = 42, i.stroke();
522
+ }), [
523
+ {
524
+ label: "Low",
525
+ angle: s + .16 * d
526
+ },
527
+ {
528
+ label: "Mid",
529
+ angle: s + .5 * d
530
+ },
531
+ {
532
+ label: "High",
533
+ angle: s + .84 * d
534
+ }
535
+ ].forEach(({ label: e, angle: t }) => {
536
+ let n = a + Math.cos(t) * 166, r = 220 + Math.sin(t) * 166;
537
+ i.font = "13px 'JetBrains Mono', monospace", i.fillStyle = f(u.t3, .55), i.textAlign = "center", i.fillText(e, n, r + 3);
538
+ });
539
+ let _ = s + e / 100 * d * o, v = e >= 66 ? u.green : e >= 33 ? u.amber : u.red;
540
+ g(i, a + Math.cos(_) * 194 / 2, 220 + Math.sin(_) * 194 / 2, 18, v, .35 * o), i.beginPath(), i.arc(a, 220, 194 / 2, s, _), i.strokeStyle = f(v, .7 * o), i.lineWidth = 38, i.lineCap = "round", i.stroke(), i.lineCap = "butt";
541
+ let y = s + e / 100 * d * h, b = a + Math.cos(y) * 82, x = 220 + Math.sin(y) * 82, S = a - Math.cos(y) * 14, C = 220 - Math.sin(y) * 14;
542
+ i.strokeStyle = f(v, .18 * h), i.lineWidth = 6, i.lineCap = "round", i.beginPath(), i.moveTo(S, C), i.lineTo(b, x), i.stroke(), i.strokeStyle = f(u.t1, .92 * h), i.lineWidth = 2, i.lineCap = "round", i.beginPath(), i.moveTo(S, C), i.lineTo(b, x), i.stroke(), i.beginPath(), i.arc(b, x, 3, 0, Math.PI * 2), i.fillStyle = f(v, .9 * h), i.fill(), g(i, a, 220, 20, v, .25 * h), i.beginPath(), i.arc(a, 220, 9, 0, Math.PI * 2), i.strokeStyle = f(v, .5 * h), i.lineWidth = 1.5, i.stroke(), i.beginPath(), i.arc(a, 220, 5, 0, Math.PI * 2), i.fillStyle = u.t1, i.fill(), o > .5 && (i.globalAlpha = Math.min(1, (o - .5) / .5), i.font = "bold 22px 'JetBrains Mono', monospace", i.fillStyle = v, i.textAlign = "center", i.fillText(`${Math.round(e * h)}%`, a, 182), i.globalAlpha = 1), o > .7 && (i.globalAlpha = Math.min(1, (o - .7) / .3), i.font = "13px 'JetBrains Mono', monospace", i.fillStyle = u.t2, i.textAlign = "center", i.fillText("NCEs confirmed", a, 252), i.font = "bold 11px 'JetBrains Mono', monospace", i.fillStyle = u.t2, i.fillText(`${t} of ${r} NCEs are confirmed compensation events`, a, 272), i.globalAlpha = 1);
543
+ for (let e = 0; e <= 10; e++) {
544
+ let t = s + e / 10 * d;
545
+ if (i.strokeStyle = f(u.bd, .5), i.lineWidth = e % 5 == 0 ? 1.5 : .8, i.beginPath(), i.moveTo(a + Math.cos(t) * 122, 220 + Math.sin(t) * 122), i.lineTo(a + Math.cos(t) * 128, 220 + Math.sin(t) * 128), i.stroke(), e % 5 == 0) {
546
+ let n = a + Math.cos(t) * 138, r = 220 + Math.sin(t) * 138;
547
+ i.font = "11px 'JetBrains Mono', monospace", i.fillStyle = f(u.t3, .45), i.textAlign = "center", i.fillText(`${e * 10}%`, n, r + 3);
548
+ }
549
+ }
550
+ p = requestAnimationFrame(m);
551
+ };
552
+ return m(), () => cancelAnimationFrame(p);
553
+ }, [
554
+ e,
555
+ t,
556
+ r
557
+ ]), /* @__PURE__ */ s("div", {
558
+ "data-testid": i,
559
+ style: {
560
+ position: "relative",
561
+ width: ie,
562
+ height: ae
563
+ },
564
+ children: /* @__PURE__ */ s("canvas", {
565
+ ref: o,
566
+ role: "img",
567
+ "aria-label": `Compensation event gauge — ${e}% of NCEs confirmed as compensation events`,
568
+ style: {
569
+ width: ie,
570
+ height: ae,
571
+ display: "block"
572
+ }
573
+ })
574
+ });
575
+ }
576
+ //#endregion
577
+ //#region src/canvas/useCanvasLoop.ts
578
+ function se(e, t, r, i, o = !0, s = {}) {
579
+ let c = a(0), { easing: l = w, durationFrames: u = 48 } = s;
580
+ n(() => {
581
+ let n = e.current;
582
+ if (!n || !t || !r) return;
583
+ let a = n.getContext("2d");
584
+ if (!a) return;
585
+ n.width = t * 2, n.height = r * 2, a.scale(2, 2);
586
+ let s;
587
+ c.current = 0;
588
+ let d = () => {
589
+ c.current++;
590
+ let e = c.current;
591
+ a.clearRect(0, 0, t, r);
592
+ let n = o ? Math.min(e / u, 1) : 1;
593
+ if (i(a, l(n), e), n < 1) s = requestAnimationFrame(d);
594
+ else {
595
+ let e = () => {
596
+ c.current++, a.clearRect(0, 0, t, r), i(a, 1, c.current), s = requestAnimationFrame(e);
597
+ };
598
+ s = requestAnimationFrame(e);
599
+ }
600
+ };
601
+ return d(), () => cancelAnimationFrame(s);
602
+ }, [
603
+ t,
604
+ r,
605
+ o
606
+ ]);
607
+ }
608
+ //#endregion
609
+ //#region src/components/contractBars/ContractBars.tsx
610
+ var R = 780, ce = 234, le = 130, ue = 52, de = [
611
+ u.blue,
612
+ u.cyan,
613
+ u.amber,
614
+ u.purple,
615
+ u.green
616
+ ], fe = [
617
+ "Base Value",
618
+ "Variations",
619
+ "Commitment"
620
+ ], pe = [
621
+ "Base",
622
+ "Var",
623
+ "Commit"
624
+ ];
625
+ function me({ contractors: e, "data-testid": t }) {
626
+ let n = a(null), r = a(/* @__PURE__ */ new Map()), { hoveredRef: o, tooltip: l, hitZonesRef: d } = x(n, {
627
+ width: R,
628
+ height: ce
629
+ }), p = i(() => {
630
+ let t = Math.max(...e.map((e) => e.base)), n = Math.max(...e.map((e) => e.variations));
631
+ return e.map((e, r) => {
632
+ let i = R * (.12 + r * .19), a = le, o = Math.min(R * .075, ue), s = de[r % de.length], c = [
633
+ e.base / t * 100,
634
+ e.variations / n * 100,
635
+ e.commitmentPct
636
+ ], l = [
637
+ `£${e.base}M`,
638
+ `£${e.variations}M`,
639
+ `${e.commitmentPct}%`
640
+ ], u = c.map((e, t) => {
641
+ let n = -Math.PI / 2 + t / fe.length * Math.PI * 2, r = e / 100, s = o * Math.max(.08, r);
642
+ return {
643
+ name: fe[t],
644
+ short: pe[t],
645
+ label: l[t],
646
+ val: Math.round(e),
647
+ x: i + Math.cos(n) * s,
648
+ y: a + Math.sin(n) * s,
649
+ angle: n,
650
+ norm: r
651
+ };
652
+ }), d = u.reduce((e, t) => e + t.x, 0) / u.length, f = u.reduce((e, t) => e + t.y, 0) / u.length, p = Math.sqrt(u.reduce((e, t) => e + (t.x - d) ** 2 + (t.y - f) ** 2, 0) / u.length);
653
+ return {
654
+ ...e,
655
+ cx: i,
656
+ cy: a,
657
+ baseR: o,
658
+ stars: u,
659
+ scatter: p,
660
+ color: s
661
+ };
662
+ });
663
+ }, [e]);
664
+ return se(n, R, ce, (e, t, n) => {
665
+ A(r.current, o.current), d.current = [], _(e, R, ce, n, 30), p.forEach((t, i) => {
666
+ let a = t.color, o = `constellation-${i}`, s = r.current.get(o) ?? 0;
667
+ e.beginPath(), e.arc(t.cx, t.cy, t.baseR + 5, 0, Math.PI * 2), e.strokeStyle = f(u.bd, .08 + .08 * s), e.lineWidth = .5, e.stroke(), e.beginPath(), t.stars.forEach((t, n) => {
668
+ n === 0 ? e.moveTo(t.x, t.y) : e.lineTo(t.x, t.y);
669
+ }), e.closePath(), e.fillStyle = f(a, .04 + .03 * s), e.fill(), e.strokeStyle = f(a, .15 + .1 * s), e.lineWidth = .8, e.stroke(), t.stars.forEach((o, s) => {
670
+ let c = O(n, .05, 5e-4) * .3 + .7, l = 3.5 * c, u = `star-${i}-${s}`, p = r.current.get(u) ?? 0, m = e.createRadialGradient(o.x, o.y, 0, o.x, o.y, l * 4);
671
+ m.addColorStop(0, f(a, (.2 + .1 * p) * c)), m.addColorStop(1, f(a, 0)), e.fillStyle = m, 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 + p * 2, 0, Math.PI * 2), e.fillStyle = f(a, (.8 + .2 * p) * c), e.fill();
672
+ let h = Math.sin(o.angle) < -.3;
673
+ e.textAlign = "center", e.textBaseline = "middle", h ? (e.font = "8px 'DM Sans', sans-serif", e.fillStyle = f(a, .5 + .15 * p), e.fillText(o.short, o.x, o.y - 24), e.font = "bold 11px 'JetBrains Mono', monospace", e.fillStyle = f(a, .8 + .15 * p), e.fillText(o.label, o.x, o.y - 11)) : (e.font = "8px 'DM Sans', sans-serif", e.fillStyle = f(a, .5 + .15 * p), e.fillText(o.short, o.x, o.y + 11), e.font = "bold 11px 'JetBrains Mono', monospace", e.fillStyle = f(a, .8 + .15 * p), e.fillText(o.label, o.x, o.y + 24)), S(d.current, u, o.x, o.y, l * 4 + 2, {
674
+ label: o.name,
675
+ value: o.label,
676
+ sublabel: t.shortName,
677
+ color: a
678
+ });
679
+ }), s > 0 && g(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 = f(a, .1 + O(n, .03, 5e-4) * .05), e.lineWidth = 1, e.stroke(), e.font = "bold 11px 'DM Sans', sans-serif", e.textAlign = "center", e.textBaseline = "alphabetic", e.fillStyle = f(u.t2, .65 + s * .25), e.fillText(t.shortName, t.cx, t.cy + t.baseR + 26), S(d.current, o, t.cx, t.cy, t.baseR + 5, {
680
+ label: t.name,
681
+ value: `£${t.totalCommitment}M total`,
682
+ sublabel: `${t.commitmentPct}% committed · scatter ${t.scatter.toFixed(1)}`,
683
+ color: a
684
+ });
685
+ }), e.font = "11px 'DM Sans', sans-serif", e.textAlign = "center", e.textBaseline = "middle", e.fillStyle = f(u.t4, .55), e.fillText("▲ top = Base value · ▼▸ lower-right = Variations · ◂▼ lower-left = Commitment % · hover stars for details", R / 2, ce - 14), v(e, R, ce, n, .012);
686
+ }, !0), /* @__PURE__ */ c("div", {
687
+ "data-testid": t,
688
+ style: {
689
+ position: "relative",
690
+ width: R,
691
+ height: ce
692
+ },
693
+ children: [/* @__PURE__ */ s("canvas", {
694
+ ref: n,
695
+ role: "img",
696
+ "aria-label": "Contract value breakdown per contractor — multi-KPI constellation chart",
697
+ style: {
698
+ width: R,
699
+ height: ce,
700
+ display: "block"
701
+ }
702
+ }), /* @__PURE__ */ s(b, {
703
+ ...l,
704
+ parentW: R,
705
+ parentH: ce
706
+ })]
707
+ });
708
+ }
709
+ //#endregion
710
+ //#region src/components/contractValueOrb/ContractValueOrb.tsx
711
+ var he = 680, ge = 220, _e = [
712
+ u.blue,
713
+ u.cyan,
714
+ u.amber,
715
+ u.purple,
716
+ u.green
717
+ ], z = {
718
+ left: 8,
719
+ right: 64,
720
+ top: 16,
721
+ bottom: 38
722
+ }, ve = 88, B = 18;
723
+ function ye({ data: e, "data-testid": t }) {
724
+ let n = a(null), r = a(/* @__PURE__ */ new Map()), { hoveredRef: i, tooltip: o, hitZonesRef: l } = x(n, {
725
+ width: he,
726
+ height: ge
727
+ }), { contractors: d, totals: p } = e, m = d.length, h = Math.max(...d.map((e) => e.totalCommitment), 1), _ = he - z.left - ve - z.right, v = m > 1 ? (ge - z.top - z.bottom - m * B) / (m - 1) : 0;
728
+ return se(n, he, ge, (e, t) => {
729
+ A(r.current, i.current), l.current = [], d.forEach((n, i) => {
730
+ let a = _e[i % _e.length], o = k(t, i, m, T), s = z.top + i * (B + v), c = z.left + ve, d = r.current.get(n.id) ?? 0, p = n.base / h * _ * o, y = n.totalCommitment / h * _ * o, b = y - p;
731
+ e.font = `${d > 0 ? "bold " : ""}10px 'DM Sans', sans-serif`, e.fillStyle = d > 0 ? a : f(u.t2, .8), e.textAlign = "right", e.textBaseline = "middle", e.fillText(n.shortName, c - 8, s + B / 2), e.fillStyle = f(u.bd, .25), e.beginPath(), e.roundRect(c, s, _, B, 4), e.fill(), p > 0 && (d > 0 && g(e, c + p / 2, s + B / 2, p * .3, a, .1 * d), e.fillStyle = f(a, .5 + d * .15), e.beginPath(), e.roundRect(c, s, p, B, 4), e.fill()), b > 2 && (e.fillStyle = f(a, .22 + d * .08), e.beginPath(), e.roundRect(c + p, s, b, B, [
732
+ 0,
733
+ 4,
734
+ 4,
735
+ 0
736
+ ]), e.fill(), e.setLineDash([2, 3]), e.strokeStyle = f(a, .55), e.lineWidth = 1, e.beginPath(), e.moveTo(c + p, s + 3), e.lineTo(c + p, s + B - 3), e.stroke(), e.setLineDash([])), d > 0 && y > 0 && (e.strokeStyle = f(a, .5 * d), e.lineWidth = 1, e.setLineDash([]), e.beginPath(), e.roundRect(c, s, y, B, 4), e.stroke()), o > .35 && (e.globalAlpha = Math.min(1, (o - .35) / .4), e.font = "bold 9px 'JetBrains Mono', monospace", e.fillStyle = d > 0 ? a : u.t2, e.textAlign = "left", e.textBaseline = "middle", e.fillText(`£${n.totalCommitment}M`, c + y + 6, s + B / 2), e.globalAlpha = 1), C(l.current, n.id, c, s, Math.max(y, 1), B, {
737
+ label: n.name,
738
+ value: `£${n.totalCommitment}M total`,
739
+ sublabel: `Base £${n.base}M + Var £${n.variations}M · ${n.commitmentPct}% committed`,
740
+ color: a
741
+ });
742
+ });
743
+ let n = ge - 14;
744
+ e.textBaseline = "middle", e.font = "7px 'DM Sans', sans-serif", e.textAlign = "left", e.fillStyle = f(u.cyan, .5), e.beginPath(), e.roundRect(z.left + ve, n - 3, 14, 6, 2), e.fill(), e.fillStyle = f(u.t3, .45), e.fillText("base value", z.left + ve + 18, n), e.fillStyle = f(u.cyan, .22), e.beginPath(), e.roundRect(z.left + ve + 94, n - 3, 14, 6, 2), e.fill(), e.setLineDash([2, 3]), e.strokeStyle = f(u.cyan, .5), e.lineWidth = .5, e.beginPath(), e.moveTo(z.left + ve + 101, n - 3), e.lineTo(z.left + ve + 101, n + 3), e.stroke(), e.setLineDash([]), e.fillStyle = f(u.t3, .45), e.fillText("approved variations", z.left + ve + 112, n), e.font = "bold 8px 'JetBrains Mono', monospace", e.textAlign = "right", e.fillStyle = f(u.t2, .6), e.fillText(`Portfolio: £${p.totalCommitment}M`, he - 8, n);
745
+ }, !0, { easing: T }), /* @__PURE__ */ c("div", {
746
+ "data-testid": t,
747
+ style: {
748
+ position: "relative",
749
+ width: he,
750
+ height: ge
751
+ },
752
+ children: [/* @__PURE__ */ s("canvas", {
753
+ ref: n,
754
+ role: "img",
755
+ "aria-label": "Total contract value per contractor — horizontal bar chart",
756
+ style: {
757
+ width: he,
758
+ height: ge,
759
+ display: "block",
760
+ borderRadius: 8
761
+ }
762
+ }), /* @__PURE__ */ s(b, {
763
+ ...o,
764
+ parentW: he,
765
+ parentH: ge
766
+ })]
767
+ });
768
+ }
769
+ //#endregion
770
+ //#region src/components/contractorRank/ContractorRank.tsx
771
+ var be = 780, V = 240, xe = 12, Se = 10, Ce = [
772
+ "Highest exposure",
773
+ "Elevated risk",
774
+ "Moderate exposure",
775
+ "Moderate exposure",
776
+ "Low exposure"
777
+ ];
778
+ function we({ contractors: e, "data-testid": t }) {
779
+ let r = a(null), i = a(0), o = a(/* @__PURE__ */ new Map()), { hoveredRef: l, tooltip: d, hitZonesRef: p } = x(r, {
780
+ width: be,
781
+ height: V
782
+ }), m = [...e].sort((e, t) => t.openCount - e.openCount).slice(0, 5), _ = m.reduce((e, t) => e + t.openCount, 0);
783
+ return n(() => {
784
+ let e = r.current;
785
+ if (!e) return;
786
+ let t = h(e, be, V);
787
+ i.current = 0;
788
+ let n = Math.min(5, m.length), a = (be - 2 * xe - (n - 1) * Se) / n, s = V * .84, c = V * .08, d, y = () => {
789
+ i.current++;
790
+ let e = i.current;
791
+ t.clearRect(0, 0, be, V), p.current = [], o.current.forEach((e, t) => {
792
+ let n = t === l.current ? 1 : 0, r = e + (n - e) * .12;
793
+ Math.abs(r - n) < .005 ? n === 0 ? o.current.delete(t) : o.current.set(t, 1) : o.current.set(t, r);
794
+ }), l.current && !o.current.has(l.current) && o.current.set(l.current, 0), m.forEach((n, r) => {
795
+ let i = r === 0, l = i ? u.red : r === 1 ? u.amber : u.blue, d = xe + r * (a + Se), m = o.current.get(n.id) ?? 0, h = m * 8, v = d - h / 2, y = a + h, b = i ? O(e, .04, 3e-4) * .06 + .06 : 0;
796
+ t.fillStyle = f(l, .08 + m * .07), t.beginPath(), t.roundRect(v, c, y, s, 6), t.fill(), t.strokeStyle = f(l, .2 + m * .4 + b), t.lineWidth = i ? 1.5 : 1, t.stroke(), (m > .01 || i) && g(t, v + y / 2, c + s / 2, y * .55, l, b + m * .14), t.font = "bold 8px 'JetBrains Mono', monospace", t.textAlign = "left", t.textBaseline = "top", t.fillStyle = f(l, .5 + m * .35), t.fillText(`#${r + 1}`, v + 7, c + 6);
797
+ let x = a * .28, S = v + y / 2, w = c + s * .38, T = t.createRadialGradient(S, w - x * .2, 0, S, w, x);
798
+ T.addColorStop(0, f(l, .5 + m * .2)), T.addColorStop(1, f(l, .2 + m * .1)), t.beginPath(), t.arc(S, w, x, 0, Math.PI * 2), t.fillStyle = T, t.fill(), t.strokeStyle = f(l, .4 + m * .3), t.lineWidth = 1, t.stroke(), t.font = `bold ${Math.min(10, a * .11)}px 'JetBrains Mono', monospace`, t.textAlign = "center", t.textBaseline = "middle", t.fillStyle = f(u.t1, .9), t.fillText(n.shortName, S, w), t.font = `bold ${Math.min(18, a * .18)}px 'JetBrains Mono', monospace`, t.textBaseline = "alphabetic", t.fillStyle = f(l, .9 + m * .1), t.fillText(String(n.openCount), S, c + s * .76), t.font = "8px 'JetBrains Mono', monospace", t.fillStyle = f(u.t2, .6), t.fillText("open EWs", S, c + s * .88);
799
+ let E = Math.round(n.openCount / _ * 100), D = Ce[r] ?? "Low exposure";
800
+ C(p.current, n.id, d, c, a, s, {
801
+ label: n.name,
802
+ value: `${n.openCount} open EWs · ${E}% of total`,
803
+ sublabel: `Rank #${r + 1} · ${D}`,
804
+ color: l
805
+ });
806
+ }), v(t, be, V, e, .015), d = requestAnimationFrame(y);
807
+ };
808
+ return y(), () => cancelAnimationFrame(d);
809
+ }, [m, _]), /* @__PURE__ */ c("div", {
810
+ "data-testid": t,
811
+ style: {
812
+ position: "relative",
813
+ width: be,
814
+ height: V
815
+ },
816
+ children: [/* @__PURE__ */ s("canvas", {
817
+ ref: r,
818
+ role: "img",
819
+ "aria-label": "Contractor rank — open EW count per contractor",
820
+ style: {
821
+ width: be,
822
+ height: V,
823
+ display: "block",
824
+ borderRadius: 8
825
+ }
826
+ }), /* @__PURE__ */ s(b, {
827
+ ...d,
828
+ parentW: be,
829
+ parentH: V
830
+ })]
831
+ });
832
+ }
833
+ //#endregion
834
+ //#region src/components/ewCategory/EWCategory.tsx
835
+ var H = 680, U = 260;
836
+ function Te({ categories: e, "data-testid": t }) {
837
+ let r = a(null), i = a(0), o = a(/* @__PURE__ */ new Map()), { hoveredRef: l, tooltip: d, hitZonesRef: p } = x(r, {
838
+ width: H,
839
+ height: U
840
+ });
841
+ return n(() => {
842
+ let t = r.current;
843
+ if (!t) return;
844
+ let n = h(t, H, U);
845
+ i.current = 0;
846
+ let a = e.length, s = Math.max(...e.map((e) => e.count), 1), c = s, d = H * .05, m = U * .1, y = H * .9 / a, b = U * .7 / c, x = e.reduce((e, t) => e + t.count, 0), C, w = () => {
847
+ i.current++;
848
+ let t = i.current;
849
+ n.clearRect(0, 0, H, U), p.current = [], o.current.forEach((e, t) => {
850
+ let n = t === l.current ? 1 : 0, r = e + (n - e) * .12;
851
+ Math.abs(r - n) < .005 ? n === 0 ? o.current.delete(t) : o.current.set(t, 1) : o.current.set(t, r);
852
+ }), l.current && !o.current.has(l.current) && o.current.set(l.current, 0), _(n, H, U, t, 40, f(u.blue, .04)), e.forEach((e, r) => {
853
+ let i = e.count === s, a = i ? u.cyan : u.blue, l = o.current.get(`${e.category}-col`) ?? 0;
854
+ for (let u = 0; u < c; u++) {
855
+ let c = d + r * y + y / 2, h = m + u * b + b / 2, _ = Math.min(y, b) * .38;
856
+ if (u >= s - e.count) {
857
+ let s = _ * (1 + (O(t, .04, 5e-4) + Math.sin(r * .6 + u * 1.2) * .3) * .12);
858
+ (i || l > .01) && g(n, c, h, s * 3, a, (i ? .2 : .1) + l * .1), n.beginPath(), n.arc(c, h, s, 0, Math.PI * 2), n.fillStyle = f(a, i ? .8 : .5 + l * .2), n.fill();
859
+ let d = `${e.category}-${u}`;
860
+ S(p.current, d, c, h, _ + 4, {
861
+ label: e.fullName,
862
+ value: `${e.count} Early Warnings`,
863
+ sublabel: `${Math.round(e.count / x * 100)}% of total`,
864
+ color: a
865
+ }), o.current.get(`${e.category}-col`);
866
+ } else n.beginPath(), n.arc(c, h, 1, 0, Math.PI * 2), n.fillStyle = f(a, .08), n.fill();
867
+ }
868
+ let h = m + c * b + 16;
869
+ n.font = `${i ? "bold " : ""}9px 'JetBrains Mono', monospace`, n.textAlign = "center", n.textBaseline = "alphabetic", n.fillStyle = i ? u.cyan : f(u.t2, .65), n.fillText(e.category, d + r * y + y / 2, h);
870
+ }), v(n, H, U, t, .015), C = requestAnimationFrame(w);
871
+ };
872
+ return w(), () => cancelAnimationFrame(C);
873
+ }, [e]), /* @__PURE__ */ c("div", {
874
+ "data-testid": t,
875
+ style: {
876
+ position: "relative",
877
+ width: H,
878
+ height: U
879
+ },
880
+ children: [/* @__PURE__ */ s("canvas", {
881
+ ref: r,
882
+ role: "img",
883
+ "aria-label": "Early Warning count by category — breathing dot grid",
884
+ style: {
885
+ width: H,
886
+ height: U,
887
+ display: "block",
888
+ borderRadius: 8
889
+ }
890
+ }), /* @__PURE__ */ s(b, {
891
+ ...d,
892
+ parentW: H,
893
+ parentH: U
894
+ })]
895
+ });
896
+ }
897
+ //#endregion
898
+ //#region src/components/lineChart/LineChart.tsx
899
+ function Ee({ rows: e = [], className: t, colors: n }) {
900
+ return /* @__PURE__ */ s(N, {
901
+ rows: e,
902
+ variant: "line",
903
+ className: t,
904
+ colors: n
905
+ });
906
+ }
907
+ //#endregion
908
+ //#region src/components/constants.ts
909
+ var De = [
910
+ "#6bbcff",
911
+ "#5fe6dd",
912
+ "#d7bc6d",
913
+ "#95a9ff",
914
+ "#7fb58a",
915
+ "#ee8a8a"
916
+ ], Oe = {
917
+ nodes: [
918
+ {
919
+ id: "supplier-x",
920
+ name: "Supplier X",
921
+ valueLabel: "Si +0.12%"
922
+ },
923
+ {
924
+ id: "bf3-superheat",
925
+ name: "BF-3 Superheat",
926
+ valueLabel: "22°C (target 34)"
927
+ },
928
+ {
929
+ id: "ccm3-solidification",
930
+ name: "CCM-3 Solidification",
931
+ valueLabel: "Rate deviation"
932
+ },
933
+ {
934
+ id: "grade-risk",
935
+ name: "Grade Risk",
936
+ valueLabel: "Automotive 74%"
937
+ }
938
+ ],
939
+ links: [
940
+ {
941
+ source: "supplier-x",
942
+ target: "bf3-superheat",
943
+ value: 92
944
+ },
945
+ {
946
+ source: "bf3-superheat",
947
+ target: "ccm3-solidification",
948
+ value: 87
949
+ },
950
+ {
951
+ source: "ccm3-solidification",
952
+ target: "grade-risk",
953
+ value: 74
954
+ }
955
+ ]
956
+ };
957
+ //#endregion
958
+ //#region src/components/miniBars/MiniBars.tsx
959
+ function ke({ rows: e = [], className: t, colors: n }) {
960
+ let r = n?.slices ?? De;
961
+ return /* @__PURE__ */ s("div", {
962
+ className: ["d3-mini-bars", t].filter(Boolean).join(" "),
963
+ children: e.map(([e, t, n], i) => /* @__PURE__ */ c("div", {
964
+ className: "d3-mini-row",
965
+ children: [
966
+ /* @__PURE__ */ s("span", { children: e }),
967
+ /* @__PURE__ */ s("div", {
968
+ className: "d3-mini-track",
969
+ children: /* @__PURE__ */ c("svg", {
970
+ viewBox: "0 0 100 12",
971
+ className: "d3-mini-svg",
972
+ "aria-hidden": "true",
973
+ children: [/* @__PURE__ */ s("rect", {
974
+ x: "0",
975
+ y: "0",
976
+ width: "100",
977
+ height: "12",
978
+ rx: "6",
979
+ className: "d3-mini-track-fill"
980
+ }), /* @__PURE__ */ s("rect", {
981
+ x: "0",
982
+ y: "0",
983
+ width: Math.max(0, Math.min(100, t)),
984
+ height: "12",
985
+ rx: "6",
986
+ className: `d3-mini-fill tone-${i % De.length}`,
987
+ fill: r[i % r.length]
988
+ })]
989
+ })
990
+ }),
991
+ /* @__PURE__ */ s("span", { children: n })
992
+ ]
993
+ }, `${e}-${i}`))
994
+ });
995
+ }
996
+ //#endregion
997
+ //#region src/components/nceTree/NCETree.tsx
998
+ var Ae = 680, W = 320;
999
+ function je({ total: e, byContractor: t, "data-testid": r }) {
1000
+ let i = a(null), o = a(/* @__PURE__ */ new Map()), l = a(0), { hoveredRef: p, tooltip: m, hitZonesRef: _ } = x(i, {
1001
+ width: Ae,
1002
+ height: W
1003
+ });
1004
+ return n(() => {
1005
+ let n = i.current;
1006
+ if (!n) return;
1007
+ let r = h(n, Ae, W);
1008
+ l.current = 0;
1009
+ let a = W / 2, s = Ae - 80, c = Math.max(...t.map((e) => e.count)), m = (W - 60) / (t.length - 1), v = t.map((e, t) => ({
1010
+ x: s,
1011
+ y: 30 + t * m
1012
+ })), y, b = () => {
1013
+ l.current++;
1014
+ let n = l.current;
1015
+ r.clearRect(0, 0, Ae, W);
1016
+ let i = w(Math.min(n / 72, 1));
1017
+ A(o.current, p.current), _.current = [], g(r, 88, a, 48 * i, u.blue, .15 * i), t.forEach((n, l) => {
1018
+ let p = d[l % d.length], m = k(i, l, t.length, w), h = v[l], y = o.current.get(n.id) ?? 0, b = Math.max(1.5, n.count / c * 6);
1019
+ if (m < .01) return;
1020
+ let x = 88 + (s - 88) * .4, C = a, T = 88 + (s - 88) * .6, E = h.y, D = m;
1021
+ r.beginPath();
1022
+ for (let e = 0; e <= 40; e++) {
1023
+ let t = e / 40 * D, n = (1 - t) ** 3 * 88 + 3 * (1 - t) ** 2 * t * x + 3 * (1 - t) * t ** 2 * T + t ** 3 * h.x, i = (1 - t) ** 3 * a + 3 * (1 - t) ** 2 * t * C + 3 * (1 - t) * t ** 2 * E + t ** 3 * h.y;
1024
+ e === 0 ? r.moveTo(n, i) : r.lineTo(n, i);
1025
+ }
1026
+ if (r.strokeStyle = f(p, y > 0 ? .8 : .45), r.lineWidth = b * (y > 0 ? 1.3 : 1), r.stroke(), m > .85) {
1027
+ let t = Math.min(1, (m - .85) / .15), i = 4 + n.count / c * 12;
1028
+ g(r, h.x, h.y, i * 2.5, p, (.25 + y * .2) * t), r.beginPath(), r.arc(h.x, h.y, i * t, 0, Math.PI * 2), r.fillStyle = f(p, (.7 + y * .2) * t), r.fill(), S(_.current, n.id, h.x, h.y, i + 8, {
1029
+ label: n.name,
1030
+ value: `${n.count} NCEs raised`,
1031
+ sublabel: `${Math.round(n.count / e * 100)}% of all NCEs`,
1032
+ color: p
1033
+ }), r.globalAlpha = t, r.font = "bold 9px 'JetBrains Mono', monospace", r.fillStyle = y > 0 ? p : f(u.t2, .85), r.textAlign = "left", r.fillText(n.shortName, h.x + i + 6, h.y - 3), r.font = "bold 11px 'JetBrains Mono', monospace", r.fillStyle = y > 0 ? p : u.t1, r.fillText(String(n.count), h.x + i + 6, h.y + 10), r.globalAlpha = 1;
1034
+ }
1035
+ }), r.beginPath(), r.arc(88, a, 32 * i, 0, Math.PI * 2), r.fillStyle = u.bgL, r.fill(), r.strokeStyle = f(u.blue, .6 * i), r.lineWidth = 2, r.stroke(), i > .4 && (r.globalAlpha = Math.min(1, (i - .4) / .4), r.font = "bold 18px 'JetBrains Mono', monospace", r.fillStyle = u.t1, r.textAlign = "center", r.fillText(String(e), 88, a + 5), r.font = "8px 'JetBrains Mono', monospace", r.fillStyle = u.t3, r.fillText("NCEs", 88, a + 18), r.globalAlpha = 1), y = requestAnimationFrame(b);
1036
+ };
1037
+ return b(), () => cancelAnimationFrame(y);
1038
+ }, [e, t]), /* @__PURE__ */ c("div", {
1039
+ "data-testid": r,
1040
+ style: {
1041
+ position: "relative",
1042
+ width: Ae,
1043
+ height: W
1044
+ },
1045
+ children: [/* @__PURE__ */ s("canvas", {
1046
+ ref: i,
1047
+ role: "img",
1048
+ "aria-label": "NCE fault tree — NCEs per contractor as branching tree",
1049
+ style: {
1050
+ width: Ae,
1051
+ height: W,
1052
+ display: "block"
1053
+ }
1054
+ }), /* @__PURE__ */ s(b, {
1055
+ ...m,
1056
+ parentW: Ae,
1057
+ parentH: W
1058
+ })]
1059
+ });
1060
+ }
1061
+ //#endregion
1062
+ //#region src/components/pieChart/PieChart.tsx
1063
+ var Me = 192, Ne = Me, Pe = Me + 80;
1064
+ function Fe({ rows: e = [], variant: t, className: r, colors: i }) {
1065
+ let o = a(null), p = a(/* @__PURE__ */ new Map()), _ = a(0), v = i?.slices ?? d, { hoveredRef: y, tooltip: C, hitZonesRef: w } = x(o, {
1066
+ width: Ne,
1067
+ height: Pe
1068
+ });
1069
+ return n(() => {
1070
+ let n = o.current;
1071
+ if (!n) return;
1072
+ let r = h(n, Ne, Pe);
1073
+ _.current = 0;
1074
+ let i = Ne / 2, a = Me / 2, s = Me * .4, c = t === "donut" ? Me * .21 : 0, l = e.reduce((e, t) => e + (t.pricing ?? 0), 0) || 1, d, b = () => {
1075
+ _.current++;
1076
+ let n = _.current;
1077
+ r.clearRect(0, 0, Ne, Pe);
1078
+ let o = 1 - (1 - Math.min(n / 48, 1)) ** 3;
1079
+ A(p.current, y.current), w.current = [];
1080
+ let h = -Math.PI / 2;
1081
+ e.forEach((e, t) => {
1082
+ let d = (e.pricing ?? 0) / l, m = d * Math.PI * 2 * o, _ = h + m, y = v[t % v.length], b = p.current.get(e.id ?? `sl-${t}`) ?? 0, x = h + m / 2, C = (s + c) / 2, T = i + Math.cos(x) * C, E = a + Math.sin(x) * C, D = (s - c) / 2 + 8;
1083
+ S(w.current, e.id ?? `sl-${t}`, T, E, D, {
1084
+ label: e.vendor,
1085
+ value: `${e.pricing ?? 0} (${Math.round(d * 100)}%)`,
1086
+ color: y
1087
+ }), b > 0 && g(r, T, E, D * 2 * b, y, .2 * b);
1088
+ let k = O(n, .03, 3e-4), A = s + b * 6 + (b > 0 ? k * 2 : 0);
1089
+ r.beginPath(), r.moveTo(i + Math.cos(h) * c, a + Math.sin(h) * c), r.arc(i, a, A, h, _), c > 0 ? r.arc(i, a, c, _, h, !0) : r.lineTo(i, a), r.closePath(), r.fillStyle = f(y, .7 + b * .2), r.fill(), r.strokeStyle = f(u.bg, .8), r.lineWidth = 1.5, r.stroke(), h = _;
1090
+ }), t === "donut" && e.length > 0 && g(r, i, a, c * .8, u.blue, .06);
1091
+ let x = Me + 12;
1092
+ e.forEach((e, t) => {
1093
+ let n = v[t % v.length], i = (e.pricing ?? 0) / l, a = p.current.get(e.id ?? `sl-${t}`) ?? 0, o = x + t * 18;
1094
+ r.beginPath(), r.arc(8, o, 4, 0, Math.PI * 2), r.fillStyle = f(n, .8 + a * .2), r.fill(), r.font = "9px 'JetBrains Mono', monospace", r.fillStyle = f(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 = m(u.t3, n, a), r.textAlign = "right", r.fillText(`${e.pricing ?? 0} (${Math.round(i * 100)}%)`, Ne - 4, o + 3.5);
1095
+ }), d = requestAnimationFrame(b);
1096
+ };
1097
+ return b(), () => cancelAnimationFrame(d);
1098
+ }, [
1099
+ e,
1100
+ t,
1101
+ i,
1102
+ v
1103
+ ]), /* @__PURE__ */ s(l, {
1104
+ className: ["canvas-pie-frame", r].filter(Boolean).join(" "),
1105
+ children: /* @__PURE__ */ c("div", {
1106
+ style: {
1107
+ position: "relative",
1108
+ width: Ne,
1109
+ height: Pe
1110
+ },
1111
+ children: [/* @__PURE__ */ s("canvas", {
1112
+ ref: o,
1113
+ role: "img",
1114
+ "aria-label": `${t} chart`,
1115
+ style: {
1116
+ width: Ne,
1117
+ height: Pe,
1118
+ display: "block",
1119
+ borderRadius: 8
1120
+ }
1121
+ }), /* @__PURE__ */ s(b, {
1122
+ ...C,
1123
+ parentW: Ne,
1124
+ parentH: Pe
1125
+ })]
1126
+ })
1127
+ });
1128
+ }
1129
+ //#endregion
1130
+ //#region src/components/sankey/SankeySvg.tsx
1131
+ function Ie(e, t, n, r) {
1132
+ let i = new Set(t.map((e) => e.source)), a = new Set(t.map((e) => e.target)), o = /* @__PURE__ */ new Map(), s = [];
1133
+ for (e.forEach((e) => {
1134
+ i.has(e.id) && !a.has(e.id) && s.push({
1135
+ id: e.id,
1136
+ depth: 0
1137
+ });
1138
+ }); s.length > 0;) {
1139
+ let e = s.shift();
1140
+ if (!e) break;
1141
+ let { id: n, depth: r } = e;
1142
+ o.has(n) || (o.set(n, r), t.filter((e) => e.source === n).forEach((e) => {
1143
+ o.has(e.target) || s.push({
1144
+ id: e.target,
1145
+ depth: r + 1
1146
+ });
1147
+ }));
1148
+ }
1149
+ let c = o.size > 0 ? Math.max(...Array.from(o.values())) : 0;
1150
+ e.forEach((e) => {
1151
+ o.has(e.id) || o.set(e.id, c + 1);
1152
+ });
1153
+ let l = /* @__PURE__ */ new Map();
1154
+ e.forEach((e) => {
1155
+ let t = o.get(e.id) ?? 0;
1156
+ l.has(t) || l.set(t, []), l.get(t).push(e.id);
1157
+ });
1158
+ let u = Math.max(...Array.from(l.keys())) + 1, d = {
1159
+ left: 100,
1160
+ right: 80,
1161
+ top: 40,
1162
+ bottom: 40
1163
+ }, f = /* @__PURE__ */ new Map();
1164
+ return l.forEach((e, t) => {
1165
+ let i = d.left + t / Math.max(u - 1, 1) * (n - d.left - d.right), a = r - d.top - d.bottom, o = Math.max(24, (a - (e.length - 1) * 12) / e.length), s = e.length * o + (e.length - 1) * 12, c = d.top + (a - s) / 2;
1166
+ e.forEach((e, t) => {
1167
+ f.set(e, {
1168
+ x: i - 20 / 2,
1169
+ y: c + t * (o + 12),
1170
+ w: 20,
1171
+ h: o
1172
+ });
1173
+ });
1174
+ }), f;
1175
+ }
1176
+ function Le({ nodes: e, links: t, width: r = 960, height: o = 280, ariaLabel: p, selectedEntity: m, className: _, colors: y }) {
1177
+ let w = a(null), T = a(/* @__PURE__ */ new Map()), E = a(0), D = a([]), k = y?.nodes ?? d, j = y?.links ?? u.bd, M = y?.activeLinks ?? u.blue, N = y?.activeNodes ?? u.blue, ee = i(() => Ie(e, t, r, o), [
1178
+ e,
1179
+ t,
1180
+ r,
1181
+ o
1182
+ ]), { hoveredRef: P, tooltip: F, hitZonesRef: te } = x(w, {
1183
+ width: r,
1184
+ height: o
1185
+ });
1186
+ return n(() => {
1187
+ let n = w.current;
1188
+ if (!n) return;
1189
+ let i = h(n, r, o);
1190
+ E.current = 0, D.current = [];
1191
+ let a = t.length > 0 ? Math.max(...t.map((e) => e.value)) : 1, s, c = () => {
1192
+ E.current++;
1193
+ let n = E.current;
1194
+ i.clearRect(0, 0, r, o);
1195
+ let l = 1 - (1 - Math.min(n / 56, 1)) ** 3;
1196
+ A(T.current, P.current), te.current = [], t.forEach((e, t) => {
1197
+ let r = ee.get(e.source), o = ee.get(e.target);
1198
+ if (!r || !o) return;
1199
+ let s = !!m && (e.source === m || e.target === m), c = s ? M : j, d = s ? .5 : .2, p = Math.max(3, e.value / a * 36 * l), h = p / 2, g = r.x + r.w, _ = r.y + r.h / 2, v = o.x, y = o.y + o.h / 2, b = (g + v) / 2;
1200
+ for (let e = 0; e < 30; e++) {
1201
+ let r = e / 30, a = (e + 1) / 30, o = 1 - r, s = 1 - a, l = o * o * g + 2 * o * r * b + r * r * v, u = o * o * _ + 2 * o * r * _ + r * r * y, p = s * s * g + 2 * s * a * b + a * a * v, m = s * s * _ + 2 * s * a * _ + a * a * y, x = O(n + r * 120 + t * 40, .025, 3e-4) * 1.2;
1202
+ i.beginPath(), i.moveTo(l, u - h + x), i.lineTo(p, m - h + x), i.lineTo(p, m + h + x), i.lineTo(l, u + h + x), i.closePath(), i.fillStyle = f(c, d * (.5 + r * .5)), i.fill();
1203
+ }
1204
+ S(te.current, `link-${t}`, b, (_ + y) / 2, p + 6, {
1205
+ label: `${e.source} → ${e.target}`,
1206
+ value: String(e.value),
1207
+ color: s ? M : u.blue
1208
+ }), Math.random() < .08 && D.current.push({
1209
+ linkIdx: t,
1210
+ prog: 0,
1211
+ speed: .006 + Math.random() * .006,
1212
+ off: (Math.random() - .5) * p * .5,
1213
+ sz: 1 + Math.random()
1214
+ });
1215
+ }), e.forEach((e, t) => {
1216
+ let r = ee.get(e.id);
1217
+ if (!r) return;
1218
+ let a = m === e.id, o = P.current === `node-${t}`, s = T.current.get(`node-${t}`) ?? 0, c = a ? N : k[t % k.length];
1219
+ C(te.current, `node-${t}`, r.x, r.y, r.w, r.h, {
1220
+ label: e.name,
1221
+ value: e.valueLabel ?? e.id,
1222
+ color: c
1223
+ }), (s > 0 || a) && g(i, r.x + r.w / 2, r.y + r.h / 2, r.w * 2, c, .2 * Math.max(s, a ? .6 : 0));
1224
+ let l = a ? O(n, .03, 3e-4) * .15 : 0;
1225
+ i.fillStyle = f(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 = f(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());
1226
+ let d = r.x + r.w + 8;
1227
+ i.font = `${a || o ? "bold " : ""}10px 'JetBrains Mono', monospace`, i.fillStyle = f(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 = f(c, .5 + s * .2), i.fillText(e.valueLabel, d, r.y + r.h / 2 + 17));
1228
+ }), D.current = D.current.filter((e) => {
1229
+ if (e.prog += e.speed, e.prog > 1) return !1;
1230
+ let n = t[e.linkIdx];
1231
+ if (!n) return !1;
1232
+ let r = ee.get(n.source), a = ee.get(n.target);
1233
+ if (!r || !a) return !1;
1234
+ 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, p = 1 - e.prog, m = p * p * o + 2 * p * e.prog * d + e.prog * e.prog * c, h = p * p * s + 2 * p * e.prog * s + e.prog * e.prog * l + e.off, g = Math.sin(e.prog * Math.PI) * .5, _ = y?.links ?? u.cyan;
1235
+ return i.beginPath(), i.arc(m, h, e.sz, 0, Math.PI * 2), i.fillStyle = f(_, g), i.fill(), !0;
1236
+ }), D.current.length > 150 && (D.current = D.current.slice(-150)), v(i, r, o, n, .01), s = requestAnimationFrame(c);
1237
+ };
1238
+ return c(), () => {
1239
+ cancelAnimationFrame(s), D.current = [];
1240
+ };
1241
+ }, [
1242
+ e,
1243
+ t,
1244
+ r,
1245
+ o,
1246
+ m,
1247
+ y,
1248
+ ee
1249
+ ]), /* @__PURE__ */ s(l, {
1250
+ className: ["canvas-sankey-frame", _].filter(Boolean).join(" "),
1251
+ children: /* @__PURE__ */ c("div", {
1252
+ role: "img",
1253
+ "aria-label": p,
1254
+ style: {
1255
+ position: "relative",
1256
+ width: r,
1257
+ height: o
1258
+ },
1259
+ children: [/* @__PURE__ */ s("canvas", {
1260
+ ref: w,
1261
+ style: {
1262
+ width: r,
1263
+ height: o,
1264
+ display: "block",
1265
+ borderRadius: 8
1266
+ }
1267
+ }), /* @__PURE__ */ s(b, {
1268
+ ...F,
1269
+ parentW: r,
1270
+ parentH: o
1271
+ })]
1272
+ })
1273
+ });
1274
+ }
1275
+ //#endregion
1276
+ //#region src/canvas/CausalFlowCanvas.tsx
1277
+ var Re = [
1278
+ {
1279
+ x: .13,
1280
+ y: .48
1281
+ },
1282
+ {
1283
+ x: .37,
1284
+ y: .28
1285
+ },
1286
+ {
1287
+ x: .63,
1288
+ y: .62
1289
+ },
1290
+ {
1291
+ x: .87,
1292
+ y: .38
1293
+ },
1294
+ {
1295
+ x: .25,
1296
+ y: .72
1297
+ },
1298
+ {
1299
+ x: .5,
1300
+ y: .18
1301
+ },
1302
+ {
1303
+ x: .75,
1304
+ y: .7
1305
+ },
1306
+ {
1307
+ x: .92,
1308
+ y: .22
1309
+ }
1310
+ ], ze = [
1311
+ u.blue,
1312
+ u.cyan,
1313
+ u.orange,
1314
+ u.red,
1315
+ u.purple,
1316
+ u.green,
1317
+ u.amber,
1318
+ u.t2
1319
+ ], Be = [
1320
+ 26,
1321
+ 24,
1322
+ 24,
1323
+ 26,
1324
+ 22,
1325
+ 22,
1326
+ 22,
1327
+ 22
1328
+ ];
1329
+ function Ve(e, t) {
1330
+ let n = 1 - t;
1331
+ return {
1332
+ 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,
1333
+ 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
1334
+ };
1335
+ }
1336
+ function He(e, t) {
1337
+ 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;
1338
+ return {
1339
+ x: -i / a,
1340
+ y: r / a
1341
+ };
1342
+ }
1343
+ function Ue(e, t) {
1344
+ let n = t.x - e.x, r = t.y - e.y;
1345
+ return {
1346
+ p0: {
1347
+ x: e.x,
1348
+ y: e.y
1349
+ },
1350
+ p1: {
1351
+ x: e.x + n * .3 + r * .15,
1352
+ y: e.y + r * .3 - n * .15
1353
+ },
1354
+ p2: {
1355
+ x: t.x - n * .3 + r * .08,
1356
+ y: t.y - r * .3 - n * .08
1357
+ },
1358
+ p3: {
1359
+ x: t.x,
1360
+ y: t.y
1361
+ }
1362
+ };
1363
+ }
1364
+ function We({ nodes: e, links: t, width: r = 960, height: o = 280, selectedEntity: l }) {
1365
+ let d = a(null), p = a(0), y = a([]), { hoveredRef: C, tooltip: T, hitZonesRef: E } = x(d, {
1366
+ width: r,
1367
+ height: o
1368
+ }), D = i(() => {
1369
+ let t = /* @__PURE__ */ new Map();
1370
+ return e.forEach((e, n) => t.set(e.id, n)), t;
1371
+ }, [e]), k = i(() => t.length > 0 ? Math.max(...t.map((e) => e.value)) : 100, [t]), A = (e) => k > 1 ? e / 100 : e, j = i(() => e.map((e, t) => {
1372
+ let n = Re[t % Re.length];
1373
+ return {
1374
+ id: e.id,
1375
+ label: e.name,
1376
+ sub: e.valueLabel ?? "",
1377
+ x: n.x * r,
1378
+ y: n.y * o,
1379
+ r: Be[t % Be.length],
1380
+ color: ze[t % ze.length]
1381
+ };
1382
+ }), [
1383
+ e,
1384
+ r,
1385
+ o
1386
+ ]), M = i(() => t.map((e) => ({
1387
+ fromIdx: D.get(e.source) ?? -1,
1388
+ toIdx: D.get(e.target) ?? -1,
1389
+ conf: A(e.value)
1390
+ })).filter((e) => e.fromIdx >= 0 && e.toIdx >= 0), [t, D]);
1391
+ return n(() => {
1392
+ let e = d.current;
1393
+ if (!e) return;
1394
+ let t = h(e, r, o);
1395
+ p.current = 0, y.current = [];
1396
+ let n, i = () => {
1397
+ p.current++;
1398
+ let e = p.current;
1399
+ if (t.clearRect(0, 0, r, o), E.current = [], _(t, r, o, e, 50, f(u.blue, .05)), M.forEach((e, n) => {
1400
+ let r = j[e.fromIdx], i = j[e.toIdx];
1401
+ if (!r || !i) return;
1402
+ let a = !!l && (r.id === l || i.id === l), o = m(r.color, i.color, .5), s = a ? .18 : .05, c = a ? .25 : .1, d = Ue(r, i);
1403
+ 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 = f(o, s), t.lineWidth = 16, t.lineCap = "round", t.stroke(), t.strokeStyle = f(o, c), t.lineWidth = 1.5, t.stroke();
1404
+ for (let t = 0; t < e.conf * 2.5; t++) Math.random() < .45 && y.current.push({
1405
+ edgeIdx: n,
1406
+ t: 0,
1407
+ speed: .003 + Math.random() * .004,
1408
+ off: (Math.random() - .5) * 13,
1409
+ sz: .7 + Math.random() * 2
1410
+ });
1411
+ let p = Ve(d, .5), h = `${Math.round(e.conf * 100)}%`;
1412
+ t.font = "bold 12px 'JetBrains Mono', monospace", t.textBaseline = "middle";
1413
+ let g = t.measureText(h).width + 14;
1414
+ t.fillStyle = "rgba(10,16,24,0.88)", t.beginPath(), t.roundRect(p.x - g / 2, p.y - 11, g, 22, 6), t.fill(), t.strokeStyle = f(u.cyan, .25), t.lineWidth = 1, t.stroke(), t.fillStyle = f(u.cyan, .9), t.textAlign = "center", t.fillText(h, p.x, p.y);
1415
+ }), y.current = y.current.filter((e) => {
1416
+ if (e.t += e.speed, e.t > 1) return !1;
1417
+ let n = M[e.edgeIdx];
1418
+ if (!n) return !1;
1419
+ let r = j[n.fromIdx], i = j[n.toIdx];
1420
+ if (!r || !i) return !1;
1421
+ let a = Ue(r, i), o = Ve(a, e.t), s = He(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 = m(r.color, i.color, e.t);
1422
+ return g(t, c, l, e.sz * 3, d, u * .1), t.beginPath(), t.arc(c, l, e.sz, 0, Math.PI * 2), t.fillStyle = f(d, u), t.fill(), !0;
1423
+ }), y.current.length > 350 && (y.current = y.current.slice(-350)), j.forEach((n, r) => {
1424
+ let i = l === n.id, a = C.current === `node-${r}`, o = O(e, .03, 3e-4) * .1 + 1, s = n.r * o * (i ? 1.15 : 1);
1425
+ t.beginPath(), t.arc(n.x, n.y, s + 6, 0, Math.PI * 2), t.strokeStyle = f(n.color, i ? .3 : .1), t.lineWidth = i ? 1.5 : .7, t.stroke(), g(t, n.x, n.y, s * 3, n.color, i ? .22 : .12);
1426
+ let c = t.createRadialGradient(n.x, n.y - s * .2, 0, n.x, n.y, s);
1427
+ if (c.addColorStop(0, f(n.color, i ? 1 : .85)), c.addColorStop(1, f(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 === j.length - 1) {
1428
+ let r = s + 16, i = e * .04, a = n.x + Math.cos(i) * r, o = n.y + Math.sin(i) * r;
1429
+ g(t, a, o, 6, n.color, .3), t.beginPath(), t.arc(a, o, 2, 0, Math.PI * 2), t.fillStyle = f(n.color, .75), t.fill();
1430
+ }
1431
+ S(E.current, `node-${r}`, n.x, n.y, s + 8, {
1432
+ label: n.label,
1433
+ value: n.sub || n.id,
1434
+ color: n.color
1435
+ }), t.font = `${i || a ? "bold " : ""}12px 'DM Sans', sans-serif`, t.textAlign = "center", t.textBaseline = "alphabetic", t.fillStyle = f(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 = f(u.t3, .65), t.fillText(n.sub, n.x, n.y + s + 32));
1436
+ }), M.length >= 2) {
1437
+ let n = M.reduce((e, t) => e * t.conf, 1), i = o * .92, a = r * .12, s = r * .76, c = w(Math.min(e * .008, 1));
1438
+ t.fillStyle = f(u.bd, .35), t.beginPath(), t.roundRect(a, i, s, 5, 3), t.fill(), t.fillStyle = f(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 = f(u.orange, .85), t.fillText(`${Math.round(n * 100)}% compound confidence`, a + s * n * c + 10, i + 2);
1439
+ let l = M.map((e) => e.conf.toFixed(2)).join(" × ");
1440
+ t.textAlign = "right", t.font = "9px 'JetBrains Mono', monospace", t.fillStyle = f(u.t4, .6), t.fillText(l, a - 6, i + 2);
1441
+ }
1442
+ v(t, r, o, e, .012), n = requestAnimationFrame(i);
1443
+ };
1444
+ return i(), () => {
1445
+ cancelAnimationFrame(n), y.current = [];
1446
+ };
1447
+ }, [
1448
+ j,
1449
+ M,
1450
+ r,
1451
+ o,
1452
+ l
1453
+ ]), /* @__PURE__ */ c("div", {
1454
+ style: {
1455
+ position: "relative",
1456
+ width: r,
1457
+ height: o
1458
+ },
1459
+ children: [/* @__PURE__ */ s("canvas", {
1460
+ ref: d,
1461
+ style: {
1462
+ width: r,
1463
+ height: o,
1464
+ display: "block",
1465
+ borderRadius: 8
1466
+ },
1467
+ role: "img",
1468
+ "aria-label": "causal flow diagram"
1469
+ }), /* @__PURE__ */ s(b, {
1470
+ ...T,
1471
+ parentW: r,
1472
+ parentH: o
1473
+ })]
1474
+ });
1475
+ }
1476
+ //#endregion
1477
+ //#region src/components/sankey/ProcessSankey.tsx
1478
+ function Ge({ selectedEntity: e, colors: t }) {
1479
+ return /* @__PURE__ */ s(We, {
1480
+ nodes: Oe.nodes,
1481
+ links: Oe.links,
1482
+ width: 960,
1483
+ height: 280,
1484
+ selectedEntity: e
1485
+ });
1486
+ }
1487
+ //#endregion
1488
+ //#region src/components/sankey/RankingSankey.tsx
1489
+ function Ke({ rows: e = [], className: t, colors: n }) {
1490
+ let { nodes: r, links: a } = i(() => {
1491
+ let t = e.slice(0, 5);
1492
+ return {
1493
+ nodes: [{
1494
+ id: "score",
1495
+ name: "Portfolio Score"
1496
+ }, ...t.map((e) => ({
1497
+ id: e.id ?? e.vendor,
1498
+ name: e.vendor
1499
+ }))],
1500
+ links: t.map((e) => ({
1501
+ source: e.id ?? e.vendor,
1502
+ target: "score",
1503
+ value: Math.max(8, e.pricing ?? 0)
1504
+ }))
1505
+ };
1506
+ }, [e]);
1507
+ return /* @__PURE__ */ s(Le, {
1508
+ nodes: r,
1509
+ links: a,
1510
+ width: 760,
1511
+ height: 280,
1512
+ ariaLabel: "sankey chart",
1513
+ className: t,
1514
+ colors: n
1515
+ });
1516
+ }
1517
+ //#endregion
1518
+ //#region src/components/quotationBalance/QuotationBalance.tsx
1519
+ var qe = 500, Je = 320;
1520
+ function Ye({ accepted: e, submitted: t, "data-testid": r }) {
1521
+ let i = a(null), o = a(0);
1522
+ return n(() => {
1523
+ let n = i.current;
1524
+ if (!n) return;
1525
+ let r = h(n, qe, Je);
1526
+ o.current = 0;
1527
+ let a = qe / 2, s = Math.max(e.value, t.value), c = (e.value - t.value) / s * 14, l, d = () => {
1528
+ o.current++;
1529
+ let n = o.current;
1530
+ r.clearRect(0, 0, qe, Je);
1531
+ let i = w(Math.min(n / 80, 1)), p = c * D(Math.min(n / 80, 1)) * Math.PI / 180;
1532
+ r.strokeStyle = f(u.bd, .5 * i), r.lineWidth = 2, r.beginPath(), r.moveTo(a, 100), r.lineTo(a, Je - 80), r.stroke(), r.beginPath(), r.arc(a, 100, 5 * i, 0, Math.PI * 2), r.fillStyle = u.t2, r.fill();
1533
+ let m = {
1534
+ x: a - Math.cos(p) * 160,
1535
+ y: 100 + Math.sin(-p) * 160
1536
+ }, h = {
1537
+ x: a + Math.cos(p) * 160,
1538
+ y: 100 + Math.sin(p) * 160
1539
+ };
1540
+ r.strokeStyle = f(u.t2, .5 * i), r.lineWidth = 2, r.beginPath(), r.moveTo(m.x, m.y), r.lineTo(h.x, h.y), r.stroke();
1541
+ let _ = Math.max(20, e.value / s * 100 * i), v = m.y + 18;
1542
+ g(r, m.x, v + _ / 2, 90 * .5, u.green, .18 * i), r.fillStyle = f(u.green, .5 * i), r.beginPath(), r.roundRect(m.x - 90 / 2, v, 90, _, [
1543
+ 0,
1544
+ 0,
1545
+ 6,
1546
+ 6
1547
+ ]), r.fill(), r.strokeStyle = f(u.green, .7 * i), r.lineWidth = 1.5, r.stroke(), r.strokeStyle = f(u.t3, .35 * i), r.lineWidth = 1, [-90 / 3, 90 / 3].forEach((e) => {
1548
+ r.beginPath(), r.moveTo(m.x + e, m.y + 4), r.lineTo(m.x + e, v), r.stroke();
1549
+ }), i > .5 && (r.globalAlpha = Math.min(1, (i - .5) / .5), r.font = "bold 14px 'JetBrains Mono', monospace", r.fillStyle = u.green, r.textAlign = "center", r.fillText(e.label, m.x, v + _ + 18), r.font = "9px 'JetBrains Mono', monospace", r.fillStyle = u.t2, r.fillText("Accepted", m.x, v + _ + 32), r.fillText(`${e.count} quotations`, m.x, v + _ + 44), r.globalAlpha = 1);
1550
+ let y = Math.max(20, t.value / s * 100 * i), b = h.y + 18;
1551
+ r.fillStyle = f(u.amber, .3 * i), r.strokeStyle = f(u.amber, .5 * i), r.lineWidth = 1.5, r.beginPath(), r.roundRect(h.x - 90 / 2, b, 90, y, [
1552
+ 0,
1553
+ 0,
1554
+ 6,
1555
+ 6
1556
+ ]), r.fill(), r.stroke(), r.strokeStyle = f(u.t3, .35 * i), r.lineWidth = 1, [-90 / 3, 90 / 3].forEach((e) => {
1557
+ r.beginPath(), r.moveTo(h.x + e, h.y + 4), r.lineTo(h.x + e, b), r.stroke();
1558
+ }), i > .5 && (r.globalAlpha = Math.min(1, (i - .5) / .5), r.font = "bold 14px 'JetBrains Mono', monospace", r.fillStyle = u.amber, r.textAlign = "center", r.fillText(t.label, h.x, b + y + 18), r.font = "9px 'JetBrains Mono', monospace", r.fillStyle = u.t2, r.fillText("Submitted", h.x, b + y + 32), r.fillText(`${t.count} quotations`, h.x, b + y + 44), r.globalAlpha = 1), i > .85 && Math.abs(c) > 1 && (r.globalAlpha = Math.min(1, (i - .85) / .15) * .6, r.font = "8px 'JetBrains Mono', monospace", r.fillStyle = u.t3, r.textAlign = "center", r.fillText(`${Math.abs(c).toFixed(1)}° tilt toward accepted`, a, Je - 12), r.globalAlpha = 1), l = requestAnimationFrame(d);
1559
+ };
1560
+ return d(), () => cancelAnimationFrame(l);
1561
+ }, [e, t]), /* @__PURE__ */ s("div", {
1562
+ "data-testid": r,
1563
+ style: {
1564
+ position: "relative",
1565
+ width: qe,
1566
+ height: Je
1567
+ },
1568
+ children: /* @__PURE__ */ s("canvas", {
1569
+ ref: i,
1570
+ role: "img",
1571
+ "aria-label": "Quotation balance — accepted vs submitted quotation value",
1572
+ style: {
1573
+ width: qe,
1574
+ height: Je,
1575
+ display: "block"
1576
+ }
1577
+ })
1578
+ });
1579
+ }
1580
+ //#endregion
1581
+ //#region src/components/quotationTrend/QuotationTrend.tsx
1582
+ var Xe = 680, G = 280;
1583
+ function Ze({ trend: e, "data-testid": t }) {
1584
+ let r = a(null), i = a(/* @__PURE__ */ new Map()), o = a(0), { hoveredRef: l, tooltip: d, hitZonesRef: p } = x(r, {
1585
+ width: Xe,
1586
+ height: G
1587
+ });
1588
+ return n(() => {
1589
+ let t = r.current;
1590
+ if (!t) return;
1591
+ let n = h(t, Xe, G);
1592
+ o.current = 0;
1593
+ let a = Xe - 54 - 28, s = G - 30 - 54, c = Math.max(...e.map((e) => e.count)), d = e.length, m = a / (d - 1), _ = e.map((e, t) => ({
1594
+ x: 54 + t * m,
1595
+ y: 30 + s - e.count / c * s,
1596
+ point: e
1597
+ })), v, b = () => {
1598
+ o.current++;
1599
+ let e = o.current;
1600
+ n.clearRect(0, 0, Xe, G);
1601
+ let t = w(Math.min(e / 72, 1));
1602
+ A(i.current, l.current), p.current = [], [
1603
+ .25,
1604
+ .5,
1605
+ .75,
1606
+ 1
1607
+ ].forEach((e) => {
1608
+ let t = 30 + s - e * s;
1609
+ n.strokeStyle = f(u.bd, .18), n.lineWidth = 1, n.setLineDash([3, 5]), n.beginPath(), n.moveTo(54, t), n.lineTo(54 + a, t), n.stroke(), n.setLineDash([]), n.font = "10px 'JetBrains Mono', monospace", n.fillStyle = f(u.t4, .6), n.textAlign = "right", n.fillText(String(Math.round(c * e)), 48, t + 3);
1610
+ }), n.save(), n.translate(12, 30 + s / 2), n.rotate(-Math.PI / 2), n.font = "11px 'JetBrains Mono', monospace", n.fillStyle = f(u.t3, .5), n.textAlign = "center", n.fillText("Submissions", 0, 0), n.restore(), n.font = "11px 'JetBrains Mono', monospace", n.fillStyle = f(u.t3, .5), n.textAlign = "center", n.fillText("Week", 54 + a / 2, G - 6), n.strokeStyle = f(u.bd, .3), n.lineWidth = 1, n.setLineDash([]), n.beginPath(), n.moveTo(54, 30 + s), n.lineTo(54 + a, 30 + s), n.stroke();
1611
+ let r = t * (d - 1), m = Math.floor(r) + 1;
1612
+ if (m >= 2) {
1613
+ n.beginPath(), n.moveTo(_[0].x, 30 + s), n.lineTo(_[0].x, _[0].y);
1614
+ for (let e = 1; e < m; e++) {
1615
+ let t = r - Math.floor(r), i = e < m - 1 ? _[e].x : _[e - 1].x + (_[e].x - _[e - 1].x) * (e === Math.ceil(r) ? t : 1), a = e < m - 1 ? _[e].y : _[e - 1].y + (_[e].y - _[e - 1].y) * (e === Math.ceil(r) ? t : 1);
1616
+ n.lineTo(i, a);
1617
+ }
1618
+ let e = _[Math.min(m - 1, d - 1)];
1619
+ n.lineTo(e.x, 30 + s), n.closePath();
1620
+ let t = n.createLinearGradient(0, 30, 0, 30 + s);
1621
+ t.addColorStop(0, f(u.cyan, .22)), t.addColorStop(1, f(u.cyan, .02)), n.fillStyle = t, n.fill();
1622
+ }
1623
+ n.beginPath();
1624
+ for (let e = 0; e < m; e++) {
1625
+ let t = r - Math.floor(r), i = e === m - 1 && e > 0 && e === Math.ceil(r), a = e === 0 || e < m - 1 ? _[e].x : _[e - 1].x + (_[e].x - _[e - 1].x) * (i ? t : 1), o = e === 0 || e < m - 1 ? _[e].y : _[e - 1].y + (_[e].y - _[e - 1].y) * (i ? t : 1);
1626
+ e === 0 ? n.moveTo(a, o) : n.lineTo(a, o);
1627
+ }
1628
+ n.strokeStyle = f(u.cyan, .85), n.lineWidth = 2, n.stroke(), _.forEach((e, t) => {
1629
+ if (t >= m) return;
1630
+ let r = `pt-${t}`, a = i.current.get(r) ?? 0;
1631
+ S(p.current, r, e.x, e.y, 10, {
1632
+ label: e.point.week,
1633
+ value: `${e.point.count} quotations submitted`,
1634
+ sublabel: `£${e.point.value}M value`,
1635
+ color: u.cyan
1636
+ }), a > 0 && y(n, e.x, 30, 30 + s, f(u.cyan, .15 * a));
1637
+ let o = e.point.count === c;
1638
+ (a > 0 || o) && g(n, e.x, e.y, 14, u.cyan, (o ? .3 : 0) + a * .25), n.beginPath(), n.arc(e.x, e.y, a > 0 ? 5 : 3.5, 0, Math.PI * 2), n.fillStyle = f(u.cyan, a > 0 ? 1 : .8), n.fill(), (a > 0 || o) && (n.font = "bold 10px 'JetBrains Mono', monospace", n.fillStyle = u.cyan, n.textAlign = "center", n.fillText(String(e.point.count), e.x, e.y - 10)), n.font = "10px 'JetBrains Mono', monospace", n.fillStyle = a > 0 ? u.cyan : f(u.t3, .6), n.textAlign = "center", n.fillText(e.point.week, e.x, G - 54 + 14);
1639
+ }), v = requestAnimationFrame(b);
1640
+ };
1641
+ return b(), () => cancelAnimationFrame(v);
1642
+ }, [e]), /* @__PURE__ */ c("div", {
1643
+ "data-testid": t,
1644
+ style: {
1645
+ position: "relative",
1646
+ width: Xe,
1647
+ height: G
1648
+ },
1649
+ children: [/* @__PURE__ */ s("canvas", {
1650
+ ref: r,
1651
+ role: "img",
1652
+ "aria-label": "Quotation submission trend — weekly count over 12 weeks",
1653
+ style: {
1654
+ width: Xe,
1655
+ height: G,
1656
+ display: "block"
1657
+ }
1658
+ }), /* @__PURE__ */ s(b, {
1659
+ ...d,
1660
+ parentW: Xe,
1661
+ parentH: G
1662
+ })]
1663
+ });
1664
+ }
1665
+ //#endregion
1666
+ //#region src/components/severityBands/SeverityBands.tsx
1667
+ var K = 680, Qe = 240, $e = {
1668
+ Critical: u.red,
1669
+ High: u.orange,
1670
+ Medium: u.amber,
1671
+ Low: u.green
1672
+ };
1673
+ function et({ severities: e, "data-testid": t }) {
1674
+ let r = a(null), i = a(/* @__PURE__ */ new Map()), o = a(0), { hoveredRef: l, tooltip: d, hitZonesRef: p } = x(r, {
1675
+ width: K,
1676
+ height: Qe
1677
+ });
1678
+ return n(() => {
1679
+ let t = r.current;
1680
+ if (!t) return;
1681
+ let n = h(t, K, Qe);
1682
+ o.current = 0;
1683
+ let a = e.reduce((e, t) => e + t.count, 0), s = K - 28 - 28, c = Qe - 50 - 52, d = e.map((e) => e.count / a * s), m, _ = () => {
1684
+ o.current++;
1685
+ let t = o.current;
1686
+ n.clearRect(0, 0, K, Qe);
1687
+ let r = T(Math.min(t / 60, 1));
1688
+ A(i.current, l.current), p.current = [], n.strokeStyle = f(u.bd, .2), n.lineWidth = 1, n.beginPath(), n.rect(28, 50, s, c), n.stroke(), n.strokeStyle = f(u.t4, .15), n.lineWidth = 1, n.setLineDash([4, 4]), n.beginPath(), n.moveTo(K / 2, 50), n.lineTo(K / 2, 50 + c), n.stroke(), n.setLineDash([]);
1689
+ let h = 28;
1690
+ e.forEach((e, t) => {
1691
+ let o = $e[e.severity] ?? u.blue, s = d[t];
1692
+ s * r;
1693
+ let l = i.current.get(e.severity) ?? 0, m = h + s / 2, _ = s * .85;
1694
+ m - _ / 2;
1695
+ let v = s * r, y = _ * r, b = m - y / 2;
1696
+ if (v > 0 && (l > 0 && g(n, h + v / 2, 50 + c / 2, v * .4, o, .15 * l), n.beginPath(), n.moveTo(b, 50), n.lineTo(b + y, 50), n.lineTo(h + v, 50 + c), n.lineTo(h, 50 + c), n.closePath(), n.fillStyle = f(o, .45 + l * .25), n.fill(), n.strokeStyle = f(o, (.5 + l * .3) * r), n.lineWidth = l > 0 ? 2 : 1, n.beginPath(), n.moveTo(b, 50), n.lineTo(b + y, 50), n.stroke(), n.strokeStyle = f(o, (.3 + l * .3) * r), n.lineWidth = l > 0 ? 2 : 1, n.beginPath(), n.moveTo(h, 50 + c), n.lineTo(h + v, 50 + c), n.stroke()), C(p.current, e.severity, h, 50, s, c, {
1697
+ label: e.severity,
1698
+ value: `${e.count} Early Warnings`,
1699
+ sublabel: `${Math.round(e.count / a * 100)}% of all EWs`,
1700
+ color: o
1701
+ }), r > .5) {
1702
+ let t = Math.min(1, (r - .5) / .5), i = h + s / 2;
1703
+ n.globalAlpha = t, n.font = "bold 10px 'JetBrains Mono', monospace", n.fillStyle = l > 0 ? o : f(o, .9), n.textAlign = "center", n.fillText(e.severity, i, 38), n.font = `bold ${s > 80 ? "18" : "13"}px 'JetBrains Mono', monospace`, n.fillStyle = l > 0 ? u.t1 : f(u.t1, .85), n.fillText(String(e.count), i, 50 + c / 2 + 6), n.font = "9px 'JetBrains Mono', monospace", n.fillStyle = l > 0 ? o : f(u.t3, .7), n.fillText(`${Math.round(e.count / a * 100)}%`, i, 50 + c + 18), n.globalAlpha = 1;
1704
+ }
1705
+ h += s;
1706
+ });
1707
+ let v = n.createLinearGradient(28, 0, 28 + s, 0);
1708
+ v.addColorStop(0, f(u.red, .03)), v.addColorStop(.33, f(u.orange, .03)), v.addColorStop(.66, f(u.amber, .03)), v.addColorStop(1, f(u.green, .03)), n.fillStyle = v, n.fillRect(28, 50, s * r, c), m = requestAnimationFrame(_);
1709
+ };
1710
+ return _(), () => cancelAnimationFrame(m);
1711
+ }, [e]), /* @__PURE__ */ c("div", {
1712
+ "data-testid": t,
1713
+ style: {
1714
+ position: "relative",
1715
+ width: K,
1716
+ height: Qe
1717
+ },
1718
+ children: [/* @__PURE__ */ s("canvas", {
1719
+ ref: r,
1720
+ role: "img",
1721
+ "aria-label": "Early Warning severity distribution — prism spectrum bands",
1722
+ style: {
1723
+ width: K,
1724
+ height: Qe,
1725
+ display: "block"
1726
+ }
1727
+ }), /* @__PURE__ */ s(b, {
1728
+ ...d,
1729
+ parentW: K,
1730
+ parentH: Qe
1731
+ })]
1732
+ });
1733
+ }
1734
+ //#endregion
1735
+ //#region src/components/statusArc/StatusArc.tsx
1736
+ var q = 460, J = 300, tt = {
1737
+ Open: u.red,
1738
+ Submitted: u.amber,
1739
+ Closed: u.green
1740
+ };
1741
+ function nt({ segments: e, title: t, "data-testid": r }) {
1742
+ let i = a(null), o = a(0), l = a(/* @__PURE__ */ new Map()), { hoveredRef: d, tooltip: p, hitZonesRef: m } = x(i, {
1743
+ width: q,
1744
+ height: J
1745
+ });
1746
+ return n(() => {
1747
+ let t = i.current;
1748
+ if (!t) return;
1749
+ let n = h(t, q, J);
1750
+ o.current = 0;
1751
+ let r = q * .5, a = J * .54, s = q * .22, c = e.reduce((e, t) => e + t.count, 0), p = Math.max(...e.map((e) => e.count), 1), y, b = () => {
1752
+ o.current++;
1753
+ let t = o.current;
1754
+ n.clearRect(0, 0, q, J), m.current = [], l.current.forEach((e, t) => {
1755
+ let n = t === d.current ? 1 : 0, r = e + (n - e) * .12;
1756
+ Math.abs(r - n) < .005 ? n === 0 ? l.current.delete(t) : l.current.set(t, 1) : l.current.set(t, r);
1757
+ }), d.current && !l.current.has(d.current) && l.current.set(d.current, 0), _(n, q, J, t, 40, f(u.blue, .04)), e.forEach((e, i) => {
1758
+ let o = i / 3 * Math.PI * 2 - Math.PI / 2, c = r + Math.cos(o) * s, l = a + Math.sin(o) * s, d = tt[e.status] ?? u.blue, m = 2 + e.count / p * 8;
1759
+ n.beginPath(), n.moveTo(r, a), n.lineTo(c, l), n.strokeStyle = f(d, .08), n.lineWidth = m * 2, n.stroke(), n.beginPath(), n.moveTo(r, a), n.lineTo(c, l), n.strokeStyle = f(d, .25), n.lineWidth = 1, n.stroke();
1760
+ let h = (t * .005 + i * .33) % 1, _ = r + (c - r) * h, v = a + (l - a) * h;
1761
+ g(n, _, v, 6, d, .4), n.beginPath(), n.arc(_, v, 2, 0, Math.PI * 2), n.fillStyle = f(d, .8), n.fill();
1762
+ let y = (r + c) / 2, b = (a + l) / 2;
1763
+ n.font = "bold 9px 'JetBrains Mono', monospace", n.textAlign = "center", n.textBaseline = "middle", n.fillStyle = f(d, .85), n.fillText(String(e.count), y, b);
1764
+ }), e.forEach((e, t) => {
1765
+ let i = t / 3 * Math.PI * 2 - Math.PI / 2, o = r + Math.cos(i) * s, d = a + Math.sin(i) * s, h = tt[e.status] ?? u.blue, _ = 10 + e.count / p * 18, v = l.current.get(e.status) ?? 0;
1766
+ g(n, o, d, _ * 2.5, h, .2 + v * .15);
1767
+ let y = n.createRadialGradient(o, d - _ * .2, 0, o, d, _);
1768
+ y.addColorStop(0, f(h, .8 + v * .2)), y.addColorStop(1, f(h, .4 + v * .1)), n.beginPath(), n.arc(o, d, _, 0, Math.PI * 2), n.fillStyle = y, n.fill(), n.font = "bold 9px 'JetBrains Mono', monospace", n.textAlign = "center", n.textBaseline = "middle", n.fillStyle = f(u.t1, .9), n.fillText(e.status, o, d), S(m.current, e.status, o, d, _ + 6, {
1769
+ label: e.status,
1770
+ value: `${e.count} Early Warnings`,
1771
+ sublabel: `${Math.round(e.count / c * 100)}%`,
1772
+ color: h
1773
+ });
1774
+ });
1775
+ let i = l.current.get("center") ?? 0;
1776
+ g(n, r, a, 36, u.t3, .2 + i * .15);
1777
+ let h = n.createRadialGradient(r, a - 4, 0, r, a, 22);
1778
+ h.addColorStop(0, f(u.t2, .9)), h.addColorStop(1, f(u.t3, .5)), n.beginPath(), n.arc(r, a, 22, 0, Math.PI * 2), n.fillStyle = h, n.fill(), n.font = "bold 8px 'JetBrains Mono', monospace", n.textAlign = "center", n.textBaseline = "middle", n.fillStyle = f(u.t1, .9), n.fillText("EW Status", r, a - 4), n.font = "bold 10px 'JetBrains Mono', monospace", n.fillStyle = u.t1, n.fillText(String(c), r, a + 8), S(m.current, "center", r, a, 28, {
1779
+ label: "Total EW Status",
1780
+ value: `${c} Early Warnings`,
1781
+ color: u.t3
1782
+ }), v(n, q, J, t, .015), y = requestAnimationFrame(b);
1783
+ };
1784
+ return b(), () => cancelAnimationFrame(y);
1785
+ }, [e, t]), /* @__PURE__ */ c("div", {
1786
+ "data-testid": r,
1787
+ style: {
1788
+ position: "relative",
1789
+ width: q,
1790
+ height: J
1791
+ },
1792
+ children: [/* @__PURE__ */ s("canvas", {
1793
+ ref: i,
1794
+ role: "img",
1795
+ "aria-label": t ?? "EW status arc visualization",
1796
+ style: {
1797
+ width: q,
1798
+ height: J,
1799
+ display: "block",
1800
+ borderRadius: 8
1801
+ }
1802
+ }), /* @__PURE__ */ s(b, {
1803
+ ...p,
1804
+ parentW: q,
1805
+ parentH: J
1806
+ })]
1807
+ });
1808
+ }
1809
+ //#endregion
1810
+ //#region src/components/trendChart/TrendChart.tsx
1811
+ var Y = 280, X = 96;
1812
+ function rt({ points: e = [], className: t, colors: r }) {
1813
+ let o = a(null), d = a(/* @__PURE__ */ new Map()), p = a(0), m = i(() => e.map(([e, t]) => {
1814
+ let n = String(t).match(/-?\d+(\.\d+)?/);
1815
+ return {
1816
+ label: e,
1817
+ value: n ? Number(n[0]) : 0
1818
+ };
1819
+ }), [e]), { mouseRef: _, hoveredRef: v, tooltip: C, hitZonesRef: w } = x(o, {
1820
+ width: Y,
1821
+ height: X
1822
+ });
1823
+ return n(() => {
1824
+ let e = o.current;
1825
+ if (!e) return;
1826
+ let t = h(e, Y, X);
1827
+ p.current = 0;
1828
+ let n = r?.line ?? u.blue, i = r?.point ?? u.blue, a = r?.axisLine ?? u.bd, s, c = () => {
1829
+ p.current++;
1830
+ let e = p.current;
1831
+ if (t.clearRect(0, 0, Y, X), m.length < 2) {
1832
+ s = requestAnimationFrame(c);
1833
+ return;
1834
+ }
1835
+ let r = {
1836
+ left: 12,
1837
+ right: 12,
1838
+ top: 16,
1839
+ bottom: 20
1840
+ }, o = Y - r.left - r.right, l = X - r.top - r.bottom, h = m.map((e) => e.value), b = Math.min(...h), x = Math.max(...h) - b || 1, C = (e) => r.left + e / (m.length - 1) * o, T = (e) => r.top + (1 - (e - b) / x) * l, E = 1 - (1 - Math.min(e / 48, 1)) ** 3, D = Math.max(2, Math.floor(E * m.length));
1841
+ if (A(d.current, v.current), w.current = [], t.strokeStyle = f(a, .3), t.lineWidth = .5, t.setLineDash([]), t.beginPath(), t.moveTo(r.left, X - r.bottom), t.lineTo(Y - r.right, X - r.bottom), t.stroke(), t.font = "9px 'JetBrains Mono', monospace", t.fillStyle = f(u.t4, .9), t.textAlign = "center", m.forEach((e, n) => {
1842
+ t.fillText(e.label.replace("Day ", "D"), C(n), X - 4);
1843
+ }), _.current.over && v.current) {
1844
+ let e = parseInt(v.current.split("-")[1]);
1845
+ isNaN(e) || y(t, C(e), r.top, r.top + l);
1846
+ }
1847
+ if (D > 1) {
1848
+ let e = t.createLinearGradient(0, r.top, 0, r.top + l);
1849
+ e.addColorStop(0, f(n, .15)), e.addColorStop(1, f(n, 0)), t.fillStyle = e, t.beginPath(), t.moveTo(C(0), r.top + l);
1850
+ for (let e = 0; e < D; e++) t.lineTo(C(e), T(m[e].value));
1851
+ t.lineTo(C(D - 1), r.top + l), t.closePath(), t.fill(), t.strokeStyle = f(n, .8), t.lineWidth = 1.5, t.setLineDash([]), t.beginPath();
1852
+ for (let e = 0; e < D; e++) {
1853
+ let n = C(e), r = T(m[e].value);
1854
+ e === 0 ? t.moveTo(n, r) : t.lineTo(n, r);
1855
+ }
1856
+ t.stroke();
1857
+ }
1858
+ for (let e = 0; e < D; e++) {
1859
+ let n = C(e), r = T(m[e].value), a = `tp-${e}`, o = d.current.get(a) ?? 0, s = e === m.length - 1;
1860
+ S(w.current, a, n, r, 10, {
1861
+ label: m[e].label,
1862
+ value: String(m[e].value),
1863
+ color: s ? u.red : i
1864
+ }), o > 0 && !s && (g(t, n, r, 12 * o, i, .2 * o), t.fillStyle = f(i, .8), t.beginPath(), t.arc(n, r, 3 + o * 2, 0, Math.PI * 2), t.fill());
1865
+ }
1866
+ if (D >= m.length) {
1867
+ let n = m.length - 1, r = C(n), i = T(m[n].value), a = d.current.get(`tp-${n}`) ?? 0, o = O(e, .05, 5e-4), s = 1 + a * .5;
1868
+ t.shadowColor = f(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;
1869
+ }
1870
+ s = requestAnimationFrame(c);
1871
+ };
1872
+ return c(), () => cancelAnimationFrame(s);
1873
+ }, [m, r]), /* @__PURE__ */ s(l, {
1874
+ className: ["canvas-trend-frame", t].filter(Boolean).join(" "),
1875
+ children: /* @__PURE__ */ c("div", {
1876
+ style: {
1877
+ position: "relative",
1878
+ width: Y,
1879
+ height: X
1880
+ },
1881
+ children: [/* @__PURE__ */ s("canvas", {
1882
+ ref: o,
1883
+ role: "img",
1884
+ "aria-label": "trend chart",
1885
+ style: {
1886
+ width: Y,
1887
+ height: X,
1888
+ display: "block",
1889
+ borderRadius: 8
1890
+ }
1891
+ }), /* @__PURE__ */ s(b, {
1892
+ ...C,
1893
+ parentW: Y,
1894
+ parentH: X
1895
+ })]
1896
+ })
1897
+ });
1898
+ }
1899
+ //#endregion
1900
+ //#region src/components/variationSplit/VariationSplit.tsx
1901
+ var it = 680, at = 320;
1902
+ function ot({ contractors: e, "data-testid": t }) {
1903
+ let r = a(null), i = a(/* @__PURE__ */ new Map()), o = a(0), { hoveredRef: l, tooltip: p, hitZonesRef: m } = x(r, {
1904
+ width: it,
1905
+ height: at
1906
+ });
1907
+ return n(() => {
1908
+ let t = r.current;
1909
+ if (!t) return;
1910
+ let n = h(t, it, at);
1911
+ o.current = 0;
1912
+ let a = it - 60 - 28, s = Math.max(...e.map((e) => e.implemented + e.unimplemented)), c = e.length * 40 - 14, p = 16 + (at - 16 - 32 - c) / 2, _, v = () => {
1913
+ o.current++;
1914
+ let t = o.current;
1915
+ n.clearRect(0, 0, it, at);
1916
+ let r = T(Math.min(t / 60, 1));
1917
+ A(i.current, l.current), m.current = [], e.forEach((t, o) => {
1918
+ let c = d[o % d.length], l = k(r, o, e.length, T), h = p + o * 40, _ = t.implemented + t.unimplemented, v = t.implemented / s * a * l, y = t.unimplemented / s * a * l, b = `${t.id}-impl`, x = `${t.id}-un`, S = i.current.get(b) ?? 0, w = i.current.get(x) ?? 0;
1919
+ C(m.current, b, 60, h, v || 1, 26, {
1920
+ label: `${t.name} — Implemented`,
1921
+ value: `${t.implemented} variations`,
1922
+ sublabel: `${Math.round(t.implemented / _ * 100)}% complete`,
1923
+ color: u.green
1924
+ }), C(m.current, x, 60 + v, h, y || 1, 26, {
1925
+ label: `${t.name} — Unimplemented`,
1926
+ value: `${t.unimplemented} variations`,
1927
+ sublabel: `${Math.round(t.unimplemented / _ * 100)}% pending`,
1928
+ color: u.amber
1929
+ }), n.font = "9px 'JetBrains Mono', monospace", n.fillStyle = f(c, .85), n.textAlign = "right", n.fillText(t.shortName, 52, h + 26 / 2 + 4), n.fillStyle = f(u.bd, .15), n.beginPath(), n.roundRect(60, h, _ / s * a, 26, 4), n.fill(), v > 0 && (S > 0 && g(n, 60 + v / 2, h + 26 / 2, v * .3, u.green, .12 * S), n.fillStyle = f(u.green, .6 + S * .2), n.beginPath(), n.roundRect(60, h, v, 26, [
1930
+ 4,
1931
+ 0,
1932
+ 0,
1933
+ 4
1934
+ ]), n.fill(), v > 28 && l > .5 && (n.font = "bold 10px 'JetBrains Mono', monospace", n.fillStyle = S > 0 ? u.green : f(u.t1, .8), n.textAlign = "center", n.fillText(String(t.implemented), 60 + v / 2, h + 26 / 2 + 4))), y > 0 && (w > 0 && g(n, 60 + v + y / 2, h + 26 / 2, y * .3, u.amber, .12 * w), n.fillStyle = f(u.amber, .18 + w * .18), n.strokeStyle = f(u.amber, .3 + w * .3), n.lineWidth = 1, n.beginPath(), n.roundRect(60 + v, h, y, 26, [
1935
+ 0,
1936
+ 4,
1937
+ 4,
1938
+ 0
1939
+ ]), n.fill(), n.stroke(), y > 28 && l > .5 && (n.font = `${w > 0 ? "bold " : ""}10px 'JetBrains Mono', monospace`, n.fillStyle = w > 0 ? u.amber : f(u.t3, .8), n.textAlign = "center", n.fillText(String(t.unimplemented), 60 + v + y / 2, h + 26 / 2 + 4))), v > 0 && y > 0 && (n.strokeStyle = f(u.bg, .7), n.lineWidth = 2, n.beginPath(), n.moveTo(60 + v, h), n.lineTo(60 + v, h + 26), n.stroke());
1940
+ });
1941
+ let h = p + c + 24, y = 60 + a / 2;
1942
+ n.font = "9px 'JetBrains Mono', monospace", n.textAlign = "right", n.fillStyle = u.green, n.fillText("■ Implemented", y - 10, h), n.textAlign = "left", n.fillStyle = f(u.t3, .7), n.fillText("■ Unimplemented", y + 10, h), _ = requestAnimationFrame(v);
1943
+ };
1944
+ return v(), () => cancelAnimationFrame(_);
1945
+ }, [e]), /* @__PURE__ */ c("div", {
1946
+ "data-testid": t,
1947
+ style: {
1948
+ position: "relative",
1949
+ width: it,
1950
+ height: at
1951
+ },
1952
+ children: [/* @__PURE__ */ s("canvas", {
1953
+ ref: r,
1954
+ role: "img",
1955
+ "aria-label": "Implemented vs unimplemented variations per contractor — split bar",
1956
+ style: {
1957
+ width: it,
1958
+ height: at,
1959
+ display: "block"
1960
+ }
1961
+ }), /* @__PURE__ */ s(b, {
1962
+ ...p,
1963
+ parentW: it,
1964
+ parentH: at
1965
+ })]
1966
+ });
1967
+ }
1968
+ //#endregion
1969
+ //#region src/components/weeklyFlow/WeeklyFlow.tsx
1970
+ var st = 800, ct = 360;
1971
+ function lt({ contractors: e, "data-testid": t }) {
1972
+ let r = a(null), i = a(/* @__PURE__ */ new Map()), o = a(0), { hoveredRef: l, tooltip: p, hitZonesRef: m } = x(r, {
1973
+ width: st,
1974
+ height: ct
1975
+ });
1976
+ return n(() => {
1977
+ let t = r.current;
1978
+ if (!t) return;
1979
+ let n = h(t, st, ct);
1980
+ o.current = 0;
1981
+ let a = e.reduce((e, t) => e + t.base, 0), s = e.reduce((e, t) => e + t.variations, 0), c = e.reduce((e, t) => e + t.totalCommitment, 0), p = ct - 20 - 26, _ = p - 6 * (e.length - 1), v = 20, y = e.map((e, t) => {
1982
+ let n = Math.max(24, e.totalCommitment / c * _), r = {
1983
+ x: 100 - 110 / 2,
1984
+ y: v,
1985
+ h: n,
1986
+ cy: v + n / 2,
1987
+ c: e,
1988
+ color: d[t % d.length]
1989
+ };
1990
+ return v += n + 6, r;
1991
+ }), b = _ - 14, x = Math.max(28, a / c * b), S = Math.max(18, s / c * b), T = 20 + (p - (x + S + 14)) / 2, E = {
1992
+ x: 420 - 110 / 2,
1993
+ y: T,
1994
+ h: x,
1995
+ cy: T + x / 2
1996
+ }, D = {
1997
+ x: 420 - 110 / 2,
1998
+ y: T + x + 14,
1999
+ h: S,
2000
+ cy: T + x + 14 + S / 2
2001
+ }, O = {
2002
+ x: 720 - 110 / 2,
2003
+ y: 20,
2004
+ h: p,
2005
+ cy: 20 + p / 2
2006
+ }, j, M = () => {
2007
+ o.current++;
2008
+ let t = o.current;
2009
+ n.clearRect(0, 0, st, ct);
2010
+ let r = w(Math.min(t / 80, 1));
2011
+ if (A(i.current, l.current), m.current = [], e.forEach((t, o) => {
2012
+ let c = y[o], l = k(r, o, e.length, w), u = i.current.get(t.id) ?? 0;
2013
+ if (l < .01) return;
2014
+ let d = t.base / t.totalCommitment, f = t.variations / t.totalCommitment, p = c.h * d, m = c.h * f, h = c.y + p / 2, g = c.y + p + m / 2, _ = Math.max(2, t.base / a * x), v = Math.max(2, t.variations / s * S), b = E.y + e.slice(0, o).reduce((e, t) => e + t.base / a * x, 0) + _ / 2, C = D.y + e.slice(0, o).reduce((e, t) => e + t.variations / s * S, 0) + v / 2, T = u * .2 + .18;
2015
+ ut(n, c.x + 110, h, 420 - 110 / 2, b, _ * l, c.color, T), ut(n, c.x + 110, g, 420 - 110 / 2, C, v * l, c.color, T * .75);
2016
+ }), r > .3) {
2017
+ let e = Math.min(1, (r - .3) / .7), t = O.y + a / c * p / 2, i = O.y + p - s / c * p / 2;
2018
+ ut(n, 475, E.cy, 720 - 110 / 2, t, x * e, u.blue, .25 * e), ut(n, 475, D.cy, 720 - 110 / 2, i, S * e, u.amber, .22 * e);
2019
+ }
2020
+ if ([
2021
+ "Contractors",
2022
+ "Components",
2023
+ "Total"
2024
+ ].forEach((e, t) => {
2025
+ let r = [
2026
+ 100,
2027
+ 420,
2028
+ 720
2029
+ ][t];
2030
+ n.font = "9px 'JetBrains Mono', monospace", n.fillStyle = f(u.t3, .5), n.textAlign = "center", n.fillText(e, r, ct - 8);
2031
+ }), e.forEach((t, a) => {
2032
+ let o = y[a], s = k(r, a, e.length, w), c = i.current.get(t.id) ?? 0;
2033
+ C(m.current, t.id, o.x, o.y, 110, o.h, {
2034
+ label: t.name,
2035
+ value: `£${t.totalCommitment}M total commitment`,
2036
+ sublabel: `Base £${t.base}M + Variations £${t.variations}M`,
2037
+ color: o.color
2038
+ }), c > 0 && g(n, o.x + 110 / 2, o.cy, 110 * .6, o.color, .12 * c), n.fillStyle = f(o.color, (.3 + c * .15) * s), n.strokeStyle = f(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 = `${c > 0 ? "bold " : ""}9px 'JetBrains Mono', monospace`, n.fillStyle = c > 0 ? o.color : f(u.t2, .9), n.textAlign = "center", n.textBaseline = "middle", n.fillText(t.shortName, o.x + 110 / 2, o.h >= 36 ? o.cy - 5 : o.cy), o.h >= 36 && (n.font = "8px 'JetBrains Mono', monospace", n.fillStyle = f(u.t3, .8), n.fillText(`£${t.totalCommitment}M`, o.x + 110 / 2, o.cy + 7)), n.globalAlpha = 1, n.textBaseline = "alphabetic");
2039
+ }), r > .2) {
2040
+ let e = Math.min(1, (r - .2) / .4);
2041
+ g(n, 420, E.cy, 30, u.blue, .1 * e), n.fillStyle = f(u.blue, .3 * e), n.strokeStyle = f(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 = "bold 9px 'JetBrains Mono', monospace", n.fillStyle = u.blue, n.textAlign = "center", n.fillText("Base Value", 420, E.cy - 6), n.font = "10px 'JetBrains Mono', monospace", n.fillStyle = u.t1, n.fillText(`£${a}M`, 420, E.cy + 8), n.globalAlpha = 1, n.textBaseline = "alphabetic", g(n, 420, D.cy, 24, u.amber, .1 * e), n.fillStyle = f(u.amber, .22 * e), n.strokeStyle = f(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 = "bold 9px 'JetBrains Mono', monospace", n.fillStyle = u.amber, n.textAlign = "center", n.fillText("Variations", 420, D.cy - 4), n.font = "10px 'JetBrains Mono', monospace", n.fillStyle = u.t1, n.fillText(`£${s}M`, 420, D.cy + 8), n.globalAlpha = 1, n.textBaseline = "alphabetic";
2042
+ }
2043
+ if (r > .5) {
2044
+ let e = Math.min(1, (r - .5) / .5);
2045
+ g(n, 720, O.cy, 44, u.cyan, .2 * e), n.fillStyle = f(u.cyan, .25 * e), n.strokeStyle = f(u.cyan, .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 = "9px 'JetBrains Mono', monospace", n.fillStyle = u.t2, n.textAlign = "center", n.fillText("Total Commitment", 720, O.cy - 12), n.font = "bold 16px 'JetBrains Mono', monospace", n.fillStyle = u.cyan, n.fillText(`£${c}M`, 720, O.cy + 6), n.globalAlpha = 1, n.textBaseline = "alphabetic";
2046
+ }
2047
+ j = requestAnimationFrame(M);
2048
+ };
2049
+ return M(), () => cancelAnimationFrame(j);
2050
+ }, [e]), /* @__PURE__ */ c("div", {
2051
+ "data-testid": t,
2052
+ style: {
2053
+ position: "relative",
2054
+ width: st,
2055
+ height: ct
2056
+ },
2057
+ children: [/* @__PURE__ */ s("canvas", {
2058
+ ref: r,
2059
+ role: "img",
2060
+ "aria-label": "Weekly report flow — base value and variations per contractor flowing to total commitment",
2061
+ style: {
2062
+ width: st,
2063
+ height: ct,
2064
+ display: "block"
2065
+ }
2066
+ }), /* @__PURE__ */ s(b, {
2067
+ ...p,
2068
+ parentW: st,
2069
+ parentH: ct
2070
+ })]
2071
+ });
2072
+ }
2073
+ function ut(e, t, n, r, i, a, o, s) {
2074
+ let c = (t + r) / 2;
2075
+ 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 = f(o, s), e.fill();
2076
+ }
2077
+ //#endregion
2078
+ //#region src/components/visualizationRenderer/VisualizationRenderer.tsx
2079
+ function dt({ config: e, className: t }) {
2080
+ return e.type === "line" ? /* @__PURE__ */ s(Ee, {
2081
+ rows: e.rows,
2082
+ className: t
2083
+ }) : e.type === "area" ? /* @__PURE__ */ s(ee, {
2084
+ rows: e.rows,
2085
+ className: t
2086
+ }) : e.type === "bar" ? /* @__PURE__ */ s(te, {
2087
+ rows: e.rows,
2088
+ className: t
2089
+ }) : e.type === "pie" ? /* @__PURE__ */ s(Fe, {
2090
+ rows: e.rows,
2091
+ variant: "pie",
2092
+ className: t
2093
+ }) : e.type === "donut" ? /* @__PURE__ */ s(Fe, {
2094
+ rows: e.rows,
2095
+ variant: "donut",
2096
+ className: t
2097
+ }) : e.type === "sankey" ? /* @__PURE__ */ s(Ke, {
2098
+ rows: e.rows,
2099
+ className: t
2100
+ }) : e.type === "flow" ? /* @__PURE__ */ s(Ge, {
2101
+ selectedEntity: e.selectedEntity,
2102
+ className: t
2103
+ }) : e.type === "trend" ? /* @__PURE__ */ s(rt, {
2104
+ points: e.points,
2105
+ className: t
2106
+ }) : e.type === "mini-bars" ? /* @__PURE__ */ s(ke, {
2107
+ rows: e.rows,
2108
+ className: t
2109
+ }) : e.type === "contract-value-orb" ? /* @__PURE__ */ s(ye, { data: e.data }) : e.type === "contract-bars" ? /* @__PURE__ */ s(me, { contractors: e.contractors }) : e.type === "commitment-race" ? /* @__PURE__ */ s(re, { contractors: e.contractors }) : e.type === "status-arc" ? /* @__PURE__ */ s(nt, {
2110
+ segments: e.segments,
2111
+ title: e.title
2112
+ }) : e.type === "ew-category" ? /* @__PURE__ */ s(Te, { categories: e.categories }) : e.type === "contractor-rank" ? /* @__PURE__ */ s(we, { contractors: e.contractors }) : e.type === "severity-bands" ? /* @__PURE__ */ s(et, { severities: e.severities }) : e.type === "nce-tree" ? /* @__PURE__ */ s(je, {
2113
+ total: e.total,
2114
+ byContractor: e.byContractor
2115
+ }) : e.type === "compensation-gauge" ? /* @__PURE__ */ s(oe, {
2116
+ pct: e.pct,
2117
+ confirmed: e.confirmed,
2118
+ total: e.total
2119
+ }) : e.type === "variation-split" ? /* @__PURE__ */ s(ot, { contractors: e.contractors }) : e.type === "quotation-balance" ? /* @__PURE__ */ s(Ye, {
2120
+ accepted: e.accepted,
2121
+ submitted: e.submitted
2122
+ }) : e.type === "quotation-trend" ? /* @__PURE__ */ s(Ze, { trend: e.trend }) : e.type === "weekly-flow" ? /* @__PURE__ */ s(lt, { contractors: e.contractors }) : /* @__PURE__ */ s("div", {
2123
+ className: "viz-empty",
2124
+ children: "Visualization unavailable"
2125
+ });
2126
+ }
2127
+ //#endregion
2128
+ //#region src/utils/mounts.tsx
2129
+ var ft = [];
2130
+ function pt(e) {
2131
+ try {
2132
+ return JSON.parse(decodeURIComponent(e));
2133
+ } catch {
2134
+ return null;
2135
+ }
2136
+ }
2137
+ function mt() {
2138
+ for (; ft.length;) {
2139
+ let e = ft.pop();
2140
+ e && e.unmount();
2141
+ }
2142
+ }
2143
+ function ht() {
2144
+ mt(), document.querySelectorAll("[data-d3-viz]").forEach((t) => {
2145
+ let n = t.dataset.d3Viz;
2146
+ if (!n) return;
2147
+ let r = pt(n);
2148
+ if (!r) return;
2149
+ let i = e(t);
2150
+ ft.push(i), i.render(/* @__PURE__ */ s(dt, { config: r }));
2151
+ });
2152
+ }
2153
+ function gt(e) {
2154
+ return encodeURIComponent(JSON.stringify(e));
2155
+ }
2156
+ //#endregion
2157
+ //#region src/components/donutChart/DonutChart.tsx
2158
+ function _t({ rows: e = [], className: t, colors: n }) {
2159
+ return /* @__PURE__ */ s(Fe, {
2160
+ rows: e,
2161
+ variant: "donut",
2162
+ className: t,
2163
+ colors: n
2164
+ });
2165
+ }
2166
+ //#endregion
2167
+ //#region src/components/keyHighlights/KeyHighlights.tsx
2168
+ var Z = {
2169
+ bg: "rgba(255,255,255,0.025)",
2170
+ border: "rgba(28,45,66,0.9)",
2171
+ t1: "#F1F5F9",
2172
+ t2: "#CBD5E1",
2173
+ t3: "#94A3B8",
2174
+ t4: "#64748B",
2175
+ red: "#F06060",
2176
+ amber: "#FBBF24",
2177
+ green: "#34D399"
2178
+ }, Q = "'JetBrains Mono', monospace", $ = "'DM Sans', sans-serif";
2179
+ function vt({ chips: e }) {
2180
+ return /* @__PURE__ */ s("div", {
2181
+ style: {
2182
+ display: "flex",
2183
+ gap: 6,
2184
+ marginTop: 10
2185
+ },
2186
+ children: e.map((e, t) => /* @__PURE__ */ c("div", {
2187
+ style: {
2188
+ flex: 1,
2189
+ display: "flex",
2190
+ alignItems: "baseline",
2191
+ gap: 8,
2192
+ padding: "8px 12px",
2193
+ background: Z.bg,
2194
+ border: `1px solid ${Z.border}`,
2195
+ borderRadius: 5
2196
+ },
2197
+ children: [/* @__PURE__ */ s("span", {
2198
+ style: {
2199
+ fontSize: 13,
2200
+ fontWeight: 700,
2201
+ color: e.color ?? Z.t1,
2202
+ fontFamily: Q
2203
+ },
2204
+ children: e.value
2205
+ }), /* @__PURE__ */ s("span", {
2206
+ style: {
2207
+ fontSize: 11,
2208
+ color: Z.t4,
2209
+ fontFamily: $,
2210
+ lineHeight: 1.4
2211
+ },
2212
+ children: e.label
2213
+ })]
2214
+ }, t))
2215
+ });
2216
+ }
2217
+ function yt({ items: e }) {
2218
+ return /* @__PURE__ */ s("div", {
2219
+ style: {
2220
+ display: "flex",
2221
+ gap: 8
2222
+ },
2223
+ children: e.map((e, t) => /* @__PURE__ */ c("div", {
2224
+ style: {
2225
+ flex: 1,
2226
+ padding: "12px 16px",
2227
+ background: Z.bg,
2228
+ border: `1px solid ${Z.border}`,
2229
+ borderTop: `2px solid ${e.color ?? Z.t4}`,
2230
+ borderRadius: 7,
2231
+ textAlign: "center"
2232
+ },
2233
+ children: [/* @__PURE__ */ s("div", {
2234
+ style: {
2235
+ fontSize: 22,
2236
+ fontWeight: 700,
2237
+ color: e.color ?? Z.t1,
2238
+ fontFamily: Q,
2239
+ lineHeight: 1.15
2240
+ },
2241
+ children: e.value
2242
+ }), /* @__PURE__ */ s("div", {
2243
+ style: {
2244
+ fontSize: 11,
2245
+ color: Z.t4,
2246
+ fontFamily: $,
2247
+ marginTop: 5,
2248
+ lineHeight: 1.45
2249
+ },
2250
+ children: e.label
2251
+ })]
2252
+ }, t))
2253
+ });
2254
+ }
2255
+ function bt({ items: e }) {
2256
+ return /* @__PURE__ */ s("div", {
2257
+ style: {
2258
+ display: "flex",
2259
+ flexDirection: "column",
2260
+ gap: 5
2261
+ },
2262
+ children: e.map((e, t) => /* @__PURE__ */ c("div", {
2263
+ style: {
2264
+ display: "flex",
2265
+ alignItems: "center",
2266
+ gap: 12,
2267
+ padding: "9px 14px",
2268
+ background: Z.bg,
2269
+ border: `1px solid ${Z.border}`,
2270
+ borderLeft: `3px solid ${e.color}`,
2271
+ borderRadius: 6
2272
+ },
2273
+ children: [
2274
+ /* @__PURE__ */ s("span", {
2275
+ style: {
2276
+ fontSize: 11,
2277
+ fontWeight: 600,
2278
+ color: e.color,
2279
+ background: e.color + "22",
2280
+ padding: "2px 8px",
2281
+ borderRadius: 4,
2282
+ fontFamily: $,
2283
+ flexShrink: 0
2284
+ },
2285
+ children: e.name
2286
+ }),
2287
+ /* @__PURE__ */ s("span", {
2288
+ style: {
2289
+ fontSize: 18,
2290
+ fontWeight: 700,
2291
+ color: e.color,
2292
+ fontFamily: Q,
2293
+ minWidth: 70,
2294
+ flexShrink: 0
2295
+ },
2296
+ children: e.value
2297
+ }),
2298
+ /* @__PURE__ */ s("span", {
2299
+ style: {
2300
+ fontSize: 11,
2301
+ color: Z.t4,
2302
+ fontFamily: $,
2303
+ flex: 1,
2304
+ lineHeight: 1.45
2305
+ },
2306
+ children: e.kpiLabel
2307
+ })
2308
+ ]
2309
+ }, t))
2310
+ });
2311
+ }
2312
+ function xt({ items: e }) {
2313
+ return /* @__PURE__ */ s("div", {
2314
+ style: {
2315
+ display: "flex",
2316
+ gap: 8
2317
+ },
2318
+ children: e.map((e, t) => /* @__PURE__ */ c("div", {
2319
+ style: {
2320
+ flex: 1,
2321
+ padding: "14px 16px",
2322
+ background: Z.bg,
2323
+ border: `1px solid ${e.color ? e.color + "30" : Z.border}`,
2324
+ borderRadius: 7
2325
+ },
2326
+ children: [/* @__PURE__ */ s("div", {
2327
+ style: {
2328
+ fontSize: 26,
2329
+ fontWeight: 700,
2330
+ color: e.color ?? Z.t1,
2331
+ fontFamily: Q,
2332
+ lineHeight: 1.1
2333
+ },
2334
+ children: e.value
2335
+ }), /* @__PURE__ */ s("div", {
2336
+ style: {
2337
+ fontSize: 14,
2338
+ color: Z.t4,
2339
+ fontFamily: $,
2340
+ marginTop: 6,
2341
+ lineHeight: 1.5
2342
+ },
2343
+ children: e.label
2344
+ })]
2345
+ }, t))
2346
+ });
2347
+ }
2348
+ var St = {
2349
+ red: Z.red,
2350
+ amber: Z.amber,
2351
+ green: Z.green
2352
+ };
2353
+ function Ct({ items: e }) {
2354
+ return /* @__PURE__ */ s("div", {
2355
+ style: {
2356
+ display: "flex",
2357
+ flexDirection: "column",
2358
+ gap: 5
2359
+ },
2360
+ children: e.map((e, t) => {
2361
+ let n = St[e.severity];
2362
+ return /* @__PURE__ */ c("div", {
2363
+ style: {
2364
+ display: "flex",
2365
+ alignItems: "flex-start",
2366
+ gap: 10,
2367
+ padding: "10px 14px",
2368
+ background: n + "0C",
2369
+ border: `1px solid ${n}28`,
2370
+ borderLeft: `3px solid ${n}`,
2371
+ borderRadius: 6
2372
+ },
2373
+ children: [/* @__PURE__ */ s("span", { style: {
2374
+ width: 7,
2375
+ height: 7,
2376
+ borderRadius: "50%",
2377
+ background: n,
2378
+ flexShrink: 0,
2379
+ marginTop: 5
2380
+ } }), /* @__PURE__ */ s("span", {
2381
+ style: {
2382
+ fontSize: 12,
2383
+ color: Z.t2,
2384
+ fontFamily: $,
2385
+ lineHeight: 1.6
2386
+ },
2387
+ children: e.text
2388
+ })]
2389
+ }, t);
2390
+ })
2391
+ });
2392
+ }
2393
+ function wt({ min: e, max: t, unit: n, dots: r, chips: i }) {
2394
+ let a = t - e;
2395
+ return /* @__PURE__ */ c("div", { children: [/* @__PURE__ */ c("div", {
2396
+ style: {
2397
+ position: "relative",
2398
+ height: 90,
2399
+ marginTop: 4
2400
+ },
2401
+ children: [
2402
+ /* @__PURE__ */ s("div", { style: {
2403
+ position: "absolute",
2404
+ top: 38,
2405
+ left: 8,
2406
+ right: 8,
2407
+ height: 2,
2408
+ background: "rgba(255,255,255,0.08)",
2409
+ borderRadius: 1
2410
+ } }),
2411
+ /* @__PURE__ */ c("div", {
2412
+ style: {
2413
+ position: "absolute",
2414
+ top: 43,
2415
+ left: 0,
2416
+ fontSize: 9,
2417
+ color: Z.t4,
2418
+ fontFamily: Q
2419
+ },
2420
+ children: [e, n]
2421
+ }),
2422
+ /* @__PURE__ */ c("div", {
2423
+ style: {
2424
+ position: "absolute",
2425
+ top: 43,
2426
+ right: 0,
2427
+ fontSize: 9,
2428
+ color: Z.t4,
2429
+ fontFamily: Q
2430
+ },
2431
+ children: [t, n]
2432
+ }),
2433
+ r.map((t, r) => {
2434
+ let i = (t.val - e) / a * 100, o = r % 2 == 0;
2435
+ return /* @__PURE__ */ c("div", {
2436
+ style: {
2437
+ position: "absolute",
2438
+ left: `${i}%`,
2439
+ top: 0,
2440
+ transform: "translateX(-50%)"
2441
+ },
2442
+ children: [
2443
+ o && /* @__PURE__ */ c("div", {
2444
+ style: {
2445
+ textAlign: "center",
2446
+ marginBottom: 2
2447
+ },
2448
+ children: [/* @__PURE__ */ s("div", {
2449
+ style: {
2450
+ fontSize: 9,
2451
+ color: t.color,
2452
+ fontFamily: $,
2453
+ whiteSpace: "nowrap"
2454
+ },
2455
+ children: t.name
2456
+ }), /* @__PURE__ */ c("div", {
2457
+ style: {
2458
+ fontSize: 9,
2459
+ fontWeight: 700,
2460
+ color: t.color,
2461
+ fontFamily: Q,
2462
+ whiteSpace: "nowrap"
2463
+ },
2464
+ children: [t.val, n]
2465
+ })]
2466
+ }),
2467
+ /* @__PURE__ */ s("div", { style: {
2468
+ width: 10,
2469
+ height: 10,
2470
+ borderRadius: "50%",
2471
+ background: t.color,
2472
+ boxShadow: `0 0 8px ${t.color}70`,
2473
+ margin: o ? "0 auto" : "26px auto 0"
2474
+ } }),
2475
+ !o && /* @__PURE__ */ c("div", {
2476
+ style: {
2477
+ textAlign: "center",
2478
+ marginTop: 4
2479
+ },
2480
+ children: [/* @__PURE__ */ s("div", {
2481
+ style: {
2482
+ fontSize: 9,
2483
+ color: t.color,
2484
+ fontFamily: $,
2485
+ whiteSpace: "nowrap"
2486
+ },
2487
+ children: t.name
2488
+ }), /* @__PURE__ */ c("div", {
2489
+ style: {
2490
+ fontSize: 9,
2491
+ fontWeight: 700,
2492
+ color: t.color,
2493
+ fontFamily: Q,
2494
+ whiteSpace: "nowrap"
2495
+ },
2496
+ children: [t.val, n]
2497
+ })]
2498
+ })
2499
+ ]
2500
+ }, r);
2501
+ })
2502
+ ]
2503
+ }), i && i.length > 0 && /* @__PURE__ */ s(vt, { chips: i })] });
2504
+ }
2505
+ function Tt({ leftPct: e, leftLabel: t, leftValue: n, leftColor: r, rightPct: i, rightLabel: a, rightValue: o, rightColor: l, chips: u }) {
2506
+ return /* @__PURE__ */ c("div", { children: [
2507
+ /* @__PURE__ */ c("div", {
2508
+ style: {
2509
+ display: "flex",
2510
+ borderRadius: 6,
2511
+ overflow: "hidden",
2512
+ height: 36,
2513
+ marginBottom: 8
2514
+ },
2515
+ children: [
2516
+ /* @__PURE__ */ s("div", {
2517
+ style: {
2518
+ width: `${e}%`,
2519
+ background: r + "38",
2520
+ display: "flex",
2521
+ alignItems: "center",
2522
+ justifyContent: "flex-end",
2523
+ paddingRight: 12
2524
+ },
2525
+ children: /* @__PURE__ */ s("span", {
2526
+ style: {
2527
+ fontSize: 12,
2528
+ fontWeight: 700,
2529
+ color: r,
2530
+ fontFamily: Q
2531
+ },
2532
+ children: n
2533
+ })
2534
+ }),
2535
+ /* @__PURE__ */ s("div", { style: {
2536
+ width: 1,
2537
+ background: "rgba(255,255,255,0.12)",
2538
+ flexShrink: 0
2539
+ } }),
2540
+ /* @__PURE__ */ s("div", {
2541
+ style: {
2542
+ width: `${i}%`,
2543
+ background: l + "2A",
2544
+ display: "flex",
2545
+ alignItems: "center",
2546
+ paddingLeft: 12
2547
+ },
2548
+ children: /* @__PURE__ */ s("span", {
2549
+ style: {
2550
+ fontSize: 12,
2551
+ fontWeight: 700,
2552
+ color: l,
2553
+ fontFamily: Q
2554
+ },
2555
+ children: o
2556
+ })
2557
+ })
2558
+ ]
2559
+ }),
2560
+ /* @__PURE__ */ c("div", {
2561
+ style: {
2562
+ display: "flex",
2563
+ marginBottom: u ? 4 : 0
2564
+ },
2565
+ children: [/* @__PURE__ */ s("div", {
2566
+ style: { width: `${e}%` },
2567
+ children: /* @__PURE__ */ c("span", {
2568
+ style: {
2569
+ fontSize: 10,
2570
+ color: r,
2571
+ fontFamily: $
2572
+ },
2573
+ children: [
2574
+ e,
2575
+ "% ",
2576
+ t
2577
+ ]
2578
+ })
2579
+ }), /* @__PURE__ */ s("div", {
2580
+ style: {
2581
+ width: `${i}%`,
2582
+ paddingLeft: 10
2583
+ },
2584
+ children: /* @__PURE__ */ c("span", {
2585
+ style: {
2586
+ fontSize: 10,
2587
+ color: l,
2588
+ fontFamily: $
2589
+ },
2590
+ children: [
2591
+ i,
2592
+ "% ",
2593
+ a
2594
+ ]
2595
+ })
2596
+ })]
2597
+ }),
2598
+ u && u.length > 0 && /* @__PURE__ */ s(vt, { chips: u })
2599
+ ] });
2600
+ }
2601
+ function Et({ pct: e, label: t, color: n, chips: r }) {
2602
+ let i = 2 * Math.PI * 30, a = i * (1 - e / 100);
2603
+ return /* @__PURE__ */ c("div", {
2604
+ style: {
2605
+ display: "flex",
2606
+ alignItems: "center",
2607
+ gap: 20
2608
+ },
2609
+ children: [/* @__PURE__ */ c("div", {
2610
+ style: {
2611
+ position: "relative",
2612
+ flexShrink: 0,
2613
+ width: 80,
2614
+ height: 80
2615
+ },
2616
+ children: [/* @__PURE__ */ c("svg", {
2617
+ width: 80,
2618
+ height: 80,
2619
+ style: { transform: "rotate(-90deg)" },
2620
+ children: [/* @__PURE__ */ s("circle", {
2621
+ cx: 40,
2622
+ cy: 40,
2623
+ r: 30,
2624
+ fill: "none",
2625
+ stroke: "rgba(255,255,255,0.07)",
2626
+ strokeWidth: 8
2627
+ }), /* @__PURE__ */ s("circle", {
2628
+ cx: 40,
2629
+ cy: 40,
2630
+ r: 30,
2631
+ fill: "none",
2632
+ stroke: n,
2633
+ strokeWidth: 8,
2634
+ strokeDasharray: i,
2635
+ strokeDashoffset: a,
2636
+ strokeLinecap: "round"
2637
+ })]
2638
+ }), /* @__PURE__ */ s("div", {
2639
+ style: {
2640
+ position: "absolute",
2641
+ top: "50%",
2642
+ left: "50%",
2643
+ transform: "translate(-50%, -50%)",
2644
+ textAlign: "center"
2645
+ },
2646
+ children: /* @__PURE__ */ c("div", {
2647
+ style: {
2648
+ fontSize: 15,
2649
+ fontWeight: 700,
2650
+ color: n,
2651
+ fontFamily: Q
2652
+ },
2653
+ children: [e, "%"]
2654
+ })
2655
+ })]
2656
+ }), /* @__PURE__ */ c("div", {
2657
+ style: { flex: 1 },
2658
+ children: [/* @__PURE__ */ s("div", {
2659
+ style: {
2660
+ fontSize: 12,
2661
+ color: Z.t3,
2662
+ fontFamily: $,
2663
+ marginBottom: 10,
2664
+ lineHeight: 1.5
2665
+ },
2666
+ children: t
2667
+ }), r && /* @__PURE__ */ s("div", {
2668
+ style: {
2669
+ display: "flex",
2670
+ flexDirection: "column",
2671
+ gap: 5
2672
+ },
2673
+ children: r.map((e, t) => /* @__PURE__ */ c("div", {
2674
+ style: {
2675
+ display: "flex",
2676
+ alignItems: "baseline",
2677
+ gap: 8,
2678
+ padding: "7px 10px",
2679
+ background: Z.bg,
2680
+ border: `1px solid ${Z.border}`,
2681
+ borderRadius: 5
2682
+ },
2683
+ children: [/* @__PURE__ */ s("span", {
2684
+ style: {
2685
+ fontSize: 13,
2686
+ fontWeight: 700,
2687
+ color: e.color ?? Z.t1,
2688
+ fontFamily: Q
2689
+ },
2690
+ children: e.value
2691
+ }), /* @__PURE__ */ s("span", {
2692
+ style: {
2693
+ fontSize: 11,
2694
+ color: Z.t4,
2695
+ fontFamily: $,
2696
+ lineHeight: 1.4
2697
+ },
2698
+ children: e.label
2699
+ })]
2700
+ }, t))
2701
+ })]
2702
+ })]
2703
+ });
2704
+ }
2705
+ var Dt = {
2706
+ green: "#34D39918",
2707
+ amber: "#FBBF2418",
2708
+ red: "#F0606018"
2709
+ }, Ot = {
2710
+ green: "#34D399",
2711
+ amber: "#FBBF24",
2712
+ red: "#F06060"
2713
+ };
2714
+ function kt({ items: e }) {
2715
+ return /* @__PURE__ */ s("div", {
2716
+ style: {
2717
+ display: "flex",
2718
+ flexDirection: "column",
2719
+ gap: 5
2720
+ },
2721
+ children: e.map((e, t) => /* @__PURE__ */ c("div", {
2722
+ style: {
2723
+ display: "flex",
2724
+ alignItems: "center",
2725
+ gap: 10,
2726
+ padding: "8px 12px",
2727
+ background: Z.bg,
2728
+ border: `1px solid ${Z.border}`,
2729
+ borderLeft: `3px solid ${e.color}`,
2730
+ borderRadius: 6
2731
+ },
2732
+ children: [
2733
+ /* @__PURE__ */ s("span", {
2734
+ style: {
2735
+ fontSize: 11,
2736
+ fontWeight: 600,
2737
+ color: e.color,
2738
+ background: e.color + "1A",
2739
+ padding: "2px 7px",
2740
+ borderRadius: 4,
2741
+ fontFamily: $,
2742
+ flexShrink: 0,
2743
+ minWidth: 62,
2744
+ textAlign: "center"
2745
+ },
2746
+ children: e.name
2747
+ }),
2748
+ /* @__PURE__ */ s("div", {
2749
+ style: {
2750
+ flex: 1,
2751
+ height: 4,
2752
+ background: "rgba(255,255,255,0.07)",
2753
+ borderRadius: 2,
2754
+ overflow: "hidden"
2755
+ },
2756
+ children: /* @__PURE__ */ s("div", { style: {
2757
+ height: "100%",
2758
+ width: `${e.pct}%`,
2759
+ background: e.color,
2760
+ borderRadius: 2,
2761
+ opacity: .75
2762
+ } })
2763
+ }),
2764
+ /* @__PURE__ */ s("span", {
2765
+ style: {
2766
+ fontSize: 13,
2767
+ fontWeight: 700,
2768
+ color: e.color,
2769
+ fontFamily: Q,
2770
+ flexShrink: 0,
2771
+ minWidth: 52,
2772
+ textAlign: "right"
2773
+ },
2774
+ children: e.value
2775
+ }),
2776
+ e.badge && e.badgeSeverity && /* @__PURE__ */ s("span", {
2777
+ style: {
2778
+ fontSize: 10,
2779
+ fontWeight: 600,
2780
+ color: Ot[e.badgeSeverity],
2781
+ background: Dt[e.badgeSeverity],
2782
+ padding: "2px 7px",
2783
+ borderRadius: 4,
2784
+ fontFamily: $,
2785
+ flexShrink: 0,
2786
+ minWidth: 72,
2787
+ textAlign: "center"
2788
+ },
2789
+ children: e.badge
2790
+ }),
2791
+ e.sublabel && /* @__PURE__ */ s("span", {
2792
+ style: {
2793
+ fontSize: 10,
2794
+ color: Z.t4,
2795
+ fontFamily: $,
2796
+ flexShrink: 0,
2797
+ minWidth: 80,
2798
+ textAlign: "right"
2799
+ },
2800
+ children: e.sublabel
2801
+ })
2802
+ ]
2803
+ }, t))
2804
+ });
2805
+ }
2806
+ var At = {
2807
+ red: Z.red,
2808
+ amber: Z.amber,
2809
+ green: Z.green
2810
+ };
2811
+ function jt({ items: e }) {
2812
+ return /* @__PURE__ */ s("div", {
2813
+ style: {
2814
+ display: "flex",
2815
+ flexDirection: "column",
2816
+ gap: 5
2817
+ },
2818
+ children: e.map((e, t) => {
2819
+ let n = At[e.severity];
2820
+ return /* @__PURE__ */ c("div", {
2821
+ style: {
2822
+ display: "flex",
2823
+ alignItems: "flex-start",
2824
+ gap: 10,
2825
+ padding: "9px 12px",
2826
+ background: n + "0A",
2827
+ border: `1px solid ${n}25`,
2828
+ borderLeft: `3px solid ${n}`,
2829
+ borderRadius: 6
2830
+ },
2831
+ children: [
2832
+ /* @__PURE__ */ s("span", { style: {
2833
+ width: 7,
2834
+ height: 7,
2835
+ borderRadius: "50%",
2836
+ background: n,
2837
+ flexShrink: 0,
2838
+ marginTop: 5
2839
+ } }),
2840
+ /* @__PURE__ */ s("span", {
2841
+ style: {
2842
+ flex: 1,
2843
+ fontSize: 12,
2844
+ color: Z.t2,
2845
+ fontFamily: $,
2846
+ lineHeight: 1.5
2847
+ },
2848
+ children: e.text
2849
+ }),
2850
+ /* @__PURE__ */ s("span", {
2851
+ style: {
2852
+ fontSize: 10,
2853
+ fontWeight: 600,
2854
+ color: n,
2855
+ background: n + "20",
2856
+ padding: "2px 7px",
2857
+ borderRadius: 4,
2858
+ fontFamily: $,
2859
+ flexShrink: 0
2860
+ },
2861
+ children: e.tag
2862
+ }),
2863
+ /* @__PURE__ */ s("span", {
2864
+ style: {
2865
+ fontSize: 10,
2866
+ color: Z.t4,
2867
+ fontFamily: Q,
2868
+ flexShrink: 0,
2869
+ marginTop: 1
2870
+ },
2871
+ children: e.date
2872
+ })
2873
+ ]
2874
+ }, t);
2875
+ })
2876
+ });
2877
+ }
2878
+ function Mt({ columns: e, rows: t }) {
2879
+ return /* @__PURE__ */ c("div", {
2880
+ style: {
2881
+ display: "flex",
2882
+ flexDirection: "column",
2883
+ gap: 5
2884
+ },
2885
+ children: [/* @__PURE__ */ c("div", {
2886
+ style: {
2887
+ display: "flex",
2888
+ alignItems: "center",
2889
+ gap: 10,
2890
+ padding: "0 12px 6px",
2891
+ borderBottom: `1px solid ${Z.border}`
2892
+ },
2893
+ children: [/* @__PURE__ */ s("div", { style: { minWidth: 64 } }), e.map((e, t) => /* @__PURE__ */ s("div", {
2894
+ style: {
2895
+ flex: 1,
2896
+ fontSize: 9,
2897
+ fontWeight: 600,
2898
+ color: Z.t4,
2899
+ fontFamily: $,
2900
+ textTransform: "uppercase",
2901
+ letterSpacing: .6
2902
+ },
2903
+ children: e
2904
+ }, t))]
2905
+ }), t.map((e, t) => /* @__PURE__ */ c("div", {
2906
+ style: {
2907
+ display: "flex",
2908
+ alignItems: "center",
2909
+ gap: 10,
2910
+ padding: "8px 12px",
2911
+ background: Z.bg,
2912
+ border: `1px solid ${Z.border}`,
2913
+ borderLeft: `3px solid ${e.color ?? Z.t4}`,
2914
+ borderRadius: 6
2915
+ },
2916
+ children: [/* @__PURE__ */ s("span", {
2917
+ style: {
2918
+ fontSize: 11,
2919
+ fontWeight: 600,
2920
+ color: e.color ?? Z.t2,
2921
+ background: (e.color ?? Z.t4) + "1A",
2922
+ padding: "2px 8px",
2923
+ borderRadius: 4,
2924
+ fontFamily: $,
2925
+ flexShrink: 0,
2926
+ minWidth: 64,
2927
+ textAlign: "center"
2928
+ },
2929
+ children: e.label
2930
+ }), e.cells.map((t, n) => /* @__PURE__ */ s("span", {
2931
+ style: {
2932
+ flex: 1,
2933
+ fontSize: 13,
2934
+ fontWeight: 700,
2935
+ color: e.color ?? Z.t1,
2936
+ fontFamily: Q
2937
+ },
2938
+ children: t
2939
+ }, n))]
2940
+ }, t))]
2941
+ });
2942
+ }
2943
+ function Nt({ text: e }) {
2944
+ return /* @__PURE__ */ c("div", {
2945
+ style: {
2946
+ marginTop: 10,
2947
+ padding: "8px 12px",
2948
+ background: "rgba(255,255,255,0.015)",
2949
+ border: `1px solid ${Z.border}`,
2950
+ borderLeft: "2px solid rgba(100,116,139,0.35)",
2951
+ borderRadius: 5
2952
+ },
2953
+ children: [/* @__PURE__ */ s("span", {
2954
+ style: {
2955
+ fontSize: 10,
2956
+ fontWeight: 700,
2957
+ color: Z.t4,
2958
+ fontFamily: $,
2959
+ letterSpacing: .5,
2960
+ textTransform: "uppercase",
2961
+ marginRight: 8
2962
+ },
2963
+ children: "Takeaway"
2964
+ }), /* @__PURE__ */ s("span", {
2965
+ style: {
2966
+ fontSize: 11,
2967
+ color: Z.t3,
2968
+ fontFamily: $,
2969
+ lineHeight: 1.6
2970
+ },
2971
+ children: e
2972
+ })]
2973
+ });
2974
+ }
2975
+ function Pt({ block: e }) {
2976
+ if (!e) return null;
2977
+ let t = (() => {
2978
+ switch (e.type) {
2979
+ case "stats": return /* @__PURE__ */ s(yt, { items: e.items });
2980
+ case "ranked": return /* @__PURE__ */ s(bt, { items: e.items });
2981
+ case "chips": return /* @__PURE__ */ s(xt, { items: e.items });
2982
+ case "badges": return /* @__PURE__ */ s(Ct, { items: e.items });
2983
+ case "dot-strip": return /* @__PURE__ */ s(wt, {
2984
+ min: e.min,
2985
+ max: e.max,
2986
+ unit: e.unit,
2987
+ dots: e.dots,
2988
+ chips: e.chips
2989
+ });
2990
+ case "proportion": return /* @__PURE__ */ s(Tt, {
2991
+ leftPct: e.leftPct,
2992
+ leftLabel: e.leftLabel,
2993
+ leftValue: e.leftValue,
2994
+ leftColor: e.leftColor,
2995
+ rightPct: e.rightPct,
2996
+ rightLabel: e.rightLabel,
2997
+ rightValue: e.rightValue,
2998
+ rightColor: e.rightColor,
2999
+ chips: e.chips
3000
+ });
3001
+ case "ring": return /* @__PURE__ */ s(Et, {
3002
+ pct: e.pct,
3003
+ label: e.label,
3004
+ color: e.color,
3005
+ chips: e.chips
3006
+ });
3007
+ case "scorecard-rows": return /* @__PURE__ */ s(kt, { items: e.items });
3008
+ case "flags-list": return /* @__PURE__ */ s(jt, { items: e.items });
3009
+ case "comparison-rows": return /* @__PURE__ */ s(Mt, {
3010
+ columns: e.columns,
3011
+ rows: e.rows
3012
+ });
3013
+ default: return null;
3014
+ }
3015
+ })();
3016
+ return e.takeaway ? /* @__PURE__ */ c("div", { children: [t, /* @__PURE__ */ s(Nt, { text: e.takeaway })] }) : t;
3017
+ }
3018
+ //#endregion
3019
+ export { ee as AreaChart, te as BarChart, l as ChartFrame, _t as DonutChart, Pt as KeyHighlights, Ee as LineChart, ke as MiniBars, Fe as PieChart, Ge as ProcessSankey, Ke as RankingSankey, Le as SankeySvg, N as SeriesChart, rt as TrendChart, dt as VisualizationRenderer, mt as cleanupVisualizationMounts, ht as hydrateVisualizationMounts, gt as serializeVisualizationConfig };