@mcp-graph-workflow/mcp-graph 5.32.0 → 5.34.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 (292) hide show
  1. package/dist/api/router.d.ts.map +1 -1
  2. package/dist/api/router.js +2 -0
  3. package/dist/api/router.js.map +1 -1
  4. package/dist/api/routes/code-graph.d.ts.map +1 -1
  5. package/dist/api/routes/code-graph.js +3 -1
  6. package/dist/api/routes/code-graph.js.map +1 -1
  7. package/dist/api/routes/davinci.d.ts +3 -0
  8. package/dist/api/routes/davinci.d.ts.map +1 -0
  9. package/dist/api/routes/davinci.js +188 -0
  10. package/dist/api/routes/davinci.js.map +1 -0
  11. package/dist/core/analyzer/ac-coverage.d.ts +16 -0
  12. package/dist/core/analyzer/ac-coverage.d.ts.map +1 -0
  13. package/dist/core/analyzer/ac-coverage.js +38 -0
  14. package/dist/core/analyzer/ac-coverage.js.map +1 -0
  15. package/dist/core/analyzer/asset-blockers.d.ts +23 -0
  16. package/dist/core/analyzer/asset-blockers.d.ts.map +1 -0
  17. package/dist/core/analyzer/asset-blockers.js +50 -0
  18. package/dist/core/analyzer/asset-blockers.js.map +1 -0
  19. package/dist/core/analyzer/concurrency-risk.d.ts +26 -0
  20. package/dist/core/analyzer/concurrency-risk.d.ts.map +1 -0
  21. package/dist/core/analyzer/concurrency-risk.js +99 -0
  22. package/dist/core/analyzer/concurrency-risk.js.map +1 -0
  23. package/dist/core/analyzer/config-coverage.d.ts +20 -0
  24. package/dist/core/analyzer/config-coverage.d.ts.map +1 -0
  25. package/dist/core/analyzer/config-coverage.js +49 -0
  26. package/dist/core/analyzer/config-coverage.js.map +1 -0
  27. package/dist/core/analyzer/contract-coverage.d.ts +22 -0
  28. package/dist/core/analyzer/contract-coverage.d.ts.map +1 -0
  29. package/dist/core/analyzer/contract-coverage.js +51 -0
  30. package/dist/core/analyzer/contract-coverage.js.map +1 -0
  31. package/dist/core/analyzer/data-integrity.d.ts +22 -0
  32. package/dist/core/analyzer/data-integrity.d.ts.map +1 -0
  33. package/dist/core/analyzer/data-integrity.js +80 -0
  34. package/dist/core/analyzer/data-integrity.js.map +1 -0
  35. package/dist/core/analyzer/economy-simulator.d.ts +33 -0
  36. package/dist/core/analyzer/economy-simulator.d.ts.map +1 -0
  37. package/dist/core/analyzer/economy-simulator.js +162 -0
  38. package/dist/core/analyzer/economy-simulator.js.map +1 -0
  39. package/dist/core/analyzer/formula-consistency.d.ts +25 -0
  40. package/dist/core/analyzer/formula-consistency.d.ts.map +1 -0
  41. package/dist/core/analyzer/formula-consistency.js +82 -0
  42. package/dist/core/analyzer/formula-consistency.js.map +1 -0
  43. package/dist/core/analyzer/metric-coverage.d.ts +22 -0
  44. package/dist/core/analyzer/metric-coverage.d.ts.map +1 -0
  45. package/dist/core/analyzer/metric-coverage.js +52 -0
  46. package/dist/core/analyzer/metric-coverage.js.map +1 -0
  47. package/dist/core/analyzer/performance-budget-check.d.ts +22 -0
  48. package/dist/core/analyzer/performance-budget-check.d.ts.map +1 -0
  49. package/dist/core/analyzer/performance-budget-check.js +40 -0
  50. package/dist/core/analyzer/performance-budget-check.js.map +1 -0
  51. package/dist/core/analyzer/risk-assessment.d.ts.map +1 -1
  52. package/dist/core/analyzer/risk-assessment.js +9 -0
  53. package/dist/core/analyzer/risk-assessment.js.map +1 -1
  54. package/dist/core/analyzer/scenario-coverage.d.ts +19 -0
  55. package/dist/core/analyzer/scenario-coverage.d.ts.map +1 -0
  56. package/dist/core/analyzer/scenario-coverage.js +59 -0
  57. package/dist/core/analyzer/scenario-coverage.js.map +1 -0
  58. package/dist/core/analyzer/state-completeness.d.ts +22 -0
  59. package/dist/core/analyzer/state-completeness.d.ts.map +1 -0
  60. package/dist/core/analyzer/state-completeness.js +76 -0
  61. package/dist/core/analyzer/state-completeness.js.map +1 -0
  62. package/dist/core/code/code-indexer.d.ts +1 -1
  63. package/dist/core/code/code-indexer.d.ts.map +1 -1
  64. package/dist/core/code/code-indexer.js +50 -3
  65. package/dist/core/code/code-indexer.js.map +1 -1
  66. package/dist/core/code/code-store.js +3 -3
  67. package/dist/core/code/code-store.js.map +1 -1
  68. package/dist/core/code/code-types.d.ts +4 -4
  69. package/dist/core/code/treesitter/treesitter-manager.d.ts.map +1 -1
  70. package/dist/core/code/treesitter/treesitter-manager.js +2 -0
  71. package/dist/core/code/treesitter/treesitter-manager.js.map +1 -1
  72. package/dist/core/davinci/build-runner.d.ts +37 -0
  73. package/dist/core/davinci/build-runner.d.ts.map +1 -0
  74. package/dist/core/davinci/build-runner.js +239 -0
  75. package/dist/core/davinci/build-runner.js.map +1 -0
  76. package/dist/core/davinci/davinci-parser.d.ts +6 -0
  77. package/dist/core/davinci/davinci-parser.d.ts.map +1 -0
  78. package/dist/core/davinci/davinci-parser.js +218 -0
  79. package/dist/core/davinci/davinci-parser.js.map +1 -0
  80. package/dist/core/davinci/davinci-store.d.ts +49 -0
  81. package/dist/core/davinci/davinci-store.d.ts.map +1 -0
  82. package/dist/core/davinci/davinci-store.js +121 -0
  83. package/dist/core/davinci/davinci-store.js.map +1 -0
  84. package/dist/core/davinci/davinci-types.d.ts +241 -0
  85. package/dist/core/davinci/davinci-types.d.ts.map +1 -0
  86. package/dist/core/davinci/davinci-types.js +123 -0
  87. package/dist/core/davinci/davinci-types.js.map +1 -0
  88. package/dist/core/davinci/davinci-validators.d.ts +16 -0
  89. package/dist/core/davinci/davinci-validators.d.ts.map +1 -0
  90. package/dist/core/davinci/davinci-validators.js +86 -0
  91. package/dist/core/davinci/davinci-validators.js.map +1 -0
  92. package/dist/core/davinci/descriptor-generator.d.ts +19 -0
  93. package/dist/core/davinci/descriptor-generator.d.ts.map +1 -0
  94. package/dist/core/davinci/descriptor-generator.js +52 -0
  95. package/dist/core/davinci/descriptor-generator.js.map +1 -0
  96. package/dist/core/davinci/plugin-generator.d.ts +29 -0
  97. package/dist/core/davinci/plugin-generator.d.ts.map +1 -0
  98. package/dist/core/davinci/plugin-generator.js +86 -0
  99. package/dist/core/davinci/plugin-generator.js.map +1 -0
  100. package/dist/core/davinci/plugin-type-detector.d.ts +15 -0
  101. package/dist/core/davinci/plugin-type-detector.d.ts.map +1 -0
  102. package/dist/core/davinci/plugin-type-detector.js +114 -0
  103. package/dist/core/davinci/plugin-type-detector.js.map +1 -0
  104. package/dist/core/davinci/pom-generator.d.ts +4 -0
  105. package/dist/core/davinci/pom-generator.d.ts.map +1 -0
  106. package/dist/core/davinci/pom-generator.js +179 -0
  107. package/dist/core/davinci/pom-generator.js.map +1 -0
  108. package/dist/core/davinci/template-registry.d.ts +25 -0
  109. package/dist/core/davinci/template-registry.d.ts.map +1 -0
  110. package/dist/core/davinci/template-registry.js +280 -0
  111. package/dist/core/davinci/template-registry.js.map +1 -0
  112. package/dist/core/davinci/variable-resolver.d.ts +9 -0
  113. package/dist/core/davinci/variable-resolver.d.ts.map +1 -0
  114. package/dist/core/davinci/variable-resolver.js +62 -0
  115. package/dist/core/davinci/variable-resolver.js.map +1 -0
  116. package/dist/core/designer/adr-validator.d.ts.map +1 -1
  117. package/dist/core/designer/adr-validator.js +12 -4
  118. package/dist/core/designer/adr-validator.js.map +1 -1
  119. package/dist/core/designer/tech-risk-assessor.d.ts +5 -1
  120. package/dist/core/designer/tech-risk-assessor.d.ts.map +1 -1
  121. package/dist/core/designer/tech-risk-assessor.js +39 -11
  122. package/dist/core/designer/tech-risk-assessor.js.map +1 -1
  123. package/dist/core/designer/traceability-matrix.d.ts.map +1 -1
  124. package/dist/core/designer/traceability-matrix.js +14 -3
  125. package/dist/core/designer/traceability-matrix.js.map +1 -1
  126. package/dist/core/graph/auto-sequence.d.ts +10 -0
  127. package/dist/core/graph/auto-sequence.d.ts.map +1 -0
  128. package/dist/core/graph/auto-sequence.js +29 -0
  129. package/dist/core/graph/auto-sequence.js.map +1 -0
  130. package/dist/core/graph/csv-export.d.ts +7 -0
  131. package/dist/core/graph/csv-export.d.ts.map +1 -0
  132. package/dist/core/graph/csv-export.js +43 -0
  133. package/dist/core/graph/csv-export.js.map +1 -0
  134. package/dist/core/graph/graph-types.d.ts +2 -2
  135. package/dist/core/graph/graph-types.d.ts.map +1 -1
  136. package/dist/core/graph/mermaid-export.d.ts +1 -1
  137. package/dist/core/graph/mermaid-export.d.ts.map +1 -1
  138. package/dist/core/graph/mermaid-export.js +101 -0
  139. package/dist/core/graph/mermaid-export.js.map +1 -1
  140. package/dist/core/importer/prd-to-graph.d.ts.map +1 -1
  141. package/dist/core/importer/prd-to-graph.js +8 -1
  142. package/dist/core/importer/prd-to-graph.js.map +1 -1
  143. package/dist/core/listener/backlog-health.d.ts.map +1 -1
  144. package/dist/core/listener/backlog-health.js +15 -3
  145. package/dist/core/listener/backlog-health.js.map +1 -1
  146. package/dist/core/parser/classify.d.ts +4 -0
  147. package/dist/core/parser/classify.d.ts.map +1 -1
  148. package/dist/core/parser/classify.js +18 -0
  149. package/dist/core/parser/classify.js.map +1 -1
  150. package/dist/core/parser/extract.d.ts.map +1 -1
  151. package/dist/core/parser/extract.js +22 -4
  152. package/dist/core/parser/extract.js.map +1 -1
  153. package/dist/core/parser/prd-diff.d.ts +23 -0
  154. package/dist/core/parser/prd-diff.d.ts.map +1 -0
  155. package/dist/core/parser/prd-diff.js +55 -0
  156. package/dist/core/parser/prd-diff.js.map +1 -0
  157. package/dist/core/parser/read-swagger.d.ts.map +1 -1
  158. package/dist/core/parser/read-swagger.js +6 -0
  159. package/dist/core/parser/read-swagger.js.map +1 -1
  160. package/dist/core/parser/segment.d.ts +5 -0
  161. package/dist/core/parser/segment.d.ts.map +1 -1
  162. package/dist/core/parser/segment.js +70 -0
  163. package/dist/core/parser/segment.js.map +1 -1
  164. package/dist/core/planner/auto-ready.d.ts +19 -0
  165. package/dist/core/planner/auto-ready.d.ts.map +1 -0
  166. package/dist/core/planner/auto-ready.js +39 -0
  167. package/dist/core/planner/auto-ready.js.map +1 -0
  168. package/dist/core/planner/planning-report.d.ts +13 -1
  169. package/dist/core/planner/planning-report.d.ts.map +1 -1
  170. package/dist/core/planner/planning-report.js +53 -2
  171. package/dist/core/planner/planning-report.js.map +1 -1
  172. package/dist/core/planner/sprint-health.d.ts +22 -0
  173. package/dist/core/planner/sprint-health.d.ts.map +1 -0
  174. package/dist/core/planner/sprint-health.js +41 -0
  175. package/dist/core/planner/sprint-health.js.map +1 -0
  176. package/dist/core/siebel/sif-parser.d.ts.map +1 -1
  177. package/dist/core/siebel/sif-parser.js +6 -0
  178. package/dist/core/siebel/sif-parser.js.map +1 -1
  179. package/dist/core/siebel/wsdl-parser.d.ts.map +1 -1
  180. package/dist/core/siebel/wsdl-parser.js +6 -0
  181. package/dist/core/siebel/wsdl-parser.js.map +1 -1
  182. package/dist/core/store/migrations.d.ts.map +1 -1
  183. package/dist/core/store/migrations.js +17 -0
  184. package/dist/core/store/migrations.js.map +1 -1
  185. package/dist/core/store/sqlite-store.d.ts +6 -0
  186. package/dist/core/store/sqlite-store.d.ts.map +1 -1
  187. package/dist/core/store/sqlite-store.js +54 -3
  188. package/dist/core/store/sqlite-store.js.map +1 -1
  189. package/dist/core/templates/template-engine.d.ts +36 -0
  190. package/dist/core/templates/template-engine.d.ts.map +1 -0
  191. package/dist/core/templates/template-engine.js +104 -0
  192. package/dist/core/templates/template-engine.js.map +1 -0
  193. package/dist/core/translation/generators/universal-generator.d.ts.map +1 -1
  194. package/dist/core/translation/generators/universal-generator.js +187 -9
  195. package/dist/core/translation/generators/universal-generator.js.map +1 -1
  196. package/dist/core/translation/language-detect.d.ts.map +1 -1
  197. package/dist/core/translation/language-detect.js +37 -14
  198. package/dist/core/translation/language-detect.js.map +1 -1
  199. package/dist/docs-manifest.json +68 -5
  200. package/dist/mcp/app-factory.js +1 -1
  201. package/dist/mcp/app-factory.js.map +1 -1
  202. package/dist/mcp/tools/analyze.d.ts.map +1 -1
  203. package/dist/mcp/tools/analyze.js +100 -1
  204. package/dist/mcp/tools/analyze.js.map +1 -1
  205. package/dist/mcp/tools/davinci-analyze.d.ts +4 -0
  206. package/dist/mcp/tools/davinci-analyze.d.ts.map +1 -0
  207. package/dist/mcp/tools/davinci-analyze.js +31 -0
  208. package/dist/mcp/tools/davinci-analyze.js.map +1 -0
  209. package/dist/mcp/tools/davinci-build.d.ts +4 -0
  210. package/dist/mcp/tools/davinci-build.d.ts.map +1 -0
  211. package/dist/mcp/tools/davinci-build.js +43 -0
  212. package/dist/mcp/tools/davinci-build.js.map +1 -0
  213. package/dist/mcp/tools/davinci-convert.d.ts +4 -0
  214. package/dist/mcp/tools/davinci-convert.d.ts.map +1 -0
  215. package/dist/mcp/tools/davinci-convert.js +61 -0
  216. package/dist/mcp/tools/davinci-convert.js.map +1 -0
  217. package/dist/mcp/tools/edge.d.ts.map +1 -1
  218. package/dist/mcp/tools/edge.js +81 -3
  219. package/dist/mcp/tools/edge.js.map +1 -1
  220. package/dist/mcp/tools/export.d.ts.map +1 -1
  221. package/dist/mcp/tools/export.js +17 -4
  222. package/dist/mcp/tools/export.js.map +1 -1
  223. package/dist/mcp/tools/import-prd.d.ts.map +1 -1
  224. package/dist/mcp/tools/import-prd.js +89 -2
  225. package/dist/mcp/tools/import-prd.js.map +1 -1
  226. package/dist/mcp/tools/index.d.ts.map +1 -1
  227. package/dist/mcp/tools/index.js +12 -0
  228. package/dist/mcp/tools/index.js.map +1 -1
  229. package/dist/mcp/tools/node.d.ts.map +1 -1
  230. package/dist/mcp/tools/node.js +127 -6
  231. package/dist/mcp/tools/node.js.map +1 -1
  232. package/dist/mcp/tools/plan-sprint.d.ts.map +1 -1
  233. package/dist/mcp/tools/plan-sprint.js +6 -2
  234. package/dist/mcp/tools/plan-sprint.js.map +1 -1
  235. package/dist/mcp/tools/show.d.ts.map +1 -1
  236. package/dist/mcp/tools/show.js +11 -4
  237. package/dist/mcp/tools/show.js.map +1 -1
  238. package/dist/mcp/tools/template.d.ts +4 -0
  239. package/dist/mcp/tools/template.d.ts.map +1 -0
  240. package/dist/mcp/tools/template.js +137 -0
  241. package/dist/mcp/tools/template.js.map +1 -0
  242. package/dist/schemas/analyzer-schema.d.ts +2 -2
  243. package/dist/schemas/designer-schema.d.ts +21 -0
  244. package/dist/schemas/designer-schema.d.ts.map +1 -1
  245. package/dist/schemas/designer-schema.js +2 -0
  246. package/dist/schemas/designer-schema.js.map +1 -1
  247. package/dist/schemas/edge.schema.d.ts +6 -0
  248. package/dist/schemas/edge.schema.d.ts.map +1 -1
  249. package/dist/schemas/edge.schema.js +2 -0
  250. package/dist/schemas/edge.schema.js.map +1 -1
  251. package/dist/schemas/graph.schema.d.ts +13 -0
  252. package/dist/schemas/graph.schema.d.ts.map +1 -1
  253. package/dist/schemas/node.schema.d.ts +20 -0
  254. package/dist/schemas/node.schema.d.ts.map +1 -1
  255. package/dist/schemas/node.schema.js +3 -0
  256. package/dist/schemas/node.schema.js.map +1 -1
  257. package/dist/schemas/siebel.schema.d.ts +13 -13
  258. package/dist/web/dashboard/dist/assets/{benchmark-tab-en-UkR66.js → benchmark-tab-Aqr2Xzu5.js} +1 -1
  259. package/dist/web/dashboard/dist/assets/{circle-alert-5GIBBP3L.js → circle-alert-BJTyaShp.js} +1 -1
  260. package/dist/web/dashboard/dist/assets/constants-DLyESMjx.js +1 -0
  261. package/dist/web/dashboard/dist/assets/{context-tab-DjfwQik8.js → context-tab-CbmHGGZh.js} +1 -1
  262. package/dist/web/dashboard/dist/assets/davinci-tab-krxsY7Pp.js +10 -0
  263. package/dist/web/dashboard/dist/assets/{docs-tab-gEBzBEEV.js → docs-tab-AautK0dL.js} +1 -1
  264. package/dist/web/dashboard/dist/assets/file-code-DVOtQrhl.js +11 -0
  265. package/dist/web/dashboard/dist/assets/{gitnexus-tab-BE2pi0xe.js → gitnexus-tab-D5xRYU3u.js} +1 -1
  266. package/dist/web/dashboard/dist/assets/{graph-section-Cwx-Bmeh.js → graph-section-D5y4S3T1.js} +1 -1
  267. package/dist/web/dashboard/dist/assets/{graph-tab-BcS75lY0.js → graph-tab-tmjyMc4q.js} +1 -1
  268. package/dist/web/dashboard/dist/assets/{graph-utils-OY_fOvB3.js → graph-utils-BlwoHdjR.js} +1 -1
  269. package/dist/web/dashboard/dist/assets/index-BcMjWikL.css +1 -0
  270. package/dist/web/dashboard/dist/assets/{index-4X4gmCkA.js → index-C13O-yj1.js} +1 -1
  271. package/dist/web/dashboard/dist/assets/{index-1aGs8JPI.js → index-CAOXRHQq.js} +1 -1
  272. package/dist/web/dashboard/dist/assets/{index-C3Kad9YO.js → index-DrvFzUJS.js} +24 -19
  273. package/dist/web/dashboard/dist/assets/{insights-tab-CP2uIpid.js → insights-tab-9sq9NfBt.js} +1 -1
  274. package/dist/web/dashboard/dist/assets/{journey-tab-ChwNK_8S.js → journey-tab-ujeAoAsS.js} +1 -1
  275. package/dist/web/dashboard/dist/assets/{languages-tab-DnBvSh4N.js → languages-tab-DT-46f7p.js} +24 -39
  276. package/dist/web/dashboard/dist/assets/{loader-circle-Bxe_TLXv.js → loader-circle-DQz_g7p_.js} +1 -1
  277. package/dist/web/dashboard/dist/assets/{logs-tab-BH86QvKe.js → logs-tab-DHj9jG6G.js} +1 -1
  278. package/dist/web/dashboard/dist/assets/{lsp-tab-DUpaQXtx.js → lsp-tab-DGIm2cTM.js} +3 -3
  279. package/dist/web/dashboard/dist/assets/{memories-tab-CkwtNv3t.js → memories-tab-DT7JcHgq.js} +1 -1
  280. package/dist/web/dashboard/dist/assets/{prd-backlog-tab-CPJanaVF.js → prd-backlog-tab-CLzQ5p_3.js} +1 -1
  281. package/dist/web/dashboard/dist/assets/{refresh-cw-DL1dUrhF.js → refresh-cw-C0EeXZ6n.js} +1 -1
  282. package/dist/web/dashboard/dist/assets/{siebel-tab-D7x34UXy.js → siebel-tab-67cdoYQ_.js} +3 -3
  283. package/dist/web/dashboard/dist/assets/{sif-parse.worker-DZrybOHz.js → sif-parse.worker-Cty_N-lP.js} +3 -3
  284. package/dist/web/dashboard/dist/assets/{skills-tab-BuqCMS29.js → skills-tab-DL8-pMo9.js} +1 -1
  285. package/dist/web/dashboard/dist/assets/{style-iy_ryTT6.js → style-DeKQIW_i.js} +1 -1
  286. package/dist/web/dashboard/dist/assets/triangle-alert-cibtv50e.js +16 -0
  287. package/dist/web/dashboard/dist/assets/upload-CZI9Zosi.js +16 -0
  288. package/dist/web/dashboard/dist/index.html +2 -2
  289. package/package.json +3 -1
  290. package/dist/web/dashboard/dist/assets/constants-Dd6A34aQ.js +0 -1
  291. package/dist/web/dashboard/dist/assets/index-BVhCKhGJ.css +0 -1
  292. package/dist/web/dashboard/dist/assets/triangle-alert-CPzksLkC.js +0 -26
@@ -1,4 +1,4 @@
1
- import{c as I,r as n,a as L,j as e,C as X}from"./index-C3Kad9YO.js";import{C as Z}from"./circle-alert-5GIBBP3L.js";import{R as z}from"./refresh-cw-DL1dUrhF.js";import{S as K,T as A,F as ee,C as me,a as ue}from"./triangle-alert-CPzksLkC.js";/**
1
+ import{c as I,r as n,a as L,j as e,C as X}from"./index-DrvFzUJS.js";import{C as Z}from"./circle-alert-BJTyaShp.js";import{R as z}from"./refresh-cw-C0EeXZ6n.js";import{S as K,T as A,C as me}from"./triangle-alert-cibtv50e.js";import{F as ee,C as ue}from"./file-code-DVOtQrhl.js";/**
2
2
  * @license lucide-react v1.7.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -33,7 +33,7 @@ import{c as I,r as n,a as L,j as e,C as X}from"./index-C3Kad9YO.js";import{C as
33
33
  *
34
34
  * This source code is licensed under the ISC license.
35
35
  * See the LICENSE file in the root directory of this source tree.
36
- */const we=[["rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2",key:"ngkwjq"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2",key:"iecqi9"}],["line",{x1:"6",x2:"6.01",y1:"6",y2:"6",key:"16zg32"}],["line",{x1:"6",x2:"6.01",y1:"18",y2:"18",key:"nzw8ys"}]],ae=I("server",we),J=300*1e3;function ke(){const t=new Map;return{get(s){const a=t.get(s);if(a){if(Date.now()-a.timestamp>J){t.delete(s);return}return a.data}},set(s,a){if(t.set(s,{data:a,timestamp:Date.now()}),t.size>200){const r=Date.now();for(const[i,h]of t)r-h.timestamp>J&&t.delete(i)}}}}function Ce(){const[t,s]=n.useState(null),[a,r]=n.useState(null),[i,h]=n.useState(!0),[y,o]=n.useState(null),[k,c]=n.useState([]),[R,$]=n.useState(null),[F,E]=n.useState(null),[M,S]=n.useState([]),[_,v]=n.useState([]),[p,g]=n.useState(null),[w,d]=n.useState(!1),f=n.useRef(ke()).current,H=n.useCallback(async()=>{try{const l=await L.getLspLanguages();s(l)}catch(l){o(l instanceof Error?l.message:"Failed to load LSP languages")}},[]),D=n.useCallback(async()=>{try{const l=await L.getLspStatus();r(l)}catch{r({ok:!0,bridgeInitialized:!1,servers:{}})}},[]),C=n.useCallback(async()=>{h(!0),o(null),await Promise.all([H(),D()]),h(!1)},[H,D]);n.useEffect(()=>{C()},[C]),n.useEffect(()=>{const l=setInterval(()=>{D()},1e4);return()=>clearInterval(l)},[D]);const ce=n.useCallback(async(l,b,j)=>{const m=`def:${l}:${b}:${j}`,u=f.get(m);if(u){c(u);return}d(!0);try{const N=(await L.lspDefinition(l,b,j)).definitions??[];f.set(m,N),c(N)}catch(x){o(x instanceof Error?x.message:"Definition lookup failed")}finally{d(!1)}},[f]),le=n.useCallback(async(l,b,j)=>{const m=`refs:${l}:${b}:${j}`,u=f.get(m);if(u){$(u);return}d(!0);try{const x=await L.lspReferences(l,b,j),N={total:x.totalReferences??0,refs:x.references??[],byFile:x.byFile??{}};f.set(m,N),$(N)}catch(x){o(x instanceof Error?x.message:"References lookup failed")}finally{d(!1)}},[f]),ie=n.useCallback(async(l,b,j)=>{const m=`hover:${l}:${b}:${j}`,u=f.get(m);if(u!==void 0){E(u);return}d(!0);try{const N=(await L.lspHover(l,b,j)).hover??null;f.set(m,N),E(N)}catch(x){o(x instanceof Error?x.message:"Hover lookup failed")}finally{d(!1)}},[f]),oe=n.useCallback(async l=>{const b=`diag:${l}`,j=f.get(b);if(j){S(j);return}d(!0);try{const u=(await L.lspDiagnostics(l)).diagnostics??[];f.set(b,u),S(u)}catch(m){o(m instanceof Error?m.message:"Diagnostics lookup failed")}finally{d(!1)}},[f]),de=n.useCallback(async l=>{const b=`sym:${l}`,j=f.get(b);if(j){v(j);return}d(!0);try{const u=(await L.lspSymbols(l)).symbols??[];f.set(b,u),v(u)}catch(m){o(m instanceof Error?m.message:"Symbols lookup failed")}finally{d(!1)}},[f]),xe=n.useCallback(async(l,b,j,m)=>{d(!0),g(null);try{const x=(await L.lspRename(l,b,j,m)).edit;x!=null&&x.changes?g(x.changes.map(N=>{var P,B,O,q,U,G,W,Y;return{file:N.file,startLine:(((B=(P=N.range)==null?void 0:P.start)==null?void 0:B.line)??0)+1,startCharacter:((q=(O=N.range)==null?void 0:O.start)==null?void 0:q.character)??0,endLine:(((G=(U=N.range)==null?void 0:U.end)==null?void 0:G.line)??0)+1,endCharacter:((Y=(W=N.range)==null?void 0:W.end)==null?void 0:Y.character)??0,newText:N.newText}})):g([])}catch(u){o(u instanceof Error?u.message:"Rename failed")}finally{d(!1)}},[]);return{languages:t,status:a,loading:i,error:y,operationLoading:w,definitions:k,references:R,hover:F,diagnostics:M,symbols:_,renameResult:p,refresh:C,goToDefinition:ce,findReferences:le,getHover:ie,getDiagnostics:oe,getSymbols:de,rename:xe}}const Se=[{id:"status",label:"Status",icon:ae},{id:"explorer",label:"Symbol Explorer",icon:K},{id:"diagnostics",label:"Diagnostics",icon:A},{id:"symbols",label:"Symbols",icon:V}],Q={1:{icon:Z,color:"text-danger",label:"Error"},2:{icon:A,color:"text-warning",label:"Warning"},3:{icon:te,color:"text-accent",label:"Info"},4:{icon:ye,color:"text-muted",label:"Hint"}};function $e({status:t}){const s={ready:{bg:"bg-success/15",text:"text-success"},starting:{bg:"bg-warning/15",text:"text-warning"},stopped:{bg:"bg-muted/15",text:"text-muted"},error:{bg:"bg-danger/15",text:"text-danger"}},a=t??"not installed",r=s[a]??{bg:"bg-muted/10",text:"text-muted",border:"border-dashed"};return e.jsxs("span",{className:`inline-flex items-center gap-1 text-[10px] font-medium px-2 py-0.5 rounded-full ${r.bg} ${r.text} ${r.border??""} border border-current/20`,children:[e.jsx(fe,{className:"w-2 h-2 fill-current"}),a]})}function Le({lang:t,serverStatus:s}){const a=Math.round(t.confidence*100);return e.jsxs("div",{className:"p-4 rounded-xl border border-edge bg-surface-alt shadow-sm hover:shadow-md transition-shadow space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ee,{className:"w-4 h-4 text-accent"}),e.jsx("span",{className:"text-sm font-semibold capitalize",children:t.languageId})]}),e.jsxs("span",{className:"text-[10px] font-medium px-2 py-0.5 rounded-full bg-accent/10 text-accent",children:[t.fileCount," files"]})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"flex items-center justify-between text-[10px] text-muted",children:[e.jsx("span",{children:"Confidence"}),e.jsxs("span",{children:[a,"%"]})]}),e.jsx("div",{className:"h-1 rounded-full bg-edge overflow-hidden",children:e.jsx("div",{className:"h-full rounded-full bg-accent transition-all duration-300",style:{width:`${a}%`}})})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-[10px] text-muted",children:"Server"}),e.jsx($e,{status:s})]}),e.jsxs("div",{className:"text-[10px] text-muted",children:["Detected via: ",e.jsx("span",{className:"text-foreground",children:t.detectedVia})]}),t.serverCommand&&e.jsxs("div",{className:"text-[10px] text-muted truncate",title:t.serverCommand,children:["Command: ",e.jsx("code",{className:"text-foreground font-mono",children:t.serverCommand})]}),t.configFile&&e.jsxs("div",{className:"text-[10px] text-muted truncate",title:t.configFile,children:["Config: ",e.jsx("code",{className:"text-foreground font-mono",children:t.configFile})]})]})}function Re({hover:t}){return e.jsxs("div",{className:"p-4 rounded-xl border border-edge bg-surface-alt space-y-2",children:[e.jsx("h4",{className:"text-xs font-semibold text-muted uppercase tracking-wider",children:"Hover Info"}),t.signature?e.jsx("pre",{className:"text-sm font-mono bg-surface p-3 rounded-lg overflow-x-auto border border-edge whitespace-pre-wrap",children:t.signature}):e.jsx("p",{className:"text-sm text-muted",children:"No signature available"}),t.documentation&&e.jsx("div",{className:"text-xs text-muted whitespace-pre-wrap",children:t.documentation}),t.language&&e.jsxs("span",{className:"text-[10px] text-muted",children:["Language: ",t.language]})]})}function ne({title:t,locations:s}){return e.jsxs("div",{className:"p-4 rounded-xl border border-edge bg-surface-alt space-y-2",children:[e.jsxs("h4",{className:"text-xs font-semibold text-muted uppercase tracking-wider",children:[t," (",s.length,")"]}),s.length===0?e.jsx("p",{className:"text-sm text-muted",children:"No results found"}):e.jsx("ul",{className:"space-y-1",children:s.map((a,r)=>e.jsxs("li",{className:"flex items-center gap-2 text-xs py-1.5 px-2 rounded-lg hover:bg-surface-elevated transition-colors",children:[e.jsx(ge,{className:"w-3 h-3 text-muted flex-shrink-0"}),e.jsx("span",{className:"font-mono text-foreground truncate",title:a.file,children:a.file}),e.jsxs("span",{className:"text-muted flex-shrink-0",children:[":",a.startLine,":",a.startCharacter]}),a.hint&&e.jsx("span",{className:"text-accent text-[10px] ml-auto truncate",children:a.hint})]},`${a.file}-${a.startLine}-${a.startCharacter}-${r}`))})]})}function Ee({references:t}){const s=Object.entries(t.byFile).sort(([,a],[,r])=>r-a);return e.jsxs("div",{className:"space-y-3",children:[e.jsx(ne,{title:"References",locations:t.refs}),s.length>0&&e.jsxs("div",{className:"p-4 rounded-xl border border-edge bg-surface-alt space-y-2",children:[e.jsxs("h4",{className:"text-xs font-semibold text-muted uppercase tracking-wider",children:["By File (",t.total," total)"]}),e.jsx("ul",{className:"space-y-1",children:s.map(([a,r])=>e.jsxs("li",{className:"flex items-center justify-between text-xs py-1 px-2 rounded-lg hover:bg-surface-elevated transition-colors",children:[e.jsx("span",{className:"font-mono truncate text-foreground",title:a,children:a}),e.jsx("span",{className:"text-muted flex-shrink-0 ml-2",children:r})]},a))})]})]})}function De({diagnostic:t}){const s=Q[t.severity]??Q[3],a=s.icon;return e.jsxs("div",{className:"flex items-start gap-3 py-2.5 px-3 rounded-lg border border-edge bg-surface-alt hover:shadow-sm transition-shadow",children:[e.jsx(a,{className:`w-4 h-4 flex-shrink-0 mt-0.5 ${s.color}`}),e.jsxs("div",{className:"flex-1 min-w-0 space-y-1",children:[e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.jsxs("span",{className:"text-xs font-mono text-muted",children:[t.file,":",t.startLine,":",t.startCharacter]}),t.source&&e.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded-full bg-surface-elevated text-muted border border-edge",children:t.source}),t.code&&e.jsxs("span",{className:"text-[10px] font-mono text-muted",children:["[",t.code,"]"]})]}),e.jsx("p",{className:"text-sm text-foreground",children:t.message})]}),e.jsx("span",{className:`text-[10px] font-medium flex-shrink-0 ${s.color}`,children:s.label})]})}const Ie={Function:"bg-accent/15 text-accent",Method:"bg-accent/15 text-accent",Class:"bg-warning/15 text-warning",Interface:"bg-success/15 text-success",Enum:"bg-danger/15 text-danger",Variable:"bg-muted/15 text-muted",Property:"bg-muted/15 text-muted",Constant:"bg-success/15 text-success",Module:"bg-warning/15 text-warning",Namespace:"bg-warning/15 text-warning"};function re({symbol:t,depth:s}){const[a,r]=n.useState(s<2),i=t.children&&t.children.length>0,h=Ie[t.kind]??"bg-muted/10 text-muted";return e.jsxs("div",{children:[e.jsxs("button",{type:"button",onClick:()=>i&&r(!a),className:`flex items-center gap-2 w-full text-left py-1.5 px-2 rounded-lg hover:bg-surface-elevated transition-colors text-xs ${i?"cursor-pointer":"cursor-default"}`,style:{paddingLeft:`${s*16+8}px`},children:[i?a?e.jsx(me,{className:"w-3 h-3 text-muted flex-shrink-0"}):e.jsx(ue,{className:"w-3 h-3 text-muted flex-shrink-0"}):e.jsx("span",{className:"w-3 flex-shrink-0"}),e.jsx("span",{className:`text-[10px] font-medium px-1.5 py-0.5 rounded ${h} flex-shrink-0`,children:t.kind}),e.jsx("span",{className:"font-mono text-foreground truncate",children:t.name}),e.jsxs("span",{className:"text-muted ml-auto flex-shrink-0",children:[t.startLine,"-",t.endLine]})]}),a&&i&&t.children.map((y,o)=>e.jsx(re,{symbol:y,depth:s+1},`${y.name}-${y.startLine}-${o}`))]})}function Fe({symbols:t}){return t.length===0?e.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-muted",children:[e.jsx(X,{className:"w-8 h-8 mb-2 opacity-40"}),e.jsx("p",{className:"text-sm",children:"No symbols found for this file"})]}):e.jsx("div",{className:"rounded-xl border border-edge bg-surface-alt overflow-hidden divide-y divide-edge",children:t.map((s,a)=>e.jsx(re,{symbol:s,depth:0},`${s.name}-${s.startLine}-${a}`))})}function Me({languages:t,status:s}){return e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center gap-2 px-4 pt-4",children:[e.jsx(ae,{className:"w-4 h-4 text-muted"}),e.jsx("span",{className:"text-xs text-muted",children:"Bridge:"}),e.jsx("span",{className:`text-xs font-medium ${s!=null&&s.bridgeInitialized?"text-success":"text-warning"}`,children:s!=null&&s.bridgeInitialized?"Initialized":"Not initialized"})]}),t.detected.length===0?e.jsxs("div",{className:"flex flex-col items-center justify-center py-16 text-muted",children:[e.jsx(ee,{className:"w-10 h-10 mb-3 opacity-40"}),e.jsx("p",{className:"text-sm",children:"No languages detected in this project"}),e.jsx("p",{className:"text-xs mt-1",children:"The LSP bridge will detect languages from project configuration files"})]}):e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4 p-4",children:t.detected.map(a=>e.jsx(Le,{lang:a,serverStatus:s==null?void 0:s.servers[a.languageId]},a.languageId))}),t.supportedLanguages.length>0&&e.jsxs("div",{className:"px-4 py-2 text-xs text-muted border-t border-edge",children:["Supported: ",t.supportedLanguages.join(", ")]})]})}function _e({edits:t}){return e.jsxs("div",{className:"p-4 rounded-xl border border-edge bg-surface-alt space-y-2",children:[e.jsxs("h4",{className:"text-xs font-semibold text-muted uppercase tracking-wider",children:["Rename Edits (",t.length,")"]}),t.length===0?e.jsx("p",{className:"text-sm text-muted",children:"No edits produced — the symbol may not support rename"}):e.jsx("ul",{className:"space-y-1",children:t.map((s,a)=>e.jsxs("li",{className:"flex items-center gap-2 text-xs py-1.5 px-2 rounded-lg hover:bg-surface-elevated transition-colors",children:[e.jsx(se,{className:"w-3 h-3 text-warning flex-shrink-0"}),e.jsx("span",{className:"font-mono text-foreground truncate",title:s.file,children:s.file}),e.jsxs("span",{className:"text-muted flex-shrink-0",children:[":",s.startLine,":",s.startCharacter]}),e.jsx("span",{className:"text-accent ml-auto text-[10px] truncate",children:s.newText})]},`${s.file}-${s.startLine}-${a}`))})]})}function ze({goToDefinition:t,findReferences:s,getHover:a,rename:r,operationLoading:i,definitions:h,references:y,hover:o,renameResult:k}){const[c,R]=n.useState(""),[$,F]=n.useState(""),[E,M]=n.useState(""),[S,_]=n.useState(""),v=parseInt($,10)||0,p=parseInt(E,10)||0,g=c.trim().length>0&&v>0,w=g&&S.trim().length>0,d=n.useCallback(()=>{g&&t(c.trim(),v,p)},[c,v,p,g,t]),T=n.useCallback(()=>{g&&s(c.trim(),v,p)},[c,v,p,g,s]),f=n.useCallback(()=>{g&&a(c.trim(),v,p)},[c,v,p,g,a]),H=n.useCallback(()=>{w&&r(c.trim(),v,p,S.trim())},[c,v,p,S,w,r]),D=o!==null||h.length>0||y!==null||k!==null;return e.jsxs("div",{className:"p-4 space-y-4",children:[e.jsxs("div",{className:"flex gap-2 flex-wrap",children:[e.jsx("input",{placeholder:"File path (e.g. src/main.ts)",value:c,onChange:C=>R(C.target.value),className:"flex-1 min-w-[200px] px-3 py-2 text-sm border border-edge rounded-lg bg-surface font-mono focus:outline-none focus:ring-1 focus:ring-accent"}),e.jsx("input",{placeholder:"Line",type:"number",min:1,value:$,onChange:C=>F(C.target.value),className:"w-20 px-3 py-2 text-sm border border-edge rounded-lg bg-surface text-center focus:outline-none focus:ring-1 focus:ring-accent"}),e.jsx("input",{placeholder:"Col",type:"number",min:0,value:E,onChange:C=>M(C.target.value),className:"w-20 px-3 py-2 text-sm border border-edge rounded-lg bg-surface text-center focus:outline-none focus:ring-1 focus:ring-accent"})]}),e.jsxs("div",{className:"flex gap-2 flex-wrap",children:[e.jsxs("button",{type:"button",onClick:d,disabled:!g||i,className:"inline-flex items-center gap-1.5 px-3 py-1.5 text-xs font-medium rounded-lg bg-accent text-white hover:bg-accent-light disabled:opacity-50 disabled:cursor-not-allowed transition-colors",children:[e.jsx(X,{className:"w-3.5 h-3.5"}),"Definition"]}),e.jsxs("button",{type:"button",onClick:T,disabled:!g||i,className:"inline-flex items-center gap-1.5 px-3 py-1.5 text-xs font-medium rounded-lg border border-edge hover:bg-surface-elevated disabled:opacity-50 disabled:cursor-not-allowed transition-colors",children:[e.jsx(K,{className:"w-3.5 h-3.5"}),"References"]}),e.jsxs("button",{type:"button",onClick:f,disabled:!g||i,className:"inline-flex items-center gap-1.5 px-3 py-1.5 text-xs font-medium rounded-lg border border-edge hover:bg-surface-elevated disabled:opacity-50 disabled:cursor-not-allowed transition-colors",children:[e.jsx(te,{className:"w-3.5 h-3.5"}),"Hover"]}),e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("input",{placeholder:"New name",value:S,onChange:C=>_(C.target.value),className:"w-32 px-2 py-1.5 text-xs border border-edge rounded-lg bg-surface font-mono focus:outline-none focus:ring-1 focus:ring-warning"}),e.jsxs("button",{type:"button",onClick:H,disabled:!w||i,className:"inline-flex items-center gap-1.5 px-3 py-1.5 text-xs font-medium rounded-lg border border-warning text-warning hover:bg-warning/10 disabled:opacity-50 disabled:cursor-not-allowed transition-colors",children:[e.jsx(se,{className:"w-3.5 h-3.5"}),"Rename"]})]})]}),i&&e.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted py-2",children:[e.jsx(z,{className:"w-3 h-3 animate-spin"}),e.jsx("span",{children:"Loading..."})]}),!i&&D&&e.jsxs("div",{className:"space-y-3",children:[o&&e.jsx(Re,{hover:o}),h.length>0&&e.jsx(ne,{title:"Definitions",locations:h}),y&&e.jsx(Ee,{references:y}),k&&e.jsx(_e,{edits:k})]}),!i&&!D&&e.jsxs("div",{className:"flex flex-col items-center justify-center py-16 text-muted",children:[e.jsx(K,{className:"w-10 h-10 mb-3 opacity-40"}),e.jsx("p",{className:"text-sm",children:"Enter a file path and position to explore symbols"}),e.jsx("p",{className:"text-xs mt-1",children:"Use Definition, References, Hover, or Rename to inspect code"})]})]})}function Te({getDiagnostics:t,operationLoading:s,diagnostics:a}){const[r,i]=n.useState(""),[h,y]=n.useState(!1),o=n.useCallback(()=>{r.trim()&&(y(!0),t(r.trim()))},[r,t]),k=n.useCallback(c=>{c.key==="Enter"&&o()},[o]);return e.jsxs("div",{className:"p-4 space-y-4",children:[e.jsxs("div",{className:"flex gap-2",children:[e.jsx("input",{placeholder:"File path (e.g. src/main.ts)",value:r,onChange:c=>i(c.target.value),onKeyDown:k,className:"flex-1 px-3 py-2 text-sm border border-edge rounded-lg bg-surface font-mono focus:outline-none focus:ring-1 focus:ring-accent"}),e.jsxs("button",{type:"button",onClick:o,disabled:!r.trim()||s,className:"inline-flex items-center gap-1.5 px-3 py-1.5 text-xs font-medium rounded-lg bg-accent text-white hover:bg-accent-light disabled:opacity-50 disabled:cursor-not-allowed transition-colors",children:[e.jsx(A,{className:"w-3.5 h-3.5"}),"Load"]})]}),s&&e.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted py-2",children:[e.jsx(z,{className:"w-3 h-3 animate-spin"}),e.jsx("span",{children:"Loading diagnostics..."})]}),!s&&a.length>0&&e.jsx("div",{className:"space-y-2",children:a.map((c,R)=>e.jsx(De,{diagnostic:c},`${c.file}-${c.startLine}-${c.startCharacter}-${R}`))}),!s&&a.length===0&&e.jsxs("div",{className:"flex flex-col items-center justify-center py-16 text-muted",children:[e.jsx(A,{className:"w-10 h-10 mb-3 opacity-40"}),h?e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"text-sm",children:"No diagnostics found for this file"}),e.jsx("p",{className:"text-xs mt-1",children:"The file may be error-free or the language server may not support diagnostics"})]}):e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"text-sm",children:"Enter a file path to load diagnostics"}),e.jsx("p",{className:"text-xs mt-1",children:"View errors, warnings, and hints from the language server"})]})]})]})}function He({getSymbols:t,operationLoading:s,symbols:a}){const[r,i]=n.useState(""),[h,y]=n.useState(!1),o=n.useCallback(()=>{r.trim()&&(y(!0),t(r.trim()))},[r,t]),k=n.useCallback(c=>{c.key==="Enter"&&o()},[o]);return e.jsxs("div",{className:"p-4 space-y-4",children:[e.jsxs("div",{className:"flex gap-2",children:[e.jsx("input",{placeholder:"File path (e.g. src/main.ts)",value:r,onChange:c=>i(c.target.value),onKeyDown:k,className:"flex-1 px-3 py-2 text-sm border border-edge rounded-lg bg-surface font-mono focus:outline-none focus:ring-1 focus:ring-accent"}),e.jsxs("button",{type:"button",onClick:o,disabled:!r.trim()||s,className:"inline-flex items-center gap-1.5 px-3 py-1.5 text-xs font-medium rounded-lg bg-accent text-white hover:bg-accent-light disabled:opacity-50 disabled:cursor-not-allowed transition-colors",children:[e.jsx(V,{className:"w-3.5 h-3.5"}),"Load"]})]}),s&&e.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted py-2",children:[e.jsx(z,{className:"w-3 h-3 animate-spin"}),e.jsx("span",{children:"Loading symbols..."})]}),!s&&h&&e.jsx(Fe,{symbols:a}),!s&&!h&&e.jsxs("div",{className:"flex flex-col items-center justify-center py-16 text-muted",children:[e.jsx(V,{className:"w-10 h-10 mb-3 opacity-40"}),e.jsx("p",{className:"text-sm",children:"Enter a file path to explore document symbols"}),e.jsx("p",{className:"text-xs mt-1",children:"View functions, classes, interfaces, and other symbols"})]})]})}function Be(){const{languages:t,status:s,loading:a,error:r,operationLoading:i,definitions:h,references:y,hover:o,diagnostics:k,symbols:c,renameResult:R,refresh:$,goToDefinition:F,findReferences:E,getHover:M,getDiagnostics:S,getSymbols:_,rename:v}=Ce(),[p,g]=n.useState("status");return r&&!t?e.jsxs("div",{className:"flex flex-col items-center justify-center h-full gap-4",children:[e.jsx(Z,{className:"w-10 h-10 text-danger"}),e.jsxs("div",{className:"text-center",children:[e.jsx("p",{className:"text-sm font-medium text-foreground",children:"Failed to load LSP data"}),e.jsx("p",{className:"text-xs text-muted mt-1",children:r})]}),e.jsxs("button",{type:"button",onClick:()=>void $(),className:"flex items-center gap-1.5 px-4 py-2 text-xs font-medium rounded-md border border-edge text-muted hover:text-foreground transition-colors cursor-pointer",children:[e.jsx(z,{className:"w-3 h-3"}),"Retry"]})]}):a||!t?e.jsxs("div",{className:"flex flex-col h-full overflow-hidden",children:[e.jsxs("div",{className:"flex items-center justify-between px-4 py-2 border-b border-edge bg-surface-alt",children:[e.jsx("div",{className:"flex items-center gap-1",children:Array.from({length:4}).map((w,d)=>e.jsx("div",{className:"h-7 w-28 rounded-lg bg-surface animate-pulse"},d))}),e.jsx("div",{className:"h-7 w-20 rounded-lg bg-surface animate-pulse"})]}),e.jsx("div",{className:"flex-1 p-4",children:e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:Array.from({length:3}).map((w,d)=>e.jsx("div",{className:"h-44 rounded-xl border border-edge bg-surface-alt animate-pulse"},d))})})]}):e.jsxs("div",{className:"flex flex-col h-full overflow-hidden",children:[e.jsxs("div",{className:"flex items-center justify-between px-4 py-2 border-b border-edge bg-surface-alt",children:[e.jsx("div",{className:"flex items-center gap-1",children:Se.map(w=>{const d=w.icon,T=p===w.id;return e.jsxs("button",{type:"button",onClick:()=>g(w.id),className:`
36
+ */const we=[["rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2",key:"ngkwjq"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2",key:"iecqi9"}],["line",{x1:"6",x2:"6.01",y1:"6",y2:"6",key:"16zg32"}],["line",{x1:"6",x2:"6.01",y1:"18",y2:"18",key:"nzw8ys"}]],ae=I("server",we),J=300*1e3;function ke(){const t=new Map;return{get(s){const a=t.get(s);if(a){if(Date.now()-a.timestamp>J){t.delete(s);return}return a.data}},set(s,a){if(t.set(s,{data:a,timestamp:Date.now()}),t.size>200){const r=Date.now();for(const[i,h]of t)r-h.timestamp>J&&t.delete(i)}}}}function Ce(){const[t,s]=n.useState(null),[a,r]=n.useState(null),[i,h]=n.useState(!0),[y,o]=n.useState(null),[k,c]=n.useState([]),[R,$]=n.useState(null),[F,E]=n.useState(null),[M,S]=n.useState([]),[_,v]=n.useState([]),[p,g]=n.useState(null),[w,d]=n.useState(!1),f=n.useRef(ke()).current,H=n.useCallback(async()=>{try{const l=await L.getLspLanguages();s(l)}catch(l){o(l instanceof Error?l.message:"Failed to load LSP languages")}},[]),D=n.useCallback(async()=>{try{const l=await L.getLspStatus();r(l)}catch{r({ok:!0,bridgeInitialized:!1,servers:{}})}},[]),C=n.useCallback(async()=>{h(!0),o(null),await Promise.all([H(),D()]),h(!1)},[H,D]);n.useEffect(()=>{C()},[C]),n.useEffect(()=>{const l=setInterval(()=>{D()},1e4);return()=>clearInterval(l)},[D]);const ce=n.useCallback(async(l,b,j)=>{const m=`def:${l}:${b}:${j}`,u=f.get(m);if(u){c(u);return}d(!0);try{const N=(await L.lspDefinition(l,b,j)).definitions??[];f.set(m,N),c(N)}catch(x){o(x instanceof Error?x.message:"Definition lookup failed")}finally{d(!1)}},[f]),le=n.useCallback(async(l,b,j)=>{const m=`refs:${l}:${b}:${j}`,u=f.get(m);if(u){$(u);return}d(!0);try{const x=await L.lspReferences(l,b,j),N={total:x.totalReferences??0,refs:x.references??[],byFile:x.byFile??{}};f.set(m,N),$(N)}catch(x){o(x instanceof Error?x.message:"References lookup failed")}finally{d(!1)}},[f]),ie=n.useCallback(async(l,b,j)=>{const m=`hover:${l}:${b}:${j}`,u=f.get(m);if(u!==void 0){E(u);return}d(!0);try{const N=(await L.lspHover(l,b,j)).hover??null;f.set(m,N),E(N)}catch(x){o(x instanceof Error?x.message:"Hover lookup failed")}finally{d(!1)}},[f]),oe=n.useCallback(async l=>{const b=`diag:${l}`,j=f.get(b);if(j){S(j);return}d(!0);try{const u=(await L.lspDiagnostics(l)).diagnostics??[];f.set(b,u),S(u)}catch(m){o(m instanceof Error?m.message:"Diagnostics lookup failed")}finally{d(!1)}},[f]),de=n.useCallback(async l=>{const b=`sym:${l}`,j=f.get(b);if(j){v(j);return}d(!0);try{const u=(await L.lspSymbols(l)).symbols??[];f.set(b,u),v(u)}catch(m){o(m instanceof Error?m.message:"Symbols lookup failed")}finally{d(!1)}},[f]),xe=n.useCallback(async(l,b,j,m)=>{d(!0),g(null);try{const x=(await L.lspRename(l,b,j,m)).edit;x!=null&&x.changes?g(x.changes.map(N=>{var P,B,O,q,U,G,W,Y;return{file:N.file,startLine:(((B=(P=N.range)==null?void 0:P.start)==null?void 0:B.line)??0)+1,startCharacter:((q=(O=N.range)==null?void 0:O.start)==null?void 0:q.character)??0,endLine:(((G=(U=N.range)==null?void 0:U.end)==null?void 0:G.line)??0)+1,endCharacter:((Y=(W=N.range)==null?void 0:W.end)==null?void 0:Y.character)??0,newText:N.newText}})):g([])}catch(u){o(u instanceof Error?u.message:"Rename failed")}finally{d(!1)}},[]);return{languages:t,status:a,loading:i,error:y,operationLoading:w,definitions:k,references:R,hover:F,diagnostics:M,symbols:_,renameResult:p,refresh:C,goToDefinition:ce,findReferences:le,getHover:ie,getDiagnostics:oe,getSymbols:de,rename:xe}}const Se=[{id:"status",label:"Status",icon:ae},{id:"explorer",label:"Symbol Explorer",icon:K},{id:"diagnostics",label:"Diagnostics",icon:A},{id:"symbols",label:"Symbols",icon:V}],Q={1:{icon:Z,color:"text-danger",label:"Error"},2:{icon:A,color:"text-warning",label:"Warning"},3:{icon:te,color:"text-accent",label:"Info"},4:{icon:ye,color:"text-muted",label:"Hint"}};function $e({status:t}){const s={ready:{bg:"bg-success/15",text:"text-success"},starting:{bg:"bg-warning/15",text:"text-warning"},stopped:{bg:"bg-muted/15",text:"text-muted"},error:{bg:"bg-danger/15",text:"text-danger"}},a=t??"not installed",r=s[a]??{bg:"bg-muted/10",text:"text-muted",border:"border-dashed"};return e.jsxs("span",{className:`inline-flex items-center gap-1 text-[10px] font-medium px-2 py-0.5 rounded-full ${r.bg} ${r.text} ${r.border??""} border border-current/20`,children:[e.jsx(fe,{className:"w-2 h-2 fill-current"}),a]})}function Le({lang:t,serverStatus:s}){const a=Math.round(t.confidence*100);return e.jsxs("div",{className:"p-4 rounded-xl border border-edge bg-surface-alt shadow-sm hover:shadow-md transition-shadow space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ee,{className:"w-4 h-4 text-accent"}),e.jsx("span",{className:"text-sm font-semibold capitalize",children:t.languageId})]}),e.jsxs("span",{className:"text-[10px] font-medium px-2 py-0.5 rounded-full bg-accent/10 text-accent",children:[t.fileCount," files"]})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"flex items-center justify-between text-[10px] text-muted",children:[e.jsx("span",{children:"Confidence"}),e.jsxs("span",{children:[a,"%"]})]}),e.jsx("div",{className:"h-1 rounded-full bg-edge overflow-hidden",children:e.jsx("div",{className:"h-full rounded-full bg-accent transition-all duration-300",style:{width:`${a}%`}})})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-[10px] text-muted",children:"Server"}),e.jsx($e,{status:s})]}),e.jsxs("div",{className:"text-[10px] text-muted",children:["Detected via: ",e.jsx("span",{className:"text-foreground",children:t.detectedVia})]}),t.serverCommand&&e.jsxs("div",{className:"text-[10px] text-muted truncate",title:t.serverCommand,children:["Command: ",e.jsx("code",{className:"text-foreground font-mono",children:t.serverCommand})]}),t.configFile&&e.jsxs("div",{className:"text-[10px] text-muted truncate",title:t.configFile,children:["Config: ",e.jsx("code",{className:"text-foreground font-mono",children:t.configFile})]})]})}function Re({hover:t}){return e.jsxs("div",{className:"p-4 rounded-xl border border-edge bg-surface-alt space-y-2",children:[e.jsx("h4",{className:"text-xs font-semibold text-muted uppercase tracking-wider",children:"Hover Info"}),t.signature?e.jsx("pre",{className:"text-sm font-mono bg-surface p-3 rounded-lg overflow-x-auto border border-edge whitespace-pre-wrap",children:t.signature}):e.jsx("p",{className:"text-sm text-muted",children:"No signature available"}),t.documentation&&e.jsx("div",{className:"text-xs text-muted whitespace-pre-wrap",children:t.documentation}),t.language&&e.jsxs("span",{className:"text-[10px] text-muted",children:["Language: ",t.language]})]})}function ne({title:t,locations:s}){return e.jsxs("div",{className:"p-4 rounded-xl border border-edge bg-surface-alt space-y-2",children:[e.jsxs("h4",{className:"text-xs font-semibold text-muted uppercase tracking-wider",children:[t," (",s.length,")"]}),s.length===0?e.jsx("p",{className:"text-sm text-muted",children:"No results found"}):e.jsx("ul",{className:"space-y-1",children:s.map((a,r)=>e.jsxs("li",{className:"flex items-center gap-2 text-xs py-1.5 px-2 rounded-lg hover:bg-surface-elevated transition-colors",children:[e.jsx(ge,{className:"w-3 h-3 text-muted flex-shrink-0"}),e.jsx("span",{className:"font-mono text-foreground truncate",title:a.file,children:a.file}),e.jsxs("span",{className:"text-muted flex-shrink-0",children:[":",a.startLine,":",a.startCharacter]}),a.hint&&e.jsx("span",{className:"text-accent text-[10px] ml-auto truncate",children:a.hint})]},`${a.file}-${a.startLine}-${a.startCharacter}-${r}`))})]})}function Ee({references:t}){const s=Object.entries(t.byFile).sort(([,a],[,r])=>r-a);return e.jsxs("div",{className:"space-y-3",children:[e.jsx(ne,{title:"References",locations:t.refs}),s.length>0&&e.jsxs("div",{className:"p-4 rounded-xl border border-edge bg-surface-alt space-y-2",children:[e.jsxs("h4",{className:"text-xs font-semibold text-muted uppercase tracking-wider",children:["By File (",t.total," total)"]}),e.jsx("ul",{className:"space-y-1",children:s.map(([a,r])=>e.jsxs("li",{className:"flex items-center justify-between text-xs py-1 px-2 rounded-lg hover:bg-surface-elevated transition-colors",children:[e.jsx("span",{className:"font-mono truncate text-foreground",title:a,children:a}),e.jsx("span",{className:"text-muted flex-shrink-0 ml-2",children:r})]},a))})]})]})}function De({diagnostic:t}){const s=Q[t.severity]??Q[3],a=s.icon;return e.jsxs("div",{className:"flex items-start gap-3 py-2.5 px-3 rounded-lg border border-edge bg-surface-alt hover:shadow-sm transition-shadow",children:[e.jsx(a,{className:`w-4 h-4 flex-shrink-0 mt-0.5 ${s.color}`}),e.jsxs("div",{className:"flex-1 min-w-0 space-y-1",children:[e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.jsxs("span",{className:"text-xs font-mono text-muted",children:[t.file,":",t.startLine,":",t.startCharacter]}),t.source&&e.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded-full bg-surface-elevated text-muted border border-edge",children:t.source}),t.code&&e.jsxs("span",{className:"text-[10px] font-mono text-muted",children:["[",t.code,"]"]})]}),e.jsx("p",{className:"text-sm text-foreground",children:t.message})]}),e.jsx("span",{className:`text-[10px] font-medium flex-shrink-0 ${s.color}`,children:s.label})]})}const Ie={Function:"bg-accent/15 text-accent",Method:"bg-accent/15 text-accent",Class:"bg-warning/15 text-warning",Interface:"bg-success/15 text-success",Enum:"bg-danger/15 text-danger",Variable:"bg-muted/15 text-muted",Property:"bg-muted/15 text-muted",Constant:"bg-success/15 text-success",Module:"bg-warning/15 text-warning",Namespace:"bg-warning/15 text-warning"};function re({symbol:t,depth:s}){const[a,r]=n.useState(s<2),i=t.children&&t.children.length>0,h=Ie[t.kind]??"bg-muted/10 text-muted";return e.jsxs("div",{children:[e.jsxs("button",{type:"button",onClick:()=>i&&r(!a),className:`flex items-center gap-2 w-full text-left py-1.5 px-2 rounded-lg hover:bg-surface-elevated transition-colors text-xs ${i?"cursor-pointer":"cursor-default"}`,style:{paddingLeft:`${s*16+8}px`},children:[i?a?e.jsx(ue,{className:"w-3 h-3 text-muted flex-shrink-0"}):e.jsx(me,{className:"w-3 h-3 text-muted flex-shrink-0"}):e.jsx("span",{className:"w-3 flex-shrink-0"}),e.jsx("span",{className:`text-[10px] font-medium px-1.5 py-0.5 rounded ${h} flex-shrink-0`,children:t.kind}),e.jsx("span",{className:"font-mono text-foreground truncate",children:t.name}),e.jsxs("span",{className:"text-muted ml-auto flex-shrink-0",children:[t.startLine,"-",t.endLine]})]}),a&&i&&t.children.map((y,o)=>e.jsx(re,{symbol:y,depth:s+1},`${y.name}-${y.startLine}-${o}`))]})}function Fe({symbols:t}){return t.length===0?e.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-muted",children:[e.jsx(X,{className:"w-8 h-8 mb-2 opacity-40"}),e.jsx("p",{className:"text-sm",children:"No symbols found for this file"})]}):e.jsx("div",{className:"rounded-xl border border-edge bg-surface-alt overflow-hidden divide-y divide-edge",children:t.map((s,a)=>e.jsx(re,{symbol:s,depth:0},`${s.name}-${s.startLine}-${a}`))})}function Me({languages:t,status:s}){return e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center gap-2 px-4 pt-4",children:[e.jsx(ae,{className:"w-4 h-4 text-muted"}),e.jsx("span",{className:"text-xs text-muted",children:"Bridge:"}),e.jsx("span",{className:`text-xs font-medium ${s!=null&&s.bridgeInitialized?"text-success":"text-warning"}`,children:s!=null&&s.bridgeInitialized?"Initialized":"Not initialized"})]}),t.detected.length===0?e.jsxs("div",{className:"flex flex-col items-center justify-center py-16 text-muted",children:[e.jsx(ee,{className:"w-10 h-10 mb-3 opacity-40"}),e.jsx("p",{className:"text-sm",children:"No languages detected in this project"}),e.jsx("p",{className:"text-xs mt-1",children:"The LSP bridge will detect languages from project configuration files"})]}):e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4 p-4",children:t.detected.map(a=>e.jsx(Le,{lang:a,serverStatus:s==null?void 0:s.servers[a.languageId]},a.languageId))}),t.supportedLanguages.length>0&&e.jsxs("div",{className:"px-4 py-2 text-xs text-muted border-t border-edge",children:["Supported: ",t.supportedLanguages.join(", ")]})]})}function _e({edits:t}){return e.jsxs("div",{className:"p-4 rounded-xl border border-edge bg-surface-alt space-y-2",children:[e.jsxs("h4",{className:"text-xs font-semibold text-muted uppercase tracking-wider",children:["Rename Edits (",t.length,")"]}),t.length===0?e.jsx("p",{className:"text-sm text-muted",children:"No edits produced — the symbol may not support rename"}):e.jsx("ul",{className:"space-y-1",children:t.map((s,a)=>e.jsxs("li",{className:"flex items-center gap-2 text-xs py-1.5 px-2 rounded-lg hover:bg-surface-elevated transition-colors",children:[e.jsx(se,{className:"w-3 h-3 text-warning flex-shrink-0"}),e.jsx("span",{className:"font-mono text-foreground truncate",title:s.file,children:s.file}),e.jsxs("span",{className:"text-muted flex-shrink-0",children:[":",s.startLine,":",s.startCharacter]}),e.jsx("span",{className:"text-accent ml-auto text-[10px] truncate",children:s.newText})]},`${s.file}-${s.startLine}-${a}`))})]})}function ze({goToDefinition:t,findReferences:s,getHover:a,rename:r,operationLoading:i,definitions:h,references:y,hover:o,renameResult:k}){const[c,R]=n.useState(""),[$,F]=n.useState(""),[E,M]=n.useState(""),[S,_]=n.useState(""),v=parseInt($,10)||0,p=parseInt(E,10)||0,g=c.trim().length>0&&v>0,w=g&&S.trim().length>0,d=n.useCallback(()=>{g&&t(c.trim(),v,p)},[c,v,p,g,t]),T=n.useCallback(()=>{g&&s(c.trim(),v,p)},[c,v,p,g,s]),f=n.useCallback(()=>{g&&a(c.trim(),v,p)},[c,v,p,g,a]),H=n.useCallback(()=>{w&&r(c.trim(),v,p,S.trim())},[c,v,p,S,w,r]),D=o!==null||h.length>0||y!==null||k!==null;return e.jsxs("div",{className:"p-4 space-y-4",children:[e.jsxs("div",{className:"flex gap-2 flex-wrap",children:[e.jsx("input",{placeholder:"File path (e.g. src/main.ts)",value:c,onChange:C=>R(C.target.value),className:"flex-1 min-w-[200px] px-3 py-2 text-sm border border-edge rounded-lg bg-surface font-mono focus:outline-none focus:ring-1 focus:ring-accent"}),e.jsx("input",{placeholder:"Line",type:"number",min:1,value:$,onChange:C=>F(C.target.value),className:"w-20 px-3 py-2 text-sm border border-edge rounded-lg bg-surface text-center focus:outline-none focus:ring-1 focus:ring-accent"}),e.jsx("input",{placeholder:"Col",type:"number",min:0,value:E,onChange:C=>M(C.target.value),className:"w-20 px-3 py-2 text-sm border border-edge rounded-lg bg-surface text-center focus:outline-none focus:ring-1 focus:ring-accent"})]}),e.jsxs("div",{className:"flex gap-2 flex-wrap",children:[e.jsxs("button",{type:"button",onClick:d,disabled:!g||i,className:"inline-flex items-center gap-1.5 px-3 py-1.5 text-xs font-medium rounded-lg bg-accent text-white hover:bg-accent-light disabled:opacity-50 disabled:cursor-not-allowed transition-colors",children:[e.jsx(X,{className:"w-3.5 h-3.5"}),"Definition"]}),e.jsxs("button",{type:"button",onClick:T,disabled:!g||i,className:"inline-flex items-center gap-1.5 px-3 py-1.5 text-xs font-medium rounded-lg border border-edge hover:bg-surface-elevated disabled:opacity-50 disabled:cursor-not-allowed transition-colors",children:[e.jsx(K,{className:"w-3.5 h-3.5"}),"References"]}),e.jsxs("button",{type:"button",onClick:f,disabled:!g||i,className:"inline-flex items-center gap-1.5 px-3 py-1.5 text-xs font-medium rounded-lg border border-edge hover:bg-surface-elevated disabled:opacity-50 disabled:cursor-not-allowed transition-colors",children:[e.jsx(te,{className:"w-3.5 h-3.5"}),"Hover"]}),e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("input",{placeholder:"New name",value:S,onChange:C=>_(C.target.value),className:"w-32 px-2 py-1.5 text-xs border border-edge rounded-lg bg-surface font-mono focus:outline-none focus:ring-1 focus:ring-warning"}),e.jsxs("button",{type:"button",onClick:H,disabled:!w||i,className:"inline-flex items-center gap-1.5 px-3 py-1.5 text-xs font-medium rounded-lg border border-warning text-warning hover:bg-warning/10 disabled:opacity-50 disabled:cursor-not-allowed transition-colors",children:[e.jsx(se,{className:"w-3.5 h-3.5"}),"Rename"]})]})]}),i&&e.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted py-2",children:[e.jsx(z,{className:"w-3 h-3 animate-spin"}),e.jsx("span",{children:"Loading..."})]}),!i&&D&&e.jsxs("div",{className:"space-y-3",children:[o&&e.jsx(Re,{hover:o}),h.length>0&&e.jsx(ne,{title:"Definitions",locations:h}),y&&e.jsx(Ee,{references:y}),k&&e.jsx(_e,{edits:k})]}),!i&&!D&&e.jsxs("div",{className:"flex flex-col items-center justify-center py-16 text-muted",children:[e.jsx(K,{className:"w-10 h-10 mb-3 opacity-40"}),e.jsx("p",{className:"text-sm",children:"Enter a file path and position to explore symbols"}),e.jsx("p",{className:"text-xs mt-1",children:"Use Definition, References, Hover, or Rename to inspect code"})]})]})}function Te({getDiagnostics:t,operationLoading:s,diagnostics:a}){const[r,i]=n.useState(""),[h,y]=n.useState(!1),o=n.useCallback(()=>{r.trim()&&(y(!0),t(r.trim()))},[r,t]),k=n.useCallback(c=>{c.key==="Enter"&&o()},[o]);return e.jsxs("div",{className:"p-4 space-y-4",children:[e.jsxs("div",{className:"flex gap-2",children:[e.jsx("input",{placeholder:"File path (e.g. src/main.ts)",value:r,onChange:c=>i(c.target.value),onKeyDown:k,className:"flex-1 px-3 py-2 text-sm border border-edge rounded-lg bg-surface font-mono focus:outline-none focus:ring-1 focus:ring-accent"}),e.jsxs("button",{type:"button",onClick:o,disabled:!r.trim()||s,className:"inline-flex items-center gap-1.5 px-3 py-1.5 text-xs font-medium rounded-lg bg-accent text-white hover:bg-accent-light disabled:opacity-50 disabled:cursor-not-allowed transition-colors",children:[e.jsx(A,{className:"w-3.5 h-3.5"}),"Load"]})]}),s&&e.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted py-2",children:[e.jsx(z,{className:"w-3 h-3 animate-spin"}),e.jsx("span",{children:"Loading diagnostics..."})]}),!s&&a.length>0&&e.jsx("div",{className:"space-y-2",children:a.map((c,R)=>e.jsx(De,{diagnostic:c},`${c.file}-${c.startLine}-${c.startCharacter}-${R}`))}),!s&&a.length===0&&e.jsxs("div",{className:"flex flex-col items-center justify-center py-16 text-muted",children:[e.jsx(A,{className:"w-10 h-10 mb-3 opacity-40"}),h?e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"text-sm",children:"No diagnostics found for this file"}),e.jsx("p",{className:"text-xs mt-1",children:"The file may be error-free or the language server may not support diagnostics"})]}):e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"text-sm",children:"Enter a file path to load diagnostics"}),e.jsx("p",{className:"text-xs mt-1",children:"View errors, warnings, and hints from the language server"})]})]})]})}function He({getSymbols:t,operationLoading:s,symbols:a}){const[r,i]=n.useState(""),[h,y]=n.useState(!1),o=n.useCallback(()=>{r.trim()&&(y(!0),t(r.trim()))},[r,t]),k=n.useCallback(c=>{c.key==="Enter"&&o()},[o]);return e.jsxs("div",{className:"p-4 space-y-4",children:[e.jsxs("div",{className:"flex gap-2",children:[e.jsx("input",{placeholder:"File path (e.g. src/main.ts)",value:r,onChange:c=>i(c.target.value),onKeyDown:k,className:"flex-1 px-3 py-2 text-sm border border-edge rounded-lg bg-surface font-mono focus:outline-none focus:ring-1 focus:ring-accent"}),e.jsxs("button",{type:"button",onClick:o,disabled:!r.trim()||s,className:"inline-flex items-center gap-1.5 px-3 py-1.5 text-xs font-medium rounded-lg bg-accent text-white hover:bg-accent-light disabled:opacity-50 disabled:cursor-not-allowed transition-colors",children:[e.jsx(V,{className:"w-3.5 h-3.5"}),"Load"]})]}),s&&e.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted py-2",children:[e.jsx(z,{className:"w-3 h-3 animate-spin"}),e.jsx("span",{children:"Loading symbols..."})]}),!s&&h&&e.jsx(Fe,{symbols:a}),!s&&!h&&e.jsxs("div",{className:"flex flex-col items-center justify-center py-16 text-muted",children:[e.jsx(V,{className:"w-10 h-10 mb-3 opacity-40"}),e.jsx("p",{className:"text-sm",children:"Enter a file path to explore document symbols"}),e.jsx("p",{className:"text-xs mt-1",children:"View functions, classes, interfaces, and other symbols"})]})]})}function Oe(){const{languages:t,status:s,loading:a,error:r,operationLoading:i,definitions:h,references:y,hover:o,diagnostics:k,symbols:c,renameResult:R,refresh:$,goToDefinition:F,findReferences:E,getHover:M,getDiagnostics:S,getSymbols:_,rename:v}=Ce(),[p,g]=n.useState("status");return r&&!t?e.jsxs("div",{className:"flex flex-col items-center justify-center h-full gap-4",children:[e.jsx(Z,{className:"w-10 h-10 text-danger"}),e.jsxs("div",{className:"text-center",children:[e.jsx("p",{className:"text-sm font-medium text-foreground",children:"Failed to load LSP data"}),e.jsx("p",{className:"text-xs text-muted mt-1",children:r})]}),e.jsxs("button",{type:"button",onClick:()=>void $(),className:"flex items-center gap-1.5 px-4 py-2 text-xs font-medium rounded-md border border-edge text-muted hover:text-foreground transition-colors cursor-pointer",children:[e.jsx(z,{className:"w-3 h-3"}),"Retry"]})]}):a||!t?e.jsxs("div",{className:"flex flex-col h-full overflow-hidden",children:[e.jsxs("div",{className:"flex items-center justify-between px-4 py-2 border-b border-edge bg-surface-alt",children:[e.jsx("div",{className:"flex items-center gap-1",children:Array.from({length:4}).map((w,d)=>e.jsx("div",{className:"h-7 w-28 rounded-lg bg-surface animate-pulse"},d))}),e.jsx("div",{className:"h-7 w-20 rounded-lg bg-surface animate-pulse"})]}),e.jsx("div",{className:"flex-1 p-4",children:e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:Array.from({length:3}).map((w,d)=>e.jsx("div",{className:"h-44 rounded-xl border border-edge bg-surface-alt animate-pulse"},d))})})]}):e.jsxs("div",{className:"flex flex-col h-full overflow-hidden",children:[e.jsxs("div",{className:"flex items-center justify-between px-4 py-2 border-b border-edge bg-surface-alt",children:[e.jsx("div",{className:"flex items-center gap-1",children:Se.map(w=>{const d=w.icon,T=p===w.id;return e.jsxs("button",{type:"button",onClick:()=>g(w.id),className:`
37
37
  inline-flex items-center gap-1.5 px-3 py-1.5 text-xs font-medium rounded-lg transition-colors
38
38
  ${T?"bg-accent/10 text-accent":"text-muted hover:bg-surface-elevated hover:text-foreground"}
39
- `,children:[e.jsx(d,{className:"w-3.5 h-3.5"}),w.label]},w.id)})}),e.jsxs("button",{type:"button",onClick:()=>void $(),className:"inline-flex items-center gap-1.5 px-2.5 py-1.5 text-xs rounded-lg border border-edge hover:bg-surface-elevated transition-colors",title:"Refresh LSP data",children:[e.jsx(z,{className:`w-3 h-3 ${a?"animate-spin":""}`}),e.jsx("span",{className:"hidden sm:inline",children:"Refresh"})]})]}),r&&e.jsx("div",{className:"px-4 py-2 text-xs text-danger bg-danger/5 border-b border-danger/20",children:r}),e.jsxs("div",{className:"flex-1 overflow-y-auto",children:[p==="status"&&e.jsx(Me,{languages:t,status:s}),p==="explorer"&&e.jsx(ze,{goToDefinition:F,findReferences:E,getHover:M,rename:v,operationLoading:i,definitions:h,references:y,hover:o,renameResult:R}),p==="diagnostics"&&e.jsx(Te,{getDiagnostics:S,operationLoading:i,diagnostics:k}),p==="symbols"&&e.jsx(He,{getSymbols:_,operationLoading:i,symbols:c})]})]})}export{Be as LspTab};
39
+ `,children:[e.jsx(d,{className:"w-3.5 h-3.5"}),w.label]},w.id)})}),e.jsxs("button",{type:"button",onClick:()=>void $(),className:"inline-flex items-center gap-1.5 px-2.5 py-1.5 text-xs rounded-lg border border-edge hover:bg-surface-elevated transition-colors",title:"Refresh LSP data",children:[e.jsx(z,{className:`w-3 h-3 ${a?"animate-spin":""}`}),e.jsx("span",{className:"hidden sm:inline",children:"Refresh"})]})]}),r&&e.jsx("div",{className:"px-4 py-2 text-xs text-danger bg-danger/5 border-b border-danger/20",children:r}),e.jsxs("div",{className:"flex-1 overflow-y-auto",children:[p==="status"&&e.jsx(Me,{languages:t,status:s}),p==="explorer"&&e.jsx(ze,{goToDefinition:F,findReferences:E,getHover:M,rename:v,operationLoading:i,definitions:h,references:y,hover:o,renameResult:R}),p==="diagnostics"&&e.jsx(Te,{getDiagnostics:S,operationLoading:i,diagnostics:k}),p==="symbols"&&e.jsx(He,{getSymbols:_,operationLoading:i,symbols:c})]})]})}export{Oe as LspTab};
@@ -1 +1 @@
1
- import{r as t,a as b,j as e}from"./index-C3Kad9YO.js";function z(l){const m=[];for(const r of l){const i=r.name.split("/");let o=m;for(let x=0;x<i.length;x++){const n=i[x],d=i.slice(0,x+1).join("/"),a=x===i.length-1;let c=o.find(h=>h.name===n);c||(c={name:n,path:d,children:[]},a&&(c.memory=r),o.push(c)),a&&!c.memory&&(c.memory=r),o=c.children}}return m}function C(){const[l,m]=t.useState([]),[r,i]=t.useState(null),[o,x]=t.useState(""),[n,d]=t.useState(null),[a,c]=t.useState(!0),[h,g]=t.useState(null),p=t.useCallback(async()=>{try{c(!0);const[s,N]=await Promise.all([b.knowledgeList(50),b.knowledgeGetStats()]);m(s.documents),i(N)}catch(s){g(s instanceof Error?s.message:"Failed to load")}finally{c(!1)}},[]);t.useEffect(()=>{p()},[p]);const j=t.useCallback(async()=>{if(!o.trim()){d(null);return}try{const s=await b.knowledgeSearch(o,20);d(s.results)}catch{d([])}},[o]),u=t.useCallback(async s=>{if(confirm("Delete this knowledge document?"))try{await b.knowledgeDelete(s),await p()}catch{}},[p]),f=n??l;return a?e.jsx("div",{className:"text-zinc-400 p-4",children:"Loading knowledge store..."}):h?e.jsxs("div",{className:"text-red-400 p-4",children:["Error: ",h]}):e.jsxs("div",{className:"space-y-4",children:[r&&e.jsxs("div",{className:"flex gap-3 flex-wrap",children:[e.jsxs("div",{className:"bg-zinc-800 rounded-lg px-4 py-2 border border-zinc-700",children:[e.jsx("span",{className:"text-lg font-bold text-zinc-100",children:r.total}),e.jsx("span",{className:"text-xs text-zinc-500 ml-2",children:"total docs"})]}),Object.entries(r.bySource).map(([s,N])=>e.jsxs("div",{className:"bg-zinc-800 rounded-lg px-3 py-2 border border-zinc-700",children:[e.jsx("span",{className:"text-sm font-medium text-zinc-200",children:N}),e.jsx("span",{className:"text-xs text-zinc-500 ml-1",children:s})]},s))]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("input",{type:"text",placeholder:"Search knowledge store...",value:o,onChange:s=>x(s.target.value),onKeyDown:s=>s.key==="Enter"&&j(),className:"flex-1 px-3 py-2 bg-zinc-800 border border-zinc-600 rounded-md text-zinc-200 placeholder-zinc-500 focus:outline-none focus:ring-1 focus:ring-blue-500"}),e.jsx("button",{onClick:j,className:"px-4 py-2 bg-blue-600 text-white rounded-md hover:bg-blue-500 text-sm",children:"Search"}),n&&e.jsx("button",{onClick:()=>{d(null),x("")},className:"px-3 py-2 bg-zinc-700 text-zinc-300 rounded-md hover:bg-zinc-600 text-sm",children:"Clear"})]}),e.jsxs("div",{className:"text-xs text-zinc-500",children:[f.length," documents",n?" (search results)":""]}),e.jsxs("div",{className:"space-y-1",children:[f.map(s=>e.jsxs("div",{className:"flex items-center justify-between p-3 rounded-md hover:bg-zinc-800/50 group",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"text-sm text-zinc-200 truncate",children:s.title}),e.jsxs("div",{className:"text-xs text-zinc-500",children:[s.sourceType,s.createdAt?` - ${new Date(s.createdAt).toLocaleDateString()}`:""]})]}),e.jsx("button",{onClick:()=>u(s.id),className:"text-xs text-red-400 opacity-0 group-hover:opacity-100 transition-opacity px-2 py-1 rounded hover:bg-red-900/30",children:"Delete"})]},s.id)),f.length===0&&e.jsx("div",{className:"text-zinc-500 text-sm p-4 text-center",children:"No documents found"})]})]})}function E(){const[l,m]=t.useState(!1),[r,i]=t.useState(!1),[o,x]=t.useState(null),[n,d]=t.useState(null),[a,c]=t.useState(null),[h,g]=t.useState(null),p=t.useCallback(async()=>{try{m(!0),g(null);const s=await b.knowledgeExport(),N=new Blob([JSON.stringify(s.package,null,2)],{type:"application/json"}),v=URL.createObjectURL(N),y=document.createElement("a");y.href=v,y.download=`knowledge-export-${new Date().toISOString().slice(0,10)}.json`,y.click(),URL.revokeObjectURL(v)}catch(s){g(s instanceof Error?s.message:"Export failed")}finally{m(!1)}},[]),j=t.useCallback(async s=>{var v;const N=(v=s.target.files)==null?void 0:v[0];if(N)try{g(null),d(null);const y=await N.text(),w=JSON.parse(y);c(w);const S=await b.knowledgePreview(w);x(S.preview)}catch(y){g(y instanceof Error?y.message:"Invalid package file"),c(null),x(null)}},[]),u=t.useCallback(async()=>{if(a)try{i(!0),g(null);const s=await b.knowledgeImport(a);d(s.result),x(null),c(null)}catch(s){g(s instanceof Error?s.message:"Import failed")}finally{i(!1)}},[a]),f=t.useCallback(()=>{c(null),x(null),d(null)},[]);return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"bg-zinc-800 rounded-lg p-4 border border-zinc-700",children:[e.jsx("h3",{className:"text-sm font-semibold text-zinc-200 mb-2",children:"Export Knowledge Package"}),e.jsx("p",{className:"text-xs text-zinc-400 mb-3",children:"Download all knowledge documents, memories, and relations as a portable JSON package."}),e.jsx("button",{onClick:p,disabled:l,className:"px-4 py-2 bg-blue-600 text-white rounded-md hover:bg-blue-500 text-sm disabled:opacity-50",children:l?"Exporting...":"Export Package"})]}),e.jsxs("div",{className:"bg-zinc-800 rounded-lg p-4 border border-zinc-700",children:[e.jsx("h3",{className:"text-sm font-semibold text-zinc-200 mb-2",children:"Import Knowledge Package"}),e.jsx("p",{className:"text-xs text-zinc-400 mb-3",children:"Upload a knowledge package JSON to import documents and memories."}),e.jsx("input",{type:"file",accept:".json",onChange:j,className:"block w-full text-sm text-zinc-400 file:mr-4 file:py-2 file:px-4 file:rounded-md file:border-0 file:text-sm file:bg-zinc-700 file:text-zinc-200 hover:file:bg-zinc-600"}),o&&e.jsxs("div",{className:"mt-4 p-3 bg-zinc-900 rounded-md border border-zinc-600",children:[e.jsx("h4",{className:"text-xs font-semibold text-zinc-300 mb-2",children:"Import Preview"}),e.jsxs("div",{className:"grid grid-cols-2 gap-2 text-xs",children:[e.jsxs("div",{children:[e.jsx("span",{className:"text-green-400",children:o.newDocuments})," new documents"]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-yellow-400",children:o.existingDocuments})," existing (skip)"]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-green-400",children:o.newMemories})," new memories"]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-yellow-400",children:o.existingMemories})," existing (skip)"]})]}),e.jsxs("div",{className:"text-xs text-zinc-500 mt-2",children:["Sources: ",o.sourceTypes.join(", ")]}),e.jsxs("div",{className:"flex gap-2 mt-3",children:[e.jsx("button",{onClick:u,disabled:r,className:"px-3 py-1.5 bg-green-600 text-white rounded-md hover:bg-green-500 text-xs disabled:opacity-50",children:r?"Importing...":"Confirm Import"}),e.jsx("button",{onClick:f,className:"px-3 py-1.5 bg-zinc-700 text-zinc-300 rounded-md hover:bg-zinc-600 text-xs",children:"Cancel"})]})]}),n&&e.jsxs("div",{className:"mt-4 p-3 bg-green-900/20 rounded-md border border-green-700/50",children:[e.jsx("h4",{className:"text-xs font-semibold text-green-400 mb-1",children:"Import Complete"}),e.jsxs("div",{className:"text-xs text-zinc-300",children:[n.documentsImported," docs imported, ",n.documentsSkipped," skipped, ",n.memoriesImported," memories imported"]})]})]}),h&&e.jsx("div",{className:"text-red-400 text-sm p-2",children:h})]})}function L(){const[l,m]=t.useState([]),[r,i]=t.useState(!0),[o,x]=t.useState({}),n=t.useCallback(async()=>{try{i(!0);const a=await b.knowledgeList(30);m(a.documents)}finally{i(!1)}},[]);t.useEffect(()=>{n()},[n]);const d=t.useCallback(async(a,c)=>{try{await b.knowledgeFeedback(a,c),x(h=>({...h,[a]:c}))}catch{}},[]);return r?e.jsx("div",{className:"text-zinc-400 p-4",children:"Loading..."}):e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-xs text-zinc-500 mb-3",children:"Rate knowledge documents to improve RAG quality. Your feedback adjusts quality scores."}),l.map(a=>{const c=o[a.id];return e.jsxs("div",{className:"flex items-center justify-between p-3 rounded-md hover:bg-zinc-800/50",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"text-sm text-zinc-200 truncate",children:a.title}),e.jsxs("div",{className:"flex items-center gap-2 text-xs text-zinc-500",children:[e.jsx("span",{children:a.sourceType}),a.qualityScore!==void 0&&e.jsxs("span",{className:`px-1.5 py-0.5 rounded ${a.qualityScore>.7?"bg-green-900/30 text-green-400":a.qualityScore>.3?"bg-yellow-900/30 text-yellow-400":"bg-red-900/30 text-red-400"}`,children:["q:",(a.qualityScore*100).toFixed(0),"%"]})]})]}),e.jsx("div",{className:"flex gap-1",children:c?e.jsx("span",{className:`text-xs px-2 py-1 rounded ${c==="helpful"?"bg-green-900/30 text-green-400":c==="unhelpful"?"bg-red-900/30 text-red-400":"bg-yellow-900/30 text-yellow-400"}`,children:c}):e.jsxs(e.Fragment,{children:[e.jsx("button",{onClick:()=>d(a.id,"helpful"),className:"text-xs px-2 py-1 rounded bg-green-900/20 text-green-400 hover:bg-green-900/40",children:"Helpful"}),e.jsx("button",{onClick:()=>d(a.id,"unhelpful"),className:"text-xs px-2 py-1 rounded bg-red-900/20 text-red-400 hover:bg-red-900/40",children:"Unhelpful"}),e.jsx("button",{onClick:()=>d(a.id,"outdated"),className:"text-xs px-2 py-1 rounded bg-yellow-900/20 text-yellow-400 hover:bg-yellow-900/40",children:"Outdated"})]})})]},a.id)}),l.length===0&&e.jsx("div",{className:"text-zinc-500 text-sm p-4 text-center",children:"No knowledge documents yet"})]})}function R(){const[l,m]=t.useState("memories");return e.jsxs("div",{className:"h-full flex flex-col",children:[e.jsx("div",{className:"flex gap-1 p-2 border-b border-zinc-700 shrink-0",children:[{id:"memories",label:"Memories"},{id:"knowledge",label:"Knowledge Store"},{id:"export",label:"Export / Import"}].map(r=>e.jsx("button",{onClick:()=>m(r.id),className:`px-3 py-1.5 rounded-md text-xs font-medium transition-colors ${l===r.id?"bg-blue-600/20 text-blue-400":"text-zinc-400 hover:bg-zinc-800 hover:text-zinc-200"}`,children:r.label},r.id))}),e.jsxs("div",{className:"flex-1 overflow-y-auto",children:[l==="knowledge"&&e.jsx("div",{className:"p-4",children:e.jsx(C,{})}),l==="export"&&e.jsxs("div",{className:"p-4 space-y-6",children:[e.jsx(E,{}),e.jsxs("div",{className:"border-t border-zinc-700 pt-4",children:[e.jsx("h3",{className:"text-sm font-semibold text-zinc-200 mb-3",children:"Knowledge Feedback"}),e.jsx(L,{})]})]}),l==="memories"&&e.jsx(D,{})]})]})}function D(){const[l,m]=t.useState([]),[r,i]=t.useState(null),[o,x]=t.useState(null),[n,d]=t.useState(!0),[a,c]=t.useState(!1),[h,g]=t.useState(new Map),p=t.useCallback(async()=>{try{d(!0);const u=await b.getMemories().catch(()=>[]);m(u)}catch(u){x(u instanceof Error?u.message:"Failed to load")}finally{d(!1)}},[]);t.useEffect(()=>{p()},[p]);const j=t.useCallback(async u=>{i(u);const f=h.get(u.name);if(f!==void 0){i({...u,content:f});return}try{c(!0);const s=await b.readMemory(u.name);g(N=>{const v=new Map(N);return v.set(u.name,s.content),v}),i({...u,content:s.content})}catch{i({...u,content:"[Failed to load content]"})}finally{c(!1)}},[h]);return n?e.jsxs("div",{className:"h-full flex",children:[e.jsxs("div",{className:"w-64 border-r border-edge bg-surface-alt p-2 space-y-2",children:[e.jsx("div",{className:"h-4 w-16 rounded bg-surface animate-pulse"}),e.jsx("div",{className:"h-6 w-full rounded bg-surface animate-pulse"}),Array.from({length:6}).map((u,f)=>e.jsx("div",{className:"h-4 rounded bg-surface animate-pulse",style:{width:`${50+Math.random()*40}%`,marginLeft:`${f%3*12}px`}},f))]}),e.jsx("div",{className:"flex-1 flex items-center justify-center text-muted text-xs",children:"Loading memories..."})]}):o?e.jsxs("div",{className:"flex items-center justify-center h-full text-danger",children:["Failed to load: ",o]}):e.jsxs("div",{className:"h-full flex flex-col",children:[e.jsxs("div",{className:"flex items-center gap-3 px-4 py-2 border-b border-edge bg-surface-alt",children:[e.jsx("h2",{className:"text-sm font-semibold",children:"Memories"}),e.jsx(F,{label:"Memories",active:l.length>0}),e.jsxs("span",{className:"text-[10px] text-muted",children:[l.length," memories"]})]}),e.jsxs("div",{className:"flex flex-1 min-h-0",children:[e.jsx(P,{memories:l,selectedMemory:r,onSelect:j}),e.jsx("div",{className:"flex-1 min-w-0 overflow-auto",children:e.jsx(M,{selectedMemory:r,contentLoading:a})})]})]})}function F({label:l,active:m}){const r=m?"var(--color-success)":"var(--color-text-muted)",i=m?"Active":"No data";return e.jsxs("span",{className:"text-[10px] font-medium px-2 py-0.5 rounded-full",style:{background:`${r}20`,color:r},children:[l,": ",i]})}function P({memories:l,selectedMemory:m,onSelect:r}){const[i,o]=t.useState(""),[x,n]=t.useState(!1),[d,a]=t.useState(new Set),c=t.useMemo(()=>{if(!i.trim())return l;const p=i.toLowerCase();return l.filter(j=>j.name.toLowerCase().includes(p))},[l,i]),h=t.useMemo(()=>z(c),[c]),g=t.useCallback(p=>{a(j=>{const u=new Set(j);return u.has(p)?u.delete(p):u.add(p),u})},[]);return x?e.jsx("div",{className:"w-8 border-r border-edge bg-surface-alt flex flex-col items-center pt-2",children:e.jsx("button",{onClick:()=>n(!1),className:"text-[10px] text-muted hover:text-foreground rotate-90",title:"Expand file explorer",children:"Files"})}):e.jsxs("div",{className:"w-64 border-r border-edge bg-surface-alt flex flex-col overflow-hidden",children:[e.jsxs("div",{className:"flex items-center justify-between px-2 py-1.5 border-b border-edge",children:[e.jsx("span",{className:"text-[10px] font-semibold text-muted uppercase tracking-wider",children:"Files"}),e.jsx("button",{onClick:()=>n(!0),className:"text-[10px] text-muted hover:text-foreground",title:"Collapse",children:"✕"})]}),e.jsx("div",{className:"px-2 py-1.5 border-b border-edge",children:e.jsx("input",{type:"text",value:i,onChange:p=>o(p.target.value),placeholder:"Search files...",className:"w-full text-[11px] px-2 py-1 rounded bg-surface border border-edge focus:outline-none focus:border-accent"})}),e.jsx("div",{className:"flex-1 overflow-y-auto text-[11px]",children:l.length===0?e.jsx("div",{className:"px-2 py-4 text-center text-muted",children:"No memories"}):e.jsx(k,{nodes:h,depth:0,expandedPaths:d,onToggle:g,selectedMemory:m,onSelect:r})})]})}function k({nodes:l,depth:m,expandedPaths:r,onToggle:i,selectedMemory:o,onSelect:x}){return e.jsx(e.Fragment,{children:l.map(n=>{const d=n.children.length>0,a=r.has(n.path),c=n.memory!=null&&(o==null?void 0:o.name)===n.memory.name;return e.jsxs("div",{children:[e.jsxs("button",{onClick:()=>{d&&i(n.path),n.memory&&x(n.memory)},className:`w-full text-left px-2 py-0.5 flex items-center gap-1 hover:bg-surface-elevated transition-colors cursor-pointer ${c?"bg-accent15 text-accent":"text-foreground"}`,style:{paddingLeft:`${m*12+8}px`},children:[d?e.jsx("span",{className:"w-3 text-[9px] text-muted",children:a?"▾":"▸"}):e.jsx("span",{className:"w-3 text-[9px] text-muted",children:"·"}),e.jsx("span",{className:"truncate",children:n.name})]}),d&&a&&e.jsx(k,{nodes:n.children,depth:m+1,expandedPaths:r,onToggle:i,selectedMemory:o,onSelect:x})]},n.path)})})}function M({selectedMemory:l,contentLoading:m}){const[r,i]=t.useState(!1);if(!l)return e.jsx("div",{className:"flex items-center justify-center h-full text-muted",children:e.jsxs("div",{className:"text-center",children:[e.jsx("p",{className:"text-sm mb-1",children:"Select a memory from the explorer"}),e.jsx("p",{className:"text-xs text-muted/60",children:"Project memories appear as navigable files"})]})});const o=()=>{navigator.clipboard.writeText(l.content),i(!0),setTimeout(()=>i(!1),2e3)},x=l.name.split("/");return e.jsxs("div",{className:"p-4",children:[e.jsxs("div",{className:"flex items-center gap-1 mb-2 text-[10px] text-muted",children:[e.jsx("span",{children:"memories"}),x.map((n,d)=>e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx("span",{children:"/"}),e.jsx("span",{className:d===x.length-1?"text-foreground font-medium":"",children:n})]},d))]}),e.jsxs("div",{className:"flex items-center justify-between mb-3 pb-2 border-b border-edge",children:[e.jsx("span",{className:"text-sm font-semibold",children:x[x.length-1]}),e.jsx("button",{onClick:o,disabled:m,className:`text-[10px] px-2 py-0.5 rounded border transition-all cursor-pointer ${r?"border-green-500/30 text-green-500 bg-green-500/5":"border-edge text-muted hover:text-foreground"}`,children:r?"Copied!":"Copy"})]}),m?e.jsx("div",{className:"space-y-2",children:Array.from({length:8}).map((n,d)=>e.jsx("div",{className:"h-3 rounded bg-surface animate-pulse",style:{width:`${40+Math.random()*50}%`}},d))}):e.jsx("pre",{className:"text-xs whitespace-pre-wrap text-muted font-mono leading-relaxed",children:l.content})]})}export{R as MemoriesTab};
1
+ import{r as t,a as b,j as e}from"./index-DrvFzUJS.js";function z(l){const m=[];for(const r of l){const i=r.name.split("/");let o=m;for(let x=0;x<i.length;x++){const n=i[x],d=i.slice(0,x+1).join("/"),a=x===i.length-1;let c=o.find(h=>h.name===n);c||(c={name:n,path:d,children:[]},a&&(c.memory=r),o.push(c)),a&&!c.memory&&(c.memory=r),o=c.children}}return m}function C(){const[l,m]=t.useState([]),[r,i]=t.useState(null),[o,x]=t.useState(""),[n,d]=t.useState(null),[a,c]=t.useState(!0),[h,g]=t.useState(null),p=t.useCallback(async()=>{try{c(!0);const[s,N]=await Promise.all([b.knowledgeList(50),b.knowledgeGetStats()]);m(s.documents),i(N)}catch(s){g(s instanceof Error?s.message:"Failed to load")}finally{c(!1)}},[]);t.useEffect(()=>{p()},[p]);const j=t.useCallback(async()=>{if(!o.trim()){d(null);return}try{const s=await b.knowledgeSearch(o,20);d(s.results)}catch{d([])}},[o]),u=t.useCallback(async s=>{if(confirm("Delete this knowledge document?"))try{await b.knowledgeDelete(s),await p()}catch{}},[p]),f=n??l;return a?e.jsx("div",{className:"text-zinc-400 p-4",children:"Loading knowledge store..."}):h?e.jsxs("div",{className:"text-red-400 p-4",children:["Error: ",h]}):e.jsxs("div",{className:"space-y-4",children:[r&&e.jsxs("div",{className:"flex gap-3 flex-wrap",children:[e.jsxs("div",{className:"bg-zinc-800 rounded-lg px-4 py-2 border border-zinc-700",children:[e.jsx("span",{className:"text-lg font-bold text-zinc-100",children:r.total}),e.jsx("span",{className:"text-xs text-zinc-500 ml-2",children:"total docs"})]}),Object.entries(r.bySource).map(([s,N])=>e.jsxs("div",{className:"bg-zinc-800 rounded-lg px-3 py-2 border border-zinc-700",children:[e.jsx("span",{className:"text-sm font-medium text-zinc-200",children:N}),e.jsx("span",{className:"text-xs text-zinc-500 ml-1",children:s})]},s))]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("input",{type:"text",placeholder:"Search knowledge store...",value:o,onChange:s=>x(s.target.value),onKeyDown:s=>s.key==="Enter"&&j(),className:"flex-1 px-3 py-2 bg-zinc-800 border border-zinc-600 rounded-md text-zinc-200 placeholder-zinc-500 focus:outline-none focus:ring-1 focus:ring-blue-500"}),e.jsx("button",{onClick:j,className:"px-4 py-2 bg-blue-600 text-white rounded-md hover:bg-blue-500 text-sm",children:"Search"}),n&&e.jsx("button",{onClick:()=>{d(null),x("")},className:"px-3 py-2 bg-zinc-700 text-zinc-300 rounded-md hover:bg-zinc-600 text-sm",children:"Clear"})]}),e.jsxs("div",{className:"text-xs text-zinc-500",children:[f.length," documents",n?" (search results)":""]}),e.jsxs("div",{className:"space-y-1",children:[f.map(s=>e.jsxs("div",{className:"flex items-center justify-between p-3 rounded-md hover:bg-zinc-800/50 group",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"text-sm text-zinc-200 truncate",children:s.title}),e.jsxs("div",{className:"text-xs text-zinc-500",children:[s.sourceType,s.createdAt?` - ${new Date(s.createdAt).toLocaleDateString()}`:""]})]}),e.jsx("button",{onClick:()=>u(s.id),className:"text-xs text-red-400 opacity-0 group-hover:opacity-100 transition-opacity px-2 py-1 rounded hover:bg-red-900/30",children:"Delete"})]},s.id)),f.length===0&&e.jsx("div",{className:"text-zinc-500 text-sm p-4 text-center",children:"No documents found"})]})]})}function E(){const[l,m]=t.useState(!1),[r,i]=t.useState(!1),[o,x]=t.useState(null),[n,d]=t.useState(null),[a,c]=t.useState(null),[h,g]=t.useState(null),p=t.useCallback(async()=>{try{m(!0),g(null);const s=await b.knowledgeExport(),N=new Blob([JSON.stringify(s.package,null,2)],{type:"application/json"}),v=URL.createObjectURL(N),y=document.createElement("a");y.href=v,y.download=`knowledge-export-${new Date().toISOString().slice(0,10)}.json`,y.click(),URL.revokeObjectURL(v)}catch(s){g(s instanceof Error?s.message:"Export failed")}finally{m(!1)}},[]),j=t.useCallback(async s=>{var v;const N=(v=s.target.files)==null?void 0:v[0];if(N)try{g(null),d(null);const y=await N.text(),w=JSON.parse(y);c(w);const S=await b.knowledgePreview(w);x(S.preview)}catch(y){g(y instanceof Error?y.message:"Invalid package file"),c(null),x(null)}},[]),u=t.useCallback(async()=>{if(a)try{i(!0),g(null);const s=await b.knowledgeImport(a);d(s.result),x(null),c(null)}catch(s){g(s instanceof Error?s.message:"Import failed")}finally{i(!1)}},[a]),f=t.useCallback(()=>{c(null),x(null),d(null)},[]);return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"bg-zinc-800 rounded-lg p-4 border border-zinc-700",children:[e.jsx("h3",{className:"text-sm font-semibold text-zinc-200 mb-2",children:"Export Knowledge Package"}),e.jsx("p",{className:"text-xs text-zinc-400 mb-3",children:"Download all knowledge documents, memories, and relations as a portable JSON package."}),e.jsx("button",{onClick:p,disabled:l,className:"px-4 py-2 bg-blue-600 text-white rounded-md hover:bg-blue-500 text-sm disabled:opacity-50",children:l?"Exporting...":"Export Package"})]}),e.jsxs("div",{className:"bg-zinc-800 rounded-lg p-4 border border-zinc-700",children:[e.jsx("h3",{className:"text-sm font-semibold text-zinc-200 mb-2",children:"Import Knowledge Package"}),e.jsx("p",{className:"text-xs text-zinc-400 mb-3",children:"Upload a knowledge package JSON to import documents and memories."}),e.jsx("input",{type:"file",accept:".json",onChange:j,className:"block w-full text-sm text-zinc-400 file:mr-4 file:py-2 file:px-4 file:rounded-md file:border-0 file:text-sm file:bg-zinc-700 file:text-zinc-200 hover:file:bg-zinc-600"}),o&&e.jsxs("div",{className:"mt-4 p-3 bg-zinc-900 rounded-md border border-zinc-600",children:[e.jsx("h4",{className:"text-xs font-semibold text-zinc-300 mb-2",children:"Import Preview"}),e.jsxs("div",{className:"grid grid-cols-2 gap-2 text-xs",children:[e.jsxs("div",{children:[e.jsx("span",{className:"text-green-400",children:o.newDocuments})," new documents"]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-yellow-400",children:o.existingDocuments})," existing (skip)"]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-green-400",children:o.newMemories})," new memories"]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-yellow-400",children:o.existingMemories})," existing (skip)"]})]}),e.jsxs("div",{className:"text-xs text-zinc-500 mt-2",children:["Sources: ",o.sourceTypes.join(", ")]}),e.jsxs("div",{className:"flex gap-2 mt-3",children:[e.jsx("button",{onClick:u,disabled:r,className:"px-3 py-1.5 bg-green-600 text-white rounded-md hover:bg-green-500 text-xs disabled:opacity-50",children:r?"Importing...":"Confirm Import"}),e.jsx("button",{onClick:f,className:"px-3 py-1.5 bg-zinc-700 text-zinc-300 rounded-md hover:bg-zinc-600 text-xs",children:"Cancel"})]})]}),n&&e.jsxs("div",{className:"mt-4 p-3 bg-green-900/20 rounded-md border border-green-700/50",children:[e.jsx("h4",{className:"text-xs font-semibold text-green-400 mb-1",children:"Import Complete"}),e.jsxs("div",{className:"text-xs text-zinc-300",children:[n.documentsImported," docs imported, ",n.documentsSkipped," skipped, ",n.memoriesImported," memories imported"]})]})]}),h&&e.jsx("div",{className:"text-red-400 text-sm p-2",children:h})]})}function L(){const[l,m]=t.useState([]),[r,i]=t.useState(!0),[o,x]=t.useState({}),n=t.useCallback(async()=>{try{i(!0);const a=await b.knowledgeList(30);m(a.documents)}finally{i(!1)}},[]);t.useEffect(()=>{n()},[n]);const d=t.useCallback(async(a,c)=>{try{await b.knowledgeFeedback(a,c),x(h=>({...h,[a]:c}))}catch{}},[]);return r?e.jsx("div",{className:"text-zinc-400 p-4",children:"Loading..."}):e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-xs text-zinc-500 mb-3",children:"Rate knowledge documents to improve RAG quality. Your feedback adjusts quality scores."}),l.map(a=>{const c=o[a.id];return e.jsxs("div",{className:"flex items-center justify-between p-3 rounded-md hover:bg-zinc-800/50",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"text-sm text-zinc-200 truncate",children:a.title}),e.jsxs("div",{className:"flex items-center gap-2 text-xs text-zinc-500",children:[e.jsx("span",{children:a.sourceType}),a.qualityScore!==void 0&&e.jsxs("span",{className:`px-1.5 py-0.5 rounded ${a.qualityScore>.7?"bg-green-900/30 text-green-400":a.qualityScore>.3?"bg-yellow-900/30 text-yellow-400":"bg-red-900/30 text-red-400"}`,children:["q:",(a.qualityScore*100).toFixed(0),"%"]})]})]}),e.jsx("div",{className:"flex gap-1",children:c?e.jsx("span",{className:`text-xs px-2 py-1 rounded ${c==="helpful"?"bg-green-900/30 text-green-400":c==="unhelpful"?"bg-red-900/30 text-red-400":"bg-yellow-900/30 text-yellow-400"}`,children:c}):e.jsxs(e.Fragment,{children:[e.jsx("button",{onClick:()=>d(a.id,"helpful"),className:"text-xs px-2 py-1 rounded bg-green-900/20 text-green-400 hover:bg-green-900/40",children:"Helpful"}),e.jsx("button",{onClick:()=>d(a.id,"unhelpful"),className:"text-xs px-2 py-1 rounded bg-red-900/20 text-red-400 hover:bg-red-900/40",children:"Unhelpful"}),e.jsx("button",{onClick:()=>d(a.id,"outdated"),className:"text-xs px-2 py-1 rounded bg-yellow-900/20 text-yellow-400 hover:bg-yellow-900/40",children:"Outdated"})]})})]},a.id)}),l.length===0&&e.jsx("div",{className:"text-zinc-500 text-sm p-4 text-center",children:"No knowledge documents yet"})]})}function R(){const[l,m]=t.useState("memories");return e.jsxs("div",{className:"h-full flex flex-col",children:[e.jsx("div",{className:"flex gap-1 p-2 border-b border-zinc-700 shrink-0",children:[{id:"memories",label:"Memories"},{id:"knowledge",label:"Knowledge Store"},{id:"export",label:"Export / Import"}].map(r=>e.jsx("button",{onClick:()=>m(r.id),className:`px-3 py-1.5 rounded-md text-xs font-medium transition-colors ${l===r.id?"bg-blue-600/20 text-blue-400":"text-zinc-400 hover:bg-zinc-800 hover:text-zinc-200"}`,children:r.label},r.id))}),e.jsxs("div",{className:"flex-1 overflow-y-auto",children:[l==="knowledge"&&e.jsx("div",{className:"p-4",children:e.jsx(C,{})}),l==="export"&&e.jsxs("div",{className:"p-4 space-y-6",children:[e.jsx(E,{}),e.jsxs("div",{className:"border-t border-zinc-700 pt-4",children:[e.jsx("h3",{className:"text-sm font-semibold text-zinc-200 mb-3",children:"Knowledge Feedback"}),e.jsx(L,{})]})]}),l==="memories"&&e.jsx(D,{})]})]})}function D(){const[l,m]=t.useState([]),[r,i]=t.useState(null),[o,x]=t.useState(null),[n,d]=t.useState(!0),[a,c]=t.useState(!1),[h,g]=t.useState(new Map),p=t.useCallback(async()=>{try{d(!0);const u=await b.getMemories().catch(()=>[]);m(u)}catch(u){x(u instanceof Error?u.message:"Failed to load")}finally{d(!1)}},[]);t.useEffect(()=>{p()},[p]);const j=t.useCallback(async u=>{i(u);const f=h.get(u.name);if(f!==void 0){i({...u,content:f});return}try{c(!0);const s=await b.readMemory(u.name);g(N=>{const v=new Map(N);return v.set(u.name,s.content),v}),i({...u,content:s.content})}catch{i({...u,content:"[Failed to load content]"})}finally{c(!1)}},[h]);return n?e.jsxs("div",{className:"h-full flex",children:[e.jsxs("div",{className:"w-64 border-r border-edge bg-surface-alt p-2 space-y-2",children:[e.jsx("div",{className:"h-4 w-16 rounded bg-surface animate-pulse"}),e.jsx("div",{className:"h-6 w-full rounded bg-surface animate-pulse"}),Array.from({length:6}).map((u,f)=>e.jsx("div",{className:"h-4 rounded bg-surface animate-pulse",style:{width:`${50+Math.random()*40}%`,marginLeft:`${f%3*12}px`}},f))]}),e.jsx("div",{className:"flex-1 flex items-center justify-center text-muted text-xs",children:"Loading memories..."})]}):o?e.jsxs("div",{className:"flex items-center justify-center h-full text-danger",children:["Failed to load: ",o]}):e.jsxs("div",{className:"h-full flex flex-col",children:[e.jsxs("div",{className:"flex items-center gap-3 px-4 py-2 border-b border-edge bg-surface-alt",children:[e.jsx("h2",{className:"text-sm font-semibold",children:"Memories"}),e.jsx(F,{label:"Memories",active:l.length>0}),e.jsxs("span",{className:"text-[10px] text-muted",children:[l.length," memories"]})]}),e.jsxs("div",{className:"flex flex-1 min-h-0",children:[e.jsx(P,{memories:l,selectedMemory:r,onSelect:j}),e.jsx("div",{className:"flex-1 min-w-0 overflow-auto",children:e.jsx(M,{selectedMemory:r,contentLoading:a})})]})]})}function F({label:l,active:m}){const r=m?"var(--color-success)":"var(--color-text-muted)",i=m?"Active":"No data";return e.jsxs("span",{className:"text-[10px] font-medium px-2 py-0.5 rounded-full",style:{background:`${r}20`,color:r},children:[l,": ",i]})}function P({memories:l,selectedMemory:m,onSelect:r}){const[i,o]=t.useState(""),[x,n]=t.useState(!1),[d,a]=t.useState(new Set),c=t.useMemo(()=>{if(!i.trim())return l;const p=i.toLowerCase();return l.filter(j=>j.name.toLowerCase().includes(p))},[l,i]),h=t.useMemo(()=>z(c),[c]),g=t.useCallback(p=>{a(j=>{const u=new Set(j);return u.has(p)?u.delete(p):u.add(p),u})},[]);return x?e.jsx("div",{className:"w-8 border-r border-edge bg-surface-alt flex flex-col items-center pt-2",children:e.jsx("button",{onClick:()=>n(!1),className:"text-[10px] text-muted hover:text-foreground rotate-90",title:"Expand file explorer",children:"Files"})}):e.jsxs("div",{className:"w-64 border-r border-edge bg-surface-alt flex flex-col overflow-hidden",children:[e.jsxs("div",{className:"flex items-center justify-between px-2 py-1.5 border-b border-edge",children:[e.jsx("span",{className:"text-[10px] font-semibold text-muted uppercase tracking-wider",children:"Files"}),e.jsx("button",{onClick:()=>n(!0),className:"text-[10px] text-muted hover:text-foreground",title:"Collapse",children:"✕"})]}),e.jsx("div",{className:"px-2 py-1.5 border-b border-edge",children:e.jsx("input",{type:"text",value:i,onChange:p=>o(p.target.value),placeholder:"Search files...",className:"w-full text-[11px] px-2 py-1 rounded bg-surface border border-edge focus:outline-none focus:border-accent"})}),e.jsx("div",{className:"flex-1 overflow-y-auto text-[11px]",children:l.length===0?e.jsx("div",{className:"px-2 py-4 text-center text-muted",children:"No memories"}):e.jsx(k,{nodes:h,depth:0,expandedPaths:d,onToggle:g,selectedMemory:m,onSelect:r})})]})}function k({nodes:l,depth:m,expandedPaths:r,onToggle:i,selectedMemory:o,onSelect:x}){return e.jsx(e.Fragment,{children:l.map(n=>{const d=n.children.length>0,a=r.has(n.path),c=n.memory!=null&&(o==null?void 0:o.name)===n.memory.name;return e.jsxs("div",{children:[e.jsxs("button",{onClick:()=>{d&&i(n.path),n.memory&&x(n.memory)},className:`w-full text-left px-2 py-0.5 flex items-center gap-1 hover:bg-surface-elevated transition-colors cursor-pointer ${c?"bg-accent15 text-accent":"text-foreground"}`,style:{paddingLeft:`${m*12+8}px`},children:[d?e.jsx("span",{className:"w-3 text-[9px] text-muted",children:a?"▾":"▸"}):e.jsx("span",{className:"w-3 text-[9px] text-muted",children:"·"}),e.jsx("span",{className:"truncate",children:n.name})]}),d&&a&&e.jsx(k,{nodes:n.children,depth:m+1,expandedPaths:r,onToggle:i,selectedMemory:o,onSelect:x})]},n.path)})})}function M({selectedMemory:l,contentLoading:m}){const[r,i]=t.useState(!1);if(!l)return e.jsx("div",{className:"flex items-center justify-center h-full text-muted",children:e.jsxs("div",{className:"text-center",children:[e.jsx("p",{className:"text-sm mb-1",children:"Select a memory from the explorer"}),e.jsx("p",{className:"text-xs text-muted/60",children:"Project memories appear as navigable files"})]})});const o=()=>{navigator.clipboard.writeText(l.content),i(!0),setTimeout(()=>i(!1),2e3)},x=l.name.split("/");return e.jsxs("div",{className:"p-4",children:[e.jsxs("div",{className:"flex items-center gap-1 mb-2 text-[10px] text-muted",children:[e.jsx("span",{children:"memories"}),x.map((n,d)=>e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx("span",{children:"/"}),e.jsx("span",{className:d===x.length-1?"text-foreground font-medium":"",children:n})]},d))]}),e.jsxs("div",{className:"flex items-center justify-between mb-3 pb-2 border-b border-edge",children:[e.jsx("span",{className:"text-sm font-semibold",children:x[x.length-1]}),e.jsx("button",{onClick:o,disabled:m,className:`text-[10px] px-2 py-0.5 rounded border transition-all cursor-pointer ${r?"border-green-500/30 text-green-500 bg-green-500/5":"border-edge text-muted hover:text-foreground"}`,children:r?"Copied!":"Copy"})]}),m?e.jsx("div",{className:"space-y-2",children:Array.from({length:8}).map((n,d)=>e.jsx("div",{className:"h-3 rounded bg-surface animate-pulse",style:{width:`${40+Math.random()*50}%`}},d))}):e.jsx("pre",{className:"text-xs whitespace-pre-wrap text-muted font-mono leading-relaxed",children:l.content})]})}export{R as MemoriesTab};
@@ -1 +1 @@
1
- import{r as c,j as e}from"./index-C3Kad9YO.js";import{R as _,u as M,a as E,b as P,i as T,B,C as D}from"./style-iy_ryTT6.js";import{S as w}from"./constants-Dd6A34aQ.js";import{b as R,g as F,t as $,c as z,d as A,W as I,e as L,N as O}from"./graph-utils-OY_fOvB3.js";import"./index-4X4gmCkA.js";import"./index-1aGs8JPI.js";const V=c.memo(function({graph:d,onNodeClick:N}){const{groups:m,nextTask:f,nodeMap:j}=c.useMemo(()=>{const r=d.nodes.filter(s=>s.type==="task"||s.type==="subtask"),x=new Map(d.nodes.map(s=>[s.id,s])),p=new Set(d.nodes.filter(s=>s.status==="done").map(s=>s.id)),h=r.filter(s=>s.status!=="backlog"&&s.status!=="ready"||s.blocked?!1:d.edges.filter(a=>a.from===s.id&&a.relationType==="depends_on").every(a=>p.has(a.to)));h.sort((s,t)=>s.priority-t.priority);const i=new Map;for(const s of r){const t=s.parentId||"__root__";i.has(t)||i.set(t,[]),i.get(t).push(s)}for(const s of i.values())s.sort((t,a)=>t.priority-a.priority);return{groups:i,nextTask:h[0]||null,nodeMap:x}},[d]);return d.nodes.filter(r=>r.type==="task"||r.type==="subtask").length===0?e.jsx("div",{className:"p-4 text-center text-muted",children:"No tasks in backlog."}):e.jsxs("div",{className:"p-2",children:[f&&e.jsxs("div",{className:"mb-3 px-3 py-2 bg-accent10 border border-accent rounded-lg",children:[e.jsx("span",{className:"text-xs font-medium text-accent",children:"Next:"})," ",e.jsx("span",{className:"text-sm font-semibold",children:f.title})]}),Array.from(m.entries()).map(([r,x])=>{const p=r!=="__root__"?j.get(r):null,h=p?p.title:"Ungrouped Tasks",i=x.filter(t=>t.status==="done").length,s=Math.round(i/x.length*100);return e.jsxs("div",{className:"mb-3",children:[e.jsxs("div",{className:"flex items-center justify-between px-2 py-1",children:[e.jsx("h4",{className:"text-xs font-semibold truncate",children:h}),e.jsxs("span",{className:"text-[10px] text-muted",children:[i,"/",x.length]})]}),e.jsx("div",{className:"h-1 mx-2 mb-1 bg-surface-elevated rounded-full overflow-hidden",children:e.jsx("div",{className:"h-full rounded-full",style:{width:`${s}%`,background:w.done}})}),x.map(t=>{const a=(f==null?void 0:f.id)===t.id,v=w[t.status]||"#9e9e9e",y=d.edges.filter(l=>l.from===t.id&&l.relationType==="depends_on").map(l=>{var n;return((n=j.get(l.to))==null?void 0:n.title)||l.to});return e.jsxs("div",{onClick:()=>N(t),className:`mx-1 mb-1 px-2 py-1.5 rounded cursor-pointer hover:bg-surface-elevated transition-colors ${a?"ring-1 ring-accent":""}`,children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:"text-[9px] px-1 py-0.5 rounded font-medium shrink-0",style:{background:`${v}20`,color:v},children:t.status.replace("_"," ")}),e.jsx("span",{className:"text-xs truncate flex-1",children:t.title}),e.jsxs("span",{className:"text-[10px] text-muted",children:["P",t.priority]}),t.xpSize&&e.jsx("span",{className:"text-[10px] text-muted",children:t.xpSize})]}),y.length>0&&e.jsxs("div",{className:"text-[10px] text-muted mt-0.5 truncate pl-1",children:["Depends on: ",y.join(", ")]})]},t.id)})]},r)})]})}),W={workflowNode:L},U={workflowEdge:I},Z={hideAttribution:!0};function G({graph:o}){const[d,N,m]=M([]),[f,j,r]=E([]),[x,p]=c.useState(null),[h,i]=c.useState(new Set),s=c.useRef(!0),{fitView:t}=P(),a=c.useMemo(()=>R(o.nodes,o.edges),[o.nodes,o.edges]),v=c.useCallback(n=>{i(u=>{const b=new Set(u);return b.has(n)?b.delete(n):b.add(n),b})},[]);c.useEffect(()=>{const n=F(o.nodes,h,a),u=$(n,void 0,a,h,v),b=new Set(u.map(S=>S.id)),k=z(o.edges,b),g=A(u,k,"TB");N(g.nodes),j(g.edges),s.current?s.current=!1:setTimeout(()=>t({duration:300}),50)},[o,N,j,h,a,v,t]);const C=c.useCallback((n,u)=>{p(u.data.sourceNode)},[]),y=c.useCallback(n=>{p(n)},[]),l=c.useMemo(()=>{const n=o.nodes.length,u=o.nodes.filter(g=>g.status==="done").length,b=o.nodes.filter(g=>g.status==="in_progress").length,k=o.nodes.filter(g=>g.status==="blocked").length;return{total:n,done:u,inProgress:b,blocked:k,pctDone:n?Math.round(u/n*100):0}},[o.nodes]);return e.jsxs("div",{className:"flex h-full",children:[e.jsxs("div",{className:"flex-1 min-w-0 flex flex-col",children:[e.jsx("div",{className:"px-3 py-1.5 bg-surface-alt border-b border-edge flex items-center gap-2 text-xs relative z-10",children:e.jsxs("span",{className:"text-muted",children:["Showing ",d.length," of ",o.nodes.length," nodes — click ▶ to expand"]})}),o.nodes.length>0?e.jsxs(T,{nodes:d,edges:f,onNodesChange:m,onEdgesChange:r,onNodeClick:C,nodeTypes:W,edgeTypes:U,nodesDraggable:!1,nodesConnectable:!1,fitView:!0,minZoom:.1,maxZoom:2,proOptions:Z,children:[e.jsx(B,{gap:16,size:1}),e.jsx(D,{showInteractive:!1})]}):e.jsx("div",{className:"flex items-center justify-center h-full text-muted",children:"Import a PRD to see the workflow"})]}),e.jsxs("div",{className:"w-96 border-l border-edge flex flex-col overflow-hidden",children:[e.jsxs("div",{className:"px-4 py-3 border-b border-edge bg-surface-alt",children:[e.jsxs("div",{className:"flex justify-between text-sm mb-1",children:[e.jsxs("span",{children:[l.done,"/",l.total," done (",l.pctDone,"%)"]}),e.jsxs("span",{className:"text-muted",children:[l.inProgress," in progress, ",l.blocked," blocked"]})]}),e.jsxs("div",{className:"h-2 bg-surface-elevated rounded-full overflow-hidden flex",children:[e.jsx("div",{className:"h-full transition-all",style:{width:`${l.pctDone}%`,background:w.done}}),e.jsx("div",{className:"h-full transition-all",style:{width:`${l.total?Math.round(l.inProgress/l.total*100):0}%`,background:w.in_progress}})]})]}),e.jsx("div",{className:"flex-1 overflow-y-auto",children:e.jsx(V,{graph:o,onNodeClick:y})})]}),x&&e.jsx(O,{node:x,onClose:()=>p(null)})]})}function Y({graph:o,loading:d,error:N,onRetry:m}){return d||!o?e.jsxs("div",{className:"flex h-full",children:[e.jsxs("div",{className:"flex-1 min-w-0 flex flex-col",children:[e.jsx("div",{className:"px-3 py-1.5 bg-surface-alt border-b border-edge",children:e.jsx("div",{className:"h-3 w-48 rounded bg-surface animate-pulse"})}),e.jsx("div",{className:"flex-1 bg-surface-alt animate-pulse"})]}),e.jsxs("div",{className:"w-96 border-l border-edge flex flex-col",children:[e.jsxs("div",{className:"px-4 py-3 border-b border-edge bg-surface-alt space-y-2",children:[e.jsxs("div",{className:"flex justify-between",children:[e.jsx("div",{className:"h-4 w-28 rounded bg-surface animate-pulse"}),e.jsx("div",{className:"h-4 w-40 rounded bg-surface animate-pulse"})]}),e.jsx("div",{className:"h-2 rounded-full bg-surface animate-pulse"})]}),e.jsx("div",{className:"flex-1 p-3 space-y-3",children:Array.from({length:6}).map((f,j)=>e.jsx("div",{className:"h-14 rounded-lg border border-edge bg-surface-alt animate-pulse"},j))})]})]}):N?e.jsxs("div",{className:"flex flex-col items-center justify-center h-full gap-4",children:[e.jsxs("div",{className:"text-center",children:[e.jsx("p",{className:"text-sm font-medium text-foreground",children:"Failed to load PRD & Backlog"}),e.jsx("p",{className:"text-xs text-muted mt-1",children:N})]}),m&&e.jsx("button",{type:"button",onClick:m,className:"flex items-center gap-1.5 px-4 py-2 text-xs font-medium rounded-md border border-edge text-muted hover:text-foreground transition-colors cursor-pointer",children:"Retry"})]}):o?e.jsx(_,{children:e.jsx(G,{graph:o})}):e.jsxs("div",{className:"flex flex-col items-center justify-center h-full gap-3 text-muted",children:[e.jsx("p",{className:"text-xs",children:"No graph data available"}),m&&e.jsx("button",{type:"button",onClick:m,className:"text-xs px-3 py-1.5 rounded border border-edge hover:text-foreground transition-colors cursor-pointer",children:"Retry"})]})}export{Y as PrdBacklogTab};
1
+ import{r as c,j as e}from"./index-DrvFzUJS.js";import{R as _,u as M,a as E,b as P,i as T,B,C as D}from"./style-DeKQIW_i.js";import{S as w}from"./constants-DLyESMjx.js";import{b as R,g as F,t as $,c as z,d as A,W as I,e as L,N as O}from"./graph-utils-BlwoHdjR.js";import"./index-C13O-yj1.js";import"./index-CAOXRHQq.js";const V=c.memo(function({graph:d,onNodeClick:N}){const{groups:m,nextTask:f,nodeMap:j}=c.useMemo(()=>{const r=d.nodes.filter(s=>s.type==="task"||s.type==="subtask"),x=new Map(d.nodes.map(s=>[s.id,s])),p=new Set(d.nodes.filter(s=>s.status==="done").map(s=>s.id)),h=r.filter(s=>s.status!=="backlog"&&s.status!=="ready"||s.blocked?!1:d.edges.filter(a=>a.from===s.id&&a.relationType==="depends_on").every(a=>p.has(a.to)));h.sort((s,t)=>s.priority-t.priority);const i=new Map;for(const s of r){const t=s.parentId||"__root__";i.has(t)||i.set(t,[]),i.get(t).push(s)}for(const s of i.values())s.sort((t,a)=>t.priority-a.priority);return{groups:i,nextTask:h[0]||null,nodeMap:x}},[d]);return d.nodes.filter(r=>r.type==="task"||r.type==="subtask").length===0?e.jsx("div",{className:"p-4 text-center text-muted",children:"No tasks in backlog."}):e.jsxs("div",{className:"p-2",children:[f&&e.jsxs("div",{className:"mb-3 px-3 py-2 bg-accent10 border border-accent rounded-lg",children:[e.jsx("span",{className:"text-xs font-medium text-accent",children:"Next:"})," ",e.jsx("span",{className:"text-sm font-semibold",children:f.title})]}),Array.from(m.entries()).map(([r,x])=>{const p=r!=="__root__"?j.get(r):null,h=p?p.title:"Ungrouped Tasks",i=x.filter(t=>t.status==="done").length,s=Math.round(i/x.length*100);return e.jsxs("div",{className:"mb-3",children:[e.jsxs("div",{className:"flex items-center justify-between px-2 py-1",children:[e.jsx("h4",{className:"text-xs font-semibold truncate",children:h}),e.jsxs("span",{className:"text-[10px] text-muted",children:[i,"/",x.length]})]}),e.jsx("div",{className:"h-1 mx-2 mb-1 bg-surface-elevated rounded-full overflow-hidden",children:e.jsx("div",{className:"h-full rounded-full",style:{width:`${s}%`,background:w.done}})}),x.map(t=>{const a=(f==null?void 0:f.id)===t.id,v=w[t.status]||"#9e9e9e",y=d.edges.filter(l=>l.from===t.id&&l.relationType==="depends_on").map(l=>{var n;return((n=j.get(l.to))==null?void 0:n.title)||l.to});return e.jsxs("div",{onClick:()=>N(t),className:`mx-1 mb-1 px-2 py-1.5 rounded cursor-pointer hover:bg-surface-elevated transition-colors ${a?"ring-1 ring-accent":""}`,children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:"text-[9px] px-1 py-0.5 rounded font-medium shrink-0",style:{background:`${v}20`,color:v},children:t.status.replace("_"," ")}),e.jsx("span",{className:"text-xs truncate flex-1",children:t.title}),e.jsxs("span",{className:"text-[10px] text-muted",children:["P",t.priority]}),t.xpSize&&e.jsx("span",{className:"text-[10px] text-muted",children:t.xpSize})]}),y.length>0&&e.jsxs("div",{className:"text-[10px] text-muted mt-0.5 truncate pl-1",children:["Depends on: ",y.join(", ")]})]},t.id)})]},r)})]})}),W={workflowNode:L},U={workflowEdge:I},Z={hideAttribution:!0};function G({graph:o}){const[d,N,m]=M([]),[f,j,r]=E([]),[x,p]=c.useState(null),[h,i]=c.useState(new Set),s=c.useRef(!0),{fitView:t}=P(),a=c.useMemo(()=>R(o.nodes,o.edges),[o.nodes,o.edges]),v=c.useCallback(n=>{i(u=>{const b=new Set(u);return b.has(n)?b.delete(n):b.add(n),b})},[]);c.useEffect(()=>{const n=F(o.nodes,h,a),u=$(n,void 0,a,h,v),b=new Set(u.map(S=>S.id)),k=z(o.edges,b),g=A(u,k,"TB");N(g.nodes),j(g.edges),s.current?s.current=!1:setTimeout(()=>t({duration:300}),50)},[o,N,j,h,a,v,t]);const C=c.useCallback((n,u)=>{p(u.data.sourceNode)},[]),y=c.useCallback(n=>{p(n)},[]),l=c.useMemo(()=>{const n=o.nodes.length,u=o.nodes.filter(g=>g.status==="done").length,b=o.nodes.filter(g=>g.status==="in_progress").length,k=o.nodes.filter(g=>g.status==="blocked").length;return{total:n,done:u,inProgress:b,blocked:k,pctDone:n?Math.round(u/n*100):0}},[o.nodes]);return e.jsxs("div",{className:"flex h-full",children:[e.jsxs("div",{className:"flex-1 min-w-0 flex flex-col",children:[e.jsx("div",{className:"px-3 py-1.5 bg-surface-alt border-b border-edge flex items-center gap-2 text-xs relative z-10",children:e.jsxs("span",{className:"text-muted",children:["Showing ",d.length," of ",o.nodes.length," nodes — click ▶ to expand"]})}),o.nodes.length>0?e.jsxs(T,{nodes:d,edges:f,onNodesChange:m,onEdgesChange:r,onNodeClick:C,nodeTypes:W,edgeTypes:U,nodesDraggable:!1,nodesConnectable:!1,fitView:!0,minZoom:.1,maxZoom:2,proOptions:Z,children:[e.jsx(B,{gap:16,size:1}),e.jsx(D,{showInteractive:!1})]}):e.jsx("div",{className:"flex items-center justify-center h-full text-muted",children:"Import a PRD to see the workflow"})]}),e.jsxs("div",{className:"w-96 border-l border-edge flex flex-col overflow-hidden",children:[e.jsxs("div",{className:"px-4 py-3 border-b border-edge bg-surface-alt",children:[e.jsxs("div",{className:"flex justify-between text-sm mb-1",children:[e.jsxs("span",{children:[l.done,"/",l.total," done (",l.pctDone,"%)"]}),e.jsxs("span",{className:"text-muted",children:[l.inProgress," in progress, ",l.blocked," blocked"]})]}),e.jsxs("div",{className:"h-2 bg-surface-elevated rounded-full overflow-hidden flex",children:[e.jsx("div",{className:"h-full transition-all",style:{width:`${l.pctDone}%`,background:w.done}}),e.jsx("div",{className:"h-full transition-all",style:{width:`${l.total?Math.round(l.inProgress/l.total*100):0}%`,background:w.in_progress}})]})]}),e.jsx("div",{className:"flex-1 overflow-y-auto",children:e.jsx(V,{graph:o,onNodeClick:y})})]}),x&&e.jsx(O,{node:x,onClose:()=>p(null)})]})}function Y({graph:o,loading:d,error:N,onRetry:m}){return d||!o?e.jsxs("div",{className:"flex h-full",children:[e.jsxs("div",{className:"flex-1 min-w-0 flex flex-col",children:[e.jsx("div",{className:"px-3 py-1.5 bg-surface-alt border-b border-edge",children:e.jsx("div",{className:"h-3 w-48 rounded bg-surface animate-pulse"})}),e.jsx("div",{className:"flex-1 bg-surface-alt animate-pulse"})]}),e.jsxs("div",{className:"w-96 border-l border-edge flex flex-col",children:[e.jsxs("div",{className:"px-4 py-3 border-b border-edge bg-surface-alt space-y-2",children:[e.jsxs("div",{className:"flex justify-between",children:[e.jsx("div",{className:"h-4 w-28 rounded bg-surface animate-pulse"}),e.jsx("div",{className:"h-4 w-40 rounded bg-surface animate-pulse"})]}),e.jsx("div",{className:"h-2 rounded-full bg-surface animate-pulse"})]}),e.jsx("div",{className:"flex-1 p-3 space-y-3",children:Array.from({length:6}).map((f,j)=>e.jsx("div",{className:"h-14 rounded-lg border border-edge bg-surface-alt animate-pulse"},j))})]})]}):N?e.jsxs("div",{className:"flex flex-col items-center justify-center h-full gap-4",children:[e.jsxs("div",{className:"text-center",children:[e.jsx("p",{className:"text-sm font-medium text-foreground",children:"Failed to load PRD & Backlog"}),e.jsx("p",{className:"text-xs text-muted mt-1",children:N})]}),m&&e.jsx("button",{type:"button",onClick:m,className:"flex items-center gap-1.5 px-4 py-2 text-xs font-medium rounded-md border border-edge text-muted hover:text-foreground transition-colors cursor-pointer",children:"Retry"})]}):o?e.jsx(_,{children:e.jsx(G,{graph:o})}):e.jsxs("div",{className:"flex flex-col items-center justify-center h-full gap-3 text-muted",children:[e.jsx("p",{className:"text-xs",children:"No graph data available"}),m&&e.jsx("button",{type:"button",onClick:m,className:"text-xs px-3 py-1.5 rounded border border-edge hover:text-foreground transition-colors cursor-pointer",children:"Retry"})]})}export{Y as PrdBacklogTab};
@@ -1,4 +1,4 @@
1
- import{c as e}from"./index-C3Kad9YO.js";/**
1
+ import{c as e}from"./index-DrvFzUJS.js";/**
2
2
  * @license lucide-react v1.7.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1,4 +1,4 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/graph-section-Cwx-Bmeh.js","assets/index-C3Kad9YO.js","assets/index-BVhCKhGJ.css","assets/style-iy_ryTT6.js","assets/index-4X4gmCkA.js","assets/style-BZV40eAE.css","assets/constants-Dd6A34aQ.js","assets/index-1aGs8JPI.js"])))=>i.map(i=>d[i]);
2
- import{r as s,j as e,a as S,_ as L}from"./index-C3Kad9YO.js";import{e as k}from"./constants-Dd6A34aQ.js";const D=[{id:"upload",label:"Upload",icon:"M3 16.5v2.25A2.25 2.25 0 005.25 21h13.5A2.25 2.25 0 0021 18.75V16.5m-13.5-9L12 3m0 0l4.5 4.5M12 3v13.5"},{id:"objects",label:"Objects",icon:"M3.75 12h16.5m-16.5 3.75h16.5M3.75 19.5h16.5M5.625 4.5h12.75a1.875 1.875 0 010 3.75H5.625a1.875 1.875 0 010-3.75z"},{id:"graph",label:"Graph",icon:"M7.5 14.25v2.25m3-4.5v4.5m3-6.75v6.75m3-9v9M6 20.25h12A2.25 2.25 0 0020.25 18V6A2.25 2.25 0 0018 3.75H6A2.25 2.25 0 003.75 6v12A2.25 2.25 0 006 20.25z"},{id:"generation",label:"Generation",icon:"M9.813 15.904L9 18.75l-.813-2.846a4.5 4.5 0 00-3.09-3.09L2.25 12l2.846-.813a4.5 4.5 0 003.09-3.09L9 5.25l.813 2.846a4.5 4.5 0 003.09 3.09L15.75 12l-2.846.813a4.5 4.5 0 00-3.09 3.09zM18.259 8.715L18 9.75l-.259-1.035a3.375 3.375 0 00-2.455-2.456L14.25 6l1.036-.259a3.375 3.375 0 002.455-2.456L18 2.25l.259 1.035a3.375 3.375 0 002.455 2.456L21.75 6l-1.036.259a3.375 3.375 0 00-2.455 2.456z"}],T=s.memo(function({activeSection:t,onSectionChange:a,objectCount:d}){return e.jsxs("nav",{className:"w-48 flex-shrink-0 border-r border-edge bg-surface-alt flex flex-col","aria-label":"Siebel sections",children:[e.jsx("div",{className:"px-3 py-3 border-b border-edge",children:e.jsx("h2",{className:"text-xs font-semibold uppercase text-muted tracking-wider",children:"Siebel"})}),e.jsx("div",{className:"flex-1 py-1",children:D.map(u=>e.jsxs("button",{onClick:()=>a(u.id),"aria-label":`Navigate to ${u.label}`,className:`w-full flex items-center gap-2.5 px-3 py-2 text-xs font-medium transition-colors cursor-pointer ${t===u.id?"bg-accent/10 text-accent border-r-2 border-accent":"text-muted hover:text-foreground hover:bg-surface"}`,children:[e.jsx("svg",{className:"w-4 h-4 flex-shrink-0",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:u.icon})}),e.jsx("span",{children:u.label}),u.id==="objects"&&d>0&&e.jsx("span",{className:"ml-auto text-[10px] px-1.5 py-0.5 rounded-full bg-surface text-muted",children:d})]},u.id))})]})});function E(){const[o,t]=s.useState([]),[a,d]=s.useState([]),[u,x]=s.useState(!0),[b,h]=s.useState(null),c=s.useCallback(async()=>{try{x(!0),h(null);const[m,l]=await Promise.all([S.siebelGetObjects({limit:100}).catch(()=>({objects:[],total:0})),S.siebelGetTemplates().catch(()=>({templates:[]}))]);t(m.objects),d(l.templates)}catch(m){h(m instanceof Error?m.message:"Failed to load Siebel data")}finally{x(!1)}},[]);return s.useEffect(()=>{c()},[c]),{objects:o,templates:a,loading:u,error:b,refresh:c}}function P(o){const[t,a]=s.useState(""),[d,u]=s.useState(["business_component"]),[x,b]=s.useState(""),[h,c]=s.useState(null),[m,l]=s.useState(""),[n,i]=s.useState(null),[g,v]=s.useState(!1),N=s.useCallback(f=>{u(y=>y.includes(f)?y.filter(w=>w!==f):[...y,f])},[]),j=s.useCallback(async()=>{if(t.trim()){v(!0),i(null);try{const f=await S.siebelPrepareGeneration({description:t,objectTypes:d,basedOnProject:x||void 0});c(f.prompt)}catch(f){c(`Error: ${f instanceof Error?f.message:String(f)}`)}finally{v(!1)}}},[t,d,x]),r=s.useCallback(async()=>{if(m.trim()){v(!0);try{const f=await S.siebelFinalizeGeneration({generatedXml:m,description:t,objectTypes:d});i(f),o==null||o()}catch(f){i({sifContent:"",objects:[],validation:{status:"invalid",messages:[{level:"error",message:f instanceof Error?f.message:String(f)}],score:0},metadata:{generatedAt:new Date().toISOString(),requestDescription:t,objectCount:0}})}finally{v(!1)}}},[m,t,d,o]),p=s.useCallback(()=>{if(!(n!=null&&n.sifContent))return;const f=new Blob([n.sifContent],{type:"application/xml"}),y=URL.createObjectURL(f),w=document.createElement("a");w.href=y,w.download="generated.sif",w.click(),URL.revokeObjectURL(y)},[n]);return{description:t,setDescription:a,selectedTypes:d,toggleType:N,project:x,setProject:b,prompt:h,xml:m,setXml:l,result:n,loading:g,prepare:j,finalize:r,download:p}}function I(){const[o,t]=s.useState(null),[a,d]=s.useState(0),[u,x]=s.useState("idle"),[b,h]=s.useState(null),c=s.useRef(null);s.useEffect(()=>()=>{var n;(n=c.current)==null||n.terminate()},[]);const m=s.useCallback(n=>{t(null),h(null),d(0),x("reading"),n.text().then(i=>{var v;d(10),x("parsing"),(v=c.current)==null||v.terminate();const g=new Worker(new URL("/assets/sif-parse.worker-DZrybOHz.js",import.meta.url),{type:"module"});c.current=g,g.onmessage=N=>{const j=N.data;j.type==="progress"?(d(j.progress),x(j.status)):j.type==="result"?(t(j.data),x("done"),d(100),g.terminate(),c.current=null):j.type==="error"&&(h(j.message),x("error"),g.terminate(),c.current=null)},g.onerror=N=>{h(N.message||"Worker error"),x("error"),g.terminate(),c.current=null},g.postMessage({type:"parse",content:i,fileName:n.name})}).catch(i=>{h(i instanceof Error?i.message:"Failed to read file"),x("error")})},[]),l=s.useCallback(()=>{var n;(n=c.current)==null||n.terminate(),c.current=null,t(null),d(0),x("idle"),h(null)},[]);return{parse:m,result:o,progress:a,status:u,error:b,reset:l}}const F={idle:"",reading:"Reading file...",parsing:"Parsing XML...",extracting:"Extracting objects...",inferring:"Inferring dependencies...",done:"Done!",error:"Error"},R=s.memo(function({status:t,progress:a,error:d}){if(t==="idle")return null;const u=t==="error",x=t==="done";return e.jsxs("div",{className:"space-y-1.5",role:"status","aria-live":"polite",children:[e.jsxs("div",{className:"flex items-center justify-between text-xs",children:[e.jsx("span",{className:u?"text-red-500":x?"text-green-500":"text-muted",children:u?d:F[t]}),!u&&e.jsxs("span",{className:"text-[10px] text-muted",children:[a,"%"]})]}),!u&&e.jsx("div",{className:"h-1.5 rounded-full bg-surface overflow-hidden",children:e.jsx("div",{className:`h-full rounded-full transition-all duration-300 ${x?"bg-green-500":"bg-accent"}`,style:{width:`${a}%`}})})]})});function $({onUploaded:o}){const[t,a]=s.useState(null),[d,u]=s.useState(!1),[x,b]=s.useState(!1),h=s.useRef(null),c=s.useRef(null),m=I();s.useEffect(()=>{if(m.status!=="done"||!m.result)return;const r=m.result.metadata.fileName;(async()=>{try{l.current&&(await S.siebelImportSif(l.current,r,!0),l.current=null,o())}catch{}})()},[m.status,m.result,o]);const l=s.useRef(null),n=s.useCallback(r=>{r.text().then(p=>{l.current=p,m.parse(r)}).catch(()=>{(async()=>{try{const p=await r.text();await S.siebelImportSif(p,r.name,!0),o()}catch{}})()})},[m,o]),i=s.useCallback(async r=>{try{a("Uploading documentation...");const p=await S.siebelUploadDocs(r);a(`Indexed: ${p.fileName} (${p.chunksIndexed} chunks)`),o()}catch(p){a(`Error: ${p instanceof Error?p.message:String(p)}`)}},[o]),g=s.useCallback(r=>{var f;const p=(f=r.target.files)==null?void 0:f[0];p&&n(p),h.current&&(h.current.value="")},[n]),v=s.useCallback(r=>{var f;const p=(f=r.target.files)==null?void 0:f[0];p&&i(p),c.current&&(c.current.value="")},[i]),N=s.useCallback((r,p,f)=>{r.preventDefault(),f(!1);const y=r.dataTransfer.files[0];y&&p(y)},[]),j=s.useCallback(r=>{r.preventDefault(),r.stopPropagation()},[]);return e.jsxs("div",{className:"p-4 space-y-4",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-sm font-semibold mb-1",children:"Upload & Context"}),e.jsx("p",{className:"text-xs text-muted",children:"Upload SIF files and documentation to build RAG context for generation"})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:`relative border-2 border-dashed rounded-lg p-6 text-center transition-colors cursor-pointer ${d?"border-accent bg-accent/5":"border-edge hover:border-accent/50"}`,onDragEnter:r=>{j(r),u(!0)},onDragOver:r=>{j(r),u(!0)},onDragLeave:r=>{j(r),u(!1)},onDrop:r=>N(r,n,u),onClick:()=>{var r;return(r=h.current)==null?void 0:r.click()},role:"button",tabIndex:0,onKeyDown:r=>{var p;(r.key==="Enter"||r.key===" ")&&((p=h.current)==null||p.click())},"aria-label":"Upload SIF file",children:[e.jsx("input",{ref:h,type:"file",accept:".sif,.xml",onChange:g,className:"hidden",tabIndex:-1}),e.jsx("svg",{className:"w-8 h-8 mx-auto mb-2 text-muted",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19.5 14.25v-2.625a3.375 3.375 0 00-3.375-3.375h-1.5A1.125 1.125 0 0113.5 7.125v-1.5a3.375 3.375 0 00-3.375-3.375H8.25m6.75 12l-3-3m0 0l-3 3m3-3v6m-1.5-15H5.625c-.621 0-1.125.504-1.125 1.125v17.25c0 .621.504 1.125 1.125 1.125h12.75c.621 0 1.125-.504 1.125-1.125V11.25a9 9 0 00-9-9z"})}),e.jsx("p",{className:"text-xs font-medium",children:"SIF File (.sif, .xml)"}),e.jsx("p",{className:"text-[10px] text-muted mt-1",children:"Drop here or click to browse"})]}),e.jsxs("div",{className:`relative border-2 border-dashed rounded-lg p-6 text-center transition-colors cursor-pointer ${x?"border-accent bg-accent/5":"border-edge hover:border-accent/50"}`,onDragEnter:r=>{j(r),b(!0)},onDragOver:r=>{j(r),b(!0)},onDragLeave:r=>{j(r),b(!1)},onDrop:r=>N(r,i,b),onClick:()=>{var r;return(r=c.current)==null?void 0:r.click()},role:"button",tabIndex:0,onKeyDown:r=>{var p;(r.key==="Enter"||r.key===" ")&&((p=c.current)==null||p.click())},"aria-label":"Upload documentation file",children:[e.jsx("input",{ref:c,type:"file",accept:".pdf,.html,.htm,.txt,.md,.doc,.docx",onChange:v,className:"hidden",tabIndex:-1}),e.jsx("svg",{className:"w-8 h-8 mx-auto mb-2 text-muted",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 6.042A8.967 8.967 0 006 3.75c-1.052 0-2.062.18-3 .512v14.25A8.987 8.987 0 016 18c2.305 0 4.408.867 6 2.292m0-14.25a8.966 8.966 0 016-2.292c1.052 0 2.062.18 3 .512v14.25A8.987 8.987 0 0018 18a8.967 8.967 0 00-6 2.292m0-14.25v14.25"})}),e.jsx("p",{className:"text-xs font-medium",children:"Documentation"}),e.jsx("p",{className:"text-[10px] text-muted mt-1",children:"PDF, HTML, DOC, DOCX, TXT, MD"})]})]}),m.status!=="idle"&&e.jsx(R,{status:m.status,progress:m.progress,error:m.error}),t&&e.jsx("div",{className:`px-3 py-2 rounded-md text-xs ${t.startsWith("Error")?"bg-red-500/10 text-red-500":"bg-green-500/10 text-green-500"}`,role:"status","aria-live":"polite",children:t})]})}const C=36;function M({objects:o}){const[t,a]=s.useState(""),[d,u]=s.useState(new Set),x=s.useDeferredValue(t),b=s.useDeferredValue(d),h=s.useMemo(()=>{const l=new Set;for(const n of o)n.siebelType&&l.add(n.siebelType);return[...l].sort()},[o]),c=s.useMemo(()=>{let l=o;if(x){const n=x.toLowerCase();l=l.filter(i=>{var g;return i.title.toLowerCase().includes(n)||((g=i.siebelProject)==null?void 0:g.toLowerCase().includes(n))||i.contentPreview.toLowerCase().includes(n)})}return b.size>0&&(l=l.filter(n=>n.siebelType&&b.has(n.siebelType))),l},[o,x,b]),m=l=>{u(n=>{const i=new Set(n);return i.has(l)?i.delete(l):i.add(l),i})};return e.jsxs("div",{className:"h-full flex flex-col",children:[e.jsxs("div",{className:"p-4 space-y-3 border-b border-edge",children:[e.jsx("div",{className:"flex items-center justify-between",children:e.jsxs("h3",{className:"text-sm font-semibold",children:["Indexed Siebel Objects",e.jsxs("span",{className:"ml-2 text-xs font-normal text-muted",children:[c.length,c.length!==o.length?` / ${o.length}`:""," objects"]})]})}),e.jsx("input",{type:"text",value:t,onChange:l=>a(l.target.value),placeholder:"Search objects...","aria-label":"Search Siebel objects",className:"w-full px-3 py-1.5 text-xs rounded-md border border-edge bg-surface text-foreground placeholder:text-muted focus:outline-none focus:ring-1 focus:ring-accent"}),h.length>0&&e.jsx("div",{className:"flex flex-wrap gap-1",children:h.map(l=>{const n=k[l]||"#6b7280",i=d.has(l);return e.jsx("button",{onClick:()=>m(l),"aria-label":`Filter by ${l}`,"aria-pressed":i,className:"px-2 py-0.5 text-[10px] rounded-md border transition-colors cursor-pointer",style:{borderColor:i?n:"var(--color-border)",backgroundColor:i?`${n}15`:"transparent",color:i?n:"var(--color-text-muted)"},children:l.replace(/_/g," ")},l)})})]}),c.length===0?e.jsx("div",{className:"flex-1 flex items-center justify-center text-xs text-muted",children:o.length===0?"No Siebel objects indexed yet. Upload a .sif file.":"No objects match the current filters."}):e.jsx("div",{className:"flex-1 overflow-auto",style:{contentVisibility:"auto",containIntrinsicSize:`0 ${c.length*C}px`},children:e.jsxs("table",{className:"w-full text-xs",children:[e.jsx("thead",{className:"sticky top-0 bg-surface-alt z-10",children:e.jsxs("tr",{className:"border-b border-edge",children:[e.jsx("th",{className:"text-left px-4 py-2 font-medium",children:"Name"}),e.jsx("th",{className:"text-left px-4 py-2 font-medium",children:"Type"}),e.jsx("th",{className:"text-left px-4 py-2 font-medium",children:"Project"}),e.jsx("th",{className:"text-left px-4 py-2 font-medium",children:"Preview"})]})}),e.jsx("tbody",{children:c.map((l,n)=>{const i=k[l.siebelType??""]||"#6b7280";return e.jsxs("tr",{className:"border-b border-edge hover:bg-surface transition-colors",style:{height:C},children:[e.jsx("td",{className:"px-4 py-1.5 font-mono",children:l.title}),e.jsx("td",{className:"px-4 py-1.5",children:e.jsx("span",{className:"px-1.5 py-0.5 rounded text-[10px]",style:{backgroundColor:`${i}15`,color:i},children:l.siebelType??l.sourceType})}),e.jsx("td",{className:"px-4 py-1.5 text-muted",children:l.siebelProject??"-"}),e.jsx("td",{className:"px-4 py-1.5 text-muted truncate max-w-xs",children:l.contentPreview})]},n)})})]})})]})}function O({templates:o,gen:t}){return e.jsx("div",{className:"h-full overflow-auto",children:e.jsxs("div",{className:"p-4 space-y-4",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-sm font-semibold mb-1",children:"SIF Generation"}),e.jsx("p",{className:"text-xs text-muted",children:"Describe what you need, generate context for the LLM, then validate the output"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-medium mb-1",htmlFor:"gen-description",children:"Description"}),e.jsx("textarea",{id:"gen-description",value:t.description,onChange:a=>t.setDescription(a.target.value),placeholder:"e.g., Create a Business Component for Service Requests with fields: SR Number, Status, Priority",rows:3,className:"w-full px-3 py-2 text-xs rounded-md border border-edge bg-surface text-foreground placeholder:text-muted focus:outline-none focus:ring-1 focus:ring-accent"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-medium mb-1.5",children:"Object Types"}),e.jsx("div",{className:"flex flex-wrap gap-1.5",children:o.map(a=>e.jsx("button",{onClick:()=>t.toggleType(a.type),"aria-label":`Toggle ${a.type}`,"aria-pressed":t.selectedTypes.includes(a.type),className:`px-2 py-1 text-[10px] rounded-md border transition-colors cursor-pointer ${t.selectedTypes.includes(a.type)?"bg-accent text-white border-accent":"bg-transparent text-muted border-edge hover:border-accent"}`,children:a.type.replace(/_/g," ")},a.type))})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-medium mb-1",htmlFor:"gen-project",children:"Base Project (optional)"}),e.jsx("input",{id:"gen-project",value:t.project,onChange:a=>t.setProject(a.target.value),placeholder:"e.g., Account (SSE)",className:"w-full px-3 py-1.5 text-xs rounded-md border border-edge bg-surface text-foreground placeholder:text-muted focus:outline-none focus:ring-1 focus:ring-accent"})]}),e.jsx("button",{onClick:t.prepare,disabled:!t.description.trim()||t.loading,className:"px-4 py-1.5 text-xs font-medium rounded-md bg-accent text-white hover:opacity-90 disabled:opacity-50 transition-opacity cursor-pointer disabled:cursor-not-allowed",children:t.loading&&!t.prompt?"Generating Context...":"Generate Context & Prompt"}),t.prompt&&e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between mb-1",children:[e.jsx("label",{className:"text-xs font-medium",children:"Generated Prompt (copy to LLM)"}),e.jsx("button",{onClick:()=>navigator.clipboard.writeText(t.prompt??""),"aria-label":"Copy prompt to clipboard",className:"text-[10px] px-2 py-0.5 rounded bg-surface text-muted hover:text-foreground border border-edge cursor-pointer transition-colors",children:"Copy"})]}),e.jsxs("pre",{className:"text-[10px] p-3 rounded-md bg-surface border border-edge max-h-48 overflow-auto whitespace-pre-wrap text-muted",children:[t.prompt.slice(0,3e3),t.prompt.length>3e3&&`
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/graph-section-D5y4S3T1.js","assets/index-DrvFzUJS.js","assets/index-BcMjWikL.css","assets/style-DeKQIW_i.js","assets/index-C13O-yj1.js","assets/style-BZV40eAE.css","assets/constants-DLyESMjx.js","assets/index-CAOXRHQq.js"])))=>i.map(i=>d[i]);
2
+ import{r as s,j as e,a as S,_ as L}from"./index-DrvFzUJS.js";import{e as k}from"./constants-DLyESMjx.js";const D=[{id:"upload",label:"Upload",icon:"M3 16.5v2.25A2.25 2.25 0 005.25 21h13.5A2.25 2.25 0 0021 18.75V16.5m-13.5-9L12 3m0 0l4.5 4.5M12 3v13.5"},{id:"objects",label:"Objects",icon:"M3.75 12h16.5m-16.5 3.75h16.5M3.75 19.5h16.5M5.625 4.5h12.75a1.875 1.875 0 010 3.75H5.625a1.875 1.875 0 010-3.75z"},{id:"graph",label:"Graph",icon:"M7.5 14.25v2.25m3-4.5v4.5m3-6.75v6.75m3-9v9M6 20.25h12A2.25 2.25 0 0020.25 18V6A2.25 2.25 0 0018 3.75H6A2.25 2.25 0 003.75 6v12A2.25 2.25 0 006 20.25z"},{id:"generation",label:"Generation",icon:"M9.813 15.904L9 18.75l-.813-2.846a4.5 4.5 0 00-3.09-3.09L2.25 12l2.846-.813a4.5 4.5 0 003.09-3.09L9 5.25l.813 2.846a4.5 4.5 0 003.09 3.09L15.75 12l-2.846.813a4.5 4.5 0 00-3.09 3.09zM18.259 8.715L18 9.75l-.259-1.035a3.375 3.375 0 00-2.455-2.456L14.25 6l1.036-.259a3.375 3.375 0 002.455-2.456L18 2.25l.259 1.035a3.375 3.375 0 002.455 2.456L21.75 6l-1.036.259a3.375 3.375 0 00-2.455 2.456z"}],T=s.memo(function({activeSection:t,onSectionChange:a,objectCount:d}){return e.jsxs("nav",{className:"w-48 flex-shrink-0 border-r border-edge bg-surface-alt flex flex-col","aria-label":"Siebel sections",children:[e.jsx("div",{className:"px-3 py-3 border-b border-edge",children:e.jsx("h2",{className:"text-xs font-semibold uppercase text-muted tracking-wider",children:"Siebel"})}),e.jsx("div",{className:"flex-1 py-1",children:D.map(u=>e.jsxs("button",{onClick:()=>a(u.id),"aria-label":`Navigate to ${u.label}`,className:`w-full flex items-center gap-2.5 px-3 py-2 text-xs font-medium transition-colors cursor-pointer ${t===u.id?"bg-accent/10 text-accent border-r-2 border-accent":"text-muted hover:text-foreground hover:bg-surface"}`,children:[e.jsx("svg",{className:"w-4 h-4 flex-shrink-0",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:u.icon})}),e.jsx("span",{children:u.label}),u.id==="objects"&&d>0&&e.jsx("span",{className:"ml-auto text-[10px] px-1.5 py-0.5 rounded-full bg-surface text-muted",children:d})]},u.id))})]})});function E(){const[o,t]=s.useState([]),[a,d]=s.useState([]),[u,x]=s.useState(!0),[b,h]=s.useState(null),c=s.useCallback(async()=>{try{x(!0),h(null);const[m,l]=await Promise.all([S.siebelGetObjects({limit:100}).catch(()=>({objects:[],total:0})),S.siebelGetTemplates().catch(()=>({templates:[]}))]);t(m.objects),d(l.templates)}catch(m){h(m instanceof Error?m.message:"Failed to load Siebel data")}finally{x(!1)}},[]);return s.useEffect(()=>{c()},[c]),{objects:o,templates:a,loading:u,error:b,refresh:c}}function P(o){const[t,a]=s.useState(""),[d,u]=s.useState(["business_component"]),[x,b]=s.useState(""),[h,c]=s.useState(null),[m,l]=s.useState(""),[n,i]=s.useState(null),[g,v]=s.useState(!1),N=s.useCallback(f=>{u(y=>y.includes(f)?y.filter(w=>w!==f):[...y,f])},[]),j=s.useCallback(async()=>{if(t.trim()){v(!0),i(null);try{const f=await S.siebelPrepareGeneration({description:t,objectTypes:d,basedOnProject:x||void 0});c(f.prompt)}catch(f){c(`Error: ${f instanceof Error?f.message:String(f)}`)}finally{v(!1)}}},[t,d,x]),r=s.useCallback(async()=>{if(m.trim()){v(!0);try{const f=await S.siebelFinalizeGeneration({generatedXml:m,description:t,objectTypes:d});i(f),o==null||o()}catch(f){i({sifContent:"",objects:[],validation:{status:"invalid",messages:[{level:"error",message:f instanceof Error?f.message:String(f)}],score:0},metadata:{generatedAt:new Date().toISOString(),requestDescription:t,objectCount:0}})}finally{v(!1)}}},[m,t,d,o]),p=s.useCallback(()=>{if(!(n!=null&&n.sifContent))return;const f=new Blob([n.sifContent],{type:"application/xml"}),y=URL.createObjectURL(f),w=document.createElement("a");w.href=y,w.download="generated.sif",w.click(),URL.revokeObjectURL(y)},[n]);return{description:t,setDescription:a,selectedTypes:d,toggleType:N,project:x,setProject:b,prompt:h,xml:m,setXml:l,result:n,loading:g,prepare:j,finalize:r,download:p}}function I(){const[o,t]=s.useState(null),[a,d]=s.useState(0),[u,x]=s.useState("idle"),[b,h]=s.useState(null),c=s.useRef(null);s.useEffect(()=>()=>{var n;(n=c.current)==null||n.terminate()},[]);const m=s.useCallback(n=>{t(null),h(null),d(0),x("reading"),n.text().then(i=>{var v;d(10),x("parsing"),(v=c.current)==null||v.terminate();const g=new Worker(new URL("/assets/sif-parse.worker-Cty_N-lP.js",import.meta.url),{type:"module"});c.current=g,g.onmessage=N=>{const j=N.data;j.type==="progress"?(d(j.progress),x(j.status)):j.type==="result"?(t(j.data),x("done"),d(100),g.terminate(),c.current=null):j.type==="error"&&(h(j.message),x("error"),g.terminate(),c.current=null)},g.onerror=N=>{h(N.message||"Worker error"),x("error"),g.terminate(),c.current=null},g.postMessage({type:"parse",content:i,fileName:n.name})}).catch(i=>{h(i instanceof Error?i.message:"Failed to read file"),x("error")})},[]),l=s.useCallback(()=>{var n;(n=c.current)==null||n.terminate(),c.current=null,t(null),d(0),x("idle"),h(null)},[]);return{parse:m,result:o,progress:a,status:u,error:b,reset:l}}const F={idle:"",reading:"Reading file...",parsing:"Parsing XML...",extracting:"Extracting objects...",inferring:"Inferring dependencies...",done:"Done!",error:"Error"},R=s.memo(function({status:t,progress:a,error:d}){if(t==="idle")return null;const u=t==="error",x=t==="done";return e.jsxs("div",{className:"space-y-1.5",role:"status","aria-live":"polite",children:[e.jsxs("div",{className:"flex items-center justify-between text-xs",children:[e.jsx("span",{className:u?"text-red-500":x?"text-green-500":"text-muted",children:u?d:F[t]}),!u&&e.jsxs("span",{className:"text-[10px] text-muted",children:[a,"%"]})]}),!u&&e.jsx("div",{className:"h-1.5 rounded-full bg-surface overflow-hidden",children:e.jsx("div",{className:`h-full rounded-full transition-all duration-300 ${x?"bg-green-500":"bg-accent"}`,style:{width:`${a}%`}})})]})});function $({onUploaded:o}){const[t,a]=s.useState(null),[d,u]=s.useState(!1),[x,b]=s.useState(!1),h=s.useRef(null),c=s.useRef(null),m=I();s.useEffect(()=>{if(m.status!=="done"||!m.result)return;const r=m.result.metadata.fileName;(async()=>{try{l.current&&(await S.siebelImportSif(l.current,r,!0),l.current=null,o())}catch{}})()},[m.status,m.result,o]);const l=s.useRef(null),n=s.useCallback(r=>{r.text().then(p=>{l.current=p,m.parse(r)}).catch(()=>{(async()=>{try{const p=await r.text();await S.siebelImportSif(p,r.name,!0),o()}catch{}})()})},[m,o]),i=s.useCallback(async r=>{try{a("Uploading documentation...");const p=await S.siebelUploadDocs(r);a(`Indexed: ${p.fileName} (${p.chunksIndexed} chunks)`),o()}catch(p){a(`Error: ${p instanceof Error?p.message:String(p)}`)}},[o]),g=s.useCallback(r=>{var f;const p=(f=r.target.files)==null?void 0:f[0];p&&n(p),h.current&&(h.current.value="")},[n]),v=s.useCallback(r=>{var f;const p=(f=r.target.files)==null?void 0:f[0];p&&i(p),c.current&&(c.current.value="")},[i]),N=s.useCallback((r,p,f)=>{r.preventDefault(),f(!1);const y=r.dataTransfer.files[0];y&&p(y)},[]),j=s.useCallback(r=>{r.preventDefault(),r.stopPropagation()},[]);return e.jsxs("div",{className:"p-4 space-y-4",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-sm font-semibold mb-1",children:"Upload & Context"}),e.jsx("p",{className:"text-xs text-muted",children:"Upload SIF files and documentation to build RAG context for generation"})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:`relative border-2 border-dashed rounded-lg p-6 text-center transition-colors cursor-pointer ${d?"border-accent bg-accent/5":"border-edge hover:border-accent/50"}`,onDragEnter:r=>{j(r),u(!0)},onDragOver:r=>{j(r),u(!0)},onDragLeave:r=>{j(r),u(!1)},onDrop:r=>N(r,n,u),onClick:()=>{var r;return(r=h.current)==null?void 0:r.click()},role:"button",tabIndex:0,onKeyDown:r=>{var p;(r.key==="Enter"||r.key===" ")&&((p=h.current)==null||p.click())},"aria-label":"Upload SIF file",children:[e.jsx("input",{ref:h,type:"file",accept:".sif,.xml",onChange:g,className:"hidden",tabIndex:-1}),e.jsx("svg",{className:"w-8 h-8 mx-auto mb-2 text-muted",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19.5 14.25v-2.625a3.375 3.375 0 00-3.375-3.375h-1.5A1.125 1.125 0 0113.5 7.125v-1.5a3.375 3.375 0 00-3.375-3.375H8.25m6.75 12l-3-3m0 0l-3 3m3-3v6m-1.5-15H5.625c-.621 0-1.125.504-1.125 1.125v17.25c0 .621.504 1.125 1.125 1.125h12.75c.621 0 1.125-.504 1.125-1.125V11.25a9 9 0 00-9-9z"})}),e.jsx("p",{className:"text-xs font-medium",children:"SIF File (.sif, .xml)"}),e.jsx("p",{className:"text-[10px] text-muted mt-1",children:"Drop here or click to browse"})]}),e.jsxs("div",{className:`relative border-2 border-dashed rounded-lg p-6 text-center transition-colors cursor-pointer ${x?"border-accent bg-accent/5":"border-edge hover:border-accent/50"}`,onDragEnter:r=>{j(r),b(!0)},onDragOver:r=>{j(r),b(!0)},onDragLeave:r=>{j(r),b(!1)},onDrop:r=>N(r,i,b),onClick:()=>{var r;return(r=c.current)==null?void 0:r.click()},role:"button",tabIndex:0,onKeyDown:r=>{var p;(r.key==="Enter"||r.key===" ")&&((p=c.current)==null||p.click())},"aria-label":"Upload documentation file",children:[e.jsx("input",{ref:c,type:"file",accept:".pdf,.html,.htm,.txt,.md,.doc,.docx",onChange:v,className:"hidden",tabIndex:-1}),e.jsx("svg",{className:"w-8 h-8 mx-auto mb-2 text-muted",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 6.042A8.967 8.967 0 006 3.75c-1.052 0-2.062.18-3 .512v14.25A8.987 8.987 0 016 18c2.305 0 4.408.867 6 2.292m0-14.25a8.966 8.966 0 016-2.292c1.052 0 2.062.18 3 .512v14.25A8.987 8.987 0 0018 18a8.967 8.967 0 00-6 2.292m0-14.25v14.25"})}),e.jsx("p",{className:"text-xs font-medium",children:"Documentation"}),e.jsx("p",{className:"text-[10px] text-muted mt-1",children:"PDF, HTML, DOC, DOCX, TXT, MD"})]})]}),m.status!=="idle"&&e.jsx(R,{status:m.status,progress:m.progress,error:m.error}),t&&e.jsx("div",{className:`px-3 py-2 rounded-md text-xs ${t.startsWith("Error")?"bg-red-500/10 text-red-500":"bg-green-500/10 text-green-500"}`,role:"status","aria-live":"polite",children:t})]})}const C=36;function M({objects:o}){const[t,a]=s.useState(""),[d,u]=s.useState(new Set),x=s.useDeferredValue(t),b=s.useDeferredValue(d),h=s.useMemo(()=>{const l=new Set;for(const n of o)n.siebelType&&l.add(n.siebelType);return[...l].sort()},[o]),c=s.useMemo(()=>{let l=o;if(x){const n=x.toLowerCase();l=l.filter(i=>{var g;return i.title.toLowerCase().includes(n)||((g=i.siebelProject)==null?void 0:g.toLowerCase().includes(n))||i.contentPreview.toLowerCase().includes(n)})}return b.size>0&&(l=l.filter(n=>n.siebelType&&b.has(n.siebelType))),l},[o,x,b]),m=l=>{u(n=>{const i=new Set(n);return i.has(l)?i.delete(l):i.add(l),i})};return e.jsxs("div",{className:"h-full flex flex-col",children:[e.jsxs("div",{className:"p-4 space-y-3 border-b border-edge",children:[e.jsx("div",{className:"flex items-center justify-between",children:e.jsxs("h3",{className:"text-sm font-semibold",children:["Indexed Siebel Objects",e.jsxs("span",{className:"ml-2 text-xs font-normal text-muted",children:[c.length,c.length!==o.length?` / ${o.length}`:""," objects"]})]})}),e.jsx("input",{type:"text",value:t,onChange:l=>a(l.target.value),placeholder:"Search objects...","aria-label":"Search Siebel objects",className:"w-full px-3 py-1.5 text-xs rounded-md border border-edge bg-surface text-foreground placeholder:text-muted focus:outline-none focus:ring-1 focus:ring-accent"}),h.length>0&&e.jsx("div",{className:"flex flex-wrap gap-1",children:h.map(l=>{const n=k[l]||"#6b7280",i=d.has(l);return e.jsx("button",{onClick:()=>m(l),"aria-label":`Filter by ${l}`,"aria-pressed":i,className:"px-2 py-0.5 text-[10px] rounded-md border transition-colors cursor-pointer",style:{borderColor:i?n:"var(--color-border)",backgroundColor:i?`${n}15`:"transparent",color:i?n:"var(--color-text-muted)"},children:l.replace(/_/g," ")},l)})})]}),c.length===0?e.jsx("div",{className:"flex-1 flex items-center justify-center text-xs text-muted",children:o.length===0?"No Siebel objects indexed yet. Upload a .sif file.":"No objects match the current filters."}):e.jsx("div",{className:"flex-1 overflow-auto",style:{contentVisibility:"auto",containIntrinsicSize:`0 ${c.length*C}px`},children:e.jsxs("table",{className:"w-full text-xs",children:[e.jsx("thead",{className:"sticky top-0 bg-surface-alt z-10",children:e.jsxs("tr",{className:"border-b border-edge",children:[e.jsx("th",{className:"text-left px-4 py-2 font-medium",children:"Name"}),e.jsx("th",{className:"text-left px-4 py-2 font-medium",children:"Type"}),e.jsx("th",{className:"text-left px-4 py-2 font-medium",children:"Project"}),e.jsx("th",{className:"text-left px-4 py-2 font-medium",children:"Preview"})]})}),e.jsx("tbody",{children:c.map((l,n)=>{const i=k[l.siebelType??""]||"#6b7280";return e.jsxs("tr",{className:"border-b border-edge hover:bg-surface transition-colors",style:{height:C},children:[e.jsx("td",{className:"px-4 py-1.5 font-mono",children:l.title}),e.jsx("td",{className:"px-4 py-1.5",children:e.jsx("span",{className:"px-1.5 py-0.5 rounded text-[10px]",style:{backgroundColor:`${i}15`,color:i},children:l.siebelType??l.sourceType})}),e.jsx("td",{className:"px-4 py-1.5 text-muted",children:l.siebelProject??"-"}),e.jsx("td",{className:"px-4 py-1.5 text-muted truncate max-w-xs",children:l.contentPreview})]},n)})})]})})]})}function O({templates:o,gen:t}){return e.jsx("div",{className:"h-full overflow-auto",children:e.jsxs("div",{className:"p-4 space-y-4",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-sm font-semibold mb-1",children:"SIF Generation"}),e.jsx("p",{className:"text-xs text-muted",children:"Describe what you need, generate context for the LLM, then validate the output"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-medium mb-1",htmlFor:"gen-description",children:"Description"}),e.jsx("textarea",{id:"gen-description",value:t.description,onChange:a=>t.setDescription(a.target.value),placeholder:"e.g., Create a Business Component for Service Requests with fields: SR Number, Status, Priority",rows:3,className:"w-full px-3 py-2 text-xs rounded-md border border-edge bg-surface text-foreground placeholder:text-muted focus:outline-none focus:ring-1 focus:ring-accent"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-medium mb-1.5",children:"Object Types"}),e.jsx("div",{className:"flex flex-wrap gap-1.5",children:o.map(a=>e.jsx("button",{onClick:()=>t.toggleType(a.type),"aria-label":`Toggle ${a.type}`,"aria-pressed":t.selectedTypes.includes(a.type),className:`px-2 py-1 text-[10px] rounded-md border transition-colors cursor-pointer ${t.selectedTypes.includes(a.type)?"bg-accent text-white border-accent":"bg-transparent text-muted border-edge hover:border-accent"}`,children:a.type.replace(/_/g," ")},a.type))})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-medium mb-1",htmlFor:"gen-project",children:"Base Project (optional)"}),e.jsx("input",{id:"gen-project",value:t.project,onChange:a=>t.setProject(a.target.value),placeholder:"e.g., Account (SSE)",className:"w-full px-3 py-1.5 text-xs rounded-md border border-edge bg-surface text-foreground placeholder:text-muted focus:outline-none focus:ring-1 focus:ring-accent"})]}),e.jsx("button",{onClick:t.prepare,disabled:!t.description.trim()||t.loading,className:"px-4 py-1.5 text-xs font-medium rounded-md bg-accent text-white hover:opacity-90 disabled:opacity-50 transition-opacity cursor-pointer disabled:cursor-not-allowed",children:t.loading&&!t.prompt?"Generating Context...":"Generate Context & Prompt"}),t.prompt&&e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between mb-1",children:[e.jsx("label",{className:"text-xs font-medium",children:"Generated Prompt (copy to LLM)"}),e.jsx("button",{onClick:()=>navigator.clipboard.writeText(t.prompt??""),"aria-label":"Copy prompt to clipboard",className:"text-[10px] px-2 py-0.5 rounded bg-surface text-muted hover:text-foreground border border-edge cursor-pointer transition-colors",children:"Copy"})]}),e.jsxs("pre",{className:"text-[10px] p-3 rounded-md bg-surface border border-edge max-h-48 overflow-auto whitespace-pre-wrap text-muted",children:[t.prompt.slice(0,3e3),t.prompt.length>3e3&&`
3
3
 
4
- ... (truncated for display)`]})]}),t.prompt&&e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-medium mb-1",htmlFor:"gen-xml",children:"Paste LLM-generated SIF XML"}),e.jsx("textarea",{id:"gen-xml",value:t.xml,onChange:a=>t.setXml(a.target.value),placeholder:'Paste the XML output from the LLM here (starting with <?xml version="1.0"...)',rows:8,className:"w-full px-3 py-2 text-xs font-mono rounded-md border border-edge bg-surface text-foreground placeholder:text-muted focus:outline-none focus:ring-1 focus:ring-accent"}),e.jsx("button",{onClick:t.finalize,disabled:!t.xml.trim()||t.loading,className:"mt-2 px-4 py-1.5 text-xs font-medium rounded-md bg-green-600 text-white hover:opacity-90 disabled:opacity-50 transition-opacity cursor-pointer disabled:cursor-not-allowed",children:t.loading?"Validating...":"Validate & Finalize"})]}),t.result&&e.jsxs("div",{className:`rounded-md border p-4 space-y-2 ${t.result.validation.status==="valid"?"border-green-500/30 bg-green-500/5":t.result.validation.status==="warnings"?"border-yellow-500/30 bg-yellow-500/5":"border-red-500/30 bg-red-500/5"}`,role:"status",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:`text-sm font-bold ${t.result.validation.status==="valid"?"text-green-500":t.result.validation.status==="warnings"?"text-yellow-500":"text-red-500"}`,children:t.result.validation.status==="valid"?"Valid":t.result.validation.status==="warnings"?"Warnings":"Invalid"}),e.jsxs("span",{className:"text-xs text-muted",children:["Score: ",t.result.validation.score,"/100"]}),e.jsxs("span",{className:"text-xs text-muted",children:[t.result.metadata.objectCount," objects"]})]}),t.result.validation.status!=="invalid"&&e.jsx("button",{onClick:t.download,"aria-label":"Download generated SIF file",className:"px-3 py-1 text-xs font-medium rounded-md bg-accent text-white hover:opacity-90 cursor-pointer transition-opacity",children:"Download SIF"})]}),t.result.objects.length>0&&e.jsxs("div",{className:"text-xs text-muted",children:["Objects: ",t.result.objects.map(a=>`${a.type}:${a.name}`).join(", ")]}),t.result.validation.messages.length>0&&e.jsx("ul",{className:"space-y-0.5",children:t.result.validation.messages.map((a,d)=>e.jsxs("li",{className:`text-[10px] ${a.level==="error"?"text-red-500":a.level==="warning"?"text-yellow-600":"text-muted"}`,children:["[",a.level,"] ",a.message,a.objectName&&` (${a.objectName})`]},d))})]})]})})}const G=s.lazy(()=>L(()=>import("./graph-section-Cwx-Bmeh.js"),__vite__mapDeps([0,1,2,3,4,5,6,7])).then(o=>({default:o.GraphSection})));function A(){return e.jsx("div",{className:"flex items-center justify-center h-full text-muted text-xs",children:"Loading..."})}function U(){const[o,t]=s.useState("upload"),{objects:a,templates:d,loading:u,error:x,refresh:b}=E(),h=P(b),[c,m]=s.useState([]),[l,n]=s.useState([]),i=s.useCallback(async()=>{try{const v=await S.siebelGetGraph();m(v.objects),n(v.dependencies)}catch{}},[]);s.useEffect(()=>{i()},[i]);const g=s.useCallback(()=>{b(),i()},[b,i]);return u?e.jsx("div",{className:"flex items-center justify-center h-full text-muted",children:"Loading Siebel..."}):x?e.jsx("div",{className:"flex items-center justify-center h-full text-danger",children:x}):e.jsxs("div",{className:"h-full flex",children:[e.jsx(T,{activeSection:o,onSectionChange:t,objectCount:a.length}),e.jsxs("main",{className:"flex-1 min-w-0 overflow-hidden",children:[o==="upload"&&e.jsx($,{onUploaded:g}),o==="objects"&&e.jsx(M,{objects:a}),o==="graph"&&e.jsx(s.Suspense,{fallback:e.jsx(A,{}),children:e.jsx(G,{objects:c,dependencies:l})}),o==="generation"&&e.jsx(O,{templates:d,gen:h})]})]})}export{U as SiebelTab};
4
+ ... (truncated for display)`]})]}),t.prompt&&e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-medium mb-1",htmlFor:"gen-xml",children:"Paste LLM-generated SIF XML"}),e.jsx("textarea",{id:"gen-xml",value:t.xml,onChange:a=>t.setXml(a.target.value),placeholder:'Paste the XML output from the LLM here (starting with <?xml version="1.0"...)',rows:8,className:"w-full px-3 py-2 text-xs font-mono rounded-md border border-edge bg-surface text-foreground placeholder:text-muted focus:outline-none focus:ring-1 focus:ring-accent"}),e.jsx("button",{onClick:t.finalize,disabled:!t.xml.trim()||t.loading,className:"mt-2 px-4 py-1.5 text-xs font-medium rounded-md bg-green-600 text-white hover:opacity-90 disabled:opacity-50 transition-opacity cursor-pointer disabled:cursor-not-allowed",children:t.loading?"Validating...":"Validate & Finalize"})]}),t.result&&e.jsxs("div",{className:`rounded-md border p-4 space-y-2 ${t.result.validation.status==="valid"?"border-green-500/30 bg-green-500/5":t.result.validation.status==="warnings"?"border-yellow-500/30 bg-yellow-500/5":"border-red-500/30 bg-red-500/5"}`,role:"status",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:`text-sm font-bold ${t.result.validation.status==="valid"?"text-green-500":t.result.validation.status==="warnings"?"text-yellow-500":"text-red-500"}`,children:t.result.validation.status==="valid"?"Valid":t.result.validation.status==="warnings"?"Warnings":"Invalid"}),e.jsxs("span",{className:"text-xs text-muted",children:["Score: ",t.result.validation.score,"/100"]}),e.jsxs("span",{className:"text-xs text-muted",children:[t.result.metadata.objectCount," objects"]})]}),t.result.validation.status!=="invalid"&&e.jsx("button",{onClick:t.download,"aria-label":"Download generated SIF file",className:"px-3 py-1 text-xs font-medium rounded-md bg-accent text-white hover:opacity-90 cursor-pointer transition-opacity",children:"Download SIF"})]}),t.result.objects.length>0&&e.jsxs("div",{className:"text-xs text-muted",children:["Objects: ",t.result.objects.map(a=>`${a.type}:${a.name}`).join(", ")]}),t.result.validation.messages.length>0&&e.jsx("ul",{className:"space-y-0.5",children:t.result.validation.messages.map((a,d)=>e.jsxs("li",{className:`text-[10px] ${a.level==="error"?"text-red-500":a.level==="warning"?"text-yellow-600":"text-muted"}`,children:["[",a.level,"] ",a.message,a.objectName&&` (${a.objectName})`]},d))})]})]})})}const G=s.lazy(()=>L(()=>import("./graph-section-D5y4S3T1.js"),__vite__mapDeps([0,1,2,3,4,5,6,7])).then(o=>({default:o.GraphSection})));function A(){return e.jsx("div",{className:"flex items-center justify-center h-full text-muted text-xs",children:"Loading..."})}function z(){const[o,t]=s.useState("upload"),{objects:a,templates:d,loading:u,error:x,refresh:b}=E(),h=P(b),[c,m]=s.useState([]),[l,n]=s.useState([]),i=s.useCallback(async()=>{try{const v=await S.siebelGetGraph();m(v.objects),n(v.dependencies)}catch{}},[]);s.useEffect(()=>{i()},[i]);const g=s.useCallback(()=>{b(),i()},[b,i]);return u?e.jsx("div",{className:"flex items-center justify-center h-full text-muted",children:"Loading Siebel..."}):x?e.jsx("div",{className:"flex items-center justify-center h-full text-danger",children:x}):e.jsxs("div",{className:"h-full flex",children:[e.jsx(T,{activeSection:o,onSectionChange:t,objectCount:a.length}),e.jsxs("main",{className:"flex-1 min-w-0 overflow-hidden",children:[o==="upload"&&e.jsx($,{onUploaded:g}),o==="objects"&&e.jsx(M,{objects:a}),o==="graph"&&e.jsx(s.Suspense,{fallback:e.jsx(A,{}),children:e.jsx(G,{objects:c,dependencies:l})}),o==="generation"&&e.jsx(O,{templates:d,gen:h})]})]})}export{z as SiebelTab};