@cccsaurora/clue-ui 1.0.2 → 1.1.0-dev.10

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 (180) hide show
  1. package/ActionForm-D4ryHO0M.js +436 -0
  2. package/AnnotationDetails-YAPoqw3R.js +175 -0
  3. package/AnnotationPreview-DiQDjt9s.js +188 -0
  4. package/ClueEnrichContext-DIn6g8tw.js +522 -0
  5. package/FlexOne-BSYAhhtG.js +9 -0
  6. package/_Map-kgDsDYxq.js +64 -0
  7. package/_MapCache-DabaaWfq.js +161 -0
  8. package/_Uint8Array-BlVVH1tp.js +129 -0
  9. package/_baseAssignValue-CNbcU6Nb.js +25 -0
  10. package/_baseClone-D3a8Pa4T.js +284 -0
  11. package/_baseExtremum-B1o1zHjR.js +33 -0
  12. package/_baseFlatten-D4huXoEI.js +92 -0
  13. package/_baseGet-BSK_nnoz.js +109 -0
  14. package/_baseIsEqual-B5xLoweL.js +238 -0
  15. package/_baseIteratee-p6Nj07-n.js +126 -0
  16. package/_baseSlice-GAv_YFTT.js +20 -0
  17. package/_baseSum-D0WC1dN0.js +13 -0
  18. package/_baseUniq-CpupKWcL.js +89 -0
  19. package/_commonjsHelpers-CUmg6egw.js +6 -0
  20. package/_createAggregator-BpVy5xMi.js +63 -0
  21. package/_getPrototype-D1LAdQKO.js +5 -0
  22. package/_getTag-D3ToyefI.js +126 -0
  23. package/cloneDeep-CjP5k9zW.js +8 -0
  24. package/components/AnnotationBody.js +49 -34
  25. package/components/AnnotationDetailPopover.js +36 -30
  26. package/components/AnnotationDetails.js +6 -6
  27. package/components/AnnotationEntry.js +50 -47
  28. package/components/AnnotationPreview.js +5 -5
  29. package/components/ClassificationChip.js +44 -23
  30. package/components/CountBadge.js +31 -26
  31. package/components/EnrichedCard.js +104 -92
  32. package/components/EnrichedChip.js +134 -109
  33. package/components/EnrichedTypography.js +136 -110
  34. package/components/ErrorBoundary.js +28 -24
  35. package/components/RetryFailedEnrichments.js +10 -9
  36. package/components/SourcePicker.js +57 -49
  37. package/components/actions/ActionForm.js +4 -4
  38. package/components/actions/ExecutePopover.js +64 -50
  39. package/components/actions/ResultModal.js +37 -34
  40. package/components/actions/form/schemaAdapter.js +39 -20
  41. package/components/display/graph/ExpandMoreButton.js +10 -10
  42. package/components/display/graph/elements/NodeCard.js +92 -76
  43. package/components/display/graph/elements/NodeTag.js +15 -13
  44. package/components/display/graph/index.js +258 -200
  45. package/components/display/graph/visualizations/Leaf.js +88 -69
  46. package/components/display/graph/visualizations/cloud/index.js +98 -81
  47. package/components/display/graph/visualizations/icons/BaseIcon.js +26 -21
  48. package/components/display/graph/visualizations/icons/BugIcon.js +12 -12
  49. package/components/display/graph/visualizations/icons/HostIcon.js +12 -12
  50. package/components/display/graph/visualizations/icons/NetworkIcon.js +12 -12
  51. package/components/display/graph/visualizations/icons/ProcessIcon.js +12 -12
  52. package/components/display/graph/visualizations/icons/TargetIcon.js +13 -13
  53. package/components/display/graph/visualizations/icons/index.js +14 -13
  54. package/components/display/graph/visualizations/panels/NodePanel.js +10 -8
  55. package/components/display/graph/visualizations/tree/BundleLine.js +108 -81
  56. package/components/display/graph/visualizations/tree/Triangle.js +13 -13
  57. package/components/display/graph/visualizations/tree/index.js +407 -305
  58. package/components/display/icons/Iconified.js +27 -12
  59. package/components/display/json/index.js +4 -4
  60. package/components/display/markdown/DynamicTabs.js +22 -17
  61. package/components/display/markdown/index.js +8527 -5670
  62. package/components/display/markdown/markdownPlugins/tabs.js +1 -1
  63. package/components/enrichment/EnrichPopover.js +55 -47
  64. package/components/fetchers/Fetcher.js +123 -95
  65. package/components/fetchers/PreviewModal.js +20 -17
  66. package/components/fetchers/StatusChip.js +22 -18
  67. package/components/group/Entry.js +13 -11
  68. package/components/group/Group.js +13 -10
  69. package/components/group/GroupControl.js +76 -65
  70. package/components/stats/QueryStatus.js +37 -28
  71. package/countBy-C69WslUA.js +14 -0
  72. package/data/event.js +6 -4
  73. package/database/index.js +2 -2
  74. package/debounce-bV0h5FC5.js +92 -0
  75. package/get-D3C3lEU3.js +8 -0
  76. package/groupBy-DC2oOuBN.js +14 -0
  77. package/hooks/ClueActionContext.js +6 -6
  78. package/hooks/ClueComponentContext.js +29 -23
  79. package/hooks/ClueConfigProvider.js +14 -12
  80. package/hooks/ClueDatabaseContext.js +19 -13
  81. package/hooks/ClueEnrichContext.js +8 -8
  82. package/hooks/ClueFetcherContext.js +74 -46
  83. package/hooks/ClueGroupContext.js +17 -14
  84. package/hooks/CluePopupContext.js +5 -5
  85. package/hooks/ClueProvider.js +12 -10
  86. package/hooks/selectors.js +22 -11
  87. package/hooks/useAnnotations.js +45 -29
  88. package/hooks/useClue.js +6 -4
  89. package/hooks/useClueActions.js +3 -3
  90. package/hooks/useClueConfig.js +5 -5
  91. package/hooks/useClueTypeConfig.js +3 -3
  92. package/hooks/useComparator.js +722 -435
  93. package/hooks/useErrors.js +22 -18
  94. package/hooks/useMyHighlights.js +66 -36
  95. package/hooks/useMyLocalStorage.js +63 -43
  96. package/iconify-CXMreGTg.js +1782 -0
  97. package/icons/Action.js +66 -49
  98. package/icons/Assessment.js +84 -68
  99. package/icons/Context.js +75 -61
  100. package/icons/Opinion.js +77 -65
  101. package/icons/iconMap.js +2 -2
  102. package/identity-CPGTqrE4.js +6 -0
  103. package/index-BDVjGvMI.js +696 -0
  104. package/index-BHPT3qoB.js +1172 -0
  105. package/index-BMxyILVD.js +465 -0
  106. package/index-BbPn6-Mw.js +15750 -0
  107. package/index-Dz1kF2MU.js +17654 -0
  108. package/isEmpty-BQkZubqU.js +29 -0
  109. package/isNil-CIubwp4T.js +6 -0
  110. package/isObject-FTY-5JQX.js +7 -0
  111. package/isObjectLike-OAgjjZye.js +48 -0
  112. package/isSymbol-Xd2FsJyp.js +8 -0
  113. package/last-CUCl67Im.js +7 -0
  114. package/main.js +58 -58
  115. package/package.json +1 -1
  116. package/sortBy-B-UKp4GT.js +100 -0
  117. package/sumBy-MYkDPHZL.js +8 -0
  118. package/tabs-xGuUGsJd.js +254 -0
  119. package/text/Frequency.js +42 -23
  120. package/toFinite-Bc55msYj.js +16 -0
  121. package/toNumber-DPxy1FBy.js +39 -0
  122. package/useClueTypeConfig-CH-nGq6a.js +3184 -0
  123. package/utils/chain.js +91 -64
  124. package/utils/classificationParser.js +519 -256
  125. package/utils/constants.js +35 -10
  126. package/utils/graph.js +72 -45
  127. package/utils/hashUtil.js +7 -7
  128. package/utils/line.js +131 -81
  129. package/utils/loggerUtil.js +5 -3
  130. package/utils/sessionStorage.js +41 -29
  131. package/utils/utils.js +9 -9
  132. package/utils/window.js +21 -10
  133. package/utils-Dr4wbKBZ.js +4182 -0
  134. package/ActionForm-BtTv0s4P.js +0 -340
  135. package/AnnotationDetails-D5tBIeEw.js +0 -160
  136. package/AnnotationPreview-CZr_CcZC.js +0 -140
  137. package/ClueEnrichContext-DH9lqjwH.js +0 -401
  138. package/FlexOne-BXWFOd1T.js +0 -6
  139. package/_Map-DXNg_Z-q.js +0 -54
  140. package/_MapCache-Cu25RRDU.js +0 -129
  141. package/_Uint8Array-DlJCtTvG.js +0 -102
  142. package/_baseAssignValue-CUmzp727.js +0 -20
  143. package/_baseClone-BlMmRXeX.js +0 -208
  144. package/_baseExtremum-P_0akmCi.js +0 -27
  145. package/_baseFlatten-CN7vDNEQ.js +0 -72
  146. package/_baseGet-Dgf6_xCm.js +0 -80
  147. package/_baseIsEqual-Cpjtfb3Q.js +0 -173
  148. package/_baseIteratee-CP1bocOX.js +0 -95
  149. package/_baseSlice-M5RKzt1A.js +0 -10
  150. package/_baseSum-wEbgNeUs.js +0 -10
  151. package/_baseUniq-tMFmk80M.js +0 -61
  152. package/_commonjsHelpers-C6fGbg64.js +0 -6
  153. package/_createAggregator-B4Cav8ZM.js +0 -53
  154. package/_getPrototype-CHAFQYL_.js +0 -5
  155. package/_getTag-BV_UoLYG.js +0 -90
  156. package/cloneDeep-BPVpFBzJ.js +0 -8
  157. package/countBy-DOutsa_w.js +0 -8
  158. package/debounce-DryYcbJ4.js +0 -56
  159. package/get-Bow1vKwx.js +0 -8
  160. package/groupBy-BheQYl6f.js +0 -8
  161. package/iconify-BBckr5AQ.js +0 -1263
  162. package/identity-ByMq8VxU.js +0 -6
  163. package/index-BUcHmehh.js +0 -975
  164. package/index-Bo-v5IAc.js +0 -12754
  165. package/index-CnaCBNrd.js +0 -358
  166. package/index-E7g8cRyW.js +0 -568
  167. package/index-p5_wX7q1.js +0 -11729
  168. package/isEmpty-g47Qir2A.js +0 -21
  169. package/isNil-CjWwlQS3.js +0 -6
  170. package/isObject-B53jY8Qg.js +0 -7
  171. package/isObjectLike-BatpeCIi.js +0 -29
  172. package/isSymbol-C3_SC0Qp.js +0 -8
  173. package/last-7CdUxN0r.js +0 -7
  174. package/sortBy-ITdmD17L.js +0 -79
  175. package/sumBy-DxJUU2E8.js +0 -8
  176. package/tabs-CgADNA57.js +0 -195
  177. package/toFinite-BMy6GObD.js +0 -14
  178. package/toNumber-YVhnnJv4.js +0 -31
  179. package/useClueTypeConfig-CneP98N_.js +0 -2260
  180. package/utils-CD0rFIFU.js +0 -2704
@@ -1,194 +1,252 @@
1
- import { jsx as i, jsxs as l, Fragment as ye } from "react/jsx-runtime";
2
- import { useMemo as m, useRef as ee, useState as u, useEffect as z, useCallback as f, createElement as ke } from "react";
3
- import { useTheme as we, lighten as te, darken as oe, Stack as x, Card as R, Typography as Ce, alpha as ne, Autocomplete as ze, TextField as he, FormControl as Se, InputLabel as Ee, Select as Ie, MenuItem as Ne, IconButton as Oe, Collapse as Me } from "@mui/material";
4
- import { p as Pe } from "../../../index-CnaCBNrd.js";
5
- import { z as Fe, i as M, s as p, t as Re, p as ie } from "../../../index-p5_wX7q1.js";
6
- import Te from "../../../hooks/useComparator.js";
7
- import { useMyLocalStorageItem as T } from "../../../hooks/useMyLocalStorage.js";
8
- import { StorageKey as L } from "../../../utils/constants.js";
9
- import { g as Le } from "../../../get-Bow1vKwx.js";
10
- import { cssImportant as k } from "../../../utils/graph.js";
11
- import ae from "../icons/Iconified.js";
12
- import Ae from "./ExpandMoreButton.js";
13
- import Be from "./visualizations/cloud/index.js";
14
- import $e from "./visualizations/panels/NodePanel.js";
15
- import je from "./visualizations/tree/index.js";
16
- const et = ({ graph: t, sx: re = {} }) => {
17
- var X, Z, U, Y, q;
18
- const o = we(), h = m(() => o.palette.mode === "dark", [o]), { runComparator: A } = Te(), r = ee(), se = ee(), [P] = T(L.SHOW_MOUSE_POS, !1), [w] = T(L.SHOW_COORDINATES, !1), [S] = T(L.PANEL_LOCATION, "vertical"), [le, ce] = u(["0", "0"]), [de, me] = u(["0", "0"]), [E, B] = u(!1), $ = m(() => ((t == null ? void 0 : t.data) ?? []).flat(2).map((e) => e.id), [t == null ? void 0 : t.data]), v = m(() => Fe().scaleExtent([0.1, 6]), []), [s, I] = u(M), [N, ue] = u(""), [C, j] = u([]), [O, H] = u(
19
- ((Z = (X = t == null ? void 0 : t.metadata.display) == null ? void 0 : X.visualization) == null ? void 0 : Z.type) ?? "tree"
20
- ), [pe, F] = u(!1);
21
- z(() => {
22
- B(C.length > 0);
23
- }, [C]);
24
- const b = m(
1
+ import { jsx, jsxs, Fragment } from "react/jsx-runtime";
2
+ import { useMemo, useRef, useState, useEffect, useCallback, createElement } from "react";
3
+ import { useTheme, lighten, darken, Stack, Card, Typography, alpha, Autocomplete, TextField, FormControl, InputLabel, Select, MenuItem, IconButton, Collapse } from "@mui/material";
4
+ import { p as parseEvent } from "../../../index-BMxyILVD.js";
5
+ import { z as zoom, i as identity, s as select, t as transform, p as pointer } from "../../../index-BbPn6-Mw.js";
6
+ import useComparator from "../../../hooks/useComparator.js";
7
+ import { useMyLocalStorageItem } from "../../../hooks/useMyLocalStorage.js";
8
+ import { StorageKey } from "../../../utils/constants.js";
9
+ import { g as get } from "../../../get-D3C3lEU3.js";
10
+ import { cssImportant } from "../../../utils/graph.js";
11
+ import Iconified from "../icons/Iconified.js";
12
+ import ExpandMoreButton from "./ExpandMoreButton.js";
13
+ import Cloud from "./visualizations/cloud/index.js";
14
+ import NodePanel from "./visualizations/panels/NodePanel.js";
15
+ import Tree from "./visualizations/tree/index.js";
16
+ const Graph = ({ graph, sx = {} }) => {
17
+ var _a, _b, _c, _d, _e;
18
+ const theme = useTheme();
19
+ const isDark = useMemo(() => theme.palette.mode === "dark", [theme]);
20
+ const { runComparator } = useComparator();
21
+ const svgRef = useRef();
22
+ const pointRef = useRef();
23
+ const [showMousePos] = useMyLocalStorageItem(StorageKey.SHOW_MOUSE_POS, false);
24
+ const [showCoordinates] = useMyLocalStorageItem(StorageKey.SHOW_COORDINATES, false);
25
+ const [panelLocation] = useMyLocalStorageItem(StorageKey.PANEL_LOCATION, "vertical");
26
+ const [relativeMousePos, setRelativeMousePos] = useState(["0", "0"]);
27
+ const [absoluteMousePos, setAbsoluteMousePos] = useState(["0", "0"]);
28
+ const [showPanel, setShowPanel] = useState(false);
29
+ const nodeIds = useMemo(() => ((graph == null ? void 0 : graph.data) ?? []).flat(2).map((node) => node.id), [graph == null ? void 0 : graph.data]);
30
+ const zoom$1 = useMemo(() => zoom().scaleExtent([0.1, 6]), []);
31
+ const [currentZoom, setCurrentZoom] = useState(identity);
32
+ const [nodeId, setNodeId] = useState("");
33
+ const [selectedNodeIds, setSelectedNodeIds] = useState([]);
34
+ const [viz, setViz] = useState(
35
+ ((_b = (_a = graph == null ? void 0 : graph.metadata.display) == null ? void 0 : _a.visualization) == null ? void 0 : _b.type) ?? "tree"
36
+ );
37
+ const [hasError, setHasError] = useState(false);
38
+ useEffect(() => {
39
+ setShowPanel(selectedNodeIds.length > 0);
40
+ }, [selectedNodeIds]);
41
+ const labelKeys = useMemo(
25
42
  () => {
26
- var e, n;
27
- return (n = (e = t == null ? void 0 : t.metadata.display) == null ? void 0 : e.displayField) == null ? void 0 : n.filter((a) => (a.zoom ?? Number.MAX_SAFE_INTEGER) > s.k);
43
+ var _a2, _b2;
44
+ return (_b2 = (_a2 = graph == null ? void 0 : graph.metadata.display) == null ? void 0 : _a2.displayField) == null ? void 0 : _b2.filter((entry) => (entry.zoom ?? Number.MAX_SAFE_INTEGER) > currentZoom.k);
28
45
  },
29
- [(U = t == null ? void 0 : t.metadata.display) == null ? void 0 : U.displayField, s.k]
30
- ), fe = f((e) => {
31
- ue(e);
32
- }, []), V = f((e) => {
33
- const n = e === "view" ? e : `node-${e ?? "will\\%never\\$ever\\*exist"}`;
34
- return p(`#${n}`);
35
- }, []), _ = f(() => {
36
- if (!N) {
37
- F(!0);
46
+ [(_c = graph == null ? void 0 : graph.metadata.display) == null ? void 0 : _c.displayField, currentZoom.k]
47
+ );
48
+ const onNodeChange = useCallback((node) => {
49
+ setNodeId(node);
50
+ }, []);
51
+ const checkForNode = useCallback((_nodeId) => {
52
+ const selector = _nodeId === "view" ? _nodeId : `node-${_nodeId ?? "will\\%never\\$ever\\*exist"}`;
53
+ return select(`#${selector}`);
54
+ }, []);
55
+ const selectNode = useCallback(() => {
56
+ if (!nodeId) {
57
+ setHasError(true);
38
58
  return;
39
59
  }
40
- const e = V(N.replace(/[^A-Za-z0-9]*/g, ""));
41
- if (e.empty()) {
42
- F(!0);
60
+ const nodeToGet = checkForNode(nodeId.replace(/[^A-Za-z0-9]*/g, ""));
61
+ if (nodeToGet.empty()) {
62
+ setHasError(true);
43
63
  return;
44
64
  }
45
- F(!1), j([N]);
46
- const n = r.current.getBoundingClientRect(), a = p(r.current), d = e.node().getBBox();
47
- a.transition().duration(500).call(
48
- v.transform,
49
- M.translate(n.width / 2, n.height / 2).scale(4).translate(-d.x, -d.y)
65
+ setHasError(false);
66
+ setSelectedNodeIds([nodeId]);
67
+ const clientRect = svgRef.current.getBoundingClientRect();
68
+ const svg = select(svgRef.current);
69
+ const box = nodeToGet.node().getBBox();
70
+ svg.transition().duration(500).call(
71
+ zoom$1.transform,
72
+ identity.translate(clientRect.width / 2, clientRect.height / 2).scale(4).translate(-box.x, -box.y)
50
73
  );
51
- }, [V, N, v.transform]), xe = f(
52
- (e) => {
53
- const n = Pe(e);
54
- n.isCtrl && n.isEnter && _();
74
+ }, [checkForNode, nodeId, zoom$1.transform]);
75
+ const onKeyPress = useCallback(
76
+ (event) => {
77
+ const parsedEvent = parseEvent(event);
78
+ if (parsedEvent.isCtrl && parsedEvent.isEnter) {
79
+ selectNode();
80
+ }
55
81
  },
56
- [_]
57
- ), ve = f((e) => ((t == null ? void 0 : t.data) ?? []).flat().find((n) => n.id === e), [t == null ? void 0 : t.data]), g = f(
58
- (e = !1) => {
59
- if (!t)
82
+ [selectNode]
83
+ );
84
+ const findNode = useCallback((id) => ((graph == null ? void 0 : graph.data) ?? []).flat().find((n) => n.id === id), [graph == null ? void 0 : graph.data]);
85
+ const resetZoom = useCallback(
86
+ (instant = false) => {
87
+ if (!graph) {
60
88
  return;
61
- const n = p(r.current).select("#view").node().getBBox(), a = r.current.getBoundingClientRect(), d = Math.min(a.width / (n.width + 25), (a.height - 96) / n.height);
62
- let y = p(r.current);
63
- e || (y = y.transition().duration(500)), y.call(
64
- v.transform,
65
- M.translate(a.width / 2, (a.height + 96) / 2).scale(d).translate(-n.width / 2, -n.height / 2 - 10)
89
+ }
90
+ const box = select(svgRef.current).select("#view").node().getBBox();
91
+ const clientRect = svgRef.current.getBoundingClientRect();
92
+ const zoomLevel = Math.min(clientRect.width / (box.width + 25), (clientRect.height - 96) / box.height);
93
+ let selection = select(svgRef.current);
94
+ if (!instant) {
95
+ selection = selection.transition().duration(500);
96
+ }
97
+ selection.call(
98
+ zoom$1.transform,
99
+ identity.translate(clientRect.width / 2, (clientRect.height + 96) / 2).scale(zoomLevel).translate(-box.width / 2, -box.height / 2 - 10)
66
100
  );
67
101
  },
68
- [v.transform, t]
69
- ), D = f((e) => j(e), []);
70
- z(() => {
71
- t && (se.current = r.current.createSVGPoint(), p(r.current).call(
72
- v.on("zoom", (e) => {
73
- I == null || I(e.transform), p(r.current).select("#view").attr("transform", e.transform);
102
+ [zoom$1.transform, graph]
103
+ );
104
+ const onNodeSelectionChanged = useCallback((_nodeIds) => setSelectedNodeIds(_nodeIds), []);
105
+ useEffect(() => {
106
+ if (!graph) {
107
+ return;
108
+ }
109
+ pointRef.current = svgRef.current.createSVGPoint();
110
+ select(svgRef.current).call(
111
+ zoom$1.on("zoom", (event) => {
112
+ setCurrentZoom == null ? void 0 : setCurrentZoom(event.transform);
113
+ select(svgRef.current).select("#view").attr("transform", event.transform);
74
114
  })
75
- ));
76
- }, [I, v, O, t]), z(() => {
77
- P && p(r.current).on("mousemove", (e) => {
78
- const n = Re(p(r.current).select("#view").node());
79
- me(n.invert(ie(e)).map((a) => a.toFixed(0))), ce(ie(e).map((a) => a.toFixed(0)));
80
- });
81
- }, [P, t]), z(() => {
82
- g();
83
- }, [O, t == null ? void 0 : t.data]), z(() => {
84
- var e, n, a, d;
85
- (n = (e = t == null ? void 0 : t.metadata.display) == null ? void 0 : e.visualization) != null && n.type && H((d = (a = t == null ? void 0 : t.metadata.display) == null ? void 0 : a.visualization) == null ? void 0 : d.type);
86
- }, [(q = (Y = t == null ? void 0 : t.metadata.display) == null ? void 0 : Y.visualization) == null ? void 0 : q.type]);
87
- const G = m(
115
+ );
116
+ }, [setCurrentZoom, zoom$1, viz, graph]);
117
+ useEffect(() => {
118
+ if (showMousePos) {
119
+ select(svgRef.current).on("mousemove", (event) => {
120
+ const _zoom = transform(select(svgRef.current).select("#view").node());
121
+ setAbsoluteMousePos(_zoom.invert(pointer(event)).map((n) => n.toFixed(0)));
122
+ setRelativeMousePos(pointer(event).map((n) => n.toFixed(0)));
123
+ });
124
+ }
125
+ }, [showMousePos, graph]);
126
+ useEffect(() => {
127
+ resetZoom();
128
+ }, [viz, graph == null ? void 0 : graph.data]);
129
+ useEffect(() => {
130
+ var _a2, _b2, _c2, _d2;
131
+ if ((_b2 = (_a2 = graph == null ? void 0 : graph.metadata.display) == null ? void 0 : _a2.visualization) == null ? void 0 : _b2.type) {
132
+ setViz((_d2 = (_c2 = graph == null ? void 0 : graph.metadata.display) == null ? void 0 : _c2.visualization) == null ? void 0 : _d2.type);
133
+ }
134
+ }, [(_e = (_d = graph == null ? void 0 : graph.metadata.display) == null ? void 0 : _d.visualization) == null ? void 0 : _e.type]);
135
+ const treeOptions = useMemo(
88
136
  () => ({
89
- textColor: o.palette.text.primary,
90
- backgroundColor: o.palette.background.paper,
137
+ textColor: theme.palette.text.primary,
138
+ backgroundColor: theme.palette.background.paper,
91
139
  nodeColor: {
92
- border: (h ? te : oe)(o.palette.background.paper, 0.3),
140
+ border: (isDark ? lighten : darken)(theme.palette.background.paper, 0.3),
93
141
  center: "white"
94
142
  }
95
143
  }),
96
- [h, o.palette.background.paper, o.palette.text.primary]
97
- ), W = m(
144
+ [isDark, theme.palette.background.paper, theme.palette.text.primary]
145
+ );
146
+ const cloudOptions = useMemo(
98
147
  () => ({
99
- textColor: o.palette.text.primary,
100
- backgroundColor: o.palette.background.paper,
148
+ textColor: theme.palette.text.primary,
149
+ backgroundColor: theme.palette.background.paper,
101
150
  nodeColor: {
102
- border: (h ? te : oe)(o.palette.background.paper, 0.3),
151
+ border: (isDark ? lighten : darken)(theme.palette.background.paper, 0.3),
103
152
  center: "white"
104
153
  }
105
154
  }),
106
- [h, o.palette.background.paper, o.palette.text.primary]
107
- ), K = m(
155
+ [isDark, theme.palette.background.paper, theme.palette.text.primary]
156
+ );
157
+ const visualizations = useMemo(
108
158
  () => ({
109
- tree: () => /* @__PURE__ */ i(
110
- je,
159
+ tree: () => /* @__PURE__ */ jsx(
160
+ Tree,
111
161
  {
112
- svgRef: r,
113
- graph: t,
114
- labelKeys: b,
115
- onNodeSelectionChanged: D,
116
- zoom: s,
117
- options: G
162
+ svgRef,
163
+ graph,
164
+ labelKeys,
165
+ onNodeSelectionChanged,
166
+ zoom: currentZoom,
167
+ options: treeOptions
118
168
  }
119
169
  ),
120
- cloud: () => /* @__PURE__ */ i(Be, { svgRef: r, graph: t, options: W })
170
+ cloud: () => /* @__PURE__ */ jsx(Cloud, { svgRef, graph, options: cloudOptions })
121
171
  }),
122
- [W, s, t, b, D, G]
123
- ), be = m(() => $.flatMap((e) => {
124
- var y, J;
125
- const n = (((y = t == null ? void 0 : t.data) == null ? void 0 : y.flat()) ?? []).find((c) => c.id === e);
126
- return n ? (((J = b == null ? void 0 : b.filter((c) => A(c, n)).pop()) == null ? void 0 : J.label) ?? "id").split(",").map((c) => {
127
- var Q;
128
- return (Q = Le(n, c)) == null ? void 0 : Q.toString();
129
- }).filter((c) => !!c).map((c) => ({ id: e, value: c.trim() })) : { id: e, value: e };
130
- }), [t == null ? void 0 : t.data, b, $, A]);
131
- return /* @__PURE__ */ l(
132
- x,
172
+ [cloudOptions, currentZoom, graph, labelKeys, onNodeSelectionChanged, treeOptions]
173
+ );
174
+ const suggestions = useMemo(() => {
175
+ return nodeIds.flatMap((id) => {
176
+ var _a2, _b2;
177
+ const node = (((_a2 = graph == null ? void 0 : graph.data) == null ? void 0 : _a2.flat()) ?? []).find((_node) => _node.id === id);
178
+ if (!node) {
179
+ return { id, value: id };
180
+ }
181
+ const key = ((_b2 = labelKeys == null ? void 0 : labelKeys.filter((comparator) => runComparator(comparator, node)).pop()) == null ? void 0 : _b2.label) ?? "id";
182
+ const value = key.split(",").map((_key) => {
183
+ var _a3;
184
+ return (_a3 = get(node, _key)) == null ? void 0 : _a3.toString();
185
+ }).filter((val) => !!val).map((_value) => ({ id, value: _value.trim() }));
186
+ return value;
187
+ });
188
+ }, [graph == null ? void 0 : graph.data, labelKeys, nodeIds, runComparator]);
189
+ return /* @__PURE__ */ jsxs(
190
+ Stack,
133
191
  {
134
- direction: S === "vertical" ? "row" : "column",
192
+ direction: panelLocation === "vertical" ? "row" : "column",
135
193
  spacing: 1,
136
194
  overflow: "hidden",
137
195
  height: "100%",
138
196
  width: "100%",
139
- sx: re,
197
+ sx,
140
198
  children: [
141
- /* @__PURE__ */ i(x, { direction: "column", spacing: 1, sx: { position: "relative", flex: 1 }, children: /* @__PURE__ */ l(
142
- R,
199
+ /* @__PURE__ */ jsx(Stack, { direction: "column", spacing: 1, sx: { position: "relative", flex: 1 }, children: /* @__PURE__ */ jsxs(
200
+ Card,
143
201
  {
144
202
  variant: "outlined",
145
203
  sx: {
146
204
  flex: 1,
147
205
  position: "relative",
148
- maxHeight: `calc(100vh - 64px - ${o.spacing(1)})`,
206
+ maxHeight: `calc(100vh - 64px - ${theme.spacing(1)})`,
149
207
  "& #viz": {
150
- maxHeight: `calc(100vh - 64px - ${o.spacing(1)})`,
208
+ maxHeight: `calc(100vh - 64px - ${theme.spacing(1)})`,
151
209
  width: "100%",
152
210
  height: "100%",
153
- backgroundColor: o.palette.background.paper
211
+ backgroundColor: theme.palette.background.paper
154
212
  },
155
213
  "& .path": {
156
- transition: o.transitions.create(["opacity"], {
157
- duration: o.transitions.duration.short
214
+ transition: theme.transitions.create(["opacity"], {
215
+ duration: theme.transitions.duration.short
158
216
  })
159
217
  },
160
218
  "& .node": {
161
219
  cursor: "pointer",
162
220
  "& > path, & > text, & > polygon, & circle": {
163
- transition: o.transitions.create(["stroke", "fill", "fill-opacity", "stroke-opacity"], {
164
- duration: o.transitions.duration.short
221
+ transition: theme.transitions.create(["stroke", "fill", "fill-opacity", "stroke-opacity"], {
222
+ duration: theme.transitions.duration.short
165
223
  })
166
224
  },
167
225
  "&.hover > .center": {
168
- stroke: k(o.palette.primary.main)
226
+ stroke: cssImportant(theme.palette.primary.main)
169
227
  },
170
228
  "&.hover > .border": {
171
- stroke: k(o.palette.primary.dark)
229
+ stroke: cssImportant(theme.palette.primary.dark)
172
230
  },
173
231
  "&.selected > .center": {
174
- stroke: k(o.palette.success.main)
232
+ stroke: cssImportant(theme.palette.success.main)
175
233
  },
176
234
  "&.selected > .border": {
177
- stroke: k(o.palette.success.dark)
235
+ stroke: cssImportant(theme.palette.success.dark)
178
236
  },
179
237
  "&.selected.hover > .center": {
180
- stroke: k(o.palette.primary.main)
238
+ stroke: cssImportant(theme.palette.primary.main)
181
239
  },
182
240
  "&.selected.hover > .border": {
183
- stroke: k(o.palette.primary.dark)
241
+ stroke: cssImportant(theme.palette.primary.dark)
184
242
  }
185
243
  }
186
244
  },
187
245
  children: [
188
- t ? K[O]() : /* @__PURE__ */ l(ye, { children: [
189
- /* @__PURE__ */ i("svg", { id: "viz", ref: r, children: /* @__PURE__ */ i("g", { id: "view" }) }),
190
- /* @__PURE__ */ i(
191
- Ce,
246
+ graph ? visualizations[viz]() : /* @__PURE__ */ jsxs(Fragment, { children: [
247
+ /* @__PURE__ */ jsx("svg", { id: "viz", ref: svgRef, children: /* @__PURE__ */ jsx("g", { id: "view" }) }),
248
+ /* @__PURE__ */ jsx(
249
+ Typography,
192
250
  {
193
251
  variant: "h1",
194
252
  color: "text.secondary",
@@ -203,19 +261,19 @@ const et = ({ graph: t, sx: re = {} }) => {
203
261
  }
204
262
  )
205
263
  ] }),
206
- /* @__PURE__ */ i(
207
- x,
264
+ /* @__PURE__ */ jsx(
265
+ Stack,
208
266
  {
209
267
  direction: "column",
210
268
  spacing: 1,
211
269
  sx: {
212
270
  position: "absolute",
213
- top: o.spacing(1),
214
- left: o.spacing(1),
215
- right: o.spacing(1)
271
+ top: theme.spacing(1),
272
+ left: theme.spacing(1),
273
+ right: theme.spacing(1)
216
274
  },
217
- children: /* @__PURE__ */ l(
218
- x,
275
+ children: /* @__PURE__ */ jsxs(
276
+ Stack,
219
277
  {
220
278
  direction: "row",
221
279
  spacing: 1,
@@ -223,62 +281,62 @@ const et = ({ graph: t, sx: re = {} }) => {
223
281
  "& > div:first-of-type": {
224
282
  flex: 1,
225
283
  maxWidth: "775px",
226
- backgroundColor: ne(o.palette.background.paper, 0.8)
284
+ backgroundColor: alpha(theme.palette.background.paper, 0.8)
227
285
  }
228
286
  },
229
287
  children: [
230
- /* @__PURE__ */ i(
231
- ze,
288
+ /* @__PURE__ */ jsx(
289
+ Autocomplete,
232
290
  {
233
- disablePortal: !0,
234
- onChange: (e, n) => fe(n.id),
235
- onKeyDown: xe,
236
- options: be,
291
+ disablePortal: true,
292
+ onChange: (__, value) => onNodeChange(value.id),
293
+ onKeyDown: onKeyPress,
294
+ options: suggestions,
237
295
  sx: { width: "400px" },
238
- getOptionLabel: (e) => e.value,
239
- filterOptions: (e, n) => e.filter((a) => a.value.toLowerCase().includes(n.inputValue)),
240
- renderOption: (e, n) => /* @__PURE__ */ ke("li", { ...e, key: n.id + n.value }, n.value),
241
- renderInput: (e) => /* @__PURE__ */ i(
242
- he,
296
+ getOptionLabel: (option) => option.value,
297
+ filterOptions: (options, state) => options.filter((opt) => opt.value.toLowerCase().includes(state.inputValue)),
298
+ renderOption: (props, option) => /* @__PURE__ */ createElement("li", { ...props, key: option.id + option.value }, option.value),
299
+ renderInput: (params) => /* @__PURE__ */ jsx(
300
+ TextField,
243
301
  {
244
- ...e,
245
- error: pe,
302
+ ...params,
303
+ error: hasError,
246
304
  label: "Enter a node ID, and press [ctrl + enter] to select it. [ctrl + space] will open an autocomplete menu."
247
305
  }
248
306
  )
249
307
  }
250
308
  ),
251
- /* @__PURE__ */ l(Se, { sx: { minWidth: "150px", backgroundColor: ne(o.palette.background.paper, 0.8) }, children: [
252
- /* @__PURE__ */ i(Ee, { id: "viz-label", children: "Visualization" }),
253
- /* @__PURE__ */ i(
254
- Ie,
309
+ /* @__PURE__ */ jsxs(FormControl, { sx: { minWidth: "150px", backgroundColor: alpha(theme.palette.background.paper, 0.8) }, children: [
310
+ /* @__PURE__ */ jsx(InputLabel, { id: "viz-label", children: "Visualization" }),
311
+ /* @__PURE__ */ jsx(
312
+ Select,
255
313
  {
256
314
  label: "Visualization",
257
315
  labelId: "viz-label",
258
- value: O,
259
- onChange: (e) => H(e.target.value),
316
+ value: viz,
317
+ onChange: (event) => setViz(event.target.value),
260
318
  sx: { textTransform: "capitalize" },
261
- children: Object.keys(K).map((e) => /* @__PURE__ */ i(Ne, { value: e, sx: { textTransform: "capitalize" }, children: e }, e))
319
+ children: Object.keys(visualizations).map((_viz) => /* @__PURE__ */ jsx(MenuItem, { value: _viz, sx: { textTransform: "capitalize" }, children: _viz }, _viz))
262
320
  }
263
321
  )
264
322
  ] }),
265
- /* @__PURE__ */ i(
266
- Ae,
323
+ /* @__PURE__ */ jsx(
324
+ ExpandMoreButton,
267
325
  {
268
- disabled: C.length < 1,
269
- expand: E,
270
- onClick: () => B(!E),
271
- "aria-expanded": E,
326
+ disabled: selectedNodeIds.length < 1,
327
+ expand: showPanel,
328
+ onClick: () => setShowPanel(!showPanel),
329
+ "aria-expanded": showPanel,
272
330
  "aria-label": "show more",
273
331
  size: "small",
274
332
  sx: {
275
333
  marginLeft: "auto !important",
276
334
  alignSelf: "center"
277
335
  },
278
- children: /* @__PURE__ */ i(
279
- ae,
336
+ children: /* @__PURE__ */ jsx(
337
+ Iconified,
280
338
  {
281
- icon: S === "vertical" ? "ic:baseline-chevron-left" : "ic:baseline-expand-more",
339
+ icon: panelLocation === "vertical" ? "ic:baseline-chevron-left" : "ic:baseline-expand-more",
282
340
  fontSize: "medium"
283
341
  }
284
342
  )
@@ -289,61 +347,61 @@ const et = ({ graph: t, sx: re = {} }) => {
289
347
  )
290
348
  }
291
349
  ),
292
- /* @__PURE__ */ i(
293
- R,
350
+ /* @__PURE__ */ jsx(
351
+ Card,
294
352
  {
295
- variant: w ? "elevation" : "outlined",
296
- elevation: w ? 4 : 0,
353
+ variant: showCoordinates ? "elevation" : "outlined",
354
+ elevation: showCoordinates ? 4 : 0,
297
355
  sx: {
298
356
  position: "absolute",
299
- bottom: o.spacing(0.5),
300
- right: o.spacing(0.5),
357
+ bottom: theme.spacing(0.5),
358
+ right: theme.spacing(0.5),
301
359
  px: 1,
302
360
  py: 0.5,
303
361
  border: "none !important"
304
362
  },
305
- children: /* @__PURE__ */ l(x, { direction: "row", spacing: 0.5, alignItems: "center", children: [
306
- w && /* @__PURE__ */ l("span", { children: [
307
- s.x.toFixed(0),
363
+ children: /* @__PURE__ */ jsxs(Stack, { direction: "row", spacing: 0.5, alignItems: "center", children: [
364
+ showCoordinates && /* @__PURE__ */ jsxs("span", { children: [
365
+ currentZoom.x.toFixed(0),
308
366
  ", ",
309
- s.y.toFixed(0),
367
+ currentZoom.y.toFixed(0),
310
368
  " (",
311
- s.k.toFixed(2),
369
+ currentZoom.k.toFixed(2),
312
370
  "x)"
313
371
  ] }),
314
- /* @__PURE__ */ i(
315
- Oe,
372
+ /* @__PURE__ */ jsx(
373
+ IconButton,
316
374
  {
317
- size: w ? "small" : "medium",
318
- onClick: () => g(),
319
- disabled: s.k === M.k && s.x === 0 && s.y === 0,
320
- children: /* @__PURE__ */ i(ae, { icon: "ic:baseline-refresh", fontSize: w ? "small" : "medium" })
375
+ size: showCoordinates ? "small" : "medium",
376
+ onClick: () => resetZoom(),
377
+ disabled: currentZoom.k === identity.k && currentZoom.x === 0 && currentZoom.y === 0,
378
+ children: /* @__PURE__ */ jsx(Iconified, { icon: "ic:baseline-refresh", fontSize: showCoordinates ? "small" : "medium" })
321
379
  }
322
380
  )
323
381
  ] })
324
382
  }
325
383
  ),
326
- P && /* @__PURE__ */ i(
327
- R,
384
+ showMousePos && /* @__PURE__ */ jsx(
385
+ Card,
328
386
  {
329
387
  variant: "elevation",
330
388
  elevation: 4,
331
389
  sx: {
332
390
  position: "absolute",
333
- bottom: o.spacing(0.5),
334
- left: o.spacing(0.5),
391
+ bottom: theme.spacing(0.5),
392
+ left: theme.spacing(0.5),
335
393
  px: 1,
336
394
  py: 0.5
337
395
  },
338
- children: /* @__PURE__ */ i("code", { children: /* @__PURE__ */ l(x, { direction: "row", spacing: 1, children: [
339
- /* @__PURE__ */ l("span", { children: [
396
+ children: /* @__PURE__ */ jsx("code", { children: /* @__PURE__ */ jsxs(Stack, { direction: "row", spacing: 1, children: [
397
+ /* @__PURE__ */ jsxs("span", { children: [
340
398
  "(abs: ",
341
- de.join(", "),
399
+ absoluteMousePos.join(", "),
342
400
  ")"
343
401
  ] }),
344
- /* @__PURE__ */ l("span", { children: [
402
+ /* @__PURE__ */ jsxs("span", { children: [
345
403
  "(rel: ",
346
- le.join(", "),
404
+ relativeMousePos.join(", "),
347
405
  ")"
348
406
  ] })
349
407
  ] }) })
@@ -352,21 +410,21 @@ const et = ({ graph: t, sx: re = {} }) => {
352
410
  ]
353
411
  }
354
412
  ) }),
355
- /* @__PURE__ */ i(
356
- Me,
413
+ /* @__PURE__ */ jsx(
414
+ Collapse,
357
415
  {
358
- in: E && C.length > 0,
359
- orientation: S === "vertical" ? "horizontal" : "vertical",
360
- appear: !0,
361
- unmountOnExit: !0,
362
- children: /* @__PURE__ */ i(
363
- x,
416
+ in: showPanel && selectedNodeIds.length > 0,
417
+ orientation: panelLocation === "vertical" ? "horizontal" : "vertical",
418
+ appear: true,
419
+ unmountOnExit: true,
420
+ children: /* @__PURE__ */ jsx(
421
+ Stack,
364
422
  {
365
423
  direction: "column",
366
424
  spacing: 1,
367
- sx: S === "vertical" ? { width: "450px", height: "100%" } : { width: "100%", height: "300px" },
425
+ sx: panelLocation === "vertical" ? { width: "450px", height: "100%" } : { width: "100%", height: "300px" },
368
426
  pb: 1,
369
- children: /* @__PURE__ */ i($e, { selectedNodeIds: C, findNode: ve })
427
+ children: /* @__PURE__ */ jsx(NodePanel, { selectedNodeIds, findNode })
370
428
  }
371
429
  )
372
430
  }
@@ -376,5 +434,5 @@ const et = ({ graph: t, sx: re = {} }) => {
376
434
  );
377
435
  };
378
436
  export {
379
- et as default
437
+ Graph as default
380
438
  };