scip-query 0.24.0 → 0.26.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +247 -1
- package/README.md +111 -124
- package/dist/augment-vue-worker.js +1 -1
- package/dist/by-kind-PRVFAGTQ.js +2 -0
- package/dist/call-graph-DVPAQV2F.js +2 -0
- package/dist/{call-graph-evidence-BociKRpF.d.ts → call-graph-evidence-CUtj8V2I.d.ts} +1 -1
- package/dist/chunk-2FSBGL5P.js +2 -0
- package/dist/chunk-2HLAFUCY.js +2 -0
- package/dist/chunk-2IWUT6CJ.js +3 -0
- package/dist/chunk-2KNN7GTQ.js +2 -0
- package/dist/chunk-2LHXRE2B.js +8 -0
- package/dist/{chunk-E65ELFKU.js → chunk-2YXE77TJ.js} +2 -2
- package/dist/chunk-36SGVCGX.js +2 -0
- package/dist/chunk-3ABBFPTP.js +2 -0
- package/dist/chunk-3IVFU4FD.js +3 -0
- package/dist/chunk-3JIQS44J.js +7 -0
- package/dist/chunk-3ZRB6DNK.js +7 -0
- package/dist/{chunk-6YTSKJJ3.js → chunk-42EOW5VI.js} +1 -1
- package/dist/{chunk-BHKK5RJY.js → chunk-4BHGBMNO.js} +2 -2
- package/dist/chunk-4BP3UBDG.js +2 -0
- package/dist/chunk-4D6RO7G4.js +2 -0
- package/dist/chunk-4FEWQ6RH.js +2 -0
- package/dist/chunk-4IGEOBG7.js +2 -0
- package/dist/chunk-4QZXBUKC.js +2 -0
- package/dist/chunk-4WBDEVX2.js +4 -0
- package/dist/chunk-4WCUBZU3.js +8 -0
- package/dist/chunk-4WTUBQ36.js +40 -0
- package/dist/chunk-4XQ4O6IM.js +3 -0
- package/dist/chunk-55UQAMZO.js +4 -0
- package/dist/chunk-5D2LVK7O.js +125 -0
- package/dist/chunk-5IYJ56TT.js +2 -0
- package/dist/chunk-5PLMJC7Q.js +2 -0
- package/dist/chunk-5TNQJUR2.js +5 -0
- package/dist/chunk-62BDNPMI.js +2 -0
- package/dist/chunk-64DZ5TXR.js +7 -0
- package/dist/chunk-65245JCM.js +2 -0
- package/dist/chunk-6FFVZZL4.js +2 -0
- package/dist/chunk-6KO5JHAR.js +2 -0
- package/dist/chunk-6LRXOOSX.js +2 -0
- package/dist/chunk-6LSEIIF7.js +2 -0
- package/dist/chunk-6YMNWD3H.js +6 -0
- package/dist/chunk-72AD6ZRR.js +5 -0
- package/dist/chunk-73AAKPUC.js +4 -0
- package/dist/chunk-76CZ77DF.js +2 -0
- package/dist/chunk-7VPEEAAG.js +2 -0
- package/dist/chunk-7WTPQ4NX.js +14 -0
- package/dist/chunk-7Y5T6XDP.js +2 -0
- package/dist/chunk-A2IIGFMJ.js +5 -0
- package/dist/chunk-AB5KCTEV.js +2 -0
- package/dist/chunk-AC566WBP.js +6 -0
- package/dist/chunk-AGWFSTXC.js +3 -0
- package/dist/chunk-AOSIYPTA.js +2 -0
- package/dist/chunk-AUVEWPIF.js +2 -0
- package/dist/chunk-B56T42J3.js +25 -0
- package/dist/chunk-BIQEF5NE.js +2 -0
- package/dist/chunk-BL6XJKTA.js +3 -0
- package/dist/chunk-BMKOQJRI.js +2 -0
- package/dist/chunk-BOZ4EXBB.js +3 -0
- package/dist/chunk-BUTWYEPH.js +2 -0
- package/dist/chunk-BZB4QPIP.js +2 -0
- package/dist/{chunk-6ILKOOGH.js → chunk-CE357GEE.js} +4 -4
- package/dist/chunk-CFN45HFP.js +2 -0
- package/dist/chunk-CFYMZFXT.js +368 -0
- package/dist/chunk-CN5EH7O3.js +2 -0
- package/dist/chunk-D254DNNQ.js +4 -0
- package/dist/chunk-D3FDISIC.js +2 -0
- package/dist/chunk-D3NX5XIE.js +3 -0
- package/dist/chunk-DA7RPPDF.js +3 -0
- package/dist/chunk-DDMC3FON.js +3 -0
- package/dist/chunk-DIO3FUSG.js +2 -0
- package/dist/chunk-DJ2NNSUK.js +3 -0
- package/dist/chunk-DKYQIM3C.js +18 -0
- package/dist/{chunk-OHIV323X.js → chunk-DOOEL2IV.js} +2 -2
- package/dist/chunk-DVFP6PZI.js +2 -0
- package/dist/chunk-E3FDPXZK.js +2 -0
- package/dist/chunk-E7YNJLCB.js +2 -0
- package/dist/chunk-EFGW5JPH.js +2 -0
- package/dist/chunk-EJVTR244.js +13 -0
- package/dist/chunk-EOV7RTRZ.js +2 -0
- package/dist/chunk-ETOIKRHO.js +2 -0
- package/dist/chunk-EYK3ZAO2.js +3 -0
- package/dist/chunk-F2V2LPET.js +52 -0
- package/dist/chunk-F4LUHJTF.js +2 -0
- package/dist/chunk-F4PUT6IT.js +2 -0
- package/dist/chunk-F56GCXXS.js +5 -0
- package/dist/chunk-FC2EVQRM.js +2 -0
- package/dist/chunk-FL7NBMHP.js +3 -0
- package/dist/chunk-FMRN2TRL.js +3 -0
- package/dist/chunk-FVULPZDF.js +20 -0
- package/dist/chunk-GCKCF5FL.js +43 -0
- package/dist/chunk-GH2PYF46.js +2 -0
- package/dist/chunk-GHJAGXIP.js +2 -0
- package/dist/{chunk-2GJSD5GY.js → chunk-GMVSHUKZ.js} +2 -2
- package/dist/chunk-GS6KDO4R.js +2 -0
- package/dist/chunk-GUUBXNN7.js +2 -0
- package/dist/chunk-GVWX5T43.js +80 -0
- package/dist/chunk-GZKFETP5.js +2 -0
- package/dist/chunk-H4EQHO6J.js +9 -0
- package/dist/chunk-H73WY2RM.js +2 -0
- package/dist/chunk-H75GSPRV.js +60 -0
- package/dist/chunk-HDR3AHSV.js +61 -0
- package/dist/chunk-HQBSL74Y.js +2 -0
- package/dist/chunk-HRRFKWPZ.js +2 -0
- package/dist/chunk-HXENDJC6.js +2 -0
- package/dist/chunk-IIBAZNSW.js +21 -0
- package/dist/chunk-INLMWEUU.js +12 -0
- package/dist/chunk-IWQPAF4F.js +2 -0
- package/dist/chunk-IZJ6YUKP.js +35 -0
- package/dist/chunk-J2TMAIN5.js +60 -0
- package/dist/chunk-J5FJMODQ.js +142 -0
- package/dist/chunk-J7HZPIO3.js +2 -0
- package/dist/chunk-JEVRKFRL.js +2 -0
- package/dist/chunk-JFXSGAEB.js +30 -0
- package/dist/chunk-JVRTHGFS.js +3 -0
- package/dist/chunk-JYWEX7RR.js +360 -0
- package/dist/chunk-K3YL22N6.js +2 -0
- package/dist/chunk-K4CN7GXK.js +12 -0
- package/dist/chunk-K5TBVXU4.js +30 -0
- package/dist/chunk-KDDIE2DP.js +9 -0
- package/dist/chunk-KHWRRPV4.js +2 -0
- package/dist/chunk-KI6NBKDY.js +14 -0
- package/dist/chunk-KU3QRSTH.js +2 -0
- package/dist/chunk-KZBJWZJB.js +2 -0
- package/dist/chunk-L7GFM3NP.js +3 -0
- package/dist/chunk-LMO6PK3V.js +35 -0
- package/dist/chunk-LN4YXJJU.js +2 -0
- package/dist/chunk-LOVIZBJ4.js +43 -0
- package/dist/chunk-LPCRK4A2.js +11 -0
- package/dist/chunk-MMHZKBFA.js +2 -0
- package/dist/{chunk-A4WEAK35.js → chunk-MOQQBQRD.js} +2 -2
- package/dist/chunk-N2WN6I3L.js +2 -0
- package/dist/chunk-N3ORQT7L.js +2 -0
- package/dist/chunk-NAZ3RAIW.js +2 -0
- package/dist/chunk-NDUNO5JQ.js +2 -0
- package/dist/chunk-NEIWRNAZ.js +4 -0
- package/dist/chunk-NJJMVD65.js +2 -0
- package/dist/chunk-NLOQOBXI.js +20 -0
- package/dist/chunk-NOLZOVCU.js +2 -0
- package/dist/chunk-NOWINRRN.js +2 -0
- package/dist/chunk-NZAXKGRL.js +16 -0
- package/dist/chunk-O2C4UILI.js +2 -0
- package/dist/chunk-O3RHA6ZT.js +3 -0
- package/dist/chunk-O4UZSPPI.js +3 -0
- package/dist/chunk-OGFV2BUX.js +2 -0
- package/dist/chunk-OZCJXZK6.js +499 -0
- package/dist/chunk-P6ODM7BY.js +2 -0
- package/dist/{chunk-GHNPACNP.js → chunk-PAVGPRHJ.js} +2 -2
- package/dist/chunk-PH52RA7D.js +2 -0
- package/dist/chunk-PKN354TH.js +3 -0
- package/dist/chunk-PWOASWEG.js +11 -0
- package/dist/chunk-QIWXRW72.js +2 -0
- package/dist/chunk-QJRMOK5N.js +2 -0
- package/dist/{chunk-YXPUP5G2.js → chunk-QOIXNWQR.js} +2 -2
- package/dist/chunk-QXEUDXBT.js +3 -0
- package/dist/chunk-QYUVVBMR.js +6 -0
- package/dist/chunk-QZ7KQZRN.js +2 -0
- package/dist/chunk-R6LQBUDH.js +2 -0
- package/dist/chunk-RBS42E55.js +20 -0
- package/dist/chunk-RSJKPCFX.js +26 -0
- package/dist/chunk-S6CZA3MV.js +2 -0
- package/dist/chunk-STMVAHJP.js +2 -0
- package/dist/chunk-SYVPTTVW.js +2 -0
- package/dist/chunk-T6DK3ZP7.js +2 -0
- package/dist/chunk-TKD34PHN.js +4 -0
- package/dist/chunk-TNNQFH7W.js +2 -0
- package/dist/chunk-TNV7SSUF.js +2 -0
- package/dist/chunk-TO7ZR3EH.js +8 -0
- package/dist/chunk-TOU3CHK4.js +2 -0
- package/dist/chunk-TRBI4UKT.js +2 -0
- package/dist/chunk-TZCVNCAN.js +4 -0
- package/dist/chunk-U4LZA5LL.js +3 -0
- package/dist/chunk-U5RIG3JP.js +3 -0
- package/dist/chunk-UP5KXN2I.js +2 -0
- package/dist/chunk-UQFR3NDH.js +5 -0
- package/dist/chunk-UXYXF7GV.js +2 -0
- package/dist/chunk-VB3GOKOS.js +2 -0
- package/dist/{chunk-4FR6GQIT.js → chunk-VF5JZICY.js} +2 -2
- package/dist/chunk-VTY3VK6E.js +2 -0
- package/dist/chunk-VX2O4RIS.js +2 -0
- package/dist/chunk-WKPV2TDZ.js +2 -0
- package/dist/chunk-WOFQ5DTB.js +2 -0
- package/dist/chunk-WS4C6TCK.js +2 -0
- package/dist/chunk-WXU3DGPU.js +2 -0
- package/dist/{chunk-ATXPTSEI.js → chunk-X6RMKHJQ.js} +7 -7
- package/dist/{chunk-44IETFOU.js → chunk-XHMN6ZX7.js} +2 -2
- package/dist/chunk-XHTVFLWW.js +2 -0
- package/dist/chunk-XKIDJCIK.js +2 -0
- package/dist/chunk-XTYTYZPT.js +2 -0
- package/dist/chunk-Y2JHHTTA.js +2 -0
- package/dist/chunk-YGVRMGYN.js +4 -0
- package/dist/chunk-YNQCGEQE.js +2 -0
- package/dist/chunk-YOQVEXVE.js +14 -0
- package/dist/chunk-YRT2WLYY.js +2 -0
- package/dist/chunk-YTAP5Y2G.js +2 -0
- package/dist/chunk-YTYWI7VB.js +2 -0
- package/dist/chunk-YULZRALL.js +2 -0
- package/dist/chunk-Z33WQG4Q.js +2 -0
- package/dist/chunk-ZGTYGDMF.js +16 -0
- package/dist/chunk-ZHMRSZFD.js +43 -0
- package/dist/chunk-ZHSP366W.js +10 -0
- package/dist/chunk-ZIBYCYKK.js +7 -0
- package/dist/chunk-ZLADLUE6.js +3 -0
- package/dist/chunk-ZO4YXUT6.js +4 -0
- package/dist/{chunk-MZPXPSUJ.js → chunk-ZR4HBC2H.js} +2 -2
- package/dist/cli-main.js +6 -6
- package/dist/cli.js +1 -1
- package/dist/{code-B17qEMbt.d.ts → code-BNyrCF3_.d.ts} +3 -2
- package/dist/code-IL5WH3NZ.js +2 -0
- package/dist/code-result-json-ANTBEDFP.js +4 -0
- package/dist/command-descriptors-HEEMDHTU.js +222 -0
- package/dist/deps-EOWFC6FD.js +2 -0
- package/dist/direct-navigation-Y5B6OSIQ.js +3 -0
- package/dist/{exploration-topology-BG4v30HZ.d.ts → exploration-topology-CSgEyAz-.d.ts} +3 -1
- package/dist/files-K4AI3JUM.js +2 -0
- package/dist/{health-BI2a9WPy.d.ts → health-BtfmNrfa.d.ts} +5 -79
- package/dist/hierarchy-6W5NDIFI.js +2 -0
- package/dist/imports-WH365QY4.js +2 -0
- package/dist/index.d.ts +13 -1
- package/dist/index.js +1 -1
- package/dist/members-K3PHMF5S.js +2 -0
- package/dist/methods-E7KVMBX4.js +2 -0
- package/dist/output-continuation-command-BJSY67SN.js +3 -0
- package/dist/output-pagination-UZJ5ACIX.js +24 -0
- package/dist/postinstall.js +1 -1
- package/dist/project-reindex-EP24WT4X.js +3 -0
- package/dist/queries/affected.js +1 -1
- package/dist/queries/architecture.d.ts +15 -4
- package/dist/queries/architecture.js +1 -1
- package/dist/queries/bottlenecks.js +1 -1
- package/dist/queries/by-kind.js +1 -1
- package/dist/queries/call-graph.d.ts +1 -1
- package/dist/queries/call-graph.js +1 -1
- package/dist/queries/change-surface.d.ts +1 -0
- package/dist/queries/change-surface.js +1 -1
- package/dist/queries/cleanup-plan.d.ts +3 -3
- package/dist/queries/cleanup-plan.js +1 -1
- package/dist/queries/co-change.js +1 -1
- package/dist/queries/code.d.ts +1 -1
- package/dist/queries/code.js +1 -1
- package/dist/queries/complexity.d.ts +6 -3
- package/dist/queries/complexity.js +1 -1
- package/dist/queries/context.d.ts +1 -7
- package/dist/queries/context.js +1 -1
- package/dist/queries/coupling.js +1 -1
- package/dist/queries/cycles.js +1 -1
- package/dist/queries/dead.js +1 -1
- package/dist/queries/decorative-checkers.js +1 -1
- package/dist/queries/dependence-slice.d.ts +46 -22
- package/dist/queries/dependence-slice.js +1 -1
- package/dist/queries/dependency-depth.d.ts +1 -7
- package/dist/queries/dependency-depth.js +1 -1
- package/dist/queries/deps.js +1 -1
- package/dist/queries/diff-impact.d.ts +3 -1
- package/dist/queries/diff-impact.js +1 -1
- package/dist/queries/doc-drift.js +1 -1
- package/dist/queries/drift.d.ts +1 -1
- package/dist/queries/drift.js +1 -1
- package/dist/queries/duplicate-bodies.d.ts +1 -1
- package/dist/queries/duplicate-bodies.js +1 -1
- package/dist/queries/entry-map.d.ts +2 -4
- package/dist/queries/entry-map.js +1 -1
- package/dist/queries/evidence.d.ts +121 -61
- package/dist/queries/evidence.js +1 -1
- package/dist/queries/fan.js +1 -1
- package/dist/queries/files.js +1 -1
- package/dist/queries/health.d.ts +1 -1
- package/dist/queries/health.js +1 -1
- package/dist/queries/hierarchy.d.ts +2 -2
- package/dist/queries/hierarchy.js +1 -1
- package/dist/queries/hotspots.d.ts +1 -1
- package/dist/queries/hotspots.js +1 -1
- package/dist/queries/imports.d.ts +1 -0
- package/dist/queries/imports.js +1 -1
- package/dist/queries/incomplete-migration.d.ts +3 -3
- package/dist/queries/incomplete-migration.js +1 -1
- package/dist/queries/index.d.ts +15 -64
- package/dist/queries/index.js +1 -1
- package/dist/queries/locality-candidates.d.ts +4 -4
- package/dist/queries/locality-candidates.js +1 -1
- package/dist/queries/members.d.ts +2 -2
- package/dist/queries/members.js +1 -1
- package/dist/queries/methods.js +1 -1
- package/dist/queries/not-implemented.d.ts +2 -6
- package/dist/queries/not-implemented.js +1 -1
- package/dist/queries/outline.js +1 -1
- package/dist/queries/passthrough-candidates.js +1 -1
- package/dist/queries/react-component-duplicates.js +1 -1
- package/dist/queries/react-hook-candidates.js +1 -1
- package/dist/queries/react-large-component-pressure.js +1 -1
- package/dist/queries/recent-duplicates.js +1 -1
- package/dist/queries/redundant-reexports.d.ts +4 -14
- package/dist/queries/redundant-reexports.js +1 -1
- package/dist/queries/refs.d.ts +4 -1
- package/dist/queries/refs.js +1 -1
- package/dist/queries/review.d.ts +188 -0
- package/dist/queries/review.js +2 -0
- package/dist/queries/similar-files.d.ts +7 -10
- package/dist/queries/similar-files.js +1 -1
- package/dist/queries/similar-signatures.js +1 -1
- package/dist/queries/similar.d.ts +19 -1
- package/dist/queries/similar.js +1 -1
- package/dist/queries/slice-cohesion.d.ts +205 -0
- package/dist/queries/slice-cohesion.js +2 -0
- package/dist/queries/source-inspection.d.ts +6 -202
- package/dist/queries/source-inspection.js +1 -1
- package/dist/queries/source-search.d.ts +2 -3
- package/dist/queries/source-search.js +1 -1
- package/dist/queries/stats.d.ts +1 -0
- package/dist/queries/stats.js +1 -1
- package/dist/queries/surface.js +1 -1
- package/dist/queries/symbols.js +1 -1
- package/dist/queries/system.d.ts +4 -2
- package/dist/queries/system.js +1 -1
- package/dist/queries/test-quality.d.ts +1 -1
- package/dist/queries/test-quality.js +1 -1
- package/dist/queries/twin-drift.d.ts +1 -1
- package/dist/queries/twin-drift.js +1 -1
- package/dist/queries/unused-imports.js +1 -1
- package/dist/queries/unused-params.d.ts +3 -15
- package/dist/queries/unused-params.js +1 -1
- package/dist/queries/vue-component-duplicates.js +1 -1
- package/dist/queries/vue-composable-candidates.js +1 -1
- package/dist/queries/vue-large-view-pressure.js +1 -1
- package/dist/query-service-fastpath.js +5 -5
- package/dist/query-service-server.js +4 -4
- package/dist/refs-CCBJG7WK.js +2 -0
- package/dist/refs-pagination-DRNLVU4S.js +2 -0
- package/dist/reindex-worker.js +79 -29
- package/dist/reindex.js +45 -45
- package/dist/repository-cache-worker.js +2 -0
- package/dist/runtime.d.ts +8 -8
- package/dist/runtime.js +3 -4
- package/dist/rust-semantic-session-server.js +1 -1
- package/dist/rust-semantic-session-worker.js +1 -1
- package/dist/rust-semantic-worker.js +1 -1
- package/dist/service-queries-2WAJI7R6.js +6 -0
- package/dist/source-inspection-91U9zdO3.d.ts +341 -0
- package/dist/{source-search-types-Dwz8KeuW.d.ts → source-search-types-DWGYNg8M.d.ts} +15 -2
- package/dist/stats-G7DIV6VU.js +2 -0
- package/dist/surface-IO55UALI.js +2 -0
- package/dist/system-ZBMSHJXU.js +2 -0
- package/dist/{queries/trace.d.ts → trace-BMjw3prn.d.ts} +1 -18
- package/dist/typescript-indexer.js +2 -0
- package/dist/typescript-mailbox-worker.js +1 -1
- package/dist/watch-server.js +3 -3
- package/docs/AGENT_GUIDE.md +19 -128
- package/docs/CLI_JSON_OUTPUT.md +21 -17
- package/docs/COMMAND_REFERENCE.md +34 -49
- package/docs/CURRENT_COMMANDS.md +123 -0
- package/docs/DETECTOR_EVIDENCE_CONTRACTS.md +0 -40
- package/docs/DETECTOR_GUIDE.md +27 -23
- package/docs/PRODUCT_VISION.md +135 -0
- package/docs/PROPERTY_TESTING.md +73 -0
- package/docs/REVIEW.md +76 -0
- package/docs/SKILLS.md +51 -0
- package/docs/WINDOWS_SIDECAR_RELEASE.md +12 -3
- package/docs/accuracy-audit-checklist.md +34 -0
- package/docs/analyzer-inventory.md +2 -2
- package/package.json +18 -80
- package/scripts/evidence-product-contract.mjs +7 -3
- package/scripts/record-review-coverage.mjs +118 -0
- package/scripts/scip-windows-provenance.mjs +29 -19
- package/skills/scip-architecture-review/SKILL.md +57 -0
- package/skills/scip-architecture-review/agents/openai.yaml +4 -0
- package/skills/scip-architecture-review/references/design-checks.md +17 -0
- package/skills/scip-explore/SKILL.md +15 -59
- package/skills/scip-explore/agents/openai.yaml +3 -3
- package/skills/scip-explore/references/external-evidence.md +2 -2
- package/skills/scip-explore/references/information-model.md +26 -29
- package/skills/scip-explore/scripts/capture-evidence.mjs +68 -34
- package/skills/scip-integrity-audit/SKILL.md +53 -181
- package/skills/scip-integrity-audit/agents/openai.yaml +3 -3
- package/skills/scip-integrity-audit/references/integrity-probes.md +27 -0
- package/skills/scip-plan/SKILL.md +39 -65
- package/skills/scip-plan/agents/openai.yaml +2 -2
- package/skills/scip-query/SKILL.md +28 -81
- package/skills/scip-query/agents/openai.yaml +2 -2
- package/skills/scip-query/references/command-guide.md +169 -0
- package/skills/scip-setup/SKILL.md +4 -2
- package/skills/scip-setup/agents/openai.yaml +3 -3
- package/dist/by-kind-H3P6BR5G.js +0 -2
- package/dist/call-graph-VTG2CUOQ.js +0 -2
- package/dist/chunk-26CT72HM.js +0 -2
- package/dist/chunk-2BMSSRBH.js +0 -2
- package/dist/chunk-2M2LSIMY.js +0 -7
- package/dist/chunk-2N6WBNDC.js +0 -29
- package/dist/chunk-2OOY75BW.js +0 -2
- package/dist/chunk-2USA3S3P.js +0 -3
- package/dist/chunk-2VAHDDLM.js +0 -133
- package/dist/chunk-2XWIUW5Z.js +0 -455
- package/dist/chunk-35NLDRZC.js +0 -2
- package/dist/chunk-3AF4TUFK.js +0 -3
- package/dist/chunk-3D4BOXW6.js +0 -20
- package/dist/chunk-3LO4FST5.js +0 -16
- package/dist/chunk-3WTY4LP2.js +0 -3
- package/dist/chunk-3Z5AMSK6.js +0 -29
- package/dist/chunk-4KBTHJLP.js +0 -2
- package/dist/chunk-5BIKR67W.js +0 -2
- package/dist/chunk-5PROPLHI.js +0 -2
- package/dist/chunk-5V7EPTII.js +0 -2
- package/dist/chunk-62LPZCBQ.js +0 -3
- package/dist/chunk-64O2JHQA.js +0 -2
- package/dist/chunk-6D4F5VWG.js +0 -10
- package/dist/chunk-6ERFBC3X.js +0 -3
- package/dist/chunk-6MFXCMZC.js +0 -2
- package/dist/chunk-6O7FACKB.js +0 -2
- package/dist/chunk-6TS3KOXR.js +0 -2
- package/dist/chunk-76QOU4PK.js +0 -3
- package/dist/chunk-7DUI77BN.js +0 -2
- package/dist/chunk-7F45LJKI.js +0 -2
- package/dist/chunk-7F7T6DCR.js +0 -2
- package/dist/chunk-7H6VHWWJ.js +0 -2
- package/dist/chunk-7HXT6YLU.js +0 -5
- package/dist/chunk-7KCZELVM.js +0 -2
- package/dist/chunk-7R4V5ES6.js +0 -6
- package/dist/chunk-7RIRIADH.js +0 -7
- package/dist/chunk-7ZLWLOGT.js +0 -2
- package/dist/chunk-AADQLOQ4.js +0 -38
- package/dist/chunk-AN76MGUE.js +0 -2
- package/dist/chunk-ANLNLY66.js +0 -2
- package/dist/chunk-AX7IDVFT.js +0 -2
- package/dist/chunk-B3X6KU75.js +0 -2
- package/dist/chunk-B7MPDEAK.js +0 -3
- package/dist/chunk-BBB5FBX4.js +0 -2
- package/dist/chunk-BJT7LSPK.js +0 -3
- package/dist/chunk-BJWFVAA5.js +0 -2
- package/dist/chunk-BKVWUP7Y.js +0 -2
- package/dist/chunk-BKZYTLGE.js +0 -35
- package/dist/chunk-BL6DCHQP.js +0 -2
- package/dist/chunk-BOW7SSQH.js +0 -43
- package/dist/chunk-C4RHHCKL.js +0 -7
- package/dist/chunk-C7C6AKAT.js +0 -117
- package/dist/chunk-CD6M6LS2.js +0 -16
- package/dist/chunk-CFE6PSG6.js +0 -2
- package/dist/chunk-CFNIGQMT.js +0 -2
- package/dist/chunk-CKBUBRYD.js +0 -2
- package/dist/chunk-CZW5MZ5B.js +0 -2
- package/dist/chunk-DBBZ63ZX.js +0 -2
- package/dist/chunk-DBN7DMJB.js +0 -18
- package/dist/chunk-DUULLZHZ.js +0 -3
- package/dist/chunk-DV5Y5NOS.js +0 -2
- package/dist/chunk-DZOIKCTM.js +0 -3
- package/dist/chunk-E4PKTOL3.js +0 -2
- package/dist/chunk-E7QR35ST.js +0 -2
- package/dist/chunk-EFSXAINW.js +0 -2
- package/dist/chunk-EHVEIEQN.js +0 -18
- package/dist/chunk-EHYDXE3Z.js +0 -2
- package/dist/chunk-EP63Y6LD.js +0 -2
- package/dist/chunk-EPX6NQN6.js +0 -4
- package/dist/chunk-ETC674NS.js +0 -5
- package/dist/chunk-F5GSBHC6.js +0 -3
- package/dist/chunk-FH3DGXC6.js +0 -2
- package/dist/chunk-FI7VGOR4.js +0 -16
- package/dist/chunk-FJF6VO2P.js +0 -2
- package/dist/chunk-FLMTCX5R.js +0 -2
- package/dist/chunk-FVFDOIM3.js +0 -2
- package/dist/chunk-G2HU5WRN.js +0 -2
- package/dist/chunk-G4ALYS4J.js +0 -2
- package/dist/chunk-G56I7K4W.js +0 -26
- package/dist/chunk-GC4DG2V5.js +0 -2
- package/dist/chunk-GG45PK4S.js +0 -4
- package/dist/chunk-GINH3YQU.js +0 -20
- package/dist/chunk-GTZZVLKJ.js +0 -2
- package/dist/chunk-GXXW5ZHH.js +0 -2
- package/dist/chunk-H5EXS3HM.js +0 -2
- package/dist/chunk-HAXXKRTD.js +0 -4
- package/dist/chunk-HEZWBAZY.js +0 -2
- package/dist/chunk-HMEWLMML.js +0 -2
- package/dist/chunk-HOBOVYPO.js +0 -11
- package/dist/chunk-HRFQ6GW5.js +0 -8
- package/dist/chunk-HX4X7KG3.js +0 -2
- package/dist/chunk-HYT2R7LX.js +0 -4
- package/dist/chunk-IKQVBVQL.js +0 -40
- package/dist/chunk-IW5XQG5G.js +0 -2
- package/dist/chunk-J6GLBBRK.js +0 -4
- package/dist/chunk-J7A4PWFX.js +0 -3
- package/dist/chunk-JCSAZ35V.js +0 -2
- package/dist/chunk-JDU2IV3A.js +0 -2
- package/dist/chunk-JFMEXGFE.js +0 -2
- package/dist/chunk-JFMI5SGB.js +0 -4
- package/dist/chunk-JJP37RGX.js +0 -57
- package/dist/chunk-JZ2A7LDM.js +0 -5
- package/dist/chunk-KMVGRIO2.js +0 -2
- package/dist/chunk-KNLQGXVH.js +0 -80
- package/dist/chunk-KVQCECPR.js +0 -2
- package/dist/chunk-KXXORBZ2.js +0 -4
- package/dist/chunk-L5KYH6U3.js +0 -35
- package/dist/chunk-L6XHYJPZ.js +0 -21
- package/dist/chunk-L7KTFEAV.js +0 -43
- package/dist/chunk-LDXHR5EL.js +0 -23
- package/dist/chunk-LEECKFCJ.js +0 -2
- package/dist/chunk-MHGDSBFX.js +0 -2
- package/dist/chunk-MLQVVDG3.js +0 -74
- package/dist/chunk-MOKUWRHO.js +0 -3
- package/dist/chunk-MPYAPMNE.js +0 -2
- package/dist/chunk-MTDBHTSF.js +0 -2
- package/dist/chunk-MV6SPXCR.js +0 -7
- package/dist/chunk-MWN53KRN.js +0 -60
- package/dist/chunk-MXNGIEPU.js +0 -3
- package/dist/chunk-N55KIE46.js +0 -2
- package/dist/chunk-NB4D3BNM.js +0 -2
- package/dist/chunk-NGKBOT6G.js +0 -23
- package/dist/chunk-NJGKXKQF.js +0 -2
- package/dist/chunk-NJQISBL4.js +0 -8
- package/dist/chunk-NJT3ZEKY.js +0 -16
- package/dist/chunk-NKMKZP6A.js +0 -2
- package/dist/chunk-NODFZ6ED.js +0 -2
- package/dist/chunk-NSM5IEVW.js +0 -2
- package/dist/chunk-NTGUVNR2.js +0 -3
- package/dist/chunk-NU3KFF2O.js +0 -57
- package/dist/chunk-NWLVNU66.js +0 -557
- package/dist/chunk-NYKZMCRC.js +0 -4
- package/dist/chunk-O6BUXZEH.js +0 -6
- package/dist/chunk-ODPDP7A4.js +0 -3
- package/dist/chunk-OIAPEKMT.js +0 -3
- package/dist/chunk-OIOC5EHF.js +0 -3
- package/dist/chunk-ONPPQM4G.js +0 -2
- package/dist/chunk-OUHEZBYI.js +0 -2
- package/dist/chunk-OVGYW7UD.js +0 -29
- package/dist/chunk-OYKU4B3Y.js +0 -2
- package/dist/chunk-POBJ6FR2.js +0 -5
- package/dist/chunk-PSZPMMWN.js +0 -2
- package/dist/chunk-PXTRBKRK.js +0 -3
- package/dist/chunk-Q5JRIHT3.js +0 -4
- package/dist/chunk-Q7ATHARX.js +0 -2
- package/dist/chunk-Q7CSKIDM.js +0 -5
- package/dist/chunk-QBQE7ZJ5.js +0 -3
- package/dist/chunk-QH22UIXP.js +0 -5
- package/dist/chunk-QXCKQTKR.js +0 -60
- package/dist/chunk-RBAD4GJ2.js +0 -13
- package/dist/chunk-RMDPFPNW.js +0 -2
- package/dist/chunk-ROPJDEJZ.js +0 -4
- package/dist/chunk-RVZC6TJE.js +0 -2
- package/dist/chunk-S4QZBKSR.js +0 -3
- package/dist/chunk-SCPMZ73U.js +0 -2
- package/dist/chunk-SIAP5RGI.js +0 -73
- package/dist/chunk-SIX4RFR3.js +0 -3
- package/dist/chunk-SKKXTABJ.js +0 -16
- package/dist/chunk-SSRFUQBD.js +0 -2
- package/dist/chunk-SYVJEEUJ.js +0 -3
- package/dist/chunk-T3CZAZSI.js +0 -8
- package/dist/chunk-T6DWDI5E.js +0 -3
- package/dist/chunk-T6HRIROJ.js +0 -7
- package/dist/chunk-TAA7HXHE.js +0 -2
- package/dist/chunk-TJ2JQYT3.js +0 -2
- package/dist/chunk-TULNMD5T.js +0 -368
- package/dist/chunk-U2FPY5XA.js +0 -3
- package/dist/chunk-U3SXIMII.js +0 -38
- package/dist/chunk-U6KCHXJ4.js +0 -2
- package/dist/chunk-UH3XSKS5.js +0 -9
- package/dist/chunk-UIFUZVCC.js +0 -2
- package/dist/chunk-UXKURIVI.js +0 -2
- package/dist/chunk-V2RBODHL.js +0 -2
- package/dist/chunk-VBKUWB6N.js +0 -2
- package/dist/chunk-VBV6ALJE.js +0 -2
- package/dist/chunk-VDGFWCQV.js +0 -2
- package/dist/chunk-VDSDOEWF.js +0 -2
- package/dist/chunk-VZPWVCLN.js +0 -20
- package/dist/chunk-WDSFQDPN.js +0 -2
- package/dist/chunk-WFA35BGR.js +0 -7
- package/dist/chunk-WLMP3OCW.js +0 -2
- package/dist/chunk-WSA52GOR.js +0 -2
- package/dist/chunk-WYPL7GF7.js +0 -2
- package/dist/chunk-X3YVZAKZ.js +0 -5
- package/dist/chunk-X6OGVFIT.js +0 -2
- package/dist/chunk-XDAUYDFT.js +0 -2
- package/dist/chunk-XKXTR6ZI.js +0 -9
- package/dist/chunk-Y5DFAW5W.js +0 -4
- package/dist/chunk-YSYPDRD5.js +0 -3
- package/dist/chunk-ZFVPWH62.js +0 -5
- package/dist/chunk-ZGIHTH27.js +0 -2
- package/dist/chunk-ZGIQN2SX.js +0 -2
- package/dist/chunk-ZHG4WAHR.js +0 -12
- package/dist/chunk-ZKB2XUEN.js +0 -4
- package/dist/chunk-ZLMXIQLC.js +0 -21
- package/dist/chunk-ZMCQIHI4.js +0 -2
- package/dist/code-TAVIKWJI.js +0 -2
- package/dist/code-result-json-5FEFQCAQ.js +0 -2
- package/dist/command-descriptors-7BKH53Y3.js +0 -343
- package/dist/dataflow-GFBTVDH3.js +0 -2
- package/dist/dependence-slice-GWGQCODG.js +0 -2
- package/dist/deps-4QHVDPYA.js +0 -2
- package/dist/direct-navigation-4UBC6HNW.js +0 -3
- package/dist/entry-map-QCTF4RVY.js +0 -2
- package/dist/files-M2UBF5HJ.js +0 -2
- package/dist/graph-evidence-Bjyky2V4.d.ts +0 -126
- package/dist/hierarchy-2UIHRLW4.js +0 -2
- package/dist/imports-WIE3YZOB.js +0 -2
- package/dist/members-YKD636DA.js +0 -2
- package/dist/methods-VDF4IMYG.js +0 -2
- package/dist/next-anchor-candidates-BwMczMvX.d.ts +0 -90
- package/dist/output-continuation-command-4UMDOOLO.js +0 -3
- package/dist/output-pagination-2GME6OPY.js +0 -19
- package/dist/project-reindex-XEQTRCV5.js +0 -3
- package/dist/queries/anchors.d.ts +0 -123
- package/dist/queries/anchors.js +0 -2
- package/dist/queries/complexity-hotspots.d.ts +0 -40
- package/dist/queries/complexity-hotspots.js +0 -2
- package/dist/queries/convergence.d.ts +0 -33
- package/dist/queries/convergence.js +0 -2
- package/dist/queries/dataflow.d.ts +0 -77
- package/dist/queries/dataflow.js +0 -2
- package/dist/queries/deep-chains.d.ts +0 -5
- package/dist/queries/deep-chains.js +0 -2
- package/dist/queries/extract-candidates.d.ts +0 -79
- package/dist/queries/extract-candidates.js +0 -2
- package/dist/queries/isolated.d.ts +0 -24
- package/dist/queries/isolated.js +0 -2
- package/dist/queries/plan-context.d.ts +0 -33
- package/dist/queries/plan-context.js +0 -2
- package/dist/queries/reference-neighborhood.d.ts +0 -4
- package/dist/queries/reference-neighborhood.js +0 -2
- package/dist/queries/reference-reachability.d.ts +0 -48
- package/dist/queries/reference-reachability.js +0 -2
- package/dist/queries/self-audit.d.ts +0 -69
- package/dist/queries/self-audit.js +0 -2
- package/dist/queries/similar-chains.d.ts +0 -48
- package/dist/queries/similar-chains.js +0 -2
- package/dist/queries/slice.d.ts +0 -4
- package/dist/queries/slice.js +0 -2
- package/dist/queries/stale-abstractions.d.ts +0 -72
- package/dist/queries/stale-abstractions.js +0 -2
- package/dist/queries/system-map.d.ts +0 -449
- package/dist/queries/system-map.js +0 -2
- package/dist/queries/trace.js +0 -2
- package/dist/queries/twin-ab.d.ts +0 -66
- package/dist/queries/twin-ab.js +0 -2
- package/dist/queries/value-flow.d.ts +0 -43
- package/dist/queries/value-flow.js +0 -2
- package/dist/queries/wrapper-candidates.d.ts +0 -49
- package/dist/queries/wrapper-candidates.js +0 -2
- package/dist/refs-JNK5CLM7.js +0 -2
- package/dist/refs-pagination-6BLRYGMV.js +0 -2
- package/dist/slice-PHPVNCWX.js +0 -2
- package/dist/source-snippet-_wrcgmZc.d.ts +0 -15
- package/dist/stats-OOJ74B32.js +0 -2
- package/dist/surface-MQX5MPIV.js +0 -2
- package/dist/symbol-resolution-DBLVXLBC.js +0 -2
- package/dist/system-JOPKV4OG.js +0 -2
- package/dist/trace-I2P2YFH4.js +0 -2
- package/dist/value-flow-JJVMF7NP.js +0 -2
- package/skills/concrete-plan/SKILL.md +0 -8
- package/skills/concrete-plan/agents/openai.yaml +0 -4
- package/skills/conductor/SKILL.md +0 -110
- package/skills/conductor/agents/openai.yaml +0 -4
- package/skills/principal-maintainability-review/SKILL.md +0 -273
- package/skills/principal-maintainability-review/agents/openai.yaml +0 -4
- package/skills/scip-calibrate/SKILL.md +0 -102
- package/skills/scip-calibrate/agents/openai.yaml +0 -4
- package/skills/scip-claim-audit/SKILL.md +0 -113
- package/skills/scip-claim-audit/agents/openai.yaml +0 -4
- package/skills/scip-probe-reachability/SKILL.md +0 -93
- package/skills/scip-probe-reachability/agents/openai.yaml +0 -4
- package/skills/scip-root-cause/SKILL.md +0 -160
- package/skills/scip-root-cause/agents/openai.yaml +0 -4
- package/skills/scip-system-compression/SKILL.md +0 -252
- package/skills/scip-system-compression/agents/openai.yaml +0 -4
- package/skills/scip-system-compression/references/compression-atlas.md +0 -116
- package/skills/scip-system-compression/references/compression-patterns.md +0 -87
- package/skills/scip-twin-drift/SKILL.md +0 -109
- package/skills/scip-twin-drift/agents/openai.yaml +0 -4
package/dist/chunk-L6XHYJPZ.js
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import{a as ye}from"./chunk-3TNRNKAT.js";import{b as te,c as Xe}from"./chunk-7KCZELVM.js";import{a as Qn}from"./chunk-GHNPACNP.js";import{a as yt,b as ht,c as Un,d as Ye,e as Qt,f as Me,g as Yt,h as Xt}from"./chunk-HAXXKRTD.js";import{b as Wn,c as Hn,e as St}from"./chunk-JFMI5SGB.js";import{a as bt,b as Zt,c as Vn,d as Jt}from"./chunk-AADQLOQ4.js";import{a as Ut,b as Gn,c as Kn,d as qn,h as Vt,i as zn}from"./chunk-JJP37RGX.js";import{a as je}from"./chunk-HX4X7KG3.js";import{b as mt}from"./chunk-NJGKXKQF.js";import{a as Ee,d as ft,e as jn,f as gt,n as Ht}from"./chunk-FI7VGOR4.js";import{b as Wt}from"./chunk-2USA3S3P.js";import{b as _n,c as Bn}from"./chunk-FVFDOIM3.js";import{B as pt,C as oe,E as ge,G as zt,K as xe,M as Dn,T as X,_ as Ge,i as dt,l as le,r as ut,t as qt,y as Y}from"./chunk-2VAHDDLM.js";import{a as kn,b as $n}from"./chunk-YXPUP5G2.js";import{b as On,c as J,h as re}from"./chunk-BL6DCHQP.js";import{c as An}from"./chunk-IW5XQG5G.js";import{p as Pe}from"./chunk-7HXT6YLU.js";import{createHash as ec}from"crypto";var qr=[{id:"general-interprocedural-value-flow",families:["dataflow"],capability:"Whole-program definition-use flow through arbitrary calls and returns is unavailable.",consequence:"Missing dataflow edges cannot establish that a value never crosses an unmodeled call.",recoverWith:["value-flow","dependence-slice","inspect","code"]},{id:"heap-aliasing",families:["dataflow","state"],capability:"Heap points-to and cross-instance alias analysis are unavailable.",consequence:"Missing field or state edges cannot establish that two references never reach the same object.",recoverWith:["value-flow","dependence-slice","inspect","code"]},{id:"exceptional-flow",families:["execution","dataflow","temporal"],capability:"Interprocedural exception propagation and finally completion flow are unavailable.",consequence:"Normal-path reachability and ordering do not establish behavior after a throw or rejection.",recoverWith:["dependence-slice","inspect","code"]},{id:"reflection",families:["execution","runtime","identity","dependencies"],capability:"Reflective lookup, dynamic loading, and name-computed invocation are unavailable without exact evidence.",consequence:"Missing static edges cannot establish that a construct is unreachable through reflection.",recoverWith:["search","inspect","code"]},{id:"generated-dispatch",families:["execution","runtime","identity"],capability:"Dispatch tables or names created only by generated or unavailable source are unavailable.",consequence:"Missing dispatch edges cannot establish that no generated consumer exists.",recoverWith:["search","inspect","code"]},{id:"unsupported-framework-adapters",families:["runtime","dataflow","state","temporal"],capability:"Framework runtime crossings without a registered source adapter are unavailable.",consequence:"Missing boundary edges cannot establish that no producer, consumer, state effect, or ordering exists.",recoverWith:["search","inspect","code"]}];function zr(e){let t=new Set(e);return qr.filter(n=>n.families.some(o=>t.has(o)))}function Yn(e){return zr(e).map(t=>`[${t.id}] ${t.capability} ${t.consequence} Recover selected paths with: ${t.recoverWith.map(n=>`scip-query ${n}`).join(", ")}.`)}var Ur=["incoming","outgoing","both"];function W(e,t,n,o={}){return{family:e,subtype:t,...o.match?{match:o.match}:{},directions:Ur,evidenceStrengths:o.strengths??["exact","derived","mixed"],supportCeiling:o.supportCeiling??"partial",establishes:n,nonClaims:o.nonClaims??[],recoverWith:o.recoverWith??["inspect","code"]}}var Wr=["predicate-consequence","predicate-alternative","predicate-fallthrough","predicate-case","predicate-default","predicate-return","predicate-throw","loop-iteration","loop-exit","exception-handler","finally-cleanup","handler-return","handler-throw"],Hr=["captured-value-to-state","constant-to-state","expression-to-state","property-to-state","return-to-state","value-to-state"],Vr=["await-completion-before","awaits-completion","inside-lock-scope","lexical-successor"],Qr=[{id:"indexed-program-identity",label:"SCIP/compiler identity and source ownership",requirements:["indexed-graph"],relations:[W("execution","call","The source construct may call the resolved target.",{strengths:["exact","derived","candidate","mixed"],nonClaims:["Static may-call reachability does not prove that an invocation occurred at runtime."],recoverWith:["call-graph","inspect","code"]}),W("execution","result-callback","The referenced callable can produce the result consumed by this path.",{nonClaims:["A callback relationship does not prove invocation order or runtime selection."],recoverWith:["call-graph","inspect","code"]}),W("contract","uses-contract-symbol","The source construct refers to the identified contract symbol.",{supportCeiling:"exact",nonClaims:["Contract identity does not prove runtime invocation or behavioral conformance."],recoverWith:["hierarchy","inspect","code"]}),W("identity","references","The occurrence resolves to the identified compiler-owned symbol.",{supportCeiling:"exact",nonClaims:["A reference does not establish execution or value transfer."],recoverWith:["refs","trace","inspect"]}),W("ownership","contains","The owner contains the identified program construct.",{supportCeiling:"exact",nonClaims:["Structural containment does not establish runtime lifetime or sharing scope."],recoverWith:["outline","inspect"]}),W("ownership","contains-","The owner contains the identified program construct.",{match:"prefix",supportCeiling:"exact",nonClaims:["Structural containment does not establish runtime lifetime or sharing scope."],recoverWith:["outline","inspect"]}),W("ownership","owns-","The owner owns the identified source or runtime observation.",{match:"prefix",supportCeiling:"exact",nonClaims:["Observation ownership does not establish singleton lifetime or exclusive ownership."],recoverWith:["inspect","code"]}),W("dependencies","imports","The source file or module statically imports the indexed target.",{nonClaims:["An import does not establish that imported code executes."],recoverWith:["imports","deps","code"]}),W("dependencies","imports-external","The source region statically imports an external package.",{nonClaims:["An external import does not establish which package behavior executes."],recoverWith:["imports","code"]})]},{id:"runtime-boundary-join",label:"source-grounded runtime-boundary joins",requirements:["indexed-graph","source-facts"],relations:[W("runtime","runtime-handoff","A producer and consumer share a source-grounded runtime rendezvous.",{strengths:["exact","derived","candidate","mixed"],nonClaims:["A candidate or unresolved join does not prove a runtime handoff."],recoverWith:["evidence","inspect","code"]}),W("runtime","discriminator-dispatch","A serialized discriminator selects the reported consumer.",{strengths:["exact","derived","mixed"],nonClaims:["The dispatch edge does not prove delivery, retry, or successful handling."],recoverWith:["evidence","inspect","code"]}),W("dataflow","serialized-discriminator-transfer","The producer serializes the discriminator consumed by dispatch.",{strengths:["exact","derived","mixed"],nonClaims:["This edge does not establish the flow of every payload field."],recoverWith:["value-flow","inspect","code"]}),W("temporal","enqueue-before-consume","The reported enqueue precedes a possible consume through the queue.",{strengths:["exact","derived","mixed"],nonClaims:["Queue order does not establish delivery time, uniqueness, retry count, or durability."],recoverWith:["evidence","inspect","code"]})]},{id:"parser-control-dependence",label:"parser-proved intraprocedural control dependence",requirements:["indexed-graph","source-facts"],relations:[...Wr.map(e=>W("execution",e,"The outcome is control-dependent on the reported predicate or handler.",{strengths:["exact"],nonClaims:["Local control dependence does not establish that the containing function executes."],recoverWith:["dependence-slice","inspect","code"]})),W("execution","returns","The selected construct contains the reported return terminal.",{strengths:["exact"],nonClaims:["A local return terminal does not establish that the containing callable executes."],recoverWith:["inspect","code"]}),W("execution","throws","The selected construct contains the reported throw terminal.",{strengths:["exact"],nonClaims:["A local throw terminal does not establish propagation, handling, or callable execution."],recoverWith:["inspect","code"]})]},{id:"bounded-static-value-flow",label:"compiler callsites and bounded static value evaluation",requirements:["indexed-graph","source-facts"],relations:["argument-to-parameter","constant-to-parameter","property-to-parameter","return-to-parameter","return-to-call-result"].map(e=>W("dataflow",e,"The reported value may reach the target through the evidenced callsite transfer.",{strengths:["exact","derived","mixed"],nonClaims:["This provider does not establish general local definition-use, alias, field, or heap flow."],recoverWith:["value-flow","dependence-slice","inspect","code"]}))},{id:"typescript-local-dependence",label:"TypeScript compiler identities, control-flow graph, and reaching definitions",requirements:["typescript-semantic"],relations:[W("dataflow","definition-to-use","The definition reaches the reported read on a feasible local control-flow path.",{strengths:["exact"],nonClaims:["Local reaching definitions do not establish heap aliasing, exceptional flow, or the runtime order of closure invocation."],recoverWith:["value-flow","dependence-slice","inspect","code"]}),W("dataflow","value-to-definition","The reported right-hand-side read supplies the assigned local definition.",{strengths:["exact"],nonClaims:["A local assignment edge does not establish field or heap points-to flow."],recoverWith:["value-flow","dependence-slice","inspect","code"]}),W("dataflow","closure-capture","The nested callable reads the reported binding from an enclosing callable.",{strengths:["candidate"],supportCeiling:"candidate",nonClaims:["Closure capture does not establish whether or when the nested callable executes."],recoverWith:["call-graph","inspect","code"]}),W("dataflow","field-definition-to-use","The reported same-owner field definition can reach the field read.",{strengths:["exact","candidate"],nonClaims:["Field-name identity does not establish whole-program heap aliasing or cross-instance flow."],recoverWith:["value-flow","dependence-slice","inspect","code"]}),W("execution","control-dependence","Execution of the reported statement depends on the outcome of the predicate.",{strengths:["exact"],nonClaims:["Intraprocedural control dependence does not establish that the containing callable executes."],recoverWith:["dependence-slice","inspect","code"]})]},{id:"parser-state-temporal",label:"parser-proved local state and temporal facts",requirements:["indexed-graph","source-facts"],relations:[...Hr.map(e=>W("dataflow",e,"The reported source value is assigned into the identified state resource.",{strengths:["exact"],nonClaims:["The edge does not establish alias, heap, or later read flow."],recoverWith:["value-flow","inspect","code"]})),...["writes-resource","deletes-resource","reads-resource","enqueues-resource","consumes-resource"].map(e=>W("state",e,"The reported construct performs the named operation on the identified resource.",{strengths:["exact"],nonClaims:["A state operation does not establish transactionality, durability, or exclusive ownership."],recoverWith:["evidence","inspect","code"]})),...Vr.map(e=>W("temporal",e,"The reported source constructs have the named local ordering relationship.",{strengths:["exact"],nonClaims:["Local source order does not establish cross-process happens-before or durable completion."],recoverWith:["evidence","inspect","code"]}))]}];function Xn(e,t){let n=Qr.flatMap(o=>o.relations.filter(i=>i.family===e&&(i.match==="prefix"?t.startsWith(i.subtype):t===i.subtype)).map(i=>({provider:o,relation:i})));if(n.length>1)throw new Error(`Ambiguous graph relation provider for ${e}/${t}: ${n.map(o=>o.provider.id).join(", ")}`);return n[0]??null}var Ce=["execution","runtime","dataflow","state","temporal","contract","identity","ownership","dependencies"];function Ke(e){return e.includes("symbol-anchor")?0:e.includes("literal-owner")?1:e.some(t=>t.startsWith("boundary-import:"))?2:e.includes("reference-owner")?3:4}function Zn(e,t){return Ke(e.origins)-Ke(t.origins)||e.depth-t.depth||e.startLine-t.startLine||e.shortName.localeCompare(t.shortName)}var Jn=new WeakMap,eo=new WeakMap,to=new WeakMap,no=new WeakMap,oo=new WeakMap;function ro(e,t){let n=eo.get(e);n||(n=new Map,eo.set(e,n));let o=n.get(t);if(o)return o;let i=Y(e,t)?.rootNode;if(!i)return n.set(t,[]),[];let a=new Set;he(i,d=>{if(d.type!=="call_expression")return;let l=d.childForFieldName("function")??d.namedChild(0),u=/^([A-Za-z_$][\w$]*(?:\.Service)?)\.of$/u.exec(l?.text.replace(/\s+/gu,"")??"");u&&a.add(u[1])});let r=xe(e,t).filter(d=>!!d.sourcePath),s=new Set;for(let d of a){let l=/^([A-Za-z_$][\w$]*)\.Service$/u.exec(d);if(l){for(let u of r)u.localName===l[1]&&s.add(u.sourcePath);continue}if(d==="Service"){X(e,t).some(u=>u.leaf==="Service")&&s.add(t);for(let u of r)(u.localName??u.importedName)==="Service"&&s.add(u.sourcePath)}}let c=on([...s]).sort();return n.set(t,c),c}function en(e,t,n={}){let i=zt(e,t)?.filter(m=>!n.ranges||n.ranges.some(p=>m.line>=p.startLine&&m.line<=p.endLine));if(!i)return{targets:[],unresolvedCallsites:0};let a=xe(e,t).filter(m=>!!m.sourcePath),r=pi(dt(e,t)??""),s=Y(e,t)?.rootNode??null,c=s?Xr(s):io(),d=new Map,l=gt(e),u=[],f=0;for(let m of i){if(!m.memberAccess)continue;let p=ft(t,l.get(m.calleeLeaf)??[]);if(n.excludeIndexedTargets!==!1&&jn(e,t,p,!0,m.calleeQualifier))continue;let g=m.calleeQualifier,b=di(e,t,m,a);if(b){u.push(b);continue}let C=Yr(e,t,m,a,Zr(c,m.calleeQualifier,m.line));if(C.length>0){u.push(...C);continue}let S=Jr(e,t,m);if(S.length>0){u.push(...S);continue}let v=g?r.get(g)??g:null,y=(v?on(a.filter(L=>(L.localName??L.importedName)===v).map(L=>L.sourcePath)):[]).flatMap(L=>{let x=d.get(L);return x||(x=ge(e,L)??[],d.set(L,x)),x.filter(M=>M.name===m.calleeLeaf).map(M=>({file:L,callable:M}))});if(y.length!==1){f+=1;continue}let N=y[0];u.push({calleeLeaf:m.calleeLeaf,line:m.line,sourceFile:t,targetFile:N.file,targetStartLine:N.callable.startLine,targetEndLine:N.callable.endLine,resolution:"direct-import-receiver",strength:"candidate"})}return{targets:u,unresolvedCallsites:f}}function Yr(e,t,n,o,i){let a=n.calleeQualifier;if(!a||!/^[A-Za-z_$][\w$]*$/u.test(a))return[];if(i.size!==1)return[];let r=[...i][0],s=on(o.filter(l=>l.localName===r||l.importedName===r).map(l=>l.sourcePath));if(s.length!==1)return[];let c=s[0],d=oi(e,c,n.calleeLeaf);return d.map(l=>({calleeLeaf:l.name,line:n.line,sourceFile:t,targetFile:l.file,targetStartLine:l.startLine,targetEndLine:l.endLine,serviceFile:c,resolutionAlternativeCount:d.length,resolution:"imported-service-object-member",strength:"candidate"}))}function io(){return{declarations:new Map,callbacks:[]}}function Xr(e){let t=io();return he(e,n=>{if(n.type==="variable_declarator"){let c=n.childForFieldName("name")??n.namedChild(0),d=n.childForFieldName("value")??n.namedChild(1);if(c?.type!=="identifier"||!d)return;let l=new Set;if(he(d,u=>{if(u.type!=="member_expression")return;let f=u.childForFieldName("object")??u.namedChild(0),m=u.childForFieldName("property")??u.namedChild(1);f?.type==="identifier"&&m?.text==="Service"&&l.add(f.text)}),l.size===1){let u=t.declarations.get(c.text)??[];u.push({line:n.startPosition.row,alias:[...l][0]}),t.declarations.set(c.text,u)}return}if(!["arrow_function","function_expression","generator_function"].includes(n.type))return;let o=n.childForFieldName("parameters")??n.childForFieldName("parameter");if(!o)return;let i=n.parent;for(;i&&i.type!=="call_expression";)i=i.parent;if(!i)return;let a=i.childForFieldName("function")??i.namedChild(0),r=/^([A-Za-z_$][\w$]*)\.Service\.use$/u.exec(a?.text??"");if(!r)return;let s=new Set;he(o,c=>{c.type==="identifier"&&s.add(c.text)}),s.size!==0&&t.callbacks.push({startLine:n.startPosition.row,endLine:n.endPosition.row,receivers:s,alias:r[1]})}),t}function Zr(e,t,n){if(!t||!/^[A-Za-z_$][\w$]*$/u.test(t))return new Set;let o=new Set((e.declarations.get(t)??[]).filter(i=>i.line<=n).map(i=>i.alias));for(let i of e.callbacks)i.startLine<=n&&i.endLine>=n&&i.receivers.has(t)&&o.add(i.alias);return o}function Jr(e,t,n){let o=n.calleeQualifier;if(!o||!/^[A-Za-z_$][\w$]*$/u.test(o))return[];let i=Y(e,t)?.rootNode;if(!i)return[];let a=ei(e,t,i,n.line,n.calleeLeaf,o),r=a?ni(a,o):null;if(!r)return[];if(!ti(r))return[];let s=(ge(e,t)??[]).filter(m=>m.startLine<=r.startPosition.row&&m.endLine>=r.endPosition.row).sort((m,p)=>m.endLine-m.startLine-(p.endLine-p.startLine))[0];if(!s)return[];let c=X(e,t).filter(m=>m.isFunctionLike&&m.leaf===s.name);if(c.length!==1)return[];let d=c[0],l=no.get(e);l||(l=new Map,no.set(e,l));let u=`${d.symbol}\0${n.calleeLeaf}`,f=l.get(u);if(!f){let m=[];for(let p of Ht(e,d)){let g=Y(e,p.file)?.rootNode;if(!g)continue;let b=ut(g,"call_expression").filter(v=>v.startPosition.row>p.line||v.endPosition.row<p.line?!1:(v.childForFieldName("function")??v.namedChild(0))?.text.replace(/\s+/gu,"").replace(/<[^<>]*>$/u,"").match(/[A-Za-z_$][\w$]*$/u)?.[0]===d.leaf);if(b.length!==1)continue;let S=b[0].childForFieldName("arguments")?.namedChildren.find(v=>Ae(v).type==="object");if(S)for(let v of Ae(S).namedChildren){if(v.type==="shorthand_property_identifier"&&v.text===n.calleeLeaf){m.push(...vt(e,p.file,n.calleeLeaf,v,v));continue}if(v.type!=="pair")continue;let R=v.childForFieldName("key")??v.namedChild(0),y=v.childForFieldName("value")??v.namedChild(1);xt(R?.text)!==n.calleeLeaf||!y||m.push(...vt(e,p.file,n.calleeLeaf,y,v))}}f=m.filter((p,g,b)=>b.findIndex(C=>C.file===p.file&&C.startLine===p.startLine&&C.endLine===p.endLine&&C.name===p.name)===g),l.set(u,f)}return f.map(m=>({calleeLeaf:m.name,line:n.line,sourceFile:t,targetFile:m.file,targetStartLine:m.startLine,targetEndLine:m.endLine,resolutionAlternativeCount:f.length,resolution:"factory-callback-member",strength:f.length===1?"exact":"candidate"}))}function ei(e,t,n,o,i,a){let r=to.get(e);r||(r=new Map,to.set(e,r));let s=r.get(t);if(!s){s=new Map;for(let c of ut(n,"call_expression")){let d=c.childForFieldName("function")??c.namedChild(0),l=/^([A-Za-z_$][\w$]*)\.([A-Za-z_$][\w$]*)$/u.exec(d?.text.replace(/\s+/gu,"")??"");if(l)for(let u=c.startPosition.row;u<=c.endPosition.row;u+=1){let f=`${u}\0${l[1]}\0${l[2]}`,m=s.get(f);(!m||c.endIndex-c.startIndex<m.endIndex-m.startIndex)&&s.set(f,c)}}r.set(t,s)}return s.get(`${o}\0${a}\0${i}`)??null}function ti(e){return e.descendantsOfType("return_statement").some(t=>{let n=t.childForFieldName("argument")??t.namedChild(0);return!!(n&&Ae(n).type==="object")})}function ni(e,t){let n=e.parent;for(;n;){if(/(?:function|method|lambda)/u.test(n.type)||n.type==="arrow_function"){let o=n.childForFieldName("parameters")??n.childForFieldName("parameter"),i=!1;if(o&&he(o,a=>{a.type==="identifier"&&a.text===t&&(i=!0)}),i)return n}n=n.parent}return null}function vt(e,t,n,o,i){if(o.type==="identifier")return(ge(e,t)??[]).filter(c=>c.name===o.text).map(c=>({...c,file:t}));let a=tn(e,t,o.text);if(a.length>0)return a;if(!nn(o))return[];let s=(ge(e,t)??[]).filter(c=>c.startLine>=i.startPosition.row&&c.endLine<=i.endPosition.row&&(c.name===n||c.name.startsWith("source@"))).sort((c,d)=>c.endLine-c.startLine-(d.endLine-d.startLine))[0];return[s?{...s,file:t}:{name:n,file:t,startLine:i.startPosition.row,endLine:i.endPosition.row}]}function oi(e,t,n){let o=oo.get(e);o||(o=new Map,oo.set(e,o));let i=`${t}\0${n}`,a=o.get(i);if(a)return a;let r=ai(e,t).flatMap(s=>ri(e,s,t,n));return o.set(i,r),r}function ri(e,t,n,o){let i=Y(e,t)?.rootNode,a=ge(e,t)??[];if(!i)return[];let r=si(e,t,n);if(r.size===0)return[];let s=new Set,c=[],d=[],l=[];return he(i,f=>{if(ii(f,r)){if(f.type==="pair"){let m=f.childForFieldName("key")??f.namedChild(0),p=f.childForFieldName("value")??f.namedChild(1);if(xt(m?.text)!==o||!p)return;if(p.type==="identifier")s.add(p.text);else if(nn(p))c.push({name:o,startLine:f.startPosition.row,endLine:f.endPosition.row});else{let g=li(e,t,p.text),b=tn(e,t,p.text);if(g.length>0)l.push(...g);else if(b.length>0)l.push(...b);else{let C=ci(f);C&&d.push(C)}}return}f.type==="shorthand_property_identifier"&&f.text===o&&s.add(o)}}),[...a.filter(f=>s.has(f.name)).map(f=>({...f,file:t})),...c.map(f=>({...f,file:t})),...d.map(f=>({...f,file:t})),...l].filter((f,m,p)=>p.findIndex(g=>g.file===f.file&&g.name===f.name&&g.startLine===f.startLine&&g.endLine===f.endLine)===m)}function ii(e,t){let n=e,o=null;for(;n;){if(n.type==="object"&&(o=n),n.type==="call_expression"){if(!o)return!1;let i=n.childForFieldName("function")??n.namedChild(0);return i?t.has(i.text.replace(/\.of$/u,""))&&i.text.endsWith(".of"):!1}n=n.parent}return!1}function ai(e,t){let n=Jn.get(e);n||(n=new Map,Jn.set(e,n));let o=n.get(t);if(o)return o;let i=new Set([t]),a=X(e,t).filter(s=>s.leaf==="Service"&&s.isTypeLike);for(let s of a)for(let c of Ht(e,s))i.add(c.file);let r=[...i].sort();return n.set(t,r),r}function si(e,t,n){let o=new Set;Pe(t,n)&&o.add("Service");for(let i of xe(e,t)){if(!i.sourcePath||!Pe(i.sourcePath,n))continue;if(i.kind==="namespace"&&i.localName){o.add(`${i.localName}.Service`);continue}(i.importedName==="default"?i.localName:i.importedName)==="Service"?o.add(i.localName??i.importedName):i.localName&&i.importedName!=="default"&&o.add(`${i.localName}.Service`)}return o}function tn(e,t,n){let o=/^([A-Za-z_$][\w$]*)\.([A-Za-z_$][\w$]*)$/u.exec(n.replace(/\s+/gu,""));if(!o)return[];let i=Y(e,t)?.rootNode;if(!i)return[];let a=ao(i,o[1]),r=a?so(a):null;if(!r)return[];let s=r.childForFieldName("function")??r.namedChild(0),c=s?lo(e,t,s.text):[];if(c.length!==1)return[];let d=c[0],l=Y(e,d.relativePath)?.rootNode;if(!l)return[];let u=qt(l,d.startLine,d.endLine);if(!u)return[];let f=[];for(let m of u.descendantsOfType("return_statement")){let p=m.childForFieldName("argument")??m.namedChild(0);if(!p)continue;let g=Ae(p);if(g.type==="object")for(let b of g.namedChildren){if(b.type==="shorthand_property_identifier"&&b.text===o[2]){for(let v of ge(e,d.relativePath)??[])v.name===o[2]&&f.push({...v,file:d.relativePath});continue}if(b.type!=="pair")continue;let C=b.childForFieldName("key")??b.namedChild(0),S=b.childForFieldName("value")??b.namedChild(1);if(!(xt(C?.text)!==o[2]||!S))if(S.type==="identifier")for(let v of ge(e,d.relativePath)??[])v.name===S.text&&f.push({...v,file:d.relativePath});else nn(S)&&f.push({name:o[2],startLine:b.startPosition.row,endLine:b.endPosition.row,file:d.relativePath})}}return f.filter((m,p,g)=>g.findIndex(b=>b.file===m.file&&b.name===m.name&&b.startLine===m.startLine&&b.endLine===m.endLine)===p)}function li(e,t,n){let o=/^([A-Za-z_$][\w$]*)\.([A-Za-z_$][\w$]*)$/u.exec(n.replace(/\s+/gu,""));if(!o)return[];let i=Y(e,t)?.rootNode;if(!i)return[];let a=ao(i,o[1]),r=a?so(a):null,s=r?.childForFieldName("function")??r?.namedChild(0),c=s?lo(e,t,s.text):[];if(c.length!==1||!r)return[];let d=c[0],l=Y(e,d.relativePath)?.rootNode;if(!l)return[];let u=qt(l,d.startLine,d.endLine);if(!u)return[];let f=new Set,m=u.childForFieldName("parameters")??u.childForFieldName("parameter");if(m&&he(m,L=>{L.type==="identifier"&&f.add(L.text)}),f.size===0)return[];let p=tn(e,t,n);if(p.length===0)return[];let g=(ge(e,d.relativePath)??[]).filter(L=>L.startLine>=d.startLine&&L.endLine<=d.endLine),b=(zt(e,d.relativePath)??[]).filter(L=>L.line>=d.startLine&&L.line<=d.endLine),C=new Set,S=p.map(L=>({name:L.name,startLine:L.startLine,endLine:L.endLine})),v=new Set;for(;S.length>0&&v.size<32;){let L=S.shift(),x=`${L.name}\0${L.startLine}\0${L.endLine}`;if(!v.has(x)){v.add(x);for(let M of b.filter(h=>h.line>=L.startLine&&h.line<=L.endLine)){if(M.memberAccess&&M.calleeQualifier&&f.has(M.calleeQualifier)){C.add(M.calleeLeaf);continue}if(M.memberAccess)continue;let h=g.filter(P=>P.name===M.calleeLeaf);h.length===1&&S.push(h[0])}}}if(C.size===0)return[];let y=r.childForFieldName("arguments")?.namedChildren.find(L=>Ae(L).type==="object");if(!y)return[];let N=[];for(let L of Ae(y).namedChildren){if(L.type==="shorthand_property_identifier"&&C.has(L.text)){N.push(...vt(e,t,L.text,L,L));continue}if(L.type!=="pair")continue;let x=L.childForFieldName("key")??L.namedChild(0),M=L.childForFieldName("value")??L.namedChild(1),h=xt(x?.text);!h||!C.has(h)||!M||N.push(...vt(e,t,h,M,L))}return N.filter((L,x,M)=>M.findIndex(h=>h.file===L.file&&h.name===L.name&&h.startLine===L.startLine&&h.endLine===L.endLine)===x)}function ao(e,t){for(let n of ut(e,"variable_declarator"))if((n.childForFieldName("name")??n.namedChild(0))?.text===t)return n.childForFieldName("value")??n.namedChild(1);return null}function so(e){return e.type==="call_expression"?e:e.descendantsOfType("call_expression")[0]??null}function lo(e,t,n){let o=n.replace(/\s+/gu,"").replace(/<[^<>]*>$/u,""),i=/^([A-Za-z_$][\w$]*)\.([A-Za-z_$][\w$]*)$/u.exec(o);if(i){let u=xe(e,t).filter(p=>p.localName===i[1]&&p.sourcePath);if(u.length!==1||!u[0].sourcePath)return[];let f=u[0].sourcePath,m=je(e,f,i[2]).filter(p=>p.isFunctionLike);return m.length>0?m:(ge(e,f)??[]).filter(p=>p.name===i[2]).map(p=>({...p,relativePath:f}))}if(!/^[A-Za-z_$][\w$]*$/u.test(o))return[];let a=X(e,t).filter(u=>u.leaf===o&&u.isFunctionLike);if(a.length>0)return a;let r=(ge(e,t)??[]).filter(u=>u.name===o).map(u=>({...u,relativePath:t}));if(r.length>0)return r;let s=xe(e,t).filter(u=>u.localName===o&&u.sourcePath&&u.kind!=="namespace");if(s.length!==1||!s[0].sourcePath)return[];let c=s[0].sourcePath,d=s[0].importedName==="default"?o:s[0].importedName,l=je(e,c,d).filter(u=>u.isFunctionLike);return l.length>0?l:(ge(e,c)??[]).filter(u=>u.name===d).map(u=>({...u,relativePath:c}))}function nn(e){return["arrow_function","function_expression","generator_function"].includes(e.type)||e.descendantsOfType(["arrow_function","function_expression","generator_function"]).length>0}function ci(e){let t=e.parent;for(;t;){if(t.type==="variable_declarator"){let n=t.childForFieldName("name")??t.namedChild(0);if(n?.type==="identifier")return{name:n.text,startLine:t.startPosition.row,endLine:t.endPosition.row}}t=t.parent}return null}function xt(e){return e?e.replace(/^(?:['"])(.*)(?:['"])$/u,"$1"):null}function di(e,t,n,o){let i=/^this\.([A-Za-z_$][\w$]*)$/u.exec(n.calleeQualifier??"");if(!i)return null;let a=Y(e,t)?.rootNode;if(!a)return null;let r=ui(a,n.line);if(!r)return null;let s=new Set;if(he(r,g=>{if(g.type!=="assignment_expression")return;let b=g.childForFieldName("left")??g.namedChild(0),C=g.childForFieldName("right")??g.namedChild(g.namedChildCount-1);if(b?.text.replace(/\s+/gu,"")!==`this.${i[1]}`||!C)return;let S=Ae(C);if(S.type!=="new_expression")return;let R=(S.childForFieldName("constructor")??S.namedChild(0))?.text.match(/[A-Za-z_$][\w$]*$/u)?.[0];R&&s.add(R)}),s.size!==1)return null;let c=[...s][0],d=o.filter(g=>g.localName===c);if(d.length!==1)return null;let l=d[0].importedName==="default"?c:d[0].importedName,u=d[0].importedName==="default"?je(e,d[0].sourcePath,c):[],f=u.length===1?u[0].leaf:l,m=X(e,d[0].sourcePath).filter(g=>g.isFunctionLike&&g.leaf===n.calleeLeaf&&On(g.symbol)===f);if(m.length!==1)return null;let p=m[0];return{calleeLeaf:n.calleeLeaf,line:n.line,sourceFile:t,targetFile:p.relativePath,targetStartLine:p.startLine,targetEndLine:p.endLine,targetSymbol:p.symbol,resolution:"constructed-member-receiver",strength:"exact"}}function ui(e,t){let n=[];return he(e,o=>{["class","class_declaration","class_definition"].includes(o.type)&&o.startPosition.row<=t&&o.endPosition.row>=t&&n.push(o)}),n.sort((o,i)=>o.endPosition.row-o.startPosition.row-(i.endPosition.row-i.startPosition.row))[0]??null}function Ae(e){let t=e;for(;["parenthesized_expression","as_expression","type_assertion","satisfies_expression"].includes(t.type)&&t.namedChildCount===1;)t=t.namedChild(0);return t}function he(e,t){t(e);for(let n of e.namedChildren)he(n,t)}function pi(e){let t=new Map,n=/\b(?:const|let|var)\s+([A-Za-z_$][\w$]*)\s*=\s*([A-Za-z_$][\w$]*)\s*;/gu;for(let o of e.matchAll(n)){let i=o[1],a=o[2];i&&a&&t.set(i,a)}return t}function on(e){let t=[];for(let n of e)t.some(o=>Pe(o,n))||t.push(n);return t}var mi=16,fi=4,gi=3e3,yi=800,hi=new Set(["assignment","const_declaration","const_item","field_declaration","lexical_declaration","local_declaration_statement","local_variable_declaration","static_item","variable_declaration"]);function go(e,t,n={}){let o=n.maxSteps??mi;if(!Number.isSafeInteger(o)||o<=0)throw new RangeError(`maxSteps must be a positive safe integer; received ${o}`);let i=new Map(t.nodes.map(E=>[E.id,E])),a=Li(n.focusLocations??[]),r=new Set,s=new Map(t.edges.map(E=>[E.id,E])),c=Le(t.paths.flatMap(E=>E.nodeIds)),d=Le(t.anchors.filter(E=>E.status==="matched").flatMap(E=>E.nodeIds)),l=t.nodes.filter(E=>E.disposition==="emitted"&&E.attributes.upstreamCausalPath===!0).sort((E,k)=>Number(k.attributes.upstreamCausalDistance??0)-Number(E.attributes.upstreamCausalDistance??0)||E.id.localeCompare(k.id)).map(E=>E.id),u=new Set(l),f=Math.max(0,o-d.length),p=bi(t,d,a,f).slice(0,f),g=new Set(p),b=new Set(p),C=new Set([...c,...l,...d]),S=t.edges.filter(E=>E.disposition==="emitted"&&E.kind!=="structural-membership"),v=t.edges.filter(E=>E.disposition!=="excluded"&&E.disposition!=="unsupported"&&E.kind!=="structural-membership"),R=new Set([...t.paths.flatMap(E=>E.edgeIds),...S.filter(E=>u.has(E.fromNodeId)&&u.has(E.toNodeId)).map(E=>E.id)]),y=t.paths.some(E=>E.edgeIds.length>0),N=new Set(d);for(let E of p)N.add(E);for(let E of t.paths){let k=E.nodeIds[0],G=s.get(E.edgeIds[0]??""),H=E.nodeIds[1];k&&H&&G?.fromNodeId===k&&G.toNodeId===H&&N.add(k)}if(t.paths.every(E=>E.nodeIds.length===0))for(let E of t.anchors)for(let k of E.nodeIds)N.add(k);let L=Ri(d,v,i,fi),x=Le(S.filter(E=>E.kind==="call"&&d.includes(E.fromNodeId)).map(E=>E.toNodeId)),M=new Set(Le([...L,...y?[]:x]));for(let E of M)N.add(E);let h=Le(S.flatMap(E=>C.has(E.fromNodeId)||C.has(E.toNodeId)?[E.fromNodeId,E.toNodeId]:[])),P=t.nodes.filter(E=>E.disposition==="emitted"&&E.kind!=="structural-region"&&S.some(k=>k.fromNodeId===E.id||k.toNodeId===E.id)).map(E=>E.id),D=Le([...l,...c,...d,...p,...M,...h,...P]).filter(E=>i.has(E)),O=[];for(let E of D)y&&!C.has(E)&&!g.has(E)&&!M.has(E)||O.length>=o&&!C.has(E)||O.push(E);let w=new Set(O),T=new Map(O.map(E=>[E,Fi(E)])),I=new Set([...c,...l]),_=new Set(t.anchors.flatMap(E=>E.nodeIds)),A=O.map((E,k)=>{let G=i.get(E),H=Ci(G,a);for(let me of H)r.add(qe(G.location.file,me));return{id:T.get(E),nodeId:E,order:k,role:_.has(E)?"anchor":I.has(E)?"connector":"junction",kind:G.kind,label:G.label,location:G.location,behavior:Si(e,G,_.has(E),[...new Set([...H,...Ei(e,G,v,i,R,N)])],H,N.has(G.id)&&(H.length===0||_.has(G.id)),M.has(G.id),b.has(G.id)&&H.length===0)}}),j=new Map;for(let E of t.paths)for(let k=0;k<E.edgeIds.length;k+=1){let G=s.get(E.edgeIds[k]),H=E.nodeIds[k],me=E.nodeIds[k+1];!G||!H||!me||j.set(G.id,G.fromNodeId===H&&G.toNodeId===me?"forward":"reverse")}let B=v.filter(E=>w.has(E.fromNodeId)&&w.has(E.toNodeId)).sort((E,k)=>Ti(E,k,t)).map((E,k)=>({id:Pi(E.id),edgeId:E.id,order:k,kind:E.kind,fromStepId:T.get(E.fromNodeId),toStepId:T.get(E.toNodeId),directed:!0,pathTraversal:j.get(E.id)??"adjacent",evidence:E.evidence})),U=new Map(B.map(E=>[E.edgeId,E.id])),q=t.paths.map(E=>({id:E.id,status:E.status,stepIds:E.nodeIds.flatMap(k=>{let G=T.get(k);return G?[G]:[]}),transitionIds:E.edgeIds.flatMap(k=>{let G=U.get(k);return G?[G]:[]})})),se=A.flatMap(E=>E.location?[`${E.location.file}:${E.location.line+1}`]:[]),Ne=t.anchors.some(E=>E.status==="ambiguous"),Oe=q.some(E=>E.status==="connected"||E.status==="candidate"),ve=q.some(E=>E.status==="partial");return{status:A.length===0?"unavailable":Ne?"ambiguous":Oe&&!ve?"connected":ve?"partial":"connected",steps:A,transitions:B,paths:q,coverage:{candidateNodes:D.length,returnedNodes:O.length,omittedNodeIds:D.filter(E=>!w.has(E)),returnedTransitions:B.length,withheldStatements:A.reduce((E,k)=>E+(k.behavior?.coverage.omittedStatements??0),0),requestedFocusLocations:a,matchedFocusLocations:a.filter(E=>r.has(qe(E.file,E.line))),unmatchedFocusLocations:a.filter(E=>!r.has(qe(E.file,E.line)))},behaviorCommand:fo(se,"behavior"),exactSourceCommand:fo(se,"source")}}function bi(e,t,n,o){if(o<=0||n.length===0)return[];let i=new Set(t),a=new Set(n.map(r=>qe(r.file,r.line)));return Le(e.edges.filter(r=>r.disposition!=="excluded"&&r.disposition!=="unsupported"&&["call","runtime-boundary"].includes(r.kind)&&i.has(r.fromNodeId)&&r.evidence.some(s=>!["candidate","unknown"].includes(s.strength)&&s.location&&a.has(qe(s.location.file,s.location.line)))).sort((r,s)=>{let c=r.evidence.find(l=>l.location)?.location,d=s.evidence.find(l=>l.location)?.location;return(c?.file??"").localeCompare(d?.file??"")||(c?.line??Number.MAX_SAFE_INTEGER)-(d?.line??Number.MAX_SAFE_INTEGER)||r.id.localeCompare(s.id)}).map(r=>r.toNodeId)).slice(0,o)}function Si(e,t,n,o,i,a,r,s){if(!t.location||!["symbol","source-construct","runtime-boundary-participant"].includes(t.kind))return null;let c=t.location.endLine??t.location.line,d=le(e,t.location.file),l=o.length>0?o:[t.location.line],u=t.kind==="runtime-boundary-participant"?Ye(e,t.location.file,0,Math.max(0,d.length-1),[t.location.line]):Ye(e,t.location.file,t.location.line,c,l),f=o.filter(M=>M>=u.startLine&&M<=u.endLine),m=yt(e,t.location.file,u.startLine,u.endLine,f),p=m??(f.length>0?yt(e,t.location.file,u.startLine,u.endLine,f,{requireSavings:!1}):null),g=f.length>0?Ii(e,t,u.startLine,u.endLine,f,p,a):null,b=d.slice(u.startLine,u.endLine+1).join(`
|
|
2
|
-
`).length,C=Me(e,t.location.file,u.startLine,u.endLine),S=d.slice(u.startLine,u.endLine+1).some((M,h)=>M.length>yi&&(C.get(u.startLine+h)??[]).some(P=>["binding","branch","loop","call","return","throw","mutation"].includes(P))),v=M=>vi(e,t,u.startLine,u.endLine,i.filter(h=>h>=u.startLine&&h<=u.endLine),M),R=(r||t.kind==="runtime-boundary-participant"||t.anchorIds.length>0)&&b<=gi,y=n&&(f.length===0||R);if(m&&(s||y))return v(co(m));if(!s&&!y&&g&&!S&&!R&&g.renderedCharacters<(p?.outlineCharacters??b))return v(g);if(m)return v(co(m));let N=d.slice(u.startLine,u.endLine+1),L=N.join(`
|
|
3
|
-
`),x=Me(e,t.location.file,u.startLine,u.endLine);return v({kind:"source",constructKind:"source construct",signature:N.find(M=>M.trim().length>0)?.trim()??t.label,lines:N.map((M,h)=>({line:u.startLine+h,endLine:u.startLine+h,depth:0,signals:x.get(u.startLine+h)??[],text:M,copied:!0})),coverage:{sourceStatements:N.length,representedStatements:N.length,copiedStatements:N.length,omittedStatements:0},rawCharacters:L.length,renderedCharacters:L.length})}function vi(e,t,n,o,i,a){if(!t.location)return a;let r=Zt(e,t.location.file,n,o);if(!r.available)return a;let s=Me(e,t.location.file,n,o),c=le(e,t.location.file),d=new Set(i);for(let S of i){let v=Et(c[S]??"");if(!v)continue;let R=Ee(e,t.location.file,v).find(y=>y>S&&y<=o);R!==void 0&&d.add(R)}let l=[...new Map(r.targets.flatMap(S=>{let v=S.definition,R=v.relativePath===t.location.file&&v.startLine<=o&&v.endLine>=n;if(v.isTypeLike||R)return[];let y=Jt(e,v),N=i.length>0&&y&&s.get(S.sourceLine)?.includes("return"),L=y&&d.has(S.sourceLine);return y&&!N&&!L?[]:[[v.symbol,{definition:v,kind:N?"return-value-transformer":L?"focused-causal-target":"compiler-referenced-declaration"}]]})).values()].sort((S,v)=>S.definition.relativePath.localeCompare(v.definition.relativePath)||S.definition.startLine-v.definition.startLine||S.definition.symbol.localeCompare(v.definition.symbol)),u=[],f=l.filter(({kind:S})=>S!=="compiler-referenced-declaration").map(({definition:S})=>({owner:S,depth:1})),m=new Set,p=new Set(l.map(({definition:S})=>S.symbol));for(;f.length>0;){let S=f.shift();if(!S||m.has(S.owner.symbol))continue;m.add(S.owner.symbol);let{owner:v,depth:R}=S,y=Zt(e,v.relativePath,v.startLine,v.endLine);if(!y.available)continue;let N=Me(e,v.relativePath,v.startLine,v.endLine),L=le(e,v.relativePath);for(let x of y.targets){let M=x.definition,h=M.relativePath===v.relativePath&&M.startLine<=v.endLine&&M.endLine>=v.startLine;if(M.isTypeLike||h)continue;let P=Jt(e,M),D=Et(L[x.sourceLine]??""),O=P&&D!==null&&Ee(e,v.relativePath,D).some(T=>T>x.sourceLine&&T<=v.endLine&&(N.get(T)??[]).some(I=>["branch","return","throw"].includes(I))),w=P&&((N.get(x.sourceLine)??[]).some(T=>["branch","return","throw"].includes(T))||O);P&&!w||(p.has(M.symbol)||(p.add(M.symbol),u.push({definition:M,kind:P?"focused-causal-target":"compiler-referenced-declaration"})),P&&R<2&&f.push({owner:M,depth:R+1}))}}let g=[...new Map([...l,...u].map(S=>[S.definition.symbol,S])).values()].sort((S,v)=>S.definition.relativePath.localeCompare(v.definition.relativePath)||S.definition.startLine-v.definition.startLine||S.definition.symbol.localeCompare(v.definition.symbol)),b=[],C=[];for(let{definition:S,kind:v}of g){let R=v==="compiler-referenced-declaration"?xi(e,S.relativePath,S.startLine,S.endLine):{startLine:S.startLine,endLine:S.endLine},y=le(e,S.relativePath).slice(R.startLine,R.endLine+1).join(`
|
|
4
|
-
`),N=v==="compiler-referenced-declaration"?null:yt(e,S.relativePath,S.startLine,S.endLine,[]),L=N?[N.signature,...N.lines.map(D=>`${D.line+1}${D.signals.length>0?`[${D.signals.join(",")}]`:""} ${D.text}`)].join(" | "):null,x=L&&L.length<y.length?L:y,M={symbol:S.symbol,label:S.leaf,file:S.relativePath,line:R.startLine,endLine:R.endLine},h=v==="compiler-referenced-declaration"?1e3:8e3,P=v==="compiler-referenced-declaration"?12:120;if(x.length>h||R.endLine-R.startLine>P){C.push({...M,reason:"source-too-large"});continue}b.push({kind:v,...M,text:x})}return{...a,...b.length===0?{}:{supportingDeclarations:b},...C.length===0?{}:{omittedSupportingDeclarations:C}}}function xi(e,t,n,o){let i=Y(e,t);if(!i)return{startLine:n,endLine:o};let a=[];yo(i.rootNode,s=>{hi.has(s.type)&&s.startPosition.row<=n&&s.endPosition.row>=o&&a.push(s)});let r=a.sort((s,c)=>s.endPosition.row-s.startPosition.row-(c.endPosition.row-c.startPosition.row)||s.endIndex-s.startIndex-(c.endIndex-c.startIndex))[0];return r?{startLine:r.startPosition.row,endLine:r.endPosition.row}:{startLine:n,endLine:o}}function yo(e,t){t(e);for(let n of e.namedChildren)yo(n,t)}function co(e){return{kind:"outline",constructKind:e.constructKind,signature:e.signature,lines:e.lines,coverage:e.coverage,rawCharacters:e.rawCharacters,renderedCharacters:e.outlineCharacters}}function Ei(e,t,n,o,i,a){if(!t.location||!["symbol","source-construct","runtime-boundary-participant"].includes(t.kind))return[];let r=new Set,s=new Set(oe(e,t.location.file)?.callSites.map(c=>c.line)??[]);if(t.kind==="runtime-boundary-participant"&&r.add(t.location.line),a.has(t.id))for(let c of Vt(e,{files:[t.location.file]}))c.source.startLine>=t.location.line&&c.source.startLine<=(t.location.endLine??t.location.line)&&r.add(c.source.startLine);for(let c of n){if(c.fromNodeId!==t.id&&c.toNodeId!==t.id)continue;let d=o.get(c.fromNodeId===t.id?c.toNodeId:c.fromNodeId),l=a.has(t.id)&&["call","reference","runtime-boundary"].includes(c.kind)&&c.fromNodeId===t.id,u=(d?.anchorIds.length??0)>0;if(!i.has(c.id)&&!l&&!u)continue;let f=c.evidence.flatMap(C=>C.location?.file===t.location.file?[C.location.line]:[]),m=f.filter(C=>s.has(C));for(let C of m.length>0?m:f)r.add(C);let p=d?.attributes.leaf;if(typeof p!="string"||p.length===0)continue;let g=Ee(e,t.location.file,p).filter(C=>C>=t.location.line&&C<=(t.location.endLine??t.location.line)),b=g.find(C=>s.has(C))??g[0];b!==void 0&&r.add(b)}return[...r].sort((c,d)=>c-d)}function Ci(e,t){if(!e.location)return[];let n=e.location.endLine??e.location.line;return t.filter(o=>o.file===e.location.file&&o.line>=e.location.line&&o.line<=n).map(o=>o.line)}function Li(e){let t=new Map;for(let n of e){if(!n.file||!Number.isSafeInteger(n.line)||n.line<0)throw new RangeError(`Behavior focus locations require a repository file and non-negative line; received ${JSON.stringify(n)}.`);t.set(qe(n.file,n.line),{file:n.file,line:n.line})}return[...t.values()].sort((n,o)=>n.file.localeCompare(o.file)||n.line-o.line)}function qe(e,t){return`${e}\0${t}`}function Ii(e,t,n,o,i,a,r){if(!t.location)return null;let s=le(e,t.location.file),c=Me(e,t.location.file,n,o),d=[...c].filter(([,w])=>w.length>0).map(([w])=>w).sort((w,T)=>w-T),l=i.map(w=>(c.get(w)??[]).length>0?w:d.find(T=>T>w&&T-w<=8)??w),u=new Set([...i,...l]),f=r?Qt(e,t.location.file,n,o,{minimumBodyLines:0}):null,m=a?[...new Map(l.flatMap(w=>a.lines.filter(T=>T.text.length<=500&&T.signals.some(I=>["branch","loop","catch","finally"].includes(I))&&w>=T.line&&w<=T.endLine).sort((T,I)=>T.endLine-T.line-(I.endLine-I.line)||T.line-I.line).slice(0,2).map(T=>[`${T.line}\0${T.endLine}`,T]))).values()]:ht(e,t.location.file,n,o,l);for(let w of f?.lines??[])u.add(w.line);for(let w of m)u.add(w.line);for(let[w,T]of c)T.includes("call")&&T.includes("shape")&&u.add(w);let p=[];for(let w of l){let T=Et(s[w]??"");if(!T)continue;let I=Ee(e,t.location.file,T).filter(B=>B>w&&B<=o),_=I[0];_!==void 0&&u.add(_);let A=I.find(B=>(c.get(B)??[]).some(U=>U==="branch"||U==="loop"));if(A===void 0)continue;u.add(A);let j=(a?.lines??[]).find(B=>B.line===A)??{line:A,endLine:Math.min(o,A+40),depth:0,signals:c.get(A)??[],text:(s[A]??"").trim(),copied:!0},$=a?.lines??s.slice(j.line,j.endLine+1).map((B,U)=>{let q=j.line+U;return{line:q,endLine:q,depth:0,signals:c.get(q)??[],text:B.trim(),copied:!0}});p.push({focusLine:w,governingUse:A,lines:$.filter(B=>B.line>=j.line&&B.line<=j.endLine&&B.text.length<=500&&B.signals.some(U=>["binding","branch","call","mutation"].includes(U)))})}for(let w of p.sort((T,I)=>I.governingUse-I.focusLine-(T.governingUse-T.focusLine)||T.focusLine-I.focusLine).slice(0,2))for(let T of w.lines.slice(0,14))u.add(T.line);let g=new Set(["binding","branch","loop","call","return","throw","mutation"]);for(let w of m)for(let T of a?.lines??[])T.line<w.line||T.line>w.endLine||T.signals.some(I=>g.has(I))&&u.add(T.line);let b=s.slice(n,o+1).flatMap((w,T)=>{let I=Et(w);return I?[{name:I,line:n+T}]:[]}),C=!0;for(;C;){C=!1;for(let w of b)if([...u].some(I=>Ni(s[I]??"",w.name))){u.has(w.line)||(u.add(w.line),C=!0);for(let I of Ee(e,t.location.file,w.name))I<n||I>o||u.has(I)||(c.get(I)??[]).some(_=>g.has(_))&&(u.add(I),C=!0)}}for(let w of a?.lines??[])if(w.signals.some(T=>["branch","loop","catch","finally"].includes(T))&&u.has(w.line))for(let T of a?.lines??[])T.line<w.line||T.line>w.endLine||T.signals.some(I=>g.has(I))&&u.add(T.line);let S=oe(e,t.location.file),v=new Set(S?.callSites.map(w=>w.line)??[]),R=c,y=new Map([...a?.lines??[],...m].filter(w=>w.signals.some(T=>["branch","loop","catch","finally"].includes(T))).map(w=>[w.line,w])),N=new Map((a?.lines??[]).filter(w=>w.text.length<=500&&w.signals.includes("shape")&&(w.signals.includes("call")||w.signals.includes("mutation")||w.signals.includes("return"))).sort((w,T)=>w.endLine-w.line-(T.endLine-T.line)||w.line-T.line).map(w=>[w.line,w])),L=new Map((f?.lines??[]).map(w=>[w.line,w.signals.filter(T=>T!=="lifecycle")])),x=[...u].filter(w=>w>=n&&w<=o).sort((w,T)=>w-T).map(w=>{let T=y.get(w)??N.get(w);return{line:w,endLine:T?.endLine??w,depth:T?.depth??0,signals:wi([...R.get(w)??[],...a?.lines.filter(I=>w>=I.line&&w<=I.endLine).flatMap(I=>I.signals)??[],...L.get(w)??[],...i.includes(w)?["anchor"]:[],...v.has(w)?["call"]:[]]),text:T?.text??(s[w]??"").trim(),copied:T?.copied??!0}}).filter(w=>w.text.length>0);if(x.length===0)return null;let M=f?.candidateLines??Qt(e,t.location.file,n,o,{minimumBodyLines:0})?.candidateLines??0,h=Math.max(a?.coverage.sourceStatements??0,M,x.length),P=a?.signature??(s[n]??t.label).trim(),D=P.length+x.reduce((w,T)=>w+T.text.length+T.signals.join(",").length+12,0),O=s.slice(n,o+1).join(`
|
|
5
|
-
`).length;return{kind:"connector-slice",constructKind:a?.constructKind??"source construct",signature:P,lines:x,coverage:{sourceStatements:h,representedStatements:x.length,copiedStatements:x.length,omittedStatements:Math.max(0,h-x.length)},rawCharacters:O,renderedCharacters:D}}function wi(e){let t=["anchor","signature","binding","branch","loop","call","await","return","throw","mutation","shape","spread","catch","finally"],n=new Set(e);return t.filter(o=>n.has(o))}function Et(e){return/\b(?:const|let|var)\s+([\p{L}_$][\p{L}\p{N}_$]*)\s*(?:=|\bof\b|\bin\b)/u.exec(e)?.[1]??null}function Ni(e,t){let n=t.replace(/[.*+?^${}()|[\]\\]/gu,"\\$&");return new RegExp(`(?:^|[^\\p{L}\\p{N}_$])${n}(?:$|[^\\p{L}\\p{N}_$])`,"u").test(e)}function Mi(e,t,n){return Le(e.flatMap(o=>{let i=n.get(o),a=t.filter(r=>r.kind==="call"&&r.toNodeId===o).map(r=>({edge:r,node:n.get(r.fromNodeId)})).filter(r=>r.node!==void 0&&["symbol","source-construct","runtime-boundary-participant"].includes(r.node.kind)&&r.node.location!==null).sort((r,s)=>{let c=uo(s.edge)-uo(r.edge);if(c!==0)return c;let d=po(r.node,i)?0:1,l=po(s.node,i)?0:1,u=(r.node.location?.endLine??r.node.location?.line??0)-(r.node.location?.line??0),f=(s.node.location?.endLine??s.node.location?.line??0)-(s.node.location?.line??0);return d-l||u-f||r.node.label.localeCompare(s.node.label)});return a[0]?[a[0].node.id]:[]}))}function uo(e){let t={exact:4,mixed:3,derived:2,candidate:1,unknown:0};return Math.max(0,...e.evidence.map(n=>t[n.strength]))}function po(e,t){return!e.location||!t?.location?!1:mo(e.location.file)===mo(t.location.file)}function mo(e){return e.split("/").filter(Boolean).slice(0,2).join("/")}function Ri(e,t,n,o){let i=new Set(e),a=new Set,r=[],s=Le(e);for(let c=0;c<o&&s.length>0;c+=1){let d=s.filter(u=>!a.has(u));for(let u of d)a.add(u);let l=Mi(d,t,n);s=[];for(let u of l)!i.has(u)&&!r.includes(u)&&r.push(u),a.has(u)||s.push(u)}return r}function Ti(e,t,n){let o=new Map(n.paths.flatMap(i=>i.edgeIds).map((i,a)=>[i,a]));return(o.get(e.id)??Number.MAX_SAFE_INTEGER)-(o.get(t.id)??Number.MAX_SAFE_INTEGER)||e.id.localeCompare(t.id)}function Fi(e){return`step:${e}`}function Pi(e){return`transition:${e}`}function fo(e,t){return e.length===0?null:`scip-query inspect ${e.map(n=>`--at ${Ai(n)}`).join(" ")} --view ${t}`}function Ai(e){return`'${e.replace(/'/gu,`'"'"'`)}'`}function Le(e){return[...new Set(e)]}var ki=6;function ho(e,t,n){return`${e}\0${t}\0${n??t}`}function xo(e,t,n,o={}){let i=o.limit??ki;if(!Number.isSafeInteger(i)||i<=0)throw new RangeError(`next-anchor limit must be a positive safe integer; received ${i}`);let a=o.sourceAllowed??(()=>!0),r=new Map(t.nodes.map(x=>[x.id,x])),s=new Set(n.steps.map(x=>x.nodeId)),c=new Set(n.steps.flatMap(x=>{let M=rn(r.get(x.nodeId));return M?[M]:[]})),d=new Set;for(let x of n.steps)for(let M of x.behavior?.supportingDeclarations??[])c.add(M.symbol),d.add(ho(M.file,M.line,M.endLine));let l=x=>x.symbol!==null&&c.has(x.symbol)||d.has(ho(x.file,x.line,x.endLine)),u=new Map(n.steps.flatMap(x=>{if(!x.location)return[];let M=rn(r.get(x.nodeId));if(!M)return[];let h=X(e,x.location.file).find(P=>P.symbol===M);return h?[[x.id,h]]:[]})),f=new St(e).calleeMap([...u.values()],{additive:!1,semantic:!0}),m=[],p=new Set,g=new Set,b=0,C=0,S=0,v=0,R=0,y=0,N=0,L=0;for(let x of n.steps){if(!x.location||!x.behavior)continue;let M=$i(x,{db:e,topology:t,nodeById:r,returnedNodeIds:s,sourceAllowed:a,alternativeAlreadyReturned:l});m.push(...M.candidates),y+=M.upstreamCandidates,L+=M.runtimeCandidates,N+=M.resultCandidates;let h=Di(x,{db:e,topology:t,nodeById:r,returnedNodeIds:s,sourceAllowed:a,alternativeAlreadyReturned:l},p);m.push(...h);let P=_i(x,{db:e,topology:t,nodeById:r,returnedNodeIds:s,sourceAllowed:a,alternativeAlreadyReturned:l},{evidencedCallsiteKeys:p,consideredCandidateKeys:g,calleeMap:f,stepDefinition:u.get(x.id)});m.push(...P.candidates),b+=P.scannedBehaviorSteps,C+=P.visibleCallsites,S+=P.identityCandidateCallsites,v+=P.ambiguousCallsites,R+=P.unresolvedCallsites}return Bi(e,m,n.steps,i,{scannedBehaviorSteps:b,visibleCallsites:C,graphEvidencedCallsites:p.size,identityCandidateCallsites:S,ambiguousCallsites:v,unresolvedCallsites:R,upstreamCandidates:y,resultCandidates:N,runtimeCandidates:L},o.selectionTerms)}function $i(e,t){let n=[],o=0,i=0,a=0;if(!e.location||!e.behavior)return{candidates:n,upstreamCandidates:o,resultCandidates:i,runtimeCandidates:a};let r=t.topology.edges.filter(c=>["call","runtime-boundary"].includes(c.kind)&&(c.fromNodeId===e.nodeId||c.toNodeId===e.nodeId)&&c.disposition!=="excluded"&&c.disposition!=="unsupported");for(let c of r){let d=c.toNodeId===e.nodeId,l=d?c.fromNodeId:c.toNodeId;if(t.returnedNodeIds.has(l))continue;let u=t.nodeById.get(l);if(!u?.location||!t.sourceAllowed(u.location.file))continue;let f=c.kind==="call"?an(t.db,u):dn(u);if(!f||t.alternativeAlreadyReturned(f))continue;let m=sn(c,u.location.file)??u.location,p=le(t.db,m.file)[m.line]?.trim(),g=d?"upstream":"downstream",b=c.kind==="runtime-boundary"?d?"runtime-producer":"runtime-consumer":d?"caller":"callee",C=ln(c.evidence),S=Je(u);n.push({anchor:{id:ze(e.id,m.line,u.id),status:C,source:"graph-relation",direction:g,causalRole:b,relationKind:c.kind,fromStepId:e.id,fromLabel:e.label,callsite:{file:m.file,line:m.line,endLine:m.endLine??m.line,text:p||`${u.label} \u2192 ${e.label}`,signals:["call"],calleeLeaf:S},alternatives:[f],alternativeCount:1,evidence:c.evidence}}),d&&(o+=1),c.kind==="runtime-boundary"&&(a+=1)}let s=t.topology.edges.filter(c=>c.kind==="reference"&&c.fromNodeId===e.nodeId&&c.disposition!=="excluded"&&c.disposition!=="unsupported"&&!t.returnedNodeIds.has(c.toNodeId));for(let c of s){let d=t.nodeById.get(c.toNodeId);if(!d?.location||!t.sourceAllowed(d.location.file))continue;let l=an(t.db,d);if(!l||t.alternativeAlreadyReturned(l))continue;let u=Je(d),f=sn(c,e.location.file)?.line,m=e.behavior.lines.find(b=>(f===void 0||f>=b.line&&f<=b.endLine)&&b.text.includes(u));if(!m)continue;let p=Co(m.signals),g=ln(c.evidence);n.push({anchor:{id:ze(e.id,m.line,d.id),status:g,source:"graph-relation",direction:"downstream",causalRole:p,relationKind:"reference",fromStepId:e.id,fromLabel:e.label,callsite:{file:e.location.file,line:m.line,endLine:m.endLine,text:m.text,signals:m.signals,calleeLeaf:u},alternatives:[l],alternativeCount:1,evidence:c.evidence}}),p==="result-callback"&&(i+=1)}return{candidates:n,upstreamCandidates:o,resultCandidates:i,runtimeCandidates:a}}function Di(e,t,n){let o=[];if(!e.location)return o;let i=bt(t.db,e.location.file,e.location.line,e.location.endLine??e.location.line),a=le(t.db,e.location.file),r=Me(t.db,e.location.file,e.location.line,e.location.endLine??e.location.line);for(let s of i.targets){if(!t.sourceAllowed(s.definition.relativePath))continue;let c=Ct(e.location.file,s.sourceLine,s.calleeLeaf);if(n.has(c))continue;n.add(c);let d=Gi(r.get(s.sourceLine)),l={symbol:s.definition.symbol,label:s.definition.leaf,file:s.definition.relativePath,line:s.definition.startLine,endLine:s.definition.endLine};t.alternativeAlreadyReturned(l)||o.push({anchor:{id:ze(e.id,s.sourceLine,s.definition.symbol),status:"exact",source:"graph-call",direction:"downstream",causalRole:"callee",relationKind:"call",fromStepId:e.id,fromLabel:e.label,callsite:{file:e.location.file,line:s.sourceLine,endLine:s.sourceLine,text:a[s.sourceLine]?.trim()||`${s.calleeLeaf}()`,signals:d,calleeLeaf:s.calleeLeaf},alternatives:[l],alternativeCount:1,evidence:[{method:"scip-occurrence-callsite",strength:"exact",identity:s.definition.symbol,location:{file:e.location.file,line:s.sourceLine}}]}})}return o}function _i(e,t,n){let o={candidates:[],scannedBehaviorSteps:0,visibleCallsites:0,identityCandidateCallsites:0,ambiguousCallsites:0,unresolvedCallsites:0};if(!e.location||!e.behavior)return o;let i=e.behavior.lines.filter(p=>p.signals.includes("call"));if(i.length===0)return o;let a=[],r=0,s=0,c=0,d=(oe(t.db,e.location.file)?.callSites??[]).filter(p=>i.some(g=>p.line>=g.line&&p.line<=g.endLine)),l=t.topology.edges.filter(p=>p.kind==="call"&&p.fromNodeId===e.nodeId&&p.disposition!=="excluded"&&p.disposition!=="unsupported"),u=new Map;for(let p of l){let g=t.nodeById.get(p.toNodeId);if(!g)continue;let b=Je(g);u.set(b,(u.get(b)??0)+1)}let f=ji(t.db,n.stepDefinition?n.calleeMap.get(n.stepDefinition.symbolId)??[]:[]),m=Ki(f);for(let p of f){if(!t.sourceAllowed(p.alternative.file)||t.alternativeAlreadyReturned(p.alternative))continue;let g=Xe(p.alternative.label),b=So(d,i,g,p.row.callsiteLine,m.get(g)===1);if(!b)continue;let C=Ze(i,b.line,g);if(!C)continue;let S=Ct(e.location.file,b.line,g);if(n.evidencedCallsiteKeys.has(S))continue;n.evidencedCallsiteKeys.add(S);let v=Io(p.row.source);a.push({anchor:{id:ze(e.id,b.line,p.alternative.symbol??p.alternative.file),status:v,source:"graph-call",direction:"downstream",causalRole:"callee",relationKind:"call",fromStepId:e.id,fromLabel:e.label,callsite:{file:e.location.file,line:C.line,endLine:C.endLine,text:C.text,signals:C.signals,calleeLeaf:g},alternatives:[p.alternative],alternativeCount:1,evidence:[{method:p.row.source,strength:v,identity:p.row.symbol,location:{file:e.location.file,line:b.line}}]}})}for(let p of l){if(t.returnedNodeIds.has(p.toNodeId))continue;let g=t.nodeById.get(p.toNodeId);if(!g?.location||!t.sourceAllowed(g.location.file))continue;let b=Je(g),C=p.evidence.find(L=>{let x=L.location;return x!==null&&x.file===e.location?.file&&x.line>=0})?.location?.line,S=So(d,i,b,C,u.get(b)===1);if(!S)continue;let v=Ze(i,S.line,b);if(!v)continue;let R=Ct(e.location.file,S.line,b);if(n.evidencedCallsiteKeys.has(R))continue;n.evidencedCallsiteKeys.add(R);let y=dn(g);if(!y||t.alternativeAlreadyReturned(y))continue;let N=ln(p.evidence);a.push({anchor:{id:ze(e.id,S.line,g.id),status:N,source:"graph-call",direction:"downstream",causalRole:"callee",relationKind:"call",fromStepId:e.id,fromLabel:e.label,callsite:{file:e.location.file,line:v.line,endLine:v.endLine,text:v.text,signals:v.signals,calleeLeaf:b},alternatives:[y],alternativeCount:1,evidence:p.evidence}})}for(let p of d){let g=Ct(e.location.file,p.line,p.calleeLeaf);if(n.evidencedCallsiteKeys.has(g))continue;let b=Ze(i,p.line,p.calleeLeaf);if(!b)continue;let C=ft(e.location.file,gt(t.db).get(p.calleeLeaf)??[]).flatMap(y=>X(t.db,y.file).filter(N=>N.symbol===y.symbol&&N.isFunctionLike)).filter(y=>t.sourceAllowed(y.relativePath)&&!t.alternativeAlreadyReturned({symbol:y.symbol,label:y.leaf,file:y.relativePath,line:y.startLine,endLine:y.endLine})),S=cn(C.map(y=>({symbol:y.symbol,label:y.leaf??p.calleeLeaf,file:y.relativePath,line:y.startLine,endLine:y.endLine})));if(S.length===0){c+=1;continue}let v=`${e.id}\0${p.line}\0${p.calleeLeaf}`;if(n.consideredCandidateKeys.has(v))continue;n.consideredCandidateKeys.add(v);let R=S.length>1;R?s+=1:r+=1,a.push({anchor:{id:ze(e.id,p.line,p.calleeLeaf),status:R?"ambiguous":"candidate",source:"leaf-identity-candidate",direction:"downstream",causalRole:"callee",relationKind:"call",fromStepId:e.id,fromLabel:e.label,callsite:{file:e.location.file,line:b.line,endLine:b.endLine,text:b.text,signals:b.signals,calleeLeaf:p.calleeLeaf},alternatives:S.slice(0,3),alternativeCount:S.length,evidence:[]}})}return{candidates:a,scannedBehaviorSteps:1,visibleCallsites:d.length,identityCandidateCallsites:r,ambiguousCallsites:s,unresolvedCallsites:c}}function Eo(e,t,n){let o=new Map(t.nodes.map(i=>[i.id,i]));for(let i of n.steps)if(!(!i.behavior||!i.location))for(let a of t.edges){if(a.kind!=="reference"||a.fromNodeId!==i.nodeId||a.disposition==="excluded"||a.disposition==="unsupported")continue;let r=o.get(a.toNodeId);if(!r?.location||!an(e,r))continue;let s=Je(r),c=sn(a,i.location.file)?.line,d=i.behavior.lines.find(l=>(c===void 0||c>=l.line&&c<=l.endLine)&&l.text.includes(s));!d||Co(d.signals)!=="result-callback"||a.semantics?.some(({family:l,subtype:u})=>l==="control"&&u==="result-callback")||(a.semantics=[...a.semantics??[],{family:"control",subtype:"result-callback",attributes:{evidenceRole:"result-producing-callable-reference"}}])}}function Co(e){return e.includes("call")&&e.some(t=>["return","mutation","shape","spread","binding"].includes(t))?"result-callback":"callable-reference"}function Bi(e,t,n,o,i,a=[]){let r=qi(t).sort(Lo),s=r.filter(p=>Oi(e,p)).slice(0,o),c=new Set(s.map(p=>p.anchor.id)),d=r.filter(p=>!c.has(p.anchor.id)),l=s.map(p=>p.anchor),u=d.map(p=>p.anchor),f=cn(l.flatMap(p=>p.alternativeCount===1?p.alternatives:[])),m=cn(u.flatMap(p=>p.alternativeCount===1?p.alternatives:[]));return{anchors:l,withheldAnchors:u,candidateAnchors:r.length,omittedAnchors:Math.max(0,r.length-l.length),...i,inspectCommand:f.length===0?null:`scip-query inspect ${f.map(vo).join(" ")} --view behavior`,remainingInspectCommands:Ui(m,8).map(p=>`scip-query inspect ${p.map(vo).join(" ")} --view behavior`)}}function Lo(e,t){let n=e.anchor.alternatives[0],o=t.anchor.alternatives[0];return Lt(e.anchor.status)-Lt(t.anchor.status)||(e.anchor.direction??"").localeCompare(t.anchor.direction??"")||(e.anchor.relationKind??"").localeCompare(t.anchor.relationKind??"")||(e.anchor.causalRole??"").localeCompare(t.anchor.causalRole??"")||e.anchor.fromStepId.localeCompare(t.anchor.fromStepId)||e.anchor.callsite.file.localeCompare(t.anchor.callsite.file)||e.anchor.callsite.line-t.anchor.callsite.line||(n?.file??"").localeCompare(o?.file??"")||(n?.line??0)-(o?.line??0)||e.anchor.id.localeCompare(t.anchor.id)}function Oi(e,t){if(t.anchor.alternativeCount!==1)return!0;let n=t.anchor.alternatives[0],o=n.endLine??n.line;return le(e,n.file).slice(n.line,o+1).join(`
|
|
6
|
-
`).length<=2e4}function Gi(e){return e?.includes("call")?[...e]:["call",...e??[]]}function ji(e,t){let n=new Map;for(let o of t){let i=X(e,o.file).find(s=>s.symbol===o.symbol&&s.isFunctionLike);if(!i)continue;let a={symbol:i.symbol,label:i.leaf,file:i.relativePath,line:i.startLine,endLine:i.endLine},r=n.get(i.symbol);!r||bo(o.source)>bo(r.row.source)?n.set(i.symbol,{row:{...o,...o.callsiteLine===void 0&&r?.row.callsiteLine!==void 0?{callsiteLine:r.row.callsiteLine}:{}},alternative:a}):r.row.callsiteLine===void 0&&o.callsiteLine!==void 0&&n.set(i.symbol,{...r,row:{...r.row,callsiteLine:o.callsiteLine}})}return[...n.values()]}function Ki(e){let t=new Map;for(let n of e){let o=Xe(n.alternative.label);t.set(o,(t.get(o)??0)+1)}return t}function Io(e){return e==="semantic-callee"||e==="scip-chunk"||e==="scip-occurrence"?"exact":"derived"}function bo(e){return Io(e)==="exact"?2:1}function Ze(e,t,n){return e.find(o=>t>=o.line&&t<=o.endLine&&o.text.includes(n))??e.find(o=>t>=o.line&&t<=o.endLine)??null}function So(e,t,n,o,i){if(o!==void 0)return e.find(r=>r.line===o&&r.calleeLeaf===n&&Ze(t,r.line,n)!==null)??null;let a=e.filter(r=>r.calleeLeaf===n&&Ze(t,r.line,r.calleeLeaf)!==null);return i&&a.length===1?a[0]:null}function Je(e){let t=e.attributes.leaf;if(typeof t=="string"&&t.length>0)return Xe(t);let n=e.label.slice(e.label.lastIndexOf(":")+1);return Xe(n)}function rn(e){if(e?.kind!=="symbol"||!e.id.startsWith("symbol:"))return null;try{return decodeURIComponent(e.id.slice(7))}catch{return null}}function dn(e){return e.location?{symbol:rn(e),label:e.label,file:e.location.file,line:e.location.line,endLine:e.location.endLine??null}:null}function an(e,t){let n=dn(t);return n?.symbol&&X(e,n.file).some(i=>i.symbol===n.symbol&&i.isFunctionLike)?n:null}function sn(e,t){return e.evidence.find(n=>n.location?.file===t)?.location??e.evidence.find(n=>n.location!==null)?.location??null}function ln(e){let t={exact:5,derived:4,mixed:3,candidate:2,unknown:1};return e.reduce((n,o)=>t[o.strength]>t[n]?o.strength:n,"unknown")}function qi(e){let t=new Map;for(let n of e){let i=n.anchor.alternatives[0]?.symbol??`${n.anchor.callsite.file}:${n.anchor.callsite.line}:${n.anchor.callsite.calleeLeaf}`,a=t.get(i);(!a||zi(n,a)<0)&&t.set(i,n)}return[...t.values()]}function zi(e,t){return Lt(e.anchor.status)-Lt(t.anchor.status)||e.anchor.alternativeCount-t.anchor.alternativeCount||Lo(e,t)}function Lt(e){return{exact:0,derived:1,mixed:2,candidate:3,unknown:4,ambiguous:5}[e]}function cn(e){let t=new Map;for(let n of e)t.set(n.symbol??`${n.file}:${n.line}`,n);return[...t.values()].sort((n,o)=>n.file.localeCompare(o.file)||n.line-o.line||n.label.localeCompare(o.label))}function vo(e){return`--at ${Wi(`${e.file}:${e.line+1}`)}`}function Ui(e,t){let n=[];for(let o=0;o<e.length;o+=t)n.push(e.slice(o,o+t));return n}function Wi(e){return`'${e.replaceAll("'","'\\''")}'`}function Ct(e,t,n){return`${e}\0${t}\0${n}`}function ze(e,t,n){return["next-anchor",e,String(t),n].map(encodeURIComponent).join(":")}var wo=["call","contract-symbol","import","reference","runtime-boundary"],Hi={call:[{family:"control",subtype:"call"}],"contract-symbol":[{family:"contract",subtype:"uses-contract-symbol"}],import:[{family:"identity",subtype:"imports"}],reference:[{family:"identity",subtype:"references"}]},Vi={"structural-membership":[{family:"identity",subtype:"contains"}],"boundary-observation":[{family:"identity",subtype:"owns-runtime-observation"}],"external-import":[{family:"identity",subtype:"imports-external"}]};function No(e){if(e.kind!=="runtime-boundary")return Mo(Hi[e.kind]);let t=e.fromBoundaryParticipant?.protocol??e.toBoundaryParticipant?.protocol,n={crossesRuntimeBoundary:!0,...t?{protocol:t}:{},...e.runtimeBoundaryKey?{runtimeKey:e.runtimeBoundaryKey}:{}},o=[{family:"control",subtype:"runtime-handoff",context:n}];return e.evidence==="runtime-boundary:carrier.discriminator"&&(o.push({family:"control",subtype:"discriminator-dispatch",context:{...n},attributes:{joinRule:"carrier.discriminator",...e.fromBoundaryParticipant?.action?{producerAction:e.fromBoundaryParticipant.action}:{},...e.toBoundaryParticipant?.action?{consumerAction:e.toBoundaryParticipant.action}:{}}}),o.push({family:"data",subtype:"serialized-discriminator-transfer",context:{...n},attributes:{joinRule:"carrier.discriminator"}})),e.evidence==="runtime-boundary:queue.address"&&e.fromBoundaryParticipant?.action==="queue.send"&&e.toBoundaryParticipant?.action==="queue.consume"&&o.push({family:"temporal",subtype:"enqueue-before-consume",context:{...n},attributes:{producerAction:e.fromBoundaryParticipant.action,consumerAction:e.toBoundaryParticipant.action,retryPolicy:"unknown"}}),o}function It(e){return Mo(Vi[e])}function Mo(e){return e.map(t=>({...t,...t.context?{context:{...t.context}}:{},...t.attributes?{attributes:{...t.attributes}}:{}}))}import{join as va}from"path";import{createRequire as Qi}from"module";import{resolve as tt}from"path";var Yi=Qi(import.meta.url),et;function To(e,t,n){let o=Xi();if(!o)return un("The TypeScript compiler runtime is unavailable.");let i=Zi(o,e,t),a=i.getSourceFile(tt(t))??i.getSourceFile(t);if(!a)return un(`The TypeScript compiler did not materialize ${t}.`);let r={ts:o,sourceFile:a,checker:i.getTypeChecker(),points:new Map,edges:new Map,unsupported:new Set,nextCfgId:0},s=ea(o,a,n);if(s.length===0)return un("No function-like construct intersects the selected source range.");let c=new Map(s.map(u=>[u,ta(a,u)])),d=s.map(u=>oa(r,u,na(o,u,c),c.get(u)));for(let u of d)ra(r,u),la(r,u),ua(r,u);ma(r,d);let l=[...r.unsupported].sort();return{points:[...r.points.values()].map(({node:u,...f})=>f).sort(Sa),edges:[...r.edges.values()].sort((u,f)=>u.id.localeCompare(f.id)),coverage:{status:l.length===0?"complete":"partial",basis:"typescript-compiler-cfg-reaching-definitions",unsupported:l}}}function Xi(){if(et!==void 0)return et;try{et=Yi("typescript")}catch{et=Bn()?.ts??null}return et}function Zi(e,t,n){let o=tt(n),i={target:e.ScriptTarget.ESNext,module:e.ModuleKind.NodeNext,moduleResolution:e.ModuleResolutionKind.NodeNext,skipLibCheck:!0,noResolve:!0},a=e.createSourceFile(o,t,i.target,!0,Ji(e,o)),r=e.createCompilerHost(i,!0),s=r.getSourceFile.bind(r),c=r.readFile.bind(r),d=r.fileExists.bind(r);return r.getSourceFile=(l,u,f,m)=>tt(l)===o?a:s(l,u,f,m),r.readFile=l=>tt(l)===o?t:c(l),r.fileExists=l=>tt(l)===o||d(l),e.createProgram([o],i,r)}function Ji(e,t){return/\.tsx$/iu.test(t)?e.ScriptKind.TSX:/\.[cm]?js$/iu.test(t)?e.ScriptKind.JS:/\.jsx$/iu.test(t)?e.ScriptKind.JSX:e.ScriptKind.TS}function ea(e,t,n){let o=[],i=a=>{if(Fo(e,a)){let r=t.getLineAndCharacterOfPosition(a.getStart(t)).line,s=t.getLineAndCharacterOfPosition(a.getEnd()).line;(!n||r<=n.endLine&&s>=n.startLine)&&o.push(a)}a.forEachChild(i)};return t.forEachChild(i),o.sort((a,r)=>a.getStart(t)-r.getStart(t))}function Fo(e,t){return e.isFunctionLike(t)&&"body"in t&&t.body!==void 0}function ta(e,t){return`callable:${encodeURIComponent(e.fileName)}:${t.getStart(e)}:${t.getEnd()}`}function na(e,t,n){for(let o=t.parent;o;o=o.parent)if(Fo(e,o)&&n.has(o))return n.get(o);return null}function oa(e,t,n,o){let i=new Map,a=ee(e,i,"exit",null),r=t.body,s=a.id;if(r&&e.ts.isBlock(r))s=pn(e,i,[...r.statements],a.id,{breakTarget:null,continueTarget:null});else if(r){let d=ee(e,i,"statement",r);Q(i,d.id,a.id),s=d.id}let c=ee(e,i,"entry",t);return Q(i,c.id,s),{id:o,node:t,parentId:n,cfg:i,entryId:c.id,exitId:a.id}}function pn(e,t,n,o,i){let a=o;for(let r=n.length-1;r>=0;r-=1)a=ke(e,t,n[r],a,i);return a}function ke(e,t,n,o,i){let a=e.ts;if(a.isBlock(n))return pn(e,t,[...n.statements],o,i);if(a.isIfStatement(n)){let s=ee(e,t,"predicate",n.expression),c=ke(e,t,n.thenStatement,o,i),d=n.elseStatement?ke(e,t,n.elseStatement,o,i):o;return Q(t,s.id,c),Q(t,s.id,d),s.id}if(a.isWhileStatement(n)){let s=ee(e,t,"predicate",n.expression),c=ke(e,t,n.statement,s.id,{breakTarget:o,continueTarget:s.id});return Q(t,s.id,c),Q(t,s.id,o),s.id}if(a.isDoStatement(n)){let s=ee(e,t,"predicate",n.expression),c=ke(e,t,n.statement,s.id,{breakTarget:o,continueTarget:s.id});return Q(t,s.id,c),Q(t,s.id,o),c}if(a.isForStatement(n)){let s=ee(e,t,"predicate",n.condition??n),c=n.incrementor?ee(e,t,"statement",n.incrementor):null;c&&Q(t,c.id,s.id);let d=c?.id??s.id,l=ke(e,t,n.statement,d,{breakTarget:o,continueTarget:d});if(Q(t,s.id,l),n.condition&&Q(t,s.id,o),!n.initializer)return s.id;let u=ee(e,t,"statement",n.initializer);return Q(t,u.id,s.id),u.id}if(a.isForInStatement(n)||a.isForOfStatement(n)){e.unsupported.add("for-in/for-of iterator assignment is conservatively represented without iterable element flow.");let s=ee(e,t,"predicate",n.expression),c=ee(e,t,"statement",n.initializer),d=ke(e,t,n.statement,s.id,{breakTarget:o,continueTarget:s.id});return Q(t,s.id,c.id),Q(t,s.id,o),Q(t,c.id,d),s.id}if(a.isSwitchStatement(n)){e.unsupported.add("switch fallthrough is represented conservatively; discriminant-to-case value refinement is unsupported.");let s=ee(e,t,"predicate",n.expression),c=o,d=[];for(let l=n.caseBlock.clauses.length-1;l>=0;l-=1){let u=n.caseBlock.clauses[l];c=pn(e,t,[...u.statements],c,{...i,breakTarget:o}),d.push(c)}for(let l of d)Q(t,s.id,l);return Q(t,s.id,o),s.id}if(a.isReturnStatement(n)||a.isThrowStatement(n)){let s=ee(e,t,"statement",n),c=[...t.values()].find(d=>d.kind==="exit");return Q(t,s.id,c.id),s.id}if(a.isBreakStatement(n)){let s=ee(e,t,"statement",n);return i.breakTarget||e.unsupported.add("A break statement could not be attached to a structured target."),Q(t,s.id,i.breakTarget??o),s.id}if(a.isContinueStatement(n)){let s=ee(e,t,"statement",n);return i.continueTarget||e.unsupported.add("A continue statement could not be attached to a structured target."),Q(t,s.id,i.continueTarget??o),s.id}if(a.isTryStatement(n)){e.unsupported.add("Exceptional control-flow and finally completion are not included in the local compiler CFG.");let s=ee(e,t,"statement",n);return s.invalidatesAllDefinitions=!0,Q(t,s.id,o),s.id}let r=ee(e,t,"statement",n);return Q(t,r.id,o),r.id}function ee(e,t,n,o){let i={id:`cfg:${e.nextCfgId++}`,kind:n,ast:o,successors:new Set,predecessors:new Set,definitions:[],uses:[],displayPoint:null,invalidatesAllDefinitions:!1};return t.set(i.id,i),i}function Q(e,t,n){e.get(t).successors.add(n),e.get(n).predecessors.add(t)}function ra(e,t){let n=t.cfg.get(t.entryId);for(let o of t.node.parameters){let i=$e(e,o.name);if(!i){e.unsupported.add("Destructured parameter definition-use is not implemented.");continue}n.definitions.push({point:De(e,i.node,"parameter-definition",i.symbolKey,i.name,t.id),rhsUseIds:[]})}for(let o of t.cfg.values())!o.ast||o.kind==="entry"||o.kind==="exit"||(o.kind==="predicate"&&(o.displayPoint=De(e,o.ast,"predicate",null,"predicate",t.id)),ia(e,t,o,o.ast),!o.displayPoint&&o.definitions.length===0&&o.uses.length===0&&(o.displayPoint=De(e,o.ast,"statement",null,ga(e,o.ast),t.id)))}function ia(e,t,n,o){let i=e.ts;if(i.isTryStatement(o))return;let a=r=>{if(!(r!==o&&i.isFunctionLike(r))){if(i.isVariableDeclaration(r)){let s=r.initializer?wt(e,t.id,r.initializer,n):[];n.uses.push(...s);let c=$e(e,r.name);c?n.definitions.push({point:De(e,c.node,"definition",c.symbolKey,c.name,t.id),rhsUseIds:s.map(d=>d.point.id)}):(n.invalidatesAllDefinitions=!0,e.unsupported.add("Destructured variable reaching definitions are not implemented."));return}if(i.isBinaryExpression(r)&&ko(i,r.operatorToken.kind)){let s=wt(e,t.id,r.right,n);r.operatorToken.kind!==i.SyntaxKind.EqualsToken&&s.push(...wt(e,t.id,r.left,n)),n.uses.push(...s);let c=$e(e,r.left);c?n.definitions.push({point:De(e,c.node,"definition",c.symbolKey,c.name,t.id),rhsUseIds:s.map(d=>d.point.id)}):(n.invalidatesAllDefinitions=!0,e.unsupported.add("Dynamic or destructured assignment targets are not included in reaching definitions."));return}if((i.isPrefixUnaryExpression(r)||i.isPostfixUnaryExpression(r))&&(r.operator===i.SyntaxKind.PlusPlusToken||r.operator===i.SyntaxKind.MinusMinusToken)){let s=wt(e,t.id,r.operand,n);n.uses.push(...s);let c=$e(e,r.operand);c&&n.definitions.push({point:De(e,c.node,"definition",c.symbolKey,c.name,t.id),rhsUseIds:s.map(d=>d.point.id)});return}if(!(i.isFunctionDeclaration(r)||i.isClassDeclaration(r)||i.isInterfaceDeclaration(r))){if(Po(e,r)){let s=Ao(e,t.id,r);s&&n.uses.push(s),i.isPropertyAccessExpression(r)&&a(r.expression);return}r.forEachChild(a)}}};a(o),n.uses=$o(n.uses)}function wt(e,t,n,o){let i=[],a=r=>{if(!e.ts.isFunctionLike(r)){if(e.ts.isBinaryExpression(r)&&ko(e.ts,r.operatorToken.kind)){o.invalidatesAllDefinitions=!0,e.unsupported.add("Nested assignment expressions are not included in ordered local definition-use flow."),r.operatorToken.kind!==e.ts.SyntaxKind.EqualsToken&&a(r.left),a(r.right);return}if(Po(e,r)){let s=Ao(e,t,r);s&&i.push(s),e.ts.isPropertyAccessExpression(r)&&a(r.expression);return}r.forEachChild(a)}};return a(n),$o(i)}function Po(e,t){if(e.ts.isPropertyAccessExpression(t))return!0;if(!e.ts.isIdentifier(t))return!1;let n=t.parent;return!(e.ts.isPropertyAccessExpression(n)&&n.name===t||"name"in n&&n.name===t&&aa(e.ts,n)||e.ts.isPropertyAssignment(n)&&n.name===t||e.ts.isBindingElement(n)&&n.propertyName===t||e.ts.isLabeledStatement(n)||e.ts.isBreakOrContinueStatement(n)||sa(e.ts,t))}function aa(e,t){return e.isVariableDeclaration(t)||e.isParameter(t)||e.isFunctionDeclaration(t)||e.isFunctionExpression(t)||e.isClassDeclaration(t)||e.isMethodDeclaration(t)||e.isPropertyDeclaration(t)||e.isInterfaceDeclaration(t)||e.isTypeAliasDeclaration(t)||e.isImportSpecifier(t)||e.isImportClause(t)||e.isNamespaceImport(t)}function sa(e,t){for(let n=t.parent;n;n=n.parent){if(e.isExpression(n)||e.isStatement(n)||e.isSourceFile(n))return!1;if(e.isTypeNode(n))return!0}return!1}function Ao(e,t,n){let o=$e(e,n);return o?{point:De(e,o.node,"use",o.symbolKey,o.name,t),property:e.ts.isPropertyAccessExpression(n)}:null}function $e(e,t){let n=e.ts;if(n.isIdentifier(t)){let o=Ro(e,t);return o?{node:t,symbolKey:o,name:t.text}:null}if(n.isPropertyAccessExpression(t)){let o=Ro(e,t.name);return o?{node:t,symbolKey:o,name:t.getText(e.sourceFile)}:null}return n.isParenthesizedExpression(t)||n.isAsExpression(t)||n.isTypeAssertionExpression(t)||n.isNonNullExpression(t)?$e(e,t.expression):((n.isArrayLiteralExpression(t)||n.isObjectLiteralExpression(t))&&e.unsupported.add("Heap aggregate identity and destructured assignment are not included in local points-to flow."),null)}function Ro(e,t){let n=e.checker.getSymbolAtLocation(t);if(!n)return null;if((n.flags&e.ts.SymbolFlags.Alias)!==0)try{n=e.checker.getAliasedSymbol(n)}catch{}let o=n.valueDeclaration??n.declarations?.[0];return o?`symbol:${encodeURIComponent(o.getSourceFile().fileName)}:${o.getStart()}:${n.getName()}`:`symbol:${n.getName()}`}function De(e,t,n,o,i,a){let r=t.getStart(e.sourceFile),s=t.getEnd(),c=e.sourceFile.getLineAndCharacterOfPosition(r),d=`flow-point:${encodeURIComponent(e.sourceFile.fileName)}:${r}:${s}:${n}:${encodeURIComponent(o??i)}`,l=e.points.get(d);if(l)return l;let u={id:d,kind:n,name:i,symbolKey:o,callableId:a,start:r,end:s,line:c.line,column:c.character,node:t};return e.points.set(d,u),u}function la(e,t){let n=[...t.cfg.values()].flatMap(c=>c.definitions),o=new Map(n.map(c=>[c.point.id,c])),i=ca(n),a=new Map,r=new Map;for(let c of t.cfg.values())a.set(c.id,new Set),r.set(c.id,new Set);let s=!0;for(;s;){s=!1;for(let c of t.cfg.values()){let d=ha([...c.predecessors].map(f=>r.get(f))),l=new Set(d);c.invalidatesAllDefinitions&&l.clear();let u=da(c.definitions);for(let f of u){for(let m of i.get(f.point.symbolKey)??[])l.delete(m.point.id);l.add(f.point.id)}mn(a.get(c.id),d)||(a.set(c.id,d),s=!0),mn(r.get(c.id),l)||(r.set(c.id,l),s=!0)}}for(let c of t.cfg.values()){let d=a.get(c.id);for(let l of c.uses){let u=c.definitions.filter(m=>m.point.symbolKey===l.point.symbolKey&&m.point.start<l.point.start&&!m.rhsUseIds.includes(l.point.id)).sort((m,p)=>p.point.start-m.point.start)[0],f=u?[u.point.id]:d;for(let m of f){let p=o.get(m);p.point.symbolKey===l.point.symbolKey&&nt(e,"reaching-definition",p.point.id,l.point.id,"exact","A CFG path reaches this use without an intervening definition.")}}for(let l of c.definitions)for(let u of l.rhsUseIds)nt(e,"value-source",u,l.point.id,"exact","This right-hand-side use supplies the new definition.")}}function ca(e){let t=new Map;for(let n of e){if(!n.point.symbolKey)continue;let o=t.get(n.point.symbolKey)??[];o.push(n),t.set(n.point.symbolKey,o)}return t}function da(e){let t=new Map;for(let n of e)n.point.symbolKey&&t.set(n.point.symbolKey,n);return[...t.values()]}function ua(e,t){let n=pa(t);for(let o of t.cfg.values()){if(o.successors.size<2||!o.displayPoint)continue;let i=n.get(o.id);for(let a of o.successors)for(let r of n.get(a)??[]){if(i.has(r)||r===t.exitId)continue;let s=t.cfg.get(r),c=[...s.definitions.map(d=>d.point),...s.uses.map(d=>d.point),...s.displayPoint?[s.displayPoint]:[]];for(let d of ya(c))nt(e,"control-dependence",o.displayPoint.id,d.id,"exact","The target postdominates a branch successor but does not postdominate the predicate.")}}}function pa(e){let t=[...e.cfg.keys()],n=new Set(t),o=new Map;for(let a of t)o.set(a,a===e.exitId?new Set([a]):new Set(n));let i=!0;for(;i;){i=!1;for(let a of e.cfg.values()){if(a.id===e.exitId)continue;let r=[...a.successors].map(c=>o.get(c)),s=new Set([a.id,...ba(r)]);mn(o.get(a.id),s)||(o.set(a.id,s),i=!0)}}return o}function ma(e,t){let n=new Map(t.map(r=>[r.id,r.parentId])),o=t.flatMap(r=>[...r.cfg.values()].flatMap(s=>s.definitions.map(c=>c.point))),i=new Map;for(let r of o){if(!r.symbolKey)continue;let s=i.get(r.symbolKey)??[];s.push(r),i.set(r.symbolKey,s)}let a=new Set([...e.edges.values()].filter(r=>r.kind==="reaching-definition").map(r=>r.toPointId));for(let r of t)for(let s of[...r.cfg.values()].flatMap(c=>c.uses)){if(!s.point.symbolKey||a.has(s.point.id))continue;let c=i.get(s.point.symbolKey)??[];for(let d of c)fa(d.callableId,s.point.callableId,n)?nt(e,"closure-capture",d.id,s.point.id,"candidate","Compiler identity proves the captured binding, but invocation order can select among outer definitions."):s.property&&nt(e,"field-definition-to-use",d.id,s.point.id,"candidate","Compiler identity matches the field; cross-callable receiver and execution order remain unresolved.")}[...e.edges.values()].some(r=>r.kind==="closure-capture")&&e.unsupported.add("Closure capture identity is known, but invocation order and intervening writes remain candidate flow."),[...e.edges.values()].some(r=>r.kind==="field-definition-to-use")&&e.unsupported.add("Cross-callable field flow lacks receiver points-to and invocation-order analysis.")}function fa(e,t,n){for(let o=n.get(t)??null;o;o=n.get(o)??null)if(o===e)return!0;return!1}function nt(e,t,n,o,i,a){let r=`local-flow-edge:${t}:${encodeURIComponent(n)}:${encodeURIComponent(o)}`;e.edges.set(r,{id:r,kind:t,fromPointId:n,toPointId:o,strength:i,reason:a})}function ko(e,t){return t>=e.SyntaxKind.FirstAssignment&&t<=e.SyntaxKind.LastAssignment}function ga(e,t){let n=t.getText(e.sourceFile).replace(/\s+/gu," ").trim();return n.length>80?`${n.slice(0,77)}...`:n||e.ts.SyntaxKind[t.kind]||"statement"}function $o(e){return[...new Map(e.map(t=>[t.point.id,t])).values()]}function ya(e){return[...new Map(e.map(t=>[t.id,t])).values()]}function ha(e){return new Set(e.flatMap(t=>[...t]))}function ba(e){return e.length===0?new Set:new Set([...e[0]].filter(t=>e.slice(1).every(n=>n.has(t))))}function mn(e,t){return e.size===t.size&&[...e].every(n=>t.has(n))}function Sa(e,t){return e.start-t.start||e.kind.localeCompare(t.kind)||e.id.localeCompare(t.id)}function un(e){return{points:[],edges:[],coverage:{status:"unsupported",basis:"typescript-compiler-cfg-reaching-definitions",unsupported:[e]}}}var xa=An("typescript-local-flow",{clearGroups:["whole-project","source-file","semantic-provider"]});function fn(e,t,n,o){if(!_n(t))return null;let i=`${t}\0${n}\0${o}`;return xa.get(e,i,()=>{let a=dt(e,t);return a?To(a,va(e.config.projectRoot,t),{startLine:n,endLine:o}):{points:[],edges:[],coverage:{status:"unsupported",basis:"typescript-compiler-cfg-reaching-definitions",unsupported:[`Current source is unavailable for ${t}.`]}}})}function Ea(e,t=new Map){let n=new Map,o=new Map,i=[];for(let a of e.transfers){if(!e.caller)continue;let r=Nt(e.caller,a.callerPosition),s=Nt(e.callee,a.calleePosition);ot(n,r),ot(n,s),yn(o,e.caller,r),yn(o,e.callee,s);let c=ne("edge","data-transfer",a.proof.file,String(a.proof.startLine),String(a.callerPosition),String(a.calleePosition));o.set(c,{id:c,kind:"data-transfer",fromNodeId:r.id,toNodeId:s.id,directed:!0,disposition:"folded",semantics:[{family:"data",subtype:"argument-to-parameter",attributes:{argumentText:a.argumentText,callerPosition:a.callerPosition,calleePosition:a.calleePosition}}],evidence:[{method:"compiler-callsite-direct-parameter-transfer",strength:"exact",identity:`${e.caller.symbol}:${a.callerPosition} -> ${e.callee.symbol}:${a.calleePosition}`,location:{file:a.proof.file,line:a.proof.startLine,endLine:a.proof.endLine}}]})}return e.unknown.forEach((a,r)=>{let s=Nt(e.callee,a.calleePosition);ot(n,s),yn(o,e.callee,s);let c=t.get(a.calleePosition);if(c&&Aa(c)){Pa(o,n,e,a.calleePosition,a.argumentText,c);return}let d=Ta(e,a.calleePosition,a.argumentText);ot(n,d);let l=ne("edge","data-transfer-unsupported",a.proof.file,String(a.proof.startLine),String(a.calleePosition),String(r));o.set(l,{id:l,kind:"data-transfer",fromNodeId:d.id,toNodeId:s.id,directed:!0,disposition:"unsupported",semantics:[{family:"data",subtype:"argument-to-parameter",attributes:{argumentText:a.argumentText,calleePosition:a.calleePosition}}],evidence:[{method:"compiler-callsite-argument-expression",strength:"exact",identity:a.argumentText,location:{file:a.proof.file,line:a.proof.startLine,endLine:a.proof.endLine}}]}),i.push({id:ne("frontier","data-transfer",l),kind:"data-transfer",direction:"unresolved",fromNodeIds:[d.id],edgeIds:[l],memberNodeIds:[s.id],memberCount:1,disposition:"unsupported",reason:c?.derivation.rule??a.reason,expansion:null})}),{nodes:[...n.values()],edges:[...o.values()],frontiers:i,blindSpots:[]}}function _o(e,t,n=[]){let o=Bo(),i=new Map,a=new Set;for(let r of t){if(r.kind!=="call"||!r.fromSymbol||!r.toSymbol||r.line===null)continue;let s=Ra(i,e,r.toFile,r.toSymbol);if(!s)continue;let c=Kn(e,s),d=c.sites.filter(g=>g.file===r.fromFile&&g.startLine<=r.line&&g.endLine>=r.line&&g.caller?.symbol===r.fromSymbol);if(d.length!==1){let g=c.unresolved.find(b=>b.file===r.fromFile&&b.line===r.line);g&&o.blindSpots.push(`Parameter flow unresolved at ${r.fromFile}:${r.line+1}: ${g.reason}.`);continue}let l=d[0],u=`${l.file}\0${l.callNode.startIndex}\0${l.callNode.endIndex}\0${s.symbol}`;if(a.has(u))continue;a.add(u);let f=qn(e,l),m=Y(e,l.file)?.rootNode,p=new Map;if(m)for(let g of f.unknown){let b=Gn({db:e,file:l.file,root:m},l.arguments[g.calleePosition]);b&&p.set(g.calleePosition,b)}Do(o,Ea(f,p)),f.caller&&Na(l.callNode)&&Ma(o,f,l.callNode)}for(let r of n){if(!r.location||!["source-construct","symbol"].includes(r.kind))continue;let s=r.location.endLine??r.location.line,c=fn(e,r.location.file,r.location.line,s);if(c){Do(o,Ca(r,c.points,c.edges));for(let d of c.coverage.unsupported)o.blindSpots.push(`TypeScript local flow is partial for ${r.location.file}:${r.location.line+1}-${s+1}: ${d} Recover with: scip-query inspect --at '${r.location.file}:${r.location.line+1}-${s+1}' --view behavior.`)}}return o.blindSpots=[...new Set(o.blindSpots)].sort(),o}function Ca(e,t,n){let o=Bo(),i=new Map,a=new Map,r=new Map,s=e.location.file;for(let c of t){let d=La(e,s,c);r.set(c.id,d.id),i.set(d.id,d),Ia(a,e,d)}for(let c of n){let d=r.get(c.fromPointId),l=r.get(c.toPointId);if(!d||!l)continue;let u=wa(c),f=ne("edge","typescript-local-flow",s,c.id);a.set(f,{id:f,kind:c.kind==="control-dependence"?"control-dependence":"data-transfer",fromNodeId:d,toNodeId:l,directed:!0,disposition:"folded",semantics:[u],evidence:[{method:"typescript-compiler-cfg-reaching-definitions",strength:c.strength,identity:c.reason,location:i.get(d)?.location??e.location}]})}return o.nodes=[...i.values()],o.edges=[...a.values()],o}function La(e,t,n){return{id:ne("local-flow-point",t,String(n.start),String(n.end),n.kind,n.symbolKey??n.name),kind:n.kind==="parameter-definition"||n.kind==="definition"?"local-definition":n.kind==="use"?"local-use":n.kind==="predicate"?"control-predicate":"local-statement",label:n.name,disposition:"folded",location:{file:t,line:n.line,endLine:n.line},anchorIds:[],attributes:{ownerNodeId:e.id,pointKind:n.kind,callableId:n.callableId,symbolKey:n.symbolKey,column:n.column}}}function Ia(e,t,n){let o=ne("edge","local-flow-owner",t.id,n.id);e.has(o)||e.set(o,{id:o,kind:"local-flow-owner",fromNodeId:t.id,toNodeId:n.id,directed:!0,disposition:"folded",semantics:[{family:"identity",subtype:"contains"}],evidence:[{method:"typescript-compiler-local-flow-owner",strength:"exact",identity:t.id,location:n.location}]})}function wa(e){switch(e.kind){case"reaching-definition":return{family:"data",subtype:"definition-to-use"};case"value-source":return{family:"data",subtype:"value-to-definition"};case"closure-capture":return{family:"data",subtype:"closure-capture"};case"field-definition-to-use":return{family:"data",subtype:"field-definition-to-use"};case"control-dependence":return{family:"control",subtype:"control-dependence"}}}function Na(e){let t=e;for(;t.parent&&["await_expression","yield_expression","parenthesized_expression","as_expression","type_assertion"].includes(t.parent.type);)t=t.parent;return t.parent!==null&&t.parent.type!=="expression_statement"}function Ma(e,t,n){if(!t.caller)return;let o={id:ne("call-result",t.call.file,String(n.startIndex),String(n.endIndex),t.callee.symbol),kind:"call-result",label:`result of ${t.callee.leaf}`,disposition:"folded",location:{file:t.call.file,line:t.call.startLine,endLine:t.call.endLine},anchorIds:[],attributes:{calleeSymbol:t.callee.symbol,callerSymbol:t.caller.symbol}},i=ne("edge","return-to-call-result",t.callee.symbol,o.id),a=ne("edge","call-result-owner",t.caller.symbol,o.id);e.nodes.push(o),e.edges.push({id:i,kind:"data-transfer",fromNodeId:hn(t.callee.symbol),toNodeId:o.id,directed:!0,disposition:"folded",semantics:[{family:"data",subtype:"return-to-call-result"}],evidence:[{method:"compiler-callsite-used-result",strength:"exact",identity:`${t.callee.symbol} -> ${t.caller.symbol}`,location:o.location}]},{id:a,kind:"call-result-owner",fromNodeId:hn(t.caller.symbol),toNodeId:o.id,directed:!0,disposition:"folded",semantics:[{family:"identity",subtype:"contains-call-result"}],evidence:[{method:"compiler-call-result-owner",strength:"exact",identity:t.caller.symbol,location:o.location}]})}function Bo(){return{nodes:[],edges:[],frontiers:[],blindSpots:[]}}function Do(e,t){gn(e.nodes,t.nodes),gn(e.edges,t.edges),gn(e.frontiers,t.frontiers),e.blindSpots.push(...t.blindSpots)}function gn(e,t){let n=new Set(e.map(o=>o.id));for(let o of t)n.has(o.id)||(n.add(o.id),e.push(o))}function Ra(e,t,n,o){let i=`${n}\0${o}`,a=e.get(i);if(a!==void 0)return a;let r=X(t,n).find(s=>s.symbol===o)??null;return e.set(i,r),r}function Nt(e,t){return{id:Da(e.symbol,t),kind:"parameter",label:`${e.leaf} parameter ${t}`,disposition:"folded",location:{file:e.relativePath,line:e.startLine,endLine:e.endLine},anchorIds:[],attributes:{ownerSymbol:e.symbol,position:t}}}function Ta(e,t,n){return{id:ne("argument-expression",e.call.file,String(e.call.startLine),String(e.call.endLine),String(t)),kind:"argument-expression",label:n,disposition:"unsupported",location:{file:e.call.file,line:e.call.startLine,endLine:e.call.endLine},anchorIds:[],attributes:{calleeSymbol:e.callee.symbol,position:t}}}function Fa(e,t,n){return{id:ne("static-value",e.call.file,String(e.call.startLine),String(e.call.endLine),String(t)),kind:"static-value",label:n.value,disposition:"folded",location:{file:e.call.file,line:e.call.startLine,endLine:e.call.endLine},anchorIds:[],attributes:{value:n.value,precision:n.precision,evidence:n.evidence,termKind:n.term.kind,derivationRule:n.derivation.rule}}}function Pa(e,t,n,o,i,a){let r=Fa(n,o,a),s=Nt(n.callee,o);ot(t,r);let c=ne("edge","static-value-transfer",n.call.file,String(n.call.startLine),String(o));e.set(c,{id:c,kind:"data-transfer",fromNodeId:r.id,toNodeId:s.id,directed:!0,disposition:"folded",semantics:[{family:"data",subtype:ka(a),attributes:{argumentText:i,calleePosition:o,value:a.value,precision:a.precision,derivationRule:a.derivation.rule}}],evidence:$a(a,n)})}function Aa(e){return e.derivation.kind!=="heuristic"&&e.precision!=="symbolic"&&e.precision!=="unknown"}function ka(e){return e.derivation.rule==="bounded-call-return"?"return-to-parameter":e.derivation.rule==="member-constant"||e.term.kind==="property"?"property-to-parameter":"constant-to-parameter"}function $a(e,t){return(e.derivation.sourceSpans.length>0?e.derivation.sourceSpans:[t.call]).map(o=>({method:`static-value:${e.derivation.rule}`,strength:e.derivation.kind==="direct"?"exact":"derived",identity:e.derivation.inputFactIds.join(",")||e.value,location:{file:o.file,line:o.startLine,endLine:o.endLine}}))}function ot(e,t){e.has(t.id)||e.set(t.id,t)}function yn(e,t,n){let o=ne("edge","parameter-owner",t.symbol,n.id);e.has(o)||e.set(o,{id:o,kind:"parameter-owner",fromNodeId:hn(t.symbol),toNodeId:n.id,directed:!0,disposition:"folded",semantics:[{family:"identity",subtype:"contains"}],evidence:[{method:"compiler-parameter-owner",strength:"exact",identity:t.symbol,location:{file:t.relativePath,line:t.startLine,endLine:t.endLine}}]})}function Da(e,t){return ne("parameter",e,String(t))}function hn(e){return ne("symbol",e)}function ne(...e){return e.map(t=>encodeURIComponent(t)).join(":")}function Oo(e,t){let n=new Map,o=new Map,i=new Map,a=new Set;for(let r of t){if(!r.location||!["source-construct","symbol"].includes(r.kind))continue;let s=r.location.endLine??r.location.line,c=Un(e,r.location.file,r.location.line,s);if(!c){a.add(`Control dependence unavailable for ${r.location.file}:${r.location.line+1}-${s+1}: no supported syntax tree or covering construct.`);continue}for(let d of c.facts){let l=bn(r,d.controller),u=bn(r,d.outcome);n.set(l.id,l),n.set(u.id,u),_a(o,r,l);let f=_e("edge","control-dependence",l.id,u.id,d.subtype);o.set(f,{id:f,kind:"control-dependence",fromNodeId:l.id,toNodeId:u.id,directed:!0,disposition:"folded",semantics:[{family:"control",subtype:d.subtype,attributes:{...d.attributes}}],evidence:[{method:"parser-control-dependence",strength:"exact",identity:`${r.location.file}:${d.controller.startLine+1}-${d.outcome.startLine+1}`,location:{file:r.location.file,line:d.controller.startLine,endLine:d.controller.endLine}}]})}for(let d of c.terminals){let l=bn(r,d);n.set(l.id,l);let u=d.label.startsWith("throw")||d.label.startsWith("raise")?"throw":"return",f=_e("edge","control-terminal",r.id,l.id,u);o.set(f,{id:f,kind:"control-terminal",fromNodeId:r.id,toNodeId:l.id,directed:!0,disposition:"folded",semantics:[{family:"control",subtype:u==="throw"?"throws":"returns"}],evidence:[{method:"parser-terminal-statement",strength:"exact",identity:d.label,location:{file:r.location.file,line:d.startLine,endLine:d.endLine}}]})}for(let d of c.unsupported){let l=_e("control-unsupported",r.location.file,String(d.startLine),String(d.endLine),d.reason);n.set(l,{id:l,kind:"control-unsupported",label:d.reason,disposition:"unsupported",location:{file:r.location.file,line:d.startLine,endLine:d.endLine},anchorIds:[],attributes:{ownerNodeId:r.id}});let u=_e("edge","control-unsupported",r.id,l);o.set(u,{id:u,kind:"control-dependence",fromNodeId:r.id,toNodeId:l,directed:!0,disposition:"unsupported",semantics:[{family:"control",subtype:"unresolved-control-construct"}],evidence:[{method:"parser-control-construct",strength:"exact",identity:d.reason,location:{file:r.location.file,line:d.startLine,endLine:d.endLine}}]});let f=_e("frontier","control-dependence",l);i.set(f,{id:f,kind:"control-dependence",direction:"unresolved",fromNodeIds:[r.id],edgeIds:[u],memberNodeIds:[l],memberCount:1,disposition:"unsupported",reason:d.reason,expansion:null})}}return{nodes:[...n.values()],edges:[...o.values()],frontiers:[...i.values()],blindSpots:[...a].sort()}}function bn(e,t){let n=e.location.file;return{id:_e(`control-${t.kind}`,n,String(t.startLine),String(t.endLine),t.label),kind:`control-${t.kind}`,label:t.label,disposition:"folded",location:{file:n,line:t.startLine,endLine:t.endLine},anchorIds:[],attributes:{ownerNodeId:e.id,constructKind:t.kind,implicit:t.implicit}}}function _a(e,t,n){let o=_e("edge","control-owner",t.id,n.id);e.has(o)||e.set(o,{id:o,kind:"control-owner",fromNodeId:t.id,toNodeId:n.id,directed:!0,disposition:"folded",semantics:[{family:"identity",subtype:"contains-control"}],evidence:[{method:"parser-control-owner",strength:"exact",identity:t.id,location:t.location}]})}function _e(...e){return e.map(t=>encodeURIComponent(t)).join(":")}var Mt=new Set(["arrow_function","constructor_declaration","function_declaration","function_definition","function_expression","generator_function","generator_function_declaration","function_item","lambda","lambda_expression","method","method_declaration","method_definition"]),it=new Set(["block","body","compound_statement","declaration_list","statement_block"]),Ba=new Set(["assignment","assignment_expression","augmented_assignment_expression"]),vn=new Set(["update_expression"]),qo=new Set(["array_access","element_access_expression","subscript_expression"]),zo=new Set(["attribute","field_access","field_expression","member_access_expression","member_expression","selector_expression"]),Oa=new Set(["false","null","null_literal","number","number_literal","string","string_literal","template_string","true"]),Ga=new Set(["call_expression","method_invocation","object_creation_expression"]),ja=new Set(["comment","else_clause","formal_parameters","parameters","type_parameters"]);function Uo(e,t,n,o){let i=Y(e,t);if(!i)return null;let a=Qa(i.rootNode,n,o);if(!a)return null;let r=[],s=[],c=[];return Be(a,d=>{if(Ba.has(d.type)||vn.has(d.type)||Ho(d)){let l=Ka(d);l?r.push(l):c.push({family:"state",startLine:d.startPosition.row,endLine:d.endPosition.row,reason:`Mutation target ${be(d.text)} could not be resolved to an exact source resource.`})}}),Be(a,d=>{if(!it.has(d.type))return;let l=Ha(d);for(let u=0;u<l.length-1;u+=1)s.push({from:rt(l[u]),to:rt(l[u+1]),subtype:"lexical-successor",synchronizationScope:null,attributes:{sameScope:!0,executionConditional:!0}});for(let u=0;u<l.length;u+=1){let f=l[u],m=Xa(f).filter(p=>p.type==="await_expression");for(let p of m){let g=at("event",`await ${be(p.text.replace(/^await\s+/u,""))}`,p);s.push({from:rt(f),to:g,subtype:"awaits-completion",synchronizationScope:null,attributes:{completionRequired:!0}});let b=l[u+1];b&&s.push({from:g,to:rt(b),subtype:"await-completion-before",synchronizationScope:null,attributes:{continuationOnly:!0}})}}}),Be(a,d=>{if(d.type!=="synchronized_statement")return;let l=d.childForFieldName("object")??d.childForFieldName("condition")??d.namedChildren.find(g=>!it.has(g.type)),u=d.childForFieldName("body")??d.namedChildren.find(g=>it.has(g.type));if(!l||!u){c.push({family:"temporal",startLine:d.startPosition.row,endLine:d.endPosition.row,reason:"Synchronized scope has no structurally resolved monitor or body."});return}let f=be(l.text).replace(/^\(|\)$/gu,""),m=at("lock",f,l),p=Ya(u).filter(g=>g.parent!==null&&Vo(g));for(let g of Va(p))s.push({from:m,to:rt(g),subtype:"inside-lock-scope",synchronizationScope:f,attributes:{syntaxNative:!0}})}),{mutations:r,temporal:s,unsupported:c}}function Ka(e){let t=Ho(e),n=e.childForFieldName("left")??e.childForFieldName("argument")??(t?e.namedChildren.at(-1)??null:e.namedChildren[0]??null);if(!n)return null;let o=qa(n);if(!o)return null;let i=t?"delete":vn.has(e.type)||!Wa(e,n).startsWith("=")?"update":"assign",a=t||vn.has(e.type)?null:e.childForFieldName("right");return{event:at("event",be(e.text),e),resource:{kind:"resource",label:o.name,startLine:n.startPosition.row,endLine:n.endPosition.row},operation:i,durabilityClass:"in-memory",recordIdentity:o.recordIdentity,value:a?at("value",be(a.text),a):null,dataSubtype:a?za(a,e):null}}function qa(e){if(qo.has(e.type)){let t=e.childForFieldName("object")??e.childForFieldName("array")??e.namedChildren[0]??null,n=e.childForFieldName("index")??e.childForFieldName("subscript")??e.namedChildren[1]??null;return!t||!n?null:{name:`${be(t.text)}[]`,recordIdentity:be(n.text)}}return zo.has(e.type)?{name:be(e.text),recordIdentity:null}:/^(?:identifier|property_identifier|field_identifier)$/u.test(e.type)?{name:be(e.text),recordIdentity:null}:null}function za(e,t){return Oa.has(e.type)||/(?:integer|float|decimal|boolean|character)_literal$/u.test(e.type)?"constant-to-state":Ga.has(e.type)?"return-to-state":zo.has(e.type)||qo.has(e.type)?"property-to-state":/identifier$/u.test(e.type)?Ua(e.text,t)?"captured-value-to-state":"value-to-state":"expression-to-state"}function Ua(e,t){let n=Sn(t.parent);if(!n||Go(n,e))return!1;let o=Sn(n.parent);for(;o;){if(Go(o,e))return!0;o=Sn(o.parent)}return!1}function Sn(e){let t=e;for(;t;){if(Mt.has(t.type))return t;t=t.parent}return null}function Go(e,t){let n=e.childForFieldName("parameters")??e.namedChildren.find(a=>["formal_parameters","parameters"].includes(a.type));if(n&&jo(n,t))return!0;let o=e.childForFieldName("body")??e.namedChildren.find(a=>it.has(a.type));if(!o)return!1;let i=!1;return Wo(o,e,a=>{if(i||!/(?:declarator|declaration|parameter)$/u.test(a.type))return;let r=a.childForFieldName("name")??a.childForFieldName("pattern")??a.namedChildren[0];r&&jo(r,t)&&(i=!0)}),i}function jo(e,t){let n=!1;return Be(e,o=>{/identifier$/u.test(o.type)&&o.text===t&&(n=!0)}),n}function Wo(e,t,n){n(e);for(let o of e.namedChildren)o!==t&&Mt.has(o.type)||Wo(o,t,n)}function Wa(e,t){let n=e.childForFieldName("right"),o=Math.max(0,t.endIndex-e.startIndex),i=n?Math.max(o,n.startIndex-e.startIndex):e.text.length;return e.text.slice(o,i).trim()}function Ho(e){return(e.type==="delete_expression"||e.type==="unary_expression")&&/^delete\b/u.test(e.text.trim())}function Ha(e){return e.namedChildren.filter(t=>Vo(t))}function Vo(e){return ja.has(e.type)||it.has(e.type)?!1:/(?:statement|declaration)$/u.test(e.type)||e.type==="expression_statement"||e.type==="local_variable_declaration"}function Va(e){let t=new Set(e);return e.filter(n=>{let o=n.parent;for(;o;){if(t.has(o))return!1;o=o.parent}return!0})}function rt(e){return at("event",be(e.text),e)}function at(e,t,n){return{kind:e,label:t,startLine:n.startPosition.row,endLine:n.endPosition.row}}function Qa(e,t,n){let o=[];return Be(e,a=>{a.startPosition.row<=t&&a.endPosition.row>=n&&o.push(a)}),o.filter(a=>Mt.has(a.type)).sort(Ko)[0]??o.sort(Ko)[0]??null}function Ko(e,t){return e.endIndex-e.startIndex-(t.endIndex-t.startIndex)||e.startIndex-t.startIndex}function Ya(e){let t=[];return Be(e,n=>t.push(n)),t}function Xa(e){let t=[],n=o=>{t.push(o);for(let i of o.namedChildren)i!==e&&Mt.has(i.type)||n(i)};return n(e),t}function Be(e,t){t(e);for(let n of e.namedChildren)Be(n,t)}function be(e){return e.trim().replace(/\s+/gu," ")}function Xo(e,t,n=[]){let o=new Map,i=new Map,a=new Map,r=new Set;for(let s of t){if(!s.location||!["source-construct","symbol"].includes(s.kind))continue;let c=s.location.endLine??s.location.line,d=Uo(e,s.location.file,s.location.line,c);if(!d){r.add(`State and temporal analysis unavailable for ${s.location.file}:${s.location.line+1}-${c+1}: no supported syntax tree or covering construct.`);continue}for(let l of d.mutations){let u=Tt(s,l.event),f=os(s,l.resource,l.durabilityClass);if(o.set(u.id,u),o.set(f.id,f),Ft(i,s,u,"contains-state-effect"),Pt(i,{kind:"state-resource",from:u,to:f,semantics:[{family:"state",subtype:l.operation==="delete"?"deletes-resource":"writes-resource",attributes:{operation:l.operation,durabilityClass:l.durabilityClass,resource:l.resource.label,recordIdentity:l.recordIdentity,transactionMembership:"unknown"}}],method:"parser-state-mutation",identity:l.event.label}),l.value&&l.dataSubtype){let m=Tt(s,l.value);o.set(m.id,m),Pt(i,{kind:"data-to-state",from:m,to:f,semantics:[{family:"data",subtype:l.dataSubtype,attributes:{operation:l.operation,resource:l.resource.label,recordIdentity:l.recordIdentity,value:l.value.label}}],method:"parser-assignment-value",identity:`${l.value.label} -> ${l.resource.label}`})}}for(let l of d.temporal){let u=Tt(s,l.from),f=Tt(s,l.to);o.set(u.id,u),o.set(f.id,f),Ft(i,s,u,l.from.kind==="lock"?"contains-lock-scope":"contains-event"),Ft(i,s,f,"contains-event"),Pt(i,{kind:"temporal-order",from:u,to:f,semantics:[{family:"temporal",subtype:l.subtype,context:l.synchronizationScope?{synchronizationScope:l.synchronizationScope}:void 0,attributes:{...l.attributes}}],method:l.subtype==="inside-lock-scope"?"parser-synchronized-scope":"parser-program-order",identity:`${l.from.label} -> ${l.to.label}`})}for(let l of d.unsupported){let u=Ie(`${l.family}-unsupported`,s.location.file,String(l.startLine),String(l.endLine),l.reason);o.set(u,{id:u,kind:`${l.family}-unsupported`,label:l.reason,disposition:"unsupported",location:{file:s.location.file,line:l.startLine,endLine:l.endLine},anchorIds:[],attributes:{ownerNodeId:s.id}});let f=Ie("edge",`${l.family}-unsupported`,s.id,u);i.set(f,{id:f,kind:`${l.family}-unsupported`,fromNodeId:s.id,toNodeId:u,directed:!0,disposition:"unsupported",semantics:[{family:l.family,subtype:`unresolved-${l.family}-construct`}],evidence:[{method:`parser-${l.family}-construct`,strength:"exact",identity:l.reason,location:{file:s.location.file,line:l.startLine,endLine:l.endLine}}]});let m=Ie("frontier",l.family,u);a.set(m,{id:m,kind:l.family,direction:"unresolved",fromNodeIds:[s.id],edgeIds:[f],memberNodeIds:[u],memberCount:1,disposition:"unsupported",reason:l.reason,expansion:null})}}for(let s of t.filter(c=>c.kind==="runtime-boundary-participant")){let c=Rt(s,"protocol"),d=Rt(s,"action"),l=Rt(s,"address")??s.label;!c||!d||!Yo(c,d)||Qo(o,i,s,{observationId:s.id,action:d,strength:"exact",file:s.location?.file??"",line:s.location?.line??0,address:l,protocol:c,role:Rt(s,"role")??void 0,resolution:"locally-linked"})}for(let s of n){if(!s.protocol||!Yo(s.protocol,s.action))continue;let c=ts(t,s.file,s.line,s.ownerShortName??null);if(!c){r.add(`State observation ${s.observationId} at ${s.file}:${s.line+1} has no materialized owner node.`);continue}Qo(o,i,c,s)}return{nodes:[...o.values()],edges:[...i.values()],frontiers:[...a.values()],blindSpots:[...r].sort()}}function Qo(e,t,n,o){let i=Ja(o),r={id:Ie("runtime-state-event",o.observationId),kind:"runtime-state-event",label:`${o.action} ${i}`,disposition:"folded",location:{file:o.file,line:o.line},anchorIds:[],attributes:{action:o.action,protocol:o.protocol??null,modality:o.modality??null,resolution:o.resolution??null}},s=o.protocol==="database"?"external-durable-intent":"external",c={id:Ie("runtime-state-resource",o.protocol??"unknown",i),kind:"runtime-state-resource",label:i,disposition:"folded",location:{file:o.file,line:o.line},anchorIds:[],attributes:{protocol:o.protocol??null,durabilityClass:s}};e.set(r.id,r),e.set(c.id,c),Ft(t,n,r,"contains-runtime-state-effect");let d=Za(o.action);Pt(t,{kind:"runtime-state-resource",from:r,to:c,semantics:[{family:"state",subtype:d,context:{crossesRuntimeBoundary:!0,protocol:o.protocol},attributes:{operation:o.action,durabilityClass:s,resource:i,recordIdentity:es(o),modality:o.modality??null,resolution:o.resolution??null,transactionMembership:"unknown",commitState:o.protocol==="database"?"unknown":null}}],method:`runtime-boundary-${o.strength}`,identity:o.observationId})}function Za(e){return e==="database.read"?"reads-resource":e==="queue.send"?"enqueues-resource":e==="queue.consume"?"consumes-resource":"writes-resource"}function Ja(e){return(e.keyParts?.find(n=>["address","resource"].includes(n.name))?.value??e.address)||e.observationId}function es(e){return e.keyParts?.find(n=>/^(?:id|key|record)$/u.test(n.name))?.value??null}function Yo(e,t){return e==="database"&&["database.read","database.write"].includes(t)||e==="queue"&&["queue.consume","queue.send"].includes(t)}function Rt(e,t){let n=e.attributes[t];return typeof n=="string"?n:null}function ts(e,t,n,o){let i=e.filter(r=>r.location?.file===t&&["source-construct","symbol"].includes(r.kind)),a=i.filter(r=>r.location.line<=n&&(r.location.endLine??r.location.line)>=n).sort(ns)[0];if(a)return a;if(o){let r=i.find(s=>s.label===o||s.label.endsWith(`.${o}`)||s.label.includes(o));if(r)return r}return i.length===1?i[0]:null}function ns(e,t){let n=(e.location?.endLine??e.location?.line??0)-(e.location?.line??0),o=(t.location?.endLine??t.location?.line??0)-(t.location?.line??0);return n-o}function Tt(e,t){let n=e.location.file;return{id:Ie(`program-${t.kind}`,n,String(t.startLine),String(t.endLine),t.label),kind:`program-${t.kind}`,label:t.label,disposition:"folded",location:{file:n,line:t.startLine,endLine:t.endLine},anchorIds:[],attributes:{ownerNodeId:e.id,constructKind:t.kind}}}function os(e,t,n){let o=e.location.file;return{id:Ie("program-resource",o,e.id,t.label,n),kind:"program-resource",label:t.label,disposition:"folded",location:{file:o,line:t.startLine,endLine:t.endLine},anchorIds:[],attributes:{ownerNodeId:e.id,durabilityClass:n}}}function Ft(e,t,n,o){let i=Ie("edge","program-owner",t.id,n.id,o);e.has(i)||e.set(i,{id:i,kind:"program-owner",fromNodeId:t.id,toNodeId:n.id,directed:!0,disposition:"folded",semantics:[{family:"identity",subtype:o}],evidence:[{method:"parser-program-owner",strength:"exact",identity:t.id,location:n.location}]})}function Pt(e,t){let n=Ie("edge",t.kind,t.from.id,t.to.id,t.semantics[0].subtype);e.set(n,{id:n,kind:t.kind,fromNodeId:t.from.id,toNodeId:t.to.id,directed:!0,disposition:"folded",semantics:t.semantics,evidence:[{method:t.method,strength:"exact",identity:t.identity,location:t.from.location}]})}function Ie(...e){return e.map(t=>encodeURIComponent(t)).join(":")}var rs=new Set(["control","data","state","temporal"]),At=new Set(["contains-control","contains-event","contains-lock-scope","contains-state-effect","contains-runtime-state-effect","contains","owns-parameter","owns-runtime-observation"]),tr=new Set(["discriminator-dispatch","result-callback","returns","runtime-handoff","throws"]);function nr(e,t={}){let n=new Map(e.nodes.map(x=>[x.id,x])),o=us(e.nodes,t.focusLocations),i=ps(e.edges,t.focusLocations),a=ms(e.edges,i),r=new Set(e.paths.flatMap(x=>x.edgeIds)),s=we(e.anchors.filter(x=>x.status==="matched").flatMap(x=>x.nodeIds)),d=e.edges.filter(er).filter(x=>is(x,o,i,r)),l=d.filter(x=>cs(x,o,i,a,n,r)),u=Zo(s,l,"forward"),f=ls(u,l),m=Zo(f,l,"backward"),p=new Set([...u].filter(x=>m.has(x)));for(let x of s)p.add(x);let g=new Set(l.filter(x=>p.has(x.fromNodeId)&&p.has(x.toNodeId)).map(x=>x.id)),b=new Set(p),C=new Set(g);as(d,b,C,o,i);let S=e.frontiers.filter(x=>gs(x,b)),v=we(S.filter(x=>x.disposition==="unsupported").map(x=>x.id)),R=we(e.edges.filter(x=>!er(x)&&rr(x)&&fs(x,b)).map(x=>x.id)),y=we(S.map(x=>x.id)),N=[];s.length===0&&N.push("No matched anchor node starts the corridor."),f.length===0&&N.push("No proved mechanical outcome is reachable from a matched anchor."),v.length>0&&N.push(`${v.length} unsupported frontier(s) touch the protected corridor.`),R.length>0&&N.push(`${R.length} candidate or unknown edge(s) touch the protected corridor.`);let L=N.length===0?"complete":"incomplete";return{schemaVersion:1,status:L,startNodeIds:s,outcomeNodeIds:f,baseNodeIds:we([...p]),baseEdgeIds:we([...g]),nodeIds:we([...b]),edgeIds:we([...C]),accountedFrontierIds:y,unresolvedFrontierIds:v,unresolvedEdgeIds:R,coverage:{protectedNodes:b.size,protectedEdges:C.size,baseNodes:p.size,baseEdges:g.size,accountedFrontiers:y.length,unresolvedFrontiers:v.length,unresolvedEdges:R.length},explanation:L==="complete"?"Every proved anchor-to-outcome path is closed over its material causal facts within reported coverage.":N.join(" ")}}function is(e,t,n,o){return t===null||e.disposition==="emitted"||o.has(e.id)||n?.has(e.id)===!0?!0:(e.semantics??[]).some(i=>{if(i.family==="identity"&&At.has(i.subtype))return t.has(e.toNodeId);if(i.family==="contract")return t.has(e.fromNodeId)&&t.has(e.toNodeId);if(i.family==="state")return t.has(e.fromNodeId);if(i.family==="data"||i.family==="temporal")return t.has(e.fromNodeId)||t.has(e.toNodeId);if(i.family==="control"){if(ir(i))return t.has(e.fromNodeId);if(["returns","throws"].includes(i.subtype))return t.has(e.toNodeId);if(i.subtype==="completion-callback")return t.has(e.fromNodeId)||t.has(e.toNodeId)}return!1})}function as(e,t,n,o,i){let a=!0;for(;a;){a=!1;for(let r of e)ss(r,t,o,i)&&(n.has(r.id)||(n.add(r.id),a=!0),t.has(r.fromNodeId)||(t.add(r.fromNodeId),a=!0),t.has(r.toNodeId)||(t.add(r.toNodeId),a=!0))}}function ss(e,t,n,o){let i=t.has(e.fromNodeId),a=t.has(e.toNodeId);return!i&&!a?!1:(e.semantics??[]).some(r=>r.family==="identity"?At.has(r.subtype)&&(a||n===null||n.has(e.toNodeId)):r.family==="contract"?!0:r.family==="state"?i&&(n===null||n.has(e.fromNodeId)):r.family==="temporal"?r.subtype==="lexical-successor"?i&&a:!0:r.family==="data"?a&&(i||n===null||n.has(e.fromNodeId)||o?.has(e.id)===!0):r.family==="control"?or(r)||["returns","throws"].includes(r.subtype)&&!a&&n!==null&&!n.has(e.toNodeId)?!1:tr.has(r.subtype)||ir(r)||r.subtype==="completion-callback":!1)}function ls(e,t){let n=new Set,o=new Map,i=new Map;for(let a of t)!e.has(a.fromNodeId)||!e.has(a.toNodeId)||(o.set(a.fromNodeId,(o.get(a.fromNodeId)??0)+1),i.set(a.toNodeId,(i.get(a.toNodeId)??0)+1),(a.semantics??[]).some(r=>r.family==="state"||r.family==="control"&&tr.has(r.subtype))&&n.add(a.toNodeId));for(let a of e)(i.get(a)??0)>0&&(o.get(a)??0)===0&&n.add(a);return we([...n])}function Zo(e,t,n){let o=new Map;for(let r of t){let s=n==="forward"?r.fromNodeId:r.toNodeId,c=n==="forward"?r.toNodeId:r.fromNodeId,d=o.get(s)??[];d.push(c),o.set(s,d)}let i=new Set(e),a=[...e];for(;a.length>0;){let r=a.shift();for(let s of o.get(r)??[])i.has(s)||(i.add(s),a.push(s))}return i}function cs(e,t,n,o,i,a){return(e.semantics??[]).some(r=>e.disposition==="emitted"||a.has(e.id)?!0:r.family==="identity"&&At.has(r.subtype)?t===null||t.has(e.toNodeId)||o?.has(e.toNodeId)===!0:!rs.has(r.family)||or(r)?!1:r.family==="control"&&["returns","throws"].includes(r.subtype)&&t!==null?t.has(e.toNodeId):t===null?!0:r.family==="state"?t.has(e.fromNodeId):r.family==="data"?t.has(e.fromNodeId)||t.has(e.toNodeId)||n?.has(e.id)===!0:r.family==="temporal"?r.subtype==="lexical-successor"?t.has(e.fromNodeId)&&t.has(e.toNodeId):t.has(e.fromNodeId)||t.has(e.toNodeId):r.family==="control"?ds(e,i)&&(t.has(e.fromNodeId)||t.has(e.toNodeId)):!1)}function or(e){return e.family==="control"&&["call","discriminator-dispatch","result-callback","runtime-handoff"].includes(e.subtype)}function ds(e,t){let n=t.get(e.fromNodeId),o=t.get(e.toNodeId);if(!n||!o)return!1;let i=Jo(n,"ownerNodeId")??(n.kind==="symbol"?n.id:null),a=Jo(o,"ownerNodeId")??(o.kind==="symbol"?o.id:null);return i!==null&&i===a}function us(e,t){if(!t)return null;let n=new Map;for(let o of t){let i=n.get(o.file)??[];i.push(o.line),n.set(o.file,i)}return new Set(e.filter(o=>{if(!o.location||o.kind==="parameter")return!1;let i=n.get(o.location.file)??[],a=o.location.endLine??o.location.line;return i.some(r=>r>=o.location.line&&r<=a)}).map(o=>o.id))}function ps(e,t){if(!t)return null;let n=new Map;for(let o of t){let i=n.get(o.file)??[];i.push(o.line),n.set(o.file,i)}return new Set(e.filter(o=>o.evidence.some(i=>{if(!i.location)return!1;let a=n.get(i.location.file)??[],r=i.location.endLine??i.location.line;return a.some(s=>s>=i.location.line&&s<=r)})).map(o=>o.id))}function ms(e,t){return t===null?null:new Set(e.filter(n=>t.has(n.id)).flatMap(n=>[n.fromNodeId,n.toNodeId]))}function Jo(e,t){let n=e.attributes[t];return typeof n=="string"?n:null}function er(e){return e.disposition==="excluded"||e.disposition==="unsupported"||!rr(e)?!1:e.evidence.some(t=>t.strength==="exact"||t.strength==="derived")}function rr(e){return(e.semantics??[]).some(t=>t.family!=="identity"||At.has(t.subtype))}function ir(e){return e.subtype.startsWith("predicate-")||e.subtype.startsWith("loop-")||e.subtype.startsWith("exception-")||e.subtype.startsWith("finally-")||e.subtype.startsWith("handler-")}function fs(e,t){return t.has(e.fromNodeId)||t.has(e.toNodeId)}function gs(e,t){return[...e.fromNodeIds,...e.memberNodeIds].some(n=>t.has(n))}function we(e){return[...new Set(e)].sort()}import{createHash as ys}from"crypto";var kt=["identity","contract","control","data","state","temporal"],hs=new Set(kt);function Dt(e){let t=We(e.anchors,"anchor"),n=We(e.nodes,"node"),o=We(e.edges,"edge"),i=We(e.paths??[],"path"),a=We(e.frontiers??[],"frontier"),r=new Set(t.map(m=>m.id)),s=new Set(n.map(m=>m.id)),c=new Set(o.map(m=>m.id)),d=e.routeCatalog?{...e.routeCatalog,routes:We(e.routeCatalog.routes,"route"),selectedRouteIds:ie(e.routeCatalog.selectedRouteIds)}:void 0;for(let m of t)ce(`anchor ${m.id}`,[...m.nodeIds,...m.candidateNodeIds],s,"node");for(let m of n)ce(`node ${m.id}`,m.anchorIds,r,"anchor");for(let m of o){if(ce(`edge ${m.id}`,[m.fromNodeId,m.toNodeId],s,"node"),m.evidence.length===0)throw new Error(`Exploration edge ${m.id} has no evidence source.`);vs(m)}for(let m of i)ce(`path ${m.id}`,[m.fromAnchorId,m.toAnchorId],r,"anchor"),ce(`path ${m.id}`,m.nodeIds,s,"node"),ce(`path ${m.id}`,m.edgeIds,c,"edge");for(let m of a)if(ce(`frontier ${m.id}`,m.fromNodeIds,s,"node"),ce(`frontier ${m.id}`,m.edgeIds,c,"edge"),ce(`frontier ${m.id}`,m.memberNodeIds,s,"node"),m.memberCount!==m.memberNodeIds.length)throw new Error(`Exploration frontier ${m.id} reports ${m.memberCount} member(s) but identifies ${m.memberNodeIds.length}.`);for(let m of d?.routes??[])ce(`route ${m.id}`,m.nodeIds,s,"node"),ce(`route ${m.id}`,m.edgeIds,c,"edge"),ce(`route ${m.id}`,[m.anchorNodeId,m.endpointNodeId],s,"node");d&&ce("route catalog selection",d.selectedRouteIds,new Set(d.routes.map(m=>m.id)),"route");let l=ie(e.incompleteReasons??[]),u=l.length===0?"accounted":"incomplete",f=t.reduce((m,p)=>m+p.omittedCandidates,0);return{schemaVersion:1,anchors:t,nodes:n,edges:o,paths:i,frontiers:a,coverage:{status:u,scope:e.scope,nodes:fr(n),edges:fr(o),matchedAnchors:t.filter(m=>m.status==="matched").length,ambiguousAnchors:t.filter(m=>m.status==="ambiguous").length,missingAnchors:t.filter(m=>m.status==="missing").length,omittedCandidates:f,frontierGroups:a.length,programEdges:Ss(o),blindSpots:ie(e.blindSpots??[]),explanation:u==="accounted"?"Every node and edge discovered within the declared query scope is emitted, folded with recoverable identity, explicitly excluded, or reported unsupported.":`The declared query scope is not fully accounted for: ${l.join("; ")}`},completion:Cs(u,i,e.scope),...d?{routeCatalog:d}:{}}}function bs(e){return e.flatMap(t=>xs(t.semantics??[]).map(n=>({id:Es(t.id,n),sourceEdgeId:t.id,sourceKind:t.kind,fromNodeId:t.fromNodeId,toNodeId:t.toNodeId,directed:!0,disposition:t.disposition,evidence:[...t.evidence],family:n.family,subtype:n.subtype,...n.context?{context:{...n.context}}:{},...n.attributes?{attributes:{...n.attributes}}:{}}))).sort((t,n)=>t.id.localeCompare(n.id))}function Ss(e){let t=bs(e),n=new Set(t.map(r=>r.sourceEdgeId)),o=new Map(kt.map(r=>[r,new Set])),i=new Map(kt.map(r=>[r,new Set])),a=new Map(kt.map(r=>[r,0]));for(let r of t)o.get(r.family).add(r.sourceEdgeId),i.get(r.family).add(r.subtype),a.set(r.family,a.get(r.family)+1);return{sourceEdges:e.length,mappedSourceEdges:n.size,projectedEdges:t.length,unmappedSourceEdges:e.length-n.size,unsupportedSourceEdges:e.filter(r=>r.disposition==="unsupported").length,unmappedKinds:ie(e.filter(r=>!n.has(r.id)).map(r=>r.kind)),families:{identity:Ue("identity",o,a,i),contract:Ue("contract",o,a,i),control:Ue("control",o,a,i),data:Ue("data",o,a,i),state:Ue("state",o,a,i),temporal:Ue("temporal",o,a,i)}}}function Ue(e,t,n,o){return{sourceEdges:t.get(e)?.size??0,projectedEdges:n.get(e)??0,subtypes:[...o.get(e)??[]].sort()}}function vs(e){let t=new Set;for(let n of e.semantics??[]){if(!hs.has(n.family))throw new Error(`Exploration edge ${e.id} has unknown program edge family: ${n.family}.`);if(n.subtype.trim().length===0)throw new Error(`Exploration edge ${e.id} has an empty program edge subtype.`);let o=xn(n);if(t.has(o))throw new Error(`Exploration edge ${e.id} repeats program edge semantic ${o}.`);t.add(o)}}function xs(e){return[...e].sort((t,n)=>xn(t).localeCompare(xn(n)))}function xn(e){return`${e.family}:${e.subtype}`}function Es(e,t){return`program:${encodeURIComponent(e)}:${t.family}:${encodeURIComponent(t.subtype)}`}function Cs(e,t,n){return e==="incomplete"||t.some(o=>o.status!=="connected")?{status:"coverage-incomplete",scope:n,explanation:"The declared graph query has an ambiguous, missing, candidate-only, or disconnected anchor relationship."}:t.length>0?{status:"connector-complete",scope:n,explanation:"Every requested anchor pair has a selected path supported by proved repository relationships."}:{status:"frontier-accounted",scope:n,explanation:"Every discovered direction in the declared graph query is emitted or represented by an exact frontier."}}function gr(e,t={}){let n=t.maxSelectedNodes??24;if(!Number.isSafeInteger(n)||n<=0)throw new RangeError(`maxSelectedNodes must be a positive safe integer; received ${n}`);let o=new Set(e.anchors.flatMap(h=>[...h.nodeIds,...h.candidateNodeIds])),i=[],a=e.anchors.filter(h=>h.status!=="missing"&&h.nodeIds.length+h.candidateNodeIds.length>0);for(let h=0;h<a.length;h+=1)for(let P=h+1;P<a.length;P+=1){let D=a[h],O=a[P],w=dr(e,D,O,!1),I=w??dr(e,D,O,!0);I?(I.nodeIds.forEach(_=>o.add(_)),i.push({id:$t("path",D.id,O.id),fromAnchorId:D.id,toAnchorId:O.id,status:!w||D.status==="ambiguous"||O.status==="ambiguous"?"candidate":"connected",nodeIds:I.nodeIds,edgeIds:I.edgeIds})):i.push({id:$t("path",D.id,O.id),fromAnchorId:D.id,toAnchorId:O.id,status:"partial",nodeIds:[],edgeIds:[]})}let r=ie(t.routeIds??[]),s=Ls(e,r),c=new Set(s.routes.map(h=>h.id)),d=r.filter(h=>!c.has(h));if(d.length>0)throw new Error(`Unknown exploration route id(s): ${d.join(", ")}`);let u=s.routes.filter(h=>r.includes(h.id)).map(h=>({anchorNodeId:h.anchorNodeId,endpointNodeId:h.endpointNodeId,endpointKind:h.endpointKind,endpointPriority:2,nodeIds:[...h.nodeIds].reverse(),edgeIds:[...h.edgeIds].reverse()}));for(let h of u)h.nodeIds.forEach(P=>o.add(P));let f=i.length===0||i.some(h=>h.edgeIds.length>0);f&&pr(e,o,n);let m=mr(e,o),p=new Set(t.expandedFrontierIds??[]),g=new Set(m.map(h=>h.id)),b=[...p].filter(h=>!g.has(h)).sort();if(b.length>0)throw new Error(`Unknown exploration frontier id(s): ${b.join(", ")}`);for(let h of m)p.has(h.id)&&h.memberNodeIds.forEach(P=>o.add(P));f&&pr(e,o,n);let C=new Map(u.map(h=>[h.endpointNodeId,h.endpointKind])),S=new Set(u.flatMap(h=>h.nodeIds)),v=new Map;for(let h of u)for(let P=0;P<h.nodeIds.length;P+=1){let D=h.nodeIds[P],O=P;v.set(D,Math.max(v.get(D)??0,O))}let R=e.nodes.map(h=>{let P=C.get(h.id),D=S.has(h.id)?{upstreamCausalPath:!0,upstreamCausalDistance:v.get(h.id)??0,...P?{upstreamCausalEndpoint:P}:{}}:{};return{...h,attributes:{...h.attributes,...D},disposition:h.disposition==="excluded"||h.disposition==="unsupported"?h.disposition:o.has(h.id)?"emitted":"folded"}}),y=new Set([...i.flatMap(h=>h.edgeIds),...u.flatMap(h=>h.edgeIds)]),N=e.edges.map(h=>({...h,disposition:h.disposition==="excluded"||h.disposition==="unsupported"?h.disposition:y.has(h.id)||o.has(h.fromNodeId)&&o.has(h.toNodeId)?"emitted":"folded"})),L=Dt({anchors:e.anchors,nodes:R,edges:N,paths:i,frontiers:[...e.frontiers.filter(h=>h.disposition!=="folded"),...mr({...e,nodes:R,edges:N},o)],scope:e.coverage.scope,blindSpots:e.coverage.blindSpots,incompleteReasons:e.coverage.status==="incomplete"?[e.coverage.explanation]:[],routeCatalog:s}),x=new Set(L.frontiers.flatMap(h=>h.edgeIds)),M=L.edges.filter(h=>h.disposition==="folded"&&!x.has(h.id)).map(h=>h.id);if(M.length>0)throw new Error(`Folded exploration edge(s) are not frontier-accounted: ${M.sort().join(", ")}`);return L}var ar=10;function Ls(e,t=[]){let n=new Map(e.nodes.map(b=>[b.id,b])),o=new Map(e.edges.map(b=>[b.id,b])),i=new Map;for(let b of e.edges){if(!Is(b))continue;let C=i.get(b.toNodeId)??[];C.push(b),i.set(b.toNodeId,C)}for(let b of i.values())b.sort((C,S)=>Number(st(S))-Number(st(C))||cr(S)-cr(C)||C.fromNodeId.localeCompare(S.fromNodeId)||C.id.localeCompare(S.id));let a=ie(e.anchors.filter(b=>b.status==="matched").flatMap(b=>b.nodeIds)),r=new Map,s=new Set,c=(b,C,S)=>{let v=C.nodeIds[C.nodeIds.length-1],R=n.get(v),y=n.get(b);if(!R?.location||!y)return;let N=[...C.nodeIds].reverse(),L=[...C.edgeIds].reverse(),x=new Set(N),M=L.flatMap(w=>{let T=o.get(w);return T?[T]:[]}),h=e.edges.filter(w=>w.disposition!=="excluded"&&w.disposition!=="unsupported"&&(x.has(w.fromNodeId)||x.has(w.toNodeId))),P={id:$t("route",b,v,S,...L),status:"proved",anchorNodeId:b,anchorLabel:y.label,endpointNodeId:v,endpointLabel:R.label,endpointLocation:{...R.location},endpointKind:S,nodeIds:N,edgeIds:L,evidenceStrengths:ie(M.flatMap(w=>w.evidence.map(T=>T.strength))),spineEdgeFamilies:sr(M,!0),relatedEdgeFamilies:sr(h,!1),crossesRuntimeBoundary:M.some(st)},D=`${b}\0${v}\0${S}`,O=r.get(D);(!O||lr(P,O)<0)&&r.set(D,P)};for(let b of a){n.get(b)?.attributes.publicEntry===!0&&c(b,{nodeIds:[b],edgeIds:[]},"public-entry");let C=[{nodeIds:[b],edgeIds:[]}],S=new Map([[b,0]]);for(let v=0;v<C.length;v+=1){let R=C[v],y=R.nodeIds[R.nodeIds.length-1];R.edgeIds.length>0&&n.get(y)?.location&&n.get(y)?.attributes.publicEntry===!0&&c(b,R,"public-entry");let N=i.get(y)??[];if(R.edgeIds.length>=ar){N.some(L=>!R.nodeIds.includes(L.fromNodeId))&&s.add(b);continue}for(let L of N){if(R.nodeIds.includes(L.fromNodeId))continue;let x=R.edgeIds.length+1,M=S.get(L.fromNodeId);if(M!==void 0&&M<=x)continue;let h={nodeIds:[...R.nodeIds,L.fromNodeId],edgeIds:[...R.edgeIds,L.id]};if(S.set(L.fromNodeId,x),st(L)&&n.get(L.fromNodeId)?.location){c(b,h,"runtime-boundary");continue}C.push(h)}}}let d=[...r.values()].sort(lr),l=new Set(d.map(b=>b.id)),u=ie(t.filter(b=>l.has(b))),f=ie(d.map(b=>b.anchorNodeId)),m=a.filter(b=>!f.includes(b)),p=[...s].sort(),g=e.coverage.status==="accounted"&&p.length===0?"accounted":"incomplete";return{schemaVersion:1,routes:d,selectedRouteIds:u,coverage:{status:g,scope:"Distinct proved public-entry and runtime-boundary endpoints reachable upstream in the supplied topology.",enumeration:"one-shortest-proved-path-per-endpoint",maximumDepth:ar,anchorNodeIds:a,anchorsWithRoutes:f,anchorsWithoutRoutes:m,depthLimitedAnchorNodeIds:p,routeCount:d.length,explanation:g==="accounted"?"Every distinct proved upstream public/runtime endpoint in the supplied topology has one stable shortest route.":"Route enumeration is incomplete because the supplied topology has incomplete coverage or a traversal reached the route-depth bound."}}}function sr(e,t){let n=e.flatMap(o=>o.semantics?.map(i=>i.family)??[]);return t&&e.length>0&&n.length===0&&n.push("control"),ie(n)}function lr(e,t){return e.anchorNodeId.localeCompare(t.anchorNodeId)||e.edgeIds.length-t.edgeIds.length||e.endpointKind.localeCompare(t.endpointKind)||e.endpointNodeId.localeCompare(t.endpointNodeId)||e.id.localeCompare(t.id)}function Is(e){return e.disposition!=="excluded"&&e.disposition!=="unsupported"&&ws(e)&&e.evidence.some(t=>["exact","derived","mixed"].includes(t.strength))}function ws(e){return st(e)||e.kind==="boundary-observation"||e.kind==="call"||e.kind==="compiler:call"}function st(e){return e.kind==="runtime-boundary"||e.kind.startsWith("runtime:")}function cr(e){let t={exact:5,derived:4,mixed:3,candidate:1,unknown:0};return Math.max(0,...e.evidence.map(n=>t[n.strength]))}function dr(e,t,n,o){return ur(e,t,n,o)??ur(e,n,t,o)}function ur(e,t,n,o){let i=[...t.nodeIds,...t.candidateNodeIds].sort(),a=new Set([...n.nodeIds,...n.candidateNodeIds]);if(i.some(l=>a.has(l)))return{nodeIds:[i.find(u=>a.has(u))],edgeIds:[]};let r=new Set(e.nodes.filter(l=>l.kind==="structural-region").map(l=>l.id)),s=new Map;for(let l of e.edges)l.disposition==="excluded"||l.disposition==="unsupported"||l.kind==="structural-membership"||r.has(l.fromNodeId)||r.has(l.toNodeId)||l.evidence.every(f=>["candidate","unknown"].includes(f.strength))&&!o||Ns(s,l.fromNodeId,l.toNodeId,l.id);for(let l of s.values())l.sort((u,f)=>u.nodeId.localeCompare(f.nodeId)||u.edgeId.localeCompare(f.edgeId));let c=i.map(l=>({nodeId:l,nodeIds:[l],edgeIds:[]})),d=new Set(i);for(let l=0;l<c.length;l+=1){let u=c[l];for(let f of s.get(u.nodeId)??[]){if(d.has(f.nodeId))continue;let m={nodeId:f.nodeId,nodeIds:[...u.nodeIds,f.nodeId],edgeIds:[...u.edgeIds,f.edgeId]};if(a.has(f.nodeId))return m;d.add(f.nodeId),c.push(m)}}return null}function Ns(e,t,n,o){let i=e.get(t)??[];i.push({nodeId:n,edgeId:o}),e.set(t,i)}function Ms(e,t,n){let o=new Map;for(let s of e.edges){let c=o.get(s.fromNodeId)??{incoming:0,outgoing:0},d=o.get(s.toNodeId)??{incoming:0,outgoing:0};c.outgoing+=1,d.incoming+=1,o.set(s.fromNodeId,c),o.set(s.toNodeId,d)}let i=new Set,a=new Map;for(let s of e.edges){let c=t.has(s.fromNodeId),d=t.has(s.toNodeId);if(c===d)continue;let l=c?s.toNodeId:s.fromNodeId,u=c?s.fromNodeId:s.toNodeId,f=e.nodes.find(g=>g.id===l);if(f?.kind==="structural-region")continue;let m=a.get(l)??new Set;m.add(u),a.set(l,m),(/(?:runtime-boundary|external)/u.test(s.kind)||f&&/(?:frontier|external)/u.test(f.kind))&&i.add(l)}let r=[...a].filter(([s,c])=>{if(i.has(s))return!0;let d=o.get(s)??{incoming:0,outgoing:0};return(d.incoming>1||d.outgoing>1)&&c.size>1}).sort(([s,c],[d,l])=>Number(i.has(d))-Number(i.has(s))||l.size-c.size||s.localeCompare(d)).map(([s])=>s);for(let s of r){if(t.size>=n)break;t.add(s)}}function pr(e,t,n){let o=-1;for(;t.size!==o&&t.size<n;)o=t.size,Ms(e,t,n)}function mr(e,t){let n=new Set(e.nodes.filter(r=>!t.has(r.id)&&r.disposition!=="excluded"&&r.disposition!=="unsupported").map(r=>r.id)),o=new Map;for(let r of e.edges){if(!n.has(r.fromNodeId)||!n.has(r.toNodeId))continue;let s=o.get(r.fromNodeId)??new Set,c=o.get(r.toNodeId)??new Set;s.add(r.toNodeId),c.add(r.fromNodeId),o.set(r.fromNodeId,s),o.set(r.toNodeId,c)}let i=[],a=new Set;for(let r of[...n].sort()){if(a.has(r))continue;let s=[],c=[r];a.add(r);for(let d=0;d<c.length;d+=1){let l=c[d];s.push(l);for(let u of[...o.get(l)??[]].sort())a.has(u)||(a.add(u),c.push(u))}i.push(s.sort())}return i.map(r=>{let s=new Set(r),c=e.edges.filter(p=>s.has(p.fromNodeId)||s.has(p.toNodeId)),d=c.filter(p=>s.has(p.fromNodeId)!==s.has(p.toNodeId)),l=ie(d.map(p=>s.has(p.fromNodeId)?p.toNodeId:p.fromNodeId)),u=new Set(d.map(p=>s.has(p.toNodeId)?"outgoing":"incoming")),f=ie(c.map(p=>p.id)),m=ie(d.map(p=>p.kind));return{id:$t("frontier",...r,...f),kind:m.join("+")||"disconnected",direction:u.size===1?[...u][0]:"undirected",fromNodeIds:l,edgeIds:f,memberNodeIds:r,memberCount:r.length,disposition:"folded",reason:d.length>0?"Connected evidence is folded beyond the first edge leaving the selected connector graph.":"Discovered evidence is disconnected from every selected anchor connector under the declared relation scope.",expansion:null}})}function $t(e,...t){let n=ys("sha256").update(t.join("\0")).digest("hex").slice(0,16);return`${e}:${n}`}function We(e,t){let n=[...e].sort((o,i)=>o.id.localeCompare(i.id));for(let o=1;o<n.length;o+=1)if(n[o-1].id===n[o].id)throw new Error(`Duplicate exploration ${t} id: ${n[o].id}`);return n}function ce(e,t,n,o){let i=ie(t.filter(a=>!n.has(a)));if(i.length>0)throw new Error(`Exploration ${e} references missing ${o}(s): ${i.join(", ")}`)}function fr(e){return{total:e.length,emitted:e.filter(t=>t.disposition==="emitted").length,folded:e.filter(t=>t.disposition==="folded").length,excluded:e.filter(t=>t.disposition==="excluded").length,unsupported:e.filter(t=>t.disposition==="unsupported").length}}function ie(e){return[...new Set(e)].sort()}var Rs=5,Ts=12,Fs=8,Ps=3,yr=8,As=6,ks=12,hr=12,$s=12,Ds=2,_s=new Set(["branch","loop","call","await","return","throw","mutation","catch","finally"]),Bs=9e3,br=wo,Sr=new WeakMap;function Rr(e,t){return Qs(e,t,"topology")}function Os(e,t,n,o,i,a=!1){let r=e.get(t);if(r)return r.depth=Math.min(r.depth,n),r.primary||=i,r.promoteBoundaryImports||=a,r.origins.add(o),r;let s={file:t,depth:n,primary:i,promoteBoundaryImports:a,origins:new Set([o]),processed:!1};return e.set(t,s),s}function Gs(e,t,n,o,i,a,r="none",s=!1){let c=e.get(n.symbol);if(c)return c.depth=Math.min(c.depth,o),c.origins.add(i),a&&c.anchorQueries.add(a),c.referenceScope=Ol(c.referenceScope,r),t(n.relativePath,o,i,!0,s),c;let d={definition:n,depth:o,origins:new Set([i]),anchorQueries:new Set(a?[a]:[]),referenceScope:r,processed:!1};return e.set(n.symbol,d),t(n.relativePath,o,i,!0,s),d}function js(e,t,n,o,i,a,r=!1,s=!0){let c=Se(n),d=e.get(c);if(d)return d.depth=Math.min(d.depth,o),d.origins.add(i),a&&d.anchorQueries.add(a),d.reverseCallExpansion||=r,d.traversalEligible||=s,t(n.file,o,i,d.traversalEligible,!0),d;let l={...n,depth:o,origins:new Set([i]),anchorQueries:new Set(a?[a]:[]),reverseCallExpansion:r,traversalEligible:s};return e.set(c,l),t(n.file,o,i,s,!0),l}function Ks(e){let{db:t,index:n,pendingRelations:o,addFile:i,addSymbol:a,addSourceConstruct:r,observation:s,depth:c,origin:d}=e;i(s.source.file,c,d,!0,!0),s.owner.file!==s.source.file&&i(s.owner.file,c,`${d}:owner`,!0,!0);let l=X(t,s.owner.file),u=s.owner.symbol?Te(t,n,s.owner.symbol).matches.find(p=>p.relativePath===s.owner.file):null,f=(u&&!re(u.symbol)?u:null)??Ge(l,s.source.startLine);if(f&&!re(f.symbol))return a(f,c,d,void 0,"none",!0),f.symbol;s.owner.name&&r({file:s.owner.file,name:s.owner.name,startLine:s.owner.startLine,endLine:s.owner.endLine},c,`${d}:source-owner`,void 0,!0);let m=e.index.definitionsForFile(s.source.file).filter(p=>!!p.leaf&&Ee(t,s.source.file,p.leaf).some(g=>g>=s.source.startLine&&g<=s.source.endLine));if(m.length===1){let p=m[0];a(p,c,`${d}:handler-identifier`,void 0,"none",!0),pe(o,{kind:"runtime-boundary",evidence:"runtime-boundary:handler-identifier",fromFile:s.source.file,fromSymbol:null,toFile:p.relativePath,toSymbol:p.symbol,fromBoundaryParticipant:Ve(s),line:s.source.startLine,strength:"derived"})}return null}function qs(e){let t=0,n=0,o=0;for(let i of e.searches){let a=El(e.db,e.index,i,e.boundaryObservationLocations),r=a.filter(l=>Nl(l,e.sourceAllowed)),s=!e.opts.fullLiteralTraversal&&(a.length>Ts||r.length>Fs),c=s?[]:a,d=new Set((s?[]:e.opts.fullLiteralTraversal?r:[...r].sort(Cl).slice(0,Ps)).map(Lr));s&&(n+=1,o+=a.length);for(let l of c){let u=d.has(Lr(l)),f=u&&!l.ownerSymbol&&l.ownerStartLine!==null&&l.ownerEndLine!==null;if(e.addFile(l.relativePath,0,`${u?"literal-anchor":"literal-match"}:${i}`,f,f),f&&e.addSourceConstruct({file:l.relativePath,name:l.ownerShortName??`${l.relativePath}:${l.ownerStartLine+1}`,startLine:l.ownerStartLine,endLine:l.ownerEndLine},0,`literal-source-owner:${i}`,i,!0),u&&l.ownerSymbol){let m=Te(e.db,e.index,l.ownerSymbol).matches[0];m&&!re(m.symbol)&&e.addSymbol(m,0,"literal-owner",i,"all",!0)}e.literalHits.push({query:i,file:l.relativePath,line:l.line,ownerSymbol:l.ownerSymbol,ownerShortName:l.ownerShortName,ownerStartLine:l.ownerStartLine,ownerEndLine:l.ownerEndLine,sourceLine:l.sourceLine.trim(),matchKind:l.matchKind,traversalSeed:u})}e.anchors.push({kind:"literal",query:i,status:a.length>0?"matched":"missing",matchedRegionIds:[],matchingLines:a.length,seedMatchingLines:s?0:d.size,matchOnlyLines:a.length-d.size,eligibleSeedMatchingLines:r.length,materializedMatchingLines:c.length,withheldMatchingLines:s?a.length:0,literalTraversal:s?"withheld-broad":"materialized",representativeMatches:s?Ml(i,a):void 0,narrowingCommands:s?Tl(i,a):void 0,exhaustiveTraversalCommand:s||d.size<r.length?`scip-query system-map --search ${V(i)} --full-literal-traversal`:void 0,seedRegionIds:[],matchOnlyRegionIds:[]})}for(let i of e.symbolQueries){let a=Te(e.db,e.index,i);t+=a.omitted;let r=Ll(e.db,i),s=a.matches.filter(f=>!re(f.symbol)),c=r!==null&&s.length===0;c&&e.addSourceConstruct(r,0,"source-construct-anchor",i,!0);let d=c?s:a.matches;for(let f of d)e.addSymbol(f,0,"symbol-anchor",i,"all",!0);let l=c?Il(r):null,u=c?1:a.total;e.anchors.push({kind:"symbol",query:i,status:u===0?"missing":u===1?"matched":"ambiguous",matchedRegionIds:[],symbolCandidates:[...l?[l]:[],...d.map($l)],totalSymbolCandidates:u,omittedSymbolCandidates:a.omitted})}return{omittedSymbolCandidates:t,broadLiteralAnchors:n,withheldLiteralMatches:o}}function zs(e){let{db:t,opts:n,mode:o,searches:i,symbolQueries:a,maxDepth:r,maxTopologyCharacters:s,requestedRelationKinds:c,evidenceFloor:d,includedSourceScopes:l,workspaces:u,runtimeBoundaries:f,boundaryObservations:m,representedBoundaryLinkIds:p,files:g,symbols:b,sourceConstructs:C,literalHits:S,pendingRelations:v,externalImports:R,anchors:y,omittedSymbolCandidates:N,broadLiteralAnchors:L,withheldLiteralMatches:x,filteredUnverifiedCallEdges:M,memberCallCandidateEdges:h,unresolvedMemberCallsites:P,sourceAllowed:D}=e,O=new Set(c),w=new Map;for(let F of g.keys())w.set(F,lt(F,u));let T=[...v.values()].filter(F=>w.has(F.fromFile)&&w.has(F.toFile)).map(F=>({...F,fromRegionId:w.get(F.fromFile).id,toRegionId:w.get(F.toFile).id})).sort(Ar),I=Vl(T),_=new Set(n.expand??[]),A=zl(g,b,S,T,I,w,_),j=new Set([...g.values()].filter(F=>[...F.origins].some(K=>K.startsWith("literal-anchor:")||K==="literal-owner"||K==="symbol-anchor")).map(F=>w.get(F.file).id)),$=Sl(A),B=new Set(A.map(F=>F.id)),U=[..._].filter(F=>!B.has(F)).sort();for(let F of y)if(F.matchedRegionIds=Yl(F,S,b,w),F.kind==="literal"){let K=S.filter(Z=>Z.query===F.query);F.seedRegionIds=z(K.filter(Z=>Z.traversalSeed).map(Z=>w.get(Z.file).id)),F.matchOnlyRegionIds=z(K.filter(Z=>!Z.traversalSeed).map(Z=>w.get(Z.file).id))}let q=[...b.values()].filter(F=>!F.processed).length,se=[...g.values()].filter(F=>F.primary&&!F.processed).length,Ne=[...g.values()].filter(F=>!F.primary&&!F.processed).length,Oe=[...b.values()].filter(F=>F.processed),ve=(f?.frontiers??[]).flatMap(F=>{let K=m.get(F.observationId);return!K&&F.source&&F.action&&F.strength?!O.has("runtime-boundary")||!D(F.source.file)||d==="exact"||!g.has(F.source.file)?[]:[{observationId:F.observationId,action:F.action,strength:F.strength,file:F.source.file,line:F.source.startLine,ownerShortName:F.ownerShortName??null,address:F.address??F.missingKeyParts.join(", "),reason:F.reason}]:!O.has("runtime-boundary")||!K||!D(K.source.file)||d==="exact"&&K.strength!=="exact"||!g.has(K.source.file)?[]:[{observationId:K.id,action:K.action,strength:K.strength,file:K.source.file,line:K.source.startLine,ownerShortName:K.owner.name,address:Pr(K),reason:F.reason,protocol:K.protocol,role:K.role,modality:K.modality,resolution:K.resolution,sourceScope:K.sourceScope,keyParts:K.keyParts.map(Z=>({name:Z.name,value:Z.value,evidence:Z.evidence}))}]}).sort((F,K)=>F.file.localeCompare(K.file)||F.line-K.line),E=(f?.links??[]).filter(F=>{if(!O.has("runtime-boundary")||d==="exact"&&F.strength!=="exact")return!1;let K=m.get(F.from),Z=m.get(F.to);return!!(K&&Z&&D(K.source.file)&&D(Z.source.file)&&(g.has(K.source.file)||g.has(Z.source.file)))}),k=E.filter(F=>F.strength==="exact").length,G=E.filter(F=>F.strength==="derived").length,H=E.filter(F=>F.strength==="candidate").length,me=f?.links.filter(F=>F.strength==="exact").length??0,Fe=f?.links.filter(F=>F.strength==="derived").length??0,Qe=f?.links.filter(F=>F.strength==="candidate").length??0,jt=Ql(R,w),Kt=N===0?"accounted":"incomplete",Rn=[...L>0?[`${L} broad literal anchor(s) withheld ${x} exact match(es) before graph traversal; representative identities and scoped search commands preserve recovery without treating every textual occurrence as relevant.`]:[],`Literal matches outside the included source scopes (${l.join(", ")}) remain visible as match-only evidence and do not seed traversal.`,f?"Built-in runtime-boundary extractors traverse direct and replayably derived links; heuristic candidates, unsupported frameworks, reflection, generated names, and dependency wiring not recoverable from compiler occurrences or constructor assignments remain disclosed frontiers.":"Runtime-boundary evidence is unavailable for this index; run scip-query reindex with this build to extract supported HTTP, event, registry, and persistence observations.","Reverse references do not recursively expand from discovered callers or callees.","Member calls use compiler occurrences, exact constructor-assigned fields, bounded unique service providers, direct factory-return members, and compiler-resolved object-literal callbacks when available. Ambiguous providers remain candidate frontiers; callback values routed through mutation, reflection, or unsupported dependency containers remain unrepresented.","Literal traversal is bounded to the smallest parser-delimited source construct; parser gaps may reduce an owner to one source line and leave its continuation untraversed.","Schema consumers stay within forward-flow regions; cross-workspace contracts may discover consumers in other workspaces. Add an explicit symbol anchor to widen either scope.",`Traversal stops after depth ${r}; nonzero frontier counts identify evidence that was discovered but not traversed.`,"Region labels are structural path groupings, not inferred runtime or architectural boundaries."],fe=ll({db:t,anchors:y,regions:A,symbolStates:b,sourceConstructStates:C,literalHits:S,relations:T,externalBoundaries:jt,boundaryFrontiers:ve,regionForFile:w,closureStatus:Kt,omittedSymbolCandidates:N,maxDepth:r,requestedRelationKinds:c,evidenceFloor:d,includedSourceScopes:l,blindSpots:Rn,topologyFrontiers:n.topologyFrontiers??[],routeIds:n.routeIds??[],expandedRegionIds:[..._],maxTopologyCharacters:s,fullLiteralTraversal:n.fullLiteralTraversal??!1});if(o==="topology")return fe;let Tn=(n.behaviorFocusLocations?.length??0)>0?new Set([...fe.anchors.flatMap(F=>F.nodeIds),...fe.paths.flatMap(F=>F.nodeIds)]).size:void 0,ct=go(t,fe,{focusLocations:n.behaviorFocusLocations,...Tn?{maxSteps:Tn}:{}});Eo(t,fe,ct);let Gr=Ys(t,fe,ct,n.behaviorFocusLocations??[]);fe.corridor=nr(fe,{focusLocations:Gr});let Fn=xo(t,fe,ct,{sourceAllowed:D,selectionTerms:n.selectionTerms}),Pn=ml(fe),jr=hl(i,a,r,c,d,l,n.fullLiteralTraversal??!1,s,A,I,j,_,Pn),Kr=yl(i,a,r,A.filter(F=>Pn.has(F.id)),j,c,d,l,n.fullLiteralTraversal??!1,s);return{anchors:y,regions:A,regionRelations:I,externalBoundaries:jt,boundaryFrontiers:ve,unmatchedExpansions:U,expansion:Kr,drilldown:$,presentation:jr,topology:fe,behavior:ct,nextAnchors:Fn,closure:{status:Kt,emitted:{regions:A.length,relations:T.length,runtimeLinks:p.size},withheld:{symbols:q,files:se+Ne,regions:fe.nodes.filter(F=>F.kind==="structural-region"&&F.disposition==="folded").length,drillAnchors:($?.omittedAnchors??0)+Fn.omittedAnchors,literalMatches:x},ambiguous:{anchors:y.filter(F=>F.status==="ambiguous").length,omittedSymbolCandidates:N},external:jt.length,unresolved:ve.length,explanation:Kt==="accounted"?"Every fact reached under the declared anchors, relations, depth, evidence floor, source scopes, and installed analyzers is accounted for as emitted, withheld, ambiguous, external, or unresolved.":"Some ambiguous symbol candidates were not identified, so the declared query is not fully accounted for."},coverage:{explicitAnchorCount:y.length,requestedRelationKinds:c,evidenceFloor:d,includedSourceScopes:l,matchedAnchorCount:y.filter(F=>F.status!=="missing").length,literalSearchesComplete:!0,broadLiteralAnchors:L,withheldLiteralMatches:x,symbolCandidateSetsComplete:N===0,omittedSymbolCandidates:N,maxTraversalDepth:r,frontierSymbols:q,frontierFiles:se,supportFilesNotTraversed:Ne,filteredUnverifiedCallEdges:M,memberCallCandidateEdges:h,unresolvedMemberCallsites:P,runtimeBoundaryEvidenceAvailable:f!==null,runtimeBoundaryObservations:f?.observations.length??0,runtimeBoundaryExactLinks:k,runtimeBoundaryDerivedLinks:G,runtimeBoundaryCandidateLinks:H,repositoryRuntimeBoundaryExactLinks:me,repositoryRuntimeBoundaryDerivedLinks:Fe,repositoryRuntimeBoundaryCandidateLinks:Qe,runtimeBoundaryTraversedLinks:p.size,runtimeBoundaryFrontiers:ve.length,referenceExpansionEligibleSymbols:Oe.filter(F=>F.referenceScope!=="none").length,referenceExpansionSkippedSymbols:Oe.filter(F=>F.referenceScope==="none").length,dynamicDispatchRepresented:f?.links.some(F=>F.joinRule==="carrier.discriminator"&&p.has(F.id))??!1,runtimeGeneratedLinksRepresented:f!==null,regionBoundariesAreStructural:!0,relationFamilies:{"literal-anchor":{evidence:"exact-source",scope:"all indexed documents for each explicit literal",completeWithinScope:!0},reference:{evidence:"compiler-graph",scope:"all cross-file indexed/source-attributed sites for explicit anchors and promoted non-module boundary symbols",completeWithinScope:!0},call:{evidence:"mixed",scope:"static callees plus exact SCIP call occurrences in traversed source ranges, exact constructor-assigned member receivers, and uniquely attributed direct-import member candidates",completeWithinScope:!0},"contract-symbol":{evidence:"compiler-graph",scope:"compiler-resolved symbol identities referenced across inferred workspace boundaries",completeWithinScope:!0},import:{evidence:"compiler-graph",scope:"all indexed or source-resolved imports of traversed primary files",completeWithinScope:!0},"runtime-boundary":{evidence:"exact-source",scope:"direct and mechanically derived links produced by grounded runtime adapters and factorized relation groups",completeWithinScope:!0}},blindSpots:Rn}}}function Us(e,t){let{db:n,relationPolicy:o,sourceConstructs:i,reverseExpandedSourceConstructs:a,pendingRelations:r,reverseFileGraph:s,serviceCallerFilesBySourceConstruct:c,sourceAllowed:d,memberCallTargetsForWholeFile:l,addSymbol:u,addSourceConstruct:f}=e;if(o.has("call")){let m=[...i.values()].filter(p=>p.traversalEligible&&p.reverseCallExpansion&&p.depth<=t&&!a.has(Se(p)));for(let p of m){a.add(Se(p));let g=oe(n,p.file);if((g?.callables??[]).filter(S=>S.name===p.name&&S.startLine<=p.endLine&&S.endLine>=p.startLine).length===1){let S=(g?.callSites??[]).filter(v=>v.calleeLeaf===p.name&&!v.memberAccess);for(let v of S){let R=t+1,y=Ge(X(n,p.file),v.line),N=null,L=null;if(y&&!re(y.symbol)){if(y.relativePath===p.file&&y.startLine<=p.endLine&&y.endLine>=p.startLine)continue;u(y,R,"reverse-local-call-owner",void 0,"forward-regions",!0),N=y.symbol}else{let x=En(n,p.file,v.line);x&&Se(x)!==Se(p)&&(L=f(x,R,"reverse-local-call-source-owner",void 0,!0))}!N&&!L||pe(r,{kind:"call",evidence:"ast-callsite",fromFile:p.file,fromSymbol:N,toFile:p.file,toSymbol:null,fromSourceConstruct:L?ae(L):void 0,toSourceConstruct:ae(p),line:v.line,strength:"derived"})}}let C=new Set([...s.get(p.file)??[],...c.get(Se(p))??[],...ro(n,p.file).flatMap(S=>[...s.get(S)??[]])]);for(let S of C){if(!d(S))continue;let R=l(S).targets.filter(y=>y.targetFile===p.file&&y.targetStartLine<=p.endLine&&y.targetEndLine>=p.startLine);for(let y of R){let N=t+1,L=Ge(X(n,S),y.line),x=null,M=null;if(L&&!re(L.symbol))u(L,N,"reverse-member-call-owner",void 0,"cross-workspace-or-forward",!0),x=L.symbol;else{let h=En(n,S,y.line);h&&(M=f(h,N,"reverse-member-call-source-owner",void 0,!0))}!x&&!M||pe(r,{kind:"call",evidence:"ast-service-member-callsite",fromFile:S,fromSymbol:x,toFile:p.file,toSymbol:null,fromSourceConstruct:M?ae(M):void 0,toSourceConstruct:ae(p),line:y.line,strength:y.strength==="exact"?"exact":"derived"})}}}}}function Ws(e,t){let{db:n,index:o,relationPolicy:i,symbols:a,sourceAllowed:r,files:s,workspaces:c,addFile:d,addSymbol:l,addSourceConstruct:u,pendingRelations:f,fileGraph:m,traversalMetrics:p}=e,g=[...a.values()].filter(C=>!C.processed&&C.depth<=t),b=i.has("call")?o.calleeMap(g.map(C=>C.definition),{additive:!1,semantic:!1}):new Map;for(let C of g){C.processed=!0;let S=C.definition;if(C.referenceScope!=="none"&&(i.has("call")||i.has("reference")||i.has("contract-symbol"))){let v=Pl(n,o,S).filter(y=>r(y.file)&&Bl(C,y.file,s,c)),R=new Set(v.flatMap(y=>{if(!(i.has("call")&&oe(n,y.file)?.callSites.some(x=>x.line===y.line&&vr(n,y.file,x,S))===!0)||!y.enclosingSymbol)return[];let L=Te(n,o,y.enclosingSymbol).matches[0];return L&&!re(L.symbol)?[{owner:L,site:y}]:[]}).sort((y,N)=>{let L=de(S.relativePath,c).relativeDir,x=de(y.owner.relativePath,c).relativeDir===L,M=de(N.owner.relativePath,c).relativeDir===L,h=xr(n,y.owner),P=xr(n,N.owner),D=y.owner.endLine-y.owner.startLine,O=N.owner.endLine-N.owner.startLine;return Number(M)-Number(x)||P-h||D-O||y.owner.symbol.localeCompare(N.owner.symbol)}).filter((y,N,L)=>L.findIndex(x=>x.owner.symbol===y.owner.symbol)===N).reduce((y,N)=>{if(y.length>=Ds)return y;let L=de(N.owner.relativePath,c).relativeDir;return y.some(x=>x.workspace===L)||y.push({symbol:N.owner.symbol,workspace:L}),y},[]).map(y=>y.symbol));for(let y of v){let N=t+1;d(y.file,N,`reference:${J(S.symbol)}`,!0);let L=i.has("call")&&oe(n,y.file)?.callSites.some(h=>h.line===y.line&&vr(n,y.file,h,S))===!0,x=null,M=null;if(y.enclosingSymbol){let h=Te(n,o,y.enclosingSymbol).matches[0];h&&!re(h.symbol)&&(l(h,N,"reference-owner",void 0,L&&R.has(h.symbol)?C.referenceScope:"none"),x=h.symbol)}if(!x&&y.line!==null){let h=En(n,y.file,y.line);h&&(M=u(h,N,"reference-source-owner",void 0,L))}i.has("reference")&&pe(f,{kind:"reference",evidence:"indexed-or-source-reference",fromFile:y.file,fromSymbol:x,toFile:S.relativePath,toSymbol:S.symbol,fromSourceConstruct:M?ae(M):void 0,line:y.line,strength:"mixed"}),L&&pe(f,{kind:"call",evidence:"ast-callsite",fromFile:y.file,fromSymbol:x,toFile:S.relativePath,toSymbol:S.symbol,fromSourceConstruct:M?ae(M):void 0,line:y.line,strength:"derived"}),i.has("contract-symbol")&&de(y.file,c).relativeDir!==de(S.relativePath,c).relativeDir&&pe(f,{kind:"contract-symbol",evidence:"compiler-cross-workspace-symbol",fromFile:y.file,fromSymbol:x,toFile:S.relativePath,toSymbol:S.symbol,fromSourceConstruct:M?ae(M):void 0,line:y.line,strength:"exact"})}}for(let v of b.get(S.symbolId)??[]){let R=Te(n,o,v.symbol).matches.find(N=>N.relativePath===v.file);if(!R||!r(R.relativePath))continue;if(!(R.relativePath===S.relativePath||(m.get(S.relativePath)??new Set).has(R.relativePath))){p.filteredUnverifiedCallEdges+=1;continue}l(R,t+1,`call:${J(S.symbol)}`,void 0,"none",!0),pe(f,{kind:"call",evidence:v.source,fromFile:S.relativePath,fromSymbol:S.symbol,toFile:R.relativePath,toSymbol:R.symbol,line:null,strength:gl(v.source)})}}}function Hs(e,t){let{db:n,index:o,relationPolicy:i,files:a,sourceConstructs:r,symbols:s,boundaryObservations:c,boundaryObservationDepths:d,sourceAllowed:l,addSymbol:u,pendingRelations:f,traversalMetrics:m,addSourceConstruct:p,serviceCallerFilesBySourceConstruct:g,reverseFileGraph:b,externalImports:C,addFile:S,workspaces:v}=e,R=[...a.values()].filter(y=>!y.processed&&y.primary&&y.depth<=t);for(let y of R){y.processed=!0;let N=[...r.values()].filter(I=>I.traversalEligible&&I.file===y.file&&I.depth<=t),L=[...s.values()].filter(I=>I.definition.relativePath===y.file&&I.depth<=t).map(I=>{let _=Yt(n,y.file,I.definition.startLine);return{startLine:_?.startLine??I.definition.startLine,endLine:_?.endLine??I.definition.endLine}}),x=I=>[...s.values()].filter(_=>_.definition.relativePath===y.file&&_.definition.startLine<=I&&_.definition.endLine>=I).sort((_,A)=>_.definition.endLine-_.definition.startLine-(A.definition.endLine-A.definition.startLine)||_.definition.startLine-A.definition.startLine)[0],M=[...c.values()].filter(I=>I.source.file===y.file&&d.has(I.id)),h=[...N.map(I=>({startLine:I.startLine,endLine:I.endLine})),...M.map(I=>({..._t(n,I)}))],P=[...L,...h],D=(oe(n,y.file)?.callSites??[]).filter(I=>P.some(_=>I.line>=_.startLine&&I.line<=_.endLine)),O=new Set;if(i.has("call"))for(let I of P){let _=bt(n,y.file,I.startLine,I.endLine);for(let A of _.targets){if(!l(A.definition.relativePath))continue;let j=x(A.sourceLine),$=N.find(U=>U.startLine<=A.sourceLine&&U.endLine>=A.sourceLine),B=M.find(U=>{let q=_t(n,U);return q.startLine<=A.sourceLine&&q.endLine>=A.sourceLine});u(A.definition,t+1,`scip-occurrence-call:${y.file}:${A.sourceLine+1}`,void 0,"none",!0),pe(f,{kind:"call",evidence:"scip-occurrence-callsite",fromFile:y.file,fromSymbol:j?.definition.symbol??null,toFile:A.definition.relativePath,toSymbol:A.definition.symbol,fromBoundaryParticipant:B?Ve(B):void 0,fromSourceConstruct:$?ae($):void 0,line:A.sourceLine,strength:"exact"}),O.add(`${A.sourceLine}\0${A.calleeLeaf}`)}}if(i.has("reference"))for(let I of P){let _=Vn(n,y.file,I.startLine,I.endLine);for(let A of _.targets){if(!l(A.definition.relativePath)||O.has(`${A.sourceLine}\0${A.calleeLeaf}`))continue;let j=x(A.sourceLine);if(j?.definition.symbol===A.definition.symbol)continue;let $=N.find(U=>U.startLine<=A.sourceLine&&U.endLine>=A.sourceLine),B=M.find(U=>{let q=_t(n,U);return q.startLine<=A.sourceLine&&q.endLine>=A.sourceLine});u(A.definition,t+1,`scip-occurrence-reference:${y.file}:${A.sourceLine+1}`,void 0,"none",!0),pe(f,{kind:"reference",evidence:"scip-occurrence-reference",fromFile:y.file,fromSymbol:j?.definition.symbol??null,toFile:A.definition.relativePath,toSymbol:A.definition.symbol,fromBoundaryParticipant:B?Ve(B):void 0,fromSourceConstruct:$?ae($):void 0,line:A.sourceLine,strength:"exact"})}}let w=i.has("call")?en(n,y.file,{ranges:P,excludeIndexedTargets:!1}):{targets:[],unresolvedCallsites:0};m.unresolvedMemberCallsites+=w.unresolvedCallsites;let T=w.targets.filter(I=>!O.has(`${I.line}\0${I.calleeLeaf}`));m.memberCallCandidateEdges+=T.filter(I=>I.strength!=="exact"&&(I.resolution!=="imported-service-object-member"||(I.resolutionAlternativeCount??0)>1)).length;for(let I of T){let _=(I.resolutionAlternativeCount??1)===1,A=I.targetSymbol?X(n,I.targetFile).find(q=>q.symbol===I.targetSymbol):void 0,j=A?null:p({file:I.targetFile,name:I.calleeLeaf,startLine:I.targetStartLine,endLine:I.targetEndLine},t+1,`member-call:${y.file}`,void 0,I.resolution==="imported-service-object-member"&&_,_);if(j&&I.serviceFile){let q=Se(j),se=g.get(q)??new Set;for(let Ne of b.get(I.serviceFile)??[])se.add(Ne);g.set(q,se)}A&&u(A,t+1,`member-call:${y.file}`,void 0,"none",!0);let $=N.find(q=>q.startLine<=I.line&&q.endLine>=I.line),B=x(I.line),U=M.find(q=>{let se=_t(n,q);return se.startLine<=I.line&&se.endLine>=I.line});pe(f,{kind:"call",evidence:I.resolution==="constructed-member-receiver"?"ast-constructed-member-callsite":I.resolution==="factory-callback-member"?"ast-factory-callback-callsite":I.resolution==="imported-service-object-member"?"ast-service-member-callsite":"ast-member-import-candidate",fromFile:y.file,fromSymbol:B?.definition.symbol??null,toFile:I.targetFile,toSymbol:A?.symbol??null,fromBoundaryParticipant:U?Ve(U):void 0,fromSourceConstruct:$?ae($):void 0,toSourceConstruct:j?ae(j):void 0,line:I.line,strength:I.resolution==="imported-service-object-member"?(I.resolutionAlternativeCount??0)===1?"derived":"candidate":I.strength??"candidate"})}for(let I of i.has("import")||i.has("call")?Al(n,y.file):[]){if(!I.fromFile){if(i.has("import")){let A=C.get(I.shortName)??{name:I.shortName,fromFiles:new Set};A.fromFiles.add(y.file),C.set(I.shortName,A)}continue}if(!l(I.fromFile))continue;if(i.has("import")&&(S(I.fromFile,t+1,`import:${y.file}`,!1),pe(f,{kind:"import",evidence:"indexed-or-source-import",fromFile:y.file,fromSymbol:null,toFile:I.fromFile,toSymbol:I.symbol,line:null,strength:"mixed"})),i.has("call")&&D.length>0){let A=(I.source==="compiler"?Te(n,o,I.symbol).matches:je(n,I.fromFile,I.importedName)).filter(j=>!re(j.symbol));for(let j of A){let $=D.filter(B=>B.calleeLeaf===I.localName).map(B=>B.line);if($.length!==0){u(j,t+1,`source-call:${y.file}`,void 0,"none",!0);for(let B of $)pe(f,{kind:"call",evidence:"ast-callsite",fromFile:y.file,fromSymbol:null,toFile:j.relativePath,toSymbol:j.symbol,line:B,strength:"derived"})}}}if(!y.promoteBoundaryImports||!Dl(y.file,I.fromFile,v))continue;let _=Te(n,o,I.symbol);for(let A of _.matches)if(_l(A.relativePath,I.fromFile,v)&&!re(A.symbol)){let j=de(y.file,v).relativeDir!==de(A.relativePath,v).relativeDir;u(A,t+1,`boundary-import:${y.file}`,void 0,j?"cross-workspace-or-forward":"forward-regions")}}}}function Vs(e,t){let{relationPolicy:n,runtimeBoundaries:o,evidenceFloor:i,representedBoundaryLinkIds:a,boundaryObservations:r,sourceAllowed:s,boundaryObservationDepths:c,symbols:d,sourceConstructs:l,addBoundaryObservation:u,pendingRelations:f}=e;for(let m of n.has("runtime-boundary")?o?.links??[]:[]){if(m.strength==="candidate"||i==="exact"&&m.strength!=="exact"||a.has(m.id))continue;let p=r.get(m.from),g=r.get(m.to);if(!p||!g||!s(p.source.file)||!s(g.source.file))continue;let b=Nr(p,t,c,d,l),C=Nr(g,t,c,d,l);if(b===null&&C===null)continue;let S=t+1,v=u(p,b??S,`runtime-boundary:${m.joinRule}`),R=u(g,C??S,`runtime-boundary:${m.joinRule}`),y=v?null:wr(l,p),N=R?null:wr(l,g);c.set(p.id,b??S),c.set(g.id,C??S),pe(f,{kind:"runtime-boundary",evidence:`runtime-boundary:${m.joinRule}`,fromFile:p.source.file,fromSymbol:v,toFile:g.source.file,toSymbol:R,fromBoundaryParticipant:Ve(p),toBoundaryParticipant:Ve(g),fromSourceConstruct:y?ae(y):void 0,toSourceConstruct:N?ae(N):void 0,runtimeBoundaryKey:m.matchedKeyParts.map(L=>`${L.name}=${L.value}`).join(" "),line:p.source.startLine,strength:m.strength}),a.add(m.id)}}function Qs(e,t,n){let o=te(t.searches??[]),i=te(t.symbols??[]),a=te(t.relations&&t.relations.length>0?t.relations:br),r=a.filter(k=>!br.includes(k));if(r.length>0)throw new Error(`Unsupported system-map relation kind(s): ${r.join(", ")}`);let s=new Set(a),c=t.evidenceFloor??"derived";if(c!=="exact"&&c!=="derived")throw new Error(`Unsupported system-map evidence floor: ${c}`);let d=te(t.sourceScopes&&t.sourceScopes.length>0?t.sourceScopes:["production"]),l=["production","test","fixture","example","generated","script","unknown"],u=d.filter(k=>!l.includes(k));if(u.length>0)throw new Error(`Unsupported system-map source scope(s): ${u.join(", ")}`);let f=new Set(d),m=k=>f.has(Ut(k));if(o.length===0&&i.length===0)throw new Error("system-map requires at least one --search or --symbol anchor.");let p=t.maxDepth??Rs;if(!Number.isSafeInteger(p)||p<0)throw new RangeError(`maxDepth must be a non-negative safe integer; received ${p}`);let g=t.maxTopologyCharacters??Bs;if(!Number.isSafeInteger(g)||g<=0)throw new RangeError(`maxTopologyCharacters must be a positive safe integer; received ${g}`);let b=new St(e),{fileGraph:C,reverseFileGraph:S,workspaces:v,runtimeBoundaries:R}=Gl(e,b),y=new Map((R?.observations??[]).map(k=>[k.id,k])),N=new Set((R?.observations??[]).map(k=>`${k.source.file}\0${k.source.startLine}`)),L=new Set,x=new Map,M=new Map,h=new Map,P=new Map,D=[],O=new Map,w=new Map,T=[],I={filteredUnverifiedCallEdges:0,memberCallCandidateEdges:0,unresolvedMemberCallsites:0},_=new Set,A=new Map,j=new Map,$=k=>{let G=j.get(k);if(G)return G;let H=en(e,k,{excludeIndexedTargets:!1});return j.set(k,H),H},B=(k,G,H,me,Fe=!1)=>Os(M,k,G,H,me,Fe),U=(k,G,H,me,Fe="none",Qe=!1)=>Gs(h,B,k,G,H,me,Fe,Qe),q=(k,G,H,me,Fe=!1,Qe=!0)=>js(P,B,k,G,H,me,Fe,Qe),se=(k,G,H)=>Ks({db:e,index:b,pendingRelations:O,addFile:B,addSymbol:U,addSourceConstruct:q,observation:k,depth:G,origin:H}),{omittedSymbolCandidates:Ne,broadLiteralAnchors:Oe,withheldLiteralMatches:ve}=qs({db:e,index:b,searches:o,symbolQueries:i,opts:t,boundaryObservationLocations:N,sourceAllowed:m,addFile:B,addSymbol:U,addSourceConstruct:q,literalHits:D,anchors:T}),E={db:e,index:b,relationPolicy:s,evidenceFloor:c,sourceAllowed:m,fileGraph:C,reverseFileGraph:S,workspaces:v,runtimeBoundaries:R,boundaryObservations:y,boundaryObservationDepths:x,representedBoundaryLinkIds:L,files:M,symbols:h,sourceConstructs:P,pendingRelations:O,externalImports:w,reverseExpandedSourceConstructs:_,serviceCallerFilesBySourceConstruct:A,traversalMetrics:I,memberCallTargetsForWholeFile:$,addFile:B,addSymbol:U,addSourceConstruct:q,addBoundaryObservation:se};for(let k=0;k<p;k+=1)Us(E,k),Ws(E,k),Hs(E,k),Vs(E,k);return zs({db:e,opts:t,mode:n,searches:o,symbolQueries:i,maxDepth:p,maxTopologyCharacters:g,requestedRelationKinds:a,evidenceFloor:c,includedSourceScopes:d,workspaces:v,runtimeBoundaries:R,boundaryObservations:y,representedBoundaryLinkIds:L,files:M,symbols:h,sourceConstructs:P,literalHits:D,pendingRelations:O,externalImports:w,anchors:T,omittedSymbolCandidates:Ne,broadLiteralAnchors:Oe,withheldLiteralMatches:ve,filteredUnverifiedCallEdges:I.filteredUnverifiedCallEdges,memberCallCandidateEdges:I.memberCallCandidateEdges,unresolvedMemberCallsites:I.unresolvedMemberCallsites,sourceAllowed:m})}function Ys(e,t,n,o){let i=new Map,a=c=>{i.set(`${c.file}\0${c.line}`,c)};for(let c of o)a(c);let r=new Set(t.anchors.filter(c=>c.status==="matched").flatMap(c=>c.nodeIds));for(let c of n.steps)if(!(!c.location||!r.has(c.nodeId)||(c.behavior?.rawCharacters??1/0)>3e3))for(let d of c.behavior?.lines??[])d.signals.some(l=>_s.has(l))&&a({file:c.location.file,line:d.line,endLine:d.endLine});let s=t.edges.filter(c=>c.disposition==="emitted").flatMap(c=>c.evidence.flatMap(d=>d.location?[d.location]:[]));for(let c of s){a(c);let d=t.nodes.filter(u=>u.location?.file===c.file&&["symbol","source-construct","runtime-boundary-participant"].includes(u.kind)&&u.location.line<=c.line&&(u.location.endLine??u.location.line)>=c.line).sort((u,f)=>(u.location.endLine??u.location.line)-u.location.line-((f.location.endLine??f.location.line)-f.location.line)||u.id.localeCompare(f.id))[0];if(!d?.location)continue;let l=ht(e,c.file,d.location.line,d.location.endLine??d.location.line,[c.line]);for(let u of l)a({file:c.file,line:u.line,endLine:u.endLine})}return[...i.values()].sort((c,d)=>c.file.localeCompare(d.file)||c.line-d.line)}function Xs(e){if(e.ownerStartLine===null||e.ownerStartLine===void 0)throw new Error(`Literal hit ${e.file}:${e.line+1} has no source-owner start line.`);if(e.ownerEndLine===null||e.ownerEndLine===void 0)throw new Error(`Literal hit ${e.file}:${e.line+1} has no source-owner end line.`);return{file:e.file,name:e.ownerShortName??`${e.file}:${e.ownerStartLine+1}`,startLine:e.ownerStartLine,endLine:e.ownerEndLine}}function Se(e){return`${e.file}\0${e.startLine}\0${e.endLine}\0${e.name}`}function ae(e){return{file:e.file,name:e.name,startLine:e.startLine,endLine:e.endLine}}function vr(e,t,n,o){if(n.calleeLeaf===o.leaf)return!0;let i=Dn(e,t,n.calleeLeaf);return i!==null&&i.importedName===o.leaf&&i.sourcePath!==null&&Pe(i.sourcePath,o.relativePath)}function Bt(e,t){let n=pt(oe(e,t.file)?.callables??[],t.startLine);if(n&&n.endLine>=t.endLine)return{file:t.file,name:/^source@\d+$/u.test(n.name)&&!/^source@\d+$/u.test(t.name)?t.name:n.name,startLine:n.startLine,endLine:n.endLine};let o=Fr(e,t.file,t.startLine);return o&&o.endLine>=t.endLine?{file:t.file,name:o.name,startLine:o.startLine,endLine:o.endLine}:ae(t)}function He(e){return ue("source-construct",e.file,String(e.startLine),String(e.endLine),e.name)}function Ot(e,t){let n=Wn(e,t.symbol,t.relativePath),o=new Set(["package-surface-file","transitive-package-surface"]),i=n.filter(r=>!o.has(r)||Qn(e,t)),a=i.some(r=>!o.has(r));return{evidence:i,priority:a||Hn(e,t.symbol,t.relativePath)?2:1}}function xr(e,t){let n=Ot(e,t);return n.evidence.length>0?n.priority:0}function Zs(e,t){let n=X(e,t.file),o=n.filter(i=>i.startLine<=t.startLine&&i.endLine>=t.startLine).sort((i,a)=>i.endLine-i.startLine-(a.endLine-a.startLine)||i.startLine-a.startLine);for(let i of o){let a=Ot(e,i);if(a.evidence.length>0)return a}for(let i of Js(e,t.file,t.startLine)){let a=n.filter(r=>r.leaf===i.name).sort((r,s)=>Math.abs(r.startLine-i.startLine)-Math.abs(s.startLine-i.startLine)||r.symbol.localeCompare(s.symbol));for(let r of a){let s=Ot(e,r);if(s.evidence.length>0)return s}return{evidence:[],priority:0}}return{evidence:[],priority:0}}function Js(e,t,n){let o=Y(e,t)?.rootNode;if(!o||o.startPosition.row>n||o.endPosition.row<n)return[];let i=[],a=In(o,n);for(;a;){if(a.type==="variable_declarator"||a.type==="function_declaration"||a.type==="generator_function_declaration"||a.type==="class_declaration"){let r=a.childForFieldName("name")??a.namedChild(0);(r?.type==="identifier"||r?.type==="type_identifier")&&i.push({name:r.text,startLine:a.startPosition.row})}a=a.parent}return i}function el(e){return[...new Map([...e.sourceConstructStates.values()].map(t=>Bt(e.db,t)).map(t=>[Se(t),t])).values()].sort((t,n)=>t.file.localeCompare(n.file)||t.startLine-n.startLine||t.endLine-n.endLine)}function tl(e,t){return e.anchors.map((n,o)=>{let i=ue("anchor",String(o),n.kind,n.query),a=[...e.symbolStates.values()].filter(l=>l.anchorQueries.has(n.query)).flatMap(l=>{if(!re(l.definition.symbol))return[Re(l.definition.symbol)];let u=t.filter(f=>f.file===l.definition.relativePath).map(f=>He(f));return u.length>0?u:[Re(l.definition.symbol)]}),r=[...e.sourceConstructStates.values()].filter(l=>l.anchorQueries.has(n.query)).map(l=>He(Bt(e.db,l))),s=e.literalHits.filter(l=>l.query===n.query&&l.traversalSeed===!0&&l.ownerSymbol&&e.symbolStates.has(l.ownerSymbol)).map(l=>Re(l.ownerSymbol)),c=e.literalHits.filter(l=>l.query===n.query&&l.traversalSeed===!0&&!l.ownerSymbol&&l.ownerStartLine!==null&&l.ownerStartLine!==void 0&&l.ownerEndLine!==null&&l.ownerEndLine!==void 0).map(l=>He(Bt(e.db,Xs(l)))),d=z(n.kind==="symbol"?[...a,...r]:s.length+c.length>0?[...s,...c]:n.seedRegionIds??[]);return{id:i,kind:n.kind,query:n.query,status:n.status,nodeIds:n.status==="ambiguous"?[]:d,candidateNodeIds:n.status==="ambiguous"?d:[],omittedCandidates:n.omittedSymbolCandidates??0}})}function nl(e){let t=new Map;for(let n of e)for(let o of[...n.nodeIds,...n.candidateNodeIds]){let i=t.get(o)??[];i.push(n.id),t.set(o,i)}return t}function ol(e,t,n){let o=e.relations.flatMap(r=>[r.fromBoundaryParticipant,r.toBoundaryParticipant].flatMap(s=>s?.ownerName?[s]:[])),i=e.regions.map(r=>({id:r.id,kind:"structural-region",label:r.label,disposition:"folded",location:null,anchorIds:z(n.get(r.id)??[]),attributes:{workspace:r.workspace,structuralPath:r.structuralPath,minimumDepth:r.minDepth,files:r.fileCount,symbols:r.symbolCount,expanded:r.expanded}}));for(let r of e.symbolStates.values()){let s=e.regionForFile.get(r.definition.relativePath)?.id;if(!s)throw new Error(`System-map symbol ${r.definition.symbol} has no structural region.`);let c=Re(r.definition.symbol),d=Ot(e.db,r.definition);i.push({id:c,kind:"symbol",label:J(r.definition.symbol),disposition:(n.get(c)?.length??0)>0?"emitted":"folded",location:{file:r.definition.relativePath,line:r.definition.startLine,endLine:r.definition.endLine},anchorIds:z(n.get(c)??[]),attributes:{regionId:s,depth:r.depth,leaf:r.definition.leaf??J(r.definition.symbol),referenceScope:r.referenceScope,...d.evidence.length>0?{publicEntry:!0,publicEntryPriority:d.priority,publicEntryEvidence:d.evidence.join(",")}:{}}})}for(let r of t){let s=e.regionForFile.get(r.file)?.id;if(!s)throw new Error(`Source construct ${r.name} has no structural region.`);let c=He(r),l=o.find(f=>f.file===r.file&&f.line>=r.startLine&&f.line<=r.endLine)?.ownerName??r.name,u=Zs(e.db,r);i.push({id:c,kind:"source-construct",label:l,disposition:(n.get(c)?.length??0)>0?"emitted":"folded",location:{file:r.file,line:r.startLine,endLine:r.endLine},anchorIds:z(n.get(c)??[]),attributes:{regionId:s,leaf:l,sourceOwned:!0,...u.evidence.length>0?{publicEntry:!0,publicEntryPriority:u.priority,publicEntryEvidence:u.evidence.join(",")}:{}}})}let a=new Map;for(let r of e.relations)r.fromBoundaryParticipant&&a.set(r.fromBoundaryParticipant.observationId,r.fromBoundaryParticipant),r.toBoundaryParticipant&&a.set(r.toBoundaryParticipant.observationId,r.toBoundaryParticipant);for(let r of[...a.values()].sort((s,c)=>s.observationId.localeCompare(c.observationId))){let s=e.regionForFile.get(r.file)?.id;if(!s)throw new Error(`Runtime-boundary participant ${r.observationId} has no structural region.`);i.push({id:wn(r.observationId),kind:"runtime-boundary-participant",label:r.address||r.ownerName||`${r.role} ${r.action}`,disposition:"folded",location:{file:r.file,line:r.line,endLine:r.endLine},anchorIds:[],attributes:{regionId:s,action:r.action,protocol:r.protocol,role:r.role,...r.address?{address:r.address}:{},ownerSymbol:r.ownerSymbol}})}return i}function rl(e,t,n,o,i,a,r,s,c,d=!1){let l=o?Re(o):null;if(l&&t.has(l)&&!re(o))return l;let u=i?wn(i.observationId):null;if(d&&u&&t.has(u))return u;let f=a?He(Bt(e,a)):null;if(f&&t.has(f))return f;if(u&&t.has(u))return u;let m=c===null?null:(n.get(s)??[]).filter(p=>p.startLine<=c&&p.endLine>=c).sort((p,g)=>p.endLine-p.startLine-(g.endLine-g.startLine)||p.startLine-g.startLine)[0]??null;return m?He(m):l&&t.has(l)?l:r}function il(e,t,n){let o=new Set(t.map(d=>d.id)),i=ye(n,d=>d.file),a=(d,l,u,f,m,p,g=!1)=>rl(e.db,o,i,d,l,u,f,m,p,g),r=[];for(let d of e.symbolStates.values()){let l=e.regionForFile.get(d.definition.relativePath)?.id;if(!l)continue;let u=Re(d.definition.symbol);r.push({id:ue("edge","structural-membership",l,u),kind:"structural-membership",fromNodeId:l,toNodeId:u,directed:!0,disposition:"folded",semantics:It("structural-membership"),evidence:[{method:"indexed-definition-file",strength:"exact",identity:d.definition.symbol,location:{file:d.definition.relativePath,line:d.definition.startLine,endLine:d.definition.endLine}}]})}let s=ye(e.relations,d=>`${a(d.fromSymbol,d.fromBoundaryParticipant,d.fromSourceConstruct,d.fromRegionId,d.fromFile,d.line,d.kind==="runtime-boundary")}\0${a(d.toSymbol,d.toBoundaryParticipant,d.toSourceConstruct,d.toRegionId,d.toFile,null)}\0${d.kind}`),c=new Set;for(let d of s.values()){let l=d[0],u=a(l.fromSymbol,l.fromBoundaryParticipant,l.fromSourceConstruct,l.fromRegionId,l.fromFile,l.line,l.kind==="runtime-boundary"),f=a(l.toSymbol,l.toBoundaryParticipant,l.toSourceConstruct,l.toRegionId,l.toFile,null);if(l.kind==="runtime-boundary"&&l.fromBoundaryParticipant){let p=wn(l.fromBoundaryParticipant.observationId),g=a(l.fromSymbol,void 0,l.fromSourceConstruct,l.fromRegionId,l.fromFile,l.line);g!==p&&!c.has(p)&&(c.add(p),r.push({id:ue("edge","boundary-observation",g,p),kind:"boundary-observation",fromNodeId:g,toNodeId:p,directed:!0,disposition:"folded",semantics:It("boundary-observation"),evidence:[{method:"runtime-boundary-observation-owner",strength:l.strength??"unknown",identity:l.fromBoundaryParticipant.observationId,location:{file:l.fromBoundaryParticipant.file,line:l.fromBoundaryParticipant.line,endLine:l.fromBoundaryParticipant.endLine}}]}))}(u===f?t.find(p=>p.id===u):null)?.kind!=="structural-region"&&r.push({id:ue("edge",l.kind,u,f),kind:l.kind,fromNodeId:u,toNodeId:f,directed:!0,disposition:"folded",semantics:No(l),evidence:fl(d.map(p=>({method:p.evidence,strength:p.strength??"unknown",identity:p.kind==="runtime-boundary"&&p.runtimeBoundaryKey?p.runtimeBoundaryKey:`${p.fromSymbol??p.fromFile} -> ${p.toSymbol??p.toFile}`,location:p.line===null?null:{file:p.fromFile,line:p.line}})))})}return r}function al(e,t,n){for(let i of e.externalBoundaries){let a=ue("external",i.kind,i.name),r=z(i.fromRegionIds);t.push({id:a,kind:i.kind,label:i.name,disposition:"folded",location:null,anchorIds:[],attributes:{}});for(let s of r)n.push({id:ue("edge",i.kind,s,a),kind:i.kind,fromNodeId:s,toNodeId:a,directed:!0,disposition:"folded",semantics:It("external-import"),evidence:[{method:"indexed-or-source-import",strength:"mixed",identity:`${s} -> ${i.name}`,location:null}]})}let o=[];return e.boundaryFrontiers.forEach((i,a)=>{let r=e.regionForFile.get(i.file)?.id;if(!r)throw new Error(`Runtime-boundary frontier ${i.observationId} has no system-map region.`);let s=ue("unsupported","runtime-boundary",i.observationId,String(a)),c=ue("edge","runtime-boundary-frontier",r,s);t.push({id:s,kind:"runtime-boundary-frontier",label:i.address,disposition:"unsupported",location:{file:i.file,line:i.line},anchorIds:[],attributes:{action:i.action,strength:i.strength,owner:i.ownerShortName}}),n.push({id:c,kind:"runtime-boundary-frontier",fromNodeId:r,toNodeId:s,directed:!0,disposition:"unsupported",evidence:[{method:"runtime-boundary-extractor",strength:i.strength,identity:i.observationId,location:{file:i.file,line:i.line}}]}),o.push({id:ue("frontier","runtime-boundary",i.observationId,String(a)),kind:"runtime-boundary",direction:"unresolved",fromNodeIds:[r],edgeIds:[c],memberNodeIds:[s],memberCount:1,disposition:"unsupported",reason:i.reason,expansion:null})}),o}function sl(e,t){let n=t.topologyFrontiers.some(p=>p==="frontier:program-facts"),o=gr(e,{expandedFrontierIds:t.topologyFrontiers.filter(p=>p!=="frontier:program-facts"),routeIds:t.routeIds}),i=o.nodes.filter(p=>p.disposition==="emitted"||o.anchors.some(g=>g.status==="matched"&&g.nodeIds.includes(p.id))),a=t.relations.filter(p=>i.some(g=>cl(p,g))),r=t.boundaryFrontiers.filter(p=>i.some(g=>dl(p,g))),s=_o(t.db,a,i),c=Oo(t.db,i),d=Xo(t.db,i,r),l=[...s.nodes,...c.nodes,...d.nodes].map(p=>n&&p.disposition==="folded"?{...p,disposition:"emitted"}:p),u=[...s.edges,...c.edges,...d.edges].map(p=>n&&p.disposition==="folded"?{...p,disposition:"emitted"}:p),f=n?null:ul(i,l,u),m=Dt({anchors:o.anchors,nodes:[...o.nodes,...l],edges:[...o.edges,...u],paths:o.paths,frontiers:[...o.frontiers,...s.frontiers,...c.frontiers,...d.frontiers,...f?[f]:[]],scope:o.coverage.scope,blindSpots:[...o.coverage.blindSpots,...s.blindSpots,...c.blindSpots,...d.blindSpots],incompleteReasons:o.coverage.status==="incomplete"?[o.coverage.explanation]:[],...o.routeCatalog?{routeCatalog:o.routeCatalog}:{}});m.completion=o.completion;for(let p of m.frontiers)p.disposition==="folded"&&(p.id.startsWith("frontier:program-facts:")||(p.expansion=pl(t,p.id)));return m}function ll(e){let t=el(e),n=tl(e,t),o=ol(e,t,nl(n)),i=il(e,o,t),a=al(e,o,i);return sl(Dt({anchors:n,nodes:o,edges:i,paths:[],frontiers:a,scope:`explicit anchors; relations ${e.requestedRelationKinds.join(", ")}; depth ${e.maxDepth}; evidence floor ${e.evidenceFloor}; source scopes ${e.includedSourceScopes.join(", ")}`,blindSpots:[...e.blindSpots],incompleteReasons:e.closureStatus==="incomplete"?[`${e.omittedSymbolCandidates} ambiguous symbol candidate(s) were omitted`]:[]}),e)}function cl(e,t){if(e.fromSymbol&&t.id===Re(e.fromSymbol)||e.toSymbol&&t.id===Re(e.toSymbol))return!0;if(!t.location)return!1;let n=t.location.endLine??t.location.line;return t.location.file===e.fromFile&&e.line!==null&&e.line>=t.location.line&&e.line<=n||t.location.file===e.toFile}function dl(e,t){if(!t.location||t.location.file!==e.file)return!1;let n=t.location.endLine??t.location.line;return e.line>=t.location.line&&e.line<=n||t.label===e.ownerShortName||typeof e.ownerShortName=="string"&&t.label.includes(e.ownerShortName)}function ul(e,t,n){let o=z(t.filter(a=>a.disposition==="folded").map(a=>a.id)),i=z(n.filter(a=>a.disposition==="folded").map(a=>a.id));return o.length===0&&i.length===0?null:{id:ue("frontier","program-facts"),kind:"program-facts",direction:"outgoing",fromNodeIds:z(e.map(a=>a.id)),edgeIds:i,memberNodeIds:o,memberCount:o.length,disposition:"folded",reason:"Control, data, state, and temporal facts are folded beneath the selected high-level owners.",expansion:null}}function pl(e,t){return`scip-query system-map ${[...e.anchors.flatMap(o=>o.kind==="literal"?[`--search ${V(o.query)}`]:[`--symbol ${V(o.query)}`]),`--depth ${e.maxDepth}`,...e.requestedRelationKinds.map(o=>`--relation ${V(o)}`),`--evidence-floor ${V(e.evidenceFloor)}`,...e.includedSourceScopes.map(o=>`--source-scope ${V(o)}`),...e.fullLiteralTraversal?["--full-literal-traversal"]:[],`--topology-characters ${e.maxTopologyCharacters}`,...e.expandedRegionIds.map(o=>`--expand ${V(o)}`),...e.topologyFrontiers.map(o=>`--frontier ${V(o)}`),...e.routeIds.map(o=>`--route ${V(o)}`),`--frontier ${V(t)}`].join(" ")}`}function ml(e){let t=new Set;for(let n of e.nodes){if(n.disposition!=="emitted")continue;n.kind==="structural-region"&&t.add(n.id);let o=n.attributes.regionId;typeof o=="string"&&t.add(o)}return t}function fl(e){let t=new Map;for(let n of e){let o=n.location?`${n.location.file}:${n.location.line}`:"";t.set(`${n.method}\0${n.strength}\0${n.identity??""}\0${o}`,n)}return[...t.values()].sort((n,o)=>n.method.localeCompare(o.method)||(n.identity??"").localeCompare(o.identity??"")||(n.location?.file??"").localeCompare(o.location?.file??"")||(n.location?.line??0)-(o.location?.line??0))}function ue(...e){return e.map(t=>encodeURIComponent(t)).join(":")}function Re(e){return ue("symbol",e)}function gl(e){return e==="semantic-callee"||e==="scip-chunk"||e==="scip-occurrence"?"exact":"derived"}function yl(e,t,n,o,i,a,r,s,c,d){let l=[...o].sort((g,b)=>Tr(g,b,i)),f=l.slice(0,hr).map(g=>g.id),m=l.slice(hr).map(g=>g.id),p=[...e.map(g=>`--search ${V(g)}`),...t.map(g=>`--symbol ${V(g)}`),`--depth ${n}`,...a.map(g=>`--relation ${V(g)}`),`--evidence-floor ${V(r)}`,...s.map(g=>`--source-scope ${V(g)}`),...c?["--full-literal-traversal"]:[],`--topology-characters ${d}`,...f.map(g=>`--expand ${V(g)}`)];return{command:f.length===0?null:`scip-query system-map ${p.join(" ")}`,regionCount:f.length,regionIds:f,candidateRegionCount:o.length,omittedRegionIds:m}}function hl(e,t,n,o,i,a,r,s,c,d,l,u,f){let m=[...c].sort((h,P)=>Tr(h,P,l)).filter(h=>!f||f.has(h.id)||u.has(h.id)),p=d.length>0?Math.floor(s*.4):0,g=s-p,b=new Set,C=0;for(let h of m){let P=Er(h);!u.has(h.id)&&b.size>0&&C+P>g||(b.add(h.id),C+=P)}let S=d.filter(h=>b.has(h.fromRegionId)&&b.has(h.toRegionId)).sort(bl),v=[];for(let h of S){let P=Cr(h);v.length>0&&C+P>s||(v.push(Gt(h)),C+=P)}let R=c.filter(h=>!b.has(h.id)).map(h=>h.id).sort(),y=new Set(v),N=d.filter(h=>!y.has(Gt(h))).length,L=c.reduce((h,P)=>h+Er(P),0)+d.reduce((h,P)=>h+Cr(P),0),x=m.every(h=>b.has(h.id))&&v.length===S.length,M=[...e.map(h=>`--search ${V(h)}`),...t.map(h=>`--symbol ${V(h)}`),`--depth ${n}`,...o.map(h=>`--relation ${V(h)}`),`--evidence-floor ${V(i)}`,...a.map(h=>`--source-scope ${V(h)}`),...r?["--full-literal-traversal"]:[],`--topology-characters ${Math.max(s,L)}`];return{maxCharacters:s,estimatedCharacters:C,totalEstimatedCharacters:L,regionIds:[...b],omittedRegionIds:R,relationKeys:v,omittedRelations:N,complete:x,expansionCommand:x?null:`scip-query system-map ${M.join(" ")}`}}function Er(e){return 120+e.id.length+e.anchorQueries.join(",").length+e.relationKinds.join(",").length+e.notableSymbols.slice(0,2).reduce((t,n)=>t+n.shortName.length+n.file.length,0)}function Cr(e){return 70+e.fromRegionId.length+e.toRegionId.length+e.kinds.join(",").length+e.evidence.join(",").length}function bl(e,t){let n=o=>o.kinds.includes("runtime-boundary")?0:o.kinds.includes("contract-symbol")?1:2;return n(e)-n(t)||t.relationCount-e.relationCount||Gt(e).localeCompare(Gt(t))}function Gt(e){return`${e.fromRegionId}\0${e.toRegionId}`}function Tr(e,t,n){let o=s=>n.has(s.id)?0:1,i=s=>s.sourceFileCount===0?1:0,a=s=>s.symbolCount+s.literalHitCount>0?0:1,r=s=>[...s.incomingRegionIds,...s.outgoingRegionIds].filter(c=>n.has(c)).length;return o(e)-o(t)||a(e)-a(t)||i(e)-i(t)||e.minDepth-t.minDepth||r(t)-r(e)||t.literalHitCount-e.literalHitCount||e.testFileCount-t.testFileCount||e.label.localeCompare(t.label)}function Sl(e){let t=[],n=new Set;for(let i of e.filter(a=>a.expanded)){for(let c of i.symbols)c.origins.includes("symbol-anchor")&&n.add(c.file);let a=ye(i.symbols,c=>c.file),r=ye(i.literalHits,c=>c.file),s=[...i.files].sort((c,d)=>xl(c,d,a,r));for(let c of s){let d=(a.get(c.file)??[]).sort(Zn)[0];if(d){t.push({kind:"symbol",regionId:i.id,file:d.file,line:d.startLine,endLine:d.endLine,label:d.shortName});continue}let l=(r.get(c.file)??[]).sort(kr)[0];l&&t.push({kind:"literal",regionId:i.id,file:l.file,line:l.line,endLine:null,label:l.ownerShortName??l.query})}}let o=vl(t,n);return{command:o.length===0?null:`scip-query inspect ${o.map(i=>`--at ${V(`${i.file}:${i.line+1}`)}`).join(" ")} --view behavior`,definitionCommand:null,candidateAnchors:t.length,selectedAnchors:o.length,omittedAnchors:t.length-o.length,anchors:o}}function vl(e,t){let n=[...ye(e,r=>r.regionId).values()],o=[],i=new Set,a=Math.min($s,24);for(let r of e)if(!(!t.has(r.file)||i.has(r.file))&&(o.push(r),i.add(r.file),o.length===a))return o;for(let r=0;o.length<a;r+=1){let s=!1;for(let c of n){let d=c[r];if(d&&(s=!0,!i.has(d.file)&&(o.push(d),i.add(d.file),o.length===a)))break}if(!s)break}return o}function xl(e,t,n,o){let i=s=>s.kind==="test"?2:s.kind==="barrel"?1:0,a=s=>(o.get(s.file)??[]).some(c=>c.traversalSeed)?0:1,r=s=>{let c=n.get(s.file)??[];return Math.min(5,...c.map(d=>Ke(d.origins)))};return i(e)-i(t)||a(e)-a(t)||r(e)-r(t)||e.depth-t.depth||e.file.localeCompare(t.file)}function V(e){return`'${e.replaceAll("'","'\\''")}'`}function El(e,t,n,o){let i=[];for(let a of kn(e,{includeIgnored:!1})){let r=le(e,a);if(r.length===0)continue;let s=[];for(let l=0;l<r.length;l+=1){let u=r[l]??"";u.includes(n)&&s.push({line:l,sourceLine:u})}if(s.length===0)continue;let c=t.definitionsForFile(a),d=oe(e,a)?.callables??[];for(let{line:l,sourceLine:u}of s){let f=Ge(c,l),m=pt(d,l),p=f&&!re(f.symbol)?f:null,g=p?.startLine??m?.startLine??f?.startLine??l,b=p?.endLine??m?.endLine??f?.endLine??l,C=Xt(e,a,l,g,b),S=o.has(`${a}\0${l}`),v=!!(p?.isFunctionLike||m);i.push({relativePath:a,line:l,sourceLine:u,ownerSymbol:p?.symbol??null,ownerShortName:p?J(p.symbol):m?.name??(f?J(f.symbol):null),ownerStartLine:C.startLine,ownerEndLine:C.endLine,matchKind:wl(u,n),seedPriority:S?0:v?1:2})}}return i}function Cl(e,t){let n={"exact-value":0,boundary:1,embedded:2};return e.seedPriority-t.seedPriority||n[e.matchKind]-n[t.matchKind]||e.relativePath.localeCompare(t.relativePath)||e.line-t.line}function Lr(e){return`${e.relativePath}\0${e.line}`}function En(e,t,n){let i=pt(oe(e,t)?.callables??[],n)??Fr(e,t,n);if(!i)return null;let a=Xt(e,t,n,i.startLine,i.endLine);return{file:t,name:i.name,startLine:a.startLine,endLine:a.endLine}}function Fr(e,t,n){let o=Y(e,t)?.rootNode;if(!o||o.startPosition.row>n||o.endPosition.row<n)return null;let i=In(o,n);for(;i;){if(i.type==="variable_declarator"){let r=i.childForFieldName("name")??i.namedChild(0),s=i.childForFieldName("value")??i.namedChild(1);if(r?.type==="identifier"&&s&&Cn(s,n))return{name:r.text,startLine:i.startPosition.row,endLine:i.endPosition.row}}if(i.type==="pair"){let r=i.childForFieldName("key")??i.namedChild(0),s=i.childForFieldName("value")??i.namedChild(1),c=r?.text.replace(/^(?:['"])(.*)(?:['"])$/u,"$1");if(c&&s&&/^[A-Za-z_$][\w$]*$/u.test(c)&&Cn(s,n))return{name:c,startLine:i.startPosition.row,endLine:i.endPosition.row}}i=i.parent}let a=Yt(e,t,n);return a?{name:`source@${n+1}`,startLine:a.startLine,endLine:a.endLine}:null}function Cn(e,t){return["arrow_function","function_expression","generator_function","generator_function_declaration"].includes(e.type)&&e.startPosition.row<=t&&e.endPosition.row>=t?!0:e.namedChildren.some(n=>n.startPosition.row<=t&&n.endPosition.row>=t&&Cn(n,t))}function In(e,t){let n=e.namedChildren.filter(o=>o.startPosition.row<=t&&o.endPosition.row>=t).sort((o,i)=>o.endIndex-o.startIndex-(i.endIndex-i.startIndex)||o.startPosition.row-i.startPosition.row)[0];return n?In(n,t):e}function Ll(e,t){let n=t.match(/^(.+):(\d+)(?:-(\d+))?$/u);if(!n)return null;let o=$n(e,n[1],{allowMultiple:!1})[0]?.relativePath;if(!o)return null;let i=Math.max(0,Number.parseInt(n[2],10)-1),a=n[3]?Math.max(i,Number.parseInt(n[3],10)-1):i,r=(oe(e,o)?.callables??[]).filter(s=>s.startLine<=i&&s.endLine>=a).sort((s,c)=>s.endLine-s.startLine-(c.endLine-c.startLine)||s.startLine-c.startLine)[0];return r?{file:o,name:r.name,startLine:r.startLine,endLine:r.endLine}:null}function Il(e){return{symbol:`source-construct:${e.file}:${e.startLine}:${e.endLine}:${e.name}`,shortName:e.name,relativePath:e.file,startLine:e.startLine,endLine:e.endLine}}function wl(e,t){let n=/[\p{L}\p{N}_$]/u,o=e.indexOf(t);for(;o>=0;){let i=e[o-1]??"",a=e[o+t.length]??"";if((i==="'"||i==='"'||i==="`")&&a===i)return"exact-value";if(!n.test(i)&&!n.test(a))return"boundary";o=e.indexOf(t,o+Math.max(1,t.length))}return"embedded"}function Ln(e){return mt(e)==="test"?!1:!/(?:^|[/._-])(?:fixtures?|mocks?|previews?|demos?|examples?|stories)(?:[/._-]|$)/iu.test(e)}function Nl(e,t){return e.matchKind!=="embedded"&&t(e.relativePath)&&(Ut(e.relativePath)!=="production"||Ln(e.relativePath))}function Ml(e,t){let n=[...t].sort(Rl),o=[],i=new Set;for(let a of n)if(!i.has(a.relativePath)&&(o.push(a),i.add(a.relativePath),o.length>=yr))break;for(let a of n){if(o.length>=yr)break;o.includes(a)||o.push(a)}return o.map(a=>({query:e,file:a.relativePath,line:a.line,ownerSymbol:a.ownerSymbol,ownerShortName:a.ownerShortName,ownerStartLine:a.ownerStartLine,ownerEndLine:a.ownerEndLine,sourceLine:a.sourceLine.trim(),matchKind:a.matchKind,traversalSeed:!1}))}function Rl(e,t){let n={"exact-value":0,boundary:1,embedded:2};return n[e.matchKind]-n[t.matchKind]||+(t.ownerSymbol!==null)-+(e.ownerSymbol!==null)||+!Ln(e.relativePath)-+!Ln(t.relativePath)||e.relativePath.localeCompare(t.relativePath)||e.line-t.line}function Tl(e,t){let n=new Map;for(let o of t){let i=Fl(o.relativePath);n.set(i,(n.get(i)??0)+1)}return[...n].sort(([o,i],[a,r])=>r-i||o.localeCompare(a)).slice(0,As).map(([o])=>`scip-query search ${V(e)} --scope ${V(o)}`)}function Fl(e){let t=e.split("/").filter(Boolean);if(t.length<=1)return e;let n=t.slice(0,-1),o=n.lastIndexOf("src");return o>=0?n.slice(0,Math.min(n.length,o+3)).join("/"):n.slice(0,Math.min(n.length,3)).join("/")}function Pl(e,t,n){let o=t.callerFileMap([n],{semantic:!1}).get(n.symbolId)??new Set,i=[];for(let a of[...o].sort()){let r=xe(e,a).filter(l=>l.importedName===n.leaf&&l.sourcePath!==null&&Pe(l.sourcePath,n.relativePath)),s=new Set;if(r.length>0)for(let l of r)s.add(l.localName??l.importedName);else n.leaf&&s.add(n.leaf);let c=[...new Set([...s].flatMap(l=>Ee(e,a,l)))].sort((l,u)=>l-u);if(c.length===0){i.push({file:a,line:null,enclosingSymbol:null});continue}let d=t.definitionsForFile(a);for(let l of c)i.push({file:a,line:l,enclosingSymbol:Ge(d,l)?.symbol??null})}return i}function Al(e,t){let n=e.all(`SELECT DISTINCT gs.symbol, def_d.relative_path AS from_file
|
|
7
|
-
FROM mentions m
|
|
8
|
-
JOIN chunks c ON m.chunk_id = c.id
|
|
9
|
-
JOIN documents imp_d ON c.document_id = imp_d.id
|
|
10
|
-
JOIN global_symbols gs ON m.symbol_id = gs.id
|
|
11
|
-
LEFT JOIN (
|
|
12
|
-
SELECT m2.symbol_id, c2.document_id
|
|
13
|
-
FROM mentions m2
|
|
14
|
-
JOIN chunks c2 ON m2.chunk_id = c2.id
|
|
15
|
-
WHERE m2.role = 1
|
|
16
|
-
GROUP BY m2.symbol_id
|
|
17
|
-
) sym_def ON sym_def.symbol_id = gs.id
|
|
18
|
-
LEFT JOIN documents def_d ON sym_def.document_id = def_d.id
|
|
19
|
-
WHERE imp_d.relative_path = ? AND m.role = 2
|
|
20
|
-
ORDER BY def_d.relative_path, gs.symbol`,t);return n.length>0?n.map(o=>({symbol:o.symbol,shortName:J(o.symbol),importedName:Ir(J(o.symbol)),localName:Ir(J(o.symbol)),fromFile:o.from_file,source:"compiler"})):xe(e,t).map(o=>{let i=kl(o.importedName,o.localName,o.kind),a=o.localName??o.importedName,r=o.importedName==="default"?a:o.importedName;return{symbol:i,shortName:i,importedName:r,localName:a,fromFile:o.sourcePath,source:"parsed-source"}})}function Ir(e){return e.slice(e.lastIndexOf(":")+1).replace(/\(\)$/u,"")||e}function kl(e,t,n){return n==="namespace"&&e==="*"&&t?`* as ${t}`:n==="default"&&t?`default as ${t}`:n==="side-effect"?"(side effect import)":t&&t!==e?`${e} as ${t}`:e}function Te(e,t,n){let o=Wt(e,n);if(!o.match)return{matches:[],total:0,omitted:0};let i=[o.match,...o.candidates.map(r=>Wt(e,r.symbol).match)].filter(r=>r!==null),a=new Map;for(let r of i){let s=t.definitionsForFile(r.relativePath).find(c=>c.symbol===r.symbol);s&&a.set(s.symbol,s)}return{matches:[...a.values()],total:o.total,omitted:Math.max(0,o.total-a.size)}}function $l(e){return{symbol:e.symbol,shortName:J(e.symbol),relativePath:e.relativePath,startLine:e.startLine,endLine:e.endLine}}function pe(e,t){let n=[t.kind,t.fromFile,t.fromSymbol??"",t.toFile,t.toSymbol??"",t.fromBoundaryParticipant?.observationId??"",t.toBoundaryParticipant?.observationId??"",t.fromSourceConstruct?Se(t.fromSourceConstruct):"",t.toSourceConstruct?Se(t.toSourceConstruct):"",t.runtimeBoundaryKey??"",t.line??""].join("\0");e.set(n,t)}function Ve(e){return{observationId:e.id,action:e.action,protocol:e.protocol,role:e.role,address:Pr(e),file:e.source.file,line:e.source.startLine,endLine:e.source.endLine,ownerName:e.owner.name,ownerSymbol:e.owner.symbol}}function _t(e,t){let n=le(e,t.source.file);return Ye(e,t.source.file,0,Math.max(0,n.length-1),[t.source.startLine])}function wr(e,t){let n=[...e.values()];for(let o of[t.owner,t.source]){let i=n.filter(a=>a.file===o.file&&a.startLine<=o.startLine&&a.endLine>=o.startLine).sort((a,r)=>a.endLine-a.startLine-(r.endLine-r.startLine)||a.startLine-r.startLine)[0];if(i)return i}return null}function Nr(e,t,n,o,i){let a=[],r=n.get(e.id);r!==void 0&&r<=t&&a.push(r);for(let s of o.values()){if(s.depth>t)continue;let c=s.definition;Mr(c,e)&&a.push(s.depth)}for(let s of i.values())s.depth>t||Mr(s,e)&&a.push(s.depth);return a.length>0?Math.min(...a):null}function Mr(e,t){let n=e.relativePath??e.file;return[t.owner,t.source].some(o=>n===o.file&&e.startLine<=o.startLine&&e.endLine>=o.startLine)}function wn(e){return ue("runtime-boundary-participant",e)}function Dl(e,t,n){let o=de(e,n),i=de(t,n);return o.relativeDir!==i.relativeDir?!0:/(?:^|\/)(?:contracts?|schemas?|db\/schema)(?:\/|$)/u.test(t)}function _l(e,t,n){return lt(e,n).id===lt(t,n).id}function Bl(e,t,n,o){if(e.referenceScope==="all")return!0;let i=lt(t,o).id;return[...n.values()].some(r=>r.promoteBoundaryImports&<(r.file,o).id===i)?!0:e.referenceScope!=="cross-workspace-or-forward"?!1:de(t,o).relativeDir!==de(e.definition.relativePath,o).relativeDir}function Ol(e,t){let n={none:0,"forward-regions":1,"cross-workspace-or-forward":2,all:3};return n[e]>=n[t]?e:t}function Gl(e,t){let n=Sr.get(e);if(n)return n;let o=t.fileDependencyGraph(),i={fileGraph:o,reverseFileGraph:jl(o),workspaces:Kl(t.sourceFiles()),runtimeBoundaries:zn(e)};return Sr.set(e,i),i}function jl(e){let t=new Map;for(let[n,o]of e)for(let i of o){let a=t.get(i)??new Set;a.add(n),t.set(i,a)}return t}function de(e,t){return t.find(n=>e===n.relativeDir||e.startsWith(`${n.relativeDir}/`))??{name:"root",relativeDir:""}}function Kl(e){let t=new Set(["apps","packages","services","crates","libs","tools"]),n=new Map;for(let o of e){let i=o.split("/").filter(Boolean);if(i.length<3||!t.has(i[0]))continue;let a=`${i[0]}/${i[1]}`;n.set(a,{name:i[1],relativeDir:a})}return[...n.values()].sort((o,i)=>i.relativeDir.length-o.relativeDir.length)}function lt(e,t){let n=de(e,t),i=(n.relativeDir?e.slice(n.relativeDir.length+1):e).split("/").filter(Boolean);i[0]==="src"&&i.shift();let a=ql(i);return{id:`region:${n.relativeDir||"root"}:${a}`,label:`${n.name}:${a}`,workspace:n.name,structuralPath:a}}function ql(e){if(e.length<=1)return"root";let t=e[0],n=e[1];return["components","features","modules"].includes(t)?`${t}/${n}`:t==="db"?`${t}/${n}`:["contracts","routes","services"].includes(t)?t:t==="tests"||t==="__tests__"?"tests":t}function zl(e,t,n,o,i,a,r){let s=ye([...e.values()],m=>a.get(m.file).id),c=ye([...t.values()],m=>a.get(m.definition.relativePath).id),d=ye(n,m=>a.get(m.file).id),l=new Map;for(let m of o)for(let p of new Set([m.fromRegionId,m.toRegionId])){let g=l.get(p)??[];g.push(m),l.set(p,g)}let u=ye(i,m=>m.toRegionId),f=ye(i,m=>m.fromRegionId);return[...s.entries()].map(([m,p])=>{let g=a.get(p[0].file),b=c.get(m)??[],C=d.get(m)??[],S=l.get(m)??[],v=r.has(m),R=b.map(Hl).sort(Xl).slice(0,ks),y=p.filter(N=>mt(N.file)==="test").length;return{id:m,label:g.label,workspace:g.workspace,structuralPath:g.structuralPath,minDepth:Math.min(...p.map(N=>N.depth)),fileCount:p.length,sourceFileCount:p.length-y,testFileCount:y,symbolCount:b.length,literalHitCount:C.length,anchorQueries:z([...C.map(N=>N.query),...b.flatMap(N=>[...N.anchorQueries])]),relationKinds:z(S.map(N=>N.kind)),incomingRegionIds:z((u.get(m)??[]).map(N=>N.fromRegionId)),outgoingRegionIds:z((f.get(m)??[]).map(N=>N.toRegionId)),memberCallCandidateRelationCount:S.filter(N=>N.evidence==="ast-member-import-candidate").length,notableSymbols:R,omittedNotableSymbols:Math.max(0,b.length-R.length),expanded:v,files:v?p.map(Ul).sort(Zl):[],symbols:v?b.map(Wl).sort(Jl):[],literalHits:v?[...C].sort(kr):[],relations:v?[...S].sort(Ar):[]}}).sort((m,p)=>m.minDepth-p.minDepth||m.label.localeCompare(p.label))}function Ul(e){return{file:e.file,kind:mt(e.file),depth:e.depth,origins:z([...e.origins])}}function Wl(e){return{symbol:e.definition.symbol,shortName:J(e.definition.symbol),file:e.definition.relativePath,startLine:e.definition.startLine,endLine:e.definition.endLine,depth:e.depth,origins:z([...e.origins]),anchorQueries:z([...e.anchorQueries]),referenceExpansion:e.referenceScope!=="none",referenceScope:e.referenceScope}}function Hl(e){return{shortName:J(e.definition.symbol),file:e.definition.relativePath,origins:z([...e.origins])}}function Vl(e){return[...ye(e.filter(n=>n.fromRegionId!==n.toRegionId),n=>`${n.fromRegionId}\0${n.toRegionId}`).values()].map(n=>({fromRegionId:n[0].fromRegionId,toRegionId:n[0].toRegionId,kinds:z(n.map(o=>o.kind)),relationCount:n.length,fromFiles:z(n.map(o=>o.fromFile)),toFiles:z(n.map(o=>o.toFile)),fromSymbols:z(n.flatMap(o=>o.fromSymbol?[J(o.fromSymbol)]:[])),toSymbols:z(n.flatMap(o=>o.toSymbol?[J(o.toSymbol)]:[])),evidence:z(n.map(o=>o.evidence)),strengths:z(n.map(o=>o.strength??"unknown"))})).sort((n,o)=>n.fromRegionId.localeCompare(o.fromRegionId)||n.toRegionId.localeCompare(o.toRegionId))}function Ql(e,t){return[...e.values()].map(n=>({kind:"external-import",name:n.name,fromRegionIds:z([...n.fromFiles].flatMap(o=>{let i=t.get(o);return i?[i.id]:[]})),fromFiles:z([...n.fromFiles])})).sort((n,o)=>n.name.localeCompare(o.name))}function Yl(e,t,n,o){let i=e.kind==="literal"?t.filter(a=>a.query===e.query).map(a=>a.file):[...n.values()].filter(a=>a.anchorQueries.has(e.query)).map(a=>a.definition.relativePath);return z(i.map(a=>o.get(a)?.id).filter(a=>!!a))}function Pr(e){return e.keyParts.map(t=>`${t.name}=${t.value}`).join(" ")}function z(e){return[...new Set(e)].sort()}function Ar(e,t){return e.fromRegionId.localeCompare(t.fromRegionId)||e.toRegionId.localeCompare(t.toRegionId)||e.kind.localeCompare(t.kind)||e.fromFile.localeCompare(t.fromFile)||e.toFile.localeCompare(t.toFile)||(e.line??-1)-(t.line??-1)}function Xl(e,t){return Ke(e.origins)-Ke(t.origins)||e.shortName.localeCompare(t.shortName)}function Zl(e,t){return e.depth-t.depth||e.file.localeCompare(t.file)}function Jl(e,t){return e.depth-t.depth||e.file.localeCompare(t.file)||e.symbol.localeCompare(t.symbol)}function kr(e,t){return e.file.localeCompare(t.file)||e.line-t.line||e.query.localeCompare(t.query)}var tc={causal:["execution","runtime","dataflow","state","temporal"],structure:["contract","identity","ownership","dependencies"],complete:Ce},nc=2,oc=48,$r=64,rc=5e4;function Su(e,t,n={}){let o=te([...t.symbols??[],...t.locations??[]]),i=te(t.searches??[]);if(o.length===0&&i.length===0)throw new Error("evidence requires at least one positional symbol, --symbol, --at, or --search selector.");let a=n.view??"causal",r=ic(n.families,a),s=n.direction??"both",c=te(n.subtypes??[]),d=n.connecting??!1,l=n.inventoryOnly??!1,u=te(n.foldIds??[]),f=n.maxDepth??nc,m=n.maxEdges??oc;if(!Number.isSafeInteger(f)||f<0)throw new RangeError(`Evidence depth must be a non-negative safe integer; received ${f}.`);if(!Number.isSafeInteger(m)||m<=0)throw new RangeError(`Evidence max edges must be a positive safe integer; received ${m}.`);if(!["incoming","outgoing","both"].includes(s))throw new Error(`Unsupported graph evidence direction: ${s}.`);if(l&&u.length>0)throw new Error("Evidence fold materialization cannot be combined with --inventory-only.");let p=Rr(e,{symbols:o,searches:i,maxDepth:f,maxTopologyCharacters:rc,relations:ac(r)}),g=new Map(p.nodes.map($=>[$.id,$])),b=p.edges.filter($=>$.disposition==="emitted"||$.disposition==="folded").flatMap($=>sc($,g)),C=b.filter($=>r.includes($.family)).filter($=>c.length===0||c.includes($.subtype)),S=new Set(p.anchors.flatMap($=>$.nodeIds));if(d&&S.size<2)throw new Error("Connecting evidence requires at least two resolved root nodes.");let v=new Set(C.map($=>$.id)),R=Nn(b,S,"incoming").filter($=>v.has($.id)),y=Nn(b,S,"outgoing").filter($=>v.has($.id)),N=Nn(b,S,"both").filter($=>v.has($.id)),L=pc(r,c,R,y,N),x=s==="incoming"?R:s==="outgoing"?y:N,M=d?Sc(x,[...S],s):x,h=xc(M,S,s),P=[...M].sort(($,B)=>Ec($,B,h)),D=mc(P,m),O=gc(D,u),w=l?[]:u.length>0?P.filter($=>O.has($.id)):P,T=u.length>0?w:w.slice(0,m),I=u.length>0||l?[]:D,_=Math.max(0,w.length-T.length),A=p.frontiers.filter($=>$.disposition==="unsupported").length,j=p.coverage.status==="incomplete"?"incomplete":_>0?"bounded":"accounted";return{kind:"graph",view:n.families&&n.families.length>0?"custom":a,families:r,selection:{direction:s,subtypes:c,connecting:d,inventoryOnly:l,foldIds:u},targets:p.anchors.map($=>({kind:$.kind,query:$.query,status:$.status,nodeIds:[...$.nodeIds],omittedCandidates:$.omittedCandidates})),inventory:L,edges:T,folds:I,coverage:{status:j,topologyStatus:p.coverage.status,scope:p.coverage.scope,maxDepth:f,maxEdges:m,matchedEdges:P.length,eligibleEdges:w.length,returnedEdges:T.length,omittedEdges:_,frontierGroups:p.frontiers.length,unsupportedFrontiers:A,blindSpots:te([...p.coverage.blindSpots,...Yn(r)]),explanation:l?`${P.length} relationship(s) match the explicit projection; only exact inventory counts were requested.`:u.length>0?`Every relationship in ${u.length} explicitly selected recoverable fold(s) was emitted.`:j==="accounted"?"Every selected relationship in the bounded topology was emitted.":j==="bounded"?`${_} selected relationship(s) were withheld by the explicit edge budget.`:p.coverage.explanation}}}function ic(e,t){let n=e&&e.length>0?e:tc[t],o=n.filter(i=>!Ce.includes(i));if(o.length>0)throw new Error(`Unsupported graph evidence family: ${o.join(", ")}.`);return te(n)}function ac(e){return["call","contract-symbol","import","reference","runtime-boundary"]}function sc(e,t){let n=t.get(e.fromNodeId),o=t.get(e.toNodeId);return!n||!o?[]:(e.semantics??[]).flatMap((i,a)=>{let r=cc(i);if(!r)return[];let s=Xn(r,i.subtype);if(!s)throw new Error(`No graph relation provider contract is registered for ${r}/${i.subtype}.`);let c=uc(e);return s.relation.evidenceStrengths.includes(c)?[{id:`${e.id}:${a}:${r}`,family:r,semanticFamily:i.family,subtype:i.subtype,from:Dr(n),to:Dr(o),sourceKind:e.kind,providerId:s.provider.id,supportCeiling:s.relation.supportCeiling,establishes:s.relation.establishes,nonClaims:[...s.relation.nonClaims],recoverWith:[...s.relation.recoverWith],evidenceStrength:c,evidenceMethods:te(e.evidence.map(d=>d.method)),evidenceConstituents:lc(e.evidence),context:i.context?{...i.context}:null,attributes:i.attributes?{...i.attributes}:null}]:[]})}function lc(e){let t=new Map;for(let n of e)t.set(`${n.method}\0${n.strength}`,n);return[...t.values()].map(({method:n,strength:o})=>({method:n,strength:o}))}function cc(e){switch(e.family){case"control":return e.context?.crossesRuntimeBoundary===!0||e.subtype==="runtime-handoff"?"runtime":"execution";case"data":return"dataflow";case"state":return"state";case"temporal":return"temporal";case"contract":return"contract";case"identity":return e.subtype.startsWith("contains")||e.subtype.startsWith("owns-")?"ownership":e.subtype.startsWith("import")?"dependencies":"identity"}}function Dr(e){let t=dc(e);return{id:e.id,kind:e.kind,label:t?J(t):e.label,symbol:t,location:e.location?{...e.location}:null}}function dc(e){return e.kind!=="symbol"||!e.id.startsWith("symbol:")?null:decodeURIComponent(e.id.slice(7))}function uc(e){let t=te(e.evidence.map(n=>n.strength));return t.length===1?t[0]:t.includes("exact")&&t.every(n=>n==="exact"||n==="derived")?"mixed":t.includes("candidate")?"candidate":t.includes("unknown")||t.length===0?"unknown":"mixed"}function Nn(e,t,n){let o=Mn(e,n),i=new Map,a=new Map,r=[...t].sort();for(let s of r)a.set(s,0);for(let s=0;s<r.length;s+=1){let c=r[s],d=a.get(c);for(let l of o.get(c)??[])i.set(l.edge.id,l.edge),!a.has(l.next)&&(a.set(l.next,d+1),r.push(l.next))}return[...i.values()]}function Mn(e,t){let n=new Map,o=(i,a,r)=>{let s=n.get(i)??[];s.push({edge:r,next:a}),n.set(i,s)};for(let i of e)t!=="incoming"&&o(i.from.id,i.to.id,i),t!=="outgoing"&&o(i.to.id,i.from.id,i);for(let i of n.values())i.sort((a,r)=>a.edge.id.localeCompare(r.edge.id)||a.next.localeCompare(r.next));return n}function pc(e,t,n,o,i){let a=new Set;for(let l of[...n,...o,...i])a.add(`${l.family}\0${l.subtype}`);if(t.length>0)for(let l of e)for(let u of t)a.add(`${l}\0${u}`);let r=l=>{let u=new Map;for(let f of l){let m=`${f.family}\0${f.subtype}`;u.set(m,(u.get(m)??0)+1)}return u},s=r(n),c=r(o),d=r(i);return[...a].map(l=>{let[u,f]=l.split("\0");return{family:u,subtype:f,incoming:s.get(l)??0,outgoing:c.get(l)??0,both:d.get(l)??0}}).sort((l,u)=>Ce.indexOf(l.family)-Ce.indexOf(u.family)||l.subtype.localeCompare(u.subtype))}function mc(e,t){let n=e.slice(t),o=new Map;for(let r of n){let s=fc(r),c=`${r.family}\0${s}`,d=o.get(c)??[];d.push(r),o.set(c,d)}let i=new Map(e.map((r,s)=>[r.id,s+1])),a=[];for(let[r,s]of[...o].sort(([c],[d])=>c.localeCompare(d))){let[c,d]=r.split("\0"),l=[...s].sort((u,f)=>u.id.localeCompare(f.id));for(let u=0;u<l.length;u+=$r){let f=l.slice(u,u+$r),m=f.map(C=>C.id),p=te(f.map(C=>C.subtype)).sort(),g=p.length===1?p[0]:"mixed",b=[...new Set(f.flatMap(C=>[C.from.id,C.to.id]))].sort();a.push({id:bc(c,p.join("\0"),m),mode:yc(f),family:c,subtype:g,subtypes:p,region:d,edgeCount:m.length,edgeIds:m,nodeIds:b,minimumMaxEdges:Math.max(...m.map(C=>i.get(C)??e.length))})}}return a.sort((r,s)=>Ce.indexOf(r.family)-Ce.indexOf(s.family)||(r.region??"").localeCompare(s.region??"")||r.id.localeCompare(s.id))}function fc(e){let t=e.from.location?.file??`kind:${e.from.kind}`,n=e.to.location?.file??`kind:${e.to.kind}`;return t===n?t:`${t} -> ${n}`}function gc(e,t){if(t.length===0)return new Set;let n=new Map(e.map(i=>[i.id,i])),o=t.filter(i=>!n.has(i));if(o.length>0){let i=e.map(a=>a.id).sort();throw new Error(`Unknown evidence fold ${o.join(", ")} for this projection. Available folds: ${i.join(", ")||"(none)"}.`)}return new Set(t.flatMap(i=>n.get(i).edgeIds))}function yc(e){let t=new Map,n=new Map,o=new Set;for(let a of e){o.add(a.from.id),o.add(a.to.id);let r=t.get(a.from.id)??new Set;r.add(a.to.id),t.set(a.from.id,r);let s=n.get(a.to.id)??new Set;s.add(a.from.id),n.set(a.to.id,s)}return hc(o,t)?"scc":[...o].every(a=>(n.get(a)?.size??0)<=1&&(t.get(a)?.size??0)<=1)?"linear":"topology"}function hc(e,t){let n=new Set,o=new Set,i=a=>{if(n.has(a))return!0;if(o.has(a))return!1;n.add(a);for(let r of t.get(a)??[])if(i(r))return!0;return n.delete(a),o.add(a),!1};return[...e].some(i)}function bc(e,t,n){return`fold:${ec("sha256").update([e,t,...n].join("\0")).digest("hex").slice(0,16)}`}function Sc(e,t,n){let o=new Map,i=[...new Set(t)].sort();for(let a=0;a<i.length;a+=1)for(let r=a+1;r<i.length;r+=1)for(let s of vc(e,i[a],i[r],n))o.set(s.id,s);return[...o.values()]}function vc(e,t,n,o){let i=Mn(e,o),a=new Map([[t,0]]),r=new Map,s=[t];for(let d=0;d<s.length;d+=1){let l=s[d],u=a.get(l);if(l!==n)for(let f of i.get(l)??[])a.has(f.next)||(a.set(f.next,u+1),r.set(f.next,{node:l,edge:f.edge}),s.push(f.next))}if(!a.has(n))return[];let c=[];for(let d=n;d!==t;){let l=r.get(d);if(!l)return[];c.push(l.edge),d=l.node}return c.reverse()}function xc(e,t,n){let o=Mn(e,n),i=new Map,a=[...t];for(let r of t)i.set(r,0);for(let r=0;r<a.length;r+=1){let s=a[r],c=i.get(s);for(let{next:d}of o.get(s)??[])i.has(d)||(i.set(d,c+1),a.push(d))}return i}function Ec(e,t,n){return _r(e,n)-_r(t,n)||Br(e)-Br(t)||Or(e.evidenceStrength)-Or(t.evidenceStrength)||Ce.indexOf(e.family)-Ce.indexOf(t.family)||e.from.label.localeCompare(t.from.label)||e.to.label.localeCompare(t.to.label)||e.subtype.localeCompare(t.subtype)||e.id.localeCompare(t.id)}function _r(e,t){return Math.min(t.get(e.from.id)??Number.MAX_SAFE_INTEGER,t.get(e.to.id)??Number.MAX_SAFE_INTEGER)}function Br(e){let t=[e.from,e.to].filter(n=>n.kind==="structural-region").length;return t===2?2:t}function Or(e){switch(e){case"exact":return 0;case"mixed":return 1;case"derived":return 2;case"candidate":return 3;case"unknown":return 4}}export{Su as a};
|
|
21
|
-
//# sourceMappingURL=chunk-L6XHYJPZ.js.map
|
package/dist/chunk-L7KTFEAV.js
DELETED
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import{J as _,L as C,a as x,c as I,d as R}from"./chunk-2VAHDDLM.js";import{a as h}from"./chunk-YXPUP5G2.js";import{b as O,d as F}from"./chunk-ATXPTSEI.js";import{c as A}from"./chunk-IW5XQG5G.js";import{e as g}from"./chunk-HGFDYOVB.js";var P=I({kind:"file-dependency-graph",invalidation:R("file-dependency-graph"),serialize:e=>JSON.stringify(e),deserialize:L}),J=A("file-dep-graph",{clearGroups:["whole-project"]});function ee(e,n,r){if(r.length===0)return[];let t=new Set(r),i=M(e),s=new Set;if(n==="forward")for(let o of t)for(let c of i.get(o)??[])t.has(c)||s.add(c);else for(let[o,c]of i)if(!t.has(o))for(let d of t)c.has(d)&&s.add(o);return[...s].sort()}function M(e,n,r={}){let t=r.scipEdges??"all-references",i=r.sourceEdges??"imports-only",s=D(n,t,i);return J.get(e,s,()=>{let o=new Set(h(e,{includeIgnored:!1})),c=F(e),d=0,f=0,l=null,p=!1,u=0,N=0,G=null;return g("file-dep-graph.product",()=>{if(c){let a=P.read(e,s,c);if(a){p=!0,G=a.construction;let E=v(a);return d=a.sourceFileCount,f=a.sourceEdgeCount,u=a.scipEdgeCount,N=E.size,l=a.sourceDependencyFingerprint,E}}let S=i==="none"?{files:[],edges:[],fingerprint:O("no-source-dependency-fallback")}:g("file-dep-graph.source-imports",()=>{let a=j(e,o,n,i);return d=a.files.length,f=a.edges.length,l=a.fingerprint,a},()=>({scope:n??null,sourceEdges:i,files:d,edges:f})),y=new Map,b=(a,E)=>m(e,y,o,a,E);g("file-dep-graph.scip-edges",()=>{for(let a of H(e,n,t))u=(u??0)+1,b(a.from_file,a.to_file)},()=>({scope:n??null,edges:u}));for(let a of S.edges)b(a.fromFile,a.toFile);return N=y.size,c&&(G="full",P.write(e,s,c,{version:2,construction:"full",sourceDependencyFingerprint:S.fingerprint,sourceFileCount:S.files.length,sourceEdgeCount:S.edges.length,scipEdgeCount:u,edgeCount:k(y),graph:w(y)})),y},()=>({scope:n??null,available:c!==null,hit:p,construction:G,files:d,sourceEdges:f,sourceEdgeMode:i,scipEdges:u,graphFiles:N,sourceDependencyFingerprint:l}))})}function ne(e){return T(e,"none")}function re(e,n="imports-only"){let r=D(void 0,"all-references",n),t=F(e);if(!t)return null;let i=P.read(e,r,t);return i?{cacheKey:r,sourceEdges:n,graph:v(i)}:null}function T(e,n){let r=D(void 0,"all-references",n),t=M(e,void 0,{sourceEdges:n});return{cacheKey:r,sourceEdges:n,graph:t}}function te(e,n,r,t){let i=n.sourceEdges??"imports-only",s=F(e);if(!s)return!1;let o=t??$(e,n,r);if(!o)return!1;let c=new Set(h(e,{includeIgnored:!1})),d=D(void 0,"all-references",i);return P.write(e,d,s,{version:2,construction:"carried",sourceDependencyFingerprint:null,sourceFileCount:c.size,sourceEdgeCount:null,scipEdgeCount:null,edgeCount:k(o),graph:w(o)}),!0}function $(e,n,r,t=[]){let i=n.sourceEdges??"imports-only",s=D(void 0,"all-references",i);if(n.cacheKey!==s)return null;let o=g("file-dep-graph.carry.indexed-files",()=>new Set(h(e,{includeIgnored:!1}))),c=new Set(r),d=new Map;g("file-dep-graph.carry.reuse",()=>{if(t.length===0)for(let[l,p]of n.graph)c.has(l)||d.set(l,p);else for(let[l,p]of n.graph)if(!(c.has(l)||!o.has(l)))for(let u of p)m(e,d,o,l,u)});let f=g("file-dep-graph.carry.scip-edges",()=>B(e,c,"all-references"));for(let l of f)m(e,d,o,l.from_file,l.to_file);return g("file-dep-graph.carry.source-edges",()=>{for(let l of c)if(o.has(l)){if(i!=="none")for(let p of C(e,l))p.sourcePath&&m(e,d,o,l,p.sourcePath);if(i==="imports-and-reexports")for(let p of _(e,l))p.sourcePath&&m(e,d,o,l,p.sourcePath)}}),d}async function oe(e,n={}){let r=h(e,{includeIgnored:!1}),t=Math.max(1,Math.floor(n.batchSize??64)),i=n.collectGarbage??x,s=0;for(let o=0;o<r.length;o+=t){for(let c of r.slice(o,o+t))C(e,c),_(e,c),s+=1;n.onBatch?.({files:s,total:r.length}),i(),await n.yieldToEventLoop?.()}return{files:s}}function j(e,n,r,t){let i=[],s=[];for(let o of n)if(!(r&&!o.includes(r))){i.push(o);for(let c of C(e,o))c.sourcePath&&s.push({fromFile:o,toFile:c.sourcePath});if(t==="imports-and-reexports")for(let c of _(e,o))c.sourcePath&&s.push({fromFile:o,toFile:c.sourcePath})}return{files:i,edges:s,fingerprint:z(i,s)}}function z(e,n){let r=n.map(t=>`${t.fromFile}\0${t.toFile}`).sort();return O(JSON.stringify({files:e,edges:r}))}function D(e,n,r){return`edge-mode-v4:${n}:${r}:${e??"<all>"}`}function w(e){return[...e].map(([n,r])=>[n,[...r].sort()]).sort(([n],[r])=>n.localeCompare(r))}function v(e){return new Map(e.graph.map(([n,r])=>[n,new Set(r)]))}function L(e){let n=JSON.parse(e);return K(n)?n:null}function K(e){if(!e||typeof e!="object")return!1;let n=e;return n.version===2&&(n.construction==="full"||n.construction==="carried")&&(n.sourceDependencyFingerprint===null||typeof n.sourceDependencyFingerprint=="string")&&typeof n.sourceFileCount=="number"&&(n.sourceEdgeCount===null||typeof n.sourceEdgeCount=="number")&&(n.scipEdgeCount===null||typeof n.scipEdgeCount=="number")&&typeof n.edgeCount=="number"&&Array.isArray(n.graph)&&n.graph.every(W)}function k(e){let n=0;for(let r of e.values())n+=r.size;return n}function W(e){return Array.isArray(e)&&e.length===2&&typeof e[0]=="string"&&Array.isArray(e[1])&&e[1].every(n=>typeof n=="string")}function H(e,n,r){let t=n?"AND d1.relative_path LIKE ?":"",i=n?[`%${n}%`]:[],s=r==="imports-only"?"AND m.role = 2":"AND m.role != 1";return e.all(`SELECT DISTINCT
|
|
2
|
-
d1.relative_path AS from_file,
|
|
3
|
-
d2.relative_path AS to_file
|
|
4
|
-
FROM mentions m
|
|
5
|
-
JOIN chunks c ON m.chunk_id = c.id
|
|
6
|
-
JOIN documents d1 ON c.document_id = d1.id
|
|
7
|
-
JOIN global_symbols gs ON m.symbol_id = gs.id
|
|
8
|
-
JOIN (
|
|
9
|
-
SELECT m2.symbol_id, c2.document_id
|
|
10
|
-
FROM mentions m2
|
|
11
|
-
JOIN chunks c2 ON m2.chunk_id = c2.id
|
|
12
|
-
WHERE m2.role = 1
|
|
13
|
-
GROUP BY m2.symbol_id
|
|
14
|
-
) sym_def ON sym_def.symbol_id = gs.id
|
|
15
|
-
JOIN documents d2 ON sym_def.document_id = d2.id
|
|
16
|
-
WHERE d1.id != d2.id
|
|
17
|
-
${s}
|
|
18
|
-
${e.pathExclusionsFor("d1","d2")}
|
|
19
|
-
${t}`,...i)}function B(e,n,r){let t=[...n].sort();if(t.length===0)return[];let i=r==="imports-only"?"AND m.role = 2":"AND m.role != 1",s=[];for(let o=0;o<t.length;o+=500){let c=t.slice(o,o+500),d=c.map(()=>"?").join(", ");s.push(...e.all(`SELECT DISTINCT
|
|
20
|
-
d1.relative_path AS from_file,
|
|
21
|
-
d2.relative_path AS to_file
|
|
22
|
-
FROM documents d1
|
|
23
|
-
CROSS JOIN chunks c
|
|
24
|
-
CROSS JOIN mentions m
|
|
25
|
-
CROSS JOIN global_symbols gs
|
|
26
|
-
CROSS JOIN chunks c2
|
|
27
|
-
CROSS JOIN documents d2
|
|
28
|
-
WHERE d1.relative_path IN (${d})
|
|
29
|
-
AND c.document_id = d1.id
|
|
30
|
-
AND m.chunk_id = c.id
|
|
31
|
-
AND gs.id = m.symbol_id
|
|
32
|
-
AND c2.id = (
|
|
33
|
-
SELECT m2.chunk_id
|
|
34
|
-
FROM mentions m2
|
|
35
|
-
WHERE m2.symbol_id = gs.id AND m2.role = 1
|
|
36
|
-
ORDER BY m2.chunk_id
|
|
37
|
-
LIMIT 1
|
|
38
|
-
)
|
|
39
|
-
AND d2.id = c2.document_id
|
|
40
|
-
AND d1.id != d2.id
|
|
41
|
-
${i}
|
|
42
|
-
${e.pathExclusionsFor("d1","d2")}`,...c))}return s}function m(e,n,r,t,i){if(t===i||e.isIgnored(t)||e.isIgnored(i)||!r.has(i))return;let s=n.get(t);s||(s=new Set,n.set(t,s)),s.add(i)}export{ee as a,M as b,ne as c,re as d,te as e,$ as f,oe as g};
|
|
43
|
-
//# sourceMappingURL=chunk-L7KTFEAV.js.map
|