@elevasis/ui 2.34.0 → 2.36.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (116) hide show
  1. package/dist/api/index.js +3 -3
  2. package/dist/app/index.d.ts +37 -30
  3. package/dist/app/index.js +25 -23
  4. package/dist/charts/index.js +3 -5
  5. package/dist/{chunk-ND5TDV2J.js → chunk-57OZ3AEG.js} +1 -1
  6. package/dist/{chunk-E4WQGJNS.js → chunk-7FPLLSHN.js} +14 -1
  7. package/dist/{chunk-RQA2EVN3.js → chunk-AKW7KISS.js} +39 -3
  8. package/dist/chunk-AUDNF2Q7.js +2050 -0
  9. package/dist/chunk-F6EFC2MJ.js +41101 -0
  10. package/dist/{chunk-TYRUKGGD.js → chunk-GX6XBRRF.js} +1 -2
  11. package/dist/{chunk-RIAXZ6AH.js → chunk-K4UZU3TU.js} +2 -2
  12. package/dist/{chunk-V6SZ4ECN.js → chunk-LUYVRATI.js} +257 -6
  13. package/dist/{chunk-DTFKWZ7A.js → chunk-O2Q4VMRN.js} +589 -932
  14. package/dist/{chunk-X4WBGKJQ.js → chunk-R3VCBZDC.js} +50 -3
  15. package/dist/chunk-SIQ3P4OR.js +1764 -0
  16. package/dist/{chunk-3FV6HBXS.js → chunk-WF7CONXF.js} +23 -23
  17. package/dist/{chunk-3QXJK5IY.js → chunk-YYX7OPZQ.js} +1 -1
  18. package/dist/components/index.d.ts +74 -71
  19. package/dist/components/index.js +20 -2795
  20. package/dist/components/navigation/index.js +25 -5
  21. package/dist/execution/index.d.ts +11 -11
  22. package/dist/execution/index.js +1 -2
  23. package/dist/features/auth/index.d.ts +3 -0
  24. package/dist/features/auth/index.js +23 -2
  25. package/dist/features/clients/index.js +20 -26
  26. package/dist/features/crm/index.d.ts +3 -0
  27. package/dist/features/crm/index.js +20 -30
  28. package/dist/features/dashboard/index.d.ts +69 -69
  29. package/dist/features/dashboard/index.js +20 -28
  30. package/dist/features/delivery/index.d.ts +3 -0
  31. package/dist/features/delivery/index.js +20 -30
  32. package/dist/features/knowledge/index.js +25 -9
  33. package/dist/features/lead-gen/index.d.ts +295 -57
  34. package/dist/features/lead-gen/index.js +20 -31
  35. package/dist/features/monitoring/index.js +20 -30
  36. package/dist/features/monitoring/requests/index.js +20 -25
  37. package/dist/features/operations/index.d.ts +183 -183
  38. package/dist/features/operations/index.js +18 -37
  39. package/dist/features/seo/index.js +3 -4
  40. package/dist/features/settings/index.d.ts +3 -0
  41. package/dist/features/settings/index.js +20 -27
  42. package/dist/graph/index.js +1 -1
  43. package/dist/hooks/delivery/index.d.ts +3 -0
  44. package/dist/hooks/delivery/index.js +30 -2
  45. package/dist/hooks/index.d.ts +112 -99
  46. package/dist/hooks/index.js +20 -21
  47. package/dist/hooks/operations/command-view/utils/transformCommandViewData.d.ts +46 -46
  48. package/dist/hooks/published.d.ts +112 -99
  49. package/dist/hooks/published.js +20 -20
  50. package/dist/index.css +532 -532
  51. package/dist/index.d.ts +9385 -5915
  52. package/dist/index.js +22 -26
  53. package/dist/initialization/index.d.ts +3 -0
  54. package/dist/knowledge/index.d.ts +42 -42
  55. package/dist/knowledge/index.js +10 -17
  56. package/dist/{knowledge-search-index-ORIJCEZX.js → knowledge-search-index-NBCTFIOH.js} +2 -2
  57. package/dist/layout/index.js +4 -10
  58. package/dist/organization/index.js +27 -1
  59. package/dist/profile/index.d.ts +3 -0
  60. package/dist/provider/index.d.ts +72 -39
  61. package/dist/provider/index.js +20 -15
  62. package/dist/provider/published.d.ts +40 -34
  63. package/dist/provider/published.js +20 -11
  64. package/dist/sse/index.js +26 -5
  65. package/dist/supabase/index.d.ts +6 -0
  66. package/dist/test-utils/index.js +3 -3
  67. package/dist/theme/index.js +2 -3
  68. package/dist/theme/presets/index.d.ts +28 -3
  69. package/dist/theme/presets/index.js +1 -1
  70. package/dist/typeform/index.js +1 -2049
  71. package/dist/types/index.d.ts +82 -79
  72. package/dist/utils/index.d.ts +47 -47
  73. package/dist/utils/index.js +1 -1
  74. package/dist/zustand/index.d.ts +6 -6
  75. package/dist/zustand/index.js +0 -3
  76. package/package.json +5 -5
  77. package/dist/chunk-3AJVNMY5.js +0 -4769
  78. package/dist/chunk-3MEXPLWT.js +0 -265
  79. package/dist/chunk-3ZMAGTWF.js +0 -18
  80. package/dist/chunk-4O4MII5S.js +0 -4716
  81. package/dist/chunk-5EYJ2GIN.js +0 -122
  82. package/dist/chunk-7M2VOCYN.js +0 -1
  83. package/dist/chunk-BPQVTIUP.js +0 -105
  84. package/dist/chunk-BZZCNLT6.js +0 -12
  85. package/dist/chunk-CLDCYJQT.js +0 -1
  86. package/dist/chunk-E565XMTQ.js +0 -17
  87. package/dist/chunk-HRWLKKWM.js +0 -758
  88. package/dist/chunk-IGDYWFNE.js +0 -5198
  89. package/dist/chunk-IIMU5YAJ.js +0 -53
  90. package/dist/chunk-IVGI4GDL.js +0 -1593
  91. package/dist/chunk-JFL3GRD4.js +0 -39
  92. package/dist/chunk-LAWLB6CT.js +0 -951
  93. package/dist/chunk-LGKLC5MG.js +0 -44
  94. package/dist/chunk-LRWTWOGP.js +0 -1778
  95. package/dist/chunk-MP3GPBPX.js +0 -1874
  96. package/dist/chunk-N55DVMAG.js +0 -14
  97. package/dist/chunk-NLBQTDOW.js +0 -12051
  98. package/dist/chunk-O6JXQ6UQ.js +0 -468
  99. package/dist/chunk-OBBQ2JCM.js +0 -68
  100. package/dist/chunk-PDHTXPSF.js +0 -12
  101. package/dist/chunk-PLP3NYPL.js +0 -356
  102. package/dist/chunk-R2XR4FCV.js +0 -48
  103. package/dist/chunk-R66W5UDG.js +0 -26
  104. package/dist/chunk-RYTEQBAO.js +0 -37
  105. package/dist/chunk-SDXSB3HN.js +0 -425
  106. package/dist/chunk-TKAYX2SP.js +0 -204
  107. package/dist/chunk-TUMSNGTX.js +0 -35
  108. package/dist/chunk-VNAZTCHA.js +0 -65
  109. package/dist/chunk-VNFR57DF.js +0 -87
  110. package/dist/chunk-VTXTZXAU.js +0 -539
  111. package/dist/chunk-W73ZABT6.js +0 -85
  112. package/dist/chunk-WU4FNWCW.js +0 -2281
  113. package/dist/chunk-XZGSCABI.js +0 -383
  114. package/dist/chunk-YNWZIWJL.js +0 -1863
  115. /package/dist/{chunk-2RJMVWFJ.js → chunk-GEFWMU26.js} +0 -0
  116. /package/dist/{chunk-22UVE3RA.js → chunk-HENXLGVD.js} +0 -0
@@ -0,0 +1,1764 @@
1
+ import { StyledMarkdown } from './chunk-3KMDHCAR.js';
2
+ import { useRouterContext } from './chunk-Q7DJKLEN.js';
3
+ import { getErrorInfo, getErrorTitle, getResourceIcon, formatTimeAgo, getTimeRangeLabel, getTimeRangeDates, formatBucketTime } from './chunk-GEFWMU26.js';
4
+ import { ResourceStatusColors } from './chunk-KRWALB24.js';
5
+ import { useElevasisServices } from './chunk-KJ3QUBNU.js';
6
+ import { useAuthContext } from './chunk-BRJ3QZ4E.js';
7
+ import { forwardRef, useRef, useState, useLayoutEffect, useEffect, useMemo, useCallback } from 'react';
8
+ import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
9
+ import { useComputedColorScheme, Group, Text, Box, Stack, Center, Title, Button, Loader, Badge, Collapse, ScrollArea, Card, Select, Alert, Code, ThemeIcon, Paper, Grid, Timeline, NumberFormatter, Space, Tooltip as Tooltip$1, SimpleGrid, SegmentedControl } from '@mantine/core';
10
+ import { ResponsiveContainer, AreaChart, CartesianGrid, XAxis, YAxis, Tooltip, ReferenceLine as ReferenceLine$1, Area, PieChart, Pie, Cell } from 'recharts';
11
+ import { IconMinus, IconTrendingUp, IconTrendingDown, IconChevronUp, IconChevronDown, IconAlertCircle, IconClock, IconInfoCircle, IconBan, IconChevronRight, IconInbox, IconHeartHandshake, IconUserOff, IconMailForward, IconBell, IconCalendarEvent, IconCalendarCancel, IconMessageReply, IconCircleCheck, IconCreditCard, IconX, IconEye, IconSend, IconFileText, IconArrowRight, IconPlus, IconActivity, IconDownload, IconChartLine, IconApps, IconPlayerPlay, IconChartBar, IconAlertTriangle, IconRocket } from '@tabler/icons-react';
12
+ import { Prism } from 'react-syntax-highlighter';
13
+ import { oneDark } from 'react-syntax-highlighter/dist/esm/styles/prism';
14
+ import { useQuery } from '@tanstack/react-query';
15
+
16
+ function ChartFrame({ h, debounceMs = 150, children }) {
17
+ const ref = useRef(null);
18
+ const [width, setWidth] = useState(0);
19
+ useLayoutEffect(() => {
20
+ const el = ref.current;
21
+ if (!el) return;
22
+ const w = el.getBoundingClientRect().width;
23
+ if (w > 0) setWidth(w);
24
+ }, []);
25
+ useEffect(() => {
26
+ const el = ref.current;
27
+ if (!el) return;
28
+ let timeout;
29
+ const ro = new ResizeObserver((entries) => {
30
+ if (timeout !== void 0) window.clearTimeout(timeout);
31
+ const nextWidth = entries[0]?.contentRect.width ?? 0;
32
+ timeout = window.setTimeout(() => {
33
+ if (nextWidth > 0) setWidth(nextWidth);
34
+ }, debounceMs);
35
+ });
36
+ ro.observe(el);
37
+ return () => {
38
+ ro.disconnect();
39
+ if (timeout !== void 0) window.clearTimeout(timeout);
40
+ };
41
+ }, [debounceMs]);
42
+ return /* @__PURE__ */ jsx("div", { ref, style: { width: "100%", height: h, position: "relative" }, children: width > 0 && /* @__PURE__ */ jsx("div", { style: { width, height: h }, children }) });
43
+ }
44
+ var THEME_DERIVED = {
45
+ grid: "var(--color-border)",
46
+ gridLine: "var(--color-border)",
47
+ tickText: "var(--mantine-color-dimmed)",
48
+ tooltipBg: "var(--glass-background)",
49
+ tooltipBorder: "var(--color-border)",
50
+ tooltipText: "var(--mantine-color-dimmed)",
51
+ dotStroke: "var(--mantine-color-body)"
52
+ };
53
+ var DARK = {
54
+ cyan: "#00e5ff",
55
+ cyanDim: "#00b8d4",
56
+ blue: "#448aff",
57
+ green: "#00ff88",
58
+ greenDim: "#00c853",
59
+ red: "#ff1744",
60
+ redDim: "#d50000",
61
+ yellow: "#ffab00",
62
+ magenta: "#ff4081",
63
+ ...THEME_DERIVED,
64
+ cardGlow: "0 0 30px rgba(0, 229, 255, 0.06)"
65
+ };
66
+ var LIGHT = {
67
+ cyan: "#0091ea",
68
+ cyanDim: "#0277bd",
69
+ blue: "#4d8af0",
70
+ green: "#00a854",
71
+ greenDim: "#00873e",
72
+ red: "#d32f2f",
73
+ redDim: "#b71c1c",
74
+ yellow: "#f9a825",
75
+ magenta: "#c51162",
76
+ ...THEME_DERIVED,
77
+ cardGlow: "0 0 20px rgba(0, 145, 234, 0.06)"
78
+ };
79
+ function useCyberColors() {
80
+ const scheme = useComputedColorScheme("dark");
81
+ return useMemo(() => scheme === "dark" ? DARK : LIGHT, [scheme]);
82
+ }
83
+ function getSeriesColor(key, colors) {
84
+ switch (key) {
85
+ case "Success Rate":
86
+ return colors.cyan;
87
+ case "Executions":
88
+ return colors.blue;
89
+ case "Success Count":
90
+ return colors.green;
91
+ case "Error Count":
92
+ return colors.red;
93
+ default:
94
+ return colors.cyan;
95
+ }
96
+ }
97
+ var ReferenceLine = ReferenceLine$1;
98
+ function CyberDefs({ colors, isLight }) {
99
+ const gradMul = isLight ? 0.5 : 1;
100
+ const gradients = [
101
+ { id: "gradCyan", color: colors.cyan, opacity: 0.35 * gradMul },
102
+ { id: "gradBlue", color: colors.blue, opacity: 0.3 * gradMul },
103
+ { id: "gradGreen", color: colors.green, opacity: 0.3 * gradMul },
104
+ { id: "gradRed", color: colors.red, opacity: 0.3 * gradMul },
105
+ { id: "gradYellow", color: colors.yellow, opacity: 0.3 * gradMul }
106
+ ];
107
+ const glowMul = isLight ? 0.25 : 1;
108
+ const filters = [
109
+ { id: "glowCyan", std: 3 * glowMul },
110
+ { id: "glowBlue", std: 3 * glowMul },
111
+ { id: "glowGreen", std: 2.5 * glowMul },
112
+ { id: "glowRed", std: 2.5 * glowMul },
113
+ { id: "glowYellow", std: 2.5 * glowMul }
114
+ ];
115
+ return /* @__PURE__ */ jsxs("defs", { children: [
116
+ gradients.map((g) => /* @__PURE__ */ jsxs("linearGradient", { id: g.id, x1: "0", y1: "0", x2: "0", y2: "1", children: [
117
+ /* @__PURE__ */ jsx("stop", { offset: "0%", stopColor: g.color, stopOpacity: g.opacity }),
118
+ /* @__PURE__ */ jsx("stop", { offset: "60%", stopColor: g.color, stopOpacity: g.opacity * 0.2 }),
119
+ /* @__PURE__ */ jsx("stop", { offset: "100%", stopColor: g.color, stopOpacity: 0 })
120
+ ] }, g.id)),
121
+ filters.map((f) => /* @__PURE__ */ jsxs("filter", { id: f.id, x: "-20%", y: "-20%", width: "140%", height: "140%", children: [
122
+ /* @__PURE__ */ jsx("feGaussianBlur", { in: "SourceGraphic", stdDeviation: f.std, result: "blur" }),
123
+ /* @__PURE__ */ jsxs("feMerge", { children: [
124
+ /* @__PURE__ */ jsx("feMergeNode", { in: "blur" }),
125
+ /* @__PURE__ */ jsx("feMergeNode", { in: "SourceGraphic" })
126
+ ] })
127
+ ] }, f.id)),
128
+ /* @__PURE__ */ jsxs("filter", { id: "dotGlow", x: "-50%", y: "-50%", width: "200%", height: "200%", children: [
129
+ /* @__PURE__ */ jsx("feGaussianBlur", { in: "SourceGraphic", stdDeviation: "4", result: "blur" }),
130
+ /* @__PURE__ */ jsxs("feMerge", { children: [
131
+ /* @__PURE__ */ jsx("feMergeNode", { in: "blur" }),
132
+ /* @__PURE__ */ jsx("feMergeNode", { in: "blur" }),
133
+ /* @__PURE__ */ jsx("feMergeNode", { in: "SourceGraphic" })
134
+ ] })
135
+ ] }),
136
+ /* @__PURE__ */ jsxs("filter", { id: "pulseGlow", x: "-30%", y: "-30%", width: "160%", height: "160%", children: [
137
+ /* @__PURE__ */ jsx("feGaussianBlur", { in: "SourceGraphic", stdDeviation: "5", result: "blur" }),
138
+ /* @__PURE__ */ jsxs("feMerge", { children: [
139
+ /* @__PURE__ */ jsx("feMergeNode", { in: "blur" }),
140
+ /* @__PURE__ */ jsx("feMergeNode", { in: "blur" }),
141
+ /* @__PURE__ */ jsx("feMergeNode", { in: "SourceGraphic" })
142
+ ] })
143
+ ] })
144
+ ] });
145
+ }
146
+ function PulseDefs({ series, colors, isLight }) {
147
+ return /* @__PURE__ */ jsx("defs", { children: series.map((s, i) => {
148
+ const color = colors[s.color ?? "cyan"];
149
+ const dur = "6s";
150
+ const delay = "0s";
151
+ const keyTimes = "0;0.3;1";
152
+ const keySplines = "0.33 0 0.67 1;0 0 1 1";
153
+ const animateProps = {
154
+ dur,
155
+ keyTimes,
156
+ keySplines,
157
+ repeatCount: "indefinite",
158
+ calcMode: "spline",
159
+ begin: delay
160
+ };
161
+ return /* @__PURE__ */ jsxs("linearGradient", { id: `pulse-${i}`, x1: "0", y1: "0", x2: "1", y2: "0", children: [
162
+ /* @__PURE__ */ jsx("stop", { offset: "0", stopColor: color, stopOpacity: 0, children: /* @__PURE__ */ jsx("animate", { attributeName: "offset", values: "-0.15;1.0;1.0", ...animateProps }) }),
163
+ /* @__PURE__ */ jsx("stop", { offset: "0", stopColor: isLight ? "white" : color, stopOpacity: isLight ? 0.6 : 0.9, children: /* @__PURE__ */ jsx("animate", { attributeName: "offset", values: "-0.075;1.075;1.075", ...animateProps }) }),
164
+ /* @__PURE__ */ jsx("stop", { offset: "0", stopColor: color, stopOpacity: 0, children: /* @__PURE__ */ jsx("animate", { attributeName: "offset", values: "0;1.15;1.15", ...animateProps }) })
165
+ ] }, i);
166
+ }) });
167
+ }
168
+ function CyberActiveDot({
169
+ cx,
170
+ cy,
171
+ color,
172
+ dotStroke
173
+ }) {
174
+ if (cx == null || cy == null) return null;
175
+ return /* @__PURE__ */ jsxs("g", { filter: "url(#dotGlow)", children: [
176
+ /* @__PURE__ */ jsxs("circle", { cx, cy, r: 6, fill: "none", stroke: color, strokeWidth: 2, opacity: 0.5, children: [
177
+ /* @__PURE__ */ jsx("animate", { attributeName: "r", from: "4", to: "10", dur: "1.2s", repeatCount: "indefinite" }),
178
+ /* @__PURE__ */ jsx("animate", { attributeName: "opacity", from: "0.6", to: "0", dur: "1.2s", repeatCount: "indefinite" })
179
+ ] }),
180
+ /* @__PURE__ */ jsx("circle", { cx, cy, r: 4, fill: color, stroke: dotStroke, strokeWidth: 2 })
181
+ ] });
182
+ }
183
+ function CyberTooltipContent({
184
+ active,
185
+ payload,
186
+ label,
187
+ colors,
188
+ labelFormatter,
189
+ valueFormatter
190
+ }) {
191
+ if (!active || !payload?.length) return null;
192
+ const filtered = payload.filter((entry) => !entry.name?.startsWith("_pulse_"));
193
+ if (!filtered.length) return null;
194
+ const displayLabel = label && labelFormatter ? labelFormatter(label) : label;
195
+ return /* @__PURE__ */ jsxs(
196
+ "div",
197
+ {
198
+ style: {
199
+ background: colors.tooltipBg,
200
+ border: `1px solid ${colors.tooltipBorder}`,
201
+ borderRadius: 8,
202
+ padding: "10px 14px",
203
+ backdropFilter: "var(--glass-blur)",
204
+ WebkitBackdropFilter: "var(--glass-blur)",
205
+ boxShadow: "var(--standard-box-shadow)",
206
+ fontFamily: "var(--mantine-font-family-monospace, monospace)",
207
+ minWidth: 160
208
+ },
209
+ children: [
210
+ /* @__PURE__ */ jsx(
211
+ "div",
212
+ {
213
+ style: {
214
+ fontSize: 11,
215
+ color: colors.tickText,
216
+ marginBottom: 8,
217
+ letterSpacing: "0.05em",
218
+ textTransform: "uppercase",
219
+ borderBottom: `1px solid ${colors.tooltipBorder}`,
220
+ paddingBottom: 6
221
+ },
222
+ children: displayLabel
223
+ }
224
+ ),
225
+ filtered.map((entry) => {
226
+ const color = entry.color || getSeriesColor(entry.dataKey, colors);
227
+ return /* @__PURE__ */ jsxs(
228
+ "div",
229
+ {
230
+ style: {
231
+ display: "flex",
232
+ justifyContent: "space-between",
233
+ alignItems: "center",
234
+ gap: 16,
235
+ padding: "3px 0",
236
+ fontSize: 12
237
+ },
238
+ children: [
239
+ /* @__PURE__ */ jsxs("div", { style: { display: "flex", alignItems: "center", gap: 8 }, children: [
240
+ /* @__PURE__ */ jsx(
241
+ "div",
242
+ {
243
+ style: {
244
+ width: 8,
245
+ height: 8,
246
+ borderRadius: "50%",
247
+ backgroundColor: color,
248
+ boxShadow: `0 0 6px ${color}`
249
+ }
250
+ }
251
+ ),
252
+ /* @__PURE__ */ jsx("span", { style: { color: colors.tooltipText }, children: entry.name ?? entry.dataKey })
253
+ ] }),
254
+ /* @__PURE__ */ jsx("span", { style: { color, fontWeight: 600, fontVariantNumeric: "tabular-nums" }, children: entry.value != null && valueFormatter ? valueFormatter(entry.value) : String(entry.value) })
255
+ ]
256
+ },
257
+ entry.dataKey
258
+ );
259
+ })
260
+ ]
261
+ }
262
+ );
263
+ }
264
+ function CyberLegendItem({ color, label }) {
265
+ return /* @__PURE__ */ jsxs(Group, { gap: 8, children: [
266
+ /* @__PURE__ */ jsx(
267
+ "div",
268
+ {
269
+ style: {
270
+ width: 10,
271
+ height: 10,
272
+ borderRadius: "50%",
273
+ backgroundColor: color,
274
+ boxShadow: `0 0 8px ${color}, 0 0 16px ${color}40`
275
+ }
276
+ }
277
+ ),
278
+ /* @__PURE__ */ jsx(Text, { size: "xs", style: { color: "var(--color-text-subtle)", letterSpacing: "0.03em" }, children: label })
279
+ ] });
280
+ }
281
+ var COLOR_MAP = {
282
+ cyan: { gradient: "url(#gradCyan)", filter: "url(#glowCyan)", key: "cyan" },
283
+ blue: { gradient: "url(#gradBlue)", filter: "url(#glowBlue)", key: "blue" },
284
+ green: { gradient: "url(#gradGreen)", filter: "url(#glowGreen)", key: "green" },
285
+ red: { gradient: "url(#gradRed)", filter: "url(#glowRed)", key: "red" },
286
+ yellow: { gradient: "url(#gradYellow)", filter: "url(#glowYellow)", key: "yellow" }
287
+ };
288
+ function CyberAreaChart({
289
+ data,
290
+ series,
291
+ xDataKey = "time",
292
+ height = 300,
293
+ yAxisLabel,
294
+ yDomain,
295
+ yTickFormatter,
296
+ showGrid = true,
297
+ showZeroBaseline = true,
298
+ baselineColor,
299
+ lineOnly = false,
300
+ margin = { top: 8, right: 20, left: 0, bottom: 0 },
301
+ xTickFormatter,
302
+ tooltipFormatter
303
+ }) {
304
+ const isLight = useComputedColorScheme("dark") === "light";
305
+ const colors = useCyberColors();
306
+ const [ready, setReady] = useState(false);
307
+ useEffect(() => {
308
+ const frame = requestAnimationFrame(() => setReady(true));
309
+ return () => cancelAnimationFrame(frame);
310
+ }, []);
311
+ const allZero = useMemo(() => {
312
+ if (!showZeroBaseline || !data.length) return false;
313
+ return data.every((row) => series.every((s) => row[s.dataKey] === 0));
314
+ }, [data, series, showZeroBaseline]);
315
+ if (!ready || !data.length) return /* @__PURE__ */ jsx(Box, { style: { height } });
316
+ const gridProps = {
317
+ stroke: colors.gridLine,
318
+ strokeDasharray: "3 6",
319
+ strokeOpacity: 1
320
+ };
321
+ const xAxisConfig = {
322
+ stroke: "none",
323
+ tick: {
324
+ fill: colors.tickText,
325
+ fontSize: 11,
326
+ fontFamily: "var(--mantine-font-family-monospace, monospace)"
327
+ },
328
+ tickLine: false,
329
+ axisLine: { stroke: colors.grid, strokeWidth: 1 }
330
+ };
331
+ const yTickStyle = {
332
+ fill: colors.tickText,
333
+ fontSize: 11,
334
+ fontFamily: "var(--mantine-font-family-monospace, monospace)"
335
+ };
336
+ return /* @__PURE__ */ jsx(Box, { style: { width: "100%", height }, children: /* @__PURE__ */ jsx(ResponsiveContainer, { width: "100%", height: "100%", children: /* @__PURE__ */ jsxs(AreaChart, { data, margin, children: [
337
+ /* @__PURE__ */ jsx(CyberDefs, { colors, isLight }),
338
+ /* @__PURE__ */ jsx(PulseDefs, { series, colors, isLight }),
339
+ showGrid && /* @__PURE__ */ jsx(CartesianGrid, { ...gridProps }),
340
+ /* @__PURE__ */ jsx(XAxis, { dataKey: xDataKey, ...xAxisConfig, tickFormatter: xTickFormatter }),
341
+ /* @__PURE__ */ jsx(
342
+ YAxis,
343
+ {
344
+ domain: yDomain ?? [0, (max) => Math.max(max, 1)],
345
+ stroke: "none",
346
+ tick: yTickStyle,
347
+ tickFormatter: yTickFormatter,
348
+ tickLine: false,
349
+ axisLine: { stroke: colors.grid, strokeWidth: 1 },
350
+ label: yAxisLabel ? {
351
+ value: yAxisLabel,
352
+ angle: -90,
353
+ position: "insideLeft",
354
+ offset: 0,
355
+ style: { fill: colors.tickText, fontSize: 11 }
356
+ } : void 0
357
+ }
358
+ ),
359
+ /* @__PURE__ */ jsx(
360
+ Tooltip,
361
+ {
362
+ content: /* @__PURE__ */ jsx(CyberTooltipContent, { colors, labelFormatter: xTickFormatter, valueFormatter: tooltipFormatter }),
363
+ cursor: { stroke: colors.cyan, strokeOpacity: 0.2 }
364
+ }
365
+ ),
366
+ allZero && (() => {
367
+ const bColor = colors[baselineColor ?? series[0]?.color ?? "cyan"];
368
+ const glow = isLight ? `drop-shadow(0 0 2px ${bColor})` : `drop-shadow(0 0 4px ${bColor}) drop-shadow(0 0 8px ${bColor})`;
369
+ return /* @__PURE__ */ jsx(ReferenceLine, { y: 0, stroke: bColor, strokeWidth: isLight ? 1.5 : 2, style: { filter: glow } });
370
+ })(),
371
+ series.map((s) => {
372
+ const cm = COLOR_MAP[s.color ?? "cyan"];
373
+ const strokeColor = colors[cm.key];
374
+ return /* @__PURE__ */ jsx(
375
+ Area,
376
+ {
377
+ type: "monotone",
378
+ dataKey: s.dataKey,
379
+ name: s.name ?? s.dataKey,
380
+ stroke: strokeColor,
381
+ strokeWidth: lineOnly ? 3 : 2,
382
+ fill: lineOnly ? "transparent" : cm.gradient,
383
+ filter: cm.filter,
384
+ dot: false,
385
+ activeDot: /* @__PURE__ */ jsx(CyberActiveDot, { color: strokeColor, dotStroke: colors.dotStroke }),
386
+ animationBegin: 100,
387
+ animationDuration: s.animationDuration ?? 1200,
388
+ animationEasing: "ease-out"
389
+ },
390
+ s.dataKey
391
+ );
392
+ }),
393
+ !isLight && series.map((s, i) => /* @__PURE__ */ jsx(
394
+ Area,
395
+ {
396
+ type: "monotone",
397
+ dataKey: s.dataKey,
398
+ name: `_pulse_${s.dataKey}`,
399
+ stroke: `url(#pulse-${i})`,
400
+ strokeWidth: 3,
401
+ fill: "none",
402
+ filter: "url(#pulseGlow)",
403
+ dot: false,
404
+ activeDot: false,
405
+ tooltipType: "none",
406
+ isAnimationActive: false,
407
+ style: { pointerEvents: "none" }
408
+ },
409
+ `pulse-${s.dataKey}`
410
+ ))
411
+ ] }) }) });
412
+ }
413
+ function CyberDonutTooltip({
414
+ active,
415
+ payload,
416
+ colors
417
+ }) {
418
+ if (!active || !payload?.length) return null;
419
+ const entry = payload[0];
420
+ if (!entry) return null;
421
+ const color = entry.payload?.color ?? colors.cyan;
422
+ return /* @__PURE__ */ jsxs(
423
+ "div",
424
+ {
425
+ style: {
426
+ background: colors.tooltipBg,
427
+ border: `1px solid ${colors.tooltipBorder}`,
428
+ borderRadius: 8,
429
+ padding: "8px 12px",
430
+ backdropFilter: "var(--glass-blur)",
431
+ WebkitBackdropFilter: "var(--glass-blur)",
432
+ boxShadow: "var(--standard-box-shadow)",
433
+ fontFamily: "var(--mantine-font-family-monospace, monospace)",
434
+ display: "flex",
435
+ alignItems: "center",
436
+ gap: 10
437
+ },
438
+ children: [
439
+ /* @__PURE__ */ jsx(
440
+ "div",
441
+ {
442
+ style: {
443
+ width: 8,
444
+ height: 8,
445
+ borderRadius: "50%",
446
+ backgroundColor: color,
447
+ boxShadow: `0 0 6px ${color}`
448
+ }
449
+ }
450
+ ),
451
+ /* @__PURE__ */ jsx("span", { style: { color: colors.tooltipText, fontSize: 12 }, children: entry.name }),
452
+ /* @__PURE__ */ jsx("span", { style: { color, fontWeight: 600, fontSize: 12, fontVariantNumeric: "tabular-nums" }, children: entry.value })
453
+ ]
454
+ }
455
+ );
456
+ }
457
+ function CyberDonut({
458
+ title,
459
+ segments,
460
+ centerValue,
461
+ centerLabel,
462
+ centerValueColor = "var(--mantine-color-text)",
463
+ glowId,
464
+ colors,
465
+ size = 120,
466
+ innerRadius = 36,
467
+ outerRadius = 52,
468
+ isLoading,
469
+ showLegend = true
470
+ }) {
471
+ const filtered = segments.filter((s) => s.value > 0);
472
+ const isEmpty = filtered.length === 0;
473
+ const pieData = isEmpty ? [{ name: "Empty", value: 1, color: "var(--color-border)" }] : filtered;
474
+ return /* @__PURE__ */ jsxs(Stack, { gap: 6, align: "center", children: [
475
+ title && /* @__PURE__ */ jsx(
476
+ Text,
477
+ {
478
+ size: "xs",
479
+ fw: 600,
480
+ style: { color: "var(--color-text)", letterSpacing: "0.03em", textTransform: "uppercase" },
481
+ children: title
482
+ }
483
+ ),
484
+ /* @__PURE__ */ jsxs(Box, { style: { width: size, height: size, position: "relative" }, children: [
485
+ /* @__PURE__ */ jsx(ResponsiveContainer, { width: "100%", height: "100%", children: /* @__PURE__ */ jsxs(PieChart, { children: [
486
+ !isEmpty && /* @__PURE__ */ jsx("defs", { children: filtered.map((_, i) => /* @__PURE__ */ jsxs("filter", { id: `${glowId}-${i}`, x: "-20%", y: "-20%", width: "140%", height: "140%", children: [
487
+ /* @__PURE__ */ jsx("feGaussianBlur", { in: "SourceGraphic", stdDeviation: "2", result: "blur" }),
488
+ /* @__PURE__ */ jsxs("feMerge", { children: [
489
+ /* @__PURE__ */ jsx("feMergeNode", { in: "blur" }),
490
+ /* @__PURE__ */ jsx("feMergeNode", { in: "SourceGraphic" })
491
+ ] })
492
+ ] }, i)) }),
493
+ /* @__PURE__ */ jsx(
494
+ Pie,
495
+ {
496
+ data: pieData,
497
+ cx: "50%",
498
+ cy: "50%",
499
+ innerRadius,
500
+ outerRadius,
501
+ paddingAngle: isEmpty ? 0 : 3,
502
+ dataKey: "value",
503
+ stroke: "none",
504
+ animationBegin: 100,
505
+ animationDuration: 1e3,
506
+ animationEasing: "ease-out",
507
+ isAnimationActive: !isEmpty,
508
+ children: pieData.map((entry, i) => /* @__PURE__ */ jsx(
509
+ Cell,
510
+ {
511
+ fill: entry.color,
512
+ style: {
513
+ filter: isEmpty ? void 0 : `url(#${glowId}-${i})`,
514
+ fillOpacity: isEmpty ? 0.3 : 0.9
515
+ }
516
+ },
517
+ entry.name
518
+ ))
519
+ }
520
+ ),
521
+ !isEmpty && /* @__PURE__ */ jsx(Tooltip, { content: /* @__PURE__ */ jsx(CyberDonutTooltip, { colors }) })
522
+ ] }) }),
523
+ /* @__PURE__ */ jsxs(
524
+ "div",
525
+ {
526
+ style: {
527
+ position: "absolute",
528
+ top: "50%",
529
+ left: "50%",
530
+ transform: "translate(-50%, -50%)",
531
+ textAlign: "center",
532
+ pointerEvents: "none"
533
+ },
534
+ children: [
535
+ /* @__PURE__ */ jsx(
536
+ "div",
537
+ {
538
+ style: {
539
+ fontSize: 18,
540
+ fontWeight: 700,
541
+ fontFamily: "var(--mantine-font-family-monospace, monospace)",
542
+ color: centerValueColor,
543
+ lineHeight: 1
544
+ },
545
+ children: isLoading ? "-" : centerValue
546
+ }
547
+ ),
548
+ /* @__PURE__ */ jsx(
549
+ "div",
550
+ {
551
+ style: {
552
+ fontSize: 8,
553
+ color: "var(--mantine-color-dimmed)",
554
+ letterSpacing: "0.05em",
555
+ textTransform: "uppercase",
556
+ marginTop: 2
557
+ },
558
+ children: centerLabel
559
+ }
560
+ )
561
+ ]
562
+ }
563
+ )
564
+ ] }),
565
+ showLegend && /* @__PURE__ */ jsx(Stack, { gap: 4, style: { width: "100%" }, children: segments.map((seg) => /* @__PURE__ */ jsxs(Group, { gap: "xs", justify: "space-between", px: "xs", children: [
566
+ /* @__PURE__ */ jsx(CyberLegendItem, { color: seg.color, label: seg.name }),
567
+ /* @__PURE__ */ jsx(
568
+ Text,
569
+ {
570
+ size: "xs",
571
+ fw: 600,
572
+ style: {
573
+ fontFamily: "var(--mantine-font-family-monospace, monospace)",
574
+ fontVariantNumeric: "tabular-nums"
575
+ },
576
+ children: isLoading ? "-" : seg.value
577
+ }
578
+ )
579
+ ] }, seg.name)) })
580
+ ] });
581
+ }
582
+ function EmptyState({ icon: Icon, title, description, action, py = "xl" }) {
583
+ return /* @__PURE__ */ jsx(Center, { py, children: /* @__PURE__ */ jsxs(Stack, { align: "center", gap: "xs", children: [
584
+ /* @__PURE__ */ jsx(Icon, { size: 48, style: { opacity: 0.5 } }),
585
+ /* @__PURE__ */ jsx(Title, { order: 4, children: title }),
586
+ description && /* @__PURE__ */ jsx(Text, { size: "sm", c: "dimmed", ta: "center", children: description }),
587
+ action && /* @__PURE__ */ jsx(Button, { variant: "light", onClick: action.onClick, leftSection: action.icon, mt: "sm", children: action.label })
588
+ ] }) });
589
+ }
590
+ function TabCountBadge({ count, isLoading }) {
591
+ return /* @__PURE__ */ jsx(Box, { miw: 20, h: 20, style: { display: "flex", alignItems: "center", justifyContent: "center" }, children: isLoading ? /* @__PURE__ */ jsx(Loader, { size: 12 }) : /* @__PURE__ */ jsx(Badge, { size: "sm", variant: "light", circle: count < 10, children: count }) });
592
+ }
593
+ function TrendIndicator({ current, previous, inverse }) {
594
+ const change = previous === 0 ? 0 : (current - previous) / previous * 100;
595
+ const isPositive = inverse ? change < 0 : change > 0;
596
+ const isFlat = Math.abs(change) < 0.1;
597
+ const color = isFlat ? "gray" : isPositive ? "green" : "red";
598
+ const Icon = isFlat ? IconMinus : change > 0 ? IconTrendingUp : IconTrendingDown;
599
+ return /* @__PURE__ */ jsxs(Group, { gap: 4, children: [
600
+ /* @__PURE__ */ jsx(Icon, { size: 12 }),
601
+ /* @__PURE__ */ jsx(Badge, { size: "sm", color, variant: "light", children: isFlat ? "No change" : `${isPositive ? "+" : ""}${Math.abs(change).toFixed(1)}%` })
602
+ ] });
603
+ }
604
+ function CollapsibleSection({
605
+ title,
606
+ count,
607
+ countLabel,
608
+ children,
609
+ emptyMessage,
610
+ defaultExpanded = true,
611
+ maxHeight = 300
612
+ }) {
613
+ const [expanded, setExpanded] = useState(defaultExpanded);
614
+ const isEmpty = count === 0;
615
+ return /* @__PURE__ */ jsxs(
616
+ "div",
617
+ {
618
+ style: {
619
+ borderRadius: "8px",
620
+ padding: "8px",
621
+ border: "1px solid var(--color-border)",
622
+ boxShadow: "var(--standard-box-shadow)"
623
+ },
624
+ children: [
625
+ /* @__PURE__ */ jsxs(
626
+ Group,
627
+ {
628
+ gap: "xs",
629
+ mb: expanded ? "xs" : 0,
630
+ justify: "space-between",
631
+ align: "center",
632
+ style: { cursor: "pointer" },
633
+ onClick: () => setExpanded(!expanded),
634
+ children: [
635
+ /* @__PURE__ */ jsxs(Group, { gap: "xs", align: "center", style: { flex: 1 }, children: [
636
+ typeof title === "string" ? /* @__PURE__ */ jsx(
637
+ Text,
638
+ {
639
+ fw: 600,
640
+ size: "sm",
641
+ c: "var(--color-text)",
642
+ style: { fontFamily: "var(--elevasis-font-family-subtitle)" },
643
+ children: title
644
+ }
645
+ ) : title,
646
+ count !== void 0 && countLabel && /* @__PURE__ */ jsxs(Badge, { size: "sm", variant: "light", color: "gray", children: [
647
+ count,
648
+ " ",
649
+ count === 1 ? countLabel.replace(/s$/, "") : countLabel
650
+ ] })
651
+ ] }),
652
+ expanded ? /* @__PURE__ */ jsx(IconChevronUp, { size: 16 }) : /* @__PURE__ */ jsx(IconChevronDown, { size: 16 })
653
+ ]
654
+ }
655
+ ),
656
+ /* @__PURE__ */ jsx(Collapse, { in: expanded, children: isEmpty && emptyMessage ? /* @__PURE__ */ jsx(Text, { size: "sm", c: "dimmed", children: emptyMessage }) : /* @__PURE__ */ jsx(ScrollArea, { h: maxHeight, type: "scroll", offsetScrollbars: true, children }) })
657
+ ]
658
+ }
659
+ );
660
+ }
661
+ var PageTitleCaption = ({ title, caption, rightSection }) => {
662
+ const renderCaption = () => {
663
+ if (!caption) return null;
664
+ return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(Text, { style: { fontFamily: "var(--elevasis-font-family-subtitle)", color: "var(--color-text-dimmed)" }, children: caption }) });
665
+ };
666
+ const titleContent = /* @__PURE__ */ jsxs("div", { style: { display: "flex", flexDirection: "column" }, children: [
667
+ /* @__PURE__ */ jsx(Title, { order: 1, children: title }),
668
+ /* @__PURE__ */ jsx(Space, { h: "4" }),
669
+ renderCaption()
670
+ ] });
671
+ if (!rightSection) {
672
+ return titleContent;
673
+ }
674
+ return /* @__PURE__ */ jsxs(Group, { justify: "space-between", align: "end", children: [
675
+ titleContent,
676
+ rightSection
677
+ ] });
678
+ };
679
+ function StatsCardSkeleton({ chartHeight = 200 }) {
680
+ return /* @__PURE__ */ jsx(Card, { withBorder: true, children: /* @__PURE__ */ jsx(Center, { mih: chartHeight, children: /* @__PURE__ */ jsx(Loader, { size: "md" }) }) });
681
+ }
682
+ function ListSkeleton({ rows = 3, rowHeight = 50 }) {
683
+ return /* @__PURE__ */ jsx(Stack, { children: /* @__PURE__ */ jsx(Center, { mih: rows * rowHeight, children: /* @__PURE__ */ jsx(Loader, { size: "md" }) }) });
684
+ }
685
+ function DetailCardSkeleton({ rows = 3 }) {
686
+ return /* @__PURE__ */ jsx(Card, { withBorder: true, children: /* @__PURE__ */ jsx(Center, { mih: rows * 60 + 100, children: /* @__PURE__ */ jsx(Loader, { size: "md" }) }) });
687
+ }
688
+ function CustomSelector({
689
+ value,
690
+ onChange,
691
+ data,
692
+ leftSection,
693
+ placeholder,
694
+ w,
695
+ withCheckIcon = false,
696
+ disabled
697
+ }) {
698
+ return /* @__PURE__ */ jsx(
699
+ Select,
700
+ {
701
+ value,
702
+ onChange,
703
+ data,
704
+ leftSection,
705
+ placeholder,
706
+ w,
707
+ size: "xs",
708
+ variant: "unstyled",
709
+ withCheckIcon,
710
+ disabled,
711
+ styles: {
712
+ wrapper: {
713
+ border: "1px solid var(--color-border)",
714
+ borderRadius: "var(--mantine-radius-default)",
715
+ backgroundColor: "var(--color-surface)",
716
+ transition: "border-color 150ms ease, background-color 150ms ease",
717
+ "&:hover": {
718
+ borderColor: "var(--color-border-hover, var(--mantine-color-dark-3))"
719
+ }
720
+ },
721
+ input: {
722
+ fontSize: "var(--mantine-font-size-xs)",
723
+ fontWeight: 500,
724
+ height: "30px",
725
+ minHeight: "30px",
726
+ paddingLeft: leftSection ? "30px" : void 0,
727
+ borderRadius: "var(--mantine-radius-default)",
728
+ cursor: "pointer"
729
+ },
730
+ section: {
731
+ color: "var(--color-text-subtle)"
732
+ },
733
+ dropdown: {
734
+ border: "1px solid var(--color-border)",
735
+ backgroundColor: "var(--color-surface)",
736
+ boxShadow: "var(--card-shadow)"
737
+ },
738
+ option: {
739
+ fontSize: "var(--mantine-font-size-xs)"
740
+ }
741
+ }
742
+ }
743
+ );
744
+ }
745
+ function APIErrorAlert({
746
+ error,
747
+ title,
748
+ showRequestId = true,
749
+ icon = /* @__PURE__ */ jsx(IconAlertCircle, {}),
750
+ color = "red"
751
+ }) {
752
+ const { message, code, requestId, retryAfter } = getErrorInfo(error);
753
+ const alertTitle = title || getErrorTitle(code);
754
+ return /* @__PURE__ */ jsxs(Alert, { icon, title: alertTitle, color, variant: "light", children: [
755
+ /* @__PURE__ */ jsx(Text, { size: "sm", children: message }),
756
+ retryAfter && /* @__PURE__ */ jsxs(Text, { size: "sm", mt: "xs", children: [
757
+ "Please wait ",
758
+ retryAfter,
759
+ " seconds before retrying."
760
+ ] }),
761
+ showRequestId && requestId && /* @__PURE__ */ jsxs(Text, { size: "xs", c: "dimmed", mt: "xs", children: [
762
+ "Request ID: ",
763
+ /* @__PURE__ */ jsx(Code, { children: requestId })
764
+ ] })
765
+ ] });
766
+ }
767
+ function CenteredErrorState({ error, title, h = 300, py }) {
768
+ return /* @__PURE__ */ jsx(Center, { h, py, children: /* @__PURE__ */ jsx(APIErrorAlert, { error, title }) });
769
+ }
770
+
771
+ // src/components/display/StatCard.module.css.js
772
+ var StatCard_module_css_default = { "heroCard": "heroCard", "iconRing": "iconRing", "iconRingSm": "iconRingSm", "heroValue": "heroValue", "heroValueSm": "heroValueSm", "heroLabel": "heroLabel", "heroLabelSm": "heroLabelSm" };
773
+ function StatCard(props) {
774
+ if (props.variant === "hero") {
775
+ return /* @__PURE__ */ jsx(HeroStatCard, { ...props });
776
+ }
777
+ const { label, value, icon: IconComponent, color } = props;
778
+ return /* @__PURE__ */ jsx(Card, { withBorder: true, children: /* @__PURE__ */ jsxs(Group, { gap: "xs", children: [
779
+ /* @__PURE__ */ jsx(ThemeIcon, { size: "lg", variant: "light", color, children: /* @__PURE__ */ jsx(IconComponent, { size: 18 }) }),
780
+ /* @__PURE__ */ jsxs("div", { children: [
781
+ /* @__PURE__ */ jsx(Text, { size: "xs", c: "dimmed", children: label }),
782
+ /* @__PURE__ */ jsx(Text, { size: "lg", fw: 600, style: { fontFamily: "var(--elevasis-font-family-subtitle)" }, children: value })
783
+ ] })
784
+ ] }) });
785
+ }
786
+ function HeroStatCard({
787
+ icon: IconComponent,
788
+ value,
789
+ label,
790
+ valueColor,
791
+ isLoading,
792
+ size = "sm",
793
+ children
794
+ }) {
795
+ const sm = size === "sm";
796
+ const iconSize = sm ? 36 : 46;
797
+ if (isLoading) {
798
+ return /* @__PURE__ */ jsx(Paper, { p: sm ? "md" : "lg", className: StatCard_module_css_default.heroCard, children: /* @__PURE__ */ jsx(Center, { mih: iconSize + 16, children: /* @__PURE__ */ jsx(Loader, { size: "sm" }) }) });
799
+ }
800
+ return /* @__PURE__ */ jsx(Paper, { p: sm ? "md" : "lg", className: StatCard_module_css_default.heroCard, children: /* @__PURE__ */ jsxs(Group, { gap: sm ? "sm" : "md", wrap: "nowrap", children: [
801
+ /* @__PURE__ */ jsx("div", { className: sm ? StatCard_module_css_default.iconRingSm : StatCard_module_css_default.iconRing, children: /* @__PURE__ */ jsx(IconComponent, { size: sm ? 18 : 22 }) }),
802
+ /* @__PURE__ */ jsxs(Stack, { gap: 2, style: { flex: children ? 1 : void 0 }, children: [
803
+ /* @__PURE__ */ jsx(
804
+ "span",
805
+ {
806
+ className: sm ? StatCard_module_css_default.heroValueSm : StatCard_module_css_default.heroValue,
807
+ style: valueColor ? { color: valueColor } : void 0,
808
+ children: value
809
+ }
810
+ ),
811
+ children ? /* @__PURE__ */ jsxs(Group, { gap: "sm", wrap: "nowrap", style: { flex: 1 }, children: [
812
+ /* @__PURE__ */ jsx("span", { className: sm ? StatCard_module_css_default.heroLabelSm : StatCard_module_css_default.heroLabel, children: label }),
813
+ /* @__PURE__ */ jsx("div", { style: { flex: 1 }, children })
814
+ ] }) : /* @__PURE__ */ jsx("span", { className: sm ? StatCard_module_css_default.heroLabelSm : StatCard_module_css_default.heroLabel, children: label })
815
+ ] })
816
+ ] }) });
817
+ }
818
+ function StatCardSkeleton() {
819
+ return /* @__PURE__ */ jsx(Card, { withBorder: true, children: /* @__PURE__ */ jsx(Center, { mih: 60, children: /* @__PURE__ */ jsx(Loader, { size: "sm" }) }) });
820
+ }
821
+ var jsonTheme = Object.fromEntries(
822
+ Object.entries(oneDark).map(([key, value]) => [
823
+ key,
824
+ typeof value === "object" && value !== null ? { ...value, background: "none", backgroundColor: "none" } : value
825
+ ])
826
+ );
827
+ function JsonViewer({ data, maxHeight, fontSize = "0.8rem" }) {
828
+ const jsonString = typeof data === "string" ? data : JSON.stringify(data, null, 2);
829
+ return /* @__PURE__ */ jsx(
830
+ Prism,
831
+ {
832
+ language: "json",
833
+ style: jsonTheme,
834
+ customStyle: {
835
+ margin: 0,
836
+ fontSize,
837
+ maxHeight,
838
+ overflow: maxHeight ? "auto" : void 0,
839
+ overflowX: "auto"
840
+ },
841
+ children: jsonString
842
+ }
843
+ );
844
+ }
845
+ var subtleMarkdownComponents = {
846
+ p: ({ children }) => /* @__PURE__ */ jsx(Text, { size: "sm", m: 0, c: "var(--color-text-subtle)", style: { whiteSpace: "pre-wrap" }, children })
847
+ };
848
+ var subtleMarkdownWrapperStyle = {
849
+ display: "flex",
850
+ flexDirection: "column",
851
+ gap: 8
852
+ };
853
+ function ContextViewer({ data }) {
854
+ return /* @__PURE__ */ jsx(ContextNode, { data, depth: 0 });
855
+ }
856
+ function ContextNode({ data, depth }) {
857
+ if (data === null || data === void 0) {
858
+ return /* @__PURE__ */ jsx(Text, { size: "sm", c: "dimmed", fs: "italic", children: "No context provided" });
859
+ }
860
+ if (typeof data === "string") {
861
+ return /* @__PURE__ */ jsx(StyledMarkdown, { components: subtleMarkdownComponents, style: subtleMarkdownWrapperStyle, children: data });
862
+ }
863
+ if (typeof data === "number" || typeof data === "boolean") {
864
+ return /* @__PURE__ */ jsx(Text, { size: "sm", children: String(data) });
865
+ }
866
+ if (Array.isArray(data)) {
867
+ return /* @__PURE__ */ jsx(ArrayView, { items: data, depth });
868
+ }
869
+ if (typeof data === "object") {
870
+ return /* @__PURE__ */ jsx(ObjectView, { data, depth });
871
+ }
872
+ return /* @__PURE__ */ jsx(Text, { size: "sm", children: String(data) });
873
+ }
874
+ var ACRONYMS = ["AI", "URL", "UUID", "ID", "API", "HTTP", "JSON"];
875
+ function formatLabel(key) {
876
+ const titleCased = key.replace(/([a-z])([A-Z])/g, "$1 $2").replace(/[_-]/g, " ").replace(/\b\w/g, (c) => c.toUpperCase());
877
+ return titleCased.replace(
878
+ new RegExp(`\\b(${ACRONYMS.map((a) => a[0] + a.slice(1).toLowerCase()).join("|")})\\b`, "g"),
879
+ (match) => match.toUpperCase()
880
+ );
881
+ }
882
+ function hasMarkdown(value) {
883
+ return /(\*\*.+\*\*|^#{1,6}\s|^\s*[-*]\s|\[.+\]\(.+\)|^\|.+\|$|^>\s|```)/.test(value);
884
+ }
885
+ function NestedSection({ title, children }) {
886
+ const [expanded, setExpanded] = useState(true);
887
+ return /* @__PURE__ */ jsxs(Stack, { gap: 6, children: [
888
+ /* @__PURE__ */ jsxs(Group, { gap: 4, style: { cursor: "pointer", userSelect: "none" }, onClick: () => setExpanded((v) => !v), children: [
889
+ expanded ? /* @__PURE__ */ jsx(IconChevronDown, { size: 14, color: "var(--color-primary)", style: { flexShrink: 0 } }) : /* @__PURE__ */ jsx(IconChevronRight, { size: 14, color: "var(--color-primary)", style: { flexShrink: 0 } }),
890
+ /* @__PURE__ */ jsx(Text, { size: "sm", fw: 600, style: { fontFamily: "var(--mantine-font-family-headings)" }, children: title })
891
+ ] }),
892
+ expanded && /* @__PURE__ */ jsx(Box, { pl: "sm", style: { borderLeft: "2px solid var(--color-border)" }, children })
893
+ ] });
894
+ }
895
+ function PrimitiveValue({ value }) {
896
+ if (value === null || value === void 0) {
897
+ return /* @__PURE__ */ jsx(Text, { size: "sm", c: "dimmed", fs: "italic", children: "\u2014" });
898
+ }
899
+ if (typeof value === "boolean") {
900
+ return /* @__PURE__ */ jsx(Text, { size: "sm", m: 0, children: value ? "Yes" : "No" });
901
+ }
902
+ if (typeof value === "number") {
903
+ return /* @__PURE__ */ jsx(Text, { size: "sm", m: 0, children: value.toLocaleString() });
904
+ }
905
+ const str = String(value);
906
+ if (hasMarkdown(str)) {
907
+ return /* @__PURE__ */ jsx(StyledMarkdown, { components: subtleMarkdownComponents, children: str });
908
+ }
909
+ return /* @__PURE__ */ jsx(Text, { size: "sm", m: 0, c: "var(--color-text-subtle)", style: { whiteSpace: "pre-wrap" }, children: str });
910
+ }
911
+ function ArrayView({ items, depth }) {
912
+ if (items.length === 0) {
913
+ return /* @__PURE__ */ jsx(Text, { size: "sm", c: "dimmed", fs: "italic", children: "Empty list" });
914
+ }
915
+ const allPrimitive = items.every((item) => typeof item !== "object" || item === null);
916
+ if (allPrimitive) {
917
+ return /* @__PURE__ */ jsx(Stack, { gap: 2, children: items.map((item, i) => /* @__PURE__ */ jsxs(Group, { gap: "xs", align: "flex-start", children: [
918
+ /* @__PURE__ */ jsx(Text, { size: "sm", c: "dimmed", style: { userSelect: "none" }, children: "\u2022" }),
919
+ /* @__PURE__ */ jsx(PrimitiveValue, { value: item })
920
+ ] }, i)) });
921
+ }
922
+ return /* @__PURE__ */ jsx(Stack, { gap: "sm", children: items.map((item, i) => /* @__PURE__ */ jsx(Paper, { p: "sm", style: { border: "1px solid var(--color-border)" }, children: /* @__PURE__ */ jsx(ContextNode, { data: item, depth: depth + 1 }) }, i)) });
923
+ }
924
+ function ObjectView({ data, depth }) {
925
+ const entries = Object.entries(data);
926
+ if (entries.length === 0) {
927
+ return /* @__PURE__ */ jsx(Text, { size: "sm", c: "dimmed", fs: "italic", children: "Empty" });
928
+ }
929
+ const simpleEntries = [];
930
+ const complexEntries = [];
931
+ for (const [key, value] of entries) {
932
+ if (value === null || value === void 0 || typeof value === "boolean" || typeof value === "number") {
933
+ simpleEntries.push([key, value]);
934
+ } else if (typeof value === "string") {
935
+ if (hasMarkdown(value) || value.length > 120) {
936
+ complexEntries.push([key, value]);
937
+ } else {
938
+ simpleEntries.push([key, value]);
939
+ }
940
+ } else {
941
+ complexEntries.push([key, value]);
942
+ }
943
+ }
944
+ return /* @__PURE__ */ jsxs(Stack, { gap: 10, children: [
945
+ simpleEntries.length > 0 && /* @__PURE__ */ jsx(Stack, { gap: 6, children: simpleEntries.map(([key, value]) => /* @__PURE__ */ jsxs(Group, { gap: "sm", align: "flex-start", wrap: "nowrap", children: [
946
+ /* @__PURE__ */ jsx(
947
+ Text,
948
+ {
949
+ size: "sm",
950
+ style: { minWidth: 140, flexShrink: 0, fontFamily: "var(--mantine-font-family-headings)" },
951
+ children: formatLabel(key)
952
+ }
953
+ ),
954
+ /* @__PURE__ */ jsx(PrimitiveValue, { value })
955
+ ] }, key)) }),
956
+ complexEntries.map(([key, value]) => /* @__PURE__ */ jsx(NestedSection, { title: formatLabel(key), children: /* @__PURE__ */ jsx(ContextNode, { data: value, depth: depth + 1 }) }, key))
957
+ ] });
958
+ }
959
+ var TIME_RANGE_OPTIONS = [
960
+ { value: "1h", label: "Last 1 hour" },
961
+ { value: "24h", label: "Last 24 hours" },
962
+ { value: "7d", label: "Last 7 days" },
963
+ { value: "30d", label: "Last 30 days" }
964
+ ];
965
+ function TimeRangeSelector({ value, onChange, width = 180 }) {
966
+ return /* @__PURE__ */ jsx(
967
+ CustomSelector,
968
+ {
969
+ value,
970
+ onChange: (newValue) => newValue && onChange(newValue),
971
+ data: TIME_RANGE_OPTIONS,
972
+ leftSection: /* @__PURE__ */ jsx(IconClock, { size: 16, color: "var(--color-text-subtle)" }),
973
+ w: width,
974
+ withCheckIcon: true
975
+ }
976
+ );
977
+ }
978
+ function PageNotFound() {
979
+ const { currentPath, navigate } = useRouterContext();
980
+ const { user, isLoading } = useAuthContext();
981
+ const isAuthPage = currentPath === "/login" || currentPath === "/auth-redirect";
982
+ const shouldShowSidebar = user && !isLoading && !isAuthPage;
983
+ const height = shouldShowSidebar ? "100%" : "100vh";
984
+ return /* @__PURE__ */ jsx(Center, { h: height, bg: "var(--color-background)", children: /* @__PURE__ */ jsxs(Stack, { align: "center", justify: "center", children: [
985
+ /* @__PURE__ */ jsx(IconInfoCircle, { size: 60, color: "var(--color-text-subtle)" }),
986
+ /* @__PURE__ */ jsx(Title, { order: 1, children: "Page Not Found" }),
987
+ /* @__PURE__ */ jsx(Text, { c: "dimmed", size: "lg", children: "The page you are looking for does not exist." }),
988
+ /* @__PURE__ */ jsx(Group, { justify: "center", children: /* @__PURE__ */ jsx(Button, { size: "md", onClick: () => navigate("/"), children: "Go Home" }) })
989
+ ] }) });
990
+ }
991
+ function FeatureUnavailableState({ path }) {
992
+ const { navigate } = useRouterContext();
993
+ return /* @__PURE__ */ jsx(
994
+ Center,
995
+ {
996
+ style: {
997
+ flex: 1,
998
+ minHeight: "100%",
999
+ width: "100%",
1000
+ padding: 24,
1001
+ background: "linear-gradient(180deg, color-mix(in srgb, var(--color-surface) 72%, transparent), transparent)"
1002
+ },
1003
+ children: /* @__PURE__ */ jsxs(
1004
+ Stack,
1005
+ {
1006
+ align: "center",
1007
+ gap: "md",
1008
+ style: {
1009
+ maxWidth: 560,
1010
+ padding: "32px 28px",
1011
+ borderRadius: 24,
1012
+ border: "1px solid var(--color-border)",
1013
+ background: "color-mix(in srgb, var(--glass-background) 86%, transparent)",
1014
+ boxShadow: "var(--card-shadow)",
1015
+ backdropFilter: "var(--glass-blur)",
1016
+ textAlign: "center"
1017
+ },
1018
+ children: [
1019
+ /* @__PURE__ */ jsx(IconBan, { size: 44, stroke: 1.8, color: "var(--color-text-subtle)" }),
1020
+ /* @__PURE__ */ jsxs(Stack, { gap: 6, align: "center", children: [
1021
+ /* @__PURE__ */ jsx(Title, { order: 2, children: "This section is unavailable" }),
1022
+ /* @__PURE__ */ jsx(Text, { c: "dimmed", size: "sm", maw: 420, children: path ? `The requested route ${path} is currently disabled in this workspace.` : "The requested subsection is currently disabled in this workspace." })
1023
+ ] }),
1024
+ /* @__PURE__ */ jsx(Group, { gap: "sm", justify: "center", children: /* @__PURE__ */ jsx(Button, { onClick: () => navigate("/"), children: "Go home" }) })
1025
+ ]
1026
+ }
1027
+ )
1028
+ }
1029
+ );
1030
+ }
1031
+ function ResourceCard({
1032
+ resource,
1033
+ onClick,
1034
+ layout = "stack",
1035
+ rightSection,
1036
+ topSection,
1037
+ lastRunLabel,
1038
+ style,
1039
+ ...rest
1040
+ }) {
1041
+ const Icon = getResourceIcon(resource.type);
1042
+ if (!Icon) {
1043
+ return /* @__PURE__ */ jsx(Card, { shadow: "sm", withBorder: true, children: /* @__PURE__ */ jsxs(Text, { children: [
1044
+ "Invalid resource type: ",
1045
+ resource.type
1046
+ ] }) });
1047
+ }
1048
+ const cardStyle = {
1049
+ cursor: "pointer",
1050
+ ...layout === "grid" || layout === "card" ? { transition: "box-shadow var(--duration-fast) var(--easing)" } : {},
1051
+ ...style
1052
+ };
1053
+ const iconSize = layout === "grid" ? 28 : 20;
1054
+ const details = /* @__PURE__ */ jsxs(Group, { gap: "sm", wrap: "nowrap", children: [
1055
+ /* @__PURE__ */ jsx(Icon, { size: iconSize, color: "var(--color-primary)" }),
1056
+ /* @__PURE__ */ jsxs(Stack, { gap: 4, style: { flex: 1, minWidth: 0 }, children: [
1057
+ /* @__PURE__ */ jsxs(Group, { gap: "xs", align: "center", children: [
1058
+ /* @__PURE__ */ jsx(
1059
+ Text,
1060
+ {
1061
+ fw: 600,
1062
+ size: "sm",
1063
+ style: { fontFamily: "var(--elevasis-font-family-subtitle)" },
1064
+ ...layout === "stack" ? { lineClamp: 1 } : { truncate: true },
1065
+ children: resource.name
1066
+ }
1067
+ ),
1068
+ /* @__PURE__ */ jsx(Badge, { variant: "light", size: layout === "grid" ? "xs" : "sm", children: resource.type })
1069
+ ] }),
1070
+ resource.description && /* @__PURE__ */ jsx(Text, { size: "sm", c: "dimmed", ...layout === "stack" ? { lineClamp: 1 } : { truncate: true }, children: resource.description }),
1071
+ /* @__PURE__ */ jsxs(Group, { gap: "xs", children: [
1072
+ resource.version && /* @__PURE__ */ jsxs(Badge, { variant: "outline", size: "xs", children: [
1073
+ "v",
1074
+ resource.version
1075
+ ] }),
1076
+ /* @__PURE__ */ jsx(Badge, { color: ResourceStatusColors[resource.status], variant: "outline", size: layout === "grid" ? "xs" : "sm", children: resource.status.toUpperCase() })
1077
+ ] }),
1078
+ lastRunLabel && /* @__PURE__ */ jsx(Text, { size: "sm", c: "dimmed", children: lastRunLabel }),
1079
+ /* @__PURE__ */ jsx(Text, { size: layout === "grid" ? "sm" : "xs", c: "dimmed", ff: "monospace", children: resource.resourceId })
1080
+ ] })
1081
+ ] });
1082
+ if (layout === "card") {
1083
+ return /* @__PURE__ */ jsx(
1084
+ Card,
1085
+ {
1086
+ withBorder: true,
1087
+ padding: 0,
1088
+ style: cardStyle,
1089
+ onClick: () => onClick(resource),
1090
+ "data-resource-id": rest["data-resource-id"],
1091
+ children: /* @__PURE__ */ jsxs(Stack, { gap: 8, p: "sm", pb: "xs", children: [
1092
+ /* @__PURE__ */ jsxs(Group, { gap: "xs", wrap: "nowrap", justify: "space-between", children: [
1093
+ /* @__PURE__ */ jsxs(Group, { gap: "xs", wrap: "nowrap", style: { minWidth: 0 }, children: [
1094
+ /* @__PURE__ */ jsx(Icon, { size: 20, color: "var(--color-primary)", style: { flexShrink: 0 } }),
1095
+ /* @__PURE__ */ jsx(Text, { fw: 600, size: "md", style: { fontFamily: "var(--elevasis-font-family-subtitle)" }, truncate: true, children: resource.name })
1096
+ ] }),
1097
+ /* @__PURE__ */ jsxs(Group, { gap: 6, wrap: "nowrap", style: { flexShrink: 0 }, children: [
1098
+ resource.version && /* @__PURE__ */ jsxs(Badge, { variant: "light", size: "sm", children: [
1099
+ "v",
1100
+ resource.version
1101
+ ] }),
1102
+ /* @__PURE__ */ jsx(Badge, { color: ResourceStatusColors[resource.status], variant: "light", size: "sm", children: resource.status.toUpperCase() })
1103
+ ] })
1104
+ ] }),
1105
+ resource.description && /* @__PURE__ */ jsx(Text, { size: "sm", c: "dimmed", truncate: true, children: resource.description }),
1106
+ /* @__PURE__ */ jsxs(Group, { gap: "xs", justify: "space-between", wrap: "nowrap", children: [
1107
+ rightSection || /* @__PURE__ */ jsx("span", {}),
1108
+ lastRunLabel && /* @__PURE__ */ jsx(Text, { size: "sm", c: "dimmed", style: { whiteSpace: "nowrap" }, children: lastRunLabel })
1109
+ ] }),
1110
+ topSection
1111
+ ] })
1112
+ }
1113
+ );
1114
+ }
1115
+ if (layout === "row") {
1116
+ const [hovered, setHovered] = useState(false);
1117
+ return /* @__PURE__ */ jsx(
1118
+ Card,
1119
+ {
1120
+ padding: 0,
1121
+ style: {
1122
+ cursor: "pointer",
1123
+ border: "1px solid var(--color-border)",
1124
+ transition: "background 150ms ease",
1125
+ background: hovered ? "var(--active-background)" : "var(--color-surface)",
1126
+ ...style
1127
+ },
1128
+ onClick: () => onClick(resource),
1129
+ onMouseEnter: () => setHovered(true),
1130
+ onMouseLeave: () => setHovered(false),
1131
+ "data-resource-id": rest["data-resource-id"],
1132
+ children: /* @__PURE__ */ jsxs(
1133
+ "div",
1134
+ {
1135
+ style: {
1136
+ display: "grid",
1137
+ gridTemplateColumns: "18px 200px 120px 1fr 180px 200px 14px",
1138
+ alignItems: "center",
1139
+ gap: "var(--mantine-spacing-sm)"
1140
+ },
1141
+ children: [
1142
+ /* @__PURE__ */ jsx(Icon, { size: 18, color: "var(--color-primary)" }),
1143
+ /* @__PURE__ */ jsx(Text, { fw: 600, size: "md", truncate: true, style: { fontFamily: "var(--elevasis-font-family-subtitle)" }, children: resource.name }),
1144
+ /* @__PURE__ */ jsxs(Group, { gap: 6, wrap: "nowrap", children: [
1145
+ resource.version && /* @__PURE__ */ jsxs(Badge, { variant: "light", size: "sm", children: [
1146
+ "v",
1147
+ resource.version
1148
+ ] }),
1149
+ /* @__PURE__ */ jsx(Badge, { color: ResourceStatusColors[resource.status], variant: "light", size: "sm", children: resource.status.toUpperCase() })
1150
+ ] }),
1151
+ /* @__PURE__ */ jsx(Text, { size: "sm", c: "dimmed", truncate: true, style: { minWidth: 0 }, children: resource.description || "" }),
1152
+ /* @__PURE__ */ jsx("div", { style: { whiteSpace: "nowrap" }, children: rightSection }),
1153
+ /* @__PURE__ */ jsx(Text, { size: "sm", c: "dimmed", style: { whiteSpace: "nowrap", textAlign: "right" }, children: lastRunLabel || "" }),
1154
+ /* @__PURE__ */ jsx(
1155
+ IconChevronRight,
1156
+ {
1157
+ size: 14,
1158
+ style: {
1159
+ opacity: hovered ? 0.7 : 0,
1160
+ transition: "opacity 150ms ease"
1161
+ }
1162
+ }
1163
+ )
1164
+ ]
1165
+ }
1166
+ )
1167
+ }
1168
+ );
1169
+ }
1170
+ if (layout === "grid") {
1171
+ return /* @__PURE__ */ jsx(
1172
+ Card,
1173
+ {
1174
+ withBorder: true,
1175
+ padding: "sm",
1176
+ style: cardStyle,
1177
+ onClick: () => onClick(resource),
1178
+ "data-resource-id": rest["data-resource-id"],
1179
+ children: /* @__PURE__ */ jsxs(Grid, { gutter: "sm", align: "center", children: [
1180
+ /* @__PURE__ */ jsx(Grid.Col, { span: 8, children: details }),
1181
+ rightSection && /* @__PURE__ */ jsx(Grid.Col, { span: 4, children: /* @__PURE__ */ jsx(Group, { justify: "flex-end", gap: "md", wrap: "nowrap", children: rightSection }) })
1182
+ ] })
1183
+ }
1184
+ );
1185
+ }
1186
+ return /* @__PURE__ */ jsx(
1187
+ Card,
1188
+ {
1189
+ shadow: "sm",
1190
+ withBorder: true,
1191
+ style: cardStyle,
1192
+ onClick: () => onClick(resource),
1193
+ "data-resource-id": rest["data-resource-id"],
1194
+ children: /* @__PURE__ */ jsx(Stack, { children: details })
1195
+ }
1196
+ );
1197
+ }
1198
+ function CardHeader({
1199
+ icon,
1200
+ title,
1201
+ subtitle,
1202
+ rightSection,
1203
+ titleOrder = 3,
1204
+ iconColor,
1205
+ mb = "md"
1206
+ }) {
1207
+ const wrappedIcon = icon ? /* @__PURE__ */ jsx(ThemeIcon, { size: "md", variant: "light", color: iconColor, children: icon }) : null;
1208
+ return /* @__PURE__ */ jsxs(Group, { justify: "space-between", mb, gap: "md", align: "flex-start", wrap: "nowrap", children: [
1209
+ subtitle ? /* @__PURE__ */ jsxs(Box, { style: { minWidth: 0 }, children: [
1210
+ /* @__PURE__ */ jsxs(Group, { gap: "xs", children: [
1211
+ wrappedIcon,
1212
+ /* @__PURE__ */ jsx(Title, { order: titleOrder, style: { overflowWrap: "anywhere" }, children: title })
1213
+ ] }),
1214
+ /* @__PURE__ */ jsx(Text, { size: "sm", mt: 2, style: { color: "var(--color-text-dimmed)", overflowWrap: "anywhere" }, children: subtitle })
1215
+ ] }) : /* @__PURE__ */ jsxs(Group, { gap: "xs", children: [
1216
+ wrappedIcon,
1217
+ /* @__PURE__ */ jsx(Title, { order: titleOrder, style: { overflowWrap: "anywhere" }, children: title })
1218
+ ] }),
1219
+ rightSection
1220
+ ] });
1221
+ }
1222
+
1223
+ // src/components/display/ElevasisLoader.module.css.js
1224
+ var ElevasisLoader_module_css_default = { "wrapper": "wrapper", "loader": "loader", "chevron": "chevron", "c1": "c1", "c2": "c2", "c3": "c3" };
1225
+ var ElevasisLoader = forwardRef(({ style, className, ...others }, ref) => /* @__PURE__ */ jsx("div", { ref, style, className: `${ElevasisLoader_module_css_default.wrapper} ${className ?? ""}`, ...others, children: /* @__PURE__ */ jsxs("svg", { className: ElevasisLoader_module_css_default.loader, viewBox: "-10 -5 60 50", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [
1226
+ /* @__PURE__ */ jsx("polyline", { className: `${ElevasisLoader_module_css_default.chevron} ${ElevasisLoader_module_css_default.c1}`, points: "5,36 20,25 35,36" }),
1227
+ /* @__PURE__ */ jsx("polyline", { className: `${ElevasisLoader_module_css_default.chevron} ${ElevasisLoader_module_css_default.c2}`, points: "9,23 20,14 31,23" }),
1228
+ /* @__PURE__ */ jsx("polyline", { className: `${ElevasisLoader_module_css_default.chevron} ${ElevasisLoader_module_css_default.c3}`, points: "13,11 20,5 27,11" })
1229
+ ] }) }));
1230
+ ElevasisLoader.displayName = "ElevasisLoader";
1231
+ var SIZE_MAP = {
1232
+ sm: { dot: 7, inner: 6, outer: 12 },
1233
+ md: { dot: 10, inner: 8, outer: 16 },
1234
+ lg: { dot: 12, inner: 10, outer: 20 }
1235
+ };
1236
+ function GlowDot({ color, size = "md" }) {
1237
+ const { dot, inner, outer } = SIZE_MAP[size];
1238
+ return /* @__PURE__ */ jsx(
1239
+ "div",
1240
+ {
1241
+ style: {
1242
+ width: dot,
1243
+ height: dot,
1244
+ borderRadius: "50%",
1245
+ backgroundColor: color,
1246
+ boxShadow: `0 0 ${inner}px ${color}, 0 0 ${outer}px ${color}40`,
1247
+ flexShrink: 0
1248
+ }
1249
+ }
1250
+ );
1251
+ }
1252
+ var STATUS_COLORS = {
1253
+ // Project
1254
+ active: "blue",
1255
+ on_track: "green",
1256
+ at_risk: "yellow",
1257
+ blocked: "red",
1258
+ completed: "teal",
1259
+ paused: "gray",
1260
+ // Milestone
1261
+ upcoming: "gray",
1262
+ in_progress: "blue",
1263
+ overdue: "red",
1264
+ // Task
1265
+ pending: "gray",
1266
+ planned: "gray",
1267
+ submitted: "yellow",
1268
+ approved: "green",
1269
+ rejected: "red",
1270
+ revision_requested: "orange",
1271
+ cancelled: "gray",
1272
+ // Note
1273
+ call_note: "blue",
1274
+ status_update: "green",
1275
+ issue: "yellow",
1276
+ blocker: "red",
1277
+ agent_learning: "grape"
1278
+ };
1279
+ function StatusBadge({ status, ...props }) {
1280
+ const label = status.split("_").map((w) => w.charAt(0).toUpperCase() + w.slice(1)).join(" ");
1281
+ return /* @__PURE__ */ jsx(Badge, { variant: "light", color: STATUS_COLORS[status] || "gray", size: "sm", ...props, children: label });
1282
+ }
1283
+ var ICON_MAP = {
1284
+ deal_created: IconPlus,
1285
+ stage_change: IconArrowRight,
1286
+ discovery_submitted: IconFileText,
1287
+ proposal_generated: IconFileText,
1288
+ proposal_sent: IconSend,
1289
+ proposal_reviewed: IconEye,
1290
+ closed_lost: IconX,
1291
+ fees_updated: IconCreditCard,
1292
+ closed_won: IconCircleCheck,
1293
+ reply_received: IconMessageReply,
1294
+ booking_cancelled: IconCalendarCancel,
1295
+ booking_rescheduled: IconCalendarEvent,
1296
+ reminder_sent: IconBell,
1297
+ reply_sent_to_lead: IconMailForward,
1298
+ followup_email_sent: IconMailForward,
1299
+ no_show: IconUserOff,
1300
+ moved_to_nurturing: IconHeartHandshake
1301
+ };
1302
+ function ActivityTimeline({ activities }) {
1303
+ if (!activities.length) {
1304
+ return /* @__PURE__ */ jsx(EmptyState, { icon: IconInbox, title: "No activity events yet" });
1305
+ }
1306
+ const sorted = [...activities].reverse();
1307
+ return /* @__PURE__ */ jsx(Paper, { withBorder: true, children: /* @__PURE__ */ jsx(Timeline, { active: sorted.length - 1, bulletSize: 28, lineWidth: 2, color: "var(--color-primary)", children: sorted.map((activity, index) => {
1308
+ const Icon = ICON_MAP[activity.type] || IconActivity;
1309
+ return /* @__PURE__ */ jsx(
1310
+ Timeline.Item,
1311
+ {
1312
+ bullet: /* @__PURE__ */ jsx(ThemeIcon, { size: 28, variant: "filled", color: "var(--color-primary)", radius: "xl", children: /* @__PURE__ */ jsx(Icon, { size: 14 }) }),
1313
+ children: /* @__PURE__ */ jsxs(Stack, { gap: 2, children: [
1314
+ /* @__PURE__ */ jsx(Text, { size: "sm", fw: 500, children: activity.title }),
1315
+ activity.description && /* @__PURE__ */ jsx(Text, { size: "xs", c: "dimmed", children: activity.description }),
1316
+ /* @__PURE__ */ jsxs(Text, { size: "xs", c: "dimmed", children: [
1317
+ formatTimeAgo(activity.occurredAt),
1318
+ activity.actor && ` by ${activity.actor}`
1319
+ ] })
1320
+ ] })
1321
+ },
1322
+ index
1323
+ );
1324
+ }) }) });
1325
+ }
1326
+ var GRANULARITY_MAP = {
1327
+ "1h": "hour",
1328
+ "24h": "hour",
1329
+ "7d": "day",
1330
+ "30d": "day"
1331
+ };
1332
+ var BUCKET_CONFIG = {
1333
+ "1h": { size: 5 * 60 * 1e3, count: 12 },
1334
+ "24h": { size: 60 * 60 * 1e3, count: 24 },
1335
+ "7d": { size: 24 * 60 * 60 * 1e3, count: 7 },
1336
+ "30d": { size: 24 * 60 * 60 * 1e3, count: 30 }
1337
+ };
1338
+ function groupTimestampsByTime(timestamps, timeRange) {
1339
+ const { size: bucketSize, count: bucketCount } = BUCKET_CONFIG[timeRange];
1340
+ const granularity = GRANULARITY_MAP[timeRange];
1341
+ const now = /* @__PURE__ */ new Date();
1342
+ const flooredNow = new Date(now.getTime() - now.getTime() % bucketSize);
1343
+ const buckets = /* @__PURE__ */ new Map();
1344
+ for (let i = bucketCount - 1; i >= 0; i--) {
1345
+ const bucketTime = new Date(flooredNow.getTime() - i * bucketSize);
1346
+ const label = formatBucketTime(bucketTime.toISOString(), granularity);
1347
+ buckets.set(label, 0);
1348
+ }
1349
+ timestamps.forEach((occurredAt) => {
1350
+ const timeDiff = flooredNow.getTime() - occurredAt.getTime();
1351
+ const bucketIndex = Math.floor(timeDiff / bucketSize);
1352
+ if (bucketIndex >= 0 && bucketIndex < bucketCount) {
1353
+ const bucketTime = new Date(flooredNow.getTime() - bucketIndex * bucketSize);
1354
+ const label = formatBucketTime(bucketTime.toISOString(), granularity);
1355
+ buckets.set(label, (buckets.get(label) || 0) + 1);
1356
+ }
1357
+ });
1358
+ return Array.from(buckets.entries()).map(([time, count]) => ({
1359
+ time,
1360
+ "Activity Count": count
1361
+ }));
1362
+ }
1363
+ function ActivityTrendChart({ timestamps, total, isLoading, timeRange }) {
1364
+ const chartData = useMemo(() => {
1365
+ return groupTimestampsByTime(timestamps, timeRange);
1366
+ }, [timestamps, timeRange]);
1367
+ if (isLoading) {
1368
+ return /* @__PURE__ */ jsx(Center, { p: "xl", children: /* @__PURE__ */ jsx(Loader, {}) });
1369
+ }
1370
+ return /* @__PURE__ */ jsxs(Paper, { withBorder: true, children: [
1371
+ /* @__PURE__ */ jsx(
1372
+ CardHeader,
1373
+ {
1374
+ icon: /* @__PURE__ */ jsx(IconActivity, { size: 18 }),
1375
+ title: "Activity Trend",
1376
+ subtitle: `${total} activities in ${getTimeRangeLabel(timeRange)}`
1377
+ }
1378
+ ),
1379
+ /* @__PURE__ */ jsx(
1380
+ CyberAreaChart,
1381
+ {
1382
+ data: chartData,
1383
+ series: [{ dataKey: "Activity Count", color: "blue" }],
1384
+ height: 200,
1385
+ yAxisLabel: "Count",
1386
+ yDomain: [0, "auto"]
1387
+ }
1388
+ )
1389
+ ] });
1390
+ }
1391
+ function formatDollar(value) {
1392
+ return `$${value.toFixed(2)}`;
1393
+ }
1394
+ function CostTrendChart({ data, summaryData, isLoading, error }) {
1395
+ const todayCost = summaryData?.current.totalCostUsd ?? 0;
1396
+ const previousCost = summaryData?.previous.totalCostUsd ?? 0;
1397
+ const mtdCost = summaryData?.mtd.totalCostUsd ?? 0;
1398
+ const projectedMonthlyCost = summaryData?.projection.monthlyCostUsd ?? 0;
1399
+ const confidence = summaryData?.projection.confidence ?? "low";
1400
+ const budget = 1500;
1401
+ const budgetStatus = projectedMonthlyCost <= budget ? "green" : projectedMonthlyCost <= budget * 1.1 ? "yellow" : "red";
1402
+ const budgetLabel = projectedMonthlyCost <= budget ? "On Budget" : projectedMonthlyCost <= budget * 1.1 ? "Warning" : "Over Budget";
1403
+ const chartData = data?.trendData.map((point) => {
1404
+ const date = new Date(point.time);
1405
+ const timeLabel = data.granularity === "hour" ? date.toLocaleTimeString("en-US", { hour: "2-digit", minute: "2-digit" }) : date.toLocaleDateString("en-US", { month: "short", day: "numeric" });
1406
+ return {
1407
+ time: timeLabel,
1408
+ "Total Cost": point.totalCostUsd
1409
+ };
1410
+ }) ?? [];
1411
+ const handleExport = () => {
1412
+ if (!data) return;
1413
+ const csvContent = [
1414
+ ["Time", "Total Cost ($)", "Executions", "Avg Cost/Execution ($)"],
1415
+ ...data.trendData.map((d) => [
1416
+ d.time,
1417
+ d.totalCostUsd.toFixed(4),
1418
+ d.executionCount,
1419
+ d.avgCostPerExecution.toFixed(4)
1420
+ ])
1421
+ ].map((row) => row.join(",")).join("\n");
1422
+ const blob = new Blob([csvContent], { type: "text/csv" });
1423
+ const url = URL.createObjectURL(blob);
1424
+ const link = document.createElement("a");
1425
+ link.href = url;
1426
+ link.download = `cost-trends-${(/* @__PURE__ */ new Date()).toISOString().split("T")[0]}.csv`;
1427
+ link.click();
1428
+ URL.revokeObjectURL(url);
1429
+ };
1430
+ if (error) {
1431
+ return /* @__PURE__ */ jsx(Paper, { withBorder: true, children: /* @__PURE__ */ jsx(CenteredErrorState, { error, title: "Failed to load cost trends" }) });
1432
+ }
1433
+ if (isLoading) {
1434
+ return /* @__PURE__ */ jsx(Paper, { withBorder: true, children: /* @__PURE__ */ jsx(Center, { p: "xl", children: /* @__PURE__ */ jsx(Loader, {}) }) });
1435
+ }
1436
+ const granularityLabel = data?.granularity === "hour" ? "Hourly" : "Daily";
1437
+ return /* @__PURE__ */ jsxs(Paper, { withBorder: true, children: [
1438
+ /* @__PURE__ */ jsx(
1439
+ CardHeader,
1440
+ {
1441
+ icon: /* @__PURE__ */ jsx(IconChartLine, { size: 18 }),
1442
+ title: `Cost Trend (${granularityLabel})`,
1443
+ rightSection: /* @__PURE__ */ jsx(Button, { variant: "subtle", size: "xs", leftSection: /* @__PURE__ */ jsx(IconDownload, { size: 14 }), onClick: handleExport, children: "Export CSV" })
1444
+ }
1445
+ ),
1446
+ /* @__PURE__ */ jsxs(Group, { justify: "space-between", align: "center", mb: "md", children: [
1447
+ /* @__PURE__ */ jsxs(Group, { gap: "lg", children: [
1448
+ /* @__PURE__ */ jsxs(Group, { gap: 6, align: "baseline", children: [
1449
+ /* @__PURE__ */ jsx(Text, { size: "xl", fw: 700, style: { fontFamily: "var(--mantine-font-family-headings)" }, children: /* @__PURE__ */ jsx(NumberFormatter, { prefix: "$", value: todayCost, decimalScale: 2 }) }),
1450
+ /* @__PURE__ */ jsx(Text, { size: "xs", c: "dimmed", children: "period" }),
1451
+ /* @__PURE__ */ jsx(TrendIndicator, { current: todayCost, previous: previousCost, inverse: true })
1452
+ ] }),
1453
+ /* @__PURE__ */ jsxs(Group, { gap: 6, align: "baseline", children: [
1454
+ /* @__PURE__ */ jsx(Text, { size: "xl", fw: 700, style: { fontFamily: "var(--mantine-font-family-headings)" }, children: /* @__PURE__ */ jsx(NumberFormatter, { prefix: "$", value: mtdCost, thousandSeparator: true, decimalScale: 2 }) }),
1455
+ /* @__PURE__ */ jsx(Text, { size: "xs", c: "dimmed", children: "MTD" })
1456
+ ] })
1457
+ ] }),
1458
+ /* @__PURE__ */ jsx(Badge, { size: "md", variant: "dot", color: budgetStatus, children: budgetLabel })
1459
+ ] }),
1460
+ chartData.length > 0 ? /* @__PURE__ */ jsx(
1461
+ CyberAreaChart,
1462
+ {
1463
+ data: chartData,
1464
+ series: [{ dataKey: "Total Cost", color: "blue", name: "Total Cost" }],
1465
+ height: 200,
1466
+ yDomain: [0, (max) => Math.max(max * 1.1, 0.01)],
1467
+ yTickFormatter: formatDollar,
1468
+ tooltipFormatter: formatDollar,
1469
+ baselineColor: "blue"
1470
+ }
1471
+ ) : /* @__PURE__ */ jsx(EmptyState, { icon: IconChartLine, title: "No cost data available for this time period" }),
1472
+ /* @__PURE__ */ jsx(Space, { h: "lg" }),
1473
+ /* @__PURE__ */ jsxs(Group, { justify: "space-between", children: [
1474
+ /* @__PURE__ */ jsxs(Group, { gap: 4, children: [
1475
+ /* @__PURE__ */ jsxs(Text, { size: "xs", c: "dimmed", children: [
1476
+ "Projected monthly:",
1477
+ " ",
1478
+ /* @__PURE__ */ jsx(NumberFormatter, { prefix: "$", value: projectedMonthlyCost, thousandSeparator: true, decimalScale: 2 })
1479
+ ] }),
1480
+ /* @__PURE__ */ jsx(Tooltip$1, { label: `Projection confidence: ${confidence}`, children: /* @__PURE__ */ jsx(IconInfoCircle, { size: 12, color: "var(--color-text-subtle)" }) })
1481
+ ] }),
1482
+ /* @__PURE__ */ jsxs(
1483
+ Text,
1484
+ {
1485
+ size: "xs",
1486
+ fw: 600,
1487
+ c: projectedMonthlyCost > budget ? "red" : "dimmed",
1488
+ style: { fontFamily: "var(--mantine-font-family-headings)" },
1489
+ children: [
1490
+ "Budget: ",
1491
+ /* @__PURE__ */ jsx(NumberFormatter, { prefix: "$", value: budget, thousandSeparator: true, decimalScale: 2 })
1492
+ ]
1493
+ }
1494
+ )
1495
+ ] })
1496
+ ] });
1497
+ }
1498
+ var EM_DASH = "\u2014";
1499
+ function getSuccessRateColor(rate) {
1500
+ if (rate >= 95) return "var(--mantine-color-teal-6)";
1501
+ if (rate >= 80) return "var(--mantine-color-yellow-6)";
1502
+ return "var(--mantine-color-red-6)";
1503
+ }
1504
+ function getErrorCountColor(count) {
1505
+ if (count === 0) return "var(--mantine-color-teal-6)";
1506
+ if (count <= 5) return "var(--mantine-color-yellow-6)";
1507
+ return "var(--mantine-color-red-6)";
1508
+ }
1509
+ function HeroStatsRow({
1510
+ resourcesData,
1511
+ resourcesLoading,
1512
+ dashboardData,
1513
+ dashboardLoading,
1514
+ unresolvedErrorCount,
1515
+ errorsLoading
1516
+ }) {
1517
+ const health = dashboardData?.executionHealth;
1518
+ const resourceCount = resourcesData?.total ?? null;
1519
+ const totalExecutions = health?.totalExecutions ?? null;
1520
+ const successRate = totalExecutions ? health?.successRate ?? null : null;
1521
+ return /* @__PURE__ */ jsxs(SimpleGrid, { cols: { base: 2, sm: 5 }, children: [
1522
+ /* @__PURE__ */ jsx(
1523
+ StatCard,
1524
+ {
1525
+ variant: "hero",
1526
+ icon: IconApps,
1527
+ value: resourceCount ?? EM_DASH,
1528
+ label: "Resources",
1529
+ isLoading: resourcesLoading
1530
+ }
1531
+ ),
1532
+ /* @__PURE__ */ jsx(
1533
+ StatCard,
1534
+ {
1535
+ variant: "hero",
1536
+ icon: IconPlayerPlay,
1537
+ value: totalExecutions ?? EM_DASH,
1538
+ label: "Executions",
1539
+ isLoading: dashboardLoading
1540
+ }
1541
+ ),
1542
+ /* @__PURE__ */ jsx(
1543
+ StatCard,
1544
+ {
1545
+ variant: "hero",
1546
+ icon: IconChartBar,
1547
+ value: successRate != null ? `${Math.round(successRate)}%` : EM_DASH,
1548
+ label: "Success Rate",
1549
+ valueColor: successRate != null ? getSuccessRateColor(successRate) : void 0,
1550
+ isLoading: dashboardLoading
1551
+ }
1552
+ ),
1553
+ /* @__PURE__ */ jsx(
1554
+ StatCard,
1555
+ {
1556
+ variant: "hero",
1557
+ icon: IconAlertTriangle,
1558
+ value: errorsLoading ? EM_DASH : unresolvedErrorCount ?? EM_DASH,
1559
+ label: "Errors",
1560
+ valueColor: unresolvedErrorCount != null ? getErrorCountColor(unresolvedErrorCount) : void 0
1561
+ }
1562
+ ),
1563
+ /* @__PURE__ */ jsx(
1564
+ StatCard,
1565
+ {
1566
+ variant: "hero",
1567
+ icon: IconRocket,
1568
+ value: dashboardData?.activeDeploymentVersion ?? EM_DASH,
1569
+ label: "Deployment",
1570
+ isLoading: dashboardLoading
1571
+ }
1572
+ )
1573
+ ] });
1574
+ }
1575
+
1576
+ // src/hooks/observability/queryKeys.ts
1577
+ var observabilityKeys = {
1578
+ all: ["observability"],
1579
+ // Error analysis
1580
+ errorAnalysis: (organizationId, timeRange) => [...observabilityKeys.all, "error-analysis", organizationId, timeRange],
1581
+ // Error details list
1582
+ errorDetails: (organizationId, filters) => [...observabilityKeys.all, "error-details", organizationId, filters],
1583
+ // Single execution error detail
1584
+ errorDetail: (organizationId, executionId) => [...observabilityKeys.all, "error-detail", organizationId, executionId],
1585
+ // Error trends time-series
1586
+ errorTrends: (organizationId, startDate, endDate, granularity) => [...observabilityKeys.all, "error-trends", organizationId, startDate, endDate, granularity],
1587
+ // Error distribution breakdown
1588
+ errorDistribution: (organizationId, startDate, endDate, groupBy) => [...observabilityKeys.all, "error-distribution", organizationId, startDate, endDate, groupBy],
1589
+ // Top failing resources
1590
+ topFailingResources: (organizationId, startDate, endDate, limit) => [...observabilityKeys.all, "top-failing-resources", organizationId, startDate, endDate, limit],
1591
+ // Cost trends time-series
1592
+ costTrends: (organizationId, timeRange, granularity) => [...observabilityKeys.all, "cost-trends", organizationId, timeRange, granularity],
1593
+ // Cost by model breakdown
1594
+ costByModel: (organizationId, timeRange) => [...observabilityKeys.all, "cost-by-model", organizationId, timeRange],
1595
+ // Cost breakdown per resource/model
1596
+ costBreakdown: (organizationId, timeRange) => [...observabilityKeys.all, "cost-breakdown", organizationId, timeRange],
1597
+ // Composite dashboard metrics
1598
+ dashboardMetrics: (organizationId, timeRange) => [...observabilityKeys.all, "dashboard-metrics", organizationId, timeRange],
1599
+ // Business impact / automation ROI
1600
+ businessImpact: (organizationId, timeRange) => [...observabilityKeys.all, "business-impact", organizationId, timeRange],
1601
+ // Resources health batch
1602
+ resourcesHealth: (organizationId, resources, startDate, endDate, granularity) => [...observabilityKeys.all, "resources-health", organizationId, resources, startDate, endDate, granularity],
1603
+ // System-scoped health from direct/descendant resource descriptors
1604
+ systemHealth: (organizationId, systemPath, timeRange, includeDescendants, descendantMode, resourceSet, startDate, endDate, directResources, descendantResources) => [
1605
+ ...observabilityKeys.all,
1606
+ "system-health",
1607
+ organizationId,
1608
+ systemPath,
1609
+ timeRange,
1610
+ includeDescendants,
1611
+ descendantMode,
1612
+ resourceSet,
1613
+ startDate,
1614
+ endDate,
1615
+ directResources,
1616
+ descendantResources
1617
+ ],
1618
+ // Unresolved errors dashboard teaser
1619
+ unresolvedErrors: (organizationId, startDate, endDate) => [...observabilityKeys.all, "unresolved-errors", organizationId, startDate, endDate],
1620
+ // Recent executions grouped by resource (dashboard widget)
1621
+ recentExecutionsByResource: (organizationId, timeRange, limit) => [...observabilityKeys.all, "recent-executions-by-resource", organizationId, timeRange, limit]
1622
+ };
1623
+
1624
+ // src/hooks/observability/useErrorTrends.ts
1625
+ function useErrorTrends({ startDate, endDate, granularity }) {
1626
+ const { apiRequest, isReady, workOSOrganizationId } = useElevasisServices();
1627
+ return useQuery({
1628
+ queryKey: observabilityKeys.errorTrends(workOSOrganizationId, startDate, endDate, granularity),
1629
+ queryFn: async () => {
1630
+ const params = new URLSearchParams({ startDate, endDate, granularity });
1631
+ return apiRequest(`/observability/error-analytics/trends?${params.toString()}`);
1632
+ },
1633
+ enabled: isReady,
1634
+ refetchInterval: 6e4,
1635
+ staleTime: 3e4
1636
+ });
1637
+ }
1638
+ function getGranularityFromTimeRange(timeRange) {
1639
+ return ["1h", "24h"].includes(timeRange) ? "hour" : "day";
1640
+ }
1641
+ function formatPeakPeriod(peakPeriod, granularity) {
1642
+ if (!peakPeriod) return "N/A";
1643
+ const date = new Date(peakPeriod);
1644
+ if (granularity === "hour") {
1645
+ return date.toLocaleTimeString("en-US", { hour: "numeric", minute: "2-digit", hour12: true });
1646
+ } else {
1647
+ return date.toLocaleDateString("en-US", { weekday: "short", month: "short", day: "numeric" });
1648
+ }
1649
+ }
1650
+ function CombinedTrendChart({
1651
+ healthData,
1652
+ errorData: _errorData,
1653
+ isLoading,
1654
+ error,
1655
+ timeRange,
1656
+ navigationAction,
1657
+ compact = false
1658
+ }) {
1659
+ const [activeTab, setActiveTab] = useState("success");
1660
+ const colors = useCyberColors();
1661
+ const { startDate: start, endDate: end } = useMemo(() => getTimeRangeDates(timeRange), [timeRange]);
1662
+ const granularity = getGranularityFromTimeRange(timeRange);
1663
+ const { data: errorTrends } = useErrorTrends({
1664
+ startDate: start,
1665
+ endDate: end,
1666
+ granularity
1667
+ });
1668
+ const xTickFormatter = useCallback((value) => formatBucketTime(value, granularity), [granularity]);
1669
+ if (error) {
1670
+ return /* @__PURE__ */ jsx(Paper, { withBorder: true, children: /* @__PURE__ */ jsx(CenteredErrorState, { error, title: "Failed to load trend data" }) });
1671
+ }
1672
+ if (isLoading) {
1673
+ return /* @__PURE__ */ jsx(Paper, { withBorder: true, children: /* @__PURE__ */ jsx(Center, { p: "xl", children: /* @__PURE__ */ jsx(Loader, {}) }) });
1674
+ }
1675
+ const errorTrendsMap = new Map(errorTrends?.map((trend) => [trend.time, trend.errorCount]) || []);
1676
+ const successErrorData = healthData?.trendData.length ? healthData.trendData.map((d) => {
1677
+ const errorCount = errorTrendsMap.get(d.time) || 0;
1678
+ return {
1679
+ time: d.time,
1680
+ "Success Count": d.successCount,
1681
+ "Error Count": errorCount
1682
+ };
1683
+ }) : [];
1684
+ const throughputData = healthData?.trendData.length ? healthData.trendData.map((d) => ({
1685
+ time: d.time,
1686
+ Executions: d.executionCount
1687
+ })) : [];
1688
+ const totalExecutions = healthData?.totalExecutions ?? 0;
1689
+ const peakPeriod = healthData?.peakPeriod ?? "";
1690
+ const dataGranularity = healthData?.granularity ?? granularity;
1691
+ if (!successErrorData.length) {
1692
+ return /* @__PURE__ */ jsx(Paper, { withBorder: true, children: /* @__PURE__ */ jsx(Center, { h: 300, children: /* @__PURE__ */ jsx(Alert, { icon: /* @__PURE__ */ jsx(IconAlertCircle, {}), color: "gray", variant: "light", children: "No trend data available for the selected time range" }) }) });
1693
+ }
1694
+ return /* @__PURE__ */ jsxs(Paper, { withBorder: true, children: [
1695
+ /* @__PURE__ */ jsx(
1696
+ CardHeader,
1697
+ {
1698
+ icon: /* @__PURE__ */ jsx(IconChartLine, { size: 18 }),
1699
+ title: "Execution Trends",
1700
+ subtitle: `${getTimeRangeLabel(timeRange)} - ${dataGranularity === "hour" ? "Hourly" : "Daily"} data`,
1701
+ rightSection: /* @__PURE__ */ jsxs(Group, { gap: "sm", children: [
1702
+ /* @__PURE__ */ jsx(
1703
+ SegmentedControl,
1704
+ {
1705
+ value: activeTab ?? "success",
1706
+ onChange: setActiveTab,
1707
+ size: "xs",
1708
+ data: [
1709
+ { label: "Success & Errors", value: "success" },
1710
+ { label: "Throughput", value: "throughput" }
1711
+ ]
1712
+ }
1713
+ ),
1714
+ navigationAction
1715
+ ] })
1716
+ }
1717
+ ),
1718
+ activeTab === "success" && /* @__PURE__ */ jsxs(Box, { style: { height: compact ? 180 : 280 }, children: [
1719
+ /* @__PURE__ */ jsxs(Group, { gap: "lg", justify: "center", mb: "xs", h: 24, align: "center", children: [
1720
+ /* @__PURE__ */ jsx(CyberLegendItem, { color: colors.green, label: "Success Count" }),
1721
+ /* @__PURE__ */ jsx(CyberLegendItem, { color: colors.red, label: "Error Count" })
1722
+ ] }),
1723
+ /* @__PURE__ */ jsx(
1724
+ CyberAreaChart,
1725
+ {
1726
+ data: successErrorData,
1727
+ series: [
1728
+ { dataKey: "Error Count", color: "red" },
1729
+ { dataKey: "Success Count", color: "green", animationDuration: 1400 }
1730
+ ],
1731
+ height: compact ? 150 : 250,
1732
+ yAxisLabel: "Count",
1733
+ baselineColor: "green",
1734
+ xTickFormatter
1735
+ }
1736
+ )
1737
+ ] }),
1738
+ activeTab === "throughput" && /* @__PURE__ */ jsxs(Box, { style: { height: compact ? 180 : 280 }, children: [
1739
+ /* @__PURE__ */ jsxs(Group, { gap: "lg", justify: "center", mb: "xs", h: 24, align: "center", children: [
1740
+ /* @__PURE__ */ jsxs(Group, { gap: 6, children: [
1741
+ /* @__PURE__ */ jsx(Text, { size: "sm", fw: 600, style: { color: colors.blue, fontVariantNumeric: "tabular-nums" }, children: totalExecutions.toLocaleString() }),
1742
+ /* @__PURE__ */ jsx(Text, { size: "xs", c: "dimmed", children: "executions" })
1743
+ ] }),
1744
+ /* @__PURE__ */ jsx(Text, { size: "xs", c: "dimmed", children: "|" }),
1745
+ /* @__PURE__ */ jsxs(Group, { gap: 6, children: [
1746
+ /* @__PURE__ */ jsx(Text, { size: "xs", c: "dimmed", children: "peak" }),
1747
+ /* @__PURE__ */ jsx(Text, { size: "sm", fw: 600, style: { color: colors.blue, fontVariantNumeric: "tabular-nums" }, children: formatPeakPeriod(peakPeriod, dataGranularity) })
1748
+ ] }),
1749
+ /* @__PURE__ */ jsx(Badge, { size: "xs", variant: "dot", color: "green", children: "Normal" })
1750
+ ] }),
1751
+ /* @__PURE__ */ jsx(
1752
+ CyberAreaChart,
1753
+ {
1754
+ data: throughputData,
1755
+ series: [{ dataKey: "Executions", color: "blue" }],
1756
+ height: compact ? 150 : 250,
1757
+ xTickFormatter
1758
+ }
1759
+ )
1760
+ ] })
1761
+ ] });
1762
+ }
1763
+
1764
+ export { APIErrorAlert, ActivityTimeline, ActivityTrendChart, CardHeader, CenteredErrorState, ChartFrame, CollapsibleSection, CombinedTrendChart, ContextViewer, CostTrendChart, CustomSelector, CyberAreaChart, CyberDonut, CyberDonutTooltip, CyberLegendItem, DetailCardSkeleton, ElevasisLoader, EmptyState, FeatureUnavailableState, GlowDot, HeroStatsRow, JsonViewer, ListSkeleton, PageNotFound, PageTitleCaption, ResourceCard, StatCard, StatCardSkeleton, StatsCardSkeleton, StatusBadge, TabCountBadge, TimeRangeSelector, TrendIndicator, getSeriesColor, observabilityKeys, useCyberColors, useErrorTrends };