@cccsaurora/clue-ui 1.1.1-dev.108 → 1.1.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.
Files changed (178) hide show
  1. package/ActionForm-myEAs2UC.js +435 -0
  2. package/AnnotationDetails-BdfWMISw.js +160 -0
  3. package/AnnotationPreview-CKMGCoUH.js +140 -0
  4. package/ClueEnrichContext-CrFpdYhh.js +414 -0
  5. package/FlexOne-BXWFOd1T.js +6 -0
  6. package/_Map-DXNg_Z-q.js +54 -0
  7. package/_MapCache-Cu25RRDU.js +129 -0
  8. package/_Uint8Array-DlJCtTvG.js +102 -0
  9. package/_baseAssignValue-CUmzp727.js +20 -0
  10. package/_baseClone-BlMmRXeX.js +208 -0
  11. package/_baseExtremum-P_0akmCi.js +27 -0
  12. package/_baseFlatten-CN7vDNEQ.js +72 -0
  13. package/_baseGet-Dgf6_xCm.js +80 -0
  14. package/_baseIsEqual-Cpjtfb3Q.js +173 -0
  15. package/_baseIteratee-CP1bocOX.js +95 -0
  16. package/_baseSlice-M5RKzt1A.js +10 -0
  17. package/_baseSum-wEbgNeUs.js +10 -0
  18. package/_baseUniq-tMFmk80M.js +61 -0
  19. package/_commonjsHelpers-DaMA6jEr.js +8 -0
  20. package/_createAggregator-B4Cav8ZM.js +53 -0
  21. package/_getPrototype-CHAFQYL_.js +5 -0
  22. package/_getTag-BV_UoLYG.js +90 -0
  23. package/cloneDeep-BPVpFBzJ.js +8 -0
  24. package/components/AnnotationBody.js +35 -49
  25. package/components/AnnotationDetailPopover.js +30 -36
  26. package/components/AnnotationDetails.js +6 -6
  27. package/components/AnnotationEntry.js +47 -50
  28. package/components/AnnotationPreview.js +5 -5
  29. package/components/ClassificationChip.js +23 -44
  30. package/components/CountBadge.js +26 -31
  31. package/components/EnrichedCard.js +97 -110
  32. package/components/EnrichedChip.js +105 -130
  33. package/components/EnrichedTypography.js +107 -133
  34. package/components/ErrorBoundary.js +24 -28
  35. package/components/RetryFailedEnrichments.js +9 -10
  36. package/components/SourcePicker.js +49 -57
  37. package/components/actions/ActionForm.js +4 -4
  38. package/components/actions/ExecutePopover.js +50 -64
  39. package/components/actions/ResultModal.js +5 -5
  40. package/components/actions/form/schemaAdapter.js +23 -39
  41. package/components/display/graph/ExpandMoreButton.js +10 -10
  42. package/components/display/graph/elements/NodeCard.js +91 -111
  43. package/components/display/graph/elements/NodeTag.js +13 -15
  44. package/components/display/graph/index.js +202 -261
  45. package/components/display/graph/visualizations/Leaf.js +69 -88
  46. package/components/display/graph/visualizations/cloud/index.js +81 -98
  47. package/components/display/graph/visualizations/icons/BaseIcon.js +21 -26
  48. package/components/display/graph/visualizations/icons/BugIcon.js +12 -12
  49. package/components/display/graph/visualizations/icons/HostIcon.js +12 -12
  50. package/components/display/graph/visualizations/icons/NetworkIcon.js +12 -12
  51. package/components/display/graph/visualizations/icons/ProcessIcon.js +12 -12
  52. package/components/display/graph/visualizations/icons/TargetIcon.js +13 -13
  53. package/components/display/graph/visualizations/icons/index.js +13 -14
  54. package/components/display/graph/visualizations/panels/NodePanel.js +8 -10
  55. package/components/display/graph/visualizations/tree/BundleLine.js +81 -108
  56. package/components/display/graph/visualizations/tree/Triangle.js +13 -13
  57. package/components/display/graph/visualizations/tree/index.js +305 -407
  58. package/components/display/icons/Iconified.js +12 -27
  59. package/components/display/json/index.js +4 -4
  60. package/components/display/markdown/index.js +5761 -8662
  61. package/components/enrichment/EnrichPopover.js +47 -55
  62. package/components/fetchers/Fetcher.js +95 -123
  63. package/components/fetchers/PreviewModal.js +17 -20
  64. package/components/fetchers/StatusChip.js +17 -21
  65. package/components/group/Entry.js +11 -13
  66. package/components/group/Group.js +10 -13
  67. package/components/group/GroupControl.js +66 -77
  68. package/components/stats/QueryStatus.js +31 -41
  69. package/countBy-DOutsa_w.js +8 -0
  70. package/data/event.js +4 -6
  71. package/database/index.js +2 -2
  72. package/debounce-DryYcbJ4.js +56 -0
  73. package/get-Bow1vKwx.js +8 -0
  74. package/groupBy-BheQYl6f.js +8 -0
  75. package/hooks/ClueActionContext.js +7 -7
  76. package/hooks/ClueComponentContext.js +23 -29
  77. package/hooks/ClueConfigProvider.js +12 -14
  78. package/hooks/ClueDatabaseContext.js +13 -19
  79. package/hooks/ClueEnrichContext.js +8 -8
  80. package/hooks/ClueFetcherContext.js +46 -74
  81. package/hooks/ClueGroupContext.js +14 -17
  82. package/hooks/CluePopupContext.js +5 -5
  83. package/hooks/ClueProvider.js +10 -12
  84. package/hooks/selectors.js +10 -21
  85. package/hooks/useActionResult.js +2 -2
  86. package/hooks/useAnnotations.js +29 -45
  87. package/hooks/useClue.js +4 -6
  88. package/hooks/useClueActions.js +3 -3
  89. package/hooks/useClueConfig.js +4 -6
  90. package/hooks/useClueTypeConfig.js +3 -3
  91. package/hooks/useComparator.js +435 -722
  92. package/hooks/useErrors.js +18 -22
  93. package/hooks/useMyHighlights.js +36 -66
  94. package/hooks/useMyLocalStorage.js +37 -66
  95. package/iconify-BBckr5AQ.js +1263 -0
  96. package/icons/Action.js +49 -66
  97. package/icons/Assessment.js +68 -84
  98. package/icons/Context.js +63 -77
  99. package/icons/Opinion.js +65 -77
  100. package/icons/iconMap.js +2 -2
  101. package/identity-ByMq8VxU.js +6 -0
  102. package/index-BXxfAxFt.js +12734 -0
  103. package/index-C15OYgRY.js +358 -0
  104. package/index-E7g8cRyW.js +568 -0
  105. package/index-p5_wX7q1.js +11729 -0
  106. package/index-vF6IyBhz.js +975 -0
  107. package/isEmpty-g47Qir2A.js +21 -0
  108. package/isNil-CjWwlQS3.js +6 -0
  109. package/isObject-B53jY8Qg.js +7 -0
  110. package/isObjectLike-BatpeCIi.js +29 -0
  111. package/isSymbol-C3_SC0Qp.js +8 -0
  112. package/last-7CdUxN0r.js +7 -0
  113. package/main.js +62 -62
  114. package/package.json +1 -1
  115. package/sortBy-ITdmD17L.js +79 -0
  116. package/sumBy-DxJUU2E8.js +8 -0
  117. package/text/Frequency.js +23 -42
  118. package/toFinite-BMy6GObD.js +14 -0
  119. package/toNumber-YVhnnJv4.js +31 -0
  120. package/useClueTypeConfig-DyeBcXQX.js +2214 -0
  121. package/utils/chain.js +64 -91
  122. package/utils/classificationParser.js +256 -519
  123. package/utils/constants.js +10 -35
  124. package/utils/graph.js +45 -72
  125. package/utils/hashUtil.js +7 -7
  126. package/utils/line.js +81 -131
  127. package/utils/loggerUtil.js +3 -5
  128. package/utils/sessionStorage.js +27 -41
  129. package/utils/time.js +423 -423
  130. package/utils/utils.js +9 -9
  131. package/utils/window.js +10 -21
  132. package/utils-BnmI_6N8.js +130 -0
  133. package/ActionForm-ByeOzpc4.js +0 -555
  134. package/AnnotationDetails-DknbKDyl.js +0 -175
  135. package/AnnotationPreview-CQwKs8se.js +0 -188
  136. package/ClueEnrichContext-6NJfXpUB.js +0 -536
  137. package/FlexOne-BSYAhhtG.js +0 -9
  138. package/_Map-kgDsDYxq.js +0 -64
  139. package/_MapCache-DabaaWfq.js +0 -161
  140. package/_Uint8Array-BlVVH1tp.js +0 -129
  141. package/_baseAssignValue-CNbcU6Nb.js +0 -25
  142. package/_baseClone-D3a8Pa4T.js +0 -284
  143. package/_baseExtremum-B1o1zHjR.js +0 -33
  144. package/_baseFlatten-D4huXoEI.js +0 -92
  145. package/_baseGet-BSK_nnoz.js +0 -109
  146. package/_baseIsEqual-B5xLoweL.js +0 -238
  147. package/_baseIteratee-p6Nj07-n.js +0 -126
  148. package/_baseSlice-GAv_YFTT.js +0 -20
  149. package/_baseSum-D0WC1dN0.js +0 -13
  150. package/_baseUniq-CpupKWcL.js +0 -89
  151. package/_commonjsHelpers-DWwsNxpa.js +0 -8
  152. package/_createAggregator-BpVy5xMi.js +0 -63
  153. package/_getPrototype-D1LAdQKO.js +0 -5
  154. package/_getTag-D3ToyefI.js +0 -126
  155. package/cloneDeep-CjP5k9zW.js +0 -8
  156. package/countBy-C69WslUA.js +0 -14
  157. package/debounce-bV0h5FC5.js +0 -92
  158. package/get-D3C3lEU3.js +0 -8
  159. package/groupBy-DC2oOuBN.js +0 -14
  160. package/iconify-CXMreGTg.js +0 -1782
  161. package/identity-CPGTqrE4.js +0 -6
  162. package/index-BDVjGvMI.js +0 -696
  163. package/index-BbPn6-Mw.js +0 -15750
  164. package/index-Bi21Wb23.js +0 -465
  165. package/index-C3lkTD69.js +0 -1172
  166. package/index-CC12Ux-9.js +0 -17654
  167. package/isEmpty-BQkZubqU.js +0 -29
  168. package/isNil-CIubwp4T.js +0 -6
  169. package/isObject-FTY-5JQX.js +0 -7
  170. package/isObjectLike-OAgjjZye.js +0 -48
  171. package/isSymbol-Xd2FsJyp.js +0 -8
  172. package/last-CUCl67Im.js +0 -7
  173. package/sortBy-B-UKp4GT.js +0 -100
  174. package/sumBy-MYkDPHZL.js +0 -8
  175. package/toFinite-Bc55msYj.js +0 -16
  176. package/toNumber-DPxy1FBy.js +0 -39
  177. package/useClueTypeConfig-XvGvIw2S.js +0 -3201
  178. package/utils-7OtvGnmf.js +0 -200
@@ -0,0 +1,140 @@
1
+ import { jsxs as C, jsx as n } from "react/jsx-runtime";
2
+ import { I as H } from "./iconify-BBckr5AQ.js";
3
+ import { useTheme as k, Popper as V, Fade as j, Paper as O, Stack as w, Typography as y, Divider as W } from "@mui/material";
4
+ import F from "./components/AnnotationDetailPopover.js";
5
+ import L from "./hooks/useAnnotations.js";
6
+ import { t as M } from "./utils-BnmI_6N8.js";
7
+ import { useState as v, useRef as Y, useCallback as x, useEffect as Z, useMemo as _ } from "react";
8
+ import { c as B, u as G } from "./index-E7g8cRyW.js";
9
+ import { SHOW_EVENT_ID as g, HIDE_EVENT_ID as D } from "./data/event.js";
10
+ import { safeDispatchEvent as A, safeAddEventListener as S } from "./utils/window.js";
11
+ import { i as J } from "./AnnotationDetails-BdfWMISw.js";
12
+ const b = B(null), rt = ({ children: c }) => {
13
+ const [l, e] = v(null), [p, i] = v(null), [r, d] = v(null), [u, m] = v(null), [f, t] = v({}), a = Y(null), P = x((s, o, z, N) => {
14
+ A(
15
+ new CustomEvent(g, {
16
+ detail: {
17
+ type: s,
18
+ anchorEl: o,
19
+ value: z,
20
+ options: N
21
+ }
22
+ })
23
+ );
24
+ }, []), h = x(
25
+ (s, o) => {
26
+ A(
27
+ new CustomEvent(D, {
28
+ detail: {
29
+ type: s,
30
+ value: o
31
+ }
32
+ })
33
+ );
34
+ },
35
+ // eslint-disable-next-line react-hooks/exhaustive-deps
36
+ []
37
+ ), E = x((s) => {
38
+ const { detail: o } = s;
39
+ e(o.type), d(o.value), o.options && (o.options.content && m(o.options.content), o.options.onClose && (a.current = o.options.onClose), o.options.popoverProps && t(o.options.popoverProps)), i(o.anchorEl);
40
+ }, []), I = x(
41
+ (s) => {
42
+ const { detail: o } = s;
43
+ r && (o.type !== l || r.type !== o.value.type || r.value !== o.value.value) || (e(null), i(null), d(null), m(null), t({}), a.current = null);
44
+ },
45
+ [r, l]
46
+ );
47
+ Z(() => {
48
+ const s = S(g, E), o = S(D, I);
49
+ return () => {
50
+ s(), o();
51
+ };
52
+ }, [E, I]);
53
+ const T = _(
54
+ () => ({
55
+ showInfo: P,
56
+ closeInfo: h,
57
+ __detailsContent: u
58
+ }),
59
+ [h, u, P]
60
+ );
61
+ return /* @__PURE__ */ C(b.Provider, { value: T, children: [
62
+ c,
63
+ /* @__PURE__ */ n(
64
+ F,
65
+ {
66
+ ...f,
67
+ anchorEl: p,
68
+ open: !!p && l === "details",
69
+ enrichRequest: r,
70
+ onClose: () => {
71
+ a.current ? a.current() : h("details", r);
72
+ }
73
+ }
74
+ ),
75
+ /* @__PURE__ */ n(
76
+ K,
77
+ {
78
+ ...f,
79
+ anchorEl: p,
80
+ open: !!p && !J(l) && l !== "details",
81
+ annotationType: l,
82
+ enrichRequest: r
83
+ }
84
+ )
85
+ ] });
86
+ }, K = ({ annotationType: c, anchorEl: l, enrichRequest: e, open: p, ...i }) => {
87
+ const r = k(), d = G(b, (t) => t.__detailsContent), [u] = L(e == null ? void 0 : e.type, e == null ? void 0 : e.value, e == null ? void 0 : e.classification), m = _(
88
+ () => c === "actionResults" ? [] : u.filter((t) => t.type === c),
89
+ [c, u]
90
+ ), f = x((t) => {
91
+ try {
92
+ const a = parseInt(window.getComputedStyle(t, null).getPropertyValue("z-index"));
93
+ return isNaN(a) ? f(t.parentElement) : (a + 2).toString();
94
+ } catch {
95
+ return "2";
96
+ }
97
+ }, []);
98
+ return !m.length && !d ? null : /* @__PURE__ */ n(
99
+ V,
100
+ {
101
+ ...i,
102
+ open: p,
103
+ anchorEl: l,
104
+ placement: "bottom-start",
105
+ sx: [{ zIndex: f(l) }, ...Array.isArray(i.sx) ? i.sx : [i.sx]],
106
+ children: /* @__PURE__ */ n(j, { in: !!l, children: /* @__PURE__ */ n(O, { sx: { overflowY: "auto", maxWidth: "500px", boxShadow: r.shadows[2] }, children: /* @__PURE__ */ n(w, { direction: "column", sx: { p: 1 }, spacing: 1, divider: /* @__PURE__ */ n(W, { orientation: "horizontal" }), children: d ?? m.map((t) => /* @__PURE__ */ C(
107
+ w,
108
+ {
109
+ direction: "column",
110
+ spacing: 1,
111
+ children: [
112
+ /* @__PURE__ */ C(w, { direction: "row", spacing: 1, alignItems: "center", children: [
113
+ t.analytic_icon && /* @__PURE__ */ n(
114
+ H,
115
+ {
116
+ icon: t.analytic_icon,
117
+ style: { filter: "drop-shadow(0px 0px 1px rgb(0 0 0 / 0.4))" }
118
+ }
119
+ ),
120
+ /* @__PURE__ */ n(y, { variant: "body1", sx: { textTransform: "capitalize" }, children: t.analytic ?? t.author }),
121
+ /* @__PURE__ */ C(y, { variant: "caption", color: "text.secondary", children: [
122
+ "(",
123
+ M(t.timestamp),
124
+ ")"
125
+ ] })
126
+ ] }),
127
+ /* @__PURE__ */ n(y, { variant: "body2", children: t.summary }),
128
+ /* @__PURE__ */ n(y, { variant: "caption", color: "text.secondary", children: t.value })
129
+ ]
130
+ },
131
+ t.analytic + t.author + t.value + t.link + t.summary + t.timestamp
132
+ )) }) }) })
133
+ }
134
+ );
135
+ };
136
+ export {
137
+ K as A,
138
+ b as C,
139
+ rt as a
140
+ };
@@ -0,0 +1,414 @@
1
+ import { jsx as vt } from "react/jsx-runtime";
2
+ import { a as xt } from "./iconify-BBckr5AQ.js";
3
+ import { u as Dt, a as Et, p as ot } from "./useClueTypeConfig-DyeBcXQX.js";
4
+ import { clueDebugLogger as G } from "./utils/loggerUtil.js";
5
+ import { b as It } from "./_baseSlice-M5RKzt1A.js";
6
+ import { t as Ct } from "./toFinite-BMy6GObD.js";
7
+ import { d as gt } from "./debounce-DryYcbJ4.js";
8
+ import { g as ct } from "./groupBy-BheQYl6f.js";
9
+ import { b as lt } from "./_baseUniq-tMFmk80M.js";
10
+ import { b as $t } from "./_baseIteratee-CP1bocOX.js";
11
+ import { useContext as Ot, useState as H, useMemo as K, useCallback as g, useRef as bt, useEffect as q } from "react";
12
+ import { c as jt } from "./index-E7g8cRyW.js";
13
+ import { ClueDatabaseContext as Pt } from "./hooks/ClueDatabaseContext.js";
14
+ import Mt from "./hooks/useClueConfig.js";
15
+ function qt(e) {
16
+ var s = Ct(e), p = s % 1;
17
+ return s === s ? p ? s - p : s : 0;
18
+ }
19
+ var At = Math.ceil, Bt = Math.max;
20
+ function Rt(e, s, p) {
21
+ s === void 0 ? s = 1 : s = Bt(qt(s), 0);
22
+ var l = e == null ? 0 : e.length;
23
+ if (!l || s < 1)
24
+ return [];
25
+ for (var h = 0, v = 0, O = Array(At(l / s)); h < l; )
26
+ O[v++] = It(e, h, h += s);
27
+ return O;
28
+ }
29
+ function at(e) {
30
+ return e && e.length ? lt(e) : [];
31
+ }
32
+ function Vt(e, s) {
33
+ return e && e.length ? lt(e, $t(s)) : [];
34
+ }
35
+ let J;
36
+ const Ut = new Uint8Array(16);
37
+ function Wt() {
38
+ if (!J && (J = typeof crypto < "u" && crypto.getRandomValues && crypto.getRandomValues.bind(crypto), !J))
39
+ throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
40
+ return J(Ut);
41
+ }
42
+ const d = [];
43
+ for (let e = 0; e < 256; ++e)
44
+ d.push((e + 256).toString(16).slice(1));
45
+ function Ft(e, s = 0) {
46
+ return d[e[s + 0]] + d[e[s + 1]] + d[e[s + 2]] + d[e[s + 3]] + "-" + d[e[s + 4]] + d[e[s + 5]] + "-" + d[e[s + 6]] + d[e[s + 7]] + "-" + d[e[s + 8]] + d[e[s + 9]] + "-" + d[e[s + 10]] + d[e[s + 11]] + d[e[s + 12]] + d[e[s + 13]] + d[e[s + 14]] + d[e[s + 15]];
47
+ }
48
+ const Ht = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto), ut = {
49
+ randomUUID: Ht
50
+ };
51
+ function $(e, s, p) {
52
+ if (ut.randomUUID && !e)
53
+ return ut.randomUUID();
54
+ e = e || {};
55
+ const l = e.random || (e.rng || Wt)();
56
+ return l[6] = l[6] & 15 | 64, l[8] = l[8] & 63 | 128, Ft(l);
57
+ }
58
+ const Jt = jt(null), ee = ({
59
+ children: e,
60
+ classification: s,
61
+ baseURL: p,
62
+ getToken: l,
63
+ onNetworkCall: h,
64
+ pickSources: v,
65
+ chunkSize: O = 15,
66
+ maxRequestCount: Q = 4,
67
+ defaultTimeout: A = 5,
68
+ enabled: B = !0,
69
+ ready: ft = !1,
70
+ publicIconify: S = !0,
71
+ skipConfigCall: X = !1,
72
+ customIconify: R,
73
+ debugLogging: x = !0
74
+ }) => {
75
+ var st, nt, it, rt;
76
+ const I = Mt(), i = Ot(Pt), [Y, dt] = H(null), w = K(
77
+ () => {
78
+ var t, n;
79
+ return Y ?? s ?? ((n = (t = I.config) == null ? void 0 : t.c12nDef) == null ? void 0 : n.RESTRICTED);
80
+ },
81
+ [s, (nt = (st = I.config) == null ? void 0 : st.c12nDef) == null ? void 0 : nt.RESTRICTED, Y]
82
+ ), Z = g(
83
+ (t) => {
84
+ var n;
85
+ return dt(t((n = I.config) == null ? void 0 : n.c12nDef));
86
+ },
87
+ [(it = I.config) == null ? void 0 : it.c12nDef]
88
+ ), [C, pt] = H(ft), b = bt(0), [D, mt] = H([]), { availableSources: j, typesDetection: V } = Dt(
89
+ B && C,
90
+ p,
91
+ x,
92
+ l,
93
+ h
94
+ );
95
+ q(() => {
96
+ if (X || !B || !C)
97
+ return;
98
+ const t = {}, n = l == null ? void 0 : l();
99
+ n && (t.Authorization = `Bearer ${n}`);
100
+ let u = { baseURL: p, headers: t };
101
+ h && (u = h(u)), Et.configs.get(u).then(I.setConfig);
102
+ }, [p, h, X, C]);
103
+ const [z, N] = H(R);
104
+ q(() => {
105
+ R && N(R);
106
+ }, [R]), q(() => {
107
+ if (S)
108
+ return;
109
+ let t = z ?? void 0 ?? (p == null ? void 0 : p.replace(/^[^.]+/, "icons"));
110
+ !t && typeof window < "u" && window && !window.location.origin.includes("localhost") && (t = window.location.protocol + "//" + window.location.origin.replace(/^[^.]+/, "icons")), t && (G(`Using ${t} for iconify`, x), xt("", {
111
+ resources: [t]
112
+ }));
113
+ }, [p, z, x, S]);
114
+ const U = g(
115
+ async (t) => {
116
+ const n = [];
117
+ for (const c of t) {
118
+ const { latency: o, source: f, type: r, value: y, items: a, error: m } = c;
119
+ m && n.push({
120
+ id: $(),
121
+ source: f,
122
+ type: r,
123
+ value: y,
124
+ annotations: [],
125
+ classification: w,
126
+ latency: o,
127
+ count: 0,
128
+ error: m
129
+ });
130
+ for (const E of a) {
131
+ const { classification: P, count: M, link: F, annotations: yt } = E;
132
+ await i.selectors.find({ selector: { type: r, value: y, source: f, classification: P } }).incrementalRemove();
133
+ const _ = {
134
+ id: $(),
135
+ source: f,
136
+ type: r,
137
+ value: y,
138
+ annotations: yt,
139
+ classification: P,
140
+ latency: o,
141
+ count: M,
142
+ link: F,
143
+ error: m
144
+ };
145
+ n.some((wt) => wt.id === _.id) && (_.id = $()), n.push(_);
146
+ }
147
+ }
148
+ const u = await i.selectors.bulkInsert(n);
149
+ u.error.length > 0 && (console.warn("Errors on upsert:"), u.error.forEach((c) => console.warn(c.documentId, c.validationErrors ?? c.status)));
150
+ },
151
+ [i, w]
152
+ ), T = g(
153
+ async (t, n, u = {}) => {
154
+ var E, P;
155
+ if (!t || !n)
156
+ return console.error(`Type (${t}) or value (${n}) is empty, returning empty response`), {};
157
+ const c = (v == null ? void 0 : v(D, j, [{ type: t, value: n, classification: u.classification }])) ?? D, o = {
158
+ timeout: A,
159
+ force: !1,
160
+ includeRaw: !1,
161
+ noCache: !1,
162
+ classification: w,
163
+ sources: c,
164
+ ...u
165
+ }, f = {}, r = l == null ? void 0 : l();
166
+ r && (f.Authorization = `Bearer ${r}`);
167
+ let y = { baseURL: p, headers: f };
168
+ h && (y = h(y));
169
+ const a = {
170
+ type: t,
171
+ value: n,
172
+ classification: o.classification
173
+ };
174
+ let m = await ((E = i.status) == null ? void 0 : E.findOne({ selector: { ...a } }).exec());
175
+ m ? await m.incrementalPatch({ status: "in-progress" }) : m = await ((P = i.status) == null ? void 0 : P.insert({
176
+ id: $(),
177
+ type: a.type,
178
+ value: a.value,
179
+ classification: a.classification ?? w,
180
+ status: "in-progress"
181
+ }));
182
+ try {
183
+ const M = await ot([a], o.sources, o, y), F = Object.values(Object.values(M)[0])[0];
184
+ return await U(Object.values(F)), F;
185
+ } catch (M) {
186
+ return console.error(M), {};
187
+ } finally {
188
+ await (m == null ? void 0 : m.incrementalPatch({ status: "complete" }));
189
+ }
190
+ },
191
+ [
192
+ U,
193
+ j,
194
+ p,
195
+ i,
196
+ w,
197
+ A,
198
+ l,
199
+ h,
200
+ v,
201
+ D
202
+ ]
203
+ ), W = g(
204
+ async (t, n) => {
205
+ const u = (v == null ? void 0 : v(D, j, t)) ?? D, c = {
206
+ timeout: A,
207
+ includeRaw: !1,
208
+ noCache: !1,
209
+ classification: w,
210
+ sources: u,
211
+ ...n
212
+ }, o = {}, f = l == null ? void 0 : l();
213
+ f && (o.Authorization = `Bearer ${f}`);
214
+ let r = { baseURL: p, headers: o };
215
+ h && (r = h(r));
216
+ const y = [];
217
+ for (const a of t) {
218
+ const m = { type: a.type, value: a.value, classification: c.classification };
219
+ let E = await i.status.findOne({
220
+ selector: m
221
+ }).incrementalPatch({
222
+ status: "in-progress"
223
+ });
224
+ E || (E = await i.status.insert({
225
+ id: $(),
226
+ ...m,
227
+ status: "in-progress",
228
+ sources: c.sources
229
+ })), y.push(E.toMutableJSON());
230
+ }
231
+ try {
232
+ const a = await ot(t, c.sources, c, r), m = Object.values(a).flatMap(Object.values).flatMap(Object.values);
233
+ return await U(m), a;
234
+ } catch (a) {
235
+ return console.error(a), {};
236
+ } finally {
237
+ i.status.bulkUpsert(
238
+ Vt(y, (a) => a.id).map((a) => (a.status = "complete", a))
239
+ );
240
+ }
241
+ },
242
+ [
243
+ v,
244
+ D,
245
+ j,
246
+ A,
247
+ w,
248
+ l,
249
+ p,
250
+ h,
251
+ i,
252
+ U
253
+ ]
254
+ ), L = g(async () => {
255
+ const t = await i.selectors.find({ selector: { error: { $exists: !0 } } }).exec(), n = ct(t, "classification"), u = [];
256
+ for (const [c, o] of Object.entries(n)) {
257
+ const f = ct(o, (r) => `${r.type}:${r.value}`);
258
+ Object.values(f).forEach((r) => {
259
+ u.push({
260
+ id: $(),
261
+ type: r[0].type,
262
+ value: r[0].value,
263
+ classification: c,
264
+ sources: at(r.map((y) => y.source)).sort(),
265
+ status: "pending"
266
+ });
267
+ });
268
+ }
269
+ await i.status.bulkInsert(u), await i.selectors.bulkRemove(t);
270
+ }, [i]), k = K(
271
+ () => gt(
272
+ async () => {
273
+ if (i != null && i.status) {
274
+ if (i.status.closed) {
275
+ console.warn("Status database is closed, will not enrich");
276
+ return;
277
+ }
278
+ } else return;
279
+ const t = await i.status.find({ selector: { status: "pending" } }).update({ $set: { status: "in-progress" } });
280
+ if (t.length < 1)
281
+ return;
282
+ const n = Rt(t, O);
283
+ G(
284
+ `Enriching ${t.length} selectors in ${n.length} chunks of ${O}.`,
285
+ x
286
+ ), await Promise.all(
287
+ // For performance reasons, we chunk the requests. This will allow us to take advantage of parellelization in the
288
+ // backend, both on the pod level and kubernetes level
289
+ n.map(async (u) => {
290
+ let c = null;
291
+ if (b.current <= Q)
292
+ b.current += 1;
293
+ else {
294
+ let o = Date.now();
295
+ await new Promise((f) => {
296
+ c = setInterval(() => {
297
+ G(
298
+ `Waiting on ${b.current} existing requests to complete (total delay: ${Date.now() - o}ms)`,
299
+ x
300
+ ), b.current < Q && f();
301
+ }, 400);
302
+ }).finally(() => {
303
+ b.current += 1, clearInterval(c);
304
+ });
305
+ }
306
+ try {
307
+ const o = {}, f = at(u.flatMap((r) => r.sources ?? []));
308
+ f.length > 0 && (o.sources = f), await W(
309
+ u.map((r) => r.toSelector()),
310
+ o
311
+ ), await i.status.findByIds(u.map((r) => r.id)).update({ $set: { status: "complete" } });
312
+ } catch (o) {
313
+ console.error(o);
314
+ } finally {
315
+ b.current -= 1, c && clearInterval(c);
316
+ }
317
+ })
318
+ );
319
+ },
320
+ 200,
321
+ { maxWait: 500, leading: !1 }
322
+ ),
323
+ [W, O, i, x, Q]
324
+ );
325
+ q(() => {
326
+ }, [i, x]), q(() => {
327
+ if (!B || !C || !(i != null && i.status))
328
+ return;
329
+ const t = i.status.find({
330
+ selector: {
331
+ status: "pending"
332
+ }
333
+ }).$.subscribe(() => k());
334
+ return () => {
335
+ try {
336
+ t == null || t.unsubscribe();
337
+ } catch (n) {
338
+ console.warn(n);
339
+ }
340
+ };
341
+ }, [B, C, i, x, k]);
342
+ const tt = g(
343
+ async (t, n, u) => {
344
+ if (!t)
345
+ throw new Error("Type cannot be null");
346
+ if (!n)
347
+ throw new Error("Value cannot be null");
348
+ const c = { type: t, value: n, classification: u ?? w };
349
+ let o = await i.status.findOne({
350
+ selector: c
351
+ }).exec();
352
+ return o || (o = await i.status.queueInsert({
353
+ id: $(),
354
+ ...c,
355
+ status: "pending"
356
+ })), o;
357
+ },
358
+ [w, i]
359
+ ), et = g(
360
+ (t) => {
361
+ var f, r;
362
+ if (!t)
363
+ return null;
364
+ const n = Object.entries(V), u = (f = n.find(([y, a]) => a.exec(t))) == null ? void 0 : f[0];
365
+ if (u)
366
+ return u;
367
+ const c = t.toLowerCase(), o = (r = n.find(([y, a]) => a.exec(c))) == null ? void 0 : r[0];
368
+ return o || null;
369
+ },
370
+ [V]
371
+ ), ht = K(
372
+ () => {
373
+ var t;
374
+ return {
375
+ bulkEnrich: W,
376
+ enrich: T,
377
+ enrichFailedEnrichments: L,
378
+ sources: D,
379
+ setSources: mt,
380
+ typesDetection: V,
381
+ availableSources: j,
382
+ guessType: et,
383
+ queueEnrich: tt,
384
+ setCustomIconify: N,
385
+ setDefaultClassification: Z,
386
+ setReady: pt,
387
+ defaultClassification: w,
388
+ ready: C && !!i && !!((t = I.config) != null && t.c12nDef)
389
+ };
390
+ },
391
+ [
392
+ W,
393
+ T,
394
+ L,
395
+ D,
396
+ V,
397
+ j,
398
+ et,
399
+ tt,
400
+ Z,
401
+ w,
402
+ C,
403
+ i,
404
+ (rt = I.config) == null ? void 0 : rt.c12nDef
405
+ ]
406
+ );
407
+ return /* @__PURE__ */ vt(Jt.Provider, { value: ht, children: e });
408
+ };
409
+ export {
410
+ Jt as C,
411
+ ee as a,
412
+ Vt as b,
413
+ at as u
414
+ };
@@ -0,0 +1,6 @@
1
+ import { jsx as o } from "react/jsx-runtime";
2
+ import { memo as r } from "react";
3
+ const t = ({ children: e = null }) => /* @__PURE__ */ o("div", { style: { flex: 1 }, children: e }), n = r(t);
4
+ export {
5
+ n as F
6
+ };
@@ -0,0 +1,54 @@
1
+ import { b as i, r as o } from "./isObjectLike-BatpeCIi.js";
2
+ import { i as c } from "./isObject-B53jY8Qg.js";
3
+ var k = Array.isArray, s = "[object AsyncFunction]", u = "[object Function]", f = "[object GeneratorFunction]", p = "[object Proxy]";
4
+ function y(r) {
5
+ if (!c(r))
6
+ return !1;
7
+ var t = i(r);
8
+ return t == u || t == f || t == s || t == p;
9
+ }
10
+ var e = o["__core-js_shared__"], a = function() {
11
+ var r = /[^.]+$/.exec(e && e.keys && e.keys.IE_PROTO || "");
12
+ return r ? "Symbol(src)_1." + r : "";
13
+ }();
14
+ function g(r) {
15
+ return !!a && a in r;
16
+ }
17
+ var v = Function.prototype, b = v.toString;
18
+ function l(r) {
19
+ if (r != null) {
20
+ try {
21
+ return b.call(r);
22
+ } catch {
23
+ }
24
+ try {
25
+ return r + "";
26
+ } catch {
27
+ }
28
+ }
29
+ return "";
30
+ }
31
+ var j = /[\\^$.*+?()[\]{}|]/g, P = /^\[object .+?Constructor\]$/, T = Function.prototype, $ = Object.prototype, d = T.toString, h = $.hasOwnProperty, O = RegExp(
32
+ "^" + d.call(h).replace(j, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$"
33
+ );
34
+ function S(r) {
35
+ if (!c(r) || g(r))
36
+ return !1;
37
+ var t = y(r) ? O : P;
38
+ return t.test(l(r));
39
+ }
40
+ function _(r, t) {
41
+ return r == null ? void 0 : r[t];
42
+ }
43
+ function m(r, t) {
44
+ var n = _(r, t);
45
+ return S(n) ? n : void 0;
46
+ }
47
+ var A = m(o, "Map");
48
+ export {
49
+ A as M,
50
+ y as a,
51
+ m as g,
52
+ k as i,
53
+ l as t
54
+ };