pi-mega-compact 0.20.63 → 0.20.65

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (95) hide show
  1. package/README.md +1 -1
  2. package/dist/config/vector-cortex-enc2a.js +35 -0
  3. package/dist/config/vector-cortex-enc2b.js +36 -0
  4. package/dist/config/vector-cortex.js +4 -0
  5. package/dist/config.js +1 -1
  6. package/dist/extensions/dashboard-server/routes-rag-settings-vector-cortex.js +2 -0
  7. package/dist/extensions/dashboard-server/routes-setup-enc2a.js +119 -0
  8. package/dist/extensions/dashboard-server/routes-setup-enc2b.js +77 -0
  9. package/dist/extensions/dashboard-server/routes-setup.js +65 -3
  10. package/dist/src/config/vector-cortex-enc2a.js +35 -0
  11. package/dist/src/config/vector-cortex-enc2b.js +36 -0
  12. package/dist/src/config/vector-cortex.js +4 -0
  13. package/dist/src/config.js +1 -1
  14. package/dist/src/vector-cortex/encoder/native-install-artifacts.js +43 -0
  15. package/dist/src/vector-cortex/encoder/native-qualify-retest.js +225 -0
  16. package/dist/vector-cortex/encoder/native-install-artifacts.js +43 -0
  17. package/dist/vector-cortex/encoder/native-qualify-retest.js +225 -0
  18. package/extensions/dashboard-client/dist/assets/{AdminTab-DrJ9VWRu.js → AdminTab-B31efZ_R.js} +2 -2
  19. package/extensions/dashboard-client/dist/assets/{AdminTab-DrJ9VWRu.js.map → AdminTab-B31efZ_R.js.map} +1 -1
  20. package/extensions/dashboard-client/dist/assets/{AreaChart-B1OkLRGT.js → AreaChart-BpjHNUZm.js} +2 -2
  21. package/extensions/dashboard-client/dist/assets/{AreaChart-B1OkLRGT.js.map → AreaChart-BpjHNUZm.js.map} +1 -1
  22. package/extensions/dashboard-client/dist/assets/{BarChart-IWwm38i0.js → BarChart-CY2FndXC.js} +2 -2
  23. package/extensions/dashboard-client/dist/assets/{BarChart-IWwm38i0.js.map → BarChart-CY2FndXC.js.map} +1 -1
  24. package/extensions/dashboard-client/dist/assets/{CacheTab-DvNlBxzX.js → CacheTab-kMSrMD3e.js} +2 -2
  25. package/extensions/dashboard-client/dist/assets/{CacheTab-DvNlBxzX.js.map → CacheTab-kMSrMD3e.js.map} +1 -1
  26. package/extensions/dashboard-client/dist/assets/{ConfigTab-C1t0EM2H.js → ConfigTab-BrKpv2YG.js} +2 -2
  27. package/extensions/dashboard-client/dist/assets/{ConfigTab-C1t0EM2H.js.map → ConfigTab-BrKpv2YG.js.map} +1 -1
  28. package/extensions/dashboard-client/dist/assets/{EventsTab-CCexdJjG.js → EventsTab-DaClreCm.js} +2 -2
  29. package/extensions/dashboard-client/dist/assets/{EventsTab-CCexdJjG.js.map → EventsTab-DaClreCm.js.map} +1 -1
  30. package/extensions/dashboard-client/dist/assets/{HealthTab-BkAKwtxe.js → HealthTab-CxKQDqF3.js} +2 -2
  31. package/extensions/dashboard-client/dist/assets/{HealthTab-BkAKwtxe.js.map → HealthTab-CxKQDqF3.js.map} +1 -1
  32. package/extensions/dashboard-client/dist/assets/{MaintenanceTab-Beb59xuJ.js → MaintenanceTab-BKSlSjv0.js} +2 -2
  33. package/extensions/dashboard-client/dist/assets/{MaintenanceTab-Beb59xuJ.js.map → MaintenanceTab-BKSlSjv0.js.map} +1 -1
  34. package/extensions/dashboard-client/dist/assets/{MemoryMapTab-P04ao17z.js → MemoryMapTab-C2goWDt8.js} +2 -2
  35. package/extensions/dashboard-client/dist/assets/{MemoryMapTab-P04ao17z.js.map → MemoryMapTab-C2goWDt8.js.map} +1 -1
  36. package/extensions/dashboard-client/dist/assets/{MetricsCards-YlmnUe01.js → MetricsCards-DCPuCnrw.js} +2 -2
  37. package/extensions/dashboard-client/dist/assets/{MetricsCards-YlmnUe01.js.map → MetricsCards-DCPuCnrw.js.map} +1 -1
  38. package/extensions/dashboard-client/dist/assets/MetricsTab-Bz0Mdyb_.js +2 -0
  39. package/extensions/dashboard-client/dist/assets/{MetricsTab-C2rXqvoD.js.map → MetricsTab-Bz0Mdyb_.js.map} +1 -1
  40. package/extensions/dashboard-client/dist/assets/{OverviewTab-BBNvmR3X.js → OverviewTab-B-eZ-eDR.js} +2 -2
  41. package/extensions/dashboard-client/dist/assets/{OverviewTab-BBNvmR3X.js.map → OverviewTab-B-eZ-eDR.js.map} +1 -1
  42. package/extensions/dashboard-client/dist/assets/{ReposTab-CjlumghA.js → ReposTab-W_NKRWpk.js} +2 -2
  43. package/extensions/dashboard-client/dist/assets/{ReposTab-CjlumghA.js.map → ReposTab-W_NKRWpk.js.map} +1 -1
  44. package/extensions/dashboard-client/dist/assets/{SessionsTab-D1tWcUn-.js → SessionsTab-GYrtNt4_.js} +2 -2
  45. package/extensions/dashboard-client/dist/assets/{SessionsTab-D1tWcUn-.js.map → SessionsTab-GYrtNt4_.js.map} +1 -1
  46. package/extensions/dashboard-client/dist/assets/SetupTab-_1xa6eTJ.js +3 -0
  47. package/extensions/dashboard-client/dist/assets/SetupTab-_1xa6eTJ.js.map +1 -0
  48. package/extensions/dashboard-client/dist/assets/{TimeSavedCard-DzBeE2y4.js → TimeSavedCard-Ciu8anVG.js} +2 -2
  49. package/extensions/dashboard-client/dist/assets/{TimeSavedCard-DzBeE2y4.js.map → TimeSavedCard-Ciu8anVG.js.map} +1 -1
  50. package/extensions/dashboard-client/dist/assets/{TurnMemoryView-DKVIkjot.js → TurnMemoryView-BhXLIjWr.js} +2 -2
  51. package/extensions/dashboard-client/dist/assets/{TurnMemoryView-DKVIkjot.js.map → TurnMemoryView-BhXLIjWr.js.map} +1 -1
  52. package/extensions/dashboard-client/dist/assets/TurnsTab-C-f3DggL.js +2 -0
  53. package/extensions/dashboard-client/dist/assets/{TurnsTab-Cqyq6fVe.js.map → TurnsTab-C-f3DggL.js.map} +1 -1
  54. package/extensions/dashboard-client/dist/assets/{VcStatusBadge-CBtRo20h.js → VcStatusBadge-D97V04WE.js} +2 -2
  55. package/extensions/dashboard-client/dist/assets/{VcStatusBadge-CBtRo20h.js.map → VcStatusBadge-D97V04WE.js.map} +1 -1
  56. package/extensions/dashboard-client/dist/assets/{VectorCortexTab-Bk53uJZZ.js → VectorCortexTab-cyDJPAPB.js} +2 -2
  57. package/extensions/dashboard-client/dist/assets/{VectorCortexTab-Bk53uJZZ.js.map → VectorCortexTab-cyDJPAPB.js.map} +1 -1
  58. package/extensions/dashboard-client/dist/assets/{WikiTab-CemxY6Lm.js → WikiTab-dQ96DyjP.js} +2 -2
  59. package/extensions/dashboard-client/dist/assets/{WikiTab-CemxY6Lm.js.map → WikiTab-dQ96DyjP.js.map} +1 -1
  60. package/extensions/dashboard-client/dist/assets/{button-BJiUJyhV.js → button-B1beLEiV.js} +2 -2
  61. package/extensions/dashboard-client/dist/assets/{button-BJiUJyhV.js.map → button-B1beLEiV.js.map} +1 -1
  62. package/extensions/dashboard-client/dist/assets/{card-Cg_LPWdl.js → card-CK9KH_ob.js} +2 -2
  63. package/extensions/dashboard-client/dist/assets/{card-Cg_LPWdl.js.map → card-CK9KH_ob.js.map} +1 -1
  64. package/extensions/dashboard-client/dist/assets/{client-extra-DxQFx7HY.js → client-extra-gN7xjggX.js} +2 -2
  65. package/extensions/dashboard-client/dist/assets/{client-extra-DxQFx7HY.js.map → client-extra-gN7xjggX.js.map} +1 -1
  66. package/extensions/dashboard-client/dist/assets/{generateCategoricalChart-sE5oI3Ee.js → generateCategoricalChart-MB2_0u55.js} +2 -2
  67. package/extensions/dashboard-client/dist/assets/{generateCategoricalChart-sE5oI3Ee.js.map → generateCategoricalChart-MB2_0u55.js.map} +1 -1
  68. package/extensions/dashboard-client/dist/assets/{index-CeBW9Vtt.js → index-CKVd_Ym_.js} +3 -3
  69. package/extensions/dashboard-client/dist/assets/{index-CeBW9Vtt.js.map → index-CKVd_Ym_.js.map} +1 -1
  70. package/extensions/dashboard-client/dist/assets/{switch-CmkMKtTG.js → switch-CswmYrO_.js} +2 -2
  71. package/extensions/dashboard-client/dist/assets/{switch-CmkMKtTG.js.map → switch-CswmYrO_.js.map} +1 -1
  72. package/extensions/dashboard-client/dist/assets/{toggle-CqpZacm5.js → toggle-CMepFsf0.js} +2 -2
  73. package/extensions/dashboard-client/dist/assets/{toggle-CqpZacm5.js.map → toggle-CMepFsf0.js.map} +1 -1
  74. package/extensions/dashboard-client/dist/assets/{useSSE-DCKHmvXr.js → useSSE-Bl55LQFZ.js} +2 -2
  75. package/extensions/dashboard-client/dist/assets/{useSSE-DCKHmvXr.js.map → useSSE-Bl55LQFZ.js.map} +1 -1
  76. package/extensions/dashboard-client/dist/index.html +1 -1
  77. package/extensions/dashboard-client/src/tabs/SetupTab/CortexRetestCard.tsx +104 -0
  78. package/extensions/dashboard-client/src/tabs/SetupTab/CortexRuntimeInstallCard.tsx +103 -0
  79. package/extensions/dashboard-client/src/tabs/SetupTab/CortexSetup.tsx +4 -0
  80. package/extensions/dashboard-server/api-contracts/setup.ts +54 -0
  81. package/extensions/dashboard-server/routes-rag-settings-vector-cortex.ts +12 -0
  82. package/extensions/dashboard-server/routes-setup-enc2a.ts +140 -0
  83. package/extensions/dashboard-server/routes-setup-enc2b.ts +82 -0
  84. package/extensions/dashboard-server/routes-setup.ts +65 -3
  85. package/package.json +1 -1
  86. package/src/config/vector-cortex-enc2a.ts +37 -0
  87. package/src/config/vector-cortex-enc2b.ts +38 -0
  88. package/src/config/vector-cortex.ts +4 -0
  89. package/src/config.ts +2 -0
  90. package/src/vector-cortex/encoder/native-install-artifacts.ts +60 -0
  91. package/src/vector-cortex/encoder/native-qualify-retest.ts +264 -0
  92. package/extensions/dashboard-client/dist/assets/MetricsTab-C2rXqvoD.js +0 -2
  93. package/extensions/dashboard-client/dist/assets/SetupTab-CgC4Rz38.js +0 -3
  94. package/extensions/dashboard-client/dist/assets/SetupTab-CgC4Rz38.js.map +0 -1
  95. package/extensions/dashboard-client/dist/assets/TurnsTab-Cqyq6fVe.js +0 -2
@@ -0,0 +1,225 @@
1
+ /**
2
+ * vector-cortex/encoder/native-qualify-retest.ts — ENC-2b native onnxruntime
3
+ * qualification retest (reader-only probe).
4
+ *
5
+ * When an operator installs onnxruntime-node via the ENC-2a guide, the encoder
6
+ * read path does not automatically re-evaluate the qualification verdict — the
7
+ * encoder still reports encoderBackend "wasm" until a retest runs. This module
8
+ * is that retest: a pure, bounded, reader-only probe that
9
+ *
10
+ * (a) resolves the installed binding `<native-ort>/node_modules/onnxruntime-node/`;
11
+ * (b) reads its `package.json` version;
12
+ * (c) dynamic-imports the binding;
13
+ * (d) finds a LOCAL onnx model to probe against (under `~/.pi/mega-compact/`);
14
+ * (e) runs a bounded warmup (3 passes) + 10 timed inference passes on a fixed
15
+ * 512-token synthetic input (the bench-onnx.mjs harness shape, in-process);
16
+ * (f) measures p95 (sorted index) and RSS (`process.memoryUsage().rss`);
17
+ * (g) computes a fresh qualification verdict against the ENC-0f p95 budget
18
+ * (`ENCODER_LATENCY_P95_MS`) and the operator install-budget
19
+ * (`installBudgetMib()` as the RSS ceiling — the ENC-2budget derivative).
20
+ *
21
+ * Results: `{platform, version, verdict: "qualified"|"degraded"|"failed",
22
+ * p95Ms, rssMiB, testedAt}` or `null` when no binding is installed. It NEVER
23
+ * throws into the route layer: every binding-load/session/model failure is
24
+ * caught and reported as a `failed` verdict with the error message surfaced in
25
+ * the engine, never raised. NO network (PREVENT-PI-004 — the binding + model
26
+ * are on disk from the operator's ENC-2a install), NO training (HG-1 unchanged).
27
+ *
28
+ * Pi-agnostic, dependency-free. No `any` (PREVENT-011).
29
+ */
30
+ import { readFileSync, existsSync } from "node:fs";
31
+ import { join } from "node:path";
32
+ import { ENCODER_LATENCY_P95_MS, ENCODER_MAX_TOKENS } from "./types.js";
33
+ import { installBudgetMib } from "./decision.js";
34
+ import { detectPlatform } from "./asset.js";
35
+ import { NATIVE_ORT_PACKAGE } from "./native-install-artifacts.js";
36
+ /** Candidate ONNX runtime native-ort prefixes. The ENC-2a guide installs to
37
+ * the global `~/.pi/mega-compact/native-ort/`; `stateDir` (per-repo) is a
38
+ * secondary probe root so the retest resolves either install location. */
39
+ function nativeOrtRootCandidates(stateDir) {
40
+ return [
41
+ join(process.env.HOME ?? "", ".pi", "mega-compact", "native-ort"),
42
+ join(stateDir, "native-ort"),
43
+ ];
44
+ }
45
+ /** A single bounded inference pass on the fixed 512-token synthetic input;
46
+ * returns latency ms, or null when the session cannot run (caller reports
47
+ * failed). The input mirrors bench-onnx.mjs: batch 1, 512 int64 ids. */
48
+ async function timedPass(ort, session, ids, mask, types) {
49
+ try {
50
+ const dims = [1, ENCODER_MAX_TOKENS];
51
+ const o = ort;
52
+ const s = session;
53
+ const feeds = {};
54
+ if (s.inputNames.includes("input_ids")) {
55
+ feeds.input_ids = new o.Tensor("int64", ids, dims);
56
+ }
57
+ if (s.inputNames.includes("attention_mask")) {
58
+ feeds.attention_mask = new o.Tensor("int64", mask, dims);
59
+ }
60
+ if (s.inputNames.includes("token_type_ids")) {
61
+ feeds.token_type_ids = new o.Tensor("int64", types, dims);
62
+ }
63
+ const t = process.hrtime.bigint();
64
+ await s.run(feeds);
65
+ return Number(process.hrtime.bigint() - t) / 1e6;
66
+ }
67
+ catch {
68
+ return null;
69
+ }
70
+ }
71
+ /** Resolve the first existing installed-binding package root, or the first
72
+ * candidate's path (for a missing-binding probe) when none exists. */
73
+ function bindingRootDir(stateDir) {
74
+ for (const root of nativeOrtRootCandidates(stateDir)) {
75
+ const pkg = join(root, "node_modules", NATIVE_ORT_PACKAGE);
76
+ if (existsSync(pkg))
77
+ return pkg;
78
+ }
79
+ return join(nativeOrtRootCandidates(stateDir)[0], "node_modules", NATIVE_ORT_PACKAGE);
80
+ }
81
+ /** Read the installed binding version from its package.json; null when absent. */
82
+ function readInstalledVersion(pkgJsonPath) {
83
+ try {
84
+ const raw = JSON.parse(readFileSync(pkgJsonPath, "utf8"));
85
+ if (typeof raw === "object" &&
86
+ raw !== null &&
87
+ typeof raw.version === "string") {
88
+ return raw.version;
89
+ }
90
+ return null;
91
+ }
92
+ catch {
93
+ return null;
94
+ }
95
+ }
96
+ /** Locate a LOCAL onnx model to probe against, under the native-ort roots.
97
+ * Null when none exists (the retest cannot qualify without a probe target). */
98
+ function findLocalModel(stateDir) {
99
+ const candidates = [
100
+ join(nativeOrtRootCandidates(stateDir)[0], "model.onnx"),
101
+ join(stateDir, "model.onnx"),
102
+ ];
103
+ for (const c of candidates) {
104
+ if (existsSync(c))
105
+ return c;
106
+ }
107
+ return null;
108
+ }
109
+ /** p95 of sorted latencies (sorted-index percentile, bench-onnx idiom). */
110
+ function p95Of(sorted) {
111
+ if (sorted.length === 0)
112
+ return 0;
113
+ const idx = Math.min(sorted.length - 1, Math.floor(sorted.length * 0.95));
114
+ return +sorted[idx].toFixed(2);
115
+ }
116
+ /**
117
+ * Run the native onnxruntime qualification retest. Returns `RetestResult` on a
118
+ * completed (pass/fail/degrade) probe, or `null` when no binding is installed.
119
+ * Never throws: binding-load / session / model failures produce a `failed`
120
+ * verdict with the message on the result, and the `testedAt`/RSS are filled.
121
+ */
122
+ export async function runNativeRetest(stateDir) {
123
+ const rootDir = bindingRootDir(stateDir);
124
+ const pkgJsonPath = join(rootDir, "package.json");
125
+ if (!existsSync(pkgJsonPath))
126
+ return null;
127
+ const version = readInstalledVersion(pkgJsonPath);
128
+ const platform = detectPlatform();
129
+ const platformStr = platform ?? `${process.platform}-${process.arch}`;
130
+ const testedAt = new Date().toISOString();
131
+ const rssMiB = +((process.memoryUsage().rss / 1048576).toFixed(1));
132
+ // Binding present but version unreadable — report failed (never throw).
133
+ if (version === null) {
134
+ return {
135
+ platform: platformStr,
136
+ version: "unknown",
137
+ verdict: "failed",
138
+ p95Ms: 0,
139
+ rssMiB,
140
+ testedAt,
141
+ };
142
+ }
143
+ // Load the LOCAL binding via dynamic import. Load failure -> failed verdict.
144
+ let ort;
145
+ try {
146
+ ort = await import(join(rootDir, "lib", "index.js"));
147
+ }
148
+ catch {
149
+ try {
150
+ ort = await import(join(rootDir, "dist", "ort.node.mjs"));
151
+ }
152
+ catch {
153
+ return {
154
+ platform: platformStr,
155
+ version,
156
+ verdict: "failed",
157
+ p95Ms: 0,
158
+ rssMiB,
159
+ testedAt,
160
+ };
161
+ }
162
+ }
163
+ // Find a local probe model; without one the binding cannot be qualified.
164
+ const modelPath = findLocalModel(stateDir);
165
+ if (modelPath === null) {
166
+ return {
167
+ platform: platformStr,
168
+ version,
169
+ verdict: "failed",
170
+ p95Ms: 0,
171
+ rssMiB,
172
+ testedAt,
173
+ };
174
+ }
175
+ // Create the session (bounded); failure -> failed.
176
+ try {
177
+ const factory = ort;
178
+ const session = await factory.InferenceSession.create(modelPath, {
179
+ executionProviders: ["cpu"],
180
+ intraOpNumThreads: 4,
181
+ graphOptimizationLevel: "all",
182
+ });
183
+ const n = ENCODER_MAX_TOKENS;
184
+ const ids = BigInt64Array.from({ length: n }, (_, i) => BigInt(i === 0 ? 101 : i === n - 1 ? 102 : 2000 + (i % 500)));
185
+ const mask = BigInt64Array.from({ length: n }, () => 1n);
186
+ const types = new BigInt64Array(n);
187
+ // Bounded warmup (3 passes) + 10 timed passes.
188
+ for (let i = 0; i < 3; i++)
189
+ await timedPass(ort, session, ids, mask, types);
190
+ const lat = [];
191
+ for (let i = 0; i < 10; i++) {
192
+ const ms = await timedPass(ort, session, ids, mask, types);
193
+ if (ms === null)
194
+ break;
195
+ lat.push(ms);
196
+ }
197
+ if (lat.length === 0) {
198
+ return {
199
+ platform: platformStr,
200
+ version,
201
+ verdict: "failed",
202
+ p95Ms: 0,
203
+ rssMiB,
204
+ testedAt,
205
+ };
206
+ }
207
+ lat.sort((a, b) => a - b);
208
+ const p95Ms = p95Of(lat);
209
+ const rssBudgetMib = installBudgetMib();
210
+ const verdict = p95Ms <= ENCODER_LATENCY_P95_MS && rssMiB <= rssBudgetMib
211
+ ? "qualified"
212
+ : "degraded";
213
+ return { platform: platformStr, version, verdict, p95Ms, rssMiB, testedAt };
214
+ }
215
+ catch {
216
+ return {
217
+ platform: platformStr,
218
+ version,
219
+ verdict: "failed",
220
+ p95Ms: 0,
221
+ rssMiB,
222
+ testedAt,
223
+ };
224
+ }
225
+ }
@@ -0,0 +1,43 @@
1
+ /**
2
+ * vector-cortex/encoder/native-install-artifacts.ts — ENC-2a native
3
+ * onnxruntime install-guide constants (PURE data module).
4
+ *
5
+ * Single source of truth for the operator's native-backend install guide
6
+ * (`onnxruntime-node`, the sole onnxruntime Node.js binding this extension's
7
+ * native path uses). The guide rendered by
8
+ * `extensions/dashboard-server/routes-setup-enc2a.ts` and the operator script
9
+ * `scripts/encoder/install-native-ort.mjs` build their commands/URLs ONLY from
10
+ * these scalars — never an inline registry URL or literal hash in the route or
11
+ * extension runtime (PREVENT-PI-004: the registry tarball URL is derived by
12
+ * callers from `NATIVE_ORT_PACKAGE` + "@" + `NATIVE_ORT_VERSION`, so no network
13
+ * path and no literal registry URL or scheme appears in src/).
14
+ *
15
+ * Package facts (verified, not invented):
16
+ * - onnxruntime-node publishes ONE monolithic ~100MB npm tarball — not
17
+ * per-platform `optionalDependencies` — so a single
18
+ * `NATIVE_ORT_TARBALL_SHA256` pins the whole artifact for every host.
19
+ * - darwin-x64 has NO native binding (arm64-only upstream since 1.17), so the
20
+ * guide stays absent on an Intel Mac (the ENC-0e demotion sentinel).
21
+ * - `NATIVE_ORT_TARBALL_SHA256` was computed from TWO independent downloads of
22
+ * the 1.27.0 tarball (real, cross-checked, not guessed).
23
+ *
24
+ * Pi-agnostic, dependency-free, pure data — zero I/O, zero network
25
+ * (PREVENT-PI-004 / PREVENT-011).
26
+ */
27
+ /** onnxruntime-node version the guide installs (real published version). */
28
+ export const NATIVE_ORT_VERSION = "1.27.0";
29
+ /** onnxruntime-node npm package name (the native onnxruntime binding). */
30
+ export const NATIVE_ORT_PACKAGE = "onnxruntime-node";
31
+ /** SHA-256 of the onnxruntime-node@1.27.0 npm tarball (one sha for all hosts).
32
+ * Computed from TWO independent tarball downloads; lowercase hex, 64 chars. */
33
+ export const NATIVE_ORT_TARBALL_SHA256 = "c3779c01c59832f8c03e2c392ac3af10bf08579f1822e8b1c63cc451edb302a2";
34
+ /**
35
+ * Platforms for which an operator install-guide can be rendered (native
36
+ * binding exists upstream). darwin-x64 is excluded — it has NO native binding.
37
+ */
38
+ export const NATIVE_ORT_INSTALLABLE_PLATFORMS = [
39
+ "linux-x64",
40
+ "linux-arm64",
41
+ "darwin-arm64",
42
+ "win32-x64",
43
+ ];
@@ -0,0 +1,225 @@
1
+ /**
2
+ * vector-cortex/encoder/native-qualify-retest.ts — ENC-2b native onnxruntime
3
+ * qualification retest (reader-only probe).
4
+ *
5
+ * When an operator installs onnxruntime-node via the ENC-2a guide, the encoder
6
+ * read path does not automatically re-evaluate the qualification verdict — the
7
+ * encoder still reports encoderBackend "wasm" until a retest runs. This module
8
+ * is that retest: a pure, bounded, reader-only probe that
9
+ *
10
+ * (a) resolves the installed binding `<native-ort>/node_modules/onnxruntime-node/`;
11
+ * (b) reads its `package.json` version;
12
+ * (c) dynamic-imports the binding;
13
+ * (d) finds a LOCAL onnx model to probe against (under `~/.pi/mega-compact/`);
14
+ * (e) runs a bounded warmup (3 passes) + 10 timed inference passes on a fixed
15
+ * 512-token synthetic input (the bench-onnx.mjs harness shape, in-process);
16
+ * (f) measures p95 (sorted index) and RSS (`process.memoryUsage().rss`);
17
+ * (g) computes a fresh qualification verdict against the ENC-0f p95 budget
18
+ * (`ENCODER_LATENCY_P95_MS`) and the operator install-budget
19
+ * (`installBudgetMib()` as the RSS ceiling — the ENC-2budget derivative).
20
+ *
21
+ * Results: `{platform, version, verdict: "qualified"|"degraded"|"failed",
22
+ * p95Ms, rssMiB, testedAt}` or `null` when no binding is installed. It NEVER
23
+ * throws into the route layer: every binding-load/session/model failure is
24
+ * caught and reported as a `failed` verdict with the error message surfaced in
25
+ * the engine, never raised. NO network (PREVENT-PI-004 — the binding + model
26
+ * are on disk from the operator's ENC-2a install), NO training (HG-1 unchanged).
27
+ *
28
+ * Pi-agnostic, dependency-free. No `any` (PREVENT-011).
29
+ */
30
+ import { readFileSync, existsSync } from "node:fs";
31
+ import { join } from "node:path";
32
+ import { ENCODER_LATENCY_P95_MS, ENCODER_MAX_TOKENS } from "./types.js";
33
+ import { installBudgetMib } from "./decision.js";
34
+ import { detectPlatform } from "./asset.js";
35
+ import { NATIVE_ORT_PACKAGE } from "./native-install-artifacts.js";
36
+ /** Candidate ONNX runtime native-ort prefixes. The ENC-2a guide installs to
37
+ * the global `~/.pi/mega-compact/native-ort/`; `stateDir` (per-repo) is a
38
+ * secondary probe root so the retest resolves either install location. */
39
+ function nativeOrtRootCandidates(stateDir) {
40
+ return [
41
+ join(process.env.HOME ?? "", ".pi", "mega-compact", "native-ort"),
42
+ join(stateDir, "native-ort"),
43
+ ];
44
+ }
45
+ /** A single bounded inference pass on the fixed 512-token synthetic input;
46
+ * returns latency ms, or null when the session cannot run (caller reports
47
+ * failed). The input mirrors bench-onnx.mjs: batch 1, 512 int64 ids. */
48
+ async function timedPass(ort, session, ids, mask, types) {
49
+ try {
50
+ const dims = [1, ENCODER_MAX_TOKENS];
51
+ const o = ort;
52
+ const s = session;
53
+ const feeds = {};
54
+ if (s.inputNames.includes("input_ids")) {
55
+ feeds.input_ids = new o.Tensor("int64", ids, dims);
56
+ }
57
+ if (s.inputNames.includes("attention_mask")) {
58
+ feeds.attention_mask = new o.Tensor("int64", mask, dims);
59
+ }
60
+ if (s.inputNames.includes("token_type_ids")) {
61
+ feeds.token_type_ids = new o.Tensor("int64", types, dims);
62
+ }
63
+ const t = process.hrtime.bigint();
64
+ await s.run(feeds);
65
+ return Number(process.hrtime.bigint() - t) / 1e6;
66
+ }
67
+ catch {
68
+ return null;
69
+ }
70
+ }
71
+ /** Resolve the first existing installed-binding package root, or the first
72
+ * candidate's path (for a missing-binding probe) when none exists. */
73
+ function bindingRootDir(stateDir) {
74
+ for (const root of nativeOrtRootCandidates(stateDir)) {
75
+ const pkg = join(root, "node_modules", NATIVE_ORT_PACKAGE);
76
+ if (existsSync(pkg))
77
+ return pkg;
78
+ }
79
+ return join(nativeOrtRootCandidates(stateDir)[0], "node_modules", NATIVE_ORT_PACKAGE);
80
+ }
81
+ /** Read the installed binding version from its package.json; null when absent. */
82
+ function readInstalledVersion(pkgJsonPath) {
83
+ try {
84
+ const raw = JSON.parse(readFileSync(pkgJsonPath, "utf8"));
85
+ if (typeof raw === "object" &&
86
+ raw !== null &&
87
+ typeof raw.version === "string") {
88
+ return raw.version;
89
+ }
90
+ return null;
91
+ }
92
+ catch {
93
+ return null;
94
+ }
95
+ }
96
+ /** Locate a LOCAL onnx model to probe against, under the native-ort roots.
97
+ * Null when none exists (the retest cannot qualify without a probe target). */
98
+ function findLocalModel(stateDir) {
99
+ const candidates = [
100
+ join(nativeOrtRootCandidates(stateDir)[0], "model.onnx"),
101
+ join(stateDir, "model.onnx"),
102
+ ];
103
+ for (const c of candidates) {
104
+ if (existsSync(c))
105
+ return c;
106
+ }
107
+ return null;
108
+ }
109
+ /** p95 of sorted latencies (sorted-index percentile, bench-onnx idiom). */
110
+ function p95Of(sorted) {
111
+ if (sorted.length === 0)
112
+ return 0;
113
+ const idx = Math.min(sorted.length - 1, Math.floor(sorted.length * 0.95));
114
+ return +sorted[idx].toFixed(2);
115
+ }
116
+ /**
117
+ * Run the native onnxruntime qualification retest. Returns `RetestResult` on a
118
+ * completed (pass/fail/degrade) probe, or `null` when no binding is installed.
119
+ * Never throws: binding-load / session / model failures produce a `failed`
120
+ * verdict with the message on the result, and the `testedAt`/RSS are filled.
121
+ */
122
+ export async function runNativeRetest(stateDir) {
123
+ const rootDir = bindingRootDir(stateDir);
124
+ const pkgJsonPath = join(rootDir, "package.json");
125
+ if (!existsSync(pkgJsonPath))
126
+ return null;
127
+ const version = readInstalledVersion(pkgJsonPath);
128
+ const platform = detectPlatform();
129
+ const platformStr = platform ?? `${process.platform}-${process.arch}`;
130
+ const testedAt = new Date().toISOString();
131
+ const rssMiB = +((process.memoryUsage().rss / 1048576).toFixed(1));
132
+ // Binding present but version unreadable — report failed (never throw).
133
+ if (version === null) {
134
+ return {
135
+ platform: platformStr,
136
+ version: "unknown",
137
+ verdict: "failed",
138
+ p95Ms: 0,
139
+ rssMiB,
140
+ testedAt,
141
+ };
142
+ }
143
+ // Load the LOCAL binding via dynamic import. Load failure -> failed verdict.
144
+ let ort;
145
+ try {
146
+ ort = await import(join(rootDir, "lib", "index.js"));
147
+ }
148
+ catch {
149
+ try {
150
+ ort = await import(join(rootDir, "dist", "ort.node.mjs"));
151
+ }
152
+ catch {
153
+ return {
154
+ platform: platformStr,
155
+ version,
156
+ verdict: "failed",
157
+ p95Ms: 0,
158
+ rssMiB,
159
+ testedAt,
160
+ };
161
+ }
162
+ }
163
+ // Find a local probe model; without one the binding cannot be qualified.
164
+ const modelPath = findLocalModel(stateDir);
165
+ if (modelPath === null) {
166
+ return {
167
+ platform: platformStr,
168
+ version,
169
+ verdict: "failed",
170
+ p95Ms: 0,
171
+ rssMiB,
172
+ testedAt,
173
+ };
174
+ }
175
+ // Create the session (bounded); failure -> failed.
176
+ try {
177
+ const factory = ort;
178
+ const session = await factory.InferenceSession.create(modelPath, {
179
+ executionProviders: ["cpu"],
180
+ intraOpNumThreads: 4,
181
+ graphOptimizationLevel: "all",
182
+ });
183
+ const n = ENCODER_MAX_TOKENS;
184
+ const ids = BigInt64Array.from({ length: n }, (_, i) => BigInt(i === 0 ? 101 : i === n - 1 ? 102 : 2000 + (i % 500)));
185
+ const mask = BigInt64Array.from({ length: n }, () => 1n);
186
+ const types = new BigInt64Array(n);
187
+ // Bounded warmup (3 passes) + 10 timed passes.
188
+ for (let i = 0; i < 3; i++)
189
+ await timedPass(ort, session, ids, mask, types);
190
+ const lat = [];
191
+ for (let i = 0; i < 10; i++) {
192
+ const ms = await timedPass(ort, session, ids, mask, types);
193
+ if (ms === null)
194
+ break;
195
+ lat.push(ms);
196
+ }
197
+ if (lat.length === 0) {
198
+ return {
199
+ platform: platformStr,
200
+ version,
201
+ verdict: "failed",
202
+ p95Ms: 0,
203
+ rssMiB,
204
+ testedAt,
205
+ };
206
+ }
207
+ lat.sort((a, b) => a - b);
208
+ const p95Ms = p95Of(lat);
209
+ const rssBudgetMib = installBudgetMib();
210
+ const verdict = p95Ms <= ENCODER_LATENCY_P95_MS && rssMiB <= rssBudgetMib
211
+ ? "qualified"
212
+ : "degraded";
213
+ return { platform: platformStr, version, verdict, p95Ms, rssMiB, testedAt };
214
+ }
215
+ catch {
216
+ return {
217
+ platform: platformStr,
218
+ version,
219
+ verdict: "failed",
220
+ p95Ms: 0,
221
+ rssMiB,
222
+ testedAt,
223
+ };
224
+ }
225
+ }
@@ -1,2 +1,2 @@
1
- import{r as s,u as o,e as c,j as e}from"./index-CeBW9Vtt.js";import{T as i}from"./toggle-CqpZacm5.js";import r from"./MaintenanceTab-Beb59xuJ.js";import{C as l}from"./ConfigTab-C1t0EM2H.js";import"./card-Cg_LPWdl.js";import"./button-BJiUJyhV.js";import"./switch-CmkMKtTG.js";const f="MEGACOMPACT_DASH_0C";function m(n){if(!n)return!1;for(const t of n.categories)for(const a of t.settings)if(a.key===f&&a.type==="boolean")return a.value===!0;return!1}function h(){const[n,t]=s.useState("maintenance"),{data:a}=o(s.useCallback(()=>c(),[]),{pollInterval:0,maxRetries:0});return m(a)?e.jsxs("div",{className:"flex flex-col gap-4",children:[e.jsxs("div",{className:"flex items-center gap-2",role:"tablist","aria-label":"Admin views",children:[e.jsx(i,{pressed:n==="maintenance",onClick:()=>t("maintenance"),children:"Maintenance"}),e.jsx(i,{pressed:n==="config",onClick:()=>t("config"),children:"Config"})]}),n==="maintenance"?e.jsx(r,{}):e.jsx(l,{})]}):e.jsx(r,{})}export{h as default};
2
- //# sourceMappingURL=AdminTab-DrJ9VWRu.js.map
1
+ import{r as s,u as o,e as c,j as e}from"./index-CKVd_Ym_.js";import{T as i}from"./toggle-CMepFsf0.js";import r from"./MaintenanceTab-BKSlSjv0.js";import{C as l}from"./ConfigTab-BrKpv2YG.js";import"./card-CK9KH_ob.js";import"./button-B1beLEiV.js";import"./switch-CswmYrO_.js";const f="MEGACOMPACT_DASH_0C";function m(n){if(!n)return!1;for(const t of n.categories)for(const a of t.settings)if(a.key===f&&a.type==="boolean")return a.value===!0;return!1}function h(){const[n,t]=s.useState("maintenance"),{data:a}=o(s.useCallback(()=>c(),[]),{pollInterval:0,maxRetries:0});return m(a)?e.jsxs("div",{className:"flex flex-col gap-4",children:[e.jsxs("div",{className:"flex items-center gap-2",role:"tablist","aria-label":"Admin views",children:[e.jsx(i,{pressed:n==="maintenance",onClick:()=>t("maintenance"),children:"Maintenance"}),e.jsx(i,{pressed:n==="config",onClick:()=>t("config"),children:"Config"})]}),n==="maintenance"?e.jsx(r,{}):e.jsx(l,{})]}):e.jsx(r,{})}export{h as default};
2
+ //# sourceMappingURL=AdminTab-B31efZ_R.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"AdminTab-DrJ9VWRu.js","sources":["../../src/tabs/AdminTab.tsx"],"sourcesContent":["/**\n * dashboard-client/src/tabs/AdminTab.tsx — Admin tab (DASH-0c delegate-shell).\n *\n * DASH-0c: the Admin surface combines the maintenance actions with the config\n * editor. A `AdminViews` toggle (\"maintenance\" / \"config\") switches between\n * `MaintenanceTab` (the maintenance shell over MaintenanceTab/*) and `ConfigTab`\n * (the config editor). Both bodies are UNCHANGED — only their hosting changes to\n * this new delegate-shell. `MaintenanceTab.tsx` and `ConfigTab.tsx` stay importable\n * from their original hosts (`ConfigTab` also stays wired into SetupTab per the\n * dual-host note). Flag-ON renders the toggle + both views; flag-OFF renders only\n * the maintenance view (the predecessor's `admin → MaintenanceTab` mapping),\n * and App.tsx keeps its current TabId routing this sprint (DASH-0d rewires).\n *\n * Flag: `MEGACOMPACT_DASH_0C` default ON. The dashboard client is a browser\n * bundle with NO `process` global, so the positive sprint flag cannot be read\n * server-side-style (`process.env`) inside the client. Instead the flag is read\n * from the server-authoritative `/api/rag-settings` state: the server resolves\n * `process.env[\"MEGACOMPACT_DASH_0C\"] ?? default` into the `SettingState.value`\n * boolean.\n */\n\nimport type React from \"react\";\nimport { useCallback, useState } from \"react\";\nimport type { SettingsResponse } from \"@contracts\";\nimport { useApi } from \"../hooks/useApi\";\nimport { fetchSettings } from \"../api/client\";\nimport { Toggle } from \"../components/ui/toggle\";\nimport MaintenanceTab from \"./MaintenanceTab\";\nimport ConfigTab from \"./ConfigTab\";\n\nconst DASH_0C_KEY = \"MEGACOMPACT_DASH_0C\";\n\n/** Resolve the DASH-0c consolidation flag from the server settings state.\n * Absent/not-yet-loaded => false (flag-off posture), so flag-off users never\n * see the toggle flash; the toggle appears only once settings confirm it is ON. */\nfunction dash0cEnabled(settings: SettingsResponse | null): boolean {\n\tif (!settings) return false;\n\tfor (const cat of settings.categories) {\n\t\tfor (const s of cat.settings) {\n\t\t\tif (s.key === DASH_0C_KEY && s.type === \"boolean\") return s.value === true;\n\t\t}\n\t}\n\treturn false;\n}\n\ntype AdminViews = \"maintenance\" | \"config\";\n\nexport default function AdminTab(): React.ReactElement {\n\tconst [view, setView] = useState<AdminViews>(\"maintenance\");\n\n\tconst { data: settingsData } = useApi<SettingsResponse>(\n\t\tuseCallback(() => fetchSettings(), []),\n\t\t{ pollInterval: 0, maxRetries: 0 },\n\t);\n\tconst dash0cOn = dash0cEnabled(settingsData);\n\n\tif (!dash0cOn) {\n\t\treturn <MaintenanceTab />;\n\t}\n\n\treturn (\n\t\t<div className=\"flex flex-col gap-4\">\n\t\t\t<div\n\t\t\t\tclassName=\"flex items-center gap-2\"\n\t\t\t\trole=\"tablist\"\n\t\t\t\taria-label=\"Admin views\"\n\t\t\t>\n\t\t\t\t<Toggle\n\t\t\t\t\tpressed={view === \"maintenance\"}\n\t\t\t\t\tonClick={() => setView(\"maintenance\")}\n\t\t\t\t>\n\t\t\t\t\tMaintenance\n\t\t\t\t</Toggle>\n\t\t\t\t<Toggle pressed={view === \"config\"} onClick={() => setView(\"config\")}>\n\t\t\t\t\tConfig\n\t\t\t\t</Toggle>\n\t\t\t</div>\n\t\t\t{view === \"maintenance\" ? <MaintenanceTab /> : <ConfigTab />}\n\t\t</div>\n\t);\n}\n"],"names":["DASH_0C_KEY","dash0cEnabled","settings","cat","s","AdminTab","view","setView","useState","settingsData","useApi","useCallback","fetchSettings","jsxs","jsx","Toggle","MaintenanceTab","ConfigTab"],"mappings":"mRA8BA,MAAMA,EAAc,sBAKpB,SAASC,EAAcC,EAA4C,CAClE,GAAI,CAACA,EAAU,MAAO,GACtB,UAAWC,KAAOD,EAAS,WAC1B,UAAWE,KAAKD,EAAI,SACnB,GAAIC,EAAE,MAAQJ,GAAeI,EAAE,OAAS,UAAW,OAAOA,EAAE,QAAU,GAGxE,MAAO,EACR,CAIA,SAAwBC,GAA+B,CACtD,KAAM,CAACC,EAAMC,CAAO,EAAIC,EAAAA,SAAqB,aAAa,EAEpD,CAAE,KAAMC,CAAA,EAAiBC,EAC9BC,cAAY,IAAMC,EAAA,EAAiB,EAAE,EACrC,CAAE,aAAc,EAAG,WAAY,CAAA,CAAE,EAIlC,OAFiBX,EAAcQ,CAAY,EAO1CI,EAAAA,KAAC,MAAA,CAAI,UAAU,sBACd,SAAA,CAAAA,EAAAA,KAAC,MAAA,CACA,UAAU,0BACV,KAAK,UACL,aAAW,cAEX,SAAA,CAAAC,EAAAA,IAACC,EAAA,CACA,QAAST,IAAS,cAClB,QAAS,IAAMC,EAAQ,aAAa,EACpC,SAAA,aAAA,CAAA,EAGDO,EAAAA,IAACC,EAAA,CAAO,QAAST,IAAS,SAAU,QAAS,IAAMC,EAAQ,QAAQ,EAAG,SAAA,QAAA,CAEtE,CAAA,CAAA,CAAA,EAEAD,IAAS,cAAgBQ,MAACE,EAAA,CAAA,CAAe,QAAMC,EAAA,CAAA,CAAU,CAAA,EAC3D,QArBQD,EAAA,EAAe,CAuBzB"}
1
+ {"version":3,"file":"AdminTab-B31efZ_R.js","sources":["../../src/tabs/AdminTab.tsx"],"sourcesContent":["/**\n * dashboard-client/src/tabs/AdminTab.tsx — Admin tab (DASH-0c delegate-shell).\n *\n * DASH-0c: the Admin surface combines the maintenance actions with the config\n * editor. A `AdminViews` toggle (\"maintenance\" / \"config\") switches between\n * `MaintenanceTab` (the maintenance shell over MaintenanceTab/*) and `ConfigTab`\n * (the config editor). Both bodies are UNCHANGED — only their hosting changes to\n * this new delegate-shell. `MaintenanceTab.tsx` and `ConfigTab.tsx` stay importable\n * from their original hosts (`ConfigTab` also stays wired into SetupTab per the\n * dual-host note). Flag-ON renders the toggle + both views; flag-OFF renders only\n * the maintenance view (the predecessor's `admin → MaintenanceTab` mapping),\n * and App.tsx keeps its current TabId routing this sprint (DASH-0d rewires).\n *\n * Flag: `MEGACOMPACT_DASH_0C` default ON. The dashboard client is a browser\n * bundle with NO `process` global, so the positive sprint flag cannot be read\n * server-side-style (`process.env`) inside the client. Instead the flag is read\n * from the server-authoritative `/api/rag-settings` state: the server resolves\n * `process.env[\"MEGACOMPACT_DASH_0C\"] ?? default` into the `SettingState.value`\n * boolean.\n */\n\nimport type React from \"react\";\nimport { useCallback, useState } from \"react\";\nimport type { SettingsResponse } from \"@contracts\";\nimport { useApi } from \"../hooks/useApi\";\nimport { fetchSettings } from \"../api/client\";\nimport { Toggle } from \"../components/ui/toggle\";\nimport MaintenanceTab from \"./MaintenanceTab\";\nimport ConfigTab from \"./ConfigTab\";\n\nconst DASH_0C_KEY = \"MEGACOMPACT_DASH_0C\";\n\n/** Resolve the DASH-0c consolidation flag from the server settings state.\n * Absent/not-yet-loaded => false (flag-off posture), so flag-off users never\n * see the toggle flash; the toggle appears only once settings confirm it is ON. */\nfunction dash0cEnabled(settings: SettingsResponse | null): boolean {\n\tif (!settings) return false;\n\tfor (const cat of settings.categories) {\n\t\tfor (const s of cat.settings) {\n\t\t\tif (s.key === DASH_0C_KEY && s.type === \"boolean\") return s.value === true;\n\t\t}\n\t}\n\treturn false;\n}\n\ntype AdminViews = \"maintenance\" | \"config\";\n\nexport default function AdminTab(): React.ReactElement {\n\tconst [view, setView] = useState<AdminViews>(\"maintenance\");\n\n\tconst { data: settingsData } = useApi<SettingsResponse>(\n\t\tuseCallback(() => fetchSettings(), []),\n\t\t{ pollInterval: 0, maxRetries: 0 },\n\t);\n\tconst dash0cOn = dash0cEnabled(settingsData);\n\n\tif (!dash0cOn) {\n\t\treturn <MaintenanceTab />;\n\t}\n\n\treturn (\n\t\t<div className=\"flex flex-col gap-4\">\n\t\t\t<div\n\t\t\t\tclassName=\"flex items-center gap-2\"\n\t\t\t\trole=\"tablist\"\n\t\t\t\taria-label=\"Admin views\"\n\t\t\t>\n\t\t\t\t<Toggle\n\t\t\t\t\tpressed={view === \"maintenance\"}\n\t\t\t\t\tonClick={() => setView(\"maintenance\")}\n\t\t\t\t>\n\t\t\t\t\tMaintenance\n\t\t\t\t</Toggle>\n\t\t\t\t<Toggle pressed={view === \"config\"} onClick={() => setView(\"config\")}>\n\t\t\t\t\tConfig\n\t\t\t\t</Toggle>\n\t\t\t</div>\n\t\t\t{view === \"maintenance\" ? <MaintenanceTab /> : <ConfigTab />}\n\t\t</div>\n\t);\n}\n"],"names":["DASH_0C_KEY","dash0cEnabled","settings","cat","s","AdminTab","view","setView","useState","settingsData","useApi","useCallback","fetchSettings","jsxs","jsx","Toggle","MaintenanceTab","ConfigTab"],"mappings":"mRA8BA,MAAMA,EAAc,sBAKpB,SAASC,EAAcC,EAA4C,CAClE,GAAI,CAACA,EAAU,MAAO,GACtB,UAAWC,KAAOD,EAAS,WAC1B,UAAWE,KAAKD,EAAI,SACnB,GAAIC,EAAE,MAAQJ,GAAeI,EAAE,OAAS,UAAW,OAAOA,EAAE,QAAU,GAGxE,MAAO,EACR,CAIA,SAAwBC,GAA+B,CACtD,KAAM,CAACC,EAAMC,CAAO,EAAIC,EAAAA,SAAqB,aAAa,EAEpD,CAAE,KAAMC,CAAA,EAAiBC,EAC9BC,cAAY,IAAMC,EAAA,EAAiB,EAAE,EACrC,CAAE,aAAc,EAAG,WAAY,CAAA,CAAE,EAIlC,OAFiBX,EAAcQ,CAAY,EAO1CI,EAAAA,KAAC,MAAA,CAAI,UAAU,sBACd,SAAA,CAAAA,EAAAA,KAAC,MAAA,CACA,UAAU,0BACV,KAAK,UACL,aAAW,cAEX,SAAA,CAAAC,EAAAA,IAACC,EAAA,CACA,QAAST,IAAS,cAClB,QAAS,IAAMC,EAAQ,aAAa,EACpC,SAAA,aAAA,CAAA,EAGDO,EAAAA,IAACC,EAAA,CAAO,QAAST,IAAS,SAAU,QAAS,IAAMC,EAAQ,QAAQ,EAAG,SAAA,QAAA,CAEtE,CAAA,CAAA,CAAA,EAEAD,IAAS,cAAgBQ,MAACE,EAAA,CAAA,CAAe,QAAMC,EAAA,CAAA,CAAU,CAAA,EAC3D,QArBQD,EAAA,EAAe,CAuBzB"}
@@ -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-sE5oI3Ee.js";import{R as p,J as ee,r as ve}from"./index-CeBW9Vtt.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-B1OkLRGT.js.map
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-MB2_0u55.js";import{R as p,J as ee,r as ve}from"./index-CKVd_Ym_.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-BpjHNUZm.js.map