@cccsaurora/clue-ui 1.0.0 → 1.0.1-dev.55

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-c5hLIfQ-.js +436 -0
  2. package/AnnotationPreview-BvNpZOP0.js +188 -0
  3. package/ClueEnrichContext-m-4vn9rz.js +518 -0
  4. package/FlexOne-BSYAhhtG.js +9 -0
  5. package/_Map-kgDsDYxq.js +64 -0
  6. package/_MapCache-DabaaWfq.js +161 -0
  7. package/_Uint8Array-BlVVH1tp.js +129 -0
  8. package/_baseAssignValue-CNbcU6Nb.js +25 -0
  9. package/_baseClone-D3a8Pa4T.js +284 -0
  10. package/_baseExtremum-B1o1zHjR.js +33 -0
  11. package/_baseFlatten-D4huXoEI.js +92 -0
  12. package/_baseGet-BSK_nnoz.js +109 -0
  13. package/_baseIsEqual-B5xLoweL.js +238 -0
  14. package/_baseIteratee-p6Nj07-n.js +126 -0
  15. package/_baseSlice-GAv_YFTT.js +20 -0
  16. package/_baseSum-D0WC1dN0.js +13 -0
  17. package/_baseUniq-CpupKWcL.js +89 -0
  18. package/_commonjsHelpers-CUmg6egw.js +6 -0
  19. package/_createAggregator-BpVy5xMi.js +63 -0
  20. package/_getPrototype-D1LAdQKO.js +5 -0
  21. package/_getTag-D3ToyefI.js +126 -0
  22. package/cloneDeep-CjP5k9zW.js +8 -0
  23. package/components/AnnotationBody.js +49 -34
  24. package/components/AnnotationDetailPopover.js +36 -30
  25. package/components/AnnotationDetails.js +109 -94
  26. package/components/AnnotationEntry.js +55 -52
  27. package/components/AnnotationPreview.js +5 -5
  28. package/components/ClassificationChip.js +44 -23
  29. package/components/CountBadge.js +31 -26
  30. package/components/EnrichedCard.js +104 -92
  31. package/components/EnrichedChip.js +134 -109
  32. package/components/EnrichedTypography.js +136 -110
  33. package/components/ErrorBoundary.js +28 -24
  34. package/components/RetryFailedEnrichments.js +10 -9
  35. package/components/SourcePicker.js +57 -49
  36. package/components/actions/ActionForm.js +4 -4
  37. package/components/actions/ExecutePopover.js +64 -50
  38. package/components/actions/ResultModal.js +37 -34
  39. package/components/actions/form/schemaAdapter.js +39 -20
  40. package/components/display/graph/ExpandMoreButton.js +10 -10
  41. package/components/display/graph/elements/NodeCard.js +92 -76
  42. package/components/display/graph/elements/NodeTag.js +15 -13
  43. package/components/display/graph/index.js +258 -200
  44. package/components/display/graph/visualizations/Leaf.js +88 -69
  45. package/components/display/graph/visualizations/cloud/index.js +98 -81
  46. package/components/display/graph/visualizations/icons/BaseIcon.js +26 -21
  47. package/components/display/graph/visualizations/icons/BugIcon.js +12 -12
  48. package/components/display/graph/visualizations/icons/HostIcon.js +12 -12
  49. package/components/display/graph/visualizations/icons/NetworkIcon.js +12 -12
  50. package/components/display/graph/visualizations/icons/ProcessIcon.js +12 -12
  51. package/components/display/graph/visualizations/icons/TargetIcon.js +13 -13
  52. package/components/display/graph/visualizations/icons/index.js +14 -13
  53. package/components/display/graph/visualizations/panels/NodePanel.js +10 -8
  54. package/components/display/graph/visualizations/tree/BundleLine.js +108 -81
  55. package/components/display/graph/visualizations/tree/Triangle.js +13 -13
  56. package/components/display/graph/visualizations/tree/index.js +407 -305
  57. package/components/display/icons/Iconified.js +27 -12
  58. package/components/display/json/index.js +4 -4
  59. package/components/display/markdown/DynamicTabs.js +22 -17
  60. package/components/display/markdown/index.js +8527 -5670
  61. package/components/display/markdown/markdownPlugins/tabs.js +1 -1
  62. package/components/enrichment/EnrichPopover.js +55 -47
  63. package/components/fetchers/Fetcher.js +123 -95
  64. package/components/fetchers/PreviewModal.js +20 -17
  65. package/components/fetchers/StatusChip.js +22 -18
  66. package/components/group/Entry.js +13 -11
  67. package/components/group/Group.js +13 -10
  68. package/components/group/GroupControl.js +76 -65
  69. package/components/stats/QueryStatus.js +37 -28
  70. package/countBy-C69WslUA.js +14 -0
  71. package/data/event.js +6 -4
  72. package/database/index.js +2 -2
  73. package/debounce-bV0h5FC5.js +92 -0
  74. package/get-D3C3lEU3.js +8 -0
  75. package/groupBy-DC2oOuBN.js +14 -0
  76. package/hooks/ClueActionContext.js +6 -6
  77. package/hooks/ClueComponentContext.js +29 -23
  78. package/hooks/ClueConfigProvider.js +14 -12
  79. package/hooks/ClueDatabaseContext.js +19 -13
  80. package/hooks/ClueEnrichContext.js +8 -8
  81. package/hooks/ClueFetcherContext.js +74 -46
  82. package/hooks/ClueGroupContext.js +17 -14
  83. package/hooks/CluePopupContext.js +5 -5
  84. package/hooks/ClueProvider.js +12 -10
  85. package/hooks/selectors.js +22 -11
  86. package/hooks/useAnnotations.js +48 -32
  87. package/hooks/useClue.js +6 -4
  88. package/hooks/useClueActions.js +3 -3
  89. package/hooks/useClueConfig.js +5 -5
  90. package/hooks/useClueTypeConfig.js +3 -3
  91. package/hooks/useComparator.js +722 -435
  92. package/hooks/useErrors.js +22 -18
  93. package/hooks/useMyHighlights.js +66 -36
  94. package/hooks/useMyLocalStorage.js +63 -43
  95. package/iconify-CXMreGTg.js +1782 -0
  96. package/icons/Action.js +66 -49
  97. package/icons/Assessment.js +84 -68
  98. package/icons/Context.js +75 -61
  99. package/icons/Opinion.js +77 -65
  100. package/icons/iconMap.js +2 -2
  101. package/identity-CPGTqrE4.js +6 -0
  102. package/index-BDVjGvMI.js +696 -0
  103. package/index-BDrtH5ec.js +465 -0
  104. package/index-BbPn6-Mw.js +15750 -0
  105. package/index-C9lySIVX.js +1172 -0
  106. package/index-Dn2NHyXg.js +17654 -0
  107. package/isEmpty-BQkZubqU.js +29 -0
  108. package/isNil-CIubwp4T.js +6 -0
  109. package/isObject-FTY-5JQX.js +7 -0
  110. package/isObjectLike-OAgjjZye.js +48 -0
  111. package/isSymbol-Xd2FsJyp.js +8 -0
  112. package/isUndefined-CE8h73dH.js +10 -0
  113. package/last-CUCl67Im.js +7 -0
  114. package/main.js +68 -68
  115. package/package.json +4 -4
  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-D4zcy8Gr.js +3184 -0
  123. package/utils/chain.js +91 -64
  124. package/utils/classificationParser.js +504 -254
  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-CxIhC2xH.js +4182 -0
  134. package/ActionForm-WIj7BfD5.js +0 -340
  135. package/AnnotationPreview-DWRDhxUB.js +0 -140
  136. package/ClueEnrichContext-CbJVBm4w.js +0 -397
  137. package/FlexOne-BXWFOd1T.js +0 -6
  138. package/_Map-DXNg_Z-q.js +0 -54
  139. package/_MapCache-Cu25RRDU.js +0 -129
  140. package/_Uint8Array-DlJCtTvG.js +0 -102
  141. package/_baseAssignValue-CUmzp727.js +0 -20
  142. package/_baseClone-BlMmRXeX.js +0 -208
  143. package/_baseExtremum-P_0akmCi.js +0 -27
  144. package/_baseFlatten-CN7vDNEQ.js +0 -72
  145. package/_baseGet-Dgf6_xCm.js +0 -80
  146. package/_baseIsEqual-Cpjtfb3Q.js +0 -173
  147. package/_baseIteratee-CP1bocOX.js +0 -95
  148. package/_baseSlice-M5RKzt1A.js +0 -10
  149. package/_baseSum-wEbgNeUs.js +0 -10
  150. package/_baseUniq-tMFmk80M.js +0 -61
  151. package/_commonjsHelpers-C6fGbg64.js +0 -6
  152. package/_createAggregator-B4Cav8ZM.js +0 -53
  153. package/_getPrototype-CHAFQYL_.js +0 -5
  154. package/_getTag-BV_UoLYG.js +0 -90
  155. package/cloneDeep-BPVpFBzJ.js +0 -8
  156. package/countBy-DOutsa_w.js +0 -8
  157. package/debounce-DryYcbJ4.js +0 -56
  158. package/get-Bow1vKwx.js +0 -8
  159. package/groupBy-BheQYl6f.js +0 -8
  160. package/iconify-BBckr5AQ.js +0 -1263
  161. package/identity-ByMq8VxU.js +0 -6
  162. package/index-4YFAh_sa.js +0 -358
  163. package/index-E7g8cRyW.js +0 -568
  164. package/index-HuYhutsd.js +0 -975
  165. package/index-WvFmjbxF.js +0 -12734
  166. package/index-p5_wX7q1.js +0 -11729
  167. package/isEmpty-g47Qir2A.js +0 -21
  168. package/isNil-CjWwlQS3.js +0 -6
  169. package/isObject-B53jY8Qg.js +0 -7
  170. package/isObjectLike-BatpeCIi.js +0 -29
  171. package/isSymbol-C3_SC0Qp.js +0 -8
  172. package/isUndefined-DiNCDKoz.js +0 -10
  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-BQ33EiyB.js +0 -2273
  180. package/utils-C_RX5uMP.js +0 -2704
@@ -1,136 +1,150 @@
1
- import { jsxs as n, jsx as i } from "react/jsx-runtime";
2
- import { I as E } from "../iconify-BBckr5AQ.js";
3
- import { useTheme as M, Stack as l, Typography as s, Tooltip as x, Box as z, IconButton as A, CircularProgress as N, Chip as S, Accordion as $, AccordionSummary as j, AccordionDetails as _, Divider as u } from "@mui/material";
4
- import g from "./display/icons/Iconified.js";
5
- import { SNACKBAR_EVENT_ID as O } from "../data/event.js";
6
- import { ClueComponentContext as F } from "../hooks/ClueComponentContext.js";
7
- import { useClueEnrichSelector as H } from "../hooks/selectors.js";
8
- import K from "../hooks/useAnnotations.js";
9
- import L from "../hooks/useErrors.js";
10
- import { ICON_MAP as T } from "../icons/iconMap.js";
11
- import { safeDispatchEvent as U } from "../utils/window.js";
12
- import { memo as V, useState as W, useMemo as k, useCallback as G, useEffect as J } from "react";
13
- import { u as P } from "../index-E7g8cRyW.js";
14
- import Q from "./actions/ExecutePopover.js";
15
- import X from "./AnnotationEntry.js";
16
- import Y from "./ClassificationChip.js";
17
- import Z from "./enrichment/EnrichPopover.js";
18
- import { u as q } from "../ClueEnrichContext-CbJVBm4w.js";
19
- import { g as R } from "../groupBy-BheQYl6f.js";
20
- import { i as w } from "../isUndefined-DiNCDKoz.js";
21
- const ii = ({ enrichRequest: o, setReady: d, updatePosition: p }) => {
22
- const v = M(), { t: c } = P(F, (a) => a.i18next), [r, I] = W("all"), y = H((a) => a.enrich), [t, C] = K(
23
- o == null ? void 0 : o.type,
24
- o == null ? void 0 : o.value,
25
- o == null ? void 0 : o.classification,
26
- { skipEnrichment: !0 }
27
- ), m = L(o == null ? void 0 : o.value), B = k(
28
- () => ["all", ...q((t ?? []).map((a) => a.type))],
29
- [t]
30
- ), b = k(() => R(t ?? [], "type"), [t]), h = G(async () => {
31
- await y(o.type, o.value, {
32
- classification: o.classification,
1
+ import { jsxs, jsx } from "react/jsx-runtime";
2
+ import { I as Icon } from "../iconify-CXMreGTg.js";
3
+ import { useTheme, Stack, Typography, Tooltip, Box, IconButton, CircularProgress, Chip, Accordion, AccordionSummary, AccordionDetails, Divider } from "@mui/material";
4
+ import Iconified from "./display/icons/Iconified.js";
5
+ import { SNACKBAR_EVENT_ID } from "../data/event.js";
6
+ import { ClueComponentContext } from "../hooks/ClueComponentContext.js";
7
+ import { useClueEnrichSelector } from "../hooks/selectors.js";
8
+ import useAnnotations from "../hooks/useAnnotations.js";
9
+ import useErrors from "../hooks/useErrors.js";
10
+ import { ICON_MAP } from "../icons/iconMap.js";
11
+ import { safeDispatchEvent } from "../utils/window.js";
12
+ import { memo, useState, useMemo, useCallback, useEffect } from "react";
13
+ import { u as useContextSelector } from "../index-BDVjGvMI.js";
14
+ import ExecutePopover from "./actions/ExecutePopover.js";
15
+ import AnnotationEntry from "./AnnotationEntry.js";
16
+ import ClassificationChip from "./ClassificationChip.js";
17
+ import EnrichPopover from "./enrichment/EnrichPopover.js";
18
+ import { u as uniq } from "../ClueEnrichContext-m-4vn9rz.js";
19
+ import { g as groupBy } from "../groupBy-DC2oOuBN.js";
20
+ import { i as isNull } from "../isUndefined-CE8h73dH.js";
21
+ const AnnotationDetails = ({ enrichRequest, setReady, updatePosition }) => {
22
+ const theme = useTheme();
23
+ const { t } = useContextSelector(ClueComponentContext, (ctx) => ctx.i18next);
24
+ const [filter, setFilter] = useState("all");
25
+ const enrich = useClueEnrichSelector((state) => state.enrich);
26
+ const [annotations, loading] = useAnnotations(
27
+ enrichRequest == null ? void 0 : enrichRequest.type,
28
+ enrichRequest == null ? void 0 : enrichRequest.value,
29
+ enrichRequest == null ? void 0 : enrichRequest.classification,
30
+ { skipEnrichment: true }
31
+ );
32
+ const errors = useErrors(enrichRequest == null ? void 0 : enrichRequest.value);
33
+ const options = useMemo(
34
+ () => ["all", ...uniq((annotations ?? []).map((annotation) => annotation.type))],
35
+ [annotations]
36
+ );
37
+ const annotationsByType = useMemo(() => groupBy(annotations ?? [], "type"), [annotations]);
38
+ const forceEnrich = useCallback(async () => {
39
+ await enrich(enrichRequest.type, enrichRequest.value, {
40
+ classification: enrichRequest.classification,
33
41
  timeout: 15,
34
- force: !0
42
+ force: true
35
43
  });
36
- }, [o, y]);
37
- return J(() => {
38
- d && (d(o && !w(t)), p == null || p());
39
- }, [t, o, d, p]), o && !w(t) && /* @__PURE__ */ n(l, { direction: "column", sx: { p: 1, width: "100%" }, spacing: 1, children: [
40
- /* @__PURE__ */ n(l, { spacing: 1, children: [
41
- /* @__PURE__ */ n(l, { direction: "row", spacing: 1, children: [
42
- /* @__PURE__ */ n(l, { children: [
43
- /* @__PURE__ */ n(l, { direction: "row", spacing: 1, children: [
44
- /* @__PURE__ */ i(s, { variant: "body1", fontWeight: "bold", children: "Clue" }),
45
- o.classification && /* @__PURE__ */ i(Y, { size: "small", classification: o.classification })
44
+ }, [enrichRequest, enrich]);
45
+ useEffect(() => {
46
+ if (!setReady) {
47
+ return;
48
+ }
49
+ setReady(enrichRequest && !isNull(annotations));
50
+ updatePosition == null ? void 0 : updatePosition();
51
+ }, [annotations, enrichRequest, setReady, updatePosition]);
52
+ return enrichRequest && !isNull(annotations) && /* @__PURE__ */ jsxs(Stack, { direction: "column", sx: { p: 1, width: "100%" }, spacing: 1, children: [
53
+ /* @__PURE__ */ jsxs(Stack, { spacing: 1, children: [
54
+ /* @__PURE__ */ jsxs(Stack, { direction: "row", spacing: 1, children: [
55
+ /* @__PURE__ */ jsxs(Stack, { children: [
56
+ /* @__PURE__ */ jsxs(Stack, { direction: "row", spacing: 1, children: [
57
+ /* @__PURE__ */ jsx(Typography, { variant: "body1", fontWeight: "bold", children: "Clue" }),
58
+ enrichRequest.classification && /* @__PURE__ */ jsx(ClassificationChip, { size: "small", classification: enrichRequest.classification })
46
59
  ] }),
47
- /* @__PURE__ */ n(s, { variant: "caption", color: "text.secondary", children: [
48
- o.type.toLocaleUpperCase(),
60
+ /* @__PURE__ */ jsxs(Typography, { variant: "caption", color: "text.secondary", children: [
61
+ enrichRequest.type.toLocaleUpperCase(),
49
62
  " ",
50
- c("enrichment")
63
+ t("enrichment")
51
64
  ] })
52
65
  ] }),
53
- /* @__PURE__ */ i("div", { style: { flex: 1 } }),
54
- /* @__PURE__ */ i(x, { title: c("refresh"), children: /* @__PURE__ */ i(z, { sx: { alignSelf: "center", m: -1 }, children: /* @__PURE__ */ i(A, { onClick: () => h(), disabled: C, children: C ? /* @__PURE__ */ i(N, { variant: "indeterminate", size: 20 }) : /* @__PURE__ */ i(g, { icon: "ic:baseline-replay", fontSize: "small" }) }) }) }),
55
- /* @__PURE__ */ i(x, { title: c("clipboard"), children: /* @__PURE__ */ i(
56
- A,
66
+ /* @__PURE__ */ jsx("div", { style: { flex: 1 } }),
67
+ /* @__PURE__ */ jsx(Tooltip, { title: t("refresh"), children: /* @__PURE__ */ jsx(Box, { sx: { alignSelf: "center", m: -1 }, children: /* @__PURE__ */ jsx(IconButton, { onClick: () => forceEnrich(), disabled: loading, children: loading ? /* @__PURE__ */ jsx(CircularProgress, { variant: "indeterminate", size: 20 }) : /* @__PURE__ */ jsx(Iconified, { icon: "ic:baseline-replay", fontSize: "small" }) }) }) }),
68
+ /* @__PURE__ */ jsx(Tooltip, { title: t("clipboard"), children: /* @__PURE__ */ jsx(
69
+ IconButton,
57
70
  {
58
71
  sx: { alignSelf: "center", m: -1 },
59
72
  onClick: () => {
60
- navigator.clipboard.writeText(o.value), U(
61
- new CustomEvent(O, {
73
+ navigator.clipboard.writeText(enrichRequest.value);
74
+ safeDispatchEvent(
75
+ new CustomEvent(SNACKBAR_EVENT_ID, {
62
76
  detail: {
63
- message: `${o.value} ${c("clipboard.success")}`,
77
+ message: `${enrichRequest.value} ${t("clipboard.success")}`,
64
78
  level: "success"
65
79
  }
66
80
  })
67
81
  );
68
82
  },
69
- children: /* @__PURE__ */ i(g, { icon: "ic:outline-assignment", fontSize: "small" })
83
+ children: /* @__PURE__ */ jsx(Iconified, { icon: "ic:outline-assignment", fontSize: "small" })
70
84
  }
71
85
  ) }),
72
- /* @__PURE__ */ i(Z, { selector: o }),
73
- /* @__PURE__ */ i(Q, { selectors: [o] })
86
+ /* @__PURE__ */ jsx(EnrichPopover, { selector: enrichRequest }),
87
+ /* @__PURE__ */ jsx(ExecutePopover, { selectors: [enrichRequest] })
74
88
  ] }),
75
- /* @__PURE__ */ n(l, { direction: "row", spacing: 0.5, children: [
76
- B.map((a, e) => /* @__PURE__ */ i(
77
- S,
89
+ /* @__PURE__ */ jsxs(Stack, { direction: "row", spacing: 0.5, children: [
90
+ options.map((opt, id) => /* @__PURE__ */ jsx(
91
+ Chip,
78
92
  {
79
93
  size: "small",
80
- variant: a === r ? "filled" : "outlined",
81
- icon: T[a] && /* @__PURE__ */ i(E, { icon: T[a] }),
82
- label: /* @__PURE__ */ n(s, { variant: "caption", textTransform: "capitalize", children: [
83
- a,
94
+ variant: opt === filter ? "filled" : "outlined",
95
+ icon: ICON_MAP[opt] && /* @__PURE__ */ jsx(Icon, { icon: ICON_MAP[opt] }),
96
+ label: /* @__PURE__ */ jsxs(Typography, { variant: "caption", textTransform: "capitalize", children: [
97
+ opt,
84
98
  ":",
85
99
  " ",
86
- a === "all" ? t.length : t.filter((f) => f.type === a).length
100
+ opt === "all" ? annotations.length : annotations.filter((annotation) => annotation.type === opt).length
87
101
  ] }),
88
- onClick: () => I(a)
102
+ onClick: () => setFilter(opt)
89
103
  },
90
- e
104
+ id
91
105
  )),
92
- (m == null ? void 0 : m.length) > 0 && /* @__PURE__ */ i(
93
- x,
106
+ (errors == null ? void 0 : errors.length) > 0 && /* @__PURE__ */ jsx(
107
+ Tooltip,
94
108
  {
95
- title: /* @__PURE__ */ i("div", { onClick: (a) => a.stopPropagation(), children: m.map((a, e) => /* @__PURE__ */ n("div", { children: [
96
- /* @__PURE__ */ i("span", { style: { textTransform: "capitalize" }, children: a.source.replace(/-/g, " ") }),
109
+ title: /* @__PURE__ */ jsx("div", { onClick: (e) => e.stopPropagation(), children: errors.map((err, err_id) => /* @__PURE__ */ jsxs("div", { children: [
110
+ /* @__PURE__ */ jsx("span", { style: { textTransform: "capitalize" }, children: err.source.replace(/-/g, " ") }),
97
111
  ":",
98
112
  " ",
99
- a.message
100
- ] }, e)) }),
101
- children: /* @__PURE__ */ i(
102
- S,
113
+ err.message
114
+ ] }, err_id)) }),
115
+ children: /* @__PURE__ */ jsx(
116
+ Chip,
103
117
  {
104
118
  size: "small",
105
119
  variant: "outlined",
106
- icon: /* @__PURE__ */ i(E, { icon: "material-symbols:timer-outline", color: v.palette.error.main }),
107
- label: /* @__PURE__ */ n(s, { variant: "caption", textTransform: "capitalize", children: [
108
- c("annotation.failed"),
120
+ icon: /* @__PURE__ */ jsx(Icon, { icon: "material-symbols:timer-outline", color: theme.palette.error.main }),
121
+ label: /* @__PURE__ */ jsxs(Typography, { variant: "caption", textTransform: "capitalize", children: [
122
+ t("annotation.failed"),
109
123
  ": ",
110
- m.length
124
+ errors.length
111
125
  ] }),
112
- onClick: h
126
+ onClick: forceEnrich
113
127
  }
114
128
  )
115
129
  }
116
130
  )
117
131
  ] })
118
132
  ] }),
119
- /* @__PURE__ */ i(z, {}),
120
- Object.keys(b).filter((a) => !r || r === "all" || a === r).map((a, e) => /* @__PURE__ */ n(
121
- $,
133
+ /* @__PURE__ */ jsx(Box, {}),
134
+ Object.keys(annotationsByType).filter((type) => !filter || filter === "all" || type === filter).map((type, id) => /* @__PURE__ */ jsxs(
135
+ Accordion,
122
136
  {
123
- defaultExpanded: !0,
137
+ defaultExpanded: true,
124
138
  sx: {
125
- marginTop: `${v.spacing(1)} !important`,
139
+ marginTop: `${theme.spacing(1)} !important`,
126
140
  marginBottom: "0 !important",
127
141
  "&:before": { height: 0 }
128
142
  },
129
143
  children: [
130
- r === "all" && /* @__PURE__ */ i(
131
- j,
144
+ filter === "all" && /* @__PURE__ */ jsx(
145
+ AccordionSummary,
132
146
  {
133
- expandIcon: /* @__PURE__ */ i(g, { icon: "ic:baseline-arrow-drop-down" }),
147
+ expandIcon: /* @__PURE__ */ jsx(Iconified, { icon: "ic:baseline-arrow-drop-down" }),
134
148
  sx: {
135
149
  minHeight: "initial !important",
136
150
  mt: 0.5,
@@ -139,19 +153,20 @@ const ii = ({ enrichRequest: o, setReady: d, updatePosition: p }) => {
139
153
  "& .MuiAccordionSummary-content": { my: 0.5, mx: 0 },
140
154
  "& .MuiAccordionSummary-content.Mui-expanded": { my: 0.5, mx: 0 }
141
155
  },
142
- children: /* @__PURE__ */ i(s, { variant: "body1", textTransform: "capitalize", children: a }, a)
156
+ children: /* @__PURE__ */ jsx(Typography, { variant: "body1", textTransform: "capitalize", children: type }, type)
143
157
  }
144
158
  ),
145
- /* @__PURE__ */ n(_, { sx: { px: 1 }, children: [
146
- r === "all" && /* @__PURE__ */ i(u, { orientation: "horizontal", sx: { mb: 1 } }),
147
- /* @__PURE__ */ i(l, { spacing: 1, divider: /* @__PURE__ */ i(u, { orientation: "horizontal", flexItem: !0 }), children: b[a].map((f, D) => /* @__PURE__ */ i(X, { annotation: f }, D)) })
159
+ /* @__PURE__ */ jsxs(AccordionDetails, { sx: { px: 1 }, children: [
160
+ filter === "all" && /* @__PURE__ */ jsx(Divider, { orientation: "horizontal", sx: { mb: 1 } }),
161
+ /* @__PURE__ */ jsx(Stack, { spacing: 1, divider: /* @__PURE__ */ jsx(Divider, { orientation: "horizontal", flexItem: true }), children: annotationsByType[type].map((annotation, ann_id) => /* @__PURE__ */ jsx(AnnotationEntry, { annotation }, ann_id)) })
148
162
  ] })
149
163
  ]
150
164
  },
151
- e
165
+ id
152
166
  ))
153
167
  ] });
154
- }, Ei = V(ii);
168
+ };
169
+ const AnnotationDetails$1 = memo(AnnotationDetails);
155
170
  export {
156
- Ei as default
171
+ AnnotationDetails$1 as default
157
172
  };
@@ -1,56 +1,59 @@
1
- import { jsxs as i, jsx as e, Fragment as t } from "react/jsx-runtime";
2
- import { I as o } from "../iconify-BBckr5AQ.js";
3
- import { Stack as l, Typography as c, Chip as s, IconButton as n } from "@mui/material";
4
- import a from "./display/icons/Iconified.js";
5
- import { t as m } from "../utils-C_RX5uMP.js";
6
- import { memo as p } from "react";
7
- import d from "./AnnotationBody.js";
8
- import f from "./ClassificationChip.js";
9
- const y = ({ annotation: r }) => /* @__PURE__ */ i(l, { direction: "column", spacing: 1, children: [
10
- /* @__PURE__ */ i(l, { direction: "row", spacing: 1, alignItems: "center", children: [
11
- r.analytic_icon && /* @__PURE__ */ e(
12
- o,
13
- {
14
- style: { alignSelf: "center", filter: "drop-shadow(0px 0px 1px rgb(0 0 0 / 0.4))" },
15
- icon: r.analytic_icon
16
- }
17
- ),
18
- /* @__PURE__ */ e(c, { variant: "body1", sx: { textTransform: "capitalize", maxWidth: "275px" }, children: r.analytic ?? r.author }),
19
- r.quantity > 1 && /* @__PURE__ */ i(c, { variant: "caption", color: "text.secondary", children: [
20
- "(x",
21
- r.quantity,
22
- ")"
1
+ import { jsxs, jsx, Fragment } from "react/jsx-runtime";
2
+ import { I as Icon } from "../iconify-CXMreGTg.js";
3
+ import { Stack, Typography, Chip, IconButton } from "@mui/material";
4
+ import Iconified from "./display/icons/Iconified.js";
5
+ import { t as twitterShort } from "../utils-CxIhC2xH.js";
6
+ import { memo } from "react";
7
+ import AnnotationBody from "./AnnotationBody.js";
8
+ import ClassificationChip from "./ClassificationChip.js";
9
+ const AnnotatonEntry = ({ annotation }) => {
10
+ return /* @__PURE__ */ jsxs(Stack, { direction: "column", spacing: 1, children: [
11
+ /* @__PURE__ */ jsxs(Stack, { direction: "row", spacing: 1, alignItems: "center", children: [
12
+ annotation.analytic_icon && /* @__PURE__ */ jsx(
13
+ Icon,
14
+ {
15
+ style: { alignSelf: "center", filter: "drop-shadow(0px 0px 1px rgb(0 0 0 / 0.4))" },
16
+ icon: annotation.analytic_icon
17
+ }
18
+ ),
19
+ /* @__PURE__ */ jsx(Typography, { variant: "body1", sx: { textTransform: "capitalize", maxWidth: "275px" }, children: annotation.analytic ?? annotation.author }),
20
+ annotation.quantity > 1 && /* @__PURE__ */ jsxs(Typography, { variant: "caption", color: "text.secondary", children: [
21
+ "(x",
22
+ annotation.quantity,
23
+ ")"
24
+ ] }),
25
+ /* @__PURE__ */ jsx("div", { style: { flex: 1 } }),
26
+ annotation.version && /* @__PURE__ */ jsx(Chip, { size: "small", label: /* @__PURE__ */ jsxs(Fragment, { children: [
27
+ "v",
28
+ annotation.version.replace(/^v/, "")
29
+ ] }) }),
30
+ annotation.link && /* @__PURE__ */ jsx(
31
+ IconButton,
32
+ {
33
+ component: "a",
34
+ href: annotation.link,
35
+ onClick: () => window.open(annotation.link, "_blank", "noreferrer"),
36
+ target: "_blank",
37
+ rel: "noreferrer",
38
+ size: "small",
39
+ children: /* @__PURE__ */ jsx(Iconified, { icon: "ic:baseline-open-in-new", fontSize: "small" })
40
+ }
41
+ ),
42
+ annotation.classification && /* @__PURE__ */ jsx(ClassificationChip, { size: "small", classification: annotation.classification })
23
43
  ] }),
24
- /* @__PURE__ */ e("div", { style: { flex: 1 } }),
25
- r.version && /* @__PURE__ */ e(s, { size: "small", label: /* @__PURE__ */ i(t, { children: [
26
- "v",
27
- r.version.replace(/^v/, "")
28
- ] }) }),
29
- r.link && /* @__PURE__ */ e(
30
- n,
31
- {
32
- component: "a",
33
- href: r.link,
34
- onClick: () => window.open(r.link, "_blank", "noreferrer"),
35
- target: "_blank",
36
- rel: "noreferrer",
37
- size: "small",
38
- children: /* @__PURE__ */ e(a, { icon: "ic:baseline-open-in-new", fontSize: "small" })
39
- }
40
- ),
41
- r.classification && /* @__PURE__ */ e(f, { size: "small", classification: r.classification })
42
- ] }),
43
- /* @__PURE__ */ e(d, { annotation: r }),
44
- /* @__PURE__ */ e(c, { variant: "caption", color: "text.secondary", children: r.summary }),
45
- /* @__PURE__ */ i(l, { direction: "row", children: [
46
- /* @__PURE__ */ e(c, { variant: "caption", color: "text.secondary", fontSize: "10px", children: m(r.timestamp) }),
47
- /* @__PURE__ */ e("div", { style: { flex: 1 } }),
48
- !!r.latency && /* @__PURE__ */ i(c, { variant: "caption", color: "text.secondary", fontSize: "10px", children: [
49
- Math.round(r.latency),
50
- "ms"
44
+ /* @__PURE__ */ jsx(AnnotationBody, { annotation }),
45
+ /* @__PURE__ */ jsx(Typography, { variant: "caption", color: "text.secondary", children: annotation.summary }),
46
+ /* @__PURE__ */ jsxs(Stack, { direction: "row", children: [
47
+ /* @__PURE__ */ jsx(Typography, { variant: "caption", color: "text.secondary", fontSize: "10px", children: twitterShort(annotation.timestamp) }),
48
+ /* @__PURE__ */ jsx("div", { style: { flex: 1 } }),
49
+ !!annotation.latency && /* @__PURE__ */ jsxs(Typography, { variant: "caption", color: "text.secondary", fontSize: "10px", children: [
50
+ Math.round(annotation.latency),
51
+ "ms"
52
+ ] })
51
53
  ] })
52
- ] })
53
- ] }), b = p(y);
54
+ ] });
55
+ };
56
+ const AnnotationEntry = memo(AnnotatonEntry);
54
57
  export {
55
- b as default
58
+ AnnotationEntry as default
56
59
  };
@@ -1,11 +1,11 @@
1
1
  import "react/jsx-runtime";
2
- import "../iconify-BBckr5AQ.js";
2
+ import "../iconify-CXMreGTg.js";
3
3
  import "@mui/material";
4
- import { A as d } from "../AnnotationPreview-DWRDhxUB.js";
4
+ import { A } from "../AnnotationPreview-BvNpZOP0.js";
5
5
  import "../hooks/useAnnotations.js";
6
- import "../utils-C_RX5uMP.js";
6
+ import "../utils-CxIhC2xH.js";
7
7
  import "react";
8
- import "../index-E7g8cRyW.js";
8
+ import "../index-BDVjGvMI.js";
9
9
  export {
10
- d as default
10
+ A as default
11
11
  };
@@ -1,31 +1,52 @@
1
- import { jsx as u } from "react/jsx-runtime";
2
- import { Tooltip as p, Chip as x } from "@mui/material";
3
- import D from "../hooks/useClueConfig.js";
4
- import { getParts as C, normalizedClassification as _ } from "../utils/classificationParser.js";
5
- import v, { useMemo as s, memo as y } from "react";
6
- const g = ["default", "primary", "secondary", "error", "info", "success", "warning"], A = v.memo(
7
- ({ classification: r, ...n }) => {
8
- var i, f;
9
- const { config: e } = D(), t = s(() => e.c12nDef ? C(r, e.c12nDef, "short", !0) : null, [r, e.c12nDef]), d = s(() => !e.c12nDef || !t ? r : _(t, e.c12nDef, "short", !0), [r, e.c12nDef, t]), o = s(() => {
10
- var c, a, m;
11
- const l = (m = (a = e.c12nDef) == null ? void 0 : a.levels_styles_map[(c = e.c12nDef) == null ? void 0 : c.levels_map[t.lvlIdx]]) == null ? void 0 : m.color;
12
- return g.includes(l) ? { color: l } : l ? { sx: { color: l } } : { color: "default" };
13
- }, [(i = e.c12nDef) == null ? void 0 : i.levels_map, (f = e.c12nDef) == null ? void 0 : f.levels_styles_map, t.lvlIdx]);
14
- return /* @__PURE__ */ u(p, { title: r, children: /* @__PURE__ */ u(
15
- x,
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { Tooltip, Chip } from "@mui/material";
3
+ import useClueConfig from "../hooks/useClueConfig.js";
4
+ import { getParts, normalizedClassification } from "../utils/classificationParser.js";
5
+ import React__default, { useMemo, memo } from "react";
6
+ const THEME_TYPES = ["default", "primary", "secondary", "error", "info", "success", "warning"];
7
+ const ClassificationChip = React__default.memo(
8
+ ({ classification, ...otherProps }) => {
9
+ var _a, _b;
10
+ const { config } = useClueConfig();
11
+ const parts = useMemo(() => {
12
+ if (!config.c12nDef) {
13
+ return null;
14
+ }
15
+ return getParts(classification, config.c12nDef, "short", true);
16
+ }, [classification, config.c12nDef]);
17
+ const normalized = useMemo(() => {
18
+ if (!config.c12nDef || !parts) {
19
+ return classification;
20
+ }
21
+ return normalizedClassification(parts, config.c12nDef, "short", true);
22
+ }, [classification, config.c12nDef, parts]);
23
+ const chipProps = useMemo(() => {
24
+ var _a2, _b2, _c;
25
+ const definedColor = (_c = (_b2 = config.c12nDef) == null ? void 0 : _b2.levels_styles_map[(_a2 = config.c12nDef) == null ? void 0 : _a2.levels_map[parts.lvlIdx]]) == null ? void 0 : _c.color;
26
+ if (THEME_TYPES.includes(definedColor)) {
27
+ return { color: definedColor };
28
+ }
29
+ if (definedColor) {
30
+ return { sx: { color: definedColor } };
31
+ }
32
+ return { color: "default" };
33
+ }, [(_a = config.c12nDef) == null ? void 0 : _a.levels_map, (_b = config.c12nDef) == null ? void 0 : _b.levels_styles_map, parts.lvlIdx]);
34
+ return /* @__PURE__ */ jsx(Tooltip, { title: classification, children: /* @__PURE__ */ jsx(
35
+ Chip,
16
36
  {
17
- variant: n.variant || "outlined",
18
- label: d,
19
- ...o,
20
- ...n,
37
+ variant: otherProps.variant || "outlined",
38
+ label: normalized,
39
+ ...chipProps,
40
+ ...otherProps,
21
41
  sx: [
22
- ...Array.isArray(o.sx) ? o.sx : [o.sx],
23
- ...Array.isArray(n.sx) ? n.sx : [n.sx]
42
+ ...Array.isArray(chipProps.sx) ? chipProps.sx : [chipProps.sx],
43
+ ...Array.isArray(otherProps.sx) ? otherProps.sx : [otherProps.sx]
24
44
  ]
25
45
  }
26
46
  ) });
27
47
  }
28
- ), M = y(A);
48
+ );
49
+ const ClassificationChip$1 = memo(ClassificationChip);
29
50
  export {
30
- M as default
51
+ ClassificationChip$1 as default
31
52
  };
@@ -1,29 +1,34 @@
1
- import { jsx as m } from "react/jsx-runtime";
2
- import { Badge as l } from "@mui/material";
3
- import { forwardRef as d, cloneElement as f, Children as g } from "react";
4
- const b = d(({ children: r, color: a = "primary", count: t, disabled: n, ...e }, o) => n ? f(g.only(r), { ref: o, ...e }) : /* @__PURE__ */ m(
5
- l,
6
- {
7
- ref: o,
8
- ...e,
9
- badgeContent: t < 100 ? t : "99+",
10
- color: a,
11
- sx: (i) => ({
12
- "& .MuiBadge-badge": {
13
- backgroundColor: "transparent",
14
- color: i.palette[a].main,
15
- fontWeight: "bold",
16
- right: 0,
17
- top: 0,
18
- transform: `translateY(-25%) translateX(${Math.min(Math.ceil(Math.log10(t)), 3) * 10}%)`,
19
- px: 0,
20
- fontSize: ".85rem"
21
- },
22
- pr: 1.5
23
- }),
24
- children: r
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { Badge } from "@mui/material";
3
+ import { forwardRef, cloneElement, Children } from "react";
4
+ const CountBadge = forwardRef(({ children, color = "primary", count, disabled, ...props }, ref) => {
5
+ if (disabled) {
6
+ return cloneElement(Children.only(children), { ref, ...props });
25
7
  }
26
- ));
8
+ return /* @__PURE__ */ jsx(
9
+ Badge,
10
+ {
11
+ ref,
12
+ ...props,
13
+ badgeContent: count < 100 ? count : "99+",
14
+ color,
15
+ sx: (theme) => ({
16
+ "& .MuiBadge-badge": {
17
+ backgroundColor: "transparent",
18
+ color: theme.palette[color].main,
19
+ fontWeight: "bold",
20
+ right: 0,
21
+ top: 0,
22
+ transform: `translateY(-25%) translateX(${Math.min(Math.ceil(Math.log10(count)), 3) * 10}%)`,
23
+ px: 0,
24
+ fontSize: ".85rem"
25
+ },
26
+ pr: 1.5
27
+ }),
28
+ children
29
+ }
30
+ );
31
+ });
27
32
  export {
28
- b as default
33
+ CountBadge as default
29
34
  };