elanous 0.2.35 → 0.2.37
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/apps/pwa/out/404/index.html +1 -1
- package/apps/pwa/out/404.html +1 -1
- package/apps/pwa/out/_next/static/{T1mBQqmkwKDLGtyisDCOd → 8kITumG9GAZ1LwT9POrAR}/_buildManifest.js +1 -1
- package/apps/pwa/out/_next/static/chunks/1041-5841aae848fb6403.js +1 -0
- package/apps/pwa/out/_next/static/chunks/1087.3177e54f672dc526.js +1 -0
- package/apps/pwa/out/_next/static/chunks/1105.efe1e13503ac7a33.js +1 -0
- package/apps/pwa/out/_next/static/chunks/1224.2ceca6c180d5130b.js +62 -0
- package/apps/pwa/out/_next/static/chunks/{9952.5daf5f94063a2b3e.js → 1262.a89bb27a5b2f844e.js} +1 -1
- package/apps/pwa/out/_next/static/chunks/1417-1768233ac92f8a5d.js +1 -0
- package/apps/pwa/out/_next/static/chunks/1612.81bbc19af06af16c.js +1 -0
- package/apps/pwa/out/_next/static/chunks/1746.3563617ea64023a3.js +115 -0
- package/apps/pwa/out/_next/static/chunks/1766.728d42053070bb2d.js +1 -0
- package/apps/pwa/out/_next/static/chunks/1773.d38e945481e04125.js +1 -0
- package/apps/pwa/out/_next/static/chunks/1974-c12f9600da3d3c26.js +1 -0
- package/apps/pwa/out/_next/static/chunks/{1dc5a567.9b092bfae3d7099b.js → 1ed5e8af.cf424815c7c0efad.js} +1 -1
- package/apps/pwa/out/_next/static/chunks/{4705-194e64e47ca0fbdb.js → 2002-a43a3f380df873ec.js} +1 -1
- package/apps/pwa/out/_next/static/chunks/2061.7232dc9dc058417f.js +1 -0
- package/apps/pwa/out/_next/static/chunks/{13.02a07436dec15f89.js → 210.90b2cbd64926cf34.js} +1 -1
- package/apps/pwa/out/_next/static/chunks/{9512.5a76207a730e0491.js → 2283.edd9627b7bdfb546.js} +2 -2
- package/apps/pwa/out/_next/static/chunks/{6866-79aa5b4e47cac6aa.js → 2318-450e75d07605b8fe.js} +1 -1
- package/apps/pwa/out/_next/static/chunks/{938.66ad1ef0e5abae1c.js → 2375.bf364c85dbb6f085.js} +1 -1
- package/apps/pwa/out/_next/static/chunks/244-a810d282a20f1783.js +1 -0
- package/apps/pwa/out/_next/static/chunks/2479-fe7e188bd9402d14.js +1 -0
- package/apps/pwa/out/_next/static/chunks/2514.03b60f266531a015.js +148 -0
- package/apps/pwa/out/_next/static/chunks/2526-a657538869888604.js +1 -0
- package/apps/pwa/out/_next/static/chunks/2533-6f0341ff075809e9.js +1 -0
- package/apps/pwa/out/_next/static/chunks/2676.e7994c695ef0f30d.js +1 -0
- package/apps/pwa/out/_next/static/chunks/2734.3ffdf54254fb6f99.js +27 -0
- package/apps/pwa/out/_next/static/chunks/2770-23252bf3a37880b9.js +1 -0
- package/apps/pwa/out/_next/static/chunks/2969.66b8b545139d1544.js +1 -0
- package/apps/pwa/out/_next/static/chunks/3128.a9210d08800ea6a8.js +1 -0
- package/apps/pwa/out/_next/static/chunks/3199.6a1a9b0e6cd01dc6.js +1 -0
- package/apps/pwa/out/_next/static/chunks/3212.12179fd3eee8cef1.js +1 -0
- package/apps/pwa/out/_next/static/chunks/{9214.63a510d39178e997.js → 3578.4e9f9948a9a6f2f4.js} +2 -2
- package/apps/pwa/out/_next/static/chunks/3760-2909ddb9279281cd.js +1 -0
- package/apps/pwa/out/_next/static/chunks/3825.1921b5901bf33dce.js +36 -0
- package/apps/pwa/out/_next/static/chunks/3994-63eb884ed0547011.js +1 -0
- package/apps/pwa/out/_next/static/chunks/4036.d54e55e1ebf5acdc.js +90 -0
- package/apps/pwa/out/_next/static/chunks/4115.5b438b99f0ae729f.js +226 -0
- package/apps/pwa/out/_next/static/chunks/4269.d8f9f34bb0fc6c43.js +287 -0
- package/apps/pwa/out/_next/static/chunks/431-4eed5bd2c5fe1719.js +1 -0
- package/apps/pwa/out/_next/static/chunks/{2018.a741297bce759490.js → 4313.76f232c304a15bde.js} +1 -1
- package/apps/pwa/out/_next/static/chunks/{1165.bad13fc9151a7288.js → 4324.c99ba3e83eb1b691.js} +1 -1
- package/apps/pwa/out/_next/static/chunks/{3f7c4ee5.3dde54f01a816613.js → 4337e36d.f42c3b391b3d8f20.js} +1 -1
- package/apps/pwa/out/_next/static/chunks/{7385.50a308a477bdfc21.js → 4383.18e5c54db3a22c88.js} +1 -1
- package/apps/pwa/out/_next/static/chunks/4599-96eff3f2a9c242c1.js +1 -0
- package/apps/pwa/out/_next/static/chunks/{8557-e7898769499cd56f.js → 4725-34bed25720cc326b.js} +1 -1
- package/apps/pwa/out/_next/static/chunks/4825-a9d9d4e9f5892309.js +1 -0
- package/apps/pwa/out/_next/static/chunks/{5483-dd5d7697f6bdb106.js → 4833-7934c592c5569f00.js} +1 -1
- package/apps/pwa/out/_next/static/chunks/4879-68518f547a207aff.js +1 -0
- package/apps/pwa/out/_next/static/chunks/4896.f9b70285363b27b2.js +24 -0
- package/apps/pwa/out/_next/static/chunks/{8444.4c26b379ca2b9596.js → 4931.95cc6dbd230774ca.js} +17 -17
- package/apps/pwa/out/_next/static/chunks/4937-28d437999b77c9dd.js +1 -0
- package/apps/pwa/out/_next/static/chunks/49aa54ab.80f39398e0ed0f30.js +1 -0
- package/apps/pwa/out/_next/static/chunks/{3408.21d1570602f4b6c0.js → 5046.7fd5cbd859299448.js} +1 -1
- package/apps/pwa/out/_next/static/chunks/5056.482687319b82638e.js +104 -0
- package/apps/pwa/out/_next/static/chunks/506.16b83d56a437a9ee.js +1 -0
- package/apps/pwa/out/_next/static/chunks/5260-20593b0a25d0afbc.js +1 -0
- package/apps/pwa/out/_next/static/chunks/5404.cc4e9fec26fd5925.js +1 -0
- package/apps/pwa/out/_next/static/chunks/576.485e83e3f3dec19a.js +1 -0
- package/apps/pwa/out/_next/static/chunks/5832-a6be14e663f65726.js +1 -0
- package/apps/pwa/out/_next/static/chunks/5854-56648a9fe646b9a0.js +1 -0
- package/apps/pwa/out/_next/static/chunks/58edce7d.f1b0c72acf13b123.js +1 -0
- package/apps/pwa/out/_next/static/chunks/5925.3b1f8b135710249b.js +93 -0
- package/apps/pwa/out/_next/static/chunks/5952.294fc574a8625184.js +1 -0
- package/apps/pwa/out/_next/static/chunks/{b6705a4f-b9a9047de9eecfd0.js → 5f6af561-f90b7a67f4f75d13.js} +1 -1
- package/apps/pwa/out/_next/static/chunks/6168.17749aa3905fa073.js +74 -0
- package/apps/pwa/out/_next/static/chunks/6252.240578f10952e091.js +34 -0
- package/apps/pwa/out/_next/static/chunks/6416.5d50b8ec9986ca98.js +1 -0
- package/apps/pwa/out/_next/static/chunks/{5101.e32282718f99ed6f.js → 6680.6a693c28aae4cd19.js} +1 -1
- package/apps/pwa/out/_next/static/chunks/{4718-17d2af636796a330.js → 6745-5a63492933959dd9.js} +3 -3
- package/apps/pwa/out/_next/static/chunks/6758.e7fbf532953c0783.js +1 -0
- package/apps/pwa/out/_next/static/chunks/6795.0cb8a59730d99703.js +149 -0
- package/apps/pwa/out/_next/static/chunks/{6236.e18cced2d5ba6afb.js → 6819.be5c9c4d67f22922.js} +16 -16
- package/apps/pwa/out/_next/static/chunks/6877-84d47b7e85d0c41e.js +1 -0
- package/apps/pwa/out/_next/static/chunks/{2833-0fe47af99ed13c29.js → 6971-fb5f9dc0a2cb5d2d.js} +1 -1
- package/apps/pwa/out/_next/static/chunks/{da5176c6.6773b6c5994e1d99.js → 709a918c.4fd3b4e2a32cb4e3.js} +1 -1
- package/apps/pwa/out/_next/static/chunks/717.522b08685979b814.js +1 -0
- package/apps/pwa/out/_next/static/chunks/7191.e41eb8f455c7f089.js +41 -0
- package/apps/pwa/out/_next/static/chunks/7233.8e744b7513119409.js +1 -0
- package/apps/pwa/out/_next/static/chunks/7238-97c2226f80504bd8.js +1 -0
- package/apps/pwa/out/_next/static/chunks/7285.307963afcf7e7660.js +24 -0
- package/apps/pwa/out/_next/static/chunks/7299-fbe4b8c47a87614a.js +1 -0
- package/apps/pwa/out/_next/static/chunks/7314.df0d95930b0c3f50.js +1 -0
- package/apps/pwa/out/_next/static/chunks/7406.c0589fdf2ee66629.js +1 -0
- package/apps/pwa/out/_next/static/chunks/7424.c0fe2a595d4232b5.js +23 -0
- package/apps/pwa/out/_next/static/chunks/752-90e3e7daad3d8e39.js +1 -0
- package/apps/pwa/out/_next/static/chunks/7524-bcd3d9928c6842d9.js +1 -0
- package/apps/pwa/out/_next/static/chunks/7549.9a4de3bf231cfc52.js +1 -0
- package/apps/pwa/out/_next/static/chunks/757-4fbaf50942b8c424.js +1 -0
- package/apps/pwa/out/_next/static/chunks/765.76ae970ceb597b5b.js +1 -0
- package/apps/pwa/out/_next/static/chunks/{7644.17e37ba6f1d4226e.js → 7867.e8725745ddd1d940.js} +4 -4
- package/apps/pwa/out/_next/static/chunks/7893-e444a1b0809cd1e4.js +1 -0
- package/apps/pwa/out/_next/static/chunks/7956-33748cabb3a05562.js +1 -0
- package/apps/pwa/out/_next/static/chunks/{0368f25d-ad84af92fefee68f.js → 7c5ed21f-f286708e57cf88f7.js} +1 -1
- package/apps/pwa/out/_next/static/chunks/8030-aa66b478b53dbfca.js +1 -0
- package/apps/pwa/out/_next/static/chunks/8051.c88c07dacbbc5f21.js +8 -0
- package/apps/pwa/out/_next/static/chunks/{359-2250789a2d3499e7.js → 8080-40d781e7704d3671.js} +1 -1
- package/apps/pwa/out/_next/static/chunks/8149.80e402d4345e8dae.js +77 -0
- package/apps/pwa/out/_next/static/chunks/8205.50a5268f4e12ba0b.js +1 -0
- package/apps/pwa/out/_next/static/chunks/8231.a128feaa6f8b6079.js +1 -0
- package/apps/pwa/out/_next/static/chunks/85.4ddb1dda2ea3ffa2.js +286 -0
- package/apps/pwa/out/_next/static/chunks/8537.26517a09e8247beb.js +1 -0
- package/apps/pwa/out/_next/static/chunks/8595-e9b7081ab773a61f.js +1 -0
- package/apps/pwa/out/_next/static/chunks/8821-30cc65a61a60951f.js +1 -0
- package/apps/pwa/out/_next/static/chunks/8905.b3385aadb7b133e6.js +79 -0
- package/apps/pwa/out/_next/static/chunks/8983.246bb3a1ac38f50f.js +1 -0
- package/apps/pwa/out/_next/static/chunks/{b2f6ba4d.fb56fdbbf798df33.js → 8c58d09b.e8724a299658d86f.js} +1 -1
- package/apps/pwa/out/_next/static/chunks/9072.18342f5941a1f3ec.js +1 -0
- package/apps/pwa/out/_next/static/chunks/9123.9df04866b2d6e00f.js +1 -0
- package/apps/pwa/out/_next/static/chunks/{1530.0e612369b6fd7ea0.js → 9151.a2c51e93f9156dae.js} +1 -1
- package/apps/pwa/out/_next/static/chunks/{4441-875b97f5821ed58a.js → 9175-7d383df15a82e2be.js} +1 -1
- package/apps/pwa/out/_next/static/chunks/9181-bf89c07ce5b8f599.js +1 -0
- package/apps/pwa/out/_next/static/chunks/920-429bbc4504b45f71.js +1 -0
- package/apps/pwa/out/_next/static/chunks/9207.625edf45d656151c.js +1 -0
- package/apps/pwa/out/_next/static/chunks/9378.d2575c6ffd6dd756.js +94 -0
- package/apps/pwa/out/_next/static/chunks/957.db5b5c4d32a35240.js +1 -0
- package/apps/pwa/out/_next/static/chunks/958.53a8dcf4729e6997.js +64 -0
- package/apps/pwa/out/_next/static/chunks/9647.8f0cd0898c592a29.js +1 -0
- package/apps/pwa/out/_next/static/chunks/9665-26abb02665704c2c.js +1 -0
- package/apps/pwa/out/_next/static/chunks/9703.e7d81b6faef1050a.js +1 -0
- package/apps/pwa/out/_next/static/chunks/9882-7a9164b3c2dacbe5.js +1 -0
- package/apps/pwa/out/_next/static/chunks/9998.b74e033efadecd10.js +1 -0
- package/apps/pwa/out/_next/static/chunks/app/_not-found/page-c604fb980a634d88.js +1 -0
- package/apps/pwa/out/_next/static/chunks/app/approvals/page-ec2d8a4979ca9075.js +1 -0
- package/apps/pwa/out/_next/static/chunks/app/autopilot/page-cb6add08ad3c7660.js +1 -0
- package/apps/pwa/out/_next/static/chunks/app/board/page-e2eaa321ec223fe6.js +1 -0
- package/apps/pwa/out/_next/static/chunks/app/botlab/page-5b8a09c475b5f844.js +1 -0
- package/apps/pwa/out/_next/static/chunks/app/bots/page-91a77daedfbac191.js +1 -0
- package/apps/pwa/out/_next/static/chunks/app/ceo/page-f37fc5e974bda39b.js +1 -0
- package/apps/pwa/out/_next/static/chunks/app/chat/page-91429a0b78415a94.js +1 -0
- package/apps/pwa/out/_next/static/chunks/app/consult/page-b95798b58263b910.js +1 -0
- package/apps/pwa/out/_next/static/chunks/app/control/page-763d53e175e17aa1.js +1 -0
- package/apps/pwa/out/_next/static/chunks/app/decisions/page-d55023204055b12f.js +1 -0
- package/apps/pwa/out/_next/static/chunks/app/design-check/page-89d2140d78abc810.js +1 -0
- package/apps/pwa/out/_next/static/chunks/app/editor/page-82dc069abfe27f55.js +1 -0
- package/apps/pwa/out/_next/static/chunks/app/exec/page-25d9eee7beb552c0.js +1 -0
- package/apps/pwa/out/_next/static/chunks/app/field/page-770b4594c713ee97.js +1 -0
- package/apps/pwa/out/_next/static/chunks/app/healthz/route-c604fb980a634d88.js +1 -0
- package/apps/pwa/out/_next/static/chunks/app/inside/page-ba8e0dcae4f83985.js +1 -0
- package/apps/pwa/out/_next/static/chunks/app/intake/page-5c112c6d7c33656e.js +1 -0
- package/apps/pwa/out/_next/static/chunks/app/layout-09788e1aa9a87db6.js +1 -0
- package/apps/pwa/out/_next/static/chunks/app/live/page-3337c6a1328c2674.js +1 -0
- package/apps/pwa/out/_next/static/chunks/app/live-run/page-89acd5d68c0bc560.js +1 -0
- package/apps/pwa/out/_next/static/chunks/app/loops/page-5c13e2c76371d797.js +1 -0
- package/apps/pwa/out/_next/static/chunks/app/market/page-653a9f18642825c6.js +1 -0
- package/apps/pwa/out/_next/static/chunks/app/missions/[id]/page-fe986fe79b107546.js +1 -0
- package/apps/pwa/out/_next/static/chunks/app/morning/{page-47c5d4db587266bd.js → page-1e5da297557d2354.js} +1 -1
- package/apps/pwa/out/_next/static/chunks/app/not-found-91ea9f5869a40943.js +1 -0
- package/apps/pwa/out/_next/static/chunks/app/observatory/page-7824e21b999962e2.js +1 -0
- package/apps/pwa/out/_next/static/chunks/app/ops/checklist/page-53d00a60cc75a922.js +1 -0
- package/apps/pwa/out/_next/static/chunks/app/ops/release/{page-1f5a60f70cb4dd0c.js → page-88a1edbff62eaf1d.js} +1 -1
- package/apps/pwa/out/_next/static/chunks/app/ops/seats/page-4e931248b3f9574b.js +1 -0
- package/apps/pwa/out/_next/static/chunks/app/outputs/{page-bac7dee94e5eae4a.js → page-443364c9e4a23b31.js} +1 -1
- package/apps/pwa/out/_next/static/chunks/app/page-b9af2ac1c4737ce8.js +1 -0
- package/apps/pwa/out/_next/static/chunks/app/reflection/page-25ab9c614c14129b.js +1 -0
- package/apps/pwa/out/_next/static/chunks/app/scheduler/page-dbcdcfac0a395a8a.js +1 -0
- package/apps/pwa/out/_next/static/chunks/app/sessions/page-bf1de6645089ec58.js +1 -0
- package/apps/pwa/out/_next/static/chunks/app/settings/devices/page-c4201761a5e839c9.js +1 -0
- package/apps/pwa/out/_next/static/chunks/app/settings/page-c304f469ea5d70e4.js +1 -0
- package/apps/pwa/out/_next/static/chunks/app/setup/done/page-8e5a238cf5e50c9c.js +1 -0
- package/apps/pwa/out/_next/static/chunks/app/setup/layout-c604fb980a634d88.js +1 -0
- package/apps/pwa/out/_next/static/chunks/app/setup/page-32b526069ee50b3c.js +1 -0
- package/apps/pwa/out/_next/static/chunks/app/share/page-fb9e639c107f5f72.js +1 -0
- package/apps/pwa/out/_next/static/chunks/app/showroom/page-84220c776608cedc.js +1 -0
- package/apps/pwa/out/_next/static/chunks/app/tasks/page-e475618cbfd5ca2b.js +1 -0
- package/apps/pwa/out/_next/static/chunks/app/term/{page-dc0a532f5b9196ec.js → page-ac2c1e6169cfce57.js} +1 -1
- package/apps/pwa/out/_next/static/chunks/app/today/page-fccd3020af2f8806.js +1 -0
- package/apps/pwa/out/_next/static/chunks/app/trace/page-9c0d7198ff7b5a91.js +1 -0
- package/apps/pwa/out/_next/static/chunks/app/vault/page-d54b1ec9b9c6430d.js +1 -0
- package/apps/pwa/out/_next/static/chunks/app/workflows/chat-ui/page-8c4bef1791d732ca.js +1 -0
- package/apps/pwa/out/_next/static/chunks/app/workflows/page-46fcc0b0bbc6fbfe.js +1 -0
- package/apps/pwa/out/_next/static/chunks/app/workspace/page-c1c80e345fa9d6f5.js +1 -0
- package/apps/pwa/out/_next/static/chunks/app/worktrees/page-7dfda00afd172f5b.js +1 -0
- package/apps/pwa/out/_next/static/chunks/{d06f9160.a3d9062f95de8ad7.js → d9815f84.4918f682a45a8502.js} +1 -1
- package/apps/pwa/out/_next/static/chunks/{cbe38a15.5a032598e39970c6.js → de8446d3.31b73eb239fecd7b.js} +1 -1
- package/apps/pwa/out/_next/static/chunks/f21fd540.63ac75328926ed30.js +1 -0
- package/apps/pwa/out/_next/static/chunks/framework-77fdcc873519a6cd.js +1 -0
- package/apps/pwa/out/_next/static/chunks/main-app-d0d620d2ce235713.js +1 -0
- package/apps/pwa/out/_next/static/chunks/main-e0ef79c79337ba90.js +1 -0
- package/apps/pwa/out/_next/static/chunks/pages/_app-84b1bc71e3f9ce6a.js +1 -0
- package/apps/pwa/out/_next/static/chunks/pages/_error-2acb61f1363128cb.js +1 -0
- package/apps/pwa/out/_next/static/chunks/webpack-462ff5727ceb7824.js +1 -0
- package/apps/pwa/out/_next/static/css/{b5d88eba78a3d7bf.css → be9019f696217521.css} +1 -1
- package/apps/pwa/out/approvals/index.html +1 -1
- package/apps/pwa/out/approvals/index.txt +23 -23
- package/apps/pwa/out/autopilot/index.html +1 -1
- package/apps/pwa/out/autopilot/index.txt +23 -23
- package/apps/pwa/out/board/index.html +1 -1
- package/apps/pwa/out/board/index.txt +23 -23
- package/apps/pwa/out/botlab/index.html +1 -1
- package/apps/pwa/out/botlab/index.txt +22 -22
- package/apps/pwa/out/bots/index.html +1 -1
- package/apps/pwa/out/bots/index.txt +22 -22
- package/apps/pwa/out/ceo/index.html +1 -1
- package/apps/pwa/out/ceo/index.txt +23 -23
- package/apps/pwa/out/chat/index.html +1 -1
- package/apps/pwa/out/chat/index.txt +22 -22
- package/apps/pwa/out/consult/index.html +1 -1
- package/apps/pwa/out/consult/index.txt +23 -23
- package/apps/pwa/out/control/index.html +1 -1
- package/apps/pwa/out/control/index.txt +23 -23
- package/apps/pwa/out/decisions/index.html +1 -1
- package/apps/pwa/out/decisions/index.txt +22 -22
- package/apps/pwa/out/design-check/index.html +1 -1
- package/apps/pwa/out/design-check/index.txt +23 -23
- package/apps/pwa/out/editor/index.html +1 -1
- package/apps/pwa/out/editor/index.txt +23 -23
- package/apps/pwa/out/exec/index.html +1 -1
- package/apps/pwa/out/exec/index.txt +23 -23
- package/apps/pwa/out/field/index.html +1 -1
- package/apps/pwa/out/field/index.txt +23 -23
- package/apps/pwa/out/healthz +1 -1
- package/apps/pwa/out/index.html +1 -1
- package/apps/pwa/out/index.txt +22 -22
- package/apps/pwa/out/inside/index.html +1 -1
- package/apps/pwa/out/inside/index.txt +22 -22
- package/apps/pwa/out/intake/index.html +1 -1
- package/apps/pwa/out/intake/index.txt +23 -23
- package/apps/pwa/out/live/index.html +1 -1
- package/apps/pwa/out/live/index.txt +23 -23
- package/apps/pwa/out/live-run/index.html +1 -1
- package/apps/pwa/out/live-run/index.txt +23 -23
- package/apps/pwa/out/loops/index.html +1 -1
- package/apps/pwa/out/loops/index.txt +22 -22
- package/apps/pwa/out/market/index.html +1 -1
- package/apps/pwa/out/market/index.txt +22 -22
- package/apps/pwa/out/missions/placeholder/index.html +1 -1
- package/apps/pwa/out/missions/placeholder/index.txt +22 -22
- package/apps/pwa/out/morning/index.html +1 -1
- package/apps/pwa/out/morning/index.txt +23 -23
- package/apps/pwa/out/observatory/index.html +1 -1
- package/apps/pwa/out/observatory/index.txt +23 -23
- package/apps/pwa/out/ops/checklist/index.html +1 -1
- package/apps/pwa/out/ops/checklist/index.txt +22 -22
- package/apps/pwa/out/ops/release/index.html +1 -1
- package/apps/pwa/out/ops/release/index.txt +22 -22
- package/apps/pwa/out/ops/seats/index.html +1 -1
- package/apps/pwa/out/ops/seats/index.txt +22 -22
- package/apps/pwa/out/outputs/index.html +1 -1
- package/apps/pwa/out/outputs/index.txt +22 -22
- package/apps/pwa/out/reflection/index.html +1 -1
- package/apps/pwa/out/reflection/index.txt +23 -23
- package/apps/pwa/out/scheduler/index.html +1 -1
- package/apps/pwa/out/scheduler/index.txt +23 -23
- package/apps/pwa/out/sessions/index.html +1 -1
- package/apps/pwa/out/sessions/index.txt +22 -22
- package/apps/pwa/out/settings/devices/index.html +1 -1
- package/apps/pwa/out/settings/devices/index.txt +23 -23
- package/apps/pwa/out/settings/index.html +1 -1
- package/apps/pwa/out/settings/index.txt +23 -23
- package/apps/pwa/out/setup/done/index.html +1 -1
- package/apps/pwa/out/setup/done/index.txt +23 -23
- package/apps/pwa/out/setup/index.html +1 -1
- package/apps/pwa/out/setup/index.txt +23 -23
- package/apps/pwa/out/share/index.html +1 -1
- package/apps/pwa/out/share/index.txt +23 -23
- package/apps/pwa/out/showroom/index.html +1 -1
- package/apps/pwa/out/showroom/index.txt +22 -22
- package/apps/pwa/out/tasks/index.html +1 -1
- package/apps/pwa/out/tasks/index.txt +23 -23
- package/apps/pwa/out/term/index.html +1 -1
- package/apps/pwa/out/term/index.txt +23 -23
- package/apps/pwa/out/today/index.html +1 -1
- package/apps/pwa/out/today/index.txt +23 -23
- package/apps/pwa/out/trace/index.html +1 -1
- package/apps/pwa/out/trace/index.txt +23 -23
- package/apps/pwa/out/vault/index.html +1 -1
- package/apps/pwa/out/vault/index.txt +23 -23
- package/apps/pwa/out/workflows/chat-ui/index.html +1 -1
- package/apps/pwa/out/workflows/chat-ui/index.txt +23 -23
- package/apps/pwa/out/workflows/index.html +1 -1
- package/apps/pwa/out/workflows/index.txt +23 -23
- package/apps/pwa/out/workspace/index.html +1 -1
- package/apps/pwa/out/workspace/index.txt +23 -23
- package/apps/pwa/out/worktrees/index.html +1 -1
- package/apps/pwa/out/worktrees/index.txt +23 -23
- package/docs/goal-context/05-authoring-lessons.jsonl +47 -0
- package/docs/goal-context/README.md +3 -0
- package/graphs/default-loop.yaml +6 -1
- package/graphs/drafts/recipes.yaml +27 -7
- package/graphs/implement-loop.yaml +24 -0
- package/graphs/release/recipes.yaml +6 -0
- package/graphs/release/release-loop.yaml +17 -4
- package/graphs/wizard/recipes.yaml +44 -0
- package/graphs/wizard/wizard-loop.yaml +44 -0
- package/graphs/work/draft-close.yaml +54 -0
- package/graphs/work/green-close.yaml +37 -0
- package/graphs/work/recipes.yaml +46 -1
- package/graphs/work/research-report.yaml +2 -0
- package/graphs/work/run-research.yaml +35 -0
- package/package.json +1 -1
- package/scripts/__fixtures__/authoring-paths-10x3.json +32 -0
- package/scripts/boundary-proof-mapping-audit.ts +88 -0
- package/scripts/ci-typecheck-changed.ts +139 -5
- package/scripts/codex-fallback-live-probe.ts +17 -15
- package/scripts/coord-role-pack.ts +1 -1
- package/scripts/first10-gate.ts +416 -0
- package/scripts/fleet/node-setup.sh +32 -2
- package/scripts/fleet/run-light-worker.sh +9 -0
- package/scripts/fleet/wsl-node-setup.sh +432 -0
- package/scripts/gate-0226-failure-census.ts +507 -0
- package/scripts/goals/authoring-metrics.ts +258 -0
- package/scripts/graph-units/draft-close-node.ts +222 -0
- package/scripts/hook-order-sweep.ts +7 -4
- package/scripts/land-global-checks.ts +69 -1
- package/scripts/measure-nl-routing-corpus.ts +207 -2
- package/scripts/release-loop/docs-node.ts +344 -8
- package/scripts/release-loop/gate-closure.ts +48 -0
- package/scripts/release-loop/gate-diff.ts +2 -1
- package/scripts/release-loop/gate-node.ts +249 -53
- package/scripts/release-loop/known-issues-node.ts +6 -4
- package/scripts/release-loop/node-verdict.ts +2 -0
- package/scripts/release-loop/notes-repair.ts +216 -0
- package/scripts/release-loop/prepare-node.ts +61 -5
- package/scripts/release-loop/resume-cap.ts +14 -34
- package/scripts/release-loop/resume-release.ts +151 -15
- package/scripts/release-loop/resume-test-traffic.ts +10 -0
- package/scripts/release-loop/traffic-node.ts +59 -0
- package/scripts/release-loop/traffic-transition.ts +159 -0
- package/scripts/release-loop/version-node.ts +81 -12
- package/scripts/rhythm/daily.ts +137 -3
- package/scripts/train/green-leg.ts +176 -0
- package/scripts/tui-continue-real-evidence.ts +47 -0
- package/scripts/ux-sim.ts +53 -0
- package/skills/README.md +1 -0
- package/src/acp/client.ts +31 -5
- package/src/acp/core-turn-bridge.ts +54 -6
- package/src/acp/stderr-summary.ts +49 -0
- package/src/agent/delegate-hint.ts +16 -0
- package/src/agent/monad-agent-turn.ts +1 -0
- package/src/agent/runner.ts +82 -2
- package/src/agent/task-notification.ts +56 -10
- package/src/agent/terminal-surface.ts +217 -0
- package/src/agent/types.ts +4 -0
- package/src/agent-substrate/pr-reviewer.ts +64 -4
- package/src/agent-substrate/review-intent.ts +29 -2
- package/src/agent-substrate/review-observation.ts +3 -0
- package/src/agent-substrate/self-review-cli.ts +490 -26
- package/src/autopilot/lineage/sources.ts +1 -1
- package/src/autopilot/mission-codebase-gate.ts +141 -12
- package/src/autopilot/pr-manager.ts +89 -18
- package/src/boot/daemon-runtime.ts +35 -3
- package/src/boot/daemon-tools/pty-shell.ts +2 -1
- package/src/boot/daemon-tools/self-implement.ts +1 -0
- package/src/budget/run-usage-rollup.ts +12 -7
- package/src/budget/unified-usage.ts +20 -0
- package/src/budget/usage-outcomes.ts +8 -4
- package/src/capture/tui-self-report.ts +132 -1
- package/src/chat/goal-continue-verdict.ts +41 -0
- package/src/chat/index.ts +30 -4
- package/src/chat/internal-turn-origin.ts +1 -0
- package/src/chat/paste-fold.ts +86 -0
- package/src/chat/tool-render/block.ts +32 -0
- package/src/chat/tool-render/dispatch.ts +2 -20
- package/src/chat/tool-render/result-text.ts +98 -0
- package/src/chat/turn-typeahead.ts +70 -7
- package/src/cli/autopilot-cli.ts +24 -9
- package/src/cli/config-audit.ts +119 -0
- package/src/cli/decisions-cli.ts +7 -4
- package/src/cli/doctor-cli.ts +137 -6
- package/src/cli/guardian-cli.ts +10 -0
- package/src/cli/herdr-cli.ts +34 -0
- package/src/cli/light-entry-route.ts +6 -3
- package/src/cli/log-event-names.ts +2 -0
- package/src/cli/logs-cli.ts +357 -2
- package/src/cli/make-cli.ts +247 -11
- package/src/cli/memory-cli.ts +30 -1
- package/src/cli/msg-cli.ts +132 -14
- package/src/cli/pr-cli.ts +29 -16
- package/src/cli/pr-granularity.ts +5 -3
- package/src/cli/pr-land-base-read.ts +11 -2
- package/src/cli/pr-land-heavy-remote.ts +6 -3
- package/src/cli/pr-land-overlap-evidence.ts +23 -4
- package/src/cli/pr-land-recovery.ts +117 -1
- package/src/cli/pty-takeover-cli.ts +8 -7
- package/src/cli/release-checklist-read-cli.ts +109 -4
- package/src/cli/release-cli.ts +64 -15
- package/src/cli/release-single-flight.ts +1 -1
- package/src/cli/self-update.ts +23 -5
- package/src/cli/self-utterances-cli.ts +13 -16
- package/src/cli/tasks-card-show.ts +162 -0
- package/src/cli/tasks-cli.ts +868 -352
- package/src/cli/tasks-read-cli.ts +197 -0
- package/src/cli/usage-cli.ts +12 -10
- package/src/context-bus/claude-memory-import.ts +99 -0
- package/src/context-bus/long-term-memory.ts +125 -0
- package/src/core-turn/run-core-turn.ts +4 -2
- package/src/core-turn/run-goal-loop.ts +76 -16
- package/src/core-turn/types.ts +8 -1
- package/src/dashboard/chat/acp-chat.ts +9 -0
- package/src/dashboard/context/keys.ts +8 -31
- package/src/dashboard/index.ts +299 -62
- package/src/dashboard/input/agent-wake.ts +50 -1
- package/src/dashboard/input/chat-main-acp-dispatch.ts +21 -1
- package/src/dashboard/input/chat-main-plain-turn-runtime.ts +146 -3
- package/src/dashboard/input/chat-main-slash-command.ts +4 -2
- package/src/dashboard/input/goal-continue.ts +210 -0
- package/src/dashboard/input/goal-interim.ts +2 -0
- package/src/dashboard/input/internal-turn.ts +2 -8
- package/src/dashboard/input/seat-autowake.ts +9 -7
- package/src/dashboard/input/turn-autoheal.ts +52 -0
- package/src/dashboard/replay-preview.ts +25 -0
- package/src/dashboard/seat-boot-preamble.ts +132 -5
- package/src/dashboard/slash-runtime/chat-persona.ts +65 -8
- package/src/dashboard/slash-runtime/dashboard-handlers.ts +20 -10
- package/src/dashboard/slash-runtime/model-choices.ts +15 -0
- package/src/dashboard/stale-install-check.ts +3 -99
- package/src/dashboard/synchronized-frame-output.ts +74 -0
- package/src/debug/batch-queue.ts +119 -0
- package/src/debug/tui-log-tag.ts +67 -0
- package/src/display/agent-surface.ts +7 -0
- package/src/display/coordinator.ts +45 -12
- package/src/display/resize-listener.ts +41 -20
- package/src/display/synchronized-output-region.ts +60 -0
- package/src/domains/standalone-log-sink.ts +15 -2
- package/src/domains/surface-events.ts +80 -1
- package/src/esc-abort-gate.ts +69 -0
- package/src/exec-requests/planner.ts +37 -2
- package/src/execution-loop/launch-gate.ts +4 -3
- package/src/git-fs/cli-stderr.ts +45 -0
- package/src/git-fs/gh-cli.ts +6 -3
- package/src/git-fs/git-cli.ts +11 -5
- package/src/git-fs/worktree.ts +95 -1
- package/src/graph-runner/graph-cli.ts +44 -2
- package/src/graph-runner/graph-run-api.ts +3 -2
- package/src/graph-runner/runner.ts +37 -16
- package/src/graph-wizard/generate.ts +131 -4
- package/src/graph-wizard/steps.ts +15 -0
- package/src/grounding/proactive-ground.ts +86 -0
- package/src/harness/control-inbox.ts +49 -1
- package/src/harness/harness-cli-command.ts +230 -40
- package/src/harness/harness-incidents.ts +52 -1
- package/src/harness/pod-control-send.ts +33 -5
- package/src/harness/review-adapter.ts +26 -6
- package/src/harness/self-send-remote.ts +69 -0
- package/src/harness/self-send-routing-guard.ts +6 -0
- package/src/harness/self-send-target.ts +4 -3
- package/src/index.ts +443 -25
- package/src/input-core/context-key-runtime.ts +21 -0
- package/src/instance/test-write-guard-real-transport.fixture.ts +52 -0
- package/src/light-cli.ts +6 -1
- package/src/llm/route-decision.ts +13 -0
- package/src/llm-tool-name.ts +37 -0
- package/src/llm-tool-schema.ts +35 -0
- package/src/llm-wellformed.ts +70 -0
- package/src/llm.ts +158 -15
- package/src/loops/checker.ts +100 -0
- package/src/loops/consensus.ts +26 -2
- package/src/loops/loop-cli.ts +9 -4
- package/src/loops/msg-wake.ts +35 -39
- package/src/loops/orchestrator/anomaly-cluster.ts +243 -0
- package/src/loops/orchestrator/inbox.ts +59 -11
- package/src/loops/orchestrator/knowhow-pack.ts +364 -0
- package/src/loops/orchestrator/tick.ts +54 -5
- package/src/maturity/feature-maturity.ts +1 -1
- package/src/model-tier/llm-tier-map.ts +12 -17
- package/src/models/prompts.ts +17 -2
- package/src/msg/msg-post-office.ts +116 -0
- package/src/msg/msg-store.ts +17 -0
- package/src/mss/logging/log-store.ts +79 -22
- package/src/native-tool-catalog.ts +1 -1
- package/src/nexus/api/decisions-route.ts +38 -18
- package/src/nexus/api/graph-wizard-api.ts +46 -3
- package/src/nexus/api/grid.ts +24 -4
- package/src/nexus/api/http-server.ts +1 -1
- package/src/nexus/api/ops-api.ts +14 -6
- package/src/nexus/boot/register-mcp-clients.ts +263 -38
- package/src/nexus/onboarding/first-boot-wizard.ts +56 -8
- package/src/nexus/state/state.ts +7 -1
- package/src/oauth/codex-account-store.ts +34 -1
- package/src/onboarding/first-run.ts +37 -6
- package/src/onboarding/web-first.ts +43 -11
- package/src/ops/loops-map.ts +46 -0
- package/src/ops/overview-cache.ts +22 -4
- package/src/ops/overview-collect.ts +12 -6
- package/src/ops/overview.ts +44 -8
- package/src/persona/loader.ts +11 -0
- package/src/persona/types.ts +8 -0
- package/src/policy/llm-policy.ts +3 -1
- package/src/prompt-enhance/enhance.ts +4 -4
- package/src/prompt-library/session-guidance.ts +14 -0
- package/src/provider-summary.ts +8 -0
- package/src/pty-shell/availability.ts +7 -0
- package/src/pty-shell/herdr-agent-report.ts +155 -37
- package/src/pty-shell/herdr-prompt.ts +266 -0
- package/src/pty-shell/herdr-prune-stale.ts +17 -0
- package/src/pty-shell/herdr-sequence-lease.ts +60 -0
- package/src/pty-shell/pty-control-ipc.ts +327 -15
- package/src/pty-shell/pty-special-keys.ts +42 -2
- package/src/pty-shell/registry.ts +25 -15
- package/src/pty-shell/stale-install-check.ts +99 -0
- package/src/pty-shell/tui-run-state.ts +249 -3
- package/src/release-loop/auto-start.ts +20 -2
- package/src/release-loop/checklist.ts +126 -9
- package/src/release-loop/feature-store.ts +9 -9
- package/src/release-loop/landed-but-yellow.ts +93 -12
- package/src/release-loop/rehearsal.ts +36 -20
- package/src/repl/index.ts +27 -1
- package/src/seat-loop/knowhow-lint.ts +1 -1
- package/src/seat-loop/seat-report.ts +1 -0
- package/src/self-dev/ask-launch-flow.ts +86 -10
- package/src/self-dev/decompose-proposal.ts +183 -20
- package/src/self-dev/decompose.ts +61 -0
- package/src/self-dev/dev-cli.ts +37 -3
- package/src/self-dev/dev-pipeline.ts +37 -9
- package/src/self-dev/draft-sweep.ts +241 -16
- package/src/self-dev/draft-triage-rules.ts +50 -5
- package/src/self-dev/glm-credential-guard.ts +77 -0
- package/src/self-dev/graph-journey-nodes.ts +1 -0
- package/src/self-dev/graph-journey-route.ts +12 -2
- package/src/self-dev/orchestrate-cli.ts +68 -3
- package/src/self-dev/orchestrate.ts +116 -17
- package/src/self-dev/review-provider-fallback.ts +45 -7
- package/src/self-dev/run-supervisor.ts +55 -2
- package/src/self-dev/run-types.ts +1 -1
- package/src/self-dev/shard-plan.ts +48 -0
- package/src/self-dev/shard-run.ts +50 -3
- package/src/self-health/autoheal.ts +153 -0
- package/src/self-health/signatures.ts +6 -0
- package/src/self-implement/device-first.ts +116 -0
- package/src/self-implement/doctor-visit.ts +322 -1
- package/src/self-implement/evidence-command-budget.ts +80 -0
- package/src/self-implement/gate-artifacts.ts +6 -2
- package/src/self-implement/gate-baseline.ts +64 -1
- package/src/self-implement/gate-cli.ts +93 -9
- package/src/self-implement/gate-remote.ts +28 -4
- package/src/self-implement/gate-scope.ts +13 -1
- package/src/self-implement/goal-author-cli.ts +1 -0
- package/src/self-implement/goal-author-decompose.ts +265 -4
- package/src/self-implement/goal-author.ts +366 -26
- package/src/self-implement/goal-elaborate.ts +176 -22
- package/src/self-implement/goal-refine.ts +3 -0
- package/src/self-implement/goal-supervisor-fill.ts +75 -26
- package/src/self-implement/graph-variant.ts +40 -6
- package/src/self-implement/headless-elanous-driver.ts +19 -3
- package/src/self-implement/importer-test-index.ts +215 -2
- package/src/self-implement/knowhow-pack.ts +5 -5
- package/src/self-implement/off-diff-evidence.ts +58 -6
- package/src/self-implement/orchestrator.ts +536 -42
- package/src/self-implement/pod-warm-pool-profile.ts +1 -0
- package/src/self-implement/pwa-import-graph.ts +1 -1
- package/src/self-implement/review-round-brief.ts +300 -0
- package/src/self-implement/rework-policy.ts +44 -0
- package/src/self-implement/run-ledger.ts +278 -6
- package/src/self-implement/run-stop.ts +1 -1
- package/src/self-implement/run-ttl.ts +38 -24
- package/src/self-implement/running-runs.ts +17 -3
- package/src/self-implement/scope-adjacency.ts +3 -1
- package/src/self-implement/seams.ts +72 -10
- package/src/self-implement/stop-autoheal.ts +1 -0
- package/src/self-implement/test-seams.ts +13 -1
- package/src/self-implement/train-reach-grouping.ts +8 -2
- package/src/self-implement/wiring-check.ts +358 -0
- package/src/session/chat.ts +7 -1
- package/src/session/id-prefix.ts +60 -0
- package/src/session/index.ts +4 -0
- package/src/session-runtime/index.ts +9 -1
- package/src/shell-env-bootstrap.ts +11 -4
- package/src/skills/runner.ts +4 -2
- package/src/skills/tools/agent.ts +290 -48
- package/src/skills/tools/pty.ts +5 -0
- package/src/skills/tools/schedule-wakeup.ts +23 -4
- package/src/skills/tools/shell.ts +61 -6
- package/src/skills/tools/terminal-modal-inject.ts +1 -2
- package/src/skills/tools/terminal-modal.ts +10 -8
- package/src/skills/url-router.ts +41 -1
- package/src/smart-wizard/run.ts +66 -0
- package/src/status/bar.ts +34 -6
- package/src/status/metrics.ts +12 -1
- package/src/status/status-provider-info.ts +37 -6
- package/src/steward/rejudge-tick.ts +22 -7
- package/src/steward/resync-tick.ts +31 -4
- package/src/steward/ta-repair-event-collect.ts +17 -6
- package/src/task-agent/actions.ts +202 -5
- package/src/task-agent/boundary-proof-mapping.ts +12 -0
- package/src/task-agent/boundary-proof-producer.ts +147 -0
- package/src/task-agent/completion-evidence.ts +2 -1
- package/src/task-agent/green-close-recipe.ts +239 -0
- package/src/task-agent/green-sweep.ts +64 -10
- package/src/task-agent/land-queue.ts +21 -8
- package/src/task-agent/live-moves.ts +70 -9
- package/src/task-agent/map-host-adapter.ts +134 -0
- package/src/task-agent/map-reduce.ts +158 -0
- package/src/task-agent/map-run-ledger.ts +226 -0
- package/src/task-agent/mission.ts +30 -0
- package/src/task-agent/parent-host.ts +21 -11
- package/src/task-agent/rejudge-on-head.ts +87 -5
- package/src/task-agent/repair-cycle.ts +179 -32
- package/src/task-agent/repair-next-move.ts +42 -4
- package/src/task-agent/repair-outcomes.ts +29 -0
- package/src/task-agent/repair-worker.ts +14 -4
- package/src/task-agent/review-prior-fix.ts +12 -2
- package/src/task-agent/shadow.ts +229 -8
- package/src/task-agent/task-card-prefix.ts +2 -0
- package/src/task-agent/task-hand.ts +630 -30
- package/src/task-agent/task-parent-role-llm.ts +45 -0
- package/src/task-agent/tier-split.ts +80 -10
- package/src/task-agent/work-order.ts +53 -2
- package/src/task-orchestrator/dispatcher.ts +46 -1
- package/src/task-orchestrator/generator-prompt.ts +6 -0
- package/src/task-orchestrator/surfaces/pod-account-broker.ts +9 -0
- package/src/task-orchestrator/surfaces/pod-artifact-return.ts +16 -6
- package/src/task-orchestrator/surfaces/pod-child-reuse.ts +146 -0
- package/src/task-orchestrator/surfaces/pod-command-job.ts +86 -5
- package/src/task-orchestrator/surfaces/pod-failure-reason.ts +215 -3
- package/src/task-orchestrator/surfaces/pod-launch-history.ts +133 -0
- package/src/task-orchestrator/surfaces/pod-ledger-collect.ts +8 -6
- package/src/task-orchestrator/surfaces/pod-ledger-events.ts +97 -0
- package/src/task-orchestrator/surfaces/pod-manifest-test-normalize.ts +11 -0
- package/src/task-orchestrator/surfaces/pod-pool.ts +126 -8
- package/src/task-orchestrator/surfaces/pod-provenance.ts +8 -2
- package/src/task-orchestrator/surfaces/pod-repair-commit.ts +18 -3
- package/src/task-orchestrator/surfaces/pod-si-warm-entry.ts +16 -0
- package/src/task-orchestrator/surfaces/pod-si-warm-host.ts +224 -0
- package/src/task-orchestrator/surfaces/pod-si-warm-protocol.ts +201 -0
- package/src/task-orchestrator/surfaces/pod-si-warm-provider.ts +444 -0
- package/src/task-orchestrator/surfaces/pod-si-warm-runner.ts +387 -0
- package/src/task-orchestrator/surfaces/pod-si-warm-transport.ts +157 -0
- package/src/task-orchestrator/surfaces/pod-warm-worker-protocol.ts +4 -0
- package/src/task-orchestrator/surfaces/pod-warm-worker-provider.ts +491 -36
- package/src/task-orchestrator/surfaces/pod-warm-worker-runtime.ts +3 -0
- package/src/task-orchestrator/surfaces/self-implement-pod.ts +612 -54
- package/src/task-orchestrator/surfaces/self-implement.ts +46 -2
- package/src/testing/linux-env.ts +177 -0
- package/src/tool-runtime/index.ts +15 -2
- package/src/tool-runtime/mcp-proxy-bootstrap.ts +29 -0
- package/src/tty-foreground.ts +155 -0
- package/src/tui/chat/goal-interim.ts +177 -0
- package/src/tui/chat/log-view.ts +205 -18
- package/src/tui/chat/self-health-status.ts +232 -0
- package/src/tui/entry.ts +623 -80
- package/src/tui/input/at-picker.ts +55 -0
- package/src/tui/input/composer.ts +8 -1
- package/src/tui/slash/compact-command.ts +7 -0
- package/src/tui/slash/compact.ts +1 -7
- package/src/tui/slash/resume.ts +98 -0
- package/src/tui/slash/signals.ts +114 -0
- package/src/tui/slash/term-next.ts +71 -0
- package/src/tui-client/local-chat-turn.ts +49 -5
- package/src/tui-client/next-dashboard-runtime.ts +8 -0
- package/src/tui-client/next-loop-command.ts +70 -0
- package/src/tui-client/next-wakeup.ts +191 -0
- package/src/tui.ts +37 -0
- package/src/ui/modal-adapter.ts +2 -2
- package/src/user-config.ts +19 -1
- package/src/ux-sim/boot-daemon-tools-pty-shell-device.ts +136 -0
- package/src/ux-sim/classic-tui-seat-scenarios.ts +670 -0
- package/src/ux-sim/cli-config-audit-device.ts +121 -0
- package/src/ux-sim/dashboard-event-loop-stall-monitor-device.ts +238 -0
- package/src/ux-sim/event-monkey.ts +3 -2
- package/src/ux-sim/fake-bin.ts +45 -0
- package/src/ux-sim/fake-gh.ts +174 -0
- package/src/ux-sim/fake-herdr.ts +238 -0
- package/src/ux-sim/fake-kubectl.ts +142 -0
- package/src/ux-sim/fake-llm.ts +116 -6
- package/src/ux-sim/fault-glm-no-credential.ts +116 -0
- package/src/ux-sim/fault-nextmove-dispatch.ts +102 -1
- package/src/ux-sim/fault-scope-escape-lift.ts +33 -6
- package/src/ux-sim/fault-tui-400-autoheal.ts +297 -0
- package/src/ux-sim/goal-device.ts +619 -0
- package/src/ux-sim/in-process-cli.ts +22 -5
- package/src/ux-sim/mock-authoring-first-run-child.ts +35 -0
- package/src/ux-sim/mock-authoring-first-run.ts +97 -0
- package/src/ux-sim/mock-seat-pty-frame-child.ts +29 -0
- package/src/ux-sim/mock-seat-pty-frame.ts +297 -0
- package/src/ux-sim/mock-seat-pty-sequence-child.ts +21 -0
- package/src/ux-sim/mock-seat-pty-sequence.ts +206 -0
- package/src/ux-sim/next-tui-seat-scenarios.ts +749 -0
- package/src/ux-sim/onboarding-first-run-device.ts +269 -0
- package/src/ux-sim/pty-key-modifiers-device.ts +85 -0
- package/src/ux-sim/resume-picker-device.ts +173 -0
- package/src/ux-sim/session-id-seed.ts +60 -0
- package/src/ux-sim/skills-tools-shell-device.ts +156 -0
- package/src/ux-sim/subagent-tools-device.ts +81 -0
- package/src/ux-sim/task-agent-parent-host-device.ts +264 -0
- package/src/ux-sim/task-agent-rejudge-on-head-device.ts +114 -0
- package/src/ux-sim/task-orchestrator-surfaces-self-implement-pod-device.ts +250 -0
- package/src/ux-sim/tty-foreground-steal-child.ts +21 -0
- package/src/version/packed-revision.json +1 -1
- package/apps/pwa/out/_next/static/chunks/1540.af38731fa7c4a3e0.js +0 -41
- package/apps/pwa/out/_next/static/chunks/1674.2a65fd5668e1cc5f.js +0 -1
- package/apps/pwa/out/_next/static/chunks/1850.f2b470ba5a471da0.js +0 -24
- package/apps/pwa/out/_next/static/chunks/193.62da94cd0b88323b.js +0 -74
- package/apps/pwa/out/_next/static/chunks/1975.260f6d249fac5f7c.js +0 -1
- package/apps/pwa/out/_next/static/chunks/1982-67cd8dfe8682325f.js +0 -1
- package/apps/pwa/out/_next/static/chunks/1993-c0007b7ad0c0ef41.js +0 -1
- package/apps/pwa/out/_next/static/chunks/1999-bb415351c8a2846c.js +0 -1
- package/apps/pwa/out/_next/static/chunks/1c735de4.f993a30bbd3c57c4.js +0 -1
- package/apps/pwa/out/_next/static/chunks/2085.8f950b4bda1cbbc7.js +0 -1
- package/apps/pwa/out/_next/static/chunks/2159-6179a961376956b9.js +0 -1
- package/apps/pwa/out/_next/static/chunks/216.b5c2a421aa1d28a5.js +0 -1
- package/apps/pwa/out/_next/static/chunks/2251.49fbe369f74c372c.js +0 -148
- package/apps/pwa/out/_next/static/chunks/2286-2939577360d3dcc0.js +0 -1
- package/apps/pwa/out/_next/static/chunks/2625.5d870aa999f33db1.js +0 -34
- package/apps/pwa/out/_next/static/chunks/2668.34d21539e62bf111.js +0 -77
- package/apps/pwa/out/_next/static/chunks/2930.d0edb4f108787ef7.js +0 -1
- package/apps/pwa/out/_next/static/chunks/2973.77318e7d85f59477.js +0 -62
- package/apps/pwa/out/_next/static/chunks/3103.0df8da390948bb84.js +0 -1
- package/apps/pwa/out/_next/static/chunks/3123.2bee9ba15d320bd2.js +0 -90
- package/apps/pwa/out/_next/static/chunks/3162-6cf652bf7124d8cf.js +0 -1
- package/apps/pwa/out/_next/static/chunks/3577-7340009f7007a795.js +0 -1
- package/apps/pwa/out/_next/static/chunks/3589.5444a06bcf6e775c.js +0 -1
- package/apps/pwa/out/_next/static/chunks/3618.f514792d6c59d7fd.js +0 -36
- package/apps/pwa/out/_next/static/chunks/3669.343f9119aa276001.js +0 -1
- package/apps/pwa/out/_next/static/chunks/3677-4215f826f6aa68e5.js +0 -1
- package/apps/pwa/out/_next/static/chunks/3736.c2efad489604cc3b.js +0 -79
- package/apps/pwa/out/_next/static/chunks/3817.f9aeab2bb6675d73.js +0 -1
- package/apps/pwa/out/_next/static/chunks/4182-0b9b1251c29cc0cf.js +0 -1
- package/apps/pwa/out/_next/static/chunks/4346.8601952e73bf5803.js +0 -1
- package/apps/pwa/out/_next/static/chunks/4582.bd68683c076649e3.js +0 -286
- package/apps/pwa/out/_next/static/chunks/4605-6e623f55aec77422.js +0 -1
- package/apps/pwa/out/_next/static/chunks/4607.5cc27468628eb4bf.js +0 -1
- package/apps/pwa/out/_next/static/chunks/4627.f07508b3936fd6c0.js +0 -24
- package/apps/pwa/out/_next/static/chunks/4747-c22262c093e46807.js +0 -1
- package/apps/pwa/out/_next/static/chunks/4775-178215aed0daba61.js +0 -1
- package/apps/pwa/out/_next/static/chunks/4815-6ffb8c3c991cc45d.js +0 -1
- package/apps/pwa/out/_next/static/chunks/4834-beca8b47ad29a898.js +0 -1
- package/apps/pwa/out/_next/static/chunks/5023-fb4802b6d2492b02.js +0 -1
- package/apps/pwa/out/_next/static/chunks/5154.a118f3957ed14e36.js +0 -1
- package/apps/pwa/out/_next/static/chunks/5210-a2e0015e3d4d5d9c.js +0 -1
- package/apps/pwa/out/_next/static/chunks/5356.84ac712cc15928bf.js +0 -1
- package/apps/pwa/out/_next/static/chunks/5401.22352141b6fd336e.js +0 -23
- package/apps/pwa/out/_next/static/chunks/5637.281e5dec4ea6ecf1.js +0 -94
- package/apps/pwa/out/_next/static/chunks/5662.02eaa029af05ad46.js +0 -1
- package/apps/pwa/out/_next/static/chunks/56d372f2.681ab4ec4c998fae.js +0 -1
- package/apps/pwa/out/_next/static/chunks/5760.22456f433c6f42c0.js +0 -1
- package/apps/pwa/out/_next/static/chunks/5852.db1f7449f4f74612.js +0 -287
- package/apps/pwa/out/_next/static/chunks/5891-0f11a7d7362a9072.js +0 -1
- package/apps/pwa/out/_next/static/chunks/5943.264d14a44ca32513.js +0 -1
- package/apps/pwa/out/_next/static/chunks/604-1b3c39df083c02aa.js +0 -1
- package/apps/pwa/out/_next/static/chunks/6121-5f97072330738caf.js +0 -1
- package/apps/pwa/out/_next/static/chunks/6193.07d8ca5af4b09086.js +0 -1
- package/apps/pwa/out/_next/static/chunks/6203-b3fea3a60d69ff14.js +0 -1
- package/apps/pwa/out/_next/static/chunks/6286.d638fb5953e2e757.js +0 -8
- package/apps/pwa/out/_next/static/chunks/630.fe5a46428d63b013.js +0 -1
- package/apps/pwa/out/_next/static/chunks/6301.ae0245f507e4395e.js +0 -1
- package/apps/pwa/out/_next/static/chunks/6673.fbbe5699f6ea5991.js +0 -27
- package/apps/pwa/out/_next/static/chunks/6777-f6d301efb5de828d.js +0 -1
- package/apps/pwa/out/_next/static/chunks/6786.423f24c88de034c7.js +0 -93
- package/apps/pwa/out/_next/static/chunks/6854-cef64a948c5e122d.js +0 -1
- package/apps/pwa/out/_next/static/chunks/6b89c8bd.24df687a820500b3.js +0 -1
- package/apps/pwa/out/_next/static/chunks/7037-fe27f001db30d323.js +0 -1
- package/apps/pwa/out/_next/static/chunks/7080.2d826860534fd88e.js +0 -1
- package/apps/pwa/out/_next/static/chunks/7118.8731be28c3ebb14b.js +0 -1
- package/apps/pwa/out/_next/static/chunks/7196.44241bc1df3e26fe.js +0 -149
- package/apps/pwa/out/_next/static/chunks/7235.c7c4e6cb5c693c2d.js +0 -104
- package/apps/pwa/out/_next/static/chunks/7706-58bfb1546637f217.js +0 -1
- package/apps/pwa/out/_next/static/chunks/7839.5b91455338c9fd3f.js +0 -1
- package/apps/pwa/out/_next/static/chunks/7857-31f13ee96f4011aa.js +0 -1
- package/apps/pwa/out/_next/static/chunks/81.f74cb60312fe4001.js +0 -1
- package/apps/pwa/out/_next/static/chunks/8219.baa715d1deee80e2.js +0 -1
- package/apps/pwa/out/_next/static/chunks/8256.e3ac8421a71f82f4.js +0 -1
- package/apps/pwa/out/_next/static/chunks/8310-444a6a895c402f12.js +0 -1
- package/apps/pwa/out/_next/static/chunks/8423.f7dda8aca4fcaae5.js +0 -1
- package/apps/pwa/out/_next/static/chunks/8437-8d5492094b166cfa.js +0 -1
- package/apps/pwa/out/_next/static/chunks/8496.75649af8652c74f4.js +0 -226
- package/apps/pwa/out/_next/static/chunks/8576.65bb654b524f3614.js +0 -1
- package/apps/pwa/out/_next/static/chunks/8609.558ce2f8f9aea2be.js +0 -64
- package/apps/pwa/out/_next/static/chunks/8614.caec96cfb91f4ae7.js +0 -1
- package/apps/pwa/out/_next/static/chunks/8637.47f5b35afcae5e6b.js +0 -1
- package/apps/pwa/out/_next/static/chunks/8714.ff0b7ce3ec3e3ae2.js +0 -1
- package/apps/pwa/out/_next/static/chunks/8732.367f44a916202353.js +0 -1
- package/apps/pwa/out/_next/static/chunks/9141-7fd1f73a5400bdc2.js +0 -1
- package/apps/pwa/out/_next/static/chunks/921.c4267d0d69a65404.js +0 -1
- package/apps/pwa/out/_next/static/chunks/9261.3962c3321b047691.js +0 -115
- package/apps/pwa/out/_next/static/chunks/936-26efd1a0efdd44d3.js +0 -1
- package/apps/pwa/out/_next/static/chunks/9627-4b9efe616b27e2e2.js +0 -1
- package/apps/pwa/out/_next/static/chunks/967-2aa39b2d04b4c690.js +0 -1
- package/apps/pwa/out/_next/static/chunks/9734.40eb1e558c29ccea.js +0 -1
- package/apps/pwa/out/_next/static/chunks/9908.3aa54f7a586a73dc.js +0 -1
- package/apps/pwa/out/_next/static/chunks/9954-ca8d29752bdbb45a.js +0 -1
- package/apps/pwa/out/_next/static/chunks/9974-507fa67cb94066dd.js +0 -1
- package/apps/pwa/out/_next/static/chunks/app/_not-found/page-ce9e00f7fb45506a.js +0 -1
- package/apps/pwa/out/_next/static/chunks/app/approvals/page-fa59d6d17daa3389.js +0 -1
- package/apps/pwa/out/_next/static/chunks/app/autopilot/page-53f68bbe7bd4b774.js +0 -1
- package/apps/pwa/out/_next/static/chunks/app/board/page-1c500fbb9f4a7a04.js +0 -1
- package/apps/pwa/out/_next/static/chunks/app/botlab/page-99d72673aa5c307c.js +0 -1
- package/apps/pwa/out/_next/static/chunks/app/bots/page-d2d5adc1e9484c88.js +0 -1
- package/apps/pwa/out/_next/static/chunks/app/ceo/page-c607c5aae637f1cc.js +0 -1
- package/apps/pwa/out/_next/static/chunks/app/chat/page-fa8c23596d555c0f.js +0 -1
- package/apps/pwa/out/_next/static/chunks/app/consult/page-bdab8c5e855c8416.js +0 -1
- package/apps/pwa/out/_next/static/chunks/app/control/page-406b47745b53f269.js +0 -1
- package/apps/pwa/out/_next/static/chunks/app/decisions/page-a4276386b7051f50.js +0 -1
- package/apps/pwa/out/_next/static/chunks/app/design-check/page-8a26bab9ad375f25.js +0 -1
- package/apps/pwa/out/_next/static/chunks/app/editor/page-775f48aa1dc7a2d5.js +0 -1
- package/apps/pwa/out/_next/static/chunks/app/exec/page-1c4dd5f959d0c558.js +0 -1
- package/apps/pwa/out/_next/static/chunks/app/field/page-c48938a8377c9f70.js +0 -1
- package/apps/pwa/out/_next/static/chunks/app/healthz/route-ce9e00f7fb45506a.js +0 -1
- package/apps/pwa/out/_next/static/chunks/app/inside/page-c6e7905859425aa9.js +0 -1
- package/apps/pwa/out/_next/static/chunks/app/intake/page-c280f4252452e830.js +0 -1
- package/apps/pwa/out/_next/static/chunks/app/layout-cf8c57498f20970a.js +0 -1
- package/apps/pwa/out/_next/static/chunks/app/live/page-ca3a17caf409fc83.js +0 -1
- package/apps/pwa/out/_next/static/chunks/app/live-run/page-26e6c18a1a750cf6.js +0 -1
- package/apps/pwa/out/_next/static/chunks/app/loops/page-3abc872cc6aeee39.js +0 -1
- package/apps/pwa/out/_next/static/chunks/app/market/page-f7481b7b2174fe3d.js +0 -1
- package/apps/pwa/out/_next/static/chunks/app/missions/[id]/page-1ae7ef8077680337.js +0 -1
- package/apps/pwa/out/_next/static/chunks/app/not-found-415f1e243c7ccb13.js +0 -1
- package/apps/pwa/out/_next/static/chunks/app/observatory/page-73f380f17b76f95c.js +0 -1
- package/apps/pwa/out/_next/static/chunks/app/ops/checklist/page-2991073ad66ee2d9.js +0 -1
- package/apps/pwa/out/_next/static/chunks/app/ops/seats/page-fbad60d1e358fb2c.js +0 -1
- package/apps/pwa/out/_next/static/chunks/app/page-398047d6949e8ca5.js +0 -1
- package/apps/pwa/out/_next/static/chunks/app/reflection/page-2d33a2231540ca89.js +0 -1
- package/apps/pwa/out/_next/static/chunks/app/scheduler/page-5bf1e6bf70bcb96c.js +0 -1
- package/apps/pwa/out/_next/static/chunks/app/sessions/page-ba59c19376a0917d.js +0 -1
- package/apps/pwa/out/_next/static/chunks/app/settings/devices/page-111f187139add30f.js +0 -1
- package/apps/pwa/out/_next/static/chunks/app/settings/page-acaae197d5be5779.js +0 -1
- package/apps/pwa/out/_next/static/chunks/app/setup/done/page-0df20b0f546a0d7d.js +0 -1
- package/apps/pwa/out/_next/static/chunks/app/setup/layout-ce9e00f7fb45506a.js +0 -1
- package/apps/pwa/out/_next/static/chunks/app/setup/page-27e1202d24b8fe35.js +0 -1
- package/apps/pwa/out/_next/static/chunks/app/share/page-bda78c50a78363e5.js +0 -1
- package/apps/pwa/out/_next/static/chunks/app/showroom/page-da592691293d9c9f.js +0 -1
- package/apps/pwa/out/_next/static/chunks/app/tasks/page-f832994317a2e9f0.js +0 -1
- package/apps/pwa/out/_next/static/chunks/app/today/page-cfccbbeae0473404.js +0 -1
- package/apps/pwa/out/_next/static/chunks/app/trace/page-527e2073af84c81b.js +0 -1
- package/apps/pwa/out/_next/static/chunks/app/vault/page-bac86e9112671357.js +0 -1
- package/apps/pwa/out/_next/static/chunks/app/workflows/chat-ui/page-6d59dff410e9d76a.js +0 -1
- package/apps/pwa/out/_next/static/chunks/app/workflows/page-53a61f8be09f02d2.js +0 -1
- package/apps/pwa/out/_next/static/chunks/app/workspace/page-db8f559e763c17f9.js +0 -1
- package/apps/pwa/out/_next/static/chunks/app/worktrees/page-c02aa4cc66455093.js +0 -1
- package/apps/pwa/out/_next/static/chunks/framework-50e6acebc630849b.js +0 -1
- package/apps/pwa/out/_next/static/chunks/main-7a1ae342d5ed75e6.js +0 -1
- package/apps/pwa/out/_next/static/chunks/main-app-7ad7d505ba1f92b4.js +0 -1
- package/apps/pwa/out/_next/static/chunks/pages/_app-02edba75232cb235.js +0 -1
- package/apps/pwa/out/_next/static/chunks/pages/_error-97d6ebae3e8eee4a.js +0 -1
- package/apps/pwa/out/_next/static/chunks/webpack-e986adaa429163e8.js +0 -1
- /package/apps/pwa/out/_next/static/{T1mBQqmkwKDLGtyisDCOd → 8kITumG9GAZ1LwT9POrAR}/_ssgManifest.js +0 -0
package/apps/pwa/out/_next/static/chunks/{7644.17e37ba6f1d4226e.js → 7867.e8725745ddd1d940.js}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[7644],{33728:(e,t,s)=>{s.d(t,{P:()=>r});var i=s(50755),n=s(25205),a=s(89419),r=(0,a.K)((e,t,s,a)=>{e.attr("class",s);let{width:r,height:c,x:h,y:d}=o(e,t);(0,i.a$)(e,c,r,a);let u=l(h,d,r,c,t);e.attr("viewBox",u),n.R.debug(`viewBox configured: ${u} with padding: ${t}`)},"setupViewPortForSVG"),o=(0,a.K)((e,t)=>{let s=e.node()?.getBBox()||{width:0,height:0,x:0,y:0};return{width:s.width+2*t,height:s.height+2*t,x:s.x,y:s.y}},"calculateDimensionsWithPadding"),l=(0,a.K)((e,t,s,i,n)=>`${e-n} ${t-n} ${s} ${i}`,"createViewBox")},40651:(e,t,s)=>{s.d(t,{A:()=>a});var i=s(89419),n=s(24212),a=(0,i.K)((e,t)=>{let s;return"sandbox"===t&&(s=(0,n.Ltv)("#i"+e)),("sandbox"===t?(0,n.Ltv)(s.nodes()[0].contentDocument.body):(0,n.Ltv)("body")).select(`[id="${e}"]`)},"getDiagramElement")},47644:(e,t,s)=>{s.d(t,{diagram:()=>nN});var i,n,a,r,o=s(40651),l=s(33728),c=s(4978);s(75967),s(25105),s(45140),s(72678),s(90032),s(95659);var h=s(46816);s(92556);var d=s(21477),u=s(33245),p=s(50755),f=s(25205),m=s(89419);function E(e){function t(){}t.prototype=e;let s=new t;function i(){return typeof s.bar}return i(),i(),e}class T{get definition(){return this._definition}set definition(e){this._definition=e}constructor(e){this._definition=e}accept(e){e.visit(this),this.definition.forEach(t=>{t.accept(e)})}}class g extends T{constructor(e){super([]),this.idx=1,Object.assign(this,b(e))}set definition(e){}get definition(){return void 0!==this.referencedRule?this.referencedRule.definition:[]}accept(e){e.visit(this)}}class y extends T{constructor(e){super(e.definition),this.orgText="",Object.assign(this,b(e))}}class A extends T{constructor(e){super(e.definition),this.ignoreAmbiguities=!1,Object.assign(this,b(e))}}class S extends T{constructor(e){super(e.definition),this.idx=1,Object.assign(this,b(e))}}class L extends T{constructor(e){super(e.definition),this.idx=1,Object.assign(this,b(e))}}class O extends T{constructor(e){super(e.definition),this.idx=1,Object.assign(this,b(e))}}class R extends T{constructor(e){super(e.definition),this.idx=1,Object.assign(this,b(e))}}class k extends T{constructor(e){super(e.definition),this.idx=1,Object.assign(this,b(e))}}class I extends T{get definition(){return this._definition}set definition(e){this._definition=e}constructor(e){super(e.definition),this.idx=1,this.ignoreAmbiguities=!1,this.hasPredicates=!1,Object.assign(this,b(e))}}class N{constructor(e){this.idx=1,Object.assign(this,b(e))}accept(e){e.visit(this)}}function b(e){return Object.fromEntries(Object.entries(e).filter(([,e])=>void 0!==e))}class C{visit(e){switch(e.constructor){case g:return this.visitNonTerminal(e);case A:return this.visitAlternative(e);case S:return this.visitOption(e);case L:return this.visitRepetitionMandatory(e);case O:return this.visitRepetitionMandatoryWithSeparator(e);case k:return this.visitRepetitionWithSeparator(e);case R:return this.visitRepetition(e);case I:return this.visitAlternation(e);case N:return this.visitTerminal(e);case y:return this.visitRule(e);default:throw Error("non exhaustive match")}}visitNonTerminal(e){}visitAlternative(e){}visitOption(e){}visitRepetition(e){}visitRepetitionMandatory(e){}visitRepetitionMandatoryWithSeparator(e){}visitRepetitionWithSeparator(e){}visitAlternation(e){}visitTerminal(e){}visitRule(e){}}function _(e,t=[]){return e instanceof S||e instanceof R||e instanceof k||(e instanceof I?e.definition.some(e=>_(e,t)):!(e instanceof g&&t.includes(e))&&e instanceof T&&(e instanceof g&&t.push(e),e.definition.every(e=>_(e,t))))}function v(e){if(e instanceof g)return"SUBRULE";if(e instanceof S)return"OPTION";if(e instanceof I)return"OR";if(e instanceof L)return"AT_LEAST_ONE";if(e instanceof O)return"AT_LEAST_ONE_SEP";else if(e instanceof k)return"MANY_SEP";else if(e instanceof R)return"MANY";else if(e instanceof N)return"CONSUME";else throw Error("non exhaustive match")}class x{walk(e,t=[]){e.definition.forEach((s,i)=>{let n=e.definition.slice(i+1);if(s instanceof g)this.walkProdRef(s,n,t);else if(s instanceof N)this.walkTerminal(s,n,t);else if(s instanceof A)this.walkFlat(s,n,t);else if(s instanceof S)this.walkOption(s,n,t);else if(s instanceof L)this.walkAtLeastOne(s,n,t);else if(s instanceof O)this.walkAtLeastOneSep(s,n,t);else if(s instanceof k)this.walkManySep(s,n,t);else if(s instanceof R)this.walkMany(s,n,t);else if(s instanceof I)this.walkOr(s,n,t);else throw Error("non exhaustive match")})}walkTerminal(e,t,s){}walkProdRef(e,t,s){}walkFlat(e,t,s){let i=t.concat(s);this.walk(e,i)}walkOption(e,t,s){let i=t.concat(s);this.walk(e,i)}walkAtLeastOne(e,t,s){let i=[new S({definition:e.definition})].concat(t,s);this.walk(e,i)}walkAtLeastOneSep(e,t,s){let i=U(e,t,s);this.walk(e,i)}walkMany(e,t,s){let i=[new S({definition:e.definition})].concat(t,s);this.walk(e,i)}walkManySep(e,t,s){let i=U(e,t,s);this.walk(e,i)}walkOr(e,t,s){let i=t.concat(s);e.definition.forEach(e=>{let t=new A({definition:[e]});this.walk(t,i)})}}function U(e,t,s){return[new S({definition:[new N({terminalType:e.separator})].concat(e.definition)})].concat(t,s)}function M(e){if(e instanceof g)return M(e.referencedRule);if(e instanceof N)return[e.terminalType];if(e instanceof A||e instanceof S||e instanceof R||e instanceof L||e instanceof O||e instanceof k||e instanceof N||e instanceof y)return function(e){let t,s=[],i=e.definition,n=0,a=i.length>n,r=!0;for(;a&&r;)r=_(t=i[n]),s=s.concat(M(t)),n+=1,a=i.length>n;return[...new Set(s)]}(e);if(e instanceof I)return[...new Set(e.definition.map(e=>M(e)).flat())];throw Error("non exhaustive match")}let w="_~IN~_";class P extends x{constructor(e){super(),this.topProd=e,this.follows={}}startWalking(){return this.walk(this.topProd),this.follows}walkTerminal(e,t,s){}walkProdRef(e,t,s){var i,n;let a=(i=e.referencedRule,n=e.idx,i.name+n+w+this.topProd.name),r=M(new A({definition:t.concat(s)}));this.follows[a]=r}}function D(e){return e.charCodeAt(0)}function $(e,t){Array.isArray(e)?e.forEach(function(e){t.push(e)}):t.push(e)}function K(e,t){if(!0===e[t])throw"duplicate flag "+t;e[t],e[t]=!0}function F(e){if(void 0===e)throw Error("Internal Error - Should never get here!");return!0}function B(){throw Error("Internal Error - Should never get here!")}function j(e){return"Character"===e.type}let G=[];for(let e=D("0");e<=D("9");e++)G.push(e);let W=[D("_")].concat(G);for(let e=D("a");e<=D("z");e++)W.push(e);for(let e=D("A");e<=D("Z");e++)W.push(e);let V=[D(" "),D("\f"),D("\n"),D("\r"),D(" "),D("\v"),D(" "),D("\xa0"),D(" "),D(" "),D(" "),D(" "),D(" "),D(" "),D(" "),D(" "),D(" "),D(" "),D(" "),D(" "),D("\u2028"),D("\u2029"),D(" "),D(" "),D(" "),D("\uFEFF")],z=/[0-9a-fA-F]/,H=/[0-9]/,Y=/[1-9]/;class X{constructor(){this.idx=0,this.input="",this.groupIdx=0}saveState(){return{idx:this.idx,input:this.input,groupIdx:this.groupIdx}}restoreState(e){this.idx=e.idx,this.input=e.input,this.groupIdx=e.groupIdx}pattern(e){this.idx=0,this.input=e,this.groupIdx=0,this.consumeChar("/");let t=this.disjunction();this.consumeChar("/");let s={type:"Flags",loc:{begin:this.idx,end:e.length},global:!1,ignoreCase:!1,multiLine:!1,unicode:!1,sticky:!1};for(;this.isRegExpFlag();)switch(this.popChar()){case"g":K(s,"global");break;case"i":K(s,"ignoreCase");break;case"m":K(s,"multiLine");break;case"u":K(s,"unicode");break;case"y":K(s,"sticky")}if(this.idx!==this.input.length)throw Error("Redundant input: "+this.input.substring(this.idx));return{type:"Pattern",flags:s,value:t,loc:this.loc(0)}}disjunction(){let e=[],t=this.idx;for(e.push(this.alternative());"|"===this.peekChar();)this.consumeChar("|"),e.push(this.alternative());return{type:"Disjunction",value:e,loc:this.loc(t)}}alternative(){let e=[],t=this.idx;for(;this.isTerm();)e.push(this.term());return{type:"Alternative",value:e,loc:this.loc(t)}}term(){return this.isAssertion()?this.assertion():this.atom()}assertion(){let e=this.idx;switch(this.popChar()){case"^":return{type:"StartAnchor",loc:this.loc(e)};case"$":return{type:"EndAnchor",loc:this.loc(e)};case"\\":switch(this.popChar()){case"b":return{type:"WordBoundary",loc:this.loc(e)};case"B":return{type:"NonWordBoundary",loc:this.loc(e)}}throw Error("Invalid Assertion Escape");case"(":let t;switch(this.consumeChar("?"),this.popChar()){case"=":t="Lookahead";break;case"!":t="NegativeLookahead";break;case"<":switch(this.popChar()){case"=":t="Lookbehind";break;case"!":t="NegativeLookbehind"}}F(t);let s=this.disjunction();return this.consumeChar(")"),{type:t,value:s,loc:this.loc(e)}}return B()}quantifier(e=!1){let t,s=this.idx;switch(this.popChar()){case"*":t={atLeast:0,atMost:1/0};break;case"+":t={atLeast:1,atMost:1/0};break;case"?":t={atLeast:0,atMost:1};break;case"{":let i=this.integerIncludingZero();switch(this.popChar()){case"}":t={atLeast:i,atMost:i};break;case",":t=this.isDigit()?{atLeast:i,atMost:this.integerIncludingZero()}:{atLeast:i,atMost:1/0},this.consumeChar("}")}if(!0===e&&void 0===t)return;F(t)}if((!0!==e||void 0!==t)&&F(t))return"?"===this.peekChar(0)?(this.consumeChar("?"),t.greedy=!1):t.greedy=!0,t.type="Quantifier",t.loc=this.loc(s),t}atom(){let e,t=this.idx;switch(this.peekChar()){case".":e=this.dotAll();break;case"\\":e=this.atomEscape();break;case"[":e=this.characterClass();break;case"(":e=this.group()}return(void 0===e&&this.isPatternCharacter()&&(e=this.patternCharacter()),F(e))?(e.loc=this.loc(t),this.isQuantifier()&&(e.quantifier=this.quantifier()),e):B()}dotAll(){return this.consumeChar("."),{type:"Set",complement:!0,value:[D("\n"),D("\r"),D("\u2028"),D("\u2029")]}}atomEscape(){switch(this.consumeChar("\\"),this.peekChar()){case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":return this.decimalEscapeAtom();case"d":case"D":case"s":case"S":case"w":case"W":return this.characterClassEscape();case"f":case"n":case"r":case"t":case"v":return this.controlEscapeAtom();case"c":return this.controlLetterEscapeAtom();case"0":return this.nulCharacterAtom();case"x":return this.hexEscapeSequenceAtom();case"u":return this.regExpUnicodeEscapeSequenceAtom();default:return this.identityEscapeAtom()}}decimalEscapeAtom(){return{type:"GroupBackReference",value:this.positiveInteger()}}characterClassEscape(){let e,t=!1;switch(this.popChar()){case"d":e=G;break;case"D":e=G,t=!0;break;case"s":e=V;break;case"S":e=V,t=!0;break;case"w":e=W;break;case"W":e=W,t=!0}return F(e)?{type:"Set",value:e,complement:t}:B()}controlEscapeAtom(){let e;switch(this.popChar()){case"f":e=D("\f");break;case"n":e=D("\n");break;case"r":e=D("\r");break;case"t":e=D(" ");break;case"v":e=D("\v")}return F(e)?{type:"Character",value:e}:B()}controlLetterEscapeAtom(){this.consumeChar("c");let e=this.popChar();if(!1===/[a-zA-Z]/.test(e))throw Error("Invalid ");return{type:"Character",value:e.toUpperCase().charCodeAt(0)-64}}nulCharacterAtom(){return this.consumeChar("0"),{type:"Character",value:D("\0")}}hexEscapeSequenceAtom(){return this.consumeChar("x"),this.parseHexDigits(2)}regExpUnicodeEscapeSequenceAtom(){return this.consumeChar("u"),this.parseHexDigits(4)}identityEscapeAtom(){return{type:"Character",value:D(this.popChar())}}classPatternCharacterAtom(){switch(this.peekChar()){case"\n":case"\r":case"\u2028":case"\u2029":case"\\":case"]":throw Error("TBD");default:return{type:"Character",value:D(this.popChar())}}}characterClass(){let e=[],t=!1;for(this.consumeChar("["),"^"===this.peekChar(0)&&(this.consumeChar("^"),t=!0);this.isClassAtom();){let t=this.classAtom();if(t.type,j(t)&&this.isRangeDash()){this.consumeChar("-");let s=this.classAtom();if(s.type,j(s)){if(s.value<t.value)throw Error("Range out of order in character class");e.push({from:t.value,to:s.value})}else $(t.value,e),e.push(D("-")),$(s.value,e)}else $(t.value,e)}return this.consumeChar("]"),{type:"Set",complement:t,value:e}}classAtom(){switch(this.peekChar()){case"]":case"\n":case"\r":case"\u2028":case"\u2029":throw Error("TBD");case"\\":return this.classEscape();default:return this.classPatternCharacterAtom()}}classEscape(){switch(this.consumeChar("\\"),this.peekChar()){case"b":return this.consumeChar("b"),{type:"Character",value:D("\b")};case"d":case"D":case"s":case"S":case"w":case"W":return this.characterClassEscape();case"f":case"n":case"r":case"t":case"v":return this.controlEscapeAtom();case"c":return this.controlLetterEscapeAtom();case"0":return this.nulCharacterAtom();case"x":return this.hexEscapeSequenceAtom();case"u":return this.regExpUnicodeEscapeSequenceAtom();default:return this.identityEscapeAtom()}}group(){let e=!0;this.consumeChar("("),"?"===this.peekChar(0)?(this.consumeChar("?"),this.consumeChar(":"),e=!1):this.groupIdx++;let t=this.disjunction();this.consumeChar(")");let s={type:"Group",capturing:e,value:t};return e&&(s.idx=this.groupIdx),s}positiveInteger(){let e=this.popChar();if(!1===Y.test(e))throw Error("Expecting a positive integer");for(;H.test(this.peekChar(0));)e+=this.popChar();return parseInt(e,10)}integerIncludingZero(){let e=this.popChar();if(!1===H.test(e))throw Error("Expecting an integer");for(;H.test(this.peekChar(0));)e+=this.popChar();return parseInt(e,10)}patternCharacter(){let e=this.popChar();switch(e){case"\n":case"\r":case"\u2028":case"\u2029":case"^":case"$":case"\\":case".":case"*":case"+":case"?":case"(":case")":case"[":case"|":throw Error("TBD");default:return{type:"Character",value:D(e)}}}isRegExpFlag(){switch(this.peekChar(0)){case"g":case"i":case"m":case"u":case"y":return!0;default:return!1}}isRangeDash(){return"-"===this.peekChar()&&this.isClassAtom(1)}isDigit(){return H.test(this.peekChar(0))}isClassAtom(e=0){switch(this.peekChar(e)){case"]":case"\n":case"\r":case"\u2028":case"\u2029":return!1;default:return!0}}isTerm(){return this.isAtom()||this.isAssertion()}isAtom(){if(this.isPatternCharacter())return!0;switch(this.peekChar(0)){case".":case"\\":case"[":case"(":return!0;default:return!1}}isAssertion(){switch(this.peekChar(0)){case"^":case"$":return!0;case"\\":switch(this.peekChar(1)){case"b":case"B":return!0;default:return!1}case"(":return"?"===this.peekChar(1)&&("="===this.peekChar(2)||"!"===this.peekChar(2)||"<"===this.peekChar(2)&&("="===this.peekChar(3)||"!"===this.peekChar(3)));default:return!1}}isQuantifier(){let e=this.saveState();try{return void 0!==this.quantifier(!0)}catch(e){return!1}finally{this.restoreState(e)}}isPatternCharacter(){switch(this.peekChar()){case"^":case"$":case"\\":case".":case"*":case"+":case"?":case"(":case")":case"[":case"|":case"/":case"\n":case"\r":case"\u2028":case"\u2029":return!1;default:return!0}}parseHexDigits(e){let t="";for(let s=0;s<e;s++){let e=this.popChar();if(!1===z.test(e))throw Error("Expecting a HexDecimal digits");t+=e}return{type:"Character",value:parseInt(t,16)}}peekChar(e=0){return this.input[this.idx+e]}popChar(){let e=this.peekChar(0);return this.consumeChar(void 0),e}consumeChar(e){if(void 0!==e&&this.input[this.idx]!==e)throw Error("Expected: '"+e+"' but found: '"+this.input[this.idx]+"' at offset: "+this.idx);if(this.idx>=this.input.length)throw Error("Unexpected end of input");this.idx++}loc(e){return{begin:e,end:this.idx}}}class q{visitChildren(e){for(let t in e){let s=e[t];e.hasOwnProperty(t)&&(void 0!==s.type?this.visit(s):Array.isArray(s)&&s.forEach(e=>{this.visit(e)},this))}}visit(e){switch(e.type){case"Pattern":this.visitPattern(e);break;case"Flags":this.visitFlags(e);break;case"Disjunction":this.visitDisjunction(e);break;case"Alternative":this.visitAlternative(e);break;case"StartAnchor":this.visitStartAnchor(e);break;case"EndAnchor":this.visitEndAnchor(e);break;case"WordBoundary":this.visitWordBoundary(e);break;case"NonWordBoundary":this.visitNonWordBoundary(e);break;case"Lookahead":this.visitLookahead(e);break;case"NegativeLookahead":this.visitNegativeLookahead(e);break;case"Lookbehind":this.visitLookbehind(e);break;case"NegativeLookbehind":this.visitNegativeLookbehind(e);break;case"Character":this.visitCharacter(e);break;case"Set":this.visitSet(e);break;case"Group":this.visitGroup(e);break;case"GroupBackReference":this.visitGroupBackReference(e);break;case"Quantifier":this.visitQuantifier(e)}this.visitChildren(e)}visitPattern(e){}visitFlags(e){}visitDisjunction(e){}visitAlternative(e){}visitStartAnchor(e){}visitEndAnchor(e){}visitWordBoundary(e){}visitNonWordBoundary(e){}visitLookahead(e){}visitNegativeLookahead(e){}visitLookbehind(e){}visitNegativeLookbehind(e){}visitCharacter(e){}visitSet(e){}visitGroup(e){}visitGroupBackReference(e){}visitQuantifier(e){}}function J(e){console&&console.error&&console.error(`Error: ${e}`)}function Z(e){console&&console.warn&&console.warn(`Warning: ${e}`)}let Q={},ee=new X;function et(e){let t=e.toString();if(Q.hasOwnProperty(t))return Q[t];{let e=ee.pattern(t);return Q[t]=e,e}}let es="Complement Sets are not supported for first char optimization",ei='Unable to use "first char" lexer optimizations:\n';function en(e,t,s){let i=eS(e);t[i]=i,!0===s&&function(e,t){let s=String.fromCharCode(e),i=s.toUpperCase();if(i!==s){let e=eS(i.charCodeAt(0));t[e]=e}else{let e=s.toLowerCase();if(e!==s){let s=eS(e.charCodeAt(0));t[s]=s}}}(e,t)}function ea(e,t){return e.value.find(e=>"number"==typeof e?t.includes(e):void 0!==t.find(t=>e.from<=t&&t<=e.to))}class er extends q{constructor(e){super(),this.targetCharCodes=e,this.found=!1}visitChildren(e){if(!0!==this.found){switch(e.type){case"Lookahead":this.visitLookahead(e);return;case"NegativeLookahead":this.visitNegativeLookahead(e);return;case"Lookbehind":this.visitLookbehind(e);return;case"NegativeLookbehind":this.visitNegativeLookbehind(e);return}super.visitChildren(e)}}visitCharacter(e){this.targetCharCodes.includes(e.value)&&(this.found=!0)}visitSet(e){e.complement?void 0===ea(e,this.targetCharCodes)&&(this.found=!0):void 0!==ea(e,this.targetCharCodes)&&(this.found=!0)}}function eo(e,t){if(t instanceof RegExp){let s=et(t),i=new er(e);return i.visit(s),i.found}for(let s of t){let t=s.charCodeAt(0);if(e.includes(t))return!0}return!1}let el="PATTERN",ec="defaultMode",eh="modes",ed=/[^\\][$]/,eu=/[^\\[][\^]|^\^/;function ep(e){let t=e.ignoreCase?"iy":"y";return RegExp(`${e.source}`,t)}function ef(e){let t=e.PATTERN;if(t instanceof RegExp)return!1;if("function"==typeof t)return!0;if(Object.hasOwn(t,"exec"))return!0;if("string"==typeof t)return!1;throw Error("non exhaustive match")}function em(e){return"string"==typeof e&&1===e.length&&e.charCodeAt(0)}let eE={test:function(e){let t=e.length;for(let s=this.lastIndex;s<t;s++){let t=e.charCodeAt(s);if(10===t)return this.lastIndex=s+1,!0;if(13===t)return 10===e.charCodeAt(s+1)?this.lastIndex=s+2:this.lastIndex=s+1,!0}return!1},lastIndex:0};function eT(e,t){if(Object.hasOwn(e,"LINE_BREAKS"))return!1;if(e.PATTERN instanceof RegExp){try{eo(t,e.PATTERN)}catch(e){return{issue:i.IDENTIFY_TERMINATOR,errMsg:e.message}}return!1}if("string"==typeof e.PATTERN)return!1;if(ef(e))return{issue:i.CUSTOM_LINE_BREAK};throw Error("non exhaustive match")}function eg(e){return e.map(e=>"string"==typeof e?e.charCodeAt(0):e)}function ey(e,t,s){void 0===e[t]?e[t]=[s]:e[t].push(s)}let eA=[];function eS(e){return e<256?e:eA[e]}function eL(e){let t=new Date().getTime(),s=e();return{time:new Date().getTime()-t,value:s}}function eO(e,t){let s=e.tokenTypeIdx;return s===t.tokenTypeIdx||!0===t.isParent&&!0===t.categoryMatchesMap[s]}function eR(e,t){return e.tokenTypeIdx===t.tokenTypeIdx}let ek=1,eI={};function eN(e){let t=function(e){let t=[...e],s=e,i=!0;for(;i;){let e=(s=s.map(e=>e.CATEGORIES).flat().filter(Boolean)).filter(e=>!t.includes(e));t=t.concat(e),0===e.length?i=!1:s=e}return t}(e);t.forEach(e=>{var t,s;eb(e)||(eI[ek]=e,e.tokenTypeIdx=ek++),eC(e)&&!Array.isArray(e.CATEGORIES)&&(e.CATEGORIES=[e.CATEGORIES]),eC(e)||(e.CATEGORIES=[]),Object.hasOwn(null!=(t=e)?t:{},"categoryMatches")||(e.categoryMatches=[]),Object.hasOwn(null!=(s=e)?s:{},"categoryMatchesMap")||(e.categoryMatchesMap={})}),t.forEach(e=>{!function e(t,s){t.forEach(e=>{s.categoryMatchesMap[e.tokenTypeIdx]=!0}),s.CATEGORIES.forEach(i=>{let n=t.concat(s);n.includes(i)||e(n,i)})}([],e)}),t.forEach(e=>{e.categoryMatches=[],Object.keys(e.categoryMatchesMap).forEach(t=>{e.categoryMatches.push(eI[t].tokenTypeIdx)})}),t.forEach(e=>{e.isParent=e.categoryMatches.length>0})}function eb(e){return Object.hasOwn(null!=e?e:{},"tokenTypeIdx")}function eC(e){return Object.hasOwn(null!=e?e:{},"CATEGORIES")}function e_(e){return Object.hasOwn(null!=e?e:{},"tokenTypeIdx")}!function(e){e[e.MISSING_PATTERN=0]="MISSING_PATTERN",e[e.INVALID_PATTERN=1]="INVALID_PATTERN",e[e.EOI_ANCHOR_FOUND=2]="EOI_ANCHOR_FOUND",e[e.UNSUPPORTED_FLAGS_FOUND=3]="UNSUPPORTED_FLAGS_FOUND",e[e.DUPLICATE_PATTERNS_FOUND=4]="DUPLICATE_PATTERNS_FOUND",e[e.INVALID_GROUP_TYPE_FOUND=5]="INVALID_GROUP_TYPE_FOUND",e[e.PUSH_MODE_DOES_NOT_EXIST=6]="PUSH_MODE_DOES_NOT_EXIST",e[e.MULTI_MODE_LEXER_WITHOUT_DEFAULT_MODE=7]="MULTI_MODE_LEXER_WITHOUT_DEFAULT_MODE",e[e.MULTI_MODE_LEXER_WITHOUT_MODES_PROPERTY=8]="MULTI_MODE_LEXER_WITHOUT_MODES_PROPERTY",e[e.MULTI_MODE_LEXER_DEFAULT_MODE_VALUE_DOES_NOT_EXIST=9]="MULTI_MODE_LEXER_DEFAULT_MODE_VALUE_DOES_NOT_EXIST",e[e.LEXER_DEFINITION_CANNOT_CONTAIN_UNDEFINED=10]="LEXER_DEFINITION_CANNOT_CONTAIN_UNDEFINED",e[e.SOI_ANCHOR_FOUND=11]="SOI_ANCHOR_FOUND",e[e.EMPTY_MATCH_PATTERN=12]="EMPTY_MATCH_PATTERN",e[e.NO_LINE_BREAKS_FLAGS=13]="NO_LINE_BREAKS_FLAGS",e[e.UNREACHABLE_PATTERN=14]="UNREACHABLE_PATTERN",e[e.IDENTIFY_TERMINATOR=15]="IDENTIFY_TERMINATOR",e[e.CUSTOM_LINE_BREAK=16]="CUSTOM_LINE_BREAK",e[e.MULTI_MODE_LEXER_LONGER_ALT_NOT_IN_CURRENT_MODE=17]="MULTI_MODE_LEXER_LONGER_ALT_NOT_IN_CURRENT_MODE"}(i||(i={}));let ev={deferDefinitionErrorsHandling:!1,positionTracking:"full",lineTerminatorsPattern:/\n|\r\n?/g,lineTerminatorCharacters:["\n","\r"],ensureOptimizations:!1,safeMode:!1,errorMessageProvider:{buildUnableToPopLexerModeMessage:e=>`Unable to pop Lexer Mode after encountering Token ->${e.image}<- The Mode Stack is empty`,buildUnexpectedCharactersMessage:(e,t,s,i,n,a)=>`unexpected character: ->${e.charAt(t)}<- at offset: ${t}, skipped ${s} characters.`},traceInitPerf:!1,skipValidations:!1,recoveryEnabled:!0};Object.freeze(ev);class ex{constructor(e,t=ev){if(this.lexerDefinition=e,this.lexerDefinitionErrors=[],this.lexerDefinitionWarning=[],this.patternIdxToConfig={},this.charCodeToPatternIdxToConfig={},this.modes=[],this.emptyGroups={},this.cachedGroupKeys=[],this.trackStartLines=!0,this.trackEndLines=!0,this.hasCustom=!1,this.canModeBeOptimized={},this.TRACE_INIT=(e,t)=>{if(!0!==this.traceInitPerf)return t();{this.traceInitIndent++;let s=Array(this.traceInitIndent+1).join(" ");this.traceInitIndent<this.traceInitMaxIdent&&console.log(`${s}--> <${e}>`);let{time:i,value:n}=eL(t),a=i>10?console.warn:console.log;return this.traceInitIndent<this.traceInitMaxIdent&&a(`${s}<-- <${e}> time: ${i}ms`),this.traceInitIndent--,n}},"boolean"==typeof t)throw Error("The second argument to the Lexer constructor is now an ILexerConfig Object.\na boolean 2nd argument is no longer supported");this.config=Object.assign({},ev,t);let s=this.config.traceInitPerf;!0===s?(this.traceInitMaxIdent=1/0,this.traceInitPerf=!0):"number"==typeof s&&(this.traceInitMaxIdent=s,this.traceInitPerf=!0),this.traceInitIndent=-1,this.TRACE_INIT("Lexer Constructor",()=>{let s,n=!0;this.TRACE_INIT("Lexer Config handling",()=>{if(this.config.lineTerminatorsPattern===ev.lineTerminatorsPattern)this.config.lineTerminatorsPattern=eE;else if(this.config.lineTerminatorCharacters===ev.lineTerminatorCharacters)throw Error("Error: Missing <lineTerminatorCharacters> property on the Lexer config.\n For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#MISSING_LINE_TERM_CHARS");if(t.safeMode&&t.ensureOptimizations)throw Error('"safeMode" and "ensureOptimizations" flags are mutually exclusive.');this.trackStartLines=/full|onlyStart/i.test(this.config.positionTracking),this.trackEndLines=/full/i.test(this.config.positionTracking),Array.isArray(e)?s={modes:{defaultMode:[...e]},defaultMode:ec}:(n=!1,s=Object.assign({},e))}),!1===this.config.skipValidations&&(this.TRACE_INIT("performRuntimeChecks",()=>{this.lexerDefinitionErrors=this.lexerDefinitionErrors.concat(function(e,t,s){let n=[];return Object.hasOwn(e,ec)||n.push({message:"A MultiMode Lexer cannot be initialized without a <"+ec+"> property in its definition\n",type:i.MULTI_MODE_LEXER_WITHOUT_DEFAULT_MODE}),Object.hasOwn(e,eh)||n.push({message:"A MultiMode Lexer cannot be initialized without a <"+eh+"> property in its definition\n",type:i.MULTI_MODE_LEXER_WITHOUT_MODES_PROPERTY}),Object.hasOwn(e,eh)&&Object.hasOwn(e,ec)&&!Object.hasOwn(e.modes,e.defaultMode)&&n.push({message:`A MultiMode Lexer cannot be initialized with a ${ec}: <${e.defaultMode}>which does not exist
|
|
1
|
+
"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[7867],{17867:(e,t,s)=>{s.d(t,{diagram:()=>nN});var i,n,a,r,o=s(60736),l=s(21403),c=s(39761);s(81028),s(61410),s(97411),s(52957),s(6171),s(68960);var h=s(84273);s(53237);var d=s(75042),u=s(68180),p=s(94268),f=s(1642),m=s(73084);function E(e){function t(){}t.prototype=e;let s=new t;function i(){return typeof s.bar}return i(),i(),e}class T{get definition(){return this._definition}set definition(e){this._definition=e}constructor(e){this._definition=e}accept(e){e.visit(this),this.definition.forEach(t=>{t.accept(e)})}}class g extends T{constructor(e){super([]),this.idx=1,Object.assign(this,b(e))}set definition(e){}get definition(){return void 0!==this.referencedRule?this.referencedRule.definition:[]}accept(e){e.visit(this)}}class y extends T{constructor(e){super(e.definition),this.orgText="",Object.assign(this,b(e))}}class A extends T{constructor(e){super(e.definition),this.ignoreAmbiguities=!1,Object.assign(this,b(e))}}class S extends T{constructor(e){super(e.definition),this.idx=1,Object.assign(this,b(e))}}class L extends T{constructor(e){super(e.definition),this.idx=1,Object.assign(this,b(e))}}class O extends T{constructor(e){super(e.definition),this.idx=1,Object.assign(this,b(e))}}class R extends T{constructor(e){super(e.definition),this.idx=1,Object.assign(this,b(e))}}class k extends T{constructor(e){super(e.definition),this.idx=1,Object.assign(this,b(e))}}class I extends T{get definition(){return this._definition}set definition(e){this._definition=e}constructor(e){super(e.definition),this.idx=1,this.ignoreAmbiguities=!1,this.hasPredicates=!1,Object.assign(this,b(e))}}class N{constructor(e){this.idx=1,Object.assign(this,b(e))}accept(e){e.visit(this)}}function b(e){return Object.fromEntries(Object.entries(e).filter(([,e])=>void 0!==e))}class C{visit(e){switch(e.constructor){case g:return this.visitNonTerminal(e);case A:return this.visitAlternative(e);case S:return this.visitOption(e);case L:return this.visitRepetitionMandatory(e);case O:return this.visitRepetitionMandatoryWithSeparator(e);case k:return this.visitRepetitionWithSeparator(e);case R:return this.visitRepetition(e);case I:return this.visitAlternation(e);case N:return this.visitTerminal(e);case y:return this.visitRule(e);default:throw Error("non exhaustive match")}}visitNonTerminal(e){}visitAlternative(e){}visitOption(e){}visitRepetition(e){}visitRepetitionMandatory(e){}visitRepetitionMandatoryWithSeparator(e){}visitRepetitionWithSeparator(e){}visitAlternation(e){}visitTerminal(e){}visitRule(e){}}function _(e,t=[]){return e instanceof S||e instanceof R||e instanceof k||(e instanceof I?e.definition.some(e=>_(e,t)):!(e instanceof g&&t.includes(e))&&e instanceof T&&(e instanceof g&&t.push(e),e.definition.every(e=>_(e,t))))}function v(e){if(e instanceof g)return"SUBRULE";if(e instanceof S)return"OPTION";if(e instanceof I)return"OR";if(e instanceof L)return"AT_LEAST_ONE";if(e instanceof O)return"AT_LEAST_ONE_SEP";else if(e instanceof k)return"MANY_SEP";else if(e instanceof R)return"MANY";else if(e instanceof N)return"CONSUME";else throw Error("non exhaustive match")}class x{walk(e,t=[]){e.definition.forEach((s,i)=>{let n=e.definition.slice(i+1);if(s instanceof g)this.walkProdRef(s,n,t);else if(s instanceof N)this.walkTerminal(s,n,t);else if(s instanceof A)this.walkFlat(s,n,t);else if(s instanceof S)this.walkOption(s,n,t);else if(s instanceof L)this.walkAtLeastOne(s,n,t);else if(s instanceof O)this.walkAtLeastOneSep(s,n,t);else if(s instanceof k)this.walkManySep(s,n,t);else if(s instanceof R)this.walkMany(s,n,t);else if(s instanceof I)this.walkOr(s,n,t);else throw Error("non exhaustive match")})}walkTerminal(e,t,s){}walkProdRef(e,t,s){}walkFlat(e,t,s){let i=t.concat(s);this.walk(e,i)}walkOption(e,t,s){let i=t.concat(s);this.walk(e,i)}walkAtLeastOne(e,t,s){let i=[new S({definition:e.definition})].concat(t,s);this.walk(e,i)}walkAtLeastOneSep(e,t,s){let i=U(e,t,s);this.walk(e,i)}walkMany(e,t,s){let i=[new S({definition:e.definition})].concat(t,s);this.walk(e,i)}walkManySep(e,t,s){let i=U(e,t,s);this.walk(e,i)}walkOr(e,t,s){let i=t.concat(s);e.definition.forEach(e=>{let t=new A({definition:[e]});this.walk(t,i)})}}function U(e,t,s){return[new S({definition:[new N({terminalType:e.separator})].concat(e.definition)})].concat(t,s)}function M(e){if(e instanceof g)return M(e.referencedRule);if(e instanceof N)return[e.terminalType];if(e instanceof A||e instanceof S||e instanceof R||e instanceof L||e instanceof O||e instanceof k||e instanceof N||e instanceof y)return function(e){let t,s=[],i=e.definition,n=0,a=i.length>n,r=!0;for(;a&&r;)r=_(t=i[n]),s=s.concat(M(t)),n+=1,a=i.length>n;return[...new Set(s)]}(e);if(e instanceof I)return[...new Set(e.definition.map(e=>M(e)).flat())];throw Error("non exhaustive match")}let w="_~IN~_";class P extends x{constructor(e){super(),this.topProd=e,this.follows={}}startWalking(){return this.walk(this.topProd),this.follows}walkTerminal(e,t,s){}walkProdRef(e,t,s){var i,n;let a=(i=e.referencedRule,n=e.idx,i.name+n+w+this.topProd.name),r=M(new A({definition:t.concat(s)}));this.follows[a]=r}}function D(e){return e.charCodeAt(0)}function $(e,t){Array.isArray(e)?e.forEach(function(e){t.push(e)}):t.push(e)}function K(e,t){if(!0===e[t])throw"duplicate flag "+t;e[t],e[t]=!0}function F(e){if(void 0===e)throw Error("Internal Error - Should never get here!");return!0}function B(){throw Error("Internal Error - Should never get here!")}function j(e){return"Character"===e.type}let G=[];for(let e=D("0");e<=D("9");e++)G.push(e);let W=[D("_")].concat(G);for(let e=D("a");e<=D("z");e++)W.push(e);for(let e=D("A");e<=D("Z");e++)W.push(e);let V=[D(" "),D("\f"),D("\n"),D("\r"),D(" "),D("\v"),D(" "),D("\xa0"),D(" "),D(" "),D(" "),D(" "),D(" "),D(" "),D(" "),D(" "),D(" "),D(" "),D(" "),D(" "),D("\u2028"),D("\u2029"),D(" "),D(" "),D(" "),D("\uFEFF")],z=/[0-9a-fA-F]/,H=/[0-9]/,Y=/[1-9]/;class X{constructor(){this.idx=0,this.input="",this.groupIdx=0}saveState(){return{idx:this.idx,input:this.input,groupIdx:this.groupIdx}}restoreState(e){this.idx=e.idx,this.input=e.input,this.groupIdx=e.groupIdx}pattern(e){this.idx=0,this.input=e,this.groupIdx=0,this.consumeChar("/");let t=this.disjunction();this.consumeChar("/");let s={type:"Flags",loc:{begin:this.idx,end:e.length},global:!1,ignoreCase:!1,multiLine:!1,unicode:!1,sticky:!1};for(;this.isRegExpFlag();)switch(this.popChar()){case"g":K(s,"global");break;case"i":K(s,"ignoreCase");break;case"m":K(s,"multiLine");break;case"u":K(s,"unicode");break;case"y":K(s,"sticky")}if(this.idx!==this.input.length)throw Error("Redundant input: "+this.input.substring(this.idx));return{type:"Pattern",flags:s,value:t,loc:this.loc(0)}}disjunction(){let e=[],t=this.idx;for(e.push(this.alternative());"|"===this.peekChar();)this.consumeChar("|"),e.push(this.alternative());return{type:"Disjunction",value:e,loc:this.loc(t)}}alternative(){let e=[],t=this.idx;for(;this.isTerm();)e.push(this.term());return{type:"Alternative",value:e,loc:this.loc(t)}}term(){return this.isAssertion()?this.assertion():this.atom()}assertion(){let e=this.idx;switch(this.popChar()){case"^":return{type:"StartAnchor",loc:this.loc(e)};case"$":return{type:"EndAnchor",loc:this.loc(e)};case"\\":switch(this.popChar()){case"b":return{type:"WordBoundary",loc:this.loc(e)};case"B":return{type:"NonWordBoundary",loc:this.loc(e)}}throw Error("Invalid Assertion Escape");case"(":let t;switch(this.consumeChar("?"),this.popChar()){case"=":t="Lookahead";break;case"!":t="NegativeLookahead";break;case"<":switch(this.popChar()){case"=":t="Lookbehind";break;case"!":t="NegativeLookbehind"}}F(t);let s=this.disjunction();return this.consumeChar(")"),{type:t,value:s,loc:this.loc(e)}}return B()}quantifier(e=!1){let t,s=this.idx;switch(this.popChar()){case"*":t={atLeast:0,atMost:1/0};break;case"+":t={atLeast:1,atMost:1/0};break;case"?":t={atLeast:0,atMost:1};break;case"{":let i=this.integerIncludingZero();switch(this.popChar()){case"}":t={atLeast:i,atMost:i};break;case",":t=this.isDigit()?{atLeast:i,atMost:this.integerIncludingZero()}:{atLeast:i,atMost:1/0},this.consumeChar("}")}if(!0===e&&void 0===t)return;F(t)}if((!0!==e||void 0!==t)&&F(t))return"?"===this.peekChar(0)?(this.consumeChar("?"),t.greedy=!1):t.greedy=!0,t.type="Quantifier",t.loc=this.loc(s),t}atom(){let e,t=this.idx;switch(this.peekChar()){case".":e=this.dotAll();break;case"\\":e=this.atomEscape();break;case"[":e=this.characterClass();break;case"(":e=this.group()}return(void 0===e&&this.isPatternCharacter()&&(e=this.patternCharacter()),F(e))?(e.loc=this.loc(t),this.isQuantifier()&&(e.quantifier=this.quantifier()),e):B()}dotAll(){return this.consumeChar("."),{type:"Set",complement:!0,value:[D("\n"),D("\r"),D("\u2028"),D("\u2029")]}}atomEscape(){switch(this.consumeChar("\\"),this.peekChar()){case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":return this.decimalEscapeAtom();case"d":case"D":case"s":case"S":case"w":case"W":return this.characterClassEscape();case"f":case"n":case"r":case"t":case"v":return this.controlEscapeAtom();case"c":return this.controlLetterEscapeAtom();case"0":return this.nulCharacterAtom();case"x":return this.hexEscapeSequenceAtom();case"u":return this.regExpUnicodeEscapeSequenceAtom();default:return this.identityEscapeAtom()}}decimalEscapeAtom(){return{type:"GroupBackReference",value:this.positiveInteger()}}characterClassEscape(){let e,t=!1;switch(this.popChar()){case"d":e=G;break;case"D":e=G,t=!0;break;case"s":e=V;break;case"S":e=V,t=!0;break;case"w":e=W;break;case"W":e=W,t=!0}return F(e)?{type:"Set",value:e,complement:t}:B()}controlEscapeAtom(){let e;switch(this.popChar()){case"f":e=D("\f");break;case"n":e=D("\n");break;case"r":e=D("\r");break;case"t":e=D(" ");break;case"v":e=D("\v")}return F(e)?{type:"Character",value:e}:B()}controlLetterEscapeAtom(){this.consumeChar("c");let e=this.popChar();if(!1===/[a-zA-Z]/.test(e))throw Error("Invalid ");return{type:"Character",value:e.toUpperCase().charCodeAt(0)-64}}nulCharacterAtom(){return this.consumeChar("0"),{type:"Character",value:D("\0")}}hexEscapeSequenceAtom(){return this.consumeChar("x"),this.parseHexDigits(2)}regExpUnicodeEscapeSequenceAtom(){return this.consumeChar("u"),this.parseHexDigits(4)}identityEscapeAtom(){return{type:"Character",value:D(this.popChar())}}classPatternCharacterAtom(){switch(this.peekChar()){case"\n":case"\r":case"\u2028":case"\u2029":case"\\":case"]":throw Error("TBD");default:return{type:"Character",value:D(this.popChar())}}}characterClass(){let e=[],t=!1;for(this.consumeChar("["),"^"===this.peekChar(0)&&(this.consumeChar("^"),t=!0);this.isClassAtom();){let t=this.classAtom();if(t.type,j(t)&&this.isRangeDash()){this.consumeChar("-");let s=this.classAtom();if(s.type,j(s)){if(s.value<t.value)throw Error("Range out of order in character class");e.push({from:t.value,to:s.value})}else $(t.value,e),e.push(D("-")),$(s.value,e)}else $(t.value,e)}return this.consumeChar("]"),{type:"Set",complement:t,value:e}}classAtom(){switch(this.peekChar()){case"]":case"\n":case"\r":case"\u2028":case"\u2029":throw Error("TBD");case"\\":return this.classEscape();default:return this.classPatternCharacterAtom()}}classEscape(){switch(this.consumeChar("\\"),this.peekChar()){case"b":return this.consumeChar("b"),{type:"Character",value:D("\b")};case"d":case"D":case"s":case"S":case"w":case"W":return this.characterClassEscape();case"f":case"n":case"r":case"t":case"v":return this.controlEscapeAtom();case"c":return this.controlLetterEscapeAtom();case"0":return this.nulCharacterAtom();case"x":return this.hexEscapeSequenceAtom();case"u":return this.regExpUnicodeEscapeSequenceAtom();default:return this.identityEscapeAtom()}}group(){let e=!0;this.consumeChar("("),"?"===this.peekChar(0)?(this.consumeChar("?"),this.consumeChar(":"),e=!1):this.groupIdx++;let t=this.disjunction();this.consumeChar(")");let s={type:"Group",capturing:e,value:t};return e&&(s.idx=this.groupIdx),s}positiveInteger(){let e=this.popChar();if(!1===Y.test(e))throw Error("Expecting a positive integer");for(;H.test(this.peekChar(0));)e+=this.popChar();return parseInt(e,10)}integerIncludingZero(){let e=this.popChar();if(!1===H.test(e))throw Error("Expecting an integer");for(;H.test(this.peekChar(0));)e+=this.popChar();return parseInt(e,10)}patternCharacter(){let e=this.popChar();switch(e){case"\n":case"\r":case"\u2028":case"\u2029":case"^":case"$":case"\\":case".":case"*":case"+":case"?":case"(":case")":case"[":case"|":throw Error("TBD");default:return{type:"Character",value:D(e)}}}isRegExpFlag(){switch(this.peekChar(0)){case"g":case"i":case"m":case"u":case"y":return!0;default:return!1}}isRangeDash(){return"-"===this.peekChar()&&this.isClassAtom(1)}isDigit(){return H.test(this.peekChar(0))}isClassAtom(e=0){switch(this.peekChar(e)){case"]":case"\n":case"\r":case"\u2028":case"\u2029":return!1;default:return!0}}isTerm(){return this.isAtom()||this.isAssertion()}isAtom(){if(this.isPatternCharacter())return!0;switch(this.peekChar(0)){case".":case"\\":case"[":case"(":return!0;default:return!1}}isAssertion(){switch(this.peekChar(0)){case"^":case"$":return!0;case"\\":switch(this.peekChar(1)){case"b":case"B":return!0;default:return!1}case"(":return"?"===this.peekChar(1)&&("="===this.peekChar(2)||"!"===this.peekChar(2)||"<"===this.peekChar(2)&&("="===this.peekChar(3)||"!"===this.peekChar(3)));default:return!1}}isQuantifier(){let e=this.saveState();try{return void 0!==this.quantifier(!0)}catch(e){return!1}finally{this.restoreState(e)}}isPatternCharacter(){switch(this.peekChar()){case"^":case"$":case"\\":case".":case"*":case"+":case"?":case"(":case")":case"[":case"|":case"/":case"\n":case"\r":case"\u2028":case"\u2029":return!1;default:return!0}}parseHexDigits(e){let t="";for(let s=0;s<e;s++){let e=this.popChar();if(!1===z.test(e))throw Error("Expecting a HexDecimal digits");t+=e}return{type:"Character",value:parseInt(t,16)}}peekChar(e=0){return this.input[this.idx+e]}popChar(){let e=this.peekChar(0);return this.consumeChar(void 0),e}consumeChar(e){if(void 0!==e&&this.input[this.idx]!==e)throw Error("Expected: '"+e+"' but found: '"+this.input[this.idx]+"' at offset: "+this.idx);if(this.idx>=this.input.length)throw Error("Unexpected end of input");this.idx++}loc(e){return{begin:e,end:this.idx}}}class q{visitChildren(e){for(let t in e){let s=e[t];e.hasOwnProperty(t)&&(void 0!==s.type?this.visit(s):Array.isArray(s)&&s.forEach(e=>{this.visit(e)},this))}}visit(e){switch(e.type){case"Pattern":this.visitPattern(e);break;case"Flags":this.visitFlags(e);break;case"Disjunction":this.visitDisjunction(e);break;case"Alternative":this.visitAlternative(e);break;case"StartAnchor":this.visitStartAnchor(e);break;case"EndAnchor":this.visitEndAnchor(e);break;case"WordBoundary":this.visitWordBoundary(e);break;case"NonWordBoundary":this.visitNonWordBoundary(e);break;case"Lookahead":this.visitLookahead(e);break;case"NegativeLookahead":this.visitNegativeLookahead(e);break;case"Lookbehind":this.visitLookbehind(e);break;case"NegativeLookbehind":this.visitNegativeLookbehind(e);break;case"Character":this.visitCharacter(e);break;case"Set":this.visitSet(e);break;case"Group":this.visitGroup(e);break;case"GroupBackReference":this.visitGroupBackReference(e);break;case"Quantifier":this.visitQuantifier(e)}this.visitChildren(e)}visitPattern(e){}visitFlags(e){}visitDisjunction(e){}visitAlternative(e){}visitStartAnchor(e){}visitEndAnchor(e){}visitWordBoundary(e){}visitNonWordBoundary(e){}visitLookahead(e){}visitNegativeLookahead(e){}visitLookbehind(e){}visitNegativeLookbehind(e){}visitCharacter(e){}visitSet(e){}visitGroup(e){}visitGroupBackReference(e){}visitQuantifier(e){}}function J(e){console&&console.error&&console.error(`Error: ${e}`)}function Z(e){console&&console.warn&&console.warn(`Warning: ${e}`)}let Q={},ee=new X;function et(e){let t=e.toString();if(Q.hasOwnProperty(t))return Q[t];{let e=ee.pattern(t);return Q[t]=e,e}}let es="Complement Sets are not supported for first char optimization",ei='Unable to use "first char" lexer optimizations:\n';function en(e,t,s){let i=eS(e);t[i]=i,!0===s&&function(e,t){let s=String.fromCharCode(e),i=s.toUpperCase();if(i!==s){let e=eS(i.charCodeAt(0));t[e]=e}else{let e=s.toLowerCase();if(e!==s){let s=eS(e.charCodeAt(0));t[s]=s}}}(e,t)}function ea(e,t){return e.value.find(e=>"number"==typeof e?t.includes(e):void 0!==t.find(t=>e.from<=t&&t<=e.to))}class er extends q{constructor(e){super(),this.targetCharCodes=e,this.found=!1}visitChildren(e){if(!0!==this.found){switch(e.type){case"Lookahead":this.visitLookahead(e);return;case"NegativeLookahead":this.visitNegativeLookahead(e);return;case"Lookbehind":this.visitLookbehind(e);return;case"NegativeLookbehind":this.visitNegativeLookbehind(e);return}super.visitChildren(e)}}visitCharacter(e){this.targetCharCodes.includes(e.value)&&(this.found=!0)}visitSet(e){e.complement?void 0===ea(e,this.targetCharCodes)&&(this.found=!0):void 0!==ea(e,this.targetCharCodes)&&(this.found=!0)}}function eo(e,t){if(t instanceof RegExp){let s=et(t),i=new er(e);return i.visit(s),i.found}for(let s of t){let t=s.charCodeAt(0);if(e.includes(t))return!0}return!1}let el="PATTERN",ec="defaultMode",eh="modes",ed=/[^\\][$]/,eu=/[^\\[][\^]|^\^/;function ep(e){let t=e.ignoreCase?"iy":"y";return RegExp(`${e.source}`,t)}function ef(e){let t=e.PATTERN;if(t instanceof RegExp)return!1;if("function"==typeof t)return!0;if(Object.hasOwn(t,"exec"))return!0;if("string"==typeof t)return!1;throw Error("non exhaustive match")}function em(e){return"string"==typeof e&&1===e.length&&e.charCodeAt(0)}let eE={test:function(e){let t=e.length;for(let s=this.lastIndex;s<t;s++){let t=e.charCodeAt(s);if(10===t)return this.lastIndex=s+1,!0;if(13===t)return 10===e.charCodeAt(s+1)?this.lastIndex=s+2:this.lastIndex=s+1,!0}return!1},lastIndex:0};function eT(e,t){if(Object.hasOwn(e,"LINE_BREAKS"))return!1;if(e.PATTERN instanceof RegExp){try{eo(t,e.PATTERN)}catch(e){return{issue:i.IDENTIFY_TERMINATOR,errMsg:e.message}}return!1}if("string"==typeof e.PATTERN)return!1;if(ef(e))return{issue:i.CUSTOM_LINE_BREAK};throw Error("non exhaustive match")}function eg(e){return e.map(e=>"string"==typeof e?e.charCodeAt(0):e)}function ey(e,t,s){void 0===e[t]?e[t]=[s]:e[t].push(s)}let eA=[];function eS(e){return e<256?e:eA[e]}function eL(e){let t=new Date().getTime(),s=e();return{time:new Date().getTime()-t,value:s}}function eO(e,t){let s=e.tokenTypeIdx;return s===t.tokenTypeIdx||!0===t.isParent&&!0===t.categoryMatchesMap[s]}function eR(e,t){return e.tokenTypeIdx===t.tokenTypeIdx}let ek=1,eI={};function eN(e){let t=function(e){let t=[...e],s=e,i=!0;for(;i;){let e=(s=s.map(e=>e.CATEGORIES).flat().filter(Boolean)).filter(e=>!t.includes(e));t=t.concat(e),0===e.length?i=!1:s=e}return t}(e);t.forEach(e=>{var t,s;eb(e)||(eI[ek]=e,e.tokenTypeIdx=ek++),eC(e)&&!Array.isArray(e.CATEGORIES)&&(e.CATEGORIES=[e.CATEGORIES]),eC(e)||(e.CATEGORIES=[]),Object.hasOwn(null!=(t=e)?t:{},"categoryMatches")||(e.categoryMatches=[]),Object.hasOwn(null!=(s=e)?s:{},"categoryMatchesMap")||(e.categoryMatchesMap={})}),t.forEach(e=>{!function e(t,s){t.forEach(e=>{s.categoryMatchesMap[e.tokenTypeIdx]=!0}),s.CATEGORIES.forEach(i=>{let n=t.concat(s);n.includes(i)||e(n,i)})}([],e)}),t.forEach(e=>{e.categoryMatches=[],Object.keys(e.categoryMatchesMap).forEach(t=>{e.categoryMatches.push(eI[t].tokenTypeIdx)})}),t.forEach(e=>{e.isParent=e.categoryMatches.length>0})}function eb(e){return Object.hasOwn(null!=e?e:{},"tokenTypeIdx")}function eC(e){return Object.hasOwn(null!=e?e:{},"CATEGORIES")}function e_(e){return Object.hasOwn(null!=e?e:{},"tokenTypeIdx")}!function(e){e[e.MISSING_PATTERN=0]="MISSING_PATTERN",e[e.INVALID_PATTERN=1]="INVALID_PATTERN",e[e.EOI_ANCHOR_FOUND=2]="EOI_ANCHOR_FOUND",e[e.UNSUPPORTED_FLAGS_FOUND=3]="UNSUPPORTED_FLAGS_FOUND",e[e.DUPLICATE_PATTERNS_FOUND=4]="DUPLICATE_PATTERNS_FOUND",e[e.INVALID_GROUP_TYPE_FOUND=5]="INVALID_GROUP_TYPE_FOUND",e[e.PUSH_MODE_DOES_NOT_EXIST=6]="PUSH_MODE_DOES_NOT_EXIST",e[e.MULTI_MODE_LEXER_WITHOUT_DEFAULT_MODE=7]="MULTI_MODE_LEXER_WITHOUT_DEFAULT_MODE",e[e.MULTI_MODE_LEXER_WITHOUT_MODES_PROPERTY=8]="MULTI_MODE_LEXER_WITHOUT_MODES_PROPERTY",e[e.MULTI_MODE_LEXER_DEFAULT_MODE_VALUE_DOES_NOT_EXIST=9]="MULTI_MODE_LEXER_DEFAULT_MODE_VALUE_DOES_NOT_EXIST",e[e.LEXER_DEFINITION_CANNOT_CONTAIN_UNDEFINED=10]="LEXER_DEFINITION_CANNOT_CONTAIN_UNDEFINED",e[e.SOI_ANCHOR_FOUND=11]="SOI_ANCHOR_FOUND",e[e.EMPTY_MATCH_PATTERN=12]="EMPTY_MATCH_PATTERN",e[e.NO_LINE_BREAKS_FLAGS=13]="NO_LINE_BREAKS_FLAGS",e[e.UNREACHABLE_PATTERN=14]="UNREACHABLE_PATTERN",e[e.IDENTIFY_TERMINATOR=15]="IDENTIFY_TERMINATOR",e[e.CUSTOM_LINE_BREAK=16]="CUSTOM_LINE_BREAK",e[e.MULTI_MODE_LEXER_LONGER_ALT_NOT_IN_CURRENT_MODE=17]="MULTI_MODE_LEXER_LONGER_ALT_NOT_IN_CURRENT_MODE"}(i||(i={}));let ev={deferDefinitionErrorsHandling:!1,positionTracking:"full",lineTerminatorsPattern:/\n|\r\n?/g,lineTerminatorCharacters:["\n","\r"],ensureOptimizations:!1,safeMode:!1,errorMessageProvider:{buildUnableToPopLexerModeMessage:e=>`Unable to pop Lexer Mode after encountering Token ->${e.image}<- The Mode Stack is empty`,buildUnexpectedCharactersMessage:(e,t,s,i,n,a)=>`unexpected character: ->${e.charAt(t)}<- at offset: ${t}, skipped ${s} characters.`},traceInitPerf:!1,skipValidations:!1,recoveryEnabled:!0};Object.freeze(ev);class ex{constructor(e,t=ev){if(this.lexerDefinition=e,this.lexerDefinitionErrors=[],this.lexerDefinitionWarning=[],this.patternIdxToConfig={},this.charCodeToPatternIdxToConfig={},this.modes=[],this.emptyGroups={},this.cachedGroupKeys=[],this.trackStartLines=!0,this.trackEndLines=!0,this.hasCustom=!1,this.canModeBeOptimized={},this.TRACE_INIT=(e,t)=>{if(!0!==this.traceInitPerf)return t();{this.traceInitIndent++;let s=Array(this.traceInitIndent+1).join(" ");this.traceInitIndent<this.traceInitMaxIdent&&console.log(`${s}--> <${e}>`);let{time:i,value:n}=eL(t),a=i>10?console.warn:console.log;return this.traceInitIndent<this.traceInitMaxIdent&&a(`${s}<-- <${e}> time: ${i}ms`),this.traceInitIndent--,n}},"boolean"==typeof t)throw Error("The second argument to the Lexer constructor is now an ILexerConfig Object.\na boolean 2nd argument is no longer supported");this.config=Object.assign({},ev,t);let s=this.config.traceInitPerf;!0===s?(this.traceInitMaxIdent=1/0,this.traceInitPerf=!0):"number"==typeof s&&(this.traceInitMaxIdent=s,this.traceInitPerf=!0),this.traceInitIndent=-1,this.TRACE_INIT("Lexer Constructor",()=>{let s,n=!0;this.TRACE_INIT("Lexer Config handling",()=>{if(this.config.lineTerminatorsPattern===ev.lineTerminatorsPattern)this.config.lineTerminatorsPattern=eE;else if(this.config.lineTerminatorCharacters===ev.lineTerminatorCharacters)throw Error("Error: Missing <lineTerminatorCharacters> property on the Lexer config.\n For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#MISSING_LINE_TERM_CHARS");if(t.safeMode&&t.ensureOptimizations)throw Error('"safeMode" and "ensureOptimizations" flags are mutually exclusive.');this.trackStartLines=/full|onlyStart/i.test(this.config.positionTracking),this.trackEndLines=/full/i.test(this.config.positionTracking),Array.isArray(e)?s={modes:{defaultMode:[...e]},defaultMode:ec}:(n=!1,s=Object.assign({},e))}),!1===this.config.skipValidations&&(this.TRACE_INIT("performRuntimeChecks",()=>{this.lexerDefinitionErrors=this.lexerDefinitionErrors.concat(function(e,t,s){let n=[];return Object.hasOwn(e,ec)||n.push({message:"A MultiMode Lexer cannot be initialized without a <"+ec+"> property in its definition\n",type:i.MULTI_MODE_LEXER_WITHOUT_DEFAULT_MODE}),Object.hasOwn(e,eh)||n.push({message:"A MultiMode Lexer cannot be initialized without a <"+eh+"> property in its definition\n",type:i.MULTI_MODE_LEXER_WITHOUT_MODES_PROPERTY}),Object.hasOwn(e,eh)&&Object.hasOwn(e,ec)&&!Object.hasOwn(e.modes,e.defaultMode)&&n.push({message:`A MultiMode Lexer cannot be initialized with a ${ec}: <${e.defaultMode}>which does not exist
|
|
2
2
|
`,type:i.MULTI_MODE_LEXER_DEFAULT_MODE_VALUE_DOES_NOT_EXIST}),Object.hasOwn(e,eh)&&Object.keys(e.modes).forEach(t=>{let s=e.modes[t];s.forEach((e,a)=>{void 0===e?n.push({message:`A Lexer cannot be initialized using an undefined Token Type. Mode:<${t}> at index: <${a}>
|
|
3
3
|
`,type:i.LEXER_DEFINITION_CANNOT_CONTAIN_UNDEFINED}):Object.hasOwn(e,"LONGER_ALT")&&(Array.isArray(e.LONGER_ALT)?e.LONGER_ALT:[e.LONGER_ALT]).forEach(a=>{void 0===a||s.includes(a)||n.push({message:`A MultiMode Lexer cannot be initialized with a longer_alt <${a.name}> on token <${e.name}> outside of mode <${t}>
|
|
4
4
|
`,type:i.MULTI_MODE_LEXER_LONGER_ALT_NOT_IN_CURRENT_MODE})})})}),n}(s,this.trackStartLines,this.config.lineTerminatorCharacters))}),this.TRACE_INIT("performWarningRuntimeChecks",()=>{this.lexerDefinitionWarning=this.lexerDefinitionWarning.concat(function(e,t,s){let n=[],a=!1,r=Object.values(e.modes||{}).flat().filter(Boolean).filter(e=>e[el]!==ex.NA),o=eg(s);return t&&r.forEach(e=>{let t=eT(e,o);if(!1!==t){let s={message:function(e,t){if(t.issue===i.IDENTIFY_TERMINATOR)return`Warning: unable to identify line terminator usage in pattern.
|
|
@@ -48,13 +48,13 @@ rule: <${t}> can be invoked from itself (directly or indirectly)
|
|
|
48
48
|
without consuming any Tokens. The grammar path that causes this is:
|
|
49
49
|
${i}
|
|
50
50
|
To fix this refactor your grammar to remove the left recursion.
|
|
51
|
-
see: https://en.wikipedia.org/wiki/LL_parser#Left_factoring.`},buildInvalidRuleNameError:e=>"deprecated",buildDuplicateRuleNameError(e){let t;return t=e.topLevelRule instanceof y?e.topLevelRule.name:e.topLevelRule,`Duplicate definition, rule: ->${t}<- is already defined in the grammar: ->${e.grammarName}<-`}};class eX extends C{constructor(e,t){super(),this.nameToTopRule=e,this.errMsgProvider=t,this.errors=[]}resolveRefs(){Object.values(this.nameToTopRule).forEach(e=>{this.currTopLevel=e,e.accept(this)})}visitNonTerminal(e){let t=this.nameToTopRule[e.nonTerminalName];if(t)e.referencedRule=t;else{let t=this.errMsgProvider.buildRuleNotFoundError(this.currTopLevel,e);this.errors.push({message:t,type:r.UNRESOLVED_SUBRULE_REF,ruleName:this.currTopLevel.name,unresolvedRefName:e.nonTerminalName})}}}class eq extends x{constructor(e,t){super(),this.topProd=e,this.path=t,this.possibleTokTypes=[],this.nextProductionName="",this.nextProductionOccurrence=0,this.found=!1,this.isAtEndOfPath=!1}startWalking(){if(this.found=!1,this.path.ruleStack[0]!==this.topProd.name)throw Error("The path does not start with the walker's top Rule!");return this.ruleStack=[...this.path.ruleStack].reverse(),this.occurrenceStack=[...this.path.occurrenceStack].reverse(),this.ruleStack.pop(),this.occurrenceStack.pop(),this.updateExpectedNext(),this.walk(this.topProd),this.possibleTokTypes}walk(e,t=[]){this.found||super.walk(e,t)}walkProdRef(e,t,s){if(e.referencedRule.name===this.nextProductionName&&e.idx===this.nextProductionOccurrence){let i=t.concat(s);this.updateExpectedNext(),this.walk(e.referencedRule,i)}}updateExpectedNext(){0===this.ruleStack.length?(this.nextProductionName="",this.nextProductionOccurrence=0,this.isAtEndOfPath=!0):(this.nextProductionName=this.ruleStack.pop(),this.nextProductionOccurrence=this.occurrenceStack.pop())}}class eJ extends eq{constructor(e,t){super(e,t),this.path=t,this.nextTerminalName="",this.nextTerminalOccurrence=0,this.nextTerminalName=this.path.lastTok.name,this.nextTerminalOccurrence=this.path.lastTokOccurrence}walkTerminal(e,t,s){if(this.isAtEndOfPath&&e.terminalType.name===this.nextTerminalName&&e.idx===this.nextTerminalOccurrence&&!this.found){let e=new A({definition:t.concat(s)});this.possibleTokTypes=M(e),this.found=!0}}}class eZ extends x{constructor(e,t){super(),this.topRule=e,this.occurrence=t,this.result={token:void 0,occurrence:void 0,isEndOfRule:void 0}}startWalking(){return this.walk(this.topRule),this.result}}class eQ extends eZ{walkMany(e,t,s){if(e.idx===this.occurrence){let e=t.concat(s)[0];this.result.isEndOfRule=void 0===e,e instanceof N&&(this.result.token=e.terminalType,this.result.occurrence=e.idx)}else super.walkMany(e,t,s)}}class e0 extends eZ{walkManySep(e,t,s){if(e.idx===this.occurrence){let e=t.concat(s)[0];this.result.isEndOfRule=void 0===e,e instanceof N&&(this.result.token=e.terminalType,this.result.occurrence=e.idx)}else super.walkManySep(e,t,s)}}class e1 extends eZ{walkAtLeastOne(e,t,s){if(e.idx===this.occurrence){let e=t.concat(s)[0];this.result.isEndOfRule=void 0===e,e instanceof N&&(this.result.token=e.terminalType,this.result.occurrence=e.idx)}else super.walkAtLeastOne(e,t,s)}}class e2 extends eZ{walkAtLeastOneSep(e,t,s){if(e.idx===this.occurrence){let e=t.concat(s)[0];this.result.isEndOfRule=void 0===e,e instanceof N&&(this.result.token=e.terminalType,this.result.occurrence=e.idx)}else super.walkAtLeastOneSep(e,t,s)}}function e5(e,t,s=[]){s=[...s];let i=[],n=0;function a(a){let r=e5(a.concat(e.slice(n+1)),t,s);return i.concat(r)}for(;s.length<t&&n<e.length;){let t=e[n];if(t instanceof A)return a(t.definition);if(t instanceof g)return a(t.definition);if(t instanceof S)i=a(t.definition);else if(t instanceof L)return a(t.definition.concat([new R({definition:t.definition})]));else if(t instanceof O)return a([new A({definition:t.definition}),new R({definition:[new N({terminalType:t.separator})].concat(t.definition)})]);else if(t instanceof k)i=a(t.definition.concat([new R({definition:[new N({terminalType:t.separator})].concat(t.definition)})]));else if(t instanceof R)i=a(t.definition.concat([new R({definition:t.definition})]));else if(t instanceof I)return t.definition.forEach(e=>{0!==e.definition.length&&(i=a(e.definition))}),i;else if(t instanceof N)s.push(t.terminalType);else throw Error("non exhaustive match");n++}return i.push({partialPath:s,suffixDef:e.slice(n)}),i}function e6(e){if(e instanceof S||"Option"===e)return n.OPTION;if(e instanceof R||"Repetition"===e)return n.REPETITION;if(e instanceof L||"RepetitionMandatory"===e)return n.REPETITION_MANDATORY;if(e instanceof O||"RepetitionMandatoryWithSeparator"===e)return n.REPETITION_MANDATORY_WITH_SEPARATOR;if(e instanceof k||"RepetitionWithSeparator"===e)return n.REPETITION_WITH_SEPARATOR;else if(e instanceof I||"Alternation"===e)return n.ALTERNATION;else throw Error("non exhaustive match")}function e4(e,t,s,i){let n=e.length,a=e.every(e=>e.every(e=>1===e.length));if(t)return function(t){let i=t.map(e=>e.GATE);for(let t=0;t<n;t++){let n=e[t],a=n.length,r=i[t];if(void 0===r||!1!==r.call(this))e:for(let e=0;e<a;e++){let i=n[e],a=i.length;for(let e=0;e<a;e++)if(!1===s(this.LA_FAST(e+1),i[e]))continue e;return t}}};if(!a||i)return function(){for(let t=0;t<n;t++){let i=e[t],n=i.length;e:for(let e=0;e<n;e++){let n=i[e],a=n.length;for(let e=0;e<a;e++)if(!1===s(this.LA_FAST(e+1),n[e]))continue e;return t}}};{let t=e.map(e=>e.flat()).reduce((e,t,s)=>(t.forEach(t=>{t.tokenTypeIdx in e||(e[t.tokenTypeIdx]=s),t.categoryMatches.forEach(t=>{Object.hasOwn(e,t)||(e[t]=s)})}),e),{});return function(){return t[this.LA_FAST(1).tokenTypeIdx]}}}function e3(e,t,s){let i=e.every(e=>1===e.length),n=e.length;if(!i||s)return function(){e:for(let s=0;s<n;s++){let i=e[s],n=i.length;for(let e=0;e<n;e++)if(!1===t(this.LA_FAST(e+1),i[e]))continue e;return!0}return!1};{let t=e.flat();if(1===t.length&&0===t[0].categoryMatches.length){let e=t[0].tokenTypeIdx;return function(){return this.LA_FAST(1).tokenTypeIdx===e}}{let e=t.reduce((e,t,s)=>(e[t.tokenTypeIdx]=!0,t.categoryMatches.forEach(t=>{e[t]=!0}),e),[]);return function(){return!0===e[this.LA_FAST(1).tokenTypeIdx]}}}}!function(e){e[e.OPTION=0]="OPTION",e[e.REPETITION=1]="REPETITION",e[e.REPETITION_MANDATORY=2]="REPETITION_MANDATORY",e[e.REPETITION_MANDATORY_WITH_SEPARATOR=3]="REPETITION_MANDATORY_WITH_SEPARATOR",e[e.REPETITION_WITH_SEPARATOR=4]="REPETITION_WITH_SEPARATOR",e[e.ALTERNATION=5]="ALTERNATION"}(n||(n={}));class e9 extends x{constructor(e,t,s){super(),this.topProd=e,this.targetOccurrence=t,this.targetProdType=s}startWalking(){return this.walk(this.topProd),this.restDef}checkIsTarget(e,t,s,i){return e.idx===this.targetOccurrence&&this.targetProdType===t&&(this.restDef=s.concat(i),!0)}walkOption(e,t,s){this.checkIsTarget(e,n.OPTION,t,s)||super.walkOption(e,t,s)}walkAtLeastOne(e,t,s){this.checkIsTarget(e,n.REPETITION_MANDATORY,t,s)||super.walkOption(e,t,s)}walkAtLeastOneSep(e,t,s){this.checkIsTarget(e,n.REPETITION_MANDATORY_WITH_SEPARATOR,t,s)||super.walkOption(e,t,s)}walkMany(e,t,s){this.checkIsTarget(e,n.REPETITION,t,s)||super.walkOption(e,t,s)}walkManySep(e,t,s){this.checkIsTarget(e,n.REPETITION_WITH_SEPARATOR,t,s)||super.walkOption(e,t,s)}}class e8 extends C{constructor(e,t,s){super(),this.targetOccurrence=e,this.targetProdType=t,this.targetRef=s,this.result=[]}checkIsTarget(e,t){e.idx===this.targetOccurrence&&this.targetProdType===t&&(void 0===this.targetRef||e===this.targetRef)&&(this.result=e.definition)}visitOption(e){this.checkIsTarget(e,n.OPTION)}visitRepetition(e){this.checkIsTarget(e,n.REPETITION)}visitRepetitionMandatory(e){this.checkIsTarget(e,n.REPETITION_MANDATORY)}visitRepetitionMandatoryWithSeparator(e){this.checkIsTarget(e,n.REPETITION_MANDATORY_WITH_SEPARATOR)}visitRepetitionWithSeparator(e){this.checkIsTarget(e,n.REPETITION_WITH_SEPARATOR)}visitAlternation(e){this.checkIsTarget(e,n.ALTERNATION)}}function e7(e){let t=Array(e);for(let s=0;s<e;s++)t[s]=[];return t}function te(e){let t=[""];for(let s=0;s<e.length;s++){let i=e[s],n=[];for(let e=0;e<t.length;e++){let s=t[e];n.push(s+"_"+i.tokenTypeIdx);for(let e=0;e<i.categoryMatches.length;e++){let t="_"+i.categoryMatches[e];n.push(s+t)}}t=n}return t}function tt(e,t){let s=e.map(e=>e5([e],1)),i=e7(s.length),n=s.map(e=>{let t={};return e.forEach(e=>{te(e.partialPath).forEach(e=>{t[e]=!0})}),t}),a=s;for(let e=1;e<=t;e++){let s=a;a=e7(s.length);for(let r=0;r<s.length;r++){let o=s[r];for(let s=0;s<o.length;s++){let l=o[s].partialPath,c=o[s].suffixDef,h=te(l);if(function(e,t,s){for(let i=0;i<e.length;i++){if(i===s)continue;let n=e[i];for(let e=0;e<t.length;e++)if(!0===n[t[e]])return!1}return!0}(n,h,r)||0===c.length||l.length===t){let e=i[r];if(!1===tn(e,l)){e.push(l);for(let e=0;e<h.length;e++){let t=h[e];n[r][t]=!0}}}else{let t=e5(c,e+1,l);a[r]=a[r].concat(t),t.forEach(e=>{te(e.partialPath).forEach(e=>{n[r][e]=!0})})}}}}return i}function ts(e,t,s,i){let a=new e8(e,n.ALTERNATION,i);return t.accept(a),tt(a.result,s)}function ti(e,t,s,i){let n=new e8(e,s);t.accept(n);let a=n.result,r=new e9(t,e,s).startWalking();return tt([new A({definition:a}),new A({definition:r})],i)}function tn(e,t){t:for(let s=0;s<e.length;s++){let i=e[s];if(i.length===t.length){for(let e=0;e<i.length;e++){let s=t[e],n=i[e];if(!1==(s===n||void 0!==n.categoryMatchesMap[s.tokenTypeIdx]))continue t}return!0}}return!1}function ta(e){return e.every(e=>e.every(e=>e.every(e=>0===e.categoryMatches.length)))}function tr(e){return`${v(e)}_#_${e.idx}_#_${to(e)}`}function to(e){return e instanceof N?e.terminalType.name:e instanceof g?e.nonTerminalName:""}class tl extends C{constructor(){super(...arguments),this.allProductions=[]}visitNonTerminal(e){this.allProductions.push(e)}visitOption(e){this.allProductions.push(e)}visitRepetitionWithSeparator(e){this.allProductions.push(e)}visitRepetitionMandatory(e){this.allProductions.push(e)}visitRepetitionMandatoryWithSeparator(e){this.allProductions.push(e)}visitRepetition(e){this.allProductions.push(e)}visitAlternation(e){this.allProductions.push(e)}visitTerminal(e){this.allProductions.push(e)}}class tc extends C{constructor(){super(...arguments),this.alternations=[]}visitAlternation(e){this.alternations.push(e)}}class th extends C{constructor(){super(...arguments),this.allProductions=[]}visitRepetitionWithSeparator(e){this.allProductions.push(e)}visitRepetitionMandatory(e){this.allProductions.push(e)}visitRepetitionMandatoryWithSeparator(e){this.allProductions.push(e)}visitRepetition(e){this.allProductions.push(e)}}let td="MismatchedTokenException",tu="NoViableAltException",tp="EarlyExitException",tf="NotAllInputParsedException",tm=[td,tu,tp,tf];function tE(e){return tm.includes(e.name)}Object.freeze(tm);class tT extends Error{constructor(e,t){super(e),this.token=t,this.resyncedTokens=[],Object.setPrototypeOf(this,new.target.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor)}}class tg extends tT{constructor(e,t,s){super(e,t),this.previousToken=s,this.name=td}}class ty extends tT{constructor(e,t,s){super(e,t),this.previousToken=s,this.name=tu}}class tA extends tT{constructor(e,t){super(e,t),this.name=tf}}class tS extends tT{constructor(e,t,s){super(e,t),this.previousToken=s,this.name=tp}}let tL={},tO="InRuleRecoveryException";class tR extends Error{constructor(e){super(e),this.name=tO}}class tk{initRecoverable(e){this.firstAfterRepMap=[],this.resyncFollows={},this.recoveryEnabled=Object.hasOwn(e,"recoveryEnabled")?e.recoveryEnabled:tJ.recoveryEnabled,this.recoveryEnabled&&(this.attemptInRepetitionRecovery=tI)}getTokenToInsert(e){let t=eV(e,"",-1,-1,-1,-1,-1,-1);return t.isInsertedInRecovery=!0,t}canTokenTypeBeInsertedInRecovery(e){return!0}canTokenTypeBeDeletedInRecovery(e){return!0}tryInRepetitionRecovery(e,t,s,i){let n=this.findReSyncTokenType(),a=this.exportLexerState(),r=[],o=!1,l=this.LA_FAST(1),c=this.LA_FAST(1),h=()=>{let e=this.LA(0),t=new tg(this.errorMessageProvider.buildMismatchTokenMessage({expected:i,actual:l,previous:e,ruleName:this.getCurrRuleFullName()}),l,this.LA(0));t.resyncedTokens=r.slice(0,-1),this.SAVE_ERROR(t)};for(;!o;)if(this.tokenMatcher(c,i))return void h();else if(s.call(this)){h(),e.apply(this,t);return}else this.tokenMatcher(c,n)?o=!0:(c=this.SKIP_TOKEN(),this.addToResyncTokens(c,r));this.importLexerState(a)}shouldInRepetitionRecoveryBeTried(e,t,s){return!(!1===s||this.tokenMatcher(this.LA_FAST(1),e)||this.isBackTracking()||this.canPerformInRuleRecovery(e,this.getFollowsForInRuleRecovery(e,t)))}getNextPossibleTokenTypes(e){let t=e.ruleStack[0];return new eJ(this.getGAstProductions()[t],e).startWalking()}getFollowsForInRuleRecovery(e,t){let s=this.getCurrentGrammarPath(e,t);return this.getNextPossibleTokenTypes(s)}tryInRuleRecovery(e,t){if(this.canRecoverWithSingleTokenInsertion(e,t))return this.getTokenToInsert(e);if(this.canRecoverWithSingleTokenDeletion(e)){let e=this.SKIP_TOKEN();return this.consumeToken(),e}throw new tR("sad sad panda")}canPerformInRuleRecovery(e,t){return this.canRecoverWithSingleTokenInsertion(e,t)||this.canRecoverWithSingleTokenDeletion(e)}canRecoverWithSingleTokenInsertion(e,t){if(!this.canTokenTypeBeInsertedInRecovery(e)||0===t.length)return!1;let s=this.LA_FAST(1);return void 0!==t.find(e=>this.tokenMatcher(s,e))}canRecoverWithSingleTokenDeletion(e){return!!this.canTokenTypeBeDeletedInRecovery(e)&&this.tokenMatcher(this.LA(2),e)}isInCurrentRuleReSyncSet(e){let t=this.getCurrFollowKey();return this.getFollowSetFromFollowKey(t).includes(e)}findReSyncTokenType(){let e=this.flattenFollowSet(),t=this.LA_FAST(1),s=2;for(;;){let i=e.find(e=>eO(t,e));if(void 0!==i)return i;t=this.LA(s),s++}}getCurrFollowKey(){if(0===this.RULE_STACK_IDX)return tL;let e=this.currRuleShortName,t=this.getLastExplicitRuleOccurrenceIndex(),s=this.getPreviousExplicitRuleShortName();return{ruleName:this.shortRuleNameToFullName(e),idxInCallingRule:t,inRule:this.shortRuleNameToFullName(s)}}buildFullFollowKeyStack(){let e=this.RULE_STACK,t=this.RULE_OCCURRENCE_STACK,s=this.RULE_STACK_IDX+1,i=Array(s);for(let n=0;n<s;n++)0===n?i[n]=tL:i[n]={ruleName:this.shortRuleNameToFullName(e[n]),idxInCallingRule:t[n],inRule:this.shortRuleNameToFullName(e[n-1])};return i}flattenFollowSet(){return this.buildFullFollowKeyStack().map(e=>this.getFollowSetFromFollowKey(e)).flat()}getFollowSetFromFollowKey(e){if(e===tL)return[eW];let t=e.ruleName+e.idxInCallingRule+w+e.inRule;return this.resyncFollows[t]}addToResyncTokens(e,t){return this.tokenMatcher(e,eW)||t.push(e),t}reSyncTo(e){let t=[],s=this.LA_FAST(1);for(;!1===this.tokenMatcher(s,e);)s=this.SKIP_TOKEN(),this.addToResyncTokens(s,t);return t.slice(0,-1)}attemptInRepetitionRecovery(e,t,s,i,n,a,r){}getCurrentGrammarPath(e,t){let s=this.getHumanReadableRuleStack();return{ruleStack:s,occurrenceStack:this.RULE_OCCURRENCE_STACK.slice(0,this.RULE_OCCURRENCE_STACK_IDX+1),lastTok:e,lastTokOccurrence:t}}getHumanReadableRuleStack(){let e=this.RULE_STACK_IDX+1,t=Array(e);for(let s=0;s<e;s++)t[s]=this.shortRuleNameToFullName(this.RULE_STACK[s]);return t}}function tI(e,t,s,i,n,a,r){var o,l,c;let h=i|n,d=null!=(o=(l=this.firstAfterRepMap)[c=this.currRuleShortName])?o:l[c]=[],u=d[h];if(void 0===u){let e=this.getCurrRuleFullName();u=new a(this.getGAstProductions()[e],n).startWalking(),d[h]=u}let p=u.token,f=u.occurrence,m=u.isEndOfRule;0===this.RULE_STACK_IDX&&m&&void 0===p&&(p=eW,f=1),void 0!==p&&void 0!==f&&this.shouldInRepetitionRecoveryBeTried(p,f,r)&&this.tryInRepetitionRecovery(e,t,s,p)}class tN{constructor(e){var t;this.maxLookahead=null!=(t=null==e?void 0:e.maxLookahead)?t:tJ.maxLookahead}validate(e){let t=this.validateNoLeftRecursion(e.rules);if(0===t.length){let s=this.validateEmptyOrAlternatives(e.rules);return[...t,...s,...this.validateAmbiguousAlternationAlternatives(e.rules,this.maxLookahead),...this.validateSomeNonEmptyLookaheadPath(e.rules,this.maxLookahead)]}return t}validateNoLeftRecursion(e){return e.flatMap(e=>(function e(t,s,i,n=[]){let a=[],o=function e(t){let s=[];if(0===t.length)return s;let i=t[0];if(i instanceof g)s.push(i.referencedRule);else if(i instanceof A||i instanceof S||i instanceof L||i instanceof O||i instanceof k||i instanceof R)s=s.concat(e(i.definition));else if(i instanceof I)s=i.definition.map(t=>e(t.definition)).flat();else if(i instanceof N);else throw Error("non exhaustive match");let n=_(i),a=t.length>1;if(!n||!a)return s;{let i=t.slice(1);return s.concat(e(i))}}(s.definition);if(0===o.length)return[];{let s=t.name;o.includes(t)&&a.push({message:i.buildLeftRecursionError({topLevelRule:t,leftRecursionPath:n}),type:r.LEFT_RECURSION,ruleName:s});let l=n.concat([t]),c=o.filter(e=>!l.includes(e)).flatMap(s=>{let a=[...n];return a.push(s),e(t,s,i,a)});return a.concat(c)}})(e,e,eY))}validateEmptyOrAlternatives(e){return e.flatMap(e=>(function(e,t){let s=new tc;return e.accept(s),s.alternations.flatMap(s=>s.definition.slice(0,-1).flatMap((i,n)=>0===function(e,t,s,i){let n="EXIT_NONE_TERMINAL",a=[n],r="EXIT_ALTERNATIVE",o=!1,l=t.length,c=l-1-1,h=[],d=[];for(d.push({idx:-1,def:e,ruleStack:[],occurrenceStack:[]});0!==d.length;){let e=d.pop();if(e===r){o&&d.at(-1).idx<=c&&d.pop();continue}let i=e.def,u=e.idx,p=e.ruleStack,f=e.occurrenceStack;if(0===i.length)continue;let m=i[0];if(m===n){let e={idx:u,def:i.slice(1),ruleStack:p.slice(0,-1),occurrenceStack:f.slice(0,-1)};d.push(e)}else if(m instanceof N)if(u<l-1){let e=u+1;if(s(t[e],m.terminalType)){let t={idx:e,def:i.slice(1),ruleStack:p,occurrenceStack:f};d.push(t)}}else if(u===l-1)h.push({nextTokenType:m.terminalType,nextTokenOccurrence:m.idx,ruleStack:p,occurrenceStack:f}),o=!0;else throw Error("non exhaustive match");else if(m instanceof g){let e=[...p];e.push(m.nonTerminalName);let t=[...f];t.push(m.idx);let s={idx:u,def:m.definition.concat(a,i.slice(1)),ruleStack:e,occurrenceStack:t};d.push(s)}else if(m instanceof S){let e={idx:u,def:i.slice(1),ruleStack:p,occurrenceStack:f};d.push(e),d.push(r);let t={idx:u,def:m.definition.concat(i.slice(1)),ruleStack:p,occurrenceStack:f};d.push(t)}else if(m instanceof L){let e=new R({definition:m.definition,idx:m.idx}),t={idx:u,def:m.definition.concat([e],i.slice(1)),ruleStack:p,occurrenceStack:f};d.push(t)}else if(m instanceof O){let e=new R({definition:[new N({terminalType:m.separator})].concat(m.definition),idx:m.idx}),t={idx:u,def:m.definition.concat([e],i.slice(1)),ruleStack:p,occurrenceStack:f};d.push(t)}else if(m instanceof k){let e={idx:u,def:i.slice(1),ruleStack:p,occurrenceStack:f};d.push(e),d.push(r);let t=new R({definition:[new N({terminalType:m.separator})].concat(m.definition),idx:m.idx}),s={idx:u,def:m.definition.concat([t],i.slice(1)),ruleStack:p,occurrenceStack:f};d.push(s)}else if(m instanceof R){let e={idx:u,def:i.slice(1),ruleStack:p,occurrenceStack:f};d.push(e),d.push(r);let t=new R({definition:m.definition,idx:m.idx}),s={idx:u,def:m.definition.concat([t],i.slice(1)),ruleStack:p,occurrenceStack:f};d.push(s)}else if(m instanceof I)for(let e=m.definition.length-1;e>=0;e--){let t={idx:u,def:m.definition[e].definition.concat(i.slice(1)),ruleStack:p,occurrenceStack:f};d.push(t),d.push(r)}else if(m instanceof A)d.push({idx:u,def:m.definition.concat(i.slice(1)),ruleStack:p,occurrenceStack:f});else if(m instanceof y)d.push(function(e,t,s,i){let n=[...s];n.push(e.name);let a=[...i];return a.push(1),{idx:t,def:e.definition,ruleStack:n,occurrenceStack:a}}(m,u,p,f));else throw Error("non exhaustive match")}return h}([i],[],eO,0).length?[{message:t.buildEmptyAlternationError({topLevelRule:e,alternation:s,emptyChoiceIdx:n}),type:r.NONE_LAST_EMPTY_ALT,ruleName:e.name,occurrence:s.idx,alternative:n+1}]:[]))})(e,eY))}validateAmbiguousAlternationAlternatives(e,t){return e.flatMap(e=>(function(e,t,s){let i=new tc;e.accept(i);let n=i.alternations;return(n=n.filter(e=>!0!==e.ignoreAmbiguities)).flatMap(i=>{let n=ts(i.idx,e,i.maxLookahead||t,i),a=function(e,t,s,i){let n=[];return e.reduce((s,i,a)=>(!0===t.definition[a].ignoreAmbiguities||i.forEach(i=>{let r=[a];e.forEach((e,s)=>{a!==s&&tn(e,i)&&!0!==t.definition[s].ignoreAmbiguities&&r.push(s)}),r.length>1&&!tn(n,i)&&(n.push(i),s.push({alts:r,path:i}))}),s),[]).map(e=>{let n=e.alts.map(e=>e+1);return{message:i.buildAlternationAmbiguityError({topLevelRule:s,alternation:t,ambiguityIndices:n,prefixPath:e.path}),type:r.AMBIGUOUS_ALTS,ruleName:s.name,occurrence:t.idx,alternatives:e.alts}})}(n,i,e,s),o=function(e,t,s,i){let n=e.reduce((e,t,s)=>{let i=t.map(e=>({idx:s,path:e}));return e.concat(i)},[]);return n.flatMap(e=>{if(!0===t.definition[e.idx].ignoreAmbiguities)return[];let a=e.idx,o=e.path;return n.filter(e=>{var s;return!0!==t.definition[e.idx].ignoreAmbiguities&&e.idx<a&&(s=e.path,s.length<o.length&&s.every((e,t)=>{let s=o[t];return e===s||s.categoryMatchesMap[e.tokenTypeIdx]}))}).map(e=>{let n=[e.idx+1,a+1],o=0===t.idx?"":t.idx;return{message:i.buildAlternationPrefixAmbiguityError({topLevelRule:s,alternation:t,ambiguityIndices:n,prefixPath:e.path}),type:r.AMBIGUOUS_PREFIX_ALTS,ruleName:s.name,occurrence:o,alternatives:n}})})}(n,i,e,s);return a.concat(o)})})(e,t,eY))}validateSomeNonEmptyLookaheadPath(e,t){let s=[];return e.forEach(e=>{let i=new th;e.accept(i),i.allProductions.forEach(i=>{let n=e6(i),a=i.maxLookahead||t;if(0===ti(i.idx,e,n,a)[0].flat().length){let t=eY.buildEmptyRepetitionError({topLevelRule:e,repetition:i});s.push({message:t,type:r.NO_NON_EMPTY_LOOKAHEAD,ruleName:e.name})}})}),s}buildLookaheadForAlternation(e){return function(e,t,s,i,n,a){let r=ts(e,t,s),o=ta(r)?eR:eO;return a(r,i,o,n)}(e.prodOccurrence,e.rule,e.maxLookahead,e.hasPredicates,e.dynamicTokensEnabled,e4)}buildLookaheadForOptional(e){return function(e,t,s,i,n,a){let r=ti(e,t,n,s),o=ta(r)?eR:eO;return a(r[0],o,i)}(e.prodOccurrence,e.rule,e.maxLookahead,e.dynamicTokensEnabled,e6(e.prodType),e3)}}class tb{initLooksAhead(e){this.dynamicTokensEnabled=Object.hasOwn(e,"dynamicTokensEnabled")?e.dynamicTokensEnabled:tJ.dynamicTokensEnabled,this.maxLookahead=Object.hasOwn(e,"maxLookahead")?e.maxLookahead:tJ.maxLookahead,this.lookaheadStrategy=Object.hasOwn(e,"lookaheadStrategy")?e.lookaheadStrategy:new tN({maxLookahead:this.maxLookahead}),this.lookAheadFuncsCache=[],this.currRuleLookaheadFuncs=[]}preComputeLookaheadFunctions(e){e.forEach(e=>{this.TRACE_INIT(`${e.name} Rule Lookahead`,()=>{let{alternation:t,repetition:s,option:i,repetitionMandatory:n,repetitionMandatoryWithSeparator:a,repetitionWithSeparator:r}=function(e){t_.reset(),e.accept(t_);let t=t_.dslMethods;return t_.reset(),t}(e);t.forEach(t=>{let s=0===t.idx?"":t.idx;this.TRACE_INIT(`${v(t)}${s}`,()=>{let s=this.lookaheadStrategy.buildLookaheadForAlternation({prodOccurrence:t.idx,rule:e,maxLookahead:t.maxLookahead||this.maxLookahead,hasPredicates:t.hasPredicates,dynamicTokensEnabled:this.dynamicTokensEnabled});this.setLaFuncCache(this.fullRuleNameToShort[e.name],256|t.idx,s)})}),s.forEach(t=>{this.computeLookaheadFunc(e,t.idx,768,"Repetition",t.maxLookahead,v(t))}),i.forEach(t=>{this.computeLookaheadFunc(e,t.idx,512,"Option",t.maxLookahead,v(t))}),n.forEach(t=>{this.computeLookaheadFunc(e,t.idx,1024,"RepetitionMandatory",t.maxLookahead,v(t))}),a.forEach(t=>{this.computeLookaheadFunc(e,t.idx,1536,"RepetitionMandatoryWithSeparator",t.maxLookahead,v(t))}),r.forEach(t=>{this.computeLookaheadFunc(e,t.idx,1280,"RepetitionWithSeparator",t.maxLookahead,v(t))})})})}computeLookaheadFunc(e,t,s,i,n,a){this.TRACE_INIT(`${a}${0===t?"":t}`,()=>{let a=this.lookaheadStrategy.buildLookaheadForOptional({prodOccurrence:t,rule:e,maxLookahead:n||this.maxLookahead,dynamicTokensEnabled:this.dynamicTokensEnabled,prodType:i});this.setLaFuncCache(this.fullRuleNameToShort[e.name],s|t,a)})}setLaFuncCache(e,t,s){let i=this.lookAheadFuncsCache[e];void 0===i&&(i=[],this.lookAheadFuncsCache[e]=i),i[t]=s}}class tC extends C{constructor(){super(...arguments),this.dslMethods={option:[],alternation:[],repetition:[],repetitionWithSeparator:[],repetitionMandatory:[],repetitionMandatoryWithSeparator:[]}}reset(){this.dslMethods={option:[],alternation:[],repetition:[],repetitionWithSeparator:[],repetitionMandatory:[],repetitionMandatoryWithSeparator:[]}}visitOption(e){this.dslMethods.option.push(e)}visitRepetitionWithSeparator(e){this.dslMethods.repetitionWithSeparator.push(e)}visitRepetitionMandatory(e){this.dslMethods.repetitionMandatory.push(e)}visitRepetitionMandatoryWithSeparator(e){this.dslMethods.repetitionMandatoryWithSeparator.push(e)}visitRepetition(e){this.dslMethods.repetition.push(e)}visitAlternation(e){this.dslMethods.alternation.push(e)}}let t_=new tC;function tv(e,t){-1===e.startOffset?(e.startOffset=t.startOffset,e.endOffset=t.endOffset):e.endOffset<t.endOffset==!0&&(e.endOffset=t.endOffset)}function tx(e,t){-1===e.startOffset?(e.startOffset=t.startOffset,e.startColumn=t.startColumn,e.startLine=t.startLine,e.endOffset=t.endOffset,e.endColumn=t.endColumn,e.endLine=t.endLine):e.endOffset<t.endOffset==!0&&(e.endOffset=t.endOffset,e.endColumn=t.endColumn,e.endLine=t.endLine)}function tU(e,t){Object.defineProperty(e,"name",{enumerable:!1,configurable:!0,writable:!1,value:t})}function tM(e,t){let s=Object.keys(e),i=s.length;for(let n=0;n<i;n++){let i=e[s[n]],a=i.length;for(let e=0;e<a;e++){let s=i[e];void 0===s.tokenTypeIdx&&this[s.name](s.children,t)}}}!function(e){e[e.REDUNDANT_METHOD=0]="REDUNDANT_METHOD",e[e.MISSING_METHOD=1]="MISSING_METHOD"}(a||(a={}));class tw{initTreeBuilder(e){if(this.CST_STACK=[],this.outputCst=e.outputCst,this.nodeLocationTracking=Object.hasOwn(e,"nodeLocationTracking")?e.nodeLocationTracking:tJ.nodeLocationTracking,this.outputCst)if(/full/i.test(this.nodeLocationTracking))this.recoveryEnabled?(this.setNodeLocationFromToken=tx,this.setNodeLocationFromNode=tx,this.cstPostRule=()=>{},this.setInitialNodeLocation=this.setInitialNodeLocationFullRecovery):(this.setNodeLocationFromToken=()=>{},this.setNodeLocationFromNode=()=>{},this.cstPostRule=this.cstPostRuleFull,this.setInitialNodeLocation=this.setInitialNodeLocationFullRegular);else if(/onlyOffset/i.test(this.nodeLocationTracking))this.recoveryEnabled?(this.setNodeLocationFromToken=tv,this.setNodeLocationFromNode=tv,this.cstPostRule=()=>{},this.setInitialNodeLocation=this.setInitialNodeLocationOnlyOffsetRecovery):(this.setNodeLocationFromToken=()=>{},this.setNodeLocationFromNode=()=>{},this.cstPostRule=this.cstPostRuleOnlyOffset,this.setInitialNodeLocation=this.setInitialNodeLocationOnlyOffsetRegular);else if(/none/i.test(this.nodeLocationTracking))this.setNodeLocationFromToken=()=>{},this.setNodeLocationFromNode=()=>{},this.cstPostRule=()=>{},this.setInitialNodeLocation=()=>{};else throw Error(`Invalid <nodeLocationTracking> config option: "${e.nodeLocationTracking}"`);else this.cstInvocationStateUpdate=()=>{},this.cstFinallyStateUpdate=()=>{},this.cstPostTerminal=()=>{},this.cstPostNonTerminal=()=>{},this.cstPostRule=()=>{}}setInitialNodeLocationOnlyOffsetRecovery(e){e.location={startOffset:-1,endOffset:-1}}setInitialNodeLocationOnlyOffsetRegular(e){e.location={startOffset:this.LA_FAST(1).startOffset,endOffset:-1}}setInitialNodeLocationFullRecovery(e){e.location={startOffset:-1,startLine:-1,startColumn:-1,endOffset:-1,endLine:-1,endColumn:-1}}setInitialNodeLocationFullRegular(e){let t=this.LA_FAST(1);e.location={startOffset:t.startOffset,startLine:t.startLine,startColumn:t.startColumn,endOffset:-1,endLine:-1,endColumn:-1}}cstInvocationStateUpdate(e){let t={name:e,children:Object.create(null)};this.setInitialNodeLocation(t),this.CST_STACK.push(t)}cstFinallyStateUpdate(){this.CST_STACK.pop()}cstPostRuleFull(e){let t=this.LA(0),s=e.location;-1!==s.startOffset&&s.startOffset<=t.startOffset==!0?(s.endOffset=t.endOffset,s.endLine=t.endLine,s.endColumn=t.endColumn):(s.startOffset=-1,s.startLine=-1,s.startColumn=-1)}cstPostRuleOnlyOffset(e){let t=this.LA(0),s=e.location;-1!==s.startOffset&&s.startOffset<=t.startOffset==!0?s.endOffset=t.endOffset:s.startOffset=-1}cstPostTerminal(e,t){let s=this.CST_STACK[this.CST_STACK.length-1];void 0===s.children[e]?s.children[e]=[t]:s.children[e].push(t),this.setNodeLocationFromToken(s.location,t)}cstPostNonTerminal(e,t){let s=this.CST_STACK[this.CST_STACK.length-1];void 0===s.children[t]?s.children[t]=[e]:s.children[t].push(e),this.setNodeLocationFromNode(s.location,e.location)}get currCSTNode(){return this.CST_STACK[this.CST_STACK.length-1]}getBaseCstVisitorConstructor(){if(void 0===this.baseCstVisitorConstructor){let e=function(e,t){let s=function(){};return tU(s,e+"BaseSemantics"),s.prototype={visit:function(e,t){if(Array.isArray(e)&&(e=e[0]),void 0!==e)return this[e.name](e.children,t)},validateVisitor:function(){var e,s,i;let n=(e=this,s=t,i=e,s.filter(e=>"function"==typeof i[e]==!1).map(e=>({msg:`Missing visitor method: <${e}> on ${i.constructor.name} CST Visitor.`,type:a.MISSING_METHOD,methodName:e})).filter(Boolean));if(0!==n.length){let e=n.map(e=>e.msg);throw Error(`Errors Detected in CST Visitor <${this.constructor.name}>:
|
|
51
|
+
see: https://en.wikipedia.org/wiki/LL_parser#Left_factoring.`},buildInvalidRuleNameError:e=>"deprecated",buildDuplicateRuleNameError(e){let t;return t=e.topLevelRule instanceof y?e.topLevelRule.name:e.topLevelRule,`Duplicate definition, rule: ->${t}<- is already defined in the grammar: ->${e.grammarName}<-`}};class eX extends C{constructor(e,t){super(),this.nameToTopRule=e,this.errMsgProvider=t,this.errors=[]}resolveRefs(){Object.values(this.nameToTopRule).forEach(e=>{this.currTopLevel=e,e.accept(this)})}visitNonTerminal(e){let t=this.nameToTopRule[e.nonTerminalName];if(t)e.referencedRule=t;else{let t=this.errMsgProvider.buildRuleNotFoundError(this.currTopLevel,e);this.errors.push({message:t,type:r.UNRESOLVED_SUBRULE_REF,ruleName:this.currTopLevel.name,unresolvedRefName:e.nonTerminalName})}}}class eq extends x{constructor(e,t){super(),this.topProd=e,this.path=t,this.possibleTokTypes=[],this.nextProductionName="",this.nextProductionOccurrence=0,this.found=!1,this.isAtEndOfPath=!1}startWalking(){if(this.found=!1,this.path.ruleStack[0]!==this.topProd.name)throw Error("The path does not start with the walker's top Rule!");return this.ruleStack=[...this.path.ruleStack].reverse(),this.occurrenceStack=[...this.path.occurrenceStack].reverse(),this.ruleStack.pop(),this.occurrenceStack.pop(),this.updateExpectedNext(),this.walk(this.topProd),this.possibleTokTypes}walk(e,t=[]){this.found||super.walk(e,t)}walkProdRef(e,t,s){if(e.referencedRule.name===this.nextProductionName&&e.idx===this.nextProductionOccurrence){let i=t.concat(s);this.updateExpectedNext(),this.walk(e.referencedRule,i)}}updateExpectedNext(){0===this.ruleStack.length?(this.nextProductionName="",this.nextProductionOccurrence=0,this.isAtEndOfPath=!0):(this.nextProductionName=this.ruleStack.pop(),this.nextProductionOccurrence=this.occurrenceStack.pop())}}class eJ extends eq{constructor(e,t){super(e,t),this.path=t,this.nextTerminalName="",this.nextTerminalOccurrence=0,this.nextTerminalName=this.path.lastTok.name,this.nextTerminalOccurrence=this.path.lastTokOccurrence}walkTerminal(e,t,s){if(this.isAtEndOfPath&&e.terminalType.name===this.nextTerminalName&&e.idx===this.nextTerminalOccurrence&&!this.found){let e=new A({definition:t.concat(s)});this.possibleTokTypes=M(e),this.found=!0}}}class eZ extends x{constructor(e,t){super(),this.topRule=e,this.occurrence=t,this.result={token:void 0,occurrence:void 0,isEndOfRule:void 0}}startWalking(){return this.walk(this.topRule),this.result}}class eQ extends eZ{walkMany(e,t,s){if(e.idx===this.occurrence){let e=t.concat(s)[0];this.result.isEndOfRule=void 0===e,e instanceof N&&(this.result.token=e.terminalType,this.result.occurrence=e.idx)}else super.walkMany(e,t,s)}}class e0 extends eZ{walkManySep(e,t,s){if(e.idx===this.occurrence){let e=t.concat(s)[0];this.result.isEndOfRule=void 0===e,e instanceof N&&(this.result.token=e.terminalType,this.result.occurrence=e.idx)}else super.walkManySep(e,t,s)}}class e1 extends eZ{walkAtLeastOne(e,t,s){if(e.idx===this.occurrence){let e=t.concat(s)[0];this.result.isEndOfRule=void 0===e,e instanceof N&&(this.result.token=e.terminalType,this.result.occurrence=e.idx)}else super.walkAtLeastOne(e,t,s)}}class e2 extends eZ{walkAtLeastOneSep(e,t,s){if(e.idx===this.occurrence){let e=t.concat(s)[0];this.result.isEndOfRule=void 0===e,e instanceof N&&(this.result.token=e.terminalType,this.result.occurrence=e.idx)}else super.walkAtLeastOneSep(e,t,s)}}function e6(e,t,s=[]){s=[...s];let i=[],n=0;function a(a){let r=e6(a.concat(e.slice(n+1)),t,s);return i.concat(r)}for(;s.length<t&&n<e.length;){let t=e[n];if(t instanceof A)return a(t.definition);if(t instanceof g)return a(t.definition);if(t instanceof S)i=a(t.definition);else if(t instanceof L)return a(t.definition.concat([new R({definition:t.definition})]));else if(t instanceof O)return a([new A({definition:t.definition}),new R({definition:[new N({terminalType:t.separator})].concat(t.definition)})]);else if(t instanceof k)i=a(t.definition.concat([new R({definition:[new N({terminalType:t.separator})].concat(t.definition)})]));else if(t instanceof R)i=a(t.definition.concat([new R({definition:t.definition})]));else if(t instanceof I)return t.definition.forEach(e=>{0!==e.definition.length&&(i=a(e.definition))}),i;else if(t instanceof N)s.push(t.terminalType);else throw Error("non exhaustive match");n++}return i.push({partialPath:s,suffixDef:e.slice(n)}),i}function e3(e){if(e instanceof S||"Option"===e)return n.OPTION;if(e instanceof R||"Repetition"===e)return n.REPETITION;if(e instanceof L||"RepetitionMandatory"===e)return n.REPETITION_MANDATORY;if(e instanceof O||"RepetitionMandatoryWithSeparator"===e)return n.REPETITION_MANDATORY_WITH_SEPARATOR;if(e instanceof k||"RepetitionWithSeparator"===e)return n.REPETITION_WITH_SEPARATOR;else if(e instanceof I||"Alternation"===e)return n.ALTERNATION;else throw Error("non exhaustive match")}function e5(e,t,s,i){let n=e.length,a=e.every(e=>e.every(e=>1===e.length));if(t)return function(t){let i=t.map(e=>e.GATE);for(let t=0;t<n;t++){let n=e[t],a=n.length,r=i[t];if(void 0===r||!1!==r.call(this))e:for(let e=0;e<a;e++){let i=n[e],a=i.length;for(let e=0;e<a;e++)if(!1===s(this.LA_FAST(e+1),i[e]))continue e;return t}}};if(!a||i)return function(){for(let t=0;t<n;t++){let i=e[t],n=i.length;e:for(let e=0;e<n;e++){let n=i[e],a=n.length;for(let e=0;e<a;e++)if(!1===s(this.LA_FAST(e+1),n[e]))continue e;return t}}};{let t=e.map(e=>e.flat()).reduce((e,t,s)=>(t.forEach(t=>{t.tokenTypeIdx in e||(e[t.tokenTypeIdx]=s),t.categoryMatches.forEach(t=>{Object.hasOwn(e,t)||(e[t]=s)})}),e),{});return function(){return t[this.LA_FAST(1).tokenTypeIdx]}}}function e4(e,t,s){let i=e.every(e=>1===e.length),n=e.length;if(!i||s)return function(){e:for(let s=0;s<n;s++){let i=e[s],n=i.length;for(let e=0;e<n;e++)if(!1===t(this.LA_FAST(e+1),i[e]))continue e;return!0}return!1};{let t=e.flat();if(1===t.length&&0===t[0].categoryMatches.length){let e=t[0].tokenTypeIdx;return function(){return this.LA_FAST(1).tokenTypeIdx===e}}{let e=t.reduce((e,t,s)=>(e[t.tokenTypeIdx]=!0,t.categoryMatches.forEach(t=>{e[t]=!0}),e),[]);return function(){return!0===e[this.LA_FAST(1).tokenTypeIdx]}}}}!function(e){e[e.OPTION=0]="OPTION",e[e.REPETITION=1]="REPETITION",e[e.REPETITION_MANDATORY=2]="REPETITION_MANDATORY",e[e.REPETITION_MANDATORY_WITH_SEPARATOR=3]="REPETITION_MANDATORY_WITH_SEPARATOR",e[e.REPETITION_WITH_SEPARATOR=4]="REPETITION_WITH_SEPARATOR",e[e.ALTERNATION=5]="ALTERNATION"}(n||(n={}));class e8 extends x{constructor(e,t,s){super(),this.topProd=e,this.targetOccurrence=t,this.targetProdType=s}startWalking(){return this.walk(this.topProd),this.restDef}checkIsTarget(e,t,s,i){return e.idx===this.targetOccurrence&&this.targetProdType===t&&(this.restDef=s.concat(i),!0)}walkOption(e,t,s){this.checkIsTarget(e,n.OPTION,t,s)||super.walkOption(e,t,s)}walkAtLeastOne(e,t,s){this.checkIsTarget(e,n.REPETITION_MANDATORY,t,s)||super.walkOption(e,t,s)}walkAtLeastOneSep(e,t,s){this.checkIsTarget(e,n.REPETITION_MANDATORY_WITH_SEPARATOR,t,s)||super.walkOption(e,t,s)}walkMany(e,t,s){this.checkIsTarget(e,n.REPETITION,t,s)||super.walkOption(e,t,s)}walkManySep(e,t,s){this.checkIsTarget(e,n.REPETITION_WITH_SEPARATOR,t,s)||super.walkOption(e,t,s)}}class e9 extends C{constructor(e,t,s){super(),this.targetOccurrence=e,this.targetProdType=t,this.targetRef=s,this.result=[]}checkIsTarget(e,t){e.idx===this.targetOccurrence&&this.targetProdType===t&&(void 0===this.targetRef||e===this.targetRef)&&(this.result=e.definition)}visitOption(e){this.checkIsTarget(e,n.OPTION)}visitRepetition(e){this.checkIsTarget(e,n.REPETITION)}visitRepetitionMandatory(e){this.checkIsTarget(e,n.REPETITION_MANDATORY)}visitRepetitionMandatoryWithSeparator(e){this.checkIsTarget(e,n.REPETITION_MANDATORY_WITH_SEPARATOR)}visitRepetitionWithSeparator(e){this.checkIsTarget(e,n.REPETITION_WITH_SEPARATOR)}visitAlternation(e){this.checkIsTarget(e,n.ALTERNATION)}}function e7(e){let t=Array(e);for(let s=0;s<e;s++)t[s]=[];return t}function te(e){let t=[""];for(let s=0;s<e.length;s++){let i=e[s],n=[];for(let e=0;e<t.length;e++){let s=t[e];n.push(s+"_"+i.tokenTypeIdx);for(let e=0;e<i.categoryMatches.length;e++){let t="_"+i.categoryMatches[e];n.push(s+t)}}t=n}return t}function tt(e,t){let s=e.map(e=>e6([e],1)),i=e7(s.length),n=s.map(e=>{let t={};return e.forEach(e=>{te(e.partialPath).forEach(e=>{t[e]=!0})}),t}),a=s;for(let e=1;e<=t;e++){let s=a;a=e7(s.length);for(let r=0;r<s.length;r++){let o=s[r];for(let s=0;s<o.length;s++){let l=o[s].partialPath,c=o[s].suffixDef,h=te(l);if(function(e,t,s){for(let i=0;i<e.length;i++){if(i===s)continue;let n=e[i];for(let e=0;e<t.length;e++)if(!0===n[t[e]])return!1}return!0}(n,h,r)||0===c.length||l.length===t){let e=i[r];if(!1===tn(e,l)){e.push(l);for(let e=0;e<h.length;e++){let t=h[e];n[r][t]=!0}}}else{let t=e6(c,e+1,l);a[r]=a[r].concat(t),t.forEach(e=>{te(e.partialPath).forEach(e=>{n[r][e]=!0})})}}}}return i}function ts(e,t,s,i){let a=new e9(e,n.ALTERNATION,i);return t.accept(a),tt(a.result,s)}function ti(e,t,s,i){let n=new e9(e,s);t.accept(n);let a=n.result,r=new e8(t,e,s).startWalking();return tt([new A({definition:a}),new A({definition:r})],i)}function tn(e,t){t:for(let s=0;s<e.length;s++){let i=e[s];if(i.length===t.length){for(let e=0;e<i.length;e++){let s=t[e],n=i[e];if(!1==(s===n||void 0!==n.categoryMatchesMap[s.tokenTypeIdx]))continue t}return!0}}return!1}function ta(e){return e.every(e=>e.every(e=>e.every(e=>0===e.categoryMatches.length)))}function tr(e){return`${v(e)}_#_${e.idx}_#_${to(e)}`}function to(e){return e instanceof N?e.terminalType.name:e instanceof g?e.nonTerminalName:""}class tl extends C{constructor(){super(...arguments),this.allProductions=[]}visitNonTerminal(e){this.allProductions.push(e)}visitOption(e){this.allProductions.push(e)}visitRepetitionWithSeparator(e){this.allProductions.push(e)}visitRepetitionMandatory(e){this.allProductions.push(e)}visitRepetitionMandatoryWithSeparator(e){this.allProductions.push(e)}visitRepetition(e){this.allProductions.push(e)}visitAlternation(e){this.allProductions.push(e)}visitTerminal(e){this.allProductions.push(e)}}class tc extends C{constructor(){super(...arguments),this.alternations=[]}visitAlternation(e){this.alternations.push(e)}}class th extends C{constructor(){super(...arguments),this.allProductions=[]}visitRepetitionWithSeparator(e){this.allProductions.push(e)}visitRepetitionMandatory(e){this.allProductions.push(e)}visitRepetitionMandatoryWithSeparator(e){this.allProductions.push(e)}visitRepetition(e){this.allProductions.push(e)}}let td="MismatchedTokenException",tu="NoViableAltException",tp="EarlyExitException",tf="NotAllInputParsedException",tm=[td,tu,tp,tf];function tE(e){return tm.includes(e.name)}Object.freeze(tm);class tT extends Error{constructor(e,t){super(e),this.token=t,this.resyncedTokens=[],Object.setPrototypeOf(this,new.target.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor)}}class tg extends tT{constructor(e,t,s){super(e,t),this.previousToken=s,this.name=td}}class ty extends tT{constructor(e,t,s){super(e,t),this.previousToken=s,this.name=tu}}class tA extends tT{constructor(e,t){super(e,t),this.name=tf}}class tS extends tT{constructor(e,t,s){super(e,t),this.previousToken=s,this.name=tp}}let tL={},tO="InRuleRecoveryException";class tR extends Error{constructor(e){super(e),this.name=tO}}class tk{initRecoverable(e){this.firstAfterRepMap=[],this.resyncFollows={},this.recoveryEnabled=Object.hasOwn(e,"recoveryEnabled")?e.recoveryEnabled:tJ.recoveryEnabled,this.recoveryEnabled&&(this.attemptInRepetitionRecovery=tI)}getTokenToInsert(e){let t=eV(e,"",-1,-1,-1,-1,-1,-1);return t.isInsertedInRecovery=!0,t}canTokenTypeBeInsertedInRecovery(e){return!0}canTokenTypeBeDeletedInRecovery(e){return!0}tryInRepetitionRecovery(e,t,s,i){let n=this.findReSyncTokenType(),a=this.exportLexerState(),r=[],o=!1,l=this.LA_FAST(1),c=this.LA_FAST(1),h=()=>{let e=this.LA(0),t=new tg(this.errorMessageProvider.buildMismatchTokenMessage({expected:i,actual:l,previous:e,ruleName:this.getCurrRuleFullName()}),l,this.LA(0));t.resyncedTokens=r.slice(0,-1),this.SAVE_ERROR(t)};for(;!o;)if(this.tokenMatcher(c,i))return void h();else if(s.call(this)){h(),e.apply(this,t);return}else this.tokenMatcher(c,n)?o=!0:(c=this.SKIP_TOKEN(),this.addToResyncTokens(c,r));this.importLexerState(a)}shouldInRepetitionRecoveryBeTried(e,t,s){return!(!1===s||this.tokenMatcher(this.LA_FAST(1),e)||this.isBackTracking()||this.canPerformInRuleRecovery(e,this.getFollowsForInRuleRecovery(e,t)))}getNextPossibleTokenTypes(e){let t=e.ruleStack[0];return new eJ(this.getGAstProductions()[t],e).startWalking()}getFollowsForInRuleRecovery(e,t){let s=this.getCurrentGrammarPath(e,t);return this.getNextPossibleTokenTypes(s)}tryInRuleRecovery(e,t){if(this.canRecoverWithSingleTokenInsertion(e,t))return this.getTokenToInsert(e);if(this.canRecoverWithSingleTokenDeletion(e)){let e=this.SKIP_TOKEN();return this.consumeToken(),e}throw new tR("sad sad panda")}canPerformInRuleRecovery(e,t){return this.canRecoverWithSingleTokenInsertion(e,t)||this.canRecoverWithSingleTokenDeletion(e)}canRecoverWithSingleTokenInsertion(e,t){if(!this.canTokenTypeBeInsertedInRecovery(e)||0===t.length)return!1;let s=this.LA_FAST(1);return void 0!==t.find(e=>this.tokenMatcher(s,e))}canRecoverWithSingleTokenDeletion(e){return!!this.canTokenTypeBeDeletedInRecovery(e)&&this.tokenMatcher(this.LA(2),e)}isInCurrentRuleReSyncSet(e){let t=this.getCurrFollowKey();return this.getFollowSetFromFollowKey(t).includes(e)}findReSyncTokenType(){let e=this.flattenFollowSet(),t=this.LA_FAST(1),s=2;for(;;){let i=e.find(e=>eO(t,e));if(void 0!==i)return i;t=this.LA(s),s++}}getCurrFollowKey(){if(0===this.RULE_STACK_IDX)return tL;let e=this.currRuleShortName,t=this.getLastExplicitRuleOccurrenceIndex(),s=this.getPreviousExplicitRuleShortName();return{ruleName:this.shortRuleNameToFullName(e),idxInCallingRule:t,inRule:this.shortRuleNameToFullName(s)}}buildFullFollowKeyStack(){let e=this.RULE_STACK,t=this.RULE_OCCURRENCE_STACK,s=this.RULE_STACK_IDX+1,i=Array(s);for(let n=0;n<s;n++)0===n?i[n]=tL:i[n]={ruleName:this.shortRuleNameToFullName(e[n]),idxInCallingRule:t[n],inRule:this.shortRuleNameToFullName(e[n-1])};return i}flattenFollowSet(){return this.buildFullFollowKeyStack().map(e=>this.getFollowSetFromFollowKey(e)).flat()}getFollowSetFromFollowKey(e){if(e===tL)return[eW];let t=e.ruleName+e.idxInCallingRule+w+e.inRule;return this.resyncFollows[t]}addToResyncTokens(e,t){return this.tokenMatcher(e,eW)||t.push(e),t}reSyncTo(e){let t=[],s=this.LA_FAST(1);for(;!1===this.tokenMatcher(s,e);)s=this.SKIP_TOKEN(),this.addToResyncTokens(s,t);return t.slice(0,-1)}attemptInRepetitionRecovery(e,t,s,i,n,a,r){}getCurrentGrammarPath(e,t){let s=this.getHumanReadableRuleStack();return{ruleStack:s,occurrenceStack:this.RULE_OCCURRENCE_STACK.slice(0,this.RULE_OCCURRENCE_STACK_IDX+1),lastTok:e,lastTokOccurrence:t}}getHumanReadableRuleStack(){let e=this.RULE_STACK_IDX+1,t=Array(e);for(let s=0;s<e;s++)t[s]=this.shortRuleNameToFullName(this.RULE_STACK[s]);return t}}function tI(e,t,s,i,n,a,r){var o,l,c;let h=i|n,d=null!=(o=(l=this.firstAfterRepMap)[c=this.currRuleShortName])?o:l[c]=[],u=d[h];if(void 0===u){let e=this.getCurrRuleFullName();u=new a(this.getGAstProductions()[e],n).startWalking(),d[h]=u}let p=u.token,f=u.occurrence,m=u.isEndOfRule;0===this.RULE_STACK_IDX&&m&&void 0===p&&(p=eW,f=1),void 0!==p&&void 0!==f&&this.shouldInRepetitionRecoveryBeTried(p,f,r)&&this.tryInRepetitionRecovery(e,t,s,p)}class tN{constructor(e){var t;this.maxLookahead=null!=(t=null==e?void 0:e.maxLookahead)?t:tJ.maxLookahead}validate(e){let t=this.validateNoLeftRecursion(e.rules);if(0===t.length){let s=this.validateEmptyOrAlternatives(e.rules);return[...t,...s,...this.validateAmbiguousAlternationAlternatives(e.rules,this.maxLookahead),...this.validateSomeNonEmptyLookaheadPath(e.rules,this.maxLookahead)]}return t}validateNoLeftRecursion(e){return e.flatMap(e=>(function e(t,s,i,n=[]){let a=[],o=function e(t){let s=[];if(0===t.length)return s;let i=t[0];if(i instanceof g)s.push(i.referencedRule);else if(i instanceof A||i instanceof S||i instanceof L||i instanceof O||i instanceof k||i instanceof R)s=s.concat(e(i.definition));else if(i instanceof I)s=i.definition.map(t=>e(t.definition)).flat();else if(i instanceof N);else throw Error("non exhaustive match");let n=_(i),a=t.length>1;if(!n||!a)return s;{let i=t.slice(1);return s.concat(e(i))}}(s.definition);if(0===o.length)return[];{let s=t.name;o.includes(t)&&a.push({message:i.buildLeftRecursionError({topLevelRule:t,leftRecursionPath:n}),type:r.LEFT_RECURSION,ruleName:s});let l=n.concat([t]),c=o.filter(e=>!l.includes(e)).flatMap(s=>{let a=[...n];return a.push(s),e(t,s,i,a)});return a.concat(c)}})(e,e,eY))}validateEmptyOrAlternatives(e){return e.flatMap(e=>(function(e,t){let s=new tc;return e.accept(s),s.alternations.flatMap(s=>s.definition.slice(0,-1).flatMap((i,n)=>0===function(e,t,s,i){let n="EXIT_NONE_TERMINAL",a=[n],r="EXIT_ALTERNATIVE",o=!1,l=t.length,c=l-1-1,h=[],d=[];for(d.push({idx:-1,def:e,ruleStack:[],occurrenceStack:[]});0!==d.length;){let e=d.pop();if(e===r){o&&d.at(-1).idx<=c&&d.pop();continue}let i=e.def,u=e.idx,p=e.ruleStack,f=e.occurrenceStack;if(0===i.length)continue;let m=i[0];if(m===n){let e={idx:u,def:i.slice(1),ruleStack:p.slice(0,-1),occurrenceStack:f.slice(0,-1)};d.push(e)}else if(m instanceof N)if(u<l-1){let e=u+1;if(s(t[e],m.terminalType)){let t={idx:e,def:i.slice(1),ruleStack:p,occurrenceStack:f};d.push(t)}}else if(u===l-1)h.push({nextTokenType:m.terminalType,nextTokenOccurrence:m.idx,ruleStack:p,occurrenceStack:f}),o=!0;else throw Error("non exhaustive match");else if(m instanceof g){let e=[...p];e.push(m.nonTerminalName);let t=[...f];t.push(m.idx);let s={idx:u,def:m.definition.concat(a,i.slice(1)),ruleStack:e,occurrenceStack:t};d.push(s)}else if(m instanceof S){let e={idx:u,def:i.slice(1),ruleStack:p,occurrenceStack:f};d.push(e),d.push(r);let t={idx:u,def:m.definition.concat(i.slice(1)),ruleStack:p,occurrenceStack:f};d.push(t)}else if(m instanceof L){let e=new R({definition:m.definition,idx:m.idx}),t={idx:u,def:m.definition.concat([e],i.slice(1)),ruleStack:p,occurrenceStack:f};d.push(t)}else if(m instanceof O){let e=new R({definition:[new N({terminalType:m.separator})].concat(m.definition),idx:m.idx}),t={idx:u,def:m.definition.concat([e],i.slice(1)),ruleStack:p,occurrenceStack:f};d.push(t)}else if(m instanceof k){let e={idx:u,def:i.slice(1),ruleStack:p,occurrenceStack:f};d.push(e),d.push(r);let t=new R({definition:[new N({terminalType:m.separator})].concat(m.definition),idx:m.idx}),s={idx:u,def:m.definition.concat([t],i.slice(1)),ruleStack:p,occurrenceStack:f};d.push(s)}else if(m instanceof R){let e={idx:u,def:i.slice(1),ruleStack:p,occurrenceStack:f};d.push(e),d.push(r);let t=new R({definition:m.definition,idx:m.idx}),s={idx:u,def:m.definition.concat([t],i.slice(1)),ruleStack:p,occurrenceStack:f};d.push(s)}else if(m instanceof I)for(let e=m.definition.length-1;e>=0;e--){let t={idx:u,def:m.definition[e].definition.concat(i.slice(1)),ruleStack:p,occurrenceStack:f};d.push(t),d.push(r)}else if(m instanceof A)d.push({idx:u,def:m.definition.concat(i.slice(1)),ruleStack:p,occurrenceStack:f});else if(m instanceof y)d.push(function(e,t,s,i){let n=[...s];n.push(e.name);let a=[...i];return a.push(1),{idx:t,def:e.definition,ruleStack:n,occurrenceStack:a}}(m,u,p,f));else throw Error("non exhaustive match")}return h}([i],[],eO,0).length?[{message:t.buildEmptyAlternationError({topLevelRule:e,alternation:s,emptyChoiceIdx:n}),type:r.NONE_LAST_EMPTY_ALT,ruleName:e.name,occurrence:s.idx,alternative:n+1}]:[]))})(e,eY))}validateAmbiguousAlternationAlternatives(e,t){return e.flatMap(e=>(function(e,t,s){let i=new tc;e.accept(i);let n=i.alternations;return(n=n.filter(e=>!0!==e.ignoreAmbiguities)).flatMap(i=>{let n=ts(i.idx,e,i.maxLookahead||t,i),a=function(e,t,s,i){let n=[];return e.reduce((s,i,a)=>(!0===t.definition[a].ignoreAmbiguities||i.forEach(i=>{let r=[a];e.forEach((e,s)=>{a!==s&&tn(e,i)&&!0!==t.definition[s].ignoreAmbiguities&&r.push(s)}),r.length>1&&!tn(n,i)&&(n.push(i),s.push({alts:r,path:i}))}),s),[]).map(e=>{let n=e.alts.map(e=>e+1);return{message:i.buildAlternationAmbiguityError({topLevelRule:s,alternation:t,ambiguityIndices:n,prefixPath:e.path}),type:r.AMBIGUOUS_ALTS,ruleName:s.name,occurrence:t.idx,alternatives:e.alts}})}(n,i,e,s),o=function(e,t,s,i){let n=e.reduce((e,t,s)=>{let i=t.map(e=>({idx:s,path:e}));return e.concat(i)},[]);return n.flatMap(e=>{if(!0===t.definition[e.idx].ignoreAmbiguities)return[];let a=e.idx,o=e.path;return n.filter(e=>{var s;return!0!==t.definition[e.idx].ignoreAmbiguities&&e.idx<a&&(s=e.path,s.length<o.length&&s.every((e,t)=>{let s=o[t];return e===s||s.categoryMatchesMap[e.tokenTypeIdx]}))}).map(e=>{let n=[e.idx+1,a+1],o=0===t.idx?"":t.idx;return{message:i.buildAlternationPrefixAmbiguityError({topLevelRule:s,alternation:t,ambiguityIndices:n,prefixPath:e.path}),type:r.AMBIGUOUS_PREFIX_ALTS,ruleName:s.name,occurrence:o,alternatives:n}})})}(n,i,e,s);return a.concat(o)})})(e,t,eY))}validateSomeNonEmptyLookaheadPath(e,t){let s=[];return e.forEach(e=>{let i=new th;e.accept(i),i.allProductions.forEach(i=>{let n=e3(i),a=i.maxLookahead||t;if(0===ti(i.idx,e,n,a)[0].flat().length){let t=eY.buildEmptyRepetitionError({topLevelRule:e,repetition:i});s.push({message:t,type:r.NO_NON_EMPTY_LOOKAHEAD,ruleName:e.name})}})}),s}buildLookaheadForAlternation(e){return function(e,t,s,i,n,a){let r=ts(e,t,s),o=ta(r)?eR:eO;return a(r,i,o,n)}(e.prodOccurrence,e.rule,e.maxLookahead,e.hasPredicates,e.dynamicTokensEnabled,e5)}buildLookaheadForOptional(e){return function(e,t,s,i,n,a){let r=ti(e,t,n,s),o=ta(r)?eR:eO;return a(r[0],o,i)}(e.prodOccurrence,e.rule,e.maxLookahead,e.dynamicTokensEnabled,e3(e.prodType),e4)}}class tb{initLooksAhead(e){this.dynamicTokensEnabled=Object.hasOwn(e,"dynamicTokensEnabled")?e.dynamicTokensEnabled:tJ.dynamicTokensEnabled,this.maxLookahead=Object.hasOwn(e,"maxLookahead")?e.maxLookahead:tJ.maxLookahead,this.lookaheadStrategy=Object.hasOwn(e,"lookaheadStrategy")?e.lookaheadStrategy:new tN({maxLookahead:this.maxLookahead}),this.lookAheadFuncsCache=[],this.currRuleLookaheadFuncs=[]}preComputeLookaheadFunctions(e){e.forEach(e=>{this.TRACE_INIT(`${e.name} Rule Lookahead`,()=>{let{alternation:t,repetition:s,option:i,repetitionMandatory:n,repetitionMandatoryWithSeparator:a,repetitionWithSeparator:r}=function(e){t_.reset(),e.accept(t_);let t=t_.dslMethods;return t_.reset(),t}(e);t.forEach(t=>{let s=0===t.idx?"":t.idx;this.TRACE_INIT(`${v(t)}${s}`,()=>{let s=this.lookaheadStrategy.buildLookaheadForAlternation({prodOccurrence:t.idx,rule:e,maxLookahead:t.maxLookahead||this.maxLookahead,hasPredicates:t.hasPredicates,dynamicTokensEnabled:this.dynamicTokensEnabled});this.setLaFuncCache(this.fullRuleNameToShort[e.name],256|t.idx,s)})}),s.forEach(t=>{this.computeLookaheadFunc(e,t.idx,768,"Repetition",t.maxLookahead,v(t))}),i.forEach(t=>{this.computeLookaheadFunc(e,t.idx,512,"Option",t.maxLookahead,v(t))}),n.forEach(t=>{this.computeLookaheadFunc(e,t.idx,1024,"RepetitionMandatory",t.maxLookahead,v(t))}),a.forEach(t=>{this.computeLookaheadFunc(e,t.idx,1536,"RepetitionMandatoryWithSeparator",t.maxLookahead,v(t))}),r.forEach(t=>{this.computeLookaheadFunc(e,t.idx,1280,"RepetitionWithSeparator",t.maxLookahead,v(t))})})})}computeLookaheadFunc(e,t,s,i,n,a){this.TRACE_INIT(`${a}${0===t?"":t}`,()=>{let a=this.lookaheadStrategy.buildLookaheadForOptional({prodOccurrence:t,rule:e,maxLookahead:n||this.maxLookahead,dynamicTokensEnabled:this.dynamicTokensEnabled,prodType:i});this.setLaFuncCache(this.fullRuleNameToShort[e.name],s|t,a)})}setLaFuncCache(e,t,s){let i=this.lookAheadFuncsCache[e];void 0===i&&(i=[],this.lookAheadFuncsCache[e]=i),i[t]=s}}class tC extends C{constructor(){super(...arguments),this.dslMethods={option:[],alternation:[],repetition:[],repetitionWithSeparator:[],repetitionMandatory:[],repetitionMandatoryWithSeparator:[]}}reset(){this.dslMethods={option:[],alternation:[],repetition:[],repetitionWithSeparator:[],repetitionMandatory:[],repetitionMandatoryWithSeparator:[]}}visitOption(e){this.dslMethods.option.push(e)}visitRepetitionWithSeparator(e){this.dslMethods.repetitionWithSeparator.push(e)}visitRepetitionMandatory(e){this.dslMethods.repetitionMandatory.push(e)}visitRepetitionMandatoryWithSeparator(e){this.dslMethods.repetitionMandatoryWithSeparator.push(e)}visitRepetition(e){this.dslMethods.repetition.push(e)}visitAlternation(e){this.dslMethods.alternation.push(e)}}let t_=new tC;function tv(e,t){-1===e.startOffset?(e.startOffset=t.startOffset,e.endOffset=t.endOffset):e.endOffset<t.endOffset==!0&&(e.endOffset=t.endOffset)}function tx(e,t){-1===e.startOffset?(e.startOffset=t.startOffset,e.startColumn=t.startColumn,e.startLine=t.startLine,e.endOffset=t.endOffset,e.endColumn=t.endColumn,e.endLine=t.endLine):e.endOffset<t.endOffset==!0&&(e.endOffset=t.endOffset,e.endColumn=t.endColumn,e.endLine=t.endLine)}function tU(e,t){Object.defineProperty(e,"name",{enumerable:!1,configurable:!0,writable:!1,value:t})}function tM(e,t){let s=Object.keys(e),i=s.length;for(let n=0;n<i;n++){let i=e[s[n]],a=i.length;for(let e=0;e<a;e++){let s=i[e];void 0===s.tokenTypeIdx&&this[s.name](s.children,t)}}}!function(e){e[e.REDUNDANT_METHOD=0]="REDUNDANT_METHOD",e[e.MISSING_METHOD=1]="MISSING_METHOD"}(a||(a={}));class tw{initTreeBuilder(e){if(this.CST_STACK=[],this.outputCst=e.outputCst,this.nodeLocationTracking=Object.hasOwn(e,"nodeLocationTracking")?e.nodeLocationTracking:tJ.nodeLocationTracking,this.outputCst)if(/full/i.test(this.nodeLocationTracking))this.recoveryEnabled?(this.setNodeLocationFromToken=tx,this.setNodeLocationFromNode=tx,this.cstPostRule=()=>{},this.setInitialNodeLocation=this.setInitialNodeLocationFullRecovery):(this.setNodeLocationFromToken=()=>{},this.setNodeLocationFromNode=()=>{},this.cstPostRule=this.cstPostRuleFull,this.setInitialNodeLocation=this.setInitialNodeLocationFullRegular);else if(/onlyOffset/i.test(this.nodeLocationTracking))this.recoveryEnabled?(this.setNodeLocationFromToken=tv,this.setNodeLocationFromNode=tv,this.cstPostRule=()=>{},this.setInitialNodeLocation=this.setInitialNodeLocationOnlyOffsetRecovery):(this.setNodeLocationFromToken=()=>{},this.setNodeLocationFromNode=()=>{},this.cstPostRule=this.cstPostRuleOnlyOffset,this.setInitialNodeLocation=this.setInitialNodeLocationOnlyOffsetRegular);else if(/none/i.test(this.nodeLocationTracking))this.setNodeLocationFromToken=()=>{},this.setNodeLocationFromNode=()=>{},this.cstPostRule=()=>{},this.setInitialNodeLocation=()=>{};else throw Error(`Invalid <nodeLocationTracking> config option: "${e.nodeLocationTracking}"`);else this.cstInvocationStateUpdate=()=>{},this.cstFinallyStateUpdate=()=>{},this.cstPostTerminal=()=>{},this.cstPostNonTerminal=()=>{},this.cstPostRule=()=>{}}setInitialNodeLocationOnlyOffsetRecovery(e){e.location={startOffset:-1,endOffset:-1}}setInitialNodeLocationOnlyOffsetRegular(e){e.location={startOffset:this.LA_FAST(1).startOffset,endOffset:-1}}setInitialNodeLocationFullRecovery(e){e.location={startOffset:-1,startLine:-1,startColumn:-1,endOffset:-1,endLine:-1,endColumn:-1}}setInitialNodeLocationFullRegular(e){let t=this.LA_FAST(1);e.location={startOffset:t.startOffset,startLine:t.startLine,startColumn:t.startColumn,endOffset:-1,endLine:-1,endColumn:-1}}cstInvocationStateUpdate(e){let t={name:e,children:Object.create(null)};this.setInitialNodeLocation(t),this.CST_STACK.push(t)}cstFinallyStateUpdate(){this.CST_STACK.pop()}cstPostRuleFull(e){let t=this.LA(0),s=e.location;-1!==s.startOffset&&s.startOffset<=t.startOffset==!0?(s.endOffset=t.endOffset,s.endLine=t.endLine,s.endColumn=t.endColumn):(s.startOffset=-1,s.startLine=-1,s.startColumn=-1)}cstPostRuleOnlyOffset(e){let t=this.LA(0),s=e.location;-1!==s.startOffset&&s.startOffset<=t.startOffset==!0?s.endOffset=t.endOffset:s.startOffset=-1}cstPostTerminal(e,t){let s=this.CST_STACK[this.CST_STACK.length-1];void 0===s.children[e]?s.children[e]=[t]:s.children[e].push(t),this.setNodeLocationFromToken(s.location,t)}cstPostNonTerminal(e,t){let s=this.CST_STACK[this.CST_STACK.length-1];void 0===s.children[t]?s.children[t]=[e]:s.children[t].push(e),this.setNodeLocationFromNode(s.location,e.location)}get currCSTNode(){return this.CST_STACK[this.CST_STACK.length-1]}getBaseCstVisitorConstructor(){if(void 0===this.baseCstVisitorConstructor){let e=function(e,t){let s=function(){};return tU(s,e+"BaseSemantics"),s.prototype={visit:function(e,t){if(Array.isArray(e)&&(e=e[0]),void 0!==e)return this[e.name](e.children,t)},validateVisitor:function(){var e,s,i;let n=(e=this,s=t,i=e,s.filter(e=>"function"==typeof i[e]==!1).map(e=>({msg:`Missing visitor method: <${e}> on ${i.constructor.name} CST Visitor.`,type:a.MISSING_METHOD,methodName:e})).filter(Boolean));if(0!==n.length){let e=n.map(e=>e.msg);throw Error(`Errors Detected in CST Visitor <${this.constructor.name}>:
|
|
52
52
|
${e.join("\n\n").replace(/\n/g,"\n ")}`)}}},s.prototype.constructor=s,s._RULE_NAMES=t,s}(this.className,Object.keys(this.gastProductionsCache));return this.baseCstVisitorConstructor=e,e}return this.baseCstVisitorConstructor}getBaseCstVisitorConstructorWithDefaults(){if(void 0===this.baseCstVisitorWithDefaultsConstructor){let e=function(e,t,s){let i=function(){};tU(i,e+"BaseSemanticsWithDefaults");let n=Object.create(s.prototype);return t.forEach(e=>{n[e]=tM}),i.prototype=n,i.prototype.constructor=i,i}(this.className,Object.keys(this.gastProductionsCache),this.getBaseCstVisitorConstructor());return this.baseCstVisitorWithDefaultsConstructor=e,e}return this.baseCstVisitorWithDefaultsConstructor}getPreviousExplicitRuleShortName(){return this.RULE_STACK[this.RULE_STACK_IDX-1]}getLastExplicitRuleOccurrenceIndex(){return this.RULE_OCCURRENCE_STACK[this.RULE_OCCURRENCE_STACK_IDX]}}class tP{initLexerAdapter(){this.tokVector=[],this.tokVectorLength=0,this.currIdx=-1}set input(e){if(!0!==this.selfAnalysisDone)throw Error("Missing <performSelfAnalysis> invocation at the end of the Parser's constructor.");this.reset(),this.tokVector=e,this.tokVectorLength=e.length}get input(){return this.tokVector}SKIP_TOKEN(){return this.currIdx<=this.tokVectorLength-2?(this.consumeToken(),this.LA_FAST(1)):tq}LA_FAST(e){let t=this.currIdx+e;return this.tokVector[t]}LA(e){let t=this.currIdx+e;return t<0||this.tokVectorLength<=t?tq:this.tokVector[t]}consumeToken(){this.currIdx++}exportLexerState(){return this.currIdx}importLexerState(e){this.currIdx=e}resetLexerState(){this.currIdx=-1}moveToTerminatedState(){this.currIdx=this.tokVectorLength-1}getLexerPosition(){return this.exportLexerState()}}class tD{ACTION(e){return e.call(this)}consume(e,t,s){return this.consumeInternal(t,e,s)}subrule(e,t,s){return this.subruleInternal(t,e,s)}option(e,t){return this.optionInternal(t,e)}or(e,t){return this.orInternal(t,e)}many(e,t){return this.manyInternal(e,t)}atLeastOne(e,t){return this.atLeastOneInternal(e,t)}CONSUME(e,t){return this.consumeInternal(e,0,t)}CONSUME1(e,t){return this.consumeInternal(e,1,t)}CONSUME2(e,t){return this.consumeInternal(e,2,t)}CONSUME3(e,t){return this.consumeInternal(e,3,t)}CONSUME4(e,t){return this.consumeInternal(e,4,t)}CONSUME5(e,t){return this.consumeInternal(e,5,t)}CONSUME6(e,t){return this.consumeInternal(e,6,t)}CONSUME7(e,t){return this.consumeInternal(e,7,t)}CONSUME8(e,t){return this.consumeInternal(e,8,t)}CONSUME9(e,t){return this.consumeInternal(e,9,t)}SUBRULE(e,t){return this.subruleInternal(e,0,t)}SUBRULE1(e,t){return this.subruleInternal(e,1,t)}SUBRULE2(e,t){return this.subruleInternal(e,2,t)}SUBRULE3(e,t){return this.subruleInternal(e,3,t)}SUBRULE4(e,t){return this.subruleInternal(e,4,t)}SUBRULE5(e,t){return this.subruleInternal(e,5,t)}SUBRULE6(e,t){return this.subruleInternal(e,6,t)}SUBRULE7(e,t){return this.subruleInternal(e,7,t)}SUBRULE8(e,t){return this.subruleInternal(e,8,t)}SUBRULE9(e,t){return this.subruleInternal(e,9,t)}OPTION(e){return this.optionInternal(e,0)}OPTION1(e){return this.optionInternal(e,1)}OPTION2(e){return this.optionInternal(e,2)}OPTION3(e){return this.optionInternal(e,3)}OPTION4(e){return this.optionInternal(e,4)}OPTION5(e){return this.optionInternal(e,5)}OPTION6(e){return this.optionInternal(e,6)}OPTION7(e){return this.optionInternal(e,7)}OPTION8(e){return this.optionInternal(e,8)}OPTION9(e){return this.optionInternal(e,9)}OR(e){return this.orInternal(e,0)}OR1(e){return this.orInternal(e,1)}OR2(e){return this.orInternal(e,2)}OR3(e){return this.orInternal(e,3)}OR4(e){return this.orInternal(e,4)}OR5(e){return this.orInternal(e,5)}OR6(e){return this.orInternal(e,6)}OR7(e){return this.orInternal(e,7)}OR8(e){return this.orInternal(e,8)}OR9(e){return this.orInternal(e,9)}MANY(e){this.manyInternal(0,e)}MANY1(e){this.manyInternal(1,e)}MANY2(e){this.manyInternal(2,e)}MANY3(e){this.manyInternal(3,e)}MANY4(e){this.manyInternal(4,e)}MANY5(e){this.manyInternal(5,e)}MANY6(e){this.manyInternal(6,e)}MANY7(e){this.manyInternal(7,e)}MANY8(e){this.manyInternal(8,e)}MANY9(e){this.manyInternal(9,e)}MANY_SEP(e){this.manySepFirstInternal(0,e)}MANY_SEP1(e){this.manySepFirstInternal(1,e)}MANY_SEP2(e){this.manySepFirstInternal(2,e)}MANY_SEP3(e){this.manySepFirstInternal(3,e)}MANY_SEP4(e){this.manySepFirstInternal(4,e)}MANY_SEP5(e){this.manySepFirstInternal(5,e)}MANY_SEP6(e){this.manySepFirstInternal(6,e)}MANY_SEP7(e){this.manySepFirstInternal(7,e)}MANY_SEP8(e){this.manySepFirstInternal(8,e)}MANY_SEP9(e){this.manySepFirstInternal(9,e)}AT_LEAST_ONE(e){this.atLeastOneInternal(0,e)}AT_LEAST_ONE1(e){return this.atLeastOneInternal(1,e)}AT_LEAST_ONE2(e){this.atLeastOneInternal(2,e)}AT_LEAST_ONE3(e){this.atLeastOneInternal(3,e)}AT_LEAST_ONE4(e){this.atLeastOneInternal(4,e)}AT_LEAST_ONE5(e){this.atLeastOneInternal(5,e)}AT_LEAST_ONE6(e){this.atLeastOneInternal(6,e)}AT_LEAST_ONE7(e){this.atLeastOneInternal(7,e)}AT_LEAST_ONE8(e){this.atLeastOneInternal(8,e)}AT_LEAST_ONE9(e){this.atLeastOneInternal(9,e)}AT_LEAST_ONE_SEP(e){this.atLeastOneSepFirstInternal(0,e)}AT_LEAST_ONE_SEP1(e){this.atLeastOneSepFirstInternal(1,e)}AT_LEAST_ONE_SEP2(e){this.atLeastOneSepFirstInternal(2,e)}AT_LEAST_ONE_SEP3(e){this.atLeastOneSepFirstInternal(3,e)}AT_LEAST_ONE_SEP4(e){this.atLeastOneSepFirstInternal(4,e)}AT_LEAST_ONE_SEP5(e){this.atLeastOneSepFirstInternal(5,e)}AT_LEAST_ONE_SEP6(e){this.atLeastOneSepFirstInternal(6,e)}AT_LEAST_ONE_SEP7(e){this.atLeastOneSepFirstInternal(7,e)}AT_LEAST_ONE_SEP8(e){this.atLeastOneSepFirstInternal(8,e)}AT_LEAST_ONE_SEP9(e){this.atLeastOneSepFirstInternal(9,e)}RULE(e,t,s=tZ){if(this.definedRulesNames.includes(e)){let t={message:eY.buildDuplicateRuleNameError({topLevelRule:e,grammarName:this.className}),type:r.DUPLICATE_RULE_NAME,ruleName:e};this.definitionErrors.push(t)}this.definedRulesNames.push(e);let i=this.defineRule(e,t,s);return this[e]=i,i}OVERRIDE_RULE(e,t,s=tZ){let i=function(e,t,s){let i=[];return t.includes(e)||i.push({message:`Invalid rule override, rule: ->${e}<- cannot be overridden in the grammar: ->${s}<-as it is not defined in any of the super grammars `,type:r.INVALID_RULE_OVERRIDE,ruleName:e}),i}(e,this.definedRulesNames,this.className);this.definitionErrors=this.definitionErrors.concat(i);let n=this.defineRule(e,t,s);return this[e]=n,n}BACKTRACK(e,t){var s;let i=null!=(s=e.coreRule)?s:e;return function(){this.isBackTrackingStack.push(1);let e=this.saveRecogState();try{return i.apply(this,t),!0}catch(e){if(tE(e))return!1;throw e}finally{this.reloadRecogState(e),this.isBackTrackingStack.pop()}}}getGAstProductions(){return this.gastProductionsCache}getSerializedGastProductions(){return Object.values(this.gastProductionsCache).map(function e(t){function s(t){return t.map(e)}if(t instanceof g){let e={type:"NonTerminal",name:t.nonTerminalName,idx:t.idx};return"string"==typeof t.label&&(e.label=t.label),e}if(t instanceof A)return{type:"Alternative",definition:s(t.definition)};if(t instanceof S)return{type:"Option",idx:t.idx,definition:s(t.definition)};if(t instanceof L)return{type:"RepetitionMandatory",idx:t.idx,definition:s(t.definition)};if(t instanceof O)return{type:"RepetitionMandatoryWithSeparator",idx:t.idx,separator:e(new N({terminalType:t.separator})),definition:s(t.definition)};else if(t instanceof k)return{type:"RepetitionWithSeparator",idx:t.idx,separator:e(new N({terminalType:t.separator})),definition:s(t.definition)};else if(t instanceof R)return{type:"Repetition",idx:t.idx,definition:s(t.definition)};else if(t instanceof I)return{type:"Alternation",idx:t.idx,definition:s(t.definition)};else if(t instanceof N){var i,n;let e={type:"Terminal",name:t.terminalType.name,label:"string"==typeof(n=i=t.terminalType).LABEL&&""!==n.LABEL?i.LABEL:i.name,idx:t.idx};"string"==typeof t.label&&(e.terminalLabel=t.label);let s=t.terminalType.PATTERN;return t.terminalType.PATTERN&&(e.pattern=s instanceof RegExp?s.source:s),e}else if(t instanceof y)return{type:"Rule",name:t.name,orgText:t.orgText,definition:s(t.definition)};else throw Error("non exhaustive match")})}}class t${initRecognizerEngine(e,t){if(this.className=this.constructor.name,this.shortRuleNameToFull=[],this.fullRuleNameToShort={},this.ruleShortNameIdx=0,this.tokenMatcher=eR,this.subruleIdx=0,this.currRuleShortName=-1,this.definedRulesNames=[],this.tokensMap={},this.isBackTrackingStack=[],this.RULE_STACK=[],this.RULE_STACK_IDX=-1,this.RULE_OCCURRENCE_STACK=[],this.RULE_OCCURRENCE_STACK_IDX=-1,this.gastProductionsCache={},Object.hasOwn(t,"serializedGrammar"))throw Error("The Parser's configuration can no longer contain a <serializedGrammar> property.\n See: https://chevrotain.io/docs/changes/BREAKING_CHANGES.html#_6-0-0\n For Further details.");if(Array.isArray(e)){if(0===e.length)throw Error("A Token Vocabulary cannot be empty.\n Note that the first argument for the parser constructor\n is no longer a Token vector (since v4.0).");if("number"==typeof e[0].startOffset)throw Error("The Parser constructor no longer accepts a token vector as the first argument.\n See: https://chevrotain.io/docs/changes/BREAKING_CHANGES.html#_4-0-0\n For Further details.")}if(Array.isArray(e))this.tokensMap=e.reduce((e,t)=>(e[t.name]=t,e),{});else if(Object.hasOwn(e,"modes")&&Object.values(e.modes).flat().every(e_)){let t=[...new Set(Object.values(e.modes).flat())];this.tokensMap=t.reduce((e,t)=>(e[t.name]=t,e),{})}else if("object"==typeof e&&null!==e)this.tokensMap=Object.assign({},e);else throw Error("<tokensDictionary> argument must be An Array of Token constructors, A dictionary of Token constructors or an IMultiModeLexerDefinition");this.tokensMap.EOF=eW;let s=(Object.hasOwn(e,"modes")?Object.values(e.modes).flat():Object.values(e)).every(e=>{var t;return(null==(t=e.categoryMatches)?void 0:t.length)==0});this.tokenMatcher=s?eR:eO,eN(Object.values(this.tokensMap))}defineRule(e,t,s){let i;if(this.selfAnalysisDone)throw Error(`Grammar rule <${e}> may not be defined after the 'performSelfAnalysis' method has been called'
|
|
53
53
|
Make sure that all grammar rule definitions are done before 'performSelfAnalysis' is called.`);let n=Object.hasOwn(s,"resyncEnabled")?s.resyncEnabled:tZ.resyncEnabled,a=Object.hasOwn(s,"recoveryValueFunc")?s.recoveryValueFunc:tZ.recoveryValueFunc,r=this.ruleShortNameIdx++;return this.shortRuleNameToFull[r]=e,this.fullRuleNameToShort[e]=r,i=!0===this.outputCst?function(...s){try{this.ruleInvocationStateUpdate(r,e,this.subruleIdx),t.apply(this,s);let i=this.CST_STACK[this.CST_STACK.length-1];return this.cstPostRule(i),i}catch(e){return this.invokeRuleCatch(e,n,a)}finally{this.ruleFinallyStateUpdate()}}:function(...s){try{return this.ruleInvocationStateUpdate(r,e,this.subruleIdx),t.apply(this,s)}catch(e){return this.invokeRuleCatch(e,n,a)}finally{this.ruleFinallyStateUpdate()}},Object.assign(function(...t){this.onBeforeParse(e);try{return i.apply(this,t)}finally{this.onAfterParse(e)}},{ruleName:e,originalGrammarAction:t,coreRule:i})}invokeRuleCatch(e,t,s){let i=0===this.RULE_STACK_IDX,n=t&&!this.isBackTracking()&&this.recoveryEnabled;if(tE(e)){if(n){let t=this.findReSyncTokenType();if(this.isInCurrentRuleReSyncSet(t)){if(e.resyncedTokens=this.reSyncTo(t),!this.outputCst)return s(e);{let e=this.CST_STACK[this.CST_STACK.length-1];return e.recoveredNode=!0,e}}if(this.outputCst){let t=this.CST_STACK[this.CST_STACK.length-1];t.recoveredNode=!0,e.partialCstResult=t}throw e}if(i)return this.moveToTerminatedState(),s(e)}throw e}optionInternal(e,t){return this.optionInternalLogic(e,t,512|t)}optionInternalLogic(e,t,s){let i,n=this.currRuleLookaheadFuncs[s];if("function"!=typeof e){i=e.DEF;let t=e.GATE;if(void 0!==t){let e=n;n=()=>t.call(this)&&e.call(this)}}else i=e;if(!0===n.call(this))return i.call(this)}atLeastOneInternal(e,t){return this.atLeastOneInternalLogic(e,t,1024|e)}atLeastOneInternalLogic(e,t,s){let i,a=this.currRuleLookaheadFuncs[s];if("function"!=typeof t){i=t.DEF;let e=t.GATE;if(void 0!==e){let t=a;a=()=>e.call(this)&&t.call(this)}}else i=t;if(!0===a.call(this)){let e=this.doSingleRepetition(i);for(;!0===a.call(this)&&!0===e;)e=this.doSingleRepetition(i)}else throw this.raiseEarlyExitException(e,n.REPETITION_MANDATORY,t.ERR_MSG);this.attemptInRepetitionRecovery(this.atLeastOneInternal,[e,t],a,1024,e,e1)}atLeastOneSepFirstInternal(e,t){this.atLeastOneSepFirstInternalLogic(e,t,1536|e)}atLeastOneSepFirstInternalLogic(e,t,s){let i=t.DEF,a=t.SEP;if(!0===this.currRuleLookaheadFuncs[s].call(this)){i.call(this);let t=()=>this.tokenMatcher(this.LA_FAST(1),a);for(;!0===this.tokenMatcher(this.LA_FAST(1),a);)this.CONSUME(a),i.call(this);this.attemptInRepetitionRecovery(this.repetitionSepSecondInternal,[e,a,t,i,e2],t,1536,e,e2)}else throw this.raiseEarlyExitException(e,n.REPETITION_MANDATORY_WITH_SEPARATOR,t.ERR_MSG)}manyInternal(e,t){return this.manyInternalLogic(e,t,768|e)}manyInternalLogic(e,t,s){let i,n=this.currRuleLookaheadFuncs[s];if("function"!=typeof t){i=t.DEF;let e=t.GATE;if(void 0!==e){let t=n;n=()=>e.call(this)&&t.call(this)}}else i=t;let a=!0;for(;!0===n.call(this)&&!0===a;)a=this.doSingleRepetition(i);this.attemptInRepetitionRecovery(this.manyInternal,[e,t],n,768,e,eQ,a)}manySepFirstInternal(e,t){this.manySepFirstInternalLogic(e,t,1280|e)}manySepFirstInternalLogic(e,t,s){let i=t.DEF,n=t.SEP;if(!0===this.currRuleLookaheadFuncs[s].call(this)){i.call(this);let t=()=>this.tokenMatcher(this.LA_FAST(1),n);for(;!0===this.tokenMatcher(this.LA_FAST(1),n);)this.CONSUME(n),i.call(this);this.attemptInRepetitionRecovery(this.repetitionSepSecondInternal,[e,n,t,i,e0],t,1280,e,e0)}}repetitionSepSecondInternal(e,t,s,i,n){for(;s();)this.CONSUME(t),i.call(this);this.attemptInRepetitionRecovery(this.repetitionSepSecondInternal,[e,t,s,i,n],s,1536,e,n)}doSingleRepetition(e){let t=this.getLexerPosition();return e.call(this),this.getLexerPosition()>t}orInternal(e,t){let s=256|t,i=Array.isArray(e)?e:e.DEF,n=this.currRuleLookaheadFuncs[s].call(this,i);if(void 0!==n)return i[n].ALT.call(this);this.raiseNoAltException(t,e.ERR_MSG)}ruleFinallyStateUpdate(){this.RULE_STACK_IDX--,this.RULE_OCCURRENCE_STACK_IDX--,this.RULE_STACK_IDX>=0&&(this.currRuleShortName=this.RULE_STACK[this.RULE_STACK_IDX],this.currRuleLookaheadFuncs=this.lookAheadFuncsCache[this.currRuleShortName]),this.cstFinallyStateUpdate()}subruleInternal(e,t,s){let i;try{let n=void 0!==s?s.ARGS:void 0;return this.subruleIdx=t,i=e.coreRule.apply(this,n),this.cstPostNonTerminal(i,void 0!==s&&void 0!==s.LABEL?s.LABEL:e.ruleName),i}catch(t){throw this.subruleInternalError(t,s,e.ruleName)}}subruleInternalError(e,t,s){throw tE(e)&&void 0!==e.partialCstResult&&(this.cstPostNonTerminal(e.partialCstResult,void 0!==t&&void 0!==t.LABEL?t.LABEL:s),delete e.partialCstResult),e}consumeInternal(e,t,s){let i;try{let t=this.LA_FAST(1);!0===this.tokenMatcher(t,e)?(this.consumeToken(),i=t):this.consumeInternalError(e,t,s)}catch(s){i=this.consumeInternalRecovery(e,t,s)}return this.cstPostTerminal(void 0!==s&&void 0!==s.LABEL?s.LABEL:e.name,i),i}consumeInternalError(e,t,s){let i,n=this.LA(0);throw i=void 0!==s&&s.ERR_MSG?s.ERR_MSG:this.errorMessageProvider.buildMismatchTokenMessage({expected:e,actual:t,previous:n,ruleName:this.getCurrRuleFullName()}),this.SAVE_ERROR(new tg(i,t,n))}consumeInternalRecovery(e,t,s){if(this.recoveryEnabled&&"MismatchedTokenException"===s.name&&!this.isBackTracking()){let i=this.getFollowsForInRuleRecovery(e,t);try{return this.tryInRuleRecovery(e,i)}catch(e){if(e.name===tO)throw s;throw e}}throw s}saveRecogState(){let e=this.errors,t=this.RULE_STACK.slice(0,this.RULE_STACK_IDX+1);return{errors:e,lexerState:this.exportLexerState(),RULE_STACK:t,CST_STACK:this.CST_STACK}}reloadRecogState(e){this.errors=e.errors,this.importLexerState(e.lexerState);let t=e.RULE_STACK;for(let e=0;e<t.length;e++)this.RULE_STACK[e]=t[e];this.RULE_STACK_IDX=t.length-1,this.RULE_STACK_IDX>=0&&(this.currRuleShortName=this.RULE_STACK[this.RULE_STACK_IDX],this.currRuleLookaheadFuncs=this.lookAheadFuncsCache[this.currRuleShortName])}ruleInvocationStateUpdate(e,t,s){this.RULE_OCCURRENCE_STACK[++this.RULE_OCCURRENCE_STACK_IDX]=s,this.RULE_STACK[++this.RULE_STACK_IDX]=e,this.currRuleShortName=e,this.currRuleLookaheadFuncs=this.lookAheadFuncsCache[e],this.cstInvocationStateUpdate(t)}isBackTracking(){return 0!==this.isBackTrackingStack.length}getCurrRuleFullName(){let e=this.currRuleShortName;return this.shortRuleNameToFull[e]}shortRuleNameToFullName(e){return this.shortRuleNameToFull[e]}isAtEndOfInput(){return this.tokenMatcher(this.LA(1),eW)}reset(){this.resetLexerState(),this.subruleIdx=0,this.currRuleShortName=-1,this.currRuleLookaheadFuncs=[],this.isBackTrackingStack=[],this.errors=[],this.RULE_STACK_IDX=-1,this.RULE_OCCURRENCE_STACK_IDX=-1,this.CST_STACK=[]}onBeforeParse(e){for(let e=0;e<this.maxLookahead+1;e++)this.tokVector.push(tq)}onAfterParse(e){if(!1===this.isAtEndOfInput()){let e=this.LA(1),t=this.errorMessageProvider.buildNotAllInputParsedMessage({firstRedundant:e,ruleName:this.getCurrRuleFullName()});this.SAVE_ERROR(new tA(t,e))}for(;this.tokVector.at(-1)===tq;)this.tokVector.pop()}}class tK{initErrorHandler(e){this._errors=[],this.errorMessageProvider=Object.hasOwn(e,"errorMessageProvider")?e.errorMessageProvider:tJ.errorMessageProvider}SAVE_ERROR(e){if(tE(e))return e.context={ruleStack:this.getHumanReadableRuleStack(),ruleOccurrenceStack:this.RULE_OCCURRENCE_STACK.slice(0,this.RULE_OCCURRENCE_STACK_IDX+1)},this._errors.push(e),e;throw Error("Trying to save an Error which is not a RecognitionException")}get errors(){return[...this._errors]}set errors(e){this._errors=e}raiseEarlyExitException(e,t,s){let i=this.getCurrRuleFullName(),n=ti(e,this.getGAstProductions()[i],t,this.maxLookahead)[0],a=[];for(let e=1;e<=this.maxLookahead;e++)a.push(this.LA(e));let r=this.errorMessageProvider.buildEarlyExitMessage({expectedIterationPaths:n,actual:a,previous:this.LA(0),customUserDescription:s,ruleName:i});throw this.SAVE_ERROR(new tS(r,this.LA(1),this.LA(0)))}raiseNoAltException(e,t){let s=this.getCurrRuleFullName(),i=ts(e,this.getGAstProductions()[s],this.maxLookahead),n=[];for(let e=1;e<=this.maxLookahead;e++)n.push(this.LA(e));let a=this.LA(0),r=this.errorMessageProvider.buildNoViableAltMessage({expectedPathsPerAlt:i,actual:n,previous:a,customUserDescription:t,ruleName:this.getCurrRuleFullName()});throw this.SAVE_ERROR(new ty(r,this.LA(1),a))}}let tF={description:"This Object indicates the Parser is during Recording Phase"};Object.freeze(tF);let tB=eG({name:"RECORDING_PHASE_TOKEN",pattern:ex.NA});eN([tB]);let tj=eV(tB,"This IToken indicates the Parser is in Recording Phase\n See: https://chevrotain.io/docs/guide/internals.html#grammar-recording for details",-1,-1,-1,-1,-1,-1);Object.freeze(tj);let tG={name:"This CSTNode indicates the Parser is in Recording Phase\n See: https://chevrotain.io/docs/guide/internals.html#grammar-recording for details",children:{}};class tW{initGastRecorder(e){this.recordingProdStack=[],this.RECORDING_PHASE=!1}enableRecording(){this.RECORDING_PHASE=!0,this.TRACE_INIT("Enable Recording",()=>{for(let e=0;e<10;e++){let t=e>0?e:"";this[`CONSUME${t}`]=function(t,s){return this.consumeInternalRecord(t,e,s)},this[`SUBRULE${t}`]=function(t,s){return this.subruleInternalRecord(t,e,s)},this[`OPTION${t}`]=function(t){return this.optionInternalRecord(t,e)},this[`OR${t}`]=function(t){return this.orInternalRecord(t,e)},this[`MANY${t}`]=function(t){this.manyInternalRecord(e,t)},this[`MANY_SEP${t}`]=function(t){this.manySepFirstInternalRecord(e,t)},this[`AT_LEAST_ONE${t}`]=function(t){this.atLeastOneInternalRecord(e,t)},this[`AT_LEAST_ONE_SEP${t}`]=function(t){this.atLeastOneSepFirstInternalRecord(e,t)}}this.consume=function(e,t,s){return this.consumeInternalRecord(t,e,s)},this.subrule=function(e,t,s){return this.subruleInternalRecord(t,e,s)},this.option=function(e,t){return this.optionInternalRecord(t,e)},this.or=function(e,t){return this.orInternalRecord(t,e)},this.many=function(e,t){this.manyInternalRecord(e,t)},this.atLeastOne=function(e,t){this.atLeastOneInternalRecord(e,t)},this.ACTION=this.ACTION_RECORD,this.BACKTRACK=this.BACKTRACK_RECORD,this.LA=this.LA_RECORD})}disableRecording(){this.RECORDING_PHASE=!1,this.TRACE_INIT("Deleting Recording methods",()=>{for(let e=0;e<10;e++){let t=e>0?e:"";delete this[`CONSUME${t}`],delete this[`SUBRULE${t}`],delete this[`OPTION${t}`],delete this[`OR${t}`],delete this[`MANY${t}`],delete this[`MANY_SEP${t}`],delete this[`AT_LEAST_ONE${t}`],delete this[`AT_LEAST_ONE_SEP${t}`]}delete this.consume,delete this.subrule,delete this.option,delete this.or,delete this.many,delete this.atLeastOne,delete this.ACTION,delete this.BACKTRACK,delete this.LA})}ACTION_RECORD(e){}BACKTRACK_RECORD(e,t){return()=>!0}LA_RECORD(e){return tq}topLevelRuleRecord(e,t){try{let s=new y({definition:[],name:e});return s.name=e,this.recordingProdStack.push(s),t.call(this),this.recordingProdStack.pop(),s}catch(e){if(!0!==e.KNOWN_RECORDER_ERROR)try{e.message=e.message+'\n This error was thrown during the "grammar recording phase" For more info see:\n https://chevrotain.io/docs/guide/internals.html#grammar-recording'}catch(e){}throw e}}optionInternalRecord(e,t){return tV.call(this,S,e,t)}atLeastOneInternalRecord(e,t){tV.call(this,L,t,e)}atLeastOneSepFirstInternalRecord(e,t){tV.call(this,O,t,e,!0)}manyInternalRecord(e,t){tV.call(this,R,t,e)}manySepFirstInternalRecord(e,t){tV.call(this,k,t,e,!0)}orInternalRecord(e,t){return tz.call(this,e,t)}subruleInternalRecord(e,t,s){if(tY(t),!e||!Object.hasOwn(e,"ruleName")){let s=Error(`<SUBRULE${tH(t)}> argument is invalid expecting a Parser method reference but got: <${JSON.stringify(e)}>
|
|
54
54
|
inside top level rule: <${this.recordingProdStack[0].name}>`);throw s.KNOWN_RECORDER_ERROR=!0,s}let i=this.recordingProdStack.at(-1),n=new g({idx:t,nonTerminalName:e.ruleName,label:null==s?void 0:s.LABEL,referencedRule:void 0});return i.definition.push(n),this.outputCst?tG:tF}consumeInternalRecord(e,t,s){if(tY(t),!eb(e)){let s=Error(`<CONSUME${tH(t)}> argument is invalid expecting a TokenType reference but got: <${JSON.stringify(e)}>
|
|
55
55
|
inside top level rule: <${this.recordingProdStack[0].name}>`);throw s.KNOWN_RECORDER_ERROR=!0,s}let i=this.recordingProdStack.at(-1),n=new N({idx:t,terminalType:e,label:null==s?void 0:s.LABEL});return i.definition.push(n),tj}}function tV(e,t,s,i=!1){tY(s);let n=this.recordingProdStack.at(-1),a="function"==typeof t?t:t.DEF,r=new e({definition:[],idx:s});return i&&(r.separator=t.SEP),Object.hasOwn(t,"MAX_LOOKAHEAD")&&(r.maxLookahead=t.MAX_LOOKAHEAD),this.recordingProdStack.push(r),a.call(this),n.definition.push(r),this.recordingProdStack.pop(),tF}function tz(e,t){tY(t);let s=this.recordingProdStack.at(-1),i=!1===Array.isArray(e),n=!1===i?e:e.DEF,a=new I({definition:[],idx:t,ignoreAmbiguities:i&&!0===e.IGNORE_AMBIGUITIES});return Object.hasOwn(e,"MAX_LOOKAHEAD")&&(a.maxLookahead=e.MAX_LOOKAHEAD),a.hasPredicates=n.some(e=>"function"==typeof e.GATE),s.definition.push(a),n.forEach(e=>{let t=new A({definition:[]});a.definition.push(t),Object.hasOwn(e,"IGNORE_AMBIGUITIES")?t.ignoreAmbiguities=e.IGNORE_AMBIGUITIES:Object.hasOwn(e,"GATE")&&(t.ignoreAmbiguities=!0),this.recordingProdStack.push(t),e.ALT.call(this),this.recordingProdStack.pop()}),tF}function tH(e){return 0===e?"":`${e}`}function tY(e){if(e<0||e>255){let t=Error(`Invalid DSL Method idx value: <${e}>
|
|
56
56
|
Idx value must be a none negative value smaller than 256`);throw t.KNOWN_RECORDER_ERROR=!0,t}}class tX{initPerformanceTracer(e){if(Object.hasOwn(e,"traceInitPerf")){let t=e.traceInitPerf,s="number"==typeof t;this.traceInitMaxIdent=s?t:1/0,this.traceInitPerf=s?t>0:t}else this.traceInitMaxIdent=0,this.traceInitPerf=tJ.traceInitPerf;this.traceInitIndent=-1}TRACE_INIT(e,t){if(!0!==this.traceInitPerf)return t();{this.traceInitIndent++;let s=Array(this.traceInitIndent+1).join(" ");this.traceInitIndent<this.traceInitMaxIdent&&console.log(`${s}--> <${e}>`);let{time:i,value:n}=eL(t),a=i>10?console.warn:console.log;return this.traceInitIndent<this.traceInitMaxIdent&&a(`${s}<-- <${e}> time: ${i}ms`),this.traceInitIndent--,n}}}let tq=eV(eW,"",-1,-1,-1,-1,-1,-1);Object.freeze(tq);let tJ=Object.freeze({recoveryEnabled:!1,maxLookahead:3,dynamicTokensEnabled:!1,outputCst:!0,errorMessageProvider:ez,nodeLocationTracking:"none",traceInitPerf:!1,skipValidations:!1}),tZ=Object.freeze({recoveryValueFunc:()=>void 0,resyncEnabled:!0});!function(e){e[e.INVALID_RULE_NAME=0]="INVALID_RULE_NAME",e[e.DUPLICATE_RULE_NAME=1]="DUPLICATE_RULE_NAME",e[e.INVALID_RULE_OVERRIDE=2]="INVALID_RULE_OVERRIDE",e[e.DUPLICATE_PRODUCTIONS=3]="DUPLICATE_PRODUCTIONS",e[e.UNRESOLVED_SUBRULE_REF=4]="UNRESOLVED_SUBRULE_REF",e[e.LEFT_RECURSION=5]="LEFT_RECURSION",e[e.NONE_LAST_EMPTY_ALT=6]="NONE_LAST_EMPTY_ALT",e[e.AMBIGUOUS_ALTS=7]="AMBIGUOUS_ALTS",e[e.CONFLICT_TOKENS_RULES_NAMESPACE=8]="CONFLICT_TOKENS_RULES_NAMESPACE",e[e.INVALID_TOKEN_NAME=9]="INVALID_TOKEN_NAME",e[e.NO_NON_EMPTY_LOOKAHEAD=10]="NO_NON_EMPTY_LOOKAHEAD",e[e.AMBIGUOUS_PREFIX_ALTS=11]="AMBIGUOUS_PREFIX_ALTS",e[e.TOO_MANY_ALTS=12]="TOO_MANY_ALTS",e[e.CUSTOM_LOOKAHEAD_VALIDATION=13]="CUSTOM_LOOKAHEAD_VALIDATION"}(r||(r={}));class tQ{static performSelfAnalysis(e){throw Error("The **static** `performSelfAnalysis` method has been deprecated. \nUse the **instance** method with the same name instead.")}performSelfAnalysis(){this.TRACE_INIT("performSelfAnalysis",()=>{let e;this.selfAnalysisDone=!0;let t=this.className;this.TRACE_INIT("toFastProps",()=>{E(this)}),this.TRACE_INIT("Grammar Recording",()=>{try{this.enableRecording(),this.definedRulesNames.forEach(e=>{let t,s=this[e].originalGrammarAction;this.TRACE_INIT(`${e} Rule`,()=>{t=this.topLevelRuleRecord(e,s)}),this.gastProductionsCache[e]=t})}finally{this.disableRecording()}});let s=[];if(this.TRACE_INIT("Grammar Resolving",()=>{s=function(e){let t=Object.assign({errMsgProvider:eH},e),s={};e.rules.forEach(e=>{s[e.name]=e});let i=new eX(s,t.errMsgProvider);return i.resolveRefs(),i.errors}({rules:Object.values(this.gastProductionsCache)}),this.definitionErrors=this.definitionErrors.concat(s)}),this.TRACE_INIT("Grammar Validations",()=>{if(0===s.length&&!1===this.skipValidations){var e;let s=function(e){var t;let s=null!=(t=e.errMsgProvider)?t:eY;return function(e,t,s,i){let n=e.flatMap(e=>(function(e,t){let s=new tl;return e.accept(s),Object.values(Object.fromEntries(Object.entries(Object.groupBy(s.allProductions,tr)).filter(([e,t])=>t.length>1))).map(s=>{let i=s[0],n=t.buildDuplicateFoundError(e,s),a=v(i),o={message:n,type:r.DUPLICATE_PRODUCTIONS,ruleName:e.name,dslName:a,occurrence:i.idx},l=to(i);return l&&(o.parameter=l),o})})(e,s)),a=function(e,t,s){let i=[],n=t.map(e=>e.name);return e.forEach(e=>{let t=e.name;if(n.includes(t)){let n=s.buildNamespaceConflictError(e);i.push({message:n,type:r.CONFLICT_TOKENS_RULES_NAMESPACE,ruleName:t})}}),i}(e,t,s),o=e.flatMap(e=>(function(e,t){let s=new tc;return e.accept(s),s.alternations.flatMap(s=>s.definition.length>255?[{message:t.buildTooManyAlternativesError({topLevelRule:e,alternation:s}),type:r.TOO_MANY_ALTS,ruleName:e.name,occurrence:s.idx}]:[])})(e,s)),l=e.flatMap(t=>(function(e,t,s,i){let n=[];if(t.reduce((t,s)=>s.name===e.name?t+1:t,0)>1){let t=i.buildDuplicateRuleNameError({topLevelRule:e,grammarName:s});n.push({message:t,type:r.DUPLICATE_RULE_NAME,ruleName:e.name})}return n})(t,e,i,s));return n.concat(a,o,l)}(e.rules,e.tokenTypes,s,e.grammarName)}({rules:Object.values(this.gastProductionsCache),tokenTypes:Object.values(this.tokensMap),errMsgProvider:eY,grammarName:t}),i=(e={lookaheadStrategy:this.lookaheadStrategy,rules:Object.values(this.gastProductionsCache),tokenTypes:Object.values(this.tokensMap),grammarName:t}).lookaheadStrategy.validate({rules:e.rules,tokenTypes:e.tokenTypes,grammarName:e.grammarName}).map(e=>Object.assign({type:r.CUSTOM_LOOKAHEAD_VALIDATION},e));this.definitionErrors=this.definitionErrors.concat(s,i)}}),0===this.definitionErrors.length&&(this.recoveryEnabled&&this.TRACE_INIT("computeAllProdsFollows",()=>{let e=function(e){let t={};return e.forEach(e=>{Object.assign(t,new P(e).startWalking())}),t}(Object.values(this.gastProductionsCache));this.resyncFollows=e}),this.TRACE_INIT("ComputeLookaheadFunctions",()=>{var e,t;null==(t=(e=this.lookaheadStrategy).initialize)||t.call(e,{rules:Object.values(this.gastProductionsCache)}),this.preComputeLookaheadFunctions(Object.values(this.gastProductionsCache))})),!tQ.DEFER_DEFINITION_ERRORS_HANDLING&&0!==this.definitionErrors.length)throw e=this.definitionErrors.map(e=>e.message),Error(`Parser Definition Errors detected:
|
|
57
|
-
${e.join("\n-------------------------------\n")}`)})}constructor(e,t){if(this.definitionErrors=[],this.selfAnalysisDone=!1,this.initErrorHandler(t),this.initLexerAdapter(),this.initLooksAhead(t),this.initRecognizerEngine(e,t),this.initRecoverable(t),this.initTreeBuilder(t),this.initGastRecorder(t),this.initPerformanceTracer(t),Object.hasOwn(t,"ignoredIssues"))throw Error("The <ignoredIssues> IParserConfig property has been deprecated.\n Please use the <IGNORE_AMBIGUITIES> flag on the relevant DSL method instead.\n See: https://chevrotain.io/docs/guide/resolving_grammar_errors.html#IGNORING_AMBIGUITIES\n For further details.");this.skipValidations=Object.hasOwn(t,"skipValidations")?t.skipValidations:tJ.skipValidations}}tQ.DEFER_DEFINITION_ERRORS_HANDLING=!1,function(e,t){t.forEach(t=>{let s=t.prototype;Object.getOwnPropertyNames(s).forEach(i=>{if("constructor"===i)return;let n=Object.getOwnPropertyDescriptor(s,i);n&&(n.get||n.set)?Object.defineProperty(e.prototype,i,n):e.prototype[i]=t.prototype[i]})})}(tQ,[tk,tb,tw,tP,t$,tD,tK,tW,tX]);class t0 extends tQ{constructor(e,t=tJ){let s=Object.assign({},t);s.outputCst=!0,super(e,s)}}var t1=s(24212),t2=(0,m.K)(e=>void 0!==e&&e>=0,"isKnownLocation");function t5(e,t){let s=e.lexer.tokenize(t);if(s.errors.length>0){let i=s.errors[0],n=t2(i.offset)?i.offset:t.length,a=n+(t2(i.length)?i.length:0);throw Error(`Error lexing ${e.diagramType} diagram: ${i.message} at line ${i.line??1}, column ${i.column??1} [${n},${a})`)}e.parser.input=s.tokens;let i=e.entry();if(e.parser.errors.length>0)throw Error(`Error parsing ${e.diagramType} diagram: ${e.parser.errors[0].message}`);e.visit(i)}(0,m.K)(t5,"runChevrotainParse");var t6={SOLID_ARROW:0,BACK_ARROW:1,LINE_SOLID:2,CIRCLE_ARROW:3,CROSS_ARROW:4,CIRCLE_ARROW_REVERSED:5,CROSS_ARROW_REVERSED:6},t4=p.UI.usecase,t3=(0,m.K)(()=>({actors:new Map,useCases:new Map,systemBoundaries:new Map,relationships:[],notes:new Map,jsonNodes:new Map,classDefs:new Map,symbols:new Map,direction:"LR",relationshipCounter:0,noteCounter:0,accTitle:"",accDescription:"",ast:void 0,config:structuredClone(t4)}),"createModel"),t9=(0,m.K)(e=>{if(!(e.actors instanceof Map)||!(e.useCases instanceof Map)||!(e.systemBoundaries instanceof Map)||!Array.isArray(e.relationships)||!(e.notes instanceof Map)||!(e.jsonNodes instanceof Map)||!(e.classDefs instanceof Map)||!(e.symbols instanceof Map)||!["TB","TD","BT","RL","LR"].includes(e.direction)||!Number.isSafeInteger(e.relationshipCounter)||e.relationshipCounter<0||!Number.isSafeInteger(e.noteCounter)||e.noteCounter<0||"string"!=typeof e.accTitle||"string"!=typeof e.accDescription||!e.config)throw Error("Cannot commit an incomplete usecase model")},"assertCompleteModel"),t8=t3(),t7=(0,m.K)(()=>structuredClone(t8.config),"getConfig"),se=(0,m.K)(()=>t8.ast,"getAST"),st=(0,m.K)(e=>{let t=structuredClone(e);t9(t);let s=(0,p.iN)(),i=(0,p.m7)();try{(0,p.SV)(t.accTitle),(0,p.EI)(t.accDescription),t8=t}catch(e){throw(0,p.SV)(s),(0,p.EI)(i),e}},"commit"),ss=(0,m.K)(()=>{t8=t3(),(0,p.IU)()},"clear"),si=(0,m.K)(()=>t8.actors,"getActors"),sn=(0,m.K)(e=>t8.actors.get(e),"getActor"),sa=(0,m.K)(()=>t8.useCases,"getUseCases"),sr=(0,m.K)(e=>t8.useCases.get(e),"getUseCase"),so=(0,m.K)(()=>t8.systemBoundaries,"getSystemBoundaries"),sl=(0,m.K)(e=>t8.systemBoundaries.get(e),"getSystemBoundary"),sc=(0,m.K)(()=>t8.relationships,"getRelationships"),sh=(0,m.K)(()=>t8.notes,"getNotes"),sd=(0,m.K)(e=>t8.notes.get(e),"getNote"),su=(0,m.K)(()=>t8.jsonNodes,"getJsonNodes"),sp=(0,m.K)(e=>t8.jsonNodes.get(e),"getJsonNode"),sf=(0,m.K)(()=>t8.classDefs,"getClassDefs"),sm=(0,m.K)(e=>t8.classDefs.get(e),"getClassDef"),sE=(0,m.K)(()=>t8.direction,"getDirection"),sT=(0,m.K)(e=>{let t=new Map;for(let s of["default",...e]){let e=t8.classDefs.get(s);if(e)for(let s of e.styles){let e=s.trim(),i=e.indexOf(":"),n=(-1===i?e:e.slice(0,i)).trim();n&&t.set(n,e)}}return[...t.values()]},"getCompiledStyles"),sg=(0,m.K)(e=>e.replaceAll("~","~0").replaceAll("/","~1"),"escapeJsonPointerPart"),sy=(0,m.K)(e=>"string"==typeof e?e:null===e?"null":String(e),"displayJsonScalar"),sA=(0,m.K)((e,t,s=e=>e)=>{let i=[],n=(0,m.K)((e,t,n)=>{i.push({key:s(e),accessibleKey:s(t),value:s(n)})},"append"),a=(0,m.K)((e,s,i)=>{if(Array.isArray(e)){if(0===e.length)return void n(s,s,"[]");if(e.every(e=>null===e||["string","number","boolean"].includes(typeof e))){for(let[t,i]of e.entries())n(0===t?s:"",s,sy(i));return}for(let[t,n]of e.entries())a(n,`${s}[${t}]`,`${i}/${t}`);return}if(null!==e&&"object"==typeof e){let r=t[i]??Object.keys(e);if(0===r.length)return void n(s,s,"{}");for(let t of r){let n=s?`${s}.${t}`:t;a(e[t],n,`${i}/${sg(t)}`)}return}n(s,s,sy(e))},"visit");return a(e,"",""),i},"flattenJsonRows"),sS=(0,m.K)(e=>{switch(e.type){case"hollow":return"usecaseActorHollow";case"awesome":return"usecaseActorAwesome";case"icon":return"usecaseActorIcon";case"normal":return"usecaseActor"}},"actorShape"),sL=(0,m.K)(e=>"ellipse"===e.shape?e.business?"usecaseBusiness":"usecaseEllipse":e.shape,"useCaseShape"),sO=(0,m.K)(e=>{switch(e){case t6.SOLID_ARROW:return{arrowTypeStart:"none",arrowTypeEnd:"arrow_point"};case t6.BACK_ARROW:return{arrowTypeStart:"arrow_point",arrowTypeEnd:"none"};case t6.CIRCLE_ARROW:return{arrowTypeStart:"none",arrowTypeEnd:"arrow_circle"};case t6.CROSS_ARROW:return{arrowTypeStart:"none",arrowTypeEnd:"arrow_cross"};case t6.CIRCLE_ARROW_REVERSED:return{arrowTypeStart:"arrow_circle",arrowTypeEnd:"none"};case t6.CROSS_ARROW_REVERSED:return{arrowTypeStart:"arrow_cross",arrowTypeEnd:"none"};case t6.LINE_SOLID:return{arrowTypeStart:"none",arrowTypeEnd:"none"}}},"associationMarkers"),sR=(0,m.K)(e=>{switch(e.type){case"include":case"extend":return{arrowTypeStart:"none",arrowTypeEnd:"arrow_point",pattern:"dotted",label:e.type,labelType:"text"};case"generalization":return{arrowTypeStart:"none",arrowTypeEnd:"extension",pattern:"solid"};case"association":return{...sO(e.arrowType),pattern:"solid",...e.label?{label:e.label}:{},...e.labelType?{labelType:e.labelType}:{}}}},"relationshipVisuals"),sk=(0,m.K)(e=>e.animate||e.animation?[`edge-animation-${e.animation??"fast"}`]:[],"animationClasses"),sI=(0,m.K)((...e)=>e.filter(e=>!!e).join(" "),"classNames"),sN=(0,m.K)(()=>{let e=(0,p.D7)(),t={...t8.config,...e.usecase},s=(0,m.K)(t=>(0,p.jZ)(t,e),"sanitize"),i=(0,m.K)(e=>s(t8.actors.get(e)?.label??t8.useCases.get(e)?.label??t8.jsonNodes.get(e)?.id??t8.notes.get(e)?.label??e),"endpointLabel"),n=[],a=[],r=0,o=0;for(let t of t8.actors.values())n.push({id:t.id,label:s(t.label),labelType:t.labelType,shape:sS(t),isGroup:!1,padding:10,look:e.look,colorIndex:r++,cssClasses:sI("default","usecase-actor",`usecase-actor-${t.type}`,t.business&&"usecase-business",...t.classes),cssStyles:[...t.styles],cssCompiledStyles:sT(t.classes),actorType:t.type,business:t.business,...t.icon?{icon:t.icon}:{},...t.stereotype?{stereotype:s(t.stereotype)}:{},...t.parentId?{parentId:t.parentId}:{}});for(let t of t8.useCases.values())n.push({id:t.id,label:s(t.label),labelType:t.labelType,shape:sL(t),isGroup:!1,padding:"ellipse"===t.shape?20:10,look:e.look,colorIndex:r++,cssClasses:sI("default","usecase-element",`usecase-${t.shape}`,t.business&&"usecase-business",...t.classes),cssStyles:[...t.styles],cssCompiledStyles:sT(t.classes),business:t.business,...t.stereotype?{stereotype:s(t.stereotype)}:{},...t.parentId?{parentId:t.parentId}:{}});for(let t of t8.notes.values())n.push({id:t.id,label:s(t.label),labelType:t.labelType,shape:"note",isGroup:!1,padding:10,look:e.look,cssClasses:"default usecase-note",cssStyles:[],cssCompiledStyles:sT([]),noteTarget:t.target,noteTargetLabel:s(t8.actors.get(t.target)?.label??t8.useCases.get(t.target)?.label??t8.jsonNodes.get(t.target)?.id??t.target)});for(let t of t8.jsonNodes.values())n.push({id:t.id,label:s(t.id),labelType:"text",shape:"usecaseJsonTable",isGroup:!1,padding:10,look:e.look,cssClasses:sI("default","usecase-json-table",...t.classes),cssStyles:[...t.styles],cssCompiledStyles:sT(t.classes),jsonRows:sA(t.value,t.propertyOrder,s)});for(let t of t8.systemBoundaries.values())n.push({id:t.id,label:s(t.label),labelType:t.labelType,shape:"usecaseSystemBoundary",isGroup:!0,padding:20,look:e.look,colorIndex:o++,cssClasses:sI("default","system-boundary",`system-boundary-${t.type}`,...t.classes),cssStyles:[...t.styles],cssCompiledStyles:sT(t.classes),boundaryType:t.type});for(let t of t8.relationships){let{label:n,...r}=sR(t);a.push({id:t.id,start:t.source,end:t.target,source:t.source,target:t.target,sourceLabel:i(t.source),targetLabel:i(t.target),type:"edge",relationshipType:t.type,internal:!1,...r,...void 0!==n?{label:s(n)}:{},labelpos:"c",classes:sI("default","relationship",`relationship-${t.type}`,...t.classes,...sk(t)),style:[...t.styles],cssCompiledStyles:sT(t.classes),animate:t.animate,...t.animation?{animation:t.animation}:{},look:e.look,thickness:"normal",minlen:t.minlen,isUserDefinedId:t.explicitId})}for(let t of t8.notes.values())a.push({id:`${t.id}-edge`,start:t.id,end:t.target,source:t.id,target:t.target,type:"edge",relationshipType:"note",sourceLabel:i(t.id),targetLabel:i(t.target),internal:!0,pattern:"dotted",arrowTypeStart:"none",arrowTypeEnd:"none",labelpos:"c",classes:"default relationship relationship-note",style:[],cssCompiledStyles:sT([]),animate:!1,look:e.look,thickness:"normal",minlen:1,isUserDefinedId:!1});for(let e of n)e.wrappingWidth??=t.wrappingWidth,e.isGroup||e.shape.startsWith("usecaseActor")||(e.minWidth??=t.minNodeWidth),("usecaseEllipse"===e.shape||"usecaseBusiness"===e.shape)&&(e.spreadPorts=!0);return{nodes:n,edges:a,config:e,type:"usecase",layoutAlgorithm:"dagre",direction:sE(),nodeSpacing:t.nodeSpacing,rankSpacing:t.rankSpacing,actorFontSize:t.actorFontSize,actorFontFamily:t.actorFontFamily,actorFontWeight:t.actorFontWeight,usecaseFontSize:t.usecaseFontSize,usecaseFontFamily:t.usecaseFontFamily,usecaseFontWeight:t.usecaseFontWeight,diagramPadding:t.diagramPadding,useMaxWidth:t.useMaxWidth,markers:["point","circle","cross","extension"]}},"getData"),sb={getConfig:t7,createModel:t3,commit:st,getAST:se,clear:ss,setDiagramTitle:p.ke,getDiagramTitle:p.ab,setAccTitle:p.SV,getAccTitle:p.iN,setAccDescription:p.EI,getAccDescription:p.m7,getActors:si,getActor:sn,getUseCases:sa,getUseCase:sr,getSystemBoundaries:so,getSystemBoundary:sl,getRelationships:sc,getNotes:sh,getNote:sd,getJsonNodes:su,getJsonNode:sp,getClassDefs:sf,getClassDef:sm,getDirection:sE,getData:sN};function sC(e,t,s){let i=[s];return i.index=t,i.input=e,i}(0,m.K)(sC,"customMatch");var s_=(0,m.K)((e,t)=>{if('"'!==e[t]||"`"!==e[t+1])return null;for(let s=t+2;s<e.length-1;s++)if("`"===e[s]&&'"'===e[s+1])return sC(e,t,e.slice(t,s+2));return null},"matchMarkdownString"),sv=(0,m.K)((e,t)=>{if("%"!==e[t]||"%"!==e[t+1])return null;for(let s=t-1;s>=0;s--){let t=e[s];if("\n"===t||"\r"===t)break;if(" "!==t&&" "!==t)return null}let s=t+2;for(;s<e.length&&"\n"!==e[s]&&"\r"!==e[s];)s++;return sC(e,t,e.slice(t,s))},"matchComment"),sx=(0,m.K)((e,t)=>{for(let s=t-1;s>=0;s--){let t=e[s];if("\n"===t||"\r"===t)break;if(" "!==t&&" "!==t)return!1}return!0},"isIndentedLineStart"),sU=(0,m.K)((e,t,s)=>{if(!sx(e,t))return null;let i=s.exec(e.slice(t));return i?sC(e,t,i[0]):null},"matchAccessibilityLine"),sM=(0,m.K)((e,t)=>{if(!sx(e,t))return null;let s=/^accDescr[\t ]*{/.exec(e.slice(t));if(!s)return null;let i=e.indexOf("}",t+s[0].length);return -1===i?null:sC(e,t,e.slice(t,i+1))},"matchAccDescrBlock"),sw=(0,m.K)((e,t)=>{if("{"!==e[t])return null;let s=0,i=!1,n=!1;for(let a=t;a<e.length;a++){let r=e[a];if(i){n?n=!1:"\\"===r?n=!0:'"'===r&&(i=!1);continue}if('"'===r)i=!0;else if("{"===r)s++;else if("}"===r&&0==--s)return sC(e,t,e.slice(t,a+1))}return null},"matchJsonObject"),sP=(0,m.K)((e,t)=>{let s=e.indexOf(">>",t);if(-1===s||/[\n\r]/.test(e.slice(t,s)))return null;let i=e.slice(t,s);return i.trim()?sC(e,t,i):null},"matchStereotypeText"),sD=eG({name:"LABEL_TEXT",pattern:ex.NA}),s$=eG({name:"WORD",pattern:ex.NA,categories:sD}),sK=eG({name:"NUMBER",pattern:/(?:\d+\.\d+|\d+|\.\d+)(?:[A-Za-z]+)?/,categories:sD}),sF=eG({name:"IDENTIFIER",pattern:/\w+/,longer_alt:sK,categories:s$}),sB=eG({name:"HWS",pattern:/[\t ]+/,group:ex.SKIPPED}),sj=eG({name:"MARKDOWN_STRING",pattern:s_,start_chars_hint:['"'],line_breaks:!0}),sG=eG({name:"UNCLOSED_MARKDOWN_STRING",pattern:/"`[^]*/,line_breaks:!0}),sW=eG({name:"COMMENT",pattern:sv,start_chars_hint:["%"],line_breaks:!1}),sV=eG({name:"NEWLINE",pattern:/\r\n|\n|\r/,line_breaks:!0}),sz=eG({name:"ACC_DESCR_BLOCK",pattern:sM,start_chars_hint:["a"],line_breaks:!0}),sH=/^accTitle[\t ]*:[^\n\r]*/,sY=/^accDescr[\t ]*:[^\n\r]*/,sX=eG({name:"ACC_TITLE_LINE",pattern:(0,m.K)((e,t)=>sU(e,t,sH),"pattern"),start_chars_hint:["a"],line_breaks:!1}),sq=eG({name:"ACC_DESCR_LINE",pattern:(0,m.K)((e,t)=>sU(e,t,sY),"pattern"),start_chars_hint:["a"],line_breaks:!1}),sJ=eG({name:"JSON_DECLARATION_START",pattern:/json[\t ]+\w+[\t ]*@[\t ]*(?={)/,push_mode:"jsonBody"}),sZ=eG({name:"JSON_OBJECT_LITERAL",pattern:sw,start_chars_hint:["{"],line_breaks:!0,pop_mode:!0}),sQ=eG({name:"UNCLOSED_JSON_OBJECT_LITERAL",pattern:/{[^]*/,line_breaks:!0,pop_mode:!0}),s0=(0,m.K)((e,t)=>eG({name:e,pattern:t,longer_alt:sF,categories:s$}),"keyword"),s1=s0("USECASE",/usecase-beta/),s2=s0("ACTOR",/actor/),s5=s0("SYSTEM_BOUNDARY",/systemBoundary/),s6=s0("END",/end/),s4=s0("DIRECTION",/direction/),s3=s0("TD",/TD/),s9=s0("TB",/TB/),s8=s0("BT",/BT/),s7=s0("LR",/LR/),ie=s0("RL",/RL/),it=s0("NOTE",/note/),is=s0("FOR",/for/),ii=s0("JSON",/json/),ia=s0("CLASS_DEF",/classDef/),ir=s0("CLASS",/class/),io=s0("STYLE",/style/),il=s0("INCLUDE",/include/i),ic=s0("EXTEND",/extend/i),ih=s0("TRUE",/true/),id=s0("FALSE",/false/),iu=eG({name:"GENERALIZATION",pattern:/--\|>/}),ip=eG({name:"DEPENDENCY_ARROW",pattern:/\.\.>/}),im=eG({name:"STEREOTYPE_START",pattern:/<</,push_mode:"stereotype"}),iE=eG({name:"STEREOTYPE_END",pattern:/>>/,pop_mode:!0}),iT=eG({name:"STEREOTYPE_TEXT",pattern:sP,line_breaks:!1}),ig=eG({name:"UNCLOSED_STEREOTYPE_TEXT",pattern:/[^\n\r]+/,line_breaks:!1,pop_mode:!0}),iy=eG({name:"CLASS_SEPARATOR",pattern:/:::/}),iA=eG({name:"FORWARD_SOLID",pattern:/--+>/}),iS=eG({name:"BACKWARD_SOLID",pattern:/<--+/}),iL=eG({name:"FORWARD_CIRCLE",pattern:/--o/}),iO=eG({name:"BACKWARD_CIRCLE",pattern:/o--/}),iR=eG({name:"FORWARD_CROSS",pattern:/--x/}),ik=eG({name:"BACKWARD_CROSS",pattern:/x--/}),iI=eG({name:"MARKERLESS_SOLID",pattern:/--+/}),iN=eG({name:"METADATA_START",pattern:/@{/}),ib=eG({name:"AT",pattern:/@/,categories:sD}),iC=eG({name:"LBRACE",pattern:/{/}),i_=eG({name:"RBRACE",pattern:/}/}),iv=eG({name:"LBRACKET",pattern:/\[/}),ix=eG({name:"RBRACKET",pattern:/]/}),iU=eG({name:"LPAREN",pattern:/\(/}),iM=eG({name:"RPAREN",pattern:/\)/}),iw=eG({name:"COMMA",pattern:/,/,categories:sD}),iP=eG({name:"COLON",pattern:/:/,categories:sD}),iD=eG({name:"HASH_COLOR",pattern:/#[\dA-Fa-f]+/,categories:sD}),i$=eG({name:"PLAIN_STRING",pattern:/"[^\n\r"]*"|'[^\n\r']*'/}),iK=eG({name:"CSS_IDENTIFIER",pattern:/--[A-Z_a-z][\w-]*|[A-Z_a-z]\w*(?:-\w+)+/,categories:sD}),iF=eG({name:"CSS_ESCAPED_COMMA",pattern:/\\,/,categories:sD}),iB=eG({name:"DASH",pattern:/-/,categories:sD}),ij=eG({name:"DOT",pattern:/\./,categories:sD}),iG=eG({name:"PERCENT",pattern:/%/,categories:sD}),iW=eG({name:"CSS_PUNCTUATION",pattern:/[!#$&*+/=?^_|~]/,categories:sD}),iV=eG({name:"LABEL_PUNCTUATION",pattern:/[;<>\\`]/,categories:sD}),iz=eG({name:"LABEL_SYMBOL",pattern:/[^\t\n\r !-~]+/,categories:sD}),iH=[sD,s$,sB,sj,sG,sW,sV,sz,sX,sq,sJ,s1,s2,s5,s6,s4,s3,s9,s8,s7,ie,it,is,ii,ia,ir,io,il,ic,ih,id,iu,ip,im,iy,iA,iS,iL,iO,iR,ik,iI,iN,ib,iC,i_,iv,ix,iU,iM,iw,iP,iD,i$,iK,sF,sK,iF,iB,ij,iG,iW,iV,iz],iY={defaultMode:"defaultMode",modes:{defaultMode:[...iH],jsonBody:[sZ,sQ],stereotype:[iE,iT,ig]}},iX=[...iH,sZ,sQ,iE,iT,ig],iq=new ex(iY),iJ=(0,m.K)(e=>eO(e,sD)||e.tokenType===i$||e.tokenType===sj,"isLabelToken"),iZ={allowmixing:!0,newpage:!0,package:!0,rectangle:!0,skinparam:!0},iQ=new class extends t0{static{(0,m.K)(this,"UsecaseParser")}constructor(){super(iX,{nodeLocationTracking:"full"}),this.RULE("start",()=>{this.CONSUME(s1),this.SUBRULE(this.lineEnd),this.MANY(()=>this.SUBRULE(this.line))}),this.RULE("line",()=>{this.OR([{ALT:(0,m.K)(()=>this.SUBRULE(this.blankLine),"ALT")},{ALT:(0,m.K)(()=>this.SUBRULE(this.commentLine),"ALT")},{GATE:(0,m.K)(()=>this.isStatementStart(),"GATE"),ALT:(0,m.K)(()=>this.SUBRULE(this.statement),"ALT")}])}),this.RULE("statement",()=>{this.OR([{ALT:(0,m.K)(()=>this.SUBRULE(this.accTitleStatement),"ALT")},{ALT:(0,m.K)(()=>this.SUBRULE(this.accDescrStatement),"ALT")},{ALT:(0,m.K)(()=>this.SUBRULE(this.directionStatement),"ALT")},{ALT:(0,m.K)(()=>this.SUBRULE(this.actorStatement),"ALT")},{ALT:(0,m.K)(()=>this.SUBRULE(this.systemBoundaryStatement),"ALT")},{ALT:(0,m.K)(()=>this.SUBRULE(this.noteStatement),"ALT")},{ALT:(0,m.K)(()=>this.SUBRULE(this.jsonStatement),"ALT")},{ALT:(0,m.K)(()=>this.SUBRULE(this.classDefStatement),"ALT")},{ALT:(0,m.K)(()=>this.SUBRULE(this.classStatement),"ALT")},{ALT:(0,m.K)(()=>this.SUBRULE(this.styleStatement),"ALT")},{GATE:(0,m.K)(()=>this.isMetadataAssignment(),"GATE"),ALT:(0,m.K)(()=>this.SUBRULE(this.metadataAssignmentStatement),"ALT")},{GATE:(0,m.K)(()=>!this.isForbiddenPlantUmlStatement(),"GATE"),ALT:(0,m.K)(()=>this.SUBRULE(this.entityStatement),"ALT")}])}),this.RULE("lineEnd",()=>{this.OR([{ALT:(0,m.K)(()=>this.CONSUME(sV),"ALT")},{ALT:(0,m.K)(()=>this.CONSUME(eW),"ALT")}])}),this.RULE("blankLine",()=>{this.CONSUME(sV)}),this.RULE("commentLine",()=>{this.CONSUME(sW),this.SUBRULE(this.lineEnd)}),this.RULE("accTitleStatement",()=>{this.CONSUME(sX),this.SUBRULE(this.lineEnd)}),this.RULE("accDescrStatement",()=>{this.OR([{ALT:(0,m.K)(()=>this.CONSUME(sq),"ALT")},{ALT:(0,m.K)(()=>this.CONSUME(sz),"ALT")}]),this.SUBRULE(this.lineEnd)}),this.RULE("actorStatement",()=>{this.CONSUME(s2),this.SUBRULE(this.actorItem),this.OPTION(()=>{this.OR([{ALT:(0,m.K)(()=>this.AT_LEAST_ONE(()=>{this.CONSUME(iw),this.SUBRULE2(this.actorItem)}),"ALT")},{ALT:(0,m.K)(()=>this.SUBRULE(this.relationTail),"ALT")}])}),this.SUBRULE(this.lineEnd)}),this.RULE("actorItem",()=>{this.SUBRULE(this.actorName),this.OPTION(()=>this.SUBRULE(this.metadata)),this.OPTION2(()=>this.SUBRULE(this.stereotype)),this.OPTION3(()=>this.SUBRULE(this.classSuffix))}),this.RULE("actorName",()=>{this.OR([{ALT:(0,m.K)(()=>{this.CONSUME(sF),this.OPTION(()=>{this.CONSUME(iU),this.SUBRULE(this.nodeLabel),this.CONSUME(iM)})},"ALT")},{ALT:(0,m.K)(()=>this.CONSUME(i$),"ALT")},{ALT:(0,m.K)(()=>this.CONSUME(sj),"ALT")}])}),this.RULE("actorDeclarationOnly",()=>{this.CONSUME(s2),this.SUBRULE(this.actorItem),this.MANY(()=>{this.CONSUME(iw),this.SUBRULE2(this.actorItem)}),this.SUBRULE(this.lineEnd)}),this.RULE("entityStatement",()=>{this.SUBRULE(this.entityName),this.OPTION(()=>this.SUBRULE(this.relationTail)),this.SUBRULE(this.lineEnd)}),this.RULE("entityName",()=>{this.OR([{ALT:(0,m.K)(()=>{this.CONSUME(sF),this.OPTION(()=>{this.OR2([{ALT:(0,m.K)(()=>{this.CONSUME(iU),this.SUBRULE(this.nodeLabel),this.CONSUME(iM)},"ALT")},{ALT:(0,m.K)(()=>{this.CONSUME(iv),this.SUBRULE2(this.nodeLabel),this.CONSUME(ix)},"ALT")}])})},"ALT")},{ALT:(0,m.K)(()=>this.CONSUME(i$),"ALT")},{ALT:(0,m.K)(()=>this.CONSUME(sj),"ALT")}]),this.OPTION2(()=>this.SUBRULE(this.useCaseMetadata)),this.OPTION3(()=>this.SUBRULE(this.stereotype)),this.OPTION4(()=>this.SUBRULE(this.classSuffix))}),this.RULE("nodeLabel",()=>{this.OR([{ALT:(0,m.K)(()=>this.CONSUME(i$),"ALT")},{ALT:(0,m.K)(()=>this.CONSUME(sj),"ALT")},{ALT:(0,m.K)(()=>this.AT_LEAST_ONE(()=>this.CONSUME(sD)),"ALT")}])}),this.RULE("useCaseMetadata",()=>{this.SUBRULE(this.metadata)}),this.RULE("relationTail",()=>{this.OPTION({GATE:(0,m.K)(()=>this.LA(1).tokenType===sF&&this.LA(2).tokenType===ib,"GATE"),DEF:(0,m.K)(()=>{this.CONSUME(sF),this.CONSUME(ib)},"DEF")}),this.SUBRULE(this.arrow),this.SUBRULE(this.entityName)}),this.RULE("arrow",()=>{this.OR([{ALT:(0,m.K)(()=>this.SUBRULE(this.semanticRelation),"ALT")},{ALT:(0,m.K)(()=>this.SUBRULE(this.forwardSolidOperator),"ALT")},{ALT:(0,m.K)(()=>this.SUBRULE(this.backwardSolidOperator),"ALT")},{ALT:(0,m.K)(()=>this.SUBRULE(this.markerlessSolidOperator),"ALT")},{ALT:(0,m.K)(()=>this.SUBRULE(this.forwardCircleOperator),"ALT")},{ALT:(0,m.K)(()=>this.SUBRULE(this.backwardCircleOperator),"ALT")},{ALT:(0,m.K)(()=>this.SUBRULE(this.forwardCrossOperator),"ALT")},{ALT:(0,m.K)(()=>this.SUBRULE(this.backwardCrossOperator),"ALT")}])}),this.RULE("forwardSolidOperator",()=>{this.CONSUME(iA)}),this.RULE("backwardSolidOperator",()=>{this.CONSUME(iS),this.OPTION({GATE:(0,m.K)(()=>"<--"===this.LA(0).image&&this.hasLabeledRight([iI]),"GATE"),DEF:(0,m.K)(()=>{this.SUBRULE(this.edgeLabel),this.CONSUME(iI)},"DEF")})}),this.RULE("markerlessSolidOperator",()=>{this.CONSUME(iI),this.OPTION({GATE:(0,m.K)(()=>"--"===this.LA(0).image&&this.hasLabeledRight([iA,iI,iL,iR]),"GATE"),DEF:(0,m.K)(()=>{this.SUBRULE(this.edgeLabel),this.OR([{ALT:(0,m.K)(()=>this.CONSUME(iA),"ALT")},{ALT:(0,m.K)(()=>this.CONSUME2(iI),"ALT")},{ALT:(0,m.K)(()=>this.CONSUME(iL),"ALT")},{ALT:(0,m.K)(()=>this.CONSUME(iR),"ALT")}])},"DEF")})}),this.RULE("forwardCircleOperator",()=>{this.CONSUME(iL)}),this.RULE("backwardCircleOperator",()=>{this.CONSUME(iO),this.OPTION({GATE:(0,m.K)(()=>this.hasLabeledRight([iI]),"GATE"),DEF:(0,m.K)(()=>{this.SUBRULE(this.edgeLabel),this.CONSUME(iI)},"DEF")})}),this.RULE("forwardCrossOperator",()=>{this.CONSUME(iR)}),this.RULE("backwardCrossOperator",()=>{this.CONSUME(ik),this.OPTION({GATE:(0,m.K)(()=>this.hasLabeledRight([iI]),"GATE"),DEF:(0,m.K)(()=>{this.SUBRULE(this.edgeLabel),this.CONSUME(iI)},"DEF")})}),this.RULE("edgeLabel",()=>{this.OR([{ALT:(0,m.K)(()=>this.CONSUME(i$),"ALT")},{ALT:(0,m.K)(()=>this.CONSUME(sj),"ALT")},{ALT:(0,m.K)(()=>this.AT_LEAST_ONE(()=>this.CONSUME(sD)),"ALT")}])}),this.RULE("semanticRelation",()=>{this.OR([{ALT:(0,m.K)(()=>{this.CONSUME(ip),this.CONSUME(iP),this.OR2([{ALT:(0,m.K)(()=>this.CONSUME(il),"ALT")},{ALT:(0,m.K)(()=>this.CONSUME(ic),"ALT")}])},"ALT")},{ALT:(0,m.K)(()=>this.CONSUME(iu),"ALT")}])}),this.RULE("metadata",()=>{this.CONSUME(iN),this.MANY(()=>this.CONSUME(sV)),this.OPTION(()=>{this.SUBRULE(this.metadataProperty),this.MANY2(()=>{this.SUBRULE(this.metadataSeparator),this.SUBRULE2(this.metadataProperty)}),this.OPTION2(()=>this.CONSUME(iw)),this.MANY3(()=>this.CONSUME2(sV))}),this.CONSUME(i_)}),this.RULE("metadataProperty",()=>{this.OR([{ALT:(0,m.K)(()=>this.CONSUME(sF),"ALT")},{ALT:(0,m.K)(()=>this.CONSUME(i$),"ALT")}]),this.CONSUME(iP),this.OR2([{ALT:(0,m.K)(()=>this.CONSUME2(sF),"ALT")},{ALT:(0,m.K)(()=>this.CONSUME2(i$),"ALT")},{ALT:(0,m.K)(()=>this.CONSUME(ih),"ALT")},{ALT:(0,m.K)(()=>this.CONSUME(id),"ALT")}])}),this.RULE("metadataSeparator",()=>{this.OR([{ALT:(0,m.K)(()=>{this.CONSUME(iw),this.MANY(()=>this.CONSUME(sV))},"ALT")},{ALT:(0,m.K)(()=>{this.AT_LEAST_ONE(()=>this.CONSUME2(sV)),this.OPTION(()=>this.CONSUME2(iw)),this.MANY2(()=>this.CONSUME3(sV))},"ALT")}])}),this.RULE("systemBoundaryStatement",()=>{this.CONSUME(s5),this.SUBRULE(this.systemBoundaryName),this.OPTION(()=>this.SUBRULE(this.metadata)),this.OPTION2(()=>this.SUBRULE(this.classSuffix)),this.SUBRULE(this.lineEnd),this.SUBRULE(this.systemBoundaryContent),this.CONSUME(s6),this.SUBRULE2(this.lineEnd)}),this.RULE("systemBoundaryName",()=>{this.OR([{ALT:(0,m.K)(()=>{this.CONSUME(sF),this.OPTION(()=>{this.OR2([{ALT:(0,m.K)(()=>{this.CONSUME(iU),this.SUBRULE(this.nodeLabel),this.CONSUME(iM)},"ALT")},{ALT:(0,m.K)(()=>{this.CONSUME(iv),this.SUBRULE2(this.nodeLabel),this.CONSUME(ix)},"ALT")}])})},"ALT")},{ALT:(0,m.K)(()=>this.CONSUME(i$),"ALT")},{ALT:(0,m.K)(()=>this.CONSUME(sj),"ALT")}])}),this.RULE("systemBoundaryContent",()=>{this.MANY(()=>{this.OR([{ALT:(0,m.K)(()=>this.SUBRULE(this.blankLine),"ALT")},{ALT:(0,m.K)(()=>this.SUBRULE(this.commentLine),"ALT")},{ALT:(0,m.K)(()=>this.SUBRULE(this.boundaryElement),"ALT")}])})}),this.RULE("boundaryElement",()=>{this.OR([{ALT:(0,m.K)(()=>this.SUBRULE(this.actorDeclarationOnly),"ALT")},{ALT:(0,m.K)(()=>{this.SUBRULE(this.entityName),this.SUBRULE(this.lineEnd)},"ALT")}])}),this.RULE("metadataAssignmentStatement",()=>{this.SUBRULE(this.metadataAssignmentTarget),this.SUBRULE(this.metadata),this.SUBRULE(this.lineEnd)}),this.RULE("metadataAssignmentTarget",()=>{this.OR([{ALT:(0,m.K)(()=>this.CONSUME(sF),"ALT")},{ALT:(0,m.K)(()=>this.CONSUME(i$),"ALT")},{ALT:(0,m.K)(()=>this.CONSUME(sj),"ALT")}])}),this.RULE("noteStatement",()=>{this.CONSUME(it),this.CONSUME(is),this.CONSUME(sF),this.SUBRULE(this.nodeLabel),this.SUBRULE(this.lineEnd)}),this.RULE("stereotype",()=>{this.CONSUME(im),this.CONSUME(iT),this.CONSUME(iE)}),this.RULE("classSuffix",()=>{this.CONSUME(iy),this.CONSUME(sF),this.MANY(()=>{this.CONSUME(iw),this.CONSUME2(sF)})}),this.RULE("jsonStatement",()=>{this.CONSUME(sJ),this.CONSUME(sZ),this.OPTION(()=>this.SUBRULE(this.classSuffix)),this.SUBRULE(this.lineEnd)}),this.RULE("directionStatement",()=>{this.CONSUME(s4),this.OR([{ALT:(0,m.K)(()=>this.CONSUME(s3),"ALT")},{ALT:(0,m.K)(()=>this.CONSUME(s9),"ALT")},{ALT:(0,m.K)(()=>this.CONSUME(s8),"ALT")},{ALT:(0,m.K)(()=>this.CONSUME(s7),"ALT")},{ALT:(0,m.K)(()=>this.CONSUME(ie),"ALT")}]),this.SUBRULE(this.lineEnd)}),this.RULE("classDefStatement",()=>{this.CONSUME(ia),this.CONSUME(sF),this.MANY(()=>{this.CONSUME(iw),this.CONSUME2(sF)}),this.SUBRULE(this.styles),this.SUBRULE(this.lineEnd)}),this.RULE("classStatement",()=>{this.CONSUME(ir),this.CONSUME(sF),this.MANY(()=>{this.CONSUME(iw),this.CONSUME2(sF)}),this.CONSUME3(sF),this.MANY2(()=>{this.CONSUME2(iw),this.CONSUME4(sF)}),this.SUBRULE(this.lineEnd)}),this.RULE("styleStatement",()=>{this.CONSUME(io),this.CONSUME(sF),this.SUBRULE(this.styles),this.SUBRULE(this.lineEnd)}),this.RULE("styles",()=>{this.SUBRULE(this.styleValue),this.MANY(()=>{this.CONSUME(iw),this.SUBRULE2(this.styleValue)})}),this.RULE("styleValue",()=>{this.OR([{ALT:(0,m.K)(()=>this.CONSUME(s$),"ALT")},{ALT:(0,m.K)(()=>this.CONSUME(iK),"ALT")},{ALT:(0,m.K)(()=>{this.CONSUME(iI),this.CONSUME2(s$)},"ALT")}]),this.CONSUME(iP),this.AT_LEAST_ONE(()=>this.SUBRULE(this.styleComponent))}),this.RULE("styleComponent",()=>{this.OR([{ALT:(0,m.K)(()=>this.CONSUME(s$),"ALT")},{ALT:(0,m.K)(()=>this.CONSUME(i$),"ALT")},{ALT:(0,m.K)(()=>this.CONSUME(sK),"ALT")},{ALT:(0,m.K)(()=>this.CONSUME(iD),"ALT")},{ALT:(0,m.K)(()=>this.CONSUME(iK),"ALT")},{ALT:(0,m.K)(()=>this.CONSUME(iF),"ALT")},{ALT:(0,m.K)(()=>this.CONSUME(iB),"ALT")},{ALT:(0,m.K)(()=>this.CONSUME(ij),"ALT")},{ALT:(0,m.K)(()=>this.CONSUME(iG),"ALT")},{ALT:(0,m.K)(()=>this.CONSUME(iW),"ALT")},{ALT:(0,m.K)(()=>this.CONSUME(iP),"ALT")},{ALT:(0,m.K)(()=>this.CONSUME(iU),"ALT")},{ALT:(0,m.K)(()=>this.CONSUME(iM),"ALT")},{ALT:(0,m.K)(()=>this.CONSUME(iv),"ALT")},{ALT:(0,m.K)(()=>this.CONSUME(ix),"ALT")},{ALT:(0,m.K)(()=>this.CONSUME(iC),"ALT")},{ALT:(0,m.K)(()=>this.CONSUME(i_),"ALT")},{ALT:(0,m.K)(()=>this.CONSUME(ib),"ALT")},{ALT:(0,m.K)(()=>this.CONSUME(iI),"ALT")}])}),this.performSelfAnalysis()}isMetadataAssignment(){let e=this.LA(1).tokenType;return(e===sF||e===i$||e===sj)&&this.LA(2).tokenType===iN}isStatementStart(){let e=this.LA(1).tokenType;return e!==eW&&e!==sV&&e!==sW}isForbiddenPlantUmlStatement(){return this.LA(1).tokenType===sF&&!0===iZ[this.LA(1).image.toLowerCase()]}hasLabeledRight(e){if(!iJ(this.LA(1)))return!1;for(let t=2;;t++){let s=this.LA(t);if(e.includes(s.tokenType))return!0;if(!iJ(s))return!1}}},i0=class extends Error{constructor(e,t,s){super(`${e} (line ${t}, column ${s})`),this.line=t,this.column=s,this.name="UsecaseJsonError"}static{(0,m.K)(this,"UsecaseJsonError")}},i1=(0,m.K)((e,t,s,i)=>{let n=s,a=i,r=Math.min(Math.max(t,0),e.length);for(let t=0;t<r;t++){let s=e[t];"\r"===s?(n++,a=1):"\n"===s?(0===t||"\r"!==e[t-1])&&(n++,a=1):a++}return{line:n,column:a}},"locationAtOffset"),i2=(0,m.K)((e,t,s,i)=>{let n=/\bposition (\d+)\b/u.exec(e);if(n)return i1(t,Number.parseInt(n[1],10),s,i);let a=/\bline (\d+) column (\d+)\b/u.exec(e);if(a){let e=Number.parseInt(a[1],10),t=Number.parseInt(a[2],10);return{line:s+e-1,column:1===e?i+t-1:t}}if(/unexpected end|end of json input/iu.test(e))return i1(t,t.length,s,i)},"locationFromErrorMessage"),i5=class extends Error{constructor(e){super("Invalid JSON token"),this.offset=e}static{(0,m.K)(this,"JsonWalkError")}},i6=class{constructor(e){this.text=e,this.offset=0,this.propertyOrder={}}static{(0,m.K)(this,"PropertyOrderCollector")}collect(){if(this.skipWhitespace(),this.collectValue(""),this.skipWhitespace(),this.offset!==this.text.length)throw new i5(this.offset);return this.propertyOrder}collectValue(e){this.skipWhitespace();let t=this.text[this.offset];if("{"===t)this.collectObject(e);else if("["===t)this.collectArray(e);else if('"'===t)this.readString(!1);else if("t"===t)this.consumeLiteral("true");else if("f"===t)this.consumeLiteral("false");else if("n"===t)this.consumeLiteral("null");else if("-"===t||t>="0"&&t<="9")this.consumeNumber();else throw new i5(this.offset)}collectObject(e){this.offset++;let t=[],s=new Set;if(this.propertyOrder[e]=t,this.skipWhitespace(),"}"===this.text[this.offset])return void this.offset++;for(;this.offset<this.text.length&&'"'===this.text[this.offset];){let i=this.readString(!0),n=`${e}/${i.replaceAll("~","~0").replaceAll("/","~1")}`;if(s.has(i)?this.deletePointerSubtree(n):(s.add(i),t.push(i)),this.skipWhitespace(),":"!==this.text[this.offset])break;if(this.offset++,this.collectValue(n),this.skipWhitespace(),"}"===this.text[this.offset])return void this.offset++;if(","!==this.text[this.offset])break;this.offset++,this.skipWhitespace()}throw new i5(this.offset)}collectArray(e){if(this.offset++,this.skipWhitespace(),"]"===this.text[this.offset])return void this.offset++;let t=0;for(;this.offset<this.text.length;){if(this.collectValue(`${e}/${t}`),t++,this.skipWhitespace(),"]"===this.text[this.offset])return void this.offset++;if(","!==this.text[this.offset])break;this.offset++,this.skipWhitespace()}throw new i5(this.offset)}readString(e){this.offset++;let t="";for(;this.offset<this.text.length;){let s=this.offset,i=this.text[this.offset++];if('"'===i)return t;if(32>i.charCodeAt(0))throw new i5(s);if("\\"!==i){e&&(t+=i);continue}let n=this.offset,a=this.text[this.offset++];switch(a){case'"':case"\\":case"/":e&&(t+=a);break;case"b":e&&(t+="\b");break;case"f":e&&(t+="\f");break;case"n":e&&(t+="\n");break;case"r":e&&(t+="\r");break;case"t":e&&(t+=" ");break;case"u":{let s=this.text.slice(this.offset,this.offset+4);if(!/^[\dA-Fa-f]{4}$/u.test(s))throw new i5(this.offset);e&&(t+=String.fromCharCode(Number.parseInt(s,16))),this.offset+=4;break}default:throw new i5(n)}}throw new i5(this.offset)}consumeLiteral(e){let t=0;for(let s of e){if(this.text[this.offset+t]!==s)throw new i5(this.offset+t);t++}this.offset+=e.length}consumeNumber(){if("-"===this.text[this.offset]&&this.offset++,"0"===this.text[this.offset])this.offset++;else if(this.text[this.offset]>="1"&&this.text[this.offset]<="9")for(;this.text[this.offset]>="0"&&this.text[this.offset]<="9";)this.offset++;else throw new i5(this.offset);if("."===this.text[this.offset]){if(this.offset++,this.text[this.offset]<"0"||this.text[this.offset]>"9")throw new i5(this.offset);for(;this.text[this.offset]>="0"&&this.text[this.offset]<="9";)this.offset++}if("e"===this.text[this.offset]||"E"===this.text[this.offset]){if(this.offset++,("+"===this.text[this.offset]||"-"===this.text[this.offset])&&this.offset++,this.text[this.offset]<"0"||this.text[this.offset]>"9")throw new i5(this.offset);for(;this.text[this.offset]>="0"&&this.text[this.offset]<="9";)this.offset++}}skipWhitespace(){for(;this.offset<this.text.length;){let e=this.text[this.offset];if(" "!==e&&" "!==e&&"\n"!==e&&"\r"!==e)return;this.offset++}}deletePointerSubtree(e){let t=`${e}/`;for(let s of Object.keys(this.propertyOrder))(s===e||s.startsWith(t))&&delete this.propertyOrder[s]}};function i4(e,t,s){let i;try{i=JSON.parse(e)}catch(a){let i=a instanceof Error?a.message:String(a),n=i2(i,e,t,s);if(!n){let i=0;try{new i6(e).collect()}catch(e){e instanceof i5&&(i=e.offset)}n=i1(e,i,t,s)}throw new i0(`Invalid JSON: ${i}`,n.line,n.column)}if("object"!=typeof i||null===i||Array.isArray(i))throw new i0("JSON value must have an object root",t,s);return{value:i,propertyOrder:new i6(e).collect()}}(0,m.K)(i4,"parseOrderedJsonObject");var i3=(0,m.K)(e=>({shape:"normal"===e.type?"actor":"hollow"===e.type?"actor-hollow":"awesome"===e.type?"actor-awesome":"actor-icon",...e.label===e.id?{}:{label:e.label},...e.classes.length?{classes:[...e.classes]}:{},...e.styles.length?{styles:[...e.styles]}:{},attrs:{kind:"actor",actorType:e.type,business:e.business,labelType:e.labelType,...e.icon?{icon:e.icon}:{},...e.stereotype?{stereotype:e.stereotype}:{},...e.parentId?{parentId:e.parentId}:{}}}),"actorNode"),i9=(0,m.K)(e=>({shape:e.shape,...e.label===e.id?{}:{label:e.label},...e.classes.length?{classes:[...e.classes]}:{},...e.styles.length?{styles:[...e.styles]}:{},attrs:{kind:"usecase",useCaseShape:e.shape,business:e.business,labelType:e.labelType,...e.stereotype?{stereotype:e.stereotype}:{},...e.parentId?{parentId:e.parentId}:{}}}),"useCaseNode"),i8=(0,m.K)(e=>({label:e.label,shape:"note",attrs:{kind:"note",target:e.target,labelType:e.labelType}}),"noteNode"),i7=(0,m.K)(e=>({label:e.id,shape:"json-table",...e.classes.length?{classes:[...e.classes]}:{},...e.styles.length?{styles:[...e.styles]}:{},attrs:{kind:"json",value:e.value,propertyOrder:e.propertyOrder,labelType:"text"}}),"jsonNode"),ne=(0,m.K)(e=>({id:e.id,source:e.source,target:e.target,...e.label?{label:e.label}:{},...e.classes.length?{classes:[...e.classes]}:{},...e.styles.length?{styles:[...e.styles]}:{},attrs:{relationshipType:e.type,arrowType:e.arrowType,minlen:e.minlen,explicitId:e.explicitId,animate:e.animate,...e.animation?{animation:e.animation}:{},...e.labelType?{labelType:e.labelType}:{}}}),"relationshipEdge"),nt=(0,m.K)(e=>({id:`${e.id}-edge`,source:e.id,target:e.target,attrs:{relationshipType:"note",arrowType:t6.LINE_SOLID,pattern:"dotted",minlen:1,explicitId:!1,animate:!1,internal:!0}}),"noteEdge"),ns=(0,m.K)((e,t,s,i)=>{let n={};for(let t of e.getActors().values())n[t.id]=i3(t);for(let t of e.getUseCases().values())n[t.id]=i9(t);for(let t of e.getNotes().values())n[t.id]=i8(t);for(let t of e.getJsonNodes().values())n[t.id]=i7(t);let a={};for(let t of e.getSystemBoundaries().values())a[t.id]={...t.label===t.id?{}:{title:t.label},nodes:[...t.members],...t.classes.length?{classes:[...t.classes]}:{},...t.styles.length?{styles:[...t.styles]}:{},attrs:{kind:"systemBoundary",boundaryType:t.type,labelType:t.labelType}};let r={};for(let t of e.getClassDefs().values())r[t.id]={styles:[...t.styles]};let o=e.getDirection();return{version:1,diagramType:"usecase",source:t,header:{keyword:"usecase",direction:"TD"===o?"TB":o,span:s},...e.getAccTitle()?{accTitle:e.getAccTitle()}:{},...e.getAccDescription()?{accDescr:e.getAccDescription()}:{},nodes:n,edges:[...e.getRelationships().map(ne),...[...e.getNotes().values()].map(nt)],groups:a,classDefs:r,statements:i}},"buildUsecaseGraphAST"),ni=(0,m.K)(e=>`line ${e.line}, column ${e.column} [${e.span[0]},${e.span[1]})`,"locationText"),nn=(0,m.K)(e=>void 0===e?"":` (label "${e}")`,"labelSuffix"),na=(0,m.K)(e=>e.generated?e.label:void 0,"generatedFrom"),nr=(0,m.K)((e,t)=>{for(let s of t)e.includes(s)||e.push(s)},"pushUnique"),no=class{constructor(e){this.db=e,this.source="",this.statements=[],this.elements=[],this.boundaries=[],this.jsonDrafts=[],this.relationshipDrafts=[],this.noteDrafts=[],this.metadataAssignments=[],this.classAssignments=[],this.styleAssignments=[],this.classDefinitions=[],this.directions=[],this.model=e.createModel()}static{(0,m.K)(this,"UsecaseModelBuilder")}reset(e){this.model=this.db.createModel(),this.source=e,this.statements=[],this.elements.length=0,this.boundaries.length=0,this.jsonDrafts.length=0,this.relationshipDrafts.length=0,this.noteDrafts.length=0,this.metadataAssignments.length=0,this.classAssignments.length=0,this.styleAssignments.length=0,this.classDefinitions.length=0,this.directions.length=0}addElement(e){this.elements.push(e)}addBoundary(e){this.boundaries.push(e)}addJson(e){this.jsonDrafts.push(e)}addRelationship(e){this.relationshipDrafts.push(e)}addNote(e){this.noteDrafts.push(e)}addMetadataAssignment(e,t,s,i){this.metadataAssignments.push({target:e,targetLocation:t,metadata:s,statement:i})}addClassDef(e,t){this.classDefinitions.push({ids:e,styles:t})}addClassAssignment(e,t){this.classAssignments.push({targets:e,classes:t})}addStyleAssignment(e,t,s){this.styleAssignments.push({target:e,location:t,styles:s})}setDirection(e){this.directions.push("TD"===e?"TB":e)}setAccTitle(e){this.model.accTitle=e}setAccDescription(e){this.model.accDescription=e}setStatements(e){this.statements=e}getActors(){return this.model.actors}getUseCases(){return this.model.useCases}getSystemBoundaries(){return this.model.systemBoundaries}getRelationships(){return this.model.relationships}getNotes(){return this.model.notes}getJsonNodes(){return this.model.jsonNodes}getClassDefs(){return this.model.classDefs}getDirection(){return this.model.direction}getAccTitle(){return this.model.accTitle}getAccDescription(){return this.model.accDescription}finalize(e){let t=new Map,s=new Map,i=new Map,n=new Map;for(let e of this.relationshipDrafts)this.recordFirst(n,e.source.id,e.source.location.span[0]),this.recordFirst(n,e.target.id,e.target.location.span[0]);for(let e of this.elements)this.recordFirst(n,e.id,e.location.span[0]);for(let e of this.boundaries)this.recordFirst(n,e.id,e.location.span[0]);for(let e of this.jsonDrafts)this.recordFirst(n,e.id,e.location.span[0]);for(let e of[...this.elements.map(e=>({offset:e.location.span[0],type:"element",value:e})),...this.boundaries.map(e=>({offset:e.location.span[0],type:"boundary",value:e})),...this.jsonDrafts.map(e=>({offset:e.location.span[0],type:"json",value:e})),...this.relationshipDrafts.filter(e=>e.explicitId).map(e=>({offset:e.explicitIdLocation.span[0],type:"edge",value:e}))].sort((e,t)=>e.offset-t.offset))"element"===e.type?this.collectElement(e.value,t,s):"boundary"===e.type?this.collectBoundary(e.value,t,i):"json"===e.type?this.registerUnique(t,e.value.id,"json",e.value.location,!1):this.registerUnique(t,e.value.explicitId,"edge",e.value.explicitIdLocation,!1);this.materializeElements(s,n),this.materializeBoundaries(i,n),this.materializeJson(n);let a=this.materializeRelationships(t,s,n);this.reorderElements(s,n),this.applyMetadataAssignments(t,s,i,a),this.validateAndRefreshElements(s),this.refreshBoundaries(i,s),this.materializeNotes(t),this.applyClassDefinitions(),this.applyClassesAndStyles(t,a),this.model.direction=this.directions.at(-1)??this.model.direction,this.model.symbols=new Map([...t].map(([e,t])=>[e,t.kind]));let r=ns(this,this.source,e,this.statements);return this.model.ast=r,this.db.commit(this.model),r}collectElement(e,t,s){let i=t.get(e.id),n=na({generated:e.generated,label:e.label.text});i&&i.kind!==e.kind&&this.conflict(`ID '${e.id}' is declared as both ${i.kind} and ${e.kind}`,e.location,i.location,n,na(i)),i&&(i.generated||e.generated)&&this.conflict(`Generated ID '${e.id}' collides with another declaration`,e.location,i.location,n,na(i));let a=s.get(e.id);if(!a){let i={kind:e.kind,id:e.id,label:e.label,location:e.location,generated:e.generated,classes:[...e.classes],...e.parentId?{parentId:e.parentId,parentLocation:e.parentLocation}:{},...e.shape?{shape:e.shape}:{},...e.stereotype?{stereotype:e.stereotype,stereotypeLocation:e.location}:{}};this.applyDeclarationMetadata(i,e.metadata),s.set(e.id,i),t.set(e.id,{kind:e.kind,location:e.location,generated:e.generated,label:e.label.text});return}(a.label.text!==e.label.text||a.label.type!==e.label.type)&&this.conflict(`ID '${e.id}' has conflicting labels`,e.location,a.location),e.shape&&a.shape&&e.shape!==a.shape&&this.conflict(`Use case '${e.id}' has conflicting shapes`,e.location,a.location),e.parentId&&a.parentId&&e.parentId!==a.parentId&&this.conflict(`Element '${e.id}' belongs to more than one system boundary`,e.parentLocation??e.location,a.parentLocation??a.location),e.stereotype&&a.stereotype&&e.stereotype!==a.stereotype&&this.conflict(`Element '${e.id}' has conflicting stereotypes`,e.location,a.stereotypeLocation??a.location),a.shape??=e.shape,a.parentId??=e.parentId,a.parentLocation??=e.parentLocation,a.stereotype??=e.stereotype,a.stereotypeLocation??=e.stereotype?e.location:void 0,nr(a.classes,e.classes),this.applyDeclarationMetadata(a,e.metadata)}collectBoundary(e,t,s){let i=t.get(e.id),n=na({generated:e.generated,label:e.label.text});i&&"boundary"!==i.kind&&this.conflict(`ID '${e.id}' is declared as both ${i.kind} and boundary`,e.location,i.location,n,na(i)),i&&(i.generated||e.generated)&&this.conflict(`Generated ID '${e.id}' collides with another declaration`,e.location,i.location,n,na(i));let a=s.get(e.id);if(a){(a.label.text!==e.label.text||a.label.type!==e.label.type)&&this.conflict(`Boundary '${e.id}' has conflicting titles`,e.location,a.location),nr(a.classes,e.classes);return}s.set(e.id,{id:e.id,label:e.label,location:e.location,generated:e.generated,classes:[...e.classes],styles:[],members:[]}),t.set(e.id,{kind:"boundary",location:e.location,generated:e.generated,label:e.label.text})}materializeElements(e,t){for(let s of[...e.values()].sort((e,s)=>(t.get(e.id)??0)-(t.get(s.id)??0)))this.setElementModel(s)}materializeBoundaries(e,t){for(let s of[...e.values()].sort((e,s)=>(t.get(e.id)??0)-(t.get(s.id)??0)))this.model.systemBoundaries.set(s.id,{id:s.id,label:s.label.text,labelType:s.label.type,type:s.type??"rect",members:[],classes:[...s.classes],styles:[...s.styles]})}materializeJson(e){for(let t of[...this.jsonDrafts].sort((t,s)=>(e.get(t.id)??0)-(e.get(s.id)??0)))this.model.jsonNodes.set(t.id,{id:t.id,value:t.value,propertyOrder:t.propertyOrder,classes:[...t.classes],styles:[]})}materializeRelationships(e,t,s){let i=new Map,n=0;for(let a of this.relationshipDrafts){let r=this.resolveEndpoint(a.source,e,t,s),o=this.resolveEndpoint(a.target,e,t,s);this.validateRelationship(a,r,o,e);let l=a.explicitId??`edge-${n++}`,c={id:l,explicitId:!!a.explicitId,source:a.source.id,target:a.target.id,type:a.type,arrowType:a.arrowType,...a.label?{label:a.label.text,labelType:a.label.type}:{},minlen:a.minlen,classes:[],styles:[],animate:!1};this.model.relationships.push(c),i.set(l,{draft:a,relationship:c})}return this.model.relationshipCounter=n,i}resolveEndpoint(e,t,s,i){if(e.classesOnReference&&!e.declaration)throw Error(`Relationship endpoint '${e.id}' uses ::: without declaring the node at ${ni(e.location)}`);let n=t.get(e.id);return n?n.kind:(s.set(e.id,{kind:"usecase",id:e.id,label:e.label,location:e.location,generated:e.generated,shape:"ellipse",classes:[]}),t.set(e.id,{kind:"usecase",location:e.location,generated:e.generated,label:e.label.text}),this.recordFirst(i,e.id,e.location.span[0]),"usecase")}reorderElements(e,t){let s=new Map(this.model.actors),i=new Map(this.model.useCases);for(let n of(this.model.actors.clear(),this.model.useCases.clear(),[...e.values()].sort((e,s)=>(t.get(e.id)??0)-(t.get(s.id)??0)))){s.has(n.id)||i.has(n.id)||this.setElementModel(n);let e=s.get(n.id)??this.model.actors.get(n.id),t=i.get(n.id)??this.model.useCases.get(n.id);e?this.model.actors.set(n.id,e):t&&this.model.useCases.set(n.id,t)}}applyMetadataAssignments(e,t,s,i){for(let n of this.metadataAssignments){let a=e.get(n.target);if(!a){let e=this.inferMetadataKind(n.metadata);throw Error(`Metadata target '${n.target}' is unresolved${e?` (metadata implies ${e})`:""} at ${ni(n.targetLocation)}`)}if("actor"===a.kind||"usecase"===a.kind)this.applyStandaloneElementMetadata(t.get(n.target),n.metadata);else if("boundary"===a.kind){let e=s.get(n.target);for(let t of n.metadata.properties)("type"!==t.key||"rect"!==t.value&&"package"!==t.value)&&this.invalidMetadata(n.target,a.kind,t),e.type=t.value}else if("edge"===a.kind){let e=i.get(n.target);if(!e)throw Error(`Metadata target '${n.target}' is not an explicit edge at ${ni(n.targetLocation)}`);for(let t of(n.statement.kind="edgeMetadata",n.statement.edges=[{id:n.target,span:n.statement.span,idSpan:n.targetLocation.span,...n.statement.metadata?{metadata:n.statement.metadata}:{}}],delete n.statement.nodes,n.metadata.properties))"animate"===t.key&&"boolean"==typeof t.value?e.relationship.animate=t.value:"animation"===t.key&&("fast"===t.value||"slow"===t.value)?(e.relationship.animation=t.value,e.relationship.animate=!0):this.invalidMetadata(n.target,a.kind,t)}else for(let e of n.metadata.properties)this.invalidMetadata(n.target,a.kind,e)}for(let{relationship:e}of i.values())e.animation&&(e.animate=!0)}applyStandaloneElementMetadata(e,t){for(let s of t.properties)"actor"===e.kind?this.applyActorProperty(e,s,!0):"business"===s.key&&"boolean"==typeof s.value?e.business=s.value:this.invalidMetadata(e.id,e.kind,s)}applyDeclarationMetadata(e,t){if(t)for(let s of t.properties)"actor"===e.kind?this.applyActorProperty(e,s,!1):"business"===s.key&&"boolean"==typeof s.value?(void 0!==e.business&&e.business!==s.value&&this.conflict(`Use case '${e.id}' has conflicting business metadata`,s.location,e.location),e.business=s.value):this.invalidMetadata(e.id,e.kind,s)}applyActorProperty(e,t,s){"type"===t.key&&("normal"===t.value||"hollow"===t.value||"awesome"===t.value)?(s||void 0===e.actorType||e.actorType===t.value||this.conflict(`Actor '${e.id}' has conflicting type metadata`,t.location,e.location),e.actorType=t.value):"icon"===t.key&&"string"==typeof t.value?(s||void 0===e.icon||e.icon===t.value||this.conflict(`Actor '${e.id}' has conflicting icon metadata`,t.location,e.location),e.icon=t.value):"business"===t.key&&"boolean"==typeof t.value?(s||void 0===e.business||e.business===t.value||this.conflict(`Actor '${e.id}' has conflicting business metadata`,t.location,e.location),e.business=t.value):this.invalidMetadata(e.id,e.kind,t)}validateAndRefreshElements(e){for(let t of e.values()){let e=t.icon?"icon":t.actorType??"normal";if("actor"===t.kind){if(t.icon&&t.actorType&&"normal"!==t.actorType)throw Error(`Actor '${t.id}' cannot combine icon with type '${t.actorType}' at ${ni(t.location)}`);if(t.business&&("icon"===e||"awesome"===e))throw Error(`Business actor '${t.id}' must use normal or hollow geometry at ${ni(t.location)}`)}else if((t.shape??"ellipse")==="rect"&&t.business)throw Error(`Rectangular use case '${t.id}' cannot be a business use case at ${ni(t.location)}`);this.setElementModel(t)}}refreshBoundaries(e,t){for(let t of e.values())t.members.length=0;for(let t of[...this.elements].sort((e,t)=>e.location.span[0]-t.location.span[0])){if(!t.parentId)continue;let s=e.get(t.parentId);if(!s)throw Error(`Parent boundary '${t.parentId}' for '${t.id}' is unresolved at ${ni(t.parentLocation??t.location)}`);s.members.includes(t.id)||s.members.push(t.id)}for(let s of t.values())if(s.parentId&&!e.has(s.parentId))throw Error(`Parent boundary '${s.parentId}' for '${s.id}' is unresolved at ${ni(s.parentLocation??s.location)}`);for(let t of e.values()){let e=this.model.systemBoundaries.get(t.id);e.type=t.type??"rect",e.members=[...t.members],e.classes=[...t.classes],e.styles=[...t.styles]}}materializeNotes(e){let t=0;for(let s of this.noteDrafts){let i=e.get(s.target);if(!i)throw Error(`Note target '${s.target}' is unresolved at ${ni(s.targetLocation)}`);"actor"!==i.kind&&"usecase"!==i.kind&&this.conflict(`Note target '${s.target}' must be an actor or use case, not ${i.kind}`,s.targetLocation,i.location);let n=`note-${t++}`;this.model.notes.set(n,{id:n,target:s.target,label:s.label.text,labelType:s.label.type})}this.model.noteCounter=t}applyClassDefinitions(){for(let e of this.classDefinitions)for(let t of e.ids)this.model.classDefs.set(t,{id:t,styles:[...e.styles]})}applyClassesAndStyles(e,t){for(let s of this.classAssignments)for(let i of s.targets)nr(this.getStylable(i.id,e,t,i.location).classes,s.classes);for(let s of this.styleAssignments)this.getStylable(s.target,e,t,s.location).styles.push(...s.styles)}getStylable(e,t,s,i){let n=t.get(e)?.kind,a="actor"===n?this.model.actors.get(e):"usecase"===n?this.model.useCases.get(e):"boundary"===n?this.model.systemBoundaries.get(e):"json"===n?this.model.jsonNodes.get(e):"edge"===n?s.get(e)?.relationship:void 0;if(!a)throw Error(`Class/style target '${e}' is unresolved or anonymous at ${ni(i)}`);return a}validateRelationship(e,t,s,i){let n=(0,m.K)(e=>"actor"===e||"usecase"===e||"json"===e,"allowed");if(n(t)||this.conflict(`Relationship source '${e.source.id}' cannot be ${t}`,e.source.location,i.get(e.source.id).location),n(s)||this.conflict(`Relationship target '${e.target.id}' cannot be ${s}`,e.target.location,i.get(e.target.id).location),("include"===e.type||"extend"===e.type)&&("usecase"!==t||"usecase"!==s))throw Error(`${e.type} relationship requires use-case endpoints at ${ni(e.location)}`);if("generalization"===e.type&&("actor"!==t&&"usecase"!==t||t!==s))throw Error(`Generalization requires actor-to-actor or use-case-to-use-case endpoints at ${ni(e.location)}`);if("association"===e.type&&("json"===t||"json"===s)&&![0,1,2].includes(e.arrowType))throw Error(`JSON relationship '${e.source.id}' to '${e.target.id}' permits only point, reversed-point, or markerless solid association at ${ni(e.location)}`)}setElementModel(e){if("actor"===e.kind){let t=e.icon?"icon":e.actorType??"normal";this.model.useCases.delete(e.id),this.model.actors.set(e.id,{id:e.id,label:e.label.text,labelType:e.label.type,type:t,...e.icon?{icon:e.icon}:{},business:e.business??!1,...e.stereotype?{stereotype:e.stereotype}:{},...e.parentId?{parentId:e.parentId}:{},classes:[...e.classes],styles:this.model.actors.get(e.id)?.styles??[]})}else this.model.actors.delete(e.id),this.model.useCases.set(e.id,{id:e.id,label:e.label.text,labelType:e.label.type,shape:e.shape??"ellipse",business:e.business??!1,...e.stereotype?{stereotype:e.stereotype}:{},...e.parentId?{parentId:e.parentId}:{},classes:[...e.classes],styles:this.model.useCases.get(e.id)?.styles??[]})}inferMetadataKind(e){let t=new Set(["actor","usecase","boundary","edge"]);for(let s of e.properties)if("icon"===s.key)t.clear(),t.add("actor");else if("animate"===s.key||"animation"===s.key)t.clear(),t.add("edge");else if("type"===s.key)t.clear(),"rect"===s.value||"package"===s.value?t.add("boundary"):("normal"===s.value||"hollow"===s.value||"awesome"===s.value)&&t.add("actor");else{if("business"!==s.key)return;t.delete("boundary"),t.delete("edge")}return 1===t.size?[...t][0]:void 0}invalidMetadata(e,t,s){throw Error(`Metadata property '${s.key}' is invalid for ${t} '${e}' at ${ni(s.location)}`)}registerUnique(e,t,s,i,n){let a=e.get(t);a&&this.conflict(`ID '${t}' is declared more than once (${a.kind} and ${s})`,i,a.location,void 0,na(a)),e.set(t,{kind:s,location:i,generated:n})}recordFirst(e,t,s){let i=e.get(t);(void 0===i||s<i)&&e.set(t,s)}conflict(e,t,s,i,n){throw Error(`${e} at ${ni(t)}${nn(i)}; previous declaration at ${ni(s)}${nn(n)}`)}},nl=iQ.getBaseCstVisitorConstructor(),nc=new class extends nl{constructor(){super(),this.builder=new no(sb),this.source="",this.anonymousEdge=0,this.anonymousNote=0,this.validateVisitor()}static{(0,m.K)(this,"UsecaseVisitor")}build(e,t){this.source=t,this.parentBoundary=void 0,this.anonymousEdge=0,this.anonymousNote=0,this.builder.reset(t),this.visit(e)}start(e){let t=this.tokens(e,"USECASE")[0],s=[];for(let t of this.nodes(e,"line"))s.push(this.visit(t));this.builder.setStatements(s),this.builder.finalize(this.tokenSpan(t))}line(e){let t=this.firstNode(e,"blankLine","commentLine","statement");return this.wrap(t,this.visit(t))}statement(e){return this.visit(this.firstNode(e,"accTitleStatement","accDescrStatement","directionStatement","actorStatement","systemBoundaryStatement","noteStatement","jsonStatement","classDefStatement","classStatement","styleStatement","metadataAssignmentStatement","entityStatement"))}lineEnd(e){}blankLine(e){return{kind:"blank",span:this.tokenSpan(this.tokens(e,"NEWLINE")[0])}}commentLine(e){return{kind:"comment",span:this.tokenSpan(this.tokens(e,"COMMENT")[0])}}accTitleStatement(e){let t=this.tokens(e,"ACC_TITLE_LINE")[0].image;return this.builder.setAccTitle(t.slice(t.indexOf(":")+1).trim()),{kind:"accTitle",span:[0,0]}}accDescrStatement(e){let t=this.tokens(e,"ACC_DESCR_LINE")[0],s=this.tokens(e,"ACC_DESCR_BLOCK")[0],i=t?t.image.slice(t.image.indexOf(":")+1).trim():s.image.slice(s.image.indexOf("{")+1,s.image.lastIndexOf("}")).trim();return this.builder.setAccDescription(i),{kind:"accDescr",span:[0,0]}}actorStatement(e){let t=this.nodes(e,"actorItem"),s=t.map(e=>this.visit(e)),i=this.nodes(e,"relationTail")[0],n=s.map((e,s)=>this.actorOccurrence(t[s],e,!0));for(let e of s)this.builder.addElement(this.actorDraft(e));if(!i)return{kind:"node",span:[0,0],nodes:n};let a=this.visit(i);a.target.explicitDeclaration&&this.builder.addElement(this.entityDraft(a.target));let r=this.relationshipDraft(s[0],a,this.nodeLocation(i));this.builder.addRelationship(r);let o=r.explicitId??`edge-${this.anonymousEdge++}`;return n.push(this.entityOccurrence(this.nodes(i.children,"entityName")[0],a.target,a.target.explicitDeclaration)),{kind:"edge",span:[0,0],nodes:n,edges:[{id:o,span:[0,0],...r.explicitIdLocation?{idSpan:r.explicitIdLocation.span}:{},...r.label?{labelSpan:r.label.span}:{}}]}}actorItem(e){let t=this.visit(this.nodes(e,"actorName")[0]),s=this.nodes(e,"metadata")[0],i=this.nodes(e,"stereotype")[0],n=this.nodes(e,"classSuffix")[0],a=n?this.visit(n):{classes:[],spans:[]};return{...t,...s?{metadata:this.visit(s)}:{},...i?{stereotype:this.visit(i)}:{},classes:a.classes,classSpans:a.spans}}actorName(e){let t=this.tokens(e,"IDENTIFIER")[0],s=this.tokens(e,"PLAIN_STRING")[0]??this.tokens(e,"MARKDOWN_STRING")[0];if(t){let s=this.nodes(e,"nodeLabel")[0],i=s?this.visit(s):this.tokenLabel(t);return{id:t.image,label:i,location:this.tokenLocation(t),generated:!1,classes:[],classSpans:[]}}let i=this.tokenLabel(s);return{id:this.generateId(i.text),label:i,location:this.tokenLocation(s),generated:!0,classes:[],classSpans:[]}}actorDeclarationOnly(e){let t=this.nodes(e,"actorItem"),s=t.map(e=>this.visit(e));for(let e of s)this.builder.addElement(this.actorDraft(e));return{kind:"node",span:[0,0],nodes:s.map((e,s)=>this.actorOccurrence(t[s],e,!0))}}entityStatement(e){let t=this.nodes(e,"entityName"),s=this.visit(t[0]),i=this.nodes(e,"relationTail")[0];if(!i)return s.explicitDeclaration=!0,s.shape??="ellipse",this.builder.addElement(this.entityDraft(s)),{kind:"node",span:[0,0],nodes:[this.entityOccurrence(t[0],s,!0)]};s.explicitDeclaration&&this.builder.addElement(this.entityDraft(s));let n=this.visit(i);n.target.explicitDeclaration&&this.builder.addElement(this.entityDraft(n.target));let a={source:this.endpoint(s),target:this.endpoint(n.target),location:this.nodeLocation(i),...n.explicitId?{explicitId:n.explicitId,explicitIdLocation:n.explicitIdLocation}:{},...n.arrow};this.builder.addRelationship(a);let r=a.explicitId??`edge-${this.anonymousEdge++}`;return{kind:"edge",span:[0,0],nodes:[this.entityOccurrence(t[0],s,s.explicitDeclaration),this.entityOccurrence(this.nodes(i.children,"entityName")[0],n.target,n.target.explicitDeclaration)],edges:[{id:r,span:[0,0],...a.explicitIdLocation?{idSpan:a.explicitIdLocation.span}:{},...a.label?{labelSpan:a.label.span}:{}}]}}entityName(e){let t=this.tokens(e,"IDENTIFIER")[0],s=this.tokens(e,"PLAIN_STRING")[0]??this.tokens(e,"MARKDOWN_STRING")[0],i=this.nodes(e,"nodeLabel")[0],n=this.nodes(e,"useCaseMetadata")[0],a=this.nodes(e,"stereotype")[0],r=this.nodes(e,"classSuffix")[0],o=r?this.visit(r):{classes:[],spans:[]};if(t){let s=i?this.visit(i):this.tokenLabel(t),r=i?this.tokens(e,"LBRACKET").length?"rect":"ellipse":void 0;return{id:t.image,label:s,location:this.tokenLocation(t),generated:!1,...r?{shape:r}:{},...n?{metadata:this.visit(n)}:{},...a?{stereotype:this.visit(a)}:{},classes:o.classes,classSpans:o.spans,explicitDeclaration:!!(r||n||a)}}let l=this.tokenLabel(s);return{id:this.generateId(l.text),label:l,location:this.tokenLocation(s),generated:!0,...n?{metadata:this.visit(n)}:{},...a?{stereotype:this.visit(a)}:{},classes:o.classes,classSpans:o.spans,explicitDeclaration:!!(n||a)}}nodeLabel(e){let t=this.allTokens(e);if(1===t.length&&("PLAIN_STRING"===t[0].tokenType.name||"MARKDOWN_STRING"===t[0].tokenType.name))return this.tokenLabel(t[0]);let s=[t[0].startOffset,(t.at(-1).endOffset??t.at(-1).startOffset)+1];return{text:this.source.slice(s[0],s[1]),type:"text",span:s}}useCaseMetadata(e){return this.visit(this.nodes(e,"metadata")[0])}relationTail(e){let t=this.tokens(e,"IDENTIFIER")[0];return{...t?{explicitId:t.image,explicitIdLocation:this.tokenLocation(t)}:{},arrow:this.visit(this.nodes(e,"arrow")[0]),target:this.visit(this.nodes(e,"entityName")[0])}}arrow(e){return this.visit(this.firstNode(e,"semanticRelation","forwardSolidOperator","backwardSolidOperator","markerlessSolidOperator","forwardCircleOperator","backwardCircleOperator","forwardCrossOperator","backwardCrossOperator"))}edgeLabel(e){return this.nodeLabel(e)}semanticRelation(e){if(this.tokens(e,"GENERALIZATION").length)return{type:"generalization",arrowType:t6.SOLID_ARROW,minlen:1};let t=this.tokens(e,"INCLUDE").length?"include":"extend",s=this.tokens(e,"include"===t?"INCLUDE":"EXTEND")[0];return{type:t,arrowType:t6.SOLID_ARROW,label:{text:t,type:"text",span:this.tokenSpan(s)},minlen:1}}metadata(e){return{properties:this.nodes(e,"metadataProperty").map(e=>this.visit(e)),location:this.ctxLocation(e)}}metadataProperty(e){let t=this.allTokens(e).filter(e=>"COLON"!==e.tokenType.name),s=t[0],i=t[1],n="TRUE"===i.tokenType.name||"FALSE"!==i.tokenType.name&&this.decodePlain(i),a=[s.startOffset,(i.endOffset??i.startOffset)+1];return{key:this.decodePlain(s),value:n,span:a,keySpan:this.contentSpan(s),valueSpan:this.contentSpan(i),location:this.tokenLocation(s)}}metadataSeparator(e){}systemBoundaryStatement(e){let t=this.visit(this.nodes(e,"systemBoundaryName")[0]),s=this.nodes(e,"classSuffix")[0],i=s?this.visit(s):{classes:[],spans:[]};t.classes=i.classes,this.builder.addBoundary(t);let n=this.parentBoundary;this.parentBoundary={id:t.id,location:t.location};let a=this.nodes(e,"systemBoundaryContent")[0],r=a?this.visit(a):[];this.parentBoundary=n;let o=this.tokens(e,"END")[0],l=this.nodes(e,"metadata")[0],c=l?this.visit(l):void 0,h={kind:"group",span:[0,0],group:t.id,idSpan:t.location.span,titleSpan:t.label.span,endSpan:this.tokenSpan(o),classSpans:i.spans,...c?{metadata:c.properties.map(({key:e,span:t,keySpan:s,valueSpan:i})=>({key:e,span:t,keySpan:s,valueSpan:i}))}:{},...r.length?{children:r}:{}};return c&&this.builder.addMetadataAssignment(t.id,t.location,c,h),h}systemBoundaryName(e){let t=this.tokens(e,"IDENTIFIER")[0];if(t){let s=this.nodes(e,"nodeLabel")[0];return{id:t.image,label:s?this.visit(s):this.tokenLabel(t),location:this.tokenLocation(t),generated:!1,classes:[]}}let s=this.tokens(e,"PLAIN_STRING")[0]??this.tokens(e,"MARKDOWN_STRING")[0],i=this.tokenLabel(s);return{id:this.generateId(i.text),label:i,location:this.tokenLocation(s),generated:!0,classes:[]}}systemBoundaryContent(e){return[...this.nodes(e,"blankLine"),...this.nodes(e,"commentLine"),...this.nodes(e,"boundaryElement")].sort((e,t)=>(e.location?.startOffset??0)-(t.location?.startOffset??0)).map(e=>this.wrap(e,this.visit(e)))}boundaryElement(e){let t=this.nodes(e,"actorDeclarationOnly")[0];if(t)return this.visit(t);let s=this.nodes(e,"entityName")[0],i=this.visit(s);return i.explicitDeclaration=!0,i.shape??="ellipse",this.builder.addElement(this.entityDraft(i)),{kind:"node",span:[0,0],nodes:[this.entityOccurrence(s,i,!0)]}}metadataAssignmentStatement(e){let t=this.visit(this.nodes(e,"metadataAssignmentTarget")[0]),s=this.visit(this.nodes(e,"metadata")[0]),i={kind:"metadata",span:[0,0],nodes:[{id:t.id,span:t.location.span,idSpan:t.location.span}],metadata:s.properties.map(({key:e,span:t,keySpan:s,valueSpan:i})=>({key:e,span:t,keySpan:s,valueSpan:i}))};return this.builder.addMetadataAssignment(t.id,t.location,s,i),i}metadataAssignmentTarget(e){let t=this.allTokens(e)[0],s=this.tokenLabel(t);return{id:"IDENTIFIER"===t.tokenType.name?t.image:this.generateId(s.text),location:this.tokenLocation(t)}}noteStatement(e){let t=this.tokens(e,"IDENTIFIER")[0],s=this.visit(this.nodes(e,"nodeLabel")[0]);return this.builder.addNote({target:t.image,targetLocation:this.tokenLocation(t),label:s,location:this.ctxLocation(e)}),{kind:"note",span:[0,0],ref:`note-${this.anonymousNote++}`,refSpan:s.span,nodes:[{id:t.image,span:this.tokenSpan(t),idSpan:this.tokenSpan(t)}]}}stereotype(e){let t=this.tokens(e,"STEREOTYPE_TEXT")[0];return{value:t.image.trim(),span:this.tokenSpan(t)}}classSuffix(e){let t=this.tokens(e,"IDENTIFIER");return{classes:t.map(e=>e.image),spans:t.map(e=>this.tokenSpan(e))}}jsonStatement(e){let t=this.tokens(e,"JSON_DECLARATION_START")[0],s=this.tokens(e,"JSON_OBJECT_LITERAL")[0],i=/^json[\t ]+(\w+)/.exec(t.image),n=i[1],a=i[0].length-n.length,r={span:[t.startOffset+a,t.startOffset+a+n.length],line:t.startLine??1,column:(t.startColumn??1)+a},o=i4(s.image,s.startLine??1,s.startColumn??1),l=this.nodes(e,"classSuffix")[0],c=l?this.visit(l):{classes:[],spans:[]},h={id:n,value:o.value,propertyOrder:o.propertyOrder,location:r,classes:c.classes};return this.builder.addJson(h),{kind:"json",span:[0,0],nodes:[{id:n,span:r.span,idSpan:r.span,defines:!0,classSpans:c.spans}],classSpans:c.spans}}directionStatement(e){let t=this.allTokens(e).find(e=>["TD","TB","BT","RL","LR"].includes(e.tokenType.name));return this.builder.setDirection(t.image),{kind:"direction",span:[0,0]}}classDefStatement(e){let t=this.tokens(e,"IDENTIFIER"),s=this.visit(this.nodes(e,"styles")[0]);return this.builder.addClassDef(t.map(e=>e.image),s),{kind:"classDef",span:[0,0],ref:t[0].image,refSpan:this.tokenSpan(t[0])}}classStatement(e){let t=this.tokens(e,"IDENTIFIER"),s=1;for(;s<t.length&&this.source.slice((t[s-1].endOffset??t[s-1].startOffset)+1,t[s].startOffset).includes(",");s++);let i=t.slice(0,s).map(e=>({id:e.image,location:this.tokenLocation(e)})),n=t.slice(s).map(e=>e.image);return this.builder.addClassAssignment(i,n),{kind:"classAssign",span:[0,0],ref:n[0],refSpan:this.tokenSpan(t[s]),nodes:i.map(({id:e,location:t})=>({id:e,span:t.span,idSpan:t.span}))}}styleStatement(e){let t=this.tokens(e,"IDENTIFIER")[0],s=this.visit(this.nodes(e,"styles")[0]);return this.builder.addStyleAssignment(t.image,this.tokenLocation(t),s),{kind:"style",span:[0,0],nodes:[{id:t.image,span:this.tokenSpan(t),idSpan:this.tokenSpan(t)}]}}styles(e){return this.nodes(e,"styleValue").map(e=>this.visit(e))}styleValue(e){let t=this.allTokens(e),s=[t[0].startOffset,(t.at(-1).endOffset??t.at(-1).startOffset)+1];return this.source.slice(s[0],s[1]).replaceAll("\\,",",")}styleComponent(e){return this.allTokens(e).map(e=>e.image).join("")}forwardSolidOperator(e){let t=this.tokens(e,"FORWARD_SOLID")[0];return{type:"association",arrowType:t6.SOLID_ARROW,minlen:this.solidMinlen(t)}}backwardSolidOperator(e){let t=this.tokens(e,"BACKWARD_SOLID")[0],s=this.nodes(e,"edgeLabel")[0],i=s?this.tokens(e,"MARKERLESS_SOLID").at(-1):t;return{type:"association",arrowType:t6.BACK_ARROW,minlen:this.solidMinlen(i),...s?{label:this.visit(s)}:{}}}markerlessSolidOperator(e){let t=this.nodes(e,"edgeLabel")[0],s=this.allTokens(e);if(!t)return{type:"association",arrowType:t6.LINE_SOLID,minlen:this.solidMinlen(this.tokens(e,"MARKERLESS_SOLID")[0])};let i=s.at(-1),n="FORWARD_SOLID"===i.tokenType.name?t6.SOLID_ARROW:"FORWARD_CIRCLE"===i.tokenType.name?t6.CIRCLE_ARROW:"FORWARD_CROSS"===i.tokenType.name?t6.CROSS_ARROW:t6.LINE_SOLID;return{type:"association",arrowType:n,label:this.visit(t),minlen:n===t6.SOLID_ARROW||n===t6.LINE_SOLID?this.solidMinlen(i):1}}forwardCircleOperator(e){return{type:"association",arrowType:t6.CIRCLE_ARROW,minlen:1}}backwardCircleOperator(e){let t=this.nodes(e,"edgeLabel")[0];return{type:"association",arrowType:t6.CIRCLE_ARROW_REVERSED,minlen:1,...t?{label:this.visit(t)}:{}}}forwardCrossOperator(e){return{type:"association",arrowType:t6.CROSS_ARROW,minlen:1}}backwardCrossOperator(e){let t=this.nodes(e,"edgeLabel")[0];return{type:"association",arrowType:t6.CROSS_ARROW_REVERSED,minlen:1,...t?{label:this.visit(t)}:{}}}actorDraft(e){return{id:e.id,kind:"actor",label:e.label,location:e.location,generated:e.generated,...this.parentBoundary?{parentId:this.parentBoundary.id,parentLocation:this.parentBoundary.location}:{},...e.metadata?{metadata:e.metadata}:{},...e.stereotype?{stereotype:e.stereotype.value,stereotypeSpan:e.stereotype.span}:{},classes:e.classes}}entityDraft(e){return{id:e.id,kind:"usecase",label:e.label,location:e.location,generated:e.generated,...this.parentBoundary?{parentId:this.parentBoundary.id,parentLocation:this.parentBoundary.location}:{},...e.shape?{shape:e.shape}:{},...e.metadata?{metadata:e.metadata}:{},...e.stereotype?{stereotype:e.stereotype.value,stereotypeSpan:e.stereotype.span}:{},classes:e.classes}}endpoint(e,t=e.explicitDeclaration??!0){return{id:e.id,label:e.label,location:e.location,generated:e.generated,declaration:t,classesOnReference:e.classes.length>0}}relationshipDraft(e,t,s){return{source:this.endpoint(e,!0),target:this.endpoint(t.target),location:s,...t.explicitId?{explicitId:t.explicitId,explicitIdLocation:t.explicitIdLocation}:{},...t.arrow}}actorOccurrence(e,t,s){return{id:t.id,span:this.nodeSpan(e),idSpan:t.location.span,labelSpan:t.label.span,...s?{defines:!0}:{},...t.stereotype?{stereotypeSpan:t.stereotype.span}:{},...t.metadata?{metadata:t.metadata.properties.map(({key:e,span:t,keySpan:s,valueSpan:i})=>({key:e,span:t,keySpan:s,valueSpan:i}))}:{},...t.classSpans.length?{classSpans:t.classSpans}:{}}}entityOccurrence(e,t,s){return this.actorOccurrence(e,t,s)}wrap(e,t){if("blank"===t.kind||"comment"===t.kind)return t;for(let s of(t.span=this.nodeSpan(e),t.edges??[]))s.span=t.span;return t}tokenLabel(e){let t="MARKDOWN_STRING"===e.tokenType.name?"markdown":"text",s="markdown"===t?2:+("PLAIN_STRING"===e.tokenType.name),i=this.tokenSpan(e,s);return{text:this.source.slice(i[0],i[1]),type:t,span:i}}decodePlain(e){return"PLAIN_STRING"===e.tokenType.name?e.image.slice(1,-1):e.image}contentSpan(e){return this.tokenSpan(e,"PLAIN_STRING"===e.tokenType.name?1:2*("MARKDOWN_STRING"===e.tokenType.name))}generateId(e){return e.replace(/\W/g,"_")}solidMinlen(e){return Math.max(1,(e.image.match(/-/g)?.length??2)-1)}nodeLocation(e){let t=this.allTokens(e.children)[0];return{span:this.nodeSpan(e),line:t.startLine??1,column:t.startColumn??1}}ctxLocation(e){let t=this.allTokens(e).filter(e=>"NEWLINE"!==e.tokenType.name&&"EOF"!==e.tokenType.name),s=t[0],i=t.at(-1);return{span:[s.startOffset,Math.min(this.source.length,(i.endOffset??i.startOffset+i.image.length-1)+1)],line:s.startLine??1,column:s.startColumn??1}}tokenLocation(e){let t="PLAIN_STRING"===e.tokenType.name?1:2*("MARKDOWN_STRING"===e.tokenType.name);return{span:this.tokenSpan(e,t),line:e.startLine??1,column:(e.startColumn??1)+t}}nodeSpan(e){let t=this.allTokens(e.children).filter(e=>"NEWLINE"!==e.tokenType.name&&"EOF"!==e.tokenType.name),s=t[0],i=t.at(-1);if(!s||!i)throw Error("Usecase CST node has no source token");return[s.startOffset,Math.min(this.source.length,(i.endOffset??i.startOffset+i.image.length-1)+1)]}tokenSpan(e,t=0){return[e.startOffset+t,Math.min(this.source.length,(e.endOffset??e.startOffset+e.image.length-1)+1-t)]}nodes(e,t){return(e[t]??[]).filter(e=>"children"in e)}tokens(e,t){return(e[t]??[]).filter(e=>"tokenTypeIdx"in e)}firstNode(e,...t){for(let s of t){let t=this.nodes(e,s)[0];if(t)return t}throw Error(`Usecase CST is missing one of: ${t.join(", ")}`)}allTokens(e){let t=[];for(let s of Object.values(e))for(let e of s)"tokenTypeIdx"in e?t.push(e):t.push(...this.allTokens(e.children));return t.sort((e,t)=>e.startOffset-t.startOffset)}},nh={parse:(0,m.K)(async e=>{sb.clear(),iQ.input=[];try{t5({diagramType:"usecase",lexer:iq,parser:iQ,entry:(0,m.K)(()=>iQ.start(),"entry"),visit:(0,m.K)(t=>nc.build(t,e),"visit")},e)}catch(s){sb.clear();let t=iQ.errors[0];if(t){let{token:i}=t,n=t2(i.startOffset)?i.startOffset:e.length,a=t2(i.endOffset)?i.endOffset+1:n,r=t2(i.startLine)?i.startLine:e.slice(0,n).split(/\r\n|\r|\n/).length,o=Math.max(e.lastIndexOf("\n",n-1),e.lastIndexOf("\r",n-1)),l=t2(i.startColumn)?i.startColumn:n-o,c=s instanceof Error?s.message:String(s);throw Error(`${c} at line ${r}, column ${l} [${n},${a})`)}throw s}},"parse")},nd=["point","circle","cross","extension"],nu={usecaseActor:!0,usecaseActorHollow:!0,usecaseActorAwesome:!0,usecaseActorIcon:!0},np=(0,m.K)((e,t)=>{let[s,i]=[e,t].map(e=>e.replace(/[^\w-]+/g,"_").replace(/^_+|_+$/g,"")||"element");return`usecase-${s}-${i}`},"usecaseDomId"),nf=(0,m.K)(e=>`usecase-${e.replace(/[^\w-]+/g,"_").replace(/^_+|_+$/g,"")||"element"}`,"usecaseNodeDomId"),nm=(0,m.K)((e,t)=>"markdown"!==t?e:(0,h.O6)(e).map(e=>e.map(e=>e.content).join(" ")).join("\n"),"getAccessibleLabel"),nE=(0,m.K)(e=>{let t=nm(e.label??e.id,e.labelType);if(nu[e.shape]){let s=e.actorType&&"normal"!==e.actorType?`${e.actorType} `:"",i=e.business?"business ":"",n=e.stereotype?`, stereotype ${e.stereotype}`:"";return`${i}${s}actor ${t}${n}`}if("note"===e.shape)return`Note for ${e.noteTargetLabel??e.noteTarget??""}: ${t}`;if("usecaseJsonTable"===e.shape){let s=(e.jsonRows??[]).map(e=>`${e.accessibleKey}: ${e.value}`).join("; ");return s?`${t}: ${s}`:t}let s=e.stereotype?`, stereotype ${e.stereotype}`:"";return`${e.business?"business ":""}use case ${t}${s}`},"getUsecaseNodeAccessibleName"),nT=(0,m.K)(e=>`${e.boundaryType} system boundary ${nm(e.label??e.id,e.labelType)}`,"getUsecaseBoundaryAccessibleName"),ng=(0,m.K)(e=>{if("note"===e.relationshipType)return"";let t="association"===e.relationshipType&&e.label?`association ${nm(e.label,e.labelType)}`:e.relationshipType;return`${t} from ${e.sourceLabel} to ${e.targetLabel}`},"getUsecaseEdgeAccessibleName"),ny=(0,m.K)(e=>e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">"),"escapePlainLabel"),nA=(0,m.K)(e=>e.replace(/([*[\\\]_`])/g,"\\$1"),"escapeMarkdownMarkers"),nS=(0,m.K)((e,t)=>{for(let s of(e.diagramId=t,e.markers=[...nd],e.nodes))if(s.domId=nf(s.id),void 0!==s.label&&"text"===s.labelType&&(s.label=ny(s.label)),s.stereotype&&(s.stereotype=ny(s.stereotype)),s.isGroup||"usecaseJsonTable"!==s.shape||(s.jsonRows=s.jsonRows?.map(e=>({...e,key:ny(e.key),value:ny(e.value)}))),!s.isGroup&&("usecaseEllipse"===s.shape||"rect"===s.shape)&&s.stereotype){let e=s.label??ny(s.id);s.label=`\xab${nA(s.stereotype)}\xbb<br/>${"text"===s.labelType?nA(e):e}`,s.labelType="markdown",s.hasFoldedStereotype=!0,delete s.stereotype}for(let t of e.edges)void 0!==t.label&&"text"===t.labelType&&(t.label=ny(t.label));return e},"prepareUsecaseLayoutData"),nL=(0,m.K)((e,t,s)=>{for(let i of t.nodes){let n="string"==typeof i.domId?i.domId:np(t.diagramId,i.id),a=e.select(`#${n}`),r=i.isGroup?"boundary":nu[i.shape]?"actor":"note"===i.shape?"note":"usecaseJsonTable"===i.shape?"json":"usecase",o=s.nodes.get(i.id)??i.id;if(a.attr("data-usecase-id",i.id).attr("data-usecase-kind",r).attr("role","img").attr("aria-label",o),!i.isGroup&&("usecaseEllipse"===i.shape||"rect"===i.shape)&&"hasFoldedStereotype"in i&&!0===i.hasFoldedStereotype){let e=a.node(),t=e?.querySelector(".nodeLabel"),s=t?.querySelector("p")??t,i=s?.firstChild;if(s&&i?.nodeType===3){let e=s.ownerDocument.createElement("span");e.className="usecase-stereotype",s.insertBefore(e,i),e.appendChild(i)}else e?.querySelector(".label tspan tspan, .label tspan")?.classList.add("usecase-stereotype")}}let i=new Map(t.edges.map(e=>[e.id,e]));e.selectAll('path[data-et="edge"]').each(function(){let e=i.get(this.getAttribute("data-id")??"");if(!e)return;let n=(0,t1.Ltv)(this);n.attr("id",np(t.diagramId,e.id)).attr("data-usecase-id",e.id).attr("data-usecase-kind",e.internal?"note-connector":"relationship"),e.internal?n.attr("aria-hidden","true"):n.attr("role","img").attr("aria-label",s.edges.get(e.id)??e.id)})},"annotateUsecaseElements"),nO=(0,m.K)((e,t)=>{e.style("--mermaid-usecase-actor-font-size",`${t.actorFontSize}px`).style("--mermaid-usecase-actor-font-family",t.actorFontFamily).style("--mermaid-usecase-actor-font-weight",t.actorFontWeight).style("--mermaid-usecase-font-size",`${t.usecaseFontSize}px`).style("--mermaid-usecase-font-family",t.usecaseFontFamily).style("--mermaid-usecase-font-weight",t.usecaseFontWeight)},"applyUsecaseFonts"),nR=(0,m.K)(async(e,t,s,i)=>{f.R.info("Drawing usecase diagram (unified)",t);let{layout:n}=(0,p.D7)(),a=i.db,r=a.getData(),h=new Map(r.nodes.map(e=>[e.id,nm(e.label??e.id,e.labelType)])),d={nodes:new Map(r.nodes.map(e=>[e.id,e.isGroup?nT(e):nE("note"===e.shape?{...e,noteTargetLabel:h.get(e.noteTarget??"")}:e)])),edges:new Map(r.edges.map(e=>[e.id,ng({...e,sourceLabel:h.get(e.source)??e.sourceLabel,targetLabel:h.get(e.target)??e.targetLabel})]))},m=(0,o.A)(t,r.config.securityLevel);r.layoutAlgorithm=(0,c.q7)(n),nS(r,t),nO(m,r),await (0,c.XX)(r,m),nL(m,r,d);let E=r.diagramPadding;u._K.insertTitle(m,"usecaseDiagramTitleText",0,a.getDiagramTitle?.()??""),(0,l.P)(m,E,"usecaseDiagram",r.useMaxWidth),nO(m,r)},"draw"),nk=(0,m.K)(e=>({actorBkg:e.usecaseActorBkg??e.actorBkg??e.mainBkg,actorBorder:e.usecaseActorBorder??e.actorBorder??e.primaryColor,bkg:e.usecaseBkg??e.mainBkg,border:e.usecaseBorder??e.nodeBorder??e.primaryColor,boundaryBkg:e.usecaseBoundaryBkg??e.clusterBkg,boundaryBorder:e.usecaseBoundaryBorder??e.clusterBorder,includeLine:e.usecaseIncludeLine??e.lineColor,extendLine:e.usecaseExtendLine??e.lineColor}),"roleColors"),nI=(0,m.K)(e=>{let{theme:t,bkgColorArray:s,borderColorArray:i}=e;if(!(0,d.P1)(t,i))return"";let n=(0,p.zj)().usecase?.colorScheme==="rotate",a=(0,d.rq)(e.look),r="handDrawn"===a,o=(0,d.Ic)(s),l="";for(let e=0;e<(0,d.Hu)(i);e++){let t=i[e],c=o?`fill: ${s[e%s.length]};`:"",h=`[data-look="${a}"][data-color-id="color-${e}"]`;l+=`
|
|
57
|
+
${e.join("\n-------------------------------\n")}`)})}constructor(e,t){if(this.definitionErrors=[],this.selfAnalysisDone=!1,this.initErrorHandler(t),this.initLexerAdapter(),this.initLooksAhead(t),this.initRecognizerEngine(e,t),this.initRecoverable(t),this.initTreeBuilder(t),this.initGastRecorder(t),this.initPerformanceTracer(t),Object.hasOwn(t,"ignoredIssues"))throw Error("The <ignoredIssues> IParserConfig property has been deprecated.\n Please use the <IGNORE_AMBIGUITIES> flag on the relevant DSL method instead.\n See: https://chevrotain.io/docs/guide/resolving_grammar_errors.html#IGNORING_AMBIGUITIES\n For further details.");this.skipValidations=Object.hasOwn(t,"skipValidations")?t.skipValidations:tJ.skipValidations}}tQ.DEFER_DEFINITION_ERRORS_HANDLING=!1,function(e,t){t.forEach(t=>{let s=t.prototype;Object.getOwnPropertyNames(s).forEach(i=>{if("constructor"===i)return;let n=Object.getOwnPropertyDescriptor(s,i);n&&(n.get||n.set)?Object.defineProperty(e.prototype,i,n):e.prototype[i]=t.prototype[i]})})}(tQ,[tk,tb,tw,tP,t$,tD,tK,tW,tX]);class t0 extends tQ{constructor(e,t=tJ){let s=Object.assign({},t);s.outputCst=!0,super(e,s)}}var t1=s(39433),t2=(0,m.K)(e=>void 0!==e&&e>=0,"isKnownLocation");function t6(e,t){let s=e.lexer.tokenize(t);if(s.errors.length>0){let i=s.errors[0],n=t2(i.offset)?i.offset:t.length,a=n+(t2(i.length)?i.length:0);throw Error(`Error lexing ${e.diagramType} diagram: ${i.message} at line ${i.line??1}, column ${i.column??1} [${n},${a})`)}e.parser.input=s.tokens;let i=e.entry();if(e.parser.errors.length>0)throw Error(`Error parsing ${e.diagramType} diagram: ${e.parser.errors[0].message}`);e.visit(i)}(0,m.K)(t6,"runChevrotainParse");var t3={SOLID_ARROW:0,BACK_ARROW:1,LINE_SOLID:2,CIRCLE_ARROW:3,CROSS_ARROW:4,CIRCLE_ARROW_REVERSED:5,CROSS_ARROW_REVERSED:6},t5=p.UI.usecase,t4=(0,m.K)(()=>({actors:new Map,useCases:new Map,systemBoundaries:new Map,relationships:[],notes:new Map,jsonNodes:new Map,classDefs:new Map,symbols:new Map,direction:"LR",relationshipCounter:0,noteCounter:0,accTitle:"",accDescription:"",ast:void 0,config:structuredClone(t5)}),"createModel"),t8=(0,m.K)(e=>{if(!(e.actors instanceof Map)||!(e.useCases instanceof Map)||!(e.systemBoundaries instanceof Map)||!Array.isArray(e.relationships)||!(e.notes instanceof Map)||!(e.jsonNodes instanceof Map)||!(e.classDefs instanceof Map)||!(e.symbols instanceof Map)||!["TB","TD","BT","RL","LR"].includes(e.direction)||!Number.isSafeInteger(e.relationshipCounter)||e.relationshipCounter<0||!Number.isSafeInteger(e.noteCounter)||e.noteCounter<0||"string"!=typeof e.accTitle||"string"!=typeof e.accDescription||!e.config)throw Error("Cannot commit an incomplete usecase model")},"assertCompleteModel"),t9=t4(),t7=(0,m.K)(()=>structuredClone(t9.config),"getConfig"),se=(0,m.K)(()=>t9.ast,"getAST"),st=(0,m.K)(e=>{let t=structuredClone(e);t8(t);let s=(0,p.iN)(),i=(0,p.m7)();try{(0,p.SV)(t.accTitle),(0,p.EI)(t.accDescription),t9=t}catch(e){throw(0,p.SV)(s),(0,p.EI)(i),e}},"commit"),ss=(0,m.K)(()=>{t9=t4(),(0,p.IU)()},"clear"),si=(0,m.K)(()=>t9.actors,"getActors"),sn=(0,m.K)(e=>t9.actors.get(e),"getActor"),sa=(0,m.K)(()=>t9.useCases,"getUseCases"),sr=(0,m.K)(e=>t9.useCases.get(e),"getUseCase"),so=(0,m.K)(()=>t9.systemBoundaries,"getSystemBoundaries"),sl=(0,m.K)(e=>t9.systemBoundaries.get(e),"getSystemBoundary"),sc=(0,m.K)(()=>t9.relationships,"getRelationships"),sh=(0,m.K)(()=>t9.notes,"getNotes"),sd=(0,m.K)(e=>t9.notes.get(e),"getNote"),su=(0,m.K)(()=>t9.jsonNodes,"getJsonNodes"),sp=(0,m.K)(e=>t9.jsonNodes.get(e),"getJsonNode"),sf=(0,m.K)(()=>t9.classDefs,"getClassDefs"),sm=(0,m.K)(e=>t9.classDefs.get(e),"getClassDef"),sE=(0,m.K)(()=>t9.direction,"getDirection"),sT=(0,m.K)(e=>{let t=new Map;for(let s of["default",...e]){let e=t9.classDefs.get(s);if(e)for(let s of e.styles){let e=s.trim(),i=e.indexOf(":"),n=(-1===i?e:e.slice(0,i)).trim();n&&t.set(n,e)}}return[...t.values()]},"getCompiledStyles"),sg=(0,m.K)(e=>e.replaceAll("~","~0").replaceAll("/","~1"),"escapeJsonPointerPart"),sy=(0,m.K)(e=>"string"==typeof e?e:null===e?"null":String(e),"displayJsonScalar"),sA=(0,m.K)((e,t,s=e=>e)=>{let i=[],n=(0,m.K)((e,t,n)=>{i.push({key:s(e),accessibleKey:s(t),value:s(n)})},"append"),a=(0,m.K)((e,s,i)=>{if(Array.isArray(e)){if(0===e.length)return void n(s,s,"[]");if(e.every(e=>null===e||["string","number","boolean"].includes(typeof e))){for(let[t,i]of e.entries())n(0===t?s:"",s,sy(i));return}for(let[t,n]of e.entries())a(n,`${s}[${t}]`,`${i}/${t}`);return}if(null!==e&&"object"==typeof e){let r=t[i]??Object.keys(e);if(0===r.length)return void n(s,s,"{}");for(let t of r){let n=s?`${s}.${t}`:t;a(e[t],n,`${i}/${sg(t)}`)}return}n(s,s,sy(e))},"visit");return a(e,"",""),i},"flattenJsonRows"),sS=(0,m.K)(e=>{switch(e.type){case"hollow":return"usecaseActorHollow";case"awesome":return"usecaseActorAwesome";case"icon":return"usecaseActorIcon";case"normal":return"usecaseActor"}},"actorShape"),sL=(0,m.K)(e=>"ellipse"===e.shape?e.business?"usecaseBusiness":"usecaseEllipse":e.shape,"useCaseShape"),sO=(0,m.K)(e=>{switch(e){case t3.SOLID_ARROW:return{arrowTypeStart:"none",arrowTypeEnd:"arrow_point"};case t3.BACK_ARROW:return{arrowTypeStart:"arrow_point",arrowTypeEnd:"none"};case t3.CIRCLE_ARROW:return{arrowTypeStart:"none",arrowTypeEnd:"arrow_circle"};case t3.CROSS_ARROW:return{arrowTypeStart:"none",arrowTypeEnd:"arrow_cross"};case t3.CIRCLE_ARROW_REVERSED:return{arrowTypeStart:"arrow_circle",arrowTypeEnd:"none"};case t3.CROSS_ARROW_REVERSED:return{arrowTypeStart:"arrow_cross",arrowTypeEnd:"none"};case t3.LINE_SOLID:return{arrowTypeStart:"none",arrowTypeEnd:"none"}}},"associationMarkers"),sR=(0,m.K)(e=>{switch(e.type){case"include":case"extend":return{arrowTypeStart:"none",arrowTypeEnd:"arrow_point",pattern:"dotted",label:e.type,labelType:"text"};case"generalization":return{arrowTypeStart:"none",arrowTypeEnd:"extension",pattern:"solid"};case"association":return{...sO(e.arrowType),pattern:"solid",...e.label?{label:e.label}:{},...e.labelType?{labelType:e.labelType}:{}}}},"relationshipVisuals"),sk=(0,m.K)(e=>e.animate||e.animation?[`edge-animation-${e.animation??"fast"}`]:[],"animationClasses"),sI=(0,m.K)((...e)=>e.filter(e=>!!e).join(" "),"classNames"),sN=(0,m.K)(()=>{let e=(0,p.D7)(),t={...t9.config,...e.usecase},s=(0,m.K)(t=>(0,p.jZ)(t,e),"sanitize"),i=(0,m.K)(e=>s(t9.actors.get(e)?.label??t9.useCases.get(e)?.label??t9.jsonNodes.get(e)?.id??t9.notes.get(e)?.label??e),"endpointLabel"),n=[],a=[],r=0,o=0;for(let t of t9.actors.values())n.push({id:t.id,label:s(t.label),labelType:t.labelType,shape:sS(t),isGroup:!1,padding:10,look:e.look,colorIndex:r++,cssClasses:sI("default","usecase-actor",`usecase-actor-${t.type}`,t.business&&"usecase-business",...t.classes),cssStyles:[...t.styles],cssCompiledStyles:sT(t.classes),actorType:t.type,business:t.business,...t.icon?{icon:t.icon}:{},...t.stereotype?{stereotype:s(t.stereotype)}:{},...t.parentId?{parentId:t.parentId}:{}});for(let t of t9.useCases.values())n.push({id:t.id,label:s(t.label),labelType:t.labelType,shape:sL(t),isGroup:!1,padding:"ellipse"===t.shape?20:10,look:e.look,colorIndex:r++,cssClasses:sI("default","usecase-element",`usecase-${t.shape}`,t.business&&"usecase-business",...t.classes),cssStyles:[...t.styles],cssCompiledStyles:sT(t.classes),business:t.business,...t.stereotype?{stereotype:s(t.stereotype)}:{},...t.parentId?{parentId:t.parentId}:{}});for(let t of t9.notes.values())n.push({id:t.id,label:s(t.label),labelType:t.labelType,shape:"note",isGroup:!1,padding:10,look:e.look,cssClasses:"default usecase-note",cssStyles:[],cssCompiledStyles:sT([]),noteTarget:t.target,noteTargetLabel:s(t9.actors.get(t.target)?.label??t9.useCases.get(t.target)?.label??t9.jsonNodes.get(t.target)?.id??t.target)});for(let t of t9.jsonNodes.values())n.push({id:t.id,label:s(t.id),labelType:"text",shape:"usecaseJsonTable",isGroup:!1,padding:10,look:e.look,cssClasses:sI("default","usecase-json-table",...t.classes),cssStyles:[...t.styles],cssCompiledStyles:sT(t.classes),jsonRows:sA(t.value,t.propertyOrder,s)});for(let t of t9.systemBoundaries.values())n.push({id:t.id,label:s(t.label),labelType:t.labelType,shape:"usecaseSystemBoundary",isGroup:!0,padding:20,look:e.look,colorIndex:o++,cssClasses:sI("default","system-boundary",`system-boundary-${t.type}`,...t.classes),cssStyles:[...t.styles],cssCompiledStyles:sT(t.classes),boundaryType:t.type});for(let t of t9.relationships){let{label:n,...r}=sR(t);a.push({id:t.id,start:t.source,end:t.target,source:t.source,target:t.target,sourceLabel:i(t.source),targetLabel:i(t.target),type:"edge",relationshipType:t.type,internal:!1,...r,...void 0!==n?{label:s(n)}:{},labelpos:"c",classes:sI("default","relationship",`relationship-${t.type}`,...t.classes,...sk(t)),style:[...t.styles],cssCompiledStyles:sT(t.classes),animate:t.animate,...t.animation?{animation:t.animation}:{},look:e.look,thickness:"normal",minlen:t.minlen,isUserDefinedId:t.explicitId})}for(let t of t9.notes.values())a.push({id:`${t.id}-edge`,start:t.id,end:t.target,source:t.id,target:t.target,type:"edge",relationshipType:"note",sourceLabel:i(t.id),targetLabel:i(t.target),internal:!0,pattern:"dotted",arrowTypeStart:"none",arrowTypeEnd:"none",labelpos:"c",classes:"default relationship relationship-note",style:[],cssCompiledStyles:sT([]),animate:!1,look:e.look,thickness:"normal",minlen:1,isUserDefinedId:!1});for(let e of n)e.wrappingWidth??=t.wrappingWidth,e.isGroup||e.shape.startsWith("usecaseActor")||(e.minWidth??=t.minNodeWidth),("usecaseEllipse"===e.shape||"usecaseBusiness"===e.shape)&&(e.spreadPorts=!0);return{nodes:n,edges:a,config:e,type:"usecase",layoutAlgorithm:"dagre",direction:sE(),nodeSpacing:t.nodeSpacing,rankSpacing:t.rankSpacing,actorFontSize:t.actorFontSize,actorFontFamily:t.actorFontFamily,actorFontWeight:t.actorFontWeight,usecaseFontSize:t.usecaseFontSize,usecaseFontFamily:t.usecaseFontFamily,usecaseFontWeight:t.usecaseFontWeight,diagramPadding:t.diagramPadding,useMaxWidth:t.useMaxWidth,markers:["point","circle","cross","extension"]}},"getData"),sb={getConfig:t7,createModel:t4,commit:st,getAST:se,clear:ss,setDiagramTitle:p.ke,getDiagramTitle:p.ab,setAccTitle:p.SV,getAccTitle:p.iN,setAccDescription:p.EI,getAccDescription:p.m7,getActors:si,getActor:sn,getUseCases:sa,getUseCase:sr,getSystemBoundaries:so,getSystemBoundary:sl,getRelationships:sc,getNotes:sh,getNote:sd,getJsonNodes:su,getJsonNode:sp,getClassDefs:sf,getClassDef:sm,getDirection:sE,getData:sN};function sC(e,t,s){let i=[s];return i.index=t,i.input=e,i}(0,m.K)(sC,"customMatch");var s_=(0,m.K)((e,t)=>{if('"'!==e[t]||"`"!==e[t+1])return null;for(let s=t+2;s<e.length-1;s++)if("`"===e[s]&&'"'===e[s+1])return sC(e,t,e.slice(t,s+2));return null},"matchMarkdownString"),sv=(0,m.K)((e,t)=>{if("%"!==e[t]||"%"!==e[t+1])return null;for(let s=t-1;s>=0;s--){let t=e[s];if("\n"===t||"\r"===t)break;if(" "!==t&&" "!==t)return null}let s=t+2;for(;s<e.length&&"\n"!==e[s]&&"\r"!==e[s];)s++;return sC(e,t,e.slice(t,s))},"matchComment"),sx=(0,m.K)((e,t)=>{for(let s=t-1;s>=0;s--){let t=e[s];if("\n"===t||"\r"===t)break;if(" "!==t&&" "!==t)return!1}return!0},"isIndentedLineStart"),sU=(0,m.K)((e,t,s)=>{if(!sx(e,t))return null;let i=s.exec(e.slice(t));return i?sC(e,t,i[0]):null},"matchAccessibilityLine"),sM=(0,m.K)((e,t)=>{if(!sx(e,t))return null;let s=/^accDescr[\t ]*{/.exec(e.slice(t));if(!s)return null;let i=e.indexOf("}",t+s[0].length);return -1===i?null:sC(e,t,e.slice(t,i+1))},"matchAccDescrBlock"),sw=(0,m.K)((e,t)=>{if("{"!==e[t])return null;let s=0,i=!1,n=!1;for(let a=t;a<e.length;a++){let r=e[a];if(i){n?n=!1:"\\"===r?n=!0:'"'===r&&(i=!1);continue}if('"'===r)i=!0;else if("{"===r)s++;else if("}"===r&&0==--s)return sC(e,t,e.slice(t,a+1))}return null},"matchJsonObject"),sP=(0,m.K)((e,t)=>{let s=e.indexOf(">>",t);if(-1===s||/[\n\r]/.test(e.slice(t,s)))return null;let i=e.slice(t,s);return i.trim()?sC(e,t,i):null},"matchStereotypeText"),sD=eG({name:"LABEL_TEXT",pattern:ex.NA}),s$=eG({name:"WORD",pattern:ex.NA,categories:sD}),sK=eG({name:"NUMBER",pattern:/(?:\d+\.\d+|\d+|\.\d+)(?:[A-Za-z]+)?/,categories:sD}),sF=eG({name:"IDENTIFIER",pattern:/\w+/,longer_alt:sK,categories:s$}),sB=eG({name:"HWS",pattern:/[\t ]+/,group:ex.SKIPPED}),sj=eG({name:"MARKDOWN_STRING",pattern:s_,start_chars_hint:['"'],line_breaks:!0}),sG=eG({name:"UNCLOSED_MARKDOWN_STRING",pattern:/"`[^]*/,line_breaks:!0}),sW=eG({name:"COMMENT",pattern:sv,start_chars_hint:["%"],line_breaks:!1}),sV=eG({name:"NEWLINE",pattern:/\r\n|\n|\r/,line_breaks:!0}),sz=eG({name:"ACC_DESCR_BLOCK",pattern:sM,start_chars_hint:["a"],line_breaks:!0}),sH=/^accTitle[\t ]*:[^\n\r]*/,sY=/^accDescr[\t ]*:[^\n\r]*/,sX=eG({name:"ACC_TITLE_LINE",pattern:(0,m.K)((e,t)=>sU(e,t,sH),"pattern"),start_chars_hint:["a"],line_breaks:!1}),sq=eG({name:"ACC_DESCR_LINE",pattern:(0,m.K)((e,t)=>sU(e,t,sY),"pattern"),start_chars_hint:["a"],line_breaks:!1}),sJ=eG({name:"JSON_DECLARATION_START",pattern:/json[\t ]+\w+[\t ]*@[\t ]*(?={)/,push_mode:"jsonBody"}),sZ=eG({name:"JSON_OBJECT_LITERAL",pattern:sw,start_chars_hint:["{"],line_breaks:!0,pop_mode:!0}),sQ=eG({name:"UNCLOSED_JSON_OBJECT_LITERAL",pattern:/{[^]*/,line_breaks:!0,pop_mode:!0}),s0=(0,m.K)((e,t)=>eG({name:e,pattern:t,longer_alt:sF,categories:s$}),"keyword"),s1=s0("USECASE",/usecase-beta/),s2=s0("ACTOR",/actor/),s6=s0("SYSTEM_BOUNDARY",/systemBoundary/),s3=s0("END",/end/),s5=s0("DIRECTION",/direction/),s4=s0("TD",/TD/),s8=s0("TB",/TB/),s9=s0("BT",/BT/),s7=s0("LR",/LR/),ie=s0("RL",/RL/),it=s0("NOTE",/note/),is=s0("FOR",/for/),ii=s0("JSON",/json/),ia=s0("CLASS_DEF",/classDef/),ir=s0("CLASS",/class/),io=s0("STYLE",/style/),il=s0("INCLUDE",/include/i),ic=s0("EXTEND",/extend/i),ih=s0("TRUE",/true/),id=s0("FALSE",/false/),iu=eG({name:"GENERALIZATION",pattern:/--\|>/}),ip=eG({name:"DEPENDENCY_ARROW",pattern:/\.\.>/}),im=eG({name:"STEREOTYPE_START",pattern:/<</,push_mode:"stereotype"}),iE=eG({name:"STEREOTYPE_END",pattern:/>>/,pop_mode:!0}),iT=eG({name:"STEREOTYPE_TEXT",pattern:sP,line_breaks:!1}),ig=eG({name:"UNCLOSED_STEREOTYPE_TEXT",pattern:/[^\n\r]+/,line_breaks:!1,pop_mode:!0}),iy=eG({name:"CLASS_SEPARATOR",pattern:/:::/}),iA=eG({name:"FORWARD_SOLID",pattern:/--+>/}),iS=eG({name:"BACKWARD_SOLID",pattern:/<--+/}),iL=eG({name:"FORWARD_CIRCLE",pattern:/--o/}),iO=eG({name:"BACKWARD_CIRCLE",pattern:/o--/}),iR=eG({name:"FORWARD_CROSS",pattern:/--x/}),ik=eG({name:"BACKWARD_CROSS",pattern:/x--/}),iI=eG({name:"MARKERLESS_SOLID",pattern:/--+/}),iN=eG({name:"METADATA_START",pattern:/@{/}),ib=eG({name:"AT",pattern:/@/,categories:sD}),iC=eG({name:"LBRACE",pattern:/{/}),i_=eG({name:"RBRACE",pattern:/}/}),iv=eG({name:"LBRACKET",pattern:/\[/}),ix=eG({name:"RBRACKET",pattern:/]/}),iU=eG({name:"LPAREN",pattern:/\(/}),iM=eG({name:"RPAREN",pattern:/\)/}),iw=eG({name:"COMMA",pattern:/,/,categories:sD}),iP=eG({name:"COLON",pattern:/:/,categories:sD}),iD=eG({name:"HASH_COLOR",pattern:/#[\dA-Fa-f]+/,categories:sD}),i$=eG({name:"PLAIN_STRING",pattern:/"[^\n\r"]*"|'[^\n\r']*'/}),iK=eG({name:"CSS_IDENTIFIER",pattern:/--[A-Z_a-z][\w-]*|[A-Z_a-z]\w*(?:-\w+)+/,categories:sD}),iF=eG({name:"CSS_ESCAPED_COMMA",pattern:/\\,/,categories:sD}),iB=eG({name:"DASH",pattern:/-/,categories:sD}),ij=eG({name:"DOT",pattern:/\./,categories:sD}),iG=eG({name:"PERCENT",pattern:/%/,categories:sD}),iW=eG({name:"CSS_PUNCTUATION",pattern:/[!#$&*+/=?^_|~]/,categories:sD}),iV=eG({name:"LABEL_PUNCTUATION",pattern:/[;<>\\`]/,categories:sD}),iz=eG({name:"LABEL_SYMBOL",pattern:/[^\t\n\r !-~]+/,categories:sD}),iH=[sD,s$,sB,sj,sG,sW,sV,sz,sX,sq,sJ,s1,s2,s6,s3,s5,s4,s8,s9,s7,ie,it,is,ii,ia,ir,io,il,ic,ih,id,iu,ip,im,iy,iA,iS,iL,iO,iR,ik,iI,iN,ib,iC,i_,iv,ix,iU,iM,iw,iP,iD,i$,iK,sF,sK,iF,iB,ij,iG,iW,iV,iz],iY={defaultMode:"defaultMode",modes:{defaultMode:[...iH],jsonBody:[sZ,sQ],stereotype:[iE,iT,ig]}},iX=[...iH,sZ,sQ,iE,iT,ig],iq=new ex(iY),iJ=(0,m.K)(e=>eO(e,sD)||e.tokenType===i$||e.tokenType===sj,"isLabelToken"),iZ={allowmixing:!0,newpage:!0,package:!0,rectangle:!0,skinparam:!0},iQ=new class extends t0{static{(0,m.K)(this,"UsecaseParser")}constructor(){super(iX,{nodeLocationTracking:"full"}),this.RULE("start",()=>{this.CONSUME(s1),this.SUBRULE(this.lineEnd),this.MANY(()=>this.SUBRULE(this.line))}),this.RULE("line",()=>{this.OR([{ALT:(0,m.K)(()=>this.SUBRULE(this.blankLine),"ALT")},{ALT:(0,m.K)(()=>this.SUBRULE(this.commentLine),"ALT")},{GATE:(0,m.K)(()=>this.isStatementStart(),"GATE"),ALT:(0,m.K)(()=>this.SUBRULE(this.statement),"ALT")}])}),this.RULE("statement",()=>{this.OR([{ALT:(0,m.K)(()=>this.SUBRULE(this.accTitleStatement),"ALT")},{ALT:(0,m.K)(()=>this.SUBRULE(this.accDescrStatement),"ALT")},{ALT:(0,m.K)(()=>this.SUBRULE(this.directionStatement),"ALT")},{ALT:(0,m.K)(()=>this.SUBRULE(this.actorStatement),"ALT")},{ALT:(0,m.K)(()=>this.SUBRULE(this.systemBoundaryStatement),"ALT")},{ALT:(0,m.K)(()=>this.SUBRULE(this.noteStatement),"ALT")},{ALT:(0,m.K)(()=>this.SUBRULE(this.jsonStatement),"ALT")},{ALT:(0,m.K)(()=>this.SUBRULE(this.classDefStatement),"ALT")},{ALT:(0,m.K)(()=>this.SUBRULE(this.classStatement),"ALT")},{ALT:(0,m.K)(()=>this.SUBRULE(this.styleStatement),"ALT")},{GATE:(0,m.K)(()=>this.isMetadataAssignment(),"GATE"),ALT:(0,m.K)(()=>this.SUBRULE(this.metadataAssignmentStatement),"ALT")},{GATE:(0,m.K)(()=>!this.isForbiddenPlantUmlStatement(),"GATE"),ALT:(0,m.K)(()=>this.SUBRULE(this.entityStatement),"ALT")}])}),this.RULE("lineEnd",()=>{this.OR([{ALT:(0,m.K)(()=>this.CONSUME(sV),"ALT")},{ALT:(0,m.K)(()=>this.CONSUME(eW),"ALT")}])}),this.RULE("blankLine",()=>{this.CONSUME(sV)}),this.RULE("commentLine",()=>{this.CONSUME(sW),this.SUBRULE(this.lineEnd)}),this.RULE("accTitleStatement",()=>{this.CONSUME(sX),this.SUBRULE(this.lineEnd)}),this.RULE("accDescrStatement",()=>{this.OR([{ALT:(0,m.K)(()=>this.CONSUME(sq),"ALT")},{ALT:(0,m.K)(()=>this.CONSUME(sz),"ALT")}]),this.SUBRULE(this.lineEnd)}),this.RULE("actorStatement",()=>{this.CONSUME(s2),this.SUBRULE(this.actorItem),this.OPTION(()=>{this.OR([{ALT:(0,m.K)(()=>this.AT_LEAST_ONE(()=>{this.CONSUME(iw),this.SUBRULE2(this.actorItem)}),"ALT")},{ALT:(0,m.K)(()=>this.SUBRULE(this.relationTail),"ALT")}])}),this.SUBRULE(this.lineEnd)}),this.RULE("actorItem",()=>{this.SUBRULE(this.actorName),this.OPTION(()=>this.SUBRULE(this.metadata)),this.OPTION2(()=>this.SUBRULE(this.stereotype)),this.OPTION3(()=>this.SUBRULE(this.classSuffix))}),this.RULE("actorName",()=>{this.OR([{ALT:(0,m.K)(()=>{this.CONSUME(sF),this.OPTION(()=>{this.CONSUME(iU),this.SUBRULE(this.nodeLabel),this.CONSUME(iM)})},"ALT")},{ALT:(0,m.K)(()=>this.CONSUME(i$),"ALT")},{ALT:(0,m.K)(()=>this.CONSUME(sj),"ALT")}])}),this.RULE("actorDeclarationOnly",()=>{this.CONSUME(s2),this.SUBRULE(this.actorItem),this.MANY(()=>{this.CONSUME(iw),this.SUBRULE2(this.actorItem)}),this.SUBRULE(this.lineEnd)}),this.RULE("entityStatement",()=>{this.SUBRULE(this.entityName),this.OPTION(()=>this.SUBRULE(this.relationTail)),this.SUBRULE(this.lineEnd)}),this.RULE("entityName",()=>{this.OR([{ALT:(0,m.K)(()=>{this.CONSUME(sF),this.OPTION(()=>{this.OR2([{ALT:(0,m.K)(()=>{this.CONSUME(iU),this.SUBRULE(this.nodeLabel),this.CONSUME(iM)},"ALT")},{ALT:(0,m.K)(()=>{this.CONSUME(iv),this.SUBRULE2(this.nodeLabel),this.CONSUME(ix)},"ALT")}])})},"ALT")},{ALT:(0,m.K)(()=>this.CONSUME(i$),"ALT")},{ALT:(0,m.K)(()=>this.CONSUME(sj),"ALT")}]),this.OPTION2(()=>this.SUBRULE(this.useCaseMetadata)),this.OPTION3(()=>this.SUBRULE(this.stereotype)),this.OPTION4(()=>this.SUBRULE(this.classSuffix))}),this.RULE("nodeLabel",()=>{this.OR([{ALT:(0,m.K)(()=>this.CONSUME(i$),"ALT")},{ALT:(0,m.K)(()=>this.CONSUME(sj),"ALT")},{ALT:(0,m.K)(()=>this.AT_LEAST_ONE(()=>this.CONSUME(sD)),"ALT")}])}),this.RULE("useCaseMetadata",()=>{this.SUBRULE(this.metadata)}),this.RULE("relationTail",()=>{this.OPTION({GATE:(0,m.K)(()=>this.LA(1).tokenType===sF&&this.LA(2).tokenType===ib,"GATE"),DEF:(0,m.K)(()=>{this.CONSUME(sF),this.CONSUME(ib)},"DEF")}),this.SUBRULE(this.arrow),this.SUBRULE(this.entityName)}),this.RULE("arrow",()=>{this.OR([{ALT:(0,m.K)(()=>this.SUBRULE(this.semanticRelation),"ALT")},{ALT:(0,m.K)(()=>this.SUBRULE(this.forwardSolidOperator),"ALT")},{ALT:(0,m.K)(()=>this.SUBRULE(this.backwardSolidOperator),"ALT")},{ALT:(0,m.K)(()=>this.SUBRULE(this.markerlessSolidOperator),"ALT")},{ALT:(0,m.K)(()=>this.SUBRULE(this.forwardCircleOperator),"ALT")},{ALT:(0,m.K)(()=>this.SUBRULE(this.backwardCircleOperator),"ALT")},{ALT:(0,m.K)(()=>this.SUBRULE(this.forwardCrossOperator),"ALT")},{ALT:(0,m.K)(()=>this.SUBRULE(this.backwardCrossOperator),"ALT")}])}),this.RULE("forwardSolidOperator",()=>{this.CONSUME(iA)}),this.RULE("backwardSolidOperator",()=>{this.CONSUME(iS),this.OPTION({GATE:(0,m.K)(()=>"<--"===this.LA(0).image&&this.hasLabeledRight([iI]),"GATE"),DEF:(0,m.K)(()=>{this.SUBRULE(this.edgeLabel),this.CONSUME(iI)},"DEF")})}),this.RULE("markerlessSolidOperator",()=>{this.CONSUME(iI),this.OPTION({GATE:(0,m.K)(()=>"--"===this.LA(0).image&&this.hasLabeledRight([iA,iI,iL,iR]),"GATE"),DEF:(0,m.K)(()=>{this.SUBRULE(this.edgeLabel),this.OR([{ALT:(0,m.K)(()=>this.CONSUME(iA),"ALT")},{ALT:(0,m.K)(()=>this.CONSUME2(iI),"ALT")},{ALT:(0,m.K)(()=>this.CONSUME(iL),"ALT")},{ALT:(0,m.K)(()=>this.CONSUME(iR),"ALT")}])},"DEF")})}),this.RULE("forwardCircleOperator",()=>{this.CONSUME(iL)}),this.RULE("backwardCircleOperator",()=>{this.CONSUME(iO),this.OPTION({GATE:(0,m.K)(()=>this.hasLabeledRight([iI]),"GATE"),DEF:(0,m.K)(()=>{this.SUBRULE(this.edgeLabel),this.CONSUME(iI)},"DEF")})}),this.RULE("forwardCrossOperator",()=>{this.CONSUME(iR)}),this.RULE("backwardCrossOperator",()=>{this.CONSUME(ik),this.OPTION({GATE:(0,m.K)(()=>this.hasLabeledRight([iI]),"GATE"),DEF:(0,m.K)(()=>{this.SUBRULE(this.edgeLabel),this.CONSUME(iI)},"DEF")})}),this.RULE("edgeLabel",()=>{this.OR([{ALT:(0,m.K)(()=>this.CONSUME(i$),"ALT")},{ALT:(0,m.K)(()=>this.CONSUME(sj),"ALT")},{ALT:(0,m.K)(()=>this.AT_LEAST_ONE(()=>this.CONSUME(sD)),"ALT")}])}),this.RULE("semanticRelation",()=>{this.OR([{ALT:(0,m.K)(()=>{this.CONSUME(ip),this.CONSUME(iP),this.OR2([{ALT:(0,m.K)(()=>this.CONSUME(il),"ALT")},{ALT:(0,m.K)(()=>this.CONSUME(ic),"ALT")}])},"ALT")},{ALT:(0,m.K)(()=>this.CONSUME(iu),"ALT")}])}),this.RULE("metadata",()=>{this.CONSUME(iN),this.MANY(()=>this.CONSUME(sV)),this.OPTION(()=>{this.SUBRULE(this.metadataProperty),this.MANY2(()=>{this.SUBRULE(this.metadataSeparator),this.SUBRULE2(this.metadataProperty)}),this.OPTION2(()=>this.CONSUME(iw)),this.MANY3(()=>this.CONSUME2(sV))}),this.CONSUME(i_)}),this.RULE("metadataProperty",()=>{this.OR([{ALT:(0,m.K)(()=>this.CONSUME(sF),"ALT")},{ALT:(0,m.K)(()=>this.CONSUME(i$),"ALT")}]),this.CONSUME(iP),this.OR2([{ALT:(0,m.K)(()=>this.CONSUME2(sF),"ALT")},{ALT:(0,m.K)(()=>this.CONSUME2(i$),"ALT")},{ALT:(0,m.K)(()=>this.CONSUME(ih),"ALT")},{ALT:(0,m.K)(()=>this.CONSUME(id),"ALT")}])}),this.RULE("metadataSeparator",()=>{this.OR([{ALT:(0,m.K)(()=>{this.CONSUME(iw),this.MANY(()=>this.CONSUME(sV))},"ALT")},{ALT:(0,m.K)(()=>{this.AT_LEAST_ONE(()=>this.CONSUME2(sV)),this.OPTION(()=>this.CONSUME2(iw)),this.MANY2(()=>this.CONSUME3(sV))},"ALT")}])}),this.RULE("systemBoundaryStatement",()=>{this.CONSUME(s6),this.SUBRULE(this.systemBoundaryName),this.OPTION(()=>this.SUBRULE(this.metadata)),this.OPTION2(()=>this.SUBRULE(this.classSuffix)),this.SUBRULE(this.lineEnd),this.SUBRULE(this.systemBoundaryContent),this.CONSUME(s3),this.SUBRULE2(this.lineEnd)}),this.RULE("systemBoundaryName",()=>{this.OR([{ALT:(0,m.K)(()=>{this.CONSUME(sF),this.OPTION(()=>{this.OR2([{ALT:(0,m.K)(()=>{this.CONSUME(iU),this.SUBRULE(this.nodeLabel),this.CONSUME(iM)},"ALT")},{ALT:(0,m.K)(()=>{this.CONSUME(iv),this.SUBRULE2(this.nodeLabel),this.CONSUME(ix)},"ALT")}])})},"ALT")},{ALT:(0,m.K)(()=>this.CONSUME(i$),"ALT")},{ALT:(0,m.K)(()=>this.CONSUME(sj),"ALT")}])}),this.RULE("systemBoundaryContent",()=>{this.MANY(()=>{this.OR([{ALT:(0,m.K)(()=>this.SUBRULE(this.blankLine),"ALT")},{ALT:(0,m.K)(()=>this.SUBRULE(this.commentLine),"ALT")},{ALT:(0,m.K)(()=>this.SUBRULE(this.boundaryElement),"ALT")}])})}),this.RULE("boundaryElement",()=>{this.OR([{ALT:(0,m.K)(()=>this.SUBRULE(this.actorDeclarationOnly),"ALT")},{ALT:(0,m.K)(()=>{this.SUBRULE(this.entityName),this.SUBRULE(this.lineEnd)},"ALT")}])}),this.RULE("metadataAssignmentStatement",()=>{this.SUBRULE(this.metadataAssignmentTarget),this.SUBRULE(this.metadata),this.SUBRULE(this.lineEnd)}),this.RULE("metadataAssignmentTarget",()=>{this.OR([{ALT:(0,m.K)(()=>this.CONSUME(sF),"ALT")},{ALT:(0,m.K)(()=>this.CONSUME(i$),"ALT")},{ALT:(0,m.K)(()=>this.CONSUME(sj),"ALT")}])}),this.RULE("noteStatement",()=>{this.CONSUME(it),this.CONSUME(is),this.CONSUME(sF),this.SUBRULE(this.nodeLabel),this.SUBRULE(this.lineEnd)}),this.RULE("stereotype",()=>{this.CONSUME(im),this.CONSUME(iT),this.CONSUME(iE)}),this.RULE("classSuffix",()=>{this.CONSUME(iy),this.CONSUME(sF),this.MANY(()=>{this.CONSUME(iw),this.CONSUME2(sF)})}),this.RULE("jsonStatement",()=>{this.CONSUME(sJ),this.CONSUME(sZ),this.OPTION(()=>this.SUBRULE(this.classSuffix)),this.SUBRULE(this.lineEnd)}),this.RULE("directionStatement",()=>{this.CONSUME(s5),this.OR([{ALT:(0,m.K)(()=>this.CONSUME(s4),"ALT")},{ALT:(0,m.K)(()=>this.CONSUME(s8),"ALT")},{ALT:(0,m.K)(()=>this.CONSUME(s9),"ALT")},{ALT:(0,m.K)(()=>this.CONSUME(s7),"ALT")},{ALT:(0,m.K)(()=>this.CONSUME(ie),"ALT")}]),this.SUBRULE(this.lineEnd)}),this.RULE("classDefStatement",()=>{this.CONSUME(ia),this.CONSUME(sF),this.MANY(()=>{this.CONSUME(iw),this.CONSUME2(sF)}),this.SUBRULE(this.styles),this.SUBRULE(this.lineEnd)}),this.RULE("classStatement",()=>{this.CONSUME(ir),this.CONSUME(sF),this.MANY(()=>{this.CONSUME(iw),this.CONSUME2(sF)}),this.CONSUME3(sF),this.MANY2(()=>{this.CONSUME2(iw),this.CONSUME4(sF)}),this.SUBRULE(this.lineEnd)}),this.RULE("styleStatement",()=>{this.CONSUME(io),this.CONSUME(sF),this.SUBRULE(this.styles),this.SUBRULE(this.lineEnd)}),this.RULE("styles",()=>{this.SUBRULE(this.styleValue),this.MANY(()=>{this.CONSUME(iw),this.SUBRULE2(this.styleValue)})}),this.RULE("styleValue",()=>{this.OR([{ALT:(0,m.K)(()=>this.CONSUME(s$),"ALT")},{ALT:(0,m.K)(()=>this.CONSUME(iK),"ALT")},{ALT:(0,m.K)(()=>{this.CONSUME(iI),this.CONSUME2(s$)},"ALT")}]),this.CONSUME(iP),this.AT_LEAST_ONE(()=>this.SUBRULE(this.styleComponent))}),this.RULE("styleComponent",()=>{this.OR([{ALT:(0,m.K)(()=>this.CONSUME(s$),"ALT")},{ALT:(0,m.K)(()=>this.CONSUME(i$),"ALT")},{ALT:(0,m.K)(()=>this.CONSUME(sK),"ALT")},{ALT:(0,m.K)(()=>this.CONSUME(iD),"ALT")},{ALT:(0,m.K)(()=>this.CONSUME(iK),"ALT")},{ALT:(0,m.K)(()=>this.CONSUME(iF),"ALT")},{ALT:(0,m.K)(()=>this.CONSUME(iB),"ALT")},{ALT:(0,m.K)(()=>this.CONSUME(ij),"ALT")},{ALT:(0,m.K)(()=>this.CONSUME(iG),"ALT")},{ALT:(0,m.K)(()=>this.CONSUME(iW),"ALT")},{ALT:(0,m.K)(()=>this.CONSUME(iP),"ALT")},{ALT:(0,m.K)(()=>this.CONSUME(iU),"ALT")},{ALT:(0,m.K)(()=>this.CONSUME(iM),"ALT")},{ALT:(0,m.K)(()=>this.CONSUME(iv),"ALT")},{ALT:(0,m.K)(()=>this.CONSUME(ix),"ALT")},{ALT:(0,m.K)(()=>this.CONSUME(iC),"ALT")},{ALT:(0,m.K)(()=>this.CONSUME(i_),"ALT")},{ALT:(0,m.K)(()=>this.CONSUME(ib),"ALT")},{ALT:(0,m.K)(()=>this.CONSUME(iI),"ALT")}])}),this.performSelfAnalysis()}isMetadataAssignment(){let e=this.LA(1).tokenType;return(e===sF||e===i$||e===sj)&&this.LA(2).tokenType===iN}isStatementStart(){let e=this.LA(1).tokenType;return e!==eW&&e!==sV&&e!==sW}isForbiddenPlantUmlStatement(){return this.LA(1).tokenType===sF&&!0===iZ[this.LA(1).image.toLowerCase()]}hasLabeledRight(e){if(!iJ(this.LA(1)))return!1;for(let t=2;;t++){let s=this.LA(t);if(e.includes(s.tokenType))return!0;if(!iJ(s))return!1}}},i0=class extends Error{constructor(e,t,s){super(`${e} (line ${t}, column ${s})`),this.line=t,this.column=s,this.name="UsecaseJsonError"}static{(0,m.K)(this,"UsecaseJsonError")}},i1=(0,m.K)((e,t,s,i)=>{let n=s,a=i,r=Math.min(Math.max(t,0),e.length);for(let t=0;t<r;t++){let s=e[t];"\r"===s?(n++,a=1):"\n"===s?(0===t||"\r"!==e[t-1])&&(n++,a=1):a++}return{line:n,column:a}},"locationAtOffset"),i2=(0,m.K)((e,t,s,i)=>{let n=/\bposition (\d+)\b/u.exec(e);if(n)return i1(t,Number.parseInt(n[1],10),s,i);let a=/\bline (\d+) column (\d+)\b/u.exec(e);if(a){let e=Number.parseInt(a[1],10),t=Number.parseInt(a[2],10);return{line:s+e-1,column:1===e?i+t-1:t}}if(/unexpected end|end of json input/iu.test(e))return i1(t,t.length,s,i)},"locationFromErrorMessage"),i6=class extends Error{constructor(e){super("Invalid JSON token"),this.offset=e}static{(0,m.K)(this,"JsonWalkError")}},i3=class{constructor(e){this.text=e,this.offset=0,this.propertyOrder={}}static{(0,m.K)(this,"PropertyOrderCollector")}collect(){if(this.skipWhitespace(),this.collectValue(""),this.skipWhitespace(),this.offset!==this.text.length)throw new i6(this.offset);return this.propertyOrder}collectValue(e){this.skipWhitespace();let t=this.text[this.offset];if("{"===t)this.collectObject(e);else if("["===t)this.collectArray(e);else if('"'===t)this.readString(!1);else if("t"===t)this.consumeLiteral("true");else if("f"===t)this.consumeLiteral("false");else if("n"===t)this.consumeLiteral("null");else if("-"===t||t>="0"&&t<="9")this.consumeNumber();else throw new i6(this.offset)}collectObject(e){this.offset++;let t=[],s=new Set;if(this.propertyOrder[e]=t,this.skipWhitespace(),"}"===this.text[this.offset])return void this.offset++;for(;this.offset<this.text.length&&'"'===this.text[this.offset];){let i=this.readString(!0),n=`${e}/${i.replaceAll("~","~0").replaceAll("/","~1")}`;if(s.has(i)?this.deletePointerSubtree(n):(s.add(i),t.push(i)),this.skipWhitespace(),":"!==this.text[this.offset])break;if(this.offset++,this.collectValue(n),this.skipWhitespace(),"}"===this.text[this.offset])return void this.offset++;if(","!==this.text[this.offset])break;this.offset++,this.skipWhitespace()}throw new i6(this.offset)}collectArray(e){if(this.offset++,this.skipWhitespace(),"]"===this.text[this.offset])return void this.offset++;let t=0;for(;this.offset<this.text.length;){if(this.collectValue(`${e}/${t}`),t++,this.skipWhitespace(),"]"===this.text[this.offset])return void this.offset++;if(","!==this.text[this.offset])break;this.offset++,this.skipWhitespace()}throw new i6(this.offset)}readString(e){this.offset++;let t="";for(;this.offset<this.text.length;){let s=this.offset,i=this.text[this.offset++];if('"'===i)return t;if(32>i.charCodeAt(0))throw new i6(s);if("\\"!==i){e&&(t+=i);continue}let n=this.offset,a=this.text[this.offset++];switch(a){case'"':case"\\":case"/":e&&(t+=a);break;case"b":e&&(t+="\b");break;case"f":e&&(t+="\f");break;case"n":e&&(t+="\n");break;case"r":e&&(t+="\r");break;case"t":e&&(t+=" ");break;case"u":{let s=this.text.slice(this.offset,this.offset+4);if(!/^[\dA-Fa-f]{4}$/u.test(s))throw new i6(this.offset);e&&(t+=String.fromCharCode(Number.parseInt(s,16))),this.offset+=4;break}default:throw new i6(n)}}throw new i6(this.offset)}consumeLiteral(e){let t=0;for(let s of e){if(this.text[this.offset+t]!==s)throw new i6(this.offset+t);t++}this.offset+=e.length}consumeNumber(){if("-"===this.text[this.offset]&&this.offset++,"0"===this.text[this.offset])this.offset++;else if(this.text[this.offset]>="1"&&this.text[this.offset]<="9")for(;this.text[this.offset]>="0"&&this.text[this.offset]<="9";)this.offset++;else throw new i6(this.offset);if("."===this.text[this.offset]){if(this.offset++,this.text[this.offset]<"0"||this.text[this.offset]>"9")throw new i6(this.offset);for(;this.text[this.offset]>="0"&&this.text[this.offset]<="9";)this.offset++}if("e"===this.text[this.offset]||"E"===this.text[this.offset]){if(this.offset++,("+"===this.text[this.offset]||"-"===this.text[this.offset])&&this.offset++,this.text[this.offset]<"0"||this.text[this.offset]>"9")throw new i6(this.offset);for(;this.text[this.offset]>="0"&&this.text[this.offset]<="9";)this.offset++}}skipWhitespace(){for(;this.offset<this.text.length;){let e=this.text[this.offset];if(" "!==e&&" "!==e&&"\n"!==e&&"\r"!==e)return;this.offset++}}deletePointerSubtree(e){let t=`${e}/`;for(let s of Object.keys(this.propertyOrder))(s===e||s.startsWith(t))&&delete this.propertyOrder[s]}};function i5(e,t,s){let i;try{i=JSON.parse(e)}catch(a){let i=a instanceof Error?a.message:String(a),n=i2(i,e,t,s);if(!n){let i=0;try{new i3(e).collect()}catch(e){e instanceof i6&&(i=e.offset)}n=i1(e,i,t,s)}throw new i0(`Invalid JSON: ${i}`,n.line,n.column)}if("object"!=typeof i||null===i||Array.isArray(i))throw new i0("JSON value must have an object root",t,s);return{value:i,propertyOrder:new i3(e).collect()}}(0,m.K)(i5,"parseOrderedJsonObject");var i4=(0,m.K)(e=>({shape:"normal"===e.type?"actor":"hollow"===e.type?"actor-hollow":"awesome"===e.type?"actor-awesome":"actor-icon",...e.label===e.id?{}:{label:e.label},...e.classes.length?{classes:[...e.classes]}:{},...e.styles.length?{styles:[...e.styles]}:{},attrs:{kind:"actor",actorType:e.type,business:e.business,labelType:e.labelType,...e.icon?{icon:e.icon}:{},...e.stereotype?{stereotype:e.stereotype}:{},...e.parentId?{parentId:e.parentId}:{}}}),"actorNode"),i8=(0,m.K)(e=>({shape:e.shape,...e.label===e.id?{}:{label:e.label},...e.classes.length?{classes:[...e.classes]}:{},...e.styles.length?{styles:[...e.styles]}:{},attrs:{kind:"usecase",useCaseShape:e.shape,business:e.business,labelType:e.labelType,...e.stereotype?{stereotype:e.stereotype}:{},...e.parentId?{parentId:e.parentId}:{}}}),"useCaseNode"),i9=(0,m.K)(e=>({label:e.label,shape:"note",attrs:{kind:"note",target:e.target,labelType:e.labelType}}),"noteNode"),i7=(0,m.K)(e=>({label:e.id,shape:"json-table",...e.classes.length?{classes:[...e.classes]}:{},...e.styles.length?{styles:[...e.styles]}:{},attrs:{kind:"json",value:e.value,propertyOrder:e.propertyOrder,labelType:"text"}}),"jsonNode"),ne=(0,m.K)(e=>({id:e.id,source:e.source,target:e.target,...e.label?{label:e.label}:{},...e.classes.length?{classes:[...e.classes]}:{},...e.styles.length?{styles:[...e.styles]}:{},attrs:{relationshipType:e.type,arrowType:e.arrowType,minlen:e.minlen,explicitId:e.explicitId,animate:e.animate,...e.animation?{animation:e.animation}:{},...e.labelType?{labelType:e.labelType}:{}}}),"relationshipEdge"),nt=(0,m.K)(e=>({id:`${e.id}-edge`,source:e.id,target:e.target,attrs:{relationshipType:"note",arrowType:t3.LINE_SOLID,pattern:"dotted",minlen:1,explicitId:!1,animate:!1,internal:!0}}),"noteEdge"),ns=(0,m.K)((e,t,s,i)=>{let n={};for(let t of e.getActors().values())n[t.id]=i4(t);for(let t of e.getUseCases().values())n[t.id]=i8(t);for(let t of e.getNotes().values())n[t.id]=i9(t);for(let t of e.getJsonNodes().values())n[t.id]=i7(t);let a={};for(let t of e.getSystemBoundaries().values())a[t.id]={...t.label===t.id?{}:{title:t.label},nodes:[...t.members],...t.classes.length?{classes:[...t.classes]}:{},...t.styles.length?{styles:[...t.styles]}:{},attrs:{kind:"systemBoundary",boundaryType:t.type,labelType:t.labelType}};let r={};for(let t of e.getClassDefs().values())r[t.id]={styles:[...t.styles]};let o=e.getDirection();return{version:1,diagramType:"usecase",source:t,header:{keyword:"usecase",direction:"TD"===o?"TB":o,span:s},...e.getAccTitle()?{accTitle:e.getAccTitle()}:{},...e.getAccDescription()?{accDescr:e.getAccDescription()}:{},nodes:n,edges:[...e.getRelationships().map(ne),...[...e.getNotes().values()].map(nt)],groups:a,classDefs:r,statements:i}},"buildUsecaseGraphAST"),ni=(0,m.K)(e=>`line ${e.line}, column ${e.column} [${e.span[0]},${e.span[1]})`,"locationText"),nn=(0,m.K)(e=>void 0===e?"":` (label "${e}")`,"labelSuffix"),na=(0,m.K)(e=>e.generated?e.label:void 0,"generatedFrom"),nr=(0,m.K)((e,t)=>{for(let s of t)e.includes(s)||e.push(s)},"pushUnique"),no=class{constructor(e){this.db=e,this.source="",this.statements=[],this.elements=[],this.boundaries=[],this.jsonDrafts=[],this.relationshipDrafts=[],this.noteDrafts=[],this.metadataAssignments=[],this.classAssignments=[],this.styleAssignments=[],this.classDefinitions=[],this.directions=[],this.model=e.createModel()}static{(0,m.K)(this,"UsecaseModelBuilder")}reset(e){this.model=this.db.createModel(),this.source=e,this.statements=[],this.elements.length=0,this.boundaries.length=0,this.jsonDrafts.length=0,this.relationshipDrafts.length=0,this.noteDrafts.length=0,this.metadataAssignments.length=0,this.classAssignments.length=0,this.styleAssignments.length=0,this.classDefinitions.length=0,this.directions.length=0}addElement(e){this.elements.push(e)}addBoundary(e){this.boundaries.push(e)}addJson(e){this.jsonDrafts.push(e)}addRelationship(e){this.relationshipDrafts.push(e)}addNote(e){this.noteDrafts.push(e)}addMetadataAssignment(e,t,s,i){this.metadataAssignments.push({target:e,targetLocation:t,metadata:s,statement:i})}addClassDef(e,t){this.classDefinitions.push({ids:e,styles:t})}addClassAssignment(e,t){this.classAssignments.push({targets:e,classes:t})}addStyleAssignment(e,t,s){this.styleAssignments.push({target:e,location:t,styles:s})}setDirection(e){this.directions.push("TD"===e?"TB":e)}setAccTitle(e){this.model.accTitle=e}setAccDescription(e){this.model.accDescription=e}setStatements(e){this.statements=e}getActors(){return this.model.actors}getUseCases(){return this.model.useCases}getSystemBoundaries(){return this.model.systemBoundaries}getRelationships(){return this.model.relationships}getNotes(){return this.model.notes}getJsonNodes(){return this.model.jsonNodes}getClassDefs(){return this.model.classDefs}getDirection(){return this.model.direction}getAccTitle(){return this.model.accTitle}getAccDescription(){return this.model.accDescription}finalize(e){let t=new Map,s=new Map,i=new Map,n=new Map;for(let e of this.relationshipDrafts)this.recordFirst(n,e.source.id,e.source.location.span[0]),this.recordFirst(n,e.target.id,e.target.location.span[0]);for(let e of this.elements)this.recordFirst(n,e.id,e.location.span[0]);for(let e of this.boundaries)this.recordFirst(n,e.id,e.location.span[0]);for(let e of this.jsonDrafts)this.recordFirst(n,e.id,e.location.span[0]);for(let e of[...this.elements.map(e=>({offset:e.location.span[0],type:"element",value:e})),...this.boundaries.map(e=>({offset:e.location.span[0],type:"boundary",value:e})),...this.jsonDrafts.map(e=>({offset:e.location.span[0],type:"json",value:e})),...this.relationshipDrafts.filter(e=>e.explicitId).map(e=>({offset:e.explicitIdLocation.span[0],type:"edge",value:e}))].sort((e,t)=>e.offset-t.offset))"element"===e.type?this.collectElement(e.value,t,s):"boundary"===e.type?this.collectBoundary(e.value,t,i):"json"===e.type?this.registerUnique(t,e.value.id,"json",e.value.location,!1):this.registerUnique(t,e.value.explicitId,"edge",e.value.explicitIdLocation,!1);this.materializeElements(s,n),this.materializeBoundaries(i,n),this.materializeJson(n);let a=this.materializeRelationships(t,s,n);this.reorderElements(s,n),this.applyMetadataAssignments(t,s,i,a),this.validateAndRefreshElements(s),this.refreshBoundaries(i,s),this.materializeNotes(t),this.applyClassDefinitions(),this.applyClassesAndStyles(t,a),this.model.direction=this.directions.at(-1)??this.model.direction,this.model.symbols=new Map([...t].map(([e,t])=>[e,t.kind]));let r=ns(this,this.source,e,this.statements);return this.model.ast=r,this.db.commit(this.model),r}collectElement(e,t,s){let i=t.get(e.id),n=na({generated:e.generated,label:e.label.text});i&&i.kind!==e.kind&&this.conflict(`ID '${e.id}' is declared as both ${i.kind} and ${e.kind}`,e.location,i.location,n,na(i)),i&&(i.generated||e.generated)&&this.conflict(`Generated ID '${e.id}' collides with another declaration`,e.location,i.location,n,na(i));let a=s.get(e.id);if(!a){let i={kind:e.kind,id:e.id,label:e.label,location:e.location,generated:e.generated,classes:[...e.classes],...e.parentId?{parentId:e.parentId,parentLocation:e.parentLocation}:{},...e.shape?{shape:e.shape}:{},...e.stereotype?{stereotype:e.stereotype,stereotypeLocation:e.location}:{}};this.applyDeclarationMetadata(i,e.metadata),s.set(e.id,i),t.set(e.id,{kind:e.kind,location:e.location,generated:e.generated,label:e.label.text});return}(a.label.text!==e.label.text||a.label.type!==e.label.type)&&this.conflict(`ID '${e.id}' has conflicting labels`,e.location,a.location),e.shape&&a.shape&&e.shape!==a.shape&&this.conflict(`Use case '${e.id}' has conflicting shapes`,e.location,a.location),e.parentId&&a.parentId&&e.parentId!==a.parentId&&this.conflict(`Element '${e.id}' belongs to more than one system boundary`,e.parentLocation??e.location,a.parentLocation??a.location),e.stereotype&&a.stereotype&&e.stereotype!==a.stereotype&&this.conflict(`Element '${e.id}' has conflicting stereotypes`,e.location,a.stereotypeLocation??a.location),a.shape??=e.shape,a.parentId??=e.parentId,a.parentLocation??=e.parentLocation,a.stereotype??=e.stereotype,a.stereotypeLocation??=e.stereotype?e.location:void 0,nr(a.classes,e.classes),this.applyDeclarationMetadata(a,e.metadata)}collectBoundary(e,t,s){let i=t.get(e.id),n=na({generated:e.generated,label:e.label.text});i&&"boundary"!==i.kind&&this.conflict(`ID '${e.id}' is declared as both ${i.kind} and boundary`,e.location,i.location,n,na(i)),i&&(i.generated||e.generated)&&this.conflict(`Generated ID '${e.id}' collides with another declaration`,e.location,i.location,n,na(i));let a=s.get(e.id);if(a){(a.label.text!==e.label.text||a.label.type!==e.label.type)&&this.conflict(`Boundary '${e.id}' has conflicting titles`,e.location,a.location),nr(a.classes,e.classes);return}s.set(e.id,{id:e.id,label:e.label,location:e.location,generated:e.generated,classes:[...e.classes],styles:[],members:[]}),t.set(e.id,{kind:"boundary",location:e.location,generated:e.generated,label:e.label.text})}materializeElements(e,t){for(let s of[...e.values()].sort((e,s)=>(t.get(e.id)??0)-(t.get(s.id)??0)))this.setElementModel(s)}materializeBoundaries(e,t){for(let s of[...e.values()].sort((e,s)=>(t.get(e.id)??0)-(t.get(s.id)??0)))this.model.systemBoundaries.set(s.id,{id:s.id,label:s.label.text,labelType:s.label.type,type:s.type??"rect",members:[],classes:[...s.classes],styles:[...s.styles]})}materializeJson(e){for(let t of[...this.jsonDrafts].sort((t,s)=>(e.get(t.id)??0)-(e.get(s.id)??0)))this.model.jsonNodes.set(t.id,{id:t.id,value:t.value,propertyOrder:t.propertyOrder,classes:[...t.classes],styles:[]})}materializeRelationships(e,t,s){let i=new Map,n=0;for(let a of this.relationshipDrafts){let r=this.resolveEndpoint(a.source,e,t,s),o=this.resolveEndpoint(a.target,e,t,s);this.validateRelationship(a,r,o,e);let l=a.explicitId??`edge-${n++}`,c={id:l,explicitId:!!a.explicitId,source:a.source.id,target:a.target.id,type:a.type,arrowType:a.arrowType,...a.label?{label:a.label.text,labelType:a.label.type}:{},minlen:a.minlen,classes:[],styles:[],animate:!1};this.model.relationships.push(c),i.set(l,{draft:a,relationship:c})}return this.model.relationshipCounter=n,i}resolveEndpoint(e,t,s,i){if(e.classesOnReference&&!e.declaration)throw Error(`Relationship endpoint '${e.id}' uses ::: without declaring the node at ${ni(e.location)}`);let n=t.get(e.id);return n?n.kind:(s.set(e.id,{kind:"usecase",id:e.id,label:e.label,location:e.location,generated:e.generated,shape:"ellipse",classes:[]}),t.set(e.id,{kind:"usecase",location:e.location,generated:e.generated,label:e.label.text}),this.recordFirst(i,e.id,e.location.span[0]),"usecase")}reorderElements(e,t){let s=new Map(this.model.actors),i=new Map(this.model.useCases);for(let n of(this.model.actors.clear(),this.model.useCases.clear(),[...e.values()].sort((e,s)=>(t.get(e.id)??0)-(t.get(s.id)??0)))){s.has(n.id)||i.has(n.id)||this.setElementModel(n);let e=s.get(n.id)??this.model.actors.get(n.id),t=i.get(n.id)??this.model.useCases.get(n.id);e?this.model.actors.set(n.id,e):t&&this.model.useCases.set(n.id,t)}}applyMetadataAssignments(e,t,s,i){for(let n of this.metadataAssignments){let a=e.get(n.target);if(!a){let e=this.inferMetadataKind(n.metadata);throw Error(`Metadata target '${n.target}' is unresolved${e?` (metadata implies ${e})`:""} at ${ni(n.targetLocation)}`)}if("actor"===a.kind||"usecase"===a.kind)this.applyStandaloneElementMetadata(t.get(n.target),n.metadata);else if("boundary"===a.kind){let e=s.get(n.target);for(let t of n.metadata.properties)("type"!==t.key||"rect"!==t.value&&"package"!==t.value)&&this.invalidMetadata(n.target,a.kind,t),e.type=t.value}else if("edge"===a.kind){let e=i.get(n.target);if(!e)throw Error(`Metadata target '${n.target}' is not an explicit edge at ${ni(n.targetLocation)}`);for(let t of(n.statement.kind="edgeMetadata",n.statement.edges=[{id:n.target,span:n.statement.span,idSpan:n.targetLocation.span,...n.statement.metadata?{metadata:n.statement.metadata}:{}}],delete n.statement.nodes,n.metadata.properties))"animate"===t.key&&"boolean"==typeof t.value?e.relationship.animate=t.value:"animation"===t.key&&("fast"===t.value||"slow"===t.value)?(e.relationship.animation=t.value,e.relationship.animate=!0):this.invalidMetadata(n.target,a.kind,t)}else for(let e of n.metadata.properties)this.invalidMetadata(n.target,a.kind,e)}for(let{relationship:e}of i.values())e.animation&&(e.animate=!0)}applyStandaloneElementMetadata(e,t){for(let s of t.properties)"actor"===e.kind?this.applyActorProperty(e,s,!0):"business"===s.key&&"boolean"==typeof s.value?e.business=s.value:this.invalidMetadata(e.id,e.kind,s)}applyDeclarationMetadata(e,t){if(t)for(let s of t.properties)"actor"===e.kind?this.applyActorProperty(e,s,!1):"business"===s.key&&"boolean"==typeof s.value?(void 0!==e.business&&e.business!==s.value&&this.conflict(`Use case '${e.id}' has conflicting business metadata`,s.location,e.location),e.business=s.value):this.invalidMetadata(e.id,e.kind,s)}applyActorProperty(e,t,s){"type"===t.key&&("normal"===t.value||"hollow"===t.value||"awesome"===t.value)?(s||void 0===e.actorType||e.actorType===t.value||this.conflict(`Actor '${e.id}' has conflicting type metadata`,t.location,e.location),e.actorType=t.value):"icon"===t.key&&"string"==typeof t.value?(s||void 0===e.icon||e.icon===t.value||this.conflict(`Actor '${e.id}' has conflicting icon metadata`,t.location,e.location),e.icon=t.value):"business"===t.key&&"boolean"==typeof t.value?(s||void 0===e.business||e.business===t.value||this.conflict(`Actor '${e.id}' has conflicting business metadata`,t.location,e.location),e.business=t.value):this.invalidMetadata(e.id,e.kind,t)}validateAndRefreshElements(e){for(let t of e.values()){let e=t.icon?"icon":t.actorType??"normal";if("actor"===t.kind){if(t.icon&&t.actorType&&"normal"!==t.actorType)throw Error(`Actor '${t.id}' cannot combine icon with type '${t.actorType}' at ${ni(t.location)}`);if(t.business&&("icon"===e||"awesome"===e))throw Error(`Business actor '${t.id}' must use normal or hollow geometry at ${ni(t.location)}`)}else if((t.shape??"ellipse")==="rect"&&t.business)throw Error(`Rectangular use case '${t.id}' cannot be a business use case at ${ni(t.location)}`);this.setElementModel(t)}}refreshBoundaries(e,t){for(let t of e.values())t.members.length=0;for(let t of[...this.elements].sort((e,t)=>e.location.span[0]-t.location.span[0])){if(!t.parentId)continue;let s=e.get(t.parentId);if(!s)throw Error(`Parent boundary '${t.parentId}' for '${t.id}' is unresolved at ${ni(t.parentLocation??t.location)}`);s.members.includes(t.id)||s.members.push(t.id)}for(let s of t.values())if(s.parentId&&!e.has(s.parentId))throw Error(`Parent boundary '${s.parentId}' for '${s.id}' is unresolved at ${ni(s.parentLocation??s.location)}`);for(let t of e.values()){let e=this.model.systemBoundaries.get(t.id);e.type=t.type??"rect",e.members=[...t.members],e.classes=[...t.classes],e.styles=[...t.styles]}}materializeNotes(e){let t=0;for(let s of this.noteDrafts){let i=e.get(s.target);if(!i)throw Error(`Note target '${s.target}' is unresolved at ${ni(s.targetLocation)}`);"actor"!==i.kind&&"usecase"!==i.kind&&this.conflict(`Note target '${s.target}' must be an actor or use case, not ${i.kind}`,s.targetLocation,i.location);let n=`note-${t++}`;this.model.notes.set(n,{id:n,target:s.target,label:s.label.text,labelType:s.label.type})}this.model.noteCounter=t}applyClassDefinitions(){for(let e of this.classDefinitions)for(let t of e.ids)this.model.classDefs.set(t,{id:t,styles:[...e.styles]})}applyClassesAndStyles(e,t){for(let s of this.classAssignments)for(let i of s.targets)nr(this.getStylable(i.id,e,t,i.location).classes,s.classes);for(let s of this.styleAssignments)this.getStylable(s.target,e,t,s.location).styles.push(...s.styles)}getStylable(e,t,s,i){let n=t.get(e)?.kind,a="actor"===n?this.model.actors.get(e):"usecase"===n?this.model.useCases.get(e):"boundary"===n?this.model.systemBoundaries.get(e):"json"===n?this.model.jsonNodes.get(e):"edge"===n?s.get(e)?.relationship:void 0;if(!a)throw Error(`Class/style target '${e}' is unresolved or anonymous at ${ni(i)}`);return a}validateRelationship(e,t,s,i){let n=(0,m.K)(e=>"actor"===e||"usecase"===e||"json"===e,"allowed");if(n(t)||this.conflict(`Relationship source '${e.source.id}' cannot be ${t}`,e.source.location,i.get(e.source.id).location),n(s)||this.conflict(`Relationship target '${e.target.id}' cannot be ${s}`,e.target.location,i.get(e.target.id).location),("include"===e.type||"extend"===e.type)&&("usecase"!==t||"usecase"!==s))throw Error(`${e.type} relationship requires use-case endpoints at ${ni(e.location)}`);if("generalization"===e.type&&("actor"!==t&&"usecase"!==t||t!==s))throw Error(`Generalization requires actor-to-actor or use-case-to-use-case endpoints at ${ni(e.location)}`);if("association"===e.type&&("json"===t||"json"===s)&&![0,1,2].includes(e.arrowType))throw Error(`JSON relationship '${e.source.id}' to '${e.target.id}' permits only point, reversed-point, or markerless solid association at ${ni(e.location)}`)}setElementModel(e){if("actor"===e.kind){let t=e.icon?"icon":e.actorType??"normal";this.model.useCases.delete(e.id),this.model.actors.set(e.id,{id:e.id,label:e.label.text,labelType:e.label.type,type:t,...e.icon?{icon:e.icon}:{},business:e.business??!1,...e.stereotype?{stereotype:e.stereotype}:{},...e.parentId?{parentId:e.parentId}:{},classes:[...e.classes],styles:this.model.actors.get(e.id)?.styles??[]})}else this.model.actors.delete(e.id),this.model.useCases.set(e.id,{id:e.id,label:e.label.text,labelType:e.label.type,shape:e.shape??"ellipse",business:e.business??!1,...e.stereotype?{stereotype:e.stereotype}:{},...e.parentId?{parentId:e.parentId}:{},classes:[...e.classes],styles:this.model.useCases.get(e.id)?.styles??[]})}inferMetadataKind(e){let t=new Set(["actor","usecase","boundary","edge"]);for(let s of e.properties)if("icon"===s.key)t.clear(),t.add("actor");else if("animate"===s.key||"animation"===s.key)t.clear(),t.add("edge");else if("type"===s.key)t.clear(),"rect"===s.value||"package"===s.value?t.add("boundary"):("normal"===s.value||"hollow"===s.value||"awesome"===s.value)&&t.add("actor");else{if("business"!==s.key)return;t.delete("boundary"),t.delete("edge")}return 1===t.size?[...t][0]:void 0}invalidMetadata(e,t,s){throw Error(`Metadata property '${s.key}' is invalid for ${t} '${e}' at ${ni(s.location)}`)}registerUnique(e,t,s,i,n){let a=e.get(t);a&&this.conflict(`ID '${t}' is declared more than once (${a.kind} and ${s})`,i,a.location,void 0,na(a)),e.set(t,{kind:s,location:i,generated:n})}recordFirst(e,t,s){let i=e.get(t);(void 0===i||s<i)&&e.set(t,s)}conflict(e,t,s,i,n){throw Error(`${e} at ${ni(t)}${nn(i)}; previous declaration at ${ni(s)}${nn(n)}`)}},nl=iQ.getBaseCstVisitorConstructor(),nc=new class extends nl{constructor(){super(),this.builder=new no(sb),this.source="",this.anonymousEdge=0,this.anonymousNote=0,this.validateVisitor()}static{(0,m.K)(this,"UsecaseVisitor")}build(e,t){this.source=t,this.parentBoundary=void 0,this.anonymousEdge=0,this.anonymousNote=0,this.builder.reset(t),this.visit(e)}start(e){let t=this.tokens(e,"USECASE")[0],s=[];for(let t of this.nodes(e,"line"))s.push(this.visit(t));this.builder.setStatements(s),this.builder.finalize(this.tokenSpan(t))}line(e){let t=this.firstNode(e,"blankLine","commentLine","statement");return this.wrap(t,this.visit(t))}statement(e){return this.visit(this.firstNode(e,"accTitleStatement","accDescrStatement","directionStatement","actorStatement","systemBoundaryStatement","noteStatement","jsonStatement","classDefStatement","classStatement","styleStatement","metadataAssignmentStatement","entityStatement"))}lineEnd(e){}blankLine(e){return{kind:"blank",span:this.tokenSpan(this.tokens(e,"NEWLINE")[0])}}commentLine(e){return{kind:"comment",span:this.tokenSpan(this.tokens(e,"COMMENT")[0])}}accTitleStatement(e){let t=this.tokens(e,"ACC_TITLE_LINE")[0].image;return this.builder.setAccTitle(t.slice(t.indexOf(":")+1).trim()),{kind:"accTitle",span:[0,0]}}accDescrStatement(e){let t=this.tokens(e,"ACC_DESCR_LINE")[0],s=this.tokens(e,"ACC_DESCR_BLOCK")[0],i=t?t.image.slice(t.image.indexOf(":")+1).trim():s.image.slice(s.image.indexOf("{")+1,s.image.lastIndexOf("}")).trim();return this.builder.setAccDescription(i),{kind:"accDescr",span:[0,0]}}actorStatement(e){let t=this.nodes(e,"actorItem"),s=t.map(e=>this.visit(e)),i=this.nodes(e,"relationTail")[0],n=s.map((e,s)=>this.actorOccurrence(t[s],e,!0));for(let e of s)this.builder.addElement(this.actorDraft(e));if(!i)return{kind:"node",span:[0,0],nodes:n};let a=this.visit(i);a.target.explicitDeclaration&&this.builder.addElement(this.entityDraft(a.target));let r=this.relationshipDraft(s[0],a,this.nodeLocation(i));this.builder.addRelationship(r);let o=r.explicitId??`edge-${this.anonymousEdge++}`;return n.push(this.entityOccurrence(this.nodes(i.children,"entityName")[0],a.target,a.target.explicitDeclaration)),{kind:"edge",span:[0,0],nodes:n,edges:[{id:o,span:[0,0],...r.explicitIdLocation?{idSpan:r.explicitIdLocation.span}:{},...r.label?{labelSpan:r.label.span}:{}}]}}actorItem(e){let t=this.visit(this.nodes(e,"actorName")[0]),s=this.nodes(e,"metadata")[0],i=this.nodes(e,"stereotype")[0],n=this.nodes(e,"classSuffix")[0],a=n?this.visit(n):{classes:[],spans:[]};return{...t,...s?{metadata:this.visit(s)}:{},...i?{stereotype:this.visit(i)}:{},classes:a.classes,classSpans:a.spans}}actorName(e){let t=this.tokens(e,"IDENTIFIER")[0],s=this.tokens(e,"PLAIN_STRING")[0]??this.tokens(e,"MARKDOWN_STRING")[0];if(t){let s=this.nodes(e,"nodeLabel")[0],i=s?this.visit(s):this.tokenLabel(t);return{id:t.image,label:i,location:this.tokenLocation(t),generated:!1,classes:[],classSpans:[]}}let i=this.tokenLabel(s);return{id:this.generateId(i.text),label:i,location:this.tokenLocation(s),generated:!0,classes:[],classSpans:[]}}actorDeclarationOnly(e){let t=this.nodes(e,"actorItem"),s=t.map(e=>this.visit(e));for(let e of s)this.builder.addElement(this.actorDraft(e));return{kind:"node",span:[0,0],nodes:s.map((e,s)=>this.actorOccurrence(t[s],e,!0))}}entityStatement(e){let t=this.nodes(e,"entityName"),s=this.visit(t[0]),i=this.nodes(e,"relationTail")[0];if(!i)return s.explicitDeclaration=!0,s.shape??="ellipse",this.builder.addElement(this.entityDraft(s)),{kind:"node",span:[0,0],nodes:[this.entityOccurrence(t[0],s,!0)]};s.explicitDeclaration&&this.builder.addElement(this.entityDraft(s));let n=this.visit(i);n.target.explicitDeclaration&&this.builder.addElement(this.entityDraft(n.target));let a={source:this.endpoint(s),target:this.endpoint(n.target),location:this.nodeLocation(i),...n.explicitId?{explicitId:n.explicitId,explicitIdLocation:n.explicitIdLocation}:{},...n.arrow};this.builder.addRelationship(a);let r=a.explicitId??`edge-${this.anonymousEdge++}`;return{kind:"edge",span:[0,0],nodes:[this.entityOccurrence(t[0],s,s.explicitDeclaration),this.entityOccurrence(this.nodes(i.children,"entityName")[0],n.target,n.target.explicitDeclaration)],edges:[{id:r,span:[0,0],...a.explicitIdLocation?{idSpan:a.explicitIdLocation.span}:{},...a.label?{labelSpan:a.label.span}:{}}]}}entityName(e){let t=this.tokens(e,"IDENTIFIER")[0],s=this.tokens(e,"PLAIN_STRING")[0]??this.tokens(e,"MARKDOWN_STRING")[0],i=this.nodes(e,"nodeLabel")[0],n=this.nodes(e,"useCaseMetadata")[0],a=this.nodes(e,"stereotype")[0],r=this.nodes(e,"classSuffix")[0],o=r?this.visit(r):{classes:[],spans:[]};if(t){let s=i?this.visit(i):this.tokenLabel(t),r=i?this.tokens(e,"LBRACKET").length?"rect":"ellipse":void 0;return{id:t.image,label:s,location:this.tokenLocation(t),generated:!1,...r?{shape:r}:{},...n?{metadata:this.visit(n)}:{},...a?{stereotype:this.visit(a)}:{},classes:o.classes,classSpans:o.spans,explicitDeclaration:!!(r||n||a)}}let l=this.tokenLabel(s);return{id:this.generateId(l.text),label:l,location:this.tokenLocation(s),generated:!0,...n?{metadata:this.visit(n)}:{},...a?{stereotype:this.visit(a)}:{},classes:o.classes,classSpans:o.spans,explicitDeclaration:!!(n||a)}}nodeLabel(e){let t=this.allTokens(e);if(1===t.length&&("PLAIN_STRING"===t[0].tokenType.name||"MARKDOWN_STRING"===t[0].tokenType.name))return this.tokenLabel(t[0]);let s=[t[0].startOffset,(t.at(-1).endOffset??t.at(-1).startOffset)+1];return{text:this.source.slice(s[0],s[1]),type:"text",span:s}}useCaseMetadata(e){return this.visit(this.nodes(e,"metadata")[0])}relationTail(e){let t=this.tokens(e,"IDENTIFIER")[0];return{...t?{explicitId:t.image,explicitIdLocation:this.tokenLocation(t)}:{},arrow:this.visit(this.nodes(e,"arrow")[0]),target:this.visit(this.nodes(e,"entityName")[0])}}arrow(e){return this.visit(this.firstNode(e,"semanticRelation","forwardSolidOperator","backwardSolidOperator","markerlessSolidOperator","forwardCircleOperator","backwardCircleOperator","forwardCrossOperator","backwardCrossOperator"))}edgeLabel(e){return this.nodeLabel(e)}semanticRelation(e){if(this.tokens(e,"GENERALIZATION").length)return{type:"generalization",arrowType:t3.SOLID_ARROW,minlen:1};let t=this.tokens(e,"INCLUDE").length?"include":"extend",s=this.tokens(e,"include"===t?"INCLUDE":"EXTEND")[0];return{type:t,arrowType:t3.SOLID_ARROW,label:{text:t,type:"text",span:this.tokenSpan(s)},minlen:1}}metadata(e){return{properties:this.nodes(e,"metadataProperty").map(e=>this.visit(e)),location:this.ctxLocation(e)}}metadataProperty(e){let t=this.allTokens(e).filter(e=>"COLON"!==e.tokenType.name),s=t[0],i=t[1],n="TRUE"===i.tokenType.name||"FALSE"!==i.tokenType.name&&this.decodePlain(i),a=[s.startOffset,(i.endOffset??i.startOffset)+1];return{key:this.decodePlain(s),value:n,span:a,keySpan:this.contentSpan(s),valueSpan:this.contentSpan(i),location:this.tokenLocation(s)}}metadataSeparator(e){}systemBoundaryStatement(e){let t=this.visit(this.nodes(e,"systemBoundaryName")[0]),s=this.nodes(e,"classSuffix")[0],i=s?this.visit(s):{classes:[],spans:[]};t.classes=i.classes,this.builder.addBoundary(t);let n=this.parentBoundary;this.parentBoundary={id:t.id,location:t.location};let a=this.nodes(e,"systemBoundaryContent")[0],r=a?this.visit(a):[];this.parentBoundary=n;let o=this.tokens(e,"END")[0],l=this.nodes(e,"metadata")[0],c=l?this.visit(l):void 0,h={kind:"group",span:[0,0],group:t.id,idSpan:t.location.span,titleSpan:t.label.span,endSpan:this.tokenSpan(o),classSpans:i.spans,...c?{metadata:c.properties.map(({key:e,span:t,keySpan:s,valueSpan:i})=>({key:e,span:t,keySpan:s,valueSpan:i}))}:{},...r.length?{children:r}:{}};return c&&this.builder.addMetadataAssignment(t.id,t.location,c,h),h}systemBoundaryName(e){let t=this.tokens(e,"IDENTIFIER")[0];if(t){let s=this.nodes(e,"nodeLabel")[0];return{id:t.image,label:s?this.visit(s):this.tokenLabel(t),location:this.tokenLocation(t),generated:!1,classes:[]}}let s=this.tokens(e,"PLAIN_STRING")[0]??this.tokens(e,"MARKDOWN_STRING")[0],i=this.tokenLabel(s);return{id:this.generateId(i.text),label:i,location:this.tokenLocation(s),generated:!0,classes:[]}}systemBoundaryContent(e){return[...this.nodes(e,"blankLine"),...this.nodes(e,"commentLine"),...this.nodes(e,"boundaryElement")].sort((e,t)=>(e.location?.startOffset??0)-(t.location?.startOffset??0)).map(e=>this.wrap(e,this.visit(e)))}boundaryElement(e){let t=this.nodes(e,"actorDeclarationOnly")[0];if(t)return this.visit(t);let s=this.nodes(e,"entityName")[0],i=this.visit(s);return i.explicitDeclaration=!0,i.shape??="ellipse",this.builder.addElement(this.entityDraft(i)),{kind:"node",span:[0,0],nodes:[this.entityOccurrence(s,i,!0)]}}metadataAssignmentStatement(e){let t=this.visit(this.nodes(e,"metadataAssignmentTarget")[0]),s=this.visit(this.nodes(e,"metadata")[0]),i={kind:"metadata",span:[0,0],nodes:[{id:t.id,span:t.location.span,idSpan:t.location.span}],metadata:s.properties.map(({key:e,span:t,keySpan:s,valueSpan:i})=>({key:e,span:t,keySpan:s,valueSpan:i}))};return this.builder.addMetadataAssignment(t.id,t.location,s,i),i}metadataAssignmentTarget(e){let t=this.allTokens(e)[0],s=this.tokenLabel(t);return{id:"IDENTIFIER"===t.tokenType.name?t.image:this.generateId(s.text),location:this.tokenLocation(t)}}noteStatement(e){let t=this.tokens(e,"IDENTIFIER")[0],s=this.visit(this.nodes(e,"nodeLabel")[0]);return this.builder.addNote({target:t.image,targetLocation:this.tokenLocation(t),label:s,location:this.ctxLocation(e)}),{kind:"note",span:[0,0],ref:`note-${this.anonymousNote++}`,refSpan:s.span,nodes:[{id:t.image,span:this.tokenSpan(t),idSpan:this.tokenSpan(t)}]}}stereotype(e){let t=this.tokens(e,"STEREOTYPE_TEXT")[0];return{value:t.image.trim(),span:this.tokenSpan(t)}}classSuffix(e){let t=this.tokens(e,"IDENTIFIER");return{classes:t.map(e=>e.image),spans:t.map(e=>this.tokenSpan(e))}}jsonStatement(e){let t=this.tokens(e,"JSON_DECLARATION_START")[0],s=this.tokens(e,"JSON_OBJECT_LITERAL")[0],i=/^json[\t ]+(\w+)/.exec(t.image),n=i[1],a=i[0].length-n.length,r={span:[t.startOffset+a,t.startOffset+a+n.length],line:t.startLine??1,column:(t.startColumn??1)+a},o=i5(s.image,s.startLine??1,s.startColumn??1),l=this.nodes(e,"classSuffix")[0],c=l?this.visit(l):{classes:[],spans:[]},h={id:n,value:o.value,propertyOrder:o.propertyOrder,location:r,classes:c.classes};return this.builder.addJson(h),{kind:"json",span:[0,0],nodes:[{id:n,span:r.span,idSpan:r.span,defines:!0,classSpans:c.spans}],classSpans:c.spans}}directionStatement(e){let t=this.allTokens(e).find(e=>["TD","TB","BT","RL","LR"].includes(e.tokenType.name));return this.builder.setDirection(t.image),{kind:"direction",span:[0,0]}}classDefStatement(e){let t=this.tokens(e,"IDENTIFIER"),s=this.visit(this.nodes(e,"styles")[0]);return this.builder.addClassDef(t.map(e=>e.image),s),{kind:"classDef",span:[0,0],ref:t[0].image,refSpan:this.tokenSpan(t[0])}}classStatement(e){let t=this.tokens(e,"IDENTIFIER"),s=1;for(;s<t.length&&this.source.slice((t[s-1].endOffset??t[s-1].startOffset)+1,t[s].startOffset).includes(",");s++);let i=t.slice(0,s).map(e=>({id:e.image,location:this.tokenLocation(e)})),n=t.slice(s).map(e=>e.image);return this.builder.addClassAssignment(i,n),{kind:"classAssign",span:[0,0],ref:n[0],refSpan:this.tokenSpan(t[s]),nodes:i.map(({id:e,location:t})=>({id:e,span:t.span,idSpan:t.span}))}}styleStatement(e){let t=this.tokens(e,"IDENTIFIER")[0],s=this.visit(this.nodes(e,"styles")[0]);return this.builder.addStyleAssignment(t.image,this.tokenLocation(t),s),{kind:"style",span:[0,0],nodes:[{id:t.image,span:this.tokenSpan(t),idSpan:this.tokenSpan(t)}]}}styles(e){return this.nodes(e,"styleValue").map(e=>this.visit(e))}styleValue(e){let t=this.allTokens(e),s=[t[0].startOffset,(t.at(-1).endOffset??t.at(-1).startOffset)+1];return this.source.slice(s[0],s[1]).replaceAll("\\,",",")}styleComponent(e){return this.allTokens(e).map(e=>e.image).join("")}forwardSolidOperator(e){let t=this.tokens(e,"FORWARD_SOLID")[0];return{type:"association",arrowType:t3.SOLID_ARROW,minlen:this.solidMinlen(t)}}backwardSolidOperator(e){let t=this.tokens(e,"BACKWARD_SOLID")[0],s=this.nodes(e,"edgeLabel")[0],i=s?this.tokens(e,"MARKERLESS_SOLID").at(-1):t;return{type:"association",arrowType:t3.BACK_ARROW,minlen:this.solidMinlen(i),...s?{label:this.visit(s)}:{}}}markerlessSolidOperator(e){let t=this.nodes(e,"edgeLabel")[0],s=this.allTokens(e);if(!t)return{type:"association",arrowType:t3.LINE_SOLID,minlen:this.solidMinlen(this.tokens(e,"MARKERLESS_SOLID")[0])};let i=s.at(-1),n="FORWARD_SOLID"===i.tokenType.name?t3.SOLID_ARROW:"FORWARD_CIRCLE"===i.tokenType.name?t3.CIRCLE_ARROW:"FORWARD_CROSS"===i.tokenType.name?t3.CROSS_ARROW:t3.LINE_SOLID;return{type:"association",arrowType:n,label:this.visit(t),minlen:n===t3.SOLID_ARROW||n===t3.LINE_SOLID?this.solidMinlen(i):1}}forwardCircleOperator(e){return{type:"association",arrowType:t3.CIRCLE_ARROW,minlen:1}}backwardCircleOperator(e){let t=this.nodes(e,"edgeLabel")[0];return{type:"association",arrowType:t3.CIRCLE_ARROW_REVERSED,minlen:1,...t?{label:this.visit(t)}:{}}}forwardCrossOperator(e){return{type:"association",arrowType:t3.CROSS_ARROW,minlen:1}}backwardCrossOperator(e){let t=this.nodes(e,"edgeLabel")[0];return{type:"association",arrowType:t3.CROSS_ARROW_REVERSED,minlen:1,...t?{label:this.visit(t)}:{}}}actorDraft(e){return{id:e.id,kind:"actor",label:e.label,location:e.location,generated:e.generated,...this.parentBoundary?{parentId:this.parentBoundary.id,parentLocation:this.parentBoundary.location}:{},...e.metadata?{metadata:e.metadata}:{},...e.stereotype?{stereotype:e.stereotype.value,stereotypeSpan:e.stereotype.span}:{},classes:e.classes}}entityDraft(e){return{id:e.id,kind:"usecase",label:e.label,location:e.location,generated:e.generated,...this.parentBoundary?{parentId:this.parentBoundary.id,parentLocation:this.parentBoundary.location}:{},...e.shape?{shape:e.shape}:{},...e.metadata?{metadata:e.metadata}:{},...e.stereotype?{stereotype:e.stereotype.value,stereotypeSpan:e.stereotype.span}:{},classes:e.classes}}endpoint(e,t=e.explicitDeclaration??!0){return{id:e.id,label:e.label,location:e.location,generated:e.generated,declaration:t,classesOnReference:e.classes.length>0}}relationshipDraft(e,t,s){return{source:this.endpoint(e,!0),target:this.endpoint(t.target),location:s,...t.explicitId?{explicitId:t.explicitId,explicitIdLocation:t.explicitIdLocation}:{},...t.arrow}}actorOccurrence(e,t,s){return{id:t.id,span:this.nodeSpan(e),idSpan:t.location.span,labelSpan:t.label.span,...s?{defines:!0}:{},...t.stereotype?{stereotypeSpan:t.stereotype.span}:{},...t.metadata?{metadata:t.metadata.properties.map(({key:e,span:t,keySpan:s,valueSpan:i})=>({key:e,span:t,keySpan:s,valueSpan:i}))}:{},...t.classSpans.length?{classSpans:t.classSpans}:{}}}entityOccurrence(e,t,s){return this.actorOccurrence(e,t,s)}wrap(e,t){if("blank"===t.kind||"comment"===t.kind)return t;for(let s of(t.span=this.nodeSpan(e),t.edges??[]))s.span=t.span;return t}tokenLabel(e){let t="MARKDOWN_STRING"===e.tokenType.name?"markdown":"text",s="markdown"===t?2:+("PLAIN_STRING"===e.tokenType.name),i=this.tokenSpan(e,s);return{text:this.source.slice(i[0],i[1]),type:t,span:i}}decodePlain(e){return"PLAIN_STRING"===e.tokenType.name?e.image.slice(1,-1):e.image}contentSpan(e){return this.tokenSpan(e,"PLAIN_STRING"===e.tokenType.name?1:2*("MARKDOWN_STRING"===e.tokenType.name))}generateId(e){return e.replace(/\W/g,"_")}solidMinlen(e){return Math.max(1,(e.image.match(/-/g)?.length??2)-1)}nodeLocation(e){let t=this.allTokens(e.children)[0];return{span:this.nodeSpan(e),line:t.startLine??1,column:t.startColumn??1}}ctxLocation(e){let t=this.allTokens(e).filter(e=>"NEWLINE"!==e.tokenType.name&&"EOF"!==e.tokenType.name),s=t[0],i=t.at(-1);return{span:[s.startOffset,Math.min(this.source.length,(i.endOffset??i.startOffset+i.image.length-1)+1)],line:s.startLine??1,column:s.startColumn??1}}tokenLocation(e){let t="PLAIN_STRING"===e.tokenType.name?1:2*("MARKDOWN_STRING"===e.tokenType.name);return{span:this.tokenSpan(e,t),line:e.startLine??1,column:(e.startColumn??1)+t}}nodeSpan(e){let t=this.allTokens(e.children).filter(e=>"NEWLINE"!==e.tokenType.name&&"EOF"!==e.tokenType.name),s=t[0],i=t.at(-1);if(!s||!i)throw Error("Usecase CST node has no source token");return[s.startOffset,Math.min(this.source.length,(i.endOffset??i.startOffset+i.image.length-1)+1)]}tokenSpan(e,t=0){return[e.startOffset+t,Math.min(this.source.length,(e.endOffset??e.startOffset+e.image.length-1)+1-t)]}nodes(e,t){return(e[t]??[]).filter(e=>"children"in e)}tokens(e,t){return(e[t]??[]).filter(e=>"tokenTypeIdx"in e)}firstNode(e,...t){for(let s of t){let t=this.nodes(e,s)[0];if(t)return t}throw Error(`Usecase CST is missing one of: ${t.join(", ")}`)}allTokens(e){let t=[];for(let s of Object.values(e))for(let e of s)"tokenTypeIdx"in e?t.push(e):t.push(...this.allTokens(e.children));return t.sort((e,t)=>e.startOffset-t.startOffset)}},nh={parse:(0,m.K)(async e=>{sb.clear(),iQ.input=[];try{t6({diagramType:"usecase",lexer:iq,parser:iQ,entry:(0,m.K)(()=>iQ.start(),"entry"),visit:(0,m.K)(t=>nc.build(t,e),"visit")},e)}catch(s){sb.clear();let t=iQ.errors[0];if(t){let{token:i}=t,n=t2(i.startOffset)?i.startOffset:e.length,a=t2(i.endOffset)?i.endOffset+1:n,r=t2(i.startLine)?i.startLine:e.slice(0,n).split(/\r\n|\r|\n/).length,o=Math.max(e.lastIndexOf("\n",n-1),e.lastIndexOf("\r",n-1)),l=t2(i.startColumn)?i.startColumn:n-o,c=s instanceof Error?s.message:String(s);throw Error(`${c} at line ${r}, column ${l} [${n},${a})`)}throw s}},"parse")},nd=["point","circle","cross","extension"],nu={usecaseActor:!0,usecaseActorHollow:!0,usecaseActorAwesome:!0,usecaseActorIcon:!0},np=(0,m.K)((e,t)=>{let[s,i]=[e,t].map(e=>e.replace(/[^\w-]+/g,"_").replace(/^_+|_+$/g,"")||"element");return`usecase-${s}-${i}`},"usecaseDomId"),nf=(0,m.K)(e=>`usecase-${e.replace(/[^\w-]+/g,"_").replace(/^_+|_+$/g,"")||"element"}`,"usecaseNodeDomId"),nm=(0,m.K)((e,t)=>"markdown"!==t?e:(0,h.O6)(e).map(e=>e.map(e=>e.content).join(" ")).join("\n"),"getAccessibleLabel"),nE=(0,m.K)(e=>{let t=nm(e.label??e.id,e.labelType);if(nu[e.shape]){let s=e.actorType&&"normal"!==e.actorType?`${e.actorType} `:"",i=e.business?"business ":"",n=e.stereotype?`, stereotype ${e.stereotype}`:"";return`${i}${s}actor ${t}${n}`}if("note"===e.shape)return`Note for ${e.noteTargetLabel??e.noteTarget??""}: ${t}`;if("usecaseJsonTable"===e.shape){let s=(e.jsonRows??[]).map(e=>`${e.accessibleKey}: ${e.value}`).join("; ");return s?`${t}: ${s}`:t}let s=e.stereotype?`, stereotype ${e.stereotype}`:"";return`${e.business?"business ":""}use case ${t}${s}`},"getUsecaseNodeAccessibleName"),nT=(0,m.K)(e=>`${e.boundaryType} system boundary ${nm(e.label??e.id,e.labelType)}`,"getUsecaseBoundaryAccessibleName"),ng=(0,m.K)(e=>{if("note"===e.relationshipType)return"";let t="association"===e.relationshipType&&e.label?`association ${nm(e.label,e.labelType)}`:e.relationshipType;return`${t} from ${e.sourceLabel} to ${e.targetLabel}`},"getUsecaseEdgeAccessibleName"),ny=(0,m.K)(e=>e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">"),"escapePlainLabel"),nA=(0,m.K)(e=>e.replace(/([*[\\\]_`])/g,"\\$1"),"escapeMarkdownMarkers"),nS=(0,m.K)((e,t)=>{for(let s of(e.diagramId=t,e.markers=[...nd],e.nodes))if(s.domId=nf(s.id),void 0!==s.label&&"text"===s.labelType&&(s.label=ny(s.label)),s.stereotype&&(s.stereotype=ny(s.stereotype)),s.isGroup||"usecaseJsonTable"!==s.shape||(s.jsonRows=s.jsonRows?.map(e=>({...e,key:ny(e.key),value:ny(e.value)}))),!s.isGroup&&("usecaseEllipse"===s.shape||"rect"===s.shape)&&s.stereotype){let e=s.label??ny(s.id);s.label=`\xab${nA(s.stereotype)}\xbb<br/>${"text"===s.labelType?nA(e):e}`,s.labelType="markdown",s.hasFoldedStereotype=!0,delete s.stereotype}for(let t of e.edges)void 0!==t.label&&"text"===t.labelType&&(t.label=ny(t.label));return e},"prepareUsecaseLayoutData"),nL=(0,m.K)((e,t,s)=>{for(let i of t.nodes){let n="string"==typeof i.domId?i.domId:np(t.diagramId,i.id),a=e.select(`#${n}`),r=i.isGroup?"boundary":nu[i.shape]?"actor":"note"===i.shape?"note":"usecaseJsonTable"===i.shape?"json":"usecase",o=s.nodes.get(i.id)??i.id;if(a.attr("data-usecase-id",i.id).attr("data-usecase-kind",r).attr("role","img").attr("aria-label",o),!i.isGroup&&("usecaseEllipse"===i.shape||"rect"===i.shape)&&"hasFoldedStereotype"in i&&!0===i.hasFoldedStereotype){let e=a.node(),t=e?.querySelector(".nodeLabel"),s=t?.querySelector("p")??t,i=s?.firstChild;if(s&&i?.nodeType===3){let e=s.ownerDocument.createElement("span");e.className="usecase-stereotype",s.insertBefore(e,i),e.appendChild(i)}else e?.querySelector(".label tspan tspan, .label tspan")?.classList.add("usecase-stereotype")}}let i=new Map(t.edges.map(e=>[e.id,e]));e.selectAll('path[data-et="edge"]').each(function(){let e=i.get(this.getAttribute("data-id")??"");if(!e)return;let n=(0,t1.Ltv)(this);n.attr("id",np(t.diagramId,e.id)).attr("data-usecase-id",e.id).attr("data-usecase-kind",e.internal?"note-connector":"relationship"),e.internal?n.attr("aria-hidden","true"):n.attr("role","img").attr("aria-label",s.edges.get(e.id)??e.id)})},"annotateUsecaseElements"),nO=(0,m.K)((e,t)=>{e.style("--mermaid-usecase-actor-font-size",`${t.actorFontSize}px`).style("--mermaid-usecase-actor-font-family",t.actorFontFamily).style("--mermaid-usecase-actor-font-weight",t.actorFontWeight).style("--mermaid-usecase-font-size",`${t.usecaseFontSize}px`).style("--mermaid-usecase-font-family",t.usecaseFontFamily).style("--mermaid-usecase-font-weight",t.usecaseFontWeight)},"applyUsecaseFonts"),nR=(0,m.K)(async(e,t,s,i)=>{f.R.info("Drawing usecase diagram (unified)",t);let{layout:n}=(0,p.D7)(),a=i.db,r=a.getData(),h=new Map(r.nodes.map(e=>[e.id,nm(e.label??e.id,e.labelType)])),d={nodes:new Map(r.nodes.map(e=>[e.id,e.isGroup?nT(e):nE("note"===e.shape?{...e,noteTargetLabel:h.get(e.noteTarget??"")}:e)])),edges:new Map(r.edges.map(e=>[e.id,ng({...e,sourceLabel:h.get(e.source)??e.sourceLabel,targetLabel:h.get(e.target)??e.targetLabel})]))},m=(0,o.A)(t,r.config.securityLevel);r.layoutAlgorithm=(0,c.q7)(n),nS(r,t),nO(m,r),await (0,c.XX)(r,m),nL(m,r,d);let E=r.diagramPadding;u._K.insertTitle(m,"usecaseDiagramTitleText",0,a.getDiagramTitle?.()??""),(0,l.P)(m,E,"usecaseDiagram",r.useMaxWidth),nO(m,r)},"draw"),nk=(0,m.K)(e=>({actorBkg:e.usecaseActorBkg??e.actorBkg??e.mainBkg,actorBorder:e.usecaseActorBorder??e.actorBorder??e.primaryColor,bkg:e.usecaseBkg??e.mainBkg,border:e.usecaseBorder??e.nodeBorder??e.primaryColor,boundaryBkg:e.usecaseBoundaryBkg??e.clusterBkg,boundaryBorder:e.usecaseBoundaryBorder??e.clusterBorder,includeLine:e.usecaseIncludeLine??e.lineColor,extendLine:e.usecaseExtendLine??e.lineColor}),"roleColors"),nI=(0,m.K)(e=>{let{theme:t,bkgColorArray:s,borderColorArray:i}=e;if(!(0,d.P1)(t,i))return"";let n=(0,p.zj)().usecase?.colorScheme==="rotate",a=(0,d.rq)(e.look),r="handDrawn"===a,o=(0,d.Ic)(s),l="";for(let e=0;e<(0,d.Hu)(i);e++){let t=i[e],c=o?`fill: ${s[e%s.length]};`:"",h=`[data-look="${a}"][data-color-id="color-${e}"]`;l+=`
|
|
58
58
|
|
|
59
59
|
& ${h}.system-boundary rect.boundary-body,
|
|
60
60
|
& ${h}.system-boundary rect.boundary-tab,
|
|
@@ -306,4 +306,4 @@ ${s?"":`
|
|
|
306
306
|
fill: ${e.mainBkg};
|
|
307
307
|
stroke: ${e.lineColor};
|
|
308
308
|
}
|
|
309
|
-
`},"getStyles")}}}]);
|
|
309
|
+
`},"getStyles")}},21403:(e,t,s)=>{s.d(t,{P:()=>r});var i=s(94268),n=s(1642),a=s(73084),r=(0,a.K)((e,t,s,a)=>{e.attr("class",s);let{width:r,height:c,x:h,y:d}=o(e,t);(0,i.a$)(e,c,r,a);let u=l(h,d,r,c,t);e.attr("viewBox",u),n.R.debug(`viewBox configured: ${u} with padding: ${t}`)},"setupViewPortForSVG"),o=(0,a.K)((e,t)=>{let s=e.node()?.getBBox()||{width:0,height:0,x:0,y:0};return{width:s.width+2*t,height:s.height+2*t,x:s.x,y:s.y}},"calculateDimensionsWithPadding"),l=(0,a.K)((e,t,s,i,n)=>`${e-n} ${t-n} ${s} ${i}`,"createViewBox")},60736:(e,t,s)=>{s.d(t,{A:()=>a});var i=s(73084),n=s(39433),a=(0,i.K)((e,t)=>{let s;return"sandbox"===t&&(s=(0,n.Ltv)("#i"+e)),("sandbox"===t?(0,n.Ltv)(s.nodes()[0].contentDocument.body):(0,n.Ltv)("body")).select(`[id="${e}"]`)},"getDiagramElement")}}]);
|