claude-code-workflow 7.2.28 → 7.2.30
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.
- package/.ccw/workflows/cli-templates/schemas/plan-overview-base-schema.json +2 -2
- package/.ccw/workflows/cli-templates/schemas/task-schema.json +14 -7
- package/.claude/agents/action-planning-agent.md +7 -4
- package/.claude/agents/cli-explore-agent.md +77 -63
- package/.claude/agents/cli-lite-planning-agent.md +11 -10
- package/.claude/agents/issue-plan-agent.md +421 -426
- package/.claude/commands/workflow/spec/setup.md +1 -1
- package/.claude/skills/ccw-chain/SKILL.md +119 -0
- package/.claude/skills/ccw-chain/chains/ccw-cycle.json +21 -0
- package/.claude/skills/ccw-chain/chains/ccw-exploration.json +47 -0
- package/.claude/skills/ccw-chain/chains/ccw-issue.json +33 -0
- package/.claude/skills/ccw-chain/chains/ccw-lightweight.json +57 -0
- package/.claude/skills/ccw-chain/chains/ccw-main.json +52 -0
- package/.claude/skills/ccw-chain/chains/ccw-standard.json +39 -0
- package/.claude/skills/ccw-chain/chains/ccw-team.json +10 -0
- package/.claude/skills/ccw-chain/chains/ccw-with-file.json +31 -0
- package/.claude/skills/ccw-chain/phases/analyze-with-file.md +788 -0
- package/.claude/skills/ccw-chain/phases/brainstorm/SKILL.md +408 -0
- package/.claude/skills/ccw-chain/phases/brainstorm/phases/01-mode-routing.md +207 -0
- package/.claude/skills/ccw-chain/phases/brainstorm/phases/02-artifacts.md +567 -0
- package/.claude/skills/ccw-chain/phases/brainstorm/phases/03-role-analysis.md +748 -0
- package/.claude/skills/ccw-chain/phases/brainstorm/phases/04-synthesis.md +827 -0
- package/.claude/skills/ccw-chain/phases/brainstorm-with-file.md +482 -0
- package/.claude/skills/ccw-chain/phases/collaborative-plan-with-file.md +639 -0
- package/.claude/skills/ccw-chain/phases/debug-with-file.md +656 -0
- package/.claude/skills/ccw-chain/phases/integration-test-cycle.md +936 -0
- package/.claude/skills/ccw-chain/phases/issue-convert-to-plan.md +720 -0
- package/.claude/skills/ccw-chain/phases/issue-discover.md +483 -0
- package/.claude/skills/ccw-chain/phases/issue-execute.md +629 -0
- package/.claude/skills/ccw-chain/phases/issue-from-brainstorm.md +382 -0
- package/.claude/skills/ccw-chain/phases/issue-plan.md +343 -0
- package/.claude/skills/ccw-chain/phases/issue-queue.md +464 -0
- package/.claude/skills/ccw-chain/phases/refactor-cycle.md +852 -0
- package/.claude/skills/ccw-chain/phases/review-cycle/SKILL.md +132 -0
- package/.claude/skills/ccw-chain/phases/review-cycle/phases/review-fix.md +760 -0
- package/.claude/skills/ccw-chain/phases/review-cycle/phases/review-module.md +764 -0
- package/.claude/skills/ccw-chain/phases/review-cycle/phases/review-session.md +775 -0
- package/.claude/skills/ccw-chain/phases/roadmap-with-file.md +544 -0
- package/.claude/skills/ccw-chain/phases/spec-generator/SKILL.md +338 -0
- package/.claude/skills/ccw-chain/phases/spec-generator/phases/01-5-requirement-clarification.md +404 -0
- package/.claude/skills/ccw-chain/phases/spec-generator/phases/01-discovery.md +257 -0
- package/.claude/skills/ccw-chain/phases/spec-generator/phases/02-product-brief.md +274 -0
- package/.claude/skills/ccw-chain/phases/spec-generator/phases/03-requirements.md +184 -0
- package/.claude/skills/ccw-chain/phases/spec-generator/phases/04-architecture.md +248 -0
- package/.claude/skills/ccw-chain/phases/spec-generator/phases/05-epics-stories.md +178 -0
- package/.claude/skills/ccw-chain/phases/spec-generator/phases/06-5-auto-fix.md +144 -0
- package/.claude/skills/ccw-chain/phases/spec-generator/phases/06-readiness-check.md +480 -0
- package/.claude/skills/ccw-chain/phases/team-planex.md +123 -0
- package/.claude/skills/ccw-chain/phases/ui-design-explore-auto.md +678 -0
- package/.claude/skills/ccw-chain/phases/unified-execute-with-file.md +870 -0
- package/.claude/skills/ccw-chain/phases/workflow-execute/SKILL.md +625 -0
- package/.claude/skills/ccw-chain/phases/workflow-execute/phases/06-review.md +215 -0
- package/.claude/skills/ccw-chain/phases/workflow-lite-plan.md +616 -0
- package/.claude/skills/ccw-chain/phases/workflow-multi-cli-plan.md +424 -0
- package/.claude/skills/ccw-chain/phases/workflow-plan/SKILL.md +466 -0
- package/.claude/skills/ccw-chain/phases/workflow-plan/phases/01-session-discovery.md +99 -0
- package/.claude/skills/ccw-chain/phases/workflow-plan/phases/02-context-gathering.md +338 -0
- package/.claude/skills/ccw-chain/phases/workflow-plan/phases/03-conflict-resolution.md +422 -0
- package/.claude/skills/ccw-chain/phases/workflow-plan/phases/04-task-generation.md +440 -0
- package/.claude/skills/ccw-chain/phases/workflow-plan/phases/05-plan-verify.md +395 -0
- package/.claude/skills/ccw-chain/phases/workflow-plan/phases/06-replan.md +594 -0
- package/.claude/skills/ccw-chain/phases/workflow-tdd-plan/SKILL.md +527 -0
- package/.claude/skills/ccw-chain/phases/workflow-tdd-plan/phases/01-session-discovery.md +57 -0
- package/.claude/skills/ccw-chain/phases/workflow-tdd-plan/phases/02-context-gathering.md +407 -0
- package/.claude/skills/ccw-chain/phases/workflow-tdd-plan/phases/03-test-coverage-analysis.md +172 -0
- package/.claude/skills/ccw-chain/phases/workflow-tdd-plan/phases/04-conflict-resolution.md +426 -0
- package/.claude/skills/ccw-chain/phases/workflow-tdd-plan/phases/05-tdd-task-generation.md +473 -0
- package/.claude/skills/ccw-chain/phases/workflow-tdd-plan/phases/06-tdd-structure-validation.md +189 -0
- package/.claude/skills/ccw-chain/phases/workflow-tdd-plan/phases/07-tdd-verify.md +635 -0
- package/.claude/skills/ccw-chain/phases/workflow-test-fix/SKILL.md +482 -0
- package/.claude/skills/ccw-chain/phases/workflow-test-fix/phases/01-session-start.md +60 -0
- package/.claude/skills/ccw-chain/phases/workflow-test-fix/phases/02-test-context-gather.md +493 -0
- package/.claude/skills/ccw-chain/phases/workflow-test-fix/phases/03-test-concept-enhanced.md +150 -0
- package/.claude/skills/ccw-chain/phases/workflow-test-fix/phases/04-test-task-generate.md +346 -0
- package/.claude/skills/ccw-chain/phases/workflow-test-fix/phases/05-test-cycle-execute.md +538 -0
- package/.claude/skills/ccw-chain/specs/auto-mode.md +47 -0
- package/.claude/skills/ccw-chain/specs/intent-patterns.md +60 -0
- package/.claude/skills/chain-loader/SKILL.md +78 -0
- package/.claude/skills/chain-loader/phases/01-analyze-skill.md +53 -0
- package/.claude/skills/chain-loader/phases/02-design-graph.md +73 -0
- package/.claude/skills/chain-loader/phases/03-generate-validate.md +75 -0
- package/.claude/skills/chain-loader/specs/chain-schema.md +99 -0
- package/.claude/skills/chain-loader/specs/design-patterns.md +99 -0
- package/.claude/skills/chain-loader/templates/chain-json.md +63 -0
- package/.claude/skills/review-cycle/phases/review-module.md +764 -764
- package/.claude/skills/review-cycle/phases/review-session.md +775 -775
- package/.claude/skills/workflow-multi-cli-plan/SKILL.md +2 -2
- package/.claude/skills/workflow-plan/phases/03-conflict-resolution.md +422 -422
- package/.claude/skills/workflow-plan/phases/05-plan-verify.md +395 -395
- package/.claude/skills/workflow-tdd-plan/phases/02-context-gathering.md +407 -407
- package/.claude/skills/workflow-tdd-plan/phases/04-conflict-resolution.md +426 -426
- package/.claude/skills/workflow-test-fix/phases/02-test-context-gather.md +493 -493
- package/.codex/skills/brainstorm/SKILL.md +3 -3
- package/.codex/skills/clean/SKILL.md +3 -3
- package/.codex/skills/issue-discover/SKILL.md +13 -13
- package/.codex/skills/issue-discover/phases/02-discover.md +4 -4
- package/.codex/skills/issue-discover/phases/03-discover-by-prompt.md +3 -3
- package/.codex/skills/parallel-dev-cycle/SKILL.md +4 -4
- package/.codex/skills/parallel-dev-cycle/phases/02-agent-execution.md +6 -6
- package/.codex/skills/parallel-dev-cycle/phases/03-result-aggregation.md +10 -10
- package/.codex/skills/review-cycle/SKILL.md +10 -10
- package/.codex/skills/review-cycle/phases/02-parallel-review.md +6 -6
- package/.codex/skills/review-cycle/phases/04-iterative-deep-dive.md +4 -4
- package/.codex/skills/review-cycle/phases/07-fix-parallel-planning.md +4 -4
- package/.codex/skills/review-cycle/phases/08-fix-execution.md +2 -2
- package/.codex/skills/roadmap-with-file/SKILL.md +14 -14
- package/.codex/skills/spec-generator/README.md +1 -1
- package/.codex/skills/spec-generator/SKILL.md +184 -88
- package/.codex/skills/spec-generator/phases/01-5-requirement-clarification.md +4 -7
- package/.codex/skills/spec-generator/phases/01-discovery.md +30 -11
- package/.codex/skills/spec-generator/phases/02-product-brief.md +2 -5
- package/.codex/skills/spec-generator/phases/03-requirements.md +4 -6
- package/.codex/skills/spec-generator/phases/04-architecture.md +4 -6
- package/.codex/skills/spec-generator/phases/05-epics-stories.md +4 -6
- package/.codex/skills/spec-generator/phases/06-5-auto-fix.md +4 -5
- package/.codex/skills/spec-generator/phases/06-readiness-check.md +8 -8
- package/.codex/skills/spec-generator/phases/07-issue-export.md +2 -2
- package/.codex/skills/spec-setup/SKILL.md +4 -4
- package/.codex/skills/workflow-plan/SKILL.md +6 -6
- package/.codex/skills/workflow-tdd-plan/SKILL.md +5 -5
- package/.codex/skills/workflow-test-fix-cycle/SKILL.md +19 -19
- package/.codex/skills/workflow-test-fix-cycle/phases/01-test-fix-gen.md +5 -5
- package/.codex/skills/workflow-test-fix-cycle/phases/02-test-cycle-execute.md +5 -5
- package/README.md +14 -0
- package/ccw/dist/core/routes/litellm-api-routes.d.ts.map +1 -1
- package/ccw/dist/core/routes/litellm-api-routes.js +0 -23
- package/ccw/dist/core/routes/litellm-api-routes.js.map +1 -1
- package/ccw/dist/tools/chain-loader.d.ts +10 -0
- package/ccw/dist/tools/chain-loader.d.ts.map +1 -0
- package/ccw/dist/tools/chain-loader.js +642 -0
- package/ccw/dist/tools/chain-loader.js.map +1 -0
- package/ccw/dist/tools/index.d.ts.map +1 -1
- package/ccw/dist/tools/index.js +2 -0
- package/ccw/dist/tools/index.js.map +1 -1
- package/ccw/dist/tools/json-builder.js +20 -0
- package/ccw/dist/tools/json-builder.js.map +1 -1
- package/ccw/dist/types/chain-types.d.ts +72 -0
- package/ccw/dist/types/chain-types.d.ts.map +1 -0
- package/ccw/dist/types/chain-types.js +5 -0
- package/ccw/dist/types/chain-types.js.map +1 -0
- package/ccw/frontend/dist/assets/{AlertDialog-BjP1ydDR.js → AlertDialog-exlTDW81.js} +3 -3
- package/ccw/frontend/dist/assets/{AlertDialog-BjP1ydDR.js.map → AlertDialog-exlTDW81.js.map} +1 -1
- package/ccw/frontend/dist/assets/{AnalysisPage-CAX3xqMf.js → AnalysisPage-cgV9LfAI.js} +2 -2
- package/ccw/frontend/dist/assets/{AnalysisPage-CAX3xqMf.js.map → AnalysisPage-cgV9LfAI.js.map} +1 -1
- package/ccw/frontend/dist/assets/{ApiSettingsPage-CtWlmztq.js → ApiSettingsPage-Dk5jJdWt.js} +2 -2
- package/ccw/frontend/dist/assets/{ApiSettingsPage-CtWlmztq.js.map → ApiSettingsPage-Dk5jJdWt.js.map} +1 -1
- package/ccw/frontend/dist/assets/{CliModeToggle-hR4a-eLX.js → CliModeToggle-Be9xsPiv.js} +2 -2
- package/ccw/frontend/dist/assets/{CliModeToggle-hR4a-eLX.js.map → CliModeToggle-Be9xsPiv.js.map} +1 -1
- package/ccw/frontend/dist/assets/{CliSessionSharePage-DzNPkFN9.js → CliSessionSharePage-Bh9jBtPI.js} +2 -2
- package/ccw/frontend/dist/assets/{CliSessionSharePage-DzNPkFN9.js.map → CliSessionSharePage-Bh9jBtPI.js.map} +1 -1
- package/ccw/frontend/dist/assets/{CliViewerPage-BPEGN4TT.js → CliViewerPage-BrE-oyEq.js} +2 -2
- package/ccw/frontend/dist/assets/{CliViewerPage-BPEGN4TT.js.map → CliViewerPage-BrE-oyEq.js.map} +1 -1
- package/ccw/frontend/dist/assets/{CodexLensPage-Cf0r2RHY.js → CodexLensPage-Cd3nrC93.js} +2 -2
- package/ccw/frontend/dist/assets/{CodexLensPage-Cf0r2RHY.js.map → CodexLensPage-Cd3nrC93.js.map} +1 -1
- package/ccw/frontend/dist/assets/{Collapsible-DEm1rJ4h.js → Collapsible-DXFl3VKF.js} +2 -2
- package/ccw/frontend/dist/assets/{Collapsible-DEm1rJ4h.js.map → Collapsible-DXFl3VKF.js.map} +1 -1
- package/ccw/frontend/dist/assets/{CommandsManagerPage-BpeWw8HO.js → CommandsManagerPage-IV8zpjgX.js} +2 -2
- package/ccw/frontend/dist/assets/{CommandsManagerPage-BpeWw8HO.js.map → CommandsManagerPage-IV8zpjgX.js.map} +1 -1
- package/ccw/frontend/dist/assets/{DeepWikiPage-BEsmh2vF.js → DeepWikiPage-CpDxtmRX.js} +2 -2
- package/ccw/frontend/dist/assets/{DeepWikiPage-BEsmh2vF.js.map → DeepWikiPage-CpDxtmRX.js.map} +1 -1
- package/ccw/frontend/dist/assets/{EndpointsPage-B30SFdtU.js → EndpointsPage-BchjWe7s.js} +2 -2
- package/ccw/frontend/dist/assets/{EndpointsPage-B30SFdtU.js.map → EndpointsPage-BchjWe7s.js.map} +1 -1
- package/ccw/frontend/dist/assets/{ExplorerPage-BVvMpg1O.js → ExplorerPage-CbWvaJ0y.js} +2 -2
- package/ccw/frontend/dist/assets/{ExplorerPage-BVvMpg1O.js.map → ExplorerPage-CbWvaJ0y.js.map} +1 -1
- package/ccw/frontend/dist/assets/{FixSessionPage-CL73dHbh.js → FixSessionPage-YMjVRiCk.js} +2 -2
- package/ccw/frontend/dist/assets/{FixSessionPage-CL73dHbh.js.map → FixSessionPage-YMjVRiCk.js.map} +1 -1
- package/ccw/frontend/dist/assets/{FloatingFileBrowser-BL-28lMZ.js → FloatingFileBrowser-JW2ehYY_.js} +2 -2
- package/ccw/frontend/dist/assets/{FloatingFileBrowser-BL-28lMZ.js.map → FloatingFileBrowser-JW2ehYY_.js.map} +1 -1
- package/ccw/frontend/dist/assets/{FloatingPanel-BzZDciHZ.js → FloatingPanel-BtqzqDVq.js} +2 -2
- package/ccw/frontend/dist/assets/{FloatingPanel-BzZDciHZ.js.map → FloatingPanel-BtqzqDVq.js.map} +1 -1
- package/ccw/frontend/dist/assets/{GraphExplorerPage-CDp6-d8P.js → GraphExplorerPage-BsJL_W4d.js} +3 -3
- package/ccw/frontend/dist/assets/{GraphExplorerPage-CDp6-d8P.js.map → GraphExplorerPage-BsJL_W4d.js.map} +1 -1
- package/ccw/frontend/dist/assets/{HistoryPage-fZY_7O9n.js → HistoryPage-BuWpQ7k5.js} +2 -2
- package/ccw/frontend/dist/assets/{HistoryPage-fZY_7O9n.js.map → HistoryPage-BuWpQ7k5.js.map} +1 -1
- package/ccw/frontend/dist/assets/{HookManagerPage-4LJeC9bq.js → HookManagerPage-D0BtMIWy.js} +2 -2
- package/ccw/frontend/dist/assets/{HookManagerPage-4LJeC9bq.js.map → HookManagerPage-D0BtMIWy.js.map} +1 -1
- package/ccw/frontend/dist/assets/{InstallationsPage-Bpigrbhw.js → InstallationsPage-C7dwsAKG.js} +2 -2
- package/ccw/frontend/dist/assets/{InstallationsPage-Bpigrbhw.js.map → InstallationsPage-C7dwsAKG.js.map} +1 -1
- package/ccw/frontend/dist/assets/{IssueHubPage-BP0zJc1R.js → IssueHubPage-D0nCNaeB.js} +2 -2
- package/ccw/frontend/dist/assets/{IssueHubPage-BP0zJc1R.js.map → IssueHubPage-D0nCNaeB.js.map} +1 -1
- package/ccw/frontend/dist/assets/{LiteTasksPage-CSt2oVKQ.js → LiteTasksPage-B5c2Kb9r.js} +3 -3
- package/ccw/frontend/dist/assets/{LiteTasksPage-CSt2oVKQ.js.map → LiteTasksPage-B5c2Kb9r.js.map} +1 -1
- package/ccw/frontend/dist/assets/{McpManagerPage-B-xaMA0w.js → McpManagerPage-C-S5CehM.js} +2 -2
- package/ccw/frontend/dist/assets/{McpManagerPage-B-xaMA0w.js.map → McpManagerPage-C-S5CehM.js.map} +1 -1
- package/ccw/frontend/dist/assets/{MemoryPage-CJqo_7DY.js → MemoryPage-P_B0JVUQ.js} +2 -2
- package/ccw/frontend/dist/assets/{MemoryPage-CJqo_7DY.js.map → MemoryPage-P_B0JVUQ.js.map} +1 -1
- package/ccw/frontend/dist/assets/{NotFoundPage-ibZeQA-Y.js → NotFoundPage-S4Jn9LUE.js} +2 -2
- package/ccw/frontend/dist/assets/{NotFoundPage-ibZeQA-Y.js.map → NotFoundPage-S4Jn9LUE.js.map} +1 -1
- package/ccw/frontend/dist/assets/{OrchestratorPage-DgJ4ctPQ.js → OrchestratorPage-C2Zlr7AC.js} +2 -2
- package/ccw/frontend/dist/assets/{OrchestratorPage-DgJ4ctPQ.js.map → OrchestratorPage-C2Zlr7AC.js.map} +1 -1
- package/ccw/frontend/dist/assets/{ProjectOverviewPage-Cit0Yq0D.js → ProjectOverviewPage-CMVfz8s5.js} +2 -2
- package/ccw/frontend/dist/assets/{ProjectOverviewPage-Cit0Yq0D.js.map → ProjectOverviewPage-CMVfz8s5.js.map} +1 -1
- package/ccw/frontend/dist/assets/{PromptHistoryPage-Ce1HDIK0.js → PromptHistoryPage-YEMjFARX.js} +3 -3
- package/ccw/frontend/dist/assets/{PromptHistoryPage-Ce1HDIK0.js.map → PromptHistoryPage-YEMjFARX.js.map} +1 -1
- package/ccw/frontend/dist/assets/{ReviewSessionPage-J1KikNrk.js → ReviewSessionPage-DnTm55nG.js} +2 -2
- package/ccw/frontend/dist/assets/{ReviewSessionPage-J1KikNrk.js.map → ReviewSessionPage-DnTm55nG.js.map} +1 -1
- package/ccw/frontend/dist/assets/{RulesManagerPage-CdBjTmth.js → RulesManagerPage-CUwebtO2.js} +2 -2
- package/ccw/frontend/dist/assets/{RulesManagerPage-CdBjTmth.js.map → RulesManagerPage-CUwebtO2.js.map} +1 -1
- package/ccw/frontend/dist/assets/{SessionDetailPage-B9ZK7LvX.js → SessionDetailPage-0qyH1Z5P.js} +2 -2
- package/ccw/frontend/dist/assets/{SessionDetailPage-B9ZK7LvX.js.map → SessionDetailPage-0qyH1Z5P.js.map} +1 -1
- package/ccw/frontend/dist/assets/{SessionsPage-CW_nS5UR.js → SessionsPage-BpgP4087.js} +2 -2
- package/ccw/frontend/dist/assets/{SessionsPage-CW_nS5UR.js.map → SessionsPage-BpgP4087.js.map} +1 -1
- package/ccw/frontend/dist/assets/SettingsPage-C3SJajeT.js +150 -0
- package/ccw/frontend/dist/assets/SettingsPage-C3SJajeT.js.map +1 -0
- package/ccw/frontend/dist/assets/SkillsManagerPage-vD9PTsmy.js +7 -0
- package/ccw/frontend/dist/assets/SkillsManagerPage-vD9PTsmy.js.map +1 -0
- package/ccw/frontend/dist/assets/{SpecsSettingsPage-DJpi9XQL.js → SpecsSettingsPage-DT-yTVkD.js} +4 -4
- package/ccw/frontend/dist/assets/{SpecsSettingsPage-DJpi9XQL.js.map → SpecsSettingsPage-DT-yTVkD.js.map} +1 -1
- package/ccw/frontend/dist/assets/{Switch-Ac6Ov7uy.js → Switch-CYSPdqWk.js} +2 -2
- package/ccw/frontend/dist/assets/{Switch-Ac6Ov7uy.js.map → Switch-CYSPdqWk.js.map} +1 -1
- package/ccw/frontend/dist/assets/{TabsNavigation-DZAAspqR.js → TabsNavigation-CPh6Zor1.js} +2 -2
- package/ccw/frontend/dist/assets/{TabsNavigation-DZAAspqR.js.map → TabsNavigation-CPh6Zor1.js.map} +1 -1
- package/ccw/frontend/dist/assets/{TaskDrawer-BJkwfhIZ.js → TaskDrawer-Ds-8830B.js} +2 -2
- package/ccw/frontend/dist/assets/{TaskDrawer-BJkwfhIZ.js.map → TaskDrawer-Ds-8830B.js.map} +1 -1
- package/ccw/frontend/dist/assets/{TeamPage-BJgjxBgb.js → TeamPage-CJODUxBk.js} +2 -2
- package/ccw/frontend/dist/assets/{TeamPage-BJgjxBgb.js.map → TeamPage-CJODUxBk.js.map} +1 -1
- package/ccw/frontend/dist/assets/{TerminalDashboardPage-D1WekoOy.js → TerminalDashboardPage-Cn3fGUuO.js} +3 -3
- package/ccw/frontend/dist/assets/{TerminalDashboardPage-D1WekoOy.js.map → TerminalDashboardPage-Cn3fGUuO.js.map} +1 -1
- package/ccw/frontend/dist/assets/{archive-DxemgIhF.js → archive-CjwVpw6k.js} +2 -2
- package/ccw/frontend/dist/assets/{archive-DxemgIhF.js.map → archive-CjwVpw6k.js.map} +1 -1
- package/ccw/frontend/dist/assets/{archive-restore-CjS83f1V.js → archive-restore-2vZa9Ic3.js} +2 -2
- package/ccw/frontend/dist/assets/{archive-restore-CjS83f1V.js.map → archive-restore-2vZa9Ic3.js.map} +1 -1
- package/ccw/frontend/dist/assets/{arrow-right-B5PUcn8I.js → arrow-right-CUU5XDgT.js} +2 -2
- package/ccw/frontend/dist/assets/{arrow-right-B5PUcn8I.js.map → arrow-right-CUU5XDgT.js.map} +1 -1
- package/ccw/frontend/dist/assets/{bookmark-plus-DCc9aPbb.js → bookmark-plus-Cc3nKRZ5.js} +2 -2
- package/ccw/frontend/dist/assets/{bookmark-plus-DCc9aPbb.js.map → bookmark-plus-Cc3nKRZ5.js.map} +1 -1
- package/ccw/frontend/dist/assets/{bot-DOwFtzak.js → bot-BwpSRDUa.js} +2 -2
- package/ccw/frontend/dist/assets/{bot-DOwFtzak.js.map → bot-BwpSRDUa.js.map} +1 -1
- package/ccw/frontend/dist/assets/{braces-96qH3aFh.js → braces-DBzUW1XC.js} +2 -2
- package/ccw/frontend/dist/assets/{braces-96qH3aFh.js.map → braces-DBzUW1XC.js.map} +1 -1
- package/ccw/frontend/dist/assets/{circle-stop-CCxSuil1.js → circle-stop-CGNNsjvE.js} +2 -2
- package/ccw/frontend/dist/assets/{circle-stop-CCxSuil1.js.map → circle-stop-CGNNsjvE.js.map} +1 -1
- package/ccw/frontend/dist/assets/{cpu-CZNSJFdq.js → cpu-D27G86Ul.js} +2 -2
- package/ccw/frontend/dist/assets/{cpu-CZNSJFdq.js.map → cpu-D27G86Ul.js.map} +1 -1
- package/ccw/frontend/dist/assets/{ellipsis-vertical-h8xtvw2_.js → ellipsis-vertical-C1Ij47Yz.js} +2 -2
- package/ccw/frontend/dist/assets/{ellipsis-vertical-h8xtvw2_.js.map → ellipsis-vertical-C1Ij47Yz.js.map} +1 -1
- package/ccw/frontend/dist/assets/{eye-D3NY0bm6.js → eye-C6MOB7Au.js} +2 -2
- package/ccw/frontend/dist/assets/{eye-D3NY0bm6.js.map → eye-C6MOB7Au.js.map} +1 -1
- package/ccw/frontend/dist/assets/{eye-off-Cy2vkc8p.js → eye-off-BxfBlZ26.js} +2 -2
- package/ccw/frontend/dist/assets/{eye-off-Cy2vkc8p.js.map → eye-off-BxfBlZ26.js.map} +1 -1
- package/ccw/frontend/dist/assets/{file-json-Bzq3U1Mx.js → file-json-NI237wA-.js} +2 -2
- package/ccw/frontend/dist/assets/{file-json-Bzq3U1Mx.js.map → file-json-NI237wA-.js.map} +1 -1
- package/ccw/frontend/dist/assets/{file-text-DwuwPDPi.js → file-text-Byn2_2v6.js} +2 -2
- package/ccw/frontend/dist/assets/{file-text-DwuwPDPi.js.map → file-text-Byn2_2v6.js.map} +1 -1
- package/ccw/frontend/dist/assets/{filter-q9g-bknU.js → filter-D-7PhZjx.js} +2 -2
- package/ccw/frontend/dist/assets/{filter-q9g-bknU.js.map → filter-D-7PhZjx.js.map} +1 -1
- package/ccw/frontend/dist/assets/{folder-CL6vb42J.js → folder-BoAsK_FL.js} +2 -2
- package/ccw/frontend/dist/assets/{folder-CL6vb42J.js.map → folder-BoAsK_FL.js.map} +1 -1
- package/ccw/frontend/dist/assets/{gauge-BkrcQBly.js → gauge-DCSxJIS4.js} +2 -2
- package/ccw/frontend/dist/assets/{gauge-BkrcQBly.js.map → gauge-DCSxJIS4.js.map} +1 -1
- package/ccw/frontend/dist/assets/{globe-BQbwyNeV.js → globe-CHS3prza.js} +2 -2
- package/ccw/frontend/dist/assets/{globe-BQbwyNeV.js.map → globe-CHS3prza.js.map} +1 -1
- package/ccw/frontend/dist/assets/{grid-3x3-x5_7DrN7.js → grid-3x3-D7K35U7S.js} +2 -2
- package/ccw/frontend/dist/assets/{grid-3x3-x5_7DrN7.js.map → grid-3x3-D7K35U7S.js.map} +1 -1
- package/ccw/frontend/dist/assets/{hard-drive-DTyWXwzf.js → hard-drive-eq9xE07G.js} +2 -2
- package/ccw/frontend/dist/assets/{hard-drive-DTyWXwzf.js.map → hard-drive-eq9xE07G.js.map} +1 -1
- package/ccw/frontend/dist/assets/{hash-80O0kJO7.js → hash-C1DMpBua.js} +2 -2
- package/ccw/frontend/dist/assets/{hash-80O0kJO7.js.map → hash-C1DMpBua.js.map} +1 -1
- package/ccw/frontend/dist/assets/{history-DDlN2Bwa.js → history-Di5SBCY-.js} +2 -2
- package/ccw/frontend/dist/assets/{history-DDlN2Bwa.js.map → history-Di5SBCY-.js.map} +1 -1
- package/ccw/frontend/dist/assets/{index-mbeo62f8.js → index--_R7COnA.js} +2 -2
- package/ccw/frontend/dist/assets/{index-mbeo62f8.js.map → index--_R7COnA.js.map} +1 -1
- package/ccw/frontend/dist/assets/{index-rLgoBCfV.js → index-BUol9HDD.js} +3 -3
- package/ccw/frontend/dist/assets/{index-rLgoBCfV.js.map → index-BUol9HDD.js.map} +1 -1
- package/ccw/frontend/dist/assets/{index-Bs80iCX0.js → index-CT9oykfw.js} +2 -2
- package/ccw/frontend/dist/assets/{index-Bs80iCX0.js.map → index-CT9oykfw.js.map} +1 -1
- package/ccw/frontend/dist/assets/{index-B9A3Hnrk.js → index-Ddwvf87H.js} +2 -2
- package/ccw/frontend/dist/assets/{index-B9A3Hnrk.js.map → index-Ddwvf87H.js.map} +1 -1
- package/ccw/frontend/dist/assets/{layout-grid-C1niOWJx.js → layout-grid-LiX0qZbN.js} +2 -2
- package/ccw/frontend/dist/assets/{layout-grid-C1niOWJx.js.map → layout-grid-LiX0qZbN.js.map} +1 -1
- package/ccw/frontend/dist/assets/{lightbulb-BTmI7SUg.js → lightbulb-CL3DVEwb.js} +2 -2
- package/ccw/frontend/dist/assets/{lightbulb-BTmI7SUg.js.map → lightbulb-CL3DVEwb.js.map} +1 -1
- package/ccw/frontend/dist/assets/{link-2-CB9HKeuZ.js → link-2-CC5cFeq6.js} +2 -2
- package/ccw/frontend/dist/assets/{link-2-CB9HKeuZ.js.map → link-2-CC5cFeq6.js.map} +1 -1
- package/ccw/frontend/dist/assets/{link-koEYiemK.js → link-ngFQ9bs0.js} +2 -2
- package/ccw/frontend/dist/assets/{link-koEYiemK.js.map → link-ngFQ9bs0.js.map} +1 -1
- package/ccw/frontend/dist/assets/{list-v2_GaLdC.js → list-BEU6I0KK.js} +2 -2
- package/ccw/frontend/dist/assets/{list-v2_GaLdC.js.map → list-BEU6I0KK.js.map} +1 -1
- package/ccw/frontend/dist/assets/{map-pin-BQNfAqG_.js → map-pin-BWZdLA6y.js} +2 -2
- package/ccw/frontend/dist/assets/{map-pin-BQNfAqG_.js.map → map-pin-BWZdLA6y.js.map} +1 -1
- package/ccw/frontend/dist/assets/{messages-square-Dzq5LGg9.js → messages-square-K6_Chm7n.js} +2 -2
- package/ccw/frontend/dist/assets/{messages-square-Dzq5LGg9.js.map → messages-square-K6_Chm7n.js.map} +1 -1
- package/ccw/frontend/dist/assets/{minimize-2-CtkoJXcz.js → minimize-2-CWkphauf.js} +2 -2
- package/ccw/frontend/dist/assets/{minimize-2-CtkoJXcz.js.map → minimize-2-CWkphauf.js.map} +1 -1
- package/ccw/frontend/dist/assets/{package-CH3smL37.js → package-DrNgkamn.js} +2 -2
- package/ccw/frontend/dist/assets/{package-CH3smL37.js.map → package-DrNgkamn.js.map} +1 -1
- package/ccw/frontend/dist/assets/{plug-CZ0aL_yF.js → plug-CMo3sw5_.js} +2 -2
- package/ccw/frontend/dist/assets/{plug-CZ0aL_yF.js.map → plug-CMo3sw5_.js.map} +1 -1
- package/ccw/frontend/dist/assets/{power-F2A_J4l6.js → power-DppNTW5e.js} +2 -2
- package/ccw/frontend/dist/assets/{power-F2A_J4l6.js.map → power-DppNTW5e.js.map} +1 -1
- package/ccw/frontend/dist/assets/{save-Byxot0YU.js → save-CD8aPMbZ.js} +2 -2
- package/ccw/frontend/dist/assets/{save-Byxot0YU.js.map → save-CD8aPMbZ.js.map} +1 -1
- package/ccw/frontend/dist/assets/{send-JjqhUkpw.js → send-B4z90fQD.js} +2 -2
- package/ccw/frontend/dist/assets/{send-JjqhUkpw.js.map → send-B4z90fQD.js.map} +1 -1
- package/ccw/frontend/dist/assets/{settings-2--SuN9rAt.js → settings-2-CAKRU_QC.js} +2 -2
- package/ccw/frontend/dist/assets/{settings-2--SuN9rAt.js.map → settings-2-CAKRU_QC.js.map} +1 -1
- package/ccw/frontend/dist/assets/{square-check-big-BbngGB2h.js → square-check-big-KhI3HrzX.js} +2 -2
- package/ccw/frontend/dist/assets/{square-check-big-BbngGB2h.js.map → square-check-big-KhI3HrzX.js.map} +1 -1
- package/ccw/frontend/dist/assets/{square-pen-CgrHgZSl.js → square-pen-BtdGIpuq.js} +2 -2
- package/ccw/frontend/dist/assets/{square-pen-CgrHgZSl.js.map → square-pen-BtdGIpuq.js.map} +1 -1
- package/ccw/frontend/dist/assets/{star-BU3TQr7Z.js → star-ZoBUkXoD.js} +2 -2
- package/ccw/frontend/dist/assets/{star-BU3TQr7Z.js.map → star-ZoBUkXoD.js.map} +1 -1
- package/ccw/frontend/dist/assets/{style-CKs7nnn3.js → style-CltxQP-P.js} +2 -2
- package/ccw/frontend/dist/assets/{style-CKs7nnn3.js.map → style-CltxQP-P.js.map} +1 -1
- package/ccw/frontend/dist/assets/{target-DW5tsDW6.js → target-C32OUSGf.js} +2 -2
- package/ccw/frontend/dist/assets/{target-DW5tsDW6.js.map → target-C32OUSGf.js.map} +1 -1
- package/ccw/frontend/dist/assets/{test-tube-BHm7w3ON.js → test-tube-0IxoyAVZ.js} +2 -2
- package/ccw/frontend/dist/assets/{test-tube-BHm7w3ON.js.map → test-tube-0IxoyAVZ.js.map} +1 -1
- package/ccw/frontend/dist/assets/{upload-DYR7PWwt.js → upload-4eKCkyBn.js} +2 -2
- package/ccw/frontend/dist/assets/{upload-DYR7PWwt.js.map → upload-4eKCkyBn.js.map} +1 -1
- package/ccw/frontend/dist/assets/{useApiSettings-D0TVgQD_.js → useApiSettings-zLTUWqhi.js} +2 -2
- package/ccw/frontend/dist/assets/{useApiSettings-D0TVgQD_.js.map → useApiSettings-zLTUWqhi.js.map} +1 -1
- package/ccw/frontend/dist/assets/{useCli-DfY8mAP8.js → useCli-BtN2vpOX.js} +2 -2
- package/ccw/frontend/dist/assets/{useCli-DfY8mAP8.js.map → useCli-BtN2vpOX.js.map} +1 -1
- package/ccw/frontend/dist/assets/{useCommands-CGusDp0F.js → useCommands-_spj49qL.js} +2 -2
- package/ccw/frontend/dist/assets/{useCommands-CGusDp0F.js.map → useCommands-_spj49qL.js.map} +1 -1
- package/ccw/frontend/dist/assets/{useDebounce-CIwh0fF1.js → useDebounce-Bm9KFZvd.js} +2 -2
- package/ccw/frontend/dist/assets/{useDebounce-CIwh0fF1.js.map → useDebounce-Bm9KFZvd.js.map} +1 -1
- package/ccw/frontend/dist/assets/{useFileExplorer-FMyFv39K.js → useFileExplorer-DOmpm6v9.js} +2 -2
- package/ccw/frontend/dist/assets/{useFileExplorer-FMyFv39K.js.map → useFileExplorer-DOmpm6v9.js.map} +1 -1
- package/ccw/frontend/dist/assets/{useLocale-B2qhsoTb.js → useLocale-D2rj4rea.js} +2 -2
- package/ccw/frontend/dist/assets/{useLocale-B2qhsoTb.js.map → useLocale-D2rj4rea.js.map} +1 -1
- package/ccw/frontend/dist/assets/{useSkills-cxKXMBm3.js → useSkills-OskEpomF.js} +3 -3
- package/ccw/frontend/dist/assets/{useSkills-cxKXMBm3.js.map → useSkills-OskEpomF.js.map} +1 -1
- package/ccw/frontend/dist/assets/{useSystemSettings-B-xUT_z-.js → useSystemSettings-BjMgsNSF.js} +2 -2
- package/ccw/frontend/dist/assets/{useSystemSettings-B-xUT_z-.js.map → useSystemSettings-BjMgsNSF.js.map} +1 -1
- package/ccw/frontend/dist/assets/{wand-sparkles-DZV_3lPr.js → wand-sparkles-CLhyYWa7.js} +2 -2
- package/ccw/frontend/dist/assets/{wand-sparkles-DZV_3lPr.js.map → wand-sparkles-CLhyYWa7.js.map} +1 -1
- package/ccw/frontend/dist/index.html +1 -1
- package/ccw/scripts/prepublish-clean.mjs +0 -1
- package/package.json +1 -3
- package/ccw/frontend/dist/assets/SettingsPage-B2PYzSoO.js +0 -150
- package/ccw/frontend/dist/assets/SettingsPage-B2PYzSoO.js.map +0 -1
- package/ccw/frontend/dist/assets/SkillsManagerPage-CTnWrrwp.js +0 -7
- package/ccw/frontend/dist/assets/SkillsManagerPage-CTnWrrwp.js.map +0 -1
- package/ccw-litellm/README.md +0 -180
- package/ccw-litellm/pyproject.toml +0 -35
- package/ccw-litellm/src/ccw_litellm/__init__.py +0 -47
- package/ccw-litellm/src/ccw_litellm/cli.py +0 -108
- package/ccw-litellm/src/ccw_litellm/clients/__init__.py +0 -12
- package/ccw-litellm/src/ccw_litellm/clients/litellm_embedder.py +0 -270
- package/ccw-litellm/src/ccw_litellm/clients/litellm_llm.py +0 -198
- package/ccw-litellm/src/ccw_litellm/config/__init__.py +0 -22
- package/ccw-litellm/src/ccw_litellm/config/loader.py +0 -343
- package/ccw-litellm/src/ccw_litellm/config/models.py +0 -162
- package/ccw-litellm/src/ccw_litellm/interfaces/__init__.py +0 -14
- package/ccw-litellm/src/ccw_litellm/interfaces/embedder.py +0 -52
- package/ccw-litellm/src/ccw_litellm/interfaces/llm.py +0 -45
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-BUol9HDD.js","assets/index-BoqylFO4.css"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{O as ge,bw as Ne,r,ab as Os,u as K,cp as Be,j as e,al as Hs,cq as Bs,cr as Te,cs as Je,ct as Rs,cu as oe,cv as $s,cw as zs,cx as _s,cy as Vs,aq as qs,ar as Ws,as as Ye,c as z,at as Gs,au as Ks,C as Q,B as X,bq as ie,e as j,X as ae,cz as Re,ap as Pe,cA as Js,cB as Ys,cC as $e,aV as as,cD as Qs,I as D,_ as R,R as ue,a7 as ve,cE as Xs,bu as Qe,U as Zs,l as et,cF as st,cG as tt,cH as ze,ao as at,cI as nt,bf as Ae,cJ as Me,cK as rt,cL as it,cM as lt,S as ot,cN as ct,cO as Xe,aw as _e,cP as dt,aP as mt,an as ut,cQ as xt,i as ht,F as gt,N as ft,aU as pt,bY as bt}from"./index-BUol9HDD.js";import{A as jt,a as Nt,b as vt,c as yt,d as wt,e as kt,f as Ct,g as St}from"./AlertDialog-exlTDW81.js";import{u as Tt,a as Mt,b as Et,c as Pt,d as Ft,e as Dt,f as Lt,g as Ut,h as It,i as At,j as Ot,k as Ht,l as Bt}from"./useSystemSettings-BjMgsNSF.js";import{u as Rt}from"./useLocale-D2rj4rea.js";import{T as $t}from"./test-tube-0IxoyAVZ.js";import{L as zt}from"./link-ngFQ9bs0.js";import{S as _t}from"./send-B4z90fQD.js";import{E as fe}from"./eye-off-BxfBlZ26.js";import{E as pe}from"./eye-C6MOB7Au.js";import{S as Fe}from"./save-CD8aPMbZ.js";import{B as Vt}from"./bot-BwpSRDUa.js";import{S as ns}from"./settings-2-CAKRU_QC.js";import{u as qt}from"./useDebounce-Bm9KFZvd.js";import{C as rs}from"./cpu-D27G86Ul.js";import{U as Wt}from"./upload-4eKCkyBn.js";import{P as Gt}from"./package-DrNgkamn.js";import{F as Kt}from"./folder-BoAsK_FL.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 Jt=ge("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 is=ge("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 ls=ge("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 Yt=ge("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 Qt=ge("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 Xt=ge("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"}]]);async function Zt(s,t=1,n=20){const l=new URLSearchParams({query:s,page:String(t),per_page:String(n)});return Ne(`/api/unsplash/search?${l}`)}async function ea(s){return Ne("/api/background/upload",{method:"POST",headers:{"Content-Type":s.type,"X-Filename":encodeURIComponent(s.name)},body:s})}async function sa(s){await Ne("/api/unsplash/download",{method:"POST",body:JSON.stringify({downloadLocation:s})})}function ta(s,t=1,n=20){const[l,c]=r.useState(s);return r.useEffect(()=>{const m=setTimeout(()=>{c(s)},500);return()=>clearTimeout(m)},[s]),Os({queryKey:["unsplash-search",l,t,n],queryFn:()=>Zt(l,t,n),enabled:l.trim().length>0,staleTime:300*1e3,retry:1})}const aa=[{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 na(){const{formatMessage:s}=K(),{backgroundConfig:t,setBackgroundMode:n,setBackgroundImage:l,updateBackgroundEffect:c}=Be(),[m,x]=r.useState(""),[p,N]=r.useState(1),[f,P]=r.useState(""),[w,F]=r.useState(!1),[u,v]=r.useState(null),k=r.useRef(null),{data:h,isLoading:$,isError:C,error:M}=ta(m,p),H=t.mode!=="gradient-only",W=r.useCallback(async i=>{l(i.regularUrl,{photographerName:i.photographer,photographerUrl:i.photographerUrl,photoUrl:i.photoUrl}),sa(i.downloadLocation).catch(()=>{})},[l]),A=r.useCallback(()=>{f.trim()&&(l(f.trim(),null),P(""))},[f,l]),b=r.useCallback(()=>{l(null,null)},[l]),y=r.useCallback(async i=>{var d;const g=(d=i.target.files)==null?void 0:d[0];if(g){if(i.target.value="",v(null),g.size>10*1024*1024){v(s({id:"theme.background.fileTooLarge"}));return}if(!g.type.startsWith("image/")||!["image/jpeg","image/png","image/webp","image/gif"].includes(g.type)){v(s({id:"theme.background.invalidType"}));return}F(!0);try{const E=await ea(g);l(E.url,null)}catch(E){v(E.message||s({id:"theme.background.uploadError"}))}finally{F(!1)}}},[s,l]);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:aa.map(({value:i,labelId:g})=>e.jsx("button",{onClick:()=>n(i),role:"radio","aria-checked":t.mode===i,className:`
|
|
33
|
+
flex-1 px-3 py-2 rounded-lg text-xs font-medium
|
|
34
|
+
transition-all duration-200 border-2
|
|
35
|
+
${t.mode===i?"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})},i))}),H&&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:b,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:m,onChange:i=>{x(i.target.value),N(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`}),$&&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"})}),C&&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(i=>e.jsx("button",{onClick:()=>W(i),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===i.regularUrl?"border-accent ring-2 ring-accent":"border-transparent"}
|
|
42
|
+
`,children:e.jsx("img",{src:i.thumbUrl,alt:`Photo by ${i.photographer}`,className:"w-full h-20 object-cover",loading:"lazy"})},i.id))}),h.totalPages>1&&e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("button",{onClick:()=>N(i=>Math.max(1,i-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:()=>N(i=>Math.min(h.totalPages,i+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&&m.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:i=>P(i.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:A,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:k,type:"file",accept:"image/jpeg,image/png,image/webp,image/gif",onChange:y,className:"hidden"}),e.jsx("button",{onClick:()=>{var i;return(i=k.current)==null?void 0:i.click()},disabled:w,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:w?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"})}),u&&e.jsx("p",{className:"text-xs text-destructive",children:u})]})]}),H&&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:i=>c("blur",Number(i.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:i=>c("darkenOpacity",Number(i.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:i=>c("saturation",Number(i.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:i=>c("enableFrostedGlass",i.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:i=>c("enableGrain",i.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:i=>c("enableVignette",i.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 ra(){const{formatMessage:s}=K(),{colorScheme:t,resolvedTheme:n,customHue:l,isCustomTheme:c,gradientLevel:m,enableHoverGlow:x,enableBackgroundAnimation:p,motionPreference:N,setColorScheme:f,setTheme:P,setCustomHue:w,setGradientLevel:F,setEnableHoverGlow:u,setEnableBackgroundAnimation:v,setMotionPreference:k,styleTier:h,setStyleTier:$,themeSlots:C,activeSlotId:M,canAddSlot:H,setActiveSlot:W,copySlot:A,renameSlot:b,deleteSlot:y,undoDeleteSlot:i,exportThemeCode:g,importThemeCode:d,setBackgroundConfig:E}=Be(),{addToast:O,removeToast:q}=Hs(),[J,Z]=r.useState(l),[ce,se]=r.useState([]),[de,me]=r.useState({}),[Y,ne]=r.useState(!1),[te,a]=r.useState(null),[S,I]=r.useState(""),[L,G]=r.useState(null),re=r.useRef(null),xe=r.useRef(null),[De,Ve]=r.useState(!1),[fs,Le]=r.useState(""),[U,ye]=r.useState(null),[ps,we]=r.useState(null),[ke,Ce]=r.useState(null),[bs,qe]=r.useState(!1);r.useEffect(()=>{Z(l)},[l]);const le=n,be=o=>{const T=Te(J??180,le)[o];return T?`hsl(${T})`:"#888"},js=[{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"}],Ns=o=>{const _=Te(l??220,le),T=o==="standard"?_:Je(_,o,le);return{bg:T["--bg"]?`hsl(${T["--bg"]})`:"#888",surface:T["--surface"]?`hsl(${T["--surface"]})`:"#888",accent:T["--accent"]?`hsl(${T["--accent"]})`:"#888"}},Ue=o=>{c&&w(null),f(o)},vs=()=>{l===null&&w(180)},ys=()=>{if(J!==null){w(J);const B=Te(J,n),T=_s(B).filter(he=>!he.passed);if(T.length>0){se(T);const he={};for(const je of T){const As=`${je.fgVar}|${je.bgVar}`;he[As]=Vs(je.fgVar,je.bgVar,B,je.required)}me(he),ne(!0)}else se([]),me({}),ne(!1)}},ws=()=>{w(null),Z(null)},ks=o=>{P(o)},Cs=o=>{if(o.key==="ArrowRight"||o.key==="ArrowDown"){o.preventDefault();const _=(oe.findIndex(T=>T.id===t)+1)%oe.length;Ue(oe[_].id)}else if(o.key==="ArrowLeft"||o.key==="ArrowUp"){o.preventDefault();const _=(oe.findIndex(T=>T.id===t)-1+oe.length)%oe.length;Ue(oe[_].id)}},Ss=r.useCallback(o=>{o!==M&&W(o)},[M,W]),Ts=r.useCallback(()=>{H&&A()},[H,A]),We=r.useCallback((o,B)=>{a(o),I(B),setTimeout(()=>{var _;return(_=re.current)==null?void 0:_.focus()},0)},[]),Ie=r.useCallback(()=>{te&&S.trim()&&b(te,S.trim()),a(null),I("")},[te,S,b]),Ge=r.useCallback(()=>{a(null),I("")},[]),Ms=r.useCallback(o=>{o.key==="Enter"?(o.preventDefault(),Ie()):o.key==="Escape"&&(o.preventDefault(),Ge())},[Ie,Ge]),Es=r.useCallback(()=>{if(!L)return;y(L),G(null),xe.current&&q(xe.current);const o=O("info",s({id:"theme.slot.undoDelete"}),void 0,{duration:1e4,dismissible:!0,action:{label:s({id:"theme.slot.undo"}),onClick:()=>{i(),q(o),xe.current=null}}});xe.current=o},[L,y,O,q,i,s]),Ke=r.useCallback(()=>{G(null)},[]),Ps=r.useCallback(async()=>{try{const o=g();await navigator.clipboard.writeText(o),qe(!0),setTimeout(()=>qe(!1),2e3)}catch{O("error","Failed to copy to clipboard")}},[g,O]),Fs=r.useCallback(()=>{Ve(!0),Le(""),ye(null),we(null),Ce(null)},[]),Se=r.useCallback(()=>{Ve(!1),Le(""),ye(null),we(null),Ce(null)},[]),Ds=r.useCallback(o=>{if(Le(o),Ce(null),we(null),ye(null),!o.trim())return;const B=d(o);B.ok?(ye(B.payload),B.warning&&we(B.warning)):Ce(B.error)},[d]),Ls=r.useCallback(()=>{U&&(!H&&M==="default"?(U.customHue!==null?w(U.customHue):(w(null),f(U.colorScheme)),F(U.gradientLevel),u(U.enableHoverGlow),v(U.enableBackgroundAnimation),$(U.styleTier)):H?(A(),U.customHue!==null?w(U.customHue):(w(null),f(U.colorScheme)),F(U.gradientLevel),u(U.enableHoverGlow),v(U.enableBackgroundAnimation),$(U.styleTier)):(U.customHue!==null?w(U.customHue):(w(null),f(U.colorScheme)),F(U.gradientLevel),u(U.enableHoverGlow),v(U.enableBackgroundAnimation),$(U.styleTier)),E(U.backgroundConfig??Bs),O("success",s({id:"theme.share.importSuccess"})),Se())},[U,H,M,A,w,f,F,u,v,$,E,O,s,Se]),Us=r.useCallback(o=>{const B=o.customHue??220,_=Te(B,le),T=o.styleTier==="standard"?_:Je(_,o.styleTier,le);return{bg:T["--bg"]?`hsl(${T["--bg"]})`:"#888",surface:T["--surface"]?`hsl(${T["--surface"]})`:"#888",accent:T["--accent"]?`hsl(${T["--accent"]})`:"#888",text:T["--text"]?`hsl(${T["--text"]})`:"#888"}},[le]),Is=o=>{switch(o){case"incompatible_version":return"theme.share.incompatibleVersion";default:return"theme.share.invalidCode"}};return r.useEffect(()=>{te&&re.current&&(re.current.focus(),re.current.select())},[te]),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:Ts,disabled:!H,title:H?s({id:"theme.slot.copy"}):s({id:"theme.slot.limitReached"},{limit:Rs}),className:`
|
|
46
|
+
px-2 py-1 rounded text-xs font-medium
|
|
47
|
+
transition-all duration-200
|
|
48
|
+
${H?"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:C.map(o=>{const B=o.id===M,_=o.id===te;return e.jsxs("div",{role:"tab","aria-selected":B,tabIndex:B?0:-1,onClick:()=>Ss(o.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
|
+
${B?"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:[B&&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:re,type:"text",value:S,onChange:T=>I(T.target.value),onKeyDown:Ms,onBlur:Ie,onClick:T=>T.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:o.name,onDoubleClick:T=>{T.stopPropagation(),o.isDefault||We(o.id,o.name)},children:o.name})}),B&&!_&&e.jsx("span",{className:"text-[10px] text-accent font-medium mt-0.5 block",children:s({id:"theme.slot.active"})}),!o.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:T=>{T.stopPropagation(),We(o.id,o.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:T=>{T.stopPropagation(),G(o.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"})})})]}),o.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"})})})})]},o.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:Cs,children:[oe.map(o=>e.jsxs("button",{onClick:()=>Ue(o.id),"aria-label":s({id:"theme.select.colorScheme"},{name:s({id:`theme.colorScheme.${o.id}`})}),"aria-selected":t===o.id&&!c,role:"radio",className:`
|
|
72
|
+
flex flex-col items-center gap-2 p-3 rounded-lg
|
|
73
|
+
transition-all duration-200 border-2
|
|
74
|
+
${t===o.id&&!c?"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:o.accentColor},"aria-hidden":"true"}),e.jsx("span",{className:"text-xs font-medium text-text text-center",children:s({id:`theme.colorScheme.${o.id}`})})]},o.id)),e.jsxs("button",{onClick:vs,"aria-label":s({id:"theme.select.colorScheme"},{name:s({id:"theme.colorScheme.custom"})}),"aria-selected":c,role:"radio",className:`
|
|
77
|
+
flex flex-col items-center gap-2 p-3 rounded-lg
|
|
78
|
+
transition-all duration-200 border-2
|
|
79
|
+
${c?"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, ${be("--accent")}, ${be("--primary")})`},"aria-hidden":"true"}),e.jsx("span",{className:"text-xs font-medium text-text text-center",children:s({id:"theme.colorScheme.custom"})})]})]})]}),c&&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:J??180})})}),e.jsx("input",{id:"hue-slider",type:"range",min:"0",max:"360",step:"1",value:J??180,onChange:o=>Z(Number(o.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:be("--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:be("--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:be("--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:ys,disabled:J===l,className:`
|
|
84
|
+
flex-1 px-4 py-2 rounded-lg text-sm font-medium
|
|
85
|
+
transition-all duration-200
|
|
86
|
+
${J===l?"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:ws,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:js.map(o=>{const B=Ns(o.id),_=h===o.id;return e.jsxs("button",{onClick:()=>$(o.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:B.bg}}),e.jsx("div",{className:"w-5 h-5 rounded-sm border border-border",style:{backgroundColor:B.surface}}),e.jsx("div",{className:"w-5 h-5 rounded-sm border border-border",style:{backgroundColor:B.accent}})]}),e.jsx("span",{className:"text-xs font-medium text-text text-center",children:s({id:o.nameKey})}),e.jsx("span",{className:"text-[10px] text-text-tertiary text-center leading-tight",children:s({id:o.descKey})})]},o.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(o=>e.jsx("button",{onClick:()=>F(o),role:"radio","aria-checked":m===o,className:`
|
|
98
|
+
flex-1 px-3 py-2 rounded-lg text-sm font-medium
|
|
99
|
+
transition-all duration-200 border-2
|
|
100
|
+
${m===o?"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.${o}`})},o))}),e.jsxs("label",{className:"flex items-center gap-3 cursor-pointer",children:[e.jsx("input",{type:"checkbox",checked:x,onChange:o=>u(o.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:o=>v(o.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(na,{}),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(o=>e.jsx("button",{onClick:()=>k(o),role:"radio","aria-checked":N===o,className:`
|
|
109
|
+
flex-1 px-3 py-2 rounded-lg text-sm font-medium
|
|
110
|
+
transition-all duration-200 border-2
|
|
111
|
+
${N===o?"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.${o}`})},o))})]}),Y&&ce.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:ce.map(o=>{const B=`${o.fgVar}|${o.bgVar}`,_=de[B]||[];return e.jsxs("li",{className:"space-y-1",children:[e.jsxs("span",{children:[o.fgVar," / ",o.bgVar,": ",o.ratio,":1 (min ",o.required,":1)"]}),_.length>0&&e.jsx("div",{className:"ml-2 text-[10px]",children:_.slice(0,1).map((T,he)=>e.jsx("span",{className:"block",children:s({id:"theme.accessibility.fixSuggestion"},{target:T.target==="fg"?o.fgVar:o.bgVar,original:T.original,suggested:T.suggested,ratio:T.resultRatio})},he))})]},B)})}),e.jsx("button",{onClick:()=>ne(!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:$s.map(o=>e.jsxs("button",{onClick:()=>ks(o.id),"aria-label":s({id:"theme.select.themeMode"},{name:s({id:`theme.themeMode.${o.id}`})}),"aria-selected":le===o.id,role:"radio",className:`
|
|
114
|
+
flex items-center justify-center gap-2 p-3 rounded-lg
|
|
115
|
+
transition-all duration-200 border-2
|
|
116
|
+
${le===o.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:o.id==="light"?"☀️":"🌙"}),e.jsx("span",{className:"text-sm font-medium text-text",children:s({id:`theme.themeMode.${o.id}`})})]},o.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:zs(t,le)})})}),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:Ps,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(bs?{id:"theme.share.copied"}:{id:"theme.share.copyCode"})}),e.jsx("button",{onClick:De?Se:Fs,className:`
|
|
124
|
+
flex-1 px-3 py-2 rounded-lg text-sm font-medium
|
|
125
|
+
transition-all duration-200 border-2
|
|
126
|
+
${De?"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"})})]}),De&&e.jsxs("div",{className:"mt-3 space-y-3",children:[e.jsx("textarea",{value:fs,onChange:o=>Ds(o.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
|
+
`}),ke&&e.jsx("div",{className:"p-2 rounded-lg bg-error-light border border-error text-error-text text-xs",children:s({id:Is(ke)})}),ps&&!ke&&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"})}),U&&!ke&&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 o=Us(U);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:o.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:o.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:o.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.${U.styleTier==="high-contrast"?"highContrast":U.styleTier}`})]}),e.jsxs("p",{children:[s({id:"theme.gradient.title"}),": ",s({id:`theme.gradient.${U.gradientLevel}`})]}),U.customHue!==null&&e.jsx("p",{children:s({id:"theme.hueValue"},{value:U.customHue})}),U.customHue===null&&e.jsxs("p",{children:[s({id:"theme.title.colorScheme"}),": ",s({id:`theme.colorScheme.${U.colorScheme}`})]})]}),e.jsxs("div",{className:"flex gap-2 pt-1",children:[e.jsx("button",{onClick:Ls,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:Se,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(jt,{open:L!==null,onOpenChange:Ke,children:e.jsxs(Nt,{children:[e.jsxs(vt,{children:[e.jsx(yt,{children:"Delete Theme Slot?"}),e.jsx(wt,{children:"This action cannot be undone. The theme slot will be permanently deleted."})]}),e.jsxs(kt,{children:[e.jsx(Ct,{onClick:Ke,children:"Cancel"}),e.jsx(St,{onClick:Es,children:"Delete"})]})]})})]})]})}const ia=[{value:"en",label:"English",flag:"🇺🇸"},{value:"zh",label:"中文",flag:"🇨🇳"}];function la({compact:s=!1,className:t}){const{locale:n,setLocale:l}=Rt();return e.jsxs(qs,{value:n,onValueChange:l,children:[e.jsx(Ws,{className:z(s?"w-[110px]":"w-[160px]","gap-2",t),"aria-label":"Select language",children:s?e.jsxs(e.Fragment,{children:[e.jsx(ls,{className:"w-4 h-4"}),e.jsx(Ye,{})]}):e.jsx(Ye,{})}),e.jsx(Gs,{children:ia.map(c=>e.jsx(Ks,{value:c.value,children:e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-base",children:c.flag}),e.jsx("span",{children:c.label})]})},c.value))})]})}const 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"]}},oa={"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 Ze(){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 ca({config:s,expandedPlatform:t,testing:n,onToggleExpand:l,onUpdateConfig:c,onTest:m,onSave:x,saving:p}){const{formatMessage:N}=K(),f=["discord","telegram","feishu","dingtalk","wecom","email","webhook"],P=u=>{switch(u){case"discord":return e.jsx(Qs,{className:"w-4 h-4"});case"telegram":return e.jsx(_t,{className:"w-4 h-4"});case"feishu":return e.jsx(as,{className:"w-4 h-4"});case"dingtalk":return e.jsx($e,{className:"w-4 h-4"});case"wecom":return e.jsx(Ys,{className:"w-4 h-4"});case"email":return e.jsx(Js,{className:"w-4 h-4"});case"webhook":return e.jsx(zt,{className:"w-4 h-4"})}},w=u=>{switch(u){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"}}},F=u=>{var k;const v=w(u);switch(u){case"discord":return!!v.webhookUrl;case"telegram":return!!v.botToken&&!!v.chatId;case"feishu":return!!v.webhookUrl;case"dingtalk":return!!v.webhookUrl;case"wecom":return!!v.webhookUrl;case"email":const h=v;return!!(h.host&&h.username&&h.password&&h.from&&((k=h.to)==null?void 0:k.length)>0);case"webhook":return!!v.url}};return e.jsx("div",{className:"grid gap-3",children:f.map(u=>{const v=Oe[u],k=w(u),h=F(u),$=t===u;return e.jsxs(Q,{className:"overflow-hidden",children:[e.jsx("div",{className:"p-4 cursor-pointer hover:bg-muted/50 transition-colors",onClick:()=>l($?null:u),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",k.enabled&&h?"bg-primary/10 text-primary":"bg-muted text-muted-foreground"),children:P(u)}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-sm font-medium",children:v.name}),h&&e.jsxs(X,{variant:"outline",className:"text-xs text-green-600 border-green-500/30",children:[e.jsx(ie,{className:"w-3 h-3 mr-1"}),N({id:"settings.remoteNotifications.configured"})]})]}),e.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:v.description})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(j,{variant:k.enabled?"default":"outline",size:"sm",className:"h-7",onClick:C=>{C.stopPropagation(),c(u,{enabled:!k.enabled})},children:k.enabled?e.jsx(ie,{className:"w-3.5 h-3.5"}):e.jsx(ae,{className:"w-3.5 h-3.5"})}),$?e.jsx(Re,{className:"w-4 h-4 text-muted-foreground"}):e.jsx(Pe,{className:"w-4 h-4 text-muted-foreground"})]})]})}),$&&e.jsxs("div",{className:"border-t border-border p-4 space-y-4 bg-muted/30",children:[u==="discord"&&e.jsx(da,{config:k,onUpdate:C=>c("discord",C)}),u==="telegram"&&e.jsx(ma,{config:k,onUpdate:C=>c("telegram",C)}),u==="feishu"&&e.jsx(xa,{config:k,onUpdate:C=>c("feishu",C)}),u==="dingtalk"&&e.jsx(ha,{config:k,onUpdate:C=>c("dingtalk",C)}),u==="wecom"&&e.jsx(ga,{config:k,onUpdate:C=>c("wecom",C)}),u==="email"&&e.jsx(fa,{config:k,onUpdate:C=>c("email",C)}),u==="webhook"&&e.jsx(ua,{config:k,onUpdate:C=>c("webhook",C)}),e.jsxs("div",{className:"flex items-center gap-2 pt-2",children:[e.jsxs(j,{variant:"outline",size:"sm",onClick:()=>m(u,k),disabled:n===u||!h,children:[e.jsx($t,{className:z("w-3.5 h-3.5 mr-1",n===u&&"animate-pulse")}),N({id:"settings.remoteNotifications.testConnection"})]}),e.jsx(j,{variant:"default",size:"sm",onClick:x,disabled:p,children:N({id:"settings.remoteNotifications.save"})})]})]})]},u)})})}function da({config:s,onUpdate:t}){const{formatMessage:n}=K(),[l,c]=r.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:n({id:"settings.remoteNotifications.discord.webhookUrl"})}),e.jsxs("div",{className:"flex gap-2 mt-1",children:[e.jsx(D,{type:l?"text":"password",value:s.webhookUrl||"",onChange:m=>t({webhookUrl:m.target.value}),placeholder:"https://discord.com/api/webhooks/...",className:"flex-1"}),e.jsx(j,{variant:"outline",size:"sm",className:"shrink-0",onClick:()=>c(!l),children:l?e.jsx(fe,{className:"w-4 h-4"}):e.jsx(pe,{className:"w-4 h-4"})})]}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:n({id:"settings.remoteNotifications.discord.webhookUrlHint"})})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium text-foreground",children:n({id:"settings.remoteNotifications.discord.username"})}),e.jsx(D,{value:s.username||"",onChange:m=>t({username:m.target.value}),placeholder:"CCW Notification",className:"mt-1"})]})]})}function ma({config:s,onUpdate:t}){const{formatMessage:n}=K(),[l,c]=r.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:n({id:"settings.remoteNotifications.telegram.botToken"})}),e.jsxs("div",{className:"flex gap-2 mt-1",children:[e.jsx(D,{type:l?"text":"password",value:s.botToken||"",onChange:m=>t({botToken:m.target.value}),placeholder:"1234567890:ABCdefGHIjklMNOpqrsTUVwxyz",className:"flex-1"}),e.jsx(j,{variant:"outline",size:"sm",className:"shrink-0",onClick:()=>c(!l),children:l?e.jsx(fe,{className:"w-4 h-4"}):e.jsx(pe,{className:"w-4 h-4"})})]}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:n({id:"settings.remoteNotifications.telegram.botTokenHint"})})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium text-foreground",children:n({id:"settings.remoteNotifications.telegram.chatId"})}),e.jsx(D,{value:s.chatId||"",onChange:m=>t({chatId:m.target.value}),placeholder:"-1001234567890",className:"mt-1"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:n({id:"settings.remoteNotifications.telegram.chatIdHint"})})]})]})}function ua({config:s,onUpdate:t}){const{formatMessage:n}=K();return e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium text-foreground",children:n({id:"settings.remoteNotifications.webhook.url"})}),e.jsx(D,{value:s.url||"",onChange:l=>t({url:l.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:n({id:"settings.remoteNotifications.webhook.method"})}),e.jsxs("div",{className:"flex gap-2 mt-1",children:[e.jsx(j,{variant:s.method==="POST"?"default":"outline",size:"sm",onClick:()=>t({method:"POST"}),children:"POST"}),e.jsx(j,{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:n({id:"settings.remoteNotifications.webhook.headers"})}),e.jsx(D,{value:s.headers?JSON.stringify(s.headers):"",onChange:l=>{try{const c=l.target.value?JSON.parse(l.target.value):void 0;t({headers:c})}catch{}},placeholder:'{"Authorization": "Bearer token"}',className:"mt-1 font-mono text-xs"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:n({id:"settings.remoteNotifications.webhook.headersHint"})})]})]})}function xa({config:s,onUpdate:t}){const{formatMessage:n}=K(),[l,c]=r.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:n({id:"settings.remoteNotifications.feishu.webhookUrl"})}),e.jsxs("div",{className:"flex gap-2 mt-1",children:[e.jsx(D,{type:l?"text":"password",value:s.webhookUrl||"",onChange:m=>t({webhookUrl:m.target.value}),placeholder:"https://open.feishu.cn/open-apis/bot/v2/hook/...",className:"flex-1"}),e.jsx(j,{variant:"outline",size:"sm",className:"shrink-0",onClick:()=>c(!l),children:l?e.jsx(fe,{className:"w-4 h-4"}):e.jsx(pe,{className:"w-4 h-4"})})]}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:n({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:m=>t({useCard:m.target.checked}),className:"rounded border-border"}),e.jsx("label",{htmlFor:"feishu-useCard",className:"text-sm font-medium text-foreground",children:n({id:"settings.remoteNotifications.feishu.useCard"})})]}),e.jsx("p",{className:"text-xs text-muted-foreground -mt-2",children:n({id:"settings.remoteNotifications.feishu.useCardHint"})}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium text-foreground",children:n({id:"settings.remoteNotifications.feishu.title"})}),e.jsx(D,{value:s.title||"",onChange:m=>t({title:m.target.value}),placeholder:"CCW Notification",className:"mt-1"})]})]})}function ha({config:s,onUpdate:t}){var m;const{formatMessage:n}=K(),[l,c]=r.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:n({id:"settings.remoteNotifications.dingtalk.webhookUrl"})}),e.jsxs("div",{className:"flex gap-2 mt-1",children:[e.jsx(D,{type:l?"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(j,{variant:"outline",size:"sm",className:"shrink-0",onClick:()=>c(!l),children:l?e.jsx(fe,{className:"w-4 h-4"}):e.jsx(pe,{className:"w-4 h-4"})})]}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:n({id:"settings.remoteNotifications.dingtalk.webhookUrlHint"})})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium text-foreground",children:n({id:"settings.remoteNotifications.dingtalk.keywords"})}),e.jsx(D,{value:((m=s.keywords)==null?void 0:m.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:n({id:"settings.remoteNotifications.dingtalk.keywordsHint"})})]})]})}function ga({config:s,onUpdate:t}){var m;const{formatMessage:n}=K(),[l,c]=r.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:n({id:"settings.remoteNotifications.wecom.webhookUrl"})}),e.jsxs("div",{className:"flex gap-2 mt-1",children:[e.jsx(D,{type:l?"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(j,{variant:"outline",size:"sm",className:"shrink-0",onClick:()=>c(!l),children:l?e.jsx(fe,{className:"w-4 h-4"}):e.jsx(pe,{className:"w-4 h-4"})})]}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:n({id:"settings.remoteNotifications.wecom.webhookUrlHint"})})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium text-foreground",children:n({id:"settings.remoteNotifications.wecom.mentionedList"})}),e.jsx(D,{value:((m=s.mentionedList)==null?void 0:m.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:n({id:"settings.remoteNotifications.wecom.mentionedListHint"})})]})]})}function fa({config:s,onUpdate:t}){var m;const{formatMessage:n}=K(),[l,c]=r.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:n({id:"settings.remoteNotifications.email.host"})}),e.jsx(D,{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:n({id:"settings.remoteNotifications.email.hostHint"})})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium text-foreground",children:n({id:"settings.remoteNotifications.email.port"})}),e.jsx(D,{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:n({id:"settings.remoteNotifications.email.secure"})})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium text-foreground",children:n({id:"settings.remoteNotifications.email.username"})}),e.jsx(D,{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:n({id:"settings.remoteNotifications.email.password"})}),e.jsxs("div",{className:"flex gap-2 mt-1",children:[e.jsx(D,{type:l?"text":"password",value:s.password||"",onChange:x=>t({password:x.target.value}),placeholder:"********",className:"flex-1"}),e.jsx(j,{variant:"outline",size:"sm",className:"shrink-0",onClick:()=>c(!l),children:l?e.jsx(fe,{className:"w-4 h-4"}):e.jsx(pe,{className:"w-4 h-4"})})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium text-foreground",children:n({id:"settings.remoteNotifications.email.from"})}),e.jsx(D,{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:n({id:"settings.remoteNotifications.email.to"})}),e.jsx(D,{value:((m=s.to)==null?void 0:m.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:n({id:"settings.remoteNotifications.email.toHint"})})]})]})}function pa({className:s}){const{formatMessage:t}=K(),[n,l]=r.useState(null),[c,m]=r.useState(!0),[x,p]=r.useState(!1),[N,f]=r.useState(null),[P,w]=r.useState(null),[F,u]=r.useState(null),v=r.useCallback(async()=>{m(!0);try{const b=await fetch("/api/notifications/remote/config");if(b.ok){const y=await b.json();l(y)}else l(Ze())}catch(b){console.error("Failed to load remote notification config:",b),l(Ze())}finally{m(!1)}},[]);r.useEffect(()=>{v()},[v]);const k=r.useCallback(async b=>{p(!0);try{const y=await fetch("/api/notifications/remote/config",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(b)});if(y.ok){const i=await y.json();l(i.config),R.success(t({id:"settings.remoteNotifications.saved"}))}else throw new Error(`HTTP ${y.status}`)}catch{R.error(t({id:"settings.remoteNotifications.saveError"}))}finally{p(!1)}},[t]),h=r.useCallback(async(b,y)=>{f(b);try{const g=await(await fetch("/api/notifications/remote/test",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({platform:b,config:y})})).json();g.success?R.success(t({id:"settings.remoteNotifications.testSuccess"}),{description:`${g.responseTime}ms`}):R.error(t({id:"settings.remoteNotifications.testFailed"}),{description:g.error})}catch{R.error(t({id:"settings.remoteNotifications.testError"}))}finally{f(null)}},[t]),$=()=>{n&&k({...n,enabled:!n.enabled})},C=(b,y)=>{if(!n)return;const i={...n,platforms:{...n.platforms,[b]:{...n.platforms[b],...y}}};l(i)},M=(b,y)=>{if(!n)return;const i=[...n.events];i[b]={...i[b],...y},l({...n,events:i})},H=(b,y)=>{if(!n)return;const i=n.events[b],g=i.platforms.includes(y)?i.platforms.filter(d=>d!==y):[...i.platforms,y];M(b,{platforms:g})},W=["discord","telegram","feishu","dingtalk","wecom","email","webhook"],A=async()=>{if(confirm(t({id:"settings.remoteNotifications.resetConfirm"})))try{const b=await fetch("/api/notifications/remote/reset",{method:"POST"});if(b.ok){const y=await b.json();l(y.config),R.success(t({id:"settings.remoteNotifications.resetSuccess"}))}}catch{R.error(t({id:"settings.remoteNotifications.resetError"}))}};return c?e.jsx(Q,{className:z("p-6",s),children:e.jsx("div",{className:"flex items-center justify-center py-8",children:e.jsx(ue,{className:"w-5 h-5 animate-spin text-muted-foreground"})})}):n?e.jsxs(Q,{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:[n.enabled?e.jsx($e,{className:"w-5 h-5 text-primary"}):e.jsx(Jt,{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(j,{variant:"outline",size:"sm",onClick:()=>v(),disabled:c,children:e.jsx(ue,{className:z("w-3.5 h-3.5",c&&"animate-spin")})}),e.jsx(j,{variant:n.enabled?"default":"outline",size:"sm",onClick:$,children:n.enabled?e.jsxs(e.Fragment,{children:[e.jsx(ie,{className:"w-4 h-4 mr-1"}),t({id:"settings.remoteNotifications.enabled"})]}):e.jsxs(e.Fragment,{children:[e.jsx(ae,{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"})}),n.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(ca,{config:n,expandedPlatform:P,testing:N,onToggleExpand:w,onUpdateConfig:C,onTest:h,onSave:()=>k(n),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:n.events.map((b,y)=>{const i=oa[b.event],g=F===y;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:()=>u(g?null:y),children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:z("p-2 rounded-lg",b.enabled?"bg-primary/10 text-primary":"bg-muted text-muted-foreground"),children:e.jsx("span",{className:"text-sm",children:i.icon})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium",children:i.name}),e.jsx("p",{className:"text-xs text-muted-foreground",children:i.description})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("div",{className:"flex gap-1 flex-wrap max-w-xs",children:[b.platforms.slice(0,3).map(d=>e.jsx(X,{variant:"secondary",className:"text-xs",children:Oe[d].name},d)),b.platforms.length>3&&e.jsxs(X,{variant:"secondary",className:"text-xs",children:["+",b.platforms.length-3]}),b.platforms.length===0&&e.jsx(X,{variant:"outline",className:"text-xs text-muted-foreground",children:t({id:"settings.remoteNotifications.noPlatforms"})})]}),e.jsx(j,{variant:b.enabled?"default":"outline",size:"sm",className:"h-7",onClick:d=>{d.stopPropagation(),M(y,{enabled:!b.enabled})},children:b.enabled?e.jsx(ie,{className:"w-3.5 h-3.5"}):e.jsx(ae,{className:"w-3.5 h-3.5"})}),g?e.jsx(Re,{className:"w-4 h-4 text-muted-foreground"}):e.jsx(Pe,{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(d=>{const E=b.platforms.includes(d),O=Oe[d],q=n.platforms[d],J=q==null?void 0:q.enabled;return e.jsxs(j,{variant:E?"default":"outline",size:"sm",className:z("h-8",!J&&!E&&"opacity-50"),onClick:()=>H(y,d),children:[E&&e.jsx(ie,{className:"w-3 h-3 mr-1"}),O.name,!J&&!E&&e.jsx(ve,{className:"w-3 h-3 ml-1 opacity-50"})]},d)})})]})]},b.event)})})]}),e.jsxs("div",{className:"flex items-center justify-between mt-6 pt-4 border-t border-border",children:[e.jsx(j,{variant:"outline",size:"sm",onClick:A,children:t({id:"settings.remoteNotifications.reset"})}),e.jsxs(j,{variant:"default",size:"sm",onClick:()=>k(n),disabled:x,children:[e.jsx(Fe,{className:"w-4 h-4 mr-1"}),t(x?{id:"settings.remoteNotifications.saving"}:{id:"settings.remoteNotifications.save"})]})]})]})]}):null}function ba({value:s,label:t,description:n,selected:l,onClick:c}){const m={modal:e.jsx("div",{className:"w-8 h-8 border-2 border-current rounded-lg flex items-center justify-center",children:e.jsx("div",{className:"w-4 h-3 border border-current rounded-sm"})}),drawer:e.jsx("div",{className:"w-8 h-8 border-2 border-current rounded-lg flex items-end justify-end p-0.5",children:e.jsx("div",{className:"w-2 h-6 border border-current rounded-sm"})}),sheet:e.jsx("div",{className:"w-8 h-8 border-2 border-current rounded-lg flex items-end justify-center p-0.5",children:e.jsx("div",{className:"w-6 h-2 border border-current rounded-sm"})}),fullscreen:e.jsx("div",{className:"w-8 h-8 border-2 border-current rounded-lg flex items-center justify-center",children:e.jsx("div",{className:"w-5 h-4 border border-current rounded-sm"})})};return e.jsxs("button",{type:"button",onClick:c,className:z("flex flex-col items-center gap-2 p-3 rounded-lg border-2 transition-all","hover:bg-accent/50",l?"border-primary bg-primary/10 text-primary":"border-border text-muted-foreground"),children:[m[s],e.jsxs("div",{className:"text-center",children:[e.jsx("div",{className:z("text-sm font-medium",l&&"text-primary"),children:t}),e.jsx("div",{className:"text-xs text-muted-foreground",children:n})]})]})}function ja({value:s,onChange:t,disabled:n}){const l=[10,20,30,45,60,90,120];return e.jsx("div",{className:"flex flex-wrap gap-2",children:l.map(c=>e.jsxs(j,{type:"button",variant:s===c?"default":"outline",size:"sm",disabled:n,onClick:()=>t(c),children:[c,"s"]},c))})}function Na(){const{formatMessage:s}=K(),{preferences:t,updatePreference:n,resetPreferences:l}=Xs(),c=[{value:"modal",label:s({id:"settings.a2ui.styleModal",defaultMessage:"Modal"}),description:s({id:"settings.a2ui.styleModalDesc",defaultMessage:"Centered"})},{value:"drawer",label:s({id:"settings.a2ui.styleDrawer",defaultMessage:"Drawer"}),description:s({id:"settings.a2ui.styleDrawerDesc",defaultMessage:"Side panel"})},{value:"sheet",label:s({id:"settings.a2ui.styleSheet",defaultMessage:"Sheet"}),description:s({id:"settings.a2ui.styleSheetDesc",defaultMessage:"Bottom"})},{value:"fullscreen",label:s({id:"settings.a2ui.styleFullscreen",defaultMessage:"Fullscreen"}),description:s({id:"settings.a2ui.styleFullscreenDesc",defaultMessage:"Full screen"})}];return e.jsxs(Q,{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.a2ui",defaultMessage:"A2UI Preferences"})]}),e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"space-y-3",children:[e.jsxs(Qe,{className:"text-sm font-medium flex items-center gap-2",children:[e.jsx(Yt,{className:"w-4 h-4"}),s({id:"settings.a2ui.dialogStyle",defaultMessage:"Dialog Style"})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:s({id:"settings.a2ui.dialogStyleDesc",defaultMessage:"Choose how A2UI dialogs are displayed"})}),e.jsx("div",{className:"grid grid-cols-4 gap-2",children:c.map(m=>e.jsx(ba,{value:m.value,label:m.label,description:m.description,selected:t.dialogStyle===m.value,onClick:()=>n("dialogStyle",m.value)},m.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(Zs,{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(j,{variant:t.smartModeEnabled?"default":"outline",size:"sm",onClick:()=>n("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(et,{className:"w-4 h-4 text-muted-foreground"}),e.jsx(Qe,{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(ja,{value:t.autoSelectionDuration,onChange:m=>n("autoSelectionDuration",m)})]}),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(j,{variant:t.pauseOnInteraction?"default":"outline",size:"sm",onClick:()=>n("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(Xt,{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(j,{variant:t.autoSelectionSoundEnabled?"default":"outline",size:"sm",onClick:()=>n("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(j,{variant:t.showA2UIButtonInToolbar?"default":"outline",size:"sm",onClick:()=>n("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(j,{variant:"outline",size:"sm",onClick:l,children:s({id:"common.resetToDefaults",defaultMessage:"Reset to Defaults"})})})]})]})}const os=["","low","medium","high"],cs=["","low","medium","high","max"],Ee=["sonnet","opus","haiku","inherit"],ds=["","default","acceptEdits","dontAsk","bypassPermissions","plan"],ms=["","user","project","local"],us=["","worktree"],xs=["","purple","blue","yellow","green","red"],He=["PreToolUse","PostToolUse","Stop"],ee="h-7 text-xs rounded border border-input bg-background px-2",V="text-xs text-muted-foreground shrink-0";function es(s){if(!s)return[];const t=[],n=s.split(`
|
|
144
|
+
`);for(const l of n){const c=l.match(/^\s+-\s+(.+)$/);c&&t.push(c[1].trim())}return t}function va(s){return s.length===0?"":`mcpServers:
|
|
145
|
+
${s.map(t=>` - ${t}`).join(`
|
|
146
|
+
`)}`}function ss(s){const t={PreToolUse:[],PostToolUse:[],Stop:[]};if(!s)return t;let n=null,l=null;const c=s.split(`
|
|
147
|
+
`);for(const m of c){const x=m.match(/^\s{2,4}(\w+):$/);if(x&&x[1]in t){n=x[1],l=null;continue}const p=m.match(/^\s+-\s+matcher:\s*["']?([^"'\n]+)["']?$/);if(p&&n){l=p[1].trim();continue}const N=m.match(/^\s+command:\s*["']?([^"'\n]+)["']?$/);if(N&&n&&l!==null){t[n].push({matcher:l,command:N[1].trim()}),l=null;continue}}return t}function ya(s){const t=[];for(const n of He){const l=s[n];if(l.length!==0){t.push(` ${n}:`);for(const c of l)t.push(` - matcher: "${c.matcher}"`),t.push(" hooks:"),t.push(" - type: command"),t.push(` command: "${c.command}"`)}}return t.length===0?"":`hooks:
|
|
148
|
+
${t.join(`
|
|
149
|
+
`)}`}function wa({agent:s,onSaved:t}){const[n,l]=r.useState(s.color),[c,m]=r.useState(s.permissionMode),[x,p]=r.useState(s.memory),[N,f]=r.useState(s.maxTurns),[P,w]=r.useState(s.background==="true"),[F,u]=r.useState(s.isolation),[v,k]=r.useState(s.tools),[h,$]=r.useState(s.disallowedTools),[C,M]=r.useState(s.skills),[H,W]=r.useState([]),[A,b]=r.useState(()=>es(s.mcpServers)),[y,i]=r.useState(!1),[g,d]=r.useState(""),[E,O]=r.useState(()=>ss(s.hooks)),[q,J]=r.useState("PreToolUse"),[Z,ce]=r.useState(!1);r.useEffect(()=>{let a=!1;return i(!0),nt().then(S=>{if(a)return;const I=new Set;S.userServers&&Object.keys(S.userServers).forEach(L=>I.add(L)),S.globalServers&&Object.keys(S.globalServers).forEach(L=>I.add(L)),S.projects&&Object.values(S.projects).forEach(L=>{L!=null&&L.mcpServers&&Object.keys(L.mcpServers).forEach(G=>I.add(G))}),W(Array.from(I).sort())}).catch(()=>{}).finally(()=>{a||i(!1)}),()=>{a=!0}},[]),r.useEffect(()=>{l(s.color),m(s.permissionMode),p(s.memory),f(s.maxTurns),w(s.background==="true"),u(s.isolation),k(s.tools),$(s.disallowedTools),M(s.skills),b(es(s.mcpServers)),O(ss(s.hooks))},[s]);const se=r.useCallback(async()=>{ce(!0);try{const a={filePath:s.filePath};n!==s.color&&(a.color=n),c!==s.permissionMode&&(a.permissionMode=c),x!==s.memory&&(a.memory=x),N!==s.maxTurns&&(a.maxTurns=N);const S=P?"true":"";S!==s.background&&(a.background=S),F!==s.isolation&&(a.isolation=F),v!==s.tools&&(a.tools=v),h!==s.disallowedTools&&(a.disallowedTools=h),C!==s.skills&&(a.skills=C);const I=va(A);I!==s.mcpServers&&(a.mcpServers=I);const L=ya(E);if(L!==s.hooks&&(a.hooks=L),Object.keys(a).filter(re=>re!=="filePath").length===0){R.info("No changes to save");return}await ze(s.type,s.name,a),R.success(`Updated ${s.name} advanced settings`),t()}catch(a){R.error(`Failed: ${a.message}`)}finally{ce(!1)}},[s,n,c,x,N,P,F,v,h,C,A,E,t]),de=a=>{b(S=>S.includes(a)?S.filter(I=>I!==a):[...S,a])},me=()=>{const a=g.trim();a&&!A.includes(a)&&(b(S=>[...S,a]),d(""))},Y=()=>{O(a=>({...a,[q]:[...a[q],{matcher:"",command:""}]}))},ne=(a,S)=>{O(I=>({...I,[a]:I[a].filter((L,G)=>G!==S)}))},te=(a,S,I,L)=>{O(G=>({...G,[a]:G[a].map((re,xe)=>xe===S?{...re,[I]:L}:re)}))};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:V,children:"Color:"}),e.jsx("select",{className:ee,value:n,onChange:a=>l(a.target.value),children:xs.map(a=>e.jsx("option",{value:a,children:a||"—"},a))})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("span",{className:V,children:"Permission:"}),e.jsx("select",{className:ee,value:c,onChange:a=>m(a.target.value),children:ds.map(a=>e.jsx("option",{value:a,children:a||"—"},a))})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("span",{className:V,children:"Memory:"}),e.jsx("select",{className:ee,value:x,onChange:a=>p(a.target.value),children:ms.map(a=>e.jsx("option",{value:a,children:a||"—"},a))})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("span",{className:V,children:"MaxTurns:"}),e.jsx(D,{className:"h-7 text-xs w-[60px]",type:"number",value:N,onChange:a=>f(a.target.value),placeholder:"—"})]}),e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx(Ae,{checked:P,onCheckedChange:a=>w(a===!0)}),e.jsx("span",{className:V,children:"Background"})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("span",{className:V,children:"Isolation:"}),e.jsx("select",{className:ee,value:F,onChange:a=>u(a.target.value),children:us.map(a=>e.jsx("option",{value:a,children:a||"—"},a))})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:V,children:"Tools:"}),e.jsx(D,{className:"h-7 text-xs flex-1",value:v,onChange:a=>k(a.target.value),placeholder:"Read, Write, Bash, Glob, Grep"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:V,children:"Disallowed:"}),e.jsx(D,{className:"h-7 text-xs flex-1",value:h,onChange:a=>$(a.target.value),placeholder:"e.g. Edit"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:V,children:"Skills:"}),e.jsx(D,{className:"h-7 text-xs flex-1",value:C,onChange:a=>M(a.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:"}),y?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:[H.map(a=>e.jsxs("label",{className:"flex items-center gap-1.5 text-xs cursor-pointer",children:[e.jsx(Ae,{checked:A.includes(a),onCheckedChange:()=>de(a)}),e.jsx("span",{className:"text-foreground",children:a})]},a)),A.filter(a=>!H.includes(a)).map(a=>e.jsxs("label",{className:"flex items-center gap-1.5 text-xs cursor-pointer",children:[e.jsx(Ae,{checked:!0,onCheckedChange:()=>de(a)}),e.jsx("span",{className:"text-foreground italic",children:a})]},a)),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(D,{className:"h-6 text-xs w-[120px]",value:g,onChange:a=>d(a.target.value),placeholder:"+ Custom",onKeyDown:a=>{a.key==="Enter"&&me()}}),e.jsx(j,{variant:"ghost",size:"sm",className:"h-6 px-1",onClick:me,disabled:!g.trim(),children:e.jsx(ve,{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:"}),He.map(a=>{const S=E[a];return S.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:[a,":"]}),S.map((I,L)=>e.jsxs("div",{className:"flex items-center gap-2 ml-3",children:[e.jsx(D,{className:"h-6 text-xs w-[100px]",value:I.matcher,onChange:G=>te(a,L,"matcher",G.target.value),placeholder:"matcher (e.g. Bash)"}),e.jsx("span",{className:"text-xs text-muted-foreground",children:"→"}),e.jsx(D,{className:"h-6 text-xs flex-1",value:I.command,onChange:G=>te(a,L,"command",G.target.value),placeholder:"command"}),e.jsx("button",{type:"button",className:"text-muted-foreground hover:text-destructive transition-colors",onClick:()=>ne(a,L),children:e.jsx(ae,{className:"w-3 h-3"})})]},L))]},a)}),e.jsxs("div",{className:"flex items-center gap-2 ml-1",children:[e.jsx("select",{className:ee,value:q,onChange:a=>J(a.target.value),children:He.map(a=>e.jsx("option",{value:a,children:a},a))}),e.jsxs(j,{variant:"outline",size:"sm",className:"h-6 px-2 text-xs",onClick:Y,children:[e.jsx(ve,{className:"w-3 h-3 mr-1"}),"Add Hook"]})]})]}),e.jsx("div",{className:"flex justify-end",children:e.jsxs(j,{variant:"default",size:"sm",className:"h-7",disabled:Z,onClick:se,children:[e.jsx(Fe,{className:"w-3 h-3 mr-1"}),Z?"Saving...":"Save Advanced"]})})]})}function ka({agent:s,onSaved:t}){const[n,l]=r.useState(s.model),[c,m]=r.useState(s.effort),[x,p]=r.useState(!1),[N,f]=r.useState(!1),P=n!==s.model||c!==s.effort,w=s.type==="codex"?os:cs,F=r.useCallback(async()=>{p(!0);try{const u={filePath:s.filePath};n!==s.model&&(u.model=n),c!==s.effort&&(u.effort=c),await ze(s.type,s.name,u),R.success(`Updated ${s.name}`),t()}catch(u){R.error(`Failed to update ${s.name}: ${u.message}`)}finally{p(!1)}},[s,n,c,t]);return r.useEffect(()=>{l(s.model),m(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(X,{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:Ee.includes(n)?n:"__custom__",onChange:u=>{u.target.value!=="__custom__"&&l(u.target.value)},children:[Ee.map(u=>e.jsx("option",{value:u,children:u||"(none)"},u)),!Ee.includes(n)&&e.jsx("option",{value:"__custom__",children:"custom"})]}),!Ee.includes(n)&&e.jsx(D,{className:"h-7 text-xs flex-1 min-w-[100px]",value:n,onChange:u=>l(u.target.value),placeholder:"model id"})]}):e.jsx(D,{className:"h-7 text-xs flex-1 min-w-[100px]",value:n,onChange:u=>l(u.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:c,onChange:u=>m(u.target.value),children:w.map(u=>e.jsx("option",{value:u,children:u||"—"},u))})]}),e.jsxs(j,{variant:"outline",size:"sm",className:"h-7 px-2 shrink-0",disabled:!P||x,onClick:F,children:[e.jsx(Fe,{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",N&&"text-primary"),onClick:()=>f(!N),title:"Advanced Settings",children:e.jsx(ns,{className:"w-4 h-4"})})]}),N&&s.type==="claude"&&e.jsx(wa,{agent:s,onSaved:t})]})}function Ca({installationPath:s,agents:t,onSaved:n}){const[l,c]=r.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:()=>c(!l),children:[l?e.jsx(Pe,{className:"w-4 h-4"}):e.jsx(at,{className:"w-4 h-4"}),e.jsx("span",{className:"text-sm font-medium text-foreground truncate",title:s,children:s}),e.jsxs(X,{variant:"outline",className:"text-xs ml-auto shrink-0",children:[t.length," agents"]})]}),l&&e.jsx("div",{className:"space-y-1 ml-6",children:t.map(m=>e.jsx(ka,{agent:m,onSaved:n},m.filePath))})]})}function Sa(){const[s,t]=r.useState([]),[n,l]=r.useState(!0),[c,m]=r.useState(""),[x,p]=r.useState(""),[N,f]=r.useState("all"),[P,w]=r.useState(""),[F,u]=r.useState(""),[v,k]=r.useState(""),[h,$]=r.useState(""),[C,M]=r.useState(""),[H,W]=r.useState(""),[A,b]=r.useState(""),[y,i]=r.useState(""),[g,d]=r.useState(""),[E,O]=r.useState(!1),[q,J]=r.useState(!1),Z=r.useCallback(async()=>{try{l(!0);const a=await st();t(a.agents)}catch(a){R.error(`Failed to load agents: ${a.message}`)}finally{l(!1)}},[]);r.useEffect(()=>{Z()},[Z]);const ce=s.reduce((a,S)=>{const I=S.installationPath;return a[I]||(a[I]=[]),a[I].push(S),a},{}),se=s.filter(a=>N==="all"||a.type===N),de=se.some(a=>a.type==="claude"),me=N==="codex"?os:N==="claude"?cs:["","low","medium","high","max (claude only)"],Y={};P&&(Y.color=P),F&&(Y.permissionMode=F),v&&(Y.memory=v),h&&(Y.maxTurns=h),C&&(Y.background=C),H&&(Y.isolation=H),A&&(Y.tools=A),y&&(Y.disallowedTools=y),g&&(Y.skills=g);const ne=Object.keys(Y).length>0,te=r.useCallback(async()=>{if(!(c||x||ne)){R.error("Set at least one value first");return}if(se.length===0){R.error("No agents match the selected type");return}J(!0);try{if(c||x){const S=se.map(L=>({filePath:L.filePath,type:L.type})),I=await tt({targets:S,model:c||void 0,effort:x||void 0});R.success(`Updated model/effort: ${I.updated}/${I.total} agents`)}if(ne&&de){const S=se.filter(L=>L.type==="claude");let I=0;for(const L of S)try{const G={filePath:L.filePath,...Y};await ze(L.type,L.name,G),I++}catch{}R.success(`Updated claude fields: ${I}/${S.length} agents`)}Z()}catch(S){R.error(`Batch update failed: ${S.message}`)}finally{J(!1)}},[se,de,c,x,ne,Y,Z]);return e.jsxs(Q,{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(Vt,{className:"w-5 h-5"}),"Agent Definitions"]}),e.jsxs(j,{variant:"ghost",size:"sm",onClick:Z,disabled:n,children:[e.jsx(ue,{className:z("w-4 h-4 mr-1",n&&"animate-spin")}),"Refresh"]})]}),e.jsxs("div",{className:"p-3 mb-4 rounded-md border border-border bg-muted/30 space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-3 flex-wrap",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:V,children:"Target:"}),e.jsxs("select",{className:ee,value:N,onChange:a=>f(a.target.value),children:[e.jsxs("option",{value:"all",children:["All (",s.length,")"]}),e.jsxs("option",{value:"codex",children:["Codex (",s.filter(a=>a.type==="codex").length,")"]}),e.jsxs("option",{value:"claude",children:["Claude (",s.filter(a=>a.type==="claude").length,")"]})]})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("span",{className:V,children:"Model:"}),e.jsx(D,{className:"h-7 text-xs w-[140px]",value:c,onChange:a=>m(a.target.value),placeholder:"model"})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("span",{className:V,children:"Effort:"}),e.jsx("select",{className:ee,value:x,onChange:a=>p(a.target.value),children:me.map(a=>{const S=a.startsWith("max")?"max":a;return e.jsx("option",{value:S,children:a||"—"},a)})})]}),N!=="codex"&&e.jsx("button",{type:"button",className:z("p-1 rounded hover:bg-accent transition-colors",E&&"text-primary"),onClick:()=>O(!E),title:"Claude Advanced Batch Settings",children:e.jsx(ns,{className:"w-4 h-4"})}),e.jsx(j,{variant:"default",size:"sm",className:"h-7",disabled:q||!c&&!x&&!ne,onClick:te,children:q?"Applying...":`Apply to ${N==="all"?"All":N} (${se.length})`})]}),E&&N!=="codex"&&e.jsxs("div",{className:"pt-2 border-t border-border space-y-2",children:[e.jsxs("span",{className:"text-xs font-medium text-muted-foreground",children:["Claude-only fields ",N==="all"&&"(applied to claude agents only)",":"]}),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:V,children:"Color:"}),e.jsx("select",{className:ee,value:P,onChange:a=>w(a.target.value),children:xs.map(a=>e.jsx("option",{value:a,children:a||"—"},a))})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("span",{className:V,children:"Permission:"}),e.jsx("select",{className:ee,value:F,onChange:a=>u(a.target.value),children:ds.map(a=>e.jsx("option",{value:a,children:a||"—"},a))})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("span",{className:V,children:"Memory:"}),e.jsx("select",{className:ee,value:v,onChange:a=>k(a.target.value),children:ms.map(a=>e.jsx("option",{value:a,children:a||"—"},a))})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("span",{className:V,children:"MaxTurns:"}),e.jsx(D,{className:"h-7 text-xs w-[60px]",type:"number",value:h,onChange:a=>$(a.target.value),placeholder:"—"})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("span",{className:V,children:"Background:"}),e.jsxs("select",{className:ee,value:C,onChange:a=>M(a.target.value),children:[e.jsx("option",{value:"",children:"—"}),e.jsx("option",{value:"true",children:"true"}),e.jsx("option",{value:"false",children:"false"})]})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("span",{className:V,children:"Isolation:"}),e.jsx("select",{className:ee,value:H,onChange:a=>W(a.target.value),children:us.map(a=>e.jsx("option",{value:a,children:a||"—"},a))})]})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[e.jsxs("div",{className:"flex items-center gap-1 flex-1 min-w-[200px]",children:[e.jsx("span",{className:V,children:"Tools:"}),e.jsx(D,{className:"h-7 text-xs flex-1",value:A,onChange:a=>b(a.target.value),placeholder:"Read, Write, Bash, Glob, Grep"})]}),e.jsxs("div",{className:"flex items-center gap-1 flex-1 min-w-[200px]",children:[e.jsx("span",{className:V,children:"Disallowed:"}),e.jsx(D,{className:"h-7 text-xs flex-1",value:y,onChange:a=>i(a.target.value),placeholder:"e.g. Edit"})]}),e.jsxs("div",{className:"flex items-center gap-1 flex-1 min-w-[200px]",children:[e.jsx("span",{className:V,children:"Skills:"}),e.jsx(D,{className:"h-7 text-xs flex-1",value:g,onChange:a=>d(a.target.value),placeholder:"e.g. api-conventions"})]})]})]})]}),n?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(ce).map(([a,S])=>e.jsx(Ca,{installationPath:a,agents:S,onSaved:Z},a))})]})}function ts({value:s,onChange:t,placeholder:n}){const[l,c]=r.useState(!1),[m,x]=r.useState(null),p=qt(s,500);r.useEffect(()=>{if(p){c(!0),x(null);const f=setTimeout(()=>{p.trim().length>0?x(null):x("Path cannot be empty."),c(!1)},1e3);return()=>clearTimeout(f)}else x(null),c(!1)},[p]);const N=async()=>{const{selectFile:f}=await bt(async()=>{const{selectFile:F}=await import("./index-BUol9HDD.js").then(u=>u.gf);return{selectFile:F}},__vite__mapDeps([0,1])),P=s?s.replace(/[/\\][^/\\]*$/,""):void 0,w=await f(P);w.path&&!w.cancelled&&!w.error&&t(w.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(D,{value:s,onChange:f=>t(f.target.value),placeholder:n,className:z("flex-1",m&&"border-destructive")}),l&&e.jsx("div",{className:"absolute inset-y-0 right-0 flex items-center pr-3",children:e.jsx(ft,{className:"h-4 w-4 animate-spin text-muted-foreground"})})]}),e.jsx(j,{type:"button",variant:"outline",size:"sm",className:"shrink-0 h-9",onClick:N,title:"Browse",children:e.jsx(pt,{className:"w-4 h-4"})})]}),m&&e.jsx("p",{className:"text-xs text-destructive mt-1",children:m})]})}const Ta=new Set(["gemini","qwen","opencode"]),hs=new Set(["claude"]);function gs(s){return Ta.has(s)?"envFile":hs.has(s)?"settingsFile":"none"}function Ma({toolId:s,config:t,isDefault:n,isExpanded:l,toolAvailable:c,isSaving:m,onToggleExpand:x,onToggleEnabled:p,onSetDefault:N,onUpdateModel:f,onUpdateTags:P,onUpdateAvailableModels:w,onUpdateEnvFile:F,onUpdateSettingsFile:u,onUpdateEffort:v,onSaveToBackend:k}){const{formatMessage:h}=K(),[$,C]=r.useState(""),[M,H]=r.useState(""),W=()=>{const d=$.trim();d&&!t.tags.includes(d)&&(P([...t.tags,d]),C(""))},A=d=>{P(t.tags.filter(E=>E!==d))},b=()=>{const d=M.trim(),E=t.availableModels||[];d&&!E.includes(d)&&(w([...E,d]),H(""))},y=d=>{const E=t.availableModels||[];w(E.filter(O=>O!==d))},i=["分析","Debug","implementation","refactoring","testing"],g=gs(s);return e.jsxs(Q,{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(rs,{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}),n&&e.jsx(X,{variant:"default",className:"text-xs",children:h({id:"settings.cliTools.default"})}),e.jsx(X,{variant:"outline",className:"text-xs",children:t.type}),c!==void 0&&e.jsx("span",{className:z("inline-block w-2 h-2 rounded-full",c?"bg-green-500":"bg-red-400"),title:c?"Available":"Unavailable"})]}),e.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:t.primaryModel})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(j,{variant:t.enabled?"default":"outline",size:"sm",className:"h-8",onClick:d=>{d.stopPropagation(),p()},children:t.enabled?e.jsxs(e.Fragment,{children:[e.jsx(ie,{className:"w-4 h-4 mr-1"}),h({id:"settings.cliTools.enabled"})]}):e.jsxs(e.Fragment,{children:[e.jsx(ae,{className:"w-4 h-4 mr-1"}),h({id:"settings.cliTools.disabled"})]})}),l?e.jsx(Re,{className:"w-5 h-5 text-muted-foreground"}):e.jsx(Pe,{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(d=>e.jsx(X,{variant:"secondary",className:"text-xs",children:d},d))})]}),l&&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(D,{value:t.primaryModel,onChange:d=>f("primaryModel",d.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(D,{value:t.secondaryModel,onChange:d=>f("secondaryModel",d.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(d=>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:[d,e.jsx("button",{type:"button",onClick:()=>A(d),className:"hover:text-destructive transition-colors","aria-label":h({id:"apiSettings.cliSettings.removeTag"}),children:e.jsx(ae,{className:"w-3 h-3"})})]},d)),e.jsx("input",{type:"text",value:$,onChange:d=>C(d.target.value),onKeyDown:d=>{d.key==="Enter"&&(d.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(j,{type:"button",size:"sm",onClick:W,variant:"outline",className:"shrink-0",children:e.jsx(ve,{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"}),":"]}),i.map(d=>e.jsx("button",{type:"button",onClick:()=>{t.tags.includes(d)||P([...t.tags,d])},disabled:t.tags.includes(d),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:d},d))]})]}),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(d=>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:[d,e.jsx("button",{type:"button",onClick:()=>y(d),className:"hover:text-destructive transition-colors",children:e.jsx(ae,{className:"w-3 h-3"})})]},d)),e.jsx("input",{type:"text",value:M,onChange:d=>H(d.target.value),onKeyDown:d=>{d.key==="Enter"&&(d.preventDefault(),b())},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(j,{type:"button",size:"sm",onClick:b,variant:"outline",className:"shrink-0",children:e.jsx(ve,{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(ts,{value:t.envFile||"",onChange:d=>F(d||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(ts,{value:t.settingsFile||"",onChange:d=>u(d||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(d=>{const E=t.effort||"high",O=`settings.cliTools.effort${d.charAt(0).toUpperCase()+d.slice(1)}`;return e.jsx("button",{type:"button",onClick:()=>v(d==="high"&&!t.effort?void 0:d),className:z("px-3 py-1.5 rounded-md text-sm border transition-colors",E===d?"bg-primary text-primary-foreground border-primary":"border-border hover:bg-muted"),children:h({id:O})},d)})}),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:[!n&&t.enabled&&e.jsx(j,{variant:"outline",size:"sm",onClick:N,children:h({id:"settings.cliTools.setDefault"})}),e.jsxs(j,{variant:"default",size:"sm",onClick:k,disabled:m,children:[e.jsx(Fe,{className:"w-4 h-4 mr-1"}),h(m?{id:"settings.cliTools.saving"}:{id:"settings.cliTools.saveToConfig"})]})]})]})]})}function Ea(){const{formatMessage:s}=K(),{data:t,isLoading:n}=Tt(),{toggle:l,isPending:c}=Mt(),{data:m,isLoading:x}=Et(),{toggle:p,isPending:N}=Pt(),{data:f,isLoading:P}=Ft(),{toggle:w,isPending:F}=Dt(),{refresh:u,isPending:v}=Lt(),{exportSettings:k,isPending:h}=Ut(),{importSettings:$,isPending:C}=It(),M=r.useRef(null),H=r.useCallback(async()=>{try{const A=await k(),b=new Blob([JSON.stringify(A,null,2)],{type:"application/json"}),y=URL.createObjectURL(b),i=document.createElement("a"),g=new Date().toISOString().replace(/[:.]/g,"-").slice(0,19);i.href=y,i.download=`ccw-settings-${g}.json`,document.body.appendChild(i),i.click(),document.body.removeChild(i),URL.revokeObjectURL(y),R.success(s({id:"settings.responseLanguage.exportSuccess"}))}catch{R.error(s({id:"settings.responseLanguage.exportError"}))}},[k,s]),W=r.useCallback(async A=>{var y;const b=(y=A.target.files)==null?void 0:y[0];if(b){if(A.target.value="",!b.name.endsWith(".json")&&b.type!=="application/json"){R.error(s({id:"settings.responseLanguage.importInvalidFile"}));return}try{const i=await b.text(),g=JSON.parse(i);if(!g.version||!g.endpoints){R.error(s({id:"settings.responseLanguage.importInvalidStructure"}));return}const d=await $(g);d.success?R.success(s({id:"settings.responseLanguage.importSuccess"},{imported:d.imported,skipped:d.skipped})):R.error(s({id:"settings.responseLanguage.importError"}))}catch(i){i instanceof SyntaxError?R.error(s({id:"settings.responseLanguage.importInvalidJson"})):R.error(s({id:"settings.responseLanguage.importError"}))}}},[$,s]);return e.jsxs(Q,{className:"p-6",children:[e.jsxs("h2",{className:"text-lg font-semibold text-foreground flex items-center gap-2 mb-4",children:[e.jsx(Qt,{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(X,{variant:"default",className:"text-xs",children:"Claude"})]}),e.jsx(j,{variant:t!=null&&t.claudeEnabled?"default":"outline",size:"sm",className:"h-7",disabled:n||c,onClick:()=>l(!(t!=null&&t.claudeEnabled),"claude"),children:t!=null&&t.claudeEnabled?e.jsxs(e.Fragment,{children:[e.jsx(ie,{className:"w-4 h-4 mr-1"}),s({id:"settings.responseLanguage.enabled"})]}):e.jsxs(e.Fragment,{children:[e.jsx(ae,{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(X,{variant:"secondary",className:"text-xs",children:"Codex"})]}),e.jsx(j,{variant:t!=null&&t.codexEnabled?"default":"outline",size:"sm",className:"h-7",disabled:n||c,onClick:()=>l(!(t!=null&&t.codexEnabled),"codex"),children:t!=null&&t.codexEnabled?e.jsxs(e.Fragment,{children:[e.jsx(ie,{className:"w-4 h-4 mr-1"}),s({id:"settings.responseLanguage.enabled"})]}):e.jsxs(e.Fragment,{children:[e.jsx(ae,{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(_e,{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(dt,{className:"w-4 h-4 text-muted-foreground"}),e.jsx("span",{className:"text-sm font-medium",children:s({id:"settings.responseLanguage.windowsPlatform"})})]}),e.jsx(j,{variant:m!=null&&m.enabled?"default":"outline",size:"sm",className:"h-7",disabled:x||N,onClick:()=>p(!(m!=null&&m.enabled)),children:m!=null&&m.enabled?e.jsxs(e.Fragment,{children:[e.jsx(ie,{className:"w-4 h-4 mr-1"}),s({id:"settings.responseLanguage.enabled"})]}):e.jsxs(e.Fragment,{children:[e.jsx(ae,{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(mt,{className:"w-4 h-4 text-muted-foreground"}),e.jsx("span",{className:"text-sm font-medium",children:s({id:"settings.responseLanguage.cliEnhancement"})}),e.jsx(X,{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(j,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0",disabled:P||v,onClick:()=>u(),title:s({id:"settings.responseLanguage.refreshConfig"}),children:e.jsx(ue,{className:z("w-3.5 h-3.5",v&&"animate-spin")})}),e.jsx(j,{variant:f!=null&&f.enabled?"default":"outline",size:"sm",className:"h-7",disabled:P||F,onClick:()=>w(!(f!=null&&f.enabled)),children:f!=null&&f.enabled?e.jsxs(e.Fragment,{children:[e.jsx(ie,{className:"w-4 h-4 mr-1"}),s({id:"settings.responseLanguage.enabled"})]}):e.jsxs(e.Fragment,{children:[e.jsx(ae,{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(j,{variant:"outline",size:"sm",className:"h-7",disabled:C,onClick:()=>{var A;return(A=M.current)==null?void 0:A.click()},children:C?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(Wt,{className:"w-3.5 h-3.5 mr-1"}),s({id:"settings.responseLanguage.import"})]})}),e.jsx(j,{variant:"outline",size:"sm",className:"h-7",disabled:h,onClick:H,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(ut,{className:"w-3.5 h-3.5 mr-1"}),s({id:"settings.responseLanguage.export"})]})})]})]})})]})}function Pa(){const{formatMessage:s}=K(),[t,n]=r.useState(null),[l,c]=r.useState(!1),[m,x]=r.useState(null),[p,N]=r.useState(null),[f,P]=r.useState(()=>{try{const u=localStorage.getItem("ccw.autoUpdate");return u===null?!0:JSON.parse(u)}catch{return!0}}),w=async(u=!1)=>{u||c(!0),x(null);try{const v=await fetch("/api/version-check");if(!v.ok)throw new Error(`HTTP ${v.status}`);const k=await v.json();if(!k.currentVersion)throw new Error("Invalid response");n(k),N(new Date)}catch(v){u||x(v instanceof Error?v.message:"Unknown error")}finally{c(!1)}};r.useEffect(()=>{if(w(!0),!f)return;const u=setInterval(()=>w(!0),3600*1e3);return()=>clearInterval(u)},[f]);const F=u=>{P(u),localStorage.setItem("ccw.autoUpdate",JSON.stringify(u))};return e.jsxs(Q,{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(is,{className:"w-5 h-5"}),s({id:"settings.versionCheck.title"})]}),e.jsxs(j,{variant:"outline",size:"sm",disabled:l,onClick:()=>w(),children:[e.jsx(ue,{className:z("w-3.5 h-3.5 mr-1.5",l&&"animate-spin")}),s(l?{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(X,{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(X,{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")})]}),m&&e.jsxs("div",{className:"flex items-center gap-2 pt-2 border-t border-border",children:[e.jsx(_e,{className:"w-4 h-4 text-destructive flex-shrink-0"}),e.jsxs("span",{className:"text-sm text-destructive",children:[s({id:"settings.versionCheck.checkFailed"}),": ",m]})]})]}),(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(j,{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:u=>F(u.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 Fa(){const{formatMessage:s}=K(),{installations:t,isLoading:n,refetch:l}=At(),{upgrade:c,isPending:m}=Ot(),{data:x}=Ht();return e.jsxs(Q,{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(Gt,{className:"w-5 h-5"}),s({id:"settings.systemStatus.title"}),!n&&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(j,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0",onClick:()=>l(),title:s({id:"settings.systemStatus.refresh"}),children:e.jsx(ue,{className:z("w-3.5 h-3.5",n&&"animate-spin")})})})]}),n?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 N=p.installation_mode==="Global",f=new Date(p.installation_date).toLocaleDateString(),P=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",N?"bg-primary/10 text-primary":"bg-orange-500/10 text-orange-500"),children:N?e.jsx(xt,{className:"w-4 h-4"}):e.jsx(Kt,{className:"w-4 h-4"})}),e.jsx("span",{className:"text-sm font-medium",children:s(N?{id:"settings.systemStatus.global"}:{id:"settings.systemStatus.path"})}),e.jsxs(X,{variant:"secondary",className:"text-xs font-mono",children:["v",P]})]}),e.jsxs(j,{variant:"ghost",size:"sm",className:"h-7",disabled:m,onClick:()=>c(p.installation_path),children:[e.jsx(is,{className:z("w-3.5 h-3.5 mr-1",m&&"animate-spin")}),s(m?{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(ht,{className:"w-3 h-3"}),f]}),e.jsxs("span",{className:"inline-flex items-center gap-1",children:[e.jsx(gt,{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(_e,{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 Da({cliTools:s,defaultCliTool:t,expandedTools:n,savingTools:l,onToggleExpand:c,onToggleEnabled:m,onSetDefault:x,onUpdateModel:p,onUpdateTags:N,onUpdateAvailableModels:f,onUpdateEnvFile:P,onUpdateSettingsFile:w,onUpdateEffort:F,onSaveToBackend:u,formatMessage:v}){const{data:k}=Bt();return e.jsxs(e.Fragment,{children:[e.jsxs("p",{className:"text-sm text-muted-foreground mb-4",children:[v({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,$])=>{const C=k==null?void 0:k[h];return e.jsx(Ma,{toolId:h,config:$,isDefault:h===t,isExpanded:n.has(h),toolAvailable:C==null?void 0:C.available,isSaving:l.has(h),onToggleExpand:()=>c(h),onToggleEnabled:()=>m(h),onSetDefault:()=>x(h),onUpdateModel:(M,H)=>p(h,M,H),onUpdateTags:M=>N(h,M),onUpdateAvailableModels:M=>f(h,M),onUpdateEnvFile:M=>P(h,M),onUpdateSettingsFile:M=>w(h,M),onUpdateEffort:M=>F(h,M),onSaveToBackend:()=>u(h)},h)})})]})}function Ya(){const{formatMessage:s}=K(),{theme:t,setTheme:n}=Be(),l=Me(rt),c=Me(it),m=Me(lt),{updateCliTool:x,setDefaultCliTool:p,setUserPreferences:N,resetUserPreferences:f}=Me(),[P,w]=r.useState(new Set),[F,u]=r.useState(new Set),v=i=>{w(g=>{const d=new Set(g);return d.has(i)?d.delete(i):d.add(i),d})},k=i=>{x(i,{enabled:!l[i].enabled})},h=i=>{p(i)},$=(i,g,d)=>{x(i,{[g]:d})},C=(i,g)=>{x(i,{tags:g})},M=(i,g)=>{x(i,{availableModels:g})},H=(i,g)=>{x(i,{envFile:g})},W=r.useCallback(async(i,g)=>{var d,E;if(x(i,{settingsFile:g}),g&&hs.has(i))try{const O=await Ne("/api/cli/parse-settings",{method:"POST",body:JSON.stringify({path:g})});if(O.primaryModel||O.secondaryModel||(d=O.availableModels)!=null&&d.length){const q={};O.primaryModel&&(q.primaryModel=O.primaryModel),O.secondaryModel&&(q.secondaryModel=O.secondaryModel),(E=O.availableModels)!=null&&E.length&&(q.availableModels=O.availableModels),x(i,q),R.success(`Models loaded from settings: ${O.primaryModel||"default"}`,{duration:3e3})}}catch{}},[x]),A=(i,g)=>{x(i,{effort:g})},b=r.useCallback(async i=>{const g=l[i];if(g){u(d=>new Set(d).add(i));try{const d={enabled:g.enabled,primaryModel:g.primaryModel,secondaryModel:g.secondaryModel,tags:g.tags,availableModels:g.availableModels},E=gs(i);E==="envFile"?d.envFile=g.envFile||null:E==="settingsFile"&&(d.settingsFile=g.settingsFile||null,d.effort=g.effort||null),await Ne(`/api/cli/config/${i}`,{method:"PUT",body:JSON.stringify(d)}),R.success(s({id:"settings.cliTools.configSaved"}),{description:i})}catch{R.error(s({id:"settings.cliTools.configSaveError"}),{description:i})}finally{u(d=>{const E=new Set(d);return E.delete(i),E})}}},[l,s]),y=(i,g)=>{N({[i]: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(ot,{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(Q,{className:"p-6",children:[e.jsxs("h2",{className:"text-lg font-semibold text-foreground flex items-center gap-2 mb-4",children:[e.jsx(ct,{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(ra,{})]}),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(j,{variant:t==="system"?"default":"outline",size:"sm",onClick:()=>n("system"),children:s({id:"settings.appearance.themeOptions.system"})})]})]})]}),e.jsxs(Q,{className:"p-6",children:[e.jsxs("h2",{className:"text-lg font-semibold text-foreground flex items-center gap-2 mb-4",children:[e.jsx(ls,{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(la,{})]})})]}),e.jsx(Ea,{}),e.jsx(Na,{}),e.jsx(Fa,{}),e.jsx(Pa,{}),e.jsxs(Q,{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.cliTools"})]}),e.jsx(Da,{cliTools:l,defaultCliTool:c,expandedTools:P,savingTools:F,onToggleExpand:v,onToggleEnabled:k,onSetDefault:h,onUpdateModel:$,onUpdateTags:C,onUpdateAvailableModels:M,onUpdateEnvFile:H,onUpdateSettingsFile:W,onUpdateEffort:A,onSaveToBackend:b,formatMessage:s})]}),e.jsx(Sa,{}),e.jsxs(Q,{className:"p-6",children:[e.jsxs("h2",{className:"text-lg font-semibold text-foreground flex items-center gap-2 mb-4",children:[e.jsx(ue,{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(j,{variant:m.autoRefresh?"default":"outline",size:"sm",onClick:()=>y("autoRefresh",!m.autoRefresh),children:m.autoRefresh?s({id:"settings.dataRefresh.enabled"}):s({id:"settings.dataRefresh.disabled"})})]}),m.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(i=>e.jsxs(j,{variant:m.refreshInterval===i?"default":"outline",size:"sm",onClick:()=>y("refreshInterval",i),children:[i/1e3,"s"]},i))})]})]})]}),e.jsxs(Q,{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(j,{variant:m.notificationsEnabled?"default":"outline",size:"sm",onClick:()=>y("notificationsEnabled",!m.notificationsEnabled),children:m.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(j,{variant:m.soundEnabled?"default":"outline",size:"sm",onClick:()=>y("soundEnabled",!m.soundEnabled),children:m.soundEnabled?s({id:"settings.notifications.on"}):s({id:"settings.notifications.off"})})]})]})]}),e.jsx(pa,{}),e.jsxs(Q,{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(j,{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-C3SJajeT.js.map
|