@kaitranntt/ccs 7.79.1-dev.9 → 8.0.0-dev.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (196) hide show
  1. package/dist/bin/codex-runtime-router.d.ts.map +1 -1
  2. package/dist/bin/codex-runtime-router.js +38 -12
  3. package/dist/bin/codex-runtime-router.js.map +1 -1
  4. package/dist/ccs.js +2 -1
  5. package/dist/ccs.js.map +1 -1
  6. package/dist/cliproxy/ai-providers/codex-plan-compatibility.js +2 -2
  7. package/dist/cliproxy/ai-providers/codex-plan-compatibility.js.map +1 -1
  8. package/dist/cliproxy/ai-providers/codex-reasoning-proxy.d.ts +2 -2
  9. package/dist/cliproxy/ai-providers/codex-reasoning-proxy.d.ts.map +1 -1
  10. package/dist/cliproxy/ai-providers/codex-reasoning-proxy.js +16 -8
  11. package/dist/cliproxy/ai-providers/codex-reasoning-proxy.js.map +1 -1
  12. package/dist/cliproxy/ai-providers/model-id-normalizer.d.ts +1 -1
  13. package/dist/cliproxy/ai-providers/model-id-normalizer.d.ts.map +1 -1
  14. package/dist/cliproxy/ai-providers/model-id-normalizer.js +1 -1
  15. package/dist/cliproxy/ai-providers/model-id-normalizer.js.map +1 -1
  16. package/dist/cliproxy/auth/oauth-handler.d.ts +13 -1
  17. package/dist/cliproxy/auth/oauth-handler.d.ts.map +1 -1
  18. package/dist/cliproxy/auth/oauth-handler.js +111 -34
  19. package/dist/cliproxy/auth/oauth-handler.js.map +1 -1
  20. package/dist/cliproxy/auth/oauth-trace/redactor.d.ts.map +1 -1
  21. package/dist/cliproxy/auth/oauth-trace/redactor.js +9 -1
  22. package/dist/cliproxy/auth/oauth-trace/redactor.js.map +1 -1
  23. package/dist/cliproxy/config/generator.d.ts.map +1 -1
  24. package/dist/cliproxy/config/generator.js +5 -2
  25. package/dist/cliproxy/config/generator.js.map +1 -1
  26. package/dist/cliproxy/config/thinking-config.js +6 -6
  27. package/dist/cliproxy/config/thinking-config.js.map +1 -1
  28. package/dist/cliproxy/executor/env-resolver.js +1 -1
  29. package/dist/cliproxy/executor/env-resolver.js.map +1 -1
  30. package/dist/cliproxy/executor/session-bridge.d.ts.map +1 -1
  31. package/dist/cliproxy/executor/session-bridge.js +11 -8
  32. package/dist/cliproxy/executor/session-bridge.js.map +1 -1
  33. package/dist/cliproxy/quota/quota-fetcher-claude.d.ts.map +1 -1
  34. package/dist/cliproxy/quota/quota-fetcher-claude.js +35 -4
  35. package/dist/cliproxy/quota/quota-fetcher-claude.js.map +1 -1
  36. package/dist/cliproxy/quota/quota-manager.d.ts +1 -0
  37. package/dist/cliproxy/quota/quota-manager.d.ts.map +1 -1
  38. package/dist/cliproxy/quota/quota-manager.js +53 -2
  39. package/dist/cliproxy/quota/quota-manager.js.map +1 -1
  40. package/dist/cliproxy/services/oauth-usage-log-transformer.d.ts.map +1 -1
  41. package/dist/cliproxy/services/oauth-usage-log-transformer.js +5 -0
  42. package/dist/cliproxy/services/oauth-usage-log-transformer.js.map +1 -1
  43. package/dist/codex-auth/codex-profile-resources.d.ts +6 -0
  44. package/dist/codex-auth/codex-profile-resources.d.ts.map +1 -0
  45. package/dist/codex-auth/codex-profile-resources.js +119 -0
  46. package/dist/codex-auth/codex-profile-resources.js.map +1 -0
  47. package/dist/codex-auth/commands/create-command.d.ts.map +1 -1
  48. package/dist/codex-auth/commands/create-command.js +20 -6
  49. package/dist/codex-auth/commands/create-command.js.map +1 -1
  50. package/dist/codex-auth/index.d.ts +1 -0
  51. package/dist/codex-auth/index.d.ts.map +1 -1
  52. package/dist/codex-auth/index.js +4 -1
  53. package/dist/codex-auth/index.js.map +1 -1
  54. package/dist/commands/cliproxy/variant-subcommand.js +1 -1
  55. package/dist/commands/cliproxy/variant-subcommand.js.map +1 -1
  56. package/dist/commands/command-catalog.d.ts +1 -1
  57. package/dist/commands/command-catalog.d.ts.map +1 -1
  58. package/dist/commands/command-catalog.js +10 -1
  59. package/dist/commands/command-catalog.js.map +1 -1
  60. package/dist/commands/completion-backend.d.ts.map +1 -1
  61. package/dist/commands/completion-backend.js +2 -0
  62. package/dist/commands/completion-backend.js.map +1 -1
  63. package/dist/commands/config-command.d.ts +2 -0
  64. package/dist/commands/config-command.d.ts.map +1 -1
  65. package/dist/commands/config-command.js +31 -20
  66. package/dist/commands/config-command.js.map +1 -1
  67. package/dist/commands/docker/finalize-key-rotation-subcommand.d.ts +2 -0
  68. package/dist/commands/docker/finalize-key-rotation-subcommand.d.ts.map +1 -0
  69. package/dist/commands/docker/finalize-key-rotation-subcommand.js +79 -0
  70. package/dist/commands/docker/finalize-key-rotation-subcommand.js.map +1 -0
  71. package/dist/commands/docker/help-subcommand.d.ts.map +1 -1
  72. package/dist/commands/docker/help-subcommand.js +6 -0
  73. package/dist/commands/docker/help-subcommand.js.map +1 -1
  74. package/dist/commands/docker/index.d.ts.map +1 -1
  75. package/dist/commands/docker/index.js +4 -0
  76. package/dist/commands/docker/index.js.map +1 -1
  77. package/dist/commands/docker/show-key-subcommand.d.ts +2 -0
  78. package/dist/commands/docker/show-key-subcommand.d.ts.map +1 -0
  79. package/dist/commands/docker/show-key-subcommand.js +96 -0
  80. package/dist/commands/docker/show-key-subcommand.js.map +1 -0
  81. package/dist/commands/docker/up-subcommand.d.ts.map +1 -1
  82. package/dist/commands/docker/up-subcommand.js +4 -0
  83. package/dist/commands/docker/up-subcommand.js.map +1 -1
  84. package/dist/commands/persist-command.d.ts.map +1 -1
  85. package/dist/commands/persist-command.js +77 -5
  86. package/dist/commands/persist-command.js.map +1 -1
  87. package/dist/docker/docker-bootstrap.d.ts +1 -1
  88. package/dist/docker/docker-bootstrap.d.ts.map +1 -1
  89. package/dist/docker/docker-bootstrap.js +99 -3
  90. package/dist/docker/docker-bootstrap.js.map +1 -1
  91. package/dist/docker/docker-executor.d.ts +3 -0
  92. package/dist/docker/docker-executor.d.ts.map +1 -1
  93. package/dist/docker/docker-executor.js +53 -0
  94. package/dist/docker/docker-executor.js.map +1 -1
  95. package/dist/docker/docker-key-rotation.d.ts +48 -0
  96. package/dist/docker/docker-key-rotation.d.ts.map +1 -0
  97. package/dist/docker/docker-key-rotation.js +179 -0
  98. package/dist/docker/docker-key-rotation.js.map +1 -0
  99. package/dist/management/checks/config-check.d.ts.map +1 -1
  100. package/dist/management/checks/config-check.js +10 -1
  101. package/dist/management/checks/config-check.js.map +1 -1
  102. package/dist/management/doctor.d.ts +1 -0
  103. package/dist/management/doctor.d.ts.map +1 -1
  104. package/dist/management/doctor.js +23 -0
  105. package/dist/management/doctor.js.map +1 -1
  106. package/dist/proxy/proxy-daemon.d.ts.map +1 -1
  107. package/dist/proxy/proxy-daemon.js +15 -3
  108. package/dist/proxy/proxy-daemon.js.map +1 -1
  109. package/dist/proxy/server/messages-route.d.ts.map +1 -1
  110. package/dist/proxy/server/messages-route.js +27 -1
  111. package/dist/proxy/server/messages-route.js.map +1 -1
  112. package/dist/shared/claude-extension-setup.d.ts.map +1 -1
  113. package/dist/shared/claude-extension-setup.js +21 -1
  114. package/dist/shared/claude-extension-setup.js.map +1 -1
  115. package/dist/shared/stale-codex-translator-settings.d.ts +4 -0
  116. package/dist/shared/stale-codex-translator-settings.d.ts.map +1 -0
  117. package/dist/shared/stale-codex-translator-settings.js +35 -0
  118. package/dist/shared/stale-codex-translator-settings.js.map +1 -0
  119. package/dist/targets/codex-adapter.d.ts.map +1 -1
  120. package/dist/targets/codex-adapter.js +64 -5
  121. package/dist/targets/codex-adapter.js.map +1 -1
  122. package/dist/ui/assets/{Trans-J6qQqjkU.js → Trans-dEd8UC39.js} +1 -1
  123. package/dist/ui/assets/{accounts-B9Y9uOFl.js → accounts-B2THsSu_.js} +1 -1
  124. package/dist/ui/assets/{alert-dialog-B7gsksZn.js → alert-dialog-Vurq1xzV.js} +1 -1
  125. package/dist/ui/assets/{api-Cz8U6P7R.js → api-CjLfG9mL.js} +1 -1
  126. package/dist/ui/assets/{auth-section-C8dzvYje.js → auth-section-iGkrMaT4.js} +1 -1
  127. package/dist/ui/assets/{backups-section-D0dn59k8.js → backups-section-DUGG_4KP.js} +1 -1
  128. package/dist/ui/assets/{channels-BEmwDrRW.js → channels-CimlCc2d.js} +1 -1
  129. package/dist/ui/assets/{checkbox-DD0s2D_O.js → checkbox-HiMHasEB.js} +1 -1
  130. package/dist/ui/assets/claude-extension-B2v9bsN9.js +1 -0
  131. package/dist/ui/assets/{cliproxy-ai-providers-B440rPlH.js → cliproxy-ai-providers-2lI5jSHb.js} +6 -6
  132. package/dist/ui/assets/{cliproxy-control-panel-Bo-Y41B_.js → cliproxy-control-panel-63gDI-e5.js} +1 -1
  133. package/dist/ui/assets/cliproxy-fai69Vyd.js +4 -0
  134. package/dist/ui/assets/{codex-DPe04ol4.js → codex-i_hfI4Tv.js} +1 -1
  135. package/dist/ui/assets/{confirm-dialog-MQNmqmha.js → confirm-dialog-B_6SrSxL.js} +1 -1
  136. package/dist/ui/assets/{copilot-COZj29YU.js → copilot-BgG5x_X6.js} +2 -2
  137. package/dist/ui/assets/{cursor-D0occhsH.js → cursor-DF63lFcy.js} +1 -1
  138. package/dist/ui/assets/droid-CqlQmFtN.js +2 -0
  139. package/dist/ui/assets/{globalenv-section-BwuNrdbO.js → globalenv-section-CYNmD12i.js} +1 -1
  140. package/dist/ui/assets/{health-DjNOO9K-.js → health-7ZO5PEm9.js} +1 -1
  141. package/dist/ui/assets/{index-Bnzie_zG.js → index-BC5ssPfF.js} +1 -1
  142. package/dist/ui/assets/index-BMoGhs28.css +1 -0
  143. package/dist/ui/assets/{index-i2MPNni3.js → index-Bgcd4FYK.js} +1 -1
  144. package/dist/ui/assets/{index-CmOBelFi.js → index-CFu0saCM.js} +1 -1
  145. package/dist/ui/assets/index-CqsmdQoA.js +1 -0
  146. package/dist/ui/assets/{index-CjM3Ehb8.js → index-D3kxCuJ7.js} +1 -1
  147. package/dist/ui/assets/{index-CSlgRg0s.js → index-DmV9wJET.js} +3 -3
  148. package/dist/ui/assets/{index-Bm_0r3qk.js → index-hHb9o079.js} +1 -1
  149. package/dist/ui/assets/{logs-7bWvuc1l.js → logs-Dy-yZhIK.js} +1 -1
  150. package/dist/ui/assets/{masked-input-D_amxi96.js → masked-input-BSLeznEs.js} +1 -1
  151. package/dist/ui/assets/{proxy-status-widget-BkC-wCtI.js → proxy-status-widget-hRH1agF9.js} +1 -1
  152. package/dist/ui/assets/{raw-json-settings-editor-panel-CVP5Bjfm.js → raw-json-settings-editor-panel-Bs83yILR.js} +1 -1
  153. package/dist/ui/assets/{searchable-select-e5sY7o6g.js → searchable-select-pXUC_0Ih.js} +1 -1
  154. package/dist/ui/assets/{separator-BR5bmtI7.js → separator-FZR_61I9.js} +1 -1
  155. package/dist/ui/assets/{shared-CsqW2cFN.js → shared-BiIwM7--.js} +1 -1
  156. package/dist/ui/assets/{table-DPheAd4c.js → table-_9IusQ8G.js} +1 -1
  157. package/dist/ui/assets/{updates-D07RjKLJ.js → updates-ButNfJqt.js} +1 -1
  158. package/dist/ui/assets/{use-accounts-CWVR2NXQ.js → use-accounts-BdtI0lBv.js} +1 -1
  159. package/dist/ui/index.html +2 -2
  160. package/dist/utils/claude-subcommand-detector.d.ts +12 -3
  161. package/dist/utils/claude-subcommand-detector.d.ts.map +1 -1
  162. package/dist/utils/claude-subcommand-detector.js +59 -12
  163. package/dist/utils/claude-subcommand-detector.js.map +1 -1
  164. package/dist/web-server/routes/cliproxy-stats-routes.d.ts +8 -0
  165. package/dist/web-server/routes/cliproxy-stats-routes.d.ts.map +1 -1
  166. package/dist/web-server/routes/cliproxy-stats-routes.js +13 -26
  167. package/dist/web-server/routes/cliproxy-stats-routes.js.map +1 -1
  168. package/dist/web-server/services/cliproxy-dashboard-restart-service.d.ts +21 -0
  169. package/dist/web-server/services/cliproxy-dashboard-restart-service.d.ts.map +1 -0
  170. package/dist/web-server/services/cliproxy-dashboard-restart-service.js +49 -0
  171. package/dist/web-server/services/cliproxy-dashboard-restart-service.js.map +1 -0
  172. package/dist/web-server/services/codex-dashboard-service.d.ts.map +1 -1
  173. package/dist/web-server/services/codex-dashboard-service.js +30 -3
  174. package/dist/web-server/services/codex-dashboard-service.js.map +1 -1
  175. package/dist/web-server/usage/aggregator.d.ts +13 -7
  176. package/dist/web-server/usage/aggregator.d.ts.map +1 -1
  177. package/dist/web-server/usage/aggregator.js +37 -22
  178. package/dist/web-server/usage/aggregator.js.map +1 -1
  179. package/dist/web-server/usage/handlers.d.ts +1 -0
  180. package/dist/web-server/usage/handlers.d.ts.map +1 -1
  181. package/dist/web-server/usage/handlers.js +16 -8
  182. package/dist/web-server/usage/handlers.js.map +1 -1
  183. package/dist/web-server/usage/profile-filter.d.ts +13 -0
  184. package/dist/web-server/usage/profile-filter.d.ts.map +1 -0
  185. package/dist/web-server/usage/profile-filter.js +30 -0
  186. package/dist/web-server/usage/profile-filter.js.map +1 -0
  187. package/dist/web-server/usage/types.d.ts +8 -0
  188. package/dist/web-server/usage/types.d.ts.map +1 -1
  189. package/lib/mcp/ccs-browser-server.cjs +217 -12
  190. package/package.json +1 -1
  191. package/scripts/docker-dashboard-sunset-guard.js +171 -0
  192. package/dist/ui/assets/claude-extension-DHVBsw6b.js +0 -1
  193. package/dist/ui/assets/cliproxy-BMlbpAIO.js +0 -4
  194. package/dist/ui/assets/droid-CSaYFApd.js +0 -2
  195. package/dist/ui/assets/index-D9HfyuQr.js +0 -1
  196. package/dist/ui/assets/index-G3mgTfgR.css +0 -1
@@ -1 +1 @@
1
- import{j as e}from"./radix-ui-nu4wz29m.js";import{r as o}from"./react-vendor-Bjx91N7w.js";import{by as ie,bz as ne,Y as E,a as Y,bA as oe,bi as O,bk as R,d as h,n as le,c as w,L as f,I as T,r as $,s as H,t as F,v as U,w as V,aI as G,M as ce,N as ue,O as xe}from"./index-CSlgRg0s.js";import{m as g,A as me}from"./proxy-C4-M_9kB.js";import{R as N,I as B,x as k,ab as ge,_ as be,bc as pe,w as Q,$ as he,a6 as fe,e as we,s as je}from"./icons-DzKUh8vG.js";import"./tanstack-bhJxV1h8.js";import"./notifications-B4_o8bcr.js";import"./utils-CzKF5WmX.js";import"./form-utils-CuHzLhJZ.js";import"./charts-eIPy2oG6.js";function ve(r,s){return{claude:{...r.claude,...s.claude},codex:{...r.codex,...s.codex}}}function Ne(){const{state:r}=ie(),s=ne(),i=o.useCallback(async()=>{try{s.setBrowserLoading(!0),s.setBrowserError(null);const d=await E.browser.get();s.setBrowserConfig(d.config),s.setBrowserStatus(d.status)}catch(d){s.setBrowserError(d.message)}finally{s.setBrowserLoading(!1),s.setBrowserStatusLoading(!1)}},[s]),a=o.useCallback(async()=>{try{s.setBrowserStatusLoading(!0),s.setBrowserError(null);const d=await E.browser.getStatus();return s.setBrowserStatus(d),d}catch(d){return s.setBrowserError(d.message),null}finally{s.setBrowserStatusLoading(!1)}},[s]),c=o.useCallback(async d=>{const l=r.browserConfig;if(!l)return!1;const b=ve(l,d);s.setBrowserConfig(b);try{s.setBrowserSaving(!0),s.setBrowserError(null);const x=await E.browser.update(d);return s.setBrowserConfig(x.browser.config),s.setBrowserStatus(x.browser.status),s.setBrowserSuccess(!0),window.setTimeout(()=>s.setBrowserSuccess(!1),1500),!0}catch(x){return s.setBrowserConfig(l),s.setBrowserError(x.message),!1}finally{s.setBrowserSaving(!1)}},[s,r.browserConfig]);return{config:r.browserConfig,status:r.browserStatus,loading:r.browserLoading,statusLoading:r.browserStatusLoading,saving:r.browserSaving,error:r.browserError,success:r.browserSuccess,fetchConfig:i,fetchStatus:a,saveConfig:c}}function ke(r){const s=r.toLowerCase();return s.includes("mac")?"darwin":s.includes("win")?"win32":"linux"}function ye(r=navigator){const s=typeof r.userAgentData?.platform=="string"?r.userAgentData.platform:"",i=typeof r.platform=="string"&&r.platform.trim()?r.platform:r.userAgent;return ke(s||i||"")}function Se(r){if(!/^\d+$/.test(r.trim()))return null;const s=Number.parseInt(r.trim(),10);return s<1||s>65535?null:s}const q=["disabled","readonly","readwrite"];function D(r,s){return r(`settingsPage.browserSection.evalMode.options.${s}`)}function Ce(r,s,i){const a=JSON.stringify(r);return i==="darwin"?`open -na "Google Chrome" --args --remote-debugging-port=${s} --user-data-dir=${a}`:i==="win32"?`chrome.exe --remote-debugging-port=${s} --user-data-dir=${a}`:`google-chrome --remote-debugging-port=${s} --user-data-dir=${a}`}function J({children:r,className:s,title:i,description:a,badge:c,action:d}){return e.jsx("div",{className:w("group relative overflow-hidden rounded-[2.5rem] border border-border/60 bg-muted/20 p-1.5 transition-all duration-700 ease-[cubic-bezier(0.32,0.72,0,1)] dark:border-white/[0.08] dark:bg-zinc-900/35",s),children:e.jsxs("div",{className:"relative overflow-hidden rounded-[calc(2.5rem-0.375rem)] border border-border/70 bg-card/90 shadow-[0_12px_36px_-18px_rgba(15,23,42,0.18)] dark:border-white/[0.08] dark:bg-zinc-900/70 dark:shadow-[0_18px_44px_-24px_rgba(0,0,0,0.55)]",children:[e.jsx("div",{className:"pointer-events-none absolute inset-0 shadow-[inset_0_1px_0_rgba(255,255,255,0.28)] dark:shadow-[inset_0_1px_0_rgba(255,255,255,0.04)]"}),(i||d)&&e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-4 border-b border-border/60 px-8 py-6 dark:border-white/[0.06]",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("h3",{className:"text-xl font-semibold tracking-tight",children:i}),c]}),a&&e.jsx("p",{className:"text-sm text-muted-foreground",children:a})]}),d&&e.jsx("div",{className:"flex items-center gap-2",children:d})]}),e.jsx("div",{className:"px-8 py-8",children:r})]})})}function K({state:r,title:s,detail:i,nextStep:a}){const{t:c}=Y(),d=r==="ready"||r==="enabled",l=!d&&r!=="disabled";return e.jsx("div",{className:w("relative overflow-hidden rounded-2xl border p-4 transition-all duration-500",d?"border-emerald-500/20 bg-emerald-500/[0.03] dark:bg-emerald-500/[0.02]":l?"border-amber-500/20 bg-amber-500/[0.03] dark:bg-amber-500/[0.02]":"border-border/60 bg-muted/30 dark:border-white/[0.06] dark:bg-zinc-900/45"),children:e.jsxs("div",{className:"flex items-start gap-4",children:[e.jsx("div",{className:w("flex h-10 w-10 shrink-0 items-center justify-center rounded-xl transition-transform duration-500 group-hover:scale-110",d?"bg-emerald-500/10 text-emerald-600":l?"bg-amber-500/10 text-amber-600":"bg-slate-500/10 text-slate-500"),children:d?e.jsx(k,{size:24}):l?e.jsx(Q,{size:24}):e.jsx(B,{size:24})}),e.jsxs("div",{className:"min-w-0 flex-1 space-y-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-sm font-semibold uppercase tracking-wider text-muted-foreground/60",children:c("settingsPage.browserSection.readiness")}),d&&e.jsx(g.span,{animate:{opacity:[.4,1,.4]},transition:{duration:2,repeat:1/0},className:"h-1.5 w-1.5 rounded-full bg-emerald-500"})]}),e.jsx("h4",{className:"font-medium text-foreground",children:s}),e.jsx("p",{className:"text-sm leading-relaxed text-muted-foreground",children:i}),a&&e.jsxs("div",{className:"mt-3 flex items-start gap-2 rounded-lg border border-border/50 bg-muted/35 p-3 dark:border-white/[0.05] dark:bg-zinc-900/45",children:[e.jsx(fe,{size:14,className:"mt-0.5 shrink-0 text-primary"}),e.jsxs("p",{className:"text-xs leading-normal",children:[e.jsxs("span",{className:"font-semibold text-primary",children:[c("settingsPage.browserSection.nextStep"),":"]})," ",a]})]})]})]})})}function W({title:r,children:s,defaultOpen:i=!1}){const[a,c]=o.useState(i);return e.jsxs(ce,{open:a,onOpenChange:c,className:"overflow-hidden rounded-2xl border border-border/60 bg-muted/20 dark:border-white/[0.06] dark:bg-zinc-900/30",children:[e.jsx(ue,{asChild:!0,children:e.jsxs("button",{className:"flex w-full items-center justify-between px-6 py-4 text-sm font-medium transition-colors hover:bg-muted/40 dark:hover:bg-zinc-900/50",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(we,{size:16,className:"text-muted-foreground"}),r]}),e.jsx(je,{size:16,className:w("transition-transform duration-300",a&&"rotate-180")})]})}),e.jsx(xe,{children:e.jsx("div",{className:"border-t border-border/60 px-6 py-6 dark:border-white/[0.06]",children:s})})]})}function Oe(){const{t:r}=Y(),{fetchRawConfig:s}=oe(),{config:i,status:a,loading:c,statusLoading:d,saving:l,error:b,success:x,fetchConfig:y,fetchStatus:L,saveConfig:S}=Ne(),[Z,m]=o.useState(null),[ee,C]=o.useState(null),[P,p]=o.useState(null);o.useEffect(()=>{y()},[y]),o.useEffect(()=>{if(!P&&!x)return;const n=window.setTimeout(()=>p(null),2500);return()=>window.clearTimeout(n)},[P,x]);const t=Z??i,j=o.useMemo(()=>t?Ce(t.claude.userDataDir,t.claude.devtoolsPort,ye()):"",[t]),M=ee??String(t?.claude.devtoolsPort??9222),v=Se(M),z=M.trim().length>0&&v===null,_=i!==null&&t!==null&&(i.claude.enabled!==t.claude.enabled||i.claude.userDataDir!==t.claude.userDataDir||i.claude.devtoolsPort!==v||i.claude.evalMode!==t.claude.evalMode),re=i!==null&&t!==null&&(i.codex.enabled!==t.codex.enabled||i.codex.evalMode!==t.codex.evalMode),I=o.useCallback(async()=>{p(null),m(null),C(null),await Promise.all([y(),s()])},[y,s]),se=o.useCallback(async()=>{await L()&&p(r("settingsPage.browserSection.messages.statusRefreshed"))},[L,r]),ae=o.useCallback(async()=>{if(!t||v===null)return;await S({claude:{enabled:t.claude.enabled,userDataDir:t.claude.userDataDir.trim(),devtoolsPort:v,evalMode:t.claude.evalMode}})&&(await s(),p(null),m(null),C(null))},[v,t,s,S]),te=o.useCallback(async()=>{if(!t)return;await S({codex:{enabled:t.codex.enabled,evalMode:t.codex.evalMode}})&&(await s(),p(null),m(null),C(null))},[t,s,S]),de=o.useCallback(async()=>{j&&(await navigator.clipboard.writeText(j),p(r("settingsPage.browserSection.messages.launchCommandCopied")))},[j,r]);return c?e.jsx("div",{className:"flex flex-1 items-center justify-center",children:e.jsxs("div",{className:"flex flex-col items-center gap-4 text-muted-foreground",children:[e.jsx(g.div,{animate:{rotate:360},transition:{duration:1.5,repeat:1/0,ease:"linear"},children:e.jsx(N,{size:32})}),e.jsx("span",{className:"text-sm font-medium uppercase tracking-widest opacity-60",children:r("settings.loading")})]})}):!i||!a||!t?e.jsx("div",{className:"p-8",children:e.jsxs(O,{variant:"destructive",className:"rounded-[2rem] p-8 shadow-xl",children:[e.jsx(B,{size:24}),e.jsx(R,{className:"mt-2 text-md leading-relaxed",children:b??r("settingsPage.browserSection.description")}),e.jsx("div",{className:"mt-6",children:e.jsxs(h,{variant:"outline",className:"rounded-full px-6 transition-transform active:scale-95",onClick:I,children:[e.jsx(N,{className:"mr-2 h-4 w-4"}),r("sharedPage.retry")]})})]})}):e.jsxs("div",{className:"relative flex min-h-0 flex-1 flex-col overflow-hidden bg-background",children:[e.jsx(me,{children:(b||x||P)&&e.jsx(g.div,{initial:{opacity:0,y:-20,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-20,scale:.95},className:"absolute left-1/2 top-6 z-50 -translate-x-1/2",children:b?e.jsxs("div",{className:"flex items-center gap-3 rounded-full border border-rose-500/20 bg-card/95 px-6 py-2.5 text-sm font-medium text-rose-600 shadow-2xl dark:bg-zinc-900/85",children:[e.jsx(B,{size:18}),b]}):e.jsxs("div",{className:"flex items-center gap-3 rounded-full border border-emerald-500/20 bg-card/95 px-6 py-2.5 text-sm font-medium text-emerald-600 shadow-2xl dark:bg-zinc-900/85",children:[e.jsx(k,{size:18}),P??r("commonToast.settingsSaved")]})})}),e.jsx(le,{className:"flex-1",children:e.jsxs("div",{className:"mx-auto max-w-[1240px] space-y-12 p-8 py-16",children:[e.jsxs(g.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},className:"flex flex-wrap items-end justify-between gap-6",children:[e.jsx("div",{className:"space-y-4",children:e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("div",{className:"flex h-12 w-12 items-center justify-center rounded-2xl bg-primary/10 text-primary",children:e.jsx(ge,{size:28})}),e.jsxs("div",{children:[e.jsx("h1",{className:"text-3xl font-bold tracking-tight",children:r("settingsPage.browserSection.title")}),e.jsx("p",{className:"mt-1 text-muted-foreground",children:r("settingsPage.browserSection.description")})]})]})}),e.jsxs(h,{variant:"outline",className:"rounded-full border-border/70 bg-background/85 shadow-sm transition-all hover:bg-muted/50 active:scale-95 dark:border-white/[0.08] dark:bg-zinc-900/70 dark:hover:bg-zinc-900",onClick:I,disabled:l||c,children:[e.jsx(N,{className:w("mr-2 h-4 w-4",d&&"animate-spin")}),r("settings.refresh")]})]}),e.jsx(g.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{delay:.1},children:e.jsxs(O,{className:"items-center rounded-3xl border-primary/10 bg-primary/[0.04] p-6 py-4 dark:border-primary/15 dark:bg-primary/[0.05]",children:[e.jsx(be,{className:"h-5 w-5 text-primary"}),e.jsxs(R,{className:"ml-2 text-sm",children:[e.jsx("span",{className:"font-semibold text-primary/80",children:r("settingsPage.browserSection.primaryTitle")})," ",r("settingsPage.browserSection.primaryDescription")]})]})}),e.jsx(g.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{delay:.2},children:e.jsx(J,{title:r("settingsPage.browserSection.claude.title"),description:r("settingsPage.browserSection.claude.description"),action:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxs("div",{className:"flex items-center gap-2 rounded-full border border-border/60 bg-muted/30 px-4 py-2 dark:border-white/[0.06] dark:bg-zinc-900/45",children:[e.jsx(f,{htmlFor:"browser-claude-enabled",className:"cursor-pointer text-xs font-semibold leading-none",children:t.claude.enabled?"ENABLED":"DISABLED"}),e.jsx(G,{id:"browser-claude-enabled",checked:t.claude.enabled,onCheckedChange:n=>m(u=>A(u??t,{enabled:n}))})]}),e.jsxs(h,{onClick:ae,disabled:l||z||!_,className:"rounded-full px-6 shadow-md transition-transform active:scale-95",children:[l?e.jsx(N,{className:"mr-2 h-4 w-4 animate-spin"}):e.jsx(k,{size:16,className:"mr-2"}),r("settingsPage.browserSection.actions.saveClaude")]}),e.jsxs(h,{variant:"outline",className:"rounded-full border-border/70 bg-background/85 shadow-sm transition-all hover:bg-muted/50 active:scale-95 dark:border-white/[0.08] dark:bg-zinc-900/70 dark:hover:bg-zinc-900",onClick:se,disabled:l||d||_||z,children:[e.jsx(he,{size:16,className:"mr-2"}),r("settingsPage.browserSection.actions.testConnection")]})]}),children:e.jsxs("div",{className:"grid gap-12",children:[e.jsx(K,{state:a.claude.state,title:a.claude.title,detail:a.claude.detail,nextStep:a.claude.nextStep}),e.jsxs("div",{className:"grid gap-8 lg:grid-cols-2",children:[e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"space-y-3",children:[e.jsx(f,{htmlFor:"browser-claude-user-data-dir",className:"text-sm font-semibold tracking-wide text-muted-foreground/80",children:r("settingsPage.browserSection.claude.userDataDir")}),e.jsx(T,{id:"browser-claude-user-data-dir",value:t.claude.userDataDir,onChange:n=>m(u=>A(u??t,{userDataDir:n.target.value})),className:"rounded-xl border-border/70 bg-background/85 dark:border-white/[0.08] dark:bg-zinc-900/70",placeholder:a.claude.recommendedUserDataDir}),e.jsx("p",{className:"text-[11px] leading-relaxed text-muted-foreground/70",children:r("settingsPage.browserSection.claude.userDataDirHint")})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx(f,{htmlFor:"browser-claude-devtools-port",className:"text-sm font-semibold tracking-wide text-muted-foreground/80",children:r("settingsPage.browserSection.claude.devtoolsPort")}),e.jsx(T,{id:"browser-claude-devtools-port",value:M,onChange:n=>C(n.target.value),inputMode:"numeric",className:"max-w-[120px] rounded-xl border-border/70 bg-background/85 dark:border-white/[0.08] dark:bg-zinc-900/70"}),e.jsx("p",{className:w("text-[11px] leading-relaxed text-muted-foreground/70",z&&"text-rose-500"),children:r(z?"settingsPage.browserSection.claude.devtoolsPortInvalid":"settingsPage.browserSection.claude.devtoolsPortHint")})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx(f,{className:"text-sm font-semibold tracking-wide text-muted-foreground/80",children:r("settingsPage.browserSection.evalMode.label")}),e.jsxs($,{value:t.claude.evalMode,onValueChange:n=>m(u=>A(u??t,{evalMode:n})),children:[e.jsx(H,{className:"rounded-xl border-border/70 bg-background/85 dark:border-white/[0.08] dark:bg-zinc-900/70",children:e.jsx(F,{})}),e.jsx(U,{children:q.map(n=>e.jsx(V,{value:n,children:D(r,n)},n))})]}),e.jsx("p",{className:"text-[11px] leading-relaxed text-muted-foreground/70",children:r("settingsPage.browserSection.claude.evalModeHint")})]})]}),e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"group/launch relative overflow-hidden rounded-2xl border border-border/60 bg-muted/20 p-5 transition-all hover:bg-muted/35 dark:border-white/[0.06] dark:bg-zinc-900/35 dark:hover:bg-zinc-900/50",children:[e.jsxs("div",{className:"flex items-start justify-between gap-4",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-[11px] font-bold uppercase tracking-[0.15em] text-primary/70",children:r("settingsPage.browserSection.claude.launchGuidance")}),e.jsx("p",{className:"text-xs text-muted-foreground",children:r("settingsPage.browserSection.claude.launchGuidanceHint")})]}),e.jsx(h,{variant:"ghost",size:"sm",className:"h-8 w-8 rounded-full p-0 transition-transform active:scale-90",onClick:de,disabled:!j,children:e.jsx(pe,{size:18})})]}),e.jsx("code",{className:"mt-4 block break-all rounded-lg border border-border/50 bg-background/80 p-3 font-mono text-[10px] leading-relaxed dark:border-white/[0.05] dark:bg-zinc-900/60",children:j})]}),a.claude.overrideActive&&e.jsxs("div",{className:"flex items-center gap-3 rounded-2xl border border-amber-500/10 bg-amber-500/[0.05] p-4 text-xs font-medium text-amber-700 dark:text-amber-300",children:[e.jsx(Q,{size:18}),r("settingsPage.browserSection.claude.overrideMessage",{source:a.claude.source})]})]})]}),e.jsx(W,{title:r("settingsPage.browserSection.technicalDetails"),defaultOpen:a.claude.state!=="ready",children:e.jsxs("div",{className:"grid gap-6 sm:grid-cols-2",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-[10px] font-bold uppercase tracking-widest text-muted-foreground/50",children:r("settingsPage.browserSection.claude.effectivePath")}),e.jsx("div",{className:"rounded-lg border border-border/50 bg-muted/25 p-3 dark:border-white/[0.05] dark:bg-zinc-900/45",children:e.jsx("p",{className:"break-all font-mono text-[11px] leading-relaxed",children:a.claude.effectiveUserDataDir})}),e.jsxs("p",{className:"text-[10px] font-medium text-muted-foreground/60",children:[e.jsxs("span",{className:"font-bold",children:[r("settingsPage.browserSection.claude.recommendedPath"),":"]})," ",a.claude.recommendedUserDataDir]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-[10px] font-bold uppercase tracking-widest text-muted-foreground/50",children:r("settingsPage.browserSection.claude.managedRuntime")}),e.jsxs("div",{className:"rounded-lg border border-border/50 bg-muted/25 p-3 dark:border-white/[0.05] dark:bg-zinc-900/45",children:[e.jsx("p",{className:"font-semibold text-primary/80",children:a.claude.managedMcpServerName}),e.jsx("p",{className:"mt-1 break-all font-mono text-[11px] leading-relaxed text-muted-foreground/80",children:a.claude.managedMcpServerPath})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-[10px] font-bold uppercase tracking-widest text-muted-foreground/50",children:r("settingsPage.browserSection.evalMode.label")}),e.jsx("div",{className:"rounded-lg border border-border/50 bg-muted/25 p-3 dark:border-white/[0.05] dark:bg-zinc-900/45",children:e.jsx("p",{className:"font-mono text-[11px] font-semibold",children:D(r,a.claude.evalMode)})})]})]})})]})})}),e.jsx(g.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{delay:.3},children:e.jsx(J,{title:r("settingsPage.browserSection.codex.title"),description:r("settingsPage.browserSection.codex.description"),action:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxs("div",{className:"flex items-center gap-2 rounded-full border border-border/60 bg-muted/30 px-4 py-2 dark:border-white/[0.06] dark:bg-zinc-900/45",children:[e.jsx(f,{htmlFor:"browser-codex-enabled",className:"cursor-pointer text-xs font-semibold leading-none",children:t.codex.enabled?"ENABLED":"DISABLED"}),e.jsx(G,{id:"browser-codex-enabled",checked:t.codex.enabled,onCheckedChange:n=>m(u=>X(u??t,{enabled:n}))})]}),e.jsxs(h,{onClick:te,disabled:l||!re,className:"rounded-full px-6 shadow-md transition-transform active:scale-95",children:[l?e.jsx(N,{className:"mr-2 h-4 w-4 animate-spin"}):e.jsx(k,{size:16,className:"mr-2"}),r("settingsPage.browserSection.actions.saveCodex")]})]}),children:e.jsxs("div",{className:"grid gap-12",children:[e.jsx(K,{state:a.codex.state,title:a.codex.title,detail:a.codex.detail,nextStep:a.codex.nextStep}),e.jsxs("div",{className:"max-w-md space-y-3",children:[e.jsx(f,{className:"text-sm font-semibold tracking-wide text-muted-foreground/80",children:r("settingsPage.browserSection.evalMode.label")}),e.jsxs($,{value:t.codex.evalMode,onValueChange:n=>m(u=>X(u??t,{evalMode:n})),children:[e.jsx(H,{className:"rounded-xl border-border/70 bg-background/85 dark:border-white/[0.08] dark:bg-zinc-900/70",children:e.jsx(F,{})}),e.jsx(U,{children:q.map(n=>e.jsx(V,{value:n,children:D(r,n)},n))})]}),e.jsx("p",{className:"text-[11px] leading-relaxed text-muted-foreground/70",children:r("settingsPage.browserSection.codex.evalModeHint")})]}),e.jsx(W,{title:r("settingsPage.browserSection.technicalDetails"),defaultOpen:a.codex.state==="unsupported_build",children:e.jsxs("div",{className:"grid gap-6 sm:grid-cols-3",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-[10px] font-bold uppercase tracking-widest text-muted-foreground/50",children:r("settingsPage.browserSection.codex.serverName")}),e.jsx("div",{className:"rounded-lg border border-border/50 bg-muted/25 p-3 dark:border-white/[0.05] dark:bg-zinc-900/45",children:e.jsx("p",{className:"font-mono text-[11px] font-semibold",children:a.codex.serverName})})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-[10px] font-bold uppercase tracking-widest text-muted-foreground/50",children:r("settingsPage.browserSection.codex.overrideSupport")}),e.jsxs("div",{className:"flex items-center gap-2 rounded-lg border border-border/50 bg-muted/25 p-3 font-medium text-xs dark:border-white/[0.05] dark:bg-zinc-900/45",children:[a.codex.supportsConfigOverrides?e.jsx(k,{className:"text-emerald-500",size:16}):e.jsx(B,{className:"text-rose-500",size:16}),a.codex.supportsConfigOverrides?r("settingsPage.browserSection.codex.overrideSupported"):r("settingsPage.browserSection.codex.overrideUnsupported")]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-[10px] font-bold uppercase tracking-widest text-muted-foreground/50",children:r("settingsPage.browserSection.codex.binary")}),e.jsxs("div",{className:"rounded-lg border border-border/50 bg-muted/25 p-3 dark:border-white/[0.05] dark:bg-zinc-900/45",children:[e.jsx("p",{className:"break-all font-mono text-[11px] leading-relaxed",children:a.codex.binaryPath??r("settingsPage.browserSection.codex.notDetected")}),a.codex.version&&e.jsx("div",{className:"mt-2 inline-flex rounded-full bg-primary/10 px-2 py-0.5 text-[10px] font-bold text-primary",children:a.codex.version})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-[10px] font-bold uppercase tracking-widest text-muted-foreground/50",children:r("settingsPage.browserSection.evalMode.label")}),e.jsx("div",{className:"rounded-lg border border-border/50 bg-muted/25 p-3 dark:border-white/[0.05] dark:bg-zinc-900/45",children:e.jsx("p",{className:"font-mono text-[11px] font-semibold",children:D(r,a.codex.evalMode)})})]})]})})]})})})]})})]})}function A(r,s){return{...r,claude:{...r.claude,...s}}}function X(r,s){return{...r,codex:{...r.codex,...s}}}export{Oe as default};
1
+ import{j as e}from"./radix-ui-nu4wz29m.js";import{r as o}from"./react-vendor-Bjx91N7w.js";import{by as ie,bz as ne,Z as E,a as X,bA as oe,bi as O,bk as R,e as h,t as le,c as w,L as f,I as T,j as $,k as H,l as F,m as U,n as V,aI as G,N as ce,O as ue,Q as xe}from"./index-DmV9wJET.js";import{m as g,A as me}from"./proxy-C4-M_9kB.js";import{R as N,I as B,x as k,ab as ge,_ as be,bc as pe,w as Z,$ as he,a6 as fe,e as we,s as je}from"./icons-DzKUh8vG.js";import"./tanstack-bhJxV1h8.js";import"./notifications-B4_o8bcr.js";import"./utils-CzKF5WmX.js";import"./form-utils-CuHzLhJZ.js";import"./charts-eIPy2oG6.js";function ve(r,s){return{claude:{...r.claude,...s.claude},codex:{...r.codex,...s.codex}}}function Ne(){const{state:r}=ie(),s=ne(),i=o.useCallback(async()=>{try{s.setBrowserLoading(!0),s.setBrowserError(null);const d=await E.browser.get();s.setBrowserConfig(d.config),s.setBrowserStatus(d.status)}catch(d){s.setBrowserError(d.message)}finally{s.setBrowserLoading(!1),s.setBrowserStatusLoading(!1)}},[s]),a=o.useCallback(async()=>{try{s.setBrowserStatusLoading(!0),s.setBrowserError(null);const d=await E.browser.getStatus();return s.setBrowserStatus(d),d}catch(d){return s.setBrowserError(d.message),null}finally{s.setBrowserStatusLoading(!1)}},[s]),c=o.useCallback(async d=>{const l=r.browserConfig;if(!l)return!1;const b=ve(l,d);s.setBrowserConfig(b);try{s.setBrowserSaving(!0),s.setBrowserError(null);const x=await E.browser.update(d);return s.setBrowserConfig(x.browser.config),s.setBrowserStatus(x.browser.status),s.setBrowserSuccess(!0),window.setTimeout(()=>s.setBrowserSuccess(!1),1500),!0}catch(x){return s.setBrowserConfig(l),s.setBrowserError(x.message),!1}finally{s.setBrowserSaving(!1)}},[s,r.browserConfig]);return{config:r.browserConfig,status:r.browserStatus,loading:r.browserLoading,statusLoading:r.browserStatusLoading,saving:r.browserSaving,error:r.browserError,success:r.browserSuccess,fetchConfig:i,fetchStatus:a,saveConfig:c}}function ke(r){const s=r.toLowerCase();return s.includes("mac")?"darwin":s.includes("win")?"win32":"linux"}function ye(r=navigator){const s=typeof r.userAgentData?.platform=="string"?r.userAgentData.platform:"",i=typeof r.platform=="string"&&r.platform.trim()?r.platform:r.userAgent;return ke(s||i||"")}function Se(r){if(!/^\d+$/.test(r.trim()))return null;const s=Number.parseInt(r.trim(),10);return s<1||s>65535?null:s}const q=["disabled","readonly","readwrite"];function D(r,s){return r(`settingsPage.browserSection.evalMode.options.${s}`)}function Ce(r,s,i){const a=JSON.stringify(r);return i==="darwin"?`open -na "Google Chrome" --args --remote-debugging-port=${s} --user-data-dir=${a}`:i==="win32"?`chrome.exe --remote-debugging-port=${s} --user-data-dir=${a}`:`google-chrome --remote-debugging-port=${s} --user-data-dir=${a}`}function J({children:r,className:s,title:i,description:a,badge:c,action:d}){return e.jsx("div",{className:w("group relative overflow-hidden rounded-[2.5rem] border border-border/60 bg-muted/20 p-1.5 transition-all duration-700 ease-[cubic-bezier(0.32,0.72,0,1)] dark:border-white/[0.08] dark:bg-zinc-900/35",s),children:e.jsxs("div",{className:"relative overflow-hidden rounded-[calc(2.5rem-0.375rem)] border border-border/70 bg-card/90 shadow-[0_12px_36px_-18px_rgba(15,23,42,0.18)] dark:border-white/[0.08] dark:bg-zinc-900/70 dark:shadow-[0_18px_44px_-24px_rgba(0,0,0,0.55)]",children:[e.jsx("div",{className:"pointer-events-none absolute inset-0 shadow-[inset_0_1px_0_rgba(255,255,255,0.28)] dark:shadow-[inset_0_1px_0_rgba(255,255,255,0.04)]"}),(i||d)&&e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-4 border-b border-border/60 px-8 py-6 dark:border-white/[0.06]",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("h3",{className:"text-xl font-semibold tracking-tight",children:i}),c]}),a&&e.jsx("p",{className:"text-sm text-muted-foreground",children:a})]}),d&&e.jsx("div",{className:"flex items-center gap-2",children:d})]}),e.jsx("div",{className:"px-8 py-8",children:r})]})})}function K({state:r,title:s,detail:i,nextStep:a}){const{t:c}=X(),d=r==="ready"||r==="enabled",l=!d&&r!=="disabled";return e.jsx("div",{className:w("relative overflow-hidden rounded-2xl border p-4 transition-all duration-500",d?"border-emerald-500/20 bg-emerald-500/[0.03] dark:bg-emerald-500/[0.02]":l?"border-amber-500/20 bg-amber-500/[0.03] dark:bg-amber-500/[0.02]":"border-border/60 bg-muted/30 dark:border-white/[0.06] dark:bg-zinc-900/45"),children:e.jsxs("div",{className:"flex items-start gap-4",children:[e.jsx("div",{className:w("flex h-10 w-10 shrink-0 items-center justify-center rounded-xl transition-transform duration-500 group-hover:scale-110",d?"bg-emerald-500/10 text-emerald-600":l?"bg-amber-500/10 text-amber-600":"bg-slate-500/10 text-slate-500"),children:d?e.jsx(k,{size:24}):l?e.jsx(Z,{size:24}):e.jsx(B,{size:24})}),e.jsxs("div",{className:"min-w-0 flex-1 space-y-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-sm font-semibold uppercase tracking-wider text-muted-foreground/60",children:c("settingsPage.browserSection.readiness")}),d&&e.jsx(g.span,{animate:{opacity:[.4,1,.4]},transition:{duration:2,repeat:1/0},className:"h-1.5 w-1.5 rounded-full bg-emerald-500"})]}),e.jsx("h4",{className:"font-medium text-foreground",children:s}),e.jsx("p",{className:"text-sm leading-relaxed text-muted-foreground",children:i}),a&&e.jsxs("div",{className:"mt-3 flex items-start gap-2 rounded-lg border border-border/50 bg-muted/35 p-3 dark:border-white/[0.05] dark:bg-zinc-900/45",children:[e.jsx(fe,{size:14,className:"mt-0.5 shrink-0 text-primary"}),e.jsxs("p",{className:"text-xs leading-normal",children:[e.jsxs("span",{className:"font-semibold text-primary",children:[c("settingsPage.browserSection.nextStep"),":"]})," ",a]})]})]})]})})}function Q({title:r,children:s,defaultOpen:i=!1}){const[a,c]=o.useState(i);return e.jsxs(ce,{open:a,onOpenChange:c,className:"overflow-hidden rounded-2xl border border-border/60 bg-muted/20 dark:border-white/[0.06] dark:bg-zinc-900/30",children:[e.jsx(ue,{asChild:!0,children:e.jsxs("button",{className:"flex w-full items-center justify-between px-6 py-4 text-sm font-medium transition-colors hover:bg-muted/40 dark:hover:bg-zinc-900/50",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(we,{size:16,className:"text-muted-foreground"}),r]}),e.jsx(je,{size:16,className:w("transition-transform duration-300",a&&"rotate-180")})]})}),e.jsx(xe,{children:e.jsx("div",{className:"border-t border-border/60 px-6 py-6 dark:border-white/[0.06]",children:s})})]})}function Oe(){const{t:r}=X(),{fetchRawConfig:s}=oe(),{config:i,status:a,loading:c,statusLoading:d,saving:l,error:b,success:x,fetchConfig:y,fetchStatus:L,saveConfig:S}=Ne(),[Y,m]=o.useState(null),[ee,C]=o.useState(null),[P,p]=o.useState(null);o.useEffect(()=>{y()},[y]),o.useEffect(()=>{if(!P&&!x)return;const n=window.setTimeout(()=>p(null),2500);return()=>window.clearTimeout(n)},[P,x]);const t=Y??i,j=o.useMemo(()=>t?Ce(t.claude.userDataDir,t.claude.devtoolsPort,ye()):"",[t]),M=ee??String(t?.claude.devtoolsPort??9222),v=Se(M),z=M.trim().length>0&&v===null,_=i!==null&&t!==null&&(i.claude.enabled!==t.claude.enabled||i.claude.userDataDir!==t.claude.userDataDir||i.claude.devtoolsPort!==v||i.claude.evalMode!==t.claude.evalMode),re=i!==null&&t!==null&&(i.codex.enabled!==t.codex.enabled||i.codex.evalMode!==t.codex.evalMode),I=o.useCallback(async()=>{p(null),m(null),C(null),await Promise.all([y(),s()])},[y,s]),se=o.useCallback(async()=>{await L()&&p(r("settingsPage.browserSection.messages.statusRefreshed"))},[L,r]),ae=o.useCallback(async()=>{if(!t||v===null)return;await S({claude:{enabled:t.claude.enabled,userDataDir:t.claude.userDataDir.trim(),devtoolsPort:v,evalMode:t.claude.evalMode}})&&(await s(),p(null),m(null),C(null))},[v,t,s,S]),te=o.useCallback(async()=>{if(!t)return;await S({codex:{enabled:t.codex.enabled,evalMode:t.codex.evalMode}})&&(await s(),p(null),m(null),C(null))},[t,s,S]),de=o.useCallback(async()=>{j&&(await navigator.clipboard.writeText(j),p(r("settingsPage.browserSection.messages.launchCommandCopied")))},[j,r]);return c?e.jsx("div",{className:"flex flex-1 items-center justify-center",children:e.jsxs("div",{className:"flex flex-col items-center gap-4 text-muted-foreground",children:[e.jsx(g.div,{animate:{rotate:360},transition:{duration:1.5,repeat:1/0,ease:"linear"},children:e.jsx(N,{size:32})}),e.jsx("span",{className:"text-sm font-medium uppercase tracking-widest opacity-60",children:r("settings.loading")})]})}):!i||!a||!t?e.jsx("div",{className:"p-8",children:e.jsxs(O,{variant:"destructive",className:"rounded-[2rem] p-8 shadow-xl",children:[e.jsx(B,{size:24}),e.jsx(R,{className:"mt-2 text-md leading-relaxed",children:b??r("settingsPage.browserSection.description")}),e.jsx("div",{className:"mt-6",children:e.jsxs(h,{variant:"outline",className:"rounded-full px-6 transition-transform active:scale-95",onClick:I,children:[e.jsx(N,{className:"mr-2 h-4 w-4"}),r("sharedPage.retry")]})})]})}):e.jsxs("div",{className:"relative flex min-h-0 flex-1 flex-col overflow-hidden bg-background",children:[e.jsx(me,{children:(b||x||P)&&e.jsx(g.div,{initial:{opacity:0,y:-20,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-20,scale:.95},className:"absolute left-1/2 top-6 z-50 -translate-x-1/2",children:b?e.jsxs("div",{className:"flex items-center gap-3 rounded-full border border-rose-500/20 bg-card/95 px-6 py-2.5 text-sm font-medium text-rose-600 shadow-2xl dark:bg-zinc-900/85",children:[e.jsx(B,{size:18}),b]}):e.jsxs("div",{className:"flex items-center gap-3 rounded-full border border-emerald-500/20 bg-card/95 px-6 py-2.5 text-sm font-medium text-emerald-600 shadow-2xl dark:bg-zinc-900/85",children:[e.jsx(k,{size:18}),P??r("commonToast.settingsSaved")]})})}),e.jsx(le,{className:"flex-1",children:e.jsxs("div",{className:"mx-auto max-w-[1240px] space-y-12 p-8 py-16",children:[e.jsxs(g.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},className:"flex flex-wrap items-end justify-between gap-6",children:[e.jsx("div",{className:"space-y-4",children:e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("div",{className:"flex h-12 w-12 items-center justify-center rounded-2xl bg-primary/10 text-primary",children:e.jsx(ge,{size:28})}),e.jsxs("div",{children:[e.jsx("h1",{className:"text-3xl font-bold tracking-tight",children:r("settingsPage.browserSection.title")}),e.jsx("p",{className:"mt-1 text-muted-foreground",children:r("settingsPage.browserSection.description")})]})]})}),e.jsxs(h,{variant:"outline",className:"rounded-full border-border/70 bg-background/85 shadow-sm transition-all hover:bg-muted/50 active:scale-95 dark:border-white/[0.08] dark:bg-zinc-900/70 dark:hover:bg-zinc-900",onClick:I,disabled:l||c,children:[e.jsx(N,{className:w("mr-2 h-4 w-4",d&&"animate-spin")}),r("settings.refresh")]})]}),e.jsx(g.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{delay:.1},children:e.jsxs(O,{className:"items-center rounded-3xl border-primary/10 bg-primary/[0.04] p-6 py-4 dark:border-primary/15 dark:bg-primary/[0.05]",children:[e.jsx(be,{className:"h-5 w-5 text-primary"}),e.jsxs(R,{className:"ml-2 text-sm",children:[e.jsx("span",{className:"font-semibold text-primary/80",children:r("settingsPage.browserSection.primaryTitle")})," ",r("settingsPage.browserSection.primaryDescription")]})]})}),e.jsx(g.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{delay:.2},children:e.jsx(J,{title:r("settingsPage.browserSection.claude.title"),description:r("settingsPage.browserSection.claude.description"),action:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxs("div",{className:"flex items-center gap-2 rounded-full border border-border/60 bg-muted/30 px-4 py-2 dark:border-white/[0.06] dark:bg-zinc-900/45",children:[e.jsx(f,{htmlFor:"browser-claude-enabled",className:"cursor-pointer text-xs font-semibold leading-none",children:t.claude.enabled?"ENABLED":"DISABLED"}),e.jsx(G,{id:"browser-claude-enabled",checked:t.claude.enabled,onCheckedChange:n=>m(u=>A(u??t,{enabled:n}))})]}),e.jsxs(h,{onClick:ae,disabled:l||z||!_,className:"rounded-full px-6 shadow-md transition-transform active:scale-95",children:[l?e.jsx(N,{className:"mr-2 h-4 w-4 animate-spin"}):e.jsx(k,{size:16,className:"mr-2"}),r("settingsPage.browserSection.actions.saveClaude")]}),e.jsxs(h,{variant:"outline",className:"rounded-full border-border/70 bg-background/85 shadow-sm transition-all hover:bg-muted/50 active:scale-95 dark:border-white/[0.08] dark:bg-zinc-900/70 dark:hover:bg-zinc-900",onClick:se,disabled:l||d||_||z,children:[e.jsx(he,{size:16,className:"mr-2"}),r("settingsPage.browserSection.actions.testConnection")]})]}),children:e.jsxs("div",{className:"grid gap-12",children:[e.jsx(K,{state:a.claude.state,title:a.claude.title,detail:a.claude.detail,nextStep:a.claude.nextStep}),e.jsxs("div",{className:"grid gap-8 lg:grid-cols-2",children:[e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"space-y-3",children:[e.jsx(f,{htmlFor:"browser-claude-user-data-dir",className:"text-sm font-semibold tracking-wide text-muted-foreground/80",children:r("settingsPage.browserSection.claude.userDataDir")}),e.jsx(T,{id:"browser-claude-user-data-dir",value:t.claude.userDataDir,onChange:n=>m(u=>A(u??t,{userDataDir:n.target.value})),className:"rounded-xl border-border/70 bg-background/85 dark:border-white/[0.08] dark:bg-zinc-900/70",placeholder:a.claude.recommendedUserDataDir}),e.jsx("p",{className:"text-[11px] leading-relaxed text-muted-foreground/70",children:r("settingsPage.browserSection.claude.userDataDirHint")})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx(f,{htmlFor:"browser-claude-devtools-port",className:"text-sm font-semibold tracking-wide text-muted-foreground/80",children:r("settingsPage.browserSection.claude.devtoolsPort")}),e.jsx(T,{id:"browser-claude-devtools-port",value:M,onChange:n=>C(n.target.value),inputMode:"numeric",className:"max-w-[120px] rounded-xl border-border/70 bg-background/85 dark:border-white/[0.08] dark:bg-zinc-900/70"}),e.jsx("p",{className:w("text-[11px] leading-relaxed text-muted-foreground/70",z&&"text-rose-500"),children:r(z?"settingsPage.browserSection.claude.devtoolsPortInvalid":"settingsPage.browserSection.claude.devtoolsPortHint")})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx(f,{className:"text-sm font-semibold tracking-wide text-muted-foreground/80",children:r("settingsPage.browserSection.evalMode.label")}),e.jsxs($,{value:t.claude.evalMode,onValueChange:n=>m(u=>A(u??t,{evalMode:n})),children:[e.jsx(H,{className:"rounded-xl border-border/70 bg-background/85 dark:border-white/[0.08] dark:bg-zinc-900/70",children:e.jsx(F,{})}),e.jsx(U,{children:q.map(n=>e.jsx(V,{value:n,children:D(r,n)},n))})]}),e.jsx("p",{className:"text-[11px] leading-relaxed text-muted-foreground/70",children:r("settingsPage.browserSection.claude.evalModeHint")})]})]}),e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"group/launch relative overflow-hidden rounded-2xl border border-border/60 bg-muted/20 p-5 transition-all hover:bg-muted/35 dark:border-white/[0.06] dark:bg-zinc-900/35 dark:hover:bg-zinc-900/50",children:[e.jsxs("div",{className:"flex items-start justify-between gap-4",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-[11px] font-bold uppercase tracking-[0.15em] text-primary/70",children:r("settingsPage.browserSection.claude.launchGuidance")}),e.jsx("p",{className:"text-xs text-muted-foreground",children:r("settingsPage.browserSection.claude.launchGuidanceHint")})]}),e.jsx(h,{variant:"ghost",size:"sm",className:"h-8 w-8 rounded-full p-0 transition-transform active:scale-90",onClick:de,disabled:!j,children:e.jsx(pe,{size:18})})]}),e.jsx("code",{className:"mt-4 block break-all rounded-lg border border-border/50 bg-background/80 p-3 font-mono text-[10px] leading-relaxed dark:border-white/[0.05] dark:bg-zinc-900/60",children:j})]}),a.claude.overrideActive&&e.jsxs("div",{className:"flex items-center gap-3 rounded-2xl border border-amber-500/10 bg-amber-500/[0.05] p-4 text-xs font-medium text-amber-700 dark:text-amber-300",children:[e.jsx(Z,{size:18}),r("settingsPage.browserSection.claude.overrideMessage",{source:a.claude.source})]})]})]}),e.jsx(Q,{title:r("settingsPage.browserSection.technicalDetails"),defaultOpen:a.claude.state!=="ready",children:e.jsxs("div",{className:"grid gap-6 sm:grid-cols-2",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-[10px] font-bold uppercase tracking-widest text-muted-foreground/50",children:r("settingsPage.browserSection.claude.effectivePath")}),e.jsx("div",{className:"rounded-lg border border-border/50 bg-muted/25 p-3 dark:border-white/[0.05] dark:bg-zinc-900/45",children:e.jsx("p",{className:"break-all font-mono text-[11px] leading-relaxed",children:a.claude.effectiveUserDataDir})}),e.jsxs("p",{className:"text-[10px] font-medium text-muted-foreground/60",children:[e.jsxs("span",{className:"font-bold",children:[r("settingsPage.browserSection.claude.recommendedPath"),":"]})," ",a.claude.recommendedUserDataDir]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-[10px] font-bold uppercase tracking-widest text-muted-foreground/50",children:r("settingsPage.browserSection.claude.managedRuntime")}),e.jsxs("div",{className:"rounded-lg border border-border/50 bg-muted/25 p-3 dark:border-white/[0.05] dark:bg-zinc-900/45",children:[e.jsx("p",{className:"font-semibold text-primary/80",children:a.claude.managedMcpServerName}),e.jsx("p",{className:"mt-1 break-all font-mono text-[11px] leading-relaxed text-muted-foreground/80",children:a.claude.managedMcpServerPath})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-[10px] font-bold uppercase tracking-widest text-muted-foreground/50",children:r("settingsPage.browserSection.evalMode.label")}),e.jsx("div",{className:"rounded-lg border border-border/50 bg-muted/25 p-3 dark:border-white/[0.05] dark:bg-zinc-900/45",children:e.jsx("p",{className:"font-mono text-[11px] font-semibold",children:D(r,a.claude.evalMode)})})]})]})})]})})}),e.jsx(g.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{delay:.3},children:e.jsx(J,{title:r("settingsPage.browserSection.codex.title"),description:r("settingsPage.browserSection.codex.description"),action:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxs("div",{className:"flex items-center gap-2 rounded-full border border-border/60 bg-muted/30 px-4 py-2 dark:border-white/[0.06] dark:bg-zinc-900/45",children:[e.jsx(f,{htmlFor:"browser-codex-enabled",className:"cursor-pointer text-xs font-semibold leading-none",children:t.codex.enabled?"ENABLED":"DISABLED"}),e.jsx(G,{id:"browser-codex-enabled",checked:t.codex.enabled,onCheckedChange:n=>m(u=>W(u??t,{enabled:n}))})]}),e.jsxs(h,{onClick:te,disabled:l||!re,className:"rounded-full px-6 shadow-md transition-transform active:scale-95",children:[l?e.jsx(N,{className:"mr-2 h-4 w-4 animate-spin"}):e.jsx(k,{size:16,className:"mr-2"}),r("settingsPage.browserSection.actions.saveCodex")]})]}),children:e.jsxs("div",{className:"grid gap-12",children:[e.jsx(K,{state:a.codex.state,title:a.codex.title,detail:a.codex.detail,nextStep:a.codex.nextStep}),e.jsxs("div",{className:"max-w-md space-y-3",children:[e.jsx(f,{className:"text-sm font-semibold tracking-wide text-muted-foreground/80",children:r("settingsPage.browserSection.evalMode.label")}),e.jsxs($,{value:t.codex.evalMode,onValueChange:n=>m(u=>W(u??t,{evalMode:n})),children:[e.jsx(H,{className:"rounded-xl border-border/70 bg-background/85 dark:border-white/[0.08] dark:bg-zinc-900/70",children:e.jsx(F,{})}),e.jsx(U,{children:q.map(n=>e.jsx(V,{value:n,children:D(r,n)},n))})]}),e.jsx("p",{className:"text-[11px] leading-relaxed text-muted-foreground/70",children:r("settingsPage.browserSection.codex.evalModeHint")})]}),e.jsx(Q,{title:r("settingsPage.browserSection.technicalDetails"),defaultOpen:a.codex.state==="unsupported_build",children:e.jsxs("div",{className:"grid gap-6 sm:grid-cols-3",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-[10px] font-bold uppercase tracking-widest text-muted-foreground/50",children:r("settingsPage.browserSection.codex.serverName")}),e.jsx("div",{className:"rounded-lg border border-border/50 bg-muted/25 p-3 dark:border-white/[0.05] dark:bg-zinc-900/45",children:e.jsx("p",{className:"font-mono text-[11px] font-semibold",children:a.codex.serverName})})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-[10px] font-bold uppercase tracking-widest text-muted-foreground/50",children:r("settingsPage.browserSection.codex.overrideSupport")}),e.jsxs("div",{className:"flex items-center gap-2 rounded-lg border border-border/50 bg-muted/25 p-3 font-medium text-xs dark:border-white/[0.05] dark:bg-zinc-900/45",children:[a.codex.supportsConfigOverrides?e.jsx(k,{className:"text-emerald-500",size:16}):e.jsx(B,{className:"text-rose-500",size:16}),a.codex.supportsConfigOverrides?r("settingsPage.browserSection.codex.overrideSupported"):r("settingsPage.browserSection.codex.overrideUnsupported")]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-[10px] font-bold uppercase tracking-widest text-muted-foreground/50",children:r("settingsPage.browserSection.codex.binary")}),e.jsxs("div",{className:"rounded-lg border border-border/50 bg-muted/25 p-3 dark:border-white/[0.05] dark:bg-zinc-900/45",children:[e.jsx("p",{className:"break-all font-mono text-[11px] leading-relaxed",children:a.codex.binaryPath??r("settingsPage.browserSection.codex.notDetected")}),a.codex.version&&e.jsx("div",{className:"mt-2 inline-flex rounded-full bg-primary/10 px-2 py-0.5 text-[10px] font-bold text-primary",children:a.codex.version})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-[10px] font-bold uppercase tracking-widest text-muted-foreground/50",children:r("settingsPage.browserSection.evalMode.label")}),e.jsx("div",{className:"rounded-lg border border-border/50 bg-muted/25 p-3 dark:border-white/[0.05] dark:bg-zinc-900/45",children:e.jsx("p",{className:"font-mono text-[11px] font-semibold",children:D(r,a.codex.evalMode)})})]})]})})]})})})]})})]})}function A(r,s){return{...r,claude:{...r.claude,...s}}}function W(r,s){return{...r,codex:{...r.codex,...s}}}export{Oe as default};