@kaitranntt/ccs 7.66.1 → 7.67.0-dev.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (283) hide show
  1. package/README.md +3 -1
  2. package/dist/ccs.js +68 -35
  3. package/dist/ccs.js.map +1 -1
  4. package/dist/cliproxy/auth/auth-types.d.ts +29 -6
  5. package/dist/cliproxy/auth/auth-types.d.ts.map +1 -1
  6. package/dist/cliproxy/auth/auth-types.js +58 -10
  7. package/dist/cliproxy/auth/auth-types.js.map +1 -1
  8. package/dist/cliproxy/auth/oauth-handler.d.ts +6 -1
  9. package/dist/cliproxy/auth/oauth-handler.d.ts.map +1 -1
  10. package/dist/cliproxy/auth/oauth-handler.js +165 -45
  11. package/dist/cliproxy/auth/oauth-handler.js.map +1 -1
  12. package/dist/cliproxy/auth/oauth-process.d.ts +26 -1
  13. package/dist/cliproxy/auth/oauth-process.d.ts.map +1 -1
  14. package/dist/cliproxy/auth/oauth-process.js +314 -49
  15. package/dist/cliproxy/auth/oauth-process.js.map +1 -1
  16. package/dist/cliproxy/auth/token-manager.d.ts +9 -0
  17. package/dist/cliproxy/auth/token-manager.d.ts.map +1 -1
  18. package/dist/cliproxy/auth/token-manager.js +104 -58
  19. package/dist/cliproxy/auth/token-manager.js.map +1 -1
  20. package/dist/cliproxy/auth-utils.d.ts +2 -1
  21. package/dist/cliproxy/auth-utils.d.ts.map +1 -1
  22. package/dist/cliproxy/auth-utils.js +32 -7
  23. package/dist/cliproxy/auth-utils.js.map +1 -1
  24. package/dist/cliproxy/catalog-cache.d.ts +9 -1
  25. package/dist/cliproxy/catalog-cache.d.ts.map +1 -1
  26. package/dist/cliproxy/catalog-cache.js +115 -29
  27. package/dist/cliproxy/catalog-cache.js.map +1 -1
  28. package/dist/cliproxy/codex-plan-compatibility.d.ts +0 -1
  29. package/dist/cliproxy/codex-plan-compatibility.d.ts.map +1 -1
  30. package/dist/cliproxy/codex-plan-compatibility.js +3 -7
  31. package/dist/cliproxy/codex-plan-compatibility.js.map +1 -1
  32. package/dist/cliproxy/config/generator.d.ts +2 -1
  33. package/dist/cliproxy/config/generator.d.ts.map +1 -1
  34. package/dist/cliproxy/config/generator.js +11 -1
  35. package/dist/cliproxy/config/generator.js.map +1 -1
  36. package/dist/cliproxy/executor/index.d.ts +5 -0
  37. package/dist/cliproxy/executor/index.d.ts.map +1 -1
  38. package/dist/cliproxy/executor/index.js +119 -16
  39. package/dist/cliproxy/executor/index.js.map +1 -1
  40. package/dist/cliproxy/index.d.ts +1 -1
  41. package/dist/cliproxy/index.d.ts.map +1 -1
  42. package/dist/cliproxy/index.js.map +1 -1
  43. package/dist/cliproxy/management-api-client.d.ts +9 -0
  44. package/dist/cliproxy/management-api-client.d.ts.map +1 -1
  45. package/dist/cliproxy/management-api-client.js +14 -0
  46. package/dist/cliproxy/management-api-client.js.map +1 -1
  47. package/dist/cliproxy/proxy-detector.d.ts.map +1 -1
  48. package/dist/cliproxy/proxy-detector.js +6 -2
  49. package/dist/cliproxy/proxy-detector.js.map +1 -1
  50. package/dist/cliproxy/quota-fetcher-gemini-cli.d.ts.map +1 -1
  51. package/dist/cliproxy/quota-fetcher-gemini-cli.js +14 -7
  52. package/dist/cliproxy/quota-fetcher-gemini-cli.js.map +1 -1
  53. package/dist/cliproxy/routing-strategy-http.d.ts +6 -0
  54. package/dist/cliproxy/routing-strategy-http.d.ts.map +1 -0
  55. package/dist/cliproxy/routing-strategy-http.js +115 -0
  56. package/dist/cliproxy/routing-strategy-http.js.map +1 -0
  57. package/dist/cliproxy/routing-strategy.d.ts +18 -0
  58. package/dist/cliproxy/routing-strategy.d.ts.map +1 -0
  59. package/dist/cliproxy/routing-strategy.js +123 -0
  60. package/dist/cliproxy/routing-strategy.js.map +1 -0
  61. package/dist/cliproxy/services/variant-settings.d.ts.map +1 -1
  62. package/dist/cliproxy/services/variant-settings.js +43 -30
  63. package/dist/cliproxy/services/variant-settings.js.map +1 -1
  64. package/dist/cliproxy/startup-lock.d.ts.map +1 -1
  65. package/dist/cliproxy/startup-lock.js +5 -1
  66. package/dist/cliproxy/startup-lock.js.map +1 -1
  67. package/dist/cliproxy/tool-sanitization-proxy.d.ts +1 -0
  68. package/dist/cliproxy/tool-sanitization-proxy.d.ts.map +1 -1
  69. package/dist/cliproxy/tool-sanitization-proxy.js +6 -0
  70. package/dist/cliproxy/tool-sanitization-proxy.js.map +1 -1
  71. package/dist/cliproxy/types.d.ts +7 -0
  72. package/dist/cliproxy/types.d.ts.map +1 -1
  73. package/dist/cliproxy/types.js.map +1 -1
  74. package/dist/commands/cleanup-command.d.ts +1 -1
  75. package/dist/commands/cleanup-command.d.ts.map +1 -1
  76. package/dist/commands/cleanup-command.js +57 -34
  77. package/dist/commands/cleanup-command.js.map +1 -1
  78. package/dist/commands/cliproxy/catalog-subcommand.d.ts.map +1 -1
  79. package/dist/commands/cliproxy/catalog-subcommand.js +12 -38
  80. package/dist/commands/cliproxy/catalog-subcommand.js.map +1 -1
  81. package/dist/commands/cliproxy/help-subcommand.d.ts.map +1 -1
  82. package/dist/commands/cliproxy/help-subcommand.js +3 -0
  83. package/dist/commands/cliproxy/help-subcommand.js.map +1 -1
  84. package/dist/commands/cliproxy/index.d.ts.map +1 -1
  85. package/dist/commands/cliproxy/index.js +14 -0
  86. package/dist/commands/cliproxy/index.js.map +1 -1
  87. package/dist/commands/cliproxy/routing-subcommand.d.ts +4 -0
  88. package/dist/commands/cliproxy/routing-subcommand.d.ts.map +1 -0
  89. package/dist/commands/cliproxy/routing-subcommand.js +68 -0
  90. package/dist/commands/cliproxy/routing-subcommand.js.map +1 -0
  91. package/dist/commands/command-catalog.d.ts +2 -2
  92. package/dist/commands/command-catalog.d.ts.map +1 -1
  93. package/dist/commands/command-catalog.js +3 -1
  94. package/dist/commands/command-catalog.js.map +1 -1
  95. package/dist/commands/completion-backend.d.ts.map +1 -1
  96. package/dist/commands/completion-backend.js +15 -1
  97. package/dist/commands/completion-backend.js.map +1 -1
  98. package/dist/commands/config-command.d.ts.map +1 -1
  99. package/dist/commands/config-command.js +23 -0
  100. package/dist/commands/config-command.js.map +1 -1
  101. package/dist/commands/docker/up-subcommand.js +1 -1
  102. package/dist/commands/docker/up-subcommand.js.map +1 -1
  103. package/dist/commands/help-command.d.ts.map +1 -1
  104. package/dist/commands/help-command.js +62 -1
  105. package/dist/commands/help-command.js.map +1 -1
  106. package/dist/config/unified-config-loader.d.ts +2 -1
  107. package/dist/config/unified-config-loader.d.ts.map +1 -1
  108. package/dist/config/unified-config-loader.js +37 -1
  109. package/dist/config/unified-config-loader.js.map +1 -1
  110. package/dist/config/unified-config-types.d.ts +29 -1
  111. package/dist/config/unified-config-types.d.ts.map +1 -1
  112. package/dist/config/unified-config-types.js +13 -1
  113. package/dist/config/unified-config-types.js.map +1 -1
  114. package/dist/copilot/copilot-executor.d.ts.map +1 -1
  115. package/dist/copilot/copilot-executor.js +5 -8
  116. package/dist/copilot/copilot-executor.js.map +1 -1
  117. package/dist/delegation/headless-executor.d.ts.map +1 -1
  118. package/dist/delegation/headless-executor.js +19 -16
  119. package/dist/delegation/headless-executor.js.map +1 -1
  120. package/dist/errors/error-handler.d.ts.map +1 -1
  121. package/dist/errors/error-handler.js +13 -0
  122. package/dist/errors/error-handler.js.map +1 -1
  123. package/dist/glmt/glmt-transformer.d.ts +1 -0
  124. package/dist/glmt/glmt-transformer.d.ts.map +1 -1
  125. package/dist/glmt/glmt-transformer.js +9 -0
  126. package/dist/glmt/glmt-transformer.js.map +1 -1
  127. package/dist/management/checks/image-analysis-check.d.ts.map +1 -1
  128. package/dist/management/checks/image-analysis-check.js +19 -1
  129. package/dist/management/checks/image-analysis-check.js.map +1 -1
  130. package/dist/management/recovery-manager.d.ts +6 -0
  131. package/dist/management/recovery-manager.d.ts.map +1 -1
  132. package/dist/management/recovery-manager.js +72 -2
  133. package/dist/management/recovery-manager.js.map +1 -1
  134. package/dist/services/logging/index.d.ts +7 -0
  135. package/dist/services/logging/index.d.ts.map +1 -0
  136. package/dist/services/logging/index.js +22 -0
  137. package/dist/services/logging/index.js.map +1 -0
  138. package/dist/services/logging/log-buffer.d.ts +5 -0
  139. package/dist/services/logging/log-buffer.d.ts.map +1 -0
  140. package/dist/services/logging/log-buffer.js +20 -0
  141. package/dist/services/logging/log-buffer.js.map +1 -0
  142. package/dist/services/logging/log-config.d.ts +4 -0
  143. package/dist/services/logging/log-config.d.ts.map +1 -0
  144. package/dist/services/logging/log-config.js +68 -0
  145. package/dist/services/logging/log-config.js.map +1 -0
  146. package/dist/services/logging/log-paths.d.ts +8 -0
  147. package/dist/services/logging/log-paths.d.ts.map +1 -0
  148. package/dist/services/logging/log-paths.js +66 -0
  149. package/dist/services/logging/log-paths.js.map +1 -0
  150. package/dist/services/logging/log-reader.d.ts +5 -0
  151. package/dist/services/logging/log-reader.d.ts.map +1 -0
  152. package/dist/services/logging/log-reader.js +124 -0
  153. package/dist/services/logging/log-reader.js.map +1 -0
  154. package/dist/services/logging/log-redaction.d.ts +2 -0
  155. package/dist/services/logging/log-redaction.d.ts.map +1 -0
  156. package/dist/services/logging/log-redaction.js +53 -0
  157. package/dist/services/logging/log-redaction.js.map +1 -0
  158. package/dist/services/logging/log-storage.d.ts +4 -0
  159. package/dist/services/logging/log-storage.d.ts.map +1 -0
  160. package/dist/services/logging/log-storage.js +109 -0
  161. package/dist/services/logging/log-storage.js.map +1 -0
  162. package/dist/services/logging/log-types.d.ts +30 -0
  163. package/dist/services/logging/log-types.d.ts.map +1 -0
  164. package/dist/services/logging/log-types.js +19 -0
  165. package/dist/services/logging/log-types.js.map +1 -0
  166. package/dist/services/logging/logger.d.ts +9 -0
  167. package/dist/services/logging/logger.d.ts.map +1 -0
  168. package/dist/services/logging/logger.js +46 -0
  169. package/dist/services/logging/logger.js.map +1 -0
  170. package/dist/ui/assets/{accounts-BjfPKR8m.js → accounts-cuFTYYRt.js} +1 -1
  171. package/dist/ui/assets/{alert-dialog-Dh2NUFdm.js → alert-dialog-SgZxEXpw.js} +1 -1
  172. package/dist/ui/assets/{api-C-3mQCFf.js → api-DQs1Ldow.js} +2 -2
  173. package/dist/ui/assets/{auth-section-Dp10_YyD.js → auth-section-C4y85pIC.js} +1 -1
  174. package/dist/ui/assets/{backups-section-C0jF8MP1.js → backups-section-BERNcZpv.js} +1 -1
  175. package/dist/ui/assets/{channels-CkXuK5i7.js → channels-DBLp0DUg.js} +1 -1
  176. package/dist/ui/assets/{checkbox-tA5FH8Ol.js → checkbox-B-cTEUE0.js} +1 -1
  177. package/dist/ui/assets/{claude-extension-Bg2ZkzMz.js → claude-extension-CiqXZCUX.js} +1 -1
  178. package/dist/ui/assets/cliproxy-DlQkkQVp.js +3 -0
  179. package/dist/ui/assets/{cliproxy-ai-providers-DBSXTTyw.js → cliproxy-ai-providers-wBfCEEze.js} +6 -6
  180. package/dist/ui/assets/{cliproxy-control-panel-Da-sGGyI.js → cliproxy-control-panel-Dg15tkqi.js} +1 -1
  181. package/dist/ui/assets/{codex-ooWKOPa2.js → codex-CbEo9E_j.js} +3 -3
  182. package/dist/ui/assets/{confirm-dialog-CKjwhn9j.js → confirm-dialog-DJpEIfS_.js} +1 -1
  183. package/dist/ui/assets/{copilot-GA7EPiK1.js → copilot-B8fIS-vF.js} +2 -2
  184. package/dist/ui/assets/{cursor-B6c8CyHG.js → cursor-DCN2ypJD.js} +1 -1
  185. package/dist/ui/assets/{droid-CPRHOIX2.js → droid-CKRz_GOK.js} +2 -2
  186. package/dist/ui/assets/{globalenv-section-Czgnw_GV.js → globalenv-section-CZCiD-lk.js} +1 -1
  187. package/dist/ui/assets/{health-CXLOMk8n.js → health-CDd5on8I.js} +1 -1
  188. package/dist/ui/assets/icons-C4EMu2PL.js +1 -0
  189. package/dist/ui/assets/index-2X6A__Ih.css +1 -0
  190. package/dist/ui/assets/{index-BceMcbCR.js → index-8IL3kgiJ.js} +1 -1
  191. package/dist/ui/assets/{index-CvfzKRSH.js → index-BGqBqww_.js} +1 -1
  192. package/dist/ui/assets/index-CUOLpSIB.js +69 -0
  193. package/dist/ui/assets/{index-Boa5e-GY.js → index-CoUGuS5J.js} +1 -1
  194. package/dist/ui/assets/{index-D2v_-6AW.js → index-Ywy20w8T.js} +1 -1
  195. package/dist/ui/assets/index-kTxwXQ5y.js +1 -0
  196. package/dist/ui/assets/logs-ecr4mQMK.js +1 -0
  197. package/dist/ui/assets/{masked-input-B1_asiUI.js → masked-input-bSAouyU5.js} +1 -1
  198. package/dist/ui/assets/proxy-status-widget-BVdcjMn7.js +1 -0
  199. package/dist/ui/assets/{raw-json-settings-editor-panel-DMbTkxWw.js → raw-json-settings-editor-panel-CJnuNmCM.js} +1 -1
  200. package/dist/ui/assets/searchable-select-DvFzk1D1.js +1 -0
  201. package/dist/ui/assets/{separator-CdaalG0K.js → separator-DgeSGH_l.js} +1 -1
  202. package/dist/ui/assets/{shared-BiFB-et0.js → shared-D5HUP-Vv.js} +1 -1
  203. package/dist/ui/assets/{table-BPwgFXLQ.js → table-8dkohJBd.js} +1 -1
  204. package/dist/ui/assets/{tanstack-DWm6aJ-G.js → tanstack-CrmUhA7Z.js} +2 -2
  205. package/dist/ui/assets/updates-8zMjNZyg.js +1 -0
  206. package/dist/ui/index.html +4 -4
  207. package/dist/utils/hooks/image-analyzer-hook-utils.d.ts +21 -0
  208. package/dist/utils/hooks/image-analyzer-hook-utils.d.ts.map +1 -0
  209. package/dist/utils/hooks/image-analyzer-hook-utils.js +81 -0
  210. package/dist/utils/hooks/image-analyzer-hook-utils.js.map +1 -0
  211. package/dist/utils/hooks/image-analyzer-profile-hook-injector.d.ts +1 -0
  212. package/dist/utils/hooks/image-analyzer-profile-hook-injector.d.ts.map +1 -1
  213. package/dist/utils/hooks/image-analyzer-profile-hook-injector.js +33 -12
  214. package/dist/utils/hooks/image-analyzer-profile-hook-injector.js.map +1 -1
  215. package/dist/utils/hooks/index.d.ts +1 -0
  216. package/dist/utils/hooks/index.d.ts.map +1 -1
  217. package/dist/utils/hooks/index.js +3 -1
  218. package/dist/utils/hooks/index.js.map +1 -1
  219. package/dist/utils/image-analysis/index.d.ts +1 -0
  220. package/dist/utils/image-analysis/index.d.ts.map +1 -1
  221. package/dist/utils/image-analysis/index.js +6 -1
  222. package/dist/utils/image-analysis/index.js.map +1 -1
  223. package/dist/utils/image-analysis/repair.d.ts +12 -0
  224. package/dist/utils/image-analysis/repair.d.ts.map +1 -0
  225. package/dist/utils/image-analysis/repair.js +105 -0
  226. package/dist/utils/image-analysis/repair.js.map +1 -0
  227. package/dist/utils/websearch/trace.d.ts.map +1 -1
  228. package/dist/utils/websearch/trace.js +7 -0
  229. package/dist/utils/websearch/trace.js.map +1 -1
  230. package/dist/web-server/index.d.ts.map +1 -1
  231. package/dist/web-server/index.js +15 -0
  232. package/dist/web-server/index.js.map +1 -1
  233. package/dist/web-server/middleware/request-logging-middleware.d.ts +3 -0
  234. package/dist/web-server/middleware/request-logging-middleware.d.ts.map +1 -0
  235. package/dist/web-server/middleware/request-logging-middleware.js +30 -0
  236. package/dist/web-server/middleware/request-logging-middleware.js.map +1 -0
  237. package/dist/web-server/routes/auth-routes.d.ts +10 -0
  238. package/dist/web-server/routes/auth-routes.d.ts.map +1 -1
  239. package/dist/web-server/routes/auth-routes.js +33 -6
  240. package/dist/web-server/routes/auth-routes.js.map +1 -1
  241. package/dist/web-server/routes/catalog-routes.js +7 -7
  242. package/dist/web-server/routes/catalog-routes.js.map +1 -1
  243. package/dist/web-server/routes/cliproxy-auth-routes.d.ts +8 -0
  244. package/dist/web-server/routes/cliproxy-auth-routes.d.ts.map +1 -1
  245. package/dist/web-server/routes/cliproxy-auth-routes.js +63 -74
  246. package/dist/web-server/routes/cliproxy-auth-routes.js.map +1 -1
  247. package/dist/web-server/routes/cliproxy-routing-routes.d.ts +3 -0
  248. package/dist/web-server/routes/cliproxy-routing-routes.d.ts.map +1 -0
  249. package/dist/web-server/routes/cliproxy-routing-routes.js +34 -0
  250. package/dist/web-server/routes/cliproxy-routing-routes.js.map +1 -0
  251. package/dist/web-server/routes/image-analysis-routes.d.ts.map +1 -1
  252. package/dist/web-server/routes/image-analysis-routes.js +1 -10
  253. package/dist/web-server/routes/image-analysis-routes.js.map +1 -1
  254. package/dist/web-server/routes/index.d.ts.map +1 -1
  255. package/dist/web-server/routes/index.js +22 -0
  256. package/dist/web-server/routes/index.js.map +1 -1
  257. package/dist/web-server/routes/logs-routes.d.ts +3 -0
  258. package/dist/web-server/routes/logs-routes.d.ts.map +1 -0
  259. package/dist/web-server/routes/logs-routes.js +75 -0
  260. package/dist/web-server/routes/logs-routes.js.map +1 -0
  261. package/dist/web-server/routes/settings-routes.d.ts.map +1 -1
  262. package/dist/web-server/routes/settings-routes.js +2 -0
  263. package/dist/web-server/routes/settings-routes.js.map +1 -1
  264. package/dist/web-server/services/logs-dashboard-service.d.ts +7 -0
  265. package/dist/web-server/services/logs-dashboard-service.d.ts.map +1 -0
  266. package/dist/web-server/services/logs-dashboard-service.js +33 -0
  267. package/dist/web-server/services/logs-dashboard-service.js.map +1 -0
  268. package/dist/web-server/usage/routes.d.ts.map +1 -1
  269. package/dist/web-server/usage/routes.js +11 -0
  270. package/dist/web-server/usage/routes.js.map +1 -1
  271. package/dist/web-server/websocket.d.ts.map +1 -1
  272. package/dist/web-server/websocket.js +23 -14
  273. package/dist/web-server/websocket.js.map +1 -1
  274. package/lib/hooks/image-analyzer-transformer.cjs +5 -0
  275. package/package.json +1 -1
  276. package/dist/ui/assets/cliproxy-1qRVSbVC.js +0 -3
  277. package/dist/ui/assets/icons-B9oTjo-t.js +0 -1
  278. package/dist/ui/assets/index-BMHPMj0j.js +0 -69
  279. package/dist/ui/assets/index-CknHGRYp.css +0 -1
  280. package/dist/ui/assets/index-v-DY6Zby.js +0 -1
  281. package/dist/ui/assets/proxy-status-widget-Ci1JpStj.js +0 -1
  282. package/dist/ui/assets/searchable-select-HbP2PXl3.js +0 -1
  283. package/dist/ui/assets/updates-l8Co9uve.js +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"log-redaction.js","sourceRoot":"","sources":["../../../src/services/logging/log-redaction.ts"],"names":[],"mappings":";;;AAAA,MAAM,qBAAqB,GACzB,yGAAyG,CAAC;AAC5G,MAAM,iBAAiB,GAAG,IAAI,CAAC;AAC/B,MAAM,SAAS,GAAG,CAAC,CAAC;AAEpB,SAAS,cAAc,CAAC,KAAa;IACnC,IAAI,KAAK,CAAC,MAAM,IAAI,iBAAiB,EAAE,CAAC;QACtC,OAAO,KAAK,CAAC;IACf,CAAC;IACD,OAAO,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,iBAAiB,CAAC,gBAAgB,CAAC;AAC9D,CAAC;AAED,SAAS,aAAa,CAAC,KAAc,EAAE,KAAa;IAClD,IAAI,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;QAC1C,OAAO,KAAK,CAAC;IACf,CAAC;IAED,IAAI,KAAK,IAAI,SAAS,EAAE,CAAC;QACvB,OAAO,aAAa,CAAC;IACvB,CAAC;IAED,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QAC9B,OAAO,cAAc,CAAC,KAAK,CAAC,CAAC;IAC/B,CAAC;IAED,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,OAAO,KAAK,KAAK,SAAS,EAAE,CAAC;QAC5D,OAAO,KAAK,CAAC;IACf,CAAC;IAED,IAAI,KAAK,YAAY,KAAK,EAAE,CAAC;QAC3B,OAAO;YACL,IAAI,EAAE,KAAK,CAAC,IAAI;YAChB,OAAO,EAAE,cAAc,CAAC,KAAK,CAAC,OAAO,CAAC;SACvC,CAAC;IACJ,CAAC;IAED,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;QACzB,OAAO,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,aAAa,CAAC,IAAI,EAAE,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC;IAC7D,CAAC;IAED,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QAC9B,MAAM,SAAS,GAA4B,EAAE,CAAC;QAC9C,KAAK,MAAM,CAAC,GAAG,EAAE,WAAW,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,KAAgC,CAAC,EAAE,CAAC;YAClF,SAAS,CAAC,GAAG,CAAC,GAAG,qBAAqB,CAAC,IAAI,CAAC,GAAG,CAAC;gBAC9C,CAAC,CAAC,YAAY;gBACd,CAAC,CAAC,aAAa,CAAC,WAAW,EAAE,KAAK,GAAG,CAAC,CAAC,CAAC;QAC5C,CAAC;QACD,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,OAAO,MAAM,CAAC,KAAK,CAAC,CAAC;AACvB,CAAC;AAED,SAAgB,aAAa,CAC3B,OAA4C;IAE5C,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,OAAO,aAAa,CAAC,OAAO,EAAE,CAAC,CAA4B,CAAC;AAC9D,CAAC;AARD,sCAQC"}
@@ -0,0 +1,4 @@
1
+ import { type LogEntry } from './log-types';
2
+ export declare function pruneExpiredLogArchives(): void;
3
+ export declare function appendStructuredLogEntry(entry: LogEntry): void;
4
+ //# sourceMappingURL=log-storage.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"log-storage.d.ts","sourceRoot":"","sources":["../../../src/services/logging/log-storage.ts"],"names":[],"mappings":"AAWA,OAAO,EAAuB,KAAK,QAAQ,EAAE,MAAM,aAAa,CAAC;AAqCjE,wBAAgB,uBAAuB,IAAI,IAAI,CAsB9C;AAED,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,QAAQ,GAAG,IAAI,CAqB9D"}
@@ -0,0 +1,109 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ Object.defineProperty(exports, "__esModule", { value: true });
26
+ exports.appendStructuredLogEntry = exports.pruneExpiredLogArchives = void 0;
27
+ const fs = __importStar(require("fs"));
28
+ const path = __importStar(require("path"));
29
+ const zlib = __importStar(require("zlib"));
30
+ const log_config_1 = require("./log-config");
31
+ const log_paths_1 = require("./log-paths");
32
+ const log_buffer_1 = require("./log-buffer");
33
+ const log_types_1 = require("./log-types");
34
+ const ONE_DAY_MS = 24 * 60 * 60 * 1000;
35
+ const PRUNE_INTERVAL_MS = 60 * 1000;
36
+ let lastPruneAt = 0;
37
+ function getRotateBytes(rotateMb) {
38
+ return Math.max(1, rotateMb) * 1024 * 1024;
39
+ }
40
+ function rotateCurrentLogIfNeeded() {
41
+ const config = (0, log_config_1.getResolvedLoggingConfig)();
42
+ const currentLogPath = (0, log_paths_1.getCurrentLogPath)();
43
+ if (!fs.existsSync(currentLogPath)) {
44
+ return;
45
+ }
46
+ const stats = fs.statSync(currentLogPath);
47
+ const ageMs = Date.now() - stats.mtimeMs;
48
+ const exceedsSize = stats.size >= getRotateBytes(config.rotate_mb);
49
+ const exceedsAge = ageMs >= ONE_DAY_MS;
50
+ if (!exceedsSize && !exceedsAge) {
51
+ return;
52
+ }
53
+ const currentContent = fs.readFileSync(currentLogPath, 'utf8');
54
+ if (!currentContent.trim()) {
55
+ fs.truncateSync(currentLogPath, 0);
56
+ return;
57
+ }
58
+ const archivePath = (0, log_paths_1.buildArchiveLogPath)(new Date(stats.mtimeMs || Date.now()));
59
+ fs.writeFileSync(archivePath, zlib.gzipSync(currentContent), { mode: 0o600 });
60
+ fs.truncateSync(currentLogPath, 0);
61
+ }
62
+ function pruneExpiredLogArchives() {
63
+ const config = (0, log_config_1.getResolvedLoggingConfig)();
64
+ const archiveDir = (0, log_paths_1.getLogArchiveDir)();
65
+ if (!fs.existsSync(archiveDir)) {
66
+ return;
67
+ }
68
+ const cutoffMs = Date.now() - config.retain_days * ONE_DAY_MS;
69
+ for (const entry of fs.readdirSync(archiveDir)) {
70
+ const archivePath = path.join(archiveDir, entry);
71
+ try {
72
+ const stats = fs.lstatSync(archivePath);
73
+ if (!stats.isFile() || stats.isSymbolicLink()) {
74
+ continue;
75
+ }
76
+ if (stats.mtimeMs < cutoffMs) {
77
+ fs.unlinkSync(archivePath);
78
+ }
79
+ }
80
+ catch {
81
+ continue;
82
+ }
83
+ }
84
+ }
85
+ exports.pruneExpiredLogArchives = pruneExpiredLogArchives;
86
+ function appendStructuredLogEntry(entry) {
87
+ const config = (0, log_config_1.getResolvedLoggingConfig)();
88
+ if (!config.enabled || !(0, log_types_1.shouldWriteLogLevel)(entry.level, config.level)) {
89
+ return;
90
+ }
91
+ try {
92
+ (0, log_paths_1.ensureLoggingDirectories)();
93
+ rotateCurrentLogIfNeeded();
94
+ fs.appendFileSync((0, log_paths_1.getCurrentLogPath)(), `${JSON.stringify(entry)}\n`, {
95
+ encoding: 'utf8',
96
+ mode: 0o600,
97
+ });
98
+ (0, log_buffer_1.pushRecentLogEntry)(entry, config.live_buffer_size);
99
+ if (Date.now() - lastPruneAt >= PRUNE_INTERVAL_MS) {
100
+ pruneExpiredLogArchives();
101
+ lastPruneAt = Date.now();
102
+ }
103
+ }
104
+ catch {
105
+ // Logging must never break runtime behavior.
106
+ }
107
+ }
108
+ exports.appendStructuredLogEntry = appendStructuredLogEntry;
109
+ //# sourceMappingURL=log-storage.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"log-storage.js","sourceRoot":"","sources":["../../../src/services/logging/log-storage.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,uCAAyB;AACzB,2CAA6B;AAC7B,2CAA6B;AAC7B,6CAAwD;AACxD,2CAKqB;AACrB,6CAAkD;AAClD,2CAAiE;AAEjE,MAAM,UAAU,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;AACvC,MAAM,iBAAiB,GAAG,EAAE,GAAG,IAAI,CAAC;AACpC,IAAI,WAAW,GAAG,CAAC,CAAC;AAEpB,SAAS,cAAc,CAAC,QAAgB;IACtC,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,QAAQ,CAAC,GAAG,IAAI,GAAG,IAAI,CAAC;AAC7C,CAAC;AAED,SAAS,wBAAwB;IAC/B,MAAM,MAAM,GAAG,IAAA,qCAAwB,GAAE,CAAC;IAC1C,MAAM,cAAc,GAAG,IAAA,6BAAiB,GAAE,CAAC;IAE3C,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,cAAc,CAAC,EAAE,CAAC;QACnC,OAAO;IACT,CAAC;IAED,MAAM,KAAK,GAAG,EAAE,CAAC,QAAQ,CAAC,cAAc,CAAC,CAAC;IAC1C,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,EAAE,GAAG,KAAK,CAAC,OAAO,CAAC;IACzC,MAAM,WAAW,GAAG,KAAK,CAAC,IAAI,IAAI,cAAc,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;IACnE,MAAM,UAAU,GAAG,KAAK,IAAI,UAAU,CAAC;IACvC,IAAI,CAAC,WAAW,IAAI,CAAC,UAAU,EAAE,CAAC;QAChC,OAAO;IACT,CAAC;IAED,MAAM,cAAc,GAAG,EAAE,CAAC,YAAY,CAAC,cAAc,EAAE,MAAM,CAAC,CAAC;IAC/D,IAAI,CAAC,cAAc,CAAC,IAAI,EAAE,EAAE,CAAC;QAC3B,EAAE,CAAC,YAAY,CAAC,cAAc,EAAE,CAAC,CAAC,CAAC;QACnC,OAAO;IACT,CAAC;IAED,MAAM,WAAW,GAAG,IAAA,+BAAmB,EAAC,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,IAAI,IAAI,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC;IAC/E,EAAE,CAAC,aAAa,CAAC,WAAW,EAAE,IAAI,CAAC,QAAQ,CAAC,cAAc,CAAC,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC;IAC9E,EAAE,CAAC,YAAY,CAAC,cAAc,EAAE,CAAC,CAAC,CAAC;AACrC,CAAC;AAED,SAAgB,uBAAuB;IACrC,MAAM,MAAM,GAAG,IAAA,qCAAwB,GAAE,CAAC;IAC1C,MAAM,UAAU,GAAG,IAAA,4BAAgB,GAAE,CAAC;IACtC,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,UAAU,CAAC,EAAE,CAAC;QAC/B,OAAO;IACT,CAAC;IAED,MAAM,QAAQ,GAAG,IAAI,CAAC,GAAG,EAAE,GAAG,MAAM,CAAC,WAAW,GAAG,UAAU,CAAC;IAC9D,KAAK,MAAM,KAAK,IAAI,EAAE,CAAC,WAAW,CAAC,UAAU,CAAC,EAAE,CAAC;QAC/C,MAAM,WAAW,GAAG,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,KAAK,CAAC,CAAC;QACjD,IAAI,CAAC;YACH,MAAM,KAAK,GAAG,EAAE,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC;YACxC,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE,IAAI,KAAK,CAAC,cAAc,EAAE,EAAE,CAAC;gBAC9C,SAAS;YACX,CAAC;YACD,IAAI,KAAK,CAAC,OAAO,GAAG,QAAQ,EAAE,CAAC;gBAC7B,EAAE,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC;YAC7B,CAAC;QACH,CAAC;QAAC,MAAM,CAAC;YACP,SAAS;QACX,CAAC;IACH,CAAC;AACH,CAAC;AAtBD,0DAsBC;AAED,SAAgB,wBAAwB,CAAC,KAAe;IACtD,MAAM,MAAM,GAAG,IAAA,qCAAwB,GAAE,CAAC;IAC1C,IAAI,CAAC,MAAM,CAAC,OAAO,IAAI,CAAC,IAAA,+BAAmB,EAAC,KAAK,CAAC,KAAK,EAAE,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC;QACvE,OAAO;IACT,CAAC;IAED,IAAI,CAAC;QACH,IAAA,oCAAwB,GAAE,CAAC;QAC3B,wBAAwB,EAAE,CAAC;QAC3B,EAAE,CAAC,cAAc,CAAC,IAAA,6BAAiB,GAAE,EAAE,GAAG,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,IAAI,EAAE;YACnE,QAAQ,EAAE,MAAM;YAChB,IAAI,EAAE,KAAK;SACZ,CAAC,CAAC;QACH,IAAA,+BAAkB,EAAC,KAAK,EAAE,MAAM,CAAC,gBAAgB,CAAC,CAAC;QACnD,IAAI,IAAI,CAAC,GAAG,EAAE,GAAG,WAAW,IAAI,iBAAiB,EAAE,CAAC;YAClD,uBAAuB,EAAE,CAAC;YAC1B,WAAW,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;QAC3B,CAAC;IACH,CAAC;IAAC,MAAM,CAAC;QACP,6CAA6C;IAC/C,CAAC;AACH,CAAC;AArBD,4DAqBC"}
@@ -0,0 +1,30 @@
1
+ import type { LoggingConfig, LoggingLevel } from '../../config/unified-config-types';
2
+ export type { LoggingConfig, LoggingLevel };
3
+ export interface LogEntry {
4
+ id: string;
5
+ timestamp: string;
6
+ level: LoggingLevel;
7
+ source: string;
8
+ event: string;
9
+ message: string;
10
+ processId: number;
11
+ runId: string;
12
+ context?: Record<string, unknown>;
13
+ }
14
+ export interface LogSourceSummary {
15
+ source: string;
16
+ label: string;
17
+ kind: 'native' | 'legacy';
18
+ count: number;
19
+ lastTimestamp: string | null;
20
+ }
21
+ export interface ReadLogEntriesOptions {
22
+ source?: string;
23
+ level?: LoggingLevel;
24
+ search?: string;
25
+ limit?: number;
26
+ }
27
+ export declare const LOG_LEVELS: readonly LoggingLevel[];
28
+ export declare function shouldWriteLogLevel(level: LoggingLevel, configuredLevel: LoggingLevel): boolean;
29
+ export declare function isLoggingLevel(value: string | undefined): value is LoggingLevel;
30
+ //# sourceMappingURL=log-types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"log-types.d.ts","sourceRoot":"","sources":["../../../src/services/logging/log-types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,mCAAmC,CAAC;AAErF,YAAY,EAAE,aAAa,EAAE,YAAY,EAAE,CAAC;AAE5C,MAAM,WAAW,QAAQ;IACvB,EAAE,EAAE,MAAM,CAAC;IACX,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,YAAY,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACnC;AAED,MAAM,WAAW,gBAAgB;IAC/B,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,QAAQ,GAAG,QAAQ,CAAC;IAC1B,KAAK,EAAE,MAAM,CAAC;IACd,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;CAC9B;AAED,MAAM,WAAW,qBAAqB;IACpC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,YAAY,CAAC;IACrB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,eAAO,MAAM,UAAU,EAAE,SAAS,YAAY,EAAuC,CAAC;AAStF,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,YAAY,EAAE,eAAe,EAAE,YAAY,GAAG,OAAO,CAE/F;AAED,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,GAAG,KAAK,IAAI,YAAY,CAE/E"}
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isLoggingLevel = exports.shouldWriteLogLevel = exports.LOG_LEVELS = void 0;
4
+ exports.LOG_LEVELS = ['error', 'warn', 'info', 'debug'];
5
+ const LOG_LEVEL_PRIORITY = {
6
+ error: 0,
7
+ warn: 1,
8
+ info: 2,
9
+ debug: 3,
10
+ };
11
+ function shouldWriteLogLevel(level, configuredLevel) {
12
+ return LOG_LEVEL_PRIORITY[level] <= LOG_LEVEL_PRIORITY[configuredLevel];
13
+ }
14
+ exports.shouldWriteLogLevel = shouldWriteLogLevel;
15
+ function isLoggingLevel(value) {
16
+ return typeof value === 'string' && exports.LOG_LEVELS.includes(value);
17
+ }
18
+ exports.isLoggingLevel = isLoggingLevel;
19
+ //# sourceMappingURL=log-types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"log-types.js","sourceRoot":"","sources":["../../../src/services/logging/log-types.ts"],"names":[],"mappings":";;;AA+Ba,QAAA,UAAU,GAA4B,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;AAEtF,MAAM,kBAAkB,GAAiC;IACvD,KAAK,EAAE,CAAC;IACR,IAAI,EAAE,CAAC;IACP,IAAI,EAAE,CAAC;IACP,KAAK,EAAE,CAAC;CACT,CAAC;AAEF,SAAgB,mBAAmB,CAAC,KAAmB,EAAE,eAA6B;IACpF,OAAO,kBAAkB,CAAC,KAAK,CAAC,IAAI,kBAAkB,CAAC,eAAe,CAAC,CAAC;AAC1E,CAAC;AAFD,kDAEC;AAED,SAAgB,cAAc,CAAC,KAAyB;IACtD,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,kBAAU,CAAC,QAAQ,CAAC,KAAqB,CAAC,CAAC;AACjF,CAAC;AAFD,wCAEC"}
@@ -0,0 +1,9 @@
1
+ export interface Logger {
2
+ child(context: Record<string, unknown>): Logger;
3
+ debug(event: string, message: string, context?: Record<string, unknown>): void;
4
+ info(event: string, message: string, context?: Record<string, unknown>): void;
5
+ warn(event: string, message: string, context?: Record<string, unknown>): void;
6
+ error(event: string, message: string, context?: Record<string, unknown>): void;
7
+ }
8
+ export declare function createLogger(source: string, baseContext?: Record<string, unknown>): Logger;
9
+ //# sourceMappingURL=logger.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../../src/services/logging/logger.ts"],"names":[],"mappings":"AA6BA,MAAM,WAAW,MAAM;IACrB,KAAK,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC;IAChD,KAAK,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;IAC/E,IAAI,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;IAC9E,IAAI,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;IAC9E,KAAK,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;CAChF;AAED,wBAAgB,YAAY,CAAC,MAAM,EAAE,MAAM,EAAE,WAAW,GAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAM,GAAG,MAAM,CA6B9F"}
@@ -0,0 +1,46 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createLogger = void 0;
4
+ const crypto_1 = require("crypto");
5
+ const log_config_1 = require("./log-config");
6
+ const log_redaction_1 = require("./log-redaction");
7
+ const log_storage_1 = require("./log-storage");
8
+ const processRunId = `${Date.now()}-${process.pid}-${Math.random().toString(36).slice(2, 10)}`;
9
+ function createEntry(source, level, event, message, context) {
10
+ const config = (0, log_config_1.getResolvedLoggingConfig)();
11
+ return {
12
+ id: (0, crypto_1.randomUUID)(),
13
+ timestamp: new Date().toISOString(),
14
+ level,
15
+ source,
16
+ event,
17
+ message,
18
+ processId: process.pid,
19
+ runId: processRunId,
20
+ context: config.redact ? (0, log_redaction_1.redactContext)(context) : context,
21
+ };
22
+ }
23
+ function createLogger(source, baseContext = {}) {
24
+ const write = (level, event, message, context) => {
25
+ (0, log_storage_1.appendStructuredLogEntry)(createEntry(source, level, event, message, { ...baseContext, ...(context || {}) }));
26
+ };
27
+ return {
28
+ child(context) {
29
+ return createLogger(source, { ...baseContext, ...context });
30
+ },
31
+ debug(event, message, context) {
32
+ write('debug', event, message, context);
33
+ },
34
+ info(event, message, context) {
35
+ write('info', event, message, context);
36
+ },
37
+ warn(event, message, context) {
38
+ write('warn', event, message, context);
39
+ },
40
+ error(event, message, context) {
41
+ write('error', event, message, context);
42
+ },
43
+ };
44
+ }
45
+ exports.createLogger = createLogger;
46
+ //# sourceMappingURL=logger.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logger.js","sourceRoot":"","sources":["../../../src/services/logging/logger.ts"],"names":[],"mappings":";;;AAAA,mCAAoC;AACpC,6CAAwD;AACxD,mDAAgD;AAChD,+CAAyD;AAGzD,MAAM,YAAY,GAAG,GAAG,IAAI,CAAC,GAAG,EAAE,IAAI,OAAO,CAAC,GAAG,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,EAAE,CAAC;AAE/F,SAAS,WAAW,CAClB,MAAc,EACd,KAAmB,EACnB,KAAa,EACb,OAAe,EACf,OAAgC;IAEhC,MAAM,MAAM,GAAG,IAAA,qCAAwB,GAAE,CAAC;IAC1C,OAAO;QACL,EAAE,EAAE,IAAA,mBAAU,GAAE;QAChB,SAAS,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;QACnC,KAAK;QACL,MAAM;QACN,KAAK;QACL,OAAO;QACP,SAAS,EAAE,OAAO,CAAC,GAAG;QACtB,KAAK,EAAE,YAAY;QACnB,OAAO,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,IAAA,6BAAa,EAAC,OAAO,CAAC,CAAC,CAAC,CAAC,OAAO;KAC1D,CAAC;AACJ,CAAC;AAUD,SAAgB,YAAY,CAAC,MAAc,EAAE,cAAuC,EAAE;IACpF,MAAM,KAAK,GAAG,CACZ,KAAmB,EACnB,KAAa,EACb,OAAe,EACf,OAAiC,EACjC,EAAE;QACF,IAAA,sCAAwB,EACtB,WAAW,CAAC,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,GAAG,WAAW,EAAE,GAAG,CAAC,OAAO,IAAI,EAAE,CAAC,EAAE,CAAC,CACnF,CAAC;IACJ,CAAC,CAAC;IAEF,OAAO;QACL,KAAK,CAAC,OAAgC;YACpC,OAAO,YAAY,CAAC,MAAM,EAAE,EAAE,GAAG,WAAW,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;QAC9D,CAAC;QACD,KAAK,CAAC,KAAK,EAAE,OAAO,EAAE,OAAO;YAC3B,KAAK,CAAC,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;QAC1C,CAAC;QACD,IAAI,CAAC,KAAK,EAAE,OAAO,EAAE,OAAO;YAC1B,KAAK,CAAC,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;QACzC,CAAC;QACD,IAAI,CAAC,KAAK,EAAE,OAAO,EAAE,OAAO;YAC1B,KAAK,CAAC,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;QACzC,CAAC;QACD,KAAK,CAAC,KAAK,EAAE,OAAO,EAAE,OAAO;YAC3B,KAAK,CAAC,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;QAC1C,CAAC;KACF,CAAC;AACJ,CAAC;AA7BD,oCA6BC"}
@@ -1 +1 @@
1
- import{j as e}from"./radix-ui-Zb8sVEtn.js";import{r as C,h as ve}from"./react-vendor-CNOkPC89.js";import{u as Ce,a as $,b as F,e as ke,f as ee,g as we}from"./tanstack-DWm6aJ-G.js";import{T as Pe,a as Ae,b as te,c as De,d as _e,e as Te}from"./table-BPwgFXLQ.js";import{Y as O,a as z,af as de,ag as ue,ah as xe,ai as me,aj as he,L as T,I as X,x as D,ax as Se,d as b,B as P,C as M,b as R,e as Ge,f as Me,g as Re,n as Oe,j as I,k as q,_ as Q}from"./index-BMHPMj0j.js";import{A as ze,a as $e,b as Fe,c as Le,d as Ke,e as He,f as Ie,g as qe}from"./alert-dialog-Dh2NUFdm.js";import{t as k}from"./notifications-B2HqRBj7.js";import{aT as W,aU as U,aV as pe,ay as ge,V as fe,aW as Ue,aX as Ee,l as Y,am as Be,N as Qe,at as E,T as J,w as Ze,Y as Ve,n as ae,U as Xe,a6 as se,Z as ne}from"./icons-B9oTjo-t.js";import{C as re}from"./checkbox-tA5FH8Ol.js";import"./utils-CzKF5WmX.js";import"./form-utils-Bcoyqxpq.js";import"./code-highlight-BRUf_pqB.js";function Z(s){return Array.from(s).sort((r,t)=>r.localeCompare(t))}function We(s){const r=new Map;for(const n of s){if(n.context_mode!=="shared")continue;const h=n.context_group||"default",m=r.get(h)??{group:h,sharedCount:0,deeperCount:0,accountNames:[]};m.sharedCount+=1,m.accountNames.push(n.name),n.continuity_mode==="deeper"&&(m.deeperCount+=1),r.set(h,m)}const t=Array.from(r.values()).sort((n,h)=>n.group.localeCompare(h.group)),u=s.map(n=>{if(n.context_mode!=="shared")return{...n,sameGroupPeerCount:0,sameGroupDeeperPeerCount:0};const h=n.context_group||"default",m=r.get(h),y=Math.max((m?.sharedCount??1)-1,0),x=Math.max((m?.deeperCount??0)-(n.continuity_mode==="deeper"?1:0),0);return{...n,sameGroupPeerCount:y,sameGroupDeeperPeerCount:x}}),a=u.filter(n=>n.context_mode==="shared").length,i=u.filter(n=>n.context_mode==="shared"&&n.continuity_mode==="deeper").length,c=u.filter(n=>n.context_inferred).length,p=u.filter(n=>n.context_mode==="shared"&&n.continuity_mode!=="deeper"&&n.continuity_inferred).length;return{accounts:u,sharedCount:a,sharedStandardCount:Math.max(a-i,0),deeperSharedCount:i,isolatedCount:u.length-a,legacyContextCount:c,legacyContinuityCount:p,sharedAloneCount:u.filter(n=>n.context_mode==="shared"&&n.sameGroupPeerCount===0).length,sharedPeerAccountCount:u.filter(n=>n.sameGroupPeerCount>0).length,deeperReadyAccountCount:u.filter(n=>n.continuity_mode==="deeper"&&n.sameGroupDeeperPeerCount>0).length,sharedPeerGroups:Z(t.filter(n=>n.sharedCount>=2).map(n=>n.group)),deeperReadyGroups:Z(t.filter(n=>n.deeperCount>=2).map(n=>n.group)),sharedGroups:Z(t.map(n=>n.group)),groupSummaries:t}}function Ye(){return Ce({queryKey:["accounts"],queryFn:()=>O.accounts.list(),select:s=>{const r=s.accounts.filter(i=>i.type!=="cliproxy"),t=We(r),u=s.accounts.length-r.length,a=t.accounts.some(i=>i.name===s.default)?s.default:null;return{accounts:t.accounts,default:a,cliproxyCount:u,legacyContextCount:t.legacyContextCount,legacyContinuityCount:t.legacyContinuityCount,sharedCount:t.sharedCount,sharedStandardCount:t.sharedStandardCount,deeperSharedCount:t.deeperSharedCount,isolatedCount:t.isolatedCount,sharedAloneCount:t.sharedAloneCount,sharedPeerAccountCount:t.sharedPeerAccountCount,deeperReadyAccountCount:t.deeperReadyAccountCount,sharedPeerGroups:t.sharedPeerGroups,deeperReadyGroups:t.deeperReadyGroups,sharedGroups:t.sharedGroups,groupSummaries:t.groupSummaries,plainCcsLane:s.plain_ccs_lane??null}}})}function Je(){const s=$();return F({mutationFn:r=>O.accounts.setDefault(r),onSuccess:(r,t)=>{s.invalidateQueries({queryKey:["accounts"]}),k.success(`Default account set to "${t}"`)},onError:r=>{k.error(r.message)}})}function et(){const s=$();return F({mutationFn:()=>O.accounts.resetDefault(),onSuccess:()=>{s.invalidateQueries({queryKey:["accounts"]}),k.success("Default account reset to CCS")},onError:r=>{k.error(r.message)}})}function tt(){const s=$();return F({mutationFn:r=>O.accounts.delete(r),onSuccess:(r,t)=>{s.invalidateQueries({queryKey:["accounts"]}),k.success(`Account "${t}" deleted`)},onError:r=>{k.error(r.message)}})}function be(){const s=$();return F({mutationFn:({name:r,context_mode:t,context_group:u,continuity_mode:a})=>O.accounts.updateContext(r,{context_mode:t,context_group:u,continuity_mode:a}),onSuccess:(r,t)=>{s.invalidateQueries({queryKey:["accounts"]});const u=t.context_mode==="shared"?t.continuity_mode==="deeper"?`shared (${(t.context_group||"default").trim().toLowerCase().replace(/\s+/g,"-")}, deeper continuity)`:`shared (${(t.context_group||"default").trim().toLowerCase().replace(/\s+/g,"-")}, standard)`:"isolated";k.success(`Updated "${t.name}" context to ${u}`)},onError:r=>{k.error(r.message)}})}function at(){const s=$();return F({mutationFn:async r=>{const t=r.filter(i=>i.context_inferred||i.continuity_inferred),a=(await Promise.allSettled(t.map(i=>{const c=i.context_mode==="shared";return O.accounts.updateContext(i.name,{context_mode:c?"shared":"isolated",context_group:c?i.context_group||"default":void 0,continuity_mode:c?i.continuity_mode==="deeper"?"deeper":"standard":void 0})}))).filter(i=>i.status==="rejected").length;return{updatedCount:t.length-a,failedCount:a}},onSuccess:({updatedCount:r,failedCount:t})=>{if(s.invalidateQueries({queryKey:["accounts"]}),t>0&&r>0){k.error(`Confirmed ${r} legacy account${r>1?"s":""}, but ${t} update${t>1?"s":""} failed. Refreshed account state.`);return}if(t>0){k.error(`Failed to confirm ${t} legacy account${t>1?"s":""}. Refreshed account state.`);return}if(r>0){k.success(`Confirmed explicit sync mode for ${r} legacy account${r>1?"s":""}`);return}k.info("No legacy accounts need confirmation")},onError:r=>{s.invalidateQueries({queryKey:["accounts"]}),k.error(r.message)}})}const oe=64,st=/^[a-zA-Z][a-zA-Z0-9_-]*$/;function nt({account:s,groupSummaries:r,plainCcsLane:t,onClose:u}){const{t:a}=z(),i=be(),[c,p]=C.useState(s.context_mode==="shared"?"shared":"isolated"),[n,h]=C.useState(s.context_group||"default"),[m,y]=C.useState(s.continuity_mode==="deeper"?"deeper":"standard"),x=C.useMemo(()=>n.trim().toLowerCase().replace(/\s+/g,"-"),[n]),l=C.useMemo(()=>r.find(g=>g.group===x),[r,x]),N=x.length>0&&x.length<=oe&&st.test(x),o=c==="isolated"||N,d=c==="shared"?Math.max((l?.sharedCount??0)-(s.context_mode==="shared"&&s.context_group===x?1:0),0):0,f=c==="shared"?Math.max((l?.deeperCount??0)-(s.continuity_mode==="deeper"&&s.context_group===x?1:0),0):0,v=t?.account_name===s.name,j=!!t&&!v,S=`ccs auth default ${s.name}`,_=`ccs auth backup ${s.name}`,w=(g,K,G,H)=>{if(!["ArrowLeft","ArrowRight","ArrowUp","ArrowDown"].includes(g.key))return;g.preventDefault();const je=G.indexOf(K),ye=g.key==="ArrowLeft"||g.key==="ArrowUp"?-1:1,Ne=(je+ye+G.length)%G.length;H(G[Ne])},L=t?t.kind==="native"?a("continuityOverview.lane.native"):t.kind==="account-default"?a("continuityOverview.lane.accountDefault",{name:t.account_name||""}):t.kind==="account-inherited"?a("continuityOverview.lane.accountInherited",{name:t.account_name||""}):t.kind==="profile-default"?a("continuityOverview.lane.profileDefault",{name:t.profile_name||"default"}):t.label:"",A=()=>{o&&i.mutate({name:s.name,context_mode:c,context_group:c==="shared"?x:void 0,continuity_mode:c==="shared"?m:void 0},{onSuccess:()=>{u()}})},B=g=>{g||u()};return e.jsx(de,{open:!0,onOpenChange:B,children:e.jsxs(ue,{className:"sm:max-w-md",children:[e.jsxs(xe,{children:[e.jsx(me,{children:a("editAccountContext.title")}),e.jsx(he,{children:a("editAccountContext.description",{name:s.name})})]}),e.jsxs("div",{className:"space-y-4 py-2",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx("div",{className:"flex items-center justify-between",children:e.jsx(T,{className:"text-sm font-semibold",children:a("editAccountContext.syncMode")})}),e.jsxs("div",{className:"flex p-0.5 bg-muted/60 hover:bg-muted/80 transition-colors rounded-xl border border-border/40 w-full",role:"radiogroup","aria-label":a("editAccountContext.syncMode"),children:[e.jsxs("button",{type:"button",role:"radio","aria-checked":c==="isolated",tabIndex:c==="isolated"?0:-1,onClick:()=>p("isolated"),onKeyDown:g=>w(g,c,["isolated","shared"],p),className:`flex-1 flex justify-center items-center gap-2 px-3 py-1.5 rounded-[10px] text-sm font-medium transition-all duration-200 overflow-hidden ${c==="isolated"?"bg-background text-blue-600 dark:text-blue-400 shadow-sm ring-1 ring-border/50":"text-muted-foreground hover:text-foreground hover:bg-muted/50"}`,children:[e.jsx(W,{className:"h-4 w-4 shrink-0"}),e.jsx("span",{className:"truncate",children:a("editAccountContext.isolatedOption")})]}),e.jsxs("button",{type:"button",role:"radio","aria-checked":c==="shared",tabIndex:c==="shared"?0:-1,onClick:()=>p("shared"),onKeyDown:g=>w(g,c,["isolated","shared"],p),className:`flex-1 flex justify-center items-center gap-2 px-3 py-1.5 rounded-[10px] text-sm font-medium transition-all duration-200 overflow-hidden ${c==="shared"?"bg-background text-emerald-600 dark:text-emerald-400 shadow-sm ring-1 ring-border/50":"text-muted-foreground hover:text-foreground hover:bg-muted/50"}`,children:[e.jsx(U,{className:"h-4 w-4 shrink-0"}),e.jsx("span",{className:"truncate",children:a("editAccountContext.sharedOption")})]})]}),e.jsx("p",{className:"text-xs text-muted-foreground pt-1 px-1",children:a(c==="isolated"?"editAccountContext.isolatedModeHint":"editAccountContext.sharedModeHint")})]}),c==="shared"&&e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{htmlFor:"context-group",children:a("editAccountContext.historySyncGroup")}),e.jsx(X,{id:"context-group",value:n,onChange:g=>h(g.target.value),placeholder:a("editAccountContext.groupPlaceholder"),autoComplete:"off"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:a("editAccountContext.groupHint",{max:oe})}),!N&&e.jsx("p",{className:"text-xs text-destructive",children:a("editAccountContext.invalidGroup")})]}),c==="shared"&&e.jsxs("div",{className:"space-y-2",children:[e.jsx("div",{className:"flex items-center justify-between",children:e.jsx(T,{className:"text-sm font-semibold",children:a("editAccountContext.continuityDepth")})}),e.jsxs("div",{className:"flex p-0.5 bg-muted/60 hover:bg-muted/80 transition-colors rounded-xl border border-border/40 w-full",role:"radiogroup","aria-label":a("editAccountContext.continuityDepth"),children:[e.jsxs("button",{type:"button",role:"radio","aria-checked":m==="standard",tabIndex:m==="standard"?0:-1,onClick:()=>y("standard"),onKeyDown:g=>w(g,m,["standard","deeper"],y),className:`flex-1 flex justify-center items-center gap-2 px-3 py-1.5 rounded-[10px] text-sm font-medium transition-all duration-200 overflow-hidden ${m==="standard"?"bg-background text-emerald-600 dark:text-emerald-400 shadow-sm ring-1 ring-border/50":"text-muted-foreground hover:text-foreground hover:bg-muted/50"}`,children:[e.jsx(U,{className:"h-4 w-4 shrink-0"}),e.jsx("span",{className:"truncate",children:a("editAccountContext.standardOption")})]}),e.jsxs("button",{type:"button",role:"radio","aria-checked":m==="deeper",tabIndex:m==="deeper"?0:-1,onClick:()=>y("deeper"),onKeyDown:g=>w(g,m,["standard","deeper"],y),className:`flex-1 flex justify-center items-center gap-2 px-3 py-1.5 rounded-[10px] text-sm font-medium transition-all duration-200 overflow-hidden ${m==="deeper"?"bg-background text-indigo-600 dark:text-indigo-400 shadow-sm ring-1 ring-border/50":"text-muted-foreground hover:text-foreground hover:bg-muted/50"}`,children:[e.jsx(pe,{className:"h-4 w-4 shrink-0"}),e.jsx("span",{className:"truncate",children:a("editAccountContext.deeperOption")})]})]}),e.jsx("p",{className:"text-xs text-muted-foreground pt-1 px-1",children:a(m==="standard"?"editAccountContext.standardHint":"editAccountContext.deeperHint")})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:a("editAccountContext.credentialsIsolated")}),j&&e.jsx("div",{className:"rounded-[14px] border border-amber-200 bg-amber-50/50 p-4 text-xs shadow-sm dark:border-amber-900/40 dark:bg-amber-900/10",children:e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"font-medium text-foreground",children:a("continuityOverview.plainLaneTitle")}),e.jsx("p",{className:"text-muted-foreground leading-relaxed",children:a("continuityOverview.plainLaneDescription",{lane:L||"plain ccs",name:s.name})}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"rounded-md border bg-background px-2 py-2 font-mono text-[11px] flex items-start gap-2",children:[e.jsx("span",{className:"flex-1 break-all",children:"ccs -r"}),e.jsx(D,{value:"ccs -r",size:"icon"})]}),e.jsxs("div",{className:"rounded-md border bg-background px-2 py-2 font-mono text-[11px] flex items-start gap-2",children:[e.jsx("span",{className:"flex-1 break-all",children:"ccs auth backup default"}),e.jsx(D,{value:"ccs auth backup default",size:"icon"})]}),e.jsxs("div",{className:"rounded-md border bg-background px-2 py-2 font-mono text-[11px] flex items-start gap-2",children:[e.jsx("span",{className:"flex-1 break-all",children:_}),e.jsx(D,{value:_,size:"icon"})]}),e.jsxs("div",{className:"rounded-md border bg-background px-2 py-2 font-mono text-[11px] flex items-start gap-2",children:[e.jsx("span",{className:"flex-1 break-all",children:S}),e.jsx(D,{value:S,size:"icon"})]})]})]})}),e.jsx("div",{className:`rounded-[14px] border p-4 text-xs shadow-sm transition-colors ${c==="isolated"?"bg-blue-50/50 border-blue-200 dark:bg-blue-900/10 dark:border-blue-800/40":"bg-muted/40 border-border/60"}`,children:e.jsxs("div",{className:"flex items-start gap-3",children:[c==="isolated"?e.jsx(ge,{className:"h-4 w-4 text-blue-500 mt-0.5 shrink-0"}):e.jsx(fe,{className:"h-4 w-4 text-muted-foreground mt-0.5 shrink-0"}),e.jsxs("div",{className:"space-y-1.5 flex-1 text-muted-foreground leading-relaxed",children:[c==="isolated"?e.jsx("p",{className:"text-foreground font-medium selection:bg-blue-200",children:a("editAccountContext.isolatedImplication")}):e.jsxs(e.Fragment,{children:[e.jsxs("p",{children:[e.jsx("span",{className:"text-foreground font-medium",children:a("editAccountContext.sameGroupRule",{group:x})})," ",d>0?a("editAccountContext.sameGroupPeerCount",{count:d}):a("editAccountContext.noSameGroupPeer")]}),m==="deeper"&&e.jsx("p",{children:f>0?a("editAccountContext.deeperReady",{count:f}):e.jsx("span",{className:"text-amber-600 dark:text-amber-500",children:a("editAccountContext.deeperNeedsPeers")})})]}),e.jsx("p",{className:`pt-1.5 text-[11px] ${c==="isolated"?"text-blue-700/70 dark:text-blue-300/60":"text-muted-foreground/70"}`,children:a("editAccountContext.resumeOriginalWarning")})]})]})})]}),e.jsxs(Se,{children:[e.jsx(b,{variant:"outline",onClick:u,disabled:i.isPending,children:a("editAccountContext.cancel")}),e.jsx(b,{onClick:A,disabled:!o||i.isPending,children:i.isPending?a("editAccountContext.saving"):a("editAccountContext.save")})]})]})})}function ce({data:s,defaultAccount:r,groupSummaries:t,plainCcsLane:u}){const{t:a}=z(),i=Je(),c=tt(),p=et(),n=be(),[h,m]=C.useState(null),[y,x]=C.useState(null),l=[{accessorKey:"name",header:a("accountsTable.name"),size:200,cell:({row:o})=>e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"font-medium",children:o.original.name}),o.original.name===r&&e.jsx("span",{className:"text-xs bg-primary/10 text-primary px-1.5 py-0.5 rounded border border-primary/20",children:a("accountsTable.defaultBadge")})]})},{accessorKey:"type",header:a("accountsTable.type"),size:100,cell:({row:o})=>e.jsx("span",{className:"capitalize text-muted-foreground",children:o.original.type||"oauth"})},{accessorKey:"created",header:a("accountsTable.created"),size:150,cell:({row:o})=>{const d=new Date(o.original.created);return e.jsx("span",{className:"text-muted-foreground",children:d.toLocaleDateString()})}},{accessorKey:"last_used",header:a("accountsTable.lastUsed"),size:150,cell:({row:o})=>{if(!o.original.last_used)return e.jsx("span",{className:"text-muted-foreground/50",children:"-"});const d=new Date(o.original.last_used);return e.jsx("span",{className:"text-muted-foreground",children:d.toLocaleDateString()})}},{id:"context",header:a("accountsTable.historySync"),size:170,cell:({row:o})=>{if(o.original.type==="cliproxy")return e.jsx("span",{className:"text-muted-foreground/50",children:"-"});if((o.original.context_mode||"isolated")==="shared"){const f=o.original.context_group||"default",v=o.original.continuity_mode==="deeper";return e.jsxs("div",{className:"flex flex-col items-start gap-1",children:[e.jsxs("div",{className:"flex items-center gap-1.5 flex-wrap",children:[e.jsx(P,{variant:"outline",className:`font-mono text-[10px] uppercase px-1.5 py-0 border ${v?"text-indigo-700 border-indigo-300/60 bg-indigo-50/50 dark:text-indigo-300 dark:border-indigo-900/40 dark:bg-indigo-900/20":"text-emerald-700 border-emerald-300/60 bg-emerald-50/50 dark:text-emerald-300 dark:border-emerald-900/40 dark:bg-emerald-900/20"}`,children:a(v?"accountsTable.badges.deeper":"accountsTable.badges.shared")}),e.jsx("span",{className:"text-xs font-semibold text-foreground/80",children:f})]}),e.jsx("p",{className:"text-[10px] text-muted-foreground whitespace-nowrap",children:o.original.sameGroupPeerCount>0?a("accountsTable.sameGroupPeerCount",{count:o.original.sameGroupPeerCount}):a("accountsTable.noSameGroupPeer")})]})}return o.original.context_inferred?e.jsxs("div",{className:"flex flex-col items-start gap-1",children:[e.jsx(P,{variant:"outline",className:"text-amber-700 border-amber-300/60 bg-amber-50/50 dark:text-amber-400 dark:border-amber-900/40 dark:bg-amber-900/20 font-mono text-[10px] uppercase px-1.5 py-0",children:a("accountsTable.badges.legacy")}),e.jsx("p",{className:"text-[10px] text-amber-700/80 dark:text-amber-400/80 whitespace-nowrap",children:a("accountsTable.legacyReview")})]}):e.jsx("div",{className:"flex flex-col items-start gap-1.5",children:e.jsx(P,{variant:"secondary",className:"font-mono text-[10px] uppercase px-1.5 py-0 text-muted-foreground bg-muted/60 border-transparent shadow-none",children:a("accountsTable.badges.isolated")})})}},{id:"actions",header:a("accountsTable.actions"),size:220,cell:({row:o})=>{const d=o.original.name===r,f=i.isPending||c.isPending||n.isPending,v=o.original.type==="cliproxy",j=o.original.context_inferred||o.original.continuity_inferred;return e.jsxs("div",{className:"flex items-center gap-1",children:[!v&&e.jsxs(b,{variant:"outline",size:"sm",className:"h-8 px-2",disabled:f,onClick:()=>x(o.original),title:a("accountsTable.syncTitle"),children:[e.jsx(Ue,{className:"w-3.5 h-3.5 mr-1"}),a("accountsTable.sync")]}),!v&&j&&e.jsxs(b,{variant:"ghost",size:"sm",className:"h-8 px-2 text-amber-700 hover:text-amber-700 hover:bg-amber-500/10 dark:text-amber-400 dark:hover:text-amber-400",disabled:f,onClick:()=>n.mutate({name:o.original.name,context_mode:o.original.context_mode==="shared"?"shared":"isolated",context_group:o.original.context_mode==="shared"?o.original.context_group||"default":void 0,continuity_mode:o.original.context_mode==="shared"?o.original.continuity_mode==="deeper"?"deeper":"standard":void 0}),title:a("accountsTable.confirmLegacyTitle"),children:[e.jsx(Ee,{className:"w-3 h-3 mr-1"}),a("accountsTable.confirm")]}),e.jsxs(b,{variant:d?"secondary":"default",size:"sm",className:"h-8 px-2",disabled:d||f,onClick:()=>i.mutate(o.original.name),children:[e.jsx(Y,{className:`w-3 h-3 mr-1 ${d?"opacity-50":""}`}),a(d?"accountsTable.active":"accountsTable.setDefault")]}),e.jsx(b,{variant:"ghost",size:"sm",className:"h-8 px-2 text-destructive hover:text-destructive hover:bg-destructive/10",disabled:d||f,onClick:()=>m(o.original.name),title:a(d?"accountsTable.cannotDeleteDefault":"accountsTable.deleteAccount"),children:e.jsx(Be,{className:"w-4 h-4"})})]})}}],N=ke({data:s,columns:l,getCoreRowModel:we()});return s.length===0?e.jsx("div",{className:"text-center py-8 text-muted-foreground",children:a("accountsTable.noAccounts")}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"space-y-4",children:[e.jsx("div",{className:"border rounded-md",children:e.jsxs(Pe,{children:[e.jsx(Ae,{children:N.getHeaderGroups().map(o=>e.jsx(te,{children:o.headers.map(d=>{const f={name:"w-[200px]",type:"w-[100px]",created:"w-[150px]",last_used:"w-[150px]",context:"w-[170px]",actions:"w-[290px]"}[d.id]||"w-auto";return e.jsx(De,{className:f,children:d.isPlaceholder?null:ee(d.column.columnDef.header,d.getContext())},d.id)})},o.id))}),e.jsx(_e,{children:N.getRowModel().rows.map(o=>e.jsx(te,{children:o.getVisibleCells().map(d=>e.jsx(Te,{children:ee(d.column.columnDef.cell,d.getContext())},d.id))},o.id))})]})}),r&&e.jsx("div",{className:"flex justify-end",children:e.jsxs(b,{variant:"outline",size:"sm",onClick:()=>p.mutate(),disabled:p.isPending,children:[e.jsx(Qe,{className:"w-4 h-4 mr-2"}),a("accountsTable.resetToDefault")]})})]}),y&&e.jsx(nt,{account:y,groupSummaries:t,plainCcsLane:u,onClose:()=>x(null)}),e.jsx(ze,{open:!!h,onOpenChange:o=>!o&&m(null),children:e.jsxs($e,{children:[e.jsxs(Fe,{children:[e.jsx(Le,{children:a("accountsTable.deleteDialogTitle")}),e.jsx(Ke,{children:a("accountsTable.deleteDialogDesc",{name:h??""})})]}),e.jsxs(He,{children:[e.jsx(Ie,{children:a("accountsTable.cancel")}),e.jsx(qe,{className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",onClick:()=>{h&&(c.mutate(h),m(null))},children:a("accountsTable.delete")})]})]})})]})}const V=({titleKey:s,descKey:r})=>{const{t}=z();return e.jsxs(Ge,{children:[e.jsx(Me,{asChild:!0,children:e.jsx(b,{variant:"ghost",size:"icon","aria-label":t(s),className:"h-5 w-5 rounded-full hover:bg-muted text-muted-foreground/70 transition-colors",children:e.jsx(fe,{className:"h-3 w-3"})})}),e.jsxs(Re,{className:"w-72 p-4 rounded-xl shadow-lg border-border/50 text-sm",side:"top",align:"center",children:[e.jsx("p",{className:"font-semibold tracking-tight",children:t(s)}),e.jsx("p",{className:"mt-1.5 text-muted-foreground leading-relaxed",children:t(r)})]})]})};function ie({totalAccounts:s,primaryAccountName:r,isolatedCount:t,sharedStandardCount:u,deeperSharedCount:a,sharedAloneCount:i,sharedPeerAccountCount:c,deeperReadyAccountCount:p,sharedPeerGroups:n,deeperReadyGroups:h,legacyTargetCount:m,cliproxyCount:y,plainCcsLane:x}){const{t:l}=z(),N=x?x.kind==="native"?l("continuityOverview.lane.native"):x.kind==="account-default"?l("continuityOverview.lane.accountDefault",{name:x.account_name||""}):x.kind==="account-inherited"?l("continuityOverview.lane.accountInherited",{name:x.account_name||""}):x.kind==="profile-default"?l("continuityOverview.lane.profileDefault",{name:x.profile_name||"default"}):x.label:"",o=s<2?"single":n.length===0?t===s?"isolated":"shared-alone":h.length===0?"shared-standard":t>0||i>0||p<c||h.length<n.length?"partial":"ready",d=h[0]||n[0]||"default",f=h.length>0&&(t>0||u>0||n.length>h.length),j={ready:e.jsx(Ze,{className:"h-6 w-6 text-emerald-600 dark:text-emerald-400"}),"shared-standard":e.jsx(U,{className:"h-6 w-6 text-blue-600 dark:text-blue-400"}),single:e.jsx(ge,{className:"h-6 w-6 text-stone-400"}),isolated:e.jsx(W,{className:"h-6 w-6 text-amber-600 dark:text-amber-400"}),"shared-alone":e.jsx(J,{className:"h-6 w-6 text-amber-600 dark:text-amber-400"}),partial:e.jsx(J,{className:"h-6 w-6 text-amber-600 dark:text-amber-400"})}[o],S=!!r&&x?.account_name===r,_=s>0&&!!x&&(!r||!S),w=s>1&&o!=="ready";return e.jsxs("div",{className:"flex flex-col gap-4",children:[e.jsx(M,{className:"flex flex-col justify-between overflow-hidden relative group p-0 border-border bg-card shadow-sm hover:shadow-md transition-shadow duration-300",children:e.jsxs(R,{className:"p-6 flex flex-col h-full bg-gradient-to-br from-card to-muted/20 space-y-4",children:[e.jsx("div",{className:"flex items-start justify-between gap-4",children:e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-start gap-4",children:[e.jsx("div",{className:"rounded-2xl bg-background p-3 shadow-sm ring-1 ring-border/50 self-start shrink-0",children:j}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx("h3",{className:"text-lg font-semibold tracking-tight",children:l(`continuityReadiness.messages.${o}.title`,{group:d})}),e.jsx(P,{variant:o==="ready"?"default":"secondary",className:"rounded-full px-2.5 py-0.5 font-medium shadow-sm",children:l(`continuityReadiness.state.${o}`)})]}),e.jsx("p",{className:"text-sm text-muted-foreground max-w-lg leading-relaxed",children:l(`continuityReadiness.messages.${o}.description`,{group:d,count:i})})]})]})}),e.jsxs("div",{className:"mt-auto pt-4 flex flex-wrap items-center gap-2",children:[y>0&&e.jsx(P,{variant:"outline",className:"text-blue-700 bg-blue-50/50 border-blue-200/60 dark:border-blue-900/40 dark:bg-blue-900/20 dark:text-blue-300",children:l("historySyncLearningMap.cliproxyManaged",{count:y})}),m>0&&e.jsx(P,{variant:"outline",className:"text-amber-700 bg-amber-50/50 border-amber-200/60 dark:border-amber-900/40 dark:bg-amber-900/20 dark:text-amber-300",children:l("historySyncLearningMap.legacyConfirmation",{count:m})}),n.length>0&&h.length===0&&e.jsx(P,{variant:"secondary",className:"font-mono text-[11px] px-2 bg-muted/50 text-muted-foreground border-transparent",children:l("continuityOverview.recommendBadge",{group:d})}),f&&e.jsx(P,{variant:"secondary",className:"font-mono text-[11px] px-2 bg-muted/50 text-muted-foreground border-transparent",children:l("continuityOverview.partialBadge",{group:d})})]})]})}),(_||w)&&e.jsx(M,{className:"border-dashed",children:e.jsxs(R,{className:"p-5 space-y-4",children:[_&&e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-semibold text-foreground",children:l("continuityOverview.plainLaneTitle")}),e.jsx("p",{className:"text-sm text-muted-foreground",children:l("continuityOverview.plainLaneDescription",{lane:N||"plain ccs"})})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"rounded-md border bg-background px-2 py-2 font-mono text-[11px] flex items-start gap-2",children:[e.jsx("span",{className:"flex-1 break-all",children:"ccs -r"}),e.jsx(D,{value:"ccs -r",size:"icon"})]}),e.jsxs("div",{className:"rounded-md border bg-background px-2 py-2 font-mono text-[11px] flex items-start gap-2",children:[e.jsx("span",{className:"flex-1 break-all",children:"ccs auth backup default"}),e.jsx(D,{value:"ccs auth backup default",size:"icon"})]}),r?e.jsxs("div",{className:"rounded-md border bg-background px-2 py-2 font-mono text-[11px] flex items-start gap-2",children:[e.jsx("span",{className:"flex-1 break-all",children:`ccs auth default ${r}`}),e.jsx(D,{value:`ccs auth default ${r}`,size:"icon"})]}):e.jsx("p",{className:"text-xs text-muted-foreground",children:l("continuityOverview.setDefaultHint")})]})]}),w&&e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-sm font-semibold text-foreground",children:l("continuityReadiness.stepsTitle")}),e.jsxs("ol",{className:"space-y-1 pl-5 text-sm text-muted-foreground",children:[e.jsx("li",{children:l("continuityReadiness.steps.syncBoth")}),e.jsx("li",{children:l("continuityReadiness.steps.sameGroup",{group:d})}),e.jsx("li",{children:l("continuityReadiness.steps.enableDeeper")}),e.jsx("li",{children:l("continuityReadiness.steps.resumeOriginal")})]})]})]})}),e.jsxs("div",{className:"flex flex-col md:flex-row items-center gap-3",children:[e.jsxs("div",{className:"flex-1 w-full flex items-center justify-between p-3.5 rounded-xl border border-blue-300/40 bg-blue-50/50 dark:border-blue-900/30 dark:bg-blue-900/10 shadow-sm transition-colors hover:bg-blue-100/40 dark:hover:bg-blue-900/20",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(W,{className:"h-4 w-4 text-blue-700/80 dark:text-blue-400/80"}),e.jsx("span",{className:"text-xs font-semibold uppercase tracking-wider text-blue-900 dark:text-blue-200",children:l("historySyncLearningMap.isolated")}),e.jsx(V,{titleKey:"accountsPage.isolated",descKey:"accountsPage.isolatedDesc"})]}),e.jsx("span",{className:"text-lg font-mono font-bold text-blue-900 dark:text-blue-200",children:t})]}),e.jsx(E,{className:"hidden md:block h-4 w-4 text-muted-foreground/40 shrink-0"}),e.jsxs("div",{className:"flex-1 w-full flex items-center justify-between p-3.5 rounded-xl border border-emerald-300/40 bg-emerald-50/50 dark:border-emerald-900/30 dark:bg-emerald-900/10 shadow-sm transition-colors hover:bg-emerald-100/40 dark:hover:bg-emerald-900/20",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(U,{className:"h-4 w-4 text-emerald-700/80 dark:text-emerald-400/80"}),e.jsx("span",{className:"text-xs font-semibold uppercase tracking-wider text-emerald-900 dark:text-emerald-200",children:l("historySyncLearningMap.shared")}),e.jsx(V,{titleKey:"accountsPage.sharedStandard",descKey:"accountsPage.sharedStandardDesc"})]}),e.jsx("span",{className:"text-lg font-mono font-bold text-emerald-900 dark:text-emerald-200",children:u})]}),e.jsx(E,{className:"hidden md:block h-4 w-4 text-muted-foreground/40 shrink-0"}),e.jsxs("div",{className:"flex-1 w-full flex items-center justify-between p-3.5 rounded-xl border border-indigo-300/40 bg-indigo-50/50 dark:border-indigo-900/30 dark:bg-indigo-900/10 shadow-sm transition-colors hover:bg-indigo-100/40 dark:hover:bg-indigo-900/20",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(pe,{className:"h-4 w-4 text-indigo-700/80 dark:text-indigo-400/80"}),e.jsx("span",{className:"text-xs font-semibold uppercase tracking-wider text-indigo-900 dark:text-indigo-200",children:l("historySyncLearningMap.deeper")}),e.jsx(V,{titleKey:"accountsPage.sharedDeeper",descKey:"accountsPage.sharedDeeperDesc"})]}),e.jsx("span",{className:"text-lg font-mono font-bold text-indigo-900 dark:text-indigo-200",children:a})]})]})]})}const le=64;function rt({open:s,onClose:r}){const{t}=z(),[u,a]=C.useState(""),[i,c]=C.useState(!1),[p,n]=C.useState(""),[h,m]=C.useState(!1),[y,x]=C.useState(!1),l=/^[a-zA-Z][a-zA-Z0-9_-]*$/.test(u),N=p.trim().toLowerCase().replace(/\s+/g,"-"),o=N.length===0||N.length<=le&&/^[a-zA-Z][a-zA-Z0-9_-]*$/.test(N),d=u&&l?[`ccs auth create ${u}`,i?N.length>0?`--context-group ${N}`:"--share-context":"",i&&h?"--deeper-continuity":""].filter(Boolean).join(" "):t("createAuthProfileDialog.commandFallback"),f=async()=>{!l||i&&!o||(await navigator.clipboard.writeText(d),x(!0),setTimeout(()=>x(!1),2e3))},v=()=>{a(""),c(!1),n(""),m(!1),x(!1),r()};return e.jsx(de,{open:s,onOpenChange:j=>!j&&v(),children:e.jsxs(ue,{className:"sm:max-w-md",children:[e.jsxs(xe,{children:[e.jsx(me,{children:t("createAuthProfileDialog.title")}),e.jsx(he,{children:t("createAuthProfileDialog.description")})]}),e.jsxs("div",{className:"space-y-4 py-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{htmlFor:"profile-name",children:t("createAuthProfileDialog.profileName")}),e.jsx(X,{id:"profile-name",value:u,onChange:j=>a(j.target.value),placeholder:t("createAuthProfileDialog.profileNamePlaceholder"),autoComplete:"off"}),u&&!l&&e.jsx("p",{className:"text-xs text-destructive",children:t("createAuthProfileDialog.invalidProfileName")})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(re,{id:"share-context",checked:i,onCheckedChange:j=>c(j===!0)}),e.jsx(T,{htmlFor:"share-context",className:"cursor-pointer",children:t("createAuthProfileDialog.enableSharedHistory")})]}),i&&e.jsxs("div",{className:"space-y-2 pl-6",children:[e.jsx(T,{htmlFor:"context-group",children:t("createAuthProfileDialog.historySyncGroupOptional")}),e.jsx(X,{id:"context-group",value:p,onChange:j=>n(j.target.value),placeholder:t("createAuthProfileDialog.historySyncGroupPlaceholder"),autoComplete:"off"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:t("createAuthProfileDialog.historySyncGroupHint")}),e.jsxs("div",{className:"flex items-center gap-2 pt-1",children:[e.jsx(re,{id:"deeper-continuity",checked:h,onCheckedChange:j=>m(j===!0)}),e.jsx(T,{htmlFor:"deeper-continuity",className:"cursor-pointer",children:t("createAuthProfileDialog.deeperContinuity")})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:t("createAuthProfileDialog.deeperContinuityHint")}),p.trim().length>0&&!o&&e.jsx("p",{className:"text-xs text-destructive",children:t("createAuthProfileDialog.invalidContextGroup",{max:le})})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{children:t("createAuthProfileDialog.command")}),e.jsxs("div",{className:"flex items-center gap-2 p-3 bg-muted rounded-md font-mono text-sm",children:[e.jsx(Ve,{className:"w-4 h-4 text-muted-foreground shrink-0"}),e.jsx("code",{className:"flex-1 break-all",children:d}),e.jsx(b,{variant:"ghost",size:"sm",className:"shrink-0 h-8 px-2",onClick:f,disabled:!l||i&&!o,children:y?e.jsx(Y,{className:"w-4 h-4 text-green-500"}):e.jsx(ae,{className:"w-4 h-4"})})]})]}),e.jsxs("div",{className:"text-sm text-muted-foreground space-y-1",children:[e.jsx("p",{children:t("createAuthProfileDialog.afterRunPrefix")}),e.jsxs("ol",{className:"list-decimal list-inside pl-2 space-y-0.5",children:[e.jsx("li",{children:t("createAuthProfileDialog.afterRunStep1")}),e.jsx("li",{children:t("createAuthProfileDialog.afterRunStep2")})]}),e.jsx("p",{className:"pt-1",children:t("createAuthProfileDialog.poolingHint")})]}),e.jsxs("div",{className:"flex justify-end gap-2 pt-2",children:[e.jsx(b,{variant:"ghost",onClick:v,children:t("createAuthProfileDialog.close")}),e.jsx(b,{onClick:f,disabled:!l||i&&!o,children:y?e.jsxs(e.Fragment,{children:[e.jsx(Y,{className:"w-4 h-4 mr-2"}),t("createAuthProfileDialog.copied")]}):e.jsxs(e.Fragment,{children:[e.jsx(ae,{className:"w-4 h-4 mr-2"}),t("createAuthProfileDialog.copyCommand")]})})]})]})]})})}function bt(){const{t:s}=z(),r=ve(),{data:t,isLoading:u}=Ye(),a=at(),[i,c]=C.useState(!1),p=t?.accounts||[],n=t?.cliproxyCount||0,h=t?.legacyContextCount||0,m=t?.legacyContinuityCount||0,y=t?.sharedCount||0,x=t?.sharedStandardCount||0,l=t?.deeperSharedCount||0,N=t?.isolatedCount||0,o=t?.sharedAloneCount||0,d=t?.sharedPeerAccountCount||0,f=t?.deeperReadyAccountCount||0,v=t?.sharedPeerGroups||[],j=t?.deeperReadyGroups||[],S=t?.sharedGroups||[],_=t?.groupSummaries||[],w=t?.plainCcsLane||null,L=p.filter(H=>H.context_inferred||H.continuity_inferred),A=L.length,B=A>0,g=()=>r("/cliproxy?provider=claude"),K=()=>r("/cliproxy?provider=claude&action=auth"),G=()=>a.mutate(L);return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"hidden h-full min-h-0 lg:flex",children:[e.jsxs("div",{className:"w-80 border-r flex flex-col bg-muted/20 shrink-0",children:[e.jsxs("div",{className:"p-4 border-b bg-background space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Xe,{className:"h-5 w-5 text-primary"}),e.jsx("h1",{className:"font-semibold",children:s("accountsPage.title")})]}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:[s("accountsPage.managePrefix"),e.jsx("code",{className:"mx-1 rounded bg-muted px-1 py-0.5",children:"ccs auth"}),s("accountsPage.manageSuffix")]})]}),e.jsx(Oe,{className:"flex-1",children:e.jsxs("div",{className:"p-4 space-y-3",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-[11px] font-medium uppercase tracking-wide text-muted-foreground",children:s("accountsPage.primaryActions")}),e.jsxs(b,{size:"sm",className:"w-full justify-start",onClick:()=>c(!0),children:[e.jsx(se,{className:"w-4 h-4 mr-2"}),s("accountsPage.createAccount")]}),e.jsxs(b,{size:"sm",className:"w-full justify-start",onClick:K,children:[e.jsx(ne,{className:"w-4 h-4 mr-2"}),s("accountsPage.authClaudeInPool")]}),e.jsxs(b,{variant:"outline",size:"sm",className:"w-full justify-start",onClick:g,children:[s("accountsPage.openClaudePoolSettings"),e.jsx(E,{className:"w-4 h-4 ml-auto"})]})]}),B?e.jsxs("section",{className:"space-y-2",children:[e.jsx("p",{className:"text-[11px] font-medium uppercase tracking-wide text-muted-foreground",children:s("accountsPage.migrationFollowup")}),e.jsxs("div",{className:"rounded-md border border-amber-500/50 bg-amber-500/10 p-3 space-y-3",children:[e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx(J,{className:"h-4 w-4 mt-0.5 text-amber-700 dark:text-amber-400 shrink-0"}),e.jsxs("div",{className:"space-y-1 text-xs",children:[h>0&&e.jsx("p",{className:"text-amber-800 dark:text-amber-300",children:s("accountsPage.legacyContextPending",{count:h})}),m>0&&e.jsx("p",{className:"text-amber-800 dark:text-amber-300",children:s("accountsPage.legacyContinuityPending",{count:m})})]})]}),e.jsx(b,{variant:"secondary",size:"sm",className:"w-full justify-start",onClick:G,disabled:a.isPending||A===0,children:a.isPending?s("accountsPage.confirmingLegacy"):s("accountsPage.confirmLegacy",{count:A})})]})]}):e.jsx("div",{className:"rounded-md border bg-background px-3 py-2 text-xs text-muted-foreground",children:s("accountsPage.noLegacyFollowup")}),e.jsxs(M,{children:[e.jsxs(I,{className:"pb-2",children:[e.jsx(q,{className:"text-sm",children:s("accountsPage.quickCommands")}),e.jsx(Q,{children:s("accountsPage.quickCommandsDesc")})]}),e.jsxs(R,{className:"space-y-2",children:[e.jsxs("div",{className:"rounded-md border bg-background px-2 py-2 font-mono text-[11px] flex items-start gap-2",children:[e.jsx("span",{className:"flex-1 break-all",children:"ccs auth create work --context-group sprint-a --deeper-continuity"}),e.jsx(D,{value:"ccs auth create work --context-group sprint-a --deeper-continuity",size:"icon"})]}),e.jsxs("div",{className:"rounded-md border bg-background px-2 py-2 font-mono text-[11px] flex items-start gap-2",children:[e.jsx("span",{className:"flex-1 break-all",children:"ccs cliproxy auth claude"}),e.jsx(D,{value:"ccs cliproxy auth claude",size:"icon"})]})]})]})]})})]}),e.jsxs("div",{className:"flex-1 min-w-0 flex flex-col bg-background",children:[e.jsxs("div",{className:"px-5 py-4 border-b bg-background",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(P,{variant:"outline",children:s("accountsPage.workspaceBadge")}),e.jsx(P,{variant:"secondary",children:s("accountsPage.historySyncBadge")})]}),e.jsx("h2",{className:"mt-2 text-xl font-semibold tracking-tight",children:s("accountsPage.authAccounts")}),e.jsxs("p",{className:"mt-1 text-sm text-muted-foreground",children:[s("accountsPage.tableScopePrefix"),e.jsx("code",{className:"mx-1 rounded bg-muted px-1 py-0.5",children:"ccs auth"}),s("accountsPage.tableScopeMiddle"),e.jsx("code",{className:"mx-1 rounded bg-muted px-1 py-0.5",children:s("accountsTable.sync")}),s("accountsPage.tableScopeSuffix")]})]}),e.jsxs("div",{className:"flex-1 min-h-0 p-5 space-y-4 overflow-y-auto",children:[e.jsx(ie,{totalAccounts:p.length,primaryAccountName:p.length===1?p[0]?.name:null,isolatedCount:N,sharedStandardCount:x,deeperSharedCount:l,sharedAloneCount:o,sharedPeerAccountCount:d,deeperReadyAccountCount:f,sharedGroups:S,sharedPeerGroups:v,deeperReadyGroups:j,legacyTargetCount:A,cliproxyCount:n,plainCcsLane:w}),e.jsxs(M,{className:"flex flex-col",children:[e.jsxs(I,{className:"pb-3",children:[e.jsx(q,{className:"text-lg",children:s("accountsPage.accountMatrix")}),e.jsx(Q,{children:s("accountsPage.sharedTotalDesc",{count:y})})]}),e.jsx(R,{children:u?e.jsx("div",{className:"text-muted-foreground",children:s("accountsPage.loadingAccounts")}):e.jsx(ce,{data:p,defaultAccount:t?.default??null,groupSummaries:_,plainCcsLane:w})})]})]})]})]}),e.jsxs("div",{className:"p-4 space-y-4 lg:hidden",children:[e.jsxs(M,{children:[e.jsxs(I,{children:[e.jsx(q,{className:"text-lg",children:s("accountsPage.title")}),e.jsxs(Q,{children:[s("accountsPage.managePrefix"),e.jsx("code",{className:"mx-1 rounded bg-muted px-1 py-0.5",children:"ccs auth"}),s("accountsPage.mobileManageSuffix")]})]}),e.jsxs(R,{className:"space-y-2",children:[e.jsxs(b,{className:"w-full",onClick:()=>c(!0),children:[e.jsx(se,{className:"w-4 h-4 mr-2"}),s("accountsPage.createAccount")]}),e.jsxs(b,{variant:"outline",className:"w-full",onClick:g,children:[s("accountsPage.openCliProxyClaudePool"),e.jsx(E,{className:"w-4 h-4 ml-2"})]}),e.jsxs(b,{variant:"outline",className:"w-full",onClick:K,children:[s("accountsPage.authClaudeInPool"),e.jsx(ne,{className:"w-4 h-4 ml-2"})]}),e.jsx(b,{variant:"outline",className:"w-full",onClick:G,disabled:a.isPending||A===0,children:a.isPending?s("accountsPage.confirmingLegacy"):s("accountsPage.confirmLegacy",{count:A})})]})]}),e.jsx(ie,{totalAccounts:p.length,primaryAccountName:p.length===1?p[0]?.name:null,isolatedCount:N,sharedStandardCount:x,deeperSharedCount:l,sharedAloneCount:o,sharedPeerAccountCount:d,deeperReadyAccountCount:f,sharedGroups:S,sharedPeerGroups:v,deeperReadyGroups:j,legacyTargetCount:A,cliproxyCount:n,plainCcsLane:w}),e.jsxs(M,{children:[e.jsx(I,{className:"pb-3",children:e.jsx(q,{className:"text-base",children:s("accountsPage.accountMatrix")})}),e.jsx(R,{children:u?e.jsx("div",{className:"text-muted-foreground",children:s("accountsPage.loadingAccounts")}):e.jsx(ce,{data:p,defaultAccount:t?.default??null,groupSummaries:_,plainCcsLane:w})})]})]}),e.jsx(rt,{open:i,onClose:()=>c(!1)})]})}export{bt as AccountsPage};
1
+ import{j as e}from"./radix-ui-Zb8sVEtn.js";import{r as C,h as ve}from"./react-vendor-CNOkPC89.js";import{u as Ce,a as $,b as F,e as ke,f as ee,g as we}from"./tanstack-CrmUhA7Z.js";import{T as Pe,a as Ae,b as te,c as De,d as _e,e as Te}from"./table-8dkohJBd.js";import{Y as R,a as z,ag as de,ah as ue,ai as xe,aj as me,ak as he,L as T,I as V,x as D,aC as Se,d as b,B as P,C as M,b as O,e as Ge,f as Me,g as Oe,n as Re,j as I,k as q,_ as Q}from"./index-CUOLpSIB.js";import{A as ze,a as $e,b as Fe,c as Le,d as Ke,e as He,f as Ie,g as qe}from"./alert-dialog-SgZxEXpw.js";import{t as k}from"./notifications-B2HqRBj7.js";import{a_ as W,a$ as E,b0 as pe,aC as ge,Y as fe,b1 as Ee,b2 as Ue,m as Y,ar as Be,O as Qe,a5 as U,T as J,x as Ze,_ as Xe,o as ae,U as Ve,a8 as se,Z as ne}from"./icons-C4EMu2PL.js";import{C as re}from"./checkbox-B-cTEUE0.js";import"./utils-CzKF5WmX.js";import"./form-utils-Bcoyqxpq.js";import"./code-highlight-BRUf_pqB.js";function Z(s){return Array.from(s).sort((r,t)=>r.localeCompare(t))}function We(s){const r=new Map;for(const n of s){if(n.context_mode!=="shared")continue;const h=n.context_group||"default",m=r.get(h)??{group:h,sharedCount:0,deeperCount:0,accountNames:[]};m.sharedCount+=1,m.accountNames.push(n.name),n.continuity_mode==="deeper"&&(m.deeperCount+=1),r.set(h,m)}const t=Array.from(r.values()).sort((n,h)=>n.group.localeCompare(h.group)),u=s.map(n=>{if(n.context_mode!=="shared")return{...n,sameGroupPeerCount:0,sameGroupDeeperPeerCount:0};const h=n.context_group||"default",m=r.get(h),y=Math.max((m?.sharedCount??1)-1,0),x=Math.max((m?.deeperCount??0)-(n.continuity_mode==="deeper"?1:0),0);return{...n,sameGroupPeerCount:y,sameGroupDeeperPeerCount:x}}),a=u.filter(n=>n.context_mode==="shared").length,i=u.filter(n=>n.context_mode==="shared"&&n.continuity_mode==="deeper").length,c=u.filter(n=>n.context_inferred).length,p=u.filter(n=>n.context_mode==="shared"&&n.continuity_mode!=="deeper"&&n.continuity_inferred).length;return{accounts:u,sharedCount:a,sharedStandardCount:Math.max(a-i,0),deeperSharedCount:i,isolatedCount:u.length-a,legacyContextCount:c,legacyContinuityCount:p,sharedAloneCount:u.filter(n=>n.context_mode==="shared"&&n.sameGroupPeerCount===0).length,sharedPeerAccountCount:u.filter(n=>n.sameGroupPeerCount>0).length,deeperReadyAccountCount:u.filter(n=>n.continuity_mode==="deeper"&&n.sameGroupDeeperPeerCount>0).length,sharedPeerGroups:Z(t.filter(n=>n.sharedCount>=2).map(n=>n.group)),deeperReadyGroups:Z(t.filter(n=>n.deeperCount>=2).map(n=>n.group)),sharedGroups:Z(t.map(n=>n.group)),groupSummaries:t}}function Ye(){return Ce({queryKey:["accounts"],queryFn:()=>R.accounts.list(),select:s=>{const r=s.accounts.filter(i=>i.type!=="cliproxy"),t=We(r),u=s.accounts.length-r.length,a=t.accounts.some(i=>i.name===s.default)?s.default:null;return{accounts:t.accounts,default:a,cliproxyCount:u,legacyContextCount:t.legacyContextCount,legacyContinuityCount:t.legacyContinuityCount,sharedCount:t.sharedCount,sharedStandardCount:t.sharedStandardCount,deeperSharedCount:t.deeperSharedCount,isolatedCount:t.isolatedCount,sharedAloneCount:t.sharedAloneCount,sharedPeerAccountCount:t.sharedPeerAccountCount,deeperReadyAccountCount:t.deeperReadyAccountCount,sharedPeerGroups:t.sharedPeerGroups,deeperReadyGroups:t.deeperReadyGroups,sharedGroups:t.sharedGroups,groupSummaries:t.groupSummaries,plainCcsLane:s.plain_ccs_lane??null}}})}function Je(){const s=$();return F({mutationFn:r=>R.accounts.setDefault(r),onSuccess:(r,t)=>{s.invalidateQueries({queryKey:["accounts"]}),k.success(`Default account set to "${t}"`)},onError:r=>{k.error(r.message)}})}function et(){const s=$();return F({mutationFn:()=>R.accounts.resetDefault(),onSuccess:()=>{s.invalidateQueries({queryKey:["accounts"]}),k.success("Default account reset to CCS")},onError:r=>{k.error(r.message)}})}function tt(){const s=$();return F({mutationFn:r=>R.accounts.delete(r),onSuccess:(r,t)=>{s.invalidateQueries({queryKey:["accounts"]}),k.success(`Account "${t}" deleted`)},onError:r=>{k.error(r.message)}})}function be(){const s=$();return F({mutationFn:({name:r,context_mode:t,context_group:u,continuity_mode:a})=>R.accounts.updateContext(r,{context_mode:t,context_group:u,continuity_mode:a}),onSuccess:(r,t)=>{s.invalidateQueries({queryKey:["accounts"]});const u=t.context_mode==="shared"?t.continuity_mode==="deeper"?`shared (${(t.context_group||"default").trim().toLowerCase().replace(/\s+/g,"-")}, deeper continuity)`:`shared (${(t.context_group||"default").trim().toLowerCase().replace(/\s+/g,"-")}, standard)`:"isolated";k.success(`Updated "${t.name}" context to ${u}`)},onError:r=>{k.error(r.message)}})}function at(){const s=$();return F({mutationFn:async r=>{const t=r.filter(i=>i.context_inferred||i.continuity_inferred),a=(await Promise.allSettled(t.map(i=>{const c=i.context_mode==="shared";return R.accounts.updateContext(i.name,{context_mode:c?"shared":"isolated",context_group:c?i.context_group||"default":void 0,continuity_mode:c?i.continuity_mode==="deeper"?"deeper":"standard":void 0})}))).filter(i=>i.status==="rejected").length;return{updatedCount:t.length-a,failedCount:a}},onSuccess:({updatedCount:r,failedCount:t})=>{if(s.invalidateQueries({queryKey:["accounts"]}),t>0&&r>0){k.error(`Confirmed ${r} legacy account${r>1?"s":""}, but ${t} update${t>1?"s":""} failed. Refreshed account state.`);return}if(t>0){k.error(`Failed to confirm ${t} legacy account${t>1?"s":""}. Refreshed account state.`);return}if(r>0){k.success(`Confirmed explicit sync mode for ${r} legacy account${r>1?"s":""}`);return}k.info("No legacy accounts need confirmation")},onError:r=>{s.invalidateQueries({queryKey:["accounts"]}),k.error(r.message)}})}const oe=64,st=/^[a-zA-Z][a-zA-Z0-9_-]*$/;function nt({account:s,groupSummaries:r,plainCcsLane:t,onClose:u}){const{t:a}=z(),i=be(),[c,p]=C.useState(s.context_mode==="shared"?"shared":"isolated"),[n,h]=C.useState(s.context_group||"default"),[m,y]=C.useState(s.continuity_mode==="deeper"?"deeper":"standard"),x=C.useMemo(()=>n.trim().toLowerCase().replace(/\s+/g,"-"),[n]),l=C.useMemo(()=>r.find(g=>g.group===x),[r,x]),N=x.length>0&&x.length<=oe&&st.test(x),o=c==="isolated"||N,d=c==="shared"?Math.max((l?.sharedCount??0)-(s.context_mode==="shared"&&s.context_group===x?1:0),0):0,f=c==="shared"?Math.max((l?.deeperCount??0)-(s.continuity_mode==="deeper"&&s.context_group===x?1:0),0):0,v=t?.account_name===s.name,j=!!t&&!v,S=`ccs auth default ${s.name}`,_=`ccs auth backup ${s.name}`,w=(g,K,G,H)=>{if(!["ArrowLeft","ArrowRight","ArrowUp","ArrowDown"].includes(g.key))return;g.preventDefault();const je=G.indexOf(K),ye=g.key==="ArrowLeft"||g.key==="ArrowUp"?-1:1,Ne=(je+ye+G.length)%G.length;H(G[Ne])},L=t?t.kind==="native"?a("continuityOverview.lane.native"):t.kind==="account-default"?a("continuityOverview.lane.accountDefault",{name:t.account_name||""}):t.kind==="account-inherited"?a("continuityOverview.lane.accountInherited",{name:t.account_name||""}):t.kind==="profile-default"?a("continuityOverview.lane.profileDefault",{name:t.profile_name||"default"}):t.label:"",A=()=>{o&&i.mutate({name:s.name,context_mode:c,context_group:c==="shared"?x:void 0,continuity_mode:c==="shared"?m:void 0},{onSuccess:()=>{u()}})},B=g=>{g||u()};return e.jsx(de,{open:!0,onOpenChange:B,children:e.jsxs(ue,{className:"sm:max-w-md",children:[e.jsxs(xe,{children:[e.jsx(me,{children:a("editAccountContext.title")}),e.jsx(he,{children:a("editAccountContext.description",{name:s.name})})]}),e.jsxs("div",{className:"space-y-4 py-2",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx("div",{className:"flex items-center justify-between",children:e.jsx(T,{className:"text-sm font-semibold",children:a("editAccountContext.syncMode")})}),e.jsxs("div",{className:"flex p-0.5 bg-muted/60 hover:bg-muted/80 transition-colors rounded-xl border border-border/40 w-full",role:"radiogroup","aria-label":a("editAccountContext.syncMode"),children:[e.jsxs("button",{type:"button",role:"radio","aria-checked":c==="isolated",tabIndex:c==="isolated"?0:-1,onClick:()=>p("isolated"),onKeyDown:g=>w(g,c,["isolated","shared"],p),className:`flex-1 flex justify-center items-center gap-2 px-3 py-1.5 rounded-[10px] text-sm font-medium transition-all duration-200 overflow-hidden ${c==="isolated"?"bg-background text-blue-600 dark:text-blue-400 shadow-sm ring-1 ring-border/50":"text-muted-foreground hover:text-foreground hover:bg-muted/50"}`,children:[e.jsx(W,{className:"h-4 w-4 shrink-0"}),e.jsx("span",{className:"truncate",children:a("editAccountContext.isolatedOption")})]}),e.jsxs("button",{type:"button",role:"radio","aria-checked":c==="shared",tabIndex:c==="shared"?0:-1,onClick:()=>p("shared"),onKeyDown:g=>w(g,c,["isolated","shared"],p),className:`flex-1 flex justify-center items-center gap-2 px-3 py-1.5 rounded-[10px] text-sm font-medium transition-all duration-200 overflow-hidden ${c==="shared"?"bg-background text-emerald-600 dark:text-emerald-400 shadow-sm ring-1 ring-border/50":"text-muted-foreground hover:text-foreground hover:bg-muted/50"}`,children:[e.jsx(E,{className:"h-4 w-4 shrink-0"}),e.jsx("span",{className:"truncate",children:a("editAccountContext.sharedOption")})]})]}),e.jsx("p",{className:"text-xs text-muted-foreground pt-1 px-1",children:a(c==="isolated"?"editAccountContext.isolatedModeHint":"editAccountContext.sharedModeHint")})]}),c==="shared"&&e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{htmlFor:"context-group",children:a("editAccountContext.historySyncGroup")}),e.jsx(V,{id:"context-group",value:n,onChange:g=>h(g.target.value),placeholder:a("editAccountContext.groupPlaceholder"),autoComplete:"off"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:a("editAccountContext.groupHint",{max:oe})}),!N&&e.jsx("p",{className:"text-xs text-destructive",children:a("editAccountContext.invalidGroup")})]}),c==="shared"&&e.jsxs("div",{className:"space-y-2",children:[e.jsx("div",{className:"flex items-center justify-between",children:e.jsx(T,{className:"text-sm font-semibold",children:a("editAccountContext.continuityDepth")})}),e.jsxs("div",{className:"flex p-0.5 bg-muted/60 hover:bg-muted/80 transition-colors rounded-xl border border-border/40 w-full",role:"radiogroup","aria-label":a("editAccountContext.continuityDepth"),children:[e.jsxs("button",{type:"button",role:"radio","aria-checked":m==="standard",tabIndex:m==="standard"?0:-1,onClick:()=>y("standard"),onKeyDown:g=>w(g,m,["standard","deeper"],y),className:`flex-1 flex justify-center items-center gap-2 px-3 py-1.5 rounded-[10px] text-sm font-medium transition-all duration-200 overflow-hidden ${m==="standard"?"bg-background text-emerald-600 dark:text-emerald-400 shadow-sm ring-1 ring-border/50":"text-muted-foreground hover:text-foreground hover:bg-muted/50"}`,children:[e.jsx(E,{className:"h-4 w-4 shrink-0"}),e.jsx("span",{className:"truncate",children:a("editAccountContext.standardOption")})]}),e.jsxs("button",{type:"button",role:"radio","aria-checked":m==="deeper",tabIndex:m==="deeper"?0:-1,onClick:()=>y("deeper"),onKeyDown:g=>w(g,m,["standard","deeper"],y),className:`flex-1 flex justify-center items-center gap-2 px-3 py-1.5 rounded-[10px] text-sm font-medium transition-all duration-200 overflow-hidden ${m==="deeper"?"bg-background text-indigo-600 dark:text-indigo-400 shadow-sm ring-1 ring-border/50":"text-muted-foreground hover:text-foreground hover:bg-muted/50"}`,children:[e.jsx(pe,{className:"h-4 w-4 shrink-0"}),e.jsx("span",{className:"truncate",children:a("editAccountContext.deeperOption")})]})]}),e.jsx("p",{className:"text-xs text-muted-foreground pt-1 px-1",children:a(m==="standard"?"editAccountContext.standardHint":"editAccountContext.deeperHint")})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:a("editAccountContext.credentialsIsolated")}),j&&e.jsx("div",{className:"rounded-[14px] border border-amber-200 bg-amber-50/50 p-4 text-xs shadow-sm dark:border-amber-900/40 dark:bg-amber-900/10",children:e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"font-medium text-foreground",children:a("continuityOverview.plainLaneTitle")}),e.jsx("p",{className:"text-muted-foreground leading-relaxed",children:a("continuityOverview.plainLaneDescription",{lane:L||"plain ccs",name:s.name})}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"rounded-md border bg-background px-2 py-2 font-mono text-[11px] flex items-start gap-2",children:[e.jsx("span",{className:"flex-1 break-all",children:"ccs -r"}),e.jsx(D,{value:"ccs -r",size:"icon"})]}),e.jsxs("div",{className:"rounded-md border bg-background px-2 py-2 font-mono text-[11px] flex items-start gap-2",children:[e.jsx("span",{className:"flex-1 break-all",children:"ccs auth backup default"}),e.jsx(D,{value:"ccs auth backup default",size:"icon"})]}),e.jsxs("div",{className:"rounded-md border bg-background px-2 py-2 font-mono text-[11px] flex items-start gap-2",children:[e.jsx("span",{className:"flex-1 break-all",children:_}),e.jsx(D,{value:_,size:"icon"})]}),e.jsxs("div",{className:"rounded-md border bg-background px-2 py-2 font-mono text-[11px] flex items-start gap-2",children:[e.jsx("span",{className:"flex-1 break-all",children:S}),e.jsx(D,{value:S,size:"icon"})]})]})]})}),e.jsx("div",{className:`rounded-[14px] border p-4 text-xs shadow-sm transition-colors ${c==="isolated"?"bg-blue-50/50 border-blue-200 dark:bg-blue-900/10 dark:border-blue-800/40":"bg-muted/40 border-border/60"}`,children:e.jsxs("div",{className:"flex items-start gap-3",children:[c==="isolated"?e.jsx(ge,{className:"h-4 w-4 text-blue-500 mt-0.5 shrink-0"}):e.jsx(fe,{className:"h-4 w-4 text-muted-foreground mt-0.5 shrink-0"}),e.jsxs("div",{className:"space-y-1.5 flex-1 text-muted-foreground leading-relaxed",children:[c==="isolated"?e.jsx("p",{className:"text-foreground font-medium selection:bg-blue-200",children:a("editAccountContext.isolatedImplication")}):e.jsxs(e.Fragment,{children:[e.jsxs("p",{children:[e.jsx("span",{className:"text-foreground font-medium",children:a("editAccountContext.sameGroupRule",{group:x})})," ",d>0?a("editAccountContext.sameGroupPeerCount",{count:d}):a("editAccountContext.noSameGroupPeer")]}),m==="deeper"&&e.jsx("p",{children:f>0?a("editAccountContext.deeperReady",{count:f}):e.jsx("span",{className:"text-amber-600 dark:text-amber-500",children:a("editAccountContext.deeperNeedsPeers")})})]}),e.jsx("p",{className:`pt-1.5 text-[11px] ${c==="isolated"?"text-blue-700/70 dark:text-blue-300/60":"text-muted-foreground/70"}`,children:a("editAccountContext.resumeOriginalWarning")})]})]})})]}),e.jsxs(Se,{children:[e.jsx(b,{variant:"outline",onClick:u,disabled:i.isPending,children:a("editAccountContext.cancel")}),e.jsx(b,{onClick:A,disabled:!o||i.isPending,children:i.isPending?a("editAccountContext.saving"):a("editAccountContext.save")})]})]})})}function ce({data:s,defaultAccount:r,groupSummaries:t,plainCcsLane:u}){const{t:a}=z(),i=Je(),c=tt(),p=et(),n=be(),[h,m]=C.useState(null),[y,x]=C.useState(null),l=[{accessorKey:"name",header:a("accountsTable.name"),size:200,cell:({row:o})=>e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"font-medium",children:o.original.name}),o.original.name===r&&e.jsx("span",{className:"text-xs bg-primary/10 text-primary px-1.5 py-0.5 rounded border border-primary/20",children:a("accountsTable.defaultBadge")})]})},{accessorKey:"type",header:a("accountsTable.type"),size:100,cell:({row:o})=>e.jsx("span",{className:"capitalize text-muted-foreground",children:o.original.type||"oauth"})},{accessorKey:"created",header:a("accountsTable.created"),size:150,cell:({row:o})=>{const d=new Date(o.original.created);return e.jsx("span",{className:"text-muted-foreground",children:d.toLocaleDateString()})}},{accessorKey:"last_used",header:a("accountsTable.lastUsed"),size:150,cell:({row:o})=>{if(!o.original.last_used)return e.jsx("span",{className:"text-muted-foreground/50",children:"-"});const d=new Date(o.original.last_used);return e.jsx("span",{className:"text-muted-foreground",children:d.toLocaleDateString()})}},{id:"context",header:a("accountsTable.historySync"),size:170,cell:({row:o})=>{if(o.original.type==="cliproxy")return e.jsx("span",{className:"text-muted-foreground/50",children:"-"});if((o.original.context_mode||"isolated")==="shared"){const f=o.original.context_group||"default",v=o.original.continuity_mode==="deeper";return e.jsxs("div",{className:"flex flex-col items-start gap-1",children:[e.jsxs("div",{className:"flex items-center gap-1.5 flex-wrap",children:[e.jsx(P,{variant:"outline",className:`font-mono text-[10px] uppercase px-1.5 py-0 border ${v?"text-indigo-700 border-indigo-300/60 bg-indigo-50/50 dark:text-indigo-300 dark:border-indigo-900/40 dark:bg-indigo-900/20":"text-emerald-700 border-emerald-300/60 bg-emerald-50/50 dark:text-emerald-300 dark:border-emerald-900/40 dark:bg-emerald-900/20"}`,children:a(v?"accountsTable.badges.deeper":"accountsTable.badges.shared")}),e.jsx("span",{className:"text-xs font-semibold text-foreground/80",children:f})]}),e.jsx("p",{className:"text-[10px] text-muted-foreground whitespace-nowrap",children:o.original.sameGroupPeerCount>0?a("accountsTable.sameGroupPeerCount",{count:o.original.sameGroupPeerCount}):a("accountsTable.noSameGroupPeer")})]})}return o.original.context_inferred?e.jsxs("div",{className:"flex flex-col items-start gap-1",children:[e.jsx(P,{variant:"outline",className:"text-amber-700 border-amber-300/60 bg-amber-50/50 dark:text-amber-400 dark:border-amber-900/40 dark:bg-amber-900/20 font-mono text-[10px] uppercase px-1.5 py-0",children:a("accountsTable.badges.legacy")}),e.jsx("p",{className:"text-[10px] text-amber-700/80 dark:text-amber-400/80 whitespace-nowrap",children:a("accountsTable.legacyReview")})]}):e.jsx("div",{className:"flex flex-col items-start gap-1.5",children:e.jsx(P,{variant:"secondary",className:"font-mono text-[10px] uppercase px-1.5 py-0 text-muted-foreground bg-muted/60 border-transparent shadow-none",children:a("accountsTable.badges.isolated")})})}},{id:"actions",header:a("accountsTable.actions"),size:220,cell:({row:o})=>{const d=o.original.name===r,f=i.isPending||c.isPending||n.isPending,v=o.original.type==="cliproxy",j=o.original.context_inferred||o.original.continuity_inferred;return e.jsxs("div",{className:"flex items-center gap-1",children:[!v&&e.jsxs(b,{variant:"outline",size:"sm",className:"h-8 px-2",disabled:f,onClick:()=>x(o.original),title:a("accountsTable.syncTitle"),children:[e.jsx(Ee,{className:"w-3.5 h-3.5 mr-1"}),a("accountsTable.sync")]}),!v&&j&&e.jsxs(b,{variant:"ghost",size:"sm",className:"h-8 px-2 text-amber-700 hover:text-amber-700 hover:bg-amber-500/10 dark:text-amber-400 dark:hover:text-amber-400",disabled:f,onClick:()=>n.mutate({name:o.original.name,context_mode:o.original.context_mode==="shared"?"shared":"isolated",context_group:o.original.context_mode==="shared"?o.original.context_group||"default":void 0,continuity_mode:o.original.context_mode==="shared"?o.original.continuity_mode==="deeper"?"deeper":"standard":void 0}),title:a("accountsTable.confirmLegacyTitle"),children:[e.jsx(Ue,{className:"w-3 h-3 mr-1"}),a("accountsTable.confirm")]}),e.jsxs(b,{variant:d?"secondary":"default",size:"sm",className:"h-8 px-2",disabled:d||f,onClick:()=>i.mutate(o.original.name),children:[e.jsx(Y,{className:`w-3 h-3 mr-1 ${d?"opacity-50":""}`}),a(d?"accountsTable.active":"accountsTable.setDefault")]}),e.jsx(b,{variant:"ghost",size:"sm",className:"h-8 px-2 text-destructive hover:text-destructive hover:bg-destructive/10",disabled:d||f,onClick:()=>m(o.original.name),title:a(d?"accountsTable.cannotDeleteDefault":"accountsTable.deleteAccount"),children:e.jsx(Be,{className:"w-4 h-4"})})]})}}],N=ke({data:s,columns:l,getCoreRowModel:we()});return s.length===0?e.jsx("div",{className:"text-center py-8 text-muted-foreground",children:a("accountsTable.noAccounts")}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"space-y-4",children:[e.jsx("div",{className:"border rounded-md",children:e.jsxs(Pe,{children:[e.jsx(Ae,{children:N.getHeaderGroups().map(o=>e.jsx(te,{children:o.headers.map(d=>{const f={name:"w-[200px]",type:"w-[100px]",created:"w-[150px]",last_used:"w-[150px]",context:"w-[170px]",actions:"w-[290px]"}[d.id]||"w-auto";return e.jsx(De,{className:f,children:d.isPlaceholder?null:ee(d.column.columnDef.header,d.getContext())},d.id)})},o.id))}),e.jsx(_e,{children:N.getRowModel().rows.map(o=>e.jsx(te,{children:o.getVisibleCells().map(d=>e.jsx(Te,{children:ee(d.column.columnDef.cell,d.getContext())},d.id))},o.id))})]})}),r&&e.jsx("div",{className:"flex justify-end",children:e.jsxs(b,{variant:"outline",size:"sm",onClick:()=>p.mutate(),disabled:p.isPending,children:[e.jsx(Qe,{className:"w-4 h-4 mr-2"}),a("accountsTable.resetToDefault")]})})]}),y&&e.jsx(nt,{account:y,groupSummaries:t,plainCcsLane:u,onClose:()=>x(null)}),e.jsx(ze,{open:!!h,onOpenChange:o=>!o&&m(null),children:e.jsxs($e,{children:[e.jsxs(Fe,{children:[e.jsx(Le,{children:a("accountsTable.deleteDialogTitle")}),e.jsx(Ke,{children:a("accountsTable.deleteDialogDesc",{name:h??""})})]}),e.jsxs(He,{children:[e.jsx(Ie,{children:a("accountsTable.cancel")}),e.jsx(qe,{className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",onClick:()=>{h&&(c.mutate(h),m(null))},children:a("accountsTable.delete")})]})]})})]})}const X=({titleKey:s,descKey:r})=>{const{t}=z();return e.jsxs(Ge,{children:[e.jsx(Me,{asChild:!0,children:e.jsx(b,{variant:"ghost",size:"icon","aria-label":t(s),className:"h-5 w-5 rounded-full hover:bg-muted text-muted-foreground/70 transition-colors",children:e.jsx(fe,{className:"h-3 w-3"})})}),e.jsxs(Oe,{className:"w-72 p-4 rounded-xl shadow-lg border-border/50 text-sm",side:"top",align:"center",children:[e.jsx("p",{className:"font-semibold tracking-tight",children:t(s)}),e.jsx("p",{className:"mt-1.5 text-muted-foreground leading-relaxed",children:t(r)})]})]})};function ie({totalAccounts:s,primaryAccountName:r,isolatedCount:t,sharedStandardCount:u,deeperSharedCount:a,sharedAloneCount:i,sharedPeerAccountCount:c,deeperReadyAccountCount:p,sharedPeerGroups:n,deeperReadyGroups:h,legacyTargetCount:m,cliproxyCount:y,plainCcsLane:x}){const{t:l}=z(),N=x?x.kind==="native"?l("continuityOverview.lane.native"):x.kind==="account-default"?l("continuityOverview.lane.accountDefault",{name:x.account_name||""}):x.kind==="account-inherited"?l("continuityOverview.lane.accountInherited",{name:x.account_name||""}):x.kind==="profile-default"?l("continuityOverview.lane.profileDefault",{name:x.profile_name||"default"}):x.label:"",o=s<2?"single":n.length===0?t===s?"isolated":"shared-alone":h.length===0?"shared-standard":t>0||i>0||p<c||h.length<n.length?"partial":"ready",d=h[0]||n[0]||"default",f=h.length>0&&(t>0||u>0||n.length>h.length),j={ready:e.jsx(Ze,{className:"h-6 w-6 text-emerald-600 dark:text-emerald-400"}),"shared-standard":e.jsx(E,{className:"h-6 w-6 text-blue-600 dark:text-blue-400"}),single:e.jsx(ge,{className:"h-6 w-6 text-stone-400"}),isolated:e.jsx(W,{className:"h-6 w-6 text-amber-600 dark:text-amber-400"}),"shared-alone":e.jsx(J,{className:"h-6 w-6 text-amber-600 dark:text-amber-400"}),partial:e.jsx(J,{className:"h-6 w-6 text-amber-600 dark:text-amber-400"})}[o],S=!!r&&x?.account_name===r,_=s>0&&!!x&&(!r||!S),w=s>1&&o!=="ready";return e.jsxs("div",{className:"flex flex-col gap-4",children:[e.jsx(M,{className:"flex flex-col justify-between overflow-hidden relative group p-0 border-border bg-card shadow-sm hover:shadow-md transition-shadow duration-300",children:e.jsxs(O,{className:"p-6 flex flex-col h-full bg-gradient-to-br from-card to-muted/20 space-y-4",children:[e.jsx("div",{className:"flex items-start justify-between gap-4",children:e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-start gap-4",children:[e.jsx("div",{className:"rounded-2xl bg-background p-3 shadow-sm ring-1 ring-border/50 self-start shrink-0",children:j}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx("h3",{className:"text-lg font-semibold tracking-tight",children:l(`continuityReadiness.messages.${o}.title`,{group:d})}),e.jsx(P,{variant:o==="ready"?"default":"secondary",className:"rounded-full px-2.5 py-0.5 font-medium shadow-sm",children:l(`continuityReadiness.state.${o}`)})]}),e.jsx("p",{className:"text-sm text-muted-foreground max-w-lg leading-relaxed",children:l(`continuityReadiness.messages.${o}.description`,{group:d,count:i})})]})]})}),e.jsxs("div",{className:"mt-auto pt-4 flex flex-wrap items-center gap-2",children:[y>0&&e.jsx(P,{variant:"outline",className:"text-blue-700 bg-blue-50/50 border-blue-200/60 dark:border-blue-900/40 dark:bg-blue-900/20 dark:text-blue-300",children:l("historySyncLearningMap.cliproxyManaged",{count:y})}),m>0&&e.jsx(P,{variant:"outline",className:"text-amber-700 bg-amber-50/50 border-amber-200/60 dark:border-amber-900/40 dark:bg-amber-900/20 dark:text-amber-300",children:l("historySyncLearningMap.legacyConfirmation",{count:m})}),n.length>0&&h.length===0&&e.jsx(P,{variant:"secondary",className:"font-mono text-[11px] px-2 bg-muted/50 text-muted-foreground border-transparent",children:l("continuityOverview.recommendBadge",{group:d})}),f&&e.jsx(P,{variant:"secondary",className:"font-mono text-[11px] px-2 bg-muted/50 text-muted-foreground border-transparent",children:l("continuityOverview.partialBadge",{group:d})})]})]})}),(_||w)&&e.jsx(M,{className:"border-dashed",children:e.jsxs(O,{className:"p-5 space-y-4",children:[_&&e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-semibold text-foreground",children:l("continuityOverview.plainLaneTitle")}),e.jsx("p",{className:"text-sm text-muted-foreground",children:l("continuityOverview.plainLaneDescription",{lane:N||"plain ccs"})})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"rounded-md border bg-background px-2 py-2 font-mono text-[11px] flex items-start gap-2",children:[e.jsx("span",{className:"flex-1 break-all",children:"ccs -r"}),e.jsx(D,{value:"ccs -r",size:"icon"})]}),e.jsxs("div",{className:"rounded-md border bg-background px-2 py-2 font-mono text-[11px] flex items-start gap-2",children:[e.jsx("span",{className:"flex-1 break-all",children:"ccs auth backup default"}),e.jsx(D,{value:"ccs auth backup default",size:"icon"})]}),r?e.jsxs("div",{className:"rounded-md border bg-background px-2 py-2 font-mono text-[11px] flex items-start gap-2",children:[e.jsx("span",{className:"flex-1 break-all",children:`ccs auth default ${r}`}),e.jsx(D,{value:`ccs auth default ${r}`,size:"icon"})]}):e.jsx("p",{className:"text-xs text-muted-foreground",children:l("continuityOverview.setDefaultHint")})]})]}),w&&e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-sm font-semibold text-foreground",children:l("continuityReadiness.stepsTitle")}),e.jsxs("ol",{className:"space-y-1 pl-5 text-sm text-muted-foreground",children:[e.jsx("li",{children:l("continuityReadiness.steps.syncBoth")}),e.jsx("li",{children:l("continuityReadiness.steps.sameGroup",{group:d})}),e.jsx("li",{children:l("continuityReadiness.steps.enableDeeper")}),e.jsx("li",{children:l("continuityReadiness.steps.resumeOriginal")})]})]})]})}),e.jsxs("div",{className:"flex flex-col md:flex-row items-center gap-3",children:[e.jsxs("div",{className:"flex-1 w-full flex items-center justify-between p-3.5 rounded-xl border border-blue-300/40 bg-blue-50/50 dark:border-blue-900/30 dark:bg-blue-900/10 shadow-sm transition-colors hover:bg-blue-100/40 dark:hover:bg-blue-900/20",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(W,{className:"h-4 w-4 text-blue-700/80 dark:text-blue-400/80"}),e.jsx("span",{className:"text-xs font-semibold uppercase tracking-wider text-blue-900 dark:text-blue-200",children:l("historySyncLearningMap.isolated")}),e.jsx(X,{titleKey:"accountsPage.isolated",descKey:"accountsPage.isolatedDesc"})]}),e.jsx("span",{className:"text-lg font-mono font-bold text-blue-900 dark:text-blue-200",children:t})]}),e.jsx(U,{className:"hidden md:block h-4 w-4 text-muted-foreground/40 shrink-0"}),e.jsxs("div",{className:"flex-1 w-full flex items-center justify-between p-3.5 rounded-xl border border-emerald-300/40 bg-emerald-50/50 dark:border-emerald-900/30 dark:bg-emerald-900/10 shadow-sm transition-colors hover:bg-emerald-100/40 dark:hover:bg-emerald-900/20",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(E,{className:"h-4 w-4 text-emerald-700/80 dark:text-emerald-400/80"}),e.jsx("span",{className:"text-xs font-semibold uppercase tracking-wider text-emerald-900 dark:text-emerald-200",children:l("historySyncLearningMap.shared")}),e.jsx(X,{titleKey:"accountsPage.sharedStandard",descKey:"accountsPage.sharedStandardDesc"})]}),e.jsx("span",{className:"text-lg font-mono font-bold text-emerald-900 dark:text-emerald-200",children:u})]}),e.jsx(U,{className:"hidden md:block h-4 w-4 text-muted-foreground/40 shrink-0"}),e.jsxs("div",{className:"flex-1 w-full flex items-center justify-between p-3.5 rounded-xl border border-indigo-300/40 bg-indigo-50/50 dark:border-indigo-900/30 dark:bg-indigo-900/10 shadow-sm transition-colors hover:bg-indigo-100/40 dark:hover:bg-indigo-900/20",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(pe,{className:"h-4 w-4 text-indigo-700/80 dark:text-indigo-400/80"}),e.jsx("span",{className:"text-xs font-semibold uppercase tracking-wider text-indigo-900 dark:text-indigo-200",children:l("historySyncLearningMap.deeper")}),e.jsx(X,{titleKey:"accountsPage.sharedDeeper",descKey:"accountsPage.sharedDeeperDesc"})]}),e.jsx("span",{className:"text-lg font-mono font-bold text-indigo-900 dark:text-indigo-200",children:a})]})]})]})}const le=64;function rt({open:s,onClose:r}){const{t}=z(),[u,a]=C.useState(""),[i,c]=C.useState(!1),[p,n]=C.useState(""),[h,m]=C.useState(!1),[y,x]=C.useState(!1),l=/^[a-zA-Z][a-zA-Z0-9_-]*$/.test(u),N=p.trim().toLowerCase().replace(/\s+/g,"-"),o=N.length===0||N.length<=le&&/^[a-zA-Z][a-zA-Z0-9_-]*$/.test(N),d=u&&l?[`ccs auth create ${u}`,i?N.length>0?`--context-group ${N}`:"--share-context":"",i&&h?"--deeper-continuity":""].filter(Boolean).join(" "):t("createAuthProfileDialog.commandFallback"),f=async()=>{!l||i&&!o||(await navigator.clipboard.writeText(d),x(!0),setTimeout(()=>x(!1),2e3))},v=()=>{a(""),c(!1),n(""),m(!1),x(!1),r()};return e.jsx(de,{open:s,onOpenChange:j=>!j&&v(),children:e.jsxs(ue,{className:"sm:max-w-md",children:[e.jsxs(xe,{children:[e.jsx(me,{children:t("createAuthProfileDialog.title")}),e.jsx(he,{children:t("createAuthProfileDialog.description")})]}),e.jsxs("div",{className:"space-y-4 py-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{htmlFor:"profile-name",children:t("createAuthProfileDialog.profileName")}),e.jsx(V,{id:"profile-name",value:u,onChange:j=>a(j.target.value),placeholder:t("createAuthProfileDialog.profileNamePlaceholder"),autoComplete:"off"}),u&&!l&&e.jsx("p",{className:"text-xs text-destructive",children:t("createAuthProfileDialog.invalidProfileName")})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(re,{id:"share-context",checked:i,onCheckedChange:j=>c(j===!0)}),e.jsx(T,{htmlFor:"share-context",className:"cursor-pointer",children:t("createAuthProfileDialog.enableSharedHistory")})]}),i&&e.jsxs("div",{className:"space-y-2 pl-6",children:[e.jsx(T,{htmlFor:"context-group",children:t("createAuthProfileDialog.historySyncGroupOptional")}),e.jsx(V,{id:"context-group",value:p,onChange:j=>n(j.target.value),placeholder:t("createAuthProfileDialog.historySyncGroupPlaceholder"),autoComplete:"off"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:t("createAuthProfileDialog.historySyncGroupHint")}),e.jsxs("div",{className:"flex items-center gap-2 pt-1",children:[e.jsx(re,{id:"deeper-continuity",checked:h,onCheckedChange:j=>m(j===!0)}),e.jsx(T,{htmlFor:"deeper-continuity",className:"cursor-pointer",children:t("createAuthProfileDialog.deeperContinuity")})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:t("createAuthProfileDialog.deeperContinuityHint")}),p.trim().length>0&&!o&&e.jsx("p",{className:"text-xs text-destructive",children:t("createAuthProfileDialog.invalidContextGroup",{max:le})})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{children:t("createAuthProfileDialog.command")}),e.jsxs("div",{className:"flex items-center gap-2 p-3 bg-muted rounded-md font-mono text-sm",children:[e.jsx(Xe,{className:"w-4 h-4 text-muted-foreground shrink-0"}),e.jsx("code",{className:"flex-1 break-all",children:d}),e.jsx(b,{variant:"ghost",size:"sm",className:"shrink-0 h-8 px-2",onClick:f,disabled:!l||i&&!o,children:y?e.jsx(Y,{className:"w-4 h-4 text-green-500"}):e.jsx(ae,{className:"w-4 h-4"})})]})]}),e.jsxs("div",{className:"text-sm text-muted-foreground space-y-1",children:[e.jsx("p",{children:t("createAuthProfileDialog.afterRunPrefix")}),e.jsxs("ol",{className:"list-decimal list-inside pl-2 space-y-0.5",children:[e.jsx("li",{children:t("createAuthProfileDialog.afterRunStep1")}),e.jsx("li",{children:t("createAuthProfileDialog.afterRunStep2")})]}),e.jsx("p",{className:"pt-1",children:t("createAuthProfileDialog.poolingHint")})]}),e.jsxs("div",{className:"flex justify-end gap-2 pt-2",children:[e.jsx(b,{variant:"ghost",onClick:v,children:t("createAuthProfileDialog.close")}),e.jsx(b,{onClick:f,disabled:!l||i&&!o,children:y?e.jsxs(e.Fragment,{children:[e.jsx(Y,{className:"w-4 h-4 mr-2"}),t("createAuthProfileDialog.copied")]}):e.jsxs(e.Fragment,{children:[e.jsx(ae,{className:"w-4 h-4 mr-2"}),t("createAuthProfileDialog.copyCommand")]})})]})]})]})})}function bt(){const{t:s}=z(),r=ve(),{data:t,isLoading:u}=Ye(),a=at(),[i,c]=C.useState(!1),p=t?.accounts||[],n=t?.cliproxyCount||0,h=t?.legacyContextCount||0,m=t?.legacyContinuityCount||0,y=t?.sharedCount||0,x=t?.sharedStandardCount||0,l=t?.deeperSharedCount||0,N=t?.isolatedCount||0,o=t?.sharedAloneCount||0,d=t?.sharedPeerAccountCount||0,f=t?.deeperReadyAccountCount||0,v=t?.sharedPeerGroups||[],j=t?.deeperReadyGroups||[],S=t?.sharedGroups||[],_=t?.groupSummaries||[],w=t?.plainCcsLane||null,L=p.filter(H=>H.context_inferred||H.continuity_inferred),A=L.length,B=A>0,g=()=>r("/cliproxy?provider=claude"),K=()=>r("/cliproxy?provider=claude&action=auth"),G=()=>a.mutate(L);return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"hidden h-full min-h-0 lg:flex",children:[e.jsxs("div",{className:"w-80 border-r flex flex-col bg-muted/20 shrink-0",children:[e.jsxs("div",{className:"p-4 border-b bg-background space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Ve,{className:"h-5 w-5 text-primary"}),e.jsx("h1",{className:"font-semibold",children:s("accountsPage.title")})]}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:[s("accountsPage.managePrefix"),e.jsx("code",{className:"mx-1 rounded bg-muted px-1 py-0.5",children:"ccs auth"}),s("accountsPage.manageSuffix")]})]}),e.jsx(Re,{className:"flex-1",children:e.jsxs("div",{className:"p-4 space-y-3",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-[11px] font-medium uppercase tracking-wide text-muted-foreground",children:s("accountsPage.primaryActions")}),e.jsxs(b,{size:"sm",className:"w-full justify-start",onClick:()=>c(!0),children:[e.jsx(se,{className:"w-4 h-4 mr-2"}),s("accountsPage.createAccount")]}),e.jsxs(b,{size:"sm",className:"w-full justify-start",onClick:K,children:[e.jsx(ne,{className:"w-4 h-4 mr-2"}),s("accountsPage.authClaudeInPool")]}),e.jsxs(b,{variant:"outline",size:"sm",className:"w-full justify-start",onClick:g,children:[s("accountsPage.openClaudePoolSettings"),e.jsx(U,{className:"w-4 h-4 ml-auto"})]})]}),B?e.jsxs("section",{className:"space-y-2",children:[e.jsx("p",{className:"text-[11px] font-medium uppercase tracking-wide text-muted-foreground",children:s("accountsPage.migrationFollowup")}),e.jsxs("div",{className:"rounded-md border border-amber-500/50 bg-amber-500/10 p-3 space-y-3",children:[e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx(J,{className:"h-4 w-4 mt-0.5 text-amber-700 dark:text-amber-400 shrink-0"}),e.jsxs("div",{className:"space-y-1 text-xs",children:[h>0&&e.jsx("p",{className:"text-amber-800 dark:text-amber-300",children:s("accountsPage.legacyContextPending",{count:h})}),m>0&&e.jsx("p",{className:"text-amber-800 dark:text-amber-300",children:s("accountsPage.legacyContinuityPending",{count:m})})]})]}),e.jsx(b,{variant:"secondary",size:"sm",className:"w-full justify-start",onClick:G,disabled:a.isPending||A===0,children:a.isPending?s("accountsPage.confirmingLegacy"):s("accountsPage.confirmLegacy",{count:A})})]})]}):e.jsx("div",{className:"rounded-md border bg-background px-3 py-2 text-xs text-muted-foreground",children:s("accountsPage.noLegacyFollowup")}),e.jsxs(M,{children:[e.jsxs(I,{className:"pb-2",children:[e.jsx(q,{className:"text-sm",children:s("accountsPage.quickCommands")}),e.jsx(Q,{children:s("accountsPage.quickCommandsDesc")})]}),e.jsxs(O,{className:"space-y-2",children:[e.jsxs("div",{className:"rounded-md border bg-background px-2 py-2 font-mono text-[11px] flex items-start gap-2",children:[e.jsx("span",{className:"flex-1 break-all",children:"ccs auth create work --context-group sprint-a --deeper-continuity"}),e.jsx(D,{value:"ccs auth create work --context-group sprint-a --deeper-continuity",size:"icon"})]}),e.jsxs("div",{className:"rounded-md border bg-background px-2 py-2 font-mono text-[11px] flex items-start gap-2",children:[e.jsx("span",{className:"flex-1 break-all",children:"ccs cliproxy auth claude"}),e.jsx(D,{value:"ccs cliproxy auth claude",size:"icon"})]})]})]})]})})]}),e.jsxs("div",{className:"flex-1 min-w-0 flex flex-col bg-background",children:[e.jsxs("div",{className:"px-5 py-4 border-b bg-background",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(P,{variant:"outline",children:s("accountsPage.workspaceBadge")}),e.jsx(P,{variant:"secondary",children:s("accountsPage.historySyncBadge")})]}),e.jsx("h2",{className:"mt-2 text-xl font-semibold tracking-tight",children:s("accountsPage.authAccounts")}),e.jsxs("p",{className:"mt-1 text-sm text-muted-foreground",children:[s("accountsPage.tableScopePrefix"),e.jsx("code",{className:"mx-1 rounded bg-muted px-1 py-0.5",children:"ccs auth"}),s("accountsPage.tableScopeMiddle"),e.jsx("code",{className:"mx-1 rounded bg-muted px-1 py-0.5",children:s("accountsTable.sync")}),s("accountsPage.tableScopeSuffix")]})]}),e.jsxs("div",{className:"flex-1 min-h-0 p-5 space-y-4 overflow-y-auto",children:[e.jsx(ie,{totalAccounts:p.length,primaryAccountName:p.length===1?p[0]?.name:null,isolatedCount:N,sharedStandardCount:x,deeperSharedCount:l,sharedAloneCount:o,sharedPeerAccountCount:d,deeperReadyAccountCount:f,sharedGroups:S,sharedPeerGroups:v,deeperReadyGroups:j,legacyTargetCount:A,cliproxyCount:n,plainCcsLane:w}),e.jsxs(M,{className:"flex flex-col",children:[e.jsxs(I,{className:"pb-3",children:[e.jsx(q,{className:"text-lg",children:s("accountsPage.accountMatrix")}),e.jsx(Q,{children:s("accountsPage.sharedTotalDesc",{count:y})})]}),e.jsx(O,{children:u?e.jsx("div",{className:"text-muted-foreground",children:s("accountsPage.loadingAccounts")}):e.jsx(ce,{data:p,defaultAccount:t?.default??null,groupSummaries:_,plainCcsLane:w})})]})]})]})]}),e.jsxs("div",{className:"p-4 space-y-4 lg:hidden",children:[e.jsxs(M,{children:[e.jsxs(I,{children:[e.jsx(q,{className:"text-lg",children:s("accountsPage.title")}),e.jsxs(Q,{children:[s("accountsPage.managePrefix"),e.jsx("code",{className:"mx-1 rounded bg-muted px-1 py-0.5",children:"ccs auth"}),s("accountsPage.mobileManageSuffix")]})]}),e.jsxs(O,{className:"space-y-2",children:[e.jsxs(b,{className:"w-full",onClick:()=>c(!0),children:[e.jsx(se,{className:"w-4 h-4 mr-2"}),s("accountsPage.createAccount")]}),e.jsxs(b,{variant:"outline",className:"w-full",onClick:g,children:[s("accountsPage.openCliProxyClaudePool"),e.jsx(U,{className:"w-4 h-4 ml-2"})]}),e.jsxs(b,{variant:"outline",className:"w-full",onClick:K,children:[s("accountsPage.authClaudeInPool"),e.jsx(ne,{className:"w-4 h-4 ml-2"})]}),e.jsx(b,{variant:"outline",className:"w-full",onClick:G,disabled:a.isPending||A===0,children:a.isPending?s("accountsPage.confirmingLegacy"):s("accountsPage.confirmLegacy",{count:A})})]})]}),e.jsx(ie,{totalAccounts:p.length,primaryAccountName:p.length===1?p[0]?.name:null,isolatedCount:N,sharedStandardCount:x,deeperSharedCount:l,sharedAloneCount:o,sharedPeerAccountCount:d,deeperReadyAccountCount:f,sharedGroups:S,sharedPeerGroups:v,deeperReadyGroups:j,legacyTargetCount:A,cliproxyCount:n,plainCcsLane:w}),e.jsxs(M,{children:[e.jsx(I,{className:"pb-3",children:e.jsx(q,{className:"text-base",children:s("accountsPage.accountMatrix")})}),e.jsx(O,{children:u?e.jsx("div",{className:"text-muted-foreground",children:s("accountsPage.loadingAccounts")}):e.jsx(ce,{data:p,defaultAccount:t?.default??null,groupSummaries:_,plainCcsLane:w})})]})]}),e.jsx(rt,{open:i,onClose:()=>c(!1)})]})}export{bt as AccountsPage};
@@ -1 +1 @@
1
- import{j as e,a3 as s,a4 as r,a5 as n,a6 as i,a7 as d,a8 as c,a9 as u,aa as f}from"./radix-ui-Zb8sVEtn.js";import"./react-vendor-CNOkPC89.js";import{c as o,bC as l}from"./index-BMHPMj0j.js";function A({...a}){return e.jsx(s,{"data-slot":"alert-dialog",...a})}function g({...a}){return e.jsx(u,{"data-slot":"alert-dialog-portal",...a})}function m({className:a,...t}){return e.jsx(f,{"data-slot":"alert-dialog-overlay",className:o("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50",a),...t})}function D({className:a,...t}){return e.jsxs(g,{children:[e.jsx(m,{}),e.jsx(r,{"data-slot":"alert-dialog-content",className:o("bg-background data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border p-6 shadow-lg duration-200 sm:max-w-lg",a),...t})]})}function b({className:a,...t}){return e.jsx("div",{"data-slot":"alert-dialog-header",className:o("flex flex-col gap-2 text-center sm:text-left",a),...t})}function N({className:a,...t}){return e.jsx("div",{"data-slot":"alert-dialog-footer",className:o("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",a),...t})}function v({className:a,...t}){return e.jsx(n,{"data-slot":"alert-dialog-title",className:o("text-lg font-semibold",a),...t})}function w({className:a,...t}){return e.jsx(i,{"data-slot":"alert-dialog-description",className:o("text-muted-foreground text-sm",a),...t})}function y({className:a,...t}){return e.jsx(c,{className:o(l(),a),...t})}function C({className:a,...t}){return e.jsx(d,{className:o(l({variant:"outline"}),a),...t})}export{A,D as a,b,v as c,w as d,N as e,C as f,y as g};
1
+ import{j as e,a3 as s,a4 as r,a5 as n,a6 as i,a7 as d,a8 as c,a9 as u,aa as f}from"./radix-ui-Zb8sVEtn.js";import"./react-vendor-CNOkPC89.js";import{c as o,bK as l}from"./index-CUOLpSIB.js";function A({...a}){return e.jsx(s,{"data-slot":"alert-dialog",...a})}function g({...a}){return e.jsx(u,{"data-slot":"alert-dialog-portal",...a})}function m({className:a,...t}){return e.jsx(f,{"data-slot":"alert-dialog-overlay",className:o("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50",a),...t})}function D({className:a,...t}){return e.jsxs(g,{children:[e.jsx(m,{}),e.jsx(r,{"data-slot":"alert-dialog-content",className:o("bg-background data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border p-6 shadow-lg duration-200 sm:max-w-lg",a),...t})]})}function b({className:a,...t}){return e.jsx("div",{"data-slot":"alert-dialog-header",className:o("flex flex-col gap-2 text-center sm:text-left",a),...t})}function N({className:a,...t}){return e.jsx("div",{"data-slot":"alert-dialog-footer",className:o("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",a),...t})}function v({className:a,...t}){return e.jsx(n,{"data-slot":"alert-dialog-title",className:o("text-lg font-semibold",a),...t})}function w({className:a,...t}){return e.jsx(i,{"data-slot":"alert-dialog-description",className:o("text-muted-foreground text-sm",a),...t})}function y({className:a,...t}){return e.jsx(c,{className:o(l(),a),...t})}function z({className:a,...t}){return e.jsx(d,{className:o(l({variant:"outline"}),a),...t})}export{A,D as a,b,v as c,w as d,N as e,z as f,y as g};