purecontext-mcp 1.1.8 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (167) hide show
  1. package/AGENT_INSTRUCTIONS.md +393 -0
  2. package/AGENT_INSTRUCTIONS_SHORT.md +53 -0
  3. package/AST-SEARCH.md +274 -0
  4. package/CHANGELOG.md +62 -0
  5. package/CODE-INTELLIGENCE.md +369 -0
  6. package/HEALTH-DASHBOARDS.md +241 -0
  7. package/README.md +7 -0
  8. package/REFACTORING-SAFELY.md +279 -0
  9. package/UNDERSTANDING-RELATIONSHIPS.md +240 -0
  10. package/USER-GUIDE.md +14 -0
  11. package/VISUALIZING-CODE.md +199 -0
  12. package/WORKFLOW-TECH-DEBT.md +286 -0
  13. package/dist/core/db/dep-store.d.ts +75 -0
  14. package/dist/core/db/dep-store.d.ts.map +1 -1
  15. package/dist/core/db/dep-store.js +277 -0
  16. package/dist/core/db/dep-store.js.map +1 -1
  17. package/dist/core/db/schema.d.ts.map +1 -1
  18. package/dist/core/db/schema.js +12 -0
  19. package/dist/core/db/schema.js.map +1 -1
  20. package/dist/core/index-manager.js +1 -1
  21. package/dist/core/index-manager.js.map +1 -1
  22. package/dist/core/types.d.ts +5 -0
  23. package/dist/core/types.d.ts.map +1 -1
  24. package/dist/graph/diagram-renderer.d.ts +83 -0
  25. package/dist/graph/diagram-renderer.d.ts.map +1 -0
  26. package/dist/graph/diagram-renderer.js +294 -0
  27. package/dist/graph/diagram-renderer.js.map +1 -0
  28. package/dist/graph/graph-traversal.d.ts +92 -0
  29. package/dist/graph/graph-traversal.d.ts.map +1 -1
  30. package/dist/graph/graph-traversal.js +440 -2
  31. package/dist/graph/graph-traversal.js.map +1 -1
  32. package/dist/server/mcp-server.d.ts.map +1 -1
  33. package/dist/server/mcp-server.js +145 -0
  34. package/dist/server/mcp-server.js.map +1 -1
  35. package/dist/server/tools/check-delete-safe.d.ts +50 -0
  36. package/dist/server/tools/check-delete-safe.d.ts.map +1 -0
  37. package/dist/server/tools/check-delete-safe.js +308 -0
  38. package/dist/server/tools/check-delete-safe.js.map +1 -0
  39. package/dist/server/tools/check-move-safe.d.ts +44 -0
  40. package/dist/server/tools/check-move-safe.d.ts.map +1 -0
  41. package/dist/server/tools/check-move-safe.js +266 -0
  42. package/dist/server/tools/check-move-safe.js.map +1 -0
  43. package/dist/server/tools/check-rename-safe.d.ts +48 -0
  44. package/dist/server/tools/check-rename-safe.d.ts.map +1 -0
  45. package/dist/server/tools/check-rename-safe.js +218 -0
  46. package/dist/server/tools/check-rename-safe.js.map +1 -0
  47. package/dist/server/tools/diff-health-radar.d.ts +44 -0
  48. package/dist/server/tools/diff-health-radar.d.ts.map +1 -0
  49. package/dist/server/tools/diff-health-radar.js +192 -0
  50. package/dist/server/tools/diff-health-radar.js.map +1 -0
  51. package/dist/server/tools/find-cycles.d.ts +31 -0
  52. package/dist/server/tools/find-cycles.d.ts.map +1 -0
  53. package/dist/server/tools/find-cycles.js +85 -0
  54. package/dist/server/tools/find-cycles.js.map +1 -0
  55. package/dist/server/tools/find-implementations.d.ts +47 -0
  56. package/dist/server/tools/find-implementations.d.ts.map +1 -0
  57. package/dist/server/tools/find-implementations.js +167 -0
  58. package/dist/server/tools/find-implementations.js.map +1 -0
  59. package/dist/server/tools/find-untested-symbols.d.ts +52 -0
  60. package/dist/server/tools/find-untested-symbols.d.ts.map +1 -0
  61. package/dist/server/tools/find-untested-symbols.js +308 -0
  62. package/dist/server/tools/find-untested-symbols.js.map +1 -0
  63. package/dist/server/tools/get-architecture-snapshot.d.ts +43 -0
  64. package/dist/server/tools/get-architecture-snapshot.d.ts.map +1 -0
  65. package/dist/server/tools/get-architecture-snapshot.js +292 -0
  66. package/dist/server/tools/get-architecture-snapshot.js.map +1 -0
  67. package/dist/server/tools/get-call-hierarchy.d.ts +43 -0
  68. package/dist/server/tools/get-call-hierarchy.d.ts.map +1 -0
  69. package/dist/server/tools/get-call-hierarchy.js +119 -0
  70. package/dist/server/tools/get-call-hierarchy.js.map +1 -0
  71. package/dist/server/tools/get-class-hierarchy.d.ts +36 -0
  72. package/dist/server/tools/get-class-hierarchy.d.ts.map +1 -0
  73. package/dist/server/tools/get-class-hierarchy.js +125 -0
  74. package/dist/server/tools/get-class-hierarchy.js.map +1 -0
  75. package/dist/server/tools/get-complexity-hotspots.d.ts +50 -0
  76. package/dist/server/tools/get-complexity-hotspots.d.ts.map +1 -0
  77. package/dist/server/tools/get-complexity-hotspots.js +282 -0
  78. package/dist/server/tools/get-complexity-hotspots.js.map +1 -0
  79. package/dist/server/tools/get-coupling-map.d.ts +39 -0
  80. package/dist/server/tools/get-coupling-map.d.ts.map +1 -0
  81. package/dist/server/tools/get-coupling-map.js +107 -0
  82. package/dist/server/tools/get-coupling-map.js.map +1 -0
  83. package/dist/server/tools/get-debt-report.d.ts +44 -0
  84. package/dist/server/tools/get-debt-report.d.ts.map +1 -0
  85. package/dist/server/tools/get-debt-report.js +606 -0
  86. package/dist/server/tools/get-debt-report.js.map +1 -0
  87. package/dist/server/tools/get-entry-points.d.ts +79 -0
  88. package/dist/server/tools/get-entry-points.d.ts.map +1 -0
  89. package/dist/server/tools/get-entry-points.js +362 -0
  90. package/dist/server/tools/get-entry-points.js.map +1 -0
  91. package/dist/server/tools/get-public-api.d.ts +53 -0
  92. package/dist/server/tools/get-public-api.d.ts.map +1 -0
  93. package/dist/server/tools/get-public-api.js +218 -0
  94. package/dist/server/tools/get-public-api.js.map +1 -0
  95. package/dist/server/tools/get-test-coverage-map.d.ts +66 -0
  96. package/dist/server/tools/get-test-coverage-map.d.ts.map +1 -0
  97. package/dist/server/tools/get-test-coverage-map.js +588 -0
  98. package/dist/server/tools/get-test-coverage-map.js.map +1 -0
  99. package/dist/server/tools/get-todos.d.ts +51 -0
  100. package/dist/server/tools/get-todos.d.ts.map +1 -0
  101. package/dist/server/tools/get-todos.js +180 -0
  102. package/dist/server/tools/get-todos.js.map +1 -0
  103. package/dist/server/tools/get-type-graph.d.ts +73 -0
  104. package/dist/server/tools/get-type-graph.d.ts.map +1 -0
  105. package/dist/server/tools/get-type-graph.js +437 -0
  106. package/dist/server/tools/get-type-graph.js.map +1 -0
  107. package/dist/server/tools/health-radar.d.ts +50 -0
  108. package/dist/server/tools/health-radar.d.ts.map +1 -0
  109. package/dist/server/tools/health-radar.js +426 -0
  110. package/dist/server/tools/health-radar.js.map +1 -0
  111. package/dist/server/tools/plan-refactoring.d.ts +74 -0
  112. package/dist/server/tools/plan-refactoring.d.ts.map +1 -0
  113. package/dist/server/tools/plan-refactoring.js +644 -0
  114. package/dist/server/tools/plan-refactoring.js.map +1 -0
  115. package/dist/server/tools/render-call-graph.d.ts +40 -0
  116. package/dist/server/tools/render-call-graph.d.ts.map +1 -0
  117. package/dist/server/tools/render-call-graph.js +215 -0
  118. package/dist/server/tools/render-call-graph.js.map +1 -0
  119. package/dist/server/tools/render-class-hierarchy.d.ts +42 -0
  120. package/dist/server/tools/render-class-hierarchy.d.ts.map +1 -0
  121. package/dist/server/tools/render-class-hierarchy.js +265 -0
  122. package/dist/server/tools/render-class-hierarchy.js.map +1 -0
  123. package/dist/server/tools/render-dep-matrix.d.ts +38 -0
  124. package/dist/server/tools/render-dep-matrix.d.ts.map +1 -0
  125. package/dist/server/tools/render-dep-matrix.js +186 -0
  126. package/dist/server/tools/render-dep-matrix.js.map +1 -0
  127. package/dist/server/tools/render-diagram.d.ts +47 -0
  128. package/dist/server/tools/render-diagram.d.ts.map +1 -0
  129. package/dist/server/tools/render-diagram.js +266 -0
  130. package/dist/server/tools/render-diagram.js.map +1 -0
  131. package/dist/server/tools/render-import-graph.d.ts +41 -0
  132. package/dist/server/tools/render-import-graph.d.ts.map +1 -0
  133. package/dist/server/tools/render-import-graph.js +158 -0
  134. package/dist/server/tools/render-import-graph.js.map +1 -0
  135. package/dist/server/tools/search-ast.d.ts +55 -0
  136. package/dist/server/tools/search-ast.d.ts.map +1 -0
  137. package/dist/server/tools/search-ast.js +279 -0
  138. package/dist/server/tools/search-ast.js.map +1 -0
  139. package/dist/server/tools/search-by-complexity.d.ts +92 -0
  140. package/dist/server/tools/search-by-complexity.d.ts.map +1 -0
  141. package/dist/server/tools/search-by-complexity.js +268 -0
  142. package/dist/server/tools/search-by-complexity.js.map +1 -0
  143. package/dist/server/tools/search-by-decorator.d.ts +48 -0
  144. package/dist/server/tools/search-by-decorator.d.ts.map +1 -0
  145. package/dist/server/tools/search-by-decorator.js +518 -0
  146. package/dist/server/tools/search-by-decorator.js.map +1 -0
  147. package/dist/server/tools/search-by-signature.d.ts +56 -0
  148. package/dist/server/tools/search-by-signature.d.ts.map +1 -0
  149. package/dist/server/tools/search-by-signature.js +200 -0
  150. package/dist/server/tools/search-by-signature.js.map +1 -0
  151. package/dist/ui/assets/BlastRadius-QdgESOL8.js +1 -0
  152. package/dist/ui/assets/{DependencyGraph-B60SMPbX.js → DependencyGraph-BSMhzwWV.js} +1 -1
  153. package/dist/ui/assets/{NotFound-Bsg8Wppk.js → NotFound-CipFP_s1.js} +1 -1
  154. package/dist/ui/assets/{RepoDetail-Cie0D4_s.js → RepoDetail-Dfp5z5Kq.js} +1 -1
  155. package/dist/ui/assets/{RepoList-CldNt89M.js → RepoList-BKtST3hB.js} +1 -1
  156. package/dist/ui/assets/{Search-CgvpHMOi.js → Search-DzhGDViy.js} +1 -1
  157. package/dist/ui/assets/{SymbolView-B9h0LZTz.js → SymbolView-ryVEwAHG.js} +1 -1
  158. package/dist/ui/assets/{index-DADf5y_L.css → index-Ny8gn9F0.css} +1 -1
  159. package/dist/ui/assets/{index-eK0wMkUR.js → index-nX2chMqi.js} +2 -2
  160. package/dist/ui/assets/{useSearch-KAl3Qyi2.js → useSearch-BnBCRKui.js} +1 -1
  161. package/dist/ui/index.html +2 -2
  162. package/dist/version.d.ts +1 -1
  163. package/dist/version.js +1 -1
  164. package/docs/dev/jcodemunch-gap-analysis.md +198 -0
  165. package/package.json +9 -1
  166. package/user-manual.md +2466 -0
  167. package/dist/ui/assets/BlastRadius-RP7vJEyQ.js +0 -1
@@ -1 +1 @@
1
- import{c as le,j as t,b as u,d as ie,u as ce,r as p,a as k,e as de,A as G,L as _}from"./index-eK0wMkUR.js";const f=le(e=>({mode:"complexity",enabled:!1,data:{},loading:!1,error:null,qualityAvailable:{},setMode:r=>e({mode:r}),setEnabled:r=>e({enabled:r}),setData:(r,n)=>e(a=>({data:{...a.data,[r]:n}})),setLoading:r=>e({loading:r}),setError:r=>e({error:r}),setQualityAvailable:(r,n)=>e(a=>({qualityAvailable:{...a.qualityAvailable,[r]:n}}))}));function J(e,r){return r==="complexity"?e.complexityScore:r==="churn"?e.churnScore:e.combinedScore}function B(e){const r=Math.min(Math.max(e,0),100);return`hsl(${Math.round(120-r*1.2)}, 70%, 45%)`}function xe(e,r){const n=new Map;for(const l of e){let o=n.get(l.filePath);o||(o={maxQualityScore:0,totalCC:0,ccCount:0,criticalCount:0},n.set(l.filePath,o)),o.maxQualityScore=Math.max(o.maxQualityScore,l.qualityScore),o.totalCC+=l.cyclomaticComplexity,o.ccCount+=1,l.riskLevel==="critical"&&(o.criticalCount+=1)}const a=new Map;for(const l of r){const o=Math.min(l.churnScore/10*100,100);a.set(l.filePath,{churnScore:o,commitCount:l.commitCount})}const i=new Set([...n.keys(),...a.keys()]),g={};for(const l of i){const o=n.get(l),c=a.get(l),m=(o==null?void 0:o.maxQualityScore)??0,v=(c==null?void 0:c.churnScore)??0,w=Math.round(m*.6+v*.4),x=o&&o.ccCount>0?Math.round(o.totalCC/o.ccCount*10)/10:0;g[l]={complexityScore:m,churnScore:v,combinedScore:w,avgComplexity:x,commitCount:(c==null?void 0:c.commitCount)??0,criticalSymbols:(o==null?void 0:o.criticalCount)??0}}return g}function ue(e){var a;const r=((a=e.split(".").pop())==null?void 0:a.toLowerCase())??"";return{ts:"TS",tsx:"TX",js:"JS",jsx:"JX",vue:"VU",svelte:"SV",astro:"AS",py:"PY",go:"GO",rs:"RS",rb:"RB",java:"JV",kt:"KT",cs:"C#",cpp:"C+",c:"C ",h:"H ",php:"PHP",lua:"LU",r:"R ",dart:"DA",swift:"SW",ex:"EX",hs:"HS",scala:"SC",elixir:"EX",json:"JSON",yaml:"YAML",yml:"YML",toml:"TOML",md:"MD",txt:"TXT",css:"CSS",scss:"SCSS",html:"HTM",svg:"SVG",sh:"SH",bash:"SH",zsh:"SH",sql:"SQL",graphql:"GQL"}[r]??" "}function me({name:e}){const r=ue(e);return t.jsx("span",{className:"shrink-0 text-[9px] font-bold w-6 h-4 flex items-center justify-center rounded bg-gray-800 text-gray-500 font-mono leading-none","aria-hidden":"true",children:r})}function he({status:e,title:r}){const n=e==="tested"?"bg-green-500":e==="untested"?"bg-red-500":"bg-gray-500";return t.jsx("span",{className:`shrink-0 w-1.5 h-1.5 rounded-full ${n}`,title:r,"aria-label":`Coverage: ${e}`})}function pe(e){const r=[];return e.avgComplexity>0&&r.push(`Avg complexity: ${e.avgComplexity}`),e.commitCount>0&&r.push(`Churn: ${e.commitCount} commits/90d`),e.criticalSymbols>0&&r.push(`${e.criticalSymbols} critical symbol${e.criticalSymbols!==1?"s":""}`),r.length>0?r.join(" | "):"No metrics available"}function Y(e,r,n,a){let i=null;for(const[g,l]of Object.entries(e)){const o=`${r}/${g}`;if(l.type==="file"){const c=n.get(o);if(c!==void 0){const m=J(c,a);i=i===null?m:Math.max(i,m)}}else{const c=Y(l.children,o,n,a);c!==null&&(i=i===null?c:Math.max(i,c))}}return i}function Z(e){return Object.entries(e).sort(([r,n],[a,i])=>n.type!==i.type?n.type==="dir"?-1:1:r.localeCompare(a))}function q({name:e,node:r,path:n,repoId:a,depth:i,onFileClick:g,coverageMap:l,heatScores:o,heatMode:c}){const m=u(h=>h.expandedDirs[a]),v=u(h=>h.toggleDir),w=u(h=>h.selectedFilePath),x=8+i*14,C=r.type==="dir"&&((m==null?void 0:m.has(n))??!1),y=r.type==="file"&&w===n;if(r.type==="dir"){const h=o&&c?Y(r.children,n,o,c):null,E=h!==null?{borderLeftColor:B(h),borderLeftWidth:"2px",borderLeftStyle:"solid"}:void 0;return t.jsxs("div",{children:[t.jsxs("button",{onClick:()=>v(a,n),style:{paddingLeft:`${x}px`,...E},title:h!==null?`Max risk score: ${Math.round(h)}`:void 0,className:"flex items-center gap-1.5 w-full text-left py-[3px] pr-2 text-sm text-gray-400 hover:text-gray-100 hover:bg-gray-800/60 rounded transition-colors","aria-expanded":C,children:[t.jsx("svg",{className:`shrink-0 w-3 h-3 text-gray-600 transition-transform ${C?"rotate-90":""}`,viewBox:"0 0 6 10",fill:"currentColor","aria-hidden":"true",children:t.jsx("path",{d:"M1 1l4 4-4 4",stroke:"currentColor",strokeWidth:"1.5",fill:"none",strokeLinecap:"round",strokeLinejoin:"round"})}),t.jsx("svg",{className:"shrink-0 w-4 h-4 text-blue-400/70",viewBox:"0 0 16 16",fill:"currentColor","aria-hidden":"true",children:C?t.jsx("path",{d:"M1.5 3A1.5 1.5 0 0 0 0 4.5v8A1.5 1.5 0 0 0 1.5 14h13a1.5 1.5 0 0 0 1.5-1.5V6.5A1.5 1.5 0 0 0 14.5 5H8.414l-1.5-1.5H1.5z"}):t.jsx("path",{d:"M.54 3.87.5 3a2 2 0 0 1 2-2h3.672a2 2 0 0 1 1.414.586l.828.828A2 2 0 0 0 9.828 3h3.982a2 2 0 0 1 1.992 2.181l-.637 7A2 2 0 0 1 13.174 14H2.826a2 2 0 0 1-1.991-1.819l-.637-7a2 2 0 0 1 .342-1.31zM8 1H2.5a1 1 0 0 0-1 1l.006.017A4.97 4.97 0 0 1 3.982 2h5.845A2 2 0 0 0 8 1z"})}),t.jsx("span",{className:"truncate text-xs font-medium",children:e}),t.jsx("span",{className:"ml-auto shrink-0 text-[10px] text-gray-600",children:r.fileCount})]}),C&&t.jsx("div",{role:"group","aria-label":e,children:Z(r.children).map(([j,S])=>t.jsx(q,{name:j,node:S,path:`${n}/${j}`,repoId:a,depth:i+1,onFileClick:g,coverageMap:l,heatScores:o,heatMode:c},j))})]})}const N=l==null?void 0:l.get(n),b=o==null?void 0:o.get(n),L=b&&c?J(b,c):null,$=L!==null?{borderLeftColor:B(L),borderLeftWidth:"2px",borderLeftStyle:"solid"}:void 0;return t.jsxs("button",{onClick:()=>g(n),style:{paddingLeft:`${x}px`,...$},title:b?pe(b):void 0,className:`flex items-center gap-1.5 w-full text-left py-[3px] pr-2 text-sm rounded transition-colors ${y?"bg-blue-900/50 text-blue-200":"text-gray-400 hover:text-gray-100 hover:bg-gray-800/60"}`,"aria-current":y?"true":void 0,children:[t.jsx("span",{className:"w-3 shrink-0","aria-hidden":"true"}),t.jsx(me,{name:e}),t.jsx("span",{className:"truncate text-xs",children:e}),N&&t.jsx(he,{status:N,title:`Coverage: ${N}`})]})}function fe({tree:e,repoId:r,onFileClick:n,coverageMap:a,heatScores:i,heatMode:g}){return Object.keys(e).length===0?t.jsx("div",{className:"flex items-center justify-center h-32 text-gray-600 text-sm",children:"No files found"}):t.jsx("div",{className:"overflow-y-auto h-full scrollbar-thin py-1",role:"tree","aria-label":"File tree",children:Z(e).map(([l,o])=>t.jsx(q,{name:l,node:o,path:l,repoId:r,depth:0,onFileClick:n,coverageMap:a,heatScores:i,heatMode:g},l))})}const K=["class","interface","type","enum","component","composable","hook","function","method","const","route","middleware","decorator"],U={class:"Classes",interface:"Interfaces",type:"Types",enum:"Enums",component:"Components",composable:"Composables",hook:"Hooks",function:"Functions",method:"Methods",const:"Constants",route:"Routes",middleware:"Middleware",decorator:"Decorators"},ge={class:"cls",interface:"int",type:"typ",enum:"enm",component:"cmp",composable:"cps",hook:"hk",function:"fn",method:"mth",const:"cst",route:"rte",middleware:"mdw",decorator:"dec"};function ye(e){switch(e){case"class":return"bg-blue-900/70 text-blue-300";case"interface":return"bg-indigo-900/70 text-indigo-300";case"type":return"bg-purple-900/70 text-purple-300";case"enum":return"bg-violet-900/70 text-violet-300";case"component":return"bg-emerald-900/70 text-emerald-300";case"composable":return"bg-teal-900/70 text-teal-300";case"hook":return"bg-cyan-900/70 text-cyan-300";case"function":return"bg-yellow-900/70 text-yellow-300";case"method":return"bg-orange-900/70 text-orange-300";case"const":return"bg-gray-800 text-gray-400";case"route":return"bg-rose-900/70 text-rose-300";case"middleware":return"bg-pink-900/70 text-pink-300";case"decorator":return"bg-amber-900/70 text-amber-300";default:return"bg-gray-800 text-gray-400"}}function be({symbol:e,onSymbolClick:r}){return t.jsxs("button",{onClick:()=>r==null?void 0:r(e.id),className:"w-full text-left px-3 py-1.5 hover:bg-gray-800/60 rounded transition-colors group",children:[t.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[t.jsx("span",{className:`shrink-0 text-[9px] font-bold font-mono px-1 py-0.5 rounded ${ye(e.kind)}`,"aria-label":e.kind,children:ge[e.kind]??e.kind.slice(0,3)}),t.jsx("span",{className:"text-sm text-gray-200 font-medium truncate group-hover:text-blue-300 transition-colors",children:e.name})]}),e.signature&&t.jsx("p",{className:"text-[11px] text-gray-500 mt-0.5 truncate font-mono pl-8",children:e.signature}),e.summary&&t.jsx("p",{className:"text-[11px] text-gray-600 mt-0.5 truncate pl-8",children:e.summary})]})}function je({kind:e,symbols:r,onSymbolClick:n}){return t.jsxs("section",{"aria-label":U[e]??e,className:"mb-3",children:[t.jsxs("div",{className:"flex items-center gap-2 px-3 py-1",children:[t.jsx("span",{className:"text-[10px] font-semibold text-gray-500 uppercase tracking-wider",children:U[e]??e}),t.jsxs("span",{className:"text-[10px] text-gray-600",children:["(",r.length,")"]})]}),t.jsx("div",{children:r.map(a=>t.jsx(be,{symbol:a,onSymbolClick:n},a.id))})]})}function ve(e){const r=new Map;for(const a of e){const i=r.get(a.kind)??[];i.push(a),r.set(a.kind,i)}return[...K.filter(a=>r.has(a)),...Array.from(r.keys()).filter(a=>!K.includes(a)).sort()].map(a=>[a,r.get(a)])}function Ce({fileSummary:e,onSymbolClick:r}){if(!e)return t.jsx("div",{className:"flex items-center justify-center h-full text-gray-600 text-sm",children:"Select a file to view its symbols"});if(e.symbols.length===0)return t.jsxs("div",{className:"h-full overflow-y-auto scrollbar-thin",children:[t.jsx("div",{className:"px-3 py-2 border-b border-gray-800",children:t.jsx("p",{className:"text-xs text-gray-500 truncate",children:e.filePath})}),t.jsx("div",{className:"flex items-center justify-center h-32 text-gray-600 text-sm",children:"No symbols in this file"})]});const n=ve(e.symbols);return t.jsxs("div",{className:"h-full overflow-y-auto scrollbar-thin",children:[t.jsxs("div",{className:"px-3 py-2 border-b border-gray-800 shrink-0",children:[t.jsx("p",{className:"text-xs text-gray-400 truncate font-mono",children:e.filePath}),t.jsxs("p",{className:"text-[11px] text-gray-600 mt-0.5",children:[e.symbols.length," symbol",e.symbols.length!==1?"s":""]})]}),t.jsx("div",{className:"py-2",children:n.map(([a,i])=>t.jsx(je,{kind:a,symbols:i,onSymbolClick:r},a))})]})}const Ne=[{value:"complexity",label:"Complexity",title:"Colour by cyclomatic complexity (worst symbol per file)"},{value:"churn",label:"Churn",title:"Colour by commit frequency (commits per 90 days)"},{value:"combined",label:"Combined",title:"Weighted composite: 60 % complexity + 40 % churn"}],we=Array.from({length:11},(e,r)=>B(r*10)),Se=`linear-gradient(to right, ${we.join(", ")})`;function ke({mode:e,onModeChange:r}){return t.jsxs("div",{className:"px-3 py-2 border-b border-gray-800 bg-gray-900/80",children:[t.jsx("div",{className:"flex gap-1 mb-2",role:"group","aria-label":"Heatmap mode",children:Ne.map(({value:n,label:a,title:i})=>t.jsx("button",{onClick:()=>r(n),title:i,"aria-pressed":e===n,className:`flex-1 text-[10px] py-0.5 rounded transition-colors ${e===n?"bg-blue-600 text-white font-semibold":"bg-gray-800 text-gray-400 hover:bg-gray-700 hover:text-gray-200"}`,children:a},n))}),t.jsxs("div",{children:[t.jsx("div",{className:"h-2 w-full rounded-sm",style:{background:Se},"aria-hidden":"true"}),t.jsxs("div",{className:"flex justify-between text-[9px] text-gray-500 mt-0.5",children:[t.jsx("span",{children:"Low risk"}),t.jsx("span",{children:"High risk"})]})]})]})}function Le({repo:e,selectedFile:r}){const n=e.rootPath.split(/[/\\]/).pop()??e.repoId;return t.jsxs("nav",{"aria-label":"Breadcrumb",className:"flex items-center gap-1.5 text-sm text-gray-500 min-w-0",children:[t.jsx(_,{to:"/",className:"hover:text-gray-300 transition-colors shrink-0",children:"Repos"}),t.jsx("span",{"aria-hidden":"true",className:"text-gray-700",children:"/"}),t.jsx("span",{className:`truncate ${r?"hover:text-gray-300 cursor-pointer":"text-gray-300"}`,children:n}),r&&t.jsxs(t.Fragment,{children:[t.jsx("span",{"aria-hidden":"true",className:"text-gray-700 shrink-0",children:"/"}),t.jsx("span",{className:"text-gray-300 truncate text-xs font-mono",children:r})]})]})}function V({label:e,value:r}){return t.jsxs("div",{className:"flex flex-col items-center px-4 py-2 bg-gray-800/50 rounded-lg border border-gray-700/50",children:[t.jsx("span",{className:"text-xs text-gray-500",children:e}),t.jsx("span",{className:"text-lg font-bold text-gray-100 mt-0.5",children:r})]})}function Ee({repo:e}){const r=new Date(e.lastIndexed).toLocaleString();return t.jsxs("div",{className:"flex flex-wrap items-center gap-3 px-6 py-3 border-b border-gray-800 bg-gray-900/50",children:[t.jsx(V,{label:"Symbols",value:e.symbolCount.toLocaleString()}),t.jsx(V,{label:"Files",value:e.fileCount.toLocaleString()}),t.jsxs(_,{to:`/repos/${encodeURIComponent(e.repoId)}/graph`,className:"flex items-center gap-1.5 px-3 py-1.5 text-xs bg-gray-800 hover:bg-gray-700 border border-gray-700 rounded text-gray-300 transition-colors",children:[t.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none","aria-hidden":"true",children:[t.jsx("circle",{cx:"2",cy:"6",r:"1.5",fill:"currentColor"}),t.jsx("circle",{cx:"10",cy:"2",r:"1.5",fill:"currentColor"}),t.jsx("circle",{cx:"10",cy:"10",r:"1.5",fill:"currentColor"}),t.jsx("line",{x1:"3.5",y1:"5.2",x2:"8.5",y2:"2.8",stroke:"currentColor",strokeWidth:"1"}),t.jsx("line",{x1:"3.5",y1:"6.8",x2:"8.5",y2:"9.2",stroke:"currentColor",strokeWidth:"1"})]}),"Dep Graph"]}),t.jsxs("div",{className:"ml-auto text-xs text-gray-600 hidden sm:block",children:["Last indexed: ",t.jsx("span",{className:"text-gray-500",children:r})]})]})}function Ae(){return t.jsx("div",{className:"p-3 space-y-1.5 animate-pulse",children:[80,65,90,55,70,45,75].map((e,r)=>t.jsx("div",{className:"h-5 bg-gray-800 rounded",style:{width:`${e}%`}},r))})}function X({message:e}){return t.jsx("div",{className:"m-3 p-3 bg-red-950 border border-red-800 rounded text-red-300 text-sm",children:e})}function Me(){return t.jsxs("div",{className:"mx-3 mt-2 px-3 py-2 bg-yellow-950/60 border border-yellow-800/50 rounded text-yellow-300/80 text-xs",children:["Run analysis to enable heatmap.",t.jsx("br",{}),t.jsx("span",{className:"text-yellow-500/70",children:"Re-index this repo to compute quality metrics."})]})}function $e({enabled:e,loading:r,onToggle:n}){return t.jsxs("button",{onClick:n,title:e?"Disable heatmap":"Enable heatmap","aria-pressed":e,disabled:r,className:`flex items-center gap-1 px-2 py-0.5 text-[10px] rounded transition-colors ${e?"bg-orange-600/80 text-white hover:bg-orange-500":"bg-gray-800 text-gray-500 hover:bg-gray-700 hover:text-gray-300"} disabled:opacity-50 disabled:cursor-wait`,children:[t.jsx("svg",{width:"10",height:"10",viewBox:"0 0 16 16",fill:"currentColor","aria-hidden":"true",children:t.jsx("path",{d:"M8 16c3.314 0 6-2 6-5.5 0-1.5-.5-4-2.5-6 .25 1.5-1.25 2-1.25 2C11 4 9 .5 6 0c.357 2 .5 4-2 6-1.25 1-2 2.729-2 4.5C2 14 4.686 16 8 16zm0-1c-1.657 0-3-1-3-2.75 0-.75.25-2 1.25-3C6.125 10.5 7 11 7 11c-.375-1.25.5-3.25 2-3.75-.179 1-.25 2 1 3 .625.5 1 1.364 1 2.25C11 14 9.657 15 8 15z"})}),r?"Loading…":e?"Heatmap on":"Heatmap"]})}function De(){const{id:e}=ie(),r=ce(),n=u(s=>s.repos),a=u(s=>s.reposLoaded),i=u(s=>s.trees),g=u(s=>s.outlines),l=u(s=>s.selectedFilePath),o=u(s=>s.setRepos),c=u(s=>s.setTree),m=u(s=>s.setOutline),v=u(s=>s.selectRepo),w=u(s=>s.selectFile),x=f(s=>s.enabled),C=f(s=>s.mode),y=f(s=>e?s.data[e]:void 0),N=f(s=>s.loading),b=f(s=>s.error),L=f(s=>e?s.qualityAvailable[e]:null),$=f(s=>s.setEnabled),h=f(s=>s.setMode),E=f(s=>s.setData),j=f(s=>s.setLoading),S=f(s=>s.setError),O=f(s=>s.setQualityAvailable),[R,H]=p.useState(!1),[D,Q]=p.useState(null),[ee,P]=p.useState(!1),[T,W]=p.useState(null),I=n.find(s=>s.repoId===e),A=e?i[e]:void 0,M=e?g[e]:void 0;p.useEffect(()=>{a||!e||k.listRepos().then(s=>o(s.repos)).catch(()=>{})},[a,e,o]);const z=de(s=>s.setActive);p.useEffect(()=>{e&&(v(e),z(e))},[e,v,z]),p.useEffect(()=>{if(!e||A)return;let s=!1;return H(!0),Q(null),k.getFileTree(e).then(d=>{s||(c(e,d),H(!1))}).catch(d=>{s||(Q(d instanceof G?d.message:String(d)),H(!1))}),()=>{s=!0}},[e,A,c]),p.useEffect(()=>{if(!e||M)return;let s=!1;return P(!0),W(null),k.getRepoOutline(e).then(d=>{s||(m(e,d.files),P(!1))}).catch(d=>{s||(W(d instanceof G?d.message:String(d)),P(!1))}),()=>{s=!0}},[e,M,m]),p.useEffect(()=>{if(!x||!e||y)return;let s=!1;return j(!0),S(null),Promise.all([k.getQualityMetrics(e).catch(()=>null),k.getChurnMetrics(e).catch(()=>null)]).then(([d,F])=>{if(s)return;const ae=((d==null?void 0:d.symbolsAnalyzed)??0)>0;O(e,ae);const oe=xe((d==null?void 0:d.worstOffenders)??[],(F==null?void 0:F.topChurn)??[]);E(e,oe),j(!1)}).catch(d=>{s||(S(String(d)),j(!1))}),()=>{s=!0}},[x,e,y,j,S,E,O]);const te=p.useCallback(s=>{w(s)},[w]),re=p.useCallback(s=>{e&&r(`/symbols/${encodeURIComponent(s)}?repoId=${encodeURIComponent(e)}`)},[e,r]),se=p.useMemo(()=>{if(!(!x||!y))return new Map(Object.entries(y))},[x,y]),ne=!l||!M?null:M.find(s=>s.filePath===l)??{filePath:l,symbols:[]};return e?t.jsxs("div",{className:"h-full flex flex-col overflow-hidden",children:[t.jsx("div",{className:"px-6 py-3 border-b border-gray-800 shrink-0 min-w-0",children:t.jsx(Le,{repo:I??{repoId:e,rootPath:e,symbolCount:0,fileCount:0,lastIndexed:""},selectedFile:l})}),I&&t.jsx(Ee,{repo:I}),t.jsxs("div",{className:"flex-1 flex overflow-hidden",children:[t.jsxs("div",{className:"w-64 shrink-0 border-r border-gray-800 flex flex-col overflow-hidden",children:[t.jsxs("div",{className:"px-3 py-2 border-b border-gray-800 shrink-0 flex items-center gap-2",children:[t.jsx("span",{className:"text-xs font-semibold text-gray-500 uppercase tracking-wide flex-1",children:"Files"}),t.jsx($e,{enabled:x,loading:N,onToggle:()=>$(!x)})]}),x&&!N&&!b&&t.jsx(ke,{mode:C,onModeChange:s=>h(s)}),x&&!N&&L===!1&&t.jsx(Me,{}),x&&b&&t.jsx("div",{className:"mx-3 mt-2 px-3 py-2 bg-red-950/60 border border-red-800/50 rounded text-red-300/80 text-xs",children:b}),t.jsxs("div",{className:"flex-1 overflow-hidden",children:[R&&t.jsx(Ae,{}),D&&t.jsx(X,{message:D}),!R&&!D&&A&&t.jsx(fe,{tree:A.tree,repoId:e,onFileClick:te,heatScores:se,heatMode:x?C:void 0})]})]}),t.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[t.jsxs("div",{className:"px-3 py-2 border-b border-gray-800 shrink-0",children:[t.jsx("span",{className:"text-xs font-semibold text-gray-500 uppercase tracking-wide",children:"Symbols"}),ee&&t.jsx("span",{className:"ml-2 text-[10px] text-gray-600 animate-pulse",children:"loading…"})]}),t.jsxs("div",{className:"flex-1 overflow-hidden",children:[T&&t.jsx(X,{message:T}),!T&&t.jsx(Ce,{fileSummary:ne,onSymbolClick:re})]})]})]})]}):t.jsx("div",{className:"flex items-center justify-center h-full text-gray-500",children:"Invalid repository ID."})}export{De as default};
1
+ import{c as le,j as t,b as u,d as ie,u as ce,r as p,a as k,e as de,A as G,L as _}from"./index-nX2chMqi.js";const f=le(e=>({mode:"complexity",enabled:!1,data:{},loading:!1,error:null,qualityAvailable:{},setMode:r=>e({mode:r}),setEnabled:r=>e({enabled:r}),setData:(r,n)=>e(a=>({data:{...a.data,[r]:n}})),setLoading:r=>e({loading:r}),setError:r=>e({error:r}),setQualityAvailable:(r,n)=>e(a=>({qualityAvailable:{...a.qualityAvailable,[r]:n}}))}));function J(e,r){return r==="complexity"?e.complexityScore:r==="churn"?e.churnScore:e.combinedScore}function B(e){const r=Math.min(Math.max(e,0),100);return`hsl(${Math.round(120-r*1.2)}, 70%, 45%)`}function xe(e,r){const n=new Map;for(const l of e){let o=n.get(l.filePath);o||(o={maxQualityScore:0,totalCC:0,ccCount:0,criticalCount:0},n.set(l.filePath,o)),o.maxQualityScore=Math.max(o.maxQualityScore,l.qualityScore),o.totalCC+=l.cyclomaticComplexity,o.ccCount+=1,l.riskLevel==="critical"&&(o.criticalCount+=1)}const a=new Map;for(const l of r){const o=Math.min(l.churnScore/10*100,100);a.set(l.filePath,{churnScore:o,commitCount:l.commitCount})}const i=new Set([...n.keys(),...a.keys()]),g={};for(const l of i){const o=n.get(l),c=a.get(l),m=(o==null?void 0:o.maxQualityScore)??0,v=(c==null?void 0:c.churnScore)??0,w=Math.round(m*.6+v*.4),x=o&&o.ccCount>0?Math.round(o.totalCC/o.ccCount*10)/10:0;g[l]={complexityScore:m,churnScore:v,combinedScore:w,avgComplexity:x,commitCount:(c==null?void 0:c.commitCount)??0,criticalSymbols:(o==null?void 0:o.criticalCount)??0}}return g}function ue(e){var a;const r=((a=e.split(".").pop())==null?void 0:a.toLowerCase())??"";return{ts:"TS",tsx:"TX",js:"JS",jsx:"JX",vue:"VU",svelte:"SV",astro:"AS",py:"PY",go:"GO",rs:"RS",rb:"RB",java:"JV",kt:"KT",cs:"C#",cpp:"C+",c:"C ",h:"H ",php:"PHP",lua:"LU",r:"R ",dart:"DA",swift:"SW",ex:"EX",hs:"HS",scala:"SC",elixir:"EX",json:"JSON",yaml:"YAML",yml:"YML",toml:"TOML",md:"MD",txt:"TXT",css:"CSS",scss:"SCSS",html:"HTM",svg:"SVG",sh:"SH",bash:"SH",zsh:"SH",sql:"SQL",graphql:"GQL"}[r]??" "}function me({name:e}){const r=ue(e);return t.jsx("span",{className:"shrink-0 text-[9px] font-bold w-6 h-4 flex items-center justify-center rounded bg-gray-800 text-gray-500 font-mono leading-none","aria-hidden":"true",children:r})}function he({status:e,title:r}){const n=e==="tested"?"bg-green-500":e==="untested"?"bg-red-500":"bg-gray-500";return t.jsx("span",{className:`shrink-0 w-1.5 h-1.5 rounded-full ${n}`,title:r,"aria-label":`Coverage: ${e}`})}function pe(e){const r=[];return e.avgComplexity>0&&r.push(`Avg complexity: ${e.avgComplexity}`),e.commitCount>0&&r.push(`Churn: ${e.commitCount} commits/90d`),e.criticalSymbols>0&&r.push(`${e.criticalSymbols} critical symbol${e.criticalSymbols!==1?"s":""}`),r.length>0?r.join(" | "):"No metrics available"}function Y(e,r,n,a){let i=null;for(const[g,l]of Object.entries(e)){const o=`${r}/${g}`;if(l.type==="file"){const c=n.get(o);if(c!==void 0){const m=J(c,a);i=i===null?m:Math.max(i,m)}}else{const c=Y(l.children,o,n,a);c!==null&&(i=i===null?c:Math.max(i,c))}}return i}function Z(e){return Object.entries(e).sort(([r,n],[a,i])=>n.type!==i.type?n.type==="dir"?-1:1:r.localeCompare(a))}function q({name:e,node:r,path:n,repoId:a,depth:i,onFileClick:g,coverageMap:l,heatScores:o,heatMode:c}){const m=u(h=>h.expandedDirs[a]),v=u(h=>h.toggleDir),w=u(h=>h.selectedFilePath),x=8+i*14,C=r.type==="dir"&&((m==null?void 0:m.has(n))??!1),y=r.type==="file"&&w===n;if(r.type==="dir"){const h=o&&c?Y(r.children,n,o,c):null,E=h!==null?{borderLeftColor:B(h),borderLeftWidth:"2px",borderLeftStyle:"solid"}:void 0;return t.jsxs("div",{children:[t.jsxs("button",{onClick:()=>v(a,n),style:{paddingLeft:`${x}px`,...E},title:h!==null?`Max risk score: ${Math.round(h)}`:void 0,className:"flex items-center gap-1.5 w-full text-left py-[3px] pr-2 text-sm text-gray-400 hover:text-gray-100 hover:bg-gray-800/60 rounded transition-colors","aria-expanded":C,children:[t.jsx("svg",{className:`shrink-0 w-3 h-3 text-gray-600 transition-transform ${C?"rotate-90":""}`,viewBox:"0 0 6 10",fill:"currentColor","aria-hidden":"true",children:t.jsx("path",{d:"M1 1l4 4-4 4",stroke:"currentColor",strokeWidth:"1.5",fill:"none",strokeLinecap:"round",strokeLinejoin:"round"})}),t.jsx("svg",{className:"shrink-0 w-4 h-4 text-blue-400/70",viewBox:"0 0 16 16",fill:"currentColor","aria-hidden":"true",children:C?t.jsx("path",{d:"M1.5 3A1.5 1.5 0 0 0 0 4.5v8A1.5 1.5 0 0 0 1.5 14h13a1.5 1.5 0 0 0 1.5-1.5V6.5A1.5 1.5 0 0 0 14.5 5H8.414l-1.5-1.5H1.5z"}):t.jsx("path",{d:"M.54 3.87.5 3a2 2 0 0 1 2-2h3.672a2 2 0 0 1 1.414.586l.828.828A2 2 0 0 0 9.828 3h3.982a2 2 0 0 1 1.992 2.181l-.637 7A2 2 0 0 1 13.174 14H2.826a2 2 0 0 1-1.991-1.819l-.637-7a2 2 0 0 1 .342-1.31zM8 1H2.5a1 1 0 0 0-1 1l.006.017A4.97 4.97 0 0 1 3.982 2h5.845A2 2 0 0 0 8 1z"})}),t.jsx("span",{className:"truncate text-xs font-medium",children:e}),t.jsx("span",{className:"ml-auto shrink-0 text-[10px] text-gray-600",children:r.fileCount})]}),C&&t.jsx("div",{role:"group","aria-label":e,children:Z(r.children).map(([j,S])=>t.jsx(q,{name:j,node:S,path:`${n}/${j}`,repoId:a,depth:i+1,onFileClick:g,coverageMap:l,heatScores:o,heatMode:c},j))})]})}const N=l==null?void 0:l.get(n),b=o==null?void 0:o.get(n),L=b&&c?J(b,c):null,$=L!==null?{borderLeftColor:B(L),borderLeftWidth:"2px",borderLeftStyle:"solid"}:void 0;return t.jsxs("button",{onClick:()=>g(n),style:{paddingLeft:`${x}px`,...$},title:b?pe(b):void 0,className:`flex items-center gap-1.5 w-full text-left py-[3px] pr-2 text-sm rounded transition-colors ${y?"bg-blue-900/50 text-blue-200":"text-gray-400 hover:text-gray-100 hover:bg-gray-800/60"}`,"aria-current":y?"true":void 0,children:[t.jsx("span",{className:"w-3 shrink-0","aria-hidden":"true"}),t.jsx(me,{name:e}),t.jsx("span",{className:"truncate text-xs",children:e}),N&&t.jsx(he,{status:N,title:`Coverage: ${N}`})]})}function fe({tree:e,repoId:r,onFileClick:n,coverageMap:a,heatScores:i,heatMode:g}){return Object.keys(e).length===0?t.jsx("div",{className:"flex items-center justify-center h-32 text-gray-600 text-sm",children:"No files found"}):t.jsx("div",{className:"overflow-y-auto h-full scrollbar-thin py-1",role:"tree","aria-label":"File tree",children:Z(e).map(([l,o])=>t.jsx(q,{name:l,node:o,path:l,repoId:r,depth:0,onFileClick:n,coverageMap:a,heatScores:i,heatMode:g},l))})}const K=["class","interface","type","enum","component","composable","hook","function","method","const","route","middleware","decorator"],U={class:"Classes",interface:"Interfaces",type:"Types",enum:"Enums",component:"Components",composable:"Composables",hook:"Hooks",function:"Functions",method:"Methods",const:"Constants",route:"Routes",middleware:"Middleware",decorator:"Decorators"},ge={class:"cls",interface:"int",type:"typ",enum:"enm",component:"cmp",composable:"cps",hook:"hk",function:"fn",method:"mth",const:"cst",route:"rte",middleware:"mdw",decorator:"dec"};function ye(e){switch(e){case"class":return"bg-blue-900/70 text-blue-300";case"interface":return"bg-indigo-900/70 text-indigo-300";case"type":return"bg-purple-900/70 text-purple-300";case"enum":return"bg-violet-900/70 text-violet-300";case"component":return"bg-emerald-900/70 text-emerald-300";case"composable":return"bg-teal-900/70 text-teal-300";case"hook":return"bg-cyan-900/70 text-cyan-300";case"function":return"bg-yellow-900/70 text-yellow-300";case"method":return"bg-orange-900/70 text-orange-300";case"const":return"bg-gray-800 text-gray-400";case"route":return"bg-rose-900/70 text-rose-300";case"middleware":return"bg-pink-900/70 text-pink-300";case"decorator":return"bg-amber-900/70 text-amber-300";default:return"bg-gray-800 text-gray-400"}}function be({symbol:e,onSymbolClick:r}){return t.jsxs("button",{onClick:()=>r==null?void 0:r(e.id),className:"w-full text-left px-3 py-1.5 hover:bg-gray-800/60 rounded transition-colors group",children:[t.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[t.jsx("span",{className:`shrink-0 text-[9px] font-bold font-mono px-1 py-0.5 rounded ${ye(e.kind)}`,"aria-label":e.kind,children:ge[e.kind]??e.kind.slice(0,3)}),t.jsx("span",{className:"text-sm text-gray-200 font-medium truncate group-hover:text-blue-300 transition-colors",children:e.name})]}),e.signature&&t.jsx("p",{className:"text-[11px] text-gray-500 mt-0.5 truncate font-mono pl-8",children:e.signature}),e.summary&&t.jsx("p",{className:"text-[11px] text-gray-600 mt-0.5 truncate pl-8",children:e.summary})]})}function je({kind:e,symbols:r,onSymbolClick:n}){return t.jsxs("section",{"aria-label":U[e]??e,className:"mb-3",children:[t.jsxs("div",{className:"flex items-center gap-2 px-3 py-1",children:[t.jsx("span",{className:"text-[10px] font-semibold text-gray-500 uppercase tracking-wider",children:U[e]??e}),t.jsxs("span",{className:"text-[10px] text-gray-600",children:["(",r.length,")"]})]}),t.jsx("div",{children:r.map(a=>t.jsx(be,{symbol:a,onSymbolClick:n},a.id))})]})}function ve(e){const r=new Map;for(const a of e){const i=r.get(a.kind)??[];i.push(a),r.set(a.kind,i)}return[...K.filter(a=>r.has(a)),...Array.from(r.keys()).filter(a=>!K.includes(a)).sort()].map(a=>[a,r.get(a)])}function Ce({fileSummary:e,onSymbolClick:r}){if(!e)return t.jsx("div",{className:"flex items-center justify-center h-full text-gray-600 text-sm",children:"Select a file to view its symbols"});if(e.symbols.length===0)return t.jsxs("div",{className:"h-full overflow-y-auto scrollbar-thin",children:[t.jsx("div",{className:"px-3 py-2 border-b border-gray-800",children:t.jsx("p",{className:"text-xs text-gray-500 truncate",children:e.filePath})}),t.jsx("div",{className:"flex items-center justify-center h-32 text-gray-600 text-sm",children:"No symbols in this file"})]});const n=ve(e.symbols);return t.jsxs("div",{className:"h-full overflow-y-auto scrollbar-thin",children:[t.jsxs("div",{className:"px-3 py-2 border-b border-gray-800 shrink-0",children:[t.jsx("p",{className:"text-xs text-gray-400 truncate font-mono",children:e.filePath}),t.jsxs("p",{className:"text-[11px] text-gray-600 mt-0.5",children:[e.symbols.length," symbol",e.symbols.length!==1?"s":""]})]}),t.jsx("div",{className:"py-2",children:n.map(([a,i])=>t.jsx(je,{kind:a,symbols:i,onSymbolClick:r},a))})]})}const Ne=[{value:"complexity",label:"Complexity",title:"Colour by cyclomatic complexity (worst symbol per file)"},{value:"churn",label:"Churn",title:"Colour by commit frequency (commits per 90 days)"},{value:"combined",label:"Combined",title:"Weighted composite: 60 % complexity + 40 % churn"}],we=Array.from({length:11},(e,r)=>B(r*10)),Se=`linear-gradient(to right, ${we.join(", ")})`;function ke({mode:e,onModeChange:r}){return t.jsxs("div",{className:"px-3 py-2 border-b border-gray-800 bg-gray-900/80",children:[t.jsx("div",{className:"flex gap-1 mb-2",role:"group","aria-label":"Heatmap mode",children:Ne.map(({value:n,label:a,title:i})=>t.jsx("button",{onClick:()=>r(n),title:i,"aria-pressed":e===n,className:`flex-1 text-[10px] py-0.5 rounded transition-colors ${e===n?"bg-blue-600 text-white font-semibold":"bg-gray-800 text-gray-400 hover:bg-gray-700 hover:text-gray-200"}`,children:a},n))}),t.jsxs("div",{children:[t.jsx("div",{className:"h-2 w-full rounded-sm",style:{background:Se},"aria-hidden":"true"}),t.jsxs("div",{className:"flex justify-between text-[9px] text-gray-500 mt-0.5",children:[t.jsx("span",{children:"Low risk"}),t.jsx("span",{children:"High risk"})]})]})]})}function Le({repo:e,selectedFile:r}){const n=e.rootPath.split(/[/\\]/).pop()??e.repoId;return t.jsxs("nav",{"aria-label":"Breadcrumb",className:"flex items-center gap-1.5 text-sm text-gray-500 min-w-0",children:[t.jsx(_,{to:"/",className:"hover:text-gray-300 transition-colors shrink-0",children:"Repos"}),t.jsx("span",{"aria-hidden":"true",className:"text-gray-700",children:"/"}),t.jsx("span",{className:`truncate ${r?"hover:text-gray-300 cursor-pointer":"text-gray-300"}`,children:n}),r&&t.jsxs(t.Fragment,{children:[t.jsx("span",{"aria-hidden":"true",className:"text-gray-700 shrink-0",children:"/"}),t.jsx("span",{className:"text-gray-300 truncate text-xs font-mono",children:r})]})]})}function V({label:e,value:r}){return t.jsxs("div",{className:"flex flex-col items-center px-4 py-2 bg-gray-800/50 rounded-lg border border-gray-700/50",children:[t.jsx("span",{className:"text-xs text-gray-500",children:e}),t.jsx("span",{className:"text-lg font-bold text-gray-100 mt-0.5",children:r})]})}function Ee({repo:e}){const r=new Date(e.lastIndexed).toLocaleString();return t.jsxs("div",{className:"flex flex-wrap items-center gap-3 px-6 py-3 border-b border-gray-800 bg-gray-900/50",children:[t.jsx(V,{label:"Symbols",value:e.symbolCount.toLocaleString()}),t.jsx(V,{label:"Files",value:e.fileCount.toLocaleString()}),t.jsxs(_,{to:`/repos/${encodeURIComponent(e.repoId)}/graph`,className:"flex items-center gap-1.5 px-3 py-1.5 text-xs bg-gray-800 hover:bg-gray-700 border border-gray-700 rounded text-gray-300 transition-colors",children:[t.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none","aria-hidden":"true",children:[t.jsx("circle",{cx:"2",cy:"6",r:"1.5",fill:"currentColor"}),t.jsx("circle",{cx:"10",cy:"2",r:"1.5",fill:"currentColor"}),t.jsx("circle",{cx:"10",cy:"10",r:"1.5",fill:"currentColor"}),t.jsx("line",{x1:"3.5",y1:"5.2",x2:"8.5",y2:"2.8",stroke:"currentColor",strokeWidth:"1"}),t.jsx("line",{x1:"3.5",y1:"6.8",x2:"8.5",y2:"9.2",stroke:"currentColor",strokeWidth:"1"})]}),"Dep Graph"]}),t.jsxs("div",{className:"ml-auto text-xs text-gray-600 hidden sm:block",children:["Last indexed: ",t.jsx("span",{className:"text-gray-500",children:r})]})]})}function Ae(){return t.jsx("div",{className:"p-3 space-y-1.5 animate-pulse",children:[80,65,90,55,70,45,75].map((e,r)=>t.jsx("div",{className:"h-5 bg-gray-800 rounded",style:{width:`${e}%`}},r))})}function X({message:e}){return t.jsx("div",{className:"m-3 p-3 bg-red-950 border border-red-800 rounded text-red-300 text-sm",children:e})}function Me(){return t.jsxs("div",{className:"mx-3 mt-2 px-3 py-2 bg-yellow-950/60 border border-yellow-800/50 rounded text-yellow-300/80 text-xs",children:["Run analysis to enable heatmap.",t.jsx("br",{}),t.jsx("span",{className:"text-yellow-500/70",children:"Re-index this repo to compute quality metrics."})]})}function $e({enabled:e,loading:r,onToggle:n}){return t.jsxs("button",{onClick:n,title:e?"Disable heatmap":"Enable heatmap","aria-pressed":e,disabled:r,className:`flex items-center gap-1 px-2 py-0.5 text-[10px] rounded transition-colors ${e?"bg-orange-600/80 text-white hover:bg-orange-500":"bg-gray-800 text-gray-500 hover:bg-gray-700 hover:text-gray-300"} disabled:opacity-50 disabled:cursor-wait`,children:[t.jsx("svg",{width:"10",height:"10",viewBox:"0 0 16 16",fill:"currentColor","aria-hidden":"true",children:t.jsx("path",{d:"M8 16c3.314 0 6-2 6-5.5 0-1.5-.5-4-2.5-6 .25 1.5-1.25 2-1.25 2C11 4 9 .5 6 0c.357 2 .5 4-2 6-1.25 1-2 2.729-2 4.5C2 14 4.686 16 8 16zm0-1c-1.657 0-3-1-3-2.75 0-.75.25-2 1.25-3C6.125 10.5 7 11 7 11c-.375-1.25.5-3.25 2-3.75-.179 1-.25 2 1 3 .625.5 1 1.364 1 2.25C11 14 9.657 15 8 15z"})}),r?"Loading…":e?"Heatmap on":"Heatmap"]})}function De(){const{id:e}=ie(),r=ce(),n=u(s=>s.repos),a=u(s=>s.reposLoaded),i=u(s=>s.trees),g=u(s=>s.outlines),l=u(s=>s.selectedFilePath),o=u(s=>s.setRepos),c=u(s=>s.setTree),m=u(s=>s.setOutline),v=u(s=>s.selectRepo),w=u(s=>s.selectFile),x=f(s=>s.enabled),C=f(s=>s.mode),y=f(s=>e?s.data[e]:void 0),N=f(s=>s.loading),b=f(s=>s.error),L=f(s=>e?s.qualityAvailable[e]:null),$=f(s=>s.setEnabled),h=f(s=>s.setMode),E=f(s=>s.setData),j=f(s=>s.setLoading),S=f(s=>s.setError),O=f(s=>s.setQualityAvailable),[R,H]=p.useState(!1),[D,Q]=p.useState(null),[ee,P]=p.useState(!1),[T,W]=p.useState(null),I=n.find(s=>s.repoId===e),A=e?i[e]:void 0,M=e?g[e]:void 0;p.useEffect(()=>{a||!e||k.listRepos().then(s=>o(s.repos)).catch(()=>{})},[a,e,o]);const z=de(s=>s.setActive);p.useEffect(()=>{e&&(v(e),z(e))},[e,v,z]),p.useEffect(()=>{if(!e||A)return;let s=!1;return H(!0),Q(null),k.getFileTree(e).then(d=>{s||(c(e,d),H(!1))}).catch(d=>{s||(Q(d instanceof G?d.message:String(d)),H(!1))}),()=>{s=!0}},[e,A,c]),p.useEffect(()=>{if(!e||M)return;let s=!1;return P(!0),W(null),k.getRepoOutline(e).then(d=>{s||(m(e,d.files),P(!1))}).catch(d=>{s||(W(d instanceof G?d.message:String(d)),P(!1))}),()=>{s=!0}},[e,M,m]),p.useEffect(()=>{if(!x||!e||y)return;let s=!1;return j(!0),S(null),Promise.all([k.getQualityMetrics(e).catch(()=>null),k.getChurnMetrics(e).catch(()=>null)]).then(([d,F])=>{if(s)return;const ae=((d==null?void 0:d.symbolsAnalyzed)??0)>0;O(e,ae);const oe=xe((d==null?void 0:d.worstOffenders)??[],(F==null?void 0:F.topChurn)??[]);E(e,oe),j(!1)}).catch(d=>{s||(S(String(d)),j(!1))}),()=>{s=!0}},[x,e,y,j,S,E,O]);const te=p.useCallback(s=>{w(s)},[w]),re=p.useCallback(s=>{e&&r(`/symbols/${encodeURIComponent(s)}?repoId=${encodeURIComponent(e)}`)},[e,r]),se=p.useMemo(()=>{if(!(!x||!y))return new Map(Object.entries(y))},[x,y]),ne=!l||!M?null:M.find(s=>s.filePath===l)??{filePath:l,symbols:[]};return e?t.jsxs("div",{className:"h-full flex flex-col overflow-hidden",children:[t.jsx("div",{className:"px-6 py-3 border-b border-gray-800 shrink-0 min-w-0",children:t.jsx(Le,{repo:I??{repoId:e,rootPath:e,symbolCount:0,fileCount:0,lastIndexed:""},selectedFile:l})}),I&&t.jsx(Ee,{repo:I}),t.jsxs("div",{className:"flex-1 flex overflow-hidden",children:[t.jsxs("div",{className:"w-64 shrink-0 border-r border-gray-800 flex flex-col overflow-hidden",children:[t.jsxs("div",{className:"px-3 py-2 border-b border-gray-800 shrink-0 flex items-center gap-2",children:[t.jsx("span",{className:"text-xs font-semibold text-gray-500 uppercase tracking-wide flex-1",children:"Files"}),t.jsx($e,{enabled:x,loading:N,onToggle:()=>$(!x)})]}),x&&!N&&!b&&t.jsx(ke,{mode:C,onModeChange:s=>h(s)}),x&&!N&&L===!1&&t.jsx(Me,{}),x&&b&&t.jsx("div",{className:"mx-3 mt-2 px-3 py-2 bg-red-950/60 border border-red-800/50 rounded text-red-300/80 text-xs",children:b}),t.jsxs("div",{className:"flex-1 overflow-hidden",children:[R&&t.jsx(Ae,{}),D&&t.jsx(X,{message:D}),!R&&!D&&A&&t.jsx(fe,{tree:A.tree,repoId:e,onFileClick:te,heatScores:se,heatMode:x?C:void 0})]})]}),t.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[t.jsxs("div",{className:"px-3 py-2 border-b border-gray-800 shrink-0",children:[t.jsx("span",{className:"text-xs font-semibold text-gray-500 uppercase tracking-wide",children:"Symbols"}),ee&&t.jsx("span",{className:"ml-2 text-[10px] text-gray-600 animate-pulse",children:"loading…"})]}),t.jsxs("div",{className:"flex-1 overflow-hidden",children:[T&&t.jsx(X,{message:T}),!T&&t.jsx(Ce,{fileSummary:ne,onSymbolClick:re})]})]})]})]}):t.jsx("div",{className:"flex items-center justify-center h-full text-gray-500",children:"Invalid repository ID."})}export{De as default};
@@ -1 +1 @@
1
- import{r as n,a as p,A as h,j as e,u as g}from"./index-eK0wMkUR.js";function f({repo:t}){const o=g(),l=new Date(t.lastIndexed).toLocaleString(),i=t.rootPath.length>60?"…"+t.rootPath.slice(-57):t.rootPath;return e.jsxs("div",{role:"button",tabIndex:0,onClick:()=>o(`/repos/${encodeURIComponent(t.repoId)}`),onKeyDown:r=>{(r.key==="Enter"||r.key===" ")&&o(`/repos/${encodeURIComponent(t.repoId)}`)},className:"border border-gray-800 rounded-lg p-5 bg-gray-900 hover:border-blue-600 transition-colors cursor-pointer group","aria-label":`Open ${t.rootPath.split("/").pop()??t.repoId}`,children:[e.jsxs("div",{className:"flex items-start justify-between gap-4",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("h3",{className:"font-semibold text-gray-100 truncate group-hover:text-blue-400 transition-colors",children:t.rootPath.split(/[/\\]/).pop()??t.repoId}),e.jsx("p",{className:"text-xs text-gray-500 mt-1 truncate",title:t.rootPath,children:i})]}),e.jsx("span",{className:"text-xs font-mono text-gray-600 shrink-0 mt-0.5",children:t.repoId})]}),e.jsxs("div",{className:"flex items-center gap-6 mt-4 text-sm text-gray-400",children:[e.jsx(x,{label:"Symbols",value:t.symbolCount.toLocaleString()}),e.jsx(x,{label:"Files",value:t.fileCount.toLocaleString()}),e.jsx(x,{label:"Indexed",value:l})]})]})}function x({label:t,value:o}){return e.jsxs("div",{children:[e.jsxs("span",{className:"text-gray-600 text-xs",children:[t," "]}),e.jsx("span",{className:"font-medium text-gray-300",children:o})]})}function y(){return e.jsxs("div",{className:"flex flex-col items-center justify-center h-64 text-center text-gray-500 gap-3",children:[e.jsx("div",{className:"text-5xl opacity-30",children:"🔍"}),e.jsx("p",{className:"text-lg font-medium text-gray-400",children:"No repositories indexed"}),e.jsxs("p",{className:"text-sm max-w-xs",children:["Use ",e.jsx("code",{className:"bg-gray-800 px-1 rounded text-gray-300",children:"npx purecontext-mcp index-folder"})," to index a project."]})]})}function b(){const[t,o]=n.useState([]),[l,i]=n.useState(!0),[r,u]=n.useState(null),[c,m]=n.useState("");n.useEffect(()=>{let s=!1;return i(!0),u(null),p.listRepos().then(a=>{s||o(a.repos)}).catch(a=>{s||u(a instanceof h?a.message:String(a))}).finally(()=>{s||i(!1)}),()=>{s=!0}},[]);const d=t.filter(s=>{const a=c.toLowerCase();return s.rootPath.toLowerCase().includes(a)||s.repoId.toLowerCase().includes(a)});return e.jsx("div",{className:"h-full overflow-y-auto scrollbar-thin p-6",children:e.jsxs("div",{className:"max-w-4xl mx-auto space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between gap-4",children:[e.jsx("h1",{className:"text-xl font-bold text-gray-100",children:"Repositories"}),e.jsx("input",{type:"search",placeholder:"Filter repositories…",value:c,onChange:s=>m(s.target.value),className:"w-64 px-3 py-1.5 bg-gray-800 border border-gray-700 rounded text-sm text-gray-100 placeholder-gray-500 focus:outline-none focus:border-blue-500"})]}),l&&e.jsx("div",{className:"space-y-3",children:[0,1,2].map(s=>e.jsx("div",{className:"h-28 bg-gray-900 border border-gray-800 rounded-lg animate-pulse"},s))}),r&&e.jsx("div",{className:"p-4 bg-red-950 border border-red-800 rounded-lg text-red-300 text-sm",children:r}),!l&&!r&&d.length===0&&(t.length===0?e.jsx(y,{}):e.jsxs("p",{className:"text-gray-500 text-sm",children:["No repositories match “",c,"”."]})),!l&&!r&&d.length>0&&e.jsx("div",{className:"space-y-3",children:d.map(s=>e.jsx(f,{repo:s},s.repoId))})]})})}export{b as default};
1
+ import{r as n,a as p,A as h,j as e,u as g}from"./index-nX2chMqi.js";function f({repo:t}){const o=g(),l=new Date(t.lastIndexed).toLocaleString(),i=t.rootPath.length>60?"…"+t.rootPath.slice(-57):t.rootPath;return e.jsxs("div",{role:"button",tabIndex:0,onClick:()=>o(`/repos/${encodeURIComponent(t.repoId)}`),onKeyDown:r=>{(r.key==="Enter"||r.key===" ")&&o(`/repos/${encodeURIComponent(t.repoId)}`)},className:"border border-gray-800 rounded-lg p-5 bg-gray-900 hover:border-blue-600 transition-colors cursor-pointer group","aria-label":`Open ${t.rootPath.split("/").pop()??t.repoId}`,children:[e.jsxs("div",{className:"flex items-start justify-between gap-4",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("h3",{className:"font-semibold text-gray-100 truncate group-hover:text-blue-400 transition-colors",children:t.rootPath.split(/[/\\]/).pop()??t.repoId}),e.jsx("p",{className:"text-xs text-gray-500 mt-1 truncate",title:t.rootPath,children:i})]}),e.jsx("span",{className:"text-xs font-mono text-gray-600 shrink-0 mt-0.5",children:t.repoId})]}),e.jsxs("div",{className:"flex items-center gap-6 mt-4 text-sm text-gray-400",children:[e.jsx(x,{label:"Symbols",value:t.symbolCount.toLocaleString()}),e.jsx(x,{label:"Files",value:t.fileCount.toLocaleString()}),e.jsx(x,{label:"Indexed",value:l})]})]})}function x({label:t,value:o}){return e.jsxs("div",{children:[e.jsxs("span",{className:"text-gray-600 text-xs",children:[t," "]}),e.jsx("span",{className:"font-medium text-gray-300",children:o})]})}function y(){return e.jsxs("div",{className:"flex flex-col items-center justify-center h-64 text-center text-gray-500 gap-3",children:[e.jsx("div",{className:"text-5xl opacity-30",children:"🔍"}),e.jsx("p",{className:"text-lg font-medium text-gray-400",children:"No repositories indexed"}),e.jsxs("p",{className:"text-sm max-w-xs",children:["Use ",e.jsx("code",{className:"bg-gray-800 px-1 rounded text-gray-300",children:"npx purecontext-mcp index-folder"})," to index a project."]})]})}function b(){const[t,o]=n.useState([]),[l,i]=n.useState(!0),[r,u]=n.useState(null),[c,m]=n.useState("");n.useEffect(()=>{let s=!1;return i(!0),u(null),p.listRepos().then(a=>{s||o(a.repos)}).catch(a=>{s||u(a instanceof h?a.message:String(a))}).finally(()=>{s||i(!1)}),()=>{s=!0}},[]);const d=t.filter(s=>{const a=c.toLowerCase();return s.rootPath.toLowerCase().includes(a)||s.repoId.toLowerCase().includes(a)});return e.jsx("div",{className:"h-full overflow-y-auto scrollbar-thin p-6",children:e.jsxs("div",{className:"max-w-4xl mx-auto space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between gap-4",children:[e.jsx("h1",{className:"text-xl font-bold text-gray-100",children:"Repositories"}),e.jsx("input",{type:"search",placeholder:"Filter repositories…",value:c,onChange:s=>m(s.target.value),className:"w-64 px-3 py-1.5 bg-gray-800 border border-gray-700 rounded text-sm text-gray-100 placeholder-gray-500 focus:outline-none focus:border-blue-500"})]}),l&&e.jsx("div",{className:"space-y-3",children:[0,1,2].map(s=>e.jsx("div",{className:"h-28 bg-gray-900 border border-gray-800 rounded-lg animate-pulse"},s))}),r&&e.jsx("div",{className:"p-4 bg-red-950 border border-red-800 rounded-lg text-red-300 text-sm",children:r}),!l&&!r&&d.length===0&&(t.length===0?e.jsx(y,{}):e.jsxs("p",{className:"text-gray-500 text-sm",children:["No repositories match “",c,"”."]})),!l&&!r&&d.length>0&&e.jsx("div",{className:"space-y-3",children:d.map(s=>e.jsx(f,{repo:s},s.repoId))})]})})}export{b as default};
@@ -1 +1 @@
1
- import{j as e,u as T,f as B,r as d,b as R,e as U,a as M}from"./index-eK0wMkUR.js";import{u as _}from"./useSearch-KAl3Qyi2.js";const G=["function","class","method","const","type","interface","enum","component","composable","hook","route","decorator","middleware"];function Q({kind:t,active:s,onToggle:l}){return e.jsx("button",{type:"button",onClick:l,"aria-pressed":s,className:`px-2 py-0.5 rounded text-[11px] font-medium transition-colors border ${s?"bg-blue-600 border-blue-500 text-white":"bg-gray-800 border-gray-700 text-gray-400 hover:border-gray-500 hover:text-gray-200"}`,children:t})}const V=[{value:"tested",label:"Tested",color:"bg-green-900/60 border-green-700 text-green-400"},{value:"untested",label:"Untested",color:"bg-red-900/60 border-red-700 text-red-400"},{value:"unknown",label:"Unknown",color:"bg-gray-800 border-gray-600 text-gray-400"}];function z({filters:t,onChange:s}){const l=t.kinds.length>0||t.filePath!==""||!!t.coverageStatus;function o(a){const n=t.kinds.includes(a)?t.kinds.filter(i=>i!==a):[...t.kinds,a];s({...t,kinds:n})}function x(a){s({...t,coverageStatus:a})}function c(){s({kinds:[],filePath:"",coverageStatus:void 0})}return e.jsxs("div",{className:"flex flex-col gap-3",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-xs font-semibold text-gray-500 uppercase tracking-wide mb-2",children:"Kind"}),e.jsx("div",{className:"flex flex-wrap gap-1.5",role:"group","aria-label":"Filter by kind",children:G.map(a=>e.jsx(Q,{kind:a,active:t.kinds.includes(a),onToggle:()=>o(a)},a))})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-xs font-semibold text-gray-500 uppercase tracking-wide block mb-2",children:"File pattern"}),e.jsx("input",{type:"text",value:t.filePath,onChange:a=>s({...t,filePath:a.target.value}),placeholder:"e.g. src/**/*.ts",className:"w-full px-3 py-1.5 bg-gray-800 border border-gray-700 rounded text-sm text-gray-100 placeholder-gray-600 focus:outline-none focus:border-blue-500"})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-xs font-semibold text-gray-500 uppercase tracking-wide mb-2",children:"Coverage"}),e.jsx("div",{className:"flex flex-wrap gap-1.5",role:"group","aria-label":"Filter by coverage status",children:V.map(({value:a,label:n,color:i})=>e.jsx("button",{type:"button",onClick:()=>x(t.coverageStatus===a?void 0:a),"aria-pressed":t.coverageStatus===a,className:`px-2 py-0.5 rounded text-[11px] font-medium transition-colors border ${t.coverageStatus===a?i:"bg-gray-800 border-gray-700 text-gray-400 hover:border-gray-500 hover:text-gray-200"}`,children:n},a))}),t.coverageStatus&&e.jsx("p",{className:"text-[9px] text-gray-600 mt-1.5 leading-tight",children:"Based on symbol references — not instrumented coverage"})]}),l&&e.jsx("div",{children:e.jsx("button",{type:"button",onClick:c,className:"text-xs text-red-400 hover:text-red-300 transition-colors",children:"Clear all filters"})})]})}const H={class:"cls",interface:"int",type:"typ",enum:"enm",component:"cmp",composable:"cps",hook:"hk",function:"fn",method:"mth",const:"cst",route:"rte",middleware:"mdw",decorator:"dec"},J={class:"bg-blue-900/70 text-blue-300",interface:"bg-indigo-900/70 text-indigo-300",type:"bg-purple-900/70 text-purple-300",enum:"bg-violet-900/70 text-violet-300",component:"bg-emerald-900/70 text-emerald-300",composable:"bg-teal-900/70 text-teal-300",hook:"bg-cyan-900/70 text-cyan-300",function:"bg-yellow-900/70 text-yellow-300",method:"bg-orange-900/70 text-orange-300",const:"bg-gray-800 text-gray-400",route:"bg-rose-900/70 text-rose-300",middleware:"bg-pink-900/70 text-pink-300",decorator:"bg-amber-900/70 text-amber-300"};function F(t,s){if(!s.trim())return[{text:t,highlight:!1}];const l=s.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),o=new RegExp(`(${l})`,"gi");return t.split(o).map(c=>({text:c,highlight:o.test(c)}))}function X({result:t,query:s,focused:l,onClick:o,showRepo:x}){const c=F(t.name,s),a=t.signature?F(t.signature,s):[],n=t.repoName??t.repoId;return e.jsxs("button",{type:"button",onClick:o,"data-focused":l,className:`w-full text-left px-4 py-3 border-b border-gray-800/60 hover:bg-gray-800/50 transition-colors group ${l?"bg-gray-800/70 ring-1 ring-inset ring-blue-700/50":""}`,children:[e.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[e.jsx("span",{className:`shrink-0 text-[9px] font-bold font-mono px-1.5 py-0.5 rounded ${J[t.kind]??"bg-gray-800 text-gray-400"}`,"aria-label":t.kind,children:H[t.kind]??t.kind.slice(0,3)}),e.jsx("span",{className:"text-sm font-semibold text-gray-100 truncate group-hover:text-blue-300 transition-colors",children:c.map((i,u)=>i.highlight?e.jsx("mark",{className:"bg-yellow-500/30 text-yellow-200 rounded-sm",children:i.text},u):e.jsx("span",{children:i.text},u))}),x&&e.jsx("span",{className:"ml-auto shrink-0 text-[9px] font-medium px-1.5 py-0.5 rounded bg-indigo-900/60 text-indigo-300 border border-indigo-800/40","data-testid":"repo-name-badge",children:n})]}),t.signature&&e.jsx("p",{className:"text-[11px] text-gray-500 mt-0.5 truncate font-mono pl-8",children:a.map((i,u)=>i.highlight?e.jsx("mark",{className:"bg-yellow-500/20 text-yellow-300/80 rounded-sm",children:i.text},u):e.jsx("span",{children:i.text},u))}),e.jsx("p",{className:"text-[11px] text-gray-600 mt-0.5 truncate pl-8 font-mono",children:t.filePath})]})}function Y(){return e.jsx("div",{className:"animate-pulse",children:[85,70,90,60,75].map((t,s)=>e.jsxs("div",{className:"px-4 py-3 border-b border-gray-800/60",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"h-4 w-8 bg-gray-800 rounded"}),e.jsx("div",{className:"h-4 bg-gray-800 rounded",style:{width:`${t}%`}})]}),e.jsx("div",{className:"mt-1.5 h-3 bg-gray-800/70 rounded w-1/2 ml-10"})]},s))})}function Z({query:t}){return e.jsxs("div",{className:"flex flex-col items-center justify-center h-40 text-gray-500 gap-2",children:[e.jsx("span",{className:"text-2xl opacity-30",children:"🔍"}),e.jsxs("p",{className:"text-sm",children:["No results for “",t,"”"]})]})}function q({message:t}){return e.jsx("div",{className:"m-4 p-3 bg-red-950 border border-red-800 rounded text-red-300 text-sm",children:t})}function ee({results:t,query:s,loading:l,error:o,focusedIndex:x,onSelect:c,showRepo:a}){return l?e.jsx(Y,{}):o?e.jsx(q,{message:o}):s&&t.length===0?e.jsx(Z,{query:s}):s?e.jsx("div",{role:"listbox","aria-label":"Search results",children:t.map((n,i)=>e.jsx(X,{result:n,query:s,focused:i===x,onClick:()=>c(n),showRepo:a},n.id))}):e.jsx("div",{className:"flex items-center justify-center h-40 text-gray-600 text-sm",children:"Type to search symbols"})}function te({repos:t,selectedId:s,onSelect:l}){return t.length===0?e.jsx("p",{className:"text-xs text-gray-500 italic",children:"No indexed repositories found."}):e.jsxs("select",{value:s??"",onChange:o=>l(o.target.value),className:"px-3 py-1.5 bg-gray-800 border border-gray-700 rounded text-sm text-gray-100 focus:outline-none focus:border-blue-500","aria-label":"Select repository",children:[!s&&e.jsx("option",{value:"",children:"Select a repository…"}),t.map(o=>e.jsx("option",{value:o.repoId,children:o.rootPath.split(/[/\\]/).pop()??o.repoId},o.repoId))]})}function re({repos:t,selectedIds:s,onToggle:l}){return e.jsx("div",{className:"flex flex-wrap gap-1.5",role:"group","aria-label":"Select repositories",children:t.map(o=>{const x=o.rootPath.split(/[/\\]/).pop()??o.repoId,c=s.includes(o.repoId);return e.jsx("button",{type:"button",onClick:()=>l(o.repoId),"aria-pressed":c,"data-testid":"repo-multi-select-btn",className:`px-2.5 py-1 rounded text-xs font-medium transition-colors border ${c?"bg-blue-600 border-blue-500 text-white":"bg-gray-800 border-gray-700 text-gray-400 hover:border-gray-500 hover:text-gray-200"}`,children:x},o.repoId)})})}function ae(){const t=T(),[s]=B(),l=d.useRef(null),o=R(r=>r.repos),x=R(r=>r.reposLoaded),c=R(r=>r.setRepos),a=U(r=>r.pinnedRepos),n=a.length>1,i=s.get("repoId")??null,u=s.getAll("repoIds"),[m,I]=d.useState(i),[h,C]=d.useState(u.length>0?u:a.length>1?a:[]);d.useEffect(()=>{x||M.listRepos().then(r=>c(r.repos)).catch(()=>{})},[x,c]),d.useEffect(()=>{n||!m&&o.length>0&&I(o[0].repoId)},[o,m,n]),d.useEffect(()=>{n&&h.length===0&&C(a)},[n,a,h.length]);function P(r){C(g=>g.includes(r)?g.filter(N=>N!==r):[...g,r])}const D=n?null:m,b=n&&h.length>1?h:void 0,{query:w,setQuery:K,filters:y,setFilters:W,results:p,loading:f,error:A,clearSearch:E}=_({repoId:D,repoIds:b}),[j,v]=d.useState(-1),[S,L]=d.useState(!1);d.useEffect(()=>{v(-1)},[p]),d.useEffect(()=>{var r;(r=l.current)==null||r.focus()},[]);const O=d.useCallback(r=>{if(p.length!==0)if(r.key==="ArrowDown")r.preventDefault(),v(g=>Math.min(g+1,p.length-1));else if(r.key==="ArrowUp")r.preventDefault(),v(g=>Math.max(g-1,0));else if(r.key==="Enter"){r.preventDefault();const g=j>=0?j:0,N=p[g];N&&$(N)}else r.key==="Escape"&&(E(),v(-1))},[p,j,E]),$=d.useCallback(r=>{t(`/symbols/${encodeURIComponent(r.id)}?repoId=${encodeURIComponent(r.repoId)}`)},[t]),k=y.kinds.length+(y.filePath?1:0)+(y.coverageStatus?1:0);return e.jsxs("div",{className:"h-full flex overflow-hidden",children:[e.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[e.jsxs("div",{className:"px-6 py-4 border-b border-gray-800 shrink-0",children:[e.jsxs("div",{className:"flex items-center gap-3 max-w-3xl",children:[e.jsxs("div",{className:"relative flex-1",children:[e.jsx("span",{className:"absolute left-3 top-1/2 -translate-y-1/2 text-gray-500 pointer-events-none",children:e.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none","aria-hidden":"true",children:[e.jsx("circle",{cx:"6",cy:"6",r:"4.5",stroke:"currentColor",strokeWidth:"1.5"}),e.jsx("line",{x1:"9.5",y1:"9.5",x2:"12.5",y2:"12.5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]})}),e.jsx("input",{ref:l,type:"search",value:w,onChange:r=>K(r.target.value),onKeyDown:O,placeholder:"Search symbols…","aria-label":"Search symbols","aria-autocomplete":"list","aria-controls":"search-results",className:"w-full pl-8 pr-4 py-2 bg-gray-800 border border-gray-700 rounded-lg text-sm text-gray-100 placeholder-gray-500 focus:outline-none focus:border-blue-500"}),f&&e.jsx("span",{className:"absolute right-3 top-1/2 -translate-y-1/2",children:e.jsx("span",{className:"block w-3 h-3 rounded-full border-2 border-blue-500 border-t-transparent animate-spin"})})]}),n?e.jsx(re,{repos:o,selectedIds:h,onToggle:P}):e.jsx(te,{repos:o,selectedId:m,onSelect:I}),e.jsxs("button",{type:"button",onClick:()=>L(r=>!r),className:`flex items-center gap-1.5 px-3 py-2 rounded-lg border text-sm transition-colors ${S||k>0?"bg-blue-600/20 border-blue-600/50 text-blue-300":"bg-gray-800 border-gray-700 text-gray-400 hover:text-gray-200"}`,"aria-expanded":S,"aria-label":"Toggle filters",children:[e.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none","aria-hidden":"true",children:[e.jsx("line",{x1:"1",y1:"3",x2:"13",y2:"3",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),e.jsx("line",{x1:"3",y1:"7",x2:"11",y2:"7",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),e.jsx("line",{x1:"5",y1:"11",x2:"9",y2:"11",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]}),"Filters",k>0&&e.jsx("span",{className:"ml-0.5 bg-blue-600 text-white text-[10px] font-bold rounded-full w-4 h-4 flex items-center justify-center",children:k})]})]}),!f&&w&&p.length>0&&e.jsxs("p",{className:"text-xs text-gray-600 mt-2 max-w-3xl",children:[p.length," result",p.length!==1?"s":"",k>0&&" (filtered)"]})]}),e.jsx("div",{id:"search-results",className:"flex-1 overflow-y-auto scrollbar-thin",role:"region","aria-label":"Search results","aria-live":"polite","aria-busy":f,children:e.jsx(ee,{results:p,query:w,loading:f,error:A,focusedIndex:j,onSelect:$,showRepo:n&&((b==null?void 0:b.length)??0)>1})})]}),S&&e.jsxs("aside",{className:"w-64 shrink-0 border-l border-gray-800 flex flex-col overflow-y-auto",children:[e.jsxs("div",{className:"px-4 py-3 border-b border-gray-800 flex items-center justify-between shrink-0",children:[e.jsx("span",{className:"text-xs font-semibold text-gray-400 uppercase tracking-wide",children:"Filters"}),e.jsx("button",{type:"button",onClick:()=>L(!1),className:"text-gray-600 hover:text-gray-300 transition-colors","aria-label":"Close filters",children:e.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none","aria-hidden":"true",children:[e.jsx("line",{x1:"2",y1:"2",x2:"12",y2:"12",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),e.jsx("line",{x1:"12",y1:"2",x2:"2",y2:"12",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]})})]}),e.jsx("div",{className:"p-4",children:e.jsx(z,{filters:y,onChange:W})})]})]})}export{ae as default};
1
+ import{j as e,u as T,f as B,r as d,b as R,e as U,a as M}from"./index-nX2chMqi.js";import{u as _}from"./useSearch-BnBCRKui.js";const G=["function","class","method","const","type","interface","enum","component","composable","hook","route","decorator","middleware"];function Q({kind:t,active:s,onToggle:l}){return e.jsx("button",{type:"button",onClick:l,"aria-pressed":s,className:`px-2 py-0.5 rounded text-[11px] font-medium transition-colors border ${s?"bg-blue-600 border-blue-500 text-white":"bg-gray-800 border-gray-700 text-gray-400 hover:border-gray-500 hover:text-gray-200"}`,children:t})}const V=[{value:"tested",label:"Tested",color:"bg-green-900/60 border-green-700 text-green-400"},{value:"untested",label:"Untested",color:"bg-red-900/60 border-red-700 text-red-400"},{value:"unknown",label:"Unknown",color:"bg-gray-800 border-gray-600 text-gray-400"}];function z({filters:t,onChange:s}){const l=t.kinds.length>0||t.filePath!==""||!!t.coverageStatus;function o(a){const n=t.kinds.includes(a)?t.kinds.filter(i=>i!==a):[...t.kinds,a];s({...t,kinds:n})}function x(a){s({...t,coverageStatus:a})}function c(){s({kinds:[],filePath:"",coverageStatus:void 0})}return e.jsxs("div",{className:"flex flex-col gap-3",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-xs font-semibold text-gray-500 uppercase tracking-wide mb-2",children:"Kind"}),e.jsx("div",{className:"flex flex-wrap gap-1.5",role:"group","aria-label":"Filter by kind",children:G.map(a=>e.jsx(Q,{kind:a,active:t.kinds.includes(a),onToggle:()=>o(a)},a))})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-xs font-semibold text-gray-500 uppercase tracking-wide block mb-2",children:"File pattern"}),e.jsx("input",{type:"text",value:t.filePath,onChange:a=>s({...t,filePath:a.target.value}),placeholder:"e.g. src/**/*.ts",className:"w-full px-3 py-1.5 bg-gray-800 border border-gray-700 rounded text-sm text-gray-100 placeholder-gray-600 focus:outline-none focus:border-blue-500"})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-xs font-semibold text-gray-500 uppercase tracking-wide mb-2",children:"Coverage"}),e.jsx("div",{className:"flex flex-wrap gap-1.5",role:"group","aria-label":"Filter by coverage status",children:V.map(({value:a,label:n,color:i})=>e.jsx("button",{type:"button",onClick:()=>x(t.coverageStatus===a?void 0:a),"aria-pressed":t.coverageStatus===a,className:`px-2 py-0.5 rounded text-[11px] font-medium transition-colors border ${t.coverageStatus===a?i:"bg-gray-800 border-gray-700 text-gray-400 hover:border-gray-500 hover:text-gray-200"}`,children:n},a))}),t.coverageStatus&&e.jsx("p",{className:"text-[9px] text-gray-600 mt-1.5 leading-tight",children:"Based on symbol references — not instrumented coverage"})]}),l&&e.jsx("div",{children:e.jsx("button",{type:"button",onClick:c,className:"text-xs text-red-400 hover:text-red-300 transition-colors",children:"Clear all filters"})})]})}const H={class:"cls",interface:"int",type:"typ",enum:"enm",component:"cmp",composable:"cps",hook:"hk",function:"fn",method:"mth",const:"cst",route:"rte",middleware:"mdw",decorator:"dec"},J={class:"bg-blue-900/70 text-blue-300",interface:"bg-indigo-900/70 text-indigo-300",type:"bg-purple-900/70 text-purple-300",enum:"bg-violet-900/70 text-violet-300",component:"bg-emerald-900/70 text-emerald-300",composable:"bg-teal-900/70 text-teal-300",hook:"bg-cyan-900/70 text-cyan-300",function:"bg-yellow-900/70 text-yellow-300",method:"bg-orange-900/70 text-orange-300",const:"bg-gray-800 text-gray-400",route:"bg-rose-900/70 text-rose-300",middleware:"bg-pink-900/70 text-pink-300",decorator:"bg-amber-900/70 text-amber-300"};function F(t,s){if(!s.trim())return[{text:t,highlight:!1}];const l=s.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),o=new RegExp(`(${l})`,"gi");return t.split(o).map(c=>({text:c,highlight:o.test(c)}))}function X({result:t,query:s,focused:l,onClick:o,showRepo:x}){const c=F(t.name,s),a=t.signature?F(t.signature,s):[],n=t.repoName??t.repoId;return e.jsxs("button",{type:"button",onClick:o,"data-focused":l,className:`w-full text-left px-4 py-3 border-b border-gray-800/60 hover:bg-gray-800/50 transition-colors group ${l?"bg-gray-800/70 ring-1 ring-inset ring-blue-700/50":""}`,children:[e.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[e.jsx("span",{className:`shrink-0 text-[9px] font-bold font-mono px-1.5 py-0.5 rounded ${J[t.kind]??"bg-gray-800 text-gray-400"}`,"aria-label":t.kind,children:H[t.kind]??t.kind.slice(0,3)}),e.jsx("span",{className:"text-sm font-semibold text-gray-100 truncate group-hover:text-blue-300 transition-colors",children:c.map((i,u)=>i.highlight?e.jsx("mark",{className:"bg-yellow-500/30 text-yellow-200 rounded-sm",children:i.text},u):e.jsx("span",{children:i.text},u))}),x&&e.jsx("span",{className:"ml-auto shrink-0 text-[9px] font-medium px-1.5 py-0.5 rounded bg-indigo-900/60 text-indigo-300 border border-indigo-800/40","data-testid":"repo-name-badge",children:n})]}),t.signature&&e.jsx("p",{className:"text-[11px] text-gray-500 mt-0.5 truncate font-mono pl-8",children:a.map((i,u)=>i.highlight?e.jsx("mark",{className:"bg-yellow-500/20 text-yellow-300/80 rounded-sm",children:i.text},u):e.jsx("span",{children:i.text},u))}),e.jsx("p",{className:"text-[11px] text-gray-600 mt-0.5 truncate pl-8 font-mono",children:t.filePath})]})}function Y(){return e.jsx("div",{className:"animate-pulse",children:[85,70,90,60,75].map((t,s)=>e.jsxs("div",{className:"px-4 py-3 border-b border-gray-800/60",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"h-4 w-8 bg-gray-800 rounded"}),e.jsx("div",{className:"h-4 bg-gray-800 rounded",style:{width:`${t}%`}})]}),e.jsx("div",{className:"mt-1.5 h-3 bg-gray-800/70 rounded w-1/2 ml-10"})]},s))})}function Z({query:t}){return e.jsxs("div",{className:"flex flex-col items-center justify-center h-40 text-gray-500 gap-2",children:[e.jsx("span",{className:"text-2xl opacity-30",children:"🔍"}),e.jsxs("p",{className:"text-sm",children:["No results for “",t,"”"]})]})}function q({message:t}){return e.jsx("div",{className:"m-4 p-3 bg-red-950 border border-red-800 rounded text-red-300 text-sm",children:t})}function ee({results:t,query:s,loading:l,error:o,focusedIndex:x,onSelect:c,showRepo:a}){return l?e.jsx(Y,{}):o?e.jsx(q,{message:o}):s&&t.length===0?e.jsx(Z,{query:s}):s?e.jsx("div",{role:"listbox","aria-label":"Search results",children:t.map((n,i)=>e.jsx(X,{result:n,query:s,focused:i===x,onClick:()=>c(n),showRepo:a},n.id))}):e.jsx("div",{className:"flex items-center justify-center h-40 text-gray-600 text-sm",children:"Type to search symbols"})}function te({repos:t,selectedId:s,onSelect:l}){return t.length===0?e.jsx("p",{className:"text-xs text-gray-500 italic",children:"No indexed repositories found."}):e.jsxs("select",{value:s??"",onChange:o=>l(o.target.value),className:"px-3 py-1.5 bg-gray-800 border border-gray-700 rounded text-sm text-gray-100 focus:outline-none focus:border-blue-500","aria-label":"Select repository",children:[!s&&e.jsx("option",{value:"",children:"Select a repository…"}),t.map(o=>e.jsx("option",{value:o.repoId,children:o.rootPath.split(/[/\\]/).pop()??o.repoId},o.repoId))]})}function re({repos:t,selectedIds:s,onToggle:l}){return e.jsx("div",{className:"flex flex-wrap gap-1.5",role:"group","aria-label":"Select repositories",children:t.map(o=>{const x=o.rootPath.split(/[/\\]/).pop()??o.repoId,c=s.includes(o.repoId);return e.jsx("button",{type:"button",onClick:()=>l(o.repoId),"aria-pressed":c,"data-testid":"repo-multi-select-btn",className:`px-2.5 py-1 rounded text-xs font-medium transition-colors border ${c?"bg-blue-600 border-blue-500 text-white":"bg-gray-800 border-gray-700 text-gray-400 hover:border-gray-500 hover:text-gray-200"}`,children:x},o.repoId)})})}function ae(){const t=T(),[s]=B(),l=d.useRef(null),o=R(r=>r.repos),x=R(r=>r.reposLoaded),c=R(r=>r.setRepos),a=U(r=>r.pinnedRepos),n=a.length>1,i=s.get("repoId")??null,u=s.getAll("repoIds"),[m,I]=d.useState(i),[h,C]=d.useState(u.length>0?u:a.length>1?a:[]);d.useEffect(()=>{x||M.listRepos().then(r=>c(r.repos)).catch(()=>{})},[x,c]),d.useEffect(()=>{n||!m&&o.length>0&&I(o[0].repoId)},[o,m,n]),d.useEffect(()=>{n&&h.length===0&&C(a)},[n,a,h.length]);function P(r){C(g=>g.includes(r)?g.filter(N=>N!==r):[...g,r])}const D=n?null:m,b=n&&h.length>1?h:void 0,{query:w,setQuery:K,filters:y,setFilters:W,results:p,loading:f,error:A,clearSearch:E}=_({repoId:D,repoIds:b}),[j,v]=d.useState(-1),[S,L]=d.useState(!1);d.useEffect(()=>{v(-1)},[p]),d.useEffect(()=>{var r;(r=l.current)==null||r.focus()},[]);const O=d.useCallback(r=>{if(p.length!==0)if(r.key==="ArrowDown")r.preventDefault(),v(g=>Math.min(g+1,p.length-1));else if(r.key==="ArrowUp")r.preventDefault(),v(g=>Math.max(g-1,0));else if(r.key==="Enter"){r.preventDefault();const g=j>=0?j:0,N=p[g];N&&$(N)}else r.key==="Escape"&&(E(),v(-1))},[p,j,E]),$=d.useCallback(r=>{t(`/symbols/${encodeURIComponent(r.id)}?repoId=${encodeURIComponent(r.repoId)}`)},[t]),k=y.kinds.length+(y.filePath?1:0)+(y.coverageStatus?1:0);return e.jsxs("div",{className:"h-full flex overflow-hidden",children:[e.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[e.jsxs("div",{className:"px-6 py-4 border-b border-gray-800 shrink-0",children:[e.jsxs("div",{className:"flex items-center gap-3 max-w-3xl",children:[e.jsxs("div",{className:"relative flex-1",children:[e.jsx("span",{className:"absolute left-3 top-1/2 -translate-y-1/2 text-gray-500 pointer-events-none",children:e.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none","aria-hidden":"true",children:[e.jsx("circle",{cx:"6",cy:"6",r:"4.5",stroke:"currentColor",strokeWidth:"1.5"}),e.jsx("line",{x1:"9.5",y1:"9.5",x2:"12.5",y2:"12.5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]})}),e.jsx("input",{ref:l,type:"search",value:w,onChange:r=>K(r.target.value),onKeyDown:O,placeholder:"Search symbols…","aria-label":"Search symbols","aria-autocomplete":"list","aria-controls":"search-results",className:"w-full pl-8 pr-4 py-2 bg-gray-800 border border-gray-700 rounded-lg text-sm text-gray-100 placeholder-gray-500 focus:outline-none focus:border-blue-500"}),f&&e.jsx("span",{className:"absolute right-3 top-1/2 -translate-y-1/2",children:e.jsx("span",{className:"block w-3 h-3 rounded-full border-2 border-blue-500 border-t-transparent animate-spin"})})]}),n?e.jsx(re,{repos:o,selectedIds:h,onToggle:P}):e.jsx(te,{repos:o,selectedId:m,onSelect:I}),e.jsxs("button",{type:"button",onClick:()=>L(r=>!r),className:`flex items-center gap-1.5 px-3 py-2 rounded-lg border text-sm transition-colors ${S||k>0?"bg-blue-600/20 border-blue-600/50 text-blue-300":"bg-gray-800 border-gray-700 text-gray-400 hover:text-gray-200"}`,"aria-expanded":S,"aria-label":"Toggle filters",children:[e.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none","aria-hidden":"true",children:[e.jsx("line",{x1:"1",y1:"3",x2:"13",y2:"3",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),e.jsx("line",{x1:"3",y1:"7",x2:"11",y2:"7",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),e.jsx("line",{x1:"5",y1:"11",x2:"9",y2:"11",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]}),"Filters",k>0&&e.jsx("span",{className:"ml-0.5 bg-blue-600 text-white text-[10px] font-bold rounded-full w-4 h-4 flex items-center justify-center",children:k})]})]}),!f&&w&&p.length>0&&e.jsxs("p",{className:"text-xs text-gray-600 mt-2 max-w-3xl",children:[p.length," result",p.length!==1?"s":"",k>0&&" (filtered)"]})]}),e.jsx("div",{id:"search-results",className:"flex-1 overflow-y-auto scrollbar-thin",role:"region","aria-label":"Search results","aria-live":"polite","aria-busy":f,children:e.jsx(ee,{results:p,query:w,loading:f,error:A,focusedIndex:j,onSelect:$,showRepo:n&&((b==null?void 0:b.length)??0)>1})})]}),S&&e.jsxs("aside",{className:"w-64 shrink-0 border-l border-gray-800 flex flex-col overflow-y-auto",children:[e.jsxs("div",{className:"px-4 py-3 border-b border-gray-800 flex items-center justify-between shrink-0",children:[e.jsx("span",{className:"text-xs font-semibold text-gray-400 uppercase tracking-wide",children:"Filters"}),e.jsx("button",{type:"button",onClick:()=>L(!1),className:"text-gray-600 hover:text-gray-300 transition-colors","aria-label":"Close filters",children:e.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none","aria-hidden":"true",children:[e.jsx("line",{x1:"2",y1:"2",x2:"12",y2:"12",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),e.jsx("line",{x1:"12",y1:"2",x2:"2",y2:"12",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]})})]}),e.jsx("div",{className:"p-4",children:e.jsx(z,{filters:y,onChange:W})})]})]})}export{ae as default};