scip-query 0.15.0 → 0.16.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (321) hide show
  1. package/CHANGELOG.md +41 -1
  2. package/README.md +148 -66
  3. package/dist/augment-vue-worker.js +1 -1
  4. package/dist/chunk-2EU6WVR3.js +3 -0
  5. package/dist/chunk-2HFXPIBT.js +2 -0
  6. package/dist/chunk-2LGPMYS2.js +35 -0
  7. package/dist/chunk-2Y7YX54K.js +16 -0
  8. package/dist/chunk-363TZ64I.js +2 -0
  9. package/dist/chunk-3I34FZ6R.js +2 -0
  10. package/dist/chunk-3LAKH6BV.js +2 -0
  11. package/dist/chunk-3M2UCPFS.js +3 -0
  12. package/dist/chunk-3OPIMH42.js +2 -0
  13. package/dist/{chunk-QZOAOLLZ.js → chunk-3YAZH3JU.js} +2 -2
  14. package/dist/chunk-5P26M63Y.js +2 -0
  15. package/dist/{chunk-72FR7KEZ.js → chunk-5TVNLPUM.js} +14 -12
  16. package/dist/chunk-5UKDCXVC.js +5 -0
  17. package/dist/{chunk-R7U2I55B.js → chunk-5XDNFOAH.js} +2 -2
  18. package/dist/chunk-62Y3PC27.js +4 -0
  19. package/dist/chunk-6DNE65QS.js +40 -0
  20. package/dist/{chunk-N2OTJWC2.js → chunk-6EVORGCB.js} +2 -2
  21. package/dist/chunk-6GZ7LM7S.js +2 -0
  22. package/dist/chunk-753JWTUH.js +3 -0
  23. package/dist/chunk-7II7NFRV.js +4 -0
  24. package/dist/{chunk-M7EEHYSU.js → chunk-7RAS466A.js} +2 -2
  25. package/dist/chunk-A46JTKTM.js +5 -0
  26. package/dist/{chunk-2XRXEIRK.js → chunk-AAMZRDJT.js} +2 -2
  27. package/dist/chunk-AMPN2VMF.js +3 -0
  28. package/dist/{chunk-6XA4LDHY.js → chunk-B3X6KU75.js} +2 -2
  29. package/dist/chunk-BFWVHD2P.js +16 -0
  30. package/dist/chunk-BVHP2B4D.js +61 -0
  31. package/dist/{chunk-BUNDZ6K2.js → chunk-BVUA3GZC.js} +2 -2
  32. package/dist/{chunk-EDSD3VJK.js → chunk-CKIAEVGM.js} +2 -2
  33. package/dist/chunk-CM4EZLW4.js +2 -0
  34. package/dist/chunk-CS3FXTUC.js +2 -0
  35. package/dist/chunk-CVBS2FD4.js +2 -0
  36. package/dist/chunk-D5OXYOJP.js +7 -0
  37. package/dist/chunk-DA34GNNO.js +29 -0
  38. package/dist/chunk-DKK2H4D7.js +7 -0
  39. package/dist/chunk-EBSSCVR4.js +5 -0
  40. package/dist/{chunk-OXTM2RX3.js → chunk-EVCSXWER.js} +2 -2
  41. package/dist/chunk-FFIYGYQR.js +67 -0
  42. package/dist/chunk-G4KQ7S74.js +20 -0
  43. package/dist/{chunk-44P4SJFN.js → chunk-GWWYLYD3.js} +2 -2
  44. package/dist/chunk-HGUNWXJX.js +2 -0
  45. package/dist/chunk-HLRWOFXC.js +9 -0
  46. package/dist/{chunk-YQKECTPV.js → chunk-IRIM3SUR.js} +2 -2
  47. package/dist/chunk-JHK2DMUQ.js +4 -0
  48. package/dist/chunk-JQ2PCFZW.js +3 -0
  49. package/dist/chunk-JRFCWCOD.js +16 -0
  50. package/dist/chunk-JXAJDINF.js +2 -0
  51. package/dist/chunk-K32ZOW3P.js +2 -0
  52. package/dist/{chunk-3H5OSDF7.js → chunk-KI4WPR7Q.js} +2 -2
  53. package/dist/{chunk-43GKP6LI.js → chunk-KP2DJY7D.js} +2 -2
  54. package/dist/{chunk-YTVKPJXW.js → chunk-L27UIF3E.js} +2 -2
  55. package/dist/chunk-LT6AHYVY.js +18 -0
  56. package/dist/chunk-MCNWCJYL.js +11 -0
  57. package/dist/{chunk-K6UI6EBZ.js → chunk-MZB3DTHW.js} +2 -2
  58. package/dist/chunk-NLRWGGPY.js +8 -0
  59. package/dist/chunk-NLVKD45E.js +13 -0
  60. package/dist/chunk-OO6S4ECV.js +112 -0
  61. package/dist/{chunk-QYOPMTZ6.js → chunk-OYGKBDAD.js} +2 -2
  62. package/dist/chunk-P5QZILZ4.js +2 -0
  63. package/dist/chunk-P5XHIJHI.js +2 -0
  64. package/dist/chunk-PCCMMI2M.js +3 -0
  65. package/dist/{chunk-2TPCIPYA.js → chunk-Q65QYKU7.js} +2 -2
  66. package/dist/{chunk-K7SPOJHZ.js → chunk-QB7NRST4.js} +2 -2
  67. package/dist/{chunk-7JZRFDCU.js → chunk-QSNG3NHQ.js} +2 -2
  68. package/dist/chunk-QVZSWLLZ.js +2 -0
  69. package/dist/chunk-RLB7FZKR.js +10 -0
  70. package/dist/{chunk-KYB7FPXT.js → chunk-RPMT6MTX.js} +2 -2
  71. package/dist/chunk-RQWNF2RM.js +2 -0
  72. package/dist/chunk-RYFIRFYJ.js +4 -0
  73. package/dist/{chunk-QARYU7R3.js → chunk-S2FZILCF.js} +2 -2
  74. package/dist/{chunk-HV27H2V2.js → chunk-S3IXCXW2.js} +2 -2
  75. package/dist/{chunk-TYCZ7S4I.js → chunk-S5MTSES5.js} +2 -2
  76. package/dist/chunk-S5RZQA6V.js +2 -0
  77. package/dist/{chunk-PEHDARNC.js → chunk-SEEJPIWG.js} +2 -2
  78. package/dist/chunk-SOCS3467.js +2 -0
  79. package/dist/chunk-U6BJVXWQ.js +2 -0
  80. package/dist/chunk-UO4IADXJ.js +38 -0
  81. package/dist/{chunk-ZEO4CXQR.js → chunk-VLSI5MYU.js} +2 -2
  82. package/dist/chunk-VSQRU3AP.js +2 -0
  83. package/dist/chunk-VYQY75NA.js +2 -0
  84. package/dist/{chunk-NOKUZU56.js → chunk-VZCR3VQY.js} +2 -2
  85. package/dist/chunk-W3ZVRLCH.js +2 -0
  86. package/dist/chunk-WA64GKWB.js +20 -0
  87. package/dist/chunk-WFRZGMWJ.js +71 -0
  88. package/dist/chunk-WN6XEYVX.js +2 -0
  89. package/dist/chunk-XAEU4ROB.js +101 -0
  90. package/dist/chunk-XBPAJASV.js +2 -0
  91. package/dist/{chunk-GY3HAWUA.js → chunk-XC6PUFNN.js} +2 -2
  92. package/dist/chunk-Y42DMR6F.js +6 -0
  93. package/dist/chunk-YCVYOV4A.js +7 -0
  94. package/dist/{chunk-WPZPB42I.js → chunk-YD37KSEK.js} +2 -2
  95. package/dist/{chunk-V5W7H7V4.js → chunk-YFEJIYWH.js} +2 -2
  96. package/dist/chunk-YSUD2S7T.js +3 -0
  97. package/dist/{chunk-KJCDEDQW.js → chunk-ZEKBAMCN.js} +2 -2
  98. package/dist/chunk-ZHGUZKJL.js +2 -0
  99. package/dist/cli.js +586 -312
  100. package/dist/{config-types-aCgyLrvE.d.ts → config-types-SVkUIufk.d.ts} +8 -2
  101. package/dist/{db-DwCdT3rv.d.ts → db-CS0TuVH6.d.ts} +1 -1
  102. package/dist/{git-history-Dao3_Pu9.d.ts → git-history-ChNHbfZQ.d.ts} +2 -1
  103. package/dist/{health-nJUidasZ.d.ts → health-Btal3mQi.d.ts} +4 -4
  104. package/dist/index.d.ts +7 -5
  105. package/dist/index.js +1 -19
  106. package/dist/queries/affected.d.ts +2 -2
  107. package/dist/queries/affected.js +1 -1
  108. package/dist/queries/bottlenecks.d.ts +8 -2
  109. package/dist/queries/bottlenecks.js +1 -1
  110. package/dist/queries/by-kind.d.ts +2 -2
  111. package/dist/queries/by-kind.js +1 -1
  112. package/dist/queries/call-graph.d.ts +2 -2
  113. package/dist/queries/call-graph.js +1 -1
  114. package/dist/queries/change-surface.d.ts +2 -2
  115. package/dist/queries/change-surface.js +1 -1
  116. package/dist/queries/cleanup-plan.d.ts +2 -2
  117. package/dist/queries/cleanup-plan.js +1 -1
  118. package/dist/queries/co-change.d.ts +4 -3
  119. package/dist/queries/co-change.js +1 -1
  120. package/dist/queries/code.d.ts +2 -2
  121. package/dist/queries/code.js +1 -1
  122. package/dist/queries/complexity-hotspots.d.ts +3 -3
  123. package/dist/queries/complexity-hotspots.js +1 -1
  124. package/dist/queries/complexity.d.ts +5 -4
  125. package/dist/queries/complexity.js +1 -1
  126. package/dist/queries/convergence.d.ts +2 -2
  127. package/dist/queries/convergence.js +1 -1
  128. package/dist/queries/coupling.d.ts +2 -2
  129. package/dist/queries/coupling.js +1 -1
  130. package/dist/queries/cycles.d.ts +2 -2
  131. package/dist/queries/cycles.js +1 -1
  132. package/dist/queries/dataflow.d.ts +2 -2
  133. package/dist/queries/dataflow.js +1 -1
  134. package/dist/queries/dead.d.ts +12 -3
  135. package/dist/queries/dead.js +1 -1
  136. package/dist/queries/decorative-checkers.d.ts +2 -2
  137. package/dist/queries/decorative-checkers.js +1 -1
  138. package/dist/queries/deep-chains.d.ts +8 -3
  139. package/dist/queries/deep-chains.js +1 -1
  140. package/dist/queries/deps.d.ts +2 -2
  141. package/dist/queries/deps.js +1 -1
  142. package/dist/queries/diff-gate.d.ts +5 -4
  143. package/dist/queries/diff-gate.js +1 -1
  144. package/dist/queries/diff-impact.d.ts +3 -3
  145. package/dist/queries/diff-impact.js +1 -1
  146. package/dist/queries/doc-drift.d.ts +4 -2
  147. package/dist/queries/doc-drift.js +1 -1
  148. package/dist/queries/drift.d.ts +2 -2
  149. package/dist/queries/drift.js +1 -1
  150. package/dist/queries/duplicate-bodies.d.ts +3 -3
  151. package/dist/queries/duplicate-bodies.js +1 -1
  152. package/dist/queries/extract-candidates.d.ts +2 -2
  153. package/dist/queries/extract-candidates.js +1 -1
  154. package/dist/queries/fan.d.ts +11 -5
  155. package/dist/queries/fan.js +1 -1
  156. package/dist/queries/files.d.ts +2 -2
  157. package/dist/queries/health.d.ts +3 -3
  158. package/dist/queries/health.js +1 -1
  159. package/dist/queries/hierarchy.d.ts +2 -2
  160. package/dist/queries/hierarchy.js +1 -1
  161. package/dist/queries/hotspots.d.ts +2 -2
  162. package/dist/queries/hotspots.js +1 -1
  163. package/dist/queries/imports.d.ts +2 -2
  164. package/dist/queries/imports.js +1 -1
  165. package/dist/queries/incomplete-migration.d.ts +3 -3
  166. package/dist/queries/incomplete-migration.js +1 -1
  167. package/dist/queries/index.d.ts +5 -5
  168. package/dist/queries/index.js +1 -1
  169. package/dist/queries/isolated.d.ts +2 -2
  170. package/dist/queries/isolated.js +1 -1
  171. package/dist/queries/locality-candidates.d.ts +2 -2
  172. package/dist/queries/locality-candidates.js +1 -1
  173. package/dist/queries/members.d.ts +2 -2
  174. package/dist/queries/members.js +1 -1
  175. package/dist/queries/methods.d.ts +2 -2
  176. package/dist/queries/methods.js +1 -1
  177. package/dist/queries/not-implemented.d.ts +2 -2
  178. package/dist/queries/not-implemented.js +1 -1
  179. package/dist/queries/outline.d.ts +2 -2
  180. package/dist/queries/outline.js +1 -1
  181. package/dist/queries/passthrough-candidates.d.ts +3 -3
  182. package/dist/queries/passthrough-candidates.js +1 -1
  183. package/dist/queries/plan-context.d.ts +4 -4
  184. package/dist/queries/plan-context.js +1 -1
  185. package/dist/queries/react-component-duplicates.d.ts +4 -2
  186. package/dist/queries/react-component-duplicates.js +1 -1
  187. package/dist/queries/react-hook-candidates.d.ts +4 -2
  188. package/dist/queries/react-hook-candidates.js +1 -1
  189. package/dist/queries/react-large-component-pressure.d.ts +2 -2
  190. package/dist/queries/react-large-component-pressure.js +1 -1
  191. package/dist/queries/recent-duplicates.d.ts +4 -2
  192. package/dist/queries/recent-duplicates.js +1 -1
  193. package/dist/queries/redundant-reexports.d.ts +2 -2
  194. package/dist/queries/redundant-reexports.js +1 -1
  195. package/dist/queries/refs.d.ts +2 -2
  196. package/dist/queries/refs.js +1 -1
  197. package/dist/queries/self-audit.d.ts +2 -2
  198. package/dist/queries/self-audit.js +1 -1
  199. package/dist/queries/similar-chains.d.ts +2 -2
  200. package/dist/queries/similar-chains.js +1 -1
  201. package/dist/queries/similar-files.d.ts +2 -2
  202. package/dist/queries/similar-files.js +1 -1
  203. package/dist/queries/similar-signatures.d.ts +2 -2
  204. package/dist/queries/similar-signatures.js +1 -1
  205. package/dist/queries/similar.d.ts +2 -2
  206. package/dist/queries/similar.js +1 -1
  207. package/dist/queries/slice.d.ts +2 -2
  208. package/dist/queries/slice.js +1 -1
  209. package/dist/queries/stale-abstractions.d.ts +2 -2
  210. package/dist/queries/stale-abstractions.js +1 -1
  211. package/dist/queries/stats.d.ts +2 -2
  212. package/dist/queries/surface.d.ts +2 -2
  213. package/dist/queries/surface.js +1 -1
  214. package/dist/queries/symbols.d.ts +2 -2
  215. package/dist/queries/symbols.js +1 -1
  216. package/dist/queries/system.d.ts +2 -2
  217. package/dist/queries/system.js +1 -1
  218. package/dist/queries/test-quality.d.ts +2 -2
  219. package/dist/queries/test-quality.js +1 -1
  220. package/dist/queries/trace.d.ts +2 -2
  221. package/dist/queries/trace.js +1 -1
  222. package/dist/queries/twin-ab.d.ts +2 -2
  223. package/dist/queries/twin-ab.js +1 -1
  224. package/dist/queries/twin-drift.d.ts +2 -2
  225. package/dist/queries/twin-drift.js +1 -1
  226. package/dist/queries/unused-imports.d.ts +2 -2
  227. package/dist/queries/unused-imports.js +1 -1
  228. package/dist/queries/unused-params.d.ts +2 -2
  229. package/dist/queries/unused-params.js +1 -1
  230. package/dist/queries/vue-component-duplicates.d.ts +4 -2
  231. package/dist/queries/vue-component-duplicates.js +1 -1
  232. package/dist/queries/vue-composable-candidates.d.ts +4 -2
  233. package/dist/queries/vue-composable-candidates.js +1 -1
  234. package/dist/queries/vue-large-view-pressure.d.ts +2 -2
  235. package/dist/queries/vue-large-view-pressure.js +1 -1
  236. package/dist/queries/wrapper-candidates.d.ts +2 -2
  237. package/dist/queries/wrapper-candidates.js +1 -1
  238. package/dist/reindex-worker.js +256 -12
  239. package/dist/reindex.d.ts +29 -3
  240. package/dist/reindex.js +251 -22
  241. package/dist/runtime.d.ts +8 -4
  242. package/dist/runtime.js +2 -2
  243. package/dist/rust-semantic-session-server.js +2 -0
  244. package/dist/rust-semantic-session-worker.js +2 -0
  245. package/dist/rust-semantic-worker.js +2 -0
  246. package/dist/{scip-cli-DeAbuJ2b.d.ts → scip-cli-BKL-26TZ.d.ts} +2 -2
  247. package/dist/{symbol-types-DaoeXKUt.d.ts → symbol-types-BgWU6lhL.d.ts} +2 -0
  248. package/dist/watch-server.js +42 -0
  249. package/docs/AGENT_GUIDE.md +110 -34
  250. package/docs/AI_FAILURE_MODES.md +8 -3
  251. package/docs/COMMAND_REFERENCE.md +10 -6
  252. package/docs/REGEX_POLICY.md +3 -1
  253. package/docs/accuracy-audit-checklist.md +300 -0
  254. package/docs/accuracy-hardening-goal.md +493 -54
  255. package/docs/analyzer-inventory.md +31 -23
  256. package/docs/analyzer-validation-ledger.md +51 -21
  257. package/package.json +2 -1
  258. package/scripts/build-scip-windows.mjs +7 -7
  259. package/skills/_shared/SKILL.md +20 -19
  260. package/skills/scip-calibrate/SKILL.md +4 -2
  261. package/skills/scip-hyper-optimization/SKILL.md +5 -1
  262. package/skills/scip-query/SKILL.md +1 -1
  263. package/skills/scip-setup/SKILL.md +104 -4
  264. package/skills/scip-verify/SKILL.md +20 -14
  265. package/dist/chunk-27HMTUJE.js +0 -3
  266. package/dist/chunk-27XEGMCT.js +0 -7
  267. package/dist/chunk-3AMWF6V5.js +0 -3
  268. package/dist/chunk-4SCMYKD6.js +0 -2
  269. package/dist/chunk-5AAAEZ2Z.js +0 -2
  270. package/dist/chunk-5JRMZMLM.js +0 -2
  271. package/dist/chunk-5VY3RIEI.js +0 -38
  272. package/dist/chunk-6JUAGXR4.js +0 -4
  273. package/dist/chunk-6KDOYKCB.js +0 -40
  274. package/dist/chunk-6KMTPNZL.js +0 -3
  275. package/dist/chunk-7COVQPQQ.js +0 -9
  276. package/dist/chunk-7S5E7KWT.js +0 -2
  277. package/dist/chunk-7TVFPOD7.js +0 -102
  278. package/dist/chunk-A6KSEIRN.js +0 -61
  279. package/dist/chunk-AAMURYOK.js +0 -4
  280. package/dist/chunk-BP7S6V3M.js +0 -20
  281. package/dist/chunk-BRBF3E5X.js +0 -35
  282. package/dist/chunk-BZXE3HO4.js +0 -6
  283. package/dist/chunk-CXQQOXSI.js +0 -10
  284. package/dist/chunk-EVZSAR3S.js +0 -2
  285. package/dist/chunk-GMOEX7EV.js +0 -2
  286. package/dist/chunk-GNG622H3.js +0 -3
  287. package/dist/chunk-GUDKRIGW.js +0 -7
  288. package/dist/chunk-GULVO6NF.js +0 -43
  289. package/dist/chunk-HZZQKNVE.js +0 -2
  290. package/dist/chunk-I4R3SNMR.js +0 -2
  291. package/dist/chunk-IMQFJ53K.js +0 -2
  292. package/dist/chunk-ISLWJ4PY.js +0 -10
  293. package/dist/chunk-IUSSGHJO.js +0 -2
  294. package/dist/chunk-J5WVNZ6O.js +0 -2
  295. package/dist/chunk-JJUX2OAP.js +0 -2
  296. package/dist/chunk-JZBGTSAB.js +0 -13
  297. package/dist/chunk-K5N5RNGM.js +0 -2
  298. package/dist/chunk-KSJ544IV.js +0 -5
  299. package/dist/chunk-LY7NMOBW.js +0 -2
  300. package/dist/chunk-N23FT4EZ.js +0 -2
  301. package/dist/chunk-NCVFKOLB.js +0 -2
  302. package/dist/chunk-PESEPWZO.js +0 -2
  303. package/dist/chunk-PMY4UFGV.js +0 -2
  304. package/dist/chunk-Q7PWDXL5.js +0 -5
  305. package/dist/chunk-QVGFVRKD.js +0 -2
  306. package/dist/chunk-R5336VHZ.js +0 -2
  307. package/dist/chunk-RLB6SG25.js +0 -2
  308. package/dist/chunk-SFDVBARK.js +0 -2
  309. package/dist/chunk-TG7QSYCJ.js +0 -2
  310. package/dist/chunk-UHPWZCYQ.js +0 -3
  311. package/dist/chunk-URSSPS5H.js +0 -2
  312. package/dist/chunk-WIBFXSYB.js +0 -6
  313. package/dist/chunk-WMO2VZZK.js +0 -3
  314. package/dist/chunk-WS3Z6W3M.js +0 -65
  315. package/dist/chunk-X3DTIEMU.js +0 -18
  316. package/dist/chunk-X5C43YVI.js +0 -2
  317. package/dist/chunk-X7CHWTZ2.js +0 -72
  318. package/dist/chunk-XDESMVOL.js +0 -4
  319. package/dist/chunk-XZBLZHXL.js +0 -16
  320. package/dist/chunk-YBGC7HTY.js +0 -3
  321. package/dist/chunk-ZMGBWSFZ.js +0 -2
@@ -0,0 +1,101 @@
1
+ import{a as ar,b as x,c as Le,d as cr,e as ue,f as lr,g as pr}from"./chunk-FFIYGYQR.js";import{a as St,b as be}from"./chunk-3M2UCPFS.js";import{a as gt,b as ht,e as yt}from"./chunk-JHK2DMUQ.js";import{spawn as Jn}from"child_process";import{closeSync as Yn,existsSync as Qn,mkdirSync as Zn,openSync as ei,readFileSync as vt,rmSync as ur,writeFileSync as ti}from"fs";import{dirname as ri,join as xt,resolve as fr}from"path";import{fileURLToPath as Lc}from"url";var Wc=3,$c=5e3,ni="watch.lock",ii="watch-state.json",si="watch-activity.json";function Vc(e){return{lockPath:xt(e,ni),statePath:xt(e,ii),activityPath:xt(e,si)}}function Uc(e){try{return oi(JSON.parse(vt(e,"utf8")))}catch{return null}}function Bc(e,t){be(e,t)}function qc(e){try{let t=JSON.parse(vt(e,"utf8"));return t.version!==1||!v(t.at)||t.refreshRequestedAt!==void 0&&!v(t.refreshRequestedAt)||t.refreshDetail!==void 0&&typeof t.refreshDetail!="string"?null:{atMs:Date.parse(t.at),...t.refreshRequestedAt===void 0?{}:{refreshRequestedAtMs:Date.parse(t.refreshRequestedAt)},...t.refreshDetail===void 0?{}:{refreshDetail:t.refreshDetail}}}catch{return null}}function Hc(e,t,r={}){let n=r.pid??process.pid,i=r.isProcessAlive??St,s=()=>{},o=bt(e);if(o&&i(o.pid))return{acquired:!1,lockPath:e,message:dr(e,t,o),release:s};o&&ur(e,{force:!0}),Zn(ri(e),{recursive:!0});let a;try{a=ei(e,"wx")}catch(p){if(ai(p)==="EEXIST")return{acquired:!1,lockPath:e,message:dr(e,t,bt(e)),release:s};throw p}let c={version:1,pid:n,projectRoot:fr(t),startedAt:(r.now??(()=>new Date))().toISOString()};ti(a,`${JSON.stringify(c)}
2
+ `);let l=!1;return{acquired:!0,lockPath:e,message:"",release:()=>{if(l)return;l=!0,Yn(a);let p=bt(e);p?.pid===c.pid&&p.startedAt===c.startedAt&&ur(e,{force:!0})}}}function bt(e){try{let t=JSON.parse(vt(e,"utf-8"));return t.version!==1||typeof t.pid!="number"||!Number.isInteger(t.pid)||t.pid<=0||typeof t.projectRoot!="string"||!v(t.startedAt)?null:t}catch{return null}}function oi(e){if(!e||typeof e!="object")return null;let t=e;return t.version!==1||typeof t.protocolVersion!="number"||typeof t.pid!="number"||!Number.isInteger(t.pid)||t.pid<=0||typeof t.projectRoot!="string"||typeof t.cliVersion!="string"||!v(t.startedAt)||!v(t.heartbeatAt)||!v(t.lastActivityAt)||!ci(t.watcher)||t.idleDeadlineAt!==void 0&&!v(t.idleDeadlineAt)||t.lastError!==void 0&&!li(t.lastError)||t.lastRefresh!==void 0&&!pi(t.lastRefresh)||t.typescriptSemantic!==void 0&&!ui(t.typescriptSemantic)||t.typescriptIndex!==void 0&&!di(t.typescriptIndex)?null:t}function zc(e){return e.idleTimeoutMs===0||e.watcher.state!=="idle"?!1:e.nowMs-e.lastActivityAtMs>=e.idleTimeoutMs}function dr(e,t,r){return`error: scip-query watch is already running for ${fr(t)}${r?` (pid ${r.pid}, started ${r.startedAt}; lock: ${e})`:` (lock: ${e})`}. Stop that watcher before starting another.`}function ai(e){return typeof e=="object"&&e&&"code"in e?e.code:void 0}var Gc={now:Date.now,isProcessAlive:St,spawnServer(e,t,r,n){if(!Qn(e))throw new Error(`Watch service helper was not found at ${e}. Run npm run build first.`);Jn(process.execPath,[e,t,r,JSON.stringify(n)],{detached:!0,stdio:"ignore",env:{...process.env,SCIP_QUERY_SKIP_WATCH_SERVICE:"1"}}).unref()},signalProcess(e){process.kill(e,"SIGTERM")},sleep(e){let t=new Int32Array(new SharedArrayBuffer(4));Atomics.wait(t,0,0,e)}};function v(e){return typeof e=="string"&&Number.isFinite(Date.parse(e))}function ci(e){if(!e||typeof e!="object"||!("state"in e))return!1;let t=e;switch(t.state){case"idle":return!0;case"waiting":return w(t.changedFiles)&&w(t.reindexAt);case"indexing":return w(t.startedAt);case"cooldown":return w(t.until)&&typeof t.dirty=="boolean";default:return!1}}function li(e){if(!e||typeof e!="object")return!1;let t=e;return v(t.at)&&typeof t.message=="string"}function pi(e){if(!e||typeof e!="object")return!1;let t=e;return typeof t.trigger?.kind=="string"&&typeof t.result=="string"&&v(t.startedAt)&&v(t.completedAt)&&w(t.durationMs)}function ui(e){if(!e||typeof e!="object")return!1;let t=e;return typeof t.protocolVersion=="number"&&(t.state==="idle"||t.state==="ready"||t.state==="unavailable"||t.state==="error")&&w(t.requests)&&w(t.sessionsCreated)&&w(t.sessionsReused)&&w(t.sessionsRefreshed)&&w(t.sessionsReplaced)&&w(t.projectsCreated)&&(t.lastRequestAt===void 0||v(t.lastRequestAt))&&(t.lastError===void 0||typeof t.lastError=="string")&&(t.busyUntil===void 0||v(t.busyUntil))}function di(e){if(!e||typeof e!="object")return!1;let t=e;return typeof t.protocolVersion=="number"&&(t.state==="idle"||t.state==="ready"||t.state==="unavailable"||t.state==="error")&&Q(t.requests)&&Q(t.sessionsCreated)&&Q(t.sessionsReplaced)&&Q(t.initializations)&&Q(t.programUpdates)&&Q(t.documentsEmitted)&&Q(t.documentsRemoved)&&(t.lastRequestAt===void 0||v(t.lastRequestAt))&&(t.lastDurationMs===void 0||w(t.lastDurationMs)&&t.lastDurationMs>=0)&&(t.lastError===void 0||typeof t.lastError=="string")&&(t.busyUntil===void 0||v(t.busyUntil))}function w(e){return typeof e=="number"&&Number.isFinite(e)}function Q(e){return typeof e=="number"&&Number.isInteger(e)&&e>=0}import{createHash as fi}from"crypto";import{readFileSync as mi}from"fs";import{dirname as gi,join as Oe}from"path";var hi=2,yi="typescript-index";function Qc(e){let t=Oe(e,yi);return{rootDir:t,requestDir:Oe(t,"requests"),responseDir:Oe(t,"responses")}}function Zc(e){let t=JSON.parse(e);if(t.protocolVersion!==hi||typeof t.id!="string"||!t.id||typeof t.baseGeneration!="string"||!t.baseGeneration||typeof t.deadlineAtMs!="number"||!Number.isFinite(t.deadlineAtMs)||!Si(t.request))throw new Error("TypeScript index service received an invalid mailbox request.");return t}function el(e){try{let t=JSON.parse(mi(Oe(gi(e),"meta.json"),"utf8"));return t.version!==2&&t.version!==3||t.status!=="complete"||typeof t.updatedAt!="string"||t.fingerprint===void 0?null:fi("sha256").update(JSON.stringify({version:t.version,status:t.status,updatedAt:t.updatedAt,fingerprint:t.fingerprint,indexedLanguages:t.indexedLanguages})).digest("hex")}catch{return null}}function Si(e){if(!e||typeof e!="object")return!1;let t=e,r=mr(t.modifiedFiles)?t.modifiedFiles:null,n=mr(t.affectedFiles)?t.affectedFiles:null;return t.kind==="emit-documents"&&typeof t.tsconfigPath=="string"&&!!t.tsconfigPath&&typeof t.projectArgument=="string"&&!!t.projectArgument&&typeof t.projectIdentity=="string"&&!!t.projectIdentity&&typeof t.producerIdentity=="string"&&!!t.producerIdentity&&r!==null&&r.length>0&&new Set(r).size===r.length&&n!==null&&n.length>0&&new Set(n).size===n.length&&r.every(i=>n.includes(i))}function mr(e){return Array.isArray(e)&&e.every(t=>typeof t=="string"&&t.length>0)}import xi from"better-sqlite3";var bi=["node_modules",".git","dist","build","out","coverage","target",".next",".nuxt",".cache",".turbo",".nbb",".cpcache",".shadow-cljs",".scipquery-cache","__pycache__",".venv","venv"],gr=class{db;config;pathFilter;statementCache=new Map;constructor(t,r){this.config=t,this.pathFilter=r??null,this.db=new xi(t.dbPath,{readonly:!0}),this.db.pragma("busy_timeout = 5000"),this.db.pragma("query_only = ON"),this.db.pragma("temp_store = MEMORY"),this.db.pragma("cache_size = -64000"),this.db.pragma("mmap_size = 268435456")}isIgnored(t){return this.pathFilter?.isIgnored(t)??!1}get localSymbolPredicate(){return`(
3
+ EXISTS (
4
+ SELECT 1
5
+ FROM defn_enclosing_ranges local_der
6
+ JOIN documents local_d ON local_der.document_id = local_d.id
7
+ WHERE local_der.symbol_id = gs.id
8
+ ${this.pathExclusionsFor("local_d").trimStart()}
9
+ )
10
+ OR EXISTS (
11
+ SELECT 1
12
+ FROM mentions local_m
13
+ JOIN chunks local_c ON local_m.chunk_id = local_c.id
14
+ JOIN documents local_d ON local_c.document_id = local_d.id
15
+ WHERE local_m.symbol_id = gs.id
16
+ AND local_m.role = 1
17
+ ${this.pathExclusionsFor("local_d").trimStart()}
18
+ )
19
+ )`}get pathExclusions(){return this.pathExclusionsFor("d")}get symbolNoise(){return this.symbolNoiseFor("gs")}pathExclusionsFor(...t){return t.flatMap(r=>bi.flatMap(n=>[`AND ${r}.relative_path NOT LIKE '${n}/%'`,`AND ${r}.relative_path NOT LIKE '%/${n}/%'`])).join(`
20
+ `)}symbolNoiseFor(t){return`AND ${t}.symbol NOT LIKE '%().(%' AND ${t}.symbol NOT LIKE '%typeLiteral%'`}all(t,...r){return this.statement(t).all(...r)}get(t,...r){return this.statement(t).get(...r)}close(){this.statementCache.clear(),this.db.close()}statement(t){let r=this.statementCache.get(t);return r||(r=this.db.prepare(t),this.statementCache.set(t,r)),r}};function de(e){return typeof e=="object"&&e!==null}function Et(e){return Array.isArray(e)&&e.every(t=>typeof t=="string")?e:null}function al(e){return!de(e)||typeof e.version!="number"||Et(e.languages)===null||typeof e.pnpmWorkspaces!="boolean"||typeof e.typescriptProjectMode!="string"||Et(e.typescriptProjects)===null||e.clojureConfigPath!==void 0&&typeof e.clojureConfigPath!="string"||!Array.isArray(e.files)||!e.files.every(vi)?null:e}function cl(e,t){let r=new Map((e?.files??[]).map(a=>[a.path,a])),n=new Map(t.files.map(a=>[a.path,a])),i=new Set([...r.keys(),...n.keys()]),s=[];for(let a of[...i].sort()){let c=r.get(a),l=n.get(a),p=pr(a,t.languages);!c&&l?s.push({kind:"added",path:a,inputKind:p,after:l}):c&&!l?s.push({kind:"deleted",path:a,inputKind:p,before:c}):c&&l&&(c.hash!==l.hash||c.size!==l.size)&&s.push({kind:"modified",path:a,inputKind:p,before:c,after:l})}let o=new Set;return e||o.add("prior-snapshot-unavailable"),e&&e.version!==t.version&&o.add("snapshot-version-changed"),(hr(e?.files??[])||hr(t.files))&&o.add("duplicate-input-path"),[...e?.files??[],...t.files].some(Ei)&&o.add("unreadable-input"),{version:1,changes:s,projectIdentityChanged:e?!ki(e,t):!0,uncertainty:[...o].sort()}}function hr(e){return new Set(e.map(t=>t.path)).size!==e.length}function vi(e){return de(e)&&typeof e.path=="string"&&typeof e.size=="number"&&typeof e.hash=="string"}function Ei(e){return e.hash==="unreadable"||e.size<0}function Pi(e){let t=new Set;for(let r of e.uncertainty)t.add(r);e.projectIdentityChanged&&t.add("project-identity-changed");for(let r of e.changes)r.kind==="added"&&t.add("file-added"),r.kind==="deleted"&&t.add("file-deleted"),r.inputKind==="config"&&t.add("configuration-changed"),r.inputKind==="ambient"&&t.add("ambient-declaration-changed"),r.inputKind==="other"&&t.add("unclassified-input");return{fullProject:t.size>0,reasons:[...t].sort()}}function ll(e,t,r){let n=e.changes.map(a=>a.path).sort();if(n.length===0&&!e.projectIdentityChanged&&e.uncertainty.length===0)return{mode:"none",changedFiles:n,affectedFiles:[],reasons:[]};let i=new Set(r),s=Pi(e),o=new Set(s.reasons);return n.some(a=>!i.has(a))&&o.add("changed-file-outside-project"),t===null?(o.add("dependency-graph-unavailable"),yr(n,i,o)):o.size>0?yr(n,i,o):{mode:"closure",changedFiles:n,affectedFiles:Ni(n,t,i),reasons:[]}}function yr(e,t,r){return{mode:"full-project",changedFiles:e,affectedFiles:[...t].sort(),reasons:[...r].sort()}}function Ni(e,t,r){let n=new Map;for(let[o,a]of t)if(r.has(o))for(let c of a){if(!r.has(c))continue;let l=n.get(c)??new Set;l.add(o),n.set(c,l)}let i=new Set(e),s=[...e];for(let o=0;o<s.length;o+=1){let a=s[o];if(a!==void 0)for(let c of n.get(a)??[])i.has(c)||(i.add(c),s.push(c))}return[...i].sort()}function ki(e,t){return Sr(e.languages,t.languages)&&e.pnpmWorkspaces===t.pnpmWorkspaces&&e.typescriptProjectMode===t.typescriptProjectMode&&Sr(e.typescriptProjects,t.typescriptProjects)&&e.clojureConfigPath===t.clojureConfigPath}function Sr(e,t){if(e.length!==t.length)return!1;let r=[...e].sort(),n=[...t].sort();return r.every((i,s)=>i===n[s])}import{execFileSync as Ti}from"child_process";import{existsSync as Ii,readdirSync as br}from"fs";import{extname as vr,join as Er}from"path";var Pr=new Set([".git",".hg",".svn",".idea",".vscode","node_modules","vendor","dist","build","target","bin","obj",".dart_tool",".gradle",".next",".venv","venv","__pycache__"]),Ci=[{language:"typescript",files:["tsconfig.json","tsconfig.base.json"],extensions:[".ts",".tsx",".mts",".cts"]},{language:"rust",files:["Cargo.toml"],extensions:[".rs"]},{language:"go",files:["go.mod"],extensions:[".go"]},{language:"java",files:["pom.xml","build.gradle","build.gradle.kts"],extensions:[".java"]},{language:"kotlin",files:["build.gradle.kts"],extensions:[".kt",".kts"]},{language:"scala",files:["build.sbt"],extensions:[".scala"]},{language:"clojure",files:["deps.edn","project.clj","bb.edn","shadow-cljs.edn"],extensions:[".clj",".cljs",".cljc"]},{language:"python",files:["pyproject.toml","setup.py","setup.cfg","Pipfile"],extensions:[".py",".pyi"]},{language:"ruby",files:["Gemfile"],extensions:[".rb"]},{language:"cpp",files:["compile_commands.json","CMakeLists.txt","Makefile"],extensions:[".cc",".cpp",".cxx",".hpp",".hh",".hxx"]},{language:"c",files:["compile_commands.json","CMakeLists.txt","Makefile"],extensions:[".c",".h"]},{language:"csharp",globs:["*.csproj","*.sln"],extensions:[".cs"]},{language:"vb",globs:["*.vbproj"],extensions:[".vb"]},{language:"dart",files:["pubspec.yaml"],extensions:[".dart"]},{language:"php",files:["composer.json"],extensions:[".php"]},{language:"javascript",files:["package.json"],extensions:[".js",".jsx",".mjs",".cjs"]}];function ml(e){let t=[],r=Ri(e),n=Ai(e);for(let i of Ci){if(_i(e,i.files)){t.push(i.language);continue}if(wi(r,i.globs)){t.push(i.language);continue}ji(n,i.extensions)&&t.push(i.language)}return t.includes("typescript")&&xr(t,"javascript"),t.includes("cpp")&&!n.has(".c")&&xr(t,"c"),t}function Ri(e){try{return br(e)}catch{return[]}}function _i(e,t){return t?.length?t.some(r=>Ii(Er(e,r))):!1}function wi(e,t){return t?.length?e.some(r=>t.some(n=>Fi(r,n))):!1}function Fi(e,t){if(t==="*")return!0;if(!t.includes("*"))return e===t;let[r,n]=t.split("*");return e.startsWith(r??"")&&e.endsWith(n??"")}function Ai(e){let t=Di(e);if(t)return t;let r=new Set,n=[e];for(;n.length>0;){let i=n.pop();if(!i)continue;let s;try{s=br(i,{withFileTypes:!0})}catch{continue}for(let o of s){if(o.name.startsWith(".")&&!o.name.endsWith("proj")&&!o.name.endsWith("sln")&&o.isDirectory())continue;let a=Er(i,o.name);if(o.isDirectory()){Pr.has(o.name)||n.push(a);continue}let c=vr(o.name).toLowerCase();c&&r.add(c)}}return r}function Di(e){try{let t=Ti("git",["-C",e,"ls-files","-co","--exclude-standard","--","."],{encoding:"utf-8",maxBuffer:26214400,stdio:["ignore","pipe","ignore"]}),r=new Set;for(let n of t.split(`
21
+ `)){if(!n||n.split("/").some(s=>Pr.has(s)))continue;let i=vr(n).toLowerCase();i&&r.add(i)}return r}catch{return null}}function ji(e,t){return t?.length?t.some(r=>e.has(r)):!1}function xr(e,t){let r=e.indexOf(t);r!==-1&&e.splice(r,1)}import{createHash as Li}from"crypto";import{copyFileSync as Nr,existsSync as q,linkSync as Oi,mkdirSync as kr,readFileSync as Cr,readdirSync as Tr,renameSync as Nt,rmSync as We,statSync as Mi}from"fs";import{basename as Me,dirname as ve,join as E,relative as Ir}from"path";var $e=1,Wi=".scipquery-generations";function bl(e){let t=Ve(e.outputDb),r=$i(e,t);e.onStage?.("after-recovery-retained"),e.preserveOutputScip||Pt(e.tempOutputScip,e.outputScip),e.onStage?.("after-scip-handoff"),Pt(e.tempOutputDb,e.outputDb),e.onStage?.("after-database-handoff"),Pt(e.tempMetaPath,e.metaPath),e.onStage?.("after-metadata-handoff");let n=Ue(e.metaPath,e.outputDb),i={version:$e,currentGeneration:n,...r?{previousGeneration:r}:{},...e.publication?{publication:e.publication}:{},publishedAt:(e.now??(()=>new Date))().toISOString()};return be(E(t,"state.json"),i,{spacing:2,trailingNewline:!0}),{currentGeneration:n,...r?{previousGeneration:r}:{}}}function Rr(e){try{let t=JSON.parse(Cr(E(Ve(e),"state.json"),"utf8"));return t.version!==$e||typeof t.currentGeneration!="string"||!t.currentGeneration||typeof t.publishedAt!="string"||!Number.isFinite(Date.parse(t.publishedAt))||!Bi(t.previousGeneration)||!qi(t.publication)?null:t}catch{return null}}function vl(e,t,r=()=>new Date){if(!q(e)||!q(t))throw new Error("metadata-only generation refresh requires stable database and metadata files");let n=Rr(e),i={version:$e,currentGeneration:Ue(t,e),...n?.previousGeneration?{previousGeneration:n.previousGeneration}:{},...n?.publication?{publication:n.publication}:{},publishedAt:r().toISOString()};return be(E(Ve(e),"state.json"),i,{spacing:2,trailingNewline:!0}),i}function El(e,t=E(ve(e),"meta.json")){let r=E(Ve(e),"state.json");if(!q(r))return{state:"legacy",statePath:r};let n=Rr(e);if(!n)return{state:"invalid",statePath:r,reason:"generation state is malformed"};try{let i=Ue(t,e),s=n.currentGeneration===i,o=n.previousGeneration?q(E(ve(e),n.previousGeneration.databasePath)):!0;return!s||!o?{state:"drifted",statePath:r,currentMatches:s,recoveryExists:o,generation:n,reason:s?"retained recovery database is missing":"stable database or metadata no longer matches the published generation"}:{state:"current",statePath:r,currentMatches:s,recoveryExists:o,generation:n}}catch(i){return{state:"drifted",statePath:r,currentMatches:!1,recoveryExists:!1,generation:n,reason:i instanceof Error?i.message:String(i)}}}function Ve(e){return E(ve(e),Wi)}function $i(e,t){if(!q(e.outputDb))return;let r=Ue(e.metaPath,e.outputDb),n=E(t,r),i=E(n,Me(e.outputDb)),s=q(e.metaPath)?E(n,Me(e.metaPath)):void 0;if(!q(i)){let o=`${n}.${process.pid}.${Date.now()}.tmp`;We(o,{recursive:!0,force:!0}),kr(o,{recursive:!0});let a=E(o,Me(e.outputDb));try{Oi(e.outputDb,a)}catch{Nr(e.outputDb,a)}s&&Nr(e.metaPath,E(o,Me(e.metaPath))),kr(t,{recursive:!0}),Nt(o,n)}return Vi(t,r),{generationIdentity:r,databasePath:Ir(ve(e.outputDb),i),...s?{metadataPath:Ir(ve(e.outputDb),s)}:{}}}function Vi(e,t){for(let r of Tr(e,{withFileTypes:!0}))!r.isDirectory()||r.name===t||r.name.endsWith(".tmp")||We(E(e,r.name),{recursive:!0,force:!0});for(let r of Tr(e,{withFileTypes:!0}))r.isDirectory()&&r.name.endsWith(".tmp")&&We(E(e,r.name),{recursive:!0,force:!0})}function Ue(e,t){let r=Li("sha256").update(`sqlite-generation-v${$e}\0`);q(e)&&r.update(Ui(Cr(e,"utf8")));let n=Mi(t);return r.update(`\0${n.size}`),r.digest("hex")}function Ui(e){try{let t=JSON.parse(e);if((t.version===2||t.version===3)&&t.status==="complete"&&typeof t.updatedAt=="string"&&t.fingerprint!==void 0)return JSON.stringify({version:t.version,status:t.status,updatedAt:t.updatedAt,fingerprint:t.fingerprint,indexedLanguages:t.indexedLanguages,scipCompanion:t.scipCompanion})}catch{}return e}function Pt(e,t){We(`${t}.tmp-replace`,{force:!0}),Nt(e,`${t}.tmp-replace`),Nt(`${t}.tmp-replace`,t)}function Bi(e){if(e===void 0)return!0;if(!e||typeof e!="object")return!1;let t=e;return typeof t.generationIdentity=="string"&&!!t.generationIdentity&&typeof t.databasePath=="string"&&!!t.databasePath&&(t.metadataPath===void 0||typeof t.metadataPath=="string"&&!!t.metadataPath)}function qi(e){if(e===void 0)return!0;if(!e||typeof e!="object")return!1;let t=e,r=[t.converterDurationMs,t.affectedDocumentCount,t.changedDocumentCount,t.producerDurationMs,t.materializationDurationMs,t.patchDurationMs].filter(n=>n!==void 0);return(t.mode==="incremental"||t.mode==="full")&&t.validation==="passed"&&t.converterDurationMs!==void 0&&r.every(n=>typeof n=="number"&&Number.isFinite(n)&&n>=0)&&(t.scipCompanion===void 0||t.scipCompanion==="current"||t.scipCompanion==="deferred")&&(t.typescriptOverlayGeneration===void 0||typeof t.typescriptOverlayGeneration=="string"&&!!t.typescriptOverlayGeneration)&&(t.scipCompanion!=="deferred"||!!t.typescriptOverlayGeneration)&&(t.fallbackReason===void 0||typeof t.fallbackReason=="string")}import{readFileSync as _r}from"fs";import{createRequire as Hi}from"module";import{dirname as Ct,isAbsolute as zi,relative as Dr,resolve as z,sep as kt}from"path";var H=Hi(import.meta.url),Gi=1,wr="0.4.0";function Ki(){try{let e=jr();if(!e.available)return e;let{packageRoot:t}=e,r=H.resolve("typescript",{paths:[t]}),n=H(r),{FileIndexer:i}=H(z(t,"dist/src/FileIndexer.js")),{Input:s}=H(z(t,"dist/src/Input.js")),{Packages:o}=H(z(t,"dist/src/Packages.js")),a=H(z(t,"dist/src/scip.js"));if(!i||!s||!o||!a.scip?.Document||!a.scip.Index)return{available:!1,reason:"scip-typescript document runtime has an unsupported module shape"};let c={packageVersion:e.packageVersion,typescript:n,Document:a.scip.Document,Index:a.scip.Index,FileIndexer:i,Input:s,Packages:o};return{available:!0,runtime:c,producerIdentity:Rt(c)}}catch(e){return{available:!1,reason:`scip-typescript document runtime unavailable: ${e instanceof Error?e.message:String(e)}`}}}function Il(){let e=jr();return e.available?{available:!0,packageVersion:e.packageVersion,typescriptVersion:e.typescriptVersion,producerIdentity:e.producerIdentity}:e}function jr(){try{let e=H.resolve("@sourcegraph/scip-typescript/package.json"),t=JSON.parse(_r(e,"utf8"));if(t.version!==wr)return{available:!1,reason:`unsupported scip-typescript version ${String(t.version??"unknown")}; expected ${wr}`};let r=Ct(e),n=H.resolve("typescript/package.json",{paths:[r]}),i=JSON.parse(_r(n,"utf8"));return typeof i.version!="string"||!i.version?{available:!1,reason:"scip-typescript TypeScript compiler version is unavailable"}:{available:!0,packageRoot:r,packageVersion:t.version,typescriptVersion:i.version,producerIdentity:Lr(t.version,i.version)}}catch(e){return{available:!1,reason:`scip-typescript document producer unavailable: ${e instanceof Error?e.message:String(e)}`}}}function Cl(e){let t=e.runtime===void 0?Ki():e.runtime===null?{available:!1,reason:"scip-typescript document runtime unavailable"}:{available:!0,runtime:e.runtime,producerIdentity:Rt(e.runtime)};return t.available?{available:!0,emitter:new Tt(e,t.runtime)}:t}var Tt=class{producerIdentity;workspaceRoot;tsconfigPath;projectRoot;maxFileByteSize;runtime;host;config=null;includedFiles=new Set;program=null;checker=null;symbolTable=new Map;constructorTable=new Map;packages;fragments=new Map;stats={initializations:0,programUpdates:0,documentsEmitted:0,documentsRemoved:0,sourceNodesReused:0,sourceNodesReplaced:0,symbolEntriesPruned:0};constructor(t,r){this.workspaceRoot=z(t.workspaceRoot),this.tsconfigPath=z(this.workspaceRoot,t.tsconfigPath),this.projectRoot=t.projectRoot??Ji(this.workspaceRoot,Ct(this.tsconfigPath)),this.maxFileByteSize=t.maxFileByteSize??1024*1024,this.runtime=r,this.producerIdentity=Rt(r);let n=Fr(r.typescript,this.tsconfigPath);this.config=n,this.host=new It(r.typescript,n.options,this.workspaceRoot),this.packages=new r.Packages(this.projectRoot)}initialize(){let t=performance.now(),r=this.config??Fr(this.runtime.typescript,this.tsconfigPath);this.includedFiles=new Set(r.fileNames.map(fe)),this.program=this.runtime.typescript.createProgram(r.fileNames,r.options,this.host.compilerHost),this.checker=this.program.getTypeChecker(),this.stats.initializations+=1;let n=[];for(let i of this.program.getSourceFiles())this.includedFiles.has(fe(i.fileName))&&n.push(this.emitSourceFile(i));return this.result(n,t)}advance(t){if(!this.program||!this.checker||!this.config)return this.initializeAndAdvance(t);let r=performance.now(),n=Be(t.modifiedFiles),i=Be(t.affectedFiles);this.validateIncrementalPaths(n,i);let s=this.program,o=new Map;for(let c of n){let l=Ee(this.workspaceRoot,c),p=s.getSourceFile(l);if(!p)throw new Error(`modified TypeScript source is unavailable: ${c}`);o.set(c,p),this.stats.symbolEntriesPruned+=Ar(this.symbolTable,p),this.stats.symbolEntriesPruned+=Ar(this.constructorTable,p),this.host.invalidate(l)}this.program=this.runtime.typescript.createProgram(this.config.fileNames,this.config.options,this.host.compilerHost,s),this.checker=this.program.getTypeChecker(),this.stats.programUpdates+=1;for(let[c,l]of o)this.program.getSourceFile(Ee(this.workspaceRoot,c))===l?this.stats.sourceNodesReused+=1:this.stats.sourceNodesReplaced+=1;let a=i.map(c=>{let l=Ee(this.workspaceRoot,c),p=this.program.getSourceFile(l);if(!p)throw new Error(`affected TypeScript source is unavailable: ${c}`);return this.emitSourceFile(p)});return this.result(a,r)}fragment(t){return this.fragments.get(qe(t))??null}snapshotStats(){return{...this.stats}}initializeAndAdvance(t){let r=this.initialize(),n=Be(t.modifiedFiles),i=Be(t.affectedFiles);this.validateIncrementalPaths(n,i);let s=new Set(i);return{...r,fragments:r.fragments.filter(o=>s.has(o.relativePath))}}validateIncrementalPaths(t,r){if(t.length===0)throw new Error("incremental TypeScript document update requires a modified file");if(r.length===0)throw new Error("incremental TypeScript document update requires an affected file");for(let n of t){let i=Ee(this.workspaceRoot,n);if(!this.includedFiles.has(fe(i)))throw new Error(`modified TypeScript file is outside the configured project: ${n}`)}for(let n of r){let i=Ee(this.workspaceRoot,n);if(!this.includedFiles.has(fe(i)))throw new Error(`affected TypeScript file is outside the configured project: ${n}`)}}emitSourceFile(t){if(!this.checker)throw new Error("TypeScript document emitter is not initialized");let r=qe(Dr(this.workspaceRoot,t.fileName)),n=new this.runtime.Document({relative_path:r,occurrences:[]});if(new this.runtime.FileIndexer(this.checker,{cwd:this.workspaceRoot,projectRoot:this.projectRoot,projectDisplayName:this.projectRoot,maxFileByteSizeNumber:this.maxFileByteSize},new this.runtime.Input(t.fileName,t.getText()),n,this.symbolTable,this.constructorTable,this.packages,t).index(),this.stats.documentsEmitted+=1,n.occurrences.length===0)return this.fragments.delete(r),this.stats.documentsRemoved+=1,{relativePath:r,bytes:null,occurrences:0,symbols:n.symbols.length,referenceFragments:[]};let s=n.serializeBinary();return this.fragments.set(r,s),{relativePath:r,bytes:s,occurrences:n.occurrences.length,symbols:n.symbols.length,referenceFragments:Xi(r,n)}}result(t,r){return{producerIdentity:this.producerIdentity,fragments:t,durationMs:performance.now()-r,stats:this.snapshotStats()}}};function Xi(e,t){let r=new Map;for(let n of t.occurrences){if(!n.symbol||(n.symbol_roles&1)!==0||n.range.length<3)continue;let i=n.range[0],s=n.range[1];if(!Number.isInteger(i)||!Number.isInteger(s))continue;let o={targetSymbol:n.symbol,location:{file:e,line:i,column:s}};r.set(`${n.symbol}\0${i}\0${s}`,o)}return[...r.values()].sort((n,i)=>n.targetSymbol.localeCompare(i.targetSymbol)||n.location.line-i.location.line||n.location.column-i.location.column)}var It=class{compilerHost;sourceFiles=new Map;constructor(t,r,n){let i=t.createCompilerHost(r),s=i.getSourceFile.bind(i);this.compilerHost={...i,getCurrentDirectory:()=>n,getSourceFile:(o,a,c,l)=>{let p=fe(o);if(this.sourceFiles.has(p))return this.sourceFiles.get(p);let u=s(o,a,c,l);return this.sourceFiles.set(p,u),u}}}invalidate(t){this.sourceFiles.delete(fe(t))}};function Fr(e,t){let r=e.readConfigFile(t,e.sys.readFile);if(r.error)throw new Error(e.formatDiagnostics([r.error],e.createCompilerHost({})));let n=e.parseJsonConfigFileContent(r.config,e.sys,Ct(t)),i=n.errors.filter(s=>s.code!==18003);if(i.length>0)throw new Error(e.formatDiagnostics(i,e.createCompilerHost({})));return n}function Rt(e){return Lr(e.packageVersion,e.typescript.version)}function Lr(e,t){return`scip-typescript:${e}:typescript:${t}:document-adapter:${Gi}`}function Ji(e,t){return qe(Dr(e,t))||"."}function Ee(e,t){if(zi(t))throw new Error(`expected a project-relative path: ${t}`);let r=z(e,t),n=e.endsWith(kt)?e:`${e}${kt}`;if(r!==e&&!r.startsWith(n))throw new Error(`path escapes the project root: ${t}`);return r}function Be(e){return[...new Set(e.map(qe))].sort()}function qe(e){return e.split(kt).join("/").replace(/^\.\//,"")}function fe(e){return z(e)}function Ar(e,t){let r=0;for(let n of e.keys())if(Yi(n)){try{if(n.getSourceFile()!==t)continue}catch{continue}e.delete(n),r+=1}return r}function Yi(e){return!!(e&&typeof e=="object"&&"kind"in e&&"getSourceFile"in e)}import{createHash as Qi}from"crypto";import{readFileSync as Zi}from"fs";import{dirname as Or,join as Mr}from"path";import es from"better-sqlite3";var ts="evidence.db";var He=new WeakMap,rs=x("evidence-content-hash",{clearGroups:["whole-project","source-file"]}),ns=x("evidence-project-fingerprint",{clearGroups:["whole-project"]}),Pe="evidence-v1",me="version NOT LIKE 'evidence-%'";function ze(e){return Qi("sha256").update(e).digest("hex")}function Ne(e,t,r){return rs.get(e,t,()=>ze(r))}function Wr(e){return ns.get(e,"current",()=>{try{let t=JSON.parse(Zi(Mr(Or(e.config.dbPath),"meta.json"),"utf-8"));if(t.version!==2&&t.version!==3||t.status!=="complete"&&t.status!=="partial"||t.fingerprint===void 0)return null;let r=Array.isArray(t.indexedLanguages)?[...t.indexedLanguages].sort():[];return ze(JSON.stringify({fingerprint:t.fingerprint,indexedLanguages:r,status:t.status}))}catch(t){return _t("project fingerprint unavailable",t),null}})}function _t(e,t){process.env.SCIP_QUERY_DEBUG&&console.error(`evidence-cache: ${e}: ${t instanceof Error?t.message:String(t)}`)}function ke(e){if(He.has(e))return He.get(e)??null;let t=null;try{let r=new es(Mr(Or(e.config.dbPath),ts));r.pragma("journal_mode = WAL"),r.pragma("busy_timeout = 5000"),r.pragma("synchronous = NORMAL"),r.exec(`
22
+ CREATE TABLE IF NOT EXISTS file_evidence (
23
+ kind TEXT NOT NULL,
24
+ relative_path TEXT NOT NULL,
25
+ content_hash TEXT NOT NULL,
26
+ version TEXT NOT NULL,
27
+ payload TEXT NOT NULL,
28
+ PRIMARY KEY (kind, relative_path)
29
+ );
30
+ CREATE TABLE IF NOT EXISTS project_evidence (
31
+ kind TEXT NOT NULL,
32
+ cache_key TEXT NOT NULL,
33
+ project_fingerprint TEXT NOT NULL,
34
+ version TEXT NOT NULL,
35
+ payload TEXT NOT NULL,
36
+ PRIMARY KEY (kind, cache_key)
37
+ );
38
+ CREATE TABLE IF NOT EXISTS semantic_callees (
39
+ relative_path TEXT NOT NULL,
40
+ symbol TEXT NOT NULL,
41
+ content_hash TEXT NOT NULL,
42
+ deps_digest TEXT NOT NULL,
43
+ version TEXT NOT NULL,
44
+ payload TEXT NOT NULL,
45
+ PRIMARY KEY (relative_path, symbol)
46
+ );
47
+ CREATE TABLE IF NOT EXISTS semantic_references (
48
+ relative_path TEXT NOT NULL,
49
+ symbol TEXT NOT NULL,
50
+ project_fingerprint TEXT NOT NULL,
51
+ version TEXT NOT NULL,
52
+ payload TEXT NOT NULL,
53
+ PRIMARY KEY (relative_path, symbol)
54
+ );
55
+ CREATE TABLE IF NOT EXISTS finding_outcome_ledger (
56
+ check_name TEXT NOT NULL,
57
+ finding_id TEXT NOT NULL,
58
+ first_seen INTEGER NOT NULL,
59
+ last_seen INTEGER NOT NULL,
60
+ times_shown INTEGER NOT NULL,
61
+ outcome TEXT NOT NULL,
62
+ PRIMARY KEY (check_name, finding_id)
63
+ );
64
+ `),t={evidence:r,readFileEvidence:r.prepare("SELECT payload FROM file_evidence WHERE kind = ? AND relative_path = ? AND content_hash = ? AND version = ?"),readLegacyFileEvidence:r.prepare(`SELECT payload FROM file_evidence
65
+ WHERE kind = ? AND relative_path = ? AND content_hash = ? AND ${me}
66
+ ORDER BY version DESC
67
+ LIMIT 1`),writeFileEvidence:r.prepare("INSERT OR REPLACE INTO file_evidence (kind, relative_path, content_hash, version, payload) VALUES (?, ?, ?, ?, ?)"),readProjectEvidence:r.prepare("SELECT payload FROM project_evidence WHERE kind = ? AND cache_key = ? AND project_fingerprint = ? AND version = ?"),readLegacyProjectEvidence:r.prepare(`SELECT payload FROM project_evidence
68
+ WHERE kind = ? AND cache_key = ? AND project_fingerprint = ? AND ${me}
69
+ ORDER BY version DESC
70
+ LIMIT 1`),writeProjectEvidence:r.prepare("INSERT OR REPLACE INTO project_evidence (kind, cache_key, project_fingerprint, version, payload) VALUES (?, ?, ?, ?, ?)"),readCallees:r.prepare(`SELECT payload FROM semantic_callees
71
+ WHERE relative_path = ? AND symbol = ? AND content_hash = ? AND deps_digest = ? AND version = ?`),readLegacyCallees:r.prepare(`SELECT payload FROM semantic_callees
72
+ WHERE relative_path = ? AND symbol = ? AND content_hash = ? AND deps_digest = ? AND ${me}
73
+ ORDER BY version DESC
74
+ LIMIT 1`),readCalleesForFile:r.prepare(`SELECT symbol, payload FROM semantic_callees
75
+ WHERE relative_path = ? AND content_hash = ? AND deps_digest = ? AND version = ?`),readLegacyCalleesForFile:r.prepare(`SELECT symbol, payload FROM semantic_callees
76
+ WHERE relative_path = ? AND content_hash = ? AND deps_digest = ? AND ${me}
77
+ ORDER BY symbol, version DESC`),writeCallees:r.prepare(`INSERT OR REPLACE INTO semantic_callees
78
+ (relative_path, symbol, content_hash, deps_digest, version, payload) VALUES (?, ?, ?, ?, ?, ?)`),dropStaleCallees:r.prepare("DELETE FROM semantic_callees WHERE relative_path = ? AND content_hash != ?"),readReferences:r.prepare(`SELECT payload FROM semantic_references
79
+ WHERE relative_path = ? AND symbol = ? AND project_fingerprint = ? AND version = ?`),readLegacyReferences:r.prepare(`SELECT payload FROM semantic_references
80
+ WHERE relative_path = ? AND symbol = ? AND project_fingerprint = ? AND ${me}
81
+ ORDER BY version DESC
82
+ LIMIT 1`),readReferencesForFile:r.prepare(`SELECT symbol, payload FROM semantic_references
83
+ WHERE relative_path = ? AND project_fingerprint = ? AND version = ?`),readLegacyReferencesForFile:r.prepare(`SELECT symbol, payload FROM semantic_references
84
+ WHERE relative_path = ? AND project_fingerprint = ? AND ${me}
85
+ ORDER BY symbol, version DESC`),writeReferences:r.prepare(`INSERT OR REPLACE INTO semantic_references
86
+ (relative_path, symbol, project_fingerprint, version, payload) VALUES (?, ?, ?, ?, ?)`),dropStaleReferences:r.prepare("DELETE FROM semantic_references WHERE relative_path = ? AND project_fingerprint != ?"),readFindingOutcomeLedger:r.prepare("SELECT check_name, finding_id, first_seen, last_seen, times_shown, outcome FROM finding_outcome_ledger"),deleteFindingOutcomeLedgerForCheck:r.prepare("DELETE FROM finding_outcome_ledger WHERE check_name = ?"),writeFindingOutcomeLedgerRow:r.prepare(`INSERT INTO finding_outcome_ledger
87
+ (check_name, finding_id, first_seen, last_seen, times_shown, outcome) VALUES (?, ?, ?, ?, ?, ?)`)}}catch(r){_t("disabled (open failed)",r)}return He.set(e,t),t}function Te(e,t,r){_t(`disabled (${t})`,r),He.set(e,null)}function $r(e,t,r,n){let i=ke(e);if(!i)return null;try{return(i.readFileEvidence.get(t,r,n,Pe)??i.readLegacyFileEvidence.get(t,r,n))?.payload??null}catch(s){return Te(e,"file_evidence read",s),null}}function Vr(e,t,r,n,i){let s=ke(e);if(s)try{s.writeFileEvidence.run(t,r,n,Pe,i)}catch(o){Te(e,"file_evidence write",o)}}function Ur(e,t){if(t.length===0)return;let r=ke(e);if(r)try{r.evidence.transaction(()=>{for(let n of t)r.writeFileEvidence.run(n.kind,n.relativePath,n.contentHash,Pe,n.payload)})()}catch(n){Te(e,"file_evidence batch write",n)}}function Br(e,t,r,n){let i=ke(e);if(!i)return null;try{return(i.readProjectEvidence.get(t,r,n,Pe)??i.readLegacyProjectEvidence.get(t,r,n))?.payload??null}catch(s){return Te(e,"project_evidence read",s),null}}function qr(e,t,r,n,i){let s=ke(e);if(s)try{s.writeProjectEvidence.run(t,r,n,Pe,i)}catch(o){Te(e,"project_evidence write",o)}}var is=[P("source-facts",{dependsOn:["content-hash","tool-version"],keyParts:["kind","relativePath","contentHash","payloadVersion"],stalenessTest:"tests/storage/evidence-cache.test.ts",owner:"src/source/source-facts.ts"}),P("file-definitions",{dependsOn:["content-hash","project-fingerprint","indexed-language-set","tool-version"],keyParts:["kind","relativePath","contentHash","projectFingerprint","payloadVersion"],stalenessTest:"tests/storage/evidence-cache.test.ts",owner:"src/symbols/definition-catalog.ts"}),P("definition-exclusions",{dependsOn:["content-hash","tool-version"],keyParts:["kind","relativePath","contentHash","payloadVersion"],stalenessTest:"tests/storage/evidence-cache.test.ts",owner:"src/analysis/framework-patterns.ts"}),P("doc-path-tokens",{dependsOn:["content-hash","tool-version"],keyParts:["kind","relativePath","contentHash","payloadVersion"],stalenessTest:"tests/storage/evidence-products.test.ts",owner:"tests/storage/evidence-cache.test.ts"}),P("doc-path-evidence",{dependsOn:["content-hash","git-history","git-head","tool-version"],keyParts:["kind","relativePath","contentHash","trackedFiles","historyWindow","payloadVersion"],stalenessTest:"tests/storage/evidence-cache.test.ts",owner:"src/queries/cleanup/doc-drift.ts"}),P("source-imports",{dependsOn:["content-hash","import-resolution-fingerprint","config","tool-version"],keyParts:["kind","relativePath","contentHash","importResolutionFingerprint","payloadVersion"],stalenessTest:"tests/storage/evidence-cache.test.ts",owner:"src/language-parsers/index.ts"}),P("source-reexports",{dependsOn:["content-hash","import-resolution-fingerprint","config","tool-version"],keyParts:["kind","relativePath","contentHash","importResolutionFingerprint","payloadVersion"],stalenessTest:"tests/storage/evidence-cache.test.ts",owner:"src/language-parsers/index.ts"}),P("source-fingerprints",{dependsOn:["content-hash","project-fingerprint","indexed-language-set","tool-version"],keyParts:["kind","relativePath","contentHash","projectFingerprint","payloadVersion"],stalenessTest:"tests/symbols/definition-catalog.test.ts",owner:"src/queries/cleanup/similar.ts"}),P("consumer-file-usage",{dependsOn:["content-hash","project-fingerprint","indexed-language-set","tool-version"],keyParts:["kind","relativePath","contentHash","projectFingerprint","payloadVersion"],stalenessTest:"tests/storage/evidence-cache.test.ts",owner:"src/queries/internal/consumer-evidence.ts"}),P("react-component-behavior-profiles",{dependsOn:["content-hash","tool-version"],keyParts:["kind","relativePath","contentHash","payloadVersion"],stalenessTest:"tests/storage/evidence-cache.test.ts",owner:"src/source/react-profile.ts"}),P("git-file-adds",{dependsOn:["git-head","git-history","tool-version"],keyParts:["kind","cacheKey","head","historyWindow","payloadVersion"],stalenessTest:"tests/storage/evidence-cache.test.ts",owner:"src/analysis/git-history.ts"}),P("typescript-reference-fragments",{dependsOn:["content-hash","transitive-deps-digest","config","tool-version"],keyParts:["kind","relativePath","semanticIdentity","payloadVersion"],stalenessTest:"tests/semantic/typescript/typescript-reference-fragments.test.ts",owner:"src/semantic/typescript/reference-fragment-shadow.ts"}),P("typescript-import-usage",{dependsOn:["content-hash","transitive-deps-digest","config","tool-version"],keyParts:["kind","relativePath","semanticIdentity","payloadVersion"],stalenessTest:"tests/semantic/typescript/typescript-semantic-provider.test.ts",owner:"src/semantic/shared-primitives.ts"}),P("typescript-signatures",{dependsOn:["content-hash","transitive-deps-digest","config","tool-version"],keyParts:["kind","relativePath","semanticIdentity","payloadVersion"],stalenessTest:"tests/semantic/typescript/typescript-semantic-provider.test.ts",owner:"src/semantic/shared-primitives.ts"}),Ge("file-dependency-graph",{dependsOn:["project-fingerprint","indexed-language-set","import-resolution-fingerprint","tool-version"],keyParts:["kind","scope","projectFingerprint","payloadVersion"],stalenessTest:"tests/symbols/file-dep-graph.test.ts",owner:"src/symbols/graph/file-dep-graph.ts"}),Ge("semantic-import-usage",{dependsOn:["project-fingerprint","indexed-language-set","import-resolution-fingerprint","tool-version"],keyParts:["kind","relativePath","projectFingerprint","language","semanticEngine","payloadVersion"],stalenessTest:"tests/semantic/rust/rust-semantic-cache-gate.test.ts",owner:"src/semantic/shared-primitives.ts"}),Ge("semantic-signatures",{dependsOn:["project-fingerprint","indexed-language-set","tool-version"],keyParts:["kind","relativePath","symbol","projectFingerprint","language","semanticEngine","payloadVersion"],stalenessTest:"tests/semantic/rust/rust-semantic-cache-gate.test.ts",owner:"src/semantic/shared-primitives.ts"}),Ge("health-semantic-prewarm",{dependsOn:["project-fingerprint","indexed-language-set","tool-version"],keyParts:["kind","scope","cliVersion","projectFingerprint","payloadVersion"],stalenessTest:"tests/runtime/cli-support.test.ts",owner:"src/runtime/cli-support.ts"})];function Ie(e){let t=new Map;return{kind:e.kind,read(r,n,i){let s=!1,o=0,a;if(gt()){let c=Wr(r);if(c){let l=`${c}\0${n}\0${i}`;a=t.get(l),a||(a=ht(["evidence-product-file-read-v1",e.kind,c,n,i]),t.set(l,a))}}return yt("evidence-product.file.read",()=>{let c=$r(r,e.kind,n,i);if(c===null)return null;o=c.length;try{let l=e.deserialize(c);return s=l!==null,l}catch{return null}},()=>({...a?{workIdentity:a,workOutcome:"computed"}:{},scope:"file",kind:e.kind,available:!0,hit:s,payloadBytes:o}))},write(r,n,i,s){Vr(r,e.kind,n,i,e.serialize(s))},writeBatch(r,n){Ur(r,n.map(i=>({kind:e.kind,relativePath:i.relativePath,contentHash:i.contentHash,payload:e.serialize(i.value)})))}}}function $l(e){let t=new Map;return{kind:e.kind,read(r,n,i){let s=!1,o=0,a;if(gt()){let c=`${i}\0${n}`;a=t.get(c),a||(a=ht(["evidence-product-project-read-v1",e.kind,i,n]),t.set(c,a))}return yt("evidence-product.project.read",()=>{let c=Br(r,e.kind,n,i);if(c===null)return null;o=c.length;try{let l=e.deserialize(c);return s=l!==null,l}catch{return null}},()=>({...a?{workIdentity:a,workOutcome:"computed"}:{},scope:"project",kind:e.kind,available:!0,hit:s,payloadBytes:o}))},write(r,n,i,s){qr(r,e.kind,n,i,e.serialize(s))}}}function Ce(e){let t=is.find(r=>r.kind===e);if(!t)throw new Error(`missing evidence product manifest entry for ${e}`);return t.invalidation}function P(e,t){return{scope:"file",kind:e,invalidation:{scope:"file",...t}}}function Ge(e,t){return{scope:"project",kind:e,invalidation:{scope:"project",...t}}}import{isAbsolute as ss,relative as os}from"path";function N(e){return e.replace(/\\/g,"/")}function Bl(e,t){let r=os(e,t);return r===""||!r.startsWith("..")&&!ss(r)}var as=[".ts",".tsx",".mts",".cts",".js",".jsx",".mjs",".cjs"];function Hl(e){let t=e.toLowerCase();return as.some(r=>t.endsWith(r))}import{createRequire as cs}from"module";var Hr=cs(import.meta.url),Re,Ke;function ls(){if(Re!==void 0)return Re;try{Re=Hr("ts-morph")}catch{Re=null}return Re}function Kl(){if(Ke)return Ke;let e=ls();if(!e)return"ts-morph:unavailable";let t="unknown";try{t=Hr("ts-morph/package.json").version??"unknown"}catch{}return Ke=`ts-morph:${t}:typescript:${e.ts.version}`,Ke}function Xl(e,t){return t.map(r=>({tsconfigPath:r,project:new e.Project({tsConfigFilePath:r,skipFileDependencyResolution:!0})}))}function Jl(e,t,r){return{language:"typescript",availability:()=>({available:!1,reason:e,tsconfigPath:t,tsconfigPaths:r}),importUsage:()=>[],referencesFor:()=>[],calleesFor:()=>[],signatureFor:()=>null}}function Ql(e,t,r){let n=new Set(r),i=new Map(r.map(s=>[s,[]]));for(let s of e)for(let o of t.get(s.symbolId)??[])n.has(o.file)&&i.get(o.file).push({targetSymbol:s.symbol,location:o});for(let[s,o]of i)i.set(s,ps(o));return i}function ps(e){let t=new Map;for(let r of e){let{location:n}=r;t.set(`${r.targetSymbol}\0${n.file}\0${n.line}\0${n.column}`,r)}return[...t.values()].sort((r,n)=>r.targetSymbol.localeCompare(n.targetSymbol)||us(r.location,n.location))}function us(e,t){return e.file.localeCompare(t.file)||e.line-t.line||e.column-t.column}import{existsSync as Ft,readFileSync as At,readdirSync as ds,statSync as fs}from"fs";import{join as ge,relative as ms}from"path";function zr(e){let t=gs(e)??xs(e);if(!t||t.length===0)return[];let r=[],n=new Set;for(let i of t)for(let s of bs(e,i)){if(n.has(s))continue;n.add(s);let o=vs(e,s);o&&r.push(o)}return r}function gs(e){let t=ge(e,"pnpm-workspace.yaml");if(!Ft(t))return null;try{return hs(At(t,"utf8"))}catch{return null}}function hs(e){let t=[],r=!1;for(let n of e.split(/\r?\n/)){let i=ys(n);if(!r){/^packages\s*:\s*$/.test(i.trim())&&(r=!0);continue}let s=/^\s+-\s*(.+)$/.exec(i);if(s){let o=Ss(s[1].trim());o&&t.push(o);continue}if(i.trim()!=="")break}return t}function ys(e){let t=e.indexOf("#");return t===-1?e:e.slice(0,t)}function Ss(e){return e.startsWith('"')&&e.endsWith('"')||e.startsWith("'")&&e.endsWith("'")?e.slice(1,-1):e}function xs(e){let t=ge(e,"package.json");if(!Ft(t))return null;try{let r=JSON.parse(At(t,"utf8"));return r.workspaces?Array.isArray(r.workspaces)?r.workspaces:r.workspaces.packages??[]:null}catch{return null}}function bs(e,t){if(!t||t.startsWith("!")||t.includes("node_modules"))return[];if(!t.includes("*")){let o=ge(e,t);return wt(o)?[o]:[]}let r=t.indexOf("*"),n=t.slice(0,r).replace(/\/$/,""),i=t.slice(r+1).replace(/^\//,""),s=ge(e,n||".");return wt(s)?ds(s).map(o=>ge(s,o,i)).filter(wt):[]}function wt(e){try{return fs(e).isDirectory()}catch{return!1}}function vs(e,t){let r=ge(t,"package.json");if(!Ft(r))return null;try{let n=JSON.parse(At(r,"utf8"));return typeof n.name!="string"||n.name.length===0?null:{name:n.name,relativeDir:ms(e,t).replace(/\\/g,"/"),exports:n.exports}}catch{return null}}import{createRequire as Es}from"module";import{existsSync as te}from"fs";import{basename as Gr,dirname as I,extname as W,join as F,relative as Z,resolve as y,sep as Ps}from"path";var Ns=Le("indexed-paths",{clearGroups:[]}),ks=Le("indexed-path-digest",{clearGroups:[]}),Ts=x("tsconfig-alias-config",{clearGroups:["whole-project"]}),Is=x("tsconfig-alias-config-for-dir",{clearGroups:["whole-project"]}),Cs=Es(import.meta.url),_e;function Rs(){if(_e!==void 0)return _e;try{_e=Cs("typescript")}catch{_e=null}return _e}var _s=["tsconfig.json","tsconfig.app.json","tsconfig.node.json","tsconfig.base.json"],ws=Le("workspace-packages",{clearGroups:["whole-project"]}),ee=[".ts",".tsx",".mts",".cts",".js",".jsx",".mjs",".cjs",".vue"],Xe=[".py",".pyi"],C=[".java",".scala",".kt",".kts"],Je=[".rs"],Ye=[".rb"],Qe=[".c",".h",".cc",".cpp",".cxx",".hpp",".hh",".hxx"],G=[".cs",".vb"],Ze=[".dart"],re=[".php"],he=[".clj",".cljs",".cljc"],Fs=new Set(ee),Dt=new Set(Xe),Kr=new Set(C),jt=new Set(Je),Lt=new Set(Ye),Xr=new Set(Qe),Jr=new Set(G),Ot=new Set(Ze),Yr=new Set(re),Qr=new Set(he),As=[{extensions:ee,lookup:Fs},{extensions:Xe,lookup:Dt},{extensions:C,lookup:Kr},{extensions:Je,lookup:jt},{extensions:Ye,lookup:Lt},{extensions:Qe,lookup:Xr},{extensions:G,lookup:Jr},{extensions:Ze,lookup:Ot},{extensions:re,lookup:Yr},{extensions:he,lookup:Qr}];function $(e,t){return t.has(W(e).toLowerCase())}function Ds(e){return $(e,Dt)}function js(e){return $(e,Kr)}function Ls(e){return $(e,jt)}function Os(e){return $(e,Lt)}function Ms(e){return $(e,Xr)}function Ws(e){return $(e,Jr)}function Zr(e){return W(e).toLowerCase()===".vb"}function $s(e){return $(e,Ot)}function Vs(e){return $(e,Yr)}function Us(e){return $(e,Qr)}function Mt(e){let t=W(e).toLowerCase();for(let r of As)if(r.lookup.has(t))return r.extensions;return ee}function Bs(e){return js(e)||Ws(e)||Vs(e)}function K(e,t,r){return Ds(t)?ye(e,t,r):Ls(t)?V(e,t,r):Os(t)?et(e,t,r):Ms(t)?tt(e,t,r):Bs(t)?g(e,r.replace(/\\/g,"."),Mt(t)):$s(t)?rt(e,t,r):Us(t)?Wt(e,r):qs(e,t,r)}function qs(e,t,r){if(!r.startsWith(".")&&!r.startsWith("/"))return Hs(e,t,r)??Gs(e,r);let n=I(F(e.config.projectRoot,t)),i=y(n,r),s=U(e);for(let o of Vt(i)){let a=N(Z(e.config.projectRoot,o));if(s.has(a)||te(o))return a}return N(Z(e.config.projectRoot,i))}function Hs(e,t,r){let n=Zs(e,t);if(!n)return null;let i=U(e);for(let s of zs(n,r)){let o=y(n.baseUrl,s);for(let a of Vt(o)){let c=N(Z(e.config.projectRoot,a));if(i.has(c)||te(a))return c}}return null}function zs(e,t){let r=[];for(let[n,i]of Object.entries(e.paths)){let s=n.indexOf("*");if(s===-1){if(t!==n)continue;r.push(...i);continue}let o=n.slice(0,s),a=n.slice(s+1);if(!t.startsWith(o)||!t.endsWith(a)||t.length<o.length+a.length)continue;let c=t.slice(o.length,t.length-a.length);for(let l of i)r.push(l.includes("*")?l.replace("*",c):l)}return r}function Gs(e,t){let r=Xs(Ks(e),t);if(!r)return null;let n=U(e);for(let i of Js(r)){let s=y(e.config.projectRoot,r.pkg.relativeDir,i);for(let o of Vt(s)){let a=N(Z(e.config.projectRoot,o));if(n.has(a)||te(o))return a}}return null}function Ks(e){return ws.get(e,()=>zr(e.config.projectRoot))}function Xs(e,t){let r=null;for(let n of e){let i=null;t===n.name?i="":t.startsWith(`${n.name}/`)&&(i=t.slice(n.name.length+1)),i!==null&&(!r||n.name.length>r.pkg.name.length)&&(r={pkg:n,subpath:i})}return r}function Js(e){let t=[],r=Ys(e.pkg.exports,e.subpath);if(r){let n=Qs(r);n&&t.push(n)}return t.push(e.subpath?`src/${e.subpath}`:"src/index"),t}function Ys(e,t){if(!e||typeof e!="object")return null;let r=t===""?".":`./${t}`;return en(e[r])}function en(e){if(typeof e=="string")return e;if(!e||typeof e!="object")return null;let t=e;for(let r of["types","import","default","require","node"]){let n=en(t[r]);if(n)return n}return null}function Qs(e){let t=e.replace(/^\.\//,"");return t.startsWith("dist/")?`src/${t.slice(5)}`:null}function Zs(e,t){let r=N(I(t));return Is.get(e,r,()=>eo(e,r))}function eo(e,t){let r=Rs();if(!r)return null;let n=y(e.config.projectRoot),i=y(n,t);for(;i===n||i.startsWith(n+Ps);){for(let o of _s){let a=F(i,o);if(!te(a))continue;let c=Ts.get(e,a,()=>to(r,a));if(c)return c}let s=I(i);if(s===i)break;i=s}return null}function to(e,t){try{let r=e.readConfigFile(t,e.sys.readFile);if(r.error||!r.config)return null;let n=e.parseJsonConfigFileContent(r.config,e.sys,I(t)),i=n.options.paths;return!i||Object.keys(i).length===0?null:{baseUrl:n.options.baseUrl?y(I(t),n.options.baseUrl):I(t),paths:i}}catch{return null}}function ye(e,t,r){let n=U(e),i;if(r.startsWith(".")){let s=r.match(/^(\.+)(.*)$/);if(!s)return null;let o=s[1].length,a=s[2].replace(/^\./,""),c=I(F(e.config.projectRoot,t));for(let l=1;l<o;l++)c=I(c);i=a?y(c,a.replace(/\./g,"/")):c}else i=y(e.config.projectRoot,r.replace(/\./g,"/"));for(let s of ro(i)){let o=N(Z(e.config.projectRoot,s));if(n.has(o)||te(s))return o}return null}function V(e,t,r){if(!r)return null;let n=r.replace(/\s+as\s+.+$/,"").trim();if(!n.startsWith("crate::")&&!n.startsWith("self::")&&!n.startsWith("super::"))return null;let i=I(F(e.config.projectRoot,t)),s;return n.startsWith("crate::")?s=y(e.config.projectRoot,"src",n.slice(7).replace(/::/g,"/")):n.startsWith("self::")?s=y(i,n.slice(6).replace(/::/g,"/")):s=y(I(i),n.slice(7).replace(/::/g,"/")),$t(e,no(s))}function et(e,t,r){let n=I(F(e.config.projectRoot,t)),i=y(n,r);return $t(e,io(i))}function tt(e,t,r){let n=I(F(e.config.projectRoot,t)),i=[y(n,r),y(e.config.projectRoot,r),y(e.config.projectRoot,"include",r),y(e.config.projectRoot,"src",r)];return $t(e,i)}function g(e,t,r){let n=U(e),i=t.replace(/\\/g,".").replace(/::/g,".").replace(/^global::/,""),s=i.replace(/\./g,"/"),o=i.split(".").pop()??i;for(let c of r){let l=`${s}${c}`,p=[...n].find(u=>u.endsWith(l));if(p)return p}for(let c of r){let l=[...n].find(p=>Gr(p)===`${o}${c}`);if(l)return l}let a=[...n].filter(c=>r.includes(W(c).toLowerCase())).filter(c=>c.includes(`/${s}/`)||c.includes(`/${o}/`)).sort((c,l)=>c.localeCompare(l));return a.length===1?a[0]:null}function rt(e,t,r){let n=U(e);if(r.startsWith("package:")){let o=r.slice(8),a=o.indexOf("/");if(a<0)return null;let c=o.slice(a+1),l=N(c.startsWith("lib/")?c:`lib/${c}`);return n.has(l)?l:null}let i=I(F(e.config.projectRoot,t)),s=y(i,r);for(let o of so(s)){let a=N(Z(e.config.projectRoot,o));if(n.has(a)||te(o))return a}return null}function Wt(e,t){let r=t.replace(/-/g,"_").replace(/\./g,"/"),n=U(e);for(let i of he){let s=`${r}${i}`,o=[...n].find(a=>a.endsWith(s));if(o)return o}for(let i of he){let s=[...n].find(o=>Gr(o)===`${r.split("/").pop()}${i}`);if(s)return s}return null}function ro(e){let t=W(e);return Dt.has(t)?[e]:[`${e}.py`,`${e}.pyi`,F(e,"__init__.py"),F(e,"__init__.pyi")]}function $t(e,t){let r=U(e);for(let n of t){let i=N(Z(e.config.projectRoot,n));if(r.has(i)||te(n))return i}return null}function no(e){let t=W(e);return jt.has(t)?[e]:[`${e}.rs`,F(e,"mod.rs")]}function io(e){let t=W(e);return Lt.has(t)?[e]:[`${e}.rb`,F(e,"index.rb")]}function so(e){let t=W(e);return Ot.has(t)?[e]:[`${e}.dart`,e]}function Vt(e){let t=W(e),r=new Set;if(t){r.add(e);for(let n of ee)r.add(e.slice(0,-t.length)+n)}else for(let n of ee)r.add(`${e}${n}`),r.add(F(e,`index${n}`));return[...r]}function U(e){return Ns.get(e,()=>new Set(lr(e,{includeIgnored:!1}).map(N)))}function Ut(e){return ks.get(e,()=>ze([...U(e)].sort().join(`
88
+ `)))}import{readFileSync as oo}from"fs";import{join as ao}from"path";var co=x("source-text",{clearGroups:["whole-project","source-file"]}),lo=x("source-lines",{clearGroups:["whole-project","source-file"]});function R(e,t){let r=t.replace(/\\/g,"/");return co.get(e,r,()=>{let n=ao(e.config.projectRoot,r);try{return oo(n,"utf-8")}catch(i){if(po(i))return"";throw i}})}function po(e){return typeof e=="object"&&e!==null&&"code"in e&&(e.code==="ENOENT"||e.code==="ENOTDIR")}function gp(e,t){let r=t.replace(/\\/g,"/");return lo.get(e,r,()=>{let n=R(e,r);return n?n.split(`
89
+ `):[]})}import{basename as In}from"path";function ne(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function uo(e){return e.replace(/'''[\s\S]*?'''/g,X).replace(/"""[\s\S]*?"""/g,X).replace(/#.*$/gm,X).replace(/\/\/.*$/gm,X).replace(/\/\*[\s\S]*?\*\//g,X).replace(/`(?:\\[\s\S]|[^`])*`/g,X).replace(/'(?:\\.|[^'\\\r\n])*'/g,X).replace(/"(?:\\.|[^"\\\r\n])*"/g,X)}function X(e){return e.replace(/[^\r\n]/g," ")}var vp=ue("stripped-lines",{clearGroups:["whole-project","source-file"]});ar({name:"stripped-source-singleton",groups:["whole-project","source-file"],clearAll:()=>{nt=null,we=""},clearFile:()=>{nt=null,we=""}});var nt=null,we="";function fo(e){return nt===e||(nt=e,we=uo(e)),we}function J(e,t,r){let n=fo(e);return`${n.slice(0,t)}${" ".repeat(r-t)}${n.slice(r)}`}function k(e,t){return new RegExp(`\\b${ne(t)}\\b`,"m").test(e)}function Se(e,t){let r=new Set,n=new RegExp(`\\b${ne(t)}\\s*\\.\\s*([A-Za-z_$][\\w$]*)`,"g");for(let i of e.matchAll(n)){let s=i[1];s&&r.add(s)}return[...r]}function Bt(e){let t=0;for(let r of e)r==="("&&(t+=1),r===")"&&(t-=1);return t}import{extname as tn}from"path";var mo={".rs":"rust",".ts":"typescript",".mts":"typescript",".cts":"typescript",".tsx":"tsx",".js":"javascript",".jsx":"javascript",".mjs":"javascript",".cjs":"javascript",".py":"python",".pyi":"python",".java":"java",".kt":"kotlin",".kts":"kotlin",".scala":"scala",".sc":"scala",".rb":"ruby",".c":"c",".h":"c",".cc":"cpp",".cpp":"cpp",".cxx":"cpp",".hpp":"cpp",".hh":"cpp",".hxx":"cpp",".cs":"csharp",".php":"php",".vb":"vb",".clj":"clojure",".cljs":"clojure",".cljc":"clojure"};function ie(e){return mo[tn(e).toLowerCase()]??null}function se(e){return tn(e).toLowerCase()===".vue"}import{createRequire as go}from"module";var b=go(import.meta.url),it=null,rn=!1;function ho(){if(rn)return null;if(it)return it;try{return it=b("tree-sitter"),it}catch{return rn=!0,null}}var nn=new Map,st=new Set;function yo(e){if(st.has(e))return null;let t=nn.get(e);if(t)return t;let r;try{switch(e){case"rust":r=b("tree-sitter-rust");break;case"typescript":r=b("tree-sitter-typescript").typescript;break;case"tsx":r=b("tree-sitter-typescript").tsx;break;case"javascript":r=b("tree-sitter-javascript");break;case"python":r=b("tree-sitter-python");break;case"java":r=b("tree-sitter-java");break;case"kotlin":r=b("tree-sitter-kotlin");break;case"scala":r=b("tree-sitter-scala");break;case"ruby":r=b("tree-sitter-ruby");break;case"c":r=b("tree-sitter-c");break;case"cpp":r=b("tree-sitter-cpp");break;case"csharp":r=b("tree-sitter-c-sharp");break;case"php":r=b("tree-sitter-php").php;break;case"vb":{let n=b("tree-sitter-vb-dotnet");r=n.language??n;break}case"clojure":return st.add(e),null}}catch{return st.add(e),null}return nn.set(e,r),r}var sn=new Map;function So(e){let t=sn.get(e);if(t)return t;let r=yo(e);if(!r)return null;let n=ho();if(!n)return null;let i=new n;try{i.setLanguage(r)}catch{return st.add(e),null}return sn.set(e,i),i}function xo(e,t){return e.parse(n=>n>=t.length?null:t.slice(n,Math.min(t.length,n+16384)))}function qt(e,t){let r=So(e);if(!r)return null;try{return xo(r,t)}catch{return null}}import{posix as Ht}from"path";import{parse as bo}from"@vue/compiler-sfc";var wp=cr("vue-sfc-units");function vo(e){return e.replace(/\\/g,"/").replace(/^\.\//,"")}function Eo(e){let t=e?.toLowerCase();return!t||t==="js"||t==="javascript"||t==="jsx"?"javascript":t==="ts"||t==="typescript"?"typescript":t==="tsx"?"tsx":null}function cn(e,t,r){let n={relativePath:t,template:null,scripts:[],styles:[],customBlocks:[],errors:[]};if(!r)return n;let i;try{i=bo(r,{filename:t})}catch(o){return n.errors.push(an(o)),n}n.errors.push(...i.errors.map(an));let{descriptor:s}=i;return s.template&&(n.template=ot(e,t,"template",s.template)),s.script&&n.scripts.push(on(e,t,s.script,!1)),s.scriptSetup&&n.scripts.push(on(e,t,s.scriptSetup,!0)),n.styles=s.styles.map(o=>ot(e,t,"style",o)),n.customBlocks=s.customBlocks.map(o=>ot(e,t,"custom",o)),n.errors.push(...[n.template,...n.scripts,...n.styles,...n.customBlocks].flatMap(o=>o?.errors??[])),n}function on(e,t,r,n){let i=ot(e,t,"script",r);return{...i,kind:"script",setup:n,astLanguage:Eo(i.lang)}}function ot(e,t,r,n){let i=No(n.attrs),s=typeof i.lang=="string"?i.lang:null,o=typeof i.src=="string"?i.src:typeof n.src=="string"?n.src:void 0;if(o){let c=Po(t,o);if(!c)return{kind:r,ownerPath:t,sourcePath:t,external:!0,src:o,attrs:i,lang:s,body:"",startLine:0,endLine:0,errors:[`Could not resolve Vue ${r} block source: ${o}`]};let l=R(e,c),p=l?Math.max(0,l.split(`
90
+ `).length-1):0;return{kind:r,ownerPath:t,sourcePath:c,external:!0,src:o,attrs:i,lang:s,body:l,startLine:0,endLine:p,errors:l?[]:[`Vue ${r} block source not found: ${c}`]}}let a=Math.max(0,n.loc.start.line-1);return{kind:r,ownerPath:t,sourcePath:t,external:!1,attrs:i,lang:s,body:n.content,startLine:a,endLine:Math.max(a,n.loc.end.line-1),errors:[]}}function Po(e,t){let r=t.split(/[?#]/,1)[0];if(!r||r.startsWith("/")||r.includes("://"))return null;let n=vo(Ht.normalize(Ht.join(Ht.dirname(e),r)));return n===".."||n.startsWith("../")?null:n}function No(e){return{...e}}function an(e){return e instanceof Error?e.message:String(e)}function at(e,t,r){let i=cn(e,t,r).scripts.filter(o=>o.astLanguage&&o.body.length>0),s=i[0]?.astLanguage;return s?{body:i.map(o=>`${`
91
+ `.repeat(o.startLine)}${o.body}`).join(`
92
+ `),startLine:0,language:s}:null}var ln=ue("ast-trees",{clearGroups:["whole-project","source-file"]});function M(e,t){if(se(t))return ko(e,t);let r=ie(t);if(!r)return null;let n=R(e,t);return n?ln.get(e,t,n,()=>qt(r,n)):null}function ko(e,t){let r=R(e,t);return r?ln.get(e,t,r,()=>{let n=at(e,t,r);if(!n)return null;let i=`
93
+ `.repeat(n.startLine)+n.body;return qt(n.language,i)}):null}function pn(e,t){let r=To(e,t);if(!r)return null;let n=oe(r);return n?{calleeLeaf:n,memberAccess:Io(r),line:e.startPosition.row}:null}function To(e,t){if(t==="rust")return e.type==="call_expression"?e.childForFieldName("function")??e.namedChild(0):e.type==="macro_invocation"?e.childForFieldName("macro")??e.namedChild(0):null;if(t==="python")return e.type!=="call"?null:e.childForFieldName("function")??e.namedChild(0);if(t==="typescript"||t==="tsx"||t==="javascript"){if(e.type==="call_expression")return e.childForFieldName("function")??e.namedChild(0);if(e.type==="new_expression")return e.childForFieldName("constructor")??e.namedChild(0)}return null}function Io(e){switch(e.type){case"field_expression":case"member_expression":case"attribute":return!0;default:return!1}}function oe(e){switch(e.type){case"identifier":case"type_identifier":case"field_identifier":case"property_identifier":case"shorthand_property_identifier":return e.text;case"field_expression":case"member_expression":case"attribute":{let t=e.namedChild(e.namedChildCount-1);return t?oe(t):null}case"generic_function":{let t=e.childForFieldName("function")??e.namedChild(0);return t?oe(t):null}case"scoped_identifier":{let t=e.childForFieldName("name")??e.namedChild(e.namedChildCount-1);return t?oe(t):null}case"super":case"self":case"this":return null;default:return null}}function Fe(e){return e.type==="comment"||e.type==="line_comment"||e.type==="block_comment"}var Co=new Set(["function_declaration","method_definition","method_signature","function_signature"]);function gn(e,t){let r=_o(e,t);if(r)return{name:r.name,startLine:r.definitionNode.startPosition.row,endLine:r.definitionNode.endPosition.row,paramCount:fn(r.functionNode),params:un(r.functionNode),paramsEndLine:dn(r.functionNode),isLiteralPassthrough:mn(r.functionNode,t)};if(!Ro(e.type,t))return null;let n=e.childForFieldName("name")??e.namedChildren.find(i=>i.type==="identifier"||i.type==="property_identifier");return n?{name:n.text,startLine:e.startPosition.row,endLine:e.endPosition.row,paramCount:fn(e),params:un(e),paramsEndLine:dn(e),isLiteralPassthrough:mn(e,t)}:null}function hn(e){return e.namedChildren.find(t=>t.type==="parameters"||t.type==="formal_parameters")}function un(e){let t=hn(e);if(!t)return[];let r=[];for(let n of t.namedChildren){if(Fe(n))continue;if(n.type==="identifier"){r.push({name:n.text,simple:!0});continue}let i=n.namedChildren.some(a=>a.type.endsWith("_modifier"))||/^\s*(?:public|private|protected|readonly|override)\b/.test(n.text),s=n.childForFieldName("pattern");if(!i&&s&&s.type==="identifier"){r.push({name:s.text,simple:!0});continue}let o=n.namedChildren.find(a=>a.type==="identifier");r.push({name:s?.type==="identifier"?s.text:o?.text??"",simple:!1})}return r}function dn(e){let t=hn(e);return t?t.endPosition.row:e.startPosition.row}function Ro(e,t){return t==="rust"?e==="function_item"||e==="function_signature_item":t==="python"?e==="function_definition":t==="typescript"||t==="tsx"||t==="javascript"?Co.has(e):!1}function _o(e,t){if(t!=="typescript"&&t!=="tsx"&&t!=="javascript")return null;if(e.type==="variable_declarator"){let r=e.childForFieldName("name")??e.namedChild(0),n=e.childForFieldName("value")??e.namedChild(1);return!r||!n||n.type!=="arrow_function"&&n.type!=="function_expression"?null:{name:r.text,definitionNode:e,functionNode:n}}if(e.type==="public_field_definition"){let r=e.childForFieldName("name")??e.namedChild(0),n=e.childForFieldName("value")??e.namedChild(1);return!r||!n||n.type!=="arrow_function"&&n.type!=="function_expression"?null:{name:r.text,definitionNode:e,functionNode:n}}return null}function fn(e){let t=e.namedChildren.find(n=>n.type==="parameters"||n.type==="formal_parameters");if(!t)return 0;let r=0;for(let n of t.namedChildren)Fe(n)||(r+=1);return r}function mn(e,t){let r=e.namedChildren.find(u=>u.type==="block"||u.type==="statement_block");if(!r)return!1;let n=r.namedChildren.filter(u=>!Fe(u));if(n.length!==1)return!1;let i=n[0],s=null;if(i.type==="return_statement"||i.type==="expression_statement"?s=i.namedChild(0)??null:t==="rust"&&(i.type==="call_expression"||i.type==="macro_invocation")&&(s=i),!s)return!1;let o=t==="python"?"call":"call_expression";if(s.type!==o)return!1;let a=s.namedChildren.find(u=>u.type==="arguments"||u.type==="argument_list");if(!a)return!1;let c=a.namedChildren.filter(u=>!Fe(u)),l=e.namedChildren.find(u=>u.type==="parameters"||u.type==="formal_parameters");if(!l)return!1;let p=[];for(let u of l.namedChildren){if(u.type==="identifier"){p.push(u.text);continue}let d=u.namedChildren.find(f=>f.type==="identifier");d&&p.push(d.text)}if(c.length!==p.length)return!1;for(let u=0;u<p.length;u+=1){let d=c[u];if(d.type!=="identifier"||d.text!==p[u])return!1}return!0}var wo=new Set(["identifier","type_identifier","field_identifier"]),Fo=new Set(["identifier"]),Ao=new Set(["identifier","property_identifier","type_identifier","shorthand_property_identifier","shorthand_property_identifier_pattern"]),Do=new Set(["rust","python"]),jo=/\{([^{}]*)\}/g,Lo=/\b([A-Za-z_][\w]*)\b/g;function yn(e,t){return Oo(t).has(e.type)}function Sn(e,t){return Do.has(t)&&e.type==="string_content"}function zt(e){let t=0;for(let n of e.values()){let i=n[n.length-1];i!==void 0&&i>t&&(t=i)}let r=new Array(t+1);for(let n=0;n<=t;n+=1)r[n]=new Set;for(let[n,i]of e)for(let s of i)r[s].add(n);return r}function Oo(e){return e==="rust"?wo:e==="python"?Fo:Ao}function xn(e,t){let r=e.startPosition.row;for(let n of e.text.matchAll(jo)){let i=n[1]??"";for(let s of i.matchAll(Lo))s[1]&&t(s[1],r)}}var Mo=[/\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],Wo=/^#!?\[\s*serde\s*\(/,$o=/^#!?\[\s*schemars\s*\(/,Vo=/^#!?\[\s*validate\s*\(/,Uo=new Set(["invoke","invokeTauriCommand","listen","once","emit","subscribe","dispatch","sendCommand","callRust"]);function bn(e,t,r){if(t!=="typescript"&&t!=="tsx"&&t!=="javascript"||e.type!=="call_expression")return;let n=e.childForFieldName("function")??e.namedChild(0);if(!n)return;let i=oe(n);if(!i||!Uo.has(i))return;let s=e.namedChildren.find(c=>c.type==="arguments");if(!s)return;let o=s.namedChild(0);if(!o||o.type!=="string")return;let a=o.namedChildren.find(c=>c.type==="string_fragment");a&&r.add(a.text)}function vn(e,t){let r=Wo.test(e),n=$o.test(e),i=Vo.test(e);if(!(!r&&!n&&!i))for(let s of Mo){s.lastIndex=0;let o;for(;(o=s.exec(e))!==null;){let a=o[1],c=a.split("::").pop()??a;c==="is_none"&&/\bOption\b/.test(a)||c==="is_empty"&&/\b(String|Vec|HashMap|BTreeMap|HashSet|BTreeSet)\b/.test(a)||c&&t.add(c)}}}function En(e,t){let r=new Map,n=(o,a)=>{if(o===a)return;let c=r.get(o);c||(c=new Set,r.set(o,c)),c.add(a)},i=t==="python"?new Set(["identifier"]):new Set(["type_identifier"]),s=(o,a)=>{let c=l=>{i.has(l.type)&&l.text!==a&&n(l.text,a);for(let p of l.children)c(p)};for(let l of o.children)c(l)};if(t==="rust")for(let o of e.rootNode.descendantsOfType(["struct_item","enum_item","union_item","type_item"])){let a=o.namedChildren.find(l=>l.type==="type_identifier")?.text;if(!a)continue;let c=o.namedChildren.find(l=>l.type==="field_declaration_list"||l.type==="enum_variant_list"||l.type==="ordered_field_declaration_list");c&&s(c,a),o.type==="type_item"&&s(o,a)}else if(t==="python")for(let o of e.rootNode.descendantsOfType("class_definition")){let a=o.namedChildren.find(p=>p.type==="identifier")?.text;if(!a)continue;let c=o.childForFieldName("superclasses");c&&s(c,a);let l=o.namedChildren.find(p=>p.type==="block");if(l)for(let p of l.descendantsOfType("type"))for(let u of p.descendantsOfType("identifier"))u.text!==a&&n(u.text,a)}else for(let o of e.rootNode.descendantsOfType(["interface_declaration","type_alias_declaration","class_declaration"])){let a=o.namedChildren.find(c=>c.type==="type_identifier")?.text;a&&s(o,a)}return r}var Bo=new Map([["defn","function"],["defn-","function"],["defmacro","macro"],["defmacro-","macro"],["defmethod","method"]]),Gt=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 Pn(e){let t=[],r=[],n=[],i=new Map,s=[],o=0,a=0,c=(l,p)=>{let u=i.get(l);if(!u){i.set(l,[p]);return}u[u.length-1]!==p&&u.push(p)};for(;a<e.length;){let l=e[a];if(l===`
94
+ `){o+=1,a+=1;continue}if(/\s|,/.test(l)){a+=1;continue}if(l===";"){a=lt(e,a);continue}if(l==='"'){let S=De(e,a,o);o=S.line,a=S.index;continue}if(l==="("||l==="["||l==="{"){s.push({kind:l,startLine:o,endLine:o,headTokens:[],tokens:[],children:[]}),a+=1;continue}if(l===")"||l==="]"||l==="}"){let S=s.pop();S&&(S.endLine=o,qo(S,{callables:t,callSites:r,clojureMembers:n,recordIdentifier:c}),s[s.length-1]?.children.push(S)),a+=1;continue}if(Kt(l)){a+=1;continue}let p=o,u=a;for(;a<e.length&&!Xt(e[a]);)a+=1;let d=e.slice(u,a);if(!d)continue;let f={text:d,line:p};Ho(s[s.length-1],f),c(A(d),p)}return{language:"clojure",callables:t,callSites:r,clojureMembers:n,typeContainerMap:new Map,identifierLineMap:i,identifiersByLine:Jo(i),fileIdentifiers:new Set(i.keys()),rustAttrReferencedNames:new Set,crossLanguageDispatchNames:new Set}}function qo(e,t){if(e.kind!=="("||e.headTokens.length===0)return;let r=e.headTokens[0],n=A(r.text),i=Bo.get(r.text);if(i){let o=e.headTokens[1];if(o){let a=A(o.text);t.recordIdentifier(a,o.line),t.callables.push({name:a,startLine:e.startLine,endLine:e.endLine,paramCount:0,params:[],paramsEndLine:o.line,isLiteralPassthrough:!1,clojureKind:i})}}if(zo(e,t),!n||Gt.has(r.text)||Gt.has(n)||n.startsWith(":"))return;let s=Xo(r.text);t.callSites.push({calleeLeaf:s.leaf,calleeQualifier:s.qualifier,calleeText:s.text,memberAccess:!1,line:r.line})}function Ho(e,t){e&&(e.headTokens.length<2&&e.headTokens.push(t),e.tokens.length<200&&e.tokens.push(t))}function zo(e,t){let r=A(e.tokens[0]?.text??"");if(r==="defprotocol"){let n=A(e.tokens[1]?.text??"");if(!n)return;for(let i of ct(e))Ae(t,n,"protocol",i,"protocol-method");return}if(r==="defrecord"||r==="deftype"){let n=A(e.tokens[1]?.text??"");if(!n)return;let i=r==="defrecord"?"record":"type",s=r==="defrecord"?"record-method":"type-method";for(let o of ct(e))Ae(t,n,i,o,s);return}if(r==="extend-type"){let n=A(e.tokens[1]?.text??"");if(!n)return;for(let i of ct(e))Ae(t,n,"extension",i,"extension-method");return}if(r==="extend-protocol"){let n=A(e.tokens[1]?.text??"");for(let i of ct(e)){n&&Ae(t,n,"extension",i,"extension-method");let s=Ko(e,i.startLine);s&&s!==n&&Ae(t,s,"extension",i,"extension-method")}}}function ct(e){return e.children.filter(Go)}function Go(e){if(e.kind!=="(")return!1;let t=A(e.tokens[0]?.text??"");return!!(t&&!Gt.has(t)&&!t.startsWith(":"))}function Ae(e,t,r,n,i){let s=n.tokens[0],o=A(s?.text??"");!s||!o||(e.recordIdentifier(o,s.line),e.clojureMembers.push({ownerName:t,ownerKind:r,memberName:o,memberKind:i,startLine:n.startLine,endLine:n.endLine}))}function Ko(e,t){let r=null;for(let n=2;n<e.tokens.length;n+=1){let i=e.tokens[n];if(i.line>t)break;let s=A(i.text);s&&!s.startsWith(":")&&(r=s)}return r}function A(e){return e.replace(/^#?['`~@]+/,"").split("/").pop()?.replace(/^\./,"")??""}function Xo(e){let t=e.replace(/^#?['`~@]+/,""),r=t.lastIndexOf("/"),n=A(t);if(r<=0)return{leaf:n,text:t};let i=t.slice(0,r);return{leaf:n,qualifier:i,text:t}}function lt(e,t){let r=t;for(;r<e.length&&e[r]!==`
95
+ `;)r+=1;return r}function De(e,t,r){let n=t+1,i=r;for(;n<e.length;){let s=e[n];if(s==="\\"){n+=2;continue}if(s===`
96
+ `&&(i+=1),n+=1,s==='"')break}return{index:n,line:i}}function Kt(e){return e==="'"||e==="`"||e==="~"||e==="@"||e==="^"||e==="#"}function Xt(e){return/\s|,/.test(e)||e==="("||e===")"||e==="["||e==="]"||e==="{"||e==="}"||e==='"'||e===";"}function Jo(e){let t=[];for(let[r,n]of e)for(let i of n)t[i]??=new Set,t[i].add(r);return t}var Nn=3,Yo=ue("source-facts",{clearGroups:["whole-project","source-file"]}),Jt=Ie({kind:"source-facts",invalidation:Ce("source-facts"),serialize:ta,deserialize:ra});function kn(e,t){return Qo(e,t).facts}function Qo(e,t){let r=R(e,t);if(!r)return{facts:null};let n=Zo(e,t,r);return n?Yo.get(e,t,r,()=>ea(e,t,n,r)):{facts:null}}function Zo(e,t,r){return se(t)?at(e,t,r)?.language??null:ie(t)}function ea(e,t,r,n){let i=Ne(e,t,n),s=Jt.read(e,t,i);if(s&&s.language===r)return{facts:s};if(r==="clojure"){let c=Pn(n);return Jt.write(e,t,i,c),{facts:c}}let o=M(e,t);if(!o)return{facts:null,unavailable:{language:r,reason:"parser-unavailable"}};let a=na(o,r);return Jt.write(e,t,i,a),{facts:a}}function ta(e){let t={version:Nn,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 ra(e){try{let t=JSON.parse(e);if(t.version!==Nn||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,i])=>[n,new Set(i)])),identifierLineMap:r,identifiersByLine:zt(r),fileIdentifiers:new Set(r.keys()),rustAttrReferencedNames:new Set(t.rustAttrReferencedNames),crossLanguageDispatchNames:new Set(t.crossLanguageDispatchNames)}}catch{return null}}function na(e,t){let r=[],n=[],i=new Set,s=new Set,o=new Map,a=(l,p)=>{let u=o.get(l);if(!u){o.set(l,[p]);return}u[u.length-1]!==p&&u.push(p)},c=l=>{let p=gn(l,t);p&&r.push(p);let u=pn(l,t);u&&n.push(u),bn(l,t,s),t==="rust"&&(l.type==="attribute_item"||l.type==="inner_attribute_item")&&vn(l.text,i),yn(l,t)&&a(l.text,l.startPosition.row),Sn(l,t)&&xn(l,a);for(let d of l.children)c(d)};return c(e.rootNode),{language:t,callables:r,callSites:n,clojureMembers:[],typeContainerMap:En(e,t),identifierLineMap:o,identifiersByLine:zt(o),fileIdentifiers:new Set(o.keys()),rustAttrReferencedNames:i,crossLanguageDispatchNames:s}}var ia=new Set(["rust","typescript","tsx","javascript","python","clojure"]);function sa(e,t){let r=kn(e,t);return!r||!ia.has(r.language)?null:r.callables.map(n=>({name:n.name,startLine:n.startLine,endLine:n.endLine}))}function Tn(e,t){return e.split(t).filter(Boolean).map(r=>r.charAt(0).toUpperCase()+r.slice(1)).join("")}var oa=new Set(["identifier","type_identifier","property_identifier","shorthand_property_identifier","field_identifier"]);function T(e){let t=[],r=0,n=0;for(let i=0;i<e.length;i++){let s=e[i];(s==="{"||s==="["||s==="(")&&r++,(s==="}"||s==="]"||s===")")&&r--,s===","&&r===0&&(t.push(e.slice(n,i)),n=i+1)}return t.push(e.slice(n)),t}function _(e,t){for(let r of e.namedChildren)if(r.type===t)return r;return null}function h(e,t){let r=new Set,n=(i,s)=>{let o=s||t.has(i.type);!o&&oa.has(i.type)&&r.add(i.text);for(let a of i.children)n(a,o)};return n(e.rootNode,!1),r}function O(e,t,r,n,i,s,o){return{importedName:i,localName:s,sourcePath:o??g(e,n,Mt(t)),kind:"named",used:k(r,s),usedMembers:[]}}function m(e,t,r,n,i="named",s={}){return{importedName:e,localName:t,sourcePath:r,kind:i,used:n.has(t),usedMembers:[],isTypeOnly:s.isTypeOnly}}function B(e,t,r,n,i="named",s=[],o={}){return{importedName:e,localName:t,sourcePath:r,kind:i,used:n,usedMembers:s,isTypeOnly:o.isTypeOnly}}function ae(e,t){return{importedName:e,localName:null,sourcePath:t,kind:"side-effect",used:!0,usedMembers:[]}}function ce(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 D(e,t,r){let n=[];for(let i of e.matchAll(t)){let s=i[0];if(!s||typeof i.index!="number")continue;let o=J(e,i.index,i.index+s.length);for(let a of r(i,o))n.push(a)}return n}function j(e,t,r,n){let i=M(e,t);if(i){let s=r(i);if(s)return s}return n()}function pt(e,t,r,n){let i=M(e,t),s=ie(t),o=s?r[s]:void 0;return i&&o?o(i):n()}function Cn(e,t,r){return j(e,t,n=>ca(e,t,n),()=>aa(e,t,r))}function aa(e,t,r){return D(r,/^[ \t]*#include\s+[<"]([^">]+)[">]\s*$/gm,(n,i)=>{let s=n[1]?.trim();if(!s)return[];let o=In(s).replace(/\.[^.]+$/,"");return[B(s,o,tt(e,t,s),k(i,o))]})}function ca(e,t,r){let n=h(r,new Set(["preproc_include"])),i=[];for(let s of r.rootNode.descendantsOfType("preproc_include")){let o=null;for(let c of s.namedChildren){if(c.type==="system_lib_string"){o=c.text.replace(/^<|>$/g,"");break}if(c.type==="string_literal"){o=c.namedChildren.find(p=>p.type==="string_content")?.text??c.text.replace(/^"|"$/g,"");break}}if(!o)continue;let a=In(o).replace(/\.[^.]+$/,"");i.push(m(o,a,tt(e,t,o),n))}return i}var la=new Set([":require",":require-macros",":use"]),Zt=String.raw`A-Za-z0-9_$*+!?.<>=-`;function _n(e,t,r){let n=ba(r);if(!n)return[];let i=xa(r,n.start,n.end),s=[];for(let o of n.children.slice(2)){if(o.type!=="list"||o.children.length===0)continue;let a=L(o.children[0]);if(a){if(la.has(a)){for(let c of da(o.children.slice(1)))s.push(...ua(e,c,i));continue}if(a===":import")for(let c of ma(o.children.slice(1)))s.push(c)}}return s}function pa(e){return e.type==="list"&&L(e.children[0])==="ns"}function ua(e,t,r){let n=Wt(e,t.namespace),i=t.alias??t.namespace,s=ha(r,i),o=[{importedName:t.namespace,localName:i,sourcePath:n,kind:"namespace",used:t.refers.length>0||t.referAll||s.length>0||ya(r,t.namespace),usedMembers:s}];t.referAll&&o.push({importedName:"*",localName:null,sourcePath:n,kind:"side-effect",used:!0,usedMembers:[]});for(let a of t.refers)o.push({importedName:a,localName:a,sourcePath:n,kind:"named",used:Sa(r,a),usedMembers:[]});return o}function da(e){return e.flatMap(t=>ut(t,null))}function ut(e,t){if(e.type==="atom")return e.text.startsWith(":")?[]:[{namespace:Qt(t,e.text),alias:null,refers:[],referAll:!1}];if(e.type==="vector")return e.children.length>0&&L(e.children[0])===null?e.children.flatMap(r=>ut(r,t)):fa(e,t);if(e.type==="list"&&e.children.length>0){let r=L(e.children[0]);return r?!r||r.startsWith(":")?[]:e.children.slice(1).flatMap(n=>ut(n,Qt(t,r))):e.children.flatMap(n=>ut(n,t))}return[]}function fa(e,t){let r=L(e.children[0]);if(!r||r.startsWith(":"))return[];let n={namespace:Qt(t,r),alias:null,refers:[],referAll:!1};for(let i=1;i<e.children.length;i+=1){let s=L(e.children[i]);if(!s?.startsWith(":"))continue;let o=e.children[i+1];if((s===":as"||s===":as-alias")&&o){n.alias=L(o),i+=1;continue}s===":refer"&&o&&(L(o)===":all"?n.referAll=!0:(o.type==="vector"||o.type==="list")&&n.refers.push(...o.children.map(L).filter(ga)),i+=1)}return[n]}function ma(e){let t=[];for(let r of e){if(r.type==="atom"){let i=r.text.split(".").pop()??r.text;t.push(B(i,i,null,!0));continue}if(r.type!=="vector")continue;let n=L(r.children[0]);if(n)for(let i of r.children.slice(1)){let s=L(i);s&&t.push(B(`${n}.${s}`,s,null,!0))}}return t}function Qt(e,t){return e?`${e}.${t}`:t}function L(e){return e?.type==="atom"?e.text:null}function ga(e){return!!(e&&!e.startsWith(":"))}function ha(e,t){let r=new Set,n=new RegExp(`${er()}${ne(t)}\\s*/\\s*([${Zt}]+)`,"g");for(let i of e.matchAll(n)){let s=i[1];s&&r.add(s)}return[...r]}function ya(e,t){return new RegExp(`${er()}${ne(t)}\\s*/`,"m").test(e)}function Sa(e,t){return new RegExp(`${er()}${ne(t)}(?![${Zt}])`,"m").test(e)}function er(){return`(?<![${Zt}])`}function xa(e,t,r){let n="",i=0;for(;i<e.length;){if(i>=t&&i<r){n+=e[i]===`
97
+ `?`
98
+ `:" ",i+=1;continue}let s=e[i];if(s===";"){let o=lt(e,i);n+=Rn(e.slice(i,o)),i=o;continue}if(s==='"'){let o=De(e,i,0).index;n+=Rn(e.slice(i,o)),i=o;continue}n+=s,i+=1}return n}function ba(e){let t=0;for(;t<e.length&&(t=tr(e,t),!(t>=e.length));){let r=dt(e,t);if(!r){t+=1;continue}if(pa(r.form))return r.form;t=r.index}return null}function dt(e,t){let r=tr(e,t);if(e.startsWith("#?@",r)||e.startsWith("#?",r))return va(e,r);if(e.startsWith("#_",r)){let i=dt(e,r+2);return i?{form:{type:"atom",text:"",start:r,end:i.index},index:i.index}:null}for(;Kt(e[r]);)r+=1;let n=e[r];return n?n==="("?Yt(e,r,"list",")"):n==="["?Yt(e,r,"vector","]"):n==="{"?Yt(e,r,"map","}"):n==='"'?{form:{type:"atom",text:"",start:r,end:De(e,r,0).index},index:De(e,r,0).index}:Pa(e,r):null}function va(e,t){let r=e.startsWith("#?@",t)?3:2,n=dt(e,t+r);return n?{form:{type:"list",children:n.form.type==="list"||n.form.type==="vector"||n.form.type==="map"?Ea(n.form.children):[],start:t,end:n.index},index:n.index}:null}function Ea(e){let t=[];for(let r=0;r<e.length;r+=2){let n=L(e[r]),i=e[r+1];n?.startsWith(":")&&i&&t.push(i)}return t}function Yt(e,t,r,n){let i=[],s=t+1;for(;s<e.length;){if(s=tr(e,s),e[s]===n)return{form:{type:r,children:i,start:t,end:s+1},index:s+1};let o=dt(e,s);if(!o){s+=1;continue}o.form.type==="atom"&&o.form.text===""||i.push(o.form),s=o.index}return{form:{type:r,children:i,start:t,end:e.length},index:e.length}}function Pa(e,t){let r=t;for(;r<e.length&&!Xt(e[r]);)r+=1;return{form:{type:"atom",text:e.slice(t,r),start:t,end:r},index:r}}function tr(e,t){let r=t;for(;r<e.length;){let n=e[r];if(/\s|,/.test(n)){r+=1;continue}if(n===";"){r=lt(e,r);continue}break}return r}function Rn(e){return e.replace(/[^\r\n]/g," ")}function wn(e,t,r){let n=[];for(let i of r.matchAll(/^[ \t]*import\s+['"]([^'"]+)['"](?:\s+as\s+([A-Za-z_]\w*))?[\s\S]*?;$/gm)){let s=i[1]?.trim(),o=i[2]?.trim()??null,a=i[0];if(!s||!a||typeof i.index!="number")continue;let c=J(r,i.index,i.index+a.length);n.push({importedName:s,localName:o,sourcePath:rt(e,t,s),kind:o?"namespace":"side-effect",used:o?k(c,o):!0,usedMembers:o?Se(c,o):[]})}return n}function Fn(e,t,r){let n=[];for(let i of r.matchAll(/^[ \t]*export\s+['"]([^'"]+)['"][\s\S]*?;$/gm)){let s=i[1]?.trim();s&&n.push({specifier:s,sourcePath:rt(e,t,s)})}return n}function An(e,t,r){return pt(e,t,{csharp:n=>ka(e,t,n),vb:n=>Na(e,t,n)},()=>{let n=Zr(t)?/^[ \t]*Imports\s+(.+?)\s*$/gm:/^[ \t]*using\s+(.+?)\s*;$/gm;return D(r,n,(i,s)=>{let o=i[1]?.trim();if(!o)return[];let[a,c]=o.split(/\s*=\s*/),l=!!c,p=(l?c:a)?.trim()??o,u=p.split(".").pop()??p,d=l?a?.trim()??u:u;return[O(e,t,s,p,u,d,g(e,p,G))]})})}function Na(e,t,r){let n=h(r,new Set(["imports_statement"])),i=[];for(let s of r.rootNode.descendantsOfType("imports_statement")){let o=s.namedChildren.filter(d=>d.type==="namespace_name");if(o.length===0)continue;let a=o[o.length-1],c=o.length>1?o[0]:null,l=a.text,p=l.split(".").pop()??l,u=c?.text??p;i.push(m(p,u,g(e,l,G),n,c?"namespace":"named"))}return i}function ka(e,t,r){let n=h(r,new Set(["using_directive"])),i=[];for(let s of r.rootNode.descendantsOfType("using_directive")){let o=s.namedChildren;if(o.length===0)continue;let a=null,c;o.length>=2&&o[0].type==="identifier"&&(o[1].type==="qualified_name"||o[1].type==="identifier")?(a=o[0],c=o[1]):c=o[o.length-1];let l=c.text,p=l.split(".").pop()??l,u=a?.text??p;i.push(m(p,u,g(e,l,G),n,a?"namespace":"named"))}return i}var Ta=x("vue-non-script-identifiers",{clearGroups:["whole-project","source-file"]});function Dn(e,t){return Ta.get(e,t,()=>{let r=new Set,n=R(e,t);if(!n)return r;let s=n.replace(/<script\b[^>]*>[\s\S]*?<\/script>/g,o=>o.replace(/[^\r\n]/g," ")).replace(/<!--[\s\S]*?-->/g,o=>o.replace(/[^\r\n]/g," ")).replace(/\/\*[\s\S]*?\*\//g,o=>o.replace(/[^\r\n]/g," "));for(let o of s.matchAll(/[A-Za-z_$][\w$]*/g))r.add(o[0]);return r})}function rr(e,t,r){return j(e,t,n=>Ca(e,t,n),()=>Ia(e,t,r))}function Ia(e,t,r){return Wa(r).flatMap(n=>$a(e,t,n.clause,n.specifier,n.start,n.end,r))}function Ca(e,t,r){let n=Ra(e,t,r),i=[];for(let s of r.rootNode.descendantsOfType("import_statement"))i.push(..._a(e,t,r,s,n));return i}function Ra(e,t,r){let n=h(r,new Set(["import_statement"]));if(se(t))for(let i of Dn(e,t))n.add(i);return n}function _a(e,t,r,n,i){let s=ja(n);if(!s)return[];let o=K(e,t,s),a=_(n,"import_clause");return a?wa(r,a,o,i,La(n.text)):[ae("*",o)]}function wa(e,t,r,n,i){let s=[];for(let o of t.namedChildren)if(o.type==="identifier")s.push(Fa(o.text,r,n,i));else if(o.type==="namespace_import"){let a=Aa(e,o,r,n,i);a&&s.push(a)}else o.type==="named_imports"&&s.push(...Da(o,r,n,i));return s}function Fa(e,t,r,n){return m("default",e,t,r,"default",{isTypeOnly:n})}function Aa(e,t,r,n,i){let o=_(t,"identifier")?.text??"";if(!o)return null;let a=Ma(e,o);return ce("*",r,{localName:o,usedMembers:a,isTypeOnly:i,used:a.length>0||n.has(o)})}function Da(e,t,r,n){let i=[];for(let s of e.namedChildren){if(s.type!=="import_specifier")continue;let o=s.namedChild(0),a=s.namedChild(1);if(!o)continue;let c=o.text,l=a?.text??c;i.push(m(c,l,t,r,"named",{isTypeOnly:n||Oa(s.text)}))}return i}function ja(e){let t=_(e,"string");if(!t)return null;let r=_(t,"string_fragment");return r?r.text:null}function La(e){return/^\s*import\s+type\b/.test(e)}function Oa(e){return/^\s*type\b/.test(e.trim())}function Ma(e,t){let r=new Set;for(let n of e.rootNode.descendantsOfType("member_expression")){let i=n.namedChild(0),s=n.namedChild(1);!i||!s||i.type!=="identifier"||i.text!==t||(s.type==="property_identifier"||s.type==="identifier")&&r.add(s.text)}return[...r]}function Wa(e){let t=[],r=/^[ \t]*import\s+([\s\S]*?)\s+from\s+['"]([^'"]+)['"]\s*;?/gm;for(let i of e.matchAll(r)){let s=i[0],o=i[1],a=i[2];!s||!a||typeof i.index!="number"||t.push({clause:o,specifier:a,start:i.index,end:i.index+s.length})}let n=/^[ \t]*import\s+['"]([^'"]+)['"]\s*;?/gm;for(let i of e.matchAll(n)){let s=i[0],o=i[1];!s||!o||typeof i.index!="number"||t.push({clause:null,specifier:o,start:i.index,end:i.index+s.length})}return t.sort((i,s)=>i.start-s.start)}function $a(e,t,r,n,i,s,o){let a=K(e,t,n),c=J(o,i,s);return r?Va(r).map(p=>({...p,sourcePath:a})).map(p=>{if(p.kind==="namespace"){let u=Se(c,p.localName);return ce(p.importedName,p.sourcePath,{localName:p.localName,usedMembers:u,used:u.length>0||k(c,p.localName),isTypeOnly:p.isTypeOnly})}return p.kind==="side-effect"?ae(p.importedName,p.sourcePath):B(p.importedName,p.localName??"",p.sourcePath,p.localName?k(c,p.localName):!1,p.kind,[],{isTypeOnly:p.isTypeOnly})}):[ae("*",a)]}function Va(e){let t=e.trim(),r=/^type\b/.test(t),n=t.replace(/^type\s+/,""),[i,s]=Ua(n),o=[];return i&&o.push(...jn(i,r)),s&&o.push(...jn(s,r)),o}function jn(e,t){let r=e.trim();if(!r)return[];if(r.startsWith("{")){let n=r.slice(1,-1).trim();return n?T(n).map(i=>{let s=i.trim(),o=t||/^type\b/.test(s),a=s.replace(/^type\s+/,""),[c,l]=a.split(/\s+as\s+/);return{importedName:c.trim(),localName:(l??c).trim(),kind:"named",isTypeOnly:o}}):[]}return r.startsWith("* as ")?[{importedName:"*",localName:r.slice(5).trim(),kind:"namespace",isTypeOnly:t}]:[{importedName:"default",localName:r,kind:"default",isTypeOnly:t}]}function Ua(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 nr(e,t,r){let n=M(e,t);return n?Ka(e,t,n):Ba(e,t,r)}function Ba(e,t,r){return[...qa(e,t,r),...Ha(e,t,r),...za(e,t,r)]}function qa(e,t,r){let n=[],i=/^[ \t]*export\s+(?:type\s+)?\{([\s\S]*?)\}\s+from\s+['"]([^'"]+)['"]\s*;?/gm;for(let s of r.matchAll(i)){if(typeof s.index!="number")continue;let o=s[1]??"",a=s[2]??"",c=T(o).map(u=>Ga(u.trim())).filter(u=>!!u),l=xe(r,s.index),p=xe(r,s.index+s[0].length-1);n.push({kind:"named",sourcePath:K(e,t,a),names:c,startLine:l,endLine:p})}return n}function Ha(e,t,r){let n=[],i=/^[ \t]*export\s+\*\s+as\s+(\w+)\s+from\s+['"]([^'"]+)['"]\s*;?/gm;for(let s of r.matchAll(i)){if(typeof s.index!="number")continue;let o=s[2]??"",a=xe(r,s.index),c=xe(r,s.index+s[0].length-1);n.push({kind:"star-as",sourcePath:K(e,t,o),names:[],startLine:a,endLine:c})}return n}function za(e,t,r){let n=[],i=/^[ \t]*export\s+\*\s+from\s+['"]([^'"]+)['"]\s*;?/gm;for(let s of r.matchAll(i)){if(typeof s.index!="number")continue;let o=s[1]??"",a=xe(r,s.index),c=xe(r,s.index+s[0].length-1);n.push({kind:"star",sourcePath:K(e,t,o),names:[],startLine:a,endLine:c})}return n}function Ga(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 xe(e,t){let r=0;for(let n=0;n<t&&n<e.length;n++)e.charCodeAt(n)===10&&r++;return r}function Ka(e,t,r){let n=[];for(let i of r.rootNode.descendantsOfType("export_statement")){let s=Xa(e,t,i);if(s===void 0)continue;let o=i.startPosition.row,a=i.endPosition.row,c=Ja(i,s,o,a);n.push(c)}return n}function Xa(e,t,r){let n=_(r,"string");if(!n)return;let i=_(n,"string_fragment");if(i)return K(e,t,i.text)}function Ja(e,t,r,n){let i=_(e,"export_clause");if(i){let o=[];for(let a of i.namedChildren){if(a.type!=="export_specifier")continue;let c=a.namedChild(0),l=a.namedChild(1);c&&o.push((l??c).text)}return{kind:"named",sourcePath:t,names:o,startLine:r,endLine:n}}return _(e,"namespace_export")?{kind:"star-as",sourcePath:t,names:[],startLine:r,endLine:n}:{kind:"star",sourcePath:t,names:[],startLine:r,endLine:n}}function Ln(e,t,r){return pt(e,t,{java:n=>Ya(e,t,n),kotlin:n=>Qa(e,t,n),scala:n=>Za(e,t,n)},()=>D(r,/^[ \t]*import\s+(?:static\s+)?(.+?)\s*;?$/gm,(n,i)=>{let s=n[1]?.trim();return s?ec(e,t,s,i):[]}))}function Ya(e,t,r){let n=h(r,new Set(["import_declaration"])),i=[];for(let s of r.rootNode.descendantsOfType("import_declaration")){let o=s.children.some(u=>u.type==="asterisk"),c=s.namedChildren.find(u=>u.type==="scoped_identifier")??s.namedChildren.find(u=>u.type==="identifier");if(!c)continue;let l=c.text;if(o){i.push(ce("*",g(e,l,C)));continue}let p=l.split(".").pop()??l;i.push(m(p,p,g(e,l,C),n))}return i}function Qa(e,t,r){let n=h(r,new Set(["import_header","import_list"])),i=[];for(let s of r.rootNode.descendantsOfType("import_header")){let o=s.namedChildren.find(f=>f.type==="identifier");if(!o)continue;let a=s.namedChildren.some(f=>f.type==="wildcard_import"),c=s.namedChildren.find(f=>f.type==="import_alias");if(a){i.push(ce("*",g(e,o.text,C)));continue}let l=o.text,p=l.split(".").pop()??l,d=c?.namedChild(0)?.text??p;i.push(m(p,d,g(e,l,C),n))}return i}function Za(e,t,r){let n=h(r,new Set(["import_declaration"])),i=[];for(let s of r.rootNode.descendantsOfType("import_declaration")){let o=s.namedChildren.find(u=>u.type==="namespace_selectors"||u.type==="namespace_wildcard"),a=s.namedChildren.filter(u=>u!==o&&(u.type==="identifier"||u.type==="stable_identifier")),c=a.map(u=>u.text).join(".");if(!c)continue;if(o?.type==="namespace_wildcard"){i.push(ce("*",g(e,c,C)));continue}if(o?.type==="namespace_selectors"){for(let u of o.namedChildren)if(u.type==="arrow_renamed_identifier"){let[d,f]=u.namedChildren;if(!d)continue;let S=d.text,le=f?.text??S;if(S==="_")continue;i.push(m(S,le,g(e,`${c}.${S}`,C),n))}else if(u.type==="identifier"){let d=u.text;i.push(m(d,d,g(e,`${c}.${d}`,C),n))}continue}let l=a[a.length-1]?.text??c,p=a.slice(0,-1).map(u=>u.text).join(".")||c;i.push(m(l,l,g(e,p&&a.length>1?`${p}.${l}`:c,C),n))}return i}function ec(e,t,r,n){if(r.includes("{")&&r.includes("}")){let i=r.slice(0,r.indexOf("{")).replace(/\.$/,"").trim(),s=r.slice(r.indexOf("{")+1,r.lastIndexOf("}")).trim();return T(s).flatMap(o=>{let a=o.trim();if(!a)return[];let[c,l]=a.includes("=>")?a.split(/\s*=>\s*/):a.split(/\s+as\s+/),p=c?.trim();if(!p||p==="_")return[];let u=(l??p.split(".").pop()??p).trim(),d=p==="_"?i:`${i}.${p}`.replace(/\.\./g,".");return[O(e,t,n,d,p,u)]})}return[O(e,t,n,r,r.split(".").pop()??r,r.split(".").pop()??r)]}function Mn(e,t,r){return j(e,t,n=>tc(e,t,n),()=>D(r,/^[ \t]*use\s+(.+?)\s*;$/gm,(n,i)=>{let s=n[1]?.trim();return s?T(s).flatMap(o=>{let a=o.trim();if(!a)return[];let[c,l]=a.split(/\s+as\s+/i),p=c?.trim()??a,u=p.split("\\").pop()??p,d=(l??u).trim();return[O(e,t,i,p,u,d,g(e,p.replace(/\\/g,"."),re))]}):[]}))}function tc(e,t,r){let n=h(r,new Set(["namespace_use_declaration"])),i=[],s=(o,a,c)=>{i.push(m(a,c,g(e,o.replace(/\\/g,"."),re),n))};for(let o of r.rootNode.descendantsOfType("namespace_use_declaration")){let a=o.namedChildren.find(c=>c.type==="namespace_use_group");if(a){let c=o.namedChildren.find(l=>l.type==="namespace_name")?.text??"";for(let l of a.namedChildren){if(l.type!=="namespace_use_clause")continue;let{importedName:p,localName:u,qualified:d}=On(l,c);p&&s(d,p,u)}continue}for(let c of o.namedChildren){if(c.type!=="namespace_use_clause")continue;let{importedName:l,localName:p,qualified:u}=On(c,"");l&&s(u,l,p)}}return i}function On(e,t){let r=e.namedChildren.find(l=>l.type==="qualified_name"),n=e.namedChildren.filter(l=>l.type==="name"),i="";r?i=r.text:n.length>=1&&(i=n[0].text);let s=r&&n.length>0?n[n.length-1]:null,o=i.split("\\").pop()??i,a=s?.text??o,c=t?`${t}\\${i}`:i;return{importedName:o,localName:a,qualified:c}}function $n(e,t,r){return j(e,t,n=>rc(e,t,n),()=>ic(r).flatMap(n=>oc(e,t,n,r)))}function rc(e,t,r){let n=h(r,new Set(["import_statement","import_from_statement"])),i=[];for(let s of r.rootNode.descendantsOfType("import_statement"))for(let o of s.namedChildren){let a=Wn(o);if(!a)continue;let c=ye(e,t,a.qualifiedName);i.push({importedName:a.qualifiedName,localName:a.localName,sourcePath:c,kind:"namespace",used:n.has(a.localName),usedMembers:[]})}for(let s of r.rootNode.descendantsOfType("import_from_statement")){let o=s.namedChild(0);if(!o)continue;let a=nc(o);if(a===null)continue;let c=ye(e,t,a);for(let l=1;l<s.namedChildCount;l+=1){let p=s.namedChild(l);if(p.type==="wildcard_import"){i.push({importedName:"*",localName:null,sourcePath:c,kind:"side-effect",used:!0,usedMembers:[]});continue}let u=Wn(p);u&&i.push({importedName:u.qualifiedName,localName:u.localName,sourcePath:c,kind:"named",used:n.has(u.localName),usedMembers:[]})}}return i}function Wn(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 nc(e){if(e.type==="dotted_name")return e.text;if(e.type==="relative_import"){let t=_(e,"import_prefix")?.text??"",r=_(e,"dotted_name")?.text??"";return`${t}${r}`}return null}function ic(e){let t=e.split(`
99
+ `),r=[],n=0;for(let i=0;i<t.length;i++){let s=t[i],o=s.trimStart(),a=n;if(n+=s.length+1,!o.startsWith("import ")&&!o.startsWith("from "))continue;let c=s,l=a+s.length,p=Bt(s);for(;i+1<t.length&&(p>0||c.trimEnd().endsWith("\\"));){i++;let d=t[i];c+=`
100
+ ${d}`,l+=1+d.length,p+=Bt(d),n+=d.length+1}let u=sc(c);u&&r.push({...u,start:a,end:l})}return r}function sc(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 oc(e,t,r,n){let i=J(n,r.start,r.end),s=r.clause.replace(/\n/g," ").trim();if(r.kind==="import")return T(s).flatMap(c=>{let l=c.trim().replace(/,$/,"");if(!l)return[];let[p,u]=l.split(/\s+as\s+/),d=p.trim(),f=(u??d.split(".")[0]??d).trim(),S=ye(e,t,d),le=Se(i,f);return[{importedName:d,localName:f,sourcePath:S,kind:"namespace",used:k(i,f)||le.length>0,usedMembers:le}]});let o=r.module?ye(e,t,r.module):null,a=[];for(let c of T(s)){let l=c.trim().replace(/,$/,"");if(!l)continue;if(l==="*"){a.push({importedName:"*",localName:null,sourcePath:o,kind:"side-effect",used:!0,usedMembers:[]});continue}let[p,u]=l.split(/\s+as\s+/),d=(u??p).trim();a.push({importedName:p.trim(),localName:d,sourcePath:o,kind:"named",used:k(i,d),usedMembers:[]})}return a}import{basename as ac}from"path";function Vn(e,t,r){return j(e,t,n=>lc(e,t,n),()=>cc(e,t,r))}function cc(e,t,r){return D(r,/^[ \t]*(require_relative|require)\s+["']([^"']+)["']\s*$/gm,(n,i)=>{let s=n[1],o=n[2];if(!s||!o)return[];let a=s==="require_relative"?et(e,t,o):null;if(a){let c=Un(o);return[B(c,c,a,k(i,c))]}return[ae(o,a)]})}function lc(e,t,r){let n=h(r,new Set([])),i=[],s=new Set(["require","require_relative","load"]);for(let o of r.rootNode.descendantsOfType("call")){let a=o.namedChild(0);if(!a||a.type!=="identifier"||!s.has(a.text))continue;let l=o.namedChildren.find(f=>f.type==="argument_list")?.namedChild(0);if(!l||l.type!=="string")continue;let u=l.namedChildren.find(f=>f.type==="string_content")?.text;if(!u)continue;let d=a.text==="require_relative"?et(e,t,u):null;if(d){let f=Un(u);i.push(m(f,f,d,n))}else i.push(ae(u,d))}return i}function Un(e){return Tn(ac(e).replace(/\.[^.]+$/,""),/_/)}function Bn(e,t,r){return j(e,t,n=>pc(e,t,n),()=>D(r,/^[ \t]*use\s+(.+?)\s*;$/gm,(n,i)=>{let s=n[1]?.trim();return s?uc(e,t,s,i):[]}))}function pc(e,t,r){let n=h(r,new Set(["use_declaration"])),i=[];for(let s of r.rootNode.descendantsOfType("use_declaration")){let o=s.namedChild(0);if(o)for(let a of je(o,"")){if(!a.importedName||a.importedName==="*")continue;let c=V(e,t,a.qualifiedName)??V(e,t,a.qualifiedName.split("::").slice(0,-1).join("::"));i.push(m(a.importedName,a.localName,c,n))}}return i}function je(e,t){switch(e.type){case"identifier":case"super":case"crate":{let r=e.text;return[{qualifiedName:ft(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:ft(t,r),importedName:n,localName:n}]}case"scoped_use_list":{let r=e.namedChild(0),n=e.namedChild(1);if(!r||!n)return[];let i=ft(t,r.text),s=[];for(let o of n.namedChildren)s.push(...je(o,i));return s}case"use_list":{let r=[];for(let n of e.namedChildren)r.push(...je(n,t));return r}case"use_as_clause":{let r=e.namedChild(0),n=e.namedChild(1);if(!r||!n)return[];let i=je(r,t),s=n.text;return i.map(o=>({...o,localName:s}))}case"use_wildcard":{let r=e.namedChild(0),n=r?r.text:"";return[{qualifiedName:ft(t,`${n}::*`),importedName:"*",localName:"*"}]}default:return[]}}function ft(e,t){return e?t?`${e}::${t}`:e:t}function uc(e,t,r,n){let i=r.trim();if(i.includes("{")&&i.includes("}")){let p=i.slice(0,i.indexOf("{")).replace(/::$/,"").trim(),u=i.slice(i.indexOf("{")+1,i.lastIndexOf("}")).trim();return T(u).flatMap(d=>{let f=d.trim();if(!f)return[];if(f==="self"){let mt=p.split("::").filter(Boolean).pop();return mt?[O(e,t,n,p,mt,mt)]:[]}let[S,le]=f.split(/\s+as\s+/),pe=S?.trim();if(!pe)return[];let Kn=(le??pe.split("::").pop()??pe).trim(),Xn=`${p}::${pe}`.replace(/::::/g,"::");return[O(e,t,n,Xn,pe.split("::").pop()??pe,Kn,V(e,t,p))]})}let[s,o]=i.split(/\s+as\s+/),a=s?.trim()??i,c=(o??a.split("::").pop()??a).trim(),l=V(e,t,a)??V(e,t,a.split("::").slice(0,-1).join("::"));return[O(e,t,n,a,a.split("::").pop()??a,c,l)]}function qn(e,t,r){let n=M(e,t);if(n)return dc(e,t,n);let i=[];for(let s of r.matchAll(/^[ \t]*pub\s+use\s+(.+?)\s*;$/gm)){let o=s[1]?.trim();o&&i.push(...mc(e,t,o))}return i}function dc(e,t,r){let n=[];for(let i of r.rootNode.descendantsOfType("use_declaration")){if(!fc(i))continue;let s=i.namedChildren.find(o=>o.type!=="visibility_modifier");if(s)for(let o of je(s,""))o.importedName&&n.push(ir(e,t,o.qualifiedName))}return n}function fc(e){for(let t of e.children)if(t.type==="visibility_modifier"&&t.text.startsWith("pub"))return!0;return!1}function mc(e,t,r){let n=r.trim();if(n.includes("{")&&n.includes("}")){let i=n.slice(0,n.indexOf("{")).replace(/::$/,"").trim(),s=n.slice(n.indexOf("{")+1,n.lastIndexOf("}")).trim();return T(s).flatMap(o=>{let a=o.trim();if(!a||a==="self")return[];let[c]=a.split(/\s+as\s+/),l=`${i}::${c?.trim()??a}`.replace(/::::/g,"::");return[ir(e,t,l)]})}return[ir(e,t,n)]}function ir(e,t,r){return{specifier:r,sourcePath:V(e,t,r)??V(e,t,r.split("::").slice(0,-1).join("::"))}}function Y({language:e,extensions:t,imports:r,parseImports:n}){return{language:e,extensions:t,capabilities:{imports:r},parseImports:n}}function Hn(e,t){let r=t.toLowerCase();for(let n of e)for(let i of n.extensions)if(r.endsWith(i))return n;return null}var gc={language:"javascript",extensions:ee,capabilities:{imports:"ast-with-regex-fallback",reExports:"ast-with-regex-fallback"},parseImports:rr,parseReExports:nr},hc=Y({language:"python",extensions:Xe,imports:"ast-with-regex-fallback",parseImports:$n}),yc=Y({language:"jvm",extensions:C,imports:"ast-dispatch-with-regex-fallback",parseImports:Ln}),Sc={language:"rust",extensions:Je,capabilities:{imports:"ast-with-regex-fallback",exports:"ast-with-regex-fallback"},parseImports:Bn,parseExports:qn},xc=Y({language:"ruby",extensions:Ye,imports:"ast-with-regex-fallback",parseImports:Vn}),bc=Y({language:"c/cpp",extensions:Qe,imports:"ast-with-regex-fallback",parseImports:Cn}),vc=Y({language:"dotnet",extensions:G,imports:"ast-dispatch-with-regex-fallback",parseImports:An}),Ec={language:"dart",extensions:Ze,capabilities:{imports:"regex-only",exports:"regex-only"},parseImports:wn,parseExports:Fn},Pc=Y({language:"php",extensions:re,imports:"ast-with-regex-fallback",parseImports:Mn}),Nc=Y({language:"clojure",extensions:he,imports:"regex-only",parseImports:_n}),kc=[gc,hc,yc,Sc,xc,bc,vc,Ec,Pc,Nc];function sr(e){return Hn(kc,e)}var or={clearGroups:["whole-project","source-file"]},Tc=x("source-imports",or),Bd=x("source-exports",or),Ic=x("source-reexports",or),zn=Ie({kind:"source-imports",invalidation:Ce("source-imports"),serialize:Cc,deserialize:Rc}),Gn=Ie({kind:"source-reexports",invalidation:Ce("source-reexports"),serialize:_c,deserialize:wc});function qd(e,t){let r=N(t);return Ic.get(e,r,()=>{let n=sr(r);if(!n?.parseReExports)return[];let i=R(e,r);if(!i)return[];let s=Ne(e,r,i),o=Ut(e),a=Gn.read(e,r,s);if(a?.resolutionFingerprint===o)return a.reExports;let c=n.parseReExports(e,r,i);return Gn.write(e,r,s,{resolutionFingerprint:o,reExports:c}),c})}function Hd(e,t){let r=N(t);return Tc.get(e,r,()=>{let n=sr(r);if(!n)return[];let i=R(e,r);if(!i)return[];let s=Ne(e,r,i),o=Ut(e),a=zn.read(e,r,s);if(a?.resolutionFingerprint===o)return a.imports;let c=n.parseImports(e,r,i);return zn.write(e,r,s,{resolutionFingerprint:o,imports:c}),c})}function Cc(e){return JSON.stringify(e)}function Rc(e){try{let t=JSON.parse(e);return!de(t)||typeof t.resolutionFingerprint!="string"||!Array.isArray(t.imports)?null:{resolutionFingerprint:t.resolutionFingerprint,imports:t.imports}}catch{return null}}function _c(e){return JSON.stringify(e)}function wc(e){try{let t=JSON.parse(e);return!de(t)||typeof t.resolutionFingerprint!="string"||!Array.isArray(t.reExports)?null:{resolutionFingerprint:t.resolutionFingerprint,reExports:t.reExports}}catch{return null}}export{gr as a,ze as b,Ne as c,Wr as d,Ie as e,$l as f,Ce as g,R as h,gp as i,M as j,Qo as k,sa as l,Bl as m,zr as n,bs as o,K as p,de as q,Et as r,ne as s,qd as t,Hd as u,Wc as v,$c as w,Vc as x,Uc as y,Bc as z,qc as A,Hc as B,zc as C,as as D,Hl as E,ls as F,Kl as G,Xl as H,Jl as I,Ql as J,al as K,cl as L,Pi as M,ll as N,ml as O,bl as P,vl as Q,El as R,Il as S,Cl as T,hi as U,Qc as V,Zc as W,el as X};
101
+ //# sourceMappingURL=chunk-XAEU4ROB.js.map
@@ -0,0 +1,2 @@
1
+ import{L as c}from"./chunk-MCNWCJYL.js";import{A as u,d as a,y as p}from"./chunk-WFRZGMWJ.js";var l=a("suppression-inventory",{clearGroups:["whole-project"]});function b(e){return l.get(e,()=>f(e))}function f(e){let r={dead:0,stale:0,wrapper:0,passthrough:0,drift:0,extract:0,similar:0,twin:0,uncategorized:0},t=new Map,s=0;for(let o of c(e)){let n=p(e,o);if(!(!n||!n.includes("scip-query")))for(let g of n.split(/\r?\n/)){let i=u(g);if(i===null)continue;s+=1,t.set(o,(t.get(o)??0)+1);let y=d(i);r[y]+=1}}return{total:s,byCategory:r,byFile:t}}function d(e){if(!e)return"uncategorized";let r=e.toLowerCase();return r==="dead-code"?"dead":r}export{b as a};
2
+ //# sourceMappingURL=chunk-XBPAJASV.js.map
@@ -1,2 +1,2 @@
1
- import{a as F,b as A}from"./chunk-I4R3SNMR.js";import{a as C}from"./chunk-IMQFJ53K.js";import{a as k}from"./chunk-27HMTUJE.js";import{d as S}from"./chunk-X5C43YVI.js";import{a as y}from"./chunk-GNG622H3.js";import{a as p}from"./chunk-64MNV6AB.js";import{posix as h}from"path";var _=20,G=1,O=new Map([["app","app"],["apps","app"],["component","component"],["components","component"],["composable","composable"],["composables","composable"],["contract","contract"],["contracts","contract"],["domain","domain"],["domains","domain"],["feature","feature"],["features","feature"],["hook","hook"],["hooks","hook"],["lib","library"],["module","module"],["modules","module"],["package","package"],["packages","package"],["page","page"],["pages","page"],["route","route"],["routes","route"],["screen","screen"],["screens","screen"],["service","service"],["services","service"],["shared","shared"],["src","source-root"],["store","state"],["stores","state"],["test","test"],["tests","test"],["util","utility"],["utils","utility"],["view","view"],["views","view"]]),q=new Set(["components","contracts","hooks","lib","services","shared","stores","utils"]),Y=new Set(["access","api","auth","config","db","effect","errors","hooks","lib","middleware","permissions","routes","schemas","servicetasks","services","startup","store","stores","test-utils","repository","repositories","tests","types","ui","utils","workflow","workflows"]);function Ce(e,n={}){let t=L(n.limit,_),i=L(n.minConsumers,G),r=new C(e),s=r.fileDependencyGraph(n.scope),o=ge(p(e,{includeIgnored:!1})),a=pe(e.config.locality?.architecturalBoundarySegments,n.architecturalBoundarySegments);return(n.target?K(e,r,n.target):J(e,n.scope,n.scanLimit)).map(c=>Q(e,r,s,c,n,o,a)).filter(c=>c.consumerFiles.length>=i||n.target).sort(me).slice(0,t)}function K(e,n,t){let i=Z(e,t);if(i)return[I(i)];let r=k(e,t);if(!r)return[];let s=n.definitionsForFile(r.relativePath).find(o=>o.symbolId===r.symbolId);return s?[ee(s)]:[{unit:{kind:"symbol",file:r.relativePath,shortName:S(r.symbol),symbol:r.symbol,startLine:r.startLine,endLine:r.endLine}}]}function J(e,n,t){let i=p(e,{scope:n,includeIgnored:!1}),r=L(t,i.length);return i.slice(0,r).map(s=>I(s))}function Q(e,n,t,i,r,s,o){let a=i.definition?V(e,n,i.definition,r.semantic):X(t,i.unit.file),d=i.definition?a.length>0?"exact":"none":a.length>0?"file-level":"none",f=i.unit.file,c=l(h.dirname(f)),u=te(a),B=ne(c),W=w([...T(c),...u?T(u):[]]),b=ie(i.unit,c,u,a),g=re(b,i.unit,c,u,a,s,o),j=le(i.unit,d,u,a,c,g.whyNoSuggestedHome),z=ue(i.unit,c,u,a,g.suggestedHome,g.whyNoSuggestedHome);return{actionTier:"signal",sourceUnit:i.unit,candidatePath:f,currentDirectory:c,directoryAncestry:B,consumerFiles:a,consumerCoverage:d,nearestCommonOwner:u,boundaryMarkers:W,recommendedTier:b,suggestedHome:g.suggestedHome,destinationConfidence:g.confidence,whyNoSuggestedHome:g.whyNoSuggestedHome,counterevidence:j,reasons:z,recommendation:de(b,g.suggestedHome,d)}}function V(e,n,t,i){let r=A(F(e,n).forDefinitions([t],{semantic:i!==!1,sourceFallback:!0}));return E(r.get(t.symbolId)??[])}function X(e,n){let t=[];for(let[i,r]of e.entries())i!==n&&r.has(n)&&t.push(i);return E(t)}function Z(e,n){let t=y(n),i=p(e,{includeIgnored:!1}),r=i.find(o=>o===t);if(r)return r;let s=i.find(o=>o.endsWith(`/${t}`));return s||(i.find(o=>o.includes(t))??null)}function ee(e){return{definition:e,unit:{kind:"symbol",file:e.relativePath,shortName:S(e.symbol),symbol:e.symbol,startLine:e.startLine,endLine:e.endLine}}}function I(e){return{unit:{kind:"file",file:e,shortName:h.basename(e)}}}function ne(e){if(e===".")return[{path:".",depth:0,markers:[]}];let n=[],t=e.split("/").filter(Boolean);for(let i=0;i<t.length;i+=1){let r=t.slice(0,i+1).join("/");n.push({path:r,depth:i,markers:D(r)})}return n}function T(e){return e==="."?[]:$(e).map(({marker:n,prefix:t})=>`${n}: ${t}`)}function D(e){return w($(e).map(({marker:n})=>n))}function $(e){let n=e.split("/").filter(Boolean),t=[];for(let i=0;i<n.length;i+=1){let r=O.get(n[i]);r&&t.push({marker:r,prefix:n.slice(0,i+1).join("/")})}return t}function te(e){if(e.length===0)return null;let n=e.map(i=>l(h.dirname(i))),t=n[0].split("/").filter(Boolean);for(let i of n.slice(1)){let r=i.split("/").filter(Boolean),s=[],o=Math.min(t.length,r.length);for(let a=0;a<o&&t[a]===r[a];a+=1)s.push(t[a]);t=s}return t.length===0?".":t.join("/")}function ie(e,n,t,i){return t?e.kind==="symbol"&&i.length===1?i[0]===e.file?"same-file":"sibling-folder":t==="."||t==="src"?"repository-level-review":U(t,"package")?"package-level-shared":U(t,"app")?"app-level-shared":N(t,["feature","domain","module"])||N(n,["feature","domain","module"])?"feature-local-shared":"sibling-folder":"no-exact-consumers"}function re(e,n,t,i,r,s,o){let a=oe(e,i);if(a)return m(a);let d=fe(n.file),f=se(e,t,d,r,o);if(f)return f;let c=i;if(l(t)===l(c))return m(`${t} is already the nearest common owner for its consumers.`);let u=ae(c,t,d,o);return u||ce(c,t,d,s,o)}function oe(e,n){return n?e==="no-exact-consumers"||e==="repository-level-review"?"The inferred owner is too broad or unsupported for an exact destination.":null:"No consumer owner could be inferred from the current index."}function se(e,n,t,i,r){if(e==="same-file"){let s=i[0]??null;return s?v(s):m("No same-file consumer path was available.")}if(e==="sibling-folder"&&i.length===1){let s=l(h.dirname(i[0])),o=H(n,t,s,r);return o?m(o):v(s)}return null}function ae(e,n,t,i){return be(e)?P(e,n,t,i,`Nearest shared owner ${e} is outside source root ${t}.`):null}function ce(e,n,t,i,r){if(e===".")return m("The nearest common owner is the repository root.");let s=`${e}/shared`,o=P(s,n,t,r,`Proposed home ${s} is outside source root ${t}.`);return o.confidence==="withheld"||i.has(s)?o:m(`${s} does not exist in the indexed project.`)}function P(e,n,t,i,r){if(!M(e,t))return m(r);let s=H(n,t,e,i);return s?m(s):v(e)}function v(e){return{suggestedHome:e,confidence:"exact",whyNoSuggestedHome:null}}function m(e){return{suggestedHome:null,confidence:"withheld",whyNoSuggestedHome:e}}function le(e,n,t,i,r,s){let o=["Report-only signal; review ownership before moving files."];return n==="none"&&o.push("No consumers were found in the current index."),n==="file-level"&&o.push("File-level import evidence can hide which exported unit is actually used."),(t==="."||t==="src")&&o.push("Nearest common owner is broad, so this is not enough evidence for automatic placement."),i.length===1&&o.push("Only one consumer was found; inlining or same-folder placement may be better than shared extraction."),e.kind==="file"&&o.push("File targets describe module locality, not symbol-level usage."),t&&r.startsWith(`${t}/`)&&o.push("Candidate already lives under the nearest common owner."),s&&o.push(`No exact suggested home: ${s}`),o}function ue(e,n,t,i,r,s){let o=[];return o.push(`${e.shortName} currently lives in ${n}.`),t?o.push(`${i.length} consumer file(s) share ${t} as their nearest common owner.`):o.push("No consumer owner could be inferred from the current index."),r?o.push(`Suggested home is ${r}.`):s&&o.push(`No exact suggested home: ${s}`),o}function de(e,n,t){return e==="no-exact-consumers"?"Review references before moving; no consumers were found.":e==="repository-level-review"?"Keep this as a broad locality signal; the inferred owner is too general for automatic relocation.":n?`Review whether ${t==="exact"?"symbol usage":"module import"} supports moving or extracting toward ${n}.`:"Review ownership manually before changing structure."}function me(e,n){return R(n)-R(e)||e.candidatePath.localeCompare(n.candidatePath)}function R(e){let n=e.consumerFiles.length*10;return e.consumerCoverage==="exact"&&(n+=5),e.suggestedHome&&(n+=3),e.recommendedTier==="repository-level-review"&&(n*=.1),e.recommendedTier==="no-exact-consumers"&&(n*=.05),n}function ge(e){let n=new Set(["."]);for(let t of e){let i=l(h.dirname(t));for(;!n.has(i)&&(n.add(i),i!==".");)i=l(h.dirname(i))}return n}function fe(e){let n=x(e),t=n.indexOf("src");return t>=0?n.slice(0,t+1).join("/"):n.length<=1?".":n[0]}function M(e,n){let t=l(e),i=l(n);return i==="."||t===i||t.startsWith(`${i}/`)}function he(e,n,t){let i=x(e),r=x(n);return(M(e,n)?i.slice(r.length):i).some(o=>t.has(o.toLowerCase()))}function H(e,n,t,i){return l(e)===l(t)||!he(e,n,i)?null:`${e} is a named architectural boundary; an exact move to ${t} needs human design.`}function pe(...e){let n=new Set(Y);for(let t of e)for(let i of t??[]){let r=ye(i);r&&n.add(r)}return n}function ye(e){let n=e.trim().toLowerCase();return n===""?null:n}function U(e,n){return D(e).includes(n)}function N(e,n){let t=D(e);return n.some(i=>t.includes(i))}function be(e){let n=e.split("/").filter(Boolean),t=n[n.length-1];return t?q.has(t):!1}function l(e){let n=y(e);return n===""?".":n}function x(e){let n=y(e);return n==="."?[]:n.split("/").filter(Boolean)}function L(e,n){return!Number.isFinite(e)||e===void 0||e<1?n:Math.floor(e)}function E(e){return w([...e]).sort((n,t)=>n.localeCompare(t))}function w(e){return[...new Set(e)]}export{Ce as a};
2
- //# sourceMappingURL=chunk-GY3HAWUA.js.map
1
+ import{a as F,b as A}from"./chunk-CVBS2FD4.js";import{a as C}from"./chunk-3I34FZ6R.js";import{a as k}from"./chunk-YSUD2S7T.js";import{d as S}from"./chunk-OO6S4ECV.js";import{a as y}from"./chunk-MCNWCJYL.js";import{a as p}from"./chunk-64MNV6AB.js";import{posix as h}from"path";var _=20,G=1,O=new Map([["app","app"],["apps","app"],["component","component"],["components","component"],["composable","composable"],["composables","composable"],["contract","contract"],["contracts","contract"],["domain","domain"],["domains","domain"],["feature","feature"],["features","feature"],["hook","hook"],["hooks","hook"],["lib","library"],["module","module"],["modules","module"],["package","package"],["packages","package"],["page","page"],["pages","page"],["route","route"],["routes","route"],["screen","screen"],["screens","screen"],["service","service"],["services","service"],["shared","shared"],["src","source-root"],["store","state"],["stores","state"],["test","test"],["tests","test"],["util","utility"],["utils","utility"],["view","view"],["views","view"]]),q=new Set(["components","contracts","hooks","lib","services","shared","stores","utils"]),Y=new Set(["access","api","auth","config","db","effect","errors","hooks","lib","middleware","permissions","routes","schemas","servicetasks","services","startup","store","stores","test-utils","repository","repositories","tests","types","ui","utils","workflow","workflows"]);function Ce(e,n={}){let t=L(n.limit,_),i=L(n.minConsumers,G),r=new C(e),s=r.fileDependencyGraph(n.scope),o=ge(p(e,{includeIgnored:!1})),a=pe(e.config.locality?.architecturalBoundarySegments,n.architecturalBoundarySegments);return(n.target?K(e,r,n.target):J(e,n.scope,n.scanLimit)).map(c=>Q(e,r,s,c,n,o,a)).filter(c=>c.consumerFiles.length>=i||n.target).sort(me).slice(0,t)}function K(e,n,t){let i=Z(e,t);if(i)return[I(i)];let r=k(e,t);if(!r)return[];let s=n.definitionsForFile(r.relativePath).find(o=>o.symbolId===r.symbolId);return s?[ee(s)]:[{unit:{kind:"symbol",file:r.relativePath,shortName:S(r.symbol),symbol:r.symbol,startLine:r.startLine,endLine:r.endLine}}]}function J(e,n,t){let i=p(e,{scope:n,includeIgnored:!1}),r=L(t,i.length);return i.slice(0,r).map(s=>I(s))}function Q(e,n,t,i,r,s,o){let a=i.definition?V(e,n,i.definition,r.semantic):X(t,i.unit.file),d=i.definition?a.length>0?"exact":"none":a.length>0?"file-level":"none",f=i.unit.file,c=l(h.dirname(f)),u=te(a),B=ne(c),W=w([...T(c),...u?T(u):[]]),b=ie(i.unit,c,u,a),g=re(b,i.unit,c,u,a,s,o),j=le(i.unit,d,u,a,c,g.whyNoSuggestedHome),z=ue(i.unit,c,u,a,g.suggestedHome,g.whyNoSuggestedHome);return{actionTier:"signal",sourceUnit:i.unit,candidatePath:f,currentDirectory:c,directoryAncestry:B,consumerFiles:a,consumerCoverage:d,nearestCommonOwner:u,boundaryMarkers:W,recommendedTier:b,suggestedHome:g.suggestedHome,destinationConfidence:g.confidence,whyNoSuggestedHome:g.whyNoSuggestedHome,counterevidence:j,reasons:z,recommendation:de(b,g.suggestedHome,d)}}function V(e,n,t,i){let r=A(F(e,n).forDefinitions([t],{semantic:i!==!1,sourceFallback:!0}));return E(r.get(t.symbolId)??[])}function X(e,n){let t=[];for(let[i,r]of e.entries())i!==n&&r.has(n)&&t.push(i);return E(t)}function Z(e,n){let t=y(n),i=p(e,{includeIgnored:!1}),r=i.find(o=>o===t);if(r)return r;let s=i.find(o=>o.endsWith(`/${t}`));return s||(i.find(o=>o.includes(t))??null)}function ee(e){return{definition:e,unit:{kind:"symbol",file:e.relativePath,shortName:S(e.symbol),symbol:e.symbol,startLine:e.startLine,endLine:e.endLine}}}function I(e){return{unit:{kind:"file",file:e,shortName:h.basename(e)}}}function ne(e){if(e===".")return[{path:".",depth:0,markers:[]}];let n=[],t=e.split("/").filter(Boolean);for(let i=0;i<t.length;i+=1){let r=t.slice(0,i+1).join("/");n.push({path:r,depth:i,markers:D(r)})}return n}function T(e){return e==="."?[]:$(e).map(({marker:n,prefix:t})=>`${n}: ${t}`)}function D(e){return w($(e).map(({marker:n})=>n))}function $(e){let n=e.split("/").filter(Boolean),t=[];for(let i=0;i<n.length;i+=1){let r=O.get(n[i]);r&&t.push({marker:r,prefix:n.slice(0,i+1).join("/")})}return t}function te(e){if(e.length===0)return null;let n=e.map(i=>l(h.dirname(i))),t=n[0].split("/").filter(Boolean);for(let i of n.slice(1)){let r=i.split("/").filter(Boolean),s=[],o=Math.min(t.length,r.length);for(let a=0;a<o&&t[a]===r[a];a+=1)s.push(t[a]);t=s}return t.length===0?".":t.join("/")}function ie(e,n,t,i){return t?e.kind==="symbol"&&i.length===1?i[0]===e.file?"same-file":"sibling-folder":t==="."||t==="src"?"repository-level-review":U(t,"package")?"package-level-shared":U(t,"app")?"app-level-shared":N(t,["feature","domain","module"])||N(n,["feature","domain","module"])?"feature-local-shared":"sibling-folder":"no-exact-consumers"}function re(e,n,t,i,r,s,o){let a=oe(e,i);if(a)return m(a);let d=fe(n.file),f=se(e,t,d,r,o);if(f)return f;let c=i;if(l(t)===l(c))return m(`${t} is already the nearest common owner for its consumers.`);let u=ae(c,t,d,o);return u||ce(c,t,d,s,o)}function oe(e,n){return n?e==="no-exact-consumers"||e==="repository-level-review"?"The inferred owner is too broad or unsupported for an exact destination.":null:"No consumer owner could be inferred from the current index."}function se(e,n,t,i,r){if(e==="same-file"){let s=i[0]??null;return s?v(s):m("No same-file consumer path was available.")}if(e==="sibling-folder"&&i.length===1){let s=l(h.dirname(i[0])),o=H(n,t,s,r);return o?m(o):v(s)}return null}function ae(e,n,t,i){return be(e)?P(e,n,t,i,`Nearest shared owner ${e} is outside source root ${t}.`):null}function ce(e,n,t,i,r){if(e===".")return m("The nearest common owner is the repository root.");let s=`${e}/shared`,o=P(s,n,t,r,`Proposed home ${s} is outside source root ${t}.`);return o.confidence==="withheld"||i.has(s)?o:m(`${s} does not exist in the indexed project.`)}function P(e,n,t,i,r){if(!M(e,t))return m(r);let s=H(n,t,e,i);return s?m(s):v(e)}function v(e){return{suggestedHome:e,confidence:"exact",whyNoSuggestedHome:null}}function m(e){return{suggestedHome:null,confidence:"withheld",whyNoSuggestedHome:e}}function le(e,n,t,i,r,s){let o=["Report-only signal; review ownership before moving files."];return n==="none"&&o.push("No consumers were found in the current index."),n==="file-level"&&o.push("File-level import evidence can hide which exported unit is actually used."),(t==="."||t==="src")&&o.push("Nearest common owner is broad, so this is not enough evidence for automatic placement."),i.length===1&&o.push("Only one consumer was found; inlining or same-folder placement may be better than shared extraction."),e.kind==="file"&&o.push("File targets describe module locality, not symbol-level usage."),t&&r.startsWith(`${t}/`)&&o.push("Candidate already lives under the nearest common owner."),s&&o.push(`No exact suggested home: ${s}`),o}function ue(e,n,t,i,r,s){let o=[];return o.push(`${e.shortName} currently lives in ${n}.`),t?o.push(`${i.length} consumer file(s) share ${t} as their nearest common owner.`):o.push("No consumer owner could be inferred from the current index."),r?o.push(`Suggested home is ${r}.`):s&&o.push(`No exact suggested home: ${s}`),o}function de(e,n,t){return e==="no-exact-consumers"?"Review references before moving; no consumers were found.":e==="repository-level-review"?"Keep this as a broad locality signal; the inferred owner is too general for automatic relocation.":n?`Review whether ${t==="exact"?"symbol usage":"module import"} supports moving or extracting toward ${n}.`:"Review ownership manually before changing structure."}function me(e,n){return R(n)-R(e)||e.candidatePath.localeCompare(n.candidatePath)}function R(e){let n=e.consumerFiles.length*10;return e.consumerCoverage==="exact"&&(n+=5),e.suggestedHome&&(n+=3),e.recommendedTier==="repository-level-review"&&(n*=.1),e.recommendedTier==="no-exact-consumers"&&(n*=.05),n}function ge(e){let n=new Set(["."]);for(let t of e){let i=l(h.dirname(t));for(;!n.has(i)&&(n.add(i),i!==".");)i=l(h.dirname(i))}return n}function fe(e){let n=x(e),t=n.indexOf("src");return t>=0?n.slice(0,t+1).join("/"):n.length<=1?".":n[0]}function M(e,n){let t=l(e),i=l(n);return i==="."||t===i||t.startsWith(`${i}/`)}function he(e,n,t){let i=x(e),r=x(n);return(M(e,n)?i.slice(r.length):i).some(o=>t.has(o.toLowerCase()))}function H(e,n,t,i){return l(e)===l(t)||!he(e,n,i)?null:`${e} is a named architectural boundary; an exact move to ${t} needs human design.`}function pe(...e){let n=new Set(Y);for(let t of e)for(let i of t??[]){let r=ye(i);r&&n.add(r)}return n}function ye(e){let n=e.trim().toLowerCase();return n===""?null:n}function U(e,n){return D(e).includes(n)}function N(e,n){let t=D(e);return n.some(i=>t.includes(i))}function be(e){let n=e.split("/").filter(Boolean),t=n[n.length-1];return t?q.has(t):!1}function l(e){let n=y(e);return n===""?".":n}function x(e){let n=y(e);return n==="."?[]:n.split("/").filter(Boolean)}function L(e,n){return!Number.isFinite(e)||e===void 0||e<1?n:Math.floor(e)}function E(e){return w([...e]).sort((n,t)=>n.localeCompare(t))}function w(e){return[...new Set(e)]}export{Ce as a};
2
+ //# sourceMappingURL=chunk-XC6PUFNN.js.map
@@ -0,0 +1,6 @@
1
+ import{a as n}from"./chunk-QVZSWLLZ.js";import{execFileSync as l}from"child_process";import{createRequire as m}from"module";import{existsSync as d}from"fs";import{platform as s,arch as p}from"os";var u="v0.8.1",c="https://github.com/sourcegraph/scip",g="SCIP_QUERY_SCIP_BIN";function h(e){if(e.isOnPath("scip"))return{source:"path",path:"scip"};let r=e.env[g];if(r&&e.fileExists(r))return{source:"env",path:r};if(e.platform==="win32"){let i=e.resolveSidecar(e.arch);if(i&&e.fileExists(i))return{source:"sidecar",path:i}}return null}function y(e){let r=m(import.meta.url);for(let i of e==="arm64"?["arm64","x64"]:[e])try{return r.resolve(`scip-query-scip-windows/scip-win32-${i}.exe`)}catch{}return null}function f(e=process.env){return h({platform:s(),arch:p(),env:e,isOnPath:n,fileExists:d,resolveSidecar:y})?.path??null}function E(){return f()!==null}function $(){let e=f();if(!e)return null;try{return l(e,["--version"],{stdio:"pipe"}).toString().trim()}catch{return null}}function v(){let e=s(),r=p(),i,o,t;switch(e){case"darwin":i="darwin",t="tar.gz";break;case"linux":i="linux",t="tar.gz";break;default:return null}switch(r){case"arm64":o="arm64";break;case"x64":o="amd64";break;default:return null}let a=`scip-${i}-${o}.${t}`;return{url:`${c}/releases/download/${u}/${a}`,filename:a}}function B(){let e=v();console.log("\nThe `scip` CLI is required but not found on PATH.\n"),s()==="darwin"?(console.log("Install via Homebrew:"),console.log(` brew install sourcegraph/scip/scip
2
+ `),console.log("Or download manually:")):s()==="win32"?(console.log("On Windows the scip binary ships via the npm sidecar package scip-query-scip-windows,"),console.log("installed automatically with scip-query. If it is missing:"),console.log(" npm install -g scip-query-scip-windows"),console.log(`Or set ${g} to a local scip.exe path.
3
+ `),console.log("Upstream release page:")):console.log("Download from:"),console.log(e?` ${e.url}
4
+ `:` ${c}/releases/tag/${u}
5
+ `),console.log("After installing, ensure `scip` is on your PATH and run `scip-query reindex`.")}function C(e){if(s()==="darwin"&&n("brew")){e("Installing scip CLI via Homebrew...");try{if(l("brew",["install","sourcegraph/scip/scip"],{stdio:"inherit",timeout:3e5,env:process.env}),n("scip"))return e("Successfully installed scip CLI via Homebrew"),!0}catch(r){let i=r instanceof Error?r.message:String(r);e(`Homebrew install failed: ${i}`)}}if(n("go")){e("Installing scip CLI via go install...");try{if(l("go",["install","github.com/sourcegraph/scip/cmd/scip@latest"],{stdio:"inherit",timeout:3e5,env:process.env}),n("scip"))return e("Successfully installed scip CLI via go install"),!0}catch(r){let i=r instanceof Error?r.message:String(r);e(`go install failed: ${i}`)}}return e("Could not auto-install scip CLI."),e(`Install manually from: ${c}/releases`),!1}export{f as a,E as b,$ as c,B as d,C as e};
6
+ //# sourceMappingURL=chunk-Y42DMR6F.js.map
@@ -0,0 +1,7 @@
1
+ import{a as j}from"./chunk-S2FZILCF.js";import{a as N,b as g,c as R}from"./chunk-CVBS2FD4.js";import{a as _}from"./chunk-MZB3DTHW.js";import{a as E}from"./chunk-B75HZHUP.js";import{a as P}from"./chunk-3I34FZ6R.js";import{a as k}from"./chunk-BGBBVSH4.js";import{g as C}from"./chunk-UO4IADXJ.js";import{a as w}from"./chunk-2Y7YX54K.js";import{d,e as y,k as v,z as L}from"./chunk-OO6S4ECV.js";import{i as S}from"./chunk-NLVKD45E.js";import{s as x}from"./chunk-WFRZGMWJ.js";import{basename as m,extname as b}from"path";function ae(t,n){let{scope:e,maxLoc:i=15,limit:a=30,scanLimit:o}=n??{},r=new P(t),s=z(r.fileDependencyGraph(e));return _({candidates:()=>B(t,r,e,i),orderCandidates:E,scanLimit:o,profile:{name:"wrapper-candidates"},prepare:l=>({callerFileMap:A(t,r,l,{semantic:n?.semantic!==!1}),reverseFanIn:s}),evaluate:(l,u)=>O(t,r,l,u),orderResults:(l,u)=>u.callerFanIn-l.callerFanIn||u.loc-l.loc,limit:a})}function A(t,n,e,i){let a=N(t,n),o=g(a.forDefinitions(e,{semantic:!1,sourceFallback:!1})),r=[];i.semantic&&x("wrapper.semantic-candidates",()=>{r=e.filter(c=>F(t,n,c,o).length<=1)},()=>({symbols:e.length,semanticCandidates:r.length}));let s=r.length===0?new Map:g(a.forDefinitions(r,{semantic:!0,sourceFallback:!1})),l=s.size===0?o:C(o,s),u=new Map(e.map(c=>[c.symbolId,c])),f=new Map;for(let c of e){let I=F(t,n,c,l);if(I.length>1||(f.set(c.symbolId,c),I.length!==1))continue;let D=I[0],M=T(t,c.symbolId,D);if(!M)continue;let p=W(n,t,D,c.symbol,M);p?.isFunctionLike&&u.has(p.symbolId)&&f.set(p.symbolId,u.get(p.symbolId))}let h=[...f.values()];return h.length===0?l:C(l,g(a.forDefinitions(h,{semantic:!1,sourceFallback:!0})))}function O(t,n,e,i){let a=F(t,n,e,i.callerFileMap);if(a.length!==1)return null;let o=a[0],r=T(t,e.symbolId,o);if(!r)return null;let s=W(n,t,o,e.symbol,r);if(s&&v(s.symbol))return null;let{fanIn:l,source:u}=J(i.callerFileMap,i.reverseFanIn,o,s);if(u==="function"?l<=3:l<=5)return null;let f=H(t,e,o,s);return{symbol:e.symbol,shortName:d(e.symbol),file:e.relativePath,startLine:e.startLine,endLine:e.endLine,loc:k(e),singleCaller:s?.symbol??"",singleCallerShort:s?.isFunctionLike?d(s.symbol):m(o),callerFanIn:l,actionTier:f.length>0?"signal":"direct",boundaryEvidence:f}}function B(t,n,e,i){return n.productionCallableDefinitions({scope:e,minLoc:2,maxLoc:i,requireFunctionLikeSymbol:!0,excludeRootedSymbols:!0,excludeRustTraitImplMembers:!0}).filter(a=>!S(t,a))}function F(t,n,e,i){let a=m(e.relativePath,b(e.relativePath)),o=[...i.get(e.symbolId)??[]].filter(r=>r!==e.relativePath).filter(r=>m(r,b(r))!==a).filter(r=>{let s=n.fileKind(r);return s!=="barrel"&&s!=="entry"&&s!=="test"});return R(t,e,o).realConsumers}function T(t,n,e){return t.get(`SELECT c.start_line, c.end_line
2
+ FROM mentions m
3
+ JOIN chunks c ON m.chunk_id = c.id
4
+ JOIN documents d ON c.document_id = d.id
5
+ WHERE m.symbol_id = ? AND m.role != 1 AND d.relative_path = ?
6
+ LIMIT 1`,n,e)}function W(t,n,e,i,a){let o=t.definitionsForFile(e),r=q(n,e,i,a.start_line,a.end_line);return L(o,r)}function J(t,n,e,i){if(i?.isFunctionLike){let a=[...t.get(i.symbolId)??[]].filter(o=>o!==i.relativePath);if(a.length>0)return{fanIn:a.length,source:"function"}}return{fanIn:G(n,e),source:"file"}}function q(t,n,e,i,a){let o=y(e);if(!o)return i;let r=w(t,n).get(o);if(!r||r.length===0)return i;for(let s of r)if(s>=i&&s<=a)return s;return i}function z(t){let n=new Map;for(let[e,i]of t){n.has(e)||n.set(e,n.get(e)??0);for(let a of i)n.set(a,(n.get(a)??0)+1)}return n}function G(t,n){let e=t.get(n)??0;if(e>0)return e;let i=m(n,b(n)),a=0;for(let[o,r]of t)o!==n&&m(o,b(o))===i&&r>a&&(a=r);return a}function H(t,n,e,i){return j(t,n.relativePath,n.startLine,"wrapper","explicit ignore-wrapper comment",[{label:"wrapper name",value:d(n.symbol)},{label:"caller name",value:i?.symbol?d(i.symbol):m(e)},{label:"wrapper path",value:n.relativePath},{label:"caller path",value:e}])}export{ae as a};
7
+ //# sourceMappingURL=chunk-YCVYOV4A.js.map
@@ -1,2 +1,2 @@
1
- import{b as A}from"./chunk-6KMTPNZL.js";import{a as _}from"./chunk-I4R3SNMR.js";import{f as R,g as L}from"./chunk-3AMWF6V5.js";import{b as D}from"./chunk-B75HZHUP.js";import{a as E}from"./chunk-IMQFJ53K.js";import{f as x,g as I}from"./chunk-BZXE3HO4.js";import{a as w}from"./chunk-BGBBVSH4.js";import{d as N}from"./chunk-X5C43YVI.js";import{b as T,c as h}from"./chunk-JZBGTSAB.js";import{p as S}from"./chunk-WS3Z6W3M.js";import{a as g}from"./chunk-64MNV6AB.js";var F={caller:3,"entry-surface":2,rooted:1},O=/not\s*yet\s*implement|not\s*implement|unimplement|\bnyi\b|\btodo\b|\bstub\b|not\s*supported|coming\s*soon/i,P=/^throw\s+new\s+[\w.]*Error\s*\(([\s\S]*)\)\s*;?$/,C=/^return(\s+(null|undefined|false|0|''|""|``|\[\]|\{\}))?\s*;?$/,v=/\/\/\s*TODO\b|\/\*\s*TODO\b/i,K=/(?:=>|\))\s*(?::\s*[^{;=]+)?\s*\{\s*\}\s*;?\s*$/;function et(e,n={}){let{scope:o,limit:r=30,scanLimit:l,semantic:a=!0}=n,s=new E(e),t=D(s.productionCallableDefinitions({scope:o,minLoc:1,requireFunctionLikeSymbol:!0,excludeTypesFiles:!0}),l),c=[];for(let i of t){let m=M(e,i);m&&c.push(m)}if(c.length===0)return[];let d=j(e,c,t),f=c.filter(i=>!d.has(i.def.symbol));if(f.length===0)return[];let p=_(e,s).forDefinitions(f.map(i=>i.def),{semantic:a}),u=[];for(let i of f){let b=p.get(i.def.symbolId)?.realConsumers.length??0,y=B(e,i.def,b);y&&u.push({symbol:i.def.symbol,shortName:N(i.def.symbol),file:i.def.relativePath,startLine:i.def.startLine,endLine:i.def.endLine,loc:w(i.def),stubKind:i.stubKind,reachability:y,callerFanIn:b,stubText:i.stubText})}return u.sort((i,m)=>F[m.reachability]-F[i.reachability]||m.callerFanIn-i.callerFanIn||i.file.localeCompare(m.file)||i.startLine-m.startLine),r?u.slice(0,r):u}function B(e,n,o){return o>0?"caller":I(e,n.symbol,n.relativePath)?"rooted":x(e,n.relativePath)?"entry-surface":null}function M(e,n){let o=R(e,n);if(!o)return null;let r=L(o),l=r.trim();if(l==="")return!z(o)||!A(e,n)?null:{def:n,stubKind:"empty-body",stubText:"(empty body)"};let a=h(r),s=T(r),t=$(a,s);if(t.length!==1)return null;let c=t[0];return U(c)?{def:n,stubKind:"throw-stub",stubText:c.trim()}:v.test(r)&&C.test(c.trim())?{def:n,stubKind:"todo-return-default",stubText:l}:null}function $(e,n){let o=[],r=0,l="";for(let a=0;a<n.length;a+=1){let s=n[a];if(s==="("||s==="["||s==="{"?r+=1:(s===")"||s==="]"||s==="}")&&(r=Math.max(0,r-1)),s===";"&&r===0){o.push(l),l="";continue}l+=e[a]??""}return l.trim()&&o.push(l),o.map(a=>a.trim()).filter(a=>a.length>0)}function U(e){let n=P.exec(e.trim());return n?O.test(n[1]??""):!1}function z(e){return K.test(e.trimEnd())}function j(e,n,o){let r=new Set,l=new Set(n.map(t=>t.def.parentTypeName).filter(t=>t!==null));if(l.size===0)return r;let a=k(e,l),s=new Map;for(let t of o){if(!t.parentTypeName)continue;let c=s.get(t.leaf)??new Set;c.add(t.parentTypeName),s.set(t.leaf,c)}for(let t of n){let c=t.def.parentTypeName;if(!c)continue;let d=a.get(c);if(!d||d.size===0)continue;let f=s.get(t.def.leaf)??new Set;[...d].every(u=>f.has(u))&&r.add(t.def.symbol)}return r}var Y=/\bclass\s+([A-Za-z_$][\w$]*)\s+extends\s+([A-Za-z_$][\w$]*)/g;function k(e,n){let o=new Map;for(let r of g(e,{includeIgnored:!1})){let l=S(e,r);if(l)for(let a of l.matchAll(Y)){let s=a[1],t=a[2];if(!s||!t||!n.has(t))continue;let c=o.get(t)??new Set;c.add(s),o.set(t,c)}}return o}export{et as a};
2
- //# sourceMappingURL=chunk-WPZPB42I.js.map
1
+ import{b as A}from"./chunk-2EU6WVR3.js";import{a as _}from"./chunk-CVBS2FD4.js";import{f as R,g as L}from"./chunk-753JWTUH.js";import{b as D}from"./chunk-B75HZHUP.js";import{a as E}from"./chunk-3I34FZ6R.js";import{f as x,g as I}from"./chunk-NLRWGGPY.js";import{a as w}from"./chunk-BGBBVSH4.js";import{d as N}from"./chunk-OO6S4ECV.js";import{b as T,c as h}from"./chunk-NLVKD45E.js";import{a as g}from"./chunk-64MNV6AB.js";import{y as S}from"./chunk-WFRZGMWJ.js";var F={caller:3,"entry-surface":2,rooted:1},O=/not\s*yet\s*implement|not\s*implement|unimplement|\bnyi\b|\btodo\b|\bstub\b|not\s*supported|coming\s*soon/i,P=/^throw\s+new\s+[\w.]*Error\s*\(([\s\S]*)\)\s*;?$/,C=/^return(\s+(null|undefined|false|0|''|""|``|\[\]|\{\}))?\s*;?$/,v=/\/\/\s*TODO\b|\/\*\s*TODO\b/i,K=/(?:=>|\))\s*(?::\s*[^{;=]+)?\s*\{\s*\}\s*;?\s*$/;function et(e,n={}){let{scope:o,limit:r=30,scanLimit:l,semantic:a=!0}=n,s=new E(e),t=D(s.productionCallableDefinitions({scope:o,minLoc:1,requireFunctionLikeSymbol:!0,excludeTypesFiles:!0}),l),c=[];for(let i of t){let m=M(e,i);m&&c.push(m)}if(c.length===0)return[];let d=j(e,c,t),f=c.filter(i=>!d.has(i.def.symbol));if(f.length===0)return[];let p=_(e,s).forDefinitions(f.map(i=>i.def),{semantic:a}),u=[];for(let i of f){let b=p.get(i.def.symbolId)?.realConsumers.length??0,y=B(e,i.def,b);y&&u.push({symbol:i.def.symbol,shortName:N(i.def.symbol),file:i.def.relativePath,startLine:i.def.startLine,endLine:i.def.endLine,loc:w(i.def),stubKind:i.stubKind,reachability:y,callerFanIn:b,stubText:i.stubText})}return u.sort((i,m)=>F[m.reachability]-F[i.reachability]||m.callerFanIn-i.callerFanIn||i.file.localeCompare(m.file)||i.startLine-m.startLine),r?u.slice(0,r):u}function B(e,n,o){return o>0?"caller":I(e,n.symbol,n.relativePath)?"rooted":x(e,n.relativePath)?"entry-surface":null}function M(e,n){let o=R(e,n);if(!o)return null;let r=L(o),l=r.trim();if(l==="")return!z(o)||!A(e,n)?null:{def:n,stubKind:"empty-body",stubText:"(empty body)"};let a=h(r),s=T(r),t=$(a,s);if(t.length!==1)return null;let c=t[0];return U(c)?{def:n,stubKind:"throw-stub",stubText:c.trim()}:v.test(r)&&C.test(c.trim())?{def:n,stubKind:"todo-return-default",stubText:l}:null}function $(e,n){let o=[],r=0,l="";for(let a=0;a<n.length;a+=1){let s=n[a];if(s==="("||s==="["||s==="{"?r+=1:(s===")"||s==="]"||s==="}")&&(r=Math.max(0,r-1)),s===";"&&r===0){o.push(l),l="";continue}l+=e[a]??""}return l.trim()&&o.push(l),o.map(a=>a.trim()).filter(a=>a.length>0)}function U(e){let n=P.exec(e.trim());return n?O.test(n[1]??""):!1}function z(e){return K.test(e.trimEnd())}function j(e,n,o){let r=new Set,l=new Set(n.map(t=>t.def.parentTypeName).filter(t=>t!==null));if(l.size===0)return r;let a=k(e,l),s=new Map;for(let t of o){if(!t.parentTypeName)continue;let c=s.get(t.leaf)??new Set;c.add(t.parentTypeName),s.set(t.leaf,c)}for(let t of n){let c=t.def.parentTypeName;if(!c)continue;let d=a.get(c);if(!d||d.size===0)continue;let f=s.get(t.def.leaf)??new Set;[...d].every(u=>f.has(u))&&r.add(t.def.symbol)}return r}var Y=/\bclass\s+([A-Za-z_$][\w$]*)\s+extends\s+([A-Za-z_$][\w$]*)/g;function k(e,n){let o=new Map;for(let r of g(e,{includeIgnored:!1})){let l=S(e,r);if(l)for(let a of l.matchAll(Y)){let s=a[1],t=a[2];if(!s||!t||!n.has(t))continue;let c=o.get(t)??new Set;c.add(s),o.set(t,c)}}return o}export{et as a};
2
+ //# sourceMappingURL=chunk-YD37KSEK.js.map
@@ -1,4 +1,4 @@
1
- import{b as l}from"./chunk-K7SPOJHZ.js";import{a}from"./chunk-IMQFJ53K.js";import{d as i,g as n}from"./chunk-X5C43YVI.js";function _(e,r){let t=l(e,r);return t.length===0?[]:m([...d(e,t),...c(e,t)]).filter(o=>!e.isIgnored(o.relative_path)).map(u)}function d(e,r){let t=r.map(()=>"?").join(", ");return e.all(`SELECT DISTINCT d1.relative_path, gs.symbol
1
+ import{b as l}from"./chunk-QB7NRST4.js";import{a}from"./chunk-3I34FZ6R.js";import{d as i,g as n}from"./chunk-OO6S4ECV.js";function _(e,r){let t=l(e,r);return t.length===0?[]:m([...d(e,t),...c(e,t)]).filter(o=>!e.isIgnored(o.relative_path)).map(u)}function d(e,r){let t=r.map(()=>"?").join(", ");return e.all(`SELECT DISTINCT d1.relative_path, gs.symbol
2
2
  FROM mentions m
3
3
  JOIN chunks c ON m.chunk_id = c.id
4
4
  JOIN documents d1 ON c.document_id = d1.id
@@ -26,4 +26,4 @@ import{b as l}from"./chunk-K7SPOJHZ.js";import{a}from"./chunk-IMQFJ53K.js";impor
26
26
  AND ${e.localSymbolPredicate}
27
27
  ${e.pathExclusionsFor("d1")}
28
28
  ORDER BY d1.relative_path`,...r,...r,...r)}function c(e,r){let t=new a(e);return r.flatMap(o=>t.definitionsForFile(o).filter(s=>n(s.symbol)).map(s=>({relative_path:o,symbol:s.symbol})))}function m(e){let r=new Set;return e.filter(t=>{let o=`${t.relative_path}|${t.symbol}`;return r.has(o)?!1:(r.add(o),!0)})}function u(e){return{consumer:e.relative_path,symbol:e.symbol,shortName:i(e.symbol)}}export{_ as a};
29
- //# sourceMappingURL=chunk-V5W7H7V4.js.map
29
+ //# sourceMappingURL=chunk-YFEJIYWH.js.map
@@ -0,0 +1,3 @@
1
+ import{A as C,c as M,d as L,e as Q,g as I,h as E,i as K,n as y,o as d,r as b}from"./chunk-OO6S4ECV.js";function se(e,n){return O(e,n).match}function O(e,n){let t=z(e,n.trim()).filter(r=>!e.isIgnored(r.relative_path));if(t.length>0)return S(e,t);let o=G(e,n);if(o&&!e.isIgnored(o.relative_path))return S(e,[o]);let i=W(e,n);return i.length>0?S(e,i):X(e,n)}function W(e,n){let t=N(n),o=x(t);if(!o)return[];let i=`%${o.path}%`,r=o.leaf;return j(e,i,r,t)}function j(e,n,t,o){let i=b([],[...q(e,n,t),...T(e,n,t)]).filter(r=>!e.isIgnored(r.relative_path)).filter(r=>f(r,o)>1);return i.sort((r,a)=>f(a,o)-f(r,o)||r.end_line-r.start_line-(a.end_line-a.start_line)||r.start_line-a.start_line||r.symbol.localeCompare(a.symbol)),i}function q(e,n,t){return y(e,{where:"d.relative_path LIKE ? AND (gs.display_name = ? OR gs.symbol LIKE ?)",params:[n,t,`%/${t}.%`]})}function T(e,n,t){return d(e,{where:"d.relative_path LIKE ? AND (gs.display_name = ? OR gs.symbol LIKE ?)",params:[n,t,`%/${t}.%`]})}function X(e,n){let t=N(n),o=P(n),i=V(e,o),r=ee(i,n,t).filter(s=>!e.isIgnored(s.relative_path));if(r.length>0)return S(e,r);let a=[];for(let s of i){if(e.isIgnored(s.relative_path))continue;let c=Y(s,n,t,o);c<=0||a.push({row:s,score:c})}return a.sort((s,c)=>c.score-s.score||s.row.end_line-s.row.start_line-(c.row.end_line-c.row.start_line)||s.row.relative_path.localeCompare(c.row.relative_path)||s.row.symbol.localeCompare(c.row.symbol)),S(e,a.map(s=>s.row))}function S(e,n){let t=n.map(i=>C(e,i)),o=t[0]??null;return{match:o,candidates:o?Z(t,o):[],total:t.length}}function Z(e,n){let t=new Set([`${n.symbolId}:${n.relativePath}:${n.startLine}`]),o=[];for(let i of e){let r=`${i.symbolId}:${i.relativePath}:${i.startLine}`;if(!t.has(r)&&(t.add(r),o.push({symbol:i.symbol,shortName:L(i.symbol),relativePath:i.relativePath,startLine:i.startLine}),o.length>=5))break}return o}function G(e,n){let t=n.match(/^(.+):(\d+)-(\d+)$/);if(!t)return;let[,o,i,r]=t,a=Math.max(0,parseInt(i,10)-1),s=Math.max(a,parseInt(r,10)-1);return H(e,o,a,s)??J(e,o,a,s)}function H(e,n,t,o){return y(e,{where:"d.relative_path LIKE ? AND der.start_line <= ? AND der.end_line >= ?",params:[`%${n}%`,t,o],orderBy:"(der.end_line - der.start_line) ASC",limit:1})[0]}function J(e,n,t,o){return d(e,{where:"d.relative_path LIKE ? AND c.start_line <= ? AND c.end_line >= ?",params:[`%${n}%`,t,o],orderBy:"(MAX(c.end_line) - MIN(c.start_line)) ASC",limit:1})[0]}function le(e,n){let t=z(e,n).find(o=>!e.isIgnored(o.relative_path));return t?C(e,t):null}function z(e,n){let t=y(e,{where:"gs.symbol = ?",params:[n],orderBy:"d.relative_path, der.start_line"}),o=t.length>0?[]:d(e,{where:"gs.symbol = ?",params:[n],orderBy:"d.relative_path, start_line"});return b(t,o)}function ce(e,n){if("symbol"in n&&"relativePath"in n)return n;let t=U(e,n.symbolId)[0];return t?C(e,t):null}function U(e,n){let t=y(e,{where:"gs.id = ?",params:[n],orderBy:"der.start_line, der.end_line"}),o=d(e,{where:"gs.id = ?",params:[n],orderBy:"start_line, end_line"});return b(t,o)}function V(e,n){let t=n.map(()=>"(gs.symbol LIKE ? OR d.relative_path LIKE ? OR COALESCE(gs.display_name, '') LIKE ?)"),o=n.flatMap(s=>{let c=`%${s}%`;return[c,c,c]}),i=t.join(`
2
+ AND `),r=y(e,{where:i,params:o,limit:200}),a=d(e,{where:i,params:o,limit:200});return b(r,a)}function Y(e,n,t,o){let i=n.trim(),r=t,a=r.replace(/\(\)$/,""),s=n.toLowerCase(),c=t.toLowerCase(),h=c.replace(/\(\)$/,""),k=e.symbol,v=L(e.symbol),g=Q(e.symbol),A=e.display_name??"",w=e.symbol.toLowerCase(),m=v.toLowerCase(),u=g.toLowerCase(),D=A.toLowerCase(),p=e.relative_path.toLowerCase(),F=/[/:.]/.test(t),$=x(t),_=$?.leaf.toLowerCase(),l=0;return(k===i||k===r)&&(l+=1150),(v===i||v===r)&&(l+=1100),A===a&&(l+=1180),g===a&&(l+=1160),(`${g}()`===i||`${g}()`===r)&&(l+=955),(w===s||w===c)&&(l+=1e3),(m===s||m===c)&&(l+=950),(p===s||p===c)&&(l+=925),(p.endsWith(`/${c}`)||p.endsWith(`/${s}`))&&(l+=875),D===h&&(l+=850),u===h&&(l+=825),(`${u}()`===s||`${u}()`===c)&&(l+=820),(m.endsWith(`:${c}`)||m.endsWith(`:${h}`)||m.endsWith(`:${h}()`))&&(l+=800),w.includes(c)&&(l+=120),m.includes(c)&&(l+=140),p.includes(c)&&(l+=140),D.includes(c)&&(l+=110),o.every(B=>{let R=B.toLowerCase();return w.includes(R)||m.includes(R)||p.includes(R)||D.includes(R)})&&(l+=100+o.length*15),$&&p.includes($.path.toLowerCase())&&(l+=360,_&&(u===_||`${u}()`===_||`${u}()`==`${_}()`)&&(l+=700),I(e.symbol)&&(l+=180)),E(e.symbol)&&u===h&&(l+=60),!F&&K(e.symbol)&&(l-=160),l-=Math.min(50,Math.max(0,e.end_line-e.start_line)),l}function x(e){let n=e.trim().replace(/\\/g,"/"),t=n.lastIndexOf("/");if(t<=0||t===n.length-1)return null;let o=n.slice(t+1).replace(/\(\)$/,"");return!o||o.includes(".")?null:{path:n.slice(0,t),leaf:o}}function N(e){return e.trim().replace(/\(\)$/,"").replace(/\(.*$/,"")}function P(e){let n=N(e),t=n.split(/[^A-Za-z0-9_]+/).map(o=>o.trim()).filter(o=>o.length>0);return t.length>0?[...new Set(t)]:[n]}function ee(e,n,t){let o=n.trim(),i=e.filter(r=>{let a=L(r.symbol),s=(r.display_name??"").trim();return r.symbol===o||a===o||a===t||s===o||s===t||`${s}()`===o||f(r,t)>1||r.relative_path===o});return i.length===0?[]:(i.sort((r,a)=>f(a,t)-f(r,t)||r.end_line-r.start_line-(a.end_line-a.start_line)||r.relative_path.localeCompare(a.relative_path)||r.symbol.localeCompare(a.symbol)),i)}function f(e,n){let t=x(n);if(!t)return 0;let o=e.relative_path.toLowerCase(),i=Q(e.symbol).toLowerCase(),r=t.path.toLowerCase(),a=t.leaf.toLowerCase();return o.includes(r)?i!==a?1:I(e.symbol)?M(e.symbol)===null?5:4:M(e.symbol)===null?3:2:0}export{se as a,O as b,le as c,ce as d};
3
+ //# sourceMappingURL=chunk-YSUD2S7T.js.map
@@ -1,2 +1,2 @@
1
- import{l as u}from"./chunk-WS3Z6W3M.js";function x(e,i){let l=new Map;return e.forEach((t,f)=>{let o=new Set;for(let r of i(t)){if(o.has(r))continue;o.add(r);let n=l.get(r);n?n.push(f):l.set(r,[f])}}),{candidatesFor:(t,f)=>{let o=new Set;for(let r of i(t)){let n=l.get(r);if(n)for(let a of n)a!==f&&o.add(a)}return[...o].sort((r,n)=>r-n)}}}function R(e){let i=c(e.profile?.name),l=()=>{let t=[];i=c(e.profile?.name,e);let f=(r,n)=>{let a=e.profiles[r],s=e.profiles[n];i.candidatePairs+=1,i.comparedPairs+=1;let d=e.compare(a,s);d&&t.push(d)};if(e.filePattern){let r=e.profiles.findIndex(n=>n.file.includes(e.filePattern));if(r>=0){let n=e.profiles[r];for(let a of m(e,r)){let s=e.profiles[a];e.focusFiles&&!e.focusFiles.has(n.file)&&!e.focusFiles.has(s.file)||f(r,a)}}}else if(e.focusFiles?.size!==0){let r=typeof e.overrunFactor=="number"&&Number.isFinite(e.limit)?e.limit*e.overrunFactor:Number.POSITIVE_INFINITY;for(let n=0;n<e.profiles.length;n+=1){let a=e.profiles[n],s=e.focusFiles?.has(a.file)??!1;for(let d of p(e,n))e.focusFiles&&!s&&!e.focusFiles.has(e.profiles[d].file)||f(n,d);if(t.length>r){i.overrunApplied=!0;break}}}t.sort(e.sort??((r,n)=>n.similarity-r.similarity)),i.matchedResults=t.length;let o=t.slice(0,e.limit);return i.emittedResults=o.length,e.onProfile?.({...i}),o};return e.profile?u(`pairwise-profile:${e.profile.name}`,l,()=>({...b(e.profile?.metadata),...i})):l()}function m(e,i){if(e.candidateIndex)return P(e,i,-1);let l=[];for(let t=0;t<e.profiles.length;t+=1)t!==i&&l.push(t);return l}function p(e,i){if(e.candidateIndex)return P(e,i,i);let l=[];for(let t=i+1;t<e.profiles.length;t+=1)l.push(t);return l}function P(e,i,l){let t=e.profiles[i],f=new Set;for(let o of e.candidateIndex?.candidatesFor(t,i,e.profiles)??[])o<=l||o!==i&&(o<0||o>=e.profiles.length||f.add(o));return[...f].sort((o,r)=>o-r)}function c(e,i){return{pipeline:e,profileCount:i?.profiles.length??0,focusedProfileCount:i?.focusFiles?i.profiles.filter(l=>i.focusFiles.has(l.file)).length:0,candidatePairs:0,comparedPairs:0,matchedResults:0,emittedResults:0,candidateIndexApplied:i?.candidateIndex!==void 0,focusApplied:i?.focusFiles!==void 0,filePatternApplied:i?.filePattern!==void 0,overrunApplied:!1}}function b(e){return typeof e=="function"?e():e??{}}export{x as a,R as b};
2
- //# sourceMappingURL=chunk-KJCDEDQW.js.map
1
+ import{s as u}from"./chunk-WFRZGMWJ.js";function x(e,i){let l=new Map;return e.forEach((t,f)=>{let o=new Set;for(let r of i(t)){if(o.has(r))continue;o.add(r);let n=l.get(r);n?n.push(f):l.set(r,[f])}}),{candidatesFor:(t,f)=>{let o=new Set;for(let r of i(t)){let n=l.get(r);if(n)for(let a of n)a!==f&&o.add(a)}return[...o].sort((r,n)=>r-n)}}}function R(e){let i=c(e.profile?.name),l=()=>{let t=[];i=c(e.profile?.name,e);let f=(r,n)=>{let a=e.profiles[r],s=e.profiles[n];i.candidatePairs+=1,i.comparedPairs+=1;let d=e.compare(a,s);d&&t.push(d)};if(e.filePattern){let r=e.profiles.findIndex(n=>n.file.includes(e.filePattern));if(r>=0){let n=e.profiles[r];for(let a of m(e,r)){let s=e.profiles[a];e.focusFiles&&!e.focusFiles.has(n.file)&&!e.focusFiles.has(s.file)||f(r,a)}}}else if(e.focusFiles?.size!==0){let r=typeof e.overrunFactor=="number"&&Number.isFinite(e.limit)?e.limit*e.overrunFactor:Number.POSITIVE_INFINITY;for(let n=0;n<e.profiles.length;n+=1){let a=e.profiles[n],s=e.focusFiles?.has(a.file)??!1;for(let d of p(e,n))e.focusFiles&&!s&&!e.focusFiles.has(e.profiles[d].file)||f(n,d);if(t.length>r){i.overrunApplied=!0;break}}}t.sort(e.sort??((r,n)=>n.similarity-r.similarity)),i.matchedResults=t.length;let o=t.slice(0,e.limit);return i.emittedResults=o.length,e.onProfile?.({...i}),o};return e.profile?u(`pairwise-profile:${e.profile.name}`,l,()=>({...b(e.profile?.metadata),...i})):l()}function m(e,i){if(e.candidateIndex)return P(e,i,-1);let l=[];for(let t=0;t<e.profiles.length;t+=1)t!==i&&l.push(t);return l}function p(e,i){if(e.candidateIndex)return P(e,i,i);let l=[];for(let t=i+1;t<e.profiles.length;t+=1)l.push(t);return l}function P(e,i,l){let t=e.profiles[i],f=new Set;for(let o of e.candidateIndex?.candidatesFor(t,i,e.profiles)??[])o<=l||o!==i&&(o<0||o>=e.profiles.length||f.add(o));return[...f].sort((o,r)=>o-r)}function c(e,i){return{pipeline:e,profileCount:i?.profiles.length??0,focusedProfileCount:i?.focusFiles?i.profiles.filter(l=>i.focusFiles.has(l.file)).length:0,candidatePairs:0,comparedPairs:0,matchedResults:0,emittedResults:0,candidateIndexApplied:i?.candidateIndex!==void 0,focusApplied:i?.focusFiles!==void 0,filePatternApplied:i?.filePattern!==void 0,overrunApplied:!1}}function b(e){return typeof e=="function"?e():e??{}}export{x as a,R as b};
2
+ //# sourceMappingURL=chunk-ZEKBAMCN.js.map
@@ -0,0 +1,2 @@
1
+ import{a as k,b as C}from"./chunk-ZEKBAMCN.js";import{a as V,b as R,c as F,e as o,f as v}from"./chunk-B3X6KU75.js";import{a as B,b as g}from"./chunk-KMVGRIO2.js";import{N as y}from"./chunk-MCNWCJYL.js";function j(e,s={}){let{minSimilarity:m=.45,minSharedBehaviors:t=6,limit:i=20,scope:l,scanLimit:c,filePattern:d,focusFiles:h}=s,u=y(e).vueProfiles({scope:l,minBehaviorTokens:Math.max(3,t),scanLimit:c}).map(r=>({file:r.file,tokens:r.behaviorTokens,profile:r})),n=k(u,r=>r.tokens);return C({profiles:u,limit:i,filePattern:d,focusFiles:h,candidateIndex:n,profile:{name:"vue-composable-candidates"},compare:(r,a)=>T(r,a,m,t),sort:(r,a)=>a.similarity-r.similarity||r.fileA.localeCompare(a.fileA)||r.fileB.localeCompare(a.fileB)})}function T(e,s,m,t){let i=B(e.tokens,s.tokens);if(i.size<t||!P(i))return null;let l=R(e.tokens,s.tokens);if(l<m)return null;let c=o(i,"composable:"),d=o(i,"store:"),h=o(i,"reactivity:"),u=o(i,"lifecycle:"),n=o(i,"request:"),r=o(i,"function:"),a=o(i,"function-verb:"),b=o(i,"template-binding:"),p=o(i,"template-event:"),f=q({sharedComposables:c,sharedStores:d,sharedReactivity:h,sharedLifecycle:u,sharedRequests:n,sharedFunctions:r,sharedFunctionVerbs:a,sharedBindings:b,sharedTemplateEvents:p});return{fileA:e.file,fileB:s.file,similarity:l,tokenCountA:e.tokens.size,tokenCountB:s.tokens.size,sharedTokens:v(i),sharedComposables:c,sharedStores:d,sharedReactivity:h,sharedLifecycle:u,sharedRequests:n,sharedFunctions:r,sharedFunctionVerbs:a,sharedBindings:b,sharedTemplateEvents:p,evidenceClass:f.evidenceClass,actionTier:f.actionTier,evidenceClassReasons:f.reasons,recommendation:f.recommendation,uniqueToA:v(g(e.tokens,s.tokens)).slice(0,25),uniqueToB:v(g(s.tokens,e.tokens)).slice(0,25),reason:S({sharedComposables:c,sharedStores:d,sharedRequests:n,sharedLifecycle:u,sharedFunctions:r,sharedFunctionVerbs:a,sharedBindings:b}),locA:e.profile.totalLines,locB:s.profile.totalLines}}function q(e){return V({genericWords:A,primitiveGroups:[{values:e.sharedReactivity,reasonPrefix:"shared reactivity primitive",bucket:"generic"},{values:e.sharedLifecycle,reasonPrefix:"shared lifecycle primitive",bucket:"generic"}],nameGroups:[{names:e.sharedComposables,label:"shared composable",fallbackBucket:"shared-abstraction"},{names:e.sharedStores,label:"shared store",fallbackBucket:"shared-abstraction"},{names:e.sharedRequests,label:"shared request",fallbackBucket:"generic"},{names:e.sharedFunctions,label:"shared function",fallbackBucket:"generic"},{names:e.sharedFunctionVerbs,label:"shared action verb",fallbackBucket:"generic"},{names:e.sharedBindings,label:"shared binding",fallbackBucket:"generic"},{names:e.sharedTemplateEvents,label:"shared template event",fallbackBucket:"generic"}],recommendation:w})}function w(e){switch(e){case"domain-behavior":return"Review for a shared composable, store, or feature module around the named domain behavior.";case"mixed":return"Separate generic Vue mechanics from domain-specific behavior before extracting a composable.";case"shared-abstraction":return"Review the existing composable/store usage first; extract only if duplicated behavior remains outside it.";case"generic-workflow-scaffolding":return"Treat as support evidence for a repeated workflow shape, not direct composable-extraction evidence."}}function P(e){let s=0,m=0,t=0,i=0,l=0,c=0,d=0;for(let n of e)n.startsWith("composable:")?s+=1:n.startsWith("store:")?m+=1:n.startsWith("request:")?t+=1:n.startsWith("lifecycle:")?i+=1:n.startsWith("function:")?l+=1:n.startsWith("reactivity:")?c+=1:(n.startsWith("function-verb:")||n.startsWith("template-binding:")||n.startsWith("template-event:"))&&(d+=1);let h=s+m,u=h+t+i+l+d;return F([{name:"requests",count:t},{name:"lifecycle",count:i},{name:"functions",count:l},{name:"reusableHooks",count:h},{name:"reactivity",count:c},{name:"namedBehavior",count:u}],[{min:{requests:1,namedBehavior:4},reason:"shared request workflow"},{min:{lifecycle:1,functions:2,namedBehavior:4},reason:"shared lifecycle workflow"},{min:{reusableHooks:2,requests:1,namedBehavior:5},reason:"shared reusable Vue hooks and requests"},{min:{reusableHooks:2,functions:2,namedBehavior:5},reason:"shared reusable Vue hooks and functions"},{min:{functions:2,reactivity:1,namedBehavior:4},reason:"shared reactive functions"}]).pass}function S(e){let s=[];return e.sharedComposables.length&&s.push(`shared composables: ${e.sharedComposables.join(", ")}`),e.sharedStores.length&&s.push(`shared stores: ${e.sharedStores.join(", ")}`),e.sharedRequests.length&&s.push(`shared request helpers: ${e.sharedRequests.join(", ")}`),e.sharedLifecycle.length&&s.push(`shared lifecycle: ${e.sharedLifecycle.join(", ")}`),e.sharedFunctions.length&&s.push(`shared functions: ${e.sharedFunctions.slice(0,6).join(", ")}`),e.sharedFunctionVerbs.length&&s.push(`shared action verbs: ${e.sharedFunctionVerbs.slice(0,6).join(", ")}`),e.sharedBindings.length&&s.push(`shared template bindings: ${e.sharedBindings.slice(0,6).join(", ")}`),s.join("; ")||"shared Vue behavior profile"}var A=new Set(["add","apply","cancel","change","clear","close","composable","create","data","delete","draft","edit","error","fetch","filter","form","item","items","load","loading","name","open","reactive","ref","refresh","remove","request","reset","resource","row","rows","save","saving","search","select","selected","store","submit","toggle","update","use","value","watch"]);export{j as a};
2
+ //# sourceMappingURL=chunk-ZHGUZKJL.js.map