claude-code-workflow 7.2.19 → 7.2.20

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 (196) hide show
  1. package/.claude/commands/workflow/analyze-with-file.md +33 -8
  2. package/.codex/skills/analyze-with-file/SKILL.md +55 -8
  3. package/ccw/frontend/dist/assets/{AlertDialog-zDuLRyN3.js → AlertDialog-Cukb0xv2.js} +2 -2
  4. package/ccw/frontend/dist/assets/{AlertDialog-zDuLRyN3.js.map → AlertDialog-Cukb0xv2.js.map} +1 -1
  5. package/ccw/frontend/dist/assets/{AnalysisPage-DGCGwIZY.js → AnalysisPage-Ddmv0J4x.js} +2 -2
  6. package/ccw/frontend/dist/assets/{AnalysisPage-DGCGwIZY.js.map → AnalysisPage-Ddmv0J4x.js.map} +1 -1
  7. package/ccw/frontend/dist/assets/{ApiSettingsPage-CgclCqmv.js → ApiSettingsPage-DMkrTZDX.js} +2 -2
  8. package/ccw/frontend/dist/assets/{ApiSettingsPage-CgclCqmv.js.map → ApiSettingsPage-DMkrTZDX.js.map} +1 -1
  9. package/ccw/frontend/dist/assets/{CliModeToggle-CbGH7qO4.js → CliModeToggle-DXenjpbe.js} +2 -2
  10. package/ccw/frontend/dist/assets/{CliModeToggle-CbGH7qO4.js.map → CliModeToggle-DXenjpbe.js.map} +1 -1
  11. package/ccw/frontend/dist/assets/{CliSessionSharePage-CJGlwyDw.js → CliSessionSharePage-B-ZIMqmX.js} +2 -2
  12. package/ccw/frontend/dist/assets/{CliSessionSharePage-CJGlwyDw.js.map → CliSessionSharePage-B-ZIMqmX.js.map} +1 -1
  13. package/ccw/frontend/dist/assets/{CliViewerPage-D-MHYyDt.js → CliViewerPage-9YxGyLxh.js} +2 -2
  14. package/ccw/frontend/dist/assets/{CliViewerPage-D-MHYyDt.js.map → CliViewerPage-9YxGyLxh.js.map} +1 -1
  15. package/ccw/frontend/dist/assets/{CodexLensPage-z6miX68P.js → CodexLensPage-B_uv5wdn.js} +2 -2
  16. package/ccw/frontend/dist/assets/{CodexLensPage-z6miX68P.js.map → CodexLensPage-B_uv5wdn.js.map} +1 -1
  17. package/ccw/frontend/dist/assets/{Collapsible-D5zS2wef.js → Collapsible-C2qk3yV0.js} +2 -2
  18. package/ccw/frontend/dist/assets/{Collapsible-D5zS2wef.js.map → Collapsible-C2qk3yV0.js.map} +1 -1
  19. package/ccw/frontend/dist/assets/{CommandsManagerPage-ChcTwmAn.js → CommandsManagerPage-DBtaWxLB.js} +2 -2
  20. package/ccw/frontend/dist/assets/{CommandsManagerPage-ChcTwmAn.js.map → CommandsManagerPage-DBtaWxLB.js.map} +1 -1
  21. package/ccw/frontend/dist/assets/{DeepWikiPage-Cv5LifSi.js → DeepWikiPage-d9K4_TgG.js} +2 -2
  22. package/ccw/frontend/dist/assets/{DeepWikiPage-Cv5LifSi.js.map → DeepWikiPage-d9K4_TgG.js.map} +1 -1
  23. package/ccw/frontend/dist/assets/{EndpointsPage-BcyNmqIa.js → EndpointsPage-DhW6hYrI.js} +2 -2
  24. package/ccw/frontend/dist/assets/{EndpointsPage-BcyNmqIa.js.map → EndpointsPage-DhW6hYrI.js.map} +1 -1
  25. package/ccw/frontend/dist/assets/{ExplorerPage-DfHtqeQM.js → ExplorerPage-DYYpCvtB.js} +2 -2
  26. package/ccw/frontend/dist/assets/{ExplorerPage-DfHtqeQM.js.map → ExplorerPage-DYYpCvtB.js.map} +1 -1
  27. package/ccw/frontend/dist/assets/{FixSessionPage-CbvZApeF.js → FixSessionPage-CSmiT5SE.js} +2 -2
  28. package/ccw/frontend/dist/assets/{FixSessionPage-CbvZApeF.js.map → FixSessionPage-CSmiT5SE.js.map} +1 -1
  29. package/ccw/frontend/dist/assets/{FloatingFileBrowser-DLz85cw9.js → FloatingFileBrowser-DvMsXLdP.js} +2 -2
  30. package/ccw/frontend/dist/assets/{FloatingFileBrowser-DLz85cw9.js.map → FloatingFileBrowser-DvMsXLdP.js.map} +1 -1
  31. package/ccw/frontend/dist/assets/{FloatingPanel-DrUTmgtV.js → FloatingPanel-sqezhSI8.js} +2 -2
  32. package/ccw/frontend/dist/assets/{FloatingPanel-DrUTmgtV.js.map → FloatingPanel-sqezhSI8.js.map} +1 -1
  33. package/ccw/frontend/dist/assets/{GraphExplorerPage-C439yLvH.js → GraphExplorerPage-DS8ghMFM.js} +2 -2
  34. package/ccw/frontend/dist/assets/{GraphExplorerPage-C439yLvH.js.map → GraphExplorerPage-DS8ghMFM.js.map} +1 -1
  35. package/ccw/frontend/dist/assets/{HistoryPage-BClJJMEy.js → HistoryPage-B-x1RyHu.js} +2 -2
  36. package/ccw/frontend/dist/assets/{HistoryPage-BClJJMEy.js.map → HistoryPage-B-x1RyHu.js.map} +1 -1
  37. package/ccw/frontend/dist/assets/{HookManagerPage-DI-2QDLJ.js → HookManagerPage-BbxpDb68.js} +2 -2
  38. package/ccw/frontend/dist/assets/{HookManagerPage-DI-2QDLJ.js.map → HookManagerPage-BbxpDb68.js.map} +1 -1
  39. package/ccw/frontend/dist/assets/{InstallationsPage-DKlz1ypL.js → InstallationsPage-3bShz_Ai.js} +2 -2
  40. package/ccw/frontend/dist/assets/{InstallationsPage-DKlz1ypL.js.map → InstallationsPage-3bShz_Ai.js.map} +1 -1
  41. package/ccw/frontend/dist/assets/{IssueHubPage--6DduN4j.js → IssueHubPage-BQY_Hh3e.js} +2 -2
  42. package/ccw/frontend/dist/assets/{IssueHubPage--6DduN4j.js.map → IssueHubPage-BQY_Hh3e.js.map} +1 -1
  43. package/ccw/frontend/dist/assets/{LiteTasksPage-39j6xEeL.js → LiteTasksPage-vD_8fQcR.js} +2 -2
  44. package/ccw/frontend/dist/assets/{LiteTasksPage-39j6xEeL.js.map → LiteTasksPage-vD_8fQcR.js.map} +1 -1
  45. package/ccw/frontend/dist/assets/{McpManagerPage-D00C9RVN.js → McpManagerPage-CI5ZzB8A.js} +2 -2
  46. package/ccw/frontend/dist/assets/{McpManagerPage-D00C9RVN.js.map → McpManagerPage-CI5ZzB8A.js.map} +1 -1
  47. package/ccw/frontend/dist/assets/{MemoryPage-BXWKdTyM.js → MemoryPage-CNuj2eNg.js} +2 -2
  48. package/ccw/frontend/dist/assets/{MemoryPage-BXWKdTyM.js.map → MemoryPage-CNuj2eNg.js.map} +1 -1
  49. package/ccw/frontend/dist/assets/{NotFoundPage-h5o3I7cF.js → NotFoundPage-BrnAXkb1.js} +2 -2
  50. package/ccw/frontend/dist/assets/{NotFoundPage-h5o3I7cF.js.map → NotFoundPage-BrnAXkb1.js.map} +1 -1
  51. package/ccw/frontend/dist/assets/{OrchestratorPage-jkyjmiI1.js → OrchestratorPage-CH81PGt4.js} +2 -2
  52. package/ccw/frontend/dist/assets/{OrchestratorPage-jkyjmiI1.js.map → OrchestratorPage-CH81PGt4.js.map} +1 -1
  53. package/ccw/frontend/dist/assets/{ProjectOverviewPage-C2bE5eb2.js → ProjectOverviewPage-dwiEXl2O.js} +2 -2
  54. package/ccw/frontend/dist/assets/{ProjectOverviewPage-C2bE5eb2.js.map → ProjectOverviewPage-dwiEXl2O.js.map} +1 -1
  55. package/ccw/frontend/dist/assets/{PromptHistoryPage-DzmPK4GZ.js → PromptHistoryPage-CabgLjJU.js} +2 -2
  56. package/ccw/frontend/dist/assets/{PromptHistoryPage-DzmPK4GZ.js.map → PromptHistoryPage-CabgLjJU.js.map} +1 -1
  57. package/ccw/frontend/dist/assets/{ReviewSessionPage-CVMH1K6G.js → ReviewSessionPage-DAMrNFn8.js} +2 -2
  58. package/ccw/frontend/dist/assets/{ReviewSessionPage-CVMH1K6G.js.map → ReviewSessionPage-DAMrNFn8.js.map} +1 -1
  59. package/ccw/frontend/dist/assets/{RulesManagerPage-BDZco-r2.js → RulesManagerPage-4jzmxPn0.js} +2 -2
  60. package/ccw/frontend/dist/assets/{RulesManagerPage-BDZco-r2.js.map → RulesManagerPage-4jzmxPn0.js.map} +1 -1
  61. package/ccw/frontend/dist/assets/{SessionDetailPage-D5cM-8Kk.js → SessionDetailPage-C5Btktmp.js} +2 -2
  62. package/ccw/frontend/dist/assets/{SessionDetailPage-D5cM-8Kk.js.map → SessionDetailPage-C5Btktmp.js.map} +1 -1
  63. package/ccw/frontend/dist/assets/{SessionsPage-BFy74ye3.js → SessionsPage-CQIB4E8m.js} +2 -2
  64. package/ccw/frontend/dist/assets/{SessionsPage-BFy74ye3.js.map → SessionsPage-CQIB4E8m.js.map} +1 -1
  65. package/ccw/frontend/dist/assets/SettingsPage-Yi9UAfm7.js +150 -0
  66. package/ccw/frontend/dist/assets/SettingsPage-Yi9UAfm7.js.map +1 -0
  67. package/ccw/frontend/dist/assets/{SkillsManagerPage-8Dsq4AUD.js → SkillsManagerPage-BqfvYSkT.js} +2 -2
  68. package/ccw/frontend/dist/assets/{SkillsManagerPage-8Dsq4AUD.js.map → SkillsManagerPage-BqfvYSkT.js.map} +1 -1
  69. package/ccw/frontend/dist/assets/{SpecsSettingsPage-CG77iAYQ.js → SpecsSettingsPage-BdVPM5R6.js} +2 -2
  70. package/ccw/frontend/dist/assets/{SpecsSettingsPage-CG77iAYQ.js.map → SpecsSettingsPage-BdVPM5R6.js.map} +1 -1
  71. package/ccw/frontend/dist/assets/{Switch-BbuvVsX-.js → Switch-BG929kV0.js} +2 -2
  72. package/ccw/frontend/dist/assets/{Switch-BbuvVsX-.js.map → Switch-BG929kV0.js.map} +1 -1
  73. package/ccw/frontend/dist/assets/{TabsNavigation-SGJhC8-P.js → TabsNavigation-Bol1y09b.js} +2 -2
  74. package/ccw/frontend/dist/assets/{TabsNavigation-SGJhC8-P.js.map → TabsNavigation-Bol1y09b.js.map} +1 -1
  75. package/ccw/frontend/dist/assets/{TaskDrawer-p51jeScU.js → TaskDrawer-Dwutrn8_.js} +2 -2
  76. package/ccw/frontend/dist/assets/{TaskDrawer-p51jeScU.js.map → TaskDrawer-Dwutrn8_.js.map} +1 -1
  77. package/ccw/frontend/dist/assets/{TeamPage-CvZBThbr.js → TeamPage-CpCSwpxD.js} +2 -2
  78. package/ccw/frontend/dist/assets/{TeamPage-CvZBThbr.js.map → TeamPage-CpCSwpxD.js.map} +1 -1
  79. package/ccw/frontend/dist/assets/{TerminalDashboardPage-uhM7kGKI.js → TerminalDashboardPage-DODKjOeK.js} +2 -2
  80. package/ccw/frontend/dist/assets/{TerminalDashboardPage-uhM7kGKI.js.map → TerminalDashboardPage-DODKjOeK.js.map} +1 -1
  81. package/ccw/frontend/dist/assets/{archive-D6ySrtHC.js → archive-CQw634kD.js} +2 -2
  82. package/ccw/frontend/dist/assets/{archive-D6ySrtHC.js.map → archive-CQw634kD.js.map} +1 -1
  83. package/ccw/frontend/dist/assets/{archive-restore-C1uI-5TY.js → archive-restore-B-_EG6wE.js} +2 -2
  84. package/ccw/frontend/dist/assets/{archive-restore-C1uI-5TY.js.map → archive-restore-B-_EG6wE.js.map} +1 -1
  85. package/ccw/frontend/dist/assets/{arrow-right-qE5-FMG8.js → arrow-right-CcQtxBrU.js} +2 -2
  86. package/ccw/frontend/dist/assets/{arrow-right-qE5-FMG8.js.map → arrow-right-CcQtxBrU.js.map} +1 -1
  87. package/ccw/frontend/dist/assets/{bookmark-plus-DL4iL38T.js → bookmark-plus-Cl-BbcpR.js} +2 -2
  88. package/ccw/frontend/dist/assets/{bookmark-plus-DL4iL38T.js.map → bookmark-plus-Cl-BbcpR.js.map} +1 -1
  89. package/ccw/frontend/dist/assets/{bot-CZzIeEkg.js → bot-CLSNSkW_.js} +2 -2
  90. package/ccw/frontend/dist/assets/{bot-CZzIeEkg.js.map → bot-CLSNSkW_.js.map} +1 -1
  91. package/ccw/frontend/dist/assets/{braces-MEPRT2LN.js → braces-DWwkaDS6.js} +2 -2
  92. package/ccw/frontend/dist/assets/{braces-MEPRT2LN.js.map → braces-DWwkaDS6.js.map} +1 -1
  93. package/ccw/frontend/dist/assets/{circle-stop-GQcecSUg.js → circle-stop-DiS7e6ma.js} +2 -2
  94. package/ccw/frontend/dist/assets/{circle-stop-GQcecSUg.js.map → circle-stop-DiS7e6ma.js.map} +1 -1
  95. package/ccw/frontend/dist/assets/{cpu-CzxYMs1Y.js → cpu-CuvHUVXO.js} +2 -2
  96. package/ccw/frontend/dist/assets/{cpu-CzxYMs1Y.js.map → cpu-CuvHUVXO.js.map} +1 -1
  97. package/ccw/frontend/dist/assets/{ellipsis-vertical-DZMfiFKo.js → ellipsis-vertical-BoVlINSw.js} +2 -2
  98. package/ccw/frontend/dist/assets/{ellipsis-vertical-DZMfiFKo.js.map → ellipsis-vertical-BoVlINSw.js.map} +1 -1
  99. package/ccw/frontend/dist/assets/{eye-BXfPoClW.js → eye-BEMOdcAN.js} +2 -2
  100. package/ccw/frontend/dist/assets/{eye-BXfPoClW.js.map → eye-BEMOdcAN.js.map} +1 -1
  101. package/ccw/frontend/dist/assets/{eye-off-CyaKXmAk.js → eye-off-C5HS4Ytm.js} +2 -2
  102. package/ccw/frontend/dist/assets/{eye-off-CyaKXmAk.js.map → eye-off-C5HS4Ytm.js.map} +1 -1
  103. package/ccw/frontend/dist/assets/{file-json-B4LbFfTU.js → file-json-DQ9XLq0B.js} +2 -2
  104. package/ccw/frontend/dist/assets/{file-json-B4LbFfTU.js.map → file-json-DQ9XLq0B.js.map} +1 -1
  105. package/ccw/frontend/dist/assets/{file-text-CIWG7Xgj.js → file-text-TGs_qCbw.js} +2 -2
  106. package/ccw/frontend/dist/assets/{file-text-CIWG7Xgj.js.map → file-text-TGs_qCbw.js.map} +1 -1
  107. package/ccw/frontend/dist/assets/{filter-CNBjjvBX.js → filter-CIuCqnDB.js} +2 -2
  108. package/ccw/frontend/dist/assets/{filter-CNBjjvBX.js.map → filter-CIuCqnDB.js.map} +1 -1
  109. package/ccw/frontend/dist/assets/{folder-DT_XOYw9.js → folder-BkivHBwn.js} +2 -2
  110. package/ccw/frontend/dist/assets/{folder-DT_XOYw9.js.map → folder-BkivHBwn.js.map} +1 -1
  111. package/ccw/frontend/dist/assets/{gauge-mvQWOG3S.js → gauge-CtM68fVY.js} +2 -2
  112. package/ccw/frontend/dist/assets/{gauge-mvQWOG3S.js.map → gauge-CtM68fVY.js.map} +1 -1
  113. package/ccw/frontend/dist/assets/{globe-B25jraBz.js → globe-DpnrINqP.js} +2 -2
  114. package/ccw/frontend/dist/assets/{globe-B25jraBz.js.map → globe-DpnrINqP.js.map} +1 -1
  115. package/ccw/frontend/dist/assets/{grid-3x3-CptugI_Z.js → grid-3x3-SjX0a5JH.js} +2 -2
  116. package/ccw/frontend/dist/assets/{grid-3x3-CptugI_Z.js.map → grid-3x3-SjX0a5JH.js.map} +1 -1
  117. package/ccw/frontend/dist/assets/{hard-drive-BUK9Wcoz.js → hard-drive-ByAmnoEg.js} +2 -2
  118. package/ccw/frontend/dist/assets/{hard-drive-BUK9Wcoz.js.map → hard-drive-ByAmnoEg.js.map} +1 -1
  119. package/ccw/frontend/dist/assets/{hash-dddMDYK7.js → hash-DbLc3VOZ.js} +2 -2
  120. package/ccw/frontend/dist/assets/{hash-dddMDYK7.js.map → hash-DbLc3VOZ.js.map} +1 -1
  121. package/ccw/frontend/dist/assets/{history-BdDj8MtC.js → history-Botz5Z5d.js} +2 -2
  122. package/ccw/frontend/dist/assets/{history-BdDj8MtC.js.map → history-Botz5Z5d.js.map} +1 -1
  123. package/ccw/frontend/dist/assets/{index-CcxBnbbQ.js → index-BGvyf4-9.js} +2 -2
  124. package/ccw/frontend/dist/assets/{index-CcxBnbbQ.js.map → index-BGvyf4-9.js.map} +1 -1
  125. package/ccw/frontend/dist/assets/index-BoqylFO4.css +39 -0
  126. package/ccw/frontend/dist/assets/{index-DZGHdspr.js → index-DP_mTJI8.js} +3 -3
  127. package/ccw/frontend/dist/assets/{index-DZGHdspr.js.map → index-DP_mTJI8.js.map} +1 -1
  128. package/ccw/frontend/dist/assets/{index-B6UfIzhR.js → index-MkgdhX7a.js} +2 -2
  129. package/ccw/frontend/dist/assets/{index-B6UfIzhR.js.map → index-MkgdhX7a.js.map} +1 -1
  130. package/ccw/frontend/dist/assets/{index-EFcT7h67.js → index-ni-tG9rm.js} +2 -2
  131. package/ccw/frontend/dist/assets/{index-EFcT7h67.js.map → index-ni-tG9rm.js.map} +1 -1
  132. package/ccw/frontend/dist/assets/{layout-grid-BVlT1oI7.js → layout-grid-11E4bGJz.js} +2 -2
  133. package/ccw/frontend/dist/assets/{layout-grid-BVlT1oI7.js.map → layout-grid-11E4bGJz.js.map} +1 -1
  134. package/ccw/frontend/dist/assets/{lightbulb-Mt3Tlwh4.js → lightbulb-8KrKY82b.js} +2 -2
  135. package/ccw/frontend/dist/assets/{lightbulb-Mt3Tlwh4.js.map → lightbulb-8KrKY82b.js.map} +1 -1
  136. package/ccw/frontend/dist/assets/{link-2-DXqT64qo.js → link-2-BUn6RILb.js} +2 -2
  137. package/ccw/frontend/dist/assets/{link-2-DXqT64qo.js.map → link-2-BUn6RILb.js.map} +1 -1
  138. package/ccw/frontend/dist/assets/{link-CBMtrpcI.js → link-CmP254Ai.js} +2 -2
  139. package/ccw/frontend/dist/assets/{link-CBMtrpcI.js.map → link-CmP254Ai.js.map} +1 -1
  140. package/ccw/frontend/dist/assets/{list-DDyEM4AO.js → list-BAwzl4a2.js} +2 -2
  141. package/ccw/frontend/dist/assets/{list-DDyEM4AO.js.map → list-BAwzl4a2.js.map} +1 -1
  142. package/ccw/frontend/dist/assets/{map-pin-B2FxBKfk.js → map-pin-gi342rqk.js} +2 -2
  143. package/ccw/frontend/dist/assets/{map-pin-B2FxBKfk.js.map → map-pin-gi342rqk.js.map} +1 -1
  144. package/ccw/frontend/dist/assets/{messages-square-zJfTY9pq.js → messages-square-C1Lh8q8b.js} +2 -2
  145. package/ccw/frontend/dist/assets/{messages-square-zJfTY9pq.js.map → messages-square-C1Lh8q8b.js.map} +1 -1
  146. package/ccw/frontend/dist/assets/{minimize-2-DnhGZj79.js → minimize-2-OgWNLKdq.js} +2 -2
  147. package/ccw/frontend/dist/assets/{minimize-2-DnhGZj79.js.map → minimize-2-OgWNLKdq.js.map} +1 -1
  148. package/ccw/frontend/dist/assets/{package-DYzAybhU.js → package-Djsvs5qp.js} +2 -2
  149. package/ccw/frontend/dist/assets/{package-DYzAybhU.js.map → package-Djsvs5qp.js.map} +1 -1
  150. package/ccw/frontend/dist/assets/{plug-B3kKHsu1.js → plug-DvSZP2cp.js} +2 -2
  151. package/ccw/frontend/dist/assets/{plug-B3kKHsu1.js.map → plug-DvSZP2cp.js.map} +1 -1
  152. package/ccw/frontend/dist/assets/{power-BPNNZgLy.js → power-BY7vTLmU.js} +2 -2
  153. package/ccw/frontend/dist/assets/{power-BPNNZgLy.js.map → power-BY7vTLmU.js.map} +1 -1
  154. package/ccw/frontend/dist/assets/{save-Cwry93p-.js → save-DXfqv84T.js} +2 -2
  155. package/ccw/frontend/dist/assets/{save-Cwry93p-.js.map → save-DXfqv84T.js.map} +1 -1
  156. package/ccw/frontend/dist/assets/{send-DuWWy2J8.js → send-E2o2LZSX.js} +2 -2
  157. package/ccw/frontend/dist/assets/{send-DuWWy2J8.js.map → send-E2o2LZSX.js.map} +1 -1
  158. package/ccw/frontend/dist/assets/{settings-2-C3U1eSK6.js → settings-2-ChD1LFHH.js} +2 -2
  159. package/ccw/frontend/dist/assets/{settings-2-C3U1eSK6.js.map → settings-2-ChD1LFHH.js.map} +1 -1
  160. package/ccw/frontend/dist/assets/{square-check-big-CrG1ejFB.js → square-check-big-CBymuqmD.js} +2 -2
  161. package/ccw/frontend/dist/assets/{square-check-big-CrG1ejFB.js.map → square-check-big-CBymuqmD.js.map} +1 -1
  162. package/ccw/frontend/dist/assets/{square-pen-eLWlCgZ5.js → square-pen-BfaiJgOX.js} +2 -2
  163. package/ccw/frontend/dist/assets/{square-pen-eLWlCgZ5.js.map → square-pen-BfaiJgOX.js.map} +1 -1
  164. package/ccw/frontend/dist/assets/{star-sveo4KRn.js → star-DHMWqZ09.js} +2 -2
  165. package/ccw/frontend/dist/assets/{star-sveo4KRn.js.map → star-DHMWqZ09.js.map} +1 -1
  166. package/ccw/frontend/dist/assets/{style-CRdAX7Cu.js → style-wvcOEAiM.js} +2 -2
  167. package/ccw/frontend/dist/assets/{style-CRdAX7Cu.js.map → style-wvcOEAiM.js.map} +1 -1
  168. package/ccw/frontend/dist/assets/{target-Oz1-z8Zu.js → target-B8AMmf_N.js} +2 -2
  169. package/ccw/frontend/dist/assets/{target-Oz1-z8Zu.js.map → target-B8AMmf_N.js.map} +1 -1
  170. package/ccw/frontend/dist/assets/{test-tube-BozkZKD6.js → test-tube-BpDeTJi1.js} +2 -2
  171. package/ccw/frontend/dist/assets/{test-tube-BozkZKD6.js.map → test-tube-BpDeTJi1.js.map} +1 -1
  172. package/ccw/frontend/dist/assets/{upload-CTlUsxyh.js → upload-pflkdIDG.js} +2 -2
  173. package/ccw/frontend/dist/assets/{upload-CTlUsxyh.js.map → upload-pflkdIDG.js.map} +1 -1
  174. package/ccw/frontend/dist/assets/{useApiSettings-D6WfgFYj.js → useApiSettings-BPx4DyKT.js} +2 -2
  175. package/ccw/frontend/dist/assets/{useApiSettings-D6WfgFYj.js.map → useApiSettings-BPx4DyKT.js.map} +1 -1
  176. package/ccw/frontend/dist/assets/{useCli-CgGVNN5I.js → useCli-D1jfH3XA.js} +2 -2
  177. package/ccw/frontend/dist/assets/{useCli-CgGVNN5I.js.map → useCli-D1jfH3XA.js.map} +1 -1
  178. package/ccw/frontend/dist/assets/{useCommands-o5CKv-10.js → useCommands-DhR71vpa.js} +2 -2
  179. package/ccw/frontend/dist/assets/{useCommands-o5CKv-10.js.map → useCommands-DhR71vpa.js.map} +1 -1
  180. package/ccw/frontend/dist/assets/{useDebounce-rKo_bCBK.js → useDebounce-a6Yyer3m.js} +2 -2
  181. package/ccw/frontend/dist/assets/{useDebounce-rKo_bCBK.js.map → useDebounce-a6Yyer3m.js.map} +1 -1
  182. package/ccw/frontend/dist/assets/{useFileExplorer-WeE4t9Hg.js → useFileExplorer-B8W2JTj2.js} +2 -2
  183. package/ccw/frontend/dist/assets/{useFileExplorer-WeE4t9Hg.js.map → useFileExplorer-B8W2JTj2.js.map} +1 -1
  184. package/ccw/frontend/dist/assets/{useLocale-BS0tTC-_.js → useLocale-aMHdQIL_.js} +2 -2
  185. package/ccw/frontend/dist/assets/{useLocale-BS0tTC-_.js.map → useLocale-aMHdQIL_.js.map} +1 -1
  186. package/ccw/frontend/dist/assets/{useSkills-BUgAhw6r.js → useSkills-BHpc2LtN.js} +3 -3
  187. package/ccw/frontend/dist/assets/{useSkills-BUgAhw6r.js.map → useSkills-BHpc2LtN.js.map} +1 -1
  188. package/ccw/frontend/dist/assets/{useSystemSettings-CLhmINg1.js → useSystemSettings-BFD0SvEF.js} +2 -2
  189. package/ccw/frontend/dist/assets/{useSystemSettings-CLhmINg1.js.map → useSystemSettings-BFD0SvEF.js.map} +1 -1
  190. package/ccw/frontend/dist/assets/{wand-sparkles-BUHKJH1X.js → wand-sparkles-dYtI2IKM.js} +2 -2
  191. package/ccw/frontend/dist/assets/{wand-sparkles-BUHKJH1X.js.map → wand-sparkles-dYtI2IKM.js.map} +1 -1
  192. package/ccw/frontend/dist/index.html +2 -2
  193. package/package.json +1 -1
  194. package/ccw/frontend/dist/assets/SettingsPage-Qj0fFDjX.js +0 -150
  195. package/ccw/frontend/dist/assets/SettingsPage-Qj0fFDjX.js.map +0 -1
  196. package/ccw/frontend/dist/assets/index-nU0QYi1y.css +0 -39
@@ -1,150 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-DZGHdspr.js","assets/index-nU0QYi1y.css"])))=>i.map(i=>d[i]);
2
- import{O as oe,r as o,ab as Es,u as V,co as Re,j as e,al as Fs,cp as Ps,cq as Ce,cr as Ge,cs as Ls,ct as ae,cu as Us,cv as Ds,cw as Is,cx as Os,aq as As,ar as Rs,as as Ke,c as z,at as Hs,au as $s,C as K,B as J,bq as Z,e as N,X as Y,cy as He,ap as Me,cz as zs,cA as _s,cB as $e,aV as ss,cC as Bs,I as P,_ as A,R as ne,a7 as pe,cD as Vs,bu as Je,U as qs,l as Ws,cE as Gs,cF as Ks,ao as Js,cG as ts,cH as Xs,bf as Ie,cI as Se,cJ as Ys,cK as Qs,cL as Zs,S as et,cM as st,cN as Xe,aw as ze,cO as tt,aP as at,an as nt,cP as rt,i as it,F as lt,N as ot,aU as ct,bX as dt}from"./index-DZGHdspr.js";import{A as mt,a as ut,b as xt,c as ht,d as gt,e as ft,f as pt,g as bt}from"./AlertDialog-zDuLRyN3.js";import{u as jt,a as Nt,b as vt,c as yt,d as wt,e as kt,f as Ct,g as St,h as Tt,i as Mt,j as Et,k as Ft,l as Pt}from"./useSystemSettings-CLhmINg1.js";import{u as Lt}from"./useLocale-BS0tTC-_.js";import{T as Ut}from"./test-tube-BozkZKD6.js";import{L as Dt}from"./link-CBMtrpcI.js";import{S as It}from"./send-DuWWy2J8.js";import{E as ce}from"./eye-off-CyaKXmAk.js";import{E as de}from"./eye-BXfPoClW.js";import{S as Ee}from"./save-Cwry93p-.js";import{B as Ot}from"./bot-CZzIeEkg.js";import{S as At}from"./settings-2-C3U1eSK6.js";import{u as Rt}from"./useDebounce-rKo_bCBK.js";import{C as as}from"./cpu-CzxYMs1Y.js";import{U as Ht}from"./upload-CTlUsxyh.js";import{P as $t}from"./package-DYzAybhU.js";import{F as zt}from"./folder-DT_XOYw9.js";/**
3
- * @license lucide-react v0.460.0 - ISC
4
- *
5
- * This source code is licensed under the ISC license.
6
- * See the LICENSE file in the root directory of this source tree.
7
- */const _t=oe("BellOff",[["path",{d:"M8.7 3A6 6 0 0 1 18 8a21.3 21.3 0 0 0 .6 5",key:"o7mx20"}],["path",{d:"M17 17H3s3-2 3-9a4.67 4.67 0 0 1 .3-1.7",key:"16f1lm"}],["path",{d:"M10.3 21a1.94 1.94 0 0 0 3.4 0",key:"qgo35s"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);/**
8
- * @license lucide-react v0.460.0 - ISC
9
- *
10
- * This source code is licensed under the ISC license.
11
- * See the LICENSE file in the root directory of this source tree.
12
- */const ns=oe("CircleArrowUp",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m16 12-4-4-4 4",key:"177agl"}],["path",{d:"M12 16V8",key:"1sbj14"}]]);/**
13
- * @license lucide-react v0.460.0 - ISC
14
- *
15
- * This source code is licensed under the ISC license.
16
- * See the LICENSE file in the root directory of this source tree.
17
- */const rs=oe("Languages",[["path",{d:"m5 8 6 6",key:"1wu5hv"}],["path",{d:"m4 14 6-6 2-3",key:"1k1g8d"}],["path",{d:"M2 5h12",key:"or177f"}],["path",{d:"M7 2h1",key:"1t2jsx"}],["path",{d:"m22 22-5-10-5 10",key:"don7ne"}],["path",{d:"M14 18h6",key:"1m8k6r"}]]);/**
18
- * @license lucide-react v0.460.0 - ISC
19
- *
20
- * This source code is licensed under the ISC license.
21
- * See the LICENSE file in the root directory of this source tree.
22
- */const Bt=oe("LayoutPanelLeft",[["rect",{width:"7",height:"18",x:"3",y:"3",rx:"1",key:"2obqm"}],["rect",{width:"7",height:"7",x:"14",y:"3",rx:"1",key:"6d4xhi"}],["rect",{width:"7",height:"7",x:"14",y:"14",rx:"1",key:"nxv5o0"}]]);/**
23
- * @license lucide-react v0.460.0 - ISC
24
- *
25
- * This source code is licensed under the ISC license.
26
- * See the LICENSE file in the root directory of this source tree.
27
- */const Vt=oe("MessageSquareText",[["path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z",key:"1lielz"}],["path",{d:"M13 8H7",key:"14i4kc"}],["path",{d:"M17 12H7",key:"16if0g"}]]);/**
28
- * @license lucide-react v0.460.0 - ISC
29
- *
30
- * This source code is licensed under the ISC license.
31
- * See the LICENSE file in the root directory of this source tree.
32
- */const qt=oe("Volume2",[["path",{d:"M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z",key:"uqj9uw"}],["path",{d:"M16 9a5 5 0 0 1 0 6",key:"1q6k2b"}],["path",{d:"M19.364 18.364a9 9 0 0 0 0-12.728",key:"ijwkga"}]]);function is(){const s=document.cookie.match(/XSRF-TOKEN=([^;]+)/);return s?decodeURIComponent(s[1]):null}async function Wt(s,t=1,a=20){const n=new URLSearchParams({query:s,page:String(t),per_page:String(a)}),l=await fetch(`/api/unsplash/search?${n}`,{credentials:"same-origin"});if(!l.ok){const d=await l.json().catch(()=>({}));throw new Error(d.error||`Unsplash search failed: ${l.status}`)}return l.json()}async function Gt(s){const t={"Content-Type":s.type,"X-Filename":encodeURIComponent(s.name)},a=is();a&&(t["X-CSRF-Token"]=a);const n=await fetch("/api/background/upload",{method:"POST",headers:t,credentials:"same-origin",body:s});if(!n.ok){const l=await n.json().catch(()=>({}));throw new Error(l.error||`Upload failed: ${n.status}`)}return n.json()}async function Kt(s){const t={"Content-Type":"application/json"},a=is();a&&(t["X-CSRF-Token"]=a),await fetch("/api/unsplash/download",{method:"POST",headers:t,credentials:"same-origin",body:JSON.stringify({downloadLocation:s})})}function Jt(s,t=1,a=20){const[n,l]=o.useState(s);return o.useEffect(()=>{const d=setTimeout(()=>{l(s)},500);return()=>clearTimeout(d)},[s]),Es({queryKey:["unsplash-search",n,t,a],queryFn:()=>Wt(n,t,a),enabled:n.trim().length>0,staleTime:300*1e3,retry:1})}const Xt=[{value:"gradient-only",labelId:"theme.background.mode.gradientOnly"},{value:"image-only",labelId:"theme.background.mode.imageOnly"},{value:"image-gradient",labelId:"theme.background.mode.imageGradient"}];function Yt(){const{formatMessage:s}=V(),{backgroundConfig:t,setBackgroundMode:a,setBackgroundImage:n,updateBackgroundEffect:l}=Re(),[d,x]=o.useState(""),[p,w]=o.useState(1),[f,S]=o.useState(""),[y,E]=o.useState(!1),[c,b]=o.useState(null),v=o.useRef(null),{data:h,isLoading:O,isError:T,error:M}=Jt(d,p),R=t.mode!=="gradient-only",W=o.useCallback(async r=>{n(r.regularUrl,{photographerName:r.photographer,photographerUrl:r.photographerUrl,photoUrl:r.photoUrl}),Kt(r.downloadLocation).catch(()=>{})},[n]),D=o.useCallback(()=>{f.trim()&&(n(f.trim(),null),S(""))},[f,n]),j=o.useCallback(()=>{n(null,null)},[n]),k=o.useCallback(async r=>{var u;const g=(u=r.target.files)==null?void 0:u[0];if(g){if(r.target.value="",b(null),g.size>10*1024*1024){b(s({id:"theme.background.fileTooLarge"}));return}if(!g.type.startsWith("image/")||!["image/jpeg","image/png","image/webp","image/gif"].includes(g.type)){b(s({id:"theme.background.invalidType"}));return}E(!0);try{const L=await Gt(g);n(L.url,null)}catch(L){b(L.message||s({id:"theme.background.uploadError"}))}finally{E(!1)}}},[s,n]);return e.jsxs("div",{className:"space-y-4",children:[e.jsx("h3",{className:"text-sm font-medium text-text",children:s({id:"theme.background.title"})}),e.jsx("div",{className:"flex gap-2",role:"radiogroup","aria-label":s({id:"theme.background.title"}),children:Xt.map(({value:r,labelId:g})=>e.jsx("button",{onClick:()=>a(r),role:"radio","aria-checked":t.mode===r,className:`
33
- flex-1 px-3 py-2 rounded-lg text-xs font-medium
34
- transition-all duration-200 border-2
35
- ${t.mode===r?"border-accent bg-surface shadow-md":"border-border bg-bg hover:bg-surface"}
36
- focus:outline-none focus:ring-2 focus:ring-accent focus:ring-offset-2
37
- `,children:s({id:g})},r))}),R&&e.jsxs("div",{className:"space-y-3",children:[t.imageUrl&&e.jsxs("div",{className:"relative rounded-lg overflow-hidden border border-border",children:[e.jsx("img",{src:t.imageUrl,alt:"Current background",className:"w-full h-32 object-cover"}),e.jsx("button",{onClick:j,className:"absolute top-2 right-2 px-2 py-1 text-xs bg-black/60 text-white rounded hover:bg-black/80 transition-colors",children:s({id:"theme.background.removeImage"})}),t.attribution&&e.jsxs("div",{className:"absolute bottom-0 left-0 right-0 px-2 py-1 bg-black/50 text-white text-xs",children:["Photo by"," ",e.jsx("a",{href:`${t.attribution.photographerUrl}?utm_source=ccw&utm_medium=referral`,target:"_blank",rel:"noopener noreferrer",className:"underline",children:t.attribution.photographerName})," ","on"," ",e.jsx("a",{href:"https://unsplash.com/?utm_source=ccw&utm_medium=referral",target:"_blank",rel:"noopener noreferrer",className:"underline",children:"Unsplash"})]})]}),e.jsx("input",{type:"text",value:d,onChange:r=>{x(r.target.value),w(1)},placeholder:s({id:"theme.background.searchPlaceholder"}),className:`w-full px-3 py-2 text-sm rounded-lg border border-border bg-bg text-text
38
- focus:outline-none focus:ring-2 focus:ring-accent focus:ring-offset-1`}),O&&e.jsx("div",{className:"flex justify-center py-4",children:e.jsx("div",{className:"w-5 h-5 border-2 border-border border-t-accent rounded-full animate-spin"})}),T&&e.jsx("p",{className:"text-xs text-destructive py-2",children:(M==null?void 0:M.message)||s({id:"theme.background.searchError"})}),h&&h.photos.length>0&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"grid grid-cols-3 gap-2 max-h-60 overflow-y-auto",children:h.photos.map(r=>e.jsx("button",{onClick:()=>W(r),className:`
39
- relative rounded overflow-hidden border-2 transition-all
40
- hover:border-accent focus:outline-none focus:ring-2 focus:ring-accent
41
- ${t.imageUrl===r.regularUrl?"border-accent ring-2 ring-accent":"border-transparent"}
42
- `,children:e.jsx("img",{src:r.thumbUrl,alt:`Photo by ${r.photographer}`,className:"w-full h-20 object-cover",loading:"lazy"})},r.id))}),h.totalPages>1&&e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("button",{onClick:()=>w(r=>Math.max(1,r-1)),disabled:p<=1,className:"px-2 py-1 text-xs rounded border border-border disabled:opacity-50 hover:bg-surface",children:s({id:"theme.background.prev"})}),e.jsxs("span",{className:"text-xs text-text-secondary",children:[p," / ",h.totalPages]}),e.jsx("button",{onClick:()=>w(r=>Math.min(h.totalPages,r+1)),disabled:p>=h.totalPages,className:"px-2 py-1 text-xs rounded border border-border disabled:opacity-50 hover:bg-surface",children:s({id:"theme.background.next"})})]})]}),h&&h.photos.length===0&&d.trim()&&e.jsx("p",{className:"text-xs text-text-secondary py-2 text-center",children:s({id:"theme.background.noResults"})}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("input",{type:"url",value:f,onChange:r=>S(r.target.value),placeholder:s({id:"theme.background.customUrlPlaceholder"}),className:`flex-1 px-3 py-2 text-xs rounded-lg border border-border bg-bg text-text
43
- focus:outline-none focus:ring-2 focus:ring-accent focus:ring-offset-1`}),e.jsx("button",{onClick:D,disabled:!f.trim(),className:"px-3 py-2 text-xs rounded-lg bg-accent text-white disabled:opacity-50 hover:opacity-90 transition-opacity",children:s({id:"theme.background.apply"})})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("input",{ref:v,type:"file",accept:"image/jpeg,image/png,image/webp,image/gif",onChange:k,className:"hidden"}),e.jsx("button",{onClick:()=>{var r;return(r=v.current)==null?void 0:r.click()},disabled:y,className:`w-full px-3 py-2 text-xs rounded-lg border border-dashed border-border
44
- bg-bg text-text hover:bg-surface hover:border-accent
45
- disabled:opacity-50 transition-all flex items-center justify-center gap-2`,children:y?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"}),s({id:"theme.background.uploading"})]}):s({id:"theme.background.upload"})}),c&&e.jsx("p",{className:"text-xs text-destructive",children:c})]})]}),R&&e.jsxs("div",{className:"space-y-3 pt-2 border-t border-border",children:[e.jsx("h4",{className:"text-xs font-medium text-text-secondary",children:s({id:"theme.background.effects"})}),e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"flex justify-between",children:[e.jsx("label",{className:"text-xs text-text",children:s({id:"theme.background.blur"})}),e.jsxs("span",{className:"text-xs text-text-secondary",children:[t.effects.blur,"px"]})]}),e.jsx("input",{type:"range",min:"0",max:"20",step:"1",value:t.effects.blur,onChange:r=>l("blur",Number(r.target.value)),className:"w-full accent-[hsl(var(--accent))]"})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"flex justify-between",children:[e.jsx("label",{className:"text-xs text-text",children:s({id:"theme.background.darken"})}),e.jsxs("span",{className:"text-xs text-text-secondary",children:[t.effects.darkenOpacity,"%"]})]}),e.jsx("input",{type:"range",min:"0",max:"80",step:"1",value:t.effects.darkenOpacity,onChange:r=>l("darkenOpacity",Number(r.target.value)),className:"w-full accent-[hsl(var(--accent))]"})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"flex justify-between",children:[e.jsx("label",{className:"text-xs text-text",children:s({id:"theme.background.saturation"})}),e.jsxs("span",{className:"text-xs text-text-secondary",children:[t.effects.saturation,"%"]})]}),e.jsx("input",{type:"range",min:"0",max:"200",step:"5",value:t.effects.saturation,onChange:r=>l("saturation",Number(r.target.value)),className:"w-full accent-[hsl(var(--accent))]"})]}),e.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[e.jsx("input",{type:"checkbox",checked:t.effects.enableFrostedGlass,onChange:r=>l("enableFrostedGlass",r.target.checked),className:"w-4 h-4 rounded border-border text-accent focus:ring-2 focus:ring-accent focus:ring-offset-2"}),e.jsx("span",{className:"text-sm text-text",children:s({id:"theme.background.frostedGlass"})})]}),e.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[e.jsx("input",{type:"checkbox",checked:t.effects.enableGrain,onChange:r=>l("enableGrain",r.target.checked),className:"w-4 h-4 rounded border-border text-accent focus:ring-2 focus:ring-accent focus:ring-offset-2"}),e.jsx("span",{className:"text-sm text-text",children:s({id:"theme.background.grain"})})]}),e.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[e.jsx("input",{type:"checkbox",checked:t.effects.enableVignette,onChange:r=>l("enableVignette",r.target.checked),className:"w-4 h-4 rounded border-border text-accent focus:ring-2 focus:ring-accent focus:ring-offset-2"}),e.jsx("span",{className:"text-sm text-text",children:s({id:"theme.background.vignette"})})]})]})]})}function Qt(){const{formatMessage:s}=V(),{colorScheme:t,resolvedTheme:a,customHue:n,isCustomTheme:l,gradientLevel:d,enableHoverGlow:x,enableBackgroundAnimation:p,motionPreference:w,setColorScheme:f,setTheme:S,setCustomHue:y,setGradientLevel:E,setEnableHoverGlow:c,setEnableBackgroundAnimation:b,setMotionPreference:v,styleTier:h,setStyleTier:O,themeSlots:T,activeSlotId:M,canAddSlot:R,setActiveSlot:W,copySlot:D,renameSlot:j,deleteSlot:k,undoDeleteSlot:r,exportThemeCode:g,importThemeCode:u,setBackgroundConfig:L}=Re(),{addToast:B,removeToast:X}=Fs(),[q,re]=o.useState(n),[me,be]=o.useState([]),[je,ue]=o.useState({}),[Fe,xe]=o.useState(!1),[ee,m]=o.useState(null),[I,_]=o.useState(""),[H,G]=o.useState(null),Q=o.useRef(null),ie=o.useRef(null),[Pe,_e]=o.useState(!1),[os,Le]=o.useState(""),[F,Ne]=o.useState(null),[cs,ve]=o.useState(null),[ye,we]=o.useState(null),[ds,Be]=o.useState(!1);o.useEffect(()=>{re(n)},[n]);const se=a,he=i=>{const C=Ce(q??180,se)[i];return C?`hsl(${C})`:"#888"},ms=[{id:"soft",nameKey:"theme.styleTier.soft",descKey:"theme.styleTier.softDesc"},{id:"standard",nameKey:"theme.styleTier.standard",descKey:"theme.styleTier.standardDesc"},{id:"high-contrast",nameKey:"theme.styleTier.highContrast",descKey:"theme.styleTier.highContrastDesc"}],us=i=>{const $=Ce(n??220,se),C=i==="standard"?$:Ge($,i,se);return{bg:C["--bg"]?`hsl(${C["--bg"]})`:"#888",surface:C["--surface"]?`hsl(${C["--surface"]})`:"#888",accent:C["--accent"]?`hsl(${C["--accent"]})`:"#888"}},Ue=i=>{l&&y(null),f(i)},xs=()=>{n===null&&y(180)},hs=()=>{if(q!==null){y(q);const U=Ce(q,a),C=Is(U).filter(le=>!le.passed);if(C.length>0){be(C);const le={};for(const ge of C){const Ms=`${ge.fgVar}|${ge.bgVar}`;le[Ms]=Os(ge.fgVar,ge.bgVar,U,ge.required)}ue(le),xe(!0)}else be([]),ue({}),xe(!1)}},gs=()=>{y(null),re(null)},fs=i=>{S(i)},ps=i=>{if(i.key==="ArrowRight"||i.key==="ArrowDown"){i.preventDefault();const $=(ae.findIndex(C=>C.id===t)+1)%ae.length;Ue(ae[$].id)}else if(i.key==="ArrowLeft"||i.key==="ArrowUp"){i.preventDefault();const $=(ae.findIndex(C=>C.id===t)-1+ae.length)%ae.length;Ue(ae[$].id)}},bs=o.useCallback(i=>{i!==M&&W(i)},[M,W]),js=o.useCallback(()=>{R&&D()},[R,D]),Ve=o.useCallback((i,U)=>{m(i),_(U),setTimeout(()=>{var $;return($=Q.current)==null?void 0:$.focus()},0)},[]),De=o.useCallback(()=>{ee&&I.trim()&&j(ee,I.trim()),m(null),_("")},[ee,I,j]),qe=o.useCallback(()=>{m(null),_("")},[]),Ns=o.useCallback(i=>{i.key==="Enter"?(i.preventDefault(),De()):i.key==="Escape"&&(i.preventDefault(),qe())},[De,qe]),vs=o.useCallback(()=>{if(!H)return;k(H),G(null),ie.current&&X(ie.current);const i=B("info",s({id:"theme.slot.undoDelete"}),void 0,{duration:1e4,dismissible:!0,action:{label:s({id:"theme.slot.undo"}),onClick:()=>{r(),X(i),ie.current=null}}});ie.current=i},[H,k,B,X,r,s]),We=o.useCallback(()=>{G(null)},[]),ys=o.useCallback(async()=>{try{const i=g();await navigator.clipboard.writeText(i),Be(!0),setTimeout(()=>Be(!1),2e3)}catch{B("error","Failed to copy to clipboard")}},[g,B]),ws=o.useCallback(()=>{_e(!0),Le(""),Ne(null),ve(null),we(null)},[]),ke=o.useCallback(()=>{_e(!1),Le(""),Ne(null),ve(null),we(null)},[]),ks=o.useCallback(i=>{if(Le(i),we(null),ve(null),Ne(null),!i.trim())return;const U=u(i);U.ok?(Ne(U.payload),U.warning&&ve(U.warning)):we(U.error)},[u]),Cs=o.useCallback(()=>{F&&(!R&&M==="default"?(F.customHue!==null?y(F.customHue):(y(null),f(F.colorScheme)),E(F.gradientLevel),c(F.enableHoverGlow),b(F.enableBackgroundAnimation),O(F.styleTier)):R?(D(),F.customHue!==null?y(F.customHue):(y(null),f(F.colorScheme)),E(F.gradientLevel),c(F.enableHoverGlow),b(F.enableBackgroundAnimation),O(F.styleTier)):(F.customHue!==null?y(F.customHue):(y(null),f(F.colorScheme)),E(F.gradientLevel),c(F.enableHoverGlow),b(F.enableBackgroundAnimation),O(F.styleTier)),L(F.backgroundConfig??Ps),B("success",s({id:"theme.share.importSuccess"})),ke())},[F,R,M,D,y,f,E,c,b,O,L,B,s,ke]),Ss=o.useCallback(i=>{const U=i.customHue??220,$=Ce(U,se),C=i.styleTier==="standard"?$:Ge($,i.styleTier,se);return{bg:C["--bg"]?`hsl(${C["--bg"]})`:"#888",surface:C["--surface"]?`hsl(${C["--surface"]})`:"#888",accent:C["--accent"]?`hsl(${C["--accent"]})`:"#888",text:C["--text"]?`hsl(${C["--text"]})`:"#888"}},[se]),Ts=i=>{switch(i){case"incompatible_version":return"theme.share.incompatibleVersion";default:return"theme.share.invalidCode"}};return o.useEffect(()=>{ee&&Q.current&&(Q.current.focus(),Q.current.select())},[ee]),e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between mb-3",children:[e.jsx("h3",{className:"text-sm font-medium text-text",children:s({id:"theme.slot.title"})}),e.jsxs("button",{onClick:js,disabled:!R,title:R?s({id:"theme.slot.copy"}):s({id:"theme.slot.limitReached"},{limit:Ls}),className:`
46
- px-2 py-1 rounded text-xs font-medium
47
- transition-all duration-200
48
- ${R?"bg-accent text-white hover:bg-accent-hover focus:ring-2 focus:ring-accent focus:ring-offset-1":"bg-muted text-muted-text cursor-not-allowed"}
49
- focus:outline-none
50
- `,children:["+ ",s({id:"theme.slot.copy"})]})]}),e.jsx("div",{className:"flex gap-2",role:"tablist","aria-label":s({id:"theme.slot.title"}),children:T.map(i=>{const U=i.id===M,$=i.id===ee;return e.jsxs("div",{role:"tab","aria-selected":U,tabIndex:U?0:-1,onClick:()=>bs(i.id),className:`
51
- relative flex-1 min-w-0 p-2.5 rounded-lg cursor-pointer
52
- transition-all duration-200 border-2 group
53
- ${U?"border-accent bg-surface shadow-md":"border-border bg-bg hover:bg-surface"}
54
- focus:outline-none focus:ring-2 focus:ring-accent focus:ring-offset-1
55
- `,children:[U&&e.jsx("span",{className:"absolute -top-1 -right-1 w-2.5 h-2.5 rounded-full bg-accent border-2 border-bg"}),e.jsx("div",{className:"flex items-center gap-1 min-w-0",children:$?e.jsx("input",{ref:Q,type:"text",value:I,onChange:C=>_(C.target.value),onKeyDown:Ns,onBlur:De,onClick:C=>C.stopPropagation(),className:`\r
56
- w-full px-1 py-0.5 text-xs font-medium text-text\r
57
- bg-bg border border-accent rounded\r
58
- focus:outline-none focus:ring-1 focus:ring-accent\r
59
- `,maxLength:20}):e.jsx("span",{className:"text-xs font-medium text-text truncate",title:i.name,onDoubleClick:C=>{C.stopPropagation(),i.isDefault||Ve(i.id,i.name)},children:i.name})}),U&&!$&&e.jsx("span",{className:"text-[10px] text-accent font-medium mt-0.5 block",children:s({id:"theme.slot.active"})}),!i.isDefault&&!$&&e.jsxs("div",{className:`\r
60
- absolute top-1 right-1 flex gap-0.5\r
61
- opacity-0 group-hover:opacity-100 transition-opacity duration-150\r
62
- `,children:[e.jsx("button",{onClick:C=>{C.stopPropagation(),Ve(i.id,i.name)},title:s({id:"theme.slot.rename"}),className:`\r
63
- p-0.5 rounded text-text-tertiary hover:text-text hover:bg-surface-hover\r
64
- transition-colors duration-150 focus:outline-none\r
65
- `,children:e.jsx("svg",{width:"12",height:"12",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:e.jsx("path",{d:"M11.5 1.5L14.5 4.5L5 14H2V11L11.5 1.5Z",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}),e.jsx("button",{onClick:C=>{C.stopPropagation(),G(i.id)},title:s({id:"theme.slot.delete"}),className:`\r
66
- p-0.5 rounded text-text-tertiary hover:text-error hover:bg-error-light\r
67
- transition-colors duration-150 focus:outline-none\r
68
- `,children:e.jsx("svg",{width:"12",height:"12",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:e.jsx("path",{d:"M4 4L12 12M12 4L4 12",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})})})]}),i.isDefault&&e.jsx("div",{className:`\r
69
- absolute top-1 right-1 flex gap-0.5\r
70
- opacity-0 group-hover:opacity-100 transition-opacity duration-150\r
71
- `,children:e.jsx("button",{disabled:!0,title:s({id:"theme.slot.cannotDeleteDefault"}),className:"p-0.5 rounded text-muted-text cursor-not-allowed",children:e.jsx("svg",{width:"12",height:"12",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:e.jsx("path",{d:"M4 4L12 12M12 4L4 12",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})})})})]},i.id)})})]}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-sm font-medium text-text mb-3",children:s({id:"theme.title.colorScheme"})}),e.jsxs("div",{className:"grid grid-cols-5 gap-3",role:"group","aria-label":"Color scheme selection",onKeyDown:ps,children:[ae.map(i=>e.jsxs("button",{onClick:()=>Ue(i.id),"aria-label":s({id:"theme.select.colorScheme"},{name:s({id:`theme.colorScheme.${i.id}`})}),"aria-selected":t===i.id&&!l,role:"radio",className:`
72
- flex flex-col items-center gap-2 p-3 rounded-lg
73
- transition-all duration-200 border-2
74
- ${t===i.id&&!l?"border-accent bg-surface shadow-md":"border-border bg-bg hover:bg-surface"}
75
- focus:outline-none focus:ring-2 focus:ring-accent focus:ring-offset-2
76
- `,children:[e.jsx("div",{className:"w-8 h-8 rounded-full border-2 border-border shadow-sm",style:{backgroundColor:i.accentColor},"aria-hidden":"true"}),e.jsx("span",{className:"text-xs font-medium text-text text-center",children:s({id:`theme.colorScheme.${i.id}`})})]},i.id)),e.jsxs("button",{onClick:xs,"aria-label":s({id:"theme.select.colorScheme"},{name:s({id:"theme.colorScheme.custom"})}),"aria-selected":l,role:"radio",className:`
77
- flex flex-col items-center gap-2 p-3 rounded-lg
78
- transition-all duration-200 border-2
79
- ${l?"border-accent bg-surface shadow-md":"border-border bg-bg hover:bg-surface"}
80
- focus:outline-none focus:ring-2 focus:ring-accent focus:ring-offset-2
81
- `,children:[e.jsx("div",{className:"w-8 h-8 rounded-full border-2 border-border shadow-sm",style:{background:`linear-gradient(135deg, ${he("--accent")}, ${he("--primary")})`},"aria-hidden":"true"}),e.jsx("span",{className:"text-xs font-medium text-text text-center",children:s({id:"theme.colorScheme.custom"})})]})]})]}),l&&e.jsxs("div",{className:"space-y-4",children:[e.jsx("h3",{className:"text-sm font-medium text-text mb-3",children:s({id:"theme.title.customHue"})}),e.jsxs("div",{className:"space-y-3",children:[e.jsx("div",{className:"flex items-center justify-between",children:e.jsx("label",{htmlFor:"hue-slider",className:"text-xs text-text-secondary",children:s({id:"theme.hueValue"},{value:q??180})})}),e.jsx("input",{id:"hue-slider",type:"range",min:"0",max:"360",step:"1",value:q??180,onChange:i=>re(Number(i.target.value)),className:"w-full h-2 rounded-lg appearance-none cursor-pointer",style:{background:`linear-gradient(to right,
82
- hsl(0, 70%, 60%), hsl(60, 70%, 60%), hsl(120, 70%, 60%),
83
- hsl(180, 70%, 60%), hsl(240, 70%, 60%), hsl(300, 70%, 60%), hsl(360, 70%, 60%))`},"aria-label":s({id:"theme.title.customHue"})}),e.jsxs("div",{className:"flex gap-3 items-end",children:[e.jsxs("span",{className:"text-xs text-text-secondary pb-1",children:[s({id:"theme.preview"}),":"]}),e.jsxs("div",{className:"flex flex-col items-center gap-1",children:[e.jsx("div",{className:"w-10 h-10 rounded border-2 border-border shadow-sm",style:{backgroundColor:he("--bg")}}),e.jsx("span",{className:"text-[10px] text-text-tertiary",children:s({id:"theme.preview.background"})})]}),e.jsxs("div",{className:"flex flex-col items-center gap-1",children:[e.jsx("div",{className:"w-10 h-10 rounded border-2 border-border shadow-sm",style:{backgroundColor:he("--surface")}}),e.jsx("span",{className:"text-[10px] text-text-tertiary",children:s({id:"theme.preview.surface"})})]}),e.jsxs("div",{className:"flex flex-col items-center gap-1",children:[e.jsx("div",{className:"w-10 h-10 rounded border-2 border-border shadow-sm",style:{backgroundColor:he("--accent")}}),e.jsx("span",{className:"text-[10px] text-text-tertiary",children:s({id:"theme.preview.accent"})})]})]}),e.jsxs("div",{className:"flex gap-2 pt-2",children:[e.jsx("button",{onClick:hs,disabled:q===n,className:`
84
- flex-1 px-4 py-2 rounded-lg text-sm font-medium
85
- transition-all duration-200
86
- ${q===n?"bg-muted text-muted-text cursor-not-allowed":"bg-accent text-white hover:bg-accent-hover focus:ring-2 focus:ring-accent focus:ring-offset-2"}
87
- `,children:s({id:"theme.save"})}),e.jsx("button",{onClick:gs,className:`\r
88
- px-4 py-2 rounded-lg text-sm font-medium\r
89
- border-2 border-border bg-bg text-text\r
90
- hover:bg-surface transition-all duration-200\r
91
- focus:outline-none focus:ring-2 focus:ring-accent focus:ring-offset-2\r
92
- `,children:s({id:"theme.reset"})})]})]})]}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-sm font-medium text-text mb-3",children:s({id:"theme.styleTier.label"})}),e.jsx("div",{className:"grid grid-cols-3 gap-3",role:"radiogroup","aria-label":s({id:"theme.styleTier.label"}),children:ms.map(i=>{const U=us(i.id),$=h===i.id;return e.jsxs("button",{onClick:()=>O(i.id),role:"radio","aria-checked":$,className:`
93
- flex flex-col items-center gap-2 p-3 rounded-lg
94
- transition-all duration-200 border-2
95
- ${$?"border-accent bg-surface shadow-md":"border-border bg-bg hover:bg-surface"}
96
- focus:outline-none focus:ring-2 focus:ring-accent focus:ring-offset-2
97
- `,children:[e.jsxs("div",{className:"flex gap-1","aria-hidden":"true",children:[e.jsx("div",{className:"w-5 h-5 rounded-sm border border-border",style:{backgroundColor:U.bg}}),e.jsx("div",{className:"w-5 h-5 rounded-sm border border-border",style:{backgroundColor:U.surface}}),e.jsx("div",{className:"w-5 h-5 rounded-sm border border-border",style:{backgroundColor:U.accent}})]}),e.jsx("span",{className:"text-xs font-medium text-text text-center",children:s({id:i.nameKey})}),e.jsx("span",{className:"text-[10px] text-text-tertiary text-center leading-tight",children:s({id:i.descKey})})]},i.id)})})]}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-sm font-medium text-text mb-3",children:s({id:"theme.gradient.title"})}),e.jsxs("div",{className:"space-y-4",children:[e.jsx("div",{className:"flex gap-2",role:"radiogroup","aria-label":s({id:"theme.gradient.title"}),children:["off","standard","enhanced"].map(i=>e.jsx("button",{onClick:()=>E(i),role:"radio","aria-checked":d===i,className:`
98
- flex-1 px-3 py-2 rounded-lg text-sm font-medium
99
- transition-all duration-200 border-2
100
- ${d===i?"border-accent bg-surface shadow-md":"border-border bg-bg hover:bg-surface"}
101
- focus:outline-none focus:ring-2 focus:ring-accent focus:ring-offset-2
102
- `,children:s({id:`theme.gradient.${i}`})},i))}),e.jsxs("label",{className:"flex items-center gap-3 cursor-pointer",children:[e.jsx("input",{type:"checkbox",checked:x,onChange:i=>c(i.target.checked),className:`\r
103
- w-4 h-4 rounded border-border text-accent\r
104
- focus:ring-2 focus:ring-accent focus:ring-offset-2\r
105
- `}),e.jsx("span",{className:"text-sm text-text",children:s({id:"theme.gradient.hoverGlow"})})]}),e.jsxs("label",{className:"flex items-center gap-3 cursor-pointer",children:[e.jsx("input",{type:"checkbox",checked:p,onChange:i=>b(i.target.checked),className:`\r
106
- w-4 h-4 rounded border-border text-accent\r
107
- focus:ring-2 focus:ring-accent focus:ring-offset-2\r
108
- `}),e.jsx("span",{className:"text-sm text-text",children:s({id:"theme.gradient.bgAnimation"})})]})]})]}),e.jsx(Yt,{}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-sm font-medium text-text mb-3",children:s({id:"theme.motion.label"})}),e.jsx("div",{className:"flex gap-2",role:"radiogroup","aria-label":s({id:"theme.motion.label"}),children:["system","reduce","enable"].map(i=>e.jsx("button",{onClick:()=>v(i),role:"radio","aria-checked":w===i,className:`
109
- flex-1 px-3 py-2 rounded-lg text-sm font-medium
110
- transition-all duration-200 border-2
111
- ${w===i?"border-accent bg-surface shadow-md":"border-border bg-bg hover:bg-surface"}
112
- focus:outline-none focus:ring-2 focus:ring-accent focus:ring-offset-2
113
- `,children:s({id:`theme.motion.${i}`})},i))})]}),Fe&&me.length>0&&e.jsxs("div",{className:"p-3 rounded-lg bg-warning-light border border-warning text-warning-text space-y-2",children:[e.jsx("p",{className:"text-xs font-medium",children:s({id:"theme.accessibility.contrastWarning"})}),e.jsx("ul",{className:"text-xs space-y-1",children:me.map(i=>{const U=`${i.fgVar}|${i.bgVar}`,$=je[U]||[];return e.jsxs("li",{className:"space-y-1",children:[e.jsxs("span",{children:[i.fgVar," / ",i.bgVar,": ",i.ratio,":1 (min ",i.required,":1)"]}),$.length>0&&e.jsx("div",{className:"ml-2 text-[10px]",children:$.slice(0,1).map((C,le)=>e.jsx("span",{className:"block",children:s({id:"theme.accessibility.fixSuggestion"},{target:C.target==="fg"?i.fgVar:i.bgVar,original:C.original,suggested:C.suggested,ratio:C.resultRatio})},le))})]},U)})}),e.jsx("button",{onClick:()=>xe(!1),className:"text-xs font-medium underline",children:s({id:"theme.accessibility.dismiss"})})]}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-sm font-medium text-text mb-3",children:s({id:"theme.title.themeMode"})}),e.jsx("div",{className:"grid grid-cols-2 gap-3",role:"group","aria-label":"Theme mode selection",children:Us.map(i=>e.jsxs("button",{onClick:()=>fs(i.id),"aria-label":s({id:"theme.select.themeMode"},{name:s({id:`theme.themeMode.${i.id}`})}),"aria-selected":se===i.id,role:"radio",className:`
114
- flex items-center justify-center gap-2 p-3 rounded-lg
115
- transition-all duration-200 border-2
116
- ${se===i.id?"border-accent bg-surface shadow-md":"border-border bg-bg hover:bg-surface"}
117
- focus:outline-none focus:ring-2 focus:ring-accent focus:ring-offset-2
118
- `,children:[e.jsx("span",{className:"text-lg","aria-hidden":"true",children:i.id==="light"?"☀️":"🌙"}),e.jsx("span",{className:"text-sm font-medium text-text",children:s({id:`theme.themeMode.${i.id}`})})]},i.id))})]}),e.jsx("div",{className:"p-3 rounded-lg bg-surface border border-border",children:e.jsx("p",{className:"text-xs text-text-secondary",children:s({id:"theme.current"},{name:Ds(t,se)})})}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-sm font-medium text-text mb-3",children:s({id:"theme.share.label"})}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("button",{onClick:ys,className:`\r
119
- flex-1 px-3 py-2 rounded-lg text-sm font-medium\r
120
- border-2 border-border bg-bg text-text\r
121
- hover:bg-surface transition-all duration-200\r
122
- focus:outline-none focus:ring-2 focus:ring-accent focus:ring-offset-2\r
123
- `,children:s(ds?{id:"theme.share.copied"}:{id:"theme.share.copyCode"})}),e.jsx("button",{onClick:Pe?ke:ws,className:`
124
- flex-1 px-3 py-2 rounded-lg text-sm font-medium
125
- transition-all duration-200 border-2
126
- ${Pe?"border-accent bg-surface shadow-md":"border-border bg-bg text-text hover:bg-surface"}
127
- focus:outline-none focus:ring-2 focus:ring-accent focus:ring-offset-2
128
- `,children:s({id:"theme.share.import"})})]}),Pe&&e.jsxs("div",{className:"mt-3 space-y-3",children:[e.jsx("textarea",{value:os,onChange:i=>ks(i.target.value),placeholder:s({id:"theme.share.paste"}),rows:3,className:`\r
129
- w-full px-3 py-2 rounded-lg text-sm font-mono\r
130
- bg-bg border-2 border-border text-text\r
131
- placeholder-text-tertiary resize-none\r
132
- focus:outline-none focus:ring-2 focus:ring-accent focus:border-accent\r
133
- `}),ye&&e.jsx("div",{className:"p-2 rounded-lg bg-error-light border border-error text-error-text text-xs",children:s({id:Ts(ye)})}),cs&&!ye&&e.jsx("div",{className:"p-2 rounded-lg bg-warning-light border border-warning text-warning-text text-xs",children:s({id:"theme.share.versionWarning"})}),F&&!ye&&e.jsxs("div",{className:"p-3 rounded-lg bg-surface border border-border space-y-3",children:[e.jsx("p",{className:"text-xs font-medium text-text",children:s({id:"theme.share.preview"})}),e.jsx("div",{className:"flex gap-3 items-end",children:(()=>{const i=Ss(F);return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex flex-col items-center gap-1",children:[e.jsx("div",{className:"w-10 h-10 rounded border-2 border-border shadow-sm",style:{backgroundColor:i.bg}}),e.jsx("span",{className:"text-[10px] text-text-tertiary",children:s({id:"theme.preview.background"})})]}),e.jsxs("div",{className:"flex flex-col items-center gap-1",children:[e.jsx("div",{className:"w-10 h-10 rounded border-2 border-border shadow-sm",style:{backgroundColor:i.surface}}),e.jsx("span",{className:"text-[10px] text-text-tertiary",children:s({id:"theme.preview.surface"})})]}),e.jsxs("div",{className:"flex flex-col items-center gap-1",children:[e.jsx("div",{className:"w-10 h-10 rounded border-2 border-border shadow-sm",style:{backgroundColor:i.accent}}),e.jsx("span",{className:"text-[10px] text-text-tertiary",children:s({id:"theme.preview.accent"})})]})]})})()}),e.jsxs("div",{className:"text-xs text-text-secondary space-y-1",children:[e.jsxs("p",{children:[s({id:"theme.styleTier.label"}),": ",s({id:`theme.styleTier.${F.styleTier==="high-contrast"?"highContrast":F.styleTier}`})]}),e.jsxs("p",{children:[s({id:"theme.gradient.title"}),": ",s({id:`theme.gradient.${F.gradientLevel}`})]}),F.customHue!==null&&e.jsx("p",{children:s({id:"theme.hueValue"},{value:F.customHue})}),F.customHue===null&&e.jsxs("p",{children:[s({id:"theme.title.colorScheme"}),": ",s({id:`theme.colorScheme.${F.colorScheme}`})]})]}),e.jsxs("div",{className:"flex gap-2 pt-1",children:[e.jsx("button",{onClick:Cs,className:`\r
134
- flex-1 px-4 py-2 rounded-lg text-sm font-medium\r
135
- bg-accent text-white hover:bg-accent-hover\r
136
- transition-all duration-200\r
137
- focus:outline-none focus:ring-2 focus:ring-accent focus:ring-offset-2\r
138
- `,children:s({id:"theme.share.apply"})}),e.jsx("button",{onClick:ke,className:`\r
139
- px-4 py-2 rounded-lg text-sm font-medium\r
140
- border-2 border-border bg-bg text-text\r
141
- hover:bg-surface transition-all duration-200\r
142
- focus:outline-none focus:ring-2 focus:ring-accent focus:ring-offset-2\r
143
- `,children:s({id:"theme.share.cancel"})})]})]})]}),e.jsx(mt,{open:H!==null,onOpenChange:We,children:e.jsxs(ut,{children:[e.jsxs(xt,{children:[e.jsx(ht,{children:"Delete Theme Slot?"}),e.jsx(gt,{children:"This action cannot be undone. The theme slot will be permanently deleted."})]}),e.jsxs(ft,{children:[e.jsx(pt,{onClick:We,children:"Cancel"}),e.jsx(bt,{onClick:vs,children:"Delete"})]})]})})]})]})}const Zt=[{value:"en",label:"English",flag:"🇺🇸"},{value:"zh",label:"中文",flag:"🇨🇳"}];function ea({compact:s=!1,className:t}){const{locale:a,setLocale:n}=Lt();return e.jsxs(As,{value:a,onValueChange:n,children:[e.jsx(Rs,{className:z(s?"w-[110px]":"w-[160px]","gap-2",t),"aria-label":"Select language",children:s?e.jsxs(e.Fragment,{children:[e.jsx(rs,{className:"w-4 h-4"}),e.jsx(Ke,{})]}):e.jsx(Ke,{})}),e.jsx(Hs,{children:Zt.map(l=>e.jsx($s,{value:l.value,children:e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-base",children:l.flag}),e.jsx("span",{children:l.label})]})},l.value))})]})}const Oe={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"]}},sa={"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 Ye(){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 ta({config:s,expandedPlatform:t,testing:a,onToggleExpand:n,onUpdateConfig:l,onTest:d,onSave:x,saving:p}){const{formatMessage:w}=V(),f=["discord","telegram","feishu","dingtalk","wecom","email","webhook"],S=c=>{switch(c){case"discord":return e.jsx(Bs,{className:"w-4 h-4"});case"telegram":return e.jsx(It,{className:"w-4 h-4"});case"feishu":return e.jsx(ss,{className:"w-4 h-4"});case"dingtalk":return e.jsx($e,{className:"w-4 h-4"});case"wecom":return e.jsx(_s,{className:"w-4 h-4"});case"email":return e.jsx(zs,{className:"w-4 h-4"});case"webhook":return e.jsx(Dt,{className:"w-4 h-4"})}},y=c=>{switch(c){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"}}},E=c=>{var v;const b=y(c);switch(c){case"discord":return!!b.webhookUrl;case"telegram":return!!b.botToken&&!!b.chatId;case"feishu":return!!b.webhookUrl;case"dingtalk":return!!b.webhookUrl;case"wecom":return!!b.webhookUrl;case"email":const h=b;return!!(h.host&&h.username&&h.password&&h.from&&((v=h.to)==null?void 0:v.length)>0);case"webhook":return!!b.url}};return e.jsx("div",{className:"grid gap-3",children:f.map(c=>{const b=Oe[c],v=y(c),h=E(c),O=t===c;return e.jsxs(K,{className:"overflow-hidden",children:[e.jsx("div",{className:"p-4 cursor-pointer hover:bg-muted/50 transition-colors",onClick:()=>n(O?null:c),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:z("p-2 rounded-lg",v.enabled&&h?"bg-primary/10 text-primary":"bg-muted text-muted-foreground"),children:S(c)}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-sm font-medium",children:b.name}),h&&e.jsxs(J,{variant:"outline",className:"text-xs text-green-600 border-green-500/30",children:[e.jsx(Z,{className:"w-3 h-3 mr-1"}),w({id:"settings.remoteNotifications.configured"})]})]}),e.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:b.description})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(N,{variant:v.enabled?"default":"outline",size:"sm",className:"h-7",onClick:T=>{T.stopPropagation(),l(c,{enabled:!v.enabled})},children:v.enabled?e.jsx(Z,{className:"w-3.5 h-3.5"}):e.jsx(Y,{className:"w-3.5 h-3.5"})}),O?e.jsx(He,{className:"w-4 h-4 text-muted-foreground"}):e.jsx(Me,{className:"w-4 h-4 text-muted-foreground"})]})]})}),O&&e.jsxs("div",{className:"border-t border-border p-4 space-y-4 bg-muted/30",children:[c==="discord"&&e.jsx(aa,{config:v,onUpdate:T=>l("discord",T)}),c==="telegram"&&e.jsx(na,{config:v,onUpdate:T=>l("telegram",T)}),c==="feishu"&&e.jsx(ia,{config:v,onUpdate:T=>l("feishu",T)}),c==="dingtalk"&&e.jsx(la,{config:v,onUpdate:T=>l("dingtalk",T)}),c==="wecom"&&e.jsx(oa,{config:v,onUpdate:T=>l("wecom",T)}),c==="email"&&e.jsx(ca,{config:v,onUpdate:T=>l("email",T)}),c==="webhook"&&e.jsx(ra,{config:v,onUpdate:T=>l("webhook",T)}),e.jsxs("div",{className:"flex items-center gap-2 pt-2",children:[e.jsxs(N,{variant:"outline",size:"sm",onClick:()=>d(c,v),disabled:a===c||!h,children:[e.jsx(Ut,{className:z("w-3.5 h-3.5 mr-1",a===c&&"animate-pulse")}),w({id:"settings.remoteNotifications.testConnection"})]}),e.jsx(N,{variant:"default",size:"sm",onClick:x,disabled:p,children:w({id:"settings.remoteNotifications.save"})})]})]})]},c)})})}function aa({config:s,onUpdate:t}){const{formatMessage:a}=V(),[n,l]=o.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(P,{type:n?"text":"password",value:s.webhookUrl||"",onChange:d=>t({webhookUrl:d.target.value}),placeholder:"https://discord.com/api/webhooks/...",className:"flex-1"}),e.jsx(N,{variant:"outline",size:"sm",className:"shrink-0",onClick:()=>l(!n),children:n?e.jsx(ce,{className:"w-4 h-4"}):e.jsx(de,{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(P,{value:s.username||"",onChange:d=>t({username:d.target.value}),placeholder:"CCW Notification",className:"mt-1"})]})]})}function na({config:s,onUpdate:t}){const{formatMessage:a}=V(),[n,l]=o.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(P,{type:n?"text":"password",value:s.botToken||"",onChange:d=>t({botToken:d.target.value}),placeholder:"1234567890:ABCdefGHIjklMNOpqrsTUVwxyz",className:"flex-1"}),e.jsx(N,{variant:"outline",size:"sm",className:"shrink-0",onClick:()=>l(!n),children:n?e.jsx(ce,{className:"w-4 h-4"}):e.jsx(de,{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(P,{value:s.chatId||"",onChange:d=>t({chatId:d.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 ra({config:s,onUpdate:t}){const{formatMessage:a}=V();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(P,{value:s.url||"",onChange:n=>t({url:n.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(N,{variant:s.method==="POST"?"default":"outline",size:"sm",onClick:()=>t({method:"POST"}),children:"POST"}),e.jsx(N,{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(P,{value:s.headers?JSON.stringify(s.headers):"",onChange:n=>{try{const l=n.target.value?JSON.parse(n.target.value):void 0;t({headers:l})}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 ia({config:s,onUpdate:t}){const{formatMessage:a}=V(),[n,l]=o.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(P,{type:n?"text":"password",value:s.webhookUrl||"",onChange:d=>t({webhookUrl:d.target.value}),placeholder:"https://open.feishu.cn/open-apis/bot/v2/hook/...",className:"flex-1"}),e.jsx(N,{variant:"outline",size:"sm",className:"shrink-0",onClick:()=>l(!n),children:n?e.jsx(ce,{className:"w-4 h-4"}):e.jsx(de,{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:d=>t({useCard:d.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(P,{value:s.title||"",onChange:d=>t({title:d.target.value}),placeholder:"CCW Notification",className:"mt-1"})]})]})}function la({config:s,onUpdate:t}){var d;const{formatMessage:a}=V(),[n,l]=o.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(P,{type:n?"text":"password",value:s.webhookUrl||"",onChange:x=>t({webhookUrl:x.target.value}),placeholder:"https://oapi.dingtalk.com/robot/send?access_token=...",className:"flex-1"}),e.jsx(N,{variant:"outline",size:"sm",className:"shrink-0",onClick:()=>l(!n),children:n?e.jsx(ce,{className:"w-4 h-4"}):e.jsx(de,{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(P,{value:((d=s.keywords)==null?void 0:d.join(", "))||"",onChange:x=>t({keywords:x.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 oa({config:s,onUpdate:t}){var d;const{formatMessage:a}=V(),[n,l]=o.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(P,{type:n?"text":"password",value:s.webhookUrl||"",onChange:x=>t({webhookUrl:x.target.value}),placeholder:"https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=...",className:"flex-1"}),e.jsx(N,{variant:"outline",size:"sm",className:"shrink-0",onClick:()=>l(!n),children:n?e.jsx(ce,{className:"w-4 h-4"}):e.jsx(de,{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(P,{value:((d=s.mentionedList)==null?void 0:d.join(", "))||"",onChange:x=>t({mentionedList:x.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 ca({config:s,onUpdate:t}){var d;const{formatMessage:a}=V(),[n,l]=o.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(P,{value:s.host||"",onChange:x=>t({host:x.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(P,{type:"number",value:s.port||587,onChange:x=>t({port:parseInt(x.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:x=>t({secure:x.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(P,{value:s.username||"",onChange:x=>t({username:x.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(P,{type:n?"text":"password",value:s.password||"",onChange:x=>t({password:x.target.value}),placeholder:"********",className:"flex-1"}),e.jsx(N,{variant:"outline",size:"sm",className:"shrink-0",onClick:()=>l(!n),children:n?e.jsx(ce,{className:"w-4 h-4"}):e.jsx(de,{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(P,{value:s.from||"",onChange:x=>t({from:x.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(P,{value:((d=s.to)==null?void 0:d.join(", "))||"",onChange:x=>t({to:x.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 da({className:s}){const{formatMessage:t}=V(),[a,n]=o.useState(null),[l,d]=o.useState(!0),[x,p]=o.useState(!1),[w,f]=o.useState(null),[S,y]=o.useState(null),[E,c]=o.useState(null),b=o.useCallback(async()=>{d(!0);try{const j=await fetch("/api/notifications/remote/config");if(j.ok){const k=await j.json();n(k)}else n(Ye())}catch(j){console.error("Failed to load remote notification config:",j),n(Ye())}finally{d(!1)}},[]);o.useEffect(()=>{b()},[b]);const v=o.useCallback(async j=>{p(!0);try{const k=await fetch("/api/notifications/remote/config",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(j)});if(k.ok){const r=await k.json();n(r.config),A.success(t({id:"settings.remoteNotifications.saved"}))}else throw new Error(`HTTP ${k.status}`)}catch{A.error(t({id:"settings.remoteNotifications.saveError"}))}finally{p(!1)}},[t]),h=o.useCallback(async(j,k)=>{f(j);try{const g=await(await fetch("/api/notifications/remote/test",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({platform:j,config:k})})).json();g.success?A.success(t({id:"settings.remoteNotifications.testSuccess"}),{description:`${g.responseTime}ms`}):A.error(t({id:"settings.remoteNotifications.testFailed"}),{description:g.error})}catch{A.error(t({id:"settings.remoteNotifications.testError"}))}finally{f(null)}},[t]),O=()=>{a&&v({...a,enabled:!a.enabled})},T=(j,k)=>{if(!a)return;const r={...a,platforms:{...a.platforms,[j]:{...a.platforms[j],...k}}};n(r)},M=(j,k)=>{if(!a)return;const r=[...a.events];r[j]={...r[j],...k},n({...a,events:r})},R=(j,k)=>{if(!a)return;const r=a.events[j],g=r.platforms.includes(k)?r.platforms.filter(u=>u!==k):[...r.platforms,k];M(j,{platforms:g})},W=["discord","telegram","feishu","dingtalk","wecom","email","webhook"],D=async()=>{if(confirm(t({id:"settings.remoteNotifications.resetConfirm"})))try{const j=await fetch("/api/notifications/remote/reset",{method:"POST"});if(j.ok){const k=await j.json();n(k.config),A.success(t({id:"settings.remoteNotifications.resetSuccess"}))}}catch{A.error(t({id:"settings.remoteNotifications.resetError"}))}};return l?e.jsx(K,{className:z("p-6",s),children:e.jsx("div",{className:"flex items-center justify-center py-8",children:e.jsx(ne,{className:"w-5 h-5 animate-spin text-muted-foreground"})})}):a?e.jsxs(K,{className:z("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($e,{className:"w-5 h-5 text-primary"}):e.jsx(_t,{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(N,{variant:"outline",size:"sm",onClick:()=>b(),disabled:l,children:e.jsx(ne,{className:z("w-3.5 h-3.5",l&&"animate-spin")})}),e.jsx(N,{variant:a.enabled?"default":"outline",size:"sm",onClick:O,children:a.enabled?e.jsxs(e.Fragment,{children:[e.jsx(Z,{className:"w-4 h-4 mr-1"}),t({id:"settings.remoteNotifications.enabled"})]}):e.jsxs(e.Fragment,{children:[e.jsx(Y,{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(ta,{config:a,expandedPlatform:S,testing:w,onToggleExpand:y,onUpdateConfig:T,onTest:h,onSave:()=>v(a),saving:x})]}),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((j,k)=>{const r=sa[j.event],g=E===k;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:()=>c(g?null:k),children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:z("p-2 rounded-lg",j.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:[j.platforms.slice(0,3).map(u=>e.jsx(J,{variant:"secondary",className:"text-xs",children:Oe[u].name},u)),j.platforms.length>3&&e.jsxs(J,{variant:"secondary",className:"text-xs",children:["+",j.platforms.length-3]}),j.platforms.length===0&&e.jsx(J,{variant:"outline",className:"text-xs text-muted-foreground",children:t({id:"settings.remoteNotifications.noPlatforms"})})]}),e.jsx(N,{variant:j.enabled?"default":"outline",size:"sm",className:"h-7",onClick:u=>{u.stopPropagation(),M(k,{enabled:!j.enabled})},children:j.enabled?e.jsx(Z,{className:"w-3.5 h-3.5"}):e.jsx(Y,{className:"w-3.5 h-3.5"})}),g?e.jsx(He,{className:"w-4 h-4 text-muted-foreground"}):e.jsx(Me,{className:"w-4 h-4 text-muted-foreground"})]})]}),g&&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:W.map(u=>{const L=j.platforms.includes(u),B=Oe[u],X=a.platforms[u],q=X==null?void 0:X.enabled;return e.jsxs(N,{variant:L?"default":"outline",size:"sm",className:z("h-8",!q&&!L&&"opacity-50"),onClick:()=>R(k,u),children:[L&&e.jsx(Z,{className:"w-3 h-3 mr-1"}),B.name,!q&&!L&&e.jsx(pe,{className:"w-3 h-3 ml-1 opacity-50"})]},u)})})]})]},j.event)})})]}),e.jsxs("div",{className:"flex items-center justify-between mt-6 pt-4 border-t border-border",children:[e.jsx(N,{variant:"outline",size:"sm",onClick:D,children:t({id:"settings.remoteNotifications.reset"})}),e.jsxs(N,{variant:"default",size:"sm",onClick:()=>v(a),disabled:x,children:[e.jsx(Ee,{className:"w-4 h-4 mr-1"}),t(x?{id:"settings.remoteNotifications.saving"}:{id:"settings.remoteNotifications.save"})]})]})]})]}):null}function ma({value:s,label:t,description:a,selected:n,onClick:l}){const d={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:l,className:z("flex flex-col items-center gap-2 p-3 rounded-lg border-2 transition-all","hover:bg-accent/50",n?"border-primary bg-primary/10 text-primary":"border-border text-muted-foreground"),children:[d[s],e.jsxs("div",{className:"text-center",children:[e.jsx("div",{className:z("text-sm font-medium",n&&"text-primary"),children:t}),e.jsx("div",{className:"text-xs text-muted-foreground",children:a})]})]})}function ua({value:s,onChange:t,disabled:a}){const n=[10,20,30,45,60,90,120];return e.jsx("div",{className:"flex flex-wrap gap-2",children:n.map(l=>e.jsxs(N,{type:"button",variant:s===l?"default":"outline",size:"sm",disabled:a,onClick:()=>t(l),children:[l,"s"]},l))})}function xa(){const{formatMessage:s}=V(),{preferences:t,updatePreference:a,resetPreferences:n}=Vs(),l=[{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(K,{className:"p-6",children:[e.jsxs("h2",{className:"text-lg font-semibold text-foreground flex items-center gap-2 mb-4",children:[e.jsx(ss,{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(Je,{className:"text-sm font-medium flex items-center gap-2",children:[e.jsx(Bt,{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:l.map(d=>e.jsx(ma,{value:d.value,label:d.label,description:d.description,selected:t.dialogStyle===d.value,onClick:()=>a("dialogStyle",d.value)},d.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(qs,{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(N,{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(Ws,{className:"w-4 h-4 text-muted-foreground"}),e.jsx(Je,{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(ua,{value:t.autoSelectionDuration,onChange:d=>a("autoSelectionDuration",d)})]}),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(N,{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(qt,{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(N,{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(N,{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(N,{variant:"outline",size:"sm",onClick:n,children:s({id:"common.resetToDefaults",defaultMessage:"Reset to Defaults"})})})]})]})}const ha=["","low","medium","high"],ga=["","low","medium","high","max"],Te=["sonnet","opus","haiku","inherit"],fa=["","default","acceptEdits","dontAsk","bypassPermissions","plan"],pa=["","user","project","local"],ba=["","worktree"],ja=["","purple","blue","yellow","green","red"],Ae=["PreToolUse","PostToolUse","Stop"],fe="h-7 text-xs rounded border border-input bg-background px-2",te="text-xs text-muted-foreground shrink-0";function Qe(s){if(!s)return[];const t=[],a=s.split(`
144
- `);for(const n of a){const l=n.match(/^\s+-\s+(.+)$/);l&&t.push(l[1].trim())}return t}function Na(s){return s.length===0?"":`mcpServers:
145
- ${s.map(t=>` - ${t}`).join(`
146
- `)}`}function Ze(s){const t={PreToolUse:[],PostToolUse:[],Stop:[]};if(!s)return t;let a=null,n=null;const l=s.split(`
147
- `);for(const d of l){const x=d.match(/^\s{2,4}(\w+):$/);if(x&&x[1]in t){a=x[1],n=null;continue}const p=d.match(/^\s+-\s+matcher:\s*["']?([^"'\n]+)["']?$/);if(p&&a){n=p[1].trim();continue}const w=d.match(/^\s+command:\s*["']?([^"'\n]+)["']?$/);if(w&&a&&n!==null){t[a].push({matcher:n,command:w[1].trim()}),n=null;continue}}return t}function va(s){const t=[];for(const a of Ae){const n=s[a];if(n.length!==0){t.push(` ${a}:`);for(const l of n)t.push(` - matcher: "${l.matcher}"`),t.push(" hooks:"),t.push(" - type: command"),t.push(` command: "${l.command}"`)}}return t.length===0?"":`hooks:
148
- ${t.join(`
149
- `)}`}function ya({agent:s,onSaved:t}){const[a,n]=o.useState(s.color),[l,d]=o.useState(s.permissionMode),[x,p]=o.useState(s.memory),[w,f]=o.useState(s.maxTurns),[S,y]=o.useState(s.background==="true"),[E,c]=o.useState(s.isolation),[b,v]=o.useState(s.tools),[h,O]=o.useState(s.disallowedTools),[T,M]=o.useState(s.skills),[R,W]=o.useState([]),[D,j]=o.useState(()=>Qe(s.mcpServers)),[k,r]=o.useState(!1),[g,u]=o.useState(""),[L,B]=o.useState(()=>Ze(s.hooks)),[X,q]=o.useState("PreToolUse"),[re,me]=o.useState(!1);o.useEffect(()=>{let m=!1;return r(!0),Xs().then(I=>{if(m)return;const _=new Set;I.userServers&&Object.keys(I.userServers).forEach(H=>_.add(H)),I.globalServers&&Object.keys(I.globalServers).forEach(H=>_.add(H)),I.projects&&Object.values(I.projects).forEach(H=>{H!=null&&H.mcpServers&&Object.keys(H.mcpServers).forEach(G=>_.add(G))}),W(Array.from(_).sort())}).catch(()=>{}).finally(()=>{m||r(!1)}),()=>{m=!0}},[]),o.useEffect(()=>{n(s.color),d(s.permissionMode),p(s.memory),f(s.maxTurns),y(s.background==="true"),c(s.isolation),v(s.tools),O(s.disallowedTools),M(s.skills),j(Qe(s.mcpServers)),B(Ze(s.hooks))},[s]);const be=o.useCallback(async()=>{me(!0);try{const m={filePath:s.filePath};a!==s.color&&(m.color=a),l!==s.permissionMode&&(m.permissionMode=l),x!==s.memory&&(m.memory=x),w!==s.maxTurns&&(m.maxTurns=w);const I=S?"true":"";I!==s.background&&(m.background=I),E!==s.isolation&&(m.isolation=E),b!==s.tools&&(m.tools=b),h!==s.disallowedTools&&(m.disallowedTools=h),T!==s.skills&&(m.skills=T);const _=Na(D);_!==s.mcpServers&&(m.mcpServers=_);const H=va(L);if(H!==s.hooks&&(m.hooks=H),Object.keys(m).filter(Q=>Q!=="filePath").length===0){A.info("No changes to save");return}await ts(s.type,s.name,m),A.success(`Updated ${s.name} advanced settings`),t()}catch(m){A.error(`Failed: ${m.message}`)}finally{me(!1)}},[s,a,l,x,w,S,E,b,h,T,D,L,t]),je=m=>{j(I=>I.includes(m)?I.filter(_=>_!==m):[...I,m])},ue=()=>{const m=g.trim();m&&!D.includes(m)&&(j(I=>[...I,m]),u(""))},Fe=()=>{B(m=>({...m,[X]:[...m[X],{matcher:"",command:""}]}))},xe=(m,I)=>{B(_=>({..._,[m]:_[m].filter((H,G)=>G!==I)}))},ee=(m,I,_,H)=>{B(G=>({...G,[m]:G[m].map((Q,ie)=>ie===I?{...Q,[_]:H}:Q)}))};return e.jsxs("div",{className:"mt-2 ml-6 p-3 rounded-md border border-border bg-muted/20 space-y-4",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("span",{className:te,children:"Color:"}),e.jsx("select",{className:fe,value:a,onChange:m=>n(m.target.value),children:ja.map(m=>e.jsx("option",{value:m,children:m||"—"},m))})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("span",{className:te,children:"Permission:"}),e.jsx("select",{className:fe,value:l,onChange:m=>d(m.target.value),children:fa.map(m=>e.jsx("option",{value:m,children:m||"—"},m))})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("span",{className:te,children:"Memory:"}),e.jsx("select",{className:fe,value:x,onChange:m=>p(m.target.value),children:pa.map(m=>e.jsx("option",{value:m,children:m||"—"},m))})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("span",{className:te,children:"MaxTurns:"}),e.jsx(P,{className:"h-7 text-xs w-[60px]",type:"number",value:w,onChange:m=>f(m.target.value),placeholder:"—"})]}),e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx(Ie,{checked:S,onCheckedChange:m=>y(m===!0)}),e.jsx("span",{className:te,children:"Background"})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("span",{className:te,children:"Isolation:"}),e.jsx("select",{className:fe,value:E,onChange:m=>c(m.target.value),children:ba.map(m=>e.jsx("option",{value:m,children:m||"—"},m))})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:te,children:"Tools:"}),e.jsx(P,{className:"h-7 text-xs flex-1",value:b,onChange:m=>v(m.target.value),placeholder:"Read, Write, Bash, Glob, Grep"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:te,children:"Disallowed:"}),e.jsx(P,{className:"h-7 text-xs flex-1",value:h,onChange:m=>O(m.target.value),placeholder:"e.g. Edit"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:te,children:"Skills:"}),e.jsx(P,{className:"h-7 text-xs flex-1",value:T,onChange:m=>M(m.target.value),placeholder:"e.g. api-conventions, error-handling"})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"MCP Servers:"}),k?e.jsx("span",{className:"text-xs text-muted-foreground ml-2",children:"Loading..."}):e.jsxs("div",{className:"flex flex-wrap gap-3 ml-1",children:[R.map(m=>e.jsxs("label",{className:"flex items-center gap-1.5 text-xs cursor-pointer",children:[e.jsx(Ie,{checked:D.includes(m),onCheckedChange:()=>je(m)}),e.jsx("span",{className:"text-foreground",children:m})]},m)),D.filter(m=>!R.includes(m)).map(m=>e.jsxs("label",{className:"flex items-center gap-1.5 text-xs cursor-pointer",children:[e.jsx(Ie,{checked:!0,onCheckedChange:()=>je(m)}),e.jsx("span",{className:"text-foreground italic",children:m})]},m)),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(P,{className:"h-6 text-xs w-[120px]",value:g,onChange:m=>u(m.target.value),placeholder:"+ Custom",onKeyDown:m=>{m.key==="Enter"&&ue()}}),e.jsx(N,{variant:"ghost",size:"sm",className:"h-6 px-1",onClick:ue,disabled:!g.trim(),children:e.jsx(pe,{className:"w-3 h-3"})})]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"Hooks:"}),Ae.map(m=>{const I=L[m];return I.length===0?null:e.jsxs("div",{className:"ml-1 space-y-1",children:[e.jsxs("span",{className:"text-xs text-muted-foreground font-medium",children:[m,":"]}),I.map((_,H)=>e.jsxs("div",{className:"flex items-center gap-2 ml-3",children:[e.jsx(P,{className:"h-6 text-xs w-[100px]",value:_.matcher,onChange:G=>ee(m,H,"matcher",G.target.value),placeholder:"matcher (e.g. Bash)"}),e.jsx("span",{className:"text-xs text-muted-foreground",children:"→"}),e.jsx(P,{className:"h-6 text-xs flex-1",value:_.command,onChange:G=>ee(m,H,"command",G.target.value),placeholder:"command"}),e.jsx("button",{type:"button",className:"text-muted-foreground hover:text-destructive transition-colors",onClick:()=>xe(m,H),children:e.jsx(Y,{className:"w-3 h-3"})})]},H))]},m)}),e.jsxs("div",{className:"flex items-center gap-2 ml-1",children:[e.jsx("select",{className:fe,value:X,onChange:m=>q(m.target.value),children:Ae.map(m=>e.jsx("option",{value:m,children:m},m))}),e.jsxs(N,{variant:"outline",size:"sm",className:"h-6 px-2 text-xs",onClick:Fe,children:[e.jsx(pe,{className:"w-3 h-3 mr-1"}),"Add Hook"]})]})]}),e.jsx("div",{className:"flex justify-end",children:e.jsxs(N,{variant:"default",size:"sm",className:"h-7",disabled:re,onClick:be,children:[e.jsx(Ee,{className:"w-3 h-3 mr-1"}),re?"Saving...":"Save Advanced"]})})]})}function wa({agent:s,onSaved:t}){const[a,n]=o.useState(s.model),[l,d]=o.useState(s.effort),[x,p]=o.useState(!1),[w,f]=o.useState(!1),S=a!==s.model||l!==s.effort,y=s.type==="codex"?ha:ga,E=o.useCallback(async()=>{p(!0);try{const c={filePath:s.filePath};a!==s.model&&(c.model=a),l!==s.effort&&(c.effort=l),await ts(s.type,s.name,c),A.success(`Updated ${s.name}`),t()}catch(c){A.error(`Failed to update ${s.name}: ${c.message}`)}finally{p(!1)}},[s,a,l,t]);return o.useEffect(()=>{n(s.model),d(s.effort)},[s.model,s.effort]),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-3 py-2 px-3 rounded-md border border-border bg-card hover:bg-accent/30 transition-colors",children:[e.jsx(J,{variant:s.type==="codex"?"default":"secondary",className:"text-xs shrink-0",children:s.type}),e.jsx("span",{className:"text-sm font-medium text-foreground min-w-[140px] truncate",title:s.name,children:s.name}),e.jsxs("div",{className:"flex items-center gap-1 flex-1 min-w-0",children:[e.jsx("span",{className:"text-xs text-muted-foreground shrink-0",children:"Model:"}),s.type==="claude"?e.jsxs("div",{className:"flex gap-1 flex-1 min-w-0",children:[e.jsxs("select",{className:"h-7 text-xs rounded border border-input bg-background px-2 shrink-0",value:Te.includes(a)?a:"__custom__",onChange:c=>{c.target.value!=="__custom__"&&n(c.target.value)},children:[Te.map(c=>e.jsx("option",{value:c,children:c||"(none)"},c)),!Te.includes(a)&&e.jsx("option",{value:"__custom__",children:"custom"})]}),!Te.includes(a)&&e.jsx(P,{className:"h-7 text-xs flex-1 min-w-[100px]",value:a,onChange:c=>n(c.target.value),placeholder:"model id"})]}):e.jsx(P,{className:"h-7 text-xs flex-1 min-w-[100px]",value:a,onChange:c=>n(c.target.value),placeholder:"model id"})]}),e.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[e.jsx("span",{className:"text-xs text-muted-foreground",children:"Effort:"}),e.jsx("select",{className:"h-7 text-xs rounded border border-input bg-background px-2",value:l,onChange:c=>d(c.target.value),children:y.map(c=>e.jsx("option",{value:c,children:c||"—"},c))})]}),e.jsxs(N,{variant:"outline",size:"sm",className:"h-7 px-2 shrink-0",disabled:!S||x,onClick:E,children:[e.jsx(Ee,{className:"w-3 h-3 mr-1"}),x?"...":"Save"]}),s.type==="claude"&&e.jsx("button",{type:"button",className:z("p-1 rounded hover:bg-accent transition-colors",w&&"text-primary"),onClick:()=>f(!w),title:"Advanced Settings",children:e.jsx(At,{className:"w-4 h-4"})})]}),w&&s.type==="claude"&&e.jsx(ya,{agent:s,onSaved:t})]})}function ka({installationPath:s,agents:t,onSaved:a}){const[n,l]=o.useState(!0);return e.jsxs("div",{className:"space-y-2",children:[e.jsxs("button",{type:"button",className:"flex items-center gap-2 w-full text-left py-1 hover:text-primary transition-colors",onClick:()=>l(!n),children:[n?e.jsx(Me,{className:"w-4 h-4"}):e.jsx(Js,{className:"w-4 h-4"}),e.jsx("span",{className:"text-sm font-medium text-foreground truncate",title:s,children:s}),e.jsxs(J,{variant:"outline",className:"text-xs ml-auto shrink-0",children:[t.length," agents"]})]}),n&&e.jsx("div",{className:"space-y-1 ml-6",children:t.map(d=>e.jsx(wa,{agent:d,onSaved:a},d.filePath))})]})}function Ca(){const[s,t]=o.useState([]),[a,n]=o.useState(!0),[l,d]=o.useState(""),[x,p]=o.useState(""),[w,f]=o.useState(!1),S=o.useCallback(async()=>{try{n(!0);const c=await Gs();t(c.agents)}catch(c){A.error(`Failed to load agents: ${c.message}`)}finally{n(!1)}},[]);o.useEffect(()=>{S()},[S]);const y=s.reduce((c,b)=>{const v=b.installationPath;return c[v]||(c[v]=[]),c[v].push(b),c},{}),E=o.useCallback(async()=>{if(!l&&!x){A.error("Set a model or effort value first");return}f(!0);try{const c=s.map(v=>({filePath:v.filePath,type:v.type})),b=await Ks({targets:c,model:l||void 0,effort:x||void 0});A.success(`Updated ${b.updated}/${b.total} agents`),S()}catch(c){A.error(`Batch update failed: ${c.message}`)}finally{f(!1)}},[s,l,x,S]);return e.jsxs(K,{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(Ot,{className:"w-5 h-5"}),"Agent Definitions"]}),e.jsxs(N,{variant:"ghost",size:"sm",onClick:S,disabled:a,children:[e.jsx(ne,{className:z("w-4 h-4 mr-1",a&&"animate-spin")}),"Refresh"]})]}),e.jsxs("div",{className:"flex items-center gap-3 p-3 mb-4 rounded-md border border-border bg-muted/30",children:[e.jsx("span",{className:"text-xs font-medium text-muted-foreground shrink-0",children:"Batch:"}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("span",{className:"text-xs text-muted-foreground",children:"Model:"}),e.jsx(P,{className:"h-7 text-xs w-[160px]",value:l,onChange:c=>d(c.target.value),placeholder:"model for all"})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("span",{className:"text-xs text-muted-foreground",children:"Effort:"}),e.jsxs("select",{className:"h-7 text-xs rounded border border-input bg-background px-2",value:x,onChange:c=>p(c.target.value),children:[e.jsx("option",{value:"",children:"—"}),e.jsx("option",{value:"low",children:"low"}),e.jsx("option",{value:"medium",children:"medium"}),e.jsx("option",{value:"high",children:"high"}),e.jsx("option",{value:"max",children:"max (claude only)"})]})]}),e.jsx(N,{variant:"default",size:"sm",className:"h-7",disabled:w||!l&&!x,onClick:E,children:w?"Applying...":"Apply to All"})]}),a?e.jsx("div",{className:"text-center text-sm text-muted-foreground py-8",children:"Loading agents..."}):s.length===0?e.jsx("div",{className:"text-center text-sm text-muted-foreground py-8",children:"No agent definitions found. Install CCW to a project first."}):e.jsx("div",{className:"space-y-4",children:Object.entries(y).map(([c,b])=>e.jsx(ka,{installationPath:c,agents:b,onSaved:S},c))})]})}function Sa(){const s=document.cookie.match(/XSRF-TOKEN=([^;]+)/);return s?decodeURIComponent(s[1]):null}function es({value:s,onChange:t,placeholder:a}){const[n,l]=o.useState(!1),[d,x]=o.useState(null),p=Rt(s,500);o.useEffect(()=>{if(p){l(!0),x(null);const f=setTimeout(()=>{p.trim().length>0?x(null):x("Path cannot be empty."),l(!1)},1e3);return()=>clearTimeout(f)}else x(null),l(!1)},[p]);const w=async()=>{const{selectFile:f}=await dt(async()=>{const{selectFile:E}=await import("./index-DZGHdspr.js").then(c=>c.gf);return{selectFile:E}},__vite__mapDeps([0,1])),S=s?s.replace(/[/\\][^/\\]*$/,""):void 0,y=await f(S);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(P,{value:s,onChange:f=>t(f.target.value),placeholder:a,className:z("flex-1",d&&"border-destructive")}),n&&e.jsx("div",{className:"absolute inset-y-0 right-0 flex items-center pr-3",children:e.jsx(ot,{className:"h-4 w-4 animate-spin text-muted-foreground"})})]}),e.jsx(N,{type:"button",variant:"outline",size:"sm",className:"shrink-0 h-9",onClick:w,title:"Browse",children:e.jsx(ct,{className:"w-4 h-4"})})]}),d&&e.jsx("p",{className:"text-xs text-destructive mt-1",children:d})]})}const Ta=new Set(["gemini","qwen","opencode"]),Ma=new Set(["claude"]);function ls(s){return Ta.has(s)?"envFile":Ma.has(s)?"settingsFile":"none"}function Ea({toolId:s,config:t,isDefault:a,isExpanded:n,toolAvailable:l,isSaving:d,onToggleExpand:x,onToggleEnabled:p,onSetDefault:w,onUpdateModel:f,onUpdateTags:S,onUpdateAvailableModels:y,onUpdateEnvFile:E,onUpdateSettingsFile:c,onUpdateEffort:b,onSaveToBackend:v}){const{formatMessage:h}=V(),[O,T]=o.useState(""),[M,R]=o.useState(""),W=()=>{const u=O.trim();u&&!t.tags.includes(u)&&(S([...t.tags,u]),T(""))},D=u=>{S(t.tags.filter(L=>L!==u))},j=()=>{const u=M.trim(),L=t.availableModels||[];u&&!L.includes(u)&&(y([...L,u]),R(""))},k=u=>{const L=t.availableModels||[];y(L.filter(B=>B!==u))},r=["分析","Debug","implementation","refactoring","testing"],g=ls(s);return e.jsxs(K,{className:z("overflow-hidden",!t.enabled&&"opacity-60"),children:[e.jsxs("div",{className:"p-4 cursor-pointer hover:bg-muted/50 transition-colors",onClick:x,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:z("p-2 rounded-lg",t.enabled?"bg-primary/10":"bg-muted"),children:e.jsx(as,{className:z("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(J,{variant:"default",className:"text-xs",children:h({id:"settings.cliTools.default"})}),e.jsx(J,{variant:"outline",className:"text-xs",children:t.type}),l!==void 0&&e.jsx("span",{className:z("inline-block w-2 h-2 rounded-full",l?"bg-green-500":"bg-red-400"),title:l?"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(N,{variant:t.enabled?"default":"outline",size:"sm",className:"h-8",onClick:u=>{u.stopPropagation(),p()},children:t.enabled?e.jsxs(e.Fragment,{children:[e.jsx(Z,{className:"w-4 h-4 mr-1"}),h({id:"settings.cliTools.enabled"})]}):e.jsxs(e.Fragment,{children:[e.jsx(Y,{className:"w-4 h-4 mr-1"}),h({id:"settings.cliTools.disabled"})]})}),n?e.jsx(He,{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(u=>e.jsx(J,{variant:"secondary",className:"text-xs",children:u},u))})]}),n&&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:h({id:"settings.cliTools.primaryModel"})}),e.jsx(P,{value:t.primaryModel,onChange:u=>f("primaryModel",u.target.value),className:"mt-1"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium text-foreground",children:h({id:"settings.cliTools.secondaryModel"})}),e.jsx(P,{value:t.secondaryModel,onChange:u=>f("secondaryModel",u.target.value),className:"mt-1"})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"text-sm font-medium text-foreground",children:h({id:"apiSettings.cliSettings.tags"})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:h({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(u=>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:[u,e.jsx("button",{type:"button",onClick:()=>D(u),className:"hover:text-destructive transition-colors","aria-label":h({id:"apiSettings.cliSettings.removeTag"}),children:e.jsx(Y,{className:"w-3 h-3"})})]},u)),e.jsx("input",{type:"text",value:O,onChange:u=>T(u.target.value),onKeyDown:u=>{u.key==="Enter"&&(u.preventDefault(),W())},placeholder:t.tags.length===0?h({id:"apiSettings.cliSettings.tagInputPlaceholder"}):"",className:"flex-1 min-w-[120px] bg-transparent border-0 outline-none text-sm placeholder:text-muted-foreground"})]}),e.jsx(N,{type:"button",size:"sm",onClick:W,variant:"outline",className:"shrink-0",children:e.jsx(pe,{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:[h({id:"apiSettings.cliSettings.predefinedTags"}),":"]}),r.map(u=>e.jsx("button",{type:"button",onClick:()=>{t.tags.includes(u)||S([...t.tags,u])},disabled:t.tags.includes(u),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:u},u))]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"text-sm font-medium text-foreground",children:h({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(u=>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:[u,e.jsx("button",{type:"button",onClick:()=>k(u),className:"hover:text-destructive transition-colors",children:e.jsx(Y,{className:"w-3 h-3"})})]},u)),e.jsx("input",{type:"text",value:M,onChange:u=>R(u.target.value),onKeyDown:u=>{u.key==="Enter"&&(u.preventDefault(),j())},placeholder:(t.availableModels||[]).length===0?h({id:"apiSettings.cliSettings.availableModelsPlaceholder"}):"",className:"flex-1 min-w-[120px] bg-transparent border-0 outline-none text-sm placeholder:text-muted-foreground"})]}),e.jsx(N,{type:"button",size:"sm",onClick:j,variant:"outline",className:"shrink-0",children:e.jsx(pe,{className:"w-4 h-4"})})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:h({id:"apiSettings.cliSettings.availableModelsHint"})})]}),g==="envFile"&&e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"text-sm font-medium text-foreground",children:h({id:"settings.cliTools.envFile"})}),e.jsx(es,{value:t.envFile||"",onChange:u=>E(u||void 0),placeholder:h({id:"settings.cliTools.envFilePlaceholder"})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:h({id:"settings.cliTools.envFileHint"})})]}),g==="settingsFile"&&e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"text-sm font-medium text-foreground",children:h({id:"apiSettings.cliSettings.settingsFile"})}),e.jsx(es,{value:t.settingsFile||"",onChange:u=>c(u||void 0),placeholder:h({id:"apiSettings.cliSettings.settingsFilePlaceholder"})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:h({id:"apiSettings.cliSettings.settingsFileHint"})})]}),g==="settingsFile"&&e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"text-sm font-medium text-foreground",children:h({id:"settings.cliTools.effort"})}),e.jsx("div",{className:"flex gap-2",children:["low","medium","high"].map(u=>{const L=t.effort||"high",B=`settings.cliTools.effort${u.charAt(0).toUpperCase()+u.slice(1)}`;return e.jsx("button",{type:"button",onClick:()=>b(u==="high"&&!t.effort?void 0:u),className:z("px-3 py-1.5 rounded-md text-sm border transition-colors",L===u?"bg-primary text-primary-foreground border-primary":"border-border hover:bg-muted"),children:h({id:B})},u)})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:h({id:"settings.cliTools.effortHint"})})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[!a&&t.enabled&&e.jsx(N,{variant:"outline",size:"sm",onClick:w,children:h({id:"settings.cliTools.setDefault"})}),e.jsxs(N,{variant:"default",size:"sm",onClick:v,disabled:d,children:[e.jsx(Ee,{className:"w-4 h-4 mr-1"}),h(d?{id:"settings.cliTools.saving"}:{id:"settings.cliTools.saveToConfig"})]})]})]})]})}function Fa(){const{formatMessage:s}=V(),{data:t,isLoading:a}=jt(),{toggle:n,isPending:l}=Nt(),{data:d,isLoading:x}=vt(),{toggle:p,isPending:w}=yt(),{data:f,isLoading:S}=wt(),{toggle:y,isPending:E}=kt(),{refresh:c,isPending:b}=Ct(),{exportSettings:v,isPending:h}=St(),{importSettings:O,isPending:T}=Tt(),M=o.useRef(null),R=o.useCallback(async()=>{try{const D=await v(),j=new Blob([JSON.stringify(D,null,2)],{type:"application/json"}),k=URL.createObjectURL(j),r=document.createElement("a"),g=new Date().toISOString().replace(/[:.]/g,"-").slice(0,19);r.href=k,r.download=`ccw-settings-${g}.json`,document.body.appendChild(r),r.click(),document.body.removeChild(r),URL.revokeObjectURL(k),A.success(s({id:"settings.responseLanguage.exportSuccess"}))}catch{A.error(s({id:"settings.responseLanguage.exportError"}))}},[v,s]),W=o.useCallback(async D=>{var k;const j=(k=D.target.files)==null?void 0:k[0];if(j){if(D.target.value="",!j.name.endsWith(".json")&&j.type!=="application/json"){A.error(s({id:"settings.responseLanguage.importInvalidFile"}));return}try{const r=await j.text(),g=JSON.parse(r);if(!g.version||!g.endpoints){A.error(s({id:"settings.responseLanguage.importInvalidStructure"}));return}const u=await O(g);u.success?A.success(s({id:"settings.responseLanguage.importSuccess"},{imported:u.imported,skipped:u.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"}))}}},[O,s]);return e.jsxs(K,{className:"p-6",children:[e.jsxs("h2",{className:"text-lg font-semibold text-foreground flex items-center gap-2 mb-4",children:[e.jsx(Vt,{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(J,{variant:"default",className:"text-xs",children:"Claude"})]}),e.jsx(N,{variant:t!=null&&t.claudeEnabled?"default":"outline",size:"sm",className:"h-7",disabled:a||l,onClick:()=>n(!(t!=null&&t.claudeEnabled),"claude"),children:t!=null&&t.claudeEnabled?e.jsxs(e.Fragment,{children:[e.jsx(Z,{className:"w-4 h-4 mr-1"}),s({id:"settings.responseLanguage.enabled"})]}):e.jsxs(e.Fragment,{children:[e.jsx(Y,{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(J,{variant:"secondary",className:"text-xs",children:"Codex"})]}),e.jsx(N,{variant:t!=null&&t.codexEnabled?"default":"outline",size:"sm",className:"h-7",disabled:a||l,onClick:()=>n(!(t!=null&&t.codexEnabled),"codex"),children:t!=null&&t.codexEnabled?e.jsxs(e.Fragment,{children:[e.jsx(Z,{className:"w-4 h-4 mr-1"}),s({id:"settings.responseLanguage.enabled"})]}):e.jsxs(e.Fragment,{children:[e.jsx(Y,{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(ze,{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(tt,{className:"w-4 h-4 text-muted-foreground"}),e.jsx("span",{className:"text-sm font-medium",children:s({id:"settings.responseLanguage.windowsPlatform"})})]}),e.jsx(N,{variant:d!=null&&d.enabled?"default":"outline",size:"sm",className:"h-7",disabled:x||w,onClick:()=>p(!(d!=null&&d.enabled)),children:d!=null&&d.enabled?e.jsxs(e.Fragment,{children:[e.jsx(Z,{className:"w-4 h-4 mr-1"}),s({id:"settings.responseLanguage.enabled"})]}):e.jsxs(e.Fragment,{children:[e.jsx(Y,{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(at,{className:"w-4 h-4 text-muted-foreground"}),e.jsx("span",{className:"text-sm font-medium",children:s({id:"settings.responseLanguage.cliEnhancement"})}),e.jsx(J,{variant:"secondary",className:"text-xs",children:"Codex"})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[(f==null?void 0:f.enabled)&&e.jsx(N,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0",disabled:S||b,onClick:()=>c(),title:s({id:"settings.responseLanguage.refreshConfig"}),children:e.jsx(ne,{className:z("w-3.5 h-3.5",b&&"animate-spin")})}),e.jsx(N,{variant:f!=null&&f.enabled?"default":"outline",size:"sm",className:"h-7",disabled:S||E,onClick:()=>y(!(f!=null&&f.enabled)),children:f!=null&&f.enabled?e.jsxs(e.Fragment,{children:[e.jsx(Z,{className:"w-4 h-4 mr-1"}),s({id:"settings.responseLanguage.enabled"})]}):e.jsxs(e.Fragment,{children:[e.jsx(Y,{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"})}),(f==null?void 0:f.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:M,type:"file",accept:".json,application/json",onChange:W,className:"hidden"}),e.jsx(N,{variant:"outline",size:"sm",className:"h-7",disabled:T,onClick:()=>{var D;return(D=M.current)==null?void 0:D.click()},children:T?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(Ht,{className:"w-3.5 h-3.5 mr-1"}),s({id:"settings.responseLanguage.import"})]})}),e.jsx(N,{variant:"outline",size:"sm",className:"h-7",disabled:h,onClick:R,children:h?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(nt,{className:"w-3.5 h-3.5 mr-1"}),s({id:"settings.responseLanguage.export"})]})})]})]})})]})}function Pa(){const{formatMessage:s}=V(),[t,a]=o.useState(null),[n,l]=o.useState(!1),[d,x]=o.useState(null),[p,w]=o.useState(null),[f,S]=o.useState(()=>{try{const c=localStorage.getItem("ccw.autoUpdate");return c===null?!0:JSON.parse(c)}catch{return!0}}),y=async(c=!1)=>{c||l(!0),x(null);try{const b=await fetch("/api/version-check");if(!b.ok)throw new Error(`HTTP ${b.status}`);const v=await b.json();if(!v.currentVersion)throw new Error("Invalid response");a(v),w(new Date)}catch(b){c||x(b instanceof Error?b.message:"Unknown error")}finally{l(!1)}};o.useEffect(()=>{if(y(!0),!f)return;const c=setInterval(()=>y(!0),3600*1e3);return()=>clearInterval(c)},[f]);const E=c=>{S(c),localStorage.setItem("ccw.autoUpdate",JSON.stringify(c))};return e.jsxs(K,{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(ns,{className:"w-5 h-5"}),s({id:"settings.versionCheck.title"})]}),e.jsxs(N,{variant:"outline",size:"sm",disabled:n,onClick:()=>y(),children:[e.jsx(ne,{className:z("w-3.5 h-3.5 mr-1.5",n&&"animate-spin")}),s(n?{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(J,{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(J,{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:z("inline-block w-2.5 h-2.5 rounded-full",t.hasUpdate?"bg-orange-500":"bg-green-500")})]}),d&&e.jsxs("div",{className:"flex items-center gap-2 pt-2 border-t border-border",children:[e.jsx(ze,{className:"w-4 h-4 text-destructive flex-shrink-0"}),e.jsxs("span",{className:"text-sm text-destructive",children:[s({id:"settings.versionCheck.checkFailed"}),": ",d]})]})]}),(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(N,{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:f,onChange:c=>E(c.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 La(){const{formatMessage:s}=V(),{installations:t,isLoading:a,refetch:n}=Mt(),{upgrade:l,isPending:d}=Et(),{data:x}=Ft();return e.jsxs(K,{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($t,{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(N,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0",onClick:()=>n(),title:s({id:"settings.systemStatus.refresh"}),children:e.jsx(ne,{className:z("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 w=p.installation_mode==="Global",f=new Date(p.installation_date).toLocaleDateString(),S=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:z("inline-flex items-center justify-center w-8 h-8 rounded-lg",w?"bg-primary/10 text-primary":"bg-orange-500/10 text-orange-500"),children:w?e.jsx(rt,{className:"w-4 h-4"}):e.jsx(zt,{className:"w-4 h-4"})}),e.jsx("span",{className:"text-sm font-medium",children:s(w?{id:"settings.systemStatus.global"}:{id:"settings.systemStatus.path"})}),e.jsxs(J,{variant:"secondary",className:"text-xs font-mono",children:["v",S]})]}),e.jsxs(N,{variant:"ghost",size:"sm",className:"h-7",disabled:d,onClick:()=>l(p.installation_path),children:[e.jsx(ns,{className:z("w-3.5 h-3.5 mr-1",d&&"animate-spin")}),s(d?{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(it,{className:"w-3 h-3"}),f]}),e.jsxs("span",{className:"inline-flex items-center gap-1",children:[e.jsx(lt,{className:"w-3 h-3"}),p.files_count," ",s({id:"settings.systemStatus.files"})]})]})]},p.manifest_id)}),x&&!x.installed&&x.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(ze,{className:"w-4 h-4"}),s({id:"settings.systemStatus.incomplete"})," — ",x.missingFiles.length," ",s({id:"settings.systemStatus.missingFiles"}).toLowerCase()]}),e.jsxs("ul",{className:"text-xs text-muted-foreground list-disc list-inside",children:[x.missingFiles.slice(0,4).map(p=>e.jsx("li",{children:p},p)),x.missingFiles.length>4&&e.jsxs("li",{children:["+",x.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 Ua({cliTools:s,defaultCliTool:t,expandedTools:a,savingTools:n,onToggleExpand:l,onToggleEnabled:d,onSetDefault:x,onUpdateModel:p,onUpdateTags:w,onUpdateAvailableModels:f,onUpdateEnvFile:S,onUpdateSettingsFile:y,onUpdateEffort:E,onSaveToBackend:c,formatMessage:b}){const{data:v}=Pt();return e.jsxs(e.Fragment,{children:[e.jsxs("p",{className:"text-sm text-muted-foreground mb-4",children:[b({id:"settings.cliTools.description"})," ",e.jsx("strong",{className:"text-foreground",children:t})]}),e.jsx("div",{className:"space-y-3",children:Object.entries(s).map(([h,O])=>{const T=v==null?void 0:v[h];return e.jsx(Ea,{toolId:h,config:O,isDefault:h===t,isExpanded:a.has(h),toolAvailable:T==null?void 0:T.available,isSaving:n.has(h),onToggleExpand:()=>l(h),onToggleEnabled:()=>d(h),onSetDefault:()=>x(h),onUpdateModel:(M,R)=>p(h,M,R),onUpdateTags:M=>w(h,M),onUpdateAvailableModels:M=>f(h,M),onUpdateEnvFile:M=>S(h,M),onUpdateSettingsFile:M=>y(h,M),onUpdateEffort:M=>E(h,M),onSaveToBackend:()=>c(h)},h)})})]})}function Ya(){const{formatMessage:s}=V(),{theme:t,setTheme:a}=Re(),n=Se(Ys),l=Se(Qs),d=Se(Zs),{updateCliTool:x,setDefaultCliTool:p,setUserPreferences:w,resetUserPreferences:f}=Se(),[S,y]=o.useState(new Set),[E,c]=o.useState(new Set),b=r=>{y(g=>{const u=new Set(g);return u.has(r)?u.delete(r):u.add(r),u})},v=r=>{x(r,{enabled:!n[r].enabled})},h=r=>{p(r)},O=(r,g,u)=>{x(r,{[g]:u})},T=(r,g)=>{x(r,{tags:g})},M=(r,g)=>{x(r,{availableModels:g})},R=(r,g)=>{x(r,{envFile:g})},W=(r,g)=>{x(r,{settingsFile:g})},D=(r,g)=>{x(r,{effort:g})},j=o.useCallback(async r=>{const g=n[r];if(g){c(u=>new Set(u).add(r));try{const u={enabled:g.enabled,primaryModel:g.primaryModel,secondaryModel:g.secondaryModel,tags:g.tags,availableModels:g.availableModels},L=ls(r);L==="envFile"?u.envFile=g.envFile||null:L==="settingsFile"&&(u.settingsFile=g.settingsFile||null,u.effort=g.effort||null);const B=Sa(),X={"Content-Type":"application/json"};B&&(X["X-CSRF-Token"]=B);const q=await fetch(`/api/cli/config/${r}`,{method:"PUT",headers:X,body:JSON.stringify(u),credentials:"same-origin"});if(!q.ok)throw new Error(`HTTP ${q.status}`);A.success(s({id:"settings.cliTools.configSaved"}),{description:r})}catch{A.error(s({id:"settings.cliTools.configSaveError"}),{description:r})}finally{c(u=>{const L=new Set(u);return L.delete(r),L})}}},[n,s]),k=(r,g)=>{w({[r]:g})};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(et,{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(K,{className:"p-6",children:[e.jsxs("h2",{className:"text-lg font-semibold text-foreground flex items-center gap-2 mb-4",children:[e.jsx(st,{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(Qt,{})]}),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(N,{variant:t==="system"?"default":"outline",size:"sm",onClick:()=>a("system"),children:s({id:"settings.appearance.themeOptions.system"})})]})]})]}),e.jsxs(K,{className:"p-6",children:[e.jsxs("h2",{className:"text-lg font-semibold text-foreground flex items-center gap-2 mb-4",children:[e.jsx(rs,{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(ea,{})]})})]}),e.jsx(Fa,{}),e.jsx(xa,{}),e.jsx(La,{}),e.jsx(Pa,{}),e.jsxs(K,{className:"p-6",children:[e.jsxs("h2",{className:"text-lg font-semibold text-foreground flex items-center gap-2 mb-4",children:[e.jsx(as,{className:"w-5 h-5"}),s({id:"settings.sections.cliTools"})]}),e.jsx(Ua,{cliTools:n,defaultCliTool:l,expandedTools:S,savingTools:E,onToggleExpand:b,onToggleEnabled:v,onSetDefault:h,onUpdateModel:O,onUpdateTags:T,onUpdateAvailableModels:M,onUpdateEnvFile:R,onUpdateSettingsFile:W,onUpdateEffort:D,onSaveToBackend:j,formatMessage:s})]}),e.jsx(Ca,{}),e.jsxs(K,{className:"p-6",children:[e.jsxs("h2",{className:"text-lg font-semibold text-foreground flex items-center gap-2 mb-4",children:[e.jsx(ne,{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(N,{variant:d.autoRefresh?"default":"outline",size:"sm",onClick:()=>k("autoRefresh",!d.autoRefresh),children:d.autoRefresh?s({id:"settings.dataRefresh.enabled"}):s({id:"settings.dataRefresh.disabled"})})]}),d.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(N,{variant:d.refreshInterval===r?"default":"outline",size:"sm",onClick:()=>k("refreshInterval",r),children:[r/1e3,"s"]},r))})]})]})]}),e.jsxs(K,{className:"p-6",children:[e.jsxs("h2",{className:"text-lg font-semibold text-foreground flex items-center gap-2 mb-4",children:[e.jsx($e,{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(N,{variant:d.notificationsEnabled?"default":"outline",size:"sm",onClick:()=>k("notificationsEnabled",!d.notificationsEnabled),children:d.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(N,{variant:d.soundEnabled?"default":"outline",size:"sm",onClick:()=>k("soundEnabled",!d.soundEnabled),children:d.soundEnabled?s({id:"settings.notifications.on"}):s({id:"settings.notifications.off"})})]})]})]}),e.jsx(da,{}),e.jsxs(K,{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(Xe,{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(N,{variant:"destructive",onClick:()=>{confirm(s({id:"settings.reset.confirm"}))&&f()},children:[e.jsx(Xe,{className:"w-4 h-4 mr-2"}),s({id:"common.actions.resetToDefaults"})]})]})]})}export{Ya as SettingsPage,Ya as default};
150
- //# sourceMappingURL=SettingsPage-Qj0fFDjX.js.map