@workflow/web 4.1.33 → 4.1.35

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 (33) hide show
  1. package/README.md +11 -34
  2. package/build/client/assets/{encryption-Cu4jq70Y.js → encryption-BhH0xZid.js} +2 -2
  3. package/build/client/assets/{entry.client-C7XgFTHI.js → entry.client-CaUKWFDB.js} +13 -35
  4. package/build/client/assets/{highlighted-body-B3W2YXNL-CK5bxjZc.js → highlighted-body-B3W2YXNL-D5wXP22M.js} +2 -2
  5. package/build/client/assets/{home-vGjXNC_q.js → home-CjokEfcx.js} +92 -164
  6. package/build/client/assets/{index-BQ-Xa8kF.js → index-BbkkdbNz.js} +78 -149
  7. package/build/client/assets/{index-CXBr7N7m.js → index-DY3Cy2uF.js} +20 -23
  8. package/build/client/assets/{manifest-5d325d67.js → manifest-cbe27963.js} +1 -1
  9. package/build/client/assets/{mermaid-3ZIDBTTL-CCVNMOf9.js → mermaid-3ZIDBTTL-8p93TMNC.js} +315 -479
  10. package/build/client/assets/mermaid-3ZIDBTTL-DHICBbcE.css +1 -0
  11. package/build/client/assets/{root-DjobWPwY.js → root-D-ZCwNhI.js} +5 -35
  12. package/build/client/assets/root-DzrclYrK.css +1 -0
  13. package/build/client/assets/{run-detail-nLEl00wq.js → run-detail-H0o7UsyU.js} +141 -205
  14. package/build/client/assets/server-build-DMZyIeNn.css +1 -0
  15. package/build/client/assets/{worker-CqHKTA7D.js → worker-DxRAeS-i.js} +2 -2
  16. package/build/client/assets/{workflow-graph-viewer-CTw33ANm.js → workflow-graph-viewer-C-MZ2XPV.js} +466 -723
  17. package/build/server/assets/{app-DFeBwpXW.js → app-BX9dMsx4.js} +67 -153
  18. package/build/server/assets/{highlighted-body-B3W2YXNL-DucHV668.js → highlighted-body-B3W2YXNL-CHc9_Xzp.js} +2 -2
  19. package/build/server/assets/{index-BUlN7QFn.js → index-BC_EEwAS.js} +2 -2
  20. package/build/server/assets/{index-DOJ452m_.js → index-BNN2zck_.js} +3 -3
  21. package/build/server/assets/{index-CMfOrLiJ.js → index-C-y3EhAf.js} +25 -32
  22. package/build/server/assets/{mermaid-3ZIDBTTL-DCNPJ1qb.js → mermaid-3ZIDBTTL-CP_u5jLd.js} +2 -2
  23. package/build/server/assets/{server-build-D0sUavwG.js → server-build-C0EUGBN0.js} +6483 -7670
  24. package/build/server/assets/{token-v98bLjzH.js → token-DYdYwRhs.js} +6 -6
  25. package/build/server/assets/{token-util-BoIjkgfM.js → token-util-BZHkMK_T.js} +2 -2
  26. package/build/server/index.js +1 -1
  27. package/host-guard.js +176 -0
  28. package/package.json +5 -4
  29. package/server.d.ts +15 -1
  30. package/server.js +28 -3
  31. package/build/client/assets/mermaid-3ZIDBTTL-yyHEMZs4.css +0 -1
  32. package/build/client/assets/root-BOS11TzD.css +0 -1
  33. package/build/client/assets/server-build-CNEy-GiI.css +0 -1
@@ -1,38 +1,20 @@
1
- import { j as jsxRuntimeExports, r as reactExports, f as reactDomExports, D as ReactDOM, B as useNavigate, C as useSearchParams, A as Link, w as withComponentProps, G as useParams } from "./index-BQ-Xa8kF.js";
2
- import { O as Copy, C as CircleAlert, Q as parseStepName, B as parseWorkflowName, j as ChevronRight, q as Check, U as ErrorCard, V as format, Z as Zap, S as Send, R as ResolveHookModal, p as ChevronUp, o as ChevronDown, X, N as ErrorBoundary, Y as Clock, G as CircleX, I as unwrapServerActionResult, u as unwrapOrThrow, W as WorkflowWebAPIError, _ as useEscapeKeydown, t as composeEventHandlers, $ as useCallbackRef, a0 as useLayoutEffect2, s as useControllableState, a1 as useId, a2 as createContext2, v as Presence, x as createContextScope, l as hideOthers, m as ReactRemoveScroll, a3 as useFocusGuards, a4 as LAYOUT, a5 as wakeUpRun, r as resumeHook, A as Alert, c as AlertTitle, d as AlertDescription, a as Skeleton$1, a6 as RunActionsButtons, F as StatusBadge, e as CopyableText, b as RelativeTime, T as Tabs, K as TabsList, L as TabsTrigger, M as TabsContent, y as cancelRun, a7 as recreateRun } from "./workflow-graph-viewer-CTw33ANm.js";
3
- import { c as createLucideIcon, M as Spinner, h as useToast, N as useHasContextCardProvider, O as ContextCardProvider, U as ContextCardTrigger, W as Skeleton, X as DecryptClickContext, Y as Yr, Z as isEncryptedMarker, _ as formatDuration, $ as DataInspector, a0 as _r, a1 as StreamClickContext, a2 as isExpiredMarker, a3 as isDoStreamStep, a4 as extractConversation, a5 as Lock, a6 as EVENT_DATA_REF_FIELDS, a7 as clsx, a8 as useTraceViewer, a9 as styles, aa as formatDurationForTimeline, ab as formatWallClockTime, ac as useImmediateStyle, ad as TIMELINE_PADDING, ae as formatTimeSelection, af as MARKER_HEIGHT, ag as ROW_HEIGHT, ah as ROW_PADDING, ai as SEARCH_HEIGHT, aj as getHighResInMs, ak as getMsInHighRes, al as MARKER_NOTCH_HEIGHT, am as MAP_HEIGHT, an as SEARCH_GAP, ao as MiniMap, ap as SpanNodes, aq as SpanDetailPanel, ar as TraceViewerContextProvider, as as hydrateResourceIOWithKey, at as hydrateResourceIO, au as fetchHook, l as fetchEvents, F as fetchRun, av as fetchStep, aw as hasEncryptedFields, ax as fetchStreams, ay as Slot, E as useComposedRefs, az as Slottable, d as cn, aA as buttonVariants, aB as isEncryptedData, aC as hydrateData, aD as SerializationFormat, aE as getWebRevivers, aF as fetchEvent, aG as fetchEventsByCorrelationId, T as Tooltip, a as TooltipTrigger, b as TooltipContent, aH as LIVE_UPDATE_INTERVAL_MS$1, u as useServerConfig, aI as getEncryptionKeyForRun, t as toast, L as LoaderCircle, aJ as StreamViewer } from "./mermaid-3ZIDBTTL-CCVNMOf9.js";
4
- import { decrypt, importKey } from "./encryption-Cu4jq70Y.js";
5
- import "./index-CXBr7N7m.js";
6
- /**
7
- * @license lucide-react v0.575.0 - ISC
8
- *
9
- * This source code is licensed under the ISC license.
10
- * See the LICENSE file in the root directory of this source tree.
11
- */
1
+ import { j as jsxRuntimeExports, r as reactExports, f as reactDomExports, D as ReactDOM, B as useNavigate, C as useSearchParams, A as Link, w as withComponentProps, G as useParams } from "./index-BbkkdbNz.js";
2
+ import { O as Copy, C as CircleAlert, Q as parseStepName, B as parseWorkflowName, j as ChevronRight, q as Check, U as ErrorCard, V as format, Z as Zap, S as Send, R as ResolveHookModal, p as ChevronUp, o as ChevronDown, X, N as ErrorBoundary, Y as Clock, G as CircleX, I as unwrapServerActionResult, u as unwrapOrThrow, W as WorkflowWebAPIError, _ as useEscapeKeydown, t as composeEventHandlers, $ as useCallbackRef, a0 as useLayoutEffect2, s as useControllableState, a1 as useId, a2 as createContext2, v as Presence, x as createContextScope, l as hideOthers, m as ReactRemoveScroll, a3 as useFocusGuards, a4 as LAYOUT, a5 as wakeUpRun, r as resumeHook, A as Alert, c as AlertTitle, d as AlertDescription, a as Skeleton$1, a6 as RunActionsButtons, F as StatusBadge, e as CopyableText, b as RelativeTime, T as Tabs, K as TabsList, L as TabsTrigger, M as TabsContent, y as cancelRun, a7 as recreateRun } from "./workflow-graph-viewer-C-MZ2XPV.js";
3
+ import { c as createLucideIcon, M as Spinner, h as useToast, N as useHasContextCardProvider, O as ContextCardProvider, U as ContextCardTrigger, W as Skeleton, X as DecryptClickContext, Y as Yr, Z as isEncryptedMarker, _ as formatDuration, $ as DataInspector, a0 as _r, a1 as StreamClickContext, a2 as isExpiredMarker, a3 as isDoStreamStep, a4 as extractConversation, a5 as Lock, a6 as EVENT_DATA_REF_FIELDS, a7 as clsx, a8 as useTraceViewer, a9 as styles, aa as formatDurationForTimeline, ab as formatWallClockTime, ac as useImmediateStyle, ad as TIMELINE_PADDING, ae as formatTimeSelection, af as MARKER_HEIGHT, ag as ROW_HEIGHT, ah as ROW_PADDING, ai as SEARCH_HEIGHT, aj as getHighResInMs, ak as getMsInHighRes, al as MARKER_NOTCH_HEIGHT, am as MAP_HEIGHT, an as SEARCH_GAP, ao as MiniMap, ap as SpanNodes, aq as SpanDetailPanel, ar as TraceViewerContextProvider, as as hydrateResourceIOWithKey, at as hydrateResourceIO, au as fetchHook, l as fetchEvents, F as fetchRun, av as fetchStep, aw as hasEncryptedFields, ax as fetchStreams, ay as Slot, E as useComposedRefs, az as Slottable, d as cn, aA as buttonVariants, aB as isEncryptedData, aC as hydrateData, aD as SerializationFormat, aE as getWebRevivers, aF as fetchEvent, aG as fetchEventsByCorrelationId, T as Tooltip, a as TooltipTrigger, b as TooltipContent, aH as LIVE_UPDATE_INTERVAL_MS$1, u as useServerConfig, aI as getEncryptionKeyForRun, t as toast, L as LoaderCircle, aJ as StreamViewer } from "./mermaid-3ZIDBTTL-8p93TMNC.js";
4
+ import { decrypt, importKey } from "./encryption-BhH0xZid.js";
5
+ import "./index-DY3Cy2uF.js";
12
6
  const __iconNode$3 = [
13
7
  ["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }],
14
8
  ["path", { d: "M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3", key: "1u773s" }],
15
9
  ["path", { d: "M12 17h.01", key: "p32p05" }]
16
10
  ];
17
11
  const CircleQuestionMark = createLucideIcon("circle-question-mark", __iconNode$3);
18
- /**
19
- * @license lucide-react v0.575.0 - ISC
20
- *
21
- * This source code is licensed under the ISC license.
22
- * See the LICENSE file in the root directory of this source tree.
23
- */
24
12
  const __iconNode$2 = [
25
13
  ["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }],
26
14
  ["path", { d: "M12 16v-4", key: "1dtifu" }],
27
15
  ["path", { d: "M12 8h.01", key: "e9boi3" }]
28
16
  ];
29
17
  const Info = createLucideIcon("info", __iconNode$2);
30
- /**
31
- * @license lucide-react v0.575.0 - ISC
32
- *
33
- * This source code is licensed under the ISC license.
34
- * See the LICENSE file in the root directory of this source tree.
35
- */
36
18
  const __iconNode$1 = [
37
19
  ["path", { d: "M3 5h.01", key: "18ugdj" }],
38
20
  ["path", { d: "M3 12h.01", key: "nlz23k" }],
@@ -42,12 +24,6 @@ const __iconNode$1 = [
42
24
  ["path", { d: "M8 19h13", key: "m83p4d" }]
43
25
  ];
44
26
  const List = createLucideIcon("list", __iconNode$1);
45
- /**
46
- * @license lucide-react v0.575.0 - ISC
47
- *
48
- * This source code is licensed under the ISC license.
49
- * See the LICENSE file in the root directory of this source tree.
50
- */
51
27
  const __iconNode = [
52
28
  ["path", { d: "M12 4v16", key: "1654pz" }],
53
29
  ["path", { d: "M4 7V5a1 1 0 0 1 1-1h14a1 1 0 0 1 1 1v2", key: "e0r10z" }],
@@ -123,10 +99,9 @@ function LoadMoreButton({ loading = false, onClick, label = "Load more", loading
123
99
  }
124
100
  const STYLES = `.wf-menu-btn{appearance:none;-webkit-appearance:none;border:none;display:inline-flex;align-items:center;justify-content:center;height:40px;padding:0 12px;border-radius:6px;font-size:14px;font-weight:500;line-height:20px;color:var(--ds-gray-1000);background:var(--ds-background-100);box-shadow:0 0 0 1px var(--ds-gray-400);cursor:pointer;white-space:nowrap;transition:background 150ms}.wf-menu-btn:hover{background:var(--ds-gray-alpha-200)}.wf-menu-item{appearance:none;-webkit-appearance:none;border:none;display:flex;align-items:center;width:100%;height:40px;padding:0 8px;border-radius:6px;font-size:14px;color:var(--ds-gray-1000);background:transparent;cursor:pointer;transition:background 150ms}.wf-menu-item:hover{background:var(--ds-gray-alpha-100)}`;
125
101
  function MenuDropdown({ options, value, onChange }) {
126
- var _a, _b;
127
102
  const [open, setOpen] = reactExports.useState(false);
128
103
  const ref = reactExports.useRef(null);
129
- const label = ((_a = options.find((o) => o.value === value)) == null ? void 0 : _a.label) ?? ((_b = options[0]) == null ? void 0 : _b.label) ?? "";
104
+ const label = options.find((o) => o.value === value)?.label ?? options[0]?.label ?? "";
130
105
  reactExports.useEffect(() => {
131
106
  if (!open)
132
107
  return;
@@ -225,12 +200,11 @@ function useShortTimeAgo(date) {
225
200
  return shortTimeAgo;
226
201
  }
227
202
  function ZoneDateTimeRow({ date, zone }) {
228
- var _a;
229
203
  const dateObj = new Date(date);
230
- const formattedZone = ((_a = new Intl.DateTimeFormat("en-US", {
204
+ const formattedZone = new Intl.DateTimeFormat("en-US", {
231
205
  timeZone: zone,
232
206
  timeZoneName: "short"
233
- }).formatToParts(dateObj).find((part) => part.type === "timeZoneName")) == null ? void 0 : _a.value) || zone;
207
+ }).formatToParts(dateObj).find((part) => part.type === "timeZoneName")?.value || zone;
234
208
  const formattedDate = dateObj.toLocaleString("en-US", {
235
209
  timeZone: zone,
236
210
  year: "numeric",
@@ -311,18 +285,17 @@ function getStatusDotColor(eventType) {
311
285
  return "var(--ds-gray-600)";
312
286
  }
313
287
  function buildNameMaps(events, run) {
314
- var _a, _b;
315
288
  const correlationNameMap = /* @__PURE__ */ new Map();
316
289
  if (events) {
317
290
  for (const event of events) {
318
291
  if (event.eventType === "step_created" && event.correlationId) {
319
- const stepName = ((_a = event.eventData) == null ? void 0 : _a.stepName) ?? "";
292
+ const stepName = event.eventData?.stepName ?? "";
320
293
  const parsed = parseStepName(String(stepName));
321
- correlationNameMap.set(event.correlationId, (parsed == null ? void 0 : parsed.shortName) ?? stepName);
294
+ correlationNameMap.set(event.correlationId, parsed?.shortName ?? stepName);
322
295
  }
323
296
  }
324
297
  }
325
- const workflowName = (run == null ? void 0 : run.workflowName) ? ((_b = parseWorkflowName(run.workflowName)) == null ? void 0 : _b.shortName) ?? run.workflowName : null;
298
+ const workflowName = run?.workflowName ? parseWorkflowName(run.workflowName)?.shortName ?? run.workflowName : null;
326
299
  return { correlationNameMap, workflowName };
327
300
  }
328
301
  function buildDurationMap(events) {
@@ -571,7 +544,7 @@ function EventRow({ event, index, isFirst, isLast, isExpanded, onToggleExpand, a
571
544
  const [hasAttemptedLoad, setHasAttemptedLoad] = reactExports.useState(cachedEventData !== null);
572
545
  reactExports.useEffect(() => {
573
546
  if (cachedEventData !== null && !encryptionKey && hasEncryptedValues(cachedEventData)) {
574
- onEncryptedDataDetected == null ? void 0 : onEncryptedDataDetected();
547
+ onEncryptedDataDetected?.();
575
548
  }
576
549
  }, []);
577
550
  const rowGroupKey = isRunLevel(event.eventType) ? "__run__" : event.correlationId ?? void 0;
@@ -614,7 +587,7 @@ function EventRow({ event, index, isFirst, isLast, isExpanded, onToggleExpand, a
614
587
  setLoadedEventData(data);
615
588
  onCacheEventData(event.eventId, data);
616
589
  if (!encryptionKey && hasEncryptedValues(data)) {
617
- onEncryptedDataDetected == null ? void 0 : onEncryptedDataDetected();
590
+ onEncryptedDataDetected?.();
618
591
  }
619
592
  }
620
593
  } catch (err) {
@@ -702,7 +675,7 @@ function EventRow({ event, index, isFirst, isLast, isExpanded, onToggleExpand, a
702
675
  borderColor: "var(--ds-gray-alpha-200)",
703
676
  opacity: contentOpacity,
704
677
  transition: "opacity 150ms"
705
- }, children: [((durationInfo == null ? void 0 : durationInfo.queued) !== void 0 || (durationInfo == null ? void 0 : durationInfo.ran) !== void 0) && jsxRuntimeExports.jsxs("div", { className: "px-2 pb-1.5 text-xs flex gap-3", style: { color: "var(--ds-gray-900)" }, children: [durationInfo.queued !== void 0 && durationInfo.queued > 0 && jsxRuntimeExports.jsxs("span", { children: ["Queued for", " ", jsxRuntimeExports.jsx("span", { className: "font-mono tabular-nums", children: formatDuration(durationInfo.queued) })] }), durationInfo.ran !== void 0 && jsxRuntimeExports.jsxs("span", { children: ["Ran for", " ", jsxRuntimeExports.jsx("span", { className: "font-mono tabular-nums", children: formatDuration(durationInfo.ran) })] })] }), displayPayload != null ? jsxRuntimeExports.jsx(PayloadBlock, { data: displayPayload, eventType: event.eventType }) : loadError ? jsxRuntimeExports.jsx("div", { className: "rounded-md border p-3 text-xs", style: {
678
+ }, children: [(durationInfo?.queued !== void 0 || durationInfo?.ran !== void 0) && jsxRuntimeExports.jsxs("div", { className: "px-2 pb-1.5 text-xs flex gap-3", style: { color: "var(--ds-gray-900)" }, children: [durationInfo.queued !== void 0 && durationInfo.queued > 0 && jsxRuntimeExports.jsxs("span", { children: ["Queued for", " ", jsxRuntimeExports.jsx("span", { className: "font-mono tabular-nums", children: formatDuration(durationInfo.queued) })] }), durationInfo.ran !== void 0 && jsxRuntimeExports.jsxs("span", { children: ["Ran for", " ", jsxRuntimeExports.jsx("span", { className: "font-mono tabular-nums", children: formatDuration(durationInfo.ran) })] })] }), displayPayload != null ? jsxRuntimeExports.jsx(PayloadBlock, { data: displayPayload, eventType: event.eventType }) : loadError ? jsxRuntimeExports.jsx("div", { className: "rounded-md border p-3 text-xs", style: {
706
679
  borderColor: "var(--ds-red-400)",
707
680
  backgroundColor: "var(--ds-red-100)",
708
681
  color: "var(--ds-red-900)"
@@ -846,7 +819,6 @@ function EventListViewInner({ events, run, onLoadEventData, hasMoreEvents = fals
846
819
  const abortController = new AbortController();
847
820
  const timer = setTimeout(() => {
848
821
  void (async () => {
849
- var _a;
850
822
  try {
851
823
  const results = await onExactIdSearch(parsed.id, parsed.kind, abortController.signal);
852
824
  if (abortController.signal.aborted || searchRequestRef.current !== requestId) {
@@ -878,7 +850,7 @@ function EventListViewInner({ events, run, onLoadEventData, hasMoreEvents = fals
878
850
  return void 0;
879
851
  return isRunLevel(first.eventType) ? "__run__" : first.correlationId ?? void 0;
880
852
  })() : parsed.id);
881
- (_a = virtuosoRef.current) == null ? void 0 : _a.scrollToIndex({
853
+ virtuosoRef.current?.scrollToIndex({
882
854
  index: 0,
883
855
  align: "start",
884
856
  behavior: "smooth"
@@ -966,7 +938,7 @@ function EventListViewInner({ events, run, onLoadEventData, hasMoreEvents = fals
966
938
  if (isExactSearchActive || !hasMoreEvents || isLoadingMoreEvents) {
967
939
  return;
968
940
  }
969
- void (onLoadMoreEvents == null ? void 0 : onLoadMoreEvents());
941
+ void onLoadMoreEvents?.();
970
942
  }, itemContent: (index) => {
971
943
  const ev = sortedEvents[index];
972
944
  return jsxRuntimeExports.jsx(EventRow, { event: ev, index, isFirst: index === 0, isLast: index === sortedEvents.length - 1, isExpanded: expandedEventIds.has(ev.eventId), onToggleExpand: toggleEventExpanded, activeGroupKey, selectedGroupKey, selectedGroupRange, correlationNameMap, workflowName, durationMap, onSelectGroup, onHoverGroup, onLoadEventData, cachedEventData: eventDataCacheRef.current.get(ev.eventId) ?? null, onCacheEventData: cacheEventData, encryptionKey, onEncryptedDataDetected: handleEncryptedDataDetected, suppressGroupDimming: isExactSearchActive });
@@ -974,7 +946,7 @@ function EventListViewInner({ events, run, onLoadEventData, hasMoreEvents = fals
974
946
  borderColor: "var(--ds-gray-alpha-200)",
975
947
  color: "var(--ds-gray-900)",
976
948
  backgroundColor: "var(--ds-background-100)"
977
- }, children: [jsxRuntimeExports.jsx("span", { children: isExactSearchActive ? searchError ? searchError : searchNotFound ? `No events found for ${searchQuery.trim()}` : `${sortedEvents.length} event${sortedEvents.length !== 1 ? "s" : ""} for ${searchQuery.trim()}${searchResultsTruncated ? " (results may be truncated)" : ""}` : `${sortedEvents.length} event${sortedEvents.length !== 1 ? "s" : ""} loaded` }), !isExactSearchActive && hasMoreEvents && jsxRuntimeExports.jsx("div", { className: "absolute inset-0 flex items-center justify-center pointer-events-none", children: jsxRuntimeExports.jsx("div", { className: "pointer-events-auto", children: jsxRuntimeExports.jsx(LoadMoreButton, { loading: isLoadingMoreEvents, onClick: () => void (onLoadMoreEvents == null ? void 0 : onLoadMoreEvents()) }) }) })] })] }) });
949
+ }, children: [jsxRuntimeExports.jsx("span", { children: isExactSearchActive ? searchError ? searchError : searchNotFound ? `No events found for ${searchQuery.trim()}` : `${sortedEvents.length} event${sortedEvents.length !== 1 ? "s" : ""} for ${searchQuery.trim()}${searchResultsTruncated ? " (results may be truncated)" : ""}` : `${sortedEvents.length} event${sortedEvents.length !== 1 ? "s" : ""} loaded` }), !isExactSearchActive && hasMoreEvents && jsxRuntimeExports.jsx("div", { className: "absolute inset-0 flex items-center justify-center pointer-events-none", children: jsxRuntimeExports.jsx("div", { className: "pointer-events-auto", children: jsxRuntimeExports.jsx(LoadMoreButton, { loading: isLoadingMoreEvents, onClick: () => void onLoadMoreEvents?.() }) }) })] })] }) });
978
950
  }
979
951
  function EventListView(props) {
980
952
  return jsxRuntimeExports.jsx(ContextCardProvider, { children: jsxRuntimeExports.jsx(EventListViewInner, { ...props }) });
@@ -1063,17 +1035,17 @@ function parseContent(content) {
1063
1035
  if (typeof part === "string") {
1064
1036
  return { type: "text", text: part };
1065
1037
  }
1066
- if ((part == null ? void 0 : part.type) === "text") {
1038
+ if (part?.type === "text") {
1067
1039
  return { type: "text", text: String(part.text ?? "") };
1068
1040
  }
1069
- if ((part == null ? void 0 : part.type) === "tool-call") {
1041
+ if (part?.type === "tool-call") {
1070
1042
  return {
1071
1043
  type: "tool-call",
1072
1044
  toolName: part.toolName,
1073
1045
  input: part.input
1074
1046
  };
1075
1047
  }
1076
- if ((part == null ? void 0 : part.type) === "tool-result") {
1048
+ if (part?.type === "tool-result") {
1077
1049
  return {
1078
1050
  type: "tool-result",
1079
1051
  toolName: part.toolName,
@@ -1117,7 +1089,7 @@ function DetailCard({ summary, children, onToggle, disabled = false, summaryClas
1117
1089
  opacity: 0.8
1118
1090
  }, children: summary });
1119
1091
  }
1120
- return jsxRuntimeExports.jsxs("details", { className: "group", onToggle: (e) => onToggle == null ? void 0 : onToggle(e.target.open), children: [jsxRuntimeExports.jsx("summary", { className: `cursor-pointer rounded-md border px-2.5 py-1.5 text-xs hover:brightness-95 [&::-webkit-details-marker]:hidden ${summaryClassName ?? ""}`, style: {
1092
+ return jsxRuntimeExports.jsxs("details", { className: "group", onToggle: (e) => onToggle?.(e.target.open), children: [jsxRuntimeExports.jsx("summary", { className: `cursor-pointer rounded-md border px-2.5 py-1.5 text-xs hover:brightness-95 [&::-webkit-details-marker]:hidden ${summaryClassName ?? ""}`, style: {
1121
1093
  borderColor: "var(--ds-gray-300)",
1122
1094
  backgroundColor: "var(--ds-gray-100)",
1123
1095
  color: "var(--ds-gray-900)",
@@ -1300,15 +1272,9 @@ const timestampWithTooltipOrNull = (value) => {
1300
1272
  };
1301
1273
  const attributeToDisplayFn = {
1302
1274
  // Names that need pretty-printing
1303
- workflowName: (value) => {
1304
- var _a;
1305
- return ((_a = parseWorkflowName(String(value))) == null ? void 0 : _a.shortName) ?? "?";
1306
- },
1275
+ workflowName: (value) => parseWorkflowName(String(value))?.shortName ?? "?",
1307
1276
  moduleSpecifier: (value) => getModuleSpecifierFromName(value),
1308
- stepName: (value) => {
1309
- var _a;
1310
- return ((_a = parseStepName(String(value))) == null ? void 0 : _a.shortName) ?? "?";
1311
- },
1277
+ stepName: (value) => parseStepName(String(value))?.shortName ?? "?",
1312
1278
  // IDs
1313
1279
  runId: (value) => String(value),
1314
1280
  stepId: (value) => String(value),
@@ -1366,7 +1332,7 @@ const attributeToDisplayFn = {
1366
1332
  const hasClosureVars = hasDisplayContent(closureVars);
1367
1333
  const hasThisVal = hasDisplayContent(thisVal);
1368
1334
  const hasArgs = hasDisplayContent(args);
1369
- if ((context == null ? void 0 : context.stepName) && isDoStreamStep(context.stepName)) {
1335
+ if (context?.stepName && isDoStreamStep(context.stepName)) {
1370
1336
  const conversation = extractConversation(args);
1371
1337
  if (conversation && conversation.length > 0) {
1372
1338
  return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [jsxRuntimeExports.jsx(ConversationWithTabs, { conversation, args }), hasClosureVars && jsxRuntimeExports.jsx(DetailCard, { summary: "Closure Variables", children: JsonBlock(closureVars) }), hasThisVal && jsxRuntimeExports.jsx(DetailCard, { summary: "This Value", children: JsonBlock(thisVal) })] });
@@ -1450,7 +1416,7 @@ const AttributePanel = ({ data, moduleSpecifier, isLoading, error, expiredAt, on
1450
1416
  const displayData = reactExports.useMemo(() => {
1451
1417
  const result = { ...data };
1452
1418
  const execCtx = data.executionContext;
1453
- if (execCtx == null ? void 0 : execCtx.workflowCoreVersion) {
1419
+ if (execCtx?.workflowCoreVersion) {
1454
1420
  result.workflowCoreVersion = execCtx.workflowCoreVersion;
1455
1421
  }
1456
1422
  if (moduleSpecifier) {
@@ -1516,8 +1482,7 @@ const AttributePanel = ({ data, moduleSpecifier, isLoading, error, expiredAt, on
1516
1482
  return jsxRuntimeExports.jsx(ContextCardProvider, { children: jsxRuntimeExports.jsx(StreamClickContext.Provider, { value: onStreamClick, children: jsxRuntimeExports.jsx(DecryptClickContext.Provider, { value: onDecrypt ? { onDecrypt, isDecrypting } : void 0, children: jsxRuntimeExports.jsxs("div", { children: [visibleBasicAttributes.length > 0 && jsxRuntimeExports.jsxs("div", { className: "mb-3 flex flex-col overflow-hidden rounded-lg border", style: {
1517
1483
  borderColor: "var(--ds-gray-300)"
1518
1484
  }, children: [orderedBasicAttributes.map((attribute, index) => {
1519
- var _a;
1520
- const displayValue = (_a = attributeToDisplayFn[attribute]) == null ? void 0 : _a.call(attributeToDisplayFn, displayData[attribute]);
1485
+ const displayValue = attributeToDisplayFn[attribute]?.(displayData[attribute]);
1521
1486
  const isModuleSpecifier = attribute === "moduleSpecifier";
1522
1487
  const moduleSpecifierValue = typeof displayValue === "string" ? displayValue : String(displayValue ?? displayData.moduleSpecifier ?? "");
1523
1488
  const shouldCapitalizeLabel = attribute !== "workflowCoreVersion";
@@ -1557,7 +1522,7 @@ function EventItem({ event, onLoadEventData, encryptionKey }) {
1557
1522
  const loadEventData = reactExports.useCallback(async (options) => {
1558
1523
  if (!onLoadEventData || !event.correlationId || !event.eventId)
1559
1524
  return;
1560
- if (!(options == null ? void 0 : options.force) && loadedDataRef.current !== null) {
1525
+ if (!options?.force && loadedDataRef.current !== null) {
1561
1526
  return;
1562
1527
  }
1563
1528
  try {
@@ -1644,9 +1609,9 @@ function EntityDetailPanel({ run, onStreamClick, spanDetailData, spanDetailError
1644
1609
  const [showResolveHookModal, setShowResolveHookModal] = reactExports.useState(false);
1645
1610
  const [resolvingHook, setResolvingHook] = reactExports.useState(false);
1646
1611
  const [resolvedHookIds, setResolvedHookIds] = reactExports.useState(/* @__PURE__ */ new Set());
1647
- const data = selectedSpan == null ? void 0 : selectedSpan.data;
1648
- const rawEvents = selectedSpan == null ? void 0 : selectedSpan.rawEvents;
1649
- const rawEventsLength = (rawEvents == null ? void 0 : rawEvents.length) ?? 0;
1612
+ const data = selectedSpan?.data;
1613
+ const rawEvents = selectedSpan?.rawEvents;
1614
+ const rawEventsLength = rawEvents?.length ?? 0;
1650
1615
  const { resource, resourceId, runId } = reactExports.useMemo(() => {
1651
1616
  if (!selectedSpan) {
1652
1617
  return { resource: void 0, resourceId: void 0, runId: void 0 };
@@ -1666,7 +1631,7 @@ function EntityDetailPanel({ run, onStreamClick, spanDetailData, spanDetailError
1666
1631
  return {
1667
1632
  resource: "sleep",
1668
1633
  resourceId: selectedSpan.spanId,
1669
- runId: waitData == null ? void 0 : waitData.runId
1634
+ runId: waitData?.runId
1670
1635
  };
1671
1636
  }
1672
1637
  return { resource: void 0, resourceId: void 0, runId: void 0 };
@@ -1988,7 +1953,6 @@ function CursorMarker({ memoCacheRef, timelineRef, root, spans, events, scale, d
1988
1953
  };
1989
1954
  let nextFrame = 0;
1990
1955
  const onFrame = () => {
1991
- var _a, _b, _c, _d, _e, _f, _g, _h;
1992
1956
  if (!hasEnteredRef.current)
1993
1957
  return;
1994
1958
  if (!rectRef.current)
@@ -2004,9 +1968,9 @@ function CursorMarker({ memoCacheRef, timelineRef, root, spans, events, scale, d
2004
1968
  const t = root.startTime + left / scale;
2005
1969
  const labelT = t - root.startTime;
2006
1970
  if (labelT < 0 || labelT > root.duration) {
2007
- (_a = labelTextRef.current) == null ? void 0 : _a.removeAttribute("data-text");
1971
+ labelTextRef.current?.removeAttribute("data-text");
2008
1972
  } else {
2009
- (_b = labelTextRef.current) == null ? void 0 : _b.setAttribute("data-text", formatTimeSelection(labelT));
1973
+ labelTextRef.current?.setAttribute("data-text", formatTimeSelection(labelT));
2010
1974
  }
2011
1975
  if (isDragging) {
2012
1976
  const xDelta = x - xStart;
@@ -2037,8 +2001,8 @@ function CursorMarker({ memoCacheRef, timelineRef, root, spans, events, scale, d
2037
2001
  t1 = labelT;
2038
2002
  t2 = labelTStart;
2039
2003
  }
2040
- (_c = selectionRef.current) == null ? void 0 : _c.setAttribute("data-range", `${formatTimeSelection(t1)} — ${formatTimeSelection(t2)}`);
2041
- (_d = selectionRef.current) == null ? void 0 : _d.setAttribute("data-duration", `${formatTimeSelection(t2 - t1)} selected`);
2004
+ selectionRef.current?.setAttribute("data-range", `${formatTimeSelection(t1)} — ${formatTimeSelection(t2)}`);
2005
+ selectionRef.current?.setAttribute("data-duration", `${formatTimeSelection(t2 - t1)} selected`);
2042
2006
  }
2043
2007
  if (Date.now() < hoverStartT) {
2044
2008
  nextFrame = requestAnimationFrame(onFrame);
@@ -2051,11 +2015,11 @@ function CursorMarker({ memoCacheRef, timelineRef, root, spans, events, scale, d
2051
2015
  return;
2052
2016
  }
2053
2017
  if (x - rect.left < 128) {
2054
- (_e = labelTextRef.current) == null ? void 0 : _e.setAttribute("data-align", "left");
2018
+ labelTextRef.current?.setAttribute("data-align", "left");
2055
2019
  } else if (x - rect.left > rect.width - 128) {
2056
- (_f = labelTextRef.current) == null ? void 0 : _f.setAttribute("data-align", "right");
2020
+ labelTextRef.current?.setAttribute("data-align", "right");
2057
2021
  } else {
2058
- (_g = labelTextRef.current) == null ? void 0 : _g.removeAttribute("data-align");
2022
+ labelTextRef.current?.removeAttribute("data-align");
2059
2023
  }
2060
2024
  if (!hasMoved && !isExternalDrag) {
2061
2025
  const cache = memoCacheRef.current;
@@ -2084,7 +2048,7 @@ function CursorMarker({ memoCacheRef, timelineRef, root, spans, events, scale, d
2084
2048
  if (event.isHovered === isHovered)
2085
2049
  continue;
2086
2050
  event.isHovered = isHovered;
2087
- const $event = (_h = event.ref) == null ? void 0 : _h.current;
2051
+ const $event = event.ref?.current;
2088
2052
  if (!$event)
2089
2053
  continue;
2090
2054
  $event.setAttribute("data-hovered", String(isHovered));
@@ -2116,7 +2080,6 @@ function CursorMarker({ memoCacheRef, timelineRef, root, spans, events, scale, d
2116
2080
  event.preventDefault();
2117
2081
  };
2118
2082
  const onMouseDown = (event) => {
2119
- var _a;
2120
2083
  if (event.button === 2) {
2121
2084
  isRightClick = true;
2122
2085
  event.preventDefault();
@@ -2125,7 +2088,7 @@ function CursorMarker({ memoCacheRef, timelineRef, root, spans, events, scale, d
2125
2088
  } else {
2126
2089
  isRightClick = false;
2127
2090
  }
2128
- if ((_a = timelineRef.current) == null ? void 0 : _a.contains(event.target)) {
2091
+ if (timelineRef.current?.contains(event.target)) {
2129
2092
  xStart = x;
2130
2093
  isDragging = true;
2131
2094
  } else {
@@ -2229,12 +2192,12 @@ function CursorMarker({ memoCacheRef, timelineRef, root, spans, events, scale, d
2229
2192
  const $timeline = timelineRef.current;
2230
2193
  if (!$timeline)
2231
2194
  return;
2232
- rectRef.current ?? (rectRef.current = $timeline.getBoundingClientRect());
2195
+ rectRef.current ??= $timeline.getBoundingClientRect();
2233
2196
  const rect = rectRef.current;
2234
2197
  const anchorX = Math.max(0, Math.min(xRef.current - rect.left - TIMELINE_PADDING, rect.width - 2 * TIMELINE_PADDING));
2235
2198
  let anchorT = 0;
2236
2199
  let existing = trackpadZoomRef.current;
2237
- if ((existing == null ? void 0 : existing.anchorX) === anchorX) {
2200
+ if (existing?.anchorX === anchorX) {
2238
2201
  anchorT = existing.anchorT;
2239
2202
  } else {
2240
2203
  anchorT = ($timeline.scrollLeft + anchorX) / scale;
@@ -2492,12 +2455,9 @@ const useStreamingSpans = (highlightedSpans, eagerRender = false) => {
2492
2455
  const [visibleEvents, setVisibleEvents] = reactExports.useState(emptyArrayInit);
2493
2456
  const [resultScale, setResultScale] = reactExports.useState(-1);
2494
2457
  const updateFilterRef = reactExports.useRef(void 0);
2458
+ reactExports.useEffect(() => updateFilterRef.current?.(ctxFilter), [ctxFilter]);
2495
2459
  reactExports.useEffect(() => {
2496
- var _a;
2497
- return (_a = updateFilterRef.current) == null ? void 0 : _a.call(updateFilterRef, ctxFilter);
2498
- }, [ctxFilter]);
2499
- reactExports.useEffect(() => {
2500
- if (!(highlightedSpans == null ? void 0 : highlightedSpans.length))
2460
+ if (!highlightedSpans?.length)
2501
2461
  return;
2502
2462
  for (const row of rows) {
2503
2463
  for (const node of row) {
@@ -2517,23 +2477,22 @@ const useStreamingSpans = (highlightedSpans, eagerRender = false) => {
2517
2477
  return;
2518
2478
  const worker = new Worker(new URL(
2519
2479
  /* @vite-ignore */
2520
- "/assets/worker-CqHKTA7D.js",
2480
+ "/assets/worker-DxRAeS-i.js",
2521
2481
  import.meta.url
2522
2482
  ), {
2523
2483
  type: "module"
2524
2484
  });
2525
2485
  let requestId = ++counterRef.current;
2526
2486
  const onMessage = (event) => {
2527
- var _a;
2528
2487
  const data = event.data;
2529
2488
  switch (data.type) {
2530
2489
  case "setRowsResult": {
2531
- if ((data == null ? void 0 : data.requestId) !== requestId)
2490
+ if (data?.requestId !== requestId)
2532
2491
  return;
2533
2492
  if (data.isEnd) {
2534
2493
  for (const row of data.rows) {
2535
2494
  for (const node of row) {
2536
- node.span = ((_a = spanMap[node.span.spanId]) == null ? void 0 : _a.span) ?? node.span;
2495
+ node.span = spanMap[node.span.spanId]?.span ?? node.span;
2537
2496
  }
2538
2497
  }
2539
2498
  }
@@ -2541,7 +2500,7 @@ const useStreamingSpans = (highlightedSpans, eagerRender = false) => {
2541
2500
  break;
2542
2501
  }
2543
2502
  case "updateHighlight": {
2544
- if ((data == null ? void 0 : data.requestId) !== requestId)
2503
+ if (data?.requestId !== requestId)
2545
2504
  return;
2546
2505
  const { matches } = data;
2547
2506
  setRows((previous) => {
@@ -2625,7 +2584,7 @@ const useStreamingSpans = (highlightedSpans, eagerRender = false) => {
2625
2584
  const queue = new Array(rows.length).fill(null);
2626
2585
  const buildQueue = () => {
2627
2586
  isDone = true;
2628
- const lastRow = Math.min(1 + currentD + Math.ceil((snapshot == null ? void 0 : snapshot.endRow) ?? Number.POSITIVE_INFINITY), rows.length);
2587
+ const lastRow = Math.min(1 + currentD + Math.ceil(snapshot?.endRow ?? Number.POSITIVE_INFINITY), rows.length);
2629
2588
  for (let i = lastRow; i--; ) {
2630
2589
  if (queue[i])
2631
2590
  continue;
@@ -2739,7 +2698,7 @@ const useStreamingSpans = (highlightedSpans, eagerRender = false) => {
2739
2698
  ignoreT = Date.now();
2740
2699
  }
2741
2700
  };
2742
- $timeline == null ? void 0 : $timeline.addEventListener("wheel", onWheel);
2701
+ $timeline?.addEventListener("wheel", onWheel);
2743
2702
  const onScroll = () => {
2744
2703
  if (Date.now() - ignoreT <= 50)
2745
2704
  return;
@@ -2747,11 +2706,11 @@ const useStreamingSpans = (highlightedSpans, eagerRender = false) => {
2747
2706
  cancelAnimationFrame(nextFrame);
2748
2707
  nextFrame = requestAnimationFrame(onFrame);
2749
2708
  };
2750
- $timeline == null ? void 0 : $timeline.addEventListener("scroll", onScroll);
2709
+ $timeline?.addEventListener("scroll", onScroll);
2751
2710
  return () => {
2752
2711
  cancelAnimationFrame(nextFrame);
2753
- $timeline == null ? void 0 : $timeline.removeEventListener("wheel", onWheel);
2754
- $timeline == null ? void 0 : $timeline.removeEventListener("scroll", onScroll);
2712
+ $timeline?.removeEventListener("wheel", onWheel);
2713
+ $timeline?.removeEventListener("scroll", onScroll);
2755
2714
  };
2756
2715
  }, [
2757
2716
  rows,
@@ -2764,7 +2723,6 @@ const useStreamingSpans = (highlightedSpans, eagerRender = false) => {
2764
2723
  eagerRender
2765
2724
  ]);
2766
2725
  reactExports.useEffect(() => {
2767
- var _a;
2768
2726
  if (!selected)
2769
2727
  return;
2770
2728
  let span;
@@ -2774,7 +2732,7 @@ const useStreamingSpans = (highlightedSpans, eagerRender = false) => {
2774
2732
  break;
2775
2733
  }
2776
2734
  }
2777
- const $span = (_a = span == null ? void 0 : span.ref) == null ? void 0 : _a.current;
2735
+ const $span = span?.ref?.current;
2778
2736
  if (!span || !$span)
2779
2737
  return;
2780
2738
  span.isSelected = true;
@@ -2851,7 +2809,7 @@ function TraceViewerTimeline({ trace = skeletonTrace, className = "", scrollLock
2851
2809
  const { state, dispatch } = useTraceViewer();
2852
2810
  const { timelineRef, scrollSnapshotRef } = state;
2853
2811
  const memoCache = state.memoCacheRef.current;
2854
- const hideSearchBar = ((highlightedSpans == null ? void 0 : highlightedSpans.length) ?? 0) > 0;
2812
+ const hideSearchBar = (highlightedSpans?.length ?? 0) > 0;
2855
2813
  const hasInitializedRef = reactExports.useRef(false);
2856
2814
  const prevSpanKeyRef = reactExports.useRef("");
2857
2815
  const prevRootRef = reactExports.useRef(null);
@@ -2863,10 +2821,10 @@ function TraceViewerTimeline({ trace = skeletonTrace, className = "", scrollLock
2863
2821
  hasInitializedRef.current = true;
2864
2822
  const spanKey = Object.keys(newSpanMap).sort().map((id) => {
2865
2823
  const events2 = newSpanMap[id].events;
2866
- const count = (events2 == null ? void 0 : events2.length) ?? 0;
2867
- const first = count ? events2 == null ? void 0 : events2[0] : void 0;
2868
- const last = count ? events2 == null ? void 0 : events2[count - 1] : void 0;
2869
- const eventSignature = `${(first == null ? void 0 : first.event.name) ?? "none"}@${(first == null ? void 0 : first.timestamp) ?? 0}|${(last == null ? void 0 : last.event.name) ?? "none"}@${(last == null ? void 0 : last.timestamp) ?? 0}`;
2824
+ const count = events2?.length ?? 0;
2825
+ const first = count ? events2?.[0] : void 0;
2826
+ const last = count ? events2?.[count - 1] : void 0;
2827
+ const eventSignature = `${first?.event.name ?? "none"}@${first?.timestamp ?? 0}|${last?.event.name ?? "none"}@${last?.timestamp ?? 0}`;
2870
2828
  return `${id}:${count}:${eventSignature}`;
2871
2829
  }).join(",");
2872
2830
  if (!isInitial && spanKey === prevSpanKeyRef.current && prevRootRef.current) {
@@ -2970,7 +2928,7 @@ function TraceViewerTimeline({ trace = skeletonTrace, className = "", scrollLock
2970
2928
  if (!target.closest(`.${String(styles.timeline)}`))
2971
2929
  return;
2972
2930
  const $button = target.closest("[data-span-id]");
2973
- const spanId = ($button == null ? void 0 : $button.dataset.spanId) || "";
2931
+ const spanId = $button?.dataset.spanId || "";
2974
2932
  lastClickRef.current = {
2975
2933
  x,
2976
2934
  y,
@@ -2996,13 +2954,12 @@ function TraceViewerTimeline({ trace = skeletonTrace, className = "", scrollLock
2996
2954
  }
2997
2955
  }, [scrollSnapshotRef, timelineRef, scale]);
2998
2956
  reactExports.useEffect(() => {
2999
- var _a;
3000
- const spanId = (_a = state.selected) == null ? void 0 : _a.span.spanId;
2957
+ const spanId = state.selected?.span.spanId;
3001
2958
  if (!spanId)
3002
2959
  return;
3003
2960
  const timeout = setTimeout(() => {
3004
2961
  const $timeline = state.timelineRef.current;
3005
- const $span = $timeline == null ? void 0 : $timeline.querySelector(`[data-span-id="${spanId}"]`);
2962
+ const $span = $timeline?.querySelector(`[data-span-id="${spanId}"]`);
3006
2963
  if (!$timeline || !$span)
3007
2964
  return;
3008
2965
  const viewRect = $timeline.getBoundingClientRect();
@@ -3040,7 +2997,7 @@ function TraceViewerTimeline({ trace = skeletonTrace, className = "", scrollLock
3040
2997
  $html.style.overflow = "clip";
3041
2998
  $body.style.overflow = "clip";
3042
2999
  const onScroll = (event) => {
3043
- if (event == null ? void 0 : event.cancelable) {
3000
+ if (event?.cancelable) {
3044
3001
  event.preventDefault();
3045
3002
  } else {
3046
3003
  window.scrollTo({
@@ -3135,19 +3092,19 @@ function isSleepStep(stepName) {
3135
3092
  }
3136
3093
  const getCustomSpanClassName = (span) => {
3137
3094
  const attributes = span.span.attributes;
3138
- const resource = attributes == null ? void 0 : attributes.resource;
3095
+ const resource = attributes?.resource;
3139
3096
  if (resource === "step") {
3140
3097
  const stepData = attributes.data;
3141
- const stepName = stepData == null ? void 0 : stepData.stepName;
3098
+ const stepName = stepData?.stepName;
3142
3099
  if (stepName && isSleepStep(stepName)) {
3143
3100
  return styles.spanSleep;
3144
3101
  }
3145
- const isStripped = (stepData == null ? void 0 : stepData.status) === "pending";
3146
- return getStatusClassName(stepData == null ? void 0 : stepData.status, isStripped);
3102
+ const isStripped = stepData?.status === "pending";
3103
+ return getStatusClassName(stepData?.status, isStripped);
3147
3104
  }
3148
3105
  if (resource === "run") {
3149
3106
  const runData = attributes.data;
3150
- return getStatusClassName(runData == null ? void 0 : runData.status, false);
3107
+ return getStatusClassName(runData?.status, false);
3151
3108
  }
3152
3109
  if (resource === "hook") {
3153
3110
  return styles.spanHook;
@@ -3252,7 +3209,6 @@ function convertEventsToSpanEvents(events, filterTypes = true) {
3252
3209
  }));
3253
3210
  }
3254
3211
  const waitEventsToWaitEntity = (events) => {
3255
- var _a;
3256
3212
  const startEvent = events.find((event) => event.eventType === "wait_created");
3257
3213
  if (!startEvent) {
3258
3214
  return null;
@@ -3262,8 +3218,8 @@ const waitEventsToWaitEntity = (events) => {
3262
3218
  waitId: startEvent.correlationId,
3263
3219
  runId: startEvent.runId,
3264
3220
  createdAt: startEvent.createdAt,
3265
- resumeAt: ((_a = startEvent.eventData) == null ? void 0 : _a.resumeAt) ? new Date(startEvent.eventData.resumeAt) : void 0,
3266
- completedAt: completedEvent == null ? void 0 : completedEvent.createdAt
3221
+ resumeAt: startEvent.eventData?.resumeAt ? new Date(startEvent.eventData.resumeAt) : void 0,
3222
+ completedAt: completedEvent?.createdAt
3267
3223
  }, startEvent.occurredAt);
3268
3224
  };
3269
3225
  function waitToSpan(events, maxEndTime) {
@@ -3299,7 +3255,6 @@ function waitToSpan(events, maxEndTime) {
3299
3255
  };
3300
3256
  }
3301
3257
  const stepEventsToStepEntity = (events) => {
3302
- var _a;
3303
3258
  const createdEvent = events.find((event) => event.eventType === "step_created");
3304
3259
  const anchorEvent = createdEvent ?? events[0];
3305
3260
  if (!anchorEvent) {
@@ -3339,11 +3294,11 @@ const stepEventsToStepEntity = (events) => {
3339
3294
  return withOccurredAt({
3340
3295
  stepId: anchorEvent.correlationId ?? "",
3341
3296
  runId: anchorEvent.runId,
3342
- stepName: ((_a = createdEvent == null ? void 0 : createdEvent.eventData) == null ? void 0 : _a.stepName) ?? "",
3297
+ stepName: createdEvent?.eventData?.stepName ?? "",
3343
3298
  status,
3344
3299
  attempt,
3345
3300
  createdAt: anchorEvent.createdAt,
3346
- updatedAt: (lastEvent == null ? void 0 : lastEvent.createdAt) ?? anchorEvent.createdAt,
3301
+ updatedAt: lastEvent?.createdAt ?? anchorEvent.createdAt,
3347
3302
  startedAt,
3348
3303
  completedAt,
3349
3304
  specVersion: anchorEvent.specVersion
@@ -3370,7 +3325,7 @@ function stepToSpan(stepEvents, maxEndTime) {
3370
3325
  }
3371
3326
  return {
3372
3327
  spanId: String(step.stepId),
3373
- name: (parsedName == null ? void 0 : parsedName.shortName) ?? "",
3328
+ name: parsedName?.shortName ?? "",
3374
3329
  kind: 1,
3375
3330
  // INTERNAL span kind
3376
3331
  resource,
@@ -3388,7 +3343,6 @@ function stepToSpan(stepEvents, maxEndTime) {
3388
3343
  };
3389
3344
  }
3390
3345
  const hookEventsToHookEntity = (events) => {
3391
- var _a, _b;
3392
3346
  const createdEvent = events.find((event) => event.eventType === "hook_created");
3393
3347
  if (!createdEvent) {
3394
3348
  return null;
@@ -3399,11 +3353,11 @@ const hookEventsToHookEntity = (events) => {
3399
3353
  return withOccurredAt({
3400
3354
  hookId: createdEvent.correlationId,
3401
3355
  runId: createdEvent.runId,
3402
- token: (_a = createdEvent.eventData) == null ? void 0 : _a.token,
3356
+ token: createdEvent.eventData?.token,
3403
3357
  createdAt: createdEvent.createdAt,
3404
3358
  receivedCount: receivedEvents.length,
3405
- lastReceivedAt: (lastReceivedEvent == null ? void 0 : lastReceivedEvent.createdAt) || void 0,
3406
- disposedAt: ((_b = disposedEvents.at(-1)) == null ? void 0 : _b.createdAt) || void 0
3359
+ lastReceivedAt: lastReceivedEvent?.createdAt || void 0,
3360
+ disposedAt: disposedEvents.at(-1)?.createdAt || void 0
3407
3361
  }, createdEvent.occurredAt);
3408
3362
  };
3409
3363
  function hookToSpan(hookEvents, maxEndTime) {
@@ -3434,7 +3388,6 @@ function hookToSpan(hookEvents, maxEndTime) {
3434
3388
  };
3435
3389
  }
3436
3390
  function runToSpan(run, runEvents, nowTime) {
3437
- var _a;
3438
3391
  const now = nowTime ?? /* @__PURE__ */ new Date();
3439
3392
  const { input: _i, output: _o, error: _e, ...runIdentity } = run;
3440
3393
  const occurrenceEvent = findEventByType(runEvents, [
@@ -3443,7 +3396,7 @@ function runToSpan(run, runEvents, nowTime) {
3443
3396
  ]);
3444
3397
  const attributes = {
3445
3398
  resource: "run",
3446
- data: withOccurredAt(runIdentity, occurrenceEvent == null ? void 0 : occurrenceEvent.occurredAt)
3399
+ data: withOccurredAt(runIdentity, occurrenceEvent?.occurredAt)
3447
3400
  };
3448
3401
  const spanStartTime = new Date(run.createdAt);
3449
3402
  const activeStartTime = run.startedAt ? new Date(run.startedAt) : void 0;
@@ -3451,7 +3404,7 @@ function runToSpan(run, runEvents, nowTime) {
3451
3404
  const events = convertEventsToSpanEvents(runEvents, false);
3452
3405
  return {
3453
3406
  spanId: String(run.runId),
3454
- name: String(((_a = parseWorkflowName(run.workflowName)) == null ? void 0 : _a.shortName) ?? "?"),
3407
+ name: String(parseWorkflowName(run.workflowName)?.shortName ?? "?"),
3455
3408
  kind: 1,
3456
3409
  // INTERNAL span kind
3457
3410
  resource: "run",
@@ -3762,7 +3715,7 @@ function TraceViewerWithContextMenu({ trace, run, isLive, onWakeUpSleep, onCance
3762
3715
  return;
3763
3716
  const resourceType = span.attributes.resource ?? "unknown";
3764
3717
  const spanData = span.attributes.data;
3765
- const isActive = !(spanData == null ? void 0 : spanData.completedAt) && !(spanData == null ? void 0 : spanData.disposedAt);
3718
+ const isActive = !spanData?.completedAt && !spanData?.disposedAt;
3766
3719
  setContextMenu({
3767
3720
  x: e.clientX,
3768
3721
  y: e.clientY,
@@ -3815,7 +3768,6 @@ function TraceViewerWithContextMenu({ trace, run, isLive, onWakeUpSleep, onCance
3815
3768
  setContextMenu(null);
3816
3769
  }, []);
3817
3770
  const getMenuItems = reactExports.useCallback((menu) => {
3818
- var _a, _b;
3819
3771
  const items = [];
3820
3772
  const isRunActive2 = !run.completedAt;
3821
3773
  if (menu.resourceType === "sleep" && menu.isActive && isRunActive2 && onWakeUpSleep) {
@@ -3843,9 +3795,9 @@ function TraceViewerWithContextMenu({ trace, run, isLive, onWakeUpSleep, onCance
3843
3795
  }
3844
3796
  if (menu.resourceType === "hook" && isRunActive2 && onResolveHook) {
3845
3797
  const span = spanLookup.get(menu.spanId);
3846
- const hookData = (_a = span == null ? void 0 : span.attributes) == null ? void 0 : _a.data;
3847
- const isDisposed = Boolean(hookData == null ? void 0 : hookData.disposedAt) || Boolean((_b = span == null ? void 0 : span.events) == null ? void 0 : _b.some((e) => e.name === "hook_disposed")) || resolvedHookIds.has(menu.spanId);
3848
- if ((hookData == null ? void 0 : hookData.token) && !isDisposed) {
3798
+ const hookData = span?.attributes?.data;
3799
+ const isDisposed = Boolean(hookData?.disposedAt) || Boolean(span?.events?.some((e) => e.name === "hook_disposed")) || resolvedHookIds.has(menu.spanId);
3800
+ if (hookData?.token && !isDisposed) {
3849
3801
  items.push({
3850
3802
  label: "Resolve Hook",
3851
3803
  icon: jsxRuntimeExports.jsx(Send, { className: "h-3.5 w-3.5" }),
@@ -3921,15 +3873,14 @@ function SelectionBridge({ onSelectionChange }) {
3921
3873
  onSelectionChangeRef.current = onSelectionChange;
3922
3874
  const prevSpanIdRef = reactExports.useRef(void 0);
3923
3875
  reactExports.useEffect(() => {
3924
- var _a, _b;
3925
- const currentSpanId = selected == null ? void 0 : selected.span.spanId;
3876
+ const currentSpanId = selected?.span.spanId;
3926
3877
  if (currentSpanId === prevSpanIdRef.current)
3927
3878
  return;
3928
3879
  prevSpanIdRef.current = currentSpanId;
3929
3880
  if (selected) {
3930
3881
  onSelectionChangeRef.current({
3931
- data: (_a = selected.span.attributes) == null ? void 0 : _a.data,
3932
- resource: (_b = selected.span.attributes) == null ? void 0 : _b.resource,
3882
+ data: selected.span.attributes?.data,
3883
+ resource: selected.span.attributes?.resource,
3933
3884
  spanId: selected.span.spanId
3934
3885
  });
3935
3886
  } else {
@@ -3950,7 +3901,7 @@ function DeselectBridge({ triggerDeselect }) {
3950
3901
  function SelectBridge({ selectRequest }) {
3951
3902
  const { dispatch } = useTraceViewer();
3952
3903
  reactExports.useEffect(() => {
3953
- if (selectRequest == null ? void 0 : selectRequest.id) {
3904
+ if (selectRequest?.id) {
3954
3905
  dispatch({ type: "select", id: selectRequest.id });
3955
3906
  }
3956
3907
  }, [dispatch, selectRequest]);
@@ -3992,7 +3943,7 @@ const WorkflowTraceViewer = ({ run, events, isLoading, error, spanDetailData, sp
3992
3943
  const [selectRequest, setSelectRequest] = reactExports.useState(null);
3993
3944
  const isLive = Boolean(run && !run.completedAt);
3994
3945
  const traceWithMeta = reactExports.useMemo(() => {
3995
- if (!(run == null ? void 0 : run.runId)) {
3946
+ if (!run?.runId) {
3996
3947
  return void 0;
3997
3948
  }
3998
3949
  return buildTrace(run, events, /* @__PURE__ */ new Date());
@@ -4007,7 +3958,7 @@ const WorkflowTraceViewer = ({ run, events, isLoading, error, spanDetailData, sp
4007
3958
  }
4008
3959
  }, [error, isLoading]);
4009
3960
  const handleSpanSelect = reactExports.useCallback((info) => {
4010
- onSpanSelect == null ? void 0 : onSpanSelect(info);
3961
+ onSpanSelect?.(info);
4011
3962
  }, [onSpanSelect]);
4012
3963
  const handleSelectionChange = reactExports.useCallback((info) => {
4013
3964
  if (info) {
@@ -4019,7 +3970,7 @@ const WorkflowTraceViewer = ({ run, events, isLoading, error, spanDetailData, sp
4019
3970
  }
4020
3971
  }, [events]);
4021
3972
  reactExports.useEffect(() => {
4022
- const correlationId = selectedSpan == null ? void 0 : selectedSpan.spanId;
3973
+ const correlationId = selectedSpan?.spanId;
4023
3974
  if (!correlationId)
4024
3975
  return;
4025
3976
  const nextRawEvents = events.filter((e) => e.correlationId === correlationId);
@@ -4028,10 +3979,7 @@ const WorkflowTraceViewer = ({ run, events, isLoading, error, spanDetailData, sp
4028
3979
  return prev;
4029
3980
  }
4030
3981
  const prevRawEvents = prev.rawEvents ?? [];
4031
- const isSame = prevRawEvents.length === nextRawEvents.length && prevRawEvents.every((event, index) => {
4032
- var _a;
4033
- return event.eventId === ((_a = nextRawEvents[index]) == null ? void 0 : _a.eventId);
4034
- });
3982
+ const isSame = prevRawEvents.length === nextRawEvents.length && prevRawEvents.every((event, index) => event.eventId === nextRawEvents[index]?.eventId);
4035
3983
  if (isSame) {
4036
3984
  return prev;
4037
3985
  }
@@ -4040,7 +3988,7 @@ const WorkflowTraceViewer = ({ run, events, isLoading, error, spanDetailData, sp
4040
3988
  rawEvents: nextRawEvents
4041
3989
  };
4042
3990
  });
4043
- }, [events, selectedSpan == null ? void 0 : selectedSpan.spanId]);
3991
+ }, [events, selectedSpan?.spanId]);
4044
3992
  const handleClose = reactExports.useCallback(() => {
4045
3993
  setSelectedSpan(null);
4046
3994
  setDeselectTrigger((n) => n + 1);
@@ -4049,43 +3997,40 @@ const WorkflowTraceViewer = ({ run, events, isLoading, error, spanDetailData, sp
4049
3997
  setPanelWidth((w) => Math.max(MIN_PANEL_WIDTH, w + deltaX));
4050
3998
  }, []);
4051
3999
  const selectedSpanIndex = reactExports.useMemo(() => {
4052
- if (!(selectedSpan == null ? void 0 : selectedSpan.spanId) || !trace)
4000
+ if (!selectedSpan?.spanId || !trace)
4053
4001
  return -1;
4054
4002
  return trace.spans.findIndex((span) => span.spanId === selectedSpan.spanId);
4055
- }, [selectedSpan == null ? void 0 : selectedSpan.spanId, trace]);
4003
+ }, [selectedSpan?.spanId, trace]);
4056
4004
  const canSelectPrevSpan = selectedSpanIndex > 0;
4057
4005
  const canSelectNextSpan = selectedSpanIndex >= 0 && trace != null && selectedSpanIndex < trace.spans.length - 1;
4058
4006
  const handleSelectPrevSpan = reactExports.useCallback(() => {
4059
- var _a;
4060
4007
  if (!trace || selectedSpanIndex <= 0)
4061
4008
  return;
4062
- const targetId = (_a = trace.spans[selectedSpanIndex - 1]) == null ? void 0 : _a.spanId;
4009
+ const targetId = trace.spans[selectedSpanIndex - 1]?.spanId;
4063
4010
  if (!targetId)
4064
4011
  return;
4065
4012
  setSelectRequest({ id: targetId, token: Date.now() });
4066
4013
  }, [selectedSpanIndex, trace]);
4067
4014
  const handleSelectNextSpan = reactExports.useCallback(() => {
4068
- var _a;
4069
4015
  if (!trace || selectedSpanIndex < 0)
4070
4016
  return;
4071
- const targetId = (_a = trace.spans[selectedSpanIndex + 1]) == null ? void 0 : _a.spanId;
4017
+ const targetId = trace.spans[selectedSpanIndex + 1]?.spanId;
4072
4018
  if (!targetId)
4073
4019
  return;
4074
4020
  setSelectRequest({ id: targetId, token: Date.now() });
4075
4021
  }, [selectedSpanIndex, trace]);
4076
4022
  const selectedSpanName = reactExports.useMemo(() => {
4077
- var _a, _b;
4078
- if (!(selectedSpan == null ? void 0 : selectedSpan.data))
4023
+ if (!selectedSpan?.data)
4079
4024
  return void 0;
4080
4025
  const data = selectedSpan.data;
4081
4026
  const stepName = data.stepName;
4082
4027
  const workflowName = data.workflowName;
4083
- return (stepName ? (_a = parseStepName(stepName)) == null ? void 0 : _a.shortName : void 0) ?? (workflowName ? (_b = parseWorkflowName(workflowName)) == null ? void 0 : _b.shortName : void 0) ?? stepName ?? workflowName ?? data.hookId ?? "Details";
4084
- }, [selectedSpan == null ? void 0 : selectedSpan.data]);
4028
+ return (stepName ? parseStepName(stepName)?.shortName : void 0) ?? (workflowName ? parseWorkflowName(workflowName)?.shortName : void 0) ?? stepName ?? workflowName ?? data.hookId ?? "Details";
4029
+ }, [selectedSpan?.data]);
4085
4030
  if (!trace) {
4086
4031
  return jsxRuntimeExports.jsxs("div", { className: "relative w-full h-full", children: [jsxRuntimeExports.jsx("div", { className: "border-b border-gray-alpha-400 w-full" }), jsxRuntimeExports.jsx(Skeleton, { className: "w-full ml-2 mt-1 mb-1 h-[56px]" }), jsxRuntimeExports.jsxs("div", { className: "p-2 relative w-full", children: [jsxRuntimeExports.jsx(Skeleton, { className: "w-full mt-6 h-[20px]" }), jsxRuntimeExports.jsx(Skeleton, { className: "w-[10%] mt-2 ml-6 h-[20px]" }), jsxRuntimeExports.jsx(Skeleton, { className: "w-[10%] mt-2 ml-12 h-[20px]" }), jsxRuntimeExports.jsx(Skeleton, { className: "w-[20%] mt-2 ml-16 h-[20px]" })] })] });
4087
4032
  }
4088
- return jsxRuntimeExports.jsxs("div", { className: "relative w-full h-full flex flex-row", children: [jsxRuntimeExports.jsx("div", { className: "flex-1 min-w-0 relative", children: jsxRuntimeExports.jsxs(TraceViewerContextProvider, { customSpanClassNameFunc: getCustomSpanClassName, customSpanEventClassNameFunc: getCustomSpanEventClassName, children: [jsxRuntimeExports.jsx(SelectionBridge, { onSelectionChange: handleSelectionChange }), jsxRuntimeExports.jsx(DeselectBridge, { triggerDeselect: deselectTrigger }), jsxRuntimeExports.jsx(SelectBridge, { selectRequest }), jsxRuntimeExports.jsx(TraceViewerWithContextMenu, { trace, run, isLive, onWakeUpSleep, onCancelRun, onResolveHook, onLoadMoreSpans, hasMoreSpans, isLoadingMoreSpans, children: jsxRuntimeExports.jsx(TraceViewerTimeline, { eagerRender: true, height: "100%", isLive, trace, knownDurationMs: traceWithMeta == null ? void 0 : traceWithMeta.knownDurationMs, hasMoreData: hasMoreSpans || Boolean(isLoading), footer: jsxRuntimeExports.jsx(TraceViewerFooter, { hasMore: hasMoreSpans, isLive, isInitialLoading: Boolean(isLoading) }) }) })] }) }), selectedSpan && jsxRuntimeExports.jsxs("div", { className: "relative border-l flex-shrink-0 flex flex-col", style: {
4033
+ return jsxRuntimeExports.jsxs("div", { className: "relative w-full h-full flex flex-row", children: [jsxRuntimeExports.jsx("div", { className: "flex-1 min-w-0 relative", children: jsxRuntimeExports.jsxs(TraceViewerContextProvider, { customSpanClassNameFunc: getCustomSpanClassName, customSpanEventClassNameFunc: getCustomSpanEventClassName, children: [jsxRuntimeExports.jsx(SelectionBridge, { onSelectionChange: handleSelectionChange }), jsxRuntimeExports.jsx(DeselectBridge, { triggerDeselect: deselectTrigger }), jsxRuntimeExports.jsx(SelectBridge, { selectRequest }), jsxRuntimeExports.jsx(TraceViewerWithContextMenu, { trace, run, isLive, onWakeUpSleep, onCancelRun, onResolveHook, onLoadMoreSpans, hasMoreSpans, isLoadingMoreSpans, children: jsxRuntimeExports.jsx(TraceViewerTimeline, { eagerRender: true, height: "100%", isLive, trace, knownDurationMs: traceWithMeta?.knownDurationMs, hasMoreData: hasMoreSpans || Boolean(isLoading), footer: jsxRuntimeExports.jsx(TraceViewerFooter, { hasMore: hasMoreSpans, isLive, isInitialLoading: Boolean(isLoading) }) }) })] }) }), selectedSpan && jsxRuntimeExports.jsxs("div", { className: "relative border-l flex-shrink-0 flex flex-col", style: {
4089
4034
  width: panelWidth,
4090
4035
  borderColor: "var(--ds-gray-200)",
4091
4036
  backgroundColor: "var(--ds-background-100)"
@@ -4398,7 +4343,7 @@ function useWorkflowTraceViewerData(env, runId, options = {}) {
4398
4343
  }
4399
4344
  if (!runResult.error) {
4400
4345
  const ctx = runResult.result.executionContext;
4401
- if ((ctx == null ? void 0 : ctx.features) && ctx.features.encryption) {
4346
+ if (ctx?.features && ctx.features.encryption) {
4402
4347
  setHasEncryptedData(true);
4403
4348
  } else {
4404
4349
  unwrapServerActionResult(
@@ -4456,7 +4401,7 @@ function useWorkflowTraceViewerData(env, runId, options = {}) {
4456
4401
  eventsCursor
4457
4402
  ]);
4458
4403
  const pollRun = reactExports.useCallback(async () => {
4459
- if (run == null ? void 0 : run.completedAt) {
4404
+ if (run?.completedAt) {
4460
4405
  return false;
4461
4406
  }
4462
4407
  const { error: error2, result } = await unwrapServerActionResult(
@@ -4469,7 +4414,7 @@ function useWorkflowTraceViewerData(env, runId, options = {}) {
4469
4414
  setError(null);
4470
4415
  setRun(hydrateResourceIO(result));
4471
4416
  return true;
4472
- }, [env, runId, run == null ? void 0 : run.completedAt]);
4417
+ }, [env, runId, run?.completedAt]);
4473
4418
  const pollEvents = reactExports.useCallback(
4474
4419
  () => pollResource({
4475
4420
  fetchFn: () => unwrapServerActionResult(
@@ -4511,7 +4456,7 @@ function useWorkflowTraceViewerData(env, runId, options = {}) {
4511
4456
  };
4512
4457
  }, []);
4513
4458
  reactExports.useEffect(() => {
4514
- if (!live || !initialLoadCompleted || (run == null ? void 0 : run.completedAt)) {
4459
+ if (!live || !initialLoadCompleted || run?.completedAt) {
4515
4460
  return;
4516
4461
  }
4517
4462
  const interval = setInterval(() => {
@@ -4520,7 +4465,7 @@ function useWorkflowTraceViewerData(env, runId, options = {}) {
4520
4465
  return () => {
4521
4466
  clearInterval(interval);
4522
4467
  };
4523
- }, [live, initialLoadCompleted, update, run == null ? void 0 : run.completedAt]);
4468
+ }, [live, initialLoadCompleted, update, run?.completedAt]);
4524
4469
  return {
4525
4470
  run: run ?? {},
4526
4471
  events,
@@ -4647,7 +4592,7 @@ var Primitive = NODES.reduce((primitive, node) => {
4647
4592
  const { asChild, ...primitiveProps } = props;
4648
4593
  const Comp = asChild ? Slot : node;
4649
4594
  if (typeof window !== "undefined") {
4650
- window[Symbol.for("radix-ui")] = true;
4595
+ window[/* @__PURE__ */ Symbol.for("radix-ui")] = true;
4651
4596
  }
4652
4597
  return /* @__PURE__ */ jsxRuntimeExports.jsx(Comp, { ...primitiveProps, ref: forwardedRef });
4653
4598
  });
@@ -4680,7 +4625,7 @@ var DismissableLayer = reactExports.forwardRef(
4680
4625
  } = props;
4681
4626
  const context = reactExports.useContext(DismissableLayerContext);
4682
4627
  const [node, setNode] = reactExports.useState(null);
4683
- const ownerDocument = (node == null ? void 0 : node.ownerDocument) ?? (globalThis == null ? void 0 : globalThis.document);
4628
+ const ownerDocument = node?.ownerDocument ?? globalThis?.document;
4684
4629
  const [, force] = reactExports.useState({});
4685
4630
  const composedRefs = useComposedRefs(forwardedRef, (node2) => setNode(node2));
4686
4631
  const layers = Array.from(context.layers);
@@ -4693,22 +4638,22 @@ var DismissableLayer = reactExports.forwardRef(
4693
4638
  const target = event.target;
4694
4639
  const isPointerDownOnBranch = [...context.branches].some((branch) => branch.contains(target));
4695
4640
  if (!isPointerEventsEnabled || isPointerDownOnBranch) return;
4696
- onPointerDownOutside == null ? void 0 : onPointerDownOutside(event);
4697
- onInteractOutside == null ? void 0 : onInteractOutside(event);
4698
- if (!event.defaultPrevented) onDismiss == null ? void 0 : onDismiss();
4641
+ onPointerDownOutside?.(event);
4642
+ onInteractOutside?.(event);
4643
+ if (!event.defaultPrevented) onDismiss?.();
4699
4644
  }, ownerDocument);
4700
4645
  const focusOutside = useFocusOutside((event) => {
4701
4646
  const target = event.target;
4702
4647
  const isFocusInBranch = [...context.branches].some((branch) => branch.contains(target));
4703
4648
  if (isFocusInBranch) return;
4704
- onFocusOutside == null ? void 0 : onFocusOutside(event);
4705
- onInteractOutside == null ? void 0 : onInteractOutside(event);
4706
- if (!event.defaultPrevented) onDismiss == null ? void 0 : onDismiss();
4649
+ onFocusOutside?.(event);
4650
+ onInteractOutside?.(event);
4651
+ if (!event.defaultPrevented) onDismiss?.();
4707
4652
  }, ownerDocument);
4708
4653
  useEscapeKeydown((event) => {
4709
4654
  const isHighestLayer = index === context.layers.size - 1;
4710
4655
  if (!isHighestLayer) return;
4711
- onEscapeKeyDown == null ? void 0 : onEscapeKeyDown(event);
4656
+ onEscapeKeyDown?.(event);
4712
4657
  if (!event.defaultPrevented && onDismiss) {
4713
4658
  event.preventDefault();
4714
4659
  onDismiss();
@@ -4781,7 +4726,7 @@ var DismissableLayerBranch = reactExports.forwardRef((props, forwardedRef) => {
4781
4726
  return /* @__PURE__ */ jsxRuntimeExports.jsx(Primitive.div, { ...props, ref: composedRefs });
4782
4727
  });
4783
4728
  DismissableLayerBranch.displayName = BRANCH_NAME;
4784
- function usePointerDownOutside(onPointerDownOutside, ownerDocument = globalThis == null ? void 0 : globalThis.document) {
4729
+ function usePointerDownOutside(onPointerDownOutside, ownerDocument = globalThis?.document) {
4785
4730
  const handlePointerDownOutside = useCallbackRef(onPointerDownOutside);
4786
4731
  const isPointerInsideReactTreeRef = reactExports.useRef(false);
4787
4732
  const handleClickRef = reactExports.useRef(() => {
@@ -4824,7 +4769,7 @@ function usePointerDownOutside(onPointerDownOutside, ownerDocument = globalThis
4824
4769
  onPointerDownCapture: () => isPointerInsideReactTreeRef.current = true
4825
4770
  };
4826
4771
  }
4827
- function useFocusOutside(onFocusOutside, ownerDocument = globalThis == null ? void 0 : globalThis.document) {
4772
+ function useFocusOutside(onFocusOutside, ownerDocument = globalThis?.document) {
4828
4773
  const handleFocusOutside = useCallbackRef(onFocusOutside);
4829
4774
  const isFocusInsideReactTreeRef = reactExports.useRef(false);
4830
4775
  reactExports.useEffect(() => {
@@ -5035,15 +4980,14 @@ function createFocusScopesStack() {
5035
4980
  add(focusScope) {
5036
4981
  const activeFocusScope = stack[0];
5037
4982
  if (focusScope !== activeFocusScope) {
5038
- activeFocusScope == null ? void 0 : activeFocusScope.pause();
4983
+ activeFocusScope?.pause();
5039
4984
  }
5040
4985
  stack = arrayRemove(stack, focusScope);
5041
4986
  stack.unshift(focusScope);
5042
4987
  },
5043
4988
  remove(focusScope) {
5044
- var _a;
5045
4989
  stack = arrayRemove(stack, focusScope);
5046
- (_a = stack[0]) == null ? void 0 : _a.resume();
4990
+ stack[0]?.resume();
5047
4991
  }
5048
4992
  };
5049
4993
  }
@@ -5060,11 +5004,10 @@ function removeLinks(items) {
5060
5004
  }
5061
5005
  var PORTAL_NAME$2 = "Portal";
5062
5006
  var Portal$1 = reactExports.forwardRef((props, forwardedRef) => {
5063
- var _a;
5064
5007
  const { container: containerProp, ...portalProps } = props;
5065
5008
  const [mounted, setMounted] = reactExports.useState(false);
5066
5009
  useLayoutEffect2(() => setMounted(true), []);
5067
- const container = containerProp || mounted && ((_a = globalThis == null ? void 0 : globalThis.document) == null ? void 0 : _a.body);
5010
+ const container = containerProp || mounted && globalThis?.document?.body;
5068
5011
  return container ? ReactDOM.createPortal(/* @__PURE__ */ jsxRuntimeExports.jsx(Primitive.div, { ...portalProps, ref: forwardedRef }), container) : null;
5069
5012
  });
5070
5013
  Portal$1.displayName = PORTAL_NAME$2;
@@ -5193,9 +5136,8 @@ var DialogContentModal = reactExports.forwardRef(
5193
5136
  trapFocus: context.open,
5194
5137
  disableOutsidePointerEvents: true,
5195
5138
  onCloseAutoFocus: composeEventHandlers(props.onCloseAutoFocus, (event) => {
5196
- var _a;
5197
5139
  event.preventDefault();
5198
- (_a = context.triggerRef.current) == null ? void 0 : _a.focus();
5140
+ context.triggerRef.current?.focus();
5199
5141
  }),
5200
5142
  onPointerDownOutside: composeEventHandlers(props.onPointerDownOutside, (event) => {
5201
5143
  const originalEvent = event.detail.originalEvent;
@@ -5224,18 +5166,16 @@ var DialogContentNonModal = reactExports.forwardRef(
5224
5166
  trapFocus: false,
5225
5167
  disableOutsidePointerEvents: false,
5226
5168
  onCloseAutoFocus: (event) => {
5227
- var _a, _b;
5228
- (_a = props.onCloseAutoFocus) == null ? void 0 : _a.call(props, event);
5169
+ props.onCloseAutoFocus?.(event);
5229
5170
  if (!event.defaultPrevented) {
5230
- if (!hasInteractedOutsideRef.current) (_b = context.triggerRef.current) == null ? void 0 : _b.focus();
5171
+ if (!hasInteractedOutsideRef.current) context.triggerRef.current?.focus();
5231
5172
  event.preventDefault();
5232
5173
  }
5233
5174
  hasInteractedOutsideRef.current = false;
5234
5175
  hasPointerDownOutsideRef.current = false;
5235
5176
  },
5236
5177
  onInteractOutside: (event) => {
5237
- var _a, _b;
5238
- (_a = props.onInteractOutside) == null ? void 0 : _a.call(props, event);
5178
+ props.onInteractOutside?.(event);
5239
5179
  if (!event.defaultPrevented) {
5240
5180
  hasInteractedOutsideRef.current = true;
5241
5181
  if (event.detail.originalEvent.type === "pointerdown") {
@@ -5243,7 +5183,7 @@ var DialogContentNonModal = reactExports.forwardRef(
5243
5183
  }
5244
5184
  }
5245
5185
  const target = event.target;
5246
- const targetIsTrigger = (_b = context.triggerRef.current) == null ? void 0 : _b.contains(target);
5186
+ const targetIsTrigger = context.triggerRef.current?.contains(target);
5247
5187
  if (targetIsTrigger) event.preventDefault();
5248
5188
  if (event.detail.originalEvent.type === "focusin" && hasPointerDownOutsideRef.current) {
5249
5189
  event.preventDefault();
@@ -5355,8 +5295,7 @@ var DescriptionWarning$1 = ({ contentRef, descriptionId }) => {
5355
5295
  const descriptionWarningContext = useWarningContext(DESCRIPTION_WARNING_NAME);
5356
5296
  const MESSAGE = `Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${descriptionWarningContext.contentName}}.`;
5357
5297
  reactExports.useEffect(() => {
5358
- var _a;
5359
- const describedById = (_a = contentRef.current) == null ? void 0 : _a.getAttribute("aria-describedby");
5298
+ const describedById = contentRef.current?.getAttribute("aria-describedby");
5360
5299
  if (descriptionId && describedById) {
5361
5300
  const hasDescription = document.getElementById(descriptionId);
5362
5301
  if (!hasDescription) console.warn(MESSAGE);
@@ -5431,9 +5370,8 @@ var AlertDialogContent$1 = reactExports.forwardRef(
5431
5370
  ...contentProps,
5432
5371
  ref: composedRefs,
5433
5372
  onOpenAutoFocus: composeEventHandlers(contentProps.onOpenAutoFocus, (event) => {
5434
- var _a;
5435
5373
  event.preventDefault();
5436
- (_a = cancelRef.current) == null ? void 0 : _a.focus({ preventScroll: true });
5374
+ cancelRef.current?.focus({ preventScroll: true });
5437
5375
  }),
5438
5376
  onPointerDownOutside: (event) => event.preventDefault(),
5439
5377
  onInteractOutside: (event) => event.preventDefault(),
@@ -5493,9 +5431,8 @@ Alternatively, you can use your own component as a description by assigning it a
5493
5431
 
5494
5432
  For more information, see https://radix-ui.com/primitives/docs/components/alert-dialog`;
5495
5433
  reactExports.useEffect(() => {
5496
- var _a;
5497
5434
  const hasDescription = document.getElementById(
5498
- (_a = contentRef.current) == null ? void 0 : _a.getAttribute("aria-describedby")
5435
+ contentRef.current?.getAttribute("aria-describedby")
5499
5436
  );
5500
5437
  if (!hasDescription) console.warn(MESSAGE);
5501
5438
  }, [MESSAGE, contentRef]);
@@ -5552,7 +5489,7 @@ function AlertDialogContent({
5552
5489
  ),
5553
5490
  onSubmit: (e) => {
5554
5491
  e.preventDefault();
5555
- onSubmit == null ? void 0 : onSubmit(e);
5492
+ onSubmit?.(e);
5556
5493
  },
5557
5494
  ...props
5558
5495
  }
@@ -5873,9 +5810,9 @@ function useStreamReader(env, streamId, runId, encryptionKey, runStatus) {
5873
5810
  streamId,
5874
5811
  runId,
5875
5812
  abortController.signal,
5876
- options == null ? void 0 : options.cursor
5813
+ options?.cursor
5877
5814
  );
5878
- const skipFrames = (options == null ? void 0 : options.skipFrames) ?? 0;
5815
+ const skipFrames = options?.skipFrames ?? 0;
5879
5816
  const reader = streamResponse.body.getReader();
5880
5817
  const decoder = new TextDecoder();
5881
5818
  let buffer = new Uint8Array(0);
@@ -6161,27 +6098,27 @@ function useEventsListData(env, runId, options = {}) {
6161
6098
  }, [env, runId, sortOrder, cursor, loadingMore, hydrateEvents]);
6162
6099
  const searchByExactId = reactExports.useCallback(
6163
6100
  async (id, kind, signal) => {
6164
- if (signal == null ? void 0 : signal.aborted) {
6101
+ if (signal?.aborted) {
6165
6102
  throw new DOMException("Aborted", "AbortError");
6166
6103
  }
6167
6104
  if (kind === "event") {
6168
6105
  const { error: fetchError, result } = await unwrapServerActionResult(
6169
6106
  fetchEvent(env, runId, id, "none")
6170
6107
  );
6171
- if (fetchError || (signal == null ? void 0 : signal.aborted)) {
6108
+ if (fetchError || signal?.aborted) {
6172
6109
  return fetchError ? { status: "error", message: fetchError.message } : (() => {
6173
6110
  throw new DOMException("Aborted", "AbortError");
6174
6111
  })();
6175
6112
  }
6176
6113
  const [event] = await hydrateEvents([result]);
6177
- return (event == null ? void 0 : event.runId) === runId ? { status: "ok", events: [event] } : { status: "not_found" };
6114
+ return event?.runId === runId ? { status: "ok", events: [event] } : { status: "not_found" };
6178
6115
  }
6179
6116
  const matched = [];
6180
6117
  let nextCursor;
6181
6118
  let pagesFetched = 0;
6182
6119
  let truncated = false;
6183
6120
  do {
6184
- if (signal == null ? void 0 : signal.aborted) {
6121
+ if (signal?.aborted) {
6185
6122
  throw new DOMException("Aborted", "AbortError");
6186
6123
  }
6187
6124
  const { error: fetchError, result } = await unwrapServerActionResult(
@@ -6196,7 +6133,7 @@ function useEventsListData(env, runId, options = {}) {
6196
6133
  if (fetchError) {
6197
6134
  return { status: "error", message: fetchError.message };
6198
6135
  }
6199
- if (signal == null ? void 0 : signal.aborted) {
6136
+ if (signal?.aborted) {
6200
6137
  throw new DOMException("Aborted", "AbortError");
6201
6138
  }
6202
6139
  pagesFetched += 1;
@@ -6251,7 +6188,6 @@ function RunDetailView({
6251
6188
  // TODO: This should open the right sidebar within the trace viewer
6252
6189
  selectedId: _selectedId
6253
6190
  }) {
6254
- var _a;
6255
6191
  const navigate = useNavigate();
6256
6192
  const [searchParams] = useSearchParams();
6257
6193
  const { serverConfig } = useServerConfig();
@@ -6382,12 +6318,12 @@ function RunDetailView({
6382
6318
  refresh: refreshSpanDetail
6383
6319
  } = useWorkflowResourceData(
6384
6320
  env,
6385
- (spanSelection == null ? void 0 : spanSelection.resource) ?? "run",
6386
- (spanSelection == null ? void 0 : spanSelection.resourceId) ?? "",
6321
+ spanSelection?.resource ?? "run",
6322
+ spanSelection?.resourceId ?? "",
6387
6323
  {
6388
- runId: spanSelection == null ? void 0 : spanSelection.runId,
6324
+ runId: spanSelection?.runId,
6389
6325
  enabled: Boolean(
6390
- (spanSelection == null ? void 0 : spanSelection.resource) && (spanSelection == null ? void 0 : spanSelection.resourceId) && spanSelection.resource !== "hook"
6326
+ spanSelection?.resource && spanSelection?.resourceId && spanSelection.resource !== "hook"
6391
6327
  ),
6392
6328
  encryptionKey: encryptionKey ?? void 0
6393
6329
  }
@@ -6477,7 +6413,7 @@ function RunDetailView({
6477
6413
  /* @__PURE__ */ jsxRuntimeExports.jsx(AlertDescription, { children: error.message })
6478
6414
  ] });
6479
6415
  }
6480
- const workflowName = (_a = parseWorkflowName(run.workflowName)) == null ? void 0 : _a.shortName;
6416
+ const workflowName = parseWorkflowName(run.workflowName)?.shortName;
6481
6417
  const hasError = false;
6482
6418
  const errorMessage = "";
6483
6419
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
@@ -6701,7 +6637,7 @@ function RunDetailView({
6701
6637
  ]
6702
6638
  }
6703
6639
  ),
6704
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex-1 min-w-0", children: selectedStreamId ? (streamError == null ? void 0 : streamError.includes("encrypted")) && !encryptionKey ? /* @__PURE__ */ jsxRuntimeExports.jsxs(
6640
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex-1 min-w-0", children: selectedStreamId ? streamError?.includes("encrypted") && !encryptionKey ? /* @__PURE__ */ jsxRuntimeExports.jsxs(
6705
6641
  "div",
6706
6642
  {
6707
6643
  className: "h-full flex flex-col items-center justify-center gap-3 rounded-lg border p-4",
@@ -6740,7 +6676,7 @@ function RunDetailView({
6740
6676
  streamId: selectedStreamId,
6741
6677
  chunks: streamChunks,
6742
6678
  isLive: streamIsLive,
6743
- error: (streamError == null ? void 0 : streamError.includes("encrypted")) ? null : streamError
6679
+ error: streamError?.includes("encrypted") ? null : streamError
6744
6680
  }
6745
6681
  ) : /* @__PURE__ */ jsxRuntimeExports.jsx(
6746
6682
  "div",