@cccsaurora/clue-ui 1.3.0-dev.404 → 1.3.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 (224) hide show
  1. package/ActionForm-CHOSKfvu.js +4403 -0
  2. package/AnnotationDetails-Bqq6Ymmg.js +160 -0
  3. package/AnnotationPreview-CqXmC-j8.js +140 -0
  4. package/ClueEnrichContext-DL6aGe1k.js +432 -0
  5. package/FlexOne-BXWFOd1T.js +6 -0
  6. package/_MapCache-DRK-s2eK.js +179 -0
  7. package/_Set-DrS_bbSV.js +6 -0
  8. package/_Uint8Array-D9R2N9Lp.js +98 -0
  9. package/_arrayIncludes-Dcl_29E6.js +25 -0
  10. package/_arrayPush-DBJIuK2V.js +8 -0
  11. package/_baseAssignValue-Bx1cxHj5.js +12 -0
  12. package/_baseClone-DRhywkxm.js +211 -0
  13. package/_baseExtremum-DodEaEyF.js +16 -0
  14. package/_baseFlatten-CD9NgrYE.js +72 -0
  15. package/_baseGet-bVwDaGrA.js +80 -0
  16. package/_baseGetTag-CxDaTem-.js +25 -0
  17. package/_baseIsEqual-C-FKsm1J.js +150 -0
  18. package/_baseIteratee-D0FhC5bC.js +95 -0
  19. package/_baseRest-D_eW2E0d.js +8 -0
  20. package/_baseSlice-M5RKzt1A.js +10 -0
  21. package/_baseSum-wEbgNeUs.js +10 -0
  22. package/_baseUniq-D3N8igOm.js +41 -0
  23. package/_cacheHas-Wgl-hw34.js +22 -0
  24. package/_commonjsHelpers-C6fGbg64.js +6 -0
  25. package/_createAggregator-BVj8IAuF.js +53 -0
  26. package/_defineProperty-BZU4WKA3.js +11 -0
  27. package/_getPrototype-BGBCg-aX.js +5 -0
  28. package/_getTag-B7R9qBo7.js +73 -0
  29. package/_isIterateeCall-Dm0VTAYy.js +13 -0
  30. package/_setToArray-Ck4YZu0Z.js +9 -0
  31. package/cloneDeep-fV59zwUf.js +8 -0
  32. package/components/AnnotationBody.js +35 -49
  33. package/components/AnnotationDetailPopover.js +30 -36
  34. package/components/AnnotationDetails.js +7 -7
  35. package/components/AnnotationEntry.js +35 -35
  36. package/components/AnnotationPreview.js +5 -5
  37. package/components/ClassificationChip.js +23 -44
  38. package/components/CountBadge.js +26 -31
  39. package/components/EnrichedCard.js +97 -110
  40. package/components/EnrichedChip.js +105 -130
  41. package/components/EnrichedTypography.js +107 -133
  42. package/components/ErrorBoundary.js +24 -28
  43. package/components/RetryFailedEnrichments.js +9 -10
  44. package/components/SourcePicker.js +49 -57
  45. package/components/actions/ActionForm.js +4 -4
  46. package/components/actions/ExecutePopover.js +59 -75
  47. package/components/actions/ResultModal.js +4 -4
  48. package/components/actions/form/schemaAdapter.js +23 -39
  49. package/components/actions/formats/FileResult.js +59 -86
  50. package/components/actions/formats/index.js +25 -29
  51. package/components/display/graph/ExpandMoreButton.js +10 -10
  52. package/components/display/graph/elements/NodeCard.js +91 -111
  53. package/components/display/graph/elements/NodeTag.js +13 -15
  54. package/components/display/graph/index.js +202 -261
  55. package/components/display/graph/visualizations/Leaf.js +70 -89
  56. package/components/display/graph/visualizations/cloud/index.js +81 -98
  57. package/components/display/graph/visualizations/icons/BaseIcon.js +21 -26
  58. package/components/display/graph/visualizations/icons/BugIcon.js +12 -12
  59. package/components/display/graph/visualizations/icons/HostIcon.js +12 -12
  60. package/components/display/graph/visualizations/icons/NetworkIcon.js +12 -12
  61. package/components/display/graph/visualizations/icons/ProcessIcon.js +12 -12
  62. package/components/display/graph/visualizations/icons/TargetIcon.js +13 -13
  63. package/components/display/graph/visualizations/icons/index.js +13 -14
  64. package/components/display/graph/visualizations/panels/NodePanel.js +8 -10
  65. package/components/display/graph/visualizations/tree/BundleLine.js +81 -108
  66. package/components/display/graph/visualizations/tree/Triangle.js +13 -13
  67. package/components/display/graph/visualizations/tree/index.js +306 -408
  68. package/components/display/icons/Iconified.js +12 -27
  69. package/components/display/json/index.js +4 -4
  70. package/components/display/markdown/index.js +5770 -8678
  71. package/components/enrichment/EnrichPopover.js +46 -54
  72. package/components/fetchers/Fetcher.js +123 -166
  73. package/components/fetchers/FetcherResultView.js +27 -31
  74. package/components/fetchers/PreviewModal.js +16 -17
  75. package/components/fetchers/StatusChip.js +17 -21
  76. package/components/group/Entry.js +11 -13
  77. package/components/group/Group.js +10 -13
  78. package/components/group/GroupControl.js +65 -76
  79. package/components/stats/QueryStatus.js +32 -45
  80. package/countBy-B3rNuG4T.js +8 -0
  81. package/data/event.js +4 -6
  82. package/database/globals.js +2 -2
  83. package/database/index.js +3 -3
  84. package/database/replication.js +4 -4
  85. package/get-Bil3mzRD.js +8 -0
  86. package/groupBy-CrJC7sGa.js +8 -0
  87. package/hooks/ClueActionContext.js +6 -6
  88. package/hooks/ClueComponentContext.js +23 -29
  89. package/hooks/ClueConfigProvider.js +12 -14
  90. package/hooks/ClueDatabaseContext.js +23 -35
  91. package/hooks/ClueEnrichContext.js +11 -11
  92. package/hooks/ClueFetcherContext.js +56 -83
  93. package/hooks/ClueGroupContext.js +14 -17
  94. package/hooks/CluePopupContext.js +5 -5
  95. package/hooks/ClueProvider.js +11 -13
  96. package/hooks/ClueUIPluginContext.js +35 -49
  97. package/hooks/selectors.js +7 -7
  98. package/hooks/useActionResult.js +3 -3
  99. package/hooks/useAnnotations.js +32 -48
  100. package/hooks/useClue.js +4 -6
  101. package/hooks/useClueActions.js +3 -3
  102. package/hooks/useClueConfig.js +4 -6
  103. package/hooks/useClueTypeConfig.js +24 -49
  104. package/hooks/useClueUIPlugins.js +7 -8
  105. package/hooks/useComparator.js +435 -722
  106. package/hooks/useErrors.js +18 -22
  107. package/hooks/useFetcherResult.js +24 -33
  108. package/hooks/useMyHighlights.js +36 -66
  109. package/hooks/useMyLocalStorage.js +37 -66
  110. package/iconify-Ptb5dTKy.js +1270 -0
  111. package/icons/Action.js +49 -66
  112. package/icons/Assessment.js +69 -85
  113. package/icons/Context.js +63 -77
  114. package/icons/Opinion.js +60 -76
  115. package/icons/iconMap.js +2 -2
  116. package/identity-ByMq8VxU.js +6 -0
  117. package/index-BH-gBhtO.js +2282 -0
  118. package/index-BM9Sve5T.js +571 -0
  119. package/index-Cj4d5cGz.js +357 -0
  120. package/index-Dh2PP9h8.js +11747 -0
  121. package/index-DoFpWPHo.js +975 -0
  122. package/index-DzVIklWY.js +6464 -0
  123. package/isArguments-BWcXOE6a.js +24 -0
  124. package/isArray-WzO_os3q.js +4 -0
  125. package/isEmpty-DKxrY-_M.js +22 -0
  126. package/isNil-CjWwlQS3.js +6 -0
  127. package/isObject-B53jY8Qg.js +7 -0
  128. package/isObjectLike-CYbdrIBr.js +6 -0
  129. package/isSymbol-DE1Kcy2M.js +9 -0
  130. package/last-7CdUxN0r.js +7 -0
  131. package/main.js +62 -62
  132. package/maxBy-BOWDkL_D.js +8 -0
  133. package/package.json +1 -1
  134. package/plugins/ClueUIPlugin.js +96 -163
  135. package/plugins/file/index.js +15 -15
  136. package/plugins/graph/index.js +26 -29
  137. package/plugins/image/index.js +24 -28
  138. package/plugins/json/index.js +21 -21
  139. package/plugins/markdown/index.js +18 -18
  140. package/plugins/registry.js +6 -6
  141. package/plugins/store.js +4 -4
  142. package/plugins/test/index.js +17 -17
  143. package/plugins/utils.js +12 -13
  144. package/replication-WkKbPdwG.js +8453 -0
  145. package/sessionStorage-DFMae61b.js +90 -0
  146. package/sortBy-BHe812lF.js +74 -0
  147. package/store-DClHBq7r.js +1169 -0
  148. package/sumBy-B7f_bP_k.js +8 -0
  149. package/text/Frequency.js +23 -42
  150. package/toFinite-CBrE65MP.js +14 -0
  151. package/toNumber-CxmWey0f.js +31 -0
  152. package/uniq-B4UZ671_.js +7 -0
  153. package/utils/chain.js +65 -92
  154. package/utils/classificationParser.js +256 -519
  155. package/utils/constants.js +11 -37
  156. package/utils/graph.js +45 -72
  157. package/utils/hashUtil.js +7 -7
  158. package/utils/line.js +81 -131
  159. package/utils/loggerUtil.js +3 -5
  160. package/utils/sessionStorage.js +7 -7
  161. package/utils/time.js +427 -447
  162. package/utils/utils.js +10 -10
  163. package/utils/window.js +10 -21
  164. package/utils-SpTOhPYl.js +147 -0
  165. package/ActionForm-CqKcnDWC.js +0 -6099
  166. package/AnnotationDetails-BlPd3T8k.js +0 -176
  167. package/AnnotationPreview-Bl447SKT.js +0 -188
  168. package/ClueEnrichContext-B3YrTCaJ.js +0 -567
  169. package/FlexOne-BSYAhhtG.js +0 -9
  170. package/_MapCache-kuEY_iOH.js +0 -220
  171. package/_Set-BrSMTlHn.js +0 -6
  172. package/_Uint8Array-OPpgYQj7.js +0 -123
  173. package/_arrayIncludes-BNqL-9ZP.js +0 -31
  174. package/_arrayPush-CBkQqaE_.js +0 -10
  175. package/_baseAssignValue-CNUVPOBW.js +0 -16
  176. package/_baseClone-9FaRd1R2.js +0 -287
  177. package/_baseExtremum-wOGT4Dgw.js +0 -18
  178. package/_baseFlatten-Co6QHDlG.js +0 -92
  179. package/_baseGet-Cmp6FztG.js +0 -109
  180. package/_baseGetTag-Hj-0NTYF.js +0 -44
  181. package/_baseIsEqual-1CpU47TZ.js +0 -211
  182. package/_baseIteratee-BN7Vbe5g.js +0 -126
  183. package/_baseRest-BZ_hQ9PC.js +0 -8
  184. package/_baseSlice-GAv_YFTT.js +0 -20
  185. package/_baseSum-D0WC1dN0.js +0 -13
  186. package/_baseUniq-BnvS3JHL.js +0 -63
  187. package/_cacheHas-_aF2y2Xv.js +0 -25
  188. package/_commonjsHelpers-CUmg6egw.js +0 -6
  189. package/_createAggregator-BUZrP_is.js +0 -63
  190. package/_defineProperty-DolZLKmv.js +0 -12
  191. package/_getPrototype-Bb4gm-5m.js +0 -5
  192. package/_getTag-CML_cXiN.js +0 -105
  193. package/_isIterateeCall-B1IFEqVv.js +0 -17
  194. package/_setToArray-CqyqC8ib.js +0 -10
  195. package/cloneDeep-l3UkXG5M.js +0 -8
  196. package/countBy-Bqcp3VCs.js +0 -14
  197. package/get-CdMThM8x.js +0 -8
  198. package/groupBy-BVV07EGQ.js +0 -14
  199. package/iconify-DJxl6dC-.js +0 -1789
  200. package/identity-CPGTqrE4.js +0 -6
  201. package/index-CAvu7vwt.js +0 -1172
  202. package/index-CVUD9o3t.js +0 -15768
  203. package/index-DUEubgWN.js +0 -464
  204. package/index-Dj1N4IQP.js +0 -9314
  205. package/index-DpJxD74E.js +0 -3272
  206. package/index-_gpzM2Px.js +0 -702
  207. package/isArguments-CuYlEuhP.js +0 -27
  208. package/isArray-RJPfgWqI.js +0 -4
  209. package/isEmpty-BE656RUK.js +0 -30
  210. package/isNil-CIubwp4T.js +0 -6
  211. package/isObject-FTY-5JQX.js +0 -7
  212. package/isObjectLike-CeENW9FN.js +0 -6
  213. package/isSymbol-D_H4HPZQ.js +0 -9
  214. package/last-CUCl67Im.js +0 -7
  215. package/maxBy-BjjQmX5t.js +0 -8
  216. package/replication--gLEZw8a.js +0 -11777
  217. package/sessionStorage-B68y-wnE.js +0 -140
  218. package/sortBy-B8JVsLQY.js +0 -95
  219. package/store-B9sjQbcS.js +0 -2163
  220. package/sumBy-D-HCzM2i.js +0 -8
  221. package/toFinite-meZTg4Su.js +0 -16
  222. package/toNumber-B5JaA1vX.js +0 -39
  223. package/uniq-CahZPAwp.js +0 -7
  224. package/utils-CEySTPtg.js +0 -224
@@ -1,87 +1,79 @@
1
- import { jsxs, Fragment, jsx } from "react/jsx-runtime";
2
- import { useTheme, Tooltip, IconButton, CircularProgress, Button, Popover, Paper, Stack, Box, Typography, Divider } from "@mui/material";
3
- import { e as useClueComponentSelector, f as useClueEnrichSelector, c as capitalize } from "../../ActionForm-CqKcnDWC.js";
4
- import { useState, useRef, useCallback, useEffect } from "react";
5
- import Iconified from "../display/icons/Iconified.js";
6
- const EnrichPopover = ({ show = false, size = "small", selector }) => {
7
- const { t } = useClueComponentSelector((ctx) => ctx.i18next);
8
- const theme = useTheme();
9
- const availableSources = useClueEnrichSelector((ctx) => ctx.availableSources);
10
- const _enrich = useClueEnrichSelector((ctx) => ctx.enrich);
11
- const [showEnrichMenu, setShowEnrichMenu] = useState(show);
12
- const [loading, setLoading] = useState(false);
13
- const enrichEl = useRef(null);
14
- const enrich = useCallback(
15
- async (_source) => {
16
- setLoading(true);
1
+ import { jsxs as y, Fragment as C, jsx as e } from "react/jsx-runtime";
2
+ import { useTheme as k, Tooltip as S, IconButton as E, CircularProgress as d, Button as z, Popover as I, Paper as j, Stack as c, Box as P, Typography as B, Divider as O } from "@mui/material";
3
+ import { e as T, f as p, c as w } from "../../ActionForm-CHOSKfvu.js";
4
+ import { useState as m, useRef as M, useCallback as D, useEffect as F } from "react";
5
+ import g from "../display/icons/Iconified.js";
6
+ const H = ({ show: t = !1, size: b = "small", selector: n }) => {
7
+ const { t: s } = T((i) => i.i18next), h = k(), a = p((i) => i.availableSources), u = p((i) => i.enrich), [x, o] = m(t), [r, f] = m(!1), l = M(null), v = D(
8
+ async (i) => {
9
+ f(!0);
17
10
  try {
18
- await _enrich(selector.type, selector.value, {
19
- classification: selector.classification,
11
+ await u(n.type, n.value, {
12
+ classification: n.classification,
20
13
  timeout: 30,
21
- force: true,
22
- noCache: true,
23
- sources: [_source],
24
- append: true
14
+ force: !0,
15
+ noCache: !0,
16
+ sources: [i],
17
+ append: !0
25
18
  });
26
19
  } finally {
27
- setLoading(false);
20
+ f(!1);
28
21
  }
29
22
  },
30
- [_enrich, selector.classification, selector.type, selector.value]
23
+ [u, n.classification, n.type, n.value]
31
24
  );
32
- useEffect(() => {
33
- setShowEnrichMenu(show);
34
- }, [show]);
35
- return /* @__PURE__ */ jsxs(Fragment, { children: [
36
- size === "small" ? /* @__PURE__ */ jsx(Tooltip, { ref: enrichEl, title: t("enrich"), children: /* @__PURE__ */ jsx("span", { style: { alignSelf: "center" }, children: /* @__PURE__ */ jsx(
37
- IconButton,
25
+ return F(() => {
26
+ o(t);
27
+ }, [t]), /* @__PURE__ */ y(C, { children: [
28
+ b === "small" ? /* @__PURE__ */ e(S, { ref: l, title: s("enrich"), children: /* @__PURE__ */ e("span", { style: { alignSelf: "center" }, children: /* @__PURE__ */ e(
29
+ E,
38
30
  {
39
- onClick: () => setShowEnrichMenu(true),
40
- disabled: Object.keys(availableSources).length < 1 || loading,
31
+ onClick: () => o(!0),
32
+ disabled: Object.keys(a).length < 1 || r,
41
33
  color: "info",
42
- children: loading ? /* @__PURE__ */ jsx(CircularProgress, { color: "info", size: "24px" }) : /* @__PURE__ */ jsx(Iconified, { icon: "ic:baseline-auto-fix-high" })
34
+ children: r ? /* @__PURE__ */ e(d, { color: "info", size: "24px" }) : /* @__PURE__ */ e(g, { icon: "ic:baseline-auto-fix-high" })
43
35
  }
44
- ) }) }) : /* @__PURE__ */ jsx(
45
- Button,
36
+ ) }) }) : /* @__PURE__ */ e(
37
+ z,
46
38
  {
47
- ref: enrichEl,
39
+ ref: l,
48
40
  variant: "outlined",
49
41
  color: "info",
50
- disabled: Object.keys(availableSources).length < 1 || loading,
51
- startIcon: loading ? /* @__PURE__ */ jsx(CircularProgress, { color: "info", size: "20px" }) : /* @__PURE__ */ jsx(Iconified, { icon: "ic:baseline-auto-fix-high" }),
42
+ disabled: Object.keys(a).length < 1 || r,
43
+ startIcon: r ? /* @__PURE__ */ e(d, { color: "info", size: "20px" }) : /* @__PURE__ */ e(g, { icon: "ic:baseline-auto-fix-high" }),
52
44
  sx: { alignSelf: "stretch" },
53
- onClick: () => setShowEnrichMenu(true),
54
- children: t("enrich")
45
+ onClick: () => o(!0),
46
+ children: s("enrich")
55
47
  }
56
48
  ),
57
- /* @__PURE__ */ jsx(
58
- Popover,
49
+ /* @__PURE__ */ e(
50
+ I,
59
51
  {
60
52
  sx: { zIndex: 2e3 },
61
- open: showEnrichMenu,
62
- disablePortal: true,
63
- onClose: () => setShowEnrichMenu(false),
64
- anchorEl: enrichEl.current,
53
+ open: x,
54
+ disablePortal: !0,
55
+ onClose: () => o(!1),
56
+ anchorEl: l.current,
65
57
  anchorOrigin: { horizontal: "left", vertical: "bottom" },
66
- children: /* @__PURE__ */ jsx(Paper, { onClick: () => setShowEnrichMenu(false), children: /* @__PURE__ */ jsx(Stack, { divider: /* @__PURE__ */ jsx(Divider, { flexItem: true, orientation: "horizontal" }), children: availableSources.map((_source) => /* @__PURE__ */ jsx(
67
- Box,
58
+ children: /* @__PURE__ */ e(j, { onClick: () => o(!1), children: /* @__PURE__ */ e(c, { divider: /* @__PURE__ */ e(O, { flexItem: !0, orientation: "horizontal" }), children: a.map((i) => /* @__PURE__ */ e(
59
+ P,
68
60
  {
69
61
  sx: {
70
62
  px: 3,
71
63
  py: 1,
72
64
  cursor: "pointer",
73
- transition: theme.transitions.create("background-color"),
74
- "&:hover": { backgroundColor: theme.palette.background.default }
65
+ transition: h.transitions.create("background-color"),
66
+ "&:hover": { backgroundColor: h.palette.background.default }
75
67
  },
76
- onClick: () => enrich(_source),
77
- children: /* @__PURE__ */ jsx(Stack, { children: /* @__PURE__ */ jsx(Stack, { direction: "row", spacing: 1, alignItems: "center", children: /* @__PURE__ */ jsx(Typography, { variant: "body1", children: _source.split("-").map(capitalize).join(" ") }) }) })
68
+ onClick: () => v(i),
69
+ children: /* @__PURE__ */ e(c, { children: /* @__PURE__ */ e(c, { direction: "row", spacing: 1, alignItems: "center", children: /* @__PURE__ */ e(B, { variant: "body1", children: i.split("-").map(w).join(" ") }) }) })
78
70
  },
79
- _source
71
+ i
80
72
  )) }) })
81
73
  }
82
74
  )
83
75
  ] });
84
76
  };
85
77
  export {
86
- EnrichPopover as default
78
+ H as default
87
79
  };
@@ -1,148 +1,106 @@
1
- import { jsx, jsxs } from "react/jsx-runtime";
2
- import { I as Icon } from "../../iconify-DJxl6dC-.js";
3
- import { useTheme, Skeleton, Chip, Tooltip, Stack, Typography, LinearProgress, Paper, IconButton } from "@mui/material";
4
- import { F as FlexOne } from "../../FlexOne-BSYAhhtG.js";
5
- import Iconified from "../display/icons/Iconified.js";
6
- import { ClueComponentContext } from "../../hooks/ClueComponentContext.js";
7
- import { g as useClueFetcherSelector } from "../../ActionForm-CqKcnDWC.js";
8
- import React__default, { useState, useRef, useMemo, useEffect, memo } from "react";
9
- import { a as useContextSelector } from "../../index-_gpzM2Px.js";
10
- import { FetcherResultView } from "./FetcherResultView.js";
11
- import PreviewModal from "./PreviewModal.js";
12
- import StatusChip from "./StatusChip.js";
13
- const Fetcher = React__default.memo(
1
+ import { jsx as t, jsxs as l } from "react/jsx-runtime";
2
+ import { I as J } from "../../iconify-Ptb5dTKy.js";
3
+ import { useTheme as K, Skeleton as W, Chip as Q, Tooltip as D, Stack as s, Typography as U, LinearProgress as X, Paper as Y, IconButton as Z } from "@mui/material";
4
+ import { F as E } from "../../FlexOne-BXWFOd1T.js";
5
+ import S from "../display/icons/Iconified.js";
6
+ import { ClueComponentContext as $ } from "../../hooks/ClueComponentContext.js";
7
+ import { g as f } from "../../ActionForm-CHOSKfvu.js";
8
+ import p, { useState as b, useRef as k, useMemo as N, useEffect as O, memo as P } from "react";
9
+ import { a as ee } from "../../index-BM9Sve5T.js";
10
+ import { FetcherResultView as te } from "./FetcherResultView.js";
11
+ import ie from "./PreviewModal.js";
12
+ import ne from "./StatusChip.js";
13
+ const re = p.memo(
14
14
  ({
15
- type,
16
- value,
17
- classification,
18
- fetcherId,
15
+ type: h,
16
+ value: x,
17
+ classification: g,
18
+ fetcherId: n,
19
19
  slotProps: {
20
- paper: paperProps = {},
21
- preview: previewProps = {},
22
- stack: stackProps = {},
23
- image: imageProps = {},
24
- chip: chipProps = {},
25
- skeleton: skeletonProps = {}
20
+ paper: o = {},
21
+ preview: q = {},
22
+ stack: a = {},
23
+ image: v = {},
24
+ chip: R = {},
25
+ skeleton: r = {}
26
26
  } = {}
27
27
  }) => {
28
- var _a, _b, _c, _d;
29
- const theme = useTheme();
30
- const fetchers = useClueFetcherSelector((ctx) => ctx.fetchers);
31
- const fetchSelector = useClueFetcherSelector((ctx) => ctx.fetchSelector);
32
- const getFetcherStatus = useClueFetcherSelector((ctx) => ctx.getFetcherStatus);
33
- const fetchCompleted = useClueFetcherSelector((ctx) => ctx.fetchCompleted);
34
- const { t } = useContextSelector(ClueComponentContext, (ctx) => ctx == null ? void 0 : ctx.i18next);
35
- const [result, setResult] = useState(null);
36
- const [loading, setLoading] = useState(true);
37
- const [showPreview, setShowPreview] = useState(false);
38
- const timeoutRef = useRef(null);
39
- const taskId = useMemo(() => result == null ? void 0 : result.task_id, [result == null ? void 0 : result.task_id]);
40
- useEffect(() => {
41
- if ((result == null ? void 0 : result.outcome) !== "pending" || !taskId) return;
42
- let cancelled = false;
43
- const poll = async () => {
44
- const res = await getFetcherStatus(fetcherId, taskId);
45
- if (!res) {
46
- setResult({ outcome: "failure", done: true, error: "Missing result", link: "" });
47
- } else if (res.outcome === "success" || res.outcome === "failure") {
48
- setResult({ ...res, done: true });
49
- } else {
50
- if (cancelled) return;
51
- setResult({ ...res });
52
- timeoutRef.current = setTimeout(poll, 2e3);
28
+ var M, j, B, L;
29
+ const c = K(), w = f((i) => i.fetchers), F = f((i) => i.fetchSelector), A = f((i) => i.getFetcherStatus), G = f((i) => i.fetchCompleted), { t: u } = ee($, (i) => i == null ? void 0 : i.i18next), [e, m] = b(null), [H, _] = b(!0), [I, z] = b(!1), y = k(null), C = N(() => e == null ? void 0 : e.task_id, [e == null ? void 0 : e.task_id]);
30
+ O(() => {
31
+ if ((e == null ? void 0 : e.outcome) !== "pending" || !C) return;
32
+ let i = !1;
33
+ const V = async () => {
34
+ const d = await A(n, C);
35
+ if (!d)
36
+ m({ outcome: "failure", done: !0, error: "Missing result", link: "" });
37
+ else if (d.outcome === "success" || d.outcome === "failure")
38
+ m({ ...d, done: !0 });
39
+ else {
40
+ if (i) return;
41
+ m({ ...d }), y.current = setTimeout(V, 2e3);
53
42
  }
54
43
  };
55
- poll();
56
- return () => {
57
- cancelled = true;
58
- if (timeoutRef.current) clearTimeout(timeoutRef.current);
44
+ return V(), () => {
45
+ i = !0, y.current && clearTimeout(y.current);
59
46
  };
60
- }, [fetcherId, getFetcherStatus, result == null ? void 0 : result.outcome, taskId]);
61
- useEffect(() => {
47
+ }, [n, A, e == null ? void 0 : e.outcome, C]), O(() => {
62
48
  (async () => {
63
49
  try {
64
- setLoading(true);
65
- setResult(await fetchSelector(fetcherId, { type, value, classification }));
50
+ _(!0), m(await F(n, { type: h, value: x, classification: g }));
66
51
  } catch {
67
- setResult({ outcome: "failure", done: true, error: t("error.unexpected") });
52
+ m({ outcome: "failure", done: !0, error: u("error.unexpected") });
68
53
  } finally {
69
- setLoading(false);
54
+ _(!1);
70
55
  }
71
56
  })();
72
- }, [classification, fetchSelector, fetcherId, t, type, value]);
73
- const resultAdditionalProps = useMemo(() => {
74
- if ((result == null ? void 0 : result.outcome) === "success" && result.format === "image") {
75
- return { ...imageProps, onClick: () => setShowPreview(true) };
76
- }
77
- return { result };
78
- }, [imageProps, result]);
79
- if (fetchCompleted) {
80
- if (!fetcherId) {
81
- console.warn("Missing fetcher Id. Component will not render.");
82
- return null;
83
- } else if (!fetcherId.includes(".")) {
84
- console.warn(
57
+ }, [g, F, n, u, h, x]);
58
+ const T = N(() => (e == null ? void 0 : e.outcome) === "success" && e.format === "image" ? { ...v, onClick: () => z(!0) } : { result: e }, [v, e]);
59
+ if (G)
60
+ if (n)
61
+ if (n.includes(".")) {
62
+ if (!(n in w))
63
+ return console.warn("Fetcher ID does not correspond to a registered fetcher. Component will not render."), null;
64
+ } else return console.warn(
85
65
  "Invalid fetcher id. Must be in the format '<plugin_id>.<fetcher_id>'. Component will not render."
86
- );
87
- return null;
88
- } else if (!(fetcherId in fetchers)) {
89
- console.warn("Fetcher ID does not correspond to a registered fetcher. Component will not render.");
90
- return null;
91
- }
92
- } else {
66
+ ), null;
67
+ else return console.warn("Missing fetcher Id. Component will not render."), null;
68
+ else
93
69
  return null;
94
- }
95
- if (loading) {
96
- if (((_a = fetchers[fetcherId]) == null ? void 0 : _a.format) === "status") {
97
- return /* @__PURE__ */ jsx(
98
- Skeleton,
99
- {
100
- variant: "rounded",
101
- height: "32px",
102
- width: "150px",
103
- ...skeletonProps,
104
- sx: [
105
- { borderRadius: "16px" },
106
- ...Array.isArray(skeletonProps == null ? void 0 : skeletonProps.sx) ? skeletonProps == null ? void 0 : skeletonProps.sx : [skeletonProps == null ? void 0 : skeletonProps.sx]
107
- ]
108
- }
109
- );
110
- } else {
111
- return /* @__PURE__ */ jsx(Skeleton, { variant: "rounded", height: "325px", width: "300px", ...skeletonProps });
70
+ return H ? ((M = w[n]) == null ? void 0 : M.format) === "status" ? /* @__PURE__ */ t(
71
+ W,
72
+ {
73
+ variant: "rounded",
74
+ height: "32px",
75
+ width: "150px",
76
+ ...r,
77
+ sx: [
78
+ { borderRadius: "16px" },
79
+ ...Array.isArray(r == null ? void 0 : r.sx) ? r == null ? void 0 : r.sx : [r == null ? void 0 : r.sx]
80
+ ]
81
+ }
82
+ ) : /* @__PURE__ */ t(W, { variant: "rounded", height: "325px", width: "300px", ...r }) : e ? e.outcome === "failure" && w[n].format === "status" ? /* @__PURE__ */ t(
83
+ Q,
84
+ {
85
+ icon: /* @__PURE__ */ t(D, { title: e.error, children: /* @__PURE__ */ t(J, { icon: "mdi:information-outline", fontSize: "1.25rem" }) }),
86
+ label: u("error"),
87
+ color: "error",
88
+ ...R
112
89
  }
113
- }
114
- if (!result) return null;
115
- if (result.outcome === "failure" && fetchers[fetcherId].format === "status") {
116
- return /* @__PURE__ */ jsx(
117
- Chip,
90
+ ) : e.outcome === "pending" ? /* @__PURE__ */ l(s, { flex: 1, sx: { pt: 2, alignItems: "center" }, spacing: 1, children: [
91
+ ((j = e.data) == null ? void 0 : j.summary) && /* @__PURE__ */ t(U, { variant: "caption", children: e.data.summary }),
92
+ /* @__PURE__ */ t(
93
+ X,
118
94
  {
119
- icon: /* @__PURE__ */ jsx(Tooltip, { title: result.error, children: /* @__PURE__ */ jsx(Icon, { icon: "mdi:information-outline", fontSize: "1.25rem" }) }),
120
- label: t("error"),
121
- color: "error",
122
- ...chipProps
95
+ variant: (B = e.data) != null && B.progress ? "determinate" : "indeterminate",
96
+ value: ((L = e.data) == null ? void 0 : L.progress) * 100,
97
+ sx: { maxWidth: 500, width: "100%", borderRadius: c.shape.borderRadius }
123
98
  }
124
- );
125
- }
126
- if (result.outcome === "pending") {
127
- return /* @__PURE__ */ jsxs(Stack, { flex: 1, sx: { pt: 2, alignItems: "center" }, spacing: 1, children: [
128
- ((_b = result.data) == null ? void 0 : _b.summary) && /* @__PURE__ */ jsx(Typography, { variant: "caption", children: result.data.summary }),
129
- /* @__PURE__ */ jsx(
130
- LinearProgress,
131
- {
132
- variant: ((_c = result.data) == null ? void 0 : _c.progress) ? "determinate" : "indeterminate",
133
- value: ((_d = result.data) == null ? void 0 : _d.progress) * 100,
134
- sx: { maxWidth: 500, width: "100%", borderRadius: theme.shape.borderRadius }
135
- }
136
- )
137
- ] });
138
- }
139
- if (result.format === "status") {
140
- return /* @__PURE__ */ jsx(StatusChip, { data: result.data, ...chipProps });
141
- }
142
- return /* @__PURE__ */ jsx(
143
- Paper,
99
+ )
100
+ ] }) : e.format === "status" ? /* @__PURE__ */ t(ne, { data: e.data, ...R }) : /* @__PURE__ */ t(
101
+ Y,
144
102
  {
145
- ...paperProps,
103
+ ...o,
146
104
  sx: [
147
105
  {
148
106
  p: 1,
@@ -151,16 +109,16 @@ const Fetcher = React__default.memo(
151
109
  width: "100%",
152
110
  minWidth: "300px"
153
111
  },
154
- ...Array.isArray(paperProps == null ? void 0 : paperProps.sx) ? paperProps == null ? void 0 : paperProps.sx : [paperProps == null ? void 0 : paperProps.sx]
112
+ ...Array.isArray(o == null ? void 0 : o.sx) ? o == null ? void 0 : o.sx : [o == null ? void 0 : o.sx]
155
113
  ],
156
- children: /* @__PURE__ */ jsxs(
157
- Stack,
114
+ children: /* @__PURE__ */ l(
115
+ s,
158
116
  {
159
117
  sx: {
160
118
  "& > img": {
161
119
  borderRadius: "3px",
162
120
  cursor: "zoom-in",
163
- transition: theme.transitions.create("border-color", { duration: theme.transitions.duration.shortest }),
121
+ transition: c.transitions.create("border-color", { duration: c.transitions.duration.shortest }),
164
122
  border: "3px solid transparent",
165
123
  "&:hover": {
166
124
  borderColor: "primary.main"
@@ -168,72 +126,71 @@ const Fetcher = React__default.memo(
168
126
  }
169
127
  },
170
128
  children: [
171
- result.outcome === "failure" && /* @__PURE__ */ jsx("code", { style: { color: theme.palette.error.main }, children: /* @__PURE__ */ jsx("pre", { style: { marginTop: 0, marginBottom: 0 }, children: result.error }) }),
172
- /* @__PURE__ */ jsx(FetcherResultView, { result, fetcherId, ...resultAdditionalProps }),
173
- /* @__PURE__ */ jsx(FlexOne, {}),
174
- /* @__PURE__ */ jsxs(
175
- Stack,
129
+ e.outcome === "failure" && /* @__PURE__ */ t("code", { style: { color: c.palette.error.main }, children: /* @__PURE__ */ t("pre", { style: { marginTop: 0, marginBottom: 0 }, children: e.error }) }),
130
+ /* @__PURE__ */ t(te, { result: e, fetcherId: n, ...T }),
131
+ /* @__PURE__ */ t(E, {}),
132
+ /* @__PURE__ */ l(
133
+ s,
176
134
  {
177
135
  direction: "row",
178
136
  spacing: 1,
179
- ...stackProps,
137
+ ...a,
180
138
  sx: [
181
139
  {
182
- py: theme.spacing(0.5),
140
+ py: c.spacing(0.5),
183
141
  display: "flex",
184
142
  alignItems: "center"
185
143
  },
186
- ...Array.isArray(stackProps == null ? void 0 : stackProps.sx) ? stackProps == null ? void 0 : stackProps.sx : [stackProps == null ? void 0 : stackProps.sx]
144
+ ...Array.isArray(a == null ? void 0 : a.sx) ? a == null ? void 0 : a.sx : [a == null ? void 0 : a.sx]
187
145
  ],
188
146
  children: [
189
- /* @__PURE__ */ jsx(Iconified, { icon: "ic:baseline-landscape", color: "primary", fontSize: "small" }),
190
- /* @__PURE__ */ jsx(
191
- Tooltip,
147
+ /* @__PURE__ */ t(S, { icon: "ic:baseline-landscape", color: "primary", fontSize: "small" }),
148
+ /* @__PURE__ */ t(
149
+ D,
192
150
  {
193
- title: /* @__PURE__ */ jsxs(Stack, { spacing: 0.5, children: [
194
- /* @__PURE__ */ jsxs("span", { children: [
195
- t("type"),
151
+ title: /* @__PURE__ */ l(s, { spacing: 0.5, children: [
152
+ /* @__PURE__ */ l("span", { children: [
153
+ u("type"),
196
154
  ": ",
197
- type
155
+ h
198
156
  ] }),
199
- /* @__PURE__ */ jsxs("span", { children: [
200
- t("value"),
157
+ /* @__PURE__ */ l("span", { children: [
158
+ u("value"),
201
159
  ": ",
202
- value
160
+ x
203
161
  ] }),
204
- /* @__PURE__ */ jsxs("span", { children: [
205
- t("classification"),
162
+ /* @__PURE__ */ l("span", { children: [
163
+ u("classification"),
206
164
  ": ",
207
- classification ?? "N/A"
165
+ g ?? "N/A"
208
166
  ] })
209
167
  ] }),
210
- children: /* @__PURE__ */ jsx(Iconified, { icon: "ic:outline-info", fontSize: "small" })
168
+ children: /* @__PURE__ */ t(S, { icon: "ic:outline-info", fontSize: "small" })
211
169
  }
212
170
  ),
213
- /* @__PURE__ */ jsx(FlexOne, {}),
214
- result.link && /* @__PURE__ */ jsx(IconButton, { size: "small", component: "a", href: result.link, children: /* @__PURE__ */ jsx(Iconified, { icon: "ic:baseline-open-in-new", fontSize: "small" }) })
171
+ /* @__PURE__ */ t(E, {}),
172
+ e.link && /* @__PURE__ */ t(Z, { size: "small", component: "a", href: e.link, children: /* @__PURE__ */ t(S, { icon: "ic:baseline-open-in-new", fontSize: "small" }) })
215
173
  ]
216
174
  }
217
175
  ),
218
- /* @__PURE__ */ jsx(
219
- PreviewModal,
176
+ /* @__PURE__ */ t(
177
+ ie,
220
178
  {
221
- ...previewProps,
222
- fetcherId,
223
- slotProps: { fetcherResultView: resultAdditionalProps },
224
- open: showPreview,
225
- result,
226
- onClose: () => setShowPreview(false)
179
+ ...q,
180
+ fetcherId: n,
181
+ slotProps: { fetcherResultView: T },
182
+ open: I,
183
+ result: e,
184
+ onClose: () => z(!1)
227
185
  }
228
186
  )
229
187
  ]
230
188
  }
231
189
  )
232
190
  }
233
- );
191
+ ) : null;
234
192
  }
235
- );
236
- const Fetcher_default = memo(Fetcher);
193
+ ), we = P(re);
237
194
  export {
238
- Fetcher_default as default
195
+ we as default
239
196
  };
@@ -1,41 +1,37 @@
1
- import { jsx, jsxs } from "react/jsx-runtime";
2
- import { Stack } from "@mui/material";
3
- import { J as JSONViewer } from "../../index-DUEubgWN.js";
4
- import Markdown from "../display/markdown/index.js";
5
- import { u as usePluginStore, c as clueUIPluginStore } from "../../store-B9sjQbcS.js";
6
- import { useTranslation } from "react-i18next";
7
- import ErrorBoundary from "../ErrorBoundary.js";
8
- const FetcherResultView = ({
9
- pluginName,
10
- result,
11
- fetcherId,
12
- ...props
1
+ import { jsx as r, jsxs as i } from "react/jsx-runtime";
2
+ import { Stack as c } from "@mui/material";
3
+ import { J as m } from "../../index-Cj4d5cGz.js";
4
+ import f from "../display/markdown/index.js";
5
+ import { u as p, c as g } from "../../store-DClHBq7r.js";
6
+ import { useTranslation as h } from "react-i18next";
7
+ import u from "../ErrorBoundary.js";
8
+ const y = ({
9
+ pluginName: l,
10
+ result: o,
11
+ fetcherId: t,
12
+ ...d
13
13
  }) => {
14
- const pluginStore = usePluginStore();
15
- const { t } = useTranslation();
16
- const availablePlugin = pluginName ?? clueUIPluginStore.getPlugin(result.format ?? "undefined", "fetcher", void 0, fetcherId);
17
- if (availablePlugin) {
14
+ const s = p(), { t: e } = h(), n = l ?? g.getPlugin(o.format ?? "undefined", "fetcher", void 0, t);
15
+ if (n)
18
16
  try {
19
- const component = pluginStore.executeFunction(`${availablePlugin}.fetcherResult`, {
20
- result,
21
- fetcherId,
22
- ...props
17
+ const a = s.executeFunction(`${n}.fetcherResult`, {
18
+ result: o,
19
+ fetcherId: t,
20
+ ...d
23
21
  });
24
- if (component !== void 0) {
25
- return /* @__PURE__ */ jsx(ErrorBoundary, { children: component });
26
- }
22
+ if (a !== void 0)
23
+ return /* @__PURE__ */ r(u, { children: a });
27
24
  } catch {
28
- return /* @__PURE__ */ jsx(ErrorBoundary, { children: /* @__PURE__ */ jsxs(Stack, { sx: { overflowY: "auto" }, children: [
29
- /* @__PURE__ */ jsx(Markdown, { md: t("format.render.error", { format: result.format }) }),
30
- /* @__PURE__ */ jsx(JSONViewer, { data: result, collapse: true, forceCompact: true })
25
+ return /* @__PURE__ */ r(u, { children: /* @__PURE__ */ i(c, { sx: { overflowY: "auto" }, children: [
26
+ /* @__PURE__ */ r(f, { md: e("format.render.error", { format: o.format }) }),
27
+ /* @__PURE__ */ r(m, { data: o, collapse: !0, forceCompact: !0 })
31
28
  ] }) });
32
29
  }
33
- }
34
- return /* @__PURE__ */ jsxs(Stack, { sx: { overflowY: "auto" }, children: [
35
- /* @__PURE__ */ jsx(Markdown, { md: t("format.not.recognized", { format: result.format }) }),
36
- /* @__PURE__ */ jsx(JSONViewer, { data: result, collapse: true, forceCompact: true })
30
+ return /* @__PURE__ */ i(c, { sx: { overflowY: "auto" }, children: [
31
+ /* @__PURE__ */ r(f, { md: e("format.not.recognized", { format: o.format }) }),
32
+ /* @__PURE__ */ r(m, { data: o, collapse: !0, forceCompact: !0 })
37
33
  ] });
38
34
  };
39
35
  export {
40
- FetcherResultView
36
+ y as FetcherResultView
41
37
  };
@@ -1,25 +1,24 @@
1
- import { jsx } from "react/jsx-runtime";
2
- import { Modal, Paper } from "@mui/material";
3
- import { memo } from "react";
4
- import { FetcherResultView } from "./FetcherResultView.js";
5
- const PreviewModal = ({ result, slotProps = {}, fetcherId, onClose, open = false, ...otherProps }) => {
6
- const { fetcherResultView, ...modalSlotProps } = slotProps;
7
- return /* @__PURE__ */ jsx(
8
- Modal,
1
+ import { jsx as l } from "react/jsx-runtime";
2
+ import { Modal as c, Paper as d } from "@mui/material";
3
+ import { memo as u } from "react";
4
+ import { FetcherResultView as s } from "./FetcherResultView.js";
5
+ const w = ({ result: a, slotProps: e = {}, fetcherId: m, onClose: n, open: f = !1, ...i }) => {
6
+ const { fetcherResultView: t, ...x } = e;
7
+ return /* @__PURE__ */ l(
8
+ c,
9
9
  {
10
- open,
10
+ open: f,
11
11
  sx: [
12
12
  { display: "flex", alignItems: "center", justifyContent: "center" },
13
- ...Array.isArray(otherProps == null ? void 0 : otherProps.sx) ? otherProps == null ? void 0 : otherProps.sx : [otherProps == null ? void 0 : otherProps.sx]
13
+ ...Array.isArray(i == null ? void 0 : i.sx) ? i == null ? void 0 : i.sx : [i == null ? void 0 : i.sx]
14
14
  ],
15
- onClose,
16
- slotProps: modalSlotProps,
17
- ...otherProps,
18
- children: /* @__PURE__ */ jsx(Paper, { sx: { maxHeight: "90%", maxWidth: "90%", p: 2, overflow: "auto" }, children: /* @__PURE__ */ jsx(FetcherResultView, { ...fetcherResultView ?? {}, result, fetcherId }) })
15
+ onClose: n,
16
+ slotProps: x,
17
+ ...i,
18
+ children: /* @__PURE__ */ l(d, { sx: { maxHeight: "90%", maxWidth: "90%", p: 2, overflow: "auto" }, children: /* @__PURE__ */ l(s, { ...t ?? {}, result: a, fetcherId: m }) })
19
19
  }
20
20
  );
21
- };
22
- const PreviewModal$1 = memo(PreviewModal);
21
+ }, j = u(w);
23
22
  export {
24
- PreviewModal$1 as default
23
+ j as default
25
24
  };