@cccsaurora/clue-ui 1.2.0-dev.254 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (179) hide show
  1. package/ActionForm-pWyIi01Z.js +4460 -0
  2. package/AnnotationDetails-11P7yhyx.js +160 -0
  3. package/AnnotationPreview-BGqlBBcp.js +140 -0
  4. package/ClueEnrichContext-DDZf646J.js +418 -0
  5. package/FlexOne-BXWFOd1T.js +6 -0
  6. package/_MapCache-BiTi0iqu.js +180 -0
  7. package/_Uint8Array-TJBs9NS2.js +101 -0
  8. package/_baseAssignValue-CNMLQZco.js +20 -0
  9. package/_baseClone-DajKHDCs.js +207 -0
  10. package/_baseExtremum-DhV10dXG.js +27 -0
  11. package/_baseFlatten-C8CjmqQ-.js +72 -0
  12. package/_baseGet-DSZygzyq.js +79 -0
  13. package/_baseIsEqual-C08cUUpA.js +147 -0
  14. package/_baseIteratee-DGZdhdqr.js +95 -0
  15. package/_baseSlice-M5RKzt1A.js +10 -0
  16. package/_baseSum-wEbgNeUs.js +10 -0
  17. package/_baseUniq-CGlHphLr.js +79 -0
  18. package/_commonjsHelpers-DaMA6jEr.js +8 -0
  19. package/_createAggregator-BvcoTZto.js +53 -0
  20. package/_getPrototype-Dm06JiGv.js +5 -0
  21. package/_getTag-Cfxlub3L.js +90 -0
  22. package/_setToArray-C7yMOeww.js +29 -0
  23. package/cloneDeep-wjl3XmFj.js +8 -0
  24. package/components/AnnotationBody.js +35 -49
  25. package/components/AnnotationDetailPopover.js +30 -36
  26. package/components/AnnotationDetails.js +7 -7
  27. package/components/AnnotationEntry.js +35 -35
  28. package/components/AnnotationPreview.js +5 -5
  29. package/components/ClassificationChip.js +23 -44
  30. package/components/CountBadge.js +26 -31
  31. package/components/EnrichedCard.js +97 -110
  32. package/components/EnrichedChip.js +105 -130
  33. package/components/EnrichedTypography.js +107 -133
  34. package/components/ErrorBoundary.js +24 -28
  35. package/components/RetryFailedEnrichments.js +9 -10
  36. package/components/SourcePicker.js +49 -57
  37. package/components/actions/ActionForm.js +4 -4
  38. package/components/actions/ExecutePopover.js +59 -75
  39. package/components/actions/ResultModal.js +4 -4
  40. package/components/actions/form/schemaAdapter.js +23 -39
  41. package/components/actions/formats/FileResult.js +59 -86
  42. package/components/actions/formats/index.js +10 -21
  43. package/components/display/graph/ExpandMoreButton.js +10 -10
  44. package/components/display/graph/elements/NodeCard.js +91 -111
  45. package/components/display/graph/elements/NodeTag.js +13 -15
  46. package/components/display/graph/index.js +202 -261
  47. package/components/display/graph/visualizations/Leaf.js +69 -88
  48. package/components/display/graph/visualizations/cloud/index.js +81 -98
  49. package/components/display/graph/visualizations/icons/BaseIcon.js +21 -26
  50. package/components/display/graph/visualizations/icons/BugIcon.js +12 -12
  51. package/components/display/graph/visualizations/icons/HostIcon.js +12 -12
  52. package/components/display/graph/visualizations/icons/NetworkIcon.js +12 -12
  53. package/components/display/graph/visualizations/icons/ProcessIcon.js +12 -12
  54. package/components/display/graph/visualizations/icons/TargetIcon.js +13 -13
  55. package/components/display/graph/visualizations/icons/index.js +13 -14
  56. package/components/display/graph/visualizations/panels/NodePanel.js +8 -10
  57. package/components/display/graph/visualizations/tree/BundleLine.js +81 -108
  58. package/components/display/graph/visualizations/tree/Triangle.js +13 -13
  59. package/components/display/graph/visualizations/tree/index.js +305 -407
  60. package/components/display/icons/Iconified.js +12 -27
  61. package/components/display/json/index.js +4 -4
  62. package/components/display/markdown/index.js +5770 -8678
  63. package/components/enrichment/EnrichPopover.js +46 -54
  64. package/components/fetchers/Fetcher.js +117 -155
  65. package/components/fetchers/PreviewModal.js +17 -20
  66. package/components/fetchers/StatusChip.js +17 -21
  67. package/components/group/Entry.js +11 -13
  68. package/components/group/Group.js +10 -13
  69. package/components/group/GroupControl.js +65 -76
  70. package/components/stats/QueryStatus.js +33 -43
  71. package/countBy-pIyxNZhO.js +8 -0
  72. package/data/event.js +4 -6
  73. package/database/index.js +2 -2
  74. package/debounce-DryYcbJ4.js +56 -0
  75. package/get-CH7kz5Ix.js +8 -0
  76. package/groupBy-yNrpdipq.js +8 -0
  77. package/hooks/ClueActionContext.js +6 -6
  78. package/hooks/ClueComponentContext.js +23 -29
  79. package/hooks/ClueConfigProvider.js +12 -14
  80. package/hooks/ClueDatabaseContext.js +13 -19
  81. package/hooks/ClueEnrichContext.js +8 -8
  82. package/hooks/ClueFetcherContext.js +56 -83
  83. package/hooks/ClueGroupContext.js +14 -17
  84. package/hooks/CluePopupContext.js +5 -5
  85. package/hooks/ClueProvider.js +10 -12
  86. package/hooks/selectors.js +7 -7
  87. package/hooks/useActionResult.js +2 -2
  88. package/hooks/useAnnotations.js +31 -47
  89. package/hooks/useClue.js +4 -6
  90. package/hooks/useClueActions.js +3 -3
  91. package/hooks/useClueConfig.js +4 -6
  92. package/hooks/useClueTypeConfig.js +3 -3
  93. package/hooks/useComparator.js +435 -722
  94. package/hooks/useErrors.js +18 -22
  95. package/hooks/useFetcherResult.js +24 -33
  96. package/hooks/useMyHighlights.js +36 -66
  97. package/hooks/useMyLocalStorage.js +37 -66
  98. package/iconify-BBckr5AQ.js +1263 -0
  99. package/icons/Action.js +49 -66
  100. package/icons/Assessment.js +68 -84
  101. package/icons/Context.js +63 -77
  102. package/icons/Opinion.js +65 -77
  103. package/icons/iconMap.js +2 -2
  104. package/identity-ByMq8VxU.js +6 -0
  105. package/index-BHAe_V9n.js +12768 -0
  106. package/index-CA5CUNZO.js +975 -0
  107. package/index-D_ZywK71.js +358 -0
  108. package/index-Dj5C04IX.js +568 -0
  109. package/index-p5_wX7q1.js +11729 -0
  110. package/isNil-CjWwlQS3.js +6 -0
  111. package/isObject-B53jY8Qg.js +7 -0
  112. package/isObjectLike-BatpeCIi.js +29 -0
  113. package/isSymbol-C3_SC0Qp.js +8 -0
  114. package/last-7CdUxN0r.js +7 -0
  115. package/main.js +60 -60
  116. package/package.json +1 -1
  117. package/sortBy-0BpKRt8p.js +79 -0
  118. package/sumBy-Do6Ff4Bw.js +8 -0
  119. package/text/Frequency.js +23 -42
  120. package/toFinite-BMy6GObD.js +14 -0
  121. package/toNumber-YVhnnJv4.js +31 -0
  122. package/useClueTypeConfig-77zd_zdF.js +2292 -0
  123. package/utils/chain.js +64 -91
  124. package/utils/classificationParser.js +256 -519
  125. package/utils/constants.js +10 -35
  126. package/utils/graph.js +45 -72
  127. package/utils/hashUtil.js +7 -7
  128. package/utils/line.js +81 -131
  129. package/utils/loggerUtil.js +3 -5
  130. package/utils/sessionStorage.js +27 -41
  131. package/utils/time.js +423 -423
  132. package/utils/utils.js +9 -9
  133. package/utils/window.js +10 -21
  134. package/utils-D5hPDE7N.js +129 -0
  135. package/ActionForm-C0aE9HUv.js +0 -5941
  136. package/AnnotationDetails-CEou0vCc.js +0 -175
  137. package/AnnotationPreview-CLMVD6Ec.js +0 -188
  138. package/ClueEnrichContext-BkD9ZwM9.js +0 -541
  139. package/FlexOne-BSYAhhtG.js +0 -9
  140. package/_MapCache-WmuDdwuH.js +0 -222
  141. package/_Uint8Array-DdG4KLKn.js +0 -128
  142. package/_baseAssignValue-CGTuELqU.js +0 -25
  143. package/_baseClone-BpWiBnMp.js +0 -283
  144. package/_baseExtremum-BY663UjY.js +0 -33
  145. package/_baseFlatten-B69cDsaV.js +0 -92
  146. package/_baseGet-Bx3A4Qfp.js +0 -108
  147. package/_baseIsEqual-B4IufFlL.js +0 -208
  148. package/_baseIteratee-7AQvAy1o.js +0 -126
  149. package/_baseSlice-GAv_YFTT.js +0 -20
  150. package/_baseSum-D0WC1dN0.js +0 -13
  151. package/_baseUniq-B8fK6hI-.js +0 -115
  152. package/_commonjsHelpers-DWwsNxpa.js +0 -8
  153. package/_createAggregator-CwGPThny.js +0 -63
  154. package/_getPrototype-CblfEidB.js +0 -5
  155. package/_getTag-jwz4XLoZ.js +0 -126
  156. package/_setToArray-CaPKQhcz.js +0 -33
  157. package/cloneDeep-DmUylbkM.js +0 -8
  158. package/countBy-DqlU5OwT.js +0 -14
  159. package/debounce-bV0h5FC5.js +0 -92
  160. package/get-DSsNkRQs.js +0 -8
  161. package/groupBy-ChDRT7uy.js +0 -14
  162. package/iconify-CXMreGTg.js +0 -1782
  163. package/identity-CPGTqrE4.js +0 -6
  164. package/index-AMfoEg_6.js +0 -696
  165. package/index-B6C2a_Lg.js +0 -1172
  166. package/index-C12gPw2W.js +0 -17698
  167. package/index-DCKkHTvx.js +0 -15750
  168. package/index-UkW8Sur3.js +0 -465
  169. package/isNil-CIubwp4T.js +0 -6
  170. package/isObject-FTY-5JQX.js +0 -7
  171. package/isObjectLike-OAgjjZye.js +0 -48
  172. package/isSymbol-Xd2FsJyp.js +0 -8
  173. package/last-CUCl67Im.js +0 -7
  174. package/sortBy-C7mGPI_D.js +0 -100
  175. package/sumBy-CGALjmwQ.js +0 -8
  176. package/toFinite-Bc55msYj.js +0 -16
  177. package/toNumber-DPxy1FBy.js +0 -39
  178. package/useClueTypeConfig-D2tf4-NM.js +0 -3289
  179. package/utils-71DpzFrA.js +0 -199
@@ -1,54 +1,40 @@
1
- import { jsxs, jsx, Fragment } from "react/jsx-runtime";
2
- import { useTheme, colors, Box } from "@mui/material";
3
- import useComparator from "../../../../../hooks/useComparator.js";
4
- import useMyHighlights from "../../../../../hooks/useMyHighlights.js";
5
- import { useMyLocalStorageItem } from "../../../../../hooks/useMyLocalStorage.js";
6
- import { StorageKey, BUNDLE_SEPARATOR } from "../../../../../utils/constants.js";
7
- import { c as cloneDeep } from "../../../../../cloneDeep-DmUylbkM.js";
8
- import { g as get } from "../../../../../get-DSsNkRQs.js";
9
- import { i as isNil } from "../../../../../isNil-CIubwp4T.js";
10
- import { b as baseExtremum, a as baseGt, i as isIterateeCall } from "../../../../../_baseExtremum-BY663UjY.js";
11
- import { i as identity } from "../../../../../identity-CPGTqrE4.js";
12
- import { t as toFinite } from "../../../../../toFinite-Bc55msYj.js";
13
- import { b as baseSum } from "../../../../../_baseSum-D0WC1dN0.js";
14
- import { memo, useMemo } from "react";
15
- import NodeCard from "../../elements/NodeCard.js";
16
- import getIcon from "../icons/index.js";
17
- import Leaf from "../Leaf.js";
18
- import BundleLine from "./BundleLine.js";
19
- function max(array) {
20
- return array && array.length ? baseExtremum(array, identity, baseGt) : void 0;
1
+ import { jsxs as it, jsx as L, Fragment as At } from "react/jsx-runtime";
2
+ import { useTheme as Bt, colors as wt, Box as Ft } from "@mui/material";
3
+ import It from "../../../../../hooks/useComparator.js";
4
+ import Wt from "../../../../../hooks/useMyHighlights.js";
5
+ import { useMyLocalStorageItem as Ot } from "../../../../../hooks/useMyLocalStorage.js";
6
+ import { StorageKey as Pt, BUNDLE_SEPARATOR as Ht } from "../../../../../utils/constants.js";
7
+ import { c as Xt } from "../../../../../cloneDeep-wjl3XmFj.js";
8
+ import { g as Tt } from "../../../../../get-CH7kz5Ix.js";
9
+ import { i as Yt } from "../../../../../isNil-CjWwlQS3.js";
10
+ import { b as $t, a as jt, i as Ut } from "../../../../../_baseExtremum-DhV10dXG.js";
11
+ import { i as Nt } from "../../../../../identity-ByMq8VxU.js";
12
+ import { t as et } from "../../../../../toFinite-BMy6GObD.js";
13
+ import { b as Gt } from "../../../../../_baseSum-wEbgNeUs.js";
14
+ import { memo as Vt, useMemo as S } from "react";
15
+ import qt from "../../elements/NodeCard.js";
16
+ import zt from "../icons/index.js";
17
+ import Jt from "../Leaf.js";
18
+ import Qt from "./BundleLine.js";
19
+ function kt(c) {
20
+ return c && c.length ? $t(c, Nt, jt) : void 0;
21
21
  }
22
- var nativeCeil = Math.ceil, nativeMax = Math.max;
23
- function baseRange(start, end, step, fromRight) {
24
- var index = -1, length = nativeMax(nativeCeil((end - start) / (step || 1)), 0), result = Array(length);
25
- while (length--) {
26
- result[++index] = start;
27
- start += step;
28
- }
29
- return result;
22
+ var Zt = Math.ceil, Kt = Math.max;
23
+ function ti(c, n, r, h) {
24
+ for (var d = -1, _ = Kt(Zt((n - c) / (r || 1)), 0), v = Array(_); _--; )
25
+ v[++d] = c, c += r;
26
+ return v;
30
27
  }
31
- function createRange(fromRight) {
32
- return function(start, end, step) {
33
- if (step && typeof step != "number" && isIterateeCall(start, end, step)) {
34
- end = step = void 0;
35
- }
36
- start = toFinite(start);
37
- if (end === void 0) {
38
- end = start;
39
- start = 0;
40
- } else {
41
- end = toFinite(end);
42
- }
43
- step = step === void 0 ? start < end ? 1 : -1 : toFinite(step);
44
- return baseRange(start, end, step);
28
+ function ii(c) {
29
+ return function(n, r, h) {
30
+ return h && typeof h != "number" && Ut(n, r, h) && (r = h = void 0), n = et(n), r === void 0 ? (r = n, n = 0) : r = et(r), h = h === void 0 ? n < r ? 1 : -1 : et(h), ti(n, r, h);
45
31
  };
46
32
  }
47
- var range = createRange();
48
- function sum(array) {
49
- return array && array.length ? baseSum(array, identity) : 0;
33
+ var ei = ii();
34
+ function ni(c) {
35
+ return c && c.length ? Gt(c, Nt) : 0;
50
36
  }
51
- const DEFAULT_OPTIONS = {
37
+ const nt = {
52
38
  textColor: "white",
53
39
  nodeColor: {
54
40
  border: "grey",
@@ -63,423 +49,335 @@ const DEFAULT_OPTIONS = {
63
49
  linePaddingX: 10,
64
50
  linePaddingY: 10,
65
51
  lineWidth: 3,
66
- enableEntryPadding: true,
67
- truncateLabels: true,
68
- enableTimestamps: true,
52
+ enableEntryPadding: !0,
53
+ truncateLabels: !0,
54
+ enableTimestamps: !0,
69
55
  iconOrientation: "vertical",
70
56
  lineDirection: "horizontal",
71
57
  rowStep: null,
72
58
  // We'll make this dynamic
73
- belowPrevious: false
59
+ belowPrevious: !1
74
60
  };
75
- DEFAULT_OPTIONS.rowStep = DEFAULT_OPTIONS.ySpacing * 2;
76
- const Tree = ({ svgRef, graph, labelKeys, onNodeSelectionChanged, zoom, options = {} }) => {
77
- var _a, _b, _c;
78
- const combinedOptions = useMemo(
61
+ nt.rowStep = nt.ySpacing * 2;
62
+ const ai = ({ svgRef: c, graph: n, labelKeys: r, onNodeSelectionChanged: h, zoom: d, options: _ = {} }) => {
63
+ var gt, xt, vt;
64
+ const v = S(
79
65
  () => {
80
- var _a2, _b2;
66
+ var i, o;
81
67
  return {
82
- ...DEFAULT_OPTIONS,
83
- ...options,
84
- ...((_b2 = (_a2 = graph == null ? void 0 : graph.metadata.display) == null ? void 0 : _a2.visualization) == null ? void 0 : _b2.config) ?? {}
68
+ ...nt,
69
+ ..._,
70
+ ...((o = (i = n == null ? void 0 : n.metadata.display) == null ? void 0 : i.visualization) == null ? void 0 : o.config) ?? {}
85
71
  };
86
72
  },
87
- [(_b = (_a = graph == null ? void 0 : graph.metadata.display) == null ? void 0 : _a.visualization) == null ? void 0 : _b.config, options]
88
- );
89
- const {
90
- xSpacing: baseXSpacing,
91
- ySpacing: baseYSpacing,
92
- linePaddingX: baseLinePaddingX,
93
- linePaddingY: baseLinePaddingY
94
- } = combinedOptions;
95
- const { runComparators, runComparator } = useComparator();
96
- const { onNodeHoveredChanged, onNodeClicked, nodeOpacities, highlightedPath, highlightedNodes, hoveredNode } = useMyHighlights(graph, (nodeIds) => onNodeSelectionChanged(nodeIds));
97
- const theme = useTheme();
98
- const isDark = useMemo(() => theme.palette.mode === "dark", [theme]);
99
- const [showCardsSettings] = useMyLocalStorageItem(StorageKey.SHOW_CARDS, false);
100
- const [cardCutoff] = useMyLocalStorageItem(StorageKey.CARD_CUTOFF, 2.5);
101
- const showCards = useMemo(() => zoom.k > cardCutoff && showCardsSettings, [cardCutoff, showCardsSettings, zoom.k]);
102
- const levels = useMemo(
103
- () => graph.data.map(
104
- (level, levelIndex) => level.map((node) => ({
105
- ...node,
106
- parents: node == null ? void 0 : node.edges,
107
- level: levelIndex
73
+ [(xt = (gt = n == null ? void 0 : n.metadata.display) == null ? void 0 : gt.visualization) == null ? void 0 : xt.config, _]
74
+ ), {
75
+ xSpacing: at,
76
+ ySpacing: ot,
77
+ linePaddingX: rt,
78
+ linePaddingY: st
79
+ } = v, { runComparators: lt, runComparator: W } = It(), { onNodeHoveredChanged: A, onNodeClicked: ct, nodeOpacities: H, highlightedPath: dt, highlightedNodes: ft, hoveredNode: pt } = Wt(n, (i) => h(i)), u = Bt(), ut = S(() => u.palette.mode === "dark", [u]), [X] = Ot(Pt.SHOW_CARDS, !1), [mt] = Ot(Pt.CARD_CUTOFF, 2.5), Y = S(() => d.k > mt && X, [mt, X, d.k]), w = S(
80
+ () => n.data.map(
81
+ (i, o) => i.map((l) => ({
82
+ ...l,
83
+ parents: l == null ? void 0 : l.edges,
84
+ level: o
108
85
  }))
109
86
  ),
110
- [graph.data]
111
- );
112
- const flatNodes = useMemo(() => levels.flat(), [levels]);
113
- const [xSpacing, linePaddingX, ySpacing, linePaddingY] = useMemo(() => {
114
- const baseValues = [
115
- [baseXSpacing, baseLinePaddingX],
116
- [baseYSpacing, baseLinePaddingY]
87
+ [n.data]
88
+ ), C = S(() => w.flat(), [w]), [$, j, ht, M] = S(() => {
89
+ const i = [
90
+ [at, rt],
91
+ [ot, st]
117
92
  ];
118
- if (zoom.k > 1 && showCardsSettings) {
119
- return baseValues.flatMap(
120
- (arr, index) => arr.map((_v) => _v * Math.pow(2.5 - index * 1.25, Math.min(zoom.k, 2.5) - 1))
121
- );
122
- } else {
123
- return baseValues.flat();
124
- }
125
- }, [baseLinePaddingX, baseLinePaddingY, baseXSpacing, baseYSpacing, showCardsSettings, zoom.k]);
126
- let portBounds;
127
- if (!graph || !svgRef.current) {
128
- portBounds = [
93
+ return d.k > 1 && X ? i.flatMap(
94
+ (o, l) => o.map((s) => s * Math.pow(2.5 - l * 1.25, Math.min(d.k, 2.5) - 1))
95
+ ) : i.flat();
96
+ }, [rt, st, at, ot, X, d.k]);
97
+ let B;
98
+ if (!n || !c.current)
99
+ B = [
129
100
  [0, 0],
130
101
  [0, 0]
131
102
  ];
132
- } else {
133
- const data = svgRef.current.getBoundingClientRect();
134
- portBounds = [zoom.invert([0, 0]), zoom.invert([data.width, data.height])];
103
+ else {
104
+ const i = c.current.getBoundingClientRect();
105
+ B = [d.invert([0, 0]), d.invert([i.width, i.height])];
135
106
  }
136
- const bundles = useMemo(() => {
137
- const bundlesDict = {};
138
- flatNodes.forEach((node) => {
139
- if (!node.parents) {
107
+ const U = S(() => {
108
+ const i = {};
109
+ return C.forEach((o) => {
110
+ if (!o.parents)
140
111
  return;
141
- }
142
- const bundleId = node.parents.join(BUNDLE_SEPARATOR);
143
- if (bundlesDict[bundleId]) {
144
- bundlesDict[bundleId].destinations.push(node);
145
- } else {
146
- bundlesDict[bundleId] = {
147
- id: bundleId,
148
- sources: node.parents.map((parent) => flatNodes.find((_node) => _node.id === parent)),
149
- destinations: [node]
150
- };
151
- }
152
- });
153
- return Object.values(bundlesDict);
154
- }, [flatNodes]);
155
- const layoutData = useMemo(() => {
112
+ const l = o.parents.join(Ht);
113
+ i[l] ? i[l].destinations.push(o) : i[l] = {
114
+ id: l,
115
+ sources: o.parents.map((s) => C.find((E) => E.id === s)),
116
+ destinations: [o]
117
+ };
118
+ }), Object.values(i);
119
+ }, [C]), G = S(() => {
156
120
  const {
157
- letterSize,
158
- letterWidth,
159
- enableEntryPadding,
160
- truncateLabels,
161
- rowStep,
162
- belowPrevious
163
- } = combinedOptions;
164
- let currentX = 0;
165
- let currentY = 0;
166
- const nodeLocations = {};
167
- const linesByLevel = {};
168
- const paddingByLevel = {};
169
- const inputs = {};
170
- const outputs = {};
171
- levels.forEach((level, levelIndex) => {
172
- let longestLabel = 0;
173
- level.forEach((node) => {
174
- var _a2;
175
- const validKeys = labelKeys == null ? void 0 : labelKeys.filter((_comparator) => runComparator(_comparator, node));
176
- const labelKey = (_a2 = validKeys == null ? void 0 : validKeys.pop()) == null ? void 0 : _a2.label;
177
- const labelRows = (labelKey == null ? void 0 : labelKey.split(",").map((key) => get(node, key)).filter((val) => !!val)) ?? [];
178
- if (labelRows.length < 1) {
179
- node.id.split("\n").forEach((line) => labelRows.push(line));
180
- }
181
- const labelHeight = labelRows.length * letterSize;
182
- currentY += labelHeight;
183
- nodeLocations[node.id] = [+currentX, +currentY, -linePaddingY];
184
- currentY += ySpacing;
185
- if (enableEntryPadding) {
186
- longestLabel = Math.max(longestLabel, max((labelRows == null ? void 0 : labelRows.map((row) => row.toString().length)) ?? [node.id.length]));
187
- }
121
+ letterSize: i,
122
+ letterWidth: o,
123
+ enableEntryPadding: l,
124
+ truncateLabels: s,
125
+ rowStep: E,
126
+ belowPrevious: F
127
+ } = v;
128
+ let V = 0, O = 0;
129
+ const P = {}, T = {}, R = {}, k = {}, D = {};
130
+ return w.forEach((e, a) => {
131
+ let b = 0;
132
+ e.forEach((f) => {
133
+ var q;
134
+ const g = r == null ? void 0 : r.filter((t) => W(t, f)), m = (q = g == null ? void 0 : g.pop()) == null ? void 0 : q.label, p = (m == null ? void 0 : m.split(",").map((t) => Tt(f, t)).filter((t) => !!t)) ?? [];
135
+ p.length < 1 && f.id.split(`
136
+ `).forEach((t) => p.push(t));
137
+ const I = p.length * i;
138
+ O += I, P[f.id] = [+V, +O, -M], O += ht, l && (b = Math.max(b, kt((p == null ? void 0 : p.map((t) => t.toString().length)) ?? [f.id.length])));
139
+ }), V += $ + (s ? Math.min(b, 44) : b) * o, F ? O += E : O = (a + 1) * E;
140
+ }), U.forEach((e) => {
141
+ e.sources.forEach((a) => {
142
+ D[a.id] || (D[a.id] = /* @__PURE__ */ new Set()), D[a.id].add(e.id);
143
+ }), e.destinations.forEach((a) => {
144
+ Yt(T[a.level]) && (T[a.level] = /* @__PURE__ */ new Set()), k[a.id] || (k[a.id] = /* @__PURE__ */ new Set()), T[a.level].add(e.id), k[a.id].add(e.id);
188
145
  });
189
- currentX += xSpacing + (!truncateLabels ? longestLabel : Math.min(longestLabel, 44)) * letterWidth;
190
- if (!belowPrevious) {
191
- currentY = (levelIndex + 1) * rowStep;
192
- } else {
193
- currentY += rowStep;
194
- }
195
- });
196
- bundles.forEach((bundle) => {
197
- bundle.sources.forEach((source) => {
198
- if (!outputs[source.id]) {
199
- outputs[source.id] = /* @__PURE__ */ new Set();
200
- }
201
- outputs[source.id].add(bundle.id);
146
+ }), Object.entries(T).forEach(([e, a]) => R[e] = a.size), w.forEach((e, a) => {
147
+ const f = ei(a + 1).map((m) => R[m] ?? 0), g = ni(f) * j;
148
+ e.forEach((m) => {
149
+ P[m.id][0] += g;
202
150
  });
203
- bundle.destinations.forEach((dest) => {
204
- if (isNil(linesByLevel[dest.level])) {
205
- linesByLevel[dest.level] = /* @__PURE__ */ new Set();
206
- }
207
- if (!inputs[dest.id]) {
208
- inputs[dest.id] = /* @__PURE__ */ new Set();
209
- }
210
- linesByLevel[dest.level].add(bundle.id);
211
- inputs[dest.id].add(bundle.id);
151
+ }), C.forEach((e) => {
152
+ var f, g, m;
153
+ let a = kt([((f = k[e.id]) == null ? void 0 : f.size) - 1, ((g = D[e.id]) == null ? void 0 : g.size) - 1, 0]) * M;
154
+ (m = k[e.id]) != null && m.has(e.id) && (a += M), P[e.id][2] = a;
155
+ const b = w[e.level].findIndex((p) => p.id === e.id);
156
+ w[e.level].filter((p, I) => b < I).forEach((p) => {
157
+ P[p.id][1] += a;
212
158
  });
213
- });
214
- Object.entries(linesByLevel).forEach(([level, lines]) => paddingByLevel[level] = lines.size);
215
- levels.forEach((level, levelIndex) => {
216
- const indexesSoFar = range(levelIndex + 1);
217
- const paddingArray = indexesSoFar.map((_levelIndex) => paddingByLevel[_levelIndex] ?? 0);
218
- const totalPadding = sum(paddingArray) * linePaddingX;
219
- level.forEach((node) => {
220
- nodeLocations[node.id][0] += totalPadding;
221
- });
222
- });
223
- flatNodes.forEach((node) => {
224
- var _a2, _b2, _c2;
225
- let maxHeight = max([((_a2 = inputs[node.id]) == null ? void 0 : _a2.size) - 1, ((_b2 = outputs[node.id]) == null ? void 0 : _b2.size) - 1, 0]) * linePaddingY;
226
- if ((_c2 = inputs[node.id]) == null ? void 0 : _c2.has(node.id)) {
227
- maxHeight += linePaddingY;
228
- }
229
- nodeLocations[node.id][2] = maxHeight;
230
- const levelIndex = levels[node.level].findIndex((_node) => _node.id === node.id);
231
- levels[node.level].filter((__, index) => levelIndex < index).forEach((_node) => {
232
- nodeLocations[_node.id][1] += maxHeight;
233
- });
234
- });
235
- return {
236
- nodeLocations,
237
- linesByLevel,
238
- paddingByLevel
159
+ }), {
160
+ nodeLocations: P,
161
+ linesByLevel: T,
162
+ paddingByLevel: R
239
163
  };
240
164
  }, [
241
- bundles,
242
- combinedOptions,
243
- flatNodes,
244
- labelKeys,
245
- levels,
246
- linePaddingX,
247
- linePaddingY,
248
- runComparator,
249
- xSpacing,
250
- ySpacing
251
- ]);
252
- const [timestamps, bundleElements, nodes] = useMemo(() => {
165
+ U,
166
+ v,
167
+ C,
168
+ r,
169
+ w,
170
+ j,
171
+ M,
172
+ W,
173
+ $,
174
+ ht
175
+ ]), [Mt, Rt, Dt] = S(() => {
253
176
  const {
254
- textColor,
255
- letterSize,
256
- letterWidth,
257
- nodeRadius,
258
- nodeColor,
259
- maxArcRadius,
260
- lineWidth,
261
- truncateLabels,
262
- enableTimestamps,
263
- belowPrevious,
264
- iconOrientation,
265
- lineDirection,
266
- colorTheme
267
- } = combinedOptions;
268
- const { nodeLocations, linesByLevel, paddingByLevel } = layoutData;
269
- const _nodes = [];
270
- const _timestamps = [];
271
- flatNodes.forEach((node) => {
272
- var _a2, _b2, _c2, _d;
273
- const [x, y, _height] = nodeLocations[node.id];
274
- const labelKey = ((_a2 = labelKeys == null ? void 0 : labelKeys.filter((_comparator) => runComparator(_comparator, node)).pop()) == null ? void 0 : _a2.label) ?? "id";
275
- let label = labelKey == null ? void 0 : labelKey.split(",").map((key) => {
276
- let labelSection = get(node, key);
277
- if (labelSection && truncateLabels && labelSection.length > 44) {
278
- labelSection = labelSection.replace(/^(.{32}).+$/, "$1 (TRUNCATED)");
279
- }
280
- return labelSection;
281
- }).filter((section) => !!section).join("\n");
282
- if (!label) {
283
- if (node.id.length > 44) {
284
- label = node.id.replace(/^(.{32}).+$/, "$1 (TRUNCATED)");
285
- } else {
286
- label = node.id;
287
- }
288
- }
289
- if (belowPrevious && enableTimestamps && (node.timestamp || node.annotation)) {
290
- _timestamps.push(
291
- /* @__PURE__ */ jsxs(
292
- "g",
293
- {
294
- style: {
295
- cursor: "default",
296
- fontFamily: '"Lucida Console", monospace',
297
- fontSize: letterSize * 0.75 + "px"
298
- },
299
- children: [
300
- /* @__PURE__ */ jsx(
177
+ textColor: i,
178
+ letterSize: o,
179
+ letterWidth: l,
180
+ nodeRadius: s,
181
+ nodeColor: E,
182
+ maxArcRadius: F,
183
+ lineWidth: V,
184
+ truncateLabels: O,
185
+ enableTimestamps: P,
186
+ belowPrevious: T,
187
+ iconOrientation: R,
188
+ lineDirection: k,
189
+ colorTheme: D
190
+ } = v, { nodeLocations: e, linesByLevel: a, paddingByLevel: b } = G, f = [], g = [];
191
+ C.forEach((t) => {
192
+ var St, Ct, bt, Et;
193
+ const [yt, z, Z] = e[t.id], K = ((St = r == null ? void 0 : r.filter((y) => W(y, t)).pop()) == null ? void 0 : St.label) ?? "id";
194
+ let J = K == null ? void 0 : K.split(",").map((y) => {
195
+ let x = Tt(t, y);
196
+ return x && O && x.length > 44 && (x = x.replace(/^(.{32}).+$/, "$1 (TRUNCATED)")), x;
197
+ }).filter((y) => !!y).join(`
198
+ `);
199
+ if (J || (t.id.length > 44 ? J = t.id.replace(/^(.{32}).+$/, "$1 (TRUNCATED)") : J = t.id), T && P && (t.timestamp || t.annotation) && g.push(
200
+ /* @__PURE__ */ it(
201
+ "g",
202
+ {
203
+ style: {
204
+ cursor: "default",
205
+ fontFamily: '"Lucida Console", monospace',
206
+ fontSize: o * 0.75 + "px"
207
+ },
208
+ children: [
209
+ /* @__PURE__ */ L(
210
+ "text",
211
+ {
212
+ x: B[0][0] + $,
213
+ y: z + (Z + s) / 2,
214
+ fill: u.palette.getContrastText(u.palette.background.paper),
215
+ style: {
216
+ fillOpacity: H(t.id) / 2,
217
+ transition: u.transitions.create(["fill-opacity"], {
218
+ duration: u.transitions.duration.short
219
+ })
220
+ },
221
+ children: t.timestamp
222
+ }
223
+ ),
224
+ t.annotation && t.annotation.split(`
225
+ `).map((y, x) => {
226
+ var Q;
227
+ return /* @__PURE__ */ L(
301
228
  "text",
302
229
  {
303
- x: portBounds[0][0] + xSpacing,
304
- y: y + (_height + nodeRadius) / 2,
305
- fill: theme.palette.getContrastText(theme.palette.background.paper),
230
+ x: B[0][0] + (((Q = t.timestamp) == null ? void 0 : Q.length) ?? 0) * l,
231
+ y: z + (Z + s) / 2 + x * o,
232
+ fill: ut ? wt.orange[300] : wt.blue[900],
306
233
  style: {
307
- fillOpacity: nodeOpacities(node.id) / 2,
308
- transition: theme.transitions.create(["fill-opacity"], {
309
- duration: theme.transitions.duration.short
234
+ fillOpacity: H(t.id),
235
+ transition: u.transitions.create(["fill-opacity"], {
236
+ duration: u.transitions.duration.short
310
237
  })
311
238
  },
312
- children: node.timestamp
313
- }
314
- ),
315
- node.annotation && node.annotation.split("\n").map((line, index) => {
316
- var _a3;
317
- return /* @__PURE__ */ jsx(
318
- "text",
319
- {
320
- x: portBounds[0][0] + (((_a3 = node.timestamp) == null ? void 0 : _a3.length) ?? 0) * letterWidth,
321
- y: y + (_height + nodeRadius) / 2 + index * letterSize,
322
- fill: isDark ? colors.orange[300] : colors.blue[900],
323
- style: {
324
- fillOpacity: nodeOpacities(node.id),
325
- transition: theme.transitions.create(["fill-opacity"], {
326
- duration: theme.transitions.duration.short
327
- })
328
- },
329
- children: line
330
- },
331
- line
332
- );
333
- })
334
- ]
335
- },
336
- node.id + "-timestamp"
337
- )
338
- );
339
- }
340
- if (!showCards) {
341
- const style = runComparators(
342
- (_c2 = (_b2 = graph.metadata.display) == null ? void 0 : _b2.styles) == null ? void 0 : _c2.filter((comparator) => comparator.type === "node"),
343
- node
344
- );
345
- const nodeOpacity = nodeOpacities(node.id);
346
- const icons = (_d = node.icons) == null ? void 0 : _d.map((icon) => [icon, getIcon(icon)]).filter(([__, icon]) => !!icon).map(([icon, Icon], index) => /* @__PURE__ */ jsx(
347
- Icon,
239
+ children: y
240
+ },
241
+ y
242
+ );
243
+ })
244
+ ]
245
+ },
246
+ t.id + "-timestamp"
247
+ )
248
+ ), !Y) {
249
+ const y = lt(
250
+ (bt = (Ct = n.metadata.display) == null ? void 0 : Ct.styles) == null ? void 0 : bt.filter((N) => N.type === "node"),
251
+ t
252
+ ), x = H(t.id), Q = (Et = t.icons) == null ? void 0 : Et.map((N) => [N, zt(N)]).filter(([N, tt]) => !!tt).map(([N, tt], Lt) => /* @__PURE__ */ L(
253
+ tt,
348
254
  {
349
- x: x - nodeRadius * 3 * (iconOrientation === "horizontal" ? index + 1 : 0),
350
- y: y - nodeRadius * 3 * (iconOrientation === "vertical" ? index + 1 : 0),
351
- size: letterSize * 1.5,
255
+ x: yt - s * 3 * (R === "horizontal" ? Lt + 1 : 0),
256
+ y: z - s * 3 * (R === "vertical" ? Lt + 1 : 0),
257
+ size: o * 1.5,
352
258
  style: {
353
- fillOpacity: nodeOpacity
259
+ fillOpacity: x
354
260
  },
355
261
  circleStyle: {
356
- fillOpacity: nodeOpacity
262
+ fillOpacity: x
357
263
  }
358
264
  },
359
- icon
265
+ N
360
266
  ));
361
- _nodes.push(
362
- /* @__PURE__ */ jsx(
363
- Leaf,
267
+ f.push(
268
+ /* @__PURE__ */ L(
269
+ Jt,
364
270
  {
365
- alwaysShowText: true,
366
- nodeId: node.id,
367
- label,
368
- height: _height,
369
- x,
370
- y,
371
- style,
372
- nodeRadius,
373
- nodeColor,
374
- nodeOpacity,
375
- letterSize,
376
- letterWidth,
377
- textColor,
378
- selected: highlightedNodes.has(node.id),
379
- onHoverChanged: onNodeHoveredChanged,
380
- onClick: onNodeClicked,
381
- children: icons
271
+ alwaysShowText: !0,
272
+ nodeId: t.id,
273
+ label: J,
274
+ height: Z,
275
+ x: yt,
276
+ y: z,
277
+ style: y,
278
+ nodeRadius: s,
279
+ nodeColor: E,
280
+ nodeOpacity: x,
281
+ letterSize: o,
282
+ letterWidth: l,
283
+ textColor: i,
284
+ selected: ft.has(t.id),
285
+ onHoverChanged: A,
286
+ onClick: ct,
287
+ children: Q
382
288
  },
383
- node.id
289
+ t.id
384
290
  )
385
291
  );
386
292
  }
387
293
  });
388
- const readonlyNodeLocations = cloneDeep(nodeLocations);
389
- const outputsByNode = {};
390
- const inputsByNode = {};
391
- const _bundleElements = bundles.map((bundle) => {
392
- return /* @__PURE__ */ jsx(
393
- BundleLine,
394
- {
395
- lineDirection,
396
- linesByLevel,
397
- paddingByLevel,
398
- nodeLocations: readonlyNodeLocations,
399
- outputsByNode,
400
- inputsByNode,
401
- bundle,
402
- maxArcRadius,
403
- lineWidth,
404
- linePaddingX,
405
- linePaddingY,
406
- highlightedPath,
407
- colorTheme
408
- },
409
- bundle.id
410
- );
411
- });
412
- return [_timestamps, _bundleElements, _nodes];
294
+ const m = Xt(e), p = {}, I = {}, q = U.map((t) => /* @__PURE__ */ L(
295
+ Qt,
296
+ {
297
+ lineDirection: k,
298
+ linesByLevel: a,
299
+ paddingByLevel: b,
300
+ nodeLocations: m,
301
+ outputsByNode: p,
302
+ inputsByNode: I,
303
+ bundle: t,
304
+ maxArcRadius: F,
305
+ lineWidth: V,
306
+ linePaddingX: j,
307
+ linePaddingY: M,
308
+ highlightedPath: dt,
309
+ colorTheme: D
310
+ },
311
+ t.id
312
+ ));
313
+ return [g, q, f];
413
314
  }, [
414
- bundles,
415
- combinedOptions,
416
- (_c = graph.metadata.display) == null ? void 0 : _c.styles,
417
- flatNodes,
418
- highlightedNodes,
419
- highlightedPath,
420
- isDark,
421
- labelKeys,
422
- layoutData,
423
- linePaddingX,
424
- linePaddingY,
425
- nodeOpacities,
426
- onNodeClicked,
427
- onNodeHoveredChanged,
428
- portBounds,
429
- runComparator,
430
- runComparators,
431
- showCards,
432
- theme.palette,
433
- theme.transitions,
434
- xSpacing
435
- ]);
436
- const cards = useMemo(() => {
437
- const { nodeRadius, lineWidth } = combinedOptions;
438
- const { nodeLocations } = layoutData;
439
- return flatNodes.filter((node) => showCards || hoveredNode === node.id).map((node) => {
440
- const [x, y] = nodeLocations[node.id];
441
- return /* @__PURE__ */ jsx(
442
- Box,
315
+ U,
316
+ v,
317
+ (vt = n.metadata.display) == null ? void 0 : vt.styles,
318
+ C,
319
+ ft,
320
+ dt,
321
+ ut,
322
+ r,
323
+ G,
324
+ j,
325
+ M,
326
+ H,
327
+ ct,
328
+ A,
329
+ B,
330
+ W,
331
+ lt,
332
+ Y,
333
+ u.palette,
334
+ u.transitions,
335
+ $
336
+ ]), _t = S(() => {
337
+ const { nodeRadius: i, lineWidth: o } = v, { nodeLocations: l } = G;
338
+ return C.filter((s) => Y || pt === s.id).map((s) => {
339
+ const [E, F] = l[s.id];
340
+ return /* @__PURE__ */ L(
341
+ Ft,
443
342
  {
444
- onMouseOver: () => onNodeHoveredChanged(node.id, true),
445
- onMouseLeave: () => setTimeout(() => onNodeHoveredChanged(node.id, false), 100),
343
+ onMouseOver: () => A(s.id, !0),
344
+ onMouseLeave: () => setTimeout(() => A(s.id, !1), 100),
446
345
  sx: {
447
346
  position: "absolute",
448
- left: zoom.k * x + zoom.x,
449
- top: zoom.k * y + zoom.y,
450
- transform: `translateX(-${nodeRadius * 2}px) translateY(${lineWidth}px)`,
451
- backgroundColor: theme.palette.background.paper,
347
+ left: d.k * E + d.x,
348
+ top: d.k * F + d.y,
349
+ transform: `translateX(-${i * 2}px) translateY(${o}px)`,
350
+ backgroundColor: u.palette.background.paper,
452
351
  maxWidth: "450px",
453
352
  maxHeight: "500px",
454
353
  overflow: "auto"
455
354
  },
456
- children: /* @__PURE__ */ jsx(NodeCard, { node })
355
+ children: /* @__PURE__ */ L(qt, { node: s })
457
356
  },
458
- node.id
357
+ s.id
459
358
  );
460
359
  });
461
360
  }, [
462
- combinedOptions,
463
- flatNodes,
464
- hoveredNode,
465
- layoutData,
466
- onNodeHoveredChanged,
467
- showCards,
468
- theme.palette.background.paper,
469
- zoom.k,
470
- zoom.x,
471
- zoom.y
361
+ v,
362
+ C,
363
+ pt,
364
+ G,
365
+ A,
366
+ Y,
367
+ u.palette.background.paper,
368
+ d.k,
369
+ d.x,
370
+ d.y
472
371
  ]);
473
- return /* @__PURE__ */ jsxs(Fragment, { children: [
474
- /* @__PURE__ */ jsx("svg", { id: "viz", ref: svgRef, children: /* @__PURE__ */ jsxs("g", { id: "view", children: [
475
- timestamps,
476
- bundleElements,
477
- nodes
372
+ return /* @__PURE__ */ it(At, { children: [
373
+ /* @__PURE__ */ L("svg", { id: "viz", ref: c, children: /* @__PURE__ */ it("g", { id: "view", children: [
374
+ Mt,
375
+ Rt,
376
+ Dt
478
377
  ] }) }),
479
- cards
378
+ _t
480
379
  ] });
481
- };
482
- const Tree$1 = memo(Tree);
380
+ }, Ei = Vt(ai);
483
381
  export {
484
- Tree$1 as default
382
+ Ei as default
485
383
  };