@mindflight/mindbrain-personal-studio 0.6.1 → 0.6.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (212) hide show
  1. package/README.md +16 -8
  2. package/build/client/_app/immutable/chunks/CIErFlYG.js +1 -0
  3. package/build/client/_app/immutable/chunks/CIErFlYG.js.br +0 -0
  4. package/build/client/_app/immutable/chunks/CIErFlYG.js.gz +0 -0
  5. package/build/client/_app/immutable/entry/{app.CVz6aYsT.js → app.mURYm8o_.js} +2 -2
  6. package/build/client/_app/immutable/entry/app.mURYm8o_.js.br +0 -0
  7. package/build/client/_app/immutable/entry/app.mURYm8o_.js.gz +0 -0
  8. package/build/client/_app/immutable/entry/start.D4M9ZeGO.js +1 -0
  9. package/build/client/_app/immutable/entry/start.D4M9ZeGO.js.br +2 -0
  10. package/build/client/_app/immutable/entry/start.D4M9ZeGO.js.gz +0 -0
  11. package/build/client/_app/immutable/nodes/{1.BBtxY46Q.js → 1.DHKtMeFI.js} +1 -1
  12. package/build/client/_app/immutable/nodes/1.DHKtMeFI.js.br +1 -0
  13. package/build/client/_app/immutable/nodes/1.DHKtMeFI.js.gz +0 -0
  14. package/build/client/_app/version.json +1 -1
  15. package/build/client/_app/version.json.br +0 -0
  16. package/build/client/_app/version.json.gz +0 -0
  17. package/build/handler.js +4 -4
  18. package/build/index.js +4 -4
  19. package/build/server/chunks/chunks/{internal.js-D8EA_he2.js → internal.js-C3tV0XXj.js} +2 -2
  20. package/build/server/chunks/chunks/{internal.js-D8EA_he2.js.map → internal.js-C3tV0XXj.js.map} +1 -1
  21. package/build/server/chunks/entries/endpoints/api/graph/schema-registry/{_server.ts.js-Dyfsc-VA.js → _server.ts.js-CAsXxBRq.js} +7 -2
  22. package/build/server/chunks/entries/endpoints/api/graph/schema-registry/_server.ts.js-CAsXxBRq.js.map +1 -0
  23. package/build/server/chunks/{handler-BjXBCd1c.js → handler-DlaCCnxx.js} +3 -3
  24. package/build/server/chunks/{handler-BjXBCd1c.js.map → handler-DlaCCnxx.js.map} +1 -1
  25. package/build/server/chunks/{index.js-BJYcV8V7.js → index.js-BGfKWHak.js} +2 -2
  26. package/build/server/chunks/{index.js-BJYcV8V7.js.map → index.js-BGfKWHak.js.map} +1 -1
  27. package/build/server/chunks/{manifest.js-Ddaot0P4.js → manifest.js-CnmaNf5D.js} +4 -4
  28. package/build/server/chunks/{manifest.js-Ddaot0P4.js.map → manifest.js-CnmaNf5D.js.map} +1 -1
  29. package/build/server/chunks/nodes/{1.js-BRigw_9J.js → 1.js-BypjwBYB.js} +2 -2
  30. package/build/server/chunks/nodes/{1.js-BRigw_9J.js.map → 1.js-BypjwBYB.js.map} +1 -1
  31. package/examples/immeuble/ACCEPTANCE.yaml +82 -0
  32. package/examples/immeuble/BIM_LITE.md +15 -0
  33. package/examples/immeuble/CHECKLIST.md +128 -0
  34. package/examples/immeuble/README.md +121 -0
  35. package/examples/immeuble/bundle/immeuble.bundle.json +22786 -0
  36. package/examples/immeuble/contracts/answer_artifacts.seed.jsonl +34 -0
  37. package/examples/immeuble/contracts/business_capabilities.seed.jsonl +25 -0
  38. package/examples/immeuble/contracts/consumer_contract.yaml +131 -0
  39. package/examples/immeuble/contracts/immeuble_structured_import_model.json +310 -0
  40. package/examples/immeuble/contracts/mapping_external_to_canonical.json +375 -0
  41. package/examples/immeuble/contracts/mapping_external_to_canonical.yaml +55 -0
  42. package/examples/immeuble/contracts/mapping_external_to_canonical_ws.json +65 -0
  43. package/examples/immeuble/contracts/model_contract.json +943 -0
  44. package/examples/immeuble/contracts/projection_catalog.yaml +366 -0
  45. package/examples/immeuble/contracts/scenarios.yaml +27 -0
  46. package/examples/immeuble/contracts/semantic_proposal.golden.json +1 -0
  47. package/examples/immeuble/contracts/source_profile.yaml +38 -0
  48. package/examples/immeuble/fake_data/DeltaFinding.csv +20 -0
  49. package/examples/immeuble/fake_data/ProjectionResult.csv +13 -0
  50. package/examples/immeuble/fake_data/ag_meeting.csv +4 -0
  51. package/examples/immeuble/fake_data/agenda_item.csv +4 -0
  52. package/examples/immeuble/fake_data/architect.csv +3 -0
  53. package/examples/immeuble/fake_data/architecture_firm.csv +2 -0
  54. package/examples/immeuble/fake_data/bank_account.csv +3 -0
  55. package/examples/immeuble/fake_data/billing_group.csv +41 -0
  56. package/examples/immeuble/fake_data/block.csv +10 -0
  57. package/examples/immeuble/fake_data/budget_line.csv +3 -0
  58. package/examples/immeuble/fake_data/building.csv +6 -0
  59. package/examples/immeuble/fake_data/cellar.csv +41 -0
  60. package/examples/immeuble/fake_data/change_order.csv +2 -0
  61. package/examples/immeuble/fake_data/charge_call.csv +58 -0
  62. package/examples/immeuble/fake_data/claim.csv +4 -0
  63. package/examples/immeuble/fake_data/coda_entry.csv +49 -0
  64. package/examples/immeuble/fake_data/compliance_certificate.csv +10 -0
  65. package/examples/immeuble/fake_data/contractor.csv +4 -0
  66. package/examples/immeuble/fake_data/decision.csv +5 -0
  67. package/examples/immeuble/fake_data/defect_reserve.csv +3 -0
  68. package/examples/immeuble/fake_data/household.csv +41 -0
  69. package/examples/immeuble/fake_data/inspection.csv +3 -0
  70. package/examples/immeuble/fake_data/insurance_policy.csv +4 -0
  71. package/examples/immeuble/fake_data/intervention.csv +13 -0
  72. package/examples/immeuble/fake_data/invoice.csv +3 -0
  73. package/examples/immeuble/fake_data/lease_contract.csv +12 -0
  74. package/examples/immeuble/fake_data/maintenance_ticket.csv +13 -0
  75. package/examples/immeuble/fake_data/meter.csv +4 -0
  76. package/examples/immeuble/fake_data/meter_reading.csv +19 -0
  77. package/examples/immeuble/fake_data/milestone.csv +3 -0
  78. package/examples/immeuble/fake_data/organization.csv +12 -0
  79. package/examples/immeuble/fake_data/parking_space.csv +8 -0
  80. package/examples/immeuble/fake_data/permit.csv +3 -0
  81. package/examples/immeuble/fake_data/person.csv +85 -0
  82. package/examples/immeuble/fake_data/private_garden.csv +7 -0
  83. package/examples/immeuble/fake_data/progress_event.csv +2 -0
  84. package/examples/immeuble/fake_data/quote.csv +3 -0
  85. package/examples/immeuble/fake_data/receipt.csv +2 -0
  86. package/examples/immeuble/fake_data/reminder.csv +11 -0
  87. package/examples/immeuble/fake_data/service_contract.csv +4 -0
  88. package/examples/immeuble/fake_data/shared_equipment.csv +8 -0
  89. package/examples/immeuble/fake_data/shared_space.csv +10 -0
  90. package/examples/immeuble/fake_data/unit.csv +41 -0
  91. package/examples/immeuble/fake_data/work_package.csv +4 -0
  92. package/examples/immeuble/fake_data/worksite_project.csv +3 -0
  93. package/examples/immeuble/gap-rules/L0-patrimoine.json +57 -0
  94. package/examples/immeuble/gap-rules/L1-syndic-naive.json +36 -0
  95. package/examples/immeuble/gap-rules/L1-syndic.json +61 -0
  96. package/examples/immeuble/gap-rules/L2-chantier.json +87 -0
  97. package/examples/immeuble/gap-rules/L2-exploitation.json +87 -0
  98. package/examples/immeuble/gap-rules/L2-finance.json +48 -0
  99. package/examples/immeuble/gap-rules/L2-maintenance.json +107 -0
  100. package/examples/immeuble/gap-rules/L2-syndic-filtered.json +39 -0
  101. package/examples/immeuble/gap-rules/L3-full.json +332 -0
  102. package/examples/immeuble/gap-rules/closed-world-contract.md +76 -0
  103. package/examples/immeuble/gap-rules/demo.json +51 -0
  104. package/examples/immeuble/gap-rules/expected-findings.yaml +100 -0
  105. package/examples/immeuble/gap-rules/gap-scenarios.yaml +79 -0
  106. package/examples/immeuble/gap-rules/motifs.json +38 -0
  107. package/examples/immeuble/gap-rules/syndic.json +40 -0
  108. package/examples/immeuble/import_manifest.yaml +25 -0
  109. package/examples/immeuble/import_ready/graph_edges_import.csv +848 -0
  110. package/examples/immeuble/import_ready/mfo_facets_import.csv +559 -0
  111. package/examples/immeuble/index.md +140 -0
  112. package/examples/immeuble/model/immeuble_model.json +418 -0
  113. package/examples/immeuble/reports/01-model.validation.json +56 -0
  114. package/examples/immeuble/reports/02-mapping.validation.json +9 -0
  115. package/examples/immeuble/reports/acceptance.validation.json +161 -0
  116. package/examples/immeuble/reports/consumer_contract.validation.json +162 -0
  117. package/examples/immeuble/reports/graph_edges.jsonl +847 -0
  118. package/examples/immeuble/reports/graph_nodes.jsonl +558 -0
  119. package/examples/immeuble/reports/hybrid-compare.json +144 -0
  120. package/examples/immeuble/reports/immeuble-import-scenario.json +233 -0
  121. package/examples/immeuble/reports/live-artifacts-refresh.validation.json +51 -0
  122. package/examples/immeuble/reports/pipeline_audit.json +59 -0
  123. package/examples/immeuble/reports/projection_audit.json +69 -0
  124. package/examples/immeuble/reports/projection_audit_immeuble.json +257 -0
  125. package/examples/immeuble/reports/projection_audit_immeuble.md +122 -0
  126. package/examples/immeuble/reports/projection_candidates.json +1596 -0
  127. package/examples/immeuble/reports/projection_candidates.md +117 -0
  128. package/examples/immeuble/reports/projection_model_validation.md +115 -0
  129. package/examples/immeuble/reports/reindex.json +4 -0
  130. package/examples/immeuble/reports/reset-immeuble-workspace.json +32 -0
  131. package/examples/immeuble/reports/schema-id-prefix-check.json +5 -0
  132. package/examples/immeuble/scripts/audit-immeuble-projections.mjs +254 -0
  133. package/examples/immeuble/scripts/build-immeuble-model.mjs +308 -0
  134. package/examples/immeuble/scripts/compare-immeuble-snapshots.sh +227 -0
  135. package/examples/immeuble/scripts/enrich-immeuble-demo.mjs +1135 -0
  136. package/examples/immeuble/scripts/reset-immeuble-workspace.mjs +139 -0
  137. package/examples/immeuble/scripts/run-immeuble-backend.sh +164 -0
  138. package/examples/immeuble/scripts/run-immeuble-import.mjs +232 -0
  139. package/examples/immeuble/scripts/run-immeuble-live-lab.sh +439 -0
  140. package/examples/immeuble/scripts/seed-immeuble-gap-rules.mjs +69 -0
  141. package/examples/immeuble/scripts/start-immeuble-demo.sh +52 -0
  142. package/examples/immeuble/scripts/starterkit/analysis-lenses.mjs +181 -0
  143. package/examples/immeuble/scripts/starterkit/analyze-projection-candidates.mjs +714 -0
  144. package/examples/immeuble/scripts/starterkit/audit-ghostcrab-projections.mjs +674 -0
  145. package/examples/immeuble/scripts/starterkit/facet-prefix.mjs +166 -0
  146. package/examples/immeuble/scripts/starterkit/sqlite-utils.mjs +131 -0
  147. package/examples/immeuble/scripts/verify-immeuble-acceptance.mjs +284 -0
  148. package/examples/immeuble/scripts/verify-immeuble-live-artifacts.mjs +140 -0
  149. package/examples/immeuble/scripts/yaml-lite.mjs +96 -0
  150. package/examples/immeuble/sources/agent-prompts/prompts/00-prerequisites-immo-mcp.md +161 -0
  151. package/examples/immeuble/sources/agent-prompts/prompts/00-prerequisites.md +39 -0
  152. package/examples/immeuble/sources/agent-prompts/prompts/01-discovery-and-model-proposal.md +42 -0
  153. package/examples/immeuble/sources/agent-prompts/prompts/02-ontology-register.md +44 -0
  154. package/examples/immeuble/sources/agent-prompts/prompts/03-gap-rules-design.md +44 -0
  155. package/examples/immeuble/sources/agent-prompts/prompts/04-document-ingest.md +40 -0
  156. package/examples/immeuble/sources/agent-prompts/prompts/05-graph-extraction.md +44 -0
  157. package/examples/immeuble/sources/agent-prompts/prompts/06-validate-and-compare-immo-mcp.md +109 -0
  158. package/examples/immeuble/sources/agent-prompts/prompts/06-validate-and-compare-test-immo-mcp3.md +30 -0
  159. package/examples/immeuble/sources/agent-prompts/prompts/06-validate-and-compare.md +63 -0
  160. package/examples/immeuble/sources/checklists/gap-rules-checklist.md +42 -0
  161. package/examples/immeuble/sources/checklists/ontology-checklist.md +54 -0
  162. package/examples/immeuble/sources/documents/README.md +42 -0
  163. package/examples/immeuble/sources/documents/annexes-caves-garages-jardins.md +8 -0
  164. package/examples/immeuble/sources/documents/annexes-jardins-garages.md +1 -0
  165. package/examples/immeuble/sources/documents/baux-erables.md +1 -0
  166. package/examples/immeuble/sources/documents/baux-locatifs.md +11 -0
  167. package/examples/immeuble/sources/documents/coda-janvier-2026.md +10 -0
  168. package/examples/immeuble/sources/documents/composition-menages.md +1 -0
  169. package/examples/immeuble/sources/documents/composition-occupants.md +18 -0
  170. package/examples/immeuble/sources/documents/expected-coverage.json +70 -0
  171. package/examples/immeuble/sources/documents/extrait-coda-janvier-2026.md +1 -0
  172. package/examples/immeuble/sources/documents/groupes-facturation.md +30 -0
  173. package/examples/immeuble/sources/documents/manifest.json +79 -0
  174. package/examples/immeuble/sources/documents/note-architecte-chantier-erables.md +3 -0
  175. package/examples/immeuble/sources/documents/permis-urbanisme-erables.md +3 -0
  176. package/examples/immeuble/sources/documents/procedures-operationnelles.md +3 -0
  177. package/examples/immeuble/sources/documents/pv-ag-budget-2026.md +1 -0
  178. package/examples/immeuble/sources/documents/pv-reception-reserves-erables.md +3 -0
  179. package/examples/immeuble/sources/documents/registre-coproprietaires.md +24 -0
  180. package/examples/immeuble/sources/documents/reglement-copropriete-tilleuls.md +1 -0
  181. package/examples/immeuble/sources/documents/statuts-erables.md +22 -0
  182. package/examples/immeuble/sources/documents/statuts-tilleuls.md +19 -0
  183. package/examples/immeuble/sources/documents/succession-jean-dupont.md +3 -0
  184. package/examples/immeuble/sources/documents/titre-propriete-tilleuls-a3.md +1 -0
  185. package/examples/immeuble/sources/documents/trous-pedagogiques.md +3 -0
  186. package/examples/immeuble/sources/ontology/README.md +1 -0
  187. package/examples/immeuble/sources/ontology/core.yaml +444 -0
  188. package/examples/immeuble/success-criteria.yaml +35 -0
  189. package/fixtures/immeuble-demo.sqlite +0 -0
  190. package/package.json +16 -3
  191. package/scripts/lib/sqlite-runtime.mjs +1 -1
  192. package/scripts/load-immeuble-demo.sh +103 -0
  193. package/scripts/seed-immeuble-projections.mjs +75 -148
  194. package/scripts/verify-immeuble-demo-sources.mjs +93 -0
  195. package/scripts/verify-immeuble-demo.mjs +69 -0
  196. package/build/client/_app/immutable/chunks/BmeSanva.js +0 -1
  197. package/build/client/_app/immutable/chunks/BmeSanva.js.br +0 -0
  198. package/build/client/_app/immutable/chunks/BmeSanva.js.gz +0 -0
  199. package/build/client/_app/immutable/entry/app.CVz6aYsT.js.br +0 -0
  200. package/build/client/_app/immutable/entry/app.CVz6aYsT.js.gz +0 -0
  201. package/build/client/_app/immutable/entry/start.Bt5tVOz8.js +0 -1
  202. package/build/client/_app/immutable/entry/start.Bt5tVOz8.js.br +0 -2
  203. package/build/client/_app/immutable/entry/start.Bt5tVOz8.js.gz +0 -0
  204. package/build/client/_app/immutable/nodes/1.BBtxY46Q.js.br +0 -0
  205. package/build/client/_app/immutable/nodes/1.BBtxY46Q.js.gz +0 -0
  206. package/build/server/chunks/entries/endpoints/api/graph/schema-registry/_server.ts.js-Dyfsc-VA.js.map +0 -1
  207. package/scripts/build-serenity-v6-concept-review-pack.mjs +0 -493
  208. package/scripts/build-serenity-v6-review-pack.mjs +0 -479
  209. package/scripts/create-serenity-production-v6.mjs +0 -627
  210. package/scripts/export-serenity-v6-backup.mjs +0 -178
  211. package/scripts/import-serenity-v6-user-decisions.mjs +0 -543
  212. package/scripts/materialize-serenity-v6-snapshots.mjs +0 -675
@@ -1,169 +1,96 @@
1
1
  #!/usr/bin/env node
2
- /**
3
- * Seed immeuble-demo projections into the local SQLite file.
4
- * Idempotent: skips rows that match agent_id + scope + proj_type + content.
5
- */
6
- import { randomUUID } from 'node:crypto';
7
- import { readFileSync, existsSync } from 'node:fs';
8
- import { spawnSync } from 'node:child_process';
9
- import { dirname, join } from 'node:path';
10
- import { fileURLToPath } from 'node:url';
11
-
12
- const SCRIPT_DIR = dirname(fileURLToPath(import.meta.url));
13
- const STUDIO_ROOT = join(SCRIPT_DIR, '..');
14
- const GHOSTCRAB_ROOT = process.env.GHOSTCRAB_ROOT ?? join(STUDIO_ROOT, '..', 'ghostcrab-personal-mcp');
15
- const SQLITE_PATH = process.env.GHOSTCRAB_SQLITE_PATH ?? join(STUDIO_ROOT, 'data', 'immeuble-demo.sqlite');
16
- const AGENT_ID = process.env.GHOSTCRAB_AGENT_ID ?? 'agent:self';
17
- const LOCAL_SEED_FILE = join(STUDIO_ROOT, 'docs', 'demo-immo', 'immeuble-demo', 'projections.seed.jsonl');
18
- const GHOSTCRAB_SEED_FILE = join(GHOSTCRAB_ROOT, 'examples', 'immeuble-demo', 'projections.seed.jsonl');
19
- const SEED_FILE =
20
- process.env.IMMEUBLE_PROJECTIONS_SEED ??
21
- (existsSync(LOCAL_SEED_FILE) ? LOCAL_SEED_FILE : GHOSTCRAB_SEED_FILE);
22
- const TYPE_B_PROJECTION_ID = 'proj_immeuble_quota_check';
23
-
24
- function runSqlite(sql) {
25
- const result = spawnSync('sqlite3', [SQLITE_PATH, sql], { encoding: 'utf8' });
26
- if (result.status !== 0) {
27
- throw new Error(result.stderr || result.stdout || 'sqlite3 failed');
2
+ import { existsSync } from "node:fs";
3
+ import { spawnSync } from "node:child_process";
4
+ import { join, resolve } from "node:path";
5
+
6
+ const STUDIO_ROOT = resolve(import.meta.dirname, "..");
7
+ const SQLITE_PATH = resolve(process.env.GHOSTCRAB_SQLITE_PATH ?? join(STUDIO_ROOT, "data", "immeuble-demo.sqlite"));
8
+ const WORKSPACE_ID = process.env.IMMEUBLE_WORKSPACE_ID ?? "immeuble";
9
+
10
+ const projections = [
11
+ {
12
+ id: "chantier_erables_synthese",
13
+ name: "Synthèse chantier Érables",
14
+ metric: "worksite_summary",
15
+ evidenceType: "worksite_project",
16
+ summary: "Chantier actif avec deux lots, un jalon en retard et une réserve ouverte."
17
+ },
18
+ {
19
+ id: "chantier_erables_budget",
20
+ name: "Budget travaux Érables",
21
+ metric: "worksite_budget",
22
+ evidenceType: "budget_line",
23
+ summary: "Budget voté 125000 EUR, prévision 132000 EUR après avenant zinguerie."
24
+ },
25
+ {
26
+ id: "chantier_erables_planning",
27
+ name: "Planning chantier Érables",
28
+ metric: "worksite_schedule",
29
+ evidenceType: "milestone",
30
+ summary: "Démarrage réel en retard de deux jours; réception provisoire ouverte."
31
+ },
32
+ {
33
+ id: "chantier_erables_reserves",
34
+ name: "Réserves chantier Érables",
35
+ metric: "worksite_reserves",
36
+ evidenceType: "defect_reserve",
37
+ summary: "Une réserve sécurité ouverte sur garde-corps échafaudage."
28
38
  }
29
- return result.stdout.trim();
39
+ ];
40
+
41
+ function sql(query) {
42
+ const res = spawnSync("sqlite3", [SQLITE_PATH, query], { encoding: "utf8" });
43
+ if (res.status !== 0) throw new Error(res.stderr || res.stdout || "sqlite3 failed");
44
+ return res.stdout.trim();
30
45
  }
31
46
 
32
- function escapeSql(value) {
47
+ function escape(value) {
33
48
  return `'${String(value).replace(/'/g, "''")}'`;
34
49
  }
35
50
 
36
- function seedTypeBProjection() {
37
- const evidenceId = runSqlite(
38
- "SELECT entity_id FROM graph_entity WHERE workspace_id='immeuble-demo' AND deprecated_at IS NULL ORDER BY CASE entity_type WHEN 'building' THEN 0 WHEN 'unit' THEN 1 ELSE 2 END, entity_id LIMIT 1;"
51
+ if (!existsSync(SQLITE_PATH)) {
52
+ console.error(`error: SQLite file not found: ${SQLITE_PATH}`);
53
+ console.error("Run pnpm load:demo first.");
54
+ process.exit(1);
55
+ }
56
+ if (spawnSync("sqlite3", ["-version"]).status !== 0) {
57
+ console.error("error: sqlite3 CLI is required");
58
+ process.exit(1);
59
+ }
60
+
61
+ let seeded = 0;
62
+ for (const projection of projections) {
63
+ const evidenceId = sql(
64
+ `SELECT entity_id FROM graph_entity WHERE workspace_id=${escape(WORKSPACE_ID)} AND entity_type=${escape(projection.evidenceType)} AND deprecated_at IS NULL ORDER BY entity_id LIMIT 1;`
39
65
  );
40
66
  if (!evidenceId) {
41
- console.warn('warning: no graph_entity row found; skipped Type B projection seed');
42
- return { typeBSeeded: false };
67
+ console.warn(`warning: skipped ${projection.id}; no ${projection.evidenceType} evidence found`);
68
+ continue;
43
69
  }
44
-
45
- const projectionMetadata = JSON.stringify({
46
- projection_id: TYPE_B_PROJECTION_ID,
47
- collection_id: 'immeuble-demo',
48
- metric: 'quota_total_check',
49
- summary: 'Contrôle matérialisé des quotités immeuble pour le smoke Studio.'
70
+ const metadata = JSON.stringify({
71
+ projection_id: projection.id,
72
+ collection_id: WORKSPACE_ID,
73
+ metric: projection.metric,
74
+ summary: projection.summary
50
75
  });
51
- const projectionEntityId = runSqlite(
52
- `
76
+ const projectionEntityId = sql(`
53
77
  INSERT INTO graph_entity (workspace_id, entity_type, name, confidence, metadata_json)
54
- VALUES ('immeuble-demo', 'ProjectionResult', 'Immeuble quota check', 0.99, ${escapeSql(projectionMetadata)})
78
+ VALUES (${escape(WORKSPACE_ID)}, 'ProjectionResult', ${escape(projection.name)}, 0.99, ${escape(metadata)})
55
79
  ON CONFLICT(workspace_id, entity_type, name)
56
80
  DO UPDATE SET confidence=excluded.confidence, metadata_json=excluded.metadata_json, deprecated_at=NULL
57
81
  RETURNING entity_id;
58
- `
59
- );
60
-
61
- const deltaMetadata = JSON.stringify({
62
- metric: TYPE_B_PROJECTION_ID,
63
- status: 'ok',
64
- expected_total: 1000,
65
- actual_total: 1000
66
- });
67
- runSqlite(
68
- `
69
- INSERT INTO graph_entity (workspace_id, entity_type, name, confidence, metadata_json)
70
- VALUES ('immeuble-demo', 'DeltaFinding', 'Quota total delta', 0.98, ${escapeSql(deltaMetadata)})
71
- ON CONFLICT(workspace_id, entity_type, name)
72
- DO UPDATE SET confidence=excluded.confidence, metadata_json=excluded.metadata_json, deprecated_at=NULL
73
- RETURNING entity_id;
74
- `
75
- );
76
-
77
- const relationMetadata = JSON.stringify({
78
- projection_id: TYPE_B_PROJECTION_ID,
79
- role: 'smoke_evidence'
80
- });
81
- const existingRelation = runSqlite(
82
- `SELECT relation_id FROM graph_relation WHERE workspace_id='immeuble-demo' AND relation_type='PROVEN_BY' AND source_id=${projectionEntityId} AND target_id=${evidenceId} LIMIT 1;`
82
+ `);
83
+ const relationMetadata = JSON.stringify({ projection_id: projection.id, role: "snapshot_evidence" });
84
+ const existingRelation = sql(
85
+ `SELECT relation_id FROM graph_relation WHERE workspace_id=${escape(WORKSPACE_ID)} AND relation_type='evidenced_by' AND source_id=${projectionEntityId} AND target_id=${evidenceId} LIMIT 1;`
83
86
  );
84
87
  if (existingRelation) {
85
- runSqlite(
86
- `UPDATE graph_relation SET metadata_json=${escapeSql(relationMetadata)}, confidence=1.0, deprecated_at=NULL WHERE relation_id=${existingRelation};`
87
- );
88
+ sql(`UPDATE graph_relation SET metadata_json=${escape(relationMetadata)}, confidence=1.0, deprecated_at=NULL WHERE relation_id=${existingRelation};`);
88
89
  } else {
89
- runSqlite(
90
- `INSERT INTO graph_relation (workspace_id, relation_type, source_id, target_id, confidence, metadata_json) VALUES ('immeuble-demo', 'PROVEN_BY', ${projectionEntityId}, ${evidenceId}, 1.0, ${escapeSql(relationMetadata)});`
91
- );
92
- }
93
-
94
- return { typeBSeeded: true, projectionEntityId, evidenceId };
95
- }
96
-
97
- function main() {
98
- if (!existsSync(SQLITE_PATH)) {
99
- console.error(`error: SQLite file not found: ${SQLITE_PATH}`);
100
- console.error('Run pnpm load:demo first.');
101
- process.exit(1);
102
- }
103
- if (!existsSync(SEED_FILE)) {
104
- console.error(`error: seed file not found: ${SEED_FILE}`);
105
- process.exit(1);
106
- }
107
- if (spawnSync('sqlite3', ['-version']).status !== 0) {
108
- console.error('error: sqlite3 CLI is required');
109
- process.exit(1);
110
- }
111
-
112
- const lines = readFileSync(SEED_FILE, 'utf8')
113
- .split('\n')
114
- .map((line) => line.trim())
115
- .filter(Boolean);
116
-
117
- let inserted = 0;
118
- let updated = 0;
119
- let skipped = 0;
120
- const now = Math.floor(Date.now() / 1000);
121
-
122
- for (const line of lines) {
123
- const row = JSON.parse(line);
124
- const scope = String(row.scope ?? 'immeuble-demo');
125
- const projType = String(row.proj_type ?? 'STEP');
126
- const content = String(row.content ?? '');
127
- const weight = Number(row.weight ?? 0.7);
128
- const status = String(row.status ?? 'active');
129
- const sourceRef = row.source_ref == null ? null : String(row.source_ref);
130
- const sourceType = 'seed:immeuble-demo';
131
-
132
- if (!content) {
133
- skipped += 1;
134
- continue;
135
- }
136
-
137
- const existing = runSqlite(
138
- `SELECT id FROM projections WHERE agent_id=${escapeSql(AGENT_ID)} AND scope=${escapeSql(scope)} AND proj_type=${escapeSql(projType)} AND content=${escapeSql(content)} LIMIT 1;`
139
- );
140
-
141
- if (existing) {
142
- runSqlite(
143
- `UPDATE projections SET weight=${weight}, status=${escapeSql(status)}, source_type=${escapeSql(sourceType)}, source_ref=${sourceRef ? escapeSql(sourceRef) : 'NULL'} WHERE id=${escapeSql(existing)};`
144
- );
145
- updated += 1;
146
- continue;
147
- }
148
-
149
- const id = randomUUID();
150
- runSqlite(
151
- `INSERT INTO projections (id, agent_id, scope, proj_type, content, weight, source_ref, source_type, status, created_at_unix) VALUES (${escapeSql(id)}, ${escapeSql(AGENT_ID)}, ${escapeSql(scope)}, ${escapeSql(projType)}, ${escapeSql(content)}, ${weight}, ${sourceRef ? escapeSql(sourceRef) : 'NULL'}, ${escapeSql(sourceType)}, ${escapeSql(status)}, ${now});`
152
- );
153
- inserted += 1;
154
- }
155
-
156
- const count = runSqlite(
157
- `SELECT COUNT(*) FROM projections WHERE agent_id=${escapeSql(AGENT_ID)} AND scope='immeuble-demo';`
158
- );
159
- const typeB = seedTypeBProjection();
160
- console.log(`==> Projections seeded into ${SQLITE_PATH}`);
161
- console.log(` inserted=${inserted} updated=${updated} skipped=${skipped} total=${count}`);
162
- if (typeB.typeBSeeded) {
163
- console.log(
164
- ` type_b=${TYPE_B_PROJECTION_ID} projection_entity=${typeB.projectionEntityId} evidence_entity=${typeB.evidenceId}`
165
- );
90
+ sql(`INSERT INTO graph_relation (workspace_id, relation_type, source_id, target_id, confidence, metadata_json) VALUES (${escape(WORKSPACE_ID)}, 'evidenced_by', ${projectionEntityId}, ${evidenceId}, 1.0, ${escape(relationMetadata)});`);
166
91
  }
92
+ seeded += 1;
167
93
  }
168
94
 
169
- main();
95
+ console.log(`==> Projection snapshots seeded into ${SQLITE_PATH}`);
96
+ console.log(` workspace=${WORKSPACE_ID} seeded=${seeded}`);
@@ -0,0 +1,93 @@
1
+ #!/usr/bin/env node
2
+ import { existsSync, readFileSync } from "node:fs";
3
+ import { join, resolve } from "node:path";
4
+
5
+ const root = resolve(import.meta.dirname, "..");
6
+ const demo = join(root, "examples", "immeuble");
7
+ const bundlePath = join(demo, "bundle", "immeuble.bundle.json");
8
+
9
+ function fail(message) {
10
+ console.error(`error: ${message}`);
11
+ process.exit(1);
12
+ }
13
+
14
+ if (!existsSync(bundlePath)) fail(`missing ${bundlePath}`);
15
+
16
+ const bundle = JSON.parse(readFileSync(bundlePath, "utf8"));
17
+ const entityTypes = new Set(bundle.entities_raw?.map((row) => row.entity_type) ?? []);
18
+ const artifactIds = new Set(bundle.mindbrain_answer_artifacts?.map((row) => row.artifact_id) ?? []);
19
+ const entityCount = bundle.entities_raw?.length ?? 0;
20
+ const relationCount = bundle.relations_raw?.length ?? 0;
21
+ const documentCount = bundle.documents_raw?.length ?? 0;
22
+ const answerArtifactCount = bundle.mindbrain_answer_artifacts?.length ?? 0;
23
+
24
+ for (const path of [
25
+ "README.md",
26
+ "BIM_LITE.md",
27
+ "sources/ontology/core.yaml",
28
+ "contracts/projection_catalog.yaml",
29
+ "contracts/answer_artifacts.seed.jsonl",
30
+ "contracts/business_capabilities.seed.jsonl",
31
+ "contracts/consumer_contract.yaml",
32
+ "gap-rules/L2-chantier.json",
33
+ "gap-rules/L3-full.json",
34
+ "gap-rules/expected-findings.yaml",
35
+ "sources/documents/note-architecte-chantier-erables.md",
36
+ "sources/documents/permis-urbanisme-erables.md",
37
+ "sources/documents/pv-reception-reserves-erables.md",
38
+ "sources/documents/procedures-operationnelles.md",
39
+ "sources/documents/trous-pedagogiques.md"
40
+ ]) {
41
+ if (!existsSync(join(demo, path))) fail(`missing examples/immeuble/${path}`);
42
+ }
43
+
44
+ for (const type of [
45
+ "ag_meeting",
46
+ "agenda_item",
47
+ "service_contract",
48
+ "maintenance_ticket",
49
+ "intervention",
50
+ "insurance_policy",
51
+ "claim",
52
+ "meter",
53
+ "meter_reading",
54
+ "compliance_certificate",
55
+ "worksite_project",
56
+ "architect",
57
+ "contractor",
58
+ "work_package",
59
+ "permit",
60
+ "budget_line",
61
+ "ProjectionResult",
62
+ "DeltaFinding"
63
+ ]) {
64
+ if (!entityTypes.has(type)) fail(`bundle missing entity type ${type}`);
65
+ }
66
+
67
+ for (const artifactId of [
68
+ "live_answer_view__lots_sans_proprietaire",
69
+ "live_answer_view__coda_a_rapprocher",
70
+ "live_answer_view__interventions_en_retard",
71
+ "live_answer_view__chantier_actif",
72
+ "live_answer_view__planning_chantier",
73
+ "live_answer_view__budget_travaux",
74
+ "live_answer_view__reserves_reception",
75
+ "answer_snapshot__chantier_erables_synthese"
76
+ ]) {
77
+ if (!artifactIds.has(artifactId)) fail(`bundle missing artifact ${artifactId}`);
78
+ }
79
+
80
+ if (entityCount < 400) fail(`bundle entities_raw < 400 (${entityCount})`);
81
+ if (relationCount < 800) fail(`bundle relations_raw < 800 (${relationCount})`);
82
+ if (documentCount < 20) fail(`bundle documents_raw < 20 (${documentCount})`);
83
+ if (answerArtifactCount < 33) fail(`bundle answer_artifacts < 33 (${answerArtifactCount})`);
84
+
85
+ console.log(JSON.stringify({
86
+ ok: true,
87
+ bundle: bundlePath,
88
+ workspace: bundle.scope?.workspace_id,
89
+ entities: entityCount,
90
+ relations: relationCount,
91
+ documents: documentCount,
92
+ answer_artifacts: answerArtifactCount
93
+ }, null, 2));
@@ -0,0 +1,69 @@
1
+ #!/usr/bin/env node
2
+ import { existsSync } from "node:fs";
3
+ import { spawnSync } from "node:child_process";
4
+ import { resolve } from "node:path";
5
+
6
+ function parseArgs(argv) {
7
+ let sqlite = process.env.GHOSTCRAB_SQLITE_PATH ?? "data/immeuble-demo.sqlite";
8
+ let workspace = process.env.IMMEUBLE_WORKSPACE_ID ?? "immeuble";
9
+ for (let i = 0; i < argv.length; i += 1) {
10
+ const arg = argv[i];
11
+ if (arg === "--sqlite" || arg === "--db") sqlite = argv[++i] ?? sqlite;
12
+ else if (arg.startsWith("--sqlite=")) sqlite = arg.slice("--sqlite=".length);
13
+ else if (arg.startsWith("--db=")) sqlite = arg.slice("--db=".length);
14
+ else if (arg === "--workspace") workspace = argv[++i] ?? workspace;
15
+ else if (arg.startsWith("--workspace=")) workspace = arg.slice("--workspace=".length);
16
+ }
17
+ return { sqlite: resolve(sqlite), workspace };
18
+ }
19
+
20
+ function sql(db, query) {
21
+ const res = spawnSync("sqlite3", ["-readonly", db, "-json", query], { encoding: "utf8" });
22
+ if (res.status !== 0) throw new Error(res.stderr || res.stdout || "sqlite3 failed");
23
+ return JSON.parse(res.stdout || "[]");
24
+ }
25
+
26
+ function scalar(db, query) {
27
+ const rows = sql(db, query);
28
+ return Number(Object.values(rows[0] ?? { value: 0 })[0] ?? 0);
29
+ }
30
+
31
+ const { sqlite, workspace } = parseArgs(process.argv.slice(2));
32
+ if (!existsSync(sqlite)) {
33
+ console.error(`error: SQLite not found: ${sqlite}`);
34
+ process.exit(1);
35
+ }
36
+ if (spawnSync("sqlite3", ["-version"]).status !== 0) {
37
+ console.error("error: sqlite3 CLI is required");
38
+ process.exit(1);
39
+ }
40
+
41
+ const checks = {
42
+ workspace_rows: scalar(sqlite, `SELECT COUNT(*) AS value FROM workspaces WHERE workspace_id='${workspace}'`),
43
+ graph_entities: scalar(sqlite, `SELECT COUNT(*) AS value FROM graph_entity WHERE workspace_id='${workspace}'`),
44
+ raw_entities: scalar(sqlite, `SELECT COUNT(*) AS value FROM entities_raw WHERE workspace_id='${workspace}'`),
45
+ documents: scalar(sqlite, `SELECT COUNT(*) AS value FROM documents_raw WHERE workspace_id='${workspace}'`),
46
+ answer_artifacts: scalar(sqlite, `SELECT COUNT(*) AS value FROM mindbrain_answer_artifacts WHERE workspace_id='${workspace}' OR scope='${workspace}'`),
47
+ projection_results: scalar(sqlite, `SELECT COUNT(*) AS value FROM graph_entity WHERE workspace_id='${workspace}' AND entity_type='ProjectionResult'`),
48
+ delta_findings: scalar(sqlite, `SELECT COUNT(*) AS value FROM graph_entity WHERE workspace_id='${workspace}' AND entity_type='DeltaFinding'`),
49
+ worksite_projects: scalar(sqlite, `SELECT COUNT(*) AS value FROM graph_entity WHERE workspace_id='${workspace}' AND entity_type='worksite_project'`),
50
+ units: scalar(sqlite, `SELECT COUNT(*) AS value FROM graph_entity WHERE workspace_id='${workspace}' AND entity_type='unit'`),
51
+ maintenance_tickets: scalar(sqlite, `SELECT COUNT(*) AS value FROM graph_entity WHERE workspace_id='${workspace}' AND entity_type='maintenance_ticket'`),
52
+ gap_rules: scalar(sqlite, `SELECT COUNT(*) AS value FROM graph_gap_rules WHERE workspace_id='${workspace}'`)
53
+ };
54
+
55
+ const failures = [];
56
+ if (checks.workspace_rows < 1) failures.push("workspace missing");
57
+ if (checks.graph_entities < 400) failures.push(`graph_entities < 400 (${checks.graph_entities})`);
58
+ if (checks.raw_entities < 400) failures.push(`raw_entities < 400 (${checks.raw_entities})`);
59
+ if (checks.documents < 20) failures.push(`documents < 20 (${checks.documents})`);
60
+ if (checks.answer_artifacts < 33) failures.push(`answer_artifacts < 33 (${checks.answer_artifacts})`);
61
+ if (checks.projection_results < 8) failures.push(`projection_results < 8 (${checks.projection_results})`);
62
+ if (checks.delta_findings < 12) failures.push(`delta_findings < 12 (${checks.delta_findings})`);
63
+ if (checks.worksite_projects < 2) failures.push(`worksite_projects < 2 (${checks.worksite_projects})`);
64
+ if (checks.units < 40) failures.push(`units < 40 (${checks.units})`);
65
+ if (checks.maintenance_tickets < 10) failures.push(`maintenance_tickets < 10 (${checks.maintenance_tickets})`);
66
+ if (checks.gap_rules < 25) failures.push(`gap_rules < 25 (${checks.gap_rules})`);
67
+
68
+ console.log(JSON.stringify({ ok: failures.length === 0, sqlite, workspace, checks, failures }, null, 2));
69
+ if (failures.length) process.exit(1);
@@ -1 +0,0 @@
1
- import{b4 as _e,aZ as mt,aK as A,a1 as U,a3 as T,aJ as ne,b6 as wt}from"./BnkCgNCx.js";import{o as Ve}from"./BNUkRZqg.js";const D=[];function Re(e,t=_e){let n=null;const r=new Set;function a(o){if(mt(e,o)&&(e=o,n)){const l=!D.length;for(const c of r)c[1](),D.push(c,e);if(l){for(let c=0;c<D.length;c+=2)D[c][0](D[c+1]);D.length=0}}}function i(o){a(o(e))}function s(o,l=_e){const c=[o,l];return r.add(c),r.size===1&&(n=t(a,i)||_e),o(e),()=>{r.delete(c),r.size===0&&n&&(n(),n=null)}}return{set:a,update:i,subscribe:s}}class xe{constructor(t,n){this.status=t,typeof n=="string"?this.body={message:n}:n?this.body=n:this.body={message:`Error: ${t}`}}toString(){return JSON.stringify(this.body)}}class Le{constructor(t,n){this.status=t,this.location=n}}class Ae extends Error{constructor(t,n,r){super(r),this.status=t,this.text=n}}new URL("sveltekit-internal://");function vt(e,t){return e==="/"||t==="ignore"?e:t==="never"?e.endsWith("/")?e.slice(0,-1):e:t==="always"&&!e.endsWith("/")?e+"/":e}function yt(e){return e.split("%25").map(decodeURI).join("%25")}function bt(e){for(const t in e)e[t]=decodeURIComponent(e[t]);return e}function me({href:e}){return e.split("#")[0]}function kt(...e){let t=5381;for(const n of e)if(typeof n=="string"){let r=n.length;for(;r;)t=t*33^n.charCodeAt(--r)}else if(ArrayBuffer.isView(n)){const r=new Uint8Array(n.buffer,n.byteOffset,n.byteLength);let a=r.length;for(;a;)t=t*33^r[--a]}else throw new TypeError("value must be a string or TypedArray");return(t>>>0).toString(36)}new TextEncoder;new TextDecoder;function Et(e){const t=atob(e),n=new Uint8Array(t.length);for(let r=0;r<t.length;r++)n[r]=t.charCodeAt(r);return n}const St=window.fetch;window.fetch=(e,t)=>((e instanceof Request?e.method:t?.method||"GET")!=="GET"&&W.delete(Ue(e)),St(e,t));const W=new Map;function Rt(e,t){const n=Ue(e,t),r=document.querySelector(n);if(r?.textContent){r.remove();let{body:a,...i}=JSON.parse(r.textContent);const s=r.getAttribute("data-ttl");return s&&W.set(n,{body:a,init:i,ttl:1e3*Number(s)}),r.getAttribute("data-b64")!==null&&(a=Et(a)),Promise.resolve(new Response(a,i))}return window.fetch(e,t)}function xt(e,t,n){if(W.size>0){const r=Ue(e,n),a=W.get(r);if(a){if(performance.now()<a.ttl&&["default","force-cache","only-if-cached",void 0].includes(n?.cache))return new Response(a.body,a.init);W.delete(r)}}return window.fetch(t,n)}function Ue(e,t){let r=`script[data-sveltekit-fetched][data-url=${JSON.stringify(e instanceof Request?e.url:e)}]`;if(t?.headers||t?.body){const a=[];t.headers&&a.push([...new Headers(t.headers)].join(",")),t.body&&(typeof t.body=="string"||ArrayBuffer.isView(t.body))&&a.push(t.body),r+=`[data-hash="${kt(...a)}"]`}return r}const Lt=/^(\[)?(\.\.\.)?(\w+)(?:=(\w+))?(\])?$/;function At(e){const t=[];return{pattern:e==="/"?/^\/$/:new RegExp(`^${Tt(e).map(r=>{const a=/^\[\.\.\.(\w+)(?:=(\w+))?\]$/.exec(r);if(a)return t.push({name:a[1],matcher:a[2],optional:!1,rest:!0,chained:!0}),"(?:/([^]*))?";const i=/^\[\[(\w+)(?:=(\w+))?\]\]$/.exec(r);if(i)return t.push({name:i[1],matcher:i[2],optional:!0,rest:!1,chained:!0}),"(?:/([^/]+))?";if(!r)return;const s=r.split(/\[(.+?)\](?!\])/);return"/"+s.map((l,c)=>{if(c%2){if(l.startsWith("x+"))return we(String.fromCharCode(parseInt(l.slice(2),16)));if(l.startsWith("u+"))return we(String.fromCharCode(...l.slice(2).split("-").map(_=>parseInt(_,16))));const f=Lt.exec(l),[,p,w,h,u]=f;return t.push({name:h,matcher:u,optional:!!p,rest:!!w,chained:w?c===1&&s[0]==="":!1}),w?"([^]*?)":p?"([^/]*)?":"([^/]+?)"}return we(l)}).join("")}).join("")}/?$`),params:t}}function Ut(e){return e!==""&&!/^\([^)]+\)$/.test(e)}function Tt(e){return e.slice(1).split("/").filter(Ut)}function It(e,t,n){const r={},a=e.slice(1),i=a.filter(o=>o!==void 0);let s=0;for(let o=0;o<t.length;o+=1){const l=t[o];let c=a[o-s];if(l.chained&&l.rest&&s&&(c=a.slice(o-s,o+1).filter(f=>f).join("/"),s=0),c===void 0)if(l.rest)c="";else continue;if(!l.matcher||n[l.matcher](c)){r[l.name]=c;const f=t[o+1],p=a[o+1];f&&!f.rest&&f.optional&&p&&l.chained&&(s=0),!f&&!p&&Object.keys(r).length===i.length&&(s=0);continue}if(l.optional&&l.chained){s++;continue}return}if(!s)return r}function we(e){return e.normalize().replace(/[[\]]/g,"\\$&").replace(/%/g,"%25").replace(/\//g,"%2[Ff]").replace(/\?/g,"%3[Ff]").replace(/#/g,"%23").replace(/[.*+?^${}()|\\]/g,"\\$&")}function Ot({nodes:e,server_loads:t,dictionary:n,matchers:r}){const a=new Set(t);return Object.entries(n).map(([o,[l,c,f]])=>{const{pattern:p,params:w}=At(o),h={id:o,exec:u=>{const _=p.exec(u);if(_)return It(_,w,r)},errors:[1,...f||[]].map(u=>e[u]),layouts:[0,...c||[]].map(s),leaf:i(l)};return h.errors.length=h.layouts.length=Math.max(h.errors.length,h.layouts.length),h});function i(o){const l=o<0;return l&&(o=~o),[l,e[o]]}function s(o){return o===void 0?o:[a.has(o),e[o]]}}function Ye(e,t=JSON.parse){try{return t(sessionStorage[e])}catch{}}function Ke(e,t,n=JSON.stringify){const r=n(t);try{sessionStorage[e]=r}catch{}}const L=globalThis.__sveltekit_1i9q8jd?.base??"",jt=globalThis.__sveltekit_1i9q8jd?.assets??L??"",Pt="1782718824257",He="sveltekit:snapshot",Xe="sveltekit:scroll",Ze="sveltekit:states",$t="sveltekit:pageurl",K="sveltekit:history",Y="sveltekit:navigation",C={tap:1,hover:2,viewport:3,eager:4,off:-1,false:-1},Te=location.origin;function Qe(e){if(e instanceof URL)return e;let t=document.baseURI;if(!t){const n=document.getElementsByTagName("base");t=n.length?n[0].href:document.URL}return new URL(e,t)}function N(){return{x:pageXOffset,y:pageYOffset}}function V(e,t){return e.getAttribute(`data-sveltekit-${t}`)}const Be={...C,"":C.hover};function et(e){let t=e.assignedSlot??e.parentNode;return t?.nodeType===11&&(t=t.host),t}function tt(e,t){for(;e&&e!==t;){if(e.nodeName.toUpperCase()==="A"&&e.hasAttribute("href"))return e;e=et(e)}}function be(e,t,n){let r;try{if(r=new URL(e instanceof SVGAElement?e.href.baseVal:e.href,document.baseURI),n&&r.hash.match(/^#[^/]/)){const o=location.hash.split("#")[1]||"/";r.hash=`#${o}${r.hash}`}}catch{}const a=e instanceof SVGAElement?e.target.baseVal:e.target,i=!r||!!a||de(r,t,n)||(e.getAttribute("rel")||"").split(/\s+/).includes("external"),s=r?.origin===Te&&e.hasAttribute("download");return{url:r,external:i,target:a,download:s}}function re(e){let t=null,n=null,r=null,a=null,i=null,s=null,o=e;for(;o&&o!==document.documentElement;)r===null&&(r=V(o,"preload-code")),a===null&&(a=V(o,"preload-data")),t===null&&(t=V(o,"keepfocus")),n===null&&(n=V(o,"noscroll")),i===null&&(i=V(o,"reload")),s===null&&(s=V(o,"replacestate")),o=et(o);function l(c){switch(c){case"":case"true":return!0;case"off":case"false":return!1;default:return}}return{preload_code:Be[r??"off"],preload_data:Be[a??"off"],keepfocus:l(t),noscroll:l(n),reload:l(i),replace_state:l(s)}}function Me(e){const t=Re(e);let n=!0;function r(){n=!0,t.update(s=>s)}function a(s){n=!1,t.set(s)}function i(s){let o;return t.subscribe(l=>{(o===void 0||n&&l!==o)&&s(o=l)})}return{notify:r,set:a,subscribe:i}}const nt={v:()=>{}};function Ct(){const{set:e,subscribe:t}=Re(!1);let n;async function r(){clearTimeout(n);try{const a=await fetch(`${jt}/_app/version.json`,{headers:{pragma:"no-cache","cache-control":"no-cache"}});if(!a.ok)return!1;const s=(await a.json()).version!==Pt;return s&&(e(!0),nt.v(),clearTimeout(n)),s}catch{return!1}}return{subscribe:t,check:r}}function de(e,t,n){return e.origin!==Te||!e.pathname.startsWith(t)?!0:n?e.pathname!==location.pathname:!1}function fn(e){}const rt=new Set(["load","prerender","csr","ssr","trailingSlash","config"]);[...rt];const qt=new Set([...rt]);[...qt];function Nt(e){return e.filter(t=>t!=null)}function Ie(e){return e instanceof xe||e instanceof Ae?e.status:500}function Dt(e){return e instanceof Ae?e.text:"Internal Error"}let E,H,ve;const Vt=Ve.toString().includes("$$")||/function \w+\(\) \{\}/.test(Ve.toString()),ze="a:";Vt?(E={data:{},form:null,error:null,params:{},route:{id:null},state:{},status:-1,url:new URL(ze)},H={current:null},ve={current:!1}):(E=new class{#e=A({});get data(){return U(this.#e)}set data(t){T(this.#e,t)}#t=A(null);get form(){return U(this.#t)}set form(t){T(this.#t,t)}#n=A(null);get error(){return U(this.#n)}set error(t){T(this.#n,t)}#r=A({});get params(){return U(this.#r)}set params(t){T(this.#r,t)}#a=A({id:null});get route(){return U(this.#a)}set route(t){T(this.#a,t)}#o=A({});get state(){return U(this.#o)}set state(t){T(this.#o,t)}#s=A(-1);get status(){return U(this.#s)}set status(t){T(this.#s,t)}#i=A(new URL(ze));get url(){return U(this.#i)}set url(t){T(this.#i,t)}},H=new class{#e=A(null);get current(){return U(this.#e)}set current(t){T(this.#e,t)}},ve=new class{#e=A(!1);get current(){return U(this.#e)}set current(t){T(this.#e,t)}},nt.v=()=>ve.current=!0);function Kt(e){Object.assign(E,e)}const Bt=new Set(["icon","shortcut icon","apple-touch-icon"]);let F=null;const $=Ye(Xe)??{},X=Ye(He)??{},P={url:Me({}),page:Me({}),navigating:Re(null),updated:Ct()};function Oe(e){$[e]=N()}function Mt(e,t){let n=e+1;for(;$[n];)delete $[n],n+=1;for(n=t+1;X[n];)delete X[n],n+=1}function Z(e,t=!1){return t?location.replace(e.href):location.href=e.href,new Promise(()=>{})}async function at(){if("serviceWorker"in navigator){const e=await navigator.serviceWorker.getRegistration(L||"/");e&&await e.update()}}function Fe(){}let je,ke,ae,I,Ee,y;const oe=[],se=[];let R=null;function ie(){R?.fork?.then(e=>e?.discard()),R=null}const te=new Map,ot=new Set,zt=new Set,J=new Set;let m={branch:[],error:null,url:null},st=!1,le=!1,Ge=!0,Q=!1,G=!1,it=!1,Pe=!1,lt,v,x,q;const ce=new Set,We=new Map;async function gn(e,t,n){globalThis.__sveltekit_1i9q8jd&&(globalThis.__sveltekit_1i9q8jd.query,globalThis.__sveltekit_1i9q8jd.prerender),document.URL!==location.href&&(location.href=location.href),y=e,await e.hooks.init?.(),je=Ot(e),I=document.documentElement,Ee=t,ke=e.nodes[0],ae=e.nodes[1],ke(),ae(),v=history.state?.[K],x=history.state?.[Y],v||(v=x=Date.now(),history.replaceState({...history.state,[K]:v,[Y]:x},""));const r=$[v];function a(){r&&(history.scrollRestoration="manual",scrollTo(r.x,r.y))}n?(a(),await an(Ee,n)):(await B({type:"enter",url:Qe(y.hash?ln(new URL(location.href)):location.href),replace_state:!0}),a()),rn()}function Ft(){oe.length=0,Pe=!1}function ct(e){se.some(t=>t?.snapshot)&&(X[e]=se.map(t=>t?.snapshot?.capture()))}function ut(e){X[e]?.forEach((t,n)=>{se[n]?.snapshot?.restore(t)})}function Je(){Oe(v),Ke(Xe,$),ct(x),Ke(He,X)}async function Gt(e,t,n,r){let a;t.invalidateAll&&ie(),await B({type:"goto",url:Qe(e),keepfocus:t.keepFocus,noscroll:t.noScroll,replace_state:t.replaceState,state:t.state,redirect_count:n,nav_token:r,accept:()=>{t.invalidateAll&&(Pe=!0,a=[],We.forEach((i,s)=>{for(const o of i.keys())a.push(s+"/"+o)})),t.invalidate&&t.invalidate.forEach(nn)}}),t.invalidateAll&&ne().then(ne).then(()=>{We.forEach((i,s)=>{i.forEach(({resource:o},l)=>{a?.includes(s+"/"+l)&&o.refresh?.()})})})}async function Wt(e){if(e.id!==R?.id){ie();const t={};ce.add(t),R={id:e.id,token:t,promise:dt({...e,preload:t}).then(n=>(ce.delete(t),n.type==="loaded"&&n.state.error&&ie(),n)),fork:null}}return R.promise}async function ye(e){const t=(await he(e,!1))?.route;t&&await Promise.all([...t.layouts,t.leaf].filter(Boolean).map(n=>n[1]()))}async function ft(e,t,n){const r={params:m.params,route:{id:m.route?.id??null},url:new URL(location.href)};m={...e.state,nav:r};const a=document.querySelector("style[data-sveltekit]");if(a&&a.remove(),Object.assign(E,e.props.page),lt=new y.root({target:t,props:{...e.props,stores:P,components:se},hydrate:n,sync:!1,transformError:void 0}),await Promise.resolve(),ut(x),n){const i={from:null,to:{...r,scroll:$[v]??N()},willUnload:!1,type:"enter",complete:Promise.resolve()};J.forEach(s=>s(i))}le=!0}async function ue({url:e,params:t,branch:n,errors:r,status:a,error:i,route:s,form:o}){let l="never";if(L&&(e.pathname===L||e.pathname===L+"/"))l="always";else for(const u of n)u?.slash!==void 0&&(l=u.slash);e.pathname=vt(e.pathname,l),e.search=e.search;const c={type:"loaded",state:{url:e,params:t,branch:n,error:i,route:s},props:{constructors:Nt(n).map(u=>u.node.component),page:De(E)}};o!==void 0&&(c.props.form=o);let f={},p=!E,w=0;for(let u=0;u<Math.max(n.length,m.branch.length);u+=1){const _=n[u],g=m.branch[u];_?.data!==g?.data&&(p=!0),_&&(f={...f,..._.data},p&&(c.props[`data_${w}`]=f),w+=1)}return(!m.url||e.href!==m.url.href||m.error!==i||o!==void 0&&o!==E.form||p)&&(c.props.page={error:i,params:t,route:{id:s?.id??null},state:{},status:a,url:new URL(e),form:o??null,data:p?f:E.data}),c}async function $e({loader:e,parent:t,url:n,params:r,route:a,server_data_node:i}){let s=null;const o={dependencies:new Set,params:new Set,parent:!1,route:!1,url:!1,search_params:new Set},l=await e();return{node:l,loader:e,server:i,universal:l.universal?.load?{type:"data",data:s,uses:o}:null,data:s??i?.data??null,slash:l.universal?.trailingSlash??i?.slash}}function Jt(e,t,n){let r=e instanceof Request?e.url:e;const a=new URL(r,n);a.origin===n.origin&&(r=a.href.slice(n.origin.length));const i=le?xt(r,a.href,t):Rt(r,t);return{resolved:a,promise:i}}function Yt(e,t,n,r,a,i){if(Pe)return!0;if(!a)return!1;if(a.parent&&e||a.route&&t||a.url&&n)return!0;for(const s of a.search_params)if(r.has(s))return!0;for(const s of a.params)if(i[s]!==m.params[s])return!0;for(const s of a.dependencies)if(oe.some(o=>o(new URL(s))))return!0;return!1}function Ce(e,t){return e?.type==="data"?e:e?.type==="skip"?t??null:null}function Ht(e,t){if(!e)return new Set(t.searchParams.keys());const n=new Set([...e.searchParams.keys(),...t.searchParams.keys()]);for(const r of n){const a=e.searchParams.getAll(r),i=t.searchParams.getAll(r);a.every(s=>i.includes(s))&&i.every(s=>a.includes(s))&&n.delete(r)}return n}function Xt({error:e,url:t,route:n,params:r}){return{type:"loaded",state:{error:e,url:t,route:n,params:r,branch:[]},props:{page:De(E),constructors:[]}}}async function dt({id:e,invalidating:t,url:n,params:r,route:a,preload:i}){if(R?.id===e)return ce.delete(R.token),R.promise;const{errors:s,layouts:o,leaf:l}=a,c=[...o,l];s.forEach(g=>g?.().catch(()=>{})),c.forEach(g=>g?.[1]().catch(()=>{}));const f=m.url?e!==fe(m.url):!1,p=m.route?a.id!==m.route.id:!1,w=Ht(m.url,n);let h=!1;const u=c.map(async(g,d)=>{if(!g)return;const b=m.branch[d];return g[1]===b?.loader&&!Yt(h,p,f,w,b.universal?.uses,r)?b:(h=!0,$e({loader:g[1],url:n,params:r,route:a,parent:async()=>{const O={};for(let j=0;j<d;j+=1)Object.assign(O,(await u[j])?.data);return O},server_data_node:Ce(g[0]?{type:"skip"}:null,g[0]?b?.server:void 0)}))});for(const g of u)g.catch(()=>{});const _=[];for(let g=0;g<c.length;g+=1)if(c[g])try{_.push(await u[g])}catch(d){if(d instanceof Le)return{type:"redirect",location:d.location};if(ce.has(i))return Xt({error:await ee(d,{params:r,url:n,route:{id:a.id}}),url:n,params:r,route:a});let b=Ie(d),S;if(d instanceof xe)S=d.body;else{if(await P.updated.check())return await at(),await Z(n);S=await ee(d,{params:r,url:n,route:{id:a.id}})}const O=await Zt(g,_,s);return O?ue({url:n,params:r,branch:_.slice(0,O.idx).concat(O.node),errors:s,status:b,error:S,route:a}):await pt(n,{id:a.id},S,b)}else _.push(void 0);return ue({url:n,params:r,branch:_,errors:s,status:200,error:null,route:a,form:t?void 0:null})}async function Zt(e,t,n){for(;e--;)if(n[e]){let r=e;for(;!t[r];)r-=1;try{return{idx:r+1,node:{node:await n[e](),loader:n[e],data:{},server:null,universal:null}}}catch{continue}}}async function qe({status:e,error:t,url:n,route:r}){const a={};let i=null;try{const s=await $e({loader:ke,url:n,params:a,route:r,parent:()=>Promise.resolve({}),server_data_node:Ce(i)}),o={node:await ae(),loader:ae,universal:null,server:null,data:null};return ue({url:n,params:a,branch:[s,o],status:e,error:t,errors:[],route:null})}catch(s){if(s instanceof Le)return Gt(new URL(s.location,location.href),{},0);throw s}}async function Qt(e){const t=e.href;if(te.has(t))return te.get(t);let n;try{const r=(async()=>{let a=await y.hooks.reroute({url:new URL(e),fetch:async(i,s)=>Jt(i,s,e).promise})??e;if(typeof a=="string"){const i=new URL(e);y.hash?i.hash=a:i.pathname=a,a=i}return a})();te.set(t,r),n=await r}catch{te.delete(t);return}return n}async function he(e,t){if(e&&!de(e,L,y.hash)){const n=await Qt(e);if(!n)return;const r=en(n);for(const a of je){const i=a.exec(r);if(i)return{id:fe(e),invalidating:t,route:a,params:bt(i),url:e}}}}function en(e){return yt(y.hash?e.hash.replace(/^#/,"").replace(/[?#].+/,""):e.pathname.slice(L.length))||"/"}function fe(e){return(y.hash?e.hash.replace(/^#/,""):e.pathname)+e.search}function ht({url:e,type:t,intent:n,delta:r,event:a,scroll:i}){let s=!1;const o=Ne(m,n,e,t,i??null);r!==void 0&&(o.navigation.delta=r),a!==void 0&&(o.navigation.event=a);const l={...o.navigation,cancel:()=>{s=!0,o.reject(new Error("navigation cancelled"))}};return Q||ot.forEach(c=>c(l)),s?null:o}async function B({type:e,url:t,popped:n,keepfocus:r,noscroll:a,replace_state:i,state:s={},redirect_count:o=0,nav_token:l={},accept:c=Fe,block:f=Fe,event:p}){const w=q;q=l;const h=await he(t,!1),u=e==="enter"?Ne(m,h,t,e):ht({url:t,type:e,delta:n?.delta,intent:h,scroll:n?.scroll,event:p});if(!u){f(),q===l&&(q=w);return}const _=v,g=x;c(),Q=!0,le&&u.navigation.type!=="enter"&&P.navigating.set(H.current=u.navigation);let d=h&&await dt(h);if(!d){if(de(t,L,y.hash))return await Z(t,i);d=await pt(t,{id:null},await ee(new Ae(404,"Not Found",`Not found: ${t.pathname}`),{url:t,params:{},route:{id:null}}),404,i)}if(t=h?.url||t,q!==l)return u.reject(new Error("navigation aborted")),!1;if(d.type==="redirect"){if(o<20){await B({type:e,url:new URL(d.location,t),popped:n,keepfocus:r,noscroll:a,replace_state:i,state:s,redirect_count:o+1,nav_token:l}),u.fulfil(void 0);return}d=await qe({status:500,error:await ee(new Error("Redirect loop"),{url:t,params:{},route:{id:null}}),url:t,route:{id:null}})}else d.props.page.status>=400&&await P.updated.check()&&(await at(),await Z(t,i));if(Ft(),Oe(_),ct(g),d.props.page.url.pathname!==t.pathname&&(t.pathname=d.props.page.url.pathname),s=n?n.state:s,!n){const k=i?0:1,M={[K]:v+=k,[Y]:x+=k,[Ze]:s};(i?history.replaceState:history.pushState).call(history,M,"",t),i||Mt(v,x)}const b=h&&R?.id===h.id?R.fork:null;R?.fork&&!b&&ie(),R=null,d.props.page.state=s;let S;if(le){const k=(await Promise.all(Array.from(zt,z=>z(u.navigation)))).filter(z=>typeof z=="function");if(k.length>0){let z=function(){k.forEach(ge=>{J.delete(ge)})};k.push(z),k.forEach(ge=>{J.add(ge)})}const M=u.navigation.to;m={...d.state,nav:{params:M.params,route:M.route,url:M.url}},d.props.page&&(d.props.page.url=t);const pe=b&&await b;pe?S=pe.commit():(F=null,lt.$set(d.props),F&&Object.assign(d.props.page,F),Kt(d.props.page),S=wt?.()),it=!0}else await ft(d,Ee,!1);const{activeElement:O}=document;await S,await ne(),await ne();let j=null;if(Ge){const k=n?n.scroll:a?N():null;k?scrollTo(k.x,k.y):(j=t.hash&&document.getElementById(gt(t)))?j.scrollIntoView():scrollTo(0,0)}const _t=document.activeElement!==O&&document.activeElement!==document.body;!r&&!_t&&sn(t,!j),Ge=!0,d.props.page&&(F&&Object.assign(d.props.page,F),Object.assign(E,d.props.page)),Q=!1,e==="popstate"&&ut(x),u.fulfil(void 0),u.navigation.to&&(u.navigation.to.scroll=N()),J.forEach(k=>k(u.navigation)),P.navigating.set(H.current=null)}async function pt(e,t,n,r,a){return e.origin===Te&&e.pathname===location.pathname&&!st?await qe({status:r,error:n,url:e,route:t}):await Z(e,a)}function tn(){let e,t={element:void 0,href:void 0},n;I.addEventListener("mousemove",o=>{const l=o.target;clearTimeout(e),e=setTimeout(()=>{i(l,C.hover)},20)});function r(o){o.defaultPrevented||i(o.composedPath()[0],C.tap)}I.addEventListener("mousedown",r),I.addEventListener("touchstart",r,{passive:!0});const a=new IntersectionObserver(o=>{for(const l of o)l.isIntersecting&&(ye(new URL(l.target.href)),a.unobserve(l.target))},{threshold:0});async function i(o,l){const c=tt(o,I),f=c===t.element&&c?.href===t.href&&l>=n;if(!c||f)return;const{url:p,external:w,download:h}=be(c,L,y.hash);if(w||h)return;const u=re(c),_=p&&fe(m.url)===fe(p);if(!(u.reload||_))if(l<=u.preload_data){t={element:c,href:c.href},n=C.tap;const g=await he(p,!1);if(!g)return;Wt(g)}else l<=u.preload_code&&(t={element:c,href:c.href},n=l,ye(p))}function s(){a.disconnect();for(const o of I.querySelectorAll("a")){const{url:l,external:c,download:f}=be(o,L,y.hash);if(c||f)continue;const p=re(o);p.reload||(p.preload_code===C.viewport&&a.observe(o),p.preload_code===C.eager&&ye(l))}}J.add(s),s()}function ee(e,t){if(e instanceof xe)return e.body;const n=Ie(e),r=Dt(e);return y.hooks.handleError({error:e,event:t,status:n,message:r})??{message:r}}function nn(e){if(typeof e=="function")oe.push(e);else{const{href:t}=new URL(e,location.href);oe.push(n=>n.href===t)}}function rn(){history.scrollRestoration="manual",addEventListener("beforeunload",t=>{let n=!1;if(Je(),!Q){const r=Ne(m,void 0,null,"leave"),a={...r.navigation,cancel:()=>{n=!0,r.reject(new Error("navigation cancelled"))}};ot.forEach(i=>i(a))}n?(t.preventDefault(),t.returnValue=""):history.scrollRestoration="auto"}),addEventListener("visibilitychange",()=>{document.visibilityState==="hidden"&&Je()}),navigator.connection?.saveData||tn(),I.addEventListener("click",async t=>{if(t.button||t.which!==1||t.metaKey||t.ctrlKey||t.shiftKey||t.altKey||t.defaultPrevented)return;const n=tt(t.composedPath()[0],I);if(!n)return;const{url:r,external:a,target:i,download:s}=be(n,L,y.hash);if(!r)return;if(i==="_parent"||i==="_top"){if(window.parent!==window)return}else if(i&&i!=="_self")return;const o=re(n);if(!(n instanceof SVGAElement)&&r.protocol!==location.protocol&&!(r.protocol==="https:"||r.protocol==="http:")||s)return;const[c,f]=(y.hash?r.hash.replace(/^#/,""):r.href).split("#"),p=c===me(location);if(a||o.reload&&(!p||!f)){ht({url:r,type:"link",event:t})?Q=!0:t.preventDefault();return}if(f!==void 0&&p){const[,w]=m.url.href.split("#");if(w===f){if(t.preventDefault(),f===""||f==="top"&&n.ownerDocument.getElementById("top")===null)scrollTo({top:0});else{const h=n.ownerDocument.getElementById(decodeURIComponent(f));h&&(h.scrollIntoView(),h.focus())}return}if(G=!0,Oe(v),e(r),!o.replace_state)return;G=!1}t.preventDefault(),await new Promise(w=>{requestAnimationFrame(()=>{setTimeout(w,0)}),setTimeout(w,100)}),await B({type:"link",url:r,keepfocus:o.keepfocus,noscroll:o.noscroll,replace_state:o.replace_state??r.href===location.href,event:t})}),I.addEventListener("submit",t=>{if(t.defaultPrevented)return;const n=HTMLFormElement.prototype.cloneNode.call(t.target),r=t.submitter;if((r?.formTarget||n.target)==="_blank"||(r?.formMethod||n.method)!=="get")return;const s=new URL(r?.hasAttribute("formaction")&&r?.formAction||n.action);if(de(s,L,!1))return;const o=t.target,l=re(o);if(l.reload)return;t.preventDefault(),t.stopPropagation();const c=new FormData(o,r);s.search=new URLSearchParams(c).toString(),B({type:"form",url:s,keepfocus:l.keepfocus,noscroll:l.noscroll,replace_state:l.replace_state??s.href===location.href,event:t})}),addEventListener("popstate",async t=>{if(!Se){if(t.state?.[K]){const n=t.state[K];if(q={},n===v)return;const r=$[n],a=t.state[Ze]??{},i=new URL(t.state[$t]??location.href),s=t.state[Y],o=m.url?me(location)===me(m.url):!1;if(s===x&&(it||o)){a!==E.state&&(E.state=a),e(i),$[v]=N(),r&&scrollTo(r.x,r.y),v=n;return}const c=n-v;await B({type:"popstate",url:i,popped:{state:a,scroll:r,delta:c},accept:()=>{v=n,x=s},block:()=>{history.go(-c)},nav_token:q,event:t})}else if(!G){const n=new URL(location.href);e(n),y.hash&&location.reload()}}}),addEventListener("hashchange",()=>{G&&(G=!1,history.replaceState({...history.state,[K]:++v,[Y]:x},"",location.href))});for(const t of document.querySelectorAll("link"))Bt.has(t.rel)&&(t.href=t.href);addEventListener("pageshow",t=>{t.persisted&&P.navigating.set(H.current=null)});function e(t){m.url=E.url=t,P.page.set(De(E)),P.page.notify()}}async function an(e,{status:t=200,error:n,node_ids:r,params:a,route:i,server_route:s,data:o,form:l}){st=!0;const c=new URL(location.href);let f;({params:a={},route:i={id:null}}=await he(c,!1)||{}),f=je.find(({id:h})=>h===i.id);let p,w=!0;try{const h=r.map(async(_,g)=>{const d=o[g];return d?.uses&&(d.uses=on(d.uses)),$e({loader:y.nodes[_],url:c,params:a,route:i,parent:async()=>{const b={};for(let S=0;S<g;S+=1)Object.assign(b,(await h[S]).data);return b},server_data_node:Ce(d)})}),u=await Promise.all(h);if(f){const _=f.layouts;for(let g=0;g<_.length;g++)_[g]||u.splice(g,0,void 0)}p=await ue({url:c,params:a,branch:u,status:t,error:n,errors:f?.errors,form:l,route:f??null})}catch(h){if(h instanceof Le){await Z(new URL(h.location,location.href));return}p=await qe({status:Ie(h),error:await ee(h,{url:c,params:a,route:i}),url:c,route:i}),e.textContent="",w=!1}p.props.page&&(p.props.page.state={}),await ft(p,e,w)}function on(e){return{dependencies:new Set(e?.dependencies??[]),params:new Set(e?.params??[]),parent:!!e?.parent,route:!!e?.route,url:!!e?.url,search_params:new Set(e?.search_params??[])}}let Se=!1;function sn(e,t=!0){const n=document.querySelector("[autofocus]");if(n)n.focus();else{const r=gt(e);if(r&&document.getElementById(r)){const{x:i,y:s}=N();setTimeout(()=>{const o=history.state;Se=!0,location.replace(new URL(`#${r}`,location.href)),history.replaceState(o,"",e),t&&scrollTo(i,s),Se=!1})}else{const i=document.body,s=i.getAttribute("tabindex");i.tabIndex=-1,i.focus({preventScroll:!0,focusVisible:!1}),s!==null?i.setAttribute("tabindex",s):i.removeAttribute("tabindex")}const a=getSelection();if(a&&a.type!=="None"){const i=[];for(let s=0;s<a.rangeCount;s+=1)i.push(a.getRangeAt(s));setTimeout(()=>{if(a.rangeCount===i.length){for(let s=0;s<a.rangeCount;s+=1){const o=i[s],l=a.getRangeAt(s);if(o.commonAncestorContainer!==l.commonAncestorContainer||o.startContainer!==l.startContainer||o.endContainer!==l.endContainer||o.startOffset!==l.startOffset||o.endOffset!==l.endOffset)return}a.removeAllRanges()}})}}}function Ne(e,t,n,r,a=null){let i,s;const o=new Promise((c,f)=>{i=c,s=f});return o.catch(()=>{}),{navigation:{from:{params:e.params,route:{id:e.route?.id??null},url:e.url,scroll:N()},to:n&&{params:t?.params??null,route:{id:t?.route?.id??null},url:n,scroll:a},willUnload:!t,type:r,complete:o},fulfil:i,reject:s}}function De(e){return{data:e.data,error:e.error,form:e.form,params:e.params,route:e.route,state:e.state,status:e.status,url:e.url}}function ln(e){const t=new URL(e);return t.hash=decodeURIComponent(e.hash),t}function gt(e){let t;if(y.hash){const[,,n]=e.hash.split("#",3);t=n??""}else t=e.hash.slice(1);return decodeURIComponent(t)}export{gn as a,fn as l,E as p,P as s};
@@ -1 +0,0 @@
1
- import{l as o,a as r}from"../chunks/BmeSanva.js";export{o as load_css,r as start};
@@ -1,2 +0,0 @@
1
- )�import{l as o,a as r}from"../chunks/BmeSanva.js";export{o as load_css,r as start};
2
- 
@@ -1 +0,0 @@
1
- {"version":3,"file":"_server.ts.js-Dyfsc-VA.js","sources":["../../../../../../../../.svelte-kit/output/server/entries/endpoints/api/graph/schema-registry/_server.ts.js"],"sourcesContent":["import { execFile } from \"node:child_process\";\nimport { existsSync } from \"node:fs\";\nimport { promisify } from \"node:util\";\nimport { json, error } from \"@sveltejs/kit\";\nimport { a as resolveMindbrainRuntime } from \"../../../../../chunks/mindbrainClient.js\";\nimport { b as sanitizeWorkspaceParam, c as sqlitePath } from \"../../../../../chunks/graphRepository.js\";\nimport { s as schemaOntologyKey } from \"../../../../../chunks/ontologyInspect.js\";\nconst execFileAsync = promisify(execFile);\nfunction parseJsonObject(raw) {\n if (!raw || typeof raw !== \"string\") return {};\n try {\n const value = JSON.parse(raw);\n return value && typeof value === \"object\" && !Array.isArray(value) ? value : {};\n } catch {\n return {};\n }\n}\nfunction registrySqlitePaths() {\n const runtime = resolveMindbrainRuntime();\n return [...new Set([runtime.sqlitePath, sqlitePath()].filter((p) => Boolean(p)))];\n}\nfunction entityTypeFromSchemaId(schemaId, workspaceId) {\n const ontologyPrefix = `${workspaceId}::`;\n if (schemaId.startsWith(ontologyPrefix)) {\n const parts2 = schemaId.slice(ontologyPrefix.length).split(\":\");\n return parts2.slice(2).join(\":\") || parts2.at(-1) || schemaId;\n }\n const prefix = `${workspaceId}:`;\n if (!schemaId.startsWith(prefix)) return schemaId;\n const parts = schemaId.slice(prefix.length).split(\":\");\n return parts.slice(1).join(\":\") || parts[0] || schemaId;\n}\nfunction objectFieldCount(raw) {\n return raw && typeof raw === \"object\" && !Array.isArray(raw) ? Object.keys(raw).length : 0;\n}\nfunction schemaFacetCount(definition) {\n const fields = objectFieldCount(definition.fields);\n if (fields > 0) return fields;\n const facets = definition.facets && typeof definition.facets === \"object\" && !Array.isArray(definition.facets) ? definition.facets : {};\n return objectFieldCount(facets.required) + objectFieldCount(facets.optional);\n}\nfunction schemaFields(definition) {\n const fields = definition.fields && typeof definition.fields === \"object\" && !Array.isArray(definition.fields) ? definition.fields : {};\n return Object.entries(fields).filter(([, raw]) => raw && typeof raw === \"object\" && !Array.isArray(raw)).map(([name, raw]) => {\n const value = raw;\n return {\n name,\n type: value.type == null ? null : String(value.type),\n range: value.range == null ? null : String(value.range),\n required: value.required === true,\n multivalued: value.multivalued === true,\n description: value.description == null ? null : String(value.description)\n };\n }).sort((a, b) => a.name.localeCompare(b.name));\n}\nfunction sqlString(value) {\n return `'${value.replaceAll(\"'\", \"''\")}'`;\n}\nasync function queryJsonRows(dbPath, sql) {\n const { stdout } = await execFileAsync(\"sqlite3\", [\"-readonly\", \"-json\", dbPath, sql], {\n maxBuffer: 10 * 1024 * 1024\n });\n const trimmed = stdout.trim();\n if (!trimmed) return [];\n const parsed = JSON.parse(trimmed);\n return Array.isArray(parsed) ? parsed : [];\n}\nconst GET = async ({ url }) => {\n const workspace = sanitizeWorkspaceParam(url.searchParams.get(\"workspace\")) ?? \"default\";\n const paths = registrySqlitePaths();\n const existingPaths = paths.filter((path) => existsSync(path));\n if (existingPaths.length === 0) {\n return json({\n workspace_id: workspace,\n total: 0,\n facet_definition_total: 0,\n rows: [],\n source: \"unavailable\",\n error: `SQLite database not found. Tried: ${paths.join(\", \")}`\n });\n }\n try {\n const workspaceSql = sqlString(workspace);\n let schemaRows = [];\n let facetRows = [];\n let sourcePath = existingPaths[0];\n for (const candidatePath of existingPaths) {\n const candidateSchemaRows = await queryJsonRows(\n candidatePath,\n `\n\t\t\t\t\tSELECT id, content, COALESCE(facets_json, facets, '{}') AS facets_json\n\t\t\t\t\tFROM agent_facts\n\t\t\t\t\tWHERE schema_id = 'mindbrain:schema'\n\t\t\t\t\t\tAND workspace_id = ${workspaceSql}\n\t\t\t\t\t\tAND json_extract(COALESCE(facets_json, facets, '{}'), '$.target') IN ('facets', 'graph_node', 'graph_edge')\n\t\t\t\t\t\tAND json_extract(COALESCE(facets_json, facets, '{}'), '$.schema_id') LIKE ${sqlString(`${workspace}:%`)}\n\t\t\t\t\tORDER BY json_extract(COALESCE(facets_json, facets, '{}'), '$.schema_id')\n\t\t\t\t\t`\n );\n if (candidateSchemaRows.length === 0 && candidatePath !== existingPaths.at(-1)) continue;\n sourcePath = candidatePath;\n schemaRows = candidateSchemaRows;\n facetRows = await queryJsonRows(\n candidatePath,\n `\n\t\t\t\t\tSELECT COALESCE(facets_json, facets, '{}') AS facets_json, content\n\t\t\t\t\tFROM agent_facts\n\t\t\t\t\tWHERE schema_id = 'mindbrain:facet-definition'\n\t\t\t\t\t\tAND workspace_id = ${workspaceSql}\n\t\t\t\t\t`\n );\n break;\n }\n void sourcePath;\n const rows = schemaRows.map((row) => {\n const facets = parseJsonObject(row.facets_json);\n const definition = parseJsonObject(row.content);\n const schemaId = String(facets.schema_id ?? definition.schema_id ?? \"\");\n return {\n id: row.id,\n schema_id: schemaId,\n ontology_key: schemaOntologyKey(schemaId, workspace),\n entity_type: entityTypeFromSchemaId(schemaId, workspace),\n class_name: definition.serenity && typeof definition.serenity === \"object\" && !Array.isArray(definition.serenity) && typeof definition.serenity.class_name === \"string\" ? String(definition.serenity.class_name) : null,\n target: facets.target == null ? null : String(facets.target),\n version: typeof facets.version === \"number\" && Number.isFinite(facets.version) ? facets.version : null,\n description: definition.description == null ? null : String(definition.description),\n facet_definition_count: schemaFacetCount(definition),\n fields: schemaFields(definition)\n };\n });\n return json({\n workspace_id: workspace,\n total: rows.length,\n facet_definition_total: facetRows.length,\n rows,\n source: \"sqlite\"\n });\n } catch (e) {\n const message = e instanceof Error ? e.message : String(e);\n console.error(\"[api/graph/schema-registry]\", message);\n throw error(500, message);\n }\n};\nexport {\n GET\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;AAOA,MAAM,aAAa,GAAG,SAAS,CAAC,QAAQ,CAAC;AACzC,SAAS,eAAe,CAAC,GAAG,EAAE;AAC9B,EAAE,IAAI,CAAC,GAAG,IAAI,OAAO,GAAG,KAAK,QAAQ,EAAE,OAAO,EAAE;AAChD,EAAE,IAAI;AACN,IAAI,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC;AACjC,IAAI,OAAO,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,GAAG,KAAK,GAAG,EAAE;AACnF,EAAE,CAAC,CAAC,MAAM;AACV,IAAI,OAAO,EAAE;AACb,EAAE;AACF;AACA,SAAS,mBAAmB,GAAG;AAC/B,EAAE,MAAM,OAAO,GAAG,uBAAuB,EAAE;AA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