claude-code-workflow 7.2.5 → 7.2.6

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 (221) hide show
  1. package/.claude/commands/workflow/analyze-with-file.md +11 -10
  2. package/.claude/skills/ccw-help/command.json +3 -3
  3. package/.claude/skills/ccw-help/index/all-commands.json +3 -3
  4. package/.claude/skills/ccw-help/index/by-category.json +3 -3
  5. package/.claude/skills/ccw-help/index/by-use-case.json +3 -3
  6. package/.claude/skills/skill-iter-tune/SKILL.md +382 -0
  7. package/.claude/skills/skill-iter-tune/phases/01-setup.md +144 -0
  8. package/.claude/skills/skill-iter-tune/phases/02-execute.md +292 -0
  9. package/.claude/skills/skill-iter-tune/phases/03-evaluate.md +312 -0
  10. package/.claude/skills/skill-iter-tune/phases/04-improve.md +186 -0
  11. package/.claude/skills/skill-iter-tune/phases/05-report.md +166 -0
  12. package/.claude/skills/skill-iter-tune/specs/evaluation-criteria.md +63 -0
  13. package/.claude/skills/skill-iter-tune/templates/eval-prompt.md +134 -0
  14. package/.claude/skills/skill-iter-tune/templates/execute-prompt.md +97 -0
  15. package/.claude/skills/team-roadmap-dev/SKILL.md +1 -1
  16. package/.claude/skills/team-roadmap-dev/roles/coordinator/role.md +1 -1
  17. package/.claude/skills/team-roadmap-dev/specs/team-config.json +1 -1
  18. package/ccw/dist/commands/install.d.ts.map +1 -1
  19. package/ccw/dist/commands/install.js +11 -9
  20. package/ccw/dist/commands/install.js.map +1 -1
  21. package/ccw/dist/tools/cli-executor-core.d.ts.map +1 -1
  22. package/ccw/dist/tools/cli-executor-core.js +0 -25
  23. package/ccw/dist/tools/cli-executor-core.js.map +1 -1
  24. package/ccw/dist/tools/cli-executor-state.d.ts.map +1 -1
  25. package/ccw/dist/tools/cli-executor-state.js +0 -31
  26. package/ccw/dist/tools/cli-executor-state.js.map +1 -1
  27. package/ccw/dist/tools/cli-history-store.d.ts.map +1 -1
  28. package/ccw/dist/tools/cli-history-store.js +1 -30
  29. package/ccw/dist/tools/cli-history-store.js.map +1 -1
  30. package/ccw/frontend/dist/assets/{AlertDialog-CFGtc76Y.js → AlertDialog-BMFUcfv_.js} +2 -2
  31. package/ccw/frontend/dist/assets/{AlertDialog-CFGtc76Y.js.map → AlertDialog-BMFUcfv_.js.map} +1 -1
  32. package/ccw/frontend/dist/assets/{AnalysisPage-Duxia_dG.js → AnalysisPage-Bxa333tD.js} +2 -2
  33. package/ccw/frontend/dist/assets/{AnalysisPage-Duxia_dG.js.map → AnalysisPage-Bxa333tD.js.map} +1 -1
  34. package/ccw/frontend/dist/assets/{ApiSettingsPage-CU9hesAE.js → ApiSettingsPage-BFVU-wcR.js} +2 -2
  35. package/ccw/frontend/dist/assets/{ApiSettingsPage-CU9hesAE.js.map → ApiSettingsPage-BFVU-wcR.js.map} +1 -1
  36. package/ccw/frontend/dist/assets/{CliModeToggle-DcdOFSvM.js → CliModeToggle-MDoFAJPL.js} +2 -2
  37. package/ccw/frontend/dist/assets/{CliModeToggle-DcdOFSvM.js.map → CliModeToggle-MDoFAJPL.js.map} +1 -1
  38. package/ccw/frontend/dist/assets/{CliSessionSharePage-oKN-GRIT.js → CliSessionSharePage-DkRmLiNN.js} +2 -2
  39. package/ccw/frontend/dist/assets/{CliSessionSharePage-oKN-GRIT.js.map → CliSessionSharePage-DkRmLiNN.js.map} +1 -1
  40. package/ccw/frontend/dist/assets/{CliViewerPage-_wUoHaY-.js → CliViewerPage-DN8jWddy.js} +2 -2
  41. package/ccw/frontend/dist/assets/{CliViewerPage-_wUoHaY-.js.map → CliViewerPage-DN8jWddy.js.map} +1 -1
  42. package/ccw/frontend/dist/assets/{CodexLensManagerPage-ClPNashJ.js → CodexLensManagerPage-Du_VAJtC.js} +2 -2
  43. package/ccw/frontend/dist/assets/{CodexLensManagerPage-ClPNashJ.js.map → CodexLensManagerPage-Du_VAJtC.js.map} +1 -1
  44. package/ccw/frontend/dist/assets/{Collapsible-Dladh9Eu.js → Collapsible-CF5bSyzt.js} +2 -2
  45. package/ccw/frontend/dist/assets/{Collapsible-Dladh9Eu.js.map → Collapsible-CF5bSyzt.js.map} +1 -1
  46. package/ccw/frontend/dist/assets/{CommandsManagerPage-B6DBb_Ew.js → CommandsManagerPage-Bm_P9I76.js} +2 -2
  47. package/ccw/frontend/dist/assets/{CommandsManagerPage-B6DBb_Ew.js.map → CommandsManagerPage-Bm_P9I76.js.map} +1 -1
  48. package/ccw/frontend/dist/assets/{DeepWikiPage-CDA3xm3R.js → DeepWikiPage-2YIlfWhz.js} +2 -2
  49. package/ccw/frontend/dist/assets/{DeepWikiPage-CDA3xm3R.js.map → DeepWikiPage-2YIlfWhz.js.map} +1 -1
  50. package/ccw/frontend/dist/assets/{EndpointsPage-Bu7iU0Wy.js → EndpointsPage-CMVNz5PY.js} +2 -2
  51. package/ccw/frontend/dist/assets/{EndpointsPage-Bu7iU0Wy.js.map → EndpointsPage-CMVNz5PY.js.map} +1 -1
  52. package/ccw/frontend/dist/assets/{ExplorerPage-xim2cboZ.js → ExplorerPage-C-KFz8YU.js} +2 -2
  53. package/ccw/frontend/dist/assets/{ExplorerPage-xim2cboZ.js.map → ExplorerPage-C-KFz8YU.js.map} +1 -1
  54. package/ccw/frontend/dist/assets/{FixSessionPage-BTFYoFQF.js → FixSessionPage-CdKND69l.js} +2 -2
  55. package/ccw/frontend/dist/assets/{FixSessionPage-BTFYoFQF.js.map → FixSessionPage-CdKND69l.js.map} +1 -1
  56. package/ccw/frontend/dist/assets/{FloatingFileBrowser-B30ANzTJ.js → FloatingFileBrowser-Bf4iqOSd.js} +2 -2
  57. package/ccw/frontend/dist/assets/{FloatingFileBrowser-B30ANzTJ.js.map → FloatingFileBrowser-Bf4iqOSd.js.map} +1 -1
  58. package/ccw/frontend/dist/assets/{FloatingPanel-Ds84B7Ob.js → FloatingPanel-CJbvABPb.js} +2 -2
  59. package/ccw/frontend/dist/assets/{FloatingPanel-Ds84B7Ob.js.map → FloatingPanel-CJbvABPb.js.map} +1 -1
  60. package/ccw/frontend/dist/assets/{GraphExplorerPage-DJ4YnFOQ.js → GraphExplorerPage-DPoozRTR.js} +2 -2
  61. package/ccw/frontend/dist/assets/{GraphExplorerPage-DJ4YnFOQ.js.map → GraphExplorerPage-DPoozRTR.js.map} +1 -1
  62. package/ccw/frontend/dist/assets/{HistoryPage-rzLVsw11.js → HistoryPage-DOMa9gJX.js} +2 -2
  63. package/ccw/frontend/dist/assets/{HistoryPage-rzLVsw11.js.map → HistoryPage-DOMa9gJX.js.map} +1 -1
  64. package/ccw/frontend/dist/assets/{HookManagerPage-DizO_dCP.js → HookManagerPage-Cfn2UEyy.js} +2 -2
  65. package/ccw/frontend/dist/assets/{HookManagerPage-DizO_dCP.js.map → HookManagerPage-Cfn2UEyy.js.map} +1 -1
  66. package/ccw/frontend/dist/assets/{InstallationsPage-BFamuE4y.js → InstallationsPage-qngOxLvm.js} +2 -2
  67. package/ccw/frontend/dist/assets/{InstallationsPage-BFamuE4y.js.map → InstallationsPage-qngOxLvm.js.map} +1 -1
  68. package/ccw/frontend/dist/assets/{IssueHubPage-DHwQWuUc.js → IssueHubPage-Cvf7tH8p.js} +2 -2
  69. package/ccw/frontend/dist/assets/{IssueHubPage-DHwQWuUc.js.map → IssueHubPage-Cvf7tH8p.js.map} +1 -1
  70. package/ccw/frontend/dist/assets/{LiteTasksPage-DMDkG7pi.js → LiteTasksPage-D20smVCY.js} +2 -2
  71. package/ccw/frontend/dist/assets/{LiteTasksPage-DMDkG7pi.js.map → LiteTasksPage-D20smVCY.js.map} +1 -1
  72. package/ccw/frontend/dist/assets/{McpManagerPage-CS2v_1OG.js → McpManagerPage-Bld27yu4.js} +2 -2
  73. package/ccw/frontend/dist/assets/{McpManagerPage-CS2v_1OG.js.map → McpManagerPage-Bld27yu4.js.map} +1 -1
  74. package/ccw/frontend/dist/assets/{MemoryPage-DhYPE-VC.js → MemoryPage-DmknNdBh.js} +2 -2
  75. package/ccw/frontend/dist/assets/{MemoryPage-DhYPE-VC.js.map → MemoryPage-DmknNdBh.js.map} +1 -1
  76. package/ccw/frontend/dist/assets/{NotFoundPage-BLmC7-ot.js → NotFoundPage-DdwPN1xU.js} +2 -2
  77. package/ccw/frontend/dist/assets/{NotFoundPage-BLmC7-ot.js.map → NotFoundPage-DdwPN1xU.js.map} +1 -1
  78. package/ccw/frontend/dist/assets/{OrchestratorPage-1jzSUFZW.js → OrchestratorPage-CgDdmvBg.js} +2 -2
  79. package/ccw/frontend/dist/assets/{OrchestratorPage-1jzSUFZW.js.map → OrchestratorPage-CgDdmvBg.js.map} +1 -1
  80. package/ccw/frontend/dist/assets/{ProjectOverviewPage-gWuAj-Cn.js → ProjectOverviewPage-9Ze9quxh.js} +2 -2
  81. package/ccw/frontend/dist/assets/{ProjectOverviewPage-gWuAj-Cn.js.map → ProjectOverviewPage-9Ze9quxh.js.map} +1 -1
  82. package/ccw/frontend/dist/assets/{PromptHistoryPage-q7ySVNHM.js → PromptHistoryPage-YRkBppOx.js} +2 -2
  83. package/ccw/frontend/dist/assets/{PromptHistoryPage-q7ySVNHM.js.map → PromptHistoryPage-YRkBppOx.js.map} +1 -1
  84. package/ccw/frontend/dist/assets/{ReviewSessionPage-DX1uT_nH.js → ReviewSessionPage-DSaeHw83.js} +2 -2
  85. package/ccw/frontend/dist/assets/{ReviewSessionPage-DX1uT_nH.js.map → ReviewSessionPage-DSaeHw83.js.map} +1 -1
  86. package/ccw/frontend/dist/assets/{RulesManagerPage-Bg6T5W-W.js → RulesManagerPage-BpGwS_jB.js} +2 -2
  87. package/ccw/frontend/dist/assets/{RulesManagerPage-Bg6T5W-W.js.map → RulesManagerPage-BpGwS_jB.js.map} +1 -1
  88. package/ccw/frontend/dist/assets/{SessionDetailPage-C_ig6JSh.js → SessionDetailPage-B_YHME7k.js} +2 -2
  89. package/ccw/frontend/dist/assets/{SessionDetailPage-C_ig6JSh.js.map → SessionDetailPage-B_YHME7k.js.map} +1 -1
  90. package/ccw/frontend/dist/assets/{SessionsPage-BENFqFDn.js → SessionsPage-bW6kEEib.js} +2 -2
  91. package/ccw/frontend/dist/assets/{SessionsPage-BENFqFDn.js.map → SessionsPage-bW6kEEib.js.map} +1 -1
  92. package/ccw/frontend/dist/assets/{SettingsPage-2c-oTxfz.js → SettingsPage-CSwUd2Bw.js} +4 -4
  93. package/ccw/frontend/dist/assets/{SettingsPage-2c-oTxfz.js.map → SettingsPage-CSwUd2Bw.js.map} +1 -1
  94. package/ccw/frontend/dist/assets/{SkillsManagerPage-GLo6DXnt.js → SkillsManagerPage-CyqKvFUi.js} +2 -2
  95. package/ccw/frontend/dist/assets/{SkillsManagerPage-GLo6DXnt.js.map → SkillsManagerPage-CyqKvFUi.js.map} +1 -1
  96. package/ccw/frontend/dist/assets/{SpecsSettingsPage-CRqMV90p.js → SpecsSettingsPage-DHqQNW_y.js} +2 -2
  97. package/ccw/frontend/dist/assets/{SpecsSettingsPage-CRqMV90p.js.map → SpecsSettingsPage-DHqQNW_y.js.map} +1 -1
  98. package/ccw/frontend/dist/assets/{Switch-vlMavMRD.js → Switch-s_-xzEWF.js} +2 -2
  99. package/ccw/frontend/dist/assets/{Switch-vlMavMRD.js.map → Switch-s_-xzEWF.js.map} +1 -1
  100. package/ccw/frontend/dist/assets/{TabsNavigation-CLKz7pWP.js → TabsNavigation-CU50UxOb.js} +2 -2
  101. package/ccw/frontend/dist/assets/{TabsNavigation-CLKz7pWP.js.map → TabsNavigation-CU50UxOb.js.map} +1 -1
  102. package/ccw/frontend/dist/assets/{TaskDrawer-BAFvNqF8.js → TaskDrawer-128XISsA.js} +2 -2
  103. package/ccw/frontend/dist/assets/{TaskDrawer-BAFvNqF8.js.map → TaskDrawer-128XISsA.js.map} +1 -1
  104. package/ccw/frontend/dist/assets/{TeamPage-C2IsDkAv.js → TeamPage-Bg_KII8B.js} +2 -2
  105. package/ccw/frontend/dist/assets/{TeamPage-C2IsDkAv.js.map → TeamPage-Bg_KII8B.js.map} +1 -1
  106. package/ccw/frontend/dist/assets/{TerminalDashboardPage-mgS-iKDm.js → TerminalDashboardPage-CQ9K2zwB.js} +2 -2
  107. package/ccw/frontend/dist/assets/{TerminalDashboardPage-mgS-iKDm.js.map → TerminalDashboardPage-CQ9K2zwB.js.map} +1 -1
  108. package/ccw/frontend/dist/assets/{archive-CxxK_YIp.js → archive--nR2vYUk.js} +2 -2
  109. package/ccw/frontend/dist/assets/{archive-CxxK_YIp.js.map → archive--nR2vYUk.js.map} +1 -1
  110. package/ccw/frontend/dist/assets/{archive-restore-DZsrBaeG.js → archive-restore-CZ7graO0.js} +2 -2
  111. package/ccw/frontend/dist/assets/{archive-restore-DZsrBaeG.js.map → archive-restore-CZ7graO0.js.map} +1 -1
  112. package/ccw/frontend/dist/assets/{arrow-right-BotRHOhr.js → arrow-right-ChKhpVhq.js} +2 -2
  113. package/ccw/frontend/dist/assets/{arrow-right-BotRHOhr.js.map → arrow-right-ChKhpVhq.js.map} +1 -1
  114. package/ccw/frontend/dist/assets/{bookmark-plus-C0MWZ3S9.js → bookmark-plus-X-JcgObI.js} +2 -2
  115. package/ccw/frontend/dist/assets/{bookmark-plus-C0MWZ3S9.js.map → bookmark-plus-X-JcgObI.js.map} +1 -1
  116. package/ccw/frontend/dist/assets/{bot-BcHFJXqD.js → bot-C3uo7Fkg.js} +2 -2
  117. package/ccw/frontend/dist/assets/{bot-BcHFJXqD.js.map → bot-C3uo7Fkg.js.map} +1 -1
  118. package/ccw/frontend/dist/assets/{braces-D_p0IZhP.js → braces-5wZupwrA.js} +2 -2
  119. package/ccw/frontend/dist/assets/{braces-D_p0IZhP.js.map → braces-5wZupwrA.js.map} +1 -1
  120. package/ccw/frontend/dist/assets/{circle-stop-Bt634NUt.js → circle-stop-DZ5hLKjQ.js} +2 -2
  121. package/ccw/frontend/dist/assets/{circle-stop-Bt634NUt.js.map → circle-stop-DZ5hLKjQ.js.map} +1 -1
  122. package/ccw/frontend/dist/assets/{cpu-DjeGKtvT.js → cpu-Dc8IS79i.js} +2 -2
  123. package/ccw/frontend/dist/assets/{cpu-DjeGKtvT.js.map → cpu-Dc8IS79i.js.map} +1 -1
  124. package/ccw/frontend/dist/assets/{ellipsis-vertical-BmNPuatq.js → ellipsis-vertical-B4pqbrsR.js} +2 -2
  125. package/ccw/frontend/dist/assets/{ellipsis-vertical-BmNPuatq.js.map → ellipsis-vertical-B4pqbrsR.js.map} +1 -1
  126. package/ccw/frontend/dist/assets/{eye-B0-xkP67.js → eye-BwniwXnu.js} +2 -2
  127. package/ccw/frontend/dist/assets/{eye-B0-xkP67.js.map → eye-BwniwXnu.js.map} +1 -1
  128. package/ccw/frontend/dist/assets/{eye-off-Bz0Fkli3.js → eye-off-BWntEdln.js} +2 -2
  129. package/ccw/frontend/dist/assets/{eye-off-Bz0Fkli3.js.map → eye-off-BWntEdln.js.map} +1 -1
  130. package/ccw/frontend/dist/assets/{file-json-PUAS4vBm.js → file-json-BDcmkaVn.js} +2 -2
  131. package/ccw/frontend/dist/assets/{file-json-PUAS4vBm.js.map → file-json-BDcmkaVn.js.map} +1 -1
  132. package/ccw/frontend/dist/assets/{file-text-BMeW5-Sb.js → file-text-DsqI3R_g.js} +2 -2
  133. package/ccw/frontend/dist/assets/{file-text-BMeW5-Sb.js.map → file-text-DsqI3R_g.js.map} +1 -1
  134. package/ccw/frontend/dist/assets/{filter-B4wgMvwi.js → filter-CQMcD8RT.js} +2 -2
  135. package/ccw/frontend/dist/assets/{filter-B4wgMvwi.js.map → filter-CQMcD8RT.js.map} +1 -1
  136. package/ccw/frontend/dist/assets/{folder-BSHjjjND.js → folder-jX77-MUi.js} +2 -2
  137. package/ccw/frontend/dist/assets/{folder-BSHjjjND.js.map → folder-jX77-MUi.js.map} +1 -1
  138. package/ccw/frontend/dist/assets/{gauge-7VRNEl22.js → gauge-yQjRXM3o.js} +2 -2
  139. package/ccw/frontend/dist/assets/{gauge-7VRNEl22.js.map → gauge-yQjRXM3o.js.map} +1 -1
  140. package/ccw/frontend/dist/assets/{globe-PvVHBjbW.js → globe-BecpCHYI.js} +2 -2
  141. package/ccw/frontend/dist/assets/{globe-PvVHBjbW.js.map → globe-BecpCHYI.js.map} +1 -1
  142. package/ccw/frontend/dist/assets/{grid-3x3-CsmmDlhN.js → grid-3x3-BrvzDFqU.js} +2 -2
  143. package/ccw/frontend/dist/assets/{grid-3x3-CsmmDlhN.js.map → grid-3x3-BrvzDFqU.js.map} +1 -1
  144. package/ccw/frontend/dist/assets/{hard-drive-D88EZgTY.js → hard-drive-B0cynodE.js} +2 -2
  145. package/ccw/frontend/dist/assets/{hard-drive-D88EZgTY.js.map → hard-drive-B0cynodE.js.map} +1 -1
  146. package/ccw/frontend/dist/assets/{hash-CZpNRWqt.js → hash-xOrTLxBg.js} +2 -2
  147. package/ccw/frontend/dist/assets/{hash-CZpNRWqt.js.map → hash-xOrTLxBg.js.map} +1 -1
  148. package/ccw/frontend/dist/assets/{history-DxN1mopa.js → history-BzXwj8RL.js} +2 -2
  149. package/ccw/frontend/dist/assets/{history-DxN1mopa.js.map → history-BzXwj8RL.js.map} +1 -1
  150. package/ccw/frontend/dist/assets/{index-C04xeBGC.js → index-B9aFbBPN.js} +2 -2
  151. package/ccw/frontend/dist/assets/{index-C04xeBGC.js.map → index-B9aFbBPN.js.map} +1 -1
  152. package/ccw/frontend/dist/assets/{index-BzGEkwIf.js → index-BNZGm_Ur.js} +2 -2
  153. package/ccw/frontend/dist/assets/{index-BzGEkwIf.js.map → index-BNZGm_Ur.js.map} +1 -1
  154. package/ccw/frontend/dist/assets/{index-bSgtHHOF.js → index-D3uMibtZ.js} +4 -4
  155. package/ccw/frontend/dist/assets/{index-bSgtHHOF.js.map → index-D3uMibtZ.js.map} +1 -1
  156. package/ccw/frontend/dist/assets/{index-BUiq2PUK.js → index-DflI9CwB.js} +2 -2
  157. package/ccw/frontend/dist/assets/{index-BUiq2PUK.js.map → index-DflI9CwB.js.map} +1 -1
  158. package/ccw/frontend/dist/assets/{index-CIoWWkDn.js → index-Dy0tUf1F.js} +2 -2
  159. package/ccw/frontend/dist/assets/{index-CIoWWkDn.js.map → index-Dy0tUf1F.js.map} +1 -1
  160. package/ccw/frontend/dist/assets/{index-DlcRFzFq.js → index-osmL8__2.js} +2 -2
  161. package/ccw/frontend/dist/assets/{index-DlcRFzFq.js.map → index-osmL8__2.js.map} +1 -1
  162. package/ccw/frontend/dist/assets/{layout-grid-BZqfuNG0.js → layout-grid-CWFZqQWu.js} +2 -2
  163. package/ccw/frontend/dist/assets/{layout-grid-BZqfuNG0.js.map → layout-grid-CWFZqQWu.js.map} +1 -1
  164. package/ccw/frontend/dist/assets/{lightbulb-DqJ4OHRL.js → lightbulb-BRLgsWe3.js} +2 -2
  165. package/ccw/frontend/dist/assets/{lightbulb-DqJ4OHRL.js.map → lightbulb-BRLgsWe3.js.map} +1 -1
  166. package/ccw/frontend/dist/assets/{link-2-Bq7fLkC9.js → link-2-BpKdq14u.js} +2 -2
  167. package/ccw/frontend/dist/assets/{link-2-Bq7fLkC9.js.map → link-2-BpKdq14u.js.map} +1 -1
  168. package/ccw/frontend/dist/assets/{link-dSLYjCIG.js → link-BxUCReDi.js} +2 -2
  169. package/ccw/frontend/dist/assets/{link-dSLYjCIG.js.map → link-BxUCReDi.js.map} +1 -1
  170. package/ccw/frontend/dist/assets/{list-Bm_CnR56.js → list-Ce9EsAg8.js} +2 -2
  171. package/ccw/frontend/dist/assets/{list-Bm_CnR56.js.map → list-Ce9EsAg8.js.map} +1 -1
  172. package/ccw/frontend/dist/assets/{map-pin-B5TELa0z.js → map-pin-CxzQV1hS.js} +2 -2
  173. package/ccw/frontend/dist/assets/{map-pin-B5TELa0z.js.map → map-pin-CxzQV1hS.js.map} +1 -1
  174. package/ccw/frontend/dist/assets/{messages-square-B9sWItdK.js → messages-square-Dyodk79r.js} +2 -2
  175. package/ccw/frontend/dist/assets/{messages-square-B9sWItdK.js.map → messages-square-Dyodk79r.js.map} +1 -1
  176. package/ccw/frontend/dist/assets/{minimize-2-Z1MYs_Tp.js → minimize-2-s0009UK9.js} +2 -2
  177. package/ccw/frontend/dist/assets/{minimize-2-Z1MYs_Tp.js.map → minimize-2-s0009UK9.js.map} +1 -1
  178. package/ccw/frontend/dist/assets/{package-EEv4N_Qk.js → package-C69biuJL.js} +2 -2
  179. package/ccw/frontend/dist/assets/{package-EEv4N_Qk.js.map → package-C69biuJL.js.map} +1 -1
  180. package/ccw/frontend/dist/assets/{plug-CEkvvYXh.js → plug-DERl-wQd.js} +2 -2
  181. package/ccw/frontend/dist/assets/{plug-CEkvvYXh.js.map → plug-DERl-wQd.js.map} +1 -1
  182. package/ccw/frontend/dist/assets/{power-B6Rod0u_.js → power-CdvaDgTh.js} +2 -2
  183. package/ccw/frontend/dist/assets/{power-B6Rod0u_.js.map → power-CdvaDgTh.js.map} +1 -1
  184. package/ccw/frontend/dist/assets/{save-DULWrB2g.js → save-C_Uot2e4.js} +2 -2
  185. package/ccw/frontend/dist/assets/{save-DULWrB2g.js.map → save-C_Uot2e4.js.map} +1 -1
  186. package/ccw/frontend/dist/assets/{send-C4z974WG.js → send-R1XtAXeP.js} +2 -2
  187. package/ccw/frontend/dist/assets/{send-C4z974WG.js.map → send-R1XtAXeP.js.map} +1 -1
  188. package/ccw/frontend/dist/assets/{square-check-big-CqEEw-V0.js → square-check-big-Cyqi4INj.js} +2 -2
  189. package/ccw/frontend/dist/assets/{square-check-big-CqEEw-V0.js.map → square-check-big-Cyqi4INj.js.map} +1 -1
  190. package/ccw/frontend/dist/assets/{square-pen-D-4BrMtQ.js → square-pen-BmLNjUUw.js} +2 -2
  191. package/ccw/frontend/dist/assets/{square-pen-D-4BrMtQ.js.map → square-pen-BmLNjUUw.js.map} +1 -1
  192. package/ccw/frontend/dist/assets/{star-CDVVM69o.js → star-CakKtIYu.js} +2 -2
  193. package/ccw/frontend/dist/assets/{star-CDVVM69o.js.map → star-CakKtIYu.js.map} +1 -1
  194. package/ccw/frontend/dist/assets/{style-CumJ7XC8.js → style-DdNmehyz.js} +2 -2
  195. package/ccw/frontend/dist/assets/{style-CumJ7XC8.js.map → style-DdNmehyz.js.map} +1 -1
  196. package/ccw/frontend/dist/assets/{target-Dr9SuV1Y.js → target-CUvfwM3S.js} +2 -2
  197. package/ccw/frontend/dist/assets/{target-Dr9SuV1Y.js.map → target-CUvfwM3S.js.map} +1 -1
  198. package/ccw/frontend/dist/assets/{test-tube-DzDRKk8F.js → test-tube-BVwrOGiZ.js} +2 -2
  199. package/ccw/frontend/dist/assets/{test-tube-DzDRKk8F.js.map → test-tube-BVwrOGiZ.js.map} +1 -1
  200. package/ccw/frontend/dist/assets/{upload-CihSmIM7.js → upload-CY1NwcDw.js} +2 -2
  201. package/ccw/frontend/dist/assets/{upload-CihSmIM7.js.map → upload-CY1NwcDw.js.map} +1 -1
  202. package/ccw/frontend/dist/assets/{useApiSettings-CevxWX2z.js → useApiSettings-9JuzUfPE.js} +2 -2
  203. package/ccw/frontend/dist/assets/{useApiSettings-CevxWX2z.js.map → useApiSettings-9JuzUfPE.js.map} +1 -1
  204. package/ccw/frontend/dist/assets/{useCli-jVaF89uU.js → useCli-Bb7Zo-OI.js} +2 -2
  205. package/ccw/frontend/dist/assets/{useCli-jVaF89uU.js.map → useCli-Bb7Zo-OI.js.map} +1 -1
  206. package/ccw/frontend/dist/assets/{useCommands-D4uGmNpF.js → useCommands-BUu-hUYI.js} +2 -2
  207. package/ccw/frontend/dist/assets/{useCommands-D4uGmNpF.js.map → useCommands-BUu-hUYI.js.map} +1 -1
  208. package/ccw/frontend/dist/assets/{useDebounce-BEYmuZYP.js → useDebounce-CptXgLBn.js} +2 -2
  209. package/ccw/frontend/dist/assets/{useDebounce-BEYmuZYP.js.map → useDebounce-CptXgLBn.js.map} +1 -1
  210. package/ccw/frontend/dist/assets/{useFileExplorer-DEv0DVy7.js → useFileExplorer-B7dN8VT1.js} +2 -2
  211. package/ccw/frontend/dist/assets/{useFileExplorer-DEv0DVy7.js.map → useFileExplorer-B7dN8VT1.js.map} +1 -1
  212. package/ccw/frontend/dist/assets/{useLocale-BRJreqvl.js → useLocale-D6USNXOr.js} +2 -2
  213. package/ccw/frontend/dist/assets/{useLocale-BRJreqvl.js.map → useLocale-D6USNXOr.js.map} +1 -1
  214. package/ccw/frontend/dist/assets/{useSkills-lnfeXe9l.js → useSkills-r8yfiQ-u.js} +3 -3
  215. package/ccw/frontend/dist/assets/{useSkills-lnfeXe9l.js.map → useSkills-r8yfiQ-u.js.map} +1 -1
  216. package/ccw/frontend/dist/assets/{useSystemSettings-PlxVdbXI.js → useSystemSettings-BVWDQLMy.js} +2 -2
  217. package/ccw/frontend/dist/assets/{useSystemSettings-PlxVdbXI.js.map → useSystemSettings-BVWDQLMy.js.map} +1 -1
  218. package/ccw/frontend/dist/assets/{wand-sparkles-BbqUxeEg.js → wand-sparkles-Zdaej5bR.js} +2 -2
  219. package/ccw/frontend/dist/assets/{wand-sparkles-BbqUxeEg.js.map → wand-sparkles-Zdaej5bR.js.map} +1 -1
  220. package/ccw/frontend/dist/index.html +1 -1
  221. package/package.json +1 -1
@@ -1,5 +1,5 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-bSgtHHOF.js","assets/index-BYlfG3iS.css"])))=>i.map(i=>d[i]);
2
- import{O as Z,r as d,ab as vs,u as O,co as Se,j as e,al as ws,cp as ys,cq as he,cr as Oe,cs as ks,ct as J,cu as Cs,cv as Ss,cw as Ts,cx as Ms,aq as Es,ar as Fs,as as ze,c as I,at as Ls,au as Us,C as V,B as _,bq as W,e as b,X as G,cy as Te,ap as Me,cz as Ds,cA as Ps,cB as Ee,aV as qe,cC as Is,I as H,_ as A,R as Y,a7 as ke,cD as Rs,bu as $e,U as Hs,l as As,cE as ge,cF as Os,cG as zs,cH as $s,S as Vs,cI as Bs,cJ as Ve,aw as Fe,cK as _s,aP as qs,an as Ws,cL as Gs,i as Ks,F as Js,N as Xs,aU as Qs,bX as Ys}from"./index-bSgtHHOF.js";import{A as Zs,a as et,b as st,c as tt,d as at,e as nt,f as rt,g as it}from"./AlertDialog-CFGtc76Y.js";import{u as lt,a as ot,b as ct,c as dt,d as mt,e as ut,f as xt,g as ht,h as gt,i as ft,j as pt,k as bt,l as jt}from"./useSystemSettings-PlxVdbXI.js";import{u as Nt}from"./useLocale-BRJreqvl.js";import{T as vt}from"./test-tube-DzDRKk8F.js";import{L as wt}from"./link-dSLYjCIG.js";import{S as yt}from"./send-C4z974WG.js";import{E as ee}from"./eye-off-Bz0Fkli3.js";import{E as se}from"./eye-B0-xkP67.js";import{S as We}from"./save-DULWrB2g.js";import{u as kt}from"./useDebounce-BEYmuZYP.js";import{C as Ge}from"./cpu-DjeGKtvT.js";import{U as Ct}from"./upload-CihSmIM7.js";import{P as St}from"./package-EEv4N_Qk.js";import{F as Tt}from"./folder-BSHjjjND.js";/**
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-D3uMibtZ.js","assets/index-BYlfG3iS.css"])))=>i.map(i=>d[i]);
2
+ import{O as Z,r as d,ab as vs,u as O,co as Se,j as e,al as ws,cp as ys,cq as he,cr as Oe,cs as ks,ct as J,cu as Cs,cv as Ss,cw as Ts,cx as Ms,aq as Es,ar as Fs,as as ze,c as I,at as Ls,au as Us,C as V,B as _,bq as W,e as b,X as G,cy as Te,ap as Me,cz as Ds,cA as Ps,cB as Ee,aV as qe,cC as Is,I as H,_ as A,R as Y,a7 as ke,cD as Rs,bu as $e,U as Hs,l as As,cE as ge,cF as Os,cG as zs,cH as $s,S as Vs,cI as Bs,cJ as Ve,aw as Fe,cK as _s,aP as qs,an as Ws,cL as Gs,i as Ks,F as Js,N as Xs,aU as Qs,bX as Ys}from"./index-D3uMibtZ.js";import{A as Zs,a as et,b as st,c as tt,d as at,e as nt,f as rt,g as it}from"./AlertDialog-BMFUcfv_.js";import{u as lt,a as ot,b as ct,c as dt,d as mt,e as ut,f as xt,g as ht,h as gt,i as ft,j as pt,k as bt,l as jt}from"./useSystemSettings-BVWDQLMy.js";import{u as Nt}from"./useLocale-D6USNXOr.js";import{T as vt}from"./test-tube-BVwrOGiZ.js";import{L as wt}from"./link-BxUCReDi.js";import{S as yt}from"./send-R1XtAXeP.js";import{E as ee}from"./eye-off-BWntEdln.js";import{E as se}from"./eye-BwniwXnu.js";import{S as We}from"./save-C_Uot2e4.js";import{u as kt}from"./useDebounce-CptXgLBn.js";import{C as Ge}from"./cpu-Dc8IS79i.js";import{U as Ct}from"./upload-CY1NwcDw.js";import{P as St}from"./package-C69biuJL.js";import{F as Tt}from"./folder-jX77-MUi.js";/**
3
3
  * @license lucide-react v0.460.0 - ISC
4
4
  *
5
5
  * This source code is licensed under the ISC license.
@@ -140,5 +140,5 @@ import{O as Z,r as d,ab as vs,u as O,co as Se,j as e,al as ws,cp as ys,cq as he,
140
140
  border-2 border-border bg-bg text-text\r
141
141
  hover:bg-surface transition-all duration-200\r
142
142
  focus:outline-none focus:ring-2 focus:ring-accent focus:ring-offset-2\r
143
- `,children:s({id:"theme.share.cancel"})})]})]})]}),e.jsx(Zs,{open:le!==null,onOpenChange:Ae,children:e.jsxs(et,{children:[e.jsxs(st,{children:[e.jsx(tt,{children:"Delete Theme Slot?"}),e.jsx(at,{children:"This action cannot be undone. The theme slot will be permanently deleted."})]}),e.jsxs(nt,{children:[e.jsx(rt,{onClick:Ae,children:"Cancel"}),e.jsx(it,{onClick:xs,children:"Delete"})]})]})})]})]})}const Ot=[{value:"en",label:"English",flag:"🇺🇸"},{value:"zh",label:"中文",flag:"🇨🇳"}];function zt({compact:s=!1,className:t}){const{locale:a,setLocale:i}=Nt();return e.jsxs(Es,{value:a,onValueChange:i,children:[e.jsx(Fs,{className:I(s?"w-[110px]":"w-[160px]","gap-2",t),"aria-label":"Select language",children:s?e.jsxs(e.Fragment,{children:[e.jsx(Je,{className:"w-4 h-4"}),e.jsx(ze,{})]}):e.jsx(ze,{})}),e.jsx(Ls,{children:Ot.map(c=>e.jsx(Us,{value:c.value,children:e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-base",children:c.flag}),e.jsx("span",{children:c.label})]})},c.value))})]})}const Ce={discord:{id:"discord",name:"Discord",icon:"message-circle",description:"Send notifications to Discord channels via webhook",requiredFields:["webhookUrl"]},telegram:{id:"telegram",name:"Telegram",icon:"send",description:"Send notifications to Telegram chats via bot",requiredFields:["botToken","chatId"]},feishu:{id:"feishu",name:"Feishu",icon:"message-square",description:"Send notifications to Feishu (Lark) via webhook with rich card support",requiredFields:["webhookUrl"]},dingtalk:{id:"dingtalk",name:"DingTalk",icon:"bell",description:"Send notifications to DingTalk via webhook",requiredFields:["webhookUrl"]},wecom:{id:"wecom",name:"WeCom",icon:"users",description:"Send notifications to WeCom (WeChat Work) via webhook",requiredFields:["webhookUrl"]},email:{id:"email",name:"Email",icon:"mail",description:"Send notifications via SMTP email",requiredFields:["host","username","password","from","to"]},webhook:{id:"webhook",name:"Custom Webhook",icon:"link",description:"Send notifications to a custom HTTP endpoint",requiredFields:["url"]}},$t={"ask-user-question":{id:"ask-user-question",name:"Ask User Question",description:"Notification when Claude asks a question via AskUserQuestion",icon:"help-circle"},"session-start":{id:"session-start",name:"Session Start",description:"Notification when a CLI session starts",icon:"play"},"session-end":{id:"session-end",name:"Session End",description:"Notification when a CLI session ends",icon:"square"},"task-completed":{id:"task-completed",name:"Task Completed",description:"Notification when a task completes successfully",icon:"check-circle"},"task-failed":{id:"task-failed",name:"Task Failed",description:"Notification when a task fails",icon:"alert-circle"}};function Be(){return{enabled:!1,platforms:{},events:[{event:"ask-user-question",platforms:["discord","telegram"],enabled:!0},{event:"session-start",platforms:[],enabled:!1},{event:"session-end",platforms:[],enabled:!1},{event:"task-completed",platforms:[],enabled:!1},{event:"task-failed",platforms:["discord","telegram"],enabled:!0}],timeout:1e4}}function Vt({config:s,expandedPlatform:t,testing:a,onToggleExpand:i,onUpdateConfig:c,onTest:o,onSave:u,saving:p}){const{formatMessage:M}=O(),g=["discord","telegram","feishu","dingtalk","wecom","email","webhook"],F=x=>{switch(x){case"discord":return e.jsx(Is,{className:"w-4 h-4"});case"telegram":return e.jsx(yt,{className:"w-4 h-4"});case"feishu":return e.jsx(qe,{className:"w-4 h-4"});case"dingtalk":return e.jsx(Ee,{className:"w-4 h-4"});case"wecom":return e.jsx(Ps,{className:"w-4 h-4"});case"email":return e.jsx(Ds,{className:"w-4 h-4"});case"webhook":return e.jsx(wt,{className:"w-4 h-4"})}},y=x=>{switch(x){case"discord":return s.platforms.discord||{enabled:!1,webhookUrl:""};case"telegram":return s.platforms.telegram||{enabled:!1,botToken:"",chatId:""};case"feishu":return s.platforms.feishu||{enabled:!1,webhookUrl:""};case"dingtalk":return s.platforms.dingtalk||{enabled:!1,webhookUrl:""};case"wecom":return s.platforms.wecom||{enabled:!1,webhookUrl:""};case"email":return s.platforms.email||{enabled:!1,host:"",port:587,username:"",password:"",from:"",to:[]};case"webhook":return s.platforms.webhook||{enabled:!1,url:"",method:"POST"}}},L=x=>{var w;const j=y(x);switch(x){case"discord":return!!j.webhookUrl;case"telegram":return!!j.botToken&&!!j.chatId;case"feishu":return!!j.webhookUrl;case"dingtalk":return!!j.webhookUrl;case"wecom":return!!j.webhookUrl;case"email":const m=j;return!!(m.host&&m.username&&m.password&&m.from&&((w=m.to)==null?void 0:w.length)>0);case"webhook":return!!j.url}};return e.jsx("div",{className:"grid gap-3",children:g.map(x=>{const j=Ce[x],w=y(x),m=L(x),D=t===x;return e.jsxs(V,{className:"overflow-hidden",children:[e.jsx("div",{className:"p-4 cursor-pointer hover:bg-muted/50 transition-colors",onClick:()=>i(D?null:x),children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:I("p-2 rounded-lg",w.enabled&&m?"bg-primary/10 text-primary":"bg-muted text-muted-foreground"),children:F(x)}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-sm font-medium",children:j.name}),m&&e.jsxs(_,{variant:"outline",className:"text-xs text-green-600 border-green-500/30",children:[e.jsx(W,{className:"w-3 h-3 mr-1"}),M({id:"settings.remoteNotifications.configured"})]})]}),e.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:j.description})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(b,{variant:w.enabled?"default":"outline",size:"sm",className:"h-7",onClick:k=>{k.stopPropagation(),c(x,{enabled:!w.enabled})},children:w.enabled?e.jsx(W,{className:"w-3.5 h-3.5"}):e.jsx(G,{className:"w-3.5 h-3.5"})}),D?e.jsx(Te,{className:"w-4 h-4 text-muted-foreground"}):e.jsx(Me,{className:"w-4 h-4 text-muted-foreground"})]})]})}),D&&e.jsxs("div",{className:"border-t border-border p-4 space-y-4 bg-muted/30",children:[x==="discord"&&e.jsx(Bt,{config:w,onUpdate:k=>c("discord",k)}),x==="telegram"&&e.jsx(_t,{config:w,onUpdate:k=>c("telegram",k)}),x==="feishu"&&e.jsx(Wt,{config:w,onUpdate:k=>c("feishu",k)}),x==="dingtalk"&&e.jsx(Gt,{config:w,onUpdate:k=>c("dingtalk",k)}),x==="wecom"&&e.jsx(Kt,{config:w,onUpdate:k=>c("wecom",k)}),x==="email"&&e.jsx(Jt,{config:w,onUpdate:k=>c("email",k)}),x==="webhook"&&e.jsx(qt,{config:w,onUpdate:k=>c("webhook",k)}),e.jsxs("div",{className:"flex items-center gap-2 pt-2",children:[e.jsxs(b,{variant:"outline",size:"sm",onClick:()=>o(x,w),disabled:a===x||!m,children:[e.jsx(vt,{className:I("w-3.5 h-3.5 mr-1",a===x&&"animate-pulse")}),M({id:"settings.remoteNotifications.testConnection"})]}),e.jsx(b,{variant:"default",size:"sm",onClick:u,disabled:p,children:M({id:"settings.remoteNotifications.save"})})]})]})]},x)})})}function Bt({config:s,onUpdate:t}){const{formatMessage:a}=O(),[i,c]=d.useState(!1);return e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium text-foreground",children:a({id:"settings.remoteNotifications.discord.webhookUrl"})}),e.jsxs("div",{className:"flex gap-2 mt-1",children:[e.jsx(H,{type:i?"text":"password",value:s.webhookUrl||"",onChange:o=>t({webhookUrl:o.target.value}),placeholder:"https://discord.com/api/webhooks/...",className:"flex-1"}),e.jsx(b,{variant:"outline",size:"sm",className:"shrink-0",onClick:()=>c(!i),children:i?e.jsx(ee,{className:"w-4 h-4"}):e.jsx(se,{className:"w-4 h-4"})})]}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:a({id:"settings.remoteNotifications.discord.webhookUrlHint"})})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium text-foreground",children:a({id:"settings.remoteNotifications.discord.username"})}),e.jsx(H,{value:s.username||"",onChange:o=>t({username:o.target.value}),placeholder:"CCW Notification",className:"mt-1"})]})]})}function _t({config:s,onUpdate:t}){const{formatMessage:a}=O(),[i,c]=d.useState(!1);return e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium text-foreground",children:a({id:"settings.remoteNotifications.telegram.botToken"})}),e.jsxs("div",{className:"flex gap-2 mt-1",children:[e.jsx(H,{type:i?"text":"password",value:s.botToken||"",onChange:o=>t({botToken:o.target.value}),placeholder:"1234567890:ABCdefGHIjklMNOpqrsTUVwxyz",className:"flex-1"}),e.jsx(b,{variant:"outline",size:"sm",className:"shrink-0",onClick:()=>c(!i),children:i?e.jsx(ee,{className:"w-4 h-4"}):e.jsx(se,{className:"w-4 h-4"})})]}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:a({id:"settings.remoteNotifications.telegram.botTokenHint"})})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium text-foreground",children:a({id:"settings.remoteNotifications.telegram.chatId"})}),e.jsx(H,{value:s.chatId||"",onChange:o=>t({chatId:o.target.value}),placeholder:"-1001234567890",className:"mt-1"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:a({id:"settings.remoteNotifications.telegram.chatIdHint"})})]})]})}function qt({config:s,onUpdate:t}){const{formatMessage:a}=O();return e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium text-foreground",children:a({id:"settings.remoteNotifications.webhook.url"})}),e.jsx(H,{value:s.url||"",onChange:i=>t({url:i.target.value}),placeholder:"https://your-server.com/webhook",className:"mt-1"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium text-foreground",children:a({id:"settings.remoteNotifications.webhook.method"})}),e.jsxs("div",{className:"flex gap-2 mt-1",children:[e.jsx(b,{variant:s.method==="POST"?"default":"outline",size:"sm",onClick:()=>t({method:"POST"}),children:"POST"}),e.jsx(b,{variant:s.method==="PUT"?"default":"outline",size:"sm",onClick:()=>t({method:"PUT"}),children:"PUT"})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium text-foreground",children:a({id:"settings.remoteNotifications.webhook.headers"})}),e.jsx(H,{value:s.headers?JSON.stringify(s.headers):"",onChange:i=>{try{const c=i.target.value?JSON.parse(i.target.value):void 0;t({headers:c})}catch{}},placeholder:'{"Authorization": "Bearer token"}',className:"mt-1 font-mono text-xs"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:a({id:"settings.remoteNotifications.webhook.headersHint"})})]})]})}function Wt({config:s,onUpdate:t}){const{formatMessage:a}=O(),[i,c]=d.useState(!1);return e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium text-foreground",children:a({id:"settings.remoteNotifications.feishu.webhookUrl"})}),e.jsxs("div",{className:"flex gap-2 mt-1",children:[e.jsx(H,{type:i?"text":"password",value:s.webhookUrl||"",onChange:o=>t({webhookUrl:o.target.value}),placeholder:"https://open.feishu.cn/open-apis/bot/v2/hook/...",className:"flex-1"}),e.jsx(b,{variant:"outline",size:"sm",className:"shrink-0",onClick:()=>c(!i),children:i?e.jsx(ee,{className:"w-4 h-4"}):e.jsx(se,{className:"w-4 h-4"})})]}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:a({id:"settings.remoteNotifications.feishu.webhookUrlHint"})})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("input",{type:"checkbox",id:"feishu-useCard",checked:s.useCard||!1,onChange:o=>t({useCard:o.target.checked}),className:"rounded border-border"}),e.jsx("label",{htmlFor:"feishu-useCard",className:"text-sm font-medium text-foreground",children:a({id:"settings.remoteNotifications.feishu.useCard"})})]}),e.jsx("p",{className:"text-xs text-muted-foreground -mt-2",children:a({id:"settings.remoteNotifications.feishu.useCardHint"})}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium text-foreground",children:a({id:"settings.remoteNotifications.feishu.title"})}),e.jsx(H,{value:s.title||"",onChange:o=>t({title:o.target.value}),placeholder:"CCW Notification",className:"mt-1"})]})]})}function Gt({config:s,onUpdate:t}){var o;const{formatMessage:a}=O(),[i,c]=d.useState(!1);return e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium text-foreground",children:a({id:"settings.remoteNotifications.dingtalk.webhookUrl"})}),e.jsxs("div",{className:"flex gap-2 mt-1",children:[e.jsx(H,{type:i?"text":"password",value:s.webhookUrl||"",onChange:u=>t({webhookUrl:u.target.value}),placeholder:"https://oapi.dingtalk.com/robot/send?access_token=...",className:"flex-1"}),e.jsx(b,{variant:"outline",size:"sm",className:"shrink-0",onClick:()=>c(!i),children:i?e.jsx(ee,{className:"w-4 h-4"}):e.jsx(se,{className:"w-4 h-4"})})]}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:a({id:"settings.remoteNotifications.dingtalk.webhookUrlHint"})})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium text-foreground",children:a({id:"settings.remoteNotifications.dingtalk.keywords"})}),e.jsx(H,{value:((o=s.keywords)==null?void 0:o.join(", "))||"",onChange:u=>t({keywords:u.target.value.split(",").map(p=>p.trim()).filter(Boolean)}),placeholder:"keyword1, keyword2",className:"mt-1"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:a({id:"settings.remoteNotifications.dingtalk.keywordsHint"})})]})]})}function Kt({config:s,onUpdate:t}){var o;const{formatMessage:a}=O(),[i,c]=d.useState(!1);return e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium text-foreground",children:a({id:"settings.remoteNotifications.wecom.webhookUrl"})}),e.jsxs("div",{className:"flex gap-2 mt-1",children:[e.jsx(H,{type:i?"text":"password",value:s.webhookUrl||"",onChange:u=>t({webhookUrl:u.target.value}),placeholder:"https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=...",className:"flex-1"}),e.jsx(b,{variant:"outline",size:"sm",className:"shrink-0",onClick:()=>c(!i),children:i?e.jsx(ee,{className:"w-4 h-4"}):e.jsx(se,{className:"w-4 h-4"})})]}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:a({id:"settings.remoteNotifications.wecom.webhookUrlHint"})})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium text-foreground",children:a({id:"settings.remoteNotifications.wecom.mentionedList"})}),e.jsx(H,{value:((o=s.mentionedList)==null?void 0:o.join(", "))||"",onChange:u=>t({mentionedList:u.target.value.split(",").map(p=>p.trim()).filter(Boolean)}),placeholder:"userid1, userid2, @all",className:"mt-1"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:a({id:"settings.remoteNotifications.wecom.mentionedListHint"})})]})]})}function Jt({config:s,onUpdate:t}){var o;const{formatMessage:a}=O(),[i,c]=d.useState(!1);return e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium text-foreground",children:a({id:"settings.remoteNotifications.email.host"})}),e.jsx(H,{value:s.host||"",onChange:u=>t({host:u.target.value}),placeholder:"smtp.gmail.com",className:"mt-1"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:a({id:"settings.remoteNotifications.email.hostHint"})})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium text-foreground",children:a({id:"settings.remoteNotifications.email.port"})}),e.jsx(H,{type:"number",value:s.port||587,onChange:u=>t({port:parseInt(u.target.value,10)||587}),placeholder:"587",className:"mt-1"})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("input",{type:"checkbox",id:"email-secure",checked:s.secure||!1,onChange:u=>t({secure:u.target.checked}),className:"rounded border-border"}),e.jsx("label",{htmlFor:"email-secure",className:"text-sm font-medium text-foreground",children:a({id:"settings.remoteNotifications.email.secure"})})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium text-foreground",children:a({id:"settings.remoteNotifications.email.username"})}),e.jsx(H,{value:s.username||"",onChange:u=>t({username:u.target.value}),placeholder:"your-email@gmail.com",className:"mt-1"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium text-foreground",children:a({id:"settings.remoteNotifications.email.password"})}),e.jsxs("div",{className:"flex gap-2 mt-1",children:[e.jsx(H,{type:i?"text":"password",value:s.password||"",onChange:u=>t({password:u.target.value}),placeholder:"********",className:"flex-1"}),e.jsx(b,{variant:"outline",size:"sm",className:"shrink-0",onClick:()=>c(!i),children:i?e.jsx(ee,{className:"w-4 h-4"}):e.jsx(se,{className:"w-4 h-4"})})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium text-foreground",children:a({id:"settings.remoteNotifications.email.from"})}),e.jsx(H,{value:s.from||"",onChange:u=>t({from:u.target.value}),placeholder:"noreply@example.com",className:"mt-1"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium text-foreground",children:a({id:"settings.remoteNotifications.email.to"})}),e.jsx(H,{value:((o=s.to)==null?void 0:o.join(", "))||"",onChange:u=>t({to:u.target.value.split(",").map(p=>p.trim()).filter(Boolean)}),placeholder:"user1@example.com, user2@example.com",className:"mt-1"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:a({id:"settings.remoteNotifications.email.toHint"})})]})]})}function Xt({className:s}){const{formatMessage:t}=O(),[a,i]=d.useState(null),[c,o]=d.useState(!0),[u,p]=d.useState(!1),[M,g]=d.useState(null),[F,y]=d.useState(null),[L,x]=d.useState(null),j=d.useCallback(async()=>{o(!0);try{const f=await fetch("/api/notifications/remote/config");if(f.ok){const N=await f.json();i(N)}else i(Be())}catch(f){console.error("Failed to load remote notification config:",f),i(Be())}finally{o(!1)}},[]);d.useEffect(()=>{j()},[j]);const w=d.useCallback(async f=>{p(!0);try{const N=await fetch("/api/notifications/remote/config",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(f)});if(N.ok){const r=await N.json();i(r.config),A.success(t({id:"settings.remoteNotifications.saved"}))}else throw new Error(`HTTP ${N.status}`)}catch{A.error(t({id:"settings.remoteNotifications.saveError"}))}finally{p(!1)}},[t]),m=d.useCallback(async(f,N)=>{g(f);try{const h=await(await fetch("/api/notifications/remote/test",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({platform:f,config:N})})).json();h.success?A.success(t({id:"settings.remoteNotifications.testSuccess"}),{description:`${h.responseTime}ms`}):A.error(t({id:"settings.remoteNotifications.testFailed"}),{description:h.error})}catch{A.error(t({id:"settings.remoteNotifications.testError"}))}finally{g(null)}},[t]),D=()=>{a&&w({...a,enabled:!a.enabled})},k=(f,N)=>{if(!a)return;const r={...a,platforms:{...a.platforms,[f]:{...a.platforms[f],...N}}};i(r)},S=(f,N)=>{if(!a)return;const r=[...a.events];r[f]={...r[f],...N},i({...a,events:r})},P=(f,N)=>{if(!a)return;const r=a.events[f],h=r.platforms.includes(N)?r.platforms.filter(l=>l!==N):[...r.platforms,N];S(f,{platforms:h})},B=["discord","telegram","feishu","dingtalk","wecom","email","webhook"],R=async()=>{if(confirm(t({id:"settings.remoteNotifications.resetConfirm"})))try{const f=await fetch("/api/notifications/remote/reset",{method:"POST"});if(f.ok){const N=await f.json();i(N.config),A.success(t({id:"settings.remoteNotifications.resetSuccess"}))}}catch{A.error(t({id:"settings.remoteNotifications.resetError"}))}};return c?e.jsx(V,{className:I("p-6",s),children:e.jsx("div",{className:"flex items-center justify-center py-8",children:e.jsx(Y,{className:"w-5 h-5 animate-spin text-muted-foreground"})})}):a?e.jsxs(V,{className:I("p-6",s),children:[e.jsxs("div",{className:"flex items-center justify-between mb-6",children:[e.jsxs("h2",{className:"text-lg font-semibold text-foreground flex items-center gap-2",children:[a.enabled?e.jsx(Ee,{className:"w-5 h-5 text-primary"}):e.jsx(Mt,{className:"w-5 h-5 text-muted-foreground"}),t({id:"settings.remoteNotifications.title"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(b,{variant:"outline",size:"sm",onClick:()=>j(),disabled:c,children:e.jsx(Y,{className:I("w-3.5 h-3.5",c&&"animate-spin")})}),e.jsx(b,{variant:a.enabled?"default":"outline",size:"sm",onClick:D,children:a.enabled?e.jsxs(e.Fragment,{children:[e.jsx(W,{className:"w-4 h-4 mr-1"}),t({id:"settings.remoteNotifications.enabled"})]}):e.jsxs(e.Fragment,{children:[e.jsx(G,{className:"w-4 h-4 mr-1"}),t({id:"settings.remoteNotifications.disabled"})]})})]})]}),e.jsx("p",{className:"text-sm text-muted-foreground mb-6",children:t({id:"settings.remoteNotifications.description"})}),a.enabled&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"space-y-4 mb-6",children:[e.jsx("h3",{className:"text-sm font-medium text-foreground",children:t({id:"settings.remoteNotifications.platforms"})}),e.jsx(Vt,{config:a,expandedPlatform:F,testing:M,onToggleExpand:y,onUpdateConfig:k,onTest:m,onSave:()=>w(a),saving:u})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsx("h3",{className:"text-sm font-medium text-foreground",children:t({id:"settings.remoteNotifications.events"})}),e.jsx("div",{className:"grid gap-3",children:a.events.map((f,N)=>{const r=$t[f.event],h=L===N;return e.jsxs("div",{className:"rounded-lg border border-border bg-muted/30 overflow-hidden",children:[e.jsxs("div",{className:"flex items-center justify-between p-3 cursor-pointer hover:bg-muted/50 transition-colors",onClick:()=>x(h?null:N),children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:I("p-2 rounded-lg",f.enabled?"bg-primary/10 text-primary":"bg-muted text-muted-foreground"),children:e.jsx("span",{className:"text-sm",children:r.icon})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium",children:r.name}),e.jsx("p",{className:"text-xs text-muted-foreground",children:r.description})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("div",{className:"flex gap-1 flex-wrap max-w-xs",children:[f.platforms.slice(0,3).map(l=>e.jsx(_,{variant:"secondary",className:"text-xs",children:Ce[l].name},l)),f.platforms.length>3&&e.jsxs(_,{variant:"secondary",className:"text-xs",children:["+",f.platforms.length-3]}),f.platforms.length===0&&e.jsx(_,{variant:"outline",className:"text-xs text-muted-foreground",children:t({id:"settings.remoteNotifications.noPlatforms"})})]}),e.jsx(b,{variant:f.enabled?"default":"outline",size:"sm",className:"h-7",onClick:l=>{l.stopPropagation(),S(N,{enabled:!f.enabled})},children:f.enabled?e.jsx(W,{className:"w-3.5 h-3.5"}):e.jsx(G,{className:"w-3.5 h-3.5"})}),h?e.jsx(Te,{className:"w-4 h-4 text-muted-foreground"}):e.jsx(Me,{className:"w-4 h-4 text-muted-foreground"})]})]}),h&&e.jsxs("div",{className:"border-t border-border p-4 space-y-3 bg-muted/20",children:[e.jsx("p",{className:"text-xs text-muted-foreground",children:t({id:"settings.remoteNotifications.selectPlatforms"})}),e.jsx("div",{className:"flex flex-wrap gap-2",children:B.map(l=>{const E=f.platforms.includes(l),z=Ce[l],q=a.platforms[l],$=q==null?void 0:q.enabled;return e.jsxs(b,{variant:E?"default":"outline",size:"sm",className:I("h-8",!$&&!E&&"opacity-50"),onClick:()=>P(N,l),children:[E&&e.jsx(W,{className:"w-3 h-3 mr-1"}),z.name,!$&&!E&&e.jsx(ke,{className:"w-3 h-3 ml-1 opacity-50"})]},l)})})]})]},f.event)})})]}),e.jsxs("div",{className:"flex items-center justify-between mt-6 pt-4 border-t border-border",children:[e.jsx(b,{variant:"outline",size:"sm",onClick:R,children:t({id:"settings.remoteNotifications.reset"})}),e.jsxs(b,{variant:"default",size:"sm",onClick:()=>w(a),disabled:u,children:[e.jsx(We,{className:"w-4 h-4 mr-1"}),t(u?{id:"settings.remoteNotifications.saving"}:{id:"settings.remoteNotifications.save"})]})]})]})]}):null}function Qt({value:s,label:t,description:a,selected:i,onClick:c}){const o={modal:e.jsx("div",{className:"w-8 h-8 border-2 border-current rounded-lg flex items-center justify-center",children:e.jsx("div",{className:"w-4 h-3 border border-current rounded-sm"})}),drawer:e.jsx("div",{className:"w-8 h-8 border-2 border-current rounded-lg flex items-end justify-end p-0.5",children:e.jsx("div",{className:"w-2 h-6 border border-current rounded-sm"})}),sheet:e.jsx("div",{className:"w-8 h-8 border-2 border-current rounded-lg flex items-end justify-center p-0.5",children:e.jsx("div",{className:"w-6 h-2 border border-current rounded-sm"})}),fullscreen:e.jsx("div",{className:"w-8 h-8 border-2 border-current rounded-lg flex items-center justify-center",children:e.jsx("div",{className:"w-5 h-4 border border-current rounded-sm"})})};return e.jsxs("button",{type:"button",onClick:c,className:I("flex flex-col items-center gap-2 p-3 rounded-lg border-2 transition-all","hover:bg-accent/50",i?"border-primary bg-primary/10 text-primary":"border-border text-muted-foreground"),children:[o[s],e.jsxs("div",{className:"text-center",children:[e.jsx("div",{className:I("text-sm font-medium",i&&"text-primary"),children:t}),e.jsx("div",{className:"text-xs text-muted-foreground",children:a})]})]})}function Yt({value:s,onChange:t,disabled:a}){const i=[10,20,30,45,60,90,120];return e.jsx("div",{className:"flex flex-wrap gap-2",children:i.map(c=>e.jsxs(b,{type:"button",variant:s===c?"default":"outline",size:"sm",disabled:a,onClick:()=>t(c),children:[c,"s"]},c))})}function Zt(){const{formatMessage:s}=O(),{preferences:t,updatePreference:a,resetPreferences:i}=Rs(),c=[{value:"modal",label:s({id:"settings.a2ui.styleModal",defaultMessage:"Modal"}),description:s({id:"settings.a2ui.styleModalDesc",defaultMessage:"Centered"})},{value:"drawer",label:s({id:"settings.a2ui.styleDrawer",defaultMessage:"Drawer"}),description:s({id:"settings.a2ui.styleDrawerDesc",defaultMessage:"Side panel"})},{value:"sheet",label:s({id:"settings.a2ui.styleSheet",defaultMessage:"Sheet"}),description:s({id:"settings.a2ui.styleSheetDesc",defaultMessage:"Bottom"})},{value:"fullscreen",label:s({id:"settings.a2ui.styleFullscreen",defaultMessage:"Fullscreen"}),description:s({id:"settings.a2ui.styleFullscreenDesc",defaultMessage:"Full screen"})}];return e.jsxs(V,{className:"p-6",children:[e.jsxs("h2",{className:"text-lg font-semibold text-foreground flex items-center gap-2 mb-4",children:[e.jsx(qe,{className:"w-5 h-5"}),s({id:"settings.sections.a2ui",defaultMessage:"A2UI Preferences"})]}),e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"space-y-3",children:[e.jsxs($e,{className:"text-sm font-medium flex items-center gap-2",children:[e.jsx(Et,{className:"w-4 h-4"}),s({id:"settings.a2ui.dialogStyle",defaultMessage:"Dialog Style"})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:s({id:"settings.a2ui.dialogStyleDesc",defaultMessage:"Choose how A2UI dialogs are displayed"})}),e.jsx("div",{className:"grid grid-cols-4 gap-2",children:c.map(o=>e.jsx(Qt,{value:o.value,label:o.label,description:o.description,selected:t.dialogStyle===o.value,onClick:()=>a("dialogStyle",o.value)},o.value))})]}),e.jsxs("div",{className:"flex items-center justify-between py-2 border-t border-border",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Hs,{className:"w-4 h-4 text-muted-foreground"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium",children:s({id:"settings.a2ui.smartMode",defaultMessage:"Smart Mode"})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:s({id:"settings.a2ui.smartModeDesc",defaultMessage:"Auto-select style based on question type"})})]})]}),e.jsx(b,{variant:t.smartModeEnabled?"default":"outline",size:"sm",onClick:()=>a("smartModeEnabled",!t.smartModeEnabled),children:t.smartModeEnabled?s({id:"common.enabled",defaultMessage:"Enabled"}):s({id:"common.disabled",defaultMessage:"Disabled"})})]}),e.jsxs("div",{className:"space-y-3 py-2 border-t border-border",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(As,{className:"w-4 h-4 text-muted-foreground"}),e.jsx($e,{className:"text-sm font-medium",children:s({id:"settings.a2ui.autoSelectionDuration",defaultMessage:"Auto-Selection Duration"})})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:s({id:"settings.a2ui.autoSelectionDurationDesc",defaultMessage:"Countdown before auto-selecting default option"})}),e.jsx(Yt,{value:t.autoSelectionDuration,onChange:o=>a("autoSelectionDuration",o)})]}),e.jsxs("div",{className:"flex items-center justify-between py-2 border-t border-border",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium",children:s({id:"settings.a2ui.pauseOnInteraction",defaultMessage:"Pause on Interaction"})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:s({id:"settings.a2ui.pauseOnInteractionDesc",defaultMessage:"Pause countdown when you interact with the dialog"})})]}),e.jsx(b,{variant:t.pauseOnInteraction?"default":"outline",size:"sm",onClick:()=>a("pauseOnInteraction",!t.pauseOnInteraction),children:t.pauseOnInteraction?s({id:"common.enabled",defaultMessage:"Enabled"}):s({id:"common.disabled",defaultMessage:"Disabled"})})]}),e.jsxs("div",{className:"flex items-center justify-between py-2 border-t border-border",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Lt,{className:"w-4 h-4 text-muted-foreground"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium",children:s({id:"settings.a2ui.soundNotification",defaultMessage:"Sound Notification"})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:s({id:"settings.a2ui.soundNotificationDesc",defaultMessage:"Play sound before auto-submit (3 seconds before)"})})]})]}),e.jsx(b,{variant:t.autoSelectionSoundEnabled?"default":"outline",size:"sm",onClick:()=>a("autoSelectionSoundEnabled",!t.autoSelectionSoundEnabled),children:t.autoSelectionSoundEnabled?s({id:"common.enabled",defaultMessage:"Enabled"}):s({id:"common.disabled",defaultMessage:"Disabled"})})]}),e.jsxs("div",{className:"flex items-center justify-between py-2 border-t border-border",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium",children:s({id:"settings.a2ui.showToolbarButton",defaultMessage:"Show Toolbar Button"})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:s({id:"settings.a2ui.showToolbarButtonDesc",defaultMessage:"Show A2UI quick action button in the toolbar"})})]}),e.jsx(b,{variant:t.showA2UIButtonInToolbar?"default":"outline",size:"sm",onClick:()=>a("showA2UIButtonInToolbar",!t.showA2UIButtonInToolbar),children:t.showA2UIButtonInToolbar?s({id:"common.enabled",defaultMessage:"Enabled"}):s({id:"common.disabled",defaultMessage:"Disabled"})})]}),e.jsx("div",{className:"flex justify-end pt-4 border-t border-border",children:e.jsx(b,{variant:"outline",size:"sm",onClick:i,children:s({id:"common.resetToDefaults",defaultMessage:"Reset to Defaults"})})})]})]})}function ea(){const s=document.cookie.match(/XSRF-TOKEN=([^;]+)/);return s?decodeURIComponent(s[1]):null}function _e({value:s,onChange:t,placeholder:a}){const[i,c]=d.useState(!1),[o,u]=d.useState(null),p=kt(s,500);d.useEffect(()=>{if(p){c(!0),u(null);const g=setTimeout(()=>{p.trim().length>0?u(null):u("Path cannot be empty."),c(!1)},1e3);return()=>clearTimeout(g)}else u(null),c(!1)},[p]);const M=async()=>{const{selectFile:g}=await Ys(async()=>{const{selectFile:L}=await import("./index-bSgtHHOF.js").then(x=>x.gM);return{selectFile:L}},__vite__mapDeps([0,1])),F=s?s.replace(/[/\\][^/\\]*$/,""):void 0,y=await g(F);y.path&&!y.cancelled&&!y.error&&t(y.path)};return e.jsxs("div",{children:[e.jsxs("div",{className:"flex gap-2 items-center",children:[e.jsxs("div",{className:"relative flex-1",children:[e.jsx(H,{value:s,onChange:g=>t(g.target.value),placeholder:a,className:I("flex-1",o&&"border-destructive")}),i&&e.jsx("div",{className:"absolute inset-y-0 right-0 flex items-center pr-3",children:e.jsx(Xs,{className:"h-4 w-4 animate-spin text-muted-foreground"})})]}),e.jsx(b,{type:"button",variant:"outline",size:"sm",className:"shrink-0 h-9",onClick:M,title:"Browse",children:e.jsx(Qs,{className:"w-4 h-4"})})]}),o&&e.jsx("p",{className:"text-xs text-destructive mt-1",children:o})]})}const sa=new Set(["gemini","qwen","opencode"]),ta=new Set(["claude"]);function Qe(s){return sa.has(s)?"envFile":ta.has(s)?"settingsFile":"none"}function aa({toolId:s,config:t,isDefault:a,isExpanded:i,toolAvailable:c,isSaving:o,onToggleExpand:u,onToggleEnabled:p,onSetDefault:M,onUpdateModel:g,onUpdateTags:F,onUpdateAvailableModels:y,onUpdateEnvFile:L,onUpdateSettingsFile:x,onUpdateEffort:j,onSaveToBackend:w}){const{formatMessage:m}=O(),[D,k]=d.useState(""),[S,P]=d.useState(""),B=()=>{const l=D.trim();l&&!t.tags.includes(l)&&(F([...t.tags,l]),k(""))},R=l=>{F(t.tags.filter(E=>E!==l))},f=()=>{const l=S.trim(),E=t.availableModels||[];l&&!E.includes(l)&&(y([...E,l]),P(""))},N=l=>{const E=t.availableModels||[];y(E.filter(z=>z!==l))},r=["分析","Debug","implementation","refactoring","testing"],h=Qe(s);return e.jsxs(V,{className:I("overflow-hidden",!t.enabled&&"opacity-60"),children:[e.jsxs("div",{className:"p-4 cursor-pointer hover:bg-muted/50 transition-colors",onClick:u,children:[e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:I("p-2 rounded-lg",t.enabled?"bg-primary/10":"bg-muted"),children:e.jsx(Ge,{className:I("w-5 h-5",t.enabled?"text-primary":"text-muted-foreground")})}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-sm font-medium text-foreground capitalize",children:s}),a&&e.jsx(_,{variant:"default",className:"text-xs",children:m({id:"settings.cliTools.default"})}),e.jsx(_,{variant:"outline",className:"text-xs",children:t.type}),c!==void 0&&e.jsx("span",{className:I("inline-block w-2 h-2 rounded-full",c?"bg-green-500":"bg-red-400"),title:c?"Available":"Unavailable"})]}),e.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:t.primaryModel})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(b,{variant:t.enabled?"default":"outline",size:"sm",className:"h-8",onClick:l=>{l.stopPropagation(),p()},children:t.enabled?e.jsxs(e.Fragment,{children:[e.jsx(W,{className:"w-4 h-4 mr-1"}),m({id:"settings.cliTools.enabled"})]}):e.jsxs(e.Fragment,{children:[e.jsx(G,{className:"w-4 h-4 mr-1"}),m({id:"settings.cliTools.disabled"})]})}),i?e.jsx(Te,{className:"w-5 h-5 text-muted-foreground"}):e.jsx(Me,{className:"w-5 h-5 text-muted-foreground"})]})]}),t.tags&&t.tags.length>0&&e.jsx("div",{className:"flex flex-wrap gap-1 mt-2",children:t.tags.map(l=>e.jsx(_,{variant:"secondary",className:"text-xs",children:l},l))})]}),i&&e.jsxs("div",{className:"border-t border-border p-4 space-y-4 bg-muted/30",children:[e.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium text-foreground",children:m({id:"settings.cliTools.primaryModel"})}),e.jsx(H,{value:t.primaryModel,onChange:l=>g("primaryModel",l.target.value),className:"mt-1"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium text-foreground",children:m({id:"settings.cliTools.secondaryModel"})}),e.jsx(H,{value:t.secondaryModel,onChange:l=>g("secondaryModel",l.target.value),className:"mt-1"})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"text-sm font-medium text-foreground",children:m({id:"apiSettings.cliSettings.tags"})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:m({id:"apiSettings.cliSettings.tagsDescription"})}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs("div",{className:"flex-1 flex flex-wrap gap-1.5 p-2 border border-input bg-background rounded-md min-h-[38px] focus-within:ring-2 focus-within:ring-ring focus-within:ring-offset-2",children:[t.tags.map(l=>e.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 bg-primary/10 text-primary rounded text-xs h-6",children:[l,e.jsx("button",{type:"button",onClick:()=>R(l),className:"hover:text-destructive transition-colors","aria-label":m({id:"apiSettings.cliSettings.removeTag"}),children:e.jsx(G,{className:"w-3 h-3"})})]},l)),e.jsx("input",{type:"text",value:D,onChange:l=>k(l.target.value),onKeyDown:l=>{l.key==="Enter"&&(l.preventDefault(),B())},placeholder:t.tags.length===0?m({id:"apiSettings.cliSettings.tagInputPlaceholder"}):"",className:"flex-1 min-w-[120px] bg-transparent border-0 outline-none text-sm placeholder:text-muted-foreground"})]}),e.jsx(b,{type:"button",size:"sm",onClick:B,variant:"outline",className:"shrink-0",children:e.jsx(ke,{className:"w-4 h-4"})})]}),e.jsxs("div",{className:"flex flex-wrap gap-1",children:[e.jsxs("span",{className:"text-xs text-muted-foreground",children:[m({id:"apiSettings.cliSettings.predefinedTags"}),":"]}),r.map(l=>e.jsx("button",{type:"button",onClick:()=>{t.tags.includes(l)||F([...t.tags,l])},disabled:t.tags.includes(l),className:"text-xs px-2 py-0.5 rounded border border-border hover:bg-muted disabled:opacity-50 disabled:cursor-not-allowed transition-colors",children:l},l))]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"text-sm font-medium text-foreground",children:m({id:"apiSettings.cliSettings.availableModels"})}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs("div",{className:"flex-1 flex flex-wrap gap-1.5 p-2 border border-input bg-background rounded-md min-h-[38px] focus-within:ring-2 focus-within:ring-ring focus-within:ring-offset-2",children:[(t.availableModels||[]).map(l=>e.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 bg-primary/10 text-primary rounded text-xs h-6",children:[l,e.jsx("button",{type:"button",onClick:()=>N(l),className:"hover:text-destructive transition-colors",children:e.jsx(G,{className:"w-3 h-3"})})]},l)),e.jsx("input",{type:"text",value:S,onChange:l=>P(l.target.value),onKeyDown:l=>{l.key==="Enter"&&(l.preventDefault(),f())},placeholder:(t.availableModels||[]).length===0?m({id:"apiSettings.cliSettings.availableModelsPlaceholder"}):"",className:"flex-1 min-w-[120px] bg-transparent border-0 outline-none text-sm placeholder:text-muted-foreground"})]}),e.jsx(b,{type:"button",size:"sm",onClick:f,variant:"outline",className:"shrink-0",children:e.jsx(ke,{className:"w-4 h-4"})})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:m({id:"apiSettings.cliSettings.availableModelsHint"})})]}),h==="envFile"&&e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"text-sm font-medium text-foreground",children:m({id:"settings.cliTools.envFile"})}),e.jsx(_e,{value:t.envFile||"",onChange:l=>L(l||void 0),placeholder:m({id:"settings.cliTools.envFilePlaceholder"})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:m({id:"settings.cliTools.envFileHint"})})]}),h==="settingsFile"&&e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"text-sm font-medium text-foreground",children:m({id:"apiSettings.cliSettings.settingsFile"})}),e.jsx(_e,{value:t.settingsFile||"",onChange:l=>x(l||void 0),placeholder:m({id:"apiSettings.cliSettings.settingsFilePlaceholder"})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:m({id:"apiSettings.cliSettings.settingsFileHint"})})]}),h==="settingsFile"&&e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"text-sm font-medium text-foreground",children:m({id:"settings.cliTools.effort"})}),e.jsx("div",{className:"flex gap-2",children:["low","medium","high"].map(l=>{const E=t.effort||"high",z=`settings.cliTools.effort${l.charAt(0).toUpperCase()+l.slice(1)}`;return e.jsx("button",{type:"button",onClick:()=>j(l==="high"&&!t.effort?void 0:l),className:I("px-3 py-1.5 rounded-md text-sm border transition-colors",E===l?"bg-primary text-primary-foreground border-primary":"border-border hover:bg-muted"),children:m({id:z})},l)})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:m({id:"settings.cliTools.effortHint"})})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[!a&&t.enabled&&e.jsx(b,{variant:"outline",size:"sm",onClick:M,children:m({id:"settings.cliTools.setDefault"})}),e.jsxs(b,{variant:"default",size:"sm",onClick:w,disabled:o,children:[e.jsx(We,{className:"w-4 h-4 mr-1"}),m(o?{id:"settings.cliTools.saving"}:{id:"settings.cliTools.saveToConfig"})]})]})]})]})}function na(){const{formatMessage:s}=O(),{data:t,isLoading:a}=lt(),{toggle:i,isPending:c}=ot(),{data:o,isLoading:u}=ct(),{toggle:p,isPending:M}=dt(),{data:g,isLoading:F}=mt(),{toggle:y,isPending:L}=ut(),{refresh:x,isPending:j}=xt(),{exportSettings:w,isPending:m}=ht(),{importSettings:D,isPending:k}=gt(),S=d.useRef(null),P=d.useCallback(async()=>{try{const R=await w(),f=new Blob([JSON.stringify(R,null,2)],{type:"application/json"}),N=URL.createObjectURL(f),r=document.createElement("a"),h=new Date().toISOString().replace(/[:.]/g,"-").slice(0,19);r.href=N,r.download=`ccw-settings-${h}.json`,document.body.appendChild(r),r.click(),document.body.removeChild(r),URL.revokeObjectURL(N),A.success(s({id:"settings.responseLanguage.exportSuccess"}))}catch{A.error(s({id:"settings.responseLanguage.exportError"}))}},[w,s]),B=d.useCallback(async R=>{var N;const f=(N=R.target.files)==null?void 0:N[0];if(f){if(R.target.value="",!f.name.endsWith(".json")&&f.type!=="application/json"){A.error(s({id:"settings.responseLanguage.importInvalidFile"}));return}try{const r=await f.text(),h=JSON.parse(r);if(!h.version||!h.settings){A.error(s({id:"settings.responseLanguage.importInvalidStructure"}));return}const l=await D(h);l.success?A.success(s({id:"settings.responseLanguage.importSuccess"},{imported:l.imported,skipped:l.skipped})):A.error(s({id:"settings.responseLanguage.importError"}))}catch(r){r instanceof SyntaxError?A.error(s({id:"settings.responseLanguage.importInvalidJson"})):A.error(s({id:"settings.responseLanguage.importError"}))}}},[D,s]);return e.jsxs(V,{className:"p-6",children:[e.jsxs("h2",{className:"text-lg font-semibold text-foreground flex items-center gap-2 mb-4",children:[e.jsx(Ft,{className:"w-5 h-5"}),s({id:"settings.sections.responseLanguage"})]}),e.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[e.jsxs("div",{className:"rounded-lg border border-border p-4 space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-sm font-medium",children:s({id:"settings.responseLanguage.chineseClaude"})}),e.jsx(_,{variant:"default",className:"text-xs",children:"Claude"})]}),e.jsx(b,{variant:t!=null&&t.claudeEnabled?"default":"outline",size:"sm",className:"h-7",disabled:a||c,onClick:()=>i(!(t!=null&&t.claudeEnabled),"claude"),children:t!=null&&t.claudeEnabled?e.jsxs(e.Fragment,{children:[e.jsx(W,{className:"w-4 h-4 mr-1"}),s({id:"settings.responseLanguage.enabled"})]}):e.jsxs(e.Fragment,{children:[e.jsx(G,{className:"w-4 h-4 mr-1"}),s({id:"settings.responseLanguage.disabled"})]})})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:s({id:"settings.responseLanguage.chineseClaudeDesc"})})]}),e.jsxs("div",{className:"rounded-lg border border-border p-4 space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-sm font-medium",children:s({id:"settings.responseLanguage.chineseCodex"})}),e.jsx(_,{variant:"secondary",className:"text-xs",children:"Codex"})]}),e.jsx(b,{variant:t!=null&&t.codexEnabled?"default":"outline",size:"sm",className:"h-7",disabled:a||c,onClick:()=>i(!(t!=null&&t.codexEnabled),"codex"),children:t!=null&&t.codexEnabled?e.jsxs(e.Fragment,{children:[e.jsx(W,{className:"w-4 h-4 mr-1"}),s({id:"settings.responseLanguage.enabled"})]}):e.jsxs(e.Fragment,{children:[e.jsx(G,{className:"w-4 h-4 mr-1"}),s({id:"settings.responseLanguage.disabled"})]})})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:s({id:"settings.responseLanguage.chineseCodexDesc"})}),(t==null?void 0:t.codexNeedsMigration)&&e.jsxs("p",{className:"text-xs text-yellow-500",children:[e.jsx(Fe,{className:"w-3 h-3 inline mr-1"}),s({id:"settings.responseLanguage.migrationWarning"})]})]}),e.jsxs("div",{className:"rounded-lg border border-border p-4 space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(_s,{className:"w-4 h-4 text-muted-foreground"}),e.jsx("span",{className:"text-sm font-medium",children:s({id:"settings.responseLanguage.windowsPlatform"})})]}),e.jsx(b,{variant:o!=null&&o.enabled?"default":"outline",size:"sm",className:"h-7",disabled:u||M,onClick:()=>p(!(o!=null&&o.enabled)),children:o!=null&&o.enabled?e.jsxs(e.Fragment,{children:[e.jsx(W,{className:"w-4 h-4 mr-1"}),s({id:"settings.responseLanguage.enabled"})]}):e.jsxs(e.Fragment,{children:[e.jsx(G,{className:"w-4 h-4 mr-1"}),s({id:"settings.responseLanguage.disabled"})]})})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:s({id:"settings.responseLanguage.windowsPlatformDesc"})})]}),e.jsxs("div",{className:"rounded-lg border border-border p-4 space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(qs,{className:"w-4 h-4 text-muted-foreground"}),e.jsx("span",{className:"text-sm font-medium",children:s({id:"settings.responseLanguage.cliEnhancement"})}),e.jsx(_,{variant:"secondary",className:"text-xs",children:"Codex"})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[(g==null?void 0:g.enabled)&&e.jsx(b,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0",disabled:F||j,onClick:()=>x(),title:s({id:"settings.responseLanguage.refreshConfig"}),children:e.jsx(Y,{className:I("w-3.5 h-3.5",j&&"animate-spin")})}),e.jsx(b,{variant:g!=null&&g.enabled?"default":"outline",size:"sm",className:"h-7",disabled:F||L,onClick:()=>y(!(g!=null&&g.enabled)),children:g!=null&&g.enabled?e.jsxs(e.Fragment,{children:[e.jsx(W,{className:"w-4 h-4 mr-1"}),s({id:"settings.responseLanguage.enabled"})]}):e.jsxs(e.Fragment,{children:[e.jsx(G,{className:"w-4 h-4 mr-1"}),s({id:"settings.responseLanguage.disabled"})]})})]})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:s({id:"settings.responseLanguage.cliEnhancementDesc"})}),(g==null?void 0:g.enabled)&&e.jsx("p",{className:"text-xs text-muted-foreground/70",children:s({id:"settings.responseLanguage.cliEnhancementHint"})})]})]}),e.jsx("div",{className:"mt-4 pt-4 border-t border-border",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("p",{className:"text-xs text-muted-foreground",children:s({id:"settings.responseLanguage.exportImportHint"})}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("input",{ref:S,type:"file",accept:".json,application/json",onChange:B,className:"hidden"}),e.jsx(b,{variant:"outline",size:"sm",className:"h-7",disabled:k,onClick:()=>{var R;return(R=S.current)==null?void 0:R.click()},children:k?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"w-3.5 h-3.5 border-2 border-border border-t-accent rounded-full animate-spin mr-1"}),s({id:"settings.responseLanguage.importing"})]}):e.jsxs(e.Fragment,{children:[e.jsx(Ct,{className:"w-3.5 h-3.5 mr-1"}),s({id:"settings.responseLanguage.import"})]})}),e.jsx(b,{variant:"outline",size:"sm",className:"h-7",disabled:m,onClick:P,children:m?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"w-3.5 h-3.5 border-2 border-border border-t-accent rounded-full animate-spin mr-1"}),s({id:"settings.responseLanguage.exporting"})]}):e.jsxs(e.Fragment,{children:[e.jsx(Ws,{className:"w-3.5 h-3.5 mr-1"}),s({id:"settings.responseLanguage.export"})]})})]})]})})]})}function ra(){const{formatMessage:s}=O(),[t,a]=d.useState(null),[i,c]=d.useState(!1),[o,u]=d.useState(null),[p,M]=d.useState(null),[g,F]=d.useState(()=>{try{const x=localStorage.getItem("ccw.autoUpdate");return x===null?!0:JSON.parse(x)}catch{return!0}}),y=async(x=!1)=>{x||c(!0),u(null);try{const j=await fetch("/api/version-check");if(!j.ok)throw new Error(`HTTP ${j.status}`);const w=await j.json();if(!w.currentVersion)throw new Error("Invalid response");a(w),M(new Date)}catch(j){x||u(j instanceof Error?j.message:"Unknown error")}finally{c(!1)}};d.useEffect(()=>{if(y(!0),!g)return;const x=setInterval(()=>y(!0),3600*1e3);return()=>clearInterval(x)},[g]);const L=x=>{F(x),localStorage.setItem("ccw.autoUpdate",JSON.stringify(x))};return e.jsxs(V,{className:"p-6",children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsxs("h2",{className:"text-lg font-semibold text-foreground flex items-center gap-2",children:[e.jsx(Ke,{className:"w-5 h-5"}),s({id:"settings.versionCheck.title"})]}),e.jsxs(b,{variant:"outline",size:"sm",disabled:i,onClick:()=>y(),children:[e.jsx(Y,{className:I("w-3.5 h-3.5 mr-1.5",i&&"animate-spin")}),s(i?{id:"settings.versionCheck.checking"}:{id:"settings.versionCheck.checkNow"})]})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"rounded-lg border border-border p-4 space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-sm text-muted-foreground",children:s({id:"settings.versionCheck.currentVersion"})}),e.jsx(_,{variant:"secondary",className:"font-mono text-xs",children:(t==null?void 0:t.currentVersion)??"..."})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-sm text-muted-foreground",children:s({id:"settings.versionCheck.latestVersion"})}),e.jsx(_,{variant:t!=null&&t.hasUpdate?"default":"secondary",className:"font-mono text-xs",children:(t==null?void 0:t.latestVersion)??"..."})]}),t&&e.jsxs("div",{className:"flex items-center justify-between pt-2 border-t border-border",children:[e.jsx("span",{className:"text-sm font-medium",children:t.hasUpdate?s({id:"settings.versionCheck.updateAvailable"}):s({id:"settings.versionCheck.upToDate"})}),e.jsx("span",{className:I("inline-block w-2.5 h-2.5 rounded-full",t.hasUpdate?"bg-orange-500":"bg-green-500")})]}),o&&e.jsxs("div",{className:"flex items-center gap-2 pt-2 border-t border-border",children:[e.jsx(Fe,{className:"w-4 h-4 text-destructive flex-shrink-0"}),e.jsxs("span",{className:"text-sm text-destructive",children:[s({id:"settings.versionCheck.checkFailed"}),": ",o]})]})]}),(t==null?void 0:t.hasUpdate)&&e.jsxs("div",{className:"rounded-lg border border-orange-500/30 bg-orange-500/5 p-4 space-y-3",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium text-foreground mb-1",children:s({id:"settings.versionCheck.updateCommand"})}),e.jsx("code",{className:"text-xs font-mono bg-muted px-3 py-1.5 rounded block",children:t.updateCommand})]}),e.jsx(b,{variant:"outline",size:"sm",asChild:!0,children:e.jsx("a",{href:"https://github.com/dyw0830/ccw/releases",target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1.5",children:s({id:"settings.versionCheck.viewRelease"})})})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[e.jsx("input",{type:"checkbox",checked:g,onChange:x=>L(x.target.checked),className:"rounded border-input"}),e.jsxs("div",{children:[e.jsx("span",{className:"text-sm font-medium",children:s({id:"settings.versionCheck.autoCheck"})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:s({id:"settings.versionCheck.autoCheckDesc"})})]})]}),e.jsxs("span",{className:"text-xs text-muted-foreground",children:[s({id:"settings.versionCheck.lastChecked"}),":"," ",p?p.toLocaleTimeString():s({id:"settings.versionCheck.never"})]})]})]})]})}function ia(){const{formatMessage:s}=O(),{installations:t,isLoading:a,refetch:i}=ft(),{upgrade:c,isPending:o}=pt(),{data:u}=bt();return e.jsxs(V,{className:"p-6",children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsxs("h2",{className:"text-lg font-semibold text-foreground flex items-center gap-2",children:[e.jsx(St,{className:"w-5 h-5"}),s({id:"settings.systemStatus.title"}),!a&&e.jsxs("span",{className:"text-sm font-normal text-muted-foreground",children:[t.length," ",s({id:"settings.systemStatus.installations"})]})]}),e.jsx("div",{className:"flex items-center gap-1",children:e.jsx(b,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0",onClick:()=>i(),title:s({id:"settings.systemStatus.refresh"}),children:e.jsx(Y,{className:I("w-3.5 h-3.5",a&&"animate-spin")})})})]}),a?e.jsx("div",{className:"text-sm text-muted-foreground py-4 text-center",children:s({id:"settings.systemStatus.checking"})}):t.length===0?e.jsxs("div",{className:"text-center py-6 space-y-2",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:s({id:"settings.systemStatus.noInstallations"})}),e.jsx("div",{className:"bg-muted/50 rounded-md p-3 inline-block",children:e.jsx("code",{className:"text-xs font-mono",children:"ccw install"})})]}):e.jsxs("div",{className:"space-y-3",children:[t.map(p=>{const M=p.installation_mode==="Global",g=new Date(p.installation_date).toLocaleDateString(),F=p.application_version!=="unknown"?p.application_version:p.installer_version;return e.jsxs("div",{className:"rounded-lg border border-border p-4 space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:I("inline-flex items-center justify-center w-8 h-8 rounded-lg",M?"bg-primary/10 text-primary":"bg-orange-500/10 text-orange-500"),children:M?e.jsx(Gs,{className:"w-4 h-4"}):e.jsx(Tt,{className:"w-4 h-4"})}),e.jsx("span",{className:"text-sm font-medium",children:s(M?{id:"settings.systemStatus.global"}:{id:"settings.systemStatus.path"})}),e.jsxs(_,{variant:"secondary",className:"text-xs font-mono",children:["v",F]})]}),e.jsxs(b,{variant:"ghost",size:"sm",className:"h-7",disabled:o,onClick:()=>c(p.installation_path),children:[e.jsx(Ke,{className:I("w-3.5 h-3.5 mr-1",o&&"animate-spin")}),s(o?{id:"settings.systemStatus.upgrading"}:{id:"settings.systemStatus.upgrade"})]})]}),e.jsx("div",{className:"text-xs text-muted-foreground bg-muted/50 rounded px-2 py-1 font-mono truncate",title:p.installation_path,children:p.installation_path}),e.jsxs("div",{className:"flex items-center gap-4 text-xs text-muted-foreground",children:[e.jsxs("span",{className:"inline-flex items-center gap-1",children:[e.jsx(Ks,{className:"w-3 h-3"}),g]}),e.jsxs("span",{className:"inline-flex items-center gap-1",children:[e.jsx(Js,{className:"w-3 h-3"}),p.files_count," ",s({id:"settings.systemStatus.files"})]})]})]},p.manifest_id)}),u&&!u.installed&&u.missingFiles.length>0&&e.jsxs("div",{className:"rounded-lg border border-yellow-500/50 bg-yellow-500/5 p-4 space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-2 text-sm font-medium text-yellow-600 dark:text-yellow-500",children:[e.jsx(Fe,{className:"w-4 h-4"}),s({id:"settings.systemStatus.incomplete"})," — ",u.missingFiles.length," ",s({id:"settings.systemStatus.missingFiles"}).toLowerCase()]}),e.jsxs("ul",{className:"text-xs text-muted-foreground list-disc list-inside",children:[u.missingFiles.slice(0,4).map(p=>e.jsx("li",{children:p},p)),u.missingFiles.length>4&&e.jsxs("li",{children:["+",u.missingFiles.length-4," more..."]})]}),e.jsxs("div",{className:"bg-muted/50 rounded-md p-2",children:[e.jsxs("p",{className:"text-xs font-medium mb-1",children:[s({id:"settings.systemStatus.runToFix"}),":"]}),e.jsx("code",{className:"text-xs font-mono bg-background px-2 py-1 rounded block",children:"ccw install"})]})]})]})]})}function la({cliTools:s,defaultCliTool:t,expandedTools:a,savingTools:i,onToggleExpand:c,onToggleEnabled:o,onSetDefault:u,onUpdateModel:p,onUpdateTags:M,onUpdateAvailableModels:g,onUpdateEnvFile:F,onUpdateSettingsFile:y,onUpdateEffort:L,onSaveToBackend:x,formatMessage:j}){const{data:w}=jt();return e.jsxs(e.Fragment,{children:[e.jsxs("p",{className:"text-sm text-muted-foreground mb-4",children:[j({id:"settings.cliTools.description"})," ",e.jsx("strong",{className:"text-foreground",children:t})]}),e.jsx("div",{className:"space-y-3",children:Object.entries(s).map(([m,D])=>{const k=w==null?void 0:w[m];return e.jsx(aa,{toolId:m,config:D,isDefault:m===t,isExpanded:a.has(m),toolAvailable:k==null?void 0:k.available,isSaving:i.has(m),onToggleExpand:()=>c(m),onToggleEnabled:()=>o(m),onSetDefault:()=>u(m),onUpdateModel:(S,P)=>p(m,S,P),onUpdateTags:S=>M(m,S),onUpdateAvailableModels:S=>g(m,S),onUpdateEnvFile:S=>F(m,S),onUpdateSettingsFile:S=>y(m,S),onUpdateEffort:S=>L(m,S),onSaveToBackend:()=>x(m)},m)})})]})}function ya(){const{formatMessage:s}=O(),{theme:t,setTheme:a}=Se(),i=ge(Os),c=ge(zs),o=ge($s),{updateCliTool:u,setDefaultCliTool:p,setUserPreferences:M,resetUserPreferences:g}=ge(),[F,y]=d.useState(new Set),[L,x]=d.useState(new Set),j=r=>{y(h=>{const l=new Set(h);return l.has(r)?l.delete(r):l.add(r),l})},w=r=>{u(r,{enabled:!i[r].enabled})},m=r=>{p(r)},D=(r,h,l)=>{u(r,{[h]:l})},k=(r,h)=>{u(r,{tags:h})},S=(r,h)=>{u(r,{availableModels:h})},P=(r,h)=>{u(r,{envFile:h})},B=(r,h)=>{u(r,{settingsFile:h})},R=(r,h)=>{u(r,{effort:h})},f=d.useCallback(async r=>{const h=i[r];if(h){x(l=>new Set(l).add(r));try{const l={enabled:h.enabled,primaryModel:h.primaryModel,secondaryModel:h.secondaryModel,tags:h.tags,availableModels:h.availableModels},E=Qe(r);E==="envFile"?l.envFile=h.envFile||null:E==="settingsFile"&&(l.settingsFile=h.settingsFile||null,l.effort=h.effort||null);const z=ea(),q={"Content-Type":"application/json"};z&&(q["X-CSRF-Token"]=z);const $=await fetch(`/api/cli/config/${r}`,{method:"PUT",headers:q,body:JSON.stringify(l),credentials:"same-origin"});if(!$.ok)throw new Error(`HTTP ${$.status}`);A.success(s({id:"settings.cliTools.configSaved"}),{description:r})}catch{A.error(s({id:"settings.cliTools.configSaveError"}),{description:r})}finally{x(l=>{const E=new Set(l);return E.delete(r),E})}}},[i,s]),N=(r,h)=>{M({[r]:h})};return e.jsxs("div",{className:"max-w-4xl mx-auto space-y-8",children:[e.jsxs("div",{children:[e.jsxs("h1",{className:"text-2xl font-bold text-foreground flex items-center gap-2",children:[e.jsx(Vs,{className:"w-6 h-6 text-primary"}),s({id:"settings.title"})]}),e.jsx("p",{className:"text-muted-foreground mt-1",children:s({id:"settings.description"})})]}),e.jsxs(V,{className:"p-6",children:[e.jsxs("h2",{className:"text-lg font-semibold text-foreground flex items-center gap-2 mb-4",children:[e.jsx(Bs,{className:"w-5 h-5"}),s({id:"settings.sections.appearance"})]}),e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("p",{className:"font-medium text-foreground mb-1",children:s({id:"settings.appearance.theme"})}),e.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:s({id:"settings.appearance.description"})}),e.jsx(At,{})]}),e.jsxs("div",{className:"flex items-center justify-between pt-4 border-t border-border",children:[e.jsxs("div",{children:[e.jsx("p",{className:"font-medium text-foreground",children:s({id:"settings.appearance.systemFollow"})}),e.jsx("p",{className:"text-sm text-muted-foreground",children:s({id:"settings.appearance.systemFollowDesc"})})]}),e.jsx(b,{variant:t==="system"?"default":"outline",size:"sm",onClick:()=>a("system"),children:s({id:"settings.appearance.themeOptions.system"})})]})]})]}),e.jsxs(V,{className:"p-6",children:[e.jsxs("h2",{className:"text-lg font-semibold text-foreground flex items-center gap-2 mb-4",children:[e.jsx(Je,{className:"w-5 h-5"}),s({id:"settings.sections.language"})]}),e.jsx("div",{className:"space-y-4",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("p",{className:"font-medium text-foreground",children:s({id:"settings.language.displayLanguage"})}),e.jsx("p",{className:"text-sm text-muted-foreground",children:s({id:"settings.language.chooseLanguage"})})]}),e.jsx(zt,{})]})})]}),e.jsx(na,{}),e.jsx(Zt,{}),e.jsx(ia,{}),e.jsx(ra,{}),e.jsxs(V,{className:"p-6",children:[e.jsxs("h2",{className:"text-lg font-semibold text-foreground flex items-center gap-2 mb-4",children:[e.jsx(Ge,{className:"w-5 h-5"}),s({id:"settings.sections.cliTools"})]}),e.jsx(la,{cliTools:i,defaultCliTool:c,expandedTools:F,savingTools:L,onToggleExpand:j,onToggleEnabled:w,onSetDefault:m,onUpdateModel:D,onUpdateTags:k,onUpdateAvailableModels:S,onUpdateEnvFile:P,onUpdateSettingsFile:B,onUpdateEffort:R,onSaveToBackend:f,formatMessage:s})]}),e.jsxs(V,{className:"p-6",children:[e.jsxs("h2",{className:"text-lg font-semibold text-foreground flex items-center gap-2 mb-4",children:[e.jsx(Y,{className:"w-5 h-5"}),s({id:"settings.dataRefresh.title"})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("p",{className:"font-medium text-foreground",children:s({id:"settings.dataRefresh.autoRefresh"})}),e.jsx("p",{className:"text-sm text-muted-foreground",children:s({id:"settings.dataRefresh.autoRefreshDesc"})})]}),e.jsx(b,{variant:o.autoRefresh?"default":"outline",size:"sm",onClick:()=>N("autoRefresh",!o.autoRefresh),children:o.autoRefresh?s({id:"settings.dataRefresh.enabled"}):s({id:"settings.dataRefresh.disabled"})})]}),o.autoRefresh&&e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("p",{className:"font-medium text-foreground",children:s({id:"settings.dataRefresh.refreshInterval"})}),e.jsx("p",{className:"text-sm text-muted-foreground",children:s({id:"settings.dataRefresh.refreshIntervalDesc"})})]}),e.jsx("div",{className:"flex gap-2",children:[15e3,3e4,6e4,12e4].map(r=>e.jsxs(b,{variant:o.refreshInterval===r?"default":"outline",size:"sm",onClick:()=>N("refreshInterval",r),children:[r/1e3,"s"]},r))})]})]})]}),e.jsxs(V,{className:"p-6",children:[e.jsxs("h2",{className:"text-lg font-semibold text-foreground flex items-center gap-2 mb-4",children:[e.jsx(Ee,{className:"w-5 h-5"}),s({id:"settings.notifications.title"})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("p",{className:"font-medium text-foreground",children:s({id:"settings.notifications.enableNotifications"})}),e.jsx("p",{className:"text-sm text-muted-foreground",children:s({id:"settings.notifications.enableNotificationsDesc"})})]}),e.jsx(b,{variant:o.notificationsEnabled?"default":"outline",size:"sm",onClick:()=>N("notificationsEnabled",!o.notificationsEnabled),children:o.notificationsEnabled?s({id:"settings.dataRefresh.enabled"}):s({id:"settings.dataRefresh.disabled"})})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("p",{className:"font-medium text-foreground",children:s({id:"settings.notifications.soundEffects"})}),e.jsx("p",{className:"text-sm text-muted-foreground",children:s({id:"settings.notifications.soundEffectsDesc"})})]}),e.jsx(b,{variant:o.soundEnabled?"default":"outline",size:"sm",onClick:()=>N("soundEnabled",!o.soundEnabled),children:o.soundEnabled?s({id:"settings.notifications.on"}):s({id:"settings.notifications.off"})})]})]})]}),e.jsx(Xt,{}),e.jsxs(V,{className:"p-6 border-destructive/50",children:[e.jsxs("h2",{className:"text-lg font-semibold text-foreground flex items-center gap-2 mb-4",children:[e.jsx(Ve,{className:"w-5 h-5"}),s({id:"common.actions.reset"})]}),e.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:s({id:"settings.reset.description"})}),e.jsxs(b,{variant:"destructive",onClick:()=>{confirm(s({id:"settings.reset.confirm"}))&&g()},children:[e.jsx(Ve,{className:"w-4 h-4 mr-2"}),s({id:"common.actions.resetToDefaults"})]})]})]})}export{ya as SettingsPage,ya as default};
144
- //# sourceMappingURL=SettingsPage-2c-oTxfz.js.map
143
+ `,children:s({id:"theme.share.cancel"})})]})]})]}),e.jsx(Zs,{open:le!==null,onOpenChange:Ae,children:e.jsxs(et,{children:[e.jsxs(st,{children:[e.jsx(tt,{children:"Delete Theme Slot?"}),e.jsx(at,{children:"This action cannot be undone. The theme slot will be permanently deleted."})]}),e.jsxs(nt,{children:[e.jsx(rt,{onClick:Ae,children:"Cancel"}),e.jsx(it,{onClick:xs,children:"Delete"})]})]})})]})]})}const Ot=[{value:"en",label:"English",flag:"🇺🇸"},{value:"zh",label:"中文",flag:"🇨🇳"}];function zt({compact:s=!1,className:t}){const{locale:a,setLocale:i}=Nt();return e.jsxs(Es,{value:a,onValueChange:i,children:[e.jsx(Fs,{className:I(s?"w-[110px]":"w-[160px]","gap-2",t),"aria-label":"Select language",children:s?e.jsxs(e.Fragment,{children:[e.jsx(Je,{className:"w-4 h-4"}),e.jsx(ze,{})]}):e.jsx(ze,{})}),e.jsx(Ls,{children:Ot.map(c=>e.jsx(Us,{value:c.value,children:e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-base",children:c.flag}),e.jsx("span",{children:c.label})]})},c.value))})]})}const Ce={discord:{id:"discord",name:"Discord",icon:"message-circle",description:"Send notifications to Discord channels via webhook",requiredFields:["webhookUrl"]},telegram:{id:"telegram",name:"Telegram",icon:"send",description:"Send notifications to Telegram chats via bot",requiredFields:["botToken","chatId"]},feishu:{id:"feishu",name:"Feishu",icon:"message-square",description:"Send notifications to Feishu (Lark) via webhook with rich card support",requiredFields:["webhookUrl"]},dingtalk:{id:"dingtalk",name:"DingTalk",icon:"bell",description:"Send notifications to DingTalk via webhook",requiredFields:["webhookUrl"]},wecom:{id:"wecom",name:"WeCom",icon:"users",description:"Send notifications to WeCom (WeChat Work) via webhook",requiredFields:["webhookUrl"]},email:{id:"email",name:"Email",icon:"mail",description:"Send notifications via SMTP email",requiredFields:["host","username","password","from","to"]},webhook:{id:"webhook",name:"Custom Webhook",icon:"link",description:"Send notifications to a custom HTTP endpoint",requiredFields:["url"]}},$t={"ask-user-question":{id:"ask-user-question",name:"Ask User Question",description:"Notification when Claude asks a question via AskUserQuestion",icon:"help-circle"},"session-start":{id:"session-start",name:"Session Start",description:"Notification when a CLI session starts",icon:"play"},"session-end":{id:"session-end",name:"Session End",description:"Notification when a CLI session ends",icon:"square"},"task-completed":{id:"task-completed",name:"Task Completed",description:"Notification when a task completes successfully",icon:"check-circle"},"task-failed":{id:"task-failed",name:"Task Failed",description:"Notification when a task fails",icon:"alert-circle"}};function Be(){return{enabled:!1,platforms:{},events:[{event:"ask-user-question",platforms:["discord","telegram"],enabled:!0},{event:"session-start",platforms:[],enabled:!1},{event:"session-end",platforms:[],enabled:!1},{event:"task-completed",platforms:[],enabled:!1},{event:"task-failed",platforms:["discord","telegram"],enabled:!0}],timeout:1e4}}function Vt({config:s,expandedPlatform:t,testing:a,onToggleExpand:i,onUpdateConfig:c,onTest:o,onSave:u,saving:p}){const{formatMessage:M}=O(),g=["discord","telegram","feishu","dingtalk","wecom","email","webhook"],F=x=>{switch(x){case"discord":return e.jsx(Is,{className:"w-4 h-4"});case"telegram":return e.jsx(yt,{className:"w-4 h-4"});case"feishu":return e.jsx(qe,{className:"w-4 h-4"});case"dingtalk":return e.jsx(Ee,{className:"w-4 h-4"});case"wecom":return e.jsx(Ps,{className:"w-4 h-4"});case"email":return e.jsx(Ds,{className:"w-4 h-4"});case"webhook":return e.jsx(wt,{className:"w-4 h-4"})}},y=x=>{switch(x){case"discord":return s.platforms.discord||{enabled:!1,webhookUrl:""};case"telegram":return s.platforms.telegram||{enabled:!1,botToken:"",chatId:""};case"feishu":return s.platforms.feishu||{enabled:!1,webhookUrl:""};case"dingtalk":return s.platforms.dingtalk||{enabled:!1,webhookUrl:""};case"wecom":return s.platforms.wecom||{enabled:!1,webhookUrl:""};case"email":return s.platforms.email||{enabled:!1,host:"",port:587,username:"",password:"",from:"",to:[]};case"webhook":return s.platforms.webhook||{enabled:!1,url:"",method:"POST"}}},L=x=>{var w;const j=y(x);switch(x){case"discord":return!!j.webhookUrl;case"telegram":return!!j.botToken&&!!j.chatId;case"feishu":return!!j.webhookUrl;case"dingtalk":return!!j.webhookUrl;case"wecom":return!!j.webhookUrl;case"email":const m=j;return!!(m.host&&m.username&&m.password&&m.from&&((w=m.to)==null?void 0:w.length)>0);case"webhook":return!!j.url}};return e.jsx("div",{className:"grid gap-3",children:g.map(x=>{const j=Ce[x],w=y(x),m=L(x),D=t===x;return e.jsxs(V,{className:"overflow-hidden",children:[e.jsx("div",{className:"p-4 cursor-pointer hover:bg-muted/50 transition-colors",onClick:()=>i(D?null:x),children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:I("p-2 rounded-lg",w.enabled&&m?"bg-primary/10 text-primary":"bg-muted text-muted-foreground"),children:F(x)}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-sm font-medium",children:j.name}),m&&e.jsxs(_,{variant:"outline",className:"text-xs text-green-600 border-green-500/30",children:[e.jsx(W,{className:"w-3 h-3 mr-1"}),M({id:"settings.remoteNotifications.configured"})]})]}),e.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:j.description})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(b,{variant:w.enabled?"default":"outline",size:"sm",className:"h-7",onClick:k=>{k.stopPropagation(),c(x,{enabled:!w.enabled})},children:w.enabled?e.jsx(W,{className:"w-3.5 h-3.5"}):e.jsx(G,{className:"w-3.5 h-3.5"})}),D?e.jsx(Te,{className:"w-4 h-4 text-muted-foreground"}):e.jsx(Me,{className:"w-4 h-4 text-muted-foreground"})]})]})}),D&&e.jsxs("div",{className:"border-t border-border p-4 space-y-4 bg-muted/30",children:[x==="discord"&&e.jsx(Bt,{config:w,onUpdate:k=>c("discord",k)}),x==="telegram"&&e.jsx(_t,{config:w,onUpdate:k=>c("telegram",k)}),x==="feishu"&&e.jsx(Wt,{config:w,onUpdate:k=>c("feishu",k)}),x==="dingtalk"&&e.jsx(Gt,{config:w,onUpdate:k=>c("dingtalk",k)}),x==="wecom"&&e.jsx(Kt,{config:w,onUpdate:k=>c("wecom",k)}),x==="email"&&e.jsx(Jt,{config:w,onUpdate:k=>c("email",k)}),x==="webhook"&&e.jsx(qt,{config:w,onUpdate:k=>c("webhook",k)}),e.jsxs("div",{className:"flex items-center gap-2 pt-2",children:[e.jsxs(b,{variant:"outline",size:"sm",onClick:()=>o(x,w),disabled:a===x||!m,children:[e.jsx(vt,{className:I("w-3.5 h-3.5 mr-1",a===x&&"animate-pulse")}),M({id:"settings.remoteNotifications.testConnection"})]}),e.jsx(b,{variant:"default",size:"sm",onClick:u,disabled:p,children:M({id:"settings.remoteNotifications.save"})})]})]})]},x)})})}function Bt({config:s,onUpdate:t}){const{formatMessage:a}=O(),[i,c]=d.useState(!1);return e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium text-foreground",children:a({id:"settings.remoteNotifications.discord.webhookUrl"})}),e.jsxs("div",{className:"flex gap-2 mt-1",children:[e.jsx(H,{type:i?"text":"password",value:s.webhookUrl||"",onChange:o=>t({webhookUrl:o.target.value}),placeholder:"https://discord.com/api/webhooks/...",className:"flex-1"}),e.jsx(b,{variant:"outline",size:"sm",className:"shrink-0",onClick:()=>c(!i),children:i?e.jsx(ee,{className:"w-4 h-4"}):e.jsx(se,{className:"w-4 h-4"})})]}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:a({id:"settings.remoteNotifications.discord.webhookUrlHint"})})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium text-foreground",children:a({id:"settings.remoteNotifications.discord.username"})}),e.jsx(H,{value:s.username||"",onChange:o=>t({username:o.target.value}),placeholder:"CCW Notification",className:"mt-1"})]})]})}function _t({config:s,onUpdate:t}){const{formatMessage:a}=O(),[i,c]=d.useState(!1);return e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium text-foreground",children:a({id:"settings.remoteNotifications.telegram.botToken"})}),e.jsxs("div",{className:"flex gap-2 mt-1",children:[e.jsx(H,{type:i?"text":"password",value:s.botToken||"",onChange:o=>t({botToken:o.target.value}),placeholder:"1234567890:ABCdefGHIjklMNOpqrsTUVwxyz",className:"flex-1"}),e.jsx(b,{variant:"outline",size:"sm",className:"shrink-0",onClick:()=>c(!i),children:i?e.jsx(ee,{className:"w-4 h-4"}):e.jsx(se,{className:"w-4 h-4"})})]}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:a({id:"settings.remoteNotifications.telegram.botTokenHint"})})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium text-foreground",children:a({id:"settings.remoteNotifications.telegram.chatId"})}),e.jsx(H,{value:s.chatId||"",onChange:o=>t({chatId:o.target.value}),placeholder:"-1001234567890",className:"mt-1"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:a({id:"settings.remoteNotifications.telegram.chatIdHint"})})]})]})}function qt({config:s,onUpdate:t}){const{formatMessage:a}=O();return e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium text-foreground",children:a({id:"settings.remoteNotifications.webhook.url"})}),e.jsx(H,{value:s.url||"",onChange:i=>t({url:i.target.value}),placeholder:"https://your-server.com/webhook",className:"mt-1"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium text-foreground",children:a({id:"settings.remoteNotifications.webhook.method"})}),e.jsxs("div",{className:"flex gap-2 mt-1",children:[e.jsx(b,{variant:s.method==="POST"?"default":"outline",size:"sm",onClick:()=>t({method:"POST"}),children:"POST"}),e.jsx(b,{variant:s.method==="PUT"?"default":"outline",size:"sm",onClick:()=>t({method:"PUT"}),children:"PUT"})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium text-foreground",children:a({id:"settings.remoteNotifications.webhook.headers"})}),e.jsx(H,{value:s.headers?JSON.stringify(s.headers):"",onChange:i=>{try{const c=i.target.value?JSON.parse(i.target.value):void 0;t({headers:c})}catch{}},placeholder:'{"Authorization": "Bearer token"}',className:"mt-1 font-mono text-xs"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:a({id:"settings.remoteNotifications.webhook.headersHint"})})]})]})}function Wt({config:s,onUpdate:t}){const{formatMessage:a}=O(),[i,c]=d.useState(!1);return e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium text-foreground",children:a({id:"settings.remoteNotifications.feishu.webhookUrl"})}),e.jsxs("div",{className:"flex gap-2 mt-1",children:[e.jsx(H,{type:i?"text":"password",value:s.webhookUrl||"",onChange:o=>t({webhookUrl:o.target.value}),placeholder:"https://open.feishu.cn/open-apis/bot/v2/hook/...",className:"flex-1"}),e.jsx(b,{variant:"outline",size:"sm",className:"shrink-0",onClick:()=>c(!i),children:i?e.jsx(ee,{className:"w-4 h-4"}):e.jsx(se,{className:"w-4 h-4"})})]}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:a({id:"settings.remoteNotifications.feishu.webhookUrlHint"})})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("input",{type:"checkbox",id:"feishu-useCard",checked:s.useCard||!1,onChange:o=>t({useCard:o.target.checked}),className:"rounded border-border"}),e.jsx("label",{htmlFor:"feishu-useCard",className:"text-sm font-medium text-foreground",children:a({id:"settings.remoteNotifications.feishu.useCard"})})]}),e.jsx("p",{className:"text-xs text-muted-foreground -mt-2",children:a({id:"settings.remoteNotifications.feishu.useCardHint"})}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium text-foreground",children:a({id:"settings.remoteNotifications.feishu.title"})}),e.jsx(H,{value:s.title||"",onChange:o=>t({title:o.target.value}),placeholder:"CCW Notification",className:"mt-1"})]})]})}function Gt({config:s,onUpdate:t}){var o;const{formatMessage:a}=O(),[i,c]=d.useState(!1);return e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium text-foreground",children:a({id:"settings.remoteNotifications.dingtalk.webhookUrl"})}),e.jsxs("div",{className:"flex gap-2 mt-1",children:[e.jsx(H,{type:i?"text":"password",value:s.webhookUrl||"",onChange:u=>t({webhookUrl:u.target.value}),placeholder:"https://oapi.dingtalk.com/robot/send?access_token=...",className:"flex-1"}),e.jsx(b,{variant:"outline",size:"sm",className:"shrink-0",onClick:()=>c(!i),children:i?e.jsx(ee,{className:"w-4 h-4"}):e.jsx(se,{className:"w-4 h-4"})})]}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:a({id:"settings.remoteNotifications.dingtalk.webhookUrlHint"})})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium text-foreground",children:a({id:"settings.remoteNotifications.dingtalk.keywords"})}),e.jsx(H,{value:((o=s.keywords)==null?void 0:o.join(", "))||"",onChange:u=>t({keywords:u.target.value.split(",").map(p=>p.trim()).filter(Boolean)}),placeholder:"keyword1, keyword2",className:"mt-1"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:a({id:"settings.remoteNotifications.dingtalk.keywordsHint"})})]})]})}function Kt({config:s,onUpdate:t}){var o;const{formatMessage:a}=O(),[i,c]=d.useState(!1);return e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium text-foreground",children:a({id:"settings.remoteNotifications.wecom.webhookUrl"})}),e.jsxs("div",{className:"flex gap-2 mt-1",children:[e.jsx(H,{type:i?"text":"password",value:s.webhookUrl||"",onChange:u=>t({webhookUrl:u.target.value}),placeholder:"https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=...",className:"flex-1"}),e.jsx(b,{variant:"outline",size:"sm",className:"shrink-0",onClick:()=>c(!i),children:i?e.jsx(ee,{className:"w-4 h-4"}):e.jsx(se,{className:"w-4 h-4"})})]}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:a({id:"settings.remoteNotifications.wecom.webhookUrlHint"})})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium text-foreground",children:a({id:"settings.remoteNotifications.wecom.mentionedList"})}),e.jsx(H,{value:((o=s.mentionedList)==null?void 0:o.join(", "))||"",onChange:u=>t({mentionedList:u.target.value.split(",").map(p=>p.trim()).filter(Boolean)}),placeholder:"userid1, userid2, @all",className:"mt-1"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:a({id:"settings.remoteNotifications.wecom.mentionedListHint"})})]})]})}function Jt({config:s,onUpdate:t}){var o;const{formatMessage:a}=O(),[i,c]=d.useState(!1);return e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium text-foreground",children:a({id:"settings.remoteNotifications.email.host"})}),e.jsx(H,{value:s.host||"",onChange:u=>t({host:u.target.value}),placeholder:"smtp.gmail.com",className:"mt-1"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:a({id:"settings.remoteNotifications.email.hostHint"})})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium text-foreground",children:a({id:"settings.remoteNotifications.email.port"})}),e.jsx(H,{type:"number",value:s.port||587,onChange:u=>t({port:parseInt(u.target.value,10)||587}),placeholder:"587",className:"mt-1"})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("input",{type:"checkbox",id:"email-secure",checked:s.secure||!1,onChange:u=>t({secure:u.target.checked}),className:"rounded border-border"}),e.jsx("label",{htmlFor:"email-secure",className:"text-sm font-medium text-foreground",children:a({id:"settings.remoteNotifications.email.secure"})})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium text-foreground",children:a({id:"settings.remoteNotifications.email.username"})}),e.jsx(H,{value:s.username||"",onChange:u=>t({username:u.target.value}),placeholder:"your-email@gmail.com",className:"mt-1"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium text-foreground",children:a({id:"settings.remoteNotifications.email.password"})}),e.jsxs("div",{className:"flex gap-2 mt-1",children:[e.jsx(H,{type:i?"text":"password",value:s.password||"",onChange:u=>t({password:u.target.value}),placeholder:"********",className:"flex-1"}),e.jsx(b,{variant:"outline",size:"sm",className:"shrink-0",onClick:()=>c(!i),children:i?e.jsx(ee,{className:"w-4 h-4"}):e.jsx(se,{className:"w-4 h-4"})})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium text-foreground",children:a({id:"settings.remoteNotifications.email.from"})}),e.jsx(H,{value:s.from||"",onChange:u=>t({from:u.target.value}),placeholder:"noreply@example.com",className:"mt-1"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium text-foreground",children:a({id:"settings.remoteNotifications.email.to"})}),e.jsx(H,{value:((o=s.to)==null?void 0:o.join(", "))||"",onChange:u=>t({to:u.target.value.split(",").map(p=>p.trim()).filter(Boolean)}),placeholder:"user1@example.com, user2@example.com",className:"mt-1"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:a({id:"settings.remoteNotifications.email.toHint"})})]})]})}function Xt({className:s}){const{formatMessage:t}=O(),[a,i]=d.useState(null),[c,o]=d.useState(!0),[u,p]=d.useState(!1),[M,g]=d.useState(null),[F,y]=d.useState(null),[L,x]=d.useState(null),j=d.useCallback(async()=>{o(!0);try{const f=await fetch("/api/notifications/remote/config");if(f.ok){const N=await f.json();i(N)}else i(Be())}catch(f){console.error("Failed to load remote notification config:",f),i(Be())}finally{o(!1)}},[]);d.useEffect(()=>{j()},[j]);const w=d.useCallback(async f=>{p(!0);try{const N=await fetch("/api/notifications/remote/config",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(f)});if(N.ok){const r=await N.json();i(r.config),A.success(t({id:"settings.remoteNotifications.saved"}))}else throw new Error(`HTTP ${N.status}`)}catch{A.error(t({id:"settings.remoteNotifications.saveError"}))}finally{p(!1)}},[t]),m=d.useCallback(async(f,N)=>{g(f);try{const h=await(await fetch("/api/notifications/remote/test",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({platform:f,config:N})})).json();h.success?A.success(t({id:"settings.remoteNotifications.testSuccess"}),{description:`${h.responseTime}ms`}):A.error(t({id:"settings.remoteNotifications.testFailed"}),{description:h.error})}catch{A.error(t({id:"settings.remoteNotifications.testError"}))}finally{g(null)}},[t]),D=()=>{a&&w({...a,enabled:!a.enabled})},k=(f,N)=>{if(!a)return;const r={...a,platforms:{...a.platforms,[f]:{...a.platforms[f],...N}}};i(r)},S=(f,N)=>{if(!a)return;const r=[...a.events];r[f]={...r[f],...N},i({...a,events:r})},P=(f,N)=>{if(!a)return;const r=a.events[f],h=r.platforms.includes(N)?r.platforms.filter(l=>l!==N):[...r.platforms,N];S(f,{platforms:h})},B=["discord","telegram","feishu","dingtalk","wecom","email","webhook"],R=async()=>{if(confirm(t({id:"settings.remoteNotifications.resetConfirm"})))try{const f=await fetch("/api/notifications/remote/reset",{method:"POST"});if(f.ok){const N=await f.json();i(N.config),A.success(t({id:"settings.remoteNotifications.resetSuccess"}))}}catch{A.error(t({id:"settings.remoteNotifications.resetError"}))}};return c?e.jsx(V,{className:I("p-6",s),children:e.jsx("div",{className:"flex items-center justify-center py-8",children:e.jsx(Y,{className:"w-5 h-5 animate-spin text-muted-foreground"})})}):a?e.jsxs(V,{className:I("p-6",s),children:[e.jsxs("div",{className:"flex items-center justify-between mb-6",children:[e.jsxs("h2",{className:"text-lg font-semibold text-foreground flex items-center gap-2",children:[a.enabled?e.jsx(Ee,{className:"w-5 h-5 text-primary"}):e.jsx(Mt,{className:"w-5 h-5 text-muted-foreground"}),t({id:"settings.remoteNotifications.title"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(b,{variant:"outline",size:"sm",onClick:()=>j(),disabled:c,children:e.jsx(Y,{className:I("w-3.5 h-3.5",c&&"animate-spin")})}),e.jsx(b,{variant:a.enabled?"default":"outline",size:"sm",onClick:D,children:a.enabled?e.jsxs(e.Fragment,{children:[e.jsx(W,{className:"w-4 h-4 mr-1"}),t({id:"settings.remoteNotifications.enabled"})]}):e.jsxs(e.Fragment,{children:[e.jsx(G,{className:"w-4 h-4 mr-1"}),t({id:"settings.remoteNotifications.disabled"})]})})]})]}),e.jsx("p",{className:"text-sm text-muted-foreground mb-6",children:t({id:"settings.remoteNotifications.description"})}),a.enabled&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"space-y-4 mb-6",children:[e.jsx("h3",{className:"text-sm font-medium text-foreground",children:t({id:"settings.remoteNotifications.platforms"})}),e.jsx(Vt,{config:a,expandedPlatform:F,testing:M,onToggleExpand:y,onUpdateConfig:k,onTest:m,onSave:()=>w(a),saving:u})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsx("h3",{className:"text-sm font-medium text-foreground",children:t({id:"settings.remoteNotifications.events"})}),e.jsx("div",{className:"grid gap-3",children:a.events.map((f,N)=>{const r=$t[f.event],h=L===N;return e.jsxs("div",{className:"rounded-lg border border-border bg-muted/30 overflow-hidden",children:[e.jsxs("div",{className:"flex items-center justify-between p-3 cursor-pointer hover:bg-muted/50 transition-colors",onClick:()=>x(h?null:N),children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:I("p-2 rounded-lg",f.enabled?"bg-primary/10 text-primary":"bg-muted text-muted-foreground"),children:e.jsx("span",{className:"text-sm",children:r.icon})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium",children:r.name}),e.jsx("p",{className:"text-xs text-muted-foreground",children:r.description})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("div",{className:"flex gap-1 flex-wrap max-w-xs",children:[f.platforms.slice(0,3).map(l=>e.jsx(_,{variant:"secondary",className:"text-xs",children:Ce[l].name},l)),f.platforms.length>3&&e.jsxs(_,{variant:"secondary",className:"text-xs",children:["+",f.platforms.length-3]}),f.platforms.length===0&&e.jsx(_,{variant:"outline",className:"text-xs text-muted-foreground",children:t({id:"settings.remoteNotifications.noPlatforms"})})]}),e.jsx(b,{variant:f.enabled?"default":"outline",size:"sm",className:"h-7",onClick:l=>{l.stopPropagation(),S(N,{enabled:!f.enabled})},children:f.enabled?e.jsx(W,{className:"w-3.5 h-3.5"}):e.jsx(G,{className:"w-3.5 h-3.5"})}),h?e.jsx(Te,{className:"w-4 h-4 text-muted-foreground"}):e.jsx(Me,{className:"w-4 h-4 text-muted-foreground"})]})]}),h&&e.jsxs("div",{className:"border-t border-border p-4 space-y-3 bg-muted/20",children:[e.jsx("p",{className:"text-xs text-muted-foreground",children:t({id:"settings.remoteNotifications.selectPlatforms"})}),e.jsx("div",{className:"flex flex-wrap gap-2",children:B.map(l=>{const E=f.platforms.includes(l),z=Ce[l],q=a.platforms[l],$=q==null?void 0:q.enabled;return e.jsxs(b,{variant:E?"default":"outline",size:"sm",className:I("h-8",!$&&!E&&"opacity-50"),onClick:()=>P(N,l),children:[E&&e.jsx(W,{className:"w-3 h-3 mr-1"}),z.name,!$&&!E&&e.jsx(ke,{className:"w-3 h-3 ml-1 opacity-50"})]},l)})})]})]},f.event)})})]}),e.jsxs("div",{className:"flex items-center justify-between mt-6 pt-4 border-t border-border",children:[e.jsx(b,{variant:"outline",size:"sm",onClick:R,children:t({id:"settings.remoteNotifications.reset"})}),e.jsxs(b,{variant:"default",size:"sm",onClick:()=>w(a),disabled:u,children:[e.jsx(We,{className:"w-4 h-4 mr-1"}),t(u?{id:"settings.remoteNotifications.saving"}:{id:"settings.remoteNotifications.save"})]})]})]})]}):null}function Qt({value:s,label:t,description:a,selected:i,onClick:c}){const o={modal:e.jsx("div",{className:"w-8 h-8 border-2 border-current rounded-lg flex items-center justify-center",children:e.jsx("div",{className:"w-4 h-3 border border-current rounded-sm"})}),drawer:e.jsx("div",{className:"w-8 h-8 border-2 border-current rounded-lg flex items-end justify-end p-0.5",children:e.jsx("div",{className:"w-2 h-6 border border-current rounded-sm"})}),sheet:e.jsx("div",{className:"w-8 h-8 border-2 border-current rounded-lg flex items-end justify-center p-0.5",children:e.jsx("div",{className:"w-6 h-2 border border-current rounded-sm"})}),fullscreen:e.jsx("div",{className:"w-8 h-8 border-2 border-current rounded-lg flex items-center justify-center",children:e.jsx("div",{className:"w-5 h-4 border border-current rounded-sm"})})};return e.jsxs("button",{type:"button",onClick:c,className:I("flex flex-col items-center gap-2 p-3 rounded-lg border-2 transition-all","hover:bg-accent/50",i?"border-primary bg-primary/10 text-primary":"border-border text-muted-foreground"),children:[o[s],e.jsxs("div",{className:"text-center",children:[e.jsx("div",{className:I("text-sm font-medium",i&&"text-primary"),children:t}),e.jsx("div",{className:"text-xs text-muted-foreground",children:a})]})]})}function Yt({value:s,onChange:t,disabled:a}){const i=[10,20,30,45,60,90,120];return e.jsx("div",{className:"flex flex-wrap gap-2",children:i.map(c=>e.jsxs(b,{type:"button",variant:s===c?"default":"outline",size:"sm",disabled:a,onClick:()=>t(c),children:[c,"s"]},c))})}function Zt(){const{formatMessage:s}=O(),{preferences:t,updatePreference:a,resetPreferences:i}=Rs(),c=[{value:"modal",label:s({id:"settings.a2ui.styleModal",defaultMessage:"Modal"}),description:s({id:"settings.a2ui.styleModalDesc",defaultMessage:"Centered"})},{value:"drawer",label:s({id:"settings.a2ui.styleDrawer",defaultMessage:"Drawer"}),description:s({id:"settings.a2ui.styleDrawerDesc",defaultMessage:"Side panel"})},{value:"sheet",label:s({id:"settings.a2ui.styleSheet",defaultMessage:"Sheet"}),description:s({id:"settings.a2ui.styleSheetDesc",defaultMessage:"Bottom"})},{value:"fullscreen",label:s({id:"settings.a2ui.styleFullscreen",defaultMessage:"Fullscreen"}),description:s({id:"settings.a2ui.styleFullscreenDesc",defaultMessage:"Full screen"})}];return e.jsxs(V,{className:"p-6",children:[e.jsxs("h2",{className:"text-lg font-semibold text-foreground flex items-center gap-2 mb-4",children:[e.jsx(qe,{className:"w-5 h-5"}),s({id:"settings.sections.a2ui",defaultMessage:"A2UI Preferences"})]}),e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"space-y-3",children:[e.jsxs($e,{className:"text-sm font-medium flex items-center gap-2",children:[e.jsx(Et,{className:"w-4 h-4"}),s({id:"settings.a2ui.dialogStyle",defaultMessage:"Dialog Style"})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:s({id:"settings.a2ui.dialogStyleDesc",defaultMessage:"Choose how A2UI dialogs are displayed"})}),e.jsx("div",{className:"grid grid-cols-4 gap-2",children:c.map(o=>e.jsx(Qt,{value:o.value,label:o.label,description:o.description,selected:t.dialogStyle===o.value,onClick:()=>a("dialogStyle",o.value)},o.value))})]}),e.jsxs("div",{className:"flex items-center justify-between py-2 border-t border-border",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Hs,{className:"w-4 h-4 text-muted-foreground"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium",children:s({id:"settings.a2ui.smartMode",defaultMessage:"Smart Mode"})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:s({id:"settings.a2ui.smartModeDesc",defaultMessage:"Auto-select style based on question type"})})]})]}),e.jsx(b,{variant:t.smartModeEnabled?"default":"outline",size:"sm",onClick:()=>a("smartModeEnabled",!t.smartModeEnabled),children:t.smartModeEnabled?s({id:"common.enabled",defaultMessage:"Enabled"}):s({id:"common.disabled",defaultMessage:"Disabled"})})]}),e.jsxs("div",{className:"space-y-3 py-2 border-t border-border",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(As,{className:"w-4 h-4 text-muted-foreground"}),e.jsx($e,{className:"text-sm font-medium",children:s({id:"settings.a2ui.autoSelectionDuration",defaultMessage:"Auto-Selection Duration"})})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:s({id:"settings.a2ui.autoSelectionDurationDesc",defaultMessage:"Countdown before auto-selecting default option"})}),e.jsx(Yt,{value:t.autoSelectionDuration,onChange:o=>a("autoSelectionDuration",o)})]}),e.jsxs("div",{className:"flex items-center justify-between py-2 border-t border-border",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium",children:s({id:"settings.a2ui.pauseOnInteraction",defaultMessage:"Pause on Interaction"})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:s({id:"settings.a2ui.pauseOnInteractionDesc",defaultMessage:"Pause countdown when you interact with the dialog"})})]}),e.jsx(b,{variant:t.pauseOnInteraction?"default":"outline",size:"sm",onClick:()=>a("pauseOnInteraction",!t.pauseOnInteraction),children:t.pauseOnInteraction?s({id:"common.enabled",defaultMessage:"Enabled"}):s({id:"common.disabled",defaultMessage:"Disabled"})})]}),e.jsxs("div",{className:"flex items-center justify-between py-2 border-t border-border",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Lt,{className:"w-4 h-4 text-muted-foreground"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium",children:s({id:"settings.a2ui.soundNotification",defaultMessage:"Sound Notification"})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:s({id:"settings.a2ui.soundNotificationDesc",defaultMessage:"Play sound before auto-submit (3 seconds before)"})})]})]}),e.jsx(b,{variant:t.autoSelectionSoundEnabled?"default":"outline",size:"sm",onClick:()=>a("autoSelectionSoundEnabled",!t.autoSelectionSoundEnabled),children:t.autoSelectionSoundEnabled?s({id:"common.enabled",defaultMessage:"Enabled"}):s({id:"common.disabled",defaultMessage:"Disabled"})})]}),e.jsxs("div",{className:"flex items-center justify-between py-2 border-t border-border",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium",children:s({id:"settings.a2ui.showToolbarButton",defaultMessage:"Show Toolbar Button"})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:s({id:"settings.a2ui.showToolbarButtonDesc",defaultMessage:"Show A2UI quick action button in the toolbar"})})]}),e.jsx(b,{variant:t.showA2UIButtonInToolbar?"default":"outline",size:"sm",onClick:()=>a("showA2UIButtonInToolbar",!t.showA2UIButtonInToolbar),children:t.showA2UIButtonInToolbar?s({id:"common.enabled",defaultMessage:"Enabled"}):s({id:"common.disabled",defaultMessage:"Disabled"})})]}),e.jsx("div",{className:"flex justify-end pt-4 border-t border-border",children:e.jsx(b,{variant:"outline",size:"sm",onClick:i,children:s({id:"common.resetToDefaults",defaultMessage:"Reset to Defaults"})})})]})]})}function ea(){const s=document.cookie.match(/XSRF-TOKEN=([^;]+)/);return s?decodeURIComponent(s[1]):null}function _e({value:s,onChange:t,placeholder:a}){const[i,c]=d.useState(!1),[o,u]=d.useState(null),p=kt(s,500);d.useEffect(()=>{if(p){c(!0),u(null);const g=setTimeout(()=>{p.trim().length>0?u(null):u("Path cannot be empty."),c(!1)},1e3);return()=>clearTimeout(g)}else u(null),c(!1)},[p]);const M=async()=>{const{selectFile:g}=await Ys(async()=>{const{selectFile:L}=await import("./index-D3uMibtZ.js").then(x=>x.gM);return{selectFile:L}},__vite__mapDeps([0,1])),F=s?s.replace(/[/\\][^/\\]*$/,""):void 0,y=await g(F);y.path&&!y.cancelled&&!y.error&&t(y.path)};return e.jsxs("div",{children:[e.jsxs("div",{className:"flex gap-2 items-center",children:[e.jsxs("div",{className:"relative flex-1",children:[e.jsx(H,{value:s,onChange:g=>t(g.target.value),placeholder:a,className:I("flex-1",o&&"border-destructive")}),i&&e.jsx("div",{className:"absolute inset-y-0 right-0 flex items-center pr-3",children:e.jsx(Xs,{className:"h-4 w-4 animate-spin text-muted-foreground"})})]}),e.jsx(b,{type:"button",variant:"outline",size:"sm",className:"shrink-0 h-9",onClick:M,title:"Browse",children:e.jsx(Qs,{className:"w-4 h-4"})})]}),o&&e.jsx("p",{className:"text-xs text-destructive mt-1",children:o})]})}const sa=new Set(["gemini","qwen","opencode"]),ta=new Set(["claude"]);function Qe(s){return sa.has(s)?"envFile":ta.has(s)?"settingsFile":"none"}function aa({toolId:s,config:t,isDefault:a,isExpanded:i,toolAvailable:c,isSaving:o,onToggleExpand:u,onToggleEnabled:p,onSetDefault:M,onUpdateModel:g,onUpdateTags:F,onUpdateAvailableModels:y,onUpdateEnvFile:L,onUpdateSettingsFile:x,onUpdateEffort:j,onSaveToBackend:w}){const{formatMessage:m}=O(),[D,k]=d.useState(""),[S,P]=d.useState(""),B=()=>{const l=D.trim();l&&!t.tags.includes(l)&&(F([...t.tags,l]),k(""))},R=l=>{F(t.tags.filter(E=>E!==l))},f=()=>{const l=S.trim(),E=t.availableModels||[];l&&!E.includes(l)&&(y([...E,l]),P(""))},N=l=>{const E=t.availableModels||[];y(E.filter(z=>z!==l))},r=["分析","Debug","implementation","refactoring","testing"],h=Qe(s);return e.jsxs(V,{className:I("overflow-hidden",!t.enabled&&"opacity-60"),children:[e.jsxs("div",{className:"p-4 cursor-pointer hover:bg-muted/50 transition-colors",onClick:u,children:[e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:I("p-2 rounded-lg",t.enabled?"bg-primary/10":"bg-muted"),children:e.jsx(Ge,{className:I("w-5 h-5",t.enabled?"text-primary":"text-muted-foreground")})}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-sm font-medium text-foreground capitalize",children:s}),a&&e.jsx(_,{variant:"default",className:"text-xs",children:m({id:"settings.cliTools.default"})}),e.jsx(_,{variant:"outline",className:"text-xs",children:t.type}),c!==void 0&&e.jsx("span",{className:I("inline-block w-2 h-2 rounded-full",c?"bg-green-500":"bg-red-400"),title:c?"Available":"Unavailable"})]}),e.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:t.primaryModel})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(b,{variant:t.enabled?"default":"outline",size:"sm",className:"h-8",onClick:l=>{l.stopPropagation(),p()},children:t.enabled?e.jsxs(e.Fragment,{children:[e.jsx(W,{className:"w-4 h-4 mr-1"}),m({id:"settings.cliTools.enabled"})]}):e.jsxs(e.Fragment,{children:[e.jsx(G,{className:"w-4 h-4 mr-1"}),m({id:"settings.cliTools.disabled"})]})}),i?e.jsx(Te,{className:"w-5 h-5 text-muted-foreground"}):e.jsx(Me,{className:"w-5 h-5 text-muted-foreground"})]})]}),t.tags&&t.tags.length>0&&e.jsx("div",{className:"flex flex-wrap gap-1 mt-2",children:t.tags.map(l=>e.jsx(_,{variant:"secondary",className:"text-xs",children:l},l))})]}),i&&e.jsxs("div",{className:"border-t border-border p-4 space-y-4 bg-muted/30",children:[e.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium text-foreground",children:m({id:"settings.cliTools.primaryModel"})}),e.jsx(H,{value:t.primaryModel,onChange:l=>g("primaryModel",l.target.value),className:"mt-1"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium text-foreground",children:m({id:"settings.cliTools.secondaryModel"})}),e.jsx(H,{value:t.secondaryModel,onChange:l=>g("secondaryModel",l.target.value),className:"mt-1"})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"text-sm font-medium text-foreground",children:m({id:"apiSettings.cliSettings.tags"})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:m({id:"apiSettings.cliSettings.tagsDescription"})}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs("div",{className:"flex-1 flex flex-wrap gap-1.5 p-2 border border-input bg-background rounded-md min-h-[38px] focus-within:ring-2 focus-within:ring-ring focus-within:ring-offset-2",children:[t.tags.map(l=>e.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 bg-primary/10 text-primary rounded text-xs h-6",children:[l,e.jsx("button",{type:"button",onClick:()=>R(l),className:"hover:text-destructive transition-colors","aria-label":m({id:"apiSettings.cliSettings.removeTag"}),children:e.jsx(G,{className:"w-3 h-3"})})]},l)),e.jsx("input",{type:"text",value:D,onChange:l=>k(l.target.value),onKeyDown:l=>{l.key==="Enter"&&(l.preventDefault(),B())},placeholder:t.tags.length===0?m({id:"apiSettings.cliSettings.tagInputPlaceholder"}):"",className:"flex-1 min-w-[120px] bg-transparent border-0 outline-none text-sm placeholder:text-muted-foreground"})]}),e.jsx(b,{type:"button",size:"sm",onClick:B,variant:"outline",className:"shrink-0",children:e.jsx(ke,{className:"w-4 h-4"})})]}),e.jsxs("div",{className:"flex flex-wrap gap-1",children:[e.jsxs("span",{className:"text-xs text-muted-foreground",children:[m({id:"apiSettings.cliSettings.predefinedTags"}),":"]}),r.map(l=>e.jsx("button",{type:"button",onClick:()=>{t.tags.includes(l)||F([...t.tags,l])},disabled:t.tags.includes(l),className:"text-xs px-2 py-0.5 rounded border border-border hover:bg-muted disabled:opacity-50 disabled:cursor-not-allowed transition-colors",children:l},l))]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"text-sm font-medium text-foreground",children:m({id:"apiSettings.cliSettings.availableModels"})}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs("div",{className:"flex-1 flex flex-wrap gap-1.5 p-2 border border-input bg-background rounded-md min-h-[38px] focus-within:ring-2 focus-within:ring-ring focus-within:ring-offset-2",children:[(t.availableModels||[]).map(l=>e.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 bg-primary/10 text-primary rounded text-xs h-6",children:[l,e.jsx("button",{type:"button",onClick:()=>N(l),className:"hover:text-destructive transition-colors",children:e.jsx(G,{className:"w-3 h-3"})})]},l)),e.jsx("input",{type:"text",value:S,onChange:l=>P(l.target.value),onKeyDown:l=>{l.key==="Enter"&&(l.preventDefault(),f())},placeholder:(t.availableModels||[]).length===0?m({id:"apiSettings.cliSettings.availableModelsPlaceholder"}):"",className:"flex-1 min-w-[120px] bg-transparent border-0 outline-none text-sm placeholder:text-muted-foreground"})]}),e.jsx(b,{type:"button",size:"sm",onClick:f,variant:"outline",className:"shrink-0",children:e.jsx(ke,{className:"w-4 h-4"})})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:m({id:"apiSettings.cliSettings.availableModelsHint"})})]}),h==="envFile"&&e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"text-sm font-medium text-foreground",children:m({id:"settings.cliTools.envFile"})}),e.jsx(_e,{value:t.envFile||"",onChange:l=>L(l||void 0),placeholder:m({id:"settings.cliTools.envFilePlaceholder"})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:m({id:"settings.cliTools.envFileHint"})})]}),h==="settingsFile"&&e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"text-sm font-medium text-foreground",children:m({id:"apiSettings.cliSettings.settingsFile"})}),e.jsx(_e,{value:t.settingsFile||"",onChange:l=>x(l||void 0),placeholder:m({id:"apiSettings.cliSettings.settingsFilePlaceholder"})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:m({id:"apiSettings.cliSettings.settingsFileHint"})})]}),h==="settingsFile"&&e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"text-sm font-medium text-foreground",children:m({id:"settings.cliTools.effort"})}),e.jsx("div",{className:"flex gap-2",children:["low","medium","high"].map(l=>{const E=t.effort||"high",z=`settings.cliTools.effort${l.charAt(0).toUpperCase()+l.slice(1)}`;return e.jsx("button",{type:"button",onClick:()=>j(l==="high"&&!t.effort?void 0:l),className:I("px-3 py-1.5 rounded-md text-sm border transition-colors",E===l?"bg-primary text-primary-foreground border-primary":"border-border hover:bg-muted"),children:m({id:z})},l)})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:m({id:"settings.cliTools.effortHint"})})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[!a&&t.enabled&&e.jsx(b,{variant:"outline",size:"sm",onClick:M,children:m({id:"settings.cliTools.setDefault"})}),e.jsxs(b,{variant:"default",size:"sm",onClick:w,disabled:o,children:[e.jsx(We,{className:"w-4 h-4 mr-1"}),m(o?{id:"settings.cliTools.saving"}:{id:"settings.cliTools.saveToConfig"})]})]})]})]})}function na(){const{formatMessage:s}=O(),{data:t,isLoading:a}=lt(),{toggle:i,isPending:c}=ot(),{data:o,isLoading:u}=ct(),{toggle:p,isPending:M}=dt(),{data:g,isLoading:F}=mt(),{toggle:y,isPending:L}=ut(),{refresh:x,isPending:j}=xt(),{exportSettings:w,isPending:m}=ht(),{importSettings:D,isPending:k}=gt(),S=d.useRef(null),P=d.useCallback(async()=>{try{const R=await w(),f=new Blob([JSON.stringify(R,null,2)],{type:"application/json"}),N=URL.createObjectURL(f),r=document.createElement("a"),h=new Date().toISOString().replace(/[:.]/g,"-").slice(0,19);r.href=N,r.download=`ccw-settings-${h}.json`,document.body.appendChild(r),r.click(),document.body.removeChild(r),URL.revokeObjectURL(N),A.success(s({id:"settings.responseLanguage.exportSuccess"}))}catch{A.error(s({id:"settings.responseLanguage.exportError"}))}},[w,s]),B=d.useCallback(async R=>{var N;const f=(N=R.target.files)==null?void 0:N[0];if(f){if(R.target.value="",!f.name.endsWith(".json")&&f.type!=="application/json"){A.error(s({id:"settings.responseLanguage.importInvalidFile"}));return}try{const r=await f.text(),h=JSON.parse(r);if(!h.version||!h.settings){A.error(s({id:"settings.responseLanguage.importInvalidStructure"}));return}const l=await D(h);l.success?A.success(s({id:"settings.responseLanguage.importSuccess"},{imported:l.imported,skipped:l.skipped})):A.error(s({id:"settings.responseLanguage.importError"}))}catch(r){r instanceof SyntaxError?A.error(s({id:"settings.responseLanguage.importInvalidJson"})):A.error(s({id:"settings.responseLanguage.importError"}))}}},[D,s]);return e.jsxs(V,{className:"p-6",children:[e.jsxs("h2",{className:"text-lg font-semibold text-foreground flex items-center gap-2 mb-4",children:[e.jsx(Ft,{className:"w-5 h-5"}),s({id:"settings.sections.responseLanguage"})]}),e.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[e.jsxs("div",{className:"rounded-lg border border-border p-4 space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-sm font-medium",children:s({id:"settings.responseLanguage.chineseClaude"})}),e.jsx(_,{variant:"default",className:"text-xs",children:"Claude"})]}),e.jsx(b,{variant:t!=null&&t.claudeEnabled?"default":"outline",size:"sm",className:"h-7",disabled:a||c,onClick:()=>i(!(t!=null&&t.claudeEnabled),"claude"),children:t!=null&&t.claudeEnabled?e.jsxs(e.Fragment,{children:[e.jsx(W,{className:"w-4 h-4 mr-1"}),s({id:"settings.responseLanguage.enabled"})]}):e.jsxs(e.Fragment,{children:[e.jsx(G,{className:"w-4 h-4 mr-1"}),s({id:"settings.responseLanguage.disabled"})]})})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:s({id:"settings.responseLanguage.chineseClaudeDesc"})})]}),e.jsxs("div",{className:"rounded-lg border border-border p-4 space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-sm font-medium",children:s({id:"settings.responseLanguage.chineseCodex"})}),e.jsx(_,{variant:"secondary",className:"text-xs",children:"Codex"})]}),e.jsx(b,{variant:t!=null&&t.codexEnabled?"default":"outline",size:"sm",className:"h-7",disabled:a||c,onClick:()=>i(!(t!=null&&t.codexEnabled),"codex"),children:t!=null&&t.codexEnabled?e.jsxs(e.Fragment,{children:[e.jsx(W,{className:"w-4 h-4 mr-1"}),s({id:"settings.responseLanguage.enabled"})]}):e.jsxs(e.Fragment,{children:[e.jsx(G,{className:"w-4 h-4 mr-1"}),s({id:"settings.responseLanguage.disabled"})]})})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:s({id:"settings.responseLanguage.chineseCodexDesc"})}),(t==null?void 0:t.codexNeedsMigration)&&e.jsxs("p",{className:"text-xs text-yellow-500",children:[e.jsx(Fe,{className:"w-3 h-3 inline mr-1"}),s({id:"settings.responseLanguage.migrationWarning"})]})]}),e.jsxs("div",{className:"rounded-lg border border-border p-4 space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(_s,{className:"w-4 h-4 text-muted-foreground"}),e.jsx("span",{className:"text-sm font-medium",children:s({id:"settings.responseLanguage.windowsPlatform"})})]}),e.jsx(b,{variant:o!=null&&o.enabled?"default":"outline",size:"sm",className:"h-7",disabled:u||M,onClick:()=>p(!(o!=null&&o.enabled)),children:o!=null&&o.enabled?e.jsxs(e.Fragment,{children:[e.jsx(W,{className:"w-4 h-4 mr-1"}),s({id:"settings.responseLanguage.enabled"})]}):e.jsxs(e.Fragment,{children:[e.jsx(G,{className:"w-4 h-4 mr-1"}),s({id:"settings.responseLanguage.disabled"})]})})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:s({id:"settings.responseLanguage.windowsPlatformDesc"})})]}),e.jsxs("div",{className:"rounded-lg border border-border p-4 space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(qs,{className:"w-4 h-4 text-muted-foreground"}),e.jsx("span",{className:"text-sm font-medium",children:s({id:"settings.responseLanguage.cliEnhancement"})}),e.jsx(_,{variant:"secondary",className:"text-xs",children:"Codex"})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[(g==null?void 0:g.enabled)&&e.jsx(b,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0",disabled:F||j,onClick:()=>x(),title:s({id:"settings.responseLanguage.refreshConfig"}),children:e.jsx(Y,{className:I("w-3.5 h-3.5",j&&"animate-spin")})}),e.jsx(b,{variant:g!=null&&g.enabled?"default":"outline",size:"sm",className:"h-7",disabled:F||L,onClick:()=>y(!(g!=null&&g.enabled)),children:g!=null&&g.enabled?e.jsxs(e.Fragment,{children:[e.jsx(W,{className:"w-4 h-4 mr-1"}),s({id:"settings.responseLanguage.enabled"})]}):e.jsxs(e.Fragment,{children:[e.jsx(G,{className:"w-4 h-4 mr-1"}),s({id:"settings.responseLanguage.disabled"})]})})]})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:s({id:"settings.responseLanguage.cliEnhancementDesc"})}),(g==null?void 0:g.enabled)&&e.jsx("p",{className:"text-xs text-muted-foreground/70",children:s({id:"settings.responseLanguage.cliEnhancementHint"})})]})]}),e.jsx("div",{className:"mt-4 pt-4 border-t border-border",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("p",{className:"text-xs text-muted-foreground",children:s({id:"settings.responseLanguage.exportImportHint"})}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("input",{ref:S,type:"file",accept:".json,application/json",onChange:B,className:"hidden"}),e.jsx(b,{variant:"outline",size:"sm",className:"h-7",disabled:k,onClick:()=>{var R;return(R=S.current)==null?void 0:R.click()},children:k?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"w-3.5 h-3.5 border-2 border-border border-t-accent rounded-full animate-spin mr-1"}),s({id:"settings.responseLanguage.importing"})]}):e.jsxs(e.Fragment,{children:[e.jsx(Ct,{className:"w-3.5 h-3.5 mr-1"}),s({id:"settings.responseLanguage.import"})]})}),e.jsx(b,{variant:"outline",size:"sm",className:"h-7",disabled:m,onClick:P,children:m?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"w-3.5 h-3.5 border-2 border-border border-t-accent rounded-full animate-spin mr-1"}),s({id:"settings.responseLanguage.exporting"})]}):e.jsxs(e.Fragment,{children:[e.jsx(Ws,{className:"w-3.5 h-3.5 mr-1"}),s({id:"settings.responseLanguage.export"})]})})]})]})})]})}function ra(){const{formatMessage:s}=O(),[t,a]=d.useState(null),[i,c]=d.useState(!1),[o,u]=d.useState(null),[p,M]=d.useState(null),[g,F]=d.useState(()=>{try{const x=localStorage.getItem("ccw.autoUpdate");return x===null?!0:JSON.parse(x)}catch{return!0}}),y=async(x=!1)=>{x||c(!0),u(null);try{const j=await fetch("/api/version-check");if(!j.ok)throw new Error(`HTTP ${j.status}`);const w=await j.json();if(!w.currentVersion)throw new Error("Invalid response");a(w),M(new Date)}catch(j){x||u(j instanceof Error?j.message:"Unknown error")}finally{c(!1)}};d.useEffect(()=>{if(y(!0),!g)return;const x=setInterval(()=>y(!0),3600*1e3);return()=>clearInterval(x)},[g]);const L=x=>{F(x),localStorage.setItem("ccw.autoUpdate",JSON.stringify(x))};return e.jsxs(V,{className:"p-6",children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsxs("h2",{className:"text-lg font-semibold text-foreground flex items-center gap-2",children:[e.jsx(Ke,{className:"w-5 h-5"}),s({id:"settings.versionCheck.title"})]}),e.jsxs(b,{variant:"outline",size:"sm",disabled:i,onClick:()=>y(),children:[e.jsx(Y,{className:I("w-3.5 h-3.5 mr-1.5",i&&"animate-spin")}),s(i?{id:"settings.versionCheck.checking"}:{id:"settings.versionCheck.checkNow"})]})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"rounded-lg border border-border p-4 space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-sm text-muted-foreground",children:s({id:"settings.versionCheck.currentVersion"})}),e.jsx(_,{variant:"secondary",className:"font-mono text-xs",children:(t==null?void 0:t.currentVersion)??"..."})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-sm text-muted-foreground",children:s({id:"settings.versionCheck.latestVersion"})}),e.jsx(_,{variant:t!=null&&t.hasUpdate?"default":"secondary",className:"font-mono text-xs",children:(t==null?void 0:t.latestVersion)??"..."})]}),t&&e.jsxs("div",{className:"flex items-center justify-between pt-2 border-t border-border",children:[e.jsx("span",{className:"text-sm font-medium",children:t.hasUpdate?s({id:"settings.versionCheck.updateAvailable"}):s({id:"settings.versionCheck.upToDate"})}),e.jsx("span",{className:I("inline-block w-2.5 h-2.5 rounded-full",t.hasUpdate?"bg-orange-500":"bg-green-500")})]}),o&&e.jsxs("div",{className:"flex items-center gap-2 pt-2 border-t border-border",children:[e.jsx(Fe,{className:"w-4 h-4 text-destructive flex-shrink-0"}),e.jsxs("span",{className:"text-sm text-destructive",children:[s({id:"settings.versionCheck.checkFailed"}),": ",o]})]})]}),(t==null?void 0:t.hasUpdate)&&e.jsxs("div",{className:"rounded-lg border border-orange-500/30 bg-orange-500/5 p-4 space-y-3",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium text-foreground mb-1",children:s({id:"settings.versionCheck.updateCommand"})}),e.jsx("code",{className:"text-xs font-mono bg-muted px-3 py-1.5 rounded block",children:t.updateCommand})]}),e.jsx(b,{variant:"outline",size:"sm",asChild:!0,children:e.jsx("a",{href:"https://github.com/dyw0830/ccw/releases",target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1.5",children:s({id:"settings.versionCheck.viewRelease"})})})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[e.jsx("input",{type:"checkbox",checked:g,onChange:x=>L(x.target.checked),className:"rounded border-input"}),e.jsxs("div",{children:[e.jsx("span",{className:"text-sm font-medium",children:s({id:"settings.versionCheck.autoCheck"})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:s({id:"settings.versionCheck.autoCheckDesc"})})]})]}),e.jsxs("span",{className:"text-xs text-muted-foreground",children:[s({id:"settings.versionCheck.lastChecked"}),":"," ",p?p.toLocaleTimeString():s({id:"settings.versionCheck.never"})]})]})]})]})}function ia(){const{formatMessage:s}=O(),{installations:t,isLoading:a,refetch:i}=ft(),{upgrade:c,isPending:o}=pt(),{data:u}=bt();return e.jsxs(V,{className:"p-6",children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsxs("h2",{className:"text-lg font-semibold text-foreground flex items-center gap-2",children:[e.jsx(St,{className:"w-5 h-5"}),s({id:"settings.systemStatus.title"}),!a&&e.jsxs("span",{className:"text-sm font-normal text-muted-foreground",children:[t.length," ",s({id:"settings.systemStatus.installations"})]})]}),e.jsx("div",{className:"flex items-center gap-1",children:e.jsx(b,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0",onClick:()=>i(),title:s({id:"settings.systemStatus.refresh"}),children:e.jsx(Y,{className:I("w-3.5 h-3.5",a&&"animate-spin")})})})]}),a?e.jsx("div",{className:"text-sm text-muted-foreground py-4 text-center",children:s({id:"settings.systemStatus.checking"})}):t.length===0?e.jsxs("div",{className:"text-center py-6 space-y-2",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:s({id:"settings.systemStatus.noInstallations"})}),e.jsx("div",{className:"bg-muted/50 rounded-md p-3 inline-block",children:e.jsx("code",{className:"text-xs font-mono",children:"ccw install"})})]}):e.jsxs("div",{className:"space-y-3",children:[t.map(p=>{const M=p.installation_mode==="Global",g=new Date(p.installation_date).toLocaleDateString(),F=p.application_version!=="unknown"?p.application_version:p.installer_version;return e.jsxs("div",{className:"rounded-lg border border-border p-4 space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:I("inline-flex items-center justify-center w-8 h-8 rounded-lg",M?"bg-primary/10 text-primary":"bg-orange-500/10 text-orange-500"),children:M?e.jsx(Gs,{className:"w-4 h-4"}):e.jsx(Tt,{className:"w-4 h-4"})}),e.jsx("span",{className:"text-sm font-medium",children:s(M?{id:"settings.systemStatus.global"}:{id:"settings.systemStatus.path"})}),e.jsxs(_,{variant:"secondary",className:"text-xs font-mono",children:["v",F]})]}),e.jsxs(b,{variant:"ghost",size:"sm",className:"h-7",disabled:o,onClick:()=>c(p.installation_path),children:[e.jsx(Ke,{className:I("w-3.5 h-3.5 mr-1",o&&"animate-spin")}),s(o?{id:"settings.systemStatus.upgrading"}:{id:"settings.systemStatus.upgrade"})]})]}),e.jsx("div",{className:"text-xs text-muted-foreground bg-muted/50 rounded px-2 py-1 font-mono truncate",title:p.installation_path,children:p.installation_path}),e.jsxs("div",{className:"flex items-center gap-4 text-xs text-muted-foreground",children:[e.jsxs("span",{className:"inline-flex items-center gap-1",children:[e.jsx(Ks,{className:"w-3 h-3"}),g]}),e.jsxs("span",{className:"inline-flex items-center gap-1",children:[e.jsx(Js,{className:"w-3 h-3"}),p.files_count," ",s({id:"settings.systemStatus.files"})]})]})]},p.manifest_id)}),u&&!u.installed&&u.missingFiles.length>0&&e.jsxs("div",{className:"rounded-lg border border-yellow-500/50 bg-yellow-500/5 p-4 space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-2 text-sm font-medium text-yellow-600 dark:text-yellow-500",children:[e.jsx(Fe,{className:"w-4 h-4"}),s({id:"settings.systemStatus.incomplete"})," — ",u.missingFiles.length," ",s({id:"settings.systemStatus.missingFiles"}).toLowerCase()]}),e.jsxs("ul",{className:"text-xs text-muted-foreground list-disc list-inside",children:[u.missingFiles.slice(0,4).map(p=>e.jsx("li",{children:p},p)),u.missingFiles.length>4&&e.jsxs("li",{children:["+",u.missingFiles.length-4," more..."]})]}),e.jsxs("div",{className:"bg-muted/50 rounded-md p-2",children:[e.jsxs("p",{className:"text-xs font-medium mb-1",children:[s({id:"settings.systemStatus.runToFix"}),":"]}),e.jsx("code",{className:"text-xs font-mono bg-background px-2 py-1 rounded block",children:"ccw install"})]})]})]})]})}function la({cliTools:s,defaultCliTool:t,expandedTools:a,savingTools:i,onToggleExpand:c,onToggleEnabled:o,onSetDefault:u,onUpdateModel:p,onUpdateTags:M,onUpdateAvailableModels:g,onUpdateEnvFile:F,onUpdateSettingsFile:y,onUpdateEffort:L,onSaveToBackend:x,formatMessage:j}){const{data:w}=jt();return e.jsxs(e.Fragment,{children:[e.jsxs("p",{className:"text-sm text-muted-foreground mb-4",children:[j({id:"settings.cliTools.description"})," ",e.jsx("strong",{className:"text-foreground",children:t})]}),e.jsx("div",{className:"space-y-3",children:Object.entries(s).map(([m,D])=>{const k=w==null?void 0:w[m];return e.jsx(aa,{toolId:m,config:D,isDefault:m===t,isExpanded:a.has(m),toolAvailable:k==null?void 0:k.available,isSaving:i.has(m),onToggleExpand:()=>c(m),onToggleEnabled:()=>o(m),onSetDefault:()=>u(m),onUpdateModel:(S,P)=>p(m,S,P),onUpdateTags:S=>M(m,S),onUpdateAvailableModels:S=>g(m,S),onUpdateEnvFile:S=>F(m,S),onUpdateSettingsFile:S=>y(m,S),onUpdateEffort:S=>L(m,S),onSaveToBackend:()=>x(m)},m)})})]})}function ya(){const{formatMessage:s}=O(),{theme:t,setTheme:a}=Se(),i=ge(Os),c=ge(zs),o=ge($s),{updateCliTool:u,setDefaultCliTool:p,setUserPreferences:M,resetUserPreferences:g}=ge(),[F,y]=d.useState(new Set),[L,x]=d.useState(new Set),j=r=>{y(h=>{const l=new Set(h);return l.has(r)?l.delete(r):l.add(r),l})},w=r=>{u(r,{enabled:!i[r].enabled})},m=r=>{p(r)},D=(r,h,l)=>{u(r,{[h]:l})},k=(r,h)=>{u(r,{tags:h})},S=(r,h)=>{u(r,{availableModels:h})},P=(r,h)=>{u(r,{envFile:h})},B=(r,h)=>{u(r,{settingsFile:h})},R=(r,h)=>{u(r,{effort:h})},f=d.useCallback(async r=>{const h=i[r];if(h){x(l=>new Set(l).add(r));try{const l={enabled:h.enabled,primaryModel:h.primaryModel,secondaryModel:h.secondaryModel,tags:h.tags,availableModels:h.availableModels},E=Qe(r);E==="envFile"?l.envFile=h.envFile||null:E==="settingsFile"&&(l.settingsFile=h.settingsFile||null,l.effort=h.effort||null);const z=ea(),q={"Content-Type":"application/json"};z&&(q["X-CSRF-Token"]=z);const $=await fetch(`/api/cli/config/${r}`,{method:"PUT",headers:q,body:JSON.stringify(l),credentials:"same-origin"});if(!$.ok)throw new Error(`HTTP ${$.status}`);A.success(s({id:"settings.cliTools.configSaved"}),{description:r})}catch{A.error(s({id:"settings.cliTools.configSaveError"}),{description:r})}finally{x(l=>{const E=new Set(l);return E.delete(r),E})}}},[i,s]),N=(r,h)=>{M({[r]:h})};return e.jsxs("div",{className:"max-w-4xl mx-auto space-y-8",children:[e.jsxs("div",{children:[e.jsxs("h1",{className:"text-2xl font-bold text-foreground flex items-center gap-2",children:[e.jsx(Vs,{className:"w-6 h-6 text-primary"}),s({id:"settings.title"})]}),e.jsx("p",{className:"text-muted-foreground mt-1",children:s({id:"settings.description"})})]}),e.jsxs(V,{className:"p-6",children:[e.jsxs("h2",{className:"text-lg font-semibold text-foreground flex items-center gap-2 mb-4",children:[e.jsx(Bs,{className:"w-5 h-5"}),s({id:"settings.sections.appearance"})]}),e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("p",{className:"font-medium text-foreground mb-1",children:s({id:"settings.appearance.theme"})}),e.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:s({id:"settings.appearance.description"})}),e.jsx(At,{})]}),e.jsxs("div",{className:"flex items-center justify-between pt-4 border-t border-border",children:[e.jsxs("div",{children:[e.jsx("p",{className:"font-medium text-foreground",children:s({id:"settings.appearance.systemFollow"})}),e.jsx("p",{className:"text-sm text-muted-foreground",children:s({id:"settings.appearance.systemFollowDesc"})})]}),e.jsx(b,{variant:t==="system"?"default":"outline",size:"sm",onClick:()=>a("system"),children:s({id:"settings.appearance.themeOptions.system"})})]})]})]}),e.jsxs(V,{className:"p-6",children:[e.jsxs("h2",{className:"text-lg font-semibold text-foreground flex items-center gap-2 mb-4",children:[e.jsx(Je,{className:"w-5 h-5"}),s({id:"settings.sections.language"})]}),e.jsx("div",{className:"space-y-4",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("p",{className:"font-medium text-foreground",children:s({id:"settings.language.displayLanguage"})}),e.jsx("p",{className:"text-sm text-muted-foreground",children:s({id:"settings.language.chooseLanguage"})})]}),e.jsx(zt,{})]})})]}),e.jsx(na,{}),e.jsx(Zt,{}),e.jsx(ia,{}),e.jsx(ra,{}),e.jsxs(V,{className:"p-6",children:[e.jsxs("h2",{className:"text-lg font-semibold text-foreground flex items-center gap-2 mb-4",children:[e.jsx(Ge,{className:"w-5 h-5"}),s({id:"settings.sections.cliTools"})]}),e.jsx(la,{cliTools:i,defaultCliTool:c,expandedTools:F,savingTools:L,onToggleExpand:j,onToggleEnabled:w,onSetDefault:m,onUpdateModel:D,onUpdateTags:k,onUpdateAvailableModels:S,onUpdateEnvFile:P,onUpdateSettingsFile:B,onUpdateEffort:R,onSaveToBackend:f,formatMessage:s})]}),e.jsxs(V,{className:"p-6",children:[e.jsxs("h2",{className:"text-lg font-semibold text-foreground flex items-center gap-2 mb-4",children:[e.jsx(Y,{className:"w-5 h-5"}),s({id:"settings.dataRefresh.title"})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("p",{className:"font-medium text-foreground",children:s({id:"settings.dataRefresh.autoRefresh"})}),e.jsx("p",{className:"text-sm text-muted-foreground",children:s({id:"settings.dataRefresh.autoRefreshDesc"})})]}),e.jsx(b,{variant:o.autoRefresh?"default":"outline",size:"sm",onClick:()=>N("autoRefresh",!o.autoRefresh),children:o.autoRefresh?s({id:"settings.dataRefresh.enabled"}):s({id:"settings.dataRefresh.disabled"})})]}),o.autoRefresh&&e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("p",{className:"font-medium text-foreground",children:s({id:"settings.dataRefresh.refreshInterval"})}),e.jsx("p",{className:"text-sm text-muted-foreground",children:s({id:"settings.dataRefresh.refreshIntervalDesc"})})]}),e.jsx("div",{className:"flex gap-2",children:[15e3,3e4,6e4,12e4].map(r=>e.jsxs(b,{variant:o.refreshInterval===r?"default":"outline",size:"sm",onClick:()=>N("refreshInterval",r),children:[r/1e3,"s"]},r))})]})]})]}),e.jsxs(V,{className:"p-6",children:[e.jsxs("h2",{className:"text-lg font-semibold text-foreground flex items-center gap-2 mb-4",children:[e.jsx(Ee,{className:"w-5 h-5"}),s({id:"settings.notifications.title"})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("p",{className:"font-medium text-foreground",children:s({id:"settings.notifications.enableNotifications"})}),e.jsx("p",{className:"text-sm text-muted-foreground",children:s({id:"settings.notifications.enableNotificationsDesc"})})]}),e.jsx(b,{variant:o.notificationsEnabled?"default":"outline",size:"sm",onClick:()=>N("notificationsEnabled",!o.notificationsEnabled),children:o.notificationsEnabled?s({id:"settings.dataRefresh.enabled"}):s({id:"settings.dataRefresh.disabled"})})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("p",{className:"font-medium text-foreground",children:s({id:"settings.notifications.soundEffects"})}),e.jsx("p",{className:"text-sm text-muted-foreground",children:s({id:"settings.notifications.soundEffectsDesc"})})]}),e.jsx(b,{variant:o.soundEnabled?"default":"outline",size:"sm",onClick:()=>N("soundEnabled",!o.soundEnabled),children:o.soundEnabled?s({id:"settings.notifications.on"}):s({id:"settings.notifications.off"})})]})]})]}),e.jsx(Xt,{}),e.jsxs(V,{className:"p-6 border-destructive/50",children:[e.jsxs("h2",{className:"text-lg font-semibold text-foreground flex items-center gap-2 mb-4",children:[e.jsx(Ve,{className:"w-5 h-5"}),s({id:"common.actions.reset"})]}),e.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:s({id:"settings.reset.description"})}),e.jsxs(b,{variant:"destructive",onClick:()=>{confirm(s({id:"settings.reset.confirm"}))&&g()},children:[e.jsx(Ve,{className:"w-4 h-4 mr-2"}),s({id:"common.actions.resetToDefaults"})]})]})]})}export{ya as SettingsPage,ya as default};
144
+ //# sourceMappingURL=SettingsPage-CSwUd2Bw.js.map