@cccsaurora/clue-ui 1.0.1-dev.57 → 1.0.1
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.
- package/ActionForm-WIj7BfD5.js +340 -0
- package/AnnotationPreview-DWRDhxUB.js +140 -0
- package/ClueEnrichContext-CbJVBm4w.js +397 -0
- package/FlexOne-BXWFOd1T.js +6 -0
- package/_Map-DXNg_Z-q.js +54 -0
- package/_MapCache-Cu25RRDU.js +129 -0
- package/_Uint8Array-DlJCtTvG.js +102 -0
- package/_baseAssignValue-CUmzp727.js +20 -0
- package/_baseClone-BlMmRXeX.js +208 -0
- package/_baseExtremum-P_0akmCi.js +27 -0
- package/_baseFlatten-CN7vDNEQ.js +72 -0
- package/_baseGet-Dgf6_xCm.js +80 -0
- package/_baseIsEqual-Cpjtfb3Q.js +173 -0
- package/_baseIteratee-CP1bocOX.js +95 -0
- package/_baseSlice-M5RKzt1A.js +10 -0
- package/_baseSum-wEbgNeUs.js +10 -0
- package/_baseUniq-tMFmk80M.js +61 -0
- package/_commonjsHelpers-C6fGbg64.js +6 -0
- package/_createAggregator-B4Cav8ZM.js +53 -0
- package/_getPrototype-CHAFQYL_.js +5 -0
- package/_getTag-BV_UoLYG.js +90 -0
- package/cloneDeep-BPVpFBzJ.js +8 -0
- package/components/AnnotationBody.js +34 -49
- package/components/AnnotationDetailPopover.js +30 -36
- package/components/AnnotationDetails.js +94 -109
- package/components/AnnotationEntry.js +52 -50
- package/components/AnnotationPreview.js +5 -5
- package/components/ClassificationChip.js +23 -44
- package/components/CountBadge.js +26 -31
- package/components/EnrichedCard.js +92 -104
- package/components/EnrichedChip.js +109 -134
- package/components/EnrichedTypography.js +110 -136
- package/components/ErrorBoundary.js +24 -28
- package/components/RetryFailedEnrichments.js +9 -10
- package/components/SourcePicker.js +49 -57
- package/components/actions/ActionForm.js +4 -4
- package/components/actions/ExecutePopover.js +50 -64
- package/components/actions/ResultModal.js +34 -37
- package/components/actions/form/schemaAdapter.js +20 -39
- package/components/display/graph/ExpandMoreButton.js +10 -10
- package/components/display/graph/elements/NodeCard.js +76 -92
- package/components/display/graph/elements/NodeTag.js +13 -15
- package/components/display/graph/index.js +200 -258
- package/components/display/graph/visualizations/Leaf.js +69 -88
- package/components/display/graph/visualizations/cloud/index.js +81 -98
- package/components/display/graph/visualizations/icons/BaseIcon.js +21 -26
- package/components/display/graph/visualizations/icons/BugIcon.js +12 -12
- package/components/display/graph/visualizations/icons/HostIcon.js +12 -12
- package/components/display/graph/visualizations/icons/NetworkIcon.js +12 -12
- package/components/display/graph/visualizations/icons/ProcessIcon.js +12 -12
- package/components/display/graph/visualizations/icons/TargetIcon.js +13 -13
- package/components/display/graph/visualizations/icons/index.js +13 -14
- package/components/display/graph/visualizations/panels/NodePanel.js +8 -10
- package/components/display/graph/visualizations/tree/BundleLine.js +81 -108
- package/components/display/graph/visualizations/tree/Triangle.js +13 -13
- package/components/display/graph/visualizations/tree/index.js +305 -407
- package/components/display/icons/Iconified.js +12 -27
- package/components/display/json/index.js +4 -4
- package/components/display/markdown/DynamicTabs.js +17 -22
- package/components/display/markdown/index.js +5674 -8531
- package/components/display/markdown/markdownPlugins/tabs.js +1 -1
- package/components/enrichment/EnrichPopover.js +47 -55
- package/components/fetchers/Fetcher.js +95 -123
- package/components/fetchers/PreviewModal.js +17 -20
- package/components/fetchers/StatusChip.js +18 -22
- package/components/group/Entry.js +11 -13
- package/components/group/Group.js +10 -13
- package/components/group/GroupControl.js +65 -76
- package/components/stats/QueryStatus.js +28 -37
- package/countBy-DOutsa_w.js +8 -0
- package/data/event.js +4 -6
- package/database/index.js +2 -2
- package/debounce-DryYcbJ4.js +56 -0
- package/get-Bow1vKwx.js +8 -0
- package/groupBy-BheQYl6f.js +8 -0
- package/hooks/ClueActionContext.js +6 -6
- package/hooks/ClueComponentContext.js +23 -29
- package/hooks/ClueConfigProvider.js +12 -14
- package/hooks/ClueDatabaseContext.js +13 -19
- package/hooks/ClueEnrichContext.js +8 -8
- package/hooks/ClueFetcherContext.js +46 -74
- package/hooks/ClueGroupContext.js +14 -17
- package/hooks/CluePopupContext.js +5 -5
- package/hooks/ClueProvider.js +10 -12
- package/hooks/selectors.js +11 -22
- package/hooks/useAnnotations.js +32 -48
- package/hooks/useClue.js +4 -6
- package/hooks/useClueActions.js +3 -3
- package/hooks/useClueConfig.js +5 -5
- package/hooks/useClueTypeConfig.js +3 -3
- package/hooks/useComparator.js +435 -722
- package/hooks/useErrors.js +18 -22
- package/hooks/useMyHighlights.js +36 -66
- package/hooks/useMyLocalStorage.js +43 -63
- package/iconify-BBckr5AQ.js +1263 -0
- package/icons/Action.js +49 -66
- package/icons/Assessment.js +68 -84
- package/icons/Context.js +61 -75
- package/icons/Opinion.js +65 -77
- package/icons/iconMap.js +2 -2
- package/identity-ByMq8VxU.js +6 -0
- package/index-4YFAh_sa.js +358 -0
- package/index-E7g8cRyW.js +568 -0
- package/index-HuYhutsd.js +975 -0
- package/index-WvFmjbxF.js +12734 -0
- package/index-p5_wX7q1.js +11729 -0
- package/isEmpty-g47Qir2A.js +21 -0
- package/isNil-CjWwlQS3.js +6 -0
- package/isObject-B53jY8Qg.js +7 -0
- package/isObjectLike-BatpeCIi.js +29 -0
- package/isSymbol-C3_SC0Qp.js +8 -0
- package/isUndefined-DiNCDKoz.js +10 -0
- package/last-7CdUxN0r.js +7 -0
- package/main.js +68 -68
- package/package.json +1 -1
- package/sortBy-ITdmD17L.js +79 -0
- package/sumBy-DxJUU2E8.js +8 -0
- package/tabs-CgADNA57.js +195 -0
- package/text/Frequency.js +23 -42
- package/toFinite-BMy6GObD.js +14 -0
- package/toNumber-YVhnnJv4.js +31 -0
- package/useClueTypeConfig-BQ33EiyB.js +2273 -0
- package/utils/chain.js +64 -91
- package/utils/classificationParser.js +254 -504
- package/utils/constants.js +10 -35
- package/utils/graph.js +45 -72
- package/utils/hashUtil.js +7 -7
- package/utils/line.js +81 -131
- package/utils/loggerUtil.js +3 -5
- package/utils/sessionStorage.js +29 -41
- package/utils/utils.js +9 -9
- package/utils/window.js +10 -21
- package/utils-C_RX5uMP.js +2704 -0
- package/ActionForm-c5hLIfQ-.js +0 -436
- package/AnnotationPreview-BvNpZOP0.js +0 -188
- package/ClueEnrichContext-m-4vn9rz.js +0 -518
- package/FlexOne-BSYAhhtG.js +0 -9
- package/_Map-kgDsDYxq.js +0 -64
- package/_MapCache-DabaaWfq.js +0 -161
- package/_Uint8Array-BlVVH1tp.js +0 -129
- package/_baseAssignValue-CNbcU6Nb.js +0 -25
- package/_baseClone-D3a8Pa4T.js +0 -284
- package/_baseExtremum-B1o1zHjR.js +0 -33
- package/_baseFlatten-D4huXoEI.js +0 -92
- package/_baseGet-BSK_nnoz.js +0 -109
- package/_baseIsEqual-B5xLoweL.js +0 -238
- package/_baseIteratee-p6Nj07-n.js +0 -126
- package/_baseSlice-GAv_YFTT.js +0 -20
- package/_baseSum-D0WC1dN0.js +0 -13
- package/_baseUniq-CpupKWcL.js +0 -89
- package/_commonjsHelpers-CUmg6egw.js +0 -6
- package/_createAggregator-BpVy5xMi.js +0 -63
- package/_getPrototype-D1LAdQKO.js +0 -5
- package/_getTag-D3ToyefI.js +0 -126
- package/cloneDeep-CjP5k9zW.js +0 -8
- package/countBy-C69WslUA.js +0 -14
- package/debounce-bV0h5FC5.js +0 -92
- package/get-D3C3lEU3.js +0 -8
- package/groupBy-DC2oOuBN.js +0 -14
- package/iconify-CXMreGTg.js +0 -1782
- package/identity-CPGTqrE4.js +0 -6
- package/index-BDVjGvMI.js +0 -696
- package/index-BDrtH5ec.js +0 -465
- package/index-BbPn6-Mw.js +0 -15750
- package/index-C9lySIVX.js +0 -1172
- package/index-Dn2NHyXg.js +0 -17654
- package/isEmpty-BQkZubqU.js +0 -29
- package/isNil-CIubwp4T.js +0 -6
- package/isObject-FTY-5JQX.js +0 -7
- package/isObjectLike-OAgjjZye.js +0 -48
- package/isSymbol-Xd2FsJyp.js +0 -8
- package/isUndefined-CE8h73dH.js +0 -10
- package/last-CUCl67Im.js +0 -7
- package/sortBy-B-UKp4GT.js +0 -100
- package/sumBy-MYkDPHZL.js +0 -8
- package/tabs-xGuUGsJd.js +0 -254
- package/toFinite-Bc55msYj.js +0 -16
- package/toNumber-DPxy1FBy.js +0 -39
- package/useClueTypeConfig-D4zcy8Gr.js +0 -3184
- package/utils-CxIhC2xH.js +0 -4182
package/icons/Opinion.js
CHANGED
|
@@ -1,125 +1,113 @@
|
|
|
1
|
-
import { jsxs, jsx, Fragment } from "react/jsx-runtime";
|
|
2
|
-
import { I as
|
|
3
|
-
import { useTheme, Stack, Chip, Divider, Grid } from "@mui/material";
|
|
4
|
-
import
|
|
5
|
-
import { C as
|
|
6
|
-
import
|
|
7
|
-
import { memo, useRef, useMemo, useCallback, useEffect } from "react";
|
|
8
|
-
import { u as
|
|
9
|
-
import { g as
|
|
10
|
-
import { s as
|
|
11
|
-
import { s as
|
|
12
|
-
const
|
|
13
|
-
const
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
const sortedOpinions = useMemo(
|
|
22
|
-
() => chain(
|
|
23
|
-
Object.entries(groupBy(opinionAnnotations, "value")).map(([_value, _annotations]) => [
|
|
24
|
-
_value,
|
|
25
|
-
sumBy(_annotations, "quantity")
|
|
1
|
+
import { jsxs as d, jsx as r, Fragment as $ } from "react/jsx-runtime";
|
|
2
|
+
import { I as u } from "../iconify-BBckr5AQ.js";
|
|
3
|
+
import { useTheme as B, Stack as x, Chip as v, Divider as O, Grid as y } from "@mui/material";
|
|
4
|
+
import k from "../components/CountBadge.js";
|
|
5
|
+
import { C as b } from "../AnnotationPreview-DWRDhxUB.js";
|
|
6
|
+
import j from "../utils/chain.js";
|
|
7
|
+
import { memo as q, useRef as M, useMemo as a, useCallback as S, useEffect as R } from "react";
|
|
8
|
+
import { u as I } from "../index-E7g8cRyW.js";
|
|
9
|
+
import { g as D } from "../groupBy-BheQYl6f.js";
|
|
10
|
+
import { s as E } from "../sumBy-DxJUU2E8.js";
|
|
11
|
+
import { s as F } from "../sortBy-ITdmD17L.js";
|
|
12
|
+
const G = ({ annotations: m, value: l, counters: C = !0, disableTooltip: c = !1, ubiquitous: p = !1, ...f }) => {
|
|
13
|
+
const i = B(), w = I(b, (e) => e.showInfo), h = I(b, (e) => e.closeInfo), g = M(), s = a(
|
|
14
|
+
() => m.filter((e) => e.type === "opinion" && e.ubiquitous === p),
|
|
15
|
+
[m, p]
|
|
16
|
+
), o = a(
|
|
17
|
+
() => j(
|
|
18
|
+
Object.entries(D(s, "value")).map(([e, t]) => [
|
|
19
|
+
e,
|
|
20
|
+
E(t, "quantity")
|
|
26
21
|
])
|
|
27
|
-
).sortBy(([
|
|
28
|
-
[
|
|
29
|
-
)
|
|
30
|
-
|
|
31
|
-
(_opinion) => _opinion === "benign" ? "mdi:shield-check" : _opinion === "suspicious" ? "mdi:warning-outline" : _opinion === "obscure" ? "bi:eye-slash-fill" : "mdi:warning-decagram",
|
|
22
|
+
).sortBy(([e, t]) => t).reverse().value(),
|
|
23
|
+
[s]
|
|
24
|
+
), n = S(
|
|
25
|
+
(e) => e === "benign" ? "mdi:shield-check" : e === "suspicious" ? "mdi:warning-outline" : e === "obscure" ? "bi:eye-slash-fill" : "mdi:warning-decagram",
|
|
32
26
|
[]
|
|
33
27
|
);
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
/* @__PURE__ */ jsx(Stack, { direction: "row", children: sortedOpinions.map(([type, count]) => /* @__PURE__ */ jsx(
|
|
43
|
-
Chip,
|
|
28
|
+
R(() => {
|
|
29
|
+
c && h("opinion", l);
|
|
30
|
+
}, [c]);
|
|
31
|
+
const z = a(
|
|
32
|
+
() => /* @__PURE__ */ d(x, { spacing: 1, onClick: (e) => e.stopPropagation(), children: [
|
|
33
|
+
s.length > 1 && /* @__PURE__ */ d($, { children: [
|
|
34
|
+
/* @__PURE__ */ r(x, { direction: "row", children: o.map(([e, t]) => /* @__PURE__ */ r(
|
|
35
|
+
v,
|
|
44
36
|
{
|
|
45
37
|
size: "small",
|
|
46
38
|
variant: "outlined",
|
|
47
|
-
label: `${
|
|
48
|
-
icon: /* @__PURE__ */
|
|
39
|
+
label: `${e}: ${t}`,
|
|
40
|
+
icon: /* @__PURE__ */ r(u, { icon: n(e) }),
|
|
49
41
|
sx: { textTransform: "capitalize" },
|
|
50
42
|
color: {
|
|
51
43
|
benign: "success",
|
|
52
44
|
suspicious: "warning",
|
|
53
45
|
obscure: "error",
|
|
54
46
|
malicious: "error"
|
|
55
|
-
}[
|
|
47
|
+
}[e]
|
|
56
48
|
},
|
|
57
|
-
|
|
49
|
+
e
|
|
58
50
|
)) }),
|
|
59
|
-
/* @__PURE__ */
|
|
51
|
+
/* @__PURE__ */ r(O, { orientation: "horizontal", flexItem: !0 })
|
|
60
52
|
] }),
|
|
61
|
-
/* @__PURE__ */
|
|
62
|
-
|
|
53
|
+
/* @__PURE__ */ r(
|
|
54
|
+
y,
|
|
63
55
|
{
|
|
64
56
|
sx: {
|
|
65
|
-
mt:
|
|
66
|
-
ml: `${
|
|
57
|
+
mt: s.length < 2 && `${i.spacing(-0.5)} !important`,
|
|
58
|
+
ml: `${i.spacing(-0.5)} !important`
|
|
67
59
|
},
|
|
68
|
-
container:
|
|
60
|
+
container: !0,
|
|
69
61
|
spacing: 0.5,
|
|
70
62
|
maxWidth: "500px",
|
|
71
|
-
children:
|
|
72
|
-
|
|
63
|
+
children: F(s, "value").map((e) => /* @__PURE__ */ r(y, { item: !0, children: /* @__PURE__ */ r(
|
|
64
|
+
v,
|
|
73
65
|
{
|
|
74
66
|
size: "small",
|
|
75
67
|
variant: "outlined",
|
|
76
|
-
label: (
|
|
77
|
-
icon: /* @__PURE__ */
|
|
68
|
+
label: (e.analytic ?? e.author) + (e.quantity > 1 ? ` (x${e.quantity})` : ""),
|
|
69
|
+
icon: /* @__PURE__ */ r(u, { icon: n(e.value) }),
|
|
78
70
|
color: {
|
|
79
71
|
benign: "success",
|
|
80
72
|
suspicious: "warning",
|
|
81
73
|
obscure: "error",
|
|
82
74
|
malicious: "error"
|
|
83
|
-
}[
|
|
75
|
+
}[e.value]
|
|
84
76
|
}
|
|
85
|
-
) }, (
|
|
77
|
+
) }, (e.analytic ?? e.author) + e.value))
|
|
86
78
|
}
|
|
87
79
|
)
|
|
88
80
|
] }),
|
|
89
|
-
[
|
|
81
|
+
[n, s, o, i]
|
|
90
82
|
);
|
|
91
|
-
|
|
92
|
-
return null;
|
|
93
|
-
}
|
|
94
|
-
return /* @__PURE__ */ jsx(
|
|
83
|
+
return (s == null ? void 0 : s.length) < 1 ? null : /* @__PURE__ */ r(
|
|
95
84
|
"span",
|
|
96
85
|
{
|
|
97
|
-
ref:
|
|
86
|
+
ref: g,
|
|
98
87
|
style: { display: "flex" },
|
|
99
|
-
onMouseOver:
|
|
100
|
-
onMouseLeave:
|
|
101
|
-
children: /* @__PURE__ */
|
|
102
|
-
|
|
88
|
+
onMouseOver: c ? void 0 : () => w("assessment", g.current, l, { content: z }),
|
|
89
|
+
onMouseLeave: c ? void 0 : () => h("assessment", l),
|
|
90
|
+
children: /* @__PURE__ */ r(k, { disabled: !C, count: o[0][1], children: /* @__PURE__ */ r(
|
|
91
|
+
u,
|
|
103
92
|
{
|
|
104
93
|
fontSize: "1.25em",
|
|
105
|
-
...
|
|
106
|
-
icon:
|
|
94
|
+
...f,
|
|
95
|
+
icon: n(o[0][0]),
|
|
107
96
|
color: {
|
|
108
|
-
benign:
|
|
109
|
-
suspicious:
|
|
110
|
-
obscure:
|
|
111
|
-
malicious:
|
|
112
|
-
}[
|
|
97
|
+
benign: i.palette.success.light,
|
|
98
|
+
suspicious: i.palette.warning.light,
|
|
99
|
+
obscure: i.palette.error.light,
|
|
100
|
+
malicious: i.palette.error.light
|
|
101
|
+
}[o[0][0]],
|
|
113
102
|
style: {
|
|
114
103
|
zIndex: 2,
|
|
115
|
-
...
|
|
104
|
+
...f.style ?? {}
|
|
116
105
|
}
|
|
117
106
|
}
|
|
118
107
|
) })
|
|
119
108
|
}
|
|
120
109
|
);
|
|
121
|
-
};
|
|
122
|
-
const OpinionIcon$1 = memo(OpinionIcon);
|
|
110
|
+
}, Y = q(G);
|
|
123
111
|
export {
|
|
124
|
-
|
|
112
|
+
Y as default
|
|
125
113
|
};
|
package/icons/iconMap.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const
|
|
1
|
+
const o = {
|
|
2
2
|
context: "material-symbols:contextual-token",
|
|
3
3
|
opinion: "material-symbols:how-to-vote-rounded",
|
|
4
4
|
mitigation: "material-symbols:shield-locked-rounded",
|
|
@@ -6,5 +6,5 @@ const ICON_MAP = {
|
|
|
6
6
|
assessment: "material-symbols:menu-book"
|
|
7
7
|
};
|
|
8
8
|
export {
|
|
9
|
-
ICON_MAP
|
|
9
|
+
o as ICON_MAP
|
|
10
10
|
};
|
|
@@ -0,0 +1,358 @@
|
|
|
1
|
+
var Y = Object.defineProperty;
|
|
2
|
+
var Z = (t, e, n) => e in t ? Y(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n;
|
|
3
|
+
var y = (t, e, n) => Z(t, typeof e != "symbol" ? e + "" : e, n);
|
|
4
|
+
import { jsx as d, jsxs as M } from "react/jsx-runtime";
|
|
5
|
+
import { ClickAwayListener as $, TextField as P, InputAdornment as v, Popper as ee, Paper as te, MenuList as ne, MenuItem as se, ListItemText as re, useTheme as ie, Stack as ae, Skeleton as ue } from "@mui/material";
|
|
6
|
+
import { useRef as A, useState as T, useEffect as N, useMemo as C, lazy as oe } from "react";
|
|
7
|
+
import { r as ce, s as he, f as de } from "./utils-C_RX5uMP.js";
|
|
8
|
+
import { ClueComponentContext as D } from "./hooks/ClueComponentContext.js";
|
|
9
|
+
import { useMyLocalStorageItem as L } from "./hooks/useMyLocalStorage.js";
|
|
10
|
+
import { StorageKey as j } from "./utils/constants.js";
|
|
11
|
+
import { u as J } from "./index-E7g8cRyW.js";
|
|
12
|
+
const fe = "Enter", le = "Escape", me = "ArrowLeft", pe = "ArrowUp", _e = "ArrowRight", ye = "ArrowDown", ke = "Backspace", be = " ";
|
|
13
|
+
function b(t, e) {
|
|
14
|
+
return t === e;
|
|
15
|
+
}
|
|
16
|
+
function xe(t) {
|
|
17
|
+
return b(t, pe);
|
|
18
|
+
}
|
|
19
|
+
function ge(t) {
|
|
20
|
+
return b(t, ye);
|
|
21
|
+
}
|
|
22
|
+
function we(t) {
|
|
23
|
+
return b(t, me);
|
|
24
|
+
}
|
|
25
|
+
function Ie(t) {
|
|
26
|
+
return b(t, _e);
|
|
27
|
+
}
|
|
28
|
+
function Ae(t) {
|
|
29
|
+
return b(t, le);
|
|
30
|
+
}
|
|
31
|
+
function Re(t) {
|
|
32
|
+
return b(t, fe);
|
|
33
|
+
}
|
|
34
|
+
function Ee(t) {
|
|
35
|
+
return b(t, ke);
|
|
36
|
+
}
|
|
37
|
+
function Se(t) {
|
|
38
|
+
return b(t, be);
|
|
39
|
+
}
|
|
40
|
+
function K(t) {
|
|
41
|
+
return {
|
|
42
|
+
key: t.key,
|
|
43
|
+
isCtrl: t.ctrlKey,
|
|
44
|
+
isEnter: Re(t.key),
|
|
45
|
+
isSpace: Se(t.key),
|
|
46
|
+
isBackspace: Ee(t.key),
|
|
47
|
+
isEscape: Ae(t.key),
|
|
48
|
+
isArrowLeft: we(t.key),
|
|
49
|
+
isArrowRight: Ie(t.key),
|
|
50
|
+
isArrowUp: xe(t.key),
|
|
51
|
+
isArrowDown: ge(t.key)
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
class Ce {
|
|
55
|
+
constructor() {
|
|
56
|
+
y(this, "_phrase", null);
|
|
57
|
+
y(this, "_buffer", null);
|
|
58
|
+
y(this, "_tokens", null);
|
|
59
|
+
y(this, "_consumers", null);
|
|
60
|
+
y(this, "_consumer", null);
|
|
61
|
+
y(this, "_startIndex", 0);
|
|
62
|
+
y(this, "_endIndex", -1);
|
|
63
|
+
}
|
|
64
|
+
find(e, n) {
|
|
65
|
+
const s = n.findIndex((o) => o.startIndex <= e && e <= o.endIndex), a = n.at(s);
|
|
66
|
+
return { index: s, token: a };
|
|
67
|
+
}
|
|
68
|
+
parse(e, n = 0) {
|
|
69
|
+
this._phrase = e, this._buffer = [], this._tokens = [], this._consumers = this.consumers(), this._consumer = null, this._startIndex = 0, this._endIndex = -1;
|
|
70
|
+
for (let c = 0; c < this._phrase.length; c++) {
|
|
71
|
+
this._endIndex += 1;
|
|
72
|
+
const k = this._phrase[c];
|
|
73
|
+
this._buffer.push(k);
|
|
74
|
+
let h = !1;
|
|
75
|
+
if (this._consumer || (this._consumer = this.lock(), this._consumer && (h = !0, this._consumer.init(this._buffer, this))), this._consumer) {
|
|
76
|
+
h ? h = !1 : this._consumer.append(k, this);
|
|
77
|
+
const x = this._consumer.consume(this);
|
|
78
|
+
x && (this._tokens.push(x), this._buffer = [], this._consumer = null, this._startIndex = this._endIndex + 1);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
this._tokens.push({ type: "eop", startIndex: e.length, endIndex: e.length, value: "" });
|
|
82
|
+
const s = this._tokens.flatMap((c) => c.children && c.children.length > 0 ? c.children : [c]), { token: a, index: o } = this.find(n, this._tokens), { token: m, index: p } = this.find(n, s), l = n === m.startIndex && s[p - 1] ? s[p - 1] : m;
|
|
83
|
+
return {
|
|
84
|
+
cursor: n,
|
|
85
|
+
parentIndex: o,
|
|
86
|
+
parent: a,
|
|
87
|
+
currentIndex: p,
|
|
88
|
+
current: m,
|
|
89
|
+
suggest: {
|
|
90
|
+
token: l,
|
|
91
|
+
parent: this.find(l.startIndex, this._tokens).token,
|
|
92
|
+
value: l.value.substring(0, n - l.startIndex)
|
|
93
|
+
},
|
|
94
|
+
tokens: this._tokens
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
lock() {
|
|
98
|
+
return this._consumers.find((e) => e.lock(this));
|
|
99
|
+
}
|
|
100
|
+
buffer() {
|
|
101
|
+
return this._buffer;
|
|
102
|
+
}
|
|
103
|
+
bufferValue() {
|
|
104
|
+
return this._buffer.join("");
|
|
105
|
+
}
|
|
106
|
+
start() {
|
|
107
|
+
return this._startIndex;
|
|
108
|
+
}
|
|
109
|
+
end() {
|
|
110
|
+
return this._endIndex;
|
|
111
|
+
}
|
|
112
|
+
ahead(e) {
|
|
113
|
+
const n = this._endIndex + 1;
|
|
114
|
+
return e ? this._phrase.slice(n, n + e) : this._phrase.substring(n);
|
|
115
|
+
}
|
|
116
|
+
behind(e) {
|
|
117
|
+
return e ? this.bufferValue().slice(-e) : this.bufferValue();
|
|
118
|
+
}
|
|
119
|
+
behindEndsWithAny(e, ...n) {
|
|
120
|
+
const s = e ? this.behind().trimEnd() : this.behind();
|
|
121
|
+
return n.some((a) => s.endsWith(a));
|
|
122
|
+
}
|
|
123
|
+
testBehind(e) {
|
|
124
|
+
return e.test(this.behind());
|
|
125
|
+
}
|
|
126
|
+
aheadStartsWithAny(e, ...n) {
|
|
127
|
+
const s = e ? this.ahead().trimStart() : this.ahead();
|
|
128
|
+
return n.some((a) => s.startsWith(a));
|
|
129
|
+
}
|
|
130
|
+
aheadIsEmpty(e = !1) {
|
|
131
|
+
return e ? this.ahead().trim().length === 0 : this.ahead().length === 0;
|
|
132
|
+
}
|
|
133
|
+
testAhead(e) {
|
|
134
|
+
return e.test(this.ahead());
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
class z {
|
|
138
|
+
constructor() {
|
|
139
|
+
y(this, "_buffer", []);
|
|
140
|
+
}
|
|
141
|
+
reset() {
|
|
142
|
+
this._buffer = [];
|
|
143
|
+
}
|
|
144
|
+
init(e, n) {
|
|
145
|
+
this._buffer = [...e];
|
|
146
|
+
}
|
|
147
|
+
append(e, n) {
|
|
148
|
+
this._buffer.push(e);
|
|
149
|
+
}
|
|
150
|
+
bufferValue() {
|
|
151
|
+
return this._buffer.join("");
|
|
152
|
+
}
|
|
153
|
+
endsWithAny(...e) {
|
|
154
|
+
const n = this.bufferValue();
|
|
155
|
+
return e.some((s) => n.endsWith(s));
|
|
156
|
+
}
|
|
157
|
+
test(e) {
|
|
158
|
+
return e.test(this.bufferValue());
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
class Te extends z {
|
|
162
|
+
lock(e) {
|
|
163
|
+
return e.bufferValue().match(/\s/) && e.ahead(1) !== " ";
|
|
164
|
+
}
|
|
165
|
+
consume(e) {
|
|
166
|
+
return e.ahead(1) !== " " ? {
|
|
167
|
+
type: "whitespace",
|
|
168
|
+
startIndex: e.start(),
|
|
169
|
+
endIndex: e.end(),
|
|
170
|
+
value: this._buffer.join("")
|
|
171
|
+
} : null;
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
class Oe extends z {
|
|
175
|
+
lock(e) {
|
|
176
|
+
return !e.bufferValue().match(/\s/) && (e.ahead(1) === " " || e.ahead(1) === "");
|
|
177
|
+
}
|
|
178
|
+
consume(e) {
|
|
179
|
+
return e.ahead(1) === " " || e.aheadIsEmpty(!0) ? {
|
|
180
|
+
type: "word",
|
|
181
|
+
startIndex: e.start(),
|
|
182
|
+
endIndex: e.end(),
|
|
183
|
+
value: this._buffer.join("")
|
|
184
|
+
} : null;
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
class We extends Ce {
|
|
188
|
+
consumers() {
|
|
189
|
+
return [new Oe(), new Te()];
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
class V {
|
|
193
|
+
constructor(e) {
|
|
194
|
+
this.suggestions = e;
|
|
195
|
+
}
|
|
196
|
+
suggest(e) {
|
|
197
|
+
return this.suggestions.filter((n) => n.indexOf(e.suggest.value) > -1);
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
function ve({
|
|
201
|
+
value: t = "",
|
|
202
|
+
variant: e = "outlined",
|
|
203
|
+
suggestions: n = [],
|
|
204
|
+
lexer: s,
|
|
205
|
+
suggester: a,
|
|
206
|
+
startAdornment: o,
|
|
207
|
+
endAdornment: m,
|
|
208
|
+
onChange: p,
|
|
209
|
+
onKeyDown: l,
|
|
210
|
+
...c
|
|
211
|
+
}) {
|
|
212
|
+
const k = A(), h = A(), x = A(), O = A(s || new We()), w = A(), R = A(a || new V(n)), [I, g] = T(!1), [_, E] = T(n);
|
|
213
|
+
N(() => {
|
|
214
|
+
R.current = a || new V(n);
|
|
215
|
+
}, [a, n]);
|
|
216
|
+
const S = (i, f = 0) => {
|
|
217
|
+
let u = h.current.querySelector("input").selectionStart + f;
|
|
218
|
+
return u = u < 0 ? 0 : u > i.length ? i.length : u, w.current = O.current.parse(i, u), w.current;
|
|
219
|
+
}, r = (i, f = 0) => {
|
|
220
|
+
const u = R.current.suggest(S(i, f));
|
|
221
|
+
E((u == null ? void 0 : u.length) > 0 ? u : [...n]);
|
|
222
|
+
}, B = (i) => {
|
|
223
|
+
p(i.target.value);
|
|
224
|
+
}, q = (i) => {
|
|
225
|
+
const f = K(i), { isEnter: u, isCtrl: H, isSpace: G, isEscape: Q, isArrowDown: X } = f;
|
|
226
|
+
X ? (i.preventDefault(), x.current.focus()) : H && G ? (g(!0), r(t)) : Q && g(!I), u && I && _.length === 1 ? (W(_[0]), i.preventDefault()) : l && l(f);
|
|
227
|
+
}, U = (i) => {
|
|
228
|
+
I && r(i.target.value);
|
|
229
|
+
}, F = (i) => {
|
|
230
|
+
const { isEscape: f } = K(i);
|
|
231
|
+
f && (h.current.focus(), g(!1));
|
|
232
|
+
}, W = (i) => {
|
|
233
|
+
const { suggest: f } = w.current, u = h.current.querySelector("input");
|
|
234
|
+
u.focus(), u.setSelectionRange(f.token.startIndex, f.token.endIndex + 1), document.execCommand("insertText", !1, i), g(!1);
|
|
235
|
+
};
|
|
236
|
+
return /* @__PURE__ */ d($, { onClickAway: () => g(!1), children: /* @__PURE__ */ M("div", { ref: k, style: { position: "relative" }, children: [
|
|
237
|
+
/* @__PURE__ */ d(
|
|
238
|
+
P,
|
|
239
|
+
{
|
|
240
|
+
ref: h,
|
|
241
|
+
...c,
|
|
242
|
+
fullWidth: !0,
|
|
243
|
+
autoComplete: "off",
|
|
244
|
+
value: t,
|
|
245
|
+
variant: e,
|
|
246
|
+
onChange: B,
|
|
247
|
+
onKeyDown: q,
|
|
248
|
+
InputProps: {
|
|
249
|
+
...c.InputProps,
|
|
250
|
+
onSelectCapture: U,
|
|
251
|
+
startAdornment: o && /* @__PURE__ */ d(v, { position: "start", children: o }),
|
|
252
|
+
endAdornment: m && /* @__PURE__ */ d(v, { position: "end", children: m })
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
),
|
|
256
|
+
/* @__PURE__ */ d(
|
|
257
|
+
ee,
|
|
258
|
+
{
|
|
259
|
+
anchorEl: k.current,
|
|
260
|
+
style: { width: "100%", zIndex: 100 },
|
|
261
|
+
open: I && _.length > 0,
|
|
262
|
+
disablePortal: !0,
|
|
263
|
+
children: /* @__PURE__ */ d(
|
|
264
|
+
te,
|
|
265
|
+
{
|
|
266
|
+
elevation: 2,
|
|
267
|
+
sx: { maxHeight: 200, overflow: "auto", borderTopRightRadius: 0, borderTopLeftRadius: 0 },
|
|
268
|
+
children: /* @__PURE__ */ d(
|
|
269
|
+
ne,
|
|
270
|
+
{
|
|
271
|
+
ref: x,
|
|
272
|
+
onKeyDown: F,
|
|
273
|
+
sx: {
|
|
274
|
+
"&:focus": {
|
|
275
|
+
outline: "none"
|
|
276
|
+
}
|
|
277
|
+
},
|
|
278
|
+
children: _ == null ? void 0 : _.map((i) => /* @__PURE__ */ d(se, { onClick: () => W(i), children: /* @__PURE__ */ d(re, { children: i }) }, i))
|
|
279
|
+
}
|
|
280
|
+
)
|
|
281
|
+
}
|
|
282
|
+
)
|
|
283
|
+
}
|
|
284
|
+
)
|
|
285
|
+
] }) });
|
|
286
|
+
}
|
|
287
|
+
const Be = ({ data: t, collapse: e = !0, forceCompact: n = !1, slotProps: s }) => {
|
|
288
|
+
var _, E, S;
|
|
289
|
+
const a = ie(), [o] = L(j.COMPACT_JSON), [m] = L(j.FLATTEN_JSON), p = J(D, (r) => r == null ? void 0 : r.ReactJson), { t: l } = J(D, (r) => r == null ? void 0 : r.i18next), [c, k] = T(null), [h, x] = T(""), O = C(() => a.palette.mode === "dark", [a]), w = C(() => ce(t, o || n), [o, t, n]), R = C(() => {
|
|
290
|
+
const r = he(w, h);
|
|
291
|
+
return m ? de(r) : r;
|
|
292
|
+
}, [w, m, h]), I = C(() => {
|
|
293
|
+
try {
|
|
294
|
+
return new RegExp(h), !1;
|
|
295
|
+
} catch {
|
|
296
|
+
return !0;
|
|
297
|
+
}
|
|
298
|
+
}, [h]);
|
|
299
|
+
N(() => {
|
|
300
|
+
k(p ? () => p : oe(() => import("@microlink/react-json-view")));
|
|
301
|
+
}, [p]);
|
|
302
|
+
const g = (r) => r.name !== "root" && r.type !== "object" || r.namespace.length > 3;
|
|
303
|
+
return t ? /* @__PURE__ */ M(
|
|
304
|
+
ae,
|
|
305
|
+
{
|
|
306
|
+
direction: "column",
|
|
307
|
+
spacing: 1,
|
|
308
|
+
...s == null ? void 0 : s.stack,
|
|
309
|
+
sx: {
|
|
310
|
+
"& > div:first-of-type": { mt: 1, mr: 0.5 },
|
|
311
|
+
...Array.isArray((_ = s == null ? void 0 : s.stack) == null ? void 0 : _.sx) ? (E = s == null ? void 0 : s.stack) == null ? void 0 : E.sx : [(S = s == null ? void 0 : s.stack) == null ? void 0 : S.sx]
|
|
312
|
+
},
|
|
313
|
+
children: [
|
|
314
|
+
/* @__PURE__ */ d(
|
|
315
|
+
ve,
|
|
316
|
+
{
|
|
317
|
+
value: h,
|
|
318
|
+
onChange: x,
|
|
319
|
+
size: "small",
|
|
320
|
+
error: I,
|
|
321
|
+
label: l("json.viewer.search.label"),
|
|
322
|
+
placeholder: l("json.viewer.search.prompt")
|
|
323
|
+
}
|
|
324
|
+
),
|
|
325
|
+
c && /* @__PURE__ */ d(
|
|
326
|
+
c,
|
|
327
|
+
{
|
|
328
|
+
src: R,
|
|
329
|
+
theme: O ? "summerfruit" : "summerfruit:inverted",
|
|
330
|
+
indentWidth: 2,
|
|
331
|
+
displayDataTypes: !o && !n,
|
|
332
|
+
displayObjectSize: !o && !n,
|
|
333
|
+
shouldCollapse: e ? g : !1,
|
|
334
|
+
quotesOnKeys: !1,
|
|
335
|
+
style: {
|
|
336
|
+
flex: 1,
|
|
337
|
+
overflow: "auto",
|
|
338
|
+
height: "100%",
|
|
339
|
+
fontSize: o || n ? "small" : "smaller",
|
|
340
|
+
borderRadius: a.shape.borderRadius,
|
|
341
|
+
padding: a.spacing(1)
|
|
342
|
+
},
|
|
343
|
+
enableClipboard: (r) => {
|
|
344
|
+
typeof r.src == "string" ? navigator.clipboard.writeText(r.src) : navigator.clipboard.writeText(JSON.stringify(r.src));
|
|
345
|
+
},
|
|
346
|
+
// Type declaration is wrong - this is a valid prop
|
|
347
|
+
displayArrayKey: !o && !n,
|
|
348
|
+
...s == null ? void 0 : s.json
|
|
349
|
+
}
|
|
350
|
+
)
|
|
351
|
+
]
|
|
352
|
+
}
|
|
353
|
+
) : /* @__PURE__ */ d(ue, { width: "100%", height: "95%", variant: "rounded" });
|
|
354
|
+
};
|
|
355
|
+
export {
|
|
356
|
+
Be as J,
|
|
357
|
+
K as p
|
|
358
|
+
};
|