@cccsaurora/clue-ui 1.0.1 → 1.0.2
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 → ActionForm-BtTv0s4P.js} +13 -13
- package/AnnotationDetails-D5tBIeEw.js +160 -0
- package/{AnnotationPreview-DWRDhxUB.js → AnnotationPreview-CZr_CcZC.js} +2 -2
- package/ClueEnrichContext-DH9lqjwH.js +401 -0
- package/api/lookup/enrich.d.ts +3 -3
- package/components/AnnotationDetailPopover.js +7 -7
- package/components/AnnotationDetails.js +21 -155
- package/components/AnnotationEntry.js +26 -31
- package/components/AnnotationPreview.js +2 -2
- package/components/EnrichedCard.js +8 -8
- package/components/EnrichedChip.js +1 -1
- package/components/EnrichedTypography.js +1 -1
- package/components/actions/ActionForm.js +3 -3
- package/components/actions/ResultModal.js +1 -1
- package/components/display/graph/elements/NodeCard.js +2 -2
- package/components/display/graph/index.js +1 -1
- package/components/display/json/index.js +2 -2
- package/components/enrichment/EnrichPopover.js +5 -5
- package/components/fetchers/Fetcher.js +1 -1
- package/components/group/Entry.js +7 -7
- package/components/group/GroupControl.js +9 -9
- package/database/index.js +1 -1
- package/hooks/ClueActionContext.d.ts +1 -1
- package/hooks/ClueActionContext.js +3 -3
- package/hooks/ClueDatabaseContext.js +1 -1
- package/hooks/ClueEnrichContext.js +4 -4
- package/hooks/ClueFetcherContext.js +1 -1
- package/hooks/CluePopupContext.js +2 -2
- package/hooks/ClueProvider.js +3 -3
- package/hooks/selectors.js +2 -2
- package/hooks/useAnnotations.js +23 -27
- package/hooks/useClue.js +1 -1
- package/hooks/useClueActions.js +1 -1
- package/hooks/useClueTypeConfig.d.ts +2 -1
- package/hooks/useClueTypeConfig.js +2 -2
- package/hooks/useMyLocalStorage.js +28 -28
- package/icons/Action.js +7 -7
- package/icons/Assessment.js +13 -13
- package/icons/Context.js +7 -7
- package/icons/Opinion.js +12 -12
- package/{index-HuYhutsd.js → index-BUcHmehh.js} +1 -1
- package/{index-WvFmjbxF.js → index-Bo-v5IAc.js} +4764 -4744
- package/{index-4YFAh_sa.js → index-CnaCBNrd.js} +1 -1
- package/main.d.ts +0 -1
- package/main.js +53 -63
- package/package.json +1 -1
- package/text/Frequency.js +19 -19
- package/{useClueTypeConfig-BQ33EiyB.js → useClueTypeConfig-CneP98N_.js} +10 -23
- package/utils/classificationParser.d.ts +8 -8
- package/utils/classificationParser.js +63 -76
- package/utils/utils.js +2 -2
- package/{utils-C_RX5uMP.js → utils-CD0rFIFU.js} +11 -11
- package/ClueEnrichContext-CbJVBm4w.js +0 -397
- package/isUndefined-DiNCDKoz.js +0 -10
|
@@ -4,7 +4,7 @@ var y = (t, e, n) => Z(t, typeof e != "symbol" ? e + "" : e, n);
|
|
|
4
4
|
import { jsx as d, jsxs as M } from "react/jsx-runtime";
|
|
5
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
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-
|
|
7
|
+
import { r as ce, s as he, f as de } from "./utils-CD0rFIFU.js";
|
|
8
8
|
import { ClueComponentContext as D } from "./hooks/ClueComponentContext.js";
|
|
9
9
|
import { useMyLocalStorageItem as L } from "./hooks/useMyLocalStorage.js";
|
|
10
10
|
import { StorageKey as j } from "./utils/constants.js";
|
package/main.d.ts
CHANGED
|
@@ -37,6 +37,5 @@ import { default as OpinionIcon } from './icons/Opinion';
|
|
|
37
37
|
import { default as FrequencyText } from './text/Frequency';
|
|
38
38
|
|
|
39
39
|
export { ActionForm, AnnotationDetailPopover, AnnotationDetails, AnnotationEntry, AnnotationPreview, AssessmentIcon, buildDatabase, ClueComponentContext, ClueDatabaseContext, ClueEnrichContext, CluePopupContext, ClueProvider, ContextIcon, CountBadge, EnrichedCard, EnrichedChip, EnrichedTypography, Entry, Fetcher, FrequencyText, Group, GroupControl, OpinionIcon, SNACKBAR_EVENT_ID, SourcePicker, StatusChip, useClue, useClueActions, useClueActionsSelector, useClueEnrichSelector, useClueFetcherSelector };
|
|
40
|
-
export { ClueComponentContext as BorealisComponentContext, ClueDatabaseContext as BorealisDatabaseContext, ClueEnrichContext as BorealisEnrichContext, CluePopupContext as BorealisPopupContext, ClueProvider as BorealisProvider, useClue as useBorealis, useClueActions as useBorealisActions, useClueActionsSelector as useBorealisActionsSelector, useClueEnrichSelector as useBorealisEnrichSelector, useClueFetcherSelector as useBorealisFetcherSelector };
|
|
41
40
|
export type { ActionDefinition, ActionDefinitionsResponse, ActionResult, Annotation, BulkEnrichRequest, BulkEnrichResponses, ClueConfigContextProps, ClueDatabase, ClueDatabaseCollections, ClueDatabaseContextProps, ClueResponse, EnrichedCardProps, EnrichedTypographyProps, Enrichment, EnrichmentProps, EnrichResponse, EnrichResponses, FailedRequest, FetcherDefinition, FetcherDefinitionsResponse, FetcherResult, RunningActionData, Selector, SelectorCollection, SelectorCollectionMethods, SelectorDocMethods, SelectorDocType, SelectorDocument, SnackbarEvents, StatusCollection, StatusCollectionMethods, StatusDocMethods, StatusDocType, StatusDocument, TypesDetectionResponse, TypesResponse, WithExtra };
|
|
42
41
|
export type { ClueConfigContextProps as BorealisConfigContextProps, ClueDatabase as BorealisDatabase, ClueDatabaseCollections as BorealisDatabaseCollections, ClueDatabaseContextProps as BorealisDatabaseContextProps, ClueResponse as BorealisResponse };
|
package/main.js
CHANGED
|
@@ -1,70 +1,60 @@
|
|
|
1
|
-
import { A as t, u as r
|
|
2
|
-
import { default as
|
|
3
|
-
import {
|
|
1
|
+
import { A as t, u as r } from "./ActionForm-BtTv0s4P.js";
|
|
2
|
+
import { default as f } from "./components/AnnotationDetailPopover.js";
|
|
3
|
+
import { A as s } from "./AnnotationDetails-D5tBIeEw.js";
|
|
4
4
|
import { default as p } from "./components/AnnotationEntry.js";
|
|
5
|
-
import { A as
|
|
6
|
-
import { default as
|
|
7
|
-
import { default as
|
|
8
|
-
import { default as
|
|
9
|
-
import { default as
|
|
10
|
-
import { default as
|
|
11
|
-
import { default as
|
|
5
|
+
import { A as x, C as m } from "./AnnotationPreview-CZr_CcZC.js";
|
|
6
|
+
import { default as C } from "./components/CountBadge.js";
|
|
7
|
+
import { default as c } from "./components/EnrichedCard.js";
|
|
8
|
+
import { default as h } from "./components/EnrichedChip.js";
|
|
9
|
+
import { default as S } from "./components/EnrichedTypography.js";
|
|
10
|
+
import { default as D } from "./components/fetchers/Fetcher.js";
|
|
11
|
+
import { default as b } from "./components/fetchers/StatusChip.js";
|
|
12
12
|
import { default as I } from "./components/group/Entry.js";
|
|
13
|
-
import { default as
|
|
14
|
-
import { default as
|
|
15
|
-
import { default as
|
|
16
|
-
import { SNACKBAR_EVENT_ID as
|
|
17
|
-
import { b as
|
|
18
|
-
import { ClueComponentContext as
|
|
19
|
-
import { ClueDatabaseContext as
|
|
20
|
-
import { C as
|
|
21
|
-
import { ClueProvider as
|
|
22
|
-
import { useClueActionsSelector as
|
|
23
|
-
import { default as
|
|
24
|
-
import { default as
|
|
25
|
-
import { default as
|
|
26
|
-
import { default as
|
|
27
|
-
import { default as
|
|
13
|
+
import { default as T } from "./components/group/Group.js";
|
|
14
|
+
import { default as B } from "./components/group/GroupControl.js";
|
|
15
|
+
import { default as N } from "./components/SourcePicker.js";
|
|
16
|
+
import { SNACKBAR_EVENT_ID as k } from "./data/event.js";
|
|
17
|
+
import { b as w } from "./index-Bo-v5IAc.js";
|
|
18
|
+
import { ClueComponentContext as O } from "./hooks/ClueComponentContext.js";
|
|
19
|
+
import { ClueDatabaseContext as V } from "./hooks/ClueDatabaseContext.js";
|
|
20
|
+
import { C as z } from "./ClueEnrichContext-DH9lqjwH.js";
|
|
21
|
+
import { ClueProvider as J } from "./hooks/ClueProvider.js";
|
|
22
|
+
import { useClueActionsSelector as M, useClueEnrichSelector as Q, useClueFetcherSelector as U } from "./hooks/selectors.js";
|
|
23
|
+
import { default as X } from "./hooks/useClue.js";
|
|
24
|
+
import { default as Z } from "./icons/Assessment.js";
|
|
25
|
+
import { default as ee } from "./icons/Context.js";
|
|
26
|
+
import { default as te } from "./icons/Opinion.js";
|
|
27
|
+
import { default as ae } from "./text/Frequency.js";
|
|
28
28
|
export {
|
|
29
29
|
t as ActionForm,
|
|
30
|
-
|
|
31
|
-
|
|
30
|
+
f as AnnotationDetailPopover,
|
|
31
|
+
s as AnnotationDetails,
|
|
32
32
|
p as AnnotationEntry,
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
pe as ContextIcon,
|
|
46
|
-
d as CountBadge,
|
|
47
|
-
A as EnrichedCard,
|
|
48
|
-
E as EnrichedChip,
|
|
49
|
-
P as EnrichedTypography,
|
|
33
|
+
x as AnnotationPreview,
|
|
34
|
+
Z as AssessmentIcon,
|
|
35
|
+
O as ClueComponentContext,
|
|
36
|
+
V as ClueDatabaseContext,
|
|
37
|
+
z as ClueEnrichContext,
|
|
38
|
+
m as CluePopupContext,
|
|
39
|
+
J as ClueProvider,
|
|
40
|
+
ee as ContextIcon,
|
|
41
|
+
C as CountBadge,
|
|
42
|
+
c as EnrichedCard,
|
|
43
|
+
h as EnrichedChip,
|
|
44
|
+
S as EnrichedTypography,
|
|
50
45
|
I as Entry,
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
r as
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
ue as useClue,
|
|
66
|
-
a as useClueActions,
|
|
67
|
-
oe as useClueActionsSelector,
|
|
68
|
-
te as useClueEnrichSelector,
|
|
69
|
-
re as useClueFetcherSelector
|
|
46
|
+
D as Fetcher,
|
|
47
|
+
ae as FrequencyText,
|
|
48
|
+
T as Group,
|
|
49
|
+
B as GroupControl,
|
|
50
|
+
te as OpinionIcon,
|
|
51
|
+
k as SNACKBAR_EVENT_ID,
|
|
52
|
+
N as SourcePicker,
|
|
53
|
+
b as StatusChip,
|
|
54
|
+
w as buildDatabase,
|
|
55
|
+
X as useClue,
|
|
56
|
+
r as useClueActions,
|
|
57
|
+
M as useClueActionsSelector,
|
|
58
|
+
Q as useClueEnrichSelector,
|
|
59
|
+
U as useClueFetcherSelector
|
|
70
60
|
};
|
package/package.json
CHANGED
package/text/Frequency.js
CHANGED
|
@@ -1,30 +1,30 @@
|
|
|
1
1
|
import { jsx as c } from "react/jsx-runtime";
|
|
2
|
-
import { Typography as
|
|
3
|
-
import {
|
|
4
|
-
import { s as
|
|
5
|
-
import {
|
|
6
|
-
const
|
|
7
|
-
annotations:
|
|
8
|
-
value:
|
|
2
|
+
import { Typography as s } from "@mui/material";
|
|
3
|
+
import { i as t } from "../isNil-CjWwlQS3.js";
|
|
4
|
+
import { s as m } from "../sumBy-DxJUU2E8.js";
|
|
5
|
+
import { useMemo as i } from "react";
|
|
6
|
+
const q = ({
|
|
7
|
+
annotations: l,
|
|
8
|
+
value: u,
|
|
9
9
|
...e
|
|
10
10
|
}) => {
|
|
11
|
-
const n =
|
|
12
|
-
() =>
|
|
13
|
-
[
|
|
14
|
-
), r =
|
|
15
|
-
() => n.length > 0 ?
|
|
11
|
+
const n = i(
|
|
12
|
+
() => l.filter((o) => o.type === "frequency"),
|
|
13
|
+
[l]
|
|
14
|
+
), r = i(
|
|
15
|
+
() => n.length > 0 ? m(n, (o) => o.value) : null,
|
|
16
16
|
[n]
|
|
17
|
-
),
|
|
18
|
-
return
|
|
19
|
-
|
|
17
|
+
), f = i(() => t(r) ? null : r < 1 ? "error" : r < 1e3 ? "secondary" : r < 1e6 ? "disabled" : null, [r]);
|
|
18
|
+
return t(r) ? /* @__PURE__ */ c(s, { ...e, color: f, children: u }) : /* @__PURE__ */ c(
|
|
19
|
+
s,
|
|
20
20
|
{
|
|
21
21
|
...e,
|
|
22
|
-
color:
|
|
23
|
-
sx: { fontWeight: !
|
|
24
|
-
children:
|
|
22
|
+
color: f ?? e.color,
|
|
23
|
+
sx: { fontWeight: !t(r) && r < 10 ? "bold" : "inherit" },
|
|
24
|
+
children: u
|
|
25
25
|
}
|
|
26
26
|
);
|
|
27
27
|
};
|
|
28
28
|
export {
|
|
29
|
-
|
|
29
|
+
q as default
|
|
30
30
|
};
|
|
@@ -6,15 +6,9 @@ import { MY_LOCAL_STORAGE_PREFIX as Te, StorageKey as w } from "./utils/constant
|
|
|
6
6
|
import { g as un } from "./_commonjsHelpers-C6fGbg64.js";
|
|
7
7
|
import { getAxiosCache as ln, setAxiosCache as fn } from "./utils/sessionStorage.js";
|
|
8
8
|
import { clueDebugLogger as dn } from "./utils/loggerUtil.js";
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
|
|
12
|
-
return C(I(), "actions");
|
|
13
|
-
}
|
|
14
|
-
function mn(e) {
|
|
15
|
-
return B(De(), null, e);
|
|
16
|
-
}
|
|
17
|
-
function En(e, t, n, r = { timeout: null }, s) {
|
|
9
|
+
import { i as pn } from "./isEmpty-g47Qir2A.js";
|
|
10
|
+
import { useState as Xe, useEffect as hn } from "react";
|
|
11
|
+
const De = () => C(I(), "actions"), mn = (e) => B(De(), null, e), En = (e, t, n, r = { timeout: null }, s) => {
|
|
18
12
|
const i = [];
|
|
19
13
|
mt(r.timeout) || i.push(`max_timeout=${r.timeout}`);
|
|
20
14
|
const o = { ...n };
|
|
@@ -27,8 +21,7 @@ function En(e, t, n, r = { timeout: null }, s) {
|
|
|
27
21
|
o,
|
|
28
22
|
s
|
|
29
23
|
);
|
|
30
|
-
}
|
|
31
|
-
const yn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
24
|
+
}, yn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
32
25
|
__proto__: null,
|
|
33
26
|
get: mn,
|
|
34
27
|
post: En,
|
|
@@ -75,19 +68,14 @@ const An = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
75
68
|
get: _n,
|
|
76
69
|
post: Tn,
|
|
77
70
|
uri: Fe
|
|
78
|
-
}, Symbol.toStringTag, { value: "Module" }))
|
|
79
|
-
function gt() {
|
|
80
|
-
return C(de(), "enrich");
|
|
81
|
-
}
|
|
82
|
-
function Cn(e, t = [], n = { timeout: null, includeRaw: !1, noCache: !1 }, r) {
|
|
71
|
+
}, Symbol.toStringTag, { value: "Module" })), gt = () => C(de(), "enrich"), Cn = (e, t = [], n = { timeout: null, includeRaw: !1, noCache: !1 }, r) => {
|
|
83
72
|
const s = [];
|
|
84
73
|
return (t == null ? void 0 : t.length) > 0 && s.push(`sources=${t.join()}`), n.classification && s.push(`classification=${encodeURIComponent(n.classification)}`), mt(n.timeout) || s.push(`max_timeout=${n.timeout}`), n.includeRaw && s.push("include_raw=true"), n.noCache && s.push("no_cache=true"), ge(
|
|
85
74
|
C(gt(), "", s.length > 0 ? new URLSearchParams(s.join("&")) : null),
|
|
86
75
|
e,
|
|
87
76
|
r
|
|
88
77
|
);
|
|
89
|
-
}
|
|
90
|
-
const Nn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
78
|
+
}, Nn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
91
79
|
__proto__: null,
|
|
92
80
|
post: Cn,
|
|
93
81
|
uri: gt
|
|
@@ -2243,11 +2231,10 @@ const fe = (e) => `${Te}.${e}`, Y = (e) => {
|
|
|
2243
2231
|
cause: c
|
|
2244
2232
|
}
|
|
2245
2233
|
);
|
|
2246
|
-
}, B = (e, t, n = {}) => qe(e, "get", null, t, n), ge = (e, t, n = {}) => qe(e, "post", t, void 0, n)
|
|
2247
|
-
function eo(e, t, n, r, s) {
|
|
2234
|
+
}, B = (e, t, n = {}) => qe(e, "get", null, t, n), ge = (e, t, n = {}) => qe(e, "post", t, void 0, n), eo = (e, t, n, r, s) => {
|
|
2248
2235
|
const [i, o] = Xe([]), [c, d] = Xe({});
|
|
2249
|
-
return
|
|
2250
|
-
if (!e || (i == null ? void 0 : i.length) > 0 && !
|
|
2236
|
+
return hn(() => {
|
|
2237
|
+
if (!e || (i == null ? void 0 : i.length) > 0 && !pn(c))
|
|
2251
2238
|
return;
|
|
2252
2239
|
const l = {}, u = r == null ? void 0 : r();
|
|
2253
2240
|
u && (l.Authorization = `Bearer ${u}`), (async () => {
|
|
@@ -2265,7 +2252,7 @@ function eo(e, t, n, r, s) {
|
|
|
2265
2252
|
availableSources: i,
|
|
2266
2253
|
typesDetection: c
|
|
2267
2254
|
};
|
|
2268
|
-
}
|
|
2255
|
+
};
|
|
2269
2256
|
export {
|
|
2270
2257
|
Cs as a,
|
|
2271
2258
|
Cn as p,
|
|
@@ -126,10 +126,10 @@ type DisabledControls = {
|
|
|
126
126
|
export declare const defaultDisabled: DisabledControls;
|
|
127
127
|
export declare class InvalidClassification extends Error {
|
|
128
128
|
}
|
|
129
|
-
export declare
|
|
130
|
-
export declare
|
|
131
|
-
export declare
|
|
132
|
-
export declare
|
|
129
|
+
export declare const getLevelText: (lvl: number, c12nDef: ClassificationDefinition, format: FormatProp, isMobile: boolean) => string;
|
|
130
|
+
export declare const getParts: (c12n: string, c12nDef: ClassificationDefinition, format: FormatProp, isMobile: boolean) => ClassificationParts;
|
|
131
|
+
export declare const canSeeRequired: (user_req: string[], req: string[]) => boolean;
|
|
132
|
+
export declare const canSeeGroups: (user_groups: string[], groups: string[]) => boolean;
|
|
133
133
|
/**
|
|
134
134
|
* Normalize a given classification by applying the rules defined in the classification definition.
|
|
135
135
|
* This function will remove any invalid parts and add missing parts to the classification.
|
|
@@ -146,7 +146,7 @@ export declare function canSeeGroups(user_groups: string[], groups: string[]): b
|
|
|
146
146
|
* @returns A normalized version of the original classification
|
|
147
147
|
*
|
|
148
148
|
*/
|
|
149
|
-
export declare
|
|
149
|
+
export declare const normalizedClassification: (parts: ClassificationParts, c12nDef: ClassificationDefinition, format: FormatProp, isMobile: boolean, skipAutoSelect?: boolean) => string;
|
|
150
150
|
type ClassificationValidator = {
|
|
151
151
|
disabled: DisabledControls;
|
|
152
152
|
parts: ClassificationParts;
|
|
@@ -164,7 +164,7 @@ export declare const defaultClassificationValidator: ClassificationValidator;
|
|
|
164
164
|
* @returns The most restrictive classification that we could create out of the two
|
|
165
165
|
*
|
|
166
166
|
*/
|
|
167
|
-
export declare
|
|
167
|
+
export declare const applyClassificationRules: (parts: ClassificationParts, c12nDef: ClassificationDefinition, format: FormatProp, isMobile: boolean, userClassification?: boolean) => ClassificationValidator;
|
|
168
168
|
/**
|
|
169
169
|
* Mixes two classifications and returns to most restrictive form for them
|
|
170
170
|
*
|
|
@@ -177,7 +177,7 @@ export declare function applyClassificationRules(parts: ClassificationParts, c12
|
|
|
177
177
|
* @returns The most restrictive classification that we could create out of the two
|
|
178
178
|
*
|
|
179
179
|
*/
|
|
180
|
-
export declare
|
|
180
|
+
export declare const getMaxClassification: (c12n_1: string, c12n_2: string, c12nDef: ClassificationDefinition, format: FormatProp, isMobile: boolean) => string;
|
|
181
181
|
/**
|
|
182
182
|
*
|
|
183
183
|
* Given a user classification, check if a user is allow to see a certain classification
|
|
@@ -191,5 +191,5 @@ export declare function getMaxClassification(c12n_1: string, c12n_2: string, c12
|
|
|
191
191
|
* @returns True is the user can see the classification
|
|
192
192
|
*
|
|
193
193
|
*/
|
|
194
|
-
export declare
|
|
194
|
+
export declare const isAccessible: (user_c12n: string, c12n: string, c12nDef: ClassificationDefinition, enforce?: boolean, ignoreInvalid?: boolean) => boolean;
|
|
195
195
|
export {};
|
|
@@ -10,59 +10,56 @@ const E = {
|
|
|
10
10
|
};
|
|
11
11
|
class O extends Error {
|
|
12
12
|
}
|
|
13
|
-
|
|
13
|
+
const I = (i, s, o, p) => {
|
|
14
14
|
let u = null;
|
|
15
15
|
return s != null && i != null && (u = s.levels_map[i.toString()]), u === void 0 || u == null ? (console.error(
|
|
16
16
|
`[classificationParser] Classification level number '${i}' was not found in your classification definition.`
|
|
17
17
|
), "INVALID") : o === "long" && !p ? s.levels_map_stl[u] : u;
|
|
18
|
-
}
|
|
19
|
-
function T(i, s) {
|
|
18
|
+
}, T = (i, s) => {
|
|
20
19
|
let o = null;
|
|
21
20
|
const [p, u, r] = (i == null ? void 0 : i.split(/\/\/(.*)/)) ?? [null, null, null], a = p == null ? void 0 : p.toUpperCase();
|
|
22
21
|
return s.levels_map[a] !== void 0 ? o = s.levels_map[a] : s.levels_map_lts[a] !== void 0 ? o = s.levels_map[s.levels_map_lts[a]] : s.levels_aliases[a] !== void 0 ? o = s.levels_map[s.levels_aliases[a]] : (o = -1, console.error(
|
|
23
22
|
`[classificationParser] Classification level '${p}' was not found in your classification definition.`
|
|
24
23
|
)), typeof o != "number" && (o = parseInt(o)), [o, u];
|
|
25
|
-
}
|
|
26
|
-
function $(i, s, o, p) {
|
|
24
|
+
}, $ = (i, s, o, p) => {
|
|
27
25
|
const u = [], r = [];
|
|
28
26
|
if (!i)
|
|
29
27
|
return [u.sort(), r];
|
|
30
28
|
const a = i.toUpperCase().split("/");
|
|
31
|
-
for (const
|
|
32
|
-
if (
|
|
33
|
-
u.push(s.access_req_map_lts[
|
|
34
|
-
else if (
|
|
35
|
-
u.push(
|
|
36
|
-
else if (
|
|
37
|
-
for (const d of s.access_req_aliases[
|
|
29
|
+
for (const m of a)
|
|
30
|
+
if (m in s.access_req_map_lts)
|
|
31
|
+
u.push(s.access_req_map_lts[m]);
|
|
32
|
+
else if (m in s.access_req_map_stl)
|
|
33
|
+
u.push(m);
|
|
34
|
+
else if (m in s.access_req_aliases)
|
|
35
|
+
for (const d of s.access_req_aliases[m])
|
|
38
36
|
u.push(d);
|
|
39
37
|
else
|
|
40
|
-
r.push(
|
|
38
|
+
r.push(m);
|
|
41
39
|
if (o === "long" && !p) {
|
|
42
|
-
const
|
|
40
|
+
const m = [];
|
|
43
41
|
for (const d of u)
|
|
44
|
-
|
|
45
|
-
return [
|
|
42
|
+
m.push(s.access_req_map_stl[d]);
|
|
43
|
+
return [m.sort(), r];
|
|
46
44
|
}
|
|
47
45
|
return [u.sort(), r];
|
|
48
|
-
}
|
|
49
|
-
function U(i, s, o, p, u = !1) {
|
|
46
|
+
}, U = (i, s, o, p, u = !1) => {
|
|
50
47
|
var l, h, e, S;
|
|
51
|
-
let r = /* @__PURE__ */ new Set(), a = /* @__PURE__ */ new Set(),
|
|
48
|
+
let r = /* @__PURE__ */ new Set(), a = /* @__PURE__ */ new Set(), m = /* @__PURE__ */ new Set();
|
|
52
49
|
const d = [], _ = [];
|
|
53
50
|
for (const t of i) {
|
|
54
51
|
if (!t)
|
|
55
52
|
continue;
|
|
56
|
-
const
|
|
57
|
-
if (
|
|
58
|
-
const g = new Set(
|
|
53
|
+
const f = t.toUpperCase();
|
|
54
|
+
if (f.startsWith("REL ")) {
|
|
55
|
+
const g = new Set(f.replace("REL TO ", "").replace("REL ", "").split(","));
|
|
59
56
|
for (let c of g) {
|
|
60
57
|
c = c.trim();
|
|
61
58
|
for (let v of c.split("/"))
|
|
62
59
|
v = v.trim(), d.push(v);
|
|
63
60
|
}
|
|
64
61
|
} else
|
|
65
|
-
_.push(
|
|
62
|
+
_.push(f);
|
|
66
63
|
}
|
|
67
64
|
for (const t of d)
|
|
68
65
|
if (t in s.groups_map_lts)
|
|
@@ -70,36 +67,36 @@ function U(i, s, o, p, u = !1) {
|
|
|
70
67
|
else if (t in s.groups_map_stl)
|
|
71
68
|
r.add(t);
|
|
72
69
|
else if (t in s.groups_aliases)
|
|
73
|
-
for (const
|
|
74
|
-
r.add(
|
|
70
|
+
for (const f of s.groups_aliases[t])
|
|
71
|
+
r.add(f);
|
|
75
72
|
else
|
|
76
|
-
|
|
73
|
+
m.add(t);
|
|
77
74
|
for (const t of _)
|
|
78
75
|
if (t in s.subgroups_map_lts)
|
|
79
76
|
a.add(s.subgroups_map_lts[t]);
|
|
80
77
|
else if (t in s.subgroups_map_stl)
|
|
81
78
|
a.add(t);
|
|
82
79
|
else if (t in s.subgroups_aliases)
|
|
83
|
-
for (const
|
|
84
|
-
a.add(
|
|
80
|
+
for (const f of s.subgroups_aliases[t])
|
|
81
|
+
a.add(f);
|
|
85
82
|
else if (t in s.groups_aliases) {
|
|
86
|
-
const
|
|
87
|
-
|
|
83
|
+
const f = s.groups_aliases[t];
|
|
84
|
+
f.length > 1 && console.error(`[classificationParser] Unclear use of alias ${t}`), r.add(f[0]);
|
|
88
85
|
} else
|
|
89
86
|
r.add(t), console.error(`[classificationParser] Unknown component ${t}`);
|
|
90
87
|
if (s.dynamic_groups) {
|
|
91
|
-
for (const t of
|
|
88
|
+
for (const t of m)
|
|
92
89
|
r.add(t);
|
|
93
|
-
|
|
90
|
+
m = /* @__PURE__ */ new Set();
|
|
94
91
|
}
|
|
95
92
|
for (const t of a) {
|
|
96
|
-
const
|
|
97
|
-
|
|
93
|
+
const f = (h = (l = s.params_map) == null ? void 0 : l[t]) == null ? void 0 : h.require_group;
|
|
94
|
+
f && r.add(f);
|
|
98
95
|
}
|
|
99
96
|
for (const t of a) {
|
|
100
|
-
const
|
|
101
|
-
|
|
102
|
-
`[classificationParser] Subgroup ${t} is limited to group ${
|
|
97
|
+
const f = (S = (e = s.params_map) == null ? void 0 : e[t]) == null ? void 0 : S.limited_to_group;
|
|
98
|
+
f != null && (r.size > 1 || r.size === 1 && !r.has(f)) && console.error(
|
|
99
|
+
`[classificationParser] Subgroup ${t} is limited to group ${f} (found: ${Array.from(
|
|
103
100
|
r
|
|
104
101
|
).toString()})`
|
|
105
102
|
);
|
|
@@ -108,15 +105,14 @@ function U(i, s, o, p, u = !1) {
|
|
|
108
105
|
const t = [];
|
|
109
106
|
for (const g of r)
|
|
110
107
|
t.push(g in s.groups_map_stl ? s.groups_map_stl[g] : g);
|
|
111
|
-
const
|
|
108
|
+
const f = [];
|
|
112
109
|
for (const g of a)
|
|
113
|
-
|
|
114
|
-
return { groups: t.sort(), subgroups:
|
|
110
|
+
f.push(s.subgroups_map_stl[g]);
|
|
111
|
+
return { groups: t.sort(), subgroups: f.sort(), others: Array.from(m).sort() };
|
|
115
112
|
}
|
|
116
|
-
return { groups: Array.from(r).sort(), subgroups: Array.from(a).sort(), others: Array.from(
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
const [u, r] = T(i, s), [a, f] = $(r, s, o, p), { groups: d, subgroups: _, others: l } = U(f, s, o, p);
|
|
113
|
+
return { groups: Array.from(r).sort(), subgroups: Array.from(a).sort(), others: Array.from(m).sort() };
|
|
114
|
+
}, b = (i, s, o, p) => {
|
|
115
|
+
const [u, r] = T(i, s), [a, m] = $(r, s, o, p), { groups: d, subgroups: _, others: l } = U(m, s, o, p);
|
|
120
116
|
return l.length > 0 && console.error(`[classificationParser] Unparsable classification parts: ${l.join(",")}`), {
|
|
121
117
|
lvlIdx: u,
|
|
122
118
|
lvl: I(u, s, o, p),
|
|
@@ -124,27 +120,24 @@ function b(i, s, o, p) {
|
|
|
124
120
|
groups: d,
|
|
125
121
|
subgroups: _
|
|
126
122
|
};
|
|
127
|
-
}
|
|
128
|
-
function z(i, s) {
|
|
123
|
+
}, z = (i, s) => {
|
|
129
124
|
if (s.length <= 0) return !0;
|
|
130
125
|
const o = new Set(i), p = new Set(s);
|
|
131
126
|
for (const u of p)
|
|
132
127
|
if (!o.has(u))
|
|
133
128
|
return !1;
|
|
134
129
|
return !0;
|
|
135
|
-
}
|
|
136
|
-
function R(i, s) {
|
|
130
|
+
}, R = (i, s) => {
|
|
137
131
|
if (s.length === 0) return !0;
|
|
138
132
|
const o = new Set(s), p = new Set(i);
|
|
139
133
|
for (const u of o)
|
|
140
134
|
if (p.has(u))
|
|
141
135
|
return !0;
|
|
142
136
|
return !1;
|
|
143
|
-
}
|
|
144
|
-
function x(i, s, o, p, u = !1) {
|
|
137
|
+
}, x = (i, s, o, p, u = !1) => {
|
|
145
138
|
var v, w, y, L, A, C;
|
|
146
139
|
if (!s.enforce || s.invalid_mode) return s.UNRESTRICTED;
|
|
147
|
-
const r = !(o === "short" || p), a = r ? "REL TO " : "REL ", { lvlIdx:
|
|
140
|
+
const r = !(o === "short" || p), a = r ? "REL TO " : "REL ", { lvlIdx: m, lvl: d } = i;
|
|
148
141
|
let { groups: _, subgroups: l, req: h } = i;
|
|
149
142
|
h = h.map((n) => r ? s.access_req_map_stl[n] || n : s.access_req_map_lts[n] || n), _ = _.map((n) => r ? s.groups_map_stl[n] || n : s.groups_map_lts[n] || n), l = l.map((n) => r ? s.subgroups_map_stl[n] || n : s.subgroups_map_lts[n] || n);
|
|
150
143
|
let e = d, S = 0;
|
|
@@ -152,12 +145,12 @@ function x(i, s, o, p, u = !1) {
|
|
|
152
145
|
const q = (w = (v = s.params_map) == null ? void 0 : v[n]) != null && w.require_lvl ? s.params_map[n].require_lvl : 0;
|
|
153
146
|
S = Math.max(S, q);
|
|
154
147
|
}
|
|
155
|
-
e = I(Math.max(
|
|
148
|
+
e = I(Math.max(m, S), s, o, p);
|
|
156
149
|
const t = /* @__PURE__ */ new Set();
|
|
157
150
|
for (const n of h)
|
|
158
151
|
(y = s.params_map[n]) != null && y.is_required_group && t.add(n);
|
|
159
|
-
const
|
|
160
|
-
|
|
152
|
+
const f = Array.from(new Set([...h].filter((n) => !t.has(n))));
|
|
153
|
+
f.length > 0 && (e += "//" + f.sort().join("/")), t.size > 0 && (e += "//" + Array.from(t).sort().join("/"));
|
|
161
154
|
let g = [...l];
|
|
162
155
|
r ? l.length > 0 && s.subgroups_auto_select.length > 0 && !u && (g = Array.from(/* @__PURE__ */ new Set([...l, ...s.subgroups_auto_select])).sort()) : l.length > 0 && s.subgroups_auto_select_short.length > 0 && !u && (g = Array.from(/* @__PURE__ */ new Set([...l, ...s.subgroups_auto_select_short])).sort());
|
|
163
156
|
let c = [];
|
|
@@ -180,32 +173,29 @@ function x(i, s, o, p, u = !1) {
|
|
|
180
173
|
e += a + _.sort().join(", ");
|
|
181
174
|
}
|
|
182
175
|
return g.length > 0 && (_.length > 0 || t.size > 0 ? e += "/" : e += "//", e += g.sort().join("/")), e;
|
|
183
|
-
}
|
|
184
|
-
function j(i) {
|
|
176
|
+
}, j = (i) => {
|
|
185
177
|
const s = [];
|
|
186
178
|
for (const o in i.levels_map)
|
|
187
179
|
isNaN(parseInt(o)) || s.push(i.levels_map[o]);
|
|
188
180
|
return s;
|
|
189
|
-
}
|
|
190
|
-
const F = {
|
|
181
|
+
}, F = {
|
|
191
182
|
disabled: N,
|
|
192
183
|
parts: E
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
const r = !(o === "short" || p), a = {}, f = {}, d = {}, _ = ["req", "groups", "subgroups"], l = { ...i }, h = {
|
|
184
|
+
}, J = (i, s, o, p, u = !1) => {
|
|
185
|
+
const r = !(o === "short" || p), a = {}, m = {}, d = {}, _ = ["req", "groups", "subgroups"], l = { ...i }, h = {
|
|
196
186
|
levels: [],
|
|
197
187
|
groups: []
|
|
198
188
|
};
|
|
199
189
|
for (const e in s.params_map)
|
|
200
190
|
if ({}.hasOwnProperty.call(s.params_map, e)) {
|
|
201
191
|
const S = s.params_map[e];
|
|
202
|
-
"require_lvl" in S && (a[e] = S.require_lvl), "limited_to_group" in S && (
|
|
192
|
+
"require_lvl" in S && (a[e] = S.require_lvl), "limited_to_group" in S && (m[e] = S.limited_to_group), "require_group" in S && (d[e] = S.require_group);
|
|
203
193
|
}
|
|
204
194
|
for (const e in _)
|
|
205
195
|
if ({}.hasOwnProperty.call(_, e)) {
|
|
206
196
|
const S = l[_[e]];
|
|
207
197
|
for (const t of S) {
|
|
208
|
-
let
|
|
198
|
+
let f = !1;
|
|
209
199
|
if (t) {
|
|
210
200
|
if (t in a) {
|
|
211
201
|
l.lvlIdx < a[t] && (l.lvlIdx = a[t], l.lvl = I(a[t], s, o, p));
|
|
@@ -223,17 +213,17 @@ function J(i, s, o, p, u = !1) {
|
|
|
223
213
|
}
|
|
224
214
|
}
|
|
225
215
|
}
|
|
226
|
-
if (t in
|
|
216
|
+
if (t in m)
|
|
227
217
|
for (const g in s.groups_map_stl) {
|
|
228
|
-
const c = s.groups_map_lts[
|
|
218
|
+
const c = s.groups_map_lts[m[t]] || m[t];
|
|
229
219
|
if (g !== c) {
|
|
230
220
|
const v = s.groups_map_stl[g];
|
|
231
221
|
h.groups.push(g), l.groups.includes(g) ? l.groups.splice(l.groups.indexOf(g), 1) : l.groups.includes(v) && l.groups.splice(l.groups.indexOf(v), 1);
|
|
232
222
|
}
|
|
233
223
|
}
|
|
234
|
-
!u && _[e] === "groups" && (
|
|
224
|
+
!u && _[e] === "groups" && (f = !0);
|
|
235
225
|
}
|
|
236
|
-
if (
|
|
226
|
+
if (f)
|
|
237
227
|
for (const g of s.groups_auto_select) {
|
|
238
228
|
const c = s.groups_map_stl[g] || g, v = s.groups_map_lts[g] || g;
|
|
239
229
|
!l.groups.includes(c) && !l.groups.includes(v) && l.groups.push(g);
|
|
@@ -244,8 +234,7 @@ function J(i, s, o, p, u = !1) {
|
|
|
244
234
|
disabled: h,
|
|
245
235
|
parts: l
|
|
246
236
|
};
|
|
247
|
-
}
|
|
248
|
-
function G(i, s) {
|
|
237
|
+
}, G = (i, s) => {
|
|
249
238
|
let o = /* @__PURE__ */ new Set();
|
|
250
239
|
if (i.length > 0 && s.length > 0) {
|
|
251
240
|
const p = new Set(s);
|
|
@@ -255,8 +244,7 @@ function G(i, s) {
|
|
|
255
244
|
return i.length > 0 && s.length > 0 && o.size <= 0 && (o = /* @__PURE__ */ new Set([...i, ...s]), console.error(
|
|
256
245
|
`[classificationParser] Could not find any intersection between the groups. ${i.toString()} & ${s.toString()}`
|
|
257
246
|
)), Array.from(o);
|
|
258
|
-
}
|
|
259
|
-
function V(i, s, o, p, u) {
|
|
247
|
+
}, V = (i, s, o, p, u) => {
|
|
260
248
|
if (!o.enforce || o.invalid_mode) {
|
|
261
249
|
const e = b(o.UNRESTRICTED, o, p, u);
|
|
262
250
|
return x(e, o, p, u);
|
|
@@ -266,16 +254,15 @@ function V(i, s, o, p, u) {
|
|
|
266
254
|
return x(a, o, p, u);
|
|
267
255
|
if (!s)
|
|
268
256
|
return x(r, o, p, u);
|
|
269
|
-
const
|
|
257
|
+
const m = Array.from(/* @__PURE__ */ new Set([...r.req, ...a.req])), d = G(r.groups, a.groups), _ = G(r.subgroups, a.subgroups), l = Math.max(r.lvlIdx, a.lvlIdx), h = {
|
|
270
258
|
lvlIdx: l,
|
|
271
259
|
lvl: I(l, o, p, u),
|
|
272
|
-
req:
|
|
260
|
+
req: m,
|
|
273
261
|
groups: d,
|
|
274
262
|
subgroups: _
|
|
275
263
|
};
|
|
276
264
|
return x(h, o, p, u);
|
|
277
|
-
}
|
|
278
|
-
function W(i, s, o, p = !1, u = !0) {
|
|
265
|
+
}, W = (i, s, o, p = !1, u = !0) => {
|
|
279
266
|
if (o.invalid_mode) return !1;
|
|
280
267
|
if (!p || !s) return !0;
|
|
281
268
|
try {
|
|
@@ -286,7 +273,7 @@ function W(i, s, o, p = !1, u = !0) {
|
|
|
286
273
|
return !1;
|
|
287
274
|
throw r;
|
|
288
275
|
}
|
|
289
|
-
}
|
|
276
|
+
};
|
|
290
277
|
export {
|
|
291
278
|
O as InvalidClassification,
|
|
292
279
|
J as applyClassificationRules,
|
package/utils/utils.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { d as m, b as o, r as i, s as p, t as c } from "../utils-
|
|
2
|
-
import "../isEmpty-g47Qir2A.js";
|
|
1
|
+
import { d as m, b as o, r as i, s as p, t as c } from "../utils-CD0rFIFU.js";
|
|
3
2
|
import "../_Map-DXNg_Z-q.js";
|
|
3
|
+
import "../isEmpty-g47Qir2A.js";
|
|
4
4
|
import "../isNil-CjWwlQS3.js";
|
|
5
5
|
export {
|
|
6
6
|
m as delay,
|