@agentmark-ai/ui-components 0.2.0 → 0.3.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 (3) hide show
  1. package/dist/index.js +186 -182
  2. package/dist/index.mjs +81 -77
  3. package/package.json +8 -8
package/dist/index.js CHANGED
@@ -1279,7 +1279,7 @@ var import_material4 = require("@mui/material");
1279
1279
 
1280
1280
  // src/sections/requests/request-table.tsx
1281
1281
  var import_x_data_grid2 = require("@mui/x-data-grid");
1282
- var import_react7 = require("react");
1282
+ var import_react8 = require("react");
1283
1283
 
1284
1284
  // src/components/iconify/iconify.tsx
1285
1285
  var import_react = require("react");
@@ -1373,59 +1373,63 @@ function EmptyContent({
1373
1373
  }
1374
1374
 
1375
1375
  // src/components/datagrid/datagrid.tsx
1376
+ var import_react3 = require("react");
1376
1377
  var import_x_data_grid = require("@mui/x-data-grid");
1377
1378
  var import_jsx_runtime3 = require("react/jsx-runtime");
1379
+ var DataGridToolbar = (0, import_react3.memo)(function DataGridToolbar2() {
1380
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_x_data_grid.Toolbar, { children: [
1381
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_x_data_grid.ColumnsPanelTrigger, { startIcon: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Iconify, { icon: "solar:eye-bold" }), children: "Columns" }),
1382
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_x_data_grid.FilterPanelTrigger, { startIcon: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Iconify, { icon: "solar:filter-bold" }), children: "Filters" })
1383
+ ] });
1384
+ });
1378
1385
  var DataGrid = ({
1379
1386
  t,
1380
1387
  emptyContentImgUrl,
1381
1388
  ...props
1382
1389
  }) => {
1390
+ const slots = (0, import_react3.useMemo)(
1391
+ () => ({
1392
+ toolbar: DataGridToolbar,
1393
+ noRowsOverlay: () => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
1394
+ EmptyContent,
1395
+ {
1396
+ sx: { margin: 2 },
1397
+ title: t("noResults"),
1398
+ imgUrl: emptyContentImgUrl
1399
+ }
1400
+ ),
1401
+ noResultsOverlay: () => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
1402
+ EmptyContent,
1403
+ {
1404
+ title: t("noResults"),
1405
+ sx: { py: 10 },
1406
+ imgUrl: emptyContentImgUrl
1407
+ }
1408
+ )
1409
+ }),
1410
+ [t, emptyContentImgUrl]
1411
+ );
1383
1412
  return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
1384
1413
  import_x_data_grid.DataGrid,
1385
1414
  {
1386
1415
  sx: { "--DataGrid-overlayHeight": "530px" },
1387
1416
  ...props,
1388
- slots: {
1389
- toolbar: () => {
1390
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_x_data_grid.Toolbar, { children: [
1391
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
1392
- import_x_data_grid.ColumnsPanelTrigger,
1393
- {
1394
- startIcon: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Iconify, { icon: "solar:eye-bold" }),
1395
- children: "Columns"
1396
- }
1397
- ),
1398
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
1399
- import_x_data_grid.FilterPanelTrigger,
1400
- {
1401
- startIcon: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Iconify, { icon: "solar:filter-bold" }),
1402
- children: "Filters"
1403
- }
1404
- )
1405
- ] });
1406
- },
1407
- noRowsOverlay: () => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
1408
- EmptyContent,
1409
- {
1410
- sx: { margin: 2 },
1411
- title: t("noResults"),
1412
- imgUrl: emptyContentImgUrl
1413
- }
1414
- ),
1415
- noResultsOverlay: () => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
1416
- EmptyContent,
1417
- {
1418
- title: t("noResults"),
1419
- sx: { py: 10 },
1420
- imgUrl: emptyContentImgUrl
1421
- }
1422
- )
1423
- },
1417
+ slots,
1424
1418
  slotProps: {
1425
1419
  loadingOverlay: {
1426
1420
  sx: {
1427
1421
  padding: 5
1428
1422
  }
1423
+ },
1424
+ filterPanel: {
1425
+ sx: {
1426
+ maxWidth: "100vw"
1427
+ }
1428
+ },
1429
+ columnsPanel: {
1430
+ sx: {
1431
+ maxWidth: "100vw"
1432
+ }
1429
1433
  }
1430
1434
  }
1431
1435
  }
@@ -1433,21 +1437,21 @@ var DataGrid = ({
1433
1437
  };
1434
1438
 
1435
1439
  // src/components/table/use-table.ts
1436
- var import_react3 = require("react");
1440
+ var import_react4 = require("react");
1437
1441
  function useTable(props) {
1438
- const [dense, setDense] = (0, import_react3.useState)(!!props?.defaultDense);
1439
- const [page, setPage] = (0, import_react3.useState)(props?.defaultCurrentPage || 0);
1440
- const [orderBy, setOrderBy] = (0, import_react3.useState)(props?.defaultOrderBy || "name");
1441
- const [rowsPerPage, setRowsPerPage] = (0, import_react3.useState)(
1442
+ const [dense, setDense] = (0, import_react4.useState)(!!props?.defaultDense);
1443
+ const [page, setPage] = (0, import_react4.useState)(props?.defaultCurrentPage || 0);
1444
+ const [orderBy, setOrderBy] = (0, import_react4.useState)(props?.defaultOrderBy || "name");
1445
+ const [rowsPerPage, setRowsPerPage] = (0, import_react4.useState)(
1442
1446
  props?.defaultRowsPerPage || 10
1443
1447
  );
1444
- const [order, setOrder] = (0, import_react3.useState)(
1448
+ const [order, setOrder] = (0, import_react4.useState)(
1445
1449
  props?.defaultOrder || "asc"
1446
1450
  );
1447
- const [selected, setSelected] = (0, import_react3.useState)(
1451
+ const [selected, setSelected] = (0, import_react4.useState)(
1448
1452
  props?.defaultSelected || []
1449
1453
  );
1450
- const onSort = (0, import_react3.useCallback)(
1454
+ const onSort = (0, import_react4.useCallback)(
1451
1455
  (id) => {
1452
1456
  const isAsc = orderBy === id && order === "asc";
1453
1457
  if (id !== "") {
@@ -1457,27 +1461,27 @@ function useTable(props) {
1457
1461
  },
1458
1462
  [order, orderBy]
1459
1463
  );
1460
- const onSelectRow = (0, import_react3.useCallback)(
1464
+ const onSelectRow = (0, import_react4.useCallback)(
1461
1465
  (inputValue) => {
1462
1466
  const newSelected = selected.includes(inputValue) ? selected.filter((value) => value !== inputValue) : [...selected, inputValue];
1463
1467
  setSelected(newSelected);
1464
1468
  },
1465
1469
  [selected]
1466
1470
  );
1467
- const onChangeRowsPerPage = (0, import_react3.useCallback)(
1471
+ const onChangeRowsPerPage = (0, import_react4.useCallback)(
1468
1472
  (event) => {
1469
1473
  setPage(0);
1470
1474
  setRowsPerPage(parseInt(event.target.value, 10));
1471
1475
  },
1472
1476
  []
1473
1477
  );
1474
- const onChangeDense = (0, import_react3.useCallback)(
1478
+ const onChangeDense = (0, import_react4.useCallback)(
1475
1479
  (event) => {
1476
1480
  setDense(event.target.checked);
1477
1481
  },
1478
1482
  []
1479
1483
  );
1480
- const onSelectAllRows = (0, import_react3.useCallback)(
1484
+ const onSelectAllRows = (0, import_react4.useCallback)(
1481
1485
  (checked, inputValue) => {
1482
1486
  if (checked) {
1483
1487
  setSelected(inputValue);
@@ -1487,13 +1491,13 @@ function useTable(props) {
1487
1491
  },
1488
1492
  []
1489
1493
  );
1490
- const onChangePage = (0, import_react3.useCallback)((_event, newPage) => {
1494
+ const onChangePage = (0, import_react4.useCallback)((_event, newPage) => {
1491
1495
  setPage(newPage);
1492
1496
  }, []);
1493
- const onResetPage = (0, import_react3.useCallback)(() => {
1497
+ const onResetPage = (0, import_react4.useCallback)(() => {
1494
1498
  setPage(0);
1495
1499
  }, []);
1496
- const onUpdatePageDeleteRow = (0, import_react3.useCallback)(
1500
+ const onUpdatePageDeleteRow = (0, import_react4.useCallback)(
1497
1501
  (totalRowsInPage) => {
1498
1502
  setSelected([]);
1499
1503
  if (page) {
@@ -1504,7 +1508,7 @@ function useTable(props) {
1504
1508
  },
1505
1509
  [page]
1506
1510
  );
1507
- const onUpdatePageDeleteRows = (0, import_react3.useCallback)(
1511
+ const onUpdatePageDeleteRows = (0, import_react4.useCallback)(
1508
1512
  ({
1509
1513
  totalRows,
1510
1514
  totalRowsInPage,
@@ -1763,7 +1767,7 @@ function TableEmptyRows({ emptyRows, height: height2 }) {
1763
1767
  }
1764
1768
 
1765
1769
  // src/components/label/label.tsx
1766
- var import_react4 = require("react");
1770
+ var import_react5 = require("react");
1767
1771
  var import_Box5 = __toESM(require("@mui/material/Box"));
1768
1772
 
1769
1773
  // src/components/label/styles.ts
@@ -1832,7 +1836,7 @@ var StyledLabel = (0, import_styles2.styled)(import_Box4.default)(({ theme: them
1832
1836
 
1833
1837
  // src/components/label/label.tsx
1834
1838
  var import_jsx_runtime9 = require("react/jsx-runtime");
1835
- var Label = (0, import_react4.forwardRef)(
1839
+ var Label = (0, import_react5.forwardRef)(
1836
1840
  ({
1837
1841
  children,
1838
1842
  color: color2 = "default",
@@ -2154,7 +2158,7 @@ function serializeStyles(args, registered, mergedProps) {
2154
2158
  }
2155
2159
 
2156
2160
  // ../../node_modules/@mui/styled-engine/esm/index.js
2157
- var import_react5 = require("@emotion/react");
2161
+ var import_react6 = require("@emotion/react");
2158
2162
  function styled2(tag, options) {
2159
2163
  const stylesFactory = (0, import_styled.default)(tag, options);
2160
2164
  if (process.env.NODE_ENV !== "production") {
@@ -3478,7 +3482,7 @@ function isObjectEmpty(obj) {
3478
3482
  return Object.keys(obj).length === 0;
3479
3483
  }
3480
3484
  function useTheme(defaultTheme2 = null) {
3481
- const contextTheme = React2.useContext(import_react5.ThemeContext);
3485
+ const contextTheme = React2.useContext(import_react6.ThemeContext);
3482
3486
  return !contextTheme || isObjectEmpty(contextTheme) ? defaultTheme2 : contextTheme;
3483
3487
  }
3484
3488
  var useThemeWithoutDefault_default = useTheme;
@@ -17450,14 +17454,14 @@ var lintExtensions = [
17450
17454
  ];
17451
17455
 
17452
17456
  // src/components/editor/json-editor.tsx
17453
- var import_react6 = require("react");
17457
+ var import_react7 = require("react");
17454
17458
  var import_jsx_runtime18 = require("react/jsx-runtime");
17455
17459
  function JsonEditor({
17456
17460
  defaultValue,
17457
17461
  onChange,
17458
17462
  value
17459
17463
  }) {
17460
- const [linterEnabled, setLinterEnabled] = (0, import_react6.useState)(
17464
+ const [linterEnabled, setLinterEnabled] = (0, import_react7.useState)(
17461
17465
  !!defaultValue && defaultValue !== ""
17462
17466
  );
17463
17467
  const theme2 = useTheme_default();
@@ -17532,7 +17536,7 @@ var RequestTable = ({
17532
17536
  t,
17533
17537
  emptyContentImgUrl
17534
17538
  }) => {
17535
- const tableData = (0, import_react7.useMemo)(() => {
17539
+ const tableData = (0, import_react8.useMemo)(() => {
17536
17540
  if (requests) {
17537
17541
  return requests.map((item) => ({
17538
17542
  ...item,
@@ -17542,7 +17546,7 @@ var RequestTable = ({
17542
17546
  }));
17543
17547
  } else return [];
17544
17548
  }, [requests]);
17545
- const columns = (0, import_react7.useMemo)(() => {
17549
+ const columns = (0, import_react8.useMemo)(() => {
17546
17550
  const col = [
17547
17551
  {
17548
17552
  field: "input",
@@ -19413,9 +19417,9 @@ var TraceListItem = ({ trace, onClick }) => {
19413
19417
  };
19414
19418
 
19415
19419
  // src/sections/traces/trace-list/trace-list-provider.tsx
19416
- var import_react8 = require("react");
19420
+ var import_react9 = require("react");
19417
19421
  var import_jsx_runtime24 = require("react/jsx-runtime");
19418
- var TraceListContext = (0, import_react8.createContext)(
19422
+ var TraceListContext = (0, import_react9.createContext)(
19419
19423
  void 0
19420
19424
  );
19421
19425
  var TraceListProvider = ({
@@ -19427,7 +19431,7 @@ var TraceListProvider = ({
19427
19431
  return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(TraceListContext.Provider, { value: { traces, isLoading, error }, children });
19428
19432
  };
19429
19433
  var useTraceListContext = () => {
19430
- const context = (0, import_react8.useContext)(TraceListContext);
19434
+ const context = (0, import_react9.useContext)(TraceListContext);
19431
19435
  if (!context) {
19432
19436
  throw new Error(
19433
19437
  "useTraceListContext must be used within TraceListProvider"
@@ -19502,15 +19506,15 @@ var TracesList = ({
19502
19506
  };
19503
19507
 
19504
19508
  // src/sections/traces/trace-drawer/trace-drawer-provider.tsx
19505
- var import_react10 = require("react");
19509
+ var import_react11 = require("react");
19506
19510
 
19507
19511
  // src/sections/traces/trace-drawer/hooks/use-trace-drawer.ts
19508
- var import_react9 = require("react");
19512
+ var import_react10 = require("react");
19509
19513
  var useTraceDrawer = (initialHeight = 400) => {
19510
- const [treeHeight, setTreeHeight] = (0, import_react9.useState)(initialHeight);
19511
- const [isDragging, setIsDragging] = (0, import_react9.useState)(false);
19512
- const [dragStart, setDragStart] = (0, import_react9.useState)({ y: 0, initialHeight: 0 });
19513
- (0, import_react9.useEffect)(() => {
19514
+ const [treeHeight, setTreeHeight] = (0, import_react10.useState)(initialHeight);
19515
+ const [isDragging, setIsDragging] = (0, import_react10.useState)(false);
19516
+ const [dragStart, setDragStart] = (0, import_react10.useState)({ y: 0, initialHeight: 0 });
19517
+ (0, import_react10.useEffect)(() => {
19514
19518
  if (isDragging) {
19515
19519
  document.addEventListener("mousemove", handleMouseMove);
19516
19520
  document.addEventListener("mouseup", handleMouseUp);
@@ -19552,7 +19556,7 @@ var useTraceDrawer = (initialHeight = 400) => {
19552
19556
 
19553
19557
  // src/sections/traces/trace-drawer/trace-drawer-provider.tsx
19554
19558
  var import_jsx_runtime26 = require("react/jsx-runtime");
19555
- var TraceDrawerContext = (0, import_react10.createContext)(
19559
+ var TraceDrawerContext = (0, import_react11.createContext)(
19556
19560
  void 0
19557
19561
  );
19558
19562
  var TraceDrawerProvider = ({
@@ -19563,8 +19567,8 @@ var TraceDrawerProvider = ({
19563
19567
  t,
19564
19568
  onSpanChange
19565
19569
  }) => {
19566
- const [selectedSpanId, setSelectedSpanId] = (0, import_react10.useState)(null);
19567
- const selectedSpan = (0, import_react10.useMemo)(() => {
19570
+ const [selectedSpanId, setSelectedSpanId] = (0, import_react11.useState)(null);
19571
+ const selectedSpan = (0, import_react11.useMemo)(() => {
19568
19572
  if (!selectedSpanId) {
19569
19573
  if (traces.length > 0 && traces[0]) {
19570
19574
  return {
@@ -19600,7 +19604,7 @@ var TraceDrawerProvider = ({
19600
19604
  }
19601
19605
  return null;
19602
19606
  }, [selectedSpanId, traces]);
19603
- const spanTree = (0, import_react10.useMemo)(() => {
19607
+ const spanTree = (0, import_react11.useMemo)(() => {
19604
19608
  const buildSpanTree = (traces2) => {
19605
19609
  const tree = [];
19606
19610
  const lookup = {};
@@ -19636,17 +19640,17 @@ var TraceDrawerProvider = ({
19636
19640
  return buildSpanTree(traces);
19637
19641
  }, [traces]);
19638
19642
  const { treeHeight, handleMouseDown, isDragging } = useTraceDrawer();
19639
- (0, import_react10.useEffect)(() => {
19643
+ (0, import_react11.useEffect)(() => {
19640
19644
  return () => {
19641
19645
  setSelectedSpanId(null);
19642
19646
  };
19643
19647
  }, [traces]);
19644
- (0, import_react10.useEffect)(() => {
19648
+ (0, import_react11.useEffect)(() => {
19645
19649
  if (onSpanChange) {
19646
19650
  onSpanChange(selectedSpan);
19647
19651
  }
19648
19652
  }, [selectedSpan]);
19649
- const findCostAndTokens = (0, import_react10.useCallback)((item) => {
19653
+ const findCostAndTokens = (0, import_react11.useCallback)((item) => {
19650
19654
  const costAndTokenCache = {};
19651
19655
  const calculate = (node) => {
19652
19656
  if (costAndTokenCache[node.id]) {
@@ -19703,7 +19707,7 @@ var TraceDrawerProvider = ({
19703
19707
  return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(TraceDrawerContext.Provider, { value, children });
19704
19708
  };
19705
19709
  var useTraceDrawerContext = () => {
19706
- const context = (0, import_react10.useContext)(TraceDrawerContext);
19710
+ const context = (0, import_react11.useContext)(TraceDrawerContext);
19707
19711
  if (!context) {
19708
19712
  throw new Error(
19709
19713
  "useTraceDrawerContext must be used within TraceDrawerProvider"
@@ -20349,7 +20353,7 @@ var TraceLabel = ({
20349
20353
  };
20350
20354
 
20351
20355
  // src/sections/traces/trace-drawer/trace-tree/trace-tree.tsx
20352
- var import_react11 = require("react");
20356
+ var import_react12 = require("react");
20353
20357
  var import_jsx_runtime36 = require("react/jsx-runtime");
20354
20358
  var renderTree = (node, findCostAndTokens) => {
20355
20359
  if (!node) {
@@ -20387,7 +20391,7 @@ var TraceTree = () => {
20387
20391
  findCostAndTokens,
20388
20392
  traceId
20389
20393
  } = useTraceDrawerContext();
20390
- const tree = (0, import_react11.useMemo)(() => {
20394
+ const tree = (0, import_react12.useMemo)(() => {
20391
20395
  return spanTree.map((node) => renderTree(node, findCostAndTokens));
20392
20396
  }, [spanTree]);
20393
20397
  return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(import_material17.Box, { sx: { height: "100%", overflowY: "auto", p: 2 }, children: selectedSpan?.id && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
@@ -20413,10 +20417,10 @@ var TraceTree = () => {
20413
20417
 
20414
20418
  // src/sections/traces/trace-drawer/trace-graph/trace-graph-canvas.tsx
20415
20419
  var import_material20 = require("@mui/material");
20416
- var import_react16 = require("react");
20420
+ var import_react17 = require("react");
20417
20421
 
20418
20422
  // src/sections/traces/trace-drawer/trace-graph/use-trace-graph.ts
20419
- var import_react12 = require("react");
20423
+ var import_react13 = require("react");
20420
20424
 
20421
20425
  // src/sections/traces/trace-drawer/trace-graph/workflow-graph-generator.ts
20422
20426
  function hasManualGraphMetadata(spans) {
@@ -20674,7 +20678,7 @@ function convertWorkflowEdgesToGraphEdges(workflowEdges) {
20674
20678
  }));
20675
20679
  }
20676
20680
  var useTraceGraph = (graphData, spans) => {
20677
- const result2 = (0, import_react12.useMemo)(() => {
20681
+ const result2 = (0, import_react13.useMemo)(() => {
20678
20682
  if (graphData && graphData.length > 0) {
20679
20683
  return processManualGraphData(graphData);
20680
20684
  }
@@ -20700,11 +20704,11 @@ var useTraceGraph = (graphData, spans) => {
20700
20704
  };
20701
20705
 
20702
20706
  // src/sections/traces/trace-drawer/trace-graph/trace-graph-canvas.tsx
20703
- var import_react17 = require("@xyflow/react");
20707
+ var import_react18 = require("@xyflow/react");
20704
20708
 
20705
20709
  // src/sections/traces/trace-drawer/trace-graph/trace-node.tsx
20706
- var import_react13 = require("react");
20707
- var import_react14 = require("@xyflow/react");
20710
+ var import_react14 = require("react");
20711
+ var import_react15 = require("@xyflow/react");
20708
20712
  var import_material18 = require("@mui/material");
20709
20713
  var import_jsx_runtime37 = require("react/jsx-runtime");
20710
20714
  function TraceNodeComponent(props) {
@@ -20726,10 +20730,10 @@ function TraceNodeComponent(props) {
20726
20730
  if (isStartOrEnd) {
20727
20731
  return /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(import_jsx_runtime37.Fragment, { children: [
20728
20732
  /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
20729
- import_react14.Handle,
20733
+ import_react15.Handle,
20730
20734
  {
20731
20735
  type: "target",
20732
- position: import_react14.Position.Top,
20736
+ position: import_react15.Position.Top,
20733
20737
  style: { visibility: "hidden" }
20734
20738
  }
20735
20739
  ),
@@ -20759,10 +20763,10 @@ function TraceNodeComponent(props) {
20759
20763
  }
20760
20764
  ),
20761
20765
  /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
20762
- import_react14.Handle,
20766
+ import_react15.Handle,
20763
20767
  {
20764
20768
  type: "source",
20765
- position: import_react14.Position.Bottom,
20769
+ position: import_react15.Position.Bottom,
20766
20770
  style: { visibility: "hidden" }
20767
20771
  }
20768
20772
  )
@@ -20770,10 +20774,10 @@ function TraceNodeComponent(props) {
20770
20774
  }
20771
20775
  return /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(import_jsx_runtime37.Fragment, { children: [
20772
20776
  /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
20773
- import_react14.Handle,
20777
+ import_react15.Handle,
20774
20778
  {
20775
20779
  type: "target",
20776
- position: import_react14.Position.Top,
20780
+ position: import_react15.Position.Top,
20777
20781
  style: { visibility: "hidden" }
20778
20782
  }
20779
20783
  ),
@@ -20843,19 +20847,19 @@ function TraceNodeComponent(props) {
20843
20847
  }
20844
20848
  ),
20845
20849
  /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
20846
- import_react14.Handle,
20850
+ import_react15.Handle,
20847
20851
  {
20848
20852
  type: "source",
20849
- position: import_react14.Position.Bottom,
20853
+ position: import_react15.Position.Bottom,
20850
20854
  style: { visibility: "hidden" }
20851
20855
  }
20852
20856
  )
20853
20857
  ] });
20854
20858
  }
20855
- var TraceNode = (0, import_react13.memo)(TraceNodeComponent);
20859
+ var TraceNode = (0, import_react14.memo)(TraceNodeComponent);
20856
20860
 
20857
20861
  // src/sections/traces/trace-drawer/trace-graph/use-graph-data.ts
20858
- var import_react15 = require("react");
20862
+ var import_react16 = require("react");
20859
20863
  var import_material19 = require("@mui/material");
20860
20864
  function useGraphData({
20861
20865
  nodes: rawNodes,
@@ -20865,7 +20869,7 @@ function useGraphData({
20865
20869
  nodeSpanIndices
20866
20870
  }) {
20867
20871
  const theme2 = (0, import_material19.useTheme)();
20868
- const reactFlowNodes = (0, import_react15.useMemo)(() => {
20872
+ const reactFlowNodes = (0, import_react16.useMemo)(() => {
20869
20873
  if (!rawNodes.length) return [];
20870
20874
  const initialNodes = rawNodes.map((node) => ({
20871
20875
  id: node.id,
@@ -20903,7 +20907,7 @@ function useGraphData({
20903
20907
  });
20904
20908
  return styledNodes;
20905
20909
  }, [rawNodes, rawEdges, theme2, onNodeClick, onNodeCycleClick, nodeSpanIndices]);
20906
- const reactFlowEdges = (0, import_react15.useMemo)(() => {
20910
+ const reactFlowEdges = (0, import_react16.useMemo)(() => {
20907
20911
  const edges = [];
20908
20912
  rawEdges.forEach((edge) => {
20909
20913
  edges.push({
@@ -20916,7 +20920,7 @@ function useGraphData({
20916
20920
  });
20917
20921
  return edges;
20918
20922
  }, [rawEdges]);
20919
- const { nodes: layoutedNodes, edges: layoutedEdges } = (0, import_react15.useMemo)(
20923
+ const { nodes: layoutedNodes, edges: layoutedEdges } = (0, import_react16.useMemo)(
20920
20924
  () => applyDagreLayout(reactFlowNodes, reactFlowEdges),
20921
20925
  [reactFlowNodes, reactFlowEdges]
20922
20926
  );
@@ -20938,7 +20942,7 @@ function TraceGraphCanvas({
20938
20942
  }) {
20939
20943
  const theme2 = (0, import_material20.useTheme)();
20940
20944
  const { onSelectSpan, traces } = useTraceDrawerContext();
20941
- const spansForAutoGeneration = (0, import_react16.useMemo)(() => {
20945
+ const spansForAutoGeneration = (0, import_react17.useMemo)(() => {
20942
20946
  if (graphData && graphData.length > 0) {
20943
20947
  return [];
20944
20948
  }
@@ -20957,18 +20961,18 @@ function TraceGraphCanvas({
20957
20961
  graphData,
20958
20962
  spansForAutoGeneration
20959
20963
  );
20960
- const [nodeSpanIndices, setNodeSpanIndices] = (0, import_react16.useState)(
20964
+ const [nodeSpanIndices, setNodeSpanIndices] = (0, import_react17.useState)(
20961
20965
  () => /* @__PURE__ */ new Map()
20962
20966
  );
20963
- const nodeMap = (0, import_react16.useMemo)(() => {
20967
+ const nodeMap = (0, import_react17.useMemo)(() => {
20964
20968
  const map = /* @__PURE__ */ new Map();
20965
20969
  rawNodes.forEach((node) => map.set(node.id, node));
20966
20970
  return map;
20967
20971
  }, [rawNodes]);
20968
- const onNodeClick = (0, import_react16.useCallback)((spanId) => {
20972
+ const onNodeClick = (0, import_react17.useCallback)((spanId) => {
20969
20973
  onSelectSpan(spanId);
20970
20974
  }, [onSelectSpan]);
20971
- const onNodeCycleClick = (0, import_react16.useCallback)(
20975
+ const onNodeCycleClick = (0, import_react17.useCallback)(
20972
20976
  (nodeId) => {
20973
20977
  const node = nodeMap.get(nodeId);
20974
20978
  if (!node?.spanIds || node.spanIds.length === 0) return;
@@ -20993,15 +20997,15 @@ function TraceGraphCanvas({
20993
20997
  onNodeCycleClick,
20994
20998
  nodeSpanIndices
20995
20999
  });
20996
- const [nodes, setNodes] = (0, import_react16.useState)(reactFlowNodes);
20997
- const [edges, setEdges] = (0, import_react16.useState)(reactFlowEdges);
20998
- const [focusedNodeIndex, setFocusedNodeIndex] = (0, import_react16.useState)(-1);
20999
- (0, import_react16.useEffect)(() => {
21000
+ const [nodes, setNodes] = (0, import_react17.useState)(reactFlowNodes);
21001
+ const [edges, setEdges] = (0, import_react17.useState)(reactFlowEdges);
21002
+ const [focusedNodeIndex, setFocusedNodeIndex] = (0, import_react17.useState)(-1);
21003
+ (0, import_react17.useEffect)(() => {
21000
21004
  setNodes(reactFlowNodes);
21001
21005
  setEdges(reactFlowEdges);
21002
21006
  setFocusedNodeIndex(-1);
21003
21007
  }, [reactFlowNodes, reactFlowEdges]);
21004
- const handleKeyDown = (0, import_react16.useCallback)(
21008
+ const handleKeyDown = (0, import_react17.useCallback)(
21005
21009
  (event) => {
21006
21010
  if (nodes.length === 0) return;
21007
21011
  switch (event.key) {
@@ -21044,7 +21048,7 @@ function TraceGraphCanvas({
21044
21048
  },
21045
21049
  [nodes, focusedNodeIndex, onNodeClick, onNodeCycleClick]
21046
21050
  );
21047
- (0, import_react16.useEffect)(() => {
21051
+ (0, import_react17.useEffect)(() => {
21048
21052
  if (focusedNodeIndex >= 0 && focusedNodeIndex < nodes.length) {
21049
21053
  setNodes(
21050
21054
  (prevNodes) => prevNodes.map((node, index) => ({
@@ -21105,16 +21109,16 @@ function TraceGraphCanvas({
21105
21109
  role: "application",
21106
21110
  "aria-label": "Workflow graph - use arrow keys to navigate between nodes, Enter to select",
21107
21111
  children: /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(
21108
- import_react17.ReactFlow,
21112
+ import_react18.ReactFlow,
21109
21113
  {
21110
21114
  nodes,
21111
21115
  edges,
21112
21116
  nodeTypes,
21113
21117
  onNodesChange: (changes) => {
21114
- setNodes((0, import_react17.applyNodeChanges)(changes, nodes));
21118
+ setNodes((0, import_react18.applyNodeChanges)(changes, nodes));
21115
21119
  },
21116
21120
  onEdgesChange: (changes) => {
21117
- setEdges((0, import_react17.applyEdgeChanges)(changes, edges));
21121
+ setEdges((0, import_react18.applyEdgeChanges)(changes, edges));
21118
21122
  },
21119
21123
  fitView: true,
21120
21124
  zoomOnScroll: true,
@@ -21125,7 +21129,7 @@ function TraceGraphCanvas({
21125
21129
  },
21126
21130
  children: [
21127
21131
  /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
21128
- import_react17.MiniMap,
21132
+ import_react18.MiniMap,
21129
21133
  {
21130
21134
  style: {
21131
21135
  width: 80,
@@ -21142,7 +21146,7 @@ function TraceGraphCanvas({
21142
21146
  }
21143
21147
  ),
21144
21148
  /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
21145
- import_react17.Controls,
21149
+ import_react18.Controls,
21146
21150
  {
21147
21151
  style: {
21148
21152
  backgroundColor: theme2.palette.background.paper,
@@ -21152,7 +21156,7 @@ function TraceGraphCanvas({
21152
21156
  }
21153
21157
  }
21154
21158
  ),
21155
- /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_react17.Background, { gap: 20, size: 1 })
21159
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_react18.Background, { gap: 20, size: 1 })
21156
21160
  ]
21157
21161
  }
21158
21162
  )
@@ -21442,17 +21446,17 @@ function computeTimelineLayout(spans) {
21442
21446
  }
21443
21447
 
21444
21448
  // src/sections/traces/trace-drawer/trace-timeline/use-timeline-layout.ts
21445
- var import_react18 = require("react");
21449
+ var import_react19 = require("react");
21446
21450
  function useTimelineLayout(spans) {
21447
- return (0, import_react18.useMemo)(() => computeTimelineLayout(spans), [spans]);
21451
+ return (0, import_react19.useMemo)(() => computeTimelineLayout(spans), [spans]);
21448
21452
  }
21449
21453
 
21450
21454
  // src/sections/traces/trace-drawer/trace-timeline/use-timeline-zoom.ts
21451
- var import_react19 = require("react");
21455
+ var import_react20 = require("react");
21452
21456
  var { MIN_SCALE, MAX_SCALE } = TIMELINE_CONSTANTS;
21453
21457
  var ZOOM_FACTOR = 1.2;
21454
21458
  function useTimelineZoom(contentWidth = 1e3, contentHeight = 500) {
21455
- const [viewState, setViewState] = (0, import_react19.useState)(() => ({
21459
+ const [viewState, setViewState] = (0, import_react20.useState)(() => ({
21456
21460
  viewBox: {
21457
21461
  x: 0,
21458
21462
  y: 0,
@@ -21462,13 +21466,13 @@ function useTimelineZoom(contentWidth = 1e3, contentHeight = 500) {
21462
21466
  scale: 1,
21463
21467
  isPanning: false
21464
21468
  }));
21465
- const panStartRef = (0, import_react19.useRef)(
21469
+ const panStartRef = (0, import_react20.useRef)(
21466
21470
  null
21467
21471
  );
21468
- const clampScale = (0, import_react19.useCallback)((scale) => {
21472
+ const clampScale = (0, import_react20.useCallback)((scale) => {
21469
21473
  return Math.max(MIN_SCALE, Math.min(MAX_SCALE, scale));
21470
21474
  }, []);
21471
- const zoomIn = (0, import_react19.useCallback)(() => {
21475
+ const zoomIn = (0, import_react20.useCallback)(() => {
21472
21476
  setViewState((prev) => {
21473
21477
  const newScale = clampScale(prev.scale * ZOOM_FACTOR);
21474
21478
  const scaleRatio = prev.scale / newScale;
@@ -21488,7 +21492,7 @@ function useTimelineZoom(contentWidth = 1e3, contentHeight = 500) {
21488
21492
  };
21489
21493
  });
21490
21494
  }, [clampScale]);
21491
- const zoomOut = (0, import_react19.useCallback)(() => {
21495
+ const zoomOut = (0, import_react20.useCallback)(() => {
21492
21496
  setViewState((prev) => {
21493
21497
  const newScale = clampScale(prev.scale / ZOOM_FACTOR);
21494
21498
  const scaleRatio = prev.scale / newScale;
@@ -21508,7 +21512,7 @@ function useTimelineZoom(contentWidth = 1e3, contentHeight = 500) {
21508
21512
  };
21509
21513
  });
21510
21514
  }, [clampScale]);
21511
- const resetZoom = (0, import_react19.useCallback)(() => {
21515
+ const resetZoom = (0, import_react20.useCallback)(() => {
21512
21516
  setViewState({
21513
21517
  viewBox: {
21514
21518
  x: 0,
@@ -21520,7 +21524,7 @@ function useTimelineZoom(contentWidth = 1e3, contentHeight = 500) {
21520
21524
  isPanning: false
21521
21525
  });
21522
21526
  }, [contentWidth, contentHeight]);
21523
- const setScale = (0, import_react19.useCallback)(
21527
+ const setScale = (0, import_react20.useCallback)(
21524
21528
  (scale) => {
21525
21529
  setViewState((prev) => {
21526
21530
  const newScale = clampScale(scale);
@@ -21543,7 +21547,7 @@ function useTimelineZoom(contentWidth = 1e3, contentHeight = 500) {
21543
21547
  },
21544
21548
  [clampScale]
21545
21549
  );
21546
- const onWheel = (0, import_react19.useCallback)(
21550
+ const onWheel = (0, import_react20.useCallback)(
21547
21551
  (event) => {
21548
21552
  if (!event.ctrlKey && !event.metaKey) {
21549
21553
  return;
@@ -21587,7 +21591,7 @@ function useTimelineZoom(contentWidth = 1e3, contentHeight = 500) {
21587
21591
  },
21588
21592
  [clampScale]
21589
21593
  );
21590
- const onMouseDown = (0, import_react19.useCallback)((event) => {
21594
+ const onMouseDown = (0, import_react20.useCallback)((event) => {
21591
21595
  if (event.button !== 0) return;
21592
21596
  event.preventDefault();
21593
21597
  setViewState((prev) => {
@@ -21603,7 +21607,7 @@ function useTimelineZoom(contentWidth = 1e3, contentHeight = 500) {
21603
21607
  };
21604
21608
  });
21605
21609
  }, []);
21606
- const onMouseMove = (0, import_react19.useCallback)((event) => {
21610
+ const onMouseMove = (0, import_react20.useCallback)((event) => {
21607
21611
  if (!panStartRef.current) return;
21608
21612
  const svg2 = event.currentTarget;
21609
21613
  const rect = svg2.getBoundingClientRect();
@@ -21622,14 +21626,14 @@ function useTimelineZoom(contentWidth = 1e3, contentHeight = 500) {
21622
21626
  };
21623
21627
  });
21624
21628
  }, []);
21625
- const onMouseUp = (0, import_react19.useCallback)(() => {
21629
+ const onMouseUp = (0, import_react20.useCallback)(() => {
21626
21630
  panStartRef.current = null;
21627
21631
  setViewState((prev) => ({
21628
21632
  ...prev,
21629
21633
  isPanning: false
21630
21634
  }));
21631
21635
  }, []);
21632
- const onMouseLeave = (0, import_react19.useCallback)(() => {
21636
+ const onMouseLeave = (0, import_react20.useCallback)(() => {
21633
21637
  if (panStartRef.current) {
21634
21638
  panStartRef.current = null;
21635
21639
  setViewState((prev) => ({
@@ -21655,11 +21659,11 @@ function useTimelineZoom(contentWidth = 1e3, contentHeight = 500) {
21655
21659
  }
21656
21660
 
21657
21661
  // src/sections/traces/trace-drawer/trace-timeline/use-timeline-view-preference.ts
21658
- var import_react20 = require("react");
21662
+ var import_react21 = require("react");
21659
21663
  var STORAGE_KEY = "agentmark-trace-view-preference";
21660
21664
  var DEFAULT_VIEW = "graph";
21661
21665
  function useTimelineViewPreference() {
21662
- const [view, setViewState] = (0, import_react20.useState)(() => {
21666
+ const [view, setViewState] = (0, import_react21.useState)(() => {
21663
21667
  if (typeof window !== "undefined") {
21664
21668
  try {
21665
21669
  const stored = localStorage.getItem(STORAGE_KEY);
@@ -21671,7 +21675,7 @@ function useTimelineViewPreference() {
21671
21675
  }
21672
21676
  return DEFAULT_VIEW;
21673
21677
  });
21674
- (0, import_react20.useEffect)(() => {
21678
+ (0, import_react21.useEffect)(() => {
21675
21679
  if (typeof window !== "undefined") {
21676
21680
  try {
21677
21681
  localStorage.setItem(STORAGE_KEY, view);
@@ -21679,10 +21683,10 @@ function useTimelineViewPreference() {
21679
21683
  }
21680
21684
  }
21681
21685
  }, [view]);
21682
- const setView = (0, import_react20.useCallback)((newView) => {
21686
+ const setView = (0, import_react21.useCallback)((newView) => {
21683
21687
  setViewState(newView);
21684
21688
  }, []);
21685
- const toggleView = (0, import_react20.useCallback)(() => {
21689
+ const toggleView = (0, import_react21.useCallback)(() => {
21686
21690
  setViewState((current) => current === "graph" ? "timeline" : "graph");
21687
21691
  }, []);
21688
21692
  return {
@@ -21700,12 +21704,12 @@ function useTimelineViewPreference() {
21700
21704
  }
21701
21705
 
21702
21706
  // src/sections/traces/trace-drawer/trace-timeline/trace-timeline.tsx
21703
- var import_react26 = require("react");
21707
+ var import_react27 = require("react");
21704
21708
  var import_material24 = require("@mui/material");
21705
21709
  var import_styles10 = require("@mui/material/styles");
21706
21710
 
21707
21711
  // src/sections/traces/trace-drawer/trace-timeline/timeline-bar.tsx
21708
- var import_react21 = require("react");
21712
+ var import_react22 = require("react");
21709
21713
  var import_styles6 = require("@mui/material/styles");
21710
21714
  var import_jsx_runtime39 = require("react/jsx-runtime");
21711
21715
  var { ROW_HEIGHT, MIN_BAR_WIDTH, BAR_HEIGHT_RATIO } = TIMELINE_CONSTANTS;
@@ -21715,7 +21719,7 @@ function formatBarDuration(ms) {
21715
21719
  }
21716
21720
  return `${(ms / 1e3).toFixed(1)}s`;
21717
21721
  }
21718
- var TimelineBar = (0, import_react21.memo)(function TimelineBar2({
21722
+ var TimelineBar = (0, import_react22.memo)(function TimelineBar2({
21719
21723
  layout,
21720
21724
  isSelected,
21721
21725
  isFocused = false,
@@ -21803,11 +21807,11 @@ var TimelineBar = (0, import_react21.memo)(function TimelineBar2({
21803
21807
  });
21804
21808
 
21805
21809
  // src/sections/traces/trace-drawer/trace-timeline/timeline-ruler.tsx
21806
- var import_react22 = require("react");
21810
+ var import_react23 = require("react");
21807
21811
  var import_styles7 = require("@mui/material/styles");
21808
21812
  var import_jsx_runtime40 = require("react/jsx-runtime");
21809
21813
  var { RULER_HEIGHT } = TIMELINE_CONSTANTS;
21810
- var TimelineRuler = (0, import_react22.memo)(function TimelineRuler2({
21814
+ var TimelineRuler = (0, import_react23.memo)(function TimelineRuler2({
21811
21815
  ticks,
21812
21816
  width: width2,
21813
21817
  height: height2 = RULER_HEIGHT
@@ -21873,7 +21877,7 @@ var TimelineRuler = (0, import_react22.memo)(function TimelineRuler2({
21873
21877
  });
21874
21878
 
21875
21879
  // src/sections/traces/trace-drawer/trace-timeline/timeline-tooltip.tsx
21876
- var import_react23 = require("react");
21880
+ var import_react24 = require("react");
21877
21881
  var import_material21 = require("@mui/material");
21878
21882
  var import_styles8 = require("@mui/material/styles");
21879
21883
  var import_jsx_runtime41 = require("react/jsx-runtime");
@@ -21921,13 +21925,13 @@ function truncateText(text, maxLength) {
21921
21925
  if (cleanText.length <= maxLength) return cleanText;
21922
21926
  return cleanText.slice(0, maxLength) + "...";
21923
21927
  }
21924
- var TimelineTooltip = (0, import_react23.memo)(function TimelineTooltip2({
21928
+ var TimelineTooltip = (0, import_react24.memo)(function TimelineTooltip2({
21925
21929
  layout,
21926
21930
  position,
21927
21931
  visible
21928
21932
  }) {
21929
21933
  const theme2 = (0, import_styles8.useTheme)();
21930
- const parsedAttributes = (0, import_react23.useMemo)(() => {
21934
+ const parsedAttributes = (0, import_react24.useMemo)(() => {
21931
21935
  const attributes = layout?.span?.data?.attributes;
21932
21936
  if (!attributes) return null;
21933
21937
  try {
@@ -22210,7 +22214,7 @@ var TimelineTooltip = (0, import_react23.memo)(function TimelineTooltip2({
22210
22214
  });
22211
22215
 
22212
22216
  // src/sections/traces/trace-drawer/trace-timeline/timeline-legend.tsx
22213
- var import_react24 = require("react");
22217
+ var import_react25 = require("react");
22214
22218
  var import_material22 = require("@mui/material");
22215
22219
  var import_styles9 = require("@mui/material/styles");
22216
22220
  var import_jsx_runtime42 = require("react/jsx-runtime");
@@ -22234,7 +22238,7 @@ var NODE_TYPE_ORDER = [
22234
22238
  "memory",
22235
22239
  "default"
22236
22240
  ];
22237
- var TimelineLegend = (0, import_react24.memo)(function TimelineLegend2({
22241
+ var TimelineLegend = (0, import_react25.memo)(function TimelineLegend2({
22238
22242
  typeBreakdown,
22239
22243
  showCounts = false
22240
22244
  }) {
@@ -22324,10 +22328,10 @@ var TimelineLegend = (0, import_react24.memo)(function TimelineLegend2({
22324
22328
  });
22325
22329
 
22326
22330
  // src/sections/traces/trace-drawer/trace-timeline/timeline-error-boundary.tsx
22327
- var import_react25 = require("react");
22331
+ var import_react26 = require("react");
22328
22332
  var import_material23 = require("@mui/material");
22329
22333
  var import_jsx_runtime43 = require("react/jsx-runtime");
22330
- var TimelineErrorBoundary = class extends import_react25.Component {
22334
+ var TimelineErrorBoundary = class extends import_react26.Component {
22331
22335
  constructor(props) {
22332
22336
  super(props);
22333
22337
  this.state = { hasError: false, error: null };
@@ -22385,7 +22389,7 @@ var import_jsx_runtime44 = require("react/jsx-runtime");
22385
22389
  var { ROW_HEIGHT: ROW_HEIGHT2, RULER_HEIGHT: RULER_HEIGHT2, PADDING, LABEL_WIDTH } = TIMELINE_CONSTANTS;
22386
22390
  var VIRTUALIZATION_THRESHOLD = 100;
22387
22391
  var VIRTUALIZATION_OVERSCAN = 5;
22388
- var TraceTimeline = (0, import_react26.memo)(function TraceTimeline2({
22392
+ var TraceTimeline = (0, import_react27.memo)(function TraceTimeline2({
22389
22393
  spans,
22390
22394
  selectedSpanId,
22391
22395
  onSelectSpan,
@@ -22397,12 +22401,12 @@ var TraceTimeline = (0, import_react26.memo)(function TraceTimeline2({
22397
22401
  isLoading = false
22398
22402
  }) {
22399
22403
  const theme2 = (0, import_styles10.useTheme)();
22400
- const containerRef = (0, import_react26.useRef)(null);
22401
- const [containerWidth, setContainerWidth] = (0, import_react26.useState)(800);
22402
- const prevSelectedSpanIdRef = (0, import_react26.useRef)(void 0);
22403
- const [tooltipData, setTooltipData] = (0, import_react26.useState)({ layout: null, position: null });
22404
- const [scrollTop, setScrollTop] = (0, import_react26.useState)(0);
22405
- const [containerHeight, setContainerHeight] = (0, import_react26.useState)(400);
22404
+ const containerRef = (0, import_react27.useRef)(null);
22405
+ const [containerWidth, setContainerWidth] = (0, import_react27.useState)(800);
22406
+ const prevSelectedSpanIdRef = (0, import_react27.useRef)(void 0);
22407
+ const [tooltipData, setTooltipData] = (0, import_react27.useState)({ layout: null, position: null });
22408
+ const [scrollTop, setScrollTop] = (0, import_react27.useState)(0);
22409
+ const [containerHeight, setContainerHeight] = (0, import_react27.useState)(400);
22406
22410
  const { layouts, metrics, rulerTicks } = useTimelineLayout(spans);
22407
22411
  const timelineWidth = Math.max(400, containerWidth - LABEL_WIDTH - PADDING * 2);
22408
22412
  const contentHeight = layouts.length * ROW_HEIGHT2;
@@ -22415,7 +22419,7 @@ var TraceTimeline = (0, import_react26.memo)(function TraceTimeline2({
22415
22419
  onWheel,
22416
22420
  panHandlers
22417
22421
  } = useTimelineZoom(timelineWidth, contentHeight);
22418
- const { visibleLayouts } = (0, import_react26.useMemo)(() => {
22422
+ const { visibleLayouts } = (0, import_react27.useMemo)(() => {
22419
22423
  if (layouts.length < VIRTUALIZATION_THRESHOLD) {
22420
22424
  return {
22421
22425
  visibleLayouts: layouts,
@@ -22439,7 +22443,7 @@ var TraceTimeline = (0, import_react26.memo)(function TraceTimeline2({
22439
22443
  endIndex: end
22440
22444
  };
22441
22445
  }, [layouts, scrollTop, containerHeight, showRuler]);
22442
- (0, import_react26.useEffect)(() => {
22446
+ (0, import_react27.useEffect)(() => {
22443
22447
  const container = containerRef.current;
22444
22448
  if (!container) return;
22445
22449
  const resizeObserver = new ResizeObserver((entries) => {
@@ -22460,7 +22464,7 @@ var TraceTimeline = (0, import_react26.memo)(function TraceTimeline2({
22460
22464
  container.removeEventListener("scroll", handleScroll);
22461
22465
  };
22462
22466
  }, []);
22463
- (0, import_react26.useEffect)(() => {
22467
+ (0, import_react27.useEffect)(() => {
22464
22468
  if (!selectedSpanId || selectedSpanId === prevSelectedSpanIdRef.current) {
22465
22469
  prevSelectedSpanIdRef.current = selectedSpanId;
22466
22470
  return;
@@ -22482,13 +22486,13 @@ var TraceTimeline = (0, import_react26.memo)(function TraceTimeline2({
22482
22486
  });
22483
22487
  }
22484
22488
  }, [selectedSpanId, layouts, showRuler]);
22485
- const handleSelectSpan = (0, import_react26.useCallback)(
22489
+ const handleSelectSpan = (0, import_react27.useCallback)(
22486
22490
  (spanId) => {
22487
22491
  onSelectSpan?.(spanId);
22488
22492
  },
22489
22493
  [onSelectSpan]
22490
22494
  );
22491
- const handleBarMouseEnter = (0, import_react26.useCallback)(
22495
+ const handleBarMouseEnter = (0, import_react27.useCallback)(
22492
22496
  (layout, event) => {
22493
22497
  setTooltipData({
22494
22498
  layout,
@@ -22497,11 +22501,11 @@ var TraceTimeline = (0, import_react26.memo)(function TraceTimeline2({
22497
22501
  },
22498
22502
  []
22499
22503
  );
22500
- const handleBarMouseLeave = (0, import_react26.useCallback)(() => {
22504
+ const handleBarMouseLeave = (0, import_react27.useCallback)(() => {
22501
22505
  setTooltipData({ layout: null, position: null });
22502
22506
  }, []);
22503
- const [focusedIndex, setFocusedIndex] = (0, import_react26.useState)(-1);
22504
- const handleKeyDown = (0, import_react26.useCallback)(
22507
+ const [focusedIndex, setFocusedIndex] = (0, import_react27.useState)(-1);
22508
+ const handleKeyDown = (0, import_react27.useCallback)(
22505
22509
  (event) => {
22506
22510
  if (layouts.length === 0) return;
22507
22511
  switch (event.key) {
@@ -22767,17 +22771,17 @@ var SpanInfoContent = ({ children }) => {
22767
22771
  var import_material26 = require("@mui/material");
22768
22772
 
22769
22773
  // src/sections/traces/trace-drawer/span-info/span-info-provider.tsx
22770
- var import_react28 = require("react");
22774
+ var import_react29 = require("react");
22771
22775
 
22772
22776
  // src/sections/traces/trace-drawer/span-info/hooks/use-span-info.ts
22773
- var import_react27 = require("react");
22777
+ var import_react28 = require("react");
22774
22778
  var useSpanInfo = ({ span }) => {
22775
- const [activeTab, setActiveTab] = (0, import_react27.useState)("attributes");
22776
- const [tabs, setTabs] = (0, import_react27.useState)([]);
22777
- const isLLMCall = (0, import_react27.useMemo)(() => {
22779
+ const [activeTab, setActiveTab] = (0, import_react28.useState)("attributes");
22780
+ const [tabs, setTabs] = (0, import_react28.useState)([]);
22781
+ const isLLMCall = (0, import_react28.useMemo)(() => {
22778
22782
  return span?.data?.type === "GENERATION" || !!span?.data?.model;
22779
22783
  }, [span?.data?.type, span?.data?.model]);
22780
- (0, import_react27.useEffect)(() => {
22784
+ (0, import_react28.useEffect)(() => {
22781
22785
  if (span?.id) {
22782
22786
  const newTabs = [];
22783
22787
  if (isLLMCall) {
@@ -22800,7 +22804,7 @@ var useSpanInfo = ({ span }) => {
22800
22804
  setTabs(newTabs);
22801
22805
  }
22802
22806
  }, [span?.id, isLLMCall]);
22803
- (0, import_react27.useEffect)(() => {
22807
+ (0, import_react28.useEffect)(() => {
22804
22808
  const isTabValid = activeTab === "inputOutput" && isLLMCall || activeTab === "evaluation" || activeTab === "attributes";
22805
22809
  if (!isTabValid) {
22806
22810
  if (isLLMCall) {
@@ -22820,7 +22824,7 @@ var useSpanInfo = ({ span }) => {
22820
22824
 
22821
22825
  // src/sections/traces/trace-drawer/span-info/span-info-provider.tsx
22822
22826
  var import_jsx_runtime46 = require("react/jsx-runtime");
22823
- var SpanInfoContext = (0, import_react28.createContext)(
22827
+ var SpanInfoContext = (0, import_react29.createContext)(
22824
22828
  void 0
22825
22829
  );
22826
22830
  var SpanInfoProvider = ({
@@ -22847,7 +22851,7 @@ var SpanInfoProvider = ({
22847
22851
  );
22848
22852
  };
22849
22853
  var useSpanInfoContext = () => {
22850
- const context = (0, import_react28.useContext)(SpanInfoContext);
22854
+ const context = (0, import_react29.useContext)(SpanInfoContext);
22851
22855
  if (!context) {
22852
22856
  throw new Error("useSpanInfo must be used within a SpanInfoProvider");
22853
22857
  }
@@ -22925,7 +22929,7 @@ var SpanInfoTabs = ({ children }) => {
22925
22929
  var import_lab2 = require("@mui/lab");
22926
22930
 
22927
22931
  // src/sections/traces/trace-drawer/span-info/tabs/hooks/use-span-attributes.ts
22928
- var import_react29 = require("react");
22932
+ var import_react30 = require("react");
22929
22933
 
22930
22934
  // src/sections/traces/trace-drawer/span-info/tabs/attribute-transformer-registry.ts
22931
22935
  var AttributeTransformerRegistry = class {
@@ -23231,7 +23235,7 @@ var transformAttributes = (attributes, normalizedData) => {
23231
23235
  // src/sections/traces/trace-drawer/span-info/tabs/hooks/use-span-attributes.ts
23232
23236
  var useSpanAttributes = () => {
23233
23237
  const { selectedSpan } = useTraceDrawerContext();
23234
- const rawAttributes = (0, import_react29.useMemo)(() => {
23238
+ const rawAttributes = (0, import_react30.useMemo)(() => {
23235
23239
  if (!selectedSpan?.data?.attributes) return {};
23236
23240
  try {
23237
23241
  return JSON.parse(selectedSpan.data.attributes);
@@ -23239,7 +23243,7 @@ var useSpanAttributes = () => {
23239
23243
  return {};
23240
23244
  }
23241
23245
  }, [selectedSpan]);
23242
- const transformedAttributes = (0, import_react29.useMemo)(() => {
23246
+ const transformedAttributes = (0, import_react30.useMemo)(() => {
23243
23247
  return transformAttributes(rawAttributes, selectedSpan?.data);
23244
23248
  }, [rawAttributes, selectedSpan?.data]);
23245
23249
  return {
@@ -23315,7 +23319,7 @@ var AttributesTab = () => {
23315
23319
  };
23316
23320
 
23317
23321
  // src/sections/traces/trace-drawer/span-info/tabs/hooks/use-span-prompts.ts
23318
- var import_react30 = require("react");
23322
+ var import_react31 = require("react");
23319
23323
  var extractPromptsFromSpan = (span) => {
23320
23324
  if (!span?.data?.input) return [];
23321
23325
  try {
@@ -23358,10 +23362,10 @@ var extractOutputFromSpan = (span) => {
23358
23362
  };
23359
23363
  var useSpanPrompts = () => {
23360
23364
  const { selectedSpan } = useTraceDrawerContext();
23361
- const prompts = (0, import_react30.useMemo)(() => {
23365
+ const prompts = (0, import_react31.useMemo)(() => {
23362
23366
  return extractPromptsFromSpan(selectedSpan);
23363
23367
  }, [selectedSpan]);
23364
- const outputData = (0, import_react30.useMemo)(() => {
23368
+ const outputData = (0, import_react31.useMemo)(() => {
23365
23369
  return extractOutputFromSpan(selectedSpan);
23366
23370
  }, [selectedSpan]);
23367
23371
  return {
@@ -23724,13 +23728,13 @@ var EvaluationItem = ({
23724
23728
  };
23725
23729
 
23726
23730
  // src/sections/traces/trace-drawer/span-info/tabs/evaluation-tab/evaluation-provider.tsx
23727
- var import_react31 = require("react");
23731
+ var import_react32 = require("react");
23728
23732
  var import_jsx_runtime59 = require("react/jsx-runtime");
23729
- var EvaluationContext = (0, import_react31.createContext)(
23733
+ var EvaluationContext = (0, import_react32.createContext)(
23730
23734
  void 0
23731
23735
  );
23732
23736
  var useEvaluationContext = () => {
23733
- const context = (0, import_react31.useContext)(EvaluationContext);
23737
+ const context = (0, import_react32.useContext)(EvaluationContext);
23734
23738
  if (!context) {
23735
23739
  throw new Error(
23736
23740
  "useEvaluationContext must be used within EvaluationProvider"
@@ -23744,7 +23748,7 @@ var EvaluationProvider = ({
23744
23748
  scores,
23745
23749
  isLoading
23746
23750
  }) => {
23747
- const [openAddAnnotationDialog, setOpenAddAnnotationDialog] = (0, import_react31.useState)(false);
23751
+ const [openAddAnnotationDialog, setOpenAddAnnotationDialog] = (0, import_react32.useState)(false);
23748
23752
  return /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
23749
23753
  EvaluationContext.Provider,
23750
23754
  {