scip-query 0.9.0 → 0.10.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 (263) hide show
  1. package/README.md +115 -58
  2. package/dist/augment-vue-worker.js +1 -1
  3. package/dist/chunk-23FVN4Y5.js +2 -0
  4. package/dist/chunk-24PFLKFK.js +2 -0
  5. package/dist/{chunk-VTF5EH22.js → chunk-27KPKLRJ.js} +2 -2
  6. package/dist/chunk-2NLK4INB.js +2 -0
  7. package/dist/{chunk-TA4DDU7J.js → chunk-2XKAMW6B.js} +2 -2
  8. package/dist/{chunk-PE4EJOLN.js → chunk-332L7SRO.js} +2 -2
  9. package/dist/chunk-44JOJLMO.js +38 -0
  10. package/dist/{chunk-U254PV4S.js → chunk-4EAANIWC.js} +2 -2
  11. package/dist/{chunk-ITUU3VE3.js → chunk-4N7LFYSD.js} +2 -2
  12. package/dist/{chunk-7I6KNKE3.js → chunk-5ALI77D7.js} +2 -2
  13. package/dist/{chunk-V76FCF5F.js → chunk-5BZOSICN.js} +2 -2
  14. package/dist/{chunk-RIXOMSOR.js → chunk-5D3BT4B4.js} +2 -2
  15. package/dist/{chunk-YSSTUCNS.js → chunk-5HDYAOSF.js} +2 -2
  16. package/dist/{chunk-NK7TQQG4.js → chunk-5IDEQEM4.js} +2 -2
  17. package/dist/{chunk-AGW2MVIO.js → chunk-5VB3WU7K.js} +2 -2
  18. package/dist/chunk-623UQCVG.js +2 -0
  19. package/dist/chunk-62NMBOA5.js +2 -0
  20. package/dist/chunk-64LH2QUP.js +62 -0
  21. package/dist/{chunk-PG3ZI5IH.js → chunk-65UWNXEH.js} +1 -1
  22. package/dist/{chunk-NGLRXEWN.js → chunk-6TWFT4Y5.js} +2 -2
  23. package/dist/chunk-6U4EODW3.js +2 -0
  24. package/dist/{chunk-SDGCKEB7.js → chunk-6YKJSETN.js} +2 -2
  25. package/dist/chunk-A2GVUCZR.js +8 -0
  26. package/dist/{chunk-WEJYUS5O.js → chunk-ADKQX2OY.js} +2 -2
  27. package/dist/{chunk-I7OTKWNY.js → chunk-ADTG377O.js} +2 -2
  28. package/dist/chunk-ATGRITZP.js +20 -0
  29. package/dist/chunk-B3HMRQDA.js +2 -0
  30. package/dist/chunk-B75HZHUP.js +2 -0
  31. package/dist/chunk-BGBBVSH4.js +2 -0
  32. package/dist/chunk-BJ7OHKB5.js +2 -0
  33. package/dist/{chunk-VN6B6HFB.js → chunk-CCB45WDY.js} +2 -2
  34. package/dist/chunk-CFLYMEUS.js +2 -0
  35. package/dist/chunk-CMGOXDVP.js +22 -0
  36. package/dist/chunk-DBIG4QAJ.js +2 -0
  37. package/dist/{chunk-RCRK4E7E.js → chunk-DMLPJ75B.js} +2 -2
  38. package/dist/chunk-DRU74YUM.js +71 -0
  39. package/dist/chunk-DTERBKUE.js +7 -0
  40. package/dist/{chunk-EKP7XJ6L.js → chunk-E55WCTLH.js} +2 -2
  41. package/dist/{chunk-ZJ737ZMD.js → chunk-F4PKYBQB.js} +2 -2
  42. package/dist/{chunk-HDA2V5DC.js → chunk-FVX4GEAC.js} +2 -2
  43. package/dist/{chunk-TR5AU6A5.js → chunk-GTNPPGZJ.js} +2 -2
  44. package/dist/{chunk-TFO4OMJZ.js → chunk-GZXXBDJA.js} +2 -2
  45. package/dist/chunk-HCQ7J2N5.js +3 -0
  46. package/dist/chunk-HQHFMPLJ.js +2 -0
  47. package/dist/{chunk-D43L5PQF.js → chunk-I6PTB2CM.js} +2 -2
  48. package/dist/{chunk-VHENVDS2.js → chunk-IJYWCB57.js} +2 -2
  49. package/dist/chunk-JTRY2YRJ.js +2 -0
  50. package/dist/chunk-L77GXANO.js +6 -0
  51. package/dist/{chunk-UUDYI3FF.js → chunk-LT6GJ27X.js} +2 -2
  52. package/dist/chunk-LUBKUISI.js +2 -0
  53. package/dist/{chunk-VQGQHIAT.js → chunk-LVYXX7ZW.js} +2 -2
  54. package/dist/{chunk-3YQO3S5D.js → chunk-LWPEZ4FP.js} +2 -2
  55. package/dist/chunk-LWWZBABT.js +2 -0
  56. package/dist/chunk-LXM7AHQG.js +4 -0
  57. package/dist/chunk-LY6NRJPJ.js +2 -0
  58. package/dist/chunk-LYS4SMAQ.js +2 -0
  59. package/dist/{chunk-7TYJD45F.js → chunk-MESUJJVQ.js} +2 -2
  60. package/dist/{chunk-6HP3BKIP.js → chunk-MHAQXOZY.js} +2 -2
  61. package/dist/chunk-N2T2GPYQ.js +2 -0
  62. package/dist/chunk-OB6PEVI3.js +2 -0
  63. package/dist/chunk-PNN3D4BE.js +2 -0
  64. package/dist/{chunk-46ILZVMX.js → chunk-PV4CEDIL.js} +2 -2
  65. package/dist/chunk-QH5GTVVB.js +3 -0
  66. package/dist/{chunk-WC43FMAB.js → chunk-QOFKVNFE.js} +2 -2
  67. package/dist/chunk-QUKZ77A6.js +4 -0
  68. package/dist/chunk-R42LZMLX.js +2 -0
  69. package/dist/{chunk-GD7XRHSV.js → chunk-R7S3UCDR.js} +2 -2
  70. package/dist/chunk-RGDUIMNE.js +3 -0
  71. package/dist/{chunk-TCCUWKH4.js → chunk-RNLUCQJB.js} +2 -2
  72. package/dist/chunk-RYBMW2EN.js +2 -0
  73. package/dist/{chunk-6ZFKI5EP.js → chunk-SA6B3EGD.js} +2 -2
  74. package/dist/chunk-T67R7V5I.js +2 -0
  75. package/dist/chunk-TMS4JPWY.js +3 -0
  76. package/dist/chunk-TTGWDUJ4.js +5 -0
  77. package/dist/chunk-TUAPDKBI.js +2 -0
  78. package/dist/chunk-UVK3SL4Z.js +2 -0
  79. package/dist/chunk-W3PQRAI4.js +2 -0
  80. package/dist/{chunk-LBAMALDV.js → chunk-WWFBDM5Y.js} +2 -2
  81. package/dist/{chunk-AQYBOORI.js → chunk-WZVTADY7.js} +1 -1
  82. package/dist/chunk-XGGTESMN.js +2 -0
  83. package/dist/{chunk-2DVVHNC3.js → chunk-Y33GRQK6.js} +2 -2
  84. package/dist/{chunk-BCFED24F.js → chunk-YIE5FZAF.js} +2 -2
  85. package/dist/chunk-YISMWW66.js +7 -0
  86. package/dist/chunk-YVQUQIBM.js +5 -0
  87. package/dist/{chunk-Z2AJQ7VA.js → chunk-YYCQQBMG.js} +2 -2
  88. package/dist/cli.js +240 -232
  89. package/dist/{config-types-CGIeLEpY.d.ts → config-types-Bok4jrO3.d.ts} +29 -1
  90. package/dist/{db-DdTPetj5.d.ts → db-BkFlkzI3.d.ts} +1 -1
  91. package/dist/{health-C6r2VgpA.d.ts → health-CbGMdRPg.d.ts} +42 -3
  92. package/dist/index.d.ts +7 -6
  93. package/dist/index.js +1 -1
  94. package/dist/postinstall.js +2 -2
  95. package/dist/queries/affected.d.ts +2 -2
  96. package/dist/queries/affected.js +1 -1
  97. package/dist/queries/bottlenecks.d.ts +2 -2
  98. package/dist/queries/bottlenecks.js +1 -1
  99. package/dist/queries/by-kind.d.ts +2 -2
  100. package/dist/queries/by-kind.js +1 -1
  101. package/dist/queries/call-graph.d.ts +2 -2
  102. package/dist/queries/call-graph.js +1 -1
  103. package/dist/queries/change-surface.d.ts +2 -2
  104. package/dist/queries/change-surface.js +1 -1
  105. package/dist/queries/cleanup-plan.d.ts +2 -2
  106. package/dist/queries/cleanup-plan.js +1 -1
  107. package/dist/queries/co-change.d.ts +5 -4
  108. package/dist/queries/co-change.js +1 -1
  109. package/dist/queries/code.d.ts +2 -2
  110. package/dist/queries/code.js +1 -1
  111. package/dist/queries/complexity-hotspots.d.ts +2 -2
  112. package/dist/queries/complexity-hotspots.js +1 -1
  113. package/dist/queries/complexity.d.ts +2 -2
  114. package/dist/queries/complexity.js +1 -1
  115. package/dist/queries/convergence.d.ts +2 -2
  116. package/dist/queries/convergence.js +1 -1
  117. package/dist/queries/coupling.d.ts +2 -2
  118. package/dist/queries/coupling.js +1 -1
  119. package/dist/queries/cycles.d.ts +2 -2
  120. package/dist/queries/cycles.js +1 -1
  121. package/dist/queries/dataflow.d.ts +2 -2
  122. package/dist/queries/dataflow.js +1 -1
  123. package/dist/queries/dead.d.ts +2 -2
  124. package/dist/queries/dead.js +1 -1
  125. package/dist/queries/deep-chains.d.ts +2 -2
  126. package/dist/queries/deep-chains.js +1 -1
  127. package/dist/queries/deps.d.ts +2 -2
  128. package/dist/queries/deps.js +1 -1
  129. package/dist/queries/diff-gate.d.ts +25 -3
  130. package/dist/queries/diff-gate.js +1 -1
  131. package/dist/queries/diff-impact.d.ts +20 -4
  132. package/dist/queries/diff-impact.js +1 -1
  133. package/dist/queries/doc-drift.d.ts +2 -2
  134. package/dist/queries/doc-drift.js +1 -1
  135. package/dist/queries/drift.d.ts +2 -2
  136. package/dist/queries/drift.js +1 -1
  137. package/dist/queries/extract-candidates.d.ts +2 -2
  138. package/dist/queries/extract-candidates.js +1 -1
  139. package/dist/queries/fan.d.ts +2 -2
  140. package/dist/queries/fan.js +1 -1
  141. package/dist/queries/files.d.ts +2 -2
  142. package/dist/queries/files.js +1 -1
  143. package/dist/queries/health.d.ts +3 -3
  144. package/dist/queries/health.js +1 -1
  145. package/dist/queries/hierarchy.d.ts +2 -2
  146. package/dist/queries/hierarchy.js +1 -1
  147. package/dist/queries/hotspots.d.ts +2 -2
  148. package/dist/queries/hotspots.js +1 -1
  149. package/dist/queries/imports.d.ts +2 -2
  150. package/dist/queries/imports.js +1 -1
  151. package/dist/queries/incomplete-migration.d.ts +4 -2
  152. package/dist/queries/incomplete-migration.js +1 -1
  153. package/dist/queries/index.d.ts +11 -5
  154. package/dist/queries/index.js +1 -1
  155. package/dist/queries/isolated.d.ts +2 -2
  156. package/dist/queries/isolated.js +1 -1
  157. package/dist/queries/members.d.ts +2 -2
  158. package/dist/queries/members.js +1 -1
  159. package/dist/queries/methods.d.ts +2 -2
  160. package/dist/queries/methods.js +1 -1
  161. package/dist/queries/outline.d.ts +2 -2
  162. package/dist/queries/outline.js +1 -1
  163. package/dist/queries/passthrough-candidates.d.ts +2 -2
  164. package/dist/queries/passthrough-candidates.js +1 -1
  165. package/dist/queries/plan-context.d.ts +2 -2
  166. package/dist/queries/plan-context.js +1 -1
  167. package/dist/queries/react-component-duplicates.d.ts +31 -0
  168. package/dist/queries/react-component-duplicates.js +2 -0
  169. package/dist/queries/react-hook-candidates.d.ts +34 -0
  170. package/dist/queries/react-hook-candidates.js +2 -0
  171. package/dist/queries/react-large-component-pressure.d.ts +28 -0
  172. package/dist/queries/react-large-component-pressure.js +2 -0
  173. package/dist/queries/recent-duplicates.d.ts +10 -3
  174. package/dist/queries/recent-duplicates.js +1 -1
  175. package/dist/queries/redundant-reexports.d.ts +2 -2
  176. package/dist/queries/redundant-reexports.js +1 -1
  177. package/dist/queries/refs.d.ts +2 -2
  178. package/dist/queries/refs.js +1 -1
  179. package/dist/queries/self-audit.d.ts +2 -2
  180. package/dist/queries/self-audit.js +1 -1
  181. package/dist/queries/similar-chains.d.ts +2 -2
  182. package/dist/queries/similar-chains.js +1 -1
  183. package/dist/queries/similar-files.d.ts +2 -2
  184. package/dist/queries/similar-files.js +1 -1
  185. package/dist/queries/similar-signatures.d.ts +2 -2
  186. package/dist/queries/similar-signatures.js +1 -1
  187. package/dist/queries/similar.d.ts +8 -3
  188. package/dist/queries/similar.js +1 -1
  189. package/dist/queries/slice.d.ts +2 -2
  190. package/dist/queries/slice.js +1 -1
  191. package/dist/queries/stale-abstractions.d.ts +2 -2
  192. package/dist/queries/stale-abstractions.js +1 -1
  193. package/dist/queries/stats.d.ts +2 -2
  194. package/dist/queries/stats.js +1 -1
  195. package/dist/queries/surface.d.ts +2 -2
  196. package/dist/queries/surface.js +1 -1
  197. package/dist/queries/symbols.d.ts +2 -2
  198. package/dist/queries/symbols.js +1 -1
  199. package/dist/queries/system.d.ts +2 -2
  200. package/dist/queries/system.js +1 -1
  201. package/dist/queries/trace.d.ts +2 -2
  202. package/dist/queries/trace.js +1 -1
  203. package/dist/queries/unused-params.d.ts +2 -2
  204. package/dist/queries/unused-params.js +1 -1
  205. package/dist/queries/vue-component-duplicates.d.ts +35 -0
  206. package/dist/queries/vue-component-duplicates.js +2 -0
  207. package/dist/queries/vue-composable-candidates.d.ts +34 -0
  208. package/dist/queries/vue-composable-candidates.js +2 -0
  209. package/dist/queries/vue-large-view-pressure.d.ts +31 -0
  210. package/dist/queries/vue-large-view-pressure.js +2 -0
  211. package/dist/queries/wrapper-candidates.d.ts +2 -2
  212. package/dist/queries/wrapper-candidates.js +1 -1
  213. package/dist/reindex-worker.js +10 -10
  214. package/dist/reindex.d.ts +1 -1
  215. package/dist/reindex.js +22 -22
  216. package/dist/runtime.d.ts +1 -1
  217. package/dist/runtime.js +2 -2
  218. package/docs/AGENT_GUIDE.md +353 -0
  219. package/docs/AI_FAILURE_MODES.md +278 -0
  220. package/docs/API.md +40 -0
  221. package/docs/COMMAND_REFERENCE.md +130 -0
  222. package/docs/DETECTOR_GUIDE.md +119 -0
  223. package/docs/accuracy-hardening-goal.md +54 -0
  224. package/docs/assets/scip-query-logo-dark.svg +21 -0
  225. package/docs/assets/scip-query-logo.svg +24 -0
  226. package/package.json +31 -3
  227. package/skills/scip-maintainability/SKILL.md +24 -3
  228. package/skills/scip-query/SKILL.md +2 -1
  229. package/skills/scip-react-maintainability/SKILL.md +114 -0
  230. package/skills/scip-vue-maintainability/SKILL.md +130 -0
  231. package/dist/chunk-2Y2WIJI4.js +0 -2
  232. package/dist/chunk-44G4P3GJ.js +0 -2
  233. package/dist/chunk-64UY7VTR.js +0 -63
  234. package/dist/chunk-6G76D2YM.js +0 -2
  235. package/dist/chunk-APLCSDXL.js +0 -4
  236. package/dist/chunk-CVRXOP6M.js +0 -3
  237. package/dist/chunk-EAU4RDFG.js +0 -2
  238. package/dist/chunk-FYT2PE7C.js +0 -2
  239. package/dist/chunk-I66MQD5U.js +0 -2
  240. package/dist/chunk-IBM6FXOQ.js +0 -3
  241. package/dist/chunk-JTCEWV7Q.js +0 -2
  242. package/dist/chunk-K3V6XUTL.js +0 -2
  243. package/dist/chunk-L6TOEQ2M.js +0 -2
  244. package/dist/chunk-LR7E2ATW.js +0 -8
  245. package/dist/chunk-MX6F756F.js +0 -2
  246. package/dist/chunk-NM3BZXHA.js +0 -2
  247. package/dist/chunk-NO2TPMCQ.js +0 -2
  248. package/dist/chunk-OMNT7E2T.js +0 -4
  249. package/dist/chunk-PBGTMPJ7.js +0 -2
  250. package/dist/chunk-PCMVXWDC.js +0 -34
  251. package/dist/chunk-PLFYFZX3.js +0 -2
  252. package/dist/chunk-R3G6ERW7.js +0 -7
  253. package/dist/chunk-SEZZ24IG.js +0 -2
  254. package/dist/chunk-SLX5XBCD.js +0 -7
  255. package/dist/chunk-SOGLYIJ4.js +0 -62
  256. package/dist/chunk-SQ6VENQY.js +0 -6
  257. package/dist/chunk-T4AK46CM.js +0 -16
  258. package/dist/chunk-TH4JVC34.js +0 -71
  259. package/dist/chunk-TQTVM27C.js +0 -6
  260. package/dist/chunk-VDZL45XI.js +0 -2
  261. package/dist/chunk-WQFOZIID.js +0 -4
  262. package/dist/chunk-Y3RUPPIU.js +0 -2
  263. package/dist/chunk-YO6DU7QZ.js +0 -2
@@ -1,4 +1,4 @@
1
- import{a as r}from"./chunk-WC43FMAB.js";import{a as c}from"./chunk-RIXOMSOR.js";import{a as l}from"./chunk-7I6KNKE3.js";import{c as d}from"./chunk-SOGLYIJ4.js";function p(e,t){let o=l(e,t);if(!o)return[];let n=e.get(`SELECT COUNT(DISTINCT c.document_id) AS file_count
1
+ import{a as r}from"./chunk-QOFKVNFE.js";import{a as l}from"./chunk-5ALI77D7.js";import{a as c}from"./chunk-5D3BT4B4.js";import{c as d}from"./chunk-64LH2QUP.js";function p(e,t){let o=l(e,t);if(!o)return[];let n=e.get(`SELECT COUNT(DISTINCT c.document_id) AS file_count
2
2
  FROM mentions m
3
3
  JOIN chunks c ON m.chunk_id = c.id
4
4
  WHERE m.symbol_id = ?
@@ -59,4 +59,4 @@ import{a as r}from"./chunk-WC43FMAB.js";import{a as c}from"./chunk-RIXOMSOR.js";
59
59
  GROUP BY d.id
60
60
  ORDER BY symbol_count DESC
61
61
  LIMIT ?`,o).filter(i=>!e.isIgnored(i.relative_path)).map(i=>({name:i.relative_path,count:i.symbol_count}))}export{p as a,b,y as c,I as d};
62
- //# sourceMappingURL=chunk-TR5AU6A5.js.map
62
+ //# sourceMappingURL=chunk-GTNPPGZJ.js.map
@@ -1,4 +1,4 @@
1
- import{a as g}from"./chunk-WC43FMAB.js";import{b as u}from"./chunk-64UY7VTR.js";import{a as p}from"./chunk-7I6KNKE3.js";import{b as a}from"./chunk-APLCSDXL.js";import{c as l,d as c,h as f}from"./chunk-SOGLYIJ4.js";import{a as d}from"./chunk-NN3O7TPH.js";function J(e,s,t={}){return I(e,s,t)?.map(r=>({symbol:r.symbol,shortName:r.shortName,fromFile:r.fromFile}))??[]}function P(e,s){let t=N(e,s);return t.length>0?t:E(e,s)}function v(e,s,t={}){return I(e,s,t)?.filter(r=>!r.used).map(r=>({symbol:r.symbol,shortName:r.shortName,importedIn:r.importer}))??[]}function N(e,s){return e.all(`SELECT DISTINCT gs.symbol, d.relative_path AS importer
1
+ import{a as g}from"./chunk-QOFKVNFE.js";import{c as u}from"./chunk-QH5GTVVB.js";import{a as p}from"./chunk-5ALI77D7.js";import{b as a}from"./chunk-QUKZ77A6.js";import{c as l,d as c,h as f}from"./chunk-64LH2QUP.js";import{a as d}from"./chunk-NN3O7TPH.js";function J(e,s,t={}){return I(e,s,t)?.map(r=>({symbol:r.symbol,shortName:r.shortName,fromFile:r.fromFile}))??[]}function P(e,s){let t=N(e,s);return t.length>0?t:E(e,s)}function v(e,s,t={}){return I(e,s,t)?.filter(r=>!r.used).map(r=>({symbol:r.symbol,shortName:r.shortName,importedIn:r.importer}))??[]}function N(e,s){return e.all(`SELECT DISTINCT gs.symbol, d.relative_path AS importer
2
2
  FROM mentions m
3
3
  JOIN chunks c ON m.chunk_id = c.id
4
4
  JOIN documents d ON c.document_id = d.id
@@ -32,4 +32,4 @@ import{a as g}from"./chunk-WC43FMAB.js";import{b as u}from"./chunk-64UY7VTR.js";
32
32
  WHERE imp_d.relative_path = ?
33
33
  AND m.role = 2
34
34
  ORDER BY def_d.relative_path, gs.symbol`,s).filter(m=>!e.isIgnored(m.importer));if(o.length>0){let m=t.semantic===!1?[]:u(e,s);return o.map(i=>({symbol:i.symbol,shortName:l(i.symbol),fromFile:i.from_file??"(external)",importer:i.importer,used:i.used!==0||m.some(n=>n.isUsed&&n.sourcePath===i.from_file)}))}return null}function F(e,s){let t=u(e,s);return t.length>0?t.map(r=>{let o=h(r.importedName,r.localName,r.kind);return{symbol:o,shortName:o,fromFile:r.sourcePath??"(external)",importer:s,used:r.kind==="side-effect"?!0:r.isUsed}}):null}function O(e,s){return a(e,s).map(t=>{let r=h(t.importedName,t.localName,t.kind),o=t.kind==="side-effect"?!0:t.used;return{symbol:r,shortName:r,fromFile:t.sourcePath??"(external)",importer:s,used:o}})}function h(e,s,t){return t==="namespace"&&e==="*"&&s?`* as ${s}`:t==="default"&&s?`default as ${s}`:t==="side-effect"?"(side effect import)":s&&s!==e?`${e} as ${s}`:e}function b(e){return e.replace(/\\/g,"/")}function R(e){return/\.(?:c|h|cc|cpp|cxx|hpp|hh|hxx)$/i.test(e)}export{J as a,P as b,v as c};
35
- //# sourceMappingURL=chunk-TFO4OMJZ.js.map
35
+ //# sourceMappingURL=chunk-GZXXBDJA.js.map
@@ -0,0 +1,3 @@
1
+ import{a as f,b as h,e as m,g as x,i as N}from"./chunk-YVQUQIBM.js";import{c as y}from"./chunk-TMS4JPWY.js";import{f as g}from"./chunk-BJ7OHKB5.js";import{extname as S}from"path";var R={".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"};function p(e){return R[S(e).toLowerCase()]??null}function k(e){return S(e).toLowerCase()===".vue"}import{extname as B}from"path";import{parse as $}from"@vue/compiler-sfc";function v(e){let t=$(e),n=t.descriptor.scriptSetup??t.descriptor.script;if(!n||n.src)return null;let s=x(n.lang??null);return s?{body:n.content,startLine:Math.max(0,n.loc.start.line-1),language:s}:null}var b=g("ast-trees",{clearGroups:["whole-project","source-file"]});function _(e,t){if(k(t))return E(e,t);let n=p(t);if(!n)return null;let s=f(e,t);return s?b.get(e,t,s,()=>m(n,s)):null}function E(e,t){let n=f(e,t);return n?b.get(e,t,n,()=>{let s=v(n);if(!s)return null;let r=`
2
+ `.repeat(s.startLine)+s.body;return m(s.language,r)}):null}var O=[".tsx",".jsx"],C=new Set(["useActionState","useCallback","useContext","useDebugValue","useDeferredValue","useEffect","useId","useImperativeHandle","useInsertionEffect","useLayoutEffect","useMemo","useOptimistic","useReducer","useRef","useState","useSyncExternalStore","useTransition"]),J=new Set(["useEffect","useInsertionEffect","useLayoutEffect"]),P=new Set(["useActionState","useOptimistic","useReducer","useRef","useState"]),D=new Set(["useLocation","useNavigate","useParams","useSearchParams","useTranslation"]),V=new Set(["axios","fetch","gql","graphql","mutate","query","request","useMutation","useQuery","useSuspenseQuery"]),q=new Set(["add","apply","cancel","change","clear","close","create","delete","fetch","filter","handle","load","open","refresh","remove","render","reset","save","select","submit","toggle","update"]),I=new Set(["children","className","false","key","null","style","true","undefined"]),Z=new Set(["aria-hidden","className","clipRule","d","fill","fillRule","height","role","stroke","strokeLinecap","strokeLinejoin","strokeWidth","style","viewBox","width","xmlns"]);function Le(e,t={}){let n=y(e,{extensions:O}).filter(r=>!t.scope||r.includes(t.scope)).sort();return(typeof t.scanLimit=="number"&&t.scanLimit>0?n.slice(0,t.scanLimit):n).flatMap(r=>z(e,r)).filter(r=>(t.minJsxTokens===void 0||r.jsxTokens.size>=t.minJsxTokens)&&(t.minBehaviorTokens===void 0||r.behaviorTokens.size>=t.minBehaviorTokens))}function z(e,t){let n=t.replace(/\\/g,"/"),s=H(n);if(!s)return[];let r=_(e,n);if(!r)return[];let o=h(e,n).length;return M(r.rootNode,s).filter(i=>i.kind==="hook"||A(i.bodyNode)).map(i=>{let l=Q(i.bodyNode),u=ne(i.bodyNode,s);return{file:n,name:i.name,kind:i.kind,startLine:i.node.startPosition.row,endLine:i.node.endPosition.row,loc:Math.max(1,i.node.endPosition.row-i.node.startPosition.row+1),fileLines:o,jsxTokens:l.tokens,behaviorTokens:u.tokens,componentNames:c(l.componentNames),nativeTags:c(l.nativeTags),propNames:c(l.propNames),eventNames:c(l.eventNames),hookNames:c(u.hookNames),requestNames:c(u.requestNames),stateNames:c(u.stateNames),effectNames:c(u.effectNames),handlerNames:c(u.handlerNames)}})}function H(e){let t=B(e).toLowerCase();return t!==".tsx"&&t!==".jsx"?null:p(e)}function M(e,t){let n=[],s=new Set,r=o=>{let a=K(o);if(a&&!U(o)){let i=`${a.name}:${a.node.startIndex}:${a.node.endIndex}`;s.has(i)||(s.add(i),n.push(a));return}for(let i of o.namedChildren)r(i)};return(t==="tsx"||t==="javascript")&&r(e),n}function K(e){if(e.type==="function_declaration"){let o=j(e);return!o||!L(o)?null:{name:o,kind:w(o),node:e,bodyNode:e}}if(e.type!=="variable_declarator")return null;let t=e.childForFieldName("name")??e.namedChild(0),n=e.childForFieldName("value")??e.namedChild(1),s=d(t);if(!s||!n||!L(s))return null;let r=W(n);return r?{name:s,kind:w(s),node:e,bodyNode:r}:null}function L(e){return/^[A-Z]/.test(e)||/^use[A-Z0-9_]/.test(e)}function w(e){return/^use[A-Z0-9_]/.test(e)?"hook":"component"}function W(e){if(e.type==="arrow_function"||e.type==="function_expression")return e;if(e.type!=="call_expression")return null;let t=G(e);return t!=="memo"&&t!=="forwardRef"?null:e.namedChildren.find(r=>r.type==="arguments")?.namedChildren.find(r=>r.type==="arrow_function"||r.type==="function_expression")??null}function U(e){let t=e.parent;for(;t;){if(t.type==="function_declaration"||t.type==="function_expression"||t.type==="arrow_function"||t.type==="method_definition")return!0;t=t.parent}return!1}function j(e){return d(e.childForFieldName("name")??e.namedChild(0))}function G(e){let t=e.childForFieldName("function")??e.namedChild(0);return t?t.text.split(".").pop()??t.text:null}function A(e){return e.type.startsWith("jsx_")?!0:e.namedChildren.some(A)}function Q(e){let t={tokens:new Set,componentNames:new Set,nativeTags:new Set,propNames:new Set,eventNames:new Set},n=s=>{s.type==="jsx_opening_element"||s.type==="jsx_self_closing_element"?X(s,t):s.type==="jsx_expression"?Y(s,t):s.type==="jsx_fragment"&&t.tokens.add("jsx:fragment");for(let r of s.namedChildren)n(r)};return n(e),t}function X(e,t){let n=ee(e),s=!1;if(n){let r=T(n);s=ae(r),s?(t.componentNames.add(r),t.tokens.add(`component:${r}`)):(t.nativeTags.add(r),t.tokens.add(`native:${r}`))}for(let r of e.namedChildren)if(r.type==="jsx_attribute"){let o=te(r);if(!o)continue;let a=T(o);if(a.startsWith("on")&&a.length>2){let i=a.slice(2).replace(/^[A-Z]/,l=>l.toLowerCase());t.eventNames.add(i),t.tokens.add(`event:${i}`)}else Z.has(a)||(t.propNames.add(a),t.tokens.add(`${s?"prop":"native-prop"}:${a}`))}else r.type==="jsx_spread_attribute"&&t.tokens.add("prop:spread")}function Y(e,t){let n=e.text;(n.includes("&&")||n.includes("?"))&&t.tokens.add("jsx:conditional"),(n.includes(".map(")||n.includes(".flatMap("))&&t.tokens.add("jsx:list");for(let s of ce(n))I.has(s)||t.tokens.add(`binding:${s}`)}function ee(e){for(let t of e.namedChildren)if(t.type==="identifier"||t.type==="jsx_identifier"||t.type==="property_identifier"||t.type==="member_expression"||t.type==="jsx_member_expression")return t.text;return/^<\s*([A-Za-z][\w$.]*)/.exec(e.text)?.[1]??null}function te(e){for(let t of e.namedChildren)if(t.type==="property_identifier"||t.type==="identifier"||t.type==="jsx_identifier")return t.text;return/^([A-Za-z_$][\w$:-]*)/.exec(e.text)?.[1]??null}function ne(e,t){let n={tokens:new Set,hookNames:new Set,requestNames:new Set,stateNames:new Set,effectNames:new Set,handlerNames:new Set},s=r=>{if(r.type==="call_expression"){let o=N(r,t);o&&se(o.calleeLeaf,n)}else if(r.type==="variable_declarator")oe(r,n);else if(r.type==="function_declaration"){let o=j(r);o&&F(o,n)}for(let o of r.namedChildren)s(o)};return s(e),n}function se(e,t){/^use[A-Z0-9_]/.test(e)&&(t.hookNames.add(e),!C.has(e)&&!D.has(e)&&t.tokens.add(`hook:${e}`)),C.has(e)&&t.tokens.add(`react-hook:${e}`),J.has(e)&&(t.effectNames.add(e),t.tokens.add(`effect:${e}`)),P.has(e)&&t.tokens.add(`state-hook:${e}`),re(e)&&(t.requestNames.add(e),t.tokens.add(`request:${e}`))}function re(e){if(V.has(e))return!0;let t=/^use([A-Z0-9_].*)$/.exec(e)?.[1];return t?/(Query|Mutation|Fetch|Resource)$/.test(t):!1}function oe(e,t){let n=e.childForFieldName("name")??e.namedChild(0),s=e.childForFieldName("value")??e.namedChild(1);if(n?.type==="array_pattern"&&s?.text.includes("useState")){let o=n.namedChildren.find(i=>d(i)),a=d(o);a&&(t.stateNames.add(a),t.tokens.add(`state:${a}`))}let r=d(n);r&&F(r,t)}function F(e,t){let n=ie(e);!n||!q.has(n)||(t.handlerNames.add(e),t.tokens.add(`handler:${e}`),t.tokens.add(`handler-verb:${n}`))}function ie(e){let t=e.startsWith("handle")&&e.length>6?e.slice(6).replace(/^[A-Z]/,n=>n.toLowerCase()):e;return/^[a-z]+/.exec(t)?.[0]??null}function ae(e){return/^[A-Z]/.test(e)||e.includes(".")}function T(e){return e.replace(/^this\./,"").replace(/\$/g,".")}function d(e){return e&&(e.type==="identifier"||e.type==="property_identifier"||e.type==="shorthand_property_identifier"||/^[A-Za-z_$][\w$]*$/.test(e.text))?e.text:null}function ce(e){let t=[];for(let n of e.matchAll(/\b[A-Za-z_$][\w$]*\b/g)){let s=n[0];t.includes(s)||t.push(s)}return t}function c(e){return[...e].sort()}export{p as a,k as b,v as c,_ as d,Le as e};
3
+ //# sourceMappingURL=chunk-HCQ7J2N5.js.map
@@ -0,0 +1,2 @@
1
+ import{a as u}from"./chunk-CFLYMEUS.js";import{a as p,b as l,c as f}from"./chunk-UIWAZ2NT.js";import{e as m}from"./chunk-HCQ7J2N5.js";function v(n,t={}){let{minSimilarity:o=.62,minTokens:e=8,limit:a=20,scope:g,scanLimit:d,filePattern:h}=t,k=m(n,{scope:g,minJsxTokens:e,scanLimit:d}).filter(i=>i.kind==="component").map(i=>({file:i.file,component:i.name,tokens:i.jsxTokens,profile:i}));return u({profiles:k,limit:a,filePattern:h,compare:(i,r)=>P(i,r,o),sort:(i,r)=>r.similarity-i.similarity||i.fileA.localeCompare(r.fileA)||i.componentA.localeCompare(r.componentA)||i.fileB.localeCompare(r.fileB)||i.componentB.localeCompare(r.componentB)})}function P(n,t,o){let e=p(n.tokens,t.tokens);if(e.size<6||!B(e))return null;let a=f(n.tokens,t.tokens);return a<o?null:{fileA:n.file,componentA:n.component,fileB:t.file,componentB:t.component,similarity:a,sharedTokens:c(e),sharedComponents:s(e,"component:"),sharedNativeTags:s(e,"native:"),sharedProps:s(e,"prop:"),sharedEvents:s(e,"event:"),sharedBindings:s(e,"binding:"),uniqueToA:c(l(n.tokens,t.tokens)).slice(0,25),uniqueToB:c(l(t.tokens,n.tokens)).slice(0,25),locA:n.profile.loc,locB:t.profile.loc}}function B(n){let t=0,o=0;for(let e of n)e.startsWith("component:")&&(t+=1),(e.startsWith("prop:")||e.startsWith("event:")||e.startsWith("native:")||e.startsWith("jsx:"))&&(o+=1);return t>=1||o>=4}function s(n,t){return[...n].filter(o=>o.startsWith(t)).map(o=>o.slice(t.length)).sort()}function c(n){return[...n].sort()}export{v as a};
2
+ //# sourceMappingURL=chunk-HQHFMPLJ.js.map
@@ -1,2 +1,2 @@
1
- import{d as i}from"./chunk-MX6F756F.js";import{a as m}from"./chunk-EAU4RDFG.js";import{a}from"./chunk-PCMVXWDC.js";import{a as r}from"./chunk-7I6KNKE3.js";import{c as o}from"./chunk-SOGLYIJ4.js";function S(s,n,c={}){let e=r(s,n);if(!e)return null;let t=c.semantic!==!1,y=m(s,e,{limit:50,semantic:t}),b=i(a(s,e,{limit:50,additive:!0,callableOnly:!0,semantic:t}));return{symbol:e.symbol,shortName:o(e.symbol),callers:y.map(l=>({symbol:l.symbol,shortName:o(l.symbol),file:l.file})),callees:b.map(l=>({symbol:l.symbol,shortName:o(l.symbol),file:l.file}))}}export{S as a};
2
- //# sourceMappingURL=chunk-D43L5PQF.js.map
1
+ import{c as i}from"./chunk-B75HZHUP.js";import{a as m}from"./chunk-623UQCVG.js";import{a}from"./chunk-44JOJLMO.js";import{a as r}from"./chunk-5ALI77D7.js";import{c as o}from"./chunk-64LH2QUP.js";function S(s,n,c={}){let e=r(s,n);if(!e)return null;let t=c.semantic!==!1,y=m(s,e,{limit:50,semantic:t}),b=i(a(s,e,{limit:50,additive:!0,callableOnly:!0,semantic:t}));return{symbol:e.symbol,shortName:o(e.symbol),callers:y.map(l=>({symbol:l.symbol,shortName:o(l.symbol),file:l.file})),callees:b.map(l=>({symbol:l.symbol,shortName:o(l.symbol),file:l.file}))}}export{S as a};
2
+ //# sourceMappingURL=chunk-I6PTB2CM.js.map
@@ -1,2 +1,2 @@
1
- import{a as u}from"./chunk-V76FCF5F.js";import{a as p}from"./chunk-NO2TPMCQ.js";import{c as i}from"./chunk-SOGLYIJ4.js";function x(e,r){let{scope:m,minLoc:o=10,limit:c=30,scanLimit:a}=r??{},s=new p(e);return u({candidates:()=>s.productionCallableDefinitions({scope:m,requireCallableSymbol:!0,includeSuppressed:!0,sortByLocDesc:typeof a=="number"&&a>0}),scanLimit:a,prepare:t=>({callerMap:s.crossFileCallerMap(t,{semantic:r?.semantic!==!1}),calleeMap:s.calleeMap(t,{semantic:r?.semantic!==!1})}),evaluate:(t,n)=>b(t,n,o),orderResults:(t,n)=>n.score-t.score||n.loc-t.loc,limit:c})}function b(e,r,m){let o=e.endLine-e.startLine+1;if(o<m)return null;let c=r.callerMap.get(e.symbolId)?.size??0,a=r.calleeMap.get(e.symbolId)??[],s=a.filter(l=>l.file!==e.relativePath),t=new Set(s.map(l=>`${l.symbol}|${l.file}`)).size,n=new Set(a.map(l=>`${l.symbol}|${l.file}`)).size;return{symbol:e.symbol,shortName:i(e.symbol),file:e.relativePath,startLine:e.startLine,endLine:e.endLine,loc:o,fanIn:c,fanOut:t,calleeCount:n,score:Math.round(o/50*(c/5)*Math.max(t/5,1)*100)/100}}export{x as a};
2
- //# sourceMappingURL=chunk-VHENVDS2.js.map
1
+ import{a as u}from"./chunk-5BZOSICN.js";import{a as p}from"./chunk-W3PQRAI4.js";import{c as i}from"./chunk-64LH2QUP.js";function x(e,r){let{scope:m,minLoc:o=10,limit:c=30,scanLimit:a}=r??{},s=new p(e);return u({candidates:()=>s.productionCallableDefinitions({scope:m,requireCallableSymbol:!0,includeSuppressed:!0,sortByLocDesc:typeof a=="number"&&a>0}),scanLimit:a,prepare:t=>({callerMap:s.crossFileCallerMap(t,{semantic:r?.semantic!==!1}),calleeMap:s.calleeMap(t,{semantic:r?.semantic!==!1})}),evaluate:(t,n)=>b(t,n,o),orderResults:(t,n)=>n.score-t.score||n.loc-t.loc,limit:c})}function b(e,r,m){let o=e.endLine-e.startLine+1;if(o<m)return null;let c=r.callerMap.get(e.symbolId)?.size??0,a=r.calleeMap.get(e.symbolId)??[],s=a.filter(l=>l.file!==e.relativePath),t=new Set(s.map(l=>`${l.symbol}|${l.file}`)).size,n=new Set(a.map(l=>`${l.symbol}|${l.file}`)).size;return{symbol:e.symbol,shortName:i(e.symbol),file:e.relativePath,startLine:e.startLine,endLine:e.endLine,loc:o,fanIn:c,fanOut:t,calleeCount:n,score:Math.round(o/50*(c/5)*Math.max(t/5,1)*100)/100}}export{x as a};
2
+ //# sourceMappingURL=chunk-IJYWCB57.js.map
@@ -0,0 +1,2 @@
1
+ import{e as m}from"./chunk-HCQ7J2N5.js";function v(e,s={}){let{minComponentLines:i=300,minFileLines:o=800,minJsxTokens:a=80,minBehaviorTokens:u=40,limit:c=20,scope:l,scanLimit:L,filePattern:t}=s;return m(e,{scope:l,scanLimit:L}).filter(n=>n.kind==="component").filter(n=>!t||n.file.includes(t)||n.name.includes(t)).map(n=>p(n,{minComponentLines:i,minFileLines:o,minJsxTokens:a,minBehaviorTokens:u})).filter(n=>n!==null).sort((n,r)=>r.componentLines-n.componentLines||r.fileLines-n.fileLines||n.file.localeCompare(r.file)).slice(0,c)}function p(e,s){let i=[];e.loc>=s.minComponentLines&&i.push(`${e.loc} component line(s)`);let o=Math.max(80,Math.floor(s.minComponentLines/2));return e.fileLines>=s.minFileLines&&e.loc>=o&&i.push(`${e.fileLines} file line(s)`),e.jsxTokens.size>=s.minJsxTokens&&i.push(`${e.jsxTokens.size} JSX structure token(s)`),e.behaviorTokens.size>=s.minBehaviorTokens&&i.push(`${e.behaviorTokens.size} behavior token(s)`),i.length===0?null:{file:e.file,component:e.name,componentLines:e.loc,fileLines:e.fileLines,jsxTokens:e.jsxTokens.size,behaviorTokens:e.behaviorTokens.size,dominantPressure:b(e),reasons:i,loc:e.loc}}function b(e){let s=[{axis:"component",value:e.loc},{axis:"file",value:e.fileLines},{axis:"jsx-structure",value:e.jsxTokens.size*3},{axis:"hook-behavior",value:e.behaviorTokens.size*4}];return s.sort((i,o)=>o.value-i.value),s[0]?.axis??"component"}export{v as a};
2
+ //# sourceMappingURL=chunk-JTRY2YRJ.js.map
@@ -0,0 +1,6 @@
1
+ import{a as b}from"./chunk-5D3BT4B4.js";import{a as S}from"./chunk-T67R7V5I.js";import{c as g}from"./chunk-TMS4JPWY.js";import{d as f}from"./chunk-BJ7OHKB5.js";import{existsSync as x,readFileSync as w,readdirSync as E}from"fs";import{join as h}from"path";var $={files:new Set,pathPrefixes:[]},p=/^(?:dist|build|lib|out|output|esm|cjs|umd)\//,v=/\.(?:d\.ts|d\.mts|d\.cts|ts|tsx|mts|cts|js|jsx|mjs|cjs)$/,_=[".ts",".tsx",".mts",".cts",".js",".jsx",".mjs",".cjs"],D=f("package-surface",{clearGroups:["whole-project"]});function T(t){return D.get(t,()=>F(t.config.projectRoot))}function m(t,r){let e=T(t);return e.files.has(r)?!0:e.pathPrefixes.some(s=>r.startsWith(s))}function F(t){let r=O(t);if(!r)return $;let e=new Set,s=[];for(let n of N(r))R(t,n,e,s);return{files:e,pathPrefixes:s}}function O(t){try{let r=w(h(t,"package.json"),"utf-8"),e=JSON.parse(r);return e&&typeof e=="object"?e:null}catch{return null}}function N(t){let r=[];for(let s of["main","module","types","browser"])typeof t[s]=="string"&&r.push(t[s]);let e=t.bin;if(typeof e=="string")r.push(e);else if(e&&typeof e=="object")for(let s of Object.values(e))typeof s=="string"&&r.push(s);return y(t.exports,r),r}function y(t,r){if(typeof t=="string"){r.push(t);return}if(!(!t||typeof t!="object"))for(let e of Object.values(t))y(e,r)}function R(t,r,e,s){let n=r.replace(/\\/g,"/").replace(/^\.\//,"");if(n===""||n.startsWith(".."))return;let i=n.indexOf("*");if(i>=0){let u=n.slice(0,i);for(let c of d(u))c!==""&&s.push(c);return}let o=n.replace(v,"");for(let u of d(o)){u===o&&u===n&&e.add(n);for(let c of _)W(t,e,u+c)}e.add(n)}function d(t){let r=[t];return p.test(t)&&(r.push(t.replace(p,"src/")),r.push(t.replace(p,""))),r}function W(t,r,e){if(r.add(e),!e.startsWith("src/")||x(h(t,e)))return;let s=_.find(c=>e.endsWith(c));if(!s)return;let n=e.slice(0,-s.length),i=n.lastIndexOf("/");if(i<=4)return;let o=n.slice(0,i),u=n.slice(i+1);for(let c of j(t,o,`${u}${s}`))r.add(c)}function j(t,r,e){let s=h(t,r);if(!x(s))return[];let n=[];for(let i of E(s,{withFileTypes:!0})){let o=`${r}/${i.name}`;i.isDirectory()?n.push(...j(t,o,e)):i.isFile()&&i.name===e&&n.push(o)}return n}function l(t){let r=a(t);return L(r)?"test":V(r)?"worker":G(r)?"entry":M(r)?"barrel":"source"}function B(t){return l(t)==="barrel"}function k(t){return C.get(t,()=>{let r=b(t),e=g(t).filter(i=>{let o=l(i);return o==="entry"||o==="worker"}),s=new Set,n=new Set;for(;e.length>0;){let i=e.shift();if(!s.has(i)){s.add(i),l(i)==="barrel"&&n.add(i);for(let o of r.get(i)??[])s.has(o)||e.push(o)}}return n})}var C=f("live-barrels",{clearGroups:["whole-project"]});function I(t,r){return k(t).has(a(r))}function tt(t){let r=k(t);return g(t).filter(e=>B(e)&&!r.has(e)&&!A(t,e))}function A(t,r){let e=a(r),s=S(t,e)?.callables;return s&&s.length>0?!0:(t.get(`SELECT COUNT(*) AS n
2
+ FROM defn_enclosing_ranges der
3
+ JOIN documents d ON d.id = der.document_id
4
+ WHERE d.relative_path = ?
5
+ AND der.end_line - der.start_line >= 2`,e)?.n??0)>0}function et(t,r){let e=l(r);return e==="entry"||e==="worker"||I(t,r)}function rt(t,r,e){let s=a(e);if(m(t,s))return!0;let n=t.config.entryRoots;return n?!!(n.files?.some(i=>a(i)===s)||n.pathPrefixes?.some(i=>s.startsWith(a(i)))||n.qualifiedVars?.some(i=>U(r,i))||n.symbolPatterns?.some(i=>{try{return new RegExp(i).test(r)}catch{return!1}})):!1}function L(t){return!!(/\.(?:test|spec)\.[a-z0-9]+$/i.test(t)||/(?:^|\/)(?:_)?test_[^/]+$/i.test(t)||/(?:^|\/)spec_[^/]+$/i.test(t)||/(?:^|\/)[^/]+_test\.[a-z0-9]+$/i.test(t)||/(?:^|\/)[^/]+_tests\.rs$/i.test(t)||/(?:^|\/)tests\.rs$/i.test(t)||/(?:^|\/)[^/]+_spec\.[a-z0-9]+$/i.test(t)||/(?:^|\/)__tests__\//i.test(t)||/(?:^|\/)test\//i.test(t)||/(?:^|\/)tests\//i.test(t)||/(?:^|\/)__fixtures__\//i.test(t)||/(?:^|\/)__mocks__\//i.test(t)||/(?:^|\/)test-support\//i.test(t)||/(?:^|\/)test-utils\//i.test(t)||/(?:^|\/)testing\//i.test(t))}function V(t){return/(?:^|\/)[^/]*worker\.(?:ts|tsx|js|mjs|cjs|rs|py|go)$/.test(t)}function G(t){let r=t.split("/"),e=r[r.length-1]??t;return e==="cli.ts"||e==="cli.js"||e==="postinstall.ts"||e==="postinstall.js"||e==="main.ts"||e==="main.js"||e==="main.rs"||e==="main.go"||e==="main.py"||e==="build.rs"||e==="lib.rs"||/\bsrc\/bin\/[^/]+\.rs$/.test(t)||/(?:^|\/)examples\/[^/]+\.rs$/.test(t)||/(?:^|\/)tests\/[^/]+\.rs$/.test(t)||/(?:^|\/)benches\/[^/]+\.rs$/.test(t)?!0:e==="index.ts"||e==="index.js"?/(?:^|\/)(?:apps|services)\/[^/]+\/src\/index\.(?:ts|js)$/.test(t)?!0:r.length<=2:!1}function M(t){return t==="index.ts"||t==="index.js"||t.endsWith("/index.ts")||t.endsWith("/index.js")||t.endsWith("/mod.rs")||t.endsWith("/__init__.py")}function a(t){return t.replace(/\\/g,"/")}function U(t,r){let e=r.lastIndexOf("/");if(e<0)return!1;let s=r.slice(0,e),n=r.slice(e+1);return t.includes(P(s)+"/")&&t.includes(P(n)+".")}function P(t){return/^[A-Za-z0-9_$+-]+$/.test(t)?t:"`"+t.replace(/`/g,"``")+"`"}export{l as a,B as b,I as c,tt as d,et as e,rt as f};
6
+ //# sourceMappingURL=chunk-L77GXANO.js.map
@@ -1,4 +1,4 @@
1
- import{a as N}from"./chunk-EAU4RDFG.js";import{a as I,b as S}from"./chunk-7I6KNKE3.js";import{c as h,e as b,r as p,v as g}from"./chunk-SOGLYIJ4.js";function x(o,s,r={}){let{maxDepth:c=5,scope:a}=r,l=I(o,s);if(!l)return[];let u=[],f=new Set([l.symbolId]),m=new Set,t=[l];for(let e=1;e<=c&&t.length!==0;e++){let i=[];for(let y of t)for(let n of D(o,y,a)){let d=`${n.file}|${n.shortName}`;if(n.symbolId!==null){if(f.has(n.symbolId))continue;f.add(n.symbolId)}else if(m.has(d))continue;m.add(d),u.push({symbol:n.symbol,shortName:n.shortName,file:n.file,depth:e}),n.symbolId!==null&&n.symbolMatch&&i.push(n.symbolMatch)}t=i}return u.sort((e,i)=>e.depth-i.depth||e.file.localeCompare(i.file)),u}function D(o,s,r){let c=N(o,s,{limit:500}).filter(t=>!o.isIgnored(t.file)).filter(t=>!r||t.file.includes(r)),a=new Set(c.map(t=>t.file)),l=[];for(let t of M(o,s,r)){if(a.has(t))continue;let e=p(o,t),i=e.length>0?g(e,e[0].startLine):null;l.push({symbol:i?.symbol??t,file:t})}let u=[...c,...l],f=[],m=new Set;for(let t of u){let e=S(o,t.symbol);if(!e){let y=`${t.file}|${t.symbol}`;if(m.has(y))continue;m.add(y),f.push({symbolId:null,symbol:t.symbol,shortName:h(t.symbol),file:t.file,symbolMatch:null});continue}if(e.symbolId===s.symbolId||o.isIgnored(e.relativePath)||!_(e.symbol))continue;let i=`${e.symbolId}|${e.relativePath}`;m.has(i)||(m.add(i),f.push({symbolId:e.symbolId,symbol:e.symbol,shortName:h(e.symbol),file:e.relativePath,symbolMatch:e}))}return f}function M(o,s,r){let c=r?"AND consumer_d.relative_path LIKE ?":"",a=[s.symbolId,s.documentId];return r&&a.push(`%${r}%`),new Set(o.all(`SELECT DISTINCT consumer_d.relative_path
1
+ import{a as N}from"./chunk-623UQCVG.js";import{a as I,b as S}from"./chunk-5ALI77D7.js";import{c as h,e as b,r as p,w as g}from"./chunk-64LH2QUP.js";function x(o,s,r={}){let{maxDepth:c=5,scope:a}=r,l=I(o,s);if(!l)return[];let u=[],f=new Set([l.symbolId]),m=new Set,t=[l];for(let e=1;e<=c&&t.length!==0;e++){let i=[];for(let y of t)for(let n of D(o,y,a)){let d=`${n.file}|${n.shortName}`;if(n.symbolId!==null){if(f.has(n.symbolId))continue;f.add(n.symbolId)}else if(m.has(d))continue;m.add(d),u.push({symbol:n.symbol,shortName:n.shortName,file:n.file,depth:e}),n.symbolId!==null&&n.symbolMatch&&i.push(n.symbolMatch)}t=i}return u.sort((e,i)=>e.depth-i.depth||e.file.localeCompare(i.file)),u}function D(o,s,r){let c=N(o,s,{limit:500}).filter(t=>!o.isIgnored(t.file)).filter(t=>!r||t.file.includes(r)),a=new Set(c.map(t=>t.file)),l=[];for(let t of M(o,s,r)){if(a.has(t))continue;let e=p(o,t),i=e.length>0?g(e,e[0].startLine):null;l.push({symbol:i?.symbol??t,file:t})}let u=[...c,...l],f=[],m=new Set;for(let t of u){let e=S(o,t.symbol);if(!e){let y=`${t.file}|${t.symbol}`;if(m.has(y))continue;m.add(y),f.push({symbolId:null,symbol:t.symbol,shortName:h(t.symbol),file:t.file,symbolMatch:null});continue}if(e.symbolId===s.symbolId||o.isIgnored(e.relativePath)||!_(e.symbol))continue;let i=`${e.symbolId}|${e.relativePath}`;m.has(i)||(m.add(i),f.push({symbolId:e.symbolId,symbol:e.symbol,shortName:h(e.symbol),file:e.relativePath,symbolMatch:e}))}return f}function M(o,s,r){let c=r?"AND consumer_d.relative_path LIKE ?":"",a=[s.symbolId,s.documentId];return r&&a.push(`%${r}%`),new Set(o.all(`SELECT DISTINCT consumer_d.relative_path
2
2
  FROM mentions m
3
3
  JOIN chunks c ON m.chunk_id = c.id
4
4
  JOIN documents consumer_d ON consumer_d.id = c.document_id
@@ -7,4 +7,4 @@ import{a as N}from"./chunk-EAU4RDFG.js";import{a as I,b as S}from"./chunk-7I6KNK
7
7
  AND c.document_id != ?
8
8
  ${o.pathExclusionsFor("consumer_d")}
9
9
  ${c}`,...a).map(l=>l.relative_path).filter(l=>!o.isIgnored(l)))}function _(o){let s=b(o);return s==="method"||s==="type"||o.endsWith("().")}export{x as a};
10
- //# sourceMappingURL=chunk-UUDYI3FF.js.map
10
+ //# sourceMappingURL=chunk-LT6GJ27X.js.map
@@ -0,0 +1,2 @@
1
+ import{b}from"./chunk-B75HZHUP.js";import{a as u}from"./chunk-W3PQRAI4.js";import{a as f}from"./chunk-623UQCVG.js";import{a as c}from"./chunk-44JOJLMO.js";import{c as l}from"./chunk-64LH2QUP.js";function R(o,e={}){let{limit:r=20,scope:s,minFanIn:i=2,minFanOut:n=2,scanLimit:m}=e,p=new u(o);return b(p.productionCallableDefinitions({scope:s,requireCallableSymbol:!0,includeSuppressed:!0,sortByLocDesc:typeof m=="number"&&m>0}),m).map(t=>y(o,t,e.semantic!==!1)).filter(t=>t.fanIn>=i&&t.fanOut>=n).sort((t,a)=>a.score-t.score||a.fanIn-t.fanIn).slice(0,r)}function y(o,e,r){let s=new Set(f(o,e,{limit:500,semantic:r}).map(n=>n.file)).size,i=new Set(c(o,e,{limit:500,semantic:r}).filter(n=>n.file!==e.relativePath).map(n=>`${n.symbol}|${n.file}`)).size;return{symbol:e.symbol,shortName:l(e.symbol),fanIn:s,fanOut:i,score:s*i,definedIn:e.relativePath}}export{R as a};
2
+ //# sourceMappingURL=chunk-LUBKUISI.js.map
@@ -1,2 +1,2 @@
1
- import{a as B}from"./chunk-TCCUWKH4.js";import{a as T}from"./chunk-GD7XRHSV.js";import{a as I}from"./chunk-NK7TQQG4.js";import{a as p}from"./chunk-LBAMALDV.js";import{a as H}from"./chunk-JTCEWV7Q.js";import{a as v}from"./chunk-BCFED24F.js";import{a as F,b as G}from"./chunk-AGW2MVIO.js";import{b as A}from"./chunk-I66MQD5U.js";import{b as P}from"./chunk-R3G6ERW7.js";import{a as k}from"./chunk-YSSTUCNS.js";import{a as b}from"./chunk-UUDYI3FF.js";import{a as D}from"./chunk-D43L5PQF.js";import{a as w}from"./chunk-ITUU3VE3.js";function X(t,e,n={}){let o=n.impactDepth??3,r=n.sliceDepth??3,l=n.semantic,s=!z(e),a=s?I(t,e,{semantic:l}):{definitions:[],referencedBy:[]},m=s?D(t,e,{semantic:l}):null,f=s?k(t,e,{semantic:l}):null,h=s?v(t,e,{semantic:l}):null,y=s?p(t,e,{direction:"backward",maxDepth:r,semantic:l}):null,R=s?p(t,e,{direction:"forward",maxDepth:r,semantic:l}):null,d=s?b(t,e,{maxDepth:o,scope:n.scope}):[],i=w(t,e,{semantic:l}),g=F(t,e),x=G(t,e),u=T(t,e),C=B(t,e),c={symbol:a.definitions.length>0||a.referencedBy.length>0||m!==null||f!==null||h!==null||y!==null||R!==null||d.length>0,file:i!==null||g.length>0||x.length>0,module:u.files.length>0||u.symbols.length>0||C.length>0},S=[];!c.symbol&&!c.file&&!c.module&&S.push("No symbol, file, or module matched target.");let O=i?.file??a.definitions[0]?.relativePath??null;return{target:e,matched:c,history:j(t,O),trace:a,callGraph:m,complexity:f,dataflow:h,backwardSlice:y,forwardSlice:R,affected:d,changeSurface:i,deps:g,rdeps:x,system:u,surface:C,warnings:S}}function j(t,e){let n={available:!1,file:e,churn:null,coChangePartners:[],suppressionsInFile:0};if(!e)return n;let o=P(t);if(!o)return n;let r=A(t,e,{limit:5});return{available:!0,file:e,churn:o.get(e)??{changes:0,fixChanges:0,lastChangedAt:0},coChangePartners:r.findings.map(l=>({file:l.fileA===e?l.fileB:l.fileA,together:l.together,confidence:l.confidence})),suppressionsInFile:H(t).byFile.get(e)??0}}function z(t){return t.includes("/")||t.includes("\\")||/\.[A-Za-z0-9]+(?::\d+(?:-\d+)?)?$/.test(t)}export{X as a};
2
- //# sourceMappingURL=chunk-VQGQHIAT.js.map
1
+ import{a as I}from"./chunk-5IDEQEM4.js";import{a as p}from"./chunk-WWFBDM5Y.js";import{a as B}from"./chunk-RNLUCQJB.js";import{a as T}from"./chunk-R7S3UCDR.js";import{a as H}from"./chunk-24PFLKFK.js";import{a as v}from"./chunk-YIE5FZAF.js";import{a as F,b as G}from"./chunk-5VB3WU7K.js";import{b as A}from"./chunk-RYBMW2EN.js";import{b as P}from"./chunk-YISMWW66.js";import{a as k}from"./chunk-5HDYAOSF.js";import{a as b}from"./chunk-LT6GJ27X.js";import{a as D}from"./chunk-I6PTB2CM.js";import{a as w}from"./chunk-4N7LFYSD.js";function X(t,e,n={}){let o=n.impactDepth??3,r=n.sliceDepth??3,l=n.semantic,s=!z(e),a=s?I(t,e,{semantic:l}):{definitions:[],referencedBy:[]},m=s?D(t,e,{semantic:l}):null,f=s?k(t,e,{semantic:l}):null,h=s?v(t,e,{semantic:l}):null,y=s?p(t,e,{direction:"backward",maxDepth:r,semantic:l}):null,R=s?p(t,e,{direction:"forward",maxDepth:r,semantic:l}):null,d=s?b(t,e,{maxDepth:o,scope:n.scope}):[],i=w(t,e,{semantic:l}),g=F(t,e),x=G(t,e),u=T(t,e),C=B(t,e),c={symbol:a.definitions.length>0||a.referencedBy.length>0||m!==null||f!==null||h!==null||y!==null||R!==null||d.length>0,file:i!==null||g.length>0||x.length>0,module:u.files.length>0||u.symbols.length>0||C.length>0},S=[];!c.symbol&&!c.file&&!c.module&&S.push("No symbol, file, or module matched target.");let O=i?.file??a.definitions[0]?.relativePath??null;return{target:e,matched:c,history:j(t,O),trace:a,callGraph:m,complexity:f,dataflow:h,backwardSlice:y,forwardSlice:R,affected:d,changeSurface:i,deps:g,rdeps:x,system:u,surface:C,warnings:S}}function j(t,e){let n={available:!1,file:e,churn:null,coChangePartners:[],suppressionsInFile:0};if(!e)return n;let o=P(t);if(!o)return n;let r=A(t,e,{limit:5});return{available:!0,file:e,churn:o.get(e)??{changes:0,fixChanges:0,lastChangedAt:0},coChangePartners:r.findings.map(l=>({file:l.fileA===e?l.fileB:l.fileA,together:l.together,confidence:l.confidence})),suppressionsInFile:H(t).byFile.get(e)??0}}function z(t){return t.includes("/")||t.includes("\\")||/\.[A-Za-z0-9]+(?::\d+(?:-\d+)?)?$/.test(t)}export{X as a};
2
+ //# sourceMappingURL=chunk-LVYXX7ZW.js.map
@@ -1,2 +1,2 @@
1
- import{a as m}from"./chunk-NO2TPMCQ.js";import{a as l}from"./chunk-7I6KNKE3.js";import{d as o,f as a}from"./chunk-SOGLYIJ4.js";import{basename as d}from"path";function M(t,c){let n=l(t,c);if(!n)return[];let r=o(n.symbol),s=new m(t).definitionsForFile(n.relativePath).filter(e=>a(e.symbol)),i=s.filter(e=>e.parentTypeName===r||e.symbol.includes(r));return(i.length>0?i:p(d(n.relativePath))===r?s.filter(e=>e.symbol.includes("<invalid-global-code>")):[]).map(e=>({startLine:e.startLine,endLine:e.endLine,name:o(e.symbol)}))}function p(t){return t.replace(/\.[^.]+$/,"")}export{M as a};
2
- //# sourceMappingURL=chunk-3YQO3S5D.js.map
1
+ import{a as m}from"./chunk-W3PQRAI4.js";import{a as l}from"./chunk-5ALI77D7.js";import{d as o,f as a}from"./chunk-64LH2QUP.js";import{basename as d}from"path";function M(t,c){let n=l(t,c);if(!n)return[];let r=o(n.symbol),s=new m(t).definitionsForFile(n.relativePath).filter(e=>a(e.symbol)),i=s.filter(e=>e.parentTypeName===r||e.symbol.includes(r));return(i.length>0?i:p(d(n.relativePath))===r?s.filter(e=>e.symbol.includes("<invalid-global-code>")):[]).map(e=>({startLine:e.startLine,endLine:e.endLine,name:o(e.symbol)}))}function p(t){return t.replace(/\.[^.]+$/,"")}export{M as a};
2
+ //# sourceMappingURL=chunk-LWPEZ4FP.js.map
@@ -0,0 +1,2 @@
1
+ import{a as d}from"./chunk-CFLYMEUS.js";import{c as a}from"./chunk-UIWAZ2NT.js";import{a as c}from"./chunk-5D3BT4B4.js";function F(t,e={}){let{minSimilarity:o=.5,limit:l=20,scope:n,filePattern:f}=e,r=e.minDeps??(f?1:3),{profiles:s,distinctiveDeps:p}=m(t,{scope:n,minDeps:r});return d({profiles:s,limit:l,filePattern:f,overrunFactor:5,compare:(i,u)=>D(i,u,o,p)})}function m(t,e){let{scope:o,minDeps:l}=e,n=c(t,o),{universalDeps:f,distinctiveDeps:r}=g(n),s=[];for(let[p,i]of n)i.size>=l&&s.push({file:p,deps:new Set([...i].filter(u=>!f.has(u)))});return{profiles:s,distinctiveDeps:r}}function g(t){let e=new Set,o=new Set,l=t.size;if(l===0)return{universalDeps:e,distinctiveDeps:o};let n=new Map;for(let r of t.values())for(let s of r)n.set(s,(n.get(s)??0)+1);let f=Math.max(3,Math.ceil(l*.03));for(let[r,s]of n)s>=5&&s/l>.3?e.add(r):s<=f&&o.add(r);return{universalDeps:e,distinctiveDeps:o}}function D(t,e,o,l){let n=new Set;for(let i of t.deps)e.deps.has(i)&&n.add(i);if(n.size<3||t.deps.size<4||e.deps.size<4)return null;let f=0;for(let i of n)l.has(i)&&f++;if(f<2)return null;let r=a(t.deps,e.deps);if(r<o)return null;let s=[];for(let i of t.deps)e.deps.has(i)||s.push(i);let p=[];for(let i of e.deps)t.deps.has(i)||p.push(i);return{fileA:t.file,fileB:e.file,similarity:r,sharedDeps:[...n],uniqueToA:s,uniqueToB:p}}export{F as a};
2
+ //# sourceMappingURL=chunk-LWWZBABT.js.map
@@ -0,0 +1,4 @@
1
+ import{a as h,b as F,c as w}from"./chunk-PNN3D4BE.js";import{a as M}from"./chunk-5BZOSICN.js";import{a as P}from"./chunk-W3PQRAI4.js";import{a as S,f as D}from"./chunk-L77GXANO.js";import{a as b}from"./chunk-BGBBVSH4.js";import{a as L,c as v,d as p}from"./chunk-64LH2QUP.js";import{e as I}from"./chunk-T67R7V5I.js";import{a as y}from"./chunk-YVQUQIBM.js";function ie(t,e){let{scope:n,minLoc:i=3,maxLoc:s=80,limit:r=30,includeLowConfidence:l=!1,scanLimit:a}=e??{},f=e?.semantic!==!1,o=new P(t),d=o.scopedDefinitions(n),g=V(o,n),x={high:0,medium:1,low:2};return M({candidates:()=>$(t,o,d,{minLoc:i,maxLoc:s}),orderCandidates:(c,u)=>b(u)-b(c)||c.relativePath.localeCompare(u.relativePath),scanLimit:a,prepare:c=>({consumerFileMap:A(o,c,{semantic:f}),singletonBackedClassIds:O(t,o,d,c,{semantic:f}),candidateIndex:B(c)}),evaluate:(c,u)=>{if(u.singletonBackedClassIds.has(c.symbolId))return null;let m=N(t,c,u.consumerFileMap,u.candidateIndex);if(m.transitivelyReachable||m.realConsumers.length>1||m.realConsumers.length===0&&m.barrelConsumers>0||!Z(m.definition,m.realConsumers.length,g))return null;let C=j(t,m);return!l&&C.confidence==="low"?null:C},orderResults:(c,u)=>x[c.confidence]-x[u.confidence]||u.loc-c.loc||c.file.localeCompare(u.file)||c.startLine-u.startLine,limit:r})}function $(t,e,n,i){return n.filter(s=>s.isTypeLike&&b(s)>=i.minLoc).filter(s=>b(s)<=i.maxLoc).filter(s=>!t.isIgnored(s.relativePath)).filter(s=>S(s.relativePath)!=="test").filter(s=>!D(t,s.symbol,s.relativePath)).filter(s=>!H(s.symbol)).filter(s=>!e.hasSuppressionComment(s))}function A(t,e,n){return h(t,e,{semantic:n.semantic})}function B(t){let e=new Map;for(let n of t){let i=e.get(n.relativePath);i||(i=new Map,e.set(n.relativePath,i));let s=p(n.symbol);s&&i.set(s,n)}return e}function N(t,e,n,i){let r=[...n.get(e.symbolId)??new Set].filter(d=>d!==e.relativePath&&!t.isIgnored(d)),{realConsumers:l,barrelConsumers:a,importOnlyConsumers:f}=F(t,e,r),o=_(t,e,n,i);return{definition:e,realConsumers:l,barrelConsumers:a+f,transitivelyReachable:o}}function j(t,e){let n=k(t,e.definition.relativePath,e.definition.startLine),i=T(e.definition.relativePath)?!0:q(t,e.definition),{confidence:s,reason:r}=G(e.realConsumers.length,n,i);return{symbol:e.definition.symbol,shortName:v(e.definition.symbol),file:e.definition.relativePath,startLine:e.definition.startLine,endLine:e.definition.endLine,loc:b(e.definition),consumers:e.realConsumers.length,barrelConsumers:e.barrelConsumers,kind:n,definerUsesType:i,confidence:s,reason:r}}function O(t,e,n,i,s){let r=W(t,U(n),i),l=r.map(o=>o.singleton);if(r.length===0)return new Set;let a=h(e,l,{semantic:s.semantic}),f=new Set;for(let{singleton:o,classId:d}of r)E(t,o,a)&&f.add(d);return f}function U(t){let e=new Map;for(let n of t){let i=p(n.symbol);i&&e.set(R(n.relativePath,i),n)}return e}function W(t,e,n){let i=[];for(let s of n){let r=z(t,e,s);r&&i.push({singleton:r,classId:s.symbolId})}return i}function z(t,e,n){if(k(t,n.relativePath,n.startLine)!=="class")return null;let i=p(n.symbol);if(!i)return null;let s=K(t,n.relativePath,i);return s?e.get(R(n.relativePath,s))??null:null}function E(t,e,n){let i=p(e.symbol),s=n.get(e.symbolId);return!i||!s?!1:[...s].some(r=>r!==e.relativePath&&!t.isIgnored(r)&&!w(t,r,i))}function R(t,e){return`${t}\0${e}`}function K(t,e,n){let i=y(t,e);if(!i)return null;let s=n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),r=new RegExp(`\\bexport\\s+const\\s+([A-Za-z_$][\\w$]*)\\s*=\\s*new\\s+${s}\\s*\\(`);return i.match(r)?.[1]??null}function V(t,e){return new Set(t.scopedDefinitions(e).filter(n=>n.isFunctionLike).map(n=>n.relativePath))}function H(t){let e=L(t);if("kind"in e)return!1;let n=e.descriptors;if(n.length<2)return!1;let i=n[n.length-1],s=n[n.length-2];return i?.suffix==="type"&&s?.suffix==="type"}function T(t){let n=(t.split("/").pop()??"").replace(/\.[^.]+$/,"");return!!(n==="types"||n.endsWith("-types")||n==="models"||n==="schema"||n==="common"||n==="protocol"||n==="proto"||n==="dto"||n==="mod"||n==="contracts"||/(^|\/)types(\/|\.)/.test(t)||/(^|\/)models?(\/|\.)/.test(t)||/(^|\/)proto(?:col)?(\/|\.)/.test(t)||/(^|\/)schema(\/|\.)/.test(t)||/(^|\/)contracts?(\/|\.)/.test(t))}function Z(t,e,n){return!(T(t.relativePath)&&e>0||e===0&&n.has(t.relativePath))}function _(t,e,n,i){let s=I(t,e.relativePath),r=p(e.symbol);if(!r)return!1;let l=s.get(r);if(!l||l.size===0)return!1;let a=i.get(e.relativePath);if(!a)return!1;for(let f of l){let o=a.get(f);if(!o)continue;let d=n.get(o.symbolId);if(d){for(let g of d)if(g!==e.relativePath&&!t.isIgnored(g))return!0}}return!1}function k(t,e,n){let i=y(t,e);if(!i)return"other";let s=i.split(`
2
+ `),r=Math.max(0,n-2),l=Math.min(s.length-1,n+2);for(let a=r;a<=l;a++){let o=(s[a]??"").replace(/^\s*\/\/.*$/g,"");if(/\b(?:export\s+)?(?:abstract\s+)?class\s+\w/.test(o))return"class";if(/\b(?:export\s+)?interface\s+\w/.test(o))return"interface";if(/\b(?:export\s+)?type\s+\w/.test(o))return"type";if(/\b(?:export\s+)?(?:const\s+)?enum\s+\w/.test(o))return"enum"}return"other"}function q(t,e){let n=y(t,e.relativePath);if(!n)return!1;let i=p(e.symbol);if(!i)return!1;let s=i.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),r=new RegExp(`\\b${s}\\b`),l=n.split(`
3
+ `);for(let a=0;a<l.length;a++)if(!(a>=e.startLine&&a<=e.endLine)&&r.test(l[a]??""))return!0;return!1}function G(t,e,n){return t===0?{confidence:"high",reason:"unused \u2014 no consumers and defining file has no real usage"}:t===1&&e==="class"?{confidence:"low",reason:"1 consumer + class kind \u2014 likely 1:1 encapsulation, not over-abstraction"}:t===1&&!n?{confidence:"high",reason:"1 consumer + defining file never uses it \u2014 type belongs with its consumer"}:{confidence:"medium",reason:"1 consumer \u2014 single-use abstraction"}}export{ie as a};
4
+ //# sourceMappingURL=chunk-LXM7AHQG.js.map
@@ -0,0 +1,2 @@
1
+ import{a as H}from"./chunk-CFLYMEUS.js";import{a as f,b as m,c as R}from"./chunk-UIWAZ2NT.js";import{e as p}from"./chunk-HCQ7J2N5.js";function A(e,s={}){let{minSimilarity:o=.45,minSharedBehaviors:i=6,limit:n=20,scope:a,scanLimit:l,filePattern:h}=s,d=p(e,{scope:a,minBehaviorTokens:Math.max(3,i),scanLimit:l}).map(t=>({file:t.file,component:t.name,tokens:t.behaviorTokens,profile:t}));return H({profiles:d,limit:n,filePattern:h,compare:(t,r)=>B(t,r,o,i),sort:(t,r)=>r.similarity-t.similarity||t.fileA.localeCompare(r.fileA)||t.componentA.localeCompare(r.componentA)||t.fileB.localeCompare(r.fileB)||t.componentB.localeCompare(r.componentB)})}function B(e,s,o,i){let n=f(e.tokens,s.tokens);if(n.size<i||!y(n))return null;let a=v(e.tokens,s.tokens);if(a<o)return null;let l=c(n,"hook:"),h=c(n,"react-hook:"),d=c(n,"effect:"),t=c(n,"state:"),r=c(n,"request:"),g=c(n,"handler:"),k=c(n,"handler-verb:");return{fileA:e.file,componentA:e.component,fileB:s.file,componentB:s.component,similarity:a,sharedTokens:u(n),sharedHooks:l,sharedReactHooks:h,sharedEffects:d,sharedState:t,sharedRequests:r,sharedHandlers:g,sharedHandlerVerbs:k,uniqueToA:u(m(e.tokens,s.tokens)).slice(0,25),uniqueToB:u(m(s.tokens,e.tokens)).slice(0,25),reason:S({sharedHooks:l,sharedReactHooks:h,sharedEffects:d,sharedState:t,sharedRequests:r,sharedHandlers:g,sharedHandlerVerbs:k}),locA:e.profile.loc,locB:s.profile.loc}}function v(e,s){if(e.size===0||s.size===0)return 0;let i=f(e,s).size/Math.min(e.size,s.size);return Math.max(R(e,s),i)}function y(e){let s=0,o=0,i=0,n=0,a=0,l=0,h=0;for(let r of e)r.startsWith("hook:")?s+=1:r.startsWith("react-hook:")?o+=1:r.startsWith("effect:")?i+=1:r.startsWith("request:")?n+=1:r.startsWith("handler:")||r.startsWith("handler-verb:")?a+=1:r.startsWith("state:")?l+=1:r.startsWith("state-hook:")&&(h+=1);let d=l+h,t=s+o+i+n+a+d;return n>=1&&t>=4||s>=1&&(n>=1||l>=1||a>=2)&&t>=5||l>=1&&a>=2&&(i>=1||o>=2)&&t>=5}function S(e){let s=[];return e.sharedHooks.length&&s.push(`shared hooks: ${e.sharedHooks.join(", ")}`),e.sharedReactHooks.length&&s.push(`shared React hooks: ${e.sharedReactHooks.join(", ")}`),e.sharedEffects.length&&s.push(`shared effects: ${e.sharedEffects.join(", ")}`),e.sharedState.length&&s.push(`shared state: ${e.sharedState.join(", ")}`),e.sharedRequests.length&&s.push(`shared requests: ${e.sharedRequests.join(", ")}`),e.sharedHandlers.length&&s.push(`shared handlers: ${e.sharedHandlers.slice(0,6).join(", ")}`),e.sharedHandlerVerbs.length&&s.push(`shared action verbs: ${e.sharedHandlerVerbs.slice(0,6).join(", ")}`),s.join("; ")||"shared React behavior profile"}function c(e,s){return[...e].filter(o=>o.startsWith(s)).map(o=>o.slice(s.length)).sort()}function u(e){return[...e].sort()}export{A as a};
2
+ //# sourceMappingURL=chunk-LY6NRJPJ.js.map
@@ -0,0 +1,2 @@
1
+ import{a as b}from"./chunk-5BZOSICN.js";import{a as g}from"./chunk-W3PQRAI4.js";import{a as d}from"./chunk-SA6B3EGD.js";import{c as p}from"./chunk-64LH2QUP.js";import{a as c}from"./chunk-T67R7V5I.js";import{a as o}from"./chunk-HCQ7J2N5.js";function T(t,r={}){let{scope:l,limit:s=30,scanLimit:f}=r,u=r.files===void 0?null:new Set(r.files),L=new g(t);return b({candidates:()=>L.productionCallableDefinitions({scope:l,minLoc:2,excludeRootedSymbols:!0,requireFunctionLikeSymbol:!0}).filter(e=>h(e.relativePath)&&(u===null||u.has(e.relativePath))),scanLimit:f,evaluate:e=>{let n=c(t,e.relativePath)?.callables.find(a=>a.startLine===e.startLine&&a.endLine===e.endLine);if(!n||n.params.length===0||n.params.some(a=>!a.simple)||n.paramsEndLine>=n.endLine)return null;let y=d(t,e.relativePath),m=[];for(let a=n.params.length-1;a>=0;a--){let i=n.params[a];if(i.name===""||i.name.startsWith("_")||P(y.get(i.name),n.paramsEndLine,n.endLine))break;m.unshift(i.name)}return m.length===0?null:{symbol:e.symbol,shortName:p(e.symbol),file:e.relativePath,startLine:e.startLine,endLine:e.endLine,paramCount:n.paramCount,unusedTrailing:m}},orderResults:(e,n)=>n.unusedTrailing.length-e.unusedTrailing.length||e.file.localeCompare(n.file)||e.startLine-n.startLine,limit:s})}function h(t){let r=o(t);return r==="typescript"||r==="tsx"||r==="javascript"}function P(t,r,l){return t?t.some(s=>s>r&&s<=l):!1}export{T as a};
2
+ //# sourceMappingURL=chunk-LYS4SMAQ.js.map
@@ -1,4 +1,4 @@
1
- import{a as d}from"./chunk-EAU4RDFG.js";import{c as r,s as l}from"./chunk-SOGLYIJ4.js";function b(o,t={}){let{limit:n=30,scope:e}=t,i=e?`AND def_d.relative_path LIKE '%${e}%'`:"",m=o.all(`SELECT
1
+ import{a as d}from"./chunk-623UQCVG.js";import{c as r,s as l}from"./chunk-64LH2QUP.js";function b(o,t={}){let{limit:n=30,scope:e}=t,i=e?`AND def_d.relative_path LIKE '%${e}%'`:"",m=o.all(`SELECT
2
2
  gs.symbol,
3
3
  COUNT(*) AS ref_count,
4
4
  COUNT(DISTINCT ref_d.id) AS file_count,
@@ -22,4 +22,4 @@ import{a as d}from"./chunk-EAU4RDFG.js";import{c as r,s as l}from"./chunk-SOGLYI
22
22
  GROUP BY gs.id
23
23
  ORDER BY ref_count DESC
24
24
  LIMIT ?`,n).filter(s=>!o.isIgnored(s.defined_in)).map(s=>({symbol:s.symbol,shortName:r(s.symbol),refCount:s.ref_count,fileCount:s.file_count,definedIn:s.defined_in}));return m.length>0?m:f(o,e,n)}function f(o,t,n){return l(o,{scope:t}).filter(e=>!o.isIgnored(e.relativePath)).map(e=>u(o,e)).filter(e=>e.refCount>0).sort((e,i)=>i.refCount-e.refCount||i.fileCount-e.fileCount).slice(0,n)}function u(o,t){let n=d(o,t,{limit:500});return{symbol:t.symbol,shortName:r(t.symbol),refCount:n.length,fileCount:new Set(n.map(e=>e.file)).size,definedIn:t.relativePath}}export{b as a};
25
- //# sourceMappingURL=chunk-7TYJD45F.js.map
25
+ //# sourceMappingURL=chunk-MESUJJVQ.js.map
@@ -1,2 +1,2 @@
1
- import{a}from"./chunk-NO2TPMCQ.js";import{a as i}from"./chunk-7I6KNKE3.js";import{c as s,e as o,k as m}from"./chunk-SOGLYIJ4.js";function L(t,l){let r=i(t,l);return r?new a(t).definitionsForFile(r.relativePath).filter(e=>e.symbol!==r.symbol).filter(e=>m(r.symbol,e.symbol)).sort((e,n)=>e.startLine-n.startLine||e.endLine-n.endLine).map(e=>({symbol:e.symbol,shortName:s(e.symbol),startLine:e.startLine,endLine:e.endLine,kind:o(e.symbol)??"unknown"})):[]}export{L as a};
2
- //# sourceMappingURL=chunk-6HP3BKIP.js.map
1
+ import{a}from"./chunk-W3PQRAI4.js";import{a as i}from"./chunk-5ALI77D7.js";import{c as s,e as o,k as m}from"./chunk-64LH2QUP.js";function L(t,l){let r=i(t,l);return r?new a(t).definitionsForFile(r.relativePath).filter(e=>e.symbol!==r.symbol).filter(e=>m(r.symbol,e.symbol)).sort((e,n)=>e.startLine-n.startLine||e.endLine-n.endLine).map(e=>({symbol:e.symbol,shortName:s(e.symbol),startLine:e.startLine,endLine:e.endLine,kind:o(e.symbol)??"unknown"})):[]}export{L as a};
2
+ //# sourceMappingURL=chunk-MHAQXOZY.js.map
@@ -0,0 +1,2 @@
1
+ import{a as B}from"./chunk-CFLYMEUS.js";import{a as d,b as f,c as y}from"./chunk-UIWAZ2NT.js";import{c as b}from"./chunk-XGGTESMN.js";function T(e,i={}){let{minSimilarity:n=.45,minSharedBehaviors:o=6,limit:s=20,scope:a,scanLimit:h,filePattern:c}=i,u=b(e,{scope:a,minBehaviorTokens:Math.max(3,o),scanLimit:h}).map(r=>({file:r.file,tokens:r.behaviorTokens,profile:r}));return B({profiles:u,limit:s,filePattern:c,compare:(r,t)=>C(r,t,n,o),sort:(r,t)=>t.similarity-r.similarity||r.fileA.localeCompare(t.fileA)||r.fileB.localeCompare(t.fileB)})}function C(e,i,n,o){let s=d(e.tokens,i.tokens);if(s.size<o||!S(s))return null;let a=P(e.tokens,i.tokens);if(a<n)return null;let h=l(s,"composable:"),c=l(s,"store:"),u=l(s,"reactivity:"),r=l(s,"lifecycle:"),t=l(s,"request:"),g=l(s,"function:"),p=l(s,"function-verb:"),v=l(s,"template-binding:"),k=l(s,"template-event:");return{fileA:e.file,fileB:i.file,similarity:a,sharedTokens:m(s),sharedComposables:h,sharedStores:c,sharedReactivity:u,sharedLifecycle:r,sharedRequests:t,sharedFunctions:g,sharedFunctionVerbs:p,sharedBindings:v,sharedTemplateEvents:k,uniqueToA:m(f(e.tokens,i.tokens)).slice(0,25),uniqueToB:m(f(i.tokens,e.tokens)).slice(0,25),reason:V({sharedComposables:h,sharedStores:c,sharedRequests:t,sharedLifecycle:r,sharedFunctions:g,sharedFunctionVerbs:p,sharedBindings:v}),locA:e.profile.totalLines,locB:i.profile.totalLines}}function P(e,i){if(e.size===0||i.size===0)return 0;let o=d(e,i).size/Math.min(e.size,i.size);return Math.max(y(e,i),o)}function S(e){let i=0,n=0,o=0,s=0,a=0,h=0,c=0;for(let t of e)t.startsWith("composable:")?i+=1:t.startsWith("store:")?n+=1:t.startsWith("request:")?o+=1:t.startsWith("lifecycle:")?s+=1:t.startsWith("function:")?a+=1:t.startsWith("reactivity:")?h+=1:(t.startsWith("function-verb:")||t.startsWith("template-binding:")||t.startsWith("template-event:"))&&(c+=1);let u=i+n,r=u+o+s+a+c;return o>=1&&r>=4||s>=1&&a>=2&&r>=4||u>=2&&(o>=1||a>=2)&&r>=5||a>=2&&h>=1&&r>=4}function V(e){let i=[];return e.sharedComposables.length&&i.push(`shared composables: ${e.sharedComposables.join(", ")}`),e.sharedStores.length&&i.push(`shared stores: ${e.sharedStores.join(", ")}`),e.sharedRequests.length&&i.push(`shared request helpers: ${e.sharedRequests.join(", ")}`),e.sharedLifecycle.length&&i.push(`shared lifecycle: ${e.sharedLifecycle.join(", ")}`),e.sharedFunctions.length&&i.push(`shared functions: ${e.sharedFunctions.slice(0,6).join(", ")}`),e.sharedFunctionVerbs.length&&i.push(`shared action verbs: ${e.sharedFunctionVerbs.slice(0,6).join(", ")}`),e.sharedBindings.length&&i.push(`shared template bindings: ${e.sharedBindings.slice(0,6).join(", ")}`),i.join("; ")||"shared Vue behavior profile"}function l(e,i){return[...e].filter(n=>n.startsWith(i)).map(n=>n.slice(i.length)).sort()}function m(e){return[...e].sort()}export{T as a};
2
+ //# sourceMappingURL=chunk-N2T2GPYQ.js.map
@@ -0,0 +1,2 @@
1
+ import{a as S}from"./chunk-N2T2GPYQ.js";import{a as A}from"./chunk-TUAPDKBI.js";import{a as h}from"./chunk-LY6NRJPJ.js";import{a as y}from"./chunk-HQHFMPLJ.js";import{b as f}from"./chunk-TTGWDUJ4.js";import{e as b}from"./chunk-YISMWW66.js";var p=.7,C=.62,g=.45;function H(i,n={}){let{windowCommits:e=100,limit:t=30,scope:l,scanLimit:s}=n,a=b(i);if(!a)return{available:!1,windowCommits:e,findings:[]};if(t<=0)return{available:!0,windowCommits:e,findings:[]};let d=v(i,{limit:t,minSimilarity:n.minSimilarity,scanLimit:s,scope:l,semantic:n.semantic}).map(m=>E(m,a,e)).filter(m=>m!==null);return d.sort((m,o)=>(m.kind===o.kind?0:m.kind==="echo"?-1:1)||o.similarity-m.similarity||m.echoFile.localeCompare(o.echoFile)||m.echoSymbol.localeCompare(o.echoSymbol)||m.domain.localeCompare(o.domain)),{available:!0,windowCommits:e,findings:d.slice(0,t)}}function v(i,n){let e=I(n.limit);return[...B(i,{scope:n.scope,minSimilarity:n.minSimilarity??p,limit:e,scanLimit:n.scanLimit,semantic:n.semantic}),...D(i,{scope:n.scope,minSimilarity:n.minSimilarity??C,limit:e,scanLimit:n.scanLimit}),...R(i,{scope:n.scope,minSimilarity:n.minSimilarity??g,limit:e,scanLimit:n.scanLimit}),...L(i,{scope:n.scope,minSimilarity:n.minSimilarity??C,limit:e,scanLimit:n.scanLimit}),...F(i,{scope:n.scope,minSimilarity:n.minSimilarity??g,limit:e,scanLimit:n.scanLimit})]}function B(i,n){return f(i,{scope:n.scope,minSimilarity:n.minSimilarity,limit:n.limit,crossFileOnly:!0,scanLimit:n.scanLimit,semantic:n.semantic}).map(e=>({domain:"callable",basis:e.similarityBasis??"callees",symbolA:e.shortNameA,fileA:e.fileA,symbolB:e.shortNameB,fileB:e.fileB,similarity:e.similarity,sharedEvidence:e.sharedCallees,sharedCallees:e.sharedCallees}))}function D(i,n){return y(i,{scope:n.scope,minSimilarity:n.minSimilarity,limit:n.limit,scanLimit:n.scanLimit}).filter(e=>e.fileA!==e.fileB).map(e=>({domain:"react-component",basis:"jsx-structure",symbolA:e.componentA,fileA:e.fileA,symbolB:e.componentB,fileB:e.fileB,similarity:e.similarity,sharedEvidence:u(["component",e.sharedComponents],["tag",e.sharedNativeTags],["prop",e.sharedProps],["event",e.sharedEvents],["binding",e.sharedBindings]),sharedCallees:[]}))}function R(i,n){return h(i,{scope:n.scope,minSimilarity:n.minSimilarity,limit:n.limit,scanLimit:n.scanLimit}).filter(e=>e.fileA!==e.fileB).map(e=>({domain:"react-hook",basis:"react-behavior",symbolA:e.componentA,fileA:e.fileA,symbolB:e.componentB,fileB:e.fileB,similarity:e.similarity,sharedEvidence:u(["hook",e.sharedHooks],["react-hook",e.sharedReactHooks],["effect",e.sharedEffects],["state",e.sharedState],["request",e.sharedRequests],["handler",e.sharedHandlers],["action",e.sharedHandlerVerbs]),sharedCallees:[]}))}function L(i,n){return A(i,{scope:n.scope,minSimilarity:n.minSimilarity,limit:n.limit,scanLimit:n.scanLimit}).filter(e=>e.fileA!==e.fileB).map(e=>({domain:"vue-component",basis:"vue-template",symbolA:r(e.fileA),fileA:e.fileA,symbolB:r(e.fileB),fileB:e.fileB,similarity:e.similarity,sharedEvidence:u(["component",e.sharedComponents],["prop",e.sharedProps],["event",e.sharedEvents],["directive",e.sharedDirectives],["slot",e.sharedSlots],["identifier",e.sharedIdentifiers]),sharedCallees:[]}))}function F(i,n){return S(i,{scope:n.scope,minSimilarity:n.minSimilarity,limit:n.limit,scanLimit:n.scanLimit}).filter(e=>e.fileA!==e.fileB).map(e=>({domain:"vue-composable",basis:"vue-behavior",symbolA:r(e.fileA),fileA:e.fileA,symbolB:r(e.fileB),fileB:e.fileB,similarity:e.similarity,sharedEvidence:u(["composable",e.sharedComposables],["store",e.sharedStores],["reactivity",e.sharedReactivity],["lifecycle",e.sharedLifecycle],["request",e.sharedRequests],["function",e.sharedFunctions],["action",e.sharedFunctionVerbs],["binding",e.sharedBindings],["template-event",e.sharedTemplateEvents]),sharedCallees:[]}))}function E(i,n,e){let t=n.get(i.fileA)?.commitsAgo??null,l=n.get(i.fileB)?.commitsAgo??null,s=t!==null&&t<=e,a=l!==null&&l<=e;if(!s&&!a)return null;if(s&&a){let c=(t??0)<=(l??0);return{kind:"twin",domain:i.domain,basis:i.basis,echoSymbol:c?i.symbolA:i.symbolB,echoFile:c?i.fileA:i.fileB,echoAgeCommits:(c?t:l)??0,establishedSymbol:c?i.symbolB:i.symbolA,establishedFile:c?i.fileB:i.fileA,establishedAgeCommits:c?l:t,similarity:i.similarity,sharedEvidence:i.sharedEvidence,sharedCallees:i.sharedCallees}}return{kind:"echo",domain:i.domain,basis:i.basis,echoSymbol:s?i.symbolA:i.symbolB,echoFile:s?i.fileA:i.fileB,echoAgeCommits:(s?t:l)??0,establishedSymbol:s?i.symbolB:i.symbolA,establishedFile:s?i.fileB:i.fileA,establishedAgeCommits:s?l:t,similarity:i.similarity,sharedEvidence:i.sharedEvidence,sharedCallees:i.sharedCallees}}function I(i){return Number.isFinite(i)?i*5:Number.POSITIVE_INFINITY}function u(...i){let n=[],e=new Set;for(let[t,l]of i)for(let s of l){let a=`${t}:${s}`;e.has(a)||(e.add(a),n.push(a))}return n}function r(i){return(i.split("/").pop()??i).replace(/\.[^.]+$/,"")}export{H as a};
2
+ //# sourceMappingURL=chunk-OB6PEVI3.js.map
@@ -0,0 +1,2 @@
1
+ import{a as y}from"./chunk-QUKZ77A6.js";import{d as b}from"./chunk-64LH2QUP.js";import{a as d,d as g}from"./chunk-HCQ7J2N5.js";import{b as u}from"./chunk-YVQUQIBM.js";import{c as m}from"./chunk-BJ7OHKB5.js";var x=m("definition-consumer-file-usage",{clearGroups:["whole-project","source-file"]});function E(n,e,r){return n.callerFileMap(e,{semantic:r.semantic,sourceFallback:r.sourceFallback})}function I(n,e,r){let i=[],t=0,s=0,p=b(e.symbol);for(let a of r)v(n,a,e.relativePath,p)?t++:S(n,a,p)?s++:i.push(a);return{realConsumers:i,barrelConsumers:t,importOnlyConsumers:s}}function S(n,e,r){if(!r)return!1;let i=d(e);if(!i)return!1;let t=x.get(n,e,()=>C(n,e,i));return t.importedLeaves.has(r)&&!t.usedLeaves.has(r)}function C(n,e,r){let i=new Set,t=new Set,s=g(n,e);if(!s)return{importedLeaves:i,usedLeaves:t};let p=r==="rust"?new Set(["use_declaration"]):r==="python"?new Set(["import_statement","import_from_statement"]):new Set(["import_statement"]),a=(o,c)=>{let l=c||p.has(o.type);(o.type==="identifier"||o.type==="type_identifier"||o.type==="property_identifier"||o.type==="field_identifier")&&(l?i.add(o.text):t.add(o.text));for(let f of o.children)a(f,l)};return a(s.rootNode,!1),{importedLeaves:i,usedLeaves:t}}function v(n,e,r,i){if(!i)return!1;let t=u(n,e);if(t.length===0)return!1;let s=y(n,e);if(s.length===0)return!1;let p=i.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),a=new RegExp(`\\b${p}\\b`),o=0;for(let c=0;c<t.length;c++){if(!a.test(t[c]??""))continue;if(o++,!s.find(f=>f.startLine<=c&&c<=f.endLine))return!1}return o>0}export{E as a,I as b,S as c};
2
+ //# sourceMappingURL=chunk-PNN3D4BE.js.map
@@ -1,4 +1,4 @@
1
- import{a as t}from"./chunk-WC43FMAB.js";function r(e,n,o){let d=t(e,n)??n,s=t(e,o)??o,m=e.get(`SELECT COUNT(DISTINCT gs.id) AS shared
1
+ import{a as t}from"./chunk-QOFKVNFE.js";function r(e,n,o){let d=t(e,n)??n,s=t(e,o)??o,m=e.get(`SELECT COUNT(DISTINCT gs.id) AS shared
2
2
  FROM global_symbols gs
3
3
  WHERE (
4
4
  -- Defined in file1, referenced in file2
@@ -53,4 +53,4 @@ import{a as t}from"./chunk-WC43FMAB.js";function r(e,n,o){let d=t(e,n)??n,s=t(e,
53
53
  GROUP BY def_d.id, ref_d.id
54
54
  ORDER BY shared DESC
55
55
  LIMIT ?`,o).filter(i=>!e.isIgnored(i.file1)&&!e.isIgnored(i.file2)).map(i=>({file1:i.file1,file2:i.file2,sharedSymbols:i.shared}))}export{r as a,c as b};
56
- //# sourceMappingURL=chunk-46ILZVMX.js.map
56
+ //# sourceMappingURL=chunk-PV4CEDIL.js.map
@@ -0,0 +1,3 @@
1
+ import{l as T}from"./chunk-ADKQX2OY.js";import{d as h,r as g}from"./chunk-64LH2QUP.js";import{a as k}from"./chunk-NN3O7TPH.js";import{a as U,c as W}from"./chunk-BJ7OHKB5.js";function p(i,e,t){if(i.has(e))return i.get(e);let n=t();return i.set(e,n),n}import $ from"path";function le(i,e){return i.getReferences().map(t=>{let n=t.getNode();return V(n,e)})}function fe(i){let e=i;return typeof e.findReferences=="function"?e.findReferences():[]}function _(i,e,t,n){let r=[];for(let o of fe(i))for(let s of le(o,n))s.file===e.relativePath&&s.line>=e.startLine&&s.line<=e.endLine||r.push(s);for(let o of t)r.push(o);return N(r)}function B(i,e,t,n){let r=[],o=t?.getStart();for(let s of i.getReferences()){let a=s.getNode();S(n,a.getSourceFile().getFilePath())===e&&(o!==void 0&&a.getStart()===o||r.push({location:V(a,n),node:a}))}return r}function V(i,e){let t=i.getSourceFile(),n=t.getLineAndColumnAtPos(i.getStart());return{file:S(e,t.getFilePath())??t.getBaseName(),line:n.line-1,column:n.column-1}}function z(i,e,t){let n=i.getSourceFile(),r=y(n,i),o=i.getText(),s=new RegExp(`\\b${pe(o)}\\b`,"g"),a=n.getFullText().split(`
2
+ `),l=[];for(let c=0;c<a.length;c++){if(c===r)continue;let d=a[c]??"";s.lastIndex=0;let u;for(;(u=s.exec(d))!==null;)l.push({file:e,line:c,column:u.index})}return N(l.filter(c=>S(t,$.join(t,c.file))===e))}function R(i){for(let e=i;e;e=e.getParent()){let t=e.getKindName();if(t.includes("Type")||t==="InterfaceDeclaration"||t==="TypeAliasDeclaration")return!0;if(t==="CallExpression"||t==="NewExpression"||t==="ExpressionStatement")return!1}return!1}function y(i,e){return i.getLineAndColumnAtPos(e.getStart()).line-1}function N(i){let e=new Set,t=[];for(let n of i){let r=`${n.file}:${n.line}:${n.column}`;e.has(r)||(e.add(r),t.push(n))}return t}function S(i,e){let t=$.relative(i||process.cwd(),e).replace(/\\/g,"/");return!t||t.startsWith("..")?null:t}function pe(i){return i.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function J(i,e,t,n){let r=de(e,n);return r.size===0?new Map:ue(i,t,r)}function de(i,e){let t=new Map;for(let n of g(i,e)){let r=h(n.symbol)??n.leaf;if(!r)continue;let o=t.get(r);o||(o=[],t.set(r,o)),o.push(n)}return t}function ue(i,e,t){let n=new Map,r=new Map;return e.forEachDescendant(o=>{for(let s of me(i,o)){let a=t.get(s);if(!a)continue;let l=y(e,o);for(let c of a){if(l<c.startLine-1||l>c.endLine+1)continue;let d=Math.abs(l-c.startLine),u=r.get(c.symbolId);u!==void 0&&u<=d||(r.set(c.symbolId,d),n.set(c.symbolId,o))}}}),n}function me(i,e){let t=[],n=r=>{r&&!t.includes(r)&&t.push(r)};if("getNameNode"in e&&typeof e.getNameNode=="function"){let r=e.getNameNode();n(r?.getText())}if("getName"in e&&typeof e.getName=="function"){let r=e.getName();n(r)}return i.Node.isIdentifier(e)&&n(e.getText()),t}var ge=W("ts-definition-leaf-candidates",{clearGroups:["definition-catalog"]});function Y(i,e,t,n){let r=q(i,e),o=K(r.get(n)??[],t);if(o)return o;let s=[];for(let a of r.values())for(let l of a)((l.leaf||h(l.symbol)||"").includes(n)||l.symbol.includes(n))&&s.push(l);return K(s,t)}function X(i,e){let t=new Map;for(let[n,r]of q(i,e)){let o=r[0];o&&t.set(n,o)}return t}function q(i,e){return ge.get(i,e,()=>{let t=new Map;for(let n of g(i,e)){let r=n.leaf||h(n.symbol);if(!r)continue;let o=t.get(r);o||(o=[],t.set(r,o)),o.push({...n,leaf:r})}for(let n of t.values())n.sort((r,o)=>r.startLine-o.startLine||r.endLine-o.endLine||r.symbolId-o.symbolId);return t})}function K(i,e){let t=null,n=Number.POSITIVE_INFINITY;for(let r of i){let o=Math.abs(r.startLine-e);(o<n||o===n&&t&&r.startLine<t.startLine)&&(t=r,n=o)}return t}import ye from"path";var x=[".ts",".tsx",".mts",".cts",".js",".jsx",".mjs",".cjs"];function M(i){let e=i.toLowerCase();return x.some(t=>e.endsWith(t))}function G(i,e){let t=new Map,n=r=>M(r)?p(t,r,()=>{let o=ye.join(i.config.projectRoot,r);for(let{project:s}of e){let a=s.getSourceFile(o)??s.addSourceFileAtPathIfExists(o)??null;if(a)return{project:s,sourceFile:a}}return null}):null;return{sourceFile:r=>n(r)?.sourceFile??null,sourceFileMatch:n,indexedTypeScriptLikeDocuments:()=>k(i,{extensions:x})}}import m from"path";import{existsSync as F,readdirSync as he,readFileSync as H}from"fs";function Q(i){let e=m.join(i,"package.json");if(!F(e))return[];let t;try{t=JSON.parse(H(e,"utf8"))}catch{return[]}return(Array.isArray(t.workspaces)?t.workspaces:t.workspaces?.packages??[]).flatMap(r=>Se(i,r)).flatMap(r=>xe(i,r))}function Se(i,e){if(!e||e.startsWith("!")||e.includes("node_modules"))return[];if(!e.includes("*")){let s=m.join(i,e);return F(m.join(s,"package.json"))?[s]:[]}let t=e.indexOf("*"),n=e.slice(0,t).replace(/\/$/,""),r=e.slice(t+1).replace(/^\//,""),o=m.join(i,n||".");if(!F(o))return[];try{return he(o).map(s=>m.join(o,s,r)).filter(s=>F(m.join(s,"package.json")))}catch{return[]}}function xe(i,e){try{let t=JSON.parse(H(m.join(e,"package.json"),"utf8"));if(!t.name)return[];let n=m.relative(i,e).replace(/\\/g,"/");return[{name:t.name,rootRelative:n,sourceRootRelative:`${n}/src`}]}catch{return[]}}function Z(i,e){for(let t of i)if(e===t.name||e.startsWith(`${t.name}/`))return t.name;return null}function ee(i){return[`${i.sourceRootRelative}/index.ts`,`${i.sourceRootRelative}/index.tsx`,`${i.sourceRootRelative}/index.mts`,`${i.sourceRootRelative}/index.cts`]}import{existsSync as I,readFileSync as Ie,readdirSync as be,statSync as De}from"fs";import f from"path";var j=["tsconfig.json","tsconfig.app.json","tsconfig.node.json","tsconfig.base.json"];function E(i,e){let n=e?f.dirname(f.join(i,e)):i,r=f.resolve(i);for(;n.startsWith(r);){for(let s of j){let a=f.join(n,s);if(I(a))return a}let o=f.dirname(n);if(o===n)break;n=o}for(let o of j){let s=f.join(i,o);if(I(s))return s}return null}function te(i){let e=i.config.projectRoot,t=new Set(ke(e,i.config.semantic?.typescript?.tsconfigs)),n=k(i,{includeIgnored:!1,extensions:x});for(let r of n){let o=E(e,r);o&&t.add(f.resolve(o))}if(t.size===0){let r=E(e);r&&t.add(f.resolve(r))}return[...t].filter(r=>!ne(e,r)).sort((r,o)=>r.localeCompare(o))}function ke(i,e=[]){let t=new Set;for(let n of e){let r=f.isAbsolute(n)?n:f.join(i,n);I(r)&&t.add(f.resolve(r))}for(let n of Ne(i))for(let r of j){let o=f.join(n,r);I(o)&&t.add(f.resolve(o))}if(t.size===0){let n=E(i);n&&t.add(f.resolve(n))}return[...t].filter(n=>!ne(i,n)).sort((n,r)=>n.localeCompare(r))}function Ne(i){let e=f.join(i,"package.json");if(!I(e))return[];let t;try{t=JSON.parse(Ie(e,"utf8"))}catch{return[]}return(Array.isArray(t.workspaces)?t.workspaces:t.workspaces?.packages??[]).flatMap(r=>Me(i,r))}function Me(i,e){if(!e||e.startsWith("!")||e.includes("node_modules"))return[];if(!e.includes("*")){let s=f.join(i,e);return C(s)?[s]:[]}let t=e.indexOf("*"),n=e.slice(0,t).replace(/\/$/,""),r=e.slice(t+1).replace(/^\//,""),o=f.join(i,n||".");return C(o)?be(o).map(s=>f.join(o,s,r)).filter(C):[]}function C(i){try{return De(i).isDirectory()}catch{return!1}}function ne(i,e){let t=f.relative(i,e).replace(/\\/g,"/");return t.startsWith("..")||t.includes("/node_modules/")||t.startsWith("node_modules/")||t.includes("/dist/")||t.startsWith("dist/")}import{createRequire as Fe}from"module";var ve=Fe(import.meta.url),b;function re(){if(b!==void 0)return b;try{b=ve("ts-morph")}catch{b=null}return b}function ie(i,e){return e.map(t=>({tsconfigPath:t,project:new i.Project({tsConfigFilePath:t,skipFileDependencyResolution:!1})}))}function v(i,e,t){return{language:"typescript",availability:()=>({available:!1,reason:i,tsconfigPath:e,tsconfigPaths:t}),importUsage:()=>[],referencesFor:()=>[],calleesFor:()=>[],signatureFor:()=>null}}function ae(i,e){let t=re();if(!t)return v("ts-morph is not installed");let n=te(i);if(n.length===0)return v("no tsconfig found");try{let r=ie(t,n);return new w(i,t,r)}catch(r){return v(r instanceof Error?r.message:String(r),n[0],n)}}var w=class{constructor(e,t,n){this.db=e;this.tsMorph=t;this.projects=n;this.workspacePackages=Q(e.config.projectRoot),this.sourceFiles=G(e,n)}db;tsMorph;projects;language="typescript";importUsageCache=new Map;referencesCache=new Map;calleesCache=new Map;fileCalleesCache=new Map;signatureCache=new Map;definitionNodeCache=new Map;fileDefinitionNodeCache=new Map;indexedDefinitionLeafCache=new Map;packageImportReferenceIndex=null;packageExportIndex=null;workspacePackages;sourceFiles;availability(){return{available:!0,tsconfigPath:this.projects[0]?.tsconfigPath,tsconfigPaths:this.projects.map(e=>e.tsconfigPath)}}importUsage(e){return p(this.importUsageCache,e,()=>{let t=this.sourceFiles.sourceFile(e);if(!t)return[];let n=[];for(let r of t.getImportDeclarations())for(let o of this.importUsageForDeclaration(e,r))n.push(o);return n})}referencesFor(e){return p(this.referencesCache,e.symbolId,()=>{let t=this.nodeForDefinition(e),n=this.packageImportReferencesForDefinition(e);return t?_(t,e,n,this.db.config.projectRoot):n})}calleesFor(e){return p(this.calleesCache,e.symbolId,()=>p(this.fileCalleesCache,e.relativePath,()=>this.calleeMapForFile(e.relativePath)).get(e.symbolId)??[])}signatureFor(e){return p(this.signatureCache,e.symbolId,()=>{let t=this.nodeForDefinition(e);if(!t||!this.tsMorph.Node.isFunctionDeclaration(t)&&!this.tsMorph.Node.isMethodDeclaration(t)&&!this.tsMorph.Node.isArrowFunction(t)&&!this.tsMorph.Node.isFunctionExpression(t)&&!this.tsMorph.Node.isConstructorDeclaration(t))return null;let n=t.getType().getCallSignatures()[0];if(!n)return null;let r=n.getParameters().map(s=>{let a=s.getDeclarations()[0],l=a?s.getTypeAtLocation(a).getText(a):s.getValueDeclaration()?.getType().getText()??"unknown";return se(l)}),o=n.getReturnType().getText(t);return`(${r.join(",")})=>${se(o)}`})}importUsageForDeclaration(e,t){let n=T(this.db,e,t.getModuleSpecifierValue()),r=oe(t);return t.getImportClause()?.isTypeOnly()?r.map(o=>Pe(e,n,o)):r.map(o=>this.valueImportUsageForEntry(e,n,o))}valueImportUsageForEntry(e,t,n){let r=n.identifier?n.identifier.findReferences():[],o=[];for(let c of r)for(let d of B(c,e,n.identifier,this.db.config.projectRoot))o.push(d);let s=o.some(c=>!R(c.node)),a=o.some(c=>R(c.node)),l=n.isTypeOnly;return{importer:e,sourcePath:t,importedName:n.importedName,localName:n.localName,kind:n.kind,isTypeOnly:l,isUsed:l||o.length>0,isTypeUsed:l||a,isValueUsed:s,references:o.map(c=>c.location)}}packageImportReferencesForDefinition(e){return this.packageImportReferences().get(e.symbolId)??[]}packageImportReferences(){if(this.packageImportReferenceIndex)return this.packageImportReferenceIndex;let e=new Map,t=this.packageExports();for(let n of this.sourceFiles.indexedTypeScriptLikeDocuments())this.addPackageImportReferencesForDocument(e,t,n);for(let[n,r]of e)e.set(n,N(r));return this.packageImportReferenceIndex=e,e}addPackageImportReferencesForDocument(e,t,n){if(this.db.isIgnored(n))return;let r=this.sourceFiles.sourceFileMatch(n);if(r)for(let o of r.sourceFile.getImportDeclarations())this.addPackageImportReferencesForDeclaration(e,t,n,o)}addPackageImportReferencesForDeclaration(e,t,n,r){let o=Z(this.workspacePackages,r.getModuleSpecifierValue());if(!o)return;let s=t.get(o);if(s)for(let a of oe(r)){if(a.kind!=="named"||!a.identifier)continue;let l=s.get(a.importedName);if(!l||l.size===0)continue;let c=z(a.identifier,n,this.db.config.projectRoot);c.length>0&&Ce(e,l,c)}}packageExports(){if(this.packageExportIndex)return this.packageExportIndex;let e=new Map;for(let t of this.workspacePackages){let n=new Map;for(let r of ee(t))this.collectPackageExports(t,r,n,new Set);n.size>0&&e.set(t.name,n)}return this.packageExportIndex=e,e}collectPackageExports(e,t,n,r){if(r.has(t))return;r.add(t);let o=this.sourceFiles.sourceFile(t);if(o)for(let s of o.getExportDeclarations()){let a=s.getModuleSpecifierValue(),l=a?T(this.db,t,a):t;if(!l||!l.startsWith(`${e.sourceRootRelative}/`))continue;let c=s.getNamedExports();if(c.length===0){if(s.isNamespaceExport())continue;this.collectPackageExports(e,l,n,r);continue}for(let d of c){let u=d.getNameNode().getText(),A=d.getAliasNode()?.getText()??u,O=this.indexedDefinitionByLeaf(l,u);if(!O)continue;let D=n.get(A);D||(D=new Set,n.set(A,D)),D.add(O.symbolId)}}}indexedDefinitionByLeaf(e,t){return p(this.indexedDefinitionLeafCache,e,()=>X(this.db,e)).get(t)??null}nodeForDefinition(e){return p(this.definitionNodeCache,e.symbolId,()=>this.definitionNodesForFile(e.relativePath).get(e.symbolId)??null)}definitionNodesForFile(e){return p(this.fileDefinitionNodeCache,e,()=>{let t=this.sourceFiles.sourceFile(e);return t?J(this.tsMorph,this.db,t,e):new Map})}definitionFromSymbol(e){let t=e.getDeclarations();for(let n of t){let r=n.getSourceFile(),o=S(this.db.config.projectRoot,r.getFilePath());if(!o||this.db.isIgnored(o))continue;let s=y(r,n),a=Y(this.db,o,s,e.getName());if(a)return{symbol:a.symbol,file:a.relativePath,line:a.startLine}}return null}calleeMapForFile(e){let t=this.sourceFiles.sourceFile(e);if(!t)return new Map;let n=g(this.db,e).sort((o,s)=>o.startLine-s.startLine||s.endLine-o.endLine);if(n.length===0)return new Map;let r=new Map;t.forEachDescendant(o=>{if(!this.tsMorph.Node.isCallExpression(o)&&!this.tsMorph.Node.isNewExpression(o))return;let s=this.semanticCalleeForCallNode(t,n,o);s&&Te(r,s.callerId,s.target)});for(let[o,s]of r)r.set(o,je(s));return r}semanticCalleeForCallNode(e,t,n){let r=Re(t,y(e,n));if(!r)return null;let o=n.getExpression(),s=o.getSymbol()??o.getType().getSymbol(),a=s?this.definitionFromSymbol(s):null;return a?{callerId:r.symbolId,target:{symbol:a.symbol,file:a.file,line:a.line}}:null}};function oe(i){let e=[],t=i.getDefaultImport();t&&e.push({identifier:t,importedName:"default",localName:t.getText(),kind:"default",isTypeOnly:i.getImportClause()?.isTypeOnly()??!1});let n=i.getNamespaceImport();n&&e.push({identifier:n,importedName:"*",localName:n.getText(),kind:"namespace",isTypeOnly:i.getImportClause()?.isTypeOnly()??!1});for(let r of i.getNamedImports()){let o=r.getNameNode(),a=r.getAliasNode()??(o.getKindName()==="Identifier"?o:null);e.push({identifier:a,importedName:o.getText(),localName:a?.getText()??o.getText(),kind:"named",isTypeOnly:r.isTypeOnly()||(i.getImportClause()?.isTypeOnly()??!1)})}return e.length===0&&e.push({identifier:null,importedName:"*",localName:null,kind:"side-effect",isTypeOnly:!1}),e}function Pe(i,e,t){return{importer:i,sourcePath:e,importedName:t.importedName,localName:t.localName,kind:t.kind,isTypeOnly:!0,isUsed:!0,isTypeUsed:!0,isValueUsed:!1,references:[]}}function Te(i,e,t){let n=i.get(e);n||(n=[],i.set(e,n)),n.push(t)}function Re(i,e){let t=null;for(let n of i)e<n.startLine||e>n.endLine||(!t||n.startLine>=t.startLine)&&(t=n);return t}function Ce(i,e,t){for(let n of e){let r=i.get(n)??[];r.push(...t),i.set(n,r)}}function je(i){let e=new Set,t=[];for(let n of i){let r=`${n.symbol}|${n.file}|${n.line}`;e.has(r)||(e.add(r),t.push(n))}return t}function se(i){return i.replace(/\s+/g," ").replace(/\bimport\("[^"]+"\)\./g,"").trim()}var L=new WeakMap;U({name:"semantic-provider",groups:["semantic-provider"],clearAll:i=>L.delete(i)});function ce(i,e){let t=`${i.config.projectRoot}:typescript-workspace`,n=L.get(i);n||(n=new Map,L.set(i,n));let r=n.get(t);if(r)return r;let o=ae(i,e);return n.set(t,o),o}function kt(i,e){let t=P(i,e);return t?t.importUsage(e):[]}function Ee(i,e){let t=P(i,e.relativePath);return t?t.referencesFor(e):[]}function Nt(i,e){let t=new Map;for(let n of e)for(let r of Ee(i,n)){if(r.file===n.relativePath||i.isIgnored(r.file))continue;let o=t.get(n.symbolId);o||(o=new Set,t.set(n.symbolId,o)),o.add(r.file)}return t}function Mt(i,e){let t=new Map;for(let n of e){let r=P(i,n.relativePath);if(!r)continue;let o=r.calleesFor(n);o.length>0&&t.set(n.symbolId,o)}return t}function Ft(i,e){let t=P(i,e.relativePath);return t?t.signatureFor(e):null}function P(i,e){if(!M(e))return null;let t=ce(i,e);return t.availability().available?t:null}export{M as a,ce as b,kt as c,Ee as d,Nt as e,Mt as f,Ft as g};
3
+ //# sourceMappingURL=chunk-QH5GTVVB.js.map
@@ -1,2 +1,2 @@
1
- import{a as u}from"./chunk-7I6KNKE3.js";import{a as c}from"./chunk-NN3O7TPH.js";import{existsSync as m}from"fs";import{basename as p,isAbsolute as g,join as d}from"path";function S(t,r){let e=f(t,r,{allowMultiple:!1})[0]?.relativePath;return e||x(t,r)}function j(t,r){return f(t,r,{allowMultiple:!0}).map(e=>e.relativePath)}function x(t,r){if(!r)return null;let e=r.replace(/\\/g,"/").replace(/^\.\//,""),s=g(e)&&e.startsWith(t.config.projectRoot)?e.slice(t.config.projectRoot.length).replace(/^\/+/,""):e,i=d(t.config.projectRoot,s);return m(i)?s:null}function f(t,r,e){let s=h(r);if(!s)return[];let i=c(t,{includeIgnored:!1}).map(o=>({relativePath:o,score:v(o,s)})).filter(o=>o.score>0).sort((o,l)=>l.score-o.score||o.relativePath.localeCompare(l.relativePath));if(i.length===0){let o=u(t,r);return!o||t.isIgnored(o.relativePath)?[]:[{relativePath:o.relativePath,score:700}]}let n=i.filter(o=>o.score>=1100);if(n.length>0)return e.allowMultiple?n:[n[0]];let a=i.filter(o=>o.score>=800);return a.length>0?e.allowMultiple?a:[a[0]]:e.allowMultiple?i:[i[0]]}function v(t,r){let e=h(t),s=p(e),i=p(r),n=0;return e===r&&(n+=1200),e.endsWith(`/${r}`)&&(n+=1100),s===i&&(n+=900),e.startsWith(`${r}/`)&&(n+=850),e.includes(r)&&(n+=250),n}function h(t){return t.trim().replace(/\\/g,"/").replace(/^\.\//,"").replace(/^\/+/,"").replace(/\/+$/,"")}export{S as a,j as b};
2
- //# sourceMappingURL=chunk-WC43FMAB.js.map
1
+ import{a as u}from"./chunk-5ALI77D7.js";import{a as c}from"./chunk-NN3O7TPH.js";import{existsSync as m}from"fs";import{basename as p,isAbsolute as g,join as d}from"path";function S(t,r){let e=f(t,r,{allowMultiple:!1})[0]?.relativePath;return e||x(t,r)}function j(t,r){return f(t,r,{allowMultiple:!0}).map(e=>e.relativePath)}function x(t,r){if(!r)return null;let e=r.replace(/\\/g,"/").replace(/^\.\//,""),s=g(e)&&e.startsWith(t.config.projectRoot)?e.slice(t.config.projectRoot.length).replace(/^\/+/,""):e,i=d(t.config.projectRoot,s);return m(i)?s:null}function f(t,r,e){let s=h(r);if(!s)return[];let i=c(t,{includeIgnored:!1}).map(o=>({relativePath:o,score:v(o,s)})).filter(o=>o.score>0).sort((o,l)=>l.score-o.score||o.relativePath.localeCompare(l.relativePath));if(i.length===0){let o=u(t,r);return!o||t.isIgnored(o.relativePath)?[]:[{relativePath:o.relativePath,score:700}]}let n=i.filter(o=>o.score>=1100);if(n.length>0)return e.allowMultiple?n:[n[0]];let a=i.filter(o=>o.score>=800);return a.length>0?e.allowMultiple?a:[a[0]]:e.allowMultiple?i:[i[0]]}function v(t,r){let e=h(t),s=p(e),i=p(r),n=0;return e===r&&(n+=1200),e.endsWith(`/${r}`)&&(n+=1100),s===i&&(n+=900),e.startsWith(`${r}/`)&&(n+=850),e.includes(r)&&(n+=250),n}function h(t){return t.trim().replace(/\\/g,"/").replace(/^\.\//,"").replace(/^\/+/,"").replace(/\/+$/,"")}export{S as a,j as b};
2
+ //# sourceMappingURL=chunk-QOFKVNFE.js.map
@@ -0,0 +1,4 @@
1
+ import{a as te,b as re,c as b,d as se,e as ne,f as oe,g as j,h as ie,i as U,j as ae,k as pe,l as E,m as W,n as T,o as V,p as z,q as S,r as Q,s as J,u as R,v as h,w as M,x as G}from"./chunk-ADKQX2OY.js";import{b as le}from"./chunk-XGGTESMN.js";import{a as ce,b as me,d as C}from"./chunk-HCQ7J2N5.js";import{a as v}from"./chunk-YVQUQIBM.js";import{c as L}from"./chunk-BJ7OHKB5.js";import{basename as ue}from"path";var ke=new Set(["identifier","type_identifier","property_identifier","shorthand_property_identifier","field_identifier"]);function x(t){let r=[],e=0,s=0;for(let n=0;n<t.length;n++){let o=t[n];(o==="{"||o==="["||o==="(")&&e++,(o==="}"||o==="]"||o===")")&&e--,o===","&&e===0&&(r.push(t.slice(s,n)),s=n+1)}return r.push(t.slice(s)),r}function y(t,r){for(let e of t.namedChildren)if(e.type===r)return e;return null}function g(t,r){let e=new Set,s=(n,o)=>{let i=o||r.has(n.type);!i&&ke.has(n.type)&&e.add(n.text);for(let a of n.children)s(a,i)};return s(t.rootNode,!1),e}function P(t,r,e,s,n,o,i){return{importedName:n,localName:o,sourcePath:i??S(t,s,pe(r)),kind:"named",used:h(e,o),usedMembers:[]}}function f(t,r,e,s,n="named",o={}){return{importedName:t,localName:r,sourcePath:e,kind:n,used:s.has(r),usedMembers:[],isTypeOnly:o.isTypeOnly}}function $(t,r,e,s,n="named",o=[],i={}){return{importedName:t,localName:r,sourcePath:e,kind:n,used:s,usedMembers:o,isTypeOnly:i.isTypeOnly}}function D(t,r){return{importedName:t,localName:null,sourcePath:r,kind:"side-effect",used:!0,usedMembers:[]}}function O(t,r,e={}){return{importedName:t,localName:e.localName??null,sourcePath:r,kind:"namespace",used:e.used??!0,usedMembers:e.usedMembers??[],isTypeOnly:e.isTypeOnly}}function N(t,r,e){let s=[];for(let n of t.matchAll(r)){let o=n[0];if(!o||typeof n.index!="number")continue;let i=R(t,n.index,n.index+o.length);for(let a of e(n,i))s.push(a)}return s}function I(t,r,e,s){let n=C(t,r);if(n){let o=e(n);if(o)return o}return s()}function X(t,r,e,s){let n=C(t,r),o=ce(r),i=o?e[o]:void 0;return n&&i?i(n):s()}function de(t,r,e){return I(t,r,s=>we(t,r,s),()=>Ae(t,r,e))}function Ae(t,r,e){return N(e,/^[ \t]*#include\s+[<"]([^">]+)[">]\s*$/gm,(s,n)=>{let o=s[1]?.trim();if(!o)return[];let i=ue(o).replace(/\.[^.]+$/,"");return[$(o,i,z(t,r,o),h(n,i))]})}function we(t,r,e){let s=g(e,new Set(["preproc_include"])),n=[];for(let o of e.rootNode.descendantsOfType("preproc_include")){let i=null;for(let p of o.namedChildren){if(p.type==="system_lib_string"){i=p.text.replace(/^<|>$/g,"");break}if(p.type==="string_literal"){i=p.namedChildren.find(c=>c.type==="string_content")?.text??p.text.replace(/^"|"$/g,"");break}}if(!i)continue;let a=ue(i).replace(/\.[^.]+$/,"");n.push(f(i,a,z(t,r,i),s))}return n}function fe(t,r,e){let s=[];for(let n of e.matchAll(/^[ \t]*import\s+['"]([^'"]+)['"](?:\s+as\s+([A-Za-z_]\w*))?[\s\S]*?;$/gm)){let o=n[1]?.trim(),i=n[2]?.trim()??null,a=n[0];if(!o||!a||typeof n.index!="number")continue;let p=R(e,n.index,n.index+a.length);s.push({importedName:o,localName:i,sourcePath:Q(t,r,o),kind:i?"namespace":"side-effect",used:i?h(p,i):!0,usedMembers:i?M(p,i):[]})}return s}function ge(t,r,e){let s=[];for(let n of e.matchAll(/^[ \t]*export\s+['"]([^'"]+)['"][\s\S]*?;$/gm)){let o=n[1]?.trim();o&&s.push({specifier:o,sourcePath:Q(t,r,o)})}return s}function Se(t,r,e){return X(t,r,{csharp:s=>je(t,r,s),vb:s=>Le(t,r,s)},()=>{let s=ae(r)?/^[ \t]*Imports\s+(.+?)\s*$/gm:/^[ \t]*using\s+(.+?)\s*;$/gm;return N(e,s,(n,o)=>{let i=n[1]?.trim();if(!i)return[];let[a,p]=i.split(/\s*=\s*/),m=!!p,c=(m?p:a)?.trim()??i,l=c.split(".").pop()??c,u=m?a?.trim()??l:l;return[P(t,r,o,c,l,u,S(t,c,j))]})})}function Le(t,r,e){let s=g(e,new Set(["imports_statement"])),n=[];for(let o of e.rootNode.descendantsOfType("imports_statement")){let i=o.namedChildren.filter(u=>u.type==="namespace_name");if(i.length===0)continue;let a=i[i.length-1],p=i.length>1?i[0]:null,m=a.text,c=m.split(".").pop()??m,l=p?.text??c;n.push(f(c,l,S(t,m,j),s,p?"namespace":"named"))}return n}function je(t,r,e){let s=g(e,new Set(["using_directive"])),n=[];for(let o of e.rootNode.descendantsOfType("using_directive")){let i=o.namedChildren;if(i.length===0)continue;let a=null,p;i.length>=2&&i[0].type==="identifier"&&(i[1].type==="qualified_name"||i[1].type==="identifier")?(a=i[0],p=i[1]):p=i[i.length-1];let m=p.text,c=m.split(".").pop()??m,l=a?.text??c;n.push(f(c,l,S(t,m,j),s,a?"namespace":"named"))}return n}var ve=L("vue-non-script-identifiers",{clearGroups:["whole-project","source-file"]});function he(t,r){return ve.get(t,r,()=>{let e=new Set,s=v(t,r);if(!s)return e;let o=s.replace(/<script\b[^>]*>[\s\S]*?<\/script>/g,i=>i.replace(/[^\r\n]/g," ")).replace(/<!--[\s\S]*?-->/g,i=>i.replace(/[^\r\n]/g," ")).replace(/\/\*[\s\S]*?\*\//g,i=>i.replace(/[^\r\n]/g," "));for(let i of o.matchAll(/[A-Za-z_$][\w$]*/g))e.add(i[0]);return e})}function Y(t,r,e){return I(t,r,s=>$e(t,r,s),()=>Me(t,r,e))}function Me(t,r,e){return Qe(e).flatMap(s=>Ge(t,r,s.clause,s.specifier,s.start,s.end,e))}function $e(t,r,e){let s=qe(t,r,e),n=[];for(let o of e.rootNode.descendantsOfType("import_statement"))n.push(...Ue(t,r,e,o,s));return n}function qe(t,r,e){let s=g(e,new Set(["import_statement"]));if(me(r))for(let n of he(t,r))s.add(n);return s}function Ue(t,r,e,s,n){let o=Be(s);if(!o)return[];let i=E(t,r,o),a=y(s,"import_clause");return a?We(e,a,i,n,He(s.text)):[D("*",i)]}function We(t,r,e,s,n){let o=[];for(let i of r.namedChildren)if(i.type==="identifier")o.push(Fe(i.text,e,s,n));else if(i.type==="namespace_import"){let a=Je(t,i,e,s,n);a&&o.push(a)}else i.type==="named_imports"&&o.push(...Xe(i,e,s,n));return o}function Fe(t,r,e,s){return f("default",t,r,e,"default",{isTypeOnly:s})}function Je(t,r,e,s,n){let i=y(r,"identifier")?.text??"";if(!i)return null;let a=ze(t,i);return O("*",e,{localName:i,usedMembers:a,isTypeOnly:n,used:a.length>0||s.has(i)})}function Xe(t,r,e,s){let n=[];for(let o of t.namedChildren){if(o.type!=="import_specifier")continue;let i=o.namedChild(0),a=o.namedChild(1);if(!i)continue;let p=i.text,m=a?.text??p;n.push(f(p,m,r,e,"named",{isTypeOnly:s||Ve(o.text)}))}return n}function Be(t){let r=y(t,"string");if(!r)return null;let e=y(r,"string_fragment");return e?e.text:null}function He(t){return/^\s*import\s+type\b/.test(t)}function Ve(t){return/^\s*type\b/.test(t.trim())}function ze(t,r){let e=new Set;for(let s of t.rootNode.descendantsOfType("member_expression")){let n=s.namedChild(0),o=s.namedChild(1);!n||!o||n.type!=="identifier"||n.text!==r||(o.type==="property_identifier"||o.type==="identifier")&&e.add(o.text)}return[...e]}function Qe(t){let r=[],e=/^[ \t]*import\s+([\s\S]*?)\s+from\s+['"]([^'"]+)['"]\s*;?/gm;for(let n of t.matchAll(e)){let o=n[0],i=n[1],a=n[2];!o||!a||typeof n.index!="number"||r.push({clause:i,specifier:a,start:n.index,end:n.index+o.length})}let s=/^[ \t]*import\s+['"]([^'"]+)['"]\s*;?/gm;for(let n of t.matchAll(s)){let o=n[0],i=n[1];!o||!i||typeof n.index!="number"||r.push({clause:null,specifier:i,start:n.index,end:n.index+o.length})}return r.sort((n,o)=>n.start-o.start)}function Ge(t,r,e,s,n,o,i){let a=E(t,r,s),p=R(i,n,o);return e?Ye(e).map(c=>({...c,sourcePath:a})).map(c=>{if(c.kind==="namespace"){let l=M(p,c.localName);return O(c.importedName,c.sourcePath,{localName:c.localName,usedMembers:l,used:l.length>0||h(p,c.localName),isTypeOnly:c.isTypeOnly})}return c.kind==="side-effect"?D(c.importedName,c.sourcePath):$(c.importedName,c.localName??"",c.sourcePath,c.localName?h(p,c.localName):!1,c.kind,[],{isTypeOnly:c.isTypeOnly})}):[D("*",a)]}function Ye(t){let r=t.trim(),e=/^type\b/.test(r),s=r.replace(/^type\s+/,""),[n,o]=Ke(s),i=[];return n&&i.push(...xe(n,e)),o&&i.push(...xe(o,e)),i}function xe(t,r){let e=t.trim();if(!e)return[];if(e.startsWith("{")){let s=e.slice(1,-1).trim();return s?x(s).map(n=>{let o=n.trim(),i=r||/^type\b/.test(o),a=o.replace(/^type\s+/,""),[p,m]=a.split(/\s+as\s+/);return{importedName:p.trim(),localName:(m??p).trim(),kind:"named",isTypeOnly:i}}):[]}return e.startsWith("* as ")?[{importedName:"*",localName:e.slice(5).trim(),kind:"namespace",isTypeOnly:r}]:[{importedName:"default",localName:e,kind:"default",isTypeOnly:r}]}function Ke(t){let r=0;for(let e=0;e<t.length;e++){let s=t[e];if(s==="{"&&r++,s==="}"&&r--,s===","&&r===0)return[t.slice(0,e).trim(),t.slice(e+1).trim()]}return[t.trim(),null]}function K(t,r,e){let s=C(t,r);return s?nt(t,r,s):Ze(t,r,e)}function Ze(t,r,e){return[...et(t,r,e),...tt(t,r,e),...rt(t,r,e)]}function et(t,r,e){let s=[],n=/^[ \t]*export\s+(?:type\s+)?\{([\s\S]*?)\}\s+from\s+['"]([^'"]+)['"]\s*;?/gm;for(let o of e.matchAll(n)){if(typeof o.index!="number")continue;let i=o[1]??"",a=o[2]??"",p=x(i).map(l=>st(l.trim())).filter(l=>!!l),m=q(e,o.index),c=q(e,o.index+o[0].length-1);s.push({kind:"named",sourcePath:E(t,r,a),names:p,startLine:m,endLine:c})}return s}function tt(t,r,e){let s=[],n=/^[ \t]*export\s+\*\s+as\s+(\w+)\s+from\s+['"]([^'"]+)['"]\s*;?/gm;for(let o of e.matchAll(n)){if(typeof o.index!="number")continue;let i=o[2]??"",a=q(e,o.index),p=q(e,o.index+o[0].length-1);s.push({kind:"star-as",sourcePath:E(t,r,i),names:[],startLine:a,endLine:p})}return s}function rt(t,r,e){let s=[],n=/^[ \t]*export\s+\*\s+from\s+['"]([^'"]+)['"]\s*;?/gm;for(let o of e.matchAll(n)){if(typeof o.index!="number")continue;let i=o[1]??"",a=q(e,o.index),p=q(e,o.index+o[0].length-1);s.push({kind:"star",sourcePath:E(t,r,i),names:[],startLine:a,endLine:p})}return s}function st(t){if(!t)return null;let r=t.replace(/^type\s+/,"").trim();if(!r)return null;let e=r.match(/^(\w+)\s+as\s+(\w+)$/);if(e)return e[2]??null;let s=r.match(/^(\w+)$/);return s?s[1]??null:null}function q(t,r){let e=0;for(let s=0;s<r&&s<t.length;s++)t.charCodeAt(s)===10&&e++;return e}function nt(t,r,e){let s=[];for(let n of e.rootNode.descendantsOfType("export_statement")){let o=ot(t,r,n);if(o===void 0)continue;let i=n.startPosition.row,a=n.endPosition.row,p=it(n,o,i,a);s.push(p)}return s}function ot(t,r,e){let s=y(e,"string");if(!s)return;let n=y(s,"string_fragment");if(n)return E(t,r,n.text)}function it(t,r,e,s){let n=y(t,"export_clause");if(n){let i=[];for(let a of n.namedChildren){if(a.type!=="export_specifier")continue;let p=a.namedChild(0),m=a.namedChild(1);p&&i.push((m??p).text)}return{kind:"named",sourcePath:r,names:i,startLine:e,endLine:s}}return y(t,"namespace_export")?{kind:"star-as",sourcePath:r,names:[],startLine:e,endLine:s}:{kind:"star",sourcePath:r,names:[],startLine:e,endLine:s}}function ye(t,r,e){return X(t,r,{java:s=>at(t,r,s),kotlin:s=>pt(t,r,s),scala:s=>ct(t,r,s)},()=>N(e,/^[ \t]*import\s+(?:static\s+)?(.+?)\s*;?$/gm,(s,n)=>{let o=s[1]?.trim();return o?mt(t,r,o,n):[]}))}function at(t,r,e){let s=g(e,new Set(["import_declaration"])),n=[];for(let o of e.rootNode.descendantsOfType("import_declaration")){let i=o.children.some(l=>l.type==="asterisk"),p=o.namedChildren.find(l=>l.type==="scoped_identifier")??o.namedChildren.find(l=>l.type==="identifier");if(!p)continue;let m=p.text;if(i){n.push(O("*",S(t,m,b)));continue}let c=m.split(".").pop()??m;n.push(f(c,c,S(t,m,b),s))}return n}function pt(t,r,e){let s=g(e,new Set(["import_header","import_list"])),n=[];for(let o of e.rootNode.descendantsOfType("import_header")){let i=o.namedChildren.find(d=>d.type==="identifier");if(!i)continue;let a=o.namedChildren.some(d=>d.type==="wildcard_import"),p=o.namedChildren.find(d=>d.type==="import_alias");if(a){n.push(O("*",S(t,i.text,b)));continue}let m=i.text,c=m.split(".").pop()??m,u=p?.namedChild(0)?.text??c;n.push(f(c,u,S(t,m,b),s))}return n}function ct(t,r,e){let s=g(e,new Set(["import_declaration"])),n=[];for(let o of e.rootNode.descendantsOfType("import_declaration")){let i=o.namedChildren.find(l=>l.type==="namespace_selectors"||l.type==="namespace_wildcard"),a=o.namedChildren.filter(l=>l!==i&&(l.type==="identifier"||l.type==="stable_identifier")),p=a.map(l=>l.text).join(".");if(!p)continue;if(i?.type==="namespace_wildcard"){n.push(O("*",S(t,p,b)));continue}if(i?.type==="namespace_selectors"){for(let l of i.namedChildren)if(l.type==="arrow_renamed_identifier"){let[u,d]=l.namedChildren;if(!u)continue;let _=u.text,A=d?.text??_;if(_==="_")continue;n.push(f(_,A,S(t,`${p}.${_}`,b),s))}else if(l.type==="identifier"){let u=l.text;n.push(f(u,u,S(t,`${p}.${u}`,b),s))}continue}let m=a[a.length-1]?.text??p,c=a.slice(0,-1).map(l=>l.text).join(".")||p;n.push(f(m,m,S(t,c&&a.length>1?`${c}.${m}`:p,b),s))}return n}function mt(t,r,e,s){if(e.includes("{")&&e.includes("}")){let n=e.slice(0,e.indexOf("{")).replace(/\.$/,"").trim(),o=e.slice(e.indexOf("{")+1,e.lastIndexOf("}")).trim();return x(o).flatMap(i=>{let a=i.trim();if(!a)return[];let[p,m]=a.includes("=>")?a.split(/\s*=>\s*/):a.split(/\s+as\s+/),c=p?.trim();if(!c||c==="_")return[];let l=(m??c.split(".").pop()??c).trim(),u=c==="_"?n:`${n}.${c}`.replace(/\.\./g,".");return[P(t,r,s,u,c,l)]})}return[P(t,r,s,e,e.split(".").pop()??e,e.split(".").pop()??e)]}function Ie(t,r,e){return I(t,r,s=>lt(t,r,s),()=>N(e,/^[ \t]*use\s+(.+?)\s*;$/gm,(s,n)=>{let o=s[1]?.trim();return o?x(o).flatMap(i=>{let a=i.trim();if(!a)return[];let[p,m]=a.split(/\s+as\s+/i),c=p?.trim()??a,l=c.split("\\").pop()??c,u=(m??l).trim();return[P(t,r,n,c,l,u,S(t,c.replace(/\\/g,"."),U))]}):[]}))}function lt(t,r,e){let s=g(e,new Set(["namespace_use_declaration"])),n=[],o=(i,a,p)=>{n.push(f(a,p,S(t,i.replace(/\\/g,"."),U),s))};for(let i of e.rootNode.descendantsOfType("namespace_use_declaration")){let a=i.namedChildren.find(p=>p.type==="namespace_use_group");if(a){let p=i.namedChildren.find(m=>m.type==="namespace_name")?.text??"";for(let m of a.namedChildren){if(m.type!=="namespace_use_clause")continue;let{importedName:c,localName:l,qualified:u}=Ne(m,p);c&&o(u,c,l)}continue}for(let p of i.namedChildren){if(p.type!=="namespace_use_clause")continue;let{importedName:m,localName:c,qualified:l}=Ne(p,"");m&&o(l,m,c)}}return n}function Ne(t,r){let e=t.namedChildren.find(m=>m.type==="qualified_name"),s=t.namedChildren.filter(m=>m.type==="name"),n="";e?n=e.text:s.length>=1&&(n=s[0].text);let o=e&&s.length>0?s[s.length-1]:null,i=n.split("\\").pop()??n,a=o?.text??i,p=r?`${r}\\${n}`:n;return{importedName:i,localName:a,qualified:p}}function Pe(t,r,e){return I(t,r,s=>ut(t,r,s),()=>ft(e).flatMap(s=>St(t,r,s,e)))}function ut(t,r,e){let s=g(e,new Set(["import_statement","import_from_statement"])),n=[];for(let o of e.rootNode.descendantsOfType("import_statement"))for(let i of o.namedChildren){let a=be(i);if(!a)continue;let p=W(t,r,a.qualifiedName);n.push({importedName:a.qualifiedName,localName:a.localName,sourcePath:p,kind:"namespace",used:s.has(a.localName),usedMembers:[]})}for(let o of e.rootNode.descendantsOfType("import_from_statement")){let i=o.namedChild(0);if(!i)continue;let a=dt(i);if(a===null)continue;let p=W(t,r,a);for(let m=1;m<o.namedChildCount;m+=1){let c=o.namedChild(m);if(c.type==="wildcard_import"){n.push({importedName:"*",localName:null,sourcePath:p,kind:"side-effect",used:!0,usedMembers:[]});continue}let l=be(c);l&&n.push({importedName:l.qualifiedName,localName:l.localName,sourcePath:p,kind:"named",used:s.has(l.localName),usedMembers:[]})}}return n}function be(t){if(t.type==="aliased_import"){let r=t.namedChild(0),e=t.namedChild(1);return!r||!e?null:{qualifiedName:r.text,localName:e.text}}if(t.type==="dotted_name"){let r=t.text;return{qualifiedName:r,localName:r.split(".")[0]??r}}return t.type==="identifier"?{qualifiedName:t.text,localName:t.text}:null}function dt(t){if(t.type==="dotted_name")return t.text;if(t.type==="relative_import"){let r=y(t,"import_prefix")?.text??"",e=y(t,"dotted_name")?.text??"";return`${r}${e}`}return null}function ft(t){let r=t.split(`
2
+ `),e=[],s=0;for(let n=0;n<r.length;n++){let o=r[n],i=o.trimStart(),a=s;if(s+=o.length+1,!i.startsWith("import ")&&!i.startsWith("from "))continue;let p=o,m=a+o.length,c=G(o);for(;n+1<r.length&&(c>0||p.trimEnd().endsWith("\\"));){n++;let u=r[n];p+=`
3
+ ${u}`,m+=1+u.length,c+=G(u),s+=u.length+1}let l=gt(p);l&&e.push({...l,start:a,end:m})}return e}function gt(t){let r=t.replace(/\\\s*\n/g," ").trim();if(r.startsWith("import "))return{kind:"import",module:null,clause:r.slice(7).trim()};let e=r.match(/^from\s+([.\w]+)\s+import\s+([\s\S]+)$/);if(!e)return null;let s=e[2].trim();return s.startsWith("(")&&s.endsWith(")")&&(s=s.slice(1,-1).trim()),{kind:"from",module:e[1],clause:s}}function St(t,r,e,s){let n=R(s,e.start,e.end),o=e.clause.replace(/\n/g," ").trim();if(e.kind==="import")return x(o).flatMap(p=>{let m=p.trim().replace(/,$/,"");if(!m)return[];let[c,l]=m.split(/\s+as\s+/),u=c.trim(),d=(l??u.split(".")[0]??u).trim(),_=W(t,r,u),A=M(n,d);return[{importedName:u,localName:d,sourcePath:_,kind:"namespace",used:h(n,d)||A.length>0,usedMembers:A}]});let i=e.module?W(t,r,e.module):null,a=[];for(let p of x(o)){let m=p.trim().replace(/,$/,"");if(!m)continue;if(m==="*"){a.push({importedName:"*",localName:null,sourcePath:i,kind:"side-effect",used:!0,usedMembers:[]});continue}let[c,l]=m.split(/\s+as\s+/),u=(l??c).trim();a.push({importedName:c.trim(),localName:u,sourcePath:i,kind:"named",used:h(n,u),usedMembers:[]})}return a}import{basename as ht}from"path";function _e(t,r,e){return I(t,r,s=>yt(t,r,s),()=>xt(t,r,e))}function xt(t,r,e){return N(e,/^[ \t]*(require_relative|require)\s+["']([^"']+)["']\s*$/gm,(s,n)=>{let o=s[1],i=s[2];if(!o||!i)return[];let a=o==="require_relative"?V(t,r,i):null;if(a){let p=Ee(i);return[$(p,p,a,h(n,p))]}return[D(i,a)]})}function yt(t,r,e){let s=g(e,new Set([])),n=[],o=new Set(["require","require_relative","load"]);for(let i of e.rootNode.descendantsOfType("call")){let a=i.namedChild(0);if(!a||a.type!=="identifier"||!o.has(a.text))continue;let m=i.namedChildren.find(d=>d.type==="argument_list")?.namedChild(0);if(!m||m.type!=="string")continue;let l=m.namedChildren.find(d=>d.type==="string_content")?.text;if(!l)continue;let u=a.text==="require_relative"?V(t,r,l):null;if(u){let d=Ee(l);n.push(f(d,d,u,s))}else n.push(D(l,u))}return n}function Ee(t){return le(ht(t).replace(/\.[^.]+$/,""),/_/)}function Te(t,r,e){return I(t,r,s=>Nt(t,r,s),()=>N(e,/^[ \t]*use\s+(.+?)\s*;$/gm,(s,n)=>{let o=s[1]?.trim();return o?It(t,r,o,n):[]}))}function Nt(t,r,e){let s=g(e,new Set(["use_declaration"])),n=[];for(let o of e.rootNode.descendantsOfType("use_declaration")){let i=o.namedChild(0);if(i)for(let a of F(i,"")){if(!a.importedName||a.importedName==="*")continue;let p=T(t,r,a.qualifiedName)??T(t,r,a.qualifiedName.split("::").slice(0,-1).join("::"));n.push(f(a.importedName,a.localName,p,s))}}return n}function F(t,r){switch(t.type){case"identifier":case"super":case"self":case"crate":{let e=t.text;return[{qualifiedName:B(r,e),importedName:e,localName:e}]}case"scoped_identifier":{let e=t.text,s=e.split("::").pop()??e;return[{qualifiedName:B(r,e),importedName:s,localName:s}]}case"scoped_use_list":{let e=t.namedChild(0),s=t.namedChild(1);if(!e||!s)return[];let n=B(r,e.text),o=[];for(let i of s.namedChildren)o.push(...F(i,n));return o}case"use_list":{let e=[];for(let s of t.namedChildren)e.push(...F(s,r));return e}case"use_as_clause":{let e=t.namedChild(0),s=t.namedChild(1);if(!e||!s)return[];let n=F(e,r),o=s.text;return n.map(i=>({...i,localName:o}))}case"use_wildcard":{let e=t.namedChild(0),s=e?e.text:"";return[{qualifiedName:B(r,`${s}::*`),importedName:"*",localName:"*"}]}default:return[]}}function B(t,r){return t?r?`${t}::${r}`:t:r}function It(t,r,e,s){let n=e.trim();if(n.includes("{")&&n.includes("}")){let c=n.slice(0,n.indexOf("{")).replace(/::$/,"").trim(),l=n.slice(n.indexOf("{")+1,n.lastIndexOf("}")).trim();return x(l).flatMap(u=>{let d=u.trim();if(!d||d==="self")return[];let[_,A]=d.split(/\s+as\s+/),w=_?.trim();if(!w)return[];let De=(A??w.split("::").pop()??w).trim(),Oe=`${c}::${w}`.replace(/::::/g,"::");return[P(t,r,s,Oe,w.split("::").pop()??w,De,T(t,r,c))]})}let[o,i]=n.split(/\s+as\s+/),a=o?.trim()??n,p=(i??a.split("::").pop()??a).trim(),m=T(t,r,a)??T(t,r,a.split("::").slice(0,-1).join("::"));return[P(t,r,s,a,a.split("::").pop()??a,p,m)]}function Re(t,r,e){let s=C(t,r);if(s)return bt(t,r,s);let n=[];for(let o of e.matchAll(/^[ \t]*pub\s+use\s+(.+?)\s*;$/gm)){let i=o[1]?.trim();i&&n.push(..._t(t,r,i))}return n}function bt(t,r,e){let s=[];for(let n of e.rootNode.descendantsOfType("use_declaration")){if(!Pt(n))continue;let o=n.namedChildren.find(i=>i.type!=="visibility_modifier");if(o)for(let i of F(o,""))i.importedName&&s.push(Z(t,r,i.qualifiedName))}return s}function Pt(t){for(let r of t.children)if(r.type==="visibility_modifier"&&r.text.startsWith("pub"))return!0;return!1}function _t(t,r,e){let s=e.trim();if(s.includes("{")&&s.includes("}")){let n=s.slice(0,s.indexOf("{")).replace(/::$/,"").trim(),o=s.slice(s.indexOf("{")+1,s.lastIndexOf("}")).trim();return x(o).flatMap(i=>{let a=i.trim();if(!a||a==="self")return[];let[p]=a.split(/\s+as\s+/),m=`${n}::${p?.trim()??a}`.replace(/::::/g,"::");return[Z(t,r,m)]})}return[Z(t,r,s)]}function Z(t,r,e){return{specifier:e,sourcePath:T(t,r,e)??T(t,r,e.split("::").slice(0,-1).join("::"))}}function k({language:t,extensions:r,imports:e,parseImports:s}){return{language:t,extensions:r,capabilities:{imports:e},parseImports:s}}function Ce(t,r){let e=r.toLowerCase();for(let s of t)for(let n of s.extensions)if(e.endsWith(n))return s;return null}var Et={language:"javascript",extensions:te,capabilities:{imports:"ast-with-regex-fallback",reExports:"ast-with-regex-fallback"},parseImports:Y,parseReExports:K},Tt=k({language:"python",extensions:re,imports:"ast-with-regex-fallback",parseImports:Pe}),Rt=k({language:"jvm",extensions:b,imports:"ast-dispatch-with-regex-fallback",parseImports:ye}),Ct={language:"rust",extensions:se,capabilities:{imports:"ast-with-regex-fallback",exports:"ast-with-regex-fallback"},parseImports:Te,parseExports:Re},Dt=k({language:"ruby",extensions:ne,imports:"ast-with-regex-fallback",parseImports:_e}),Ot=k({language:"c/cpp",extensions:oe,imports:"ast-with-regex-fallback",parseImports:de}),kt=k({language:"dotnet",extensions:j,imports:"ast-dispatch-with-regex-fallback",parseImports:Se}),At={language:"dart",extensions:ie,capabilities:{imports:"regex-only",exports:"regex-only"},parseImports:fe,parseExports:ge},wt=k({language:"php",extensions:U,imports:"ast-with-regex-fallback",parseImports:Ie}),Lt=[Et,Tt,Rt,Ct,Dt,Ot,kt,At,wt];function H(t){return Ce(Lt,t)}var ee={clearGroups:["whole-project","source-file"]},jt=L("source-imports",ee),vt=L("source-exports",ee),Mt=L("source-reexports",ee);function Zr(t,r){let e=J(r);return Mt.get(t,e,()=>{let s=H(e);if(!s?.parseReExports)return[];let n=v(t,e);return n?s.parseReExports(t,e,n):[]})}function es(t,r){let e=J(r);return jt.get(t,e,()=>{let s=H(e);if(!s)return[];let n=v(t,e);return n?s.parseImports(t,e,n):[]})}function ts(t,r){let e=J(r);return vt.get(t,e,()=>{let s=H(e);if(!s?.parseExports)return[];let n=v(t,e);return n?s.parseExports(t,e,n):[]})}export{Zr as a,es as b,ts as c};
4
+ //# sourceMappingURL=chunk-QUKZ77A6.js.map
@@ -0,0 +1,2 @@
1
+ import{a as b}from"./chunk-5BZOSICN.js";import{a as f}from"./chunk-B75HZHUP.js";import{a as c}from"./chunk-W3PQRAI4.js";import{a as u}from"./chunk-BGBBVSH4.js";import{c as a,g as l}from"./chunk-64LH2QUP.js";import{b as d}from"./chunk-T67R7V5I.js";function D(i,e){let{scope:n,maxLoc:t=15,limit:r=30,scanLimit:g}=e??{},m=new c(i);return b({candidates:()=>y(m,n,t),orderCandidates:f,scanLimit:g,prepare:o=>m.calleeMap(o,{semantic:e?.semantic!==!1}),evaluate:(o,s)=>p(i,o,s.get(o.symbolId)??[]),orderResults:(o,s)=>o.loc-s.loc||o.file.localeCompare(s.file),limit:r})}function p(i,e,n){let t=h(n);if(t.size!==1||!d(i,e.relativePath,e.startLine,e.endLine))return null;let[,r]=[...t.entries()][0];return{symbol:e.symbol,shortName:a(e.symbol),file:e.relativePath,startLine:e.startLine,endLine:e.endLine,loc:u(e),forwardsTo:r.symbol,forwardsToShort:a(r.symbol),forwardsToFile:r.file}}function h(i){let e=i.some(t=>l(t.symbol))?i.filter(t=>l(t.symbol)):i,n=new Map;for(let t of e)n.has(t.symbol)||n.set(t.symbol,t);return n}function y(i,e,n){return i.productionCallableDefinitions({scope:e,minLoc:3,maxLoc:n,requireFunctionLikeSymbol:!0,excludeRootedSymbols:!0,excludeRustTraitImplMembers:!0})}export{D as a};
2
+ //# sourceMappingURL=chunk-R42LZMLX.js.map
@@ -1,4 +1,4 @@
1
- import{b as m}from"./chunk-WC43FMAB.js";import{u as o}from"./chunk-SOGLYIJ4.js";function h(t,l){let s=m(t,l);if(s.length===0)return{files:[],symbols:[],dependsOn:[],dependedOnBy:[]};let d=s.map(()=>"?").join(", "),i=t.all(`SELECT relative_path FROM documents
1
+ import{b as m}from"./chunk-QOFKVNFE.js";import{u as o}from"./chunk-64LH2QUP.js";function h(t,l){let s=m(t,l);if(s.length===0)return{files:[],symbols:[],dependsOn:[],dependedOnBy:[]};let d=s.map(()=>"?").join(", "),i=t.all(`SELECT relative_path FROM documents
2
2
  WHERE relative_path IN (${d})
3
3
  ORDER BY relative_path`,...s).map(e=>e.relative_path).filter(e=>!t.isIgnored(e)),n=o(t,i,{onlyDocumented:!0,sort:!0}).map(({relativePath:e,...c})=>c),a=t.all(`SELECT DISTINCT d2.relative_path
4
4
  FROM mentions m
@@ -32,4 +32,4 @@ import{b as m}from"./chunk-WC43FMAB.js";import{u as o}from"./chunk-SOGLYIJ4.js";
32
32
  WHERE d2.relative_path IN (${d})
33
33
  AND d1.relative_path NOT IN (${d})
34
34
  ORDER BY d1.relative_path`,...s,...s).map(e=>e.relative_path).filter(e=>!t.isIgnored(e));return{files:i,symbols:n,dependsOn:a,dependedOnBy:r}}export{h as a};
35
- //# sourceMappingURL=chunk-GD7XRHSV.js.map
35
+ //# sourceMappingURL=chunk-R7S3UCDR.js.map
@@ -0,0 +1,3 @@
1
+ import{a as q}from"./chunk-LYS4SMAQ.js";import{a as g}from"./chunk-B32FX5KB.js";import{a as _}from"./chunk-DTERBKUE.js";import{a as j}from"./chunk-LXM7AHQG.js";import{a as T}from"./chunk-WZVTADY7.js";import{a as I}from"./chunk-B3HMRQDA.js";import{a as P}from"./chunk-R42LZMLX.js";import{a as B}from"./chunk-4EAANIWC.js";import{a as M}from"./chunk-A2GVUCZR.js";import{a as L,b as H}from"./chunk-TTGWDUJ4.js";import{b as x,c as N,f as A}from"./chunk-ATGRITZP.js";import{c as E}from"./chunk-2NLK4INB.js";import{a as G}from"./chunk-Y33GRQK6.js";import{b as C}from"./chunk-6U4EODW3.js";import{a as k}from"./chunk-RYBMW2EN.js";import{f as F}from"./chunk-YISMWW66.js";import{a as R}from"./chunk-E55WCTLH.js";import{a as v}from"./chunk-W3PQRAI4.js";import{e as b,f as $}from"./chunk-L77GXANO.js";import{d as D}from"./chunk-64LH2QUP.js";import{createHash as se}from"crypto";import{existsSync as z}from"fs";import{existsSync as Y,readFileSync as J,writeFileSync as V}from"fs";import{isAbsolute as Q,join as W}from"path";var X=75e3,Z=5e3,ee=2500;function ie(e){let n=T(e);return n.symbols>=X||n.documents>=Z?ee:void 0}var ne=".scipquery-baseline.json";function S(e,n){return n&&Q(n)?n:W(e.config.projectRoot,n??ne)}function O(e,n={}){let{scope:s}=n,t=ie(e),o=[],r=C(e,{scope:s,...g.dead,scanLimit:t});for(let i of r.symbols)b(e,i.relativePath)||$(e,i.symbol,i.relativePath)||i.kind==="dead-code"&&o.push(`dead:${i.relativePath}:${i.shortName}`);for(let i of I(e,{scope:s,...g.isolated,scanLimit:t}))b(e,i.relativePath)||$(e,i.symbol,i.relativePath)||o.push(`isolated:${i.relativePath}:${i.shortName}`);for(let i of R(e,{scope:s}))i.kind==="real"&&o.push(`cycle:${te(i.path)}`);for(let i of H(e,{scope:s,...g.similar,scanLimit:t}))o.push(`similar:${[i.symbolA,i.symbolB].sort().join("|")}`);for(let i of B(e,{scope:s,...g.extract,scanLimit:t}))o.push(`extract:${i.relativePath}:${i.shortName}`);for(let i of _(e,{scope:s,...g.wrappers,scanLimit:t}))o.push(`wrapper:${i.file}:${i.shortName}`);for(let i of P(e,{scope:s,...g.passthroughs,scanLimit:t}))o.push(`passthrough:${i.file}:${i.shortName}`);for(let i of j(e,{scope:s,...g.stale,scanLimit:t}))o.push(`stale:${i.file}:${i.shortName}`);for(let i of G(e,{scope:s,...g.drift}).results)i.kind!=="pattern-deviation"&&o.push(`drift:${i.kind}:${i.file}:${i.dep}`);return[...new Set(o)].sort()}function te(e){if(e.length===0)return"";let n=0;for(let s=1;s<e.length;s++)e[s]<e[n]&&(n=s);return[...e.slice(n),...e.slice(0,n)].join(">")}function Ee(e,n={}){let s=O(e,{scope:n.scope}),t=S(e,n.path);return V(t,JSON.stringify({version:1,findings:s},null,2)+`
2
+ `),{path:t,findingCount:s.length}}function U(e,n={}){let s=S(e,n.path);if(!Y(s))throw new Error(`No baseline found at ${s}. Create one with: scip-query health --write-baseline`);let t=JSON.parse(J(s,"utf-8")),o=new Set(t.findings??[]),r=O(e,{scope:n.scope}),i=new Set(r);return{baselinePath:s,baselineCount:o.size,current:r,newFindings:r.filter(a=>!o.has(a)),fixedFindings:[...o].filter(a=>!i.has(a))}}var Ke=["echo","incomplete-migration","co-change-partner","doc-reference","unused-params","new-dead","baseline"];function Ye(e,n={}){let s=n.base??"HEAD",{minTogether:t=6,minConfidence:o=.6,maxEchoChecks:r=Number.POSITIVE_INFINITY,maxHelpers:i=Number.POSITIVE_INFINITY,minSimilarity:a=.8}=n,d=new Set(n.skip??[]),f=N(e,{base:s}),l=x(e,{base:s,plan:f}),c=l.changedFiles,u=new Set(c),m=me(e.config.projectRoot,s,f),h={base:s,changedFiles:c,changedSymbols:l.changedSymbols.length,checksRun:[],skipped:[],suppressed:[],findings:[],note:l.summary.note};if(c.length===0)return h;let p=(w,K)=>{if(d.has(w)){h.skipped.push({check:w,reason:"skipped via --skip"});return}K()};return p("echo",()=>ae(e,l.changedSymbols,u,m,r,a,h)),p("incomplete-migration",()=>ce(e,s,f,i,h)),p("co-change-partner",()=>fe(e,u,t,o,h)),p("doc-reference",()=>le(e,u,h)),p("unused-params",()=>de(e,c,h)),p("new-dead",()=>he(e,l.changedSymbols,m,h)),p("baseline",()=>ue(e,h)),oe(h,e.config.suppressions??[]),h}function oe(e,n){if(n.length===0||e.findings.length===0)return;let s=[];for(let t of e.findings){let o=n.find(r=>re(r,t));o?e.suppressed.push({finding:t,suppression:o}):s.push(t)}e.findings=s}function re(e,n){return!e.reason||e.reason.trim()===""||e.expiresAt&&Date.parse(e.expiresAt)<=Date.now()||e.id&&e.id!==n.id||e.check&&e.check!==n.check||e.file&&e.file!==n.file?!1:!!(e.id||e.check)}function ae(e,n,s,t,o,r,i){i.checksRun.push("echo");for(let a of n.slice(0,o)){if(t(a))continue;let d=L(e,a.symbol,{minSimilarity:r,limit:3});for(let f of d){let l=f.fileA===a.file?f.fileB:f.fileA,c=f.fileA===a.file?f.shortNameB:f.shortNameA,u=f.fileA===a.file?f.symbolB:f.symbolA;if(s.has(l))continue;let m=y("echo",a.symbol,a.file,u,l);i.findings.push({id:m,check:"echo",severity:"warning",evidence:"heuristic",confidence:f.similarity,file:a.file,symbol:a.symbol,relatedFiles:[l],message:`${a.shortName} (${a.file}) is ${Math.round(f.similarity*100)}% similar to established ${c} (${l})`,why:[`${a.shortName} was changed in this diff.`,`${c} is outside this diff and scored ${Math.round(f.similarity*100)}% similar by ${f.similarityBasis??"callee"} evidence.`,`Shared evidence: ${f.sharedCallees.slice(0,5).join(", ")||"(none listed)"}.`],remediation:`Extend or reuse ${c} instead of keeping the re-implementation.`,suppressionHint:`scip-query: ignore echo ${m} -- <reason>`})}}n.length>o&&i.skipped.push({check:"echo",reason:`echo check capped at ${o} of ${n.length} changed symbols`})}function ce(e,n,s,t,o){let r=M(e,{base:n,maxHelpers:t,diffPlan:s});if(!r.available){o.skipped.push({check:"incomplete-migration",reason:"no git history"});return}o.checksRun.push("incomplete-migration"),r.note&&o.skipped.push({check:"incomplete-migration",reason:r.note});for(let i of r.findings){let a=i.leftovers.map(c=>`${c.shortName} (${c.file}, ${Math.round(c.containment*100)}%)`).join(", "),d=[...i.migratedFiles,...i.leftovers.map(c=>c.file)],f=i.leftovers.length===0?void 0:Math.max(...i.leftovers.map(c=>c.containment)),l=y("incomplete-migration",i.helperSymbol,i.helperFile,d.join("|"));o.findings.push({id:l,check:"incomplete-migration",severity:"warning",evidence:"heuristic",confidence:f,file:i.helperFile,symbol:i.helperSymbol,relatedFiles:d,message:`new helper ${i.helperShortName} (${i.helperFile}) is wired into ${i.migratedFiles.length} file(s), but ${i.leftovers.length} similar un-migrated site(s) remain: ${a}`,why:[`${i.helperShortName} is new in this diff and already referenced by ${i.migratedFiles.join(", ")}.`,`Unchanged site(s) still contain the helper's callee pattern: ${a}.`],remediation:`Migrate the remaining sites to ${i.helperShortName}, or confirm they are intentionally different.`,suppressionHint:`scip-query: ignore incomplete-migration ${l} -- <reason>`})}}function fe(e,n,s,t,o){let r=F(e,{minTogether:s,minConfidence:0,maxFilesPerCommit:20});if(!r){o.skipped.push({check:"co-change-partner",reason:"no git history"});return}o.checksRun.push("co-change-partner");let i=new Set;for(let a of r){let d=n.has(a.fileA),f=n.has(a.fileB);if(d===f)continue;let l=d?a.fileA:a.fileB,c=d?a.fileB:a.fileA,u=d?a.changesA:a.changesB,m=u>0?a.together/u:0;if(m<t||k(c)||k(l)||!z(`${e.config.projectRoot}/${c}`))continue;let h=`${l}|${c}`;if(i.has(h))continue;i.add(h);let p=y("co-change-partner",l,c,String(a.together));o.findings.push({id:p,check:"co-change-partner",severity:"warning",evidence:"change-graph",confidence:m,file:l,relatedFiles:[c],message:`${l} changed, but ${c} did not \u2014 they change together ${a.together}x (${Math.round(m*100)}% of the time)`,why:[`${l} is in this diff and ${c} is not.`,`Git history shows ${a.together} co-change(s), which is ${Math.round(m*100)}% of changes to the edited side.`],remediation:`Update ${c} alongside this change, or confirm the coupling no longer holds.`,suppressionHint:`scip-query: ignore co-change-partner ${p} -- <reason>`})}}function le(e,n,s){s.checksRun.push("doc-reference");for(let t of E(e,n)){if(n.has(t.doc))continue;let o=y("doc-reference",t.doc,t.cited.join("|"));s.findings.push({id:o,check:"doc-reference",severity:"warning",evidence:"change-graph",confidence:1,file:t.doc,relatedFiles:t.cited,message:`${t.doc} cites ${t.cited.join(", ")} \u2014 changed in this diff, doc untouched`,why:[`${t.cited.join(", ")} changed in this diff.`,`${t.doc} cites the changed file(s) but was not updated in the same diff.`],remediation:`Re-read ${t.doc} and update its claims, or update its citations.`,suppressionHint:`scip-query: ignore doc-reference ${o} -- <reason>`})}}function de(e,n,s){s.checksRun.push("unused-params");for(let t of q(e,{files:n,limit:50})){let o=y("unused-params",t.symbol,t.file,t.unusedTrailing.join("|"));s.findings.push({id:o,check:"unused-params",severity:"warning",evidence:"heuristic",confidence:.85,file:t.file,startLine:t.startLine,endLine:t.endLine,symbol:t.symbol,message:`${t.shortName} (${t.file}) has trailing unused parameter(s): ${t.unusedTrailing.join(", ")}`,why:[`${t.shortName} is in a changed file.`,`The trailing parameter(s) ${t.unusedTrailing.join(", ")} are not referenced in the function body.`],remediation:"Drop the unused trailing parameters and their call-site arguments.",suppressionHint:`scip-query: ignore unused-params ${o} -- <reason>`})}}function he(e,n,s,t){t.checksRun.push("new-dead");let o=new v(e);for(let r of n){if(s(r)||r.fanIn>0||o.fileKind(r.file)==="test"||b(e,r.file)||$(e,r.symbol,r.file))continue;let i=y("new-dead",r.symbol,r.file);t.findings.push({id:i,check:"new-dead",severity:"warning",evidence:"graph-fact",confidence:.9,file:r.file,symbol:r.symbol,message:`${r.shortName} (${r.file}) was changed but has zero indexed consumers`,why:[`${r.shortName} is a changed production symbol.`,"The index reports zero consumers for this symbol.","The symbol is not in a detected entry surface or configured live root."],remediation:"Wire it up, or remove it before it becomes permanent dead code.",suppressionHint:`scip-query: ignore new-dead ${i} -- <reason>`})}}function me(e,n,s){let t=new Map(s.renamedFiles.map(r=>[r.to,r.from])),o=new Map;return r=>{let i=t.get(r.file);if(!i)return!1;let a=D(r.symbol);if(!a)return!1;let d=o.get(i);return d===void 0&&(d=A(e,n,i),o.set(i,d)),d!==null&&pe(d,a)}}function pe(e,n){return new RegExp(`\\b${ge(n)}\\b`).test(e)}function ge(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function ue(e,n){if(!z(S(e))){n.skipped.push({check:"baseline",reason:"no .scipquery-baseline.json \u2014 run health --write-baseline to enable"});return}n.checksRun.push("baseline");let s=U(e);for(let t of s.newFindings){let o=y("baseline",t);n.findings.push({id:o,check:"baseline",severity:"error",evidence:"baseline",confidence:1,message:`new finding vs committed baseline: ${t}`,why:["A committed health baseline exists.","The current health result contains a finding not present in that baseline."],remediation:"Fix the finding, or knowingly accept it via health --write-baseline.",suppressionHint:`scip-query: ignore baseline ${o} -- <reason>`})}}function y(e,...n){return`SQ${se("sha256").update([e,...n].join("\0")).digest("hex").slice(0,12).toUpperCase()}`}export{O as a,Ee as b,U as c,Ke as d,Ye as e};
3
+ //# sourceMappingURL=chunk-RGDUIMNE.js.map
@@ -1,4 +1,4 @@
1
- import{b as l}from"./chunk-WC43FMAB.js";import{a}from"./chunk-NO2TPMCQ.js";import{c as i,f as n}from"./chunk-SOGLYIJ4.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-QOFKVNFE.js";import{a}from"./chunk-W3PQRAI4.js";import{c as i,f as n}from"./chunk-64LH2QUP.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-WC43FMAB.js";import{a}from"./chunk-NO2TPMCQ.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-TCCUWKH4.js.map
29
+ //# sourceMappingURL=chunk-RNLUCQJB.js.map
@@ -0,0 +1,2 @@
1
+ import{a as p,f as h}from"./chunk-YISMWW66.js";import{a as c}from"./chunk-L77GXANO.js";import{a as d}from"./chunk-5D3BT4B4.js";import{existsSync as k}from"fs";import{join as x}from"path";function z(e){return m.test(e)}var m=/(?:^|\/)(?:package-lock\.json|pnpm-lock\.yaml|yarn\.lock|Cargo\.lock|CHANGELOG(?:\.[a-z]+)?|.*\.map)$|(?:^|\/)(?:dist|build|out|node_modules|docs\/plans)\//i;function I(e,n,t={}){let{minTogether:o=4,minConfidence:s=.6,limit:a=30,maxFilesPerCommit:b=20}=t,u=p(e),r=n!==void 0,f=h(e,{minTogether:r?Math.min(o,2):o,minConfidence:r?0:s,maxFilesPerCommit:b});if(!u||!f)return{available:!1,commitsAnalyzed:0,findings:[]};let y=d(e),S=L(e),A=t.includeLinked===!0||r,l=[];for(let i of f){if(m.test(i.fileA)||m.test(i.fileB)||!C(e,i.fileA)||!C(e,i.fileB)||r&&!i.fileA.includes(n)&&!i.fileB.includes(n)||!r&&(c(i.fileA)==="test"||c(i.fileB)==="test"||F(i.fileA,i.fileB)))continue;let g=B(y,S,i.fileA,i.fileB);if(!(!A&&g)&&(l.push({...i,structurallyLinked:g}),l.length>=a))break}return{available:!0,commitsAnalyzed:u.commits.length,findings:l}}function C(e,n){return k(x(e.config.projectRoot,n))}function F(e,n){let t=e.lastIndexOf("/"),o=n.lastIndexOf("/");if(e.slice(0,t)!==n.slice(0,o))return!1;let s=e.slice(t+1).split(".")[0],a=n.slice(o+1).split(".")[0];return s!==""&&s===a}function L(e){return(e.config.declaredCouplings??[]).filter(n=>Array.isArray(n.files)&&n.files.length>=2).map(n=>new Set(n.files))}function B(e,n,t,o){return e.get(t)?.has(o)===!0||e.get(o)?.has(t)===!0?!0:n.some(s=>s.has(t)&&s.has(o))}export{z as a,I as b};
2
+ //# sourceMappingURL=chunk-RYBMW2EN.js.map
@@ -1,4 +1,4 @@
1
- import{c as C}from"./chunk-64UY7VTR.js";import{c as _}from"./chunk-7I6KNKE3.js";import{b as S}from"./chunk-APLCSDXL.js";import{t as M}from"./chunk-WEJYUS5O.js";import{c as I}from"./chunk-PBGTMPJ7.js";import{d as f,r as y,v as h}from"./chunk-SOGLYIJ4.js";import{a as m,c as v,f as b}from"./chunk-WQFOZIID.js";import{c as g,d as D}from"./chunk-VDZL45XI.js";function R(e,r,n,t={}){if(!n)return[];let i=m(e,r);return i?i.indexOf(n)===-1?[]:(L(e,r).get(n)??[]).filter(s=>!B(s,t)):[]}function B(e,r){return typeof r.excludeStartLine=="number"&&typeof r.excludeEndLine=="number"&&e>=r.excludeStartLine&&e<=r.excludeEndLine}var G=g("file-identifiers",{clearGroups:["whole-project","source-file"]});function w(e,r){let n=b(e,r);return n?n.fileIdentifiers:G.get(e,r,()=>new Set(L(e,r).keys()))}var H=g("file-ident-lines",{clearGroups:["whole-project","source-file"]});function L(e,r){let n=b(e,r);return n?n.identifierLineMap:H.get(e,r,()=>z(e,r))}var J=g("file-idents-by-line",{clearGroups:["whole-project","source-file"]});function ie(e,r){let n=b(e,r);return n?n.identifiersByLine:J.get(e,r,()=>{let t=L(e,r),i=0;for(let s of t.values()){let c=s[s.length-1];c!==void 0&&c>i&&(i=c)}let o=new Array(i+1);for(let s=0;s<=i;s+=1)o[s]=new Set;for(let[s,c]of t)for(let a of c)o[a].add(s);return o})}function z(e,r){let n=new Map,t=(c,a)=>{let l=n.get(c);if(!l){n.set(c,[a]);return}l[l.length-1]!==a&&l.push(a)},i=m(e,r);if(!i)return n;let o=M(i).split(/\r?\n/),s=/\b([A-Za-z_$][\w$]*)\b/g;for(let c=0;c<o.length;c+=1){let a=o[c]??"";for(let l of a.matchAll(s))l[1]&&t(l[1],c)}return n}function k(e){return e.replace(/\\/g,"/").replace(/^\.\//,"")}function d(e,r){return k(e)===k(r)}function O(e,r){let n=new Map;for(let t of S(e,r)){if(!t.sourcePath)continue;let i=t.localName??t.importedName;if(i&&F(n,i,t.sourcePath),t.kind==="namespace")for(let o of t.usedMembers)F(n,o,t.sourcePath)}return n}function F(e,r,n){let t=e.get(r);t||(t=new Set,e.set(r,t)),t.add(n)}function le(e,r){return E(e,r,n=>{let t=n?`AND m.symbol_id IN (${n.map(()=>"?").join(",")})`:"";return e.all(`SELECT
1
+ import{d as C}from"./chunk-QH5GTVVB.js";import{c as _}from"./chunk-5ALI77D7.js";import{b as S}from"./chunk-QUKZ77A6.js";import{t as M}from"./chunk-ADKQX2OY.js";import{d as f,r as y,w as h}from"./chunk-64LH2QUP.js";import{a as b}from"./chunk-T67R7V5I.js";import{a as v}from"./chunk-HCQ7J2N5.js";import{a as m}from"./chunk-YVQUQIBM.js";import{c as I}from"./chunk-TMS4JPWY.js";import{c as g,d as D}from"./chunk-BJ7OHKB5.js";function R(e,r,n,t={}){if(!n)return[];let i=m(e,r);return i?i.indexOf(n)===-1?[]:(L(e,r).get(n)??[]).filter(s=>!B(s,t)):[]}function B(e,r){return typeof r.excludeStartLine=="number"&&typeof r.excludeEndLine=="number"&&e>=r.excludeStartLine&&e<=r.excludeEndLine}var G=g("file-identifiers",{clearGroups:["whole-project","source-file"]});function w(e,r){let n=b(e,r);return n?n.fileIdentifiers:G.get(e,r,()=>new Set(L(e,r).keys()))}var H=g("file-ident-lines",{clearGroups:["whole-project","source-file"]});function L(e,r){let n=b(e,r);return n?n.identifierLineMap:H.get(e,r,()=>z(e,r))}var J=g("file-idents-by-line",{clearGroups:["whole-project","source-file"]});function ie(e,r){let n=b(e,r);return n?n.identifiersByLine:J.get(e,r,()=>{let t=L(e,r),i=0;for(let s of t.values()){let c=s[s.length-1];c!==void 0&&c>i&&(i=c)}let o=new Array(i+1);for(let s=0;s<=i;s+=1)o[s]=new Set;for(let[s,c]of t)for(let a of c)o[a].add(s);return o})}function z(e,r){let n=new Map,t=(c,a)=>{let l=n.get(c);if(!l){n.set(c,[a]);return}l[l.length-1]!==a&&l.push(a)},i=m(e,r);if(!i)return n;let o=M(i).split(/\r?\n/),s=/\b([A-Za-z_$][\w$]*)\b/g;for(let c=0;c<o.length;c+=1){let a=o[c]??"";for(let l of a.matchAll(s))l[1]&&t(l[1],c)}return n}function k(e){return e.replace(/\\/g,"/").replace(/^\.\//,"")}function d(e,r){return k(e)===k(r)}function O(e,r){let n=new Map;for(let t of S(e,r)){if(!t.sourcePath)continue;let i=t.localName??t.importedName;if(i&&F(n,i,t.sourcePath),t.kind==="namespace")for(let o of t.usedMembers)F(n,o,t.sourcePath)}return n}function F(e,r,n){let t=e.get(r);t||(t=new Set,e.set(r,t)),t.add(n)}function le(e,r){return E(e,r,n=>{let t=n?`AND m.symbol_id IN (${n.map(()=>"?").join(",")})`:"";return e.all(`SELECT
2
2
  m.symbol_id,
3
3
  d.relative_path,
4
4
  COUNT(*) AS ref_count
@@ -37,4 +37,4 @@ import{c as C}from"./chunk-64UY7VTR.js";import{c as _}from"./chunk-7I6KNKE3.js";
37
37
  ) mention_doc ON mention_doc.symbol_id = gs.id
38
38
  WHERE 1 = 1
39
39
  ${e.symbolNoiseFor("gs")}`),n=new Map;for(let t of r){if(!t.relative_path||e.isIgnored(t.relative_path))continue;let i=f(t.symbol);if(!i)continue;let o=n.get(i);o||(o=[],n.set(i,o)),o.some(s=>s.symbolId===t.id)||o.push({symbol:t.symbol,symbolId:t.id,file:t.relative_path})}return n})}function N(e,r,n){let t=x(e).get(n);if(!t||t.length===0)return[];if(t.length===1)return[p(t[0])];let i=t.filter(a=>a.file===r);if(i.length>0)return i.map(p);let o=O(e,r),s=o.get(n);if(s)for(let a of s){let l=t.filter(u=>d(a,u.file));if(l.length>0)return l.map(p)}let c=new Set;for(let a of o.values())for(let l of a)c.add(l);for(let a of c){let l=t.filter(u=>d(a,u.file));if(l.length>0&&l.length===t.length)return l.map(p)}return[]}function Ce(e,r,n){let t=N(e,r,n);if(t.length>0)return t;let i=x(e).get(n);return!i||i.length===0?[]:i.map(p)}function $(e,r,n={}){let t=_(e,r);if(!t)return[];let i=f(t.symbol);if(!i)return[];if(n.semantic!==!1){let s=C(e,{...t,leaf:i,parentTypeName:null,isFunctionLike:!1,isTypeLike:!1,kind:null,documentation:null,enclosingSymbol:null});if(s.length>0){let c=new Map;for(let a of s){let l=c.get(a.file)??[];l.push(a.line),c.set(a.file,l)}return P(e,c)}}let o=new Map;for(let s of I(e)){let c=m(e,s);if(!c||c.indexOf(i)===-1||s!==t.relativePath&&!N(e,s,i).some(u=>u.symbolId===t.symbolId))continue;let a=R(e,s,i,s===t.relativePath?{excludeStartLine:t.startLine,excludeEndLine:t.endLine}:{});a.length>0&&o.set(s,a)}return P(e,o)}function we(e,r){let n=new Map;for(let o of r){if(!o.leaf)continue;let s=n.get(o.leaf)??[];s.push(o),n.set(o.leaf,s)}if(n.size===0)return new Map;let t=new Set(r.map(o=>o.symbolId)),i=new Map;for(let o of I(e)){let s=w(e,o);if(s.size!==0){for(let c of s)if(n.has(c))for(let a of N(e,o,c)){if(!t.has(a.symbolId)||o===a.relativePath)continue;let l=i.get(a.symbolId);l||(l=new Set,i.set(a.symbolId,l)),l.add(o)}}}return i}function p(e){return{symbolId:e.symbolId,symbol:e.symbol,relativePath:e.file}}function P(e,r){let n=[],t=new Set;for(let[i,o]of r){let s=y(e,i);for(let c of o){let a=h(s,c),l=`${i}|${c}|${a?.symbol??""}`;t.has(l)||(t.add(l),n.push({file:i,line:c,enclosingSymbol:a?.symbol??null}))}}return n}function Y(e,r){let n=q(e,r);return n?K(e,Q(e,n.match,n.identifier)):[]}function je(e,r,n={}){return Z(e,r,n).map(t=>({file:t.file,line:t.line,enclosingSymbol:t.enclosingSymbol}))}function Z(e,r,n={}){let t=$(e,r,{semantic:n.semantic}),i=t.length>0?j(t,"source-attribution"):j(Y(e,r),"scip-reference-chunk");return n.includeIgnored===!0?i:i.filter(o=>!e.isIgnored(o.file))}function j(e,r){return e.map(n=>({...n,provenance:r}))}function Q(e,r,n){let t=new Map;for(let[i,o]of U(e,r.symbolId))t.set(i,V(e,i,o,r,n));return t}function U(e,r){let n=new Map;for(let t of A(e,[r])){if(e.isIgnored(t.relative_path))continue;let i=n.get(t.relative_path);i||(i=[],n.set(t.relative_path,i)),i.push({start_line:t.chunk_start,end_line:t.chunk_end})}return n}function V(e,r,n,t,i){let o=r===t.relativePath?{excludeStartLine:t.startLine,excludeEndLine:t.endLine}:{},s=i?R(e,r,i,o):[];return n.flatMap(c=>X(s,c))}function X(e,r){let n=e.filter(t=>t>=r.start_line&&t<=r.end_line);return n.length>0?n:[r.start_line]}function q(e,r){let n=_(e,r);return n?{match:n,identifier:f(n.symbol)||null}:null}function K(e,r){let n=[],t=new Set;for(let[i,o]of r){let s=y(e,i);for(let c of o){let a=h(s,c),l=`${i}|${c}|${a?.symbol??""}`;t.has(l)||(t.add(l),n.push({file:i,line:c,enclosingSymbol:a?.symbol??null}))}}return n}export{L as a,ie as b,le as c,fe as d,A as e,d as f,Se as g,ye as h,x as i,O as j,N as k,Ce as l,we as m,Y as n,je as o};
40
- //# sourceMappingURL=chunk-6ZFKI5EP.js.map
40
+ //# sourceMappingURL=chunk-SA6B3EGD.js.map
@@ -0,0 +1,2 @@
1
+ import{a as C}from"./chunk-XGGTESMN.js";import{a as m,b as d,c as L,d as g}from"./chunk-HCQ7J2N5.js";import{a as h,i as A,j as S}from"./chunk-YVQUQIBM.js";import{b as x,c as _,d as N}from"./chunk-CMGOXDVP.js";import{f as b}from"./chunk-BJ7OHKB5.js";var k=new Set(["identifier","type_identifier","field_identifier"]),B=new Set(["identifier"]),V=new Set(["identifier","property_identifier","type_identifier","shorthand_property_identifier","shorthand_property_identifier_pattern"]),j=new Set(["rust","python"]),v=/\{([^{}]*)\}/g,O=/\b([A-Za-z_][\w]*)\b/g;function F(e,t){return P(t).has(e.type)}function R(e,t){return j.has(t)&&e.type==="string_content"}function y(e){let t=0;for(let n of e.values()){let c=n[n.length-1];c!==void 0&&c>t&&(t=c)}let r=new Array(t+1);for(let n=0;n<=t;n+=1)r[n]=new Set;for(let[n,c]of e)for(let u of c)r[u].add(n);return r}function P(e){return e==="rust"?k:e==="python"?B:V}function w(e,t){let r=e.startPosition.row;for(let n of e.text.matchAll(v)){let c=n[1]??"";for(let u of c.matchAll(O))u[1]&&t(u[1],r)}}var H=[/\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],z=/^#!?\[\s*serde\s*\(/,U=/^#!?\[\s*schemars\s*\(/,G=/^#!?\[\s*validate\s*\(/,K=new Set(["invoke","invokeTauriCommand","listen","once","emit","subscribe","dispatch","sendCommand","callRust"]);function T(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 c=S(n);if(!c||!K.has(c))return;let u=e.namedChildren.find(a=>a.type==="arguments");if(!u)return;let i=u.namedChild(0);if(!i||i.type!=="string")return;let o=i.namedChildren.find(a=>a.type==="string_fragment");o&&r.add(o.text)}function D(e,t){let r=z.test(e),n=U.test(e),c=G.test(e);if(!(!r&&!n&&!c))for(let u of H){u.lastIndex=0;let i;for(;(i=u.exec(e))!==null;){let o=i[1],a=o.split("::").pop()??o;a==="is_none"&&/\bOption\b/.test(o)||a==="is_empty"&&/\b(String|Vec|HashMap|BTreeMap|HashSet|BTreeSet)\b/.test(o)||a&&t.add(a)}}}function E(e,t){let r=new Map,n=(i,o)=>{if(i===o)return;let a=r.get(i);a||(a=new Set,r.set(i,a)),a.add(o)},c=t==="python"?new Set(["identifier"]):new Set(["type_identifier"]),u=(i,o)=>{let a=s=>{c.has(s.type)&&s.text!==o&&n(s.text,o);for(let l of s.children)a(l)};for(let s of i.children)a(s)};if(t==="rust")for(let i of e.rootNode.descendantsOfType(["struct_item","enum_item","union_item","type_item"])){let o=i.namedChildren.find(s=>s.type==="type_identifier")?.text;if(!o)continue;let a=i.namedChildren.find(s=>s.type==="field_declaration_list"||s.type==="enum_variant_list"||s.type==="ordered_field_declaration_list");a&&u(a,o),i.type==="type_item"&&u(i,o)}else if(t==="python")for(let i of e.rootNode.descendantsOfType("class_definition")){let o=i.namedChildren.find(s=>s.type==="identifier")?.text;if(!o)continue;let a=i.namedChildren.find(s=>s.type==="block");if(a)for(let s of a.descendantsOfType("type"))for(let l of s.descendantsOfType("identifier"))l.text!==o&&n(l.text,o)}else for(let i of e.rootNode.descendantsOfType(["interface_declaration","type_alias_declaration","class_declaration"])){let o=i.namedChildren.find(a=>a.type==="type_identifier")?.text;o&&u(i,o)}return r}var Y=b("source-facts",{clearGroups:["whole-project","source-file"]});function f(e,t){let r=h(e,t);if(!r)return null;let n=J(t,r);return n?Y.get(e,t,r,()=>Q(e,t,n,r)):null}function J(e,t){return d(e)?L(t)?.language??null:m(e)}function Q(e,t,r,n){let c=x(e,t,n),u=_(e,"source-facts",t,c);if(u){let a=q(u);if(a&&a.language===r)return a}let i=g(e,t);if(!i)return null;let o=$(i,r);return N(e,"source-facts",t,c,Z(o)),o}function Z(e){let t={language:e.language,callables:e.callables,callSites:e.callSites,typeContainerMap:[...e.typeContainerMap.entries()].map(([r,n])=>[r,[...n]]),identifierLineMap:[...e.identifierLineMap.entries()],rustAttrReferencedNames:[...e.rustAttrReferencedNames],crossLanguageDispatchNames:[...e.crossLanguageDispatchNames]};return JSON.stringify(t)}function q(e){try{let t=JSON.parse(e),r=new Map(t.identifierLineMap);return{language:t.language,callables:t.callables,callSites:t.callSites,typeContainerMap:new Map(t.typeContainerMap.map(([n,c])=>[n,new Set(c)])),identifierLineMap:r,identifiersByLine:y(r),fileIdentifiers:new Set(r.keys()),rustAttrReferencedNames:new Set(t.rustAttrReferencedNames),crossLanguageDispatchNames:new Set(t.crossLanguageDispatchNames)}}catch{return null}}function W(e,t,r,n){let c=f(e,t);return c?X(c,r,n)?.isLiteralPassthrough??!0:!0}function X(e,t,r){return e.callables.find(n=>n.startLine===t&&n.endLine===r)??null}function $(e,t){let r=[],n=[],c=new Set,u=new Set,i=new Map,o=(s,l)=>{let p=i.get(s);if(!p){i.set(s,[l]);return}p[p.length-1]!==l&&p.push(l)},a=s=>{let l=C(s,t);l&&r.push(l);let p=A(s,t);p&&n.push(p),T(s,t,u),t==="rust"&&(s.type==="attribute_item"||s.type==="inner_attribute_item")&&D(s.text,c),F(s,t)&&o(s.text,s.startPosition.row),R(s,t)&&w(s,o);for(let M of s.children)a(M)};return a(e.rootNode),{language:t,callables:r,callSites:n,typeContainerMap:E(e,t),identifierLineMap:i,identifiersByLine:y(i),fileIdentifiers:new Set(i.keys()),rustAttrReferencedNames:c,crossLanguageDispatchNames:u}}var I=new Set(["rust","typescript","tsx","javascript","python"]);function ee(e,t){let r=f(e,t);return!r||!I.has(r.language)?null:r.callables.map(n=>({name:n.name,startLine:n.startLine,endLine:n.endLine}))}function te(e,t){let r=f(e,t);return!r||!I.has(r.language)?null:r.callSites}function re(e,t){return f(e,t)?.typeContainerMap??new Map}function ne(e,t,r={}){let n=f(e,t);if(!n)return[];let c=[];if(r.includeCrossLanguageDispatchNames)for(let u of n.crossLanguageDispatchNames)c.push({name:u,kind:"cross-language-dispatch",occurrences:1});if(r.includeRustAttributeNames&&n.language==="rust")for(let u of n.rustAttrReferencedNames)c.push({name:u,kind:"rust-attribute",occurrences:1});return c}export{f as a,W as b,ee as c,te as d,re as e,ne as f};
2
+ //# sourceMappingURL=chunk-T67R7V5I.js.map
@@ -0,0 +1,3 @@
1
+ import{a as f}from"./chunk-NN3O7TPH.js";import{c as l}from"./chunk-BJ7OHKB5.js";import{readdirSync as g}from"fs";import{execFileSync as p}from"child_process";import{extname as d,join as m}from"path";var x=[".ts",".tsx",".mts",".cts",".js",".jsx",".mjs",".cjs",".vue",".rs",".py",".pyi",".java",".kt",".kts",".scala",".sc",".rb",".c",".h",".cc",".cpp",".cxx",".hpp",".hh",".hxx",".cs",".vb",".php",".dart"],O=[".vue"],S=new Set(x.map(e=>e.toLowerCase())),y=[...S].sort().join(","),h=new Set(["node_modules",".git","target","dist","build",".next",".nuxt",".cache",".turbo","out","coverage",".scipquery-cache","__pycache__",".venv","venv",".idea",".vscode"]);function F(e,n={}){let s=n.includeIndexed??!0,r=n.includeAuxiliary??!0,t=n.extensions?.map(c=>c.toLowerCase()),o=t?new Set(t):S,u=t?[...o].sort().join(","):y,i=`${s?"1":"0"}|${r?"1":"0"}|${u}`;return E.get(e,i,()=>{let c=new Set;if(s)for(let a of f(e,{includeIgnored:!1}))o.has(d(a).toLowerCase())&&c.add(a);if(r)for(let a of _(e.config.projectRoot,o))e.isIgnored(a)||s&&c.has(a)||c.add(a);return[...c].sort()})}var E=l("source-files",{clearGroups:[]});function _(e,n){return I(e,n)??v(e,n)}function I(e,n){try{let s=p("git",["ls-files","--cached","--others","--exclude-standard"],{cwd:e,encoding:"utf-8",timeout:1e4,stdio:["ignore","pipe","ignore"]}),r=new Set;for(let t of s.split(`
2
+ `)){let o=t.trim();o&&n.has(d(o).toLowerCase())&&r.add(o)}return r}catch{return null}}function v(e,n){let s=new Set,r=t=>{let o=t?m(e,t):e,u;try{u=g(o,{withFileTypes:!0})}catch{return}for(let i of u)if(!h.has(i.name)){if(i.isDirectory()){r(t?`${t}/${i.name}`:i.name);continue}n.has(d(i.name).toLowerCase())&&s.add(t?`${t}/${i.name}`:i.name)}};return r(""),s}export{O as a,h as b,F as c};
3
+ //# sourceMappingURL=chunk-TMS4JPWY.js.map
@@ -0,0 +1,5 @@
1
+ import{a as F,b as y,e as L,f as E}from"./chunk-UIWAZ2NT.js";import{b as q}from"./chunk-B75HZHUP.js";import{a as k}from"./chunk-W3PQRAI4.js";import{a as N}from"./chunk-44JOJLMO.js";import{a as A}from"./chunk-5ALI77D7.js";import{c as b,d as I,g as w}from"./chunk-64LH2QUP.js";import{b as z}from"./chunk-YVQUQIBM.js";import{d as D}from"./chunk-BJ7OHKB5.js";function be(e,i,t={}){let{minSimilarity:n=.4,limit:s=20}=t,o=W(e,i,{semantic:t.semantic!==!1});if(!o)return[];if(!w(o.symbol))return[];let a=G(e,o,n,{scanLimit:t.scanLimit,semantic:t.semantic!==!1});return a.length>0?a.slice(0,s):Q(e,i,{minSimilarity:n,limit:s})}function G(e,i,t,n){let s=T(e,{minCallees:3,excludeSymbol:i.symbol,scanLimit:n.scanLimit,semantic:n.semantic}),o=L([i,...s].map(c=>c.callees)),a=[];for(let c of s){if(c.callees.size<3)continue;let r=$(i,c,o,{minSimilarity:t,requireSignificantShared:1,requireSharedCount:0});r&&a.push(r)}return a.sort((c,r)=>r.similarity-c.similarity),a}function $(e,i,t,n){let{similarity:s,significantShared:o}=E(e.callees,i.callees,t);if(s<n.minSimilarity)return null;let a=F(e.callees,i.callees).size;if(o.length<n.requireSignificantShared&&a<n.requireSharedCount)return null;let c=o.length>0?o:[...F(e.callees,i.callees)];return{symbolA:e.symbol,shortNameA:b(e.symbol),fileA:e.file,symbolB:i.symbol,shortNameB:b(i.symbol),fileB:i.file,similarity:s,similarityBasis:"callees",sharedCallees:c.map(b),uniqueToA:[...y(e.callees,i.callees)].map(b),uniqueToB:[...y(i.callees,e.callees)].map(b)}}function ge(e,i={}){let{minSimilarity:t=.5,limit:n=20,scope:s,minCallees:o=4,crossFileOnly:a=!1,scanLimit:c}=i,r=T(e,{minCallees:o,scope:s,scanLimit:c,semantic:i.semantic!==!1}),l=L(r.map(m=>m.callees)),f=new Map;for(let m of r)for(let u of m.callees)f.set(u,(f.get(u)??0)+1);let h=Math.max(8,Math.ceil(Math.sqrt(r.length))),R=new Map;for(let m=0;m<r.length;m+=1)for(let u of r[m].callees){if((f.get(u)??0)>h)continue;let g=R.get(u);g||(g=[],R.set(u,g)),g.push(m)}let x=[],P=0,B=new Set;for(let m=0;m<r.length;m+=1){let u=r[m],g=new Set;for(let C of u.callees){let S=R.get(C);if(S)for(let p of S)p>m&&g.add(p)}for(let C of g){let S=`${m}|${C}`;if(B.has(S))continue;B.add(S);let p=r[C];if(a&&u.file===p.file)continue;if(u.paramCount>=0&&p.paramCount>=0){let O=Math.abs(u.paramCount-p.paramCount),U=Math.max(2,Math.ceil(Math.max(u.paramCount,p.paramCount)*.5));if(O>U)continue}let M=$(u,p,l,{minSimilarity:t,requireSignificantShared:2,requireSharedCount:4});M&&(V(x,M,n,P),P+=1)}}return x.sort((m,u)=>u.result.similarity-m.result.similarity||m.order-u.order),x.map(m=>m.result)}function V(e,i,t,n){if(t<=0)return;if(e.length<t){e.push({result:i,order:n});return}let s=0;for(let a=1;a<e.length;a+=1){let c=e[a],r=e[s];(c.result.similarity<r.result.similarity||c.result.similarity===r.result.similarity&&c.order>r.order)&&(s=a)}let o=e[s];i.similarity<=o.result.similarity||(e[s]={result:i,order:n})}var Z=["ScipDatabase#all","ScipDatabase#get","ScipDatabase#prepare","ScipDatabase#pathExclusionsFor","ScipDatabase#isIgnored","ScipDatabase#symbolNoiseFor","PerDbValue#get","PerDbValue#has",":storage:db:ScipDatabase:all",":storage:db:ScipDatabase:get",":storage:db:ScipDatabase:prepare",":storage:db:ScipDatabase:pathExclusionsFor",":storage:db:ScipDatabase:isIgnored",":storage:db:ScipDatabase:symbolNoiseFor",":storage:per-db-cache:PerDbValue:get",":storage:per-db-cache:PerDbValue:has"];function W(e,i,t){let n=A(e,i),s=new k(e);if(!n)return null;let o=N(e,n,{semantic:t.semantic});return{symbol:n.symbol,file:n.relativePath,callees:v(o.map(a=>a.symbol)),paramCount:s.callableSignature(n)?.paramCount??-1}}var K=D("callee-fingerprint-corpus",{clearGroups:["whole-project","definition-catalog"]});function T(e,i){let{minCallees:t,scope:n,excludeSymbol:s,scanLimit:o}=i,a=i.semantic!==!1,c=K.get(e,()=>new Map),r=`${t}|${n??""}|${o??""}|${a}`,l=c.get(r);return l||(l=H(e,{minCallees:t,scope:n,scanLimit:o,semantic:a}),c.set(r,l)),s===void 0?l:l.filter(f=>f.symbol!==s)}function H(e,i){let{minCallees:t,scope:n,scanLimit:s,semantic:o}=i,a=new k(e),c=q(a.productionCallableDefinitions({scope:n,minLoc:5,sortByLocDesc:typeof s=="number"&&s>0}),s),r=a.calleeMap(c,{semantic:o});return c.map(l=>({symbol:l.symbol,file:l.relativePath,callees:v((r.get(l.symbolId)??[]).map(f=>f.symbol)),paramCount:a.callableSignature(l)?.paramCount??-1})).filter(l=>l.callees.size>=t)}function v(e){return new Set([...e].filter(i=>!J(i)))}function J(e){return Z.some(i=>e.includes(i))}function Q(e,i,t){let n=X(e,i);if(!n||n.tokens.size<3)return[];let s=t.minSimilarity>=.5?t.minSimilarity:.3,o=[],a=new Set,c=te(ie(e));for(let r of n.tokens)for(let l of c.get(r)??[])a.add(l);for(let r of a){if(r.symbol===n.symbol||r.tokens.size<3)continue;let l=F(n.tokens,r.tokens);if(l.size<2)continue;let f=new Set([...n.tokens,...r.tokens]),h=f.size>0?l.size/f.size:0;h<s||o.push({symbolA:n.symbol,shortNameA:b(n.symbol),fileA:n.file,symbolB:r.symbol,shortNameB:b(r.symbol),fileB:r.file,similarity:h,similarityBasis:"source-tokens",sharedCallees:[...l].sort(),uniqueToA:[...y(n.tokens,r.tokens)].sort(),uniqueToB:[...y(r.tokens,n.tokens)].sort()})}return o.sort((r,l)=>l.similarity-r.similarity||r.shortNameB.localeCompare(l.shortNameB)),o.slice(0,t.limit)}function X(e,i){let t=A(e,i);if(!t||!w(t.symbol))return null;let n=Y(e,t);return n?{symbol:t.symbol,file:t.relativePath,tokens:n}:null}function Y(e,i){let t=I(i.symbol),n=j(e,i.relativePath,i.startLine,i.endLine,t),s=_(n,t);return s.size>0?s:null}var ee=D("source-fingerprint-corpus",{clearGroups:["whole-project","definition-catalog"]});function ie(e){return ee.get(e,()=>ne(e))}function te(e){let i=new Map;for(let t of e)for(let n of t.tokens){let s=i.get(n);s||(s=[],i.set(n,s)),s.push(t)}return i}function ne(e){return new k(e).productionCallableDefinitions().map(t=>({symbol:t.symbol,file:t.relativePath,tokens:_(j(e,t.relativePath,t.startLine,t.endLine,t.leaf),t.leaf)})).filter(t=>t.tokens.size>0)}function j(e,i,t,n,s){let o=z(e,i);if(o.length===0)return"";if(n>=t&&n-t<=12)return o.slice(t,n+1).join(`
2
+ `);let a=[new RegExp(`\\bdef\\s+${d(s)}\\b`),new RegExp(`\\bfun\\s+${d(s)}\\b`),new RegExp(`\\bfn\\s+${d(s)}\\b`),new RegExp(`\\bfunction\\s+${d(s)}\\b`),new RegExp(`\\b${d(s)}\\s*\\(`)],c=o.findIndex(r=>a.some(l=>l.test(r)));if(c>=0){let r=c;for(let l=c+1;l<o.length&&l<=c+8;l++){let f=o[l]??"";if(l>c&&se(f)||(r=l,f.trim()===""&&l>c+1))break}return o.slice(c,r+1).join(`
3
+ `)}return o.slice(t,Math.min(o.length,t+8)).join(`
4
+ `)}function _(e,i){if(!e)return new Set;let t=new Set(["public","private","protected","final","static","class","def","fun","fn","function","return","string","bool","boolean","void","unit","self","this","new","const","let","var","end","pub"]),n=re(i),o=e.replace(/["'`]/g," ").replace(/\b\d+\b/g," NUM ").replace(/([a-z0-9])([A-Z])/g,"$1 $2").replace(/[^A-Za-z0-9_]+/g," ").replace(/_/g," ").toLowerCase().split(/\s+/).map(a=>a.trim()).filter(a=>a.length>1).filter(a=>!t.has(a)).filter(a=>!n.has(a));return new Set(o)}function re(e){return new Set(e.replace(/([a-z0-9])([A-Z])/g,"$1 $2").split(/[^A-Za-z0-9_]+|_/).map(i=>i.toLowerCase()).filter(i=>i.length>1))}function se(e){return/^\s*(?:def|fun|fn|function|class|trait|module|object|enum|interface|public|private|protected)\b/.test(e)}function d(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}export{be as a,ge as b,V as c,T as d,v as e};
5
+ //# sourceMappingURL=chunk-TTGWDUJ4.js.map