scip-query 0.23.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 +491 -2
- package/README.md +111 -122
- 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-CUtj8V2I.d.ts +19 -0
- 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-EG2CPZMJ.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-6I6L7Z62.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-ILTDAWEF.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-JTQVMR42.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-WIWY3CRX.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-M2O5NY6W.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-XBGWL66K.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-T3I6NHBH.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-VF5JZICY.js +2 -0
- 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-X6RMKHJQ.js +81 -0
- package/dist/{chunk-4ILJCCXV.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-GAS2LJMP.js → chunk-ZLADLUE6.js} +3 -3
- package/dist/chunk-ZO4YXUT6.js +4 -0
- package/dist/{chunk-HYO3NP5Q.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/frontend-profile-roles-D7eCum8P.d.ts +10 -0
- package/dist/{health-CPp2Jf1Z.d.ts → health-BtfmNrfa.d.ts} +58 -74
- 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 +3 -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.d.ts +20 -2
- 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.d.ts +2 -0
- 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 +29 -2
- 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 +17 -65
- 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.d.ts +9 -1
- package/dist/queries/passthrough-candidates.js +1 -1
- package/dist/queries/react-component-duplicates.d.ts +19 -3
- package/dist/queries/react-component-duplicates.js +1 -1
- package/dist/queries/react-hook-candidates.d.ts +22 -3
- package/dist/queries/react-hook-candidates.js +1 -1
- package/dist/queries/react-large-component-pressure.d.ts +17 -3
- 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 +23 -7
- 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 +55 -12
- 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 +70 -13
- package/docs/analyzer-inventory.md +2 -2
- package/docs/locality-analyzer-design.md +9 -9
- 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-XI2CSWEY.js +0 -2
- package/dist/call-graph-UONR6JR5.js +0 -2
- package/dist/call-graph-evidence-lZa2dwQA.d.ts +0 -11
- package/dist/chunk-26CT72HM.js +0 -2
- package/dist/chunk-2E7CX53V.js +0 -2
- package/dist/chunk-2GRUZAQF.js +0 -43
- package/dist/chunk-2LDBDR6J.js +0 -29
- package/dist/chunk-2OOY75BW.js +0 -2
- package/dist/chunk-2R3V3PSD.js +0 -4
- package/dist/chunk-2WC2OEDO.js +0 -4
- package/dist/chunk-35NLDRZC.js +0 -2
- package/dist/chunk-3AF4TUFK.js +0 -3
- package/dist/chunk-3D3QG236.js +0 -2
- package/dist/chunk-3FHOF22C.js +0 -21
- package/dist/chunk-3JKSW6LJ.js +0 -2
- package/dist/chunk-3L2ZBPEX.js +0 -133
- package/dist/chunk-3PJABJSU.js +0 -2
- package/dist/chunk-3SVF22I5.js +0 -2
- package/dist/chunk-3WR4E3A3.js +0 -3
- package/dist/chunk-4FTZ4P5G.js +0 -2
- package/dist/chunk-4UX2F3JX.js +0 -2
- package/dist/chunk-4WNW27SX.js +0 -2
- package/dist/chunk-5ENOG4VP.js +0 -61
- package/dist/chunk-64BFSI5I.js +0 -2
- package/dist/chunk-66DVSJQG.js +0 -455
- package/dist/chunk-6HFCYNYE.js +0 -9
- package/dist/chunk-6PQNKL3G.js +0 -3
- package/dist/chunk-6V5CNXL6.js +0 -2
- package/dist/chunk-6VVV4WRR.js +0 -4
- package/dist/chunk-7BWFZPPZ.js +0 -2
- package/dist/chunk-7CYG22FH.js +0 -2
- package/dist/chunk-7F45LJKI.js +0 -2
- package/dist/chunk-7IWV2EG3.js +0 -3
- package/dist/chunk-7KCZELVM.js +0 -2
- package/dist/chunk-AFHTBORT.js +0 -2
- package/dist/chunk-AVRYW5OZ.js +0 -2
- package/dist/chunk-B3X6KU75.js +0 -2
- package/dist/chunk-B5D7QPBE.js +0 -4
- package/dist/chunk-BBCIS4DX.js +0 -16
- package/dist/chunk-BDUVI7TO.js +0 -3
- package/dist/chunk-BE7ZZTMC.js +0 -2
- package/dist/chunk-BHVUJOCQ.js +0 -3
- package/dist/chunk-BJT7LSPK.js +0 -3
- package/dist/chunk-BKVWUP7Y.js +0 -2
- package/dist/chunk-BQGB4HBD.js +0 -2
- package/dist/chunk-BRV7PIFF.js +0 -2
- package/dist/chunk-CEEZJXEF.js +0 -2
- package/dist/chunk-CIYLO6SI.js +0 -7
- package/dist/chunk-CJZXN4NU.js +0 -2
- package/dist/chunk-CNO7TOKL.js +0 -2
- package/dist/chunk-COF23M5F.js +0 -2
- package/dist/chunk-CWFP7GM5.js +0 -2
- package/dist/chunk-D2DHWI3D.js +0 -2
- package/dist/chunk-D4N5SQ2M.js +0 -4
- package/dist/chunk-DBRSYFXR.js +0 -2
- package/dist/chunk-DHUIOLDT.js +0 -2
- package/dist/chunk-DIRJWYBM.js +0 -6
- package/dist/chunk-DIUFNHRJ.js +0 -35
- package/dist/chunk-DRENNWRG.js +0 -2
- package/dist/chunk-DTZCKZEU.js +0 -4
- package/dist/chunk-DULC3QFP.js +0 -5
- package/dist/chunk-DYGHBZ2N.js +0 -16
- package/dist/chunk-E5R6AQ73.js +0 -40
- package/dist/chunk-E73UNJTF.js +0 -38
- package/dist/chunk-EKV5HX33.js +0 -2
- package/dist/chunk-EQHFIL6T.js +0 -3
- package/dist/chunk-ESIQ66Z7.js +0 -2
- package/dist/chunk-EVFUMY4R.js +0 -3
- package/dist/chunk-F7DY272B.js +0 -2
- package/dist/chunk-FBN2FGXG.js +0 -2
- package/dist/chunk-FDLOBR6P.js +0 -4
- package/dist/chunk-FESCRNVV.js +0 -5
- package/dist/chunk-FFRKR4EQ.js +0 -2
- package/dist/chunk-FGA2U4OR.js +0 -8
- package/dist/chunk-FIQRSHVM.js +0 -2
- package/dist/chunk-FPYLNQPT.js +0 -2
- package/dist/chunk-FRUSVINH.js +0 -2
- package/dist/chunk-GSP44ENC.js +0 -2
- package/dist/chunk-GUFSG5TX.js +0 -2
- package/dist/chunk-GYIZ4NXB.js +0 -2
- package/dist/chunk-GZIUDL6G.js +0 -2
- package/dist/chunk-H5EXS3HM.js +0 -2
- package/dist/chunk-HCXEQRFF.js +0 -18
- package/dist/chunk-HEHOQQKH.js +0 -2
- package/dist/chunk-HKGFPJ4T.js +0 -4
- package/dist/chunk-HLZTEXRA.js +0 -2
- package/dist/chunk-HOENASQM.js +0 -3
- package/dist/chunk-HVF5VBG6.js +0 -2
- package/dist/chunk-I55I7XXP.js +0 -2
- package/dist/chunk-IDFEUFKS.js +0 -2
- package/dist/chunk-IHGQTTVW.js +0 -2
- package/dist/chunk-IICPE7B2.js +0 -20
- package/dist/chunk-IL676XCC.js +0 -18
- package/dist/chunk-IW5XQG5G.js +0 -2
- package/dist/chunk-IZDPJ2QI.js +0 -2
- package/dist/chunk-J66VOFW6.js +0 -5
- package/dist/chunk-JFMEXGFE.js +0 -2
- package/dist/chunk-JGKUET5J.js +0 -3
- package/dist/chunk-JS4PGXMV.js +0 -3
- package/dist/chunk-JWTGMPIT.js +0 -80
- package/dist/chunk-JYR66JN5.js +0 -5
- package/dist/chunk-KFOYCQAJ.js +0 -9
- package/dist/chunk-KLFEXGQA.js +0 -2
- package/dist/chunk-KMVGRIO2.js +0 -2
- package/dist/chunk-KYSDI3GE.js +0 -5
- package/dist/chunk-L6PJPETJ.js +0 -29
- package/dist/chunk-LDVT66YM.js +0 -2
- package/dist/chunk-LEECKFCJ.js +0 -2
- package/dist/chunk-LMZ5PRUV.js +0 -2
- package/dist/chunk-LQRQN2XA.js +0 -2
- package/dist/chunk-LXABEJX3.js +0 -2
- package/dist/chunk-MNV5FSBW.js +0 -3
- package/dist/chunk-MPQ4OTBM.js +0 -2
- package/dist/chunk-MTDBHTSF.js +0 -2
- package/dist/chunk-MV3CDXPI.js +0 -38
- package/dist/chunk-MWN53KRN.js +0 -60
- package/dist/chunk-MXNGIEPU.js +0 -3
- package/dist/chunk-N2ZSIIGR.js +0 -117
- package/dist/chunk-N5B2NILC.js +0 -5
- package/dist/chunk-NJITK2GP.js +0 -2
- package/dist/chunk-NOGJXYFO.js +0 -2
- package/dist/chunk-NOYBFVJA.js +0 -554
- package/dist/chunk-NWQXSFFU.js +0 -3
- package/dist/chunk-ODDUPDP7.js +0 -13
- package/dist/chunk-OLIWTZI3.js +0 -3
- package/dist/chunk-OLNV6I6U.js +0 -2
- package/dist/chunk-OR2E3AGZ.js +0 -2
- package/dist/chunk-OSR2GEHQ.js +0 -2
- package/dist/chunk-OSSESPDX.js +0 -3
- package/dist/chunk-OWOOWNJ5.js +0 -7
- package/dist/chunk-P42EIXTA.js +0 -2
- package/dist/chunk-PJFGPYTU.js +0 -2
- package/dist/chunk-PP7KNN7L.js +0 -2
- package/dist/chunk-PU7T5QYQ.js +0 -2
- package/dist/chunk-PWWAJSKV.js +0 -74
- package/dist/chunk-PZL5T7SU.js +0 -73
- package/dist/chunk-QBE3YX64.js +0 -23
- package/dist/chunk-QGVTFRY2.js +0 -7
- package/dist/chunk-QOJONDS7.js +0 -2
- package/dist/chunk-QU5XRYB5.js +0 -4
- package/dist/chunk-QUU5OBVK.js +0 -11
- package/dist/chunk-RBLQNW26.js +0 -20
- package/dist/chunk-RTQ7NEKG.js +0 -81
- package/dist/chunk-SQXRS7BG.js +0 -4
- package/dist/chunk-SSK6LDPC.js +0 -2
- package/dist/chunk-SZHGTCPP.js +0 -7
- package/dist/chunk-T4N4P2K5.js +0 -16
- package/dist/chunk-TA3QKLLU.js +0 -2
- package/dist/chunk-TEBQMNVI.js +0 -43
- package/dist/chunk-TPFHAQ2G.js +0 -2
- package/dist/chunk-TQPCBMWT.js +0 -5
- package/dist/chunk-TQZV7KV4.js +0 -2
- package/dist/chunk-TRNAEQ6P.js +0 -3
- package/dist/chunk-TY7CRN3Z.js +0 -2
- package/dist/chunk-UHFYCMZO.js +0 -35
- package/dist/chunk-UICY4GTQ.js +0 -7
- package/dist/chunk-UVGEWT4Y.js +0 -26
- package/dist/chunk-UXW33INU.js +0 -29
- package/dist/chunk-VMPRET3I.js +0 -5
- package/dist/chunk-VNLGKHS6.js +0 -6
- package/dist/chunk-VQILFTEH.js +0 -2
- package/dist/chunk-VUPHCS7Y.js +0 -57
- package/dist/chunk-VVZSBTSU.js +0 -23
- package/dist/chunk-VZRNID6A.js +0 -2
- package/dist/chunk-W5OXRYGE.js +0 -7
- package/dist/chunk-W6STWDQI.js +0 -57
- package/dist/chunk-W7CXK74K.js +0 -2
- package/dist/chunk-WB3WYIRE.js +0 -4
- package/dist/chunk-WDNVY4E7.js +0 -20
- package/dist/chunk-WK46TNUM.js +0 -3
- package/dist/chunk-WNTFFKAX.js +0 -12
- package/dist/chunk-WOIKCX6A.js +0 -2
- package/dist/chunk-WUN6KBHV.js +0 -2
- package/dist/chunk-WYCTJDVR.js +0 -2
- package/dist/chunk-WYPL7GF7.js +0 -2
- package/dist/chunk-XDAUYDFT.js +0 -2
- package/dist/chunk-XDQMU3BT.js +0 -2
- package/dist/chunk-XFA4SSO3.js +0 -3
- package/dist/chunk-XGZEP6GR.js +0 -8
- package/dist/chunk-XPDPNWTQ.js +0 -368
- package/dist/chunk-XRYABF57.js +0 -8
- package/dist/chunk-YBGKCQIS.js +0 -2
- package/dist/chunk-YEN6CYC7.js +0 -16
- package/dist/chunk-YF5IB2LF.js +0 -2
- package/dist/chunk-YI2AWIHC.js +0 -3
- package/dist/chunk-YPWBKGFU.js +0 -2
- package/dist/chunk-YPWHBBIS.js +0 -2
- package/dist/chunk-YSH6U3L4.js +0 -3
- package/dist/chunk-YU5DZUZI.js +0 -10
- package/dist/chunk-YWO5DDRC.js +0 -16
- package/dist/chunk-Z4CDXYNQ.js +0 -2
- package/dist/chunk-ZF5KHH7C.js +0 -2
- package/dist/chunk-ZOHS7AQV.js +0 -21
- package/dist/chunk-ZTI4SBFV.js +0 -3
- package/dist/code-MI6F2TTU.js +0 -2
- package/dist/code-result-json-FXALY4HE.js +0 -2
- package/dist/command-descriptors-P34VABY5.js +0 -343
- package/dist/dataflow-4KEMJPC6.js +0 -2
- package/dist/dependence-slice-R7FPWD5M.js +0 -2
- package/dist/deps-7EMQUYUT.js +0 -2
- package/dist/direct-navigation-6YO234F2.js +0 -3
- package/dist/entry-map-KOOLR26E.js +0 -2
- package/dist/files-OPIPJIGZ.js +0 -2
- package/dist/graph-evidence-Bjyky2V4.d.ts +0 -126
- package/dist/hierarchy-QPD2CAER.js +0 -2
- package/dist/imports-M6HUXRXC.js +0 -2
- package/dist/members-I5MEFOCT.js +0 -2
- package/dist/methods-5JYGGHXA.js +0 -2
- package/dist/next-anchor-candidates-BwMczMvX.d.ts +0 -90
- package/dist/output-continuation-command-UPQAAKBP.js +0 -3
- package/dist/output-pagination-3OFL2MJV.js +0 -19
- package/dist/project-reindex-UKKQ5PLS.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 -52
- 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 -63
- 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 -34
- package/dist/queries/wrapper-candidates.js +0 -2
- package/dist/refs-PSU4JZZW.js +0 -2
- package/dist/refs-pagination-JG6CJMRC.js +0 -2
- package/dist/slice-HYRATV64.js +0 -2
- package/dist/source-snippet-_wrcgmZc.d.ts +0 -15
- package/dist/stats-OOJ74B32.js +0 -2
- package/dist/surface-VTGDYWF5.js +0 -2
- package/dist/symbol-resolution-WD5EU5JE.js +0 -2
- package/dist/system-LRQNFOR2.js +0 -2
- package/dist/trace-F4B6OLL4.js +0 -2
- package/dist/value-flow-VRPZY72V.js +0 -2
- package/skills/concrete-plan/SKILL.md +0 -8
- package/skills/concrete-plan/agents/openai.yaml +0 -4
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import{A as k,B as Q,C as ne,N as Qe,O as R,P as se,Q as Ye,R as oe,U as ie,V as ae,W as Ze,e as Be,f as qe,g as C,h as Ve,i as ze,j as We,k as q,l as Ke,m as H,n as He,o as Je,p as Ge,q as A,s as J,t as L,u as ge,v as Se,w as S,x as xe,y as Xe,z as he}from"./chunk-FVULPZDF.js";import{e as ye,g as G,i as X}from"./chunk-D3FDISIC.js";import{a as w}from"./chunk-A2IIGFMJ.js";import{d as K}from"./chunk-GVWX5T43.js";import{Ca as B,Fa as Ue,c as W,qa as Me,ra as ve,za as $e}from"./chunk-5TNQJUR2.js";function M(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Ut(e){return e.replace(/'''[\s\S]*?'''/g,j).replace(/"""[\s\S]*?"""/g,j).replace(/#.*$/gm,j).replace(/\/\/.*$/gm,j).replace(/\/\*[\s\S]*?\*\//g,j).replace(/`(?:\\[\s\S]|[^`])*`/g,j).replace(/'(?:\\.|[^'\\\r\n])*'/g,j).replace(/"(?:\\.|[^"\\\r\n])*"/g,j)}function Rs(e){return tt(e,{maskStrings:!1})}function Fs(e){return tt(e,{maskStrings:!0})}function tt(e,t){let r="",n=0;for(;n<e.length;){let s=Bt(e,n);if(s!==null){r+=et(e,n,s),n=s;continue}let o=e[n];if(o==="`"||o==="'"||o==='"'){let i=qt(e,n,o);r+=t.maskStrings?et(e,n,i):e.slice(n,i),n=i;continue}r+=o,n+=1}return r}function Bt(e,t){if(e[t]!=="/")return null;if(e[t+1]==="/"){let r=e.indexOf(`
|
|
2
|
+
`,t);return r===-1?e.length:r}if(e[t+1]==="*"){let r=e.indexOf("*/",t+2);return r===-1?e.length:r+2}return null}function qt(e,t,r){let n=t+1;for(;n<e.length;){if(e[n]==="\\"){n+=2;continue}if(e[n]===r)return n+1;if(r!=="`"&&e[n]===`
|
|
3
|
+
`)break;n+=1}return n}function et(e,t,r){let n="";for(let s=t;s<r;s+=1)n+=e[s]===`
|
|
4
|
+
`?`
|
|
5
|
+
`:" ";return n}function j(e){return e.replace(/[^\r\n]/g," ")}$e({name:"stripped-source-singleton",groups:["whole-project","source-file"],clearAll:()=>{ce=null,Y=""},clearFile:()=>{ce=null,Y=""}});var ce=null,Y="";function Vt(e){return ce===e||(ce=e,Y=Ut(e)),Y}function D(e,t,r){let n=Vt(e);return`${n.slice(0,t)}${" ".repeat(r-t)}${n.slice(r)}`}function x(e,t){return new RegExp(`\\b${M(t)}\\b`,"m").test(e)}function V(e,t){let r=new Set,n=new RegExp(`\\b${M(t)}\\s*\\.\\s*([A-Za-z_$][\\w$]*)`,"g");for(let s of e.matchAll(n)){let o=s[1];o&&r.add(o)}return[...r]}function be(e){let t=0;for(let r of e)r==="("&&(t+=1),r===")"&&(t-=1);return t}var zt=new Set(["if_statement","conditional_expression","ternary_expression","for_statement","for_in_statement","for_of_statement","while_statement","do_statement","switch_case","case_statement","catch_clause","except_clause","elif_clause","match_arm"]);function rt(e){return zt.has(e.type)?1:e.type==="binary_expression"&&e.parent?.type!=="binary_expression"&&(e.text.includes("&&")||e.text.includes("||"))?Wt(e.text):0}function Wt(e){return(e.match(/&&|\|\|/g)??[]).length}var Kt=new Set(["identifier","type_identifier","field_identifier"]),Ht=new Set(["identifier"]),Jt=new Set(["identifier","property_identifier","type_identifier","shorthand_property_identifier","shorthand_property_identifier_pattern"]),Gt=new Set(["rust","python"]),Xt=/\{([^{}]*)\}/g,Qt=/\b([A-Za-z_][\w]*)\b/g;function nt(e,t){return Yt(t).has(e.type)}function st(e,t){return Gt.has(t)&&e.type==="string_content"}function Ne(e){let t=0;for(let n of e.values()){let s=n[n.length-1];s!==void 0&&s>t&&(t=s)}let r=new Array(t+1);for(let n=0;n<=t;n+=1)r[n]=new Set;for(let[n,s]of e)for(let o of s)r[o].add(n);return r}function Yt(e){return e==="rust"?Kt:e==="python"?Ht:Jt}function ot(e,t){let r=e.startPosition.row;for(let n of e.text.matchAll(Xt)){let s=n[1]??"";for(let o of s.matchAll(Qt))o[1]&&t(o[1],r)}}var Zt=[/\bdefault\s*=\s*"([^"]+)"/g,/\bwith\s*=\s*"([^"]+)"/g,/\bserialize_with\s*=\s*"([^"]+)"/g,/\bdeserialize_with\s*=\s*"([^"]+)"/g,/\bskip_serializing_if\s*=\s*"([^"]+)"/g,/\bgetter\s*=\s*"([^"]+)"/g,/\brename_all_with\s*=\s*"([^"]+)"/g,/\bschema_with\s*=\s*"([^"]+)"/g],er=/^#!?\[\s*serde\s*\(/,tr=/^#!?\[\s*schemars\s*\(/,rr=/^#!?\[\s*validate\s*\(/,nr=new Set(["invoke","invokeTauriCommand","listen","once","emit","subscribe","dispatch","sendCommand","callRust"]),sr=new Set(["typescript","tsx","javascript"]);function it(e,t,r){if(!sr.has(t)||e.type!=="call_expression")return;let n=e.childForFieldName("function")??e.namedChild(0);if(!n)return;let s=ae(n);!s||!nr.has(s)||or(e,r)}function or(e,t){let r=e.namedChildren.find(o=>o.type==="arguments");if(!r)return;let n=r.namedChild(0);if(!n||n.type!=="string")return;let s=n.namedChildren.find(o=>o.type==="string_fragment");s&&t.add(s.text)}function at(e,t){let r=er.test(e),n=tr.test(e),s=rr.test(e);if(!(!r&&!n&&!s))for(let o of Zt){o.lastIndex=0;let i;for(;(i=o.exec(e))!==null;){let a=i[1],c=a.split("::").pop()??a;ir(c,a)||c&&t.add(c)}}}function ir(e,t){return e==="is_none"?/\bOption\b/.test(t):e==="is_empty"&&/\b(String|Vec|HashMap|BTreeMap|HashSet|BTreeSet)\b/.test(t)}function ct(e,t){let r=new Map,n=(p,l)=>{if(p===l)return;let u=r.get(p);u||(u=new Set,r.set(p,u)),u.add(l)},s=t==="python"?new Set(["identifier"]):new Set(["type_identifier"]),o=(p,l)=>{let u=m=>{s.has(m.type)&&m.text!==l&&n(m.text,l);for(let d of m.children)u(d)};for(let m of p.children)u(m)};return t==="rust"?(()=>{for(let p of e.rootNode.descendantsOfType(["struct_item","enum_item","union_item","type_item"])){let l=p.namedChildren.find(m=>m.type==="type_identifier")?.text;if(!l)continue;let u=p.namedChildren.find(m=>m.type==="field_declaration_list"||m.type==="enum_variant_list"||m.type==="ordered_field_declaration_list");u&&o(u,l),p.type==="type_item"&&o(p,l)}})():t==="python"?(()=>{for(let p of e.rootNode.descendantsOfType("class_definition")){let l=p.namedChildren.find(d=>d.type==="identifier")?.text;if(!l)continue;let u=p.childForFieldName("superclasses");u&&o(u,l);let m=p.namedChildren.find(d=>d.type==="block");if(m)for(let d of m.descendantsOfType("type"))for(let P of d.descendantsOfType("identifier"))n(P.text,l)}})():(()=>{for(let p of e.rootNode.descendantsOfType(["interface_declaration","type_alias_declaration","class_declaration"])){let l=p.namedChildren.find(u=>u.type==="type_identifier")?.text;l&&o(p,l)}})(),r}var ar=new Map([["defn","function"],["defn-","function"],["defmacro","macro"],["defmacro-","macro"],["defmethod","method"]]),Ie=new Set(["catch","comment","def","defprotocol","defrecord","deftype","defmethod","defmacro","defmacro-","defn","defn-","do","doseq","dotimes","fn","for","if","let","loop","ns","quote","recur","throw","try","extend-protocol","extend-type","when","when-let","when-not"]);function lt(e){let t=[],r=[],n=[],s=new Map,o=[],i={line:0,index:0},a=(p,l)=>{let u=s.get(p);if(!u){s.set(p,[l]);return}u[u.length-1]!==l&&u.push(l)},c={callables:t,callSites:r,clojureMembers:n,recordIdentifier:a};for(;i.index<e.length;){let p=e[i.index];if(cr(e,p,i)||lr(p,i,o,c))continue;if(_e(p)){i.index+=1;continue}let l=pr(e,i);l&&(mr(o[o.length-1],l),a(F(l.text),l.line))}return{language:"clojure",callables:t,callSites:r,clojureMembers:n,typeContainerMap:new Map,identifierLineMap:s,identifiersByLine:yr(s),fileIdentifiers:new Set(s.keys()),rustAttrReferencedNames:new Set,crossLanguageDispatchNames:new Set}}function cr(e,t,r){if(t===`
|
|
6
|
+
`)r.line+=1,r.index+=1;else if(/\s|,/.test(t))r.index+=1;else if(t===";")r.index=le(e,r.index);else if(t==='"'){let n=Z(e,r.index,r.line);r.line=n.line,r.index=n.index}else return!1;return!0}function lr(e,t,r,n){if(e==="("||e==="["||e==="{")r.push({kind:e,startLine:t.line,endLine:t.line,headTokens:[],tokens:[],children:[]});else if(e===")"||e==="]"||e==="}"){let s=r.pop();s&&(s.endLine=t.line,ur(s,n),r[r.length-1]?.children.push(s))}else return!1;return t.index+=1,!0}function pr(e,t){let r=t.line,n=t.index;for(;t.index<e.length&&!Pe(e[t.index]);)t.index+=1;let s=e.slice(n,t.index);return s?{text:s,line:r,column:n-e.lastIndexOf(`
|
|
7
|
+
`,n-1)-1}:null}function ur(e,t){if(e.kind!=="("||e.headTokens.length===0)return;let r=e.headTokens[0],n=F(r.text),s=ar.get(r.text);if(s){let i=e.headTokens[1];if(i){let a=F(i.text);t.recordIdentifier(a,i.line),t.callables.push({name:a,startLine:e.startLine,endLine:e.endLine,paramCount:0,params:[],paramsEndLine:i.line,isLiteralPassthrough:!1,clojureKind:s})}}if(dr(e,t),!n||Ie.has(r.text)||Ie.has(n)||n.startsWith(":"))return;let o=hr(r.text);t.callSites.push({calleeLeaf:o.leaf,calleeQualifier:o.qualifier,calleeText:o.text,memberAccess:!1,line:r.line,targetRange:{startLine:r.line,startColumn:r.column,endLine:r.line,endColumn:r.column+r.text.length}})}function mr(e,t){e&&(e.headTokens.length<2&&e.headTokens.push(t),e.tokens.length<200&&e.tokens.push(t))}function dr(e,t){let r=F(e.tokens[0]?.text??"");if(r==="extend-protocol"){gr(e,t);return}let n=fr(r);if(!n)return;let s=F(e.tokens[1]?.text??"");if(s)for(let o of pt(e))Ce(t,s,n.ownerKind,o,n.memberKind)}function fr(e){switch(e){case"defprotocol":return{ownerKind:"protocol",memberKind:"protocol-method"};case"defrecord":return{ownerKind:"record",memberKind:"record-method"};case"deftype":return{ownerKind:"type",memberKind:"type-method"};case"extend-type":return{ownerKind:"extension",memberKind:"extension-method"};default:return null}}function gr(e,t){let r=F(e.tokens[1]?.text??"");for(let n of pt(e)){r&&Ce(t,r,"extension",n,"extension-method");let s=xr(e,n.startLine);s&&s!==r&&Ce(t,s,"extension",n,"extension-method")}}function pt(e){return e.children.filter(Sr)}function Sr(e){if(e.kind!=="(")return!1;let t=F(e.tokens[0]?.text??"");return!!(t&&!Ie.has(t)&&!t.startsWith(":"))}function Ce(e,t,r,n,s){let o=n.tokens[0],i=F(o?.text??"");!o||!i||(e.recordIdentifier(i,o.line),e.clojureMembers.push({ownerName:t,ownerKind:r,memberName:i,memberKind:s,startLine:n.startLine,endLine:n.endLine}))}function xr(e,t){let r=null;for(let n=2;n<e.tokens.length;n+=1){let s=e.tokens[n];if(s.line>t)break;let o=F(s.text);o&&!o.startsWith(":")&&(r=o)}return r}function F(e){return e.replace(/^#?['`~@]+/,"").split("/").pop()?.replace(/^\./,"")??""}function hr(e){let t=e.replace(/^#?['`~@]+/,""),r=t.lastIndexOf("/"),n=F(t);if(r<=0)return{leaf:n,text:t};let s=t.slice(0,r);return{leaf:n,qualifier:s,text:t}}function le(e,t){let r=t;for(;r<e.length&&e[r]!==`
|
|
8
|
+
`;)r+=1;return r}function Z(e,t,r){let n=t+1,s=r;for(;n<e.length;){let o=e[n];if(o==="\\"){n+=2;continue}if(o===`
|
|
9
|
+
`&&(s+=1),n+=1,o==='"')break}return{index:n,line:s}}function _e(e){return e==="'"||e==="`"||e==="~"||e==="@"||e==="^"||e==="#"}function Pe(e){return/\s|,/.test(e)||e==="("||e===")"||e==="["||e==="]"||e==="{"||e==="}"||e==='"'||e===";"}function yr(e){let t=[];for(let[r,n]of e)for(let s of n)t[s]??=new Set,t[s].add(r);return t}var ut=15,Nr=Ue("source-facts",{clearGroups:["whole-project","source-file"]}),Re=G({kind:"source-facts",invalidation:X("source-facts"),serialize:Pr,deserialize:Rr});function T(e,t){return Ir(e,t).facts}function Ir(e,t){let r=w(e,t);if(!r)return{facts:null};let n=Cr(e,t,r);return n?Nr.get(e,t,r,()=>_r(e,t,n,r)):{facts:null}}function Cr(e,t,r){return Q(t)?Qe(e,t,r)?.language??null:k(t)}function _r(e,t,r,n){let s=K(e,t,n),o=Re.read(e,t,s);if(o&&o.language===r)return{facts:o};if(r==="clojure"){let c=lt(n);return Re.write(e,t,s,c),{facts:c}}let i=R(e,t);if(!i)return{facts:null,unavailable:{language:r,reason:"parser-unavailable"}};let a=Ar(i,r);return Re.write(e,t,s,a),{facts:a}}function Pr(e){let t={version:ut,language:e.language,callables:e.callables,callSites:e.callSites,clojureMembers:e.clojureMembers,typeContainerMap:[...e.typeContainerMap.entries()].map(([r,n])=>[r,[...n]]),identifierLineMap:[...e.identifierLineMap.entries()],rustAttrReferencedNames:[...e.rustAttrReferencedNames],crossLanguageDispatchNames:[...e.crossLanguageDispatchNames]};return JSON.stringify(t)}function Rr(e){try{let t=JSON.parse(e);if(t.version!==ut||t.language==="clojure"&&(t.clojureMembers===void 0||t.callSites.some(n=>n.calleeText===void 0)))return null;let r=new Map(t.identifierLineMap);return{language:t.language,callables:t.callables,callSites:t.callSites,clojureMembers:t.clojureMembers??[],typeContainerMap:new Map(t.typeContainerMap.map(([n,s])=>[n,new Set(s)])),identifierLineMap:r,identifiersByLine:Ne(r),fileIdentifiers:new Set(r.keys()),rustAttrReferencedNames:new Set(t.rustAttrReferencedNames),crossLanguageDispatchNames:new Set(t.crossLanguageDispatchNames)}}catch{return null}}function Fr(e,t,r,n){let s=T(e,t);return s?Er(s,r,n)?.isLiteralPassthrough??!0:!0}function Tr(e,t){return t.relativePath.includes(".clj-kondo/hooks/")?!0:T(e,t.relativePath)?.callables.find(n=>n.startLine===t.startLine&&n.endLine===t.endLine)?.clojureKind==="macro"}function Er(e,t,r){return e.callables.find(n=>n.startLine===t&&n.endLine===r)??null}function Ar(e,t){let r=[],n=[],s=new Set,o=new Set,i=new Map,a=(l,u)=>{let m=i.get(l);if(!m){i.set(l,[u]);return}m[m.length-1]!==u&&m.push(u)},c=[],p=l=>{let u=oe(l,t);u&&(u.branches=0,r.push(u),c.push(u));let m=rt(l);if(m>0)for(let P of c)P.branches=(P.branches??0)+m;let d=ie(l,t);d&&n.push(d),it(l,t,o),Lr(l,t,s,a);for(let P of l.children)p(P);u&&c.pop()};return p(e.rootNode),{language:t,callables:r,callSites:n,clojureMembers:[],typeContainerMap:ct(e,t),identifierLineMap:i,identifiersByLine:Ne(i),fileIdentifiers:new Set(i.keys()),rustAttrReferencedNames:s,crossLanguageDispatchNames:o}}function Lr(e,t,r,n){t==="rust"&&(e.type==="attribute_item"||e.type==="inner_attribute_item")&&at(e.text,r),nt(e,t)&&n(e.text,e.startPosition.row),st(e,t)&&ot(e,n)}var dt=new Set(["rust","typescript","tsx","javascript","python","clojure"]),wr=new Set(["rust","typescript","tsx","javascript","python"]),ft=new Set(["typescript","tsx","javascript"]),Fe=new WeakMap,mt=new WeakMap;function kr(e,t){let r=T(e,t);return!r||!dt.has(r.language)?null:r.callables.map(n=>({name:n.name,startLine:n.startLine,endLine:n.endLine}))}function jr(e,t){return gt(e,t)?.map(({name:r,startLine:n,endLine:s})=>({name:r,startLine:n,endLine:s}))??null}function gt(e,t){if(!wr.has(t))return null;let r=Fe.get(e)?.get(t);if(r)return r;let n=[];for(let o of ne(e,[...Ye(t)])){let i=oe(o,t);i&&n.push({...i,branches:void 0})}let s=Fe.get(e)??new Map;return s.set(t,n),Fe.set(e,s),n}function ro(e,t){let r=k(t);if(!r||!ft.has(r))return T(e,t)?.callables??null;let n=R(e,t)?.rootNode;return n?gt(n,r):null}function Dr(e,t){let r=k(t);if(r&&ft.has(r)){let s=R(e,t)?.rootNode;if(!s)return null;let o=mt.get(s);if(o)return o;let i=ne(s,["call_expression","new_expression","jsx_opening_element","jsx_self_closing_element"]).flatMap(a=>{let c=ie(a,r);return c?[c]:[]});return mt.set(s,i),i}let n=T(e,t);return!n||!dt.has(n.language)?null:n.callSites}function Or(e,t,r={}){let n=T(e,t);if(!n)return[];let s=[];if(r.includeCrossLanguageDispatchNames)for(let o of n.crossLanguageDispatchNames)s.push({name:o,kind:"cross-language-dispatch",occurrences:1});if(r.includeRustAttributeNames&&n.language==="rust")for(let o of n.rustAttrReferencedNames)s.push({name:o,kind:"rust-attribute",occurrences:1});return s}import{basename as St}from"path";var Mr=new Set(["identifier","type_identifier","property_identifier","shorthand_property_identifier","field_identifier"]);function h(e){let t=[],r=0,n=0;for(let s=0;s<e.length;s++){let o=e[s];(o==="{"||o==="["||o==="(")&&r++,(o==="}"||o==="]"||o===")")&&r--,o===","&&r===0&&(t.push(e.slice(n,s)),n=s+1)}return t.push(e.slice(n)),t}function y(e,t){for(let r of e.namedChildren)if(r.type===t)return r;return null}function g(e,t){let r=new Set,n=(s,o)=>{let i=o||t.has(s.type);!i&&Mr.has(s.type)&&r.add(s.text);for(let a of s.children)n(a,i)};return n(e.rootNode,!1),r}function _(e,t,r,n,s,o,i){return{importedName:s,localName:o,sourcePath:i??S(e,n,Ge(t)),kind:"named",used:x(r,o),usedMembers:[]}}function f(e,t,r,n,s="named",o={}){return{importedName:e,localName:t,sourcePath:r,kind:s,used:n.has(t),usedMembers:[],isTypeOnly:o.isTypeOnly}}function E(e,t,r,n,s="named",o=[],i={}){return{importedName:e,localName:t,sourcePath:r,kind:s,used:n,usedMembers:o,isTypeOnly:i.isTypeOnly}}function v(e,t){return{importedName:e,localName:null,sourcePath:t,kind:"side-effect",used:!0,usedMembers:[]}}function $(e,t,r={}){return{importedName:e,localName:r.localName??null,sourcePath:t,kind:"namespace",used:r.used??!0,usedMembers:r.usedMembers??[],isTypeOnly:r.isTypeOnly}}function b(e,t,r){let n=[];for(let s of e.matchAll(t)){let o=s[0];if(!o||typeof s.index!="number")continue;let i=D(e,s.index,s.index+o.length);for(let a of r(s,i))n.push(a)}return n}function N(e,t,r,n,s){let o=se(e,t,s);if(o){let i=r(o);if(i)return i}return n()}function pe(e,t,r,n,s){let o=se(e,t,s),i=k(t),a=i?r[i]:void 0;return o&&a?a(o):n()}function xt(e,t,r){return N(e,t,n=>$r(e,t,n),()=>vr(e,t,r),r)}function vr(e,t,r){return b(r,/^[ \t]*#include\s+[<"]([^">]+)[">]\s*$/gm,(n,s)=>{let o=n[1]?.trim();if(!o)return[];let i=St(o).replace(/\.[^.]+$/,"");return[E(o,i,Se(e,t,o),x(s,i))]})}function $r(e,t,r){let n=g(r,new Set(["preproc_include"])),s=[];for(let o of r.rootNode.descendantsOfType("preproc_include")){let i=null;for(let c of o.namedChildren){if(c.type==="system_lib_string"){i=c.text.replace(/^<|>$/g,"");break}if(c.type==="string_literal"){i=c.namedChildren.find(l=>l.type==="string_content")?.text??c.text.replace(/^"|"$/g,"");break}}if(!i)continue;let a=St(i).replace(/\.[^.]+$/,"");s.push(f(i,a,Se(e,t,i),n))}return s}var Ur=new Set([":require",":require-macros",":use"]),Ee=String.raw`A-Za-z0-9_$*+!?.<>=-`;function yt(e,t,r){let n=en(r);if(!n)return[];let s=Zr(r,n.start,n.end),o=[];for(let i of n.children.slice(2)){if(i.type!=="list"||i.children.length===0)continue;let a=I(i.children[0]);if(a)for(let c of Br(e,i,a,s))o.push(c)}return o}function Br(e,t,r,n){let s=[];if(Ur.has(r)){for(let o of zr(t.children.slice(1)))s.push(...Vr(e,o,n));return s}if(r===":import")for(let o of Jr(t.children.slice(1)))s.push(o);return s}function qr(e){return e.type==="list"&&I(e.children[0])==="ns"}function Vr(e,t,r){let n=Xe(e,t.namespace),s=t.alias??t.namespace,o=Xr(r,s),i=[{importedName:t.namespace,localName:s,sourcePath:n,kind:"namespace",used:t.refers.length>0||t.referAll||o.length>0||Qr(r,t.namespace),usedMembers:o}];t.referAll&&i.push({importedName:"*",localName:null,sourcePath:n,kind:"side-effect",used:!0,usedMembers:[]});for(let a of t.refers)i.push({importedName:a,localName:a,sourcePath:n,kind:"named",used:Yr(r,a),usedMembers:[]});return i}function zr(e){return e.flatMap(t=>ue(t,null))}function ue(e,t){return e.type==="atom"?e.text.startsWith(":")?[]:[{namespace:Ae(t,e.text),alias:null,refers:[],referAll:!1}]:e.type==="vector"?e.children.length>0&&I(e.children[0])===null?e.children.flatMap(r=>ue(r,t)):Hr(e,t):e.type==="list"?Wr(e,t):[]}function Wr(e,t){if(e.children.length===0)return[];let r=I(e.children[0]);return r?r.startsWith(":")?[]:e.children.slice(1).flatMap(n=>ue(n,Ae(t,r))):e.children.flatMap(n=>ue(n,t))}function Kr(e,t){I(t)===":all"?e.referAll=!0:(t.type==="vector"||t.type==="list")&&e.refers.push(...t.children.map(I).filter(Gr))}function Hr(e,t){let r=I(e.children[0]);if(!r||r.startsWith(":"))return[];let n={namespace:Ae(t,r),alias:null,refers:[],referAll:!1};for(let s=1;s<e.children.length;s+=1){let o=I(e.children[s]);if(!o?.startsWith(":"))continue;let i=e.children[s+1];if((o===":as"||o===":as-alias")&&i){n.alias=I(i),s+=1;continue}o===":refer"&&i&&(Kr(n,i),s+=1)}return[n]}function Jr(e){let t=[];for(let r of e){if(r.type==="atom"){let s=r.text.split(".").pop()??r.text;t.push(E(s,s,null,!0));continue}if(r.type!=="vector")continue;let n=I(r.children[0]);if(n)for(let s of r.children.slice(1)){let o=I(s);o&&t.push(E(`${n}.${o}`,o,null,!0))}}return t}function Ae(e,t){return e?`${e}.${t}`:t}function I(e){return e?.type==="atom"?e.text:null}function Gr(e){return!!(e&&!e.startsWith(":"))}function Xr(e,t){let r=new Set,n=new RegExp(`${Le()}${M(t)}\\s*/\\s*([${Ee}]+)`,"g");for(let s of e.matchAll(n)){let o=s[1];o&&r.add(o)}return[...r]}function Qr(e,t){return new RegExp(`${Le()}${M(t)}\\s*/`,"m").test(e)}function Yr(e,t){return new RegExp(`${Le()}${M(t)}(?![${Ee}])`,"m").test(e)}function Le(){return`(?<![${Ee}])`}function Zr(e,t,r){let n="",s=0;for(;s<e.length;){if(s>=t&&s<r){n+=e[s]===`
|
|
10
|
+
`?`
|
|
11
|
+
`:" ",s+=1;continue}let o=e[s];if(o===";"){let i=le(e,s);n+=ht(e.slice(s,i)),s=i;continue}if(o==='"'){let i=Z(e,s,0).index;n+=ht(e.slice(s,i)),s=i;continue}n+=o,s+=1}return n}function en(e){let t=0;for(;t<e.length&&(t=we(e,t),!(t>=e.length));){let r=me(e,t);if(!r){t+=1;continue}if(qr(r.form))return r.form;t=r.index}return null}function me(e,t){let r=we(e,t);if(e.startsWith("#?@",r)||e.startsWith("#?",r))return rn(e,r);if(e.startsWith("#_",r)){let n=me(e,r+2);return n?{form:{type:"atom",text:"",start:r,end:n.index},index:n.index}:null}for(;_e(e[r]);)r+=1;return tn(e,r)}function tn(e,t){let r=e[t];return r?r==="("?Te(e,t,"list",")"):r==="["?Te(e,t,"vector","]"):r==="{"?Te(e,t,"map","}"):r==='"'?{form:{type:"atom",text:"",start:t,end:Z(e,t,0).index},index:Z(e,t,0).index}:sn(e,t):null}function rn(e,t){let r=e.startsWith("#?@",t)?3:2,n=me(e,t+r);return n?{form:{type:"list",children:n.form.type==="list"||n.form.type==="vector"||n.form.type==="map"?nn(n.form.children):[],start:t,end:n.index},index:n.index}:null}function nn(e){let t=[];for(let r=0;r<e.length;r+=2){let n=I(e[r]),s=e[r+1];n?.startsWith(":")&&s&&t.push(s)}return t}function Te(e,t,r,n){let s=[],o=t+1;for(;o<e.length;){if(o=we(e,o),e[o]===n)return{form:{type:r,children:s,start:t,end:o+1},index:o+1};let i=me(e,o);if(!i){o+=1;continue}i.form.type==="atom"&&i.form.text===""||s.push(i.form),o=i.index}return{form:{type:r,children:s,start:t,end:e.length},index:e.length}}function sn(e,t){let r=t;for(;r<e.length&&!Pe(e[r]);)r+=1;return{form:{type:"atom",text:e.slice(t,r),start:t,end:r},index:r}}function we(e,t){let r=t;for(;r<e.length;){let n=e[r];if(/\s|,/.test(n)){r+=1;continue}if(n===";"){r=le(e,r);continue}break}return r}function ht(e){return e.replace(/[^\r\n]/g," ")}function bt(e,t,r){let n=[];for(let s of r.matchAll(/^[ \t]*import\s+['"]([^'"]+)['"](?:\s+as\s+([A-Za-z_]\w*))?[\s\S]*?;$/gm)){let o=s[1]?.trim(),i=s[2]?.trim()??null,a=s[0];if(!o||!a||typeof s.index!="number")continue;let c=D(r,s.index,s.index+a.length);n.push({importedName:o,localName:i,sourcePath:xe(e,t,o),kind:i?"namespace":"side-effect",used:i?x(c,i):!0,usedMembers:i?V(c,i):[]})}return n}function Nt(e,t,r){let n=[];for(let s of r.matchAll(/^[ \t]*export\s+['"]([^'"]+)['"][\s\S]*?;$/gm)){let o=s[1]?.trim();o&&n.push({specifier:o,sourcePath:xe(e,t,o)})}return n}function It(e,t,r){return pe(e,t,{csharp:n=>an(e,t,n),vb:n=>on(e,t,n)},()=>{let n=Je(t)?/^[ \t]*Imports\s+(.+?)\s*$/gm:/^[ \t]*using\s+(.+?)\s*;$/gm;return b(r,n,(s,o)=>{let i=s[1]?.trim();if(!i)return[];let[a,c]=i.split(/\s*=\s*/),p=!!c,l=(p?c:a)?.trim()??i,u=l.split(".").pop()??l,m=p?a?.trim()??u:u;return[_(e,t,o,l,u,m,S(e,l,q))]})},r)}function on(e,t,r){let n=g(r,new Set(["imports_statement"])),s=[];for(let o of r.rootNode.descendantsOfType("imports_statement")){let i=o.namedChildren.filter(m=>m.type==="namespace_name");if(i.length===0)continue;let a=i[i.length-1],c=i.length>1?i[0]:null,p=a.text,l=p.split(".").pop()??p,u=c?.text??l;s.push(f(l,u,S(e,p,q),n,c?"namespace":"named"))}return s}function an(e,t,r){let n=g(r,new Set(["using_directive"])),s=[];for(let o of r.rootNode.descendantsOfType("using_directive")){let i=o.namedChildren;if(i.length===0)continue;let a=null,c;i.length>=2&&i[0].type==="identifier"&&(i[1].type==="qualified_name"||i[1].type==="identifier")?(a=i[0],c=i[1]):c=i[i.length-1];let p=c.text,l=p.split(".").pop()??p,u=a?.text??l;s.push(f(l,u,S(e,p,q),n,a?"namespace":"named"))}return s}var cn=B("vue-non-script-identifiers",{clearGroups:["whole-project","source-file"]});function Ct(e,t){return cn.get(e,t,()=>{let r=new Set,n=w(e,t);if(!n)return r;let o=n.replace(/<script\b[^>]*>[\s\S]*?<\/script>/g,i=>i.replace(/[^\r\n]/g," ")).replace(/<!--[\s\S]*?-->/g,i=>i.replace(/[^\r\n]/g," ")).replace(/\/\*[\s\S]*?\*\//g,i=>i.replace(/[^\r\n]/g," "));for(let i of o.matchAll(/[A-Za-z_$][\w$]*/g))r.add(i[0]);return r})}function ke(e,t,r){return N(e,t,n=>pn(e,t,n),()=>ln(e,t,r),r)}function ln(e,t,r){return Nn(r).flatMap(n=>In(e,t,n.clause,n.specifier,n.start,n.end,r))}function pn(e,t,r){let n=un(e,t,r),s=[];for(let o of r.rootNode.descendantsOfType("import_statement"))s.push(...mn(e,t,r,o,n));return s}function un(e,t,r){let n=g(r,new Set(["import_statement"]));if(Q(t))for(let s of Ct(e,t))n.add(s);return n}function mn(e,t,r,n,s){let o=xn(n);if(!o)return[];let i=A(e,t,o),a=y(n,"import_clause");return a?dn(r,a,i,s,hn(n.text)):[v("*",i)]}function dn(e,t,r,n,s){let o=[];for(let i of t.namedChildren)if(i.type==="identifier")o.push(fn(i.text,r,n,s));else if(i.type==="namespace_import"){let a=gn(e,i,r,n,s);a&&o.push(a)}else i.type==="named_imports"&&o.push(...Sn(i,r,n,s));return o}function fn(e,t,r,n){return f("default",e,t,r,"default",{isTypeOnly:n})}function gn(e,t,r,n,s){let i=y(t,"identifier")?.text??"";if(!i)return null;let a=bn(e,i);return $("*",r,{localName:i,usedMembers:a,isTypeOnly:s,used:a.length>0||n.has(i)})}function Sn(e,t,r,n){let s=[];for(let o of e.namedChildren){if(o.type!=="import_specifier")continue;let i=o.namedChild(0),a=o.namedChild(1);if(!i)continue;let c=i.text,p=a?.text??c;s.push(f(c,p,t,r,"named",{isTypeOnly:n||yn(o.text)}))}return s}function xn(e){let t=y(e,"string");if(!t)return null;let r=y(t,"string_fragment");return r?r.text:null}function hn(e){return/^\s*import\s+type\b/.test(e)}function yn(e){return/^\s*type\b/.test(e.trim())}function bn(e,t){let r=new Set;for(let n of e.rootNode.descendantsOfType("member_expression")){let s=n.namedChild(0),o=n.namedChild(1);!s||!o||s.type!=="identifier"||s.text!==t||(o.type==="property_identifier"||o.type==="identifier")&&r.add(o.text)}return[...r]}function Nn(e){let t=[],r=/^[ \t]*import\s+([\s\S]*?)\s+from\s+['"]([^'"]+)['"]\s*;?/gm;for(let s of e.matchAll(r)){let o=s[0],i=s[1],a=s[2];!o||!a||typeof s.index!="number"||t.push({clause:i,specifier:a,start:s.index,end:s.index+o.length})}let n=/^[ \t]*import\s+['"]([^'"]+)['"]\s*;?/gm;for(let s of e.matchAll(n)){let o=s[0],i=s[1];!o||!i||typeof s.index!="number"||t.push({clause:null,specifier:i,start:s.index,end:s.index+o.length})}return t.sort((s,o)=>s.start-o.start)}function In(e,t,r,n,s,o,i){let a=A(e,t,n),c=D(i,s,o);return r?Cn(r).map(l=>({...l,sourcePath:a})).map(l=>{if(l.kind==="namespace"){let u=V(c,l.localName);return $(l.importedName,l.sourcePath,{localName:l.localName,usedMembers:u,used:u.length>0||x(c,l.localName),isTypeOnly:l.isTypeOnly})}return l.kind==="side-effect"?v(l.importedName,l.sourcePath):E(l.importedName,l.localName??"",l.sourcePath,l.localName?x(c,l.localName):!1,l.kind,[],{isTypeOnly:l.isTypeOnly})}):[v("*",a)]}function Cn(e){let t=e.trim(),r=/^type\b/.test(t),n=t.replace(/^type\s+/,""),[s,o]=_n(n),i=[];return s&&i.push(..._t(s,r)),o&&i.push(..._t(o,r)),i}function _t(e,t){let r=e.trim();if(!r)return[];if(r.startsWith("{")){let n=r.slice(1,-1).trim();return n?h(n).map(s=>{let o=s.trim(),i=t||/^type\b/.test(o),a=o.replace(/^type\s+/,""),[c,p]=a.split(/\s+as\s+/);return{importedName:c.trim(),localName:(p??c).trim(),kind:"named",isTypeOnly:i}}):[]}return r.startsWith("* as ")?[{importedName:"*",localName:r.slice(5).trim(),kind:"namespace",isTypeOnly:t}]:[{importedName:"default",localName:r,kind:"default",isTypeOnly:t}]}function _n(e){let t=0;for(let r=0;r<e.length;r++){let n=e[r];if(n==="{"&&t++,n==="}"&&t--,n===","&&t===0)return[e.slice(0,r).trim(),e.slice(r+1).trim()]}return[e.trim(),null]}function je(e,t,r){let n=R(e,t);return n?An(e,t,n):Pn(e,t,r)}function Pn(e,t,r){return[...Rn(e,t,r),...Fn(e,t,r),...Tn(e,t,r)]}function Rn(e,t,r){let n=[],s=/^[ \t]*export\s+(?:type\s+)?\{([\s\S]*?)\}\s+from\s+['"]([^'"]+)['"]\s*;?/gm;for(let o of r.matchAll(s)){if(typeof o.index!="number")continue;let i=o[1]??"",a=o[2]??"",c=h(i).map(u=>En(u.trim())).filter(u=>!!u),p=z(r,o.index),l=z(r,o.index+o[0].length-1);n.push({kind:"named",sourcePath:A(e,t,a),names:c,startLine:p,endLine:l})}return n}function Fn(e,t,r){let n=[],s=/^[ \t]*export\s+\*\s+as\s+(\w+)\s+from\s+['"]([^'"]+)['"]\s*;?/gm;for(let o of r.matchAll(s)){if(typeof o.index!="number")continue;let i=o[2]??"",a=z(r,o.index),c=z(r,o.index+o[0].length-1);n.push({kind:"star-as",sourcePath:A(e,t,i),names:o[1]?[o[1]]:[],startLine:a,endLine:c})}return n}function Tn(e,t,r){let n=[],s=/^[ \t]*export\s+\*\s+from\s+['"]([^'"]+)['"]\s*;?/gm;for(let o of r.matchAll(s)){if(typeof o.index!="number")continue;let i=o[1]??"",a=z(r,o.index),c=z(r,o.index+o[0].length-1);n.push({kind:"star",sourcePath:A(e,t,i),names:[],startLine:a,endLine:c})}return n}function En(e){if(!e)return null;let t=e.replace(/^type\s+/,"").trim();if(!t)return null;let r=t.match(/^(\w+)\s+as\s+(\w+)$/);if(r)return r[2]??null;let n=t.match(/^(\w+)$/);return n?n[1]??null:null}function z(e,t){let r=0;for(let n=0;n<t&&n<e.length;n++)e.charCodeAt(n)===10&&r++;return r}function An(e,t,r){let n=[];for(let s of r.rootNode.descendantsOfType("export_statement")){let o=Ln(e,t,s);if(o===void 0)continue;let i=s.startPosition.row,a=s.endPosition.row,c=wn(s,o,i,a);n.push(c)}return n}function Ln(e,t,r){let n=y(r,"string");if(!n)return;let s=y(n,"string_fragment");if(s)return A(e,t,s.text)}function wn(e,t,r,n){let s=y(e,"export_clause");if(s){let i=[];for(let a of s.namedChildren){if(a.type!=="export_specifier")continue;let c=a.namedChild(0),p=a.namedChild(1);c&&i.push((p??c).text)}return{kind:"named",sourcePath:t,names:i,startLine:r,endLine:n}}let o=y(e,"namespace_export");if(o){let i=o.namedChildren.find(a=>a.type==="identifier"||a.type==="type_identifier")?.text;return{kind:"star-as",sourcePath:t,names:i?[i]:[],startLine:r,endLine:n}}return{kind:"star",sourcePath:t,names:[],startLine:r,endLine:n}}function Pt(e,t,r){return pe(e,t,{java:n=>kn(e,t,n),kotlin:n=>jn(e,t,n),scala:n=>Dn(e,t,n)},()=>b(r,/^[ \t]*import\s+(?:static\s+)?(.+?)\s*;?$/gm,(n,s)=>{let o=n[1]?.trim();return o?vn(e,t,o,s):[]}),r)}function kn(e,t,r){let n=g(r,new Set(["import_declaration"])),s=[];for(let o of r.rootNode.descendantsOfType("import_declaration")){let i=o.children.some(u=>u.type==="asterisk"),c=o.namedChildren.find(u=>u.type==="scoped_identifier")??o.namedChildren.find(u=>u.type==="identifier");if(!c)continue;let p=c.text;if(i){s.push($("*",S(e,p,C)));continue}let l=p.split(".").pop()??p;s.push(f(l,l,S(e,p,C),n))}return s}function jn(e,t,r){let n=g(r,new Set(["import_header","import_list"])),s=[];for(let o of r.rootNode.descendantsOfType("import_header")){let i=o.namedChildren.find(d=>d.type==="identifier");if(!i)continue;let a=o.namedChildren.some(d=>d.type==="wildcard_import"),c=o.namedChildren.find(d=>d.type==="import_alias");if(a){s.push($("*",S(e,i.text,C)));continue}let p=i.text,l=p.split(".").pop()??p,m=c?.namedChild(0)?.text??l;s.push(f(l,m,S(e,p,C),n))}return s}function Dn(e,t,r){let n=g(r,new Set(["import_declaration"])),s=[];for(let o of r.rootNode.descendantsOfType("import_declaration")){let i=o.namedChildren.find(p=>p.type==="namespace_selectors"||p.type==="namespace_wildcard"),a=o.namedChildren.filter(p=>p!==i&&(p.type==="identifier"||p.type==="stable_identifier")),c=a.map(p=>p.text).join(".");if(c){if(i?.type==="namespace_wildcard"){s.push($("*",S(e,c,C)));continue}if(i?.type==="namespace_selectors"){for(let p of i.namedChildren){let l=Mn(e,c,p,n);l&&s.push(l)}continue}s.push(On(e,c,a,n))}}return s}function On(e,t,r,n){let s=r[r.length-1]?.text??t,o=r.slice(0,-1).map(i=>i.text).join(".")||t;return f(s,s,S(e,o&&r.length>1?`${o}.${s}`:t,C),n)}function Mn(e,t,r,n){if(r.type==="arrow_renamed_identifier"){let[o,i]=r.namedChildren;if(!o)return null;let a=o.text,c=i?.text??a;return a==="_"?null:f(a,c,S(e,`${t}.${a}`,C),n)}if(r.type!=="identifier")return null;let s=r.text;return f(s,s,S(e,`${t}.${s}`,C),n)}function vn(e,t,r,n){if(r.includes("{")&&r.includes("}")){let s=r.slice(0,r.indexOf("{")).replace(/\.$/,"").trim(),o=r.slice(r.indexOf("{")+1,r.lastIndexOf("}")).trim();return h(o).flatMap(i=>{let a=i.trim();if(!a)return[];let[c,p]=a.includes("=>")?a.split(/\s*=>\s*/):a.split(/\s+as\s+/),l=c?.trim();if(!l||l==="_")return[];let u=(p??l.split(".").pop()??l).trim(),m=l==="_"?s:`${s}.${l}`.replace(/\.\./g,".");return[_(e,t,n,m,l,u)]})}return[_(e,t,n,r,r.split(".").pop()??r,r.split(".").pop()??r)]}function Ft(e,t,r){return N(e,t,n=>$n(e,t,n),()=>b(r,/^[ \t]*use\s+(.+?)\s*;$/gm,(n,s)=>{let o=n[1]?.trim();return o?h(o).flatMap(i=>{let a=i.trim();if(!a)return[];let[c,p]=a.split(/\s+as\s+/i),l=c?.trim()??a,u=l.split("\\").pop()??l,m=(p??u).trim();return[_(e,t,s,l,u,m,S(e,l.replace(/\\/g,"."),H))]}):[]}),r)}function $n(e,t,r){let n=g(r,new Set(["namespace_use_declaration"])),s=[],o=(i,a,c)=>{s.push(f(a,c,S(e,i.replace(/\\/g,"."),H),n))};for(let i of r.rootNode.descendantsOfType("namespace_use_declaration")){let a=i.namedChildren.find(c=>c.type==="namespace_use_group");if(a){let c=i.namedChildren.find(p=>p.type==="namespace_name")?.text??"";Rt(a.namedChildren,c,o);continue}Rt(i.namedChildren,"",o)}return s}function Rt(e,t,r){for(let n of e){if(n.type!=="namespace_use_clause")continue;let{importedName:s,localName:o,qualified:i}=Un(n,t);s&&r(i,s,o)}}function Un(e,t){let r=e.namedChildren.find(p=>p.type==="qualified_name"),n=e.namedChildren.filter(p=>p.type==="name"),s="";r?s=r.text:n.length>=1&&(s=n[0].text);let o=r&&n.length>0?n[n.length-1]:null,i=s.split("\\").pop()??s,a=o?.text??i,c=t?`${t}\\${s}`:s;return{importedName:i,localName:a,qualified:c}}function Tt(e,t,r){return N(e,t,n=>Bn(e,t,n),()=>zn(r).flatMap(n=>Kn(e,t,n,r)),r)}function Bn(e,t,r){let n=g(r,new Set(["import_statement","import_from_statement"])),s=[];for(let o of r.rootNode.descendantsOfType("import_statement"))for(let i of o.namedChildren){let a=Et(i);if(!a)continue;let c=J(e,t,a.qualifiedName);s.push({importedName:a.qualifiedName,localName:a.localName,sourcePath:c,kind:"namespace",used:n.has(a.localName),usedMembers:[]})}for(let o of r.rootNode.descendantsOfType("import_from_statement")){let i=o.namedChild(0);if(!i)continue;let a=Vn(i);if(a===null)continue;let c=J(e,t,a);qn(o,c,n,s)}return s}function qn(e,t,r,n){for(let s=1;s<e.namedChildCount;s+=1){let o=e.namedChild(s);if(o.type==="wildcard_import"){n.push({importedName:"*",localName:null,sourcePath:t,kind:"side-effect",used:!0,usedMembers:[]});continue}let i=Et(o);i&&n.push({importedName:i.qualifiedName,localName:i.localName,sourcePath:t,kind:"named",used:r.has(i.localName),usedMembers:[]})}}function Et(e){if(e.type==="aliased_import"){let t=e.namedChild(0),r=e.namedChild(1);return!t||!r?null:{qualifiedName:t.text,localName:r.text}}if(e.type==="dotted_name"){let t=e.text;return{qualifiedName:t,localName:t.split(".")[0]??t}}return e.type==="identifier"?{qualifiedName:e.text,localName:e.text}:null}function Vn(e){if(e.type==="dotted_name")return e.text;if(e.type==="relative_import"){let t=y(e,"import_prefix")?.text??"",r=y(e,"dotted_name")?.text??"";return`${t}${r}`}return null}function zn(e){let t=e.split(`
|
|
12
|
+
`),r=[],n=0;for(let s=0;s<t.length;s++){let o=t[s],i=o.trimStart(),a=n;if(n+=o.length+1,!i.startsWith("import ")&&!i.startsWith("from "))continue;let c=o,p=a+o.length,l=be(o);for(;s+1<t.length&&(l>0||c.trimEnd().endsWith("\\"));){s++;let m=t[s];c+=`
|
|
13
|
+
${m}`,p+=1+m.length,l+=be(m),n+=m.length+1}let u=Wn(c);u&&r.push({...u,start:a,end:p})}return r}function Wn(e){let t=e.replace(/\\\s*\n/g," ").trim();if(t.startsWith("import "))return{kind:"import",module:null,clause:t.slice(7).trim()};let r=t.match(/^from\s+([.\w]+)\s+import\s+([\s\S]+)$/);if(!r)return null;let n=r[2].trim();return n.startsWith("(")&&n.endsWith(")")&&(n=n.slice(1,-1).trim()),{kind:"from",module:r[1],clause:n}}function Kn(e,t,r,n){let s=D(n,r.start,r.end),o=r.clause.replace(/\n/g," ").trim();if(r.kind==="import")return h(o).flatMap(c=>{let p=c.trim().replace(/,$/,"");if(!p)return[];let[l,u]=p.split(/\s+as\s+/),m=l.trim(),d=(u??m.split(".")[0]??m).trim(),P=J(e,t,m),re=V(s,d);return[{importedName:m,localName:d,sourcePath:P,kind:"namespace",used:x(s,d)||re.length>0,usedMembers:re}]});let i=r.module?J(e,t,r.module):null,a=[];for(let c of h(o)){let p=c.trim().replace(/,$/,"");if(!p)continue;if(p==="*"){a.push({importedName:"*",localName:null,sourcePath:i,kind:"side-effect",used:!0,usedMembers:[]});continue}let[l,u]=p.split(/\s+as\s+/),m=(u??l).trim();a.push({importedName:l.trim(),localName:m,sourcePath:i,kind:"named",used:x(s,m),usedMembers:[]})}return a}import{basename as Hn}from"path";function At(e,t,r){return N(e,t,n=>Gn(e,t,n),()=>Jn(e,t,r),r)}function Jn(e,t,r){return b(r,/^[ \t]*(require_relative|require)\s+["']([^"']+)["']\s*$/gm,(n,s)=>{let o=n[1],i=n[2];if(!o||!i)return[];let a=o==="require_relative"?ge(e,t,i):null;if(a){let c=Lt(i);return[E(c,c,a,x(s,c))]}return[v(i,a)]})}function Gn(e,t,r){let n=g(r,new Set([])),s=[],o=new Set(["require","require_relative","load"]);for(let i of r.rootNode.descendantsOfType("call")){let a=i.namedChild(0);if(!a||a.type!=="identifier"||!o.has(a.text))continue;let c=Xn(i);if(!c)continue;let p=a.text==="require_relative"?ge(e,t,c):null;if(p){let l=Lt(c);s.push(f(l,l,p,n))}else s.push(v(c,p))}return s}function Xn(e){let r=e.namedChildren.find(n=>n.type==="argument_list")?.namedChild(0);if(!(!r||r.type!=="string"))return r.namedChildren.find(n=>n.type==="string_content")?.text}function Lt(e){return Ze(Hn(e).replace(/\.[^.]+$/,""),/_/)}function wt(e,t,r){return N(e,t,n=>Qn(e,t,n),()=>b(r,/^[ \t]*use\s+(.+?)\s*;$/gm,(n,s)=>{let o=n[1]?.trim();return o?es(e,t,o,s):[]}),r)}function Qn(e,t,r){let n=g(r,new Set(["use_declaration"])),s=[];for(let o of r.rootNode.descendantsOfType("use_declaration")){let i=o.namedChild(0);if(i)for(let a of ee(i,"")){if(!a.importedName||a.importedName==="*")continue;let c=L(e,t,a.qualifiedName)??L(e,t,a.qualifiedName.split("::").slice(0,-1).join("::"));s.push(f(a.importedName,a.localName,c,n))}}return s}function ee(e,t){let r=Zn(e,t);if(r)return r;switch(e.type){case"scoped_use_list":return Yn(e,t);case"use_list":{let n=[];for(let s of e.namedChildren)n.push(...ee(s,t));return n}case"use_as_clause":{let n=e.namedChild(0),s=e.namedChild(1);if(!n||!s)return[];let o=ee(n,t),i=s.text;return o.map(a=>({...a,localName:i}))}case"use_wildcard":{let n=e.namedChild(0),s=n?n.text:"";return[{qualifiedName:de(t,`${s}::*`),importedName:"*",localName:"*"}]}default:return[]}}function Yn(e,t){let r=e.namedChild(0),n=e.namedChild(1);if(!r||!n)return[];let s=de(t,r.text),o=[];for(let i of n.namedChildren)o.push(...ee(i,s));return o}function Zn(e,t){switch(e.type){case"identifier":case"super":case"crate":{let r=e.text;return[{qualifiedName:de(t,r),importedName:r,localName:r}]}case"self":{let r=t.split("::").filter(Boolean).pop()??"self";return[{qualifiedName:t||"self",importedName:r,localName:r}]}case"scoped_identifier":{let r=e.text,n=r.split("::").pop()??r;return[{qualifiedName:de(t,r),importedName:n,localName:n}]}default:return null}}function de(e,t){return e?t?`${e}::${t}`:e:t}function es(e,t,r,n){let s=r.trim();if(s.includes("{")&&s.includes("}")){let l=s.slice(0,s.indexOf("{")).replace(/::$/,"").trim(),u=s.slice(s.indexOf("{")+1,s.lastIndexOf("}")).trim();return h(u).flatMap(m=>{let d=m.trim();if(!d)return[];if(d==="self"){let fe=l.split("::").filter(Boolean).pop();return fe?[_(e,t,n,l,fe,fe)]:[]}let[P,re]=d.split(/\s+as\s+/),U=P?.trim();if(!U)return[];let vt=(re??U.split("::").pop()??U).trim(),$t=`${l}::${U}`.replace(/::::/g,"::");return[_(e,t,n,$t,U.split("::").pop()??U,vt,L(e,t,l))]})}let[o,i]=s.split(/\s+as\s+/),a=o?.trim()??s,c=(i??a.split("::").pop()??a).trim(),p=L(e,t,a)??L(e,t,a.split("::").slice(0,-1).join("::"));return[_(e,t,n,a,a.split("::").pop()??a,c,p)]}function kt(e,t,r){let n=R(e,t);if(n)return ts(e,t,n);let s=[];for(let o of r.matchAll(/^[ \t]*pub\s+use\s+(.+?)\s*;$/gm)){let i=o[1]?.trim();i&&s.push(...ns(e,t,i))}return s}function ts(e,t,r){let n=[];for(let s of r.rootNode.descendantsOfType("use_declaration")){if(!rs(s))continue;let o=s.namedChildren.find(i=>i.type!=="visibility_modifier");if(o)for(let i of ee(o,""))i.importedName&&n.push(De(e,t,i.qualifiedName))}return n}function rs(e){for(let t of e.children)if(t.type==="visibility_modifier"&&t.text.startsWith("pub"))return!0;return!1}function ns(e,t,r){let n=r.trim();if(n.includes("{")&&n.includes("}")){let s=n.slice(0,n.indexOf("{")).replace(/::$/,"").trim(),o=n.slice(n.indexOf("{")+1,n.lastIndexOf("}")).trim();return h(o).flatMap(i=>{let a=i.trim();if(!a||a==="self")return[];let[c]=a.split(/\s+as\s+/),p=`${s}::${c?.trim()??a}`.replace(/::::/g,"::");return[De(e,t,p)]})}return[De(e,t,n)]}function De(e,t,r){return{specifier:r,sourcePath:L(e,t,r)??L(e,t,r.split("::").slice(0,-1).join("::"))}}function O({language:e,extensions:t,imports:r,parseImports:n}){return{language:e,extensions:t,capabilities:{imports:r},parseImports:n}}function jt(e,t){let r=t.toLowerCase();for(let n of e)for(let s of n.extensions)if(r.endsWith(s))return n;return null}var ss={language:"javascript",extensions:Be,capabilities:{imports:"ast-with-regex-fallback",reExports:"ast-with-regex-fallback"},parseImports:ke,parseReExports:je},os=O({language:"python",extensions:qe,imports:"ast-with-regex-fallback",parseImports:Tt}),is=O({language:"jvm",extensions:C,imports:"ast-dispatch-with-regex-fallback",parseImports:Pt}),as={language:"rust",extensions:Ve,capabilities:{imports:"ast-with-regex-fallback",exports:"ast-with-regex-fallback"},parseImports:wt,parseExports:kt},cs=O({language:"ruby",extensions:ze,imports:"ast-with-regex-fallback",parseImports:At}),ls=O({language:"c/cpp",extensions:We,imports:"ast-with-regex-fallback",parseImports:xt}),ps=O({language:"dotnet",extensions:q,imports:"ast-dispatch-with-regex-fallback",parseImports:It}),us={language:"dart",extensions:Ke,capabilities:{imports:"regex-only",exports:"regex-only"},parseImports:bt,parseExports:Nt},ms=O({language:"php",extensions:H,imports:"ast-with-regex-fallback",parseImports:Ft}),ds=O({language:"clojure",extensions:He,imports:"regex-only",parseImports:yt}),fs=[ss,os,is,as,cs,ls,ps,us,ms,ds];function te(e){return jt(fs,e)}var Oe={clearGroups:["whole-project","source-file"]},gs=B("source-imports",Oe),Ss=B("source-exports",Oe),xs=B("source-reexports",Oe),Dt=G({kind:"source-imports",invalidation:X("source-imports"),serialize:ys,deserialize:bs}),Ot=G({kind:"source-reexports",invalidation:X("source-reexports"),serialize:Ns,deserialize:Is});function Xi(e,t){let r=W(t);return xs.get(e,r,()=>{let n=te(r);if(!n?.parseReExports)return[];let s=w(e,r);if(!s)return[];let o=K(e,r,s),i=he(e),a=Ot.read(e,r,o);if(a?.resolutionFingerprint===i)return a.reExports;let c=n.parseReExports(e,r,s);return Ot.write(e,r,o,{resolutionFingerprint:i,reExports:c}),c})}function hs(e,t){let r=W(t);return gs.get(e,r,()=>{let n=te(r);if(!n)return[];let s=w(e,r);return s?Mt(e,r,s,n):[]})}function Qi(e,t){let r=W(t),n=te(r);if(!n)return[];let s;try{s=Me(e.config.projectRoot,r,{inputKind:"indexed source file"})}catch(o){if(ve(o))return[];throw o}return Mt(e,r,s,n)}function Mt(e,t,r,n){let s=K(e,t,r),o=he(e),i=Dt.read(e,t,s);if(i?.resolutionFingerprint===o)return i.imports;let a=n.parseImports(e,t,r);return Dt.write(e,t,s,{parserVersion:2,resolutionFingerprint:o,imports:a}),a}function Yi(e,t,r){let n=hs(e,t).filter(s=>s.kind==="named"&&s.isTypeOnly!==!0&&s.localName===r&&s.sourcePath!==null);return n.length===1?n[0]:null}function Zi(e,t){let r=W(t);return Ss.get(e,r,()=>{let n=te(r);if(!n?.parseExports)return[];let s=w(e,r);return s?n.parseExports(e,r,s):[]})}function ys(e){return JSON.stringify(e)}function bs(e){try{let t=JSON.parse(e);return!ye(t)||t.parserVersion!==2||typeof t.resolutionFingerprint!="string"||!Array.isArray(t.imports)?null:{parserVersion:2,resolutionFingerprint:t.resolutionFingerprint,imports:t.imports}}catch{return null}}function Ns(e){return JSON.stringify(e)}function Is(e){try{let t=JSON.parse(e);return!ye(t)||typeof t.resolutionFingerprint!="string"||!Array.isArray(t.reExports)?null:{resolutionFingerprint:t.resolutionFingerprint,reExports:t.reExports}}catch{return null}}export{M as a,Ut as b,Rs as c,Fs as d,be as e,rt as f,T as g,Ir as h,Fr as i,Tr as j,kr as k,jr as l,gt as m,ro as n,Dr as o,Or as p,de as q,Xi as r,hs as s,Qi as t,Yi as u,Zi as v};
|
|
14
|
+
//# sourceMappingURL=chunk-7WTPQ4NX.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{setFlagsFromString as r}from"v8";import{runInNewContext as i}from"vm";var e;function c(){if(e!==void 0)return e;let n=globalThis.gc;if(typeof n=="function")return e=n,e;try{r("--expose_gc");let o=i("gc");r("--no-expose_gc"),e=typeof o=="function"?o:null}catch{e=null}return e}function u(){let n=c();return n?(n(),!0):!1}var l=512*1024*1024,t=0;function f(n,o=u){!Number.isFinite(n)||n<=0||(t+=n,!(t<l)&&(t=0,o()))}export{u as a,f as b};
|
|
2
|
+
//# sourceMappingURL=chunk-7Y5T6XDP.js.map
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import{a as S,b as c,d as a}from"./chunk-PH52RA7D.js";import{Ca as g,Fa as f,qa as l,ra as p}from"./chunk-5TNQJUR2.js";var C=g("source-text",{clearGroups:["whole-project","source-file"]}),h=f("source-lines",{clearGroups:["whole-project","source-file"]});function T(r,e){let t=e.replace(/\\/g,"/");a(t);let n=C.get(r,t,()=>x(r,t));return d(t,n)}function P(r,e){let t=e.replace(/\\/g,"/");return a(t),d(t,x(r,t))}function d(r,e){return S(r,e.text),e.available||c(r),e.text}function x(r,e){try{return{text:l(r.config.projectRoot,e,{inputKind:"indexed source file"}),available:!0}}catch(t){if(c(e),p(t))return{text:"",available:!1};throw t}}function _(r){if(r.length===0)return[];let e=r.split(`
|
|
2
|
+
`);return r.endsWith(`
|
|
3
|
+
`)&&e.pop(),e}function D(r,e){let t=e.replace(/\\/g,"/"),n=T(r,t);return h.get(r,t,n,()=>n?n.split(`
|
|
4
|
+
`):[])}var E=/^\s*(?:\/\/|#|\/\*+|\*)\s*scip-query[\s:-]*ignore(?:[\s:-]+([a-z][\w-]*))?(?![\w-])/i;function R(r){let e=E.exec(r);return e?e[1]?.toLowerCase()??"":null}function U(r,e,t){return b(r,e,t).length>0}function z(r,e,t,n){let i=m(n);return b(r,e,t).some(o=>o===""||m(o)===i)}function m(r){let e=r.toLowerCase();return e==="dead-code"||e==="stale"?"dead":e==="wrapper"?"passthrough":e}function b(r,e,t){if(t<=0)return[];let n=D(r,e);if(n.length===0)return[];let i=[];for(let o=t-1;o>=0&&o>=t-5;o-=1){let s=(n[o]??"").trim();if(s==="")continue;let u=R(s);if(u!==null){i.push(u);continue}if(!w(s))return i}return i}function w(r){return["//","*","/*","@","#"].some(e=>r.startsWith(e))}export{T as a,P as b,_ as c,D as d,R as e,U as f,z as g};
|
|
5
|
+
//# sourceMappingURL=chunk-A2IIGFMJ.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{b as D}from"./chunk-N2WN6I3L.js";function N(a,n,o={}){let{file:c,line:e,maxDepth:i,maxEdges:t,direction:l}=L(n,o),d=D(a,c,e-1,e-1),p=d?.coverage??{status:"unsupported",basis:"typescript-compiler-cfg-reaching-definitions",unsupported:["Function-local slicing currently requires TypeScript or JavaScript source."]},m=T(d?.points??[],e,o),u=x(p,m.length),s={kind:"dependence-slice",direction:l,criterion:n,...o.variable!==void 0?{variable:o.variable}:{},resolution:u,candidates:m,points:[],edges:[],coverage:{status:"incomplete",basis:"function-local-dependence",model:p,omittedEdges:0,omittedPoints:0,depthLimited:!1,candidateEdges:0}},g=m[0];if(u!=="matched"||!g||!d)return s;let b=new Map(d.points.map(r=>[r.id,r])),E=I(d,b,g.callableId,l),{selected:S,reached:f,depthFrontier:F}=R(E,g.id,l,i);s.edges=[...S.values()].slice(0,t);let w=new Set([g.id,...s.edges.flatMap(r=>[r.fromPointId,r.toPointId])]);s.points=[...w].map(r=>b.get(r)).sort((r,v)=>r.start-v.start||r.id.localeCompare(v.id));let h=S.size-s.edges.length,y=F.size>0;return s.coverage={status:p.status!=="complete"?"incomplete":h>0||y?"bounded":"complete",basis:"function-local-dependence",model:p,omittedEdges:h,omittedPoints:f.size-w.size,depthLimited:y,candidateEdges:d.edges.filter(r=>r.strength==="candidate"&&(f.has(r.fromPointId)||f.has(r.toPointId))).length},s}function x(a,n){return a.status==="unsupported"?"unsupported":n===1?"matched":n>1?"ambiguous":"missing"}function L(a,n){let o=/^(.*):([1-9]\d*)$/u.exec(a);if(!o)throw new Error("A dependence slice requires an exact file:line, with --variable or --column when ambiguous. Use evidence for symbol relationships.");let c=Number(o[2]),e=n.maxDepth??Number.MAX_SAFE_INTEGER,i=n.maxEdges??200;P(c,n.column,e,i);let t=n.direction??"backward";if(t!=="backward"&&t!=="forward")throw new Error("Slice direction must be backward or forward.");return{file:o[1],line:c,maxDepth:e,maxEdges:i,direction:t}}function P(a,n,o,c){for(let[e,i]of[["line",a],["depth",o],["max-edges",c]])if(!Number.isSafeInteger(i)||i<(e==="line"?1:0))throw new RangeError(`Invalid slice ${e}: ${i}.`);if(n!==void 0&&(!Number.isSafeInteger(n)||n<1))throw new RangeError("Slice column must be a positive safe integer.")}function T(a,n,o){let c=a.filter(e=>e.line===n-1&&["use","definition","parameter-definition"].includes(e.kind)&&(o.variable===void 0||e.name===o.variable));if(o.column!==void 0){let e=o.column-1;c=c.filter(t=>e>=t.column&&e<t.column+t.end-t.start);let i=Math.min(...c.map(t=>t.end-t.start));c=c.filter(t=>t.end-t.start===i)}return c}function I(a,n,o,c){let e=new Map;for(let i of a.edges){if(i.strength!=="exact"||n.get(i.fromPointId)?.callableId!==o||n.get(i.toPointId)?.callableId!==o)continue;let t=c==="backward"?i.toPointId:i.fromPointId,l=e.get(t)??[];l.push(i),e.set(t,l)}return e}function R(a,n,o,c){let e=new Set([n]),i=new Map,t=[{id:n,depth:0}],l=new Set;for(let d=0;d<t.length;d++){let p=t[d],m=a.get(p.id)??[];if(p.depth>=c){for(let u of m)l.add(u.id);continue}for(let u of m){i.set(u.id,{...u,traversalDepth:p.depth+1});let s=o==="backward"?u.fromPointId:u.toPointId;e.has(s)||(e.add(s),t.push({id:s,depth:p.depth+1}))}}for(let d of i.keys())l.delete(d);return{selected:i,reached:e,depthFrontier:l}}export{N as a};
|
|
2
|
+
//# sourceMappingURL=chunk-AB5KCTEV.js.map
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import{a as se,b as ce,c as ae}from"./chunk-F56GCXXS.js";import{b as ue}from"./chunk-55UQAMZO.js";import{e as oe}from"./chunk-D3NX5XIE.js";import{a as S}from"./chunk-VTY3VK6E.js";import{a as ie,b as re}from"./chunk-ZR4HBC2H.js";import{a as z}from"./chunk-F4LUHJTF.js";import{a as K,b as Q,c as J,d as te}from"./chunk-ZIBYCYKK.js";import{a as ee,c as ne,d as E}from"./chunk-MOQQBQRD.js";import{a as Y,d as Z}from"./chunk-YGVRMGYN.js";import{d as X}from"./chunk-AOSIYPTA.js";import{h as H}from"./chunk-F2V2LPET.js";import{d as x}from"./chunk-BOJ5SVE2.js";import{b as D}from"./chunk-FMRN2TRL.js";import{b as T,c as L}from"./chunk-E3FDPXZK.js";import{d as F,x as W}from"./chunk-5D2LVK7O.js";import{s as V}from"./chunk-7WTPQ4NX.js";import{d as C}from"./chunk-A2IIGFMJ.js";import{createHash as ve}from"crypto";function me(e,i,n={}){let r=we(e,i,n);if(r.kind!=="matched")return r;let{referenceEvidence:t,claimSupport:o,...s}=r;return s}function we(e,i,n={}){let r=D(e,i);if(!r.match)return{kind:"missing",query:i};if(r.total>1)return{kind:"ambiguous",query:i,total:r.total,candidates:[{symbol:r.match.symbol,shortName:F(r.match.symbol),relativePath:r.match.relativePath,startLine:r.match.startLine},...r.candidates]};let t=r.match,o=$e(n.parts),s=Pe(e,t.symbol,o,n),c=ke(e,t.symbol,o,n),a=n.relatedSourceLines??80;return{kind:"matched",query:i,symbol:t.symbol,shortName:F(t.symbol),file:t.relativePath,parts:o,definition:o.includes("definition")?te(e,t.symbol):null,referenceWindows:o.includes("references")?Be(e,s.referencedBy):[],callers:le(e,c,"callers",o,a),callees:le(e,c,"callees",o,a),dependencies:o.includes("dependencies")?ie(e,t.relativePath):[],consumers:o.includes("consumers")?re(e,t.relativePath):[],referenceEvidence:s.referenceEvidence,claimSupport:s.claimSupport}}function Pe(e,i,n,r){return n.includes("definition")||n.includes("references")?ue(e,i,{semantic:r.semantic,referenceContext:r.referenceContext}):{definitions:[],referencedBy:[],referenceEvidence:[],claimSupport:null}}function ke(e,i,n,r){return n.includes("callers")||n.includes("callees")?z(e,i,{semantic:r.semantic}):null}function le(e,i,n,r,t){if(!r.includes(n))return[];let o=n==="callers"?i?.callerEvidence??[]:i?.calleeEvidence??[];return Me(e,o,t)}function Be(e,i){let n=i.filter(t=>t.sourceStartLine!==null&&t.sourceEndLine!==null&&t.source!==null).sort((t,o)=>t.relativePath.localeCompare(o.relativePath)||t.sourceStartLine-o.sourceStartLine||t.line-o.line),r=[];for(let t of n){let o=r[r.length-1];if(o&&o.relativePath===t.relativePath&&t.sourceStartLine<=o.endLine+1){o.endLine=Math.max(o.endLine,t.sourceEndLine),o.references.push(de(t)),o.source=C(e,o.relativePath).slice(o.startLine,o.endLine+1).join(`
|
|
2
|
+
`);continue}r.push({relativePath:t.relativePath,startLine:t.sourceStartLine,endLine:t.sourceEndLine,source:t.source,references:[de(t)]})}return r}function de(e){return{line:e.line,enclosingSymbol:e.enclosingSymbol,enclosingShort:e.enclosingShort}}function $e(e){let i=e&&e.length>0?e:["definition","references"];return[...new Set(i)]}function Me(e,i,n){let r=[],t=new Set;for(let o of i){if(t.has(o.symbol))continue;t.add(o.symbol);let s=(o.file?W(e,o.file).find(a=>a.symbol===o.symbol):void 0)??D(e,o.symbol).match;if(!s)continue;let c=ne(e,s.relativePath,s.startLine,s.endLine,n);c&&r.push({...c,symbol:o.symbol,shortName:o.shortName,evidenceStrength:o.evidenceStrength,omittedLines:Math.max(0,s.endLine-c.endLine)})}return r}var be=6,Fe=12,Te=48,De=2e4,pe=12,y=Number.MAX_SAFE_INTEGER,Ne=["definition","callers","callees"],q={search:12,"exact-source":24,definition:24,caller:8,callee:8,"production-reference":6,"test-reference":2,dependency:6,consumer:6};function jn(e,i){if(i.cursor)throw new Error("Inspect no longer accepts semantic packet cursors. Run the original inspect selectors again.");let n=Ae(i),r=Xe(e,n),t=r.candidates.sort((u,p)=>N(u,p));n.view==="behavior"&&nn(e,t),tn(e,t),n.view==="behavior"&&Ze(e,t);let o=se(t.map(u=>O(u,n.view)),n.evidenceBudgets,(u,p)=>N(u.candidate,p.candidate)),{selected:s,omitted:c}=ce(o.selected,n.maxUnits,n.maxCharacters,(u,p)=>N(u.candidate,p.candidate),n.view==="source"),a=s.map(u=>u.candidate),l=[...o.omitted,...c].map(u=>u.candidate),m=a.map(mn),d=Q(a.map(u=>u.kind==="source"?u.bindingClosure:void 0),a.filter(u=>u.kind==="source").map(u=>({relativePath:u.relativePath,startLine:u.startLine,endLine:u.endLine}))),f=m.reduce((u,p)=>u+(p.kind==="source"?fn(p.source):0),0),v=m.reduce((u,p)=>u+(p.kind==="source"?p.source.length:0),0),P=m.reduce((u,p)=>u+Le(p,n.view),0),g=m.filter(u=>u.kind==="source"&&(u.roles.includes("search")||u.roles.includes("location"))).map(pn),b=t.filter(u=>u.kind==="source"&&(u.roles.includes("search")||u.roles.includes("location"))).length,Ee=m.filter(u=>u.kind==="source"&&(u.roles.includes("search")||u.roles.includes("location"))).length,k=r.searches.map(u=>sn(u,t,a)),Ue=cn(l),A=Oe(r,l),j=k.reduce((u,p)=>u+p.omittedMatches,0),B=l.length===0&&j===0,$=B?void 0:Ce(n,!0),G=rn(n,l),Re=qe(B,A,l.length+j,G,k,$),M=_e(e,t,n.view);return{searches:k,evidence:r.evidence,locations:r.locations,slices:g,candidateSlices:b,omittedSlices:b-Ee,maxSlices:b,maxTotalLines:f,units:m,candidateUnits:t.length,omittedUnits:l.length,maxUnits:n.maxUnits,maxCharacters:n.maxCharacters,returnedLines:f,returnedCharacters:v,returnedViewCharacters:P,view:n.view,omissionGroups:G,packetCoverage:{mode:B?"complete":"bounded",candidateUnits:t.length,returnedUnits:m.length,omittedUnits:l.length,omittedByRole:Ue,exactSelectorsComplete:A,maxUnits:n.maxUnits,maxCharacters:n.maxCharacters,channels:an(t,a,n.evidenceBudgets,n.view),...$?{expansionCommand:$}:{}},stoppingSummary:Re,...M&&M.candidateAnchors>0?{causalFrontier:M}:{},bindingClosure:d,continuation:null}}function Oe(e,i){return e.locations.every(n=>n.matched)&&e.evidence.every(n=>n.kind==="matched")&&e.searches.every(n=>un(n.textCoverage))&&i.every(n=>!n.roles.some(r=>r==="location"||r==="definition"))}function _e(e,i,n){let r=i.filter(t=>n==="behavior"&&t.kind==="source"&&t.roles.some(o=>o==="location"||o==="definition"||o==="search")).map(t=>({id:`inspect:${t.relativePath}:${t.startLine}-${t.endLine}`,label:t.ownerShort??`${t.relativePath}:${t.startLine+1}`,file:t.relativePath,startLine:t.startLine,endLine:t.endLine}));return r.length>0?oe(e,r):void 0}function qe(e,i,n,r,t,o){let s=h([...r.map(c=>c.drillCommand),...t.flatMap(c=>c.exactFollowup?[c.exactFollowup]:[]),...o?[o]:[]]);return e&&i?{queryStatus:"selection-complete",status:"stop-ready",openEvidence:0,guidance:"All evidence requested by this inspect query was materialized.",drillCommands:[]}:i?{queryStatus:"frontier-accounted",status:"relevance-check-required",openEvidence:n,guidance:"Withheld evidence is accounted for by recoverable groups; drill the groups relevant to the current decision.",drillCommands:s}:{queryStatus:"coverage-incomplete",status:"exact-evidence-withheld",openEvidence:n,guidance:"A requested identity, exact source unit, or current-text coverage requirement is unresolved; drill before relying on it.",drillCommands:s}}function Ae(e){let i=x(e.searches),n=x(e.symbols),r=x(e.locations),t=i.length+n.length+r.length;if(t===0)throw new Error("inspect requires at least one --search, --symbol, or --at selector.");if(t>24)throw new RangeError(`inspect accepts at most ${24} selectors; received ${t}.`);let o=e.evidence??{};je(e),Ge(e);let s=e.full??!1;return{searches:i,symbols:n,locations:r,...e.scope?.trim()?{scope:e.scope.trim()}:{},...Ve(e,s),view:e.view??"source",evidence:We(o,n.length>0)}}function je(e){for(let i of["unitLines","totalLines","sliceLimit","maxCharacters","maxUnits"]){let n=e[i];n!==void 0&&U(n,i)}}function Ge(e){if(e.view!==void 0&&e.view!=="source"&&e.view!=="behavior")throw new Error(`Unknown inspect view: ${String(e.view)}. Use source or behavior.`);if(e.full&&(e.searchLimit!==void 0||e.maxUnits!==void 0||e.maxCharacters!==void 0||e.evidenceBudgets!==void 0))throw new Error("full inspect cannot be combined with searchLimit, maxUnits, maxCharacters, or evidenceBudgets.")}function Ve(e,i){return{context:xe(e.context??be,"context"),searchLimit:U(e.searchLimit??(i?y:Fe),"searchLimit"),maxUnits:U(i?y:e.maxUnits??Te,"maxUnits"),maxCharacters:U(i?y:e.maxCharacters??De,"maxCharacters"),evidenceBudgets:i?ze():He(e.evidenceBudgets??q)}}function We(e,i){return{...e.parts?{parts:[...e.parts]}:i?{parts:[...Ne]}:{},...e.referenceContext!==void 0?{referenceContext:xe(e.referenceContext,"referenceContext")}:{},relatedSourceLines:e.relatedSourceLines??60,...e.semantic!==void 0?{semantic:e.semantic}:{}}}function He(e){let i={...q};for(let[n,r]of Object.entries(e)){if(!(n in i))throw new Error(`Unknown inspect evidence channel: ${n}.`);if(!Number.isSafeInteger(r)||(r??-1)<0)throw new RangeError(`Evidence budget ${n} must be a non-negative safe integer; received ${r}.`);i[n]=r}return i}function ze(){return Object.fromEntries(Object.keys(q).map(e=>[e,y]))}function Xe(e,i){let n={candidates:[],sequence:0},r=Ke(e,i,n),t=Qe(e,i,n),o=Ye(e,i,n);return{searches:r,evidence:o,locations:t,candidates:n.candidates}}function Ke(e,i,n){let r=ae(e,i.searches,{scope:i.scope,context:0,limit:i.searchLimit,ranking:"structural"}).map((s,c)=>({pattern:i.searches[c],result:s,matches:s.matches})),t=Math.max(0,...r.map(s=>s.matches.length));for(let s=0;s<t;s+=1)for(let c of r){let a=c.matches[s];if(!a)continue;let l=E(e,a.relativePath,a.focusLine,y,i.context);l&&I(e,n.candidates,l,"search",`search:${c.pattern}`,a.ownerSymbol,a.ownerShort,1,n.sequence++)}return r.map(({pattern:s,result:c})=>{let a=c.omittedMatches>0?ye(s,i.scope):void 0,l=c.fileCoverage??[],m=ln(s,l,i.scope);return{pattern:s,matchingLines:c.matchingLines,returnedMatches:c.matches.length,omittedMatches:c.omittedMatches,matchingFiles:l.length,returnedFiles:l.filter(d=>d.returnedMatches>0).length,omittedFiles:l.filter(d=>d.returnedMatches===0).length,candidateUnits:0,selectedUnits:0,omittedUnits:0,scopeHints:m.slice(0,pe),omittedScopeHints:Math.max(0,m.length-pe),textCoverage:c.textCoverage,...a?{exactFollowup:a}:{}}})}function Qe(e,i,n){return i.locations.map(t=>{let o=hn(t),s=o?X(e,o.path):null,c=s?E(e,s,o.line-1,y,i.context):null;return c&&I(e,n.candidates,c,"location",`at:${t}`,null,null,0,n.sequence++),{target:t,matched:c!==null}})}function Je(e,i,n,r){if(r.definition){let t=E(e,r.definition.relativePath,r.definition.startLine,y,i.context);t&&I(e,n.candidates,t,"definition",`definition:${r.shortName}`,r.symbol,r.shortName,0,n.sequence++)}for(let t of r.referenceWindows){let o=t.references[0];I(e,n.candidates,{...t,focusLine:o?.line??t.startLine,unitType:null,unitStartLine:t.startLine,unitEndLine:t.endLine,omittedLines:0},"reference",`reference:${r.shortName}`,o?.enclosingSymbol??null,o?.enclosingShort??null,L(t.relativePath)==="test"?5:4,n.sequence++,t.references.map(s=>s.line),r.symbol)}}function Ye(e,i,n){let r=i.symbols.map(t=>me(e,t,i.evidence));for(let t of r)if(t.kind==="matched"){Je(e,i,n,t);for(let o of t.callers)he(e,n.candidates,o,"caller",t,2,n.sequence++);for(let o of t.callees)he(e,n.candidates,o,"callee",t,3,n.sequence++);for(let o of t.dependencies)fe(e,n.candidates,"dependency",t.file,o.relativePath,t.symbol,i.context,6,n.sequence++);for(let o of t.consumers)fe(e,n.candidates,"consumer",o.relativePath,t.file,t.symbol,i.context,7,n.sequence++)}return r}function N(e,i){return e.priority-i.priority||i.roles.length-e.roles.length||i.reasons.length-e.reasons.length||T(L(e.relativePath))-T(L(i.relativePath))||e.sequence-i.sequence}function O(e,i){return{candidate:e,priority:e.priority,sequence:e.sequence,relativePath:e.relativePath,fileKind:L(e.relativePath),evidenceCharacters:Le(e,i),roles:e.roles,reasons:e.reasons,symbols:e.symbols,behaviorSignals:e.kind==="source"?e.behavior?.signals??[]:[],channel:_(e)}}function _(e){let i=e.roles;return i.includes("location")?"exact-source":i.includes("definition")?"definition":i.includes("caller")?"caller":i.includes("callee")?"callee":i.includes("reference")?L(e.relativePath)==="test"?"test-reference":"production-reference":i.includes("dependency")?"dependency":i.includes("consumer")?"consumer":"search"}function Ze(e,i){let n=i.filter(t=>t.kind==="source"),r=H(e,{files:h(n.map(t=>t.relativePath))});for(let t of n){t.behavior=Y(e,t.relativePath,t.startLine,t.endLine,t.focusLines)??void 0;let o=r.filter(c=>c.source.file===t.relativePath&&c.source.startLine<=t.endLine&&c.source.endLine>=t.startLine),s=o.filter(c=>!en(c,o)).map(c=>({observationId:c.id,protocol:c.protocol,action:c.action,role:c.role,strength:c.strength,resolution:c.resolution,line:c.source.startLine,endLine:c.source.endLine,keyParts:c.keyParts.map(a=>({name:a.name,value:a.value,evidence:a.evidence})),derivation:{kind:c.derivation.kind,rule:c.derivation.rule,sourceSpans:c.derivation.sourceSpans.length}}));t.runtimeFacts=s.length>0?s:void 0}}function en(e,i){if(e.strength!=="candidate"||e.protocol!=="http")return!1;let n=e.keyParts.find(t=>t.name==="path")?.value,r=e.keyParts.find(t=>t.name==="method")?.value;return n?i.some(t=>{if(t===e||t.action!==e.action||t.role!==e.role||t.source.startLine!==e.source.startLine||t.derivation.rule!=="http.mount-prefix")return!1;let o=t.keyParts.find(c=>c.name==="path")?.value,s=t.keyParts.find(c=>c.name==="method")?.value;return!!(o&&o!==n&&o.endsWith(n)&&(!r||r===s))}):!1}function nn(e,i){for(let n of i){if(n.kind!=="source")continue;let r=Z(e,n.relativePath,n.startLine,n.endLine,n.focusLines);r.startLine===n.startLine&&r.endLine===n.endLine||(n.startLine=r.startLine,n.endLine=r.endLine,n.source=C(e,n.relativePath).slice(r.startLine,r.endLine+1).join(`
|
|
3
|
+
`),n.unitStartLine=r.startLine,n.unitEndLine=r.endLine,n.omittedLines=0)}}function tn(e,i){for(let n of i)n.kind==="source"&&(n.bindingClosure=K(e,n.relativePath,n.startLine,n.endLine))}function rn(e,i){let n=new Map;for(let r of i){let t=w(r.relativePath),o=_(r),s=[...r.roles].sort().join(","),c=r.kind==="path"?r.relationship:"",a=`${t}|${o}|${s}|${c}`,l=n.get(a)??[];l.push(r),n.set(a,l)}return[...n.entries()].map(([r,t])=>{let o=t[0],s=h(t.flatMap(a=>[...a.roles])).sort(),c=h(t.flatMap(a=>a.kind==="source"?a.behavior?.signals??[]:[])).sort();return{id:`g-${ve("sha256").update(r).digest("hex").slice(0,8)}`,scope:w(o.relativePath),channel:_(o),roles:s,behaviorSignals:c,candidateUnits:t.length,sourceCharacters:t.reduce((a,l)=>a+(l.kind==="source"?l.source.length:0),0),anchors:t.map(a=>({relativePath:a.relativePath,line:a.kind==="source"?a.focusLine:0,ownerShort:a.kind==="source"?a.ownerShort:null,roles:[...a.roles],behaviorSignals:a.kind==="source"?[...a.behavior?.signals??[]]:[]})),drillCommand:on(e,t)}}).sort((r,t)=>t.candidateUnits-r.candidateUnits||t.sourceCharacters-r.sourceCharacters||r.scope.localeCompare(t.scope)||r.id.localeCompare(t.id))}function on(e,i){let n=h(i.flatMap(o=>o.reasons.filter(s=>s.startsWith("search:")).map(s=>s.slice(7)))),r=w(i[0].relativePath);if(n.length>0&&i.every(o=>o.kind==="source"&&o.roles.includes("search")))return Sn(e,n,r);let t=i.filter(o=>o.kind==="source");if(t.length>0&&t.length<=24){let o=["scip-query inspect"];for(let s of t)o.push(`--at ${S(`${s.relativePath}:${s.focusLine+1}`)}`);return e.view==="behavior"&&o.push("--view behavior"),o.join(" ")}return i.length===1&&i[0].kind==="path"?i[0].exactFollowup:Ce(e,!0)}function sn(e,i,n){let r=`search:${e.pattern}`,t=i.filter(c=>c.reasons.includes(r)).length,o=new Set(n),s=i.filter(c=>c.reasons.includes(r)&&o.has(c)).length;return{...e,candidateUnits:t,selectedUnits:s,omittedUnits:t-s}}function cn(e){let i={};for(let n of e)for(let r of n.roles)i[r]=(i[r]??0)+1;return i}function an(e,i,n,r){let t=e.map(s=>O(s,r).channel),o=i.map(s=>O(s,r).channel);return Object.fromEntries(Object.keys(n).map(s=>{let c=t.filter(l=>l===s).length,a=o.filter(l=>l===s).length;return[s,{candidateUnits:c,returnedUnits:a,omittedUnits:c-a,maxUnits:n[s]}]}))}function un(e){return!!(e&&e.skippedUnreadablePaths.length===0&&e.skippedOversizedPaths.length===0)}function ln(e,i,n){let r=new Map;for(let t of i){let o=w(t.relativePath),s=r.get(o)??{matchingLines:0,returnedMatches:0};s.matchingLines+=t.matchingLines,s.returnedMatches+=t.returnedMatches,r.set(o,s)}return[...r.entries()].map(([t,o])=>({scope:t,...o,exactFollowup:ye(e,t||n)})).sort((t,o)=>o.matchingLines-t.matchingLines||o.returnedMatches-t.returnedMatches||t.scope.localeCompare(o.scope))}function w(e){let i=e.lastIndexOf("/");return i<0?e:e.slice(0,i)}function ye(e,i){return`scip-query inspect --search ${S(e)}${i?` --scope ${S(i)}`:""} --full`}function Ce(e,i){let n=["scip-query inspect"];for(let r of e.searches)n.push(`--search ${S(r)}`);for(let r of e.symbols)n.push(`--symbol ${S(r)}`);for(let r of e.locations)n.push(`--at ${S(r)}`);return e.scope&&n.push(`--scope ${S(e.scope)}`),e.context!==be&&n.push(`--context ${e.context}`),e.evidence.parts&&n.push(`--include ${S(e.evidence.parts.join(","))}`),i&&n.push("--full"),e.view==="behavior"&&n.push("--view behavior"),n.join(" ")}function he(e,i,n,r,t,o,s){I(e,i,{...n,unitType:null,unitStartLine:n.startLine,unitEndLine:n.endLine+n.omittedLines},r,`${n.evidenceStrength==="exact"?r:`candidate-${r}`}:${t.shortName}`,n.symbol,n.shortName,o,s,[n.focusLine],t.symbol)}function fe(e,i,n,r,t,o,s,c,a){let l=`${r} -> ${t}`,m=V(e,r).filter(b=>b.sourcePath===t),d=C(e,r),f=dn(d,m,t),v=f===null?null:ee(e,r,f,Math.min(s,4));if(v){I(e,i,{...v,unitType:null,unitStartLine:v.startLine,unitEndLine:v.endLine,omittedLines:0},n,`${n}:${l}`,null,null,c,a,[v.focusLine],o);return}let P=`scip-query inspect --search ${S(Ie(t))} --scope ${S(r)}`,g=i.find(b=>b.kind==="path"&&b.relativePath===r&&b.relationship===l);if(g){g.roles=h([...g.roles,n]),g.reasons=h([...g.reasons,`${n}:${l}`]),g.symbols=h([...g.symbols,o]),g.priority=Math.min(g.priority,c);return}i.push({kind:"path",roles:[n],relativePath:r,relationship:l,reasons:[`${n}:${l}`],symbols:[o],exactFollowup:P,priority:c,sequence:a})}function dn(e,i,n){let r=h(i.flatMap(a=>[a.importedName,a.localName??""]).filter(a=>a.length>1)),t=Ie(n).replace(/\.[^.]+$/u,""),o=h([...r,t]).filter(Boolean),s=/\b(?:from|import|include|require|use)\b/u,c=e.findIndex(a=>s.test(a)&&o.some(l=>a.includes(l)));return c>=0?c:null}function I(e,i,n,r,t,o,s,c,a,l=[n.focusLine],m){let d=i.find(f=>f.kind==="source"&&f.relativePath===n.relativePath&&f.startLine<=n.endLine&&n.startLine<=f.endLine);if(d){let f=Math.min(d.startLine,n.startLine),v=Math.max(d.endLine,n.endLine);d.startLine=f,d.endLine=v,d.source=C(e,n.relativePath).slice(f,v+1).join(`
|
|
4
|
+
`),d.focusLine=Math.min(d.focusLine,n.focusLine),d.focusLines=ge([...d.focusLines,...l]),d.unitStartLine=Math.min(d.unitStartLine,n.unitStartLine),d.unitEndLine=Math.max(d.unitEndLine,n.unitEndLine),d.omittedLines=Math.max(d.omittedLines,n.omittedLines),d.reasons=h([...d.reasons,t]),d.roles=h([...d.roles,r]),d.symbols=h([...d.symbols,...m?[m]:[]]),!d.ownerSymbol&&o&&(d.ownerSymbol=o),!d.ownerShort&&s&&(d.ownerShort=s),d.priority=Math.min(d.priority,c);return}i.push({kind:"source",...n,reasons:[t],focusLines:ge(l),ownerSymbol:o,ownerShort:s,roles:[r],symbols:m?[m]:[],priority:c,sequence:a})}function mn(e){if(e.kind==="path"){let{priority:o,sequence:s,...c}=e;return{...c,id:Se(c)}}let{priority:i,sequence:n,bindingClosure:r,...t}=e;return{...t,id:Se(t),omittedCharacters:0}}function pn(e){let{kind:i,id:n,roles:r,symbols:t,omittedCharacters:o,behavior:s,runtimeFacts:c,...a}=e;return a}function Se(e){return ve("sha256").update(JSON.stringify(e)).digest("hex").slice(0,16)}function hn(e){let i=e.match(/^(.+\.\w+):(\d+)$/u);if(!i)return null;let n=Number(i[2]);return Number.isSafeInteger(n)&&n>0?{path:i[1],line:n}:null}function h(e){return[...new Set(e)]}function ge(e){return h(e).sort((i,n)=>i-n)}function fn(e){return e.length===0?0:e.split(`
|
|
5
|
+
`).length}function Le(e,i){if(e.kind==="path")return e.relationship.length+e.exactFollowup.length;let n="bindingClosure"in e?J(e.bindingClosure):0,r=(e.runtimeFacts??[]).reduce((t,o)=>t+o.action.length+o.derivation.rule.length+o.keyParts.reduce((s,c)=>s+c.name.length+c.value.length+4,0)+24,0);return i!=="behavior"?e.source.length+n:e.behavior?e.behavior.lines.reduce((t,o)=>t+o.text.length+o.signals.join(",").length+12,0)+e.behavior.testCases.reduce((t,o)=>t+o.length+2,0)+r+n:e.source.length+n+r}function Ie(e){return e.split("/").at(-1)??e}function U(e,i){if(!Number.isSafeInteger(e)||e<=0)throw new RangeError(`${i} must be a positive safe integer; received ${e}`);return e}function xe(e,i){if(!Number.isSafeInteger(e)||e<0)throw new RangeError(`${i} must be a non-negative safe integer; received ${e}`);return e}function Sn(e,i,n){let r=["scip-query inspect"];for(let t of i)r.push(`--search ${S(t)}`);return r.push(`--scope ${S(n)}`,"--full"),e.view==="behavior"&&r.push("--view behavior"),r.join(" ")}export{jn as a};
|
|
6
|
+
//# sourceMappingURL=chunk-AC566WBP.js.map
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import{a as ne}from"./chunk-P5XHIJHI.js";import{a as Dt,i as vt,j as ge,k as $,l as Oe,m as te,n as re,o as Ue,q as mn,r as qe,s as Pt,t as yn,v as Sn,w as gn,x as kt}from"./chunk-73AAKPUC.js";import{a as Be,b as ie,c as Ct,e as Tt,f as wt,g as je,h as We}from"./chunk-KZBJWZJB.js";import{d as Mt}from"./chunk-KK7GPALL.js";import{a as Te,b as we,c as Ee,d as Fe,e as O,o as xt}from"./chunk-DA7RPPDF.js";import{b as ht,e as V,h as Le,j as It,l as Se,x as B,y as ee}from"./chunk-5D2LVK7O.js";import{a as ye,g as _e,q as Rt,s as bt}from"./chunk-7WTPQ4NX.js";import{A as St,O as gt,a as Ae,c as pt,d as mt,q as dn}from"./chunk-FVULPZDF.js";import{g as pn,h as me,i as K}from"./chunk-D3FDISIC.js";import{c as fn,e as Z,n as ft,p as dt,q as A,s as yt,t as C,v as Ne}from"./chunk-GVWX5T43.js";import{a as de,d as F}from"./chunk-T6DK3ZP7.js";import{Ca as ut,Da as un,Q as ln,ma as st,o as it,p as z,q as Pe,qa as at,ra as pe,t as ke,u as L,ua as ct,v as ot,z as cn,za as lt}from"./chunk-5TNQJUR2.js";import{randomUUID as Yi}from"crypto";import{existsSync as Ji}from"fs";import{dirname as rr}from"path";function li(n){return(n.tsconfigPath===void 0||typeof n.tsconfigPath=="string")&&(n.tsconfigPaths===void 0||Array.isArray(n.tsconfigPaths)&&n.tsconfigPaths.every(e=>typeof e=="string"))}function ui(n){return typeof n.available=="boolean"&&(n.dependencyAvailable===void 0||typeof n.dependencyAvailable=="boolean")&&li(n)&&(n.resolvedBinary===void 0||typeof n.resolvedBinary=="string")&&(n.note===void 0||typeof n.note=="string")}function Et(n){if(!n||typeof n!="object"||Array.isArray(n))return null;let e=n;if(!ui(e))return null;if(e.available===!0){if(e.reason!==void 0)return null}else if(typeof e.reason!="string"||e.reason.length===0)return null;return e}import{performance as x}from"perf_hooks";function E(n,e,t){if(n.has(e))return n.get(e);let r=t();return n.set(e,r),r}import Nt from"path";import{realpathSync as Ft}from"fs";function fi(n,e){return n.getReferences().map(t=>{let r=t.getNode();return He(r,e)})}function di(n){let e=n;return typeof e.findReferences=="function"?e.findReferences():[]}function _t(n,e,t,r){let i=[];for(let o of di(n))for(let s of fi(o,r))s.file===e.relativePath&&s.line>=e.startLine&&s.line<=e.endLine||i.push(s);for(let o of t)i.push(o);return oe(i)}function Lt(n,e,t,r){let i=[],o=t?.getStart();for(let s of n.getReferences()){let a=s.getNode();se(r,a.getSourceFile().getFilePath())===e&&(o!==void 0&&a.getStart()===o||i.push({location:He(a,r),node:a}))}return i}function He(n,e){let t=n.getSourceFile(),r=t.getLineAndColumnAtPos(n.getStart());return{file:se(e,t.getFilePath())??t.getBaseName(),line:r.line-1,column:r.column-1}}function Ot(n,e,t){let r=n.getSourceFile(),i=bn(r,n),o=n.getText(),s=new RegExp(`\\b${ye(o)}\\b`,"g"),a=r.getFullText().split(`
|
|
2
|
+
`),c=[];for(let u=0;u<a.length;u++){if(u===i)continue;let l=a[u]??"";s.lastIndex=0;let f;for(;(f=s.exec(l))!==null;)c.push({file:e,line:u,column:f.index})}return oe(c.filter(u=>se(t,Nt.join(t,u.file))===e))}function Rn(n){for(let e=n;e;e=e.getParent()){let t=e.getKindName();if(t.includes("Type")||t==="InterfaceDeclaration"||t==="TypeAliasDeclaration")return!0;if(t==="CallExpression"||t==="NewExpression"||t==="ExpressionStatement")return!1}return!1}function bn(n,e){return n.getLineAndColumnAtPos(e.getStart()).line-1}function oe(n){let e=new Set,t=[];for(let r of n){let i=`${r.file}:${r.line}:${r.column}`;e.has(i)||(e.add(i),t.push(r))}return t}function se(n,e){let t=n||process.cwd(),r=At(t,e);if(r)return r;try{return At(Ft(t),Ft(e))}catch{return null}}function At(n,e){let t=Nt.relative(n,e).replace(/\\/g,"/");return!t||t===".."||t.startsWith("../")?null:t}function Ut(n,e,t,r){let i=pi(e,r);return i.size===0?new Map:mi(n,t,i)}function pi(n,e){let t=new Map;for(let r of B(n,e)){let i=V(r.symbol)??r.leaf;if(!i)continue;let o=t.get(i);o||(o=[],t.set(i,o)),o.push(r)}return t}function mi(n,e,t){let r=new Map,i=new Map;return e.forEachDescendant(o=>{for(let s of yi(n,o)){let a=t.get(s);if(!a)continue;let c=bn(e,o);for(let u of a){if(c<u.startLine-1||c>u.endLine+1)continue;let l=Math.abs(c-u.startLine),f=i.get(u.symbolId);f!==void 0&&f<=l||(i.set(u.symbolId,l),r.set(u.symbolId,o))}}}),r}function yi(n,e){let t=[],r=i=>{i&&!t.includes(i)&&t.push(i)};if("getNameNode"in e&&typeof e.getNameNode=="function"){let i=e.getNameNode();r(i?.getText())}if("getName"in e&&typeof e.getName=="function"){let i=e.getName();r(i)}return n.Node.isIdentifier(e)&&r(e.getText()),t}function hn(n,e,t){let r=new Map,i=new Set,o=s=>{if(n.isFunctionLike(s)){let a=Si(n,s),u=a.name?.getText(e)??(n.isConstructorDeclaration(s)?"constructor":void 0),l=e.getLineAndCharacterOfPosition(a.getStart(e)),f=t.filter(d=>!i.has(d.symbolId)&&d.leaf===u&&Ri(d,l));f.length===1&&(r.set(s,f[0]),i.add(f[0].symbolId))}n.forEachChild(s,o)};return o(e),s=>{for(let a=s.parent;a;a=a.parent)if(n.isFunctionLike(a))return r.get(a)}}function Si(n,e){if(!n.isArrowFunction(e)&&!n.isFunctionExpression(e))return e;let t=e;for(;t.parent&&gi(n,t.parent);)t=t.parent;let r=t.parent;return r&&(n.isVariableDeclaration(r)||n.isPropertyDeclaration(r)||n.isPropertyAssignment(r))&&r.initializer===t?r:e}function gi(n,e){return n.isParenthesizedExpression(e)||n.isAsExpression(e)||n.isSatisfiesExpression(e)}function Ri(n,e){return e.line<n.startLine||e.line>n.endLine||e.line===n.startLine&&e.character<(n.startChar??0)?!1:e.line!==n.endLine||e.character<=(n.endChar??1/0)}var bi=ut("ts-definition-leaf-candidates",{clearGroups:["definition-catalog"]});function qt(n,e,t,r){let i=Dn(n,e),o=In(i.get(r)??[],t);if(o)return o;let s=[];for(let a of i.values())for(let c of a)((c.leaf||V(c.symbol)||"").includes(r)||c.symbol.includes(r))&&s.push(c);return In(s,t)}function Mn(n,e,t,r){return In(Dn(n,e).get(r)??[],t)}function Bt(n,e){let t=new Map;for(let[r,i]of Dn(n,e)){let o=i[0];o&&t.set(r,o)}return t}function Dn(n,e){return bi.get(n,e,()=>{let t=new Map;for(let r of B(n,e)){let i=r.leaf||V(r.symbol);if(!i)continue;let o=t.get(i);o||(o=[],t.set(i,o)),o.push({...r,leaf:i})}for(let r of t.values())r.sort((i,o)=>i.startLine-o.startLine||i.endLine-o.endLine||i.symbolId-o.symbolId);return t})}function In(n,e){let t=null,r=Number.POSITIVE_INFINITY;for(let i of n){let o=Math.abs(i.startLine-e);(o<r||o===r&&t&&i.startLine<t.startLine)&&(t=i,r=o)}return t}import hi from"path";import{realpathSync as Ii}from"fs";function Wt(n,e){let t=new Map,r=new Map,i=null,o=()=>(i??=Ae(n,{extensions:Be}),i),s=u=>E(r,u,()=>C("typescript.source-file-index",()=>{let l=new Map;for(let f of u.project.getSourceFiles())jt(l,f);return{project:u.project,sourceFiles:l}},()=>({tsconfigPath:u.tsconfigPath,indexedDocuments:o().length}))),a=(u,l)=>{let f=s(u),d=f.sourceFiles.get(l)??null;return d||(d=u.project.addSourceFileAtPathIfExists(l)??null,d&&jt(f.sourceFiles,d)),d?{project:f.project,sourceFile:d}:null},c=u=>ie(u)?E(t,u,()=>{let l=Mi(n.config.projectRoot,u);if(!l)return null;for(let m of e){if(!m.loaded)continue;let p=s(m).sourceFiles.get(l);if(p)return{project:m.project,sourceFile:p}}let f=e.find(m=>m.fileNames?.has(l));if(f)return a(f,l);for(let m of e){if(!m.loaded)continue;let p=a(m,l);if(p)return p}let d=e[0];return d?a(d,l):null}):null;return{sourceFile:u=>c(u)?.sourceFile??null,sourceFileMatch:c,indexedTypeScriptLikeDocuments:o}}function jt(n,e){let t=vn(e.getFilePath());n.set(t,e);try{n.set(vn(Ii(t)),e)}catch(r){if(!pe(r))throw r}}function Mi(n,e){try{return vn(st(n,e,{inputKind:"indexed TypeScript source file"}).absolutePath)}catch(t){if(!pe(t))throw t;return null}}function vn(n){return hi.resolve(n)}function xn(n,e){for(let t of n)if(e===t.name||e.startsWith(`${t.name}/`))return t.name;return null}function Ht(n){let e=`${n.relativeDir}/src`;return[`${e}/index.ts`,`${e}/index.tsx`,`${e}/index.mts`,`${e}/index.cts`]}import{existsSync as Re}from"fs";import k from"path";var Cn=["tsconfig.json","tsconfig.app.json","tsconfig.node.json","tsconfig.base.json"];function Tn(n,e){let r=e?k.dirname(k.join(n,e)):n,i=k.resolve(n);for(;r.startsWith(i);){for(let s of Cn){let a=k.join(r,s);if(Re(a))return a}let o=k.dirname(r);if(o===r)break;r=o}for(let o of Cn){let s=k.join(n,o);if(Re(s))return s}return null}function zt(n){let e=n.config.projectRoot,t=new Set(Di(e,n.config.semantic?.typescript?.tsconfigs)),r=Ae(n,{includeIgnored:!1,extensions:Be});for(let i of r){let o=Tn(e,i);o&&t.add(k.resolve(o))}if(t.size===0){let i=Tn(e);i&&t.add(k.resolve(i))}return[...t].filter(i=>!Kt(e,i)).sort((i,o)=>i.localeCompare(o))}function Di(n,e=[]){let t=new Set;for(let r of e){let i=k.isAbsolute(r)?r:k.join(n,r);Re(i)&&t.add(k.resolve(i))}for(let r of vi(n))for(let i of Cn){let o=k.join(r,i);Re(o)&&t.add(k.resolve(o))}if(t.size===0){let r=Tn(n);r&&t.add(k.resolve(r))}return[...t].filter(r=>!Kt(n,r)).sort((r,i)=>r.localeCompare(i))}function vi(n){let e=k.join(n,"package.json");if(!Re(e))return[];let t;try{t=JSON.parse(ot(e,"project package manifest"))}catch{return[]}return(Array.isArray(t.workspaces)?t.workspaces:t.workspaces?.packages??[]).flatMap(i=>mt(n,i))}function Kt(n,e){let t=k.relative(n,e).replace(/\\/g,"/");return t.startsWith("..")||t.includes("/node_modules/")||t.startsWith("node_modules/")||t.includes("/dist/")||t.startsWith("dist/")}var xi=32;function Xt(n,e){let t=C("typescript.provider.load",()=>Ct());if(!t)return We("ts-morph is not installed");let r=C("typescript.provider.tsconfig-discovery",()=>zt(n));if(r.length===0)return We("no tsconfig found");try{let i=C("typescript.provider.project-bundles",()=>Tt(t,r),()=>({tsconfigs:r.length}));return Ci(n,t,i)}catch(i){return We(i instanceof Error?i.message:String(i),r[0],r)}}function Ci(n,e,t,r={}){return C("typescript.provider.construct",()=>new wn(n,e,t),()=>({tsconfigs:t.length,reusedProjects:r.reusedProjects===!0}))}var wn=class{constructor(e,t,r){this.db=e;this.tsMorph=t;this.projects=r;this.workspacePackages=pt(e.config.projectRoot),this.sourceFiles=Wt(e,r)}db;tsMorph;projects;language="typescript";importUsageCache=new Map;referencesCache=new Map;calleesCache=new Map;fileCalleesCache=new Map;signatureCache=new Map;definitionNodeCache=new Map;fileDefinitionNodeCache=new Map;indexedDefinitionLeafCache=new Map;packageImportReferenceIndex=null;packageExportIndex=null;workspacePackages;sourceFiles;availability(){let e=je(this.projects);return{available:!0,tsconfigPath:this.projects[0]?.tsconfigPath,tsconfigPaths:this.projects.map(t=>t.tsconfigPath),projectScope:e?"file-closure":"project",...e?{note:"compiler projects are file-scoped: callees, signatures, and import usage are served per file; references and hierarchies are unavailable"}:{}}}attachBatchFiles(e){if(je(this.projects))for(let t of new Set(e.map(r=>r.relativePath)))this.sourceFiles.sourceFile(t)}assertProjectWide(){if(je(this.projects))throw new Error(wt)}importUsage(e){return E(this.importUsageCache,e,()=>{let t=this.sourceFiles.sourceFile(e);if(!t)return[];let r=wi();return C("typescript.import-usage.file",()=>this.importUsageForSourceFile(e,t,r),()=>({file:e,...r}))})}referencesFor(e){return E(this.referencesCache,e.symbolId,()=>{let t=this.nodeForDefinition(e);return this.referencesForDefinitionNode(e,t)})}referencesForDefinitions(e,t={}){this.assertProjectWide();let r=new Map,i=A(),o=[];for(let l of e){let f=this.referencesCache.get(l.symbolId);f?r.set(l.symbolId,f):o.push(l)}if(o.length===0)return r;let s=o,a=t.exact?[]:o.filter(l=>!$t(l));if(a.length>=xi){let l=this.referencesForDefinitionsBySymbolScan(a);if(this.cacheScannedReferenceResults(a,l,r),s=o.filter(f=>$t(f)),s.length===0)return r}let c=qi(s),u=[];for(let[l,f]of c){let d=Yt();C("typescript.references-map.file",()=>{let m=this.definitionNodesForFile(l);for(let p of f){i&&(d.cacheMisses+=1);let y=m.get(p.symbolId)??null;i&&(y?d.nodeHits+=1:d.nodeMisses+=1);try{let b=this.referencesForDefinitionNode(p,y,i?d:void 0);this.referencesCache.set(p.symbolId,b),r.set(p.symbolId,b)}catch{d.preciseSearchFailures+=1,u.push(p)}}},()=>({relativePath:l,definitions:f.length,...Gt(d)}))}if(u.length>0){let l=this.referencesForDefinitionsBySymbolScan(u);this.cacheScannedReferenceResults(u,l,r)}return r}cacheScannedReferenceResults(e,t,r){for(let i of e){let o=t.get(i.symbolId)??[];this.referencesCache.set(i.symbolId,o),r.set(i.symbolId,o)}}referenceFragmentsForFiles(e){this.assertProjectWide();let t=ee(this.db).filter(o=>ie(o.relativePath)),r=e.filter(o=>this.sourceFiles.sourceFile(o)!==null),i=this.referencesForDefinitionsBySymbolScan(t,r);return Pt(t,i,r)}referencesForDefinitionsBySymbolScan(e,t){let r=A(),i=Yt(),o=new Map,s=new Set(e.map(l=>l.symbolId)),a=new Map(e.map(l=>[l.symbolId,l]));for(let l of e)o.set(l.symbolId,[]);let c=()=>{let l=r?x.now():0,f=t?this.packageImportReferencesForFiles(t):this.packageImportReferences();for(let d of e){let m=f.get(d.symbolId)??[];if(m.length>0){let p=o.get(d.symbolId)??[];p.push(...m),o.set(d.symbolId,p)}r&&(i.packageReferenceCount+=m.length)}r&&(i.packageRefsMs+=x.now()-l)},u=()=>{let l=new Map,f=new Map,d=this.hierarchyTargetsForDefinitions(e),m=new Set(e.map(y=>y.leaf).filter(Boolean)),p=r?x.now():0;for(let y of t??this.sourceFiles.indexedTypeScriptLikeDocuments()){if(this.db.isIgnored(y))continue;let b=this.sourceFiles.sourceFile(y);b&&(r&&(i.scanFiles+=1),this.addReferencesFromSourceFileScan(b,y,s,a,d,m,l,f,o,r?i:void 0))}r&&(i.scanMs+=x.now()-p)};return C("typescript.references-map.inverted-scan",()=>{c(),u();let l=r?x.now():0;this.addHierarchyMemberReferences(e,o,r?i:void 0),r&&(i.hierarchyMs+=x.now()-l);for(let[f,d]of o){let m=oe(d);o.set(f,m),r&&(i.referenceCount+=m.length)}},()=>({definitions:e.length,...Gt(i)})),o}addReferencesFromSourceFileScan(e,t,r,i,o,s,a,c,u,l){let f=this.compilerCheckerForSourceFile(e),d=e.compilerNode,m=Ei(e),p=S=>{let g;return a.has(S)?g=a.get(S)??null:(g=this.referenceDefinitionFromCompilerSymbol(S),a.set(S,g)),l&&(g?l.targetHits+=1:l.targetMisses+=1),g},y=S=>{if(l&&(l.identifiers+=1),!s.has(S.text)&&!m.has(S.text))return;let g=this.compilerReferenceSymbol(f,S,l);if(!g)return;let D=p(g),P=E(c,g,()=>this.compilerSymbolKeys(g)),M=null,T=null,v=I=>{if(M??=Vt(d,S),Fi(I,t,M))return;if(!T){let w=d.getLineAndCharacterOfPosition(S.getStart(d));T={file:t,line:w.line,column:w.character}}let R=u.get(I.symbolId)??[];R.push(T),u.set(I.symbolId,R),l&&(l.requestedHits+=1)},h=Wi(D,r,i);h&&v(h);for(let I of P)for(let R of o.get(I)?.values()??[])v(R)},b=S=>{this.tsMorph.ts.isIdentifier(S)&&y(S),this.tsMorph.ts.forEachChild(S,b)};b(d)}hierarchyTargetsMemo=null;hierarchyTargetsForDefinitions(e){let t=Li(e);if(this.hierarchyTargetsMemo?.key===t)return this.hierarchyTargetsMemo.targets;let r=Z(this.db),i=`definitions:${t}`,o=!1,s=C("typescript.references-map.hierarchy-targets",()=>{if(r){let c=Jt.read(this.db,i,r);if(c&&c.projectRoot===this.db.config.projectRoot)return o=!0,_i(c,e)}let a=this.computeHierarchyTargets(e);return r&&Jt.write(this.db,i,r,{version:Zt,projectRoot:this.db.config.projectRoot,entries:[...a].map(([c,u])=>[c,[...u.values()].map(l=>l.symbol)])}),a},()=>({definitions:e.length,hit:o}));return this.hierarchyTargetsMemo={key:t,targets:s},s}computeHierarchyTargets(e){let t=new Map;for(let r of e){let i=this.nodeForDefinition(r),o=i?.compilerNode;if(!o||!this.isHierarchyMethod(o))continue;let s=o.parent;if(!this.isHierarchyContainer(s))continue;let a=this.compilerCheckerForSourceFile(i.getSourceFile()),c=a.getSymbolAtLocation(o.name);if(c)for(let u of this.hierarchyMemberSymbols(a,s,c))for(let l of this.compilerSymbolKeys(u)){let f=t.get(l)??new Map;f.set(r.symbolId,r),t.set(l,f)}}return t}hierarchyMemberSymbols(e,t,r){let i=new Set,o=new Set,s=(a,c,u)=>{if(!o.has(a)){o.add(a),i.add(c);for(let l of u){let f=l.getProperty(r.name);f&&s(l,f,this.hierarchyAncestorTypesForType(e,l))}}};return s(e.getTypeAtLocation(t),r,this.hierarchyAncestorTypes(e,t)),i}addHierarchyMemberReferences(e,t,r){let i=new Map,o=(c,u,l,f)=>{for(let d of this.hierarchyMemberSymbols(u,l,f))if(d!==f)for(let m of this.compilerSymbolLocations(d))c.push(m),r&&(r.hierarchyReferences+=1)},s=c=>{let u=this.nodeForDefinition(c),l=u?.compilerNode;if(!l||!this.isHierarchyMethod(l))return;let f=l.parent;if(!this.isHierarchyContainer(f))return;let d=this.compilerCheckerForSourceFile(u.getSourceFile()),m=d.getSymbolAtLocation(l.name);if(!m)return;let p=l.getSourceFile(),y=p.getLineAndCharacterOfPosition(l.name.getStart(p)),b={definition:c,location:{file:c.relativePath,line:y.line,column:y.character}},S=t.get(c.symbolId)??[];o(S,d,f,m),t.set(c.symbolId,S);let g=this.hierarchyRootMemberSymbols(d,f,m);for(let D of g){let P=i.get(D)??new Map;P.set(c.symbolId,b),i.set(D,P)}r&&(r.hierarchyDefinitions+=1)},a=c=>{for(let{definition:u}of c.values()){let l=t.get(u.symbolId)??[];for(let f of c.values())f.definition.symbolId!==u.symbolId&&(l.push(f.location),r&&(r.hierarchyReferences+=1));t.set(u.symbolId,l)}};for(let c of e)s(c);for(let c of i.values())c.size<2||(r&&(r.hierarchyFamilies+=1),a(c))}hierarchyRootMemberSymbols(e,t,r){let i=new Set,o=new Set,s=(a,c,u)=>{if(o.has(a))return;o.add(a);let l=!1;for(let f of u){let d=f.getProperty(r.name);d&&(l=!0,s(f,d,this.hierarchyAncestorTypesForType(e,f)))}if(!l)for(let f of this.compilerSymbolKeys(c))i.add(f)};return s(e.getTypeAtLocation(t),r,this.hierarchyAncestorTypes(e,t)),i}compilerSymbolKeys(e){return(e.declarations??[]).map(t=>{let r=t.getSourceFile();return`${r.fileName}\0${t.getStart(r)}\0${e.name}`})}compilerSymbolLocations(e){let t=[];for(let r of e.declarations??[]){let i=r.getSourceFile(),o=se(this.db.config.projectRoot,i.fileName);if(!o)continue;let s=r.name,a=i.getLineAndCharacterOfPosition((s??r).getStart(i));t.push({file:o,line:a.line,column:a.character})}return t}baseTypes(e,t){try{return e.getBaseTypes(t)??[]}catch{return[]}}hierarchyAncestorTypes(e,t){let r=new Set(this.hierarchyAncestorTypesForType(e,e.getTypeAtLocation(t)));for(let i of t.heritageClauses??[])for(let o of i.types)r.add(e.getTypeAtLocation(o));return[...r]}hierarchyAncestorTypesForType(e,t){let r=new Set(this.baseTypes(e,t));for(let i of t.getSymbol()?.declarations??[])if(this.isHierarchyContainer(i))for(let o of i.heritageClauses??[])for(let s of o.types)r.add(e.getTypeAtLocation(s));return[...r]}isHierarchyMethod(e){return this.tsMorph.ts.isMethodDeclaration(e)||this.tsMorph.ts.isMethodSignature(e)}isHierarchyContainer(e){return this.tsMorph.ts.isClassDeclaration(e)||this.tsMorph.ts.isClassExpression(e)||this.tsMorph.ts.isInterfaceDeclaration(e)}compilerReferenceSymbol(e,t,r){r&&(r.symbolLookups+=1);let i=e.getSymbolAtLocation(t);if(i){if((i.flags&this.tsMorph.ts.SymbolFlags.Alias)===0)return i;try{return r&&(r.aliasResolutions+=1),e.getAliasedSymbol(i)}catch{return i}}}calleesFor(e){return E(this.calleesCache,e.symbolId,()=>E(this.fileCalleesCache,e.relativePath,()=>this.calleeMapForFile(e.relativePath)).get(e.symbolId)??[])}calleesForDefinitions(e){let t=new Map;this.attachBatchFiles(e);let r=new Map;for(let i of e){let o=r.get(i.relativePath);o?o.push(i):r.set(i.relativePath,[i])}for(let[i,o]of r){let s=this.fileCalleesCache.get(i),a=new Set(o.map(u=>u.symbolId)),c=s??this.calleeMapForFile(i,a);for(let u of o){let l=c.get(u.symbolId)??[];this.calleesCache.set(u.symbolId,l),t.set(u.symbolId,l)}}return t}calleeCoverageForDefinitions(e){this.attachBatchFiles(e);let t=new Map,r=new Map;for(let i of e){let o=r.get(i.relativePath);o?o.push(i):r.set(i.relativePath,[i]),t.set(i.symbolId,{callSites:0,resolvedInRepository:0,resolvedExternal:0,unresolved:0})}for(let[i,o]of r){let s=this.sourceFiles.sourceFile(i);if(!s)continue;let a=this.compilerCheckerForSourceFile(s),c=s.compilerNode,u=new Map,l=hn(this.tsMorph.ts,c,o),f=d=>{if(this.tsMorph.ts.isCallExpression(d)||this.tsMorph.ts.isNewExpression(d)||Qt(this.tsMorph.ts,d)){let m=l(d),p=m?t.get(m.symbolId):void 0;p&&this.recordCallSiteCoverage(d,a,p,u)}this.tsMorph.ts.forEachChild(d,f)};f(c)}return t}callNodeExpression(e){return this.tsMorph.ts.isJsxOpeningElement(e)||this.tsMorph.ts.isJsxSelfClosingElement(e)?this.tsMorph.ts.isJsxNamespacedName(e.tagName)?null:e.tagName:e.expression}recordCallSiteCoverage(e,t,r,i){r.callSites+=1;let o=this.callNodeExpression(e),s=o?this.compilerSymbolForExpression(t,o):void 0;if(!s){r.unresolved+=1;return}let a=i.get(s);a===void 0&&(a=this.definitionFromCompilerSymbol(s),i.set(s,a)),a?r.resolvedInRepository+=1:r.resolvedExternal+=1}referencesForDefinitionNode(e,t,r){let i=r?x.now():0,o=this.packageImportReferencesForDefinition(e);if(r&&(r.packageRefsMs+=x.now()-i,r.packageReferenceCount+=o.length),!t)return o;let s=r?x.now():0,a=_t(t,e,o,this.db.config.projectRoot);return r&&(r.semanticRefsMs+=x.now()-s,r.referenceCount+=a.length),a}signatureFor(e){return E(this.signatureCache,e.symbolId,()=>{let t=this.nodeForDefinition(e);if(!t||!this.tsMorph.Node.isFunctionDeclaration(t)&&!this.tsMorph.Node.isMethodDeclaration(t)&&!this.tsMorph.Node.isArrowFunction(t)&&!this.tsMorph.Node.isFunctionExpression(t)&&!this.tsMorph.Node.isConstructorDeclaration(t))return null;let r=t.getType().getCallSignatures()[0];if(!r)return null;let i=r.getParameters().map(s=>{let a=s.getDeclarations()[0];return(a?s.getTypeAtLocation(a).getText(a):s.getValueDeclaration()?.getType().getText()??"unknown").trim()}),o=r.getReturnType().getText(t);return`(${i.join(",")})=>${o.trim()}`})}importUsageForSourceFile(e,t,r){let i=[],o=new Map;for(let s of t.getImportDeclarations()){r.declarations+=1;let a=dn(this.db,e,s.getModuleSpecifierValue()),c=s.getImportClause()?.isTypeOnly()??!1;for(let u of Pn(s)){let l=Bi(a,u,c,r),{bindingSymbol:f}=l;if(i.push(l),c||!u.localName||!f)continue;let d=o.get(u.localName);d?d.push(l):o.set(u.localName,[l])}}return o.size>0&&t.forEachDescendant(s=>{if(s.getKindName()!=="Identifier")return;let a=o.get(s.getText());if(!a||Pi(s))return;r.scannedIdentifiers+=1;let c=s.getSymbol()?.compilerSymbol;if(r.symbolLookups+=1,!!c){for(let u of a)if(u.bindingSymbol===c){u.references.push({location:He(s,this.db.config.projectRoot),node:s}),r.matchedReferences+=1;break}}}),i.map(s=>s.typeOnlyDeclaration?Ti(e,s.sourcePath,s.entry):s.entry.identifier&&!s.bindingSymbol?(r.fallbackEntries+=1,this.valueImportUsageForEntry(e,s.sourcePath,s.entry)):this.valueImportUsageFromLocations(e,s.sourcePath,s.entry,s.references))}valueImportUsageForEntry(e,t,r){let i=r.identifier?r.identifier.findReferences():[],o=[];for(let s of i)for(let a of Lt(s,e,r.identifier,this.db.config.projectRoot))o.push(a);return this.valueImportUsageFromLocations(e,t,r,o)}valueImportUsageFromLocations(e,t,r,i){let o=i.some(c=>!Rn(c.node)),s=i.some(c=>Rn(c.node)),a=r.isTypeOnly;return{importer:e,sourcePath:t,importedName:r.importedName,localName:r.localName,kind:r.kind,isTypeOnly:a,isUsed:a||i.length>0,isTypeUsed:a||s,isValueUsed:o,references:i.map(c=>c.location)}}packageImportReferencesForDefinition(e){return this.packageImportReferences().get(e.symbolId)??[]}packageImportReferencesForFiles(e){let t=new Map,r=new Set;for(let o of e){let s=this.sourceFiles.sourceFile(o);if(s)for(let a of s.getImportDeclarations()){let c=xn(this.workspacePackages,a.getModuleSpecifierValue());c&&r.add(c)}}if(r.size===0)return t;let i=this.packageExportsForNames(r);for(let o of e)this.addPackageImportReferencesForDocument(t,i,o);for(let[o,s]of t)t.set(o,oe(s));return t}packageImportReferences(){if(this.packageImportReferenceIndex)return this.packageImportReferenceIndex;let e=new Map,t=this.packageExports();for(let r of this.sourceFiles.indexedTypeScriptLikeDocuments())this.addPackageImportReferencesForDocument(e,t,r);for(let[r,i]of e)e.set(r,oe(i));return this.packageImportReferenceIndex=e,e}addPackageImportReferencesForDocument(e,t,r){if(this.db.isIgnored(r))return;let i=this.sourceFiles.sourceFileMatch(r);if(i)for(let o of i.sourceFile.getImportDeclarations())this.addPackageImportReferencesForDeclaration(e,t,r,o)}addPackageImportReferencesForDeclaration(e,t,r,i){let o=xn(this.workspacePackages,i.getModuleSpecifierValue());if(!o)return;let s=t.get(o);if(s)for(let a of Pn(i)){if(a.kind!=="named"||!a.identifier)continue;let c=s.get(a.importedName);if(!c||c.size===0)continue;let u=Ot(a.identifier,r,this.db.config.projectRoot);u.length>0&&Oi(e,c,u)}}packageExports(){return this.packageExportIndex?this.packageExportIndex:(this.packageExportIndex=this.packageExportsForNames(new Set(this.workspacePackages.map(e=>e.name))),this.packageExportIndex)}packageExportsForNames(e){let t=new Map;for(let r of this.workspacePackages){if(!e.has(r.name))continue;let i=new Map;for(let o of Ht(r))this.collectPackageExports(r,o,i,new Set);i.size>0&&t.set(r.name,i)}return t}collectPackageExports(e,t,r,i){if(i.has(t))return;i.add(t);let o=this.sourceFiles.sourceFile(t);if(o)for(let s of o.getExportDeclarations()){let a=s.getModuleSpecifierValue(),c=a?dn(this.db,t,a):t;if(!c||!c.startsWith(`${e.relativeDir}/src/`))continue;let u=s.getNamedExports();if(u.length===0){if(s.isNamespaceExport())continue;this.collectPackageExports(e,c,r,i);continue}ji(u,r,l=>this.indexedDefinitionByLeaf(c,l))}}indexedDefinitionByLeaf(e,t){return E(this.indexedDefinitionLeafCache,e,()=>Bt(this.db,e)).get(t)??null}nodeForDefinition(e){return E(this.definitionNodeCache,e.symbolId,()=>this.definitionNodesForFile(e.relativePath).get(e.symbolId)??null)}definitionNodesForFile(e){return E(this.fileDefinitionNodeCache,e,()=>{let t=this.sourceFiles.sourceFile(e);return t?Ut(this.tsMorph,this.db,t,e):new Map})}referenceDefinitionFromCompilerSymbol(e){return this.definitionFromCompilerSymbol(e,void 0,!0)}definitionFromCompilerSymbol(e,t,r=!1){let i=e.name,o=t?x.now():0,s=e.declarations??[];t&&(t.declarationsMs+=x.now()-o,t.declarationChecks+=s.length);for(let a of s){let c=t?x.now():0,u=a.getSourceFile(),l=se(this.db.config.projectRoot,u.fileName),f=u.getLineAndCharacterOfPosition(a.getStart(u)).line;if(t&&(t.declarationLocationMs+=x.now()-c),!l||this.db.isIgnored(l))continue;let d=this.indexedMatchForCompilerDeclaration(a,l,f,i,t,r);if(d)return{symbolId:d.symbolId,symbol:d.symbol,file:d.relativePath,line:d.startLine}}return null}indexedMatchForCompilerDeclaration(e,t,r,i,o,s){let a=o?x.now():0,c=this.compilerDeclarationName(e),u=s?Mn(this.db,t,r,i)??(c&&c!==i?Mn(this.db,t,r,c):null):qt(this.db,t,r,i);return o&&(o.indexedLookupMs+=x.now()-a),u}compilerDeclarationName(e){let t=e.name;return t&&this.tsMorph.ts.isIdentifier(t)?t.text:null}calleeMapForFile(e,t){let r=A(),i=0,o=0,s=0,a=0,c=0,u=0,l=0,f=0,d=r?Ai():void 0;return C("typescript.callee-map.file",()=>{let m=r?x.now():0,p=this.sourceFiles.sourceFile(e);if(r&&(c=Math.round(x.now()-m)),!p)return new Map;let y=zi(this.db,e,r),b=y.definitions;if(r&&(u=y.durationMs),i=b.length,b.length===0)return new Map;let S=new Map,g=r?x.now():0,D=this.compilerCheckerForSourceFile(p),P=p.compilerNode,M=hn(this.tsMorph.ts,P,b);r&&(l=Math.round(x.now()-g));let T=new Map,v=I=>{if(this.tsMorph.ts.isCallExpression(I)||this.tsMorph.ts.isNewExpression(I)||Qt(this.tsMorph.ts,I)){r&&(o+=1);let R=this.semanticCalleeForCallNode(D,P,M,I,T,t,d);R&&(r&&(s+=1),ki(S,R.callerId,R.target))}this.tsMorph.ts.forEachChild(I,v)},h=r?x.now():0;return v(P),r&&(f=Math.round(x.now()-h)),Ki(S),a=S.size,S},()=>({relativePath:e,definitions:i,callNodes:o,resolvedCallees:s,outputRows:a,requestedDefinitions:t?.size??i,sourceFileLookupMs:c,definitionsLoadMs:u,checkerLookupMs:l,traversalMs:f,...d?Ni(d):{}}))}semanticCalleeForCallNode(e,t,r,i,o,s,a){let c=this.requestedCallSiteOwner(r,i,s,a);if(!c)return null;let u=this.tsMorph.ts.isJsxOpeningElement(i)||this.tsMorph.ts.isJsxSelfClosingElement(i);if(u&&this.tsMorph.ts.isJsxNamespacedName(i.tagName))return null;let l=u?i.tagName:i.expression,f=this.compilerSymbolForExpression(e,l,a),d=this.profiledCalleeTarget(f,o,a);return d?{callerId:c.symbolId,target:{symbol:d.symbol,file:d.file,line:d.line,callsiteLine:Vt(t,i),...u?{kind:"jsx-render"}:{}}}:null}requestedCallSiteOwner(e,t,r,i){let o=i?x.now():0,s=e(t);return i&&(i.callerLookupMs+=x.now()-o),s?r&&!r.has(s.symbolId)?(i&&(i.skippedUnrequestedCallers+=1),null):s:null}profiledCalleeTarget(e,t,r){if(!e)return r&&(r.targetMisses+=1),null;if(r&&(r.targetSymbolHits+=1),t.has(e))return r&&(r.compilerSymbolCacheHits+=1),t.get(e)??null;r&&(r.compilerSymbolCacheMisses+=1);let i=r?x.now():0,o=this.definitionFromCompilerSymbol(e,r);return r&&(r.targetLookupMs+=x.now()-i),t.set(e,o),o}compilerSymbolForExpression(e,t,r){let i=r?x.now():0,o=e.getSymbolAtLocation(t);if(r&&(r.expressionSymbolMs+=x.now()-i),o){if((o.flags&this.tsMorph.ts.SymbolFlags.Alias)===0)return o;try{return e.getAliasedSymbol(o)}catch{return o}}r&&(r.typeFallbacks+=1);let s=r?x.now():0,a=e.getTypeAtLocation(t).getSymbol();return r&&(r.typeSymbolMs+=x.now()-s),a}compilerCheckerForSourceFile(e){return e.getProject().getTypeChecker().compilerObject}};function Pn(n){let e=[],t=n.getDefaultImport();t&&e.push({identifier:t,importedName:"default",localName:t.getText(),kind:"default",isTypeOnly:n.getImportClause()?.isTypeOnly()??!1});let r=n.getNamespaceImport();r&&e.push({identifier:r,importedName:"*",localName:r.getText(),kind:"namespace",isTypeOnly:n.getImportClause()?.isTypeOnly()??!1});for(let i of n.getNamedImports())e.push(Hi(i,n));return e.length===0&&e.push({identifier:null,importedName:"*",localName:null,kind:"side-effect",isTypeOnly:!1}),e}function Ti(n,e,t){return{importer:n,sourcePath:e,importedName:t.importedName,localName:t.localName,kind:t.kind,isTypeOnly:!0,isUsed:!0,isTypeUsed:!0,isValueUsed:!1,references:[]}}function wi(){return{declarations:0,entries:0,bindingSymbols:0,missingBindingSymbols:0,scannedIdentifiers:0,symbolLookups:0,matchedReferences:0,fallbackEntries:0}}function Pi(n){for(let e=n;e;e=e.getParent())if(e.getKindName()==="ImportDeclaration")return!0;return!1}function ki(n,e,t){let r=n.get(e);r||(r=[],n.set(e,r)),r.push(t)}function Ei(n){let e=new Set;for(let t of n.getImportDeclarations())for(let r of Pn(t))r.localName&&e.add(r.localName);return e}function Vt(n,e){return n.getLineAndCharacterOfPosition(e.getStart(n)).line}function Fi(n,e,t){return e===n.relativePath&&t>=n.startLine&&t<=n.endLine}function $t(n){return n.symbol.includes("#")?Le(n.symbol)==="type"&&n.relativePath.endsWith(".d.ts"):!1}function Ai(){return{callerLookupMs:0,expressionSymbolMs:0,typeSymbolMs:0,targetLookupMs:0,declarationsMs:0,declarationLocationMs:0,indexedLookupMs:0,compilerSymbolCacheHits:0,compilerSymbolCacheMisses:0,targetSymbolHits:0,targetMisses:0,typeFallbacks:0,declarationChecks:0,skippedUnrequestedCallers:0}}function Ni(n){return{...n,callerLookupMs:Math.round(n.callerLookupMs),expressionSymbolMs:Math.round(n.expressionSymbolMs),typeSymbolMs:Math.round(n.typeSymbolMs),targetLookupMs:Math.round(n.targetLookupMs),declarationsMs:Math.round(n.declarationsMs),declarationLocationMs:Math.round(n.declarationLocationMs),indexedLookupMs:Math.round(n.indexedLookupMs)}}function Yt(){return{cacheHits:0,cacheMisses:0,nodeHits:0,nodeMisses:0,scanFiles:0,identifiers:0,symbolLookups:0,aliasResolutions:0,targetHits:0,targetMisses:0,requestedHits:0,scanMs:0,packageRefsMs:0,semanticRefsMs:0,packageReferenceCount:0,referenceCount:0,preciseSearchFailures:0,hierarchyDefinitions:0,hierarchyFamilies:0,hierarchyReferences:0,hierarchyMs:0}}var Zt=1,Jt=me({kind:"typescript-hierarchy-targets",invalidation:K("typescript-hierarchy-targets"),serialize:n=>JSON.stringify(n),deserialize:n=>{try{let e=JSON.parse(n);return e.version!==Zt||typeof e.projectRoot!="string"||!Array.isArray(e.entries)?null:e}catch{return null}}});function _i(n,e){let t=new Map(e.map(i=>[i.symbol,i])),r=new Map;for(let[i,o]of n.entries){let s=new Map;for(let a of o){let c=t.get(a);c&&s.set(c.symbolId,c)}s.size>0&&r.set(i,s)}return r}function Li(n){let e=2166136261;for(let t of n)e^=t.symbolId,e=Math.imul(e,16777619)>>>0;return`${n.length}:${e.toString(16)}`}function Gt(n){return{...n,scanMs:Math.round(n.scanMs),packageRefsMs:Math.round(n.packageRefsMs),semanticRefsMs:Math.round(n.semanticRefsMs),hierarchyMs:Math.round(n.hierarchyMs)}}function Oi(n,e,t){for(let r of e){let i=n.get(r)??[];i.push(...t),n.set(r,i)}}function Qt(n,e){if(!n.isJsxOpeningElement(e)&&!n.isJsxSelfClosingElement(e))return!1;let t=e.tagName;return n.isPropertyAccessExpression(t)?!0:n.isIdentifier(t)?/^[A-Z]/.test(t.text):!1}function Ui(n){let e=new Set,t=[];for(let r of n){let i=`${r.symbol}|${r.file}|${r.line}|${r.callsiteLine??""}`;e.has(i)||(e.add(i),t.push(r))}return t}function qi(n){let e=new Map;for(let t of n){let r=e.get(t.relativePath);r?r.push(t):e.set(t.relativePath,[t])}return e}function Bi(n,e,t,r){r.entries+=1;let i=t?null:e.identifier?.getSymbol()?.compilerSymbol??null;return!t&&e.identifier&&(i?r.bindingSymbols+=1:r.missingBindingSymbols+=1),{sourcePath:n,entry:e,typeOnlyDeclaration:t,bindingSymbol:i,references:[]}}function ji(n,e,t){for(let r of n){let i=r.getNameNode().getText(),o=r.getAliasNode()?.getText()??i,s=t(i);if(!s)continue;let a=e.get(o);a||(a=new Set,e.set(o,a)),a.add(s.symbolId)}}function Wi(n,e,t){return n&&e.has(n.symbolId)?t.get(n.symbolId):void 0}function Hi(n,e){let t=n.getNameNode(),i=n.getAliasNode()??(t.getKindName()==="Identifier"?t:null);return{identifier:i,importedName:t.getText(),localName:i?.getText()??t.getText(),kind:"named",isTypeOnly:n.isTypeOnly()||(e.getImportClause()?.isTypeOnly()??!1)}}function zi(n,e,t){let r=t?x.now():0,i=B(n,e).sort((s,a)=>s.startLine-a.startLine||a.endLine-s.endLine),o=t?Math.round(x.now()-r):0;return{definitions:i,durationMs:o}}function Ki(n){for(let[e,t]of n)n.set(e,Ui(t))}import{join as Vi}from"path";var ze=3;var $i="typescript-semantic";function er(n){let e=Vi(n,$i),t=Oe(e);return{...t,requestDir:t.legacyRequestDir}}var Gi=12e4,Qi=5;function ir(n,e,t={}){let r=t.requester??new En(n,t),i=null,o=null,s=process.env.SCIP_QUERY_SKIP_WATCH_SERVICE==="1",a=null,c=()=>(i??=Xt(n,e),i),u=(p,y,b)=>(s=!0,to(n)?y():(a=p instanceof Error?p.message:String(p),console.error(`TypeScript semantic service request failed (${a}); semantic enrichment is disabled for the rest of this run because the index is too large for an in-process compiler.`),b())),l=(p,y,b,S=b)=>{if(a!==null)return S();if(s)return b();try{return y(r.request(p))}catch(g){return nr(g)?S():u(g,b,S)}},f=(p,y,b,S)=>{if(a!==null)return new Map;if(s)return S();let g=D=>{try{return b(r.request(y(D)))}catch(P){if(!Xi(P))throw P;let M=Zi(D);if(!M)throw P;return new Map([...g(M[0]),...g(M[1])])}};try{return g(p)}catch(D){return nr(D)?new Map:u(D,S,()=>new Map)}},d=(p,y)=>f(p,b=>({kind:"references",definitions:[...b],...y?.exact?{exact:!0}:{}}),b=>kn(b),()=>c().referencesForDefinitions?.(p,y)??new Map(p.map(b=>[b.symbolId,c().referencesFor(b)]))),m=p=>f(p,y=>({kind:"callees",definitions:[...y]}),y=>kn(y),()=>c().calleesForDefinitions?.(p)??new Map(p.map(y=>[y.symbolId,c().calleesFor(y)])));return{language:"typescript",availability:()=>(o??=l({kind:"availability"},so,()=>c().availability(),()=>({available:!1,reason:`TypeScript semantic service declined: ${a??"unknown"}`})),o),importUsage:p=>l({kind:"import-usage",file:p},y=>y,()=>c().importUsage(p),()=>[]),referencesFor:p=>d([p]).get(p.symbolId)??[],referencesForDefinitions:d,referenceFragmentsForFiles:p=>l({kind:"reference-fragments",files:[...p]},y=>oo(y),()=>c().referenceFragmentsForFiles?.(p)??new Map,()=>new Map),calleesFor:p=>m([p]).get(p.symbolId)??[],calleesForDefinitions:m,calleeCoverageForDefinitions:p=>f(p,y=>({kind:"callee-coverage",definitions:[...y]}),y=>kn(y),()=>c().calleeCoverageForDefinitions?.(p)??new Map),signatureFor:p=>l({kind:"signature",definition:p},ao,()=>c().signatureFor(p),()=>null),dispose:()=>i?.dispose?.()}}function Xi(n){let e=n instanceof Error?n.message:String(n);return/memory limit|heap out of memory|worker terminated|worker failed/iu.test(e)}function Zi(n){let e=[...new Set(n.map(r=>r.relativePath))].sort();if(e.length<2)return null;let t=new Set(e.slice(0,Math.ceil(e.length/2)));return[n.filter(r=>t.has(r.relativePath)),n.filter(r=>!t.has(r.relativePath))]}function nr(n){let e=n instanceof Error?n.message:String(n);return e.includes("invalid mailbox request")||e.includes("Unhandled TypeScript semantic request")||e.includes("compiler project is file-scoped")}var eo=2500,no=25e3,tr=new WeakMap;function to(n){let e=tr.get(n);if(e!==void 0)return e;let t=ro(n);return tr.set(n,t),t}function ro(n){try{let e=n.get("SELECT (SELECT count(*) FROM documents) AS documents, (SELECT count(*) FROM global_symbols) AS symbols");return!e||e.documents<eo&&e.symbols<no}catch{return!0}}var En=class{constructor(e,t={}){this.db=e;this.runtime=t.runtime??sr,this.timeoutMs=t.timeoutMs??co(),this.mailboxLimits=t.mailboxLimits??{},this.cacheDir=rr(e.config.dbPath),this.projectRoot=ln(e.config.projectRoot)}db;runtime;timeoutMs;cacheDir;projectRoot;mailboxLimits;request(e){let t=mn(this.cacheDir),r=er(this.cacheDir),i=qe(t.statePath);if(!Fn(i,this.projectRoot,this.runtime))throw new Error("Compatible TypeScript semantic service is not running.");let o=this.db.generation.identity;if(!o)throw new Error("Published TypeScript generation identity is unavailable.");let s=this.runtime.now(),a=s+this.timeoutMs,c=(this.runtime.monotonicNow??O)()+this.timeoutMs,u=yt(),l=te("typescript-semantic-v3",{generation:o,profileEnvironment:u,request:e}),f=re(l),d=Ue(r,{mailboxVersion:$,operationKey:l,clientId:this.runtime.randomId(),enqueuedAtMs:s,deadlineAtMs:a,protocolVersion:ze,id:f,generation:o,profileEnvironment:u,request:e},{nowMs:s,limits:this.mailboxLimits});for(;(this.runtime.monotonicNow??O)()<=c;){if(Ji(d.responsePath))return io(L(d.responsePath,{maxBytes:this.mailboxLimits.maxItemBytes??64*1024*1024,inputKind:"TypeScript semantic mailbox response"}),f,o,l);let m=qe(t.statePath);if(!Fn(m,this.projectRoot,this.runtime))throw new Error("TypeScript semantic service stopped while processing a request.");this.runtime.sleep(Qi)}throw new Error(`TypeScript semantic service timed out after ${this.timeoutMs}ms.`)}};function or(n){if(process.env.SCIP_QUERY_SKIP_WATCH_SERVICE==="1")return!1;try{let e=qe(mn(rr(n.config.dbPath)).statePath);return Fn(e,ln(n.config.projectRoot),sr)}catch{return!1}}function Fn(n,e,t){let r=n?.processIdentity?t.readProcessIdentity?.(n.pid):null;return n!==null&&n.projectRoot===e&&n.typescriptSemantic?.protocolVersion===ze&&t.isProcessAlive(n.pid)&&(!n.processIdentity||r!=null&&we(n.processIdentity,r))}function io(n,e,t,r){let i=JSON.parse(n);if(i.protocolVersion!==ze||i.id!==e||i.operationKey!==r||i.ok===!0&&i.generation!==t)throw new Error("TypeScript semantic service wrote an incompatible response.");if(i.ok===!0)return i.response;throw new Error(typeof i.error=="string"?i.error:"TypeScript semantic service request failed.")}function kn(n){if(!Array.isArray(n))throw new Error("TypeScript semantic service wrote an invalid numeric map.");return new Map(n)}function oo(n){if(!Array.isArray(n))throw new Error("TypeScript semantic service wrote an invalid string map.");return new Map(n)}function so(n){let e=Et(n);if(!e)throw new Error("TypeScript semantic service wrote invalid availability.");return e}function ao(n){if(n!==null&&typeof n!="string")throw new Error("TypeScript semantic service wrote an invalid signature.");return n}function co(){let n=Number(process.env.SCIP_TYPESCRIPT_SEMANTIC_TIMEOUT_MS);return Number.isInteger(n)&&n>0?n:Gi}var sr={now:Date.now,monotonicNow:O,randomId:Yi,sleep(n){let e=new Int32Array(new SharedArrayBuffer(4));Atomics.wait(e,0,0,n)},isProcessAlive:Fe,readProcessIdentity:Ee};function ar(n){let e=new Map,t=uo(n),r=new Map;return i=>{let o=lo(i),s=r.get(o);if(s!==void 0)return s;if(!t.has(i.file))return r.set(o,i.symbol),i.symbol;let a=e.get(i.file);a||(a=fo(B(n,i.file)),e.set(i.file,a));let c=po(a,i);return r.set(o,c),c}}function lo(n){return`${n.file}\0${n.symbol}\0${n.line}`}function uo(n){return new Set(n.all("SELECT relative_path FROM documents").map(e=>e.relative_path))}function fo(n){let e=new Map,t=new Map;for(let r of n){let i=e.get(r.leaf);i?i.push(r):e.set(r.leaf,[r]);let o=t.get(r.startLine);o?o.push(r):t.set(r.startLine,[r])}return{definitions:n,byLeaf:e,byStartLine:t}}function po(n,e){if(n.definitions.length===0)return e.symbol;let t=So(e.symbol),r=mo(n.byLeaf,t),i=yo(r,e.line);if(i)return i.symbol;let o=n.byStartLine.get(e.line)??[];return o.length===1?o[0].symbol:e.symbol}function mo(n,e){let t=[],r=new Set;for(let i of e)for(let o of n.get(i)??[])r.has(o.symbolId)||(r.add(o.symbolId),t.push(o));return t}function yo(n,e){let t=null;for(let r of n)if(!(r.startLine>e||r.endLine<e)){if(r.startLine===e)return r;(!t||r.endLine-r.startLine<t.endLine-t.startLine)&&(t=r)}return t}function So(n){let e=new Set([n]),r=n.split(/::|\.|#/).filter(Boolean).at(-1);return r&&e.add(r),e}function cr(n,e){let r=bt(n,e).map(i=>Ro(e,i));return{usage:r,positions:bo(n,e,r)}}function lr(n,e){return{importUsage(t){let r=n.importUsageFacts(t);if(!e||r.positions.length===0)return r.usage;let i=e.importDefinitionsForFile(t,r.positions);return i.available?go(r.usage,i.sourcePaths):r.usage}}}function go(n,e){return n.map((t,r)=>{let i=e.get(String(r));return i?{...t,sourcePath:i}:t})}function Ro(n,e){let t=e.isTypeOnly===!0,r=e.kind==="side-effect"||t||e.used;return{importer:n,sourcePath:e.sourcePath,importedName:e.importedName,localName:e.localName,kind:e.kind,isTypeOnly:t,isUsed:r,isTypeUsed:t,isValueUsed:e.kind==="side-effect"||!t&&e.used,references:[]}}function bo(n,e,t){let r=gt(n,e);if(!r)return[];let i=ho(r.rootNode),o=new Map;for(let a of i){let c=o.get(An(a.importedName,a.localName));c?c.push(a.position):o.set(An(a.importedName,a.localName),[a.position])}let s=[];return t.forEach((a,c)=>{let u=o.get(An(a.importedName,a.localName??a.importedName))?.shift();u&&s.push({...u,id:String(c),file:e})}),s}function ho(n){let e=[];for(let t of n.descendantsOfType("use_declaration")){let r=t.namedChildren.find(i=>i.type!=="visibility_modifier");r&&e.push(...Ke(r,""))}return e.filter(t=>t.importedName!=="*")}function Ke(n,e){switch(n.type){case"identifier":case"super":case"self":case"crate":return[{importedName:n.text,localName:n.text,position:Nn(n,n.text)}];case"scoped_identifier":return Io(n);case"scoped_use_list":return Mo(n,e);case"use_list":return n.namedChildren.flatMap(t=>Ke(t,e));case"use_as_clause":return Do(n,e);case"use_wildcard":return vo(n);default:return[]}}function Io(n){let e=n.text.split("::").pop()??n.text;return[{importedName:e,localName:e,position:Nn(n,e)}]}function Mo(n,e){let t=n.namedChild(0),r=n.namedChild(1);if(!t||!r)return[];let i=Rt(e,t.text);return r.namedChildren.flatMap(o=>Ke(o,i))}function Do(n,e){let t=n.namedChild(0),r=n.namedChild(1);return!t||!r?[]:Ke(t,e).map(i=>({...i,localName:r.text}))}function vo(n){let e=n.namedChild(0),t="*";return[{importedName:t,localName:t,position:Nn(e??n,t)}]}function Nn(n,e){let t=Math.max(0,n.text.lastIndexOf(e));return{id:"",file:"",line:n.startPosition.row,column:n.startPosition.column+t+xo(e)}}function xo(n){return Math.max(0,Math.min(n.length-1,1))}function An(n,e){return`${n}\0${e}`}import{spawnSync as Kn}from"child_process";import{existsSync as Vn}from"fs";import{fileURLToPath as Bs}from"url";function Ve(n){let e=vt(Dt,n),t=e.runnable;return t?{available:!0,dependencyAvailable:t,resolvedBinary:e.resolvedBinary??void 0,note:"rust-analyzer semantic reference queries are enabled."}:{available:!1,dependencyAvailable:t,resolvedBinary:e.resolvedBinary??void 0,reason:"rust-analyzer is not runnable; Rust semantic checks will use SCIP/source evidence only."}}import{existsSync as Ms,mkdtempSync as Ar,rmSync as Bn}from"fs";import{tmpdir as Nr}from"os";import{join as jn}from"path";import{fileURLToPath as Ze,pathToFileURL as Ds}from"url";import{SHARE_ENV as vs,Worker as xs}from"worker_threads";function j(n,e,t=new Set){let r=new Map;for(let i of n)t.has(i.symbolId)||r.set(i.symbolId,e.get(i.symbolId)??[]);return r}function Y(n,e,t){let r=ne(process.env.SCIP_RUST_SEMANTIC_BATCH_TIMEOUT_MS)??0;if(r>0)return r;let i=Math.max(1,Math.ceil(n/Math.max(1,t)));return Math.max(12e4,3e4+i*e)}import{spawn as Go}from"child_process";import{createHash as Qo,randomUUID as Xo}from"crypto";import{existsSync as vr,realpathSync as Zo,rmSync as es}from"fs";import{tmpdir as ns}from"os";import{resolve as ce}from"path";import{execFileSync as No}from"child_process";import{existsSync as Co}from"fs";import{deserializeSCIP as To,SymbolRole as wo}from"@c4312/scip";import{realpathSync as Dl}from"fs";import{basename as xl,dirname as Cl,join as Tl,relative as wl,sep as Pl}from"path";import{fileURLToPath as El,pathToFileURL as Fl}from"url";function $e(n){let e=new Map;for(let t of n)e.set(`${t.file}\0${t.line}\0${t.column}`,t);return[...e.values()].sort((t,r)=>{let i=t.file.localeCompare(r.file);return i!==0?i:t.line!==r.line?t.line-r.line:t.column-r.column})}var _n=new WeakMap,Po="SCIP_RUST_SCIP_OCCURRENCE_REFERENCE_MODE";function ur(n,e){let t=new Map,r=Ye(),i=e.filter(s=>pr(s,r));if(i.length===0)return t;let o=mr(n);if(!o)return t;for(let s of i){let a=dr(o,s);a!==null&&t.set(s.symbolId,a)}return t}function fr(n,e){if(!pr(e,Ye()))return null;let t=mr(n);return t?dr(t,e):null}function dr(n,e){return n.referencesBySymbol.get(e.symbol)??[]}function pr(n,e="safe"){if(!n.symbol.startsWith("rust-analyzer ")||!n.relativePath.endsWith(".rs")||Se(n.symbol)||/impl#\[[^\]]+\]\[Default\]default\(\)\.$/.test(n.symbol))return!1;if(e==="all")return!0;let t=Le(n.symbol);if(t==="method")return!0;if(t!=="term")return!1;let r=ht(n.symbol);return"kind"in r?!1:!ko(r)}function ko(n){for(let e=0;e<n.descriptors.length-1;e+=1)if(n.descriptors[e]?.suffix==="type")return!0;return!1}function mr(n){if(_n.has(n))return _n.get(n)??null;let e=Eo(n);return _n.set(n,e),e}function Eo(n){if(!n.generation.indexPath||!Co(n.generation.indexPath))return null;try{let e=To(ke(n.generation.indexPath,{inputKind:"SCIP occurrence-reference index",maxBytes:Pe})),t=new Map;for(let r of e.documents??[]){let i=r.relativePath;!i||n.isIgnored(i)||Ao(r,i,t)}for(let[r,i]of t)t.set(r,$e(i));return{referencesBySymbol:t}}catch{return null}}function Fo(n,e){if(e.length<3)return null;let t=e[0],r=e[1];return!Number.isInteger(t)||!Number.isInteger(r)?null:{file:n,line:t,column:r}}function Ye(){return process.env[Po]==="all"?"all":"safe"}function Ao(n,e,t){for(let r of n.occurrences??[]){if(!r.symbol||(r.symbolRoles&wo.Definition)!==0)continue;let i=Fo(e,r.range);if(!i)continue;let o=t.get(r.symbol)??[];o.push(i),t.set(r.symbol,o)}}var yr=new Map;function Ln(n){let t=Ve(n).resolvedBinary??null;return{engine:"rust-analyzer",resolvedBinary:t,version:t?_o(n,t):"unavailable"}}function On(n){return{...Ln(n),scipOccurrenceReferenceMode:Ye()}}function _o(n,e){let t=`${n}\0${e}`,r=yr.get(t);if(r)return r;let i;try{i=No(e,["--version"],{cwd:n,encoding:"utf8",stdio:["ignore","pipe","ignore"],timeout:2e3}).trim()}catch{i="unknown"}return yr.set(t,i),i}import{createHash as Lo}from"crypto";var Oo=new Set(["Cargo.lock","Cargo.toml","rust-project.json","rust-toolchain","rust-toolchain.toml"]);function Sr(n){let e=ct(n,{includePath:Uo});return Lo("sha256").update(JSON.stringify(e)).digest("hex")}function Uo(n){let e=n.replaceAll("\\","/"),t=e.split("/").at(-1)??e;return e.endsWith(".rs")||Oo.has(t)?!0:e===".cargo/config"||e===".cargo/config.toml"||e.endsWith("/.cargo/config")||e.endsWith("/.cargo/config.toml")}import{createHash as qo}from"crypto";import{resolve as Bo}from"path";var ae=3;function qn(n){return qo("sha256").update(ge({kind:"scip-query-durable-rust-mailbox",protocolVersion:ae,sessionDir:Bo(n)})).digest("hex")}function jo(n,e){return n.mailboxVersion===$&&n.id===e.requestId&&n.operationKey===e.operationKey&&n.sessionIdentity===e.sessionIdentity&&n.deadlineAtMs===e.deadlineAtMs}function Wo(n,e){return typeof n.completedAtMs=="number"&&Number.isFinite(n.completedAtMs)&&!(n.completedAtMs>e.deadlineAtMs)&&!(e.nowMs>e.deadlineAtMs)}function Ho(n,e){return n.ok===!1?typeof n.error!="string"||!Jo(n.errorCode)?Un("helper wrote an invalid rejection response"):{ok:!1,code:n.errorCode,error:n.error}:n.ok!==!0||n.session!=="created"&&n.session!=="reused"&&n.session!=="invalidated"||!zo(n.response,e)?Un("helper wrote an invalid success response"):{ok:!0,session:n.session,response:n.response}}function br(n,e){return de(n)?n.protocolVersion!==ae?Rr(n.protocolVersion===void 0?"helper wrote a prior uncorrelated response protocol":`helper wrote unsupported response protocol ${String(n.protocolVersion)}`):jo(n,e)?Wo(n,e)?Ho(n,e.requestKind):{ok:!1,code:"expired-request",error:"helper response arrived after the durable request deadline"}:Rr("helper wrote an incompatible response identity"):Un("helper wrote an invalid response object")}function zo(n,e){return!de(n)||typeof n.available!="boolean"||n.available===!1&&(typeof n.reason!="string"||n.reason.length===0)||n.available===!0&&n.reason!==void 0?!1:e==="import-definitions"?Ko(n):Vo(n)}function Ko(n){return Array.isArray(n.sourcePaths)&&n.sourcePaths.every(e=>Array.isArray(e)&&e.length===2&&typeof e[0]=="string"&&(e[1]===null||typeof e[1]=="string"))}function Vo(n){return gr(n.references,$o)&&(n.incompleteReferenceSymbolIds===void 0||Array.isArray(n.incompleteReferenceSymbolIds)&&n.incompleteReferenceSymbolIds.every(e=>Number.isSafeInteger(e)))&&(n.callees===void 0||gr(n.callees,Yo))&&(n.signatures===void 0||Array.isArray(n.signatures)&&n.signatures.every(e=>Array.isArray(e)&&e.length===2&&Number.isSafeInteger(e[0])&&(e[1]===null||typeof e[1]=="string")))}function gr(n,e){return Array.isArray(n)&&n.every(t=>Array.isArray(t)&&t.length===2&&Number.isSafeInteger(t[0])&&Array.isArray(t[1])&&t[1].every(e))}function $o(n){return de(n)&&typeof n.file=="string"&&F(n.line)&&F(n.column)}function Yo(n){return de(n)&&typeof n.symbol=="string"&&typeof n.file=="string"&&F(n.line)&&(n.callsiteLine===void 0||F(n.callsiteLine))}function Jo(n){return n==="unsupported-protocol"||n==="malformed-request"||n==="expired-request"||n==="handler-error"}function Un(n){return{ok:!1,code:"malformed-response",error:n}}function Rr(n){return{ok:!1,code:"incompatible-response",error:n}}var ts=5e3,xr=10,rs=3e4;function hr(n,e,t,r=kr){let i=r.engineIdentity(n),o={protocolVersion:ae,projectRoot:r.canonicalProjectRoot(n),projectFingerprint:r.projectFingerprint(n),engine:{engine:i.engine,resolvedBinary:i.resolvedBinary,version:i.version},workerFingerprint:r.fileFingerprint(e),environment:Tr(r.environment())};return{key:Er(ge(o)),...o}}function Je(n,e,t,r){if(n.protocolVersion!==ae||!t(n.pid))return!1;if(!n.processIdentity)return!0;let i=r?.(n.pid);return i!=null&&we(n.processIdentity,i)}function Cr(n,e,t){let r;try{r=cn(e,{maxBytes:z,inputKind:"Rust semantic engine artifact"})}catch{r="missing"}let i=Er(ge({projectRoot:ce(n),serverPath:ce(e),serverFingerprint:r})).slice(0,20);return ce(t,`scip-query-rust-session-${i}`)}function Ir(n){let e=n===void 0?Number.NaN:Number(n);return Number.isInteger(e)&&e>=0?e:0}function Tr(n){return Object.fromEntries(Object.entries(n).filter(([e])=>Pr(e)).sort(([e],[t])=>e.localeCompare(t)).map(([e,t])=>[e,t??null]))}function wr(n,e){let t=e.runtime??ps,r=e.identityRuntime??kr,i=Cr(n,e.serverPath,e.tempRoot??ns()),o=!1,s=(a,c)=>{if(o)throw new Error("Durable Rust semantic session was already disposed.");return os(i,e.serverPath,e.semanticWorkerPath,a,c,t,e.mailboxLimits)};return{requestSemantic(a,c){let u=hr(n,e.semanticWorkerPath,a,r),{readinessDeadlineMs:l,...f}=a;return s({kind:"semantic",identityKey:u.key,workerEnvironment:Dr(),request:{...f,referenceRetryTimeoutMs:is(process.env.SCIP_RUST_SEMANTIC_REFERENCE_RETRY_TIMEOUT_MS,a.referenceRetryTimeoutMs),settleDelayMs:process.env.SCIP_RUST_SEMANTIC_SETTLE_MS===void 0?a.settleDelayMs:Ir(process.env.SCIP_RUST_SEMANTIC_SETTLE_MS)},timeoutMs:c},c)},requestImportDefinitions(a,c){let u=hr(n,e.semanticWorkerPath,a,r),{readinessDeadlineMs:l,...f}=a;return s({kind:"import-definitions",identityKey:u.key,workerEnvironment:Dr(),request:{...f,settleDelayMs:process.env.SCIP_RUST_SEMANTIC_SETTLE_MS===void 0?a.settleDelayMs:Ir(process.env.SCIP_RUST_SEMANTIC_SETTLE_MS)},timeoutMs:c},c)},shutdown(){o=!0}}}function is(n,e){return e!==void 0?e:n===void 0?rs:void 0}function os(n,e,t,r,i,o,s={}){let a=o.now(),c=a+i,u=(o.monotonicNow??O)(),l=u+i,f=te("rust-semantic-v3",r),d=re(f),m=Oe(n),p=qn(n),y=Ue(m,{mailboxVersion:$,protocolVersion:ae,id:d,operationKey:f,clientId:o.randomId(),enqueuedAtMs:a,deadlineAtMs:c,sessionIdentity:p,request:r},{nowMs:a,limits:s});for(Mr(n,e,t,l,o);(o.monotonicNow??O)()<=l;){if(vr(y.responsePath)){let S=us(L(y.responsePath,{maxBytes:s.maxItemBytes??z,inputKind:"durable Rust semantic mailbox response"}),{requestId:d,operationKey:f,sessionIdentity:p,deadlineAtMs:y.authoritativeDeadlineAtMs,requestKind:r.kind,nowMs:o.now()});if(!S.ok)throw new Error(S.error);return ys(o,u,S.session,r.kind),S.response}let b=Ge(n);(!b||!Je(b,o.now(),o.isProcessAlive,o.readProcessIdentity))&&Mr(n,e,t,l,o),o.sleep(xr)}throw new Error(`Durable Rust semantic session timed out after ${(i/1e3).toFixed(0)}s.`)}function Mr(n,e,t,r,i){let o=Ge(n);if(o&&Je(o,i.now(),i.isProcessAlive,i.readProcessIdentity))return;es(ce(n,"server.json"),{force:!0}),i.spawnServer(e,n,t);let s=i.monotonicNow??O,a=Math.min(r,s()+ts);for(;s()<=a;){let c=Ge(n);if(c&&Je(c,i.now(),i.isProcessAlive,i.readProcessIdentity))return;i.sleep(xr)}throw new Error("Durable Rust semantic session helper did not become ready within 5s.")}function ss(n,e){return typeof n.protocolVersion=="number"&&as(n,e)&&typeof n.pid=="number"&&typeof n.heartbeatAtMs=="number"}function as(n,e){return n.sessionIdentity===void 0||typeof n.sessionIdentity=="string"&&n.sessionIdentity===qn(e)}function cs(n){return(n.busyUntilMs===void 0||typeof n.busyUntilMs=="number")&&(n.mailbox===void 0||fs(n.mailbox))}function ls(n,e){return{protocolVersion:n.protocolVersion,...n.sessionIdentity===void 0?{}:{sessionIdentity:n.sessionIdentity},pid:n.pid,...e?{processIdentity:e}:{},heartbeatAtMs:n.heartbeatAtMs,...n.busyUntilMs===void 0?{}:{busyUntilMs:n.busyUntilMs},...n.mailbox===void 0?{}:{mailbox:n.mailbox}}}function Ge(n){try{let e=JSON.parse(L(ce(n,"server.json"),{maxBytes:it,inputKind:"durable Rust session state"}));if(!ss(e,n)||!cs(e))return null;let t=e.processIdentity===void 0?null:Te(e.processIdentity);return e.processIdentity!==void 0&&(!t||t.pid!==e.pid)?null:ls(e,t)}catch{return null}}function us(n,e){try{return br(JSON.parse(n),e)}catch(t){return{ok:!1,code:"malformed-response",error:`helper wrote malformed JSON: ${t instanceof Error?t.message:String(t)}`}}}function fs(n){if(!n||typeof n!="object")return!1;let e=n;return ms(e)&&typeof e.totalBytes=="number"&&Number.isFinite(e.totalBytes)&&e.totalBytes>=0&&(e.oldestPendingAt===void 0||Number.isFinite(Date.parse(e.oldestPendingAt)))}function Dr(){return Object.fromEntries(Object.entries(process.env).filter(([n])=>ds(n)).sort(([n],[e])=>n.localeCompare(e)).map(([n,e])=>[n,e??null]))}function Pr(n){return n==="HOME"||n==="PATH"||n.startsWith("CARGO_")||n.startsWith("RA_")||n.startsWith("RUST")}function ds(n){return Pr(n)||n.startsWith("SCIP_RUST_")||n==="SCIP_QUERY_PROFILE"||n==="SCIP_QUERY_PROFILE_CACHE_STATE"||n==="SCIP_QUERY_PROFILE_COMMAND"||n==="SCIP_QUERY_PROFILE_OUT"||n==="SCIP_QUERY_PROFILE_RUN_ID"||n==="SCIP_QUERY_PROFILE_WORKLOAD_IDENTITY"||n==="SCIP_QUERY_PROFILE_WORKLOAD_IDENTITY_KIND"||n==="SCIP_QUERY_PROFILE_MIN_MS"}var kr={canonicalProjectRoot(n){try{return Zo(n)}catch{return ce(n)}},projectFingerprint(n){return Sr(n)},engineIdentity:Ln,fileFingerprint(n){return cn(n,{maxBytes:z,inputKind:"Rust semantic engine artifact"})},environment(){return Tr(process.env)}},ps={now:Date.now,monotonicNow:O,randomId:Xo,isProcessAlive:Fe,readProcessIdentity:Ee,spawnServer(n,e,t){if(!vr(n))throw new Error(`Durable Rust semantic session helper was not found at ${n}. Run npm run build first.`);Go(process.execPath,[n,e,t],{detached:!0,stdio:"ignore"}).unref()},sleep(n){let e=new Int32Array(new SharedArrayBuffer(4));Atomics.wait(e,0,0,n)}};function Er(n){return Qo("sha256").update(n).digest("hex")}function ms(n){return F(n.pending)&&F(n.inflight)&&F(n.responses)&&F(n.deadLetters)&&F(n.invalid)&&F(n.totalItems)}function ys(n,e,t,r){A()&&Ne({type:"span",name:"rust.semantic.durable-session.request",durationMs:(n.monotonicNow??O)()-e,ok:!0,session:t,kind:r})}import{randomUUID as Mu}from"crypto";import{readdirSync as Ss,rmSync as vu,writeFileSync as xu}from"fs";import{join as gs}from"path";var Rs="rust-analyzer-owner-",bs=".json",hs=16*1024;async function Fr(n,e){if(!n)return[];let t;try{t=Ss(n)}catch{return[]}let r=t.filter(s=>s.startsWith(Rs)&&s.endsWith(bs)).map(s=>gs(n,s)),i=[],o=[];for(let s of r){let a=Is(s);a?o.push(a):i.push({reaped:!1,reason:"identity-unavailable",detail:`Rust analyzer ownership record ${s} could not be validated.`})}return i.push(...await Promise.all(o.map(s=>xt(s,e)))),i}function Is(n){try{let e=L(n,{maxBytes:hs,inputKind:"rust-analyzer process ownership record"}),t=JSON.parse(e),r=Te(t.rootIdentity);return t.version!==1||!r||typeof t.ownsProcessGroup!="boolean"?null:{rootPid:r.pid,rootIdentity:r,ownsProcessGroup:t.ownsProcessGroup,knownMembers:new Map([[r.pid,r]])}}catch{return null}}var _r=15e3,Lr=8,Ur=5e3,Cs=64,Ts=96,Wn=class{constructor(e,t,r={}){this.projectRoot=e;this.status=t;this.opts=r;this.requester=r.requester??Es(e,process.env.SCIP_RUST_SEMANTIC_DURABLE_SESSION)}projectRoot;status;opts;requester;referencesForDefinitions(e){let t=this.status(this.projectRoot);if(!t.available||!t.resolvedBinary)return{available:!1,resolvedBinary:t.resolvedBinary,reason:he(t),references:Ie(e)};try{let r=this.requestSession(t.resolvedBinary,e,{includeReferences:!0});return{...be(r),resolvedBinary:t.resolvedBinary,references:j(e,new Map(r.references),new Set(r.incompleteReferenceSymbolIds??[]))}}catch(r){return this.opts.fallbackReferenceResolver?.referencesForDefinitions(e)??{available:!1,resolvedBinary:t.resolvedBinary,reason:r instanceof Error?r.message:String(r),references:Ie(e)}}}calleesForDefinitions(e){let t=this.status(this.projectRoot);if(!t.available||!t.resolvedBinary)return{available:!1,resolvedBinary:t.resolvedBinary,reason:he(t),callees:Me(e)};try{let r=this.requestSession(t.resolvedBinary,e,{includeReferences:!1,includeCallees:!0});return{...be(r),resolvedBinary:t.resolvedBinary,callees:Hn(e,new Map(r.callees??[]))}}catch(r){return this.opts.fallbackCalleeResolver?.calleesForDefinitions(e)??{available:!1,resolvedBinary:t.resolvedBinary,reason:r instanceof Error?r.message:String(r),callees:Me(e)}}}referencesAndCalleesForDefinitions(e,t){let r=this.status(this.projectRoot);if(!r.available||!r.resolvedBinary)return{available:!1,resolvedBinary:r.resolvedBinary,reason:he(r),references:Ie(e),callees:Me(t)};let i=[...e,...t];try{let o=this.requestSession(r.resolvedBinary,i,{includeReferences:e.length>0,includeCallees:t.length>0,referenceDefinitions:e,calleeDefinitions:t});return{...be(o),resolvedBinary:r.resolvedBinary,references:j(e,new Map(o.references),new Set(o.incompleteReferenceSymbolIds??[])),callees:Hn(t,new Map(o.callees??[]))}}catch(o){return this.fallbackReferencesAndCallees(r,e,t,o)}}signaturesForDefinitions(e){let t=this.status(this.projectRoot);if(!t.available||!t.resolvedBinary)return{available:!1,resolvedBinary:t.resolvedBinary,reason:he(t),signatures:Or(e)};try{let r=this.requestSession(t.resolvedBinary,e,{includeReferences:!1,includeCallees:!1,includeSignatures:!0});return{...be(r),resolvedBinary:t.resolvedBinary,signatures:Ls(e,new Map(r.signatures??[]))}}catch(r){return this.opts.fallbackSignatureResolver?.signaturesForDefinitions(e)??{available:!1,resolvedBinary:t.resolvedBinary,reason:r instanceof Error?r.message:String(r),signatures:Or(e)}}}importDefinitionsForFile(e,t){let r=this.status(this.projectRoot);if(t.length===0)return r.available?{available:!0,resolvedBinary:r.resolvedBinary,sourcePaths:new Map}:{available:!1,reason:r.reason,resolvedBinary:r.resolvedBinary,sourcePaths:new Map};if(!r.available||!r.resolvedBinary)return{available:!1,resolvedBinary:r.resolvedBinary,reason:he(r),sourcePaths:new Map(t.map(i=>[i.id,null]))};try{let i=this.requestImportDefinitions(r.resolvedBinary,e,t);return{...be(i),resolvedBinary:r.resolvedBinary,sourcePaths:new Map(i.sourcePaths)}}catch(i){return{available:!1,resolvedBinary:r.resolvedBinary,reason:i instanceof Error?i.message:String(i),sourcePaths:new Map(t.map(o=>[o.id,null]))}}}dispose(){this.requester.shutdown()}requestSession(e,t,r){let i=Qe(process.env.SCIP_RUST_SEMANTIC_REQUEST_TIMEOUT_MS,_r),o=Xe(process.env.SCIP_RUST_SEMANTIC_REFERENCE_RETRY_TIMEOUT_MS,0),s=Qe(process.env.SCIP_RUST_SEMANTIC_CONCURRENCY,Lr),a=Xe(process.env.SCIP_RUST_SEMANTIC_DIAGNOSTICS_TIMEOUT_MS,Math.min(i,1e4)),c=r.referenceDefinitions?[...r.referenceDefinitions]:void 0,u=r.calleeDefinitions?[...r.calleeDefinitions]:void 0,l=r.signatureDefinitions?[...r.signatureDefinitions]:void 0,f=De(process.env.SCIP_RUST_SEMANTIC_SETTLE_MS,{definitionCount:t.length,...r}),d={projectRoot:this.projectRoot,rustAnalyzerBinary:e,definitions:[...t],...c?{referenceDefinitions:c}:{},...u?{calleeDefinitions:u}:{},...l?{signatureDefinitions:l}:{},requestTimeoutMs:i,...r.includeReferences!==!1&&o>0?{referenceRetryTimeoutMs:o}:{},diagnosticsTimeoutMs:a,settleDelayMs:f,concurrency:s,includeReferences:r.includeReferences,includeCallees:r.includeCallees,includeSignatures:r.includeSignatures},m=Os(d);return C("rust.semantic.session.request",()=>this.requester.requestSemantic(d,Y(m,zn(i,d.referenceRetryTimeoutMs),s)),()=>({definitions:t.length,operationDefinitions:m,referenceDefinitions:d.referenceDefinitions?.length,calleeDefinitions:d.calleeDefinitions?.length,signatureDefinitions:d.signatureDefinitions?.length,references:d.includeReferences!==!1,callees:d.includeCallees===!0,signatures:d.includeSignatures===!0,referenceRetryTimeoutMs:d.referenceRetryTimeoutMs}))}fallbackReferencesAndCallees(e,t,r,i){let o=t.length===0?{available:!0,resolvedBinary:e.resolvedBinary,references:Ie(t)}:this.opts.fallbackReferenceResolver?.referencesForDefinitions(t),s=r.length===0?{available:!0,resolvedBinary:e.resolvedBinary,callees:Me(r)}:this.opts.fallbackCalleeResolver?.calleesForDefinitions(r);return o&&s?qs(e,t,r,o,s):{available:!1,resolvedBinary:e.resolvedBinary,reason:i instanceof Error?i.message:String(i),references:Ie(t),callees:Me(r)}}requestImportDefinitions(e,t,r){let i=Qe(process.env.SCIP_RUST_SEMANTIC_REQUEST_TIMEOUT_MS,_r),o=Qe(process.env.SCIP_RUST_SEMANTIC_CONCURRENCY,Lr),s=Xe(process.env.SCIP_RUST_SEMANTIC_DIAGNOSTICS_TIMEOUT_MS,Math.min(i,1e4)),a=Xe(process.env.SCIP_RUST_SEMANTIC_SETTLE_MS,Ur),c={projectRoot:this.projectRoot,rustAnalyzerBinary:e,file:t,positions:[...r],requestTimeoutMs:i,diagnosticsTimeoutMs:s,settleDelayMs:a,concurrency:o};return C("rust.semantic.import-definitions.session.request",()=>this.requester.requestImportDefinitions(c,Y(r.length,i,o)),()=>({file:t,positions:r.length}))}};function be(n){return n.available?{available:!0}:{available:!1,reason:n.reason}}function he(n){return n.available?"rust-analyzer binary path is unavailable.":n.reason}function qr(n,e,t={}){return new Wn(n,e,t)}function De(n,e){let t=jr(n);if(t!==null)return t;let r=e.includeReferences!==!1;return r&&e.includeCallees!==!0&&e.includeSignatures!==!0&&e.definitionCount<=Cs||r&&e.includeCallees===!0&&e.includeSignatures!==!0&&e.definitionCount<=Ts?0:Ur}function ws(n){let e=n?.trim().toLowerCase(),t=["0","false","off","worker"].includes(e??""),r=["1","true","on","durable"].includes(e??""),i=e===void 0||e==="";return{transport:t||!i&&!r?"worker":"durable",source:i?"default":"environment",fallback:"worker",valid:i||t||r,optOut:"SCIP_RUST_SEMANTIC_DURABLE_SESSION=0"}}function Ps(n){return ws(n).transport}function ks(n,e){let t=null,r=!1,i=!1,o=!1,s=()=>t??=e(),a=()=>{i||(n.shutdown(),i=!0)},c=(l,f,d)=>{let m=_s(l);r=!0;try{a()}catch{}A()&&Ne({type:"span",name:"rust.semantic.durable-session.request",durationMs:d,ok:!1,kind:f,session:"worker-fallback",reason:m})},u=(l,f,d)=>{if(o)throw new Error("Rust semantic failover session was already disposed.");if(r)return d(s());let m=performance.now();try{return f(n)}catch(p){c(p,l,performance.now()-m)}return d(s())};return{requestSemantic(l,f){return u("semantic",d=>d.requestSemantic(l,f),d=>d.requestSemantic(l,f))},requestImportDefinitions(l,f){return u("import-definitions",d=>d.requestImportDefinitions(l,f),d=>d.requestImportDefinitions(l,f))},shutdown(){if(o)return;o=!0;let l=[];try{a()}catch(f){l.push(f)}try{t?.shutdown()}catch(f){l.push(f)}if(l.length>0)throw l[0]}}}function Es(n,e,t={worker:()=>Fs(),durable:()=>wr(n,{serverPath:Ze(Us()),semanticWorkerPath:Ze(Br())})}){return Ps(e)==="durable"?ks(t.durable(),t.worker):t.worker()}function Fs(n={}){let e=null,t=null,r=1,i=!1,o=null,s=null,a=f=>{f&&Bn(f,{recursive:!0,force:!0})},c=()=>{if(o)return;let f=e,d=t;e=null,t=null;let m=f?f.terminate():Promise.resolve(0);o=Promise.allSettled([m,Fr(d,{gracefulMs:1e3,forceMs:1e3})]).then(([p,y])=>{let S=(y.status==="fulfilled"?y.value:[{reaped:!1,detail:String(y.reason)}]).filter(g=>!g.reaped);if(p.status==="rejected"||S.length>0){s=new Error(`Rust semantic worker cleanup did not complete; ownership evidence remains at ${d??"unknown"}.`);return}a(d)}).finally(()=>{o=null})},u=()=>{if(e)return e;if(o)throw new Error("The previous Rust semantic session worker is still terminating; retry the request.");if(s)throw s;let f=n.semanticWorkerPath?Ds(n.semanticWorkerPath):Br();if(!Ms(Ze(f)))throw new Error(`Rust semantic session worker was not found at ${Ze(f)}. Run npm run build before using built semantic Rust queries.`);return t=Ar(jn(Nr(),"scip-query-rust-session-")),e=new xs(f,n.shareEnvironment?{env:vs}:void 0),e.unref(),e},l=()=>{let f=t??Ar(jn(Nr(),"scip-query-rust-session-"));return t=f,jn(f,`${r++}.json`)};return{requestSemantic(f,d){if(i)throw new Error("Rust semantic session was already disposed.");let m=u(),p=l(),y=new SharedArrayBuffer(4),b=new Int32Array(y);if(m.postMessage({kind:"semantic",request:f,responsePath:p,sharedBuffer:y}),Atomics.wait(b,0,0,d)==="timed-out")throw c(),new Error(`Rust semantic session worker timed out after ${(d/1e3).toFixed(0)}s`);try{let g=As(L(p,{maxBytes:z,inputKind:"Rust semantic worker response"}));if(!g.ok)throw new Error(g.error);return g.response}finally{Bn(p,{force:!0})}},requestImportDefinitions(f,d){if(i)throw new Error("Rust semantic session was already disposed.");let m=u(),p=l(),y=new SharedArrayBuffer(4),b=new Int32Array(y);if(m.postMessage({kind:"import-definitions",request:f,responsePath:p,sharedBuffer:y}),Atomics.wait(b,0,0,d)==="timed-out")throw c(),new Error(`Rust semantic import-definition session worker timed out after ${(d/1e3).toFixed(0)}s`);try{let g=Ns(L(p,{maxBytes:z,inputKind:"Rust import-definition worker response"}));if(!g.ok)throw new Error(g.error);return g.response}finally{Bn(p,{force:!0})}},shutdown(){if(i)return;if(i=!0,!e){a(t),t=null;return}let f=l(),d=new SharedArrayBuffer(4),m=new Int32Array(d);e.postMessage({kind:"shutdown",responsePath:f,sharedBuffer:d}),Atomics.wait(m,0,0,5e3),c()}}}function As(n){let e=JSON.parse(n);if(!e||typeof e!="object")return{ok:!1,error:"Rust semantic session worker wrote a non-object response."};let t=e;return t.ok===!0&&"response"in t?{ok:!0,response:t.response}:{ok:!1,error:typeof e.error=="string"?e.error:"Rust semantic session worker failed."}}function Ns(n){let e=JSON.parse(n);if(!e||typeof e!="object")return{ok:!1,error:"Rust semantic session worker wrote a non-object response."};let t=e;return t.ok===!0&&"response"in t?{ok:!0,response:t.response}:{ok:!1,error:typeof e.error=="string"?e.error:"Rust semantic session worker failed."}}function _s(n){let e=n instanceof Error?`${n.name} ${n.message}`.toLowerCase():String(n).toLowerCase();return e.includes("readiness")?"readiness":e.includes("timeout")||e.includes("timed out")?"timeout":e.includes("helper")?"helper":"request"}function Ie(n){return new Map(n.map(e=>[e.symbolId,[]]))}function Me(n){return new Map(n.map(e=>[e.symbolId,[]]))}function Or(n){return new Map(n.map(e=>[e.symbolId,null]))}function Hn(n,e){return new Map(n.map(t=>[t.symbolId,e.get(t.symbolId)??[]]))}function Ls(n,e){return new Map(n.map(t=>[t.symbolId,e.get(t.symbolId)??null]))}function Os(n){let e=0;return n.includeReferences!==!1&&(e+=(n.referenceDefinitions??n.definitions).length),n.includeCallees===!0&&(e+=(n.calleeDefinitions??n.definitions).length),n.includeSignatures===!0&&(e+=(n.signatureDefinitions??n.definitions).length),Math.max(1,e)}function zn(n,e){return e&&e>0?Math.max(n,e):n}function Br(){return new URL("./rust-semantic-session-worker.js",import.meta.url)}function Us(){return new URL("./rust-semantic-session-server.js",import.meta.url)}function Qe(n,e){return ne(n)??e}function Xe(n,e){return jr(n)??e}function jr(n){if(!n)return null;let e=Number(n);return Number.isInteger(e)&&e>=0?e:null}function qs(n,e,t,r,i){let o={resolvedBinary:r.resolvedBinary??i.resolvedBinary??n.resolvedBinary,references:j(e,r.references),callees:Hn(t,i.callees)};return r.available&&i.available?{available:!0,...o}:{available:!1,reason:(r.available?void 0:r.reason)??(i.available?void 0:i.reason)??"Rust semantic fallback was unavailable.",...o}}var $n=15e3,Yn=8;function zr(n,e={}){let t=e.status??Ve,r=Hs(n,t),i=zs(n,t),o=Ks(n,t),s=Gs(n,e,t,r,i,o),a=e.referenceResolver??s??r,c=e.calleeResolver??s??i,u=e.signatureResolver??s??o,l=Qs(e,s),f=e.calleeSymbolResolver,d=e.sourceZeroCalleeOracle,m=e.scipOccurrenceCalleeOracle,p=new Map,y=new Map,b=null,S=null,g=()=>(b??=t(n),b),D=()=>{let h=g();return h.dependencyAvailable?S??h:h},P=h=>{if(h.length===0)return new Map;let I=xe(h);try{let R=a.referencesForDefinitions(I),w=g();return S=en(w,R),R.available?new Map(R.references):j(I,R.references)}catch(R){let w=g();return S=ve(w,R),J(I)}},M=h=>{if(h.length===0)return new Map;let I=xe(h),R=I.filter(Wr);if(R.length===0)return G(I);let w=new Map,W=Hr(R,m),_=Zs(R,y,W,d,w);if(_.length===0)return le(I,w,void 0);try{let X=c.calleesForDefinitions(_),H=g();S=en(H,X);let q=le(_,X.callees,f);for(let[fe,on]of q)w.set(fe,on);return le(I,w,void 0)}catch(X){let H=g();return S=ve(H,X),G(I)}},T=(h,I)=>{let R=xe(h),w=xe(I),W=w.filter(Wr),_=new Map,X=Hr(W,m),H=ea(W,X,d,_);if(R.length===0&&H.length===0)return{references:J(R),callees:le(w,_,void 0)};try{let q=s?s.referencesAndCalleesForDefinitions(R,H):Js(a,c,{referenceDefinitions:R,calleeDefinitions:H}),fe=g();S=en(fe,q);let on=q.available?new Map(q.references):j(R,q.references);for(let[sn,an]of q.callees)_.set(sn,an);let rt=le(w,_,f);for(let[sn,an]of rt)y.set(sn,an);return{references:on,callees:rt}}catch(q){let fe=g();return S=ve(fe,q),{references:J(R),callees:G(w)}}},v=h=>{if(h.length===0)return new Map;let I=xe(h);try{let R=u.signaturesForDefinitions(I),w=g();return S=en(w,R),Vr(I,R.signatures)}catch(R){let w=g();return S=ve(w,R),nn(I)}};return{language:"rust",availability:D,dispose:()=>{s?.dispose()},importUsage:h=>{let I=p.get(h);if(I)return I;try{let R=l.importUsage(h);return p.set(h,R),R}catch(R){let w=g();return S=ve(w,R),[]}},referencesFor:h=>P([h]).get(h.symbolId)??[],referencesForDefinitions:P,referencesAndCalleesForDefinitions:T,calleesFor:h=>M([h]).get(h.symbolId)??[],calleesForDefinitions:M,signatureFor:h=>v([h]).get(h.symbolId)??null}}function en(n,e){let t={dependencyAvailable:n.dependencyAvailable,resolvedBinary:e.resolvedBinary??n.resolvedBinary,...n.note?{note:n.note}:{}};return e.available?{available:!0,...t}:{available:!1,reason:e.reason,...t}}function ve(n,e){return{available:!1,dependencyAvailable:n.dependencyAvailable,resolvedBinary:n.resolvedBinary,...n.note?{note:n.note}:{},reason:e instanceof Error?e.message:String(e)}}function js(n){if(n.usePersistentSession!==void 0)return n.usePersistentSession;let e=process.env.SCIP_RUST_SEMANTIC_SESSION;return e!=="0"&&e!=="false"}function Ws(){return{importUsageFacts:()=>({usage:[],positions:[]})}}function xe(n){return n.map(e=>{let t=e;return{...e,leaf:typeof t.leaf=="string"?t.leaf:V(e.symbol),parentTypeName:t.parentTypeName??null,isFunctionLike:typeof t.isFunctionLike=="boolean"?t.isFunctionLike:It(e.symbol),isTypeLike:t.isTypeLike??!1,kind:t.kind??null,documentation:t.documentation??null,enclosingSymbol:t.enclosingSymbol??null}})}function Wr(n){return n.isFunctionLike}function Kr(n,e){if(!e)return!1;try{return e(n)}catch{return!1}}function Hr(n,e){if(!e||n.length===0)return new Map;try{return e(n)}catch{return new Map}}function Hs(n,e){return{referencesForDefinitions:t=>Vs(n,e,t)}}function zs(n,e){return{calleesForDefinitions:t=>$s(n,e,t)}}function Ks(n,e){return{signaturesForDefinitions:t=>Ys(n,e,t)}}function Vs(n,e,t){let r=e(n);if(!r.available||!r.resolvedBinary)return{available:!1,resolvedBinary:r.resolvedBinary,reason:Qn(r),references:J(t)};let i=Jn();if(!Vn(i))return{available:!1,resolvedBinary:r.resolvedBinary,reason:`Rust semantic worker was not found at ${i}. Run npm run build before using built semantic Rust queries.`,references:J(t)};let o=ue(process.env.SCIP_RUST_SEMANTIC_REQUEST_TIMEOUT_MS,$n),s=tn(process.env.SCIP_RUST_SEMANTIC_REFERENCE_RETRY_TIMEOUT_MS,0),a=ue(process.env.SCIP_RUST_SEMANTIC_CONCURRENCY,Yn),c=tn(process.env.SCIP_RUST_SEMANTIC_DIAGNOSTICS_TIMEOUT_MS,Math.min(o,1e4)),u=De(process.env.SCIP_RUST_SEMANTIC_SETTLE_MS,{definitionCount:t.length,includeReferences:!0}),l={projectRoot:n,rustAnalyzerBinary:r.resolvedBinary,definitions:[...t],requestTimeoutMs:o,...s>0?{referenceRetryTimeoutMs:s}:{},diagnosticsTimeoutMs:c,settleDelayMs:u,concurrency:a},f=Kn(process.execPath,[i],{cwd:n,input:JSON.stringify(l),encoding:"utf8",maxBuffer:50*1024*1024,timeout:Y(t.length,zn(o,l.referenceRetryTimeoutMs),a)}),d=Xn(f.stdout);if(d)return{...Gn(d),resolvedBinary:r.resolvedBinary,references:j(t,new Map(d.references),new Set(d.incompleteReferenceSymbolIds??[]))};let m=f.error instanceof Error?f.error.message:f.stderr.trim()||`Rust semantic worker exited with status ${f.status??"unknown"}.`;return{available:!1,resolvedBinary:r.resolvedBinary,reason:m,references:J(t)}}function $s(n,e,t){let r=e(n);if(!r.available||!r.resolvedBinary)return{available:!1,resolvedBinary:r.resolvedBinary,reason:Qn(r),callees:G(t)};let i=Jn();if(!Vn(i))return{available:!1,resolvedBinary:r.resolvedBinary,reason:`Rust semantic worker was not found at ${i}. Run npm run build before using built semantic Rust queries.`,callees:G(t)};let o=ue(process.env.SCIP_RUST_SEMANTIC_REQUEST_TIMEOUT_MS,$n),s=ue(process.env.SCIP_RUST_SEMANTIC_CONCURRENCY,Yn),a=tn(process.env.SCIP_RUST_SEMANTIC_DIAGNOSTICS_TIMEOUT_MS,Math.min(o,1e4)),c=De(process.env.SCIP_RUST_SEMANTIC_SETTLE_MS,{definitionCount:t.length,includeReferences:!1,includeCallees:!0}),u={projectRoot:n,rustAnalyzerBinary:r.resolvedBinary,definitions:[...t],requestTimeoutMs:o,diagnosticsTimeoutMs:a,settleDelayMs:c,concurrency:s,includeReferences:!1,includeCallees:!0},l=Kn(process.execPath,[i],{cwd:n,input:JSON.stringify(u),encoding:"utf8",maxBuffer:50*1024*1024,timeout:Y(t.length,o,s)}),f=Xn(l.stdout);if(f)return{...Gn(f),resolvedBinary:r.resolvedBinary,callees:le(t,new Map(f.callees??[]),void 0)};let d=l.error instanceof Error?l.error.message:l.stderr.trim()||`Rust semantic worker exited with status ${l.status??"unknown"}.`;return{available:!1,resolvedBinary:r.resolvedBinary,reason:d,callees:G(t)}}function Ys(n,e,t){let r=e(n);if(!r.available||!r.resolvedBinary)return{available:!1,resolvedBinary:r.resolvedBinary,reason:Qn(r),signatures:nn(t)};let i=Jn();if(!Vn(i))return{available:!1,resolvedBinary:r.resolvedBinary,reason:`Rust semantic worker was not found at ${i}. Run npm run build before using built semantic Rust queries.`,signatures:nn(t)};let o=ue(process.env.SCIP_RUST_SEMANTIC_REQUEST_TIMEOUT_MS,$n),s=ue(process.env.SCIP_RUST_SEMANTIC_CONCURRENCY,Yn),a=tn(process.env.SCIP_RUST_SEMANTIC_DIAGNOSTICS_TIMEOUT_MS,Math.min(o,1e4)),c=De(process.env.SCIP_RUST_SEMANTIC_SETTLE_MS,{definitionCount:t.length,includeReferences:!1,includeCallees:!1,includeSignatures:!0}),u={projectRoot:n,rustAnalyzerBinary:r.resolvedBinary,definitions:[...t],requestTimeoutMs:o,diagnosticsTimeoutMs:a,settleDelayMs:c,concurrency:s,includeReferences:!1,includeCallees:!1,includeSignatures:!0},l=Kn(process.execPath,[i],{cwd:n,input:JSON.stringify(u),encoding:"utf8",maxBuffer:50*1024*1024,timeout:Y(t.length,o,s)}),f=Xn(l.stdout);if(f)return{...Gn(f),resolvedBinary:r.resolvedBinary,signatures:Vr(t,new Map(f.signatures??[]))};let d=l.error instanceof Error?l.error.message:l.stderr.trim()||`Rust semantic worker exited with status ${l.status??"unknown"}.`;return{available:!1,resolvedBinary:r.resolvedBinary,reason:d,signatures:nn(t)}}function Js(n,e,t){let r=t.referenceDefinitions.length>0?n.referencesForDefinitions(t.referenceDefinitions):{available:!0,references:J(t.referenceDefinitions)},i=t.calleeDefinitions.length>0?e.calleesForDefinitions(t.calleeDefinitions):{available:!0,callees:G(t.calleeDefinitions)},o={resolvedBinary:r.resolvedBinary??i.resolvedBinary,references:r.references,callees:i.callees};return r.available&&i.available?{available:!0,...o}:{available:!1,reason:(r.available?void 0:r.reason)??(i.available?void 0:i.reason)??"Rust semantic resolution was unavailable.",...o}}function J(n){return new Map(n.map(e=>[e.symbolId,[]]))}function G(n){return new Map(n.map(e=>[e.symbolId,[]]))}function nn(n){return new Map(n.map(e=>[e.symbolId,null]))}function le(n,e,t){let r=0,i=0;return C("rust.semantic.callees.complete-map",()=>{let o=new Map;for(let s of n){let a=e.get(s.symbolId)??[];a.length>0&&(r+=1),i+=a.length,o.set(s.symbolId,a.map(c=>({...c,symbol:t?t(c):c.symbol})))}return o},()=>({definitions:n.length,rows:r,callees:i,resolveSymbols:!!t}))}function Vr(n,e){return new Map(n.map(t=>[t.symbolId,e.get(t.symbolId)??null]))}function Jn(){return Bs(new URL("./rust-semantic-worker.js",import.meta.url))}function Gn(n){return n.available?{available:!0}:{available:!1,reason:n.reason}}function Qn(n){return n.available?"rust-analyzer binary path is unavailable.":n.reason}function Xn(n){try{let e=JSON.parse(n);if(!e||typeof e!="object")return null;let t=e;if(typeof t.available!="boolean"||!Array.isArray(t.references)||!na(t))return null;let r=Xs(t,t.references);return t.available===!0?{available:!0,...r}:{available:!1,reason:String(t.reason),...r}}catch{return null}}function ue(n,e){return ne(n)??e}function tn(n,e){if(!n)return e;let t=Number(n);return Number.isInteger(t)&&t>=0?t:e}function Gs(n,e,t,r,i,o){return e.referenceResolver||e.calleeResolver||e.signatureResolver||!js(e)?null:qr(n,t,{fallbackReferenceResolver:r,fallbackCalleeResolver:i,fallbackSignatureResolver:o})}function Qs(n,e){return n.importUsageResolver??lr(n.sourceImportUsageResolver??Ws(),n.importDefinitionResolver??e)}function Xs(n,e){return{references:e,incompleteReferenceSymbolIds:Array.isArray(n.incompleteReferenceSymbolIds)?n.incompleteReferenceSymbolIds.filter(r=>typeof r=="number"):void 0,callees:Array.isArray(n.callees)?n.callees:void 0,signatures:Array.isArray(n.signatures)?n.signatures:void 0}}function Zs(n,e,t,r,i){let o=[];for(let s of n)e.has(s.symbolId)?i.set(s.symbolId,e.get(s.symbolId)??[]):t.has(s.symbolId)?i.set(s.symbolId,t.get(s.symbolId)??[]):Kr(s,r)?i.set(s.symbolId,[]):o.push(s);return o}function ea(n,e,t,r){let i=[];for(let o of n)e.has(o.symbolId)?r.set(o.symbolId,e.get(o.symbolId)??[]):Kr(o,t)?r.set(o.symbolId,[]):i.push(o);return i}function na(n){return!(n.available===!1&&typeof n.reason!="string"||n.available===!0&&n.reason!==void 0)}import{existsSync as ta}from"fs";import{deserializeSCIP as ra,SymbolRole as ia}from"@c4312/scip";var Zn=new WeakMap;function Yr(n,e){let t=e.filter(oa);if(t.length===0)return new Map;let r=!1,i=0,o=0;return C("rust.scip-occurrence.callees",()=>{let s=ca(n);if(r=!!s,!s)return new Map;let a=new Map;for(let c of t){let u=sa(n,s,c);u!==null&&(a.set(c.symbolId,u),i+=1,o+=u.length)}return a},()=>({definitions:e.length,candidates:t.length,indexAvailable:r,resolvedDefinitions:i,resolvedCallees:o}))}function oa(n){return!(!n.symbol.startsWith("rust-analyzer ")||!n.relativePath.endsWith(".rs")||!n.isFunctionLike||n.leaf==="main"||Se(n.symbol))}function sa(n,e,t){let r=_e(n,t.relativePath);if(!r||r.language!=="rust")return null;let i=r.callables.find(u=>u.startLine!==t.startLine||u.endLine!==t.endLine?!1:u.name===t.leaf||t.leaf.endsWith(u.name)||u.name.endsWith(t.leaf));if(!i)return null;let o=r.callSites.filter(u=>u.line>=i.startLine&&u.line<=i.endLine);if(o.length===0)return null;let s=(e.occurrencesByFile.get(t.relativePath)??[]).filter(u=>u.line>=i.startLine&&u.line<=i.endLine&&u.callee.symbol!==t.symbol);if(s.some(u=>u.traitImplMember)||!aa(o,s))return null;let a=[],c=new Set;for(let u of s){let l=`${u.callee.symbol}\0${u.callee.file}\0${u.callee.line}`;c.has(l)||(c.add(l),a.push(u.callee))}return a}function aa(n,e){let t=$r(n),r=$r(e);if(t.size!==r.size)return!1;for(let[i,o]of t)if(r.get(i)!==o)return!1;return!0}function $r(n){let e=new Map;for(let t of n){let r=t.calleeLeaf??t.leaf;if(!r)continue;let i=`${t.line}\0${r}`;e.set(i,(e.get(i)??0)+1)}return e}function ca(n){if(Zn.has(n))return Zn.get(n)??null;let e=la(n);return Zn.set(n,e),e}function la(n){if(!n.generation.indexPath||!ta(n.generation.indexPath))return null;try{let e=ee(n).filter(o=>o.symbol.startsWith("rust-analyzer ")&&o.relativePath.endsWith(".rs")&&o.isFunctionLike),t=new Map(e.map(o=>[o.symbol,o])),r=ra(ke(n.generation.indexPath,{inputKind:"SCIP occurrence-callee index",maxBytes:Pe})),i=new Map;for(let o of r.documents??[]){let s=o.relativePath;if(!s||!s.endsWith(".rs")||n.isIgnored(s))continue;let a=ua(o,t);i.set(s,a)}return{occurrencesByFile:i}}catch{return null}}function ua(n,e){let t=[];for(let r of n.occurrences??[]){if(!r.symbol||(r.symbolRoles&ia.Definition)!==0)continue;let i=e.get(r.symbol);if(!i)continue;let o=r.range?.[0];Number.isInteger(o)&&t.push({line:o,leaf:i.leaf,traitImplMember:Se(i.symbol),callee:{symbol:i.symbol,file:i.relativePath,line:i.startLine,callsiteLine:o}})}return t}var rn=class{sessions=new WeakMap;getOrCreate(e,t,r){let i=fa(e,t),o=this.sessions.get(e);o||(o=new Map,this.sessions.set(e,o));let s=o.get(i);if(s)return s.hits+=1,s.lastUsedAtMs=Date.now(),s.provider;let a=Date.now(),c=r();return o.set(i,{key:i,language:t,projectRoot:e.config.projectRoot,provider:c,createdAtMs:a,lastUsedAtMs:a,hits:1}),c}sessionsFor(e){return[...this.sessions.get(e)?.values()??[]]}clear(e){let t=this.sessions.get(e);if(t)for(let r of t.values())r.provider.dispose?.();this.sessions.delete(e)}};function fa(n,e){return`${n.config.projectRoot}:${e}-workspace`}var Jr=new rn;lt({name:"semantic-provider",groups:["semantic-provider"],clearAll:n=>Jr.clear(n)});function Q(n,e){let t=N(e)??"typescript";return Jr.getOrCreate(n,t,()=>t==="rust"?zr(n.config.projectRoot,{sourceImportUsageResolver:{importUsageFacts:r=>cr(n,r)},calleeSymbolResolver:ar(n),sourceZeroCalleeOracle:r=>da(n,r),scipOccurrenceCalleeOracle:r=>Yr(n,r)}):ir(n,e))}function N(n){return n?St(n)==="rust"?"rust":ie(n)?"typescript":null:"typescript"}function da(n,e){let t=_e(n,e.relativePath);if(!t||t.language!=="rust")return!1;let r=t.callables.find(i=>i.startLine===e.startLine&&i.endLine===e.endLine&&i.name===e.leaf)??t.callables.find(i=>i.startLine===e.startLine&&i.endLine===e.endLine);return r?!t.callSites.some(i=>i.line>=r.startLine&&i.line<=r.endLine):!1}var pa=/^[A-Za-z_][A-Za-z0-9_]*$/,Gr=/\bDefault::default\b/g,ma=/^\.\.\s*Default::default\b/;function Qr(n,e){let t=new Map,r=new Map;for(let i of e){let o=et(n,i,r);o!==null&&t.set(i.symbolId,o)}return t}function et(n,e,t=new Map){let r=Ia(e.symbol);if(!r)return null;let i=Mt(n,[e.symbolId]);if(i.length===0)return null;let o=new RegExp(`(^|[^A-Za-z0-9_])${ye(r)}::default\\b`,"g"),s=new RegExp(`(^|[^A-Za-z0-9_])${ye(r)}\\s*$`),a=ha(n,e.symbolId),c={owner:r,ownerDefaultCall:o,ownerLiteralBeforeBrace:s,canUseStructUpdateDefault:a},u=[];for(let l of i){let f=Ma(n,l.relative_path,t);if(f===null)return null;let d=ya(l,f,c);if(d===null)return null;for(let m of d)u.push(m)}return $e(u)}function ya(n,e,t){let r=e.split(/\r?\n/),i={braceDepth:0,ownerLiteralDepths:[]},o=[];for(let s=n.chunk_start;s<=n.chunk_end&&s<r.length;s+=1){let a=r[s]??"";for(let l of Sa(n.relative_path,s,a,t))o.push(l);let c=ga(n.relative_path,s,a,t,i);for(let l of c)o.push(l);let u=new Set(c.map(l=>l.column));if(ba(a,u))return null}return o.length===0?null:o}function Sa(n,e,t,{owner:r,ownerDefaultCall:i}){let o=[];i.lastIndex=0;let s;for(;s=i.exec(t);)o.push({file:n,line:e,column:s.index+s[1].length+r.length+2});return o}function ga(n,e,t,r,i){let o=[];for(let s=0;s<t.length;s+=1){let a=ma.exec(t.slice(s));if(a){r.canUseStructUpdateDefault&&i.ownerLiteralDepths.includes(i.braceDepth)&&o.push({file:n,line:e,column:s+a[0].lastIndexOf("default")}),s+=a[0].length-1;continue}Ra(t,s,r.ownerLiteralBeforeBrace,i)}return o}function Ra(n,e,t,r){let i=n[e];if(i==="{"){let o=t.test(n.slice(0,e));r.braceDepth+=1,o&&r.ownerLiteralDepths.push(r.braceDepth);return}if(i==="}")for(r.braceDepth=Math.max(0,r.braceDepth-1);r.ownerLiteralDepths.length>0&&r.ownerLiteralDepths[r.ownerLiteralDepths.length-1]>r.braceDepth;)r.ownerLiteralDepths.pop()}function ba(n,e){Gr.lastIndex=0;let t;for(;t=Gr.exec(n);)if(!e.has(t.index+9))return!0;return!1}function ha(n,e){return n.get("SELECT 1 AS present FROM mentions WHERE symbol_id = ? AND role = 1 LIMIT 1",e)?.present===1}function Ia(n){let e=/impl#\[([^\]]+)\]\[Default\]default\(\)\./.exec(n)?.[1]??null;return!e||!pa.test(e)?null:e}function Ma(n,e,t){if(t.has(e))return t.get(e)??null;let r=n.get("SELECT text FROM documents WHERE relative_path = ?",e),i=typeof r?.text=="string"?r.text:Da(n,e);return t.set(e,i),i}function Da(n,e){try{return at(n.config.projectRoot,e,{inputKind:"indexed Rust source file"})}catch(t){if(!pe(t))throw t;return null}}function Xr(n){let e=new Map;for(let t of n){let r=e.get(t.relativePath)??[];r.push(t),e.set(t.relativePath,r)}return e}var va="typescript-import-usage-v1",xa="typescript-signatures-v2",nt=un("semantic-prefetched-callees",{clearGroups:["whole-project","source-file","semantic-provider"]}),Zr=me({kind:"semantic-import-usage",invalidation:K("semantic-import-usage"),serialize:n=>JSON.stringify(n),deserialize:ai}),ei=me({kind:"semantic-signatures",invalidation:K("semantic-signatures"),serialize:n=>JSON.stringify(n),deserialize:za}),ni=pn({kind:"typescript-import-usage",invalidation:K("typescript-import-usage"),serialize:n=>JSON.stringify(n),deserialize:ai}),ti=pn({kind:"typescript-signatures",invalidation:K("typescript-signatures"),serialize:n=>JSON.stringify(n),deserialize:Ka}),Ca=256;function Bf(n,e={}){let t=e.coldFragmentLimit??Ca,r=kt(n);return r===null||r.missing<=t?{ready:!0}:(e.serviceAvailable??or)(n)?{ready:!0}:{ready:!1,reason:`TypeScript reference fragments are cold for ${r.missing} of ${r.files} files and no watch service is running; start the service with \`scip-query watch --daemon\`, then re-run this command.`}}var Ta=un("typescript-reference-map",{clearGroups:["whole-project"]});function wa(n){return Ta.get(n,()=>{let e=Z(n);if(!e)return null;let t=ee(n).filter(i=>N(i.relativePath)==="typescript"),r=gn(n,t,i=>Q(n,i));return r?{projectFingerprint:e,references:r.references,files:r.files,cacheHits:r.cacheHits,cacheMisses:r.cacheMisses,computedFiles:r.computedFiles}:null})}function Ce(n){let e=new Map,t=new Set;return{capability:(r,i)=>ci(n,r,i),importUsage:r=>ka(n,r),references:r=>ri(n,r),materializeReferences:(r,i)=>ii(n,r,e,t,i),callerMap:r=>Ea(n,r,e,t),calleeMap:r=>qa(n,r),signature:r=>Wa(n,r)}}function Pa(n,e){if(e.size===0)return;let t=nt.get(n,()=>new Map);for(let[r,i]of e)t.set(r,[...i])}function jf(n,e){if(!nt.has(n))return{hits:[],misses:[...e]};let t=nt.get(n,()=>new Map),r=[],i=[];for(let o of e)t.has(o.symbolId)?r.push({definition:o,callees:t.get(o.symbolId)??[]}):i.push(o);return{hits:r,misses:i}}function Wf(n,e){return Ce(n).importUsage(e)}function ka(n,e){if(N(e)==="typescript"){let o="fallback",s=0,a=0,c=0,u=0;return C("typescript.import-usage.materialize",()=>{let l=yn(n,e,va);if(l?.key){s=1;let d=ni.read(n,e,l.key);if(d)return o="hit",a=1,d;c=1;let m=U(n,e);if(!m)return o="unavailable",[];let p=m.importUsage(e);return ni.write(n,e,l.key,p),o="computed",p}u=1;let f=U(n,e);return f?(o="direct-fallback",f.importUsage(e)):(o="unavailable",[])},()=>({state:o,eligible:s,cacheHits:a,cacheMisses:c,fallbacks:u}))}let t=si(n,"semantic-import-usage",e);if(t){let o=Zr.read(n,e,t);if(o)return o}let r=U(n,e);if(!r)return[];let i=r.importUsage(e);return t&&Zr.write(n,e,t,i),i}function Hf(n,e){return Ce(n).references(e)}function ri(n,e){let t=et(n,e);if(t)return t;let r=fr(n,e);if(r)return r;let i=U(n,e.relativePath);return i?i.referencesFor(e):[]}function zf(n,e){return Ce(n).callerMap(e)}function Kf(n,e){let t=new Map,r=[];for(let i of e){if(N(i.relativePath)==="typescript"){r.push(i);continue}tt(n,t,i,ri(n,i))}if(r.length>0){let i=Ja(n,r);for(let o of r)tt(n,t,o,i.get(o.symbolId)??[])}return t}function Ea(n,e,t=new Map,r=new Set){let i=new Map,o=ii(n,e,t,r),s=0;return C("semantic.callers.from-references",()=>{for(let a of e)s+=tt(n,i,a,t.get(a.symbolId)??[])},()=>({definitions:e.length,materialized:o.definitions,inMemoryHits:o.inMemoryHits,incompleteInMemoryHits:o.incompleteInMemoryHits,resultRows:i.size,callerFiles:s})),i}function Fa(n,e){let t=[];for(let r of n)e.materializedReferences.has(r.symbolId)?e.inMemoryHits+=1:e.incompleteReferences.has(r.symbolId)?e.incompleteInMemoryHits+=1:t.push(r);return t}function Aa(n,e,t,r,i){let o=Fa(r,i);if(o.length===0){i.fullyInMemoryFiles+=1;return}let s=_a(n,e,t);if(!s){for(let c of o)N(c.relativePath)||(i.skippedUnsupportedLanguage+=1),i.unkeyed.push(c);return}i.cacheReadFiles+=1;let a=ft(n,t,s);for(let c of o)Na(c,a.get(c.symbol)??null,s,i)}function Na(n,e,t,r){if(e!==null){let i=Ua(e);if(i){r.cacheHits+=1,r.materializedReferences.set(n.symbolId,i);return}r.parseFailures+=1}r.misses.push({definition:n,cacheFingerprint:t})}function ii(n,e,t,r,i={}){let o=Z(n),s=[],a=[],c=[],u={skippedUnsupportedLanguage:0,inMemoryHits:0,cacheHits:0,parseFailures:0,cacheReadFiles:0,fullyInMemoryFiles:0,incompleteInMemoryHits:0,materializedReferences:t,incompleteReferences:r,misses:a,unkeyed:c},l=0,f=0,d=0,m=0,p=0,y=[],b=new Map,S=e.filter(D=>N(D.relativePath)==="typescript"&&!t.has(D.symbolId)&&!r.has(D.symbolId)),g=S.length>0?wa(n):null;if(g){f=S.length,d=g.cacheHits,m=g.cacheMisses,p=g.computedFiles;for(let D of S)t.set(D.symbolId,g.references.get(D.symbolId)??[])}return C("semantic.references.cache-scan",()=>{for(let[D,P]of Xr(e))Aa(n,o,D,P,u)},()=>({definitions:e.length,skippedUnsupportedLanguage:u.skippedUnsupportedLanguage,cacheHits:u.cacheHits,parseFailures:u.parseFailures,misses:a.length,unkeyed:c.length,inMemoryHits:u.inMemoryHits,incompleteInMemoryHits:u.incompleteInMemoryHits,fullyInMemoryFiles:u.fullyInMemoryFiles,cacheReadFiles:u.cacheReadFiles})),(a.length>0||c.length>0)&&(y=[...c,...a.map(D=>D.definition)],b=C("semantic.references.compute-misses",()=>{let D=La(n,y,i);return l=D.size,D},()=>({definitions:y.length,misses:a.length,unkeyed:c.length,rows:l})),Va(n,y,b,t,r,a,s)),s.length>0&&C("semantic.references.cache-write",()=>dt(n,s),()=>({entries:s.length})),b.size>0&&Sn(n,y,b,D=>Q(n,D)),{definitions:e.length,inMemoryHits:u.inMemoryHits,incompleteInMemoryHits:u.incompleteInMemoryHits,cacheHits:u.cacheHits,misses:a.length,unkeyed:c.length,skippedUnsupportedLanguage:u.skippedUnsupportedLanguage,parseFailures:u.parseFailures,computed:l,incomplete:r.size,cacheWrites:s.length,fragmentDefinitions:f,fragmentCacheHits:d,fragmentCacheMisses:m,fragmentComputedFiles:p}}function _a(n,e,t){if(!e)return null;let r=N(t);return r==="typescript"?e:r==="rust"?fn(JSON.stringify({kind:"semantic-references",language:r,engine:On(n.config.projectRoot),projectFingerprint:e})):null}function La(n,e,t={}){let r=A(),i=new Map,o=0,s=0,a=0,c=0,u=0,l=0,f=0,d=0,m=0,p=(M,T)=>{Oa(i,M,T,r,v=>{f+=1,d+=v})},y=(M,T)=>{for(let v of T)M.has(v.symbolId)&&p(v.symbolId,M.get(v.symbolId)??[])},b=(M,T,v)=>{let h=M.get(T);h?h.push(v):M.set(T,[v])},S=(M,T,v)=>{T?.referencesAndCalleesForDefinitions&&(b(M,T,v),m+=1)},g=(M,T,v)=>{let h=T.get(M.symbolId);if(h)return a+=1,c+=h.length,p(M.symbolId,h),!0;let I=v.get(M.symbolId);return I?(u+=1,l+=I.length,p(M.symbolId,I),!0):!1},D=(M,T)=>{let v=new Map,h=t.prefetchCallees?new Map:null,I=[];for(let R of e){let w,W=()=>(w??=U(n,R.relativePath),w);if(h&&S(h,W(),R),g(R,M,T))continue;let _=W();if(!_){r&&(s+=1);continue}r&&(o+=1),Ga(_,R,v,I)}return{bulkGroups:v,prefetchCalleeGroups:h,scalarDefinitions:I}},P=M=>{let T=new Set;if(!M.prefetchCalleeGroups)return T;for(let[v,h]of M.prefetchCalleeGroups){if(!v.referencesAndCalleesForDefinitions)continue;let I=M.bulkGroups.get(v)??[],R=v.referencesAndCalleesForDefinitions(I,h);T.add(v),Pa(n,R.callees),y(R.references,I)}return T};return C("semantic.references.provider-loop",()=>{let M=Qr(n,e),T=ur(n,e),v=D(M,T),h=P(v);for(let[I,R]of v.bulkGroups)h.has(I)||y(I.referencesForDefinitions(R),R);for(let{provider:I,definition:R}of v.scalarDefinitions)p(R.symbolId,I.referencesFor(R));return i},()=>({definitions:e.length,providerHits:o,providerMisses:s,rustDefaultFastPathRows:a,rustDefaultFastPathReferences:c,rustScipOccurrenceFastPathRows:u,rustScipOccurrenceFastPathReferences:l,prefetchCalleeDefinitions:m,definitionsWithReferences:f,referenceCount:d,rows:i.size}))}function Oa(n,e,t,r,i){n.set(e,t),r&&t.length>0&&i(t.length)}function tt(n,e,t,r){let i=0;for(let o of r){if(o.file===t.relativePath||n.isIgnored(o.file))continue;let s=e.get(t.symbolId);s||(s=new Set,e.set(t.symbolId,s));let a=s.size;s.add(o.file),s.size!==a&&(i+=1)}return i}function Ua(n){try{return JSON.parse(n)}catch{return null}}function Vf(n,e){return Ce(n).calleeMap(e)}function qa(n,e){let t=A(),r=new Map,i=0,o=0,s=0,a=0;return C("semantic.callees.provider-loop",()=>{let c=new Map,u=[];for(let l of e){let f=U(n,l.relativePath);if(!f){t&&(o+=1);continue}t&&(i+=1);let d=l;f.calleesForDefinitions?Ya(c,f,d):u.push({provider:f,definition:d})}$a(c,r,t,l=>{s+=1,a+=l});for(let{provider:l,definition:f}of u){let d=l.calleesFor(f);oi(r,f.symbolId,d,t,m=>{s+=1,a+=m})}return r},()=>({definitions:e.length,providerHits:i,providerMisses:o,definitionsWithCallees:s,calleeCount:a,rows:r.size}))}var Ba=256;function ja(n){let e=new Map;for(let i of n){let o=e.get(i.relativePath);o?o.push(i):e.set(i.relativePath,[i])}let t=[],r=[];for(let i of e.values())r.length>0&&r.length+i.length>Ba&&(t.push(r),r=[]),r.push(...i);return r.length>0&&t.push(r),t}function oi(n,e,t,r,i){t.length>0&&(n.set(e,t),r&&i(t.length))}function $f(n,e){return Ce(n).signature(e)}function Wa(n,e){if(N(e.relativePath)==="typescript"){let s="fallback",a=0,c=0,u=0,l=0;return C("typescript.signature.materialize",()=>{let f=yn(n,e.relativePath,xa);if(f?.key){a=1;let m=ti.read(n,e.relativePath,f.key)??{};if(Object.prototype.hasOwnProperty.call(m,e.symbol))return s="hit",c=1,m[e.symbol]??null;u=1;let p=U(n,e.relativePath);if(!p)return s="unavailable",null;let y=p.signatureFor(e);return ti.write(n,e.relativePath,f.key,{...m,[e.symbol]:y}),s="computed",y}l=1;let d=U(n,e.relativePath);return d?(s="direct-fallback",d.signatureFor(e)):(s="unavailable",null)},()=>({state:s,eligible:a,cacheHits:c,cacheMisses:u,fallbacks:l}))}let t=si(n,"semantic-signatures",e.relativePath),r=Ha(e);if(t){let s=ei.read(n,r,t);if(s)return s.signature}let i=U(n,e.relativePath);if(!i)return null;let o=i.signatureFor(e);return t&&ei.write(n,r,t,{signature:o}),o}function si(n,e,t){let r=Z(n);if(!r)return null;let i=N(t);return i!=="rust"?null:fn(JSON.stringify({kind:e,language:i,engine:On(n.config.projectRoot),projectFingerprint:r}))}function Ha(n){return`${n.relativePath}\0${n.symbol}`}function ai(n){try{let e=JSON.parse(n);return Array.isArray(e)?e:null}catch{return null}}function za(n){try{let e=JSON.parse(n);if(!e||typeof e!="object")return null;let t=e.signature;return t!==null&&typeof t!="string"?null:{signature:t}}catch{return null}}function Ka(n){try{let e=JSON.parse(n);if(!e||typeof e!="object"||Array.isArray(e))return null;for(let t of Object.values(e))if(t!==null&&typeof t!="string")return null;return e}catch{return null}}function ci(n,e,t){let r=N(t);if(!r)return{slot:e,language:"typescript",available:!1,reason:"semantic evidence is only available for TypeScript or Rust files"};try{return{slot:e,language:r,...Q(n,t).availability()}}catch(i){return{slot:e,language:r,available:!1,reason:i instanceof Error?i.message:String(i)}}}function U(n,e){if(!N(e))return null;let t=Q(n,e);return t.availability().available?t:null}function Va(n,e,t,r,i,o,s){for(let a of e)t.has(a.symbolId)?(r.set(a.symbolId,t.get(a.symbolId)??[]),i.delete(a.symbolId)):i.add(a.symbolId);for(let{definition:a,cacheFingerprint:c}of o)t.has(a.symbolId)&&ci(n,"semantic-references",a.relativePath).available&&s.push({relativePath:a.relativePath,symbol:a.symbol,projectFingerprint:c,payload:JSON.stringify(t.get(a.symbolId)??[])})}function $a(n,e,t,r){for(let[i,o]of n)for(let s of ja(o)){let a=i.calleesForDefinitions(s);for(let c of s){let u=a.get(c.symbolId)??[];oi(e,c.symbolId,u,t,l=>{r(l)})}}}function Ya(n,e,t){let r=n.get(e);r?r.push(t):n.set(e,[t])}function Ja(n,e){let r=gn(n,e,i=>Q(n,i))?.references;if(!r){let i=U(n,e[0].relativePath);r=i?i.referencesForDefinitions?i.referencesForDefinitions(e,{exact:!0}):new Map(e.map(o=>[o.symbolId,i.referencesFor(o)])):new Map,i&&A()&&Sn(n,e,r,o=>Q(n,o))}return r}function Ga(n,e,t,r){if(n.referencesForDefinitions){let i=t.get(n);i?i.push(e):t.set(n,[e])}else r.push({provider:n,definition:e})}export{Xr as a,On as b,N as c,Bf as d,Ce as e,jf as f,Wf as g,Hf as h,zf as i,Kf as j,La as k,Vf as l,$f as m};
|
|
3
|
+
//# sourceMappingURL=chunk-AGWFSTXC.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{a as h}from"./chunk-FMRN2TRL.js";import{a as d,b as l}from"./chunk-FVULPZDF.js";import{statSync as f}from"fs";import{isAbsolute as s,join as x,relative as m}from"path";function S(t,e){let n=p(t,e,{allowMultiple:!1})[0]?.relativePath;return n||g(t,e)}function y(t,e){return p(t,e,{allowMultiple:!0}).map(n=>n.relativePath)}function b(t,e){let n=p(t,e,{allowMultiple:!0});return n.length===1?n[0].relativePath:null}function w(t,e){let n=l(t,e,{allowMultiple:!0,requirePathMatch:!0});return n.length===1?n[0].relativePath:null}function g(t,e){if(!e)return null;let n=e.replace(/\\/g,"/").replace(/^\.\//,""),r=s(n)?m(t.config.projectRoot,n):n;if(r===".."||r.startsWith("../")||s(r))return null;let o=x(t.config.projectRoot,r);return f(o,{throwIfNoEntry:!1})?.isFile()?r:null}function p(t,e,n){if(n.allowMultiple&&e.trim()){let i=D(t,e);if(i.length)return i}let r=g(t,e);if(r)return l(t,r,n).filter(i=>i.relativePath===r);let o=e.replace(/\\/g,"/").replace(/^\.\//,""),c=s(o)||o.includes("/"),a=l(t,e,{...n,requirePathMatch:c});if(a.length||c)return a;let u=h(t,e);return!u||t.isIgnored(u.relativePath)?[]:[{relativePath:u.relativePath,score:700}]}function D(t,e){let r=(s(e)?m(t.config.projectRoot,e):e).replace(/\\/g,"/").replace(/^\.\//,"").replace(/\/+$/,""),o=r==="."||r===""?"":`${r}/`;return d(t,{includeIgnored:!1}).filter(a=>a.startsWith(o)).map(a=>({relativePath:a,score:1100}))}export{S as a,y as b,b as c,w as d};
|
|
2
|
+
//# sourceMappingURL=chunk-AOSIYPTA.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{a as P,b as y}from"./chunk-5PLMJC7Q.js";import{a as C,c as b,e as r,f}from"./chunk-2KNN7GTQ.js";import{a as g,b as h,c as k}from"./chunk-NOLZOVCU.js";import{$ as v}from"./chunk-FVULPZDF.js";function L(e,t={}){let{minSimilarity:o=.62,minTokens:n=8,limit:c=20,scope:l,scanLimit:u,filePattern:m,focusFiles:d}=t,s=B(e,{scope:l,minTokens:n,scanLimit:u}),p=P(s,i=>i.tokens);return y({profiles:s,limit:c,filePattern:m,focusFiles:d,candidateIndex:p,profile:{name:"vue-component-duplicates"},compare:(i,a)=>V(i,a,o),sort:(i,a)=>a.similarity-i.similarity||i.fileA.localeCompare(a.fileA)||i.fileB.localeCompare(a.fileB)})}function B(e,t){return v(e).vueProfiles({scope:t.scope,minTemplateTokens:t.minTokens,scanLimit:t.scanLimit}).map(o=>({file:o.file,tokens:o.templateTokens,loc:T(o)}))}function T(e){return e.totalLines}function V(e,t,o){let n=g(e.tokens,t.tokens);if(n.size<6||!R(n))return null;let c=k(e.tokens,t.tokens);if(c<o)return null;let l=r(n,"component:"),u=r(n,"prop:"),m=r(n,"event:"),d=r(n,"directive:"),s=r(n,"slot:"),p=r(n,"id:"),i=S({sharedComponents:l,sharedProps:u,sharedEvents:m,sharedDirectives:d,sharedSlots:s,sharedIdentifiers:p});return{fileA:e.file,fileB:t.file,similarity:c,tokenCountA:e.tokens.size,tokenCountB:t.tokens.size,sharedTokens:f(n),sharedComponents:l,sharedProps:u,sharedEvents:m,sharedDirectives:d,sharedSlots:s,sharedIdentifiers:p,evidenceClass:i.evidenceClass,actionTier:i.actionTier,evidenceClassReasons:i.reasons,recommendation:i.recommendation,uniqueToA:f(h(e.tokens,t.tokens)),uniqueToB:f(h(t.tokens,e.tokens)),locA:e.loc,locB:t.loc}}function R(e){let t=0,o=0;for(let n of e)n.startsWith("component:")&&(t+=1),(n.startsWith("prop:")||n.startsWith("event:")||n.startsWith("directive:")||n.startsWith("slot:"))&&(o+=1);return b([{name:"component",count:t},{name:"behavior",count:o}],[{min:{component:1},reason:"shared custom component"},{min:{behavior:3},reason:"shared Vue template structure"}]).pass}function S(e){return C({genericWords:x,primitiveGroups:[{values:e.sharedProps,reasonPrefix:"shared props",bucket:"generic"},{values:e.sharedEvents,reasonPrefix:"shared events",bucket:"generic"},{values:e.sharedDirectives,reasonPrefix:"shared directives",bucket:"generic"},{values:e.sharedSlots,reasonPrefix:"shared slots",bucket:"generic"}],nameGroups:[{names:e.sharedComponents,label:"shared component",fallbackBucket:"generic"},{names:e.sharedIdentifiers,label:"shared identifier",fallbackBucket:"generic"}],recommendation:w})}function w(e){switch(e){case"domain-behavior":case"mixed":return"Review for a shared component or feature-specific Vue primitive around the named domain structure.";case"shared-abstraction":return"Review the existing shared component usage first; extract only if duplicated structure remains outside it.";case"generic-workflow-scaffolding":return"Generic structural overlap \u2014 verify intent before consolidating."}}var x=new Set(["actions","app","button","card","content","container","dialog","field","form","header","input","item","label","layout","list","modal","page","panel","row","section","shell","table","text","toolbar","ui","value","view","wrapper"]);export{L as a};
|
|
2
|
+
//# sourceMappingURL=chunk-AUVEWPIF.js.map
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import{Ab as _,Bb as k,Cb as z,Eb as j,_b as it,ac as C,d as B,zb as $}from"./chunk-JYWEX7RR.js";import{Ba as S,Zf as st,mf as ot,oe as et,pe as nt,qe as rt,re as M,t as x,ye as H,za as b}from"./chunk-OZCJXZK6.js";import{createHash as I,randomBytes as lt}from"crypto";import{writeSync as Gt,chmodSync as Xt,closeSync as T,fstatSync as V,lstatSync as Yt,mkdirSync as mt,openSync as G,readSync as Kt,readdirSync as Ot,renameSync as yt,rmSync as X,statSync as wt}from"fs";import{tmpdir as Zt}from"os";import{dirname as Qt,join as E,resolve as te}from"path";import{StringDecoder as Y}from"string_decoder";import{InvalidArgumentError as at}from"commander";var St="scip-query-output-page",Pt=1,ee="continue",O=256,P=1e5,R=4096,f=32e6,vt=64*1024*1024,ne=256*1024*1024,re=32,bt=32768,Ct=16,oe=z*Ct,A=4096,ut=vt,It=3600*1e3,se="scip-query-json-export",ie=1,Tt=3;function Et(){return E(Zt(),`scip-query-output-pages-${typeof process.getuid=="function"?process.getuid():"user"}`)}var K=/^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/u,xt=/^[A-Za-z0-9_][A-Za-z0-9_-]{11}$/u,ae=/^4\.([A-Za-z0-9_-]{22})\.([0-9a-z]{1,10})$/u,ue=/^([A-Za-z0-9_][A-Za-z0-9_-]{11})(?:\.([0-9a-z]{1,10}))?$/u,_t=1,ce="quota.lock",pe=2e3,he=5,ct=1024*1024,de=new Int32Array(new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT)),q,ge=Object.freeze({maxSnapshotBytes:vt,maxAggregateBytes:ne,maxSnapshotCount:re});var At={writeStdout:t=>{process.stdout.write(t)},writeStderr:t=>{process.stderr.write(t)},stdoutIsRegularFile:()=>{try{return V(1).isFile()}catch{return!1}}};async function fe(t,e,n=At){return it({command:t.command,cwd:t.cwd,argv:t.argv,json:t.json,sessionEnabled:t.sourceSession,reemit:t.reemitSource},async()=>{try{await le(t,e,n)}finally{C(!1)}})}async function le(t,e,n){let o=t.pageSize??$,r=t.snapshotRoot??Et(),s=ke(t.snapshotLimits),i=me(t);switch(Oe(t,o),we(t,n)){case"json-file":await Ce(t,e,n,i);return;case"json":await Ie(t,e,n);return;case"human-file":await Te(t,e,i);return}let a=jt(t.argv),u=Dt(t.invocationPrefix),c=zt(t.command,t.cwd,u,a),p={pageSize:o,snapshotRoot:r,snapshotLimits:s,maxOutputCharacters:i,filteredArgv:a,invocationPrefix:u,invocationHash:c},d=t.cursor===void 0?void 0:en(t.cursor,c),h=d?Se(d,t,p):await Pe(t,e,p);ve(t,n,p,h)}function me(t){let e=t.maxOutputCharacters??f;if(!Number.isSafeInteger(e)||e<=0)throw new Error("Output character safety limit must be a positive integer.");return Math.min(e,f,t.agentOutput?oe:f)}function Oe(t,e){if(Ut(e),t.cursor!==void 0&&t.cursor.length>R)throw new Error(`Output cursor exceeds the ${R}-character limit. Run the command again without --output-cursor.`)}function ye(t){if(!t.json)throw new Error("--json-output requires --json.");if(t.agentOutput||t.pageSize!==void 0||t.cursor!==void 0)throw new Error("--json-output cannot be combined with --agent-output or output pagination.")}function we(t,e){if(t.jsonOutputPath!==void 0)return ye(t),"json-file";if(t.json)return!t.agentOutput&&t.pageSize===void 0&&t.cursor===void 0?"json":void 0;if(t.cursor===void 0&&t.pageSize===void 0&&e.stdoutIsRegularFile?.()===!0)return"human-file"}function Se(t,e,n){let{invocationHash:o,pageSize:r,maxOutputCharacters:s,snapshotRoot:i,invocationPrefix:a,filteredArgv:u}=n;try{return{snapshotId:t.snapshotId,completed:Ee(t,o,r,s,i,e.onSnapshotRead)}}catch(c){let p=c instanceof Error?c.message:String(c);throw new Error(`${p} Restart with: ${qt(a,u,r)}`,{cause:c})}}async function Pe(t,e,n){let{invocationHash:o,invocationPrefix:r,filteredArgv:s,pageSize:i,maxOutputCharacters:a,snapshotRoot:u,snapshotLimits:c}=n,p=new F(o,r,t.command,t.cwd,s,i,a,Rt(t)?k:Qe(t,r),u,c,t.agentOutput?Ct:bt,!t.json,U(a,t.agentOutput===!0)),d=Nt(m=>p.write(m)),h=!1;try{await e(),h=!0}finally{d(),h||p.abort()}let g;try{g=p.complete()}catch(m){throw p.abort(),m}return{snapshotId:g.snapshotId,completed:{content:g.content,offset:0,pageIndex:0,pageCount:g.pageCount,totalCharacters:g.totalCharacters,outputHash:g.outputHash}}}function Rt(t){return!t.json&&t.pageSize===void 0&&t.cursor===void 0}function ve(t,e,n,{snapshotId:o,completed:r}){let{invocationPrefix:s,snapshotRoot:i}=n,a=r.offset+r.content.length,u=r.pageIndex+1>=r.pageCount;if(!u&&Rt(t)){let d=ht(o),h=l(i,d,"output");J(i,d,wt(h).size,"saved",n.snapshotLimits);let g=$t(r.content,1800,1800,!0),m=r.content.slice(0,g).split(`
|
|
3
|
+
`).slice(0,24).join(`
|
|
4
|
+
`).trimEnd();e.writeStdout(`Full result: ${j(h)}
|
|
5
|
+
Preview (${r.totalCharacters} characters saved):
|
|
6
|
+
${m}
|
|
7
|
+
`);return}let c=u?void 0:Ze({invocationPrefix:s,nextPageIndex:r.pageIndex+1,snapshotId:ht(o)});if(be(t,e,n,{snapshotId:o,completed:r}))return;let p=pn(t,r,c,a);t.json?e.writeStdout(`${JSON.stringify(p)}
|
|
8
|
+
`):e.writeStdout(cn(p)),u&&o&&v(o,i)}function be(t,e,n,{snapshotId:o,completed:r}){let s=r.pageIndex+1>=r.pageCount;return r.offset===0&&s&&t.cursor===void 0?(e.writeStdout(r.content),C(!0),o&&v(o,n.snapshotRoot),!0):!1}async function Rn(t,e,n=Et(),o=At){if(t.length>R)throw new Error(`Output cursor exceeds the ${R}-character limit.`);let r=kt(t);if(!r)throw new Error("Invalid output cursor. Run the original command again.");let s=Bt(r.snapshotId,n);await fe({command:s.command,producerVersion:e,invocationPrefix:s.invocationPrefix,argv:[...s.argv,"--output-page-size",String(s.pageSize),"--output-cursor",t],cwd:s.cwd,json:s.argv.some(i=>i==="--json"||i.startsWith("--json=")),sourceSession:!s.argv.some(i=>i==="--no-session"),agentOutput:s.argv.some(i=>i==="--agent-output"),pageSize:s.pageSize,cursor:t,snapshotRoot:n},()=>{throw new Error("Output continuation attempted to rerun the original command.")},o)}async function Ce(t,e,n,o){let r=t.jsonOutputPath;if(r===void 0||r.length===0||Buffer.byteLength(r)>A||r.includes("\0"))throw new Error(`--json-output requires a path from 1 through ${A} UTF-8 bytes.`);let s=te(t.cwd,r);if(Buffer.byteLength(s)>A)throw new Error(`The resolved --json-output path exceeds ${A} UTF-8 bytes.`);let i=new Y("utf8"),a=I("sha256"),u=0,c=0,p=w=>{if(c+=w.length,!Number.isSafeInteger(c)||c>o)throw new Error(U(o,!1))};mt(Qt(s),{recursive:!0});let d=`${s}.tmp-${lt(12).toString("hex")}`,h=G(d,"wx",384),g=!0,m=Nt(w=>{let L=u+w.length;if(!Number.isSafeInteger(L)||L>ut)throw new Error(`JSON export exceeds the ${ut}-byte file safety limit. Narrow the query before retrying.`);if(p(i.write(w)),h===void 0)throw new Error("JSON export writer is closed.");st(h,w,"JSON export"),a.update(w),u=L});try{await e(),p(i.end()),m(),T(h),h=void 0,yt(d,s),g=!1}finally{if(m(),h!==void 0)try{T(h)}catch{}g&&X(d,{force:!0})}let Wt={kind:se,schemaVersion:ie,producer:{name:"scip-query",version:t.producerVersion},command:t.command,path:s,bytes:u,sha256:a.digest("hex")};n.writeStdout(`${JSON.stringify(Wt)}
|
|
9
|
+
`),C(!0)}function U(t,e){let n=`Command output exceeds the ${t}-character safety limit. Narrow the query before retrying.`;return e?`${n} For the complete machine result, use --json --json-output <path> and inspect the file programmatically.`:n}function Un(t){if(!/^\d+$/u.test(t))throw new at(`Output page size must be an integer from ${O} through ${P}.`);let e=Number(t);try{Ut(e)}catch{throw new at(`Output page size must be an integer from ${O} through ${P}.`)}return e}function Ut(t){if(!Number.isSafeInteger(t)||t<O||t>P)throw new Error(`Output page size must be an integer from ${O} through ${P}.`)}async function Ie(t,e,n){let o=new D(_,t.maxOutputCharacters??f),r=process.stdout.write,s=!1,i=`${j(`scip-query: JSON output exceeds the ${_}-byte client-safe budget and may be truncated by the client. Do not use possibly partial client output as evidence. Read every page with: ${qt(Dt(t.invocationPrefix),an(jt(t.argv)),$)}`)}
|
|
10
|
+
`;process.stdout.write=((a,u,c)=>{let p=o.push(a,u);return p!==void 0&&(s||(s=!0,n.writeStderr(i)),r.call(process.stdout,p)),Z(u,c),!0});try{await e();let a=o.finish();a.crossedPageBoundary&&!s&&(s=!0,n.writeStderr(i)),a.bytes.length>0&&r.call(process.stdout,a.bytes),s&&n.writeStderr(i)}finally{process.stdout.write=r}}async function Te(t,e,n){let o=process.stdout.write,r=0;process.stdout.write=((s,i,a)=>{let u=Lt(s,i);if(r+=u.length,r>n)throw new Error(U(n,!1));return o.call(process.stdout,u),Z(i,a),!0});try{await e()}finally{process.stdout.write=o}C(!0)}function Nt(t){let e=process.stdout.write;return process.stdout.write=((n,o,r)=>{let s=Lt(n,o);return t(s),Z(o,r),!0}),()=>{process.stdout.write=e}}function Lt(t,e){return typeof t=="string"?Buffer.from(t,typeof e=="string"?e:"utf8"):Buffer.from(t)}function Z(t,e){let n=typeof t=="function"?t:e;typeof n=="function"&&n()}var D=class{constructor(e,n){this.byteLimit=e;this.maxOutputCharacters=n}byteLimit;maxOutputCharacters;decoder=new Y("utf8");chunks=[];overflowed=!1;totalCharacters=0;totalBytes=0;push(e,n){let o=typeof e=="string"?Buffer.from(e,typeof n=="string"?n:"utf8"):Buffer.from(e);if(this.totalBytes+=o.length,this.addCharacters(this.decoder.write(o)),this.overflowed)return o;if(this.chunks.push(o),this.totalBytes<=this.byteLimit)return;this.overflowed=!0;let r=Buffer.concat(this.chunks);return this.chunks.length=0,r}finish(){this.addCharacters(this.decoder.end());let e=this.totalBytes>this.byteLimit,n=Buffer.concat(this.chunks);return this.chunks.length=0,{bytes:n,crossedPageBoundary:e}}addCharacters(e){if(this.totalCharacters+=e.length,!Number.isSafeInteger(this.totalCharacters)||this.totalCharacters>this.maxOutputCharacters)throw new Error(`Command output exceeds the ${this.maxOutputCharacters}-character safety limit. Narrow the query before retrying.`)}},F=class{constructor(e,n,o,r,s,i,a,u,c,p,d,h,g=U(a,!1)){this.invocationHash=e;this.invocationPrefix=n;this.command=o;this.cwd=r;this.argv=s;this.pageSize=i;this.maxOutputCharacters=a;this.pageContentByteLimit=u;this.snapshotRoot=c;this.limits=p;this.maxPages=d;this.preferLineBoundaries=h;this.overflowMessage=g;Q(c);do this.snapshotId=lt(9).toString("base64url");while(this.snapshotId.startsWith("-"));this.temporaryPath=l(c,this.snapshotId,"tmp")}invocationHash;invocationPrefix;command;cwd;argv;pageSize;maxOutputCharacters;pageContentByteLimit;snapshotRoot;limits;maxPages;preferLineBoundaries;overflowMessage;snapshotId;temporaryPath;decoder=new Y("utf8");hash=I("sha256");pages=[];descriptor=null;pending="";firstPageContent="";totalCharacters=0;pageCharacterOffset=0;byteLength=0;reservedBytes=0;opened=!1;finished=!1;write(e){if(this.finished)throw new Error("Output snapshot writer is closed.");this.appendDecoded(this.decoder.write(e))}complete(){if(this.finished)throw new Error("Output snapshot writer is closed.");if(this.appendDecoded(this.decoder.end()),this.finished=!0,!this.opened){let r=this.pending,s=Buffer.from(r);return this.assertWithinByteLimit(s.length),this.hash.update(s),this.pending="",{content:r,totalCharacters:this.totalCharacters,outputHash:this.hash.digest("hex"),pageCount:1}}if((this.pending.length>0||this.pages.length===0)&&(this.flushPage(this.pending),this.pending=""),this.descriptor===null)throw new Error("Output snapshot writer is not open.");T(this.descriptor),this.descriptor=null;let e=this.hash.digest("hex"),n=l(this.snapshotRoot,this.snapshotId,"output"),o=l(this.snapshotRoot,this.snapshotId,"json");try{yt(this.temporaryPath,n);let r={version:Tt,snapshotId:this.snapshotId,invocationHash:this.invocationHash,invocationPrefix:[...this.invocationPrefix],command:this.command,cwd:this.cwd,argv:[...this.argv],outputHash:e,pageSize:this.pageSize,pages:this.pages,totalCharacters:this.totalCharacters,byteLength:this.byteLength,createdAtMs:Date.now()};return H(o,r),J(this.snapshotRoot,this.snapshotId,this.byteLength,"complete",this.limits),this.reservedBytes=this.byteLength,{content:this.firstPageContent,totalCharacters:this.totalCharacters,outputHash:e,pageCount:this.pages.length,snapshotId:this.snapshotId}}catch(r){throw v(this.snapshotId,this.snapshotRoot),r}}abort(){this.descriptor!==null&&(T(this.descriptor),this.descriptor=null),this.finished=!0,v(this.snapshotId,this.snapshotRoot)}appendDecoded(e){if(e.length===0)return;let n=this.totalCharacters+e.length;if(!Number.isSafeInteger(n)||n>this.maxOutputCharacters)throw new Error(this.overflowMessage);for(this.totalCharacters=n,this.pending+=e,this.assertWithinByteLimit(this.byteLength+Buffer.byteLength(this.pending));this.pending.length>this.pageSize||Buffer.byteLength(this.pending)>this.pageContentByteLimit;){this.open();let o=$t(this.pending,this.pageSize,this.pageContentByteLimit,this.preferLineBoundaries),r=this.pending.slice(0,o);this.pending=this.pending.slice(o),this.flushPage(r)}}open(){if(!this.opened){ze(this.snapshotRoot,this.snapshotId,0,this.limits);try{this.descriptor=G(this.temporaryPath,"wx",384),this.opened=!0}catch(e){throw qe(this.snapshotRoot,this.snapshotId),e}}}flushPage(e){if(this.descriptor===null)throw new Error("Output snapshot writer is not open.");if(this.pages.length>=this.maxPages)throw new Error(`Command output requires more than ${this.maxPages} snapshot pages. Retry with a larger --output-page-size, narrow the query, or use --json --json-output <path>.`);let n=Buffer.from(e),o=this.byteLength+n.length;if(this.assertWithinByteLimit(o),o>this.reservedBytes){let i=Math.min(this.limits.maxSnapshotBytes,Math.ceil(o/ct)*ct);J(this.snapshotRoot,this.snapshotId,i,"active",this.limits),this.reservedBytes=i}let r=0;for(;r<n.length;){let i=Gt(this.descriptor,n,r,n.length-r);if(i<=0)throw new Error("Output snapshot write made no progress.");r+=i}let s={characterOffset:this.pageCharacterOffset,characterLength:e.length,byteOffset:this.byteLength,byteLength:n.length,hash:I("sha256").update(n).digest("hex")};this.pages.length===0&&(this.firstPageContent=e),this.pages.push(s),this.hash.update(n),this.pageCharacterOffset+=e.length,this.byteLength=o}assertWithinByteLimit(e){if(!Number.isSafeInteger(e)||e>this.limits.maxSnapshotBytes)throw new Error(`Command output exceeds the ${this.limits.maxSnapshotBytes}-byte snapshot limit. Narrow the query before retrying.`)}};function Ee(t,e,n,o,r,s){Q(r);let i=Bt(t.snapshotId,r);xe(i,t,e,n);let a=i.pages[t.pageIndex];if(!a)throw new Error("Output cursor points past the current result.");if(i.totalCharacters>o)throw new Error(`Output snapshot exceeds the ${o}-character safety limit.`);if(Date.now()-i.createdAtMs>It)throw v(t.snapshotId,r),new Error("Output snapshot expired before all pages were read.");let u=l(r,t.snapshotId,"output"),c=G(u,"r");try{return{content:_e(c,i,a,s),offset:a.characterOffset,pageIndex:t.pageIndex,pageCount:i.pages.length,totalCharacters:i.totalCharacters,outputHash:i.outputHash}}catch(p){throw v(t.snapshotId,r),p}finally{T(c)}}function xe(t,e,n,o){if(t.invocationHash!==n)throw new Error("This output cursor belongs to a different command, working directory, or argument set. Run again without --output-cursor.");if(t.snapshotId!==e.snapshotId||e.version===3&&(t.invocationHash!==e.invocationHash||t.outputHash!==e.outputHash))throw new Error("Output snapshot identity does not match this cursor.");if(t.pageSize!==o||e.version===3&&e.pageSize!==o)throw new Error(`Output page size changed after this cursor was issued; use ${t.pageSize}.`)}function _e(t,e,n,o){let r=V(t);if(!r.isFile()||r.size!==e.byteLength)throw new Error("Output snapshot size or type changed.");let{bytes:s,bytesRead:i}=Ae(t,n,o),a=V(t);if(a.dev!==r.dev||a.ino!==r.ino||a.size!==r.size||i!==n.byteLength)throw new Error("Output snapshot changed while it was being read.");if(I("sha256").update(s).digest("hex")!==n.hash)throw new Error("Output snapshot page no longer matches its metadata.");let u=s.toString("utf8");if(u.length!==n.characterLength)throw new Error("Output snapshot page character count changed.");return u}function Ae(t,e,n){let o=Buffer.allocUnsafe(e.byteLength),r=0;for(;r<o.length;){let s=Kt(t,o,r,o.length-r,e.byteOffset+r);if(s===0)break;r+=s,n?.(s)}return{bytes:o,bytesRead:r}}function Bt(t,e){if(!y(t))throw new Error("Output snapshot identifier is invalid.");let n;try{n=JSON.parse(x(l(e,t,"json"),"output snapshot metadata"))}catch(o){throw new Error("Output snapshot is unavailable.",{cause:o})}if(!Re(n))throw new Error("Output snapshot metadata is invalid.");return n}function Re(t){if(!t||typeof t!="object")return!1;let e=t;return e.version===Tt&&Ue(e)&&Le(e)&&b(e.createdAtMs)}function pt(t,e){return typeof t=="string"&&t.length>0&&t.length<=e}function Ue(t){return typeof t.snapshotId=="string"&&y(t.snapshotId)&&S(t.invocationHash)&&Ft(t.invocationPrefix)&&pt(t.command,256)&&pt(t.cwd,8192)&&un(t.argv)&&zt(t.command,t.cwd,t.invocationPrefix,t.argv)===t.invocationHash}function Ne(t){return Array.isArray(t)&&t.length>1&&t.length<=bt&&t.every(Be)&&$e(t)}function Le(t){return S(t.outputHash)&&b(t.pageSize)&&t.pageSize>=O&&t.pageSize<=P&&Ne(t.pages)&&b(t.totalCharacters)&&t.pages.reduce((e,n)=>e+n.characterLength,0)===t.totalCharacters&&b(t.byteLength)&&t.pages.reduce((e,n)=>e+n.byteLength,0)===t.byteLength}function Be(t){if(!t||typeof t!="object")return!1;let e=t;return Me(e)&&He(e)&&S(e.hash)}function Me(t){return Number.isSafeInteger(t.characterOffset)&&(t.characterOffset??-1)>=0&&Number.isSafeInteger(t.characterLength)&&(t.characterLength??0)>0}function He(t){return Number.isSafeInteger(t.byteOffset)&&(t.byteOffset??-1)>=0&&Number.isSafeInteger(t.byteLength)&&(t.byteLength??0)>0}function $e(t){let e=0,n=0;for(let o of t){if(o.characterOffset!==e||o.byteOffset!==n)return!1;e+=o.characterLength,n+=o.byteLength}return!0}function Q(t){mt(t,{recursive:!0,mode:448});let e=Yt(t);if(!e.isDirectory()||e.isSymbolicLink())throw new Error(`Output snapshot root is not a private directory: ${t}`);if(typeof process.getuid=="function"&&e.uid!==process.getuid())throw new Error(`Output snapshot root is not owned by the current user: ${t}`);process.platform!=="win32"&&Xt(t,448)}function ke(t){let e={...ge,...t};for(let[n,o]of Object.entries(e))if(!Number.isSafeInteger(o)||o<=0)throw new Error(`Output snapshot ${n} must be a positive integer.`);if(e.maxSnapshotBytes>e.maxAggregateBytes)throw new Error("Output snapshot maxSnapshotBytes cannot exceed maxAggregateBytes.");return e}function ze(t,e,n,o){N(t,()=>{We(t),Mt(t,e,n,"active",o)})}function J(t,e,n,o,r){if(!Number.isSafeInteger(n)||n<0||n>r.maxSnapshotBytes)throw new Error(`Command output exceeds the ${r.maxSnapshotBytes}-byte snapshot limit.`);N(t,()=>{Mt(t,e,n,o,r)})}function je(t,e,n,o,r){for(let s of t.filter(i=>i.state==="saved"&&i.snapshotId!==n).sort((i,a)=>i.updatedAtMs-a.updatedAtMs)){let i=t.filter(a=>a.snapshotId!==n);if(i.length+1<=r.maxSnapshotCount&&i.reduce((a,u)=>a+u.reservedBytes,o)<=r.maxAggregateBytes)break;tt(s.snapshotId,e),t.splice(t.indexOf(s),1)}}function Mt(t,e,n,o,r){if(!Number.isSafeInteger(n)||n<0||n>r.maxSnapshotBytes)throw new Error(`Command output exceeds the ${r.maxSnapshotBytes}-byte snapshot limit.`);let s=Ve(t);je(s,t,e,n,r);let i=s.find(d=>d.snapshotId===e),a=s.reduce((d,h)=>d+h.reservedBytes,0)-(i?.reservedBytes??0)+n,u=s.length+(i?0:1);if(u>r.maxSnapshotCount||a>r.maxAggregateBytes)throw new Error(`Output snapshot capacity is full (${u}/${r.maxSnapshotCount} snapshots, ${a}/${r.maxAggregateBytes} bytes). Redirect output to a file, narrow the query, or finish an explicit pagination sequence before retrying.`);let c=Date.now(),p={version:_t,snapshotId:e,pid:process.pid,...W()?{processIdentity:W()}:{},reservedBytes:n,state:o,createdAtMs:i?.createdAtMs??c,updatedAtMs:c};H(l(t,e,"reserve"),p)}function qe(t,e){N(t,()=>{X(l(t,e,"reserve"),{force:!0})})}function Ve(t){let e=[];for(let n of Ot(t,{withFileTypes:!0})){if(!n.isFile()||!n.name.endsWith(".reserve"))continue;let o=n.name.slice(0,-8);if(y(o))try{let r=JSON.parse(x(E(t,n.name),"output snapshot reservation"));if(!Ht(r)||r.snapshotId!==o)throw new Error("reservation identity is invalid");e.push(r)}catch(r){throw new Error(`Output snapshot reservation ${n.name} is invalid; retry after its owning process or snapshot expires.`,{cause:r})}}return e}function Ht(t){if(!t||typeof t!="object")return!1;let e=t;return De(e)&&Fe(e)&&Je(e)}function De(t){return t.version===_t&&typeof t.snapshotId=="string"&&y(t.snapshotId)}function Fe(t){return Number.isSafeInteger(t.pid)&&(t.pid??0)>0&&(t.processIdentity===void 0||nt(t.processIdentity)!==null&&t.processIdentity.pid===t.pid)}function Je(t){return Number.isSafeInteger(t.reservedBytes)&&(t.reservedBytes??-1)>=0&&(t.state==="active"||t.state==="complete"||t.state==="saved")&&Number.isSafeInteger(t.createdAtMs)&&Number.isSafeInteger(t.updatedAtMs)}function We(t){let e=Date.now();for(let n of Ot(t,{withFileTypes:!0})){if(!n.isFile()||!n.name.endsWith(".reserve"))continue;let o=n.name.slice(0,-8);if(!y(o))continue;let r=Xe(E(t,n.name)),s=Ke(l(t,o,"json"));Ge(r,s,e)||tt(o,t)}}function Ge(t,e,n){let o=Ye(t),r=t?n-t.updatedAtMs>It:!1;return o||e&&!r?!0:!e&&t!==null&&!r&&t.state==="complete"}function Xe(t){try{let e=JSON.parse(x(t,"output snapshot reservation"));return Ht(e)?e:null}catch{return null}}function Ye(t){return t?.state==="active"&&et(t.pid)&&(t.processIdentity===void 0||(()=>{let e=M(t.pid);return e!==null&&rt(t.processIdentity,e)})())}function Ke(t){try{return wt(t),!0}catch{return!1}}function N(t,e){Q(t);let n=E(t,ce),o=Date.now()+pe;for(;;){let r=ot(n,{kind:"output-snapshot-quota",processIdentity:W()});if(r.kind==="acquired")try{return e()}finally{r.lock.release()}if(Date.now()>=o)throw new Error("Output snapshot quota is busy. Retry the command.");Atomics.wait(de,0,0,he)}}function W(){return q===void 0&&(q=M(process.pid)),q}function v(t,e){y(t)&&N(e,()=>tt(t,e))}function tt(t,e){for(let n of["json","output","tmp","reserve"])X(l(e,t,n),{force:!0})}function l(t,e,n){if(!y(e))throw new Error("Output snapshot identifier is invalid.");return E(t,`${e}.${n}`)}function ht(t){if(!t)throw new Error("Incomplete output did not create a resumable snapshot.");return t}function dt(t){return t>=55296&&t<=56319}function $t(t,e,n,o){let r=Math.min(t.length,e);if(dt(t.charCodeAt(r-1))&&(r-=1),Buffer.byteLength(t.slice(0,r))>n){let s=0,i=r;for(;s<i;){let a=Math.ceil((s+i)/2);Buffer.byteLength(t.slice(0,a))<=n?s=a:i=a-1}r=s,dt(t.charCodeAt(r-1))&&(r-=1)}if(r<=0)throw new Error("Output page byte limit cannot contain one UTF-8 character.");if(o){let s=t.lastIndexOf(`
|
|
11
|
+
`,r-1);if(s>=0)return s+1}return r}function Ze(t){let e=tn({pageIndex:t.nextPageIndex,snapshotId:t.snapshotId});return{cursor:e,command:Vt(t.invocationPrefix,e)}}function Qe(t,e){let n="c".repeat(64),o={cursor:n,command:Vt(e,n)};if(!t.json){let i="9".repeat(String(f).length),a=`[scip-query output page: characters ${i}-${i} of ${i}]
|
|
12
|
+
|
|
13
|
+
[Incomplete: ${i} characters remain.]
|
|
14
|
+
Continue exactly:
|
|
15
|
+
${o.command}
|
|
16
|
+
`;return gt(k,Buffer.byteLength(a),1)}let r={kind:St,schemaVersion:Pt,producer:{name:"scip-query",version:t.producerVersion},command:t.command,contentType:"application/json",agentInstruction:"INCOMPLETE EVIDENCE: do not draw conclusions or report completion from this partial page. Run page.continuation.command exactly, then repeat until page.complete is true.",page:{offset:f,returnedCharacters:f,totalCharacters:f,omittedCharacters:f,remainingCharacters:f,complete:!1,outputHash:"f".repeat(64),continuation:o},content:""},s=Buffer.byteLength(`${JSON.stringify(r)}
|
|
17
|
+
`);return gt(z,s,2)}function gt(t,e,n){let o=Math.floor((_-e)/n);if(o<O)throw new Error(`The command invocation leaves fewer than ${O} bytes for client-safe output content. Use a shorter executable path.`);return Math.min(t,o)}function tn(t){return xt.test(t.snapshotId)?t.pageIndex===1?t.snapshotId:`${t.snapshotId}.${t.pageIndex.toString(36)}`:`4.${on(t.snapshotId)}.${t.pageIndex.toString(36)}`}function en(t,e){let n=kt(t);if(!n)throw new Error("Invalid output cursor. Run the command again without --output-cursor.");if(n.version===3&&n.invocationHash!==e)throw new Error("This output cursor belongs to a different command, working directory, or argument set. Run again without --output-cursor.");return n}function kt(t){let e=ue.exec(t);if(e){let o=e[2]??"1",r=Number.parseInt(o,36);return ft(r,o)?{version:4,pageIndex:r,snapshotId:e[1]}:null}let n=ae.exec(t);if(n){let o=sn(n[1]),r=Number.parseInt(n[2],36);return o&&ft(r,n[2])?{version:4,pageIndex:r,snapshotId:o}:null}try{let o=JSON.parse(Buffer.from(t,"base64url").toString("utf8"));return nn(o)?o:null}catch{return null}}function nn(t){if(!t||typeof t!="object")return!1;let e=t;return e.version===3&&S(e.invocationHash)&&rn(e)&&S(e.outputHash)&&typeof e.snapshotId=="string"&&y(e.snapshotId)}function rn(t){return Number.isSafeInteger(t.pageIndex)&&(t.pageIndex??-1)>=1&&Number.isSafeInteger(t.pageSize)&&(t.pageSize??0)>=O&&(t.pageSize??0)<=P}function on(t){if(!K.test(t))throw new Error("Output snapshot identifier is invalid.");return Buffer.from(t.replaceAll("-",""),"hex").toString("base64url")}function sn(t){let e=Buffer.from(t,"base64url");if(e.length!==16)return null;let n=e.toString("hex"),o=`${n.slice(0,8)}-${n.slice(8,12)}-${n.slice(12,16)}-${n.slice(16,20)}-${n.slice(20)}`;return K.test(o)?o:null}function y(t){return typeof t=="string"&&(xt.test(t)||K.test(t))}function zt(t,e,n,o){return I("sha256").update(JSON.stringify({command:t,cwd:e,invocationPrefix:n,argv:o})).digest("hex")}function jt(t){let e=[];for(let n=0;n<t.length;n+=1){let o=t[n];if(o==="--output-page-size"||o==="--output-cursor"){n+=1;continue}o.startsWith("--output-page-size=")||o.startsWith("--output-cursor=")||e.push(o)}return e}function an(t){return t.filter(e=>e!=="--raw-json"&&e!=="--raw-json=true")}function qt(t,e,n){return Jt([...t,...e,"--output-page-size",String(n)])}function Vt(t,e){return Jt([...t,ee,e])}function Dt(t){let e=t===void 0?["scip-query"]:[...t];if(!Ft(e))throw new Error("Output pagination invocation prefix must contain one to sixteen non-empty shell arguments.");return e}function Ft(t){return Array.isArray(t)&&t.length>0&&t.length<=16&&t.every(e=>typeof e=="string"&&e.length>0&&e.length<=2048&&!e.includes("\0")&&!e.includes("\r")&&!e.includes(`
|
|
18
|
+
`))}function un(t){return Array.isArray(t)&&t.length>0&&t.length<=256&&t.every(e=>typeof e=="string"&&e.length<=8192&&!e.includes("\0")&&!e.includes("\r")&&!e.includes(`
|
|
19
|
+
`))}function Jt(t){return t.map(e=>B(e,{omitSafeQuotes:!0})).join(" ")}function cn(t){let e=t.page.continuation,n=Math.max(t.page.offset,t.page.offset+t.page.returnedCharacters-1),o=`[scip-query output page: characters ${t.page.offset}-${n} of ${t.page.totalCharacters}]
|
|
20
|
+
`,r=e?`
|
|
21
|
+
[Incomplete: ${t.page.remainingCharacters} characters remain.]
|
|
22
|
+
Continue exactly:
|
|
23
|
+
${e.command}
|
|
24
|
+
`:"";return`${o}${t.content}${r}`}function pn(t,e,n,o){let r={offset:e.offset,returnedCharacters:e.content.length,totalCharacters:e.totalCharacters,omittedCharacters:e.totalCharacters-e.content.length,remainingCharacters:e.totalCharacters-o};return{kind:St,schemaVersion:Pt,producer:{name:"scip-query",version:t.producerVersion},command:t.command,contentType:t.json?"application/json":"text/plain",agentInstruction:n?"INCOMPLETE EVIDENCE: do not draw conclusions or report completion from this partial page. Run page.continuation.command exactly, then repeat until page.complete is true.":"OUTPUT COMPLETE: all rendered characters have been retrieved. Evaluate the command result's own coverage separately.",page:n?{...r,complete:!1,outputHash:e.outputHash,continuation:n}:{...r,complete:!0,outputHash:e.outputHash},content:e.content}}function ft(t,e){return Number.isSafeInteger(t)&&t>=1&&t.toString(36)===e}export{ee as a,fe as b,Rn as c,Un as d};
|
|
25
|
+
//# sourceMappingURL=chunk-B56T42J3.js.map
|