@shahmilsaari/memory-core 1.0.11 → 1.0.16
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/README.md +6 -2
- package/dist/{chunk-PRRVI3YM.js → chunk-ECYSBYMM.js} +66 -19
- package/dist/cli.js +103 -35
- package/dist/dashboard/assets/index-DM82nOf5.js +2 -0
- package/dist/dashboard/index.html +1 -1
- package/dist/{dashboard-server-46IGUJ4H.js → dashboard-server-4WOUQTJN.js} +65 -16
- package/package.json +1 -1
- package/dist/dashboard/assets/index-CtOmKAsL.js +0 -2
package/README.md
CHANGED
|
@@ -292,7 +292,7 @@ npx @shahmilsaari/memory-core remember "Use DTOs for all API responses" \
|
|
|
292
292
|
|---|---|---|
|
|
293
293
|
| `--type` | `decision` `rule` `pattern` `note` | `decision` |
|
|
294
294
|
| `--scope` | `global` `project` | `project` |
|
|
295
|
-
| `--reason` | any text | asked interactively |
|
|
295
|
+
| `--reason` | any text | asked interactively; fallback is stored if blank |
|
|
296
296
|
| `--applies-to` | comma-separated use cases | none |
|
|
297
297
|
| `--avoid-when` | comma-separated exceptions | none |
|
|
298
298
|
| `--example` | comma-separated examples | none |
|
|
@@ -394,6 +394,7 @@ When `--path` is provided, it must point to the project root (the directory cont
|
|
|
394
394
|
|
|
395
395
|
```bash
|
|
396
396
|
npx @shahmilsaari/memory-core check --staged # check staged files
|
|
397
|
+
npx @shahmilsaari/memory-core check --staged --fast # deterministic-only staged check
|
|
397
398
|
npx @shahmilsaari/memory-core check --staged --verbose # with extra detail
|
|
398
399
|
npx @shahmilsaari/memory-core check --staged --debug # show prompt, diff, and raw model output
|
|
399
400
|
npx @shahmilsaari/memory-core check --ci # CI mode using memories.json
|
|
@@ -401,7 +402,7 @@ npx @shahmilsaari/memory-core check --all # scan all tracked source
|
|
|
401
402
|
npx @shahmilsaari/memory-core check --all --path src/ # scan only tracked files under src/
|
|
402
403
|
```
|
|
403
404
|
|
|
404
|
-
`--staged` is the same path used by the pre-commit hook. `--ci` reads `memories.json` and uses a deterministic CI-friendly diff check, so pull requests can enforce rules without a local database or Ollama setup.
|
|
405
|
+
`--staged` is the same path used by the pre-commit hook. Add `--fast` to skip AI and memory retrieval when you need a low-latency deterministic check. `--ci` reads `memories.json` and uses a deterministic CI-friendly diff check, so pull requests can enforce rules without a local database or Ollama setup.
|
|
405
406
|
`--all` runs a full tracked-file snapshot check and exits non-zero if violations are found.
|
|
406
407
|
`--all` and `--ci` are mutually exclusive in the same command.
|
|
407
408
|
|
|
@@ -413,10 +414,13 @@ npx @shahmilsaari/memory-core check --all --path src/ # scan only tracked files
|
|
|
413
414
|
npx @shahmilsaari/memory-core hook install # advisory mode (default)
|
|
414
415
|
npx @shahmilsaari/memory-core hook install --advisory # logs violations, never blocks
|
|
415
416
|
npx @shahmilsaari/memory-core hook install --strict # blocks commits on violations
|
|
417
|
+
npx @shahmilsaari/memory-core hook install --fast # deterministic-only hook
|
|
416
418
|
```
|
|
417
419
|
|
|
418
420
|
Installs a git pre-commit hook in the current project. Every time you run `git commit`, your code is checked against your architecture rules.
|
|
419
421
|
|
|
422
|
+
Add `--fast` to make the hook skip AI and memory retrieval for lower latency.
|
|
423
|
+
|
|
420
424
|
**Advisory mode (default):** violations are logged so you can see them, but the commit always goes through. Useful for getting used to the rules without disrupting your flow.
|
|
421
425
|
|
|
422
426
|
**Strict mode:** violations block the commit entirely. You see exactly what's wrong and how to fix it:
|
|
@@ -90,12 +90,17 @@ var Config = {
|
|
|
90
90
|
};
|
|
91
91
|
|
|
92
92
|
// src/embedding.ts
|
|
93
|
+
function getEmbeddingTimeoutMs() {
|
|
94
|
+
const raw = Number(process.env.EMBEDDING_TIMEOUT_MS ?? process.env.MEMORY_CORE_RETRIEVAL_TIMEOUT_MS ?? 5e3);
|
|
95
|
+
return Number.isFinite(raw) && raw > 0 ? Math.floor(raw) : 5e3;
|
|
96
|
+
}
|
|
93
97
|
async function embed(text) {
|
|
94
98
|
let response;
|
|
95
99
|
try {
|
|
96
100
|
response = await fetch(`${Config.ollamaUrl}/api/embeddings`, {
|
|
97
101
|
method: "POST",
|
|
98
102
|
headers: { "Content-Type": "application/json" },
|
|
103
|
+
signal: AbortSignal.timeout(getEmbeddingTimeoutMs()),
|
|
99
104
|
body: JSON.stringify({ model: Config.ollamaModel, prompt: text })
|
|
100
105
|
});
|
|
101
106
|
} catch {
|
|
@@ -122,10 +127,25 @@ function getChatConfig() {
|
|
|
122
127
|
apiKey: process.env.CHAT_API_KEY ?? ""
|
|
123
128
|
};
|
|
124
129
|
}
|
|
125
|
-
|
|
130
|
+
function getDefaultTimeoutMs() {
|
|
131
|
+
const raw = Number(process.env.CHAT_TIMEOUT_MS ?? 2e4);
|
|
132
|
+
return Number.isFinite(raw) && raw > 0 ? Math.floor(raw) : 2e4;
|
|
133
|
+
}
|
|
134
|
+
function timeoutSignal(timeoutMs) {
|
|
135
|
+
return AbortSignal.timeout(timeoutMs ?? getDefaultTimeoutMs());
|
|
136
|
+
}
|
|
137
|
+
function normalizeChatError(err, timeoutMs) {
|
|
138
|
+
const ms = timeoutMs ?? getDefaultTimeoutMs();
|
|
139
|
+
if (err instanceof Error && err.name === "AbortError") {
|
|
140
|
+
return new Error(`TIMEOUT:${ms}`);
|
|
141
|
+
}
|
|
142
|
+
return err instanceof Error ? err : new Error(String(err));
|
|
143
|
+
}
|
|
144
|
+
async function callOllama(cfg, messages, options = {}) {
|
|
126
145
|
const res = await fetch(`${cfg.ollamaUrl}/api/chat`, {
|
|
127
146
|
method: "POST",
|
|
128
147
|
headers: { "Content-Type": "application/json" },
|
|
148
|
+
signal: timeoutSignal(options.timeoutMs),
|
|
129
149
|
body: JSON.stringify({ model: cfg.model, messages, stream: false, format: "json" })
|
|
130
150
|
});
|
|
131
151
|
if (!res.ok) {
|
|
@@ -138,13 +158,14 @@ async function callOllama(cfg, messages) {
|
|
|
138
158
|
const data = await res.json();
|
|
139
159
|
return data.message.content.trim();
|
|
140
160
|
}
|
|
141
|
-
async function callOpenAI(cfg, messages) {
|
|
161
|
+
async function callOpenAI(cfg, messages, options = {}) {
|
|
142
162
|
const res = await fetch("https://api.openai.com/v1/chat/completions", {
|
|
143
163
|
method: "POST",
|
|
144
164
|
headers: {
|
|
145
165
|
"Content-Type": "application/json",
|
|
146
166
|
"Authorization": `Bearer ${cfg.apiKey}`
|
|
147
167
|
},
|
|
168
|
+
signal: timeoutSignal(options.timeoutMs),
|
|
148
169
|
body: JSON.stringify({
|
|
149
170
|
model: cfg.model,
|
|
150
171
|
messages,
|
|
@@ -155,7 +176,7 @@ async function callOpenAI(cfg, messages) {
|
|
|
155
176
|
const data = await res.json();
|
|
156
177
|
return data.choices[0].message.content.trim();
|
|
157
178
|
}
|
|
158
|
-
async function callAnthropic(cfg, messages) {
|
|
179
|
+
async function callAnthropic(cfg, messages, options = {}) {
|
|
159
180
|
const system = messages.find((m) => m.role === "system")?.content ?? "";
|
|
160
181
|
const userMessages = messages.filter((m) => m.role !== "system");
|
|
161
182
|
const res = await fetch("https://api.anthropic.com/v1/messages", {
|
|
@@ -165,6 +186,7 @@ async function callAnthropic(cfg, messages) {
|
|
|
165
186
|
"x-api-key": cfg.apiKey,
|
|
166
187
|
"anthropic-version": "2023-06-01"
|
|
167
188
|
},
|
|
189
|
+
signal: timeoutSignal(options.timeoutMs),
|
|
168
190
|
body: JSON.stringify({
|
|
169
191
|
model: cfg.model,
|
|
170
192
|
max_tokens: 4096,
|
|
@@ -176,13 +198,14 @@ async function callAnthropic(cfg, messages) {
|
|
|
176
198
|
const data = await res.json();
|
|
177
199
|
return data.content[0].text.trim();
|
|
178
200
|
}
|
|
179
|
-
async function callMiniMax(cfg, messages) {
|
|
201
|
+
async function callMiniMax(cfg, messages, options = {}) {
|
|
180
202
|
const res = await fetch("https://api.minimax.io/v1/chat/completions", {
|
|
181
203
|
method: "POST",
|
|
182
204
|
headers: {
|
|
183
205
|
"Content-Type": "application/json",
|
|
184
206
|
"Authorization": `Bearer ${cfg.apiKey}`
|
|
185
207
|
},
|
|
208
|
+
signal: timeoutSignal(options.timeoutMs),
|
|
186
209
|
body: JSON.stringify({
|
|
187
210
|
model: cfg.model,
|
|
188
211
|
messages,
|
|
@@ -193,17 +216,21 @@ async function callMiniMax(cfg, messages) {
|
|
|
193
216
|
const data = await res.json();
|
|
194
217
|
return data.choices[0].message.content.trim();
|
|
195
218
|
}
|
|
196
|
-
async function callChatModel(messages) {
|
|
219
|
+
async function callChatModel(messages, options = {}) {
|
|
197
220
|
const cfg = getChatConfig();
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
221
|
+
try {
|
|
222
|
+
switch (cfg.provider) {
|
|
223
|
+
case "openai":
|
|
224
|
+
return await callOpenAI(cfg, messages, options);
|
|
225
|
+
case "anthropic":
|
|
226
|
+
return await callAnthropic(cfg, messages, options);
|
|
227
|
+
case "minimax":
|
|
228
|
+
return await callMiniMax(cfg, messages, options);
|
|
229
|
+
default:
|
|
230
|
+
return await callOllama(cfg, messages, options);
|
|
231
|
+
}
|
|
232
|
+
} catch (err) {
|
|
233
|
+
throw normalizeChatError(err, options.timeoutMs);
|
|
207
234
|
}
|
|
208
235
|
}
|
|
209
236
|
function getChatProviderLabel() {
|
|
@@ -218,6 +245,10 @@ import { createHash } from "crypto";
|
|
|
218
245
|
var { Pool } = pg;
|
|
219
246
|
var pool = null;
|
|
220
247
|
var migrationsRun = false;
|
|
248
|
+
function readPositiveIntEnv(name, fallback) {
|
|
249
|
+
const raw = Number(process.env[name]);
|
|
250
|
+
return Number.isFinite(raw) && raw > 0 ? Math.floor(raw) : fallback;
|
|
251
|
+
}
|
|
221
252
|
function hashMemoryContent(content) {
|
|
222
253
|
return createHash("md5").update(content.trim()).digest("hex");
|
|
223
254
|
}
|
|
@@ -226,7 +257,13 @@ function getPool() {
|
|
|
226
257
|
if (!Config.databaseUrl) {
|
|
227
258
|
throw new Error("DATABASE_URL is not set. Add it to your .env or .memory-core.env file.");
|
|
228
259
|
}
|
|
229
|
-
|
|
260
|
+
const timeoutMs = readPositiveIntEnv("DATABASE_TIMEOUT_MS", 5e3);
|
|
261
|
+
pool = new Pool({
|
|
262
|
+
connectionString: Config.databaseUrl,
|
|
263
|
+
connectionTimeoutMillis: timeoutMs,
|
|
264
|
+
query_timeout: timeoutMs,
|
|
265
|
+
statement_timeout: timeoutMs
|
|
266
|
+
});
|
|
230
267
|
}
|
|
231
268
|
return pool;
|
|
232
269
|
}
|
|
@@ -235,6 +272,7 @@ async function runMigrations() {
|
|
|
235
272
|
const client = await getPool().connect();
|
|
236
273
|
try {
|
|
237
274
|
await client.query("BEGIN");
|
|
275
|
+
await client.query(`ALTER TABLE memories ALTER COLUMN scope SET DEFAULT 'project'`);
|
|
238
276
|
await client.query(`ALTER TABLE memories ADD COLUMN IF NOT EXISTS reason TEXT`);
|
|
239
277
|
await client.query(`ALTER TABLE memories ADD COLUMN IF NOT EXISTS content_hash TEXT`);
|
|
240
278
|
await client.query(`ALTER TABLE memories ADD COLUMN IF NOT EXISTS context JSONB NOT NULL DEFAULT '{}'::jsonb`);
|
|
@@ -1243,13 +1281,22 @@ var MemoryEngineService = class {
|
|
|
1243
1281
|
}
|
|
1244
1282
|
memoryRepository;
|
|
1245
1283
|
embeddingProvider;
|
|
1284
|
+
withReason(input) {
|
|
1285
|
+
const reason = input.reason?.trim();
|
|
1286
|
+
return {
|
|
1287
|
+
...input,
|
|
1288
|
+
reason: reason || `Captured as a ${input.type} memory because it should be remembered: ${input.content}`
|
|
1289
|
+
};
|
|
1290
|
+
}
|
|
1246
1291
|
async remember(input) {
|
|
1247
|
-
const
|
|
1248
|
-
|
|
1292
|
+
const normalized = this.withReason(input);
|
|
1293
|
+
const embedding = await this.embeddingProvider.embed(normalized.content);
|
|
1294
|
+
return this.memoryRepository.upsert({ ...normalized, embedding });
|
|
1249
1295
|
}
|
|
1250
1296
|
async rememberForce(input) {
|
|
1251
|
-
const
|
|
1252
|
-
await this.
|
|
1297
|
+
const normalized = this.withReason(input);
|
|
1298
|
+
const embedding = await this.embeddingProvider.embed(normalized.content);
|
|
1299
|
+
await this.memoryRepository.save({ ...normalized, embedding });
|
|
1253
1300
|
}
|
|
1254
1301
|
async list(filters = {}) {
|
|
1255
1302
|
return this.memoryRepository.list(filters);
|
package/dist/cli.js
CHANGED
|
@@ -20,7 +20,7 @@ import {
|
|
|
20
20
|
retrieveMemorySelection,
|
|
21
21
|
runMigrations,
|
|
22
22
|
seeds
|
|
23
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-ECYSBYMM.js";
|
|
24
24
|
|
|
25
25
|
// src/cli.ts
|
|
26
26
|
import { Command } from "commander";
|
|
@@ -122,8 +122,9 @@ var reasonMap = new Map(
|
|
|
122
122
|
);
|
|
123
123
|
var HOOK_PATH = join2(".git", "hooks", "pre-commit");
|
|
124
124
|
var HOOK_MARKER = "# archmind-memory-core";
|
|
125
|
-
function buildHookBody(advisory) {
|
|
125
|
+
function buildHookBody(advisory, fast = false) {
|
|
126
126
|
const suffix = advisory ? " || true" : "";
|
|
127
|
+
const checkArgs = fast ? "check --staged --fast" : "check --staged";
|
|
127
128
|
return `${HOOK_MARKER}${advisory ? " advisory" : ""}
|
|
128
129
|
if [ "\${MEMORY_CORE_SKIP_HOOK:-}" = "1" ] || [ "\${ARCHMIND_SKIP_HOOK:-}" = "1" ] || [ "\${HUSKY:-}" = "0" ] || [ "\${HUSKY_SKIP_HOOKS:-}" = "1" ]; then
|
|
129
130
|
exit 0
|
|
@@ -135,20 +136,20 @@ if [ -n "\${SKIP_HOOKS:-}" ]; then
|
|
|
135
136
|
exit 0
|
|
136
137
|
fi
|
|
137
138
|
if command -v memory-core >/dev/null 2>&1; then
|
|
138
|
-
memory-core
|
|
139
|
+
memory-core ${checkArgs}${suffix}
|
|
139
140
|
elif [ -f "./node_modules/.bin/memory-core" ]; then
|
|
140
|
-
./node_modules/.bin/memory-core
|
|
141
|
+
./node_modules/.bin/memory-core ${checkArgs}${suffix}
|
|
141
142
|
elif [ -f "./dist/cli.js" ]; then
|
|
142
|
-
node ./dist/cli.js
|
|
143
|
+
node ./dist/cli.js ${checkArgs}${suffix}
|
|
143
144
|
else
|
|
144
|
-
npx --no-install memory-core
|
|
145
|
+
npx --no-install memory-core ${checkArgs} 2>/dev/null || exit 0
|
|
145
146
|
fi
|
|
146
147
|
`;
|
|
147
148
|
}
|
|
148
|
-
function buildHookScript(advisory) {
|
|
149
|
+
function buildHookScript(advisory, fast = false) {
|
|
149
150
|
return `#!/bin/sh
|
|
150
151
|
|
|
151
|
-
${buildHookBody(advisory)}`;
|
|
152
|
+
${buildHookBody(advisory, fast)}`;
|
|
152
153
|
}
|
|
153
154
|
function normalizeHookPreamble(content) {
|
|
154
155
|
const lines = content.split("\n");
|
|
@@ -165,6 +166,26 @@ function normalizeHookPreamble(content) {
|
|
|
165
166
|
}
|
|
166
167
|
return normalized.join("\n").replace(/\n{3,}/g, "\n\n").trim();
|
|
167
168
|
}
|
|
169
|
+
function readPositiveIntEnv(name, fallback) {
|
|
170
|
+
const raw = Number(process.env[name]);
|
|
171
|
+
return Number.isFinite(raw) && raw > 0 ? Math.floor(raw) : fallback;
|
|
172
|
+
}
|
|
173
|
+
function isFastCheck(options) {
|
|
174
|
+
return options.fast === true || process.env.MEMORY_CORE_CHECK_FAST === "1";
|
|
175
|
+
}
|
|
176
|
+
async function withTimeout(promise, timeoutMs, fallback) {
|
|
177
|
+
let timer;
|
|
178
|
+
try {
|
|
179
|
+
return await Promise.race([
|
|
180
|
+
promise,
|
|
181
|
+
new Promise((resolve2) => {
|
|
182
|
+
timer = setTimeout(() => resolve2(fallback), timeoutMs);
|
|
183
|
+
})
|
|
184
|
+
]);
|
|
185
|
+
} finally {
|
|
186
|
+
if (timer) clearTimeout(timer);
|
|
187
|
+
}
|
|
188
|
+
}
|
|
168
189
|
function recordViolations(violations, source = "hook") {
|
|
169
190
|
const statsPath = join2(process.cwd(), ".memory-core-stats.json");
|
|
170
191
|
let stats = { rules: {}, files: {} };
|
|
@@ -219,11 +240,12 @@ async function promptToSaveViolations(violations) {
|
|
|
219
240
|
message: "Why should this rule exist?",
|
|
220
241
|
default: selected.reason ?? selected.issue ?? ""
|
|
221
242
|
});
|
|
243
|
+
const storedReason = reason.trim() || selected.reason || selected.issue || `Captured from violation: ${selected.rule}`;
|
|
222
244
|
await app.services.memoryEngine.remember({
|
|
223
245
|
type: "rule",
|
|
224
246
|
scope: "project",
|
|
225
247
|
content: selected.rule,
|
|
226
|
-
reason:
|
|
248
|
+
reason: storedReason,
|
|
227
249
|
tags: ["violation"]
|
|
228
250
|
});
|
|
229
251
|
console.log(chalk.green(" \u2713 Saved as project rule. Run memory-core sync to propagate it.\n"));
|
|
@@ -493,10 +515,11 @@ ${JSON.stringify(options.allowPatterns, null, 2)}`;
|
|
|
493
515
|
console.log(chalk.dim(" \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500"));
|
|
494
516
|
}
|
|
495
517
|
try {
|
|
518
|
+
const recheckTimeoutMs = readPositiveIntEnv("MEMORY_CORE_FALSE_POSITIVE_TIMEOUT_MS", 6e3);
|
|
496
519
|
const raw = await callChatModel([
|
|
497
520
|
{ role: "system", content: systemPrompt },
|
|
498
521
|
{ role: "user", content: userPrompt }
|
|
499
|
-
]);
|
|
522
|
+
], { timeoutMs: recheckTimeoutMs });
|
|
500
523
|
const parsed = parseFalsePositiveDecisions(raw);
|
|
501
524
|
if (!parsed.valid) return [];
|
|
502
525
|
const existing = new Set(options.allowPatterns.map((pattern) => pattern.toLowerCase()));
|
|
@@ -637,13 +660,13 @@ function filterModelViolationsByStagedDiff(violations, stagedFiles, diff) {
|
|
|
637
660
|
}
|
|
638
661
|
return filtered;
|
|
639
662
|
}
|
|
640
|
-
function installHook(advisory = true) {
|
|
663
|
+
function installHook(advisory = true, fast = false) {
|
|
641
664
|
if (!existsSync2(".git")) {
|
|
642
665
|
console.error(chalk.red("\n Not a git repository. Run from project root.\n"));
|
|
643
666
|
process.exit(1);
|
|
644
667
|
}
|
|
645
|
-
const script = buildHookScript(advisory);
|
|
646
|
-
const body = buildHookBody(advisory).trimEnd();
|
|
668
|
+
const script = buildHookScript(advisory, fast);
|
|
669
|
+
const body = buildHookBody(advisory, fast).trimEnd();
|
|
647
670
|
if (existsSync2(HOOK_PATH)) {
|
|
648
671
|
const existing = readFileSync2(HOOK_PATH, "utf-8");
|
|
649
672
|
if (existing.includes(HOOK_MARKER)) {
|
|
@@ -660,6 +683,7 @@ ${body}
|
|
|
660
683
|
chmodSync(HOOK_PATH, 493);
|
|
661
684
|
const modeLabel2 = advisory ? chalk.cyan("advisory") : chalk.yellow("strict");
|
|
662
685
|
console.log(chalk.green("\n \u2713 Pre-commit hook updated") + chalk.dim(` (${modeLabel2} mode)`));
|
|
686
|
+
if (fast) console.log(chalk.gray(` Check mode: fast deterministic checks`));
|
|
663
687
|
return;
|
|
664
688
|
}
|
|
665
689
|
writeFileSync2(HOOK_PATH, existing.trimEnd() + "\n\n" + body + "\n");
|
|
@@ -669,7 +693,7 @@ ${body}
|
|
|
669
693
|
chmodSync(HOOK_PATH, 493);
|
|
670
694
|
const modeLabel = advisory ? "advisory (logs violations, never blocks)" : "strict (blocks commits on violations)";
|
|
671
695
|
console.log(chalk.green("\n \u2713 Pre-commit hook installed") + chalk.dim(` \u2014 ${modeLabel}`));
|
|
672
|
-
console.log(chalk.gray(` Chat model: ${process.env.OLLAMA_CHAT_MODEL ?? "llama3.2"}`));
|
|
696
|
+
console.log(chalk.gray(fast ? " Check mode: fast deterministic checks" : ` Chat model: ${process.env.OLLAMA_CHAT_MODEL ?? "llama3.2"}`));
|
|
673
697
|
console.log(chalk.gray(" To uninstall: memory-core hook uninstall\n"));
|
|
674
698
|
}
|
|
675
699
|
function uninstallHook() {
|
|
@@ -720,17 +744,22 @@ async function checkStaged(options = {}) {
|
|
|
720
744
|
if (!existsSync2(configPath)) return;
|
|
721
745
|
const config = JSON.parse(readFileSync2(configPath, "utf-8"));
|
|
722
746
|
const { rules: fallbackRules, avoids } = getProfileRules(config);
|
|
723
|
-
const
|
|
724
|
-
|
|
725
|
-
|
|
747
|
+
const fast = isFastCheck(options);
|
|
748
|
+
const ruleLoadTimeoutMs = readPositiveIntEnv("MEMORY_CORE_RULE_LOAD_TIMEOUT_MS", 2e3);
|
|
749
|
+
const ignoreLoadTimeoutMs = readPositiveIntEnv("MEMORY_CORE_IGNORE_LOAD_TIMEOUT_MS", 1500);
|
|
750
|
+
const [rules, ignores] = fast ? [fallbackRules, []] : await Promise.all([
|
|
751
|
+
withTimeout(loadRelevantRules(config, diff, stagedFiles, fallbackRules), ruleLoadTimeoutMs, fallbackRules),
|
|
752
|
+
withTimeout(loadIgnorePatterns(), ignoreLoadTimeoutMs, [])
|
|
726
753
|
]);
|
|
727
754
|
const allowPatterns = [.../* @__PURE__ */ new Set([...getAllowPatterns(config), ...ignores])];
|
|
728
755
|
if (rules.length === 0) return;
|
|
729
|
-
const
|
|
756
|
+
const modelInputMaxChars = readPositiveIntEnv("MEMORY_CORE_MODEL_INPUT_MAX_CHARS", 8e3);
|
|
757
|
+
const modelInput = buildModelInputFromDiff(diff, modelInputMaxChars);
|
|
730
758
|
console.log(chalk.cyan("\n archmind \u2014 checking staged changes against rules\u2026"));
|
|
731
759
|
if (options.verbose || options.debug) {
|
|
732
760
|
const sourceLabel = modelInput.source === "added-lines" ? "added lines" : "diff";
|
|
733
|
-
|
|
761
|
+
const modelLabel = fast ? "skipped (--fast)" : getChatProviderLabel();
|
|
762
|
+
console.log(chalk.gray(` model: ${modelLabel} rules: ${rules.length} diff: ${diff.length} chars input: ${sourceLabel}${modelInput.truncated ? " (truncated)" : ""}`));
|
|
734
763
|
}
|
|
735
764
|
const rulesWithReasons = rules.map((r, i) => {
|
|
736
765
|
const why = reasonMap.get(r);
|
|
@@ -773,13 +802,19 @@ Do not include any text outside the JSON object.`;
|
|
|
773
802
|
reasonLookup: reasonMap
|
|
774
803
|
});
|
|
775
804
|
let modelViolations = [];
|
|
776
|
-
|
|
805
|
+
let aiFallback = fast;
|
|
806
|
+
if (fast) {
|
|
807
|
+
if (options.verbose || options.debug) {
|
|
808
|
+
console.log(chalk.gray(" AI check skipped; running deterministic checks only."));
|
|
809
|
+
}
|
|
810
|
+
} else try {
|
|
811
|
+
const checkTimeoutMs = readPositiveIntEnv("MEMORY_CORE_CHECK_TIMEOUT_MS", readPositiveIntEnv("CHAT_TIMEOUT_MS", 2e4));
|
|
777
812
|
const raw = await callChatModel([
|
|
778
813
|
{ role: "system", content: systemPrompt },
|
|
779
814
|
{ role: "user", content: `Review these staged changes:
|
|
780
815
|
|
|
781
816
|
${modelInput.text}` }
|
|
782
|
-
]);
|
|
817
|
+
], { timeoutMs: checkTimeoutMs });
|
|
783
818
|
if (options.verbose || options.debug) {
|
|
784
819
|
console.log(chalk.gray(` raw response: ${options.debug ? raw : raw.slice(0, 200)}`));
|
|
785
820
|
}
|
|
@@ -792,22 +827,32 @@ ${modelInput.text}` }
|
|
|
792
827
|
} catch (err) {
|
|
793
828
|
if (err.message?.startsWith("MODEL_NOT_FOUND:")) {
|
|
794
829
|
printModelMissing(err.message.split(":")[1]);
|
|
830
|
+
aiFallback = true;
|
|
831
|
+
modelViolations = [];
|
|
832
|
+
} else if (err.message?.startsWith("TIMEOUT:")) {
|
|
833
|
+
const timeoutMs = err.message.split(":")[1];
|
|
834
|
+
console.log(chalk.yellow(`
|
|
835
|
+
\u26A0 AI check timed out after ${timeoutMs}ms \u2014 switching to fast deterministic checks for this run.`));
|
|
836
|
+
console.log(chalk.gray(" Set MEMORY_CORE_CHECK_TIMEOUT_MS to tune this.\n"));
|
|
837
|
+
aiFallback = true;
|
|
795
838
|
modelViolations = [];
|
|
796
839
|
} else if (err.cause?.code === "ECONNREFUSED" || err.message?.includes("ECONNREFUSED")) {
|
|
797
840
|
console.log(chalk.yellow("\n \u26A0 Ollama not running \u2014 using deterministic checks only."));
|
|
798
841
|
console.log(chalk.gray(" Start it: ollama serve\n"));
|
|
842
|
+
aiFallback = true;
|
|
799
843
|
modelViolations = [];
|
|
800
844
|
} else {
|
|
801
845
|
console.log(chalk.yellow(`
|
|
802
846
|
\u26A0 AI rule check failed: ${err.message}`));
|
|
803
847
|
console.log(chalk.gray(" Using deterministic checks only.\n"));
|
|
848
|
+
aiFallback = true;
|
|
804
849
|
modelViolations = [];
|
|
805
850
|
}
|
|
806
851
|
}
|
|
807
852
|
modelViolations = filterModelViolationsByStagedDiff(modelViolations, stagedFiles, diff);
|
|
808
853
|
let violations = dedupeViolations([...deterministicViolations, ...astViolations, ...modelViolations]);
|
|
809
854
|
violations = applyAllowPatterns(violations, allowPatterns);
|
|
810
|
-
if (violations.length > 0) {
|
|
855
|
+
if (!aiFallback && violations.length > 0) {
|
|
811
856
|
const learnedPatterns = await learnGlobalIgnoresFromFalsePositives({
|
|
812
857
|
diff,
|
|
813
858
|
currentViolations: violations,
|
|
@@ -1305,6 +1350,11 @@ function buildMemoryContext(opts) {
|
|
|
1305
1350
|
if (opts.source?.trim()) context.source = opts.source.trim();
|
|
1306
1351
|
return Object.keys(context).length ? context : void 0;
|
|
1307
1352
|
}
|
|
1353
|
+
function memoryReasonOrFallback(reason, content, type = "memory") {
|
|
1354
|
+
const trimmed = reason?.trim();
|
|
1355
|
+
if (trimmed) return trimmed;
|
|
1356
|
+
return `Captured as a ${type} memory because it should be remembered: ${content}`;
|
|
1357
|
+
}
|
|
1308
1358
|
function truncate(value, length) {
|
|
1309
1359
|
if (!value) return "";
|
|
1310
1360
|
return value.length > length ? `${value.slice(0, Math.max(0, length - 1))}\u2026` : value;
|
|
@@ -1960,27 +2010,29 @@ program.command("auto-sync [mode]").description("Show or change automatic agent
|
|
|
1960
2010
|
});
|
|
1961
2011
|
program.command("remember <text>").description("Save a new memory to the central database").option("-t, --type <type>", "Memory type (decision|rule|pattern|note)", "decision").option("-s, --scope <scope>", "Scope (global|project)", "project").option("--tags <tags>", "Comma-separated tags").option("-r, --reason <reason>", "Why this rule exists \u2014 helps agents understand intent and debug violations").option("--applies-to <items>", "Comma-separated situations where this memory applies").option("--avoid-when <items>", "Comma-separated situations where this memory should not be used").option("--example <items>", "Comma-separated examples that teach agents how to apply this memory").option("--source <source>", "Human-readable source for this memory").option("--no-sync", "Skip automatic agent file sync after saving").action(async (text, opts) => {
|
|
1962
2012
|
const config = readProjectConfig();
|
|
2013
|
+
const scope = opts.scope?.trim() || "project";
|
|
1963
2014
|
let reason = opts.reason;
|
|
1964
2015
|
if (!reason) {
|
|
1965
2016
|
reason = await input({
|
|
1966
|
-
message: chalk2.dim("Why
|
|
2017
|
+
message: chalk2.dim("Why should this memory exist?"),
|
|
1967
2018
|
default: ""
|
|
1968
2019
|
});
|
|
1969
2020
|
}
|
|
2021
|
+
const storedReason = memoryReasonOrFallback(reason, text, opts.type);
|
|
1970
2022
|
const spinner = ora("Saving memory\u2026").start();
|
|
1971
2023
|
try {
|
|
1972
2024
|
await phase1.services.memoryEngine.remember({
|
|
1973
2025
|
type: opts.type,
|
|
1974
|
-
scope
|
|
2026
|
+
scope,
|
|
1975
2027
|
architecture: config?.backendArchitecture ?? config?.frontendFramework,
|
|
1976
|
-
projectName: config?.projectName,
|
|
2028
|
+
projectName: scope === "project" ? config?.projectName : void 0,
|
|
1977
2029
|
content: text,
|
|
1978
|
-
reason:
|
|
2030
|
+
reason: storedReason,
|
|
1979
2031
|
context: buildMemoryContext(opts),
|
|
1980
2032
|
tags: parseTags(opts.tags)
|
|
1981
2033
|
});
|
|
1982
|
-
const reasonLine =
|
|
1983
|
-
Why: ${
|
|
2034
|
+
const reasonLine = chalk2.gray(`
|
|
2035
|
+
Why: ${storedReason}`);
|
|
1984
2036
|
spinner.succeed(chalk2.green(`Memory saved: "${text}"`) + reasonLine);
|
|
1985
2037
|
await autoSyncGeneratedFiles(config, "remember", opts.sync);
|
|
1986
2038
|
} catch (err) {
|
|
@@ -2162,7 +2214,7 @@ program.command("edit <id>").description("Edit a memory interactively").option("
|
|
|
2162
2214
|
scope,
|
|
2163
2215
|
title: title || void 0,
|
|
2164
2216
|
content,
|
|
2165
|
-
reason: reason
|
|
2217
|
+
reason: memoryReasonOrFallback(reason, content, type),
|
|
2166
2218
|
context: buildMemoryContext({ appliesTo, avoidWhen, example: examples, source }),
|
|
2167
2219
|
tags: parseTags(tags)
|
|
2168
2220
|
});
|
|
@@ -2362,10 +2414,26 @@ program.command("stats").description("Show violation counters recorded by check
|
|
|
2362
2414
|
}
|
|
2363
2415
|
});
|
|
2364
2416
|
program.command("dashboard").description("Start the live Svelte dashboard with WebSocket watch events").option("-p, --port <port>", "Dashboard port", "5178").option("--path <dir>", "Directory to watch (default: current directory)").option("--no-watch", "Serve the dashboard without starting file watch").action(async (opts) => {
|
|
2365
|
-
const
|
|
2417
|
+
const resolveDashboardPath = () => {
|
|
2418
|
+
if (typeof opts.path === "string" && opts.path.trim().length > 0) return opts.path;
|
|
2419
|
+
const withEquals = process.argv.find((arg) => arg.startsWith("--path="));
|
|
2420
|
+
if (withEquals) {
|
|
2421
|
+
const value = withEquals.slice("--path=".length).trim();
|
|
2422
|
+
if (value.length > 0) return value;
|
|
2423
|
+
}
|
|
2424
|
+
const index = process.argv.indexOf("--path");
|
|
2425
|
+
if (index !== -1) {
|
|
2426
|
+
const candidate = process.argv[index + 1];
|
|
2427
|
+
if (typeof candidate === "string" && candidate.trim().length > 0 && !candidate.startsWith("-")) {
|
|
2428
|
+
return candidate;
|
|
2429
|
+
}
|
|
2430
|
+
}
|
|
2431
|
+
return void 0;
|
|
2432
|
+
};
|
|
2433
|
+
const { startDashboard } = await import("./dashboard-server-4WOUQTJN.js");
|
|
2366
2434
|
await startDashboard({
|
|
2367
2435
|
port: parseInt(opts.port, 10),
|
|
2368
|
-
path:
|
|
2436
|
+
path: resolveDashboardPath(),
|
|
2369
2437
|
watch: opts.watch
|
|
2370
2438
|
});
|
|
2371
2439
|
});
|
|
@@ -2759,14 +2827,14 @@ graph.command("diff <leftSnapshotId> [rightSnapshotId]").description("Diff two s
|
|
|
2759
2827
|
}
|
|
2760
2828
|
});
|
|
2761
2829
|
var hook = program.command("hook").description("Manage the pre-commit rule enforcement hook");
|
|
2762
|
-
hook.command("install").description("Install pre-commit hook (advisory mode by default \u2014 logs violations, never blocks)").option("--advisory", "Log violations but never block commits (default)").option("--strict", "Block commits that violate your rules").action((opts) => {
|
|
2830
|
+
hook.command("install").description("Install pre-commit hook (advisory mode by default \u2014 logs violations, never blocks)").option("--advisory", "Log violations but never block commits (default)").option("--strict", "Block commits that violate your rules").option("--fast", "Use deterministic checks only in the hook").action((opts) => {
|
|
2763
2831
|
const advisory = opts.strict ? false : true;
|
|
2764
|
-
installHook(advisory);
|
|
2832
|
+
installHook(advisory, opts.fast ?? false);
|
|
2765
2833
|
});
|
|
2766
2834
|
hook.command("uninstall").description("Remove the pre-commit hook").action(() => {
|
|
2767
2835
|
uninstallHook();
|
|
2768
2836
|
});
|
|
2769
|
-
program.command("check").description("Check staged changes against architecture rules (used by pre-commit hook)").option("--staged", "Check git staged diff (default behaviour)").option("--ci", `Check CI diff using ${MEMORY_FILE}`).option("--all", "Check all tracked source files, including already-committed files").option("--path <dir>", "Directory to check for --all mode (default: current directory)").option("--verbose", "Show model and diff details").option("--debug", "Show prompt, diff, and raw model response").action(async (opts) => {
|
|
2837
|
+
program.command("check").description("Check staged changes against architecture rules (used by pre-commit hook)").option("--staged", "Check git staged diff (default behaviour)").option("--ci", `Check CI diff using ${MEMORY_FILE}`).option("--all", "Check all tracked source files, including already-committed files").option("--path <dir>", "Directory to check for --all mode (default: current directory)").option("--verbose", "Show model and diff details").option("--debug", "Show prompt, diff, and raw model response").option("--fast", "Skip AI and memory retrieval; run deterministic checks only").action(async (opts) => {
|
|
2770
2838
|
if (opts.ci && opts.all) {
|
|
2771
2839
|
console.error(chalk2.red("\n Choose one mode: --ci or --all.\n"));
|
|
2772
2840
|
process.exit(1);
|
|
@@ -2784,7 +2852,7 @@ program.command("check").description("Check staged changes against architecture
|
|
|
2784
2852
|
if (summary.violations > 0) process.exit(1);
|
|
2785
2853
|
return;
|
|
2786
2854
|
}
|
|
2787
|
-
await checkStaged({ verbose: opts.verbose ?? false, debug: opts.debug ?? false });
|
|
2855
|
+
await checkStaged({ verbose: opts.verbose ?? false, debug: opts.debug ?? false, fast: opts.fast ?? false });
|
|
2788
2856
|
});
|
|
2789
2857
|
program.command("watch").description("Watch source files and check violations in real-time on every save").option("--path <dir>", "Directory to watch (default: current directory)").option("--scan-on-start", "Run an initial full snapshot scan before watching file changes").option("--verbose", "Show diff size and model details per file").option("--debug", "Show prompt, diff, and raw model response").action(async (opts) => {
|
|
2790
2858
|
await phase1.providers.watchService.start({
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
var Gl=Object.defineProperty;var Gn=e=>{throw TypeError(e)};var Jl=(e,t,r)=>t in e?Gl(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var je=(e,t,r)=>Jl(e,typeof t!="symbol"?t+"":t,r),ls=(e,t,r)=>t.has(e)||Gn("Cannot "+r);var c=(e,t,r)=>(ls(e,t,"read from private field"),r?r.call(e):t.get(e)),M=(e,t,r)=>t.has(e)?Gn("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,r),D=(e,t,r,s)=>(ls(e,t,"write to private field"),s?s.call(e,r):t.set(e,r),r),q=(e,t,r)=>(ls(e,t,"access private method"),r);(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const a of document.querySelectorAll('link[rel="modulepreload"]'))s(a);new MutationObserver(a=>{for(const i of a)if(i.type==="childList")for(const u of i.addedNodes)u.tagName==="LINK"&&u.rel==="modulepreload"&&s(u)}).observe(document,{childList:!0,subtree:!0});function r(a){const i={};return a.integrity&&(i.integrity=a.integrity),a.referrerPolicy&&(i.referrerPolicy=a.referrerPolicy),a.crossOrigin==="use-credentials"?i.credentials="include":a.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function s(a){if(a.ep)return;a.ep=!0;const i=r(a);fetch(a.href,i)}})();const Ql=!1;var As=Array.isArray,Xl=Array.prototype.indexOf,Jt=Array.prototype.includes,Br=Array.from,Zl=Object.defineProperty,ur=Object.getOwnPropertyDescriptor,_a=Object.getOwnPropertyDescriptors,eo=Object.prototype,to=Array.prototype,Cs=Object.getPrototypeOf,Jn=Object.isExtensible;const ro=()=>{};function so(e){return e()}function vs(e){for(var t=0;t<e.length;t++)e[t]()}function ha(){var e,t,r=new Promise((s,a)=>{e=s,t=a});return{promise:r,resolve:e,reject:t}}const oe=2,Qt=4,xr=8,ga=1<<24,Je=16,We=32,ht=64,ps=128,Re=512,Z=1024,ae=2048,Ve=4096,ue=8192,Ne=16384,jt=32768,Qn=1<<25,Xt=65536,_s=1<<17,no=1<<18,tr=1<<19,ba=1<<20,Ge=1<<25,Dt=65536,Vr=1<<21,_r=1<<22,pt=1<<23,Ct=Symbol("$state"),et=new class extends Error{constructor(){super(...arguments);je(this,"name","StaleReactionError");je(this,"message","The reaction that called `getAbortSignal()` was re-run or destroyed")}};function ma(e){throw new Error("https://svelte.dev/e/lifecycle_outside_component")}function ao(){throw new Error("https://svelte.dev/e/async_derived_orphan")}function io(e,t,r){throw new Error("https://svelte.dev/e/each_key_duplicate")}function lo(e){throw new Error("https://svelte.dev/e/effect_in_teardown")}function oo(){throw new Error("https://svelte.dev/e/effect_in_unowned_derived")}function co(e){throw new Error("https://svelte.dev/e/effect_orphan")}function fo(){throw new Error("https://svelte.dev/e/effect_update_depth_exceeded")}function uo(){throw new Error("https://svelte.dev/e/state_descriptors_fixed")}function vo(){throw new Error("https://svelte.dev/e/state_prototype_fixed")}function po(){throw new Error("https://svelte.dev/e/state_unsafe_mutation")}function _o(){throw new Error("https://svelte.dev/e/svelte_boundary_reset_onerror")}const ho=1,go=2,ya=4,bo=8,mo=16,yo=2,re=Symbol(),wa="http://www.w3.org/1999/xhtml";function wo(){console.warn("https://svelte.dev/e/derived_inert")}function Eo(){console.warn("https://svelte.dev/e/select_multiple_invalid_value")}function xo(){console.warn("https://svelte.dev/e/svelte_boundary_reset_noop")}function Ea(e){return e===this.v}function ko(e,t){return e!=e?t==t:e!==t||e!==null&&typeof e=="object"||typeof e=="function"}function xa(e){return!ko(e,this.v)}let kr=!1,So=!1;function To(){kr=!0}let B=null;function Zt(e){B=e}function ka(e,t=!1,r){B={p:B,i:!1,c:null,e:null,s:e,x:null,r:F,l:kr&&!t?{s:null,u:null,$:[]}:null}}function Sa(e){var t=B,r=t.e;if(r!==null){t.e=null;for(var s of r)Ba(s)}return t.i=!0,B=t.p,{}}function Sr(){return!kr||B!==null&&B.l===null}let wt=[];function Ta(){var e=wt;wt=[],vs(e)}function _t(e){if(wt.length===0&&!dr){var t=wt;queueMicrotask(()=>{t===wt&&Ta()})}wt.push(e)}function Ao(){for(;wt.length>0;)Ta()}function Aa(e){var t=F;if(t===null)return O.f|=pt,e;if(!(t.f&jt)&&!(t.f&Qt))throw e;vt(e,t)}function vt(e,t){for(;t!==null;){if(t.f&ps){if(!(t.f&jt))throw e;try{t.b.error(e);return}catch(r){e=r}}t=t.parent}throw e}const Co=-7169;function J(e,t){e.f=e.f&Co|t}function Rs(e){e.f&Re||e.deps===null?J(e,Z):J(e,Ve)}function Ca(e){if(e!==null)for(const t of e)!(t.f&oe)||!(t.f&Dt)||(t.f^=Dt,Ca(t.deps))}function Ra(e,t,r){e.f&ae?t.add(e):e.f&Ve&&r.add(e),Ca(e.deps),J(e,Z)}const yt=new Set;let T=null,ne=null,hs=null,dr=!1,os=!1,zt=null,Or=null;var Xn=0;let Ro=1;var Ht,Bt,xt,tt,Be,gr,be,br,ut,rt,Ke,Kt,Yt,kt,ee,Ir,Na,jr,gs,Pr,No;const Ur=class Ur{constructor(){M(this,ee);je(this,"id",Ro++);je(this,"current",new Map);je(this,"previous",new Map);M(this,Ht,new Set);M(this,Bt,new Set);M(this,xt,new Set);M(this,tt,new Map);M(this,Be,new Map);M(this,gr,null);M(this,be,[]);M(this,br,[]);M(this,ut,new Set);M(this,rt,new Set);M(this,Ke,new Map);M(this,Kt,new Set);je(this,"is_fork",!1);M(this,Yt,!1);M(this,kt,new Set)}skip_effect(t){c(this,Ke).has(t)||c(this,Ke).set(t,{d:[],m:[]}),c(this,Kt).delete(t)}unskip_effect(t,r=s=>this.schedule(s)){var s=c(this,Ke).get(t);if(s){c(this,Ke).delete(t);for(var a of s.d)J(a,ae),r(a);for(a of s.m)J(a,Ve),r(a)}c(this,Kt).add(t)}capture(t,r,s=!1){t.v!==re&&!this.previous.has(t)&&this.previous.set(t,t.v),t.f&pt||(this.current.set(t,[r,s]),ne==null||ne.set(t,r)),this.is_fork||(t.v=r)}activate(){T=this}deactivate(){T=null,ne=null}flush(){try{os=!0,T=this,q(this,ee,jr).call(this)}finally{Xn=0,hs=null,zt=null,Or=null,os=!1,T=null,ne=null,Rt.clear()}}discard(){for(const t of c(this,Bt))t(this);c(this,Bt).clear(),c(this,xt).clear(),yt.delete(this)}register_created_effect(t){c(this,br).push(t)}increment(t,r){let s=c(this,tt).get(r)??0;if(c(this,tt).set(r,s+1),t){let a=c(this,Be).get(r)??0;c(this,Be).set(r,a+1)}}decrement(t,r,s){let a=c(this,tt).get(r)??0;if(a===1?c(this,tt).delete(r):c(this,tt).set(r,a-1),t){let i=c(this,Be).get(r)??0;i===1?c(this,Be).delete(r):c(this,Be).set(r,i-1)}c(this,Yt)||s||(D(this,Yt,!0),_t(()=>{D(this,Yt,!1),this.flush()}))}transfer_effects(t,r){for(const s of t)c(this,ut).add(s);for(const s of r)c(this,rt).add(s);t.clear(),r.clear()}oncommit(t){c(this,Ht).add(t)}ondiscard(t){c(this,Bt).add(t)}on_fork_commit(t){c(this,xt).add(t)}run_fork_commit_callbacks(){for(const t of c(this,xt))t(this);c(this,xt).clear()}settled(){return(c(this,gr)??D(this,gr,ha())).promise}static ensure(){if(T===null){const t=T=new Ur;os||(yt.add(T),dr||_t(()=>{T===t&&t.flush()}))}return T}apply(){{ne=null;return}}schedule(t){var a;if(hs=t,(a=t.b)!=null&&a.is_pending&&t.f&(Qt|xr|ga)&&!(t.f&jt)){t.b.defer_effect(t);return}for(var r=t;r.parent!==null;){r=r.parent;var s=r.f;if(zt!==null&&r===F&&(O===null||!(O.f&oe)))return;if(s&(ht|We)){if(!(s&Z))return;r.f^=Z}}c(this,be).push(r)}};Ht=new WeakMap,Bt=new WeakMap,xt=new WeakMap,tt=new WeakMap,Be=new WeakMap,gr=new WeakMap,be=new WeakMap,br=new WeakMap,ut=new WeakMap,rt=new WeakMap,Ke=new WeakMap,Kt=new WeakMap,Yt=new WeakMap,kt=new WeakMap,ee=new WeakSet,Ir=function(){return this.is_fork||c(this,Be).size>0},Na=function(){for(const s of c(this,kt))for(const a of c(s,Be).keys()){for(var t=!1,r=a;r.parent!==null;){if(c(this,Ke).has(r)){t=!0;break}r=r.parent}if(!t)return!0}return!1},jr=function(){var v,d;if(Xn++>1e3&&(yt.delete(this),Do()),!q(this,ee,Ir).call(this)){for(const p of c(this,ut))c(this,rt).delete(p),J(p,ae),this.schedule(p);for(const p of c(this,rt))J(p,Ve),this.schedule(p)}const t=c(this,be);D(this,be,[]),this.apply();var r=zt=[],s=[],a=Or=[];for(const p of t)try{q(this,ee,gs).call(this,p,r,s)}catch(g){throw Fa(p),g}if(T=null,a.length>0){var i=Ur.ensure();for(const p of a)i.schedule(p)}if(zt=null,Or=null,q(this,ee,Ir).call(this)||q(this,ee,Na).call(this)){q(this,ee,Pr).call(this,s),q(this,ee,Pr).call(this,r);for(const[p,g]of c(this,Ke))Da(p,g)}else{c(this,tt).size===0&&yt.delete(this),c(this,ut).clear(),c(this,rt).clear();for(const p of c(this,Ht))p(this);c(this,Ht).clear(),Zn(s),Zn(r),(v=c(this,gr))==null||v.resolve()}var u=T;if(c(this,be).length>0){const p=u??(u=this);c(p,be).push(...c(this,be).filter(g=>!c(p,be).includes(g)))}u!==null&&(yt.add(u),q(d=u,ee,jr).call(d))},gs=function(t,r,s){t.f^=Z;for(var a=t.first;a!==null;){var i=a.f,u=(i&(We|ht))!==0,v=u&&(i&Z)!==0,d=v||(i&ue)!==0||c(this,Ke).has(a);if(!d&&a.fn!==null){u?a.f^=Z:i&Qt?r.push(a):rr(a)&&(i&Je&&c(this,rt).add(a),It(a));var p=a.first;if(p!==null){a=p;continue}}for(;a!==null;){var g=a.next;if(g!==null){a=g;break}a=a.parent}}},Pr=function(t){for(var r=0;r<t.length;r+=1)Ra(t[r],c(this,ut),c(this,rt))},No=function(){var g,k,w;for(const y of yt){var t=y.id<this.id,r=[];for(const[o,[A,m]]of this.current){if(y.current.has(o)){var s=y.current.get(o)[0];if(t&&A!==s)y.current.set(o,[A,m]);else continue}r.push(o)}var a=[...y.current.keys()].filter(o=>!this.current.has(o));if(a.length===0)t&&y.discard();else if(r.length>0){if(t)for(const o of c(this,Kt))y.unskip_effect(o,A=>{var m;A.f&(Je|_r)?y.schedule(A):q(m=y,ee,Pr).call(m,[A])});y.activate();var i=new Set,u=new Map;for(var v of r)Ma(v,a,i,u);u=new Map;var d=[...y.current.keys()].filter(o=>this.current.has(o)?this.current.get(o)[0]!==o:!0);for(const o of c(this,br))!(o.f&(Ne|ue|_s))&&Ns(o,d,u)&&(o.f&(_r|Je)?(J(o,ae),y.schedule(o)):c(y,ut).add(o));if(c(y,be).length>0){y.apply();for(var p of c(y,be))q(g=y,ee,gs).call(g,p,[],[]);D(y,be,[])}y.deactivate()}}for(const y of yt)c(y,kt).has(this)&&(c(y,kt).delete(this),c(y,kt).size===0&&!q(k=y,ee,Ir).call(k)&&(y.activate(),q(w=y,ee,jr).call(w)))};let Ft=Ur;function Mo(e){var t=dr;dr=!0;try{for(var r;;){if(Ao(),T===null)return r;T.flush()}}finally{dr=t}}function Do(){try{fo()}catch(e){vt(e,hs)}}let Pe=null;function Zn(e){var t=e.length;if(t!==0){for(var r=0;r<t;){var s=e[r++];if(!(s.f&(Ne|ue))&&rr(s)&&(Pe=new Set,It(s),s.deps===null&&s.first===null&&s.nodes===null&&s.teardown===null&&s.ac===null&&Ya(s),(Pe==null?void 0:Pe.size)>0)){Rt.clear();for(const a of Pe){if(a.f&(Ne|ue))continue;const i=[a];let u=a.parent;for(;u!==null;)Pe.has(u)&&(Pe.delete(u),i.push(u)),u=u.parent;for(let v=i.length-1;v>=0;v--){const d=i[v];d.f&(Ne|ue)||It(d)}}Pe.clear()}}Pe=null}}function Ma(e,t,r,s){if(!r.has(e)&&(r.add(e),e.reactions!==null))for(const a of e.reactions){const i=a.f;i&oe?Ma(a,t,r,s):i&(_r|Je)&&!(i&ae)&&Ns(a,t,s)&&(J(a,ae),Ms(a))}}function Ns(e,t,r){const s=r.get(e);if(s!==void 0)return s;if(e.deps!==null)for(const a of e.deps){if(Jt.call(t,a))return!0;if(a.f&oe&&Ns(a,t,r))return r.set(a,!0),!0}return r.set(e,!1),!1}function Ms(e){T.schedule(e)}function Da(e,t){if(!(e.f&We&&e.f&Z)){e.f&ae?t.d.push(e):e.f&Ve&&t.m.push(e),J(e,Z);for(var r=e.first;r!==null;)Da(r,t),r=r.next}}function Fa(e){J(e,Z);for(var t=e.first;t!==null;)Fa(t),t=t.next}function Fo(e){let t=0,r=Ot(0),s;return()=>{Is()&&(n(r),Yr(()=>(t===0&&(s=b(()=>e(()=>vr(r)))),t+=1,()=>{_t(()=>{t-=1,t===0&&(s==null||s(),s=void 0,vr(r))})})))}}var Oo=Xt|tr;function Io(e,t,r,s){new jo(e,t,r,s)}var Se,Ts,Te,St,ve,Ae,fe,me,st,Tt,dt,Gt,mr,yr,nt,zr,Q,Po,Lo,$o,bs,Lr,$r,ms,ys;class jo{constructor(t,r,s,a){M(this,Q);je(this,"parent");je(this,"is_pending",!1);je(this,"transform_error");M(this,Se);M(this,Ts,null);M(this,Te);M(this,St);M(this,ve);M(this,Ae,null);M(this,fe,null);M(this,me,null);M(this,st,null);M(this,Tt,0);M(this,dt,0);M(this,Gt,!1);M(this,mr,new Set);M(this,yr,new Set);M(this,nt,null);M(this,zr,Fo(()=>(D(this,nt,Ot(c(this,Tt))),()=>{D(this,nt,null)})));var i;D(this,Se,t),D(this,Te,r),D(this,St,u=>{var v=F;v.b=this,v.f|=ps,s(u)}),this.parent=F.b,this.transform_error=a??((i=this.parent)==null?void 0:i.transform_error)??(u=>u),D(this,ve,Ps(()=>{q(this,Q,bs).call(this)},Oo))}defer_effect(t){Ra(t,c(this,mr),c(this,yr))}is_rendered(){return!this.is_pending&&(!this.parent||this.parent.is_rendered())}has_pending_snippet(){return!!c(this,Te).pending}update_pending_count(t,r){q(this,Q,ms).call(this,t,r),D(this,Tt,c(this,Tt)+t),!(!c(this,nt)||c(this,Gt))&&(D(this,Gt,!0),_t(()=>{D(this,Gt,!1),c(this,nt)&&er(c(this,nt),c(this,Tt))}))}get_effect_pending(){return c(this,zr).call(this),n(c(this,nt))}error(t){if(!c(this,Te).onerror&&!c(this,Te).failed)throw t;T!=null&&T.is_fork?(c(this,Ae)&&T.skip_effect(c(this,Ae)),c(this,fe)&&T.skip_effect(c(this,fe)),c(this,me)&&T.skip_effect(c(this,me)),T.on_fork_commit(()=>{q(this,Q,ys).call(this,t)})):q(this,Q,ys).call(this,t)}}Se=new WeakMap,Ts=new WeakMap,Te=new WeakMap,St=new WeakMap,ve=new WeakMap,Ae=new WeakMap,fe=new WeakMap,me=new WeakMap,st=new WeakMap,Tt=new WeakMap,dt=new WeakMap,Gt=new WeakMap,mr=new WeakMap,yr=new WeakMap,nt=new WeakMap,zr=new WeakMap,Q=new WeakSet,Po=function(){try{D(this,Ae,Ce(()=>c(this,St).call(this,c(this,Se))))}catch(t){this.error(t)}},Lo=function(t){const r=c(this,Te).failed;r&&D(this,me,Ce(()=>{r(c(this,Se),()=>t,()=>()=>{})}))},$o=function(){const t=c(this,Te).pending;t&&(this.is_pending=!0,D(this,fe,Ce(()=>t(c(this,Se)))),_t(()=>{var r=D(this,st,document.createDocumentFragment()),s=at();r.append(s),D(this,Ae,q(this,Q,$r).call(this,()=>Ce(()=>c(this,St).call(this,s)))),c(this,dt)===0&&(c(this,Se).before(r),D(this,st,null),Nt(c(this,fe),()=>{D(this,fe,null)}),q(this,Q,Lr).call(this,T))}))},bs=function(){try{if(this.is_pending=this.has_pending_snippet(),D(this,dt,0),D(this,Tt,0),D(this,Ae,Ce(()=>{c(this,St).call(this,c(this,Se))})),c(this,dt)>0){var t=D(this,st,document.createDocumentFragment());Ws(c(this,Ae),t);const r=c(this,Te).pending;D(this,fe,Ce(()=>r(c(this,Se))))}else q(this,Q,Lr).call(this,T)}catch(r){this.error(r)}},Lr=function(t){this.is_pending=!1,t.transfer_effects(c(this,mr),c(this,yr))},$r=function(t){var r=F,s=O,a=B;Fe(c(this,ve)),De(c(this,ve)),Zt(c(this,ve).ctx);try{return Ft.ensure(),t()}catch(i){return Aa(i),null}finally{Fe(r),De(s),Zt(a)}},ms=function(t,r){var s;if(!this.has_pending_snippet()){this.parent&&q(s=this.parent,Q,ms).call(s,t,r);return}D(this,dt,c(this,dt)+t),c(this,dt)===0&&(q(this,Q,Lr).call(this,r),c(this,fe)&&Nt(c(this,fe),()=>{D(this,fe,null)}),c(this,st)&&(c(this,Se).before(c(this,st)),D(this,st,null)))},ys=function(t){c(this,Ae)&&(_e(c(this,Ae)),D(this,Ae,null)),c(this,fe)&&(_e(c(this,fe)),D(this,fe,null)),c(this,me)&&(_e(c(this,me)),D(this,me,null));var r=c(this,Te).onerror;let s=c(this,Te).failed;var a=!1,i=!1;const u=()=>{if(a){xo();return}a=!0,i&&_o(),c(this,me)!==null&&Nt(c(this,me),()=>{D(this,me,null)}),q(this,Q,$r).call(this,()=>{q(this,Q,bs).call(this)})},v=d=>{try{i=!0,r==null||r(d,u),i=!1}catch(p){vt(p,c(this,ve)&&c(this,ve).parent)}s&&D(this,me,q(this,Q,$r).call(this,()=>{try{return Ce(()=>{var p=F;p.b=this,p.f|=ps,s(c(this,Se),()=>d,()=>u)})}catch(p){return vt(p,c(this,ve).parent),null}}))};_t(()=>{var d;try{d=this.transform_error(t)}catch(p){vt(p,c(this,ve)&&c(this,ve).parent);return}d!==null&&typeof d=="object"&&typeof d.then=="function"?d.then(v,p=>vt(p,c(this,ve)&&c(this,ve).parent)):v(d)})};function Wo(e,t,r,s){const a=Sr()?Ds:Ia;var i=e.filter(w=>!w.settled);if(r.length===0&&i.length===0){s(t.map(a));return}var u=F,v=Vo(),d=i.length===1?i[0].promise:i.length>1?Promise.all(i.map(w=>w.promise)):null;function p(w){v();try{s(w)}catch(y){u.f&Ne||vt(y,u)}qr()}if(r.length===0){d.then(()=>p(t.map(a)));return}var g=Oa();function k(){Promise.all(r.map(w=>qo(w))).then(w=>p([...t.map(a),...w])).catch(w=>vt(w,u)).finally(()=>g())}d?d.then(()=>{v(),k(),qr()}):k()}function Vo(){var e=F,t=O,r=B,s=T;return function(i=!0){Fe(e),De(t),Zt(r),i&&!(e.f&Ne)&&(s==null||s.activate(),s==null||s.apply())}}function qr(e=!0){Fe(null),De(null),Zt(null),e&&(T==null||T.deactivate())}function Oa(){var e=F,t=e.b,r=T,s=t.is_rendered();return t.update_pending_count(1,r),r.increment(s,e),(a=!1)=>{t.update_pending_count(-1,r),r.decrement(s,e,a)}}function Ds(e){var t=oe|ae;return F!==null&&(F.f|=tr),{ctx:B,deps:null,effects:null,equals:Ea,f:t,fn:e,reactions:null,rv:0,v:re,wv:0,parent:F,ac:null}}function qo(e,t,r){let s=F;s===null&&ao();var a=void 0,i=Ot(re),u=!O,v=new Map;return sc(()=>{var y;var d=F,p=ha();a=p.promise;try{Promise.resolve(e()).then(p.resolve,p.reject).finally(qr)}catch(o){p.reject(o),qr()}var g=T;if(u){if(d.f&jt)var k=Oa();if(s.b.is_rendered())(y=v.get(g))==null||y.reject(et),v.delete(g);else{for(const o of v.values())o.reject(et);v.clear()}v.set(g,p)}const w=(o,A=void 0)=>{if(k){var m=A===et;k(m)}if(!(A===et||d.f&Ne)){if(g.activate(),A)i.f|=pt,er(i,A);else{i.f&pt&&(i.f^=pt),er(i,o);for(const[C,W]of v){if(v.delete(C),C===g)break;W.reject(et)}}g.deactivate()}};p.promise.then(w,o=>w(null,o||"unknown"))}),js(()=>{for(const d of v.values())d.reject(et)}),new Promise(d=>{function p(g){function k(){g===a?d(i):p(a)}g.then(k,k)}p(a)})}function Ia(e){const t=Ds(e);return t.equals=xa,t}function Uo(e){var t=e.effects;if(t!==null){e.effects=null;for(var r=0;r<t.length;r+=1)_e(t[r])}}function Fs(e){var t,r=F,s=e.parent;if(!gt&&s!==null&&s.f&(Ne|ue))return wo(),e.v;Fe(s);try{e.f&=~Dt,Uo(e),t=ei(e)}finally{Fe(r)}return t}function ja(e){var t=Fs(e);if(!e.equals(t)&&(e.wv=Xa(),(!(T!=null&&T.is_fork)||e.deps===null)&&(T!==null?T.capture(e,t,!0):e.v=t,e.deps===null))){J(e,Z);return}gt||(ne!==null?(Is()||T!=null&&T.is_fork)&&ne.set(e,t):Rs(e))}function zo(e){var t,r;if(e.effects!==null)for(const s of e.effects)(s.teardown||s.ac)&&((t=s.teardown)==null||t.call(s),(r=s.ac)==null||r.abort(et),s.teardown=ro,s.ac=null,hr(s,0),Ls(s))}function Pa(e){if(e.effects!==null)for(const t of e.effects)t.teardown&&It(t)}let ws=new Set;const Rt=new Map;let La=!1;function Ot(e,t){var r={f:0,v:e,reactions:null,equals:Ea,rv:0,wv:0};return r}function ct(e,t){const r=Ot(e);return ic(r),r}function X(e,t=!1,r=!0){var a;const s=Ot(e);return t||(s.equals=xa),kr&&r&&B!==null&&B.l!==null&&((a=B.l).s??(a.s=[])).push(s),s}function ir(e,t){return N(e,b(()=>n(e))),t}function N(e,t,r=!1){O!==null&&(!$e||O.f&_s)&&Sr()&&O.f&(oe|Je|_r|_s)&&(Me===null||!Jt.call(Me,e))&&po();let s=r?cr(t):t;return er(e,s,Or)}function er(e,t,r=null){if(!e.equals(t)){Rt.set(e,gt?t:e.v);var s=Ft.ensure();if(s.capture(e,t),e.f&oe){const a=e;e.f&ae&&Fs(a),ne===null&&Rs(a)}e.wv=Xa(),$a(e,ae,r),Sr()&&F!==null&&F.f&Z&&!(F.f&(We|ht))&&(ke===null?lc([e]):ke.push(e)),!s.is_fork&&ws.size>0&&!La&&Ho()}return t}function Ho(){La=!1;for(const e of ws)e.f&Z&&J(e,Ve),rr(e)&&It(e);ws.clear()}function vr(e){N(e,e.v+1)}function $a(e,t,r){var s=e.reactions;if(s!==null)for(var a=Sr(),i=s.length,u=0;u<i;u++){var v=s[u],d=v.f;if(!(!a&&v===F)){var p=(d&ae)===0;if(p&&J(v,t),d&oe){var g=v;ne==null||ne.delete(g),d&Dt||(d&Re&&(F===null||!(F.f&Vr))&&(v.f|=Dt),$a(g,Ve,r))}else if(p){var k=v;d&Je&&Pe!==null&&Pe.add(k),r!==null?r.push(k):Ms(k)}}}}function cr(e){if(typeof e!="object"||e===null||Ct in e)return e;const t=Cs(e);if(t!==eo&&t!==to)return e;var r=new Map,s=As(e),a=ct(0),i=Mt,u=v=>{if(Mt===i)return v();var d=O,p=Mt;De(null),na(i);var g=v();return De(d),na(p),g};return s&&r.set("length",ct(e.length)),new Proxy(e,{defineProperty(v,d,p){(!("value"in p)||p.configurable===!1||p.enumerable===!1||p.writable===!1)&&uo();var g=r.get(d);return g===void 0?u(()=>{var k=ct(p.value);return r.set(d,k),k}):N(g,p.value,!0),!0},deleteProperty(v,d){var p=r.get(d);if(p===void 0){if(d in v){const g=u(()=>ct(re));r.set(d,g),vr(a)}}else N(p,re),vr(a);return!0},get(v,d,p){var y;if(d===Ct)return e;var g=r.get(d),k=d in v;if(g===void 0&&(!k||(y=ur(v,d))!=null&&y.writable)&&(g=u(()=>{var o=cr(k?v[d]:re),A=ct(o);return A}),r.set(d,g)),g!==void 0){var w=n(g);return w===re?void 0:w}return Reflect.get(v,d,p)},getOwnPropertyDescriptor(v,d){var p=Reflect.getOwnPropertyDescriptor(v,d);if(p&&"value"in p){var g=r.get(d);g&&(p.value=n(g))}else if(p===void 0){var k=r.get(d),w=k==null?void 0:k.v;if(k!==void 0&&w!==re)return{enumerable:!0,configurable:!0,value:w,writable:!0}}return p},has(v,d){var w;if(d===Ct)return!0;var p=r.get(d),g=p!==void 0&&p.v!==re||Reflect.has(v,d);if(p!==void 0||F!==null&&(!g||(w=ur(v,d))!=null&&w.writable)){p===void 0&&(p=u(()=>{var y=g?cr(v[d]):re,o=ct(y);return o}),r.set(d,p));var k=n(p);if(k===re)return!1}return g},set(v,d,p,g){var P;var k=r.get(d),w=d in v;if(s&&d==="length")for(var y=p;y<k.v;y+=1){var o=r.get(y+"");o!==void 0?N(o,re):y in v&&(o=u(()=>ct(re)),r.set(y+"",o))}if(k===void 0)(!w||(P=ur(v,d))!=null&&P.writable)&&(k=u(()=>ct(void 0)),N(k,cr(p)),r.set(d,k));else{w=k.v!==re;var A=u(()=>cr(p));N(k,A)}var m=Reflect.getOwnPropertyDescriptor(v,d);if(m!=null&&m.set&&m.set.call(g,p),!w){if(s&&typeof d=="string"){var C=r.get("length"),W=Number(d);Number.isInteger(W)&&W>=C.v&&N(C,W+1)}vr(a)}return!0},ownKeys(v){n(a);var d=Reflect.ownKeys(v).filter(k=>{var w=r.get(k);return w===void 0||w.v!==re});for(var[p,g]of r)g.v!==re&&!(p in v)&&d.push(p);return d},setPrototypeOf(){vo()}})}function ea(e){try{if(e!==null&&typeof e=="object"&&Ct in e)return e[Ct]}catch{}return e}function Bo(e,t){return Object.is(ea(e),ea(t))}var ta,Wa,Va,qa;function Ko(){if(ta===void 0){ta=window,Wa=/Firefox/.test(navigator.userAgent);var e=Element.prototype,t=Node.prototype,r=Text.prototype;Va=ur(t,"firstChild").get,qa=ur(t,"nextSibling").get,Jn(e)&&(e.__click=void 0,e.__className=void 0,e.__attributes=null,e.__style=void 0,e.__e=void 0),Jn(r)&&(r.__t=void 0)}}function at(e=""){return document.createTextNode(e)}function Os(e){return Va.call(e)}function Tr(e){return qa.call(e)}function _(e,t){return Os(e)}function Yo(e,t=!1){{var r=Os(e);return r instanceof Comment&&r.data===""?Tr(r):r}}function h(e,t=1,r=!1){let s=e;for(;t--;)s=Tr(s);return s}function Go(e){e.textContent=""}function Ua(){return!1}function Jo(e,t,r){return document.createElementNS(wa,e,void 0)}let ra=!1;function Qo(){ra||(ra=!0,document.addEventListener("reset",e=>{Promise.resolve().then(()=>{var t;if(!e.defaultPrevented)for(const r of e.target.elements)(t=r.__on_r)==null||t.call(r)})},{capture:!0}))}function Kr(e){var t=O,r=F;De(null),Fe(null);try{return e()}finally{De(t),Fe(r)}}function za(e,t,r,s=r){e.addEventListener(t,()=>Kr(r));const a=e.__on_r;a?e.__on_r=()=>{a(),s(!0)}:e.__on_r=()=>s(!0),Qo()}function Ha(e){F===null&&(O===null&&co(),oo()),gt&&lo()}function Xo(e,t){var r=t.last;r===null?t.last=t.first=e:(r.next=e,e.prev=r,t.last=e)}function Qe(e,t){var r=F;r!==null&&r.f&ue&&(e|=ue);var s={ctx:B,deps:null,nodes:null,f:e|ae|Re,first:null,fn:t,last:null,next:null,parent:r,b:r&&r.b,prev:null,teardown:null,wv:0,ac:null};T==null||T.register_created_effect(s);var a=s;if(e&Qt)zt!==null?zt.push(s):Ft.ensure().schedule(s);else if(t!==null){try{It(s)}catch(u){throw _e(s),u}a.deps===null&&a.teardown===null&&a.nodes===null&&a.first===a.last&&!(a.f&tr)&&(a=a.first,e&Je&&e&Xt&&a!==null&&(a.f|=Xt))}if(a!==null&&(a.parent=r,r!==null&&Xo(a,r),O!==null&&O.f&oe&&!(e&ht))){var i=O;(i.effects??(i.effects=[])).push(a)}return s}function Is(){return O!==null&&!$e}function js(e){const t=Qe(xr,null);return J(t,Z),t.teardown=e,t}function Es(e){Ha();var t=F.f,r=!O&&(t&We)!==0&&(t&jt)===0;if(r){var s=B;(s.e??(s.e=[])).push(e)}else return Ba(e)}function Ba(e){return Qe(Qt|ba,e)}function Zo(e){return Ha(),Qe(xr|ba,e)}function ec(e){Ft.ensure();const t=Qe(ht|tr,e);return(r={})=>new Promise(s=>{r.outro?Nt(t,()=>{_e(t),s(void 0)}):(_e(t),s(void 0))})}function tc(e){return Qe(Qt,e)}function xe(e,t){var r=B,s={effect:null,ran:!1,deps:e};r.l.$.push(s),s.effect=Yr(()=>{if(e(),!s.ran){s.ran=!0;var a=F;try{Fe(a.parent),b(t)}finally{Fe(a)}}})}function rc(){var e=B;Yr(()=>{for(var t of e.l.$){t.deps();var r=t.effect;r.f&Z&&r.deps!==null&&J(r,Ve),rr(r)&&It(r),t.ran=!1}})}function sc(e){return Qe(_r|tr,e)}function Yr(e,t=0){return Qe(xr|t,e)}function U(e,t=[],r=[],s=[]){Wo(s,t,r,a=>{Qe(xr,()=>e(...a.map(n)))})}function Ps(e,t=0){var r=Qe(Je|t,e);return r}function Ce(e){return Qe(We|tr,e)}function Ka(e){var t=e.teardown;if(t!==null){const r=gt,s=O;sa(!0),De(null);try{t.call(null)}finally{sa(r),De(s)}}}function Ls(e,t=!1){var r=e.first;for(e.first=e.last=null;r!==null;){const a=r.ac;a!==null&&Kr(()=>{a.abort(et)});var s=r.next;r.f&ht?r.parent=null:_e(r,t),r=s}}function nc(e){for(var t=e.first;t!==null;){var r=t.next;t.f&We||_e(t),t=r}}function _e(e,t=!0){var r=!1;(t||e.f&no)&&e.nodes!==null&&e.nodes.end!==null&&(ac(e.nodes.start,e.nodes.end),r=!0),J(e,Qn),Ls(e,t&&!r),hr(e,0);var s=e.nodes&&e.nodes.t;if(s!==null)for(const i of s)i.stop();Ka(e),e.f^=Qn,e.f|=Ne;var a=e.parent;a!==null&&a.first!==null&&Ya(e),e.next=e.prev=e.teardown=e.ctx=e.deps=e.fn=e.nodes=e.ac=e.b=null}function ac(e,t){for(;e!==null;){var r=e===t?null:Tr(e);e.remove(),e=r}}function Ya(e){var t=e.parent,r=e.prev,s=e.next;r!==null&&(r.next=s),s!==null&&(s.prev=r),t!==null&&(t.first===e&&(t.first=s),t.last===e&&(t.last=r))}function Nt(e,t,r=!0){var s=[];Ga(e,s,!0);var a=()=>{r&&_e(e),t&&t()},i=s.length;if(i>0){var u=()=>--i||a();for(var v of s)v.out(u)}else a()}function Ga(e,t,r){if(!(e.f&ue)){e.f^=ue;var s=e.nodes&&e.nodes.t;if(s!==null)for(const v of s)(v.is_global||r)&&t.push(v);for(var a=e.first;a!==null;){var i=a.next;if(!(a.f&ht)){var u=(a.f&Xt)!==0||(a.f&We)!==0&&(e.f&Je)!==0;Ga(a,t,u?r:!1)}a=i}}}function $s(e){Ja(e,!0)}function Ja(e,t){if(e.f&ue){e.f^=ue,e.f&Z||(J(e,ae),Ft.ensure().schedule(e));for(var r=e.first;r!==null;){var s=r.next,a=(r.f&Xt)!==0||(r.f&We)!==0;Ja(r,a?t:!1),r=s}var i=e.nodes&&e.nodes.t;if(i!==null)for(const u of i)(u.is_global||t)&&u.in()}}function Ws(e,t){if(e.nodes)for(var r=e.nodes.start,s=e.nodes.end;r!==null;){var a=r===s?null:Tr(r);t.append(r),r=a}}let Wr=!1,gt=!1;function sa(e){gt=e}let O=null,$e=!1;function De(e){O=e}let F=null;function Fe(e){F=e}let Me=null;function ic(e){O!==null&&(Me===null?Me=[e]:Me.push(e))}let pe=null,ge=0,ke=null;function lc(e){ke=e}let Qa=1,Et=0,Mt=Et;function na(e){Mt=e}function Xa(){return++Qa}function rr(e){var t=e.f;if(t&ae)return!0;if(t&oe&&(e.f&=~Dt),t&Ve){for(var r=e.deps,s=r.length,a=0;a<s;a++){var i=r[a];if(rr(i)&&ja(i),i.wv>e.wv)return!0}t&Re&&ne===null&&J(e,Z)}return!1}function Za(e,t,r=!0){var s=e.reactions;if(s!==null&&!(Me!==null&&Jt.call(Me,e)))for(var a=0;a<s.length;a++){var i=s[a];i.f&oe?Za(i,t,!1):t===i&&(r?J(i,ae):i.f&Z&&J(i,Ve),Ms(i))}}function ei(e){var A;var t=pe,r=ge,s=ke,a=O,i=Me,u=B,v=$e,d=Mt,p=e.f;pe=null,ge=0,ke=null,O=p&(We|ht)?null:e,Me=null,Zt(e.ctx),$e=!1,Mt=++Et,e.ac!==null&&(Kr(()=>{e.ac.abort(et)}),e.ac=null);try{e.f|=Vr;var g=e.fn,k=g();e.f|=jt;var w=e.deps,y=T==null?void 0:T.is_fork;if(pe!==null){var o;if(y||hr(e,ge),w!==null&&ge>0)for(w.length=ge+pe.length,o=0;o<pe.length;o++)w[ge+o]=pe[o];else e.deps=w=pe;if(Is()&&e.f&Re)for(o=ge;o<w.length;o++)((A=w[o]).reactions??(A.reactions=[])).push(e)}else!y&&w!==null&&ge<w.length&&(hr(e,ge),w.length=ge);if(Sr()&&ke!==null&&!$e&&w!==null&&!(e.f&(oe|Ve|ae)))for(o=0;o<ke.length;o++)Za(ke[o],e);if(a!==null&&a!==e){if(Et++,a.deps!==null)for(let m=0;m<r;m+=1)a.deps[m].rv=Et;if(t!==null)for(const m of t)m.rv=Et;ke!==null&&(s===null?s=ke:s.push(...ke))}return e.f&pt&&(e.f^=pt),k}catch(m){return Aa(m)}finally{e.f^=Vr,pe=t,ge=r,ke=s,O=a,Me=i,Zt(u),$e=v,Mt=d}}function oc(e,t){let r=t.reactions;if(r!==null){var s=Xl.call(r,e);if(s!==-1){var a=r.length-1;a===0?r=t.reactions=null:(r[s]=r[a],r.pop())}}if(r===null&&t.f&oe&&(pe===null||!Jt.call(pe,t))){var i=t;i.f&Re&&(i.f^=Re,i.f&=~Dt),i.v!==re&&Rs(i),zo(i),hr(i,0)}}function hr(e,t){var r=e.deps;if(r!==null)for(var s=t;s<r.length;s++)oc(e,r[s])}function It(e){var t=e.f;if(!(t&Ne)){J(e,Z);var r=F,s=Wr;F=e,Wr=!0;try{t&(Je|ga)?nc(e):Ls(e),Ka(e);var a=ei(e);e.teardown=typeof a=="function"?a:null,e.wv=Qa;var i;Ql&&So&&e.f&ae&&e.deps}finally{Wr=s,F=r}}}async function cc(){await Promise.resolve(),Mo()}function n(e){var t=e.f,r=(t&oe)!==0;if(O!==null&&!$e){var s=F!==null&&(F.f&Ne)!==0;if(!s&&(Me===null||!Jt.call(Me,e))){var a=O.deps;if(O.f&Vr)e.rv<Et&&(e.rv=Et,pe===null&&a!==null&&a[ge]===e?ge++:pe===null?pe=[e]:pe.push(e));else{(O.deps??(O.deps=[])).push(e);var i=e.reactions;i===null?e.reactions=[O]:Jt.call(i,O)||i.push(O)}}}if(gt&&Rt.has(e))return Rt.get(e);if(r){var u=e;if(gt){var v=u.v;return(!(u.f&Z)&&u.reactions!==null||ri(u))&&(v=Fs(u)),Rt.set(u,v),v}var d=(u.f&Re)===0&&!$e&&O!==null&&(Wr||(O.f&Re)!==0),p=(u.f&jt)===0;rr(u)&&(d&&(u.f|=Re),ja(u)),d&&!p&&(Pa(u),ti(u))}if(ne!=null&&ne.has(e))return ne.get(e);if(e.f&pt)throw e.v;return e.v}function ti(e){if(e.f|=Re,e.deps!==null)for(const t of e.deps)(t.reactions??(t.reactions=[])).push(e),t.f&oe&&!(t.f&Re)&&(Pa(t),ti(t))}function ri(e){if(e.v===re)return!0;if(e.deps===null)return!1;for(const t of e.deps)if(Rt.has(t)||t.f&oe&&ri(t))return!0;return!1}function b(e){var t=$e;try{return $e=!0,e()}finally{$e=t}}function fc(e){if(!(typeof e!="object"||!e||e instanceof EventTarget)){if(Ct in e)xs(e);else if(!Array.isArray(e))for(let t in e){const r=e[t];typeof r=="object"&&r&&Ct in r&&xs(r)}}}function xs(e,t=new Set){if(typeof e=="object"&&e!==null&&!(e instanceof EventTarget)&&!t.has(e)){t.add(e),e instanceof Date&&e.getTime();for(let s in e)try{xs(e[s],t)}catch{}const r=Cs(e);if(r!==Object.prototype&&r!==Array.prototype&&r!==Map.prototype&&r!==Set.prototype&&r!==Date.prototype){const s=_a(r);for(let a in s){const i=s[a].get;if(i)try{i.call(e)}catch{}}}}}const uc=["touchstart","touchmove"];function dc(e){return uc.includes(e)}const Nr=Symbol("events"),vc=new Set,aa=new Set;function pc(e,t,r,s={}){function a(i){if(s.capture||ks.call(t,i),!i.cancelBubble)return Kr(()=>r==null?void 0:r.call(this,i))}return e.startsWith("pointer")||e.startsWith("touch")||e==="wheel"?_t(()=>{t.addEventListener(e,a,s)}):t.addEventListener(e,a,s),a}function Mr(e,t,r,s,a){var i={capture:s,passive:a},u=pc(e,t,r,i);(t===document.body||t===window||t===document||t instanceof HTMLMediaElement)&&js(()=>{t.removeEventListener(e,u,i)})}let ia=null;function ks(e){var m,C;var t=this,r=t.ownerDocument,s=e.type,a=((m=e.composedPath)==null?void 0:m.call(e))||[],i=a[0]||e.target;ia=e;var u=0,v=ia===e&&e[Nr];if(v){var d=a.indexOf(v);if(d!==-1&&(t===document||t===window)){e[Nr]=t;return}var p=a.indexOf(t);if(p===-1)return;d<=p&&(u=d)}if(i=a[u]||e.target,i!==t){Zl(e,"currentTarget",{configurable:!0,get(){return i||r}});var g=O,k=F;De(null),Fe(null);try{for(var w,y=[];i!==null;){var o=i.assignedSlot||i.parentNode||i.host||null;try{var A=(C=i[Nr])==null?void 0:C[s];A!=null&&(!i.disabled||e.target===i)&&A.call(i,e)}catch(W){w?y.push(W):w=W}if(e.cancelBubble||o===t||o===null)break;i=o}if(w){for(let W of y)queueMicrotask(()=>{throw W});throw w}}finally{e[Nr]=t,delete e.currentTarget,De(g),Fe(k)}}}var va;const cs=((va=globalThis==null?void 0:globalThis.window)==null?void 0:va.trustedTypes)&&globalThis.window.trustedTypes.createPolicy("svelte-trusted-html",{createHTML:e=>e});function _c(e){return(cs==null?void 0:cs.createHTML(e))??e}function hc(e){var t=Jo("template");return t.innerHTML=_c(e.replaceAll("<!>","<!---->")),t.content}function Vs(e,t){var r=F;r.nodes===null&&(r.nodes={start:e,end:t,a:null,t:null})}function V(e,t){var r=(t&yo)!==0,s,a=!e.startsWith("<!>");return()=>{s===void 0&&(s=hc(a?e:"<!>"+e),s=Os(s));var i=r||Wa?document.importNode(s,!0):s.cloneNode(!0);return Vs(i,i),i}}function la(e=""){{var t=at(e+"");return Vs(t,t),t}}function gc(){var e=document.createDocumentFragment(),t=document.createComment(""),r=at();return e.append(t,r),Vs(t,r),e}function L(e,t){e!==null&&e.before(t)}function x(e,t){var r=t==null?"":typeof t=="object"?`${t}`:t;r!==(e.__t??(e.__t=e.nodeValue))&&(e.__t=r,e.nodeValue=`${r}`)}function bc(e,t){return mc(e,t)}const Dr=new Map;function mc(e,{target:t,anchor:r,props:s={},events:a,context:i,intro:u=!0,transformError:v}){Ko();var d=void 0,p=ec(()=>{var g=r??t.appendChild(at());Io(g,{pending:()=>{}},y=>{ka({});var o=B;i&&(o.c=i),a&&(s.$$events=a),d=e(y,s)||{},Sa()},v);var k=new Set,w=y=>{for(var o=0;o<y.length;o++){var A=y[o];if(!k.has(A)){k.add(A);var m=dc(A);for(const P of[t,document]){var C=Dr.get(P);C===void 0&&(C=new Map,Dr.set(P,C));var W=C.get(A);W===void 0?(P.addEventListener(A,ks,{passive:m}),C.set(A,1)):C.set(A,W+1)}}}};return w(Br(vc)),aa.add(w),()=>{var m;for(var y of k)for(const C of[t,document]){var o=Dr.get(C),A=o.get(y);--A==0?(C.removeEventListener(y,ks),o.delete(y),o.size===0&&Dr.delete(C)):o.set(y,A)}aa.delete(w),g!==r&&((m=g.parentNode)==null||m.removeChild(g))}});return yc.set(d,p),d}let yc=new WeakMap;var Le,Ye,ye,At,wr,Er,Hr;class wc{constructor(t,r=!0){je(this,"anchor");M(this,Le,new Map);M(this,Ye,new Map);M(this,ye,new Map);M(this,At,new Set);M(this,wr,!0);M(this,Er,t=>{if(c(this,Le).has(t)){var r=c(this,Le).get(t),s=c(this,Ye).get(r);if(s)$s(s),c(this,At).delete(r);else{var a=c(this,ye).get(r);a&&(c(this,Ye).set(r,a.effect),c(this,ye).delete(r),a.fragment.lastChild.remove(),this.anchor.before(a.fragment),s=a.effect)}for(const[i,u]of c(this,Le)){if(c(this,Le).delete(i),i===t)break;const v=c(this,ye).get(u);v&&(_e(v.effect),c(this,ye).delete(u))}for(const[i,u]of c(this,Ye)){if(i===r||c(this,At).has(i))continue;const v=()=>{if(Array.from(c(this,Le).values()).includes(i)){var p=document.createDocumentFragment();Ws(u,p),p.append(at()),c(this,ye).set(i,{effect:u,fragment:p})}else _e(u);c(this,At).delete(i),c(this,Ye).delete(i)};c(this,wr)||!s?(c(this,At).add(i),Nt(u,v,!1)):v()}}});M(this,Hr,t=>{c(this,Le).delete(t);const r=Array.from(c(this,Le).values());for(const[s,a]of c(this,ye))r.includes(s)||(_e(a.effect),c(this,ye).delete(s))});this.anchor=t,D(this,wr,r)}ensure(t,r){var s=T,a=Ua();if(r&&!c(this,Ye).has(t)&&!c(this,ye).has(t))if(a){var i=document.createDocumentFragment(),u=at();i.append(u),c(this,ye).set(t,{effect:Ce(()=>r(u)),fragment:i})}else c(this,Ye).set(t,Ce(()=>r(this.anchor)));if(c(this,Le).set(s,t),a){for(const[v,d]of c(this,Ye))v===t?s.unskip_effect(d):s.skip_effect(d);for(const[v,d]of c(this,ye))v===t?s.unskip_effect(d.effect):s.skip_effect(d.effect);s.oncommit(c(this,Er)),s.ondiscard(c(this,Hr))}else c(this,Er).call(this,s)}}Le=new WeakMap,Ye=new WeakMap,ye=new WeakMap,At=new WeakMap,wr=new WeakMap,Er=new WeakMap,Hr=new WeakMap;function ce(e,t,r=!1){var s=new wc(e),a=r?Xt:0;function i(u,v){s.ensure(u,v)}Ps(()=>{var u=!1;t((v,d=0)=>{u=!0,i(d,v)}),u||i(-1,null)},a)}function Ec(e,t,r){for(var s=[],a=t.length,i,u=t.length,v=0;v<a;v++){let k=t[v];Nt(k,()=>{if(i){if(i.pending.delete(k),i.done.add(k),i.pending.size===0){var w=e.outrogroups;Ss(e,Br(i.done)),w.delete(i),w.size===0&&(e.outrogroups=null)}}else u-=1},!1)}if(u===0){var d=s.length===0&&r!==null;if(d){var p=r,g=p.parentNode;Go(g),g.append(p),e.items.clear()}Ss(e,t,!d)}else i={pending:new Set(t),done:new Set},(e.outrogroups??(e.outrogroups=new Set)).add(i)}function Ss(e,t,r=!0){var s;if(e.pending.size>0){s=new Set;for(const u of e.pending.values())for(const v of u)s.add(e.items.get(v).e)}for(var a=0;a<t.length;a++){var i=t[a];if(s!=null&&s.has(i)){i.f|=Ge;const u=document.createDocumentFragment();Ws(i,u)}else _e(t[a],r)}}var oa;function Ut(e,t,r,s,a,i=null){var u=e,v=new Map,d=(t&ya)!==0;if(d){var p=e;u=p.appendChild(at())}var g=null,k=Ia(()=>{var P=r();return As(P)?P:P==null?[]:Br(P)}),w,y=new Map,o=!0;function A(P){W.effect.f&Ne||(W.pending.delete(P),W.fallback=g,xc(W,w,u,t,s),g!==null&&(w.length===0?g.f&Ge?(g.f^=Ge,fr(g,null,u)):$s(g):Nt(g,()=>{g=null})))}function m(P){W.pending.delete(P)}var C=Ps(()=>{w=n(k);for(var P=w.length,K=new Set,ie=T,qe=Ua(),I=0;I<P;I+=1){var Xe=w[I],it=s(Xe,I),de=o?null:v.get(it);de?(de.v&&er(de.v,Xe),de.i&&er(de.i,I),qe&&ie.unskip_effect(de.e)):(de=kc(v,o?u:oa??(oa=at()),Xe,it,I,a,t,r),o||(de.e.f|=Ge),v.set(it,de)),K.add(it)}if(P===0&&i&&!g&&(o?g=Ce(()=>i(u)):(g=Ce(()=>i(oa??(oa=at()))),g.f|=Ge)),P>K.size&&io(),!o)if(y.set(ie,K),qe){for(const[Ue,Pt]of v)K.has(Ue)||ie.skip_effect(Pt.e);ie.oncommit(A),ie.ondiscard(m)}else A(ie);n(k)}),W={effect:C,items:v,pending:y,outrogroups:null,fallback:g};o=!1}function lr(e){for(;e!==null&&!(e.f&We);)e=e.next;return e}function xc(e,t,r,s,a){var de,Ue,Pt,Lt,sr,bt,Ar,$t,nr;var i=(s&bo)!==0,u=t.length,v=e.items,d=lr(e.effect.first),p,g=null,k,w=[],y=[],o,A,m,C;if(i)for(C=0;C<u;C+=1)o=t[C],A=a(o,C),m=v.get(A).e,m.f&Ge||((Ue=(de=m.nodes)==null?void 0:de.a)==null||Ue.measure(),(k??(k=new Set)).add(m));for(C=0;C<u;C+=1){if(o=t[C],A=a(o,C),m=v.get(A).e,e.outrogroups!==null)for(const we of e.outrogroups)we.pending.delete(m),we.done.delete(m);if(m.f&ue&&($s(m),i&&((Lt=(Pt=m.nodes)==null?void 0:Pt.a)==null||Lt.unfix(),(k??(k=new Set)).delete(m))),m.f&Ge)if(m.f^=Ge,m===d)fr(m,null,r);else{var W=g?g.next:d;m===e.effect.last&&(e.effect.last=m.prev),m.prev&&(m.prev.next=m.next),m.next&&(m.next.prev=m.prev),ft(e,g,m),ft(e,m,W),fr(m,W,r),g=m,w=[],y=[],d=lr(g.next);continue}if(m!==d){if(p!==void 0&&p.has(m)){if(w.length<y.length){var P=y[0],K;g=P.prev;var ie=w[0],qe=w[w.length-1];for(K=0;K<w.length;K+=1)fr(w[K],P,r);for(K=0;K<y.length;K+=1)p.delete(y[K]);ft(e,ie.prev,qe.next),ft(e,g,ie),ft(e,qe,P),d=P,g=qe,C-=1,w=[],y=[]}else p.delete(m),fr(m,d,r),ft(e,m.prev,m.next),ft(e,m,g===null?e.effect.first:g.next),ft(e,g,m),g=m;continue}for(w=[],y=[];d!==null&&d!==m;)(p??(p=new Set)).add(d),y.push(d),d=lr(d.next);if(d===null)continue}m.f&Ge||w.push(m),g=m,d=lr(m.next)}if(e.outrogroups!==null){for(const we of e.outrogroups)we.pending.size===0&&(Ss(e,Br(we.done)),(sr=e.outrogroups)==null||sr.delete(we));e.outrogroups.size===0&&(e.outrogroups=null)}if(d!==null||p!==void 0){var I=[];if(p!==void 0)for(m of p)m.f&ue||I.push(m);for(;d!==null;)!(d.f&ue)&&d!==e.fallback&&I.push(d),d=lr(d.next);var Xe=I.length;if(Xe>0){var it=s&ya&&u===0?r:null;if(i){for(C=0;C<Xe;C+=1)(Ar=(bt=I[C].nodes)==null?void 0:bt.a)==null||Ar.measure();for(C=0;C<Xe;C+=1)(nr=($t=I[C].nodes)==null?void 0:$t.a)==null||nr.fix()}Ec(e,I,it)}}i&&_t(()=>{var we,ar;if(k!==void 0)for(m of k)(ar=(we=m.nodes)==null?void 0:we.a)==null||ar.apply()})}function kc(e,t,r,s,a,i,u,v){var d=u&ho?u&mo?Ot(r):X(r,!1,!1):null,p=u&go?Ot(a):null;return{v:d,i:p,e:Ce(()=>(i(t,d??r,p??a,v),()=>{e.delete(s)}))}}function fr(e,t,r){if(e.nodes)for(var s=e.nodes.start,a=e.nodes.end,i=t&&!(t.f&Ge)?t.nodes.start:r;s!==null;){var u=Tr(s);if(i.before(s),s===a)return;s=u}}function ft(e,t,r){t===null?e.effect.first=r:t.next=r,r===null?e.effect.last=t:r.prev=t}const ca=[...`
|
|
2
|
+
\r\f \v\uFEFF`];function Sc(e,t,r){var s=e==null?"":""+e;if(r){for(var a of Object.keys(r))if(r[a])s=s?s+" "+a:a;else if(s.length)for(var i=a.length,u=0;(u=s.indexOf(a,u))>=0;){var v=u+i;(u===0||ca.includes(s[u-1]))&&(v===s.length||ca.includes(s[v]))?s=(u===0?"":s.substring(0,u))+s.substring(v+1):u=v}}return s===""?null:s}function Tc(e,t){return e==null?null:String(e)}function or(e,t,r,s,a,i){var u=e.__className;if(u!==r||u===void 0){var v=Sc(r,s,i);v==null?e.removeAttribute("class"):e.className=v,e.__className=r}else if(i&&a!==i)for(var d in i){var p=!!i[d];(a==null||p!==!!a[d])&&e.classList.toggle(d,p)}return i}function fa(e,t,r,s){var a=e.__style;if(a!==t){var i=Tc(t);i==null?e.removeAttribute("style"):e.style.cssText=i,e.__style=t}return s}function si(e,t,r=!1){if(e.multiple){if(t==null)return;if(!As(t))return Eo();for(var s of e.options)s.selected=t.includes(pr(s));return}for(s of e.options){var a=pr(s);if(Bo(a,t)){s.selected=!0;return}}(!r||t!==void 0)&&(e.selectedIndex=-1)}function Ac(e){var t=new MutationObserver(()=>{si(e,e.__value)});t.observe(e,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["value"]}),js(()=>{t.disconnect()})}function fs(e,t,r=t){var s=new WeakSet,a=!0;za(e,"change",i=>{var u=i?"[selected]":":checked",v;if(e.multiple)v=[].map.call(e.querySelectorAll(u),pr);else{var d=e.querySelector(u)??e.querySelector("option:not([disabled])");v=d&&pr(d)}r(v),e.__value=v,T!==null&&s.add(T)}),tc(()=>{var i=t();if(e===document.activeElement){var u=T;if(s.has(u))return}if(si(e,i,a),a&&i===void 0){var v=e.querySelector(":checked");v!==null&&(i=pr(v),r(i))}e.__value=i,a=!1}),Ac(e)}function pr(e){return"__value"in e?e.__value:e.value}const Cc=Symbol("is custom element"),Rc=Symbol("is html");function Nc(e,t,r,s){var a=Mc(e);a[t]!==(a[t]=r)&&(r==null?e.removeAttribute(t):typeof r!="string"&&Dc(e).includes(t)?e[t]=r:e.setAttribute(t,r))}function Mc(e){return e.__attributes??(e.__attributes={[Cc]:e.nodeName.includes("-"),[Rc]:e.namespaceURI===wa})}var ua=new Map;function Dc(e){var t=e.getAttribute("is")||e.nodeName,r=ua.get(t);if(r)return r;ua.set(t,r=[]);for(var s,a=e,i=Element.prototype;i!==a;){s=_a(a);for(var u in s)s[u].set&&r.push(u);a=Cs(a)}return r}function Fr(e,t,r=t){var s=new WeakSet;za(e,"input",async a=>{var i=a?e.defaultValue:e.value;if(i=us(e)?ds(i):i,r(i),T!==null&&s.add(T),await cc(),i!==(i=t())){var u=e.selectionStart,v=e.selectionEnd,d=e.value.length;if(e.value=i??"",v!==null){var p=e.value.length;u===v&&v===d&&p>d?(e.selectionStart=p,e.selectionEnd=p):(e.selectionStart=u,e.selectionEnd=Math.min(v,p))}}}),b(t)==null&&e.value&&(r(us(e)?ds(e.value):e.value),T!==null&&s.add(T)),Yr(()=>{var a=t();if(e===document.activeElement){var i=T;if(s.has(i))return}us(e)&&a===ds(e.value)||e.type==="date"&&!a&&!e.value||a!==e.value&&(e.value=a??"")})}function us(e){var t=e.type;return t==="number"||t==="range"}function ds(e){return e===""?null:+e}function Fc(e){return function(...t){var r=t[0];return r.preventDefault(),e==null?void 0:e.apply(this,t)}}function Oc(e=!1){const t=B,r=t.l.u;if(!r)return;let s=()=>fc(t.s);if(e){let a=0,i={};const u=Ds(()=>{let v=!1;const d=t.s;for(const p in d)d[p]!==i[p]&&(i[p]=d[p],v=!0);return v&&a++,a});s=()=>n(u)}r.b.length&&Zo(()=>{da(t,s),vs(r.b)}),Es(()=>{const a=b(()=>r.m.map(so));return()=>{for(const i of a)typeof i=="function"&&i()}}),r.a.length&&Es(()=>{da(t,s),vs(r.a)})}function da(e,t){if(e.l.s)for(const r of e.l.s)n(r);t()}function Ic(e){B===null&&ma(),kr&&B.l!==null?Pc(B).m.push(e):Es(()=>{const t=b(e);if(typeof t=="function")return t})}function jc(e){B===null&&ma(),Ic(()=>()=>b(e))}function Pc(e){var t=e.l;return t.u??(t.u={a:[],b:[],m:[]})}const Lc="5";var pa;typeof window<"u"&&((pa=window.__svelte??(window.__svelte={})).v??(pa.v=new Set)).add(Lc);To();var $c=V('<div class="svelte-d3ct2b"><span class="svelte-d3ct2b">Watch issue</span><strong class="status-warn svelte-d3ct2b"> </strong></div>'),Wc=V('<section class="notice svelte-d3ct2b"> </section>'),Vc=V('<section class="notice danger svelte-d3ct2b"> </section>'),qc=V('<p class="terminal-line svelte-d3ct2b"><time class="svelte-d3ct2b">--:--:--</time><span class="sys svelte-d3ct2b">SYS</span><strong class="svelte-d3ct2b">Waiting for memory-core watch output...</strong></p>'),Uc=V('<strong class="svelte-d3ct2b"> </strong>'),zc=V('<strong class="svelte-d3ct2b"> </strong>'),Hc=V('<strong class="svelte-d3ct2b"> </strong>'),Bc=V('<strong class="svelte-d3ct2b"> </strong>'),Kc=V('<strong class="svelte-d3ct2b"> </strong>'),Yc=V('<p class="svelte-d3ct2b"><b class="svelte-d3ct2b">Why:</b> </p>'),Gc=V('<p class="svelte-d3ct2b"><b class="svelte-d3ct2b">Issue:</b> </p>'),Jc=V('<p class="svelte-d3ct2b"><b class="svelte-d3ct2b">Fix:</b> </p>'),Qc=V('<pre class="svelte-d3ct2b"> </pre>'),Xc=V('<div class="terminal-detail svelte-d3ct2b"><p class="svelte-d3ct2b"> </p> <p class="svelte-d3ct2b"><b class="svelte-d3ct2b">Rule:</b> </p> <!> <!> <!> <!></div>'),Zc=V('<section><p class="terminal-line svelte-d3ct2b"><time class="svelte-d3ct2b"> </time> <span class="svelte-d3ct2b"> </span> <!></p> <!></section>'),ef=V('<div class="metric-row svelte-d3ct2b"><div class="svelte-d3ct2b"><span class="svelte-d3ct2b"> </span> <strong class="svelte-d3ct2b"> </strong></div> <i class="svelte-d3ct2b"></i></div>'),tf=V('<p class="empty svelte-d3ct2b">No rule counters yet.</p>'),rf=V('<div class="metric-row warning svelte-d3ct2b"><div class="svelte-d3ct2b"><span class="svelte-d3ct2b"> </span> <strong class="svelte-d3ct2b"> </strong></div> <i class="svelte-d3ct2b"></i></div>'),sf=V('<p class="empty svelte-d3ct2b">No file counters yet.</p>'),nf=V('<small class="svelte-d3ct2b"> </small>'),af=V('<small class="svelte-d3ct2b"> </small>'),lf=V('<section class="commit-item svelte-d3ct2b"><div class="commit-meta svelte-d3ct2b"><span> </span> <time> </time></div> <strong class="svelte-d3ct2b"> </strong> <p class="svelte-d3ct2b"> </p> <!> <!></section>'),of=V('<article class="glass-panel commit-watch svelte-d3ct2b"><div class="card-head svelte-d3ct2b"><h2 class="svelte-d3ct2b">Commit Watch</h2> <span class="svelte-d3ct2b"> </span></div> <div class="commit-list svelte-d3ct2b"></div></article>'),cf=V('<small class="svelte-d3ct2b"> </small>'),ff=V('<div class="rule-item svelte-d3ct2b"><div><div class="rule-meta svelte-d3ct2b"><span class="svelte-d3ct2b"> </span> <code class="svelte-d3ct2b"> </code></div> <p class="svelte-d3ct2b"> </p> <!></div> <button class="svelte-d3ct2b">Delete</button></div>'),uf=V('<p class="empty svelte-d3ct2b">No rules match the current filters.</p>'),df=V('<div class="command-center svelte-d3ct2b"><aside class="sidebar svelte-d3ct2b"><div class="brand svelte-d3ct2b"><h1 class="svelte-d3ct2b">memory-core</h1> <span class="svelte-d3ct2b">command center</span></div> <nav aria-label="Dashboard navigation" class="svelte-d3ct2b"><a class="nav-item active svelte-d3ct2b" href="/"><span class="nav-icon svelte-d3ct2b">[]</span> <span>Command Center</span></a></nav> <div class="sidebar-footer svelte-d3ct2b"><div><i class="svelte-d3ct2b"></i> </div> <small class="svelte-d3ct2b"> </small></div></aside> <div class="workspace svelte-d3ct2b"><header class="topbar svelte-d3ct2b"><div class="topbar-left svelte-d3ct2b"><button class="icon-button mobile-menu svelte-d3ct2b" aria-label="Menu">=</button> <div><i class="svelte-d3ct2b"></i> <span> </span></div></div> <div class="header-metrics svelte-d3ct2b" aria-label="Global metrics"><div class="svelte-d3ct2b"><span class="svelte-d3ct2b">Violations</span> <strong class="svelte-d3ct2b"> </strong></div> <div class="svelte-d3ct2b"><span class="svelte-d3ct2b">Files</span> <strong class="svelte-d3ct2b"> </strong></div> <div class="svelte-d3ct2b"><span class="svelte-d3ct2b">Rules</span> <strong class="svelte-d3ct2b"> </strong></div></div> <div class="top-actions svelte-d3ct2b" aria-label="Status shortcuts"><button class="icon-button svelte-d3ct2b" title="Refresh from current path" aria-label="Refresh from current path">REF</button> <button class="icon-button svelte-d3ct2b" title="Clear dashboard cache" aria-label="Clear dashboard cache">CLR</button></div></header> <main class="canvas svelte-d3ct2b"><section class="status-grid svelte-d3ct2b"><article class="glass-panel status-card svelte-d3ct2b"><div class="card-head svelte-d3ct2b"><h2 class="svelte-d3ct2b">Project</h2> <span class="svelte-d3ct2b"> </span></div> <div class="data-list svelte-d3ct2b"><div class="svelte-d3ct2b"><span class="svelte-d3ct2b">Name</span><strong class="svelte-d3ct2b"> </strong></div> <div class="svelte-d3ct2b"><span class="svelte-d3ct2b">Type</span><strong class="svelte-d3ct2b"> </strong></div> <div class="svelte-d3ct2b"><span class="svelte-d3ct2b">Language</span><strong class="svelte-d3ct2b"> </strong></div> <div class="svelte-d3ct2b"><span class="svelte-d3ct2b">Architecture</span><strong class="svelte-d3ct2b"> </strong></div> <div class="svelte-d3ct2b"><span class="svelte-d3ct2b">Path</span><strong class="svelte-d3ct2b"> </strong></div> <div class="svelte-d3ct2b"><span class="svelte-d3ct2b">Watcher</span><strong class="svelte-d3ct2b"> </strong></div> <!></div></article> <article class="glass-panel status-card svelte-d3ct2b"><div class="card-head svelte-d3ct2b"><h2 class="svelte-d3ct2b">Runtime</h2> <span class="svelte-d3ct2b"> </span></div> <div class="data-list svelte-d3ct2b"><div class="svelte-d3ct2b"><span class="svelte-d3ct2b">Provider</span><strong class="svelte-d3ct2b"> </strong></div> <div class="svelte-d3ct2b"><span class="svelte-d3ct2b">Check model</span><strong class="svelte-d3ct2b"> </strong></div> <div class="svelte-d3ct2b"><span class="svelte-d3ct2b">Check status</span> <strong><!></strong></div> <div class="svelte-d3ct2b"><span class="svelte-d3ct2b">Embedding</span><strong class="svelte-d3ct2b"> </strong></div> <div class="svelte-d3ct2b"><span class="svelte-d3ct2b">Ollama URL</span><strong class="svelte-d3ct2b"> </strong></div></div></article> <article class="glass-panel status-card svelte-d3ct2b"><div class="card-head svelte-d3ct2b"><h2 class="svelte-d3ct2b">PostgreSQL</h2> <span> </span></div> <div class="data-list svelte-d3ct2b"><div class="svelte-d3ct2b"><span class="svelte-d3ct2b">Database</span><strong class="svelte-d3ct2b"> </strong></div> <div class="svelte-d3ct2b"><span class="svelte-d3ct2b">User</span><strong class="svelte-d3ct2b"> </strong></div> <div class="svelte-d3ct2b"><span class="svelte-d3ct2b">Host</span><strong class="svelte-d3ct2b"> </strong></div> <div class="svelte-d3ct2b"><span class="svelte-d3ct2b">URL</span><strong class="svelte-d3ct2b"> </strong></div></div></article></section> <!> <!> <section class="terminal-panel glass-panel svelte-d3ct2b"><div class="terminal-head svelte-d3ct2b"><div class="svelte-d3ct2b"><span class="terminal-icon svelte-d3ct2b">>_</span> <h2 class="svelte-d3ct2b">Live Feed</h2></div> <div class="window-dots svelte-d3ct2b" aria-hidden="true"><i class="svelte-d3ct2b"></i><i class="svelte-d3ct2b"></i><i class="svelte-d3ct2b"></i></div></div> <div class="terminal-body svelte-d3ct2b"><!> <!></div></section> <section class="content-grid svelte-d3ct2b"><article class="glass-panel stats-panel svelte-d3ct2b"><div class="card-head svelte-d3ct2b"><h2 class="svelte-d3ct2b">Stats</h2> <span class="svelte-d3ct2b">Recorded</span></div> <div class="stat-block svelte-d3ct2b"><h3 class="svelte-d3ct2b">Most Violated Rules</h3> <!></div> <div class="stat-block svelte-d3ct2b"><h3 class="svelte-d3ct2b">Problem Files</h3> <!></div> <div class="summary-strip svelte-d3ct2b"><div class="svelte-d3ct2b"><span class="svelte-d3ct2b">Clean</span><strong class="svelte-d3ct2b"> </strong></div> <div class="svelte-d3ct2b"><span class="svelte-d3ct2b">Issues</span><strong class="svelte-d3ct2b"> </strong></div> <div class="svelte-d3ct2b"><span class="svelte-d3ct2b">Events</span><strong class="svelte-d3ct2b"> </strong></div></div></article> <!> <article class="glass-panel rule-engine svelte-d3ct2b"><div class="card-head svelte-d3ct2b"><h2 class="svelte-d3ct2b">Rule Engine</h2> <span class="svelte-d3ct2b"> </span></div> <form class="rule-form svelte-d3ct2b"><div class="control-grid svelte-d3ct2b"><select class="svelte-d3ct2b"><option>Rule</option><option>Decision</option><option>Pattern</option><option>Ignore</option></select> <select class="svelte-d3ct2b"><option>Project</option><option>Global</option></select></div> <textarea rows="3" placeholder="Rule or decision" class="svelte-d3ct2b"></textarea> <div class="control-grid svelte-d3ct2b"><input placeholder="Reason" class="svelte-d3ct2b"/> <input placeholder="Tags" class="svelte-d3ct2b"/></div> <button class="svelte-d3ct2b"> </button></form> <div class="control-grid filters svelte-d3ct2b"><select class="svelte-d3ct2b"><option>All types</option><option>Rules</option><option>Decisions</option><option>Patterns</option><option>Ignores</option></select> <input placeholder="Search rules..." class="svelte-d3ct2b"/></div> <div class="rule-list svelte-d3ct2b"></div></article></section></main></div></div>');function vf(e,t){ka(t,!1);const r=X(),s=X(),a=X(),i=X(),u=X(),v=X(),d=X(),p=X(),g=X(),k=X(),w=X(),y=X();let o=X({config:null,stats:{rules:{},files:{},topRules:[],topFiles:[]},files:[],memories:[]}),A=X([]),m=X(!1),C=X("all"),W=X(""),P=X(!1),K=X(""),ie,qe=!1,I=X({type:"rule",scope:"project",content:"",reason:"",tags:"dashboard"});const Xe=24*60*60*1e3,it=()=>{var S,R;const l=(R=(S=n(o).runtime)==null?void 0:S.project.name)==null?void 0:R.trim();if(l)return l;const f=Ue("projectName");return f||"memory-core"},de=l=>{if(!l)return null;const f=l.trim().toLowerCase();return{angular:"angular",express:"express",fastify:"fastify",go:"go-api",laravel:"laravel-service-repository",nestjs:"nestjs","next.js":"nextjs","nuxt.js":"nuxt",react:"react","react native":"react-native",svelte:"svelte","vue.js":"vue"}[f]??null},Ue=l=>{var S;const f=(S=n(o).config)==null?void 0:S[l];return typeof f=="string"&&f.trim().length>0?f.trim():void 0},Pt=()=>{var E,$,Ee,lt,ot;const l=((E=n(o).runtime)==null?void 0:E.project.declaredArchitectures)??[],f=(($=n(o).runtime)==null?void 0:$.project.activeArchitectures)??[],S=(Ee=n(o).runtime)==null?void 0:Ee.project.backendArchitecture,R=(lt=n(o).runtime)==null?void 0:lt.project.frontendFramework,z=Ue("backendArchitecture")??Ue("backendArch"),te=Ue("frontendFramework")??Ue("frontendFw"),le=de((ot=n(o).runtime)==null?void 0:ot.project.detected.framework),j=[...new Set([...l,...f,S,R,z,te,le??void 0].filter(Ze=>typeof Ze=="string"&&Ze.length>0))];return j.length>0?j.join(", "):"none"};function Lt(l){N(A,[{...l,id:crypto.randomUUID()},...n(A)].slice(0,80))}function sr(l){return l.type==="saved"?{type:"saved",timestamp:l.timestamp,file:l.file}:l.type==="clean"?{type:"clean",timestamp:l.timestamp,file:l.file}:l.type==="skipped"?{type:"skipped",timestamp:l.timestamp,file:l.file,reason:l.reason}:l.type==="violations"?{type:"violations",timestamp:l.timestamp,file:l.file,violations:l.violations}:l.type==="error"?{type:"error",timestamp:l.timestamp,message:l.message}:l.type==="ready"?{type:"system",timestamp:l.timestamp,message:`Watching ${l.path} | ${l.rules} rules | ${l.model}`}:{type:"system",timestamp:l.timestamp,message:"Watch stopped"}}function bt(l){const f=n(o).files??[],S=f.findIndex(z=>z.file===l.file),R=f.slice();return S===-1?R.push(l):R[S]=l,R.sort((z,te)=>te.lastSeen.localeCompare(z.lastSeen))}function Ar(l){const f=n(o).watcher??{enabled:!0,running:!1,path:void 0,model:void 0,rules:void 0,lastEventAt:void 0,error:void 0};let S=n(o).files,R={...f,lastEventAt:l.timestamp,enabled:!0};l.type==="ready"&&(R={...R,running:!0,error:void 0,path:l.path,model:l.model,rules:l.rules}),l.type==="saved"&&(S=bt({file:l.file,status:"checking",lastSeen:l.timestamp,violations:[]})),l.type==="clean"&&(S=bt({file:l.file,status:"clean",lastSeen:l.timestamp,violations:[]})),l.type==="skipped"&&(S=bt({file:l.file,status:"skipped",lastSeen:l.timestamp,violations:[],message:l.reason})),l.type==="violations"&&(S=bt({file:l.file,status:"violations",lastSeen:l.timestamp,violations:l.violations})),l.type==="error"&&(R={...R,running:!1,error:l.message}),l.type==="stopped"&&(R={...R,running:!1});const z=[l,...n(o).events??[]].slice(0,100);N(o,{...n(o),files:S,events:z,watcher:R})}function $t(l=[]){N(A,l.map(sr).map(f=>({...f,id:crypto.randomUUID()})).reverse().slice(0,80))}function nr(l){return new Intl.DateTimeFormat(void 0,{hour:"2-digit",minute:"2-digit",second:"2-digit"}).format(new Date(l))}function we(l){return Math.max(1,...l.map(f=>f.count))}function ar(l,f){const S=l.file||f;return l.line?`${S}:${l.line}`:S}function ni(l){return l.type==="saved"?"SAVE":l.type==="clean"?"OK":l.type==="skipped"?"SKIP":l.type==="violations"?"FAIL":l.type==="error"?"WARN":"SYS"}async function Cr(){const l=await fetch(`/api/snapshot?t=${Date.now()}`,{cache:"no-store"});N(o,await l.json()),$t(n(o).events)}async function ai(){N(K,"");try{const l=await fetch("/api/refresh",{method:"POST",headers:{"content-type":"application/json"},cache:"no-store"});if(!l.ok)throw new Error((await l.json()).error??"Refresh failed");const f=await l.json();f.snapshot?(N(o,f.snapshot),$t(n(o).events)):await Cr()}catch(l){N(K,l.message)}}function ii(){try{localStorage.clear(),sessionStorage.clear()}finally{location.reload()}}async function li(){if(!qe&&document.visibilityState!=="hidden"){qe=!0;try{const l=await fetch("/api/stats",{cache:"no-store"});if(!l.ok)return;const f=await l.json();if(!f.stats)return;N(o,{...n(o),stats:f.stats})}catch{}finally{qe=!1}}}function oi(){ie&&clearInterval(ie),ie=setInterval(()=>{li()},2e3)}function qs(){const l=location.protocol==="https:"?"wss:":"ws:",f=new WebSocket(`${l}//${location.host}/ws`);f.addEventListener("open",()=>{N(m,!0),Lt({type:"system",timestamp:new Date().toISOString(),message:"Dashboard connected"})}),f.addEventListener("close",()=>{N(m,!1),Lt({type:"error",timestamp:new Date().toISOString(),message:"Dashboard disconnected"}),setTimeout(qs,1500)}),f.addEventListener("message",S=>{const R=JSON.parse(S.data);if(R.type==="snapshot"){N(o,R.snapshot),n(A).length===0&&$t(n(o).events);return}R.type==="watch"&&(Ar(R.event),Lt(sr(R.event)))})}async function ci(){if(n(I).content.trim()){N(P,!0),N(K,"");try{const l=await fetch("/api/memories",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(n(I))});if(!l.ok)throw new Error((await l.json()).error??"Save failed");N(I,{type:"rule",scope:"project",content:"",reason:"",tags:"dashboard"}),await Cr()}catch(l){N(K,l.message)}finally{N(P,!1)}}}async function fi(l){N(K,"");const f=await fetch(`/api/memories/${l}`,{method:"DELETE"});if(!f.ok){N(K,(await f.json()).error??"Delete failed");return}await Cr()}Cr().catch(l=>{N(K,l.message)}),qs(),oi(),jc(()=>{ie&&(clearInterval(ie),ie=void 0)}),xe(()=>(n(o),n(C),n(W)),()=>{N(r,n(o).memories.filter(l=>{const f=n(C)==="all"||l.type===n(C),S=`${l.type} ${l.scope} ${l.content} ${l.reason??""} ${l.tags.join(" ")}`.toLowerCase();return f&&S.includes(n(W).toLowerCase())}))}),xe(()=>n(o),()=>{N(s,Object.values(n(o).stats.files??{}).reduce((l,f)=>l+f,0))}),xe(()=>n(o),()=>{N(a,n(o).files.filter(l=>l.status==="clean").length)}),xe(()=>n(o),()=>{N(i,Object.values(n(o).stats.rules).reduce((l,f)=>l+f,0))}),xe(()=>n(o),()=>{N(u,n(o).stats.recentViolations??[])}),xe(()=>n(u),()=>{N(v,n(u).filter(l=>{if(!(l.source==="hook"||l.source==="ci"))return!1;const f=Date.parse(l.timestamp);return Number.isNaN(f)?!1:Date.now()-f<=Xe}))}),xe(()=>n(s),()=>{N(d,n(s))}),xe(()=>n(o),()=>{N(p,Object.keys(n(o).stats.files??{}).length)}),xe(()=>n(o),()=>{N(g,n(o).memories.filter(l=>["rule","pattern","decision"].includes(l.type)).length)}),xe(()=>n(o),()=>{var l;N(k,((l=n(o).memoryCount)==null?void 0:l.total)??n(o).memories.length)}),xe(()=>n(o),()=>{var l;N(w,((l=n(o).memoryCount)==null?void 0:l.relevant)??n(o).memories.length)}),xe(()=>(n(m),n(o)),()=>{var l,f;N(y,n(m)?((l=n(o).watcher)==null?void 0:l.enabled)===!1?{live:!1,label:"Watch off"}:(f=n(o).watcher)!=null&&f.running?{live:!0,label:"Watcher live"}:{live:!1,label:"Watcher idle"}:{live:!1,label:"Disconnected"})}),rc(),Oc();var Us=df(),zs=_(Us),ui=h(_(zs),4),Gr=_(ui);let Hs;var di=h(_(Gr)),vi=h(Gr,2),pi=_(vi),_i=h(zs,2),Bs=_(_i),Ks=_(Bs),Ys=h(_(Ks),2);let Gs;var hi=h(_(Ys),2),gi=_(hi),Js=h(Ks,2),Qs=_(Js),bi=h(_(Qs),2),mi=_(bi),Xs=h(Qs,2),yi=h(_(Xs),2),wi=_(yi),Ei=h(Xs,2),xi=h(_(Ei),2),ki=_(xi),Si=h(Js,2),Zs=_(Si),Ti=h(Zs,2),Ai=h(Bs,2),en=_(Ai),tn=_(en),rn=_(tn),Ci=h(_(rn),2),Ri=_(Ci),Ni=h(rn,2),sn=_(Ni),Mi=h(_(sn)),Di=_(Mi),nn=h(sn,2),Fi=h(_(nn)),Oi=_(Fi),an=h(nn,2),Ii=h(_(an)),ji=_(Ii),ln=h(an,2),Pi=h(_(ln)),Li=_(Pi),on=h(ln,2),$i=h(_(on)),Wi=_($i),cn=h(on,2),Vi=h(_(cn)),qi=_(Vi),Ui=h(cn,2);{var zi=l=>{var f=$c(),S=h(_(f)),R=_(S);U(()=>x(R,(n(o),b(()=>n(o).watcher.error)))),L(l,f)};ce(Ui,l=>{n(o),b(()=>{var f;return(f=n(o).watcher)==null?void 0:f.error})&&l(zi)})}var fn=h(tn,2),un=_(fn),Hi=h(_(un),2),Bi=_(Hi),Ki=h(un,2),dn=_(Ki),Yi=h(_(dn)),Gi=_(Yi),vn=h(dn,2),Ji=h(_(vn)),Qi=_(Ji),pn=h(vn,2),_n=h(_(pn),2);let hn;var Xi=_(_n);{var Zi=l=>{var f=la();U(()=>x(f,(n(o),b(()=>{var S;return(S=n(o).runtime)!=null&&S.model.checkModelInstalled?"installed":"missing"})))),L(l,f)},el=l=>{var f=la();U(()=>x(f,(n(o),b(()=>{var S;return(S=n(o).runtime)!=null&&S.model.apiKeyConfigured?"api key set":"api key missing"})))),L(l,f)};ce(Xi,l=>{n(o),b(()=>{var f;return((f=n(o).runtime)==null?void 0:f.model.provider)==="ollama"})?l(Zi):l(el,-1)})}var gn=h(pn,2),tl=h(_(gn)),rl=_(tl),sl=h(gn,2),nl=h(_(sl)),al=_(nl),il=h(fn,2),bn=_(il),mn=h(_(bn),2);let yn;var ll=_(mn),ol=h(bn,2),wn=_(ol),cl=h(_(wn)),fl=_(cl),En=h(wn,2),ul=h(_(En)),dl=_(ul),xn=h(En,2),vl=h(_(xn)),pl=_(vl),_l=h(xn,2),hl=h(_(_l)),gl=_(hl),kn=h(en,2);{var bl=l=>{var f=Wc(),S=_(f);U(()=>x(S,(n(o),b(()=>n(o).dbError)))),L(l,f)};ce(kn,l=>{n(o),b(()=>n(o).dbError)&&l(bl)})}var Sn=h(kn,2);{var ml=l=>{var f=Vc(),S=_(f);U(()=>x(S,n(K))),L(l,f)};ce(Sn,l=>{n(K)&&l(ml)})}var Tn=h(Sn,2),yl=h(_(Tn),2),An=_(yl);{var wl=l=>{var f=qc();L(l,f)};ce(An,l=>{n(A),b(()=>n(A).length===0)&&l(wl)})}var El=h(An,2);Ut(El,1,()=>(n(A),b(()=>[...n(A)].reverse())),l=>l.id,(l,f)=>{var S=Zc();let R;var z=_(S),te=_(z),le=_(te),j=h(te,2),E=_(j),$=h(j,2);{var Ee=Y=>{var G=Uc(),he=_(G);U(()=>x(he,(n(f),b(()=>n(f).message)))),L(Y,G)},lt=Y=>{var G=zc(),he=_(G);U(()=>x(he,`saved: ${n(f),b(()=>n(f).file)??""}`)),L(Y,G)},ot=Y=>{var G=Hc(),he=_(G);U(()=>x(he,`${n(f),b(()=>n(f).file)??""} - no violations`)),L(Y,G)},Ze=Y=>{var G=Bc(),he=_(G);U(()=>x(he,`${n(f),b(()=>n(f).file)??""} - skipped: ${n(f),b(()=>n(f).reason)??""}`)),L(Y,G)},ze=Y=>{var G=Kc(),he=_(G);U(()=>x(he,`${n(f),b(()=>n(f).violations.length)??""} violation${n(f),b(()=>n(f).violations.length===1?"":"s")??""} in ${n(f),b(()=>n(f).file)??""}`)),L(Y,G)};ce($,Y=>{n(f),b(()=>n(f).type==="system"||n(f).type==="error")?Y(Ee):(n(f),b(()=>n(f).type==="saved")?Y(lt,1):(n(f),b(()=>n(f).type==="clean")?Y(ot,2):(n(f),b(()=>n(f).type==="skipped")?Y(Ze,3):Y(ze,-1))))})}var Wt=h(z,2);{var Vt=Y=>{var G=gc(),he=Yo(G);Ut(he,3,()=>(n(f),b(()=>n(f).violations)),(Rr,H)=>`${n(f).id}-${H}`,(Rr,H,Oe)=>{var He=Xc(),qt=_(He),ql=_(qt),Hn=h(qt,2),Ul=h(_(Hn)),Bn=h(Hn,2);{var zl=se=>{var Ie=Yc(),mt=h(_(Ie));U(()=>x(mt,` ${n(H),b(()=>n(H).reason)??""}`)),L(se,Ie)};ce(Bn,se=>{n(H),b(()=>n(H).reason)&&se(zl)})}var Kn=h(Bn,2);{var Hl=se=>{var Ie=Gc(),mt=h(_(Ie));U(()=>x(mt,` ${n(H),b(()=>n(H).issue)??""}`)),L(se,Ie)};ce(Kn,se=>{n(H),b(()=>n(H).issue)&&se(Hl)})}var Yn=h(Kn,2);{var Bl=se=>{var Ie=Jc(),mt=h(_(Ie));U(()=>x(mt,` ${n(H),b(()=>n(H).suggestion)??""}`)),L(se,Ie)};ce(Yn,se=>{n(H),b(()=>n(H).suggestion)&&se(Bl)})}var Kl=h(Yn,2);{var Yl=se=>{var Ie=Qc(),mt=_(Ie);U(()=>x(mt,(n(H),b(()=>n(H).code)))),L(se,Ie)};ce(Kl,se=>{n(H),b(()=>n(H).code)&&se(Yl)})}U(se=>{x(ql,`[${n(Oe)+1}] ${se??""}`),x(Ul,` ${n(H),b(()=>n(H).rule)??""}`)},[()=>(n(H),n(f),b(()=>ar(n(H),n(f).file)))]),L(Rr,He)}),L(Y,G)};ce(Wt,Y=>{n(f),b(()=>n(f).type==="violations")&&Y(Vt)})}U((Y,G)=>{R=or(S,1,"svelte-d3ct2b",null,R,{"error-line":n(f).type==="error","ok-line":n(f).type==="clean","violation-line":n(f).type==="violations"}),x(le,Y),x(E,G)},[()=>(n(f),b(()=>nr(n(f).timestamp))),()=>(n(f),b(()=>ni(n(f))))]),L(l,S)});var xl=h(Tn,2),Cn=_(xl),Rn=h(_(Cn),2),kl=h(_(Rn),2);Ut(kl,1,()=>(n(o),b(()=>n(o).stats.topRules.slice(0,5))),l=>l.name,(l,f)=>{var S=ef(),R=_(S),z=_(R),te=_(z),le=h(z,2),j=_(le),E=h(R,2);U($=>{x(te,(n(f),b(()=>n(f).name))),x(j,(n(f),b(()=>n(f).count))),fa(E,$)},[()=>(n(f),n(o),b(()=>`width: ${n(f).count/we(n(o).stats.topRules)*100}%`))]),L(l,S)},l=>{var f=tf();L(l,f)});var Nn=h(Rn,2),Sl=h(_(Nn),2);Ut(Sl,1,()=>(n(o),b(()=>n(o).stats.topFiles.slice(0,5))),l=>l.name,(l,f)=>{var S=rf(),R=_(S),z=_(R),te=_(z),le=h(z,2),j=_(le),E=h(R,2);U($=>{x(te,(n(f),b(()=>n(f).name))),x(j,(n(f),b(()=>n(f).count))),fa(E,$)},[()=>(n(f),n(o),b(()=>`width: ${n(f).count/we(n(o).stats.topFiles)*100}%`))]),L(l,S)},l=>{var f=sf();L(l,f)});var Tl=h(Nn,2),Mn=_(Tl),Al=h(_(Mn)),Cl=_(Al),Dn=h(Mn,2),Rl=h(_(Dn)),Nl=_(Rl),Ml=h(Dn,2),Dl=h(_(Ml)),Fl=_(Dl),Fn=h(Cn,2);{var Ol=l=>{var f=of(),S=_(f),R=h(_(S),2),z=_(R),te=h(S,2);Ut(te,7,()=>(n(v),b(()=>n(v).slice(0,8))),(le,j)=>`${le.timestamp}-${j}`,(le,j)=>{var E=lf(),$=_(E),Ee=_($),lt=_(Ee),ot=h(Ee,2),Ze=_(ot),ze=h($,2),Wt=_(ze),Vt=h(ze,2),Y=_(Vt),G=h(Vt,2);{var he=Oe=>{var He=nf(),qt=_(He);U(()=>x(qt,(n(j),b(()=>n(j).issue)))),L(Oe,He)};ce(G,Oe=>{n(j),b(()=>n(j).issue)&&Oe(he)})}var Rr=h(G,2);{var H=Oe=>{var He=af(),qt=_(He);U(()=>x(qt,(n(j),b(()=>n(j).suggestion)))),L(Oe,He)};ce(Rr,Oe=>{n(j),b(()=>n(j).suggestion)&&Oe(H)})}U((Oe,He)=>{x(lt,(n(j),b(()=>n(j).source==="ci"?"CI":"Hook"))),x(Ze,Oe),x(Wt,(n(j),b(()=>n(j).rule))),x(Y,He)},[()=>(n(j),b(()=>nr(n(j).timestamp))),()=>(n(j),b(()=>ar(n(j),n(j).file||"staged diff")))]),L(le,E)}),U(()=>x(z,`${n(v),b(()=>n(v).length)??""} in 24h`)),L(l,f)};ce(Fn,l=>{n(v),b(()=>n(v).length>0)&&l(Ol)})}var Il=h(Fn,2),On=_(Il),jl=h(_(On),2),Pl=_(jl),Jr=h(On,2),In=_(Jr),Qr=_(In),Xr=_(Qr);Xr.value=Xr.__value="rule";var Zr=h(Xr);Zr.value=Zr.__value="decision";var es=h(Zr);es.value=es.__value="pattern";var jn=h(es);jn.value=jn.__value="ignore";var Pn=h(Qr,2),ts=_(Pn);ts.value=ts.__value="project";var Ln=h(ts);Ln.value=Ln.__value="global";var $n=h(In,2),Wn=h($n,2),Vn=_(Wn),Ll=h(Vn,2),qn=h(Wn,2),$l=_(qn),Un=h(Jr,2),rs=_(Un),ss=_(rs);ss.value=ss.__value="all";var ns=h(ss);ns.value=ns.__value="rule";var as=h(ns);as.value=as.__value="decision";var is=h(as);is.value=is.__value="pattern";var zn=h(is);zn.value=zn.__value="ignore";var Wl=h(rs,2),Vl=h(Un,2);Ut(Vl,5,()=>n(r),l=>l.id,(l,f)=>{var S=ff(),R=_(S),z=_(R),te=_(z),le=_(te),j=h(te,2),E=_(j),$=h(z,2),Ee=_($),lt=h($,2);{var ot=ze=>{var Wt=cf(),Vt=_(Wt);U(()=>x(Vt,(n(f),b(()=>n(f).reason)))),L(ze,Wt)};ce(lt,ze=>{n(f),b(()=>n(f).reason)&&ze(ot)})}var Ze=h(R,2);U(ze=>{x(le,(n(f),b(()=>n(f).scope))),x(E,`Rule-${ze??""}`),x(Ee,(n(f),b(()=>n(f).content))),Nc(Ze,"aria-label",(n(f),b(()=>`Delete ${n(f).id}`)))},[()=>(n(f),b(()=>String(n(f).id).padStart(3,"0")))]),Mr("click",Ze,()=>fi(n(f).id)),L(l,S)},l=>{var f=uf();L(l,f)}),U((l,f,S)=>{var R,z,te,le,j;Hs=or(Gr,1,"status-chip svelte-d3ct2b",null,Hs,{live:n(y).live}),x(di,` ${n(y),b(()=>n(y).label)??""}`),x(pi,(n(o),b(()=>{var E;return((E=n(o).runtime)==null?void 0:E.model.label)??"runtime pending"}))),Gs=or(Ys,1,"live-label svelte-d3ct2b",null,Gs,{live:n(y).live}),x(gi,(n(y),b(()=>n(y).label))),x(mi,n(d)),x(wi,n(p)),x(ki,n(g)),x(Ri,(n(o),b(()=>{var E;return(E=n(o).runtime)!=null&&E.project.initialized?"Initialized":"Not initialized"}))),x(Di,l),x(Oi,(n(o),b(()=>{var E;return((E=n(o).runtime)==null?void 0:E.project.type)??"unknown"}))),x(ji,(n(o),b(()=>{var E;return((E=n(o).runtime)==null?void 0:E.project.language)??"unknown"}))),x(Li,f),x(Wi,(n(o),b(()=>{var E;return((E=n(o).runtime)==null?void 0:E.project.root)??"unknown"}))),x(qi,(n(o),b(()=>{var E,$;return((E=n(o).watcher)==null?void 0:E.enabled)===!1?"disabled":($=n(o).watcher)!=null&&$.running?"running":"idle"}))),x(Bi,(n(o),b(()=>{var E;return((E=n(o).runtime)==null?void 0:E.model.label)??"pending"}))),x(Gi,(n(o),b(()=>{var E;return((E=n(o).runtime)==null?void 0:E.model.provider)??"unknown"}))),x(Qi,(n(o),b(()=>{var E,$,Ee;return((E=n(o).runtime)==null?void 0:E.model.checkModelResolved)??(($=n(o).runtime)==null?void 0:$.model.checkModel)??((Ee=n(o).runtime)==null?void 0:Ee.model.chatModel)??"unknown"}))),hn=or(_n,1,"svelte-d3ct2b",null,hn,{"status-ok":((R=n(o).runtime)==null?void 0:R.model.checkModelInstalled)||((z=n(o).runtime)==null?void 0:z.model.apiKeyConfigured),"status-warn":((te=n(o).runtime)==null?void 0:te.model.checkModelInstalled)===!1||((le=n(o).runtime)==null?void 0:le.model.error)}),x(rl,(n(o),b(()=>{var E,$;return((E=n(o).runtime)==null?void 0:E.model.embeddingModelResolved)??(($=n(o).runtime)==null?void 0:$.model.embeddingModel)??"unknown"}))),x(al,(n(o),b(()=>{var E;return((E=n(o).runtime)==null?void 0:E.model.ollamaUrl)??"unknown"}))),yn=or(mn,1,"svelte-d3ct2b",null,yn,{success:(j=n(o).runtime)==null?void 0:j.postgres.connected}),x(ll,(n(o),b(()=>{var E;return(E=n(o).runtime)!=null&&E.postgres.connected?"Connected":"Not connected"}))),x(fl,(n(o),b(()=>{var E,$;return((E=n(o).runtime)==null?void 0:E.postgres.serverDatabase)??(($=n(o).runtime)==null?void 0:$.postgres.database)??"unknown"}))),x(dl,(n(o),b(()=>{var E,$;return((E=n(o).runtime)==null?void 0:E.postgres.serverUser)??(($=n(o).runtime)==null?void 0:$.postgres.user)??"unknown"}))),x(pl,`${n(o),b(()=>{var E;return((E=n(o).runtime)==null?void 0:E.postgres.host)??"unknown"})??""}${n(o),b(()=>{var E;return(E=n(o).runtime)!=null&&E.postgres.port?`:${n(o).runtime.postgres.port}`:""})??""}`),x(gl,(n(o),b(()=>{var E;return((E=n(o).runtime)==null?void 0:E.postgres.url)??"(not set)"}))),x(Cl,n(a)),x(Nl,n(d)),x(Fl,n(i)),x(Pl,`${n(g)??""} rules active`),qn.disabled=S,x($l,n(P)?"Saving...":"Add New Architecture Rule")},[()=>b(it),()=>b(Pt),()=>(n(P),n(I),b(()=>n(P)||!n(I).content.trim()))]),Mr("click",Zs,ai),Mr("click",Ti,ii),fs(Qr,()=>n(I).type,l=>ir(I,n(I).type=l)),fs(Pn,()=>n(I).scope,l=>ir(I,n(I).scope=l)),Fr($n,()=>n(I).content,l=>ir(I,n(I).content=l)),Fr(Vn,()=>n(I).reason,l=>ir(I,n(I).reason=l)),Fr(Ll,()=>n(I).tags,l=>ir(I,n(I).tags=l)),Mr("submit",Jr,Fc(ci)),fs(rs,()=>n(C),l=>N(C,l)),Fr(Wl,()=>n(W),l=>N(W,l)),L(e,Us),Sa()}bc(vf,{target:document.getElementById("app")});
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
<meta charset="UTF-8" />
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
6
|
<title>Memory Core Dashboard</title>
|
|
7
|
-
<script type="module" crossorigin src="/assets/index-
|
|
7
|
+
<script type="module" crossorigin src="/assets/index-DM82nOf5.js"></script>
|
|
8
8
|
<link rel="stylesheet" crossorigin href="/assets/index-CJyZEmIe.css">
|
|
9
9
|
</head>
|
|
10
10
|
<body>
|
|
@@ -12,13 +12,13 @@ import {
|
|
|
12
12
|
saveMemory,
|
|
13
13
|
startWatch,
|
|
14
14
|
updateMemory
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-ECYSBYMM.js";
|
|
16
16
|
|
|
17
17
|
// src/dashboard-server.ts
|
|
18
18
|
import { createHash } from "crypto";
|
|
19
19
|
import { createReadStream, existsSync, readFileSync, watch } from "fs";
|
|
20
20
|
import { createServer } from "http";
|
|
21
|
-
import { extname, join, normalize, relative, resolve } from "path";
|
|
21
|
+
import { basename, dirname, extname, join, normalize, relative, resolve } from "path";
|
|
22
22
|
import { fileURLToPath } from "url";
|
|
23
23
|
import chalk from "chalk";
|
|
24
24
|
var clients = /* @__PURE__ */ new Set();
|
|
@@ -47,6 +47,13 @@ var snapshotBroadcastInFlight = false;
|
|
|
47
47
|
var snapshotBroadcastQueued = false;
|
|
48
48
|
var snapshotBroadcastForceRefresh = false;
|
|
49
49
|
var projectRoot = process.cwd();
|
|
50
|
+
function resolveDashboardProjectRoot(inputPath) {
|
|
51
|
+
const candidate = (inputPath ?? process.cwd()).trim();
|
|
52
|
+
if (candidate.endsWith(".memory-core.json")) {
|
|
53
|
+
return resolve(dirname(candidate));
|
|
54
|
+
}
|
|
55
|
+
return resolve(candidate);
|
|
56
|
+
}
|
|
50
57
|
function mapFrameworkToArchitecture(framework) {
|
|
51
58
|
if (!framework) return null;
|
|
52
59
|
const normalized = framework.trim().toLowerCase();
|
|
@@ -100,8 +107,29 @@ function readJsonFile(path, fallback) {
|
|
|
100
107
|
return fallback;
|
|
101
108
|
}
|
|
102
109
|
}
|
|
110
|
+
function normalizeConfigString(value) {
|
|
111
|
+
if (typeof value !== "string") return void 0;
|
|
112
|
+
const trimmed = value.trim();
|
|
113
|
+
return trimmed.length > 0 ? trimmed : void 0;
|
|
114
|
+
}
|
|
115
|
+
function normalizeProjectConfig(raw) {
|
|
116
|
+
if (!raw) return null;
|
|
117
|
+
return {
|
|
118
|
+
...raw,
|
|
119
|
+
projectName: normalizeConfigString(raw.projectName) ?? normalizeConfigString(raw.project_name),
|
|
120
|
+
projectType: normalizeConfigString(raw.projectType) ?? normalizeConfigString(raw.project_type),
|
|
121
|
+
backendArchitecture: normalizeConfigString(raw.backendArchitecture) ?? normalizeConfigString(raw.backendArch) ?? normalizeConfigString(raw.backend_architecture) ?? normalizeConfigString(raw.backend_arch),
|
|
122
|
+
frontendFramework: normalizeConfigString(raw.frontendFramework) ?? normalizeConfigString(raw.frontendFw) ?? normalizeConfigString(raw.frontend_framework) ?? normalizeConfigString(raw.frontend_fw),
|
|
123
|
+
language: normalizeConfigString(raw.language)
|
|
124
|
+
};
|
|
125
|
+
}
|
|
103
126
|
function readProjectConfig() {
|
|
104
|
-
|
|
127
|
+
const raw = readJsonFile(join(projectRoot, ".memory-core.json"), null);
|
|
128
|
+
return normalizeProjectConfig(raw);
|
|
129
|
+
}
|
|
130
|
+
function readProjectConfigFromRoot(root) {
|
|
131
|
+
const raw = readJsonFile(join(root, ".memory-core.json"), null);
|
|
132
|
+
return normalizeProjectConfig(raw);
|
|
105
133
|
}
|
|
106
134
|
function parseEnvFile(raw) {
|
|
107
135
|
const values = {};
|
|
@@ -254,9 +282,15 @@ async function getModelStatus(forceRefresh = false) {
|
|
|
254
282
|
return status;
|
|
255
283
|
}
|
|
256
284
|
async function getRuntimeStatus(config) {
|
|
285
|
+
const watcherRoot = watcherStatus.path ? resolveDashboardProjectRoot(watcherStatus.path) : void 0;
|
|
286
|
+
const watcherConfig = watcherRoot ? readProjectConfigFromRoot(watcherRoot) : null;
|
|
287
|
+
const effectiveConfig = {
|
|
288
|
+
...watcherConfig ?? {},
|
|
289
|
+
...config ?? {}
|
|
290
|
+
};
|
|
257
291
|
const detected = detectProject(projectRoot);
|
|
258
|
-
const declared = resolveDeclaredArchitectures(
|
|
259
|
-
const inferredArchitectures = inferProjectArchitectures(projectRoot,
|
|
292
|
+
const declared = resolveDeclaredArchitectures(effectiveConfig, detected.framework);
|
|
293
|
+
const inferredArchitectures = inferProjectArchitectures(projectRoot, effectiveConfig);
|
|
260
294
|
const activeArchitectures = [.../* @__PURE__ */ new Set([
|
|
261
295
|
...inferredArchitectures,
|
|
262
296
|
...declared.declaredArchitectures
|
|
@@ -291,11 +325,12 @@ async function getRuntimeStatus(config) {
|
|
|
291
325
|
const model = await modelPromise;
|
|
292
326
|
return {
|
|
293
327
|
project: {
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
328
|
+
root: projectRoot,
|
|
329
|
+
name: effectiveConfig.projectName ?? basename(watcherRoot ?? projectRoot) ?? "project",
|
|
330
|
+
type: effectiveConfig.projectType ?? "unknown",
|
|
331
|
+
language: effectiveConfig.language ?? detected.language,
|
|
332
|
+
initialized: effectiveConfig.projectName !== void 0 || config !== null,
|
|
333
|
+
backendArchitecture: declared.backendArchitecture ?? activeArchitectures[0],
|
|
299
334
|
frontendFramework: declared.frontendFramework,
|
|
300
335
|
declaredArchitectures: declared.declaredArchitectures,
|
|
301
336
|
activeArchitectures,
|
|
@@ -439,14 +474,16 @@ async function handleApi(req, res, url) {
|
|
|
439
474
|
}
|
|
440
475
|
const config = readProjectConfig();
|
|
441
476
|
const activeArchitectures = inferProjectArchitectures(projectRoot, config);
|
|
477
|
+
const scope = typeof body.scope === "string" && body.scope.trim() ? body.scope.trim() : "project";
|
|
478
|
+
const reason = typeof body.reason === "string" && body.reason.trim() ? body.reason.trim() : `Captured as a ${typeof body.type === "string" ? body.type : "rule"} memory because it should be remembered: ${content}`;
|
|
442
479
|
await saveMemory({
|
|
443
480
|
type: typeof body.type === "string" ? body.type : "rule",
|
|
444
|
-
scope
|
|
481
|
+
scope,
|
|
445
482
|
architecture: typeof config?.backendArchitecture === "string" ? config.backendArchitecture : typeof config?.frontendFramework === "string" ? config.frontendFramework : activeArchitectures[0],
|
|
446
|
-
projectName: typeof config?.projectName === "string" ? config.projectName : void 0,
|
|
483
|
+
projectName: scope === "project" && typeof config?.projectName === "string" ? config.projectName : void 0,
|
|
447
484
|
title: typeof body.title === "string" ? body.title : void 0,
|
|
448
485
|
content,
|
|
449
|
-
reason
|
|
486
|
+
reason,
|
|
450
487
|
context: {},
|
|
451
488
|
tags: parseTags(body.tags),
|
|
452
489
|
embedding: await embed(content)
|
|
@@ -527,10 +564,20 @@ function serveStatic(req, res, url) {
|
|
|
527
564
|
res.end("Dashboard assets are missing. Run `npm run build` before `memory-core dashboard`.");
|
|
528
565
|
return;
|
|
529
566
|
}
|
|
530
|
-
createReadStream(join(dashboardDir, "index.html")).pipe(res.writeHead(200, {
|
|
567
|
+
createReadStream(join(dashboardDir, "index.html")).pipe(res.writeHead(200, {
|
|
568
|
+
"content-type": contentType("index.html"),
|
|
569
|
+
"cache-control": "no-store, no-cache, must-revalidate",
|
|
570
|
+
pragma: "no-cache",
|
|
571
|
+
expires: "0"
|
|
572
|
+
}));
|
|
531
573
|
return;
|
|
532
574
|
}
|
|
533
|
-
createReadStream(filePath).pipe(res.writeHead(200, {
|
|
575
|
+
createReadStream(filePath).pipe(res.writeHead(200, {
|
|
576
|
+
"content-type": contentType(filePath),
|
|
577
|
+
"cache-control": "no-store, no-cache, must-revalidate",
|
|
578
|
+
pragma: "no-cache",
|
|
579
|
+
expires: "0"
|
|
580
|
+
}));
|
|
534
581
|
}
|
|
535
582
|
function encodeFrame(payload) {
|
|
536
583
|
const body = Buffer.from(payload);
|
|
@@ -718,7 +765,7 @@ function startConfigWatch() {
|
|
|
718
765
|
};
|
|
719
766
|
}
|
|
720
767
|
async function startDashboard(options = {}) {
|
|
721
|
-
projectRoot =
|
|
768
|
+
projectRoot = resolveDashboardProjectRoot(options.path);
|
|
722
769
|
reloadRuntimeEnv();
|
|
723
770
|
const port = options.port ?? 5178;
|
|
724
771
|
const stopConfigWatch = startConfigWatch();
|
|
@@ -752,6 +799,7 @@ async function startDashboard(options = {}) {
|
|
|
752
799
|
console.log(chalk.green(`
|
|
753
800
|
Dashboard: http://localhost:${port}
|
|
754
801
|
`));
|
|
802
|
+
console.log(chalk.gray(` Project root: ${projectRoot}`));
|
|
755
803
|
if (options.watch ?? true) {
|
|
756
804
|
watcherStatus.enabled = true;
|
|
757
805
|
void startWatch({
|
|
@@ -767,6 +815,7 @@ async function startDashboard(options = {}) {
|
|
|
767
815
|
}
|
|
768
816
|
export {
|
|
769
817
|
mapFrameworkToArchitecture,
|
|
818
|
+
resolveDashboardProjectRoot,
|
|
770
819
|
resolveDeclaredArchitectures,
|
|
771
820
|
startDashboard
|
|
772
821
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shahmilsaari/memory-core",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.16",
|
|
4
4
|
"description": "Universal AI memory core — generate AI context files from architecture profiles with RAG support",
|
|
5
5
|
"homepage": "https://memory-core.shahmilsaari.my/",
|
|
6
6
|
"type": "module",
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
var Bl=Object.defineProperty;var Yn=e=>{throw TypeError(e)};var Kl=(e,t,r)=>t in e?Bl(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var je=(e,t,r)=>Kl(e,typeof t!="symbol"?t+"":t,r),ls=(e,t,r)=>t.has(e)||Yn("Cannot "+r);var c=(e,t,r)=>(ls(e,t,"read from private field"),r?r.call(e):t.get(e)),M=(e,t,r)=>t.has(e)?Yn("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,r),D=(e,t,r,s)=>(ls(e,t,"write to private field"),s?s.call(e,r):t.set(e,r),r),q=(e,t,r)=>(ls(e,t,"access private method"),r);(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const a of document.querySelectorAll('link[rel="modulepreload"]'))s(a);new MutationObserver(a=>{for(const i of a)if(i.type==="childList")for(const u of i.addedNodes)u.tagName==="LINK"&&u.rel==="modulepreload"&&s(u)}).observe(document,{childList:!0,subtree:!0});function r(a){const i={};return a.integrity&&(i.integrity=a.integrity),a.referrerPolicy&&(i.referrerPolicy=a.referrerPolicy),a.crossOrigin==="use-credentials"?i.credentials="include":a.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function s(a){if(a.ep)return;a.ep=!0;const i=r(a);fetch(a.href,i)}})();const Yl=!1;var As=Array.isArray,Gl=Array.prototype.indexOf,Jt=Array.prototype.includes,Br=Array.from,Jl=Object.defineProperty,ur=Object.getOwnPropertyDescriptor,pa=Object.getOwnPropertyDescriptors,Ql=Object.prototype,Xl=Array.prototype,Cs=Object.getPrototypeOf,Gn=Object.isExtensible;const Zl=()=>{};function eo(e){return e()}function vs(e){for(var t=0;t<e.length;t++)e[t]()}function _a(){var e,t,r=new Promise((s,a)=>{e=s,t=a});return{promise:r,resolve:e,reject:t}}const oe=2,Qt=4,xr=8,ha=1<<24,Je=16,We=32,ht=64,ps=128,Re=512,Z=1024,ae=2048,Ve=4096,ue=8192,Ne=16384,jt=32768,Jn=1<<25,Xt=65536,_s=1<<17,to=1<<18,tr=1<<19,ga=1<<20,Ge=1<<25,Dt=65536,Vr=1<<21,_r=1<<22,pt=1<<23,Ct=Symbol("$state"),et=new class extends Error{constructor(){super(...arguments);je(this,"name","StaleReactionError");je(this,"message","The reaction that called `getAbortSignal()` was re-run or destroyed")}};function ba(e){throw new Error("https://svelte.dev/e/lifecycle_outside_component")}function ro(){throw new Error("https://svelte.dev/e/async_derived_orphan")}function so(e,t,r){throw new Error("https://svelte.dev/e/each_key_duplicate")}function no(e){throw new Error("https://svelte.dev/e/effect_in_teardown")}function ao(){throw new Error("https://svelte.dev/e/effect_in_unowned_derived")}function io(e){throw new Error("https://svelte.dev/e/effect_orphan")}function lo(){throw new Error("https://svelte.dev/e/effect_update_depth_exceeded")}function oo(){throw new Error("https://svelte.dev/e/state_descriptors_fixed")}function co(){throw new Error("https://svelte.dev/e/state_prototype_fixed")}function fo(){throw new Error("https://svelte.dev/e/state_unsafe_mutation")}function uo(){throw new Error("https://svelte.dev/e/svelte_boundary_reset_onerror")}const vo=1,po=2,ma=4,_o=8,ho=16,go=2,re=Symbol(),ya="http://www.w3.org/1999/xhtml";function bo(){console.warn("https://svelte.dev/e/derived_inert")}function mo(){console.warn("https://svelte.dev/e/select_multiple_invalid_value")}function yo(){console.warn("https://svelte.dev/e/svelte_boundary_reset_noop")}function wa(e){return e===this.v}function wo(e,t){return e!=e?t==t:e!==t||e!==null&&typeof e=="object"||typeof e=="function"}function Ea(e){return!wo(e,this.v)}let kr=!1,Eo=!1;function xo(){kr=!0}let B=null;function Zt(e){B=e}function xa(e,t=!1,r){B={p:B,i:!1,c:null,e:null,s:e,x:null,r:F,l:kr&&!t?{s:null,u:null,$:[]}:null}}function ka(e){var t=B,r=t.e;if(r!==null){t.e=null;for(var s of r)Ha(s)}return t.i=!0,B=t.p,{}}function Sr(){return!kr||B!==null&&B.l===null}let wt=[];function Sa(){var e=wt;wt=[],vs(e)}function _t(e){if(wt.length===0&&!dr){var t=wt;queueMicrotask(()=>{t===wt&&Sa()})}wt.push(e)}function ko(){for(;wt.length>0;)Sa()}function Ta(e){var t=F;if(t===null)return O.f|=pt,e;if(!(t.f&jt)&&!(t.f&Qt))throw e;vt(e,t)}function vt(e,t){for(;t!==null;){if(t.f&ps){if(!(t.f&jt))throw e;try{t.b.error(e);return}catch(r){e=r}}t=t.parent}throw e}const So=-7169;function J(e,t){e.f=e.f&So|t}function Rs(e){e.f&Re||e.deps===null?J(e,Z):J(e,Ve)}function Aa(e){if(e!==null)for(const t of e)!(t.f&oe)||!(t.f&Dt)||(t.f^=Dt,Aa(t.deps))}function Ca(e,t,r){e.f&ae?t.add(e):e.f&Ve&&r.add(e),Aa(e.deps),J(e,Z)}const yt=new Set;let T=null,ne=null,hs=null,dr=!1,os=!1,zt=null,Or=null;var Qn=0;let To=1;var Ht,Bt,xt,tt,Be,gr,be,br,ut,rt,Ke,Kt,Yt,kt,ee,Ir,Ra,jr,gs,Lr,Ao;const Ur=class Ur{constructor(){M(this,ee);je(this,"id",To++);je(this,"current",new Map);je(this,"previous",new Map);M(this,Ht,new Set);M(this,Bt,new Set);M(this,xt,new Set);M(this,tt,new Map);M(this,Be,new Map);M(this,gr,null);M(this,be,[]);M(this,br,[]);M(this,ut,new Set);M(this,rt,new Set);M(this,Ke,new Map);M(this,Kt,new Set);je(this,"is_fork",!1);M(this,Yt,!1);M(this,kt,new Set)}skip_effect(t){c(this,Ke).has(t)||c(this,Ke).set(t,{d:[],m:[]}),c(this,Kt).delete(t)}unskip_effect(t,r=s=>this.schedule(s)){var s=c(this,Ke).get(t);if(s){c(this,Ke).delete(t);for(var a of s.d)J(a,ae),r(a);for(a of s.m)J(a,Ve),r(a)}c(this,Kt).add(t)}capture(t,r,s=!1){t.v!==re&&!this.previous.has(t)&&this.previous.set(t,t.v),t.f&pt||(this.current.set(t,[r,s]),ne==null||ne.set(t,r)),this.is_fork||(t.v=r)}activate(){T=this}deactivate(){T=null,ne=null}flush(){try{os=!0,T=this,q(this,ee,jr).call(this)}finally{Qn=0,hs=null,zt=null,Or=null,os=!1,T=null,ne=null,Rt.clear()}}discard(){for(const t of c(this,Bt))t(this);c(this,Bt).clear(),c(this,xt).clear(),yt.delete(this)}register_created_effect(t){c(this,br).push(t)}increment(t,r){let s=c(this,tt).get(r)??0;if(c(this,tt).set(r,s+1),t){let a=c(this,Be).get(r)??0;c(this,Be).set(r,a+1)}}decrement(t,r,s){let a=c(this,tt).get(r)??0;if(a===1?c(this,tt).delete(r):c(this,tt).set(r,a-1),t){let i=c(this,Be).get(r)??0;i===1?c(this,Be).delete(r):c(this,Be).set(r,i-1)}c(this,Yt)||s||(D(this,Yt,!0),_t(()=>{D(this,Yt,!1),this.flush()}))}transfer_effects(t,r){for(const s of t)c(this,ut).add(s);for(const s of r)c(this,rt).add(s);t.clear(),r.clear()}oncommit(t){c(this,Ht).add(t)}ondiscard(t){c(this,Bt).add(t)}on_fork_commit(t){c(this,xt).add(t)}run_fork_commit_callbacks(){for(const t of c(this,xt))t(this);c(this,xt).clear()}settled(){return(c(this,gr)??D(this,gr,_a())).promise}static ensure(){if(T===null){const t=T=new Ur;os||(yt.add(T),dr||_t(()=>{T===t&&t.flush()}))}return T}apply(){{ne=null;return}}schedule(t){var a;if(hs=t,(a=t.b)!=null&&a.is_pending&&t.f&(Qt|xr|ha)&&!(t.f&jt)){t.b.defer_effect(t);return}for(var r=t;r.parent!==null;){r=r.parent;var s=r.f;if(zt!==null&&r===F&&(O===null||!(O.f&oe)))return;if(s&(ht|We)){if(!(s&Z))return;r.f^=Z}}c(this,be).push(r)}};Ht=new WeakMap,Bt=new WeakMap,xt=new WeakMap,tt=new WeakMap,Be=new WeakMap,gr=new WeakMap,be=new WeakMap,br=new WeakMap,ut=new WeakMap,rt=new WeakMap,Ke=new WeakMap,Kt=new WeakMap,Yt=new WeakMap,kt=new WeakMap,ee=new WeakSet,Ir=function(){return this.is_fork||c(this,Be).size>0},Ra=function(){for(const s of c(this,kt))for(const a of c(s,Be).keys()){for(var t=!1,r=a;r.parent!==null;){if(c(this,Ke).has(r)){t=!0;break}r=r.parent}if(!t)return!0}return!1},jr=function(){var v,d;if(Qn++>1e3&&(yt.delete(this),Ro()),!q(this,ee,Ir).call(this)){for(const p of c(this,ut))c(this,rt).delete(p),J(p,ae),this.schedule(p);for(const p of c(this,rt))J(p,Ve),this.schedule(p)}const t=c(this,be);D(this,be,[]),this.apply();var r=zt=[],s=[],a=Or=[];for(const p of t)try{q(this,ee,gs).call(this,p,r,s)}catch(g){throw Da(p),g}if(T=null,a.length>0){var i=Ur.ensure();for(const p of a)i.schedule(p)}if(zt=null,Or=null,q(this,ee,Ir).call(this)||q(this,ee,Ra).call(this)){q(this,ee,Lr).call(this,s),q(this,ee,Lr).call(this,r);for(const[p,g]of c(this,Ke))Ma(p,g)}else{c(this,tt).size===0&&yt.delete(this),c(this,ut).clear(),c(this,rt).clear();for(const p of c(this,Ht))p(this);c(this,Ht).clear(),Xn(s),Xn(r),(v=c(this,gr))==null||v.resolve()}var u=T;if(c(this,be).length>0){const p=u??(u=this);c(p,be).push(...c(this,be).filter(g=>!c(p,be).includes(g)))}u!==null&&(yt.add(u),q(d=u,ee,jr).call(d))},gs=function(t,r,s){t.f^=Z;for(var a=t.first;a!==null;){var i=a.f,u=(i&(We|ht))!==0,v=u&&(i&Z)!==0,d=v||(i&ue)!==0||c(this,Ke).has(a);if(!d&&a.fn!==null){u?a.f^=Z:i&Qt?r.push(a):rr(a)&&(i&Je&&c(this,rt).add(a),It(a));var p=a.first;if(p!==null){a=p;continue}}for(;a!==null;){var g=a.next;if(g!==null){a=g;break}a=a.parent}}},Lr=function(t){for(var r=0;r<t.length;r+=1)Ca(t[r],c(this,ut),c(this,rt))},Ao=function(){var g,x,w;for(const y of yt){var t=y.id<this.id,r=[];for(const[o,[A,m]]of this.current){if(y.current.has(o)){var s=y.current.get(o)[0];if(t&&A!==s)y.current.set(o,[A,m]);else continue}r.push(o)}var a=[...y.current.keys()].filter(o=>!this.current.has(o));if(a.length===0)t&&y.discard();else if(r.length>0){if(t)for(const o of c(this,Kt))y.unskip_effect(o,A=>{var m;A.f&(Je|_r)?y.schedule(A):q(m=y,ee,Lr).call(m,[A])});y.activate();var i=new Set,u=new Map;for(var v of r)Na(v,a,i,u);u=new Map;var d=[...y.current.keys()].filter(o=>this.current.has(o)?this.current.get(o)[0]!==o:!0);for(const o of c(this,br))!(o.f&(Ne|ue|_s))&&Ns(o,d,u)&&(o.f&(_r|Je)?(J(o,ae),y.schedule(o)):c(y,ut).add(o));if(c(y,be).length>0){y.apply();for(var p of c(y,be))q(g=y,ee,gs).call(g,p,[],[]);D(y,be,[])}y.deactivate()}}for(const y of yt)c(y,kt).has(this)&&(c(y,kt).delete(this),c(y,kt).size===0&&!q(x=y,ee,Ir).call(x)&&(y.activate(),q(w=y,ee,jr).call(w)))};let Ft=Ur;function Co(e){var t=dr;dr=!0;try{for(var r;;){if(ko(),T===null)return r;T.flush()}}finally{dr=t}}function Ro(){try{lo()}catch(e){vt(e,hs)}}let Le=null;function Xn(e){var t=e.length;if(t!==0){for(var r=0;r<t;){var s=e[r++];if(!(s.f&(Ne|ue))&&rr(s)&&(Le=new Set,It(s),s.deps===null&&s.first===null&&s.nodes===null&&s.teardown===null&&s.ac===null&&Ka(s),(Le==null?void 0:Le.size)>0)){Rt.clear();for(const a of Le){if(a.f&(Ne|ue))continue;const i=[a];let u=a.parent;for(;u!==null;)Le.has(u)&&(Le.delete(u),i.push(u)),u=u.parent;for(let v=i.length-1;v>=0;v--){const d=i[v];d.f&(Ne|ue)||It(d)}}Le.clear()}}Le=null}}function Na(e,t,r,s){if(!r.has(e)&&(r.add(e),e.reactions!==null))for(const a of e.reactions){const i=a.f;i&oe?Na(a,t,r,s):i&(_r|Je)&&!(i&ae)&&Ns(a,t,s)&&(J(a,ae),Ms(a))}}function Ns(e,t,r){const s=r.get(e);if(s!==void 0)return s;if(e.deps!==null)for(const a of e.deps){if(Jt.call(t,a))return!0;if(a.f&oe&&Ns(a,t,r))return r.set(a,!0),!0}return r.set(e,!1),!1}function Ms(e){T.schedule(e)}function Ma(e,t){if(!(e.f&We&&e.f&Z)){e.f&ae?t.d.push(e):e.f&Ve&&t.m.push(e),J(e,Z);for(var r=e.first;r!==null;)Ma(r,t),r=r.next}}function Da(e){J(e,Z);for(var t=e.first;t!==null;)Da(t),t=t.next}function No(e){let t=0,r=Ot(0),s;return()=>{Is()&&(n(r),Yr(()=>(t===0&&(s=b(()=>e(()=>vr(r)))),t+=1,()=>{_t(()=>{t-=1,t===0&&(s==null||s(),s=void 0,vr(r))})})))}}var Mo=Xt|tr;function Do(e,t,r,s){new Fo(e,t,r,s)}var Se,Ts,Te,St,ve,Ae,fe,me,st,Tt,dt,Gt,mr,yr,nt,zr,Q,Oo,Io,jo,bs,Pr,$r,ms,ys;class Fo{constructor(t,r,s,a){M(this,Q);je(this,"parent");je(this,"is_pending",!1);je(this,"transform_error");M(this,Se);M(this,Ts,null);M(this,Te);M(this,St);M(this,ve);M(this,Ae,null);M(this,fe,null);M(this,me,null);M(this,st,null);M(this,Tt,0);M(this,dt,0);M(this,Gt,!1);M(this,mr,new Set);M(this,yr,new Set);M(this,nt,null);M(this,zr,No(()=>(D(this,nt,Ot(c(this,Tt))),()=>{D(this,nt,null)})));var i;D(this,Se,t),D(this,Te,r),D(this,St,u=>{var v=F;v.b=this,v.f|=ps,s(u)}),this.parent=F.b,this.transform_error=a??((i=this.parent)==null?void 0:i.transform_error)??(u=>u),D(this,ve,Ls(()=>{q(this,Q,bs).call(this)},Mo))}defer_effect(t){Ca(t,c(this,mr),c(this,yr))}is_rendered(){return!this.is_pending&&(!this.parent||this.parent.is_rendered())}has_pending_snippet(){return!!c(this,Te).pending}update_pending_count(t,r){q(this,Q,ms).call(this,t,r),D(this,Tt,c(this,Tt)+t),!(!c(this,nt)||c(this,Gt))&&(D(this,Gt,!0),_t(()=>{D(this,Gt,!1),c(this,nt)&&er(c(this,nt),c(this,Tt))}))}get_effect_pending(){return c(this,zr).call(this),n(c(this,nt))}error(t){if(!c(this,Te).onerror&&!c(this,Te).failed)throw t;T!=null&&T.is_fork?(c(this,Ae)&&T.skip_effect(c(this,Ae)),c(this,fe)&&T.skip_effect(c(this,fe)),c(this,me)&&T.skip_effect(c(this,me)),T.on_fork_commit(()=>{q(this,Q,ys).call(this,t)})):q(this,Q,ys).call(this,t)}}Se=new WeakMap,Ts=new WeakMap,Te=new WeakMap,St=new WeakMap,ve=new WeakMap,Ae=new WeakMap,fe=new WeakMap,me=new WeakMap,st=new WeakMap,Tt=new WeakMap,dt=new WeakMap,Gt=new WeakMap,mr=new WeakMap,yr=new WeakMap,nt=new WeakMap,zr=new WeakMap,Q=new WeakSet,Oo=function(){try{D(this,Ae,Ce(()=>c(this,St).call(this,c(this,Se))))}catch(t){this.error(t)}},Io=function(t){const r=c(this,Te).failed;r&&D(this,me,Ce(()=>{r(c(this,Se),()=>t,()=>()=>{})}))},jo=function(){const t=c(this,Te).pending;t&&(this.is_pending=!0,D(this,fe,Ce(()=>t(c(this,Se)))),_t(()=>{var r=D(this,st,document.createDocumentFragment()),s=at();r.append(s),D(this,Ae,q(this,Q,$r).call(this,()=>Ce(()=>c(this,St).call(this,s)))),c(this,dt)===0&&(c(this,Se).before(r),D(this,st,null),Nt(c(this,fe),()=>{D(this,fe,null)}),q(this,Q,Pr).call(this,T))}))},bs=function(){try{if(this.is_pending=this.has_pending_snippet(),D(this,dt,0),D(this,Tt,0),D(this,Ae,Ce(()=>{c(this,St).call(this,c(this,Se))})),c(this,dt)>0){var t=D(this,st,document.createDocumentFragment());Ws(c(this,Ae),t);const r=c(this,Te).pending;D(this,fe,Ce(()=>r(c(this,Se))))}else q(this,Q,Pr).call(this,T)}catch(r){this.error(r)}},Pr=function(t){this.is_pending=!1,t.transfer_effects(c(this,mr),c(this,yr))},$r=function(t){var r=F,s=O,a=B;Fe(c(this,ve)),De(c(this,ve)),Zt(c(this,ve).ctx);try{return Ft.ensure(),t()}catch(i){return Ta(i),null}finally{Fe(r),De(s),Zt(a)}},ms=function(t,r){var s;if(!this.has_pending_snippet()){this.parent&&q(s=this.parent,Q,ms).call(s,t,r);return}D(this,dt,c(this,dt)+t),c(this,dt)===0&&(q(this,Q,Pr).call(this,r),c(this,fe)&&Nt(c(this,fe),()=>{D(this,fe,null)}),c(this,st)&&(c(this,Se).before(c(this,st)),D(this,st,null)))},ys=function(t){c(this,Ae)&&(_e(c(this,Ae)),D(this,Ae,null)),c(this,fe)&&(_e(c(this,fe)),D(this,fe,null)),c(this,me)&&(_e(c(this,me)),D(this,me,null));var r=c(this,Te).onerror;let s=c(this,Te).failed;var a=!1,i=!1;const u=()=>{if(a){yo();return}a=!0,i&&uo(),c(this,me)!==null&&Nt(c(this,me),()=>{D(this,me,null)}),q(this,Q,$r).call(this,()=>{q(this,Q,bs).call(this)})},v=d=>{try{i=!0,r==null||r(d,u),i=!1}catch(p){vt(p,c(this,ve)&&c(this,ve).parent)}s&&D(this,me,q(this,Q,$r).call(this,()=>{try{return Ce(()=>{var p=F;p.b=this,p.f|=ps,s(c(this,Se),()=>d,()=>u)})}catch(p){return vt(p,c(this,ve).parent),null}}))};_t(()=>{var d;try{d=this.transform_error(t)}catch(p){vt(p,c(this,ve)&&c(this,ve).parent);return}d!==null&&typeof d=="object"&&typeof d.then=="function"?d.then(v,p=>vt(p,c(this,ve)&&c(this,ve).parent)):v(d)})};function Lo(e,t,r,s){const a=Sr()?Ds:Oa;var i=e.filter(w=>!w.settled);if(r.length===0&&i.length===0){s(t.map(a));return}var u=F,v=Po(),d=i.length===1?i[0].promise:i.length>1?Promise.all(i.map(w=>w.promise)):null;function p(w){v();try{s(w)}catch(y){u.f&Ne||vt(y,u)}qr()}if(r.length===0){d.then(()=>p(t.map(a)));return}var g=Fa();function x(){Promise.all(r.map(w=>$o(w))).then(w=>p([...t.map(a),...w])).catch(w=>vt(w,u)).finally(()=>g())}d?d.then(()=>{v(),x(),qr()}):x()}function Po(){var e=F,t=O,r=B,s=T;return function(i=!0){Fe(e),De(t),Zt(r),i&&!(e.f&Ne)&&(s==null||s.activate(),s==null||s.apply())}}function qr(e=!0){Fe(null),De(null),Zt(null),e&&(T==null||T.deactivate())}function Fa(){var e=F,t=e.b,r=T,s=t.is_rendered();return t.update_pending_count(1,r),r.increment(s,e),(a=!1)=>{t.update_pending_count(-1,r),r.decrement(s,e,a)}}function Ds(e){var t=oe|ae;return F!==null&&(F.f|=tr),{ctx:B,deps:null,effects:null,equals:wa,f:t,fn:e,reactions:null,rv:0,v:re,wv:0,parent:F,ac:null}}function $o(e,t,r){let s=F;s===null&&ro();var a=void 0,i=Ot(re),u=!O,v=new Map;return ec(()=>{var y;var d=F,p=_a();a=p.promise;try{Promise.resolve(e()).then(p.resolve,p.reject).finally(qr)}catch(o){p.reject(o),qr()}var g=T;if(u){if(d.f&jt)var x=Fa();if(s.b.is_rendered())(y=v.get(g))==null||y.reject(et),v.delete(g);else{for(const o of v.values())o.reject(et);v.clear()}v.set(g,p)}const w=(o,A=void 0)=>{if(x){var m=A===et;x(m)}if(!(A===et||d.f&Ne)){if(g.activate(),A)i.f|=pt,er(i,A);else{i.f&pt&&(i.f^=pt),er(i,o);for(const[C,W]of v){if(v.delete(C),C===g)break;W.reject(et)}}g.deactivate()}};p.promise.then(w,o=>w(null,o||"unknown"))}),js(()=>{for(const d of v.values())d.reject(et)}),new Promise(d=>{function p(g){function x(){g===a?d(i):p(a)}g.then(x,x)}p(a)})}function Oa(e){const t=Ds(e);return t.equals=Ea,t}function Wo(e){var t=e.effects;if(t!==null){e.effects=null;for(var r=0;r<t.length;r+=1)_e(t[r])}}function Fs(e){var t,r=F,s=e.parent;if(!gt&&s!==null&&s.f&(Ne|ue))return bo(),e.v;Fe(s);try{e.f&=~Dt,Wo(e),t=Za(e)}finally{Fe(r)}return t}function Ia(e){var t=Fs(e);if(!e.equals(t)&&(e.wv=Qa(),(!(T!=null&&T.is_fork)||e.deps===null)&&(T!==null?T.capture(e,t,!0):e.v=t,e.deps===null))){J(e,Z);return}gt||(ne!==null?(Is()||T!=null&&T.is_fork)&&ne.set(e,t):Rs(e))}function Vo(e){var t,r;if(e.effects!==null)for(const s of e.effects)(s.teardown||s.ac)&&((t=s.teardown)==null||t.call(s),(r=s.ac)==null||r.abort(et),s.teardown=Zl,s.ac=null,hr(s,0),Ps(s))}function ja(e){if(e.effects!==null)for(const t of e.effects)t.teardown&&It(t)}let ws=new Set;const Rt=new Map;let La=!1;function Ot(e,t){var r={f:0,v:e,reactions:null,equals:wa,rv:0,wv:0};return r}function ct(e,t){const r=Ot(e);return sc(r),r}function X(e,t=!1,r=!0){var a;const s=Ot(e);return t||(s.equals=Ea),kr&&r&&B!==null&&B.l!==null&&((a=B.l).s??(a.s=[])).push(s),s}function ir(e,t){return N(e,b(()=>n(e))),t}function N(e,t,r=!1){O!==null&&(!$e||O.f&_s)&&Sr()&&O.f&(oe|Je|_r|_s)&&(Me===null||!Jt.call(Me,e))&&fo();let s=r?cr(t):t;return er(e,s,Or)}function er(e,t,r=null){if(!e.equals(t)){Rt.set(e,gt?t:e.v);var s=Ft.ensure();if(s.capture(e,t),e.f&oe){const a=e;e.f&ae&&Fs(a),ne===null&&Rs(a)}e.wv=Qa(),Pa(e,ae,r),Sr()&&F!==null&&F.f&Z&&!(F.f&(We|ht))&&(ke===null?nc([e]):ke.push(e)),!s.is_fork&&ws.size>0&&!La&&qo()}return t}function qo(){La=!1;for(const e of ws)e.f&Z&&J(e,Ve),rr(e)&&It(e);ws.clear()}function vr(e){N(e,e.v+1)}function Pa(e,t,r){var s=e.reactions;if(s!==null)for(var a=Sr(),i=s.length,u=0;u<i;u++){var v=s[u],d=v.f;if(!(!a&&v===F)){var p=(d&ae)===0;if(p&&J(v,t),d&oe){var g=v;ne==null||ne.delete(g),d&Dt||(d&Re&&(F===null||!(F.f&Vr))&&(v.f|=Dt),Pa(g,Ve,r))}else if(p){var x=v;d&Je&&Le!==null&&Le.add(x),r!==null?r.push(x):Ms(x)}}}}function cr(e){if(typeof e!="object"||e===null||Ct in e)return e;const t=Cs(e);if(t!==Ql&&t!==Xl)return e;var r=new Map,s=As(e),a=ct(0),i=Mt,u=v=>{if(Mt===i)return v();var d=O,p=Mt;De(null),sa(i);var g=v();return De(d),sa(p),g};return s&&r.set("length",ct(e.length)),new Proxy(e,{defineProperty(v,d,p){(!("value"in p)||p.configurable===!1||p.enumerable===!1||p.writable===!1)&&oo();var g=r.get(d);return g===void 0?u(()=>{var x=ct(p.value);return r.set(d,x),x}):N(g,p.value,!0),!0},deleteProperty(v,d){var p=r.get(d);if(p===void 0){if(d in v){const g=u(()=>ct(re));r.set(d,g),vr(a)}}else N(p,re),vr(a);return!0},get(v,d,p){var y;if(d===Ct)return e;var g=r.get(d),x=d in v;if(g===void 0&&(!x||(y=ur(v,d))!=null&&y.writable)&&(g=u(()=>{var o=cr(x?v[d]:re),A=ct(o);return A}),r.set(d,g)),g!==void 0){var w=n(g);return w===re?void 0:w}return Reflect.get(v,d,p)},getOwnPropertyDescriptor(v,d){var p=Reflect.getOwnPropertyDescriptor(v,d);if(p&&"value"in p){var g=r.get(d);g&&(p.value=n(g))}else if(p===void 0){var x=r.get(d),w=x==null?void 0:x.v;if(x!==void 0&&w!==re)return{enumerable:!0,configurable:!0,value:w,writable:!0}}return p},has(v,d){var w;if(d===Ct)return!0;var p=r.get(d),g=p!==void 0&&p.v!==re||Reflect.has(v,d);if(p!==void 0||F!==null&&(!g||(w=ur(v,d))!=null&&w.writable)){p===void 0&&(p=u(()=>{var y=g?cr(v[d]):re,o=ct(y);return o}),r.set(d,p));var x=n(p);if(x===re)return!1}return g},set(v,d,p,g){var L;var x=r.get(d),w=d in v;if(s&&d==="length")for(var y=p;y<x.v;y+=1){var o=r.get(y+"");o!==void 0?N(o,re):y in v&&(o=u(()=>ct(re)),r.set(y+"",o))}if(x===void 0)(!w||(L=ur(v,d))!=null&&L.writable)&&(x=u(()=>ct(void 0)),N(x,cr(p)),r.set(d,x));else{w=x.v!==re;var A=u(()=>cr(p));N(x,A)}var m=Reflect.getOwnPropertyDescriptor(v,d);if(m!=null&&m.set&&m.set.call(g,p),!w){if(s&&typeof d=="string"){var C=r.get("length"),W=Number(d);Number.isInteger(W)&&W>=C.v&&N(C,W+1)}vr(a)}return!0},ownKeys(v){n(a);var d=Reflect.ownKeys(v).filter(x=>{var w=r.get(x);return w===void 0||w.v!==re});for(var[p,g]of r)g.v!==re&&!(p in v)&&d.push(p);return d},setPrototypeOf(){co()}})}function Zn(e){try{if(e!==null&&typeof e=="object"&&Ct in e)return e[Ct]}catch{}return e}function Uo(e,t){return Object.is(Zn(e),Zn(t))}var ea,$a,Wa,Va;function zo(){if(ea===void 0){ea=window,$a=/Firefox/.test(navigator.userAgent);var e=Element.prototype,t=Node.prototype,r=Text.prototype;Wa=ur(t,"firstChild").get,Va=ur(t,"nextSibling").get,Gn(e)&&(e.__click=void 0,e.__className=void 0,e.__attributes=null,e.__style=void 0,e.__e=void 0),Gn(r)&&(r.__t=void 0)}}function at(e=""){return document.createTextNode(e)}function Os(e){return Wa.call(e)}function Tr(e){return Va.call(e)}function _(e,t){return Os(e)}function Ho(e,t=!1){{var r=Os(e);return r instanceof Comment&&r.data===""?Tr(r):r}}function h(e,t=1,r=!1){let s=e;for(;t--;)s=Tr(s);return s}function Bo(e){e.textContent=""}function qa(){return!1}function Ko(e,t,r){return document.createElementNS(ya,e,void 0)}let ta=!1;function Yo(){ta||(ta=!0,document.addEventListener("reset",e=>{Promise.resolve().then(()=>{var t;if(!e.defaultPrevented)for(const r of e.target.elements)(t=r.__on_r)==null||t.call(r)})},{capture:!0}))}function Kr(e){var t=O,r=F;De(null),Fe(null);try{return e()}finally{De(t),Fe(r)}}function Ua(e,t,r,s=r){e.addEventListener(t,()=>Kr(r));const a=e.__on_r;a?e.__on_r=()=>{a(),s(!0)}:e.__on_r=()=>s(!0),Yo()}function za(e){F===null&&(O===null&&io(),ao()),gt&&no()}function Go(e,t){var r=t.last;r===null?t.last=t.first=e:(r.next=e,e.prev=r,t.last=e)}function Qe(e,t){var r=F;r!==null&&r.f&ue&&(e|=ue);var s={ctx:B,deps:null,nodes:null,f:e|ae|Re,first:null,fn:t,last:null,next:null,parent:r,b:r&&r.b,prev:null,teardown:null,wv:0,ac:null};T==null||T.register_created_effect(s);var a=s;if(e&Qt)zt!==null?zt.push(s):Ft.ensure().schedule(s);else if(t!==null){try{It(s)}catch(u){throw _e(s),u}a.deps===null&&a.teardown===null&&a.nodes===null&&a.first===a.last&&!(a.f&tr)&&(a=a.first,e&Je&&e&Xt&&a!==null&&(a.f|=Xt))}if(a!==null&&(a.parent=r,r!==null&&Go(a,r),O!==null&&O.f&oe&&!(e&ht))){var i=O;(i.effects??(i.effects=[])).push(a)}return s}function Is(){return O!==null&&!$e}function js(e){const t=Qe(xr,null);return J(t,Z),t.teardown=e,t}function Es(e){za();var t=F.f,r=!O&&(t&We)!==0&&(t&jt)===0;if(r){var s=B;(s.e??(s.e=[])).push(e)}else return Ha(e)}function Ha(e){return Qe(Qt|ga,e)}function Jo(e){return za(),Qe(xr|ga,e)}function Qo(e){Ft.ensure();const t=Qe(ht|tr,e);return(r={})=>new Promise(s=>{r.outro?Nt(t,()=>{_e(t),s(void 0)}):(_e(t),s(void 0))})}function Xo(e){return Qe(Qt,e)}function xe(e,t){var r=B,s={effect:null,ran:!1,deps:e};r.l.$.push(s),s.effect=Yr(()=>{if(e(),!s.ran){s.ran=!0;var a=F;try{Fe(a.parent),b(t)}finally{Fe(a)}}})}function Zo(){var e=B;Yr(()=>{for(var t of e.l.$){t.deps();var r=t.effect;r.f&Z&&r.deps!==null&&J(r,Ve),rr(r)&&It(r),t.ran=!1}})}function ec(e){return Qe(_r|tr,e)}function Yr(e,t=0){return Qe(xr|t,e)}function U(e,t=[],r=[],s=[]){Lo(s,t,r,a=>{Qe(xr,()=>e(...a.map(n)))})}function Ls(e,t=0){var r=Qe(Je|t,e);return r}function Ce(e){return Qe(We|tr,e)}function Ba(e){var t=e.teardown;if(t!==null){const r=gt,s=O;ra(!0),De(null);try{t.call(null)}finally{ra(r),De(s)}}}function Ps(e,t=!1){var r=e.first;for(e.first=e.last=null;r!==null;){const a=r.ac;a!==null&&Kr(()=>{a.abort(et)});var s=r.next;r.f&ht?r.parent=null:_e(r,t),r=s}}function tc(e){for(var t=e.first;t!==null;){var r=t.next;t.f&We||_e(t),t=r}}function _e(e,t=!0){var r=!1;(t||e.f&to)&&e.nodes!==null&&e.nodes.end!==null&&(rc(e.nodes.start,e.nodes.end),r=!0),J(e,Jn),Ps(e,t&&!r),hr(e,0);var s=e.nodes&&e.nodes.t;if(s!==null)for(const i of s)i.stop();Ba(e),e.f^=Jn,e.f|=Ne;var a=e.parent;a!==null&&a.first!==null&&Ka(e),e.next=e.prev=e.teardown=e.ctx=e.deps=e.fn=e.nodes=e.ac=e.b=null}function rc(e,t){for(;e!==null;){var r=e===t?null:Tr(e);e.remove(),e=r}}function Ka(e){var t=e.parent,r=e.prev,s=e.next;r!==null&&(r.next=s),s!==null&&(s.prev=r),t!==null&&(t.first===e&&(t.first=s),t.last===e&&(t.last=r))}function Nt(e,t,r=!0){var s=[];Ya(e,s,!0);var a=()=>{r&&_e(e),t&&t()},i=s.length;if(i>0){var u=()=>--i||a();for(var v of s)v.out(u)}else a()}function Ya(e,t,r){if(!(e.f&ue)){e.f^=ue;var s=e.nodes&&e.nodes.t;if(s!==null)for(const v of s)(v.is_global||r)&&t.push(v);for(var a=e.first;a!==null;){var i=a.next;if(!(a.f&ht)){var u=(a.f&Xt)!==0||(a.f&We)!==0&&(e.f&Je)!==0;Ya(a,t,u?r:!1)}a=i}}}function $s(e){Ga(e,!0)}function Ga(e,t){if(e.f&ue){e.f^=ue,e.f&Z||(J(e,ae),Ft.ensure().schedule(e));for(var r=e.first;r!==null;){var s=r.next,a=(r.f&Xt)!==0||(r.f&We)!==0;Ga(r,a?t:!1),r=s}var i=e.nodes&&e.nodes.t;if(i!==null)for(const u of i)(u.is_global||t)&&u.in()}}function Ws(e,t){if(e.nodes)for(var r=e.nodes.start,s=e.nodes.end;r!==null;){var a=r===s?null:Tr(r);t.append(r),r=a}}let Wr=!1,gt=!1;function ra(e){gt=e}let O=null,$e=!1;function De(e){O=e}let F=null;function Fe(e){F=e}let Me=null;function sc(e){O!==null&&(Me===null?Me=[e]:Me.push(e))}let pe=null,ge=0,ke=null;function nc(e){ke=e}let Ja=1,Et=0,Mt=Et;function sa(e){Mt=e}function Qa(){return++Ja}function rr(e){var t=e.f;if(t&ae)return!0;if(t&oe&&(e.f&=~Dt),t&Ve){for(var r=e.deps,s=r.length,a=0;a<s;a++){var i=r[a];if(rr(i)&&Ia(i),i.wv>e.wv)return!0}t&Re&&ne===null&&J(e,Z)}return!1}function Xa(e,t,r=!0){var s=e.reactions;if(s!==null&&!(Me!==null&&Jt.call(Me,e)))for(var a=0;a<s.length;a++){var i=s[a];i.f&oe?Xa(i,t,!1):t===i&&(r?J(i,ae):i.f&Z&&J(i,Ve),Ms(i))}}function Za(e){var A;var t=pe,r=ge,s=ke,a=O,i=Me,u=B,v=$e,d=Mt,p=e.f;pe=null,ge=0,ke=null,O=p&(We|ht)?null:e,Me=null,Zt(e.ctx),$e=!1,Mt=++Et,e.ac!==null&&(Kr(()=>{e.ac.abort(et)}),e.ac=null);try{e.f|=Vr;var g=e.fn,x=g();e.f|=jt;var w=e.deps,y=T==null?void 0:T.is_fork;if(pe!==null){var o;if(y||hr(e,ge),w!==null&&ge>0)for(w.length=ge+pe.length,o=0;o<pe.length;o++)w[ge+o]=pe[o];else e.deps=w=pe;if(Is()&&e.f&Re)for(o=ge;o<w.length;o++)((A=w[o]).reactions??(A.reactions=[])).push(e)}else!y&&w!==null&&ge<w.length&&(hr(e,ge),w.length=ge);if(Sr()&&ke!==null&&!$e&&w!==null&&!(e.f&(oe|Ve|ae)))for(o=0;o<ke.length;o++)Xa(ke[o],e);if(a!==null&&a!==e){if(Et++,a.deps!==null)for(let m=0;m<r;m+=1)a.deps[m].rv=Et;if(t!==null)for(const m of t)m.rv=Et;ke!==null&&(s===null?s=ke:s.push(...ke))}return e.f&pt&&(e.f^=pt),x}catch(m){return Ta(m)}finally{e.f^=Vr,pe=t,ge=r,ke=s,O=a,Me=i,Zt(u),$e=v,Mt=d}}function ac(e,t){let r=t.reactions;if(r!==null){var s=Gl.call(r,e);if(s!==-1){var a=r.length-1;a===0?r=t.reactions=null:(r[s]=r[a],r.pop())}}if(r===null&&t.f&oe&&(pe===null||!Jt.call(pe,t))){var i=t;i.f&Re&&(i.f^=Re,i.f&=~Dt),i.v!==re&&Rs(i),Vo(i),hr(i,0)}}function hr(e,t){var r=e.deps;if(r!==null)for(var s=t;s<r.length;s++)ac(e,r[s])}function It(e){var t=e.f;if(!(t&Ne)){J(e,Z);var r=F,s=Wr;F=e,Wr=!0;try{t&(Je|ha)?tc(e):Ps(e),Ba(e);var a=Za(e);e.teardown=typeof a=="function"?a:null,e.wv=Ja;var i;Yl&&Eo&&e.f&ae&&e.deps}finally{Wr=s,F=r}}}async function ic(){await Promise.resolve(),Co()}function n(e){var t=e.f,r=(t&oe)!==0;if(O!==null&&!$e){var s=F!==null&&(F.f&Ne)!==0;if(!s&&(Me===null||!Jt.call(Me,e))){var a=O.deps;if(O.f&Vr)e.rv<Et&&(e.rv=Et,pe===null&&a!==null&&a[ge]===e?ge++:pe===null?pe=[e]:pe.push(e));else{(O.deps??(O.deps=[])).push(e);var i=e.reactions;i===null?e.reactions=[O]:Jt.call(i,O)||i.push(O)}}}if(gt&&Rt.has(e))return Rt.get(e);if(r){var u=e;if(gt){var v=u.v;return(!(u.f&Z)&&u.reactions!==null||ti(u))&&(v=Fs(u)),Rt.set(u,v),v}var d=(u.f&Re)===0&&!$e&&O!==null&&(Wr||(O.f&Re)!==0),p=(u.f&jt)===0;rr(u)&&(d&&(u.f|=Re),Ia(u)),d&&!p&&(ja(u),ei(u))}if(ne!=null&&ne.has(e))return ne.get(e);if(e.f&pt)throw e.v;return e.v}function ei(e){if(e.f|=Re,e.deps!==null)for(const t of e.deps)(t.reactions??(t.reactions=[])).push(e),t.f&oe&&!(t.f&Re)&&(ja(t),ei(t))}function ti(e){if(e.v===re)return!0;if(e.deps===null)return!1;for(const t of e.deps)if(Rt.has(t)||t.f&oe&&ti(t))return!0;return!1}function b(e){var t=$e;try{return $e=!0,e()}finally{$e=t}}function lc(e){if(!(typeof e!="object"||!e||e instanceof EventTarget)){if(Ct in e)xs(e);else if(!Array.isArray(e))for(let t in e){const r=e[t];typeof r=="object"&&r&&Ct in r&&xs(r)}}}function xs(e,t=new Set){if(typeof e=="object"&&e!==null&&!(e instanceof EventTarget)&&!t.has(e)){t.add(e),e instanceof Date&&e.getTime();for(let s in e)try{xs(e[s],t)}catch{}const r=Cs(e);if(r!==Object.prototype&&r!==Array.prototype&&r!==Map.prototype&&r!==Set.prototype&&r!==Date.prototype){const s=pa(r);for(let a in s){const i=s[a].get;if(i)try{i.call(e)}catch{}}}}}const oc=["touchstart","touchmove"];function cc(e){return oc.includes(e)}const Nr=Symbol("events"),fc=new Set,na=new Set;function uc(e,t,r,s={}){function a(i){if(s.capture||ks.call(t,i),!i.cancelBubble)return Kr(()=>r==null?void 0:r.call(this,i))}return e.startsWith("pointer")||e.startsWith("touch")||e==="wheel"?_t(()=>{t.addEventListener(e,a,s)}):t.addEventListener(e,a,s),a}function Mr(e,t,r,s,a){var i={capture:s,passive:a},u=uc(e,t,r,i);(t===document.body||t===window||t===document||t instanceof HTMLMediaElement)&&js(()=>{t.removeEventListener(e,u,i)})}let aa=null;function ks(e){var m,C;var t=this,r=t.ownerDocument,s=e.type,a=((m=e.composedPath)==null?void 0:m.call(e))||[],i=a[0]||e.target;aa=e;var u=0,v=aa===e&&e[Nr];if(v){var d=a.indexOf(v);if(d!==-1&&(t===document||t===window)){e[Nr]=t;return}var p=a.indexOf(t);if(p===-1)return;d<=p&&(u=d)}if(i=a[u]||e.target,i!==t){Jl(e,"currentTarget",{configurable:!0,get(){return i||r}});var g=O,x=F;De(null),Fe(null);try{for(var w,y=[];i!==null;){var o=i.assignedSlot||i.parentNode||i.host||null;try{var A=(C=i[Nr])==null?void 0:C[s];A!=null&&(!i.disabled||e.target===i)&&A.call(i,e)}catch(W){w?y.push(W):w=W}if(e.cancelBubble||o===t||o===null)break;i=o}if(w){for(let W of y)queueMicrotask(()=>{throw W});throw w}}finally{e[Nr]=t,delete e.currentTarget,De(g),Fe(x)}}}var da;const cs=((da=globalThis==null?void 0:globalThis.window)==null?void 0:da.trustedTypes)&&globalThis.window.trustedTypes.createPolicy("svelte-trusted-html",{createHTML:e=>e});function dc(e){return(cs==null?void 0:cs.createHTML(e))??e}function vc(e){var t=Ko("template");return t.innerHTML=dc(e.replaceAll("<!>","<!---->")),t.content}function Vs(e,t){var r=F;r.nodes===null&&(r.nodes={start:e,end:t,a:null,t:null})}function V(e,t){var r=(t&go)!==0,s,a=!e.startsWith("<!>");return()=>{s===void 0&&(s=vc(a?e:"<!>"+e),s=Os(s));var i=r||$a?document.importNode(s,!0):s.cloneNode(!0);return Vs(i,i),i}}function ia(e=""){{var t=at(e+"");return Vs(t,t),t}}function pc(){var e=document.createDocumentFragment(),t=document.createComment(""),r=at();return e.append(t,r),Vs(t,r),e}function P(e,t){e!==null&&e.before(t)}function k(e,t){var r=t==null?"":typeof t=="object"?`${t}`:t;r!==(e.__t??(e.__t=e.nodeValue))&&(e.__t=r,e.nodeValue=`${r}`)}function _c(e,t){return hc(e,t)}const Dr=new Map;function hc(e,{target:t,anchor:r,props:s={},events:a,context:i,intro:u=!0,transformError:v}){zo();var d=void 0,p=Qo(()=>{var g=r??t.appendChild(at());Do(g,{pending:()=>{}},y=>{xa({});var o=B;i&&(o.c=i),a&&(s.$$events=a),d=e(y,s)||{},ka()},v);var x=new Set,w=y=>{for(var o=0;o<y.length;o++){var A=y[o];if(!x.has(A)){x.add(A);var m=cc(A);for(const L of[t,document]){var C=Dr.get(L);C===void 0&&(C=new Map,Dr.set(L,C));var W=C.get(A);W===void 0?(L.addEventListener(A,ks,{passive:m}),C.set(A,1)):C.set(A,W+1)}}}};return w(Br(fc)),na.add(w),()=>{var m;for(var y of x)for(const C of[t,document]){var o=Dr.get(C),A=o.get(y);--A==0?(C.removeEventListener(y,ks),o.delete(y),o.size===0&&Dr.delete(C)):o.set(y,A)}na.delete(w),g!==r&&((m=g.parentNode)==null||m.removeChild(g))}});return gc.set(d,p),d}let gc=new WeakMap;var Pe,Ye,ye,At,wr,Er,Hr;class bc{constructor(t,r=!0){je(this,"anchor");M(this,Pe,new Map);M(this,Ye,new Map);M(this,ye,new Map);M(this,At,new Set);M(this,wr,!0);M(this,Er,t=>{if(c(this,Pe).has(t)){var r=c(this,Pe).get(t),s=c(this,Ye).get(r);if(s)$s(s),c(this,At).delete(r);else{var a=c(this,ye).get(r);a&&(c(this,Ye).set(r,a.effect),c(this,ye).delete(r),a.fragment.lastChild.remove(),this.anchor.before(a.fragment),s=a.effect)}for(const[i,u]of c(this,Pe)){if(c(this,Pe).delete(i),i===t)break;const v=c(this,ye).get(u);v&&(_e(v.effect),c(this,ye).delete(u))}for(const[i,u]of c(this,Ye)){if(i===r||c(this,At).has(i))continue;const v=()=>{if(Array.from(c(this,Pe).values()).includes(i)){var p=document.createDocumentFragment();Ws(u,p),p.append(at()),c(this,ye).set(i,{effect:u,fragment:p})}else _e(u);c(this,At).delete(i),c(this,Ye).delete(i)};c(this,wr)||!s?(c(this,At).add(i),Nt(u,v,!1)):v()}}});M(this,Hr,t=>{c(this,Pe).delete(t);const r=Array.from(c(this,Pe).values());for(const[s,a]of c(this,ye))r.includes(s)||(_e(a.effect),c(this,ye).delete(s))});this.anchor=t,D(this,wr,r)}ensure(t,r){var s=T,a=qa();if(r&&!c(this,Ye).has(t)&&!c(this,ye).has(t))if(a){var i=document.createDocumentFragment(),u=at();i.append(u),c(this,ye).set(t,{effect:Ce(()=>r(u)),fragment:i})}else c(this,Ye).set(t,Ce(()=>r(this.anchor)));if(c(this,Pe).set(s,t),a){for(const[v,d]of c(this,Ye))v===t?s.unskip_effect(d):s.skip_effect(d);for(const[v,d]of c(this,ye))v===t?s.unskip_effect(d.effect):s.skip_effect(d.effect);s.oncommit(c(this,Er)),s.ondiscard(c(this,Hr))}else c(this,Er).call(this,s)}}Pe=new WeakMap,Ye=new WeakMap,ye=new WeakMap,At=new WeakMap,wr=new WeakMap,Er=new WeakMap,Hr=new WeakMap;function ce(e,t,r=!1){var s=new bc(e),a=r?Xt:0;function i(u,v){s.ensure(u,v)}Ls(()=>{var u=!1;t((v,d=0)=>{u=!0,i(d,v)}),u||i(-1,null)},a)}function mc(e,t,r){for(var s=[],a=t.length,i,u=t.length,v=0;v<a;v++){let x=t[v];Nt(x,()=>{if(i){if(i.pending.delete(x),i.done.add(x),i.pending.size===0){var w=e.outrogroups;Ss(e,Br(i.done)),w.delete(i),w.size===0&&(e.outrogroups=null)}}else u-=1},!1)}if(u===0){var d=s.length===0&&r!==null;if(d){var p=r,g=p.parentNode;Bo(g),g.append(p),e.items.clear()}Ss(e,t,!d)}else i={pending:new Set(t),done:new Set},(e.outrogroups??(e.outrogroups=new Set)).add(i)}function Ss(e,t,r=!0){var s;if(e.pending.size>0){s=new Set;for(const u of e.pending.values())for(const v of u)s.add(e.items.get(v).e)}for(var a=0;a<t.length;a++){var i=t[a];if(s!=null&&s.has(i)){i.f|=Ge;const u=document.createDocumentFragment();Ws(i,u)}else _e(t[a],r)}}var la;function Ut(e,t,r,s,a,i=null){var u=e,v=new Map,d=(t&ma)!==0;if(d){var p=e;u=p.appendChild(at())}var g=null,x=Oa(()=>{var L=r();return As(L)?L:L==null?[]:Br(L)}),w,y=new Map,o=!0;function A(L){W.effect.f&Ne||(W.pending.delete(L),W.fallback=g,yc(W,w,u,t,s),g!==null&&(w.length===0?g.f&Ge?(g.f^=Ge,fr(g,null,u)):$s(g):Nt(g,()=>{g=null})))}function m(L){W.pending.delete(L)}var C=Ls(()=>{w=n(x);for(var L=w.length,K=new Set,ie=T,qe=qa(),I=0;I<L;I+=1){var Xe=w[I],it=s(Xe,I),de=o?null:v.get(it);de?(de.v&&er(de.v,Xe),de.i&&er(de.i,I),qe&&ie.unskip_effect(de.e)):(de=wc(v,o?u:la??(la=at()),Xe,it,I,a,t,r),o||(de.e.f|=Ge),v.set(it,de)),K.add(it)}if(L===0&&i&&!g&&(o?g=Ce(()=>i(u)):(g=Ce(()=>i(la??(la=at()))),g.f|=Ge)),L>K.size&&so(),!o)if(y.set(ie,K),qe){for(const[Ue,Lt]of v)K.has(Ue)||ie.skip_effect(Lt.e);ie.oncommit(A),ie.ondiscard(m)}else A(ie);n(x)}),W={effect:C,items:v,pending:y,outrogroups:null,fallback:g};o=!1}function lr(e){for(;e!==null&&!(e.f&We);)e=e.next;return e}function yc(e,t,r,s,a){var de,Ue,Lt,Pt,sr,bt,Ar,$t,nr;var i=(s&_o)!==0,u=t.length,v=e.items,d=lr(e.effect.first),p,g=null,x,w=[],y=[],o,A,m,C;if(i)for(C=0;C<u;C+=1)o=t[C],A=a(o,C),m=v.get(A).e,m.f&Ge||((Ue=(de=m.nodes)==null?void 0:de.a)==null||Ue.measure(),(x??(x=new Set)).add(m));for(C=0;C<u;C+=1){if(o=t[C],A=a(o,C),m=v.get(A).e,e.outrogroups!==null)for(const we of e.outrogroups)we.pending.delete(m),we.done.delete(m);if(m.f&ue&&($s(m),i&&((Pt=(Lt=m.nodes)==null?void 0:Lt.a)==null||Pt.unfix(),(x??(x=new Set)).delete(m))),m.f&Ge)if(m.f^=Ge,m===d)fr(m,null,r);else{var W=g?g.next:d;m===e.effect.last&&(e.effect.last=m.prev),m.prev&&(m.prev.next=m.next),m.next&&(m.next.prev=m.prev),ft(e,g,m),ft(e,m,W),fr(m,W,r),g=m,w=[],y=[],d=lr(g.next);continue}if(m!==d){if(p!==void 0&&p.has(m)){if(w.length<y.length){var L=y[0],K;g=L.prev;var ie=w[0],qe=w[w.length-1];for(K=0;K<w.length;K+=1)fr(w[K],L,r);for(K=0;K<y.length;K+=1)p.delete(y[K]);ft(e,ie.prev,qe.next),ft(e,g,ie),ft(e,qe,L),d=L,g=qe,C-=1,w=[],y=[]}else p.delete(m),fr(m,d,r),ft(e,m.prev,m.next),ft(e,m,g===null?e.effect.first:g.next),ft(e,g,m),g=m;continue}for(w=[],y=[];d!==null&&d!==m;)(p??(p=new Set)).add(d),y.push(d),d=lr(d.next);if(d===null)continue}m.f&Ge||w.push(m),g=m,d=lr(m.next)}if(e.outrogroups!==null){for(const we of e.outrogroups)we.pending.size===0&&(Ss(e,Br(we.done)),(sr=e.outrogroups)==null||sr.delete(we));e.outrogroups.size===0&&(e.outrogroups=null)}if(d!==null||p!==void 0){var I=[];if(p!==void 0)for(m of p)m.f&ue||I.push(m);for(;d!==null;)!(d.f&ue)&&d!==e.fallback&&I.push(d),d=lr(d.next);var Xe=I.length;if(Xe>0){var it=s&ma&&u===0?r:null;if(i){for(C=0;C<Xe;C+=1)(Ar=(bt=I[C].nodes)==null?void 0:bt.a)==null||Ar.measure();for(C=0;C<Xe;C+=1)(nr=($t=I[C].nodes)==null?void 0:$t.a)==null||nr.fix()}mc(e,I,it)}}i&&_t(()=>{var we,ar;if(x!==void 0)for(m of x)(ar=(we=m.nodes)==null?void 0:we.a)==null||ar.apply()})}function wc(e,t,r,s,a,i,u,v){var d=u&vo?u&ho?Ot(r):X(r,!1,!1):null,p=u&po?Ot(a):null;return{v:d,i:p,e:Ce(()=>(i(t,d??r,p??a,v),()=>{e.delete(s)}))}}function fr(e,t,r){if(e.nodes)for(var s=e.nodes.start,a=e.nodes.end,i=t&&!(t.f&Ge)?t.nodes.start:r;s!==null;){var u=Tr(s);if(i.before(s),s===a)return;s=u}}function ft(e,t,r){t===null?e.effect.first=r:t.next=r,r===null?e.effect.last=t:r.prev=t}const oa=[...`
|
|
2
|
-
\r\f \v\uFEFF`];function Ec(e,t,r){var s=e==null?"":""+e;if(r){for(var a of Object.keys(r))if(r[a])s=s?s+" "+a:a;else if(s.length)for(var i=a.length,u=0;(u=s.indexOf(a,u))>=0;){var v=u+i;(u===0||oa.includes(s[u-1]))&&(v===s.length||oa.includes(s[v]))?s=(u===0?"":s.substring(0,u))+s.substring(v+1):u=v}}return s===""?null:s}function xc(e,t){return e==null?null:String(e)}function or(e,t,r,s,a,i){var u=e.__className;if(u!==r||u===void 0){var v=Ec(r,s,i);v==null?e.removeAttribute("class"):e.className=v,e.__className=r}else if(i&&a!==i)for(var d in i){var p=!!i[d];(a==null||p!==!!a[d])&&e.classList.toggle(d,p)}return i}function ca(e,t,r,s){var a=e.__style;if(a!==t){var i=xc(t);i==null?e.removeAttribute("style"):e.style.cssText=i,e.__style=t}return s}function ri(e,t,r=!1){if(e.multiple){if(t==null)return;if(!As(t))return mo();for(var s of e.options)s.selected=t.includes(pr(s));return}for(s of e.options){var a=pr(s);if(Uo(a,t)){s.selected=!0;return}}(!r||t!==void 0)&&(e.selectedIndex=-1)}function kc(e){var t=new MutationObserver(()=>{ri(e,e.__value)});t.observe(e,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["value"]}),js(()=>{t.disconnect()})}function fs(e,t,r=t){var s=new WeakSet,a=!0;Ua(e,"change",i=>{var u=i?"[selected]":":checked",v;if(e.multiple)v=[].map.call(e.querySelectorAll(u),pr);else{var d=e.querySelector(u)??e.querySelector("option:not([disabled])");v=d&&pr(d)}r(v),e.__value=v,T!==null&&s.add(T)}),Xo(()=>{var i=t();if(e===document.activeElement){var u=T;if(s.has(u))return}if(ri(e,i,a),a&&i===void 0){var v=e.querySelector(":checked");v!==null&&(i=pr(v),r(i))}e.__value=i,a=!1}),kc(e)}function pr(e){return"__value"in e?e.__value:e.value}const Sc=Symbol("is custom element"),Tc=Symbol("is html");function Ac(e,t,r,s){var a=Cc(e);a[t]!==(a[t]=r)&&(r==null?e.removeAttribute(t):typeof r!="string"&&Rc(e).includes(t)?e[t]=r:e.setAttribute(t,r))}function Cc(e){return e.__attributes??(e.__attributes={[Sc]:e.nodeName.includes("-"),[Tc]:e.namespaceURI===ya})}var fa=new Map;function Rc(e){var t=e.getAttribute("is")||e.nodeName,r=fa.get(t);if(r)return r;fa.set(t,r=[]);for(var s,a=e,i=Element.prototype;i!==a;){s=pa(a);for(var u in s)s[u].set&&r.push(u);a=Cs(a)}return r}function Fr(e,t,r=t){var s=new WeakSet;Ua(e,"input",async a=>{var i=a?e.defaultValue:e.value;if(i=us(e)?ds(i):i,r(i),T!==null&&s.add(T),await ic(),i!==(i=t())){var u=e.selectionStart,v=e.selectionEnd,d=e.value.length;if(e.value=i??"",v!==null){var p=e.value.length;u===v&&v===d&&p>d?(e.selectionStart=p,e.selectionEnd=p):(e.selectionStart=u,e.selectionEnd=Math.min(v,p))}}}),b(t)==null&&e.value&&(r(us(e)?ds(e.value):e.value),T!==null&&s.add(T)),Yr(()=>{var a=t();if(e===document.activeElement){var i=T;if(s.has(i))return}us(e)&&a===ds(e.value)||e.type==="date"&&!a&&!e.value||a!==e.value&&(e.value=a??"")})}function us(e){var t=e.type;return t==="number"||t==="range"}function ds(e){return e===""?null:+e}function Nc(e){return function(...t){var r=t[0];return r.preventDefault(),e==null?void 0:e.apply(this,t)}}function Mc(e=!1){const t=B,r=t.l.u;if(!r)return;let s=()=>lc(t.s);if(e){let a=0,i={};const u=Ds(()=>{let v=!1;const d=t.s;for(const p in d)d[p]!==i[p]&&(i[p]=d[p],v=!0);return v&&a++,a});s=()=>n(u)}r.b.length&&Jo(()=>{ua(t,s),vs(r.b)}),Es(()=>{const a=b(()=>r.m.map(eo));return()=>{for(const i of a)typeof i=="function"&&i()}}),r.a.length&&Es(()=>{ua(t,s),vs(r.a)})}function ua(e,t){if(e.l.s)for(const r of e.l.s)n(r);t()}function Dc(e){B===null&&ba(),kr&&B.l!==null?Oc(B).m.push(e):Es(()=>{const t=b(e);if(typeof t=="function")return t})}function Fc(e){B===null&&ba(),Dc(()=>()=>b(e))}function Oc(e){var t=e.l;return t.u??(t.u={a:[],b:[],m:[]})}const Ic="5";var va;typeof window<"u"&&((va=window.__svelte??(window.__svelte={})).v??(va.v=new Set)).add(Ic);xo();var jc=V('<div class="svelte-d3ct2b"><span class="svelte-d3ct2b">Watch issue</span><strong class="status-warn svelte-d3ct2b"> </strong></div>'),Lc=V('<section class="notice svelte-d3ct2b"> </section>'),Pc=V('<section class="notice danger svelte-d3ct2b"> </section>'),$c=V('<p class="terminal-line svelte-d3ct2b"><time class="svelte-d3ct2b">--:--:--</time><span class="sys svelte-d3ct2b">SYS</span><strong class="svelte-d3ct2b">Waiting for memory-core watch output...</strong></p>'),Wc=V('<strong class="svelte-d3ct2b"> </strong>'),Vc=V('<strong class="svelte-d3ct2b"> </strong>'),qc=V('<strong class="svelte-d3ct2b"> </strong>'),Uc=V('<strong class="svelte-d3ct2b"> </strong>'),zc=V('<strong class="svelte-d3ct2b"> </strong>'),Hc=V('<p class="svelte-d3ct2b"><b class="svelte-d3ct2b">Why:</b> </p>'),Bc=V('<p class="svelte-d3ct2b"><b class="svelte-d3ct2b">Issue:</b> </p>'),Kc=V('<p class="svelte-d3ct2b"><b class="svelte-d3ct2b">Fix:</b> </p>'),Yc=V('<pre class="svelte-d3ct2b"> </pre>'),Gc=V('<div class="terminal-detail svelte-d3ct2b"><p class="svelte-d3ct2b"> </p> <p class="svelte-d3ct2b"><b class="svelte-d3ct2b">Rule:</b> </p> <!> <!> <!> <!></div>'),Jc=V('<section><p class="terminal-line svelte-d3ct2b"><time class="svelte-d3ct2b"> </time> <span class="svelte-d3ct2b"> </span> <!></p> <!></section>'),Qc=V('<div class="metric-row svelte-d3ct2b"><div class="svelte-d3ct2b"><span class="svelte-d3ct2b"> </span> <strong class="svelte-d3ct2b"> </strong></div> <i class="svelte-d3ct2b"></i></div>'),Xc=V('<p class="empty svelte-d3ct2b">No rule counters yet.</p>'),Zc=V('<div class="metric-row warning svelte-d3ct2b"><div class="svelte-d3ct2b"><span class="svelte-d3ct2b"> </span> <strong class="svelte-d3ct2b"> </strong></div> <i class="svelte-d3ct2b"></i></div>'),ef=V('<p class="empty svelte-d3ct2b">No file counters yet.</p>'),tf=V('<small class="svelte-d3ct2b"> </small>'),rf=V('<small class="svelte-d3ct2b"> </small>'),sf=V('<section class="commit-item svelte-d3ct2b"><div class="commit-meta svelte-d3ct2b"><span> </span> <time> </time></div> <strong class="svelte-d3ct2b"> </strong> <p class="svelte-d3ct2b"> </p> <!> <!></section>'),nf=V('<article class="glass-panel commit-watch svelte-d3ct2b"><div class="card-head svelte-d3ct2b"><h2 class="svelte-d3ct2b">Commit Watch</h2> <span class="svelte-d3ct2b"> </span></div> <div class="commit-list svelte-d3ct2b"></div></article>'),af=V('<small class="svelte-d3ct2b"> </small>'),lf=V('<div class="rule-item svelte-d3ct2b"><div><div class="rule-meta svelte-d3ct2b"><span class="svelte-d3ct2b"> </span> <code class="svelte-d3ct2b"> </code></div> <p class="svelte-d3ct2b"> </p> <!></div> <button class="svelte-d3ct2b">Delete</button></div>'),of=V('<p class="empty svelte-d3ct2b">No rules match the current filters.</p>'),cf=V('<div class="command-center svelte-d3ct2b"><aside class="sidebar svelte-d3ct2b"><div class="brand svelte-d3ct2b"><h1 class="svelte-d3ct2b">memory-core</h1> <span class="svelte-d3ct2b">command center</span></div> <nav aria-label="Dashboard navigation" class="svelte-d3ct2b"><a class="nav-item active svelte-d3ct2b" href="/"><span class="nav-icon svelte-d3ct2b">[]</span> <span>Command Center</span></a></nav> <div class="sidebar-footer svelte-d3ct2b"><div><i class="svelte-d3ct2b"></i> </div> <small class="svelte-d3ct2b"> </small></div></aside> <div class="workspace svelte-d3ct2b"><header class="topbar svelte-d3ct2b"><div class="topbar-left svelte-d3ct2b"><button class="icon-button mobile-menu svelte-d3ct2b" aria-label="Menu">=</button> <div><i class="svelte-d3ct2b"></i> <span> </span></div></div> <div class="header-metrics svelte-d3ct2b" aria-label="Global metrics"><div class="svelte-d3ct2b"><span class="svelte-d3ct2b">Violations</span> <strong class="svelte-d3ct2b"> </strong></div> <div class="svelte-d3ct2b"><span class="svelte-d3ct2b">Files</span> <strong class="svelte-d3ct2b"> </strong></div> <div class="svelte-d3ct2b"><span class="svelte-d3ct2b">Rules</span> <strong class="svelte-d3ct2b"> </strong></div></div> <div class="top-actions svelte-d3ct2b" aria-label="Status shortcuts"><button class="icon-button svelte-d3ct2b" title="Refresh from current path" aria-label="Refresh from current path">REF</button> <button class="icon-button svelte-d3ct2b" title="Clear dashboard cache" aria-label="Clear dashboard cache">CLR</button></div></header> <main class="canvas svelte-d3ct2b"><section class="status-grid svelte-d3ct2b"><article class="glass-panel status-card svelte-d3ct2b"><div class="card-head svelte-d3ct2b"><h2 class="svelte-d3ct2b">Project</h2> <span class="svelte-d3ct2b"> </span></div> <div class="data-list svelte-d3ct2b"><div class="svelte-d3ct2b"><span class="svelte-d3ct2b">Name</span><strong class="svelte-d3ct2b"> </strong></div> <div class="svelte-d3ct2b"><span class="svelte-d3ct2b">Type</span><strong class="svelte-d3ct2b"> </strong></div> <div class="svelte-d3ct2b"><span class="svelte-d3ct2b">Language</span><strong class="svelte-d3ct2b"> </strong></div> <div class="svelte-d3ct2b"><span class="svelte-d3ct2b">Architecture</span><strong class="svelte-d3ct2b"> </strong></div> <div class="svelte-d3ct2b"><span class="svelte-d3ct2b">Watcher</span><strong class="svelte-d3ct2b"> </strong></div> <!></div></article> <article class="glass-panel status-card svelte-d3ct2b"><div class="card-head svelte-d3ct2b"><h2 class="svelte-d3ct2b">Runtime</h2> <span class="svelte-d3ct2b"> </span></div> <div class="data-list svelte-d3ct2b"><div class="svelte-d3ct2b"><span class="svelte-d3ct2b">Provider</span><strong class="svelte-d3ct2b"> </strong></div> <div class="svelte-d3ct2b"><span class="svelte-d3ct2b">Check model</span><strong class="svelte-d3ct2b"> </strong></div> <div class="svelte-d3ct2b"><span class="svelte-d3ct2b">Check status</span> <strong><!></strong></div> <div class="svelte-d3ct2b"><span class="svelte-d3ct2b">Embedding</span><strong class="svelte-d3ct2b"> </strong></div> <div class="svelte-d3ct2b"><span class="svelte-d3ct2b">Ollama URL</span><strong class="svelte-d3ct2b"> </strong></div></div></article> <article class="glass-panel status-card svelte-d3ct2b"><div class="card-head svelte-d3ct2b"><h2 class="svelte-d3ct2b">PostgreSQL</h2> <span> </span></div> <div class="data-list svelte-d3ct2b"><div class="svelte-d3ct2b"><span class="svelte-d3ct2b">Database</span><strong class="svelte-d3ct2b"> </strong></div> <div class="svelte-d3ct2b"><span class="svelte-d3ct2b">User</span><strong class="svelte-d3ct2b"> </strong></div> <div class="svelte-d3ct2b"><span class="svelte-d3ct2b">Host</span><strong class="svelte-d3ct2b"> </strong></div> <div class="svelte-d3ct2b"><span class="svelte-d3ct2b">URL</span><strong class="svelte-d3ct2b"> </strong></div></div></article></section> <!> <!> <section class="terminal-panel glass-panel svelte-d3ct2b"><div class="terminal-head svelte-d3ct2b"><div class="svelte-d3ct2b"><span class="terminal-icon svelte-d3ct2b">>_</span> <h2 class="svelte-d3ct2b">Live Feed</h2></div> <div class="window-dots svelte-d3ct2b" aria-hidden="true"><i class="svelte-d3ct2b"></i><i class="svelte-d3ct2b"></i><i class="svelte-d3ct2b"></i></div></div> <div class="terminal-body svelte-d3ct2b"><!> <!></div></section> <section class="content-grid svelte-d3ct2b"><article class="glass-panel stats-panel svelte-d3ct2b"><div class="card-head svelte-d3ct2b"><h2 class="svelte-d3ct2b">Stats</h2> <span class="svelte-d3ct2b">Recorded</span></div> <div class="stat-block svelte-d3ct2b"><h3 class="svelte-d3ct2b">Most Violated Rules</h3> <!></div> <div class="stat-block svelte-d3ct2b"><h3 class="svelte-d3ct2b">Problem Files</h3> <!></div> <div class="summary-strip svelte-d3ct2b"><div class="svelte-d3ct2b"><span class="svelte-d3ct2b">Clean</span><strong class="svelte-d3ct2b"> </strong></div> <div class="svelte-d3ct2b"><span class="svelte-d3ct2b">Issues</span><strong class="svelte-d3ct2b"> </strong></div> <div class="svelte-d3ct2b"><span class="svelte-d3ct2b">Events</span><strong class="svelte-d3ct2b"> </strong></div></div></article> <!> <article class="glass-panel rule-engine svelte-d3ct2b"><div class="card-head svelte-d3ct2b"><h2 class="svelte-d3ct2b">Rule Engine</h2> <span class="svelte-d3ct2b"> </span></div> <form class="rule-form svelte-d3ct2b"><div class="control-grid svelte-d3ct2b"><select class="svelte-d3ct2b"><option>Rule</option><option>Decision</option><option>Pattern</option><option>Ignore</option></select> <select class="svelte-d3ct2b"><option>Project</option><option>Global</option></select></div> <textarea rows="3" placeholder="Rule or decision" class="svelte-d3ct2b"></textarea> <div class="control-grid svelte-d3ct2b"><input placeholder="Reason" class="svelte-d3ct2b"/> <input placeholder="Tags" class="svelte-d3ct2b"/></div> <button class="svelte-d3ct2b"> </button></form> <div class="control-grid filters svelte-d3ct2b"><select class="svelte-d3ct2b"><option>All types</option><option>Rules</option><option>Decisions</option><option>Patterns</option><option>Ignores</option></select> <input placeholder="Search rules..." class="svelte-d3ct2b"/></div> <div class="rule-list svelte-d3ct2b"></div></article></section></main></div></div>');function ff(e,t){xa(t,!1);const r=X(),s=X(),a=X(),i=X(),u=X(),v=X(),d=X(),p=X(),g=X(),x=X(),w=X(),y=X();let o=X({config:null,stats:{rules:{},files:{},topRules:[],topFiles:[]},files:[],memories:[]}),A=X([]),m=X(!1),C=X("all"),W=X(""),L=X(!1),K=X(""),ie,qe=!1,I=X({type:"rule",scope:"project",content:"",reason:"",tags:"dashboard"});const Xe=24*60*60*1e3,it=()=>{var S,R;const l=(R=(S=n(o).runtime)==null?void 0:S.project.name)==null?void 0:R.trim();if(l)return l;const f=Ue("projectName");return f||"memory-core"},de=l=>{if(!l)return null;const f=l.trim().toLowerCase();return{angular:"angular",express:"express",fastify:"fastify",go:"go-api",laravel:"laravel-service-repository",nestjs:"nestjs","next.js":"nextjs","nuxt.js":"nuxt",react:"react","react native":"react-native",svelte:"svelte","vue.js":"vue"}[f]??null},Ue=l=>{var S;const f=(S=n(o).config)==null?void 0:S[l];return typeof f=="string"&&f.trim().length>0?f.trim():void 0},Lt=()=>{var E,$,Ee,lt,ot;const l=((E=n(o).runtime)==null?void 0:E.project.declaredArchitectures)??[],f=(($=n(o).runtime)==null?void 0:$.project.activeArchitectures)??[],S=(Ee=n(o).runtime)==null?void 0:Ee.project.backendArchitecture,R=(lt=n(o).runtime)==null?void 0:lt.project.frontendFramework,z=Ue("backendArchitecture")??Ue("backendArch"),te=Ue("frontendFramework")??Ue("frontendFw"),le=de((ot=n(o).runtime)==null?void 0:ot.project.detected.framework),j=[...new Set([...l,...f,S,R,z,te,le??void 0].filter(Ze=>typeof Ze=="string"&&Ze.length>0))];return j.length>0?j.join(", "):"none"};function Pt(l){N(A,[{...l,id:crypto.randomUUID()},...n(A)].slice(0,80))}function sr(l){return l.type==="saved"?{type:"saved",timestamp:l.timestamp,file:l.file}:l.type==="clean"?{type:"clean",timestamp:l.timestamp,file:l.file}:l.type==="skipped"?{type:"skipped",timestamp:l.timestamp,file:l.file,reason:l.reason}:l.type==="violations"?{type:"violations",timestamp:l.timestamp,file:l.file,violations:l.violations}:l.type==="error"?{type:"error",timestamp:l.timestamp,message:l.message}:l.type==="ready"?{type:"system",timestamp:l.timestamp,message:`Watching ${l.path} | ${l.rules} rules | ${l.model}`}:{type:"system",timestamp:l.timestamp,message:"Watch stopped"}}function bt(l){const f=n(o).files??[],S=f.findIndex(z=>z.file===l.file),R=f.slice();return S===-1?R.push(l):R[S]=l,R.sort((z,te)=>te.lastSeen.localeCompare(z.lastSeen))}function Ar(l){const f=n(o).watcher??{enabled:!0,running:!1,path:void 0,model:void 0,rules:void 0,lastEventAt:void 0,error:void 0};let S=n(o).files,R={...f,lastEventAt:l.timestamp,enabled:!0};l.type==="ready"&&(R={...R,running:!0,error:void 0,path:l.path,model:l.model,rules:l.rules}),l.type==="saved"&&(S=bt({file:l.file,status:"checking",lastSeen:l.timestamp,violations:[]})),l.type==="clean"&&(S=bt({file:l.file,status:"clean",lastSeen:l.timestamp,violations:[]})),l.type==="skipped"&&(S=bt({file:l.file,status:"skipped",lastSeen:l.timestamp,violations:[],message:l.reason})),l.type==="violations"&&(S=bt({file:l.file,status:"violations",lastSeen:l.timestamp,violations:l.violations})),l.type==="error"&&(R={...R,running:!1,error:l.message}),l.type==="stopped"&&(R={...R,running:!1});const z=[l,...n(o).events??[]].slice(0,100);N(o,{...n(o),files:S,events:z,watcher:R})}function $t(l=[]){N(A,l.map(sr).map(f=>({...f,id:crypto.randomUUID()})).reverse().slice(0,80))}function nr(l){return new Intl.DateTimeFormat(void 0,{hour:"2-digit",minute:"2-digit",second:"2-digit"}).format(new Date(l))}function we(l){return Math.max(1,...l.map(f=>f.count))}function ar(l,f){const S=l.file||f;return l.line?`${S}:${l.line}`:S}function si(l){return l.type==="saved"?"SAVE":l.type==="clean"?"OK":l.type==="skipped"?"SKIP":l.type==="violations"?"FAIL":l.type==="error"?"WARN":"SYS"}async function Cr(){const l=await fetch(`/api/snapshot?t=${Date.now()}`,{cache:"no-store"});N(o,await l.json()),$t(n(o).events)}async function ni(){N(K,"");try{const l=await fetch("/api/refresh",{method:"POST",headers:{"content-type":"application/json"},cache:"no-store"});if(!l.ok)throw new Error((await l.json()).error??"Refresh failed");const f=await l.json();f.snapshot?(N(o,f.snapshot),$t(n(o).events)):await Cr()}catch(l){N(K,l.message)}}function ai(){try{localStorage.clear(),sessionStorage.clear()}finally{location.reload()}}async function ii(){if(!qe&&document.visibilityState!=="hidden"){qe=!0;try{const l=await fetch("/api/stats",{cache:"no-store"});if(!l.ok)return;const f=await l.json();if(!f.stats)return;N(o,{...n(o),stats:f.stats})}catch{}finally{qe=!1}}}function li(){ie&&clearInterval(ie),ie=setInterval(()=>{ii()},2e3)}function qs(){const l=location.protocol==="https:"?"wss:":"ws:",f=new WebSocket(`${l}//${location.host}/ws`);f.addEventListener("open",()=>{N(m,!0),Pt({type:"system",timestamp:new Date().toISOString(),message:"Dashboard connected"})}),f.addEventListener("close",()=>{N(m,!1),Pt({type:"error",timestamp:new Date().toISOString(),message:"Dashboard disconnected"}),setTimeout(qs,1500)}),f.addEventListener("message",S=>{const R=JSON.parse(S.data);if(R.type==="snapshot"){N(o,R.snapshot),n(A).length===0&&$t(n(o).events);return}R.type==="watch"&&(Ar(R.event),Pt(sr(R.event)))})}async function oi(){if(n(I).content.trim()){N(L,!0),N(K,"");try{const l=await fetch("/api/memories",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(n(I))});if(!l.ok)throw new Error((await l.json()).error??"Save failed");N(I,{type:"rule",scope:"project",content:"",reason:"",tags:"dashboard"}),await Cr()}catch(l){N(K,l.message)}finally{N(L,!1)}}}async function ci(l){N(K,"");const f=await fetch(`/api/memories/${l}`,{method:"DELETE"});if(!f.ok){N(K,(await f.json()).error??"Delete failed");return}await Cr()}Cr().catch(l=>{N(K,l.message)}),qs(),li(),Fc(()=>{ie&&(clearInterval(ie),ie=void 0)}),xe(()=>(n(o),n(C),n(W)),()=>{N(r,n(o).memories.filter(l=>{const f=n(C)==="all"||l.type===n(C),S=`${l.type} ${l.scope} ${l.content} ${l.reason??""} ${l.tags.join(" ")}`.toLowerCase();return f&&S.includes(n(W).toLowerCase())}))}),xe(()=>n(o),()=>{N(s,Object.values(n(o).stats.files??{}).reduce((l,f)=>l+f,0))}),xe(()=>n(o),()=>{N(a,n(o).files.filter(l=>l.status==="clean").length)}),xe(()=>n(o),()=>{N(i,Object.values(n(o).stats.rules).reduce((l,f)=>l+f,0))}),xe(()=>n(o),()=>{N(u,n(o).stats.recentViolations??[])}),xe(()=>n(u),()=>{N(v,n(u).filter(l=>{if(!(l.source==="hook"||l.source==="ci"))return!1;const f=Date.parse(l.timestamp);return Number.isNaN(f)?!1:Date.now()-f<=Xe}))}),xe(()=>n(s),()=>{N(d,n(s))}),xe(()=>n(o),()=>{N(p,Object.keys(n(o).stats.files??{}).length)}),xe(()=>n(o),()=>{N(g,n(o).memories.filter(l=>["rule","pattern","decision"].includes(l.type)).length)}),xe(()=>n(o),()=>{var l;N(x,((l=n(o).memoryCount)==null?void 0:l.total)??n(o).memories.length)}),xe(()=>n(o),()=>{var l;N(w,((l=n(o).memoryCount)==null?void 0:l.relevant)??n(o).memories.length)}),xe(()=>(n(m),n(o)),()=>{var l,f;N(y,n(m)?((l=n(o).watcher)==null?void 0:l.enabled)===!1?{live:!1,label:"Watch off"}:(f=n(o).watcher)!=null&&f.running?{live:!0,label:"Watcher live"}:{live:!1,label:"Watcher idle"}:{live:!1,label:"Disconnected"})}),Zo(),Mc();var Us=cf(),zs=_(Us),fi=h(_(zs),4),Gr=_(fi);let Hs;var ui=h(_(Gr)),di=h(Gr,2),vi=_(di),pi=h(zs,2),Bs=_(pi),Ks=_(Bs),Ys=h(_(Ks),2);let Gs;var _i=h(_(Ys),2),hi=_(_i),Js=h(Ks,2),Qs=_(Js),gi=h(_(Qs),2),bi=_(gi),Xs=h(Qs,2),mi=h(_(Xs),2),yi=_(mi),wi=h(Xs,2),Ei=h(_(wi),2),xi=_(Ei),ki=h(Js,2),Zs=_(ki),Si=h(Zs,2),Ti=h(Bs,2),en=_(Ti),tn=_(en),rn=_(tn),Ai=h(_(rn),2),Ci=_(Ai),Ri=h(rn,2),sn=_(Ri),Ni=h(_(sn)),Mi=_(Ni),nn=h(sn,2),Di=h(_(nn)),Fi=_(Di),an=h(nn,2),Oi=h(_(an)),Ii=_(Oi),ln=h(an,2),ji=h(_(ln)),Li=_(ji),on=h(ln,2),Pi=h(_(on)),$i=_(Pi),Wi=h(on,2);{var Vi=l=>{var f=jc(),S=h(_(f)),R=_(S);U(()=>k(R,(n(o),b(()=>n(o).watcher.error)))),P(l,f)};ce(Wi,l=>{n(o),b(()=>{var f;return(f=n(o).watcher)==null?void 0:f.error})&&l(Vi)})}var cn=h(tn,2),fn=_(cn),qi=h(_(fn),2),Ui=_(qi),zi=h(fn,2),un=_(zi),Hi=h(_(un)),Bi=_(Hi),dn=h(un,2),Ki=h(_(dn)),Yi=_(Ki),vn=h(dn,2),pn=h(_(vn),2);let _n;var Gi=_(pn);{var Ji=l=>{var f=ia();U(()=>k(f,(n(o),b(()=>{var S;return(S=n(o).runtime)!=null&&S.model.checkModelInstalled?"installed":"missing"})))),P(l,f)},Qi=l=>{var f=ia();U(()=>k(f,(n(o),b(()=>{var S;return(S=n(o).runtime)!=null&&S.model.apiKeyConfigured?"api key set":"api key missing"})))),P(l,f)};ce(Gi,l=>{n(o),b(()=>{var f;return((f=n(o).runtime)==null?void 0:f.model.provider)==="ollama"})?l(Ji):l(Qi,-1)})}var hn=h(vn,2),Xi=h(_(hn)),Zi=_(Xi),el=h(hn,2),tl=h(_(el)),rl=_(tl),sl=h(cn,2),gn=_(sl),bn=h(_(gn),2);let mn;var nl=_(bn),al=h(gn,2),yn=_(al),il=h(_(yn)),ll=_(il),wn=h(yn,2),ol=h(_(wn)),cl=_(ol),En=h(wn,2),fl=h(_(En)),ul=_(fl),dl=h(En,2),vl=h(_(dl)),pl=_(vl),xn=h(en,2);{var _l=l=>{var f=Lc(),S=_(f);U(()=>k(S,(n(o),b(()=>n(o).dbError)))),P(l,f)};ce(xn,l=>{n(o),b(()=>n(o).dbError)&&l(_l)})}var kn=h(xn,2);{var hl=l=>{var f=Pc(),S=_(f);U(()=>k(S,n(K))),P(l,f)};ce(kn,l=>{n(K)&&l(hl)})}var Sn=h(kn,2),gl=h(_(Sn),2),Tn=_(gl);{var bl=l=>{var f=$c();P(l,f)};ce(Tn,l=>{n(A),b(()=>n(A).length===0)&&l(bl)})}var ml=h(Tn,2);Ut(ml,1,()=>(n(A),b(()=>[...n(A)].reverse())),l=>l.id,(l,f)=>{var S=Jc();let R;var z=_(S),te=_(z),le=_(te),j=h(te,2),E=_(j),$=h(j,2);{var Ee=Y=>{var G=Wc(),he=_(G);U(()=>k(he,(n(f),b(()=>n(f).message)))),P(Y,G)},lt=Y=>{var G=Vc(),he=_(G);U(()=>k(he,`saved: ${n(f),b(()=>n(f).file)??""}`)),P(Y,G)},ot=Y=>{var G=qc(),he=_(G);U(()=>k(he,`${n(f),b(()=>n(f).file)??""} - no violations`)),P(Y,G)},Ze=Y=>{var G=Uc(),he=_(G);U(()=>k(he,`${n(f),b(()=>n(f).file)??""} - skipped: ${n(f),b(()=>n(f).reason)??""}`)),P(Y,G)},ze=Y=>{var G=zc(),he=_(G);U(()=>k(he,`${n(f),b(()=>n(f).violations.length)??""} violation${n(f),b(()=>n(f).violations.length===1?"":"s")??""} in ${n(f),b(()=>n(f).file)??""}`)),P(Y,G)};ce($,Y=>{n(f),b(()=>n(f).type==="system"||n(f).type==="error")?Y(Ee):(n(f),b(()=>n(f).type==="saved")?Y(lt,1):(n(f),b(()=>n(f).type==="clean")?Y(ot,2):(n(f),b(()=>n(f).type==="skipped")?Y(Ze,3):Y(ze,-1))))})}var Wt=h(z,2);{var Vt=Y=>{var G=pc(),he=Ho(G);Ut(he,3,()=>(n(f),b(()=>n(f).violations)),(Rr,H)=>`${n(f).id}-${H}`,(Rr,H,Oe)=>{var He=Gc(),qt=_(He),$l=_(qt),zn=h(qt,2),Wl=h(_(zn)),Hn=h(zn,2);{var Vl=se=>{var Ie=Hc(),mt=h(_(Ie));U(()=>k(mt,` ${n(H),b(()=>n(H).reason)??""}`)),P(se,Ie)};ce(Hn,se=>{n(H),b(()=>n(H).reason)&&se(Vl)})}var Bn=h(Hn,2);{var ql=se=>{var Ie=Bc(),mt=h(_(Ie));U(()=>k(mt,` ${n(H),b(()=>n(H).issue)??""}`)),P(se,Ie)};ce(Bn,se=>{n(H),b(()=>n(H).issue)&&se(ql)})}var Kn=h(Bn,2);{var Ul=se=>{var Ie=Kc(),mt=h(_(Ie));U(()=>k(mt,` ${n(H),b(()=>n(H).suggestion)??""}`)),P(se,Ie)};ce(Kn,se=>{n(H),b(()=>n(H).suggestion)&&se(Ul)})}var zl=h(Kn,2);{var Hl=se=>{var Ie=Yc(),mt=_(Ie);U(()=>k(mt,(n(H),b(()=>n(H).code)))),P(se,Ie)};ce(zl,se=>{n(H),b(()=>n(H).code)&&se(Hl)})}U(se=>{k($l,`[${n(Oe)+1}] ${se??""}`),k(Wl,` ${n(H),b(()=>n(H).rule)??""}`)},[()=>(n(H),n(f),b(()=>ar(n(H),n(f).file)))]),P(Rr,He)}),P(Y,G)};ce(Wt,Y=>{n(f),b(()=>n(f).type==="violations")&&Y(Vt)})}U((Y,G)=>{R=or(S,1,"svelte-d3ct2b",null,R,{"error-line":n(f).type==="error","ok-line":n(f).type==="clean","violation-line":n(f).type==="violations"}),k(le,Y),k(E,G)},[()=>(n(f),b(()=>nr(n(f).timestamp))),()=>(n(f),b(()=>si(n(f))))]),P(l,S)});var yl=h(Sn,2),An=_(yl),Cn=h(_(An),2),wl=h(_(Cn),2);Ut(wl,1,()=>(n(o),b(()=>n(o).stats.topRules.slice(0,5))),l=>l.name,(l,f)=>{var S=Qc(),R=_(S),z=_(R),te=_(z),le=h(z,2),j=_(le),E=h(R,2);U($=>{k(te,(n(f),b(()=>n(f).name))),k(j,(n(f),b(()=>n(f).count))),ca(E,$)},[()=>(n(f),n(o),b(()=>`width: ${n(f).count/we(n(o).stats.topRules)*100}%`))]),P(l,S)},l=>{var f=Xc();P(l,f)});var Rn=h(Cn,2),El=h(_(Rn),2);Ut(El,1,()=>(n(o),b(()=>n(o).stats.topFiles.slice(0,5))),l=>l.name,(l,f)=>{var S=Zc(),R=_(S),z=_(R),te=_(z),le=h(z,2),j=_(le),E=h(R,2);U($=>{k(te,(n(f),b(()=>n(f).name))),k(j,(n(f),b(()=>n(f).count))),ca(E,$)},[()=>(n(f),n(o),b(()=>`width: ${n(f).count/we(n(o).stats.topFiles)*100}%`))]),P(l,S)},l=>{var f=ef();P(l,f)});var xl=h(Rn,2),Nn=_(xl),kl=h(_(Nn)),Sl=_(kl),Mn=h(Nn,2),Tl=h(_(Mn)),Al=_(Tl),Cl=h(Mn,2),Rl=h(_(Cl)),Nl=_(Rl),Dn=h(An,2);{var Ml=l=>{var f=nf(),S=_(f),R=h(_(S),2),z=_(R),te=h(S,2);Ut(te,7,()=>(n(v),b(()=>n(v).slice(0,8))),(le,j)=>`${le.timestamp}-${j}`,(le,j)=>{var E=sf(),$=_(E),Ee=_($),lt=_(Ee),ot=h(Ee,2),Ze=_(ot),ze=h($,2),Wt=_(ze),Vt=h(ze,2),Y=_(Vt),G=h(Vt,2);{var he=Oe=>{var He=tf(),qt=_(He);U(()=>k(qt,(n(j),b(()=>n(j).issue)))),P(Oe,He)};ce(G,Oe=>{n(j),b(()=>n(j).issue)&&Oe(he)})}var Rr=h(G,2);{var H=Oe=>{var He=rf(),qt=_(He);U(()=>k(qt,(n(j),b(()=>n(j).suggestion)))),P(Oe,He)};ce(Rr,Oe=>{n(j),b(()=>n(j).suggestion)&&Oe(H)})}U((Oe,He)=>{k(lt,(n(j),b(()=>n(j).source==="ci"?"CI":"Hook"))),k(Ze,Oe),k(Wt,(n(j),b(()=>n(j).rule))),k(Y,He)},[()=>(n(j),b(()=>nr(n(j).timestamp))),()=>(n(j),b(()=>ar(n(j),n(j).file||"staged diff")))]),P(le,E)}),U(()=>k(z,`${n(v),b(()=>n(v).length)??""} in 24h`)),P(l,f)};ce(Dn,l=>{n(v),b(()=>n(v).length>0)&&l(Ml)})}var Dl=h(Dn,2),Fn=_(Dl),Fl=h(_(Fn),2),Ol=_(Fl),Jr=h(Fn,2),On=_(Jr),Qr=_(On),Xr=_(Qr);Xr.value=Xr.__value="rule";var Zr=h(Xr);Zr.value=Zr.__value="decision";var es=h(Zr);es.value=es.__value="pattern";var In=h(es);In.value=In.__value="ignore";var jn=h(Qr,2),ts=_(jn);ts.value=ts.__value="project";var Ln=h(ts);Ln.value=Ln.__value="global";var Pn=h(On,2),$n=h(Pn,2),Wn=_($n),Il=h(Wn,2),Vn=h($n,2),jl=_(Vn),qn=h(Jr,2),rs=_(qn),ss=_(rs);ss.value=ss.__value="all";var ns=h(ss);ns.value=ns.__value="rule";var as=h(ns);as.value=as.__value="decision";var is=h(as);is.value=is.__value="pattern";var Un=h(is);Un.value=Un.__value="ignore";var Ll=h(rs,2),Pl=h(qn,2);Ut(Pl,5,()=>n(r),l=>l.id,(l,f)=>{var S=lf(),R=_(S),z=_(R),te=_(z),le=_(te),j=h(te,2),E=_(j),$=h(z,2),Ee=_($),lt=h($,2);{var ot=ze=>{var Wt=af(),Vt=_(Wt);U(()=>k(Vt,(n(f),b(()=>n(f).reason)))),P(ze,Wt)};ce(lt,ze=>{n(f),b(()=>n(f).reason)&&ze(ot)})}var Ze=h(R,2);U(ze=>{k(le,(n(f),b(()=>n(f).scope))),k(E,`Rule-${ze??""}`),k(Ee,(n(f),b(()=>n(f).content))),Ac(Ze,"aria-label",(n(f),b(()=>`Delete ${n(f).id}`)))},[()=>(n(f),b(()=>String(n(f).id).padStart(3,"0")))]),Mr("click",Ze,()=>ci(n(f).id)),P(l,S)},l=>{var f=of();P(l,f)}),U((l,f,S)=>{var R,z,te,le,j;Hs=or(Gr,1,"status-chip svelte-d3ct2b",null,Hs,{live:n(y).live}),k(ui,` ${n(y),b(()=>n(y).label)??""}`),k(vi,(n(o),b(()=>{var E;return((E=n(o).runtime)==null?void 0:E.model.label)??"runtime pending"}))),Gs=or(Ys,1,"live-label svelte-d3ct2b",null,Gs,{live:n(y).live}),k(hi,(n(y),b(()=>n(y).label))),k(bi,n(d)),k(yi,n(p)),k(xi,n(g)),k(Ci,(n(o),b(()=>{var E;return(E=n(o).runtime)!=null&&E.project.initialized?"Initialized":"Not initialized"}))),k(Mi,l),k(Fi,(n(o),b(()=>{var E;return((E=n(o).runtime)==null?void 0:E.project.type)??"unknown"}))),k(Ii,(n(o),b(()=>{var E;return((E=n(o).runtime)==null?void 0:E.project.language)??"unknown"}))),k(Li,f),k($i,(n(o),b(()=>{var E,$;return((E=n(o).watcher)==null?void 0:E.enabled)===!1?"disabled":($=n(o).watcher)!=null&&$.running?"running":"idle"}))),k(Ui,(n(o),b(()=>{var E;return((E=n(o).runtime)==null?void 0:E.model.label)??"pending"}))),k(Bi,(n(o),b(()=>{var E;return((E=n(o).runtime)==null?void 0:E.model.provider)??"unknown"}))),k(Yi,(n(o),b(()=>{var E,$,Ee;return((E=n(o).runtime)==null?void 0:E.model.checkModelResolved)??(($=n(o).runtime)==null?void 0:$.model.checkModel)??((Ee=n(o).runtime)==null?void 0:Ee.model.chatModel)??"unknown"}))),_n=or(pn,1,"svelte-d3ct2b",null,_n,{"status-ok":((R=n(o).runtime)==null?void 0:R.model.checkModelInstalled)||((z=n(o).runtime)==null?void 0:z.model.apiKeyConfigured),"status-warn":((te=n(o).runtime)==null?void 0:te.model.checkModelInstalled)===!1||((le=n(o).runtime)==null?void 0:le.model.error)}),k(Zi,(n(o),b(()=>{var E,$;return((E=n(o).runtime)==null?void 0:E.model.embeddingModelResolved)??(($=n(o).runtime)==null?void 0:$.model.embeddingModel)??"unknown"}))),k(rl,(n(o),b(()=>{var E;return((E=n(o).runtime)==null?void 0:E.model.ollamaUrl)??"unknown"}))),mn=or(bn,1,"svelte-d3ct2b",null,mn,{success:(j=n(o).runtime)==null?void 0:j.postgres.connected}),k(nl,(n(o),b(()=>{var E;return(E=n(o).runtime)!=null&&E.postgres.connected?"Connected":"Not connected"}))),k(ll,(n(o),b(()=>{var E,$;return((E=n(o).runtime)==null?void 0:E.postgres.serverDatabase)??(($=n(o).runtime)==null?void 0:$.postgres.database)??"unknown"}))),k(cl,(n(o),b(()=>{var E,$;return((E=n(o).runtime)==null?void 0:E.postgres.serverUser)??(($=n(o).runtime)==null?void 0:$.postgres.user)??"unknown"}))),k(ul,`${n(o),b(()=>{var E;return((E=n(o).runtime)==null?void 0:E.postgres.host)??"unknown"})??""}${n(o),b(()=>{var E;return(E=n(o).runtime)!=null&&E.postgres.port?`:${n(o).runtime.postgres.port}`:""})??""}`),k(pl,(n(o),b(()=>{var E;return((E=n(o).runtime)==null?void 0:E.postgres.url)??"(not set)"}))),k(Sl,n(a)),k(Al,n(d)),k(Nl,n(i)),k(Ol,`${n(g)??""} rules active`),Vn.disabled=S,k(jl,n(L)?"Saving...":"Add New Architecture Rule")},[()=>b(it),()=>b(Lt),()=>(n(L),n(I),b(()=>n(L)||!n(I).content.trim()))]),Mr("click",Zs,ni),Mr("click",Si,ai),fs(Qr,()=>n(I).type,l=>ir(I,n(I).type=l)),fs(jn,()=>n(I).scope,l=>ir(I,n(I).scope=l)),Fr(Pn,()=>n(I).content,l=>ir(I,n(I).content=l)),Fr(Wn,()=>n(I).reason,l=>ir(I,n(I).reason=l)),Fr(Il,()=>n(I).tags,l=>ir(I,n(I).tags=l)),Mr("submit",Jr,Nc(oi)),fs(rs,()=>n(C),l=>N(C,l)),Fr(Ll,()=>n(W),l=>N(W,l)),P(e,Us),ka()}_c(ff,{target:document.getElementById("app")});
|