scip-query 0.6.6 → 0.6.7

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 (165) hide show
  1. package/README.md +20 -1
  2. package/dist/chunk-2AUZ3PLO.js +2 -0
  3. package/dist/{chunk-PIRXZGV6.js → chunk-2CC7RA6B.js} +2 -2
  4. package/dist/{chunk-OQZF2DQJ.js → chunk-2R7OKZE5.js} +2 -2
  5. package/dist/{chunk-7PRMSA4Z.js → chunk-2YA36CXK.js} +2 -2
  6. package/dist/chunk-3A2M7AF3.js +4 -0
  7. package/dist/chunk-3EJRPTTB.js +2 -0
  8. package/dist/chunk-3SWWYJPB.js +6 -0
  9. package/dist/chunk-4M4FEWBL.js +7 -0
  10. package/dist/{chunk-UUIWMLDX.js → chunk-4Y6KUJDO.js} +2 -2
  11. package/dist/{chunk-MO65UK5V.js → chunk-55ZJ2FCW.js} +2 -2
  12. package/dist/chunk-6FLGPRBR.js +5 -0
  13. package/dist/chunk-6XRB6ATD.js +16 -0
  14. package/dist/{chunk-VEXS3I3N.js → chunk-7EQ4J66C.js} +2 -2
  15. package/dist/{chunk-QFBJZHMV.js → chunk-7TGEXAN5.js} +2 -2
  16. package/dist/chunk-ABLXPGAZ.js +2 -0
  17. package/dist/{chunk-IKQYNTW3.js → chunk-BG7YU4DJ.js} +2 -2
  18. package/dist/chunk-D2R6IIEO.js +2 -0
  19. package/dist/{chunk-YJODB2F5.js → chunk-E47WMJ5F.js} +2 -2
  20. package/dist/chunk-EEA3R37V.js +11 -0
  21. package/dist/chunk-FAN2CVZT.js +2 -0
  22. package/dist/{chunk-HVNVO6UW.js → chunk-FYO3FPFH.js} +2 -2
  23. package/dist/chunk-G47V5V3U.js +90 -0
  24. package/dist/chunk-GS55K4WJ.js +85 -0
  25. package/dist/{chunk-I377UMS2.js → chunk-HADDFTMU.js} +2 -2
  26. package/dist/chunk-HTJ5BOYP.js +10 -0
  27. package/dist/chunk-IARIBTCL.js +2 -0
  28. package/dist/{chunk-E2V5SE6M.js → chunk-IBWYWAWE.js} +2 -2
  29. package/dist/{chunk-DLWRLPKO.js → chunk-ILQSK2KJ.js} +2 -2
  30. package/dist/{chunk-KBGFYKOJ.js → chunk-JVMXNDRU.js} +2 -2
  31. package/dist/{chunk-O6VBAW7P.js → chunk-K345WFTU.js} +2 -2
  32. package/dist/{chunk-GPY33RTH.js → chunk-K6ULLR7M.js} +2 -2
  33. package/dist/chunk-KCC3GMCX.js +2 -0
  34. package/dist/{chunk-7LSCW7NF.js → chunk-KQWFRAQI.js} +2 -2
  35. package/dist/chunk-KRVRD6KZ.js +5 -0
  36. package/dist/{chunk-QFZE73XF.js → chunk-KYGNCIJ6.js} +8 -8
  37. package/dist/chunk-LHLXHH43.js +2 -0
  38. package/dist/{chunk-IZ4KV37N.js → chunk-M7GBLQG4.js} +2 -2
  39. package/dist/{chunk-WFDTS7XL.js → chunk-MEVK6R7N.js} +2 -2
  40. package/dist/{chunk-Q2ALKKSE.js → chunk-OCQN6WF4.js} +2 -2
  41. package/dist/{chunk-ERRUE5G4.js → chunk-PQTGBYXV.js} +2 -2
  42. package/dist/{chunk-ZHHMG4UC.js → chunk-QYWGC7JV.js} +2 -2
  43. package/dist/{chunk-TLRA5TR6.js → chunk-R373SHXM.js} +2 -2
  44. package/dist/{chunk-MXWC53GJ.js → chunk-RRWPHKZA.js} +2 -2
  45. package/dist/{chunk-6GPFHZP3.js → chunk-RUAJV3TN.js} +2 -2
  46. package/dist/{chunk-Q4R2IYA3.js → chunk-S57GUI2T.js} +2 -2
  47. package/dist/chunk-SVUVC5VS.js +2 -0
  48. package/dist/{chunk-4TX5IMMK.js → chunk-T426XELO.js} +2 -2
  49. package/dist/chunk-TX7BHRMT.js +2 -0
  50. package/dist/{chunk-YXMHTJYY.js → chunk-TYRPQE6R.js} +2 -2
  51. package/dist/{chunk-Y4DS3MDC.js → chunk-WPY46NIL.js} +2 -2
  52. package/dist/{chunk-CYJMOTIH.js → chunk-X3Z4KZNX.js} +2 -2
  53. package/dist/{chunk-7X7FLQC5.js → chunk-ZNNCDAYX.js} +2 -2
  54. package/dist/cli.js +156 -145
  55. package/dist/{db-BZPa7dzJ.d.ts → db-DdlToIC-.d.ts} +1 -0
  56. package/dist/index.d.ts +4 -4
  57. package/dist/index.js +2 -2
  58. package/dist/queries/affected.d.ts +1 -1
  59. package/dist/queries/affected.js +1 -1
  60. package/dist/queries/bottlenecks.d.ts +1 -1
  61. package/dist/queries/bottlenecks.js +1 -1
  62. package/dist/queries/by-kind.d.ts +1 -1
  63. package/dist/queries/by-kind.js +1 -1
  64. package/dist/queries/call-graph.d.ts +1 -1
  65. package/dist/queries/call-graph.js +1 -1
  66. package/dist/queries/change-surface.d.ts +1 -1
  67. package/dist/queries/change-surface.js +1 -1
  68. package/dist/queries/code.d.ts +1 -1
  69. package/dist/queries/code.js +1 -1
  70. package/dist/queries/complexity-hotspots.d.ts +2 -1
  71. package/dist/queries/complexity-hotspots.js +1 -1
  72. package/dist/queries/complexity.d.ts +1 -1
  73. package/dist/queries/complexity.js +1 -1
  74. package/dist/queries/convergence.d.ts +1 -1
  75. package/dist/queries/convergence.js +1 -1
  76. package/dist/queries/coupling.d.ts +1 -1
  77. package/dist/queries/coupling.js +1 -1
  78. package/dist/queries/cycles.d.ts +1 -1
  79. package/dist/queries/cycles.js +1 -1
  80. package/dist/queries/dataflow.d.ts +1 -1
  81. package/dist/queries/dataflow.js +1 -1
  82. package/dist/queries/dead.d.ts +1 -1
  83. package/dist/queries/dead.js +1 -1
  84. package/dist/queries/deep-chains.d.ts +1 -1
  85. package/dist/queries/deep-chains.js +1 -1
  86. package/dist/queries/deps.d.ts +1 -1
  87. package/dist/queries/deps.js +1 -1
  88. package/dist/queries/diff-impact.d.ts +20 -2
  89. package/dist/queries/diff-impact.js +1 -1
  90. package/dist/queries/drift.d.ts +1 -1
  91. package/dist/queries/drift.js +1 -1
  92. package/dist/queries/extract-candidates.d.ts +2 -1
  93. package/dist/queries/extract-candidates.js +1 -1
  94. package/dist/queries/fan.d.ts +1 -1
  95. package/dist/queries/fan.js +1 -1
  96. package/dist/queries/files.d.ts +1 -1
  97. package/dist/queries/health-cache-control.d.ts +15 -0
  98. package/dist/queries/health-cache-control.js +2 -0
  99. package/dist/queries/health.d.ts +66 -2
  100. package/dist/queries/health.js +1 -1
  101. package/dist/queries/hierarchy.d.ts +1 -1
  102. package/dist/queries/hierarchy.js +1 -1
  103. package/dist/queries/hotspots.d.ts +1 -1
  104. package/dist/queries/hotspots.js +1 -1
  105. package/dist/queries/imports.d.ts +1 -1
  106. package/dist/queries/imports.js +1 -1
  107. package/dist/queries/index.d.ts +3 -3
  108. package/dist/queries/index.js +1 -1
  109. package/dist/queries/isolated.d.ts +1 -1
  110. package/dist/queries/isolated.js +1 -1
  111. package/dist/queries/members.d.ts +1 -1
  112. package/dist/queries/members.js +1 -1
  113. package/dist/queries/methods.d.ts +1 -1
  114. package/dist/queries/methods.js +1 -1
  115. package/dist/queries/outline.d.ts +1 -1
  116. package/dist/queries/outline.js +1 -1
  117. package/dist/queries/passthrough-candidates.d.ts +2 -1
  118. package/dist/queries/passthrough-candidates.js +1 -1
  119. package/dist/queries/redundant-reexports.d.ts +1 -1
  120. package/dist/queries/redundant-reexports.js +1 -1
  121. package/dist/queries/refs.d.ts +1 -1
  122. package/dist/queries/refs.js +1 -1
  123. package/dist/queries/similar-chains.d.ts +1 -1
  124. package/dist/queries/similar-chains.js +1 -1
  125. package/dist/queries/similar-files.d.ts +1 -1
  126. package/dist/queries/similar-files.js +1 -1
  127. package/dist/queries/similar-signatures.d.ts +1 -1
  128. package/dist/queries/similar-signatures.js +1 -1
  129. package/dist/queries/similar.d.ts +2 -1
  130. package/dist/queries/similar.js +1 -1
  131. package/dist/queries/slice.d.ts +1 -1
  132. package/dist/queries/slice.js +1 -1
  133. package/dist/queries/stale-abstractions.d.ts +4 -2
  134. package/dist/queries/stale-abstractions.js +1 -1
  135. package/dist/queries/stats.d.ts +1 -1
  136. package/dist/queries/surface.d.ts +1 -1
  137. package/dist/queries/surface.js +1 -1
  138. package/dist/queries/symbols.d.ts +1 -1
  139. package/dist/queries/symbols.js +1 -1
  140. package/dist/queries/system.d.ts +1 -1
  141. package/dist/queries/system.js +1 -1
  142. package/dist/queries/trace.d.ts +1 -1
  143. package/dist/queries/trace.js +1 -1
  144. package/dist/queries/wrapper-candidates.d.ts +2 -1
  145. package/dist/queries/wrapper-candidates.js +1 -1
  146. package/package.json +1 -1
  147. package/dist/chunk-25HOGELX.js +0 -2
  148. package/dist/chunk-2TLYCK2L.js +0 -11
  149. package/dist/chunk-3PVIYZ74.js +0 -84
  150. package/dist/chunk-6DVA22YE.js +0 -2
  151. package/dist/chunk-7YI2M2AQ.js +0 -2
  152. package/dist/chunk-AADJ7MCQ.js +0 -2
  153. package/dist/chunk-AV7BOODV.js +0 -4
  154. package/dist/chunk-AXP4H62Q.js +0 -6
  155. package/dist/chunk-C4C3T4K3.js +0 -2
  156. package/dist/chunk-CSRPJCWO.js +0 -2
  157. package/dist/chunk-GBDZY73J.js +0 -2
  158. package/dist/chunk-KW2F3WSV.js +0 -5
  159. package/dist/chunk-NIN762LD.js +0 -5
  160. package/dist/chunk-QPJG6VRT.js +0 -16
  161. package/dist/chunk-TUV2VI7D.js +0 -7
  162. package/dist/chunk-UAPNU7UP.js +0 -2
  163. package/dist/chunk-URCJTFOD.js +0 -2
  164. package/dist/chunk-VRC3WKKE.js +0 -2
  165. package/dist/chunk-Z4AMQWVY.js +0 -90
package/README.md CHANGED
@@ -50,11 +50,30 @@ For goal-oriented usage guides (not just command reference), see **[Agent Guide]
50
50
 
51
51
  Historical implementation plans and completed cleanup notes live in [`docs/plans/`](docs/plans/).
52
52
 
53
+ ## Install From npm
54
+
55
+ Install the published CLI globally from npm:
56
+
57
+ ```bash
58
+ npm install -g scip-query@latest
59
+ scip-query --version
60
+ ```
61
+
62
+ You can also run it without a global install:
63
+
64
+ ```bash
65
+ npx scip-query@latest --version
66
+ npx scip-query@latest reindex
67
+ ```
68
+
69
+ The npm package is published at [`scip-query`](https://www.npmjs.com/package/scip-query). `@latest` should resolve to the newest published version.
70
+
53
71
  ## Quick Start
54
72
 
55
73
  ```bash
56
74
  # Install
57
- npm install -g scip-query
75
+ npm install -g scip-query@latest
76
+ scip-query --version
58
77
  scip-query check-deps # verify optional indexers and parser support
59
78
  scip-query install-skills # install built-in Codex/Claude skills
60
79
 
@@ -0,0 +1,2 @@
1
+ import{g as c,h as n}from"./chunk-GS55K4WJ.js";import{c as o,h as m}from"./chunk-6FLGPRBR.js";import{n as r}from"./chunk-G47V5V3U.js";import{e as t,i}from"./chunk-KYGNCIJ6.js";import{getHeapStatistics as s}from"v8";var p=64*1024*1024;function P(e,a={}){n(e),a.semanticProvider===!0&&r(e),c(e),m(e),o(e),i(e),t(e)}function _(){let e=globalThis.gc;if(!e)return;let a=s();a.heap_size_limit-a.used_heap_size<p||e()}export{P as a,_ as b};
2
+ //# sourceMappingURL=chunk-2AUZ3PLO.js.map
@@ -1,2 +1,2 @@
1
- import{a as p,b as g}from"./chunk-YXMHTJYY.js";import{g as B}from"./chunk-3PVIYZ74.js";function w(s,e={}){let{scope:r,maxDepth:c=10}=e,n=B(s,r),i=[],a=new Set,l=new Set,f=[];function y(t,o){if(o>c)return;if(l.has(t)){let h=f.indexOf(t);if(h!==-1){let u=f.slice(h).concat(t),m=u.indexOf(u.reduce(($,x)=>$<x?$:x)),d=[...u.slice(m,-1),...u.slice(0,m),u[m]],S=d.join(" -> ");b.has(S)||(b.add(S),i.push({path:d,kind:R(d)}))}return}if(a.has(t))return;a.add(t),l.add(t),f.push(t);let k=n.get(t);if(k)for(let h of k)y(h,o+1);f.pop(),l.delete(t)}let b=new Set;for(let t of n.keys())a.has(t)||y(t,0);return i.sort((t,o)=>t.kind!==o.kind?t.kind==="real"?-1:1:t.path.length-o.path.length),i}function R(s){for(let c of s){let n=p(c);if(n==="test"||n==="barrel"||n==="entry")return"module-hierarchy"}if(s.length!==3)return"real";let[e,r]=s;return!e||!r?"real":g(e)||g(r)||C(e,r)||C(r,e)||D(e,r)||D(r,e)||p(e)==="entry"||p(r)==="entry"?"module-hierarchy":"real"}function C(s,e){if(!/\.rs$/.test(s)||!/\.rs$/.test(e))return!1;let r=e.replace(/\.rs$/,"/");return s.startsWith(r)?!s.slice(r.length).includes("/"):!1}function D(s,e){if(!/\.rs$/.test(s)||!/\.rs$/.test(e))return!1;let r=s.replace(/\.rs$/,""),c=e.replace(/\.rs$/,"");if(r===c+"_tests"||r===c+"/tests")return!0;let n=s.split("/"),i=e.split("/");if(n.length===i.length&&n.includes("tests")&&i.includes("src")){let a=n[n.length-1],l=i[i.length-1];if(a&&a===l)return!0}return!1}export{w as a};
2
- //# sourceMappingURL=chunk-PIRXZGV6.js.map
1
+ import{a as p,b as g}from"./chunk-TYRPQE6R.js";import{i as B}from"./chunk-GS55K4WJ.js";function w(s,e={}){let{scope:r,maxDepth:c=10}=e,n=B(s,r),i=[],a=new Set,l=new Set,f=[];function y(t,o){if(o>c)return;if(l.has(t)){let h=f.indexOf(t);if(h!==-1){let u=f.slice(h).concat(t),m=u.indexOf(u.reduce(($,x)=>$<x?$:x)),d=[...u.slice(m,-1),...u.slice(0,m),u[m]],S=d.join(" -> ");b.has(S)||(b.add(S),i.push({path:d,kind:R(d)}))}return}if(a.has(t))return;a.add(t),l.add(t),f.push(t);let k=n.get(t);if(k)for(let h of k)y(h,o+1);f.pop(),l.delete(t)}let b=new Set;for(let t of n.keys())a.has(t)||y(t,0);return i.sort((t,o)=>t.kind!==o.kind?t.kind==="real"?-1:1:t.path.length-o.path.length),i}function R(s){for(let c of s){let n=p(c);if(n==="test"||n==="barrel"||n==="entry")return"module-hierarchy"}if(s.length!==3)return"real";let[e,r]=s;return!e||!r?"real":g(e)||g(r)||C(e,r)||C(r,e)||D(e,r)||D(r,e)||p(e)==="entry"||p(r)==="entry"?"module-hierarchy":"real"}function C(s,e){if(!/\.rs$/.test(s)||!/\.rs$/.test(e))return!1;let r=e.replace(/\.rs$/,"/");return s.startsWith(r)?!s.slice(r.length).includes("/"):!1}function D(s,e){if(!/\.rs$/.test(s)||!/\.rs$/.test(e))return!1;let r=s.replace(/\.rs$/,""),c=e.replace(/\.rs$/,"");if(r===c+"_tests"||r===c+"/tests")return!0;let n=s.split("/"),i=e.split("/");if(n.length===i.length&&n.includes("tests")&&i.includes("src")){let a=n[n.length-1],l=i[i.length-1];if(a&&a===l)return!0}return!1}export{w as a};
2
+ //# sourceMappingURL=chunk-2CC7RA6B.js.map
@@ -1,3 +1,3 @@
1
- import{a as d}from"./chunk-ZHHMG4UC.js";import{n as g,o as m}from"./chunk-QFZE73XF.js";function S(n,f){let a=d(n,f);if(!a)return[];let t=n.get(`SELECT symbol, enclosing_symbol FROM global_symbols
1
+ import{a as d}from"./chunk-QYWGC7JV.js";import{p as g,q as m}from"./chunk-KYGNCIJ6.js";function S(n,f){let a=d(n,f);if(!a)return[];let t=n.get(`SELECT symbol, enclosing_symbol FROM global_symbols
2
2
  WHERE id = ? LIMIT 1`,a.symbolId);if(!t)return[];let o=[{symbol:t.symbol,shortName:m(t.symbol),depth:0}],e=t.enclosing_symbol,r=1,c=new Set([t.symbol]);for(;e&&!c.has(e)&&r<20;){c.add(e);let s=n.get("SELECT symbol, enclosing_symbol FROM global_symbols WHERE symbol = ?",e);if(!s)break;o.push({symbol:s.symbol,shortName:m(s.symbol),depth:r}),e=s.enclosing_symbol,r++}if(o.length>1)return o;let y=g(t.symbol);if("kind"in y)return o;let l=y.descriptors;if(l.length<=1)return o;let b=[o[0]];for(let s=l.length-2,p=1;s>=0;s--,p++){let h=l.slice(0,s+1).map(i=>i.suffix==="method"?`${i.name}()`:i.name.replace(/\.(ts|tsx|js|jsx|mjs|cjs|py|pyi|rs|java|scala|kt|kts|rb|go|cs|vb|dart|php|c|cc|cpp|cxx|h|hpp)$/,"")).join(":");b.push({symbol:h,shortName:h,depth:p})}return b}export{S as a};
3
- //# sourceMappingURL=chunk-OQZF2DQJ.js.map
3
+ //# sourceMappingURL=chunk-2R7OKZE5.js.map
@@ -1,2 +1,2 @@
1
- import{g as h}from"./chunk-3PVIYZ74.js";function B(e,s={}){let{minSimilarity:t=.5,limit:n=15,scope:i,minChainLength:r=3,maxChainLength:l=8}=s,a=h(e,i),o=y(a,r,l);if(o.length===0)return[];let f=d(o);return f.length<2?[]:S(C(f,t,n),n)}function d(e){let s=m(e),t=[];for(let n of e){let i=n.filter(r=>!s.has(r));i.length>=2&&t.push({original:n,filtered:i})}return t}function m(e){let{nodeFreq:s,tailFreq:t}=p(e),n=e.length*.9,i=e.length*.8,r=new Set;for(let[a,o]of s)o>n&&r.add(a);for(let[a,o]of t)o>i&&r.add(a);let l=["index.ts","index.js","cli.ts","main.ts","health.ts","health.js"];for(let a of s.keys()){let o=a.split("/").pop()??"";l.includes(o)&&r.add(a)}return r}function p(e){let s=new Map,t=new Map;for(let n of e){let i=new Set;for(let r of n)i.has(r)||(s.set(r,(s.get(r)??0)+1),i.add(r));for(let r=Math.max(0,n.length-2);r<n.length;r++)t.set(n[r],(t.get(n[r])??0)+1)}return{nodeFreq:s,tailFreq:t}}function C(e,s,t){let n=[];for(let i=0;i<e.length;i++){for(let r=i+1;r<e.length;r++){let l=x(e[i],e[r],s);l&&n.push(l)}if(n.length>t*10)break}return n.sort((i,r)=>Math.abs(r.similarity-i.similarity)>.01?r.similarity-i.similarity:i.divergencePoints.length-r.divergencePoints.length),n}function x(e,s,t){if(!b(e.filtered,s.filtered))return null;let{distance:n,ops:i}=F(e.filtered,s.filtered),r=Math.max(e.filtered.length,s.filtered.length);if(r===0)return null;let l=1-n/r;if(l<t||n===0)return null;let a=i.filter(f=>f.type==="substitute").map(f=>({index:f.indexA,nodeA:e.filtered[f.indexA],nodeB:s.filtered[f.indexB]}));return a.length===0||i.filter(f=>f.type==="match").length<2?null:{chainA:e.original,chainB:s.original,similarity:l,editDistance:n,divergencePoints:a,commonPrefix:A(e.original,s.original),commonSuffix:M(e.original,s.original)}}function b(e,s){let t=new Set(e);return s.some(n=>t.has(n))}function S(e,s){let t=[];for(let n of e)if(t.some(r=>c(n.chainA,r.chainA)&&c(n.chainB,r.chainB))||t.push(n),t.length>=s)break;return t}function y(e,s,t){let n=[];for(let r of e.keys()){if(n.length>=500)break;g(e,r,[r],new Set([r]),s,t,n,500)}return n}function g(e,s,t,n,i,r,l,a){if(l.length>=a)return;if(t.length>=r){t.length>=i&&l.push([...t]);return}let o=e.get(s);if(!o||o.size===0){t.length>=i&&l.push([...t]);return}let f=!1;for(let u of o)if(!n.has(u)&&(n.add(u),t.push(u),g(e,u,t,n,i,r,l,a),t.pop(),n.delete(u),f=!0,l.length>=a))return;!f&&t.length>=i&&l.push([...t])}function F(e,s){let t=e.length,n=s.length,i=Array.from({length:t+1},()=>Array(n+1).fill(0));for(let o=0;o<=t;o++)i[o][0]=o;for(let o=0;o<=n;o++)i[0][o]=o;for(let o=1;o<=t;o++)for(let f=1;f<=n;f++)e[o-1]===s[f-1]?i[o][f]=i[o-1][f-1]:i[o][f]=1+Math.min(i[o-1][f],i[o][f-1],i[o-1][f-1]);let r=[],l=t,a=n;for(;l>0||a>0;)l>0&&a>0&&e[l-1]===s[a-1]?(r.unshift({type:"match",indexA:l-1,indexB:a-1}),l--,a--):l>0&&a>0&&i[l][a]===i[l-1][a-1]+1?(r.unshift({type:"substitute",indexA:l-1,indexB:a-1}),l--,a--):a>0&&i[l][a]===i[l][a-1]+1?(r.unshift({type:"insert",indexA:l,indexB:a-1}),a--):(r.unshift({type:"delete",indexA:l-1,indexB:a}),l--);return{distance:i[t][n],ops:r}}function A(e,s){let t=[];for(let n=0;n<Math.min(e.length,s.length)&&e[n]===s[n];n++)t.push(e[n]);return t}function M(e,s){let t=[],n=e.length-1,i=s.length-1;for(;n>=0&&i>=0&&e[n]===s[i];)t.unshift(e[n]),n--,i--;return t}function c(e,s){if(e.length>s.length)return!1;let t=s.join("\u2192"),n=e.join("\u2192");return t.includes(n)}export{B as a};
2
- //# sourceMappingURL=chunk-7PRMSA4Z.js.map
1
+ import{i as h}from"./chunk-GS55K4WJ.js";function B(e,s={}){let{minSimilarity:t=.5,limit:n=15,scope:i,minChainLength:r=3,maxChainLength:l=8}=s,a=h(e,i),o=y(a,r,l);if(o.length===0)return[];let f=d(o);return f.length<2?[]:S(C(f,t,n),n)}function d(e){let s=m(e),t=[];for(let n of e){let i=n.filter(r=>!s.has(r));i.length>=2&&t.push({original:n,filtered:i})}return t}function m(e){let{nodeFreq:s,tailFreq:t}=p(e),n=e.length*.9,i=e.length*.8,r=new Set;for(let[a,o]of s)o>n&&r.add(a);for(let[a,o]of t)o>i&&r.add(a);let l=["index.ts","index.js","cli.ts","main.ts","health.ts","health.js"];for(let a of s.keys()){let o=a.split("/").pop()??"";l.includes(o)&&r.add(a)}return r}function p(e){let s=new Map,t=new Map;for(let n of e){let i=new Set;for(let r of n)i.has(r)||(s.set(r,(s.get(r)??0)+1),i.add(r));for(let r=Math.max(0,n.length-2);r<n.length;r++)t.set(n[r],(t.get(n[r])??0)+1)}return{nodeFreq:s,tailFreq:t}}function C(e,s,t){let n=[];for(let i=0;i<e.length;i++){for(let r=i+1;r<e.length;r++){let l=x(e[i],e[r],s);l&&n.push(l)}if(n.length>t*10)break}return n.sort((i,r)=>Math.abs(r.similarity-i.similarity)>.01?r.similarity-i.similarity:i.divergencePoints.length-r.divergencePoints.length),n}function x(e,s,t){if(!b(e.filtered,s.filtered))return null;let{distance:n,ops:i}=F(e.filtered,s.filtered),r=Math.max(e.filtered.length,s.filtered.length);if(r===0)return null;let l=1-n/r;if(l<t||n===0)return null;let a=i.filter(f=>f.type==="substitute").map(f=>({index:f.indexA,nodeA:e.filtered[f.indexA],nodeB:s.filtered[f.indexB]}));return a.length===0||i.filter(f=>f.type==="match").length<2?null:{chainA:e.original,chainB:s.original,similarity:l,editDistance:n,divergencePoints:a,commonPrefix:A(e.original,s.original),commonSuffix:M(e.original,s.original)}}function b(e,s){let t=new Set(e);return s.some(n=>t.has(n))}function S(e,s){let t=[];for(let n of e)if(t.some(r=>c(n.chainA,r.chainA)&&c(n.chainB,r.chainB))||t.push(n),t.length>=s)break;return t}function y(e,s,t){let n=[];for(let r of e.keys()){if(n.length>=500)break;g(e,r,[r],new Set([r]),s,t,n,500)}return n}function g(e,s,t,n,i,r,l,a){if(l.length>=a)return;if(t.length>=r){t.length>=i&&l.push([...t]);return}let o=e.get(s);if(!o||o.size===0){t.length>=i&&l.push([...t]);return}let f=!1;for(let u of o)if(!n.has(u)&&(n.add(u),t.push(u),g(e,u,t,n,i,r,l,a),t.pop(),n.delete(u),f=!0,l.length>=a))return;!f&&t.length>=i&&l.push([...t])}function F(e,s){let t=e.length,n=s.length,i=Array.from({length:t+1},()=>Array(n+1).fill(0));for(let o=0;o<=t;o++)i[o][0]=o;for(let o=0;o<=n;o++)i[0][o]=o;for(let o=1;o<=t;o++)for(let f=1;f<=n;f++)e[o-1]===s[f-1]?i[o][f]=i[o-1][f-1]:i[o][f]=1+Math.min(i[o-1][f],i[o][f-1],i[o-1][f-1]);let r=[],l=t,a=n;for(;l>0||a>0;)l>0&&a>0&&e[l-1]===s[a-1]?(r.unshift({type:"match",indexA:l-1,indexB:a-1}),l--,a--):l>0&&a>0&&i[l][a]===i[l-1][a-1]+1?(r.unshift({type:"substitute",indexA:l-1,indexB:a-1}),l--,a--):a>0&&i[l][a]===i[l][a-1]+1?(r.unshift({type:"insert",indexA:l,indexB:a-1}),a--):(r.unshift({type:"delete",indexA:l-1,indexB:a}),l--);return{distance:i[t][n],ops:r}}function A(e,s){let t=[];for(let n=0;n<Math.min(e.length,s.length)&&e[n]===s[n];n++)t.push(e[n]);return t}function M(e,s){let t=[],n=e.length-1,i=s.length-1;for(;n>=0&&i>=0&&e[n]===s[i];)t.unshift(e[n]),n--,i--;return t}function c(e,s){if(e.length>s.length)return!1;let t=s.join("\u2192"),n=e.join("\u2192");return t.includes(n)}export{B as a};
2
+ //# sourceMappingURL=chunk-2YA36CXK.js.map
@@ -0,0 +1,4 @@
1
+ import{c as S}from"./chunk-7EQ4J66C.js";import{l as d}from"./chunk-GS55K4WJ.js";import{a as f}from"./chunk-QYWGC7JV.js";import{A as m,B as g,d as a,q as s,u}from"./chunk-KYGNCIJ6.js";function _(n,o){let e=f(n,o);if(!e)return{definitions:[],referencedBy:[]};let i=n.get("SELECT display_name, documentation FROM global_symbols WHERE id = ?",e.symbolId),t=g(i?.documentation??null),c=n.isIgnored(e.relativePath)?[]:[{relativePath:e.relativePath,startLine:e.startLine,endLine:e.endLine,signature:b(t,i?.display_name??null,e.symbol),source:y(n,e.relativePath,e.startLine,e.endLine)}],l=S(n,e),p=(l.length>0?l:d(n,e)).filter(r=>!n.isIgnored(r.file)).map(r=>({relativePath:r.file,line:r.line,enclosingSymbol:r.enclosingSymbol,enclosingShort:r.enclosingSymbol?s(r.enclosingSymbol):"(top-level)"}));return{definitions:c,referencedBy:p}}function y(n,o,e,i){let t=a(n,o);if(!t)return null;let l=t.split(`
2
+ `).slice(e,i+1).join(`
3
+ `).trimEnd();return l.length>0?l:null}function b(n,o,e){let i=m(n);if(i&&!h(i))return i;let t=(o??"").trim();return t?u(e)&&!t.endsWith("()")?`${t}()`:t:s(e)}function h(n){return n.startsWith("undefined")||n.includes("|")||n.includes("```")}export{_ as a};
4
+ //# sourceMappingURL=chunk-3A2M7AF3.js.map
@@ -0,0 +1,2 @@
1
+ import{b as e}from"./chunk-55ZJ2FCW.js";import{F as o}from"./chunk-KYGNCIJ6.js";function l(t,r){let s=e(t,r);return o(t,s).map(({relativePath:m,...a})=>a)}export{l as a};
2
+ //# sourceMappingURL=chunk-3EJRPTTB.js.map
@@ -0,0 +1,6 @@
1
+ import{a as F,b as y,d as A,e as $}from"./chunk-RKTDEIHF.js";import{a as k}from"./chunk-SVUVC5VS.js";import{j as T}from"./chunk-GS55K4WJ.js";import{a as R}from"./chunk-QYWGC7JV.js";import{d as M,q as p,r as q,u as x,x as B}from"./chunk-KYGNCIJ6.js";function se(e,i,t={}){let{minSimilarity:r=.4,limit:l=20}=t,s=Z(e,i);if(!s)return[];if(!x(s.symbol))return[];let n=O(e,s,r);return n.length>0?n.slice(0,l):K(e,i,{minSimilarity:r,limit:l})}function O(e,i,t){let r=E(e,{minCallees:3,excludeSymbol:i.symbol}),l=A([i,...r].map(n=>n.callees)),s=[];for(let n of r){if(n.callees.size<3)continue;let o=v(i,n,l,{minSimilarity:t,requireSignificantShared:1,requireSharedCount:0});o&&s.push(o)}return s.sort((n,o)=>o.similarity-n.similarity),s}function v(e,i,t,r){let{similarity:l,significantShared:s}=$(e.callees,i.callees,t);if(l<r.minSimilarity)return null;let n=F(e.callees,i.callees).size;if(s.length<r.requireSignificantShared&&n<r.requireSharedCount)return null;let o=s.length>0?s:[...F(e.callees,i.callees)];return{symbolA:e.symbol,shortNameA:p(e.symbol),fileA:e.file,symbolB:i.symbol,shortNameB:p(i.symbol),fileB:i.file,similarity:l,similarityBasis:"callees",sharedCallees:o.map(p),uniqueToA:[...y(e.callees,i.callees)].map(p),uniqueToB:[...y(i.callees,e.callees)].map(p)}}function le(e,i={}){let{minSimilarity:t=.5,limit:r=20,scope:l,minCallees:s=4,crossFileOnly:n=!1,scanLimit:o}=i,a=E(e,{minCallees:s,scope:l,scanLimit:o}),c=A(a.map(m=>m.callees)),u=new Map;for(let m of a)for(let f of m.callees)u.set(f,(u.get(f)??0)+1);let h=Math.max(8,Math.ceil(Math.sqrt(a.length))),w=new Map;for(let m=0;m<a.length;m+=1)for(let f of a[m].callees){if((u.get(f)??0)>h)continue;let g=w.get(f);g||(g=[],w.set(f,g)),g.push(m)}let C=[],z=new Set;e:for(let m=0;m<a.length;m+=1){let f=a[m],g=new Set;for(let D of f.callees){let S=w.get(D);if(S)for(let b of S)b>m&&g.add(b)}for(let D of g){let S=`${m}|${D}`;if(z.has(S))continue;z.add(S);let b=a[D];if(n&&f.file===b.file)continue;if(f.paramCount>=0&&b.paramCount>=0){let j=Math.abs(f.paramCount-b.paramCount),_=Math.max(2,Math.ceil(Math.max(f.paramCount,b.paramCount)*.5));if(j>_)continue}let P=v(f,b,c,{minSimilarity:t,requireSignificantShared:2,requireSharedCount:4});if(P&&(C.push(P),C.length>r*5))break e}}return C.sort((m,f)=>f.similarity-m.similarity),C.slice(0,r)}var V=["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 Z(e,i){let t=R(e,i),r=new k(e);if(!t)return null;let l=T(e,t);return{symbol:t.symbol,file:t.relativePath,callees:I(l.map(s=>s.symbol)),paramCount:r.callableSignature(t)?.paramCount??-1}}function E(e,i){let{minCallees:t,scope:r,excludeSymbol:l,scanLimit:s}=i,n=new k(e),o=U(n.productionCallableDefinitions({scope:r,minLoc:5,excludeSymbol:l,sortByLocDesc:typeof s=="number"&&s>0}),s),a=n.calleeMap(o);return o.map(c=>({symbol:c.symbol,file:c.relativePath,callees:I((a.get(c.symbolId)??[]).map(u=>u.symbol)),paramCount:n.callableSignature(c)?.paramCount??-1})).filter(c=>c.callees.size>=t)}function U(e,i){return typeof i!="number"||i<=0||e.length<=i?e:e.slice(0,i)}function I(e){return new Set([...e].filter(i=>!W(i)))}function W(e){return V.some(i=>e.includes(i))}function K(e,i,t){let r=G(e,i);if(!r||r.tokens.size<3)return[];let l=t.minSimilarity>=.5?t.minSimilarity:.3,s=[];for(let n of J(e)){if(n.symbol===r.symbol||n.tokens.size<3)continue;let o=F(r.tokens,n.tokens);if(o.size<2)continue;let a=new Set([...r.tokens,...n.tokens]),c=a.size>0?o.size/a.size:0;c<l||s.push({symbolA:r.symbol,shortNameA:p(r.symbol),fileA:r.file,symbolB:n.symbol,shortNameB:p(n.symbol),fileB:n.file,similarity:c,similarityBasis:"source-tokens",sharedCallees:[...o].sort(),uniqueToA:[...y(r.tokens,n.tokens)].sort(),uniqueToB:[...y(n.tokens,r.tokens)].sort()})}return s.sort((n,o)=>o.similarity-n.similarity||n.shortNameB.localeCompare(o.shortNameB)),s.slice(0,t.limit)}function G(e,i){let t=R(e,i);if(!t||!x(t.symbol))return null;let r=H(e,t);return r?{symbol:t.symbol,file:t.relativePath,tokens:r}:null}function H(e,i){let t=q(i.symbol),r=L(e,i.relativePath,i.startLine,i.endLine,t),l=N(r,t);return l.size>0?l:null}function J(e){let i=new k(e);return i.scopedDefinitions().filter(t=>t.isFunctionLike).filter(t=>i.fileKind(t.relativePath)!=="test").filter(t=>!B(t.symbol)).map(t=>({symbol:t.symbol,file:t.relativePath,tokens:N(L(e,t.relativePath,t.startLine,t.endLine,t.leaf),t.leaf)})).filter(t=>t.tokens.size>0)}function L(e,i,t,r,l){let s=M(e,i);if(!s)return"";let n=s.split(`
2
+ `);if(r>=t&&r-t<=12)return n.slice(t,r+1).join(`
3
+ `);let o=[new RegExp(`\\bdef\\s+${d(l)}\\b`),new RegExp(`\\bfun\\s+${d(l)}\\b`),new RegExp(`\\bfn\\s+${d(l)}\\b`),new RegExp(`\\bfunction\\s+${d(l)}\\b`),new RegExp(`\\b${d(l)}\\s*\\(`)],a=n.findIndex(c=>o.some(u=>u.test(c)));if(a>=0){let c=a;for(let u=a+1;u<n.length&&u<=a+8;u++){let h=n[u]??"";if(u>a&&X(h)||(c=u,h.trim()===""&&u>a+1))break}return n.slice(a,c+1).join(`
4
+ `)}return n.slice(t,Math.min(n.length,t+8)).join(`
5
+ `)}function N(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"]),r=Q(i),s=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(n=>n.trim()).filter(n=>n.length>1).filter(n=>!t.has(n)).filter(n=>!r.has(n));return new Set(s)}function Q(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 X(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{se as a,le as b};
6
+ //# sourceMappingURL=chunk-3SWWYJPB.js.map
@@ -0,0 +1,7 @@
1
+ import{a as F}from"./chunk-SVUVC5VS.js";import{f as g}from"./chunk-GS55K4WJ.js";import{G as M,q as p,r as I,x as C}from"./chunk-KYGNCIJ6.js";import{basename as f,extname as d}from"path";function A(t,e){let{scope:n,maxLoc:o=15,limit:r=30,scanLimit:i}=e??{},a=new F(t),l=_(a.fileDependencyGraph(n)),u=j(x(a,n,o).sort((c,s)=>b(c)-b(s)||c.relativePath.localeCompare(s.relativePath)),i),h=P(a.crossFileCallerMap(u),a.sourceFallbackCallerFiles(u)),m=[];for(let c of u){let s=S(t,a,c,{callerFileMap:h,reverseFanIn:l});s&&m.push(s)}return m.sort((c,s)=>s.callerFanIn-c.callerFanIn||s.loc-c.loc),m.slice(0,r)}function S(t,e,n,o){let r=D(e,n,o.callerFileMap);if(r.length!==1)return null;let i=r[0],a=L(t,n.symbolId,i);if(!a)return null;let l=y(e,t,i,n.symbol,a);if(l&&C(l.symbol))return null;let u=v(o.callerFileMap,o.reverseFanIn,i,l);return u<=3?null:{symbol:n.symbol,shortName:p(n.symbol),file:n.relativePath,startLine:n.startLine,endLine:n.endLine,loc:b(n),singleCaller:l?.symbol??"",singleCallerShort:l?.isFunctionLike?p(l.symbol):f(i),callerFanIn:u}}function b(t){return t.endLine-t.startLine+1}function x(t,e,n){return t.productionCallableDefinitions({scope:e,minLoc:2,maxLoc:n,requireFunctionLikeSymbol:!0})}function D(t,e,n){let o=f(e.relativePath,d(e.relativePath));return[...n.get(e.symbolId)??[]].filter(r=>r!==e.relativePath).filter(r=>f(r,d(r))!==o).filter(r=>{let i=t.fileKind(r);return i!=="barrel"&&i!=="entry"&&i!=="test"})}function L(t,e,n){return t.get(`SELECT c.start_line, c.end_line
2
+ FROM mentions m
3
+ JOIN chunks c ON m.chunk_id = c.id
4
+ JOIN documents d ON c.document_id = d.id
5
+ WHERE m.symbol_id = ? AND m.role != 1 AND d.relative_path = ?
6
+ LIMIT 1`,e,n)}function y(t,e,n,o,r){let i=t.definitionsForFile(n),a=k(e,n,o,r.start_line,r.end_line);return M(i,a)}function v(t,e,n,o){if(o?.isFunctionLike){let r=[...t.get(o.symbolId)??[]].filter(i=>i!==o.relativePath);if(r.length>0)return r.length}return N(e,n)}function k(t,e,n,o,r){let i=I(n);if(!i)return o;let a=g(t,e).get(i);if(!a||a.length===0)return o;for(let l of a)if(l>=o&&l<=r)return l;return o}function P(...t){let e=new Map;for(let n of t)for(let[o,r]of n){let i=e.get(o);i||(i=new Set,e.set(o,i));for(let a of r)i.add(a)}return e}function _(t){let e=new Map;for(let[n,o]of t){e.has(n)||e.set(n,e.get(n)??0);for(let r of o)e.set(r,(e.get(r)??0)+1)}return e}function N(t,e){let n=t.get(e)??0;if(n>0)return n;let o=f(e,d(e)),r=0;for(let[i,a]of t)i!==e&&f(i,d(i))===o&&a>r&&(r=a);return r}function j(t,e){return typeof e!="number"||e<=0||t.length<=e?t:t.slice(0,e)}export{A as a};
7
+ //# sourceMappingURL=chunk-4M4FEWBL.js.map
@@ -1,4 +1,4 @@
1
- import{a as g}from"./chunk-MO65UK5V.js";import{e as a}from"./chunk-KW2F3WSV.js";import{n as u}from"./chunk-Z4AMQWVY.js";import{a as p}from"./chunk-ZHHMG4UC.js";import{o as l,p as c,t as f}from"./chunk-QFZE73XF.js";function T(t,r){return h(t,r)?.map(e=>({symbol:e.symbol,shortName:e.shortName,fromFile:e.fromFile}))??[]}function M(t,r){let e=E(t,r);return e.length>0?e:N(t,r)}function J(t,r){return h(t,r)?.filter(e=>!e.used).map(e=>({symbol:e.symbol,shortName:e.shortName,importedIn:e.importer}))??[]}function E(t,r){return t.all(`SELECT DISTINCT gs.symbol, d.relative_path AS importer
1
+ import{a as g}from"./chunk-55ZJ2FCW.js";import{f as a}from"./chunk-6FLGPRBR.js";import{o as u}from"./chunk-G47V5V3U.js";import{a as p}from"./chunk-QYWGC7JV.js";import{q as l,r as c,v as f}from"./chunk-KYGNCIJ6.js";function T(t,r){return h(t,r)?.map(e=>({symbol:e.symbol,shortName:e.shortName,fromFile:e.fromFile}))??[]}function M(t,r){let e=E(t,r);return e.length>0?e:N(t,r)}function J(t,r){return h(t,r)?.filter(e=>!e.used).map(e=>({symbol:e.symbol,shortName:e.shortName,importedIn:e.importer}))??[]}function E(t,r){return t.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
@@ -36,4 +36,4 @@ import{a as g}from"./chunk-MO65UK5V.js";import{e as a}from"./chunk-KW2F3WSV.js";
36
36
  WHERE imp_d.relative_path = ?
37
37
  AND m.role = 2
38
38
  ORDER BY def_d.relative_path, gs.symbol`,r).filter(o=>!t.isIgnored(o.importer));if(s.length>0){let o=u(t,r);return s.map(i=>({symbol:i.symbol,shortName:l(i.symbol),fromFile:i.from_file??"(external)",importer:i.importer,used:i.used!==0||o.some(m=>m.isUsed&&m.sourcePath===i.from_file)}))}return null}function F(t,r){let e=u(t,r);return e.length>0?e.map(s=>{let o=I(s.importedName,s.localName,s.kind);return{symbol:o,shortName:o,fromFile:s.sourcePath??"(external)",importer:r,used:s.kind==="side-effect"?!0:s.isUsed}}):null}function y(t,r){return a(t,r).map(e=>{let s=I(e.importedName,e.localName,e.kind),o=e.kind==="side-effect"?!0:e.used;return{symbol:s,shortName:s,fromFile:e.sourcePath??"(external)",importer:r,used:o}})}function I(t,r,e){return e==="namespace"&&t==="*"&&r?`* as ${r}`:e==="default"&&r?`default as ${r}`:e==="side-effect"?"(side effect import)":r&&r!==t?`${t} as ${r}`:t}function _(t){return t.replace(/\\/g,"/")}function R(t){return/\.(?:c|h|cc|cpp|cxx|hpp|hh|hxx)$/i.test(t)}export{T as a,M as b,J as c};
39
- //# sourceMappingURL=chunk-UUIWMLDX.js.map
39
+ //# sourceMappingURL=chunk-4Y6KUJDO.js.map
@@ -1,6 +1,6 @@
1
- import{a as p}from"./chunk-ZHHMG4UC.js";import{existsSync as f}from"fs";import{basename as u,isAbsolute as g,join as d}from"path";function S(t,o){let e=h(t,o,{allowMultiple:!1})[0]?.relativePath;return e||v(t,o)}function b(t,o){return h(t,o,{allowMultiple:!0}).map(e=>e.relativePath)}function v(t,o){if(!o)return null;let e=o.replace(/\\/g,"/").replace(/^\.\//,""),i=g(e)&&e.startsWith(t.config.projectRoot)?e.slice(t.config.projectRoot.length).replace(/^\/+/,""):e,n=d(t.config.projectRoot,i);return f(n)?i:null}function h(t,o,e){let i=m(o);if(!i)return[];let a=t.all(`SELECT relative_path
1
+ import{a as p}from"./chunk-QYWGC7JV.js";import{existsSync as f}from"fs";import{basename as u,isAbsolute as g,join as d}from"path";function S(t,o){let e=h(t,o,{allowMultiple:!1})[0]?.relativePath;return e||v(t,o)}function b(t,o){return h(t,o,{allowMultiple:!0}).map(e=>e.relativePath)}function v(t,o){if(!o)return null;let e=o.replace(/\\/g,"/").replace(/^\.\//,""),i=g(e)&&e.startsWith(t.config.projectRoot)?e.slice(t.config.projectRoot.length).replace(/^\/+/,""):e,n=d(t.config.projectRoot,i);return f(n)?i:null}function h(t,o,e){let i=m(o);if(!i)return[];let a=t.all(`SELECT relative_path
2
2
  FROM documents
3
3
  WHERE 1 = 1
4
4
  ${t.pathExclusionsFor("documents")}
5
5
  ORDER BY relative_path`).filter(r=>!t.isIgnored(r.relative_path)).map(r=>({relativePath:r.relative_path,score:x(r.relative_path,i)})).filter(r=>r.score>0).sort((r,c)=>c.score-r.score||r.relativePath.localeCompare(c.relativePath));if(a.length===0){let r=p(t,o);return!r||t.isIgnored(r.relativePath)?[]:[{relativePath:r.relativePath,score:700}]}let s=a.filter(r=>r.score>=1100);if(s.length>0)return e.allowMultiple?s:[s[0]];let l=a.filter(r=>r.score>=800);return l.length>0?e.allowMultiple?l:[l[0]]:e.allowMultiple?a:[a[0]]}function x(t,o){let e=m(t),i=u(e),n=u(o),a=0;return e===o&&(a+=1200),e.endsWith(`/${o}`)&&(a+=1100),i===n&&(a+=900),e.startsWith(`${o}/`)&&(a+=850),e.includes(o)&&(a+=250),a}function m(t){return t.trim().replace(/\\/g,"/").replace(/^\.\//,"").replace(/^\/+/,"").replace(/\/+$/,"")}export{S as a,b};
6
- //# sourceMappingURL=chunk-MO65UK5V.js.map
6
+ //# sourceMappingURL=chunk-55ZJ2FCW.js.map
@@ -0,0 +1,5 @@
1
+ import{a as b,b as j,c as U,d as Z,e as K,f as T,g as O,h as _,i as B,j as W,k as h,l as J,m as z}from"./chunk-G47V5V3U.js";import{a as $,c as Q,d as k,g as L,h as X,j as g}from"./chunk-KYGNCIJ6.js";function Y(e){return e.replace(/'''[\s\S]*?'''/g,C).replace(/"""[\s\S]*?"""/g,C).replace(/#.*$/gm,C).replace(/\/\/.*$/gm,C).replace(/\/\*[\s\S]*?\*\//g,C).replace(/`(?:\\[\s\S]|[^`])*`/g,C).replace(/'(?:\\.|[^'\\\r\n])*'/g,C).replace(/"(?:\\.|[^"\\\r\n])*"/g,C)}function C(e){return e.replace(/[^\r\n]/g," ")}var G=Q("stripped-lines");function Dt(e,r,t){return G.get(e,r,t,()=>Y(t).split(`
2
+ `))}function kt(e){G.invalidateAll(e),F=null,w=""}var F=null,w="";function _e(e){return F===e||(F=e,w=Y(e)),w}function E(e,r,t){let s=_e(e);return`${s.slice(0,r)}${" ".repeat(t-r)}${s.slice(t)}`}function S(e,r){return new RegExp(`\\b${ee(r)}\\b`,"m").test(e)}function A(e,r){let t=new Set,s=new RegExp(`\\b${ee(r)}\\s*\\.\\s*([A-Za-z_$][\\w$]*)`,"g");for(let n of e.matchAll(s)){let i=n[1];i&&t.add(i)}return[...t]}function ee(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}var Ce=new Set(["identifier","type_identifier","property_identifier","shorthand_property_identifier","field_identifier"]);function x(e){let r=[],t=0,s=0;for(let n=0;n<e.length;n++){let i=e[n];(i==="{"||i==="["||i==="(")&&t++,(i==="}"||i==="]"||i===")")&&t--,i===","&&t===0&&(r.push(e.slice(s,n)),s=n+1)}return r.push(e.slice(s)),r}function y(e,r){for(let t of e.namedChildren)if(t.type===r)return t;return null}function f(e,r){let t=new Set,s=(n,i)=>{let o=i||r.has(n.type);!o&&Ce.has(n.type)&&t.add(n.text);for(let a of n.children)s(a,o)};return s(e.rootNode,!1),t}function P(e,r,t,s,n,i,o){return{importedName:n,localName:i,sourcePath:o??h(e,s,K(r)),kind:"named",used:S(t,i),usedMembers:[]}}function N(e,r,t){let s=[];for(let n of e.matchAll(r)){let i=n[0];if(!i||typeof n.index!="number")continue;let o=E(e,n.index,n.index+i.length);for(let a of t(n,o))s.push(a)}return s}function re(e,r,t){let s=g(e,r);return s?Ee(e,r,s):we(t).flatMap(n=>qe(e,r,n.clause,n.specifier,n.start,n.end,t))}function Ee(e,r,t){let s=Re(e,r,t),n=[];for(let i of t.rootNode.descendantsOfType("import_statement"))n.push(...Te(e,r,t,i,s));return n}function Re(e,r,t){let s=f(t,new Set(["import_statement"]));if(X(r))for(let n of Ke(e,r))s.add(n);return s}function Te(e,r,t,s,n){let i=Oe(s);if(!i)return[];let o=T(e,r,i),a=y(s,"import_clause");return a?De(t,a,o,n,ve(s.text)):[ke(o)]}function De(e,r,t,s,n){let i=[];for(let o of r.namedChildren)if(o.type==="identifier")i.push(Ae(o.text,t,s,n));else if(o.type==="namespace_import"){let a=Me(e,o,t,s,n);a&&i.push(a)}else o.type==="named_imports"&&i.push(...$e(o,t,s,n));return i}function ke(e){return{importedName:"*",localName:null,sourcePath:e,kind:"side-effect",used:!0,usedMembers:[]}}function Ae(e,r,t,s){return{importedName:"default",localName:e,sourcePath:r,kind:"default",used:t.has(e),usedMembers:[],isTypeOnly:s}}function Me(e,r,t,s,n){let o=y(r,"identifier")?.text??"";if(!o)return null;let a=je(e,o);return{importedName:"*",localName:o,sourcePath:t,kind:"namespace",used:a.length>0||s.has(o),usedMembers:a,isTypeOnly:n}}function $e(e,r,t,s){let n=[];for(let i of e.namedChildren){if(i.type!=="import_specifier")continue;let o=i.namedChild(0),a=i.namedChild(1);if(!o)continue;let c=o.text,p=a?.text??c;n.push({importedName:c,localName:p,sourcePath:r,kind:"named",used:t.has(p),usedMembers:[],isTypeOnly:s||Le(i.text)})}return n}function Oe(e){let r=y(e,"string");if(!r)return null;let t=y(r,"string_fragment");return t?t.text:null}function ve(e){return/^\s*import\s+type\b/.test(e)}function Le(e){return/^\s*type\b/.test(e.trim())}function je(e,r){let t=new Set;for(let s of e.rootNode.descendantsOfType("member_expression")){let n=s.namedChild(0),i=s.namedChild(1);!n||!i||n.type!=="identifier"||n.text!==r||(i.type==="property_identifier"||i.type==="identifier")&&t.add(i.text)}return[...t]}function we(e){let r=[],t=/^[ \t]*import\s+([\s\S]*?)\s+from\s+['"]([^'"]+)['"]\s*;?/gm;for(let n of e.matchAll(t)){let i=n[0],o=n[1],a=n[2];!i||!a||typeof n.index!="number"||r.push({clause:o,specifier:a,start:n.index,end:n.index+i.length})}let s=/^[ \t]*import\s+['"]([^'"]+)['"]\s*;?/gm;for(let n of e.matchAll(s)){let i=n[0],o=n[1];!i||!o||typeof n.index!="number"||r.push({clause:null,specifier:o,start:n.index,end:n.index+i.length})}return r.sort((n,i)=>n.start-i.start)}function qe(e,r,t,s,n,i,o){let a=T(e,r,s),c=E(o,n,i);return t?Ue(t).map(u=>({...u,sourcePath:a})).map(u=>{if(u.kind==="namespace"){let m=A(c,u.localName);return{...u,used:m.length>0||S(c,u.localName),usedMembers:m}}return u.kind==="side-effect"?{...u,used:!0,usedMembers:[]}:{...u,used:u.localName?S(c,u.localName):!1,usedMembers:[]}}):[{importedName:"*",localName:null,sourcePath:a,kind:"side-effect",used:!0,usedMembers:[]}]}function Ue(e){let r=e.trim(),t=/^type\b/.test(r),s=r.replace(/^type\s+/,""),[n,i]=Be(s),o=[];return n&&o.push(...te(n,t)),i&&o.push(...te(i,t)),o}function te(e,r){let t=e.trim();if(!t)return[];if(t.startsWith("{")){let s=t.slice(1,-1).trim();return s?x(s).map(n=>{let i=n.trim(),o=r||/^type\b/.test(i),a=i.replace(/^type\s+/,""),[c,p]=a.split(/\s+as\s+/);return{importedName:c.trim(),localName:(p??c).trim(),kind:"named",isTypeOnly:o}}):[]}return t.startsWith("* as ")?[{importedName:"*",localName:t.slice(5).trim(),kind:"namespace",isTypeOnly:r}]:[{importedName:"default",localName:t,kind:"default",isTypeOnly:r}]}function Be(e){let r=0;for(let t=0;t<e.length;t++){let s=e[t];if(s==="{"&&r++,s==="}"&&r--,s===","&&r===0)return[e.slice(0,t).trim(),e.slice(t+1).trim()]}return[e.trim(),null]}function se(e,r){let t=g(e,r);if(t)return He(e,r,t);let s=k(e,r);return s?We(e,r,s):[]}function We(e,r,t){return[...Je(e,r,t),...ze(e,r,t),...Fe(e,r,t)]}function Je(e,r,t){let s=[],n=/^[ \t]*export\s+(?:type\s+)?\{([\s\S]*?)\}\s+from\s+['"]([^'"]+)['"]\s*;?/gm;for(let i of t.matchAll(n)){if(typeof i.index!="number")continue;let o=i[1]??"",a=i[2]??"",c=x(o).map(m=>Ve(m.trim())).filter(m=>!!m),p=M(t,i.index),u=M(t,i.index+i[0].length-1);s.push({kind:"named",sourcePath:T(e,r,a),names:c,startLine:p,endLine:u})}return s}function ze(e,r,t){let s=[],n=/^[ \t]*export\s+\*\s+as\s+(\w+)\s+from\s+['"]([^'"]+)['"]\s*;?/gm;for(let i of t.matchAll(n)){if(typeof i.index!="number")continue;let o=i[2]??"",a=M(t,i.index),c=M(t,i.index+i[0].length-1);s.push({kind:"star-as",sourcePath:T(e,r,o),names:[],startLine:a,endLine:c})}return s}function Fe(e,r,t){let s=[],n=/^[ \t]*export\s+\*\s+from\s+['"]([^'"]+)['"]\s*;?/gm;for(let i of t.matchAll(n)){if(typeof i.index!="number")continue;let o=i[1]??"",a=M(t,i.index),c=M(t,i.index+i[0].length-1);s.push({kind:"star",sourcePath:T(e,r,o),names:[],startLine:a,endLine:c})}return s}function Ve(e){if(!e)return null;let r=e.replace(/^type\s+/,"").trim();if(!r)return null;let t=r.match(/^(\w+)\s+as\s+(\w+)$/);if(t)return t[2]??null;let s=r.match(/^(\w+)$/);return s?s[1]??null:null}function M(e,r){let t=0;for(let s=0;s<r&&s<e.length;s++)e.charCodeAt(s)===10&&t++;return t}function He(e,r,t){let s=[];for(let n of t.rootNode.descendantsOfType("export_statement")){let i=Qe(e,r,n);if(i===void 0)continue;let o=n.startPosition.row,a=n.endPosition.row,c=Xe(n,i,o,a);s.push(c)}return s}function Qe(e,r,t){let s=y(t,"string");if(!s)return;let n=y(s,"string_fragment");if(n)return T(e,r,n.text)}function Xe(e,r,t,s){let n=y(e,"export_clause");if(n){let o=[];for(let a of n.namedChildren){if(a.type!=="export_specifier")continue;let c=a.namedChild(0),p=a.namedChild(1);c&&o.push((p??c).text)}return{kind:"named",sourcePath:r,names:o,startLine:t,endLine:s}}return y(e,"namespace_export")?{kind:"star-as",sourcePath:r,names:[],startLine:t,endLine:s}:{kind:"star",sourcePath:r,names:[],startLine:t,endLine:s}}var Ze=$("vue-non-script-identifiers");function Ke(e,r){return Ze.get(e,r,()=>{let t=new Set,s=k(e,r);if(!s)return t;let i=s.replace(/<script\b[^>]*>[\s\S]*?<\/script>/g,o=>o.replace(/[^\r\n]/g," ")).replace(/<!--[\s\S]*?-->/g,o=>o.replace(/[^\r\n]/g," ")).replace(/\/\*[\s\S]*?\*\//g,o=>o.replace(/[^\r\n]/g," "));for(let o of i.matchAll(/[A-Za-z_$][\w$]*/g))t.add(o[0]);return t})}import{basename as ne}from"path";function oe(e,r,t){let s=g(e,r);return s?Ye(e,r,s):N(t,/^[ \t]*#include\s+[<"]([^">]+)[">]\s*$/gm,(n,i)=>{let o=n[1]?.trim();if(!o)return[];let a=ne(o).replace(/\.[^.]+$/,"");return[{importedName:o,localName:a,sourcePath:W(e,r,o),kind:"named",used:S(i,a),usedMembers:[]}]})}function Ye(e,r,t){let s=f(t,new Set(["preproc_include"])),n=[];for(let i of t.rootNode.descendantsOfType("preproc_include")){let o=null;for(let c of i.namedChildren){if(c.type==="system_lib_string"){o=c.text.replace(/^<|>$/g,"");break}if(c.type==="string_literal"){o=c.namedChildren.find(u=>u.type==="string_content")?.text??c.text.replace(/^"|"$/g,"");break}}if(!o)continue;let a=ne(o).replace(/\.[^.]+$/,"");n.push({importedName:o,localName:a,sourcePath:W(e,r,o),kind:"named",used:s.has(a),usedMembers:[]})}return n}function ie(e,r,t){let s=[];for(let n of t.matchAll(/^[ \t]*import\s+['"]([^'"]+)['"](?:\s+as\s+([A-Za-z_]\w*))?[\s\S]*?;$/gm)){let i=n[1]?.trim(),o=n[2]?.trim()??null,a=n[0];if(!i||!a||typeof n.index!="number")continue;let c=E(t,n.index,n.index+a.length);s.push({importedName:i,localName:o,sourcePath:J(e,r,i),kind:o?"namespace":"side-effect",used:o?S(c,o):!0,usedMembers:o?A(c,o):[]})}return s}function ae(e,r,t){let s=[];for(let n of t.matchAll(/^[ \t]*export\s+['"]([^'"]+)['"][\s\S]*?;$/gm)){let i=n[1]?.trim();i&&s.push({specifier:i,sourcePath:J(e,r,i)})}return s}function ce(e,r,t){let s=g(e,r),n=L(r);if(s&&n==="csharp")return et(e,r,s);if(s&&n==="vb")return Ge(e,r,s);let i=Z(r)?/^[ \t]*Imports\s+(.+?)\s*$/gm:/^[ \t]*using\s+(.+?)\s*;$/gm;return N(t,i,(o,a)=>{let c=o[1]?.trim();if(!c)return[];let[p,u]=c.split(/\s*=\s*/),m=!!u,l=(m?u:p)?.trim()??c,d=l.split(".").pop()??l,I=m?p?.trim()??d:d;return[P(e,r,a,l,d,I,h(e,l,j))]})}function Ge(e,r,t){let s=f(t,new Set(["imports_statement"])),n=[];for(let i of t.rootNode.descendantsOfType("imports_statement")){let o=i.namedChildren.filter(l=>l.type==="namespace_name");if(o.length===0)continue;let a=o[o.length-1],c=o.length>1?o[0]:null,p=a.text,u=p.split(".").pop()??p,m=c?.text??u;n.push({importedName:u,localName:m,sourcePath:h(e,p,j),kind:c?"namespace":"named",used:s.has(m),usedMembers:[]})}return n}function et(e,r,t){let s=f(t,new Set(["using_directive"])),n=[];for(let i of t.rootNode.descendantsOfType("using_directive")){let o=i.namedChildren;if(o.length===0)continue;let a=null,c;o.length>=2&&o[0].type==="identifier"&&(o[1].type==="qualified_name"||o[1].type==="identifier")?(a=o[0],c=o[1]):c=o[o.length-1];let p=c.text,u=p.split(".").pop()??p,m=a?.text??u;n.push({importedName:u,localName:m,sourcePath:h(e,p,j),kind:a?"namespace":"named",used:s.has(m),usedMembers:[]})}return n}function pe(e,r,t){let s=g(e,r),n=L(r);return s&&n==="java"?tt(e,r,s):s&&n==="kotlin"?rt(e,r,s):s&&n==="scala"?st(e,r,s):N(t,/^[ \t]*import\s+(?:static\s+)?(.+?)\s*;?$/gm,(i,o)=>{let a=i[1]?.trim();return a?nt(e,r,a,o):[]})}function tt(e,r,t){let s=f(t,new Set(["import_declaration"])),n=[];for(let i of t.rootNode.descendantsOfType("import_declaration")){let o=i.children.some(m=>m.type==="asterisk"),c=i.namedChildren.find(m=>m.type==="scoped_identifier")??i.namedChildren.find(m=>m.type==="identifier");if(!c)continue;let p=c.text;if(o){n.push({importedName:"*",localName:null,sourcePath:h(e,p,b),kind:"namespace",used:!0,usedMembers:[]});continue}let u=p.split(".").pop()??p;n.push({importedName:u,localName:u,sourcePath:h(e,p,b),kind:"named",used:s.has(u),usedMembers:[]})}return n}function rt(e,r,t){let s=f(t,new Set(["import_header","import_list"])),n=[];for(let i of t.rootNode.descendantsOfType("import_header")){let o=i.namedChildren.find(d=>d.type==="identifier");if(!o)continue;let a=i.namedChildren.some(d=>d.type==="wildcard_import"),c=i.namedChildren.find(d=>d.type==="import_alias");if(a){n.push({importedName:"*",localName:null,sourcePath:h(e,o.text,b),kind:"namespace",used:!0,usedMembers:[]});continue}let p=o.text,u=p.split(".").pop()??p,l=c?.namedChild(0)?.text??u;n.push({importedName:u,localName:l,sourcePath:h(e,p,b),kind:"named",used:s.has(l),usedMembers:[]})}return n}function st(e,r,t){let s=f(t,new Set(["import_declaration"])),n=[];for(let i of t.rootNode.descendantsOfType("import_declaration")){let o=i.namedChildren.find(m=>m.type==="namespace_selectors"||m.type==="namespace_wildcard"),a=i.namedChildren.filter(m=>m!==o&&(m.type==="identifier"||m.type==="stable_identifier")),c=a.map(m=>m.text).join(".");if(!c)continue;if(o?.type==="namespace_wildcard"){n.push({importedName:"*",localName:null,sourcePath:h(e,c,b),kind:"namespace",used:!0,usedMembers:[]});continue}if(o?.type==="namespace_selectors"){for(let m of o.namedChildren)if(m.type==="arrow_renamed_identifier"){let[l,d]=m.namedChildren;if(!l)continue;let I=l.text,R=d?.text??I;if(I==="_")continue;n.push({importedName:I,localName:R,sourcePath:h(e,`${c}.${I}`,b),kind:"named",used:s.has(R),usedMembers:[]})}else if(m.type==="identifier"){let l=m.text;n.push({importedName:l,localName:l,sourcePath:h(e,`${c}.${l}`,b),kind:"named",used:s.has(l),usedMembers:[]})}continue}let p=a[a.length-1]?.text??c,u=a.slice(0,-1).map(m=>m.text).join(".")||c;n.push({importedName:p,localName:p,sourcePath:h(e,u&&a.length>1?`${u}.${p}`:c,b),kind:"named",used:s.has(p),usedMembers:[]})}return n}function nt(e,r,t,s){if(t.includes("{")&&t.includes("}")){let n=t.slice(0,t.indexOf("{")).replace(/\.$/,"").trim(),i=t.slice(t.indexOf("{")+1,t.lastIndexOf("}")).trim();return x(i).flatMap(o=>{let a=o.trim();if(!a)return[];let[c,p]=a.includes("=>")?a.split(/\s*=>\s*/):a.split(/\s+as\s+/),u=c?.trim();if(!u||u==="_")return[];let m=(p??u.split(".").pop()??u).trim(),l=u==="_"?n:`${n}.${u}`.replace(/\.\./g,".");return[P(e,r,s,l,u,m)]})}return[P(e,r,s,t,t.split(".").pop()??t,t.split(".").pop()??t)]}function ue(e,r,t){let s=g(e,r);return s?ot(e,r,s):N(t,/^[ \t]*use\s+(.+?)\s*;$/gm,(n,i)=>{let o=n[1]?.trim();return o?x(o).flatMap(a=>{let c=a.trim();if(!c)return[];let[p,u]=c.split(/\s+as\s+/i),m=p?.trim()??c,l=m.split("\\").pop()??m,d=(u??l).trim();return[P(e,r,i,m,l,d,h(e,m.replace(/\\/g,"."),U))]}):[]})}function ot(e,r,t){let s=f(t,new Set(["namespace_use_declaration"])),n=[],i=(o,a,c)=>{n.push({importedName:a,localName:c,sourcePath:h(e,o.replace(/\\/g,"."),U),kind:"named",used:s.has(c),usedMembers:[]})};for(let o of t.rootNode.descendantsOfType("namespace_use_declaration")){let a=o.namedChildren.find(c=>c.type==="namespace_use_group");if(a){let c=o.namedChildren.find(p=>p.type==="namespace_name")?.text??"";for(let p of a.namedChildren){if(p.type!=="namespace_use_clause")continue;let{importedName:u,localName:m,qualified:l}=me(p,c);u&&i(l,u,m)}continue}for(let c of o.namedChildren){if(c.type!=="namespace_use_clause")continue;let{importedName:p,localName:u,qualified:m}=me(c,"");p&&i(m,p,u)}}return n}function me(e,r){let t=e.namedChildren.find(p=>p.type==="qualified_name"),s=e.namedChildren.filter(p=>p.type==="name"),n="";t?n=t.text:s.length>=1&&(n=s[0].text);let i=t&&s.length>0?s[s.length-1]:null,o=n.split("\\").pop()??n,a=i?.text??o,c=r?`${r}\\${n}`:n;return{importedName:o,localName:a,qualified:c}}function fe(e,r,t){let s=g(e,r);return s?it(e,r,s):ct(t).flatMap(n=>mt(e,r,n,t))}function it(e,r,t){let s=f(t,new Set(["import_statement","import_from_statement"])),n=[];for(let i of t.rootNode.descendantsOfType("import_statement"))for(let o of i.namedChildren){let a=le(o);if(!a)continue;let c=O(e,r,a.qualifiedName);n.push({importedName:a.qualifiedName,localName:a.localName,sourcePath:c,kind:"namespace",used:s.has(a.localName),usedMembers:[]})}for(let i of t.rootNode.descendantsOfType("import_from_statement")){let o=i.namedChild(0);if(!o)continue;let a=at(o);if(a===null)continue;let c=O(e,r,a);for(let p=1;p<i.namedChildCount;p+=1){let u=i.namedChild(p);if(u.type==="wildcard_import"){n.push({importedName:"*",localName:null,sourcePath:c,kind:"side-effect",used:!0,usedMembers:[]});continue}let m=le(u);m&&n.push({importedName:m.qualifiedName,localName:m.localName,sourcePath:c,kind:"named",used:s.has(m.localName),usedMembers:[]})}}return n}function le(e){if(e.type==="aliased_import"){let r=e.namedChild(0),t=e.namedChild(1);return!r||!t?null:{qualifiedName:r.text,localName:t.text}}if(e.type==="dotted_name"){let r=e.text;return{qualifiedName:r,localName:r.split(".")[0]??r}}return e.type==="identifier"?{qualifiedName:e.text,localName:e.text}:null}function at(e){if(e.type==="dotted_name")return e.text;if(e.type==="relative_import"){let r=y(e,"import_prefix")?.text??"",t=y(e,"dotted_name")?.text??"";return`${r}${t}`}return null}function ct(e){let r=e.split(`
3
+ `),t=[],s=0;for(let n=0;n<r.length;n++){let i=r[n],o=i.trimStart(),a=s;if(s+=i.length+1,!o.startsWith("import ")&&!o.startsWith("from "))continue;let c=i,p=a+i.length,u=de(i);for(;n+1<r.length&&(u>0||c.trimEnd().endsWith("\\"));){n++;let l=r[n];c+=`
4
+ ${l}`,p+=1+l.length,u+=de(l),s+=l.length+1}let m=pt(c);m&&t.push({...m,start:a,end:p})}return t}function pt(e){let r=e.replace(/\\\s*\n/g," ").trim();if(r.startsWith("import "))return{kind:"import",module:null,clause:r.slice(7).trim()};let t=r.match(/^from\s+([.\w]+)\s+import\s+([\s\S]+)$/);if(!t)return null;let s=t[2].trim();return s.startsWith("(")&&s.endsWith(")")&&(s=s.slice(1,-1).trim()),{kind:"from",module:t[1],clause:s}}function mt(e,r,t,s){let n=E(s,t.start,t.end),i=t.clause.replace(/\n/g," ").trim();if(t.kind==="import")return x(i).flatMap(c=>{let p=c.trim().replace(/,$/,"");if(!p)return[];let[u,m]=p.split(/\s+as\s+/),l=u.trim(),d=(m??l.split(".")[0]??l).trim(),I=O(e,r,l),R=A(n,d);return[{importedName:l,localName:d,sourcePath:I,kind:"namespace",used:S(n,d)||R.length>0,usedMembers:R}]});let o=t.module?O(e,r,t.module):null,a=[];for(let c of x(i)){let p=c.trim().replace(/,$/,"");if(!p)continue;if(p==="*"){a.push({importedName:"*",localName:null,sourcePath:o,kind:"side-effect",used:!0,usedMembers:[]});continue}let[u,m]=p.split(/\s+as\s+/),l=(m??u).trim();a.push({importedName:u.trim(),localName:l,sourcePath:o,kind:"named",used:S(n,l),usedMembers:[]})}return a}function de(e){let r=0;for(let t of e)t==="("&&r++,t===")"&&r--;return r}import{basename as ut}from"path";function ge(e,r,t){let s=g(e,r);return s?lt(e,r,s):N(t,/^[ \t]*(require_relative|require)\s+["']([^"']+)["']\s*$/gm,(n,i)=>{let o=n[1],a=n[2];if(!o||!a)return[];let c=o==="require_relative"?B(e,r,a):null;if(c){let p=he(a);return[{importedName:p,localName:p,sourcePath:c,kind:"named",used:S(i,p),usedMembers:[]}]}return[{importedName:a,localName:null,sourcePath:c,kind:"side-effect",used:!0,usedMembers:[]}]})}function lt(e,r,t){let s=f(t,new Set([])),n=[],i=new Set(["require","require_relative","load"]);for(let o of t.rootNode.descendantsOfType("call")){let a=o.namedChild(0);if(!a||a.type!=="identifier"||!i.has(a.text))continue;let p=o.namedChildren.find(d=>d.type==="argument_list")?.namedChild(0);if(!p||p.type!=="string")continue;let m=p.namedChildren.find(d=>d.type==="string_content")?.text;if(!m)continue;let l=a.text==="require_relative"?B(e,r,m):null;if(l){let d=he(m);n.push({importedName:d,localName:d,sourcePath:l,kind:"named",used:s.has(d),usedMembers:[]})}else n.push({importedName:m,localName:null,sourcePath:l,kind:"side-effect",used:!0,usedMembers:[]})}return n}function he(e){return ut(e).replace(/\.[^.]+$/,"").split("_").filter(Boolean).map(r=>r.charAt(0).toUpperCase()+r.slice(1)).join("")}function Se(e,r,t){let s=g(e,r);return s?dt(e,r,s):N(t,/^[ \t]*use\s+(.+?)\s*;$/gm,(n,i)=>{let o=n[1]?.trim();return o?ft(e,r,o,i):[]})}function dt(e,r,t){let s=f(t,new Set(["use_declaration"])),n=[];for(let i of t.rootNode.descendantsOfType("use_declaration")){let o=i.namedChild(0);if(o)for(let a of v(o,"")){if(!a.importedName||a.importedName==="*")continue;let c=_(e,r,a.qualifiedName)??_(e,r,a.qualifiedName.split("::").slice(0,-1).join("::"));n.push({importedName:a.importedName,localName:a.localName,sourcePath:c,kind:"named",used:s.has(a.localName),usedMembers:[]})}}return n}function v(e,r){switch(e.type){case"identifier":case"super":case"self":case"crate":{let t=e.text;return[{qualifiedName:q(r,t),importedName:t,localName:t}]}case"scoped_identifier":{let t=e.text,s=t.split("::").pop()??t;return[{qualifiedName:q(r,t),importedName:s,localName:s}]}case"scoped_use_list":{let t=e.namedChild(0),s=e.namedChild(1);if(!t||!s)return[];let n=q(r,t.text),i=[];for(let o of s.namedChildren)i.push(...v(o,n));return i}case"use_list":{let t=[];for(let s of e.namedChildren)t.push(...v(s,r));return t}case"use_as_clause":{let t=e.namedChild(0),s=e.namedChild(1);if(!t||!s)return[];let n=v(t,r),i=s.text;return n.map(o=>({...o,localName:i}))}case"use_wildcard":{let t=e.namedChild(0),s=t?t.text:"";return[{qualifiedName:q(r,`${s}::*`),importedName:"*",localName:"*"}]}default:return[]}}function q(e,r){return e?r?`${e}::${r}`:e:r}function ft(e,r,t,s){let n=t.trim();if(n.includes("{")&&n.includes("}")){let u=n.slice(0,n.indexOf("{")).replace(/::$/,"").trim(),m=n.slice(n.indexOf("{")+1,n.lastIndexOf("}")).trim();return x(m).flatMap(l=>{let d=l.trim();if(!d||d==="self")return[];let[I,R]=d.split(/\s+as\s+/),D=I?.trim();if(!D)return[];let Pe=(R??D.split("::").pop()??D).trim(),be=`${u}::${D}`.replace(/::::/g,"::");return[P(e,r,s,be,D.split("::").pop()??D,Pe,_(e,r,u))]})}let[i,o]=n.split(/\s+as\s+/),a=i?.trim()??n,c=(o??a.split("::").pop()??a).trim(),p=_(e,r,a)??_(e,r,a.split("::").slice(0,-1).join("::"));return[P(e,r,s,a,a.split("::").pop()??a,c,p)]}function xe(e,r,t){let s=g(e,r);if(s)return gt(e,r,s);let n=[];for(let i of t.matchAll(/^[ \t]*pub\s+use\s+(.+?)\s*;$/gm)){let o=i[1]?.trim();o&&n.push(...St(e,r,o))}return n}function gt(e,r,t){let s=[];for(let n of t.rootNode.descendantsOfType("use_declaration")){if(!ht(n))continue;let i=n.namedChildren.find(o=>o.type!=="visibility_modifier");if(i)for(let o of v(i,""))o.importedName&&s.push(V(e,r,o.qualifiedName))}return s}function ht(e){for(let r of e.children)if(r.type==="visibility_modifier"&&r.text.startsWith("pub"))return!0;return!1}function St(e,r,t){let s=t.trim();if(s.includes("{")&&s.includes("}")){let n=s.slice(0,s.indexOf("{")).replace(/::$/,"").trim(),i=s.slice(s.indexOf("{")+1,s.lastIndexOf("}")).trim();return x(i).flatMap(o=>{let a=o.trim();if(!a||a==="self")return[];let[c]=a.split(/\s+as\s+/),p=`${n}::${c?.trim()??a}`.replace(/::::/g,"::");return[V(e,r,p)]})}return[V(e,r,s)]}function V(e,r,t){return{specifier:t,sourcePath:_(e,r,t)??_(e,r,t.split("::").slice(0,-1).join("::"))}}function ye(e,r){let t=r.toLowerCase();for(let s of e)for(let n of s.extensions)if(t.endsWith(n))return s;return null}var xt={language:"javascript",extensions:[".ts",".tsx",".mts",".cts",".js",".jsx",".mjs",".cjs",".vue"],parseImports:re},yt={language:"python",extensions:[".py",".pyi"],parseImports:fe},Nt={language:"jvm",extensions:[".java",".scala",".kt",".kts"],parseImports:pe},It={language:"rust",extensions:[".rs"],parseImports:Se,parseExports:xe},Pt={language:"ruby",extensions:[".rb"],parseImports:ge},bt={language:"c/cpp",extensions:[".c",".h",".cc",".cpp",".cxx",".hpp",".hh",".hxx"],parseImports:oe},_t={language:"dotnet",extensions:[".cs",".vb"],parseImports:ce},Ct={language:"dart",extensions:[".dart"],parseImports:ie,parseExports:ae},Et={language:"php",extensions:[".php"],parseImports:ue},Rt=[xt,yt,Nt,It,Pt,bt,_t,Ct,Et];function H(e){return ye(Rt,e)}function Br(e,r){return se(e,r)}var Ne=$("source-imports"),Ie=$("source-exports");function Wr(e,r){let t=z(r);return Ne.get(e,t,()=>{let s=H(t);if(!s)return[];let n=k(e,t);return n?s.parseImports(e,t,n):[]})}function Jr(e,r){let t=z(r);return Ie.get(e,t,()=>{let s=H(t);if(!s?.parseExports)return[];let n=k(e,t);return n?s.parseExports(e,t,n):[]})}function zr(e){Ne.invalidateAll(e),Ie.invalidateAll(e)}export{Y as a,Dt as b,kt as c,ee as d,Br as e,Wr as f,Jr as g,zr as h};
5
+ //# sourceMappingURL=chunk-6FLGPRBR.js.map
@@ -0,0 +1,16 @@
1
+ import{a as h}from"./chunk-SVUVC5VS.js";import{q as p}from"./chunk-G47V5V3U.js";import{q as u,t as m,v as g}from"./chunk-KYGNCIJ6.js";import{execFileSync as d}from"child_process";function O(e,n={}){let t=b(e,n);return t.note?C(t.note,t.changedFileLines):t.changedFiles.length===0?D(t.changedFileLines):I(t.changedFiles,[S(e,t.changedFiles,t.changedFiles)])}function b(e,n={}){let{base:t="HEAD"}=n;try{let s=F(e.config.projectRoot,t);return{changedFileLines:s,changedFiles:_(e,s),note:s.length===0?"No changed files found.":void 0}}catch{return{changedFileLines:[],changedFiles:[],note:"Unable to compute git diff."}}}function S(e,n,t){let s=new h(e),r=new Set(t),a=[],l=new Map,o=n.flatMap(i=>s.definitionsForFile(i)).filter(N).sort((i,f)=>i.relativePath.localeCompare(f.relativePath)||i.startLine-f.startLine),c=p(e,o);for(let i of o)R(e,i,t,r,a,l,c.get(i.symbolId)??new Set);return{changedSymbols:a,consumerEntries:[...l.entries()].map(([i,f])=>({file:i,symbols:[...f].sort()}))}}function I(e,n){let t=new Map,s=n.flatMap(a=>a.changedSymbols);for(let a of n)for(let l of a.consumerEntries){let o=t.get(l.file);o||(o=new Set,t.set(l.file,o));for(let c of l.symbols)o.add(c)}let r=E(t);return{changedFiles:[...e],changedSymbols:s,affectedConsumers:r,summary:{totalChangedFiles:e.length,totalChangedSymbols:s.length,totalAffectedFiles:r.length}}}function C(e,n=[]){return{changedFiles:n,changedSymbols:[],affectedConsumers:[],summary:{totalChangedFiles:n.length,totalChangedSymbols:0,totalAffectedFiles:0,note:e}}}function D(e){return{changedFiles:e,changedSymbols:[],affectedConsumers:[],summary:{totalChangedFiles:e.length,totalChangedSymbols:0,totalAffectedFiles:0,note:"Changed files are not present in the current SCIP index."}}}function F(e,n){let t=d("git",["diff","--name-only",n],{encoding:"utf-8",cwd:e,timeout:1e4}),s=d("git",["diff","--name-only","--cached",n],{encoding:"utf-8",cwd:e,timeout:1e4}),r=d("git",["ls-files","--others","--exclude-standard"],{encoding:"utf-8",cwd:e,timeout:1e4});return[...new Set([t,s,r].flatMap(a=>a.split(`
2
+ `)).map(a=>a.trim()).filter(a=>a.length>0))]}function _(e,n){let t=[];for(let s of n){let r=e.get(`SELECT relative_path FROM documents
3
+ WHERE relative_path LIKE ?
4
+ LIMIT 1`,`%${s}`);r&&!e.isIgnored(r.relative_path)&&t.push(r.relative_path)}return t}function R(e,n,t,s,r,a,l){let o=Math.max(x(e,n.symbolId),l.size);if(!v(n,o))return;let c=u(n.symbol);r.push({symbol:n.symbol,shortName:c,file:n.relativePath,fanIn:o});for(let i of M(e,n.symbolId,t))y(e,s,a,i,c);for(let i of l)y(e,s,a,i,c)}function x(e,n){return e.get(`SELECT COUNT(DISTINCT c.document_id) AS fan_in
5
+ FROM mentions m
6
+ JOIN chunks c ON m.chunk_id = c.id
7
+ WHERE m.symbol_id = ?
8
+ AND m.role != 1`,n)?.fan_in??0}function M(e,n,t){return t.length===0?[]:e.all(`SELECT DISTINCT ref_d.relative_path
9
+ FROM mentions m
10
+ JOIN chunks c ON m.chunk_id = c.id
11
+ JOIN documents ref_d ON c.document_id = ref_d.id
12
+ WHERE m.symbol_id = ?
13
+ AND m.role != 1
14
+ AND ref_d.relative_path NOT IN (${t.map(()=>"?").join(",")})
15
+ ${e.pathExclusionsFor("ref_d")}`,n,...t).map(r=>r.relative_path)}function y(e,n,t,s,r){if(e.isIgnored(s)||n.has(s))return;let a=t.get(s);a||(a=new Set,t.set(s,a)),a.add(r)}function E(e){return[...e.entries()].map(([n,t])=>({file:n,consumedSymbols:t.size})).sort((n,t)=>t.consumedSymbols-n.consumedSymbols)}function N(e){return!(g(e.symbol)||e.parentTypeName!==null&&!m(e.symbol))}function v(e,n){return m(e.symbol)||e.isTypeLike?!0:e.parentTypeName===null&&n>0}export{O as a,b,S as c,I as d};
16
+ //# sourceMappingURL=chunk-6XRB6ATD.js.map
@@ -1,2 +1,2 @@
1
- import{c as p}from"./chunk-Y4DS3MDC.js";import{d as b,e as S,l as u}from"./chunk-3PVIYZ74.js";import{e as y}from"./chunk-KW2F3WSV.js";import{o as L}from"./chunk-Z4AMQWVY.js";import{c as x}from"./chunk-ZHHMG4UC.js";import{A as I,E as R,d,p as h}from"./chunk-QFZE73XF.js";function g(n,a,t){let e=u(n).get(t);if(!e||e.length===0)return[];if(e.length===1)return[m(e[0])];let s=e.filter(r=>r.file===a);if(s.length>0)return s.map(m);let i=F(n,a),o=i.get(t);if(o)for(let r of o){let f=e.filter(l=>w(r,l.file));if(f.length>0)return f.map(m)}let c=new Set;for(let r of i.values())for(let f of r)c.add(f);for(let r of c){let f=e.filter(l=>w(r,l.file));if(f.length>0&&f.length===e.length)return f.map(m)}return[]}function C(n,a,t){let e=g(n,a,t);if(e.length>0)return e;let s=u(n).get(t);return!s||s.length===0?[]:s.map(m)}function E(n,a){let t=x(n,a);if(!t)return[];let e=h(t.symbol);if(!e)return[];let s=L(n,{...t,leaf:e,parentTypeName:null,isFunctionLike:!1,isTypeLike:!1,kind:null,documentation:null,enclosingSymbol:null});if(s.length>0){let o=new Map;for(let c of s){let r=o.get(c.file)??[];r.push(c.line),o.set(c.file,r)}return D(n,o)}let i=new Map;for(let o of p(n)){let c=d(n,o);if(!c||c.indexOf(e)===-1||o!==t.relativePath&&!g(n,o,e).some(l=>l.symbolId===t.symbolId))continue;let r=b(n,o,e,o===t.relativePath?{excludeStartLine:t.startLine,excludeEndLine:t.endLine}:{});r.length>0&&i.set(o,r)}return D(n,i)}function A(n,a){let t=new Map;for(let i of a){if(!i.leaf)continue;let o=t.get(i.leaf)??[];o.push(i),t.set(i.leaf,o)}if(t.size===0)return new Map;let e=new Set(a.map(i=>i.symbolId)),s=new Map;for(let i of p(n)){let o=S(n,i);if(o.size!==0){for(let c of o)if(t.has(c))for(let r of g(n,i,c)){if(!e.has(r.symbolId)||i===r.relativePath)continue;let f=s.get(r.symbolId);f||(f=new Set,s.set(r.symbolId,f)),f.add(i)}}}return s}function F(n,a){let t=new Map;for(let e of y(n,a)){if(!e.sourcePath)continue;let s=e.localName??e.importedName;if(s){let i=t.get(s);i||(i=new Set,t.set(s,i)),i.add(e.sourcePath)}if(e.kind==="namespace")for(let i of e.usedMembers){let o=t.get(i);o||(o=new Set,t.set(i,o)),o.add(e.sourcePath)}}return t}function w(n,a){let t=e=>e.replace(/\\/g,"/").replace(/^\.\//,"");return t(n)===t(a)}function m(n){return{symbolId:n.symbolId,symbol:n.symbol,relativePath:n.file}}function D(n,a){let t=[],e=new Set;for(let[s,i]of a){let o=I(n,s);for(let c of i){let r=R(o,c),f=`${s}|${c}|${r?.symbol??""}`;e.has(f)||(e.add(f),t.push({file:s,line:c,enclosingSymbol:r?.symbol??null}))}}return t}export{g as a,C as b,E as c,A as d};
2
- //# sourceMappingURL=chunk-VEXS3I3N.js.map
1
+ import{c as p}from"./chunk-WPY46NIL.js";import{d as b,e as S,n as u}from"./chunk-GS55K4WJ.js";import{f as y}from"./chunk-6FLGPRBR.js";import{p as L}from"./chunk-G47V5V3U.js";import{c as x}from"./chunk-QYWGC7JV.js";import{C as I,G as R,d,r as h}from"./chunk-KYGNCIJ6.js";function g(n,a,t){let e=u(n).get(t);if(!e||e.length===0)return[];if(e.length===1)return[m(e[0])];let s=e.filter(r=>r.file===a);if(s.length>0)return s.map(m);let i=F(n,a),o=i.get(t);if(o)for(let r of o){let f=e.filter(l=>w(r,l.file));if(f.length>0)return f.map(m)}let c=new Set;for(let r of i.values())for(let f of r)c.add(f);for(let r of c){let f=e.filter(l=>w(r,l.file));if(f.length>0&&f.length===e.length)return f.map(m)}return[]}function C(n,a,t){let e=g(n,a,t);if(e.length>0)return e;let s=u(n).get(t);return!s||s.length===0?[]:s.map(m)}function E(n,a){let t=x(n,a);if(!t)return[];let e=h(t.symbol);if(!e)return[];let s=L(n,{...t,leaf:e,parentTypeName:null,isFunctionLike:!1,isTypeLike:!1,kind:null,documentation:null,enclosingSymbol:null});if(s.length>0){let o=new Map;for(let c of s){let r=o.get(c.file)??[];r.push(c.line),o.set(c.file,r)}return D(n,o)}let i=new Map;for(let o of p(n)){let c=d(n,o);if(!c||c.indexOf(e)===-1||o!==t.relativePath&&!g(n,o,e).some(l=>l.symbolId===t.symbolId))continue;let r=b(n,o,e,o===t.relativePath?{excludeStartLine:t.startLine,excludeEndLine:t.endLine}:{});r.length>0&&i.set(o,r)}return D(n,i)}function A(n,a){let t=new Map;for(let i of a){if(!i.leaf)continue;let o=t.get(i.leaf)??[];o.push(i),t.set(i.leaf,o)}if(t.size===0)return new Map;let e=new Set(a.map(i=>i.symbolId)),s=new Map;for(let i of p(n)){let o=S(n,i);if(o.size!==0){for(let c of o)if(t.has(c))for(let r of g(n,i,c)){if(!e.has(r.symbolId)||i===r.relativePath)continue;let f=s.get(r.symbolId);f||(f=new Set,s.set(r.symbolId,f)),f.add(i)}}}return s}function F(n,a){let t=new Map;for(let e of y(n,a)){if(!e.sourcePath)continue;let s=e.localName??e.importedName;if(s){let i=t.get(s);i||(i=new Set,t.set(s,i)),i.add(e.sourcePath)}if(e.kind==="namespace")for(let i of e.usedMembers){let o=t.get(i);o||(o=new Set,t.set(i,o)),o.add(e.sourcePath)}}return t}function w(n,a){let t=e=>e.replace(/\\/g,"/").replace(/^\.\//,"");return t(n)===t(a)}function m(n){return{symbolId:n.symbolId,symbol:n.symbol,relativePath:n.file}}function D(n,a){let t=[],e=new Set;for(let[s,i]of a){let o=I(n,s);for(let c of i){let r=R(o,c),f=`${s}|${c}|${r?.symbol??""}`;e.has(f)||(e.add(f),t.push({file:s,line:c,enclosingSymbol:r?.symbol??null}))}}return t}export{g as a,C as b,E as c,A as d};
2
+ //# sourceMappingURL=chunk-7EQ4J66C.js.map
@@ -1,4 +1,4 @@
1
- import{i as d}from"./chunk-3PVIYZ74.js";import{B as l,o as m}from"./chunk-QFZE73XF.js";function y(o,t={}){let{limit:s=30,scope:e}=t,n=e?`AND def_d.relative_path LIKE '%${e}%'`:"",r=o.all(`SELECT
1
+ import{k as d}from"./chunk-GS55K4WJ.js";import{D as l,q as m}from"./chunk-KYGNCIJ6.js";function y(o,t={}){let{limit:s=30,scope:e}=t,n=e?`AND def_d.relative_path LIKE '%${e}%'`:"",r=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{i as d}from"./chunk-3PVIYZ74.js";import{B as l,o as m}from"./chunk-QFZE73
22
22
  GROUP BY gs.id
23
23
  ORDER BY ref_count DESC
24
24
  LIMIT ?`,s).filter(i=>!o.isIgnored(i.defined_in)).map(i=>({symbol:i.symbol,shortName:m(i.symbol),refCount:i.ref_count,fileCount:i.file_count,definedIn:i.defined_in}));return r.length>0?r:f(o,e,s)}function f(o,t,s){return l(o,{scope:t}).filter(e=>!o.isIgnored(e.relativePath)).map(e=>u(o,e)).filter(e=>e.refCount>0).sort((e,n)=>n.refCount-e.refCount||n.fileCount-e.fileCount).slice(0,s)}function u(o,t){let s=d(o,t,{limit:500});return{symbol:t.symbol,shortName:m(t.symbol),refCount:s.length,fileCount:new Set(s.map(e=>e.file)).size,definedIn:t.relativePath}}export{y as a};
25
- //# sourceMappingURL=chunk-QFBJZHMV.js.map
25
+ //# sourceMappingURL=chunk-7TGEXAN5.js.map
@@ -0,0 +1,2 @@
1
+ import{a as u}from"./chunk-SVUVC5VS.js";import{q as m}from"./chunk-KYGNCIJ6.js";function L(o,t){let{scope:n,minLoc:r=10,limit:a=30,scanLimit:b}=t??{},{definitions:d,callerMap:y,calleeMap:f}=C(o,n,b);return d.map(e=>{let s=e.endLine-e.startLine+1,c=y.get(e.symbolId)?.size??0,p=f.get(e.symbolId)??[],x=p.filter(l=>l.file!==e.relativePath),i=new Set(x.map(l=>`${l.symbol}|${l.file}`)).size,M=new Set(p.map(l=>`${l.symbol}|${l.file}`)).size;return{symbol:e.symbol,shortName:m(e.symbol),file:e.relativePath,startLine:e.startLine,endLine:e.endLine,loc:s,fanIn:c,fanOut:i,calleeCount:M,score:Math.round(s/50*(c/5)*Math.max(i/5,1)*100)/100}}).filter(e=>e.loc>=r).sort((e,s)=>s.score-e.score||s.loc-e.loc).slice(0,a)}function C(o,t,n){let r=new u(o),a=S(r.productionCallableDefinitions({scope:t,requireCallableSymbol:!0,includeSuppressed:!0,sortByLocDesc:typeof n=="number"&&n>0}),n);return{definitions:a,callerMap:r.crossFileCallerMap(a),calleeMap:r.calleeMap(a)}}function S(o,t){return typeof t!="number"||t<=0||o.length<=t?o:o.slice(0,t)}export{L as a};
2
+ //# sourceMappingURL=chunk-ABLXPGAZ.js.map
@@ -1,2 +1,2 @@
1
- import{a as l}from"./chunk-UAPNU7UP.js";import{a as i}from"./chunk-ZHHMG4UC.js";import{o as s,q as m,w as n}from"./chunk-QFZE73XF.js";function c(r,a){let t=i(r,a);return t?new l(r).definitionsForFile(t.relativePath).filter(e=>e.symbol!==t.symbol).filter(e=>n(t.symbol,e.symbol)).sort((e,o)=>e.startLine-o.startLine||e.endLine-o.endLine).map(e=>({symbol:e.symbol,shortName:s(e.symbol),startLine:e.startLine,endLine:e.endLine,kind:m(e.symbol)??"unknown"})):[]}export{c as a};
2
- //# sourceMappingURL=chunk-IKQYNTW3.js.map
1
+ import{a as l}from"./chunk-SVUVC5VS.js";import{a as i}from"./chunk-QYWGC7JV.js";import{q as s,s as m,y as n}from"./chunk-KYGNCIJ6.js";function c(r,a){let t=i(r,a);return t?new l(r).definitionsForFile(t.relativePath).filter(e=>e.symbol!==t.symbol).filter(e=>n(t.symbol,e.symbol)).sort((e,o)=>e.startLine-o.startLine||e.endLine-o.endLine).map(e=>({symbol:e.symbol,shortName:s(e.symbol),startLine:e.startLine,endLine:e.endLine,kind:m(e.symbol)??"unknown"})):[]}export{c as a};
2
+ //# sourceMappingURL=chunk-BG7YU4DJ.js.map
@@ -0,0 +1,2 @@
1
+ import{a as m}from"./chunk-SVUVC5VS.js";import{q as f}from"./chunk-KYGNCIJ6.js";function E(e,l={}){let{scope:t,minLoc:o=10,minCallees:s=6,limit:n=20,scanLimit:c}=l,r=new m(e),i=r.productionCallableDefinitions({scope:t,minLoc:o,excludeTypesFiles:!0,requireFunctionLikeSymbol:!0,sortByLocDesc:!0}),g=L(i,c),p=r.calleeMap(g),d=[];for(let a of g){let u=b(a,p.get(a.symbolId)??[],s);u&&d.push(u)}return d.sort((a,u)=>u.clusters.length-a.clusters.length||u.loc-a.loc),d.slice(0,n)}function b(e,l,t){let o=new Set(l.map(r=>r.symbol));if(o.size<t)return null;let s=h(o,l),n=S(o,s);if(n.length<2)return null;let c=C(n,s);return c.length===0?null:{symbol:e.symbol,shortName:f(e.symbol),relativePath:e.relativePath,startLine:e.startLine,endLine:e.endLine,loc:x(e),totalCallees:o.size,clusters:c}}function h(e,l){let t=new Map;for(let s of e)t.set(s,new Set);let o=new Map;for(let s of l){let n=o.get(s.chunkId);n||(n=new Set,o.set(s.chunkId,n)),n.add(s.symbol)}for(let s of o.values()){let n=[...s];for(let c=0;c<n.length;c++)for(let r=c+1;r<n.length;r++)t.get(n[c]).add(n[r]),t.get(n[r]).add(n[c])}return t}function S(e,l){let t=new Set,o=[];for(let s of e){if(t.has(s))continue;let n=new Set,c=[s];for(;c.length>0;){let r=c.pop();if(!t.has(r)){t.add(r),n.add(r);for(let i of l.get(r)??[])t.has(i)||c.push(i)}}o.push(n)}return o}function C(e,l){return e.filter(t=>t.size>=3).map(t=>y(t,e,l)).filter(t=>t.isolation>.5).sort((t,o)=>o.isolation-t.isolation)}function y(e,l,t){let o=new Set;for(let r of l)if(r!==e)for(let i of r)o.add(i);let s=0;for(let r of e)for(let i of t.get(r)??[])o.has(i)&&s++;let n=e.size*o.size,c=n>0?1-s/n:1;return{callees:[...e].map(f),isolation:c}}function x(e){return e.endLine-e.startLine+1}function L(e,l){return typeof l!="number"||l<=0||e.length<=l?e:e.slice(0,l)}export{E as a};
2
+ //# sourceMappingURL=chunk-D2R6IIEO.js.map
@@ -1,2 +1,2 @@
1
- import{h as a,i as n}from"./chunk-3PVIYZ74.js";import{a as m}from"./chunk-ZHHMG4UC.js";import{o as i}from"./chunk-QFZE73XF.js";function p(e,s){let o=m(e,s);if(!o)return null;let t=n(e,o,{limit:50}),r=y(a(e,o,{limit:50,additive:!0,callableOnly:!0}));return{symbol:o.symbol,shortName:i(o.symbol),callers:t.map(l=>({symbol:l.symbol,shortName:i(l.symbol),file:l.file})),callees:r.map(l=>({symbol:l.symbol,shortName:i(l.symbol),file:l.file}))}}function y(e){let s=new Set,o=[];for(let t of e){let r=`${t.symbol}|${t.file}`;s.has(r)||(s.add(r),o.push(t))}return o}export{p as a};
2
- //# sourceMappingURL=chunk-YJODB2F5.js.map
1
+ import{j as a,k as n}from"./chunk-GS55K4WJ.js";import{a as m}from"./chunk-QYWGC7JV.js";import{q as i}from"./chunk-KYGNCIJ6.js";function p(e,s){let o=m(e,s);if(!o)return null;let t=n(e,o,{limit:50}),r=y(a(e,o,{limit:50,additive:!0,callableOnly:!0}));return{symbol:o.symbol,shortName:i(o.symbol),callers:t.map(l=>({symbol:l.symbol,shortName:i(l.symbol),file:l.file})),callees:r.map(l=>({symbol:l.symbol,shortName:i(l.symbol),file:l.file}))}}function y(e){let s=new Set,o=[];for(let t of e){let r=`${t.symbol}|${t.file}`;s.has(r)||(s.add(r),o.push(t))}return o}export{p as a};
2
+ //# sourceMappingURL=chunk-E47WMJ5F.js.map
@@ -0,0 +1,11 @@
1
+ import{a as d}from"./chunk-55ZJ2FCW.js";import{a as c}from"./chunk-SVUVC5VS.js";import{q as m}from"./chunk-G47V5V3U.js";import{q as u}from"./chunk-KYGNCIJ6.js";function I(e,n){let r=d(e,n);if(!r)return null;let t=p(e,r);if(!t||e.isIgnored(t.relative_path))return null;let s=[],i=0,l=h(e,t.relative_path),f=m(e,l);for(let o of l){let a=g(e,t,o,f.get(o.symbolId)??new Set);i+=a,s.push({symbol:o.symbol,shortName:u(o.symbol),startLine:o.startLine,endLine:o.endLine,externalConsumers:a,riskLevel:S(a)})}return{file:t.relative_path,symbols:s,totalExternalConsumers:i}}function p(e,n){return e.get(`SELECT id, relative_path FROM documents
2
+ WHERE relative_path = ?
3
+ ${e.pathExclusionsFor("documents")}
4
+ LIMIT 1`,n)??null}function h(e,n){return new c(e).definitionsForFile(n).sort((r,t)=>r.startLine-t.startLine||r.endLine-t.endLine)}function g(e,n,r,t){let s=e.all(`SELECT DISTINCT consumer_d.relative_path
5
+ FROM mentions m
6
+ JOIN chunks c ON m.chunk_id = c.id
7
+ JOIN documents consumer_d ON consumer_d.id = c.document_id
8
+ WHERE m.symbol_id = ?
9
+ AND m.role != 1
10
+ AND c.document_id != ?`,r.symbolId,n.id);return new Set([...s.map(i=>i.relative_path),...[...t].filter(i=>i!==n.relative_path)]).size}function S(e){return e>10?"high":e>0?"medium":"low"}export{I as a};
11
+ //# sourceMappingURL=chunk-EEA3R37V.js.map
@@ -0,0 +1,2 @@
1
+ import{a as b}from"./chunk-SVUVC5VS.js";import{g as y,j as g,q as m,u as p}from"./chunk-KYGNCIJ6.js";function C(n,t,s,o){let r=y(t);if(!r)return!0;let i=g(n,t);if(!i)return!0;let l=x.get(i);return l||(l=L(i,r),x.set(i,l)),l.get(`${s}:${o}`)??!0}var x=new WeakMap;function L(n,t){let s=t==="rust"?new Set(["function_item","function_signature_item"]):t==="python"?new Set(["function_definition"]):new Set(["function_declaration","method_definition","arrow_function","function_expression"]),o=new Map,r=i=>{s.has(i.type)&&o.set(`${i.startPosition.row}:${i.endPosition.row}`,_(i,t));for(let l of i.children)r(l)};return r(n.rootNode),o}function _(n,t){let s=n.namedChildren.find(e=>e.type==="block"||e.type==="statement_block");if(!s)return!1;let o=s.namedChildren.filter(e=>e.type!=="comment"&&e.type!=="line_comment"&&e.type!=="block_comment");if(o.length!==1)return!1;let r=o[0],i=null;if(r.type==="return_statement"||r.type==="expression_statement"?i=r.namedChild(0)??null:t==="rust"&&(r.type==="call_expression"||r.type==="macro_invocation")&&(i=r),!i)return!1;let l=t==="python"?"call":"call_expression";if(i.type!==l)return!1;let u=i.namedChildren.find(e=>e.type==="arguments"||e.type==="argument_list");if(!u)return!1;let d=u.namedChildren.filter(e=>e.type!=="comment"),c=n.namedChildren.find(e=>e.type==="parameters"||e.type==="formal_parameters");if(!c)return!1;let a=[];for(let e of c.namedChildren)if(e.type==="identifier")a.push(e.text);else{let f=e.namedChildren.find(S=>S.type==="identifier");f&&a.push(f.text)}if(d.length!==a.length)return!1;for(let e=0;e<a.length;e+=1){let f=d[e];if(f.type!=="identifier"||f.text!==a[e])return!1}return!0}function j(n,t){let{scope:s,maxLoc:o=15,limit:r=30,scanLimit:i}=t??{},l=new b(n),u=D(w(l,s,o).sort((a,e)=>h(a)-h(e)||a.relativePath.localeCompare(e.relativePath)),i),d=l.calleeMap(u),c=[];for(let a of u){let e=P(n,a,d.get(a.symbolId)??[]);e&&c.push(e)}return c.sort((a,e)=>a.loc-e.loc||a.file.localeCompare(e.file)),c.slice(0,r)}function P(n,t,s){let o=T(s);if(o.size!==1||!C(n,t.relativePath,t.startLine,t.endLine))return null;let[,r]=[...o.entries()][0];return{symbol:t.symbol,shortName:m(t.symbol),file:t.relativePath,startLine:t.startLine,endLine:t.endLine,loc:h(t),forwardsTo:r.symbol,forwardsToShort:m(r.symbol),forwardsToFile:r.file}}function T(n){let t=n.some(o=>p(o.symbol))?n.filter(o=>p(o.symbol)):n,s=new Map;for(let o of t)s.has(o.symbol)||s.set(o.symbol,o);return s}function w(n,t,s){return n.productionCallableDefinitions({scope:t,minLoc:3,maxLoc:s,requireFunctionLikeSymbol:!0,excludeRustTraitImplMembers:!0})}function h(n){return n.endLine-n.startLine+1}function D(n,t){return typeof t!="number"||t<=0||n.length<=t?n:n.slice(0,t)}export{j as a};
2
+ //# sourceMappingURL=chunk-FAN2CVZT.js.map
@@ -1,4 +1,4 @@
1
- import{a as r}from"./chunk-MO65UK5V.js";import{g as l}from"./chunk-3PVIYZ74.js";import{a as c}from"./chunk-ZHHMG4UC.js";import{o as d}from"./chunk-QFZE73XF.js";function f(e,t){let o=c(e,t);if(!o)return[];let i=e.get(`SELECT COUNT(DISTINCT c.document_id) AS file_count
1
+ import{a as r}from"./chunk-55ZJ2FCW.js";import{i as l}from"./chunk-GS55K4WJ.js";import{a as c}from"./chunk-QYWGC7JV.js";import{q as d}from"./chunk-KYGNCIJ6.js";function f(e,t){let o=c(e,t);if(!o)return[];let i=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-MO65UK5V.js";import{g as l}from"./chunk-3PVIYZ74.js";
59
59
  GROUP BY d.id
60
60
  ORDER BY symbol_count DESC
61
61
  LIMIT ?`,o).filter(s=>!e.isIgnored(s.relative_path)).map(s=>({name:s.relative_path,count:s.symbol_count}))}export{f as a,y as b,b as c,I as d};
62
- //# sourceMappingURL=chunk-HVNVO6UW.js.map
62
+ //# sourceMappingURL=chunk-FYO3FPFH.js.map
@@ -0,0 +1,90 @@
1
+ import{C as F,b as Y,r as C}from"./chunk-KYGNCIJ6.js";import g from"path";import{createRequire as Ye}from"module";import{existsSync as T,readdirSync as Ge,readFileSync as pe}from"fs";import{existsSync as R}from"fs";import{basename as he,dirname as y,extname as S,join as p,relative as E,resolve as f}from"path";var ye=Y("indexed-paths"),N=[".ts",".tsx",".mts",".cts",".js",".jsx",".mjs",".cjs",".vue"],G=[".py",".pyi"],q=[".java",".scala",".kt",".kts"],Q=[".rs"],Z=[".rb"],ee=[".c",".h",".cc",".cpp",".cxx",".hpp",".hh",".hxx"],te=[".cs",".vb"],ne=[".dart"],re=[".php"],Ie=new Set(N),O=new Set(G),ie=new Set(q),P=new Set(Q),A=new Set(Z),oe=new Set(ee),se=new Set(te),j=new Set(ne),ae=new Set(re),xe=[{extensions:N,lookup:Ie},{extensions:G,lookup:O},{extensions:q,lookup:ie},{extensions:Q,lookup:P},{extensions:Z,lookup:A},{extensions:ee,lookup:oe},{extensions:te,lookup:se},{extensions:ne,lookup:j},{extensions:re,lookup:ae}];function I(t,e){return e.has(S(t).toLowerCase())}function Ee(t){return I(t,O)}function Ne(t){return I(t,ie)}function be(t){return I(t,P)}function ve(t){return I(t,A)}function ke(t){return I(t,oe)}function De(t){return I(t,se)}function Dt(t){return S(t).toLowerCase()===".vb"}function Re(t){return I(t,j)}function Te(t){return I(t,ae)}function Le(t){let e=S(t).toLowerCase();for(let n of xe)if(n.lookup.has(e))return n.extensions;return N}function _e(t){return Ne(t)||De(t)||Te(t)}function w(t,e,n){return Ee(e)?Ce(t,e,n):be(e)?Fe(t,e,n):ve(e)?Oe(t,e,n):ke(e)?Pe(t,e,n):_e(e)?Ae(t,n.replace(/\\/g,"."),Le(e)):Re(e)?je(t,e,n):Me(t,e,n)}function Me(t,e,n){if(!n.startsWith(".")&&!n.startsWith("/"))return null;let r=y(p(t.config.projectRoot,e)),i=f(r,n),o=b(t);for(let s of Ke(i)){let a=x(E(t.config.projectRoot,s));if(o.has(a)||R(s))return a}return x(E(t.config.projectRoot,i))}function Ce(t,e,n){let r=b(t),i;if(n.startsWith(".")){let o=n.match(/^(\.+)(.*)$/);if(!o)return null;let s=o[1].length,a=o[2].replace(/^\./,""),c=y(p(t.config.projectRoot,e));for(let l=1;l<s;l++)c=y(c);i=a?f(c,a.replace(/\./g,"/")):c}else i=f(t.config.projectRoot,n.replace(/\./g,"/"));for(let o of we(i)){let s=x(E(t.config.projectRoot,o));if(r.has(s)||R(o))return s}return null}function Fe(t,e,n){if(!n)return null;let r=n.replace(/\s+as\s+.+$/,"").trim();if(!r.startsWith("crate::")&&!r.startsWith("self::")&&!r.startsWith("super::"))return null;let i=y(p(t.config.projectRoot,e)),o;return r.startsWith("crate::")?o=f(t.config.projectRoot,"src",r.slice(7).replace(/::/g,"/")):r.startsWith("self::")?o=f(i,r.slice(6).replace(/::/g,"/")):o=f(y(i),r.slice(7).replace(/::/g,"/")),W(t,We(o))}function Oe(t,e,n){let r=y(p(t.config.projectRoot,e)),i=f(r,n);return W(t,$e(i))}function Pe(t,e,n){let r=y(p(t.config.projectRoot,e)),i=[f(r,n),f(t.config.projectRoot,n),f(t.config.projectRoot,"include",n),f(t.config.projectRoot,"src",n)];return W(t,i)}function Ae(t,e,n){let r=b(t),i=e.replace(/\\/g,".").replace(/::/g,".").replace(/^global::/,""),o=i.replace(/\./g,"/"),s=i.split(".").pop()??i;for(let c of n){let l=`${o}${c}`,d=[...r].find(m=>m.endsWith(l));if(d)return d}for(let c of n){let l=[...r].find(d=>he(d)===`${s}${c}`);if(l)return l}let a=[...r].filter(c=>n.includes(S(c).toLowerCase())).filter(c=>c.includes(`/${o}/`)||c.includes(`/${s}/`)).sort((c,l)=>c.localeCompare(l));return a.length===1?a[0]:null}function je(t,e,n){let r=b(t);if(n.startsWith("package:")){let s=n.slice(8),a=s.indexOf("/");if(a<0)return null;let c=s.slice(a+1),l=x(c.startsWith("lib/")?c:`lib/${c}`);return r.has(l)?l:null}let i=y(p(t.config.projectRoot,e)),o=f(i,n);for(let s of Ue(o)){let a=x(E(t.config.projectRoot,s));if(r.has(a)||R(s))return a}return null}function we(t){let e=S(t);return O.has(e)?[t]:[`${t}.py`,`${t}.pyi`,p(t,"__init__.py"),p(t,"__init__.pyi")]}function W(t,e){let n=b(t);for(let r of e){let i=x(E(t.config.projectRoot,r));if(n.has(i)||R(r))return i}return null}function We(t){let e=S(t);return P.has(e)?[t]:[`${t}.rs`,p(t,"mod.rs")]}function $e(t){let e=S(t);return A.has(e)?[t]:[`${t}.rb`,p(t,"index.rb")]}function Ue(t){let e=S(t);return j.has(e)?[t]:[`${t}.dart`,t]}function Ke(t){let e=S(t),n=new Set;if(e){n.add(t);for(let r of N)n.add(t.slice(0,-e.length)+r)}else for(let r of N)n.add(`${t}${r}`),n.add(p(t,`index${r}`));return[...n]}function b(t){return ye.get(t,()=>new Set(t.all(`SELECT relative_path
2
+ FROM documents
3
+ WHERE 1 = 1
4
+ ${t.pathExclusionsFor("documents")}`).map(e=>x(e.relative_path)).filter(e=>!t.isIgnored(e))))}function x(t){return t.replace(/\\/g,"/")}import{existsSync as v,readFileSync as He,readdirSync as Xe,statSync as Je}from"fs";import u from"path";var U=["tsconfig.json","tsconfig.app.json","tsconfig.node.json","tsconfig.base.json"];function K(t,e){let r=e?u.dirname(u.join(t,e)):t,i=u.resolve(t);for(;r.startsWith(i);){for(let s of U){let a=u.join(r,s);if(v(a))return a}let o=u.dirname(r);if(o===r)break;r=o}for(let o of U){let s=u.join(t,o);if(v(s))return s}return null}function ce(t){let e=t.config.projectRoot,n=new Set(Be(e,t.config.semantic?.typescript?.tsconfigs)),r=t.all(`SELECT relative_path
5
+ FROM documents
6
+ WHERE (
7
+ relative_path LIKE '%.ts'
8
+ OR relative_path LIKE '%.tsx'
9
+ OR relative_path LIKE '%.mts'
10
+ OR relative_path LIKE '%.cts'
11
+ OR relative_path LIKE '%.js'
12
+ OR relative_path LIKE '%.jsx'
13
+ OR relative_path LIKE '%.mjs'
14
+ OR relative_path LIKE '%.cjs'
15
+ )
16
+ ${t.pathExclusionsFor("documents")}`);for(let i of r){if(t.isIgnored(i.relative_path))continue;let o=K(e,i.relative_path);o&&n.add(u.resolve(o))}if(n.size===0){let i=K(e);i&&n.add(u.resolve(i))}return[...n].filter(i=>!le(e,i)).sort((i,o)=>i.localeCompare(o))}function Be(t,e=[]){let n=new Set;for(let r of e){let i=u.isAbsolute(r)?r:u.join(t,r);v(i)&&n.add(u.resolve(i))}for(let r of Ve(t))for(let i of U){let o=u.join(r,i);v(o)&&n.add(u.resolve(o))}if(n.size===0){let r=K(t);r&&n.add(u.resolve(r))}return[...n].filter(r=>!le(t,r)).sort((r,i)=>r.localeCompare(i))}function Ve(t){let e=u.join(t,"package.json");if(!v(e))return[];let n;try{n=JSON.parse(He(e,"utf8"))}catch{return[]}return(Array.isArray(n.workspaces)?n.workspaces:n.workspaces?.packages??[]).flatMap(i=>ze(t,i))}function ze(t,e){if(!e||e.startsWith("!")||e.includes("node_modules"))return[];if(!e.includes("*")){let s=u.join(t,e);return $(s)?[s]:[]}let n=e.indexOf("*"),r=e.slice(0,n).replace(/\/$/,""),i=e.slice(n+1).replace(/^\//,""),o=u.join(t,r||".");return $(o)?Xe(o).map(s=>u.join(o,s,i)).filter($):[]}function $(t){try{return Je(t).isDirectory()}catch{return!1}}function le(t,e){let n=u.relative(t,e).replace(/\\/g,"/");return n.startsWith("..")||n.includes("/node_modules/")||n.startsWith("node_modules/")||n.includes("/dist/")||n.startsWith("dist/")}var qe=Ye(import.meta.url),k;function ge(t,e){let n=Qe();if(!n)return H("ts-morph is not installed");let r=ce(t);if(r.length===0)return H("no tsconfig found");try{let i=r.map(o=>({tsconfigPath:o,project:new n.Project({tsConfigFilePath:o,skipFileDependencyResolution:!1})}));return new X(t,n,i)}catch(i){return H(i instanceof Error?i.message:String(i),r[0],r)}}function Qe(){if(k!==void 0)return k;try{k=qe("ts-morph")}catch{k=null}return k}function H(t,e,n){return{language:"typescript",availability:()=>({available:!1,reason:t,tsconfigPath:e,tsconfigPaths:n}),importUsage:()=>[],referencesFor:()=>[],calleesFor:()=>[],signatureFor:()=>null}}var X=class{constructor(e,n,r){this.db=e;this.tsMorph=n;this.projects=r;this.workspacePackages=rt(e.config.projectRoot)}db;tsMorph;projects;language="typescript";importUsageCache=new Map;referencesCache=new Map;calleesCache=new Map;fileCalleesCache=new Map;signatureCache=new Map;sourceFileCache=new Map;definitionNodeCache=new Map;fileDefinitionNodeCache=new Map;indexedDefinitionLeafCache=new Map;packageImportReferenceIndex=null;packageExportIndex=null;workspacePackages;availability(){return{available:!0,tsconfigPath:this.projects[0]?.tsconfigPath,tsconfigPaths:this.projects.map(e=>e.tsconfigPath)}}importUsage(e){return h(this.importUsageCache,e,()=>{let n=this.sourceFile(e);if(!n)return[];let r=[];for(let i of n.getImportDeclarations())for(let o of this.importUsageForDeclaration(e,i))r.push(o);return r})}referencesFor(e){return h(this.referencesCache,e.symbolId,()=>{let n=this.nodeForDefinition(e),r=this.packageImportReferencesForDefinition(e);return n?ut(n,e,r,this.db.config.projectRoot):r})}calleesFor(e){return h(this.calleesCache,e.symbolId,()=>h(this.fileCalleesCache,e.relativePath,()=>this.calleeMapForFile(e.relativePath)).get(e.symbolId)??[])}signatureFor(e){return h(this.signatureCache,e.symbolId,()=>{let n=this.nodeForDefinition(e);if(!n||!this.tsMorph.Node.isFunctionDeclaration(n)&&!this.tsMorph.Node.isMethodDeclaration(n)&&!this.tsMorph.Node.isArrowFunction(n)&&!this.tsMorph.Node.isFunctionExpression(n)&&!this.tsMorph.Node.isConstructorDeclaration(n))return null;let r=n.getType().getCallSignatures()[0];if(!r)return null;let i=r.getParameters().map(s=>{let a=s.getDeclarations()[0],c=a?s.getTypeAtLocation(a).getText(a):s.getValueDeclaration()?.getType().getText()??"unknown";return fe(c)}),o=r.getReturnType().getText(n);return`(${i.join(",")})=>${fe(o)}`})}importUsageForDeclaration(e,n){let r=w(this.db,e,n.getModuleSpecifierValue()),i=ue(n);return n.getImportClause()?.isTypeOnly()?i.map(o=>tt(e,r,o)):i.map(o=>this.valueImportUsageForEntry(e,r,o))}valueImportUsageForEntry(e,n,r){let i=r.identifier?r.identifier.findReferences():[],o=[];for(let l of i)for(let d of dt(l,e,r.identifier,this.db.config.projectRoot))o.push(d);let s=o.some(l=>!de(l.node)),a=o.some(l=>de(l.node)),c=r.isTypeOnly;return{importer:e,sourcePath:n,importedName:r.importedName,localName:r.localName,kind:r.kind,isTypeOnly:c,isUsed:c||o.length>0,isTypeUsed:c||a,isValueUsed:s,references:o.map(l=>l.location)}}sourceFile(e){return this.sourceFileMatch(e)?.sourceFile??null}sourceFileMatch(e){return It(e)?h(this.sourceFileCache,e,()=>{let n=g.join(this.db.config.projectRoot,e);for(let{project:r}of this.projects){let i=r.getSourceFile(n)??r.addSourceFileAtPathIfExists(n)??null;if(i)return{project:r,sourceFile:i}}return null}):null}packageImportReferencesForDefinition(e){return this.packageImportReferences().get(e.symbolId)??[]}packageImportReferences(){if(this.packageImportReferenceIndex)return this.packageImportReferenceIndex;let e=new Map,n=this.packageExports();for(let r of this.indexedTypeScriptLikeDocuments())this.addPackageImportReferencesForDocument(e,n,r);for(let[r,i]of e)e.set(r,J(i));return this.packageImportReferenceIndex=e,e}indexedTypeScriptLikeDocuments(){return this.db.all(`SELECT relative_path
17
+ FROM documents
18
+ WHERE (
19
+ relative_path LIKE '%.ts'
20
+ OR relative_path LIKE '%.tsx'
21
+ OR relative_path LIKE '%.mts'
22
+ OR relative_path LIKE '%.cts'
23
+ OR relative_path LIKE '%.js'
24
+ OR relative_path LIKE '%.jsx'
25
+ OR relative_path LIKE '%.mjs'
26
+ OR relative_path LIKE '%.cjs'
27
+ )
28
+ ${this.db.pathExclusionsFor("documents")}`).map(e=>e.relative_path)}addPackageImportReferencesForDocument(e,n,r){if(this.db.isIgnored(r))return;let i=this.sourceFileMatch(r);if(i)for(let o of i.sourceFile.getImportDeclarations())this.addPackageImportReferencesForDeclaration(e,n,r,o)}addPackageImportReferencesForDeclaration(e,n,r,i){let o=st(this.workspacePackages,i.getModuleSpecifierValue());if(!o)return;let s=n.get(o);if(s)for(let a of ue(i)){if(a.kind!=="named"||!a.identifier)continue;let c=s.get(a.importedName);if(!c||c.size===0)continue;let l=ft(a.identifier,r,this.db.config.projectRoot);l.length>0&&ht(e,c,l)}}packageExports(){if(this.packageExportIndex)return this.packageExportIndex;let e=new Map;for(let n of this.workspacePackages){let r=new Map;for(let i of at(n))this.collectPackageExports(n,i,r,new Set);r.size>0&&e.set(n.name,r)}return this.packageExportIndex=e,e}collectPackageExports(e,n,r,i){if(i.has(n))return;i.add(n);let o=this.sourceFile(n);if(o)for(let s of o.getExportDeclarations()){let a=s.getModuleSpecifierValue(),c=a?w(this.db,n,a):n;if(!c||!c.startsWith(`${e.sourceRootRelative}/`))continue;let l=s.getNamedExports();if(l.length===0){if(s.isNamespaceExport())continue;this.collectPackageExports(e,c,r,i);continue}for(let d of l){let m=d.getNameNode().getText(),V=d.getAliasNode()?.getText()??m,z=this.indexedDefinitionByLeaf(c,m);if(!z)continue;let D=r.get(V);D||(D=new Set,r.set(V,D)),D.add(z.symbolId)}}}indexedDefinitionByLeaf(e,n){return h(this.indexedDefinitionLeafCache,e,()=>mt(this.db,e)).get(n)??null}nodeForDefinition(e){return h(this.definitionNodeCache,e.symbolId,()=>this.definitionNodesForFile(e.relativePath).get(e.symbolId)??null)}definitionNodesForFile(e){return h(this.fileDefinitionNodeCache,e,()=>{let n=this.sourceFile(e);if(!n)return new Map;let r=Ze(this.db,e);return r.size===0?new Map:et(this.tsMorph,n,r)})}definitionFromSymbol(e){let n=e.getDeclarations();for(let r of n){let i=r.getSourceFile(),o=_(this.db.config.projectRoot,i.getFilePath());if(!o||this.db.isIgnored(o))continue;let s=L(i,r),a=gt(this.db,o,s,e.getName());if(a)return{symbol:a.symbol,file:a.relativePath,line:a.startLine}}return null}calleeMapForFile(e){let n=this.sourceFile(e);if(!n)return new Map;let r=F(this.db,e).sort((o,s)=>o.startLine-s.startLine||s.endLine-o.endLine);if(r.length===0)return new Map;let i=new Map;n.forEachDescendant(o=>{if(!this.tsMorph.Node.isCallExpression(o)&&!this.tsMorph.Node.isNewExpression(o))return;let s=this.semanticCalleeForCallNode(n,r,o);s&&nt(i,s.callerId,s.target)});for(let[o,s]of i)i.set(o,yt(s));return i}semanticCalleeForCallNode(e,n,r){let i=St(n,L(e,r));if(!i)return null;let o=r.getExpression(),s=o.getSymbol()??o.getType().getSymbol(),a=s?this.definitionFromSymbol(s):null;return a?{callerId:i.symbolId,target:{symbol:a.symbol,file:a.file,line:a.line}}:null}};function ue(t){let e=[],n=t.getDefaultImport();n&&e.push({identifier:n,importedName:"default",localName:n.getText(),kind:"default",isTypeOnly:t.getImportClause()?.isTypeOnly()??!1});let r=t.getNamespaceImport();r&&e.push({identifier:r,importedName:"*",localName:r.getText(),kind:"namespace",isTypeOnly:t.getImportClause()?.isTypeOnly()??!1});for(let i of t.getNamedImports()){let o=i.getNameNode(),a=i.getAliasNode()??(o.getKindName()==="Identifier"?o:null);e.push({identifier:a,importedName:o.getText(),localName:a?.getText()??o.getText(),kind:"named",isTypeOnly:i.isTypeOnly()||(t.getImportClause()?.isTypeOnly()??!1)})}return e.length===0&&e.push({identifier:null,importedName:"*",localName:null,kind:"side-effect",isTypeOnly:!1}),e}function Ze(t,e){let n=new Map;for(let r of F(t,e)){let i=C(r.symbol)??r.leaf;if(!i)continue;let o=n.get(i);o||(o=[],n.set(i,o)),o.push(r)}return n}function et(t,e,n){let r=new Map,i=new Map;return e.forEachDescendant(o=>{for(let s of pt(t,o)){let a=n.get(s);if(!a)continue;let c=L(e,o);for(let l of a){if(c<l.startLine-1||c>l.endLine+1)continue;let d=Math.abs(c-l.startLine),m=i.get(l.symbolId);m!==void 0&&m<=d||(i.set(l.symbolId,d),r.set(l.symbolId,o))}}}),r}function tt(t,e,n){return{importer:t,sourcePath:e,importedName:n.importedName,localName:n.localName,kind:n.kind,isTypeOnly:!0,isUsed:!0,isTypeUsed:!0,isValueUsed:!1,references:[]}}function nt(t,e,n){let r=t.get(e);r||(r=[],t.set(e,r)),r.push(n)}function rt(t){let e=g.join(t,"package.json");if(!T(e))return[];let n;try{n=JSON.parse(pe(e,"utf8"))}catch{return[]}return(Array.isArray(n.workspaces)?n.workspaces:n.workspaces?.packages??[]).flatMap(i=>it(t,i)).flatMap(i=>ot(t,i))}function it(t,e){if(!e||e.startsWith("!")||e.includes("node_modules"))return[];if(!e.includes("*")){let s=g.join(t,e);return T(g.join(s,"package.json"))?[s]:[]}let n=e.indexOf("*"),r=e.slice(0,n).replace(/\/$/,""),i=e.slice(n+1).replace(/^\//,""),o=g.join(t,r||".");if(!T(o))return[];try{return Ge(o).map(s=>g.join(o,s,i)).filter(s=>T(g.join(s,"package.json")))}catch{return[]}}function ot(t,e){try{let n=JSON.parse(pe(g.join(e,"package.json"),"utf8"));if(!n.name)return[];let r=g.relative(t,e).replace(/\\/g,"/");return[{name:n.name,rootRelative:r,sourceRootRelative:`${r}/src`}]}catch{return[]}}function st(t,e){for(let n of t)if(e===n.name||e.startsWith(`${n.name}/`))return n.name;return null}function at(t){return[`${t.sourceRootRelative}/index.ts`,`${t.sourceRootRelative}/index.tsx`,`${t.sourceRootRelative}/index.mts`,`${t.sourceRootRelative}/index.cts`]}function ct(t,e){return t.getReferences().map(n=>{let r=n.getNode();return me(r,e)})}function lt(t){let e=t;return typeof e.findReferences=="function"?e.findReferences():[]}function ut(t,e,n,r){let i=[];for(let o of lt(t))for(let s of ct(o,r))s.file===e.relativePath&&s.line>=e.startLine&&s.line<=e.endLine||i.push(s);for(let o of n)i.push(o);return J(i)}function dt(t,e,n,r){let i=[],o=n?.getStart();for(let s of t.getReferences()){let a=s.getNode();_(r,a.getSourceFile().getFilePath())===e&&(o!==void 0&&a.getStart()===o||i.push({location:me(a,r),node:a}))}return i}function me(t,e){let n=t.getSourceFile(),r=n.getLineAndColumnAtPos(t.getStart());return{file:_(e,n.getFilePath())??n.getBaseName(),line:r.line-1,column:r.column-1}}function ft(t,e,n){let r=t.getSourceFile(),i=L(r,t),o=t.getText(),s=new RegExp(`\\b${xt(o)}\\b`,"g"),a=r.getFullText().split(`
29
+ `),c=[];for(let l=0;l<a.length;l++){if(l===i)continue;let d=a[l]??"";s.lastIndex=0;let m;for(;(m=s.exec(d))!==null;)c.push({file:e,line:l,column:m.index})}return J(c.filter(l=>_(n,g.join(n,l.file))===e))}function de(t){for(let e=t;e;e=e.getParent()){let n=e.getKindName();if(n.includes("Type")||n==="InterfaceDeclaration"||n==="TypeAliasDeclaration")return!0;if(n==="CallExpression"||n==="NewExpression"||n==="ExpressionStatement")return!1}return!1}function pt(t,e){let n=[],r=i=>{i&&!n.includes(i)&&n.push(i)};if("getNameNode"in e&&typeof e.getNameNode=="function"){let i=e.getNameNode();r(i?.getText())}if("getName"in e&&typeof e.getName=="function"){let i=e.getName();r(i)}return t.Node.isIdentifier(e)&&r(e.getText()),n}function gt(t,e,n,r){return t.all(`SELECT
30
+ gs.id AS symbolId,
31
+ gs.symbol,
32
+ d.relative_path AS relativePath,
33
+ COALESCE(der.start_line, c.start_line) AS startLine,
34
+ COALESCE(der.end_line, c.end_line) AS endLine,
35
+ COALESCE(gs.display_name, '') AS leaf,
36
+ NULL AS parentTypeName,
37
+ CASE WHEN gs.kind IN (6, 12, 13) OR gs.symbol LIKE '%().' THEN 1 ELSE 0 END AS isFunctionLike,
38
+ CASE WHEN gs.kind IN (5, 8, 11) THEN 1 ELSE 0 END AS isTypeLike,
39
+ gs.kind AS kind,
40
+ gs.documentation AS documentation,
41
+ gs.enclosing_symbol AS enclosingSymbol
42
+ FROM global_symbols gs
43
+ LEFT JOIN defn_enclosing_ranges der ON der.symbol_id = gs.id
44
+ LEFT JOIN chunks c ON c.document_id = der.document_id
45
+ JOIN documents d ON d.id = der.document_id
46
+ WHERE d.relative_path = ?
47
+ AND COALESCE(gs.display_name, gs.symbol) LIKE ?
48
+ ORDER BY ABS(COALESCE(der.start_line, c.start_line) - ?)
49
+ LIMIT 5`,e,`%${r}%`,n)[0]??null}function mt(t,e){let n=t.all(`SELECT
50
+ d.id AS documentId,
51
+ gs.id AS symbolId,
52
+ gs.symbol,
53
+ d.relative_path AS relativePath,
54
+ der.start_line AS startLine,
55
+ der.end_line AS endLine,
56
+ COALESCE(gs.display_name, '') AS leaf,
57
+ NULL AS parentTypeName,
58
+ CASE WHEN gs.kind IN (6, 12, 13) OR gs.symbol LIKE '%().' THEN 1 ELSE 0 END AS isFunctionLike,
59
+ CASE WHEN gs.kind IN (5, 8, 11) THEN 1 ELSE 0 END AS isTypeLike,
60
+ gs.kind AS kind,
61
+ gs.documentation AS documentation,
62
+ gs.enclosing_symbol AS enclosingSymbol
63
+ FROM global_symbols gs
64
+ JOIN defn_enclosing_ranges der ON der.symbol_id = gs.id
65
+ JOIN documents d ON d.id = der.document_id
66
+ WHERE d.relative_path = ?
67
+ UNION ALL
68
+ SELECT
69
+ d.id AS documentId,
70
+ gs.id AS symbolId,
71
+ gs.symbol,
72
+ d.relative_path AS relativePath,
73
+ MIN(c.start_line) AS startLine,
74
+ MAX(c.end_line) AS endLine,
75
+ COALESCE(gs.display_name, '') AS leaf,
76
+ NULL AS parentTypeName,
77
+ CASE WHEN gs.kind IN (6, 12, 13) OR gs.symbol LIKE '%().' THEN 1 ELSE 0 END AS isFunctionLike,
78
+ CASE WHEN gs.kind IN (5, 8, 11) THEN 1 ELSE 0 END AS isTypeLike,
79
+ gs.kind AS kind,
80
+ gs.documentation AS documentation,
81
+ gs.enclosing_symbol AS enclosingSymbol
82
+ FROM global_symbols gs
83
+ JOIN mentions m ON m.symbol_id = gs.id
84
+ JOIN chunks c ON c.id = m.chunk_id
85
+ JOIN documents d ON d.id = c.document_id
86
+ WHERE d.relative_path = ?
87
+ AND m.role = 1
88
+ GROUP BY gs.id, gs.symbol, d.id, d.relative_path, gs.display_name, gs.kind, gs.documentation, gs.enclosing_symbol
89
+ ORDER BY startLine, endLine`,e,e),r=new Set,i=new Map;for(let o of n){if(r.has(o.symbolId))continue;r.add(o.symbolId);let s=o.leaf||C(o.symbol);!s||i.has(s)||i.set(s,{...o,leaf:s})}return i}function St(t,e){let n=null;for(let r of t)e<r.startLine||e>r.endLine||(!n||r.startLine>=n.startLine)&&(n=r);return n}function L(t,e){return t.getLineAndColumnAtPos(e.getStart()).line-1}function J(t){let e=new Set,n=[];for(let r of t){let i=`${r.file}:${r.line}:${r.column}`;e.has(i)||(e.add(i),n.push(r))}return n}function ht(t,e,n){for(let r of e){let i=t.get(r)??[];i.push(...n),t.set(r,i)}}function yt(t){let e=new Set,n=[];for(let r of t){let i=`${r.symbol}|${r.file}|${r.line}`;e.has(i)||(e.add(i),n.push(r))}return n}function h(t,e,n){if(t.has(e))return t.get(e);let r=n();return t.set(e,r),r}function _(t,e){let n=g.relative(t||process.cwd(),e).replace(/\\/g,"/");return!n||n.startsWith("..")?null:n}function It(t){return/\.(?:ts|tsx|mts|cts|js|jsx|mjs|cjs)$/.test(t)}function fe(t){return t.replace(/\s+/g," ").replace(/\bimport\("[^"]+"\)\./g,"").trim()}function xt(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}var B=new WeakMap;function Se(t,e){let n=`${t.config.projectRoot}:typescript-workspace`,r=B.get(t);r||(r=new Map,B.set(t,r));let i=r.get(n);if(i)return i;let o=ge(t,e);return r.set(n,o),o}function $t(t){B.delete(t)}function Ht(t,e){let n=M(t,e);return n?n.importUsage(e):[]}function Et(t,e){let n=M(t,e.relativePath);return n?n.referencesFor(e):[]}function Xt(t,e){let n=new Map;for(let r of e)for(let i of Et(t,r)){if(i.file===r.relativePath||t.isIgnored(i.file))continue;let o=n.get(r.symbolId);o||(o=new Set,n.set(r.symbolId,o)),o.add(i.file)}return n}function Jt(t,e){let n=new Map;for(let r of e){let i=M(t,r.relativePath);if(!i)continue;let o=i.calleesFor(r);o.length>0&&n.set(r.symbolId,o)}return n}function Bt(t,e){let n=M(t,e.relativePath);return n?n.signatureFor(e):null}function M(t,e){if(!Nt(e))return null;let n=Se(t,e);return n.availability().available?n:null}function Nt(t){return/\.(?:ts|tsx|mts|cts|js|jsx|mjs|cjs)$/.test(t)}export{q as a,te as b,re as c,Dt as d,Le as e,w as f,Ce as g,Fe as h,Oe as i,Pe as j,Ae as k,je as l,x as m,$t as n,Ht as o,Et as p,Xt as q,Jt as r,Bt as s};
90
+ //# sourceMappingURL=chunk-G47V5V3U.js.map