project-athena 0.2.1 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +63 -0
- package/README.md +61 -12
- package/dist/activity-BKW7G4I5.js +77 -0
- package/dist/agents-DFSNEOP5.js +69 -0
- package/dist/ai-ASL4FFQ7.js +96 -0
- package/dist/analyze-ZY3MXBOI.js +50 -0
- package/dist/chunk-2DY4PUR4.js +465 -0
- package/dist/chunk-2R6PXY6Z.js +33 -0
- package/dist/chunk-3IS2X2Z7.js +89 -0
- package/dist/chunk-3XSDI5WF.js +179 -0
- package/dist/chunk-65TSRDQ3.js +124 -0
- package/dist/chunk-673EPYYH.js +105 -0
- package/dist/chunk-7DZK6WSQ.js +65 -0
- package/dist/chunk-AD4OZCU2.js +34 -0
- package/dist/chunk-DZDI2HRT.js +169 -0
- package/dist/chunk-ELKFRTZT.js +221 -0
- package/dist/chunk-EUPETUWA.js +14 -0
- package/dist/chunk-FQEGEVLY.js +38 -0
- package/dist/chunk-FVCDMQUQ.js +343 -0
- package/dist/chunk-GGXPG6OE.js +904 -0
- package/dist/chunk-GHFRQAYT.js +112 -0
- package/dist/chunk-GR4DL2VM.js +47 -0
- package/dist/chunk-INT3IGMQ.js +111 -0
- package/dist/chunk-IQQBAWSM.js +90 -0
- package/dist/chunk-JCGDR4UV.js +182 -0
- package/dist/chunk-KBO7XRBW.js +26 -0
- package/dist/chunk-KHMBNT66.js +399 -0
- package/dist/chunk-LEMPCNAY.js +209 -0
- package/dist/chunk-MPG3IEGB.js +2691 -0
- package/dist/chunk-OLPSEQS5.js +264 -0
- package/dist/chunk-PVCIGUIT.js +64 -0
- package/dist/chunk-QCC4VJUH.js +217 -0
- package/dist/chunk-QLW657NT.js +95 -0
- package/dist/chunk-RVTNSNGK.js +182 -0
- package/dist/chunk-RXNRMIZP.js +390 -0
- package/dist/chunk-SHKXELUX.js +295 -0
- package/dist/chunk-SJ4DQFIJ.js +379 -0
- package/dist/chunk-SVTEJYMS.js +227 -0
- package/dist/chunk-TDNZ2RYA.js +702 -0
- package/dist/chunk-UAZLPNVC.js +108 -0
- package/dist/chunk-VSYBC3VY.js +28 -0
- package/dist/chunk-WVQC2EGO.js +166 -0
- package/dist/chunk-XDCKZ5TV.js +436 -0
- package/dist/chunk-XFN7UZCS.js +35 -0
- package/dist/chunk-XW3MLHI2.js +32 -0
- package/dist/chunk-YRIS7ZS6.js +919 -0
- package/dist/chunk-Z6QWMJLK.js +124 -0
- package/dist/chunk-ZB7LC6FP.js +221 -0
- package/dist/clean-MDBYH62P.js +23 -0
- package/dist/cli.js +18 -10716
- package/dist/context-PLPCAPCO.js +161 -0
- package/dist/doctor-BX677KRE.js +69 -0
- package/dist/event-TNT6CQZR.js +101 -0
- package/dist/git-hook-YZNZGAAP.js +252 -0
- package/dist/init-WQCAOJ2R.js +38 -0
- package/dist/mcp-U7EPH43L.js +393 -0
- package/dist/memory-VSVNLEJC.js +393 -0
- package/dist/open-UJZRYF4E.js +1450 -0
- package/dist/program-CWJNGCTZ.js +165 -0
- package/dist/review-OOKXSYMP.js +117 -0
- package/dist/rules-4FXJUCXB.js +83 -0
- package/dist/security-LME3XFL3.js +177 -0
- package/dist/staged-check-X24C3YRD.js +502 -0
- package/dist/status-RR57ZNGI.js +81 -0
- package/dist/sync-KFJANRXF.js +218 -0
- package/dist/watch-CY7QHIYN.js +123 -0
- package/dist/web/assets/{Editor-DAXvniWB.js → Editor-Bnilgch0.js} +1 -1
- package/dist/web/assets/{abnfDiagram-O67JEVCF-Az7EW1BC.js → abnfDiagram-O67JEVCF-DW9LWr8f.js} +1 -1
- package/dist/web/assets/architecture-7GRP2DOG-BWDZV2yn.js +1 -0
- package/dist/web/assets/{architectureDiagram-NJMV4G6O-BxeXqSTn.js → architectureDiagram-NJMV4G6O-0eKeQRhj.js} +1 -1
- package/dist/web/assets/{blockDiagram-BEXU5L5S-aeKZl9lJ.js → blockDiagram-BEXU5L5S-D5i3-ogI.js} +1 -1
- package/dist/web/assets/{c4Diagram-YGBWAQC7-CgmntYsG.js → c4Diagram-YGBWAQC7-BAWQZrEu.js} +1 -1
- package/dist/web/assets/channel-Bkh05NKd.js +1 -0
- package/dist/web/assets/{chunk-3FUC2YCW-BpmRD2yo.js → chunk-3FUC2YCW-fKRGOZF3.js} +1 -1
- package/dist/web/assets/{chunk-5DYCD2WN-CRIFDwod.js → chunk-5DYCD2WN-C5jOlx42.js} +1 -1
- package/dist/web/assets/{chunk-742MDFTN-hRW9VeNV.js → chunk-742MDFTN-urY4RP_A.js} +1 -1
- package/dist/web/assets/{chunk-7INBJB4K-C6VEpT0Y.js → chunk-7INBJB4K-nk48sKqZ.js} +1 -1
- package/dist/web/assets/{chunk-7M6MHVWA-Dnajov2w.js → chunk-7M6MHVWA-BfBD9X0F.js} +1 -1
- package/dist/web/assets/{chunk-7PRAP22T-DSAc0_CZ.js → chunk-7PRAP22T-jYf59QlI.js} +1 -1
- package/dist/web/assets/{chunk-GTNCS2PH-CefpYUjb.js → chunk-GTNCS2PH-BOCxryKf.js} +1 -1
- package/dist/web/assets/{chunk-GWA4HPMP-MLNflMmF.js → chunk-GWA4HPMP-CFpaW0ru.js} +1 -1
- package/dist/web/assets/{chunk-MBY4JIJT-D3GmmEiU.js → chunk-MBY4JIJT-BIB8HctN.js} +1 -1
- package/dist/web/assets/{chunk-NETBCI7D-DzTj6xVk.js → chunk-NETBCI7D-CpUUK6rh.js} +1 -1
- package/dist/web/assets/{chunk-O7XYJQB3-D1d0hCko.js → chunk-O7XYJQB3-BNx_V4Oi.js} +1 -1
- package/dist/web/assets/{chunk-UA2S7LBM-C9hIFeWR.js → chunk-UA2S7LBM-D3tMiIOY.js} +1 -1
- package/dist/web/assets/{chunk-WEXAMYUT-BFGtcjsi.js → chunk-WEXAMYUT-CC-3C32l.js} +1 -1
- package/dist/web/assets/{chunk-Z7XXMR3K-BRZ8_wtE.js → chunk-Z7XXMR3K-BzhxKQUc.js} +1 -1
- package/dist/web/assets/{chunk-ZIGJFQKS-CTKOioal.js → chunk-ZIGJFQKS-D4tBHzxg.js} +1 -1
- package/dist/web/assets/{classDiagram-v2-NBCMYWYE-DJGKtWJv.js → classDiagram-v2-NBCMYWYE-BbtyanXR.js} +1 -1
- package/dist/web/assets/{cynefin-OW5HDTMX-hNq1kGmA.js → cynefin-OW5HDTMX-BIArb8W1.js} +1 -1
- package/dist/web/assets/{cynefinDiagram-VND7K2PF-sODQM_ZZ.js → cynefinDiagram-VND7K2PF-BrAcfkXL.js} +1 -1
- package/dist/web/assets/{dagre-6A5THRUB-DEzTThIf.js → dagre-6A5THRUB-BcHXRl4s.js} +1 -1
- package/dist/web/assets/{diagram-22UHCM2B-s_eellsa.js → diagram-22UHCM2B-Dx9tSCdE.js} +1 -1
- package/dist/web/assets/{diagram-3UASUU5V-B2onY_Xw.js → diagram-3UASUU5V-CLLDP9yH.js} +1 -1
- package/dist/web/assets/{diagram-ATOU4E4O-B8V6s13s.js → diagram-ATOU4E4O-B46H9iPt.js} +1 -1
- package/dist/web/assets/{diagram-CDSNMT55-CJxiE6mf.js → diagram-CDSNMT55-CYtvB6aG.js} +1 -1
- package/dist/web/assets/{diagram-MLGK6HIB-m5OHPLAp.js → diagram-MLGK6HIB-Dar7ktoX.js} +1 -1
- package/dist/web/assets/{diagram-MPIPVDR6-Buvvrk_A.js → diagram-MPIPVDR6-C-DljnYN.js} +1 -1
- package/dist/web/assets/{ebnfDiagram-ZINNZB2B-CpL7Wt3R.js → ebnfDiagram-ZINNZB2B-Dv_3jWnh.js} +1 -1
- package/dist/web/assets/{elk-276RUBZZ-CwYhbsXa.js → elk-276RUBZZ-DnHciE9k.js} +1 -1
- package/dist/web/assets/{erDiagram-OPXOYQCR-DNikci2r.js → erDiagram-OPXOYQCR-Bn46KrHz.js} +1 -1
- package/dist/web/assets/eventmodeling-NTZA5JFV-DYwoptMd.js +1 -0
- package/dist/web/assets/flowDiagram-KWPJA3E3-y4rS0gIB.js +1 -0
- package/dist/web/assets/{ganttDiagram-FUAMR5RP-d-ynDlvJ.js → ganttDiagram-FUAMR5RP-DOjjJtqz.js} +1 -1
- package/dist/web/assets/{gitGraph-4MIJSDKK-DwIeBI91.js → gitGraph-4MIJSDKK-BIoMXJRQ.js} +1 -1
- package/dist/web/assets/{gitGraphDiagram-X574FWY7-04RZccu6.js → gitGraphDiagram-X574FWY7-BsJ01R0v.js} +1 -1
- package/dist/web/assets/{index-C3-8uYXr.js → index-Cen0jOXj.js} +5 -4
- package/dist/web/assets/{index-DKE3ojTe.css → index-WwRY6n68.css} +1 -1
- package/dist/web/assets/{info-A6RAGUB7-xf4Nzgv-.js → info-A6RAGUB7-BmlXzRWj.js} +1 -1
- package/dist/web/assets/{infoDiagram-VRGFBTTK-BYjw0eiK.js → infoDiagram-VRGFBTTK-CYPJPmBP.js} +1 -1
- package/dist/web/assets/{ishikawaDiagram-OU5B5YK6-Bx9s4nPM.js → ishikawaDiagram-OU5B5YK6-YN96geky.js} +1 -1
- package/dist/web/assets/{journeyDiagram-ZHPQQLJL-DrdHs7B-.js → journeyDiagram-ZHPQQLJL-20juojKY.js} +1 -1
- package/dist/web/assets/{kanban-definition-PNTS6WVX-CVd8v2Te.js → kanban-definition-PNTS6WVX-BhCKIEbP.js} +1 -1
- package/dist/web/assets/{line-V_WrJ-6y.js → line-BERsMFG6.js} +1 -1
- package/dist/web/assets/{mermaid-parser.core-B-ilyEpO.js → mermaid-parser.core-Bis_wTB-.js} +3 -3
- package/dist/web/assets/{mermaid.core-Bnyaa0nF.js → mermaid.core-DMsM3ZX7.js} +4 -4
- package/dist/web/assets/{mindmap-definition-NLK3R4M7-B3AbvHPR.js → mindmap-definition-NLK3R4M7-BkcGdOfv.js} +1 -1
- package/dist/web/assets/{packet-AYTQ26CC-CBAIUXIc.js → packet-AYTQ26CC-Bh30-JJX.js} +1 -1
- package/dist/web/assets/{pegDiagram-GJSIUBJH-DIdeELUM.js → pegDiagram-GJSIUBJH-DxnIo9RF.js} +1 -1
- package/dist/web/assets/{pie-WAS4IAKB-a1r3tzPR.js → pie-WAS4IAKB-ChaTr-GD.js} +1 -1
- package/dist/web/assets/{pieDiagram-5QR66LMP-pQBEio0x.js → pieDiagram-5QR66LMP-CzAp78FM.js} +1 -1
- package/dist/web/assets/{quadrantDiagram-O4NWA36T-CkJK5Y03.js → quadrantDiagram-O4NWA36T-BDSE-cfY.js} +1 -1
- package/dist/web/assets/{radar-RG4KPBEZ-BZfLYjx5.js → radar-RG4KPBEZ-DgJ-o_dq.js} +1 -1
- package/dist/web/assets/{railroad-74A4TZTK-CuIW1ZAU.js → railroad-74A4TZTK-C8MmcBKz.js} +1 -1
- package/dist/web/assets/railroad-abnf-HS5TGJTU-CTLXjcdP.js +1 -0
- package/dist/web/assets/railroad-ebnf-LZEXJU2U-ggWsTTL0.js +1 -0
- package/dist/web/assets/railroad-peg-WCYAUIDC-D1mCX705.js +1 -0
- package/dist/web/assets/{railroadDiagram-XR7U4H2S-_BpGE8aJ.js → railroadDiagram-XR7U4H2S-DfbcWRNh.js} +1 -1
- package/dist/web/assets/{requirementDiagram-PLB6GJNP-CnzF90GS.js → requirementDiagram-PLB6GJNP-DM3nksxs.js} +1 -1
- package/dist/web/assets/{sankeyDiagram-IPEJSGJF-DYeisDj_.js → sankeyDiagram-IPEJSGJF-DthUpiiC.js} +1 -1
- package/dist/web/assets/{sequenceDiagram-PO4LG4MO-ll9cBvca.js → sequenceDiagram-PO4LG4MO-DLA3nuvA.js} +1 -1
- package/dist/web/assets/{stateDiagram-v2-GCMORJYK-CdKcOIKQ.js → stateDiagram-v2-GCMORJYK-B0X6ihBW.js} +1 -1
- package/dist/web/assets/{swimlanes-2SLR337P-y6piTWEW.js → swimlanes-2SLR337P-B4qWe6vE.js} +1 -1
- package/dist/web/assets/swimlanesDiagram-TC7HE7FX-ClIk3e7S.js +8 -0
- package/dist/web/assets/{timeline-definition-EJHVYXUP-DuC_4xK0.js → timeline-definition-EJHVYXUP-F-cDzYrj.js} +1 -1
- package/dist/web/assets/{treeView-Q6P3EWNA-gCQFmND0.js → treeView-Q6P3EWNA-BaI30nLZ.js} +1 -1
- package/dist/web/assets/{treemap-WGGIJYW6-BQ2010OY.js → treemap-WGGIJYW6-D2jGGoMl.js} +1 -1
- package/dist/web/assets/{usecaseDiagram-POWQR4AR-CCTqzHz6.js → usecaseDiagram-POWQR4AR-B9qoAQCy.js} +1 -1
- package/dist/web/assets/{vennDiagram-UO4OBE2U-0_O7guNq.js → vennDiagram-UO4OBE2U-DGVNOaKO.js} +1 -1
- package/dist/web/assets/{wardley-WFR3VGLG-SsX7uMDs.js → wardley-WFR3VGLG-DbKqhNAh.js} +1 -1
- package/dist/web/assets/{wardleyDiagram-VNRHLVJA-DlqH6Hox.js → wardleyDiagram-VNRHLVJA-BgZ1gprw.js} +1 -1
- package/dist/web/assets/{xychartDiagram-PMCCYNJV-nr4UYDtd.js → xychartDiagram-PMCCYNJV-D73RYid1.js} +1 -1
- package/dist/web/index.html +2 -2
- package/package.json +4 -2
- package/dist/web/assets/architecture-7GRP2DOG-blXBarB2.js +0 -1
- package/dist/web/assets/channel-f4QzewnN.js +0 -1
- package/dist/web/assets/eventmodeling-NTZA5JFV-CA_ZFPZ2.js +0 -1
- package/dist/web/assets/flowDiagram-KWPJA3E3-DObsBuWT.js +0 -1
- package/dist/web/assets/railroad-abnf-HS5TGJTU-6B4Ffbxn.js +0 -1
- package/dist/web/assets/railroad-ebnf-LZEXJU2U-BGL9lIQc.js +0 -1
- package/dist/web/assets/railroad-peg-WCYAUIDC-DcqxTem7.js +0 -1
- package/dist/web/assets/swimlanesDiagram-TC7HE7FX-DFS8a3jO.js +0 -8
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import {
|
|
3
|
+
confirm
|
|
4
|
+
} from "./chunk-7DZK6WSQ.js";
|
|
5
|
+
import {
|
|
6
|
+
bullet,
|
|
7
|
+
c,
|
|
8
|
+
dim,
|
|
9
|
+
heading,
|
|
10
|
+
info,
|
|
11
|
+
isJson,
|
|
12
|
+
isQuiet,
|
|
13
|
+
json,
|
|
14
|
+
line,
|
|
15
|
+
ok,
|
|
16
|
+
spinner,
|
|
17
|
+
sym,
|
|
18
|
+
warn
|
|
19
|
+
} from "./chunk-Z6QWMJLK.js";
|
|
20
|
+
import {
|
|
21
|
+
requireProjectRoot
|
|
22
|
+
} from "./chunk-XFN7UZCS.js";
|
|
23
|
+
import "./chunk-KBO7XRBW.js";
|
|
24
|
+
import {
|
|
25
|
+
applySync,
|
|
26
|
+
fileChangeCount,
|
|
27
|
+
needsIndexRefreshOnly,
|
|
28
|
+
planSync,
|
|
29
|
+
staleForCheck,
|
|
30
|
+
summarizePlan
|
|
31
|
+
} from "./chunk-KHMBNT66.js";
|
|
32
|
+
import "./chunk-WVQC2EGO.js";
|
|
33
|
+
import "./chunk-GR4DL2VM.js";
|
|
34
|
+
import "./chunk-GGXPG6OE.js";
|
|
35
|
+
import "./chunk-MPG3IEGB.js";
|
|
36
|
+
import "./chunk-ELKFRTZT.js";
|
|
37
|
+
import "./chunk-2R6PXY6Z.js";
|
|
38
|
+
import "./chunk-PVCIGUIT.js";
|
|
39
|
+
import "./chunk-OLPSEQS5.js";
|
|
40
|
+
import "./chunk-SVTEJYMS.js";
|
|
41
|
+
import "./chunk-QCC4VJUH.js";
|
|
42
|
+
import "./chunk-JCGDR4UV.js";
|
|
43
|
+
import "./chunk-YRIS7ZS6.js";
|
|
44
|
+
import "./chunk-GHFRQAYT.js";
|
|
45
|
+
import "./chunk-INT3IGMQ.js";
|
|
46
|
+
import "./chunk-673EPYYH.js";
|
|
47
|
+
import "./chunk-FQEGEVLY.js";
|
|
48
|
+
import "./chunk-2DY4PUR4.js";
|
|
49
|
+
import "./chunk-IQQBAWSM.js";
|
|
50
|
+
import {
|
|
51
|
+
AthenaError,
|
|
52
|
+
EXIT
|
|
53
|
+
} from "./chunk-AD4OZCU2.js";
|
|
54
|
+
import "./chunk-XW3MLHI2.js";
|
|
55
|
+
import "./chunk-EUPETUWA.js";
|
|
56
|
+
|
|
57
|
+
// src/cli/commands/sync.ts
|
|
58
|
+
function colorDiff(patch) {
|
|
59
|
+
return patch.split("\n").map((l) => l.startsWith("+++") || l.startsWith("---") ? c.bold(l) : l.startsWith("+") ? c.green(l) : l.startsWith("-") ? c.red(l) : l.startsWith("@@") ? c.cyan(l) : l).join("\n");
|
|
60
|
+
}
|
|
61
|
+
function printPlan(plan, opts = {}) {
|
|
62
|
+
const fc = plan.fileChanges;
|
|
63
|
+
const count = fileChangeCount(plan);
|
|
64
|
+
heading("Changes since last analysis");
|
|
65
|
+
if (count) {
|
|
66
|
+
const parts = [fc.modified.length && `${fc.modified.length} modified`, fc.added.length && `${fc.added.length} added`, fc.deleted.length && `${fc.deleted.length} deleted`, fc.renamed.length && `${fc.renamed.length} renamed`].filter(Boolean);
|
|
67
|
+
line(` ${count} file${count === 1 ? "" : "s"} ${dim(`(${parts.join(" \xB7 ")})`)}`);
|
|
68
|
+
const sample = [...fc.modified.map((p) => `M ${p}`), ...fc.added.map((p) => `A ${p}`), ...fc.deleted.map((p) => `D ${p}`), ...fc.renamed.map((r) => `R ${r.from} \u2192 ${r.to}`)];
|
|
69
|
+
for (const s of sample.slice(0, 8)) line(` ${dim(s)}`);
|
|
70
|
+
if (sample.length > 8) line(dim(` +${sample.length - 8} more`));
|
|
71
|
+
} else {
|
|
72
|
+
line(dim(" No file changes."));
|
|
73
|
+
}
|
|
74
|
+
const g = plan.git;
|
|
75
|
+
if (g.isRepo && g.previousHead && g.head && g.previousHead !== g.head) {
|
|
76
|
+
if (g.branchChanged) line(` Git: branch changed ${c.bold(g.previousBranch ?? "?")} \u2192 ${c.bold(g.branch ?? "?")}`);
|
|
77
|
+
if (g.diverged) line(` Git: HEAD moved to ${g.head.slice(0, 8)} ${dim("(not a descendant of the last analyzed commit \u2014 rebase, reset or checkout)")}`);
|
|
78
|
+
else if (g.commits.length) {
|
|
79
|
+
line(` Git: ${g.commits.length}${g.truncated ? "+" : ""} new commit${g.commits.length === 1 ? "" : "s"}`);
|
|
80
|
+
for (const c2 of g.commits.slice(0, 5)) line(` ${dim(`${c2.sha.slice(0, 8)} ${c2.subject}`)}`);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
if (plan.modelChanges.length) {
|
|
84
|
+
line();
|
|
85
|
+
heading("Detected project changes");
|
|
86
|
+
for (const m of plan.modelChanges) bullet(`${m.label}: ${dim(m.summary)}`);
|
|
87
|
+
}
|
|
88
|
+
line();
|
|
89
|
+
if (plan.upToDate) {
|
|
90
|
+
ok("Knowledge already reflects these changes \u2014 no document needs updating.");
|
|
91
|
+
if (plan.checkedUnchanged.length) line(dim(` Checked: ${plan.checkedUnchanged.join(", ")}`));
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
heading("Knowledge to update");
|
|
95
|
+
const width = Math.max(...plan.documents.map((d) => d.file.length));
|
|
96
|
+
for (const d of plan.documents) {
|
|
97
|
+
const sign = d.status === "created" ? c.green("+") : c.yellow("~");
|
|
98
|
+
line(` ${sign} ${d.file.padEnd(width)} ${c.green(`+${d.additions}`)} ${c.red(`\u2212${d.deletions}`)} ${dim(d.changedSections.join(", "))}`);
|
|
99
|
+
for (const r of d.reasons.slice(0, 3)) line(` ${dim(`${sym.arrow} ${r}`)}`);
|
|
100
|
+
if (d.preservedSections.length) line(` ${c.yellow(sym.warn)} ${dim(`your edits kept in: ${d.preservedSections.join(", ")}`)}`);
|
|
101
|
+
}
|
|
102
|
+
if (plan.checkedUnchanged.length) line(dim(` Checked and unchanged: ${plan.checkedUnchanged.join(", ")}`));
|
|
103
|
+
if (plan.ignored) line(dim(" (You previously ignored this exact proposal.)"));
|
|
104
|
+
if (opts.diff) {
|
|
105
|
+
for (const d of plan.documents) {
|
|
106
|
+
line();
|
|
107
|
+
line(colorDiff(d.diff.replace(/^=+\n/m, "")));
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
async function syncCommand(opts) {
|
|
112
|
+
if (opts.staged && (!opts.check || opts.yes || opts.dryRun || opts.diff || opts.force)) {
|
|
113
|
+
throw new AthenaError("`--staged` only works with `--check`.", "Run `athena sync --check --staged`; to update knowledge, run `athena sync` and stage .athena/.");
|
|
114
|
+
}
|
|
115
|
+
const root = await requireProjectRoot(opts);
|
|
116
|
+
if (opts.staged) return stagedCheckCommand(root, opts);
|
|
117
|
+
const sp = spinner("Checking for changes...");
|
|
118
|
+
let plan;
|
|
119
|
+
try {
|
|
120
|
+
plan = await planSync(root, { signal: opts.signal, force: opts.force });
|
|
121
|
+
sp.stop();
|
|
122
|
+
} catch (err) {
|
|
123
|
+
sp.stop();
|
|
124
|
+
throw err;
|
|
125
|
+
}
|
|
126
|
+
const stale = staleForCheck(plan);
|
|
127
|
+
const inSync = stale.length === 0;
|
|
128
|
+
if (isJson() && (opts.dryRun || opts.check)) {
|
|
129
|
+
json({
|
|
130
|
+
...summarizePlan(plan),
|
|
131
|
+
...opts.check ? { inSync, stale: stale.map((d) => d.file) } : {},
|
|
132
|
+
...opts.diff ? { diffs: Object.fromEntries(plan.documents.map((d) => [d.file, d.diff])) } : {}
|
|
133
|
+
});
|
|
134
|
+
return opts.check && !inSync ? 1 : EXIT.OK;
|
|
135
|
+
}
|
|
136
|
+
if (!isJson() && !isQuiet()) {
|
|
137
|
+
heading("Athena Sync");
|
|
138
|
+
line();
|
|
139
|
+
printPlan(plan, { diff: opts.diff });
|
|
140
|
+
line();
|
|
141
|
+
} else if (!isJson() && !plan.upToDate) {
|
|
142
|
+
line(`Proposed: ${plan.documents.map((d) => d.file).join(", ")}`);
|
|
143
|
+
}
|
|
144
|
+
if (opts.check) {
|
|
145
|
+
if (!inSync) line(c.yellow("Knowledge is out of date. Run `athena sync` to review and apply."));
|
|
146
|
+
else {
|
|
147
|
+
line(c.green("Knowledge is synchronized."));
|
|
148
|
+
if (!plan.upToDate) info(dim("Only Git-history sections (change hotspots) differ; they are not checked. `athena sync` refreshes them."));
|
|
149
|
+
}
|
|
150
|
+
return inSync ? EXIT.OK : 1;
|
|
151
|
+
}
|
|
152
|
+
if (opts.dryRun) {
|
|
153
|
+
if (!isJson()) line(dim("Dry run \u2014 nothing was written."));
|
|
154
|
+
return EXIT.OK;
|
|
155
|
+
}
|
|
156
|
+
if (plan.upToDate) {
|
|
157
|
+
if (needsIndexRefreshOnly(plan)) {
|
|
158
|
+
const r = await applySync(root, plan);
|
|
159
|
+
if (isJson()) json({ ...summarizePlan(plan), applied: r });
|
|
160
|
+
else info(dim("File index refreshed."));
|
|
161
|
+
} else if (isJson()) json(summarizePlan(plan));
|
|
162
|
+
return EXIT.OK;
|
|
163
|
+
}
|
|
164
|
+
let approved = Boolean(opts.yes);
|
|
165
|
+
if (!approved) {
|
|
166
|
+
if (!process.stdin.isTTY) {
|
|
167
|
+
if (isJson()) json(summarizePlan(plan));
|
|
168
|
+
else line(c.yellow("Not applied: confirmation required. Re-run with --yes to apply, or --diff to inspect changes."));
|
|
169
|
+
return EXIT.OK;
|
|
170
|
+
}
|
|
171
|
+
approved = await confirm(`Apply updates to ${plan.documents.length} document${plan.documents.length === 1 ? "" : "s"}?`);
|
|
172
|
+
}
|
|
173
|
+
if (!approved) {
|
|
174
|
+
line("Not applied.");
|
|
175
|
+
return EXIT.OK;
|
|
176
|
+
}
|
|
177
|
+
const result = await applySync(root, plan);
|
|
178
|
+
if (isJson()) json({ ...summarizePlan(plan), applied: result });
|
|
179
|
+
else {
|
|
180
|
+
ok(`Updated ${result.applied.join(", ")}`);
|
|
181
|
+
for (const p of result.preserved) warn(`${p.file}: kept your edits in ${p.sections.join(", ")} ${dim("(use `athena analyze --force` to regenerate)")}`);
|
|
182
|
+
}
|
|
183
|
+
return EXIT.OK;
|
|
184
|
+
}
|
|
185
|
+
async function stagedCheckCommand(root, opts) {
|
|
186
|
+
const { checkStaged } = await import("./staged-check-X24C3YRD.js");
|
|
187
|
+
const sp = spinner("Checking staged knowledge...");
|
|
188
|
+
let r;
|
|
189
|
+
try {
|
|
190
|
+
r = await checkStaged(root, { signal: opts.signal });
|
|
191
|
+
} finally {
|
|
192
|
+
sp.stop();
|
|
193
|
+
}
|
|
194
|
+
if (isJson()) {
|
|
195
|
+
json({ staged: true, inSync: r.inSync, stale: r.stale.map((d) => d.file), documents: r.stale, files: r.files, fromIndex: r.fromIndex, durationMs: r.durationMs });
|
|
196
|
+
return r.inSync ? EXIT.OK : 1;
|
|
197
|
+
}
|
|
198
|
+
if (r.inSync) {
|
|
199
|
+
if (!isQuiet()) ok(`Staged knowledge matches the staged code ${dim(`(${r.files} files in the index)`)}`);
|
|
200
|
+
return EXIT.OK;
|
|
201
|
+
}
|
|
202
|
+
if (!isQuiet()) heading("Staged knowledge to update");
|
|
203
|
+
const width = Math.max(...r.stale.map((d) => d.file.length));
|
|
204
|
+
for (const d of r.stale) {
|
|
205
|
+
const what = d.status === "missing" ? "not staged" : d.changedSections.join(", ");
|
|
206
|
+
line(` ${c.yellow("~")} ${d.file.padEnd(width)} ${dim(what)}${d.syncedButUnstaged ? dim(" (up to date in the working tree: stage it)") : ""}`);
|
|
207
|
+
}
|
|
208
|
+
const files = r.stale.map((d) => `.athena/${d.file}`).join(" ");
|
|
209
|
+
if (r.stale.every((d) => d.syncedButUnstaged)) line(c.yellow(`Staged knowledge is out of date; the working tree is already synced. Run \`git add ${files}\`.`));
|
|
210
|
+
else line(c.yellow("Staged knowledge is out of date for the staged code. Run `athena sync`, then stage .athena/."));
|
|
211
|
+
return 1;
|
|
212
|
+
}
|
|
213
|
+
export {
|
|
214
|
+
colorDiff,
|
|
215
|
+
printPlan,
|
|
216
|
+
syncCommand
|
|
217
|
+
};
|
|
218
|
+
//# sourceMappingURL=sync-KFJANRXF.js.map
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import {
|
|
3
|
+
watchProject
|
|
4
|
+
} from "./chunk-DZDI2HRT.js";
|
|
5
|
+
import "./chunk-RVTNSNGK.js";
|
|
6
|
+
import {
|
|
7
|
+
c,
|
|
8
|
+
dim,
|
|
9
|
+
isJson,
|
|
10
|
+
line,
|
|
11
|
+
setInterruptMessage,
|
|
12
|
+
sym
|
|
13
|
+
} from "./chunk-Z6QWMJLK.js";
|
|
14
|
+
import {
|
|
15
|
+
requireProjectRoot
|
|
16
|
+
} from "./chunk-XFN7UZCS.js";
|
|
17
|
+
import "./chunk-KBO7XRBW.js";
|
|
18
|
+
import "./chunk-KHMBNT66.js";
|
|
19
|
+
import "./chunk-WVQC2EGO.js";
|
|
20
|
+
import "./chunk-GR4DL2VM.js";
|
|
21
|
+
import "./chunk-GGXPG6OE.js";
|
|
22
|
+
import "./chunk-MPG3IEGB.js";
|
|
23
|
+
import "./chunk-ELKFRTZT.js";
|
|
24
|
+
import "./chunk-2R6PXY6Z.js";
|
|
25
|
+
import "./chunk-PVCIGUIT.js";
|
|
26
|
+
import "./chunk-OLPSEQS5.js";
|
|
27
|
+
import "./chunk-SVTEJYMS.js";
|
|
28
|
+
import "./chunk-QCC4VJUH.js";
|
|
29
|
+
import "./chunk-JCGDR4UV.js";
|
|
30
|
+
import "./chunk-YRIS7ZS6.js";
|
|
31
|
+
import "./chunk-GHFRQAYT.js";
|
|
32
|
+
import "./chunk-INT3IGMQ.js";
|
|
33
|
+
import "./chunk-673EPYYH.js";
|
|
34
|
+
import "./chunk-FQEGEVLY.js";
|
|
35
|
+
import "./chunk-2DY4PUR4.js";
|
|
36
|
+
import "./chunk-IQQBAWSM.js";
|
|
37
|
+
import {
|
|
38
|
+
AthenaError
|
|
39
|
+
} from "./chunk-AD4OZCU2.js";
|
|
40
|
+
import "./chunk-XW3MLHI2.js";
|
|
41
|
+
import "./chunk-EUPETUWA.js";
|
|
42
|
+
|
|
43
|
+
// src/cli/commands/watch.ts
|
|
44
|
+
var time = () => (/* @__PURE__ */ new Date()).toLocaleTimeString([], { hour: "2-digit", minute: "2-digit", second: "2-digit", hour12: false });
|
|
45
|
+
async function watchCommand(opts) {
|
|
46
|
+
const root = await requireProjectRoot(opts);
|
|
47
|
+
let debounceMs;
|
|
48
|
+
if (opts.debounce !== void 0) {
|
|
49
|
+
debounceMs = Number(opts.debounce);
|
|
50
|
+
if (!Number.isInteger(debounceMs) || debounceMs < 100 || debounceMs > 6e4) throw new AthenaError("--debounce must be between 100 and 60000 ms");
|
|
51
|
+
}
|
|
52
|
+
const burst = /* @__PURE__ */ new Set();
|
|
53
|
+
const log = (line2) => {
|
|
54
|
+
if (isJson()) return;
|
|
55
|
+
line(`${dim(time())} ${line2}`);
|
|
56
|
+
};
|
|
57
|
+
const onEvent = (e) => {
|
|
58
|
+
if (isJson()) {
|
|
59
|
+
const { plan, error, ...rest } = e;
|
|
60
|
+
if (e.type !== "changes") process.stdout.write(`${JSON.stringify({ ...rest, ts: (/* @__PURE__ */ new Date()).toISOString(), ...plan ? { planId: plan.id, upToDate: plan.upToDate, documents: plan.documents.map((d) => ({ file: d.file, reasons: d.reasons })) } : {}, ...error ? { error: error.message } : {} })}
|
|
61
|
+
`);
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
switch (e.type) {
|
|
65
|
+
case "changes":
|
|
66
|
+
for (const p of e.paths ?? []) burst.add(p);
|
|
67
|
+
break;
|
|
68
|
+
case "git-head":
|
|
69
|
+
log(`${c.cyan("git")} HEAD moved ${dim(`${e.head?.from?.slice(0, 8) ?? "?"} \u2192 ${e.head?.to?.slice(0, 8) ?? "?"}`)}`);
|
|
70
|
+
break;
|
|
71
|
+
case "planning": {
|
|
72
|
+
const n = burst.size;
|
|
73
|
+
if (n) log(`${n} file${n === 1 ? "" : "s"} changed ${dim(`(${[...burst].slice(0, 3).join(", ")}${n > 3 ? ", \u2026" : ""})`)} \u2014 checking knowledge\u2026`);
|
|
74
|
+
burst.clear();
|
|
75
|
+
break;
|
|
76
|
+
}
|
|
77
|
+
case "refreshed":
|
|
78
|
+
log(`${c.green(sym.ok)} Knowledge up to date ${dim("(index refreshed)")}`);
|
|
79
|
+
break;
|
|
80
|
+
case "plan": {
|
|
81
|
+
const plan = e.plan;
|
|
82
|
+
if (plan.upToDate) {
|
|
83
|
+
log(`${c.green(sym.ok)} Knowledge up to date`);
|
|
84
|
+
break;
|
|
85
|
+
}
|
|
86
|
+
if (plan.ignored) {
|
|
87
|
+
log(dim(`Proposal unchanged since you ignored it (${plan.documents.map((d) => d.file).join(", ")})`));
|
|
88
|
+
break;
|
|
89
|
+
}
|
|
90
|
+
log(`${c.yellow(sym.dot)} Update proposed for ${c.bold(plan.documents.map((d) => d.file).join(", "))}`);
|
|
91
|
+
for (const d of plan.documents) log(` ${dim(`${d.file}: ${d.reasons[0] ?? ""}`)}`);
|
|
92
|
+
log(dim(" Review and apply with `athena sync` (or in the web UI)."));
|
|
93
|
+
break;
|
|
94
|
+
}
|
|
95
|
+
case "applied":
|
|
96
|
+
log(`${c.green(sym.ok)} Applied ${e.result?.applied.join(", ")} ${dim("(auto-apply)")}`);
|
|
97
|
+
for (const p of e.result?.preserved ?? []) log(` ${c.yellow(sym.warn)} ${p.file}: kept your edits in ${p.sections.join(", ")}`);
|
|
98
|
+
break;
|
|
99
|
+
case "error":
|
|
100
|
+
log(`${c.red(sym.err)} ${e.error?.message ?? "Watcher error"}`);
|
|
101
|
+
break;
|
|
102
|
+
default:
|
|
103
|
+
break;
|
|
104
|
+
}
|
|
105
|
+
};
|
|
106
|
+
const watcher = await watchProject(root, { autoApply: opts.autoApply, debounceMs, onEvent, signal: opts.signal });
|
|
107
|
+
setInterruptMessage("Stopped watching.");
|
|
108
|
+
if (!isJson()) {
|
|
109
|
+
line(`${c.bold("Athena is watching")} ${dim(root)}`);
|
|
110
|
+
line(opts.autoApply ? c.yellow("Auto-apply is ON: knowledge updates are written automatically (your edited sections are still preserved).") : dim("Proposals only \u2014 no knowledge document is changed without your review. Press Ctrl+C to stop."));
|
|
111
|
+
line();
|
|
112
|
+
}
|
|
113
|
+
await watcher.planNow();
|
|
114
|
+
await new Promise((resolve) => {
|
|
115
|
+
if (opts.signal.aborted) resolve();
|
|
116
|
+
opts.signal.addEventListener("abort", () => resolve(), { once: true });
|
|
117
|
+
});
|
|
118
|
+
await watcher.close();
|
|
119
|
+
}
|
|
120
|
+
export {
|
|
121
|
+
watchCommand
|
|
122
|
+
};
|
|
123
|
+
//# sourceMappingURL=watch-CY7QHIYN.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{i as e,r as t}from"./index-
|
|
1
|
+
import{i as e,r as t}from"./index-Cen0jOXj.js";var n=e(),r=[],i=[];(()=>{let e=`lc,34,7n,7,7b,19,,,,2,,2,,,20,b,1c,l,g,,2t,7,2,6,2,2,,4,z,,u,r,2j,b,1m,9,9,,o,4,,9,,3,,5,17,3,1n,9,16,o,,x,1i,3,,i,,7,a,2,t,3,1k,,,7,2,2,2,3,9,,a,2,q,,2,3,1k,,,5,4,2,2,3,3,,u,2,3,,b,3,1k,,,8,,3,,3,k,2,m,6,,3,1k,,,7,2,2,2,3,7,3,a,2,u,,1n,5,3,3,,4,9,,14,5,1j,,,7,,3,,4,7,2,b,2,t,3,1k,,,7,,3,,4,7,2,b,2,f,,c,4,1j,2,,7,,3,,4,9,,a,2,t,3,1y,,4,6,,,,8,i,2,1p,,,8,c,8,2q,,,a,b,7,21,2,r,,,,,,4,2,1d,k,,2,5,b,,10,9,,2u,b,,6,n,4,4,3,g,4,d,,,3,6,,f,,jj,3,qa,4,s,3,t,2,u,2,1s,w,9,,19,3,,,39,2,y,,3a,c,4,c,63,5,1l,a,,,,,2,o,2,,1c,1a,2,c,k,5,1b,h,12,9,c,3,u,d,1k,e,1c,k,48,3,,l,4,,6,,2,3,5i,1s,ek,,5f,x,2da,3,3x,,2o,w,fe,6,2x,2,n9w,4,,a,w,2,28,2,7k,,3,,4,,n,5,4,,2b,2,1e,i,q,i,d,,12,8,p,d,18,4,1b,e,10,,1v,e,c,,8,2,1a,,1f,,,3,2,2,5,2,,,15,5,5,2,6k,8,,2,fn4,,kh,g,g,g,a6,2,gt,,6a,,45,5,1ae,3,,2,5,4,14,3,4,,4l,2,fx,4,1t,5,8t,2,25,6,1y,b,1d,4,3e,3,1h,f,15,,2,2,a,4,19,b,7,,1p,3,10,e,g,2,18,,c,3,1c,e,8,4,,2,2k,c,6,,2,,4d,c,l,4,1j,2,,7,2,2,2,3,9,,a,2,2,7,3,5,1v,9,,,2,,,4,,5,,,e,2,2a,i,n,,29,k,6j,7,2,9,r,2,2a,h,2y,d,2t,3,2,a,74,f,6t,6,,2,2,4,,,,2,3x,7,2,7,3,,s,a,14,7,,4,8,,9,b,1a,g,5i,8,5j,8,,8,2a,m,,e,3e,6,3,,,2,,7,,,1u,5,,2,,5,9n,4,9,2,,,1c,7,3,5,n,,44l,,6,f,8ug,i,1xc,5,1n,7,t4,,,1j,7,4,29,,b,2,f57,2,3mp,1a,2,n,f2,5,3,6,8,8,2,7,u,4,44,3,1iz,1j,4,1e,8,,e,,m,5,,f,11s,7,,h,2,7,,2,,5,2s,,4g,7,af,,1p,4,e4,4,72,2,6r,,2,,7,2,5,,d6,7,31,7,240,5`.split(`,`).map(e=>e?parseInt(e,36):1);for(let t=0,n=0;t<e.length;t++)(t%2?i:r).push(n+=e[t])})();function a(e){if(e<768)return!1;for(let t=0,n=r.length;;){let a=t+n>>1;if(e<r[a])n=a;else if(e>=i[a])t=a+1;else return!0;if(t==n)return!1}}function o(e){return e>=127462&&e<=127487}var s=8205;function c(e,t,n=!0,r=!0){return(n?l:u)(e,t,r)}function l(e,t,n){if(t==e.length)return t;t&&f(e.charCodeAt(t))&&p(e.charCodeAt(t-1))&&t--;let r=d(e,t);for(t+=m(r);t<e.length;){let i=d(e,t);if(r==s||i==s||n&&a(i))t+=m(i),r=i;else if(o(i)){let n=0,r=t-2;for(;r>=0&&o(d(e,r));)n++,r-=2;if(n%2==0)break;t+=2}else break}return t}function u(e,t,n){for(;t>1;){let r=l(e,t-2,n);if(r<t)return r;t--}return 0}function d(e,t){let n=e.charCodeAt(t);if(!p(n)||t+1==e.length)return n;let r=e.charCodeAt(t+1);return f(r)?(n-55296<<10)+(r-56320)+65536:n}function f(e){return e>=56320&&e<57344}function p(e){return e>=55296&&e<56320}function m(e){return e<65536?1:2}var h=class e{lineAt(e){if(e<0||e>this.length)throw RangeError(`Invalid position ${e} in document of length ${this.length}`);return this.lineInner(e,!1,1,0)}line(e){if(e<1||e>this.lines)throw RangeError(`Invalid line number ${e} in ${this.lines}-line document`);return this.lineInner(e,!0,1,0)}replace(e,t,n){[e,t]=ie(this,e,t);let r=[];return this.decompose(0,e,r,2),n.length&&n.decompose(0,n.length,r,3),this.decompose(t,this.length,r,1),_.from(r,this.length-(t-e)+n.length)}append(e){return this.replace(this.length,this.length,e)}slice(e,t=this.length){[e,t]=ie(this,e,t);let n=[];return this.decompose(e,t,n,0),_.from(n,t-e)}eq(e){if(e==this)return!0;if(e.length!=this.length||e.lines!=this.lines)return!1;let t=this.scanIdentical(e,1),n=this.length-this.scanIdentical(e,-1),r=new b(this),i=new b(e);for(let e=t,a=t;;){if(r.next(e),i.next(e),e=0,r.lineBreak!=i.lineBreak||r.done!=i.done||r.value!=i.value)return!1;if(a+=r.value.length,r.done||a>=n)return!0}}iter(e=1){return new b(this,e)}iterRange(e,t=this.length){return new te(this,e,t)}iterLines(e,t){let n;if(e==null)n=this.iter();else{t??=this.lines+1;let r=this.line(e).from;n=this.iterRange(r,Math.max(r,t==this.lines+1?this.length:t<=1?0:this.line(t-1).to))}return new ne(n)}toString(){return this.sliceString(0)}toJSON(){let e=[];return this.flatten(e),e}constructor(){}static of(t){if(t.length==0)throw RangeError(`A document must have at least one line`);return t.length==1&&!t[0]?e.empty:t.length<=32?new g(t):_.from(g.split(t,[]))}},g=class e extends h{constructor(e,t=v(e)){super(),this.text=e,this.length=t}get lines(){return this.text.length}get children(){return null}lineInner(e,t,n,r){for(let i=0;;i++){let a=this.text[i],o=r+a.length;if((t?n:o)>=e)return new re(r,o,n,a);r=o+1,n++}}decompose(t,n,r,i){let a=t<=0&&n>=this.length?this:new e(ee(this.text,t,n),Math.min(n,this.length)-Math.max(0,t));if(i&1){let t=r.pop(),n=y(a.text,t.text.slice(),0,a.length);if(n.length<=32)r.push(new e(n,t.length+a.length));else{let t=n.length>>1;r.push(new e(n.slice(0,t)),new e(n.slice(t)))}}else r.push(a)}replace(t,n,r){if(!(r instanceof e))return super.replace(t,n,r);[t,n]=ie(this,t,n);let i=y(this.text,y(r.text,ee(this.text,0,t)),n),a=this.length+r.length-(n-t);return i.length<=32?new e(i,a):_.from(e.split(i,[]),a)}sliceString(e,t=this.length,n=`
|
|
2
2
|
`){[e,t]=ie(this,e,t);let r=``;for(let i=0,a=0;i<=t&&a<this.text.length;a++){let o=this.text[a],s=i+o.length;i>e&&a&&(r+=n),e<s&&t>i&&(r+=o.slice(Math.max(0,e-i),t-i)),i=s+1}return r}flatten(e){for(let t of this.text)e.push(t)}scanIdentical(){return 0}static split(t,n){let r=[],i=-1;for(let a of t)r.push(a),i+=a.length+1,r.length==32&&(n.push(new e(r,i)),r=[],i=-1);return i>-1&&n.push(new e(r,i)),n}},_=class e extends h{constructor(e,t){super(),this.children=e,this.length=t,this.lines=0;for(let t of e)this.lines+=t.lines}lineInner(e,t,n,r){for(let i=0;;i++){let a=this.children[i],o=r+a.length,s=n+a.lines-1;if((t?s:o)>=e)return a.lineInner(e,t,n,r);r=o+1,n=s+1}}decompose(e,t,n,r){for(let i=0,a=0;a<=t&&i<this.children.length;i++){let o=this.children[i],s=a+o.length;if(e<=s&&t>=a){let i=r&(a<=e|(s>=t?2:0));a>=e&&s<=t&&!i?n.push(o):o.decompose(e-a,t-a,n,i)}a=s+1}}replace(t,n,r){if([t,n]=ie(this,t,n),r.lines<this.lines)for(let i=0,a=0;i<this.children.length;i++){let o=this.children[i],s=a+o.length;if(t>=a&&n<=s){let c=o.replace(t-a,n-a,r),l=this.lines-o.lines+c.lines;if(c.lines<l>>4&&c.lines>l>>6){let a=this.children.slice();return a[i]=c,new e(a,this.length-(n-t)+r.length)}return super.replace(a,s,c)}a=s+1}return super.replace(t,n,r)}sliceString(e,t=this.length,n=`
|
|
3
3
|
`){[e,t]=ie(this,e,t);let r=``;for(let i=0,a=0;i<this.children.length&&a<=t;i++){let o=this.children[i],s=a+o.length;a>e&&i&&(r+=n),e<s&&t>a&&(r+=o.sliceString(e-a,t-a,n)),a=s+1}return r}flatten(e){for(let t of this.children)t.flatten(e)}scanIdentical(t,n){if(!(t instanceof e))return 0;let r=0,[i,a,o,s]=n>0?[0,0,this.children.length,t.children.length]:[this.children.length-1,t.children.length-1,-1,-1];for(;;i+=n,a+=n){if(i==o||a==s)return r;let e=this.children[i],c=t.children[a];if(e!=c)return r+e.scanIdentical(c,n);r+=e.length+1}}static from(t,n=t.reduce((e,t)=>e+t.length+1,-1)){let r=0;for(let e of t)r+=e.lines;if(r<32){let e=[];for(let n of t)n.flatten(e);return new g(e,n)}let i=Math.max(32,r>>5),a=i<<1,o=i>>1,s=[],c=0,l=-1,u=[];function d(t){let n;if(t.lines>a&&t instanceof e)for(let e of t.children)d(e);else t.lines>o&&(c>o||!c)?(f(),s.push(t)):t instanceof g&&c&&(n=u[u.length-1])instanceof g&&t.lines+n.lines<=32?(c+=t.lines,l+=t.length+1,u[u.length-1]=new g(n.text.concat(t.text),n.length+1+t.length)):(c+t.lines>i&&f(),c+=t.lines,l+=t.length+1,u.push(t))}function f(){c!=0&&(s.push(u.length==1?u[0]:e.from(u,l)),l=-1,c=u.length=0)}for(let e of t)d(e);return f(),s.length==1?s[0]:new e(s,n)}};h.empty=new g([``],0);function v(e){let t=-1;for(let n of e)t+=n.length+1;return t}function y(e,t,n=0,r=1e9){for(let i=0,a=0,o=!0;a<e.length&&i<=r;a++){let s=e[a],c=i+s.length;c>=n&&(c>r&&(s=s.slice(0,r-i)),i<n&&(s=s.slice(n-i)),o?(t[t.length-1]+=s,o=!1):t.push(s)),i=c+1}return t}function ee(e,t,n){return y(e,[``],t,n)}var b=class{constructor(e,t=1){this.dir=t,this.done=!1,this.lineBreak=!1,this.value=``,this.nodes=[e],this.offsets=[t>0?1:(e instanceof g?e.text.length:e.children.length)<<1]}nextInner(e,t){for(this.done=this.lineBreak=!1;;){let n=this.nodes.length-1,r=this.nodes[n],i=this.offsets[n],a=i>>1,o=r instanceof g?r.text.length:r.children.length;if(a==(t>0?o:0)){if(n==0)return this.done=!0,this.value=``,this;t>0&&this.offsets[n-1]++,this.nodes.pop(),this.offsets.pop()}else if((i&1)==(t>0?0:1)){if(this.offsets[n]+=t,e==0)return this.lineBreak=!0,this.value=`
|
|
4
4
|
`,this;e--}else if(r instanceof g){let i=r.text[a+(t<0?-1:0)];if(this.offsets[n]+=t,i.length>Math.max(0,e))return this.value=e==0?i:t>0?i.slice(e):i.slice(0,i.length-e),this;e-=i.length}else{let i=r.children[a+(t<0?-1:0)];e>i.length?(e-=i.length,this.offsets[n]+=t):(t<0&&this.offsets[n]--,this.nodes.push(i),this.offsets.push(t>0?1:(i instanceof g?i.text.length:i.children.length)<<1))}}}next(e=0){return e<0&&(this.nextInner(-e,-this.dir),e=this.value.length),this.nextInner(e,this.dir)}},te=class{constructor(e,t,n){this.value=``,this.done=!1,this.cursor=new b(e,t>n?-1:1),this.pos=t>n?e.length:0,this.from=Math.min(t,n),this.to=Math.max(t,n)}nextInner(e,t){if(t<0?this.pos<=this.from:this.pos>=this.to)return this.value=``,this.done=!0,this;e+=Math.max(0,t<0?this.pos-this.to:this.from-this.pos);let n=t<0?this.pos-this.from:this.to-this.pos;e>n&&(e=n),n-=e;let{value:r}=this.cursor.next(e);return this.pos+=(r.length+e)*t,this.value=r.length<=n?r:t<0?r.slice(r.length-n):r.slice(0,n),this.done=!this.value,this}next(e=0){return e<0?e=Math.max(e,this.from-this.pos):e>0&&(e=Math.min(e,this.to-this.pos)),this.nextInner(e,this.cursor.dir)}get lineBreak(){return this.cursor.lineBreak&&this.value!=``}},ne=class{constructor(e){this.inner=e,this.afterBreak=!0,this.value=``,this.done=!1}next(e=0){let{done:t,lineBreak:n,value:r}=this.inner.next(e);return t&&this.afterBreak?(this.value=``,this.afterBreak=!1):t?(this.done=!0,this.value=``):n?this.afterBreak?this.value=``:(this.afterBreak=!0,this.next()):(this.value=r,this.afterBreak=!1),this}get lineBreak(){return!1}};typeof Symbol<`u`&&(h.prototype[Symbol.iterator]=function(){return this.iter()},b.prototype[Symbol.iterator]=te.prototype[Symbol.iterator]=ne.prototype[Symbol.iterator]=function(){return this});var re=class{constructor(e,t,n,r){this.from=e,this.to=t,this.number=n,this.text=r}get length(){return this.to-this.from}};function ie(e,t,n){return t=Math.max(0,Math.min(e.length,t)),[t,Math.max(t,Math.min(e.length,n))]}function x(e,t,n=!0,r=!0){return c(e,t,n,r)}function ae(e){return e>=56320&&e<57344}function oe(e){return e>=55296&&e<56320}function S(e,t){let n=e.charCodeAt(t);if(!oe(n)||t+1==e.length)return n;let r=e.charCodeAt(t+1);return ae(r)?(n-55296<<10)+(r-56320)+65536:n}function se(e){return e<=65535?String.fromCharCode(e):(e-=65536,String.fromCharCode((e>>10)+55296,(e&1023)+56320))}function ce(e){return e<65536?1:2}var le=/\r\n?|\n/,C=(function(e){return e[e.Simple=0]=`Simple`,e[e.TrackDel=1]=`TrackDel`,e[e.TrackBefore=2]=`TrackBefore`,e[e.TrackAfter=3]=`TrackAfter`,e})(C||={}),ue=class e{constructor(e){this.sections=e}get length(){let e=0;for(let t=0;t<this.sections.length;t+=2)e+=this.sections[t];return e}get newLength(){let e=0;for(let t=0;t<this.sections.length;t+=2){let n=this.sections[t+1];e+=n<0?this.sections[t]:n}return e}get empty(){return this.sections.length==0||this.sections.length==2&&this.sections[1]<0}iterGaps(e){for(let t=0,n=0,r=0;t<this.sections.length;){let i=this.sections[t++],a=this.sections[t++];a<0?(e(n,r,i),r+=i):r+=a,n+=i}}iterChangedRanges(e,t=!1){pe(this,e,t)}get invertedDesc(){let t=[];for(let e=0;e<this.sections.length;){let n=this.sections[e++],r=this.sections[e++];r<0?t.push(n,r):t.push(r,n)}return new e(t)}composeDesc(e){return this.empty?e:e.empty?this:he(this,e)}mapDesc(e,t=!1){return e.empty?this:me(this,e,t)}mapPos(e,t=-1,n=C.Simple){let r=0,i=0;for(let a=0;a<this.sections.length;){let o=this.sections[a++],s=this.sections[a++],c=r+o;if(s<0){if(c>e)return i+(e-r);i+=o}else{if(n!=C.Simple&&c>=e&&(n==C.TrackDel&&r<e&&c>e||n==C.TrackBefore&&r<e||n==C.TrackAfter&&c>e))return null;if(c>e||c==e&&t<0&&!o)return e==r||t<0?i:i+s;i+=s}r=c}if(e>r)throw RangeError(`Position ${e} is out of range for changeset of length ${r}`);return i}touchesRange(e,t=e){for(let n=0,r=0;n<this.sections.length&&r<=t;){let i=this.sections[n++],a=this.sections[n++],o=r+i;if(a>=0&&r<=t&&o>=e)return r<e&&o>t?`cover`:!0;r=o}return!1}toString(){let e=``;for(let t=0;t<this.sections.length;){let n=this.sections[t++],r=this.sections[t++];e+=(e?` `:``)+n+(r>=0?`:`+r:``)}return e}toJSON(){return this.sections}static fromJSON(t){if(!Array.isArray(t)||t.length%2||t.some(e=>typeof e!=`number`))throw RangeError(`Invalid JSON representation of ChangeDesc`);return new e(t)}static create(t){return new e(t)}},de=class e extends ue{constructor(e,t){super(e),this.inserted=t}apply(e){if(this.length!=e.length)throw RangeError(`Applying change set to a document with the wrong length`);return pe(this,(t,n,r,i,a)=>e=e.replace(r,r+(n-t),a),!1),e}mapDesc(e,t=!1){return me(this,e,t,!0)}invert(t){let n=this.sections.slice(),r=[];for(let e=0,i=0;e<n.length;e+=2){let a=n[e],o=n[e+1];if(o>=0){n[e]=o,n[e+1]=a;let s=e>>1;for(;r.length<s;)r.push(h.empty);r.push(a?t.slice(i,i+a):h.empty)}i+=a}return new e(n,r)}compose(e){return this.empty?e:e.empty?this:he(this,e,!0)}map(e,t=!1){return e.empty?this:me(this,e,t,!0)}iterChanges(e,t=!1){pe(this,e,t)}get desc(){return ue.create(this.sections)}filter(t){let n=[],r=[],i=[],a=new ge(this);done:for(let e=0,o=0;;){let s=e==t.length?1e9:t[e++];for(;o<s||o==s&&a.len==0;){if(a.done)break done;let e=Math.min(a.len,s-o);w(i,e,-1);let t=a.ins==-1?-1:a.off==0?a.ins:0;w(n,e,t),t>0&&fe(r,n,a.text),a.forward(e),o+=e}let c=t[e++];for(;o<c;){if(a.done)break done;let e=Math.min(a.len,c-o);w(n,e,-1),w(i,e,a.ins==-1?-1:a.off==0?a.ins:0),a.forward(e),o+=e}}return{changes:new e(n,r),filtered:ue.create(i)}}toJSON(){let e=[];for(let t=0;t<this.sections.length;t+=2){let n=this.sections[t],r=this.sections[t+1];r<0?e.push(n):r==0?e.push([n]):e.push([n].concat(this.inserted[t>>1].toJSON()))}return e}static of(t,n,r){let i=[],a=[],o=0,s=null;function c(t=!1){if(!t&&!i.length)return;o<n&&w(i,n-o,-1);let r=new e(i,a);s=s?s.compose(r.map(s)):r,i=[],a=[],o=0}function l(t){if(Array.isArray(t))for(let e of t)l(e);else if(t instanceof e){if(t.length!=n)throw RangeError(`Mismatched change set length (got ${t.length}, expected ${n})`);c(),s=s?s.compose(t.map(s)):t}else{let{from:e,to:s=e,insert:l}=t;if(e>s||e<0||s>n)throw RangeError(`Invalid change range ${e} to ${s} (in doc of length ${n})`);let u=l?typeof l==`string`?h.of(l.split(r||le)):l:h.empty,d=u.length;if(e==s&&d==0)return;e<o&&c(),e>o&&w(i,e-o,-1),w(i,s-e,d),fe(a,i,u),o=s}}return l(t),c(!s),s}static empty(t){return new e(t?[t,-1]:[],[])}static fromJSON(t){if(!Array.isArray(t))throw RangeError(`Invalid JSON representation of ChangeSet`);let n=[],r=[];for(let e=0;e<t.length;e++){let i=t[e];if(typeof i==`number`)n.push(i,-1);else if(!Array.isArray(i)||typeof i[0]!=`number`||i.some((e,t)=>t&&typeof e!=`string`))throw RangeError(`Invalid JSON representation of ChangeSet`);else if(i.length==1)n.push(i[0],0);else{for(;r.length<e;)r.push(h.empty);r[e]=h.of(i.slice(1)),n.push(i[0],r[e].length)}}return new e(n,r)}static createSet(t,n){return new e(t,n)}};function w(e,t,n,r=!1){if(t==0&&n<=0)return;let i=e.length-2;i>=0&&n<=0&&n==e[i+1]?e[i]+=t:i>=0&&t==0&&e[i]==0?e[i+1]+=n:r?(e[i]+=t,e[i+1]+=n):e.push(t,n)}function fe(e,t,n){if(n.length==0)return;let r=t.length-2>>1;if(r<e.length)e[e.length-1]=e[e.length-1].append(n);else{for(;e.length<r;)e.push(h.empty);e.push(n)}}function pe(e,t,n){let r=e.inserted;for(let i=0,a=0,o=0;o<e.sections.length;){let s=e.sections[o++],c=e.sections[o++];if(c<0)i+=s,a+=s;else{let l=i,u=a,d=h.empty;for(;l+=s,u+=c,c&&r&&(d=d.append(r[o-2>>1])),!(n||o==e.sections.length||e.sections[o+1]<0);)s=e.sections[o++],c=e.sections[o++];t(i,l,a,u,d),i=l,a=u}}}function me(e,t,n,r=!1){let i=[],a=r?[]:null,o=new ge(e),s=new ge(t);for(let e=-1;;)if(o.done&&s.len||s.done&&o.len)throw Error(`Mismatched change set lengths`);else if(o.ins==-1&&s.ins==-1){let e=Math.min(o.len,s.len);w(i,e,-1),o.forward(e),s.forward(e)}else if(s.ins>=0&&(o.ins<0||e==o.i||o.off==0&&(s.len<o.len||s.len==o.len&&!n))){let t=s.len;for(w(i,s.ins,-1);t;){let n=Math.min(o.len,t);o.ins>=0&&e<o.i&&o.len<=n&&(w(i,0,o.ins),a&&fe(a,i,o.text),e=o.i),o.forward(n),t-=n}s.next()}else if(o.ins>=0){let t=0,n=o.len;for(;n;)if(s.ins==-1){let e=Math.min(n,s.len);t+=e,n-=e,s.forward(e)}else if(s.ins==0&&s.len<n)n-=s.len,s.next();else break;w(i,t,e<o.i?o.ins:0),a&&e<o.i&&fe(a,i,o.text),e=o.i,o.forward(o.len-n)}else if(o.done&&s.done)return a?de.createSet(i,a):ue.create(i);else throw Error(`Mismatched change set lengths`)}function he(e,t,n=!1){let r=[],i=n?[]:null,a=new ge(e),o=new ge(t);for(let e=!1;;)if(a.done&&o.done)return i?de.createSet(r,i):ue.create(r);else if(a.ins==0)w(r,a.len,0,e),a.next();else if(o.len==0&&!o.done)w(r,0,o.ins,e),i&&fe(i,r,o.text),o.next();else if(a.done||o.done)throw Error(`Mismatched change set lengths`);else{let t=Math.min(a.len2,o.len),n=r.length;if(a.ins==-1){let n=o.ins==-1?-1:o.off?0:o.ins;w(r,t,n,e),i&&n&&fe(i,r,o.text)}else o.ins==-1?(w(r,a.off?0:a.len,t,e),i&&fe(i,r,a.textBit(t))):(w(r,a.off?0:a.len,o.off?0:o.ins,e),i&&!o.off&&fe(i,r,o.text));e=(a.ins>t||o.ins>=0&&o.len>t)&&(e||r.length>n),a.forward2(t),o.forward(t)}}var ge=class{constructor(e){this.set=e,this.i=0,this.next()}next(){let{sections:e}=this.set;this.i<e.length?(this.len=e[this.i++],this.ins=e[this.i++]):(this.len=0,this.ins=-2),this.off=0}get done(){return this.ins==-2}get len2(){return this.ins<0?this.len:this.ins}get text(){let{inserted:e}=this.set,t=this.i-2>>1;return t>=e.length?h.empty:e[t]}textBit(e){let{inserted:t}=this.set,n=this.i-2>>1;return n>=t.length&&!e?h.empty:t[n].slice(this.off,e==null?void 0:this.off+e)}forward(e){e==this.len?this.next():(this.len-=e,this.off+=e)}forward2(e){this.ins==-1?this.forward(e):e==this.ins?this.next():(this.ins-=e,this.off+=e)}},_e=class e{constructor(e,t,n,r){this.from=e,this.to=t,this.flags=n,this.goalColumn=r}get anchor(){return this.flags&32?this.to:this.from}get head(){return this.flags&32?this.from:this.to}get empty(){return this.from==this.to}get assoc(){return this.flags&8?-1:this.flags&16?1:0}get undirectional(){return(this.flags&64)>0}get bidiLevel(){let e=this.flags&7;return e==7?null:e}map(t,n=-1){let r,i;return this.empty?r=i=t.mapPos(this.from,n):(r=t.mapPos(this.from,1),i=t.mapPos(this.to,-1)),r==this.from&&i==this.to?this:new e(r,i,this.flags,this.goalColumn)}extend(e,t=e,n=0){if(e<=this.anchor&&t>=this.anchor)return T.range(e,t,void 0,void 0,n);let r=Math.abs(e-this.anchor)>Math.abs(t-this.anchor)?e:t;return T.range(this.anchor,r,void 0,void 0,n)}eq(e,t=!1){return this.anchor==e.anchor&&this.head==e.head&&this.goalColumn==e.goalColumn&&(!t||!this.empty||this.assoc==e.assoc)}toJSON(){return{anchor:this.anchor,head:this.head}}static fromJSON(e){if(!e||typeof e.anchor!=`number`||typeof e.head!=`number`)throw RangeError(`Invalid JSON representation for SelectionRange`);return T.range(e.anchor,e.head)}static create(t,n,r,i){return new e(t,n,r,i)}},T=class e{constructor(e,t){this.ranges=e,this.mainIndex=t}map(t,n=-1){return t.empty?this:e.create(this.ranges.map(e=>e.map(t,n)),this.mainIndex)}eq(e,t=!1){if(this.ranges.length!=e.ranges.length||this.mainIndex!=e.mainIndex)return!1;for(let n=0;n<this.ranges.length;n++)if(!this.ranges[n].eq(e.ranges[n],t))return!1;return!0}get main(){return this.ranges[this.mainIndex]}asSingle(){return this.ranges.length==1?this:new e([this.main],0)}addRange(t,n=!0){return e.create([t].concat(this.ranges),n?0:this.mainIndex+1)}replaceRange(t,n=this.mainIndex){let r=this.ranges.slice();return r[n]=t,e.create(r,this.mainIndex)}toJSON(){return{ranges:this.ranges.map(e=>e.toJSON()),main:this.mainIndex}}static fromJSON(t){if(!t||!Array.isArray(t.ranges)||typeof t.main!=`number`||t.main>=t.ranges.length)throw RangeError(`Invalid JSON representation for EditorSelection`);return new e(t.ranges.map(e=>_e.fromJSON(e)),t.main)}static single(t,n=t){return new e([e.range(t,n)],0)}static create(t,n=0){if(t.length==0)throw RangeError(`A selection needs at least one range`);for(let r=0,i=0;i<t.length;i++){let a=t[i];if(a.empty?a.from<=r:a.from<r)return e.normalized(t.slice(),n);r=a.to}return new e(t,n)}static cursor(e,t=0,n,r){return _e.create(e,e,(t==0?0:t<0?8:16)|(n==null?7:Math.min(6,n)),r)}static range(e,t,n,r,i){let a=r==null?7:Math.min(6,r);return!i&&e!=t&&(i=t<e?1:-1),i&&(a|=i<0?8:16),t<e?_e.create(t,e,a|32,n):_e.create(e,t,a,n)}static undirectionalRange(e,t){return _e.create(e,t,64,void 0)}static normalized(t,n=0){let r=t[n];t.sort((e,t)=>e.from-t.from),n=t.indexOf(r);for(let r=1;r<t.length;r++){let i=t[r],a=t[r-1];if(i.empty?i.from<=a.to:i.from<a.to){let o=a.from,s=Math.max(i.to,a.to);r<=n&&n--,t.splice(--r,2,i.anchor>i.head?e.range(s,o):e.range(o,s))}}return new e(t,n)}};function ve(e,t){for(let n of e.ranges)if(n.to>t)throw RangeError(`Selection points outside of document`)}var ye=0,E=class e{constructor(e,t,n,r,i){this.combine=e,this.compareInput=t,this.compare=n,this.isStatic=r,this.id=ye++,this.default=e([]),this.extensions=typeof i==`function`?i(this):i}get reader(){return this}static define(t={}){return new e(t.combine||(e=>e),t.compareInput||((e,t)=>e===t),t.compare||(t.combine?(e,t)=>e===t:be),!!t.static,t.enables)}of(e){return new xe([],this,0,e)}compute(e,t){if(this.isStatic)throw Error(`Can't compute a static facet`);return new xe(e,this,1,t)}computeN(e,t){if(this.isStatic)throw Error(`Can't compute a static facet`);return new xe(e,this,2,t)}from(e,t){return t||=e=>e,this.compute([e],n=>t(n.field(e)))}};function be(e,t){return e==t||e.length==t.length&&e.every((e,n)=>e===t[n])}var xe=class{constructor(e,t,n,r){this.dependencies=e,this.facet=t,this.type=n,this.value=r,this.id=ye++}dynamicSlot(e){let t=this.value,n=this.facet.compareInput,r=this.id,i=e[r]>>1,a=this.type==2,o=!1,s=!1,c=[];for(let t of this.dependencies)t==`doc`?o=!0:t==`selection`?s=!0:(e[t.id]??1)&1||c.push(e[t.id]);return{create(e){return e.values[i]=t(e),1},update(e,r){if(o&&r.docChanged||s&&(r.docChanged||r.selection)||Ce(e,c)){let r=t(e);if(a?!Se(r,e.values[i],n):!n(r,e.values[i]))return e.values[i]=r,1}return 0},reconfigure:(e,o)=>{let s,c=o.config.address[r];if(c!=null){let r=Ie(o,c);if(this.dependencies.every(t=>t instanceof E?o.facet(t)===e.facet(t):t instanceof Ee?o.field(t,!1)==e.field(t,!1):!0)||(a?Se(s=t(e),r,n):n(s=t(e),r)))return e.values[i]=r,0}else s=t(e);return e.values[i]=s,1}}}get extension(){return this}};function Se(e,t,n){if(e.length!=t.length)return!1;for(let r=0;r<e.length;r++)if(!n(e[r],t[r]))return!1;return!0}function Ce(e,t){let n=!1;for(let r of t)Fe(e,r)&1&&(n=!0);return n}function we(e,t,n){let r=n.map(t=>e[t.id]),i=n.map(e=>e.type),a=r.filter(e=>!(e&1)),o=e[t.id]>>1;function s(e){let n=[];for(let t=0;t<r.length;t++){let a=Ie(e,r[t]);if(i[t]==2)for(let e of a)n.push(e);else n.push(a)}return t.combine(n)}return{create(e){for(let t of r)Fe(e,t);return e.values[o]=s(e),1},update(e,n){if(!Ce(e,a))return 0;let r=s(e);return t.compare(r,e.values[o])?0:(e.values[o]=r,1)},reconfigure(e,i){let a=Ce(e,r),c=i.config.facets[t.id],l=i.facet(t);if(c&&!a&&be(n,c))return e.values[o]=l,0;let u=s(e);return t.compare(u,l)?(e.values[o]=l,0):(e.values[o]=u,1)}}}var Te=E.define({static:!0}),Ee=class e{constructor(e,t,n,r,i){this.id=e,this.createF=t,this.updateF=n,this.compareF=r,this.spec=i,this.provides=void 0}static define(t){let n=new e(ye++,t.create,t.update,t.compare||((e,t)=>e===t),t);return t.provide&&(n.provides=t.provide(n)),n}create(e){return(e.facet(Te).find(e=>e.field==this)?.create||this.createF)(e)}slot(e){let t=e[this.id]>>1;return{create:e=>(e.values[t]=this.create(e),1),update:(e,n)=>{let r=e.values[t],i=this.updateF(r,n);return this.compareF(r,i)?0:(e.values[t]=i,1)},reconfigure:(e,n)=>{let r=e.facet(Te),i=n.facet(Te),a;return(a=r.find(e=>e.field==this))&&a!=i.find(e=>e.field==this)?(e.values[t]=a.create(e),1):n.config.address[this.id]==null?(e.values[t]=this.create(e),1):(e.values[t]=n.field(this),0)}}}init(e){return[this,Te.of({field:this,create:e})]}get extension(){return this}},De={lowest:4,low:3,default:2,high:1,highest:0};function Oe(e){return t=>new Ae(t,e)}var ke={highest:Oe(De.highest),high:Oe(De.high),default:Oe(De.default),low:Oe(De.low),lowest:Oe(De.lowest)},Ae=class{constructor(e,t){this.inner=e,this.prec=t}get extension(){return this}},je=class e{of(e){return new Me(this,e)}reconfigure(t){return e.reconfigure.of({compartment:this,extension:t})}get(e){return e.config.compartments.get(this)}},Me=class{constructor(e,t){this.compartment=e,this.inner=t}get extension(){return this}},Ne=class e{constructor(e,t,n,r,i,a){for(this.base=e,this.compartments=t,this.dynamicSlots=n,this.address=r,this.staticValues=i,this.facets=a,this.statusTemplate=[];this.statusTemplate.length<n.length;)this.statusTemplate.push(0)}staticFacet(e){let t=this.address[e.id];return t==null?e.default:this.staticValues[t>>1]}static resolve(t,n,r){let i=[],a=Object.create(null),o=new Map;for(let e of Pe(t,n,o))e instanceof Ee?i.push(e):(a[e.facet.id]||(a[e.facet.id]=[])).push(e);let s=Object.create(null),c=[],l=[];for(let e of i)s[e.id]=l.length<<1,l.push(t=>e.slot(t));let u=r?.config.facets;for(let e in a){let t=a[e],n=t[0].facet,i=u&&u[e]||[];if(t.every(e=>e.type==0)){if(s[n.id]=c.length<<1|1,be(i,t))c.push(r.facet(n));else{let e=n.combine(t.map(e=>e.value));c.push(r&&n.compare(e,r.facet(n))?r.facet(n):e)}}else{for(let e of t)e.type==0?(s[e.id]=c.length<<1|1,c.push(e.value)):(s[e.id]=l.length<<1,l.push(t=>e.dynamicSlot(t)));s[n.id]=l.length<<1,l.push(e=>we(e,n,t))}}let d=l.map(e=>e(s));return new e(t,o,d,s,c,a)}};function Pe(e,t,n){let r=[[],[],[],[],[]],i=new Map;function a(e,o){let s=i.get(e);if(s!=null){if(s<=o)return;let t=r[s].indexOf(e);t>-1&&r[s].splice(t,1),e instanceof Me&&n.delete(e.compartment)}if(i.set(e,o),Array.isArray(e))for(let t of e)a(t,o);else if(e instanceof Me){if(n.has(e.compartment))throw RangeError(`Duplicate use of compartment in extensions`);let r=t.get(e.compartment)||e.inner;n.set(e.compartment,r),a(r,o)}else if(e instanceof Ae)a(e.inner,e.prec);else if(e instanceof Ee)r[o].push(e),e.provides&&a(e.provides,o);else if(e instanceof xe)r[o].push(e),e.facet.extensions&&a(e.facet.extensions,De.default);else{let t=e.extension;if(!t)throw Error(`Unrecognized extension value in extension set (${e}).`);if(t==e)throw Error(`Unrecognized extension value in extension set (${e}). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.`);a(t,o)}}return a(e,De.default),r.reduce((e,t)=>e.concat(t))}function Fe(e,t){if(t&1)return 2;let n=t>>1,r=e.status[n];if(r==4)throw Error(`Cyclic dependency between fields and/or facets`);if(r&2)return r;e.status[n]=4;let i=e.computeSlot(e,e.config.dynamicSlots[n]);return e.status[n]=2|i}function Ie(e,t){return t&1?e.config.staticValues[t>>1]:e.values[t>>1]}var Le=E.define(),Re=E.define({combine:e=>e.some(e=>e),static:!0}),ze=E.define({combine:e=>e.length?e[0]:void 0,static:!0}),Be=E.define(),Ve=E.define(),He=E.define(),Ue=E.define({combine:e=>e.length?e[0]:!1}),We=class{constructor(e,t){this.type=e,this.value=t}static define(){return new Ge}},Ge=class{of(e){return new We(this,e)}},Ke=class{constructor(e){this.map=e}of(e){return new D(this,e)}},D=class e{constructor(e,t){this.type=e,this.value=t}map(t){let n=this.type.map(this.value,t);return n===void 0?void 0:n==this.value?this:new e(this.type,n)}is(e){return this.type==e}static define(e={}){return new Ke(e.map||(e=>e))}static mapEffects(e,t){if(!e.length)return e;let n=[];for(let r of e){let e=r.map(t);e&&n.push(e)}return n}};D.reconfigure=D.define(),D.appendConfig=D.define();var qe=class e{constructor(t,n,r,i,a,o){this.startState=t,this.changes=n,this.selection=r,this.effects=i,this.annotations=a,this.scrollIntoView=o,this._doc=null,this._state=null,r&&ve(r,n.newLength),a.some(t=>t.type==e.time)||(this.annotations=a.concat(e.time.of(Date.now())))}static create(t,n,r,i,a,o){return new e(t,n,r,i,a,o)}get newDoc(){return this._doc||=this.changes.apply(this.startState.doc)}get newSelection(){return this.selection||this.startState.selection.map(this.changes)}get state(){return this._state||this.startState.applyTransaction(this),this._state}annotation(e){for(let t of this.annotations)if(t.type==e)return t.value}get docChanged(){return!this.changes.empty}get reconfigured(){return this.startState.config!=this.state.config}isUserEvent(t){let n=this.annotation(e.userEvent);return!!(n&&(n==t||n.length>t.length&&n.slice(0,t.length)==t&&n[t.length]==`.`))}};qe.time=We.define(),qe.userEvent=We.define(),qe.addToHistory=We.define(),qe.remote=We.define();function Je(e,t){let n=[];for(let r=0,i=0;;){let a,o;if(r<e.length&&(i==t.length||t[i]>=e[r]))a=e[r++],o=e[r++];else if(i<t.length)a=t[i++],o=t[i++];else return n;!n.length||n[n.length-1]<a?n.push(a,o):n[n.length-1]<o&&(n[n.length-1]=o)}}function Ye(e,t,n){let r,i,a;return n?(r=t.changes,i=de.empty(t.changes.length),a=e.changes.compose(t.changes)):(r=t.changes.map(e.changes),i=e.changes.mapDesc(t.changes,!0),a=e.changes.compose(r)),{changes:a,selection:t.selection?t.selection.map(i):e.selection?.map(r),effects:D.mapEffects(e.effects,r).concat(D.mapEffects(t.effects,i)),annotations:e.annotations.length?e.annotations.concat(t.annotations):t.annotations,scrollIntoView:e.scrollIntoView||t.scrollIntoView}}function Xe(e,t,n){let r=t.selection,i=tt(t.annotations);return t.userEvent&&(i=i.concat(qe.userEvent.of(t.userEvent))),{changes:t.changes instanceof de?t.changes:de.of(t.changes||[],n,e.facet(ze)),selection:r&&(r instanceof T?r:T.single(r.anchor,r.head)),effects:tt(t.effects),annotations:i,scrollIntoView:!!t.scrollIntoView}}function Ze(e,t,n){let r=Xe(e,t.length?t[0]:{},e.doc.length);t.length&&t[0].filter===!1&&(n=!1);for(let i=1;i<t.length;i++){t[i].filter===!1&&(n=!1);let a=!!t[i].sequential;r=Ye(r,Xe(e,t[i],a?r.changes.newLength:e.doc.length),a)}let i=qe.create(e,r.changes,r.selection,r.effects,r.annotations,r.scrollIntoView);return $e(n?Qe(i):i)}function Qe(e){let t=e.startState,n=!0;for(let r of t.facet(Be)){let t=r(e);if(t===!1){n=!1;break}Array.isArray(t)&&(n=n===!0?t:Je(n,t))}if(n!==!0){let r,i;if(n===!1)i=e.changes.invertedDesc,r=de.empty(t.doc.length);else{let t=e.changes.filter(n);r=t.changes,i=t.filtered.mapDesc(t.changes).invertedDesc}e=qe.create(t,r,e.selection&&e.selection.map(i),D.mapEffects(e.effects,i),e.annotations,e.scrollIntoView)}let r=t.facet(Ve);for(let n=r.length-1;n>=0;n--){let i=r[n](e);e=i instanceof qe?i:Array.isArray(i)&&i.length==1&&i[0]instanceof qe?i[0]:Ze(t,tt(i),!1)}return e}function $e(e){let t=e.startState,n=t.facet(He),r=e;for(let i=n.length-1;i>=0;i--){let a=n[i](e);a&&Object.keys(a).length&&(r=Ye(r,Xe(t,a,e.changes.newLength),!0))}return r==e?e:qe.create(t,e.changes,e.selection,r.effects,r.annotations,r.scrollIntoView)}var et=[];function tt(e){return e==null?et:Array.isArray(e)?e:[e]}var O=(function(e){return e[e.Word=0]=`Word`,e[e.Space=1]=`Space`,e[e.Other=2]=`Other`,e})(O||={}),nt=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/,rt;try{rt=RegExp(`[\\p{Alphabetic}\\p{Number}_]`,`u`)}catch{}function it(e){if(rt)return rt.test(e);for(let t=0;t<e.length;t++){let n=e[t];if(/\w/.test(n)||n>``&&(n.toUpperCase()!=n.toLowerCase()||nt.test(n)))return!0}return!1}function at(e){return t=>{if(!/\S/.test(t))return O.Space;if(it(t))return O.Word;for(let n=0;n<e.length;n++)if(t.indexOf(e[n])>-1)return O.Word;return O.Other}}var k=class e{constructor(e,t,n,r,i,a){this.config=e,this.doc=t,this.selection=n,this.values=r,this.status=e.statusTemplate.slice(),this.computeSlot=i,a&&(a._state=this);for(let e=0;e<this.config.dynamicSlots.length;e++)Fe(this,e<<1);this.computeSlot=null}field(e,t=!0){let n=this.config.address[e.id];if(n==null){if(t)throw RangeError(`Field is not present in this state`);return}return Fe(this,n),Ie(this,n)}update(...e){return Ze(this,e,!0)}applyTransaction(t){let n=this.config,{base:r,compartments:i}=n;for(let e of t.effects)e.is(je.reconfigure)?(n&&=(i=new Map,n.compartments.forEach((e,t)=>i.set(t,e)),null),i.set(e.value.compartment,e.value.extension)):e.is(D.reconfigure)?(n=null,r=e.value):e.is(D.appendConfig)&&(n=null,r=tt(r).concat(e.value));let a;n?a=t.startState.values.slice():(n=Ne.resolve(r,i,this),a=new e(n,this.doc,this.selection,n.dynamicSlots.map(()=>null),(e,t)=>t.reconfigure(e,this),null).values);let o=t.startState.facet(Re)?t.newSelection:t.newSelection.asSingle();new e(n,t.newDoc,o,a,(e,n)=>n.update(e,t),t)}replaceSelection(e){return typeof e==`string`&&(e=this.toText(e)),this.changeByRange(t=>({changes:{from:t.from,to:t.to,insert:e},range:T.cursor(t.from+e.length)}))}changeByRange(e){let t=this.selection,n=e(t.ranges[0]),r=this.changes(n.changes),i=[n.range],a=tt(n.effects);for(let n=1;n<t.ranges.length;n++){let o=e(t.ranges[n]),s=this.changes(o.changes),c=s.map(r);for(let e=0;e<n;e++)i[e]=i[e].map(c);let l=r.mapDesc(s,!0);i.push(o.range.map(l)),r=r.compose(c),a=D.mapEffects(a,c).concat(D.mapEffects(tt(o.effects),l))}return{changes:r,selection:T.create(i,t.mainIndex),effects:a}}changes(t=[]){return t instanceof de?t:de.of(t,this.doc.length,this.facet(e.lineSeparator))}toText(t){return h.of(t.split(this.facet(e.lineSeparator)||le))}sliceDoc(e=0,t=this.doc.length){return this.doc.sliceString(e,t,this.lineBreak)}facet(e){let t=this.config.address[e.id];return t==null?e.default:(Fe(this,t),Ie(this,t))}toJSON(e){let t={doc:this.sliceDoc(),selection:this.selection.toJSON()};if(e)for(let n in e){let r=e[n];r instanceof Ee&&this.config.address[r.id]!=null&&(t[n]=r.spec.toJSON(this.field(e[n]),this))}return t}static fromJSON(t,n={},r){if(!t||typeof t.doc!=`string`)throw RangeError(`Invalid JSON representation for EditorState`);let i=[];if(r){for(let e in r)if(Object.prototype.hasOwnProperty.call(t,e)){let n=r[e],a=t[e];i.push(n.init(e=>n.spec.fromJSON(a,e)))}}return e.create({doc:t.doc,selection:T.fromJSON(t.selection),extensions:n.extensions?i.concat([n.extensions]):i})}static create(t={}){let n=Ne.resolve(t.extensions||[],new Map),r=t.doc instanceof h?t.doc:h.of((t.doc||``).split(n.staticFacet(e.lineSeparator)||le)),i=t.selection?t.selection instanceof T?t.selection:T.single(t.selection.anchor,t.selection.head):T.single(0);return ve(i,r.length),n.staticFacet(Re)||(i=i.asSingle()),new e(n,r,i,n.dynamicSlots.map(()=>null),(e,t)=>t.create(e),null)}get tabSize(){return this.facet(e.tabSize)}get lineBreak(){return this.facet(e.lineSeparator)||`
|
package/dist/web/assets/{abnfDiagram-O67JEVCF-Az7EW1BC.js → abnfDiagram-O67JEVCF-DW9LWr8f.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{m as e,t}from"./mermaid-parser.core-
|
|
1
|
+
import{m as e,t}from"./mermaid-parser.core-Bis_wTB-.js";import{n}from"./chunk-Y2CYZVJY-DsF7k-Jl.js";import{m as r}from"./src-oBChb5qS.js";import"./chunk-O7XYJQB3-BNx_V4Oi.js";import{n as i,r as a,t as o}from"./chunk-GTNCS2PH-BOCxryKf.js";import{t as s}from"./chunk-JWPE2WC7-DVXcaiue.js";import"./mermaid.core-DMsM3ZX7.js";var c=e().RailroadAbnf.parser.LangiumParser,l=n(e=>{let t=e.alternatives.map(u);return t.length===1?t[0]:{type:`choice`,alternatives:t}},`transformAlternation`),u=n(e=>{let t=e.elements.map(f);return t.length===1?t[0]:{type:`sequence`,elements:t}},`transformConcatenation`),d=n(e=>{if(e.includes(`*`)){let[t,n]=e.split(`*`);return{min:t?parseInt(t,10):0,max:n?parseInt(n,10):1/0}}let t=parseInt(e,10);return{min:t,max:t}},`parseRepeat`),f=n(e=>{let t=p(e.primary);if(!e.repeat)return t;let{min:n,max:r}=d(e.repeat);return n===0&&r===1?{type:`optional`,element:t}:{type:`repetition`,element:t,min:n,max:r}},`transformElement`),p=n(e=>{switch(e.$type){case`AbnfStringLiteral`:return{type:`terminal`,value:e.value};case`AbnfNumVal`:return{type:`terminal`,value:e.value};case`AbnfRuleName`:return{type:`nonterminal`,name:e.name};case`AbnfGroup`:return l(e.element);case`AbnfOptionalGroup`:return{type:`optional`,element:l(e.element)};default:throw Error(`Unsupported ABNF primary node: ${e.$type}`)}},`transformPrimary`),m=n(e=>({name:e.name,definition:l(e.definition)}),`transformRule`),h=n(e=>{s(e,o),e.title&&o.setTitle(e.title),e.rules.map(e=>o.addRule(m(e)))},`populateDb`),g={parser:{parse:n(e=>{o.clear(),r.debug(`[ABNF Parser] Starting Langium parse`);let n=c.parse(e);if(n.lexerErrors.length>0||n.parserErrors.length>0)throw new t(n);let i=n.value;r.debug(`[ABNF Parser] Parsed rules:`,i.rules.length),h(i),r.debug(`[ABNF Parser] Parse complete`)},`parse`),parser:{yy:o}},db:o,renderer:a,styles:i};export{g as diagram};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import"./chunk-FOHPRMQF-DzxwRta7.js";import{M as e}from"./mermaid-parser.core-Bis_wTB-.js";export{e as createArchitectureServices};
|