@surething/cockpit 1.0.175

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 (1095) hide show
  1. package/.next-prod/BUILD_ID +1 -0
  2. package/.next-prod/app-path-routes-manifest.json +99 -0
  3. package/.next-prod/build-manifest.json +20 -0
  4. package/.next-prod/diagnostics/build-diagnostics.json +6 -0
  5. package/.next-prod/diagnostics/framework.json +1 -0
  6. package/.next-prod/export-marker.json +6 -0
  7. package/.next-prod/images-manifest.json +67 -0
  8. package/.next-prod/next-minimal-server.js.nft.json +1 -0
  9. package/.next-prod/next-server.js.nft.json +1 -0
  10. package/.next-prod/package.json +1 -0
  11. package/.next-prod/prerender-manifest.json +119 -0
  12. package/.next-prod/react-loadable-manifest.json +4241 -0
  13. package/.next-prod/required-server-files.js +326 -0
  14. package/.next-prod/required-server-files.json +326 -0
  15. package/.next-prod/routes-manifest.json +641 -0
  16. package/.next-prod/server/app/_global-error/page.js +3 -0
  17. package/.next-prod/server/app/_global-error/page.js.nft.json +1 -0
  18. package/.next-prod/server/app/_global-error/page_client-reference-manifest.js +1 -0
  19. package/.next-prod/server/app/_global-error.html +2 -0
  20. package/.next-prod/server/app/_global-error.meta +16 -0
  21. package/.next-prod/server/app/_global-error.rsc +12 -0
  22. package/.next-prod/server/app/_global-error.segments/_full.segment.rsc +12 -0
  23. package/.next-prod/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +5 -0
  24. package/.next-prod/server/app/_global-error.segments/_global-error.segment.rsc +4 -0
  25. package/.next-prod/server/app/_global-error.segments/_head.segment.rsc +5 -0
  26. package/.next-prod/server/app/_global-error.segments/_index.segment.rsc +4 -0
  27. package/.next-prod/server/app/_global-error.segments/_tree.segment.rsc +1 -0
  28. package/.next-prod/server/app/_not-found/page.js +2 -0
  29. package/.next-prod/server/app/_not-found/page.js.nft.json +1 -0
  30. package/.next-prod/server/app/_not-found/page_client-reference-manifest.js +1 -0
  31. package/.next-prod/server/app/_not-found.html +18 -0
  32. package/.next-prod/server/app/_not-found.meta +16 -0
  33. package/.next-prod/server/app/_not-found.rsc +18 -0
  34. package/.next-prod/server/app/_not-found.segments/_full.segment.rsc +18 -0
  35. package/.next-prod/server/app/_not-found.segments/_head.segment.rsc +6 -0
  36. package/.next-prod/server/app/_not-found.segments/_index.segment.rsc +6 -0
  37. package/.next-prod/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +5 -0
  38. package/.next-prod/server/app/_not-found.segments/_not-found.segment.rsc +4 -0
  39. package/.next-prod/server/app/_not-found.segments/_tree.segment.rsc +5 -0
  40. package/.next-prod/server/app/api/bash/route.js +1 -0
  41. package/.next-prod/server/app/api/bash/route.js.nft.json +1 -0
  42. package/.next-prod/server/app/api/bash/route_client-reference-manifest.js +1 -0
  43. package/.next-prod/server/app/api/chat/route.js +5 -0
  44. package/.next-prod/server/app/api/chat/route.js.nft.json +1 -0
  45. package/.next-prod/server/app/api/chat/route_client-reference-manifest.js +1 -0
  46. package/.next-prod/server/app/api/claude-stats/route.js +1 -0
  47. package/.next-prod/server/app/api/claude-stats/route.js.nft.json +1 -0
  48. package/.next-prod/server/app/api/claude-stats/route_client-reference-manifest.js +1 -0
  49. package/.next-prod/server/app/api/commands/route.js +1 -0
  50. package/.next-prod/server/app/api/commands/route.js.nft.json +1 -0
  51. package/.next-prod/server/app/api/commands/route_client-reference-manifest.js +1 -0
  52. package/.next-prod/server/app/api/comments/route.js +1 -0
  53. package/.next-prod/server/app/api/comments/route.js.nft.json +1 -0
  54. package/.next-prod/server/app/api/comments/route_client-reference-manifest.js +1 -0
  55. package/.next-prod/server/app/api/db/columns/route.js +15 -0
  56. package/.next-prod/server/app/api/db/columns/route.js.nft.json +1 -0
  57. package/.next-prod/server/app/api/db/columns/route_client-reference-manifest.js +1 -0
  58. package/.next-prod/server/app/api/db/connect/route.js +1 -0
  59. package/.next-prod/server/app/api/db/connect/route.js.nft.json +1 -0
  60. package/.next-prod/server/app/api/db/connect/route_client-reference-manifest.js +1 -0
  61. package/.next-prod/server/app/api/db/disconnect/route.js +1 -0
  62. package/.next-prod/server/app/api/db/disconnect/route.js.nft.json +1 -0
  63. package/.next-prod/server/app/api/db/disconnect/route_client-reference-manifest.js +1 -0
  64. package/.next-prod/server/app/api/db/export/route.js +1 -0
  65. package/.next-prod/server/app/api/db/export/route.js.nft.json +1 -0
  66. package/.next-prod/server/app/api/db/export/route_client-reference-manifest.js +1 -0
  67. package/.next-prod/server/app/api/db/query/route.js +1 -0
  68. package/.next-prod/server/app/api/db/query/route.js.nft.json +1 -0
  69. package/.next-prod/server/app/api/db/query/route_client-reference-manifest.js +1 -0
  70. package/.next-prod/server/app/api/db/schemas/route.js +8 -0
  71. package/.next-prod/server/app/api/db/schemas/route.js.nft.json +1 -0
  72. package/.next-prod/server/app/api/db/schemas/route_client-reference-manifest.js +1 -0
  73. package/.next-prod/server/app/api/extension/version/route.js +1 -0
  74. package/.next-prod/server/app/api/extension/version/route.js.nft.json +1 -0
  75. package/.next-prod/server/app/api/extension/version/route_client-reference-manifest.js +1 -0
  76. package/.next-prod/server/app/api/file/route.js +1 -0
  77. package/.next-prod/server/app/api/file/route.js.nft.json +1 -0
  78. package/.next-prod/server/app/api/file/route_client-reference-manifest.js +1 -0
  79. package/.next-prod/server/app/api/files/blame/route.js +1 -0
  80. package/.next-prod/server/app/api/files/blame/route.js.nft.json +1 -0
  81. package/.next-prod/server/app/api/files/blame/route_client-reference-manifest.js +1 -0
  82. package/.next-prod/server/app/api/files/clipboard/route.js +1 -0
  83. package/.next-prod/server/app/api/files/clipboard/route.js.nft.json +1 -0
  84. package/.next-prod/server/app/api/files/clipboard/route_client-reference-manifest.js +1 -0
  85. package/.next-prod/server/app/api/files/copy/route.js +1 -0
  86. package/.next-prod/server/app/api/files/copy/route.js.nft.json +1 -0
  87. package/.next-prod/server/app/api/files/copy/route_client-reference-manifest.js +1 -0
  88. package/.next-prod/server/app/api/files/delete/route.js +1 -0
  89. package/.next-prod/server/app/api/files/delete/route.js.nft.json +1 -0
  90. package/.next-prod/server/app/api/files/delete/route_client-reference-manifest.js +1 -0
  91. package/.next-prod/server/app/api/files/expanded/route.js +1 -0
  92. package/.next-prod/server/app/api/files/expanded/route.js.nft.json +1 -0
  93. package/.next-prod/server/app/api/files/expanded/route_client-reference-manifest.js +1 -0
  94. package/.next-prod/server/app/api/files/index/route.js +1 -0
  95. package/.next-prod/server/app/api/files/index/route.js.nft.json +1 -0
  96. package/.next-prod/server/app/api/files/index/route_client-reference-manifest.js +1 -0
  97. package/.next-prod/server/app/api/files/init/route.js +1 -0
  98. package/.next-prod/server/app/api/files/init/route.js.nft.json +1 -0
  99. package/.next-prod/server/app/api/files/init/route_client-reference-manifest.js +1 -0
  100. package/.next-prod/server/app/api/files/paste/route.js +1 -0
  101. package/.next-prod/server/app/api/files/paste/route.js.nft.json +1 -0
  102. package/.next-prod/server/app/api/files/paste/route_client-reference-manifest.js +1 -0
  103. package/.next-prod/server/app/api/files/read/route.js +1 -0
  104. package/.next-prod/server/app/api/files/read/route.js.nft.json +1 -0
  105. package/.next-prod/server/app/api/files/read/route_client-reference-manifest.js +1 -0
  106. package/.next-prod/server/app/api/files/readdir/route.js +1 -0
  107. package/.next-prod/server/app/api/files/readdir/route.js.nft.json +1 -0
  108. package/.next-prod/server/app/api/files/readdir/route_client-reference-manifest.js +1 -0
  109. package/.next-prod/server/app/api/files/recent/route.js +1 -0
  110. package/.next-prod/server/app/api/files/recent/route.js.nft.json +1 -0
  111. package/.next-prod/server/app/api/files/recent/route_client-reference-manifest.js +1 -0
  112. package/.next-prod/server/app/api/files/save/route.js +1 -0
  113. package/.next-prod/server/app/api/files/save/route.js.nft.json +1 -0
  114. package/.next-prod/server/app/api/files/save/route_client-reference-manifest.js +1 -0
  115. package/.next-prod/server/app/api/files/search/route.js +1 -0
  116. package/.next-prod/server/app/api/files/search/route.js.nft.json +1 -0
  117. package/.next-prod/server/app/api/files/search/route_client-reference-manifest.js +1 -0
  118. package/.next-prod/server/app/api/git/branch-diff/route.js +1 -0
  119. package/.next-prod/server/app/api/git/branch-diff/route.js.nft.json +1 -0
  120. package/.next-prod/server/app/api/git/branch-diff/route_client-reference-manifest.js +1 -0
  121. package/.next-prod/server/app/api/git/branches/route.js +1 -0
  122. package/.next-prod/server/app/api/git/branches/route.js.nft.json +1 -0
  123. package/.next-prod/server/app/api/git/branches/route_client-reference-manifest.js +1 -0
  124. package/.next-prod/server/app/api/git/commit-diff/route.js +1 -0
  125. package/.next-prod/server/app/api/git/commit-diff/route.js.nft.json +1 -0
  126. package/.next-prod/server/app/api/git/commit-diff/route_client-reference-manifest.js +1 -0
  127. package/.next-prod/server/app/api/git/commits/route.js +1 -0
  128. package/.next-prod/server/app/api/git/commits/route.js.nft.json +1 -0
  129. package/.next-prod/server/app/api/git/commits/route_client-reference-manifest.js +1 -0
  130. package/.next-prod/server/app/api/git/diff/route.js +1 -0
  131. package/.next-prod/server/app/api/git/diff/route.js.nft.json +1 -0
  132. package/.next-prod/server/app/api/git/diff/route_client-reference-manifest.js +1 -0
  133. package/.next-prod/server/app/api/git/discard/route.js +1 -0
  134. package/.next-prod/server/app/api/git/discard/route.js.nft.json +1 -0
  135. package/.next-prod/server/app/api/git/discard/route_client-reference-manifest.js +1 -0
  136. package/.next-prod/server/app/api/git/stage/route.js +1 -0
  137. package/.next-prod/server/app/api/git/stage/route.js.nft.json +1 -0
  138. package/.next-prod/server/app/api/git/stage/route_client-reference-manifest.js +1 -0
  139. package/.next-prod/server/app/api/git/status/route.js +1 -0
  140. package/.next-prod/server/app/api/git/status/route.js.nft.json +1 -0
  141. package/.next-prod/server/app/api/git/status/route_client-reference-manifest.js +1 -0
  142. package/.next-prod/server/app/api/git/unstage/route.js +1 -0
  143. package/.next-prod/server/app/api/git/unstage/route.js.nft.json +1 -0
  144. package/.next-prod/server/app/api/git/unstage/route_client-reference-manifest.js +1 -0
  145. package/.next-prod/server/app/api/git/worktree/route.js +1 -0
  146. package/.next-prod/server/app/api/git/worktree/route.js.nft.json +1 -0
  147. package/.next-prod/server/app/api/git/worktree/route_client-reference-manifest.js +1 -0
  148. package/.next-prod/server/app/api/global-state/route.js +1 -0
  149. package/.next-prod/server/app/api/global-state/route.js.nft.json +1 -0
  150. package/.next-prod/server/app/api/global-state/route_client-reference-manifest.js +1 -0
  151. package/.next-prod/server/app/api/jupyter/load/route.js +1 -0
  152. package/.next-prod/server/app/api/jupyter/load/route.js.nft.json +1 -0
  153. package/.next-prod/server/app/api/jupyter/load/route_client-reference-manifest.js +1 -0
  154. package/.next-prod/server/app/api/jupyter/save/route.js +1 -0
  155. package/.next-prod/server/app/api/jupyter/save/route.js.nft.json +1 -0
  156. package/.next-prod/server/app/api/jupyter/save/route_client-reference-manifest.js +1 -0
  157. package/.next-prod/server/app/api/jupyter/shutdown/route.js +1 -0
  158. package/.next-prod/server/app/api/jupyter/shutdown/route.js.nft.json +1 -0
  159. package/.next-prod/server/app/api/jupyter/shutdown/route_client-reference-manifest.js +1 -0
  160. package/.next-prod/server/app/api/lsp/definition/route.js +1 -0
  161. package/.next-prod/server/app/api/lsp/definition/route.js.nft.json +1 -0
  162. package/.next-prod/server/app/api/lsp/definition/route_client-reference-manifest.js +1 -0
  163. package/.next-prod/server/app/api/lsp/hover/route.js +1 -0
  164. package/.next-prod/server/app/api/lsp/hover/route.js.nft.json +1 -0
  165. package/.next-prod/server/app/api/lsp/hover/route_client-reference-manifest.js +1 -0
  166. package/.next-prod/server/app/api/lsp/references/route.js +1 -0
  167. package/.next-prod/server/app/api/lsp/references/route.js.nft.json +1 -0
  168. package/.next-prod/server/app/api/lsp/references/route_client-reference-manifest.js +1 -0
  169. package/.next-prod/server/app/api/lsp/status/route.js +1 -0
  170. package/.next-prod/server/app/api/lsp/status/route.js.nft.json +1 -0
  171. package/.next-prod/server/app/api/lsp/status/route_client-reference-manifest.js +1 -0
  172. package/.next-prod/server/app/api/lsp/warmup/route.js +1 -0
  173. package/.next-prod/server/app/api/lsp/warmup/route.js.nft.json +1 -0
  174. package/.next-prod/server/app/api/lsp/warmup/route_client-reference-manifest.js +1 -0
  175. package/.next-prod/server/app/api/mysql/columns/route.js +9 -0
  176. package/.next-prod/server/app/api/mysql/columns/route.js.nft.json +1 -0
  177. package/.next-prod/server/app/api/mysql/columns/route_client-reference-manifest.js +1 -0
  178. package/.next-prod/server/app/api/mysql/connect/route.js +1 -0
  179. package/.next-prod/server/app/api/mysql/connect/route.js.nft.json +1 -0
  180. package/.next-prod/server/app/api/mysql/connect/route_client-reference-manifest.js +1 -0
  181. package/.next-prod/server/app/api/mysql/disconnect/route.js +1 -0
  182. package/.next-prod/server/app/api/mysql/disconnect/route.js.nft.json +1 -0
  183. package/.next-prod/server/app/api/mysql/disconnect/route_client-reference-manifest.js +1 -0
  184. package/.next-prod/server/app/api/mysql/export/route.js +1 -0
  185. package/.next-prod/server/app/api/mysql/export/route.js.nft.json +1 -0
  186. package/.next-prod/server/app/api/mysql/export/route_client-reference-manifest.js +1 -0
  187. package/.next-prod/server/app/api/mysql/query/route.js +1 -0
  188. package/.next-prod/server/app/api/mysql/query/route.js.nft.json +1 -0
  189. package/.next-prod/server/app/api/mysql/query/route_client-reference-manifest.js +1 -0
  190. package/.next-prod/server/app/api/mysql/schemas/route.js +6 -0
  191. package/.next-prod/server/app/api/mysql/schemas/route.js.nft.json +1 -0
  192. package/.next-prod/server/app/api/mysql/schemas/route_client-reference-manifest.js +1 -0
  193. package/.next-prod/server/app/api/note/route.js +1 -0
  194. package/.next-prod/server/app/api/note/route.js.nft.json +1 -0
  195. package/.next-prod/server/app/api/note/route_client-reference-manifest.js +1 -0
  196. package/.next-prod/server/app/api/open-cursor/route.js +1 -0
  197. package/.next-prod/server/app/api/open-cursor/route.js.nft.json +1 -0
  198. package/.next-prod/server/app/api/open-cursor/route_client-reference-manifest.js +1 -0
  199. package/.next-prod/server/app/api/open-vscode/route.js +1 -0
  200. package/.next-prod/server/app/api/open-vscode/route.js.nft.json +1 -0
  201. package/.next-prod/server/app/api/open-vscode/route_client-reference-manifest.js +1 -0
  202. package/.next-prod/server/app/api/pick-folder/route.js +1 -0
  203. package/.next-prod/server/app/api/pick-folder/route.js.nft.json +1 -0
  204. package/.next-prod/server/app/api/pick-folder/route_client-reference-manifest.js +1 -0
  205. package/.next-prod/server/app/api/pinned-sessions/route.js +1 -0
  206. package/.next-prod/server/app/api/pinned-sessions/route.js.nft.json +1 -0
  207. package/.next-prod/server/app/api/pinned-sessions/route_client-reference-manifest.js +1 -0
  208. package/.next-prod/server/app/api/project-settings/route.js +1 -0
  209. package/.next-prod/server/app/api/project-settings/route.js.nft.json +1 -0
  210. package/.next-prod/server/app/api/project-settings/route_client-reference-manifest.js +1 -0
  211. package/.next-prod/server/app/api/project-state/route.js +1 -0
  212. package/.next-prod/server/app/api/project-state/route.js.nft.json +1 -0
  213. package/.next-prod/server/app/api/project-state/route_client-reference-manifest.js +1 -0
  214. package/.next-prod/server/app/api/projects/route.js +1 -0
  215. package/.next-prod/server/app/api/projects/route.js.nft.json +1 -0
  216. package/.next-prod/server/app/api/projects/route_client-reference-manifest.js +1 -0
  217. package/.next-prod/server/app/api/redis/command/route.js +1 -0
  218. package/.next-prod/server/app/api/redis/command/route.js.nft.json +1 -0
  219. package/.next-prod/server/app/api/redis/command/route_client-reference-manifest.js +1 -0
  220. package/.next-prod/server/app/api/redis/connect/route.js +1 -0
  221. package/.next-prod/server/app/api/redis/connect/route.js.nft.json +1 -0
  222. package/.next-prod/server/app/api/redis/connect/route_client-reference-manifest.js +1 -0
  223. package/.next-prod/server/app/api/redis/delete/route.js +1 -0
  224. package/.next-prod/server/app/api/redis/delete/route.js.nft.json +1 -0
  225. package/.next-prod/server/app/api/redis/delete/route_client-reference-manifest.js +1 -0
  226. package/.next-prod/server/app/api/redis/disconnect/route.js +1 -0
  227. package/.next-prod/server/app/api/redis/disconnect/route.js.nft.json +1 -0
  228. package/.next-prod/server/app/api/redis/disconnect/route_client-reference-manifest.js +1 -0
  229. package/.next-prod/server/app/api/redis/get/route.js +1 -0
  230. package/.next-prod/server/app/api/redis/get/route.js.nft.json +1 -0
  231. package/.next-prod/server/app/api/redis/get/route_client-reference-manifest.js +1 -0
  232. package/.next-prod/server/app/api/redis/keys/route.js +1 -0
  233. package/.next-prod/server/app/api/redis/keys/route.js.nft.json +1 -0
  234. package/.next-prod/server/app/api/redis/keys/route_client-reference-manifest.js +1 -0
  235. package/.next-prod/server/app/api/redis/set/route.js +1 -0
  236. package/.next-prod/server/app/api/redis/set/route.js.nft.json +1 -0
  237. package/.next-prod/server/app/api/redis/set/route_client-reference-manifest.js +1 -0
  238. package/.next-prod/server/app/api/review/[id]/comments/route.js +1 -0
  239. package/.next-prod/server/app/api/review/[id]/comments/route.js.nft.json +1 -0
  240. package/.next-prod/server/app/api/review/[id]/comments/route_client-reference-manifest.js +1 -0
  241. package/.next-prod/server/app/api/review/[id]/replies/route.js +1 -0
  242. package/.next-prod/server/app/api/review/[id]/replies/route.js.nft.json +1 -0
  243. package/.next-prod/server/app/api/review/[id]/replies/route_client-reference-manifest.js +1 -0
  244. package/.next-prod/server/app/api/review/[id]/route.js +1 -0
  245. package/.next-prod/server/app/api/review/[id]/route.js.nft.json +1 -0
  246. package/.next-prod/server/app/api/review/[id]/route_client-reference-manifest.js +1 -0
  247. package/.next-prod/server/app/api/review/identify/route.js +1 -0
  248. package/.next-prod/server/app/api/review/identify/route.js.nft.json +1 -0
  249. package/.next-prod/server/app/api/review/identify/route_client-reference-manifest.js +1 -0
  250. package/.next-prod/server/app/api/review/order/route.js +1 -0
  251. package/.next-prod/server/app/api/review/order/route.js.nft.json +1 -0
  252. package/.next-prod/server/app/api/review/order/route_client-reference-manifest.js +1 -0
  253. package/.next-prod/server/app/api/review/route.js +1 -0
  254. package/.next-prod/server/app/api/review/route.js.nft.json +1 -0
  255. package/.next-prod/server/app/api/review/route_client-reference-manifest.js +1 -0
  256. package/.next-prod/server/app/api/review/share-info/route.js +1 -0
  257. package/.next-prod/server/app/api/review/share-info/route.js.nft.json +1 -0
  258. package/.next-prod/server/app/api/review/share-info/route_client-reference-manifest.js +1 -0
  259. package/.next-prod/server/app/api/review/users/route.js +1 -0
  260. package/.next-prod/server/app/api/review/users/route.js.nft.json +1 -0
  261. package/.next-prod/server/app/api/review/users/route_client-reference-manifest.js +1 -0
  262. package/.next-prod/server/app/api/scheduled-tasks/route.js +1 -0
  263. package/.next-prod/server/app/api/scheduled-tasks/route.js.nft.json +1 -0
  264. package/.next-prod/server/app/api/scheduled-tasks/route_client-reference-manifest.js +1 -0
  265. package/.next-prod/server/app/api/services/config/route.js +1 -0
  266. package/.next-prod/server/app/api/services/config/route.js.nft.json +1 -0
  267. package/.next-prod/server/app/api/services/config/route_client-reference-manifest.js +1 -0
  268. package/.next-prod/server/app/api/services/scripts/route.js +1 -0
  269. package/.next-prod/server/app/api/services/scripts/route.js.nft.json +1 -0
  270. package/.next-prod/server/app/api/services/scripts/route_client-reference-manifest.js +1 -0
  271. package/.next-prod/server/app/api/session/[sessionId]/fork/route.js +1 -0
  272. package/.next-prod/server/app/api/session/[sessionId]/fork/route.js.nft.json +1 -0
  273. package/.next-prod/server/app/api/session/[sessionId]/fork/route_client-reference-manifest.js +1 -0
  274. package/.next-prod/server/app/api/session/[sessionId]/history/route.js +1 -0
  275. package/.next-prod/server/app/api/session/[sessionId]/history/route.js.nft.json +1 -0
  276. package/.next-prod/server/app/api/session/[sessionId]/history/route_client-reference-manifest.js +1 -0
  277. package/.next-prod/server/app/api/session-by-path/route.js +1 -0
  278. package/.next-prod/server/app/api/session-by-path/route.js.nft.json +1 -0
  279. package/.next-prod/server/app/api/session-by-path/route_client-reference-manifest.js +1 -0
  280. package/.next-prod/server/app/api/sessions/projects/[encodedPath]/route.js +1 -0
  281. package/.next-prod/server/app/api/sessions/projects/[encodedPath]/route.js.nft.json +1 -0
  282. package/.next-prod/server/app/api/sessions/projects/[encodedPath]/route_client-reference-manifest.js +1 -0
  283. package/.next-prod/server/app/api/sessions/projects/route.js +1 -0
  284. package/.next-prod/server/app/api/sessions/projects/route.js.nft.json +1 -0
  285. package/.next-prod/server/app/api/sessions/projects/route_client-reference-manifest.js +1 -0
  286. package/.next-prod/server/app/api/sessions/route.js +1 -0
  287. package/.next-prod/server/app/api/sessions/route.js.nft.json +1 -0
  288. package/.next-prod/server/app/api/sessions/route_client-reference-manifest.js +1 -0
  289. package/.next-prod/server/app/api/settings/route.js +1 -0
  290. package/.next-prod/server/app/api/settings/route.js.nft.json +1 -0
  291. package/.next-prod/server/app/api/settings/route_client-reference-manifest.js +1 -0
  292. package/.next-prod/server/app/api/terminal/aliases/route.js +1 -0
  293. package/.next-prod/server/app/api/terminal/aliases/route.js.nft.json +1 -0
  294. package/.next-prod/server/app/api/terminal/aliases/route_client-reference-manifest.js +1 -0
  295. package/.next-prod/server/app/api/terminal/autocomplete/route.js +1 -0
  296. package/.next-prod/server/app/api/terminal/autocomplete/route.js.nft.json +1 -0
  297. package/.next-prod/server/app/api/terminal/autocomplete/route_client-reference-manifest.js +1 -0
  298. package/.next-prod/server/app/api/terminal/bubble-order/route.js +1 -0
  299. package/.next-prod/server/app/api/terminal/bubble-order/route.js.nft.json +1 -0
  300. package/.next-prod/server/app/api/terminal/bubble-order/route_client-reference-manifest.js +1 -0
  301. package/.next-prod/server/app/api/terminal/env/route.js +1 -0
  302. package/.next-prod/server/app/api/terminal/env/route.js.nft.json +1 -0
  303. package/.next-prod/server/app/api/terminal/env/route_client-reference-manifest.js +1 -0
  304. package/.next-prod/server/app/api/terminal/history/route.js +1 -0
  305. package/.next-prod/server/app/api/terminal/history/route.js.nft.json +1 -0
  306. package/.next-prod/server/app/api/terminal/history/route_client-reference-manifest.js +1 -0
  307. package/.next-prod/server/app/api/version/route.js +1 -0
  308. package/.next-prod/server/app/api/version/route.js.nft.json +1 -0
  309. package/.next-prod/server/app/api/version/route_client-reference-manifest.js +1 -0
  310. package/.next-prod/server/app/favicon.ico/route.js +1 -0
  311. package/.next-prod/server/app/favicon.ico/route.js.nft.json +1 -0
  312. package/.next-prod/server/app/favicon.ico.body +0 -0
  313. package/.next-prod/server/app/favicon.ico.meta +1 -0
  314. package/.next-prod/server/app/manifest.webmanifest/route.js +16 -0
  315. package/.next-prod/server/app/manifest.webmanifest/route.js.nft.json +1 -0
  316. package/.next-prod/server/app/manifest.webmanifest/route_client-reference-manifest.js +1 -0
  317. package/.next-prod/server/app/manifest.webmanifest.body +1 -0
  318. package/.next-prod/server/app/manifest.webmanifest.meta +1 -0
  319. package/.next-prod/server/app/page.js +97 -0
  320. package/.next-prod/server/app/page.js.nft.json +1 -0
  321. package/.next-prod/server/app/page_client-reference-manifest.js +1 -0
  322. package/.next-prod/server/app/project/page.js +29 -0
  323. package/.next-prod/server/app/project/page.js.nft.json +1 -0
  324. package/.next-prod/server/app/project/page_client-reference-manifest.js +1 -0
  325. package/.next-prod/server/app/review/[id]/page.js +2 -0
  326. package/.next-prod/server/app/review/[id]/page.js.nft.json +1 -0
  327. package/.next-prod/server/app/review/[id]/page_client-reference-manifest.js +1 -0
  328. package/.next-prod/server/app-paths-manifest.json +99 -0
  329. package/.next-prod/server/chunks/1639.js +1 -0
  330. package/.next-prod/server/chunks/1667.js +1 -0
  331. package/.next-prod/server/chunks/1813.js +1 -0
  332. package/.next-prod/server/chunks/1912.js +1 -0
  333. package/.next-prod/server/chunks/2325.js +82 -0
  334. package/.next-prod/server/chunks/2376.js +36 -0
  335. package/.next-prod/server/chunks/2816.js +1 -0
  336. package/.next-prod/server/chunks/2840.js +62 -0
  337. package/.next-prod/server/chunks/3434.js +1 -0
  338. package/.next-prod/server/chunks/3441.js +24 -0
  339. package/.next-prod/server/chunks/3503.js +29 -0
  340. package/.next-prod/server/chunks/3863.js +1 -0
  341. package/.next-prod/server/chunks/3932.js +56 -0
  342. package/.next-prod/server/chunks/4042.js +1 -0
  343. package/.next-prod/server/chunks/4073.js +1 -0
  344. package/.next-prod/server/chunks/4097.js +136 -0
  345. package/.next-prod/server/chunks/4098.js +1 -0
  346. package/.next-prod/server/chunks/4268.js +4 -0
  347. package/.next-prod/server/chunks/4272.js +5 -0
  348. package/.next-prod/server/chunks/4309.js +141 -0
  349. package/.next-prod/server/chunks/4345.js +1 -0
  350. package/.next-prod/server/chunks/4367.js +1 -0
  351. package/.next-prod/server/chunks/4388.js +24 -0
  352. package/.next-prod/server/chunks/4442.js +1 -0
  353. package/.next-prod/server/chunks/4490.js +26 -0
  354. package/.next-prod/server/chunks/4741.js +22 -0
  355. package/.next-prod/server/chunks/4793.js +1 -0
  356. package/.next-prod/server/chunks/5152.js +1 -0
  357. package/.next-prod/server/chunks/5460.js +201 -0
  358. package/.next-prod/server/chunks/5481.js +1 -0
  359. package/.next-prod/server/chunks/5536.js +148 -0
  360. package/.next-prod/server/chunks/5733.js +5 -0
  361. package/.next-prod/server/chunks/582.js +1 -0
  362. package/.next-prod/server/chunks/5958.js +1 -0
  363. package/.next-prod/server/chunks/6062.js +1 -0
  364. package/.next-prod/server/chunks/6117.js +13 -0
  365. package/.next-prod/server/chunks/6142.js +287 -0
  366. package/.next-prod/server/chunks/6346.js +1 -0
  367. package/.next-prod/server/chunks/6443.js +1 -0
  368. package/.next-prod/server/chunks/6804.js +43 -0
  369. package/.next-prod/server/chunks/7265.js +93 -0
  370. package/.next-prod/server/chunks/7284.js +1 -0
  371. package/.next-prod/server/chunks/7307.js +1 -0
  372. package/.next-prod/server/chunks/7483.js +1 -0
  373. package/.next-prod/server/chunks/7484.js +64 -0
  374. package/.next-prod/server/chunks/7514.js +31 -0
  375. package/.next-prod/server/chunks/7800.js +166 -0
  376. package/.next-prod/server/chunks/8068.js +63 -0
  377. package/.next-prod/server/chunks/8351.js +23 -0
  378. package/.next-prod/server/chunks/8491.js +5 -0
  379. package/.next-prod/server/chunks/8585.js +198 -0
  380. package/.next-prod/server/chunks/887.js +215 -0
  381. package/.next-prod/server/chunks/911.js +1 -0
  382. package/.next-prod/server/chunks/9116.js +65 -0
  383. package/.next-prod/server/chunks/925.js +68 -0
  384. package/.next-prod/server/chunks/9298.js +139 -0
  385. package/.next-prod/server/chunks/9401.js +1 -0
  386. package/.next-prod/server/chunks/9408.js +1 -0
  387. package/.next-prod/server/functions-config-manifest.json +24 -0
  388. package/.next-prod/server/interception-route-rewrite-manifest.js +1 -0
  389. package/.next-prod/server/middleware-build-manifest.js +1 -0
  390. package/.next-prod/server/middleware-manifest.json +6 -0
  391. package/.next-prod/server/middleware-react-loadable-manifest.js +1 -0
  392. package/.next-prod/server/next-font-manifest.js +1 -0
  393. package/.next-prod/server/next-font-manifest.json +1 -0
  394. package/.next-prod/server/pages/404.html +18 -0
  395. package/.next-prod/server/pages/500.html +2 -0
  396. package/.next-prod/server/pages-manifest.json +4 -0
  397. package/.next-prod/server/server-reference-manifest.js +1 -0
  398. package/.next-prod/server/server-reference-manifest.json +1 -0
  399. package/.next-prod/server/webpack-runtime.js +1 -0
  400. package/.next-prod/static/DV3WCL3Yj_UIBxTQ3r93N/_buildManifest.js +1 -0
  401. package/.next-prod/static/DV3WCL3Yj_UIBxTQ3r93N/_ssgManifest.js +1 -0
  402. package/.next-prod/static/chunks/10.6cf001c181ce1098.js +1 -0
  403. package/.next-prod/static/chunks/1078.02294b2934d5bf21.js +1 -0
  404. package/.next-prod/static/chunks/1142.17e45d200709420d.js +1 -0
  405. package/.next-prod/static/chunks/1161.06b33878b495da50.js +1 -0
  406. package/.next-prod/static/chunks/1184.e80a999422621ed9.js +1 -0
  407. package/.next-prod/static/chunks/1188.1d4ce94ddc297119.js +1 -0
  408. package/.next-prod/static/chunks/1198.2a5c215f01a8b74d.js +1 -0
  409. package/.next-prod/static/chunks/1215.88ed89521e915107.js +1 -0
  410. package/.next-prod/static/chunks/1219.e27b0bd10b029e40.js +1 -0
  411. package/.next-prod/static/chunks/123.d6fe9c2353baf42b.js +1 -0
  412. package/.next-prod/static/chunks/1247.64e212daa5bb3925.js +1 -0
  413. package/.next-prod/static/chunks/1248.36af3903f037c1f5.js +1 -0
  414. package/.next-prod/static/chunks/1274.ce6906b1fe2e04b8.js +1 -0
  415. package/.next-prod/static/chunks/1280.1651bb5167170457.js +1 -0
  416. package/.next-prod/static/chunks/1310.c38c5fbf05820fcd.js +166 -0
  417. package/.next-prod/static/chunks/1335.716cc5924662708e.js +1 -0
  418. package/.next-prod/static/chunks/1365.d7391145ca7f8791.js +1 -0
  419. package/.next-prod/static/chunks/1379.03e1e0f31bdaa2cc.js +1 -0
  420. package/.next-prod/static/chunks/1409.9f81cd6d2cab4b67.js +1 -0
  421. package/.next-prod/static/chunks/1413.117c5958c59cc695.js +1 -0
  422. package/.next-prod/static/chunks/142.e09e154342f02da4.js +4 -0
  423. package/.next-prod/static/chunks/1453.3c24c777a3deca2d.js +1 -0
  424. package/.next-prod/static/chunks/1456.a1f849b334fff0da.js +1 -0
  425. package/.next-prod/static/chunks/1501.549af2c91a889a08.js +1 -0
  426. package/.next-prod/static/chunks/1534.918a25b2e3daab22.js +1 -0
  427. package/.next-prod/static/chunks/1556.96abc9ff91b0c383.js +1 -0
  428. package/.next-prod/static/chunks/1583.03a06dbdde85ac56.js +1 -0
  429. package/.next-prod/static/chunks/1590.05549e036336164c.js +65 -0
  430. package/.next-prod/static/chunks/1593-7902218f5b10761f.js +1 -0
  431. package/.next-prod/static/chunks/1595.ee61519fde230f60.js +1 -0
  432. package/.next-prod/static/chunks/1656.a9efc78185a5a85f.js +1 -0
  433. package/.next-prod/static/chunks/1664.6d5b5e3112b66906.js +1 -0
  434. package/.next-prod/static/chunks/1898.e07b2b1c5e789b06.js +1 -0
  435. package/.next-prod/static/chunks/1932.b0aea9b52cabe5e8.js +1 -0
  436. package/.next-prod/static/chunks/194.dace825a3ddbbbff.js +1 -0
  437. package/.next-prod/static/chunks/1948.bf7e0d9ede202530.js +29 -0
  438. package/.next-prod/static/chunks/1977.a06c8e8d2198f765.js +1 -0
  439. package/.next-prod/static/chunks/1987.226da043eabc8911.js +5 -0
  440. package/.next-prod/static/chunks/1991.d869abe5092c9011.js +1 -0
  441. package/.next-prod/static/chunks/1cd6e1d3.8121a74b2042bff3.js +1 -0
  442. package/.next-prod/static/chunks/2013.598558c40e51e107.js +1 -0
  443. package/.next-prod/static/chunks/2020.46a0112747939389.js +1 -0
  444. package/.next-prod/static/chunks/2031.3877441c49bff5cd.js +1 -0
  445. package/.next-prod/static/chunks/2041.00f4fa0ab26c6ba5.js +1 -0
  446. package/.next-prod/static/chunks/2062.4a0ab3400fea0e34.js +1 -0
  447. package/.next-prod/static/chunks/2072-37a80cb92f1ee2d4.js +4 -0
  448. package/.next-prod/static/chunks/2107.c627112b02b9e1c8.js +1 -0
  449. package/.next-prod/static/chunks/2130.441ae0f68863efeb.js +1 -0
  450. package/.next-prod/static/chunks/214.f6bba63dfa159e01.js +1 -0
  451. package/.next-prod/static/chunks/2160.e38d781fd5c4cde0.js +1 -0
  452. package/.next-prod/static/chunks/2179.1bf5fe315e6e132c.js +1 -0
  453. package/.next-prod/static/chunks/2215.9d2d6fbe90ffcc80.js +1 -0
  454. package/.next-prod/static/chunks/2235.b4453110c06e2b09.js +1 -0
  455. package/.next-prod/static/chunks/2349.ca15d465c4260b4b.js +1 -0
  456. package/.next-prod/static/chunks/2374.7560cc5c4b8ed6b0.js +1 -0
  457. package/.next-prod/static/chunks/2403.3dda71b6482dce3b.js +1 -0
  458. package/.next-prod/static/chunks/2485.3188870375e9fbee.js +1 -0
  459. package/.next-prod/static/chunks/2489.fcc70bd67329a70e.js +1 -0
  460. package/.next-prod/static/chunks/2501.4e65b56602faa956.js +1 -0
  461. package/.next-prod/static/chunks/2503.bb9d3528c3c7ccae.js +1 -0
  462. package/.next-prod/static/chunks/252.a9e22657cbf67b42.js +1 -0
  463. package/.next-prod/static/chunks/254.8b4308512ac955b5.js +24 -0
  464. package/.next-prod/static/chunks/2614.8349e4b407470a30.js +1 -0
  465. package/.next-prod/static/chunks/2710.fe0656d4ebae4d30.js +1 -0
  466. package/.next-prod/static/chunks/2728.5fed9ac13dfcd1d1.js +1 -0
  467. package/.next-prod/static/chunks/2729.826909b4d5229ba6.js +68 -0
  468. package/.next-prod/static/chunks/2735.5a3e65a580bd5af9.js +1 -0
  469. package/.next-prod/static/chunks/2747.1d85d388314f2904.js +1 -0
  470. package/.next-prod/static/chunks/2765.2c6d9772af50feed.js +1 -0
  471. package/.next-prod/static/chunks/2783.e8bbf2c794ef9750.js +1 -0
  472. package/.next-prod/static/chunks/2812.dcd8179a6b1d76c9.js +1 -0
  473. package/.next-prod/static/chunks/2821.fa74c6e87f6e759a.js +1 -0
  474. package/.next-prod/static/chunks/2839.a832cb0d77a9d298.js +1 -0
  475. package/.next-prod/static/chunks/2895.0339e755e79ee794.js +1 -0
  476. package/.next-prod/static/chunks/2921.26016c4c7eb031e8.js +1 -0
  477. package/.next-prod/static/chunks/2954.7d8daeae6410d4a4.js +1 -0
  478. package/.next-prod/static/chunks/2964.1a0e15f7327680a2.js +1 -0
  479. package/.next-prod/static/chunks/2ff9d716.93c18c265de76cfb.js +136 -0
  480. package/.next-prod/static/chunks/305-fced91c3443b6178.js +1 -0
  481. package/.next-prod/static/chunks/3072.b6da96c10080c967.js +1 -0
  482. package/.next-prod/static/chunks/3074.911584369786c26c.js +1 -0
  483. package/.next-prod/static/chunks/3077.bf82c0c332cc9fec.js +1 -0
  484. package/.next-prod/static/chunks/3082.159e4ab8f0572597.js +1 -0
  485. package/.next-prod/static/chunks/3095.8cd478c42cee505a.js +1 -0
  486. package/.next-prod/static/chunks/3111.1cf85db2faeb20cc.js +1 -0
  487. package/.next-prod/static/chunks/3126.c89ab7ce8e10978e.js +1 -0
  488. package/.next-prod/static/chunks/3175.538ce7aec634bddb.js +1 -0
  489. package/.next-prod/static/chunks/3186.3665756f8aae3eb7.js +1 -0
  490. package/.next-prod/static/chunks/3194.5a331fb5e3dc34e9.js +1 -0
  491. package/.next-prod/static/chunks/3229.5e91f7d0b135266b.js +1 -0
  492. package/.next-prod/static/chunks/327.8ecab0b86d52b597.js +1 -0
  493. package/.next-prod/static/chunks/3274.858f7f9216c8b074.js +1 -0
  494. package/.next-prod/static/chunks/3286.196c508356bb0b66.js +1 -0
  495. package/.next-prod/static/chunks/3288.f210cd6796271d4f.js +1 -0
  496. package/.next-prod/static/chunks/3290.b5ba2646ad49c9fd.js +1 -0
  497. package/.next-prod/static/chunks/3304.16305e84f4ff6598.js +1 -0
  498. package/.next-prod/static/chunks/3313.471138e5504646a9.js +1 -0
  499. package/.next-prod/static/chunks/3324.85e21e3313d0901c.js +1 -0
  500. package/.next-prod/static/chunks/3392.460f5a753531f501.js +1 -0
  501. package/.next-prod/static/chunks/34.ce581867cf95e24b.js +1 -0
  502. package/.next-prod/static/chunks/3419.78b520dab7e2f96d.js +1 -0
  503. package/.next-prod/static/chunks/3437.0ad1ecc8c5b8a679.js +1 -0
  504. package/.next-prod/static/chunks/3476.246c30b47bded3b7.js +1 -0
  505. package/.next-prod/static/chunks/3483.fc2a0b1185dbaa5d.js +1 -0
  506. package/.next-prod/static/chunks/3492.ca55498822ad7796.js +1 -0
  507. package/.next-prod/static/chunks/3530-6d8abfd0e950d439.js +14 -0
  508. package/.next-prod/static/chunks/36.b4a553bf2106f6d3.js +1 -0
  509. package/.next-prod/static/chunks/3613.9a37e282a0b018d7.js +1 -0
  510. package/.next-prod/static/chunks/3682.d8c0079db560c625.js +1 -0
  511. package/.next-prod/static/chunks/3695-f14fb3e48483755c.js +18 -0
  512. package/.next-prod/static/chunks/376.9e742ff6919b2b54.js +1 -0
  513. package/.next-prod/static/chunks/3782.8de9ba0149339c0c.js +1 -0
  514. package/.next-prod/static/chunks/3787.78ebe68a043f50ce.js +1 -0
  515. package/.next-prod/static/chunks/3794-337d1ca25ad99a89.js +2 -0
  516. package/.next-prod/static/chunks/3860.be5b243bf7d6618c.js +1 -0
  517. package/.next-prod/static/chunks/3873.72a9a21509f713f7.js +1 -0
  518. package/.next-prod/static/chunks/392.3cad93691f1b7360.js +1 -0
  519. package/.next-prod/static/chunks/3942.00e2e29e2d62b039.js +1 -0
  520. package/.next-prod/static/chunks/3979.cea8623f6e9f83ea.js +1 -0
  521. package/.next-prod/static/chunks/400.59979e0d3ae126e4.js +1 -0
  522. package/.next-prod/static/chunks/4053.90d71fcbe4ffd852.js +1 -0
  523. package/.next-prod/static/chunks/4080.08a21dae9e93c547.js +1 -0
  524. package/.next-prod/static/chunks/4163.c6ebefdd9aa5c358.js +1 -0
  525. package/.next-prod/static/chunks/4174.9e84de8f8816fe01.js +1 -0
  526. package/.next-prod/static/chunks/4223.c10556cd92fc8018.js +1 -0
  527. package/.next-prod/static/chunks/4240-38a224bd376cc8a0.js +1 -0
  528. package/.next-prod/static/chunks/4242.3a66c58375424a5b.js +1 -0
  529. package/.next-prod/static/chunks/425.9a3434a28926566a.js +1 -0
  530. package/.next-prod/static/chunks/4275.8f2e531757c2a813.js +1 -0
  531. package/.next-prod/static/chunks/4295.6c0f4838b0c9c69d.js +1 -0
  532. package/.next-prod/static/chunks/4309.a887a10e84c44f9e.js +1 -0
  533. package/.next-prod/static/chunks/4350.b9d80827e8eee01a.js +1 -0
  534. package/.next-prod/static/chunks/4357.05060a5a3fea9ff1.js +1 -0
  535. package/.next-prod/static/chunks/4358.f15dd467571f7594.js +1 -0
  536. package/.next-prod/static/chunks/4367.2610339aa03a9fb3.js +1 -0
  537. package/.next-prod/static/chunks/4370.ac13b62c811f7ede.js +1 -0
  538. package/.next-prod/static/chunks/4402d2ac.d0d1b1777a45e0b2.js +1 -0
  539. package/.next-prod/static/chunks/4474.053807fa34066566.js +1 -0
  540. package/.next-prod/static/chunks/4539.559c223da16b0282.js +1 -0
  541. package/.next-prod/static/chunks/4540.03df20c499bca840.js +1 -0
  542. package/.next-prod/static/chunks/4553.a16dba8d6d03226c.js +1 -0
  543. package/.next-prod/static/chunks/4567.d405b50b917bd2c2.js +1 -0
  544. package/.next-prod/static/chunks/4583.2a5df6eb3a6ea30b.js +1 -0
  545. package/.next-prod/static/chunks/4593.676ac488744e1af5.js +1 -0
  546. package/.next-prod/static/chunks/4608.1ff246d6b4c771f8.js +1 -0
  547. package/.next-prod/static/chunks/4634.0332a56fdb8e26c0.js +1 -0
  548. package/.next-prod/static/chunks/4650.61aec912b756287b.js +1 -0
  549. package/.next-prod/static/chunks/4659.b8e05ba7cbf46556.js +1 -0
  550. package/.next-prod/static/chunks/4678.867dfae26694be02.js +1 -0
  551. package/.next-prod/static/chunks/4699.8603b2742a761084.js +1 -0
  552. package/.next-prod/static/chunks/4823.907850963b2bcb70.js +1 -0
  553. package/.next-prod/static/chunks/4829.402ec60139d36417.js +1 -0
  554. package/.next-prod/static/chunks/4892.1674cc00200143ba.js +1 -0
  555. package/.next-prod/static/chunks/4900.b723a916eafdf743.js +1 -0
  556. package/.next-prod/static/chunks/4903.004f583a12223dac.js +1 -0
  557. package/.next-prod/static/chunks/4963.0f6678151a159143.js +1 -0
  558. package/.next-prod/static/chunks/4969.1cb10af9489ea295.js +1 -0
  559. package/.next-prod/static/chunks/4976.8870319ffbd1c31f.js +1 -0
  560. package/.next-prod/static/chunks/4bd1b696-e5d7c65570c947b7.js +1 -0
  561. package/.next-prod/static/chunks/4ca0cff5.07efe2bc8f09d72e.js +1 -0
  562. package/.next-prod/static/chunks/5005.cf839e066f3d3efe.js +1 -0
  563. package/.next-prod/static/chunks/5019.2906d96e77b98f68.js +198 -0
  564. package/.next-prod/static/chunks/5025.b597364f0cf8b85a.js +1 -0
  565. package/.next-prod/static/chunks/5061.025d30c3123eeaf6.js +1 -0
  566. package/.next-prod/static/chunks/5136.ac897c2a56ee392f.js +1 -0
  567. package/.next-prod/static/chunks/5139.83dc2c84aeea716b.js +63 -0
  568. package/.next-prod/static/chunks/5183.2e5c895a2be76262.js +1 -0
  569. package/.next-prod/static/chunks/5199.5faac6a2cc104a4c.js +36 -0
  570. package/.next-prod/static/chunks/5269.25d99df0164521ad.js +23 -0
  571. package/.next-prod/static/chunks/5318.d48b9096df0171df.js +1 -0
  572. package/.next-prod/static/chunks/5320.191be461ff110fb3.js +1 -0
  573. package/.next-prod/static/chunks/5325.aad15a16a5d57787.js +1 -0
  574. package/.next-prod/static/chunks/5331.4d5d42e5253dbee2.js +1 -0
  575. package/.next-prod/static/chunks/5338.76f7773c317f3142.js +1 -0
  576. package/.next-prod/static/chunks/5347.3192e0021174aaa8.js +1 -0
  577. package/.next-prod/static/chunks/5364.2e5ba480c24d7854.js +148 -0
  578. package/.next-prod/static/chunks/5375.ebc026e6140b52f1.js +1 -0
  579. package/.next-prod/static/chunks/5394.9d260f733e336357.js +287 -0
  580. package/.next-prod/static/chunks/53c1bd3f.2911e2bac119d910.js +1 -0
  581. package/.next-prod/static/chunks/541.cfa15b606745131a.js +1 -0
  582. package/.next-prod/static/chunks/5424.4d62f7ee887cd8b9.js +1 -0
  583. package/.next-prod/static/chunks/5482.0907421e6bf5eeec.js +1 -0
  584. package/.next-prod/static/chunks/5491.5cc285c4b84dac30.js +1 -0
  585. package/.next-prod/static/chunks/5493-9f80ad2c7c9cf840.js +1 -0
  586. package/.next-prod/static/chunks/5498.fa0a196807d6cd2f.js +1 -0
  587. package/.next-prod/static/chunks/54a60aa6-f60235f3d6b54466.js +79 -0
  588. package/.next-prod/static/chunks/5518.6c3dc9afe81a566b.js +1 -0
  589. package/.next-prod/static/chunks/5520.eab85d7487e77510.js +1 -0
  590. package/.next-prod/static/chunks/5553.75df19e3cc1246d6.js +1 -0
  591. package/.next-prod/static/chunks/5575.3d90c643343a1329.js +1 -0
  592. package/.next-prod/static/chunks/5645.9002948124d25d41.js +1 -0
  593. package/.next-prod/static/chunks/5670.2a1b27a6fdb7aa6b.js +1 -0
  594. package/.next-prod/static/chunks/5690.d30877807cf5c7eb.js +1 -0
  595. package/.next-prod/static/chunks/570e4624.a82467c542429379.js +1 -0
  596. package/.next-prod/static/chunks/5712.574fca2d5f06483a.js +1 -0
  597. package/.next-prod/static/chunks/5728.8ef773d61765855e.js +1 -0
  598. package/.next-prod/static/chunks/5750.aa57d25b74640d23.js +1 -0
  599. package/.next-prod/static/chunks/5755.00015c284ed6fb39.js +1 -0
  600. package/.next-prod/static/chunks/5788.e5d5040b65e5edf3.js +1 -0
  601. package/.next-prod/static/chunks/579.33fc87fb95163c6a.js +1 -0
  602. package/.next-prod/static/chunks/583.5061a2f9e7b7e97d.js +1 -0
  603. package/.next-prod/static/chunks/5920.9db223329ee9e11a.js +1 -0
  604. package/.next-prod/static/chunks/5922.0d75c174139a59a4.js +1 -0
  605. package/.next-prod/static/chunks/5937.0827b5b3eb831ff0.js +1 -0
  606. package/.next-prod/static/chunks/5968.63d5869783fad06f.js +1 -0
  607. package/.next-prod/static/chunks/5997.226c07d9e6c496e0.js +1 -0
  608. package/.next-prod/static/chunks/6026.4027a04696ef04db.js +1 -0
  609. package/.next-prod/static/chunks/6046.00d36aea7fd5b147.js +1 -0
  610. package/.next-prod/static/chunks/6089.2dd351186ec85cc3.js +1 -0
  611. package/.next-prod/static/chunks/6099.43e6595fcf24fc33.js +1 -0
  612. package/.next-prod/static/chunks/6110.5ce3f75fced27aaf.js +1 -0
  613. package/.next-prod/static/chunks/6144.f967a8228bcdf663.js +1 -0
  614. package/.next-prod/static/chunks/6155.e6cf0ef7c818caa9.js +1 -0
  615. package/.next-prod/static/chunks/6166.ecd82a9dcb484b97.js +1 -0
  616. package/.next-prod/static/chunks/624.2dd909fbfce98c5e.js +1 -0
  617. package/.next-prod/static/chunks/6290.e14cf4fc52dd4539.js +1 -0
  618. package/.next-prod/static/chunks/6293.5914fa73a9f7e777.js +1 -0
  619. package/.next-prod/static/chunks/6311.5b9c1f74df9a8f67.js +1 -0
  620. package/.next-prod/static/chunks/6331.758f2f66b92cada9.js +1 -0
  621. package/.next-prod/static/chunks/6339.bc9301cc22898be0.js +1 -0
  622. package/.next-prod/static/chunks/6360.ff0a9063773daeeb.js +1 -0
  623. package/.next-prod/static/chunks/6383.ca3e074feb80c69c.js +1 -0
  624. package/.next-prod/static/chunks/640.5bf1e25d0bddf875.js +1 -0
  625. package/.next-prod/static/chunks/6402.a0070d7688ed986b.js +1 -0
  626. package/.next-prod/static/chunks/6412.089ee787a294d10b.js +1 -0
  627. package/.next-prod/static/chunks/6455.12b78a2660d609eb.js +1 -0
  628. package/.next-prod/static/chunks/6460.8ce93fe47320f6c5.js +1 -0
  629. package/.next-prod/static/chunks/6563.5d618b608750f4dc.js +1 -0
  630. package/.next-prod/static/chunks/6572.ca2463823b9b01a0.js +1 -0
  631. package/.next-prod/static/chunks/6580.75d53830b434451f.js +1 -0
  632. package/.next-prod/static/chunks/6588.0fbca957af7d9e6a.js +1 -0
  633. package/.next-prod/static/chunks/6647.584c5d5cd8dfdb5a.js +1 -0
  634. package/.next-prod/static/chunks/6686.796c782c33ab8ca9.js +1 -0
  635. package/.next-prod/static/chunks/6701.bff0efb979f71a17.js +1 -0
  636. package/.next-prod/static/chunks/6704.f280f0ad0f5d8644.js +1 -0
  637. package/.next-prod/static/chunks/6729.0f91dcaaaffa2ed4.js +1 -0
  638. package/.next-prod/static/chunks/6741.06fdaf122961074e.js +1 -0
  639. package/.next-prod/static/chunks/6846.91283f709c40802c.js +1 -0
  640. package/.next-prod/static/chunks/6859.bacad166ee995fe0.js +1 -0
  641. package/.next-prod/static/chunks/6871.38519003bd87ac1c.js +62 -0
  642. package/.next-prod/static/chunks/6887.6c81234d73740fb9.js +1 -0
  643. package/.next-prod/static/chunks/6927.aa3914b5fb0d14d4.js +1 -0
  644. package/.next-prod/static/chunks/6931.3c90e9fe0f7f1e66.js +1 -0
  645. package/.next-prod/static/chunks/6938.0ccf683bd8aa8410.js +1 -0
  646. package/.next-prod/static/chunks/6948.2719ed8731963209.js +1 -0
  647. package/.next-prod/static/chunks/6959.5a803faf27f88e9f.js +1 -0
  648. package/.next-prod/static/chunks/6962.3bbd080592d4efa0.js +64 -0
  649. package/.next-prod/static/chunks/698.e0dda03fd303b96b.js +1 -0
  650. package/.next-prod/static/chunks/700.65a02f6a597083dc.js +9 -0
  651. package/.next-prod/static/chunks/7021.b71240b1d5f6fbe4.js +1 -0
  652. package/.next-prod/static/chunks/7040.b8e05ba7cbf46556.js +1 -0
  653. package/.next-prod/static/chunks/7041.174bf29bd837f06d.js +1 -0
  654. package/.next-prod/static/chunks/7082.fc816f91214026d7.js +1 -0
  655. package/.next-prod/static/chunks/7084.921c9737b83f55eb.js +1 -0
  656. package/.next-prod/static/chunks/7085.b16e7c0e24741232.js +215 -0
  657. package/.next-prod/static/chunks/70e0d97a-6903b8594c742784.js +1 -0
  658. package/.next-prod/static/chunks/7113.86e40b60c804b8c5.js +1 -0
  659. package/.next-prod/static/chunks/7130.8d24694735826c22.js +1 -0
  660. package/.next-prod/static/chunks/7142.dbd2cf8141eece5e.js +1 -0
  661. package/.next-prod/static/chunks/7152.c7b7f1f5e9622f21.js +1 -0
  662. package/.next-prod/static/chunks/7182.b747e3ef1524157a.js +1 -0
  663. package/.next-prod/static/chunks/7227.a6b2f01487bb3d9d.js +1 -0
  664. package/.next-prod/static/chunks/7258.6cbe24c3bcb63d1d.js +1 -0
  665. package/.next-prod/static/chunks/7425.8b47c8e398a12dd8.js +1 -0
  666. package/.next-prod/static/chunks/7443.124211e5abc05d3f.js +93 -0
  667. package/.next-prod/static/chunks/7455.71d54397710b923c.js +1 -0
  668. package/.next-prod/static/chunks/7465.867e8ff655666413.js +1 -0
  669. package/.next-prod/static/chunks/7479.433d3878625aba75.js +24 -0
  670. package/.next-prod/static/chunks/7524.9528295a19a5837a.js +1 -0
  671. package/.next-prod/static/chunks/7525.f433aaf1fe40c90a.js +1 -0
  672. package/.next-prod/static/chunks/7547.54b68d37b50c2f21.js +43 -0
  673. package/.next-prod/static/chunks/7557.bdc743175125b3d8.js +1 -0
  674. package/.next-prod/static/chunks/7610.b1439345dbcf285d.js +1 -0
  675. package/.next-prod/static/chunks/7625.ab66bd50d2fb61a4.js +1 -0
  676. package/.next-prod/static/chunks/7635.166d83de1d29e758.js +1 -0
  677. package/.next-prod/static/chunks/7636.bf91320a9ff695af.js +1 -0
  678. package/.next-prod/static/chunks/7650.18f74243e9325242.js +1 -0
  679. package/.next-prod/static/chunks/7785.1402a4110c300764.js +1 -0
  680. package/.next-prod/static/chunks/7799.f90cda9aba4e0e77.js +1 -0
  681. package/.next-prod/static/chunks/7819.3c56f48c0dc5ad5d.js +1 -0
  682. package/.next-prod/static/chunks/7844.2bb29faa262f313e.js +1 -0
  683. package/.next-prod/static/chunks/7846.c9705c044ab8f87a.js +1 -0
  684. package/.next-prod/static/chunks/7874.8db6929b94cdf697.js +1 -0
  685. package/.next-prod/static/chunks/7884.79af1a2f4511cea5.js +1 -0
  686. package/.next-prod/static/chunks/7889.af3e581842f34c28.js +1 -0
  687. package/.next-prod/static/chunks/7921.c361f794cc208e06.js +1 -0
  688. package/.next-prod/static/chunks/794.06b1ae4fc9cc10a9.js +1 -0
  689. package/.next-prod/static/chunks/7977.80e4daa080a79c39.js +1 -0
  690. package/.next-prod/static/chunks/799ebd4e.ccb85c56e9216a38.js +1 -0
  691. package/.next-prod/static/chunks/7d29de82.30ff86a90cbfd921.js +1 -0
  692. package/.next-prod/static/chunks/8113.907baefc7227cfb8.js +1 -0
  693. package/.next-prod/static/chunks/8132.74491162f08af899.js +1 -0
  694. package/.next-prod/static/chunks/816.ccc7dc455fcaf7c0.js +1 -0
  695. package/.next-prod/static/chunks/8192.5918d83ac6a0e2dc.js +1 -0
  696. package/.next-prod/static/chunks/8243.aa3ccfb41335eb1f.js +1 -0
  697. package/.next-prod/static/chunks/8257.dd8f651f1a43fee2.js +1 -0
  698. package/.next-prod/static/chunks/8288.8ff86c6a3bee6b7c.js +1 -0
  699. package/.next-prod/static/chunks/830.e49b226c07876df4.js +1 -0
  700. package/.next-prod/static/chunks/8317.9c6f22e0c8cd07a8.js +141 -0
  701. package/.next-prod/static/chunks/8318.a70d7a81445f8cf9.js +1 -0
  702. package/.next-prod/static/chunks/840.a9c535f8868cc4bd.js +1 -0
  703. package/.next-prod/static/chunks/8406.955ccfbb4b70b8c3.js +1 -0
  704. package/.next-prod/static/chunks/8430.b1f802dcffa41626.js +1 -0
  705. package/.next-prod/static/chunks/8432.bd66ac287c569996.js +1 -0
  706. package/.next-prod/static/chunks/8457.b61d96d8d30215fc.js +1 -0
  707. package/.next-prod/static/chunks/8496.046efd6301dd804f.js +1 -0
  708. package/.next-prod/static/chunks/8545.be0c9eea6aae5971.js +1 -0
  709. package/.next-prod/static/chunks/8555.ab3ee6358f1d64da.js +1 -0
  710. package/.next-prod/static/chunks/862.7cd3197e1ba5fd00.js +1 -0
  711. package/.next-prod/static/chunks/8656.2ceb4e5ff5df2fca.js +1 -0
  712. package/.next-prod/static/chunks/8670.90ede75068758e82.js +1 -0
  713. package/.next-prod/static/chunks/8704.a1003918da6654da.js +1 -0
  714. package/.next-prod/static/chunks/8773.614f1f4f0f845c5e.js +1 -0
  715. package/.next-prod/static/chunks/8776.6fb12270eca03fd3.js +149 -0
  716. package/.next-prod/static/chunks/8848.b0a10ee0b0a2b91b.js +1 -0
  717. package/.next-prod/static/chunks/8863.4a09596cf95e996a.js +82 -0
  718. package/.next-prod/static/chunks/893.c469257bbbbca4f5.js +1 -0
  719. package/.next-prod/static/chunks/8947.31d3d834d8281fd9.js +1 -0
  720. package/.next-prod/static/chunks/9005.473ce947d16e7f65.js +1 -0
  721. package/.next-prod/static/chunks/9006.11537833945ec4b8.js +1 -0
  722. package/.next-prod/static/chunks/9015.c4e40321a6503a1b.js +1 -0
  723. package/.next-prod/static/chunks/90542734.58d84d15ab7a8c98.js +1 -0
  724. package/.next-prod/static/chunks/9114-abef8471519b7dee.js +1 -0
  725. package/.next-prod/static/chunks/9136.191be42a2fee842c.js +1 -0
  726. package/.next-prod/static/chunks/9178.48a90097ee3f0b0c.js +1 -0
  727. package/.next-prod/static/chunks/9186.3af6fcd13ab752fa.js +1 -0
  728. package/.next-prod/static/chunks/9189.3e9d29bf275ec462.js +1 -0
  729. package/.next-prod/static/chunks/9220.0206dd0432eca784.js +1 -0
  730. package/.next-prod/static/chunks/9224.401f9320ee58570b.js +1 -0
  731. package/.next-prod/static/chunks/9233.124321d2f404e01c.js +1 -0
  732. package/.next-prod/static/chunks/9240.d38ddbe94e0bf128.js +1 -0
  733. package/.next-prod/static/chunks/9261.303cbbe69262a995.js +1 -0
  734. package/.next-prod/static/chunks/9267.fbfd65ea31e7448c.js +1 -0
  735. package/.next-prod/static/chunks/9294.a20485f3282321b3.js +1 -0
  736. package/.next-prod/static/chunks/92e53eb0.097194be4a0e7d55.js +1 -0
  737. package/.next-prod/static/chunks/9302.726b065f2df0323a.js +1 -0
  738. package/.next-prod/static/chunks/9318.ba24787a52cefe4c.js +56 -0
  739. package/.next-prod/static/chunks/9373.6206c440af44002a.js +1 -0
  740. package/.next-prod/static/chunks/9377.f9db706e76f04afe.js +1 -0
  741. package/.next-prod/static/chunks/9382.bc0e11ecc88dd62c.js +1 -0
  742. package/.next-prod/static/chunks/9421.a5c1dbcfbfdd8f52.js +1 -0
  743. package/.next-prod/static/chunks/9448.2668b3cd408e86de.js +1 -0
  744. package/.next-prod/static/chunks/9466.3dacf5969d47ba2c.js +1 -0
  745. package/.next-prod/static/chunks/9521.e1240eb862eb32dc.js +1 -0
  746. package/.next-prod/static/chunks/9547.7729788fff21926f.js +1 -0
  747. package/.next-prod/static/chunks/9565.8de0671f99d12abe.js +1 -0
  748. package/.next-prod/static/chunks/9569.2f36b2b1c2f838d7.js +1 -0
  749. package/.next-prod/static/chunks/9615.3b62c13af671f714.js +1 -0
  750. package/.next-prod/static/chunks/9648.8235b6fea7087b3a.js +1 -0
  751. package/.next-prod/static/chunks/966.57e4cd93c2368d34.js +1 -0
  752. package/.next-prod/static/chunks/9666.a515fa6d89a71f1c.js +1 -0
  753. package/.next-prod/static/chunks/968.29d4ba7ee8bd5ccb.js +1 -0
  754. package/.next-prod/static/chunks/9680.d5ceac8967e0b6a8.js +1 -0
  755. package/.next-prod/static/chunks/9690.7773c72f0eff6dec.js +1 -0
  756. package/.next-prod/static/chunks/9841.422321143547591a.js +1 -0
  757. package/.next-prod/static/chunks/9842.3b71b65b30d8ef2a.js +1 -0
  758. package/.next-prod/static/chunks/9996.18b7bca2f0ab222e.js +1 -0
  759. package/.next-prod/static/chunks/aaea2bcf-6b3391c26b869501.js +1 -0
  760. package/.next-prod/static/chunks/af7f6608.85a7e1eb0d4130b0.js +53 -0
  761. package/.next-prod/static/chunks/app/_global-error/page-f2ae9d2d29d5fe08.js +1 -0
  762. package/.next-prod/static/chunks/app/_not-found/page-511b5b7e4ffc7ac9.js +1 -0
  763. package/.next-prod/static/chunks/app/api/bash/route-f2ae9d2d29d5fe08.js +1 -0
  764. package/.next-prod/static/chunks/app/api/chat/route-f2ae9d2d29d5fe08.js +1 -0
  765. package/.next-prod/static/chunks/app/api/claude-stats/route-f2ae9d2d29d5fe08.js +1 -0
  766. package/.next-prod/static/chunks/app/api/commands/route-f2ae9d2d29d5fe08.js +1 -0
  767. package/.next-prod/static/chunks/app/api/comments/route-f2ae9d2d29d5fe08.js +1 -0
  768. package/.next-prod/static/chunks/app/api/db/columns/route-f2ae9d2d29d5fe08.js +1 -0
  769. package/.next-prod/static/chunks/app/api/db/connect/route-f2ae9d2d29d5fe08.js +1 -0
  770. package/.next-prod/static/chunks/app/api/db/disconnect/route-f2ae9d2d29d5fe08.js +1 -0
  771. package/.next-prod/static/chunks/app/api/db/export/route-f2ae9d2d29d5fe08.js +1 -0
  772. package/.next-prod/static/chunks/app/api/db/query/route-f2ae9d2d29d5fe08.js +1 -0
  773. package/.next-prod/static/chunks/app/api/db/schemas/route-f2ae9d2d29d5fe08.js +1 -0
  774. package/.next-prod/static/chunks/app/api/extension/version/route-f2ae9d2d29d5fe08.js +1 -0
  775. package/.next-prod/static/chunks/app/api/file/route-f2ae9d2d29d5fe08.js +1 -0
  776. package/.next-prod/static/chunks/app/api/files/blame/route-f2ae9d2d29d5fe08.js +1 -0
  777. package/.next-prod/static/chunks/app/api/files/clipboard/route-f2ae9d2d29d5fe08.js +1 -0
  778. package/.next-prod/static/chunks/app/api/files/copy/route-f2ae9d2d29d5fe08.js +1 -0
  779. package/.next-prod/static/chunks/app/api/files/delete/route-f2ae9d2d29d5fe08.js +1 -0
  780. package/.next-prod/static/chunks/app/api/files/expanded/route-f2ae9d2d29d5fe08.js +1 -0
  781. package/.next-prod/static/chunks/app/api/files/index/route-f2ae9d2d29d5fe08.js +1 -0
  782. package/.next-prod/static/chunks/app/api/files/init/route-f2ae9d2d29d5fe08.js +1 -0
  783. package/.next-prod/static/chunks/app/api/files/paste/route-f2ae9d2d29d5fe08.js +1 -0
  784. package/.next-prod/static/chunks/app/api/files/read/route-f2ae9d2d29d5fe08.js +1 -0
  785. package/.next-prod/static/chunks/app/api/files/readdir/route-f2ae9d2d29d5fe08.js +1 -0
  786. package/.next-prod/static/chunks/app/api/files/recent/route-f2ae9d2d29d5fe08.js +1 -0
  787. package/.next-prod/static/chunks/app/api/files/save/route-f2ae9d2d29d5fe08.js +1 -0
  788. package/.next-prod/static/chunks/app/api/files/search/route-f2ae9d2d29d5fe08.js +1 -0
  789. package/.next-prod/static/chunks/app/api/git/branch-diff/route-f2ae9d2d29d5fe08.js +1 -0
  790. package/.next-prod/static/chunks/app/api/git/branches/route-f2ae9d2d29d5fe08.js +1 -0
  791. package/.next-prod/static/chunks/app/api/git/commit-diff/route-f2ae9d2d29d5fe08.js +1 -0
  792. package/.next-prod/static/chunks/app/api/git/commits/route-f2ae9d2d29d5fe08.js +1 -0
  793. package/.next-prod/static/chunks/app/api/git/diff/route-f2ae9d2d29d5fe08.js +1 -0
  794. package/.next-prod/static/chunks/app/api/git/discard/route-f2ae9d2d29d5fe08.js +1 -0
  795. package/.next-prod/static/chunks/app/api/git/stage/route-f2ae9d2d29d5fe08.js +1 -0
  796. package/.next-prod/static/chunks/app/api/git/status/route-f2ae9d2d29d5fe08.js +1 -0
  797. package/.next-prod/static/chunks/app/api/git/unstage/route-f2ae9d2d29d5fe08.js +1 -0
  798. package/.next-prod/static/chunks/app/api/git/worktree/route-f2ae9d2d29d5fe08.js +1 -0
  799. package/.next-prod/static/chunks/app/api/global-state/route-f2ae9d2d29d5fe08.js +1 -0
  800. package/.next-prod/static/chunks/app/api/jupyter/load/route-f2ae9d2d29d5fe08.js +1 -0
  801. package/.next-prod/static/chunks/app/api/jupyter/save/route-f2ae9d2d29d5fe08.js +1 -0
  802. package/.next-prod/static/chunks/app/api/jupyter/shutdown/route-f2ae9d2d29d5fe08.js +1 -0
  803. package/.next-prod/static/chunks/app/api/lsp/definition/route-f2ae9d2d29d5fe08.js +1 -0
  804. package/.next-prod/static/chunks/app/api/lsp/hover/route-f2ae9d2d29d5fe08.js +1 -0
  805. package/.next-prod/static/chunks/app/api/lsp/references/route-f2ae9d2d29d5fe08.js +1 -0
  806. package/.next-prod/static/chunks/app/api/lsp/status/route-f2ae9d2d29d5fe08.js +1 -0
  807. package/.next-prod/static/chunks/app/api/lsp/warmup/route-f2ae9d2d29d5fe08.js +1 -0
  808. package/.next-prod/static/chunks/app/api/mysql/columns/route-f2ae9d2d29d5fe08.js +1 -0
  809. package/.next-prod/static/chunks/app/api/mysql/connect/route-f2ae9d2d29d5fe08.js +1 -0
  810. package/.next-prod/static/chunks/app/api/mysql/disconnect/route-f2ae9d2d29d5fe08.js +1 -0
  811. package/.next-prod/static/chunks/app/api/mysql/export/route-f2ae9d2d29d5fe08.js +1 -0
  812. package/.next-prod/static/chunks/app/api/mysql/query/route-f2ae9d2d29d5fe08.js +1 -0
  813. package/.next-prod/static/chunks/app/api/mysql/schemas/route-f2ae9d2d29d5fe08.js +1 -0
  814. package/.next-prod/static/chunks/app/api/note/route-f2ae9d2d29d5fe08.js +1 -0
  815. package/.next-prod/static/chunks/app/api/open-cursor/route-f2ae9d2d29d5fe08.js +1 -0
  816. package/.next-prod/static/chunks/app/api/open-vscode/route-f2ae9d2d29d5fe08.js +1 -0
  817. package/.next-prod/static/chunks/app/api/pick-folder/route-f2ae9d2d29d5fe08.js +1 -0
  818. package/.next-prod/static/chunks/app/api/pinned-sessions/route-f2ae9d2d29d5fe08.js +1 -0
  819. package/.next-prod/static/chunks/app/api/project-settings/route-f2ae9d2d29d5fe08.js +1 -0
  820. package/.next-prod/static/chunks/app/api/project-state/route-f2ae9d2d29d5fe08.js +1 -0
  821. package/.next-prod/static/chunks/app/api/projects/route-f2ae9d2d29d5fe08.js +1 -0
  822. package/.next-prod/static/chunks/app/api/redis/command/route-f2ae9d2d29d5fe08.js +1 -0
  823. package/.next-prod/static/chunks/app/api/redis/connect/route-f2ae9d2d29d5fe08.js +1 -0
  824. package/.next-prod/static/chunks/app/api/redis/delete/route-f2ae9d2d29d5fe08.js +1 -0
  825. package/.next-prod/static/chunks/app/api/redis/disconnect/route-f2ae9d2d29d5fe08.js +1 -0
  826. package/.next-prod/static/chunks/app/api/redis/get/route-f2ae9d2d29d5fe08.js +1 -0
  827. package/.next-prod/static/chunks/app/api/redis/keys/route-f2ae9d2d29d5fe08.js +1 -0
  828. package/.next-prod/static/chunks/app/api/redis/set/route-f2ae9d2d29d5fe08.js +1 -0
  829. package/.next-prod/static/chunks/app/api/review/[id]/comments/route-f2ae9d2d29d5fe08.js +1 -0
  830. package/.next-prod/static/chunks/app/api/review/[id]/replies/route-f2ae9d2d29d5fe08.js +1 -0
  831. package/.next-prod/static/chunks/app/api/review/[id]/route-f2ae9d2d29d5fe08.js +1 -0
  832. package/.next-prod/static/chunks/app/api/review/identify/route-f2ae9d2d29d5fe08.js +1 -0
  833. package/.next-prod/static/chunks/app/api/review/order/route-f2ae9d2d29d5fe08.js +1 -0
  834. package/.next-prod/static/chunks/app/api/review/route-f2ae9d2d29d5fe08.js +1 -0
  835. package/.next-prod/static/chunks/app/api/review/share-info/route-f2ae9d2d29d5fe08.js +1 -0
  836. package/.next-prod/static/chunks/app/api/review/users/route-f2ae9d2d29d5fe08.js +1 -0
  837. package/.next-prod/static/chunks/app/api/scheduled-tasks/route-f2ae9d2d29d5fe08.js +1 -0
  838. package/.next-prod/static/chunks/app/api/services/config/route-f2ae9d2d29d5fe08.js +1 -0
  839. package/.next-prod/static/chunks/app/api/services/scripts/route-f2ae9d2d29d5fe08.js +1 -0
  840. package/.next-prod/static/chunks/app/api/session/[sessionId]/fork/route-f2ae9d2d29d5fe08.js +1 -0
  841. package/.next-prod/static/chunks/app/api/session/[sessionId]/history/route-f2ae9d2d29d5fe08.js +1 -0
  842. package/.next-prod/static/chunks/app/api/session-by-path/route-f2ae9d2d29d5fe08.js +1 -0
  843. package/.next-prod/static/chunks/app/api/sessions/projects/[encodedPath]/route-f2ae9d2d29d5fe08.js +1 -0
  844. package/.next-prod/static/chunks/app/api/sessions/projects/route-f2ae9d2d29d5fe08.js +1 -0
  845. package/.next-prod/static/chunks/app/api/sessions/route-f2ae9d2d29d5fe08.js +1 -0
  846. package/.next-prod/static/chunks/app/api/settings/route-f2ae9d2d29d5fe08.js +1 -0
  847. package/.next-prod/static/chunks/app/api/terminal/aliases/route-f2ae9d2d29d5fe08.js +1 -0
  848. package/.next-prod/static/chunks/app/api/terminal/autocomplete/route-f2ae9d2d29d5fe08.js +1 -0
  849. package/.next-prod/static/chunks/app/api/terminal/bubble-order/route-f2ae9d2d29d5fe08.js +1 -0
  850. package/.next-prod/static/chunks/app/api/terminal/env/route-f2ae9d2d29d5fe08.js +1 -0
  851. package/.next-prod/static/chunks/app/api/terminal/history/route-f2ae9d2d29d5fe08.js +1 -0
  852. package/.next-prod/static/chunks/app/api/version/route-f2ae9d2d29d5fe08.js +1 -0
  853. package/.next-prod/static/chunks/app/global-error-3c48d7d42c672863.js +1 -0
  854. package/.next-prod/static/chunks/app/layout-44210aade5d56585.js +1 -0
  855. package/.next-prod/static/chunks/app/manifest.webmanifest/route-f2ae9d2d29d5fe08.js +1 -0
  856. package/.next-prod/static/chunks/app/page-cc2bf3ca4c337090.js +1 -0
  857. package/.next-prod/static/chunks/app/project/page-fb1ff1d5d382977d.js +25 -0
  858. package/.next-prod/static/chunks/app/review/[id]/page-64f18d8d2476753c.js +1 -0
  859. package/.next-prod/static/chunks/ce16f5a9.5c7821b201f35593.js +1 -0
  860. package/.next-prod/static/chunks/cee15710.869cef5f741d40c2.js +1 -0
  861. package/.next-prod/static/chunks/cfdf2ac7.4506d3f72b310564.js +1 -0
  862. package/.next-prod/static/chunks/d1c28714.f52cffdd449a2d14.js +1 -0
  863. package/.next-prod/static/chunks/d3ac728e-d1ae8819b8f0be6a.js +1 -0
  864. package/.next-prod/static/chunks/e868780c.a081703edc1bc551.js +18 -0
  865. package/.next-prod/static/chunks/framework-81b2e59ffe13bb24.js +1 -0
  866. package/.next-prod/static/chunks/main-ac50dc1e450895a2.js +5 -0
  867. package/.next-prod/static/chunks/main-app-b76c0df33a946918.js +1 -0
  868. package/.next-prod/static/chunks/next/dist/client/components/builtin/app-error-f2ae9d2d29d5fe08.js +1 -0
  869. package/.next-prod/static/chunks/next/dist/client/components/builtin/forbidden-f2ae9d2d29d5fe08.js +1 -0
  870. package/.next-prod/static/chunks/next/dist/client/components/builtin/not-found-f2ae9d2d29d5fe08.js +1 -0
  871. package/.next-prod/static/chunks/next/dist/client/components/builtin/unauthorized-f2ae9d2d29d5fe08.js +1 -0
  872. package/.next-prod/static/chunks/polyfills-42372ed130431b0a.js +1 -0
  873. package/.next-prod/static/chunks/webpack-67d02a2a41508d41.js +1 -0
  874. package/.next-prod/static/css/2163ab5e45fedc6a.css +1 -0
  875. package/.next-prod/static/css/dd86f60184ab34a9.css +3 -0
  876. package/.next-prod/static/media/0086f8992871c45b-s.woff2 +0 -0
  877. package/.next-prod/static/media/03b436aa846269de-s.woff2 +0 -0
  878. package/.next-prod/static/media/08aedeceaf1dcd57-s.woff2 +0 -0
  879. package/.next-prod/static/media/0aa834ed78bf6d07-s.woff2 +0 -0
  880. package/.next-prod/static/media/19cfc7226ec3afaa-s.woff2 +0 -0
  881. package/.next-prod/static/media/21350d82a1f187e9-s.woff2 +0 -0
  882. package/.next-prod/static/media/36008747766f78c6-s.woff2 +0 -0
  883. package/.next-prod/static/media/5c0c2bcbaa4149ca-s.p.woff2 +0 -0
  884. package/.next-prod/static/media/67957d42bae0796d-s.woff2 +0 -0
  885. package/.next-prod/static/media/6d38f9d4e0f4772b-s.woff2 +0 -0
  886. package/.next-prod/static/media/886030b0b59bc5a7-s.woff2 +0 -0
  887. package/.next-prod/static/media/8e9860b6e62d6359-s.woff2 +0 -0
  888. package/.next-prod/static/media/939c4f875ee75fbb-s.woff2 +0 -0
  889. package/.next-prod/static/media/KaTeX_AMS-Regular.1608a09b.woff +0 -0
  890. package/.next-prod/static/media/KaTeX_AMS-Regular.4aafdb68.ttf +0 -0
  891. package/.next-prod/static/media/KaTeX_AMS-Regular.a79f1c31.woff2 +0 -0
  892. package/.next-prod/static/media/KaTeX_Caligraphic-Bold.b6770918.woff +0 -0
  893. package/.next-prod/static/media/KaTeX_Caligraphic-Bold.cce5b8ec.ttf +0 -0
  894. package/.next-prod/static/media/KaTeX_Caligraphic-Bold.ec17d132.woff2 +0 -0
  895. package/.next-prod/static/media/KaTeX_Caligraphic-Regular.07ef19e7.ttf +0 -0
  896. package/.next-prod/static/media/KaTeX_Caligraphic-Regular.55fac258.woff2 +0 -0
  897. package/.next-prod/static/media/KaTeX_Caligraphic-Regular.dad44a7f.woff +0 -0
  898. package/.next-prod/static/media/KaTeX_Fraktur-Bold.9f256b85.woff +0 -0
  899. package/.next-prod/static/media/KaTeX_Fraktur-Bold.b18f59e1.ttf +0 -0
  900. package/.next-prod/static/media/KaTeX_Fraktur-Bold.d42a5579.woff2 +0 -0
  901. package/.next-prod/static/media/KaTeX_Fraktur-Regular.7c187121.woff +0 -0
  902. package/.next-prod/static/media/KaTeX_Fraktur-Regular.d3c882a6.woff2 +0 -0
  903. package/.next-prod/static/media/KaTeX_Fraktur-Regular.ed38e79f.ttf +0 -0
  904. package/.next-prod/static/media/KaTeX_Main-Bold.b74a1a8b.ttf +0 -0
  905. package/.next-prod/static/media/KaTeX_Main-Bold.c3fb5ac2.woff2 +0 -0
  906. package/.next-prod/static/media/KaTeX_Main-Bold.d181c465.woff +0 -0
  907. package/.next-prod/static/media/KaTeX_Main-BoldItalic.6f2bb1df.woff2 +0 -0
  908. package/.next-prod/static/media/KaTeX_Main-BoldItalic.70d8b0a5.ttf +0 -0
  909. package/.next-prod/static/media/KaTeX_Main-BoldItalic.e3f82f9d.woff +0 -0
  910. package/.next-prod/static/media/KaTeX_Main-Italic.47373d1e.ttf +0 -0
  911. package/.next-prod/static/media/KaTeX_Main-Italic.8916142b.woff2 +0 -0
  912. package/.next-prod/static/media/KaTeX_Main-Italic.9024d815.woff +0 -0
  913. package/.next-prod/static/media/KaTeX_Main-Regular.0462f03b.woff2 +0 -0
  914. package/.next-prod/static/media/KaTeX_Main-Regular.7f51fe03.woff +0 -0
  915. package/.next-prod/static/media/KaTeX_Main-Regular.b7f8fe9b.ttf +0 -0
  916. package/.next-prod/static/media/KaTeX_Math-BoldItalic.572d331f.woff2 +0 -0
  917. package/.next-prod/static/media/KaTeX_Math-BoldItalic.a879cf83.ttf +0 -0
  918. package/.next-prod/static/media/KaTeX_Math-BoldItalic.f1035d8d.woff +0 -0
  919. package/.next-prod/static/media/KaTeX_Math-Italic.5295ba48.woff +0 -0
  920. package/.next-prod/static/media/KaTeX_Math-Italic.939bc644.ttf +0 -0
  921. package/.next-prod/static/media/KaTeX_Math-Italic.f28c23ac.woff2 +0 -0
  922. package/.next-prod/static/media/KaTeX_SansSerif-Bold.8c5b5494.woff2 +0 -0
  923. package/.next-prod/static/media/KaTeX_SansSerif-Bold.94e1e8dc.ttf +0 -0
  924. package/.next-prod/static/media/KaTeX_SansSerif-Bold.bf59d231.woff +0 -0
  925. package/.next-prod/static/media/KaTeX_SansSerif-Italic.3b1e59b3.woff2 +0 -0
  926. package/.next-prod/static/media/KaTeX_SansSerif-Italic.7c9bc82b.woff +0 -0
  927. package/.next-prod/static/media/KaTeX_SansSerif-Italic.b4c20c84.ttf +0 -0
  928. package/.next-prod/static/media/KaTeX_SansSerif-Regular.74048478.woff +0 -0
  929. package/.next-prod/static/media/KaTeX_SansSerif-Regular.ba21ed5f.woff2 +0 -0
  930. package/.next-prod/static/media/KaTeX_SansSerif-Regular.d4d7ba48.ttf +0 -0
  931. package/.next-prod/static/media/KaTeX_Script-Regular.03e9641d.woff2 +0 -0
  932. package/.next-prod/static/media/KaTeX_Script-Regular.07505710.woff +0 -0
  933. package/.next-prod/static/media/KaTeX_Script-Regular.fe9cbbe1.ttf +0 -0
  934. package/.next-prod/static/media/KaTeX_Size1-Regular.e1e279cb.woff +0 -0
  935. package/.next-prod/static/media/KaTeX_Size1-Regular.eae34984.woff2 +0 -0
  936. package/.next-prod/static/media/KaTeX_Size1-Regular.fabc004a.ttf +0 -0
  937. package/.next-prod/static/media/KaTeX_Size2-Regular.57727022.woff +0 -0
  938. package/.next-prod/static/media/KaTeX_Size2-Regular.5916a24f.woff2 +0 -0
  939. package/.next-prod/static/media/KaTeX_Size2-Regular.d6b476ec.ttf +0 -0
  940. package/.next-prod/static/media/KaTeX_Size3-Regular.9acaf01c.woff +0 -0
  941. package/.next-prod/static/media/KaTeX_Size3-Regular.a144ef58.ttf +0 -0
  942. package/.next-prod/static/media/KaTeX_Size3-Regular.b4230e7e.woff2 +0 -0
  943. package/.next-prod/static/media/KaTeX_Size4-Regular.10d95fd3.woff2 +0 -0
  944. package/.next-prod/static/media/KaTeX_Size4-Regular.7a996c9d.woff +0 -0
  945. package/.next-prod/static/media/KaTeX_Size4-Regular.fbccdabe.ttf +0 -0
  946. package/.next-prod/static/media/KaTeX_Typewriter-Regular.6258592b.woff +0 -0
  947. package/.next-prod/static/media/KaTeX_Typewriter-Regular.a8709e36.woff2 +0 -0
  948. package/.next-prod/static/media/KaTeX_Typewriter-Regular.d97aaf4a.ttf +0 -0
  949. package/.next-prod/static/media/ab00a911ac2adf48-s.woff2 +0 -0
  950. package/.next-prod/static/media/ba9851c3c22cd980-s.woff2 +0 -0
  951. package/.next-prod/static/media/bb3ef058b751a6ad-s.p.woff2 +0 -0
  952. package/.next-prod/static/media/c5fe6dc8356a8c31-s.woff2 +0 -0
  953. package/.next-prod/static/media/df0a9ae256c0569c-s.woff2 +0 -0
  954. package/.next-prod/static/media/e4af272ccee01ff0-s.p.woff2 +0 -0
  955. package/.next-prod/static/media/f911b923c6adde36-s.woff2 +0 -0
  956. package/.next-prod/trace +12 -0
  957. package/.next-prod/trace-build +1 -0
  958. package/.next-prod/types/app/api/bash/route.ts +350 -0
  959. package/.next-prod/types/app/api/chat/route.ts +350 -0
  960. package/.next-prod/types/app/api/claude-stats/route.ts +350 -0
  961. package/.next-prod/types/app/api/commands/route.ts +350 -0
  962. package/.next-prod/types/app/api/comments/route.ts +350 -0
  963. package/.next-prod/types/app/api/db/columns/route.ts +350 -0
  964. package/.next-prod/types/app/api/db/connect/route.ts +350 -0
  965. package/.next-prod/types/app/api/db/disconnect/route.ts +350 -0
  966. package/.next-prod/types/app/api/db/export/route.ts +350 -0
  967. package/.next-prod/types/app/api/db/query/route.ts +350 -0
  968. package/.next-prod/types/app/api/db/schemas/route.ts +350 -0
  969. package/.next-prod/types/app/api/extension/version/route.ts +350 -0
  970. package/.next-prod/types/app/api/file/route.ts +350 -0
  971. package/.next-prod/types/app/api/files/blame/route.ts +350 -0
  972. package/.next-prod/types/app/api/files/clipboard/route.ts +350 -0
  973. package/.next-prod/types/app/api/files/copy/route.ts +350 -0
  974. package/.next-prod/types/app/api/files/delete/route.ts +350 -0
  975. package/.next-prod/types/app/api/files/expanded/route.ts +350 -0
  976. package/.next-prod/types/app/api/files/index/route.ts +350 -0
  977. package/.next-prod/types/app/api/files/init/route.ts +350 -0
  978. package/.next-prod/types/app/api/files/paste/route.ts +350 -0
  979. package/.next-prod/types/app/api/files/read/route.ts +350 -0
  980. package/.next-prod/types/app/api/files/readdir/route.ts +350 -0
  981. package/.next-prod/types/app/api/files/recent/route.ts +350 -0
  982. package/.next-prod/types/app/api/files/save/route.ts +350 -0
  983. package/.next-prod/types/app/api/files/search/route.ts +350 -0
  984. package/.next-prod/types/app/api/git/branch-diff/route.ts +350 -0
  985. package/.next-prod/types/app/api/git/branches/route.ts +350 -0
  986. package/.next-prod/types/app/api/git/commit-diff/route.ts +350 -0
  987. package/.next-prod/types/app/api/git/commits/route.ts +350 -0
  988. package/.next-prod/types/app/api/git/diff/route.ts +350 -0
  989. package/.next-prod/types/app/api/git/discard/route.ts +350 -0
  990. package/.next-prod/types/app/api/git/stage/route.ts +350 -0
  991. package/.next-prod/types/app/api/git/status/route.ts +350 -0
  992. package/.next-prod/types/app/api/git/unstage/route.ts +350 -0
  993. package/.next-prod/types/app/api/git/worktree/route.ts +350 -0
  994. package/.next-prod/types/app/api/global-state/route.ts +350 -0
  995. package/.next-prod/types/app/api/jupyter/load/route.ts +350 -0
  996. package/.next-prod/types/app/api/jupyter/save/route.ts +350 -0
  997. package/.next-prod/types/app/api/jupyter/shutdown/route.ts +350 -0
  998. package/.next-prod/types/app/api/lsp/definition/route.ts +350 -0
  999. package/.next-prod/types/app/api/lsp/hover/route.ts +350 -0
  1000. package/.next-prod/types/app/api/lsp/references/route.ts +350 -0
  1001. package/.next-prod/types/app/api/lsp/status/route.ts +350 -0
  1002. package/.next-prod/types/app/api/lsp/warmup/route.ts +350 -0
  1003. package/.next-prod/types/app/api/mysql/columns/route.ts +350 -0
  1004. package/.next-prod/types/app/api/mysql/connect/route.ts +350 -0
  1005. package/.next-prod/types/app/api/mysql/disconnect/route.ts +350 -0
  1006. package/.next-prod/types/app/api/mysql/export/route.ts +350 -0
  1007. package/.next-prod/types/app/api/mysql/query/route.ts +350 -0
  1008. package/.next-prod/types/app/api/mysql/schemas/route.ts +350 -0
  1009. package/.next-prod/types/app/api/note/route.ts +350 -0
  1010. package/.next-prod/types/app/api/open-cursor/route.ts +350 -0
  1011. package/.next-prod/types/app/api/open-vscode/route.ts +350 -0
  1012. package/.next-prod/types/app/api/pick-folder/route.ts +350 -0
  1013. package/.next-prod/types/app/api/pinned-sessions/route.ts +350 -0
  1014. package/.next-prod/types/app/api/project-settings/route.ts +350 -0
  1015. package/.next-prod/types/app/api/project-state/route.ts +350 -0
  1016. package/.next-prod/types/app/api/projects/route.ts +350 -0
  1017. package/.next-prod/types/app/api/redis/command/route.ts +350 -0
  1018. package/.next-prod/types/app/api/redis/connect/route.ts +350 -0
  1019. package/.next-prod/types/app/api/redis/delete/route.ts +350 -0
  1020. package/.next-prod/types/app/api/redis/disconnect/route.ts +350 -0
  1021. package/.next-prod/types/app/api/redis/get/route.ts +350 -0
  1022. package/.next-prod/types/app/api/redis/keys/route.ts +350 -0
  1023. package/.next-prod/types/app/api/redis/set/route.ts +350 -0
  1024. package/.next-prod/types/app/api/review/[id]/comments/route.ts +350 -0
  1025. package/.next-prod/types/app/api/review/[id]/replies/route.ts +350 -0
  1026. package/.next-prod/types/app/api/review/[id]/route.ts +350 -0
  1027. package/.next-prod/types/app/api/review/identify/route.ts +350 -0
  1028. package/.next-prod/types/app/api/review/order/route.ts +350 -0
  1029. package/.next-prod/types/app/api/review/route.ts +350 -0
  1030. package/.next-prod/types/app/api/review/share-info/route.ts +350 -0
  1031. package/.next-prod/types/app/api/review/users/route.ts +350 -0
  1032. package/.next-prod/types/app/api/scheduled-tasks/route.ts +350 -0
  1033. package/.next-prod/types/app/api/services/config/route.ts +350 -0
  1034. package/.next-prod/types/app/api/services/scripts/route.ts +350 -0
  1035. package/.next-prod/types/app/api/session/[sessionId]/fork/route.ts +350 -0
  1036. package/.next-prod/types/app/api/session/[sessionId]/history/route.ts +350 -0
  1037. package/.next-prod/types/app/api/session-by-path/route.ts +350 -0
  1038. package/.next-prod/types/app/api/sessions/projects/[encodedPath]/route.ts +350 -0
  1039. package/.next-prod/types/app/api/sessions/projects/route.ts +350 -0
  1040. package/.next-prod/types/app/api/sessions/route.ts +350 -0
  1041. package/.next-prod/types/app/api/settings/route.ts +350 -0
  1042. package/.next-prod/types/app/api/terminal/aliases/route.ts +350 -0
  1043. package/.next-prod/types/app/api/terminal/autocomplete/route.ts +350 -0
  1044. package/.next-prod/types/app/api/terminal/bubble-order/route.ts +350 -0
  1045. package/.next-prod/types/app/api/terminal/env/route.ts +350 -0
  1046. package/.next-prod/types/app/api/terminal/history/route.ts +350 -0
  1047. package/.next-prod/types/app/api/version/route.ts +350 -0
  1048. package/.next-prod/types/app/page.ts +86 -0
  1049. package/.next-prod/types/app/project/page.ts +86 -0
  1050. package/.next-prod/types/app/review/[id]/page.ts +86 -0
  1051. package/.next-prod/types/package.json +1 -0
  1052. package/.next-prod/types/routes.d.ts +164 -0
  1053. package/.next-prod/types/validator.ts +898 -0
  1054. package/LICENSE +21 -0
  1055. package/README.md +94 -0
  1056. package/README.zh.md +100 -0
  1057. package/bin/cock-browser.mjs +435 -0
  1058. package/bin/cock-dev.mjs +6 -0
  1059. package/bin/cock-terminal.mjs +215 -0
  1060. package/bin/cock.mjs +99 -0
  1061. package/bin/postinstall.mjs +29 -0
  1062. package/chrome-extension/automation.js +684 -0
  1063. package/chrome-extension/background.js +364 -0
  1064. package/chrome-extension/content.js +224 -0
  1065. package/chrome-extension/disguise.js +14 -0
  1066. package/chrome-extension/icons/icon128.png +0 -0
  1067. package/chrome-extension/icons/icon16.png +0 -0
  1068. package/chrome-extension/icons/icon48.png +0 -0
  1069. package/chrome-extension/manifest.json +42 -0
  1070. package/chrome-extension/network-capture.js +197 -0
  1071. package/chrome-extension/rules.json +56 -0
  1072. package/dist/JupyterKernelManager-475VNVA5.mjs +248 -0
  1073. package/dist/chunk-OER3N6H7.mjs +250 -0
  1074. package/dist/scheduledTasks.mjs +418 -0
  1075. package/dist/wsServer.mjs +1441 -0
  1076. package/next.config.ts +18 -0
  1077. package/package.json +122 -0
  1078. package/public/favicon.ico +0 -0
  1079. package/public/icons/dev/icon-128x128.png +0 -0
  1080. package/public/icons/dev/icon-144x144.png +0 -0
  1081. package/public/icons/dev/icon-152x152.png +0 -0
  1082. package/public/icons/dev/icon-192x192.png +0 -0
  1083. package/public/icons/dev/icon-384x384.png +0 -0
  1084. package/public/icons/dev/icon-512x512.png +0 -0
  1085. package/public/icons/dev/icon-72x72.png +0 -0
  1086. package/public/icons/dev/icon-96x96.png +0 -0
  1087. package/public/icons/icon-128x128.png +0 -0
  1088. package/public/icons/icon-144x144.png +0 -0
  1089. package/public/icons/icon-152x152.png +0 -0
  1090. package/public/icons/icon-192x192.png +0 -0
  1091. package/public/icons/icon-384x384.png +0 -0
  1092. package/public/icons/icon-512x512.png +0 -0
  1093. package/public/icons/icon-72x72.png +0 -0
  1094. package/public/icons/icon-96x96.png +0 -0
  1095. package/server.mjs +135 -0
@@ -0,0 +1,29 @@
1
+ (()=>{var a={};a.id=6500,a.ids=[6500],a.modules={243:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{M:()=>p});var e=c(48249),f=c(67484),g=c(84705),h=c(99117),i=c(77937),j=c(45214),k=c(77033),l=c(47033),m=c(23434),n=c(44384),o=a([g]);g=(o.then?(await o)():o)[0];let p=(0,f.forwardRef)(function({messages:a,isLoading:b,cwd:c,sessionId:d,hasMoreHistory:o,isLoadingMore:p,onLoadMore:q,onFork:r,isActive:s=!0,onContentSearch:t},u){let{t:v}=(0,n.Bd)(),w=(0,f.useRef)(null),x=(0,f.useRef)(null),y=(0,f.useRef)(null),z=(0,f.useRef)(null),[A,B]=(0,f.useState)(null),[C,D]=(0,f.useState)(!0),[E,F]=(0,f.useState)(!1),[G,H]=(0,f.useState)(!1);(0,f.useEffect)(()=>{B(z.current)},[]);let{isSearchVisible:I,searchQuery:J,setSearchQuery:K,matches:L,currentMatchIndex:M,goToNextMatch:N,goToPrevMatch:O,closeSearch:P,searchInputRef:Q,handleSearchKeyDown:R}=(0,h.a)(z),S=(0,k.nH)(),T=(0,f.useRef)(null),U=(0,f.useRef)(()=>{}),{addComment:V,refresh:W}=(0,l._)({cwd:c||"",filePath:m.Un}),[X,Y]=(0,f.useState)(null),[Z,$]=(0,f.useState)(null),_=(0,f.useCallback)(a=>{if(X||Z)return;let b=window.getSelection();if(!b||b.isCollapsed||!b.rangeCount){T.current=null,U.current();return}let c=b.toString().trim();if(!c){T.current=null,U.current();return}let d=b.anchorNode instanceof HTMLElement?b.anchorNode:b.anchorNode?.parentElement;if(d?.closest('[data-role="user"]')){T.current=null,U.current();return}T.current={x:a.clientX,y:a.clientY,range:{start:0,end:0},selectedText:c},U.current()},[X,Z]),aa=(0,f.useCallback)(a=>{let b=a.target;!(b.closest(".floating-toolbar")||b.closest('[class*="z-[200]"]'))&&T.current&&(T.current=null,U.current())},[]),ab=(0,f.useCallback)(()=>{let a=T.current;a&&(Y({x:a.x,y:a.y,text:a.selectedText}),T.current=null,U.current(),window.getSelection()?.removeAllRanges())},[]),ac=(0,f.useCallback)(()=>{let a=T.current;a&&($({x:a.x,y:a.y,text:a.selectedText}),T.current=null,U.current(),window.getSelection()?.removeAllRanges())},[]),ad=(0,f.useCallback)(()=>{let a=T.current;if(!a||!t)return;let b=a.selectedText.trim();T.current=null,U.current(),window.getSelection()?.removeAllRanges(),b&&t(b)},[t]),ae=(0,f.useCallback)(async a=>{X&&(await V(0,0,a,X.text),Y(null))},[X,V]),af=(0,f.useCallback)(async a=>{if(Z&&S&&c)try{let b=(await (0,m.$3)(c)).map(a=>({filePath:a.filePath,startLine:a.startLine,endLine:a.endLine,codeContent:a.codeContent,note:a.content||void 0}));b.push({filePath:m.Un,startLine:0,endLine:0,codeContent:Z.text});let d=(0,m.Gw)(b,a);S.sendMessage(d),await (0,m.RP)(c),W(),$(null)}catch(a){console.error("Failed to send to AI:",a)}},[Z,S,c,W]),ag=(0,f.useMemo)(()=>{let b=new Set;return a.filter(a=>!b.has(a.id)&&(b.add(a.id),!0))},[a]),ah=(0,f.useRef)(0),ai=(0,f.useRef)(!1),aj=(0,f.useCallback)(()=>{let a=y.current;return!a||a.scrollHeight-a.scrollTop-a.clientHeight<50},[]),ak=(0,f.useCallback)(()=>{let a=y.current;return!a||a.scrollTop<50},[]),al=(0,f.useCallback)(()=>{let a=aj(),b=ak();if(D(a),F(!b),H(!a),b&&o&&!p&&q){let a=y.current;a&&(ah.current=a.scrollHeight,ai.current=!0),q()}},[aj,ak,o,p,q]),am=(0,f.useCallback)(()=>{x.current?.scrollIntoView({behavior:"smooth"})},[]),an=(0,f.useCallback)(()=>{w.current?.scrollIntoView({behavior:"smooth"})},[]),ao=(0,f.useCallback)(a=>{let b=y.current;if(!b)return;let c=b.querySelector(`[data-message-id="${a}"]`);c&&(c.scrollIntoView({behavior:"smooth",block:"center"}),c.classList.add("ring-2","ring-brand","ring-offset-2"),setTimeout(()=>{c.classList.remove("ring-2","ring-brand","ring-offset-2")},2e3))},[]);(0,f.useImperativeHandle)(u,()=>({scrollToMessage:ao}),[ao]);let ap=(0,f.useRef)(0),aq=(0,f.useRef)(!0);(0,f.useEffect)(()=>{let b=ap.current,c=a.length;ap.current=c,!aq.current&&C&&c>b&&w.current?.scrollIntoView({behavior:"smooth"})},[a,C]),(0,f.useEffect)(()=>{C&&b&&w.current?.scrollIntoView({behavior:"smooth"})},[b,C]),(0,f.useEffect)(()=>{if(ai.current&&!p){let a=y.current;if(a){let b=a.scrollHeight-ah.current;a.scrollTop=b,ai.current=!1}}},[a,p]);let ar=(0,f.useRef)(!1);return(0,f.useEffect)(()=>{s&&ar.current&&a.length>0&&(ar.current=!1,w.current?.scrollIntoView({behavior:"instant"}))},[s,a.length]),(0,f.useEffect)(()=>{aq.current&&a.length>0&&(aq.current=!1,s?w.current?.scrollIntoView({behavior:"instant"}):ar.current=!0)},[a.length,s]),(0,e.jsxs)("div",{ref:z,className:"relative flex-1 min-h-0 overflow-hidden flex flex-col outline-none",tabIndex:-1,onMouseUp:_,onMouseDown:aa,children:[I&&(0,e.jsxs)("div",{className:"flex-shrink-0 flex items-center gap-2 px-3 py-2 bg-secondary border-b border-border",children:[(0,e.jsx)("input",{ref:Q,type:"text",value:J,onChange:a=>K(a.target.value),onKeyDown:R,placeholder:v("codeViewer.searchChat"),className:"flex-1 max-w-xs px-2 py-1 text-sm border border-border rounded bg-card text-foreground focus:outline-none focus:ring-2 focus:ring-ring"}),(0,e.jsx)("span",{className:"text-xs text-muted-foreground",children:L.length>0?`${M+1}/${L.length}`:v("common.noMatch")}),(0,e.jsx)("button",{onClick:O,disabled:0===L.length,className:"p-1 rounded hover:bg-accent disabled:opacity-50",title:v("codeViewer.prevShiftEnter"),children:(0,e.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 15l7-7 7 7"})})}),(0,e.jsx)("button",{onClick:N,disabled:0===L.length,className:"p-1 rounded hover:bg-accent disabled:opacity-50",title:v("codeViewer.nextEnter"),children:(0,e.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})}),(0,e.jsx)("button",{onClick:P,className:"p-1 rounded hover:bg-accent",title:v("codeViewer.closeEsc"),children:(0,e.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),(0,e.jsx)("div",{ref:y,onScroll:al,className:"relative flex-1 min-h-0 overflow-y-auto p-4",children:0!==a.length||b?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("div",{ref:x}),o&&(0,e.jsx)("div",{className:"flex justify-center py-3",children:p?(0,e.jsxs)("div",{className:"flex items-center gap-2 text-muted-foreground text-sm",children:[(0,e.jsx)("span",{className:"inline-block w-4 h-4 border-2 border-brand border-t-transparent rounded-full animate-spin"}),(0,e.jsx)("span",{children:v("chat.loadMoreHistory")})]}):(0,e.jsx)("button",{onClick:q,className:"text-sm text-muted-foreground hover:text-foreground transition-colors",children:v("chat.scrollUpForMore")})}),ag.map(a=>(0,e.jsx)("div",{"data-message-id":a.id,className:"transition-[box-shadow] duration-300",children:(0,e.jsx)(g.s,{message:a,cwd:c,sessionId:d,onFork:r})},a.id)),b&&(0,e.jsx)("div",{className:"flex justify-start mb-4",children:(0,e.jsx)("div",{className:"bg-accent rounded-2xl rounded-bl-md px-4 py-3",children:(0,e.jsxs)("div",{className:"flex items-center gap-2 text-muted-foreground",children:[(0,e.jsx)("span",{className:"inline-block w-5 h-5 border-2 border-brand border-t-transparent rounded-full animate-spin"}),(0,e.jsx)("span",{className:"text-sm",children:v("chat.claudeThinking")})]})})}),(0,e.jsx)("div",{ref:w})]}):(0,e.jsx)("div",{className:"flex items-center justify-center h-full text-slate-9",children:(0,e.jsxs)("div",{className:"text-center",children:[(0,e.jsx)("div",{className:"text-4xl mb-4",children:"\uD83D\uDCAC"}),(0,e.jsx)("div",{children:v("chat.startConversation")})]})})}),E&&a.length>0&&(0,e.jsx)("button",{onClick:am,className:"absolute top-2 left-1/2 -translate-x-1/2 p-2 bg-card text-muted-foreground hover:text-foreground shadow-md rounded-full transition-all hover:shadow-lg active:scale-95",title:v("chat.jumpToStart"),children:(0,e.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 15l7-7 7 7"})})}),G&&a.length>0&&(0,e.jsx)("button",{onClick:an,className:"absolute bottom-2 left-1/2 -translate-x-1/2 p-2 bg-card text-muted-foreground hover:text-foreground shadow-md rounded-full transition-all hover:shadow-lg active:scale-95",title:v("chat.jumpToLatest"),children:(0,e.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})}),A&&(0,e.jsx)(i.f,{floatingToolbarRef:T,bumpRef:U,container:A,onAddComment:ab,onSendToAI:ac,onSearch:t?ad:void 0,isChatLoading:S?.isLoading}),X&&A&&(0,e.jsx)(j.t,{x:X.x,y:X.y,range:{start:0,end:0},codeContent:X.text,container:A,onSubmit:ae,onClose:()=>Y(null)}),Z&&A&&(0,e.jsx)(j.G,{x:Z.x,y:Z.y,range:{start:0,end:0},codeContent:Z.text,container:A,onSubmit:af,onClose:()=>$(null),isChatLoading:S?.isLoading})]})});d()}catch(a){d(a)}})},261:a=>{"use strict";a.exports=require("next/dist/shared/lib/router/utils/app-paths")},1708:a=>{"use strict";a.exports=require("node:process")},1906:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{D:()=>k});var e=c(48249),f=c(67484),g=c(44384),h=c(46674),i=c(5811),j=a([i]);function k({references:a,loading:b,onSelect:c,onClose:d}){let{t:i}=(0,g.Bd)(),j=function(a){let[b,c]=(0,f.useState)(new Map),[d,e]=(0,f.useState)(!1);return(0,f.useRef)(0),b}(0),k=[],l=new Map;for(let b=0;b<a.length;b++){let c=a[b],d=l.get(c.file);void 0===d&&(d=k.length,l.set(c.file,d),k.push({file:c.file,items:[]})),k[d].items.push({ref:c,idx:b})}return(0,e.jsxs)("div",{className:"border-t border-border bg-secondary flex flex-col",style:{height:"300px"},children:[(0,e.jsxs)("div",{className:"flex items-center justify-between px-3 py-1.5 bg-card/50 border-b border-border flex-shrink-0",children:[(0,e.jsxs)("span",{className:"text-xs font-medium text-foreground",children:[i("references.title")," ",!b&&`(${a.length})`]}),(0,e.jsx)("button",{onClick:d,className:"p-0.5 rounded hover:bg-accent text-muted-foreground",children:(0,e.jsx)(h.A,{className:"w-3.5 h-3.5"})})]}),(0,e.jsx)("div",{className:"flex-1 overflow-auto",children:b?(0,e.jsx)("div",{className:"px-3 py-2 text-xs text-muted-foreground",children:i("references.searching")}):0===a.length?(0,e.jsx)("div",{className:"px-3 py-2 text-xs text-muted-foreground",children:i("references.notFound")}):k.map(({file:a,items:b})=>(0,e.jsxs)("div",{children:[(0,e.jsx)("div",{className:"px-3 py-1 text-xs text-muted-foreground font-medium bg-card/30 sticky top-0",children:a}),b.map(({ref:a,idx:b})=>(0,e.jsxs)("button",{onClick:()=>c(a),className:"w-full text-left px-3 py-0.5 hover:bg-accent/50 flex items-baseline gap-2 group",children:[(0,e.jsx)("span",{className:"text-sm text-muted-foreground font-mono font-variant-tabular flex-shrink-0 w-10 text-right",children:a.line}),j.has(b)?(0,e.jsx)("span",{className:"text-sm font-mono truncate",dangerouslySetInnerHTML:{__html:j.get(b)}}):(0,e.jsx)("span",{className:"text-sm font-mono text-foreground truncate",children:a.lineText||""})]},`${a.line}-${a.column}-${b}`))]},a))})]})}i=(j.then?(await j)():j)[0],d()}catch(a){d(a)}})},2868:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{n:()=>m});var e=c(48249),f=c(67484),g=c(44384),h=c(86402),i=c(95836),j=c(56929),k=c(36645),l=a([h]);function m({isOpen:a,onClose:b,commit:c,cwd:d,embedded:l=!1,initialFilePath:m,onContentSearch:n}){let{t:o}=(0,g.Bd)(),[p,q]=(0,f.useState)([]),[r,s]=(0,f.useState)([]),[t,u]=(0,f.useState)(new Set),[v,w]=(0,f.useState)(null),[x,y]=(0,f.useState)(null),[z,A]=(0,f.useState)(!1),[B,C]=(0,f.useState)(!1),[D,E]=(0,f.useState)(null),F=(0,f.useRef)(null),G=(0,k.o)(F),H=(0,f.useCallback)(a=>{c&&(w(a),C(!0),fetch(`/api/git/commit-diff?cwd=${encodeURIComponent(d)}&hash=${c.hash}&file=${encodeURIComponent(a.path)}`).then(a=>a.json()).then(a=>y(a)).catch(console.error).finally(()=>C(!1)))},[d,c]),I=(0,f.useCallback)(a=>{u(b=>{let c=new Set(b);return c.has(a)?c.delete(a):c.add(a),c})},[]),J=(0,f.useMemo)(()=>{if(!c)return"";if(c.date){var a;let b,d,e,f,g,h,i;return a=c.date,b=new Date(a),d=new Date,e=b.getFullYear()===d.getFullYear(),f=String(b.getMonth()+1).padStart(2,"0"),g=String(b.getDate()).padStart(2,"0"),h=String(b.getHours()).padStart(2,"0"),i=String(b.getMinutes()).padStart(2,"0"),e?`${f}-${g} ${h}:${i}`:`${b.getFullYear()}-${f}-${g} ${h}:${i}`}return c.time?new Date(1e3*c.time).toLocaleString():""},[c]);if(!a||!c)return null;let K=(0,e.jsxs)("div",{className:"flex-1 flex flex-col overflow-hidden",children:[(0,e.jsxs)("div",{className:"px-4 py-3 border-b border-border bg-secondary flex-shrink-0",children:[(0,e.jsx)("div",{className:"text-sm font-medium text-foreground mb-2",children:c.subject}),c.body&&(0,e.jsx)("div",{className:"text-xs text-muted-foreground whitespace-pre-wrap mb-3 max-h-32 overflow-y-auto border-l-2 border-border pl-3",children:c.body}),(0,e.jsxs)("div",{className:"flex flex-wrap gap-4 text-xs text-muted-foreground",children:[(0,e.jsxs)("div",{className:"flex items-center gap-1",children:[(0,e.jsx)("span",{className:"text-slate-9",children:o("commitDetail.hash")}),(0,e.jsx)("span",{className:"font-mono bg-accent px-1.5 py-0.5 rounded",children:c.hash})]}),(0,e.jsxs)("div",{className:"flex items-center gap-1",children:[(0,e.jsx)("span",{className:"text-slate-9",children:o("commitDetail.author")}),(0,e.jsx)("span",{children:c.author}),(0,e.jsxs)("span",{className:"text-slate-9",children:["<",c.authorEmail,">"]})]}),(0,e.jsxs)("div",{className:"flex items-center gap-1",children:[(0,e.jsx)("span",{className:"text-slate-9",children:o("commitDetail.date")}),(0,e.jsx)("span",{children:J}),c.relativeDate&&(0,e.jsxs)("span",{className:"text-slate-9",children:["(",c.relativeDate,")"]})]}),(0,e.jsxs)("div",{className:"flex items-center gap-1",children:[(0,e.jsx)("span",{className:"text-slate-9",children:o("commitDetail.files")}),(0,e.jsx)("span",{children:o("commitDetail.nChanges",{count:p.length})})]})]})]}),(0,e.jsxs)("div",{className:"flex-1 flex overflow-hidden",children:[(0,e.jsx)("div",{className:"w-72 flex-shrink-0 border-r border-border overflow-y-auto overflow-x-hidden",children:z?(0,e.jsx)("div",{className:"p-4 text-center text-muted-foreground text-sm",children:o("commitDetail.loadingFiles")}):(0,e.jsx)(i.VO,{files:r,selectedPath:v?.path||null,expandedPaths:t,onSelect:a=>a.file&&H(a.file),onToggle:I,cwd:d,showChanges:!0,emptyMessage:o("commitDetail.noFileChanges"),className:"py-1"})}),(0,e.jsx)("div",{className:"flex-1 overflow-hidden",children:B?(0,e.jsx)("div",{className:"h-full flex items-center justify-center text-muted-foreground text-sm",children:o("commitDetail.loadingDiff")}):x?(0,e.jsx)(h.xZ,{oldContent:x.oldContent,newContent:x.newContent,filePath:x.filePath,isNew:x.isNew,isDeleted:x.isDeleted,cwd:d,enableComments:!0,onPreview:!x.isDeleted&&x.filePath.endsWith(".json")?()=>E({content:x.newContent,filePath:x.filePath}):void 0,previewLabel:o("common.readable"),onContentSearch:n}):(0,e.jsx)("div",{className:"h-full flex items-center justify-center text-muted-foreground text-sm",children:o("commitDetail.selectFileToView")})})]})]}),L=D&&(0,e.jsx)("div",{className:"absolute inset-0 z-50 flex items-center justify-center bg-black/50",onClick:()=>E(null),children:(0,e.jsxs)("div",{className:"bg-card rounded-lg shadow-xl w-full max-w-[90%] h-[90%] flex flex-col",onClick:a=>a.stopPropagation(),children:[(0,e.jsxs)("div",{className:"flex items-center justify-between px-4 py-2 border-b border-border flex-shrink-0",children:[(0,e.jsx)("span",{className:"text-sm text-muted-foreground font-mono truncate",children:D.filePath}),(0,e.jsx)("button",{onClick:()=>E(null),className:"p-1 text-muted-foreground hover:text-foreground hover:bg-accent rounded transition-colors",children:(0,e.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),(0,e.jsx)(k._,{search:G}),(0,e.jsx)("div",{className:"flex-1 overflow-auto px-6 py-4 bg-[#0d1117]",children:(0,e.jsx)("pre",{ref:F,className:"whitespace-pre-wrap break-words font-mono",style:{fontSize:"0.8125rem",lineHeight:"1.5"},children:(0,j.xb)(D.content)})})]})});return l?(0,e.jsxs)("div",{className:"bg-card w-full h-full flex flex-col relative",children:[(0,e.jsx)("button",{onClick:b,className:"absolute top-2 right-2 z-10 p-1 text-slate-9 hover:text-foreground hover:bg-accent rounded transition-colors",title:o("common.close"),children:(0,e.jsx)("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})}),K,L]}):(0,e.jsx)("div",{className:"fixed inset-0 z-[60] bg-black/50",onClick:b,children:(0,e.jsxs)("div",{className:"bg-card w-full h-full flex flex-col",onClick:a=>a.stopPropagation(),children:[(0,e.jsxs)("div",{className:"flex items-center justify-between px-4 py-3 border-b border-border",children:[(0,e.jsx)("h3",{className:"text-sm font-medium text-foreground",children:o("commitDetail.title")}),(0,e.jsx)("button",{onClick:b,className:"p-1 text-slate-9 hover:text-foreground hover:bg-accent rounded transition-colors",children:(0,e.jsx)("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),K,L]})})}h=(l.then?(await l)():l)[0],d()}catch(a){d(a)}})},3295:a=>{"use strict";a.exports=require("next/dist/server/app-render/after-task-async-storage.external.js")},4219:(a,b,c)=>{"use strict";c.d(b,{o:()=>g});var d=c(48249);c(67484);let e={ts:"#3178c6",tsx:"#3178c6",js:"#f1e05a",jsx:"#61dafb",mjs:"#f1e05a",cjs:"#f1e05a",html:"#e44d26",css:"#563d7c",scss:"#cd6799",sass:"#cd6799",less:"#1d365d",vue:"#41b883",svelte:"#ff3e00",json:"#cbcb41",yaml:"#cb171e",yml:"#cb171e",toml:"#9c4121",xml:"#e37933",env:"#ecd53f",md:"#519aba",mdx:"#519aba",txt:"#89898a",py:"#3572a5",go:"#00add8",rs:"#dea584",java:"#b07219",kt:"#a97bff",kts:"#a97bff",c:"#555555",h:"#555555",cpp:"#f34b7d",hpp:"#f34b7d",rb:"#701516",php:"#4f5d95",sh:"#89e051",bash:"#89e051",zsh:"#89e051",png:"#a074c4",jpg:"#a074c4",jpeg:"#a074c4",gif:"#a074c4",svg:"#ffb13b",webp:"#a074c4",ico:"#a074c4",lock:"#89898a",gitignore:"#f14e32",dockerfile:"#2496ed",sql:"#e38c00",graphql:"#e535ab",gql:"#e535ab",default:"#8a8a8a"},f={"package.json":"#cb3837","package-lock.json":"#cb3837","tsconfig.json":"#3178c6","jsconfig.json":"#f1e05a",".gitignore":"#f14e32",".eslintrc":"#4b32c3",".eslintrc.js":"#4b32c3",".eslintrc.json":"#4b32c3",".prettierrc":"#56b3b4",dockerfile:"#2496ed",".env":"#ecd53f",".env.local":"#ecd53f",".env.development":"#ecd53f",".env.production":"#ecd53f","readme.md":"#519aba",license:"#d4af37",makefile:"#6d8086","cargo.toml":"#dea584","go.mod":"#00add8","go.sum":"#00add8","requirements.txt":"#3572a5","yarn.lock":"#2c8ebb","pnpm-lock.yaml":"#f9ad00","vite.config.ts":"#646cff","vite.config.js":"#646cff","next.config.js":"#000000","next.config.mjs":"#000000","tailwind.config.js":"#38bdf8","tailwind.config.ts":"#38bdf8"};function g({name:a,className:b="",size:c=16}){let g,h=f[g=a.toLowerCase()]?f[g]:e[a.split(".").pop()?.toLowerCase()||""]||e.default,i=a.split(".").pop()?.toLowerCase()||"";return["ts","tsx"].includes(i)?(0,d.jsxs)("svg",{width:c,height:c,viewBox:"0 0 24 24",fill:"none",className:b,children:[(0,d.jsx)("rect",{x:"2",y:"2",width:"20",height:"20",rx:"2",fill:h}),(0,d.jsx)("path",{d:"M7 10h10M12 10v8",stroke:"white",strokeWidth:"2",strokeLinecap:"round"})]}):["js","jsx","mjs","cjs"].includes(i)?(0,d.jsxs)("svg",{width:c,height:c,viewBox:"0 0 24 24",fill:"none",className:b,children:[(0,d.jsx)("rect",{x:"2",y:"2",width:"20",height:"20",rx:"2",fill:h}),(0,d.jsx)("path",{d:"M10 10v6c0 1-1 2-2 2M14 10v4c0 2 4 2 4 0v-4",stroke:"#323330",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}):"jsx"===i||"tsx"===i&&a.includes("component")?(0,d.jsxs)("svg",{width:c,height:c,viewBox:"0 0 24 24",fill:"none",className:b,children:[(0,d.jsx)("ellipse",{cx:"12",cy:"12",rx:"10",ry:"4",stroke:"#61dafb",strokeWidth:"1.5",fill:"none"}),(0,d.jsx)("ellipse",{cx:"12",cy:"12",rx:"10",ry:"4",stroke:"#61dafb",strokeWidth:"1.5",fill:"none",transform:"rotate(60 12 12)"}),(0,d.jsx)("ellipse",{cx:"12",cy:"12",rx:"10",ry:"4",stroke:"#61dafb",strokeWidth:"1.5",fill:"none",transform:"rotate(120 12 12)"}),(0,d.jsx)("circle",{cx:"12",cy:"12",r:"2",fill:"#61dafb"})]}):"json"===i?(0,d.jsxs)("svg",{width:c,height:c,viewBox:"0 0 24 24",fill:"none",className:b,children:[(0,d.jsx)("path",{d:"M6 4C4 4 4 6 4 8v2c0 1-1 2-2 2 1 0 2 1 2 2v2c0 2 0 4 2 4",stroke:h,strokeWidth:"2",fill:"none",strokeLinecap:"round"}),(0,d.jsx)("path",{d:"M18 4c2 0 2 2 2 4v2c0 1 1 2 2 2-1 0-2 1-2 2v2c0 2 0 4-2 4",stroke:h,strokeWidth:"2",fill:"none",strokeLinecap:"round"}),(0,d.jsx)("circle",{cx:"12",cy:"12",r:"1.5",fill:h})]}):["md","mdx"].includes(i)?(0,d.jsxs)("svg",{width:c,height:c,viewBox:"0 0 24 24",fill:"none",className:b,children:[(0,d.jsx)("rect",{x:"2",y:"4",width:"20",height:"16",rx:"2",stroke:h,strokeWidth:"1.5",fill:"none"}),(0,d.jsx)("path",{d:"M5 15V9l3 4 3-4v6M17 12l-2-3v6M17 12l2-3v6",stroke:h,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]}):["py","pyi","pyx"].includes(i)?(0,d.jsxs)("svg",{width:c,height:c,viewBox:"0 0 24 24",fill:"none",className:b,children:[(0,d.jsx)("path",{d:"M12 4c-4 0-4 2-4 3v2h5v1H6c-2 0-3 2-3 4s1 4 3 4h2v-2c0-2 1-3 3-3h4c1 0 2-1 2-2V7c0-2-2-3-5-3z",fill:"#3572a5"}),(0,d.jsx)("path",{d:"M12 20c4 0 4-2 4-3v-2h-5v-1h7c2 0 3-2 3-4s-1-4-3-4h-2v2c0 2-1 3-3 3h-4c-1 0-2 1-2 2v4c0 2 2 3 5 3z",fill:"#ffd43b"}),(0,d.jsx)("circle",{cx:"9",cy:"7",r:"1",fill:"white"}),(0,d.jsx)("circle",{cx:"15",cy:"17",r:"1",fill:"white"})]}):"go"===i?(0,d.jsxs)("svg",{width:c,height:c,viewBox:"0 0 24 24",fill:"none",className:b,children:[(0,d.jsx)("ellipse",{cx:"12",cy:"12",rx:"8",ry:"6",fill:h}),(0,d.jsx)("circle",{cx:"9",cy:"11",r:"1.5",fill:"white"}),(0,d.jsx)("circle",{cx:"15",cy:"11",r:"1.5",fill:"white"}),(0,d.jsx)("circle",{cx:"9",cy:"11",r:"0.7",fill:"#333"}),(0,d.jsx)("circle",{cx:"15",cy:"11",r:"0.7",fill:"#333"})]}):"rs"===i?(0,d.jsxs)("svg",{width:c,height:c,viewBox:"0 0 24 24",fill:"none",className:b,children:[(0,d.jsx)("circle",{cx:"12",cy:"12",r:"9",stroke:h,strokeWidth:"2",fill:"none"}),(0,d.jsx)("circle",{cx:"12",cy:"12",r:"3",fill:h}),(0,d.jsx)("path",{d:"M12 3v3M12 18v3M3 12h3M18 12h3",stroke:h,strokeWidth:"2",strokeLinecap:"round"})]}):["png","jpg","jpeg","gif","webp","ico","bmp"].includes(i)?(0,d.jsxs)("svg",{width:c,height:c,viewBox:"0 0 24 24",fill:"none",className:b,children:[(0,d.jsx)("rect",{x:"3",y:"4",width:"18",height:"16",rx:"2",stroke:h,strokeWidth:"1.5",fill:"none"}),(0,d.jsx)("circle",{cx:"8",cy:"9",r:"2",fill:h}),(0,d.jsx)("path",{d:"M3 16l5-5 3 3 4-4 6 6",stroke:h,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]}):"svg"===i?(0,d.jsxs)("svg",{width:c,height:c,viewBox:"0 0 24 24",fill:"none",className:b,children:[(0,d.jsx)("rect",{x:"3",y:"4",width:"18",height:"16",rx:"2",stroke:h,strokeWidth:"1.5",fill:"none"}),(0,d.jsx)("path",{d:"M7 12 Q12 6 17 12 Q12 18 7 12",stroke:h,strokeWidth:"1.5",fill:"none"})]}):"html"===i?(0,d.jsxs)("svg",{width:c,height:c,viewBox:"0 0 24 24",fill:"none",className:b,children:[(0,d.jsx)("path",{d:"M4 3l1.5 17L12 22l6.5-2L20 3H4z",fill:h}),(0,d.jsx)("path",{d:"M8 7h8l-.5 6-3.5 1-3.5-1-.2-2",stroke:"white",strokeWidth:"1.2",strokeLinecap:"round",strokeLinejoin:"round",fill:"none"})]}):["css","scss","sass","less"].includes(i)?(0,d.jsxs)("svg",{width:c,height:c,viewBox:"0 0 24 24",fill:"none",className:b,children:[(0,d.jsx)("path",{d:"M4 3l1.5 17L12 22l6.5-2L20 3H4z",fill:h}),(0,d.jsx)("path",{d:"M15 8H9l.3 3h5.2l-.4 4-2.1.7-2.1-.7-.1-2",stroke:"white",strokeWidth:"1.2",strokeLinecap:"round",strokeLinejoin:"round",fill:"none"})]}):["yaml","yml"].includes(i)?(0,d.jsxs)("svg",{width:c,height:c,viewBox:"0 0 24 24",fill:"none",className:b,children:[(0,d.jsx)("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",stroke:h,strokeWidth:"1.5",fill:"none"}),(0,d.jsx)("path",{d:"M7 8l3 4v5M17 8l-3 4v5",stroke:h,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]}):["sh","bash","zsh","fish"].includes(i)?(0,d.jsxs)("svg",{width:c,height:c,viewBox:"0 0 24 24",fill:"none",className:b,children:[(0,d.jsx)("rect",{x:"2",y:"4",width:"20",height:"16",rx:"2",fill:"#1e1e1e",stroke:"#555",strokeWidth:"1"}),(0,d.jsx)("path",{d:"M6 9l3 3-3 3M12 15h5",stroke:h,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]}):"gitignore"===i||".gitignore"===a.toLowerCase()?(0,d.jsxs)("svg",{width:c,height:c,viewBox:"0 0 24 24",fill:"none",className:b,children:[(0,d.jsx)("circle",{cx:"12",cy:"12",r:"9",fill:h}),(0,d.jsx)("circle",{cx:"12",cy:"12",r:"3",fill:"white"}),(0,d.jsx)("path",{d:"M12 6v3M12 15v3M6 12h3M15 12h3",stroke:"white",strokeWidth:"2",strokeLinecap:"round"})]}):"dockerfile"===i||"dockerfile"===a.toLowerCase()||a.toLowerCase().startsWith("dockerfile")?(0,d.jsxs)("svg",{width:c,height:c,viewBox:"0 0 24 24",fill:"none",className:b,children:[(0,d.jsx)("path",{d:"M3 12h3v3H3zM7 12h3v3H7zM11 12h3v3h-3zM7 8h3v3H7zM11 8h3v3h-3zM11 4h3v3h-3zM15 12h3v3h-3z",fill:h}),(0,d.jsx)("path",{d:"M21 13c-1-2-3-2-4-2h-1c0-1 0-2-2-3h-1v1c0 1-1 2-2 2H3c-1 3 0 6 2 8s5 3 9 3c5 0 8-2 10-6",stroke:h,strokeWidth:"1.5",fill:"none"})]}):"env"===i||a.startsWith(".env")?(0,d.jsxs)("svg",{width:c,height:c,viewBox:"0 0 24 24",fill:"none",className:b,children:[(0,d.jsx)("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",stroke:h,strokeWidth:"1.5",fill:"none"}),(0,d.jsx)("circle",{cx:"8",cy:"8",r:"2",fill:h}),(0,d.jsx)("path",{d:"M12 8h6M8 12h8M8 16h5",stroke:h,strokeWidth:"1.5",strokeLinecap:"round"})]}):"sql"===i?(0,d.jsxs)("svg",{width:c,height:c,viewBox:"0 0 24 24",fill:"none",className:b,children:[(0,d.jsx)("ellipse",{cx:"12",cy:"7",rx:"8",ry:"3",stroke:h,strokeWidth:"1.5",fill:"none"}),(0,d.jsx)("path",{d:"M4 7v10c0 1.7 3.6 3 8 3s8-1.3 8-3V7",stroke:h,strokeWidth:"1.5",fill:"none"}),(0,d.jsx)("path",{d:"M4 12c0 1.7 3.6 3 8 3s8-1.3 8-3",stroke:h,strokeWidth:"1.5",fill:"none"})]}):"vue"===i?(0,d.jsxs)("svg",{width:c,height:c,viewBox:"0 0 24 24",fill:"none",className:b,children:[(0,d.jsx)("path",{d:"M2 4h4l6 10 6-10h4L12 22 2 4z",fill:h}),(0,d.jsx)("path",{d:"M6 4h4l2 4 2-4h4l-6 10L6 4z",fill:"#35495e"})]}):(0,d.jsxs)("svg",{width:c,height:c,viewBox:"0 0 24 24",fill:"none",className:b,children:[(0,d.jsx)("path",{d:"M6 3h8l5 5v13H6V3z",stroke:h,strokeWidth:"1.5",fill:"none"}),(0,d.jsx)("path",{d:"M14 3v5h5",stroke:h,strokeWidth:"1.5",fill:"none"})]})}},4667:(a,b,c)=>{"use strict";c.d(b,{Q:()=>g});var d=c(48249),e=c(67484),f=c(44384);function g({isOpen:a,onClose:b,cwd:c,onSelectSession:g}){let{t:h}=(0,f.Bd)(),[i,j]=(0,e.useState)([]),[k,l]=(0,e.useState)(!1),[m,n]=(0,e.useState)(null),[o,p]=(0,e.useState)(""),q=(0,e.useRef)(null);(0,e.useCallback)(async()=>{if(c){l(!0),n(null);try{let a=c.replace(/\//g,"-"),b=await fetch(`/api/sessions/projects/${encodeURIComponent(a)}`);if(!b.ok)throw Error("Failed to load sessions");let d=await b.json();j(d)}catch(a){n(a instanceof Error?a.message:"Unknown error")}finally{l(!1)}}},[c]);let r=i.filter(a=>{if(!o)return!0;let b=o.toLowerCase();return a.title.toLowerCase().includes(b)||a.firstMessages.some(a=>a.toLowerCase().includes(b))||a.lastMessages.some(a=>a.toLowerCase().includes(b))});return a?(0,d.jsxs)("div",{className:"fixed inset-0 z-50 flex items-center justify-center",children:[(0,d.jsx)("div",{className:"absolute inset-0 bg-black/50 backdrop-blur-sm",onClick:b}),(0,d.jsxs)("div",{className:"relative w-full max-w-6xl h-[90vh] mx-4 bg-card rounded-lg shadow-xl flex flex-col overflow-hidden",children:[(0,d.jsxs)("div",{className:"flex items-center justify-between px-4 py-3 border-b border-border",children:[(0,d.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,d.jsx)("h2",{className:"text-sm font-medium text-foreground",children:h("sessions.sessionList")}),(0,d.jsx)("p",{className:"text-xs text-muted-foreground truncate",title:c,children:c})]}),(0,d.jsxs)("div",{className:"flex items-center gap-3 ml-4",children:[(0,d.jsx)("input",{ref:q,type:"text",placeholder:h("sessions.searchSessions"),value:o,onChange:a=>p(a.target.value),className:"px-2 py-1 text-xs border border-border rounded bg-card text-foreground placeholder-slate-9 focus:outline-none focus:ring-2 focus:ring-ring focus:border-transparent"}),(0,d.jsx)("button",{onClick:b,className:"p-1 text-slate-9 hover:text-foreground hover:bg-accent rounded transition-colors",children:(0,d.jsx)("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,d.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]})]}),(0,d.jsxs)("div",{className:"flex-1 overflow-y-auto p-4",children:[k&&(0,d.jsx)("div",{className:"flex items-center justify-center h-full",children:(0,d.jsxs)("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[(0,d.jsxs)("svg",{className:"animate-spin h-4 w-4",fill:"none",viewBox:"0 0 24 24",children:[(0,d.jsx)("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),(0,d.jsx)("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}),(0,d.jsx)("span",{children:h("sessions.loadingSessions")})]})}),m&&(0,d.jsx)("div",{className:"flex items-center justify-center h-full",children:(0,d.jsx)("div",{className:"text-xs text-red-11",children:m})}),!k&&!m&&0===r.length&&(0,d.jsx)("div",{className:"flex items-center justify-center h-full",children:(0,d.jsx)("div",{className:"text-xs text-muted-foreground",children:h(o?"sessions.noMatchingSessions":"sessions.noSessionsYet")})}),!k&&!m&&r.length>0&&(0,d.jsx)("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-3",children:r.map(a=>(0,d.jsxs)("div",{onClick:()=>{let d;return d=(a.path.split("/").pop()||"").replace(".jsonl",""),void(g?(g(d,a.title),b()):window.parent.postMessage({type:"OPEN_PROJECT",cwd:c,sessionId:d},"*"))},className:"p-3 bg-secondary rounded border border-border hover:border-brand hover:shadow-md cursor-pointer transition-all",children:[(0,d.jsx)("h4",{className:"text-xs font-medium text-foreground mb-1 truncate",title:a.title,children:a.title}),(0,d.jsx)("div",{className:"text-xs text-muted-foreground mb-2",children:new Date(a.modifiedAt).toLocaleString("zh-CN",{year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"})}),(0,d.jsxs)("div",{className:"space-y-0.5 text-xs",children:[a.firstMessages.map((a,b)=>(0,d.jsxs)("div",{className:"text-foreground truncate",title:a,children:[(0,d.jsx)("span",{className:"text-slate-9 mr-1",children:"•"}),a]},`first-${b}`)),a.lastMessages.length>0&&(0,d.jsx)("div",{className:"text-slate-9 text-center py-0.5",children:"\xb7\xb7\xb7"}),a.lastMessages.map((a,b)=>(0,d.jsxs)("div",{className:"text-foreground truncate",title:a,children:[(0,d.jsx)("span",{className:"text-slate-9 mr-1",children:"•"}),a]},`last-${b}`))]})]},a.path))})]})]})]}):null}},5811:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{Np:()=>k,ZD:()=>i,b8:()=>j,kS:()=>g,sQ:()=>h});var e=c(78908),f=a([e]);e=(f.then?(await f)():f)[0];let l=null,m=["typescript","tsx","javascript","jsx","html","css","scss","json","yaml","python","go","rust","java","ruby","php","bash","shell","markdown","sql","c","cpp","swift","kotlin","dart","lua","graphql","xml"];function g(){return l||(l=(0,e.createHighlighter)({themes:["github-dark","github-light"],langs:[...m]})),l}function h(a){let b=a.split("/").pop()?.toLowerCase()||"",c=b.split(".").pop()?.toLowerCase();if(".env"===b||b.startsWith(".env.")||"dockerfile"===b||b.startsWith("dockerfile.")||"makefile"===b)return"bash";let d={ts:"typescript",tsx:"tsx",js:"javascript",jsx:"jsx",mjs:"javascript",cjs:"javascript",html:"html",htm:"html",css:"css",scss:"scss",json:"json",yaml:"yaml",yml:"yaml",xml:"xml",py:"python",go:"go",rs:"rust",java:"java",kt:"kotlin",rb:"ruby",php:"php",cs:"cpp",cpp:"cpp",c:"c",h:"c",sh:"bash",bash:"bash",zsh:"bash",md:"markdown",mdx:"markdown",sql:"sql",swift:"swift",dart:"dart",lua:"lua",graphql:"graphql",gql:"graphql",toml:"yaml",sass:"scss",less:"css",scala:"java",r:"python",vim:"bash",env:"bash"}[c||""]||"text";return m.includes(d)?d:"text"}function i(a){return a.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}function j(a){return a.map(a=>a.color?`<span style="color:${a.color}">${i(a.content)}</span>`:i(a.content)).join("")}function k(a,b,c,d){if(!b)return[];let e=[],f=c?b:b.toLowerCase();for(let b=0;b<a.length;b++){let g=c?a[b]:a[b].toLowerCase(),h=0;for(;;){let a=g.indexOf(f,h);if(-1===a)break;let c=a+f.length;if(d){let d=a>0?g[a-1]:" ",f=c<g.length?g[c]:" ",h=!/\w/.test(d),i=!/\w/.test(f);h&&i&&e.push({lineIndex:b,startCol:a,endCol:c})}else e.push({lineIndex:b,startCol:a,endCol:c});h=a+1}}return e}d()}catch(a){d(a)}})},6440:(a,b,c)=>{"use strict";c.d(b,{F:()=>e});var d=c(67484);function e(){let[a,b]=(0,d.useState)(()=>"u"<typeof document||"visible"===document.visibilityState);return a}},8472:(a,b,c)=>{"use strict";c.r(b),c.d(b,{default:()=>h,dynamic:()=>f,generateMetadata:()=>g});var d=c(5735),e=c(38476);let f="force-dynamic";async function g({searchParams:a}){let b=(await a).cwd,c=b?.split("/").filter(Boolean).pop();return{title:c?`Cockpit - ${c}`:"Cockpit"}}async function h({searchParams:a}){let{cwd:b,sessionId:c}=await a;return(0,d.jsx)(e.TabManager,{initialCwd:b,initialSessionId:c})}},10164:(a,b,c)=>{"use strict";c.d(b,{M:()=>u});var d=c(48249),e=c(67484),f=c(44384),g=c(74429),h=c(26068),i=c(77937),j=c(45214),k=c(68502),l=c(47033),m=c(77033),n=c(23434),o=c(44741),p=c(90500),q=c(30068),r=c(81749);function s({content:a,sourceFile:b}){let c,g,h,i,j,{t:k}=(0,f.Bd)(),[l,m]=(0,e.useState)(null),[n,o]=(0,e.useState)(!0),[p,q]=(0,e.useState)(!1),s=l?.active===!0,t=(0,e.useCallback)(async()=>{q(!0);try{let c=b.split("/").pop()||b,d=await fetch("/api/review",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({title:c,content:a,sourceFile:b})});if(!d.ok)throw Error("Failed");let e=(await d.json()).review;m({id:e.id,active:!0,updatedAt:e.updatedAt||e.createdAt});try{let a=await fetch("/api/review/share-info"),b=await a.json(),c=b.shareBase?`${b.shareBase}/review/${e.id}`:`${window.location.origin}/review/${e.id}`;await navigator.clipboard.writeText(c)}catch{}(0,r.oR)(e.existing?k("toast.reviewUpdated"):k("toast.reviewCreated"),"success")}catch{(0,r.oR)(k("toast.reviewCreateFailed"),"error")}finally{q(!1)}},[a,b]),u=(0,e.useCallback)(async()=>{if(l){q(!0);try{if(!(await fetch(`/api/review/${l.id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({active:!1})})).ok)throw Error("Failed");m(a=>a?{...a,active:!1}:null),(0,r.oR)(k("toast.sharingClosed"),"success")}catch{(0,r.oR)(k("toast.sharingCloseFailed"),"error")}finally{q(!1)}}},[l]),v=(0,e.useCallback)(()=>{p||(s?u():t())},[p,s,t,u]),w=(0,e.useCallback)(()=>{l&&window.open(`${window.location.origin}/review/${l.id}`,"_blank")},[l]);return n?null:(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)("button",{onClick:v,disabled:p,className:`relative inline-flex h-4 w-7 items-center rounded-full transition-colors ${p?"opacity-50 cursor-wait":"cursor-pointer"} ${s?"bg-green-500":"bg-muted-foreground/30"}`,title:s?k("review.closeSharing"):k("review.enableSharing"),children:(0,d.jsx)("span",{className:`inline-block h-3 w-3 rounded-full bg-white transition-transform ${s?"translate-x-3.5":"translate-x-0.5"}`})}),(0,d.jsx)("span",{className:`text-[11px] ${s?"text-green-600 dark:text-green-400":"text-muted-foreground"}`,children:s?k("review.sharing"):k("review.notShared")}),l&&l.updatedAt&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("span",{className:"text-[10px] text-muted-foreground",children:(g=String((c=new Date(l.updatedAt)).getMonth()+1).padStart(2,"0"),h=String(c.getDate()).padStart(2,"0"),i=String(c.getHours()).padStart(2,"0"),j=String(c.getMinutes()).padStart(2,"0"),`${g}-${h} ${i}:${j}`)}),(0,d.jsx)("button",{onClick:w,className:"text-[11px] text-brand hover:underline",children:k("review.view")})]})]})}let t=[p.W];function u({content:a,filePath:b,cwd:c,onClose:p,sourceFile:r}){let u=r||(c&&b.startsWith(c)?b.slice(c.endsWith("/")?c.length:c.length+1):b),{t:v}=(0,f.Bd)(),w=(0,e.useRef)(null),x=(0,e.useRef)(null),y=(0,e.useRef)(()=>{}),z=(0,h.iN)(),A=(0,m.nH)(),{comments:B,addComment:C,updateComment:D,deleteComment:E,refresh:F}=(0,l._)({cwd:c,filePath:b}),[G,H]=(0,e.useState)(!1),[I,J]=(0,e.useState)(null),[K,L]=(0,e.useState)(null),[M,N]=(0,e.useState)(null),O=(0,e.useMemo)(()=>a.split("\n"),[a]),P=(0,e.useCallback)(()=>{let a=x.current;a&&(J({x:a.x,y:a.y,range:a.range,codeContent:a.selectedText}),x.current=null,y.current())},[]),Q=(0,e.useCallback)(()=>{let a=x.current;a&&(L({x:a.x,y:a.y,range:a.range,codeContent:a.selectedText}),x.current=null,y.current())},[]),R=(0,e.useCallback)(async a=>{I&&(await C(I.range.start,I.range.end,a),J(null))},[I,C]),S=(0,e.useCallback)(async a=>{if(K&&A)try{let d=await (0,n.$3)(c),e=[];for(let a of d)e.push({filePath:a.filePath,startLine:a.startLine,endLine:a.endLine,codeContent:a.codeContent,note:a.content||void 0});let f=Math.max(0,K.range.start-1),g=Math.min(O.length,K.range.end),h=O.slice(f,g).join("\n");e.push({filePath:b,startLine:K.range.start,endLine:K.range.end,codeContent:h});let i=(0,n.Gw)(e,a);A.sendMessage(i),await (0,n.RP)(c),F(),L(null)}catch(a){console.error("Failed to send to AI:",a)}},[K,A,b,c,O,F]);(0,e.useMemo)(()=>{if(0===B.length)return[];let a=new Map;for(let b of B){let c=`${b.startLine}-${b.endLine}`;a.has(c)||a.set(c,[]),a.get(c).push(b)}return Array.from(a.entries()).map(([a,b])=>({key:a,startLine:b[0].startLine,endLine:b[0].endLine,comments:b}))},[B]);let[T,U]=(0,e.useState)([]);return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("div",{className:"px-4 py-3 border-b border-border flex items-center justify-between flex-shrink-0",children:[(0,d.jsx)("span",{className:"text-sm font-medium text-foreground truncate",children:b}),(0,d.jsxs)("div",{className:"flex items-center gap-3",children:[(0,d.jsx)(s,{content:a,sourceFile:u}),(0,d.jsx)("button",{onClick:p,className:"p-1 text-muted-foreground hover:text-foreground hover:bg-accent rounded transition-colors",title:v("common.close"),children:(0,d.jsx)("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,d.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]})]}),(0,d.jsxs)("div",{className:"flex-1 flex overflow-hidden",children:[(0,d.jsx)(q.l,{content:a,containerRef:w}),(0,d.jsxs)("div",{className:"flex-1 overflow-auto relative",ref:w,children:[(0,d.jsx)("div",{className:"p-6",children:(0,d.jsx)(o.T,{content:a,rehypePlugins:t})}),T.map(({key:a,top:b,comments:c})=>(0,d.jsx)("div",{className:"absolute right-3 cursor-pointer z-10",style:{top:b},onClick:a=>{a.stopPropagation(),N({comment:c[0],x:a.clientX,y:a.clientY})},children:(0,d.jsx)("div",{className:"w-5 h-5 rounded-full bg-amber-500/80 text-white text-xs flex items-center justify-center shadow-sm hover:bg-amber-500 transition-colors",children:c.length})},a))]})]}),G&&z&&(0,g.createPortal)((0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(i.f,{floatingToolbarRef:x,bumpRef:y,container:z,onAddComment:P,onSendToAI:Q,isChatLoading:A?.isLoading}),I&&(0,d.jsx)(j.t,{x:I.x,y:I.y,range:I.range,codeContent:I.codeContent,container:z,onSubmit:R,onClose:()=>J(null)}),K&&(0,d.jsx)(j.G,{x:K.x,y:K.y,range:K.range,filePath:b,codeContent:K.codeContent,container:z,onSubmit:S,onClose:()=>L(null),isChatLoading:A?.isLoading}),M&&(0,d.jsx)(k.t,{x:M.x,y:M.y,comment:M.comment,container:z,onClose:()=>N(null),onUpdateComment:D,onDeleteComment:E})]}),z)]})}},10846:a=>{"use strict";a.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},15273:(a,b,c)=>{"use strict";c.d(b,{A:()=>d});let d=(0,c(47408).A)("copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]])},16306:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{d:()=>n,o:()=>m});var e=c(67484),f=c(36043),g=c(47033),h=c(23434),i=c(77033),j=c(90173),k=c(5811),l=a([j,k]);function m(a,b){let c,d=document.createTreeWalker(a,NodeFilter.SHOW_TEXT),e=b,f=null;for(;c=d.nextNode();){f=c;let a=c.textContent.length;if(e<=a)return{node:c,offset:e};e-=a}return f?{node:f,offset:f.textContent.length}:null}function n({content:a,filePath:b,showSearch:c=!0,cwd:d,enableComments:l=!1,scrollToLine:m=null,scrollToLineAlign:n="center",onScrollToLineComplete:o,visibleLineRef:p,onContentSearch:q}){let[r,s]=(0,e.useState)(!1),t=(0,e.useRef)(null),u=(0,e.useRef)(null),v=(0,e.useRef)(null),w=(0,i.nH)(),[x,y]=(0,e.useState)(!1),[z,A]=(0,e.useState)(null);(0,e.useRef)(null);let[B,C]=(0,e.useState)(!1),[D,E]=(0,e.useState)(""),[F,G]=(0,e.useState)(!1),[H,I]=(0,e.useState)(!1),[J,K]=(0,e.useState)(0),[L,M]=(0,e.useState)(0),N=(0,e.useRef)(!1),[O,P]=(0,e.useState)(null),Q=(0,e.useRef)(null),R=(0,e.useRef)(()=>{}),S=(0,e.useRef)(!1),T=(0,e.useRef)(null),[U,V]=(0,e.useState)(null),[W,X]=(0,e.useState)(null),Y=(0,e.useRef)(null),[Z,$]=(0,e.useState)(0),_=l&&!!d,{comments:aa,addComment:ab,updateComment:ac,deleteComment:ad,refresh:ae}=(0,g._)({cwd:d||"",filePath:b}),af=(0,e.useMemo)(()=>a.split("\n"),[a]),ag=(0,j.C)(af,b),ah=(0,e.useMemo)(()=>{let a=new Map;for(let b of aa){let c=b.endLine;a.has(c)||a.set(c,[]),a.get(c).push(b)}return a},[aa]),ai=(0,e.useMemo)(()=>{let a=new Set;for(let b of aa)for(let c=b.startLine;c<=b.endLine;c++)a.add(c);return a},[aa]),aj=(0,e.useMemo)(()=>(0,k.Np)(af,D,F,H),[af,D,F,H]),ak=(0,e.useMemo)(()=>{let a=[];for(let b=0;b<af.length;b++)a.push({type:"code",lineIndex:b});return a},[af.length]),al=(0,f.Te)({count:ak.length,getScrollElement:()=>t.current,estimateSize:()=>20,overscan:10}),am=(0,e.useCallback)(()=>{0!==aj.length&&(K(a=>(a+1)%aj.length),M(a=>a+1))},[aj.length]),an=(0,e.useCallback)(()=>{0!==aj.length&&(K(a=>(a-1+aj.length)%aj.length),M(a=>a+1))},[aj.length]);(0,e.useRef)(m).current=m;let ao=(0,e.useCallback)(a=>{"Enter"===a.key&&(a.preventDefault(),a.shiftKey?an():am()),"Escape"===a.key&&(C(!1),E(""))},[am,an]),ap=(0,e.useCallback)((a,b)=>{_&&(b.stopPropagation(),P({comment:a,x:b.clientX,y:b.clientY}),Q.current=null,R.current(),V(null),X(null))},[_]),aq=(0,e.useCallback)(()=>{let a=Q.current;a&&(V({x:a.x,y:a.y,range:a.range,codeContent:a.selectedText}),Q.current=null,R.current())},[]),ar=(0,e.useCallback)(()=>{let a=Q.current;if(!a)return;let b=a.selectedText;X({x:a.x,y:a.y,range:a.range,codeContent:b}),Q.current=null,R.current()},[]),as=(0,e.useCallback)(()=>{let a=Q.current;if(!a||!q)return;let b=a.selectedText.trim();Q.current=null,R.current(),b&&q(b)},[q]),at=(0,e.useCallback)(async a=>{U&&(await ab(U.range.start,U.range.end,a),V(null))},[U,ab]),au=(0,e.useCallback)(async a=>{if(W&&w&&d)try{let c=await (0,h.$3)(d),e=[];for(let a of c)e.push({filePath:a.filePath,startLine:a.startLine,endLine:a.endLine,codeContent:a.codeContent,note:a.content||void 0});e.push({filePath:b,startLine:W.range.start,endLine:W.range.end,codeContent:W.codeContent});let f=(0,h.Gw)(e,a);w.sendMessage(f),await (0,h.RP)(d),ae(),X(null)}catch(a){console.error("Failed to send to AI:",a)}},[W,w,b,d,ae]),av=(0,e.useCallback)((a,b,c)=>{let d=af[a];if(!d)return b;let e=[];if(D&&aj.length>0)for(let b of aj.filter(b=>b.lineIndex===a)){let c=aj[J]?.lineIndex===a&&aj[J]?.startCol===b.startCol;e.push({start:b.startCol,end:b.endCol,cls:c?"hl-cur":"hl-m"})}if(c&&!D&&c.length>=1){let a=c.toLowerCase(),b=d.toLowerCase(),f=0;for(;-1!==(f=b.indexOf(a,f));)e.push({start:f,end:f+c.length,cls:"hl-kw"}),f+=1}if(0===e.length)return b;e.sort((a,b)=>a.start-b.start||a.end-b.end);let f=[],g=0;for(let a of e){if(a.start<g)continue;a.start>g&&f.push((0,k.ZD)(d.substring(g,a.start)));let b=(0,k.ZD)(d.substring(a.start,a.end));f.push(`<span class="${a.cls}">${b}</span>`),g=a.end}g<d.length&&f.push((0,k.ZD)(d.substring(g)));let h=(0,k.ZD)(d);if(b!==h){let a=b;for(let b of e){let c=d.substring(b.start,b.end),e=(0,k.ZD)(c),f=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),g=RegExp(`(?<=>)([^<]*?)(${f})`,""),h=`$1<span class="${b.cls}">${e}</span>`,i=a.replace(g,h);i.length>a.length+200||(a=i)}return a}return f.join("")},[D,aj,J,af]);return{parentRef:t,containerRef:u,searchInputRef:v,floatingToolbarRef:Q,suppressHoverRef:S,savedSelectionRef:T,highlightedLines:ag,isMounted:r,cmdHeld:x,flashLine:z,isSearchVisible:B,searchQuery:D,caseSensitive:F,wholeWord:H,currentMatchIndex:J,viewingComment:O,bumpToolbarRef:R,addCommentInput:U,sendToAIInput:W,chatContext:w,commentsEnabled:_,comments:aa,updateComment:ac,deleteComment:ad,lines:af,matches:aj,rowData:ak,virtualizer:al,commentsByEndLine:ah,linesWithComments:ai,setIsSearchVisible:C,setSearchQuery:E,suppressMatchScrollRef:N,setCaseSensitive:G,setWholeWord:I,setViewingComment:P,setAddCommentInput:V,setSendToAIInput:X,goToNextMatch:am,goToPrevMatch:an,handleSearchKeyDown:ao,handleCommentBubbleClick:ap,handleToolbarAddComment:aq,handleToolbarSendToAI:ar,handleToolbarSearch:as,handleCommentSubmit:at,handleSendToAISubmit:au,getHighlightedLineHtml:av,inlineBlameLineRef:Y,inlineBlameVersion:Z}}[j,k]=l.then?(await l)():l,d()}catch(a){d(a)}})},19121:a=>{"use strict";a.exports=require("next/dist/server/app-render/action-async-storage.external.js")},19794:(a,b,c)=>{"use strict";c.d(b,{A:()=>d});let d=(0,c(47408).A)("chevron-right",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]])},21735:(a,b,c)=>{"use strict";c.d(b,{A:()=>d});let d=(0,c(47408).A)("loader",[["path",{d:"M12 2v4",key:"3427ic"}],["path",{d:"m16.2 7.8 2.9-2.9",key:"r700ao"}],["path",{d:"M18 12h4",key:"wj9ykh"}],["path",{d:"m16.2 16.2 2.9 2.9",key:"1bxg5t"}],["path",{d:"M12 18v4",key:"jadmvz"}],["path",{d:"m4.9 19.1 2.9-2.9",key:"bwix9q"}],["path",{d:"M2 12h4",key:"j09sii"}],["path",{d:"m4.9 4.9 2.9 2.9",key:"giyufr"}]])},21820:a=>{"use strict";a.exports=require("os")},23434:(a,b,c)=>{"use strict";c.d(b,{$3:()=>h,Cm:()=>g,Gw:()=>k,RP:()=>i,Un:()=>j,zL:()=>f});var d=c(41564);let e=new Set;function f(a){return e.add(a),()=>e.delete(a)}function g(){e.forEach(a=>a())}async function h(a){let b=await fetch(`/api/comments?cwd=${encodeURIComponent(a)}`);if(!b.ok)throw Error("Failed to fetch comments");let c=(await b.json()).comments||[];if(0===c.length)return[];let d=new Map;for(let a of c)a.selectedText||(d.has(a.filePath)||d.set(a.filePath,[]),d.get(a.filePath).push(a));let e=new Map;await Promise.all(Array.from(d.keys()).map(async b=>{try{let c=await fetch(`/api/files/read?cwd=${encodeURIComponent(a)}&path=${encodeURIComponent(b)}`);if(c.ok){let a=await c.json();"text"===a.type&&a.content&&e.set(b,a.content.split("\n"))}}catch(a){console.error(`Failed to read file ${b}:`,a)}}));let f=[];for(let a of c){if(a.selectedText){f.push({...a,codeContent:a.selectedText});continue}let b=e.get(a.filePath),c="";if(b){let d=Math.max(0,a.startLine-1),e=Math.min(b.length,a.endLine);c=b.slice(d,e).join("\n")}f.push({...a,codeContent:c})}return f}async function i(a){try{if((await fetch(`/api/comments?cwd=${encodeURIComponent(a)}&all=true`,{method:"DELETE"})).ok)return g(),!0;return!1}catch(a){return console.error("Failed to clear comments:",a),!1}}let j="__chat__";function k(a,b){let c=a.filter(a=>a.filePath===j),e=a.filter(a=>a.filePath!==j),f=[];for(let a of(e.length>0&&(f.push(`${d.A.t("comments.codeRef")}`,""),e.forEach((a,b)=>{f.push(`[${b+1}] ${a.filePath}:${a.startLine}-${a.endLine}`),f.push("```"),f.push(a.codeContent),f.push("```"),a.note&&f.push(d.A.t("comments.note",{content:a.note})),f.push("")})),c)){let b=a.codeContent.split("\n").map(a=>`> ${a}`).join("\n");f.push(b),a.note&&f.push(a.note),f.push("")}return f.push(d.A.t("comments.question",{question:b})),f.join("\n")}},24266:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{r:()=>t});var e=c(48249),f=c(67484),g=c(243),h=c(83634),i=c(64874),j=c(4667),k=c(60306),l=c(42911),m=c(99374),n=c(77033),o=c(61969),p=c(56111),q=c(99543),r=c(44384),s=a([g]);function t({tabId:a,initialCwd:b,initialSessionId:c,hideHeader:d,hideSidebar:s,isActive:t=!0,onLoadingChange:u,onSessionIdChange:v,onTitleChange:w,onShowGitStatus:x,onOpenNote:y,onCreateScheduledTask:z,onOpenSession:A,onContentSearch:B}){let{t:C}=(0,r.Bd)();(0,n.nH)();let[D,E]=(0,f.useState)([]),[F,G]=(0,f.useState)(null),[H,I]=(0,f.useState)(!1),[J,K]=(0,f.useState)(!1),[L,M]=(0,f.useState)(!1),[N,O]=(0,f.useState)(!1),[P,Q]=(0,f.useState)(!1),[R,S]=(0,f.useState)(!1),[T,U]=(0,f.useState)(null),V=(0,f.useRef)(null);(0,f.useRef)(null);let W=(0,f.useCallback)(async a=>{if(b)try{let c=await fetch("/api/session-by-path",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({cwd:b,sessionId:a})});if(c.ok){let a=await c.json();a.title&&w?.(a.title)}}catch(a){console.error("Failed to fetch session title:",a)}},[b,w]),{isLoading:X,tokenUsage:Y,handleSend:Z,handleStop:$}=(0,p.e)(D,E,{sessionId:F,cwd:b,onSessionId:G,onFetchTitle:W}),_=(0,f.useCallback)(async(a,c)=>{let d=a.split("\n")[0];if(d.startsWith("!")&&d.length>1){let e=d.slice(1).trim();if(!e)return void Z(a,c);let f=a.split("\n").slice(1).join("\n").trim();try{let a=await fetch("/api/bash",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({command:e,cwd:b})}),d=await a.json(),g=[d.stdout,d.stderr].filter(Boolean).join("\n")||"(no output)",h=d.exitCode?` (exit code: ${d.exitCode})`:"",i=C("chat.executedCommand",{command:e,exitInfo:h,output:g});f&&(i+=`
2
+
3
+ ${f}`),Z(i,c)}catch(a){Z(C("chat.executedCommandFailed",{command:e,error:a}),c)}return}Z(a,c)},[Z,b,C]),{isLoadingHistory:aa,isLoadingMore:ab,hasMoreHistory:ac,loadMoreHistory:ad,loadHistoryByCwdAndSessionId:ae}=(0,q.m)(D,E,F,{cwd:b,initialSessionId:c,onSessionId:G,onTitleChange:w,onTokenUsage:U});(0,f.useRef)(t);let af=Y||T;(0,f.useRef)(!1);let ag=(0,f.useCallback)(async a=>{if(b&&F)try{let c=await fetch(`/api/session/${F}/fork`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({cwd:b,fromMessageUuid:a})});if(c.ok){let a=await c.json();A?A(a.newSessionId,"Fork"):window.parent.postMessage({type:"OPEN_PROJECT",cwd:b,sessionId:a.newSessionId},"*")}else console.error("Fork failed:",await c.text())}catch(a){console.error("Fork error:",a)}},[b,F,A]),ah=(0,f.useCallback)(()=>{Q(!0)},[]),ai=(0,f.useCallback)(()=>{S(!0)},[]),aj=(0,f.useMemo)(()=>{if(z&&b&&a&&F)return c=>{z({...c,cwd:b,tabId:a,sessionId:F})}},[z,b,a,F]);return(0,e.jsxs)("div",{className:`flex ${d&&s?"h-full":"h-screen"} bg-card`,children:[(0,e.jsxs)("div",{id:"chat-screen",className:"flex-1 flex flex-col min-w-0 relative",onMouseEnter:()=>I(!0),onMouseLeave:()=>I(!1),children:[!d&&(0,e.jsx)(o.e,{cwd:b,sessionId:F,onOpenProjectSessions:()=>M(!0),onOpenSessionBrowser:()=>K(!0),onOpenSettings:()=>O(!0)}),aa?(0,e.jsx)("div",{className:"flex-1 flex items-center justify-center",children:(0,e.jsx)("span",{className:"text-muted-foreground",children:C("sessions.loadingHistory")})}):(0,e.jsx)(g.M,{ref:V,messages:D,isLoading:X,cwd:b,sessionId:F,hasMoreHistory:ac,isLoadingMore:ab,onLoadMore:ad,onFork:ag,isActive:t,onContentSearch:B}),af&&(0,e.jsx)(o.g,{tokenUsage:af}),(0,e.jsx)(h.V,{onSend:_,disabled:X,cwd:b,onShowGitStatus:x,onShowComments:b?ah:void 0,onShowUserMessages:ai,onOpenNote:y,onCreateScheduledTask:aj})]}),!d&&(0,e.jsx)(i.r,{isOpen:J,onClose:()=>K(!1)}),!d&&b&&(0,e.jsx)(j.Q,{isOpen:L,onClose:()=>M(!1),cwd:b}),!d&&(0,e.jsx)(k.b,{isOpen:N,onClose:()=>O(!1)}),b&&(0,e.jsx)(l.i,{isOpen:P,onClose:()=>Q(!1),cwd:b}),(0,e.jsx)(m.f,{isOpen:R,onClose:()=>S(!1),messages:D,onSelectMessage:a=>{V.current?.scrollToMessage(a)}})]})}g=(s.then?(await s)():s)[0],d()}catch(a){d(a)}})},24463:(a,b,c)=>{"use strict";c.d(b,{s:()=>h});var d=c(48249),e=c(67484),f=c(44384);function g(a){return a.replace(/^\([^)]+\)\s*/,"")}let h=(0,e.forwardRef)(function({displayString:a,documentation:b,x:c,y:h,container:i,onMouseEnter:j,onMouseLeave:k,onFindReferences:l,onSearch:m},n){let{t:o}=(0,f.Bd)(),p=(0,e.useRef)(null);(0,e.useImperativeHandle)(n,()=>p.current,[]);let q=i.getBoundingClientRect(),r=c-q.left,s=h-q.top,t=(0,e.useMemo)(()=>g(a),[a]),u=(0,e.useMemo)(()=>(function(a){let b,c=/\b(const|let|var|function|class|interface|type|enum|import|export|async|await|return|new|typeof|keyof|extends|implements|readonly|static|public|private|protected|abstract|declare|namespace|module|void|never|undefined|null|true|false|any|unknown|string|number|boolean|bigint|symbol|object)\b/g,e=[],f=0,g=0,h=/\b(const|let|var|function|class|interface|type|enum|import|export|async|await|return|new|typeof|keyof|extends|implements|readonly|static|public|private|protected|abstract|declare|namespace|module|void|never|undefined|null|true|false|any|unknown|string|number|boolean|bigint|symbol|object)\b|"[^"]*"|'[^']*'|\b\d+\b/g;for(;null!==(b=h.exec(a));){b.index>f&&e.push((0,d.jsx)("span",{className:"text-foreground",children:a.slice(f,b.index)},g++));let h=b[0];/^["']/.test(h)?e.push((0,d.jsx)("span",{className:"text-green-400",children:h},g++)):/^\d+$/.test(h)?e.push((0,d.jsx)("span",{className:"text-orange-300",children:h},g++)):c.test(h)?(c.lastIndex=0,e.push((0,d.jsx)("span",{className:"text-pink-400",children:h},g++))):e.push((0,d.jsx)("span",{className:"text-foreground",children:h},g++)),f=b.index+h.length}return f<a.length&&e.push((0,d.jsx)("span",{className:"text-foreground",children:a.slice(f)},g++)),e})(t),[t]);return(0,e.useEffect)(()=>{if(!p.current)return;let a=p.current,b=i.getBoundingClientRect(),d=a.getBoundingClientRect(),e=c-b.left,f=h-b.top;e+d.width>b.width-8&&(e=b.width-d.width-8),e<8&&(e=8),f+d.height>b.height-8&&(f=f-d.height-24),a.style.left=`${e}px`,a.style.top=`${f}px`},[c,h,i]),(0,d.jsxs)("div",{ref:p,className:"absolute z-[200] max-w-lg bg-card border border-border rounded-lg shadow-xl px-3 py-2 pointer-events-none",style:{left:r,top:s},children:[(0,d.jsx)("pre",{className:"font-mono text-xs whitespace-pre-wrap break-all leading-relaxed",children:u}),b&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("div",{className:"border-t border-border my-1"}),(0,d.jsx)("p",{className:"text-xs text-muted-foreground whitespace-pre-wrap",children:b})]}),(l||m)&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("div",{className:"border-t border-border my-1.5"}),(0,d.jsxs)("div",{className:"flex items-center gap-3 pointer-events-auto",onMouseEnter:j,onMouseLeave:k,children:[l&&(0,d.jsx)("button",{onClick:l,className:"text-[11px] text-brand hover:underline cursor-pointer",children:o("hoverTooltip.findReferences")}),m&&(0,d.jsx)("button",{onClick:()=>m(function(a){let b=g(a),c=b.match(/^(?:function|const|let|var|class|interface|type|enum|async function)\s+([a-zA-Z_$][\w$]*)/);if(c)return c[1];let d=a.match(/\([^)]+\)\s+(?:[\w$]+\.)*([a-zA-Z_$][\w$]*)/);if(d)return d[1];let e=b.match(/([a-zA-Z_$][\w$]*)/);return e?e[1]:b.split(/[(\s:]/)[0]}(a)),className:"text-[11px] text-brand hover:underline cursor-pointer",children:o("hoverTooltip.search")})]})]})]})})},24520:(a,b,c)=>{"use strict";c.d(b,{A:()=>d});let d=(0,c(47408).A)("plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]])},26068:(a,b,c)=>{"use strict";c.d(b,{Ee:()=>m,SU:()=>j,ft:()=>l,iN:()=>k});var d=c(48249),e=c(67484),f=c(44384),g=c(74429),h=c(81749);let i=(0,e.createContext)(null);function j({container:a,children:b}){return(0,d.jsx)(i.Provider,{value:a,children:b})}function k(){return(0,e.useContext)(i)}function l({x:a,y:b,path:c,cwd:j,isDirectory:k,onClose:l,onCreateFile:m,onDelete:n,onRefresh:o,onCopyFile:p,onPaste:q}){let{t:r}=(0,f.Bd)(),s=(0,e.useRef)(null),t=(0,e.useContext)(i),u=c.split("/").pop()||c,v=`${j}/${c}`,w=c.includes("/")?c.substring(0,c.lastIndexOf("/")):"",x=w?`${j}/${w}`:j,y=k?c:w,z=k?v:x,[A,B]=(0,e.useState)({x:0,y:0}),C=(0,e.useCallback)(async(a,b)=>{try{await navigator.clipboard.writeText(a),(0,h.oR)(r("toast.copiedName",{name:b}),"success")}catch{(0,h.oR)(r("toast.copyFailed"),"error")}l()},[l,r]),D=k?c:w,E=[{label:r("fileContextMenu.copyRelativePath"),value:c},{label:r("fileContextMenu.copyAbsolutePath"),value:v},{label:r("fileContextMenu.copyRelativeDirPath"),value:y||"."},{label:r("fileContextMenu.copyAbsoluteDirPath"),value:z},{label:k?r("fileContextMenu.copyFolderName"):r("fileContextMenu.copyFileName"),value:u}],F=(0,d.jsxs)("div",{ref:s,className:"absolute z-[200] bg-card border border-border rounded-lg shadow-lg py-1 w-fit whitespace-nowrap",style:{left:A.x,top:A.y},children:[m&&(0,d.jsx)("button",{className:"block w-full px-3 py-1.5 text-left text-sm text-foreground hover:bg-accent transition-colors",onClick:()=>{l(),m(D)},children:r("fileContextMenu.createFile")}),p&&(0,d.jsx)("button",{className:"block w-full px-3 py-1.5 text-left text-sm text-foreground hover:bg-accent transition-colors",onClick:()=>{l(),p(c)},children:k?r("fileContextMenu.copyFolder"):r("fileContextMenu.copyFile")}),q&&(0,d.jsx)("button",{className:"block w-full px-3 py-1.5 text-left text-sm text-foreground hover:bg-accent transition-colors",onClick:()=>{l(),q(D)},children:r("fileContextMenu.pasteHere")}),n&&(0,d.jsx)("button",{className:"block w-full px-3 py-1.5 text-left text-sm text-destructive hover:bg-accent transition-colors",onClick:()=>{l(),n(c,k,u)},children:k?r("fileContextMenu.deleteFolder"):r("fileContextMenu.deleteFile")}),(m||n||p||q)&&(0,d.jsx)("div",{className:"my-1 border-t border-border"}),E.map((a,b)=>(0,d.jsx)("button",{className:"block w-full px-3 py-1.5 text-left text-sm text-foreground hover:bg-accent transition-colors",onClick:()=>C(a.value,a.label),children:a.label},b))]});return t?(0,g.createPortal)(F,t):F}function m(){let[a,b]=(0,e.useState)(null);return{contextMenu:a,showContextMenu:(0,e.useCallback)((a,c,d)=>{a.preventDefault(),a.stopPropagation(),b({x:a.clientX,y:a.clientY,path:c,isDirectory:d})},[]),hideContextMenu:(0,e.useCallback)(()=>{b(null)},[])}}},26130:(a,b,c)=>{"use strict";c.d(b,{x:()=>h});var d=c(48249),e=c(67484),f=c(44384),g=c(81749);function h({isOpen:a,onClose:b,cwd:c}){let h,{t:i}=(0,f.Bd)(),[j,k]=(0,e.useState)([]),[l,m]=(0,e.useState)(null),[n,o]=(0,e.useState)(null),[p,q]=(0,e.useState)(!1),[r,s]=(0,e.useState)(!1),[t,u]=(0,e.useState)(null),[v,w]=(0,e.useState)(!1),[x,y]=(0,e.useState)(""),[z,A]=(0,e.useState)(!1),[B,C]=(0,e.useState)([]),[D,E]=(0,e.useState)(""),[F,G]=(0,e.useState)(!1),H=(0,e.useCallback)(async()=>{q(!0);try{let a=await fetch(`/api/git/worktree?cwd=${encodeURIComponent(c)}`);if(a.ok){let b=await a.json();k(b.worktrees),m(b.nextPath),o(b.nextRandomWord),b.gitUserName&&y(b.gitUserName)}}catch(a){console.error("Failed to load worktrees:",a),(0,g.oR)(i("toast.worktreeLoadFailed"),"error")}finally{q(!1)}},[c]),I=(0,e.useCallback)(a=>{let{local:b,remote:c}=a;return c.includes("origin/main")?"origin/main":c.includes("origin/master")?"origin/master":b.includes("main")?"main":b.includes("master")?"master":c.length>0?c[0]:b.length>0?b[0]:"main"},[]),J=async()=>{if(!l)return;let a="origin/main";try{let b=await fetch(`/api/git/branches?cwd=${encodeURIComponent(c)}`);if(b.ok){let c=await b.json();a=I(c)}}catch{}let b=n||function(){let a="bcdfghjklmnprstvwz",b=["a","e","i","o","u","ai","au","ea","ee","ia","io","oa","oo","ou","ui"],c="";for(let d=0;d<2;d++)c+=a[Math.floor(Math.random()*a.length)],c+=b[Math.floor(Math.random()*b.length)];return c}(),d=x?`${x}/${b}`:b;s(!0);try{let b=await fetch("/api/git/worktree",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"add",cwd:c,path:l,newBranch:d,baseBranch:a})});if(b.ok)(0,g.oR)(i("toast.worktreeCreateSuccess",{name:d}),"success"),H();else{let a=await b.json();(0,g.oR)(a.error||i("toast.worktreeCreateFailed"),"error")}}catch(a){console.error("Failed to create worktree:",a),(0,g.oR)(i("toast.worktreeCreateFailed"),"error")}finally{s(!1)}},K=async()=>{G(!0),E(""),A(!0);try{let a=await fetch(`/api/git/branches?cwd=${encodeURIComponent(c)}`);if(a.ok){let b=await a.json(),c=new Set(j.map(a=>a.branch).filter(Boolean)),d=[...b.local.filter(a=>!c.has(a)),...b.remote.filter(a=>!c.has(a)&&!b.local.includes(a.replace(/^origin\//,"")))];C(d)}}catch{(0,g.oR)(i("toast.loadBranchFailed"),"error")}finally{G(!1)}},L=async a=>{if(l){A(!1),s(!0);try{let b=await fetch("/api/git/worktree",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"add",cwd:c,path:l,branch:a})});if(b.ok)(0,g.oR)(i("toast.worktreeCreateSuccess",{name:a}),"success"),H();else{let a=await b.json();(0,g.oR)(a.error||i("toast.worktreeCreateFailed"),"error")}}catch(a){console.error("Failed to create worktree:",a),(0,g.oR)(i("toast.worktreeCreateFailed"),"error")}finally{s(!1)}}},M=async()=>{if(t){w(!0);try{let a=await fetch("/api/git/worktree",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"remove",cwd:c,path:t.path})});if(a.ok)(0,g.oR)(i("toast.worktreeDeleted"),"success"),u(null),H();else{let b=await a.json();(0,g.oR)(b.error||i("toast.worktreeDeleteFailed"),"error")}}catch(a){console.error("Failed to delete worktree:",a),(0,g.oR)(i("toast.worktreeDeleteFailed"),"error")}finally{w(!1)}}},N=async a=>{let b=a.isLocked?"unlock":"lock";try{let d=await fetch("/api/git/worktree",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:b,cwd:c,path:a.path})});if(d.ok)(0,g.oR)(a.isLocked?i("toast.worktreeUnlocked"):i("toast.worktreeLocked"),"success"),H();else{let a=await d.json();(0,g.oR)(a.error||i("toast.operationFailed"),"error")}}catch(a){console.error("Failed to toggle lock:",a),(0,g.oR)(i("toast.operationFailed"),"error")}};return a?(0,d.jsx)("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50",onClick:b,children:(0,d.jsxs)("div",{className:"bg-card rounded-lg shadow-xl w-[480px] max-h-[80vh] flex flex-col",onClick:a=>a.stopPropagation(),children:[(0,d.jsxs)("div",{className:"px-4 py-3 border-b border-border flex items-center justify-between flex-shrink-0",children:[(0,d.jsx)("span",{className:"text-sm font-medium text-foreground",children:"Git Worktrees"}),(0,d.jsx)("button",{onClick:b,className:"p-1.5 text-muted-foreground hover:text-foreground hover:bg-accent rounded transition-colors",title:i("common.close"),children:(0,d.jsx)("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,d.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),(0,d.jsx)("div",{className:"flex-1 p-4 overflow-y-auto",children:p?(0,d.jsx)("div",{className:"flex items-center justify-center py-8",children:(0,d.jsx)("span",{className:"inline-block w-6 h-6 border-2 border-brand border-t-transparent rounded-full animate-spin"})}):(0,d.jsx)("div",{className:"space-y-2",children:j.map(a=>{let e=a.path===c;return(0,d.jsxs)("div",{className:`group p-3 rounded-lg border transition-colors ${e?"border-brand bg-brand/5":"border-border hover:bg-accent cursor-pointer"}`,onClick:()=>{a.path!==c&&(window.parent.postMessage({type:"OPEN_PROJECT",cwd:a.path},"*"),b())},children:[(0,d.jsxs)("div",{className:"flex items-center justify-between",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2 min-w-0",children:[(0,d.jsx)("span",{className:`w-2 h-2 rounded-full flex-shrink-0 ${e?"bg-brand":"bg-muted-foreground/30"}`}),(0,d.jsx)("span",{className:"font-medium text-foreground truncate",children:a.branch||(a.isDetached?"detached":"unknown")}),a.isLocked&&(0,d.jsx)("span",{className:"text-amber-11",title:i("git.worktree.locked"),children:"\uD83D\uDD12"}),e&&(0,d.jsxs)("span",{className:"text-xs text-brand",children:["(",i("common.current"),")"]})]}),(0,d.jsx)("div",{className:"flex items-center gap-1 opacity-0 group-hover:opacity-100 transition-opacity",children:!e&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("button",{onClick:b=>{b.stopPropagation(),N(a)},className:"p-1.5 text-muted-foreground hover:text-foreground hover:bg-secondary rounded transition-colors",title:a.isLocked?i("git.worktree.unlock"):i("git.worktree.lock"),children:a.isLocked?(0,d.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,d.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 11V7a4 4 0 118 0m-4 8v2m-6 4h12a2 2 0 002-2v-6a2 2 0 00-2-2H6a2 2 0 00-2 2v6a2 2 0 002 2z"})}):(0,d.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,d.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 15v2m-6 4h12a2 2 0 002-2v-6a2 2 0 00-2-2H6a2 2 0 00-2 2v6a2 2 0 002 2zm10-10V7a4 4 0 00-8 0v4h8z"})})}),(0,d.jsx)("button",{onClick:b=>{b.stopPropagation(),u(a)},className:"p-1.5 text-muted-foreground hover:text-red-11 hover:bg-secondary rounded transition-colors",title:i("common.delete"),children:(0,d.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,d.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"})})})]})})]}),(0,d.jsx)("div",{className:"mt-1 text-xs text-muted-foreground truncate pl-4",children:a.path}),a.isDetached&&(0,d.jsx)("div",{className:"mt-1 text-xs text-amber-11 pl-4",children:"(detached HEAD)"})]},a.path)})})}),z&&(0,d.jsxs)("div",{className:"border-t border-border px-4 py-3 flex-shrink-0",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2 mb-2",children:[(0,d.jsx)("input",{value:D,onChange:a=>E(a.target.value),placeholder:i("git.worktree.searchBranch"),className:"flex-1 bg-secondary text-sm text-foreground rounded px-2.5 py-1.5 outline-none placeholder:text-muted-foreground",autoFocus:!0,autoComplete:"off",spellCheck:"false"}),(0,d.jsx)("button",{onClick:()=>A(!1),className:"text-xs text-muted-foreground hover:text-foreground px-2 py-1.5",children:i("common.cancel")})]}),(0,d.jsx)("div",{className:"max-h-[200px] overflow-y-auto space-y-0.5",children:F?(0,d.jsx)("div",{className:"text-xs text-muted-foreground text-center py-4",children:i("common.loading")}):0===(h=B.filter(a=>a.toLowerCase().includes(D.toLowerCase()))).length?(0,d.jsx)("div",{className:"text-xs text-muted-foreground text-center py-4",children:i("git.worktree.noBranches")}):h.map(a=>(0,d.jsx)("button",{onClick:()=>L(a),className:"w-full text-left px-2.5 py-1.5 text-sm rounded hover:bg-accent transition-colors truncate",children:(0,d.jsx)("span",{className:`${a.startsWith("origin/")?"text-muted-foreground":"text-foreground"}`,children:a})},a))})]}),(0,d.jsxs)("div",{className:"px-4 py-3 border-t border-border flex items-center justify-between flex-shrink-0",children:[(0,d.jsx)("div",{className:"text-xs text-muted-foreground",children:i("git.worktree.count",{count:j.length})}),(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)("button",{onClick:K,disabled:!l||r,className:`px-3 py-1.5 text-sm rounded transition-colors ${l&&!r?"bg-secondary text-foreground hover:bg-accent":"bg-secondary text-muted-foreground cursor-not-allowed"}`,children:i("git.worktree.selectBranch")}),(0,d.jsx)("button",{onClick:J,disabled:!l||r,className:`px-3 py-1.5 text-sm rounded transition-colors ${l&&!r?"bg-brand text-white hover:bg-brand/90":"bg-secondary text-muted-foreground cursor-not-allowed"}`,children:r?(0,d.jsx)("span",{className:"inline-block w-4 h-4 border-2 border-current border-t-transparent rounded-full animate-spin"}):i("git.worktree.addWorktree")})]})]}),t&&(0,d.jsx)("div",{className:"absolute inset-0 z-10 flex items-center justify-center bg-black/50 rounded-lg",onClick:()=>u(null),children:(0,d.jsxs)("div",{className:"bg-card rounded-lg shadow-xl w-[360px] p-4",onClick:a=>a.stopPropagation(),children:[(0,d.jsx)("div",{className:"text-sm font-medium text-foreground mb-3",children:i("git.worktree.confirmDelete")}),(0,d.jsxs)("div",{className:"text-sm text-muted-foreground mb-4",children:[(0,d.jsx)("p",{className:"mb-2",children:i("git.worktree.confirmDeleteMsg")}),(0,d.jsxs)("p",{className:"text-xs",children:[(0,d.jsx)("span",{className:"text-muted-foreground",children:i("git.worktree.path")}),(0,d.jsx)("span",{className:"text-foreground",children:t.path})]}),(0,d.jsxs)("p",{className:"text-xs",children:[(0,d.jsx)("span",{className:"text-muted-foreground",children:i("git.worktree.branch")}),(0,d.jsx)("span",{className:"text-foreground",children:t.branch||"detached"})]})]}),(0,d.jsxs)("div",{className:"flex items-center justify-end gap-2",children:[(0,d.jsx)("button",{onClick:()=>u(null),className:"px-3 py-1.5 text-sm text-muted-foreground hover:text-foreground transition-colors",children:i("common.cancel")}),(0,d.jsx)("button",{onClick:M,disabled:v,className:"px-3 py-1.5 text-sm bg-red-9 text-white rounded hover:bg-red-10 transition-colors disabled:opacity-50",children:v?(0,d.jsx)("span",{className:"inline-block w-4 h-4 border-2 border-current border-t-transparent rounded-full animate-spin"}):i("common.delete")})]})]})})]})}):null}},26713:a=>{"use strict";a.exports=require("next/dist/shared/lib/router/utils/is-bot")},27805:(a,b,c)=>{"use strict";c.d(b,{J:()=>ba});var d,e,f,g,h,i=c(48249),j=c(67484),k=c(44384),l=c(46674),m=c(15273),n=c(47408);let o=(0,n.A)("clipboard",[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",key:"116196"}]]),p=(0,n.A)("rotate-cw",[["path",{d:"M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8",key:"1p45f6"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}]]),q=(0,n.A)("search",[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]]),r=(0,n.A)("chevron-up",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]);var s=c(44218),t=c(81749),u=function(a,b){return Object.defineProperty?Object.defineProperty(a,"raw",{value:b}):a.raw=b,a};(d=e||(e={}))[d.EOS=0]="EOS",d[d.Text=1]="Text",d[d.Incomplete=2]="Incomplete",d[d.ESC=3]="ESC",d[d.Unknown=4]="Unknown",d[d.SGR=5]="SGR",d[d.OSCURL=6]="OSCURL";class v{constructor(){this.VERSION="6.0.6",this.setup_palettes(),this._use_classes=!1,this.bold=!1,this.faint=!1,this.italic=!1,this.underline=!1,this.fg=this.bg=null,this._buffer="",this._url_allowlist={http:1,https:1},this._escape_html=!0,this.boldStyle="font-weight:bold",this.faintStyle="opacity:0.7",this.italicStyle="font-style:italic",this.underlineStyle="text-decoration:underline"}set use_classes(a){this._use_classes=a}get use_classes(){return this._use_classes}set url_allowlist(a){this._url_allowlist=a}get url_allowlist(){return this._url_allowlist}set escape_html(a){this._escape_html=a}get escape_html(){return this._escape_html}set boldStyle(a){this._boldStyle=a}get boldStyle(){return this._boldStyle}set faintStyle(a){this._faintStyle=a}get faintStyle(){return this._faintStyle}set italicStyle(a){this._italicStyle=a}get italicStyle(){return this._italicStyle}set underlineStyle(a){this._underlineStyle=a}get underlineStyle(){return this._underlineStyle}setup_palettes(){this.ansi_colors=[[{rgb:[0,0,0],class_name:"ansi-black"},{rgb:[187,0,0],class_name:"ansi-red"},{rgb:[0,187,0],class_name:"ansi-green"},{rgb:[187,187,0],class_name:"ansi-yellow"},{rgb:[0,0,187],class_name:"ansi-blue"},{rgb:[187,0,187],class_name:"ansi-magenta"},{rgb:[0,187,187],class_name:"ansi-cyan"},{rgb:[255,255,255],class_name:"ansi-white"}],[{rgb:[85,85,85],class_name:"ansi-bright-black"},{rgb:[255,85,85],class_name:"ansi-bright-red"},{rgb:[0,255,0],class_name:"ansi-bright-green"},{rgb:[255,255,85],class_name:"ansi-bright-yellow"},{rgb:[85,85,255],class_name:"ansi-bright-blue"},{rgb:[255,85,255],class_name:"ansi-bright-magenta"},{rgb:[85,255,255],class_name:"ansi-bright-cyan"},{rgb:[255,255,255],class_name:"ansi-bright-white"}]],this.palette_256=[],this.ansi_colors.forEach(a=>{a.forEach(a=>{this.palette_256.push(a)})});let a=[0,95,135,175,215,255];for(let b=0;b<6;++b)for(let c=0;c<6;++c)for(let d=0;d<6;++d){let e={rgb:[a[b],a[c],a[d]],class_name:"truecolor"};this.palette_256.push(e)}let b=8;for(let a=0;a<24;++a,b+=10){let a={rgb:[b,b,b],class_name:"truecolor"};this.palette_256.push(a)}}escape_txt_for_html(a){return this._escape_html?a.replace(/[&<>"']/gm,a=>"&"===a?"&amp;":"<"===a?"&lt;":">"===a?"&gt;":'"'===a?"&quot;":"'"===a?"&#x27;":void 0):a}append_buffer(a){var b=this._buffer+a;this._buffer=b}get_next_packet(){var a={kind:e.EOS,text:"",url:""},b=this._buffer.length;if(0==b)return a;var c=this._buffer.indexOf("\x1b");if(-1==c)return a.kind=e.Text,a.text=this._buffer,this._buffer="",a;if(c>0)return a.kind=e.Text,a.text=this._buffer.slice(0,c),this._buffer=this._buffer.slice(c),a;if(0==c){if(b<3)return a.kind=e.Incomplete,a;var d=this._buffer.charAt(1);if("["!=d&&"]"!=d&&"("!=d)return a.kind=e.ESC,a.text=this._buffer.slice(0,1),this._buffer=this._buffer.slice(1),a;if("["==d){this._csi_regex||(this._csi_regex=w(f||(f=u(["\n ^ # beginning of line\n #\n # First attempt\n (?: # legal sequence\n \x1b[ # CSI\n ([<-?]?) # private-mode char\n ([d;]*) # any digits or semicolons\n ([ -/]? # an intermediate modifier\n [@-~]) # the command\n )\n | # alternate (second attempt)\n (?: # illegal sequence\n \x1b[ # CSI\n [ -~]* # anything legal\n ([\0-\x1f:]) # anything illegal\n )\n "],["\n ^ # beginning of line\n #\n # First attempt\n (?: # legal sequence\n \\x1b\\[ # CSI\n ([\\x3c-\\x3f]?) # private-mode char\n ([\\d;]*) # any digits or semicolons\n ([\\x20-\\x2f]? # an intermediate modifier\n [\\x40-\\x7e]) # the command\n )\n | # alternate (second attempt)\n (?: # illegal sequence\n \\x1b\\[ # CSI\n [\\x20-\\x7e]* # anything legal\n ([\\x00-\\x1f:]) # anything illegal\n )\n "]))));let b=this._buffer.match(this._csi_regex);if(null===b)return a.kind=e.Incomplete,a;if(b[4])return a.kind=e.ESC,a.text=this._buffer.slice(0,1),this._buffer=this._buffer.slice(1),a;""!=b[1]||"m"!=b[3]?a.kind=e.Unknown:a.kind=e.SGR,a.text=b[2];var i=b[0].length;return this._buffer=this._buffer.slice(i),a}if("]"==d){if(b<4)return a.kind=e.Incomplete,a;if("8"!=this._buffer.charAt(2)||";"!=this._buffer.charAt(3))return a.kind=e.ESC,a.text=this._buffer.slice(0,1),this._buffer=this._buffer.slice(1),a;this._osc_st||(this._osc_st=RegExp((g||(g=u(["\n (?: # legal sequence\n (\x1b\\) # ESC | # alternate\n (\x07) # BEL (what xterm did)\n )\n | # alternate (second attempt)\n ( # illegal sequence\n [\0-\x06] # anything illegal\n | # alternate\n [\b-\x1a] # anything illegal\n | # alternate\n [\x1c-\x1f] # anything illegal\n )\n "],["\n (?: # legal sequence\n (\\x1b\\\\) # ESC \\\n | # alternate\n (\\x07) # BEL (what xterm did)\n )\n | # alternate (second attempt)\n ( # illegal sequence\n [\\x00-\\x06] # anything illegal\n | # alternate\n [\\x08-\\x1a] # anything illegal\n | # alternate\n [\\x1c-\\x1f] # anything illegal\n )\n "]))).raw[0].replace(/^\s+|\s+\n|\s*#[\s\S]*?\n|\n/gm,""),"g")),this._osc_st.lastIndex=0;{let b=this._osc_st.exec(this._buffer);if(null===b)return a.kind=e.Incomplete,a;if(b[3])return a.kind=e.ESC,a.text=this._buffer.slice(0,1),this._buffer=this._buffer.slice(1),a}{let b=this._osc_st.exec(this._buffer);if(null===b)return a.kind=e.Incomplete,a;if(b[3])return a.kind=e.ESC,a.text=this._buffer.slice(0,1),this._buffer=this._buffer.slice(1),a}this._osc_regex||(this._osc_regex=w(h||(h=u(["\n ^ # beginning of line\n #\n \x1b]8; # OSC Hyperlink\n [ -:<-~]* # params (excluding ;)\n ; # end of params\n ([!-~]{0,512}) # URL capture\n (?: # ST\n (?:\x1b\\) # ESC | # alternate\n (?:\x07) # BEL (what xterm did)\n )\n ([ -~]+) # TEXT capture\n \x1b]8;; # OSC Hyperlink End\n (?: # ST\n (?:\x1b\\) # ESC | # alternate\n (?:\x07) # BEL (what xterm did)\n )\n "],["\n ^ # beginning of line\n #\n \\x1b\\]8; # OSC Hyperlink\n [\\x20-\\x3a\\x3c-\\x7e]* # params (excluding ;)\n ; # end of params\n ([\\x21-\\x7e]{0,512}) # URL capture\n (?: # ST\n (?:\\x1b\\\\) # ESC \\\n | # alternate\n (?:\\x07) # BEL (what xterm did)\n )\n ([\\x20-\\x7e]+) # TEXT capture\n \\x1b\\]8;; # OSC Hyperlink End\n (?: # ST\n (?:\\x1b\\\\) # ESC \\\n | # alternate\n (?:\\x07) # BEL (what xterm did)\n )\n "]))));let c=this._buffer.match(this._osc_regex);if(null===c)return a.kind=e.ESC,a.text=this._buffer.slice(0,1),this._buffer=this._buffer.slice(1),a;a.kind=e.OSCURL,a.url=c[1],a.text=c[2];var i=c[0].length;return this._buffer=this._buffer.slice(i),a}if("("==d)return a.kind=e.Unknown,this._buffer=this._buffer.slice(3),a}}ansi_to_html(a){this.append_buffer(a);for(var b=[];;){var c=this.get_next_packet();if(c.kind==e.EOS||c.kind==e.Incomplete)break;c.kind!=e.ESC&&c.kind!=e.Unknown&&(c.kind==e.Text?b.push(this.transform_to_html(this.with_state(c))):c.kind==e.SGR?this.process_ansi(c):c.kind==e.OSCURL&&b.push(this.process_hyperlink(c)))}return b.join("")}with_state(a){return{bold:this.bold,faint:this.faint,italic:this.italic,underline:this.underline,fg:this.fg,bg:this.bg,text:a.text}}process_ansi(a){let b=a.text.split(";");for(;b.length>0;){let a=parseInt(b.shift(),10);if(isNaN(a)||0===a)this.fg=null,this.bg=null,this.bold=!1,this.faint=!1,this.italic=!1,this.underline=!1;else if(1===a)this.bold=!0;else if(2===a)this.faint=!0;else if(3===a)this.italic=!0;else if(4===a)this.underline=!0;else if(21===a)this.bold=!1;else if(22===a)this.faint=!1,this.bold=!1;else if(23===a)this.italic=!1;else if(24===a)this.underline=!1;else if(39===a)this.fg=null;else if(49===a)this.bg=null;else if(a>=30&&a<38)this.fg=this.ansi_colors[0][a-30];else if(a>=40&&a<48)this.bg=this.ansi_colors[0][a-40];else if(a>=90&&a<98)this.fg=this.ansi_colors[1][a-90];else if(a>=100&&a<108)this.bg=this.ansi_colors[1][a-100];else if((38===a||48===a)&&b.length>0){let c=38===a,d=b.shift();if("5"===d&&b.length>0){let a=parseInt(b.shift(),10);a>=0&&a<=255&&(c?this.fg=this.palette_256[a]:this.bg=this.palette_256[a])}if("2"===d&&b.length>2){let a=parseInt(b.shift(),10),d=parseInt(b.shift(),10),e=parseInt(b.shift(),10);if(a>=0&&a<=255&&d>=0&&d<=255&&e>=0&&e<=255){let b={rgb:[a,d,e],class_name:"truecolor"};c?this.fg=b:this.bg=b}}}}}transform_to_html(a){let b=a.text;if(0===b.length||(b=this.escape_txt_for_html(b),!a.bold&&!a.italic&&!a.faint&&!a.underline&&null===a.fg&&null===a.bg))return b;let c=[],d=[],e=a.fg,f=a.bg;a.bold&&c.push(this._boldStyle),a.faint&&c.push(this._faintStyle),a.italic&&c.push(this._italicStyle),a.underline&&c.push(this._underlineStyle),this._use_classes?(e&&("truecolor"!==e.class_name?d.push(`${e.class_name}-fg`):c.push(`color:rgb(${e.rgb.join(",")})`)),f&&("truecolor"!==f.class_name?d.push(`${f.class_name}-bg`):c.push(`background-color:rgb(${f.rgb.join(",")})`))):(e&&c.push(`color:rgb(${e.rgb.join(",")})`),f&&c.push(`background-color:rgb(${f.rgb})`));let g="",h="";return d.length&&(g=` class="${d.join(" ")}"`),c.length&&(h=` style="${c.join(";")}"`),`<span${h}${g}>${b}</span>`}process_hyperlink(a){let b=a.url.split(":");return b.length<1||!this._url_allowlist[b[0]]?"":`<a href="${this.escape_txt_for_html(a.url)}">${this.escape_txt_for_html(a.text)}</a>`}}function w(a){return new RegExp(a.raw[0].replace(/^\s+|\s+\n|\s*#[\s\S]*?\n|\n/gm,""))}function x(a){let b=function(a){let b=0xffffffff;for(let c=0;c<a.length;c++){b^=a.charCodeAt(c);for(let a=0;a<8;a++)b=b>>>1^(1&b?0xedb88320:0)}return(0xffffffff^b)>>>0}(a),c="",d=b;for(let a=0;a<4;a++)c+=String.fromCharCode(97+d%26),d=Math.floor(d/26);return c}let y=(0,j.memo)(function({shortId:a,type:b,onRegister:c,onUnregister:d}){let{t:e}=(0,k.Bd)(),[f,g]=(0,j.useState)(!1),h=(0,j.useCallback)(async h=>{if(h.stopPropagation(),f)await d(),g(!1),(0,t.oR)(e("toast.disconnected",{id:a}));else{await c(),g(!0);let d=`cock ${b} ${a}`;navigator.clipboard.writeText(d),(0,t.oR)(e("toast.copiedCommand",{command:d}))}},[f,a,b,c,d,e]);return(0,i.jsxs)("button",{onClick:h,className:"inline-flex items-center gap-1 text-[10px] font-mono leading-none px-1.5 py-0.5 rounded flex-shrink-0 transition-colors bg-muted/60 hover:bg-muted text-muted-foreground",title:f?e("shortIdBadge.clickToDisconnect"):e("shortIdBadge.clickToRegister"),children:[(0,i.jsx)("span",{className:`inline-block w-1.5 h-1.5 rounded-full ${f?"bg-green-500":"bg-muted-foreground/40"}`}),a]})});var z=c(30976);let A=(0,j.lazy)(()=>c.e(4490).then(c.bind(c,54490)).then(a=>({default:a.XtermRenderer}))),B={c:"\x03",d:"\x04",z:"\x1a",l:"\f",a:"\x01",e:"\x05",u:"\x15",w:"\x17"},C=/\x1b\[[0-9;]*m/g;function D({output:a,query:b,mode:c,currentIdx:d,matchRefs:e}){let f=(0,j.useRef)(null);f.current||(f.current=new v,f.current.use_classes=!0);let g=a.split("\n"),h=b.toLowerCase(),k=0;return e.current=[],(0,i.jsx)("pre",{className:"text-sm font-mono whitespace-pre-wrap break-words select-text",children:g.map((a,b)=>{let g=a.replace(C,""),j=g.toLowerCase().includes(h);if("filter"===c&&!j)return null;if(!j){let c=f.current.ansi_to_html(a);return(0,i.jsx)("div",{dangerouslySetInnerHTML:{__html:c}},b)}let l=[],m=0,n=g.toLowerCase(),o=0;for(;o<n.length;){let a=n.indexOf(h,o);if(-1===a)break;a>m&&l.push((0,i.jsx)("span",{children:g.slice(m,a)},`t${m}`));let b=k++,c=b===d;l.push((0,i.jsx)("mark",{ref:a=>{e.current[b]=a},className:c?"bg-brand/40 text-foreground":"bg-yellow-300/40 text-foreground",children:g.slice(a,a+h.length)},`m${a}`)),o=m=a+h.length}return m<g.length&&l.push((0,i.jsx)("span",{children:g.slice(m)},`t${m}`)),(0,i.jsx)("div",{children:l},b)})})}let E=(0,j.memo)(function({commandId:a,tabId:b,projectCwd:c,command:d,output:e,exitCode:f,isRunning:g,selected:h,onSelect:n,onInterrupt:u,onStdin:w,onDelete:C,onRerun:E,timestamp:F,usePty:G,onPtyResize:H,onToggleMaximize:I,maximized:J,expandedHeight:K,bubbleContentHeight:L,onTitleMouseDown:M}){let{t:N}=(0,k.Bd)(),O=(0,j.useRef)(null),P=(0,j.useRef)(null),Q=(0,j.useRef)(!0),R=(0,j.useRef)(null),S=(0,j.useRef)(null),T=(a=>{if(!a)return"";let b=new Date(a);if(isNaN(b.getTime()))return"";let c=String(b.getMonth()+1).padStart(2,"0"),d=String(b.getDate()).padStart(2,"0"),e=String(b.getHours()).padStart(2,"0"),f=String(b.getMinutes()).padStart(2,"0");return`${c}-${d} ${e}:${f}`})(F),U=a&&b?x(b+a):void 0,[V,W]=(0,j.useState)(!1),[X,Y]=(0,j.useState)(""),Z=(0,j.useRef)(null),$=(0,j.useRef)(null),[_,aa]=(0,j.useState)(!1),[ab,ac]=(0,j.useState)(""),[ad,ae]=(0,j.useState)("search"),[af,ag]=(0,j.useState)(0),ah=(0,j.useRef)([]),ai=(0,j.useRef)(null),aj=(0,j.useRef)(0);(0,j.useEffect)(()=>{ai.current||(ai.current=new v,ai.current.use_classes=!0)},[]),(0,j.useLayoutEffect)(()=>{let a=P.current;if(a&&ai.current){if(e.length<aj.current&&(ai.current=new v,ai.current.use_classes=!0,aj.current=0,a.innerHTML=""),e.length>aj.current){let b=e.slice(aj.current),c=ai.current.ansi_to_html(b);aj.current=e.length,a.insertAdjacentHTML("beforeend",c)}if(O.current){let a=O.current.scrollHeight>O.current.clientHeight;W(a),a&&(O.current.scrollTop=O.current.scrollHeight)}}},[e]),(0,j.useEffect)(()=>(g&&Q.current&&O.current&&(null!==R.current&&cancelAnimationFrame(R.current),R.current=requestAnimationFrame(()=>{O.current&&(O.current.scrollTop=O.current.scrollHeight),R.current=null})),()=>{null!==R.current&&cancelAnimationFrame(R.current)}),[e,g]),(0,j.useEffect)(()=>{if(!J)return;let a=a=>{"Escape"===a.key&&(a.preventDefault(),a.stopPropagation(),I?.())};return document.addEventListener("keydown",a,!0),()=>document.removeEventListener("keydown",a,!0)},[J,I]);let ak=e?e.split("\n").length:0,al=(0,j.useCallback)(()=>{aa(!0),requestAnimationFrame(()=>$.current?.focus())},[]),am=(0,j.useCallback)(()=>{aa(!1),ac(""),ag(0),Z.current?.clearSearch()},[]),an=(0,j.useCallback)(a=>{a.trim()&&(G?Z.current?.findNext(a):ag(a=>{let b=a+1,c=ah.current[b];return c?(c.scrollIntoView({block:"nearest"}),b):(ah.current[0]?.scrollIntoView({block:"nearest"}),0)}))},[G]),ao=(0,j.useCallback)(a=>{a.trim()&&(G?Z.current?.findPrevious(a):ag(a=>{let b=a-1;if(b>=0)return ah.current[b]?.scrollIntoView({block:"nearest"}),b;let c=ah.current.length-1;return c>=0&&ah.current[c]?.scrollIntoView({block:"nearest"}),Math.max(c,0)}))},[G]);(0,j.useEffect)(()=>{if(!h)return;let a=a=>{if((a.metaKey||a.ctrlKey)&&"f"===a.key){a.preventDefault(),a.stopPropagation(),al();return}if("Escape"===a.key&&_){a.preventDefault(),a.stopPropagation(),am();return}};return document.addEventListener("keydown",a,!0),()=>document.removeEventListener("keydown",a,!0)},[h,_,al,am]);let ap=J&&K?K-41:L??360;return(0,i.jsx)("div",{className:"flex flex-col items-start",children:(0,i.jsxs)("div",{className:`w-full bg-accent text-foreground dark:text-slate-11 relative overflow-hidden border transition-colors cursor-pointer ${J?"rounded-none border-0":"rounded-2xl rounded-bl-md rounded-br-md"} ${J?"":h?"border-brand":"border-brand/30"}`,onClick:n,children:[J?(0,i.jsxs)("div",{onDoubleClick:()=>I?.(),className:"flex items-center gap-2 px-3 py-2 border-b border-border bg-card",style:{height:41,flexShrink:0},children:[(0,i.jsx)("span",{className:"text-[10px] font-mono leading-none px-1 py-0.5 rounded bg-muted text-muted-foreground",children:">_"}),(0,i.jsx)("span",{className:"flex-1 text-xs text-muted-foreground truncate font-mono",children:d}),g&&(0,i.jsxs)("span",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",children:[(0,i.jsx)("span",{className:"inline-block w-2 h-2 bg-green-500 rounded-full animate-pulse"}),N("console.runningText")]}),g&&u&&(0,i.jsx)("button",{onClick:u,className:"text-xs px-3 py-1 rounded-md font-medium bg-destructive text-destructive-foreground transition-all duration-150 hover:bg-destructive/80 hover:shadow-md active:scale-95 active:bg-destructive/70 cursor-pointer select-none",children:"Ctrl+C"}),(0,i.jsx)("button",{onClick:()=>I?.(),className:"p-1 rounded text-muted-foreground hover:text-foreground hover:bg-accent transition-colors",title:N("console.restoreTooltip",{modKey:(0,z.Mu)()}),children:(0,i.jsx)(l.A,{className:"w-4 h-4"})})]}):(0,i.jsxs)("div",{"data-drag-handle":!0,onMouseDown:()=>M?.(),onDoubleClick:a=>{a.stopPropagation(),I?.()},className:`flex items-center gap-2 px-4 py-1.5 border-b text-xs transition-colors cursor-grab active:cursor-grabbing ${h?"border-brand":"border-brand/30"}`,children:[(0,i.jsx)("span",{className:"text-[10px] font-mono leading-none px-1 py-0.5 rounded flex-shrink-0 bg-muted text-muted-foreground",children:">_"}),U&&a&&b&&(0,i.jsx)(y,{shortId:U,type:"terminal",onRegister:()=>{fetch("/api/terminal/register",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({tabId:b,commandId:a,command:d,projectCwd:c})}).catch(()=>{})},onUnregister:()=>{fetch("/api/terminal/unregister",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({commandId:a})}).catch(()=>{})}}),(0,i.jsx)("span",{className:"font-mono text-foreground truncate",children:d}),(0,i.jsx)("button",{onClick:a=>{a.stopPropagation(),navigator.clipboard.writeText(d),(0,t.oR)(N("toast.copiedCmd"))},className:"p-0.5 rounded text-muted-foreground hover:text-foreground transition-colors flex-shrink-0",title:N("console.copyCommand"),children:(0,i.jsx)(m.A,{className:"w-3.5 h-3.5"})}),(0,i.jsx)("span",{className:"flex-1"}),V&&!g&&(0,i.jsx)("span",{className:"text-muted-foreground flex-shrink-0",children:N("console.totalLines",{count:ak})}),e&&(0,i.jsx)("button",{onClick:a=>{let b;a.stopPropagation(),b=e.replace(/\x1b\[[0-9;]*m/g,""),navigator.clipboard.writeText(b),(0,t.oR)(N("toast.copiedOutput"))},className:"p-0.5 rounded text-muted-foreground hover:text-foreground transition-colors flex-shrink-0",title:N("console.copyOutput"),children:(0,i.jsx)(o,{className:"w-3.5 h-3.5"})}),E&&(0,i.jsx)("button",{onClick:a=>{a.stopPropagation(),E()},className:"p-0.5 rounded text-muted-foreground hover:text-foreground transition-colors flex-shrink-0",title:N("console.rerun"),children:(0,i.jsx)(p,{className:"w-3.5 h-3.5"})}),C&&(0,i.jsx)("button",{onClick:a=>{a.stopPropagation(),C()},className:"p-0.5 rounded text-destructive hover:text-destructive/80 transition-colors flex-shrink-0",title:N("console.deleteRecord"),children:(0,i.jsx)(l.A,{className:"w-3.5 h-3.5"})})]}),_&&(0,i.jsxs)("div",{className:"flex items-center gap-2 px-3 py-1.5 border-b border-border bg-card",style:{flexShrink:0},children:[(0,i.jsx)(q,{className:"w-3.5 h-3.5 text-muted-foreground flex-shrink-0"}),(0,i.jsx)("input",{ref:$,value:ab,onChange:a=>{let b=a.target.value;ac(b),ag(0),G&&(b.trim()?Z.current?.findNext(b):Z.current?.clearSearch())},onKeyDown:a=>{"Enter"===a.key&&(a.preventDefault(),a.shiftKey?ao(ab):an(ab))},placeholder:N("console.searchPlaceholder"),className:"flex-1 bg-transparent text-sm text-foreground outline-none placeholder:text-muted-foreground",autoComplete:"off",spellCheck:"false"}),!G&&(0,i.jsxs)("div",{className:"flex items-center gap-0.5 text-xs flex-shrink-0",children:[(0,i.jsx)("button",{onClick:()=>ae("search"),className:`px-1.5 py-0.5 rounded transition-colors ${"search"===ad?"bg-brand/20 text-brand":"text-muted-foreground hover:text-foreground"}`,children:N("console.searchMode")}),(0,i.jsx)("button",{onClick:()=>ae("filter"),className:`px-1.5 py-0.5 rounded transition-colors ${"filter"===ad?"bg-brand/20 text-brand":"text-muted-foreground hover:text-foreground"}`,children:N("console.filterMode")})]}),(0,i.jsxs)("div",{className:"flex items-center gap-0.5",children:[(0,i.jsx)("button",{onClick:()=>ao(ab),className:"p-1 rounded text-muted-foreground hover:text-foreground hover:bg-accent transition-colors",title:N("console.prevShiftEnter"),children:(0,i.jsx)(r,{className:"w-3.5 h-3.5"})}),(0,i.jsx)("button",{onClick:()=>an(ab),className:"p-1 rounded text-muted-foreground hover:text-foreground hover:bg-accent transition-colors",title:N("console.nextEnter"),children:(0,i.jsx)(s.A,{className:"w-3.5 h-3.5"})})]}),(0,i.jsx)("button",{onClick:am,className:"p-1 rounded text-muted-foreground hover:text-foreground hover:bg-accent transition-colors",children:(0,i.jsx)(l.A,{className:"w-3.5 h-3.5"})})]}),G?(0,i.jsx)("div",{style:{height:ap,overflow:"hidden"},children:(0,i.jsx)(j.Suspense,{fallback:(0,i.jsx)("div",{className:"px-4 py-2 text-xs text-muted-foreground",style:{height:ap},children:N("console.loadingTerminal")}),children:(0,i.jsx)(A,{ref:Z,output:e,isRunning:g,onInput:w,onResize:H,maximized:J,height:ap})})}):(0,i.jsx)("div",{ref:O,className:"overflow-auto px-4 py-2",style:{height:ap},onScroll:()=>{if(O.current){let{scrollTop:a,scrollHeight:b,clientHeight:c}=O.current;Q.current=b-a-c<50}},children:_&&ab.trim()?(0,i.jsx)(D,{output:e,query:ab,mode:ad,currentIdx:af,matchRefs:ah}):(0,i.jsx)("pre",{ref:P,className:"text-sm font-mono whitespace-pre-wrap break-words select-text"})}),g&&!J&&(0,i.jsxs)("div",{className:"border-t border-border px-4 py-2 flex items-center gap-2",onClick:a=>a.stopPropagation(),children:[(0,i.jsx)("span",{className:"inline-block w-2 h-2 bg-green-500 rounded-full animate-pulse flex-shrink-0"}),G?(0,i.jsx)("span",{className:"text-xs text-muted-foreground flex-1",children:N("console.clickToInput")}):w?(0,i.jsx)("input",{ref:S,value:X,onChange:a=>Y(a.target.value),onKeyDown:a=>{if(a.ctrlKey&&!a.metaKey&&!a.altKey){let b=B[a.key.toLowerCase()];if(b){a.preventDefault(),a.stopPropagation(),w(b);return}}"Enter"!==a.key||a.nativeEvent.isComposing||(a.preventDefault(),w(X+"\n"),Y("")),"Tab"===a.key&&(a.preventDefault(),w(" "))},placeholder:N("console.stdinPlaceholder"),className:"flex-1 min-w-0 bg-transparent text-xs font-mono text-foreground outline-none placeholder:text-muted-foreground",autoComplete:"off",spellCheck:"false"}):(0,i.jsx)("span",{className:"text-xs text-muted-foreground",children:N("console.runningText")}),u&&(0,i.jsx)("button",{onClick:u,className:"flex-shrink-0 text-xs text-destructive hover:brightness-125 transition-colors cursor-pointer select-none",children:"Ctrl+C"}),T&&(0,i.jsx)("span",{className:"text-[11px] text-muted-foreground flex-shrink-0",children:T})]}),!g&&void 0!==f&&!J&&(0,i.jsxs)("div",{className:"border-t border-border px-4 py-2 flex items-center gap-2 text-xs text-muted-foreground",children:[(0,i.jsx)("span",{className:`inline-block w-2 h-2 rounded-full ${0===f?"bg-green-500":"bg-red-500"}`}),(0,i.jsx)("span",{children:N("console.exitCode",{code:f})}),(0,i.jsx)("span",{className:"flex-1"}),T&&(0,i.jsx)("span",{className:"text-[11px] flex-shrink-0",children:T})]})]})})});var F=c(59347),G=c(24520);function H({cwd:a,tabId:b,onClose:c,onSave:d}){let{t:e}=(0,k.Bd)(),[f,g]=(0,j.useState)({}),[h,m]=(0,j.useState)(""),[n,o]=(0,j.useState)(""),[p,q]=(0,j.useState)(!0),r=()=>{h.trim()&&(g(a=>({...a,[h.trim()]:n})),m(""),o(""))},s=async()=>{try{(await fetch("/api/terminal/env",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({cwd:a,tabId:b,env:f})})).ok&&(d(f),c())}catch(a){console.error("Failed to save env:",a)}};return(0,i.jsx)("div",{className:"absolute inset-0 bg-black/50 flex items-center justify-center z-50",children:(0,i.jsxs)("div",{className:"bg-background border border-border rounded-lg shadow-xl w-full max-w-2xl max-h-[80vh] flex flex-col m-4",children:[(0,i.jsxs)("div",{className:"flex items-center justify-between px-4 py-3 border-b border-border",children:[(0,i.jsxs)("div",{children:[(0,i.jsx)("h2",{className:"text-lg font-semibold",children:e("envManager.title")}),(0,i.jsx)("p",{className:"text-xs text-muted-foreground mt-0.5",children:b?e("envManager.tabScope"):e("envManager.globalScope")})]}),(0,i.jsx)("button",{onClick:c,className:"p-1 rounded hover:bg-accent transition-colors",children:(0,i.jsx)(l.A,{className:"w-5 h-5"})})]}),(0,i.jsx)("div",{className:"flex-1 overflow-y-auto p-4",children:p?(0,i.jsx)("div",{className:"flex items-center justify-center h-32 text-muted-foreground",children:e("common.loading")}):(0,i.jsxs)("div",{className:"space-y-3",children:[Object.entries(f).map(([a,b])=>(0,i.jsxs)("div",{className:"flex items-start gap-2",children:[(0,i.jsx)("input",{type:"text",value:a,disabled:!0,className:"flex-1 px-3 py-2 rounded-lg border border-input bg-muted text-sm font-mono"}),(0,i.jsx)("input",{type:"text",value:b,onChange:b=>{var c;return c=b.target.value,void g(b=>({...b,[a]:c}))},placeholder:e("envManager.valuePlaceholder"),className:"flex-1 px-3 py-2 rounded-lg border border-input bg-background text-sm font-mono focus:outline-none focus:ring-2 focus:ring-brand focus:border-transparent"}),(0,i.jsx)("button",{onClick:()=>{g(b=>{let c={...b};return delete c[a],c})},className:"p-2 rounded-lg text-destructive hover:bg-destructive/10 transition-colors",children:(0,i.jsx)(F.A,{className:"w-4 h-4"})})]},a)),(0,i.jsxs)("div",{className:"flex items-start gap-2 pt-2 border-t border-border",children:[(0,i.jsx)("input",{type:"text",value:h,onChange:a=>m(a.target.value),placeholder:e("envManager.varNamePlaceholder"),className:"flex-1 px-3 py-2 rounded-lg border border-input bg-background text-sm font-mono focus:outline-none focus:ring-2 focus:ring-brand focus:border-transparent",onKeyDown:a=>{"Enter"!==a.key||a.nativeEvent.isComposing||(a.preventDefault(),r())}}),(0,i.jsx)("input",{type:"text",value:n,onChange:a=>o(a.target.value),placeholder:e("envManager.varValuePlaceholder"),className:"flex-1 px-3 py-2 rounded-lg border border-input bg-background text-sm font-mono focus:outline-none focus:ring-2 focus:ring-brand focus:border-transparent",onKeyDown:a=>{"Enter"!==a.key||a.nativeEvent.isComposing||(a.preventDefault(),r())}}),(0,i.jsx)("button",{onClick:r,disabled:!h.trim(),className:"p-2 rounded-lg bg-brand text-brand-foreground hover:bg-brand/90 transition-colors disabled:opacity-50 disabled:cursor-not-allowed",children:(0,i.jsx)(G.A,{className:"w-4 h-4"})})]}),0===Object.keys(f).length&&(0,i.jsx)("div",{className:"text-center py-8 text-muted-foreground text-sm",children:e("envManager.noVars")})]})}),(0,i.jsxs)("div",{className:"flex items-center justify-end gap-2 px-4 py-3 border-t border-border",children:[(0,i.jsx)("button",{onClick:c,className:"px-4 py-2 rounded-lg text-sm hover:bg-accent transition-colors",children:e("common.cancel")}),(0,i.jsx)("button",{onClick:s,className:"px-4 py-2 rounded-lg text-sm bg-brand text-brand-foreground hover:bg-brand/90 transition-colors",children:e("common.save")})]})]})})}var I=c(94924);let J=(0,n.A)("zap",[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]]),K=(0,n.A)("list",[["path",{d:"M3 5h.01",key:"18ugdj"}],["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M3 19h.01",key:"noohij"}],["path",{d:"M8 5h13",key:"1pao27"}],["path",{d:"M8 12h13",key:"1za7za"}],["path",{d:"M8 19h13",key:"m83p4d"}]]),L=(0,n.A)("layout-grid",[["rect",{width:"7",height:"7",x:"3",y:"3",rx:"1",key:"1g98yp"}],["rect",{width:"7",height:"7",x:"14",y:"3",rx:"1",key:"6d4xhi"}],["rect",{width:"7",height:"7",x:"14",y:"14",rx:"1",key:"nxv5o0"}],["rect",{width:"7",height:"7",x:"3",y:"14",rx:"1",key:"1bb6yr"}]]),M=(0,n.A)("variable",[["path",{d:"M8 21s-4-3-4-9 4-9 4-9",key:"uto9ud"}],["path",{d:"M16 3s4 3 4 9-4 9-4 9",key:"4w2vsq"}],["line",{x1:"15",x2:"9",y1:"9",y2:"15",key:"f7djnv"}],["line",{x1:"9",x2:"15",y1:"9",y2:"15",key:"1shsy8"}]]),N=(0,n.A)("play",[["path",{d:"M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z",key:"10ikf1"}]]);var O=c(69005);let P=null,Q="",R=0,S=null,T=!1,U=new Map,V=null,W=null;function X(a){let b;try{b=JSON.parse(a.data)}catch{return}let c=b.type;if("ping"===c)return;if("running"===c){V&&(V(b.commands),V=null);return}let d=b.commandId;if(!d)return;let e=U.get(d);if(e){if("error"===c)e.onError(b.error);else{let{commandId:a,type:d,...f}=b;e.onData(c,f)}("exit"===c||"error"===c)&&U.delete(d)}}function Y(a){P?.readyState===WebSocket.OPEN&&P.send(JSON.stringify(a))}function Z(a){let b,c=(b="https:"===window.location.protocol?"wss:":"ws:",`${b}//${window.location.host}/ws/terminal?projectCwd=${encodeURIComponent(a)}`);Q===c&&P||(function(){if(T=!0,S&&(clearTimeout(S),S=null),P){let a=P;P=null,a.close()}U.clear(),V&&(V([]),V=null),W=null,Q="",R=0}(),T=!1,Q=c,function a(){if(T||!Q)return;let b=new WebSocket(Q);P=b,b.onopen=()=>{R=0},b.onmessage=X,b.onclose=()=>{if(P!==b||(P=null,T))return;S&&clearTimeout(S);let c=Math.min(1e3*Math.pow(1.5,R),1e4);R++,S=setTimeout(a,c)},b.onerror=()=>{}}())}function $(){return new Promise((a,b)=>{if(P?.readyState===WebSocket.OPEN)return void a();let c=setInterval(()=>{P?.readyState===WebSocket.OPEN&&(clearInterval(c),clearTimeout(d),a())},50),d=setTimeout(()=>{clearInterval(c),b(Error("WebSocket connection timeout"))},5e3)})}async function _(a){let{cwd:b,command:c,commandId:d,tabId:e,projectCwd:f,env:g,usePty:h,cols:i,rows:j,onData:k,onError:l}=a;Z(f);try{await $()}catch{l("WebSocket connection failed");return}U.delete(d),U.set(d,{onData:k,onError:l}),Y({type:"exec",commandId:d,command:c,cwd:b,tabId:e,env:g,...h?{usePty:!0}:{},...i?{cols:i,rows:j}:{}})}async function aa(a){let{commandId:b,projectCwd:c,onData:d,onError:e}=a;Z(c);try{await $()}catch{e("WebSocket connection failed");return}U.set(b,{onData:d,onError:e}),Y({type:"attach",commandId:b})}function ab(a,b){Y({type:"stdin",commandId:a,data:b})}function ac(a,b,c){Y({type:"resize",commandId:a,cols:b,rows:c})}function ad(a){Y({type:"interrupt",pid:a})}async function ae(a){try{Z(a);try{await $()}catch{return[]}return await new Promise(a=>{V=b=>{a(b)},Y({type:"running"}),setTimeout(()=>{V&&(V=null,a([]))},3e3)})}finally{W=null}}let af=new Map;function ag(a){af.set(a.type,a)}function ah(a){return af.get(a)}function ai(a){for(let b of af.values())if(b.match(a))return b;return null}var aj=c(74955);async function ak(a){let b=(0,aj.f)()?.id??null;return!!b&&new Promise(c=>{try{let d=globalThis.chrome?.runtime;if(!d?.sendMessage)return void c(!1);let e=setTimeout(()=>c(!1),2e3);d.sendMessage(b,{type:"prepare-iframe",url:a},a=>{clearTimeout(e),c(a?.ok??!1)})}catch{c(!1)}})}function al({url:a,id:b,selected:c,maximized:d,expandedHeight:e,bubbleContentHeight:f,onSelect:g,onClose:h,onToggleMaximize:l,onNewTab:m,timestamp:n,onTitleMouseDown:o,initialSleeping:p,onSleep:q,onWake:r}){let{t:s}=(0,k.Bd)(),[u,v]=(0,j.useState)(!1),[w,A]=(0,j.useState)(null),[B,C]=(0,j.useState)(a),[D,E]=(0,j.useState)(null),[F,G]=(0,j.useState)(p??!1),H=(0,j.useRef)(null),I=(0,j.useRef)(null),J=(0,j.useRef)(null);(0,j.useRef)(!0),(0,j.useCallback)(()=>{F||(G(!0),E(null),q?.(b))},[F,b,q]),(0,j.useCallback)(()=>{H.current&&(clearTimeout(H.current),H.current=null)},[]);let{shortId:K,connected:L,connect:M,disconnect:N}=function(a,b,c){let d=(0,j.useMemo)(()=>x(a),[a]),[e,f]=(0,j.useState)(!1),g=(0,j.useRef)(null);(0,j.useRef)([]),(0,j.useRef)(null),(0,j.useRef)(!1),(0,j.useRef)(c);let h=(0,j.useRef)([]);(0,j.useCallback)(a=>{let c=b.current;if(!c?.contentWindow){let b=g.current;b&&b.readyState===WebSocket.OPEN&&b.send(JSON.stringify({type:"browser:cmd-result",reqId:a.reqId,ok:!1,error:"iframe not available (page may be sleeping)"}));return}c.contentWindow.postMessage({type:"cockpit:cmd",reqId:a.reqId,action:a.action,params:a.params},"*")},[b]);let i=(0,j.useCallback)(()=>e&&g.current?.readyState===WebSocket.OPEN?Promise.resolve():new Promise(a=>{h.current.push(a),e||f(!0)}),[e]);return{shortId:d,connected:e,connect:i,disconnect:(0,j.useCallback)(()=>{f(!1)},[])}}(b,J,!!D&&!F&&!u);(0,j.useRef)(L).current=L;let O=(0,j.useCallback)(()=>{G(!1),r?.(b);let c=function(a){if(!a)return a;try{let b=new URL(a);return b.searchParams.set("_cockpit","1"),b.toString()}catch{let b=a.includes("?")?"&":"?";return`${a}${b}_cockpit=1`}}(a);!function(a){try{let b=new URL(a).hostname;return"localhost"===b||"127.0.0.1"===b}catch{return!1}}(a)?ak(a).then(()=>E(c)):E(c)},[a,b,r]),P=(0,j.useCallback)(()=>v(!1),[]),Q=(0,j.useCallback)(()=>{v(!1),A(s("browser.pageLoadFailed"))},[]),R=(0,j.useCallback)(()=>{if(F)return void O();let a=I.current?.querySelector("iframe");if(a&&D){v(!0),A(null);let b=a.src;a.src="",setTimeout(()=>{a.src=b},0)}},[F,O,D]),S=(0,j.useCallback)(()=>{B&&window.open(B,"_blank")},[B]),T=function(a){if(!a)return"";try{let b=new URL(a);return b.port?`${b.hostname}:${b.port}`:b.hostname}catch{return a}}(B);return(0,i.jsx)("div",{className:"flex flex-col items-start",children:(0,i.jsxs)("div",{className:`w-full bg-accent text-foreground
4
+ relative transition-colors cursor-pointer
5
+ ${d?"rounded-none overflow-visible border-0":"border overflow-hidden rounded-2xl rounded-bl-md rounded-br-md"}
6
+ ${d?"":c?"border-brand":"border-brand/30"}`,onClick:d?void 0:g,children:[d?(0,i.jsxs)("div",{onDoubleClick:l,className:"flex items-center gap-2 px-3 py-2 border-b border-border bg-card",style:{height:41},children:[(0,i.jsx)("span",{className:"text-[10px] font-mono leading-none px-1 py-0.5 rounded flex-shrink-0 bg-muted text-muted-foreground",children:(0,i.jsx)("svg",{className:"w-3 h-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,i.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M21 12a9 9 0 01-9 9m9-9a9 9 0 00-9-9m9 9H3m9 9a9 9 0 01-9-9m9 9c1.657 0 3-4.03 3-9s-1.343-9-3-9m0 18c-1.657 0-3-4.03-3-9s1.343-9 3-9m-9 9a9 9 0 019-9"})})}),K&&(0,i.jsx)(y,{shortId:K,type:"browser",onRegister:()=>M(),onUnregister:async()=>{N(),await fetch("/api/browser/unregister",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:K})}).catch(()=>{})}}),(0,i.jsx)("span",{className:"text-xs text-muted-foreground truncate font-mono",children:B||s("browser.blankPage")}),B&&(0,i.jsx)("button",{onClick:a=>{a.stopPropagation(),navigator.clipboard.writeText(B),(0,t.oR)(s("toast.copiedUrl"))},className:"p-0.5 rounded text-muted-foreground hover:text-foreground transition-colors flex-shrink-0",title:s("browser.copyUrl"),children:(0,i.jsx)("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,i.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z"})})}),(0,i.jsx)("span",{className:"flex-1"}),u&&(0,i.jsx)("span",{className:"inline-block w-3 h-3 border border-brand border-t-transparent rounded-full animate-spin flex-shrink-0"}),(0,i.jsx)("button",{onClick:R,className:"p-0.5 rounded text-muted-foreground hover:text-foreground transition-colors flex-shrink-0",title:s("common.refresh"),children:(0,i.jsx)("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,i.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})})}),(0,i.jsx)("button",{onClick:S,className:"p-0.5 rounded text-muted-foreground hover:text-foreground transition-colors flex-shrink-0",title:s("browser.openInNewWindow"),children:(0,i.jsx)("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,i.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14"})})}),(0,i.jsx)("button",{onClick:l,className:"p-0.5 rounded text-muted-foreground hover:text-foreground transition-colors flex-shrink-0",title:s("browser.exitMaximize",{modKey:(0,z.Mu)()}),children:(0,i.jsx)("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,i.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 3v3a2 2 0 01-2 2H3m18 0h-3a2 2 0 01-2-2V3m0 18v-3a2 2 0 012-2h3M3 16h3a2 2 0 012 2v3"})})})]}):(0,i.jsxs)("div",{"data-drag-handle":!0,onMouseDown:()=>o?.(),onDoubleClick:a=>{a.stopPropagation(),l()},className:`flex items-center gap-2 px-4 py-1.5 border-b text-xs transition-colors cursor-grab active:cursor-grabbing
7
+ ${c?"border-brand":"border-brand/30"}`,children:[(0,i.jsx)("span",{className:"text-[10px] font-mono leading-none px-1 py-0.5 rounded flex-shrink-0 bg-muted text-muted-foreground",children:(0,i.jsx)("svg",{className:"w-3 h-3 inline-block",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,i.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M21 12a9 9 0 01-9 9m9-9a9 9 0 00-9-9m9 9H3m9 9a9 9 0 01-9-9m9 9c1.657 0 3-4.03 3-9s-1.343-9-3-9m0 18c-1.657 0-3-4.03-3-9s1.343-9 3-9m-9 9a9 9 0 019-9"})})}),K&&(0,i.jsx)(y,{shortId:K,type:"browser",onRegister:()=>M(),onUnregister:async()=>{N(),await fetch("/api/browser/unregister",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:K})}).catch(()=>{})}}),(0,i.jsx)("span",{className:"font-mono text-foreground truncate",children:B||s("browser.blankPage")}),B&&(0,i.jsx)("button",{onClick:a=>{a.stopPropagation(),navigator.clipboard.writeText(B),(0,t.oR)(s("toast.copiedUrl"))},className:"p-0.5 rounded text-muted-foreground hover:text-foreground transition-colors flex-shrink-0",title:s("browser.copyUrl"),children:(0,i.jsx)("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,i.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z"})})}),(0,i.jsx)("span",{className:"flex-1"}),u&&(0,i.jsx)("span",{className:"inline-block w-3 h-3 border border-brand border-t-transparent rounded-full animate-spin flex-shrink-0"}),(0,i.jsx)("button",{onClick:a=>{a.stopPropagation(),S()},className:"p-0.5 rounded text-muted-foreground hover:text-foreground transition-colors flex-shrink-0",title:s("browser.openInNewWindow"),children:(0,i.jsx)("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,i.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14"})})}),(0,i.jsx)("button",{onClick:a=>{a.stopPropagation(),R()},className:"p-0.5 rounded text-muted-foreground hover:text-foreground transition-colors flex-shrink-0",title:s("common.refresh"),children:(0,i.jsx)("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,i.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})})}),(0,i.jsx)("button",{onClick:a=>{a.stopPropagation(),h()},className:"p-0.5 rounded text-destructive hover:text-destructive/80 transition-colors flex-shrink-0",title:s("common.close"),children:(0,i.jsx)("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,i.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),(0,i.jsx)("div",{ref:I,className:"w-full",style:{height:d&&e?e-41:f??360},children:F?(0,i.jsxs)("div",{className:"relative overflow-hidden cursor-pointer group h-full",onClick:a=>{a.stopPropagation(),R()},children:[(0,i.jsxs)("div",{className:"absolute inset-0 flex flex-col items-center justify-center bg-muted/30",children:[(0,i.jsx)("svg",{className:"w-10 h-10 mb-2 text-muted-foreground/50",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,i.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"M21 12a9 9 0 01-9 9m9-9a9 9 0 00-9-9m9 9H3m9 9a9 9 0 01-9-9m9 9c1.657 0 3-4.03 3-9s-1.343-9-3-9m0 18c-1.657 0-3-4.03-3-9s1.343-9 3-9m-9 9a9 9 0 019-9"})}),(0,i.jsx)("p",{className:"text-xs text-muted-foreground/60",children:T})]}),(0,i.jsx)("div",{className:"absolute inset-0 flex items-center justify-center opacity-0 group-hover:opacity-100 transition-opacity",children:(0,i.jsxs)("div",{className:"flex items-center gap-1.5 px-3 py-1.5 rounded-full bg-black/60 text-white text-xs",children:[(0,i.jsx)("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,i.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})}),s("browser.clickToWake")]})})]}):a?w?(0,i.jsxs)("div",{className:"flex flex-col items-center justify-center text-muted-foreground p-6 h-full",children:[(0,i.jsx)("svg",{className:"w-10 h-10 mb-3 text-red-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,i.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"})}),(0,i.jsx)("p",{className:"text-xs",children:w}),(0,i.jsx)("button",{onClick:a=>{a.stopPropagation(),R()},className:"mt-2 px-3 py-1 text-xs bg-secondary text-foreground rounded hover:bg-accent transition-colors",children:s("common.retry")})]}):(0,i.jsxs)("div",{className:"relative overflow-hidden h-full",style:{contain:"strict"},children:[u&&(0,i.jsx)("div",{className:"absolute inset-0 flex items-center justify-center bg-white/80 dark:bg-slate-900/80 z-10",children:(0,i.jsx)("span",{className:"inline-block w-6 h-6 border-2 border-brand border-t-transparent rounded-full animate-spin"})}),D?(0,i.jsx)("iframe",{ref:J,src:D,className:"border-0",allow:"clipboard-write; clipboard-read",style:d?{width:"100%",height:"100%"}:{position:"absolute",top:0,left:0,width:"200%",height:"200%",transform:"scale(0.5)",transformOrigin:"top left"},onLoad:P,onError:Q,title:`Browser: ${T}`,"data-browser-id":b}):(0,i.jsx)("div",{className:"absolute inset-0 flex items-center justify-center",children:(0,i.jsx)("span",{className:"inline-block w-6 h-6 border-2 border-brand border-t-transparent rounded-full animate-spin"})})]}):(0,i.jsxs)("div",{className:"flex flex-col items-center justify-center text-muted-foreground h-full",children:[(0,i.jsx)("svg",{className:"w-10 h-10 mb-2 text-slate-300 dark:text-slate-700",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,i.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"M21 12a9 9 0 01-9 9m9-9a9 9 0 00-9-9m9 9H3m9 9a9 9 0 01-9-9m9 9c1.657 0 3-4.03 3-9s-1.343-9-3-9m0 18c-1.657 0-3-4.03-3-9s1.343-9 3-9m-9 9a9 9 0 019-9"})}),(0,i.jsx)("p",{className:"text-xs",children:s("browser.blankPage")})]})}),!d&&a&&(0,i.jsxs)("div",{className:"border-t border-border px-4 py-2 flex items-center gap-2 text-xs text-muted-foreground",children:[(0,i.jsx)("span",{className:`inline-block w-2 h-2 rounded-full flex-shrink-0 ${F?"bg-yellow-500":u?"bg-brand animate-pulse":w?"bg-red-500":"bg-green-500"}`}),(0,i.jsx)("span",{className:"truncate",children:F?s("browser.sleeping"):u?s("browser.loadingPage"):w?s("browser.loadFailed"):T}),(0,i.jsx)("span",{className:"flex-1"}),n&&(0,i.jsx)("span",{className:"text-[11px] flex-shrink-0",children:function(a){if(!a)return"";let b=new Date(a);if(isNaN(b.getTime()))return"";let c=String(b.getMonth()+1).padStart(2,"0"),d=String(b.getDate()).padStart(2,"0"),e=String(b.getHours()).padStart(2,"0"),f=String(b.getMinutes()).padStart(2,"0");return`${c}-${d} ${e}:${f}`}(n)})]})]})})}ag({type:"browser",idPrefix:"browser",match(a){let b=a.trim().toLowerCase();return b.startsWith("http://")||b.startsWith("https://")},parse:a=>({url:a.trim()}),fromHistory:a=>({url:a.url}),toHistory:a=>({url:a.url}),Component:function({item:a,selected:b,maximized:c,expandedHeight:d,bubbleContentHeight:e,timestamp:f,onSelect:g,onClose:h,onToggleMaximize:j,onTitleMouseDown:k,extra:l}){return(0,i.jsx)(al,{id:a.id,url:a.url,selected:b,maximized:c,expandedHeight:d,bubbleContentHeight:e,timestamp:f,onSelect:g,onClose:h,onToggleMaximize:j,onTitleMouseDown:k,onNewTab:l?.addBrowserItem,initialSleeping:l?.initialSleeping,onSleep:l?.onSleep,onWake:l?.onWake})}});var am=c(74429);let an=[{value:"=",label:"="},{value:"!=",label:"≠"},{value:">",label:">"},{value:"<",label:"<"},{value:">=",label:"≥"},{value:"<=",label:"≤"},{value:"LIKE",label:"LIKE"},{value:"NOT LIKE",label:"NOT LIKE"},{value:"IN",label:"IN"},{value:"IS NULL",label:"IS NULL"},{value:"IS NOT NULL",label:"IS NOT NULL"}];function ao(a){if(!a)return"";let b=new Date(a);if(isNaN(b.getTime()))return"";let c=String(b.getMonth()+1).padStart(2,"0"),d=String(b.getDate()).padStart(2,"0"),e=String(b.getHours()).padStart(2,"0"),f=String(b.getMinutes()).padStart(2,"0");return`${c}-${d} ${e}:${f}`}function ap(a){return`"${a.replace(/"/g,'""')}"`}function aq(a){return null==a?"":"object"==typeof a?JSON.stringify(a):String(a)}function ar({text:a}){let[b,c]=(0,j.useState)(!1),[d,e]=(0,j.useState)({x:0,y:0,maxW:600,maxH:300,above:!0}),f=(0,j.useRef)(null),g=(0,j.useRef)(null),h=(0,j.useRef)(!1),k=(0,j.useCallback)(()=>{g.current&&clearTimeout(g.current),g.current=setTimeout(()=>{h.current||c(!1)},80)},[]),l=(0,j.useCallback)(()=>{g.current&&clearTimeout(g.current),h.current=!1,g.current=setTimeout(()=>{let a=f.current;if(!a||a.scrollWidth<=a.clientWidth)return;let b=a.getBoundingClientRect(),d=window.innerWidth,g=Math.min(600,d-b.left-8),h=g<200?Math.max(8,d-600-8):b.left,i=g<200?Math.min(600,d-16):g,j=window.innerHeight,k=b.top-8,l=j-b.bottom-8,m=k>l&&k>80;e({x:h,y:m?b.top-4:b.bottom+4,maxW:i,maxH:Math.max(60,m?k-4:l-4),above:m}),c(!0)},350)},[]),m=(0,j.useCallback)(()=>{k()},[k]),n=(0,j.useCallback)(()=>{h.current=!0,g.current&&clearTimeout(g.current)},[]),o=(0,j.useCallback)(()=>{h.current=!1,k()},[k]);return(0,i.jsxs)("span",{ref:f,className:"block truncate",onMouseEnter:l,onMouseLeave:m,children:[a,b&&(0,am.createPortal)((0,i.jsx)("div",{className:"fixed z-[9999] overflow-y-auto px-2 py-1.5 text-xs font-mono bg-popover text-popover-foreground border border-border rounded shadow-lg whitespace-pre-wrap break-all select-text cursor-text",style:{left:d.x,top:d.y,maxWidth:d.maxW,maxHeight:d.maxH,transform:d.above?"translateY(-100%)":void 0},onMouseEnter:n,onMouseLeave:o,children:function(a){try{let b=JSON.parse(a);if("object"==typeof b&&null!==b)return JSON.stringify(b,null,2)}catch{}return a}(a)}),document.body)]})}async function as(a,b){let c=await fetch(a,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(b)}),d=await c.json();if(!c.ok)throw Error(d.error||`HTTP ${c.status}`);return d}async function at(a,b){let c=new URLSearchParams(b),d=await fetch(`${a}?${c}`),e=await d.json();if(!d.ok)throw Error(e.error||`HTTP ${d.status}`);return e}function au({id:a,connectionString:b,displayName:c,selected:d,maximized:e,expandedHeight:f,bubbleContentHeight:g,onSelect:h,onClose:l,onToggleMaximize:m,timestamp:n,onTitleMouseDown:o}){let{t:p}=(0,k.Bd)(),{showToast:q}=(0,t.dj)(),[r,s]=(0,j.useState)("connecting"),[u,v]=(0,j.useState)(""),[w,x]=(0,j.useState)([]),[y,A]=(0,j.useState)("public"),[B,C]=(0,j.useState)([]),[D,E]=(0,j.useState)(null),[F,G]=(0,j.useState)("table"),[H,I]=(0,j.useState)("data"),[J,K]=(0,j.useState)([]),[L,M]=(0,j.useState)([]),[N,O]=(0,j.useState)([]),[P,Q]=(0,j.useState)([]),[R,S]=(0,j.useState)(null),[T,U]=(0,j.useState)(0),[V,W]=(0,j.useState)(!1),[X,Y]=(0,j.useState)(0),[Z,$]=(0,j.useState)(new Set),[_,aa]=(0,j.useState)(!1),[ab,ac]=(0,j.useState)(null),[ad,ae]=(0,j.useState)({}),[af,ag]=(0,j.useState)(!1),[ah,ai]=(0,j.useState)({}),[aj,ak]=(0,j.useState)({}),[al,am]=(0,j.useState)(null),[an,au]=(0,j.useState)(""),[aw,az]=(0,j.useState)(null),[aA,aB]=(0,j.useState)(""),[aC,aD]=(0,j.useState)(!1),aE=(0,j.useRef)(null),aF=(0,j.useCallback)(async()=>{s("connecting"),v("");try{let c=await as("/api/db/connect",{id:a,connectionString:b});x(c.schemas||[]),c.schemas?.length>0&&!c.schemas.includes("public")&&A(c.schemas[0]),s("connected")}catch(a){v(a instanceof Error?a.message:String(a)),s("error")}},[a,b]),aG=(0,j.useCallback)(async()=>{if("connected"===r)try{let c=await at("/api/db/schemas",{id:a,connectionString:b,schema:y});C(c.tables||[])}catch{}},[a,b,y,r]),aH=(0,j.useCallback)(async c=>{E(c),U(0),ac(null),ag(!1),$(new Set),aa(!1),ak({}),am(null);try{let d=await at("/api/db/columns",{id:a,connectionString:b,schema:y,table:c});K(d.columns||[]),M(d.primaryKeys||[]),O(d.foreignKeys||[]),Q(d.indexes||[])}catch{}aI(c,0,{},null)},[a,b,y]),aI=(0,j.useCallback)(async(c,d,e,f)=>{W(!0);let g=e??aj,h=void 0!==f?f:al;try{let e=`${ap(y)}.${ap(c)}`,{where:f,params:i}=function(a){let b=[],c=[],d=1;for(let[e,f]of Object.entries(a)){if(!f.enabled)continue;let a=ap(e);if("IS NULL"===f.op)b.push(`${a} IS NULL`);else if("IS NOT NULL"===f.op)b.push(`${a} IS NOT NULL`);else if("IN"===f.op){let e=f.value.split(",").map(a=>a.trim()).filter(Boolean);if(0===e.length)continue;let g=e.map(a=>(c.push(a),`$${d++}`));b.push(`${a}::text IN (${g.join(", ")})`)}else"LIKE"===f.op||f.op,b.push(`${a}::text ${f.op} $${d++}`),c.push(f.value)}return{where:b.length>0?` WHERE ${b.join(" AND ")}`:"",params:c}}(g),j=h?` ORDER BY ${ap(h.column)} ${h.dir}`:"",k=`SELECT * FROM ${e}${f}${j} LIMIT 50 OFFSET ${50*d}`,l=await as("/api/db/query",{id:a,connectionString:b,sql:k,params:i});S(l);let m=`SELECT count(*)::int AS cnt FROM ${e}${f}`,n=await as("/api/db/query",{id:a,connectionString:b,sql:m,params:i});Y(n.rows?.[0]?.cnt??0)}catch{}W(!1)},[a,b,y,aj,al]),aJ=(0,j.useCallback)(async()=>{if(an.trim()){aD(!0),aB(""),az(null);try{let c=await as("/api/db/query",{id:a,connectionString:b,sql:an});az(c)}catch(a){aB(a instanceof Error?a.message:String(a))}aD(!1)}},[a,b,an]),aK=(0,j.useCallback)(async()=>{if(null===ab||!R||!D)return;let c=R.rows[ab],d=[],e=[],f=1;for(let a of J)void 0!==ad[a.name]&&ad[a.name]!==aq(c[a.name]??"")&&(d.push(`${ap(a.name)} = $${f}`),e.push(""===ad[a.name]&&a.nullable?null:ad[a.name]),f++);if(0===d.length)return void ac(null);let g=L.length>0?L:J.map(a=>a.name),h=[];for(let a of g)null===c[a]||void 0===c[a]?h.push(`${ap(a)} IS NULL`):(h.push(`${ap(a)} = $${f}`),e.push(c[a]),f++);let i=`UPDATE ${ap(y)}.${ap(D)} SET ${d.join(", ")} WHERE ${h.join(" AND ")}`;try{await as("/api/db/query",{id:a,connectionString:b,sql:i,params:e}),ac(null),aI(D,T,aj,al)}catch(a){alert(`Update failed: ${a instanceof Error?a.message:String(a)}`)}},[ab,R,D,J,L,ad,a,b,y,aI,T,aj,al]),aL=(0,j.useCallback)(async()=>{if(!D)return;let c=[],d=[],e=[],f=1;for(let a of J)void 0!==ah[a.name]&&""!==ah[a.name]&&(c.push(ap(a.name)),d.push(ah[a.name]),e.push(`$${f}`),f++);if(0===c.length)return;let g=`INSERT INTO ${ap(y)}.${ap(D)} (${c.join(", ")}) VALUES (${e.join(", ")})`;try{await as("/api/db/query",{id:a,connectionString:b,sql:g,params:d}),ag(!1),ai({}),aI(D,T,aj,al)}catch(a){alert(`Insert failed: ${a instanceof Error?a.message:String(a)}`)}},[D,J,ah,a,b,y,aI,T,aj,al]),aM=(0,j.useCallback)(async()=>{if(0===Z.size||!R||!D)return;let c=L.length>0?L:J.map(a=>a.name),d=0;for(let e of Array.from(Z).sort((a,b)=>b-a)){let f=R.rows[e];if(!f)continue;let g=[],h=[],i=1;for(let a of c)null===f[a]||void 0===f[a]?g.push(`${ap(a)} IS NULL`):(g.push(`${ap(a)} = $${i}`),h.push(f[a]),i++);let j=`DELETE FROM ${ap(y)}.${ap(D)} WHERE ctid = (SELECT ctid FROM ${ap(y)}.${ap(D)} WHERE ${g.join(" AND ")} LIMIT 1)`;try{await as("/api/db/query",{id:a,connectionString:b,sql:j,params:h})}catch{d++}}$(new Set),aa(!1),aI(D,T,aj,al),d>0&&alert(p("database.deleteRowsFailed",{count:d}))},[Z,R,D,L,J,a,b,y,aI,T,aj,al]),aN=(0,j.useCallback)(async c=>{if(!D)return;if(Z.size>0&&R){let a,b=R.fields.map(a=>a.name),d=Array.from(Z).sort((a,b)=>a-b).map(a=>R.rows[a]).filter(Boolean);if("json"===c)a=JSON.stringify(d,null,2);else{let c=[b.join(",")];for(let a of d)c.push(b.map(b=>{let c=a[b];if(null==c)return"";let d="object"==typeof c?JSON.stringify(c):String(c);return d.includes(",")||d.includes('"')||d.includes("\n")?`"${d.replace(/"/g,'""')}"`:d}).join(","));a=c.join("\n")}navigator.clipboard.writeText(a);return}let d=`SELECT * FROM ${ap(y)}.${ap(D)}`;try{let e=await fetch("/api/db/export",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:a,connectionString:b,sql:d,format:c})});if(!e.ok)throw Error("Export failed");let f=await e.blob(),g=URL.createObjectURL(f),h=document.createElement("a");h.href=g,h.download=`${D}.${c}`,h.click(),URL.revokeObjectURL(g)}catch(a){alert(`Export failed: ${a instanceof Error?a.message:String(a)}`)}},[D,a,b,y,Z,R]),aO=(0,j.useCallback)(a=>{(a.metaKey||a.ctrlKey)&&"Enter"===a.key&&(a.preventDefault(),aJ())},[aJ]),aP=Math.max(1,Math.ceil(X/50)),aQ=(0,j.useCallback)(a=>{D&&(U(a),aI(D,a,aj,al))},[D,aI,aj,al]),aR=(0,j.useCallback)((a,b)=>{let c={...aj};b?c[a]=b:delete c[a],ak(c),U(0),$(new Set),D&&aI(D,0,c,al)},[aj,al,D,aI]),aS=(0,j.useCallback)(()=>{ak({}),U(0),$(new Set),D&&aI(D,0,{},al)},[al,D,aI]),aT=(0,j.useCallback)(a=>{am(a),U(0),$(new Set),D&&aI(D,0,aj,a)},[aj,D,aI]);return(0,i.jsx)("div",{className:"flex flex-col items-start",children:(0,i.jsxs)("div",{className:`w-full bg-accent text-foreground
8
+ relative transition-colors cursor-pointer
9
+ ${e?"rounded-none overflow-visible border-0":"border overflow-hidden rounded-2xl rounded-bl-md rounded-br-md"}
10
+ ${e?"":d?"border-brand":"border-brand/30"}`,onClick:e?void 0:h,children:[(0,i.jsxs)("div",{"data-drag-handle":!0,onDoubleClick:m,onMouseDown:o,className:`flex items-center gap-2 px-4 py-1.5 border-b border-border ${e?"bg-card":"bg-card/50"}`,style:e?{height:41}:void 0,children:[(0,i.jsx)("span",{className:"text-sm flex-shrink-0",children:"\uD83D\uDC18"}),(0,i.jsx)("span",{className:"text-xs text-foreground truncate font-mono font-medium",children:c}),"connecting"===r&&(0,i.jsx)("span",{className:"inline-block w-3 h-3 border border-brand border-t-transparent rounded-full animate-spin flex-shrink-0"}),"error"===r&&(0,i.jsx)("span",{className:"text-[10px] text-destructive flex-shrink-0",children:p("database.connectionFailed")}),"connected"===r&&(0,i.jsx)("span",{className:"text-[10px] text-emerald-500 flex-shrink-0",children:p("database.connected")}),(0,i.jsx)("span",{className:"flex-1"}),n&&(0,i.jsx)("span",{className:"text-[10px] text-muted-foreground flex-shrink-0",children:ao(n)}),(0,i.jsx)("button",{onClick:a=>{a.stopPropagation(),m()},className:"p-0.5 rounded text-muted-foreground hover:text-foreground transition-colors flex-shrink-0",title:e?p("browser.exitMaximize",{modKey:(0,z.Mu)()}):p("browser.maximize",{modKey:(0,z.Mu)()}),children:e?(0,i.jsx)("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,i.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 3v3a2 2 0 01-2 2H3m18 0h-3a2 2 0 01-2-2V3m0 18v-3a2 2 0 012-2h3M3 16h3a2 2 0 012 2v3"})}):(0,i.jsx)("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,i.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 8V4m0 0h4M4 4l5 5m11-1V4m0 0h-4m4 0l-5 5M4 16v4m0 0h4m-4 0l5-5m11 5l-5-5m5 5v-4m0 4h-4"})})}),(0,i.jsx)("button",{onClick:a=>{a.stopPropagation(),l()},className:"p-0.5 rounded text-muted-foreground hover:text-foreground transition-colors flex-shrink-0",title:p("common.close"),children:(0,i.jsx)("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,i.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),(0,i.jsxs)("div",{style:{height:e&&f?f-41:g??360},className:"flex overflow-hidden",children:["connecting"===r&&(0,i.jsxs)("div",{className:"flex-1 flex items-center justify-center text-sm text-muted-foreground",children:[(0,i.jsx)("span",{className:"inline-block w-4 h-4 border-2 border-brand border-t-transparent rounded-full animate-spin mr-2"}),p("database.connecting")]}),"error"===r&&(0,i.jsxs)("div",{className:"flex-1 flex flex-col items-center justify-center gap-3 p-4",children:[(0,i.jsx)("span",{className:"text-sm text-destructive text-center break-all",children:u}),(0,i.jsx)("button",{onClick:aF,className:"px-3 py-1.5 text-xs bg-brand text-white rounded-md hover:bg-brand/90 transition-colors",children:p("common.retry")})]}),"connected"===r&&(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)("div",{className:"w-52 flex-shrink-0 border-r border-border flex flex-col overflow-hidden",children:[(0,i.jsxs)("div",{className:"p-1.5 border-b border-border flex items-center gap-1",children:[w.length>1?(0,i.jsx)("select",{value:y,onChange:a=>{A(a.target.value),E(null)},className:"flex-1 min-w-0 text-xs bg-background border border-input rounded px-1.5 py-1",children:w.map(a=>(0,i.jsx)("option",{value:a,children:a},a))}):(0,i.jsx)("span",{className:"flex-1 min-w-0 text-xs text-muted-foreground truncate",children:y}),(0,i.jsx)("button",{onClick:aG,className:"flex-shrink-0 w-5 h-5 flex items-center justify-center rounded text-muted-foreground hover:text-foreground hover:bg-accent active:bg-accent/50 transition-colors",title:p("database.refreshTableList"),children:(0,i.jsxs)("svg",{width:"12",height:"12",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,i.jsx)("path",{d:"M1 1v5h5"}),(0,i.jsx)("path",{d:"M15 15v-5h-5"}),(0,i.jsx)("path",{d:"M13.5 6A6 6 0 0 0 3.2 3.2L1 6"}),(0,i.jsx)("path",{d:"M2.5 10a6 6 0 0 0 10.3 2.8L15 10"})]})})]}),(0,i.jsx)("div",{className:"flex items-center border-b border-border",children:["table","view"].map(a=>(0,i.jsx)("button",{onClick:()=>G(a),className:`flex-1 py-1 text-[10px] font-medium transition-colors ${F===a?"text-brand border-b border-brand":"text-muted-foreground hover:text-foreground"}`,children:{table:p("database.filterTable"),view:p("database.filterView")}[a]},a))}),(0,i.jsxs)("div",{className:"flex-1 overflow-y-auto text-xs",children:[B.filter(a=>"table"===F?"view"!==a.type:"view"===a.type).map(a=>(0,i.jsxs)("div",{onClick:()=>aH(a.name),className:`flex items-center gap-1.5 px-2 py-1 cursor-pointer truncate transition-colors ${D===a.name?"bg-brand/10 text-brand":"hover:bg-accent text-foreground"}`,children:[(0,i.jsx)("span",{className:"flex-shrink-0 text-[10px] text-muted-foreground",children:"view"===a.type?"V":"T"}),(0,i.jsx)("span",{className:"truncate min-w-0 flex-1",children:(0,i.jsx)(ar,{text:a.name})}),(0,i.jsx)("span",{className:"ml-auto text-[10px] text-muted-foreground flex-shrink-0",children:a.rowEstimate>0?`~${a.rowEstimate}`:""})]},a.name)),0===B.length&&(0,i.jsx)("div",{className:"p-2 text-muted-foreground text-center",children:p("database.noTables")})]})]}),(0,i.jsxs)("div",{className:"flex-1 flex flex-col overflow-hidden min-w-0",children:[(0,i.jsxs)("div",{className:"flex items-center gap-0 border-b border-border bg-card/30 flex-shrink-0",children:[["structure","data","sql"].map(a=>(0,i.jsx)("button",{onClick:()=>I(a),className:`px-3 py-1.5 text-xs transition-colors ${H===a?"text-brand border-b-2 border-brand font-medium":"text-muted-foreground hover:text-foreground"}`,children:{structure:p("database.tabStructure"),data:p("database.tabData"),sql:"SQL"}[a]},a)),D&&"data"===H&&(0,i.jsxs)("div",{className:"ml-auto flex items-center gap-1 pr-2",children:[Object.values(aj).some(a=>a.enabled)&&(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)("span",{className:"text-[10px] text-brand",children:p("database.filterActive",{count:Object.values(aj).filter(a=>a.enabled).length})}),(0,i.jsx)("button",{onClick:aS,className:"px-1 py-0.5 text-[10px] text-muted-foreground hover:text-foreground transition-colors",title:p("database.clearAllFilters"),children:"✕"}),(0,i.jsx)("span",{className:"text-border",children:"|"})]}),Z.size>0&&!_&&(0,i.jsx)("button",{onClick:()=>aa(!0),className:"px-1.5 py-0.5 text-[10px] text-destructive hover:text-destructive/80 bg-destructive/10 rounded transition-colors",children:p("database.deleteNRows",{count:Z.size})}),_&&(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)("span",{className:"text-[10px] text-destructive",children:p("database.confirmDeleteRows")}),(0,i.jsx)("button",{onClick:aM,className:"px-1.5 py-0.5 text-[10px] text-white bg-destructive rounded transition-colors hover:bg-destructive/80",children:p("common.confirm")}),(0,i.jsx)("button",{onClick:()=>aa(!1),className:"px-1.5 py-0.5 text-[10px] text-muted-foreground hover:text-foreground bg-muted rounded transition-colors",children:p("common.cancel")})]}),(0,i.jsx)("button",{onClick:()=>aN("csv"),className:"px-1.5 py-0.5 text-[10px] text-muted-foreground hover:text-foreground bg-muted rounded transition-colors",title:Z.size>0?p("database.copyCsvSelected"):p("database.copyCsvAll"),children:Z.size>0?p("database.copyCSV"):p("database.CSV")}),(0,i.jsx)("button",{onClick:()=>aN("json"),className:"px-1.5 py-0.5 text-[10px] text-muted-foreground hover:text-foreground bg-muted rounded transition-colors",title:Z.size>0?p("database.copyJsonSelected"):p("database.copyJsonAll"),children:Z.size>0?p("database.copyJSON"):p("database.JSON")})]})]}),(0,i.jsx)("div",{className:"flex-1 overflow-auto",children:D||"sql"===H?"structure"===H?(0,i.jsx)(av,{columns:J,primaryKeys:L,foreignKeys:N,indexes:P}):"data"===H?(0,i.jsx)(ax,{result:R,loading:V,columns:J,page:T,totalPages:aP,totalRows:X,onPageChange:aQ,filters:aj,sort:al,onFilterChange:aR,onSortChange:aT,selectedRows:Z,onSelectedRowsChange:a=>{$(a),aa(!1)},editingRowIdx:ab,editValues:ad,onStartEdit:a=>{if(!R)return;let b=R.rows[a],c={};for(let a of J)c[a.name]=null==b[a.name]?"":aq(b[a.name]);ae(c),ac(a)},onEditChange:(a,b)=>ae(c=>({...c,[a]:b})),onSaveEdit:aK,onCancelEdit:()=>ac(null),isAddingRow:af,newRowValues:ah,onStartAdd:()=>{ag(!0),ai({})},onNewRowChange:(a,b)=>ai(c=>({...c,[a]:b})),onSaveNewRow:aL,onCancelAdd:()=>{ag(!1),ai({})},onCellCopy:a=>{navigator.clipboard.writeText(a),q(p("common.copied"))}}):(0,i.jsx)(ay,{sqlInput:an,onSqlChange:au,onExecute:aJ,onKeyDown:aO,result:aw,error:aA,loading:aC,sqlRef:aE,onCellCopy:a=>{navigator.clipboard.writeText(a),q(p("common.copied"))}}):(0,i.jsx)("div",{className:"flex items-center justify-center h-full text-sm text-muted-foreground",children:p("database.selectTable")})})]})]})]}),!e&&(0,i.jsxs)("div",{className:"border-t border-border px-4 py-1.5 flex items-center gap-2 text-xs text-muted-foreground",children:[(0,i.jsx)("span",{className:`inline-block w-2 h-2 rounded-full ${"connected"===r?"bg-green-500":"error"===r?"bg-red-500":"bg-yellow-500 animate-pulse"}`}),(0,i.jsx)("span",{children:{connecting:p("common.connecting"),connected:p("common.connected"),error:p("common.connectionFailed")}[r]}),"connected"===r&&D&&(0,i.jsx)("span",{className:"text-muted-foreground/70",children:D}),(0,i.jsx)("span",{className:"flex-1"}),n&&(0,i.jsx)("span",{className:"text-[11px] flex-shrink-0",children:ao(n)})]})]})})}function av({columns:a,primaryKeys:b,foreignKeys:c,indexes:d}){let{t:e}=(0,k.Bd)();return 0===a.length?(0,i.jsx)("div",{className:"p-4 text-sm text-muted-foreground",children:e("database.selectTableToView")}):(0,i.jsxs)("div",{className:"p-2 space-y-3",children:[(0,i.jsxs)("div",{children:[(0,i.jsx)("div",{className:"text-[10px] text-muted-foreground uppercase tracking-wide px-1 mb-1",children:e("database.columns")}),(0,i.jsxs)("table",{className:"w-full text-xs",children:[(0,i.jsx)("thead",{children:(0,i.jsxs)("tr",{className:"text-left text-muted-foreground border-b border-border",children:[(0,i.jsx)("th",{className:"px-1.5 py-1 font-medium",children:e("database.colName")}),(0,i.jsx)("th",{className:"px-1.5 py-1 font-medium",children:e("database.colType")}),(0,i.jsx)("th",{className:"px-1.5 py-1 font-medium",children:e("database.colNullable")}),(0,i.jsx)("th",{className:"px-1.5 py-1 font-medium",children:e("database.colDefault")})]})}),(0,i.jsx)("tbody",{children:a.map(a=>(0,i.jsxs)("tr",{className:"border-b border-border/50 hover:bg-accent/50",children:[(0,i.jsxs)("td",{className:"px-1.5 py-1 font-mono",children:[a.isPrimaryKey&&(0,i.jsx)("span",{className:"text-amber-500 mr-1",title:e("database.primaryKey"),children:"\uD83D\uDD11"}),a.name]}),(0,i.jsxs)("td",{className:"px-1.5 py-1 text-muted-foreground font-mono",children:[a.type,a.maxLength?`(${a.maxLength})`:""]}),(0,i.jsx)("td",{className:"px-1.5 py-1 text-muted-foreground",children:a.nullable?"YES":"NO"}),(0,i.jsx)("td",{className:"px-1.5 py-1 text-muted-foreground font-mono truncate max-w-[120px]",children:a.default||""})]},a.name))})]})]}),c.length>0&&(0,i.jsxs)("div",{children:[(0,i.jsx)("div",{className:"text-[10px] text-muted-foreground uppercase tracking-wide px-1 mb-1",children:e("database.foreignKeys")}),(0,i.jsx)("div",{className:"space-y-0.5",children:c.map((a,b)=>(0,i.jsxs)("div",{className:"text-xs font-mono px-1.5 text-muted-foreground",children:[a.column," → ",a.refSchema,".",a.refTable,".",a.refColumn]},b))})]}),d.length>0&&(0,i.jsxs)("div",{children:[(0,i.jsx)("div",{className:"text-[10px] text-muted-foreground uppercase tracking-wide px-1 mb-1",children:e("database.indexes")}),(0,i.jsx)("div",{className:"space-y-0.5",children:d.map(a=>(0,i.jsx)("div",{className:"text-xs font-mono px-1.5 text-muted-foreground truncate",title:a.definition,children:a.name},a.name))})]})]})}function aw({filter:a,onApply:b,onClear:c,onToggle:d,onClose:e,colName:f,anchorRect:g}){let{t:h}=(0,k.Bd)(),[l,m]=(0,j.useState)(a?.op||"="),[n,o]=(0,j.useState)(a?.value||""),p=(0,j.useRef)(null),q="IS NULL"!==l&&"IS NOT NULL"!==l,r=()=>{(!q||n.trim())&&b({op:l,value:n.trim(),enabled:!0})},s=g.left;return s+220>992&&(s=772),s<8&&(s=8),(0,am.createPortal)((0,i.jsxs)("div",{ref:p,className:"fixed z-[9998] w-[220px] bg-popover border border-border rounded-md shadow-lg p-2 space-y-2",style:{left:s,top:g.bottom+2},onClick:a=>a.stopPropagation(),children:[a&&(0,i.jsxs)("div",{className:"flex items-center justify-between",children:[(0,i.jsxs)("label",{className:"flex items-center gap-1.5 text-[10px] text-muted-foreground cursor-pointer",children:[(0,i.jsx)("input",{type:"checkbox",checked:a.enabled,onChange:a=>d(a.target.checked),className:"w-3 h-3 accent-brand"}),h("database.enable")]}),(0,i.jsx)("span",{className:"text-[10px] text-muted-foreground font-mono truncate max-w-[120px]",children:f})]}),(0,i.jsx)("select",{value:l,onChange:a=>m(a.target.value),className:"w-full text-xs bg-background border border-input rounded px-1.5 py-1 focus:outline-none focus:ring-1 focus:ring-ring",children:an.map(a=>(0,i.jsx)("option",{value:a.value,children:a.label},a.value))}),q&&(0,i.jsx)("input",{type:"text",value:n,onChange:a=>o(a.target.value),onKeyDown:a=>{"Enter"===a.key&&(a.preventDefault(),r())},placeholder:h("IN"===l?"database.commaValues":"LIKE"===l?"database.likePattern":"database.valuePlaceholder"),className:"w-full text-xs bg-background border border-input rounded px-1.5 py-1 font-mono focus:outline-none focus:ring-1 focus:ring-ring",autoFocus:!0}),(0,i.jsxs)("div",{className:"flex items-center gap-1",children:[(0,i.jsx)("button",{onClick:r,disabled:q&&!n.trim(),className:"flex-1 px-2 py-1 text-[10px] bg-brand text-white rounded hover:bg-brand/90 disabled:opacity-40 transition-colors",children:h("database.apply")}),a&&(0,i.jsx)("button",{onClick:c,className:"flex-1 px-2 py-1 text-[10px] text-muted-foreground bg-muted rounded hover:text-foreground transition-colors",children:h("database.clearFilter")})]})]}),document.body)}function ax({result:a,loading:b,columns:c,page:d,totalPages:e,totalRows:f,onPageChange:g,filters:h,sort:l,onFilterChange:m,onSortChange:n,selectedRows:o,onSelectedRowsChange:p,editingRowIdx:q,editValues:r,onStartEdit:s,onEditChange:t,onSaveEdit:u,onCancelEdit:v,isAddingRow:w,newRowValues:x,onStartAdd:y,onNewRowChange:z,onSaveNewRow:A,onCancelAdd:B,onCellCopy:C}){let{t:D}=(0,k.Bd)(),[E,F]=(0,j.useState)(null),[G,H]=(0,j.useState)({left:0,bottom:0});if(!a&&!b)return(0,i.jsx)("div",{className:"p-4 text-sm text-muted-foreground",children:D("database.selectTableForData")});let I=a?.fields||[],J=a?.rows||[],K={};for(let a of c)K[a.name]=a.type+(a.maxLength?`(${a.maxLength})`:"");let L=J.length>0&&o.size===J.length,M=o.size>0&&!L;return(0,i.jsxs)("div",{className:"flex flex-col h-full",children:[(0,i.jsxs)("div",{className:"flex-1 overflow-auto relative",children:[b&&(0,i.jsx)("div",{className:"absolute inset-0 bg-background/50 flex items-center justify-center z-10",children:(0,i.jsx)("span",{className:"inline-block w-4 h-4 border-2 border-brand border-t-transparent rounded-full animate-spin"})}),(0,i.jsxs)("table",{className:"w-full text-xs border-collapse",children:[(0,i.jsx)("thead",{className:"sticky top-0 bg-card z-[2]",children:(0,i.jsxs)("tr",{children:[(0,i.jsx)("th",{className:"px-1 py-1 border-b border-border w-8 text-center",children:(0,i.jsx)("input",{type:"checkbox",checked:L,ref:a=>{a&&(a.indeterminate=M)},onChange:()=>{L?p(new Set):p(new Set(J.map((a,b)=>b)))},className:"w-3 h-3 accent-brand cursor-pointer"})}),I.map(a=>{let b=l?.column===a.name?l.dir:null,c=h[a.name],d=c?.enabled;return(0,i.jsxs)("th",{className:"px-1.5 py-1 text-left text-muted-foreground font-medium border-b border-border whitespace-nowrap font-mono relative",children:[(0,i.jsxs)("span",{className:"cursor-pointer select-none hover:text-foreground transition-colors",onClick:()=>{var b;return b=a.name,void(l?.column===b?"ASC"===l.dir?n({column:b,dir:"DESC"}):n(null):n({column:b,dir:"ASC"}))},children:[a.name,K[a.name]&&(0,i.jsx)("span",{className:"ml-1 text-[9px] text-muted-foreground/60 font-normal",children:K[a.name]}),"ASC"===b&&(0,i.jsx)("span",{className:"ml-0.5 text-brand",children:"↑"}),"DESC"===b&&(0,i.jsx)("span",{className:"ml-0.5 text-brand",children:"↓"})]}),(0,i.jsx)("button",{onClick:b=>{if(b.stopPropagation(),E===a.name)return void F(null);let c=b.currentTarget.closest("th").getBoundingClientRect();H({left:c.left,bottom:c.bottom}),F(a.name)},className:`ml-1 inline-flex items-center transition-colors ${d?"text-brand":"text-muted-foreground/40 hover:text-muted-foreground"}`,children:(0,i.jsx)("svg",{className:"w-2.5 h-2.5",viewBox:"0 0 16 16",fill:"currentColor",children:(0,i.jsx)("path",{d:"M1 2h14l-5.5 6.5V14l-3-2v-3.5z"})})}),E===a.name&&(0,i.jsx)(aw,{filter:c||null,onApply:b=>{m(a.name,b),F(null)},onClear:()=>{m(a.name,null),F(null)},onToggle:b=>{c&&m(a.name,{...c,enabled:b})},onClose:()=>F(null),colName:a.name,anchorRect:G})]},a.name)})]})}),(0,i.jsxs)("tbody",{children:[w&&(0,i.jsxs)("tr",{className:"bg-emerald-500/5",children:[(0,i.jsx)("td",{className:"px-1 py-0.5 border-b border-border text-center",children:(0,i.jsxs)("div",{className:"flex gap-0.5 justify-center",children:[(0,i.jsx)("button",{onClick:A,className:"text-[10px] text-emerald-500 hover:text-emerald-400",title:D("common.save"),children:"✓"}),(0,i.jsx)("button",{onClick:B,className:"text-[10px] text-muted-foreground hover:text-foreground",title:D("common.cancel"),children:"✕"})]})}),I.map(a=>(0,i.jsx)("td",{className:"px-0.5 py-0.5 border-b border-border",children:(0,i.jsx)("input",{type:"text",value:x[a.name]??"",onChange:b=>z(a.name,b.target.value),className:"w-full px-1 py-0.5 text-xs bg-background border border-input rounded font-mono min-w-[60px]",placeholder:"NULL"})},a.name))]}),J.map((a,b)=>(0,i.jsxs)("tr",{className:`hover:bg-accent/50 ${o.has(b)?"bg-brand/5":""} ${q===b?"bg-blue-500/5":""}`,children:[(0,i.jsx)("td",{className:"px-1 py-0.5 border-b border-border/50 text-center",children:q===b?(0,i.jsxs)("div",{className:"flex gap-0.5 justify-center",children:[(0,i.jsx)("button",{onClick:u,className:"text-[10px] text-emerald-500 hover:text-emerald-400",title:D("common.save"),children:"✓"}),(0,i.jsx)("button",{onClick:v,className:"text-[10px] text-muted-foreground hover:text-foreground",title:D("common.cancel"),children:"✕"})]}):(0,i.jsx)("input",{type:"checkbox",checked:o.has(b),onChange:()=>{let a;(a=new Set(o)).has(b)?a.delete(b):a.add(b),p(a)},className:"w-3 h-3 accent-brand cursor-pointer"})}),I.map(c=>(0,i.jsx)("td",{className:"px-1.5 py-0.5 border-b border-border/50 font-mono whitespace-nowrap max-w-[200px] truncate",onDoubleClick:()=>{null===q&&s(b)},onContextMenu:b=>{b.preventDefault(),C(aq(a[c.name]))},children:q===b?(0,i.jsx)("input",{type:"text",value:r[c.name]??"",onChange:a=>t(c.name,a.target.value),className:"w-full px-1 py-0.5 text-xs bg-background border border-input rounded font-mono min-w-[60px]"}):null===a[c.name]||void 0===a[c.name]?(0,i.jsx)("span",{className:"text-muted-foreground italic",children:"NULL"}):(0,i.jsx)(ar,{text:aq(a[c.name])})},c.name))]},b))]})]}),0===J.length&&!b&&(0,i.jsx)("div",{className:"p-4 text-xs text-muted-foreground text-center",children:D("common.noData")})]}),(0,i.jsxs)("div",{className:"flex items-center justify-between px-2 py-1 border-t border-border text-[10px] text-muted-foreground bg-card/30 flex-shrink-0",children:[(0,i.jsxs)("div",{className:"flex items-center gap-2",children:[(0,i.jsx)("button",{onClick:y,disabled:w,className:"px-1.5 py-0.5 text-[10px] text-emerald-500 hover:text-emerald-400 disabled:opacity-30",children:D("database.addRow")}),(0,i.jsx)("span",{children:D("database.totalRows",{count:f})}),a?.duration!==void 0&&(0,i.jsxs)("span",{children:[a.duration,"ms"]})]}),(0,i.jsxs)("div",{className:"flex items-center gap-1",children:[(0,i.jsx)("button",{onClick:()=>g(d-1),disabled:0===d,className:"px-1 py-0.5 hover:text-foreground disabled:opacity-30",children:"◀"}),(0,i.jsxs)("span",{children:[d+1," / ",e]}),(0,i.jsx)("button",{onClick:()=>g(d+1),disabled:d>=e-1,className:"px-1 py-0.5 hover:text-foreground disabled:opacity-30",children:"▶"})]})]})]})}function ay({sqlInput:a,onSqlChange:b,onExecute:c,onKeyDown:d,result:e,error:f,loading:g,sqlRef:h,onCellCopy:j}){let{t:l}=(0,k.Bd)();return(0,i.jsxs)("div",{className:"flex flex-col h-full",children:[(0,i.jsxs)("div",{className:"flex-shrink-0 p-2 border-b border-border",children:[(0,i.jsx)("textarea",{ref:h,value:a,onChange:a=>b(a.target.value),onKeyDown:d,placeholder:l("database.sqlPlaceholder",{modKey:(0,z.Mu)()}),className:"w-full h-20 px-2 py-1.5 text-xs font-mono bg-background border border-input rounded resize-y focus:outline-none focus:ring-1 focus:ring-ring",spellCheck:!1}),(0,i.jsxs)("div",{className:"flex items-center gap-2 mt-1",children:[(0,i.jsx)("button",{onClick:c,disabled:g||!a.trim(),className:"px-2 py-1 text-xs bg-brand text-white rounded hover:bg-brand/90 disabled:opacity-50 transition-colors",children:l(g?"database.executing":"database.execute")}),e?.duration!==void 0&&(0,i.jsxs)("span",{className:"text-[10px] text-muted-foreground",children:[e.command&&!e.fields?l("database.rowsAffected",{command:e.command,count:e.rowCount,duration:e.duration}):l("database.queryRows",{count:e.rows?.length??0,duration:e.duration}),e.truncated&&` ${l("database.resultTruncated")}`]})]})]}),f&&(0,i.jsx)("div",{className:"px-3 py-2 text-xs text-destructive bg-destructive/5 border-b border-border break-all",children:f}),e?.fields&&e.rows&&(0,i.jsx)("div",{className:"flex-1 overflow-auto",children:(0,i.jsxs)("table",{className:"w-full text-xs border-collapse",children:[(0,i.jsx)("thead",{className:"sticky top-0 bg-card z-[1]",children:(0,i.jsx)("tr",{children:e.fields.map(a=>(0,i.jsx)("th",{className:"px-1.5 py-1 text-left text-muted-foreground font-medium border-b border-border whitespace-nowrap font-mono",children:a.name},a.name))})}),(0,i.jsx)("tbody",{children:e.rows.map((a,b)=>(0,i.jsx)("tr",{className:"hover:bg-accent/50",children:e.fields.map(b=>(0,i.jsx)("td",{className:"px-1.5 py-0.5 border-b border-border/50 font-mono whitespace-nowrap max-w-[200px] truncate",onContextMenu:c=>{c.preventDefault(),j(aq(a[b.name]))},children:null===a[b.name]||void 0===a[b.name]?(0,i.jsx)("span",{className:"text-muted-foreground italic",children:"NULL"}):(0,i.jsx)(ar,{text:aq(a[b.name])})},b.name))},b))})]})})]})}ag({type:"database",idPrefix:"db",match(a){let b=a.trim().toLowerCase();return b.startsWith("postgresql://")||b.startsWith("postgres://")},parse(a){let b=a.trim(),c=b;try{let a=new URL(b),d=a.pathname.replace(/^\//,"")||"postgres";c=`${d}@${a.hostname}${a.port?":"+a.port:""}`}catch{}return{connectionString:b,displayName:c}},fromHistory:a=>({connectionString:a.connectionString,displayName:a.displayName||a.connectionString}),toHistory:a=>({connectionString:a.connectionString,displayName:a.displayName}),Component:function({item:a,selected:b,maximized:c,expandedHeight:d,bubbleContentHeight:e,timestamp:f,onSelect:g,onClose:h,onToggleMaximize:j,onTitleMouseDown:k}){return(0,i.jsx)(au,{id:a.id,connectionString:a.connectionString,displayName:a.displayName,selected:b,maximized:c,expandedHeight:d,bubbleContentHeight:e,timestamp:f,onSelect:g,onClose:h,onToggleMaximize:j,onTitleMouseDown:k})},async onClose(a){try{await fetch("/api/db/disconnect",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:a.id})})}catch{}}});var az=c(50757),aA=c(27454),aB=c(37752),aC=c(44741),aD=c(3532);let aE=new v;function aF(a){return a?Array.isArray(a)?a.join(""):a:""}function aG(a,b){return a&&a[b]?aF(a[b]):""}aE.use_classes=!0;let aH=(0,j.memo)(function({output:a}){if("stream"===a.output_type){let b=aF(a.text);if(!b)return null;let c=aE.ansi_to_html(b);return(0,i.jsx)("pre",{className:`text-xs leading-relaxed whitespace-pre-wrap break-all px-3 py-1 ${"stderr"===a.name?"text-amber-500":"text-foreground"}`,dangerouslySetInnerHTML:{__html:c}})}if("error"===a.output_type){let b=(a.traceback||[]).join("\n"),c=aE.ansi_to_html(b);return(0,i.jsx)("pre",{className:"text-xs leading-relaxed whitespace-pre-wrap break-all px-3 py-1 text-red-400 bg-red-500/5 rounded",dangerouslySetInnerHTML:{__html:c}})}if("execute_result"===a.output_type||"display_data"===a.output_type||"update_display_data"===a.output_type){let b=a.data;if(!b)return null;let c=aG(b,"image/png"),d=aG(b,"image/jpeg"),e=aG(b,"image/svg+xml"),f=aG(b,"text/html"),g=aG(b,"text/markdown"),h=aG(b,"text/latex"),j=aG(b,"text/plain");if(c)return(0,i.jsx)("div",{className:"px-3 py-1",children:(0,i.jsx)("img",{src:`data:image/png;base64,${c}`,alt:"output",className:"max-w-full"})});if(d)return(0,i.jsx)("div",{className:"px-3 py-1",children:(0,i.jsx)("img",{src:`data:image/jpeg;base64,${d}`,alt:"output",className:"max-w-full"})});if(e)return(0,i.jsx)("div",{className:"px-3 py-1",dangerouslySetInnerHTML:{__html:e}});if(f)return(0,i.jsx)("div",{className:"px-3 py-1 overflow-x-auto notebook-html-output",dangerouslySetInnerHTML:{__html:f}});if(g)return(0,i.jsx)("div",{className:"px-3 py-1",children:(0,i.jsx)(aC.T,{content:g})});if(h)return(0,i.jsx)("div",{className:"px-3 py-1",children:(0,i.jsx)(aC.T,{content:`$$${h}$$`})});if(j)return(0,i.jsx)("pre",{className:"text-xs leading-relaxed whitespace-pre-wrap break-all px-3 py-1 text-foreground",children:j})}return null}),aI=(0,j.memo)(function({cell:a,isActive:b,isEditing:c,onSelect:d,onEdit:e,onStopEdit:f,onSourceChange:g,onRun:h,onDelete:k,onMoveUp:l,onMoveDown:m,onToggleType:n,isFirst:o,isLast:p}){let{resolvedTheme:q}=(0,aD.D)(),r=(0,j.useRef)(null),[s,t]=(0,j.useState)(a.source),u=(0,j.useCallback)(()=>{t(a.source),e()},[a.source,e]);(0,j.useEffect)(()=>{if(c&&r.current){r.current.focus();let a=r.current.value.length;r.current.setSelectionRange(a,a)}},[c]);let v=(0,j.useCallback)(()=>{let a=r.current;a&&(a.style.height="auto",a.style.height=a.scrollHeight+"px")},[]);(0,j.useEffect)(()=>{c&&v()},[c,s,v]);let w=(0,j.useCallback)(a=>{t(a.target.value),v()},[v]),x=(0,j.useCallback)(()=>{s!==a.source&&g(s),f()},[s,a.source,g,f]),y=(0,j.useCallback)(b=>{if("Enter"===b.key&&b.shiftKey)b.preventDefault(),s!==a.source&&g(s),h();else if("Enter"===b.key&&(b.metaKey||b.ctrlKey))b.preventDefault(),s!==a.source&&g(s),h();else if("Escape"===b.key)b.preventDefault(),x();else if("Tab"===b.key){b.preventDefault();let a=r.current;if(a){let b=a.selectionStart,c=a.selectionEnd;t(s.substring(0,b)+" "+s.substring(c)),requestAnimationFrame(()=>{a.selectionStart=a.selectionEnd=b+4})}}},[s,a.source,g,h,x]),z=a.isExecuting?"*":a.execution_count??" ",A="code"===a.cell_type?"Code":"markdown"===a.cell_type?"Md":"Raw";return(0,i.jsxs)("div",{className:`group relative border rounded-lg transition-colors ${b?"border-brand/50 bg-brand/5":"border-border/50 hover:border-border"}`,onClick:d,children:[(0,i.jsxs)("div",{className:`absolute -top-3 right-2 flex items-center gap-0.5 text-[10px] z-10 bg-surface-secondary rounded px-1 py-0.5 border border-border/50 transition-opacity ${b?"opacity-100":"opacity-0 group-hover:opacity-100"}`,children:[(0,i.jsx)("button",{onClick:h,className:"px-1 hover:text-brand",title:"Run (Shift+Enter)",children:a.isExecuting?"⬛":"▶"}),(0,i.jsx)("button",{onClick:n,className:"px-1 hover:text-brand",title:"Toggle type",children:A}),!o&&(0,i.jsx)("button",{onClick:l,className:"px-1 hover:text-brand",title:"Move up",children:"↑"}),!p&&(0,i.jsx)("button",{onClick:m,className:"px-1 hover:text-brand",title:"Move down",children:"↓"}),(0,i.jsx)("button",{onClick:k,className:"px-1 hover:text-red-400",title:"Delete",children:"\xd7"})]}),(0,i.jsxs)("div",{className:"flex",children:[(0,i.jsx)("div",{className:"flex-shrink-0 w-10 text-center py-2 text-[10px] text-muted-foreground select-none cursor-pointer border-r border-border/30",onClick:a=>{a.stopPropagation(),h()},title:"code"===a.cell_type?"Click to run":void 0,children:"code"===a.cell_type?(0,i.jsxs)("span",{className:a.isExecuting?"text-brand animate-pulse":"",children:["[",z,"]"]}):(0,i.jsx)("span",{className:"text-muted-foreground/50",children:A})}),(0,i.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,i.jsx)("div",{className:"cursor-text",onDoubleClick:a=>{a.stopPropagation(),u()},children:c?(0,i.jsx)("textarea",{ref:r,value:s,onChange:w,onBlur:x,onKeyDown:y,className:"w-full bg-transparent text-xs font-mono leading-relaxed px-3 py-2 resize-none outline-none text-foreground",spellCheck:!1,style:{minHeight:"1.5rem"}}):"code"===a.cell_type?(0,i.jsx)("div",{className:"text-xs [&_pre]:!m-0 [&_pre]:!p-2 [&_pre]:!bg-transparent [&_code]:!bg-transparent",children:(0,i.jsx)(az.A,{language:"python",style:"dark"===q?aA.A:aB.A,customStyle:{margin:0,padding:"8px 12px",background:"transparent",fontSize:"12px"},wrapLongLines:!0,children:a.source||" "})}):"markdown"===a.cell_type?a.source.trim()?(0,i.jsx)("div",{className:"px-3 py-2 text-sm prose prose-sm dark:prose-invert max-w-none",children:(0,i.jsx)(aC.T,{content:a.source})}):(0,i.jsx)("div",{className:"px-3 py-2 text-xs text-muted-foreground italic",children:"Empty markdown cell"}):(0,i.jsx)("pre",{className:"text-xs font-mono px-3 py-2 text-muted-foreground whitespace-pre-wrap",children:a.source||" "})}),a.outputs.length>0&&(0,i.jsx)("div",{className:"border-t border-border/30",children:a.outputs.map((a,b)=>(0,i.jsx)(aH,{output:a},b))})]})]})]})});function aJ({id:a,filePath:b,displayName:c,cwd:d,selected:e,maximized:f,expandedHeight:g,bubbleContentHeight:h,timestamp:k,onSelect:l,onClose:m,onToggleMaximize:n,onTitleMouseDown:o}){let{showToast:p}=(0,t.dj)(),[q,r]=(0,j.useState)([]),[s,u]=(0,j.useState)(!0),[v,w]=(0,j.useState)(null),[x,y]=(0,j.useState)(!1),[A,B]=(0,j.useState)(!1),[C,D]=(0,j.useState)(null),[E,F]=(0,j.useState)(null),[G,H]=(0,j.useState)("disconnected"),[I,J]=(0,j.useState)(null),K=(0,j.useRef)(null),L=(0,j.useRef)(new Map),M=(0,j.useRef)(null),N=(0,j.useRef)(q);N.current=q;let O=(0,j.useCallback)(async()=>{u(!0),w(null);try{let a=await fetch("/api/jupyter/load",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({filePath:b,cwd:d})}),c=await a.json();if(!a.ok)throw Error(c.error||"Failed to load notebook");r(c.cells.map((a,b)=>({...a,index:b,isExecuting:!1}))),y(!1)}catch(a){w(a.message)}finally{u(!1)}},[b,d]),P=(0,j.useCallback)(async()=>{if(!A){B(!0);try{let a=await fetch("/api/jupyter/save",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({filePath:b,cwd:d,cells:q.map(a=>({cell_type:a.cell_type,source:a.source,outputs:a.outputs,execution_count:a.execution_count,metadata:a.metadata}))})}),c=await a.json();if(!a.ok)throw Error(c.error||"Failed to save");y(!1),p("Saved","success")}catch(a){p(a.message,"error")}finally{B(!1)}}},[b,d,q,A,p]),Q=(0,j.useCallback)(()=>{if(K.current&&K.current.readyState<=1)return;H("starting"),J(null);let b="https:"===window.location.protocol?"wss:":"ws:",c=new WebSocket(`${b}//${window.location.host}/ws/jupyter?bubbleId=${encodeURIComponent(a)}&cwd=${encodeURIComponent(d)}`);K.current=c,c.onopen=()=>{},c.onmessage=a=>{let b;try{b=JSON.parse(a.data)}catch{return}let c=b.type;if("ready"===c)H("idle"),J(null);else if("status"===c){let a=b.execution_state;"idle"===a?H("idle"):"busy"===a&&H("busy")}else if("output"===c){let a=b.msg_id,c=b.msg_type,d=b.content,e=L.current.get(a);if(void 0===e)return;r(a=>a.map((a,b)=>{if(b!==e)return a;let f={output_type:"execute_result"===c?"execute_result":"display_data"===c?"display_data":"update_display_data"===c?"update_display_data":"stream"===c?"stream":"error"===c?"error":"display_data"};return"stream"===c?(f.name=d.name,f.text=d.text):"error"===c?(f.ename=d.ename,f.evalue=d.evalue,f.traceback=d.traceback):(f.data=d.data,f.metadata=d.metadata,"execute_result"===c&&(f.execution_count=d.execution_count)),{...a,outputs:[...a.outputs,f]}}))}else if("kernel_error"===c)H("error"),J(b.message);else if("kernel_died"===c){for(let[,a]of(H("dead"),J("Kernel died"),L.current))r(b=>b.map((b,c)=>c===a?{...b,isExecuting:!1}:b));L.current.clear()}},c.onclose=()=>{"error"!==G&&"dead"!==G&&H("disconnected")},c.onerror=()=>{H("error")}},[a,d,G]),R=(0,j.useCallback)(a=>{let b=N.current[a];if(!b||"code"!==b.cell_type)return;if(!K.current||K.current.readyState!==WebSocket.OPEN){Q();let b=setInterval(()=>{K.current?.readyState===WebSocket.OPEN&&(clearInterval(b),R(a))},200);setTimeout(()=>clearInterval(b),15e3);return}let c=`cell-${a}-${Date.now()}`;L.current.set(c,a),r(b=>b.map((b,c)=>c===a?{...b,outputs:[],isExecuting:!0,execution_count:null}:b)),K.current.send(JSON.stringify({type:"execute",msg_id:c,code:b.source})),setTimeout(()=>{L.current.has(c)&&(L.current.delete(c),r(b=>b.map((b,c)=>c===a?{...b,isExecuting:!1}:b)))},3e5)},[Q]),S=(0,j.useCallback)(()=>{let a=[...q.map((a,b)=>({cell:a,index:b})).filter(a=>"code"===a.cell.cell_type)],b=()=>{if(0===a.length)return;let{index:c}=a.shift();R(c);let d=setInterval(()=>{let a=N.current[c];a&&!a.isExecuting&&(clearInterval(d),b())},200)};b()},[q,R]),T=(0,j.useCallback)(()=>{K.current?.send(JSON.stringify({type:"interrupt"}))},[]),U=(0,j.useCallback)((a,b)=>{r(c=>c.map((c,d)=>d===a?{...c,source:b}:c)),y(!0)},[]),V=(0,j.useCallback)(a=>{r(b=>b.filter((b,c)=>c!==a)),y(!0),C===a&&D(null)},[C]),W=(0,j.useCallback)((a,b)=>{r(c=>{let d=[...c],e="up"===b?a-1:a+1;return e<0||e>=d.length?c:([d[a],d[e]]=[d[e],d[a]],d)}),y(!0),D("up"===b?a-1:a+1)},[]),X=(0,j.useCallback)(a=>{r(b=>b.map((b,c)=>{if(c!==a)return b;let d="code"===b.cell_type?"markdown":"markdown"===b.cell_type?"raw":"code";return{...b,cell_type:d,outputs:"code"===d?b.outputs:[]}})),y(!0)},[]),Y=(0,j.useCallback)((a,b)=>{let c={index:0,cell_type:a,source:"",outputs:[],execution_count:null,metadata:{},isExecuting:!1};r(a=>{let d=[...a],e=void 0!==b?b+1:d.length;return d.splice(e,0,c),d}),y(!0);let d=void 0!==b?b+1:q.length;D(d),F(d)},[q.length]),Z=(0,j.useMemo)(()=>{switch(G){case"idle":return(0,i.jsx)("span",{className:"w-2 h-2 rounded-full bg-emerald-500 inline-block",title:"Kernel idle"});case"busy":return(0,i.jsx)("span",{className:"w-2 h-2 rounded-full bg-amber-500 animate-pulse inline-block",title:"Kernel busy"});case"starting":return(0,i.jsx)("span",{className:"w-3 h-3 border border-brand border-t-transparent rounded-full animate-spin inline-block",title:"Starting kernel"});case"error":return(0,i.jsx)("span",{className:"w-2 h-2 rounded-full bg-red-500 inline-block",title:I||"Kernel error"});case"dead":return(0,i.jsx)("span",{className:"w-2 h-2 rounded-full bg-red-500 inline-block",title:"Kernel died"});default:return(0,i.jsx)("span",{className:"w-2 h-2 rounded-full bg-gray-500 inline-block",title:"Disconnected"})}},[G,I]);return(0,i.jsxs)("div",{className:`w-full bg-accent text-foreground
11
+ relative transition-colors cursor-pointer
12
+ ${f?"rounded-none overflow-visible border-0":"border overflow-hidden rounded-2xl rounded-bl-md rounded-br-md"}
13
+ ${f?"":e?"border-brand":"border-brand/30"}`,onClick:f?void 0:l,children:[(0,i.jsxs)("div",{"data-drag-handle":!0,onDoubleClick:n,onMouseDown:o,className:`flex items-center gap-2 px-4 py-1.5 border-b border-border ${f?"bg-card":"bg-card/50"}`,style:f?{height:41}:void 0,children:[(0,i.jsx)("span",{className:"text-sm flex-shrink-0",children:"\uD83D\uDCD3"}),(0,i.jsx)("span",{className:"text-xs text-foreground truncate font-mono font-medium",children:c}),Z,x&&(0,i.jsx)("span",{className:"text-[10px] text-amber-500 flex-shrink-0",children:"unsaved"}),(0,i.jsx)("span",{className:"flex-1"}),k&&(0,i.jsx)("span",{className:"text-[10px] text-muted-foreground flex-shrink-0",children:function(a){if(!a)return"";let b=new Date(a);if(isNaN(b.getTime()))return"";let c=String(b.getMonth()+1).padStart(2,"0"),d=String(b.getDate()).padStart(2,"0"),e=String(b.getHours()).padStart(2,"0"),f=String(b.getMinutes()).padStart(2,"0");return`${c}-${d} ${e}:${f}`}(k)}),(0,i.jsx)("button",{onClick:a=>{a.stopPropagation(),n()},className:"p-0.5 rounded text-muted-foreground hover:text-foreground transition-colors flex-shrink-0",title:f?`Exit maximize (${(0,z.Mu)()}+M)`:`Maximize (${(0,z.Mu)()}+M)`,children:f?(0,i.jsx)("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,i.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 3v3a2 2 0 01-2 2H3m18 0h-3a2 2 0 01-2-2V3m0 18v-3a2 2 0 012-2h3M3 16h3a2 2 0 012 2v3"})}):(0,i.jsx)("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,i.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 8V4m0 0h4M4 4l5 5m11-1V4m0 0h-4m4 0l-5 5M4 16v4m0 0h4m-4 0l5-5m11 5l-5-5m5 5v-4m0 4h-4"})})}),(0,i.jsx)("button",{onClick:a=>{a.stopPropagation(),m()},className:"p-0.5 rounded text-muted-foreground hover:text-foreground transition-colors flex-shrink-0",title:"Close",children:(0,i.jsx)("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,i.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),(0,i.jsxs)("div",{className:"flex items-center gap-1 px-3 py-1 border-b border-border/50 bg-surface-secondary/50 text-[11px]",children:[(0,i.jsx)("button",{onClick:a=>{a.stopPropagation(),S()},className:"px-1.5 py-0.5 rounded hover:bg-accent text-muted-foreground hover:text-foreground transition-colors",title:"Run All",children:"▶ All"}),(0,i.jsx)("button",{onClick:a=>{a.stopPropagation(),T()},className:"px-1.5 py-0.5 rounded hover:bg-accent text-muted-foreground hover:text-foreground transition-colors",title:"Interrupt",disabled:"busy"!==G,children:"⬛ Stop"}),(0,i.jsx)("div",{className:"w-px h-3 bg-border/50 mx-1"}),(0,i.jsx)("button",{onClick:a=>{a.stopPropagation(),Y("code",C??q.length-1)},className:"px-1.5 py-0.5 rounded hover:bg-accent text-muted-foreground hover:text-foreground transition-colors",title:"Add code cell",children:"+ Code"}),(0,i.jsx)("button",{onClick:a=>{a.stopPropagation(),Y("markdown",C??q.length-1)},className:"px-1.5 py-0.5 rounded hover:bg-accent text-muted-foreground hover:text-foreground transition-colors",title:"Add markdown cell",children:"+ Md"}),(0,i.jsx)("div",{className:"w-px h-3 bg-border/50 mx-1"}),(0,i.jsx)("button",{onClick:a=>{a.stopPropagation(),P()},className:`px-1.5 py-0.5 rounded hover:bg-accent transition-colors ${x?"text-brand":"text-muted-foreground hover:text-foreground"}`,title:`Save (${(0,z.Mu)()}+S)`,disabled:A,children:A?"Saving...":"Save"}),(0,i.jsx)("span",{className:"flex-1"}),I&&(0,i.jsx)("span",{className:"text-[10px] text-red-400 truncate max-w-[50%]",title:I,children:I}),"dead"===G&&(0,i.jsx)("button",{onClick:a=>{a.stopPropagation(),Q()},className:"px-1.5 py-0.5 rounded text-brand hover:bg-accent transition-colors",children:"Restart"})]}),(0,i.jsx)("div",{ref:M,className:"overflow-y-auto",style:{height:(f&&g?g-41:h??360)-30},children:s?(0,i.jsx)("div",{className:"flex items-center justify-center h-32 text-muted-foreground text-sm",children:"Loading notebook..."}):v?(0,i.jsxs)("div",{className:"flex flex-col items-center justify-center h-32 gap-2",children:[(0,i.jsx)("span",{className:"text-red-400 text-sm",children:v}),(0,i.jsx)("button",{onClick:O,className:"text-xs text-brand hover:underline",children:"Retry"})]}):0===q.length?(0,i.jsxs)("div",{className:"flex flex-col items-center justify-center h-32 gap-2 text-muted-foreground text-sm",children:[(0,i.jsx)("span",{children:"Empty notebook"}),(0,i.jsxs)("div",{className:"flex gap-2",children:[(0,i.jsx)("button",{onClick:()=>Y("code"),className:"text-xs text-brand hover:underline",children:"+ Code cell"}),(0,i.jsx)("button",{onClick:()=>Y("markdown"),className:"text-xs text-brand hover:underline",children:"+ Markdown cell"})]})]}):(0,i.jsxs)("div",{className:"flex flex-col gap-1 p-2",children:[q.map((a,b)=>(0,i.jsx)(aI,{cell:a,isActive:C===b,isEditing:E===b,onSelect:()=>D(b),onEdit:()=>{D(b),F(b)},onStopEdit:()=>F(null),onSourceChange:a=>U(b,a),onRun:()=>{"code"===a.cell_type&&R(b),b<q.length-1&&D(b+1)},onDelete:()=>V(b),onMoveUp:()=>W(b,"up"),onMoveDown:()=>W(b,"down"),onToggleType:()=>X(b),isFirst:0===b,isLast:b===q.length-1},`${b}-${a.cell_type}`)),(0,i.jsxs)("div",{className:"flex justify-center gap-2 py-2 opacity-0 hover:opacity-100 transition-opacity",children:[(0,i.jsx)("button",{onClick:()=>Y("code",q.length-1),className:"text-[10px] text-muted-foreground hover:text-foreground px-2 py-0.5 rounded border border-border/50 hover:border-border transition-colors",children:"+ Code"}),(0,i.jsx)("button",{onClick:()=>Y("markdown",q.length-1),className:"text-[10px] text-muted-foreground hover:text-foreground px-2 py-0.5 rounded border border-border/50 hover:border-border transition-colors",children:"+ Markdown"})]})]})})]})}ag({type:"jupyter",idPrefix:"nb",match:a=>a.trim().endsWith(".ipynb"),parse(a){let b=a.trim(),c=b.split("/"),d=c[c.length-1]||b;return{filePath:b,displayName:d,cwd:""}},fromHistory:a=>({filePath:a.filePath,displayName:a.displayName||"",cwd:a.cwd||""}),toHistory:a=>({filePath:a.filePath,displayName:a.displayName,cwd:a.cwd}),Component:function({item:a,selected:b,maximized:c,expandedHeight:d,bubbleContentHeight:e,timestamp:f,onSelect:g,onClose:h,onToggleMaximize:j,onTitleMouseDown:k}){return(0,i.jsx)(aJ,{id:a.id,filePath:a.filePath,displayName:a.displayName,cwd:a.cwd,selected:b,maximized:c,expandedHeight:d,bubbleContentHeight:e,timestamp:f,onSelect:g,onClose:h,onToggleMaximize:j,onTitleMouseDown:k})},async onClose(a){try{await fetch("/api/jupyter/shutdown",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({bubbleId:a.id})})}catch{}}});let aK=[{value:"=",label:"="},{value:"!=",label:"!="},{value:">",label:">"},{value:"<",label:"<"},{value:">=",label:">="},{value:"<=",label:"<="},{value:"LIKE",label:"LIKE"},{value:"NOT LIKE",label:"NOT LIKE"},{value:"IN",label:"IN"},{value:"IS NULL",label:"IS NULL"},{value:"IS NOT NULL",label:"IS NOT NULL"}];function aL(a){if(!a)return"";let b=new Date(a);if(isNaN(b.getTime()))return"";let c=String(b.getMonth()+1).padStart(2,"0"),d=String(b.getDate()).padStart(2,"0"),e=String(b.getHours()).padStart(2,"0"),f=String(b.getMinutes()).padStart(2,"0");return`${c}-${d} ${e}:${f}`}function aM(a){return`\`${a.replace(/`/g,"``")}\``}function aN(a){try{let b=a.match(/\/\/[^/]+\/([^?]+)/);if(b)return b[1]}catch{}return""}function aO(a){return null==a?"":"object"==typeof a?JSON.stringify(a):String(a)}function aP({text:a}){let[b,c]=(0,j.useState)(!1),[d,e]=(0,j.useState)({x:0,y:0,maxW:600,maxH:300,above:!0}),f=(0,j.useRef)(null),g=(0,j.useRef)(null),h=(0,j.useRef)(!1),k=(0,j.useCallback)(()=>{g.current&&clearTimeout(g.current),g.current=setTimeout(()=>{h.current||c(!1)},80)},[]),l=(0,j.useCallback)(()=>{g.current&&clearTimeout(g.current),h.current=!1,g.current=setTimeout(()=>{let a=f.current;if(!a||a.scrollWidth<=a.clientWidth)return;let b=a.getBoundingClientRect(),d=window.innerWidth,g=Math.min(600,d-b.left-8),h=g<200?Math.max(8,d-600-8):b.left,i=g<200?Math.min(600,d-16):g,j=window.innerHeight,k=b.top-8,l=j-b.bottom-8,m=k>l&&k>80;e({x:h,y:m?b.top-4:b.bottom+4,maxW:i,maxH:Math.max(60,m?k-4:l-4),above:m}),c(!0)},350)},[]),m=(0,j.useCallback)(()=>{k()},[k]),n=(0,j.useCallback)(()=>{h.current=!0,g.current&&clearTimeout(g.current)},[]),o=(0,j.useCallback)(()=>{h.current=!1,k()},[k]);return(0,i.jsxs)("span",{ref:f,className:"block truncate",onMouseEnter:l,onMouseLeave:m,children:[a,b&&(0,am.createPortal)((0,i.jsx)("div",{className:"fixed z-[9999] overflow-y-auto px-2 py-1.5 text-xs font-mono bg-popover text-popover-foreground border border-border rounded shadow-lg whitespace-pre-wrap break-all select-text cursor-text",style:{left:d.x,top:d.y,maxWidth:d.maxW,maxHeight:d.maxH,transform:d.above?"translateY(-100%)":void 0},onMouseEnter:n,onMouseLeave:o,children:function(a){try{let b=JSON.parse(a);if("object"==typeof b&&null!==b)return JSON.stringify(b,null,2)}catch{}return a}(a)}),document.body)]})}async function aQ(a,b){let c=await fetch(a,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(b)}),d=await c.json();if(!c.ok)throw Error(d.error||`HTTP ${c.status}`);return d}async function aR(a,b){let c=new URLSearchParams(b),d=await fetch(`${a}?${c}`),e=await d.json();if(!d.ok)throw Error(e.error||`HTTP ${d.status}`);return e}function aS({id:a,connectionString:b,displayName:c,selected:d,maximized:e,expandedHeight:f,bubbleContentHeight:g,onSelect:h,onClose:l,onToggleMaximize:m,timestamp:n,onTitleMouseDown:o}){let{t:p}=(0,k.Bd)(),{showToast:q}=(0,t.dj)(),[r,s]=(0,j.useState)("connecting"),[u,v]=(0,j.useState)(""),[w,x]=(0,j.useState)([]),[y,A]=(0,j.useState)(()=>aN(b)),[B,C]=(0,j.useState)([]),[D,E]=(0,j.useState)(null),[F,G]=(0,j.useState)("table"),[H,I]=(0,j.useState)("data"),[J,K]=(0,j.useState)([]),[L,M]=(0,j.useState)([]),[N,O]=(0,j.useState)([]),[P,Q]=(0,j.useState)([]),[R,S]=(0,j.useState)(null),[T,U]=(0,j.useState)(0),[V,W]=(0,j.useState)(!1),[X,Y]=(0,j.useState)(0),[Z,$]=(0,j.useState)(new Set),[_,aa]=(0,j.useState)(!1),[ab,ac]=(0,j.useState)(null),[ad,ae]=(0,j.useState)({}),[af,ag]=(0,j.useState)(!1),[ah,ai]=(0,j.useState)({}),[aj,ak]=(0,j.useState)({}),[al,am]=(0,j.useState)(null),[an,ao]=(0,j.useState)(""),[ap,aq]=(0,j.useState)(null),[ar,as]=(0,j.useState)(""),[at,au]=(0,j.useState)(!1),av=(0,j.useRef)(null),aw=(0,j.useCallback)(async()=>{s("connecting"),v("");try{let c=await aQ("/api/mysql/connect",{id:a,connectionString:b});x(c.schemas||[]);let d=aN(b);c.schemas?.length>0&&d&&c.schemas.includes(d)?A(d):c.schemas?.length>0&&A(c.schemas[0]),s("connected")}catch(a){v(a instanceof Error?a.message:String(a)),s("error")}},[a,b]),ax=(0,j.useCallback)(async()=>{if("connected"===r)try{let c=await aR("/api/mysql/schemas",{id:a,connectionString:b,schema:y});C(c.tables||[])}catch{}},[a,b,y,r]),ay=(0,j.useCallback)(async c=>{E(c),U(0),ac(null),ag(!1),$(new Set),aa(!1),ak({}),am(null);try{let d=await aR("/api/mysql/columns",{id:a,connectionString:b,schema:y,table:c});K(d.columns||[]),M(d.primaryKeys||[]),O(d.foreignKeys||[]),Q(d.indexes||[])}catch{}az(c,0,{},null)},[a,b,y]),az=(0,j.useCallback)(async(c,d,e,f)=>{W(!0);let g=e??aj,h=void 0!==f?f:al;try{let e=`${aM(y)}.${aM(c)}`,{where:f,params:i}=function(a){let b=[],c=[];for(let[d,e]of Object.entries(a)){if(!e.enabled)continue;let a=aM(d);if("IS NULL"===e.op)b.push(`${a} IS NULL`);else if("IS NOT NULL"===e.op)b.push(`${a} IS NOT NULL`);else if("IN"===e.op){let d=e.value.split(",").map(a=>a.trim()).filter(Boolean);if(0===d.length)continue;let f=d.map(a=>(c.push(a),"?"));b.push(`${a} IN (${f.join(", ")})`)}else"LIKE"===e.op||e.op,b.push(`${a} ${e.op} ?`),c.push(e.value)}return{where:b.length>0?` WHERE ${b.join(" AND ")}`:"",params:c}}(g),j=h?` ORDER BY ${aM(h.column)} ${h.dir}`:"",k=`SELECT * FROM ${e}${f}${j} LIMIT 50 OFFSET ${50*d}`,l=await aQ("/api/mysql/query",{id:a,connectionString:b,sql:k,params:i});S(l);let m=`SELECT count(*) AS cnt FROM ${e}${f}`,n=await aQ("/api/mysql/query",{id:a,connectionString:b,sql:m,params:i});Y(n.rows?.[0]?.cnt??0)}catch{}W(!1)},[a,b,y,aj,al]),aA=(0,j.useCallback)(async()=>{if(an.trim()){au(!0),as(""),aq(null);try{let c=await aQ("/api/mysql/query",{id:a,connectionString:b,sql:an});aq(c)}catch(a){as(a instanceof Error?a.message:String(a))}au(!1)}},[a,b,an]),aB=(0,j.useCallback)(async()=>{if(null===ab||!R||!D)return;let c=R.rows[ab],d=[],e=[];for(let a of J)void 0!==ad[a.name]&&ad[a.name]!==aO(c[a.name]??"")&&(d.push(`${aM(a.name)} = ?`),e.push(""===ad[a.name]&&a.nullable?null:ad[a.name]));if(0===d.length)return void ac(null);let f=L.length>0?L:J.map(a=>a.name),g=[];for(let a of f)null===c[a]||void 0===c[a]?g.push(`${aM(a)} IS NULL`):(g.push(`${aM(a)} = ?`),e.push(c[a]));let h=`UPDATE ${aM(y)}.${aM(D)} SET ${d.join(", ")} WHERE ${g.join(" AND ")}`;try{await aQ("/api/mysql/query",{id:a,connectionString:b,sql:h,params:e}),ac(null),az(D,T,aj,al)}catch(a){alert(`Update failed: ${a instanceof Error?a.message:String(a)}`)}},[ab,R,D,J,L,ad,a,b,y,az,T,aj,al]),aC=(0,j.useCallback)(async()=>{if(!D)return;let c=[],d=[],e=[];for(let a of J)void 0!==ah[a.name]&&""!==ah[a.name]&&(c.push(aM(a.name)),d.push(ah[a.name]),e.push("?"));if(0===c.length)return;let f=`INSERT INTO ${aM(y)}.${aM(D)} (${c.join(", ")}) VALUES (${e.join(", ")})`;try{await aQ("/api/mysql/query",{id:a,connectionString:b,sql:f,params:d}),ag(!1),ai({}),az(D,T,aj,al)}catch(a){alert(`Insert failed: ${a instanceof Error?a.message:String(a)}`)}},[D,J,ah,a,b,y,az,T,aj,al]),aD=(0,j.useCallback)(async()=>{if(0===Z.size||!R||!D)return;let c=L.length>0?L:J.map(a=>a.name),d=0;for(let e of Array.from(Z).sort((a,b)=>b-a)){let f=R.rows[e];if(!f)continue;let g=[],h=[];for(let a of c)null===f[a]||void 0===f[a]?g.push(`${aM(a)} IS NULL`):(g.push(`${aM(a)} = ?`),h.push(f[a]));let i=`DELETE FROM ${aM(y)}.${aM(D)} WHERE ${g.join(" AND ")} LIMIT 1`;try{await aQ("/api/mysql/query",{id:a,connectionString:b,sql:i,params:h})}catch{d++}}$(new Set),aa(!1),az(D,T,aj,al),d>0&&alert(p("mysql.deleteRowsFailed",{count:d}))},[Z,R,D,L,J,a,b,y,az,T,aj,al]),aE=(0,j.useCallback)(async c=>{if(!D)return;if(Z.size>0&&R){let a,b=R.fields.map(a=>a.name),d=Array.from(Z).sort((a,b)=>a-b).map(a=>R.rows[a]).filter(Boolean);if("json"===c)a=JSON.stringify(d,null,2);else{let c=[b.join(",")];for(let a of d)c.push(b.map(b=>{let c=a[b];if(null==c)return"";let d="object"==typeof c?JSON.stringify(c):String(c);return d.includes(",")||d.includes('"')||d.includes("\n")?`"${d.replace(/"/g,'""')}"`:d}).join(","));a=c.join("\n")}navigator.clipboard.writeText(a);return}let d=`SELECT * FROM ${aM(y)}.${aM(D)}`;try{let e=await fetch("/api/mysql/export",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:a,connectionString:b,sql:d,format:c})});if(!e.ok)throw Error("Export failed");let f=await e.blob(),g=URL.createObjectURL(f),h=document.createElement("a");h.href=g,h.download=`${D}.${c}`,h.click(),URL.revokeObjectURL(g)}catch(a){alert(`Export failed: ${a instanceof Error?a.message:String(a)}`)}},[D,a,b,y,Z,R]),aF=(0,j.useCallback)(a=>{(a.metaKey||a.ctrlKey)&&"Enter"===a.key&&(a.preventDefault(),aA())},[aA]),aG=Math.max(1,Math.ceil(X/50)),aH=(0,j.useCallback)(a=>{D&&(U(a),az(D,a,aj,al))},[D,az,aj,al]),aI=(0,j.useCallback)((a,b)=>{let c={...aj};b?c[a]=b:delete c[a],ak(c),U(0),$(new Set),D&&az(D,0,c,al)},[aj,al,D,az]),aJ=(0,j.useCallback)(()=>{ak({}),U(0),$(new Set),D&&az(D,0,{},al)},[al,D,az]),aK=(0,j.useCallback)(a=>{am(a),U(0),$(new Set),D&&az(D,0,aj,a)},[aj,D,az]);return(0,i.jsx)("div",{className:"flex flex-col items-start",children:(0,i.jsxs)("div",{className:`w-full bg-accent text-foreground
14
+ relative transition-colors cursor-pointer
15
+ ${e?"rounded-none overflow-visible border-0":"border overflow-hidden rounded-2xl rounded-bl-md rounded-br-md"}
16
+ ${e?"":d?"border-brand":"border-brand/30"}`,onClick:e?void 0:h,children:[(0,i.jsxs)("div",{"data-drag-handle":!0,onDoubleClick:m,onMouseDown:o,className:`flex items-center gap-2 px-4 py-1.5 border-b border-border ${e?"bg-card":"bg-card/50"}`,style:e?{height:41}:void 0,children:[(0,i.jsx)("span",{className:"text-sm flex-shrink-0",children:"\uD83D\uDC2C"}),(0,i.jsx)("span",{className:"text-xs text-foreground truncate font-mono font-medium",children:c}),"connecting"===r&&(0,i.jsx)("span",{className:"inline-block w-3 h-3 border border-brand border-t-transparent rounded-full animate-spin flex-shrink-0"}),"error"===r&&(0,i.jsx)("span",{className:"text-[10px] text-destructive flex-shrink-0",children:p("mysql.connectionFailed")}),"connected"===r&&(0,i.jsx)("span",{className:"text-[10px] text-emerald-500 flex-shrink-0",children:p("mysql.connected")}),(0,i.jsx)("span",{className:"flex-1"}),n&&(0,i.jsx)("span",{className:"text-[10px] text-muted-foreground flex-shrink-0",children:aL(n)}),(0,i.jsx)("button",{onClick:a=>{a.stopPropagation(),m()},className:"p-0.5 rounded text-muted-foreground hover:text-foreground transition-colors flex-shrink-0",title:e?p("browser.exitMaximize",{modKey:(0,z.Mu)()}):p("browser.maximize",{modKey:(0,z.Mu)()}),children:e?(0,i.jsx)("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,i.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 3v3a2 2 0 01-2 2H3m18 0h-3a2 2 0 01-2-2V3m0 18v-3a2 2 0 012-2h3M3 16h3a2 2 0 012 2v3"})}):(0,i.jsx)("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,i.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 8V4m0 0h4M4 4l5 5m11-1V4m0 0h-4m4 0l-5 5M4 16v4m0 0h4m-4 0l5-5m11 5l-5-5m5 5v-4m0 4h-4"})})}),(0,i.jsx)("button",{onClick:a=>{a.stopPropagation(),l()},className:"p-0.5 rounded text-muted-foreground hover:text-foreground transition-colors flex-shrink-0",title:p("common.close"),children:(0,i.jsx)("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,i.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),(0,i.jsxs)("div",{style:{height:e&&f?f-41:g??360},className:"flex overflow-hidden",children:["connecting"===r&&(0,i.jsxs)("div",{className:"flex-1 flex items-center justify-center text-sm text-muted-foreground",children:[(0,i.jsx)("span",{className:"inline-block w-4 h-4 border-2 border-brand border-t-transparent rounded-full animate-spin mr-2"}),p("mysql.connecting")]}),"error"===r&&(0,i.jsxs)("div",{className:"flex-1 flex flex-col items-center justify-center gap-3 p-4",children:[(0,i.jsx)("span",{className:"text-sm text-destructive text-center break-all",children:u}),(0,i.jsx)("button",{onClick:aw,className:"px-3 py-1.5 text-xs bg-brand text-white rounded-md hover:bg-brand/90 transition-colors",children:p("common.retry")})]}),"connected"===r&&(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)("div",{className:"w-52 flex-shrink-0 border-r border-border flex flex-col overflow-hidden",children:[(0,i.jsxs)("div",{className:"p-1.5 border-b border-border flex items-center gap-1",children:[w.length>1?(0,i.jsx)("select",{value:y,onChange:a=>{A(a.target.value),E(null)},className:"flex-1 min-w-0 text-xs bg-background border border-input rounded px-1.5 py-1",children:w.map(a=>(0,i.jsx)("option",{value:a,children:a},a))}):(0,i.jsx)("span",{className:"flex-1 min-w-0 text-xs text-muted-foreground truncate",children:y}),(0,i.jsx)("button",{onClick:ax,className:"flex-shrink-0 w-5 h-5 flex items-center justify-center rounded text-muted-foreground hover:text-foreground hover:bg-accent active:bg-accent/50 transition-colors",title:p("mysql.refreshTableList"),children:(0,i.jsxs)("svg",{width:"12",height:"12",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,i.jsx)("path",{d:"M1 1v5h5"}),(0,i.jsx)("path",{d:"M15 15v-5h-5"}),(0,i.jsx)("path",{d:"M13.5 6A6 6 0 0 0 3.2 3.2L1 6"}),(0,i.jsx)("path",{d:"M2.5 10a6 6 0 0 0 10.3 2.8L15 10"})]})})]}),(0,i.jsx)("div",{className:"flex items-center border-b border-border",children:["table","view"].map(a=>(0,i.jsx)("button",{onClick:()=>G(a),className:`flex-1 py-1 text-[10px] font-medium transition-colors ${F===a?"text-brand border-b border-brand":"text-muted-foreground hover:text-foreground"}`,children:{table:p("mysql.filterTable"),view:p("mysql.filterView")}[a]},a))}),(0,i.jsxs)("div",{className:"flex-1 overflow-y-auto text-xs",children:[B.filter(a=>"table"===F?"view"!==a.type:"view"===a.type).map(a=>(0,i.jsxs)("div",{onClick:()=>ay(a.name),className:`flex items-center gap-1.5 px-2 py-1 cursor-pointer truncate transition-colors ${D===a.name?"bg-brand/10 text-brand":"hover:bg-accent text-foreground"}`,children:[(0,i.jsx)("span",{className:"flex-shrink-0 text-[10px] text-muted-foreground",children:"view"===a.type?"V":"T"}),(0,i.jsx)("span",{className:"truncate min-w-0 flex-1",children:(0,i.jsx)(aP,{text:a.name})}),(0,i.jsx)("span",{className:"ml-auto text-[10px] text-muted-foreground flex-shrink-0",children:a.rowEstimate>0?`~${a.rowEstimate}`:""})]},a.name)),0===B.length&&(0,i.jsx)("div",{className:"p-2 text-muted-foreground text-center",children:p("mysql.noTables")})]})]}),(0,i.jsxs)("div",{className:"flex-1 flex flex-col overflow-hidden min-w-0",children:[(0,i.jsxs)("div",{className:"flex items-center gap-0 border-b border-border bg-card/30 flex-shrink-0",children:[["structure","data","sql"].map(a=>(0,i.jsx)("button",{onClick:()=>I(a),className:`px-3 py-1.5 text-xs transition-colors ${H===a?"text-brand border-b-2 border-brand font-medium":"text-muted-foreground hover:text-foreground"}`,children:{structure:p("mysql.tabStructure"),data:p("mysql.tabData"),sql:"SQL"}[a]},a)),D&&"data"===H&&(0,i.jsxs)("div",{className:"ml-auto flex items-center gap-1 pr-2",children:[Object.values(aj).some(a=>a.enabled)&&(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)("span",{className:"text-[10px] text-brand",children:p("mysql.filterActive",{count:Object.values(aj).filter(a=>a.enabled).length})}),(0,i.jsx)("button",{onClick:aJ,className:"px-1 py-0.5 text-[10px] text-muted-foreground hover:text-foreground transition-colors",title:p("mysql.clearAllFilters"),children:"✕"}),(0,i.jsx)("span",{className:"text-border",children:"|"})]}),Z.size>0&&!_&&(0,i.jsx)("button",{onClick:()=>aa(!0),className:"px-1.5 py-0.5 text-[10px] text-destructive hover:text-destructive/80 bg-destructive/10 rounded transition-colors",children:p("mysql.deleteNRows",{count:Z.size})}),_&&(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)("span",{className:"text-[10px] text-destructive",children:p("mysql.confirmDeleteRows")}),(0,i.jsx)("button",{onClick:aD,className:"px-1.5 py-0.5 text-[10px] text-white bg-destructive rounded transition-colors hover:bg-destructive/80",children:p("common.confirm")}),(0,i.jsx)("button",{onClick:()=>aa(!1),className:"px-1.5 py-0.5 text-[10px] text-muted-foreground hover:text-foreground bg-muted rounded transition-colors",children:p("common.cancel")})]}),(0,i.jsx)("button",{onClick:()=>aE("csv"),className:"px-1.5 py-0.5 text-[10px] text-muted-foreground hover:text-foreground bg-muted rounded transition-colors",title:Z.size>0?p("mysql.copyCsvSelected"):p("mysql.copyCsvAll"),children:Z.size>0?p("mysql.copyCSV"):p("mysql.CSV")}),(0,i.jsx)("button",{onClick:()=>aE("json"),className:"px-1.5 py-0.5 text-[10px] text-muted-foreground hover:text-foreground bg-muted rounded transition-colors",title:Z.size>0?p("mysql.copyJsonSelected"):p("mysql.copyJsonAll"),children:Z.size>0?p("mysql.copyJSON"):p("mysql.JSON")})]})]}),(0,i.jsx)("div",{className:"flex-1 overflow-auto",children:D||"sql"===H?"structure"===H?(0,i.jsx)(aT,{columns:J,primaryKeys:L,foreignKeys:N,indexes:P}):"data"===H?(0,i.jsx)(aV,{result:R,loading:V,columns:J,page:T,totalPages:aG,totalRows:X,onPageChange:aH,filters:aj,sort:al,onFilterChange:aI,onSortChange:aK,selectedRows:Z,onSelectedRowsChange:a=>{$(a),aa(!1)},editingRowIdx:ab,editValues:ad,onStartEdit:a=>{if(!R)return;let b=R.rows[a],c={};for(let a of J)c[a.name]=null==b[a.name]?"":aO(b[a.name]);ae(c),ac(a)},onEditChange:(a,b)=>ae(c=>({...c,[a]:b})),onSaveEdit:aB,onCancelEdit:()=>ac(null),isAddingRow:af,newRowValues:ah,onStartAdd:()=>{ag(!0),ai({})},onNewRowChange:(a,b)=>ai(c=>({...c,[a]:b})),onSaveNewRow:aC,onCancelAdd:()=>{ag(!1),ai({})},onCellCopy:a=>{navigator.clipboard.writeText(a),q(p("common.copied"))}}):(0,i.jsx)(aW,{sqlInput:an,onSqlChange:ao,onExecute:aA,onKeyDown:aF,result:ap,error:ar,loading:at,sqlRef:av,onCellCopy:a=>{navigator.clipboard.writeText(a),q(p("common.copied"))}}):(0,i.jsx)("div",{className:"flex items-center justify-center h-full text-sm text-muted-foreground",children:p("mysql.selectTable")})})]})]})]}),!e&&(0,i.jsxs)("div",{className:"border-t border-border px-4 py-1.5 flex items-center gap-2 text-xs text-muted-foreground",children:[(0,i.jsx)("span",{className:`inline-block w-2 h-2 rounded-full ${"connected"===r?"bg-green-500":"error"===r?"bg-red-500":"bg-yellow-500 animate-pulse"}`}),(0,i.jsx)("span",{children:{connecting:p("common.connecting"),connected:p("common.connected"),error:p("common.connectionFailed")}[r]}),"connected"===r&&D&&(0,i.jsx)("span",{className:"text-muted-foreground/70",children:D}),(0,i.jsx)("span",{className:"flex-1"}),n&&(0,i.jsx)("span",{className:"text-[11px] flex-shrink-0",children:aL(n)})]})]})})}function aT({columns:a,primaryKeys:b,foreignKeys:c,indexes:d}){let{t:e}=(0,k.Bd)();return 0===a.length?(0,i.jsx)("div",{className:"p-4 text-sm text-muted-foreground",children:e("mysql.selectTableToView")}):(0,i.jsxs)("div",{className:"p-2 space-y-3",children:[(0,i.jsxs)("div",{children:[(0,i.jsx)("div",{className:"text-[10px] text-muted-foreground uppercase tracking-wide px-1 mb-1",children:e("mysql.columns")}),(0,i.jsxs)("table",{className:"w-full text-xs",children:[(0,i.jsx)("thead",{children:(0,i.jsxs)("tr",{className:"text-left text-muted-foreground border-b border-border",children:[(0,i.jsx)("th",{className:"px-1.5 py-1 font-medium",children:e("mysql.colName")}),(0,i.jsx)("th",{className:"px-1.5 py-1 font-medium",children:e("mysql.colType")}),(0,i.jsx)("th",{className:"px-1.5 py-1 font-medium",children:e("mysql.colNullable")}),(0,i.jsx)("th",{className:"px-1.5 py-1 font-medium",children:e("mysql.colDefault")})]})}),(0,i.jsx)("tbody",{children:a.map(a=>(0,i.jsxs)("tr",{className:"border-b border-border/50 hover:bg-accent/50",children:[(0,i.jsxs)("td",{className:"px-1.5 py-1 font-mono",children:[a.isPrimaryKey&&(0,i.jsx)("span",{className:"text-amber-500 mr-1",title:e("mysql.primaryKey"),children:"\uD83D\uDD11"}),a.name]}),(0,i.jsxs)("td",{className:"px-1.5 py-1 text-muted-foreground font-mono",children:[a.type,a.maxLength?`(${a.maxLength})`:""]}),(0,i.jsx)("td",{className:"px-1.5 py-1 text-muted-foreground",children:a.nullable?"YES":"NO"}),(0,i.jsx)("td",{className:"px-1.5 py-1 text-muted-foreground font-mono truncate max-w-[120px]",children:a.default||""})]},a.name))})]})]}),c.length>0&&(0,i.jsxs)("div",{children:[(0,i.jsx)("div",{className:"text-[10px] text-muted-foreground uppercase tracking-wide px-1 mb-1",children:e("mysql.foreignKeys")}),(0,i.jsx)("div",{className:"space-y-0.5",children:c.map((a,b)=>(0,i.jsxs)("div",{className:"text-xs font-mono px-1.5 text-muted-foreground",children:[a.column," → ",a.refSchema,".",a.refTable,".",a.refColumn]},b))})]}),d.length>0&&(0,i.jsxs)("div",{children:[(0,i.jsx)("div",{className:"text-[10px] text-muted-foreground uppercase tracking-wide px-1 mb-1",children:e("mysql.indexes")}),(0,i.jsx)("div",{className:"space-y-0.5",children:d.map(a=>(0,i.jsx)("div",{className:"text-xs font-mono px-1.5 text-muted-foreground truncate",title:a.definition,children:a.name},a.name))})]})]})}function aU({filter:a,onApply:b,onClear:c,onToggle:d,onClose:e,colName:f,anchorRect:g}){let{t:h}=(0,k.Bd)(),[l,m]=(0,j.useState)(a?.op||"="),[n,o]=(0,j.useState)(a?.value||""),p=(0,j.useRef)(null),q="IS NULL"!==l&&"IS NOT NULL"!==l,r=()=>{(!q||n.trim())&&b({op:l,value:n.trim(),enabled:!0})},s=g.left;return s+220>992&&(s=772),s<8&&(s=8),(0,am.createPortal)((0,i.jsxs)("div",{ref:p,className:"fixed z-[9998] w-[220px] bg-popover border border-border rounded-md shadow-lg p-2 space-y-2",style:{left:s,top:g.bottom+2},onClick:a=>a.stopPropagation(),children:[a&&(0,i.jsxs)("div",{className:"flex items-center justify-between",children:[(0,i.jsxs)("label",{className:"flex items-center gap-1.5 text-[10px] text-muted-foreground cursor-pointer",children:[(0,i.jsx)("input",{type:"checkbox",checked:a.enabled,onChange:a=>d(a.target.checked),className:"w-3 h-3 accent-brand"}),h("mysql.enable")]}),(0,i.jsx)("span",{className:"text-[10px] text-muted-foreground font-mono truncate max-w-[120px]",children:f})]}),(0,i.jsx)("select",{value:l,onChange:a=>m(a.target.value),className:"w-full text-xs bg-background border border-input rounded px-1.5 py-1 focus:outline-none focus:ring-1 focus:ring-ring",children:aK.map(a=>(0,i.jsx)("option",{value:a.value,children:a.label},a.value))}),q&&(0,i.jsx)("input",{type:"text",value:n,onChange:a=>o(a.target.value),onKeyDown:a=>{"Enter"===a.key&&(a.preventDefault(),r())},placeholder:h("IN"===l?"mysql.commaValues":"LIKE"===l?"mysql.likePattern":"mysql.valuePlaceholder"),className:"w-full text-xs bg-background border border-input rounded px-1.5 py-1 font-mono focus:outline-none focus:ring-1 focus:ring-ring",autoFocus:!0}),(0,i.jsxs)("div",{className:"flex items-center gap-1",children:[(0,i.jsx)("button",{onClick:r,disabled:q&&!n.trim(),className:"flex-1 px-2 py-1 text-[10px] bg-brand text-white rounded hover:bg-brand/90 disabled:opacity-40 transition-colors",children:h("mysql.apply")}),a&&(0,i.jsx)("button",{onClick:c,className:"flex-1 px-2 py-1 text-[10px] text-muted-foreground bg-muted rounded hover:text-foreground transition-colors",children:h("mysql.clearFilter")})]})]}),document.body)}function aV({result:a,loading:b,columns:c,page:d,totalPages:e,totalRows:f,onPageChange:g,filters:h,sort:l,onFilterChange:m,onSortChange:n,selectedRows:o,onSelectedRowsChange:p,editingRowIdx:q,editValues:r,onStartEdit:s,onEditChange:t,onSaveEdit:u,onCancelEdit:v,isAddingRow:w,newRowValues:x,onStartAdd:y,onNewRowChange:z,onSaveNewRow:A,onCancelAdd:B,onCellCopy:C}){let{t:D}=(0,k.Bd)(),[E,F]=(0,j.useState)(null),[G,H]=(0,j.useState)({left:0,bottom:0});if(!a&&!b)return(0,i.jsx)("div",{className:"p-4 text-sm text-muted-foreground",children:D("mysql.selectTableForData")});let I=a?.fields||[],J=a?.rows||[],K={};for(let a of c)K[a.name]=a.type+(a.maxLength?`(${a.maxLength})`:"");let L=J.length>0&&o.size===J.length,M=o.size>0&&!L;return(0,i.jsxs)("div",{className:"flex flex-col h-full",children:[(0,i.jsxs)("div",{className:"flex-1 overflow-auto relative",children:[b&&(0,i.jsx)("div",{className:"absolute inset-0 bg-background/50 flex items-center justify-center z-10",children:(0,i.jsx)("span",{className:"inline-block w-4 h-4 border-2 border-brand border-t-transparent rounded-full animate-spin"})}),(0,i.jsxs)("table",{className:"w-full text-xs border-collapse",children:[(0,i.jsx)("thead",{className:"sticky top-0 bg-card z-[2]",children:(0,i.jsxs)("tr",{children:[(0,i.jsx)("th",{className:"px-1 py-1 border-b border-border w-8 text-center",children:(0,i.jsx)("input",{type:"checkbox",checked:L,ref:a=>{a&&(a.indeterminate=M)},onChange:()=>{L?p(new Set):p(new Set(J.map((a,b)=>b)))},className:"w-3 h-3 accent-brand cursor-pointer"})}),I.map(a=>{let b=l?.column===a.name?l.dir:null,c=h[a.name],d=c?.enabled;return(0,i.jsxs)("th",{className:"px-1.5 py-1 text-left text-muted-foreground font-medium border-b border-border whitespace-nowrap font-mono relative",children:[(0,i.jsxs)("span",{className:"cursor-pointer select-none hover:text-foreground transition-colors",onClick:()=>{var b;return b=a.name,void(l?.column===b?"ASC"===l.dir?n({column:b,dir:"DESC"}):n(null):n({column:b,dir:"ASC"}))},children:[a.name,K[a.name]&&(0,i.jsx)("span",{className:"ml-1 text-[9px] text-muted-foreground/60 font-normal",children:K[a.name]}),"ASC"===b&&(0,i.jsx)("span",{className:"ml-0.5 text-brand",children:"↑"}),"DESC"===b&&(0,i.jsx)("span",{className:"ml-0.5 text-brand",children:"↓"})]}),(0,i.jsx)("button",{onClick:b=>{if(b.stopPropagation(),E===a.name)return void F(null);let c=b.currentTarget.closest("th").getBoundingClientRect();H({left:c.left,bottom:c.bottom}),F(a.name)},className:`ml-1 inline-flex items-center transition-colors ${d?"text-brand":"text-muted-foreground/40 hover:text-muted-foreground"}`,children:(0,i.jsx)("svg",{className:"w-2.5 h-2.5",viewBox:"0 0 16 16",fill:"currentColor",children:(0,i.jsx)("path",{d:"M1 2h14l-5.5 6.5V14l-3-2v-3.5z"})})}),E===a.name&&(0,i.jsx)(aU,{filter:c||null,onApply:b=>{m(a.name,b),F(null)},onClear:()=>{m(a.name,null),F(null)},onToggle:b=>{c&&m(a.name,{...c,enabled:b})},onClose:()=>F(null),colName:a.name,anchorRect:G})]},a.name)})]})}),(0,i.jsxs)("tbody",{children:[w&&(0,i.jsxs)("tr",{className:"bg-emerald-500/5",children:[(0,i.jsx)("td",{className:"px-1 py-0.5 border-b border-border text-center",children:(0,i.jsxs)("div",{className:"flex gap-0.5 justify-center",children:[(0,i.jsx)("button",{onClick:A,className:"text-[10px] text-emerald-500 hover:text-emerald-400",title:D("common.save"),children:"✓"}),(0,i.jsx)("button",{onClick:B,className:"text-[10px] text-muted-foreground hover:text-foreground",title:D("common.cancel"),children:"✕"})]})}),I.map(a=>(0,i.jsx)("td",{className:"px-0.5 py-0.5 border-b border-border",children:(0,i.jsx)("input",{type:"text",value:x[a.name]??"",onChange:b=>z(a.name,b.target.value),className:"w-full px-1 py-0.5 text-xs bg-background border border-input rounded font-mono min-w-[60px]",placeholder:"NULL"})},a.name))]}),J.map((a,b)=>(0,i.jsxs)("tr",{className:`hover:bg-accent/50 ${o.has(b)?"bg-brand/5":""} ${q===b?"bg-blue-500/5":""}`,children:[(0,i.jsx)("td",{className:"px-1 py-0.5 border-b border-border/50 text-center",children:q===b?(0,i.jsxs)("div",{className:"flex gap-0.5 justify-center",children:[(0,i.jsx)("button",{onClick:u,className:"text-[10px] text-emerald-500 hover:text-emerald-400",title:D("common.save"),children:"✓"}),(0,i.jsx)("button",{onClick:v,className:"text-[10px] text-muted-foreground hover:text-foreground",title:D("common.cancel"),children:"✕"})]}):(0,i.jsx)("input",{type:"checkbox",checked:o.has(b),onChange:()=>{let a;(a=new Set(o)).has(b)?a.delete(b):a.add(b),p(a)},className:"w-3 h-3 accent-brand cursor-pointer"})}),I.map(c=>(0,i.jsx)("td",{className:"px-1.5 py-0.5 border-b border-border/50 font-mono whitespace-nowrap max-w-[200px] truncate",onDoubleClick:()=>{null===q&&s(b)},onContextMenu:b=>{b.preventDefault(),C(aO(a[c.name]))},children:q===b?(0,i.jsx)("input",{type:"text",value:r[c.name]??"",onChange:a=>t(c.name,a.target.value),className:"w-full px-1 py-0.5 text-xs bg-background border border-input rounded font-mono min-w-[60px]"}):null===a[c.name]||void 0===a[c.name]?(0,i.jsx)("span",{className:"text-muted-foreground italic",children:"NULL"}):(0,i.jsx)(aP,{text:aO(a[c.name])})},c.name))]},b))]})]}),0===J.length&&!b&&(0,i.jsx)("div",{className:"p-4 text-xs text-muted-foreground text-center",children:D("common.noData")})]}),(0,i.jsxs)("div",{className:"flex items-center justify-between px-2 py-1 border-t border-border text-[10px] text-muted-foreground bg-card/30 flex-shrink-0",children:[(0,i.jsxs)("div",{className:"flex items-center gap-2",children:[(0,i.jsx)("button",{onClick:y,disabled:w,className:"px-1.5 py-0.5 text-[10px] text-emerald-500 hover:text-emerald-400 disabled:opacity-30",children:D("mysql.addRow")}),(0,i.jsx)("span",{children:D("mysql.totalRows",{count:f})}),a?.duration!==void 0&&(0,i.jsxs)("span",{children:[a.duration,"ms"]})]}),(0,i.jsxs)("div",{className:"flex items-center gap-1",children:[(0,i.jsx)("button",{onClick:()=>g(d-1),disabled:0===d,className:"px-1 py-0.5 hover:text-foreground disabled:opacity-30",children:"◀"}),(0,i.jsxs)("span",{children:[d+1," / ",e]}),(0,i.jsx)("button",{onClick:()=>g(d+1),disabled:d>=e-1,className:"px-1 py-0.5 hover:text-foreground disabled:opacity-30",children:"▶"})]})]})]})}function aW({sqlInput:a,onSqlChange:b,onExecute:c,onKeyDown:d,result:e,error:f,loading:g,sqlRef:h,onCellCopy:j}){let{t:l}=(0,k.Bd)();return(0,i.jsxs)("div",{className:"flex flex-col h-full",children:[(0,i.jsxs)("div",{className:"flex-shrink-0 p-2 border-b border-border",children:[(0,i.jsx)("textarea",{ref:h,value:a,onChange:a=>b(a.target.value),onKeyDown:d,placeholder:l("mysql.sqlPlaceholder",{modKey:(0,z.Mu)()}),className:"w-full h-20 px-2 py-1.5 text-xs font-mono bg-background border border-input rounded resize-y focus:outline-none focus:ring-1 focus:ring-ring",spellCheck:!1}),(0,i.jsxs)("div",{className:"flex items-center gap-2 mt-1",children:[(0,i.jsx)("button",{onClick:c,disabled:g||!a.trim(),className:"px-2 py-1 text-xs bg-brand text-white rounded hover:bg-brand/90 disabled:opacity-50 transition-colors",children:l(g?"mysql.executing":"mysql.execute")}),e?.duration!==void 0&&(0,i.jsxs)("span",{className:"text-[10px] text-muted-foreground",children:[e.command&&!e.fields?l("mysql.rowsAffected",{command:e.command,count:e.rowCount,duration:e.duration}):l("mysql.queryRows",{count:e.rows?.length??0,duration:e.duration}),e.truncated&&` ${l("mysql.resultTruncated")}`]})]})]}),f&&(0,i.jsx)("div",{className:"px-3 py-2 text-xs text-destructive bg-destructive/5 border-b border-border break-all",children:f}),e?.fields&&e.rows&&(0,i.jsx)("div",{className:"flex-1 overflow-auto",children:(0,i.jsxs)("table",{className:"w-full text-xs border-collapse",children:[(0,i.jsx)("thead",{className:"sticky top-0 bg-card z-[1]",children:(0,i.jsx)("tr",{children:e.fields.map(a=>(0,i.jsx)("th",{className:"px-1.5 py-1 text-left text-muted-foreground font-medium border-b border-border whitespace-nowrap font-mono",children:a.name},a.name))})}),(0,i.jsx)("tbody",{children:e.rows.map((a,b)=>(0,i.jsx)("tr",{className:"hover:bg-accent/50",children:e.fields.map(b=>(0,i.jsx)("td",{className:"px-1.5 py-0.5 border-b border-border/50 font-mono whitespace-nowrap max-w-[200px] truncate",onContextMenu:c=>{c.preventDefault(),j(aO(a[b.name]))},children:null===a[b.name]||void 0===a[b.name]?(0,i.jsx)("span",{className:"text-muted-foreground italic",children:"NULL"}):(0,i.jsx)(aP,{text:aO(a[b.name])})},b.name))},b))})]})})]})}async function aX(a,b){let c=await fetch(a,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(b)}),d=await c.json();if(!c.ok)throw Error(d.error||`HTTP ${c.status}`);return d}ag({type:"mysql",idPrefix:"mysql",match:a=>a.trim().toLowerCase().startsWith("mysql://"),parse(a){let b=a.trim(),c=b;try{let a=new URL(b),d=a.pathname.replace(/^\//,"")||"mysql";c=`${d}@${a.hostname}${a.port?":"+a.port:""}`}catch{}return{connectionString:b,displayName:c}},fromHistory:a=>({connectionString:a.connectionString,displayName:a.displayName||a.connectionString}),toHistory:a=>({connectionString:a.connectionString,displayName:a.displayName}),Component:function({item:a,selected:b,maximized:c,expandedHeight:d,bubbleContentHeight:e,timestamp:f,onSelect:g,onClose:h,onToggleMaximize:j,onTitleMouseDown:k}){return(0,i.jsx)(aS,{id:a.id,connectionString:a.connectionString,displayName:a.displayName,selected:b,maximized:c,expandedHeight:d,bubbleContentHeight:e,timestamp:f,onSelect:g,onClose:h,onToggleMaximize:j,onTitleMouseDown:k})},async onClose(a){try{await fetch("/api/mysql/disconnect",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:a.id})})}catch{}}});let aY={string:{label:"S",color:"text-emerald-500 bg-emerald-500/10"},hash:{label:"H",color:"text-blue-500 bg-blue-500/10"},list:{label:"L",color:"text-orange-500 bg-orange-500/10"},set:{label:"SET",color:"text-teal-500 bg-teal-500/10"},zset:{label:"Z",color:"text-purple-500 bg-purple-500/10"},stream:{label:"STR",color:"text-pink-500 bg-pink-500/10"}};function aZ({type:a}){let b=aY[a]||{label:"?",color:"text-muted-foreground bg-muted"};return(0,i.jsx)("span",{className:`inline-block text-[9px] font-mono font-bold leading-none px-1 py-0.5 rounded flex-shrink-0 ${b.color}`,children:b.label})}function a$({text:a}){let[b,c]=(0,j.useState)(!1),[d,e]=(0,j.useState)({x:0,y:0,above:!0}),f=(0,j.useRef)(null),g=(0,j.useRef)(null),h=(0,j.useCallback)(()=>{g.current&&clearTimeout(g.current),g.current=setTimeout(()=>{let a=f.current;if(!a||a.scrollWidth<=a.clientWidth)return;let b=a.getBoundingClientRect(),d=b.top>window.innerHeight/2;e({x:b.left,y:d?b.top-4:b.bottom+4,above:d}),c(!0)},350)},[]),k=(0,j.useCallback)(()=>{g.current&&clearTimeout(g.current),c(!1)},[]);return(0,i.jsxs)("span",{ref:f,className:"block truncate",onMouseEnter:h,onMouseLeave:k,children:[a,b&&(0,am.createPortal)((0,i.jsx)("div",{className:"fixed z-[9999] max-w-[500px] max-h-[200px] overflow-y-auto px-2 py-1.5 text-xs font-mono bg-popover text-popover-foreground border border-border rounded shadow-lg whitespace-pre-wrap break-all select-text",style:{left:d.x,top:d.y,transform:d.above?"translateY(-100%)":void 0},children:a}),document.body)]})}function a_({id:a,connectionString:b,displayName:c,selected:d,maximized:e,expandedHeight:f,bubbleContentHeight:g,onSelect:h,onClose:l,onToggleMaximize:m,timestamp:n,onTitleMouseDown:o}){var p;let{t:q}=(0,k.Bd)(),{showToast:r}=(0,t.dj)(),[s,u]=(0,j.useState)("connecting"),[v,w]=(0,j.useState)(""),[x,y]=(0,j.useState)(null),[A,B]=(0,j.useState)([]),[C,D]=(0,j.useState)("0"),[E,F]=(0,j.useState)(!1),[G,H]=(0,j.useState)("*"),[I,J]=(0,j.useState)(!1),[K,L]=(0,j.useState)(null),[M,N]=(0,j.useState)(null),[O,P]=(0,j.useState)(!1),[Q,R]=(0,j.useState)(null),[S,T]=(0,j.useState)(!1),[U,V]=(0,j.useState)("data"),[W,X]=(0,j.useState)(""),[Y,Z]=(0,j.useState)(""),[$,_]=(0,j.useState)([]),[aa,ab]=(0,j.useState)(!1),ac=(0,j.useRef)(null),ad=(0,j.useRef)(null),ae=(0,j.useCallback)(async()=>{u("connecting"),w("");try{let c=await aX("/api/redis/connect",{id:a,connectionString:b});y(c),u("connected")}catch(a){w(a instanceof Error?a.message:String(a)),u("error")}},[a,b]),af=(0,j.useCallback)(async(c,d,e)=>{J(!0);try{let f=await aX("/api/redis/keys",{id:a,connectionString:b,pattern:c,cursor:d,count:200});B(a=>e?[...a,...f.keys]:f.keys),D(f.cursor),F(f.hasMore)}catch{}J(!1)},[a,b]),ag=(0,j.useCallback)(()=>{L(null),N(null),af(G,"0",!1)},[G,af]),ah=(0,j.useCallback)(async c=>{L(c),P(!0),R(null),T(!1);try{let d=await aX("/api/redis/get",{id:a,connectionString:b,key:c});N(d)}catch(a){N(null),r(a instanceof Error?a.message:q("redis.loadFailed"))}P(!1)},[a,b,r]),ai=(0,j.useCallback)(async()=>{if(K)try{await aX("/api/redis/delete",{id:a,connectionString:b,keys:[K]}),L(null),N(null),T(!1),af(G,"0",!1)}catch(a){r(a instanceof Error?a.message:q("redis.deleteFailed"))}},[K,a,b,G,af,r]),aj=(0,j.useCallback)(async()=>{if(K&&null!==Q)try{await aX("/api/redis/set",{id:a,connectionString:b,key:K,value:Q,type:"string"}),R(null),ah(K),r(q("common.saved"))}catch(a){r(a instanceof Error?a.message:q("redis.saveFailed"))}},[K,Q,a,b,ah,r]),ak=(0,j.useCallback)(async()=>{try{let c=await aX("/api/redis/command",{id:a,connectionString:b,command:"INFO"});X("string"==typeof c.result?c.result:String(c.result))}catch{}},[a,b]),al=(0,j.useCallback)(async()=>{let c,d=Y.trim();if(!d)return;ab(!0),Z("");let e=[],f=/(?:"([^"]*)")|(?:'([^']*)')|(\S+)/g;for(;null!==(c=f.exec(d));)e.push(c[1]??c[2]??c[3]);let g=e[0]||"",h=e.slice(1);try{let c=await aX("/api/redis/command",{id:a,connectionString:b,command:g,args:h});_(a=>[...a,{command:d,result:c.result,duration:c.duration,isError:!1}])}catch(a){_(b=>[...b,{command:d,result:a instanceof Error?a.message:String(a),duration:0,isError:!0}])}ab(!1)},[Y,a,b]);return(0,i.jsx)("div",{className:"flex flex-col items-start",children:(0,i.jsxs)("div",{className:`w-full bg-accent text-foreground
17
+ relative transition-colors cursor-pointer
18
+ ${e?"rounded-none overflow-visible border-0":"border overflow-hidden rounded-2xl rounded-bl-md rounded-br-md"}
19
+ ${e?"":d?"border-brand":"border-brand/30"}`,onClick:e?void 0:h,children:[(0,i.jsxs)("div",{"data-drag-handle":!0,onDoubleClick:m,onMouseDown:o,className:`flex items-center gap-2 px-4 py-1.5 border-b border-border ${e?"bg-card":"bg-card/50"}`,style:e?{height:41}:void 0,children:[(0,i.jsx)("span",{className:"text-sm flex-shrink-0",children:"♦"}),(0,i.jsx)("span",{className:"text-xs text-foreground truncate font-mono font-medium",children:c}),"connecting"===s&&(0,i.jsx)("span",{className:"inline-block w-3 h-3 border border-brand border-t-transparent rounded-full animate-spin flex-shrink-0"}),"error"===s&&(0,i.jsx)("span",{className:"text-[10px] text-destructive flex-shrink-0",children:q("common.connectionFailed")}),"connected"===s&&x&&(0,i.jsxs)("span",{className:"text-[10px] text-red-500 flex-shrink-0",children:["v",x.version," \xb7 ",x.dbSize," keys \xb7 ",x.memory]}),(0,i.jsx)("span",{className:"flex-1"}),n&&(0,i.jsx)("span",{className:"text-[10px] text-muted-foreground flex-shrink-0",children:function(a){if(!a)return"";let b=new Date(a);if(isNaN(b.getTime()))return"";let c=String(b.getMonth()+1).padStart(2,"0"),d=String(b.getDate()).padStart(2,"0"),e=String(b.getHours()).padStart(2,"0"),f=String(b.getMinutes()).padStart(2,"0");return`${c}-${d} ${e}:${f}`}(n)}),(0,i.jsx)("button",{onClick:a=>{a.stopPropagation(),m()},className:"p-0.5 rounded text-muted-foreground hover:text-foreground transition-colors flex-shrink-0",title:e?q("browser.exitMaximize",{modKey:(0,z.Mu)()}):q("browser.maximize",{modKey:(0,z.Mu)()}),children:e?(0,i.jsx)("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,i.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 3v3a2 2 0 01-2 2H3m18 0h-3a2 2 0 01-2-2V3m0 18v-3a2 2 0 012-2h3M3 16h3a2 2 0 012 2v3"})}):(0,i.jsx)("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,i.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 8V4m0 0h4M4 4l5 5m11-1V4m0 0h-4m4 0l-5 5M4 16v4m0 0h4m-4 0l5-5m11 5l-5-5m5 5v-4m0 4h-4"})})}),(0,i.jsx)("button",{onClick:a=>{a.stopPropagation(),l()},className:"p-0.5 rounded text-muted-foreground hover:text-foreground transition-colors flex-shrink-0",title:q("common.close"),children:(0,i.jsx)("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,i.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),(0,i.jsxs)("div",{style:{height:e&&f?f-41:g??360},className:"flex overflow-hidden",children:["connecting"===s&&(0,i.jsxs)("div",{className:"flex-1 flex items-center justify-center text-sm text-muted-foreground",children:[(0,i.jsx)("span",{className:"inline-block w-4 h-4 border-2 border-brand border-t-transparent rounded-full animate-spin mr-2"}),q("common.connecting"),"..."]}),"error"===s&&(0,i.jsxs)("div",{className:"flex-1 flex flex-col items-center justify-center gap-3 p-4",children:[(0,i.jsx)("span",{className:"text-sm text-destructive text-center break-all",children:v}),(0,i.jsx)("button",{onClick:ae,className:"px-3 py-1.5 text-xs bg-brand text-white rounded-md hover:bg-brand/90 transition-colors",children:q("common.retry")})]}),"connected"===s&&(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)("div",{className:"w-52 flex-shrink-0 border-r border-border flex flex-col overflow-hidden",children:[(0,i.jsxs)("div",{className:"p-1.5 border-b border-border flex items-center gap-1",children:[(0,i.jsx)("input",{type:"text",value:G,onChange:a=>H(a.target.value),onKeyDown:a=>{"Enter"===a.key&&ag()},placeholder:q("redis.scanPlaceholder"),className:"flex-1 min-w-0 text-xs bg-background border border-input rounded px-1.5 py-1 font-mono focus:outline-none focus:ring-1 focus:ring-ring"}),(0,i.jsx)("button",{onClick:ag,className:"flex-shrink-0 w-5 h-5 flex items-center justify-center rounded text-muted-foreground hover:text-foreground hover:bg-accent active:bg-accent/50 transition-colors",title:q("redis.scanSearch"),children:(0,i.jsxs)("svg",{width:"12",height:"12",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,i.jsx)("circle",{cx:"6.5",cy:"6.5",r:"4.5"}),(0,i.jsx)("path",{d:"M10 10l4 4"})]})}),(0,i.jsx)("button",{onClick:()=>af(G,"0",!1),className:"flex-shrink-0 w-5 h-5 flex items-center justify-center rounded text-muted-foreground hover:text-foreground hover:bg-accent active:bg-accent/50 transition-colors",title:q("common.refresh"),children:(0,i.jsxs)("svg",{width:"12",height:"12",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,i.jsx)("path",{d:"M1 1v5h5"}),(0,i.jsx)("path",{d:"M15 15v-5h-5"}),(0,i.jsx)("path",{d:"M13.5 6A6 6 0 0 0 3.2 3.2L1 6"}),(0,i.jsx)("path",{d:"M2.5 10a6 6 0 0 0 10.3 2.8L15 10"})]})})]}),(0,i.jsxs)("div",{className:"flex-1 overflow-y-auto text-xs",children:[A.map(a=>(0,i.jsxs)("div",{onClick:()=>ah(a.key),className:`flex items-center gap-1.5 px-2 py-1 cursor-pointer transition-colors ${K===a.key?"bg-brand/10 text-brand":"hover:bg-accent text-foreground"}`,children:[(0,i.jsx)(aZ,{type:a.type}),(0,i.jsx)("span",{className:"truncate min-w-0 flex-1 font-mono",children:(0,i.jsx)(a$,{text:a.key})})]},a.key)),0===A.length&&!I&&(0,i.jsx)("div",{className:"p-2 text-muted-foreground text-center",children:q("redis.noKeys")}),I&&(0,i.jsx)("div",{className:"p-2 flex items-center justify-center",children:(0,i.jsx)("span",{className:"inline-block w-3 h-3 border border-brand border-t-transparent rounded-full animate-spin"})}),E&&!I&&(0,i.jsx)("button",{onClick:()=>af(G,C,!0),className:"w-full py-1.5 text-[10px] text-brand hover:text-brand/80 transition-colors",children:q("redis.loadMore")})]}),(0,i.jsxs)("div",{className:"px-2 py-1 border-t border-border text-[10px] text-muted-foreground",children:[A.length," keys",E?"+":"",x?` / ${x.dbSize} total`:""]})]}),(0,i.jsxs)("div",{className:"flex-1 flex flex-col overflow-hidden min-w-0",children:[(0,i.jsxs)("div",{className:"flex items-center gap-0 border-b border-border bg-card/30 flex-shrink-0",children:[["data","info","cli"].map(a=>(0,i.jsx)("button",{onClick:()=>V(a),className:`px-3 py-1.5 text-xs transition-colors ${U===a?"text-brand border-b-2 border-brand font-medium":"text-muted-foreground hover:text-foreground"}`,children:{data:q("redis.tabData"),info:q("redis.tabInfo"),cli:"CLI"}[a]},a)),K&&"data"===U&&(0,i.jsxs)("div",{className:"ml-auto flex items-center gap-1 pr-2",children:[M&&(0,i.jsxs)("span",{className:"text-[10px] text-muted-foreground",children:["TTL: ",function(a,b){if(-1===a)return b("redis.neverExpires");if(-2===a)return b("redis.expired");if(a<60)return`${a}s`;if(a<3600)return`${Math.floor(a/60)}m${a%60>0?` ${a%60}s`:""}`;let c=Math.floor(a/3600),d=Math.floor(a%3600/60);return`${c}h${d>0?` ${d}m`:""}`}(M.ttl,q),null!==M.size?` \xb7 ${null==(p=M.size)?"":p<1024?`${p} B`:p<1048576?`${(p/1024).toFixed(1)} KB`:`${(p/1048576).toFixed(1)} MB`}`:""]}),S?(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)("span",{className:"text-[10px] text-destructive",children:[q("common.confirm"),"?"]}),(0,i.jsx)("button",{onClick:ai,className:"px-1.5 py-0.5 text-[10px] text-white bg-destructive rounded transition-colors hover:bg-destructive/80",children:q("common.confirm")}),(0,i.jsx)("button",{onClick:()=>T(!1),className:"px-1.5 py-0.5 text-[10px] text-muted-foreground hover:text-foreground bg-muted rounded transition-colors",children:q("common.cancel")})]}):(0,i.jsx)("button",{onClick:()=>T(!0),className:"px-1.5 py-0.5 text-[10px] text-destructive hover:text-destructive/80 bg-destructive/10 rounded transition-colors",children:q("common.delete")})]})]}),(0,i.jsx)("div",{className:"flex-1 overflow-auto",children:"data"===U?(0,i.jsx)(a0,{selectedKey:K,keyValue:M,keyLoading:O,editingValue:Q,onStartEdit:a=>R(a),onEditChange:R,onSaveEdit:aj,onCancelEdit:()=>R(null),onCellCopy:a=>{navigator.clipboard.writeText(a),r(q("common.copied"))}}):"info"===U?(0,i.jsx)(a1,{infoText:W,onRefresh:ak}):(0,i.jsx)(a2,{cliInput:Y,onInputChange:Z,onExecute:al,history:$,loading:aa,endRef:ac,inputRef:ad})})]})]})]})]})})}function a0({selectedKey:a,keyValue:b,keyLoading:c,editingValue:d,onStartEdit:e,onEditChange:f,onSaveEdit:g,onCancelEdit:h,onCellCopy:j}){let{t:l}=(0,k.Bd)();if(!a)return(0,i.jsx)("div",{className:"flex items-center justify-center h-full text-sm text-muted-foreground",children:l("redis.selectKey")});if(c)return(0,i.jsx)("div",{className:"flex items-center justify-center h-full",children:(0,i.jsx)("span",{className:"inline-block w-4 h-4 border-2 border-brand border-t-transparent rounded-full animate-spin"})});if(!b)return(0,i.jsx)("div",{className:"flex items-center justify-center h-full text-sm text-muted-foreground",children:l("redis.keyNotExist")});let{type:m,value:n}=b;if("string"===m){let b=String(n??""),c=null!==d;return(0,i.jsxs)("div",{className:"p-3 h-full flex flex-col",children:[(0,i.jsxs)("div",{className:"flex items-center gap-2 mb-2",children:[(0,i.jsx)(aZ,{type:"string"}),(0,i.jsx)("span",{className:"text-xs font-mono text-muted-foreground truncate",children:a}),(0,i.jsx)("span",{className:"flex-1"}),c?(0,i.jsxs)("div",{className:"flex gap-1",children:[(0,i.jsx)("button",{onClick:g,className:"px-2 py-0.5 text-[10px] text-white bg-brand rounded hover:bg-brand/90",children:l("common.save")}),(0,i.jsx)("button",{onClick:h,className:"px-2 py-0.5 text-[10px] text-muted-foreground bg-muted rounded hover:text-foreground",children:l("common.cancel")})]}):(0,i.jsx)("button",{onClick:()=>e(b),className:"px-2 py-0.5 text-[10px] text-brand hover:text-brand/80 bg-brand/10 rounded transition-colors",children:l("common.edit")})]}),c?(0,i.jsx)("textarea",{value:d,onChange:a=>f(a.target.value),className:"flex-1 w-full px-2 py-1.5 text-xs font-mono bg-background border border-input rounded resize-none focus:outline-none focus:ring-1 focus:ring-ring",spellCheck:!1}):(0,i.jsx)("pre",{className:"flex-1 overflow-auto text-xs font-mono bg-muted/30 rounded p-2 whitespace-pre-wrap break-all select-text cursor-text",onContextMenu:a=>{a.preventDefault(),j(b)},children:b})]})}if("hash"===m){let b=Object.entries(n||{});return(0,i.jsxs)("div",{className:"h-full flex flex-col",children:[(0,i.jsxs)("div",{className:"flex items-center gap-2 px-3 py-1.5 border-b border-border",children:[(0,i.jsx)(aZ,{type:"hash"}),(0,i.jsx)("span",{className:"text-xs font-mono text-muted-foreground truncate",children:a}),(0,i.jsxs)("span",{className:"text-[10px] text-muted-foreground ml-auto",children:[b.length," fields"]})]}),(0,i.jsx)("div",{className:"flex-1 overflow-auto",children:(0,i.jsxs)("table",{className:"w-full text-xs border-collapse",children:[(0,i.jsx)("thead",{className:"sticky top-0 bg-card z-[1]",children:(0,i.jsxs)("tr",{children:[(0,i.jsx)("th",{className:"px-2 py-1 text-left text-muted-foreground font-medium border-b border-border w-1/3",children:"Field"}),(0,i.jsx)("th",{className:"px-2 py-1 text-left text-muted-foreground font-medium border-b border-border",children:"Value"})]})}),(0,i.jsx)("tbody",{children:b.map(([a,b])=>(0,i.jsxs)("tr",{className:"hover:bg-accent/50",children:[(0,i.jsx)("td",{className:"px-2 py-0.5 border-b border-border/50 font-mono truncate max-w-[150px]",onContextMenu:b=>{b.preventDefault(),j(a)},children:(0,i.jsx)(a$,{text:a})}),(0,i.jsx)("td",{className:"px-2 py-0.5 border-b border-border/50 font-mono truncate max-w-[300px]",onContextMenu:a=>{a.preventDefault(),j(b)},children:(0,i.jsx)(a$,{text:b})})]},a))})]})})]})}if("list"===m){let b=n?.items||[],c=n?.total||0;return(0,i.jsxs)("div",{className:"h-full flex flex-col",children:[(0,i.jsxs)("div",{className:"flex items-center gap-2 px-3 py-1.5 border-b border-border",children:[(0,i.jsx)(aZ,{type:"list"}),(0,i.jsx)("span",{className:"text-xs font-mono text-muted-foreground truncate",children:a}),(0,i.jsxs)("span",{className:"text-[10px] text-muted-foreground ml-auto",children:[l("redis.nItems",{total:c}),b.length<c?` (${l("redis.showingN",{count:b.length})})`:""]})]}),(0,i.jsx)("div",{className:"flex-1 overflow-auto",children:(0,i.jsxs)("table",{className:"w-full text-xs border-collapse",children:[(0,i.jsx)("thead",{className:"sticky top-0 bg-card z-[1]",children:(0,i.jsxs)("tr",{children:[(0,i.jsx)("th",{className:"px-2 py-1 text-left text-muted-foreground font-medium border-b border-border w-16",children:"#"}),(0,i.jsx)("th",{className:"px-2 py-1 text-left text-muted-foreground font-medium border-b border-border",children:"Value"})]})}),(0,i.jsx)("tbody",{children:b.map((a,b)=>(0,i.jsxs)("tr",{className:"hover:bg-accent/50",children:[(0,i.jsx)("td",{className:"px-2 py-0.5 border-b border-border/50 text-muted-foreground",children:b}),(0,i.jsx)("td",{className:"px-2 py-0.5 border-b border-border/50 font-mono truncate max-w-[300px]",onContextMenu:b=>{b.preventDefault(),j(a)},children:(0,i.jsx)(a$,{text:a})})]},b))})]})})]})}if("set"===m){let b=n?.items||[],c=n?.total||0;return(0,i.jsxs)("div",{className:"h-full flex flex-col",children:[(0,i.jsxs)("div",{className:"flex items-center gap-2 px-3 py-1.5 border-b border-border",children:[(0,i.jsx)(aZ,{type:"set"}),(0,i.jsx)("span",{className:"text-xs font-mono text-muted-foreground truncate",children:a}),(0,i.jsxs)("span",{className:"text-[10px] text-muted-foreground ml-auto",children:[l("redis.nMembers",{total:c}),b.length<c?` (${l("redis.showingN",{count:b.length})})`:""]})]}),(0,i.jsx)("div",{className:"flex-1 overflow-auto",children:(0,i.jsxs)("table",{className:"w-full text-xs border-collapse",children:[(0,i.jsx)("thead",{className:"sticky top-0 bg-card z-[1]",children:(0,i.jsx)("tr",{children:(0,i.jsx)("th",{className:"px-2 py-1 text-left text-muted-foreground font-medium border-b border-border",children:"Member"})})}),(0,i.jsx)("tbody",{children:b.map((a,b)=>(0,i.jsx)("tr",{className:"hover:bg-accent/50",children:(0,i.jsx)("td",{className:"px-2 py-0.5 border-b border-border/50 font-mono truncate max-w-[400px]",onContextMenu:b=>{b.preventDefault(),j(a)},children:(0,i.jsx)(a$,{text:a})})},b))})]})})]})}if("zset"===m){let b=n?.items||[],c=n?.total||0;return(0,i.jsxs)("div",{className:"h-full flex flex-col",children:[(0,i.jsxs)("div",{className:"flex items-center gap-2 px-3 py-1.5 border-b border-border",children:[(0,i.jsx)(aZ,{type:"zset"}),(0,i.jsx)("span",{className:"text-xs font-mono text-muted-foreground truncate",children:a}),(0,i.jsxs)("span",{className:"text-[10px] text-muted-foreground ml-auto",children:[l("redis.nMembers",{total:c}),b.length<c?` (${l("redis.showingN",{count:b.length})})`:""]})]}),(0,i.jsx)("div",{className:"flex-1 overflow-auto",children:(0,i.jsxs)("table",{className:"w-full text-xs border-collapse",children:[(0,i.jsx)("thead",{className:"sticky top-0 bg-card z-[1]",children:(0,i.jsxs)("tr",{children:[(0,i.jsx)("th",{className:"px-2 py-1 text-left text-muted-foreground font-medium border-b border-border",children:"Member"}),(0,i.jsx)("th",{className:"px-2 py-1 text-right text-muted-foreground font-medium border-b border-border w-28",children:"Score"})]})}),(0,i.jsx)("tbody",{children:b.map((a,b)=>(0,i.jsxs)("tr",{className:"hover:bg-accent/50",children:[(0,i.jsx)("td",{className:"px-2 py-0.5 border-b border-border/50 font-mono truncate max-w-[300px]",onContextMenu:b=>{b.preventDefault(),j(a.member)},children:(0,i.jsx)(a$,{text:a.member})}),(0,i.jsx)("td",{className:"px-2 py-0.5 border-b border-border/50 font-mono text-right text-muted-foreground",children:a.score})]},b))})]})})]})}if("stream"===m){let b=n?.entries||[],c=n?.total||0;return(0,i.jsxs)("div",{className:"h-full flex flex-col",children:[(0,i.jsxs)("div",{className:"flex items-center gap-2 px-3 py-1.5 border-b border-border",children:[(0,i.jsx)(aZ,{type:"stream"}),(0,i.jsx)("span",{className:"text-xs font-mono text-muted-foreground truncate",children:a}),(0,i.jsxs)("span",{className:"text-[10px] text-muted-foreground ml-auto",children:[l("redis.nEntries",{total:c}),b.length<c?` (${l("redis.showingN",{count:b.length})})`:""]})]}),(0,i.jsx)("div",{className:"flex-1 overflow-auto",children:(0,i.jsxs)("table",{className:"w-full text-xs border-collapse",children:[(0,i.jsx)("thead",{className:"sticky top-0 bg-card z-[1]",children:(0,i.jsxs)("tr",{children:[(0,i.jsx)("th",{className:"px-2 py-1 text-left text-muted-foreground font-medium border-b border-border w-40",children:"ID"}),(0,i.jsx)("th",{className:"px-2 py-1 text-left text-muted-foreground font-medium border-b border-border",children:"Fields"})]})}),(0,i.jsx)("tbody",{children:b.map(([a,b])=>{let c=[];for(let a=0;a<b.length;a+=2)c.push(`${b[a]}: ${b[a+1]}`);return(0,i.jsxs)("tr",{className:"hover:bg-accent/50",children:[(0,i.jsx)("td",{className:"px-2 py-0.5 border-b border-border/50 font-mono text-muted-foreground",children:a}),(0,i.jsx)("td",{className:"px-2 py-0.5 border-b border-border/50 font-mono truncate max-w-[300px]",children:(0,i.jsx)(a$,{text:c.join(", ")})})]},a)})})]})})]})}return(0,i.jsx)("div",{className:"flex items-center justify-center h-full text-sm text-muted-foreground",children:l("redis.unsupportedType",{type:m})})}function a1({infoText:a,onRefresh:b}){let{t:c}=(0,k.Bd)();if(!a)return(0,i.jsx)("div",{className:"flex items-center justify-center h-full",children:(0,i.jsx)("span",{className:"inline-block w-4 h-4 border-2 border-brand border-t-transparent rounded-full animate-spin"})});let d=[],e=null;for(let b of a.split("\n")){let a=b.trim();if(a){if(a.startsWith("#"))e={title:a.replace(/^#\s*/,""),items:[]},d.push(e);else if(e&&a.includes(":")){let b=a.indexOf(":");e.items.push({key:a.slice(0,b),value:a.slice(b+1)})}}}return(0,i.jsxs)("div",{className:"p-2 space-y-3 overflow-auto h-full",children:[(0,i.jsx)("div",{className:"flex justify-end",children:(0,i.jsx)("button",{onClick:b,className:"px-2 py-0.5 text-[10px] text-muted-foreground hover:text-foreground bg-muted rounded transition-colors",children:c("common.refresh")})}),d.map(a=>(0,i.jsxs)("div",{children:[(0,i.jsx)("div",{className:"text-[10px] text-muted-foreground uppercase tracking-wide px-1 mb-1 font-medium",children:a.title}),(0,i.jsx)("div",{className:"space-y-0",children:a.items.map(({key:a,value:b})=>(0,i.jsxs)("div",{className:"flex items-start gap-2 px-1.5 py-0.5 text-xs hover:bg-accent/50 rounded",children:[(0,i.jsx)("span",{className:"text-muted-foreground font-mono flex-shrink-0 w-48 truncate",children:a}),(0,i.jsx)("span",{className:"font-mono text-foreground break-all",children:b})]},a))})]},a.title))]})}function a2({cliInput:a,onInputChange:b,onExecute:c,history:d,loading:e,endRef:f,inputRef:g}){let{t:h}=(0,k.Bd)();return(0,i.jsxs)("div",{className:"flex flex-col h-full",children:[(0,i.jsxs)("div",{className:"flex-1 overflow-auto p-2 font-mono text-xs space-y-2",onClick:()=>g.current?.focus(),children:[0===d.length&&(0,i.jsx)("div",{className:"text-muted-foreground text-center py-4",children:h("redis.cliHint")}),d.map((a,b)=>(0,i.jsxs)("div",{children:[(0,i.jsxs)("div",{className:"text-brand",children:[(0,i.jsx)("span",{className:"text-muted-foreground mr-1",children:">"}),a.command,a.duration>0&&(0,i.jsxs)("span",{className:"text-muted-foreground/50 ml-2",children:["(",a.duration,"ms)"]})]}),(0,i.jsx)("pre",{className:`whitespace-pre-wrap break-all mt-0.5 ${a.isError?"text-destructive":"text-foreground"}`,children:a.isError?`(error) ${a.result}`:function a(b,c=0){let d=" ".repeat(c);return null===b?`${d}(nil)`:"number"==typeof b?`${d}(integer) ${b}`:"string"==typeof b?`${d}"${b}"`:Array.isArray(b)?0===b.length?`${d}(empty array)`:b.map((b,c)=>`${d}${c+1}) ${a(b,0)}`).join("\n"):`${d}${String(b)}`}(a.result)})]},b)),(0,i.jsx)("div",{ref:f})]}),(0,i.jsxs)("div",{className:"flex items-center gap-1 px-2 py-1.5 border-t border-border bg-card/30 flex-shrink-0",children:[(0,i.jsx)("span",{className:"text-xs text-brand font-mono flex-shrink-0",children:">"}),(0,i.jsx)("input",{ref:g,type:"text",value:a,onChange:a=>b(a.target.value),onKeyDown:a=>{"Enter"!==a.key||e||c()},placeholder:h("redis.cliPlaceholder"),className:"flex-1 min-w-0 text-xs font-mono bg-transparent border-0 focus:outline-none",autoComplete:"off",spellCheck:!1,disabled:e}),e&&(0,i.jsx)("span",{className:"inline-block w-3 h-3 border border-brand border-t-transparent rounded-full animate-spin flex-shrink-0"})]})]})}function a3(){return`cmd-${Date.now()}-${Math.random().toString(36).substring(2,9)}`}ag({type:"redis",idPrefix:"redis",match(a){let b=a.trim().toLowerCase();return b.startsWith("redis://")||b.startsWith("rediss://")},parse(a){let b=a.trim(),c=b;try{let a=new URL(b),d=a.pathname.replace(/^\//,"")||"0";c=`db${d}@${a.hostname}${a.port?":"+a.port:":6379"}`}catch{}return{connectionString:b,displayName:c}},fromHistory:a=>({connectionString:a.connectionString,displayName:a.displayName||a.connectionString}),toHistory:a=>({connectionString:a.connectionString,displayName:a.displayName}),Component:function({item:a,selected:b,maximized:c,expandedHeight:d,bubbleContentHeight:e,timestamp:f,onSelect:g,onClose:h,onToggleMaximize:j,onTitleMouseDown:k}){return(0,i.jsx)(a_,{id:a.id,connectionString:a.connectionString,displayName:a.displayName,selected:b,maximized:c,expandedHeight:d,bubbleContentHeight:e,timestamp:f,onSelect:g,onClose:h,onToggleMaximize:j,onTitleMouseDown:k})},async onClose(a){try{await fetch("/api/redis/disconnect",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:a.id})})}catch{}}});let a4=new Set(["zsh","bash","sh","fish","nu","python","python3","node","irb","lua","vim","nvim","vi","nano","emacs","top","htop","less","man"]);function a5({onAdd:a,onCancel:b}){let{t:c}=(0,k.Bd)(),[d,e]=(0,j.useState)(""),[f,g]=(0,j.useState)("");return(0,i.jsxs)("div",{className:"flex gap-1 mb-1",children:[(0,i.jsx)("input",{type:"text",value:d,onChange:a=>e(a.target.value),placeholder:c("console.namePlaceholder"),className:"w-24 flex-shrink-0 px-2 py-1 text-xs rounded border border-input bg-background focus:outline-none focus:ring-1 focus:ring-ring",autoFocus:!0,onKeyDown:a=>{"Escape"===a.key&&b()}}),(0,i.jsx)("input",{type:"text",value:f,onChange:a=>g(a.target.value),placeholder:c("console.commandPlaceholder"),className:"flex-1 min-w-0 px-2 py-1 text-xs font-mono rounded border border-input bg-background focus:outline-none focus:ring-1 focus:ring-ring",onKeyDown:c=>{"Enter"!==c.key||c.nativeEvent.isComposing?"Escape"===c.key&&b():(c.preventDefault(),c.stopPropagation(),d.trim()&&f.trim()&&a(d.trim(),f.trim()))}})]})}function a6({label:a,commands:b,isAdding:c,onStartAdd:d,onAdd:e,onCancelAdd:f,onDelete:g,onExecute:h}){let{t:j}=(0,k.Bd)();return(0,i.jsxs)("div",{className:"p-2",children:[(0,i.jsxs)("div",{className:"flex items-center justify-between mb-1",children:[(0,i.jsx)("span",{className:"text-xs font-medium text-muted-foreground px-1",children:a}),(0,i.jsx)("button",{type:"button",onClick:d,className:"p-0.5 text-muted-foreground hover:text-foreground rounded",children:(0,i.jsx)(G.A,{className:"w-3.5 h-3.5"})})]}),c&&(0,i.jsx)(a5,{onAdd:(a,b)=>e(a,b),onCancel:f}),0===b.length&&!c&&(0,i.jsx)("div",{className:"text-xs text-muted-foreground px-1 py-1",children:j("console.noCustomCommands")}),b.map((a,b)=>(0,i.jsx)(O.m,{content:a.command,children:(0,i.jsxs)("div",{className:"flex items-center group min-w-0",children:[(0,i.jsxs)("button",{type:"button",onClick:()=>h(a.command),className:"flex-1 min-w-0 flex items-center gap-2 px-2 py-1.5 text-left text-sm rounded hover:bg-accent transition-colors",children:[(0,i.jsx)(N,{className:"w-3 h-3 flex-shrink-0 text-muted-foreground"}),(0,i.jsx)("span",{className:"truncate",children:a.name})]}),(0,i.jsx)("button",{type:"button",onClick:()=>g(b),className:"p-1 text-muted-foreground hover:text-destructive rounded opacity-0 group-hover:opacity-100 transition-opacity flex-shrink-0",children:(0,i.jsx)(l.A,{className:"w-3 h-3"})})]})},b))]})}function a7({cwd:a,show:b,onClose:c,onExecute:d,onAddPluginItem:e}){let{t:f}=(0,k.Bd)(),[g,h]=(0,j.useState)([]),[l,m]=(0,j.useState)([]),[n,o]=(0,j.useState)(null),p=(0,j.useRef)(null);(0,j.useCallback)(async()=>{try{let[b,c]=await Promise.all([fetch("/api/services/config?scope=global"),fetch(`/api/services/config?cwd=${encodeURIComponent(a)}`)]);if(b.ok){let a=await b.json();h(a.customCommands||[])}if(c.ok){let a=await c.json();m(a.customCommands||[])}}catch(a){console.error("Failed to load commands:",a)}},[a]);let q=(0,j.useCallback)(async a=>{h(a);try{await fetch("/api/services/config",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({scope:"global",customCommands:a})})}catch(a){console.error("Failed to save global commands:",a)}},[]),r=(0,j.useCallback)(async b=>{m(b);try{await fetch("/api/services/config",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({cwd:a,customCommands:b})})}catch(a){console.error("Failed to save project commands:",a)}},[a]),s=(0,j.useCallback)(a=>{c();let b=ai(a);b?e?.(b.type,a.trim()):d(a)},[c,d,e]);return b?(0,i.jsxs)("div",{ref:p,className:"absolute bottom-full left-0 mb-2 w-72 bg-popover border border-border rounded-lg shadow-lg z-50 max-h-[70vh] overflow-y-auto",children:[(0,i.jsx)(a6,{label:f("console.globalCommands"),commands:g,isAdding:"global"===n,onStartAdd:()=>o("global"),onAdd:(a,b)=>{q([...g,{name:a,command:b}]),o(null)},onCancelAdd:()=>o(null),onDelete:a=>q(g.filter((b,c)=>c!==a)),onExecute:s}),(0,i.jsx)("div",{className:"border-t border-border"}),(0,i.jsx)(a6,{label:f("console.projectCommands"),commands:l,isAdding:"project"===n,onStartAdd:()=>o("project"),onAdd:(a,b)=>{r([...l,{name:a,command:b}]),o(null)},onCancelAdd:()=>o(null),onDelete:a=>r(l.filter((b,c)=>c!==a)),onExecute:s})]}):null}function a8({cwd:a,currentCwd:b,commandHistoryRef:c,gridLayout:d,onGridLayoutChange:e,onExecute:f,onAddPluginItem:g,onShowEnvManager:h,onOpenZsh:l,onOpenNote:m}){let{t:n}=(0,k.Bd)(),[o,p]=(0,j.useState)(""),[q,r]=(0,j.useState)(-1),[s,t]=(0,j.useState)(""),[u,v]=(0,j.useState)([]),[w,x]=(0,j.useState)(0),[y,z]=(0,j.useState)(!1),[A,B]=(0,j.useState)(!1),[C,D]=(0,j.useState)([]),[E,F]=(0,j.useState)(!1),[G,H]=(0,j.useState)(0),I=(0,j.useRef)(null),N=(0,j.useRef)(null),O=(0,j.useRef)(!1),{projectCommands:P,globalCommands:Q,expandCustomCommand:R,loadQuickCommands:S}=function(a){let[b,c]=(0,j.useState)([]),[d,e]=(0,j.useState)([]),f=(0,j.useCallback)(async()=>{try{let[b,d]=await Promise.all([fetch(`/api/services/config?cwd=${encodeURIComponent(a)}`),fetch("/api/services/config?scope=global")]);if(b.ok){let a=await b.json();c(a.customCommands||[])}if(d.ok){let a=await d.json();e(a.customCommands||[])}}catch{}},[a]),g=[...b,...d],h=(0,j.useCallback)(a=>{let c=a.trim().split(/\s+/),e=c[0];if(!e.startsWith("/")||e.length<=1)return null;let f=e.slice(1),g=b.find(a=>a.name===f)??d.find(a=>a.name===f);return g?g.command+(c.length>1?" "+c.slice(1).join(" "):""):null},[b,d]);return{quickCustomCommands:g,projectCommands:b,globalCommands:d,expandCustomCommand:h,loadQuickCommands:f}}(a),T=(0,j.useCallback)(a=>{F(!1);let b=a.command,c=ai(b);c?g?.(c.type,b.trim()):f(b),p("")},[f,g]),U=(0,j.useCallback)(a=>{if(a.preventDefault(),O.current||!o.trim())return;let b=R(o)??o,c=ai(b);c?g?.(c.type,b.trim()):f(b),p(""),r(-1),t("")},[o,f,g,R]),V=(0,j.useCallback)(async()=>{if(!I.current)return;let a=I.current.selectionStart||0;try{let c=await fetch("/api/terminal/autocomplete",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({cwd:b,input:o,cursorPosition:a})});if(c.ok){let a=await c.json();if(a.suggestions&&a.suggestions.length>0&&(v(a.suggestions),x(0),z(!0),1===a.suggestions.length)){let b=o.substring(0,a.replaceStart),c=o.substring(a.replaceEnd),d=b+a.suggestions[0]+c;p(d),z(!1),setTimeout(()=>{if(I.current){let b=a.replaceStart+a.suggestions[0].length;I.current.setSelectionRange(b,b)}},0)}}}catch(a){console.error("Autocomplete error:",a)}},[b,o]),W=(0,j.useCallback)(a=>{if(!I.current)return;let b=I.current.selectionStart||0,c=o.substring(0,b),d=o.substring(b),e=c.split(/\s+/),f=b-(e[e.length-1]||"").length;p(o.substring(0,f)+a+d),z(!1),setTimeout(()=>{if(I.current){let b=f+a.length;I.current.setSelectionRange(b,b)}},0)},[o]),X=(0,j.useCallback)(a=>{if(a.nativeEvent.isComposing)return;if(E&&C.length>0){if("ArrowUp"===a.key){a.preventDefault(),H(a=>(a-1+C.length)%C.length);return}if("ArrowDown"===a.key){a.preventDefault(),H(a=>(a+1)%C.length);return}if("Tab"===a.key||"Enter"===a.key){a.preventDefault(),T(C[G]);return}if("Escape"===a.key){a.preventDefault(),F(!1);return}}if("Tab"===a.key){if(a.preventDefault(),y&&u.length>0){let a=(w+1)%u.length;x(a),W(u[a])}else V();return}if("Escape"===a.key&&y){a.preventDefault(),z(!1);return}let b=c.current;if(b&&0!==b.length){if("ArrowUp"===a.key){a.preventDefault(),-1===q&&t(o);let c=-1===q?b.length-1:Math.max(0,q-1);r(c),p(b[c])}else if("ArrowDown"===a.key){if(a.preventDefault(),-1===q)return;let c=q+1;c>=b.length?(r(-1),p(s)):(r(c),p(b[c]))}}},[q,o,s,y,u,w,V,W,E,C,G,T,c]);return(0,i.jsx)("div",{className:"border-t border-border p-4",children:(0,i.jsxs)("form",{onSubmit:U,className:"relative flex gap-2 items-center",children:[(0,i.jsxs)("div",{className:"relative",children:[(0,i.jsx)("button",{type:"button",onClick:()=>{A||S(),B(!A)},className:`p-2 rounded-lg transition-all ${A?"text-brand bg-brand/10":"text-muted-foreground hover:text-foreground hover:bg-accent active:bg-muted active:scale-95"}`,title:n("console.quickCommands"),children:(0,i.jsx)(J,{className:"w-4 h-4"})}),(0,i.jsx)(a7,{cwd:a,show:A,onClose:()=>B(!1),onExecute:f,onAddPluginItem:g})]}),m&&(0,i.jsx)("button",{type:"button",onClick:m,className:"p-2 text-muted-foreground hover:text-foreground hover:bg-accent active:bg-muted active:scale-95 rounded-lg transition-all",title:n("chat.projectNotes"),children:(0,i.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,i.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M11 5H6a2 2 0 00-2 2v11a2 2 0 002 2h11a2 2 0 002-2v-5m-1.414-9.414a2 2 0 112.828 2.828L11.828 15H9v-2.828l8.586-8.586z"})})}),(0,i.jsx)("button",{type:"button",onClick:()=>e(!d),className:`p-2 rounded-lg transition-all ${d?"text-brand bg-brand/10":"text-muted-foreground hover:text-foreground hover:bg-accent active:bg-muted active:scale-95"}`,title:d?n("console.singleColumn"):n("console.dualColumn"),children:d?(0,i.jsx)(K,{className:"w-4 h-4"}):(0,i.jsx)(L,{className:"w-4 h-4"})}),(0,i.jsx)("button",{type:"button",onClick:h,className:"p-2 text-muted-foreground hover:text-foreground hover:bg-accent active:bg-muted active:scale-95 rounded-lg transition-all",title:n("console.envVars"),children:(0,i.jsx)(M,{className:"w-4 h-4"})}),(0,i.jsx)("button",{type:"button",onClick:l,className:"p-2 text-muted-foreground hover:text-foreground hover:bg-accent active:bg-muted active:scale-95 rounded-lg transition-all",title:n("console.launchZsh"),children:(0,i.jsxs)("svg",{className:"w-4 h-4",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",children:[(0,i.jsx)("polyline",{points:"4 17 10 11 4 5"}),(0,i.jsx)("line",{x1:"12",y1:"19",x2:"20",y2:"19"})]})}),(0,i.jsx)("input",{ref:I,type:"text",value:o,onChange:a=>{p(a.target.value),-1!==q&&(r(-1),t("")),z(!1)},onKeyDown:X,onCompositionStart:()=>{O.current=!0},onCompositionEnd:()=>{O.current=!1},placeholder:n("console.inputPlaceholder"),className:"flex-1 px-3 py-2 rounded-lg border border-input bg-background text-sm focus:outline-none focus:ring-2 focus:ring-ring font-mono"}),E&&C.length>0&&(0,i.jsx)("div",{ref:N,className:"absolute bottom-full left-0 right-0 mb-1 max-h-64 overflow-y-auto bg-popover border border-border rounded-lg shadow-lg z-50",children:C.map((a,b)=>(0,i.jsxs)("div",{onClick:()=>T(a),className:`flex items-center gap-3 px-3 py-1.5 cursor-pointer text-sm ${b===G?"bg-brand/10":"hover:bg-accent"}`,children:[(0,i.jsxs)("span",{className:"font-mono font-medium text-foreground",children:["/",a.name]}),(0,i.jsx)("span",{className:"flex-1 text-muted-foreground truncate",children:a.command}),(0,i.jsx)("span",{className:"text-[10px] text-muted-foreground/60 flex-shrink-0",children:"project"===a.scope?n("console.scopeProject"):n("console.scopeGlobal")})]},`${a.scope}-${a.name}`))}),y&&u.length>1&&(0,i.jsxs)("div",{className:"absolute bottom-full left-0 mb-1 bg-popover border border-border rounded-lg shadow-lg max-h-48 overflow-y-auto z-50",children:[(0,i.jsx)("div",{className:"py-1",children:u.map((a,b)=>(0,i.jsx)("button",{type:"button",onClick:()=>W(a),className:`w-full px-3 py-1.5 text-left text-sm font-mono hover:bg-accent transition-colors ${b===w?"bg-accent":""}`,children:a},b))}),(0,i.jsx)("div",{className:"border-t border-border px-3 py-1 text-xs text-muted-foreground",children:n("console.tabSwitchEscClose")})]})]})})}function a9({showTop:a,showBottom:b,onScrollTop:c,onScrollBottom:d}){let{t:e}=(0,k.Bd)();return(0,i.jsxs)(i.Fragment,{children:[a&&(0,i.jsx)("button",{onClick:c,className:"absolute top-2 left-1/2 -translate-x-1/2 p-2 bg-card text-muted-foreground hover:text-foreground shadow-md rounded-full transition-all hover:shadow-lg active:scale-95 z-10",title:e("chat.jumpToStart"),children:(0,i.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,i.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 15l7-7 7 7"})})}),b&&(0,i.jsx)("button",{onClick:d,className:"absolute bottom-20 left-1/2 -translate-x-1/2 p-2 bg-card text-muted-foreground hover:text-foreground shadow-md rounded-full transition-all hover:shadow-lg active:scale-95 z-10",title:e("chat.jumpToLatest"),children:(0,i.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,i.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})})]})}function ba({cwd:a,initialShellCwd:b,tabId:c,onCwdChange:d,onOpenNote:e}){let{t:f}=(0,k.Bd)(),{consoleItems:g,scrollRef:h,selectedCommandId:l,setSelectedCommandId:m,interruptCommand:n,sendStdin:o,deleteCommand:p,rerunCommand:q,ptySizeRef:r,resizePty:s,executeCommand:t,addPluginItem:u,closePluginItem:v,sleepingBubbles:w,handleBubbleSleep:x,handleBubbleWake:y,scrollToBottom:z,currentCwd:A,commandHistoryRef:B,setCustomEnv:C,setAliases:D,saveBubbleOrder:F,hasMoreHistory:G,loadHistory:J,currentPage:K,isLoadingHistory:L}=function({cwd:a,initialShellCwd:b,tabId:c,onCwdChange:d}){let[e,f]=(0,j.useState)([]),[g,h]=(0,j.useState)([]),[i,k]=(0,j.useState)(new Set),[l,m]=(0,j.useState)(b||a),[n,o]=(0,j.useState)(!1),[p,q]=(0,j.useState)(!1),[r,s]=(0,j.useState)(0),[t,u]=(0,j.useState)(null),[v,w]=(0,j.useState)({}),[x,y]=(0,j.useState)({}),[z,A]=(0,j.useState)(null),B=(0,j.useRef)(null),C=(0,j.useRef)(new Map),D=(0,j.useRef)(new Map),E=(0,j.useRef)(new Set),F=(0,j.useRef)([]),G=(0,j.useRef)(new Map),H=(0,j.useRef)(null),I=(0,j.useRef)(null),J=(0,j.useRef)([]),K=(0,j.useRef)(null),L=(0,j.useCallback)(()=>{if(C.current.size>0){let a=new Map(C.current);C.current.clear(),f(b=>b.map(b=>{let c=a.get(b.id);return void 0!==c?{...b,output:c}:b}))}B.current=null},[]),M=(0,j.useCallback)((a,b)=>{let c=(D.current.get(a)||"")+b,d=E.current.has(a)?5242880:2097152;if(c.length>d){let b=function(a,b){let c=a.slice(-b),d=0;if(c.length>0){let a=c.charCodeAt(0);a>=56320&&a<=57343&&(d=1)}let e=Math.min(c.length,64);for(let a=d;a<e;a++){let b=c.charCodeAt(a);if(27===b){d=a;break}if((!(b>=48)||!(b<=63))&&59!==b&&63!==b&&32!==b){b>=64&&b<=126&&(d=a+1);break}}return d>0?c.slice(d):c}(c,d);D.current.set(a,b),C.current.set(a,b)}else D.current.set(a,c),C.current.set(a,c);null===B.current&&(B.current=requestAnimationFrame(L))},[L]),N=(0,j.useCallback)(a=>{D.current.delete(a),E.current.delete(a),C.current.delete(a)},[]),O=(0,j.useCallback)(a=>(null!==B.current&&(cancelAnimationFrame(B.current),B.current=null),L(),D.current.get(a)||""),[L]),P=(0,j.useCallback)(()=>{K.current&&(K.current.scrollTop=K.current.scrollHeight)},[]),Q=(0,j.useCallback)(async(b=0)=>{if(c){o(!0);try{let d=await fetch(`/api/terminal/history?cwd=${encodeURIComponent(a)}&tabId=${encodeURIComponent(c)}&page=${b}&pageSize=100`);if(d.ok){let a=await d.json(),c=[],e=[],g=new Set;for(let b of a.entries){let a=ah(b.type);if(a){let c=a.fromHistory(b);e.push({id:b.id,_type:b.type,timestamp:b.timestamp,...c}),b.sleeping&&g.add(b.id)}else{if(b.running)continue;c.push({id:b.id.includes("-")&&3===b.id.split("-").length?b.id:a3(),command:b.command,output:b.output,exitCode:b.exitCode,isRunning:!1,timestamp:b.timestamp,cwd:b.cwd,usePty:b.usePty})}}0===b?(f(c),h(e),g.size>0&&k(g)):(f(a=>{let b=new Set(a.map(a=>a.id)),d=c.filter(a=>!b.has(a.id));return[...a,...d]}),h(a=>{let b=new Set(a.map(a=>a.id)),c=e.filter(a=>!b.has(a.id));return[...a,...c]})),q(a.hasMore),s(b)}}catch(a){console.error("Failed to load history:",a)}finally{o(!1)}}},[a,c]),R=(0,j.useCallback)(async b=>{if(c)try{await fetch("/api/terminal/history",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({cwd:a,tabId:c,entry:{id:b.id,command:b.command,output:b.output,exitCode:b.exitCode,timestamp:b.timestamp,cwd:l}})})}catch(a){console.error("Failed to save cd history:",a)}},[a,c,l]);(0,j.useCallback)(async b=>{try{let d=await (W||(W=ae(a)));if(b.current)return;for(let e of d){if(c&&e.tabId!==c)continue;if(b.current)break;let d=e.commandId;f(a=>a.find(a=>a.id===d)?a.map(a=>a.id===d?{...a,isRunning:!0,exitCode:void 0,pid:e.pid,...e.usePty?{usePty:!0}:{}}:a):[...a,{id:d,command:e.command,output:"",isRunning:!0,pid:e.pid,timestamp:e.timestamp,cwd:e.cwd,...e.usePty?{usePty:!0}:{}}]),D.current.set(d,""),e.usePty&&E.current.add(d),await aa({commandId:d,projectCwd:a,onData:(a,b)=>{if("pid"===a);else if("stdout"===a||"stderr"===a)M(d,b.data);else if("exit"===a){let a=O(d);N(d),f(c=>c.map(c=>c.id===d?{...c,output:a,exitCode:b.code,isRunning:!1,pid:void 0}:c))}},onError:()=>{f(a=>a.map(a=>a.id===d&&a.isRunning?{...a,isRunning:!1}:a))}})}}catch{}},[a,c,M,O,N]);let S=(0,j.useCallback)(async b=>{let e,g=b.trim().split(/\s+/),h=g[0],i=b;x[h]&&(i=x[h]+(g.length>1?" "+g.slice(1).join(" "):""));let j=ai(i);if(j)return void I.current?.(j.type,i.trim());let k=a3(),n=new Date().toISOString(),o=(e=i.trim().split(/\s+/)[0],a4.has(e)),p={id:k,command:b,output:i!==b?`→ ${i}
20
+ `:"",isRunning:!0,timestamp:n,cwd:l,...o?{usePty:!0}:{}};if(f(a=>a.some(a=>a.id===k)?a:[...a,p]),u(k),D.current.set(k,p.output),o&&E.current.add(k),setTimeout(P,100),i.trim().startsWith("cd ")){let a=i.trim().substring(3).trim(),b=l;a.startsWith("/")?b=a:".."===a?b=l.split("/").slice(0,-1).join("/")||"/":"."!==a&&(b=`${l}/${a}`.replace(/\/+/g,"/")),m(b),d?.(b),f(a=>a.map(a=>{if(a.id===k){let c={...a,output:`Changed directory to: ${b}`,exitCode:0,isRunning:!1};return R(c),c}return a}));return}try{await _({cwd:l,command:i,commandId:k,tabId:c||"",projectCwd:a,env:v,usePty:o,onData:(a,b)=>{if("pid"===a)f(a=>a.map(a=>a.id===k?{...a,pid:b.pid}:a));else if("stdout"===a||"stderr"===a)M(k,b.data);else if("exit"===a){let a=O(k);N(k),f(c=>c.map(c=>c.id===k?{...c,output:a,exitCode:b.code,isRunning:!1,pid:void 0}:c))}},onError:a=>{let b=O(k);N(k),f(c=>c.map(c=>c.id===k?{...c,output:b+`
21
+ Error: ${a}`,exitCode:1,isRunning:!1,pid:void 0}:c))}})}catch(b){let a=O(k);N(k),f(c=>c.map(c=>c.id===k?{...c,output:a+`
22
+ Error: ${b.message}`,exitCode:1,isRunning:!1,pid:void 0}:c))}},[x,l,v,c,a,M,O,N,P,d,R]),T=(0,j.useCallback)(a=>{let b=e.find(b=>b.id===a);b?.isRunning&&b.pid&&ad(b.pid)},[e]),U=(0,j.useCallback)(async b=>{let d=e.find(a=>a.id===b);if(!d)return;d.isRunning&&d.pid&&(ad(d.pid),await new Promise(a=>setTimeout(a,200)));let g=d.command.trim().split(/\s+/),h=g[0],i=d.command;x[h]&&(i=x[h]+(g.length>1?" "+g.slice(1).join(" "):"")),N(b);let j=i!==d.command?`→ ${i}
23
+ `:"";D.current.set(b,j),f(a=>a.map(a=>a.id===b?{...a,output:j,exitCode:void 0,isRunning:!0,pid:void 0}:a));let k=d.usePty||!1,m=G.current.get(b);try{await _({cwd:d.cwd||l,command:i,commandId:b,tabId:c||"",projectCwd:a,env:v,usePty:k,...k&&m?{cols:m.cols,rows:m.rows}:{},onData:(a,c)=>{if("pid"===a)f(a=>a.map(a=>a.id===b?{...a,pid:c.pid}:a));else if("stdout"===a||"stderr"===a)M(b,c.data);else if("exit"===a){let a=O(b);N(b),f(d=>d.map(d=>d.id===b?{...d,output:a,exitCode:c.code,isRunning:!1,pid:void 0}:d))}},onError:a=>{let c=O(b);N(b),f(d=>d.map(d=>d.id===b?{...d,output:c+`
24
+ Error: ${a}`,exitCode:1,isRunning:!1,pid:void 0}:d))}})}catch(c){let a=O(b);N(b),f(d=>d.map(d=>d.id===b?{...d,output:a+`
25
+ Error: ${c.message}`,exitCode:1,isRunning:!1,pid:void 0}:d))}},[e,x,l,v,c,a,M,O,N]),V=(0,j.useCallback)(async b=>{if(f(a=>a.filter(a=>a.id!==b)),N(b),c)try{await fetch(`/api/terminal/history?cwd=${encodeURIComponent(a)}&tabId=${encodeURIComponent(c)}&commandId=${encodeURIComponent(b)}`,{method:"DELETE"})}catch(a){console.error("Failed to delete command:",a)}},[a,c,N]),X=(0,j.useCallback)((b,d,e)=>{var f;let g=ah(b);if(!g)return;let i=g.parse(d);"cwd"in i&&!i.cwd&&(i.cwd=l);let j={id:(f=g.idPrefix,`${f}-${Date.now()}-${Math.random().toString(36).slice(2,8)}`),_type:b,timestamp:new Date().toISOString(),...i};if(h(a=>[...a,j]),u(j.id),setTimeout(P,100),e){let b=z&&z.length>0?[...z]:J.current.map(a=>a.data.id),d=b.indexOf(e);-1!==d?b.splice(d+1,0,j.id):b.push(j.id),A(b),c&&fetch("/api/terminal/bubble-order",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({cwd:a,tabId:c,order:b})}).catch(()=>{})}if(c){let d=g.toHistory(j);fetch("/api/terminal/history",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({cwd:a,tabId:c,entry:{type:b,id:j.id,timestamp:j.timestamp,...d}})}).catch(a=>console.error(`Failed to save ${b} item:`,a))}},[P,a,c,z]),Y=(0,j.useCallback)(async b=>{let d=g.find(a=>a.id===b);if(h(a=>a.filter(a=>a.id!==b)),u(a=>a===b?null:a),k(a=>{let c=new Set(a);return c.delete(b),c}),d){let a=ah(d._type);a?.onClose?.(d)}c&&fetch(`/api/terminal/history?cwd=${encodeURIComponent(a)}&tabId=${encodeURIComponent(c)}&commandId=${encodeURIComponent(b)}`,{method:"DELETE"}).catch(a=>console.error("Failed to delete plugin item:",a))},[g,a,c]);I.current=X,H.current=S;let Z=(0,j.useCallback)((b,d)=>{c&&fetch("/api/terminal/history",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({cwd:a,tabId:c,id:b,fields:{sleeping:d}})}).catch(()=>{})},[a,c]),$=(0,j.useCallback)(a=>{k(b=>new Set(b).add(a)),Z(a,!0)},[Z]),af=(0,j.useCallback)(a=>{k(b=>{let c=new Set(b);return c.delete(a),c}),Z(a,!1)},[Z]),ag=(0,j.useCallback)(async b=>{if(A(b),c)try{await fetch("/api/terminal/bubble-order",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({cwd:a,tabId:c,order:b})})}catch{}},[a,c]),aj=(0,j.useMemo)(()=>{let a=[...e.map(a=>({type:"command",data:a})),...g.map(a=>({type:a._type,data:a}))];if(!z||0===z.length)return a.sort((a,b)=>new Date(a.data.timestamp).getTime()-new Date(b.data.timestamp).getTime());let b=new Map(z.map((a,b)=>[a,b])),c=[],d=[];for(let e of a)b.has(e.data.id)?c.push(e):d.push(e);return c.sort((a,c)=>b.get(a.data.id)-b.get(c.data.id)),d.sort((a,b)=>new Date(a.data.timestamp).getTime()-new Date(b.data.timestamp).getTime()),[...c,...d]},[e,g,z]);return J.current=aj,{commands:e,pluginItems:g,sleepingBubbles:i,consoleItems:aj,currentCwd:l,selectedCommandId:t,setSelectedCommandId:u,customEnv:v,setCustomEnv:w,aliases:x,setAliases:y,isLoadingHistory:n,hasMoreHistory:p,currentPage:r,scrollRef:K,commandHistoryRef:F,ptySizeRef:G,executeCommandRef:H,executeCommand:S,interruptCommand:T,rerunCommand:U,deleteCommand:V,addPluginItem:X,closePluginItem:Y,handleBubbleSleep:$,handleBubbleWake:af,loadHistory:Q,scrollToBottom:P,saveBubbleOrder:ag,sendStdin:ab,resizePty:ac}}({cwd:a,initialShellCwd:b,tabId:c,onCwdChange:d}),[M,N]=(0,j.useState)(null),[O,P]=(0,j.useState)(0),[Q,R]=(0,j.useState)(0),[S,T]=(0,j.useState)(!0),[U,V]=(0,j.useState)(!1),[X,Y]=(0,j.useState)(!1),[Z,$]=(0,j.useState)(!1),[af,ag]=(0,j.useState)(!1),aj=(0,j.useRef)(null),ak=(0,j.useRef)(null),al=(0,j.useRef)(null),am=(0,j.useRef)(!1),an=(0,j.useRef)(null),ao=(0,j.useRef)(null),ap=(0,j.useRef)([]),aq=(0,j.useCallback)(()=>{let a=h.current;return!a||a.scrollHeight-a.scrollTop-a.clientHeight<50},[h]),ar=(0,j.useCallback)(()=>{let a=h.current;return!a||a.scrollTop<50},[h]),as=(0,j.useCallback)(()=>{$(!ar()),ag(!aq())},[aq,ar]),at=(0,j.useCallback)(()=>{ak.current?.scrollIntoView({behavior:"smooth"})},[]),au=async b=>{try{await fetch("/api/project-settings",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({cwd:a,settings:b})})}catch(a){console.error("Failed to save project settings:",a)}},av=(0,j.useCallback)(()=>{am.current=!0},[]),aw=(0,j.useCallback)((a,b)=>{if(!am.current)return void a.preventDefault();am.current=!1,an.current=b,a.dataTransfer.effectAllowed="move",a.dataTransfer.setData("text/plain",b),a.currentTarget.style.opacity="0.4";let c=a.currentTarget.querySelector("[data-drag-handle]");if(c){let b=c.cloneNode(!0);b.style.cssText="position:fixed;top:-9999px;left:-9999px;width:"+c.offsetWidth+"px;background:var(--card);border-radius:8px;padding:4px 12px;opacity:0.9;",document.body.appendChild(b),a.dataTransfer.setDragImage(b,20,16),requestAnimationFrame(()=>document.body.removeChild(b))}},[]),ax=(0,j.useCallback)((a,b)=>{a.preventDefault(),a.dataTransfer.dropEffect="move",ao.current=b},[]),ay=(0,j.useCallback)(a=>{a.preventDefault(),a.currentTarget.classList.add("ring-2","ring-brand")},[]),az=(0,j.useCallback)(a=>{a.currentTarget.classList.remove("ring-2","ring-brand")},[]),aA=(0,j.useCallback)(a=>{a.preventDefault(),a.currentTarget.classList.remove("ring-2","ring-brand")},[]),aB=(0,j.useCallback)(a=>{a.currentTarget.style.opacity="1";let b=an.current,c=ao.current;if(an.current=null,ao.current=null,!b||!c||b===c)return;let d=ap.current.map(a=>a.data.id),e=d.indexOf(b),f=d.indexOf(c);if(-1===e||-1===f)return;let g=[...d];g[e]=c,g[f]=b,F(g)},[F]),aC=(0,j.useCallback)(a=>{N(b=>b===a?null:a)},[]),aD=Q>0?Math.floor((Q-32-12)/2-41):void 0;return(0,i.jsxs)("div",{ref:aj,className:"h-full flex flex-col bg-background relative",children:[(0,i.jsx)("div",{ref:h,onScroll:as,className:`flex-1 overflow-y-auto ${M?"":"py-4 px-4"}`,children:0===g.length?(0,i.jsx)("div",{className:"flex items-center justify-center h-full text-muted-foreground text-sm",children:f("console.enterCommandOrUrl")}):(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)("div",{ref:ak}),G&&(0,i.jsx)("div",{className:"flex justify-center mb-4",children:(0,i.jsx)("button",{onClick:()=>J(K+1),disabled:L,className:"px-4 py-2 text-sm text-muted-foreground hover:text-foreground hover:bg-accent rounded-lg transition-colors disabled:opacity-50",children:f(L?"console.loadingMore":"console.loadMoreHistory")})}),(0,i.jsx)("div",{className:M?"flex flex-col gap-3":S?"grid grid-cols-2 gap-3":"flex flex-col gap-3",children:g.map(b=>{let d={draggable:!0,onDragStart:a=>aw(a,b.data.id),onDragOver:a=>ax(a,b.data.id),onDragEnter:ay,onDragLeave:az,onDrop:aA,onDragEnd:aB};if("command"===b.type){let e=b.data;return(0,i.jsx)("div",{"data-bubble-id":e.id,className:"group/cmd rounded-lg transition-shadow",...d,children:(0,i.jsx)(E,{commandId:e.id,tabId:c,projectCwd:a,command:e.command,output:e.output,exitCode:e.exitCode,isRunning:e.isRunning,selected:l===e.id,onSelect:()=>{m(e.id)},onInterrupt:e.isRunning?()=>n(e.id):void 0,onStdin:e.isRunning?a=>o(e.id,a):void 0,onDelete:()=>{e.isRunning&&e.pid&&ad(e.pid),p(e.id)},onRerun:()=>q(e.id),timestamp:e.timestamp,usePty:e.usePty,onPtyResize:(a,b)=>{r.current.set(e.id,{cols:a,rows:b}),s(e.id,a,b)},onToggleMaximize:()=>aC(e.id),maximized:M===e.id,expandedHeight:O,bubbleContentHeight:aD,onTitleMouseDown:av})},e.id)}let e=ah(b.type);if(!e)return null;let f=e.Component,g=b.data;return(0,i.jsx)("div",{"data-bubble-id":g.id,className:"rounded-lg transition-shadow",...d,children:(0,i.jsx)(f,{item:g,selected:l===g.id,maximized:M===g.id,expandedHeight:O,bubbleContentHeight:aD,timestamp:g.timestamp,onSelect:()=>{m(g.id)},onClose:()=>v(g.id),onToggleMaximize:()=>aC(g.id),onTitleMouseDown:av,extra:{addBrowserItem:(a,b)=>u("browser",a,b),initialSleeping:w.has(g.id),onSleep:x,onWake:y}})},g.id)})}),(0,i.jsx)("div",{ref:al})]})}),!M&&g.length>0&&(0,i.jsx)(a9,{showTop:Z,showBottom:af,onScrollTop:at,onScrollBottom:z}),(0,i.jsx)(a8,{cwd:a,currentCwd:A,commandHistoryRef:B,gridLayout:S,onGridLayoutChange:a=>{T(a),au({gridLayout:a})},onExecute:t,onAddPluginItem:u,onShowEnvManager:()=>V(!0),onOpenZsh:()=>t("zsh"),onOpenNote:e}),U&&(0,i.jsx)(H,{cwd:a,tabId:c,onClose:()=>V(!1),onSave:a=>C(a)}),X&&(0,i.jsx)(I.Y,{onClose:()=>Y(!1),onSave:a=>D(a)})]})}},28354:a=>{"use strict";a.exports=require("util")},29294:a=>{"use strict";a.exports=require("next/dist/server/app-render/work-async-storage.external.js")},31893:(a,b,c)=>{"use strict";c.d(b,{$:()=>q});var d=c(48249),e=c(67484),f=c(44384),g=c(31172),h=c(15273),i=c(46674),j=c(47408);let k=(0,j.A)("square-check-big",[["path",{d:"M21 10.656V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h12.344",key:"2acyp4"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]]),l=(0,j.A)("square",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]]),m=(0,j.A)("circle-dot",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}]]),n=(0,j.A)("pen-line",[["path",{d:"M13 21h8",key:"1jsn5i"}],["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}]]);var o=c(81749);function p(a){let b=a.input?.questions||[],c=a.input?.answers||{},d={};if(a.result)try{let b=JSON.parse(a.result);b?.answers&&(d=b.answers)}catch{}return{questions:b,answers:{...c,...d}}}function q({toolCalls:a,onClose:b}){let{t:c}=(0,f.Bd)(),[j,q]=(0,e.useState)({}),[r,s]=(0,e.useState)({}),[t,u]=(0,e.useState)({}),[v,w]=(0,e.useState)({}),x=a.reduce((a,b)=>{let{questions:c}=p(b);return a+c.length},0),y=Object.values(v).filter(Boolean).length,z=(0,e.useCallback)((a,b)=>{q(c=>({...c,[a]:b})),s(b=>({...b,[a]:!1}))},[]),A=(0,e.useCallback)(a=>{s(b=>{let c=!b[a];if(c){let b=t[a]||"";b&&q(c=>({...c,[a]:b}))}return{...b,[a]:c}})},[t]),B=(0,e.useCallback)((a,b)=>{u(c=>({...c,[a]:b})),b&&q(c=>({...c,[a]:b}))},[]),C=(0,e.useCallback)(a=>{w(b=>({...b,[a]:!b[a]}))},[]),D=(0,e.useCallback)(()=>{let b=y>0,d=[];a.forEach((a,e)=>{let{questions:f}=p(a);f.forEach((a,f)=>{let g=`${e}-${f}`;if(b&&!v[g])return;let h=j[g];d.push(`Q: ${a.question}`),d.push(`A: ${h||c("askQuestion.notSelected")}`),d.push("")})}),navigator.clipboard.writeText(d.join("\n").trim()),(0,o.oR)(b?c("toast.copiedQA",{count:y}):c("toast.copiedAllQA"))},[a,j,v,y,c]),E=(0,d.jsx)("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50 p-4",onClick:b,children:(0,d.jsxs)("div",{className:"bg-card rounded-lg shadow-xl w-full max-w-6xl h-[90vh] flex flex-col overflow-hidden",onClick:a=>a.stopPropagation(),children:[(0,d.jsxs)("div",{className:"flex items-center justify-between px-4 py-3 border-b border-border flex-shrink-0",children:[(0,d.jsxs)("div",{className:"flex items-center gap-3",children:[(0,d.jsx)("h3",{className:"text-sm font-medium text-foreground",children:c("askQuestion.title")}),(0,d.jsxs)("span",{className:"text-xs text-muted-foreground",children:[c("askQuestion.nQuestions",{count:x}),y>0&&` \xb7 ${c("askQuestion.checkedN",{count:y})}`]})]}),(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)("button",{onClick:D,className:"p-1 text-muted-foreground hover:text-foreground hover:bg-accent rounded transition-colors",title:y>0?c("askQuestion.copyChecked",{count:y}):c("askQuestion.copyAll"),children:(0,d.jsx)(h.A,{className:"w-4 h-4"})}),(0,d.jsx)("button",{onClick:b,className:"p-1 text-muted-foreground hover:text-foreground hover:bg-accent rounded transition-colors",children:(0,d.jsx)(i.A,{className:"w-5 h-5"})})]})]}),(0,d.jsx)("div",{className:"flex-1 overflow-y-auto px-6 py-4 space-y-6",children:a.map((b,e)=>{let{questions:f}=p(b);return f.map((b,g)=>{let h=`${e}-${g}`,i=j[h],o=r[h]||!1,p=v[h]||!1;return(0,d.jsxs)("div",{className:"space-y-3",children:[(0,d.jsxs)("div",{className:"flex items-start gap-2",children:[(0,d.jsx)("button",{onClick:()=>C(h),className:"mt-0.5 flex-shrink-0 p-0.5 rounded hover:bg-accent transition-colors",title:c("askQuestion.checkToCopy"),children:p?(0,d.jsx)(k,{className:"w-4 h-4 text-brand"}):(0,d.jsx)(l,{className:"w-4 h-4 text-muted-foreground"})}),b.header&&(0,d.jsx)("span",{className:"inline-flex items-center px-1.5 py-0.5 rounded text-[10px] font-medium bg-brand/10 text-brand flex-shrink-0 mt-0.5",children:b.header}),(0,d.jsx)("span",{className:"text-sm font-medium text-foreground",children:b.question})]}),(0,d.jsxs)("div",{className:"space-y-1 ml-7",children:[b.options.map((a,b)=>{let c=i===a.label&&!o;return(0,d.jsxs)("button",{onClick:()=>z(h,a.label),className:`flex items-start gap-2 px-2.5 py-1.5 rounded-md transition-colors w-full text-left cursor-pointer hover:bg-accent/50 ${c?"bg-brand/10 hover:bg-brand/15":""}`,children:[(0,d.jsx)("div",{className:"mt-0.5 flex-shrink-0",children:c?(0,d.jsx)(m,{className:"w-3.5 h-3.5 text-brand"}):(0,d.jsx)("div",{className:"w-3.5 h-3.5 rounded-full border border-muted-foreground"})}),(0,d.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,d.jsx)("div",{className:`text-sm ${c?"text-foreground font-medium":"text-foreground"}`,children:a.label}),a.description&&(0,d.jsx)("div",{className:"text-xs text-muted-foreground mt-0.5",children:a.description})]})]},b)}),(0,d.jsxs)("button",{onClick:()=>A(h),className:`flex items-start gap-2 px-2.5 py-1.5 rounded-md transition-colors w-full text-left cursor-pointer hover:bg-accent/50 ${o?"bg-brand/10 hover:bg-brand/15":""}`,children:[(0,d.jsx)("div",{className:"mt-0.5 flex-shrink-0",children:o?(0,d.jsx)(m,{className:"w-3.5 h-3.5 text-brand"}):(0,d.jsx)("div",{className:"w-3.5 h-3.5 rounded-full border border-muted-foreground"})}),(0,d.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,d.jsx)(n,{className:"w-3.5 h-3.5 text-muted-foreground"}),(0,d.jsx)("span",{className:"text-sm text-muted-foreground",children:c("askQuestion.custom")})]})]}),o&&(0,d.jsx)("div",{className:"ml-6 mt-1",children:(0,d.jsx)("input",{type:"text",autoFocus:!0,value:t[h]||"",onChange:a=>B(h,a.target.value),placeholder:c("askQuestion.customPlaceholder"),className:"w-full px-3 py-1.5 text-sm bg-background border border-border rounded-md focus:outline-none focus:ring-1 focus:ring-brand text-foreground placeholder:text-muted-foreground"})})]}),(e!==a.length-1||g!==f.length-1)&&(0,d.jsx)("div",{className:"border-b border-border/50 mt-3"})]},h)})})})]})});return(0,d.jsx)(g.Z,{children:E})}},32616:(a,b,c)=>{"use strict";c.d(b,{A:()=>d});let d=(0,c(47408).A)("file-diff",[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M9 10h6",key:"9gxzsh"}],["path",{d:"M12 13V7",key:"h0r20n"}],["path",{d:"M9 17h6",key:"r8uit2"}]])},33740:(a,b,c)=>{"use strict";c.d(b,{A:()=>d});let d=(0,c(47408).A)("circle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]])},33873:a=>{"use strict";a.exports=require("path")},34371:(a,b,c)=>{"use strict";c.d(b,{y:()=>h});var d=c(67484),e=c(95836),f=c(94882),g=c(41564);function h({cwd:a,addToRecentFiles:b}){let[c,h]=(0,d.useState)(null),[i,j]=(0,d.useState)(""),[k,l]=(0,d.useState)([]),[m,n]=(0,d.useState)(null),[o,p]=(0,d.useState)([]),[q,r]=(0,d.useState)([]),[s,t]=(0,d.useState)(new Set),[u,v]=(0,d.useState)(null),[w,x]=(0,d.useState)(null),[y,z]=(0,d.useState)(!1),[A,B]=(0,d.useState)(!1),[C,D]=(0,d.useState)(!1),[E,F]=(0,d.useState)(!0),[G,H]=(0,d.useState)(!1),[I,J]=(0,d.useState)(!1),[K,L]=(0,d.useState)(null),M=(0,d.useRef)(null),[N,O]=(0,d.useState)(null),[P,Q]=(0,d.useState)(!1),[R,S]=(0,d.useState)(""),[T,U]=(0,d.useState)(""),[V,W]=(0,d.useState)([]),[X,Y]=(0,d.useState)([]),[Z,$]=(0,d.useState)(new Set),[_,aa]=(0,d.useState)(null),[ab,ac]=(0,d.useState)(null),[ad,ae]=(0,d.useState)(!1),[af,ag]=(0,d.useState)(!1),ah=(0,d.useCallback)(()=>{z(!0),L(null),fetch(`/api/git/branches?cwd=${encodeURIComponent(a)}`).then(a=>a.json()).then(a=>{a.error?(L("Failed to get branches"===a.error?g.A.t("git.notGitRepo"):a.error),h(null)):a.local&&a.current?(h(a),j(a.current),a.upstream&&U(a.upstream)):(L(g.A.t("git.cannotGetBranches")),h(null))}).catch(a=>{console.error(a),L(g.A.t("git.getBranchesFailed")),h(null)}).finally(()=>z(!1))},[a]),ai=(0,d.useCallback)(b=>{B(!0),n(null),p([]),r([]),v(null),x(null),F(!0),fetch(`/api/git/commits?cwd=${encodeURIComponent(a)}&branch=${encodeURIComponent(b)}&limit=${f.B_}`).then(a=>a.json()).then(a=>{let b=a.commits||[];l(b),F(b.length>=f.B_)}).catch(console.error).finally(()=>B(!1))},[a]),aj=(0,d.useCallback)(()=>{if(C||!E||!i)return;D(!0);let b=k.length;fetch(`/api/git/commits?cwd=${encodeURIComponent(a)}&branch=${encodeURIComponent(i)}&limit=${f.B_}&offset=${b}`).then(a=>a.json()).then(a=>{let b=a.commits||[];b.length>0&&l(a=>[...a,...b]),F(b.length>=f.B_)}).catch(console.error).finally(()=>D(!1))},[a,i,k.length,C,E]),ak=(0,d.useCallback)(a=>{let{scrollTop:b,scrollHeight:c,clientHeight:d}=a.target;c-b-d<100&&aj()},[aj]),al=(0,d.useCallback)(b=>{n(b),v(null),x(null),H(!0),fetch(`/api/git/commit-diff?cwd=${encodeURIComponent(a)}&hash=${b.hash}`).then(a=>a.json()).then(a=>{let b=a.files||[];p(b);let c=(0,e.Do)(b);r(c),t(new Set((0,e.Sz)(c)))}).catch(console.error).finally(()=>H(!1))},[a]),am=(0,d.useCallback)(c=>{m&&(v(c),b(c.path),J(!0),fetch(`/api/git/commit-diff?cwd=${encodeURIComponent(a)}&hash=${m.hash}&file=${encodeURIComponent(c.path)}`).then(a=>a.json()).then(a=>x(a)).catch(console.error).finally(()=>J(!1)))},[a,m,b]),an=(0,d.useCallback)(a=>{t(b=>{let c=new Set(b);return c.has(a)?c.delete(a):c.add(a),c})},[]),ao=(0,d.useCallback)(b=>{ae(!0),aa(null),ac(null),fetch(`/api/git/branch-diff?cwd=${encodeURIComponent(a)}&base=${encodeURIComponent(b)}`).then(a=>a.json()).then(a=>{let b=a.files||[];W(b);let c=(0,e.Do)(b);Y(c),$(new Set((0,e.Sz)(c)))}).catch(console.error).finally(()=>ae(!1))},[a]),ap=(0,d.useCallback)(c=>{aa(c),b(c.path),ag(!0),fetch(`/api/git/branch-diff?cwd=${encodeURIComponent(a)}&base=${encodeURIComponent(i)}&file=${encodeURIComponent(c.path)}`).then(a=>a.json()).then(a=>ac(a)).catch(console.error).finally(()=>ag(!1))},[a,i,b]),aq=(0,d.useCallback)(a=>{$(b=>{let c=new Set(b);return c.has(a)?c.delete(a):c.add(a),c})},[]),ar=(0,d.useCallback)(a=>{if(Q(a),a){S(i);let a=T||"origin/main";j(a),ao(a)}else W([]),Y([]),aa(null),ac(null),R&&(j(R),ai(R))},[i,R,T,ao,ai]);return{branches:c,selectedBranch:i,setSelectedBranch:j,commits:k,setCommits:l,selectedCommit:m,setSelectedCommit:n,historyFiles:o,historyFileTree:q,historyExpandedPaths:s,historySelectedFile:u,historyFileDiff:w,isLoadingBranches:y,isLoadingCommits:A,isLoadingMore:C,hasMoreCommits:E,setHasMoreCommits:F,isLoadingHistoryFiles:G,isLoadingHistoryDiff:I,historyError:K,commitListRef:M,tooltipPos:N,loadBranches:ah,loadCommits:ai,loadMoreCommits:aj,handleCommitListScroll:ak,handleSelectCommit:al,handleSelectHistoryFile:am,handleHistoryToggle:an,handleCommitInfoMouseMove:(0,d.useCallback)(a=>{O({x:a.clientX,y:a.clientY})},[]),handleCommitInfoMouseLeave:(0,d.useCallback)(()=>{O(null)},[]),compareMode:P,toggleCompareMode:ar,compareFiles:V,compareFileTree:X,compareExpandedPaths:Z,compareSelectedFile:_,compareFileDiff:ab,isLoadingCompareFiles:ad,isLoadingCompareDiff:af,handleSelectCompareFile:ap,handleCompareToggle:aq,loadCompareFiles:ao}}},36043:(a,b,c)=>{"use strict";c.d(b,{Te:()=>t});var d=c(67484),e=c(74429);function f(a,b,c){let d,e=c.initialDeps??[],f=!0;function g(){var g,h,i;let j,k;c.key&&(null==(g=c.debug)?void 0:g.call(c))&&(j=Date.now());let l=a();if(!(l.length!==e.length||l.some((a,b)=>e[b]!==a)))return d;if(e=l,c.key&&(null==(h=c.debug)?void 0:h.call(c))&&(k=Date.now()),d=b(...l),c.key&&(null==(i=c.debug)?void 0:i.call(c))){let a=Math.round((Date.now()-j)*100)/100,b=Math.round((Date.now()-k)*100)/100,d=b/16,e=(a,b)=>{for(a=String(a);a.length<b;)a=" "+a;return a};console.info(`%c⏱ ${e(b,5)} /${e(a,5)} ms`,`
26
+ font-size: .6rem;
27
+ font-weight: bold;
28
+ color: hsl(${Math.max(0,Math.min(120-120*d,120))}deg 100% 31%);`,null==c?void 0:c.key)}return(null==c?void 0:c.onChange)&&!(f&&c.skipInitialOnChange)&&c.onChange(d),f=!1,d}return g.updateDeps=a=>{e=a},g}function g(a,b){if(void 0!==a)return a;throw Error(`Unexpected undefined${b?`: ${b}`:""}`)}let h=a=>{let{offsetWidth:b,offsetHeight:c}=a;return{width:b,height:c}},i=a=>a,j=a=>{let b=Math.max(a.startIndex-a.overscan,0),c=Math.min(a.endIndex+a.overscan,a.count-1),d=[];for(let a=b;a<=c;a++)d.push(a);return d},k=(a,b)=>{let c=a.scrollElement;if(!c)return;let d=a.targetWindow;if(!d)return;let e=a=>{let{width:c,height:d}=a;b({width:Math.round(c),height:Math.round(d)})};if(e(h(c)),!d.ResizeObserver)return()=>{};let f=new d.ResizeObserver(b=>{let d=()=>{let a=b[0];if(null==a?void 0:a.borderBoxSize){let b=a.borderBoxSize[0];if(b)return void e({width:b.inlineSize,height:b.blockSize})}e(h(c))};a.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(d):d()});return f.observe(c,{box:"border-box"}),()=>{f.unobserve(c)}},l={passive:!0},m="u"<typeof window||"onscrollend"in window,n=(a,b)=>{var c,d;let e,f=a.scrollElement;if(!f)return;let g=a.targetWindow;if(!g)return;let h=0,i=a.options.useScrollendEvent&&m?()=>void 0:(c=()=>{b(h,!1)},d=a.options.isScrollingResetDelay,function(...a){g.clearTimeout(e),e=g.setTimeout(()=>c.apply(this,a),d)}),j=c=>()=>{let{horizontal:d,isRtl:e}=a.options;h=d?f.scrollLeft*(e&&-1||1):f.scrollTop,i(),b(h,c)},k=j(!0),n=j(!1);f.addEventListener("scroll",k,l);let o=a.options.useScrollendEvent&&m;return o&&f.addEventListener("scrollend",n,l),()=>{f.removeEventListener("scroll",k),o&&f.removeEventListener("scrollend",n)}},o=(a,b,c)=>{if(null==b?void 0:b.borderBoxSize){let a=b.borderBoxSize[0];if(a)return Math.round(a[c.options.horizontal?"inlineSize":"blockSize"])}return a[c.options.horizontal?"offsetWidth":"offsetHeight"]},p=(a,{adjustments:b=0,behavior:c},d)=>{var e,f;null==(f=null==(e=d.scrollElement)?void 0:e.scrollTo)||f.call(e,{[d.options.horizontal?"left":"top"]:a+b,behavior:c})};class q{constructor(a){this.unsubs=[],this.scrollElement=null,this.targetWindow=null,this.isScrolling=!1,this.currentScrollToIndex=null,this.measurementsCache=[],this.itemSizeCache=new Map,this.laneAssignments=new Map,this.pendingMeasuredCacheIndexes=[],this.prevLanes=void 0,this.lanesChangedFlag=!1,this.lanesSettling=!1,this.scrollRect=null,this.scrollOffset=null,this.scrollDirection=null,this.scrollAdjustments=0,this.elementsCache=new Map,this.observer=(()=>{let a=null,b=()=>a||(this.targetWindow&&this.targetWindow.ResizeObserver?a=new this.targetWindow.ResizeObserver(a=>{a.forEach(a=>{let b=()=>{this._measureElement(a.target,a)};this.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(b):b()})}):null);return{disconnect:()=>{var c;null==(c=b())||c.disconnect(),a=null},observe:a=>{var c;return null==(c=b())?void 0:c.observe(a,{box:"border-box"})},unobserve:a=>{var c;return null==(c=b())?void 0:c.unobserve(a)}}})(),this.range=null,this.setOptions=a=>{Object.entries(a).forEach(([b,c])=>{void 0===c&&delete a[b]}),this.options={debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:i,rangeExtractor:j,onChange:()=>{},measureElement:o,initialRect:{width:0,height:0},scrollMargin:0,gap:0,indexAttribute:"data-index",initialMeasurementsCache:[],lanes:1,isScrollingResetDelay:150,enabled:!0,isRtl:!1,useScrollendEvent:!1,useAnimationFrameWithResizeObserver:!1,...a}},this.notify=a=>{var b,c;null==(c=(b=this.options).onChange)||c.call(b,this,a)},this.maybeNotify=f(()=>(this.calculateRange(),[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]),a=>{this.notify(a)},{key:!1,debug:()=>this.options.debug,initialDeps:[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]}),this.cleanup=()=>{this.unsubs.filter(Boolean).forEach(a=>a()),this.unsubs=[],this.observer.disconnect(),this.scrollElement=null,this.targetWindow=null},this._didMount=()=>()=>{this.cleanup()},this._willUpdate=()=>{var a;let b=this.options.enabled?this.options.getScrollElement():null;if(this.scrollElement!==b){if(this.cleanup(),!b)return void this.maybeNotify();this.scrollElement=b,this.scrollElement&&"ownerDocument"in this.scrollElement?this.targetWindow=this.scrollElement.ownerDocument.defaultView:this.targetWindow=(null==(a=this.scrollElement)?void 0:a.window)??null,this.elementsCache.forEach(a=>{this.observer.observe(a)}),this.unsubs.push(this.options.observeElementRect(this,a=>{this.scrollRect=a,this.maybeNotify()})),this.unsubs.push(this.options.observeElementOffset(this,(a,b)=>{this.scrollAdjustments=0,this.scrollDirection=b?this.getScrollOffset()<a?"forward":"backward":null,this.scrollOffset=a,this.isScrolling=b,this.maybeNotify()})),this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0})}},this.getSize=()=>this.options.enabled?(this.scrollRect=this.scrollRect??this.options.initialRect,this.scrollRect[this.options.horizontal?"width":"height"]):(this.scrollRect=null,0),this.getScrollOffset=()=>this.options.enabled?(this.scrollOffset=this.scrollOffset??("function"==typeof this.options.initialOffset?this.options.initialOffset():this.options.initialOffset),this.scrollOffset):(this.scrollOffset=null,0),this.getFurthestMeasurement=(a,b)=>{let c=new Map,d=new Map;for(let e=b-1;e>=0;e--){let b=a[e];if(c.has(b.lane))continue;let f=d.get(b.lane);if(null==f||b.end>f.end?d.set(b.lane,b):b.end<f.end&&c.set(b.lane,!0),c.size===this.options.lanes)break}return d.size===this.options.lanes?Array.from(d.values()).sort((a,b)=>a.end===b.end?a.index-b.index:a.end-b.end)[0]:void 0},this.getMeasurementOptions=f(()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled,this.options.lanes],(a,b,c,d,e,f)=>(void 0!==this.prevLanes&&this.prevLanes!==f&&(this.lanesChangedFlag=!0),this.prevLanes=f,this.pendingMeasuredCacheIndexes=[],{count:a,paddingStart:b,scrollMargin:c,getItemKey:d,enabled:e,lanes:f}),{key:!1}),this.getMeasurements=f(()=>[this.getMeasurementOptions(),this.itemSizeCache],({count:a,paddingStart:b,scrollMargin:c,getItemKey:d,enabled:e,lanes:f},g)=>{if(!e)return this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),[];if(this.laneAssignments.size>a)for(let b of this.laneAssignments.keys())b>=a&&this.laneAssignments.delete(b);this.lanesChangedFlag&&(this.lanesChangedFlag=!1,this.lanesSettling=!0,this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),this.pendingMeasuredCacheIndexes=[]),0!==this.measurementsCache.length||this.lanesSettling||(this.measurementsCache=this.options.initialMeasurementsCache,this.measurementsCache.forEach(a=>{this.itemSizeCache.set(a.key,a.size)}));let h=this.lanesSettling?0:this.pendingMeasuredCacheIndexes.length>0?Math.min(...this.pendingMeasuredCacheIndexes):0;this.pendingMeasuredCacheIndexes=[],this.lanesSettling&&this.measurementsCache.length===a&&(this.lanesSettling=!1);let i=this.measurementsCache.slice(0,h),j=Array(f).fill(void 0);for(let a=0;a<h;a++){let b=i[a];b&&(j[b.lane]=a)}for(let e=h;e<a;e++){let a,f,h=d(e),k=this.laneAssignments.get(e);if(void 0!==k&&this.options.lanes>1){let d=j[a=k],e=void 0!==d?i[d]:void 0;f=e?e.end+this.options.gap:b+c}else{let d=1===this.options.lanes?i[e-1]:this.getFurthestMeasurement(i,e);f=d?d.end+this.options.gap:b+c,a=d?d.lane:e%this.options.lanes,this.options.lanes>1&&this.laneAssignments.set(e,a)}let l=g.get(h),m="number"==typeof l?l:this.options.estimateSize(e),n=f+m;i[e]={index:e,start:f,size:m,end:n,key:h,lane:a},j[a]=e}return this.measurementsCache=i,i},{key:!1,debug:()=>this.options.debug}),this.calculateRange=f(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes],(a,b,c,d)=>this.range=a.length>0&&b>0?function({measurements:a,outerSize:b,scrollOffset:c,lanes:d}){let e=a.length-1;if(a.length<=d)return{startIndex:0,endIndex:e};let f=r(0,e,b=>a[b].start,c),g=f;if(1===d)for(;g<e&&a[g].end<c+b;)g++;else if(d>1){let h=Array(d).fill(0);for(;g<e&&h.some(a=>a<c+b);){let b=a[g];h[b.lane]=b.end,g++}let i=Array(d).fill(c+b);for(;f>=0&&i.some(a=>a>=c);){let b=a[f];i[b.lane]=b.start,f--}f=Math.max(0,f-f%d),g=Math.min(e,g+(d-1-g%d))}return{startIndex:f,endIndex:g}}({measurements:a,outerSize:b,scrollOffset:c,lanes:d}):null,{key:!1,debug:()=>this.options.debug}),this.getVirtualIndexes=f(()=>{let a=null,b=null,c=this.calculateRange();return c&&(a=c.startIndex,b=c.endIndex),this.maybeNotify.updateDeps([this.isScrolling,a,b]),[this.options.rangeExtractor,this.options.overscan,this.options.count,a,b]},(a,b,c,d,e)=>null===d||null===e?[]:a({startIndex:d,endIndex:e,overscan:b,count:c}),{key:!1,debug:()=>this.options.debug}),this.indexFromElement=a=>{let b=this.options.indexAttribute,c=a.getAttribute(b);return c?parseInt(c,10):(console.warn(`Missing attribute name '${b}={index}' on measured element.`),-1)},this._measureElement=(a,b)=>{let c=this.indexFromElement(a),d=this.measurementsCache[c];if(!d)return;let e=d.key,f=this.elementsCache.get(e);f!==a&&(f&&this.observer.unobserve(f),this.observer.observe(a),this.elementsCache.set(e,a)),a.isConnected&&this.resizeItem(c,this.options.measureElement(a,b,this))},this.resizeItem=(a,b)=>{let c=this.measurementsCache[a];if(!c)return;let d=b-(this.itemSizeCache.get(c.key)??c.size);0!==d&&((void 0!==this.shouldAdjustScrollPositionOnItemSizeChange?this.shouldAdjustScrollPositionOnItemSizeChange(c,d,this):c.start<this.getScrollOffset()+this.scrollAdjustments)&&this._scrollToOffset(this.getScrollOffset(),{adjustments:this.scrollAdjustments+=d,behavior:void 0}),this.pendingMeasuredCacheIndexes.push(c.index),this.itemSizeCache=new Map(this.itemSizeCache.set(c.key,b)),this.notify(!1))},this.measureElement=a=>{a?this._measureElement(a,void 0):this.elementsCache.forEach((a,b)=>{a.isConnected||(this.observer.unobserve(a),this.elementsCache.delete(b))})},this.getVirtualItems=f(()=>[this.getVirtualIndexes(),this.getMeasurements()],(a,b)=>{let c=[];for(let d=0,e=a.length;d<e;d++){let e=b[a[d]];c.push(e)}return c},{key:!1,debug:()=>this.options.debug}),this.getVirtualItemForOffset=a=>{let b=this.getMeasurements();if(0!==b.length)return g(b[r(0,b.length-1,a=>g(b[a]).start,a)])},this.getMaxScrollOffset=()=>{if(!this.scrollElement)return 0;if("scrollHeight"in this.scrollElement)return this.options.horizontal?this.scrollElement.scrollWidth-this.scrollElement.clientWidth:this.scrollElement.scrollHeight-this.scrollElement.clientHeight;{let a=this.scrollElement.document.documentElement;return this.options.horizontal?a.scrollWidth-this.scrollElement.innerWidth:a.scrollHeight-this.scrollElement.innerHeight}},this.getOffsetForAlignment=(a,b,c=0)=>{if(!this.scrollElement)return 0;let d=this.getSize(),e=this.getScrollOffset();return"auto"===b&&(b=a>=e+d?"end":"start"),"center"===b?a+=(c-d)/2:"end"===b&&(a-=d),Math.max(Math.min(this.getMaxScrollOffset(),a),0)},this.getOffsetForIndex=(a,b="auto")=>{a=Math.max(0,Math.min(a,this.options.count-1));let c=this.measurementsCache[a];if(!c)return;let d=this.getSize(),e=this.getScrollOffset();if("auto"===b)if(c.end>=e+d-this.options.scrollPaddingEnd)b="end";else{if(!(c.start<=e+this.options.scrollPaddingStart))return[e,b];b="start"}if("end"===b&&a===this.options.count-1)return[this.getMaxScrollOffset(),b];let f="end"===b?c.end+this.options.scrollPaddingEnd:c.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(f,b,c.size),b]},this.isDynamicMode=()=>this.elementsCache.size>0,this.scrollToOffset=(a,{align:b="start",behavior:c}={})=>{"smooth"===c&&this.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size."),this._scrollToOffset(this.getOffsetForAlignment(a,b),{adjustments:void 0,behavior:c})},this.scrollToIndex=(a,{align:b="auto",behavior:c}={})=>{"smooth"===c&&this.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size."),a=Math.max(0,Math.min(a,this.options.count-1)),this.currentScrollToIndex=a;let d=0,e=b=>{if(!this.targetWindow)return;let d=this.getOffsetForIndex(a,b);if(!d)return void console.warn("Failed to get offset for index:",a);let[e,g]=d;this._scrollToOffset(e,{adjustments:void 0,behavior:c}),this.targetWindow.requestAnimationFrame(()=>{let b=()=>{if(this.currentScrollToIndex!==a)return;let b=this.getScrollOffset(),c=this.getOffsetForIndex(a,g);c?1.01>Math.abs(c[0]-b)||f(g):console.warn("Failed to get offset for index:",a)};this.isDynamicMode()?this.targetWindow.requestAnimationFrame(b):b()})},f=b=>{this.targetWindow&&this.currentScrollToIndex===a&&(++d<10?this.targetWindow.requestAnimationFrame(()=>e(b)):console.warn(`Failed to scroll to index ${a} after 10 attempts.`))};e(b)},this.scrollBy=(a,{behavior:b}={})=>{"smooth"===b&&this.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size."),this._scrollToOffset(this.getScrollOffset()+a,{adjustments:void 0,behavior:b})},this.getTotalSize=()=>{var a;let b,c=this.getMeasurements();if(0===c.length)b=this.options.paddingStart;else if(1===this.options.lanes)b=(null==(a=c[c.length-1])?void 0:a.end)??0;else{let a=Array(this.options.lanes).fill(null),d=c.length-1;for(;d>=0&&a.some(a=>null===a);){let b=c[d];null===a[b.lane]&&(a[b.lane]=b.end),d--}b=Math.max(...a.filter(a=>null!==a))}return Math.max(b-this.options.scrollMargin+this.options.paddingEnd,0)},this._scrollToOffset=(a,{adjustments:b,behavior:c})=>{this.options.scrollToFn(a,{behavior:c,adjustments:b},this)},this.measure=()=>{this.itemSizeCache=new Map,this.laneAssignments=new Map,this.notify(!1)},this.setOptions(a)}}let r=(a,b,c,d)=>{for(;a<=b;){let e=(a+b)/2|0,f=c(e);if(f<d)a=e+1;else{if(!(f>d))return e;b=e-1}}return a>0?a-1:0},s="u">typeof document?d.useLayoutEffect:d.useEffect;function t(a){return function({useFlushSync:a=!0,...b}){let c=d.useReducer(()=>({}),{})[1],f={...b,onChange:(d,f)=>{var g;a&&f?(0,e.flushSync)(c):c(),null==(g=b.onChange)||g.call(b,d,f)}},[g]=d.useState(()=>new q(f));return g.setOptions(f),s(()=>g._didMount(),[]),s(()=>g._willUpdate()),g}({observeElementRect:k,observeElementOffset:n,scrollToFn:p,...a})}},36645:(a,b,c)=>{"use strict";c.d(b,{_:()=>i,o:()=>h});var d=c(67484),e=c.n(d),f=c(41564);let g="json-search-highlight-style";function h(a){let[b,c]=(0,d.useState)(!1),[e,f]=(0,d.useState)(""),[h,i]=(0,d.useState)(!1),[j,k]=(0,d.useState)(0),[l,m]=(0,d.useState)(0),n=(0,d.useRef)(null),o=(0,d.useRef)([]);(0,d.useCallback)(()=>{let b;CSS.highlights?.delete("json-search"),CSS.highlights?.delete("json-search-current"),o.current=[];let c=a.current;if(!c||!e){k(0),m(0);return}!function(){if(document.getElementById(g))return;let a=document.createElement("style");a.id=g,a.textContent="::highlight(json-search){background:rgba(217,119,6,.3)}::highlight(json-search-current){background:rgba(217,119,6,.5)}",document.head.appendChild(a)}();let d=c.textContent||"",f=h?e:e.toLowerCase(),i=h?d:d.toLowerCase(),j=[],l=0;for(;l<i.length;){let a=i.indexOf(f,l);if(-1===a)break;j.push([a,a+f.length]),l=a+1}if(0===j.length){k(0),m(0);return}let n=document.createTreeWalker(c,NodeFilter.SHOW_TEXT),p=0,q=0,r=[],s=null,t=0;for(;(b=n.nextNode())&&q<j.length;){let a=b.textContent?.length||0,c=p,d=p+a;for(;q<j.length;){let[a,e]=j[q];if(a>=d)break;if(!s)if(a>=c)(s=document.createRange()).setStart(b,a-c),t=e;else break;if(t<=d)s.setEnd(b,t-c),r.push(s),s=null,q++;else break}p=d}o.current=r,k(r.length),m(a=>r.length>0?Math.min(a,r.length-1):0),CSS.highlights&&r.length>0&&CSS.highlights.set("json-search",new Highlight(...r))},[a,e,h]);let p=(0,d.useCallback)((a,b)=>{let c=a.getBoundingClientRect();(b.top<c.top||b.bottom>c.bottom)&&(a.scrollTop+=b.top-c.top-c.height/2+b.height/2)},[]);(0,d.useCallback)(b=>{CSS.highlights?.delete("json-search-current");let c=o.current[b];if(!c||!CSS.highlights)return;CSS.highlights.set("json-search-current",new Highlight(c));let d=c.getBoundingClientRect(),e=a.current?.parentElement;e&&p(e,d)},[a,p]);let q=(0,d.useCallback)(()=>{0!==j&&m(a=>(a+1)%j)},[j]),r=(0,d.useCallback)(()=>{0!==j&&m(a=>(a-1+j)%j)},[j]),s=(0,d.useCallback)(()=>{c(!0),setTimeout(()=>n.current?.focus(),0)},[]),t=(0,d.useCallback)(()=>{c(!1),f(""),m(0)},[]),u=(0,d.useCallback)(a=>{"Enter"===a.key&&(a.preventDefault(),a.shiftKey?r():q()),"Escape"===a.key&&(a.preventDefault(),t())},[q,r,t]);return{isVisible:b,query:e,setQuery:f,caseSensitive:h,setCaseSensitive:i,matchCount:j,currentIndex:l,searchInputRef:n,open:s,close:t,goToNext:q,goToPrev:r,handleKeyDown:u}}function i({search:a}){return a.isVisible?e().createElement("div",{className:"flex-shrink-0 flex items-center gap-2 px-3 py-2 bg-secondary border-b border-border"},e().createElement("input",{ref:a.searchInputRef,type:"text",value:a.query,onChange:b=>a.setQuery(b.target.value),onKeyDown:a.handleKeyDown,placeholder:f.A.t("codeViewer.searchPlaceholder"),className:"flex-1 max-w-xs px-2 py-1 text-sm border border-border rounded bg-card text-foreground focus:outline-none focus:ring-2 focus:ring-ring"}),e().createElement("button",{onClick:()=>a.setCaseSensitive(a=>!a),className:`px-2 py-1 text-xs font-mono rounded border transition-colors ${a.caseSensitive?"bg-brand text-white border-brand":"border-border text-muted-foreground hover:bg-accent"}`,title:f.A.t("codeViewer.caseSensitive")},"Aa"),e().createElement("span",{className:"text-xs text-muted-foreground"},a.matchCount>0?`${a.currentIndex+1}/${a.matchCount}`:f.A.t("common.noMatch")),e().createElement("button",{onClick:a.goToPrev,disabled:0===a.matchCount,className:"p-1 rounded hover:bg-accent disabled:opacity-50",title:f.A.t("common.previous")},e().createElement("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},e().createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 15l7-7 7 7"}))),e().createElement("button",{onClick:a.goToNext,disabled:0===a.matchCount,className:"p-1 rounded hover:bg-accent disabled:opacity-50",title:f.A.t("common.next")},e().createElement("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},e().createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"}))),e().createElement("button",{onClick:a.close,className:"p-1 rounded hover:bg-accent",title:f.A.t("common.close")},e().createElement("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},e().createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})))):null}},37957:(a,b,c)=>{Promise.resolve().then(c.bind(c,38476))},38476:(a,b,c)=>{"use strict";c.d(b,{TabManager:()=>d});let d=(0,c(77943).registerClientReference)(function(){throw Error("Attempted to call TabManager() from the server but TabManager is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"/home/runner/work/cockpit/cockpit/src/components/project/TabManager.tsx","TabManager")},41025:a=>{"use strict";a.exports=require("next/dist/server/app-render/dynamic-access-async-storage.external.js")},42911:(a,b,c)=>{"use strict";c.d(b,{i:()=>l});var d=c(48249),e=c(67484),f=c(44384),g=c(41564),h=c(23434),i=c(31172),j=c(81749);function k(a){if(0===a.length)return"";let b=[g.A.t("comments.codeRef"),""],c=a.filter(a=>a.filePath===h.Un),d=a.filter(a=>a.filePath!==h.Un);for(let a of(d.length>0&&d.forEach((a,c)=>{b.push(`[${c+1}] ${a.filePath}:${a.startLine}-${a.endLine}`),b.push("```"),b.push(a.codeContent),b.push("```"),a.content&&b.push(g.A.t("comments.note",{content:a.content})),b.push("")}),c)){let c=a.codeContent.split("\n").map(a=>`> ${a}`).join("\n");b.push(c),a.content&&b.push(a.content),b.push("")}return b.join("\n").trim()}function l({isOpen:a,onClose:b,cwd:c,onNavigateToComment:g}){let{t:l}=(0,f.Bd)(),[m,n]=(0,e.useState)([]),[o,p]=(0,e.useState)(!1),[q,r]=(0,e.useState)(null),[s,t]=(0,e.useState)(!1);(0,e.useCallback)(async()=>{if(c){p(!0);try{let a=await fetch(`/api/comments?cwd=${encodeURIComponent(c)}&all=true`);if(a.ok){let b=await a.json();n(b.comments||[])}}catch(a){console.error("Failed to load comments:",a)}finally{p(!1)}}},[c]);let u=async a=>{try{(await fetch(`/api/comments?cwd=${encodeURIComponent(c)}&id=${encodeURIComponent(a)}`,{method:"DELETE"})).ok&&(n(b=>b.filter(b=>b.id!==a)),(0,h.Cm)())}catch(a){console.error("Failed to delete comment:",a)}},v=async a=>{r(a.id);try{let b="";if(a.selectedText)b=a.selectedText;else{let d=await fetch(`/api/files/read?cwd=${encodeURIComponent(c)}&path=${encodeURIComponent(a.filePath)}`);if(!d.ok)throw Error("Failed to read file");b=((await d.json()).content||"").split("\n").slice(a.startLine-1,a.endLine).join("\n")}let d={filePath:a.filePath,startLine:a.startLine,endLine:a.endLine,content:a.content,codeContent:b},e=k([d]);await navigator.clipboard.writeText(e),(0,j.oR)(l("toast.copiedComment"))}catch(a){console.error("Failed to copy comment:",a)}finally{r(null)}},w=async()=>{if(0!==m.length){t(!0);try{let a=await (0,h.$3)(c),b=k(a);await navigator.clipboard.writeText(b),(0,j.oR)(l("toast.copiedAllComments"))}catch(a){console.error("Failed to copy all comments:",a)}finally{t(!1)}}},x=m.reduce((a,b)=>(a[b.filePath]||(a[b.filePath]=[]),a[b.filePath].push(b),a),{});if(!a)return null;let y=(0,d.jsx)("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50 p-4",onClick:b,children:(0,d.jsxs)("div",{className:"w-full max-w-2xl max-h-[80vh] bg-card border border-border rounded-lg shadow-xl flex flex-col overflow-hidden",onClick:a=>a.stopPropagation(),children:[(0,d.jsxs)("div",{className:"flex items-center justify-between px-4 py-3 border-b border-border bg-secondary",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)("h2",{className:"text-lg font-semibold text-foreground",children:l("comments.allComments")}),m.length>0&&(0,d.jsx)("button",{onClick:w,disabled:s,className:"p-1 rounded hover:bg-accent text-muted-foreground disabled:opacity-50",title:l("comments.copyAllComments"),children:s?(0,d.jsx)("span",{className:"inline-block w-4 h-4 border-2 border-current border-t-transparent rounded-full animate-spin"}):(0,d.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,d.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z"})})})]}),(0,d.jsx)("button",{onClick:b,className:"p-1 rounded hover:bg-accent text-muted-foreground",children:(0,d.jsx)("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,d.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),(0,d.jsx)("div",{className:"flex-1 overflow-y-auto p-4",children:o?(0,d.jsx)("div",{className:"flex items-center justify-center py-12 text-muted-foreground",children:l("common.loading")}):0===m.length?(0,d.jsxs)("div",{className:"flex flex-col items-center justify-center py-12 text-muted-foreground",children:[(0,d.jsx)("svg",{className:"w-12 h-12 mb-3 opacity-50",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,d.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"M7 8h10M7 12h4m1 8l-4-4H5a2 2 0 01-2-2V6a2 2 0 012-2h14a2 2 0 012 2v8a2 2 0 01-2 2h-3l-4 4z"})}),(0,d.jsx)("span",{children:l("comments.noComments")})]}):(0,d.jsx)("div",{className:"space-y-4",children:Object.entries(x).map(([a,b])=>(0,d.jsxs)("div",{className:"border border-border rounded-lg overflow-hidden",children:[(0,d.jsxs)("div",{className:"px-3 py-2 bg-secondary border-b border-border",children:[(0,d.jsx)("span",{className:"text-sm font-medium text-foreground font-mono",children:a===h.Un?l("comments.aiReply"):a}),(0,d.jsxs)("span",{className:"ml-2 text-xs text-muted-foreground",children:["(",l("comments.nComments",{count:b.length}),")"]})]}),(0,d.jsx)("div",{className:"divide-y divide-border",children:b.map(a=>{var b;return(0,d.jsx)("div",{className:"px-3 py-2 hover:bg-accent/50 cursor-pointer group",onClick:()=>g?.(a),children:(0,d.jsxs)("div",{className:"flex items-start justify-between gap-2",children:[(0,d.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2 mb-1",children:[a.startLine>0||a.endLine>0?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("span",{className:"text-xs text-brand font-mono",children:[l("common.line")," ",a.startLine===a.endLine?a.startLine:`${a.startLine}-${a.endLine}`]}),(0,d.jsxs)("span",{className:"text-xs text-muted-foreground",children:["(",l("comments.linesCount",{count:a.endLine-a.startLine+1}),")"]})]}):a.selectedText?(0,d.jsxs)("span",{className:"text-xs text-muted-foreground italic truncate max-w-[200px]",children:["“",a.selectedText.slice(0,50),a.selectedText.length>50?"...":"","”"]}):null,(0,d.jsx)("span",{className:"text-xs text-muted-foreground",children:(b=a.updatedAt||a.createdAt)?new Date(b).toLocaleString("zh-CN",{month:"numeric",day:"numeric",hour:"2-digit",minute:"2-digit"}):""})]}),(0,d.jsx)("p",{className:"text-sm text-foreground line-clamp-2",children:a.content||(0,d.jsx)("span",{className:"text-muted-foreground italic",children:l("comments.noContent")})})]}),(0,d.jsx)("button",{onClick:b=>{b.stopPropagation(),v(a)},disabled:q===a.id,className:"p-1 rounded opacity-0 group-hover:opacity-100 hover:bg-accent text-muted-foreground transition-opacity disabled:opacity-50",title:l("common.copy"),children:q===a.id?(0,d.jsx)("span",{className:"inline-block w-4 h-4 border-2 border-current border-t-transparent rounded-full animate-spin"}):(0,d.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,d.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z"})})}),(0,d.jsx)("button",{onClick:b=>{b.stopPropagation(),u(a.id)},className:"p-1 rounded opacity-0 group-hover:opacity-100 hover:bg-accent text-muted-foreground hover:text-red-9 transition-opacity",title:l("common.delete"),children:(0,d.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,d.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"})})})]})},a.id)})})]},a))})}),(0,d.jsxs)("div",{className:"px-4 py-3 border-t border-border bg-secondary flex items-center justify-between",children:[(0,d.jsx)("span",{className:"text-sm text-muted-foreground",children:l("comments.totalComments",{count:m.length})}),(0,d.jsx)("button",{onClick:async()=>{0===m.length||await (0,h.RP)(c)&&n([])},disabled:0===m.length,className:"px-3 py-1.5 text-sm bg-red-9 text-white rounded hover:bg-red-10 disabled:opacity-50 disabled:cursor-not-allowed",children:l("comments.clearAll")})]})]})});return(0,d.jsx)(i.Z,{children:y})}},43501:(a,b,c)=>{"use strict";c.r(b),c.d(b,{GlobalError:()=>C.default,__next_app__:()=>K,handler:()=>M,routeModule:()=>L});var d=c(7553),e=c(84006),f=c(67798),g=c(34775),h=c(99373),i=c(73461),j=c(1020),k=c(26349),l=c(54365),m=c(16023),n=c(63747),o=c(24235),p=c(23938),q=c(261),r=c(66758),s=c(77243),t=c(26713),u=c(37527),v=c(22820),w=c(88216),x=c(47929),y=c(79551),z=c(89125),A=c(86439),B=c(77068),C=c(81227),D=c(61287),E=c(81494),F=c(70722),G=c(70753),H=c(43954),I={};for(let a in D)0>["default","GlobalError","__next_app__","routeModule","handler"].indexOf(a)&&(I[a]=()=>D[a]);c.d(b,I);let J={children:["",{children:["project",{children:["__PAGE__",{},{page:[()=>Promise.resolve().then(c.bind(c,8472)),"/home/runner/work/cockpit/cockpit/src/app/project/page.tsx"]}]},{metadata:{icon:[async a=>(await Promise.resolve().then(c.bind(c,70440))).default(a)],apple:[],openGraph:[],twitter:[],manifest:"/manifest.webmanifest"}}]},{layout:[()=>Promise.resolve().then(c.bind(c,76537)),"/home/runner/work/cockpit/cockpit/src/app/layout.tsx"],"global-error":[()=>Promise.resolve().then(c.bind(c,81227)),"/home/runner/work/cockpit/cockpit/src/app/global-error.tsx"],"not-found":[()=>Promise.resolve().then(c.t.bind(c,55091,23)),"next/dist/client/components/builtin/not-found.js"],forbidden:[()=>Promise.resolve().then(c.t.bind(c,45270,23)),"next/dist/client/components/builtin/forbidden.js"],unauthorized:[()=>Promise.resolve().then(c.t.bind(c,28193,23)),"next/dist/client/components/builtin/unauthorized.js"],metadata:{icon:[async a=>(await Promise.resolve().then(c.bind(c,70440))).default(a)],apple:[],openGraph:[],twitter:[],manifest:"/manifest.webmanifest"}}]}.children,K={require:c,loadChunk:()=>Promise.resolve()},L=new d.AppPageRouteModule({definition:{kind:e.RouteKind.APP_PAGE,page:"/project/page",pathname:"/project",bundlePath:"",filename:"",appPaths:[]},userland:{loaderTree:J},distDir:".next-prod",relativeProjectDir:""});async function M(a,b,d){var I;L.isDev&&(0,h.addRequestMeta)(a,"devRequestTimingInternalsEnd",process.hrtime.bigint());let N=!!(0,h.getRequestMeta)(a,"minimalMode"),O="/project/page";"/index"===O&&(O="/");let P=await L.prepare(a,b,{srcPage:O,multiZoneDraftMode:!1});if(!P)return b.statusCode=400,b.end("Bad Request"),null==d.waitUntil||d.waitUntil.call(d,Promise.resolve()),null;let{buildId:Q,query:R,params:S,pageIsDynamic:T,buildManifest:U,nextFontManifest:V,reactLoadableManifest:W,serverActionsManifest:X,clientReferenceManifest:Y,subresourceIntegrityManifest:Z,prerenderManifest:$,isDraftMode:_,resolvedPathname:aa,revalidateOnlyGenerated:ab,routerServerContext:ac,nextConfig:ad,parsedUrl:ae,interceptionRoutePatterns:af,deploymentId:ag}=P,ah=(0,q.normalizeAppPath)(O),{isOnDemandRevalidate:ai}=P,aj=ad.experimental.ppr&&!ad.cacheComponents&&(0,H.isInterceptionRouteAppPath)(aa)?null:L.match(aa,$),ak=!!$.routes[aa],al=a.headers["user-agent"]||"",am=(0,t.getBotType)(al),an=(0,p.isHtmlBotRequest)(a),ao=(0,h.getRequestMeta)(a,"isPrefetchRSCRequest")??"1"===a.headers[s.NEXT_ROUTER_PREFETCH_HEADER],ap=(0,h.getRequestMeta)(a,"isRSCRequest")??!!a.headers[s.RSC_HEADER],aq=(0,r.getIsPossibleServerAction)(a),ar=(0,m.checkIsAppPPREnabled)(ad.experimental.ppr);if(!(0,h.getRequestMeta)(a,"postponed")&&ar&&"1"===a.headers[x.NEXT_RESUME_HEADER]&&"POST"===a.method){let b=[];for await(let c of a)b.push(c);let c=Buffer.concat(b).toString("utf8");(0,h.addRequestMeta)(a,"postponed",c)}let as=ar&&(null==(I=$.routes[ah]??$.dynamicRoutes[ah])?void 0:I.renderingMode)==="PARTIALLY_STATIC",at=!1,au=!1,av=as?(0,h.getRequestMeta)(a,"postponed"):void 0,aw=as&&ap&&!ao;N&&(aw=aw&&!!av);let ax=(0,h.getRequestMeta)(a,"segmentPrefetchRSCRequest"),ay=(!an||!as)&&(!al||(0,p.shouldServeStreamingMetadata)(al,ad.htmlLimitedBots)),az=!!((aj||ak||$.routes[ah])&&!(an&&as)),aA=as&&!0===ad.cacheComponents,aB=!0===L.isDev||!az||"string"==typeof av||(aA&&(0,h.getRequestMeta)(a,"onCacheEntryV2")?aw&&!N:aw),aC=an&&as,aD=null;_||!az||aB||aq||av||aw||(aD=aa);let aE=aD;!aE&&L.isDev&&(aE=aa),L.isDev||_||!az||!ap||aw||(0,k.d)(a.headers);let aF={...D,tree:J,GlobalError:C.default,handler:M,routeModule:L,__next_app__:K};X&&Y&&(0,o.setManifestsSingleton)({page:O,clientReferenceManifest:Y,serverActionsManifest:X});let aG=a.method||"GET",aH=(0,g.getTracer)(),aI=aH.getActiveScopeSpan(),aJ=async()=>((null==ac?void 0:ac.render404)?await ac.render404(a,b,ae,!1):b.end("This page could not be found"),null);try{let f=L.getVaryHeader(aa,af);b.setHeader("Vary",f);let k=async(c,d)=>{let e=new l.NodeNextRequest(a),f=new l.NodeNextResponse(b);return L.render(e,f,d).finally(()=>{if(!c)return;c.setAttributes({"http.status_code":b.statusCode,"next.rsc":!1});let a=aH.getRootSpanAttributes();if(!a)return;if(a.get("next.span_type")!==i.BaseServerSpan.handleRequest)return void console.warn(`Unexpected root span type '${a.get("next.span_type")}'. Please report this Next.js issue https://github.com/vercel/next.js`);let d=a.get("next.route");if(d){let a=`${aG} ${d}`;c.setAttributes({"next.route":d,"http.route":d,"next.span_name":a}),c.updateName(a)}else c.updateName(`${aG} ${O}`)})},m=(0,h.getRequestMeta)(a,"incrementalCache"),o=async({span:e,postponed:f,fallbackRouteParams:g,forceStaticRender:i})=>{let l={query:R,params:S,page:ah,sharedContext:{buildId:Q},serverComponentsHmrCache:(0,h.getRequestMeta)(a,"serverComponentsHmrCache"),fallbackRouteParams:g,renderOpts:{App:()=>null,Document:()=>null,pageConfig:{},ComponentMod:aF,Component:(0,j.T)(aF),params:S,routeModule:L,page:O,postponed:f,shouldWaitOnAllReady:aC,serveStreamingMetadata:ay,supportsDynamicResponse:"string"==typeof f||aB,buildManifest:U,nextFontManifest:V,reactLoadableManifest:W,subresourceIntegrityManifest:Z,setCacheStatus:null==ac?void 0:ac.setCacheStatus,setIsrStatus:null==ac?void 0:ac.setIsrStatus,setReactDebugChannel:null==ac?void 0:ac.setReactDebugChannel,sendErrorsToBrowser:null==ac?void 0:ac.sendErrorsToBrowser,dir:c(33873).join(process.cwd(),L.relativeProjectDir),isDraftMode:_,botType:am,isOnDemandRevalidate:ai,isPossibleServerAction:aq,assetPrefix:ad.assetPrefix,nextConfigOutput:ad.output,crossOrigin:ad.crossOrigin,trailingSlash:ad.trailingSlash,images:ad.images,previewProps:$.preview,deploymentId:ag,enableTainting:ad.experimental.taint,htmlLimitedBots:ad.htmlLimitedBots,reactMaxHeadersLength:ad.reactMaxHeadersLength,multiZoneDraftMode:!1,incrementalCache:m,cacheLifeProfiles:ad.cacheLife,basePath:ad.basePath,serverActions:ad.experimental.serverActions,...at||au?{nextExport:!0,supportsDynamicResponse:!1,isStaticGeneration:!0,isDebugDynamicAccesses:at}:{},cacheComponents:!!ad.cacheComponents,experimental:{isRoutePPREnabled:as,expireTime:ad.expireTime,staleTimes:ad.experimental.staleTimes,dynamicOnHover:!!ad.experimental.dynamicOnHover,inlineCss:!!ad.experimental.inlineCss,authInterrupts:!!ad.experimental.authInterrupts,clientTraceMetadata:ad.experimental.clientTraceMetadata||[],clientParamParsingOrigins:ad.experimental.clientParamParsingOrigins,maxPostponedStateSizeBytes:(0,B.parseMaxPostponedStateSize)(ad.experimental.maxPostponedStateSize)},waitUntil:d.waitUntil,onClose:a=>{b.on("close",a)},onAfterTaskError:()=>{},onInstrumentationRequestError:(b,c,d,e)=>L.onRequestError(a,b,d,e,ac),err:(0,h.getRequestMeta)(a,"invokeError"),dev:L.isDev}};at&&(l.renderOpts.nextExport=!0,l.renderOpts.supportsDynamicResponse=!1,l.renderOpts.isDebugDynamicAccesses=at),i&&(l.renderOpts.supportsDynamicResponse=!1);let n=await k(e,l),{metadata:o}=n,{cacheControl:p,headers:q={},fetchTags:r,fetchMetrics:s}=o;if(r&&(q[x.NEXT_CACHE_TAGS_HEADER]=r),a.fetchMetrics=s,az&&(null==p?void 0:p.revalidate)===0&&!L.isDev&&!as){let a=o.staticBailoutInfo,b=Object.defineProperty(Error(`Page changed from static to dynamic at runtime ${aa}${(null==a?void 0:a.description)?`, reason: ${a.description}`:""}
29
+ see more here https://nextjs.org/docs/messages/app-static-to-dynamic-error`),"__NEXT_ERROR_CODE",{value:"E132",enumerable:!1,configurable:!0});if(null==a?void 0:a.stack){let c=a.stack;b.stack=b.message+c.substring(c.indexOf("\n"))}throw b}return{value:{kind:u.CachedRouteKind.APP_PAGE,html:n,headers:q,rscData:o.flightData,postponed:o.postponed,status:o.statusCode,segmentData:o.segmentData},cacheControl:p}},p=async({hasResolved:c,previousCacheEntry:f,isRevalidating:g,span:i,forceStaticRender:j=!1})=>{let k,l=!1===L.isDev,q=c||b.writableEnded;if(ai&&ab&&!f&&!N)return(null==ac?void 0:ac.render404)?await ac.render404(a,b):(b.statusCode=404,b.end("This page could not be found")),null;if(aj&&(k=(0,v.parseFallbackField)(aj.fallback)),k===v.FallbackMode.PRERENDER&&(0,t.isBot)(al)&&(!as||an)&&(k=v.FallbackMode.BLOCKING_STATIC_RENDER),(null==f?void 0:f.isStale)===-1&&(ai=!0),ai&&(k!==v.FallbackMode.NOT_FOUND||f)&&(k=v.FallbackMode.BLOCKING_STATIC_RENDER),!N&&k!==v.FallbackMode.BLOCKING_STATIC_RENDER&&aE&&!q&&!_&&T&&(l||!ak)){if((l||aj)&&k===v.FallbackMode.NOT_FOUND){if(ad.experimental.adapterPath)return await aJ();throw new A.NoFallbackError}if(as&&(ad.cacheComponents?!aw:!ap)){let b=l&&"string"==typeof(null==aj?void 0:aj.fallback)?aj.fallback:ah,c=l&&(null==aj?void 0:aj.fallbackRouteParams)?(0,n.createOpaqueFallbackRouteParams)(aj.fallbackRouteParams):au?(0,n.getFallbackRouteParams)(ah,L):null,f=await L.handleResponse({cacheKey:b,req:a,nextConfig:ad,routeKind:e.RouteKind.APP_PAGE,isFallback:!0,prerenderManifest:$,isRoutePPREnabled:as,responseGenerator:async()=>o({span:i,postponed:void 0,fallbackRouteParams:c,forceStaticRender:!1}),waitUntil:d.waitUntil,isMinimalMode:N});if(null===f)return null;if(f)return delete f.cacheControl,f}}let r=ai||g||!av?void 0:av;if(aA&&!N&&m&&aw&&!j){let b=await m.get(aa,{kind:u.IncrementalCacheKind.APP_PAGE,isRoutePPREnabled:!0,isFallback:!1});b&&b.value&&b.value.kind===u.CachedRouteKind.APP_PAGE&&(r=b.value.postponed,b&&(-1===b.isStale||!0===b.isStale)&&(0,G.scheduleOnNextTick)(async()=>{let b=L.getResponseCache(a);try{await b.revalidate(aa,m,as,!1,a=>p({...a,forceStaticRender:!0}),null,c,d.waitUntil)}catch(a){console.error("Error revalidating the page in the background",a)}}))}if(at&&void 0!==r)return{cacheControl:{revalidate:1,expire:void 0},value:{kind:u.CachedRouteKind.PAGES,html:w.default.EMPTY,pageData:{},headers:void 0,status:void 0}};let s=l&&(null==aj?void 0:aj.fallbackRouteParams)&&(0,h.getRequestMeta)(a,"renderFallbackShell")?(0,n.createOpaqueFallbackRouteParams)(aj.fallbackRouteParams):au?(0,n.getFallbackRouteParams)(ah,L):null;return o({span:i,postponed:r,fallbackRouteParams:s,forceStaticRender:j})},q=async c=>{var f,g,i,j,k;let l,m=await L.handleResponse({cacheKey:aD,responseGenerator:a=>p({span:c,...a}),routeKind:e.RouteKind.APP_PAGE,isOnDemandRevalidate:ai,isRoutePPREnabled:as,req:a,nextConfig:ad,prerenderManifest:$,waitUntil:d.waitUntil,isMinimalMode:N});if(_&&b.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate"),L.isDev&&b.setHeader("Cache-Control","no-store, must-revalidate"),!m){if(aD)throw Object.defineProperty(Error("invariant: cache entry required but not generated"),"__NEXT_ERROR_CODE",{value:"E62",enumerable:!1,configurable:!0});return null}if((null==(f=m.value)?void 0:f.kind)!==u.CachedRouteKind.APP_PAGE)throw Object.defineProperty(Error(`Invariant app-page handler received invalid cache entry ${null==(i=m.value)?void 0:i.kind}`),"__NEXT_ERROR_CODE",{value:"E707",enumerable:!1,configurable:!0});let n="string"==typeof m.value.postponed;az&&!aw&&(!n||ao)&&(N||b.setHeader("x-nextjs-cache",ai?"REVALIDATED":m.isMiss?"MISS":m.isStale?"STALE":"HIT"),b.setHeader(s.NEXT_IS_PRERENDER_HEADER,"1"));let{value:q}=m;if(av)l={revalidate:0,expire:void 0};else if(aw)l={revalidate:0,expire:void 0};else if(!L.isDev)if(_)l={revalidate:0,expire:void 0};else if(az){if(m.cacheControl)if("number"==typeof m.cacheControl.revalidate){if(m.cacheControl.revalidate<1)throw Object.defineProperty(Error(`Invalid revalidate configuration provided: ${m.cacheControl.revalidate} < 1`),"__NEXT_ERROR_CODE",{value:"E22",enumerable:!1,configurable:!0});l={revalidate:m.cacheControl.revalidate,expire:(null==(j=m.cacheControl)?void 0:j.expire)??ad.expireTime}}else l={revalidate:x.CACHE_ONE_YEAR,expire:void 0}}else b.getHeader("Cache-Control")||(l={revalidate:0,expire:void 0});if(m.cacheControl=l,"string"==typeof ax&&(null==q?void 0:q.kind)===u.CachedRouteKind.APP_PAGE&&q.segmentData){b.setHeader(s.NEXT_DID_POSTPONE_HEADER,"2");let c=null==(k=q.headers)?void 0:k[x.NEXT_CACHE_TAGS_HEADER];N&&az&&c&&"string"==typeof c&&b.setHeader(x.NEXT_CACHE_TAGS_HEADER,c);let d=q.segmentData.get(ax);return void 0!==d?(0,z.sendRenderResult)({req:a,res:b,generateEtags:ad.generateEtags,poweredByHeader:ad.poweredByHeader,result:w.default.fromStatic(d,s.RSC_CONTENT_TYPE_HEADER),cacheControl:m.cacheControl}):(b.statusCode=204,(0,z.sendRenderResult)({req:a,res:b,generateEtags:ad.generateEtags,poweredByHeader:ad.poweredByHeader,result:w.default.EMPTY,cacheControl:m.cacheControl}))}let r=aA?(0,h.getRequestMeta)(a,"onCacheEntryV2")??(0,h.getRequestMeta)(a,"onCacheEntry"):(0,h.getRequestMeta)(a,"onCacheEntry");if(r&&await r(m,{url:(0,h.getRequestMeta)(a,"initURL")??a.url}))return null;if(q.headers){let a={...q.headers};for(let[c,d]of(N&&az||delete a[x.NEXT_CACHE_TAGS_HEADER],Object.entries(a)))if(void 0!==d)if(Array.isArray(d))for(let a of d)b.appendHeader(c,a);else"number"==typeof d&&(d=d.toString()),b.appendHeader(c,d)}let t=null==(g=q.headers)?void 0:g[x.NEXT_CACHE_TAGS_HEADER];if(N&&az&&t&&"string"==typeof t&&b.setHeader(x.NEXT_CACHE_TAGS_HEADER,t),!q.status||ap&&as||(b.statusCode=q.status),!N&&q.status&&E.RedirectStatusCode[q.status]&&ap&&(b.statusCode=200),n&&!aw&&b.setHeader(s.NEXT_DID_POSTPONE_HEADER,"1"),ap&&!_){if(void 0===q.rscData){if(q.html.contentType!==s.RSC_CONTENT_TYPE_HEADER)if(ad.cacheComponents)return b.statusCode=404,(0,z.sendRenderResult)({req:a,res:b,generateEtags:ad.generateEtags,poweredByHeader:ad.poweredByHeader,result:w.default.EMPTY,cacheControl:m.cacheControl});else throw Object.defineProperty(new F.InvariantError(`Expected RSC response, got ${q.html.contentType}`),"__NEXT_ERROR_CODE",{value:"E789",enumerable:!1,configurable:!0});return(0,z.sendRenderResult)({req:a,res:b,generateEtags:ad.generateEtags,poweredByHeader:ad.poweredByHeader,result:q.html,cacheControl:m.cacheControl})}return(0,z.sendRenderResult)({req:a,res:b,generateEtags:ad.generateEtags,poweredByHeader:ad.poweredByHeader,result:w.default.fromStatic(q.rscData,s.RSC_CONTENT_TYPE_HEADER),cacheControl:m.cacheControl})}let v=q.html;if(!n||N||ap)return(0,z.sendRenderResult)({req:a,res:b,generateEtags:ad.generateEtags,poweredByHeader:ad.poweredByHeader,result:v,cacheControl:m.cacheControl});if(at)return v.push(new ReadableStream({start(a){a.enqueue(y.ENCODED_TAGS.CLOSED.BODY_AND_HTML),a.close()}})),(0,z.sendRenderResult)({req:a,res:b,generateEtags:ad.generateEtags,poweredByHeader:ad.poweredByHeader,result:v,cacheControl:{revalidate:0,expire:void 0}});let A=new TransformStream;return v.push(A.readable),o({span:c,postponed:q.postponed,fallbackRouteParams:null,forceStaticRender:!1}).then(async a=>{var b,c;if(!a)throw Object.defineProperty(Error("Invariant: expected a result to be returned"),"__NEXT_ERROR_CODE",{value:"E463",enumerable:!1,configurable:!0});if((null==(b=a.value)?void 0:b.kind)!==u.CachedRouteKind.APP_PAGE)throw Object.defineProperty(Error(`Invariant: expected a page response, got ${null==(c=a.value)?void 0:c.kind}`),"__NEXT_ERROR_CODE",{value:"E305",enumerable:!1,configurable:!0});await a.value.html.pipeTo(A.writable)}).catch(a=>{A.writable.abort(a).catch(a=>{console.error("couldn't abort transformer",a)})}),(0,z.sendRenderResult)({req:a,res:b,generateEtags:ad.generateEtags,poweredByHeader:ad.poweredByHeader,result:v,cacheControl:{revalidate:0,expire:void 0}})};if(!aI)return await aH.withPropagatedContext(a.headers,()=>aH.trace(i.BaseServerSpan.handleRequest,{spanName:`${aG} ${O}`,kind:g.SpanKind.SERVER,attributes:{"http.method":aG,"http.target":a.url}},q));await q(aI)}catch(b){throw b instanceof A.NoFallbackError||await L.onRequestError(a,b,{routerKind:"App Router",routePath:O,routeType:"render",revalidateReason:(0,f.c)({isStaticGeneration:az,isOnDemandRevalidate:ai})},!1,ac),b}}},43609:(a,b,c)=>{"use strict";c.d(b,{W:()=>f});var d=c(67484),e=c(94882);function f({cwd:a}){let[b,c]=(0,d.useState)([]),[f,g]=(0,d.useState)(null),[h,i]=(0,d.useState)(new Set),[j,k]=(0,d.useState)([]),[l,m]=(0,d.useState)(null),[n,o]=(0,d.useState)(null),[p,q]=(0,d.useState)(new Set),[r,s]=(0,d.useState)(null),[t,u]=(0,d.useState)(""),[v,w]=(0,d.useState)(!1),[x,y]=(0,d.useState)(null),[z,A]=(0,d.useState)(!1),[B,C]=(0,d.useState)(!1),[D,E]=(0,d.useState)(null),F=(0,d.useRef)(null),[G,H]=(0,d.useState)(!1),[I,J]=(0,d.useState)(null),[K,L]=(0,d.useState)("center"),[M,N]=(0,d.useState)(null),[O,P]=(0,d.useState)(null),[Q,R]=(0,d.useState)(!1),[S,T]=(0,d.useState)([]),[U,V]=(0,d.useState)(!1),[W,X]=(0,d.useState)(null),[Y,Z]=(0,d.useState)(null),[$,_]=(0,d.useState)(!1),[aa,ab]=(0,d.useState)(!1),ac=(0,d.useMemo)(()=>j.map(a=>a.path).filter(Boolean),[j]),ad=(0,d.useMemo)(()=>(0,e.v3)(ac),[ac]),ae=(0,d.useMemo)(()=>new Set((0,e.tW)(ad)),[ad]),af=(0,d.useMemo)(()=>t?f?(0,e.KH)(f,t,v):(0,e.q3)(b,t,v):null,[b,f,t,v]),ag=r??p,ah=(0,d.useRef)(null),ai=(0,d.useCallback)(b=>{ah.current&&clearTimeout(ah.current),ah.current=setTimeout(async()=>{try{await fetch("/api/files/expanded",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({cwd:a,paths:Array.from(b)})})}catch(a){console.error("Error saving expanded paths:",a)}},500)},[a]),aj=(0,d.useCallback)(async()=>{A(!0),E(null);try{let b=await fetch(`/api/files/init?cwd=${encodeURIComponent(a)}`),d=await b.json();d.error?E(d.error):(c(d.files||[]),d.expandedPaths&&Array.isArray(d.expandedPaths)&&q(new Set(d.expandedPaths)))}catch(a){console.error("Error loading files:",a),E("Failed to load files")}finally{A(!1)}},[a]),ak=(0,d.useCallback)(async()=>{try{let b=await fetch(`/api/files/index?cwd=${encodeURIComponent(a)}`),c=await b.json();c.paths&&g(c.paths)}catch(a){console.error("Error loading file index:",a)}},[a]),al=(0,d.useCallback)(async b=>{i(a=>new Set([...a,b]));try{let d=await fetch(`/api/files/readdir?cwd=${encodeURIComponent(a)}&path=${encodeURIComponent(b)}`),f=await d.json();f.children&&c(a=>{if(!b){let b=new Map(a.map(a=>[a.path,a]));return f.children.map(a=>{let c=b.get(a.path);return c?.children&&a.isDirectory?{...a,children:c.children}:a})}let c=structuredClone(a),d=(0,e.MB)(c,b);return d&&(d.children=f.children),c})}catch(a){console.error("Error loading directory:",a)}finally{i(a=>{let c=new Set(a);return c.delete(b),c})}},[a]);(0,d.useRef)(h).current=h;let am=(0,d.useCallback)(async()=>{try{let b=await fetch(`/api/files/recent?cwd=${encodeURIComponent(a)}`),c=await b.json();k(c.files||[])}catch(a){console.error("Error loading recent files:",a)}},[a]),an=(0,d.useCallback)(async b=>{k(a=>{let c=a.filter(a=>a.path!==b);return[{path:b},...c].slice(0,15)});try{await fetch("/api/files/recent",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({cwd:a,file:b})})}catch(a){console.error("Error adding to recent files:",a)}},[a]),ao=(0,d.useCallback)((b,c,d,e)=>{k(a=>a.map(a=>a.path===b?{...a,scrollLine:c,cursorLine:d,cursorCol:e}:a)),fetch("/api/files/recent",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({cwd:a,file:b,scrollLine:c,cursorLine:d,cursorCol:e})}).catch(()=>{})},[a]),ap=(0,d.useCallback)(a=>j.find(b=>b.path===a),[j]),aq=(0,d.useCallback)(async b=>{let c=b||l;if(c){V(!0),X(null);try{let b=await fetch(`/api/files/blame?cwd=${encodeURIComponent(a)}&path=${encodeURIComponent(c)}`),d=await b.json();d.error?X(d.error):T(d.blame||[])}catch(a){console.error("Error loading blame:",a),X("Failed to load blame info")}finally{V(!1)}}},[a,l]),ar=(0,d.useCallback)(async b=>{C(!0),o(null),R(!1),T([]),X(null),Z(null);try{let c=await fetch(`/api/files/read?cwd=${encodeURIComponent(a)}&path=${encodeURIComponent(b)}`),d=await c.json();o(d),an(b),aq(b)}catch(a){console.error("Error loading file content:",a),o({type:"error",message:"Failed to load file"})}finally{C(!1)}},[a,an,aq]),as=(0,d.useCallback)(()=>{Q?R(!1):(R(!0),0===S.length&&aq())},[Q,S.length,aq]),at=(0,d.useCallback)((a,b)=>{if(!a)return;if(m(a),J(b??null),null==b){let b=j.find(b=>b.path===a);b?.scrollLine?(J(b.scrollLine),L("start"),N(b.cursorLine??null),P(b.cursorCol??null)):(L("center"),N(null),P(null))}else L("center"),N(null),P(null);ar(a);let c=a.split("/");if(c.length>1){let a=[];for(let b=1;b<c.length;b++)a.push(c.slice(0,b).join("/"));q(b=>{let c=new Set(b),d=!1;for(let b of a)c.has(b)||(c.add(b),d=!0);return d&&ai(c),d?c:b})}},[ar,ai,j]),au=(0,d.useCallback)(a=>{if(r)s(b=>{let c=new Set(b);return c.has(a)?c.delete(a):c.add(a),c});else{let c=!p.has(a);if(q(b=>{let c=new Set(b);return c.has(a)?c.delete(a):c.add(a),ai(c),c}),c){let c=(0,e.MB)(b,a);c&&c.isDirectory&&!c.children&&al(a)}}},[r,ai,p,b,al]);return{files:b,setFiles:c,fileIndex:f,setFileIndex:g,loadingDirs:h,expandedPaths:p,setExpandedPaths:q,searchTreeExpandedPaths:r,setSearchTreeExpandedPaths:s,effectiveExpandedPaths:ag,searchQuery:t,setSearchQuery:u,searchExactMatch:v,setSearchDirExact:w,matchedPaths:af,creatingItem:x,setCreatingItem:y,isLoadingFiles:z,fileError:D,searchInputRef:F,shouldScrollToSelected:G,setShouldScrollToSelected:H,targetLineNumber:I,setTargetLineNumber:J,targetScrollAlign:K,setTargetScrollAlign:L,initialCursorLine:M,initialCursorCol:O,setInitialCursorLine:N,setInitialCursorCol:P,selectedPath:l,setSelectedPath:m,fileContent:n,setFileContent:o,isLoadingContent:B,recentFiles:j,recentFilePaths:ac,setRecentFiles:k,recentFilesTree:ad,recentTreeDirPaths:ae,showBlame:Q,setShowBlame:R,blameLines:S,isLoadingBlame:U,blameError:W,blameSelectedCommit:Y,setBlameSelectedCommit:Z,showMarkdownPreview:$,setShowMarkdownPreview:_,showEditor:aa,setShowEditor:ab,saveExpandedPaths:ai,loadFiles:aj,loadFileIndex:ak,loadDirectory:al,loadRecentFiles:am,addToRecentFiles:an,updateRecentFilePosition:ao,getRecentFilePosition:ap,loadFileContent:ar,loadBlame:aq,handleToggleBlame:as,handleSelectFile:at,handleToggle:au}}},43954:a=>{"use strict";a.exports=require("next/dist/shared/lib/router/utils/interception-routes")},44218:(a,b,c)=>{"use strict";c.d(b,{A:()=>d});let d=(0,c(47408).A)("chevron-down",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]])},45050:(a,b,c)=>{"use strict";function d(a,b){let c=a.split("\n"),d=b.split("\n"),e=[],f=c.length,g=d.length,h=Array(f+1).fill(null).map(()=>Array(g+1).fill(0));for(let a=1;a<=f;a++)for(let b=1;b<=g;b++)c[a-1]===d[b-1]?h[a][b]=h[a-1][b-1]+1:h[a][b]=Math.max(h[a-1][b],h[a][b-1]);let i=f,j=g,k=[];for(;i>0||j>0;)i>0&&j>0&&c[i-1]===d[j-1]?(k.push({type:"unchanged",content:c[i-1],oldLineNum:i,newLineNum:j}),i--,j--):j>0&&(0===i||h[i][j-1]>=h[i-1][j])?(k.push({type:"added",content:d[j-1],newLineNum:j}),j--):(k.push({type:"removed",content:c[i-1],oldLineNum:i}),i--);for(;k.length>0;)e.push(k.pop());return e}c.d(b,{X:()=>d})},45214:(a,b,c)=>{"use strict";c.d(b,{G:()=>h,t:()=>g});var d=c(48249),e=c(67484),f=c(44384);function g({x:a,y:b,range:c,codeContent:g,container:h,onSubmit:i,onClose:j}){let{t:k}=(0,f.Bd)(),[l,m]=(0,e.useState)(""),[n,o]=(0,e.useState)(!1),p=(0,e.useRef)(null),q=(0,e.useRef)(null),[r,s]=(0,e.useState)({x:0,y:0}),t=g?.split("\n").slice(0,5).join("\n"),u=!!g&&g.split("\n").length>5;return(0,d.jsxs)("div",{ref:p,className:"absolute z-[200] w-[640px] bg-card border border-border rounded-lg shadow-lg overflow-hidden",style:{left:r.x,top:r.y},children:[(0,d.jsx)("div",{className:"px-3 py-2 bg-amber-9/10 border-b border-border",children:(0,d.jsxs)("div",{className:"flex items-center justify-between",children:[(0,d.jsx)("span",{className:"text-xs font-medium text-amber-11",children:k("comments.addComment")}),(c.start>0||c.end>0)&&(0,d.jsx)("span",{className:"text-xs text-muted-foreground",children:k("comments.lineRange",{start:c.start,end:c.end})})]})}),g&&(0,d.jsx)("div",{className:"px-3 py-2 bg-secondary/50 border-b border-border max-h-24 overflow-hidden",children:(0,d.jsxs)("pre",{className:"text-xs font-mono text-muted-foreground whitespace-pre-wrap break-all",children:[t,u&&(0,d.jsx)("span",{className:"text-muted-foreground/50",children:"..."})]})}),(0,d.jsxs)("div",{className:"p-2",children:[(0,d.jsx)("textarea",{ref:q,value:l,onChange:a=>m(a.target.value),placeholder:k("comments.inputPlaceholder"),className:"w-full px-2 py-1.5 text-sm border border-border rounded bg-card resize-none focus:outline-none focus:ring-1 focus:ring-ring disabled:opacity-50 disabled:cursor-not-allowed",rows:2,disabled:n,onKeyDown:a=>{"Enter"===a.key&&!a.shiftKey&&!a.nativeEvent.isComposing&&(a.preventDefault(),!n&&l.trim()&&(o(!0),i(l.trim()))),"Escape"!==a.key||n||j()}}),(0,d.jsx)("div",{className:"mt-1 text-xs text-muted-foreground",children:k(n?"comments.submitting":"comments.enterSubmit")})]})]})}function h({x:a,y:b,range:c,filePath:g,codeContent:h,container:i,onSubmit:j,onClose:k,isChatLoading:l}){let{t:m}=(0,f.Bd)(),[n,o]=(0,e.useState)(""),p=(0,e.useRef)(null),q=(0,e.useRef)(null),[r,s]=(0,e.useState)({x:0,y:0}),t=h?.split("\n").slice(0,5).join("\n"),u=!!h&&h.split("\n").length>5;return(0,d.jsxs)("div",{ref:p,className:"absolute z-[200] w-[640px] bg-card border border-border rounded-lg shadow-lg overflow-hidden",style:{left:r.x,top:r.y},children:[(0,d.jsxs)("div",{className:"px-3 py-2 bg-brand/10 border-b border-border",children:[(0,d.jsxs)("div",{className:"flex items-center justify-between",children:[(0,d.jsx)("span",{className:"text-xs font-medium text-brand",children:m("comments.askAI")}),(c.start>0||c.end>0)&&(0,d.jsx)("span",{className:"text-xs text-muted-foreground",children:m("comments.lineRange",{start:c.start,end:c.end})})]}),g&&(0,d.jsx)("div",{className:"mt-1 text-xs text-muted-foreground truncate",children:g})]}),h&&(0,d.jsx)("div",{className:"px-3 py-2 bg-secondary/50 border-b border-border max-h-24 overflow-hidden",children:(0,d.jsxs)("pre",{className:"text-xs font-mono text-muted-foreground whitespace-pre-wrap break-all",children:[t,u&&(0,d.jsx)("span",{className:"text-muted-foreground/50",children:"..."})]})}),(0,d.jsxs)("div",{className:"p-2",children:[(0,d.jsx)("textarea",{ref:q,value:n,onChange:a=>o(a.target.value),placeholder:m("comments.inputQuestion"),className:"w-full px-2 py-1.5 text-sm border border-border rounded bg-card resize-none focus:outline-none focus:ring-1 focus:ring-ring disabled:opacity-50 disabled:cursor-not-allowed",rows:2,disabled:l,onKeyDown:a=>{"Enter"===a.key&&!a.shiftKey&&!a.nativeEvent.isComposing&&(a.preventDefault(),!l&&n.trim()&&(j(n.trim()),k())),"Escape"===a.key&&k()}}),(0,d.jsx)("div",{className:"mt-1 text-xs text-muted-foreground",children:m(l?"comments.aiGenerating":"comments.enterSend")})]})]})}},45832:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{D:()=>k});var e=c(48249),f=c(67484),g=c(44384),h=c(46674),i=c(5811),j=a([i]);function k({results:a,loading:b,totalMatches:c,onSelect:d,onClose:i}){let{t:j}=(0,g.Bd)(),k=function(a){let[b,c]=(0,f.useState)(new Map),[d,e]=(0,f.useState)(!1);return(0,f.useRef)(0),b}(0);return(0,e.jsxs)("div",{className:"border-t border-border bg-secondary flex flex-col",style:{height:"300px"},children:[(0,e.jsxs)("div",{className:"flex items-center justify-between px-3 py-1.5 bg-card/50 border-b border-border flex-shrink-0",children:[(0,e.jsxs)("span",{className:"text-xs font-medium text-foreground",children:[j("searchResults.title")," ",!b&&j("searchResults.nMatches",{count:c})]}),(0,e.jsx)("button",{onClick:i,className:"p-0.5 rounded hover:bg-accent text-muted-foreground",children:(0,e.jsx)(h.A,{className:"w-3.5 h-3.5"})})]}),(0,e.jsx)("div",{className:"flex-1 overflow-auto",children:b?(0,e.jsx)("div",{className:"px-3 py-2 text-xs text-muted-foreground",children:j("searchResults.searching")}):0===a.length?(0,e.jsx)("div",{className:"px-3 py-2 text-xs text-muted-foreground",children:j("searchResults.noResults")}):a.map(a=>(0,e.jsxs)("div",{children:[(0,e.jsx)("div",{className:"px-3 py-1 text-xs text-muted-foreground font-medium bg-card/30 sticky top-0",children:a.path}),a.matches.map((b,c)=>{let f=`${a.path}:${b.lineNumber}`,g=k.get(f);return(0,e.jsxs)("button",{onClick:()=>d(a.path,b.lineNumber),className:"w-full text-left px-3 py-0.5 hover:bg-accent/50 flex items-baseline gap-2 group",children:[(0,e.jsx)("span",{className:"text-sm text-muted-foreground font-mono font-variant-tabular flex-shrink-0 w-10 text-right",children:b.lineNumber}),g?(0,e.jsx)("span",{className:"text-sm font-mono truncate",dangerouslySetInnerHTML:{__html:g}}):(0,e.jsx)("span",{className:"text-sm font-mono text-foreground truncate",children:b.content||""})]},`${b.lineNumber}-${c}`)})]},a.path))})]})}i=(j.then?(await j)():j)[0],d()}catch(a){d(a)}})},46674:(a,b,c)=>{"use strict";c.d(b,{A:()=>d});let d=(0,c(47408).A)("x",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]])},47033:(a,b,c)=>{"use strict";c.d(b,{_:()=>e});var d=c(67484);function e({cwd:a,filePath:b}){let[c,e]=(0,d.useState)([]),[f,g]=(0,d.useState)(!1),[h,i]=(0,d.useState)(null),j=(0,d.useCallback)(async()=>{if(a&&b){g(!0),i(null);try{let c=await fetch(`/api/comments?cwd=${encodeURIComponent(a)}&filePath=${encodeURIComponent(b)}`);if(c.ok){let a=await c.json();e(a.comments||[])}else i("Failed to load comments")}catch(a){i(a instanceof Error?a.message:"Unknown error")}finally{g(!1)}}},[a,b]),k=(0,d.useCallback)(async(c,d,f,g)=>{try{let h=await fetch("/api/comments",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({cwd:a,filePath:b,startLine:c,endLine:d,content:f,...g?{selectedText:g}:{}})});if(h.ok){let a=await h.json();return e(b=>[...b,a.comment]),a.comment}}catch(a){console.error("Failed to add comment:",a)}return null},[a,b]),l=(0,d.useCallback)(async(b,c)=>{try{let d=await fetch("/api/comments",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({cwd:a,id:b,content:c})});if(d.ok){let a=await d.json();return e(c=>c.map(c=>c.id===b?a.comment:c)),!0}}catch(a){console.error("Failed to update comment:",a)}return!1},[a]),m=(0,d.useCallback)(async b=>{try{if((await fetch(`/api/comments?cwd=${encodeURIComponent(a)}&id=${encodeURIComponent(b)}`,{method:"DELETE"})).ok)return e(a=>a.filter(a=>a.id!==b)),!0}catch(a){console.error("Failed to delete comment:",a)}return!1},[a]),n=(0,d.useCallback)(a=>c.filter(b=>a>=b.startLine&&a<=b.endLine),[c]);return{comments:c,isLoading:f,error:h,addComment:k,updateComment:l,deleteComment:m,refresh:j,getCommentsForLine:n}}c(23434)},47237:(a,b,c)=>{"use strict";c.d(b,{Q:()=>e});var d=c(67484);function e(){let a=(0,d.useRef)([]),b=(0,d.useRef)([]),c=(0,d.useCallback)(c=>{a.current.push(c),a.current.length>50&&(a.current=a.current.slice(-50)),b.current=[]},[]),e=(0,d.useCallback)(c=>{if(0===a.current.length)return null;let d=a.current.pop();return b.current.push(c),b.current.length>50&&(b.current=b.current.slice(-50)),d},[]),f=(0,d.useCallback)(c=>{if(0===b.current.length)return null;let d=b.current.pop();return a.current.push(c),a.current.length>50&&(a.current=a.current.slice(-50)),d},[]);return{push:c,goBack:e,goForward:f,canGoBack:(0,d.useCallback)(()=>a.current.length>0,[]),canGoForward:(0,d.useCallback)(()=>b.current.length>0,[])}}},47408:(a,b,c)=>{"use strict";c.d(b,{A:()=>i});var d=c(67484);let e=(...a)=>a.filter((a,b,c)=>!!a&&""!==a.trim()&&c.indexOf(a)===b).join(" ").trim(),f=a=>{let b=a.replace(/^([A-Z])|[\s-_]+(\w)/g,(a,b,c)=>c?c.toUpperCase():b.toLowerCase());return b.charAt(0).toUpperCase()+b.slice(1)};var g={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};let h=(0,d.forwardRef)(({color:a="currentColor",size:b=24,strokeWidth:c=2,absoluteStrokeWidth:f,className:h="",children:i,iconNode:j,...k},l)=>(0,d.createElement)("svg",{ref:l,...g,width:b,height:b,stroke:a,strokeWidth:f?24*Number(c)/Number(b):c,className:e("lucide",h),...!i&&!(a=>{for(let b in a)if(b.startsWith("aria-")||"role"===b||"title"===b)return!0;return!1})(k)&&{"aria-hidden":"true"},...k},[...j.map(([a,b])=>(0,d.createElement)(a,b)),...Array.isArray(i)?i:[i]])),i=(a,b)=>{let c=(0,d.forwardRef)(({className:c,...g},i)=>(0,d.createElement)(h,{ref:i,iconNode:b,className:e(`lucide-${f(a).replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}`,`lucide-${a}`,c),...g}));return c.displayName=f(a),c}},48464:(a,b,c)=>{"use strict";c.d(b,{V:()=>h});var d=c(48249);c(67484);var e=c(69005),f=c(44384);function g({number:a,isActive:b}){return(0,d.jsxs)("svg",{className:`w-5 h-5 flex-shrink-0 ${b?"text-brand":"text-muted-foreground"}`,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,children:[(0,d.jsx)("circle",{cx:"12",cy:"12",r:"9"}),(0,d.jsx)("text",{x:"12",y:"16",textAnchor:"middle",fill:"currentColor",stroke:"none",fontSize:"12",fontWeight:"500",children:a})]})}function h({tabs:a,activeTabId:b,unreadTabs:c,dragTabIndex:h,dragOverTabIndex:i,isPinned:j,onTogglePin:k,onSwitchTab:l,onCloseTab:m,onNewTab:n,onDragStart:o,onDragOver:p,onDrop:q,onDragEnd:r}){let{t:s}=(0,f.Bd)();return(0,d.jsx)("div",{className:"border-b border-border bg-card shrink-0",children:(0,d.jsxs)("div",{className:"flex items-center px-2 gap-1 overflow-x-auto",children:[a.map((f,n)=>(0,d.jsx)(e.m,{content:f.title,delay:200,children:(0,d.jsxs)("div",{draggable:!0,onDragStart:()=>o(n),onDragOver:a=>p(a,n),onDrop:()=>q(n),onDragEnd:r,className:`group flex items-center gap-1 px-3 py-1.5 text-sm cursor-pointer rounded-t-lg transition-colors ${f.id===b?"bg-accent text-foreground":"text-muted-foreground hover:bg-secondary"} ${h===n?"opacity-50":""} ${i===n?"border-l-2 border-brand":""}`,onClick:()=>l(f.id),children:[(0,d.jsxs)("div",{className:"relative flex-shrink-0",children:[(0,d.jsx)(g,{number:n+1,isActive:f.id===b}),f.isLoading&&(0,d.jsx)("span",{className:"absolute -top-0.5 -right-0.5 w-2 h-2 rounded-full bg-orange-9 animate-pulse"}),!f.isLoading&&c.has(f.id)&&f.id!==b&&(0,d.jsx)("span",{className:"absolute -top-0.5 -right-0.5 w-2 h-2 rounded-full bg-red-500"}),k&&j?.(f.id)&&!f.isLoading&&!(c.has(f.id)&&f.id!==b)&&(0,d.jsx)("button",{onClick:a=>{a.stopPropagation(),k(f.id)},className:"absolute -top-1 -right-1 w-3.5 h-3.5 flex items-center justify-center rounded-full bg-card text-amber-500 hover:text-destructive transition-colors",title:s("tabBar.unpin"),children:(0,d.jsx)("svg",{className:"w-2.5 h-2.5",viewBox:"0 0 24 24",fill:"currentColor",children:(0,d.jsx)("path",{d:"M16 4h-2V2h-4v2H8c-.55 0-1 .45-1 1v4l-2 3v2h5.97v7l1 1 1-1v-7H19v-2l-2-3V5c0-.55-.45-1-1-1z"})})}),k&&!j?.(f.id)&&!f.isLoading&&!(c.has(f.id)&&f.id!==b)&&(0,d.jsx)("button",{onClick:a=>{a.stopPropagation(),k(f.id)},className:"absolute -top-1 -right-1 w-3.5 h-3.5 flex items-center justify-center rounded-full bg-card text-muted-foreground opacity-0 group-hover:opacity-60 hover:!opacity-100 hover:!text-brand transition-all",title:s("tabBar.pin"),children:(0,d.jsx)("svg",{className:"w-2.5 h-2.5",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2.5,children:(0,d.jsx)("path",{d:"M16 4h-2V2h-4v2H8c-.55 0-1 .45-1 1v4l-2 3v2h5.97v7l1 1 1-1v-7H19v-2l-2-3V5c0-.55-.45-1-1-1z"})})})]}),(0,d.jsx)("span",{className:"max-w-32 truncate",children:f.title}),a.length>1&&(0,d.jsx)("button",{onClick:a=>{a.stopPropagation(),m(f.id)},className:"ml-1 p-0.5 rounded hover:bg-muted opacity-0 group-hover:opacity-100 transition-opacity",title:s("tabBar.closeTab"),children:(0,d.jsx)("svg",{className:"w-3 h-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,d.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]})},f.id)),(0,d.jsx)("button",{onClick:n,className:"p-1.5 text-muted-foreground hover:text-foreground hover:bg-accent rounded transition-colors",title:s("tabBar.newTab"),children:(0,d.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,d.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 4v16m8-8H4"})})})]})})}},49681:(a,b,c)=>{"use strict";c.d(b,{A:()=>d});let d=(0,c(47408).A)("circle-check",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]])},52620:(a,b,c)=>{"use strict";c.d(b,{JL:()=>h,Sn:()=>e,Xm:()=>f,po:()=>g});var d=c(67484);function e(a){let[b,c]=(0,d.useState)(!1);return{goToDefinition:(0,d.useCallback)(async(b,d,e)=>{c(!0);try{let c=await fetch("/api/lsp/definition",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({cwd:a,filePath:b,line:d,column:e})});return(await c.json()).definitions||[]}catch(a){return console.error("[useLSP] definition error:",a),[]}finally{c(!1)}},[a]),loading:b}}function f(a){let[b,c]=(0,d.useState)(null),e=(0,d.useRef)(null),f=(0,d.useRef)(null),g=(0,d.useRef)(0),h=(0,d.useRef)(!1),i=(0,d.useRef)(null),j=(0,d.useRef)({x:0,y:0}),k=(0,d.useRef)(!1),l=(0,d.useRef)(null),m=(0,d.useCallback)(()=>{let a=i.current;a&&k.current&&(a.style.pointerEvents="none"),k.current=!1,l.current&&(i.current?.removeEventListener("mouseleave",l.current),l.current=null)},[]),n=(0,d.useCallback)(()=>{let a=i.current;if(!a||k.current)return;k.current=!0,h.current=!0,a.style.pointerEvents="auto";let b=()=>{h.current=!1,m(),g.current++,c(null)};l.current=b,a.addEventListener("mouseleave",b)},[m]),o=(0,d.useCallback)((b,d,h,i)=>{e.current&&clearTimeout(e.current),f.current&&clearTimeout(f.current);let j=++g.current;e.current=setTimeout(async()=>{try{let e=await fetch("/api/lsp/hover",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({cwd:a,filePath:b,line:d,column:h})}),f=await e.json();if(j!==g.current)return;f.hover&&f.hover.displayString&&c({...f.hover,x:i.x,y:i.y,filePath:b,line:d,column:h})}catch{}},300)},[a]),p=(0,d.useCallback)(()=>{e.current&&clearTimeout(e.current),g.current++,f.current=setTimeout(function(){if(h.current)return;let a=i.current;if(a){let b=a.getBoundingClientRect(),{x:c,y:d}=j.current;if(c>=b.left&&c<=b.right&&d>=b.top&&d<=b.bottom)return void n()}c(null)},150)},[n]),q=(0,d.useCallback)(()=>{h.current=!0,f.current&&clearTimeout(f.current)},[]);return{hoverInfo:b,onTokenMouseEnter:o,onTokenMouseLeave:p,onCardMouseEnter:q,onCardMouseLeave:(0,d.useCallback)(()=>{h.current=!1,g.current++,c(null)},[]),clearHover:(0,d.useCallback)(()=>{e.current&&clearTimeout(e.current),f.current&&clearTimeout(f.current),h.current=!1,m(),g.current++,c(null)},[m]),tooltipElRef:i}}function g(a){let[b,c]=(0,d.useState)([]),[e,f]=(0,d.useState)(!1),[g,h]=(0,d.useState)(!1);return{references:b,loading:e,visible:g,findReferences:(0,d.useCallback)(async(b,d,e)=>{f(!0),h(!0);try{let f=await fetch("/api/lsp/references",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({cwd:a,filePath:b,line:d,column:e})}),g=await f.json();c(g.references||[])}catch(a){console.error("[useLSP] references error:",a),c([])}finally{f(!1)}},[a]),closeReferences:(0,d.useCallback)(()=>{h(!1),c([])},[])}}function h(a,b){(0,d.useRef)(null)}c(62862)},54017:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{g:()=>J});var e=c(48249),f=c(67484),g=c(74429),h=c(2868),i=c(86402),j=c(81749),k=c(66254),l=c(95836),m=c(26068),n=c(79029),o=c(56929),p=c(94882),q=c(10164),r=c(66185),s=c(13928),t=c(6440),u=c(99470),v=c(43609),w=c(96666),x=c(86753),y=c(34371),z=c(52620),A=c(47237),B=c(44384),C=c(36645),D=c(62862),E=c(24463),F=c(1906),G=c(45832),H=c(92154),I=a([h,i,n,F,G]);function J({onClose:a,cwd:b,initialTab:c="tree",tabSwitchTrigger:d,initialSearchQuery:I,searchQueryTrigger:J}){let{t:K}=(0,B.Bd)(),{activeView:L}=(0,H.R8)(),[M,N]=(0,f.useState)(c),O=(0,f.useRef)(null),P=(0,f.useRef)(!1),[Q,R]=(0,f.useState)(null),[S,T]=(0,f.useState)(null),[U,V]=(0,f.useState)(!1),[W,X]=(0,f.useState)(null),Y=(0,f.useRef)(1),Z=(0,f.useRef)(null),[$,_]=(0,f.useState)(null),aa=(0,f.useRef)(null),[ab,ac]=(0,f.useState)({isDirty:!1,isSaving:!1}),[ad,ae]=(0,f.useState)(!1),[af,ag]=(0,f.useState)(!1),[ah,ai]=(0,f.useState)(null),aj=(0,f.useRef)(null),ak=(0,C.o)(aj),al=(0,f.useRef)(null),am=(0,C.o)(al),an=(0,z.Sn)(b),ao=(0,z.Xm)(b),ap=(0,z.po)(b),aq=(0,A.Q)(),ar=(0,t.F)(),as=(0,v.W)({cwd:b});(0,z.JL)(b,as.selectedPath);let at=(0,w.p)({cwd:b,onSearchComplete:()=>ae(!0)}),au=(0,x.e)({cwd:b,addToRecentFiles:as.addToRecentFiles}),av=(0,y.y)({cwd:b,addToRecentFiles:as.addToRecentFiles}),aw=(0,f.useCallback)(a=>{as.setFileContent(b=>b?.type==="text"?{...b,content:a}:b)},[as]),ax=(0,f.useCallback)(a=>{as.setShowEditor(!0)},[as]),ay=(0,f.useCallback)(async()=>{if(as.fileContent&&"text"===as.fileContent.type&&as.fileContent.content)try{let a=await fetch("/api/files/save",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({cwd:b,path:as.selectedPath,content:as.fileContent.content})});if(!a.ok)throw Error("Failed to save file");let c=await a.json();c.mtime&&as.setFileContent(a=>a?.type==="text"?{...a,mtime:c.mtime}:a),(0,j.oR)(K("toast.savedSuccess"),"success")}catch{(0,j.oR)(K("toast.saveFailed"),"error")}},[b,as]),az=(0,f.useCallback)(()=>{if(!as.selectedPath)return;let a=Y.current,b=Z.current;a>0&&as.updateRecentFilePosition(as.selectedPath,a,b?b.cursorLine+1:a,b?b.cursorCol+1:1)},[as]),aA=(0,f.useCallback)((a,b)=>{a!==as.selectedPath&&az(),as.handleSelectFile(a,b)},[as,az]),aB=(0,f.useMemo)(()=>{let a=at.contentSearchResults;if(0===a.length)return{files:[],expandDirs:new Set,matchMap:new Map};let b=new Map,c=[];for(let d of a)b.set(d.path,d),c.push(d.path);let d=(0,p.v3)(c),e=new Set((0,p.tW)(d));return{files:d,expandDirs:e,matchMap:b}},[at.contentSearchResults]),[aC,aD]=(0,f.useState)(new Set),aE=(0,f.useCallback)(a=>{aD(b=>{let c=new Set(b);return c.has(a)?c.delete(a):c.add(a),c})},[]),aF=(0,f.useCallback)(a=>{if(a.isDirectory)return null;let b=aB.matchMap.get(a.path);return b?(0,e.jsx)("span",{className:"text-xs text-muted-foreground",children:b.matches.length}):null},[aB.matchMap]),aG=ad&&at.contentSearchResults.length>0,aH=!!as.selectedPath&&null!==(0,D.c)(as.selectedPath),aI=(0,f.useCallback)(async(a,c)=>{if(!as.selectedPath||!aH)return;let d=await an.goToDefinition(as.selectedPath,a,c);if(0===d.length)return;let e=d[0],f=b.endsWith("/")?b:b+"/",g=e.file.startsWith(f)?e.file.slice(f.length):e.file;aq.push({filePath:as.selectedPath,lineNumber:Y.current}),g===as.selectedPath?as.setTargetLineNumber(e.line):aA(g,e.line)},[as,b,aH,an,aq]),aJ=(0,f.useCallback)((a,b,c)=>{as.selectedPath&&aH&&ao.onTokenMouseEnter(as.selectedPath,a,b,c)},[as.selectedPath,aH,ao]),aK=(0,f.useCallback)(a=>{let c=b.endsWith("/")?b:b+"/",d=a.file.startsWith(c)?a.file.slice(c.length):a.file;as.selectedPath&&aq.push({filePath:as.selectedPath,lineNumber:Y.current}),d===as.selectedPath?as.setTargetLineNumber(a.line):aA(d,a.line)},[as,b,aq]),aL=(0,f.useMemo)(()=>{if(!au.status)return null;let a=new Map,b=a=>{switch(a){case"modified":default:return"M";case"added":return"A";case"deleted":return"D";case"renamed":return"R";case"untracked":return"?"}};for(let c of au.status.staged)a.set(c.path,b(c.status));for(let c of au.status.unstaged)a.set(c.path,b(c.status));return a},[au.status]),aM=(0,f.useCallback)(a=>{N(a),as.setBlameSelectedCommit(null),"history"===a&&av.selectedBranch&&av.loadCommits(av.selectedBranch)},[as,av.selectedBranch,av.loadCommits]);(0,f.useCallback)(()=>{if(!as.selectedPath)return;let a={filePath:as.selectedPath,lineNumber:Y.current},b=aq.goBack(a);b&&(b.filePath===as.selectedPath?as.setTargetLineNumber(b.lineNumber):aA(b.filePath,b.lineNumber))},[as,aq]),(0,f.useCallback)(()=>{if(!as.selectedPath)return;let a={filePath:as.selectedPath,lineNumber:Y.current},b=aq.goForward(a);b&&(b.filePath===as.selectedPath?as.setTargetLineNumber(b.lineNumber):aA(b.filePath,b.lineNumber))},[as,aq]);let aN=(0,f.useCallback)(async a=>{let c=a.split("/").pop()||a;try{await fetch("/api/files/clipboard",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({cwd:b,path:a})}),(0,j.oR)(K("toast.copiedName",{name:c}),"success")}catch{(0,j.oR)(K("toast.copyFailed"),"error")}},[b]),aO=(0,f.useCallback)(async a=>{try{let c=await fetch("/api/files/clipboard"),d=await c.json();if(!d.path)return void(0,j.oR)(K("toast.noFileToPaste"),"info");let e=await fetch("/api/files/paste",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({cwd:b,targetDir:a,sourceAbsPath:d.path})}),f=await e.json();e.ok?((0,j.oR)(K("toast.pastedFile",{name:f.newName}),"success"),as.loadDirectory(a),as.loadFileIndex()):(0,j.oR)(f.error||K("toast.pasteFailed"),"error")}catch{(0,j.oR)(K("toast.pasteFailed"),"error")}},[b,as]);(0,f.useRef)(0),(0,f.useRef)(ar),(0,f.useRef)(M);let aP=(0,f.useRef)(av.selectedBranch);aP.current=av.selectedBranch;let aQ=(0,f.useRef)(as.selectedPath);aQ.current=as.selectedPath;let aR=(0,f.useRef)(as.fileContent?.type);aR.current=as.fileContent?.type;let aS=(0,f.useCallback)(async a=>{try{let{data:c}=a;if(!c)return;let d=c.some(a=>"git"===a.type),e=c.some(a=>"file"===a.type),f=[];if((e||d)&&(f.push(fetch(`/api/files/init?cwd=${encodeURIComponent(b)}`).then(a=>a.json()).then(a=>{a.error||as.setFiles(a.files||[])})),f.push(fetch(`/api/files/index?cwd=${encodeURIComponent(b)}`).then(a=>a.json()).then(a=>{a.paths&&as.setFileIndex(a.paths)})),f.push(fetch(`/api/files/recent?cwd=${encodeURIComponent(b)}`).then(a=>a.json()).then(a=>{as.setRecentFiles(a.files||[])}))),d||e){f.push(fetch(`/api/git/status?cwd=${encodeURIComponent(b)}`).then(a=>{if(a.ok)return a.json().then(a=>{au.setStatus(a);let b=(0,l.Do)(a.staged),c=(0,l.Do)(a.unstaged);au.setStagedTree(b),au.setUnstagedTree(c);let d=new Set([...(0,l.Sz)(b),...(0,l.Sz)(c)]);au.setStatusExpandedPaths(a=>new Set([...a,...d]))})})),au.refreshDiff(),d&&av.loadBranches();let a=aP.current;a&&f.push(fetch(`/api/git/commits?cwd=${encodeURIComponent(b)}&branch=${encodeURIComponent(a)}&limit=${p.B_}`).then(a=>a.json()).then(a=>{let b=a.commits||[];av.setCommits(b),av.setHasMoreCommits(b.length>=p.B_)}))}let g=aQ.current,h=aR.current;g&&"text"===h&&f.push(fetch(`/api/files/read?cwd=${encodeURIComponent(b)}&path=${encodeURIComponent(g)}`).then(a=>a.json()).then(a=>{"text"===a.type&&as.setFileContent(a)})),await Promise.all(f)}catch(a){console.error("File watch handler error:",a)}},[b]);(0,s.h)({url:`/ws/watch?cwd=${encodeURIComponent(b)}`,onMessage:aS,enabled:ar});let aT=(0,f.useCallback)(a=>{let b=a.split("/");if(b.length>1){let a=[];for(let c=1;c<b.length;c++)a.push(b.slice(0,c).join("/"));as.setExpandedPaths(b=>{let c=new Set(b);for(let b of a)c.add(b);return as.saveExpandedPaths(c),c})}as.setSelectedPath(a),as.setShouldScrollToSelected(!0),N("tree")},[as]);return(0,e.jsxs)(m.SU,{container:Q,children:[(0,e.jsxs)("div",{ref:O,className:"bg-card w-full h-full flex flex-col relative",children:[(0,e.jsxs)("div",{className:"flex-1 flex overflow-hidden",children:[(0,e.jsxs)("div",{className:"w-80 flex-shrink-0 border-r border-border flex flex-col overflow-hidden",children:[(0,e.jsxs)("div",{className:"flex border-b border-border",children:[(0,e.jsx)("button",{onClick:()=>aM("tree"),className:`flex-1 px-2 py-2 text-sm font-medium transition-colors ${"tree"===M?"text-brand border-b-2 border-brand":"text-muted-foreground hover:text-foreground dark:hover:text-foreground"}`,children:K("fileBrowser.directoryTree")}),(0,e.jsx)("button",{onClick:()=>aM("search"),className:`flex-1 px-2 py-2 text-sm font-medium transition-colors ${"search"===M?"text-brand border-b-2 border-brand":"text-muted-foreground hover:text-foreground dark:hover:text-foreground"}`,children:K("fileBrowser.searchTab")}),(0,e.jsx)("button",{onClick:()=>aM("recent"),className:`flex-1 px-2 py-2 text-sm font-medium transition-colors ${"recent"===M?"text-brand border-b-2 border-brand":"text-muted-foreground hover:text-foreground dark:hover:text-foreground"}`,children:K("fileBrowser.recentTab")}),(0,e.jsx)("button",{onClick:()=>aM("status"),className:`flex-1 px-2 py-2 text-sm font-medium transition-colors ${"status"===M?"text-brand border-b-2 border-brand":"text-muted-foreground hover:text-foreground dark:hover:text-foreground"}`,children:K("fileBrowser.changesTab")}),(0,e.jsx)("button",{onClick:()=>aM("history"),className:`flex-1 px-2 py-2 text-sm font-medium transition-colors ${"history"===M?"text-brand border-b-2 border-brand":"text-muted-foreground hover:text-foreground dark:hover:text-foreground"}`,children:K("fileBrowser.historyTab")})]}),"tree"===M&&(0,e.jsxs)("div",{className:"p-2 border-b border-border flex items-center gap-2",children:[(0,e.jsxs)("div",{className:"flex-1 relative",children:[(0,e.jsx)("input",{ref:as.searchInputRef,type:"text",value:as.searchQuery,onChange:a=>as.setSearchQuery(a.target.value),placeholder:K("fileBrowser.searchFiles"),className:"w-full px-3 py-1.5 pr-7 text-sm border border-border rounded bg-card text-foreground placeholder-slate-9 focus:outline-none focus:ring-2 focus:ring-ring"}),as.searchQuery&&(0,e.jsx)("button",{onClick:()=>as.setSearchQuery(""),className:"absolute right-1.5 top-1/2 -translate-y-1/2 p-0.5 text-slate-9 hover:text-foreground rounded-sm transition-colors",title:K("fileBrowser.clear"),children:(0,e.jsx)("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),(0,e.jsx)("button",{onClick:()=>as.setSearchDirExact(a=>!a),className:`px-1 py-0.5 rounded transition-colors text-xs font-mono font-bold border ${as.searchExactMatch?"border-brand text-brand bg-brand/10":"border-transparent text-muted-foreground hover:text-foreground hover:bg-accent"}`,title:as.searchExactMatch?K("fileBrowser.exactMatchOn"):K("fileBrowser.exactMatchOff"),children:"ab"}),(0,e.jsxs)("div",{className:"flex items-center gap-0.5",children:[(0,e.jsx)("button",{onClick:()=>as.loadFiles(),className:"p-1.5 text-muted-foreground hover:text-foreground hover:bg-accent rounded transition-colors",title:K("fileBrowser.refreshTree"),children:(0,e.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})})}),(0,e.jsx)("button",{onClick:()=>as.searchTreeExpandedPaths?as.setSearchTreeExpandedPaths(new Set):as.setExpandedPaths(new Set),className:"p-1.5 text-muted-foreground hover:text-foreground hover:bg-accent rounded transition-colors",title:K("fileBrowser.collapseAll"),children:(0,e.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M20 12H4"})})})]})]}),"search"===M&&(0,e.jsxs)("div",{className:"p-2 border-b border-border space-y-2",children:[(0,e.jsxs)("div",{className:"flex gap-2",children:[(0,e.jsxs)("div",{className:"flex-1 relative",children:[(0,e.jsx)("input",{ref:at.contentSearchInputRef,type:"text",value:at.contentSearchQuery,onChange:a=>at.setContentSearchQuery(a.target.value),onKeyDown:a=>{"Enter"===a.key&&at.performContentSearch(at.contentSearchQuery)},placeholder:K("fileBrowser.searchFileContent"),className:"w-full px-3 py-1.5 pr-7 text-sm border border-border rounded bg-card text-foreground placeholder-slate-9 focus:outline-none focus:ring-2 focus:ring-ring"}),at.contentSearchQuery&&(0,e.jsx)("button",{onClick:()=>at.setContentSearchQuery(""),className:"absolute right-1.5 top-1/2 -translate-y-1/2 p-0.5 text-slate-9 hover:text-foreground rounded-sm transition-colors",title:K("fileBrowser.clear"),children:(0,e.jsx)("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),(0,e.jsx)("button",{onClick:()=>at.performContentSearch(at.contentSearchQuery),disabled:at.isSearching||!at.contentSearchQuery.trim(),className:"px-3 py-1.5 text-sm bg-brand text-white rounded hover:bg-brand/90 disabled:opacity-50 disabled:cursor-not-allowed",children:at.isSearching?"...":K("common.search")})]}),(0,e.jsxs)("div",{className:"flex flex-wrap gap-2 text-xs",children:[(0,e.jsxs)("label",{className:"flex items-center gap-1 cursor-pointer",children:[(0,e.jsx)("input",{type:"checkbox",checked:at.searchOptions.caseSensitive,onChange:a=>at.setSearchOptions(b=>({...b,caseSensitive:a.target.checked})),className:"w-3 h-3"}),(0,e.jsx)("span",{className:"text-muted-foreground",children:K("fileBrowser.caseSensitive")})]}),(0,e.jsxs)("label",{className:"flex items-center gap-1 cursor-pointer",children:[(0,e.jsx)("input",{type:"checkbox",checked:at.searchOptions.wholeWord,onChange:a=>at.setSearchOptions(b=>({...b,wholeWord:a.target.checked})),className:"w-3 h-3"}),(0,e.jsx)("span",{className:"text-muted-foreground",children:K("fileBrowser.wholeWord")})]}),(0,e.jsxs)("label",{className:"flex items-center gap-1 cursor-pointer",children:[(0,e.jsx)("input",{type:"checkbox",checked:at.searchOptions.regex,onChange:a=>at.setSearchOptions(b=>({...b,regex:a.target.checked})),className:"w-3 h-3"}),(0,e.jsx)("span",{className:"text-muted-foreground",children:K("fileBrowser.regex")})]}),(0,e.jsx)("input",{type:"text",value:at.searchOptions.fileType,onChange:a=>at.setSearchOptions(b=>({...b,fileType:a.target.value})),placeholder:K("fileBrowser.fileTypes"),className:"w-24 px-2 py-0.5 text-xs border border-border rounded bg-card text-foreground placeholder-slate-9"})]})]}),"history"===M&&(0,e.jsx)("div",{className:"p-3 border-b border-border",children:(0,e.jsxs)("div",{className:"flex items-center gap-2",children:[(0,e.jsx)("div",{className:"flex-1 min-w-0",children:(0,e.jsx)(u.e,{branches:av.branches,selectedBranch:av.selectedBranch,onSelect:a=>{av.setSelectedBranch(a),av.compareMode&&av.loadCompareFiles(a)},isLoading:av.isLoadingBranches})}),(0,e.jsx)("button",{onClick:()=>av.toggleCompareMode(!av.compareMode),className:`flex-shrink-0 px-2.5 py-1.5 text-xs font-medium rounded-lg transition-colors ${av.compareMode?"bg-brand text-white":"text-muted-foreground hover:text-foreground hover:bg-accent border border-border"}`,title:av.compareMode?K("fileBrowser.compareModeOff"):K("fileBrowser.compareModeOn"),children:K("fileBrowser.compareMode")})]})}),(0,e.jsxs)("div",{className:"flex-1 overflow-hidden flex flex-col",children:[(0,e.jsxs)("div",{className:`flex-1 flex flex-col min-h-0 ${"tree"===M?"":"hidden"}`,children:[as.creatingItem&&(0,e.jsxs)("div",{className:"px-2 py-1.5 border-b border-border bg-secondary flex items-center gap-2",children:[(0,e.jsx)("span",{className:"text-xs text-muted-foreground",children:as.creatingItem.parentPath?K("fileBrowser.createFileIn",{path:as.creatingItem.parentPath}):K("fileBrowser.createFile")}),(0,e.jsx)("input",{type:"text",autoFocus:!0,placeholder:K("fileBrowser.fileName"),className:"flex-1 px-2 py-1 text-sm border border-border rounded bg-card text-foreground focus:outline-none focus:ring-2 focus:ring-ring",onCompositionStart:()=>{P.current=!0},onCompositionEnd:()=>{P.current=!1},onKeyDown:async a=>{if("Enter"===a.key){if(P.current)return;let c=a.target.value.trim();if(!c)return;let d=as.creatingItem.parentPath,e=d?`${d}/${c}`:c;try{let a=await fetch("/api/files/save",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({cwd:b,path:e,content:""})});if(a.ok)(0,j.oR)(K("toast.createdFile",{name:c}),"success"),as.setCreatingItem(null),as.loadDirectory(d),as.loadFileIndex(),d&&as.setExpandedPaths(a=>new Set([...a,d])),aA(e);else{let b=await a.json();(0,j.oR)(b.error||K("toast.createFailed"),"error")}}catch(a){(0,j.oR)(K("toast.createFailed"),"error")}}else"Escape"===a.key&&as.setCreatingItem(null)},onBlur:()=>as.setCreatingItem(null)})]}),as.isLoadingFiles?(0,e.jsx)("div",{className:"p-4 text-center text-muted-foreground text-sm",children:K("common.loading")}):as.fileError?(0,e.jsx)("div",{className:"p-4 text-center text-red-11 text-sm",children:as.fileError}):(0,e.jsx)(k.h,{files:as.files,selectedPath:as.selectedPath,expandedPaths:as.effectiveExpandedPaths,matchedPaths:as.matchedPaths,gitStatusMap:aL,loadingDirs:as.loadingDirs,onSelect:a=>{as.setShouldScrollToSelected(!1),aA(a)},onToggle:as.handleToggle,cwd:b,shouldScrollToSelected:as.shouldScrollToSelected,onScrolledToSelected:()=>as.setShouldScrollToSelected(!1),onCreateFile:a=>as.setCreatingItem({type:"file",parentPath:a}),onDelete:(a,b,c)=>T({path:a,isDirectory:b,name:c}),onRefresh:()=>as.loadFiles(),onCopyFile:aN,onPaste:aO})]}),(0,e.jsx)("div",{className:`flex-1 flex flex-col min-h-0 ${"search"===M?"":"hidden"}`,children:at.isSearching?(0,e.jsx)("div",{className:"flex-1 flex items-center justify-center",children:(0,e.jsx)("span",{className:"inline-block w-6 h-6 border-2 border-brand border-t-transparent rounded-full animate-spin"})}):at.searchError?(0,e.jsx)("div",{className:"p-4 text-center text-red-11 text-sm",children:at.searchError}):0===at.contentSearchResults.length?(0,e.jsx)("div",{className:"p-4 text-center text-muted-foreground text-sm",children:at.contentSearchQuery?K("fileBrowser.noContentSearchResults"):K("fileBrowser.enterKeywordToSearch")}):(0,e.jsxs)("div",{className:"flex-1 overflow-y-auto flex flex-col min-h-0",children:[at.searchStats&&(0,e.jsxs)("div",{className:"px-3 py-1.5 text-xs text-muted-foreground bg-secondary border-b border-border flex-shrink-0",children:[K("fileBrowser.nFilesNMatches",{files:at.searchStats.totalFiles,matches:at.searchStats.totalMatches}),at.searchStats.truncated&&(0,e.jsxs)("span",{className:"text-amber-11 ml-1",children:["(",K("fileBrowser.resultsTruncated"),")"]})]}),(0,e.jsx)(k.h,{files:aB.files,selectedPath:as.selectedPath,expandedPaths:aC,onSelect:a=>{let b=aB.matchMap.get(a);aA(a,b?.matches[0]?.lineNumber),ad||ae(!0)},onToggle:aE,cwd:b,renderActions:aF,className:"flex-1 overflow-y-auto py-1 min-w-max"})]})}),(0,e.jsx)("div",{className:`flex-1 flex flex-col min-h-0 ${"recent"===M?"":"hidden"}`,children:0===as.recentFiles.length?(0,e.jsx)("div",{className:"p-4 text-center text-muted-foreground text-sm",children:K("fileBrowser.noRecentFiles")}):(0,e.jsx)(k.h,{files:as.recentFilesTree,selectedPath:as.selectedPath,expandedPaths:as.recentTreeDirPaths,onSelect:aA,onToggle:p.tE,cwd:b})}),(0,e.jsx)("div",{className:`flex-1 flex flex-col min-h-0 ${"status"===M?"":"hidden"}`,children:au.statusLoading?(0,e.jsx)("div",{className:"flex-1 flex items-center justify-center",children:(0,e.jsx)("span",{className:"inline-block w-6 h-6 border-2 border-brand border-t-transparent rounded-full animate-spin"})}):au.statusError?(0,e.jsx)("div",{className:"flex-1 flex items-center justify-center p-4",children:(0,e.jsx)("span",{className:"text-red-11 text-sm",children:au.statusError})}):(0,e.jsxs)("div",{className:"flex-1 min-h-0 overflow-y-auto",children:[(0,e.jsxs)("div",{className:"border-b border-border",children:[(0,e.jsxs)("div",{className:"flex items-center justify-between px-3 py-2 bg-secondary",children:[(0,e.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,e.jsx)("span",{className:"text-sm font-medium text-muted-foreground",children:K("fileBrowser.stagingArea",{count:au.status?.staged.length||0})}),(0,e.jsx)("button",{onClick:()=>au.fetchStatus(),className:"p-0.5 text-muted-foreground hover:text-foreground hover:bg-accent rounded transition-colors",title:K("fileBrowser.refreshChanges"),children:(0,e.jsx)("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})})})]}),(au.status?.staged.length||0)>0&&(0,e.jsx)("button",{onClick:au.handleUnstageAll,className:"text-sm text-amber-11 hover:text-amber-10 hover:underline",children:K("fileBrowser.unstageAll")})]}),(0,e.jsx)(l.VO,{files:au.stagedTree,selectedPath:au.statusSelectedFile?.type==="staged"?au.statusSelectedFile.file.path:null,expandedPaths:au.statusExpandedPaths,onSelect:a=>a.file&&au.handleStatusFileSelect(a.file,"staged"),onToggle:au.handleStatusToggle,cwd:b,emptyMessage:K("fileBrowser.noStagedFiles"),className:"py-1",renderActions:a=>{if(a.isDirectory){let b=(0,l.wI)(a);return 0===b.length?null:(0,e.jsx)("button",{onClick:a=>{a.stopPropagation(),au.handleUnstageFiles(b.map(a=>a.path))},className:"opacity-0 group-hover:opacity-100 p-0.5 text-amber-11 hover:text-amber-10 hover:bg-amber-9/10 dark:hover:bg-amber-9/20 rounded transition-all",title:K("fileBrowser.unstageNFiles",{count:b.length}),children:(0,e.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M20 12H4"})})})}return(0,e.jsx)("button",{onClick:b=>{b.stopPropagation(),au.handleUnstage(a.path)},className:"opacity-0 group-hover:opacity-100 p-0.5 text-amber-11 hover:text-amber-10 hover:bg-amber-9/10 dark:hover:bg-amber-9/20 rounded transition-all",title:K("fileBrowser.unstageFile"),children:(0,e.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M20 12H4"})})})}})]}),(0,e.jsxs)("div",{children:[(0,e.jsxs)("div",{className:"flex items-center justify-between px-3 py-2 bg-secondary",children:[(0,e.jsx)("span",{className:"text-sm font-medium text-muted-foreground",children:K("fileBrowser.workspace",{count:au.status?.unstaged.length||0})}),(au.status?.unstaged.length||0)>0&&(0,e.jsxs)("div",{className:"flex items-center gap-2",children:[(0,e.jsx)("button",{onClick:au.handleDiscardAll,className:"text-sm text-red-11 hover:text-red-10 hover:underline",children:K("fileBrowser.discardAll")}),(0,e.jsx)("button",{onClick:au.handleStageAll,className:"text-sm text-green-11 hover:text-green-10 hover:underline",children:K("fileBrowser.stageAll")})]})]}),(0,e.jsx)(l.VO,{files:au.unstagedTree,selectedPath:au.statusSelectedFile?.type==="unstaged"?au.statusSelectedFile.file.path:null,expandedPaths:au.statusExpandedPaths,onSelect:a=>a.file&&au.handleStatusFileSelect(a.file,"unstaged"),onToggle:au.handleStatusToggle,cwd:b,emptyMessage:K("fileBrowser.noUnstagedChanges"),className:"py-1",renderActions:a=>{if(a.isDirectory){let b=(0,l.wI)(a);if(0===b.length)return null;let c=b.map(a=>a.file).filter(Boolean);return(0,e.jsxs)("div",{className:"flex items-center gap-0.5",children:[(0,e.jsx)("button",{onClick:a=>{a.stopPropagation(),au.handleDiscardFiles(c)},className:"opacity-0 group-hover:opacity-100 p-0.5 text-red-11 hover:text-red-10 hover:bg-red-9/10 dark:hover:bg-red-9/20 rounded transition-all",title:K("fileBrowser.discardNFiles",{count:b.length}),children:(0,e.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M3 10h10a8 8 0 018 8v2M3 10l6 6m-6-6l6-6"})})}),(0,e.jsx)("button",{onClick:a=>{a.stopPropagation(),au.handleStageFiles(b.map(a=>a.path))},className:"opacity-0 group-hover:opacity-100 p-0.5 text-green-11 hover:text-green-10 hover:bg-green-9/10 dark:hover:bg-green-9/20 rounded transition-all",title:K("fileBrowser.stageNFiles",{count:b.length}),children:(0,e.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 4v16m8-8H4"})})})]})}return a.file?(0,e.jsxs)("div",{className:"flex items-center gap-0.5",children:[(0,e.jsx)("button",{onClick:b=>{b.stopPropagation(),au.handleDiscardFile(a.file)},className:"opacity-0 group-hover:opacity-100 p-0.5 text-red-11 hover:text-red-10 hover:bg-red-9/10 dark:hover:bg-red-9/20 rounded transition-all",title:K("fileBrowser.discardChanges"),children:(0,e.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M3 10h10a8 8 0 018 8v2M3 10l6 6m-6-6l6-6"})})}),(0,e.jsx)("button",{onClick:b=>{b.stopPropagation(),au.handleStage(a.path)},className:"opacity-0 group-hover:opacity-100 p-0.5 text-green-11 hover:text-green-10 hover:bg-green-9/10 dark:hover:bg-green-9/20 rounded transition-all",title:K("fileBrowser.stageFile"),children:(0,e.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 4v16m8-8H4"})})})]}):null}})]})]})}),(0,e.jsx)("div",{className:`flex-1 flex flex-col min-h-0 ${"history"===M?"":"hidden"}`,children:av.historyError?(0,e.jsx)("div",{className:"flex-1 flex items-center justify-center",children:(0,e.jsxs)("div",{className:"text-center",children:[(0,e.jsx)("svg",{className:"w-16 h-16 mx-auto text-slate-7 mb-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"})}),(0,e.jsx)("p",{className:"text-muted-foreground",children:av.historyError})]})}):av.compareMode?(0,e.jsx)("div",{className:"flex-1 overflow-y-auto",children:av.isLoadingCompareFiles?(0,e.jsx)("div",{className:"p-4 text-center text-muted-foreground text-sm",children:K("fileBrowser.loadingDiff")}):0===av.compareFiles.length?(0,e.jsx)("div",{className:"p-4 text-center text-muted-foreground text-sm",children:K("fileBrowser.noDiffFiles")}):(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("div",{className:"px-3 py-2 border-b border-border",children:(0,e.jsx)("span",{className:"text-xs text-muted-foreground",children:K("fileBrowser.nFilesChanged",{count:av.compareFiles.length,branch:av.selectedBranch})})}),(0,e.jsx)(l.VO,{files:av.compareFileTree,expandedPaths:av.compareExpandedPaths,onToggle:av.handleCompareToggle,selectedPath:av.compareSelectedFile?.path||null,onSelect:a=>{a.file&&av.handleSelectCompareFile(a.file)},cwd:b,showChanges:!0})]})}):(0,e.jsx)("div",{ref:av.commitListRef,className:"flex-1 overflow-y-auto",onScroll:av.handleCommitListScroll,children:av.isLoadingCommits?(0,e.jsx)("div",{className:"p-4 text-center text-muted-foreground text-sm",children:K("fileBrowser.loadingCommits")}):0===av.commits.length?(0,e.jsx)("div",{className:"p-4 text-center text-muted-foreground text-sm",children:K("fileBrowser.noCommits")}):(0,e.jsxs)(e.Fragment,{children:[av.commits.map(a=>(0,e.jsxs)("div",{onClick:()=>av.handleSelectCommit(a),className:`px-3 py-2 border-b border-border cursor-pointer hover:bg-accent ${av.selectedCommit?.hash===a.hash?"bg-brand/10":""}`,children:[(0,e.jsxs)("div",{className:"flex items-center gap-2",children:[(0,e.jsx)("span",{className:"font-mono text-xs text-brand",children:a.shortHash}),(0,e.jsxs)("span",{className:"text-xs text-slate-9",title:a.date,children:[a.relativeDate," \xb7 ",(0,p.r6)(a.date)]})]}),(0,e.jsx)("div",{className:"text-sm text-foreground truncate mt-0.5","data-tooltip":a.subject,children:a.subject}),(0,e.jsx)("div",{className:"text-xs text-muted-foreground mt-0.5",children:a.author})]},a.hash)),av.isLoadingMore&&(0,e.jsx)("div",{className:"p-3 text-center",children:(0,e.jsx)("span",{className:"inline-block w-4 h-4 border-2 border-brand border-t-transparent rounded-full animate-spin"})}),!av.hasMoreCommits&&av.commits.length>0&&(0,e.jsx)("div",{className:"p-3 text-center text-xs text-slate-9",children:K("fileBrowser.allLoaded",{count:av.commits.length})})]})})})]})]}),(0,e.jsxs)("div",{className:"flex-1 flex flex-col overflow-hidden",children:[("tree"===M||"search"===M||"recent"===M)&&(as.blameSelectedCommit?(0,e.jsx)(h.n,{isOpen:!0,onClose:()=>as.setBlameSelectedCommit(null),commit:as.blameSelectedCommit,cwd:b,embedded:!0,initialFilePath:as.selectedPath||void 0,onContentSearch:a=>{N("search"),at.setContentSearchQuery(a),at.performContentSearch(a)}}):as.selectedPath?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsxs)("div",{className:"px-4 py-2 bg-secondary border-b border-border flex-shrink-0 flex items-center justify-between",children:[(0,e.jsxs)("div",{className:"flex items-center gap-1 min-w-0",children:[(0,e.jsx)("span",{className:"text-sm text-muted-foreground truncate",children:as.selectedPath}),(0,e.jsx)("button",{onClick:a=>{a.stopPropagation(),navigator.clipboard.writeText(`${b}/${as.selectedPath}`),(0,j.oR)(K("common.copiedPath"))},className:"p-0.5 rounded text-muted-foreground hover:text-foreground hover:bg-accent transition-colors flex-shrink-0",title:K("common.copyAbsPath"),children:(0,e.jsx)("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z"})})}),(0,e.jsx)("button",{onClick:a=>{a.stopPropagation(),aT(as.selectedPath)},className:"p-0.5 rounded text-muted-foreground hover:text-foreground hover:bg-accent transition-colors flex-shrink-0",title:K("fileBrowser.locateInTree"),children:(0,e.jsxs)("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:[(0,e.jsx)("circle",{cx:"12",cy:"12",r:"10",strokeWidth:2}),(0,e.jsx)("circle",{cx:"12",cy:"12",r:"3",strokeWidth:2}),(0,e.jsx)("path",{strokeLinecap:"round",strokeWidth:2,d:"M12 2v4m0 12v4M2 12h4m12 0h4"})]})})]}),(0,e.jsx)("div",{className:"flex items-center gap-1.5 flex-shrink-0",children:as.showEditor?(0,e.jsxs)(e.Fragment,{children:[ab.isDirty&&(0,e.jsx)("span",{className:"text-xs text-amber-11",children:K("fileBrowser.unsaved")}),(0,e.jsx)("button",{onClick:()=>aa.current?.save(),disabled:!ab.isDirty||ab.isSaving,className:`px-1.5 py-0.5 text-xs rounded transition-colors ${ab.isDirty&&!ab.isSaving?"bg-brand text-white hover:bg-brand/90":"bg-secondary text-muted-foreground cursor-not-allowed"}`,children:ab.isSaving?(0,e.jsx)("span",{className:"inline-block w-3 h-3 border-2 border-current border-t-transparent rounded-full animate-spin"}):K("common.save")}),(0,e.jsx)("button",{onClick:()=>aa.current?.close(),className:"px-1.5 py-0.5 text-xs rounded transition-colors text-muted-foreground hover:bg-accent",title:K("fileBrowser.closeEdit"),children:K("fileBrowser.closeBtn")})]}):(0,e.jsxs)(e.Fragment,{children:[as.fileContent?.type==="text"&&as.fileContent.content&&(0,e.jsx)("button",{onClick:()=>{navigator.clipboard.writeText(as.fileContent.content),(0,j.oR)(K("toast.copiedFileContent"))},className:"px-1.5 py-0.5 text-xs rounded transition-colors text-muted-foreground hover:bg-accent",title:K("fileBrowser.copyFileContent"),children:K("common.copy")}),as.selectedPath?.endsWith(".json")&&as.fileContent?.type==="text"&&(0,e.jsx)("button",{onClick:()=>ag(a=>!a),className:`px-1.5 py-0.5 text-xs rounded transition-colors ${af?"bg-brand text-white":"text-muted-foreground hover:bg-accent"}`,title:K("fileBrowser.toggleJsonReadable"),children:K("common.readable")}),as.fileContent?.type==="text"&&(0,o.e$)(as.selectedPath)&&(0,e.jsx)("button",{onClick:()=>as.setShowMarkdownPreview(!0),className:"px-1.5 py-0.5 text-xs rounded transition-colors text-muted-foreground hover:bg-accent",title:K("fileBrowser.previewMarkdown"),children:K("common.preview")}),as.fileContent?.type==="text"&&(0,e.jsx)("button",{onClick:as.handleToggleBlame,disabled:as.isLoadingBlame,className:`px-1.5 py-0.5 text-xs rounded transition-colors ${as.showBlame?"bg-brand text-white":"text-muted-foreground hover:bg-accent"} disabled:opacity-50`,title:K("fileBrowser.viewBlame"),children:as.isLoadingBlame?(0,e.jsx)("span",{className:"inline-block w-3 h-3 border border-current border-t-transparent rounded-full animate-spin"}):"Blame"}),as.fileContent?.type==="text"&&(0,e.jsx)("button",{onClick:()=>as.setShowEditor(!0),className:"px-1.5 py-0.5 text-xs rounded transition-colors text-muted-foreground hover:bg-accent",title:K("fileBrowser.editFile"),children:K("common.edit")})]})})]}),(0,e.jsx)("div",{className:"flex-1 overflow-hidden",children:as.isLoadingContent?(0,e.jsx)("div",{className:"h-full flex items-center justify-center",children:(0,e.jsx)("span",{className:"inline-block w-6 h-6 border-2 border-brand border-t-transparent rounded-full animate-spin"})}):as.fileContent?"text"===as.fileContent.type&&"string"==typeof as.fileContent.content?as.showBlame&&as.blameError?(0,e.jsx)("div",{className:"h-full flex items-center justify-center text-muted-foreground",children:(0,e.jsxs)("div",{className:"text-center",children:[(0,e.jsx)("p",{className:"text-red-11",children:as.blameError}),(0,e.jsx)("button",{onClick:()=>as.setShowBlame(!1),className:"mt-2 text-brand hover:underline text-sm",children:K("fileBrowser.backToPreview")})]})}):as.showBlame&&0===as.blameLines.length&&as.isLoadingBlame?(0,e.jsx)("div",{className:"h-full flex items-center justify-center",children:(0,e.jsx)("span",{className:"inline-block w-6 h-6 border-2 border-brand border-t-transparent rounded-full animate-spin"})}):af&&as.selectedPath?.endsWith(".json")?(0,e.jsxs)("div",{className:"h-full flex flex-col bg-[#0d1117]",children:[(0,e.jsx)(C._,{search:ak}),(0,e.jsx)("div",{className:"flex-1 overflow-auto px-6 py-4",children:(0,e.jsx)("pre",{ref:aj,className:"whitespace-pre-wrap break-words font-mono",style:{fontSize:"0.8125rem",lineHeight:"1.5"},children:(0,o.xb)(as.fileContent.content)})})]}):(0,e.jsx)(n.Cv,{ref:aa,content:as.fileContent.content,filePath:as.selectedPath,cwd:b,enableComments:!0,scrollToLine:$??as.targetLineNumber,scrollToLineAlign:null!=$?"start":as.targetScrollAlign,onScrollToLineComplete:()=>{_(null),as.setTargetLineNumber(null)},highlightKeyword:"search"===M?at.contentSearchQuery:null,visibleLineRef:Y,viStateRef:Z,initialCursorLine:as.initialCursorLine,initialCursorCol:as.initialCursorCol,onInitialCursorSet:()=>{as.setInitialCursorLine(null),as.setInitialCursorCol(null)},onCmdClick:aH?aI:void 0,onTokenHover:aH?aJ:void 0,onTokenHoverLeave:aH?ao.onTokenMouseLeave:void 0,onTokenHoverCancel:aH?ao.clearHover:void 0,blameLines:as.showBlame&&as.blameLines.length>0?as.blameLines:void 0,inlineBlameLines:as.blameLines.length>0?as.blameLines:void 0,onSelectCommit:as.setBlameSelectedCommit,editable:as.showEditor,initialMtime:as.fileContent.mtime,onEditorClose:a=>{as.setShowEditor(!1),_(a)},onSaved:()=>{let a=Y.current??1;as.loadFileContent(as.selectedPath),as.setShowEditor(!1),_(a)},onEditorStateChange:ac,viMode:!0,onContentMutate:aw,onEnterInsertMode:ax,onViSave:ay,onContentSearch:a=>{N("search"),at.setContentSearchQuery(a),at.performContentSearch(a)}}):"image"===as.fileContent.type&&as.fileContent.content?(0,e.jsx)("div",{className:"h-full flex items-center justify-center p-4 bg-secondary",children:(0,e.jsx)("img",{src:as.fileContent.content,alt:as.selectedPath,className:"max-w-full max-h-full object-contain"})}):(0,e.jsx)("div",{className:"h-full flex items-center justify-center text-muted-foreground",children:(0,e.jsxs)("div",{className:"text-center",children:[(0,e.jsx)("svg",{className:"w-16 h-16 mx-auto text-slate-7 mb-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"})}),(0,e.jsx)("p",{children:as.fileContent.message||K("fileBrowser.cannotPreview")})]})}):(0,e.jsx)("div",{className:"h-full flex items-center justify-center text-muted-foreground",children:K("fileBrowser.selectFileToPreview")})})]}):(0,e.jsx)("div",{className:"flex-1 flex items-center justify-center text-muted-foreground",children:(0,e.jsxs)("div",{className:"text-center",children:[(0,e.jsx)("svg",{className:"w-16 h-16 mx-auto text-slate-7 mb-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"M3 7v10a2 2 0 002 2h14a2 2 0 002-2V9a2 2 0 00-2-2h-6l-2-2H5a2 2 0 00-2 2z"})}),(0,e.jsx)("p",{children:K("fileBrowser.selectFileToPreview")})]})})),"status"===M&&(au.statusSelectedFile&&au.statusDiff?(0,e.jsxs)("div",{className:"flex-1 flex flex-col overflow-hidden",children:[(0,e.jsxs)("div",{className:"px-4 py-2 bg-secondary border-b border-border flex items-center gap-2",children:[(0,e.jsx)("span",{className:"text-xs font-mono text-muted-foreground",children:au.statusSelectedFile.file.path}),(0,e.jsx)("button",{onClick:a=>{a.stopPropagation(),navigator.clipboard.writeText(`${b}/${au.statusSelectedFile.file.path}`),(0,j.oR)(K("common.copiedPath"))},className:"p-0.5 rounded text-muted-foreground hover:text-foreground hover:bg-accent transition-colors flex-shrink-0",title:K("common.copyAbsPath"),children:(0,e.jsx)("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z"})})}),(0,e.jsx)("button",{onClick:a=>{a.stopPropagation(),aT(au.statusSelectedFile.file.path)},className:"p-0.5 rounded text-muted-foreground hover:text-foreground hover:bg-accent transition-colors flex-shrink-0",title:K("fileBrowser.locateInTree"),children:(0,e.jsxs)("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:[(0,e.jsx)("circle",{cx:"12",cy:"12",r:"10",strokeWidth:2}),(0,e.jsx)("circle",{cx:"12",cy:"12",r:"3",strokeWidth:2}),(0,e.jsx)("path",{strokeLinecap:"round",strokeWidth:2,d:"M12 2v4m0 12v4M2 12h4m12 0h4"})]})}),(0,e.jsx)("span",{className:`text-xs px-1.5 py-0.5 rounded ${"staged"===au.statusSelectedFile.type?"bg-green-9/15 text-green-11 dark:bg-green-9/25":"bg-amber-9/15 text-amber-11 dark:bg-amber-9/25"}`,children:"staged"===au.statusSelectedFile.type?K("fileBrowser.staged"):K("fileBrowser.unstaged")}),(0,e.jsx)("div",{className:"flex-1"})]}),(0,e.jsx)("div",{className:"flex-1 overflow-auto",children:(0,p.u)(au.statusSelectedFile.file.path)?(0,e.jsx)("div",{className:"p-4 flex items-center justify-center",children:(0,e.jsx)("img",{src:`/api/files/read?cwd=${encodeURIComponent(b)}&path=${encodeURIComponent(au.statusSelectedFile.file.path)}&raw=1`,alt:au.statusSelectedFile.file.path,className:"max-w-full max-h-[60vh] object-contain"})}):(0,e.jsx)(i.xZ,{oldContent:au.statusDiff.oldContent,newContent:au.statusDiff.newContent,filePath:au.statusDiff.filePath,isNew:au.statusDiff.isNew,isDeleted:au.statusDiff.isDeleted,cwd:b,enableComments:!0,onPreview:!au.statusDiff.isDeleted&&(0,o.e$)(au.statusSelectedFile.file.path)?()=>au.setShowStatusDiffPreview(!0):!au.statusDiff.isDeleted&&au.statusSelectedFile.file.path.endsWith(".json")?()=>ai({content:au.statusDiff.newContent,filePath:au.statusDiff.filePath}):void 0,previewLabel:au.statusSelectedFile.file.path.endsWith(".json")?K("common.readable"):K("common.preview"),onContentSearch:a=>{N("search"),at.setContentSearchQuery(a),at.performContentSearch(a)}})}),au.showStatusDiffPreview&&au.statusDiff&&(0,e.jsx)("div",{className:"absolute inset-0 z-50 flex items-center justify-center bg-black/50",onClick:()=>au.setShowStatusDiffPreview(!1),children:(0,e.jsx)("div",{className:"bg-card rounded-lg shadow-xl w-full max-w-[90%] h-full flex flex-col",onClick:a=>a.stopPropagation(),children:(0,e.jsx)(q.M,{content:au.statusDiff.newContent,filePath:au.statusDiff.filePath,cwd:b,onClose:()=>au.setShowStatusDiffPreview(!1)})})}),ah&&(0,e.jsx)("div",{className:"absolute inset-0 z-50 flex items-center justify-center bg-black/50",onClick:()=>ai(null),children:(0,e.jsxs)("div",{className:"bg-card rounded-lg shadow-xl w-full max-w-[90%] h-[90%] flex flex-col",onClick:a=>a.stopPropagation(),children:[(0,e.jsxs)("div",{className:"flex items-center justify-between px-4 py-2 border-b border-border flex-shrink-0",children:[(0,e.jsx)("span",{className:"text-sm text-muted-foreground font-mono truncate",children:ah.filePath}),(0,e.jsx)("button",{onClick:()=>ai(null),className:"p-1 text-muted-foreground hover:text-foreground hover:bg-accent rounded transition-colors",children:(0,e.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),(0,e.jsx)(C._,{search:am}),(0,e.jsx)("div",{className:"flex-1 overflow-auto px-6 py-4 bg-[#0d1117]",children:(0,e.jsx)("pre",{ref:al,className:"whitespace-pre-wrap break-words font-mono",style:{fontSize:"0.8125rem",lineHeight:"1.5"},children:(0,o.xb)(ah.content)})})]})})]}):(0,e.jsx)("div",{className:"flex-1 flex items-center justify-center text-slate-9",children:(0,e.jsx)("span",{children:K("fileBrowser.selectFileToViewDiff")})})),"history"===M&&!av.historyError&&(av.compareMode?av.isLoadingCompareDiff?(0,e.jsx)("div",{className:"flex-1 flex items-center justify-center text-muted-foreground text-sm",children:K("fileBrowser.loadingDiffContent")}):av.compareFileDiff?(0,e.jsx)(i.xZ,{oldContent:av.compareFileDiff.oldContent,newContent:av.compareFileDiff.newContent,filePath:av.compareFileDiff.filePath,isNew:av.compareFileDiff.isNew,isDeleted:av.compareFileDiff.isDeleted,cwd:b,enableComments:!0,onPreview:!av.compareFileDiff.isDeleted&&av.compareFileDiff.filePath.endsWith(".json")?()=>ai({content:av.compareFileDiff.newContent,filePath:av.compareFileDiff.filePath}):void 0,previewLabel:K("common.readable"),onContentSearch:a=>{N("search"),at.setContentSearchQuery(a),at.performContentSearch(a)}}):(0,e.jsx)("div",{className:"flex-1 flex items-center justify-center text-slate-9",children:(0,e.jsx)("span",{children:av.compareFiles.length>0?K("fileBrowser.selectFileToViewDiff"):K("fileBrowser.clickCompareToLoad")})}):av.selectedCommit?(0,e.jsx)(h.n,{isOpen:!0,onClose:()=>av.setSelectedCommit(null),commit:av.selectedCommit,cwd:b,embedded:!0,onContentSearch:a=>{N("search"),at.setContentSearchQuery(a),at.performContentSearch(a)}}):(0,e.jsx)("div",{className:"flex-1 flex items-center justify-center text-slate-9",children:(0,e.jsx)("span",{children:K("fileBrowser.selectCommitToView")})}))]})]}),as.showMarkdownPreview&&as.fileContent?.type==="text"&&as.selectedPath&&(0,e.jsx)("div",{className:"absolute inset-0 z-50 flex items-center justify-center bg-black/50",onClick:()=>as.setShowMarkdownPreview(!1),children:(0,e.jsx)("div",{className:"bg-card rounded-lg shadow-xl w-full max-w-[90%] h-full flex flex-col",onClick:a=>a.stopPropagation(),children:(0,e.jsx)(q.M,{content:as.fileContent.content||"",filePath:as.selectedPath,cwd:b,onClose:()=>as.setShowMarkdownPreview(!1)})})}),U&&(0,e.jsx)(r.c,{files:as.files,fileIndex:as.fileIndex,recentFiles:as.recentFilePaths,onSelectFile:a=>{aA(a),as.setShouldScrollToSelected(!0),N("tree")},onClose:()=>V(!1)}),(aG||ap.visible)&&(0,e.jsxs)("div",{className:`flex ${ap.visible&&aG?"":"flex-col"}`,children:[aG&&(0,e.jsx)("div",{className:ap.visible?"flex-1 min-w-0 border-r border-border":"",children:(0,e.jsx)(G.D,{results:at.contentSearchResults,loading:at.isSearching,totalMatches:at.searchStats?.totalMatches??0,onSelect:(a,b)=>{as.selectedPath&&aq.push({filePath:as.selectedPath,lineNumber:Y.current}),aA(a,b)},onClose:()=>ae(!1)})}),ap.visible&&(0,e.jsx)("div",{className:aG?"flex-1 min-w-0":"",children:(0,e.jsx)(F.D,{references:ap.references,loading:ap.loading,onSelect:aK,onClose:ap.closeReferences})})]})]}),W&&(0,g.createPortal)((0,e.jsx)("div",{className:"fixed z-[9999] px-2 py-1 bg-popover text-popover-foreground text-xs font-mono rounded shadow-lg border border-brand whitespace-nowrap pointer-events-none",style:{left:W.x+12,top:W.y+16},children:W.text}),document.body),S&&(0,g.createPortal)((0,e.jsx)("div",{className:"fixed inset-0 z-[300] flex items-center justify-center bg-black/50",onClick:()=>T(null),children:(0,e.jsxs)("div",{className:"bg-card border border-border rounded-lg shadow-xl p-4 max-w-sm w-full mx-4",onClick:a=>a.stopPropagation(),children:[(0,e.jsx)("h3",{className:"text-sm font-medium text-foreground mb-2",children:K("fileBrowser.confirmDelete")}),(0,e.jsx)("p",{className:"text-sm text-muted-foreground mb-4",children:K("fileBrowser.confirmDeleteMessage",{name:S.name}).split(/<\/?file>/g).map((a,b)=>1===b?(0,e.jsx)("span",{className:"font-mono text-foreground",children:a},b):a)}),(0,e.jsxs)("div",{className:"flex justify-end gap-2",children:[(0,e.jsx)("button",{onClick:()=>T(null),className:"px-3 py-1.5 text-sm rounded border border-border hover:bg-accent transition-colors",children:K("common.cancel")}),(0,e.jsx)("button",{onClick:async()=>{let{path:a,name:c}=S;T(null);try{let d=await fetch("/api/files/delete",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({cwd:b,path:a})});if(d.ok){(0,j.oR)(K("toast.movedToTrash",{name:c}),"success");let b=a.includes("/")?a.substring(0,a.lastIndexOf("/")):"";as.loadDirectory(b),as.loadFileIndex(),as.selectedPath===a&&aA("")}else{let a=await d.json();(0,j.oR)(a.error||K("toast.deleteFailed"),"error")}}catch{(0,j.oR)(K("toast.deleteFailed"),"error")}},className:"px-3 py-1.5 text-sm rounded bg-destructive text-destructive-foreground hover:bg-destructive/90 transition-colors",children:K("common.delete")})]})]})}),document.body),ao.hoverInfo&&Q&&(0,g.createPortal)((0,e.jsx)(E.s,{ref:a=>{ao.tooltipElRef.current=a},displayString:ao.hoverInfo.displayString,documentation:ao.hoverInfo.documentation,x:ao.hoverInfo.x,y:ao.hoverInfo.y,container:Q,onMouseEnter:ao.onCardMouseEnter,onMouseLeave:ao.onCardMouseLeave,onFindReferences:()=>{let{filePath:a,line:b,column:c}=ao.hoverInfo;ao.clearHover(),ap.findReferences(a,b,c)},onSearch:a=>{ao.clearHover(),N("search"),at.setContentSearchQuery(a),at.performContentSearch(a)}}),Q)]})}[h,i,n,F,G]=I.then?(await I)():I,d()}catch(a){d(a)}})},54338:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{TabManager:()=>w});var e=c(48249),f=c(67484),g=c(44384),h=c(4667),i=c(54017),j=c(26130),k=c(27805),l=c(94924),m=c(77033),n=c(92154),o=c(93053),p=c(81190),q=c(48464),r=c(92050),s=c(13928),t=c(132),u=c(21108),v=a([i,r]);function w({initialCwd:a,initialSessionId:b}){let{t:c}=(0,g.Bd)(),[d,v]=(0,f.useState)("agent"),{tabs:w,activeTabId:x,activeTab:y,unreadTabs:z,dragTabIndex:A,dragOverTabIndex:B,closeTab:C,switchTab:D,handleSelectSession:E,handleNewTab:F,handleOpenSession:G,updateTabState:H,handleTabDragStart:I,handleTabDragOver:J,handleTabDrop:K,handleTabDragEnd:L}=(0,o.i)({initialCwd:a,initialSessionId:b,activeView:d}),{isPinned:M,pinSession:N,unpinSession:O}=(0,t.P)(),{createTask:P}=(0,u.n)(),Q=(0,f.useCallback)(a=>{let b=w.find(b=>b.id===a);return!!b?.sessionId&&M(b.sessionId)},[w,M]),R=(0,f.useCallback)(b=>{let c=w.find(a=>a.id===b);c?.sessionId&&(M(c.sessionId)?O(c.sessionId):N(c.sessionId,c.cwd||a||"",c.title))},[w,M,N,O,a]),[S,T]=(0,f.useState)(!1),[U,V]=(0,f.useState)(!1),[W,X]=(0,f.useState)(!1),[Y,Z]=(0,f.useState)(null),[$,_]=(0,f.useState)(!1),[aa,ab]=(0,f.useState)("tree"),[ac,ad]=(0,f.useState)(0),[ae,af]=(0,f.useState)(null),[ag,ah]=(0,f.useState)(0),[ai,aj]=(0,f.useState)(!1);(0,f.useRef)(null);let ak=(0,f.useCallback)(b=>{v(b),a&&(fetch("/api/project-settings",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({cwd:a,settings:{activeView:b}})}).catch(()=>{}),window.parent.postMessage({type:"VIEW_CHANGE",cwd:a,view:b},"*"))},[a]),al=(0,f.useCallback)(async()=>{if(a)try{let b=await fetch(`/api/git/worktree?cwd=${encodeURIComponent(a)}`);if(b.ok){let c=await b.json();if(_(c.isGitRepo),c.isGitRepo&&c.worktrees.length>0){let b=c.worktrees.find(b=>b.path===a);b&&Z(b.branch)}}}catch(a){console.error("Failed to load git info:",a)}},[a]),am=(0,f.useCallback)(a=>{let{data:b}=a;b?.some(a=>"git"===a.type)&&al()},[al]);(0,s.h)({url:`/ws/watch?cwd=${encodeURIComponent(a||"")}`,onMessage:am,enabled:!!a});let an=(0,f.useCallback)(()=>{ab("status"),ad(a=>a+1),ak("explorer")},[ak]),ao=(0,f.useCallback)(a=>{af(a),ah(a=>a+1),ak("explorer")},[ak]),ap=(0,f.useCallback)(()=>{a&&window.parent.postMessage({type:"OPEN_NOTE",cwd:a},"*")},[a]);return(0,e.jsx)(m.k_,{children:(0,e.jsx)(n.fY,{activeView:d,onViewChange:ak,children:(0,e.jsxs)("div",{className:"flex h-screen bg-card",children:[(0,e.jsxs)("div",{className:"flex-1 flex flex-col min-w-0",children:[(0,e.jsx)(p.B,{initialCwd:a,activeTab:y,isGitRepo:$,currentBranch:Y,onOpenWorktree:()=>V(!0),onOpenProjectSessions:()=>T(!0),onOpenAliasManager:()=>X(!0),onBranchSwitched:al}),ai&&(0,e.jsxs)("div",{className:"flex items-center justify-center gap-2 py-1 bg-brand/15 text-brand text-xs font-medium border-b border-brand/20",children:[(0,e.jsx)("span",{className:"animate-pulse",children:"●"}),c("console.screenshotting")]}),a?(0,e.jsxs)(n.c0,{children:[(0,e.jsxs)("div",{className:"w-1/3 h-full flex flex-col overflow-hidden",children:[(0,e.jsx)(q.V,{tabs:w,activeTabId:x,unreadTabs:z,dragTabIndex:A,dragOverTabIndex:B,isPinned:Q,onTogglePin:R,onSwitchTab:D,onCloseTab:C,onNewTab:F,onDragStart:I,onDragOver:J,onDrop:K,onDragEnd:L}),(0,e.jsx)("div",{className:"flex-1 overflow-hidden relative",children:w.map(a=>(0,e.jsx)("div",{className:`h-full ${a.id===x?"block":"hidden"}`,children:(0,e.jsx)(r.X,{tabId:a.id,cwd:a.cwd,sessionId:a.sessionId,isActive:a.id===x&&"agent"===d,onStateChange:H,onShowGitStatus:an,onContentSearch:ao,onOpenNote:ap,onCreateScheduledTask:P,onOpenSession:G})},a.id))})]}),(0,e.jsx)("div",{className:"w-1/3 h-full overflow-hidden",children:(0,e.jsx)(i.g,{onClose:()=>ak("agent"),cwd:a,initialTab:aa,tabSwitchTrigger:ac,initialSearchQuery:ae,searchQueryTrigger:ag})}),(0,e.jsx)("div",{className:"w-1/3 h-full overflow-hidden",children:(0,e.jsx)(k.J,{cwd:a,tabId:"default",onOpenNote:ap})})]}):(0,e.jsxs)("div",{className:"flex-1 flex flex-col overflow-hidden",children:[(0,e.jsx)(q.V,{tabs:w,activeTabId:x,unreadTabs:z,dragTabIndex:A,dragOverTabIndex:B,isPinned:Q,onTogglePin:R,onSwitchTab:D,onCloseTab:C,onNewTab:F,onDragStart:I,onDragOver:J,onDrop:K,onDragEnd:L}),(0,e.jsx)("div",{className:"flex-1 overflow-hidden relative",children:w.map(a=>(0,e.jsx)("div",{className:`h-full ${a.id===x?"block":"hidden"}`,children:(0,e.jsx)(r.X,{tabId:a.id,cwd:a.cwd,sessionId:a.sessionId,isActive:a.id===x,onStateChange:H,onCreateScheduledTask:P,onOpenSession:G})},a.id))})]})]}),a&&(0,e.jsx)(h.Q,{isOpen:S,onClose:()=>T(!1),cwd:a,onSelectSession:E}),a&&$&&(0,e.jsx)(j.x,{isOpen:U,onClose:()=>V(!1),cwd:a}),W&&(0,e.jsx)(l.Y,{onClose:()=>X(!1),onSave:()=>X(!1)})]})})})}[i,r]=v.then?(await v)():v,d()}catch(a){d(a)}})},55313:(a,b,c)=>{"use strict";c.d(b,{A:()=>d});let d=(0,c(47408).A)("message-circle-question-mark",[["path",{d:"M2.992 16.342a2 2 0 0 1 .094 1.167l-1.065 3.29a1 1 0 0 0 1.236 1.168l3.413-.998a2 2 0 0 1 1.099.092 10 10 0 1 0-4.777-4.719",key:"1sd12s"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]])},55511:a=>{"use strict";a.exports=require("crypto")},56111:(a,b,c)=>{"use strict";c.d(b,{e:()=>f});var d=c(67484),e=c(41564);function f(a,b,{sessionId:c,cwd:f,onSessionId:g,onFetchTitle:h}){let[i,j]=(0,d.useState)(!1),[k,l]=(0,d.useState)(null),m=(0,d.useRef)(null),n=(0,d.useRef)(c);n.current=c;let o=(0,d.useRef)(null),p=(0,d.useRef)(null),q=(0,d.useCallback)(()=>{let a=o.current;if(a&&a.text){let{messageId:c,text:d}=a;b(a=>a.map(a=>a.id===c?{...a,content:(a.content||"")+d}:a)),o.current={messageId:c,text:""}}p.current=null},[b]),r=(0,d.useCallback)(()=>{m.current&&(m.current.abort(),m.current=null)},[]),s=(0,d.useCallback)((a,c)=>{let d=a.type;if("system"===d&&"init"===a.subtype){let b=a.session_id;g(b),n.current=b;return}if("stream_event"===d){let b=a.event;if(b?.type==="content_block_delta"&&b.delta?.type==="text_delta"){let a=b.delta.text||"";o.current&&o.current.messageId===c?o.current.text+=a:o.current={messageId:c,text:a},p.current||(p.current=setTimeout(q,50))}return}if("assistant"===d){let d=a.message;if(d?.content){for(let a of d.content)if("name"in a&&a.name){let d={id:a.id||`tool-${Date.now()}`,name:a.name,input:a.input||{},isLoading:!0};b(a=>a.map(a=>a.id!==c||a.toolCalls?.some(a=>a.id===d.id)?a:{...a,toolCalls:[...a.toolCalls||[],d]}))}}}if("user"===d){let d=a.message;if(d?.content){for(let a of d.content)if("tool_use_id"in a&&a.tool_use_id){let d=a.tool_use_id,e="string"==typeof a.content?a.content:JSON.stringify(a.content);b(a=>a.map(a=>a.id===c?{...a,toolCalls:a.toolCalls?.map(a=>a.id===d?{...a,result:e,isLoading:!1}:a)}:a))}}}if("result"===d){p.current&&(clearTimeout(p.current),p.current=null),q();let d=n.current;d&&f&&b(a=>(2===a.length&&h(d),a));let e=a.usage,g=a.total_cost_usd;e&&l({inputTokens:e.input_tokens||0,outputTokens:e.output_tokens||0,cacheCreationInputTokens:e.cache_creation_input_tokens||0,cacheReadInputTokens:e.cache_read_input_tokens||0,totalCostUsd:g||0}),b(a=>a.map(a=>a.id===c?{...a,isStreaming:!1,toolCalls:a.toolCalls?.map(a=>({...a,isLoading:!1}))}:a))}},[b,q,g,h,f]);return{isLoading:i,tokenUsage:k,handleSend:(0,d.useCallback)(async(a,c)=>{let d=c?.map(a=>({type:"base64",media_type:a.media_type,data:a.data})),g={id:`user-${Date.now()}`,role:"user",content:a,images:d};b(a=>[...a,g]),j(!0);let h=`assistant-${Date.now()}`,i={id:h,role:"assistant",content:"",toolCalls:[],isStreaming:!0};b(a=>[...a,i]),m.current=new AbortController;try{let b=await fetch("/api/chat",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({prompt:a,sessionId:n.current,images:d,cwd:f}),signal:m.current.signal});if(!b.ok)throw Error(e.A.t("chat.requestFailed"));let c=b.body?.getReader();if(!c)throw Error(e.A.t("chat.cannotReadStream"));let g=new TextDecoder,i="";for(;;){let{done:a,value:b}=await c.read();if(a)break;let d=(i+=g.decode(b,{stream:!0})).split("\n");for(let a of(i=d.pop()||"",d))if(a.startsWith("data: ")){let b=a.slice(6);if("[DONE]"===b)continue;try{let a=JSON.parse(b);s(a,h)}catch{}}}}catch(a){a instanceof Error&&"AbortError"===a.name||(console.error("Chat error:",a),b(a=>a.map(a=>a.id===h?{...a,content:e.A.t("chat.errorRetry"),isStreaming:!1}:a)))}finally{m.current=null,j(!1),b(a=>a.map(a=>a.id===h?{...a,isStreaming:!1}:a))}},[f,b,s]),handleStop:r,abortControllerRef:m}}},56929:(a,b,c)=>{"use strict";c.d(b,{C6:()=>h,e$:()=>t,jU:()=>g,oK:()=>u,u:()=>s,xb:()=>i,zs:()=>q});var d=c(67484),e=c.n(d),f=c(41564);function g(a){try{return JSON.parse(a),!0}catch{return!1}}function h(a){try{let b=JSON.parse(a);return JSON.stringify(b,null,2)}catch{return a}}function i(a){try{let b=JSON.parse(a);return p(b,0)}catch{return a}}let j="#79c0ff",k="#a5d6ff",l="#ff7b72",m="#8b949e",n=(a,b)=>e().createElement("span",{style:{color:a}},b);function o({label:a,labelColor:b,value:c,indent:d}){let[g,h]=e().useState(!1),[i,j]=e().useState({x:0,y:0}),l="string"==typeof c&&c.replace(/\\n/g,"\n").split("\n").length>3,o={onMouseDown:a=>{j({x:a.clientX,y:a.clientY})},onClick:a=>{let b=a.clientX-i.x,c=a.clientY-i.y;b*b+c*c>25||(a.stopPropagation(),h(a=>!a))},style:{cursor:"pointer"}};if(l&&g&&"string"==typeof c){let d=c.replace(/\\n/g,"\n").split("\n")[0],g=c.replace(/\\n/g,"\n").split("\n").length;return e().createElement("span",o,n(b,a),n(m,": "),n(k,d),n("#6e7681",` ${f.A.t("toolCall.foldedLines",{count:g})}`))}let q=e().createElement(e().Fragment,null,n(b,a),n(m,": "),p(c,d));return l?e().createElement("span",o,q):q}function p(a,b){let c=" ".repeat(b);if(null===a)return n(l,"null");if(void 0===a)return n(l,"undefined");if("string"==typeof a)return n(k,a.replace(/\\n/g,"\n").replace(/\n/g,"\n"+c));if("number"==typeof a)return n("#79c0ff",String(a));if("boolean"==typeof a)return n(l,String(a));if(Array.isArray(a))return 0===a.length?n(m,"[]"):e().createElement(e().Fragment,null,n(m,"["),"\n",...a.map((d,f)=>e().createElement("span",{key:f},c+" ",e().createElement(o,{label:`[${f}]`,labelColor:j,value:d,indent:b+1}),f<a.length-1?e().createElement(e().Fragment,null,n(m,","),"\n"):"\n")),c,n(m,"]"));if("object"==typeof a){let d=Object.entries(a);return 0===d.length?n(m,"{}"):e().createElement(e().Fragment,null,n(m,"{"),"\n",...d.map(([a,f],g)=>e().createElement("span",{key:a},c+" ",e().createElement(o,{label:a,labelColor:j,value:f,indent:b+1}),g<d.length-1?e().createElement(e().Fragment,null,n(m,","),"\n"):"\n")),c,n(m,"}"))}return String(a)}function q(a){try{let b=JSON.parse(a);if(b&&"string"==typeof b.file_path&&"string"==typeof b.old_string&&"string"==typeof b.new_string)return b}catch{}return null}let r=new Set([".png",".jpg",".jpeg",".gif",".webp",".svg",".bmp",".ico",".avif"]);function s(a){let b=a.slice(a.lastIndexOf(".")).toLowerCase();return r.has(b)}function t(a){return a.toLowerCase().endsWith(".md")}function u(a){try{let b=JSON.parse(a);if(b&&"string"==typeof b.file_path)return b.file_path}catch{let b=a.trim();if(b.startsWith("/")&&!b.includes("\n")&&b.length<500)return b}return null}},59347:(a,b,c)=>{"use strict";c.d(b,{A:()=>d});let d=(0,c(47408).A)("trash-2",[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]])},61969:(a,b,c)=>{"use strict";c.d(b,{e:()=>g,g:()=>h});var d=c(48249),e=c(67484),f=c(44384);function g({cwd:a,sessionId:b,onOpenProjectSessions:c,onOpenSessionBrowser:g,onOpenSettings:h}){let{t:i}=(0,f.Bd)(),[j,k]=(0,e.useState)(!1);return(0,d.jsx)("div",{className:"border-b border-border px-4 py-3 bg-card",children:(0,d.jsxs)("div",{className:"flex items-center justify-between",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)("img",{src:"/icons/icon-72x72.png",alt:"Cockpit",className:"w-6 h-6"}),(0,d.jsxs)("div",{className:"flex items-baseline gap-2",children:[(0,d.jsx)("h1",{className:"text-lg font-semibold text-foreground",children:"Cockpit"}),(0,d.jsx)("span",{className:"text-xs text-muted-foreground",children:"One seat. One AI. Everything under control."})]})]}),(0,d.jsxs)("div",{className:"flex items-center gap-3",children:[a&&(0,d.jsx)("span",{className:"text-sm text-foreground max-w-md truncate cursor-help",title:`CWD: ${a}`,children:a}),!a&&b&&(0,d.jsxs)("span",{className:"text-xs text-muted-foreground",children:["Session: ",b.slice(0,8),"..."]}),a&&(0,d.jsx)("button",{onClick:c,className:"p-2 text-muted-foreground hover:text-foreground hover:bg-accent rounded-lg transition-colors",title:i("sessions.projectSessions"),children:(0,d.jsx)("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,d.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"})})}),(0,d.jsx)("button",{onClick:g,className:"p-2 text-muted-foreground hover:text-foreground hover:bg-accent rounded-lg transition-colors",title:i("sessions.browseAllSessions"),children:(0,d.jsx)("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,d.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 11H5m14 0a2 2 0 012 2v6a2 2 0 01-2 2H5a2 2 0 01-2-2v-6a2 2 0 012-2m14 0V9a2 2 0 00-2-2M5 11V9a2 2 0 012-2m0 0V5a2 2 0 012-2h6a2 2 0 012 2v2M7 7h10"})})}),b&&(0,d.jsx)("button",{onClick:()=>{let a=`claude -r ${b}`;navigator.clipboard.writeText(a).then(()=>{k(!0),setTimeout(()=>k(!1),2e3)})},className:`p-2 rounded-lg transition-colors ${j?"text-green-500 bg-green-500/10":"text-muted-foreground hover:text-foreground hover:bg-accent"}`,title:j?i("chat.copiedCommandTooltip"):i("chat.copyCommandTooltip",{sessionId:b}),children:j?(0,d.jsx)("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,d.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})}):(0,d.jsx)("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,d.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 5H6a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2v-1M8 5a2 2 0 002 2h2a2 2 0 002-2M8 5a2 2 0 012-2h2a2 2 0 012 2m0 0h2a2 2 0 012 2v3m2 4H10m0 0l3-3m-3 3l3 3"})})}),(0,d.jsx)("button",{onClick:h,className:"p-2 text-muted-foreground hover:text-foreground hover:bg-accent rounded-lg transition-colors",title:i("settings.title"),children:(0,d.jsxs)("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:[(0,d.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M10.325 4.317c.426-1.756 2.924-1.756 3.35 0a1.724 1.724 0 002.573 1.066c1.543-.94 3.31.826 2.37 2.37a1.724 1.724 0 001.065 2.572c1.756.426 1.756 2.924 0 3.35a1.724 1.724 0 00-1.066 2.573c.94 1.543-.826 3.31-2.37 2.37a1.724 1.724 0 00-2.572 1.065c-.426 1.756-2.924 1.756-3.35 0a1.724 1.724 0 00-2.573-1.066c-1.543.94-3.31-.826-2.37-2.37a1.724 1.724 0 00-1.065-2.572c-1.756-.426-1.756-2.924 0-3.35a1.724 1.724 0 001.066-2.573c-.94-1.543.826-3.31 2.37-2.37.996.608 2.296.07 2.572-1.065z"}),(0,d.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z"})]})})]})]})})}function h({tokenUsage:a}){let{t:b}=(0,f.Bd)();return(0,d.jsx)("div",{className:"px-4 py-1.5 border-t border-border bg-secondary",children:(0,d.jsxs)("div",{className:"flex items-center justify-end gap-4 text-xs text-muted-foreground",children:[(0,d.jsxs)("span",{className:"flex items-center gap-1",children:[(0,d.jsx)("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,d.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M7 8h10M7 12h4m1 8l-4-4H5a2 2 0 01-2-2V6a2 2 0 012-2h14a2 2 0 012 2v8a2 2 0 01-2 2h-3l-4 4z"})}),(0,d.jsxs)("span",{children:[b("chat.context"),": ",(0,d.jsx)("strong",{className:"text-foreground",children:(a.inputTokens+a.cacheReadInputTokens+a.cacheCreationInputTokens).toLocaleString()})]})]}),(0,d.jsxs)("span",{className:"flex items-center gap-1",children:[(0,d.jsx)("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,d.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 10h.01M12 10h.01M16 10h.01M9 16H5a2 2 0 01-2-2V6a2 2 0 012-2h14a2 2 0 012 2v8a2 2 0 01-2 2h-5l-5 5v-5z"})}),(0,d.jsxs)("span",{children:[b("chat.output"),": ",(0,d.jsx)("strong",{className:"text-foreground",children:a.outputTokens.toLocaleString()})]})]}),(a.cacheReadInputTokens>0||a.cacheCreationInputTokens>0)&&(0,d.jsxs)("span",{className:"flex items-center gap-1 text-brand",children:[(0,d.jsx)("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,d.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 7v10c0 2.21 3.582 4 8 4s8-1.79 8-4V7M4 7c0 2.21 3.582 4 8 4s8-1.79 8-4M4 7c0-2.21 3.582-4 8-4s8 1.79 8 4"})}),(0,d.jsxs)("span",{children:["Cache: ",(a.cacheReadInputTokens/(a.inputTokens+a.cacheReadInputTokens+a.cacheCreationInputTokens)*100).toFixed(0),"%"]})]}),a.totalCostUsd>0&&(0,d.jsxs)("span",{className:"flex items-center gap-1 text-green-11",children:[(0,d.jsx)("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,d.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 8c-1.657 0-3 .895-3 2s1.343 2 3 2 3 .895 3 2-1.343 2-3 2m0-8c1.11 0 2.08.402 2.599 1M12 8V7m0 1v8m0 0v1m0-1c-1.11 0-2.08-.402-2.599-1M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})}),(0,d.jsxs)("span",{children:["$",a.totalCostUsd.toFixed(4)]})]})]})})}},62862:(a,b,c)=>{"use strict";function d(a){let b=a.split(".").pop()?.toLowerCase();return b?["ts","tsx","js","jsx","mjs","cjs"].includes(b)?"typescript":["py","pyi"].includes(b)?"python":null:null}c.d(b,{c:()=>d})},63033:a=>{"use strict";a.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},66185:(a,b,c)=>{"use strict";c.d(b,{c:()=>j});var d=c(48249),e=c(67484),f=c(44384),g=c(74429),h=c(4219);function i({path:a,matchedIndices:b}){let c=(0,e.useMemo)(()=>new Set(b),[b]),f=a.lastIndexOf("/"),g=f>=0?a.slice(0,f+1):"",h=f>=0?a.slice(f+1):a,i=(a,b,e)=>{let f=[],g="",h=!1;for(let e=0;e<a.length;e++){let i=b+e,j=c.has(i);j!==h&&g&&(f.push(h?(0,d.jsx)("span",{className:"text-brand font-medium",children:g},`${b}-${e}`):(0,d.jsx)("span",{children:g},`${b}-${e}`)),g=""),h=j,g+=a[e]}return g&&f.push(h?(0,d.jsx)("span",{className:"text-brand font-medium",children:g},`${b}-end`):(0,d.jsx)("span",{children:g},`${b}-end`)),(0,d.jsx)("span",{className:e,children:f})};return(0,d.jsxs)("span",{className:"truncate",children:[g&&i(g,0,"text-muted-foreground"),i(h,g.length,"text-foreground")]})}function j({files:a,fileIndex:b,recentFiles:c,onSelectFile:j,onClose:k}){let{t:l}=(0,f.Bd)(),[m,n]=(0,e.useState)(""),[o,p]=(0,e.useState)(0),q=(0,e.useRef)(null),r=(0,e.useRef)(null),s=(0,e.useMemo)(()=>{let c,d;return b??(c=[],(d=a=>{for(let b of a)b.isDirectory&&b.children?d(b.children):b.isDirectory||c.push(b.path)})(a),c)},[b,a]),t=(0,e.useMemo)(()=>{if(!m.trim()){let a=new Set(c);return[...c.map(a=>({path:a,score:0,matchedIndices:[]})),...s.filter(b=>!a.has(b)).slice(0,50).map(a=>({path:a,score:0,matchedIndices:[]}))]}let a=[];for(let b of s){let d=function(a,b){let c=a.toLowerCase(),d=b.toLowerCase(),e=[],f=0,g=0,h=-1;for(let i=0;i<c.length&&f<d.length;i++)c[i]===d[f]&&(e.push(i),h===i-1&&(g+=5),(0===i||"/"===a[i-1]||"."===a[i-1]||"-"===a[i-1]||"_"===a[i-1])&&(g+=10),i>a.lastIndexOf("/")&&(g+=3),a[i]===b[f]&&(g+=1),h=i,f++);return f<d.length?null:(g-=.1*a.length,{path:a,score:g,matchedIndices:e})}(b,m.trim());d&&(c.includes(b)&&(d.score+=20),a.push(d))}return a.sort((a,b)=>b.score-a.score),a.slice(0,50)},[m,s,c]),u=(0,e.useCallback)(a=>{n(a),p(0)},[]),v=(0,e.useCallback)(a=>{j(a),k()},[j,k]),w=(0,e.useCallback)(a=>{if(!a.nativeEvent.isComposing)switch(a.key){case"ArrowDown":a.preventDefault(),p(a=>Math.min(a+1,t.length-1));break;case"ArrowUp":a.preventDefault(),p(a=>Math.max(a-1,0));break;case"Enter":a.preventDefault(),t[o]&&v(t[o].path);break;case"Escape":a.preventDefault(),k()}},[t,o,v,k]);return(0,g.createPortal)((0,d.jsx)("div",{className:"fixed inset-0 z-[300] flex items-start justify-center pt-[15vh]",onClick:k,children:(0,d.jsxs)("div",{className:"w-[680px] max-h-[60vh] bg-card border border-border rounded-lg shadow-2xl overflow-hidden flex flex-col",onClick:a=>a.stopPropagation(),children:[(0,d.jsxs)("div",{className:"px-3 py-2 border-b border-border flex items-center gap-2",children:[(0,d.jsx)("svg",{className:"w-4 h-4 text-muted-foreground flex-shrink-0",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,d.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"})}),(0,d.jsx)("input",{ref:q,value:m,onChange:a=>u(a.target.value),onKeyDown:w,placeholder:l("quickFileOpen.placeholder"),className:"flex-1 bg-transparent text-sm text-foreground outline-none placeholder:text-muted-foreground",autoComplete:"off",autoCorrect:"off",spellCheck:"false"}),(0,d.jsx)("kbd",{className:"text-[10px] text-muted-foreground px-1.5 py-0.5 rounded border border-border bg-secondary",children:"ESC"})]}),(0,d.jsx)("div",{ref:r,className:"flex-1 overflow-y-auto py-1",children:0===t.length?(0,d.jsx)("div",{className:"px-3 py-8 text-center text-sm text-muted-foreground",children:l("quickFileOpen.noMatch")}):t.map((a,b)=>(0,d.jsxs)("div",{className:`px-3 py-1.5 flex items-center gap-2 cursor-pointer transition-colors ${b===o?"bg-brand/15 text-foreground":"hover:bg-accent text-foreground"}`,"data-tooltip":a.path,onClick:()=>v(a.path),children:[(0,d.jsx)(h.o,{name:a.path.split("/").pop()||"",className:"w-4 h-4 flex-shrink-0"}),(0,d.jsx)(i,{path:a.path,matchedIndices:a.matchedIndices}),!m.trim()&&c.includes(a.path)&&(0,d.jsx)("span",{className:"ml-auto text-[10px] text-muted-foreground px-1.5 py-0.5 rounded bg-secondary flex-shrink-0",children:l("quickFileOpen.recent")})]},a.path))}),(0,d.jsxs)("div",{className:"px-3 py-1.5 border-t border-border flex items-center gap-3 text-[10px] text-muted-foreground",children:[(0,d.jsxs)("span",{className:"flex items-center gap-1",children:[(0,d.jsx)("kbd",{className:"px-1 py-0.5 rounded border border-border bg-secondary",children:"↑↓"})," ",l("quickFileOpen.selectHint")]}),(0,d.jsxs)("span",{className:"flex items-center gap-1",children:[(0,d.jsx)("kbd",{className:"px-1 py-0.5 rounded border border-border bg-secondary",children:"Enter"})," ",l("quickFileOpen.openHint")]}),(0,d.jsxs)("span",{className:"flex items-center gap-1",children:[(0,d.jsx)("kbd",{className:"px-1 py-0.5 rounded border border-border bg-secondary",children:"Esc"})," ",l("quickFileOpen.closeHint")]})]})]})}),document.body)}},66254:(a,b,c)=>{"use strict";c.d(b,{h:()=>l});var d=c(48249),e=c(67484),f=c.n(e),g=c(36043),h=c(26068),i=c(4219);let j={M:{text:"text-amber-11",bg:"bg-amber-9/20"},A:{text:"text-green-11",bg:"bg-green-9/20"},D:{text:"text-red-11",bg:"bg-red-9/20"},"?":{text:"text-slate-9",bg:"bg-slate-9/20"},R:{text:"text-blue-11",bg:"bg-blue-9/20"}},k=f().memo(function({item:a,isSelected:b,isExpanded:c,isLoading:f,onSelect:g,onToggle:h,onContextMenu:k,renderActions:l}){let{node:m,level:n,gitStatus:o,hasChangedChildren:p}=a,q=o?j[o]:null,r=(0,e.useCallback)(()=>{m.isDirectory?h(m.path):g(m.path)},[m.isDirectory,m.path,g,h]),s=(0,e.useCallback)(a=>{k(a,m.path,m.isDirectory)},[m.path,m.isDirectory,k]),t=!m.isDirectory&&(".env"===m.name||m.name.startsWith(".env.")),u=o?q.text:p?"text-amber-11":t?"text-yellow-600 dark:text-yellow-500":b&&!m.isDirectory?"text-brand":"text-foreground";return(0,d.jsxs)("div",{className:`flex items-center gap-1.5 py-0.5 px-2 cursor-pointer hover:bg-accent ${b?"bg-brand/10":""}`,style:{paddingLeft:`${12*n+8}px`},onClick:r,onContextMenu:s,children:[m.isDirectory?f?(0,d.jsxs)("svg",{className:"w-4 h-4 flex-shrink-0 text-muted-foreground animate-spin",viewBox:"0 0 16 16",fill:"none",children:[(0,d.jsx)("circle",{cx:"8",cy:"8",r:"6",stroke:"currentColor",strokeWidth:"1.5",opacity:"0.3"}),(0,d.jsx)("path",{d:"M14 8a6 6 0 0 0-6-6",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]}):(0,d.jsx)("svg",{className:`w-4 h-4 flex-shrink-0 text-muted-foreground transition-transform ${c?"rotate-90":""}`,viewBox:"0 0 16 16",fill:"none",children:(0,d.jsx)("path",{d:"M6 4 L10 8 L6 12",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}):(0,d.jsx)(i.o,{name:m.name,size:16,className:"flex-shrink-0 ml-4"}),(0,d.jsx)("span",{className:`text-sm truncate flex-1 ${u}`,"data-tooltip":m.isSymlink&&m.symlinkTarget?`${m.path} → ${m.symlinkTarget}`:m.path,children:m.name}),m.isSymlink&&(0,d.jsx)("span",{className:"text-xs text-muted-foreground flex-shrink-0",children:"→"}),o&&(0,d.jsx)("span",{className:`text-xs font-mono px-1 rounded ${q.text} ${q.bg} flex-shrink-0`,children:o}),m.isDirectory&&p&&(0,d.jsx)("span",{className:"w-1.5 h-1.5 rounded-full bg-amber-9 flex-shrink-0"}),l?.(m)]})});function l({files:a,selectedPath:b,expandedPaths:c,matchedPaths:f=null,gitStatusMap:i=null,loadingDirs:j,onSelect:l,onToggle:m,cwd:n,shouldScrollToSelected:o=!1,onScrolledToSelected:p,className:q,renderActions:r,onCreateFile:s,onDelete:t,onRefresh:u,onCopyFile:v,onPaste:w}){let x=(0,e.useRef)(null),{contextMenu:y,showContextMenu:z,hideContextMenu:A}=(0,h.Ee)(),B=(0,e.useMemo)(()=>(function a(b,c,d,e=null,f=0){let g=[];for(let h of b){if(null!==d&&!d.has(h.path))continue;let b=e?.get(h.path),i=h.isDirectory?function(a,b){if(!b)return!1;let c=a+"/";for(let a of b.keys())if(a.startsWith(c))return!0;return!1}(h.path,e):void 0;g.push({node:h,level:f,gitStatus:b,hasChangedChildren:i}),h.isDirectory&&h.children&&c.has(h.path)&&g.push(...a(h.children,c,d,e,f+1))}return g})(a,c,f,i),[a,c,f,i]),C=(0,g.Te)({count:B.length,getScrollElement:()=>x.current,estimateSize:()=>26,overscan:10});return((0,e.useRef)(p).current=p,0===B.length)?(0,d.jsx)("div",{className:"p-4 text-center text-muted-foreground text-sm",children:"No files"}):(0,d.jsxs)("div",{ref:x,className:q||"h-full overflow-y-auto",style:{willChange:"transform"},children:[(0,d.jsx)("div",{style:{height:`${C.getTotalSize()}px`,width:"100%",position:"relative"},children:C.getVirtualItems().map(a=>{let e=B[a.index];return(0,d.jsx)("div",{style:{position:"absolute",top:0,left:0,width:"100%",height:`${a.size}px`,transform:`translateY(${a.start}px)`},children:(0,d.jsx)(k,{item:e,isSelected:b===e.node.path,isExpanded:c.has(e.node.path),isLoading:j?.has(e.node.path),onSelect:l,onToggle:m,onContextMenu:z,renderActions:r})},e.node.path)})}),y&&(0,d.jsx)(h.ft,{x:y.x,y:y.y,path:y.path,cwd:n,isDirectory:y.isDirectory,onClose:A,onCreateFile:s,onDelete:t,onRefresh:u,onCopyFile:v,onPaste:w})]})}},68502:(a,b,c)=>{"use strict";c.d(b,{t:()=>g});var d=c(48249),e=c(67484),f=c(44384);function g({x:a,y:b,comment:c,container:g,onClose:h,onUpdateComment:i,onDeleteComment:j}){let{t:k}=(0,f.Bd)(),[l,m]=(0,e.useState)(!1),[n,o]=(0,e.useState)(c.content),p=(0,e.useRef)(null),[q,r]=(0,e.useState)({x:0,y:0}),s=async()=>{n.trim()&&(await i(c.id,n.trim()),m(!1))},t=async()=>{await j(c.id),h()};return(0,d.jsx)("div",{ref:p,className:"absolute z-[200] w-96 bg-card border border-border rounded-lg shadow-lg overflow-hidden",style:{left:q.x,top:q.y},children:(0,d.jsx)("div",{className:"p-3",children:l?(0,d.jsxs)("div",{className:"space-y-2",children:[(0,d.jsx)("textarea",{value:n,onChange:a=>o(a.target.value),className:"w-full px-2 py-1.5 text-sm border border-border rounded bg-card resize-none focus:outline-none focus:ring-1 focus:ring-ring",rows:3,autoFocus:!0,onKeyDown:a=>{"Enter"!==a.key||a.shiftKey||a.nativeEvent.isComposing||(a.preventDefault(),s()),"Escape"===a.key&&(m(!1),o(c.content))}}),(0,d.jsxs)("div",{className:"flex justify-end gap-2",children:[(0,d.jsx)("button",{onClick:()=>{m(!1),o(c.content)},className:"px-2 py-1 text-xs text-muted-foreground hover:text-foreground",children:k("common.cancel")}),(0,d.jsx)("button",{onClick:s,className:"px-2 py-1 text-xs bg-brand text-white rounded hover:bg-brand/90",children:k("common.save")})]})]}):(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("p",{className:"text-sm text-foreground whitespace-pre-wrap",children:c.content}),(0,d.jsxs)("div",{className:"mt-2 flex items-center justify-between",children:[(0,d.jsx)("span",{className:"text-xs text-muted-foreground",children:k("comments.lineRange",{start:c.startLine,end:c.endLine})}),(0,d.jsxs)("div",{className:"flex gap-1",children:[(0,d.jsx)("button",{onClick:()=>m(!0),className:"p-1 rounded hover:bg-accent text-muted-foreground",title:k("common.edit"),children:(0,d.jsx)("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,d.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M11 5H6a2 2 0 00-2 2v11a2 2 0 002 2h11a2 2 0 002-2v-5m-1.414-9.414a2 2 0 112.828 2.828L11.828 15H9v-2.828l8.586-8.586z"})})}),(0,d.jsx)("button",{onClick:t,className:"p-1 rounded hover:bg-accent text-muted-foreground hover:text-red-9",title:k("common.delete"),children:(0,d.jsx)("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,d.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"})})})]})]})]})})})}},69648:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{z:()=>q});var e=c(48249),f=c(67484),g=c(44384),h=c(31172),i=c(80600),j=c(44218),k=c(19794),l=c(46674),m=c(86402),n=a([m]);function o(a,b){if(b&&a.startsWith(b)){let c=a.slice(b.length);return c.startsWith("/")?c.slice(1):c}return a}function p({node:a,selectedUid:b,onSelect:c,depth:d=0}){let[g,h]=(0,f.useState)(!0);if(a.isFile&&a.change){let f=b===a.change.uid;return(0,e.jsxs)("button",{onClick:()=>c(a.change),className:`w-full flex items-center gap-1.5 px-2 py-1 text-xs text-left rounded transition-colors ${f?"bg-brand/15 text-brand":"text-foreground hover:bg-accent"}`,style:{paddingLeft:`${12*d+8}px`},"data-tooltip":a.fullPath,children:[(0,e.jsx)(i.A,{className:"w-3.5 h-3.5 flex-shrink-0 opacity-60"}),(0,e.jsx)("span",{className:"truncate",children:a.name}),(0,e.jsx)("span",{className:`ml-auto text-[10px] flex-shrink-0 ${"write"===a.change.type?"text-green-500":"text-yellow-500"}`,children:"write"===a.change.type?"new":"edit"})]})}return(0,e.jsxs)("div",{children:[(0,e.jsxs)("button",{onClick:()=>h(!g),className:"w-full flex items-center gap-1 px-2 py-1 text-xs text-muted-foreground hover:text-foreground transition-colors",style:{paddingLeft:`${12*d+8}px`},children:[g?(0,e.jsx)(j.A,{className:"w-3 h-3"}):(0,e.jsx)(k.A,{className:"w-3 h-3"}),(0,e.jsx)("span",{className:"truncate",children:a.name})]}),g&&a.children.map((a,f)=>(0,e.jsx)(p,{node:a,selectedUid:b,onSelect:c,depth:d+1},a.isFile&&a.change?a.change.uid:`${a.fullPath}-${f}`))]})}function q({toolCalls:a,cwd:b,onClose:c}){let{t:d}=(0,g.Bd)(),i=(0,f.useMemo)(()=>(function(a,b){let c=[],d=0;for(let e of a)if("Edit"===e.name){let a=e.input;a.file_path&&"string"==typeof a.old_string&&"string"==typeof a.new_string&&c.push({filePath:o(a.file_path,b),uid:`change-${d++}`,type:"edit",old_string:a.old_string,new_string:a.new_string})}else if("Write"===e.name){let a=e.input;a.file_path&&"string"==typeof a.content&&c.push({filePath:o(a.file_path,b),uid:`change-${d++}`,type:"write",old_string:"",new_string:a.content})}return c})(a,b),[a,b]),j=(0,f.useMemo)(()=>(function a(b){return b.map(b=>{if(!b.isFile&&1===b.children.length&&!b.children[0].isFile){let c=b.children[0];return{...c,name:b.name+"/"+c.name,children:a(c.children)}}return{...b,children:a(b.children)}})})(function(a){let b=[];for(let c of a){let a=c.filePath.split("/").filter(Boolean),d=b;for(let b=0;b<a.length;b++){let e=a[b],f=b===a.length-1,g=a.slice(0,b+1).join("/");if(f){let a={name:e,fullPath:g,isFile:!0,children:[],change:c};d.push(a)}else{let a=d.find(a=>a.name===e&&!a.isFile);a||(a={name:e,fullPath:g,isFile:!1,children:[]},d.push(a)),d=a.children}}}return b}(i)),[i]),[k,n]=(0,f.useState)(i[0]||null),[q,r]=(0,f.useState)("unified"),[s,t]=(0,f.useState)(null),u=(0,f.useRef)(null);if(0===i.length)return null;let v=(0,e.jsx)("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50 p-4",onClick:c,children:(0,e.jsxs)("div",{className:"bg-card rounded-lg shadow-xl w-full max-w-[90%] h-[90vh] flex flex-col transition-all",onClick:a=>a.stopPropagation(),children:[(0,e.jsxs)("div",{className:"flex items-center justify-between px-4 py-3 border-b border-border",children:[(0,e.jsx)("div",{className:"flex items-center gap-2",children:(0,e.jsx)("h3",{className:"text-sm font-medium text-foreground",children:d("diffViewer.fileChanges",{count:i.length})})}),(0,e.jsxs)("div",{className:"flex items-center gap-3",children:[(0,e.jsxs)("div",{className:"flex items-center gap-1 bg-accent rounded p-0.5",children:[(0,e.jsx)("button",{onClick:()=>r("unified"),className:`px-2 py-1 text-xs rounded transition-colors ${"unified"===q?"bg-card text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"}`,children:"Unified"}),(0,e.jsx)("button",{onClick:()=>r("split"),className:`px-2 py-1 text-xs rounded transition-colors ${"split"===q?"bg-card text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"}`,children:"Split"})]}),(0,e.jsx)("button",{onClick:c,className:"p-1 text-muted-foreground hover:text-foreground hover:bg-accent rounded transition-colors",children:(0,e.jsx)(l.A,{className:"w-5 h-5"})})]})]}),(0,e.jsxs)("div",{className:"flex-1 flex overflow-hidden",children:[(0,e.jsx)("div",{ref:u,className:"w-56 flex-shrink-0 border-r border-border overflow-y-auto py-2",children:j.map((a,b)=>(0,e.jsx)(p,{node:a,selectedUid:k?.uid||"",onSelect:n},a.isFile&&a.change?a.change.uid:`${a.fullPath}-${b}`))}),(0,e.jsx)("div",{className:"flex-1 overflow-auto",children:k?"unified"===q?(0,e.jsx)(m.xU,{oldContent:k.old_string,newContent:k.new_string,filePath:k.filePath}):(0,e.jsx)(m.xZ,{oldContent:k.old_string,newContent:k.new_string,filePath:k.filePath,isNew:"write"===k.type}):(0,e.jsx)("div",{className:"flex items-center justify-center h-full text-muted-foreground text-sm",children:d("diffViewer.selectFileToView")})})]})]})});return(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(h.Z,{children:v}),s&&(0,e.jsx)(h.Z,{children:(0,e.jsx)("div",{className:"fixed z-[9999] px-2 py-1 bg-popover text-popover-foreground text-xs font-mono rounded shadow-lg border border-brand whitespace-nowrap pointer-events-none",style:{left:s.x+12,top:s.y+16},children:s.text})})]})}m=(n.then?(await n)():n)[0],d()}catch(a){d(a)}})},70722:a=>{"use strict";a.exports=require("next/dist/shared/lib/invariant-error")},73136:a=>{"use strict";a.exports=require("node:url")},74405:(a,b,c)=>{Promise.resolve().then(c.bind(c,54338))},75005:(a,b,c)=>{"use strict";c.d(b,{A:()=>e});var d=c(67484);function e({lines:a,enabled:b,onContentChange:c,onEnterInsert:e,onSave:f,getVisibleLineCount:g,scrollToLine:h,onSearchExecute:i,onSearchNext:j,onSearchPrev:k,onSearchClear:l}){let[m,n]=(0,d.useState)("normal"),[o,p]=(0,d.useState)(-1),[q,r]=(0,d.useState)(0),[s,t]=(0,d.useState)(!1),[u,v]=(0,d.useState)(""),[w,x]=(0,d.useState)(""),[y,z]=(0,d.useState)(""),[A,B]=(0,d.useState)(""),C=(0,d.useRef)([]),D=(0,d.useRef)([]),E=(0,d.useRef)([]),F=(0,d.useRef)(null),G=(0,d.useRef)(a),H=(0,d.useCallback)((a,b)=>Math.max(0,Math.min(b,Math.max(0,(G.current[a]??"").length-1))),[]);(0,d.useRef)(a.length);let I=(0,d.useCallback)(()=>{F.current&&(clearTimeout(F.current),F.current=null),v("")},[]),J=(0,d.useCallback)(()=>{F.current&&clearTimeout(F.current),F.current=setTimeout(()=>{v(""),F.current=null},500)},[]),K=(0,d.useCallback)((a,b)=>{C.current.push(b),D.current=[],t(!0),c(a.join("\n"))},[c]),L=(0,d.useCallback)((a,b)=>{let c=Math.max(0,Math.min(a,G.current.length-1));p(c),r(H(c,b??0)),h(c,"auto")},[h,H]),M=(0,d.useCallback)(a=>{p(b=>{let c=Math.max(0,Math.min(b+a,G.current.length-1));return h(c,"auto"),r(a=>Math.max(0,Math.min(a,Math.max(0,(G.current[c]??"").length-1)))),c})},[h]),N=(0,d.useCallback)(()=>{let a=G.current,b=Math.min(o,a.length-1);if(0===a.length)return;let c=a[b];E.current=[c];let d=[...a];d.splice(b,1),0===d.length&&d.push("");let e=Math.min(b,d.length-1);K(d,{lineIndex:b,oldLines:[c],newLines:[],cursorLine:b}),p(e),r(0)},[o,K]),O=(0,d.useCallback)(()=>{let a=G.current,b=Math.min(o,a.length-1);a.length>0&&(E.current=[a[b]])},[o]),P=(0,d.useCallback)(()=>{let a=E.current;if(0===a.length)return;let b=G.current,c=Math.min(o,b.length-1)+1,d=[...b];d.splice(c,0,...a),K(d,{lineIndex:c,oldLines:[],newLines:[...a],cursorLine:o}),p(c),r(0),h(c,"auto")},[o,K,h]),Q=(0,d.useCallback)(()=>{let a=G.current,b=Math.min(o,a.length-1),c=a[b];if(!c||0===c.length)return;let d=c.substring(1),e=[...a];e[b]=d,K(e,{lineIndex:b,oldLines:[c],newLines:[d],cursorLine:o})},[o,K]),R=(0,d.useCallback)(()=>{let a=C.current;if(0===a.length)return;let b=a.pop(),d=[...G.current];0===b.newLines.length&&b.oldLines.length>0?d.splice(b.lineIndex,0,...b.oldLines):0===b.oldLines.length&&b.newLines.length>0?(d.splice(b.lineIndex,b.newLines.length),0===d.length&&d.push("")):d.splice(b.lineIndex,b.newLines.length,...b.oldLines),D.current.push(b),c(d.join("\n")),p(Math.min(b.cursorLine,d.length-1)),h(Math.min(b.cursorLine,d.length-1),"auto"),0===a.length&&t(!1)},[c,h]),S=(0,d.useCallback)(()=>{let a=D.current;if(0===a.length)return;let b=a.pop(),d=[...G.current];0===b.newLines.length&&b.oldLines.length>0?(d.splice(b.lineIndex,b.oldLines.length),0===d.length&&d.push("")):0===b.oldLines.length&&b.newLines.length>0?d.splice(b.lineIndex,0,...b.newLines):d.splice(b.lineIndex,b.oldLines.length,...b.newLines),C.current.push(b),t(!0),c(d.join("\n"));let e=b.lineIndex+Math.max(0,b.newLines.length-1);p(Math.min(e,d.length-1)),h(Math.min(e,d.length-1),"auto")},[c,h]),T=(0,d.useCallback)(a=>{let b=G.current,c=Math.min(o,b.length-1);if("o"===a||"O"===a){let d="o"===a?c+1:c,e=[...b];e.splice(d,0,""),K(e,{lineIndex:d,oldLines:[],newLines:[""],cursorLine:o}),c=d,p(d)}n("insert"),e(c,q,a)},[o,q,K,e]),U=(0,d.useCallback)(()=>{n("normal"),I()},[I]),V=(0,d.useCallback)(()=>{n("command"),x("")},[]),W=(0,d.useCallback)(()=>{n("normal"),x("")},[]),X=(0,d.useCallback)(()=>{n("search"),z("")},[]),Y=(0,d.useCallback)(()=>{n("normal"),z("")},[]),Z=(0,d.useCallback)(a=>{let b=a.trim();if("w"===b){f?.(),n("normal"),x("");return}if("q"===b){n("normal"),x("");return}if("wq"===b){f?.(),n("normal"),x("");return}if("noh"===b||"nohlsearch"===b){l?.(),n("normal"),x("");return}let c=parseInt(b,10);if(!isNaN(c)&&c>0){let a=Math.min(c-1,G.current.length-1);p(a),h(a,"center"),n("normal"),x("");return}n("normal"),x("")},[f,l,h]),$=(0,d.useCallback)(a=>{if(!a){n("normal"),z("");return}B(a),i?.(a),n("normal"),z("")},[i]),_=(0,d.useCallback)(a=>{if(!b)return!1;let c=a.ctrlKey&&"c"===a.key&&!a.metaKey&&!a.shiftKey;if("insert"===m)return("Escape"===a.key||!!c)&&(U(),!0);if("command"===m)return!a.isComposing&&("Escape"===a.key||c?W():"Enter"===a.key?Z(w):"Backspace"===a.key?0===w.length?W():x(a=>a.slice(0,-1)):1!==a.key.length||a.metaKey||a.ctrlKey||x(b=>b+a.key),!0);if("search"===m)return!a.isComposing&&("Escape"===a.key||c?Y():"Enter"===a.key?$(y):"Backspace"===a.key?0===y.length?Y():z(a=>a.slice(0,-1)):1!==a.key.length||a.metaKey||a.ctrlKey||z(b=>b+a.key),!0);if(o<0&&(p(0),r(0)),a.metaKey)return!1;if(a.ctrlKey)return"d"===a.key?(M(Math.max(1,Math.floor(g()/2))),I(),!0):"u"===a.key?(M(-Math.max(1,Math.floor(g()/2))),I(),!0):"r"===a.key&&(S(),I(),!0);let d=a.key,e=u+d;if("g"===e)return v("g"),J(),!0;if("gg"===e)return L(0),I(),!0;if("d"===e)return v("d"),J(),!0;if("dd"===e)return N(),I(),!0;if("y"===e)return v("y"),J(),!0;if("yy"===e)return O(),I(),!0;if(u&&e!==d&&I(),"j"===d||"ArrowDown"===d)return M(1),!0;if("k"===d||"ArrowUp"===d)return M(-1),!0;if("h"===d||"ArrowLeft"===d)return r(a=>Math.max(0,a-1)),!0;if("l"===d||"ArrowRight"===d){let a=Math.max(0,(G.current[o]??"").length-1);return r(b=>Math.min(a,b+1)),!0}if("0"===d)return r(0),!0;if("$"===d)return r(Math.max(0,(G.current[o]??"").length-1)),!0;if("^"===d){let a=(G.current[o]??"").search(/\S/);return r(a>=0?a:0),!0}return"G"===d?(L(G.current.length-1),!0):"x"===d?(Q(),!0):"p"===d?(P(),!0):"u"===d?(R(),!0):"i"===d||"a"===d||"I"===d||"A"===d||"o"===d||"O"===d?(T(d),!0):"/"===d?(X(),!0):"n"===d?(j?.(),!0):"N"===d?(k?.(),!0):":"===d?(V(),!0):"Escape"!==d&&1===d.length},[b,m,u,w,y,o,U,T,V,W,X,Y,Z,$,M,L,g,N,O,P,Q,R,S,I,J,j,k]);return{state:{mode:m,cursorLine:o,cursorCol:q,isDirty:s,keyBuffer:u,commandInput:w,searchInput:y,lastSearch:A},handleKeyDown:_,enterNormal:U,enterInsert:T,setCursorLine:p,setCursorCol:r,setCommandInput:x,setSearchInput:z,setIsDirty:t,clearUndoHistory:(0,d.useCallback)(()=>{C.current=[],D.current=[]},[])}}},76760:a=>{"use strict";a.exports=require("node:path")},77033:(a,b,c)=>{"use strict";c.d(b,{k_:()=>g,nH:()=>h});var d=c(48249),e=c(67484);let f=(0,e.createContext)(null);function g({children:a}){let b=(0,e.useRef)(new Map),c=(0,e.useRef)(null),[g,h]=(0,e.useState)(!1),i=(0,e.useCallback)((a,c)=>{b.current.set(c,a)},[]),j=(0,e.useCallback)(a=>{b.current.delete(a)},[]),k=(0,e.useCallback)(a=>{c.current=a},[]),l=(0,e.useCallback)(a=>{let d=c.current;if(!d)return void console.warn("No active tab to send message");let e=b.current.get(d);e?e(a):console.warn(`No chat sender registered for tab ${d}`)},[]),m=(0,e.useMemo)(()=>({sendMessage:l,isLoading:g,registerChat:i,unregisterChat:j,setActiveTab:k,setIsLoading:h}),[l,g,i,j,k]);return(0,d.jsx)(f.Provider,{value:m,children:a})}function h(){return(0,e.useContext)(f)}},77068:a=>{"use strict";a.exports=require("next/dist/shared/lib/size-limit")},77937:(a,b,c)=>{"use strict";c.d(b,{f:()=>h,w:()=>g});var d=c(48249),e=c(67484),f=c(44384);function g({x:a,y:b,visible:c,container:e,onAddComment:g,onSendToAI:h,onSearch:i,isChatLoading:j}){let{t:k}=(0,f.Bd)(),l=e.getBoundingClientRect(),m=a-l.left,n=Math.max(0,b-l.top-40);return(0,d.jsxs)("div",{className:"floating-toolbar absolute z-[200] flex items-center gap-1.5 bg-card border border-border rounded-lg shadow-xl p-1.5",style:{left:m+8,top:n,visibility:c?"visible":"hidden",pointerEvents:c?"auto":"none"},children:[(0,d.jsx)("button",{className:"px-3 py-1.5 text-xs font-medium border border-brand text-brand rounded-md hover:bg-brand/10 transition-colors",onClick:g,children:k("floatingToolbar.addComment")}),(0,d.jsx)("button",{className:"px-3 py-1.5 text-xs font-medium border border-brand text-brand rounded-md hover:bg-brand/10 transition-colors disabled:opacity-50 disabled:cursor-not-allowed",onClick:h,disabled:j,title:k(j?"comments.aiResponding":"floatingToolbar.sendToAI"),children:k("floatingToolbar.sendToAI")}),i&&(0,d.jsx)("button",{className:"px-3 py-1.5 text-xs font-medium border border-brand text-brand rounded-md hover:bg-brand/10 transition-colors",onClick:i,children:k("floatingToolbar.search")})]})}let h=(0,e.memo)(function({floatingToolbarRef:a,bumpRef:b,container:c,onAddComment:f,onSendToAI:h,onSearch:i,isChatLoading:j}){let[k,l]=(0,e.useState)(0),m=(0,e.useMemo)(()=>a.current,[k]);return(0,d.jsx)(g,{x:m?.x??0,y:m?.y??0,visible:!!m,container:c,onAddComment:f,onSendToAI:h,onSearch:i,isChatLoading:j})})},78908:a=>{"use strict";a.exports=import("shiki")},79029:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{Cv:()=>y});var e=c(48249),f=c(67484),g=c(44384),h=c(74429),i=c(26068),j=c(45214),k=c(90173),l=c(5811),m=c(77937),n=c(68502),o=c(95133),p=c(16306),q=c(94882),r=c(81749),s=c(75005),t=a([k,l,p]);[k,l,p]=t.then?(await t)():t;let x="white-space:pre;padding:0 12px;min-height:20px;line-height:20px";function u(a){let b=window.getSelection();if(!b?.rangeCount)return null;let c=b.getRangeAt(0),d=c.startContainer;for(;d&&d.parentElement!==a;)d=d.parentElement;if(!d)return null;let e=Array.from(a.children).indexOf(d);if(e<0)return null;let f=document.createRange();f.selectNodeContents(d),f.setEnd(c.startContainer,c.startOffset);let g=f.toString().length;return{line:e,offset:g}}function v(a,b){let c,d=a.children[b.line];if(!d)return;let e=document.createTreeWalker(d,NodeFilter.SHOW_TEXT),f=b.offset;for(;c=e.nextNode();){let a=c.textContent?.length||0;if(f<=a){let a=window.getSelection(),b=document.createRange();b.setStart(c,f),b.collapse(!0),a?.removeAllRanges(),a?.addRange(b);return}f-=a}let g=window.getSelection(),h=document.createRange();h.selectNodeContents(d),h.collapse(!1),g?.removeAllRanges(),g?.addRange(h)}function w(a){return a.map(a=>`<div style="${x}">${a}</div>`).join("")}let y=(0,f.forwardRef)(function({content:a,filePath:b,showLineNumbers:c=!0,showSearch:d=!0,className:k="",cwd:t,enableComments:y=!1,scrollToLine:z=null,scrollToLineAlign:A="center",onScrollToLineComplete:B,highlightKeyword:C=null,visibleLineRef:D,onCmdClick:E,onTokenHover:F,onTokenHoverLeave:G,onTokenHoverCancel:H,blameLines:I,inlineBlameLines:J,onSelectCommit:K,editable:L=!1,initialMtime:M,onEditorClose:N,onSaved:O,onEditorStateChange:P,viMode:Q=!1,onContentMutate:R,onEnterInsertMode:S,onViSave:T,viStateRef:U,initialCursorLine:V,initialCursorCol:W,onInitialCursorSet:X,onContentSearch:Y},Z){let{t:$}=(0,g.Bd)(),_=(0,f.useRef)(a),aa=(0,f.useRef)(!1),[ab,ac]=(0,f.useState)(!1),[ad,ae]=(0,f.useState)(!1),[af,ag]=(0,f.useState)(()=>a.split("\n").length),ah=(0,f.useRef)(a.split("\n").length),[ai,aj]=(0,f.useState)({show:!1}),ak=(0,f.useRef)(null),al=(0,f.useRef)(null),am=(0,f.useRef)(M),an=(0,f.useRef)(null),ao=(0,f.useRef)(!1),ap=(0,f.useRef)(!1),{parentRef:aq,containerRef:ar,searchInputRef:as,floatingToolbarRef:at,suppressHoverRef:au,bumpToolbarRef:av,savedSelectionRef:aw,highlightedLines:ax,isMounted:ay,cmdHeld:az,flashLine:aA,isSearchVisible:aB,searchQuery:aC,caseSensitive:aD,wholeWord:aE,currentMatchIndex:aF,viewingComment:aG,addCommentInput:aH,sendToAIInput:aI,chatContext:aJ,commentsEnabled:aK,updateComment:aL,deleteComment:aM,lines:aN,matches:aO,rowData:aP,virtualizer:aQ,commentsByEndLine:aR,linesWithComments:aS,setIsSearchVisible:aT,setSearchQuery:aU,setCaseSensitive:aV,setWholeWord:aW,setViewingComment:aX,setAddCommentInput:aY,setSendToAIInput:aZ,goToNextMatch:a$,goToPrevMatch:a_,handleSearchKeyDown:a0,handleCommentBubbleClick:a1,handleToolbarAddComment:a2,handleToolbarSendToAI:a3,handleToolbarSearch:a4,handleCommentSubmit:a5,handleSendToAISubmit:a6,getHighlightedLineHtml:a7,suppressMatchScrollRef:a8,inlineBlameLineRef:a9,inlineBlameVersion:ba}=(0,p.d)({content:a,filePath:b,showSearch:d,cwd:t,enableComments:!L&&y,scrollToLine:L?null:z,scrollToLineAlign:L?"center":A,onScrollToLineComplete:L?void 0:B,visibleLineRef:L?void 0:D,onContentSearch:Y}),bb=(0,i.iN)(),bc=(0,f.useRef)(null),bd=(0,f.useRef)(null),be=(0,f.useRef)({line:0,col:0}),bf=(0,s.A)({lines:aN,enabled:Q&&!L,onContentChange:a=>{R?.(a)},onEnterInsert:(a,b,c)=>{let d=b;if("a"===c)d=b+1;else if("A"===c)d=(aN[a]??"").length;else if("I"===c){let b=(aN[a]??"").search(/\S/);d=b>=0?b:0}else("o"===c||"O"===c)&&(d=0);be.current={line:a,col:d},S?.(a)},onSave:T,getVisibleLineCount:()=>{let a=aq.current;return a?Math.floor(a.clientHeight/20):20},scrollToLine:(a,b)=>{let c=aP.findIndex(b=>"code"===b.type&&b.lineIndex===a);c>=0&&aQ.scrollToIndex(c,{align:b||"auto"})},onSearchExecute:a=>{aU(a),aT(!1)},onSearchNext:a$,onSearchPrev:a_,onSearchClear:()=>{aU("")}});(0,f.useEffect)(()=>{U&&(U.current={cursorLine:bf.state.cursorLine,cursorCol:bf.state.cursorCol})},[U,bf.state.cursorLine,bf.state.cursorCol]);let bg=(0,f.useRef)(null);(0,f.useEffect)(()=>{Q&&!L&&null!=V&&b&&bg.current!==b&&(bg.current=b,bf.setCursorLine(V-1),null!=W&&bf.setCursorCol(W-1),X?.())},[Q,L,V,W,b]),(0,f.useEffect)(()=>{if(!Q||L)return;let a=ar.current;if(!a)return;let b=a=>{let b=a.target;"TEXTAREA"===b.tagName||"INPUT"===b.tagName||b.isContentEditable||bf.handleKeyDown(a)&&(a.preventDefault(),a.stopPropagation())};return a.addEventListener("keydown",b,!0),()=>a.removeEventListener("keydown",b,!0)},[Q,L,bf.handleKeyDown]),(0,f.useEffect)(()=>{if(!Q||L)return;let a=ar.current;a&&"normal"===bf.state.mode&&requestAnimationFrame(()=>{let b=document.activeElement;b&&("TEXTAREA"===b.tagName||"INPUT"===b.tagName||b.isContentEditable)||a.focus()})},[Q,L,bf.state.mode,a]);let bh=(0,f.useCallback)(a=>{if(!Q||L)return;let b=a.target.closest("[data-line]");if(b){let c=parseInt(b.getAttribute("data-line"),10);if(!isNaN(c)){bf.setCursorLine(c-1);let d=b.querySelector("[data-code-content]");if(d){let b=document.caretRangeFromPoint(a.clientX,a.clientY);if(b&&d.contains(b.startContainer)){let a,e=document.createTreeWalker(d,NodeFilter.SHOW_TEXT),f=0;for(;a=e.nextNode();){if(a===b.startContainer){f+=b.startOffset;break}f+=a.textContent?.length||0}let g=aN[c-1]??"";bf.setCursorCol(Math.max(0,Math.min(f,Math.max(0,g.length-1))))}}}}let c=a.target;if("TEXTAREA"===c.tagName||"INPUT"===c.tagName||c.isContentEditable)return;let d=ar.current;d&&d.focus()},[Q,L,bf.setCursorLine,bf.setCursorCol,aN]),bi=(0,f.useCallback)(a=>{Q&&!L&&requestAnimationFrame(()=>{let a=window.getSelection(),b=a?.toString().trim();b&&/^\S+$/.test(b)&&(a8.current=!0,aU(b))})},[Q,L,aU,a8]);(0,f.useEffect)(()=>{"command"===bf.state.mode?setTimeout(()=>bc.current?.focus(),0):"search"===bf.state.mode&&setTimeout(()=>bd.current?.focus(),0)},[bf.state.mode]),(0,f.useEffect)(()=>{let a=aq.current;if(!a)return;let b=()=>{(H??G)?.()};return a.addEventListener("mousedown",b),()=>a.removeEventListener("mousedown",b)},[H,G]),(0,f.useEffect)(()=>{aH||aI?(au.current=!0,G?.()):at.current||(au.current=!1)},[aH,aI,G]),(0,f.useLayoutEffect)(()=>{let a=aw.current;if(!a)return;let b=window.getSelection();if(b&&!b.isCollapsed)return;let c=aq.current;if(!c)return;let d=c.querySelector(`[data-line="${a.startLine}"]`),e=c.querySelector(`[data-line="${a.endLine}"]`);if(!d||!e)return;let f=(0,p.o)(d,a.startOffset),g=(0,p.o)(e,a.endOffset);if(f&&g)try{let a=document.createRange();a.setStart(f.node,f.offset),a.setEnd(g.node,g.offset),b?.removeAllRanges(),b?.addRange(a)}catch{}});let bj=(0,f.useCallback)((a,b,c)=>{au.current||F?.(a,b,c)},[F]),bk=(0,f.useCallback)((a,b)=>{au.current||E?.(a,b)},[E]),bl=Math.max(4,String(L?af:aN.length).length),bm=(0,f.useMemo)(()=>{let a=0;for(let b of aN){let c=0;for(let a=0;a<b.length;a++)" "===b[a]?c+=2-c%2:c+=1;c>a&&(a=c)}return a},[aN]);(0,f.useEffect)(()=>{if(L){_.current=a;let b=a.split("\n").length;ah.current=b,ag(b),aa.current=!1,ac(!1),aj({show:!1}),am.current=M}},[L,a,M]),(0,f.useEffect)(()=>{if(!L)return;let b=ak.current;if(!b)return;let c=a.split("\n"),d=c.map((a,b)=>ax[b]||(0,l.ZD)(a||" "));b.innerHTML=w(d),requestAnimationFrame(()=>{let a,d;Q?(a=Math.max(0,Math.min(be.current.line,c.length-1)),d=be.current.col):(a=Math.max(0,Math.min((D?.current??1)-1,c.length-1)),d=0),b.focus(),v(b,{line:a,offset:d});let e=D?.current??1;al.current&&(al.current.scrollTop=(e-1)*20)})},[L]),(0,f.useEffect)(()=>{L&&P?.({isDirty:ab,isSaving:ad})},[L,ab,ad,P]);let bn=(0,f.useCallback)(()=>{let a=ak.current;if(!a)return _.current;let b=[];for(let c of a.childNodes){let a=c.textContent||"";b.push(" "===a?"":a)}return b.join("\n")},[]),bo=(0,f.useCallback)(()=>{an.current&&clearTimeout(an.current),an.current=setTimeout(async()=>{let a=ak.current;if(a&&!ap.current){_.current=bn();try{let c=await (0,l.kS)(),d=(0,l.sQ)(b),e=document.documentElement.classList.contains("dark"),f=_.current.split("\n"),g=c.codeToTokens(f.join("\n"),{lang:d,theme:e?"github-dark":"github-light"}).tokens.map(a=>(0,l.b8)(a)),h=u(a);ao.current=!0,a.innerHTML=w(g),ao.current=!1,h&&v(a,h)}catch{}}},300)},[b,bn]);(0,f.useEffect)(()=>{if(L)return()=>{an.current&&clearTimeout(an.current)}},[L]);let bp=(0,f.useCallback)(()=>{let a=ak.current;if(!a)return;aa.current||(aa.current=!0,ac(!0));let b=a.children.length;b!==ah.current&&(ah.current=b,ag(b))},[]),bq=(0,f.useCallback)(()=>{ao.current||ap.current||(bp(),bo())},[bp,bo]),br=(0,f.useCallback)(a=>{if(!a.nativeEvent.isComposing&&("Tab"===a.key&&(a.preventDefault(),document.execCommand("insertText",!1," ")),"Enter"===a.key)){a.preventDefault();let b=ak.current;if(!b)return;let c=window.getSelection();if(!c?.rangeCount)return;let d=c.getRangeAt(0);d.deleteContents();let e=d.startContainer;for(;e&&e.parentElement!==b;)e=e.parentElement;if(!e||!(e instanceof HTMLElement))return;let f=u(b),g=Array.from(b.children).indexOf(e),h=e.textContent||"",i=f?.offset??h.length,j=h.substring(0,i),k=h.substring(i);e.innerHTML=(0,l.ZD)(j||" ");let m=document.createElement("div");m.setAttribute("style",x),m.innerHTML=(0,l.ZD)(k||" "),e.after(m),v(b,{line:g+1,offset:0}),bp(),bo()}},[bp,bo]),bs=(0,f.useCallback)(a=>{a.preventDefault();let b=a.clipboardData.getData("text/plain");document.execCommand("insertText",!1,b)},[]),bt=(0,f.useCallback)(async(a=!1)=>{if(t){_.current=bn(),ae(!0);try{let c=await fetch("/api/files/save",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({cwd:t,path:b,content:_.current,expectedMtime:a?void 0:am.current})}),d=await c.json();if(409===c.status&&d.conflict){try{let a=await fetch(`/api/files/read?cwd=${encodeURIComponent(t)}&path=${encodeURIComponent(b)}`),c=await a.json();aj({show:!0,diskContent:"text"===c.type?c.content:void 0})}catch{aj({show:!0})}return}if(!c.ok)throw Error("Failed to save file");d.mtime&&(am.current=d.mtime),aa.current=!1,ac(!1),aj({show:!1}),(0,r.oR)($("toast.savedSuccess"),"success"),O?.()}catch(a){console.error("Error saving file:",a),(0,r.oR)($("toast.saveFailed"),"error")}finally{ae(!1)}}},[t,b,bn,O]),bu=(0,f.useCallback)(async()=>{ab&&!ad&&await bt(!1)},[ab,ad,bt]),bv=(0,f.useCallback)(async()=>{aj({show:!1}),await bt(!0)},[bt]),bw=(0,f.useCallback)(()=>{if(void 0!==ai.diskContent){_.current=ai.diskContent;let b=ai.diskContent.split("\n").length;ah.current=b,ag(b);let c=ai.diskContent!==a;aa.current=c,ac(c);let d=ak.current;if(d){let a=ai.diskContent.split("\n");d.innerHTML=w(a.map(a=>(0,l.ZD)(a||" "))),bo()}}aj({show:!1}),O?.()},[ai.diskContent,a,O,bo]),bx=(0,f.useCallback)(()=>{let a=al.current;return a?Math.floor(a.scrollTop/20)+1:D?.current??1},[D]),by=(0,f.useCallback)(async()=>{(!ab||await (0,r.lJ)($("codeViewer.unsavedConfirm"),{danger:!0,confirmText:$("codeViewer.discardChanges"),cancelText:$("codeViewer.continueEditing")}))&&N?.(bx())},[ab,N,bx]);(0,f.useEffect)(()=>{if(!L)return;let a=a=>{(a.metaKey||a.ctrlKey)&&"s"===a.key&&(a.preventDefault(),bu())};return document.addEventListener("keydown",a),()=>document.removeEventListener("keydown",a)},[L,bu]);let bz=(0,f.useCallback)(()=>{let a=bn();R?.(a);let b=ak.current,c=b?u(b):null,d=bx();if(bf.enterNormal(),c){bf.setCursorLine(c.line);let b=a.split("\n")[c.line]??"";bf.setCursorCol(Math.max(0,Math.min(c.offset,Math.max(0,b.length-1))))}else bf.setCursorLine(Math.max(0,d-1));N?.(d)},[bn,R,bx,N,bf]);(0,f.useEffect)(()=>{if(!L)return;let a=a=>{let b="Escape"===a.key,c=a.ctrlKey&&"c"===a.key&&!a.metaKey&&!a.shiftKey;(b||Q&&c)&&(a.preventDefault(),a.stopPropagation(),Q?aa.current?(0,r.lJ)($("codeViewer.unsavedExitConfirm"),{danger:!0,confirmText:$("codeViewer.discardChanges"),cancelText:$("codeViewer.continueEditing")}).then(a=>{a&&bz()}):bz():by())};return document.addEventListener("keydown",a,!0),()=>document.removeEventListener("keydown",a,!0)},[L,Q,by,bz]),(0,f.useImperativeHandle)(Z,()=>({save:bu,close:by,get isDirty(){return ab},get isSaving(){return ad}}),[bu,by,ab,ad]);let bA=!!(I&&I.length>0),bB=(0,f.useMemo)(()=>{if(!I)return new Map;let a=[...new Set(I.map(a=>a.author))],b=new Map;return a.forEach((a,c)=>{b.set(a,o.j[c%o.j.length])}),b},[I]),[bC,bD]=(0,f.useState)(null),[bE,bF]=(0,f.useState)(null);(0,f.useEffect)(()=>{bD(null),bF(null)},[I]);let bG=(0,f.useCallback)((a,b)=>{bD(a.author);let c=b.currentTarget.getBoundingClientRect();bF({line:a,x:c.right+8,y:c.top})},[]),bH=(0,f.useCallback)(()=>{bD(null),bF(null)},[]),bI=(0,f.useCallback)(a=>{if(!K)return;let b={hash:a.hashFull,shortHash:a.hash,author:a.author,authorEmail:a.authorEmail,date:new Date(1e3*a.time).toISOString(),subject:a.message.split("\n")[0]||"",body:a.message.split("\n").slice(1).join("\n").trim(),time:a.time};K(b),bF(null)},[K]),bJ=`${bl+2}ch`;return(0,e.jsxs)("div",{ref:ar,className:`h-full flex flex-col outline-none ${k}`,tabIndex:0,onClick:bh,onDoubleClick:bi,children:[L&&ai.show&&(0,e.jsxs)("div",{className:"px-4 py-2 bg-amber-500/15 border-b border-amber-500/30 flex items-center gap-3 flex-shrink-0",children:[(0,e.jsx)("svg",{className:"w-5 h-5 text-amber-500 flex-shrink-0",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-2.5L13.732 4c-.77-.833-1.964-.833-2.732 0L4.082 16.5c-.77.833.192 2.5 1.732 2.5z"})}),(0,e.jsx)("span",{className:"text-sm text-foreground flex-1",children:$("codeViewer.fileModifiedExternally")}),(0,e.jsxs)("div",{className:"flex items-center gap-2",children:[(0,e.jsx)("button",{onClick:bw,className:"px-3 py-1 text-sm rounded border border-border hover:bg-accent transition-colors",children:$("codeViewer.useDiskVersion")}),(0,e.jsx)("button",{onClick:bv,className:"px-3 py-1 text-sm rounded bg-amber-500 text-white hover:bg-amber-600 transition-colors",children:$("codeViewer.forceOverwrite")})]})]}),!L&&d&&aB&&(0,e.jsxs)("div",{className:"flex-shrink-0 flex items-center gap-2 px-3 py-2 bg-secondary border-b border-border",children:[(0,e.jsx)("input",{ref:as,type:"text",value:aC,onChange:a=>aU(a.target.value),onKeyDown:a0,placeholder:$("codeViewer.searchPlaceholder"),className:"flex-1 max-w-xs px-2 py-1 text-sm border border-border rounded bg-card text-foreground focus:outline-none focus:ring-2 focus:ring-ring"}),(0,e.jsx)("button",{onClick:()=>aV(!aD),className:`px-2 py-1 text-xs font-mono rounded border transition-colors ${aD?"bg-brand text-white border-brand":"border-border text-muted-foreground hover:bg-accent"}`,title:$("codeViewer.caseSensitive"),children:"Aa"}),(0,e.jsx)("button",{onClick:()=>aW(!aE),className:`px-2 py-1 text-xs font-mono rounded border transition-colors ${aE?"bg-brand text-white border-brand":"border-border text-muted-foreground hover:bg-accent"}`,title:$("codeViewer.wholeWordMatch"),children:"[ab]"}),(0,e.jsx)("span",{className:"text-xs text-muted-foreground",children:aO.length>0?`${aF+1}/${aO.length}`:$("common.noMatch")}),(0,e.jsx)("button",{onClick:a_,disabled:0===aO.length,className:"p-1 rounded hover:bg-accent disabled:opacity-50",title:$("common.previous"),children:(0,e.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 15l7-7 7 7"})})}),(0,e.jsx)("button",{onClick:a$,disabled:0===aO.length,className:"p-1 rounded hover:bg-accent disabled:opacity-50",title:$("common.next"),children:(0,e.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})}),(0,e.jsx)("button",{onClick:()=>{aT(!1),aU("")},className:"p-1 rounded hover:bg-accent",title:$("common.close"),children:(0,e.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),L?(0,e.jsx)("div",{ref:al,className:"flex-1 overflow-auto bg-secondary",children:(0,e.jsxs)("div",{className:"flex",style:{minHeight:"100%"},children:[(0,e.jsx)("div",{className:"flex-shrink-0 font-mono text-sm select-none sticky left-0 z-[2] bg-secondary",style:{width:bJ},children:Array.from({length:af},(a,b)=>(0,e.jsx)("div",{className:"text-right text-muted-foreground/50 pr-3",style:{height:20,lineHeight:"20px"},children:b+1},b))}),(0,e.jsx)("div",{ref:ak,contentEditable:!0,suppressContentEditableWarning:!0,onInput:bq,onKeyDown:br,onPaste:bs,onCompositionStart:()=>{ap.current=!0},onCompositionEnd:()=>{ap.current=!1,bq()},spellCheck:!1,autoCorrect:"off",autoCapitalize:"off",className:"flex-1 font-mono text-sm outline-none",style:{caretColor:"var(--foreground)",tabSize:2}})]})}):(0,e.jsx)("div",{ref:aq,className:`flex-1 overflow-auto font-mono text-sm bg-secondary${az?" cmd-held-container":""}`,children:(0,e.jsx)("div",{style:{height:`${aQ.getTotalSize()}px`,minWidth:"100%",width:bA?`calc(${bl+bm+10}ch + 13rem)`:`${bl+bm+10}ch`,position:"relative"},children:aQ.getVirtualItems().map(a=>{let b=aP[a.index];if("code"!==b.type)return null;let d=b.lineIndex,f=d+1,g=ax[d]||(0,l.ZD)(aN[d]||""),h=a7(d,g,C),i=aS.has(f),j=aR.get(f),k=j?.[0],m=!!(aH&&f>=aH.range.start&&f<=aH.range.end),n=ba>=0?a9.current:null,p=!L&&J&&n===f?J[d]??null:null,q=bA?I[d]:void 0,r=bA&&d>0?I[d-1]:void 0,s=!!q&&(!r||r.hash!==q.hash),t=q?bB.get(q.author):void 0;return(0,e.jsx)(o.S,{virtualKey:a.key,lineNum:f,highlightedHtml:h,hasComments:i,firstComment:k,lineCommentsCount:j?.length,isInRange:m,showLineNumbers:c,lineNumChars:bl,commentsEnabled:aK,virtualItemSize:a.size,virtualItemStart:a.start,onCommentBubbleClick:a1,onCmdClick:bk,onTokenHover:bj,onTokenHoverLeave:G,flashLine:aA,blameLine:q,showBlameInfo:s,blameAuthorColor:t,isBlameHovered:!!(q&&bC===q.author),onBlameClick:bI,onBlameMouseEnter:bG,onBlameMouseLeave:bH,inlineBlameData:p,onInlineBlameClick:bI,isCursorLine:Q&&!L&&bf.state.cursorLine===d,cursorCol:Q&&!L&&bf.state.cursorLine===d?bf.state.cursorCol:void 0},a.key)})})}),Q&&(0,e.jsxs)("div",{className:"vi-status-bar flex-shrink-0 h-6 bg-card border-t border-border flex items-center px-3 text-xs font-mono select-none",children:["normal"===bf.state.mode&&(0,e.jsx)("span",{className:"text-green-11 font-medium",children:"NORMAL"}),"insert"===bf.state.mode&&(0,e.jsx)("span",{className:"text-blue-11 font-medium",children:"INSERT"}),"command"===bf.state.mode&&(0,e.jsxs)("div",{className:"flex items-center flex-1",children:[(0,e.jsx)("span",{className:"text-foreground",children:":"}),(0,e.jsx)("input",{ref:bc,value:bf.state.commandInput,onChange:a=>bf.setCommandInput(a.target.value),onKeyDown:a=>{if(a.nativeEvent.isComposing)return;let b=a.ctrlKey&&"c"===a.key&&!a.metaKey&&!a.shiftKey;("Enter"===a.key||"Escape"===a.key||b)&&(a.preventDefault(),a.stopPropagation(),bf.handleKeyDown(a.nativeEvent))},className:"flex-1 bg-transparent outline-none text-foreground ml-0.5",spellCheck:!1,autoComplete:"off"})]}),"search"===bf.state.mode&&(0,e.jsxs)("div",{className:"flex items-center flex-1",children:[(0,e.jsx)("span",{className:"text-foreground",children:"/"}),(0,e.jsx)("input",{ref:bd,value:bf.state.searchInput,onChange:a=>bf.setSearchInput(a.target.value),onKeyDown:a=>{if(a.nativeEvent.isComposing)return;let b=a.ctrlKey&&"c"===a.key&&!a.metaKey&&!a.shiftKey;("Enter"===a.key||"Escape"===a.key||b)&&(a.preventDefault(),a.stopPropagation(),bf.handleKeyDown(a.nativeEvent))},className:"flex-1 bg-transparent outline-none text-foreground ml-0.5",spellCheck:!1,autoComplete:"off"})]}),bf.state.keyBuffer&&"normal"===bf.state.mode&&(0,e.jsx)("span",{className:"ml-2 text-muted-foreground",children:bf.state.keyBuffer}),bf.state.isDirty&&("normal"===bf.state.mode||"command"===bf.state.mode)&&(0,e.jsx)("span",{className:"ml-2 text-amber-11",children:"[+]"}),(0,e.jsxs)("span",{className:"ml-auto text-muted-foreground",children:[bf.state.cursorLine+1,":",bf.state.cursorCol+1]})]}),ay&&bb&&(0,h.createPortal)((0,e.jsxs)(e.Fragment,{children:[!L&&(0,e.jsx)(m.f,{floatingToolbarRef:at,bumpRef:av,container:bb,onAddComment:a2,onSendToAI:a3,onSearch:Y?a4:void 0,isChatLoading:aJ?.isLoading}),!L&&aH&&(0,e.jsx)(j.t,{x:aH.x,y:aH.y,range:aH.range,codeContent:aH.codeContent,container:bb,onSubmit:a5,onClose:()=>aY(null)}),!L&&aI&&(0,e.jsx)(j.G,{x:aI.x,y:aI.y,range:aI.range,filePath:b,codeContent:aI.codeContent,container:bb,onSubmit:a6,onClose:()=>aZ(null),isChatLoading:aJ?.isLoading}),!L&&aG&&(0,e.jsx)(n.t,{x:aG.x,y:aG.y,comment:aG.comment,container:bb,onClose:()=>aX(null),onUpdateComment:aL,onDeleteComment:aM}),bE&&(0,e.jsxs)("div",{className:"fixed z-50 bg-card border border-border rounded-lg shadow-lg p-3 max-w-lg",style:{left:Math.min(bE.x,window.innerWidth-450),top:Math.max(8,Math.min(bE.y,window.innerHeight-200))},children:[(0,e.jsxs)("div",{className:"flex items-start gap-3",children:[(0,e.jsx)("div",{className:"px-2 py-0.5 rounded text-xs font-mono font-medium text-white flex-shrink-0",style:{backgroundColor:bB.get(bE.line.author)?.border||"#666"},children:bE.line.hash}),(0,e.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,e.jsx)("div",{className:"text-sm font-medium text-foreground",children:bE.line.author}),(0,e.jsx)("div",{className:"text-xs text-muted-foreground",children:bE.line.authorEmail})]})]}),(0,e.jsx)("div",{className:"mt-2 text-sm text-foreground whitespace-pre-wrap max-h-48 overflow-y-auto",children:bE.line.message}),(0,e.jsxs)("div",{className:"mt-2 text-xs text-muted-foreground border-t border-border pt-2",children:[(0,q.fw)(bE.line.time)," \xb7 ",new Date(1e3*bE.line.time).toLocaleString(),(0,e.jsx)("span",{className:"ml-2 text-brand",children:$("codeViewer.clickToViewDetails")})]})]})]}),bb)]})});d()}catch(a){d(a)}})},80600:(a,b,c)=>{"use strict";c.d(b,{A:()=>d});let d=(0,c(47408).A)("file-text",[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]])},81190:(a,b,c)=>{"use strict";c.d(b,{B:()=>p});var d=c(48249),e=c(67484),f=c(92154),g=c(44384),h=c(13928),i=c(15622);let j="review-last-viewed";function k(){try{return JSON.parse(localStorage.getItem(j)||"{}")}catch{return{}}}function l(a,b){if(!a.lastCommentAt)return!1;let c=b[a.id];return!c||a.lastCommentAt>c}function m({cwd:a}){let{t:b}=(0,g.Bd)(),[c,f]=(0,e.useState)(!1),[m,n]=(0,e.useState)([]),[o,p]=(0,e.useState)(!1),[q,r]=(0,e.useState)(null),[s,t]=(0,e.useState)({}),[u,v]=(0,e.useState)({open:!1,comments:[],title:"",userNameMap:{}}),w=(0,e.useRef)(null),x=(0,e.useRef)(null),[y,z]=(0,e.useState)(null),A=(0,e.useCallback)(async()=>{p(!0);try{let a=await fetch("/api/review");if(a.ok){let b=await a.json();n(b.reviews||[])}}catch{}p(!1)},[]),B=(0,e.useCallback)(a=>{let{data:b}=a;b?.some(a=>"review"===a.type)&&A()},[A]);(0,h.h)({url:`/ws/watch?cwd=${encodeURIComponent(a||"/")}`,onMessage:B,enabled:!!a});let C=(0,e.useMemo)(()=>m.filter(a=>a.active),[m]),D=(0,e.useMemo)(()=>C.some(a=>l(a,s)),[C,s]),E=(0,e.useCallback)(a=>{let b;(b=k())[a]=Date.now(),localStorage.setItem(j,JSON.stringify(b)),t(k()),window.open(`${window.location.origin}/review/${a}`,"_blank")},[]),F=(0,e.useCallback)(async(a,b)=>{a.stopPropagation();try{let[a,c]=await Promise.all([fetch(`/api/review/${b}`),fetch("/api/review/users")]);if(!a.ok)return;let{review:d}=await a.json(),e={};if(c.ok){let{users:a}=await c.json();for(let[b,c]of Object.entries(a))e[b]=c.name}v({open:!0,comments:d.comments||[],title:d.title,userNameMap:e})}catch{}},[]),G=(0,e.useCallback)((a,b)=>{x.current=b,a.dataTransfer.effectAllowed="move";let c=a.currentTarget;requestAnimationFrame(()=>c.classList.add("opacity-30"))},[]),H=(0,e.useCallback)(a=>{x.current=null,z(null),a.currentTarget instanceof HTMLElement&&a.currentTarget.classList.remove("opacity-30")},[]),I=(0,e.useCallback)((a,b)=>{a.preventDefault(),a.dataTransfer.dropEffect="move",x.current&&x.current!==b&&z(b)},[]),J=(0,e.useCallback)((a,b)=>{a.preventDefault(),z(null);let c=x.current;x.current=null,c&&c!==b&&n(a=>{let d=[...a],e=d.findIndex(a=>a.id===c),f=d.findIndex(a=>a.id===b);if(-1===e||-1===f)return a;let[g]=d.splice(e,1);return d.splice(f,0,g),fetch("/api/review/order",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({order:d.map(a=>a.id)})}).catch(()=>{}),d})},[]);return(0,d.jsxs)("div",{ref:w,className:"relative",children:[(0,d.jsxs)("button",{onClick:()=>f(a=>!a),className:`relative p-2 rounded-lg transition-colors ${c?"text-foreground bg-accent":"text-muted-foreground hover:text-foreground hover:bg-accent"}`,title:b("review.reviewManagement"),children:[(0,d.jsx)("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,d.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4"})}),D&&(0,d.jsx)("span",{className:"absolute top-1 right-1 w-2 h-2 bg-red-500 rounded-full"})]}),c&&(0,d.jsxs)("div",{className:"absolute right-0 top-full mt-1 w-64 bg-popover border border-border rounded-lg shadow-xl z-50 overflow-hidden",children:[(0,d.jsxs)("div",{className:"px-3 py-2 border-b border-border flex items-center justify-between",children:[(0,d.jsxs)("div",{children:[(0,d.jsx)("span",{className:"text-xs font-medium text-muted-foreground",children:b("review.allReviews")}),(0,d.jsx)("span",{className:"text-xs text-muted-foreground/60 ml-1.5",children:C.length})]}),(0,d.jsx)("button",{onClick:A,className:"p-0.5 text-muted-foreground hover:text-foreground rounded transition-colors",title:b("common.refresh"),children:(0,d.jsx)("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,d.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})})})]}),(0,d.jsx)("div",{className:"max-h-80 overflow-y-auto",children:o&&0===m.length?(0,d.jsx)("div",{className:"px-3 py-4 text-xs text-muted-foreground/50 text-center",children:b("common.loading")}):0===C.length?(0,d.jsx)("div",{className:"px-3 py-4 text-xs text-muted-foreground/50 text-center",children:b("review.noOpenReviews")}):C.map(a=>{let c,e,f,g,h,i=l(a,s);return(0,d.jsxs)("div",{draggable:!0,onDragStart:b=>G(b,a.id),onDragEnd:H,onDragOver:b=>I(b,a.id),onDrop:b=>J(b,a.id),onMouseEnter:b=>{let c=b.currentTarget.getBoundingClientRect();r({id:a.id,text:a.title,top:c.top+c.height/2,left:c.left})},onMouseLeave:()=>r(b=>b?.id===a.id?null:b),onClick:()=>E(a.id),className:`group px-3 py-2 cursor-pointer border-b transition-colors ${y===a.id?"border-b-brand border-t border-t-transparent":"border-b-border/50"} hover:bg-accent/30`,children:[(0,d.jsxs)("div",{className:"flex items-center gap-1.5 min-w-0",children:[(0,d.jsx)("span",{className:`w-1.5 h-1.5 rounded-full flex-shrink-0 ${i?"bg-red-500":"bg-green-500"}`}),(0,d.jsx)("span",{className:`text-xs truncate flex-1 ${i?"font-medium text-foreground":""}`,children:a.title}),a.commentCount>0&&(0,d.jsx)("button",{onClick:b=>F(b,a.id),className:"flex-shrink-0 p-0.5 rounded text-muted-foreground/0 group-hover:text-muted-foreground/60 hover:!text-brand hover:!bg-brand/10 transition-colors",title:b("review.viewComments"),children:(0,d.jsx)("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:(0,d.jsx)("path",{d:"M7 8h10M7 12h4m1 8l-4-4H5a2 2 0 01-2-2V6a2 2 0 012-2h14a2 2 0 012 2v8a2 2 0 01-2 2h-3l-4 4z"})})})]}),(0,d.jsxs)("div",{className:"flex items-center gap-2 text-[10px] text-muted-foreground/50 mt-0.5 pl-3",children:[(0,d.jsx)("span",{children:(e=String((c=new Date(a.updatedAt||a.createdAt)).getMonth()+1).padStart(2,"0"),f=String(c.getDate()).padStart(2,"0"),g=String(c.getHours()).padStart(2,"0"),h=String(c.getMinutes()).padStart(2,"0"),`${e}-${f} ${g}:${h}`)}),a.commentCount>0&&(0,d.jsx)("span",{children:b("review.nComments",{count:a.commentCount})})]})]},a.id)})})]}),q&&c&&(0,d.jsx)("div",{className:"fixed z-[60] px-2 py-1 text-xs bg-popover text-popover-foreground border border-border rounded shadow-md whitespace-nowrap pointer-events-none",style:{top:q.top,left:q.left-8,transform:"translate(-100%, -50%)"},children:q.text}),(0,d.jsx)(i._,{isOpen:u.open,onClose:()=>v(a=>({...a,open:!1})),comments:u.comments,reviewTitle:u.title,userNameMap:u.userNameMap})]})}var n=c(81749);function o({cwd:a,currentBranch:b,onSwitched:c}){let{t:f}=(0,g.Bd)(),[h,i]=(0,e.useState)(!1),[j,k]=(0,e.useState)([]),[l,m]=(0,e.useState)(!1),[o,p]=(0,e.useState)(!1),[q,r]=(0,e.useState)(""),s=(0,e.useRef)(null),t=(0,e.useRef)(null),u=(0,e.useCallback)(async()=>{m(!0);try{let b=await fetch(`/api/git/branches?cwd=${encodeURIComponent(a)}`);if(b.ok){let a=await b.json(),c=[...a.local||[],...(a.remote||[]).filter(b=>!a.local.includes(b.replace(/^origin\//,"")))];k(c)}}catch{(0,n.oR)(f("toast.loadBranchFailed"),"error")}finally{m(!1)}},[a]),v=(0,e.useCallback)(()=>{i(!0),r(""),u()},[u]),w=(0,e.useCallback)(()=>{i(!1)},[]),x=async b=>{p(!0);try{let d=await fetch("/api/git/worktree",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"checkout",cwd:a,path:a,branch:b})});if(d.ok){let a=b.replace(/^origin\//,"");(0,n.oR)(f("toast.switchedToBranch",{branch:a}),"success"),w(),c()}else{let a=await d.json();(0,n.oR)(a.error||f("toast.switchBranchFailed"),"error")}}catch{(0,n.oR)(f("toast.switchBranchFailed"),"error")}finally{p(!1)}},y=j.filter(a=>a!==b&&a.toLowerCase().includes(q.toLowerCase()));return(0,d.jsxs)("div",{className:"relative",ref:s,children:[(0,d.jsx)("button",{onClick:h?w:v,className:"p-1 text-muted-foreground hover:text-foreground hover:bg-accent rounded transition-colors",title:f("git.switchBranch"),children:(0,d.jsx)("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,d.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 7h12m0 0l-4-4m4 4l-4 4m0 6H4m0 0l4 4m-4-4l4-4"})})}),h&&(0,d.jsxs)("div",{className:"absolute top-full left-0 mt-1 w-64 bg-popover border border-border rounded-lg shadow-lg z-50 overflow-hidden",children:[(0,d.jsx)("div",{className:"p-2 border-b border-border",children:(0,d.jsx)("input",{ref:t,type:"text",value:q,onChange:a=>r(a.target.value),placeholder:f("git.searchBranch"),className:"w-full px-2.5 py-1.5 text-sm bg-muted rounded border-none outline-none placeholder:text-muted-foreground",onKeyDown:a=>{"Escape"===a.key&&w()}})}),(0,d.jsx)("div",{className:"max-h-60 overflow-y-auto p-1",children:l?(0,d.jsx)("div",{className:"text-xs text-muted-foreground text-center py-4",children:f("common.loading")}):0===y.length?(0,d.jsx)("div",{className:"text-xs text-muted-foreground text-center py-4",children:q?f("git.noMatchingBranches"):f("git.noBranches")}):y.map(a=>(0,d.jsx)("button",{onClick:()=>x(a),disabled:o,className:"w-full text-left px-2.5 py-1.5 text-sm rounded hover:bg-accent transition-colors truncate disabled:opacity-50",children:(0,d.jsx)("span",{className:a.startsWith("origin/")?"text-muted-foreground":"text-foreground",children:a})},a))})]})]})}function p({initialCwd:a,activeTab:b,isGitRepo:c,currentBranch:e,onOpenWorktree:h,onOpenProjectSessions:i,onOpenAliasManager:j,onBranchSwitched:k}){let{t:l}=(0,g.Bd)();return(0,d.jsx)("div",{className:"border-b border-border bg-card shrink-0",children:(0,d.jsxs)("div",{className:"flex items-center justify-between px-4 py-2 relative",children:[(0,d.jsxs)("div",{className:"flex items-center gap-3",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)("img",{src:"/icons/icon-72x72.png",alt:"Cockpit",className:"w-6 h-6 cursor-pointer",title:l("tabManagerTopBar.copyPageUrl"),onClick:()=>{navigator.clipboard.writeText(window.location.href).then(()=>{(0,n.oR)(l("toast.copiedPageUrl"),"success")})}}),a?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("span",{className:"text-sm text-foreground max-w-md truncate cursor-help",title:`CWD: ${a}`,children:a}),(0,d.jsx)("button",{onClick:()=>{navigator.clipboard.writeText(a),(0,n.oR)(l("toast.copiedDirPath"))},className:"p-1 text-muted-foreground hover:text-foreground hover:bg-accent rounded transition-colors",title:l("tabManagerTopBar.copyDirPath"),children:(0,d.jsx)("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,d.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z"})})})]}):(0,d.jsx)("h1",{className:"text-lg font-semibold text-foreground",children:"Cockpit"})]}),c&&a&&(0,d.jsxs)("div",{className:"flex items-center gap-1",children:[(0,d.jsxs)("button",{onClick:h,className:"flex items-center gap-1.5 px-2 py-1.5 text-muted-foreground hover:text-foreground hover:bg-accent rounded-lg transition-colors",title:"Git Worktrees",children:[(0,d.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,d.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M13 17h8m0 0l-4-4m4 4l-4 4M3 7v6a4 4 0 004 4h5"})}),(0,d.jsx)("span",{className:"text-sm",children:e||"main"})]}),(0,d.jsx)(o,{cwd:a,currentBranch:e,onSwitched:()=>k?.()})]})]}),(0,d.jsx)("div",{className:"absolute left-1/2 -translate-x-1/2",children:(0,d.jsx)(f.gT,{})}),(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)(m,{cwd:a}),(0,d.jsx)("button",{onClick:()=>window.location.reload(),className:"p-2 text-muted-foreground hover:text-foreground hover:bg-accent rounded-lg transition-colors",title:l("tabManagerTopBar.refreshProject"),children:(0,d.jsx)("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,d.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})})}),a&&(0,d.jsx)("button",{onClick:i,className:"p-2 text-muted-foreground hover:text-foreground hover:bg-accent rounded-lg transition-colors",title:l("sessions.projectSessions"),children:(0,d.jsx)("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,d.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"})})}),(0,d.jsx)("button",{onClick:async()=>{if(b?.cwd)try{await fetch("/api/open-vscode",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({cwd:b.cwd})})}catch{}},className:"p-2 text-muted-foreground hover:text-foreground hover:bg-accent rounded-lg transition-colors",title:l("tabManagerTopBar.openInVSCode"),children:(0,d.jsx)("svg",{className:"w-5 h-5",viewBox:"0 0 24 24",fill:"currentColor",children:(0,d.jsx)("path",{d:"M17.583 2.213L12 7.393 6.417 2.213 1 6.17v11.66l5.417 3.957L12 16.607l5.583 5.18L23 17.83V6.17l-5.417-3.957zM6.417 17.83L3 15.33V8.67l3.417-2.5v11.66zm11.166 0V6.17L21 8.67v6.66l-3.417 2.5z"})})}),(0,d.jsx)("button",{onClick:async()=>{if(b?.cwd)try{await fetch("/api/open-cursor",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({cwd:b.cwd})})}catch{}},className:"p-2 text-muted-foreground hover:text-foreground hover:bg-accent rounded-lg transition-colors",title:l("tabManagerTopBar.openInCursor"),children:(0,d.jsx)("svg",{className:"w-5 h-5",viewBox:"0 0 24 24",fill:"currentColor",children:(0,d.jsx)("path",{d:"M4.5 2L20.5 12L4.5 22V2Z"})})}),b?.sessionId&&(0,d.jsx)("button",{onClick:()=>{let a=`claude -r ${b.sessionId}`;navigator.clipboard.writeText(a).then(()=>{(0,n.oR)(l("toast.copiedCommand",{command:a}),"success")})},className:"p-2 text-muted-foreground hover:text-foreground hover:bg-accent rounded-lg transition-colors",title:l("chat.copyCommandTooltip",{sessionId:b.sessionId}),children:(0,d.jsx)("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,d.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z"})})}),(0,d.jsx)("button",{onClick:j,className:"p-2 text-muted-foreground hover:text-foreground hover:bg-accent rounded-lg transition-colors",title:l("tabManagerTopBar.aliasesGlobal"),children:(0,d.jsx)("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,d.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M16 12h-6m-4 0a8 8 0 1116 0 8 8 0 01-16 0zm4 0h.01"})})}),(0,d.jsx)("button",{onClick:()=>window.parent.postMessage({type:"OPEN_TOKEN_STATS"},"*"),className:"p-2 text-muted-foreground hover:text-foreground hover:bg-accent rounded-lg transition-colors",title:l("tabManagerTopBar.tokenStats"),children:(0,d.jsx)("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,d.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 19v-6a2 2 0 00-2-2H5a2 2 0 00-2 2v6a2 2 0 002 2h2a2 2 0 002-2zm0 0V9a2 2 0 012-2h2a2 2 0 012 2v10m-6 0a2 2 0 002 2h2a2 2 0 002-2m0 0V5a2 2 0 012-2h2a2 2 0 012 2v14a2 2 0 01-2 2h-2a2 2 0 01-2-2z"})})}),(0,d.jsx)("button",{onClick:()=>window.open("https://surething.io?from=cockpit","_blank"),className:"p-2 text-muted-foreground hover:text-foreground hover:bg-accent rounded-lg transition-colors",title:l("tabManagerTopBar.openSurething"),children:(0,d.jsx)("img",{src:"https://surething.io/logo.png?from=cockpit",alt:"Surething",className:"w-5 h-5 rounded-sm"})})]})]})})}},83634:(a,b,c)=>{"use strict";c.d(b,{V:()=>l});var d=c(48249),e=c(67484),f=c(44384),g=c(31172);function h({image:a,onClose:b}){let{t:c}=(0,f.Bd)(),e=(0,d.jsx)("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/70 p-4",onClick:b,children:(0,d.jsxs)("div",{className:"relative max-w-[90vw] max-h-[90vh]",children:[(0,d.jsx)("img",{src:a.preview,alt:c("imagePreview.previewImage"),className:"max-w-full max-h-[90vh] object-contain rounded-lg",onClick:a=>a.stopPropagation()}),(0,d.jsx)("button",{onClick:b,className:"absolute -top-3 -right-3 w-8 h-8 bg-card text-foreground hover:text-foreground rounded-full shadow-lg flex items-center justify-center transition-colors",title:c("common.close"),children:(0,d.jsx)("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,d.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]})});return(0,d.jsx)(g.Z,{children:e})}function i({images:a,onRemove:b,disabled:c}){let{t:g}=(0,f.Bd)(),[i,j]=(0,e.useState)(null);return 0===a.length?null:(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("div",{className:"flex flex-wrap gap-2 p-2 bg-secondary border-b border-border",children:a.map(a=>(0,d.jsxs)("div",{className:"relative group w-16 h-16 rounded-lg overflow-hidden border border-border cursor-pointer",onClick:()=>j(a),children:[(0,d.jsx)("img",{src:a.preview,alt:g("imagePreview.previewImage"),className:"w-full h-full object-cover hover:opacity-90 transition-opacity"}),(0,d.jsx)("button",{onClick:c=>{c.stopPropagation(),b(a.id)},className:"absolute top-0 right-0 w-5 h-5 bg-black/60 hover:bg-black/80 text-white text-xs flex items-center justify-center rounded-bl-lg opacity-0 group-hover:opacity-100 transition-opacity",title:g("imagePreview.deleteImage"),children:"✕"})]},a.id))}),i&&(0,d.jsx)(h,{image:i,onClose:()=>j(null)})]})}var j=c(81749),k=c(31037);let l=(0,e.memo)(function({onSend:a,disabled:b,cwd:c,onShowGitStatus:g,onShowComments:h,onShowUserMessages:l,onOpenNote:m,onCreateScheduledTask:n}){let{t:o}=(0,f.Bd)(),[p,q]=(0,e.useState)(""),[r,s]=(0,e.useState)([]),[t,u]=(0,e.useState)([]),[v,w]=(0,e.useState)(!1),[x,y]=(0,e.useState)(0),[z,A]=(0,e.useState)(!1),B=(0,e.useRef)(null),C=(0,e.useRef)(null),D=(0,e.useCallback)(()=>{let a=B.current;if(!a)return;a.style.height="auto";let b=Math.max(38,Math.min(a.scrollHeight,200));a.style.height=`${b}px`},[]);(0,e.useLayoutEffect)(()=>{D()},[p,D]),(0,e.useEffect)(()=>{(async()=>{try{let a=c?`/api/commands?cwd=${encodeURIComponent(c)}`:"/api/commands",b=await fetch(a);if(b.ok){let a=await b.json();u(a)}}catch(a){console.error("Failed to load commands:",a)}})()},[c]);let E=(0,e.useMemo)(()=>{if(!p.startsWith("/"))return[];let a=p.toLowerCase();return t.filter(b=>b.name.toLowerCase().startsWith(a))},[p,t]),F=!z&&p.startsWith("/")&&E.length>0,G=(0,e.useRef)(p);(0,e.useLayoutEffect)(()=>{G.current!==p&&(queueMicrotask(()=>y(0)),z&&queueMicrotask(()=>A(!1)),G.current=p)},[p,z]),(0,e.useLayoutEffect)(()=>{if(F&&C.current){let a=C.current.children[x];a&&a.scrollIntoView({block:"nearest"})}},[x,F]);let H=(0,e.useCallback)(()=>{let c=p.trim();(c||r.length>0)&&!b&&(a(c,r.length>0?r:void 0),q(""),s([]),B.current&&(B.current.style.height="auto"))},[p,r,b,a]),I=(0,e.useCallback)(a=>{q(a.name+" "),B.current?.focus()},[]),J=(0,e.useCallback)(a=>{if(!a.nativeEvent.isComposing){if(F&&E.length>0){if("ArrowDown"===a.key){a.preventDefault(),y(a=>(a+1)%E.length);return}if("ArrowUp"===a.key){a.preventDefault(),y(a=>(a-1+E.length)%E.length);return}if("Enter"===a.key){a.preventDefault(),I(E[x]);return}if("Escape"===a.key){a.preventDefault(),A(!0);return}if("Tab"===a.key){a.preventDefault(),I(E[x]);return}}"Enter"!==a.key||a.shiftKey||a.nativeEvent.isComposing||(a.preventDefault(),H())}},[F,E,x,I,H]),K=(0,e.useCallback)(a=>{let b=a.clipboardData?.items;if(!b)return;let c=["image/png","image/jpeg","image/webp","image/gif"];for(let d of Array.from(b)){let b=c.find(a=>d.type===a);if(b){a.preventDefault();let c=d.getAsFile();if(!c)continue;if(c.size>5242880){alert(o("chat.imageSizeLimit",{size:(c.size/1024/1024).toFixed(2)}));continue}let e=new FileReader;e.onload=a=>{let c=a.target?.result;if(!c)return;let d=c.replace(/^data:image\/\w+;base64,/,""),e={id:`img-${Date.now()}-${Math.random().toString(36).slice(2,9)}`,data:d,preview:c,media_type:b};s(a=>[...a,e])},e.readAsDataURL(c)}}},[o]),L=(0,e.useCallback)(a=>{s(b=>b.filter(b=>b.id!==a))},[]);return(0,d.jsxs)("div",{className:"border-t border-border bg-card relative",children:[(0,d.jsx)(i,{images:r,onRemove:L,disabled:b}),F&&E.length>0&&(0,d.jsx)("div",{ref:C,className:"absolute bottom-full left-0 right-0 mx-4 mb-2 max-h-64 overflow-y-auto bg-card border border-border rounded-lg shadow-lg",children:E.map((a,b)=>(0,d.jsxs)("div",{onClick:()=>I(a),className:`flex items-center gap-3 px-4 py-2 cursor-pointer ${b===x?"bg-brand/10":"hover:bg-accent"}`,children:[(0,d.jsx)("span",{className:"font-mono text-sm font-medium text-foreground",children:a.name}),(0,d.jsx)("span",{className:"flex-1 text-sm text-muted-foreground truncate",children:a.description}),(0,d.jsx)("span",{className:`text-xs px-1.5 py-0.5 rounded ${(a=>{switch(a){case"builtin":return"bg-brand/15 text-brand dark:bg-brand/25 dark:text-teal-11";case"global":return"bg-green-9/15 text-green-11 dark:bg-green-9/25 dark:text-green-11";case"project":return"bg-amber-9/15 text-amber-11 dark:bg-amber-9/25 dark:text-amber-11"}})(a.source)}`,children:(a=>{switch(a){case"builtin":return o("common.builtin");case"global":return o("common.global");case"project":return o("common.project")}})(a.source)})]},a.name))}),(0,d.jsxs)("div",{className:"flex gap-2 items-end p-4",children:[(0,d.jsx)("button",{onClick:async()=>{try{(await fetch("/api/git/stage",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({cwd:c,files:["."]})})).ok?((0,j.oR)(o("toast.stagedAllFiles"),"success"),window.dispatchEvent(new CustomEvent("git-status-changed"))):(0,j.oR)(o("toast.stageFailed"),"error")}catch(a){console.error("Error staging files:",a),(0,j.oR)(o("toast.stageFailed"),"error")}},className:"p-2 text-green-11 hover:text-green-10 hover:bg-green-9/10 active:bg-green-9/20 active:scale-95 rounded-lg transition-all",title:o("chat.stageAll"),children:(0,d.jsx)("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,d.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 4v16m8-8H4"})})}),g&&(0,d.jsx)("button",{onClick:g,className:"p-2 text-brand hover:text-teal-10 hover:bg-brand/10 active:bg-brand/20 active:scale-95 rounded-lg transition-all",title:o("chat.viewGitChanges"),children:(0,d.jsxs)("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:[(0,d.jsx)("circle",{cx:"6",cy:"6",r:"2",strokeWidth:2}),(0,d.jsx)("circle",{cx:"18",cy:"6",r:"2",strokeWidth:2}),(0,d.jsx)("circle",{cx:"6",cy:"18",r:"2",strokeWidth:2}),(0,d.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 8v10M18 8v4c0 2-2 4-6 4"})]})}),h&&(0,d.jsx)("button",{onClick:h,className:"p-2 text-amber-11 hover:text-amber-10 hover:bg-amber-9/10 active:bg-amber-9/20 active:scale-95 rounded-lg transition-all",title:o("chat.viewAllComments"),children:(0,d.jsx)("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,d.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M7 8h10M7 12h4m1 8l-4-4H5a2 2 0 01-2-2V6a2 2 0 012-2h14a2 2 0 012 2v8a2 2 0 01-2 2h-3l-4 4z"})})}),l&&(0,d.jsx)("button",{onClick:l,className:"p-2 text-muted-foreground hover:text-foreground hover:bg-accent active:bg-muted active:scale-95 rounded-lg transition-all",title:o("chat.userMessages"),children:(0,d.jsx)("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,d.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 6h16M4 12h16M4 18h16"})})}),m&&(0,d.jsx)("button",{onClick:m,className:"p-2 text-muted-foreground hover:text-foreground hover:bg-accent active:bg-muted active:scale-95 rounded-lg transition-all",title:o("chat.projectNotes"),children:(0,d.jsx)("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,d.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M11 5H6a2 2 0 00-2 2v11a2 2 0 002 2h11a2 2 0 002-2v-5m-1.414-9.414a2 2 0 112.828 2.828L11.828 15H9v-2.828l8.586-8.586z"})})}),n&&(0,d.jsxs)("div",{className:"relative",children:[(0,d.jsx)("button",{onClick:()=>w(!v),className:`p-2 rounded-lg transition-all ${v?"text-brand bg-brand/10":"text-muted-foreground hover:text-foreground hover:bg-accent active:bg-muted active:scale-95"}`,title:o("chat.scheduledTasks"),children:(0,d.jsxs)("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:[(0,d.jsx)("circle",{cx:"12",cy:"12",r:"10",strokeWidth:2}),(0,d.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 6v6l4 2"})]})}),v&&(0,d.jsx)(k.E,{onClose:()=>w(!1),onCreate:n})]}),(0,d.jsx)("textarea",{ref:B,value:p,onChange:a=>q(a.target.value),onKeyDown:J,onPaste:K,placeholder:b?o("chat.placeholderDisabled"):o("chat.placeholder"),rows:1,className:"flex-1 resize-none px-4 py-2 border border-border rounded-lg focus:outline-none focus:ring-2 focus:ring-ring bg-card text-foreground placeholder-slate-9"})]})]})})},84705:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{s:()=>x});var e=c(48249),f=c(67484),g=c(31172),h=c(49681),i=c(21735),j=c(33740),k=c(55313),l=c(32616),m=c(86791),n=c(69648),o=c(31893),p=c(10164),q=c(26068),r=c(44741),s=c(81749),t=c(44384),u=a([m,n]);function v({image:a,onClose:b}){let{t:c}=(0,t.Bd)(),d=(0,e.jsxs)("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/80",onClick:b,children:[(0,e.jsx)("button",{onClick:b,className:"absolute top-4 right-4 w-10 h-10 flex items-center justify-center text-white/80 hover:text-white bg-black/40 hover:bg-black/60 rounded-full transition-colors",children:(0,e.jsx)("svg",{className:"w-6 h-6",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})}),(0,e.jsx)("img",{src:`data:${a.media_type};base64,${a.data}`,alt:c("chat.imagePreview"),className:"max-w-[90vw] max-h-[90vh] object-contain",onClick:a=>a.stopPropagation()})]});return(0,e.jsx)(g.Z,{children:d})}function w({filePath:a,content:b,cwd:c,onClose:d}){let[h,i]=(0,f.useState)(null);return(0,e.jsx)(g.Z,{children:(0,e.jsx)("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50 p-4",onClick:d,children:(0,e.jsx)("div",{ref:i,className:"bg-card rounded-lg shadow-xl w-full max-w-[90%] h-[90vh] flex flex-col relative",onClick:a=>a.stopPropagation(),children:(0,e.jsx)(q.SU,{container:h,children:(0,e.jsx)(p.M,{content:b,filePath:a,cwd:c,onClose:d})})})})})}[m,n]=u.then?(await u)():u;let x=(0,f.memo)(function({message:a,cwd:b,sessionId:c,onFork:d}){let g,p,q,{t:u}=(0,t.Bd)(),[x,y]=(0,f.useState)(null),[z,A]=(0,f.useState)(!1),[B,C]=(0,f.useState)(!1),[D,E]=(0,f.useState)(!1),F="user"===a.role,G=a.images&&a.images.length>0,H=a.toolCalls?.length||0,I=H>1,J=!!c&&!!b&&!!d,K=(0,f.useMemo)(()=>a.toolCalls?.some(a=>"Edit"===a.name||"Write"===a.name)||!1,[a.toolCalls]),L=(0,f.useMemo)(()=>{if(!a.toolCalls)return null;for(let b=a.toolCalls.length-1;b>=0;b--)if("TodoWrite"===a.toolCalls[b].name)return a.toolCalls[b];return null},[a.toolCalls]),M=(0,f.useMemo)(()=>a.toolCalls?a.toolCalls.filter(a=>"AskUserQuestion"===a.name):[],[a.toolCalls]),N=(0,f.useMemo)(()=>{if(!a.toolCalls)return[];let b=new Set,c=[];for(let d of a.toolCalls)if("Read"===d.name||"Edit"===d.name||"Write"===d.name){let a=d.input.file_path;a&&a.toLowerCase().endsWith(".md")&&!b.has(a)&&(b.add(a),c.push(a))}return c},[a.toolCalls]),[O,P]=(0,f.useState)(null),[Q,R]=(0,f.useState)(null);(0,f.useEffect)(()=>{if(!O)return void queueMicrotask(()=>R(null));let a=!1;return fetch(`/api/file?path=${encodeURIComponent(O)}`).then(a=>a.ok?a.json():Promise.reject()).then(b=>{a||R(b.content)}).catch(()=>{a||((0,s.oR)(u("toast.readFileFailed"),"error"),P(null))}),()=>{a=!0}},[O]);let S=()=>{a.content&&(navigator.clipboard.writeText(a.content),(0,s.oR)(u("toast.copiedMessage")))},T=()=>{J&&d(a.id)},U=(a=>{if(!a)return"";let b=new Date(a);if(isNaN(b.getTime()))return"";let c=String(b.getMonth()+1).padStart(2,"0"),d=String(b.getDate()).padStart(2,"0"),e=String(b.getHours()).padStart(2,"0"),f=String(b.getMinutes()).padStart(2,"0");return`${c}-${d} ${e}:${f}`})(a.timestamp);return(0,e.jsxs)(e.Fragment,{children:[(0,e.jsxs)("div",{className:`flex flex-col ${F?"items-end":"items-start"} mb-4 group`,"data-role":a.role,children:[U&&(0,e.jsx)("span",{className:"text-[11px] text-muted-foreground opacity-0 group-hover:opacity-100 transition-opacity mb-0.5 px-1",children:U}),(0,e.jsxs)("div",{className:`flex ${F?"justify-end":"justify-start"} w-full`,children:[F&&(0,e.jsxs)("div",{className:"self-start mt-2 mr-1 flex flex-col gap-0.5 opacity-0 group-hover:opacity-100 transition-opacity",children:[a.content&&(0,e.jsx)("button",{onClick:S,className:"p-1 rounded text-muted-foreground hover:text-foreground hover:bg-accent",title:u("chat.copyMessage"),children:(0,e.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z"})})}),J&&(0,e.jsx)("button",{onClick:T,className:"p-1 rounded text-muted-foreground hover:text-foreground hover:bg-accent",title:u("chat.forkSession"),children:(0,e.jsxs)("svg",{className:"w-4 h-4",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",children:[(0,e.jsx)("circle",{cx:"12",cy:"18",r:"3"}),(0,e.jsx)("circle",{cx:"6",cy:"6",r:"3"}),(0,e.jsx)("circle",{cx:"18",cy:"6",r:"3"}),(0,e.jsx)("path",{d:"M18 9v2c0 .6-.4 1-1 1H7c-.6 0-1-.4-1-1V9"}),(0,e.jsx)("path",{d:"M12 12v3"})]})})]}),(0,e.jsxs)("div",{className:`max-w-[80%] ${F?"bg-accent text-foreground border border-brand rounded-2xl rounded-br-md":"bg-accent text-foreground dark:text-slate-11 rounded-2xl rounded-bl-md"} px-4 py-2`,children:[G&&(0,e.jsx)("div",{className:`flex flex-wrap gap-2 ${a.content?"mb-2":""}`,children:a.images.map((a,b)=>(0,e.jsx)("div",{className:"relative w-16 h-16 rounded-lg overflow-hidden border border-white/20 cursor-pointer hover:opacity-90 transition-opacity",onClick:()=>y(a),children:(0,e.jsx)("img",{src:`data:${a.media_type};base64,${a.data}`,alt:u("chat.imageN",{index:b+1}),className:"w-full h-full object-cover"})},b))}),a.content&&(0,e.jsxs)("div",{className:"break-words",children:[(0,e.jsx)(r.T,{content:a.content,isUser:F,isStreaming:a.isStreaming}),a.isStreaming&&(0,e.jsx)("span",{className:"inline-block w-2 h-4 ml-1 bg-current animate-pulse"})]}),L&&(p=(g=L.input?.todos||[]).filter(a=>"completed"===a.status).length,q=g.length,(0,e.jsx)("div",{className:`${a.content||G?"mt-2":""}`,children:(0,e.jsxs)("div",{className:"border border-border rounded-lg overflow-hidden bg-secondary/50 px-3 py-2 space-y-1",children:[(0,e.jsxs)("div",{className:"flex items-center gap-2 mb-1.5",children:[(0,e.jsx)("div",{className:"flex-1 h-1 bg-secondary rounded-full overflow-hidden",children:(0,e.jsx)("div",{className:"h-full bg-green-500 rounded-full transition-all duration-300",style:{width:`${q>0?p/q*100:0}%`}})}),(0,e.jsxs)("span",{className:"text-[10px] text-muted-foreground flex-shrink-0",children:[p,"/",q]})]}),g.map((a,b)=>(0,e.jsxs)("div",{className:`flex items-center gap-1.5 ${"completed"===a.status?"opacity-50":""}`,children:["completed"===a.status?(0,e.jsx)(h.A,{className:"w-3 h-3 text-green-500 flex-shrink-0"}):"in_progress"===a.status?(0,e.jsx)(i.A,{className:"w-3 h-3 text-brand flex-shrink-0 animate-spin"}):(0,e.jsx)(j.A,{className:"w-3 h-3 text-muted-foreground flex-shrink-0"}),(0,e.jsx)("span",{className:`text-xs truncate ${"completed"===a.status?"text-muted-foreground":"text-foreground"}`,children:"in_progress"===a.status&&a.activeForm?a.activeForm:a.content})]},b))]})})),N.length>0&&(0,e.jsx)("div",{className:`${a.content||G||L?"mt-2":""}`,children:(0,e.jsx)("div",{className:"border border-border rounded-lg overflow-hidden bg-secondary/50 px-3 py-2 space-y-0.5",children:N.map(a=>(0,e.jsxs)("button",{onClick:()=>P(a),className:"flex items-center gap-1.5 w-full text-left hover:bg-accent rounded px-1 py-0.5 transition-colors group/md",children:[(0,e.jsx)("svg",{className:"w-3.5 h-3.5 text-muted-foreground flex-shrink-0",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"})}),(0,e.jsx)("span",{className:"text-xs text-muted-foreground group-hover/md:text-foreground truncate",children:a.split("/").pop()})]},a))})}),a.toolCalls&&a.toolCalls.length>0&&(0,e.jsx)("div",{className:`${a.content||G?"mt-2":""}`,children:I?(0,e.jsxs)("div",{className:"border border-border rounded-lg overflow-hidden bg-secondary",children:[(0,e.jsxs)("div",{className:"flex items-center",children:[(0,e.jsxs)("button",{onClick:()=>A(!z),className:"flex-1 px-3 py-2 flex items-center gap-2 text-left hover:bg-accent transition-colors active:bg-muted",children:[(0,e.jsx)("span",{className:"text-lg",children:"\uD83D\uDD27"}),(0,e.jsx)("span",{className:"font-medium text-foreground",children:u("chat.toolCalls",{count:H})}),(0,e.jsx)("span",{className:"ml-auto text-muted-foreground text-sm",children:z?u("chat.collapse"):u("chat.expand")})]}),M.length>0&&(0,e.jsx)("button",{onClick:()=>E(!0),className:"px-3 py-2 text-muted-foreground hover:text-foreground hover:bg-accent transition-colors border-l border-border",title:u("chat.viewQuestions"),children:(0,e.jsx)(k.A,{className:"w-4 h-4"})}),K&&(0,e.jsx)("button",{onClick:()=>C(!0),className:"px-3 py-2 text-muted-foreground hover:text-foreground hover:bg-accent transition-colors border-l border-border",title:u("chat.viewAllFileChanges"),children:(0,e.jsx)(l.A,{className:"w-4 h-4"})})]}),z&&(0,e.jsx)("div",{className:"border-t border-border p-2 space-y-1",children:a.toolCalls.map((a,c)=>(0,e.jsx)(m.K,{toolCall:a,cwd:b},`${a.id}-${c}`))})]}):a.toolCalls.map((a,c)=>(0,e.jsx)(m.K,{toolCall:a,cwd:b},`${a.id}-${c}`))})]}),!F&&(0,e.jsxs)("div",{className:"self-start mt-2 ml-1 flex flex-col gap-0.5 opacity-0 group-hover:opacity-100 transition-opacity",children:[a.content&&(0,e.jsx)("button",{onClick:S,className:"p-1 rounded text-muted-foreground hover:text-foreground hover:bg-accent",title:u("chat.copyMessage"),children:(0,e.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z"})})}),J&&(0,e.jsx)("button",{onClick:T,className:"p-1 rounded text-muted-foreground hover:text-foreground hover:bg-accent",title:u("chat.forkSession"),children:(0,e.jsxs)("svg",{className:"w-4 h-4",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",children:[(0,e.jsx)("circle",{cx:"12",cy:"18",r:"3"}),(0,e.jsx)("circle",{cx:"6",cy:"6",r:"3"}),(0,e.jsx)("circle",{cx:"18",cy:"6",r:"3"}),(0,e.jsx)("path",{d:"M18 9v2c0 .6-.4 1-1 1H7c-.6 0-1-.4-1-1V9"}),(0,e.jsx)("path",{d:"M12 12v3"})]})})]})]})]}),x&&(0,e.jsx)(v,{image:x,onClose:()=>y(null)}),B&&a.toolCalls&&(0,e.jsx)(n.z,{toolCalls:a.toolCalls,cwd:b,onClose:()=>C(!1)}),D&&M.length>0&&(0,e.jsx)(o.$,{toolCalls:M,onClose:()=>E(!1)}),O&&null!==Q&&(0,e.jsx)(w,{filePath:O,content:Q,cwd:b||"",onClose:()=>P(null)})]})});d()}catch(a){d(a)}})},86402:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{xU:()=>x,xZ:()=>w});var e=c(48249),f=c(67484),g=c(74429),h=c(44384),i=c(36043),j=c(47033),k=c(23434),l=c(26068),m=c(77033),n=c(45214),o=c(45050),p=c(81749),q=c(90173),r=c(5811),s=c(89976),t=c(77937),u=c(68502),v=a([q,r]);[q,r]=v.then?(await v)():v;let y=(0,f.memo)(function({floatingToolbarRef:a,bumpRef:b,container:c,onAddComment:d,onSendToAI:g,onSearch:h,isChatLoading:i}){let[j,k]=(0,f.useState)(0),l=(0,f.useMemo)(()=>a.current,[j]);return(0,e.jsx)(t.w,{x:l?.x??0,y:l?.y??0,visible:!!l,container:c,onAddComment:d,onSendToAI:g,onSearch:h,isChatLoading:i})});function w({oldContent:a,newContent:b,filePath:c,isNew:d=!1,isDeleted:t=!1,cwd:v,enableComments:w=!1,onPreview:x,previewLabel:z,onContentSearch:A}){let{t:B}=(0,h.Bd)(),C=z??B("common.preview"),D=(0,f.useMemo)(()=>(0,o.X)(a,b),[a,b]),E=(0,f.useRef)(null),F=(0,f.useRef)(null),G=(0,f.useRef)(null);(0,f.useRef)(!1);let[H,I]=(0,f.useState)(!1),J=(0,l.iN)(),K=(0,m.nH)(),L=w&&!!v,{comments:M,addComment:N,updateComment:O,deleteComment:P,refresh:Q}=(0,j._)({cwd:v||"",filePath:c}),[R,S]=(0,f.useState)(null),T=(0,f.useRef)(null),U=(0,f.useRef)(()=>{}),[V,W]=(0,f.useState)(null),[X,Y]=(0,f.useState)(null),Z=(0,f.useMemo)(()=>{let a=new Set;for(let b of M)for(let c=b.startLine;c<=b.endLine;c++)a.add(c);return a},[M]),$=(0,f.useMemo)(()=>{let a=new Map;for(let b of M){let c=b.endLine;a.has(c)||a.set(c,[]),a.get(c).push(b)}return a},[M]),_=(0,f.useCallback)((a,b)=>{b.stopPropagation(),S({comment:a,x:b.clientX,y:b.clientY}),T.current=null,U.current(),W(null),Y(null)},[]),aa=(0,f.useCallback)(()=>{let a=T.current;a&&(W({x:a.x,y:a.y,range:a.range,codeContent:a.codeContent}),T.current=null,U.current())},[]),ab=(0,f.useCallback)(()=>{let a=T.current;a&&(Y({x:a.x,y:a.y,range:a.range,codeContent:a.codeContent}),T.current=null,U.current())},[]),ac=(0,f.useCallback)(()=>{let a=T.current;if(!a||!A)return;let b=a.codeContent.trim();T.current=null,U.current(),b&&A(b)},[A]),ad=(0,f.useCallback)(async a=>{if(X&&K&&v)try{let b=await (0,k.$3)(v),d=[];for(let a of b)d.push({filePath:a.filePath,startLine:a.startLine,endLine:a.endLine,codeContent:a.codeContent,note:a.content||void 0});d.push({filePath:c,startLine:X.range.start,endLine:X.range.end,codeContent:X.codeContent});let e=(0,k.Gw)(d,a);K.sendMessage(e),await (0,k.RP)(v),Q(),Y(null)}catch(a){console.error("Failed to send to AI:",a)}},[X,K,c,v,Q]),ae=(0,f.useCallback)(async a=>{V&&(await N(V.range.start,V.range.end,a),W(null))},[V,N]),{leftLines:af,rightLines:ag}=(0,f.useMemo)(()=>{let a=[],b=[],c=0,d=0;for(let e=0;e<D.length;e++){let f=D[e];if("unchanged"===f.type){for(;a.length<b.length;)a.push({lineNum:0,content:"",type:"unchanged",originalIdx:-1});for(;b.length<a.length;)b.push({lineNum:0,content:"",type:"unchanged",originalIdx:-1});c++,d++,a.push({lineNum:c,content:f.content,type:"unchanged",originalIdx:e}),b.push({lineNum:d,content:f.content,type:"unchanged",originalIdx:e})}else"removed"===f.type?(c++,a.push({lineNum:c,content:f.content,type:"removed",originalIdx:e})):"added"===f.type&&(d++,b.push({lineNum:d,content:f.content,type:"added",originalIdx:e}))}for(;a.length<b.length;)a.push({lineNum:0,content:"",type:"unchanged",originalIdx:-1});for(;b.length<a.length;)b.push({lineNum:0,content:"",type:"unchanged",originalIdx:-1});return{leftLines:a,rightLines:b}},[D]),ah=(0,f.useMemo)(()=>D.map(a=>a.content),[D]),ai=(0,q.C)(ah,c),aj=(0,i.Te)({count:af.length,getScrollElement:()=>E.current,estimateSize:()=>20,overscan:20}),ak=d?"w-1/4":t?"w-3/4":"w-1/2",al=d?"w-3/4":t?"w-1/4":"w-1/2",am=(0,f.useMemo)(()=>af.map((a,b)=>{let c=ag[b];return"removed"===a.type?{type:"removed"}:c?.type==="added"?{type:"added"}:{type:"unchanged"}}),[af,ag]),an=aj.getTotalSize(),ao=aj.getVirtualItems();return(0,e.jsxs)("div",{className:"font-mono flex flex-col h-full text-sm",children:[(0,e.jsxs)("div",{className:"flex flex-shrink-0 border-b border-border",children:[(0,e.jsx)("div",{className:`${ak} min-w-0 px-2 py-1 bg-accent text-muted-foreground text-center text-xs font-medium border-r border-border`,children:d?"(New File)":t?"Deleted":"Old"}),(0,e.jsxs)("div",{className:`${al} min-w-0 px-2 py-1 bg-accent text-muted-foreground text-xs font-medium relative`,children:[(0,e.jsx)("span",{className:"block text-center",children:t?"(Deleted)":"New"}),(0,e.jsxs)("div",{className:"absolute right-2 top-1/2 -translate-y-1/2 flex items-center gap-2",children:[x&&(0,e.jsx)("button",{onClick:x,className:"text-muted-foreground hover:text-foreground transition-colors",children:C}),!t&&b&&(0,e.jsx)("button",{onClick:()=>{navigator.clipboard.writeText(b),(0,p.oR)(B("diffViewer.copiedAll"))},className:"text-muted-foreground hover:text-foreground transition-colors",children:B("common.copy")})]})]}),(0,e.jsx)("div",{className:"w-4 flex-shrink-0 bg-accent"})]}),(0,e.jsxs)("div",{className:"flex-1 min-h-0 flex",children:[(0,e.jsx)("div",{ref:E,className:"flex-1 overflow-y-auto overflow-x-hidden",children:(0,e.jsxs)("div",{className:"flex",style:{height:`${an}px`},children:[(0,e.jsx)("div",{ref:F,className:`${ak} overflow-x-auto border-r border-border`,children:(0,e.jsx)("div",{className:"min-w-max h-full",style:{position:"relative"},children:ao.map(a=>{let b=af[a.index];return(0,e.jsxs)("div",{style:{position:"absolute",top:0,left:0,minWidth:"100%",width:"max-content",height:`${a.size}px`,transform:`translateY(${a.start}px)`},className:`flex ${"removed"===b.type?"bg-red-9/15 dark:bg-red-9/25":""}`,children:[(0,e.jsx)("span",{className:"w-10 flex-shrink-0 text-right pr-2 text-slate-9 select-none border-r border-border",children:b.lineNum||""}),(0,e.jsx)("span",{className:"whitespace-pre pl-2",dangerouslySetInnerHTML:{__html:b.originalIdx>=0&&ai[b.originalIdx]||(0,r.ZD)(b.content||" ")}})]},a.key)})})}),(0,e.jsx)("div",{ref:G,className:`${al} overflow-x-auto`,children:(0,e.jsx)("div",{className:"min-w-max h-full",style:{position:"relative"},children:ao.map(a=>{let b=ag[a.index],c=b?.lineNum||0,d=c>0&&Z.has(c),f=$.get(c),g=f?.[0],h=V&&c>=V.range.start&&c<=V.range.end,i=X&&c>=X.range.start&&c<=X.range.end,j=h||i;return(0,e.jsxs)("div",{"data-new-line":c||void 0,style:{position:"absolute",top:0,left:0,minWidth:"100%",width:"max-content",height:`${a.size}px`,transform:`translateY(${a.start}px)`},className:`flex ${j?"bg-blue-9/20":d?"bg-amber-9/10":b?.type==="added"?"bg-green-9/15 dark:bg-green-9/25":""}`,children:[(0,e.jsxs)("span",{className:`flex-shrink-0 flex items-center gap-0.5 pr-1 text-slate-9 select-none border-r border-border ${j?"bg-blue-9/30":""}`,style:{width:L?"52px":"40px"},children:[L&&c>0&&d&&g&&(0,e.jsx)("button",{onClick:a=>_(g,a),className:"w-4 h-4 flex items-center justify-center rounded hover:bg-accent text-amber-9",title:B("codeViewer.nComments",{count:f?.length}),children:(0,e.jsx)("svg",{className:"w-3 h-3",fill:"currentColor",viewBox:"0 0 20 20",children:(0,e.jsx)("path",{fillRule:"evenodd",d:"M18 10c0 3.866-3.582 7-8 7a8.841 8.841 0 01-4.083-.98L2 17l1.338-3.123C2.493 12.767 2 11.434 2 10c0-3.866 3.582-7 8-7s8 3.134 8 7zM7 9H5v2h2V9zm8 0h-2v2h2V9zM9 9h2v2H9V9z",clipRule:"evenodd"})})}),L&&c>0&&!d&&(0,e.jsx)("span",{className:"w-4"}),(0,e.jsx)("span",{className:"flex-1 text-right pr-1",children:c||""})]}),(0,e.jsx)("span",{className:"whitespace-pre pl-2",dangerouslySetInnerHTML:{__html:b?.originalIdx>=0&&ai[b.originalIdx]||(0,r.ZD)(b?.content||" ")}})]},a.key)})})})]})}),(0,e.jsx)(s.b,{lines:am,containerRef:E})]}),H&&J&&(0,g.createPortal)((0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(y,{floatingToolbarRef:T,bumpRef:U,container:J,onAddComment:aa,onSendToAI:ab,onSearch:A?ac:void 0,isChatLoading:K?.isLoading??!1}),V&&(0,e.jsx)(n.t,{x:V.x,y:V.y,range:V.range,codeContent:V.codeContent,container:J,onSubmit:ae,onClose:()=>W(null)}),X&&(0,e.jsx)(n.G,{x:X.x,y:X.y,range:X.range,container:J,onSubmit:ad,onClose:()=>Y(null)}),R&&(0,e.jsx)(u.t,{x:R.x,y:R.y,comment:R.comment,container:J,onClose:()=>S(null),onUpdateComment:O,onDeleteComment:P})]}),J)]})}function x({oldContent:a,newContent:b,filePath:c}){let d=(0,f.useMemo)(()=>(0,o.X)(a,b),[a,b]),g=(0,f.useRef)(null),h=(0,f.useMemo)(()=>d.map(a=>a.content),[d]),j=(0,q.C)(h,c),k=(0,i.Te)({count:d.length,getScrollElement:()=>g.current,estimateSize:()=>20,overscan:20});return(0,e.jsx)("div",{ref:g,className:"font-mono text-sm overflow-auto h-full",children:(0,e.jsx)("div",{style:{height:`${k.getTotalSize()}px`,position:"relative"},children:k.getVirtualItems().map(a=>{let b=d[a.index];return(0,e.jsxs)("div",{style:{position:"absolute",top:0,left:0,minWidth:"100%",width:"max-content",height:`${a.size}px`,transform:`translateY(${a.start}px)`},className:`flex ${"removed"===b.type?"bg-red-9/15 dark:bg-red-9/25":"added"===b.type?"bg-green-9/15 dark:bg-green-9/25":""}`,children:[(0,e.jsx)("span",{className:"w-10 flex-shrink-0 text-right pr-2 text-slate-9 select-none border-r border-border",children:"added"!==b.type?b.oldLineNum:""}),(0,e.jsx)("span",{className:"w-10 flex-shrink-0 text-right pr-2 text-slate-9 select-none border-r border-border",children:"removed"!==b.type?b.newLineNum:""}),(0,e.jsx)("span",{className:`w-6 flex-shrink-0 text-center select-none ${"removed"===b.type?"text-red-11":"added"===b.type?"text-green-11":"text-slate-9"}`,children:"removed"===b.type?"-":"added"===b.type?"+":" "}),(0,e.jsx)("span",{className:"flex-1 whitespace-pre pl-1",dangerouslySetInnerHTML:{__html:j[a.index]||(0,r.ZD)(b.content||" ")}})]},a.key)})})})}d()}catch(a){d(a)}})},86439:a=>{"use strict";a.exports=require("next/dist/shared/lib/no-fallback-error.external")},86753:(a,b,c)=>{"use strict";c.d(b,{e:()=>h});var d=c(67484),e=c(95836),f=c(81749),g=c(41564);function h({cwd:a,addToRecentFiles:b}){let[c,h]=(0,d.useState)(null),[i,j]=(0,d.useState)(!1),[k,l]=(0,d.useState)(null),[m,n]=(0,d.useState)(null),[o,p]=(0,d.useState)(null),[q,r]=(0,d.useState)(!1),[s,t]=(0,d.useState)(new Set),[u,v]=(0,d.useState)([]),[w,x]=(0,d.useState)([]),[y,z]=(0,d.useState)(!1),[A,B]=(0,d.useState)(0),C=(0,d.useCallback)(async()=>{j(!0),l(null);try{let b=`/api/git/status?cwd=${encodeURIComponent(a)}`,c=await fetch(b);if(!c.ok){let a=await c.json();throw Error(a.error||"Failed to fetch git status")}let d=await c.json();h(d);let f=(0,e.Do)(d.staged),g=(0,e.Do)(d.unstaged);v(f),x(g);let i=new Set([...(0,e.Sz)(f),...(0,e.Sz)(g)]);t(i)}catch(a){l(a instanceof Error?a.message:"Unknown error")}finally{j(!1)}},[a]),D=(0,d.useCallback)(a=>{t(b=>{let c=new Set(b);return c.has(a)?c.delete(a):c.add(a),c})},[]),E=(0,d.useCallback)((a,c)=>{n({file:a,type:c}),b(a.path)},[b]),F=(0,d.useCallback)(async b=>{try{if(!(await fetch("/api/git/stage",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({cwd:a,files:[b]})})).ok)throw Error("Failed to stage file");await C(),(0,f.oR)(g.A.t("toast.staged"),"success")}catch(a){console.error("Error staging file:",a),(0,f.oR)(g.A.t("toast.stageFailed"),"error")}},[a,C]),G=(0,d.useCallback)(async b=>{try{if(!(await fetch("/api/git/unstage",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({cwd:a,files:[b]})})).ok)throw Error("Failed to unstage file");await C(),(0,f.oR)(g.A.t("toast.unstaged"),"success")}catch(a){console.error("Error unstaging file:",a),(0,f.oR)(g.A.t("toast.unstageFailed"),"error")}},[a,C]),H=(0,d.useCallback)(async b=>{if(0!==b.length)try{if(!(await fetch("/api/git/stage",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({cwd:a,files:b})})).ok)throw Error("Failed to stage files");await C(),(0,f.oR)(g.A.t("toast.stagedNFiles",{count:b.length}),"success")}catch(a){console.error("Error staging files:",a),(0,f.oR)(g.A.t("toast.stageFailed"),"error")}},[a,C]),I=(0,d.useCallback)(async b=>{if(0!==b.length)try{if(!(await fetch("/api/git/unstage",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({cwd:a,files:b})})).ok)throw Error("Failed to unstage files");await C(),(0,f.oR)(g.A.t("toast.unstagedNFiles",{count:b.length}),"success")}catch(a){console.error("Error unstaging files:",a),(0,f.oR)(g.A.t("toast.unstageFailed"),"error")}},[a,C]),J=(0,d.useCallback)(async b=>{if(0!==b.length)try{let c=b.filter(a=>"untracked"===a.status).map(a=>a.path),d=b.filter(a=>"untracked"!==a.status).map(a=>a.path);if(c.length>0&&!(await fetch("/api/git/discard",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({cwd:a,files:c,isUntracked:!0})})).ok)throw Error("Failed to discard untracked files");if(d.length>0&&!(await fetch("/api/git/discard",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({cwd:a,files:d,isUntracked:!1})})).ok)throw Error("Failed to discard tracked files");await C(),(0,f.oR)(g.A.t("toast.discardedNFiles",{count:b.length}),"success")}catch(a){console.error("Error discarding files:",a),(0,f.oR)(g.A.t("toast.discardFailed"),"error")}},[a,C]),K=(0,d.useCallback)(async()=>{if(c?.unstaged.length)try{if(!(await fetch("/api/git/stage",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({cwd:a,files:c.unstaged.map(a=>a.path)})})).ok)throw Error("Failed to stage all files");await C(),(0,f.oR)(g.A.t("toast.stagedNFiles",{count:c.unstaged.length}),"success")}catch(a){console.error("Error staging all files:",a),(0,f.oR)(g.A.t("toast.stageFailed"),"error")}},[a,c,C]),L=(0,d.useCallback)(async()=>{if(c?.staged.length)try{if(!(await fetch("/api/git/unstage",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({cwd:a,files:c.staged.map(a=>a.path)})})).ok)throw Error("Failed to unstage all files");await C(),(0,f.oR)(g.A.t("toast.unstagedNFiles",{count:c.staged.length}),"success")}catch(a){console.error("Error unstaging all files:",a),(0,f.oR)(g.A.t("toast.unstageFailed"),"error")}},[a,c,C]),M=(0,d.useCallback)(async b=>{try{let c="untracked"===b.status;if(!(await fetch("/api/git/discard",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({cwd:a,files:[b.path],isUntracked:c})})).ok)throw Error("Failed to discard file");await C(),(0,f.oR)(c?g.A.t("toast.deletedFile"):g.A.t("toast.discardedChanges"),"success")}catch(a){console.error("Error discarding file:",a),(0,f.oR)(g.A.t("toast.discardFailed"),"error")}},[a,C]),N=(0,d.useCallback)(async()=>{if(c?.unstaged.length&&await (0,f.lJ)(g.A.t("git.discardAllConfirm",{count:c.unstaged.length}),{danger:!0}))try{let b=c.unstaged.filter(a=>"untracked"===a.status).map(a=>a.path),d=c.unstaged.filter(a=>"untracked"!==a.status).map(a=>a.path);d.length>0&&await fetch("/api/git/discard",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({cwd:a,files:d,isUntracked:!1})}),b.length>0&&await fetch("/api/git/discard",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({cwd:a,files:b,isUntracked:!0})}),await C(),(0,f.oR)(g.A.t("toast.discardedNFiles",{count:c.unstaged.length}),"success")}catch(a){console.error("Error discarding all:",a),(0,f.oR)(g.A.t("toast.discardFailed"),"error")}},[a,c,C]);return{status:c,setStatus:h,statusLoading:i,statusError:k,statusSelectedFile:m,statusDiff:o,statusDiffLoading:q,statusExpandedPaths:s,setStatusExpandedPaths:t,stagedTree:u,setStagedTree:v,unstagedTree:w,setUnstagedTree:x,showStatusDiffPreview:y,setShowStatusDiffPreview:z,fetchStatus:C,handleStatusToggle:D,handleStatusFileSelect:E,handleStage:F,handleUnstage:G,handleStageFiles:H,handleUnstageFiles:I,handleDiscardFiles:J,handleStageAll:K,handleUnstageAll:L,handleDiscardFile:M,handleDiscardAll:N,refreshDiff:(0,d.useCallback)(()=>B(a=>a+1),[])}}},86791:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{K:()=>k});var e=c(48249),f=c(67484),g=c(44384),h=c(92951),i=c(81749),j=a([h]);h=(j.then?(await j)():j)[0];let l={Read:"\uD83D\uDCC4",Write:"✏️",Edit:"\uD83D\uDCDD",Bash:"\uD83D\uDCBB",Glob:"\uD83D\uDD0D",Grep:"\uD83D\uDD0E",WebFetch:"\uD83C\uDF10",WebSearch:"\uD83D\uDD0D"};function k({toolCall:a,cwd:b}){let c,{t:d}=(0,g.Bd)(),[j,k]=(0,f.useState)(!1),[m,n]=(0,f.useState)(null),o=l[a.name]||"\uD83D\uDD27",p=(c=a.input,"Bash"===a.name&&c.command&&"string"==typeof c.command?c.command:"Glob"===a.name&&c.pattern&&"string"==typeof c.pattern||"Grep"===a.name&&c.pattern&&"string"==typeof c.pattern?c.pattern:c.file_path&&"string"==typeof c.file_path?c.file_path:c.path&&"string"==typeof c.path?c.path:null),q="Glob"===a.name||"Grep"===a.name||"Bash"===a.name,r=p?q?p:(a=>{if(b&&a.startsWith(b)){let c=a.slice(b.length);return c.startsWith("/")?c.slice(1):c}let c=a.split("/");return c.length>2?".../"+c.slice(-2).join("/"):a})(p):null,s=b=>{let c="input"===b?d("toolCall.inputParams"):d("toolCall.resultLabel"),e="input"===b?JSON.stringify(a.input,null,2):"string"==typeof a.result?a.result:JSON.stringify(a.result,null,2);n({title:`${a.name}${r?` ${r}`:""} - ${c}`,content:e,toolName:a.name})};return(0,e.jsxs)("div",{className:"my-2 border border-border rounded-lg overflow-hidden bg-secondary",children:[(0,e.jsxs)("button",{onClick:()=>k(!j),className:"w-full px-3 py-2 flex items-center gap-2 text-left hover:bg-accent transition-colors",children:[(0,e.jsx)("span",{className:"text-base",children:o}),(0,e.jsx)("span",{className:"font-medium text-sm text-foreground flex-shrink-0",children:a.name}),r&&(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("span",{className:"text-xs text-muted-foreground truncate flex-1 min-w-0",title:p||"",children:r}),(0,e.jsx)("span",{role:"button",tabIndex:0,onClick:a=>{a.stopPropagation(),p&&(navigator.clipboard.writeText(p),(0,i.oR)(d("common.copiedPath")))},onKeyDown:a=>{("Enter"===a.key||" "===a.key)&&(a.stopPropagation(),p&&(navigator.clipboard.writeText(p),(0,i.oR)(d("common.copiedPath"))))},className:"p-0.5 rounded text-muted-foreground hover:text-foreground hover:bg-accent transition-colors flex-shrink-0 cursor-pointer",title:d("common.copyAbsPath"),children:(0,e.jsx)("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z"})})})]}),(0,e.jsxs)("span",{className:"ml-auto flex items-center gap-2",children:[j&&!a.isLoading&&(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("span",{role:"button",tabIndex:0,onClick:a=>{a.stopPropagation(),s("input")},onKeyDown:a=>{("Enter"===a.key||" "===a.key)&&(a.stopPropagation(),s("input"))},className:"text-xs text-brand hover:text-teal-10 cursor-pointer",title:d("toolCall.inputParamsTitle"),children:d("toolCall.input")}),a.result&&(0,e.jsx)("span",{role:"button",tabIndex:0,onClick:a=>{a.stopPropagation(),s("result")},onKeyDown:a=>{("Enter"===a.key||" "===a.key)&&(a.stopPropagation(),s("result"))},className:"text-xs text-brand hover:text-teal-10 cursor-pointer",title:d("toolCall.resultTitle"),children:d("toolCall.result")})]}),a.isLoading?(0,e.jsx)("span",{className:"inline-block w-4 h-4 border-2 border-brand border-t-transparent rounded-full animate-spin"}):(0,e.jsx)("span",{className:"text-slate-9 text-xs",children:j?"▲":"▼"})]})]}),j&&(0,e.jsxs)("div",{className:"border-t border-border",children:[(0,e.jsxs)("div",{className:"px-3 py-2",children:[(0,e.jsx)("div",{className:"mb-1",children:(0,e.jsxs)("span",{className:"text-xs text-muted-foreground",children:[d("toolCall.inputParams"),":"]})}),(0,e.jsx)("pre",{className:"text-xs bg-secondary p-2 rounded overflow-x-auto max-h-24 overflow-y-auto text-foreground",children:JSON.stringify(a.input,null,2)})]}),a.result&&(0,e.jsxs)("div",{className:"px-3 py-2 border-t border-border",children:[(0,e.jsx)("div",{className:"mb-1",children:(0,e.jsxs)("span",{className:"text-xs text-muted-foreground",children:[d("toolCall.resultLabel"),":"]})}),(0,e.jsx)("pre",{className:"text-xs bg-secondary p-2 rounded overflow-x-auto max-h-24 overflow-y-auto text-foreground",children:"string"==typeof a.result?a.result:JSON.stringify(a.result,null,2)})]})]}),m&&(0,e.jsx)(h.M,{title:m.title,content:m.content,toolName:m.toolName,onClose:()=>n(null)})]})}d()}catch(a){d(a)}})},89976:(a,b,c)=>{"use strict";c.d(b,{b:()=>f});var d=c(48249),e=c(67484);function f({lines:a,containerRef:b}){let c=(0,e.useRef)(null),[f,g]=(0,e.useState)({top:0,height:0});if(0===a.length)return null;let h=100/a.length;return(0,d.jsxs)("div",{ref:c,className:"w-4 flex-shrink-0 bg-secondary border-l border-border relative cursor-pointer",onClick:a=>{let d=b.current,e=c.current;if(!d||!e)return;let f=e.getBoundingClientRect(),g=(a.clientY-f.top)/f.height*d.scrollHeight-d.clientHeight/2;d.scrollTo({top:Math.max(0,g),behavior:"smooth"})},children:[a.map((a,b)=>"unchanged"!==a.type&&(0,d.jsx)("div",{className:`absolute left-0 right-0 ${"removed"===a.type?"bg-red-9":"bg-green-9"}`,style:{top:`${b*h}%`,height:`${Math.max(h,.5)}%`,minHeight:"2px"}},b)),(0,d.jsx)("div",{className:"absolute left-0 right-0 bg-muted/60 border-y border-border",style:{top:`${f.top}px`,height:`${Math.max(f.height,10)}px`}})]})}},90173:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{C:()=>h});var e=c(67484),f=c(5811),g=a([f]);function h(a,b){let[c,d]=(0,e.useState)([]),[f,g]=(0,e.useState)(!1);return(0,e.useRef)(""),a.join("\n"),c}f=(g.then?(await g)():g)[0],d()}catch(a){d(a)}})},91645:a=>{"use strict";a.exports=require("net")},92050:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{X:()=>i});var e=c(48249),f=c(67484),g=c(24266),h=a([g]);function i({tabId:a,cwd:b,sessionId:c,isActive:d,onStateChange:h,onShowGitStatus:i,onOpenNote:j,onCreateScheduledTask:k,onOpenSession:l,onContentSearch:m}){let n=(0,f.useCallback)(b=>{h(a,{isLoading:b})},[a,h]),o=(0,f.useCallback)(b=>{h(a,{sessionId:b})},[a,h]),p=(0,f.useCallback)(b=>{h(a,{title:b})},[a,h]);return(0,e.jsx)(g.r,{tabId:a,initialCwd:b,initialSessionId:c,hideHeader:!0,hideSidebar:!0,isActive:d,onLoadingChange:n,onSessionIdChange:o,onTitleChange:p,onShowGitStatus:i,onOpenNote:j,onCreateScheduledTask:k,onOpenSession:l,onContentSearch:m})}g=(h.then?(await h)():h)[0],d()}catch(a){d(a)}})},92154:(a,b,c)=>{"use strict";c.d(b,{R8:()=>i,c0:()=>k,fY:()=>j,gT:()=>l});var d=c(48249),e=c(67484);let f=["agent","explorer","console"],g={agent:"AGENT",explorer:"EXPLORER",console:"CONSOLE"},h=(0,e.createContext)(null);function i(){let a=(0,e.useContext)(h);if(!a)throw Error("useSwipeContext must be used within SwipeableViewContainer");return a}function j({activeView:a,onViewChange:b,children:c}){(0,e.useRef)(null),(0,e.useRef)(!1),(0,e.useRef)(0);let[g,i]=(0,e.useState)(0),[j,k]=(0,e.useState)(!1);f.indexOf(a),f.length;let[l,m]=(0,e.useState)(!1),n={activeView:a,onViewChange:b,dragOffset:(()=>{if(!l)return 0;let a=window.innerWidth;return a?g/a:0})(),isDragging:l&&j};return(0,d.jsx)(h.Provider,{value:n,children:c})}function k({children:a}){let b,c,{activeView:g,dragOffset:h,isDragging:j}=i(),k=(0,e.useRef)(null),l=(0,e.useRef)(null),m=f.indexOf(g),n=f.length;return(0,d.jsx)("div",{ref:k,className:"flex-1 overflow-hidden relative",style:{overscrollBehaviorX:"none"},children:(0,d.jsx)("div",{ref:l,className:j?"flex":"flex transition-transform duration-100 ease-out",style:{position:"absolute",top:"0px",bottom:"0px",left:"0px",width:`${100*f.length}%`,transform:(b=h/n*100,c=-(100/n*m)+(Number.isFinite(b)?b:0),`translateX(${c}%)`)},children:a})})}function l(){let{activeView:a,onViewChange:b,dragOffset:c,isDragging:h}=i(),j=(0,e.useRef)(null),k=(0,e.useRef)([]),[l,m]=(0,e.useState)({left:0,width:0}),n=f.indexOf(a),o=Number.isFinite(c)?c:0,p=Math.round(Math.max(0,Math.min(f.length-1,n-o)));return(0,d.jsxs)("div",{ref:j,className:"relative flex gap-4",children:[f.map((a,c)=>(0,d.jsx)("button",{ref:a=>{k.current[c]=a},onClick:()=>b(a),className:`px-4 py-1 text-sm font-medium transition-colors ${p===c?"text-brand":"text-muted-foreground hover:text-foreground"}`,children:g[a]},a)),(0,d.jsx)("div",{className:`absolute bottom-0 h-0.5 bg-brand ${h?"":"transition-all duration-100 ease-out"}`,style:{left:l.left,width:l.width}})]})}},92951:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{M:()=>t});var e=c(48249),f=c(67484),g=c(44384),h=c(31172),i=c(86402),j=c(79029),k=c(44741),l=c(30068),m=c(90500),n=c(81749),o=c(36645),p=c(56929),q=a([i,j]);function r({filePath:a}){let[b,c]=(0,f.useState)(null),[d,g]=(0,f.useState)(!0),[h,i]=(0,f.useState)(null);(0,f.useRef)(!1);let k=(0,p.e$)(a);if((0,p.u)(a),h)return(0,e.jsx)("div",{className:"flex items-center justify-center h-full",children:(0,e.jsx)("div",{className:"text-xs text-red-11",children:h})});if(d)return(0,e.jsx)("div",{className:"flex items-center justify-center h-full",children:(0,e.jsx)("span",{className:"text-sm text-muted-foreground",children:"Loading..."})});if((0,p.u)(a)){let b=`/api/file?path=${encodeURIComponent(a)}&raw=true`;return(0,e.jsx)("div",{className:"flex items-center justify-center h-full overflow-auto",children:(0,e.jsx)("img",{src:b,alt:a.split("/").pop()||"image",className:"max-w-full max-h-full object-contain"})})}return b?k?(0,e.jsx)(s,{content:b}):(0,e.jsx)(j.Cv,{content:b,filePath:a,showLineNumbers:!0,showSearch:!0,className:"h-full"}):(0,e.jsx)("div",{className:"flex items-center justify-center h-full",children:(0,e.jsx)("span",{className:"text-sm text-muted-foreground",children:"No content"})})}[i,j]=q.then?(await q)():q;let u=[m.W];function s({content:a}){let b=(0,f.useRef)(null);return(0,e.jsxs)("div",{className:"h-full flex",children:[(0,e.jsx)(l.l,{content:a,containerRef:b}),(0,e.jsx)("div",{ref:b,className:"flex-1 overflow-auto p-4",children:(0,e.jsx)(k.T,{content:a,rehypePlugins:u})})]})}function t({title:a,content:b,toolName:c,onClose:d}){let{t:j}=(0,g.Bd)(),k=(0,p.jU)(b),l=(0,p.zs)(b),m=(0,p.oK)(b),q=!!l,s=!!m,[t,u]=(0,f.useState)(("Read"===c||"Write"===c)&&s?"file":q?"diff-unified":k?"readable":"json"),v=(0,f.useRef)(null),w=(0,o.o)(v),x=(0,e.jsx)("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50 p-4",onClick:d,children:(0,e.jsxs)("div",{className:"bg-card rounded-lg shadow-xl w-full max-w-[90%] h-[90vh] flex flex-col transition-all",onClick:a=>a.stopPropagation(),children:[(0,e.jsxs)("div",{className:"flex items-center justify-between px-4 py-3 border-b border-border",children:[(0,e.jsxs)("div",{className:"flex items-center gap-2",children:[(0,e.jsx)("h3",{className:"text-sm font-medium text-foreground",children:a}),m&&(0,e.jsx)("button",{onClick:()=>{navigator.clipboard.writeText(m),(0,n.oR)(j("common.copiedPath"))},className:"p-0.5 rounded text-muted-foreground hover:text-foreground hover:bg-accent transition-colors",title:j("common.copyAbsPath"),children:(0,e.jsx)("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z"})})})]}),(0,e.jsxs)("div",{className:"flex items-center gap-3",children:[k&&(0,e.jsxs)("div",{className:"flex items-center gap-1 bg-accent rounded p-0.5",children:[q&&(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("button",{onClick:()=>u("diff-split"),className:`px-2 py-1 text-xs rounded transition-colors ${"diff-split"===t?"bg-card text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"}`,title:j("diffViewer.sideBySide"),children:"Split"}),(0,e.jsx)("button",{onClick:()=>u("diff-unified"),className:`px-2 py-1 text-xs rounded transition-colors ${"diff-unified"===t?"bg-card text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"}`,title:j("diffViewer.unified"),children:"Unified"})]}),s&&(0,e.jsx)("button",{onClick:()=>u("file"),className:`px-2 py-1 text-xs rounded transition-colors ${"file"===t?"bg-card text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"}`,title:j("diffViewer.previewFile"),children:"File"}),(0,e.jsx)("button",{onClick:()=>u("readable"),className:`px-2 py-1 text-xs rounded transition-colors ${"readable"===t?"bg-card text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"}`,children:j("common.readable")}),(0,e.jsx)("button",{onClick:()=>u("json"),className:`px-2 py-1 text-xs rounded transition-colors ${"json"===t?"bg-card text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"}`,children:"JSON"})]}),(0,e.jsx)("button",{onClick:d,className:"p-1 text-slate-9 hover:text-foreground hover:bg-accent rounded transition-colors",children:(0,e.jsx)("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]})]}),(0,e.jsx)("div",{className:"flex-1 overflow-auto p-4",children:"file"===t&&m?(0,e.jsx)(r,{filePath:m}):"diff-unified"===t&&l?(0,e.jsx)(i.xU,{oldContent:l.old_string,newContent:l.new_string,filePath:l.file_path}):"diff-split"===t&&l?(0,e.jsx)(i.xZ,{oldContent:l.old_string,newContent:l.new_string,filePath:l.file_path}):"readable"===t&&k?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(o._,{search:w}),(0,e.jsx)("pre",{ref:v,className:"text-foreground whitespace-pre-wrap break-words",style:{fontSize:"0.8125rem"},children:(0,p.xb)(b)})]}):(0,e.jsx)("pre",{className:"text-foreground whitespace-pre-wrap break-words",style:{fontSize:"0.8125rem"},children:k?(0,p.C6)(b):b})})]})});return(0,e.jsx)(h.Z,{children:x})}d()}catch(a){d(a)}})},93053:(a,b,c)=>{"use strict";c.d(b,{i:()=>f});var d=c(67484),e=c(6440);function f({initialCwd:a,initialSessionId:b,activeView:c}){(0,d.useRef)(!1),(0,d.useRef)(!0);let f=(0,d.useRef)(c),g=(0,e.F)(),h=(0,d.useRef)(g),[i,j]=(0,d.useState)(()=>[{id:`tab-${Date.now()}`,cwd:a,title:"New Chat"}]),[k,l]=(0,d.useState)(i[0].id),[m,n]=(0,d.useState)(new Set),o=(0,d.useRef)(i),p=(0,d.useCallback)((b,c)=>{a&&b&&fetch("/api/global-state",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({cwd:a,sessionId:b,status:c})}).catch(()=>{})},[a]),[q,r]=(0,d.useState)(null),[s,t]=(0,d.useState)(null),u=(0,d.useCallback)((a,b,c)=>{let d={id:`tab-${Date.now()}`,cwd:a,sessionId:b,title:c||(b?`Session ${b.slice(0,6)}...`:"New Chat")};j(a=>{let b=a.findIndex(a=>a.id===k);if(-1===b)return[...a,d];let c=[...a];return c.splice(b+1,0,d),c}),l(d.id)},[k]),v=(0,d.useCallback)(b=>{j(c=>{let d=c.filter(a=>a.id!==b);if(b===k&&d.length>0&&l(d[d.length-1].id),0===d.length){let b={id:`tab-${Date.now()}`,cwd:a,title:"New Chat"};return l(b.id),[b]}return d})},[k,a]),w=(0,d.useCallback)((b,c)=>{let d=i.find(a=>a.sessionId===b);d?l(d.id):u(a,b,c)},[i,a,u]),x=(0,d.useCallback)(()=>{u(a)},[a,u]),y=(0,d.useCallback)((b,c)=>{u(a,b,c)},[a,u]),z=(0,d.useCallback)((a,b)=>{j(c=>{let d=c.find(b=>b.id===a);if(d?.isLoading&&!1===b.isLoading){let c=!f.current||"agent"===f.current;if(a===k&&c&&h.current){let a=d.sessionId||b.sessionId;a&&p(a,"normal")}else n(b=>new Set(b).add(a))}return c.map(c=>c.id===a?{...c,...b}:c)})},[k,p]),A=(0,d.useCallback)(a=>{l(a),n(b=>{if(!b.has(a))return b;let c=new Set(b);c.delete(a);let d=o.current.find(b=>b.id===a);return d?.sessionId&&p(d.sessionId,"normal"),c})},[p]),B=(0,d.useCallback)(a=>{r(a)},[]),C=(0,d.useCallback)((a,b)=>{a.preventDefault(),null!==q&&q!==b&&t(b)},[q]),D=(0,d.useCallback)(a=>{null!==q&&q!==a&&j(b=>{let c=[...b],[d]=c.splice(q,1);return c.splice(a,0,d),c}),r(null),t(null)},[q]),E=(0,d.useCallback)(()=>{r(null),t(null)},[]),F=i.find(a=>a.id===k);return{tabs:i,activeTabId:k,activeTab:F,unreadTabs:m,dragTabIndex:q,dragOverTabIndex:s,addTab:u,closeTab:v,switchTab:A,handleSelectSession:w,handleNewTab:x,handleOpenSession:y,updateTabState:z,handleTabDragStart:B,handleTabDragOver:C,handleTabDrop:D,handleTabDragEnd:E}}},94882:(a,b,c)=>{"use strict";function d(a,b){for(let c of a){if(c.path===b)return c;if(c.children){let a=d(c.children,b);if(a)return a}}return null}function e(a,b){if(!a)return"";let c=d(b,a);if(c?.isDirectory)return a;let e=a.split("/");return e.pop(),e.join("/")}function f(a){let b=[];for(let c of a){let a=c.split("/"),d=b;for(let b=0;b<a.length;b++){let c=a[b],e=b===a.length-1,f=a.slice(0,b+1).join("/"),g=d.find(a=>a.name===c);g||(g={name:c,path:f,isDirectory:!e,children:e?void 0:[]},d.push(g)),!e&&g.children&&(d=g.children)}}let c=a=>{a.sort((a,b)=>a.isDirectory&&!b.isDirectory?-1:!a.isDirectory&&b.isDirectory?1:a.name.localeCompare(b.name)),a.forEach(a=>{a.children&&c(a.children)})};return c(b),b}function g(a){let b=[],c=a=>{for(let d of a)d.isDirectory&&(b.push(d.path),d.children&&c(d.children))};return c(a),b}c.d(b,{B_:()=>o,KH:()=>k,MB:()=>d,S7:()=>e,fw:()=>l,q3:()=>j,r6:()=>m,tE:()=>n,tW:()=>g,u:()=>i,v3:()=>f});let h=new Set(["png","jpg","jpeg","gif","svg","webp","ico","bmp"]);function i(a){let b=a.split(".").pop()?.toLowerCase();return h.has(b||"")}function j(a,b,c=!1){let d=new Set;if(!b)return d;let e=b.toLowerCase(),f=a=>{if(d.add(a.path),a.children)for(let b of a.children)f(b)},g=(a,b)=>{let h=a.name.toLowerCase(),i=c?h===e:h.includes(e);if(i&&a.children)return f(a),b.forEach(a=>d.add(a)),!0;let j=!1;if(a.children)for(let c of a.children)g(c,[...b,a.path])&&(j=!0);return(!!i||!!j)&&(d.add(a.path),b.forEach(a=>d.add(a)),!0)};for(let b of a)g(b,[]);return d}function k(a,b,c=!1){let d=new Set;if(!b)return d;let e=b.toLowerCase();for(let b of a){let a=b.split("/");for(let b=0;b<a.length;b++){let f=a[b].toLowerCase();if(c?f===e:f.includes(e)){for(let b=0;b<=a.length-1;b++)d.add(a.slice(0,b+1).join("/"));break}}}return d}function l(a){let b=Math.floor(Math.floor((Date.now()-1e3*a)/1e3)/60),c=Math.floor(b/60),d=Math.floor(c/24),e=Math.floor(d/30),f=Math.floor(d/365);return f>0?`${f}y ago`:e>0?`${e}mo ago`:d>0?`${d}d ago`:c>0?`${c}h ago`:b>0?`${b}m ago`:"just now"}function m(a){let b=new Date(a),c=new Date,d=b.getFullYear()===c.getFullYear(),e=String(b.getMonth()+1).padStart(2,"0"),f=String(b.getDate()).padStart(2,"0"),g=String(b.getHours()).padStart(2,"0"),h=String(b.getMinutes()).padStart(2,"0");return d?`${e}-${f} ${g}:${h}`:`${b.getFullYear()}-${e}-${f} ${g}:${h}`}let n=()=>{},o=50},94924:(a,b,c)=>{"use strict";c.d(b,{Y:()=>k});var d=c(48249),e=c(67484),f=c(44384);let g=(0,c(47408).A)("terminal",[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]]);var h=c(46674),i=c(59347),j=c(24520);function k({onClose:a,onSave:b}){let{t:c}=(0,f.Bd)(),[k,l]=(0,e.useState)({}),[m,n]=(0,e.useState)(""),[o,p]=(0,e.useState)(""),[q,r]=(0,e.useState)(!0),s=()=>{m.trim()&&o.trim()&&(l(a=>({...a,[m.trim()]:o.trim()})),n(""),p(""))},t=async()=>{try{(await fetch("/api/terminal/aliases",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({aliases:k})})).ok&&(b(k),a())}catch(a){console.error("Failed to save aliases:",a)}};return(0,d.jsx)("div",{className:"absolute inset-0 bg-black/50 flex items-center justify-center z-50",children:(0,d.jsxs)("div",{className:"bg-background border border-border rounded-lg shadow-xl w-full max-w-2xl max-h-[80vh] flex flex-col m-4",children:[(0,d.jsxs)("div",{className:"flex items-center justify-between px-4 py-3 border-b border-border",children:[(0,d.jsxs)("div",{children:[(0,d.jsxs)("h2",{className:"text-lg font-semibold flex items-center gap-2",children:[(0,d.jsx)(g,{className:"w-5 h-5"}),c("aliasManager.title")]}),(0,d.jsx)("p",{className:"text-xs text-muted-foreground mt-0.5",children:c("aliasManager.description")})]}),(0,d.jsx)("button",{onClick:a,className:"p-1 rounded hover:bg-accent transition-colors",children:(0,d.jsx)(h.A,{className:"w-5 h-5"})})]}),(0,d.jsx)("div",{className:"flex-1 overflow-y-auto p-4",children:q?(0,d.jsx)("div",{className:"flex items-center justify-center h-32 text-muted-foreground",children:c("common.loading")}):(0,d.jsxs)("div",{className:"space-y-3",children:[Object.entries(k).map(([a,b])=>(0,d.jsxs)("div",{className:"flex items-start gap-2 group",children:[(0,d.jsxs)("div",{className:"flex-1 grid grid-cols-2 gap-2",children:[(0,d.jsxs)("div",{className:"relative",children:[(0,d.jsx)("div",{className:"absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground text-sm",children:"$"}),(0,d.jsx)("input",{type:"text",value:a,disabled:!0,className:"w-full pl-7 pr-3 py-2 rounded-lg border border-input bg-muted text-sm font-mono"})]}),(0,d.jsx)("input",{type:"text",value:b,onChange:b=>{var c;return c=b.target.value,void l(b=>({...b,[a]:c}))},placeholder:c("aliasManager.fullCommandPlaceholder"),className:"w-full px-3 py-2 rounded-lg border border-input bg-background text-sm font-mono focus:outline-none focus:ring-2 focus:ring-brand focus:border-transparent"})]}),(0,d.jsx)("button",{onClick:()=>{l(b=>{let c={...b};return delete c[a],c})},className:"p-2 rounded-lg text-destructive hover:bg-destructive/10 transition-colors opacity-0 group-hover:opacity-100",children:(0,d.jsx)(i.A,{className:"w-4 h-4"})})]},a)),(0,d.jsxs)("div",{className:"flex items-start gap-2 pt-2 border-t border-border",children:[(0,d.jsxs)("div",{className:"flex-1 grid grid-cols-2 gap-2",children:[(0,d.jsxs)("div",{className:"relative",children:[(0,d.jsx)("div",{className:"absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground text-sm",children:"$"}),(0,d.jsx)("input",{type:"text",value:m,onChange:a=>n(a.target.value),placeholder:c("aliasManager.aliasPlaceholder"),className:"w-full pl-7 pr-3 py-2 rounded-lg border border-input bg-background text-sm font-mono focus:outline-none focus:ring-2 focus:ring-brand focus:border-transparent",onKeyDown:a=>{"Enter"!==a.key||a.nativeEvent.isComposing||(a.preventDefault(),s())}})]}),(0,d.jsx)("input",{type:"text",value:o,onChange:a=>p(a.target.value),placeholder:c("aliasManager.commandPlaceholder"),className:"w-full px-3 py-2 rounded-lg border border-input bg-background text-sm font-mono focus:outline-none focus:ring-2 focus:ring-brand focus:border-transparent",onKeyDown:a=>{"Enter"!==a.key||a.nativeEvent.isComposing||(a.preventDefault(),s())}})]}),(0,d.jsx)("button",{onClick:s,disabled:!m.trim()||!o.trim(),className:"p-2 rounded-lg bg-brand text-brand-foreground hover:bg-brand/90 transition-colors disabled:opacity-50 disabled:cursor-not-allowed",children:(0,d.jsx)(j.A,{className:"w-4 h-4"})})]}),(0,d.jsxs)("div",{className:"mt-4 p-3 bg-accent rounded-lg",children:[(0,d.jsxs)("p",{className:"text-sm text-muted-foreground",children:[(0,d.jsx)("strong",{children:c("aliasManager.usage")}),c("aliasManager.usageDesc")]}),(0,d.jsxs)("div",{className:"mt-2 space-y-1 text-xs text-muted-foreground",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)("code",{className:"px-1.5 py-0.5 bg-background rounded",children:"$ ll"}),(0,d.jsx)("span",{children:"→"}),(0,d.jsx)("code",{className:"px-1.5 py-0.5 bg-background rounded",children:"ls -la"})]}),(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)("code",{className:"px-1.5 py-0.5 bg-background rounded",children:"$ gs"}),(0,d.jsx)("span",{children:"→"}),(0,d.jsx)("code",{className:"px-1.5 py-0.5 bg-background rounded",children:"git status"})]})]})]}),0===Object.keys(k).length&&(0,d.jsx)("div",{className:"text-center py-8 text-muted-foreground text-sm",children:c("aliasManager.noAliases")})]})}),(0,d.jsxs)("div",{className:"flex items-center justify-end gap-2 px-4 py-3 border-t border-border",children:[(0,d.jsx)("button",{onClick:a,className:"px-4 py-2 rounded-lg text-sm hover:bg-accent transition-colors",children:c("common.cancel")}),(0,d.jsx)("button",{onClick:t,className:"px-4 py-2 rounded-lg text-sm bg-brand text-brand-foreground hover:bg-brand/90 transition-colors",children:c("common.save")})]})]})})}},95133:(a,b,c)=>{"use strict";c.d(b,{S:()=>l,j:()=>j});var d=c(48249),e=c(67484),f=c(44384),g=c(41564),h=c(74429);function i({blame:a,onClick:b}){let{t:c}=(0,f.Bd)(),i=(0,e.useRef)(null),j=(0,e.useRef)(null),k=(0,e.useRef)(!1),l=(0,e.useRef)(!1),m=(0,e.useRef)(null),n=(0,e.useRef)(null),o=(0,e.useRef)(null),p=(0,e.useRef)(a),q=(0,e.useRef)(b),r=(0,e.useCallback)(()=>{let a,b=j.current,c=i.current;if(!b||!c)return;let d=c.getBoundingClientRect(),e=b.getBoundingClientRect(),f=window.innerWidth,g=window.innerHeight,h=d.left;h+e.width>f-8&&(h=f-e.width-8),h<8&&(h=8),(a=d.top-e.height-4<0?d.bottom+4:d.top-e.height-4)+e.height>g-8&&(a=g-e.height-8),b.style.left=`${h}px`,b.style.top=`${a}px`},[]),s=(0,e.useCallback)(()=>{m.current&&(clearTimeout(m.current),m.current=null),n.current&&(clearTimeout(n.current),n.current=null),k.current=!1,l.current=!1,j.current&&(j.current.style.display="none"),o.current&&(document.removeEventListener("mousedown",o.current.down),document.removeEventListener("mouseup",o.current.up),o.current=null)},[]),t=(0,e.useCallback)(()=>{let a=j.current;if(!a||k.current)return;k.current=!0,a.style.left="-9999px",a.style.top="-9999px",a.style.display="block",requestAnimationFrame(()=>requestAnimationFrame(r));let b=0,c=0,d=a=>{b=a.clientX,c=a.clientY},e=a=>{if(!(Math.abs(a.clientX-b)>5||Math.abs(a.clientY-c)>5)){let b;b=a.target,j.current?.contains(b)||i.current?.contains(b)||s()}};document.addEventListener("mousedown",d),document.addEventListener("mouseup",e),o.current={down:d,up:e}},[r,s]),u=(0,e.useCallback)(()=>{if(m.current&&clearTimeout(m.current),n.current&&(clearTimeout(n.current),n.current=null),k.current)return;let a=window.getSelection();(!a||a.isCollapsed)&&(m.current=setTimeout(t,500))},[t]),v=(0,e.useCallback)(()=>{m.current&&(clearTimeout(m.current),m.current=null),k.current&&(n.current=setTimeout(()=>{l.current||s()},200))},[s]),w=(0,e.useCallback)(()=>{l.current=!0,n.current&&(clearTimeout(n.current),n.current=null)},[]),x=(0,e.useCallback)(()=>{l.current=!1,s()},[s]),y=(0,e.useCallback)(a=>{a.stopPropagation();let b=window.getSelection();b&&b.toString().length>0&&j.current?.contains(b.anchorNode)||(q.current?.(p.current),s())},[s]),z=a.message.split("\n")[0]||"",A=a.message.split("\n").slice(1).join("\n").trim();return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("span",{ref:i,className:"select-none text-xs text-muted-foreground/50 ml-6 cursor-default hover:text-muted-foreground/80",onMouseEnter:u,onMouseLeave:v,children:[a.author.split(" ")[0],", ",function(a){let b=g.A.t,c=Math.floor((Date.now()-1e3*a)/1e3);if(c<60)return b("common.justNow");let d=Math.floor(c/60);if(d<60)return b("common.minutesAgo",{count:d});let e=Math.floor(d/60);if(e<24)return b("common.hoursAgo",{count:e});let f=Math.floor(e/24);if(f<30)return b("common.daysAgo",{count:f});let h=Math.floor(f/30);return h<12?b("common.monthsAgo",{count:h}):b("common.yearsAgo",{count:Math.floor(h/12)})}(a.time)," \xb7 ",z]}),(0,h.createPortal)((0,d.jsxs)("div",{ref:j,className:"fixed z-[9999] bg-card border border-border rounded-lg shadow-xl p-3 text-xs text-foreground whitespace-pre-wrap max-w-md select-text",style:{display:"none",minWidth:280,cursor:"text"},"data-inline-blame-tip":"",onMouseEnter:w,onMouseLeave:x,children:[(0,d.jsxs)("div",{className:"flex items-center gap-2 mb-1.5",children:[(0,d.jsx)("span",{className:"font-mono text-brand",children:a.hash}),(0,d.jsx)("span",{className:"text-muted-foreground",children:a.author}),(0,d.jsx)("span",{className:"text-muted-foreground/60",children:new Date(1e3*a.time).toLocaleString()})]}),(0,d.jsx)("div",{className:"font-medium",children:z}),A&&(0,d.jsx)("div",{className:"mt-1 text-muted-foreground",children:A}),(0,d.jsx)("div",{className:"mt-2 text-[11px] text-brand border-t border-border pt-2 cursor-pointer hover:underline",onClick:y,children:c("codeViewer.clickToViewDetails")})]}),document.body)]})}let j=[{bg:"rgba(59, 130, 246, 0.15)",border:"rgb(59, 130, 246)"},{bg:"rgba(16, 185, 129, 0.15)",border:"rgb(16, 185, 129)"},{bg:"rgba(245, 158, 11, 0.15)",border:"rgb(245, 158, 11)"},{bg:"rgba(239, 68, 68, 0.15)",border:"rgb(239, 68, 68)"},{bg:"rgba(168, 85, 247, 0.15)",border:"rgb(168, 85, 247)"},{bg:"rgba(236, 72, 153, 0.15)",border:"rgb(236, 72, 153)"},{bg:"rgba(20, 184, 166, 0.15)",border:"rgb(20, 184, 166)"},{bg:"rgba(249, 115, 22, 0.15)",border:"rgb(249, 115, 22)"}];function k(a,b){let c,d=document.caretRangeFromPoint(a.clientX,a.clientY);if(!d||!b.contains(d.startContainer))return 1;let e=d.startContainer,f=d.startOffset,g=document.createTreeWalker(b,NodeFilter.SHOW_TEXT),h=1;for(;c=g.nextNode();){if(c===e){h+=f;break}h+=c.textContent?.length||0}return h}let l=(0,e.memo)(function({virtualKey:a,lineNum:b,highlightedHtml:c,hasComments:g,firstComment:h,lineCommentsCount:j,isInRange:l,showLineNumbers:m,lineNumChars:n,commentsEnabled:o,virtualItemSize:p,virtualItemStart:q,onCommentBubbleClick:r,onCmdClick:s,onTokenHover:t,onTokenHoverLeave:u,flashLine:v,blameLine:w,showBlameInfo:x,blameAuthorColor:y,isBlameHovered:z,onBlameClick:A,onBlameMouseEnter:B,onBlameMouseLeave:C,inlineBlameData:D,onInlineBlameClick:E,isCursorLine:F,cursorCol:G}){let{t:H}=(0,f.Bd)(),I=(0,e.useMemo)(()=>F&&null!=G?function(a,b){let c=0,d=0;for(;d<a.length;){if("<"===a[d]){let b=a.indexOf(">",d);if(-1!==b){d=b+1;continue}}if(c===b){let b;if("&"===a[d]){let c=a.indexOf(";",d);b=-1!==c&&c-d<10?c+1:d+1}else b=d+1;let c=a.substring(d,b);return a.substring(0,d)+'<span class="vi-char-cursor">'+c+"</span>"+a.substring(b)}if("&"===a[d]){let b=a.indexOf(";",d);d=-1!==b&&b-d<10?b+1:d+1}else d++;c++}return a+'<span class="vi-char-cursor"> </span>'}(c,G):c,[c,F,G]),J=(0,e.useCallback)(a=>{if(!a.metaKey||!s)return;a.preventDefault(),a.stopPropagation();let c=a.currentTarget,d=k(a,c);window.getSelection()?.removeAllRanges(),s(b,d)},[b,s]),K=(0,e.useCallback)(a=>{if(!t||0!==a.buttons)return;let c=window.getSelection();if(c&&!c.isCollapsed)return;let d=a.target;if("SPAN"!==d.tagName||!d.style.color)return;let e=a.currentTarget,f=k(a,e),g=d.getBoundingClientRect();t(b,f,{x:g.left,y:g.bottom+4})},[b,t]),L=(0,e.useCallback)(()=>{w&&A&&A(w)},[w,A]),M=(0,e.useCallback)(a=>{w&&B&&B(w,a)},[w,B]);return(0,d.jsxs)("div",{"data-line":b,style:{position:"absolute",top:0,left:0,width:"100%",height:`${p}px`,transform:`translateY(${q}px)`,backgroundColor:z&&y?y.bg:void 0},className:`flex ${v===b?"flash-line":""} ${F?"vi-cursor-line":""} ${l?"bg-blue-9/20":g?"bg-amber-9/10":"hover:bg-accent/50"}`,children:[(0,d.jsxs)("div",{className:"flex shrink-0 sticky left-0 z-[2] bg-secondary",style:{backgroundColor:z&&y?y.bg:void 0},children:[w&&y&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("div",{className:"w-1 flex-shrink-0",style:{backgroundColor:y.border}}),(0,d.jsx)("div",{className:"w-48 flex-shrink-0 px-2 flex items-center gap-2 border-r border-border text-muted-foreground cursor-pointer hover:bg-accent/50",onMouseEnter:M,onMouseLeave:C,onClick:L,title:H("codeViewer.clickToViewCommit"),children:x?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("span",{className:"font-medium",style:{color:y.border},children:w.hash}),(0,d.jsx)("span",{className:"truncate flex-1",children:w.author.split(" ")[0]})]}):null})]}),m&&(0,d.jsxs)("span",{className:`flex-shrink-0 flex items-center justify-end gap-0.5 pr-2 select-none border-r border-border font-variant-tabular ${l?"bg-blue-9/30 text-blue-11":"bg-card/50 text-slate-9"}`,children:[o&&g&&h&&(0,d.jsx)("button",{onClick:a=>r(h,a),className:"w-4 h-4 flex items-center justify-center rounded hover:bg-accent text-amber-9",title:H("codeViewer.nComments",{count:j}),children:(0,d.jsx)("svg",{className:"w-3 h-3",fill:"currentColor",viewBox:"0 0 20 20",children:(0,d.jsx)("path",{fillRule:"evenodd",d:"M18 10c0 3.866-3.582 7-8 7a8.841 8.841 0 01-4.083-.98L2 17l1.338-3.123C2.493 12.767 2 11.434 2 10c0-3.866 3.582-7 8-7s8 3.134 8 7zM7 9H5v2h2V9zm8 0h-2v2h2V9zM9 9h2v2H9V9z",clipRule:"evenodd"})})}),o&&!g&&(0,d.jsx)("span",{className:"w-4"}),(0,d.jsx)("span",{className:"text-right",style:{minWidth:`${n}ch`},children:b})]})]}),(0,d.jsxs)("span",{className:"flex-1 px-3 whitespace-pre select-text",onClick:J,onMouseOver:K,onMouseLeave:u,"data-code-content":!0,children:[(0,d.jsx)("span",{dangerouslySetInnerHTML:{__html:I}}),D&&(0,d.jsx)(i,{blame:D,onClick:E})]})]},a)})},95836:(a,b,c)=>{"use strict";c.d(b,{Do:()=>m,Sz:()=>n,VO:()=>l,wI:()=>o});var d=c(48249),e=c(67484),f=c.n(e),g=c(44384),h=c(26068),i=c(4219);function j({status:a}){let{label:b,className:c}={added:{label:"A",className:"text-green-11"},untracked:{label:"A",className:"text-green-11"},modified:{label:"M",className:"text-amber-11"},deleted:{label:"D",className:"text-red-11"},renamed:{label:"R",className:"text-brand"}}[a]||{label:"?",className:"text-muted-foreground"};return(0,d.jsx)("span",{className:`text-xs font-bold ${c}`,children:b})}let k=f().memo(function a({node:b,level:c,selectedPath:f,expandedPaths:g,onSelect:h,onToggle:k,onContextMenu:l,showChanges:m=!1,renderActions:n}){let o=f===b.path,p=g.has(b.path),q=(0,e.useCallback)(()=>{b.isDirectory?k(b.path):h(b)},[b,h,k]),r=(0,e.useCallback)(a=>{a.preventDefault(),a.stopPropagation(),l(a,b.path,b.isDirectory)},[b.path,b.isDirectory,l]);return b.isDirectory?(0,d.jsxs)("div",{children:[(0,d.jsxs)("div",{className:"flex items-center gap-1 py-0.5 px-2 pr-3 hover:bg-accent cursor-pointer whitespace-nowrap group",style:{paddingLeft:`${12*c+8}px`},onClick:q,onContextMenu:r,children:[(0,d.jsx)("span",{className:"text-slate-9 text-xs",children:p?"▼":"▶"}),(0,d.jsx)("span",{className:"text-sm text-foreground flex-1 truncate","data-tooltip":b.path,children:b.name}),n&&n(b)]}),p&&b.children.map(b=>(0,d.jsx)(a,{node:b,level:c+1,selectedPath:f,expandedPaths:g,onSelect:h,onToggle:k,onContextMenu:l,showChanges:m,renderActions:n},b.path))]}):(0,d.jsxs)("div",{className:`flex items-center gap-1.5 py-0.5 px-2 pr-3 cursor-pointer whitespace-nowrap group ${o?"bg-brand/10":"hover:bg-accent"}`,style:{paddingLeft:`${12*c+8}px`},onClick:q,onContextMenu:r,children:[(0,d.jsx)(i.o,{name:b.name,size:16,className:"flex-shrink-0"}),(0,d.jsx)("span",{className:`text-sm flex-1 truncate ${o?"text-brand":"text-foreground"}`,"data-tooltip":b.path,children:b.name}),b.status&&(0,d.jsx)(j,{status:b.status}),m&&void 0!==b.additions&&void 0!==b.deletions&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("span",{className:"text-xs text-green-11",children:["+",b.additions]}),(0,d.jsxs)("span",{className:"text-xs text-red-11",children:["-",b.deletions]})]}),n&&n(b)]})});function l({files:a,selectedPath:b,expandedPaths:c,onSelect:e,onToggle:f,cwd:i,showChanges:j=!1,renderActions:l,emptyMessage:m,className:n}){let{t:o}=(0,g.Bd)(),p=m??o("gitFileTree.noFiles"),{contextMenu:q,showContextMenu:r,hideContextMenu:s}=(0,h.Ee)();return 0===a.length?(0,d.jsx)("div",{className:"px-3 py-2 text-xs text-slate-9",children:p}):(0,d.jsxs)("div",{className:n||"py-1 overflow-y-auto h-full min-w-max",children:[a.map(a=>(0,d.jsx)(k,{node:a,level:0,selectedPath:b,expandedPaths:c,onSelect:e,onToggle:f,onContextMenu:r,showChanges:j,renderActions:l},a.path)),q&&(0,d.jsx)(h.ft,{x:q.x,y:q.y,path:q.path,cwd:i,isDirectory:q.isDirectory,onClose:s})]})}function m(a){let b=[];for(let c of a){let a=c.path.split("/"),d=b;for(let b=0;b<a.length;b++){let e=a[b],f=b===a.length-1,g=a.slice(0,b+1).join("/"),h=d.find(a=>a.name===e);h||(h={name:e,path:g,isDirectory:!f,children:[],...f&&{status:c.status,additions:c.additions,deletions:c.deletions,oldPath:c.oldPath,file:c}},d.push(h)),f||(d=h.children)}}let c=a=>{a.sort((a,b)=>a.isDirectory&&!b.isDirectory?-1:!a.isDirectory&&b.isDirectory?1:a.name.localeCompare(b.name)),a.forEach(a=>c(a.children))};return c(b),b}function n(a){let b=[],c=a=>{for(let d of a)d.isDirectory&&(b.push(d.path),c(d.children))};return c(a),b}function o(a){let b=[],c=a=>{if(a.isDirectory)for(let b of a.children)c(b);else b.push(a)};return c(a),b}},96666:(a,b,c)=>{"use strict";c.d(b,{p:()=>f});var d=c(67484),e=c(41564);function f({cwd:a,onSearchComplete:b}){let[c,f]=(0,d.useState)(""),[g,h]=(0,d.useState)([]),[i,j]=(0,d.useState)(!1),[k,l]=(0,d.useState)(null),[m,n]=(0,d.useState)(new Set),[o,p]=(0,d.useState)({caseSensitive:!1,wholeWord:!1,regex:!1,fileType:""}),[q,r]=(0,d.useState)(null),s=(0,d.useRef)(null),t=(0,d.useCallback)(async c=>{let d=c.trim();if(!d){h([]),r(null);return}if(d.length<2)return void l(e.A.t("fileBrowser.searchMinChars"));j(!0),l(null);try{let d=new URLSearchParams({cwd:a,q:c,caseSensitive:String(o.caseSensitive),wholeWord:String(o.wholeWord),regex:String(o.regex),fileType:o.fileType}),e=await fetch(`/api/files/search?${d}`),f=await e.json();if(f.error)throw Error(f.error);h(f.results),r({totalFiles:f.totalFiles,totalMatches:f.totalMatches,truncated:f.truncated});let g=new Set(f.results.map(a=>a.path));n(g),f.results.length>0&&b?.()}catch(a){l(a instanceof Error?a.message:"Search failed"),h([])}finally{j(!1)}},[a,o,b]);return{contentSearchQuery:c,setContentSearchQuery:f,contentSearchResults:g,isSearching:i,searchError:k,searchExpandedPaths:m,searchOptions:o,setSearchOptions:p,searchStats:q,contentSearchInputRef:s,performContentSearch:t,handleSearchToggle:(0,d.useCallback)(a=>{n(b=>{let c=new Set(b);return c.has(a)?c.delete(a):c.add(a),c})},[])}}},99117:(a,b,c)=>{"use strict";c.d(b,{a:()=>e});var d=c(67484);function e(a){let[b,c]=(0,d.useState)(!1),[e,f]=(0,d.useState)(""),[g,h]=(0,d.useState)([]),[i,j]=(0,d.useState)(0),k=(0,d.useRef)(null),l=(0,d.useRef)([]),m=(0,d.useCallback)(()=>{let b=a.current;b&&(b.querySelectorAll("mark.chat-search-match, mark.chat-search-current").forEach(a=>{let b=a.parentNode;b&&(b.replaceChild(document.createTextNode(a.textContent||""),a),b.normalize())}),l.current=[])},[a]);(0,d.useCallback)(b=>{if(m(),!b||!a.current){h([]),j(0);return}let c=[],d=[],e=b.toLowerCase();a.current.querySelectorAll("[data-message-id]").forEach(a=>{let f,g=a.getAttribute("data-message-id")||"",h=0,i=document.createTreeWalker(a,NodeFilter.SHOW_TEXT,null),j=[];for(;f=i.nextNode();)j.push(f);for(let a of j){let f=(a.textContent||"").toLowerCase(),i=0,j=[];for(;;){let a=f.indexOf(e,i);if(-1===a)break;j.push({start:a,end:a+b.length}),i=a+1}if(0!==j.length)for(let b=j.length-1;b>=0;b--){let e=j[b];a.splitText(e.end);let f=a.splitText(e.start),i=document.createElement("mark");i.className="chat-search-match",i.textContent=f.textContent,f.parentNode.replaceChild(i,f),c.push({messageId:g,markIndex:h}),d.push(i),h++}}}),c.reverse(),d.reverse(),l.current=d,h(c),j(c.length>0?0:-1)},[a,m]);let n=(0,d.useCallback)(()=>{0!==g.length&&j(a=>(a+1)%g.length)},[g.length]),o=(0,d.useCallback)(()=>{0!==g.length&&j(a=>(a-1+g.length)%g.length)},[g.length]),p=(0,d.useCallback)(()=>{c(!0),setTimeout(()=>k.current?.focus(),0)},[]),q=(0,d.useCallback)(()=>{c(!1),f(""),m(),h([]),j(0)},[m]),r=(0,d.useCallback)(a=>{"Enter"===a.key&&(a.preventDefault(),a.shiftKey?o():n()),"Escape"===a.key&&q()},[n,o,q]);return{isSearchVisible:b,searchQuery:e,setSearchQuery:f,matches:g,currentMatchIndex:i,goToNextMatch:n,goToPrevMatch:o,openSearch:p,closeSearch:q,searchInputRef:k,handleSearchKeyDown:r}}},99374:(a,b,c)=>{"use strict";c.d(b,{f:()=>g});var d=c(48249);c(67484);var e=c(44384),f=c(31172);function g({isOpen:a,onClose:b,messages:c,onSelectMessage:g}){let{t:h}=(0,e.Bd)();if(!a)return null;let i=c.filter(a=>"user"===a.role),j=(0,d.jsx)("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50 p-4",onClick:b,children:(0,d.jsxs)("div",{className:"bg-card rounded-lg shadow-xl w-full max-w-lg max-h-[70vh] flex flex-col",onClick:a=>a.stopPropagation(),children:[(0,d.jsxs)("div",{className:"flex items-center justify-between px-4 py-3 border-b border-border shrink-0",children:[(0,d.jsx)("h3",{className:"text-sm font-medium text-foreground",children:h("userMessages.title")}),(0,d.jsx)("button",{onClick:b,className:"p-1 text-muted-foreground hover:text-foreground hover:bg-accent rounded transition-colors",children:(0,d.jsx)("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,d.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),(0,d.jsx)("div",{className:"flex-1 overflow-y-auto",children:0===i.length?(0,d.jsx)("div",{className:"flex items-center justify-center h-32 text-muted-foreground",children:h("userMessages.noMessages")}):(0,d.jsx)("div",{className:"divide-y divide-border",children:i.map((a,c)=>{let e,f,h,i=(e=a.id.match(/^user-(\d+)/))?parseInt(e[1],10):null,j=i?(f=new Date(i),h=new Date,f.toDateString()===h.toDateString()?f.toLocaleTimeString("zh-CN",{hour:"2-digit",minute:"2-digit"}):f.toLocaleDateString("zh-CN",{month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"})):"";return(0,d.jsx)("button",{onClick:()=>{g(a.id),b()},className:"w-full px-4 py-3 text-left hover:bg-accent transition-colors",children:(0,d.jsxs)("div",{className:"flex items-start gap-3",children:[(0,d.jsxs)("span",{className:"text-xs text-muted-foreground font-mono w-6 shrink-0 pt-0.5",children:[c+1,"."]}),(0,d.jsx)("div",{className:"flex-1 min-w-0",children:(0,d.jsx)("p",{className:"text-sm text-foreground break-words",children:function(a,b=50){let c=a.replace(/\s+/g," ").trim();return c.length<=b?c:c.slice(0,b)+"..."}(a.content)})}),j&&(0,d.jsx)("span",{className:"text-xs text-muted-foreground shrink-0 pt-0.5",children:j})]})},a.id)})})})]})});return(0,d.jsx)(f.Z,{children:j})}},99470:(a,b,c)=>{"use strict";c.d(b,{e:()=>g});var d=c(48249),e=c(67484),f=c(44384);function g({branches:a,selectedBranch:b,onSelect:c,isLoading:g}){let{t:h}=(0,f.Bd)(),[i,j]=(0,e.useState)(!1),[k,l]=(0,e.useState)(""),m=(0,e.useRef)(null),n=(0,e.useRef)(null),o=a?.local.filter(a=>a.toLowerCase().includes(k.toLowerCase()))||[],p=a?.remote.filter(a=>a.toLowerCase().includes(k.toLowerCase()))||[],q=a=>{c(a),j(!1),l("")};return(0,d.jsxs)("div",{className:"relative",ref:m,children:[(0,d.jsxs)("button",{onClick:()=>j(!i),disabled:g,className:"w-full px-3 py-1.5 text-sm border border-border rounded bg-card text-foreground text-left flex items-center justify-between hover:border-slate-6 dark:hover:border-slate-6 transition-colors",children:[(0,d.jsxs)("span",{className:"truncate flex items-center gap-2",children:[(0,d.jsx)("svg",{className:"w-4 h-4 text-muted-foreground flex-shrink-0",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,d.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M13 10V3L4 14h7v7l9-11h-7z"})}),b||h("git.selectBranch"),a?.current===b&&(0,d.jsxs)("span",{className:"text-xs text-green-11",children:["(",h("git.currentBranch"),")"]})]}),(0,d.jsx)("svg",{className:`w-4 h-4 text-slate-9 transition-transform ${i?"rotate-180":""}`,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,d.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),i&&(0,d.jsxs)("div",{className:"absolute z-50 mt-1 w-full bg-card border border-border rounded-lg shadow-lg max-h-80 flex flex-col",children:[(0,d.jsx)("div",{className:"p-2 border-b border-border",children:(0,d.jsx)("input",{ref:n,type:"text",value:k,onChange:a=>l(a.target.value),placeholder:h("git.searchBranch"),className:"w-full px-2 py-1 text-sm border border-border rounded bg-secondary text-foreground placeholder-slate-9"})}),(0,d.jsxs)("div",{className:"overflow-y-auto flex-1",children:[o.length>0&&(0,d.jsxs)("div",{children:[(0,d.jsx)("div",{className:"px-3 py-1 text-xs font-medium text-muted-foreground bg-secondary sticky top-0",children:h("git.localBranches")}),o.map(c=>(0,d.jsxs)("div",{onClick:()=>q(c),className:`px-3 py-1.5 text-sm cursor-pointer flex items-center gap-2 ${c===b?"bg-brand/10 text-brand":"hover:bg-accent text-foreground"}`,children:[(0,d.jsx)("span",{className:"truncate flex-1",children:c}),c===a?.current&&(0,d.jsx)("span",{className:"text-xs text-green-11 flex-shrink-0",children:h("git.currentBranch")}),c===b&&(0,d.jsx)("svg",{className:"w-4 h-4 text-brand flex-shrink-0",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,d.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})})]},c))]}),p.length>0&&(0,d.jsxs)("div",{children:[(0,d.jsx)("div",{className:"px-3 py-1 text-xs font-medium text-muted-foreground bg-secondary sticky top-0",children:h("git.remoteBranches")}),p.map(a=>(0,d.jsxs)("div",{onClick:()=>q(a),className:`px-3 py-1.5 text-sm cursor-pointer flex items-center gap-2 ${a===b?"bg-brand/10 text-brand":"hover:bg-accent text-foreground"}`,children:[(0,d.jsx)("span",{className:"truncate flex-1",children:a}),a===b&&(0,d.jsx)("svg",{className:"w-4 h-4 text-brand flex-shrink-0",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,d.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})})]},a))]}),0===o.length&&0===p.length&&(0,d.jsx)("div",{className:"px-3 py-4 text-sm text-muted-foreground text-center",children:h("git.noMatchingBranches")})]})]})]})}},99543:(a,b,c)=>{"use strict";c.d(b,{m:()=>e});var d=c(67484);function e(a,b,c,{cwd:e,initialSessionId:f,onSessionId:g,onTitleChange:h,onTokenUsage:i}){let[j,k]=(0,d.useState)(!1),[l,m]=(0,d.useState)(!1),[n,o]=(0,d.useState)(!1),[p,q]=(0,d.useState)(void 0),[r,s]=(0,d.useState)(0),t=(0,d.useRef)(h);t.current=h;let u=(0,d.useRef)(i);u.current=i;let v=(0,d.useRef)(void 0),w=(0,d.useRef)(0),x=(0,d.useCallback)(async(a,c,d=!1,e,f)=>{if(d){let a=Date.now();if(a-w.current<5e3)return;w.current=a}d||k(!0);try{let h={cwd:a,sessionId:c,limit:e,beforeTurnIndex:f};d&&v.current&&(h.ifFingerprint=v.current);let i=await fetch("/api/session-by-path",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(h)});if(i.ok){let a=await i.json();if(a.notModified)return;a.fingerprint&&(v.current=a.fingerprint),void 0!==a.totalTurns&&s(a.totalTurns),void 0!==a.hasMore&&o(a.hasMore),a.messages&&a.messages.length>0&&(d?b(b=>{let c=a.messages;if(b.length===c.length&&b.length>0&&b[b.length-1].content===c[c.length-1].content)return b;let d=0;for(let a=0;a<Math.min(b.length,c.length)&&b[a].id===c[a].id&&b[a].content===c[a].content;a++)d=a+1;return d===b.length&&d<c.length?[...b,...c.slice(d)]:c}):b(a.messages)),a.sessionId&&g(a.sessionId),a.title&&t.current?.(a.title),a.usage&&u.current?.({inputTokens:a.usage.input_tokens||0,outputTokens:a.usage.output_tokens||0,cacheCreationInputTokens:a.usage.cache_creation_input_tokens||0,cacheReadInputTokens:a.usage.cache_read_input_tokens||0,totalCostUsd:0})}}catch(a){console.error("Failed to load history by cwd and sessionId:",a)}finally{d||k(!1)}},[b,g]),y=(0,d.useCallback)(async()=>{if(e&&c&&!l&&n){m(!0);try{let d=void 0!==p?p:r-Math.ceil(a.filter(a=>"user"===a.role).length),f=await fetch("/api/session-by-path",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({cwd:e,sessionId:c,limit:10,beforeTurnIndex:d>0?d:void 0})});if(f.ok){let a=await f.json();if(a.messages&&a.messages.length>0){b(b=>[...a.messages,...b]);let c=a.messages.filter(a=>"user"===a.role).length;q(d-c)}void 0!==a.hasMore&&o(a.hasMore),a.fingerprint&&(v.current=a.fingerprint)}}catch(a){console.error("Failed to load more history:",a)}finally{m(!1)}}},[e,c,l,n,p,r,a,b]);return{isLoadingHistory:j,isLoadingMore:l,hasMoreHistory:n,loadMoreHistory:y,loadHistory:(0,d.useCallback)(async a=>{k(!0);try{let c=await fetch(`/api/session/${a}/history`);if(c.ok){let a=await c.json();a.messages&&a.messages.length>0&&b(a.messages)}}catch(a){console.error("Failed to load history:",a)}finally{k(!1)}},[b]),loadHistoryByCwdAndSessionId:x}}}};var b=require("../../webpack-runtime.js");b.C(a);var c=b.X(0,[4741,6117,4793,6443,7514,6062,7284],()=>b(b.s=43501));module.exports=c})();