@elevasis/ui 1.15.3 → 1.17.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 (41) hide show
  1. package/dist/charts/index.d.ts +25 -2
  2. package/dist/charts/index.js +2 -2
  3. package/dist/{chunk-FEZ2TGSH.js → chunk-7ATCF6UL.js} +282 -14
  4. package/dist/{chunk-4NHYV42S.js → chunk-7S5FS7WW.js} +35 -4
  5. package/dist/chunk-ADSSLKKP.js +10 -0
  6. package/dist/{chunk-WY2BCL5F.js → chunk-F25DUOWI.js} +2 -2
  7. package/dist/chunk-MHW43EOH.js +47 -0
  8. package/dist/{chunk-6YIE72M2.js → chunk-NUULWBAD.js} +1 -1
  9. package/dist/{chunk-E6Q6A5TU.js → chunk-QCEUL5QG.js} +2 -6
  10. package/dist/{chunk-4NAZQ7WO.js → chunk-RYSPAQGW.js} +2 -2
  11. package/dist/{chunk-XY7VKOKI.js → chunk-UEYUPTAD.js} +80 -777
  12. package/dist/chunk-ZGK6XZVY.js +1208 -0
  13. package/dist/components/index.d.ts +511 -488
  14. package/dist/components/index.js +28 -1221
  15. package/dist/features/operations/index.css +565 -0
  16. package/dist/features/operations/index.d.ts +90 -0
  17. package/dist/features/operations/index.js +241 -0
  18. package/dist/hooks/index.d.ts +509 -488
  19. package/dist/hooks/index.js +4 -4
  20. package/dist/hooks/published.d.ts +509 -488
  21. package/dist/hooks/published.js +4 -4
  22. package/dist/index.d.ts +522 -490
  23. package/dist/index.js +6 -6
  24. package/dist/initialization/index.d.ts +508 -487
  25. package/dist/layout/index.d.ts +196 -6
  26. package/dist/layout/index.js +5 -4
  27. package/dist/profile/index.d.ts +508 -487
  28. package/dist/provider/index.d.ts +1 -1
  29. package/dist/provider/index.js +4 -4
  30. package/dist/provider/published.d.ts +1 -1
  31. package/dist/router/index.d.ts +12 -1
  32. package/dist/router/index.js +1 -1
  33. package/dist/supabase/index.d.ts +890 -851
  34. package/dist/theme/index.d.ts +1 -1
  35. package/dist/theme/index.js +3 -3
  36. package/dist/types/index.d.ts +509 -488
  37. package/package.json +5 -1
  38. package/dist/chunk-LHQTTUL2.js +0 -27
  39. package/dist/components/layout/backgrounds/CyberParticles.d.ts +0 -30
  40. package/dist/components/layout/backgrounds/CyberParticles.d.ts.map +0 -1
  41. package/dist/components/layout/backgrounds/CyberParticles.js +0 -138
@@ -0,0 +1,1208 @@
1
+ import { useCyberColors, GlowDot } from './chunk-7S5FS7WW.js';
2
+ import { Graph_module_css_default, useDirectedChainHighlighting, useNodeSelection, useFitViewTrigger } from './chunk-F6RBK7NJ.js';
3
+ import { STATUS_COLORS, getStatusIcon, formatDuration, getStatusColors, AGENT_CONSTANTS, shouldAnimateEdge, TIMELINE_CONSTANTS, calculateBarPosition, CONTAINER_CONSTANTS, useExecutionPath, useUnifiedWorkflowLayout, WORKFLOW_CONSTANTS, useReactFlowAgent } from './chunk-XA34RETF.js';
4
+ import { Paper, Stack, Text, Group, Badge, Box, useComputedColorScheme, Loader, Card, ActionIcon, SegmentedControl } from '@mantine/core';
5
+ import { jsxs, jsx } from 'react/jsx-runtime';
6
+ import { memo, useMemo, useEffect, useState, useCallback, Fragment } from 'react';
7
+ import { Position, Handle, getSmoothStepPath, BaseEdge as BaseEdge$1, EdgeLabelRenderer, Panel, useReactFlow, Controls, ReactFlowProvider, ReactFlow } from '@xyflow/react';
8
+ import { IconPlayerPlay, IconPlayerStop, IconArrowsSplit, IconSquare, IconFocus2 } from '@tabler/icons-react';
9
+ import '@xyflow/react/dist/style.css';
10
+
11
+ function ExecutionStatusBadge({
12
+ status,
13
+ size = "sm",
14
+ variant = "light",
15
+ showLoader = true
16
+ }) {
17
+ const statusColors = STATUS_COLORS[status];
18
+ const isRunning = status === "running" && showLoader;
19
+ return /* @__PURE__ */ jsx(
20
+ Badge,
21
+ {
22
+ color: statusColors.badge,
23
+ size,
24
+ variant,
25
+ leftSection: isRunning ? /* @__PURE__ */ jsx(Loader, { size: 10, color: statusColors.badge }) : void 0,
26
+ children: status.charAt(0).toUpperCase() + status.slice(1)
27
+ }
28
+ );
29
+ }
30
+ function getRateColor(rate) {
31
+ if (rate >= 95) return "var(--color-success)";
32
+ if (rate >= 80) return "var(--color-warning)";
33
+ return "var(--color-error)";
34
+ }
35
+ function getMantineRateColor(rate) {
36
+ if (rate >= 95) return "green";
37
+ if (rate >= 80) return "yellow";
38
+ return "red";
39
+ }
40
+ function ExecutionStats({
41
+ totalExecutions,
42
+ successCount,
43
+ failureCount,
44
+ warningCount,
45
+ successRate,
46
+ align = "flex-end",
47
+ compact = false
48
+ }) {
49
+ const cyberColors = useCyberColors();
50
+ if (totalExecutions === 0 && !compact) {
51
+ return null;
52
+ }
53
+ if (compact && totalExecutions === 0) {
54
+ return /* @__PURE__ */ jsxs(Group, { gap: 10, wrap: "nowrap", style: { width: "100%" }, children: [
55
+ /* @__PURE__ */ jsx(Text, { size: "md", fw: 700, ff: "monospace", c: "dimmed", style: { minWidth: 42 }, children: "\u2014" }),
56
+ /* @__PURE__ */ jsx(Text, { size: "sm", c: "dimmed", style: { whiteSpace: "nowrap" }, children: "No recent executions" })
57
+ ] });
58
+ }
59
+ if (compact) {
60
+ return /* @__PURE__ */ jsxs(Group, { gap: 10, wrap: "nowrap", style: { width: "100%" }, children: [
61
+ /* @__PURE__ */ jsxs(Group, { gap: 8, wrap: "nowrap", children: [
62
+ /* @__PURE__ */ jsxs(Text, { size: "md", fw: 700, ff: "monospace", style: { color: getRateColor(successRate), minWidth: 42 }, children: [
63
+ successRate,
64
+ "%"
65
+ ] }),
66
+ /* @__PURE__ */ jsxs(Group, { gap: 5, wrap: "nowrap", children: [
67
+ /* @__PURE__ */ jsx(GlowDot, { size: "sm", color: cyberColors.green }),
68
+ /* @__PURE__ */ jsx(Text, { size: "sm", fw: 600, c: "green", children: successCount })
69
+ ] }),
70
+ failureCount > 0 && /* @__PURE__ */ jsxs(Group, { gap: 5, wrap: "nowrap", children: [
71
+ /* @__PURE__ */ jsx(GlowDot, { size: "sm", color: cyberColors.red }),
72
+ /* @__PURE__ */ jsx(Text, { size: "sm", fw: 600, c: "red", children: failureCount })
73
+ ] })
74
+ ] }),
75
+ /* @__PURE__ */ jsxs(Text, { size: "sm", c: "dimmed", style: { whiteSpace: "nowrap" }, children: [
76
+ totalExecutions,
77
+ " ",
78
+ totalExecutions === 1 ? "run" : "runs"
79
+ ] })
80
+ ] });
81
+ }
82
+ return /* @__PURE__ */ jsxs(Stack, { gap: 2, align, style: { whiteSpace: "nowrap" }, children: [
83
+ /* @__PURE__ */ jsxs(Text, { size: "xs", c: "blue", children: [
84
+ totalExecutions,
85
+ " ",
86
+ totalExecutions === 1 ? "execution" : "executions"
87
+ ] }),
88
+ /* @__PURE__ */ jsxs(Text, { size: "xs", c: "green", children: [
89
+ successCount,
90
+ " success"
91
+ ] }),
92
+ warningCount != null && warningCount > 0 && /* @__PURE__ */ jsxs(Text, { size: "xs", c: "yellow", children: [
93
+ warningCount,
94
+ " warning"
95
+ ] }),
96
+ failureCount > 0 && /* @__PURE__ */ jsxs(Text, { size: "xs", c: "red", children: [
97
+ failureCount,
98
+ " failed"
99
+ ] }),
100
+ /* @__PURE__ */ jsxs(Text, { size: "xs", fw: 600, c: getMantineRateColor(successRate), children: [
101
+ successRate,
102
+ "% Success Rate"
103
+ ] })
104
+ ] });
105
+ }
106
+ function TimelineAxis({ totalDuration }) {
107
+ const markers = [
108
+ { position: 0, time: 0 },
109
+ { position: 25, time: totalDuration * 0.25 },
110
+ { position: 50, time: totalDuration * 0.5 },
111
+ { position: 75, time: totalDuration * 0.75 },
112
+ { position: 100, time: totalDuration }
113
+ ];
114
+ return /* @__PURE__ */ jsx(
115
+ Box,
116
+ {
117
+ style: {
118
+ position: "relative",
119
+ height: 20
120
+ },
121
+ children: markers.map((marker, idx) => /* @__PURE__ */ jsx(
122
+ Box,
123
+ {
124
+ style: {
125
+ position: "absolute",
126
+ left: `${marker.position}%`,
127
+ transform: marker.position === 100 ? "translateX(-100%)" : marker.position === 0 ? "none" : "translateX(-50%)",
128
+ top: 4
129
+ },
130
+ children: /* @__PURE__ */ jsx(Text, { size: "xs", c: "dimmed", children: formatDuration(marker.time) })
131
+ },
132
+ idx
133
+ ))
134
+ }
135
+ );
136
+ }
137
+ function TimelineContainer({ executionStart, executionEnd, children }) {
138
+ const totalDuration = executionEnd - executionStart;
139
+ return /* @__PURE__ */ jsxs(
140
+ Box,
141
+ {
142
+ style: {
143
+ borderBottom: "1px solid var(--color-border)",
144
+ backgroundColor: "var(--color-background)",
145
+ padding: "var(--mantine-spacing-xs)"
146
+ },
147
+ children: [
148
+ /* @__PURE__ */ jsx(
149
+ Box,
150
+ {
151
+ style: {
152
+ position: "relative"
153
+ },
154
+ children: /* @__PURE__ */ jsx(Box, { style: { position: "relative", zIndex: 1 }, children })
155
+ }
156
+ ),
157
+ /* @__PURE__ */ jsx(Box, { style: { paddingLeft: TIMELINE_CONSTANTS.LABEL_WIDTH + 12, paddingRight: 16 }, children: /* @__PURE__ */ jsx(TimelineAxis, { totalDuration }) })
158
+ ]
159
+ }
160
+ );
161
+ }
162
+ function TimelineBar({
163
+ startTime,
164
+ endTime,
165
+ executionStart,
166
+ executionEnd,
167
+ status,
168
+ label,
169
+ onClick,
170
+ isSelected = false,
171
+ hasSelection = false
172
+ }) {
173
+ const colors = getStatusColors(status);
174
+ const { left, width } = calculateBarPosition(startTime, endTime, executionStart, executionEnd);
175
+ const opacity = hasSelection && !isSelected ? 0.5 : 1;
176
+ return /* @__PURE__ */ jsx(
177
+ Box,
178
+ {
179
+ style: {
180
+ position: "absolute",
181
+ left: `${left}%`,
182
+ width: `${width}%`,
183
+ top: 4,
184
+ height: TIMELINE_CONSTANTS.BAR_HEIGHT / 2,
185
+ backgroundColor: colors.color,
186
+ opacity,
187
+ borderRadius: 4,
188
+ cursor: onClick ? "pointer" : "default",
189
+ display: "flex",
190
+ alignItems: "center",
191
+ justifyContent: "center",
192
+ overflow: "hidden"
193
+ },
194
+ onClick,
195
+ children: label && /* @__PURE__ */ jsx(Text, { size: "xs", c: "white", style: { whiteSpace: "nowrap" }, children: label })
196
+ }
197
+ );
198
+ }
199
+ function TimelineRow({
200
+ label,
201
+ bars,
202
+ executionStart,
203
+ executionEnd,
204
+ indent = 0,
205
+ selectedNodeId
206
+ }) {
207
+ const labelMatch = label.match(/^(.+?)\s*\((.+?)\)$/);
208
+ const labelName = labelMatch ? labelMatch[1] : label;
209
+ const labelDuration = labelMatch ? labelMatch[2] : null;
210
+ const statusColor = bars.length > 0 ? getStatusColors(bars[0].status).color : "var(--color-text-dimmed)";
211
+ const hasSelection = selectedNodeId !== null && selectedNodeId !== void 0;
212
+ return /* @__PURE__ */ jsxs(
213
+ Box,
214
+ {
215
+ style: {
216
+ display: "flex",
217
+ gap: 0,
218
+ height: TIMELINE_CONSTANTS.BAR_HEIGHT
219
+ // paddingLeft: indent * TIMELINE_CONSTANTS.INDENT_SIZE
220
+ },
221
+ children: [
222
+ /* @__PURE__ */ jsxs(
223
+ Box,
224
+ {
225
+ style: {
226
+ height: TIMELINE_CONSTANTS.BAR_HEIGHT,
227
+ width: TIMELINE_CONSTANTS.LABEL_WIDTH,
228
+ flexShrink: 0,
229
+ display: "flex",
230
+ alignItems: "center",
231
+ gap: 6,
232
+ paddingRight: 12,
233
+ paddingLeft: 8 + indent * TIMELINE_CONSTANTS.INDENT_SIZE,
234
+ // Indent only the label, not the timeline bars
235
+ overflow: "hidden"
236
+ },
237
+ children: [
238
+ /* @__PURE__ */ jsx(
239
+ Box,
240
+ {
241
+ style: {
242
+ width: 6,
243
+ height: 6,
244
+ borderRadius: "50%",
245
+ backgroundColor: statusColor,
246
+ flexShrink: 0
247
+ }
248
+ }
249
+ ),
250
+ /* @__PURE__ */ jsx(Text, { size: "sm", truncate: true, style: { flexShrink: 1, minWidth: 0 }, children: labelName }),
251
+ labelDuration && /* @__PURE__ */ jsxs(Text, { size: "sm", c: "dimmed", ff: "monospace", style: { flexShrink: 0 }, children: [
252
+ "(",
253
+ labelDuration,
254
+ ")"
255
+ ] })
256
+ ]
257
+ }
258
+ ),
259
+ /* @__PURE__ */ jsx(
260
+ Box,
261
+ {
262
+ style: {
263
+ position: "relative",
264
+ flex: 1,
265
+ height: TIMELINE_CONSTANTS.BAR_HEIGHT,
266
+ marginLeft: 12,
267
+ marginRight: 16
268
+ // Right margin to match grid padding
269
+ },
270
+ children: bars.map((bar, idx) => {
271
+ const isSelected = bar.nodeId !== void 0 && bar.nodeId === selectedNodeId;
272
+ return /* @__PURE__ */ jsx(
273
+ TimelineBar,
274
+ {
275
+ ...bar,
276
+ executionStart,
277
+ executionEnd,
278
+ isSelected,
279
+ hasSelection
280
+ },
281
+ idx
282
+ );
283
+ })
284
+ }
285
+ )
286
+ ]
287
+ }
288
+ );
289
+ }
290
+ var VisualizerContainer = ({ children, handleContainerClick, height }) => {
291
+ const containerHeight = height ?? CONTAINER_CONSTANTS.CONTAINER_HEIGHT;
292
+ return /* @__PURE__ */ jsx(
293
+ Box,
294
+ {
295
+ bg: "var(--color-background)",
296
+ onClick: handleContainerClick,
297
+ style: {
298
+ // borderBottom: '1px solid var(--color-border)',
299
+ // borderRadius: 'var(--mantine-radius-default)'
300
+ },
301
+ children: /* @__PURE__ */ jsx(
302
+ "div",
303
+ {
304
+ style: {
305
+ width: "100%",
306
+ height: `${containerHeight}px`,
307
+ overflow: "hidden"
308
+ },
309
+ children
310
+ }
311
+ )
312
+ }
313
+ );
314
+ };
315
+ var EmptyVisualizer = ({ message = "Select an execution to view timeline" }) => {
316
+ return /* @__PURE__ */ jsx(
317
+ Box,
318
+ {
319
+ h: CONTAINER_CONSTANTS.CONTAINER_HEIGHT,
320
+ bg: "var(--color-background)",
321
+ style: {
322
+ borderBottom: "1px solid var(--color-border)",
323
+ borderRadius: "var(--mantine-radius-default)",
324
+ display: "flex",
325
+ alignItems: "center",
326
+ justifyContent: "center"
327
+ },
328
+ children: /* @__PURE__ */ jsx(Text, { size: "sm", c: "dimmed", children: message })
329
+ }
330
+ );
331
+ };
332
+ var DOMAIN_COLORS = {
333
+ primary: "var(--color-primary)",
334
+ agent: "#8b5cf6",
335
+ workflow: "#3b82f6",
336
+ trigger: "#f97316",
337
+ integration: "#14b8a6",
338
+ approval: "#f59e0b"
339
+ };
340
+ function fill(color, isDark) {
341
+ return isDark ? `color-mix(in srgb, ${color} 80%, black)` : `color-mix(in srgb, ${color} 60%, white)`;
342
+ }
343
+ function glow(color) {
344
+ return `color-mix(in srgb, ${color} 40%, transparent)`;
345
+ }
346
+ function useGraphTheme() {
347
+ const isDark = useComputedColorScheme("dark") === "dark";
348
+ return useMemo(
349
+ () => ({
350
+ primary: fill(DOMAIN_COLORS.primary, isDark),
351
+ primaryGlow: glow(DOMAIN_COLORS.primary),
352
+ agent: fill(DOMAIN_COLORS.agent, isDark),
353
+ workflow: fill(DOMAIN_COLORS.workflow, isDark),
354
+ trigger: fill(DOMAIN_COLORS.trigger, isDark),
355
+ integration: fill(DOMAIN_COLORS.integration, isDark),
356
+ approval: fill(DOMAIN_COLORS.approval, isDark),
357
+ agentGlow: glow(DOMAIN_COLORS.agent),
358
+ workflowGlow: glow(DOMAIN_COLORS.workflow),
359
+ triggerGlow: glow(DOMAIN_COLORS.trigger),
360
+ integrationGlow: glow(DOMAIN_COLORS.integration),
361
+ approvalGlow: glow(DOMAIN_COLORS.approval),
362
+ edgeTriggers: fill(DOMAIN_COLORS.workflow, isDark),
363
+ edgeUses: fill(DOMAIN_COLORS.integration, isDark),
364
+ edgeApproval: fill(DOMAIN_COLORS.approval, isDark),
365
+ edgeTriggersGlow: glow(DOMAIN_COLORS.workflow),
366
+ edgeUsesGlow: glow(DOMAIN_COLORS.integration),
367
+ edgeApprovalGlow: glow(DOMAIN_COLORS.approval)
368
+ }),
369
+ [isDark]
370
+ );
371
+ }
372
+ function getGraphBackgroundStyles(isDark) {
373
+ const pct = isDark ? 5 : 3;
374
+ const glowPct = isDark ? 8 : 5;
375
+ const mix = (percent) => `color-mix(in srgb, var(--color-primary) ${percent}%, transparent)`;
376
+ return {
377
+ backgroundImage: `
378
+ linear-gradient(${mix(pct)} 1px, transparent 1px),
379
+ linear-gradient(90deg, ${mix(pct)} 1px, transparent 1px),
380
+ radial-gradient(ellipse at 50% 50%, ${mix(glowPct)} 0%, transparent 70%)
381
+ `,
382
+ backgroundColor: "color-mix(in srgb, var(--color-background) 50%, var(--glass-background))",
383
+ backdropFilter: "var(--glass-blur)",
384
+ backgroundSize: "40px 40px, 40px 40px, 100% 100%"
385
+ };
386
+ }
387
+ function useGraphBackgroundStyles() {
388
+ const isDark = useComputedColorScheme("dark") === "dark";
389
+ return useMemo(() => getGraphBackgroundStyles(isDark), [isDark]);
390
+ }
391
+ function GraphContainer({ children, height = 600 }) {
392
+ const backgroundStyles = useGraphBackgroundStyles();
393
+ return /* @__PURE__ */ jsx(
394
+ Box,
395
+ {
396
+ style: {
397
+ width: "100%",
398
+ height,
399
+ border: "1px solid var(--color-border)",
400
+ borderRadius: "var(--mantine-radius-md)",
401
+ overflow: "hidden",
402
+ position: "relative",
403
+ ...backgroundStyles
404
+ },
405
+ children
406
+ }
407
+ );
408
+ }
409
+ function GraphBackground() {
410
+ return null;
411
+ }
412
+ function LegendDot({ color }) {
413
+ return /* @__PURE__ */ jsx(
414
+ Box,
415
+ {
416
+ style: {
417
+ width: 10,
418
+ height: 10,
419
+ borderRadius: "50%",
420
+ backgroundColor: `var(--mantine-color-${color}-5)`
421
+ }
422
+ }
423
+ );
424
+ }
425
+ function LegendLine({ color }) {
426
+ return /* @__PURE__ */ jsx(
427
+ Box,
428
+ {
429
+ style: {
430
+ width: 20,
431
+ height: 3,
432
+ borderRadius: 2,
433
+ background: `linear-gradient(90deg, var(--mantine-color-${color}-5), var(--mantine-color-${color}-6))`
434
+ }
435
+ }
436
+ );
437
+ }
438
+ function GraphLegend({ title = "Legend", items, position = "bottom-right" }) {
439
+ const margins = {
440
+ marginBottom: position.includes("bottom") ? 12 : void 0,
441
+ marginTop: position.includes("top") ? 12 : void 0,
442
+ marginRight: position.includes("right") ? 60 : 12,
443
+ marginLeft: position.includes("left") ? 12 : void 0
444
+ };
445
+ return /* @__PURE__ */ jsx(Panel, { position, style: margins, children: /* @__PURE__ */ jsx(
446
+ Card,
447
+ {
448
+ p: "xs",
449
+ className: Graph_module_css_default.legend,
450
+ style: {
451
+ backgroundColor: "var(--glass-background)"
452
+ },
453
+ children: /* @__PURE__ */ jsxs(Group, { children: [
454
+ /* @__PURE__ */ jsx(
455
+ Text,
456
+ {
457
+ size: "xs",
458
+ fw: 600,
459
+ style: {
460
+ letterSpacing: "0.5px",
461
+ textTransform: "uppercase",
462
+ fontFamily: "var(--mantine-font-family-headings)"
463
+ },
464
+ children: title
465
+ }
466
+ ),
467
+ items.map((item) => /* @__PURE__ */ jsxs(Group, { gap: "xs", children: [
468
+ item.type === "line" ? /* @__PURE__ */ jsx(LegendLine, { color: item.color }) : /* @__PURE__ */ jsx(LegendDot, { color: item.color }),
469
+ /* @__PURE__ */ jsx(Text, { size: "xs", children: item.label })
470
+ ] }, item.label))
471
+ ] })
472
+ }
473
+ ) });
474
+ }
475
+ function GraphFitViewButton({ padding = 0.2, variant = "reactflow", duration = 300 }) {
476
+ const { fitView } = useReactFlow();
477
+ const handleFitView = () => {
478
+ fitView({ padding, duration });
479
+ };
480
+ if (variant === "mantine") {
481
+ return /* @__PURE__ */ jsx(
482
+ ActionIcon,
483
+ {
484
+ onClick: handleFitView,
485
+ variant: "default",
486
+ size: "lg",
487
+ title: "Fit view",
488
+ style: {
489
+ position: "absolute",
490
+ bottom: 12,
491
+ right: 12,
492
+ zIndex: 5,
493
+ background: "var(--color-surface)",
494
+ border: "1px solid var(--color-border)"
495
+ },
496
+ children: /* @__PURE__ */ jsx(IconFocus2, { size: 18 })
497
+ }
498
+ );
499
+ }
500
+ return /* @__PURE__ */ jsx(Controls, { position: "bottom-right", showZoom: false, showFitView: false, showInteractive: false, children: /* @__PURE__ */ jsx(
501
+ "button",
502
+ {
503
+ className: "react-flow__controls-button react-flow__controls-fitview",
504
+ onClick: handleFitView,
505
+ title: "Fit view",
506
+ children: /* @__PURE__ */ jsx("svg", { width: "16", height: "16", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx("path", { d: "M8 3H5C3.89 3 3 3.89 3 5V8H5V5H8V3M19 3H16V5H19V8H21V5C21 3.89 20.11 3 19 3M19 19H16V21H19C20.11 21 21 20.11 21 19V16H19V19M5 19H8V21H5C3.89 21 3 20.11 3 19V16H5V19Z" }) })
507
+ }
508
+ ) });
509
+ }
510
+ function GraphFitViewHandler({
511
+ trigger,
512
+ padding = 0.15,
513
+ duration = 300,
514
+ delay = 250
515
+ }) {
516
+ const { fitView } = useReactFlow();
517
+ useEffect(() => {
518
+ if (trigger && trigger > 0) {
519
+ const timeout = setTimeout(() => {
520
+ fitView({ padding, duration });
521
+ }, delay);
522
+ return () => clearTimeout(timeout);
523
+ }
524
+ return void 0;
525
+ }, [trigger, fitView, padding, duration, delay]);
526
+ return null;
527
+ }
528
+ var colorClassMap = {
529
+ violet: Graph_module_css_default.nodeAgent,
530
+ blue: Graph_module_css_default.nodeWorkflow,
531
+ orange: Graph_module_css_default.nodeTrigger,
532
+ teal: Graph_module_css_default.nodeIntegration,
533
+ gray: Graph_module_css_default.nodeExternal,
534
+ yellow: Graph_module_css_default.nodeHuman
535
+ };
536
+ var BaseNode = memo(function BaseNode2({
537
+ children,
538
+ color,
539
+ selected = false,
540
+ highlighted = false,
541
+ width = 220,
542
+ className = "",
543
+ handleDirection = "horizontal",
544
+ showSourceHandle = true,
545
+ showTargetHandle = true
546
+ }) {
547
+ const typeClass = colorClassMap[color] || Graph_module_css_default.nodeAgent;
548
+ const highlightClass = highlighted ? Graph_module_css_default.nodeHighlighted : "";
549
+ const targetPosition = handleDirection === "horizontal" ? Position.Left : Position.Top;
550
+ const sourcePosition = handleDirection === "horizontal" ? Position.Right : Position.Bottom;
551
+ return /* @__PURE__ */ jsxs("div", { className: `${Graph_module_css_default.node} ${typeClass} ${highlightClass} ${className}`, children: [
552
+ showTargetHandle && /* @__PURE__ */ jsx(Handle, { type: "target", position: targetPosition, style: { opacity: 0, pointerEvents: "none" } }),
553
+ showSourceHandle && /* @__PURE__ */ jsx(Handle, { type: "source", position: sourcePosition, style: { opacity: 0, pointerEvents: "none" } }),
554
+ /* @__PURE__ */ jsx(
555
+ Paper,
556
+ {
557
+ p: "sm",
558
+ className: `${Graph_module_css_default.nodeCard} ${selected ? Graph_module_css_default.nodeCardSelected : ""}`,
559
+ style: {
560
+ width,
561
+ border: `1px solid ${selected ? `var(--mantine-color-${color}-5)` : "var(--color-border)"}`,
562
+ backgroundColor: "var(--color-surface)",
563
+ cursor: "pointer",
564
+ boxShadow: selected ? `0 0 15px var(--mantine-color-${color}-5), 0 4px 12px rgba(0,0,0,0.1)` : "0 2px 8px rgba(0,0,0,0.08)"
565
+ },
566
+ children
567
+ }
568
+ )
569
+ ] });
570
+ });
571
+ var BaseEdge = memo(function BaseEdge2({
572
+ id,
573
+ sourceX,
574
+ sourceY,
575
+ targetX,
576
+ targetY,
577
+ sourcePosition,
578
+ targetPosition,
579
+ color,
580
+ glowColor,
581
+ label,
582
+ selected,
583
+ animated = true,
584
+ dimmed = false,
585
+ edgeIndex = 0,
586
+ totalEdges = 1
587
+ }) {
588
+ const edgeSpacing = 10;
589
+ const baseOffset = 15;
590
+ const offsetAmount = totalEdges > 1 ? (edgeIndex - (totalEdges - 1) / 2) * edgeSpacing : 0;
591
+ const [edgePath, labelX, labelY] = getSmoothStepPath({
592
+ sourceX,
593
+ sourceY: sourceY + offsetAmount,
594
+ sourcePosition,
595
+ targetX,
596
+ targetY: targetY + offsetAmount,
597
+ targetPosition,
598
+ borderRadius: 8,
599
+ offset: baseOffset + Math.abs(offsetAmount)
600
+ // Stagger the turn points horizontally
601
+ });
602
+ const edgeOpacity = dimmed ? 0.25 : 1;
603
+ return /* @__PURE__ */ jsxs("g", { style: { opacity: edgeOpacity }, children: [
604
+ /* @__PURE__ */ jsx(
605
+ "path",
606
+ {
607
+ d: edgePath,
608
+ fill: "none",
609
+ stroke: color,
610
+ strokeWidth: selected ? 8 : 6,
611
+ strokeOpacity: 0.2,
612
+ style: { filter: "blur(4px)" }
613
+ }
614
+ ),
615
+ animated && !dimmed && /* @__PURE__ */ jsx(
616
+ "path",
617
+ {
618
+ d: edgePath,
619
+ fill: "none",
620
+ stroke: color,
621
+ strokeWidth: selected ? 4 : 3,
622
+ strokeOpacity: 0.3,
623
+ strokeDasharray: "12 6",
624
+ className: Graph_module_css_default.edgeAnimated,
625
+ style: { filter: `drop-shadow(0 0 3px ${glowColor})` }
626
+ }
627
+ ),
628
+ /* @__PURE__ */ jsx(
629
+ BaseEdge$1,
630
+ {
631
+ id,
632
+ path: edgePath,
633
+ style: {
634
+ stroke: color,
635
+ strokeWidth: selected ? 3 : 2,
636
+ filter: dimmed ? "none" : selected ? `drop-shadow(0 0 6px ${glowColor})` : `drop-shadow(0 0 2px ${glowColor})`
637
+ }
638
+ }
639
+ ),
640
+ animated && !dimmed && /* @__PURE__ */ jsx(
641
+ "path",
642
+ {
643
+ d: edgePath,
644
+ fill: "none",
645
+ stroke: "white",
646
+ strokeWidth: 2,
647
+ strokeOpacity: 0.6,
648
+ strokeDasharray: "4 20",
649
+ className: Graph_module_css_default.edgeAnimated,
650
+ style: { filter: "drop-shadow(0 0 2px white)" }
651
+ }
652
+ ),
653
+ label && /* @__PURE__ */ jsx(EdgeLabelRenderer, { children: /* @__PURE__ */ jsx(
654
+ "div",
655
+ {
656
+ className: `${Graph_module_css_default.edgeLabel} ${dimmed ? Graph_module_css_default.edgeLabelDimmed : ""}`,
657
+ style: {
658
+ position: "absolute",
659
+ transform: `translate(-50%, -50%) translate(${labelX}px, ${labelY}px)`,
660
+ pointerEvents: "all",
661
+ fontSize: 10,
662
+ fontWeight: 600,
663
+ textTransform: "uppercase",
664
+ letterSpacing: "0.5px",
665
+ padding: "3px 8px",
666
+ borderRadius: 6,
667
+ background: `linear-gradient(135deg, ${color}, ${color}dd)`,
668
+ color: "var(--color-text)",
669
+ boxShadow: "0 2px 8px rgba(0,0,0,0.2)",
670
+ opacity: dimmed ? 0.25 : 1
671
+ },
672
+ children: label
673
+ }
674
+ ) })
675
+ ] });
676
+ });
677
+ var UnifiedWorkflowNode = memo(function UnifiedWorkflowNode2({ data }) {
678
+ const selected = data.isSelected ?? false;
679
+ const primaryColor = data.isEntryPoint ? "teal" : data.isEndNode ? "violet" : data.isConditional ? "orange" : "blue";
680
+ const statusColors = data.executionStatus ? STATUS_COLORS[data.executionStatus] : void 0;
681
+ const showExecutionStatus = data.isExecuted && data.executionStatus;
682
+ return /* @__PURE__ */ jsx(
683
+ BaseNode,
684
+ {
685
+ color: primaryColor,
686
+ selected,
687
+ highlighted: Boolean(data.highlighted),
688
+ width: 220,
689
+ className: data.isDimmed ? "dimmed-node" : "",
690
+ showSourceHandle: !data.isEndNode,
691
+ children: /* @__PURE__ */ jsx("div", { style: { opacity: data.isDimmed ? 0.3 : 1 }, children: /* @__PURE__ */ jsxs(Stack, { gap: 6, children: [
692
+ /* @__PURE__ */ jsx(Text, { size: "sm", fw: 500, lineClamp: 1, style: { fontFamily: "var(--mantine-font-family-headings)" }, children: data.name }),
693
+ /* @__PURE__ */ jsxs(Group, { gap: "xs", children: [
694
+ data.isEntryPoint && /* @__PURE__ */ jsx(Badge, { size: "xs", variant: "light", color: "teal", leftSection: /* @__PURE__ */ jsx(IconPlayerPlay, { size: 10 }), children: "Entry" }),
695
+ data.isEndNode && /* @__PURE__ */ jsx(Badge, { size: "xs", variant: "light", color: "violet", leftSection: /* @__PURE__ */ jsx(IconPlayerStop, { size: 10 }), children: "End" }),
696
+ data.isConditional && /* @__PURE__ */ jsxs(Badge, { size: "xs", variant: "light", color: "orange", leftSection: /* @__PURE__ */ jsx(IconArrowsSplit, { size: 10 }), children: [
697
+ data.routeCount,
698
+ " routes"
699
+ ] }),
700
+ !data.isEntryPoint && !data.isEndNode && !data.isConditional && /* @__PURE__ */ jsx(Badge, { size: "xs", variant: "light", leftSection: /* @__PURE__ */ jsx(IconSquare, { size: 10 }), children: "Step" }),
701
+ /* @__PURE__ */ jsx(Text, { size: "xs", ff: "monospace", c: "dimmed", truncate: true, children: data.id })
702
+ ] }),
703
+ !data.isDimmed && data.description && /* @__PURE__ */ jsx(Text, { size: "xs", c: "dimmed", lineClamp: 2, children: data.description }),
704
+ showExecutionStatus && statusColors && /* @__PURE__ */ jsx(Box, { mt: 4, children: /* @__PURE__ */ jsxs(Group, { gap: 8, align: "center", children: [
705
+ /* @__PURE__ */ jsx(Box, { children: getStatusIcon({
706
+ status: data.executionStatus,
707
+ colors: { icon: statusColors.color },
708
+ iconSize: 16,
709
+ spinDuration: "1s"
710
+ }) }),
711
+ /* @__PURE__ */ jsx(Badge, { size: "xs", variant: "light", color: statusColors.badge, children: data.executionStatus }),
712
+ data.duration !== void 0 && /* @__PURE__ */ jsx(Text, { size: "xs", c: "dimmed", children: formatDuration(data.duration) })
713
+ ] }) })
714
+ ] }) })
715
+ }
716
+ );
717
+ });
718
+ var UnifiedWorkflowEdge = memo(function UnifiedWorkflowEdge2({
719
+ id,
720
+ sourceX,
721
+ sourceY,
722
+ targetX,
723
+ targetY,
724
+ selected,
725
+ data
726
+ }) {
727
+ const colors = useGraphTheme();
728
+ const edgeType = data?.edgeType || "linear";
729
+ const isDimmed = data?.isDimmed ?? false;
730
+ const isAnimated = data?.isAnimated ?? false;
731
+ let edgeColor;
732
+ let glowColor;
733
+ let label;
734
+ switch (edgeType) {
735
+ case "conditional":
736
+ edgeColor = colors.trigger;
737
+ glowColor = colors.triggerGlow;
738
+ label = data?.label || "route";
739
+ break;
740
+ case "default":
741
+ edgeColor = colors.integration;
742
+ glowColor = colors.integrationGlow;
743
+ label = data?.label || "default";
744
+ break;
745
+ case "linear":
746
+ default:
747
+ edgeColor = colors.workflow;
748
+ glowColor = colors.workflowGlow;
749
+ label = void 0;
750
+ break;
751
+ }
752
+ return /* @__PURE__ */ jsx(
753
+ BaseEdge,
754
+ {
755
+ id,
756
+ sourceX,
757
+ sourceY,
758
+ targetX,
759
+ targetY,
760
+ sourcePosition: Position.Right,
761
+ targetPosition: Position.Left,
762
+ color: edgeColor,
763
+ glowColor,
764
+ label,
765
+ selected,
766
+ animated: isAnimated,
767
+ dimmed: isDimmed
768
+ }
769
+ );
770
+ });
771
+ var nodeTypes = {
772
+ unifiedWorkflowNode: UnifiedWorkflowNode
773
+ };
774
+ var edgeTypes = {
775
+ unifiedWorkflowEdge: UnifiedWorkflowEdge
776
+ };
777
+ var NODE_LEGEND_ITEMS = [
778
+ { color: "teal", label: "Entry" },
779
+ { color: "blue", label: "Step" },
780
+ { color: "orange", label: "Conditional" },
781
+ { color: "violet", label: "End" }
782
+ ];
783
+ var EDGE_LEGEND_ITEMS = [
784
+ { color: "blue", label: "Next", type: "line" },
785
+ { color: "orange", label: "Route", type: "line" },
786
+ { color: "teal", label: "Default", type: "line" }
787
+ ];
788
+ function UnifiedWorkflowGraph({
789
+ resourceDefinition,
790
+ executionLogs,
791
+ selectedStepId,
792
+ onStepSelect,
793
+ fitViewTrigger: externalFitViewTrigger
794
+ }) {
795
+ const hasExecutionData = executionLogs && executionLogs.length > 0;
796
+ const [mode, setMode] = useState(hasExecutionData ? "execution" : "definition");
797
+ useEffect(() => {
798
+ setMode(hasExecutionData ? "execution" : "definition");
799
+ }, [hasExecutionData]);
800
+ const isDefinitionMode = mode === "definition";
801
+ const executionPath = useExecutionPath(
802
+ isDefinitionMode ? void 0 : executionLogs,
803
+ isDefinitionMode ? void 0 : resourceDefinition
804
+ );
805
+ const workflowInput = useMemo(
806
+ () => resourceDefinition ? { entryPoint: resourceDefinition.entryPoint, steps: resourceDefinition.steps } : void 0,
807
+ [resourceDefinition]
808
+ );
809
+ const {
810
+ nodes: layoutNodes,
811
+ edges: layoutEdges,
812
+ graphHeight
813
+ } = useUnifiedWorkflowLayout(workflowInput, executionPath, isDefinitionMode ? null : selectedStepId, mode);
814
+ const {
815
+ nodes: highlightedNodes,
816
+ edges: highlightedEdges,
817
+ handleNodeMouseEnter,
818
+ handleNodeMouseLeave
819
+ } = useDirectedChainHighlighting(layoutNodes, layoutEdges);
820
+ const nodes = isDefinitionMode ? highlightedNodes : layoutNodes;
821
+ const edges = isDefinitionMode ? highlightedEdges : layoutEdges;
822
+ const [internalFitViewTrigger, setInternalFitViewTrigger] = useState(0);
823
+ const executedStepsCount = executionPath?.executedSteps.size ?? 0;
824
+ const nodesCount = nodes.length;
825
+ useEffect(() => {
826
+ if (nodesCount > 0) {
827
+ setInternalFitViewTrigger((prev) => prev + 1);
828
+ }
829
+ }, [nodesCount, executedStepsCount]);
830
+ const fitViewTrigger = (externalFitViewTrigger ?? 0) + internalFitViewTrigger;
831
+ const { handleNodeClick, handlePaneClick, handleContainerClick } = useNodeSelection(
832
+ selectedStepId || null,
833
+ onStepSelect || (() => {
834
+ })
835
+ );
836
+ if (!resourceDefinition || !resourceDefinition.steps.length) {
837
+ return /* @__PURE__ */ jsx(EmptyVisualizer, {});
838
+ }
839
+ return /* @__PURE__ */ jsx(
840
+ VisualizerContainer,
841
+ {
842
+ handleContainerClick: isDefinitionMode ? void 0 : handleContainerClick,
843
+ height: graphHeight,
844
+ children: /* @__PURE__ */ jsx(ReactFlowProvider, { children: /* @__PURE__ */ jsxs(
845
+ ReactFlow,
846
+ {
847
+ nodes,
848
+ edges,
849
+ nodeTypes,
850
+ edgeTypes,
851
+ onNodeClick: isDefinitionMode ? void 0 : handleNodeClick,
852
+ onPaneClick: isDefinitionMode ? void 0 : handlePaneClick,
853
+ onNodeMouseEnter: isDefinitionMode ? handleNodeMouseEnter : void 0,
854
+ onNodeMouseLeave: isDefinitionMode ? handleNodeMouseLeave : void 0,
855
+ fitView: true,
856
+ fitViewOptions: {
857
+ padding: WORKFLOW_CONSTANTS.FIT_VIEW_PADDING
858
+ },
859
+ proOptions: { hideAttribution: true },
860
+ minZoom: WORKFLOW_CONSTANTS.MIN_ZOOM,
861
+ maxZoom: WORKFLOW_CONSTANTS.MAX_ZOOM,
862
+ defaultViewport: { x: 0, y: 0, zoom: 1 },
863
+ nodesDraggable: false,
864
+ nodesConnectable: false,
865
+ elementsSelectable: !isDefinitionMode,
866
+ selectNodesOnDrag: false,
867
+ zoomOnScroll: true,
868
+ panOnDrag: true,
869
+ className: Graph_module_css_default.graphContainer,
870
+ children: [
871
+ /* @__PURE__ */ jsx(GraphBackground, {}),
872
+ /* @__PURE__ */ jsx(Panel, { position: "top-right", style: { marginTop: 12, marginRight: 12 }, children: /* @__PURE__ */ jsx(
873
+ SegmentedControl,
874
+ {
875
+ size: "xs",
876
+ value: mode,
877
+ onChange: (value) => setMode(value),
878
+ data: [
879
+ { label: "Definition", value: "definition" },
880
+ { label: "Execution", value: "execution" }
881
+ ],
882
+ styles: {
883
+ root: {
884
+ backgroundColor: "var(--color-surface)",
885
+ border: "1px solid var(--color-border)"
886
+ }
887
+ }
888
+ }
889
+ ) }),
890
+ /* @__PURE__ */ jsx(GraphLegend, { title: "Legend", items: NODE_LEGEND_ITEMS, position: "bottom-right" }),
891
+ /* @__PURE__ */ jsx(GraphLegend, { title: "Flow", items: EDGE_LEGEND_ITEMS, position: "bottom-left" }),
892
+ /* @__PURE__ */ jsx(GraphFitViewButton, { padding: WORKFLOW_CONSTANTS.FIT_VIEW_PADDING, variant: "mantine" }),
893
+ /* @__PURE__ */ jsx(GraphFitViewHandler, { trigger: fitViewTrigger, padding: WORKFLOW_CONSTANTS.FIT_VIEW_PADDING })
894
+ ]
895
+ }
896
+ ) })
897
+ }
898
+ );
899
+ }
900
+ function WorkflowExecutionTimeline({ timelineData, selectedStepId }) {
901
+ const { steps } = timelineData;
902
+ const executionStart = steps[0]?.startTime || 0;
903
+ const executionEnd = steps[steps.length - 1]?.endTime || executionStart;
904
+ return /* @__PURE__ */ jsx(TimelineContainer, { executionStart, executionEnd, children: steps.map(
905
+ (step) => step.startTime && step.endTime && /* @__PURE__ */ jsx(
906
+ TimelineRow,
907
+ {
908
+ label: step.stepName,
909
+ bars: [
910
+ {
911
+ startTime: step.startTime,
912
+ endTime: step.endTime,
913
+ status: step.status,
914
+ nodeId: step.stepId
915
+ }
916
+ ],
917
+ executionStart,
918
+ executionEnd,
919
+ selectedNodeId: selectedStepId
920
+ },
921
+ step.stepId
922
+ )
923
+ ) });
924
+ }
925
+ var statusColorMap = {
926
+ running: "blue",
927
+ completed: "teal",
928
+ failed: "orange",
929
+ pending: "violet",
930
+ warning: "yellow"
931
+ };
932
+ var AgentIterationNode = memo(function AgentIterationNode2({ data, selected }) {
933
+ const { nodeType, label, iterationNumber, status, reasoningCount, actionCount, duration, isLive } = data;
934
+ const colors = getStatusColors(status);
935
+ const nodeColor = statusColorMap[status];
936
+ return /* @__PURE__ */ jsxs(BaseNode, { color: nodeColor, selected, width: AGENT_CONSTANTS.NODE_WIDTH, children: [
937
+ /* @__PURE__ */ jsxs(Box, { style: { display: "flex", flexDirection: "column", alignItems: "center" }, children: [
938
+ /* @__PURE__ */ jsx(
939
+ Box,
940
+ {
941
+ style: {
942
+ width: AGENT_CONSTANTS.CIRCLE_SIZE,
943
+ height: AGENT_CONSTANTS.CIRCLE_SIZE,
944
+ borderRadius: "50%",
945
+ backgroundColor: "var(--color-surface)",
946
+ border: `2px solid ${colors.color}`,
947
+ display: "flex",
948
+ alignItems: "center",
949
+ justifyContent: "center"
950
+ },
951
+ children: getStatusIcon({
952
+ status,
953
+ colors: { icon: colors.color },
954
+ iconSize: AGENT_CONSTANTS.STATUS_ICON_SIZE,
955
+ spinDuration: "1s"
956
+ })
957
+ }
958
+ ),
959
+ /* @__PURE__ */ jsx(
960
+ Text,
961
+ {
962
+ size: "sm",
963
+ fw: status === "running" ? 500 : 400,
964
+ ta: "center",
965
+ mt: 4,
966
+ style: { maxWidth: 150, fontFamily: "var(--mantine-font-family-headings)" },
967
+ children: nodeType === "iteration" ? `Iteration ${iterationNumber}` : label
968
+ }
969
+ ),
970
+ /* @__PURE__ */ jsx(Badge, { size: "xs", variant: "light", color: colors.badge, mt: 4, children: status.toUpperCase() }),
971
+ /* @__PURE__ */ jsxs(Stack, { gap: 2, mt: 2, align: "center", children: [
972
+ nodeType === "iteration" && reasoningCount !== void 0 && reasoningCount > 0 && /* @__PURE__ */ jsxs(Text, { size: "xs", c: "dimmed", children: [
973
+ reasoningCount,
974
+ " reasoning"
975
+ ] }),
976
+ nodeType === "iteration" && actionCount !== void 0 && actionCount > 0 && /* @__PURE__ */ jsxs(Text, { size: "xs", c: "dimmed", children: [
977
+ actionCount,
978
+ " ",
979
+ actionCount === 1 ? "action" : "actions"
980
+ ] }),
981
+ duration !== void 0 && /* @__PURE__ */ jsx(Text, { size: "xs", c: "dimmed", children: formatDuration(duration) })
982
+ ] })
983
+ ] }),
984
+ isLive && /* @__PURE__ */ jsx(
985
+ Badge,
986
+ {
987
+ size: "xs",
988
+ variant: "filled",
989
+ style: {
990
+ position: "absolute",
991
+ top: 4,
992
+ right: 4
993
+ },
994
+ children: /* @__PURE__ */ jsx("span", { className: Graph_module_css_default.livePulse, children: "LIVE" })
995
+ }
996
+ )
997
+ ] });
998
+ });
999
+ var statusEdgeColors = {
1000
+ running: {
1001
+ color: "var(--mantine-color-blue-5)",
1002
+ glow: "rgba(59, 130, 246, 0.5)"
1003
+ },
1004
+ completed: {
1005
+ color: "var(--mantine-color-teal-5)",
1006
+ glow: "rgba(20, 184, 166, 0.5)"
1007
+ },
1008
+ failed: {
1009
+ color: "var(--mantine-color-orange-5)",
1010
+ glow: "rgba(249, 115, 22, 0.5)"
1011
+ },
1012
+ pending: {
1013
+ color: "var(--mantine-color-gray-5)",
1014
+ glow: "rgba(156, 163, 175, 0.3)"
1015
+ },
1016
+ warning: {
1017
+ color: "var(--mantine-color-yellow-5)",
1018
+ glow: "rgba(234, 179, 8, 0.5)"
1019
+ }
1020
+ };
1021
+ var AgentIterationEdge = memo(function AgentIterationEdge2({
1022
+ id,
1023
+ sourceX,
1024
+ sourceY,
1025
+ targetX,
1026
+ targetY,
1027
+ data,
1028
+ selected
1029
+ }) {
1030
+ const edgeData = data;
1031
+ const sourceStatus = edgeData?.sourceStatus || "pending";
1032
+ const targetStatus = edgeData?.targetStatus || "pending";
1033
+ const edgeColors = statusEdgeColors[sourceStatus];
1034
+ const isAnimated = shouldAnimateEdge(sourceStatus, targetStatus);
1035
+ return /* @__PURE__ */ jsx(
1036
+ BaseEdge,
1037
+ {
1038
+ id,
1039
+ sourceX,
1040
+ sourceY,
1041
+ targetX,
1042
+ targetY,
1043
+ sourcePosition: Position.Right,
1044
+ targetPosition: Position.Left,
1045
+ color: edgeColors.color,
1046
+ glowColor: edgeColors.glow,
1047
+ animated: isAnimated,
1048
+ selected
1049
+ }
1050
+ );
1051
+ });
1052
+ var nodeTypes2 = {
1053
+ agentIteration: AgentIterationNode
1054
+ };
1055
+ var edgeTypes2 = {
1056
+ agentIteration: AgentIterationEdge
1057
+ };
1058
+ function AgentExecutionVisualizer({
1059
+ resourceDefinition,
1060
+ iterationData,
1061
+ selectedExecutionId,
1062
+ liveExecutions,
1063
+ selectedIterationId,
1064
+ onIterationSelect
1065
+ }) {
1066
+ const { nodes, edges } = useReactFlowAgent(
1067
+ iterationData,
1068
+ resourceDefinition,
1069
+ selectedIterationId,
1070
+ liveExecutions,
1071
+ selectedExecutionId
1072
+ );
1073
+ const fitViewTrigger = useFitViewTrigger(iterationData, nodes);
1074
+ const handleIterationSelect = useCallback(
1075
+ (id) => {
1076
+ onIterationSelect(id);
1077
+ },
1078
+ [onIterationSelect]
1079
+ );
1080
+ const { handlePaneClick, handleContainerClick } = useNodeSelection(selectedIterationId, handleIterationSelect);
1081
+ const handleNodeClick = useCallback(
1082
+ (_event, node) => {
1083
+ if (node.id === "initialization" || node.id === "completion") {
1084
+ handleIterationSelect(selectedIterationId === node.id ? null : node.id);
1085
+ return;
1086
+ }
1087
+ const iterationNumber = Number.parseInt(node.id.replace("iteration-", ""), 10);
1088
+ if (!Number.isNaN(iterationNumber)) {
1089
+ handleIterationSelect(iterationNumber === selectedIterationId ? null : iterationNumber);
1090
+ }
1091
+ },
1092
+ [selectedIterationId, handleIterationSelect]
1093
+ );
1094
+ if (!iterationData || nodes.length === 0) {
1095
+ return /* @__PURE__ */ jsx(EmptyVisualizer, {});
1096
+ }
1097
+ return /* @__PURE__ */ jsx(VisualizerContainer, { handleContainerClick, children: /* @__PURE__ */ jsx(ReactFlowProvider, { children: /* @__PURE__ */ jsxs(
1098
+ ReactFlow,
1099
+ {
1100
+ nodes,
1101
+ edges,
1102
+ nodeTypes: nodeTypes2,
1103
+ edgeTypes: edgeTypes2,
1104
+ onNodeClick: handleNodeClick,
1105
+ onPaneClick: handlePaneClick,
1106
+ fitView: true,
1107
+ fitViewOptions: {
1108
+ padding: AGENT_CONSTANTS.FIT_VIEW_PADDING
1109
+ },
1110
+ proOptions: { hideAttribution: true },
1111
+ minZoom: AGENT_CONSTANTS.MIN_ZOOM,
1112
+ maxZoom: AGENT_CONSTANTS.MAX_ZOOM,
1113
+ nodesDraggable: false,
1114
+ nodesConnectable: false,
1115
+ elementsSelectable: true,
1116
+ selectNodesOnDrag: false,
1117
+ zoomOnScroll: false,
1118
+ panOnDrag: false,
1119
+ className: Graph_module_css_default.graphContainer,
1120
+ children: [
1121
+ /* @__PURE__ */ jsx(GraphBackground, {}),
1122
+ /* @__PURE__ */ jsx(GraphFitViewButton, { padding: AGENT_CONSTANTS.FIT_VIEW_PADDING, variant: "mantine", duration: 300 }),
1123
+ /* @__PURE__ */ jsx(GraphFitViewHandler, { trigger: fitViewTrigger, padding: AGENT_CONSTANTS.FIT_VIEW_PADDING })
1124
+ ]
1125
+ }
1126
+ ) }) });
1127
+ }
1128
+ function AgentExecutionTimeline({ iterationData, selectedIterationId }) {
1129
+ const { initialization, iterations, completion } = iterationData;
1130
+ const executionStart = initialization.startTime;
1131
+ const executionEnd = completion.endTime;
1132
+ return /* @__PURE__ */ jsxs(TimelineContainer, { executionStart, executionEnd, children: [
1133
+ initialization.startTime && initialization.endTime && /* @__PURE__ */ jsx(
1134
+ TimelineRow,
1135
+ {
1136
+ label: `Initialization (${formatDuration(initialization.duration || 0)})`,
1137
+ bars: [
1138
+ {
1139
+ startTime: initialization.startTime,
1140
+ endTime: initialization.endTime,
1141
+ status: initialization.status,
1142
+ nodeId: "initialization"
1143
+ }
1144
+ ],
1145
+ executionStart,
1146
+ executionEnd,
1147
+ selectedNodeId: selectedIterationId
1148
+ }
1149
+ ),
1150
+ iterations.map((iteration) => /* @__PURE__ */ jsxs(Fragment, { children: [
1151
+ iteration.startTime && iteration.endTime && /* @__PURE__ */ jsx(
1152
+ TimelineRow,
1153
+ {
1154
+ label: `Iteration ${iteration.iterationNumber} (${formatDuration(iteration.duration || 0)})`,
1155
+ bars: [
1156
+ {
1157
+ startTime: iteration.startTime,
1158
+ endTime: iteration.endTime,
1159
+ status: iteration.status,
1160
+ nodeId: iteration.iterationNumber
1161
+ }
1162
+ ],
1163
+ executionStart,
1164
+ executionEnd,
1165
+ selectedNodeId: selectedIterationId
1166
+ }
1167
+ ),
1168
+ iteration.subActivities.map((activity, activityIndex) => /* @__PURE__ */ jsx(
1169
+ TimelineRow,
1170
+ {
1171
+ label: `${activity.type} (${formatDuration(activity.duration)})`,
1172
+ bars: [
1173
+ {
1174
+ startTime: activity.startTime,
1175
+ endTime: activity.endTime,
1176
+ status: "completed",
1177
+ nodeId: iteration.iterationNumber
1178
+ }
1179
+ ],
1180
+ executionStart,
1181
+ executionEnd,
1182
+ indent: 1,
1183
+ selectedNodeId: selectedIterationId
1184
+ },
1185
+ `${iteration.iterationNumber}-${activity.type}-${activity.startTime}-${activityIndex}`
1186
+ ))
1187
+ ] }, iteration.iterationNumber)),
1188
+ completion.startTime && completion.endTime && /* @__PURE__ */ jsx(
1189
+ TimelineRow,
1190
+ {
1191
+ label: `Completion (${formatDuration(completion.duration || 0)})`,
1192
+ bars: [
1193
+ {
1194
+ startTime: completion.startTime,
1195
+ endTime: completion.endTime,
1196
+ status: completion.status,
1197
+ nodeId: "completion"
1198
+ }
1199
+ ],
1200
+ executionStart,
1201
+ executionEnd,
1202
+ selectedNodeId: selectedIterationId
1203
+ }
1204
+ )
1205
+ ] });
1206
+ }
1207
+
1208
+ export { AgentExecutionTimeline, AgentExecutionVisualizer, AgentIterationEdge, AgentIterationNode, BaseEdge, BaseNode, EmptyVisualizer, ExecutionStats, ExecutionStatusBadge, GraphBackground, GraphContainer, GraphFitViewButton, GraphFitViewHandler, GraphLegend, TimelineAxis, TimelineBar, TimelineContainer, TimelineRow, UnifiedWorkflowEdge, UnifiedWorkflowGraph, UnifiedWorkflowNode, VisualizerContainer, WorkflowExecutionTimeline, getGraphBackgroundStyles, useGraphBackgroundStyles, useGraphTheme };