pi-mega-compact 0.18.0 → 0.19.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.
- package/assets/vector-cortex/encoder-v1/manifest.json +1 -0
- package/assets/vector-cortex/encoder-v1/model-card.json +1 -0
- package/assets/vector-cortex/encoder-v1/model.onnx +0 -0
- package/assets/vector-cortex/encoder-v1/tokenizer.json +1 -0
- package/dist/config/vector-cortex.js +18 -0
- package/dist/config.js +117 -0
- package/dist/extensions/dashboard-server/routes-rag-settings-helpers.js +4 -0
- package/dist/extensions/dashboard-server/routes-vector-cortex.js +89 -1
- package/dist/log.js +47 -0
- package/dist/src/config/vector-cortex.js +18 -0
- package/dist/src/config.js +1 -1
- package/dist/src/vector-cortex/encoder/calibrate.js +174 -0
- package/dist/src/vector-cortex/encoder/emit-vc2b.js +63 -0
- package/dist/src/vector-cortex/encoder/emit-vc2c.js +59 -0
- package/dist/src/vector-cortex/encoder/fallback.js +62 -0
- package/dist/src/vector-cortex/encoder/heads.js +113 -0
- package/dist/src/vector-cortex/encoder/lexical.js +104 -0
- package/dist/src/vector-cortex/encoder/router.js +115 -0
- package/dist/src/vector-cortex/encoder/select.js +172 -0
- package/dist/src/vector-cortex/encoder/trigram.js +75 -0
- package/dist/src/vector-cortex/encoder/types.js +84 -0
- package/dist/vector-cortex/encoder/calibrate.js +174 -0
- package/dist/vector-cortex/encoder/emit-vc2b.js +63 -0
- package/dist/vector-cortex/encoder/emit-vc2c.js +59 -0
- package/dist/vector-cortex/encoder/fallback.js +62 -0
- package/dist/vector-cortex/encoder/heads.js +113 -0
- package/dist/vector-cortex/encoder/lexical.js +104 -0
- package/dist/vector-cortex/encoder/router.js +115 -0
- package/dist/vector-cortex/encoder/select.js +172 -0
- package/dist/vector-cortex/encoder/trigram.js +75 -0
- package/dist/vector-cortex/encoder/types.js +84 -0
- package/extensions/dashboard-client/dist/assets/{AreaChart-BQXFF7UI.js → AreaChart-DywU5SSt.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{AreaChart-BQXFF7UI.js.map → AreaChart-DywU5SSt.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{BarChart-BVtoz9Eg.js → BarChart-But7WN6K.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{BarChart-BVtoz9Eg.js.map → BarChart-But7WN6K.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{CacheTab-trI2TIGy.js → CacheTab-7aZWa1DR.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{CacheTab-trI2TIGy.js.map → CacheTab-7aZWa1DR.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{EventsTab-CNUbk9__.js → EventsTab-Bf_boNG2.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{EventsTab-CNUbk9__.js.map → EventsTab-Bf_boNG2.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{HealthTab-K-bd_CM-.js → HealthTab-AbGc1nXP.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{HealthTab-K-bd_CM-.js.map → HealthTab-AbGc1nXP.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{MaintenanceTab-CoEioKzx.js → MaintenanceTab-BfHHhn5F.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{MaintenanceTab-CoEioKzx.js.map → MaintenanceTab-BfHHhn5F.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{MemoryMapTab-CJo24ulv.js → MemoryMapTab-DrcWti0-.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{MemoryMapTab-CJo24ulv.js.map → MemoryMapTab-DrcWti0-.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{MetricsTab-DCNlQWWP.js → MetricsTab-ALiglXQq.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{MetricsTab-DCNlQWWP.js.map → MetricsTab-ALiglXQq.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{OverviewTab-CQQlyIQ6.js → OverviewTab-nnaJdNyR.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{OverviewTab-CQQlyIQ6.js.map → OverviewTab-nnaJdNyR.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{ReposTab-Cqm82_yn.js → ReposTab-BTK0nofM.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{ReposTab-Cqm82_yn.js.map → ReposTab-BTK0nofM.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{SessionsTab-A8xTAdET.js → SessionsTab-RXPNqO6x.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{SessionsTab-A8xTAdET.js.map → SessionsTab-RXPNqO6x.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{SetupTab-CqaSgaZl.js → SetupTab-Dab0AVfs.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{SetupTab-CqaSgaZl.js.map → SetupTab-Dab0AVfs.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{TimeSavedCard-C_f3q8GR.js → TimeSavedCard-DIVG8hdt.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{TimeSavedCard-C_f3q8GR.js.map → TimeSavedCard-DIVG8hdt.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{TurnsTab-BEsafACo.js → TurnsTab-9uz2fBwx.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{TurnsTab-BEsafACo.js.map → TurnsTab-9uz2fBwx.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{VectorCortexTab-DD1CMK80.js → VectorCortexTab-DnKY61EJ.js} +2 -2
- package/extensions/dashboard-client/dist/assets/VectorCortexTab-DnKY61EJ.js.map +1 -0
- package/extensions/dashboard-client/dist/assets/{WikiTab-Bf01M2_Z.js → WikiTab-CpcgaggS.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{WikiTab-Bf01M2_Z.js.map → WikiTab-CpcgaggS.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{button-BEJPTk_E.js → button-B0Q2fuKY.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{button-BEJPTk_E.js.map → button-B0Q2fuKY.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{card-DK1V382s.js → card-Cnik3TFr.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{card-DK1V382s.js.map → card-Cnik3TFr.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{generateCategoricalChart-CRtaPphL.js → generateCategoricalChart-DrSwgn1V.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{generateCategoricalChart-CRtaPphL.js.map → generateCategoricalChart-DrSwgn1V.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{index-CB6BslE4.js → index-DraytcOY.js} +3 -3
- package/extensions/dashboard-client/dist/assets/{index-CB6BslE4.js.map → index-DraytcOY.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{switch-C4FV6B9k.js → switch-DVQ1aB9b.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{switch-C4FV6B9k.js.map → switch-DVQ1aB9b.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{toggle-GBmeENMd.js → toggle-Dkppx-49.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{toggle-GBmeENMd.js.map → toggle-Dkppx-49.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{useSSE-BOKZGSn1.js → useSSE-CPkjU4Gx.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{useSSE-BOKZGSn1.js.map → useSSE-CPkjU4Gx.js.map} +1 -1
- package/extensions/dashboard-client/dist/index.html +1 -1
- package/extensions/dashboard-client/src/tabs/VectorCortexTab.tsx +2 -0
- package/extensions/dashboard-client/src/types/vector-cortex.ts +11 -0
- package/extensions/dashboard-server/api-contracts/vector-cortex.ts +11 -0
- package/extensions/dashboard-server/routes-rag-settings-helpers.ts +14 -0
- package/extensions/dashboard-server/routes-vector-cortex.ts +108 -1
- package/package.json +2 -1
- package/src/config/vector-cortex.ts +20 -0
- package/src/config.ts +2 -0
- package/src/vector-cortex/encoder/calibrate.ts +225 -0
- package/src/vector-cortex/encoder/emit-vc2b.ts +82 -0
- package/src/vector-cortex/encoder/emit-vc2c.ts +70 -0
- package/src/vector-cortex/encoder/fallback.ts +99 -0
- package/src/vector-cortex/encoder/heads.ts +142 -0
- package/src/vector-cortex/encoder/lexical.ts +123 -0
- package/src/vector-cortex/encoder/router.ts +163 -0
- package/src/vector-cortex/encoder/select.ts +237 -0
- package/src/vector-cortex/encoder/trigram.ts +85 -0
- package/src/vector-cortex/encoder/types.ts +226 -0
- package/extensions/dashboard-client/dist/assets/VectorCortexTab-DD1CMK80.js.map +0 -1
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* vector-cortex/encoder/lexical.ts — VC2B mode C: token/phrase lexical encoder.
|
|
3
|
+
*
|
|
4
|
+
* Lexical C is a token/phrase lexical feature generator used when both mode A
|
|
5
|
+
* (learned asset) and mode B (trigram) are unavailable or fail. It is continuity,
|
|
6
|
+
* NOT semantic completeness: C operates on exact current tokens/phrases only and
|
|
7
|
+
* MUST state that it has lost old semantic context (task 4 + TRIAD_RESILIENCE.
|
|
8
|
+
* "C is continuity, not semantic completeness: it may omit old context and must
|
|
9
|
+
* report that limitation").
|
|
10
|
+
*
|
|
11
|
+
* C never imports the learned asset or learned calibration (task 4): it is a
|
|
12
|
+
* pure token/phrase lexical projection (token counts + phrase hashes) computed
|
|
13
|
+
* from the exact input. It is independently implemented from B (which hashes
|
|
14
|
+
* byte-level trigrams) — C works at the token/phrase level, B at the byte-ngram
|
|
15
|
+
* level, so the two share no algorithm.
|
|
16
|
+
*
|
|
17
|
+
* Authority outage freezes derived high-water: C never advances any derived
|
|
18
|
+
* frontier; it is purely a local reconstruction from the exact present tokens.
|
|
19
|
+
*
|
|
20
|
+
* Pi-agnostic, zero network (PREVENT-PI-004), no `any` (PREVENT-011).
|
|
21
|
+
*/
|
|
22
|
+
import { createHash } from "node:crypto";
|
|
23
|
+
import { l2Normalize } from "./heads.js";
|
|
24
|
+
import { createEncoderHeadsReporter, } from "./emit-vc2b.js";
|
|
25
|
+
/** Fixed output width of lexical C. */
|
|
26
|
+
export const ENCODER_LEXICAL_WIDTH = 256;
|
|
27
|
+
/** The documented limitation lexical C reports (continuity, not semantics). */
|
|
28
|
+
export const ENCODER_LEXICAL_LIMITATION = "lexical C: token/phrase-level continuity only; old semantic context is omitted";
|
|
29
|
+
export function tokenizeLexical(text) {
|
|
30
|
+
// Split into lowercase token/phrase units on non-alphanumeric boundaries.
|
|
31
|
+
return text.toLowerCase().split(/[^a-z0-9_]+/).filter((t) => t.length > 0);
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Normalize a single token/phrase unit the same way `tokenizeLexical` does for
|
|
35
|
+
* the string form: lowercase and strip leading/trailing non-alphanumeric runs.
|
|
36
|
+
* Applied to array-form tokens so both accepted input forms of `embedLexical`
|
|
37
|
+
* hash identical conceptual content to identical buckets, regardless of how the
|
|
38
|
+
* caller chose to pass it (code-review Q03).
|
|
39
|
+
*/
|
|
40
|
+
function normalizeToken(tok) {
|
|
41
|
+
return tok.toLowerCase().split(/[^a-z0-9_]+/).join("");
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Resolve either accepted input form to a normalized token sequence: the string
|
|
45
|
+
* form routes through `tokenizeLexical` (split on non-alphanumeric boundaries,
|
|
46
|
+
* fragmented tokens discarded); the array form applies the same per-token
|
|
47
|
+
* lowercase/strip normalization and drops tokens that normalize to empty. Both
|
|
48
|
+
* paths therefore agree on hash buckets for the same conceptual content.
|
|
49
|
+
*/
|
|
50
|
+
function resolveTokens(tokensOrText) {
|
|
51
|
+
if (typeof tokensOrText === "string")
|
|
52
|
+
return tokenizeLexical(tokensOrText);
|
|
53
|
+
const out = [];
|
|
54
|
+
for (const raw of tokensOrText) {
|
|
55
|
+
const norm = normalizeToken(raw);
|
|
56
|
+
if (norm.length > 0)
|
|
57
|
+
out.push(norm);
|
|
58
|
+
}
|
|
59
|
+
return out;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Encode a token/phrase sequence into a 256-dim L2-normalized lexical vector
|
|
63
|
+
* (all-zero on empty input). Features: exact token count + token id-hash sums +
|
|
64
|
+
* phrase-adjacency hashes. Deterministic (repeat drift == 0). Pure local compute.
|
|
65
|
+
*/
|
|
66
|
+
export function embedLexical(tokensOrText) {
|
|
67
|
+
const width = ENCODER_LEXICAL_WIDTH;
|
|
68
|
+
const out = new Float32Array(width);
|
|
69
|
+
const tokens = resolveTokens(tokensOrText);
|
|
70
|
+
for (let i = 0; i < tokens.length; i++) {
|
|
71
|
+
const tok = tokens[i];
|
|
72
|
+
const h = createHash("sha256").update(`t:${tok}`).digest();
|
|
73
|
+
const bucket = h.readUInt32BE(0) % width;
|
|
74
|
+
const weight = (h.readUInt32BE(4) / 4294967295) * 2 - 1;
|
|
75
|
+
out[bucket] += weight;
|
|
76
|
+
// Phrase adjacency: bigram hash blended in so semantic-free ordering matters.
|
|
77
|
+
if (i > 0) {
|
|
78
|
+
const pair = createHash("sha256").update(`p:${tokens[i - 1]}:${tok}`).digest();
|
|
79
|
+
const pb = pair.readUInt32BE(0) % width;
|
|
80
|
+
const pw = (pair.readUInt32BE(4) / 4294967295) * 2 - 1;
|
|
81
|
+
out[pb] += pw;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
return l2Normalize(out);
|
|
85
|
+
}
|
|
86
|
+
/** The documented limitation string, surfaced when lexical C is selected. */
|
|
87
|
+
export function selectLexicalC(options = {}) {
|
|
88
|
+
const reporter = options.reporter ?? createEncoderHeadsReporter();
|
|
89
|
+
const selection = {
|
|
90
|
+
ok: true,
|
|
91
|
+
mode: "C",
|
|
92
|
+
dim: ENCODER_LEXICAL_WIDTH,
|
|
93
|
+
width: ENCODER_LEXICAL_WIDTH,
|
|
94
|
+
limitation: ENCODER_LEXICAL_LIMITATION,
|
|
95
|
+
};
|
|
96
|
+
reporter.fallbackSelected({
|
|
97
|
+
mode: selection.mode,
|
|
98
|
+
dim: selection.dim,
|
|
99
|
+
width: selection.width,
|
|
100
|
+
limitation: selection.limitation,
|
|
101
|
+
});
|
|
102
|
+
return selection;
|
|
103
|
+
}
|
|
104
|
+
export { l2Normalize };
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* vector-cortex/encoder/router.ts — VC2B encode-or-fallback router (S2).
|
|
3
|
+
*
|
|
4
|
+
* The single production seam that catches a real VC2A `load()` failure and
|
|
5
|
+
* hands off to the independently initialized VC2B fallbacks:
|
|
6
|
+
*
|
|
7
|
+
* - mode A: the learned multi-head projection — an EncoderRuntime that
|
|
8
|
+
* verifies+loads a local qualified ONNX (VC2A) plus `encodeVectorSet`
|
|
9
|
+
* producing VectorSetV1, emitting `vector_cortex_encoder_heads_emitted`;
|
|
10
|
+
* - when that `load()` fails for ANY reason (removed model ->
|
|
11
|
+
* ENC_ASSET_UNREADABLE, digest mismatch -> ENC_DIGEST_MISMATCH, missing
|
|
12
|
+
* manifest -> ENC_MANIFEST_INVALID, unsupported platform, RSS over budget,
|
|
13
|
+
* ...) the router catches the real failure and selects the independently
|
|
14
|
+
* initialized asset-free trigram B (`selectTrigramBFallback`) — or lexical C
|
|
15
|
+
* when the runtime reports B-unavailable / the caller forces mode C. The
|
|
16
|
+
* `vector_cortex_encoder_fallback_selected` event fires from the REAL
|
|
17
|
+
* producer seam, not test wiring (task 5 + code-review S1).
|
|
18
|
+
*
|
|
19
|
+
* Best-effort and non-fatal: every branch returns an explicit verdict and never
|
|
20
|
+
* throws across the boundary into the agent loop. Flag-OFF parity: with
|
|
21
|
+
* `MEGACOMPACT_VC2B=0` the VC2B reporter is a no-op (zero emissions), and the
|
|
22
|
+
* mode-A path is governed by the VC2A runtime itself — the router only adds the
|
|
23
|
+
* fallback handoff and changes no producer bytes.
|
|
24
|
+
*
|
|
25
|
+
* Pi-agnostic, zero network (PREVENT-PI-004), no `any` (PREVENT-011).
|
|
26
|
+
*/
|
|
27
|
+
import { createEncoderRuntime } from "./runtime.js";
|
|
28
|
+
import { encodeVectorSet } from "./heads.js";
|
|
29
|
+
import { embedTrigram512, selectTrigramBFallback } from "./trigram.js";
|
|
30
|
+
import { embedLexical, selectLexicalC } from "./lexical.js";
|
|
31
|
+
import { createEncoderHeadsReporter } from "./emit-vc2b.js";
|
|
32
|
+
import { ENC_FAIL, } from "./types.js";
|
|
33
|
+
/** Deterministic text derived from an int token sequence so the asset-free
|
|
34
|
+
* fallback producers operate on the same authority the learned path encoded. */
|
|
35
|
+
function textFromTokens(tokens) {
|
|
36
|
+
return tokens.join("-");
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Try to produce an encoding for an input token sequence. Mode A: verify+load
|
|
40
|
+
* the local learned asset via the EncoderRuntime; on a real `load()` failure
|
|
41
|
+
* (removed model, digest mismatch, missing manifest, ...) the router catches it
|
|
42
|
+
* and selects the independently initialized trigram B or lexical C, emitting
|
|
43
|
+
* `vector_cortex_encoder_fallback_selected` (and `heads_emitted` when A wins).
|
|
44
|
+
*/
|
|
45
|
+
export function encodeOrFallback(input, assetDir, options = {}) {
|
|
46
|
+
const reporter = options.reporter ?? createEncoderHeadsReporter();
|
|
47
|
+
const tokens = Array.isArray(input?.tokens) ? input.tokens : [];
|
|
48
|
+
const runtime = options.runtime ?? createEncoderRuntime();
|
|
49
|
+
// A caller that explicitly forces a fallback mode wins even over the empty-
|
|
50
|
+
// input degenerate case: the forced-mode contract must hold for ANY input, so
|
|
51
|
+
// handle forceFallback before the empty-input selection below (Q02). A forced
|
|
52
|
+
// B/C is NOT a rollback and NOT a demotion — it is an intentional selection
|
|
53
|
+
// for capacity/testing — so the verdict carries `code: null`, never
|
|
54
|
+
// ENC_FAIL.ROLLBACK, so a consumer that reads `verdict.code` as "what
|
|
55
|
+
// triggered the fallback" won't misread a deliberately forced mode as a
|
|
56
|
+
// rollback and take rollback-specific action (code-review Q04).
|
|
57
|
+
if (options.forceFallback !== undefined) {
|
|
58
|
+
if (options.forceFallback === "C") {
|
|
59
|
+
const sel = selectLexicalC({ reporter });
|
|
60
|
+
const vector = embedLexical(textFromTokens(tokens));
|
|
61
|
+
return { ok: true, mode: "C", vector, width: sel.width, limitation: sel.limitation, code: null };
|
|
62
|
+
}
|
|
63
|
+
const sel = selectTrigramBFallback({ reporter });
|
|
64
|
+
const vector = embedTrigram512(textFromTokens(tokens));
|
|
65
|
+
return { ok: true, mode: "B", vector, width: sel.width, limitation: null, code: null };
|
|
66
|
+
}
|
|
67
|
+
// Empty input yields the asset-free fallback (finite, deterministic zero
|
|
68
|
+
// vector, ENC-ZERO-002). This is legitimate degenerate behavior, NOT a shape
|
|
69
|
+
// failure, so the verdict carries no failure code (code === null) — a consumer
|
|
70
|
+
// that interprets `code` as "what went wrong" must not misread a valid all-zero
|
|
71
|
+
// B vector as a shape rejection (Q05). Only reached when no mode is forced, so
|
|
72
|
+
// a forced B/C is never subverted by empty tokens.
|
|
73
|
+
if (tokens.length === 0) {
|
|
74
|
+
const sel = selectTrigramBFallback({ reporter });
|
|
75
|
+
const vector = embedTrigram512("");
|
|
76
|
+
return { ok: true, mode: "B", vector, width: sel.width, limitation: null, code: null };
|
|
77
|
+
}
|
|
78
|
+
// Mode A attempt — reached only when no mode is forced (the forceFallback
|
|
79
|
+
// guard at the top already returned), so `options.forceFallback` is undefined here.
|
|
80
|
+
const loaded = runtime.load(assetDir);
|
|
81
|
+
if (!loaded.ok) {
|
|
82
|
+
return fallbackFromLoad(loaded, reporter, tokens);
|
|
83
|
+
}
|
|
84
|
+
// Q01/Q03: a qualified mode-A load is not enough — the verified per-manifest
|
|
85
|
+
// token capacity (maxTokens, <= global 512) must also be enforced before we
|
|
86
|
+
// produce a VectorSetV1. run inference over the input; an over-cap sequence
|
|
87
|
+
// (e.g. 100 tokens against a verified maxTokens=64 manifest) or an
|
|
88
|
+
// over-budget inference is rejected here and routed to the B/C fallback with
|
|
89
|
+
// the real failure code, rather than silently emitting an ok:true mode-A
|
|
90
|
+
// set whose inputTokens breach the model's declared capacity.
|
|
91
|
+
const inferred = runtime.infer({ tokens });
|
|
92
|
+
if (!inferred.ok) {
|
|
93
|
+
return fallbackFromLoad({ ok: false, mode: "B", code: inferred.code }, reporter, tokens);
|
|
94
|
+
}
|
|
95
|
+
const vectorSet = encodeVectorSet(tokens, { reporter, seed: options.seed });
|
|
96
|
+
return { ok: true, mode: "A", vectorSet, code: null };
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Catch a (real or forced) A load failure (ok === false only) and select the
|
|
100
|
+
* B/C fallback that emits `vector_cortex_encoder_fallback_selected` from the
|
|
101
|
+
* production seam. The parameter is narrowed to the failed-load variant because
|
|
102
|
+
* the router hands off here only on a non-A/failed load — a qualified mode-A
|
|
103
|
+
* success never reaches this function (Q04).
|
|
104
|
+
*/
|
|
105
|
+
function fallbackFromLoad(loaded, reporter, tokens) {
|
|
106
|
+
if (loaded.mode === "C") {
|
|
107
|
+
const sel = selectLexicalC({ reporter });
|
|
108
|
+
const vector = embedLexical(textFromTokens(tokens));
|
|
109
|
+
return { ok: true, mode: "C", vector, width: sel.width, limitation: sel.limitation, code: loaded.code };
|
|
110
|
+
}
|
|
111
|
+
const sel = selectTrigramBFallback({ reporter });
|
|
112
|
+
const vector = embedTrigram512(textFromTokens(tokens));
|
|
113
|
+
return { ok: true, mode: "B", vector, width: sel.width, limitation: null, code: loaded.code };
|
|
114
|
+
}
|
|
115
|
+
export { ENC_FAIL };
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* vector-cortex/encoder/select.ts — VC2C atomic qualification selection (task 3).
|
|
3
|
+
*
|
|
4
|
+
* Selects mode A (a `QualifiedEncoderV1`) ONLY when EVERY MODEL_ASSET
|
|
5
|
+
* constraint AND every per-head EVALUATION threshold passes — the eligibility
|
|
6
|
+
* check is ATOMIC: any single failed field demotes the ENTIRE candidate to
|
|
7
|
+
* mode B/C (never a partial A). The failed field is reported so the caller/UI
|
|
8
|
+
* can inspect which threshold tripped.
|
|
9
|
+
*
|
|
10
|
+
* - asset fields (MODEL_ASSET §qualification): maxTokens <= 512, p95 latency
|
|
11
|
+
* <= 40 ms, encoder RSS delta <= 150 MiB. When an asset field fails, the
|
|
12
|
+
* demotion code is `ENC_QUALIFICATION_ASSET_FAILED`; per-head / reconstruction
|
|
13
|
+
* failures report `ENC_QUALIFICATION_THRESHOLD_FAILED`. Either way the check is
|
|
14
|
+
* atomic — the field that tripped is surfaced via `failedField`.
|
|
15
|
+
* - per-head EVALUATION thresholds (EVALUATION.md §metrics):
|
|
16
|
+
* semantic spearman >= .75, recall@10 >= .90
|
|
17
|
+
* dependency precision >= .97, recall >= .95
|
|
18
|
+
* contradiction precision >= .98, recall >= .90, ECE <= .05
|
|
19
|
+
* cacheStability precision >= .999, recall >= .90
|
|
20
|
+
* payloadRouting macro-F1 >= .97, exact/anchor recall = 1.0
|
|
21
|
+
* - reconstruction: zero causal/tool/anchor/exact violations, dependency
|
|
22
|
+
* closure recall = 1.0, task-success non-inferior to C.
|
|
23
|
+
*
|
|
24
|
+
* Unique failure injection: when a candidate supplies an expected
|
|
25
|
+
* `qualificationManifestDigest` (the digest of the qualification manifest
|
|
26
|
+
* sealed at calibration time) and the presented calibration digest differs,
|
|
27
|
+
* selection returns ENC_QUALIFICATION_DIGEST_MISMATCH and demotes A — the
|
|
28
|
+
* "corrupt qualification manifest after calibration but before selection" case.
|
|
29
|
+
*
|
|
30
|
+
* Emits `vector_cortex_encoder_qualification_passed` on success and
|
|
31
|
+
* `vector_cortex_encoder_qualification_demoted` on any demotion, via the
|
|
32
|
+
* flag-gated VC2C reporter. Pi-agnostic, zero network (PREVENT-PI-004), no
|
|
33
|
+
* `any` (PREVENT-011).
|
|
34
|
+
*/
|
|
35
|
+
import { createHash } from "node:crypto";
|
|
36
|
+
import { ENC_QUALIFICATION_FAIL, EVALUATION_THRESHOLDS, } from "./types.js";
|
|
37
|
+
import { createEncoderQualificationReporter, } from "./emit-vc2c.js";
|
|
38
|
+
/** Canonical digest over a CalibrationV1's stable identity (split digest, heads,
|
|
39
|
+
* temps, thresholds, seed) — the "qualification manifest digest". */
|
|
40
|
+
export function qualificationManifestDigest(calibration) {
|
|
41
|
+
const payload = JSON.stringify({
|
|
42
|
+
headOrder: [...calibration.headOrder].sort(),
|
|
43
|
+
splitDigest: calibration.calibrationSplitDigest,
|
|
44
|
+
temps: calibration.temperatures,
|
|
45
|
+
thresholds: calibration.thresholds,
|
|
46
|
+
seed: calibration.seed,
|
|
47
|
+
});
|
|
48
|
+
return createHash("sha256").update(payload).digest("hex");
|
|
49
|
+
}
|
|
50
|
+
/** True when one per-head metric row clears its normative EVALUATION threshold. */
|
|
51
|
+
function headPasses(head, m) {
|
|
52
|
+
switch (head) {
|
|
53
|
+
case "semantic":
|
|
54
|
+
return m.semantic.spearman >= EVALUATION_THRESHOLDS.semantic.spearman &&
|
|
55
|
+
m.semantic.recallAt10 >= EVALUATION_THRESHOLDS.semantic.recallAt10;
|
|
56
|
+
case "dependency":
|
|
57
|
+
return m.dependency.precision >= EVALUATION_THRESHOLDS.dependency.precision &&
|
|
58
|
+
m.dependency.recall >= EVALUATION_THRESHOLDS.dependency.recall;
|
|
59
|
+
case "contradiction":
|
|
60
|
+
return m.contradiction.precision >= EVALUATION_THRESHOLDS.contradiction.precision &&
|
|
61
|
+
m.contradiction.recall >= EVALUATION_THRESHOLDS.contradiction.recall &&
|
|
62
|
+
m.contradiction.ece <= EVALUATION_THRESHOLDS.contradiction.ece;
|
|
63
|
+
case "cacheStability":
|
|
64
|
+
return m.cacheStability.precision >= EVALUATION_THRESHOLDS.cacheStability.precision &&
|
|
65
|
+
m.cacheStability.recall >= EVALUATION_THRESHOLDS.cacheStability.recall;
|
|
66
|
+
case "payloadRouting":
|
|
67
|
+
return m.payloadRouting.macroF1 >= EVALUATION_THRESHOLDS.payloadRouting.macroF1 &&
|
|
68
|
+
m.payloadRouting.exactAnchorRecall >= EVALUATION_THRESHOLDS.payloadRouting.exactAnchorRecall;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
function reconstructionPasses(m) {
|
|
72
|
+
return (m.reconstruction.votesOk &&
|
|
73
|
+
m.reconstruction.dependencyClosureRecall >= EVALUATION_THRESHOLDS.reconstruction.dependencyClosureRecall &&
|
|
74
|
+
m.reconstruction.taskSuccessNonInferior);
|
|
75
|
+
}
|
|
76
|
+
function assetPasses(a, failed) {
|
|
77
|
+
let ok = true;
|
|
78
|
+
if (a.maxTokens > EVALUATION_THRESHOLDS.asset.maxTokens) {
|
|
79
|
+
failed.push("asset.maxTokens");
|
|
80
|
+
ok = false;
|
|
81
|
+
}
|
|
82
|
+
if (a.latencyP95Ms > EVALUATION_THRESHOLDS.asset.maxLatencyP95Ms) {
|
|
83
|
+
failed.push("asset.latencyP95Ms");
|
|
84
|
+
ok = false;
|
|
85
|
+
}
|
|
86
|
+
if (a.rssDeltaMib > EVALUATION_THRESHOLDS.asset.maxRssDeltaMib) {
|
|
87
|
+
failed.push("asset.rssDeltaMib");
|
|
88
|
+
ok = false;
|
|
89
|
+
}
|
|
90
|
+
return ok;
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Atomic eligibility check across every MODEL_ASSET + per-head EVALUATION
|
|
94
|
+
* threshold (task 3). Any single failed field demotes ALL of A (returns
|
|
95
|
+
* `ok:false`); there is no partial qualification. On success returns a
|
|
96
|
+
* `QualifiedEncoderV1` pinning asset/calibration digests + held-out evidence.
|
|
97
|
+
*/
|
|
98
|
+
export function selectQualifiedEncoder(candidate, options = {}) {
|
|
99
|
+
const reporter = options.reporter ?? createEncoderQualificationReporter();
|
|
100
|
+
// Unique failure injection: corrupt qualification manifest between calibration
|
|
101
|
+
// and selection. The sealed manifest digest must match the presented
|
|
102
|
+
// calibration's digest; a mismatch demotes A to B/C with the dedicated code.
|
|
103
|
+
if (candidate.expectedQualificationManifestDigest !== undefined) {
|
|
104
|
+
const presented = qualificationManifestDigest(candidate.calibration);
|
|
105
|
+
if (presented !== candidate.expectedQualificationManifestDigest) {
|
|
106
|
+
reporter.qualificationDemoted({
|
|
107
|
+
reason: ENC_QUALIFICATION_FAIL.DIGEST_MISMATCH,
|
|
108
|
+
modelVersion: candidate.modelVersion,
|
|
109
|
+
mode: "B",
|
|
110
|
+
});
|
|
111
|
+
return {
|
|
112
|
+
ok: false,
|
|
113
|
+
mode: "B",
|
|
114
|
+
code: ENC_QUALIFICATION_FAIL.DIGEST_MISMATCH,
|
|
115
|
+
failedField: "qualificationManifestDigest",
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
// Atomic: collect EVERY failed field across asset + all heads + reconstruction.
|
|
120
|
+
const failed = [];
|
|
121
|
+
assetPasses(candidate.asset, failed);
|
|
122
|
+
const heads = ["semantic", "dependency", "contradiction", "cacheStability", "payloadRouting"];
|
|
123
|
+
for (const h of heads) {
|
|
124
|
+
if (!headPasses(h, candidate.heldOut))
|
|
125
|
+
failed.push(`head.${h}`);
|
|
126
|
+
}
|
|
127
|
+
if (!reconstructionPasses(candidate.heldOut))
|
|
128
|
+
failed.push("reconstruction");
|
|
129
|
+
if (failed.length > 0) {
|
|
130
|
+
// Any failed field demotes all of A — no partial A. Route the demotion code
|
|
131
|
+
// by the failed-field class: an asset-field failure (maxTokens/latency/RSS)
|
|
132
|
+
// reports ENC_QUALIFICATION_ASSET_FAILED; a per-head/reconstruction failure
|
|
133
|
+
// reports ENC_QUALIFICATION_THRESHOLD_FAILED. `failedField` always carries the
|
|
134
|
+
// specific field that tripped, so the code + field together fully identify it.
|
|
135
|
+
const assetFailed = failed.some((f) => f.startsWith("asset."));
|
|
136
|
+
const code = assetFailed
|
|
137
|
+
? ENC_QUALIFICATION_FAIL.ASSET_FAILED
|
|
138
|
+
: ENC_QUALIFICATION_FAIL.THRESHOLD_FAILED;
|
|
139
|
+
reporter.qualificationDemoted({
|
|
140
|
+
reason: code,
|
|
141
|
+
failed: failed.join("/"),
|
|
142
|
+
modelVersion: candidate.modelVersion,
|
|
143
|
+
mode: "B",
|
|
144
|
+
});
|
|
145
|
+
return {
|
|
146
|
+
ok: false,
|
|
147
|
+
mode: "B",
|
|
148
|
+
code,
|
|
149
|
+
failedField: failed[0] ?? null,
|
|
150
|
+
};
|
|
151
|
+
}
|
|
152
|
+
const qualified = {
|
|
153
|
+
schema: "qualified-encoder-v1",
|
|
154
|
+
modelVersion: candidate.modelVersion,
|
|
155
|
+
mode: "A",
|
|
156
|
+
// The REAL ModelManifestV1 asset-manifest digest (passed through the
|
|
157
|
+
// candidate), not a calibration-derived hash — matches the documented
|
|
158
|
+
// contract and the dashboard health card's encoderAssetDigest.
|
|
159
|
+
assetDigest: candidate.assetManifestDigest,
|
|
160
|
+
calibrationDigest: candidate.calibration.calibrationSplitDigest,
|
|
161
|
+
onnxDigest: candidate.onnxDigest,
|
|
162
|
+
heldOut: candidate.heldOut,
|
|
163
|
+
calibration: candidate.calibration,
|
|
164
|
+
};
|
|
165
|
+
reporter.qualificationPassed({
|
|
166
|
+
modelVersion: candidate.modelVersion,
|
|
167
|
+
mode: "A",
|
|
168
|
+
assetDigest: qualified.assetDigest.slice(0, 12),
|
|
169
|
+
calibrationDigest: qualified.calibrationDigest.slice(0, 12),
|
|
170
|
+
});
|
|
171
|
+
return { ok: true, mode: "A", qualified, code: null };
|
|
172
|
+
}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* vector-cortex/encoder/trigram.ts — VC2B mode B: asset-free trigram encoder.
|
|
3
|
+
*
|
|
4
|
+
* Trigram B is a deterministic, asset-free (no learned model, no manifest, no
|
|
5
|
+
* calibration) 512-dim fixed feature encoding of a token/phrase sequence. It is
|
|
6
|
+
* the mode-B fallback selected when the learned asset (mode A) is removed,
|
|
7
|
+
* missing, unsupported, or digest-bad — and it never imports the learned asset
|
|
8
|
+
* or learned calibration (task 4). It derives directly from textual authority:
|
|
9
|
+
* the same document hashed via its byte-level trigrams yields the same 512-dim
|
|
10
|
+
* vector regardless of the asset state.
|
|
11
|
+
*
|
|
12
|
+
* Width is fixed at `ENCODER_TRIGRAM_WIDTH = 512` (VC2B task 4 "trigram B at 512
|
|
13
|
+
* dimensions"). The vector is L2-normalized; a zero-norm (empty) input maps to
|
|
14
|
+
* the all-zero vector, matching the heads convention of the VectorSet.
|
|
15
|
+
*
|
|
16
|
+
* Failure-triad independence: B's algorithm/index is distinct from A (learned
|
|
17
|
+
* projections) and C (token/phrase lexical) — it is a deterministic hashed
|
|
18
|
+
* n-gram bag-of-hashes, computed purely in-process with no external asset.
|
|
19
|
+
*
|
|
20
|
+
* Pi-agnostic, zero network (PREVENT-PI-004), no `any` (PREVENT-011).
|
|
21
|
+
*/
|
|
22
|
+
import { createHash } from "node:crypto";
|
|
23
|
+
import { l2Normalize } from "./heads.js";
|
|
24
|
+
import { createEncoderHeadsReporter, } from "./emit-vc2b.js";
|
|
25
|
+
/** Fixed output width of trigram B (VC2B task 4). */
|
|
26
|
+
export const ENCODER_TRIGRAM_WIDTH = 512;
|
|
27
|
+
/** Tokenize a phrase into byte-level trigrams (3-byte sliding windows). For a
|
|
28
|
+
* short phrase with fewer than 3 bytes we still emit the available shingles. */
|
|
29
|
+
function trigrams(text) {
|
|
30
|
+
const bytes = Buffer.from(text, "utf8");
|
|
31
|
+
if (bytes.length === 0)
|
|
32
|
+
return [];
|
|
33
|
+
const out = [];
|
|
34
|
+
const n = bytes.length;
|
|
35
|
+
// `Math.max(1, n - 2)` already emits a single whole-string shingle for 1- and
|
|
36
|
+
// 2-byte phrases (slice(0,3) covers the whole buffer), so there is NO separate
|
|
37
|
+
// short-phrase block — adding one would hash the same shingle twice (Q05).
|
|
38
|
+
for (let i = 0; i < Math.max(1, n - 2); i++) {
|
|
39
|
+
const chunk = bytes.slice(i, i + 3);
|
|
40
|
+
out.push(chunk.toString("hex"));
|
|
41
|
+
}
|
|
42
|
+
return out;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Encode a phrase into a 512-dim L2-normalized trigram vector (all-zero on
|
|
46
|
+
* empty input). Deterministic: the same text always yields the same vector
|
|
47
|
+
* (repeat drift == 0) — no asset, no calibration, no network.
|
|
48
|
+
*/
|
|
49
|
+
export function embedTrigram512(text) {
|
|
50
|
+
const width = ENCODER_TRIGRAM_WIDTH;
|
|
51
|
+
const out = new Float32Array(width);
|
|
52
|
+
// Feistel-style double hashing of each trigram into a bucket index + weight.
|
|
53
|
+
for (const tg of trigrams(text)) {
|
|
54
|
+
const h1 = createHash("sha256").update(tg).digest();
|
|
55
|
+
const bucket = h1.readUInt32BE(0) % width;
|
|
56
|
+
const weight = (h1.readUInt32BE(4) / 4294967295) * 2 - 1;
|
|
57
|
+
out[bucket] += weight;
|
|
58
|
+
}
|
|
59
|
+
return l2Normalize(out);
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* The 512-dim vector is produced even when the learned asset is absent: this is
|
|
63
|
+
* the mode-B selection point. Returns `{ ok: true, dim, width }` always — there
|
|
64
|
+
* is no asset to consult (task 4 + ENC-FALLBACK-003). Selecting mode B also
|
|
65
|
+
* emits `vector_cortex_encoder_fallback_selected` via the flag-gated reporter
|
|
66
|
+
* (task 5) — the production seam that makes the fallback event live in the
|
|
67
|
+
* runtime, not dead test-only wiring.
|
|
68
|
+
*/
|
|
69
|
+
export function selectTrigramBFallback(options = {}) {
|
|
70
|
+
const reporter = options.reporter ?? createEncoderHeadsReporter();
|
|
71
|
+
const selection = { ok: true, mode: "B", dim: ENCODER_TRIGRAM_WIDTH, width: ENCODER_TRIGRAM_WIDTH };
|
|
72
|
+
reporter.fallbackSelected({ mode: selection.mode, dim: selection.dim, width: selection.width });
|
|
73
|
+
return selection;
|
|
74
|
+
}
|
|
75
|
+
export { l2Normalize };
|
|
@@ -83,3 +83,87 @@ export const ENC_IDS = [
|
|
|
83
83
|
"ENC-007",
|
|
84
84
|
"ENC-008",
|
|
85
85
|
];
|
|
86
|
+
// ---------------------------------------------------------------------------
|
|
87
|
+
// VC2B — multi-head encoder (VectorSetV1 / HeadCalibrationDraft).
|
|
88
|
+
// ---------------------------------------------------------------------------
|
|
89
|
+
/** The five independent projection heads in STABLE order (MODEL_ASSET
|
|
90
|
+
* §decision record; VC2B task 2 "stable order"). The array order is the
|
|
91
|
+
* normative ordering consumed by consumers: semantic, dependency,
|
|
92
|
+
* contradiction, cache-stability, payload-routing. */
|
|
93
|
+
export const ENCODER_HEAD_ORDER = [
|
|
94
|
+
"semantic",
|
|
95
|
+
"dependency",
|
|
96
|
+
"contradiction",
|
|
97
|
+
"cacheStability",
|
|
98
|
+
"payloadRouting",
|
|
99
|
+
];
|
|
100
|
+
/** The ordered per-head output dimensions: semantic 384, dependency 128,
|
|
101
|
+
* contradiction 128, cacheStability 64, payloadRouting 32 (VC2B task 2). */
|
|
102
|
+
export const ENCODER_HEAD_DIMS = {
|
|
103
|
+
semantic: 384,
|
|
104
|
+
dependency: 128,
|
|
105
|
+
contradiction: 128,
|
|
106
|
+
cacheStability: 64,
|
|
107
|
+
payloadRouting: 32,
|
|
108
|
+
};
|
|
109
|
+
/** Ordered dimension list matching ENCODER_HEAD_ORDER (384/128/128/64/32). */
|
|
110
|
+
export const ENCODER_HEAD_DIM_ORDER = ENCODER_HEAD_ORDER.map((h) => ENCODER_HEAD_DIMS[h]);
|
|
111
|
+
/**
|
|
112
|
+
* Weighted training losses per head (MODEL_ASSET §data/losses/calibration):
|
|
113
|
+
* semantic .35, dependency .20, contradiction .20, cache .15, payload .10.
|
|
114
|
+
* These are normative (VC2B task 3: "losses exactly .35/.20/.20/.15/.10").
|
|
115
|
+
*/
|
|
116
|
+
export const ENCODER_HEAD_LOSS_WEIGHTS = {
|
|
117
|
+
semantic: 0.35,
|
|
118
|
+
dependency: 0.2,
|
|
119
|
+
contradiction: 0.2,
|
|
120
|
+
cacheStability: 0.15,
|
|
121
|
+
payloadRouting: 0.1,
|
|
122
|
+
};
|
|
123
|
+
/** Sum of the five loss weights must be exactly 1.0 (asserted in tests). */
|
|
124
|
+
export const ENCODER_HEAD_LOSS_SUM = 1.0;
|
|
125
|
+
/** Deterministic seed shared by Python/NumPy training and ONNX export (VC2B
|
|
126
|
+
* task 3: "seed ... at 1729"). */
|
|
127
|
+
export const ENCODER_SEED = 1729;
|
|
128
|
+
/** The 16 registered VC2B conformance IDs (task 1: "register ENC-009..016"). */
|
|
129
|
+
export const ENC2B_IDS = [
|
|
130
|
+
"ENC-009",
|
|
131
|
+
"ENC-010",
|
|
132
|
+
"ENC-011",
|
|
133
|
+
"ENC-012",
|
|
134
|
+
"ENC-013",
|
|
135
|
+
"ENC-014",
|
|
136
|
+
"ENC-015",
|
|
137
|
+
"ENC-016",
|
|
138
|
+
];
|
|
139
|
+
/** Normative per-head + asset qualification thresholds (MODEL_ASSET §qualification
|
|
140
|
+
* + EVALUATION.md §metrics). These are the constants `select.ts` evaluates the
|
|
141
|
+
* candidate's held-out metrics against (task 3 atomic check). */
|
|
142
|
+
export const EVALUATION_THRESHOLDS = {
|
|
143
|
+
semantic: { spearman: 0.75, recallAt10: 0.9 },
|
|
144
|
+
dependency: { precision: 0.97, recall: 0.95 },
|
|
145
|
+
contradiction: { precision: 0.98, recall: 0.9, ece: 0.05 },
|
|
146
|
+
cacheStability: { precision: 0.999, recall: 0.9 },
|
|
147
|
+
payloadRouting: { macroF1: 0.97, exactAnchorRecall: 1.0 },
|
|
148
|
+
reconstruction: { dependencyClosureRecall: 1.0 },
|
|
149
|
+
asset: { maxTokens: 512, maxLatencyP95Ms: 40, maxRssDeltaMib: 150 },
|
|
150
|
+
};
|
|
151
|
+
/** VC2C-specific qualification failure codes (returned, never thrown). */
|
|
152
|
+
export const ENC_QUALIFICATION_FAIL = {
|
|
153
|
+
/** The qualification manifest hash does not match the calibration that was fit
|
|
154
|
+
* (corrupt qualification manifest after calibration before selection). */
|
|
155
|
+
DIGEST_MISMATCH: "ENC_QUALIFICATION_DIGEST_MISMATCH",
|
|
156
|
+
/** One or more per-head EVALUATION thresholds failed (demotes all of A). */
|
|
157
|
+
THRESHOLD_FAILED: "ENC_QUALIFICATION_THRESHOLD_FAILED",
|
|
158
|
+
/** An asset-field qualification check (asset/latency/RSS) failed. */
|
|
159
|
+
ASSET_FAILED: "ENC_QUALIFICATION_ASSET_FAILED",
|
|
160
|
+
/** Calibration was attempted using held-out labels (fit prohibition). */
|
|
161
|
+
HELD_OUT_IN_FIT: "ENC_QUALIFICATION_HELD_OUT_IN_FIT",
|
|
162
|
+
};
|
|
163
|
+
/** The 4 registered VC2C conformance IDs (task 1: "register ENC-017..020"). */
|
|
164
|
+
export const ENC2C_IDS = [
|
|
165
|
+
"ENC-017",
|
|
166
|
+
"ENC-018",
|
|
167
|
+
"ENC-019",
|
|
168
|
+
"ENC-020",
|
|
169
|
+
];
|
package/extensions/dashboard-client/dist/assets/{AreaChart-BQXFF7UI.js → AreaChart-DywU5SSt.js}
RENAMED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{b as R,c as W,m as T,i as C,d as F,A as ie,e as B,h as q,j as oe,k as G,l as se,n as le,u as ue,o as K,G as ce,p as J,q as Q,D as fe,g as pe,X as he,Y as de,f as me}from"./generateCategoricalChart-CRtaPphL.js";import{R as p,F as ee,r as ve}from"./index-CB6BslE4.js";var ye=["layout","type","stroke","connectNulls","isRange","ref"],be=["key"],te;function M(e){"@babel/helpers - typeof";return M=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},M(e)}function ae(e,t){if(e==null)return{};var r=Ae(e,t),a,n;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)a=i[n],!(t.indexOf(a)>=0)&&Object.prototype.propertyIsEnumerable.call(e,a)&&(r[a]=e[a])}return r}function Ae(e,t){if(e==null)return{};var r={};for(var a in e)if(Object.prototype.hasOwnProperty.call(e,a)){if(t.indexOf(a)>=0)continue;r[a]=e[a]}return r}function D(){return D=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var a in r)Object.prototype.hasOwnProperty.call(r,a)&&(e[a]=r[a])}return e},D.apply(this,arguments)}function U(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter(function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable})),r.push.apply(r,a)}return r}function S(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?U(Object(r),!0).forEach(function(a){E(e,a,r[a])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):U(Object(r)).forEach(function(a){Object.defineProperty(e,a,Object.getOwnPropertyDescriptor(r,a))})}return e}function ge(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Z(e,t){for(var r=0;r<t.length;r++){var a=t[r];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,ne(a.key),a)}}function xe(e,t,r){return t&&Z(e.prototype,t),r&&Z(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function Pe(e,t,r){return t=$(t),Oe(e,re()?Reflect.construct(t,r||[],$(e).constructor):t.apply(e,r))}function Oe(e,t){if(t&&(M(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Ee(e)}function Ee(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function re(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(re=function(){return!!e})()}function $(e){return $=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},$(e)}function we(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&X(e,t)}function X(e,t){return X=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(a,n){return a.__proto__=n,a},X(e,t)}function E(e,t,r){return t=ne(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function ne(e){var t=_e(e,"string");return M(t)=="symbol"?t:t+""}function _e(e,t){if(M(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var a=r.call(e,t);if(M(a)!="object")return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}var L=function(e){function t(){var r;ge(this,t);for(var a=arguments.length,n=new Array(a),i=0;i<a;i++)n[i]=arguments[i];return r=Pe(this,t,[].concat(n)),E(r,"state",{isAnimationFinished:!0}),E(r,"id",ue("recharts-area-")),E(r,"handleAnimationEnd",function(){var o=r.props.onAnimationEnd;r.setState({isAnimationFinished:!0}),K(o)&&o()}),E(r,"handleAnimationStart",function(){var o=r.props.onAnimationStart;r.setState({isAnimationFinished:!1}),K(o)&&o()}),r}return we(t,e),xe(t,[{key:"renderDots",value:function(a,n,i){var o=this.props.isAnimationActive,s=this.state.isAnimationFinished;if(o&&!s)return null;var u=this.props,l=u.dot,f=u.points,c=u.dataKey,h=R(this.props,!1),A=R(l,!0),g=f.map(function(v,O){var y=S(S(S({key:"dot-".concat(O),r:3},h),A),{},{index:O,cx:v.x,cy:v.y,dataKey:c,value:v.value,payload:v.payload,points:f});return t.renderDotItem(l,y)}),x={clipPath:a?"url(#clipPath-".concat(n?"":"dots-").concat(i,")"):null};return p.createElement(W,D({className:"recharts-area-dots"},x),g)}},{key:"renderHorizontalRect",value:function(a){var n=this.props,i=n.baseLine,o=n.points,s=n.strokeWidth,u=o[0].x,l=o[o.length-1].x,f=a*Math.abs(u-l),c=T(o.map(function(h){return h.y||0}));return C(i)&&typeof i=="number"?c=Math.max(i,c):i&&Array.isArray(i)&&i.length&&(c=Math.max(T(i.map(function(h){return h.y||0})),c)),C(c)?p.createElement("rect",{x:u<l?u:u-f,y:0,width:f,height:Math.floor(c+(s?parseInt("".concat(s),10):1))}):null}},{key:"renderVerticalRect",value:function(a){var n=this.props,i=n.baseLine,o=n.points,s=n.strokeWidth,u=o[0].y,l=o[o.length-1].y,f=a*Math.abs(u-l),c=T(o.map(function(h){return h.x||0}));return C(i)&&typeof i=="number"?c=Math.max(i,c):i&&Array.isArray(i)&&i.length&&(c=Math.max(T(i.map(function(h){return h.x||0})),c)),C(c)?p.createElement("rect",{x:0,y:u<l?u:u-f,width:c+(s?parseInt("".concat(s),10):1),height:Math.floor(f)}):null}},{key:"renderClipRect",value:function(a){var n=this.props.layout;return n==="vertical"?this.renderVerticalRect(a):this.renderHorizontalRect(a)}},{key:"renderAreaStatically",value:function(a,n,i,o){var s=this.props,u=s.layout,l=s.type,f=s.stroke,c=s.connectNulls,h=s.isRange;s.ref;var A=ae(s,ye);return p.createElement(W,{clipPath:i?"url(#clipPath-".concat(o,")"):null},p.createElement(F,D({},R(A,!0),{points:a,connectNulls:c,type:l,baseLine:n,layout:u,stroke:"none",className:"recharts-area-area"})),f!=="none"&&p.createElement(F,D({},R(this.props,!1),{className:"recharts-area-curve",layout:u,type:l,connectNulls:c,fill:"none",points:a})),f!=="none"&&h&&p.createElement(F,D({},R(this.props,!1),{className:"recharts-area-curve",layout:u,type:l,connectNulls:c,fill:"none",points:n})))}},{key:"renderAreaWithAnimation",value:function(a,n){var i=this,o=this.props,s=o.points,u=o.baseLine,l=o.isAnimationActive,f=o.animationBegin,c=o.animationDuration,h=o.animationEasing,A=o.animationId,g=this.state,x=g.prevPoints,v=g.prevBaseLine;return p.createElement(ie,{begin:f,duration:c,isActive:l,easing:h,from:{t:0},to:{t:1},key:"area-".concat(A),onAnimationEnd:this.handleAnimationEnd,onAnimationStart:this.handleAnimationStart},function(O){var y=O.t;if(x){var _=x.length/s.length,d=s.map(function(P,N){var k=Math.floor(N*_);if(x[k]){var j=x[k],I=B(j.x,P.x),V=B(j.y,P.y);return S(S({},P),{},{x:I(y),y:V(y)})}return P}),m;if(C(u)&&typeof u=="number"){var b=B(v,u);m=b(y)}else if(q(u)||oe(u)){var w=B(v,0);m=w(y)}else m=u.map(function(P,N){var k=Math.floor(N*_);if(v[k]){var j=v[k],I=B(j.x,P.x),V=B(j.y,P.y);return S(S({},P),{},{x:I(y),y:V(y)})}return P});return i.renderAreaStatically(d,m,a,n)}return p.createElement(W,null,p.createElement("defs",null,p.createElement("clipPath",{id:"animationClipPath-".concat(n)},i.renderClipRect(y))),p.createElement(W,{clipPath:"url(#animationClipPath-".concat(n,")")},i.renderAreaStatically(s,u,a,n)))})}},{key:"renderArea",value:function(a,n){var i=this.props,o=i.points,s=i.baseLine,u=i.isAnimationActive,l=this.state,f=l.prevPoints,c=l.prevBaseLine,h=l.totalLength;return u&&o&&o.length&&(!f&&h>0||!G(f,o)||!G(c,s))?this.renderAreaWithAnimation(a,n):this.renderAreaStatically(o,s,a,n)}},{key:"render",value:function(){var a,n=this.props,i=n.hide,o=n.dot,s=n.points,u=n.className,l=n.top,f=n.left,c=n.xAxis,h=n.yAxis,A=n.width,g=n.height,x=n.isAnimationActive,v=n.id;if(i||!s||!s.length)return null;var O=this.state.isAnimationFinished,y=s.length===1,_=ee("recharts-area",u),d=c&&c.allowDataOverflow,m=h&&h.allowDataOverflow,b=d||m,w=q(v)?this.id:v,P=(a=R(o,!1))!==null&&a!==void 0?a:{r:3,strokeWidth:2},N=P.r,k=N===void 0?3:N,j=P.strokeWidth,I=j===void 0?2:j,V=se(o)?o:{},Y=V.clipDot,H=Y===void 0?!0:Y,z=k*2+I;return p.createElement(W,{className:_},d||m?p.createElement("defs",null,p.createElement("clipPath",{id:"clipPath-".concat(w)},p.createElement("rect",{x:d?f:f-A/2,y:m?l:l-g/2,width:d?A:A*2,height:m?g:g*2})),!H&&p.createElement("clipPath",{id:"clipPath-dots-".concat(w)},p.createElement("rect",{x:f-z/2,y:l-z/2,width:A+z,height:g+z}))):null,y?null:this.renderArea(b,w),(o||y)&&this.renderDots(b,H,w),(!x||O)&&le.renderCallByParent(this.props,s))}}],[{key:"getDerivedStateFromProps",value:function(a,n){return a.animationId!==n.prevAnimationId?{prevAnimationId:a.animationId,curPoints:a.points,curBaseLine:a.baseLine,prevPoints:n.curPoints,prevBaseLine:n.curBaseLine}:a.points!==n.curPoints||a.baseLine!==n.curBaseLine?{curPoints:a.points,curBaseLine:a.baseLine}:null}}])}(ve.PureComponent);te=L;E(L,"displayName","Area");E(L,"defaultProps",{stroke:"#3182bd",fill:"#3182bd",fillOpacity:.6,xAxisId:0,yAxisId:0,legendType:"line",connectNulls:!1,points:[],dot:!1,activeDot:!0,hide:!1,isAnimationActive:!ce.isSsr,animationBegin:0,animationDuration:1500,animationEasing:"ease"});E(L,"getBaseValue",function(e,t,r,a){var n=e.layout,i=e.baseValue,o=t.props.baseValue,s=o??i;if(C(s)&&typeof s=="number")return s;var u=n==="horizontal"?a:r,l=u.scale.domain();if(u.type==="number"){var f=Math.max(l[0],l[1]),c=Math.min(l[0],l[1]);return s==="dataMin"?c:s==="dataMax"||f<0?f:Math.max(Math.min(l[0],l[1]),0)}return s==="dataMin"?l[0]:s==="dataMax"?l[1]:l[0]});E(L,"getComposedData",function(e){var t=e.props,r=e.item,a=e.xAxis,n=e.yAxis,i=e.xAxisTicks,o=e.yAxisTicks,s=e.bandSize,u=e.dataKey,l=e.stackedData,f=e.dataStartIndex,c=e.displayedData,h=e.offset,A=t.layout,g=l&&l.length,x=te.getBaseValue(t,r,a,n),v=A==="horizontal",O=!1,y=c.map(function(d,m){var b;g?b=l[f+m]:(b=J(d,u),Array.isArray(b)?O=!0:b=[x,b]);var w=b[1]==null||g&&J(d,u)==null;return v?{x:Q({axis:a,ticks:i,bandSize:s,entry:d,index:m}),y:w?null:n.scale(b[1]),value:b,payload:d}:{x:w?null:a.scale(b[1]),y:Q({axis:n,ticks:o,bandSize:s,entry:d,index:m}),value:b,payload:d}}),_;return g||O?_=y.map(function(d){var m=Array.isArray(d.value)?d.value[0]:null;return v?{x:d.x,y:m!=null&&d.y!=null?n.scale(m):null}:{x:m!=null?a.scale(m):null,y:d.y}}):_=v?n.scale(x):a.scale(x),S({points:y,baseLine:_,layout:A,isRange:O},h)});E(L,"renderDotItem",function(e,t){var r;if(p.isValidElement(e))r=p.cloneElement(e,t);else if(K(e))r=e(t);else{var a=ee("recharts-area-dot",typeof e!="boolean"?e.className:""),n=t.key,i=ae(t,be);r=p.createElement(fe,D({},i,{key:n,className:a}))}return r});var ke=pe({chartName:"AreaChart",GraphicalChild:L,axisComponents:[{axisType:"xAxis",AxisComp:he},{axisType:"yAxis",AxisComp:de}],formatAxisMap:me});export{ke as A,L as a};
|
|
2
|
-
//# sourceMappingURL=AreaChart-
|
|
1
|
+
import{b as R,c as W,m as T,i as C,d as F,A as ie,e as B,h as q,j as oe,k as G,l as se,n as le,u as ue,o as K,G as ce,p as J,q as Q,D as fe,g as pe,X as he,Y as de,f as me}from"./generateCategoricalChart-DrSwgn1V.js";import{R as p,F as ee,r as ve}from"./index-DraytcOY.js";var ye=["layout","type","stroke","connectNulls","isRange","ref"],be=["key"],te;function M(e){"@babel/helpers - typeof";return M=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},M(e)}function ae(e,t){if(e==null)return{};var r=Ae(e,t),a,n;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)a=i[n],!(t.indexOf(a)>=0)&&Object.prototype.propertyIsEnumerable.call(e,a)&&(r[a]=e[a])}return r}function Ae(e,t){if(e==null)return{};var r={};for(var a in e)if(Object.prototype.hasOwnProperty.call(e,a)){if(t.indexOf(a)>=0)continue;r[a]=e[a]}return r}function D(){return D=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var a in r)Object.prototype.hasOwnProperty.call(r,a)&&(e[a]=r[a])}return e},D.apply(this,arguments)}function U(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter(function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable})),r.push.apply(r,a)}return r}function S(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?U(Object(r),!0).forEach(function(a){E(e,a,r[a])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):U(Object(r)).forEach(function(a){Object.defineProperty(e,a,Object.getOwnPropertyDescriptor(r,a))})}return e}function ge(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Z(e,t){for(var r=0;r<t.length;r++){var a=t[r];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,ne(a.key),a)}}function xe(e,t,r){return t&&Z(e.prototype,t),r&&Z(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function Pe(e,t,r){return t=$(t),Oe(e,re()?Reflect.construct(t,r||[],$(e).constructor):t.apply(e,r))}function Oe(e,t){if(t&&(M(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Ee(e)}function Ee(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function re(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(re=function(){return!!e})()}function $(e){return $=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},$(e)}function we(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&X(e,t)}function X(e,t){return X=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(a,n){return a.__proto__=n,a},X(e,t)}function E(e,t,r){return t=ne(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function ne(e){var t=_e(e,"string");return M(t)=="symbol"?t:t+""}function _e(e,t){if(M(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var a=r.call(e,t);if(M(a)!="object")return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}var L=function(e){function t(){var r;ge(this,t);for(var a=arguments.length,n=new Array(a),i=0;i<a;i++)n[i]=arguments[i];return r=Pe(this,t,[].concat(n)),E(r,"state",{isAnimationFinished:!0}),E(r,"id",ue("recharts-area-")),E(r,"handleAnimationEnd",function(){var o=r.props.onAnimationEnd;r.setState({isAnimationFinished:!0}),K(o)&&o()}),E(r,"handleAnimationStart",function(){var o=r.props.onAnimationStart;r.setState({isAnimationFinished:!1}),K(o)&&o()}),r}return we(t,e),xe(t,[{key:"renderDots",value:function(a,n,i){var o=this.props.isAnimationActive,s=this.state.isAnimationFinished;if(o&&!s)return null;var u=this.props,l=u.dot,f=u.points,c=u.dataKey,h=R(this.props,!1),A=R(l,!0),g=f.map(function(v,O){var y=S(S(S({key:"dot-".concat(O),r:3},h),A),{},{index:O,cx:v.x,cy:v.y,dataKey:c,value:v.value,payload:v.payload,points:f});return t.renderDotItem(l,y)}),x={clipPath:a?"url(#clipPath-".concat(n?"":"dots-").concat(i,")"):null};return p.createElement(W,D({className:"recharts-area-dots"},x),g)}},{key:"renderHorizontalRect",value:function(a){var n=this.props,i=n.baseLine,o=n.points,s=n.strokeWidth,u=o[0].x,l=o[o.length-1].x,f=a*Math.abs(u-l),c=T(o.map(function(h){return h.y||0}));return C(i)&&typeof i=="number"?c=Math.max(i,c):i&&Array.isArray(i)&&i.length&&(c=Math.max(T(i.map(function(h){return h.y||0})),c)),C(c)?p.createElement("rect",{x:u<l?u:u-f,y:0,width:f,height:Math.floor(c+(s?parseInt("".concat(s),10):1))}):null}},{key:"renderVerticalRect",value:function(a){var n=this.props,i=n.baseLine,o=n.points,s=n.strokeWidth,u=o[0].y,l=o[o.length-1].y,f=a*Math.abs(u-l),c=T(o.map(function(h){return h.x||0}));return C(i)&&typeof i=="number"?c=Math.max(i,c):i&&Array.isArray(i)&&i.length&&(c=Math.max(T(i.map(function(h){return h.x||0})),c)),C(c)?p.createElement("rect",{x:0,y:u<l?u:u-f,width:c+(s?parseInt("".concat(s),10):1),height:Math.floor(f)}):null}},{key:"renderClipRect",value:function(a){var n=this.props.layout;return n==="vertical"?this.renderVerticalRect(a):this.renderHorizontalRect(a)}},{key:"renderAreaStatically",value:function(a,n,i,o){var s=this.props,u=s.layout,l=s.type,f=s.stroke,c=s.connectNulls,h=s.isRange;s.ref;var A=ae(s,ye);return p.createElement(W,{clipPath:i?"url(#clipPath-".concat(o,")"):null},p.createElement(F,D({},R(A,!0),{points:a,connectNulls:c,type:l,baseLine:n,layout:u,stroke:"none",className:"recharts-area-area"})),f!=="none"&&p.createElement(F,D({},R(this.props,!1),{className:"recharts-area-curve",layout:u,type:l,connectNulls:c,fill:"none",points:a})),f!=="none"&&h&&p.createElement(F,D({},R(this.props,!1),{className:"recharts-area-curve",layout:u,type:l,connectNulls:c,fill:"none",points:n})))}},{key:"renderAreaWithAnimation",value:function(a,n){var i=this,o=this.props,s=o.points,u=o.baseLine,l=o.isAnimationActive,f=o.animationBegin,c=o.animationDuration,h=o.animationEasing,A=o.animationId,g=this.state,x=g.prevPoints,v=g.prevBaseLine;return p.createElement(ie,{begin:f,duration:c,isActive:l,easing:h,from:{t:0},to:{t:1},key:"area-".concat(A),onAnimationEnd:this.handleAnimationEnd,onAnimationStart:this.handleAnimationStart},function(O){var y=O.t;if(x){var _=x.length/s.length,d=s.map(function(P,N){var k=Math.floor(N*_);if(x[k]){var j=x[k],I=B(j.x,P.x),V=B(j.y,P.y);return S(S({},P),{},{x:I(y),y:V(y)})}return P}),m;if(C(u)&&typeof u=="number"){var b=B(v,u);m=b(y)}else if(q(u)||oe(u)){var w=B(v,0);m=w(y)}else m=u.map(function(P,N){var k=Math.floor(N*_);if(v[k]){var j=v[k],I=B(j.x,P.x),V=B(j.y,P.y);return S(S({},P),{},{x:I(y),y:V(y)})}return P});return i.renderAreaStatically(d,m,a,n)}return p.createElement(W,null,p.createElement("defs",null,p.createElement("clipPath",{id:"animationClipPath-".concat(n)},i.renderClipRect(y))),p.createElement(W,{clipPath:"url(#animationClipPath-".concat(n,")")},i.renderAreaStatically(s,u,a,n)))})}},{key:"renderArea",value:function(a,n){var i=this.props,o=i.points,s=i.baseLine,u=i.isAnimationActive,l=this.state,f=l.prevPoints,c=l.prevBaseLine,h=l.totalLength;return u&&o&&o.length&&(!f&&h>0||!G(f,o)||!G(c,s))?this.renderAreaWithAnimation(a,n):this.renderAreaStatically(o,s,a,n)}},{key:"render",value:function(){var a,n=this.props,i=n.hide,o=n.dot,s=n.points,u=n.className,l=n.top,f=n.left,c=n.xAxis,h=n.yAxis,A=n.width,g=n.height,x=n.isAnimationActive,v=n.id;if(i||!s||!s.length)return null;var O=this.state.isAnimationFinished,y=s.length===1,_=ee("recharts-area",u),d=c&&c.allowDataOverflow,m=h&&h.allowDataOverflow,b=d||m,w=q(v)?this.id:v,P=(a=R(o,!1))!==null&&a!==void 0?a:{r:3,strokeWidth:2},N=P.r,k=N===void 0?3:N,j=P.strokeWidth,I=j===void 0?2:j,V=se(o)?o:{},Y=V.clipDot,H=Y===void 0?!0:Y,z=k*2+I;return p.createElement(W,{className:_},d||m?p.createElement("defs",null,p.createElement("clipPath",{id:"clipPath-".concat(w)},p.createElement("rect",{x:d?f:f-A/2,y:m?l:l-g/2,width:d?A:A*2,height:m?g:g*2})),!H&&p.createElement("clipPath",{id:"clipPath-dots-".concat(w)},p.createElement("rect",{x:f-z/2,y:l-z/2,width:A+z,height:g+z}))):null,y?null:this.renderArea(b,w),(o||y)&&this.renderDots(b,H,w),(!x||O)&&le.renderCallByParent(this.props,s))}}],[{key:"getDerivedStateFromProps",value:function(a,n){return a.animationId!==n.prevAnimationId?{prevAnimationId:a.animationId,curPoints:a.points,curBaseLine:a.baseLine,prevPoints:n.curPoints,prevBaseLine:n.curBaseLine}:a.points!==n.curPoints||a.baseLine!==n.curBaseLine?{curPoints:a.points,curBaseLine:a.baseLine}:null}}])}(ve.PureComponent);te=L;E(L,"displayName","Area");E(L,"defaultProps",{stroke:"#3182bd",fill:"#3182bd",fillOpacity:.6,xAxisId:0,yAxisId:0,legendType:"line",connectNulls:!1,points:[],dot:!1,activeDot:!0,hide:!1,isAnimationActive:!ce.isSsr,animationBegin:0,animationDuration:1500,animationEasing:"ease"});E(L,"getBaseValue",function(e,t,r,a){var n=e.layout,i=e.baseValue,o=t.props.baseValue,s=o??i;if(C(s)&&typeof s=="number")return s;var u=n==="horizontal"?a:r,l=u.scale.domain();if(u.type==="number"){var f=Math.max(l[0],l[1]),c=Math.min(l[0],l[1]);return s==="dataMin"?c:s==="dataMax"||f<0?f:Math.max(Math.min(l[0],l[1]),0)}return s==="dataMin"?l[0]:s==="dataMax"?l[1]:l[0]});E(L,"getComposedData",function(e){var t=e.props,r=e.item,a=e.xAxis,n=e.yAxis,i=e.xAxisTicks,o=e.yAxisTicks,s=e.bandSize,u=e.dataKey,l=e.stackedData,f=e.dataStartIndex,c=e.displayedData,h=e.offset,A=t.layout,g=l&&l.length,x=te.getBaseValue(t,r,a,n),v=A==="horizontal",O=!1,y=c.map(function(d,m){var b;g?b=l[f+m]:(b=J(d,u),Array.isArray(b)?O=!0:b=[x,b]);var w=b[1]==null||g&&J(d,u)==null;return v?{x:Q({axis:a,ticks:i,bandSize:s,entry:d,index:m}),y:w?null:n.scale(b[1]),value:b,payload:d}:{x:w?null:a.scale(b[1]),y:Q({axis:n,ticks:o,bandSize:s,entry:d,index:m}),value:b,payload:d}}),_;return g||O?_=y.map(function(d){var m=Array.isArray(d.value)?d.value[0]:null;return v?{x:d.x,y:m!=null&&d.y!=null?n.scale(m):null}:{x:m!=null?a.scale(m):null,y:d.y}}):_=v?n.scale(x):a.scale(x),S({points:y,baseLine:_,layout:A,isRange:O},h)});E(L,"renderDotItem",function(e,t){var r;if(p.isValidElement(e))r=p.cloneElement(e,t);else if(K(e))r=e(t);else{var a=ee("recharts-area-dot",typeof e!="boolean"?e.className:""),n=t.key,i=ae(t,be);r=p.createElement(fe,D({},i,{key:n,className:a}))}return r});var ke=pe({chartName:"AreaChart",GraphicalChild:L,axisComponents:[{axisType:"xAxis",AxisComp:he},{axisType:"yAxis",AxisComp:de}],formatAxisMap:me});export{ke as A,L as a};
|
|
2
|
+
//# sourceMappingURL=AreaChart-DywU5SSt.js.map
|