dsh-coding-subscription-oauth 0.5.2 → 0.5.4

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 (44) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/INSTALL.md +11 -11
  3. package/README.de.md +34 -9
  4. package/README.es.md +35 -9
  5. package/README.fr.md +35 -9
  6. package/README.ja.md +35 -9
  7. package/README.ko.md +35 -9
  8. package/README.md +34 -13
  9. package/README.pt-BR.md +35 -9
  10. package/README.ru.md +35 -9
  11. package/README.zh-CN.md +34 -13
  12. package/docs/02-architecture.md +4 -3
  13. package/docs/02-architecture.zh-CN.md +8 -3
  14. package/lib/adapter.d.ts.map +1 -1
  15. package/lib/alias-adapter.d.ts.map +1 -1
  16. package/lib/client.js +1 -1
  17. package/lib/client.js.map +4 -4
  18. package/lib/grok-errors.d.ts +13 -0
  19. package/lib/grok-errors.d.ts.map +1 -0
  20. package/lib/index.js +13 -3
  21. package/lib/index.js.map +3 -3
  22. package/media/settings_accounts.png +0 -0
  23. package/media/settings_capabilities.png +0 -0
  24. package/media/settings_gateway.png +0 -0
  25. package/media/settings_overview.png +0 -0
  26. package/package.json +2 -1
  27. package/src/adapter.ts +7 -2
  28. package/src/alias-adapter.ts +2 -1
  29. package/src/client/GrokBuildSettings.tsx +247 -1772
  30. package/src/client/api.ts +88 -0
  31. package/src/client/components/AboutTab.tsx +20 -0
  32. package/src/client/components/AccountsTab.tsx +224 -0
  33. package/src/client/components/CapabilitiesTab.tsx +214 -0
  34. package/src/client/components/CliPullPreview.tsx +107 -0
  35. package/src/client/components/GatewayTab.tsx +287 -0
  36. package/src/client/components/ProviderCard.tsx +322 -0
  37. package/src/client/components/SettingsTabs.tsx +65 -0
  38. package/src/client/constants.ts +206 -0
  39. package/src/client/display.ts +61 -0
  40. package/src/client/locales.ts +47 -15
  41. package/src/client/parsers.ts +386 -0
  42. package/src/client/styles.ts +180 -0
  43. package/src/client/types.ts +185 -0
  44. package/src/grok-errors.ts +24 -0
@@ -60,8 +60,9 @@ ctx.llm route
60
60
  - `oauth-session.ts`: login, refresh, static model catalog and model-selection cache.
61
61
  - `oauth-sources.ts`: allowlisted official Grok/Codex/Kimi/Claude CLI discovery; hardened lstat/`O_NOFOLLOW`/owner/mode/regular-file/size reads; one-use preview tickets (five minutes, max 32); never writes official CLI files.
62
62
  - `oauth-import-routes.ts`: same-origin Pull HTTP API (discover → preview → commit/cancel) into the destination store lock.
63
- - `alias-adapter.ts`: translates Harness routes, does not modify pi-ai `model.provider`, and runs a credential gate before `listModels()`; unauthenticated or unreadable credentials return an empty catalog, and the provider group name is `(OAuth)`. On an AUTH finish it invalidates the stored token so the harness retry can refresh first.
64
- - `adapter.ts`: composes Grok with the three subscription profiles; asks pi-ai for a 60 s remaining-validity floor and registers a retry policy that includes AUTH plus transient codes. Optionally wraps `codex-oauth-fast` as **Fast requested**.
63
+ - `alias-adapter.ts`: translates Harness routes, does not modify pi-ai `model.provider`, and runs a credential gate before `listModels()`; unauthenticated or unreadable credentials return an empty catalog, and the provider group name is `(OAuth)`. On an AUTH finish it invalidates the stored token so the harness retry can refresh first. The finish pipeline also remaps Kimi misclassified AUTH context overflow and xAI capacity wording → `RATE_LIMIT`.
64
+ - `grok-errors.ts`: detects xAI “at capacity / high demand / priority processing / overloaded” messages and rewrites them to `RATE_LIMIT` so they are not skipped as `PI_AI_ERROR`.
65
+ - `adapter.ts`: composes Grok with the three subscription profiles; asks pi-ai for a 60 s remaining-validity floor and registers a retry policy that includes AUTH plus transient codes (default 5 retries, 5 s → 80 s stacked exponential). Optionally wraps `codex-oauth-fast` as **Fast requested**.
65
66
  - `auth-routes.ts`: legacy Grok API + the unified `/plugins/dsh-grok-build/oauth/*`; JSON writes use a 64 KiB bounded reader and return 400/413 for malformed/oversized bodies.
66
67
  - `capability-settings.ts`: default-off live flags and limits (search 1–20, image count 1–4, artifact TTL 1 h–7 d).
67
68
  - `capability-routes.ts`: secret-free capability snapshot plus optional Codex usage and Imagine credential-status routes.
@@ -118,7 +119,7 @@ This project does not replicate the private Google Antigravity protocol. The pro
118
119
 
119
120
  ## 6. Compatibility
120
121
 
121
- The canonical package and repository name is **`dsh-coding-subscription-oauth`**. The previous GitHub URL still resolves to the same `main`, so old `dsh plugin add github:lninghaha/dsh-grok-build` commands continue to install the renamed package. The first public npm/GitHub Release was **`0.4.1`**. The current release is **`0.5.2`** (`dsh plugin --profile web add dsh-coding-subscription-oauth@0.5.2`). GitHub and local tarball installs remain valid.
122
+ The canonical package and repository name is **`dsh-coding-subscription-oauth`**. The previous GitHub URL still resolves to the same `main`, so old `dsh plugin add github:lninghaha/dsh-grok-build` commands continue to install the renamed package. The first public npm/GitHub Release was **`0.4.1`**. The current release is **`0.5.4`** (`dsh plugin --profile web add dsh-coding-subscription-oauth@0.5.4`). GitHub and local tarball installs remain valid.
122
123
 
123
124
  Stable on-disk / in-process identifiers (do not rename without a migration):
124
125
 
@@ -1,5 +1,9 @@
1
1
  # 02 · 架构设计
2
2
 
3
+ > 中文版 · [**English**](02-architecture.md)
4
+
5
+ 本文描述 `dsh-coding-subscription-oauth` 的内部架构,是 `README.md` 技术说明的来源,面向贡献者与维护者。
6
+
3
7
  ## 1. 路由与原生 provider
4
8
 
5
9
  ```text
@@ -56,8 +60,9 @@ ctx.llm route
56
60
  - `oauth-session.ts`:登录、刷新、静态模型目录和模型选择缓存。
57
61
  - `oauth-sources.ts`:白名单官方 Grok/Codex/Kimi/Claude CLI 发现;加固的 lstat/`O_NOFOLLOW`/属主/权限/普通文件/大小读取;一次性预览票据(五分钟、最多 32 张);从不写入官方 CLI 文件。
58
62
  - `oauth-import-routes.ts`:同源拉取 HTTP API(发现 → 预览 → 提交/取消),写入发生在目标 store 锁内。
59
- - `alias-adapter.ts`:转换 Harness route、不修改 pi-ai model.provider,并在 `listModels()` 前执行 credential gate;未认证或凭据读取失败返回空目录,provider group 名使用 `(OAuth)`。AUTH finish 时作废本地令牌,让 harness 重试先刷新。
60
- - `adapter.ts`:组合 Grok 与三个 subscription profile;向 pi-ai 要求至少 60 秒剩余有效期,并注册包含 AUTH 与瞬时故障码的 retryPolicy。可选包装 `codex-oauth-fast`,显示为 **已请求 Fast**。
63
+ - `alias-adapter.ts`:转换 Harness route、不修改 pi-ai model.provider,并在 `listModels()` 前执行 credential gate;未认证或凭据读取失败返回空目录,provider group 名使用 `(OAuth)`。AUTH finish 时作废本地令牌,让 harness 重试先刷新。finish 管道还会重映射 Kimi 误标 AUTH 的上下文溢出,以及 xAI capacity 文案 → `RATE_LIMIT`。
64
+ - `grok-errors.ts`:识别 xAI「at capacity / high demand / priority processing / overloaded」并改为 `RATE_LIMIT`,避免 `PI_AI_ERROR` 跳过退避。
65
+ - `adapter.ts`:组合 Grok 与三个 subscription profile;向 pi-ai 要求至少 60 秒剩余有效期,并注册包含 AUTH 与瞬时故障码的 retryPolicy(默认 5 次,5 s → 80 s 指数叠加)。可选包装 `codex-oauth-fast`,显示为 **已请求 Fast**。
61
66
  - `auth-routes.ts`:旧 Grok API + 新统一 `/plugins/dsh-grok-build/oauth/*`;JSON 写请求使用 64 KiB 有界读取器,无效/超限 body 分别返回 400/413。
62
67
  - `capability-settings.ts`:默认关闭、立即生效的开关与限制(搜索 1–20、图像 1–4、产物 TTL 1 小时–7 天)。
63
68
  - `capability-routes.ts`:无密钥的能力快照,以及可选的 Codex 用量和 Imagine 凭据状态路由。
@@ -114,7 +119,7 @@ POST /plugins/dsh-grok-build/gateway/rotate
114
119
 
115
120
  ## 6. 兼容性
116
121
 
117
- 正式包名与仓库名是 **`dsh-coding-subscription-oauth`**。旧 GitHub 地址仍指向同一条 `main`,因此旧的 `dsh plugin add github:lninghaha/dsh-grok-build` 仍会安装更名后的包。第一次公开 npm / GitHub Release 是 **`0.4.1`**。当前版本是 **`0.5.2`**(`dsh plugin --profile web add dsh-coding-subscription-oauth@0.5.2`)。GitHub 与本地 tarball 安装仍然有效。
122
+ 正式包名与仓库名是 **`dsh-coding-subscription-oauth`**。旧 GitHub 地址仍指向同一条 `main`,因此旧的 `dsh plugin add github:lninghaha/dsh-grok-build` 仍会安装更名后的包。第一次公开 npm / GitHub Release 是 **`0.4.1`**。当前版本是 **`0.5.4`**(`dsh plugin --profile web add dsh-coding-subscription-oauth@0.5.4`)。GitHub 与本地 tarball 安装仍然有效。
118
123
 
119
124
  以下标识保持稳定(无迁移方案前不要改名):
120
125
 
@@ -1 +1 @@
1
- {"version":3,"file":"adapter.d.ts","sourceRoot":"","sources":["../../src/adapter.ts"],"names":[],"mappings":"AAAA,wFAAwF;AAExF,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AACnE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAC9D,OAAO,EAAE,KAAK,UAAU,EAAgC,MAAM,sBAAsB,CAAC;AAErF,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAkBzD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAG/D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAErD,uEAAuE;AACvE,wBAAgB,uBAAuB,CAAC,MAAM,GAAE,SAAS;IAAE,EAAE,EAAE,MAAM,CAAA;CAAE,EAA8B,GAAG,MAAM,CAE7G;AAyDD,4EAA4E;AAC5E,wBAAgB,sBAAsB,CACrC,OAAO,EAAE,gBAAgB,EACzB,kBAAkB,EAAE,MAAM,eAAe,GAAG,SAAS,GACnD,WAAW,CAgBb;AAED,0FAA0F;AAC1F,MAAM,WAAW,yBAAyB;IACzC,WAAW,CAAC,EAAE,iBAAiB,CAAC;IAChC,SAAS,CAAC,EAAE;QAAE,UAAU,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAA;KAAE,CAAC;CACrD;AAwBD,iFAAiF;AACjF,wBAAgB,wBAAwB,CACvC,IAAI,EAAE,gBAAgB,EACtB,aAAa,EAAE,SAAS,oBAAoB,EAAE,EAC9C,kBAAkB,EAAE,MAAM,eAAe,GAAG,SAAS,EACrD,WAAW,CAAC,EAAE,iBAAiB,EAC/B,OAAO,CAAC,EAAE,yBAAyB,GACjC,UAAU,CAAC;AACd,wBAAgB,wBAAwB,CACvC,IAAI,EAAE,gBAAgB,EACtB,aAAa,EAAE,SAAS,oBAAoB,EAAE,EAC9C,kBAAkB,EAAE,MAAM,eAAe,GAAG,SAAS,EACrD,OAAO,CAAC,EAAE,yBAAyB,GACjC,UAAU,CAAC"}
1
+ {"version":3,"file":"adapter.d.ts","sourceRoot":"","sources":["../../src/adapter.ts"],"names":[],"mappings":"AAAA,wFAAwF;AAExF,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AACnE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAC9D,OAAO,EAAE,KAAK,UAAU,EAAgC,MAAM,sBAAsB,CAAC;AAErF,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAkBzD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAG/D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAErD,uEAAuE;AACvE,wBAAgB,uBAAuB,CAAC,MAAM,GAAE,SAAS;IAAE,EAAE,EAAE,MAAM,CAAA;CAAE,EAA8B,GAAG,MAAM,CAE7G;AA8DD,4EAA4E;AAC5E,wBAAgB,sBAAsB,CACrC,OAAO,EAAE,gBAAgB,EACzB,kBAAkB,EAAE,MAAM,eAAe,GAAG,SAAS,GACnD,WAAW,CAgBb;AAED,0FAA0F;AAC1F,MAAM,WAAW,yBAAyB;IACzC,WAAW,CAAC,EAAE,iBAAiB,CAAC;IAChC,SAAS,CAAC,EAAE;QAAE,UAAU,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAA;KAAE,CAAC;CACrD;AAwBD,iFAAiF;AACjF,wBAAgB,wBAAwB,CACvC,IAAI,EAAE,gBAAgB,EACtB,aAAa,EAAE,SAAS,oBAAoB,EAAE,EAC9C,kBAAkB,EAAE,MAAM,eAAe,GAAG,SAAS,EACrD,WAAW,CAAC,EAAE,iBAAiB,EAC/B,OAAO,CAAC,EAAE,yBAAyB,GACjC,UAAU,CAAC;AACd,wBAAgB,wBAAwB,CACvC,IAAI,EAAE,gBAAgB,EACtB,aAAa,EAAE,SAAS,oBAAoB,EAAE,EAC9C,kBAAkB,EAAE,MAAM,eAAe,GAAG,SAAS,EACrD,OAAO,CAAC,EAAE,yBAAyB,GACjC,UAAU,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"alias-adapter.d.ts","sourceRoot":"","sources":["../../src/alias-adapter.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EACX,eAAe,EACf,YAAY,EACZ,eAAe,EACf,oBAAoB,EACpB,mBAAmB,EACnB,WAAW,EACX,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,UAAU,EAAY,MAAM,sBAAsB,CAAC;AAG5D,MAAM,WAAW,mBAAmB;IACnC,0EAA0E;IAC1E,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,sEAAsE;IACtE,eAAe,CAAC,EAAE,MAAM,OAAO,CAAC,OAAO,CAAC,CAAC;IACzC;;;;OAIG;IACH,YAAY,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,OAAO,CAAC;IAC5C;;;;;;OAMG;IACH,aAAa,CAAC,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CACpC;AAwBD;;;GAGG;AACH,qBAAa,eAAgB,SAAQ,UAAU;IAE7C,OAAO,CAAC,QAAQ,CAAC,KAAK;IACtB,OAAO,CAAC,QAAQ,CAAC,OAAO;IACxB,OAAO,CAAC,QAAQ,CAAC,QAAQ;gBAFR,KAAK,EAAE,UAAU,EACjB,OAAO,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,EACpC,QAAQ,GAAE,WAAW,CAAC,MAAM,EAAE,mBAAmB,CAAa;IAKhF,OAAO,CAAC,cAAc;IAMtB,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,eAAe;IAO/C,mBAAmB,CAAC,QAAQ,EAAE,MAAM,GAAG,mBAAmB,GAAG,SAAS;IAIhE,UAAU,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,YAAY,EAAE,CAAC;IAiB9D,YAAY,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,oBAAoB,CAAC;IAKjG,MAAM,CAAC,OAAO,EAAE,eAAe,GAAG,aAAa,CAAC,WAAW,CAAC;CAwCnE"}
1
+ {"version":3,"file":"alias-adapter.d.ts","sourceRoot":"","sources":["../../src/alias-adapter.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EACX,eAAe,EACf,YAAY,EACZ,eAAe,EACf,oBAAoB,EACpB,mBAAmB,EACnB,WAAW,EACX,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,UAAU,EAAY,MAAM,sBAAsB,CAAC;AAI5D,MAAM,WAAW,mBAAmB;IACnC,0EAA0E;IAC1E,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,sEAAsE;IACtE,eAAe,CAAC,EAAE,MAAM,OAAO,CAAC,OAAO,CAAC,CAAC;IACzC;;;;OAIG;IACH,YAAY,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,OAAO,CAAC;IAC5C;;;;;;OAMG;IACH,aAAa,CAAC,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CACpC;AAwBD;;;GAGG;AACH,qBAAa,eAAgB,SAAQ,UAAU;IAE7C,OAAO,CAAC,QAAQ,CAAC,KAAK;IACtB,OAAO,CAAC,QAAQ,CAAC,OAAO;IACxB,OAAO,CAAC,QAAQ,CAAC,QAAQ;gBAFR,KAAK,EAAE,UAAU,EACjB,OAAO,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,EACpC,QAAQ,GAAE,WAAW,CAAC,MAAM,EAAE,mBAAmB,CAAa;IAKhF,OAAO,CAAC,cAAc;IAMtB,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,eAAe;IAO/C,mBAAmB,CAAC,QAAQ,EAAE,MAAM,GAAG,mBAAmB,GAAG,SAAS;IAIhE,UAAU,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,YAAY,EAAE,CAAC;IAiB9D,YAAY,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,oBAAoB,CAAC;IAKjG,MAAM,CAAC,OAAO,EAAE,eAAe,GAAG,aAAa,CAAC,WAAW,CAAC;CAwCnE"}
package/lib/client.js CHANGED
@@ -1,3 +1,3 @@
1
1
  window.__ModuleLoader__.load({id:"dsh-coding-subscription-oauth",factory:(require)=>{var module={exports:{}};var exports=module.exports;
2
- var qe=Object.defineProperty;var Zi=Object.getOwnPropertyDescriptor;var en=Object.getOwnPropertyNames;var nn=Object.prototype.hasOwnProperty;var tn=(e,t)=>{for(var o in t)qe(e,o,{get:t[o],enumerable:!0})},an=(e,t,o,c)=>{if(t&&typeof t=="object"||typeof t=="function")for(let l of en(t))!nn.call(e,l)&&l!==o&&qe(e,l,{get:()=>t[l],enumerable:!(c=Zi(t,l))||c.enumerable});return e};var on=e=>an(qe({},"__esModule",{value:!0}),e);var gt={};tn(gt,{apply:()=>ut,inject:()=>ct,name:()=>lt});module.exports=on(gt);var r=require("react"),i=require("react/jsx-runtime"),rn="/plugins/dsh-grok-build/oauth/status",sn="/plugins/dsh-grok-build/oauth/login",dn="/plugins/dsh-grok-build/oauth/code",ln="/plugins/dsh-grok-build/oauth/cancel",cn="/plugins/dsh-grok-build/oauth/logout",un="/plugins/dsh-grok-build/oauth/models",gn="/plugins/dsh-grok-build/oauth/sources",pn="/plugins/dsh-grok-build/oauth/sources/preview",yn="/plugins/dsh-grok-build/oauth/sources/commit",xi="/plugins/dsh-grok-build/oauth/sources/cancel",hi="/plugins/dsh-grok-build/capabilities",fn="/plugins/dsh-grok-build/codex/usage",mn="/plugins/dsh-grok-build/imagine/credential-status",ze="/plugins/dsh-grok-build/gateway",bn="/plugins/dsh-grok-build/gateway/reveal",hn="/plugins/dsh-grok-build/gateway/rotate",wn=1e3,Ai=["grok","codex","kimi","claude"],Cn=["missing","unsafe","invalid","too_large"],kn=["none","same_credential","same_account","different_account","unknown_account","unreadable_destination","unsafe_destination"],Sn=["import","reuse","overwrite","blocked"],vn=["imported","unchanged","overwritten"],Pi={grok:"~/.grok/auth.json",codex:"~/.codex/auth.json",kimi:"~/.kimi/credentials/kimi-code.json",claude:"~/.claude/.credentials.json"},In={grok:"sourceKindGrok",codex:"sourceKindCodex",kimi:"sourceKindKimi",claude:"sourceKindClaude"},xn={missing:"sourceReasonMissing",unsafe:"sourceReasonUnsafe",invalid:"sourceReasonInvalid",too_large:"sourceReasonTooLarge"},An={none:"sourceConflictNone",same_credential:"sourceConflictSameCredential",same_account:"sourceConflictSameAccount",different_account:"sourceConflictDifferentAccount",unknown_account:"sourceConflictUnknownAccount",unreadable_destination:"sourceConflictUnreadableDestination",unsafe_destination:"sourceConflictUnsafeDestination"},Pn={import:"sourceActionImport",reuse:"sourceActionReuse",overwrite:"sourceActionOverwrite",blocked:"sourceActionBlocked"},Rn={imported:"sourceCommitImported",unchanged:"sourceCommitUnchanged",overwritten:"sourceCommitOverwritten"},wi=[{key:"codexSearch",label:"capCodexSearch",hint:"capCodexSearchHint"},{key:"codexImages",label:"capCodexImages",hint:"capCodexImagesHint"},{key:"codexImageEdits",label:"capCodexImageEdits",hint:"capCodexImageEditsHint",requiresImages:!0},{key:"codexUsage",label:"capCodexUsage",hint:"capCodexUsageHint"},{key:"codexFast",label:"capCodexFast",hint:"capCodexFastHint"},{key:"grokImagineImage",label:"capGrokImagineImage",hint:"capGrokImagineImageHint"},{key:"grokImagineVideo",label:"capGrokImagineVideo",hint:"capGrokImagineVideoHint"}],ce=3600*1e3,Tn=[{key:"searchResults",label:"capSearchResults",hint:"capSearchResultsHint",min:1,max:20,scale:1},{key:"imageCount",label:"capImageCount",hint:"capImageCountHint",min:1,max:4,scale:1},{key:"videoArtifactTtlMs",label:"capVideoTtlHours",hint:"capVideoTtlHoursHint",min:1,max:168,scale:ce}],Ci={none:"imagineSourceNone",env:"imagineSourceEnv",environment:"imagineSourceEnv","xai-api-key":"imagineSourceEnv",xai_api_key:"imagineSourceEnv","api-key":"imagineSourceApiKey",api_key:"imagineSourceApiKey",apikey:"imagineSourceApiKey",key:"imagineSourceApiKey",settings:"imagineSourceApiKey",oauth:"imagineSourceOAuth","oauth-access":"imagineSourceOAuth","grok-cli-key":"imagineSourceCliKey","cli-key":"imagineSourceCliKey"},Ln=[{slug:"grok",route:"grok-build",titleKey:"grokTitle",descriptionKey:"grokDescription",methods:["pkce","device"],recommended:"pkce"},{slug:"codex",route:"codex-oauth",titleKey:"codexTitle",descriptionKey:"codexDescription",methods:["device","browser"],recommended:"device"},{slug:"kimi",route:"kimi-code-oauth",titleKey:"kimiTitle",descriptionKey:"kimiDescription",methods:["device"],recommended:"device"},{slug:"claude",route:"claude-code-oauth",titleKey:"claudeTitle",descriptionKey:"claudeDescription",methods:["browser"],recommended:"browser"}],En=[{id:"accounts",label:"tabAccounts"},{id:"gateway",label:"tabGateway"},{id:"capabilities",label:"tabCapabilities"},{id:"about",label:"tabAbout"}],_n={display:"flex",flexDirection:"column",gap:16,maxWidth:780},B={margin:0,fontSize:20,lineHeight:"28px",fontWeight:600,color:"var(--dsw-alias-label-primary)"},m={margin:0,fontSize:14,lineHeight:"22px",color:"var(--dsw-alias-label-secondary)"},X={display:"flex",flexDirection:"column",gap:14,padding:"18px 20px",border:"1px solid var(--dsw-alias-border-l2)",borderRadius:12,background:"var(--dsw-alias-bg-module-platform)"},ke={display:"flex",alignItems:"center",justifyContent:"space-between",flexWrap:"wrap",gap:12},M={display:"flex",alignItems:"center",gap:9,fontSize:14,fontWeight:500,color:"var(--dsw-alias-label-primary)"},S={boxSizing:"border-box",minHeight:34,padding:"6px 14px",border:"1px solid var(--dsw-alias-border-l4, rgba(127, 127, 127, 0.4))",borderRadius:18,background:"var(--dsw-alias-button-elevated-fill, var(--dsw-alias-bg-layer-1))",color:"var(--dsw-alias-label-primary)",boxShadow:"0 1px 2px rgba(0, 0, 0, 0.18)",font:"inherit",fontSize:14,fontWeight:500,cursor:"pointer"},q={...S,borderColor:"#315fc7",background:"#315fc7",color:"#ffffff",boxShadow:"0 1px 3px rgba(0, 0, 0, 0.28)",fontWeight:600},_={...m,color:"var(--dsw-alias-state-error-primary)"},On={...m,padding:"10px 12px",borderRadius:8,background:"var(--dsw-alias-bg-layer-1)"},Gn={fontFamily:"ui-monospace, SFMono-Regular, Menlo, Consolas, monospace",fontSize:20,letterSpacing:"0.08em",fontWeight:600,color:"var(--dsw-alias-label-primary)"},O={fontFamily:"ui-monospace, SFMono-Regular, Menlo, Consolas, monospace"},Kn={color:"var(--dsw-alias-brand-primary)",wordBreak:"break-all"},re={display:"flex",flexDirection:"column",gap:8,margin:0,padding:0,listStyle:"none"},se={display:"flex",alignItems:"flex-start",gap:8,fontSize:14,color:"var(--dsw-alias-label-primary)"},$e={boxSizing:"border-box",width:"100%",minHeight:34,padding:"6px 12px",border:"1px solid var(--dsw-alias-border-l2)",borderRadius:8,background:"var(--dsw-alias-bg-layer-1)",color:"var(--dsw-alias-label-primary)",font:"inherit",fontSize:13},de={display:"flex",flexDirection:"column",gap:8,padding:"12px 14px",border:"1px solid var(--dsw-alias-border-l2)",borderRadius:8,background:"var(--dsw-alias-bg-layer-1)"},f={...m,fontSize:13},Un={display:"flex",flexWrap:"wrap",gap:8},Hn={...S,borderRadius:10},Fn={...q,borderRadius:10},Bn={display:"flex",flexDirection:"column",gap:14,minWidth:0},Mn={display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(320px, 1fr))",gap:14},je={display:"flex",alignItems:"center",justifyContent:"space-between",flexWrap:"wrap",gap:8};function V(e,t=!0){return{width:9,height:9,borderRadius:"50%",flex:"0 0 auto",background:t?e==="signed-in"||e==="available"?"var(--dsw-alias-state-success-primary, #22a06b)":e==="error"?"var(--dsw-alias-state-error-primary, #d92d20)":e==="signing-in"||e==="loading"?"var(--dsw-alias-brand-primary, #1677ff)":"var(--dsw-alias-label-dimmed, #9aa0a6)":"var(--dsw-alias-label-dimmed, #9aa0a6)"}}function h(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function w(e){return typeof e=="string"&&e.length>0&&e.length<500?e:void 0}function I(e){return typeof e=="number"&&Number.isFinite(e)?e:void 0}function xe(e){return typeof e=="boolean"?e:void 0}function Qe(e){let t=I(e);return t!==void 0&&t>=0&&t<=100?t:void 0}function Ri(e){return Ai.includes(e)}function Vn(e){return Cn.includes(e)}function Nn(e){return kn.includes(e)}function Dn(e){return Sn.includes(e)}function Wn(e){return vn.includes(e)}function Ae(e){return/eyJ[A-Za-z0-9_-]+\.|sk-[A-Za-z0-9_-]{8,}|Bearer\s+\S+/u.test(e)}function Ti(e,t){let o=w(e);return o===void 0||Ae(o)||o.length>180?Pi[t]:o}function qn(e){let t=w(e);if(!(t===void 0||Ae(t)))return t}function N(e){if(e===void 0||!Number.isFinite(e)||e<=0)return;let t=e>1e12?e:e>1e9?e*1e3:void 0;if(t===void 0)return;let o=new Date(t).toLocaleString();return o.length>0?o:void 0}function Li(e){return e instanceof Error&&e.name==="PluginRequestError"&&"status"in e}function zn(e){return Li(e)?e.status===409||e.code==="SETTINGS_CONFLICT"||/conflict/iu.test(e.message):e instanceof Error&&/SETTINGS_CONFLICT|settings-conflict|changed since it was read/iu.test(e.message)}var $n=new Set(["preview_invalid","preview_expired","source_changed","destination_changed","confirm_required","unsafe_destination"]);function jn(e){return Li(e)?e.code!==void 0&&$n.has(e.code)?!0:e.status===404||e.status===410:!1}function Ye(e,t=!1){fetch(xi,{method:"POST",headers:{accept:"application/json","content-type":"application/json"},credentials:"same-origin",body:JSON.stringify({previewId:e}),...t?{keepalive:!0}:{}}).catch(()=>{})}async function k(e,t="GET",o){let c=await fetch(e,{method:t,headers:{accept:"application/json",...o===void 0?{}:{"content-type":"application/json"}},credentials:"same-origin",...o===void 0?{}:{body:JSON.stringify(o)}}),l=await c.json().catch(()=>{});if(!c.ok){let b=h(l)?l:void 0,g=b!==void 0&&typeof b.error=="string"?b.error:b!==void 0&&typeof b.message=="string"?b.message:`HTTP ${c.status}`,R=b!==void 0&&typeof b.code=="string"?b.code:void 0,v=new Error(g);throw v.name="PluginRequestError",v.status=c.status,R!==void 0&&(v.code=R),v}return l}function Yn(e){if(!h(e)||typeof e.kind!="string"||!Ri(e.kind))return;let t=e.kind,o=w(e.reason),c=I(e.expiresAt);return{kind:t,displayPath:Ti(e.displayPath,t),available:e.available===!0,...c===void 0?{}:{expiresAt:c},...o!==void 0&&Vn(o)?{reason:o}:{}}}function Ei(e){return Ai.map(t=>e.find(c=>c.kind===t)??{kind:t,displayPath:Pi[t],available:!1,reason:"missing"})}function Xn(e){let t=Array.isArray(e)?e:h(e)&&Array.isArray(e.sources)?e.sources:[];return Ei(t.map(Yn).filter(o=>o!==void 0))}function Jn(e){if(!h(e))return;let t=w(e.previewId),o=w(e.kind);if(t===void 0||o===void 0||!Ri(o))return;let c=w(e.conflict),l=w(e.action),b=I(e.expiresAt),g=I(e.ticketExpiresAt),R=Array.isArray(e.warnings)?e.warnings.map(qn).filter(v=>v!==void 0):[];return{previewId:t,kind:o,displayPath:Ti(e.displayPath,o),confirmOverwriteRequired:e.confirmOverwriteRequired===!0,warnings:R,...b===void 0?{}:{expiresAt:b},...g===void 0?{}:{ticketExpiresAt:g},...c!==void 0&&Nn(c)?{conflict:c}:{},...l!==void 0&&Dn(l)?{action:l}:{}}}function Qn(e){if(!h(e))return;let t=w(e.action);return t!==void 0&&Wn(t)?t:void 0}function Xe(e,t,o,c){let l=I(e);return l!==void 0&&Number.isInteger(l)&&l>=t&&l<=o?l:c}function ki(){return{codexSearch:!1,codexImages:!1,codexImageEdits:!1,codexUsage:!1,codexFast:!1,grokImagineImage:!1,grokImagineVideo:!1,searchResults:5,imageCount:1,videoArtifactTtlMs:168*ce}}function Zn(e){let t=h(e)?e:{};return{codexSearch:t.codexSearch===!0,codexImages:t.codexImages===!0,codexImageEdits:t.codexImageEdits===!0,codexUsage:t.codexUsage===!0,codexFast:t.codexFast===!0,grokImagineImage:t.grokImagineImage===!0,grokImagineVideo:t.grokImagineVideo===!0,searchResults:Xe(t.searchResults,1,20,5),imageCount:Xe(t.imageCount,1,4,1),videoArtifactTtlMs:Xe(t.videoArtifactTtlMs,ce,168*ce,168*ce)}}function Si(e){if(!h(e))return;let t=h(e.value)?e.value:e,o=I(e.revision);if(!(o===void 0&&!h(e.value)&&e.writable===void 0))return{value:Zn(t),revision:o??0,writable:e.writable===!0}}function Se(e){if(!h(e))return;let t=Qe(e.usedPercent??e.used_percent),o=Qe(e.remainingPercent??e.remaining_percent),c=I(e.windowSeconds??e.limit_window_seconds),l=I(e.resetsAt??e.reset_at);if(!(t===void 0&&o===void 0&&c===void 0&&l===void 0))return{...t===void 0?{}:{usedPercent:t},...o===void 0?{}:{remainingPercent:o},...c!==void 0&&c>0?{windowSeconds:c}:{},...l===void 0?{}:{resetsAt:l}}}function ve(e,t){if(!h(e))return;let o=w(e.id)??w(e.metered_feature)??t,c=w(e.name)??w(e.limit_name),l=h(e.rate_limit)?e.rate_limit:e,b=Array.isArray(e.windows)?e.windows.map(Se).filter(g=>g!==void 0):[Se(l.primary_window),Se(l.secondary_window),Se(l)].filter(g=>g!==void 0);if(!(b.length===0&&c===void 0&&w(e.id)===void 0))return{id:o,windows:b,...c===void 0?{}:{name:c}}}function et(e){if(!h(e))return;let t=h(e.usage)?e.usage:e,o=[],c=new Set,l=u=>{u===void 0||c.has(u.id)||(c.add(u.id),o.push(u))};Array.isArray(t.rateLimits)?t.rateLimits.forEach((u,A)=>l(ve(u,`limit-${String(A)}`))):(l(ve(t.rate_limit,"codex")),Array.isArray(t.additional_rate_limits)&&t.additional_rate_limits.forEach((u,A)=>l(ve(u,`extra-${String(A)}`))),l(ve(t.code_review_rate_limit,"code_review")));let b=h(t.credits)?t.credits:void 0,g=h(t.individualLimit)?t.individualLimit:h(t.spend_control)?h(t.spend_control.individual_limit)?t.spend_control.individual_limit:t.spend_control:void 0,R=h(t.resetCredits)?t.resetCredits.availableCount:h(t.rate_limit_reset_credits)?t.rate_limit_reset_credits.available_count:void 0,v=I(R),ue=I(t.fetchedAt),ge=xe(t.spendControlReached)??(h(t.spend_control)?xe(t.spend_control.reached):void 0),pe=b===void 0?void 0:w(b.balance),J=g===void 0?void 0:w(g.limit),Q=g===void 0?void 0:w(g.used),x=g===void 0?void 0:w(g.remaining),G=g===void 0?void 0:Qe(g.remainingPercent??g.remaining_percent),T=g===void 0?void 0:I(g.resetsAt??g.reset_at);return{rateLimits:o,...b!==void 0&&typeof b.unlimited=="boolean"?{creditsUnlimited:b.unlimited}:{},...pe===void 0?{}:{creditsBalance:pe},...J===void 0?{}:{individualLimit:J},...Q===void 0?{}:{individualUsed:Q},...x===void 0?{}:{individualRemaining:x},...G===void 0?{}:{individualRemainingPercent:G},...T===void 0?{}:{individualResetsAt:T},...ge===void 0?{}:{spendControlReached:ge},...v!==void 0&&v>=0&&Number.isSafeInteger(v)?{resetCredits:v}:{},...ue===void 0?{}:{fetchedAt:ue}}}function it(e){return e.rateLimits.some(t=>t.windows.length>0||t.name!==void 0)||e.creditsUnlimited!==void 0||e.creditsBalance!==void 0||e.individualLimit!==void 0||e.individualUsed!==void 0||e.individualRemaining!==void 0||e.individualRemainingPercent!==void 0||e.spendControlReached===!0||e.resetCredits!==void 0}function Je(e){if(!h(e))return;let t=w(e.bind),o=I(e.port);if(!(t===void 0||o===void 0))return{enabled:e.enabled===!0,running:e.running===!0,bind:t,port:o,keyHint:w(e.keyHint)??"",warning:w(e.warning)??""}}function Ie(e,t){return`http://${e.includes(":")&&!e.startsWith("[")?`[${e}]`:e}:${String(t)}`}var _i=1024,Oi=65535,le=18100,nt=18999,tt=new Set([22,53,3080,7890,9090,18080]);function at(e){for(let t=0;t<32;t+=1){let o=nt-le+1,c=le+Math.floor(Math.random()*o);if(c!==e&&!tt.has(c))return c}return e===le?le+1:le}function vi(e){let t=Number(e);if(!(!Number.isInteger(t)||t<_i||t>Oi))return t}async function ot(e){try{if(typeof navigator<"u"&&navigator.clipboard?.writeText!==void 0)return await navigator.clipboard.writeText(e),!0}catch{}try{let t=document.createElement("textarea");t.value=e,t.setAttribute("readonly",""),t.style.position="fixed",t.style.left="-9999px",document.body.appendChild(t),t.select();let o=document.execCommand("copy");return document.body.removeChild(t),o}catch{return!1}}function rt(e){if(!h(e))return;let t=xe(e.configured);if(t===void 0&&e.source===void 0&&e.writable===void 0)return;let o=w(e.source),c=xe(e.writable);return{configured:t===!0,...o===void 0||Ae(o)?{}:{source:o},...c===void 0?{}:{writable:c}}}function st(e,t){if(e===void 0)return t("imagineSourceUnknown");let o=Ci[e]??Ci[e.toLowerCase()];return o!==void 0?t(o):e.length<=40&&/^[a-z0-9._-]+$/iu.test(e)&&!Ae(e)?e:t("imagineSourceUnknown")}function Ii(e,t){return t(e==="device"?"deviceLogin":e==="browser"?"browserLogin":"pkceLogin")}function dt(e){return e.status!=="signed-in"?{available:[],selected:[]}:{available:"available"in e?e.available:[],selected:"selected"in e?e.selected:[]}}function Gi({t:e}){if(e===void 0)throw new Error("Coding OAuth settings requires its translation function");let[t,o]=(0,r.useState)(void 0),[c,l]=(0,r.useState)(void 0),[b,g]=(0,r.useState)(void 0),[R,v]=(0,r.useState)({}),[ue,ge]=(0,r.useState)({}),[pe,J]=(0,r.useState)(void 0),[Q,x]=(0,r.useState)(void 0),[G,T]=(0,r.useState)(!1),[u,A]=(0,r.useState)(void 0),K=(0,r.useRef)(void 0),z=(0,r.useRef)(0),D=(0,r.useRef)(!0),[ye,Z]=(0,r.useState)(!1),[Ze,ei]=(0,r.useState)(void 0),[C,Pe]=(0,r.useState)(void 0),[ii,fe]=(0,r.useState)(void 0),[Re,ni]=(0,r.useState)(!1),[L,Te]=(0,r.useState)(void 0),[ti,Le]=(0,r.useState)(void 0),[Hi,Ee]=(0,r.useState)(!1),[ee,Fi]=(0,r.useState)(void 0),[_e,ai]=(0,r.useState)(void 0),[y,Oe]=(0,r.useState)(void 0),[Ge,U]=(0,r.useState)(void 0),[E,$]=(0,r.useState)(!1),[me,oi]=(0,r.useState)(void 0),[Ke,Ue]=(0,r.useState)(!1),[Bi,He]=(0,r.useState)(!1),[ri,ie]=(0,r.useState)(void 0),[be,ne]=(0,r.useState)(""),[W,Mi]=(0,r.useState)("accounts"),[Vi,Fe]=(0,r.useState)(void 0),[Ni,Be]=(0,r.useState)(void 0),[Di,Wi]=(0,r.useState)({}),j=(0,r.useRef)(void 0),H=(0,r.useCallback)(async()=>{try{o(await k(rn)),l(void 0)}catch(n){l(n instanceof Error?n.message:e("requestFailed"))}},[e]),he=(0,r.useCallback)(async()=>{try{J(Xn(await k(gn))),x(void 0)}catch(n){J(Ei([])),x(n instanceof Error?n.message:e("sourcesLoadFailed"))}},[e]),we=(0,r.useCallback)(async()=>{try{let n=Si(await k(hi));return Pe(n??{value:ki(),revision:0,writable:!1}),fe(void 0),n}catch(n){Pe({value:ki(),revision:0,writable:!1}),fe(n instanceof Error?n.message:e("capabilitiesLoadFailed"));return}},[e]),Me=(0,r.useCallback)(async()=>{try{Oe(Je(await k(ze))),U(void 0)}catch(n){U(n instanceof Error?n.message:e("gatewayLoadFailed"))}},[e]),si=(0,r.useCallback)(async()=>{try{Fi(rt(await k(mn))),ai(void 0)}catch(n){ai(n instanceof Error?n.message:e("imagineLoadFailed"))}},[e]),di=(0,r.useCallback)(async()=>{Ee(!0);try{Te(et(await k(fn))),Le(void 0)}catch(n){Te(void 0),Le(n instanceof Error?n.message:e("usageUnavailable"))}finally{Ee(!1)}},[e]);(0,r.useEffect)(()=>{H(),he(),we(),si(),Me()},[H,he,we,si,Me]),(0,r.useEffect)(()=>{K.current=u},[u]),(0,r.useEffect)(()=>(D.current=!0,()=>{D.current=!1,j.current!==void 0&&window.clearTimeout(j.current),z.current+=1;let n=K.current;n!==void 0&&Ye(n.previewId,!0)}),[]),(0,r.useEffect)(()=>{if(!(t!==void 0&&Object.values(t.providers).some(d=>d.status==="signing-in")))return;let a=window.setInterval(()=>{H()},wn);return()=>{window.clearInterval(a)}},[H,t]),(0,r.useEffect)(()=>{let n=t?.providers.codex.status==="signed-in";if(C?.value.codexUsage===!0&&n){di();return}Te(void 0),Le(void 0),Ee(!1)},[C?.value.codexUsage,di,t?.providers.codex.status]);let li=async(n,a)=>{let d=window.open("about:blank","_blank");d!==null&&(d.opener=null),g(n),l(void 0),ge(s=>({...s,[n]:d===null}));try{let s=await k(sn,"POST",{provider:n,method:a});d!==null&&d.location.replace(s.url),await H()}catch(s){d?.close(),l(s instanceof Error?s.message:e("requestFailed")),await H()}finally{g(void 0)}},ci=async n=>{let a=R[n]?.trim()??"";if(a.length!==0){g(n);try{await k(dn,"POST",{provider:n,code:a}),v(d=>({...d,[n]:""})),await H()}catch(d){l(d instanceof Error?d.message:e("requestFailed"))}finally{g(void 0)}}},qi=async n=>{g(n);try{o(await k(ln,"POST",{provider:n}))}catch(a){l(a instanceof Error?a.message:e("requestFailed"))}finally{g(void 0)}},zi=async n=>{g(n);try{o(await k(cn,"POST",{provider:n}))}catch(a){l(a instanceof Error?a.message:e("requestFailed"))}finally{g(void 0)}},ui=async(n,a)=>{g(n);try{o(await k(un,"POST",{provider:n,selected:a}))}catch(d){l(d instanceof Error?d.message:e("requestFailed"))}finally{g(void 0)}},gi=async n=>{let a=++z.current,d=K.current;d!==void 0&&(K.current=void 0,A(void 0),Ye(d.previewId)),T(!0),ei(void 0),Z(!1);try{let s=Jn(await k(pn,"POST",{kind:n}));if(s===void 0)throw new Error(e("sourcesPreviewFailed"));if(!D.current||a!==z.current){Ye(s.previewId,!D.current);return}K.current=s,A(s),x(void 0)}catch(s){if(!D.current||a!==z.current)return;A(void 0),x(s instanceof Error?s.message:e("sourcesPreviewFailed"))}finally{D.current&&a===z.current&&T(!1)}},$i=async()=>{if(u!==void 0&&u.action!=="blocked"&&!(u.confirmOverwriteRequired&&!ye)){T(!0);try{let n=await k(yn,"POST",{kind:u.kind,previewId:u.previewId,confirmOverwrite:ye}),a=Qn(n);K.current=void 0,A(void 0),Z(!1),ei(e("sourcesCommitSuccess",{action:a===void 0?"":e(Rn[a])})),x(void 0),await he(),await H()}catch(n){jn(n)&&(K.current=void 0,A(void 0),Z(!1)),x(n instanceof Error?n.message:e("sourcesCommitFailed")),await he()}finally{T(!1)}}},ji=async()=>{if(u===void 0)return;let n=u.previewId;z.current+=1,K.current=void 0,A(void 0),Z(!1),T(!0);try{await k(xi,"POST",{previewId:n}),x(void 0)}catch(a){x(a instanceof Error?a.message:e("requestFailed"))}finally{T(!1)}},Ve=async(n,a)=>{if(C===void 0||!C.writable||n==="codexImageEdits"&&a===!0&&!C.value.codexImages)return!1;let d=n==="codexImages"&&a===!1&&C.value.codexImageEdits?{codexImages:!1,codexImageEdits:!1}:{[n]:a};ni(!0);try{let s=Si(await k(hi,"PATCH",{expectedRevision:C.revision,patch:d}));return s!==void 0?Pe(s):await we(),fe(void 0),!0}catch(s){return await we(),fe(zn(s)?e("capabilitiesConflictRefreshed"):s instanceof Error?s.message:e("capabilitiesSaveFailed")),!1}finally{ni(!1)}},pi=C?.value.codexUsage===!0&&t?.providers.codex.status==="signed-in",Yi=n=>{j.current!==void 0&&window.clearTimeout(j.current),Fe(n),Be(void 0),j.current=window.setTimeout(()=>{D.current&&(Fe(void 0),Be(void 0)),j.current=void 0},2e3)},Ne=async(n,a)=>{if(await ot(a)){Yi(n);return}Fe(void 0),Be(n)},De=(n,a)=>Vi===n?e("copied"):Ni===n?e("copyFailed"):a??e("copy"),yi=async()=>{if(me!==void 0)return me;let n=await k(bn,"POST");if(typeof n.apiKey!="string"||n.apiKey.length===0)throw new Error(e("gatewayRevealFailed"));return oi(n.apiKey),n.apiKey},Xi=async()=>{try{let n=await yi();await Ne("key",n),ie(void 0)}catch{ie(e("gatewayRevealFailed"))}},Ji=async()=>{if(Ke){Ue(!1);return}try{await yi(),Ue(!0),ie(void 0)}catch{ie(e("gatewayRevealFailed"))}};(0,r.useEffect)(()=>{y!==void 0&&ne(String(y.port))},[y]);let fi=async()=>{let n=vi(be);if(n===void 0){U(e("gatewayPortInvalid"));return}if(!(y!==void 0&&n===y.port)){$(!0);try{Oe(Je(await k(ze,"PATCH",{port:n}))??y),U(void 0)}catch(a){U(a instanceof Error?a.message:e("gatewaySaveFailed")),y!==void 0&&ne(String(y.port))}finally{$(!1)}}},Qi=async()=>{$(!0);try{let n=await k(hn,"POST");typeof n.apiKey=="string"&&oi(n.apiKey),Ue(!0),He(!1),ie(void 0),await Me()}catch(n){U(n instanceof Error?n.message:e("gatewaySaveFailed"))}finally{$(!1)}};return(0,i.jsxs)("section",{style:_n,"aria-labelledby":"coding-oauth-settings-title",children:[(0,i.jsxs)("div",{children:[(0,i.jsx)("h2",{id:"coding-oauth-settings-title",style:B,children:e("title")}),(0,i.jsx)("p",{style:{...m,marginTop:6},children:e("intro")})]}),c===void 0?null:(0,i.jsx)("p",{style:_,role:"alert",children:c}),(0,i.jsx)("nav",{style:Un,"aria-label":e("title"),children:En.map(n=>(0,i.jsx)("button",{type:"button",style:W===n.id?Fn:Hn,"aria-current":W===n.id?"page":void 0,onClick:()=>{Mi(n.id)},children:e(n.label)},n.id))}),(0,i.jsxs)("div",{style:Bn,children:[W==="accounts"?t===void 0?(0,i.jsx)("div",{style:X,children:(0,i.jsxs)("div",{style:M,children:[(0,i.jsx)("span",{"aria-hidden":"true",style:V("loading")}),e("loadingAccount")]})}):(0,i.jsxs)(i.Fragment,{children:[Q===void 0?null:(0,i.jsx)("p",{style:_,role:"alert",children:Q}),Ze===void 0?null:(0,i.jsx)("p",{style:m,role:"status",children:Ze}),(0,i.jsx)("div",{style:Mn,children:Ln.map(n=>{let a=t.providers[n.slug],d=n.slug==="grok"?a:void 0,s=b===n.slug,P=a.status==="signed-in"?e("signedIn"):a.status==="signing-in"?e("signingIn"):a.status==="error"?e("requestFailed"):e("signedOut"),F=a.status==="signing-in"?a.method:n.recommended,{available:te,selected:ae}=dt(a),mi=R[n.slug]??"",oe=pe?.find(p=>p.kind===n.slug),Ce=a.status==="signing-in"||Di[n.slug]===!0,bi=n.slug==="codex"&&pi?L?.individualRemainingPercent===void 0?L?.rateLimits[0]?.windows[0]?.usedPercent:100-L.individualRemainingPercent:void 0;return(0,i.jsxs)("div",{style:X,children:[(0,i.jsxs)("div",{style:ke,children:[(0,i.jsxs)("div",{children:[(0,i.jsx)("h3",{style:{...B,fontSize:16},children:e(n.titleKey)}),a.status==="signed-in"&&!Ce?(0,i.jsxs)("p",{style:{...f,marginTop:4},children:[e("modelsSummary",{selected:ae.length,total:te.length}),bi===void 0?"":` \xB7 ${e("usageUsedShort",{value:`${String(bi)}%`})}`]}):(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)("p",{style:{...m,marginTop:4},children:e(n.descriptionKey)}),(0,i.jsx)("p",{style:{...m,marginTop:4},children:(0,i.jsx)("span",{style:O,children:n.route})})]})]}),(0,i.jsxs)("div",{style:M,role:"status",children:[(0,i.jsx)("span",{"aria-hidden":"true",style:V(a.status)}),(0,i.jsx)("span",{children:P})]})]}),(0,i.jsx)("div",{style:{display:"flex",flexWrap:"wrap",gap:8},children:a.status==="signed-in"?(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)("button",{type:"button",style:S,disabled:s,onClick:()=>{zi(n.slug)},children:e(s?"working":"logout")}),(0,i.jsx)("button",{type:"button",style:S,onClick:()=>{Wi(p=>({...p,[n.slug]:!Ce}))},children:e(Ce?"collapseModels":"expandModels")}),oe?.available===!0?(0,i.jsx)("button",{type:"button",style:S,disabled:G,onClick:()=>{gi(n.slug)},children:e("sourcesPullCopy")}):null]}):a.status==="signing-in"?(0,i.jsxs)(i.Fragment,{children:[n.methods.filter(p=>p!==F).map(p=>(0,i.jsx)("button",{type:"button",style:S,disabled:s,onClick:()=>{li(n.slug,p)},children:Ii(p,e)},p)),(0,i.jsx)("button",{type:"button",style:S,disabled:s,onClick:()=>{qi(n.slug)},children:e("cancelLogin")})]}):(0,i.jsxs)(i.Fragment,{children:[n.methods.map((p,Y)=>(0,i.jsx)("button",{type:"button",style:Y===0?q:S,disabled:s,onClick:()=>{li(n.slug,p)},children:s?e("working"):Ii(p,e)},p)),oe?.available===!0?(0,i.jsx)("button",{type:"button",style:S,disabled:G,onClick:()=>{gi(n.slug)},children:e("sourcesPullCopy")}):oe!==void 0&&oe.reason!==void 0?(0,i.jsx)("span",{style:f,children:e(xn[oe.reason])}):null]})}),a.status==="error"?(0,i.jsx)("p",{style:_,children:a.message}):null,a.status==="signing-in"&&a.userCode!==void 0?(0,i.jsxs)("p",{style:m,children:[e("userCode")," ",(0,i.jsx)("span",{style:Gn,children:a.userCode})]}):null,a.status==="signing-in"&&a.url!==void 0?(0,i.jsxs)("p",{style:m,children:[ue[n.slug]===!0?e("popupBlocked"):e("openUrl")," ",(0,i.jsx)("a",{href:a.url,target:"_blank",rel:"noreferrer",style:Kn,children:a.url})]}):null,a.status==="signing-in"&&F!=="device"?(0,i.jsxs)("div",{style:{display:"flex",flexDirection:"column",gap:8},children:[(0,i.jsx)("p",{style:m,children:e(F==="browser"?"pasteBrowserCodeHint":"pasteCodeHint")}),(0,i.jsxs)("div",{style:{display:"flex",flexWrap:"wrap",gap:8},children:[(0,i.jsx)("input",{style:{...$e,flex:"1 1 360px"},value:mi,placeholder:e("pasteCodePlaceholder"),disabled:s,onChange:p=>v(Y=>({...Y,[n.slug]:p.target.value})),onKeyDown:p=>{p.key==="Enter"&&(p.preventDefault(),ci(n.slug))}}),(0,i.jsx)("button",{type:"button",style:q,disabled:s||mi.trim().length===0,onClick:()=>{ci(n.slug)},children:e("submitCode")})]})]}):null,a.status==="signed-in"&&Ce?(0,i.jsxs)("div",{style:{display:"flex",flexDirection:"column",gap:8},children:[(0,i.jsxs)("div",{style:ke,children:[(0,i.jsx)("h4",{style:{...B,fontSize:14},children:e("models")}),(0,i.jsx)("button",{type:"button",style:S,disabled:s,onClick:()=>{ui(n.slug,[])},children:e("selectAll")})]}),d?.status==="signed-in"?(0,i.jsx)("p",{style:m,children:d.catalogSource==="live"?e("catalogLive"):d.catalogSource==="cache"?e("catalogCache"):e("catalogFallback")}):null,(0,i.jsxs)("p",{style:m,children:[e("modelHint")," ",(0,i.jsxs)("span",{style:O,children:[n.route,"/<id>"]})]}),(0,i.jsx)("ul",{style:re,children:te.map(p=>{let Y=ae.includes(p);return(0,i.jsx)("li",{children:(0,i.jsxs)("label",{style:se,children:[(0,i.jsx)("input",{type:"checkbox",checked:Y,disabled:s,onChange:()=>{let We=new Set(ae);Y?We.delete(p):We.add(p),ui(n.slug,[...We])}}),(0,i.jsx)("span",{style:O,children:p})]})},p)})}),d?.status==="signed-in"&&d.catalogError!==void 0?(0,i.jsx)("p",{style:_,children:e("catalogError")}):null,n.slug==="codex"&&pi?(0,i.jsxs)("div",{style:de,children:[(0,i.jsx)("p",{style:{...m,color:"var(--dsw-alias-label-primary)"},children:e("usageTitle")}),ti===void 0?null:(0,i.jsx)("p",{style:_,role:"alert",children:ti}),Hi&&L===void 0?(0,i.jsx)("p",{style:f,children:e("usageLoading")}):L===void 0||!it(L)?(0,i.jsx)("p",{style:f,children:e("usageEmpty")}):(0,i.jsxs)(i.Fragment,{children:[N(L.fetchedAt)===void 0?null:(0,i.jsx)("p",{style:f,children:e("usageFetchedAt",{time:N(L.fetchedAt)})}),L.rateLimits.map(p=>(0,i.jsxs)("p",{style:f,children:[p.name??e("usageRateLimit"),p.windows[0]?.usedPercent===void 0?"":` \xB7 ${e("usageUsed",{value:`${String(p.windows[0].usedPercent)}%`})}`,N(p.windows[0]?.resetsAt)===void 0?"":` \xB7 ${e("usageResets",{time:N(p.windows[0]?.resetsAt)})}`]},p.id))]})]}):null]}):null]},n.slug)})}),u===void 0?null:(0,i.jsxs)("div",{style:X,"aria-live":"polite",children:[(0,i.jsxs)("p",{style:m,children:[e("sourcesPreviewTitle")," \xB7 ",e(In[u.kind])]}),(0,i.jsx)("p",{style:f,children:(0,i.jsx)("span",{style:O,children:u.displayPath})}),(0,i.jsx)("p",{style:m,children:e("sourcesConflict",{detail:e(u.conflict===void 0?"sourceConflictUnrecognized":An[u.conflict])})}),(0,i.jsx)("p",{style:m,children:e("sourcesAction",{detail:e(u.action===void 0?"sourceActionUnrecognized":Pn[u.action])})}),N(u.expiresAt)===void 0?null:(0,i.jsx)("p",{style:f,children:e("sourcesPreviewExpires",{time:N(u.expiresAt)})}),N(u.ticketExpiresAt)===void 0?null:(0,i.jsx)("p",{style:f,children:e("sourcesTicketExpires",{time:N(u.ticketExpiresAt)})}),u.warnings.length===0?null:(0,i.jsx)("ul",{style:{...re,gap:4},"aria-label":e("sourcesWarnings"),children:u.warnings.map(n=>(0,i.jsx)("li",{style:f,children:n},n))}),u.confirmOverwriteRequired?(0,i.jsxs)("label",{style:se,children:[(0,i.jsx)("input",{type:"checkbox",checked:ye,disabled:G||u.action==="blocked",onChange:n=>Z(n.target.checked)}),(0,i.jsxs)("span",{children:[e("sourcesConfirmOverwrite"),(0,i.jsx)("span",{style:{display:"block",...f},children:e("sourcesConfirmOverwriteHint")})]})]}):null,(0,i.jsxs)("div",{style:{display:"flex",flexWrap:"wrap",gap:8},children:[(0,i.jsx)("button",{type:"button",style:q,disabled:G||u.action==="blocked"||u.confirmOverwriteRequired&&!ye,onClick:()=>{$i()},children:e("sourcesCommit")}),(0,i.jsx)("button",{type:"button",style:S,disabled:G,onClick:()=>{ji()},children:e("sourcesCancelPreview")})]})]})]}):null,W==="capabilities"?(0,i.jsxs)("section",{style:X,"aria-labelledby":"coding-oauth-capabilities-title",children:[(0,i.jsxs)("div",{children:[(0,i.jsx)("h3",{id:"coding-oauth-capabilities-title",style:{...B,fontSize:16},children:e("capabilitiesTitle")}),(0,i.jsx)("p",{style:{...m,marginTop:4},children:e("capabilitiesIntro")}),(0,i.jsx)("p",{style:{...f,marginTop:4},children:e("capabilitiesQuotaHint")})]}),_e===void 0?null:(0,i.jsx)("p",{style:_,role:"alert",children:_e}),ee===void 0&&_e===void 0?(0,i.jsxs)("div",{style:M,role:"status",children:[(0,i.jsx)("span",{"aria-hidden":"true",style:V("loading")}),e("imagineLoading")]}):ee===void 0?null:(0,i.jsxs)("div",{style:de,children:[(0,i.jsxs)("p",{style:M,role:"status",children:[(0,i.jsx)("span",{"aria-hidden":"true",style:V(ee.configured?"available":"unavailable")}),(0,i.jsx)("span",{children:ee.configured?e("imagineConfigured"):e("imagineNotConfigured")})]}),(0,i.jsx)("p",{style:f,children:e("imagineSource",{source:st(ee.source,e)})})]}),ii===void 0?null:(0,i.jsx)("p",{style:_,role:"alert",children:ii}),C===void 0?(0,i.jsxs)("div",{style:M,role:"status",children:[(0,i.jsx)("span",{"aria-hidden":"true",style:V("loading")}),e("capabilitiesLoading")]}):(0,i.jsxs)("fieldset",{style:{border:0,margin:0,padding:0,minWidth:0},children:[(0,i.jsx)("legend",{style:{...m,position:"absolute",width:1,height:1,overflow:"hidden"},children:e("capabilitiesTitle")}),C.writable?null:(0,i.jsx)("p",{style:f,children:e("capabilitiesReadOnly")}),(0,i.jsx)("ul",{style:re,children:wi.filter(n=>!n.key.startsWith("grokImagine")).map(n=>{let a=C.value[n.key],d=n.requiresImages===!0&&!C.value.codexImages,s=Re||!C.writable||d;return(0,i.jsx)("li",{children:(0,i.jsxs)("label",{style:se,children:[(0,i.jsx)("input",{type:"checkbox",checked:a,disabled:s,"aria-describedby":`cap-hint-${n.key}`,onChange:P=>{Ve(n.key,P.target.checked)}}),(0,i.jsxs)("span",{children:[(0,i.jsx)("span",{style:{display:"block"},children:e(n.label)}),(0,i.jsx)("span",{id:`cap-hint-${n.key}`,style:{display:"block",...f},children:e(n.hint)})]})]})},n.key)})}),(0,i.jsx)("h4",{style:{...B,fontSize:14},children:e("imagineTitle")}),(0,i.jsx)("ul",{style:re,children:wi.filter(n=>n.key.startsWith("grokImagine")).map(n=>{let a=C.value[n.key],d=Re||!C.writable;return(0,i.jsx)("li",{children:(0,i.jsxs)("label",{style:se,children:[(0,i.jsx)("input",{type:"checkbox",checked:a,disabled:d,"aria-describedby":`cap-hint-${n.key}`,onChange:s=>{Ve(n.key,s.target.checked)}}),(0,i.jsxs)("span",{children:[(0,i.jsx)("span",{style:{display:"block"},children:e(n.label)}),(0,i.jsx)("span",{id:`cap-hint-${n.key}`,style:{display:"block",...f},children:e(n.hint)})]})]})},n.key)})}),(0,i.jsxs)("div",{style:de,children:[(0,i.jsx)("h4",{style:{...B,fontSize:14},children:e("capabilityLimitsTitle")}),(0,i.jsx)("p",{style:f,children:e("capabilityLimitsHint")}),(0,i.jsx)("ul",{style:re,children:Tn.map(n=>{let a=C.value[n.key]/n.scale,d=`cap-limit-${n.key}`;return(0,i.jsxs)("li",{style:ke,children:[(0,i.jsxs)("label",{htmlFor:d,style:{...m,flex:"1 1 360px"},children:[(0,i.jsx)("span",{style:{display:"block",color:"var(--dsw-alias-label-primary)"},children:e(n.label)}),(0,i.jsx)("span",{id:`${d}-hint`,style:{display:"block",...f},children:e(n.hint)})]}),(0,i.jsx)("input",{id:d,type:"number",inputMode:"numeric",min:n.min,max:n.max,step:1,defaultValue:a,disabled:Re||!C.writable,"aria-describedby":`${d}-hint`,style:{...$e,width:112,flex:"0 0 112px"},onInput:s=>s.currentTarget.setCustomValidity(""),onKeyDown:s=>{s.key==="Enter"&&s.currentTarget.blur(),s.key==="Escape"&&(s.currentTarget.value=String(a),s.currentTarget.setCustomValidity(""))},onBlur:s=>{let P=s.currentTarget,F=Number(P.value);if(!Number.isInteger(F)||F<n.min||F>n.max){P.setCustomValidity(e("capabilityLimitInvalid",{min:n.min,max:n.max})),P.reportValidity();return}P.setCustomValidity("");let te=F*n.scale;te!==C.value[n.key]&&Ve(n.key,te).then(ae=>{!ae&&P.isConnected&&(P.value=String(a))})}},`${n.key}-${String(C.revision)}-${String(a)}`)]},n.key)})})]})]})]}):null,W==="about"?(0,i.jsx)("p",{style:On,children:e("termsWarning")}):null,W==="gateway"?(0,i.jsxs)("section",{style:X,"aria-labelledby":"coding-oauth-gateway-title",children:[(0,i.jsxs)("div",{children:[(0,i.jsx)("h3",{id:"coding-oauth-gateway-title",style:{...B,fontSize:16},children:e("gatewayTitle")}),(0,i.jsx)("p",{style:{...m,marginTop:4},children:e("gatewayIntro")}),(0,i.jsx)("p",{style:{...f,marginTop:8},children:e("gatewayWarning")})]}),Ge===void 0?null:(0,i.jsx)("p",{style:_,role:"alert",children:Ge}),ri===void 0?null:(0,i.jsx)("p",{style:_,role:"alert",children:ri}),y===void 0&&Ge===void 0?(0,i.jsxs)("div",{style:M,role:"status",children:[(0,i.jsx)("span",{"aria-hidden":"true",style:V("loading")}),e("gatewayLoading")]}):y===void 0?null:(0,i.jsxs)("div",{style:de,children:[(0,i.jsxs)("p",{style:M,role:"status",children:[(0,i.jsx)("span",{"aria-hidden":"true",style:V(y.running?"available":"unavailable")}),(0,i.jsx)("span",{children:y.running?e("gatewayRunning"):e("gatewayStopped")})]}),(0,i.jsxs)("label",{style:se,children:[(0,i.jsx)("input",{type:"checkbox",checked:y.enabled,disabled:E,onChange:n=>{let a=n.target.checked;$(!0),k(ze,"PATCH",{enabled:a}).then(d=>{Oe(Je(d)??y),U(void 0)}).catch(d=>{U(d instanceof Error?d.message:e("gatewaySaveFailed"))}).finally(()=>$(!1))}}),(0,i.jsx)("span",{children:e("gatewayEnabled")})]}),(0,i.jsxs)("div",{children:[(0,i.jsx)("label",{htmlFor:"coding-oauth-gateway-port",style:{...m,color:"var(--dsw-alias-label-primary)"},children:e("gatewayPort")}),(0,i.jsx)("p",{id:"coding-oauth-gateway-port-hint",style:f,children:e("gatewayPortHint")}),(0,i.jsxs)("div",{style:{display:"flex",flexWrap:"wrap",gap:8,marginTop:8},children:[(0,i.jsx)("input",{id:"coding-oauth-gateway-port",type:"number",inputMode:"numeric",min:_i,max:Oi,step:1,value:be,disabled:E,"aria-describedby":"coding-oauth-gateway-port-hint",style:{...$e,width:112,flex:"0 0 112px"},onChange:n=>ne(n.target.value),onKeyDown:n=>{n.key==="Enter"&&(n.preventDefault(),fi()),n.key==="Escape"&&y!==void 0&&ne(String(y.port))}}),(0,i.jsx)("button",{type:"button",style:q,disabled:E||be===String(y.port)||vi(be)===void 0,onClick:()=>{fi()},children:e("gatewayPortApply")}),(0,i.jsx)("button",{type:"button",style:S,disabled:E,onClick:()=>{ne(String(at(y.port)))},children:e("gatewayPortRandom")})]})]}),(0,i.jsxs)("p",{style:je,children:[(0,i.jsxs)("span",{style:f,children:[e("gatewayOpenAiUrl"),(0,i.jsx)("span",{style:{display:"block",...O},children:`${Ie(y.bind,y.port)}/v1`})]}),(0,i.jsx)("button",{type:"button",style:q,onClick:()=>{Ne("openai",`${Ie(y.bind,y.port)}/v1`)},children:De("openai")})]}),(0,i.jsxs)("p",{style:je,children:[(0,i.jsxs)("span",{style:f,children:[e("gatewayAnthropicUrl"),(0,i.jsx)("span",{style:{display:"block",...O},children:Ie(y.bind,y.port)})]}),(0,i.jsx)("button",{type:"button",style:S,onClick:()=>{Ne("anthropic",Ie(y.bind,y.port))},children:De("anthropic")})]}),(0,i.jsxs)("p",{style:je,children:[(0,i.jsxs)("span",{style:f,children:[e("gatewayKeyHint"),(0,i.jsx)("span",{style:{display:"block",...O,overflowWrap:"anywhere"},children:Ke&&me!==void 0?me:y.keyHint||"\u2014"})]}),(0,i.jsxs)("span",{style:{display:"flex",flexWrap:"wrap",gap:8},children:[(0,i.jsx)("button",{type:"button",style:q,disabled:E,onClick:()=>{Xi()},children:De("key",e("gatewayCopyKey"))}),(0,i.jsx)("button",{type:"button",style:S,disabled:E,onClick:()=>{Ji()},children:e(Ke?"gatewayHideKey":"gatewayShowKey")})]})]}),(0,i.jsx)("p",{style:f,children:e("gatewayKeyCopyHint")}),Bi?(0,i.jsxs)("div",{style:de,children:[(0,i.jsx)("p",{style:m,children:e("gatewayRotateConfirm")}),(0,i.jsx)("p",{style:f,children:e("gatewayRotateConfirmHint")}),(0,i.jsxs)("div",{style:{display:"flex",flexWrap:"wrap",gap:8},children:[(0,i.jsx)("button",{type:"button",style:S,disabled:E,onClick:()=>{Qi()},children:e("gatewayRotateConfirmAction")}),(0,i.jsx)("button",{type:"button",style:S,disabled:E,onClick:()=>He(!1),children:e("gatewayRotateCancel")})]})]}):(0,i.jsx)("button",{type:"button",style:S,disabled:E,onClick:()=>He(!0),children:e("gatewayRotate")})]})]}):null,W==="about"&&t!==void 0?(0,i.jsxs)("div",{style:X,children:[(0,i.jsxs)("div",{style:ke,children:[(0,i.jsxs)("div",{children:[(0,i.jsx)("h3",{style:{...B,fontSize:16},children:e("antigravityTitle")}),(0,i.jsx)("p",{style:{...m,marginTop:4},children:e("antigravityDescription")}),(0,i.jsx)("p",{style:{...m,marginTop:4},children:(0,i.jsx)("span",{style:O,children:t.antigravity.route})})]}),(0,i.jsxs)("div",{style:M,role:"status",children:[(0,i.jsx)("span",{"aria-hidden":"true",style:V("signed-out",t.antigravity.installed)}),(0,i.jsx)("span",{children:t.antigravity.installed?e("antigravityInstalled"):e("antigravityMissing")})]})]}),(0,i.jsx)("p",{style:m,children:e("antigravityCliHint")}),(0,i.jsx)("code",{style:{...O,fontSize:12,overflowWrap:"anywhere"},children:e("antigravityCliCommand")})]}):null]})]})}var Ki={nav:"Coding OAuth",title:"Coding subscriptions",intro:"Use your own Grok Build, ChatGPT Codex, Kimi Code, and Claude Code subscriptions in dsh. API-key routes remain separate.",termsWarning:"These are unofficial third-party integrations with subscription services. Provider terms, quotas, regions, and account-risk policies still apply.",loadingAccount:"Loading accounts\u2026",signedOut:"Not signed in",signingIn:"Waiting for authorization\u2026",signedIn:"Signed in",requestFailed:"The account request failed.",logout:"Sign out",working:"Working\u2026",cancelLogin:"Cancel sign-in",deviceLogin:"Sign in with device code",browserLogin:"Sign in in browser",pkceLogin:"Sign in with authorization code",userCode:"Enter this code when the provider asks:",openUrl:"Complete sign-in at:",popupBlocked:"The browser blocked the sign-in window. Open this URL manually:",pasteCodeHint:"Paste the authorization code or complete redirect URL returned by the provider. For local PKCE, use this only if the callback could not reach this DSH host:",pasteBrowserCodeHint:"Paste the authorization code or complete redirect URL returned by the provider to finish this browser sign-in:",pasteCodePlaceholder:"authorization code or complete redirect URL",submitCode:"Submit code",importGrok:"Import from Grok CLI",importHint:"Copies ~/.grok/auth.json into dsh. A later dsh refresh may rotate the token and sign the Grok CLI out.",models:"Visible models",catalogLive:"From your current xAI account",catalogCache:"From the last successful xAI listing",catalogFallback:"Built-in Grok baseline (live listing unavailable)",catalogError:"Could not refresh the live Grok model list.",selectAll:"Show all",modelHint:"Checked models appear in the model picker as",grokTitle:"xAI Grok Build",grokDescription:"SuperGrok / X Premium coding subscription through the Grok Build endpoint.",codexTitle:"OpenAI Codex",codexDescription:"ChatGPT Plus/Pro Codex entitlement. Device code is recommended for a remote DSH host.",kimiTitle:"Kimi Code",kimiDescription:"Kimi Code membership through auth.kimi.com and api.kimi.com/coding; this is not the Moonshot API-key platform.",claudeTitle:"Claude Code",claudeDescription:"Claude Pro/Max OAuth with Claude Code scopes and automatic refresh.",antigravityTitle:"Google Antigravity",antigravityDescription:"Provided by the separately pinned MIT dsh-agy plugin and exposed as the agy route.",antigravityInstalled:"Installed (CLI-managed)",antigravityMissing:"Not installed",antigravityCliHint:"The unauthenticated dsh-agy web export dashboard is disabled. Manage Google OAuth with the profile-local CLI when needed.",antigravityCliCommand:"dsh plugin --profile web exec dsh-agy login --headless",sourcesTitle:"Pull a copy from official CLI files",sourcesIntro:"dsh can discover a local official CLI login and pull a one-way copy into its own store. Official CLI files stay read-only and are never modified.",sourcesReadOnlyHint:"This is a one-way pull of a copy. dsh does not update, replace, or write back the official CLI documents.",sourcesLoading:"Looking for official CLI login files\u2026",sourcesCheckAgain:"Check again",sourcesAvailable:"A readable copy is available",sourcesUnavailable:"No usable copy found",sourcesPullCopy:"Pull a copy",sourcesPreviewTitle:"Review this copy before saving it in dsh",sourcesPreviewExpires:"CLI credential expiry: {time}",sourcesTicketExpires:"This preview expires at {time}",sourcesConflict:"Stored dsh credential: {detail}",sourcesAction:"If you continue: {detail}",sourcesWarnings:"Notes",sourcesConfirmOverwrite:"Replace the credential already stored in dsh with this copy",sourcesConfirmOverwriteHint:"A different credential is already stored. Check the box, then confirm the pull.",sourcesCommit:"Confirm pull",sourcesCancelPreview:"Cancel preview",sourcesCommitSuccess:"Copied into dsh ({action}).",sourcesPreviewFailed:"Could not prepare a copy from that CLI file.",sourcesCommitFailed:"Could not save the copy in dsh.",sourcesLoadFailed:"Could not look for official CLI login files.",sourceKindGrok:"Grok CLI",sourceKindCodex:"Codex CLI",sourceKindKimi:"Kimi Code CLI",sourceKindClaude:"Claude Code CLI",sourceReasonMissing:"No official CLI file was found at the expected location.",sourceReasonUnsafe:"The official CLI file is not safe to read (permissions or file type).",sourceReasonInvalid:"The official CLI file is present but is not a usable OAuth login.",sourceReasonTooLarge:"The official CLI file is larger than the allowed read limit.",sourceConflictNone:"dsh has no stored credential yet",sourceConflictSameCredential:"same credential already stored",sourceConflictSameAccount:"same account, different credential",sourceConflictDifferentAccount:"a different account is already stored",sourceConflictUnknownAccount:"an existing credential is stored (account could not be compared)",sourceConflictUnreadableDestination:"the stored dsh credential could not be read",sourceConflictUnsafeDestination:"the stored dsh credential file is not safe to replace",sourceConflictUnrecognized:"the stored credential needs a review",sourceActionImport:"save this copy in dsh",sourceActionReuse:"keep the stored dsh credential (it already matches)",sourceActionOverwrite:"replace the stored dsh credential",sourceActionBlocked:"blocked \u2014 the stored dsh file cannot be replaced from here",sourceActionUnrecognized:"needs a review",sourceCommitImported:"saved",sourceCommitUnchanged:"already matched",sourceCommitOverwritten:"replaced",capabilitiesTitle:"Subscription capabilities",capabilitiesIntro:"Every switch starts off. Turning one on uses that vendor\u2019s subscription quota, not a separate API-key bill.",capabilitiesQuotaHint:"Search, images, edits, Fast, usage, and Grok Imagine all consume the matching subscription quota when they run.",capabilitiesReadOnly:"These switches are read-only in this deployment.",capabilitiesLoading:"Loading capability settings\u2026",capabilitiesLoadFailed:"Could not load capability settings.",capabilitiesSaveFailed:"Could not save that capability setting.",capabilitiesConflictRefreshed:"Those settings changed elsewhere. The page was refreshed; try again.",capabilityLimitsTitle:"Capability limits",capabilityLimitsHint:"Limits apply live to newly started operations and remain within the audited safety bounds.",capSearchResults:"Maximum search results",capSearchResultsHint:"Codex search returns at most this many results (1\u201320).",capImageCount:"Maximum images per call",capImageCountHint:"Codex and Imagine image tools can return at most this many images (1\u20134).",capVideoTtlHours:"Video artifact retention (hours)",capVideoTtlHoursHint:"Completed Imagine video artifacts are kept for 1\u2013168 hours. Lowering retention cleans older artifacts immediately; raising it applies to new artifacts.",capabilityLimitInvalid:"Enter a whole number from {min} through {max}.",capCodexSearch:"Codex subscription search",capCodexSearchHint:"Optional Codex search. It does not become the default search provider.",capCodexImages:"Codex images",capCodexImagesHint:"Optional Codex image generation. Uses ChatGPT/Codex quota.",capCodexImageEdits:"Codex image edits",capCodexImageEditsHint:"Optional Codex image edits. Available only when Codex images is on.",capCodexUsage:"Show Codex quota",capCodexUsageHint:"Best-effort remaining-quota card. Hidden if the vendor does not return usable numbers.",capCodexFast:"Fast requested",capCodexFastHint:"Publishes the codex-oauth-fast route only after a fresh private model catalog confirms a priority-eligible model; failures withdraw it.",capGrokImagineImage:"Grok Imagine images",capGrokImagineImageHint:"Optional official xAI Imagine images. Requires an Imagine credential, not only Grok OAuth.",capGrokImagineVideo:"Grok Imagine video",capGrokImagineVideoHint:"Optional official xAI Imagine video. Requires an Imagine credential, not only Grok OAuth.",usageTitle:"Codex quota",usageLoading:"Loading Codex quota\u2026",usageUnavailable:"Codex quota is not available right now.",usageEmpty:"The vendor did not return any displayable quota fields.",usageFetchedAt:"Last read: {time}",usageRateLimit:"Rate limit",usageWindow:"{seconds}s window",usageUsed:"Used {value}",usageRemaining:"Remaining {value}",usageResets:"Resets {time}",usageCredits:"Credits",usageCreditsUnlimited:"Unlimited credits",usageCreditsLimited:"Limited credits",usageBalance:"Balance {value}",usageIndividualLimit:"Individual limit",usageLimit:"Limit {value}",usageUsedAmount:"Used {value}",usageRemainingAmount:"Remaining {value}",usageSpendControlReached:"Spend control has been reached.",usageResetCredits:"Reset credits available: {value}",imagineTitle:"Grok Imagine credential",imagineIntro:"Official Imagine calls use an xAI API credential (for example $XAI_API_KEY). That key is separate from a Grok Build OAuth login and is never shown here.",imagineLoading:"Checking the Imagine credential\u2026",imagineLoadFailed:"Could not read the Imagine credential status.",imagineConfigured:"An Imagine credential is configured",imagineNotConfigured:"No Imagine credential is configured",imagineSource:"Source: {source}",imagineWritable:"This deployment can update the Imagine credential store.",imagineReadOnly:"This deployment cannot update the Imagine credential store.",imagineSourceNone:"none",imagineSourceEnv:"environment variable",imagineSourceApiKey:"stored API key",imagineSourceOAuth:"OAuth access (only if Imagine accepted it)",imagineSourceCliKey:"Grok CLI key field",imagineSourceUnknown:"configured (details withheld)",tabAccounts:"Accounts",tabCapabilities:"Capabilities",tabGateway:"Gateway",tabAbout:"About",copy:"Copy",copied:"Copied",copyFailed:"Could not copy",modelsSummary:"{selected}/{total} models visible",expandModels:"Models",collapseModels:"Hide models",usageUsedShort:"Used {value}",gatewayTitle:"Local API gateway",gatewayIntro:"Loopback OpenAI/Anthropic-compatible server for your own tools. Off until you enable it.",gatewayWarning:"Exposes signed-in subscriptions as a local API. Can violate provider terms and uses quota.",gatewayEnabled:"Enable local gateway",gatewayBind:"Bind",gatewayPort:"Port",gatewayPortHint:"Integer from 1024 through 65535. Apply to save; Random fills a high port, then Apply.",gatewayPortApply:"Apply",gatewayPortRandom:"Random",gatewayPortInvalid:"Enter a whole port number from 1024 through 65535.",gatewayAddress:"Gateway address",gatewayOpenAiUrl:"OpenAI-compatible base URL",gatewayAnthropicUrl:"Anthropic-compatible base URL",gatewayKeyHint:"Bearer key",gatewayKeyCopyHint:"Copy uses the current key. Rotate only if you want to invalidate existing clients.",gatewayCopyKey:"Copy key",gatewayShowKey:"Show",gatewayHideKey:"Hide",gatewayRevealFailed:"Could not read the current key.",gatewayRotateConfirm:"Rotate the key? Existing clients will stop working.",gatewayRotateConfirmHint:"This replaces the current Bearer key.",gatewayRotateConfirmAction:"Confirm rotate",gatewayRotateCancel:"Cancel",gatewayRunning:"Listening",gatewayStopped:"Not listening",gatewayRotate:"Rotate API key",gatewayRotated:"New key (shown once): {key}",gatewayLoadFailed:"Could not load gateway settings.",gatewaySaveFailed:"Could not update the gateway.",gatewayLoading:"Loading gateway settings\u2026"},Ui={nav:"\u7F16\u7801 OAuth",title:"\u7F16\u7801\u8BA2\u9605\u8D26\u6237",intro:"\u5728 dsh \u4E2D\u4F7F\u7528\u81EA\u5DF1\u7684 Grok Build\u3001ChatGPT Codex\u3001Kimi Code \u548C Claude Code \u8BA2\u9605\uFF1B\u73B0\u6709 API-key \u8DEF\u7531\u7EE7\u7EED\u72EC\u7ACB\u4FDD\u7559\u3002",termsWarning:"\u8FD9\u4E9B\u662F\u8BA2\u9605\u670D\u52A1\u7684\u975E\u5B98\u65B9\u7B2C\u4E09\u65B9\u96C6\u6210\uFF0C\u4ECD\u53D7\u4F9B\u5E94\u5546\u6761\u6B3E\u3001\u914D\u989D\u3001\u5730\u533A\u9650\u5236\u548C\u8D26\u53F7\u98CE\u63A7\u7EA6\u675F\u3002",loadingAccount:"\u6B63\u5728\u52A0\u8F7D\u8D26\u6237\u2026",signedOut:"\u5C1A\u672A\u767B\u5F55",signingIn:"\u6B63\u5728\u7B49\u5F85\u6388\u6743\u2026",signedIn:"\u5DF2\u767B\u5F55",requestFailed:"\u8D26\u6237\u8BF7\u6C42\u5931\u8D25\u3002",logout:"\u9000\u51FA\u767B\u5F55",working:"\u5904\u7406\u4E2D\u2026",cancelLogin:"\u53D6\u6D88\u767B\u5F55",deviceLogin:"\u4F7F\u7528\u8BBE\u5907\u7801\u767B\u5F55",browserLogin:"\u5728\u6D4F\u89C8\u5668\u4E2D\u767B\u5F55",pkceLogin:"\u4F7F\u7528\u6388\u6743\u7801\u767B\u5F55",userCode:"\u4F9B\u5E94\u5546\u8981\u6C42\u8F93\u5165\u4EE3\u7801\u65F6\uFF0C\u8BF7\u8F93\u5165\uFF1A",openUrl:"\u8BF7\u5728\u6B64\u5B8C\u6210\u767B\u5F55\uFF1A",popupBlocked:"\u6D4F\u89C8\u5668\u963B\u6B62\u4E86\u767B\u5F55\u7A97\u53E3\uFF0C\u8BF7\u624B\u52A8\u6253\u5F00\uFF1A",pasteCodeHint:"\u8BF7\u7C98\u8D34\u4F9B\u5E94\u5546\u8FD4\u56DE\u7684\u6388\u6743 code \u6216\u5B8C\u6574\u8DF3\u8F6C\u94FE\u63A5\u3002\u672C\u5730 PKCE \u4EC5\u5728\u56DE\u8C03\u65E0\u6CD5\u5230\u8FBE\u8FD9\u53F0 DSH \u4E3B\u673A\u65F6\u4F7F\u7528\uFF1A",pasteBrowserCodeHint:"\u8BF7\u7C98\u8D34\u4F9B\u5E94\u5546\u8FD4\u56DE\u7684\u6388\u6743 code \u6216\u5B8C\u6574\u8DF3\u8F6C\u94FE\u63A5\uFF0C\u4EE5\u5B8C\u6210\u6B64\u6B21\u6D4F\u89C8\u5668\u767B\u5F55\uFF1A",pasteCodePlaceholder:"\u6388\u6743 code \u6216\u5B8C\u6574\u8DF3\u8F6C\u94FE\u63A5",submitCode:"\u63D0\u4EA4 code",importGrok:"\u4ECE Grok CLI \u5BFC\u5165",importHint:"\u628A ~/.grok/auth.json \u590D\u5236\u8FDB dsh\uFF1B\u4E4B\u540E dsh \u5237\u65B0 token \u53EF\u80FD\u8BA9 Grok CLI \u6389\u7EBF\u3002",models:"\u53EF\u89C1\u6A21\u578B",catalogLive:"\u6765\u81EA\u5F53\u524D xAI \u8D26\u53F7",catalogCache:"\u6765\u81EA\u4E0A\u4E00\u6B21\u6210\u529F\u62C9\u53D6\u7684 xAI \u5217\u8868",catalogFallback:"\u5185\u7F6E Grok \u57FA\u7EBF\u76EE\u5F55\uFF08\u7EBF\u4E0A\u5217\u8868\u4E0D\u53EF\u7528\uFF09",catalogError:"\u65E0\u6CD5\u5237\u65B0\u7EBF\u4E0A Grok \u6A21\u578B\u5217\u8868\u3002",selectAll:"\u5168\u90E8\u663E\u793A",modelHint:"\u52FE\u9009\u6A21\u578B\u4F1A\u4EE5\u8BE5\u524D\u7F00\u51FA\u73B0\u5728\u6A21\u578B\u9009\u62E9\u5668\uFF1A",grokTitle:"xAI Grok Build",grokDescription:"\u901A\u8FC7 Grok Build \u7AEF\u70B9\u4F7F\u7528 SuperGrok / X Premium \u7F16\u7801\u8BA2\u9605\u3002",codexTitle:"OpenAI Codex",codexDescription:"\u4F7F\u7528 ChatGPT Plus/Pro \u7684 Codex \u6743\u76CA\uFF1B\u8FDC\u7A0B DSH \u4E3B\u673A\u63A8\u8350\u8BBE\u5907\u7801\u767B\u5F55\u3002",kimiTitle:"Kimi Code",kimiDescription:"\u901A\u8FC7 auth.kimi.com \u4E0E api.kimi.com/coding \u4F7F\u7528 Kimi Code \u4F1A\u5458\uFF1B\u4E0D\u662F Moonshot API-key \u5F00\u653E\u5E73\u53F0\u3002",claudeTitle:"Claude Code",claudeDescription:"Claude Pro/Max OAuth\uFF0C\u5305\u542B Claude Code scope \u548C\u81EA\u52A8\u5237\u65B0\u3002",antigravityTitle:"Google Antigravity",antigravityDescription:"\u7531\u5355\u72EC\u56FA\u5B9A\u7248\u672C\u7684 MIT \u5F00\u6E90 dsh-agy \u63D2\u4EF6\u63D0\u4F9B\uFF0C\u5BF9\u5916\u8DEF\u7531\u4E3A agy\u3002",antigravityInstalled:"\u5DF2\u5B89\u88C5\uFF08CLI \u7BA1\u7406\uFF09",antigravityMissing:"\u5C1A\u672A\u5B89\u88C5",antigravityCliHint:"\u4E3A\u907F\u514D\u66B4\u9732\u65E0\u8BA4\u8BC1\u7684\u51ED\u636E\u5BFC\u51FA\u9875\u9762\uFF0C\u9ED8\u8BA4\u7981\u7528 dsh-agy Web \u7BA1\u7406\u9875\uFF1B\u9700\u8981\u65F6\u4F7F\u7528 profile \u5185 CLI \u7BA1\u7406 Google OAuth\u3002",antigravityCliCommand:"dsh plugin --profile web exec dsh-agy login --headless",sourcesTitle:"\u4ECE\u5B98\u65B9 CLI \u6587\u4EF6\u62C9\u53D6\u526F\u672C",sourcesIntro:"dsh \u53EF\u4EE5\u81EA\u52A8\u53D1\u73B0\u672C\u673A\u5B98\u65B9 CLI \u767B\u5F55\uFF0C\u5E76\u5355\u5411\u62C9\u53D6\u4E00\u4EFD\u526F\u672C\u5230\u81EA\u5DF1\u7684\u5B58\u50A8\u3002\u5B98\u65B9 CLI \u6587\u4EF6\u4FDD\u6301\u53EA\u8BFB\uFF0C\u7EDD\u4E0D\u4F1A\u88AB\u4FEE\u6539\u3002",sourcesReadOnlyHint:"\u8FD9\u662F\u5355\u5411\u62C9\u53D6\u526F\u672C\u3002dsh \u4E0D\u4F1A\u66F4\u65B0\u3001\u8986\u76D6\u6216\u56DE\u5199\u5B98\u65B9 CLI \u6587\u6863\u3002",sourcesLoading:"\u6B63\u5728\u67E5\u627E\u5B98\u65B9 CLI \u767B\u5F55\u6587\u4EF6\u2026",sourcesCheckAgain:"\u518D\u68C0\u67E5\u4E00\u6B21",sourcesAvailable:"\u53EF\u4EE5\u8BFB\u53D6\u4E00\u4EFD\u526F\u672C",sourcesUnavailable:"\u6CA1\u6709\u53EF\u7528\u7684\u526F\u672C",sourcesPullCopy:"\u62C9\u53D6\u526F\u672C",sourcesPreviewTitle:"\u5148\u6838\u5BF9\u8FD9\u4EFD\u526F\u672C\uFF0C\u518D\u5199\u5165 dsh",sourcesPreviewExpires:"CLI \u51ED\u636E\u5230\u671F\u65F6\u95F4\uFF1A{time}",sourcesTicketExpires:"\u6B64\u6B21\u9884\u89C8\u5C06\u4E8E {time} \u5931\u6548",sourcesConflict:"dsh \u4E2D\u5DF2\u5B58\u51ED\u636E\uFF1A{detail}",sourcesAction:"\u82E5\u7EE7\u7EED\uFF1A{detail}",sourcesWarnings:"\u8BF4\u660E",sourcesConfirmOverwrite:"\u7528\u8FD9\u4EFD\u526F\u672C\u66FF\u6362 dsh \u4E2D\u5DF2\u4FDD\u5B58\u7684\u51ED\u636E",sourcesConfirmOverwriteHint:"dsh \u91CC\u5DF2\u6709\u53E6\u4E00\u4EFD\u51ED\u636E\u3002\u8BF7\u5148\u52FE\u9009\uFF0C\u518D\u786E\u8BA4\u62C9\u53D6\u3002",sourcesCommit:"\u786E\u8BA4\u62C9\u53D6",sourcesCancelPreview:"\u53D6\u6D88\u9884\u89C8",sourcesCommitSuccess:"\u5DF2\u590D\u5236\u5230 dsh\uFF08{action}\uFF09\u3002",sourcesPreviewFailed:"\u65E0\u6CD5\u4ECE\u8BE5 CLI \u6587\u4EF6\u51C6\u5907\u526F\u672C\u3002",sourcesCommitFailed:"\u65E0\u6CD5\u628A\u526F\u672C\u4FDD\u5B58\u5230 dsh\u3002",sourcesLoadFailed:"\u65E0\u6CD5\u67E5\u627E\u5B98\u65B9 CLI \u767B\u5F55\u6587\u4EF6\u3002",sourceKindGrok:"Grok CLI",sourceKindCodex:"Codex CLI",sourceKindKimi:"Kimi Code CLI",sourceKindClaude:"Claude Code CLI",sourceReasonMissing:"\u5728\u9884\u671F\u4F4D\u7F6E\u6CA1\u6709\u627E\u5230\u5B98\u65B9 CLI \u6587\u4EF6\u3002",sourceReasonUnsafe:"\u5B98\u65B9 CLI \u6587\u4EF6\u4E0D\u5B89\u5168\uFF0C\u65E0\u6CD5\u8BFB\u53D6\uFF08\u6743\u9650\u6216\u6587\u4EF6\u7C7B\u578B\uFF09\u3002",sourceReasonInvalid:"\u5B98\u65B9 CLI \u6587\u4EF6\u5B58\u5728\uFF0C\u4F46\u4E0D\u662F\u53EF\u7528\u7684 OAuth \u767B\u5F55\u3002",sourceReasonTooLarge:"\u5B98\u65B9 CLI \u6587\u4EF6\u8D85\u8FC7\u5141\u8BB8\u7684\u8BFB\u53D6\u4E0A\u9650\u3002",sourceConflictNone:"dsh \u5C1A\u672A\u4FDD\u5B58\u51ED\u636E",sourceConflictSameCredential:"\u5DF2\u4FDD\u5B58\u540C\u4E00\u4EFD\u51ED\u636E",sourceConflictSameAccount:"\u540C\u4E00\u8D26\u53F7\uFF0C\u4F46\u51ED\u636E\u4E0D\u540C",sourceConflictDifferentAccount:"\u5DF2\u4FDD\u5B58\u53E6\u4E00\u4E2A\u8D26\u53F7",sourceConflictUnknownAccount:"\u5DF2\u4FDD\u5B58\u51ED\u636E\uFF08\u65E0\u6CD5\u6BD4\u8F83\u8D26\u53F7\uFF09",sourceConflictUnreadableDestination:"\u65E0\u6CD5\u8BFB\u53D6 dsh \u4E2D\u5DF2\u5B58\u51ED\u636E",sourceConflictUnsafeDestination:"dsh \u4E2D\u7684\u51ED\u636E\u6587\u4EF6\u4E0D\u5B89\u5168\uFF0C\u4E0D\u80FD\u4ECE\u8FD9\u91CC\u66FF\u6362",sourceConflictUnrecognized:"\u5DF2\u5B58\u51ED\u636E\u9700\u8981\u6838\u5BF9",sourceActionImport:"\u628A\u8FD9\u4EFD\u526F\u672C\u4FDD\u5B58\u5230 dsh",sourceActionReuse:"\u4FDD\u7559 dsh \u4E2D\u5DF2\u5B58\u51ED\u636E\uFF08\u5185\u5BB9\u5DF2\u76F8\u540C\uFF09",sourceActionOverwrite:"\u66FF\u6362 dsh \u4E2D\u5DF2\u5B58\u51ED\u636E",sourceActionBlocked:"\u5DF2\u963B\u6B62 \u2014 \u4E0D\u80FD\u4ECE\u8FD9\u91CC\u66FF\u6362 dsh \u4E2D\u7684\u6587\u4EF6",sourceActionUnrecognized:"\u9700\u8981\u6838\u5BF9",sourceCommitImported:"\u5DF2\u4FDD\u5B58",sourceCommitUnchanged:"\u539F\u672C\u5C31\u76F8\u540C",sourceCommitOverwritten:"\u5DF2\u66FF\u6362",capabilitiesTitle:"\u8BA2\u9605\u80FD\u529B",capabilitiesIntro:"\u6240\u6709\u5F00\u5173\u9ED8\u8BA4\u5173\u95ED\u3002\u6253\u5F00\u540E\u6D88\u8017\u7684\u662F\u5BF9\u5E94\u4F9B\u5E94\u5546\u7684\u8BA2\u9605\u914D\u989D\uFF0C\u4E0D\u662F\u53E6\u4E00\u5957 API-key \u8D26\u5355\u3002",capabilitiesQuotaHint:"\u641C\u7D22\u3001\u51FA\u56FE\u3001\u6539\u56FE\u3001Fast\u3001\u989D\u5EA6\u5C55\u793A\u548C Grok Imagine \u5728\u5B9E\u9645\u8C03\u7528\u65F6\u90FD\u4F1A\u6D88\u8017\u5BF9\u5E94\u8BA2\u9605\u914D\u989D\u3002",capabilitiesReadOnly:"\u5F53\u524D\u90E8\u7F72\u4E2D\u8FD9\u4E9B\u5F00\u5173\u4E3A\u53EA\u8BFB\u3002",capabilitiesLoading:"\u6B63\u5728\u52A0\u8F7D\u80FD\u529B\u8BBE\u7F6E\u2026",capabilitiesLoadFailed:"\u65E0\u6CD5\u52A0\u8F7D\u80FD\u529B\u8BBE\u7F6E\u3002",capabilitiesSaveFailed:"\u65E0\u6CD5\u4FDD\u5B58\u8BE5\u80FD\u529B\u8BBE\u7F6E\u3002",capabilitiesConflictRefreshed:"\u8FD9\u4E9B\u8BBE\u7F6E\u5DF2\u5728\u522B\u5904\u88AB\u6539\u8FC7\u3002\u9875\u9762\u5DF2\u5237\u65B0\uFF0C\u8BF7\u518D\u8BD5\u4E00\u6B21\u3002",capabilityLimitsTitle:"\u80FD\u529B\u9650\u5236",capabilityLimitsHint:"\u9650\u5236\u4F1A\u5B9E\u65F6\u5E94\u7528\u4E8E\u65B0\u53D1\u8D77\u7684\u64CD\u4F5C\uFF0C\u5E76\u59CB\u7EC8\u4FDD\u6301\u5728\u5DF2\u5BA1\u8BA1\u7684\u5B89\u5168\u8303\u56F4\u5185\u3002",capSearchResults:"\u6700\u591A\u641C\u7D22\u7ED3\u679C\u6570",capSearchResultsHint:"Codex \u641C\u7D22\u6700\u591A\u8FD4\u56DE\u8FD9\u4E48\u591A\u6761\u7ED3\u679C\uFF081\u201320\uFF09\u3002",capImageCount:"\u5355\u6B21\u6700\u591A\u56FE\u7247\u6570",capImageCountHint:"Codex \u4E0E Imagine \u56FE\u7247\u5DE5\u5177\u5355\u6B21\u6700\u591A\u8FD4\u56DE\u8FD9\u4E48\u591A\u5F20\u56FE\u7247\uFF081\u20134\uFF09\u3002",capVideoTtlHours:"\u89C6\u9891\u4EA7\u7269\u4FDD\u7559\u65F6\u95F4\uFF08\u5C0F\u65F6\uFF09",capVideoTtlHoursHint:"Imagine \u89C6\u9891\u4EA7\u7269\u4FDD\u7559 1\u2013168 \u5C0F\u65F6\uFF1B\u964D\u4F4E\u4FDD\u7559\u65F6\u95F4\u4F1A\u7ACB\u5373\u6E05\u7406\u8FC7\u671F\u65E7\u4EA7\u7269\uFF0C\u63D0\u9AD8\u53EA\u5F71\u54CD\u65B0\u4EA7\u7269\u3002",capabilityLimitInvalid:"\u8BF7\u8F93\u5165 {min} \u5230 {max} \u4E4B\u95F4\u7684\u6574\u6570\u3002",capCodexSearch:"Codex \u8BA2\u9605\u641C\u7D22",capCodexSearchHint:"\u53EF\u9009\u7684 Codex \u641C\u7D22\u3002\u4E0D\u4F1A\u81EA\u52A8\u53D8\u6210\u9ED8\u8BA4\u641C\u7D22\u63D0\u4F9B\u65B9\u3002",capCodexImages:"Codex \u51FA\u56FE",capCodexImagesHint:"\u53EF\u9009\u7684 Codex \u51FA\u56FE\u3002\u6D88\u8017 ChatGPT/Codex \u914D\u989D\u3002",capCodexImageEdits:"Codex \u6539\u56FE",capCodexImageEditsHint:"\u53EF\u9009\u7684 Codex \u6539\u56FE\u3002\u4EC5\u5728\u6253\u5F00 Codex \u51FA\u56FE\u540E\u53EF\u7F16\u8F91\u3002",capCodexUsage:"\u663E\u793A Codex \u989D\u5EA6",capCodexUsageHint:"\u5C3D\u529B\u5C55\u793A\u5269\u4F59\u989D\u5EA6\u3002\u4F9B\u5E94\u5546\u672A\u8FD4\u56DE\u53EF\u7528\u6570\u5B57\u65F6\u4F1A\u9690\u85CF\u5BF9\u5E94\u9879\u3002",capCodexFast:"\u5DF2\u8BF7\u6C42 Fast",capCodexFastHint:"\u4EC5\u5728\u6700\u65B0\u79C1\u6709\u6A21\u578B\u76EE\u5F55\u786E\u8BA4\u5B58\u5728\u53EF\u7528\u4F18\u5148\u6A21\u578B\u540E\u53D1\u5E03 codex-oauth-fast \u8DEF\u7531\uFF1B\u5237\u65B0\u5931\u8D25\u4F1A\u64A4\u56DE\u8BE5\u8DEF\u7531\u3002",capGrokImagineImage:"Grok Imagine \u51FA\u56FE",capGrokImagineImageHint:"\u53EF\u9009\u7684\u5B98\u65B9 xAI Imagine \u51FA\u56FE\u3002\u9700\u8981 Imagine \u51ED\u636E\uFF0C\u4EC5\u6709 Grok OAuth \u4E0D\u591F\u3002",capGrokImagineVideo:"Grok Imagine \u51FA\u89C6\u9891",capGrokImagineVideoHint:"\u53EF\u9009\u7684\u5B98\u65B9 xAI Imagine \u51FA\u89C6\u9891\u3002\u9700\u8981 Imagine \u51ED\u636E\uFF0C\u4EC5\u6709 Grok OAuth \u4E0D\u591F\u3002",usageTitle:"Codex \u989D\u5EA6",usageLoading:"\u6B63\u5728\u52A0\u8F7D Codex \u989D\u5EA6\u2026",usageUnavailable:"\u5F53\u524D\u65E0\u6CD5\u8BFB\u53D6 Codex \u989D\u5EA6\u3002",usageEmpty:"\u4F9B\u5E94\u5546\u6CA1\u6709\u8FD4\u56DE\u53EF\u5C55\u793A\u7684\u989D\u5EA6\u5B57\u6BB5\u3002",usageFetchedAt:"\u6700\u8FD1\u8BFB\u53D6\uFF1A{time}",usageRateLimit:"\u901F\u7387\u9650\u5236",usageWindow:"{seconds} \u79D2\u7A97\u53E3",usageUsed:"\u5DF2\u7528 {value}",usageRemaining:"\u5269\u4F59 {value}",usageResets:"\u91CD\u7F6E\u65F6\u95F4 {time}",usageCredits:"\u79EF\u5206",usageCreditsUnlimited:"\u65E0\u9650\u79EF\u5206",usageCreditsLimited:"\u6709\u9650\u79EF\u5206",usageBalance:"\u4F59\u989D {value}",usageIndividualLimit:"\u4E2A\u4EBA\u989D\u5EA6",usageLimit:"\u4E0A\u9650 {value}",usageUsedAmount:"\u5DF2\u7528 {value}",usageRemainingAmount:"\u5269\u4F59 {value}",usageSpendControlReached:"\u5DF2\u8FBE\u5230\u652F\u51FA\u63A7\u5236\u4E0A\u9650\u3002",usageResetCredits:"\u53EF\u7528\u91CD\u7F6E\u6B21\u6570\uFF1A{value}",imagineTitle:"Grok Imagine \u51ED\u636E",imagineIntro:"\u5B98\u65B9 Imagine \u8C03\u7528\u4F7F\u7528 xAI API \u51ED\u636E\uFF08\u4F8B\u5982 $XAI_API_KEY\uFF09\u3002\u5B83\u4E0E Grok Build OAuth \u767B\u5F55\u4E0D\u662F\u540C\u4E00\u4EFD\u51ED\u636E\uFF0C\u8FD9\u91CC\u4E5F\u4E0D\u4F1A\u663E\u793A\u5BC6\u94A5\u3002",imagineLoading:"\u6B63\u5728\u68C0\u67E5 Imagine \u51ED\u636E\u2026",imagineLoadFailed:"\u65E0\u6CD5\u8BFB\u53D6 Imagine \u51ED\u636E\u72B6\u6001\u3002",imagineConfigured:"\u5DF2\u914D\u7F6E Imagine \u51ED\u636E",imagineNotConfigured:"\u5C1A\u672A\u914D\u7F6E Imagine \u51ED\u636E",imagineSource:"\u6765\u6E90\uFF1A{source}",imagineWritable:"\u5F53\u524D\u90E8\u7F72\u53EF\u4EE5\u66F4\u65B0 Imagine \u51ED\u636E\u5B58\u50A8\u3002",imagineReadOnly:"\u5F53\u524D\u90E8\u7F72\u4E0D\u80FD\u66F4\u65B0 Imagine \u51ED\u636E\u5B58\u50A8\u3002",imagineSourceNone:"\u65E0",imagineSourceEnv:"\u73AF\u5883\u53D8\u91CF",imagineSourceApiKey:"\u5DF2\u4FDD\u5B58\u7684 API key",imagineSourceOAuth:"OAuth access\uFF08\u4EC5\u5F53 Imagine \u63A5\u53D7\u65F6\uFF09",imagineSourceCliKey:"Grok CLI \u7684 key \u5B57\u6BB5",imagineSourceUnknown:"\u5DF2\u914D\u7F6E\uFF08\u7EC6\u8282\u4E0D\u5C55\u793A\uFF09",tabAccounts:"\u8D26\u6237",tabCapabilities:"\u80FD\u529B",tabGateway:"\u7F51\u5173",tabAbout:"\u5173\u4E8E",copy:"\u590D\u5236",copied:"\u5DF2\u590D\u5236",copyFailed:"\u590D\u5236\u5931\u8D25",modelsSummary:"\u5DF2\u663E\u793A {selected}/{total} \u4E2A\u6A21\u578B",expandModels:"\u6A21\u578B",collapseModels:"\u6536\u8D77\u6A21\u578B",usageUsedShort:"\u5DF2\u7528 {value}",gatewayTitle:"\u672C\u5730 API \u7F51\u5173",gatewayIntro:"\u672C\u673A loopback \u4E0A\u7684 OpenAI/Anthropic \u517C\u5BB9\u670D\u52A1\uFF0C\u4F9B\u4F60\u81EA\u5DF1\u7684\u5DE5\u5177\u4F7F\u7528\u3002\u9ED8\u8BA4\u5173\u95ED\u3002",gatewayWarning:"\u6253\u5F00\u540E\u4F1A\u628A\u5DF2\u767B\u5F55\u8BA2\u9605\u66B4\u9732\u6210\u672C\u5730 API\u3002\u53EF\u80FD\u8FDD\u53CD\u4F9B\u5E94\u5546\u6761\u6B3E\u5E76\u6D88\u8017\u914D\u989D\u3002",gatewayEnabled:"\u542F\u7528\u672C\u5730\u7F51\u5173",gatewayBind:"\u7ED1\u5B9A\u5730\u5740",gatewayPort:"\u7AEF\u53E3",gatewayPortHint:"1024\u201365535 \u7684\u6574\u6570\u3002\u6539\u5B8C\u70B9\u786E\u5B9A\u4FDD\u5B58\uFF1B\u968F\u673A\u4F1A\u586B\u4E00\u4E2A\u9AD8\u4F4D\u7AEF\u53E3\uFF0C\u4ECD\u9700\u786E\u5B9A\u3002",gatewayPortApply:"\u786E\u5B9A",gatewayPortRandom:"\u968F\u673A",gatewayPortInvalid:"\u8BF7\u8F93\u5165 1024 \u5230 65535 \u4E4B\u95F4\u7684\u6574\u6570\u7AEF\u53E3\u3002",gatewayAddress:"\u7F51\u5173\u5730\u5740",gatewayOpenAiUrl:"OpenAI \u517C\u5BB9\u5730\u5740",gatewayAnthropicUrl:"Anthropic \u517C\u5BB9\u5730\u5740",gatewayKeyHint:"Bearer key",gatewayKeyCopyHint:"\u590D\u5236\u7684\u662F\u5F53\u524D key\u3002\u53EA\u6709\u8981\u4F5C\u5E9F\u5DF2\u6709\u5BA2\u6237\u7AEF\u65F6\u624D\u8F6E\u6362\u3002",gatewayCopyKey:"\u590D\u5236 key",gatewayShowKey:"\u663E\u793A",gatewayHideKey:"\u9690\u85CF",gatewayRevealFailed:"\u65E0\u6CD5\u8BFB\u53D6\u5F53\u524D key\u3002",gatewayRotateConfirm:"\u786E\u5B9A\u8F6E\u6362 key\uFF1F\u73B0\u6709\u5BA2\u6237\u7AEF\u5C06\u5931\u6548\u3002",gatewayRotateConfirmHint:"\u8FD9\u4F1A\u66FF\u6362\u5F53\u524D Bearer key\u3002",gatewayRotateConfirmAction:"\u786E\u8BA4\u8F6E\u6362",gatewayRotateCancel:"\u53D6\u6D88",gatewayRunning:"\u6B63\u5728\u76D1\u542C",gatewayStopped:"\u672A\u76D1\u542C",gatewayRotate:"\u8F6E\u6362 API key",gatewayRotated:"\u65B0 key\uFF08\u53EA\u663E\u793A\u4E00\u6B21\uFF09\uFF1A{key}",gatewayLoadFailed:"\u65E0\u6CD5\u52A0\u8F7D\u7F51\u5173\u8BBE\u7F6E\u3002",gatewaySaveFailed:"\u65E0\u6CD5\u66F4\u65B0\u7F51\u5173\u3002",gatewayLoading:"\u6B63\u5728\u52A0\u8F7D\u7F51\u5173\u8BBE\u7F6E\u2026"};var lt="dsh-grok-build-client",ct=["slots","locale"];function ut(e){let t="settings.grok-build";e.effect(()=>e.locale.register(t,{zh:Ui,en:Ki}),"dsh-coding-subscription-oauth: settings copy");let o=e.locale.bind(t);e.slots.inject("settings.section",()=>e.slots.register({name:"settings.section",id:"grok-build",order:17,label:()=>o("nav"),inject:()=>({t:o})},Gi))}
2
+ var Je=Object.defineProperty;var mn=Object.getOwnPropertyDescriptor;var bn=Object.getOwnPropertyNames;var Cn=Object.prototype.hasOwnProperty;var hn=(e,i)=>{for(var t in i)Je(e,t,{get:i[t],enumerable:!0})},Sn=(e,i,t,o)=>{if(i&&typeof i=="object"||typeof i=="function")for(let r of bn(i))!Cn.call(e,r)&&r!==t&&Je(e,r,{get:()=>i[r],enumerable:!(o=mn(i,r))||o.enumerable});return e};var wn=e=>Sn(Je({},"__esModule",{value:!0}),e);var Un={};hn(Un,{apply:()=>Hn,inject:()=>Gn,name:()=>On});module.exports=wn(Un);var c=require("react");var Si="/plugins/dsh-grok-build/oauth/status",wi="/plugins/dsh-grok-build/oauth/login",vi="/plugins/dsh-grok-build/oauth/code",ki="/plugins/dsh-grok-build/oauth/cancel",xi="/plugins/dsh-grok-build/oauth/logout",Ii="/plugins/dsh-grok-build/oauth/models",Ai="/plugins/dsh-grok-build/oauth/sources",Pi="/plugins/dsh-grok-build/oauth/sources/preview",Ti="/plugins/dsh-grok-build/oauth/sources/commit",Pe="/plugins/dsh-grok-build/oauth/sources/cancel",Qe="/plugins/dsh-grok-build/capabilities",Ei="/plugins/dsh-grok-build/codex/usage",Ri="/plugins/dsh-grok-build/imagine/credential-status",Te="/plugins/dsh-grok-build/gateway",Li="/plugins/dsh-grok-build/gateway/reveal",_i="/plugins/dsh-grok-build/gateway/rotate";var Ze=["grok","codex","kimi","claude"],Oi=["missing","unsafe","invalid","too_large"],Gi=["none","same_credential","same_account","different_account","unknown_account","unreadable_destination","unsafe_destination"],Hi=["import","reuse","overwrite","blocked"],Ui=["imported","unchanged","overwritten"],ei={grok:"~/.grok/auth.json",codex:"~/.codex/auth.json",kimi:"~/.kimi/credentials/kimi-code.json",claude:"~/.claude/.credentials.json"},Ki={grok:"sourceKindGrok",codex:"sourceKindCodex",kimi:"sourceKindKimi",claude:"sourceKindClaude"},Fi={missing:"sourceReasonMissing",unsafe:"sourceReasonUnsafe",invalid:"sourceReasonInvalid",too_large:"sourceReasonTooLarge"},Di={none:"sourceConflictNone",same_credential:"sourceConflictSameCredential",same_account:"sourceConflictSameAccount",different_account:"sourceConflictDifferentAccount",unknown_account:"sourceConflictUnknownAccount",unreadable_destination:"sourceConflictUnreadableDestination",unsafe_destination:"sourceConflictUnsafeDestination"},Bi={import:"sourceActionImport",reuse:"sourceActionReuse",overwrite:"sourceActionOverwrite",blocked:"sourceActionBlocked"},Mi={imported:"sourceCommitImported",unchanged:"sourceCommitUnchanged",overwritten:"sourceCommitOverwritten"},ii=[{key:"codexSearch",label:"capCodexSearch",hint:"capCodexSearchHint"},{key:"codexImages",label:"capCodexImages",hint:"capCodexImagesHint"},{key:"codexImageEdits",label:"capCodexImageEdits",hint:"capCodexImageEditsHint",requiresImages:!0},{key:"codexUsage",label:"capCodexUsage",hint:"capCodexUsageHint"},{key:"codexFast",label:"capCodexFast",hint:"capCodexFastHint"},{key:"grokImagineImage",label:"capGrokImagineImage",hint:"capGrokImagineImageHint"},{key:"grokImagineVideo",label:"capGrokImagineVideo",hint:"capGrokImagineVideoHint"}],Ni=[{key:"searchResults",label:"capSearchResults",hint:"capSearchResultsHint",min:1,max:20,scale:1},{key:"imageCount",label:"capImageCount",hint:"capImageCountHint",min:1,max:4,scale:1},{key:"videoArtifactTtlMs",label:"capVideoTtlHours",hint:"capVideoTtlHoursHint",min:1,max:168,scale:36e5}],ti={none:"imagineSourceNone",env:"imagineSourceEnv",environment:"imagineSourceEnv","xai-api-key":"imagineSourceEnv",xai_api_key:"imagineSourceEnv","api-key":"imagineSourceApiKey",api_key:"imagineSourceApiKey",apikey:"imagineSourceApiKey",key:"imagineSourceApiKey",settings:"imagineSourceApiKey",oauth:"imagineSourceOAuth","oauth-access":"imagineSourceOAuth","grok-cli-key":"imagineSourceCliKey","cli-key":"imagineSourceCliKey"},Vi=[{slug:"grok",route:"grok-build",titleKey:"grokTitle",descriptionKey:"grokDescription",methods:["pkce","device"],recommended:"pkce",remoteRecommended:"device"},{slug:"codex",route:"codex-oauth",titleKey:"codexTitle",descriptionKey:"codexDescription",methods:["device","browser"],recommended:"device",remoteRecommended:"device"},{slug:"kimi",route:"kimi-code-oauth",titleKey:"kimiTitle",descriptionKey:"kimiDescription",methods:["device"],recommended:"device",remoteRecommended:"device"},{slug:"claude",route:"claude-code-oauth",titleKey:"claudeTitle",descriptionKey:"claudeDescription",methods:["browser"],recommended:"browser",remoteRecommended:"browser"}],le=[{id:"accounts",label:"tabAccounts"},{id:"gateway",label:"tabGateway"},{id:"capabilities",label:"tabCapabilities"},{id:"about",label:"tabAbout"}],Ee=1024,Re=65535,he=18100,Wi=18999,qi=new Set([22,53,3080,7890,9090,18080]),Yi=new Set(["preview_invalid","preview_expired","source_changed","destination_changed","confirm_required","unsafe_destination"]),ji="0.5.4";function x(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function zi(e){return e instanceof Error&&e.name==="PluginRequestError"&&"status"in e}function $i(e){return zi(e)?e.status===409||e.code==="SETTINGS_CONFLICT"||/conflict/iu.test(e.message):e instanceof Error&&/SETTINGS_CONFLICT|settings-conflict|changed since it was read/iu.test(e.message)}function Xi(e){return zi(e)?e.code!==void 0&&Yi.has(e.code)?!0:e.status===404||e.status===410:!1}function Le(e,i=!1){fetch(Pe,{method:"POST",headers:{accept:"application/json","content-type":"application/json"},credentials:"same-origin",body:JSON.stringify({previewId:e}),...i?{keepalive:!0}:{}}).catch(()=>{})}async function L(e,i="GET",t){let o=await fetch(e,{method:i,headers:{accept:"application/json",...t===void 0?{}:{"content-type":"application/json"}},credentials:"same-origin",...t===void 0?{}:{body:JSON.stringify(t)}}),r=await o.json().catch(()=>{});if(!o.ok){let s=x(r)?r:void 0,d=s!==void 0&&typeof s.error=="string"?s.error:s!==void 0&&typeof s.message=="string"?s.message:`HTTP ${o.status}`,v=s!==void 0&&typeof s.code=="string"?s.code:void 0,C=new Error(d);throw C.name="PluginRequestError",C.status=o.status,v!==void 0&&(C.code=v),C}return r}async function Ji(e){try{if(typeof navigator<"u"&&navigator.clipboard?.writeText!==void 0)return await navigator.clipboard.writeText(e),!0}catch{}try{let i=document.createElement("textarea");i.value=e,i.setAttribute("readonly",""),i.style.position="fixed",i.style.left="-9999px",document.body.appendChild(i),i.select();let t=document.execCommand("copy");return document.body.removeChild(i),t}catch{return!1}}var Qi={display:"flex",flexDirection:"column",gap:16,maxWidth:780},q={margin:0,fontSize:20,lineHeight:"28px",fontWeight:600,color:"var(--dsw-alias-label-primary)"},f={margin:0,fontSize:14,lineHeight:"22px",color:"var(--dsw-alias-label-secondary)"},Y={display:"flex",flexDirection:"column",gap:14,padding:"18px 20px",border:"1px solid var(--dsw-alias-border-l2)",borderRadius:12,background:"var(--dsw-alias-bg-module-platform)"},pe={display:"flex",alignItems:"center",justifyContent:"space-between",flexWrap:"wrap",gap:12},X={display:"flex",alignItems:"center",gap:9,fontSize:14,fontWeight:500,color:"var(--dsw-alias-label-primary)"},I={boxSizing:"border-box",minHeight:34,padding:"6px 14px",border:"1px solid var(--dsw-alias-border-l4, rgba(127, 127, 127, 0.4))",borderRadius:18,background:"var(--dsw-alias-button-elevated-fill, var(--dsw-alias-bg-layer-1))",color:"var(--dsw-alias-label-primary)",boxShadow:"0 1px 2px rgba(0, 0, 0, 0.18)",font:"inherit",fontSize:14,fontWeight:500,cursor:"pointer"},ee={...I,borderColor:"#315fc7",background:"#315fc7",color:"#ffffff",boxShadow:"0 1px 3px rgba(0, 0, 0, 0.28)",fontWeight:600},N={...f,color:"var(--dsw-alias-state-error-primary)"},_e={...f,padding:"10px 12px",borderRadius:8,background:"var(--dsw-alias-bg-layer-1)"},ni={...f,padding:"10px 12px",borderRadius:8,border:"1px solid var(--dsw-alias-border-l2)",background:"var(--dsw-alias-bg-layer-1)",color:"var(--dsw-alias-label-primary)"},Zi={fontFamily:"ui-monospace, SFMono-Regular, Menlo, Consolas, monospace",fontSize:20,letterSpacing:"0.08em",fontWeight:600,color:"var(--dsw-alias-label-primary)"},j={fontFamily:"ui-monospace, SFMono-Regular, Menlo, Consolas, monospace"},et={color:"var(--dsw-alias-brand-primary)",wordBreak:"break-all"},ce={display:"flex",flexDirection:"column",gap:8,margin:0,padding:0,listStyle:"none"},ae={display:"flex",alignItems:"flex-start",gap:8,fontSize:14,color:"var(--dsw-alias-label-primary)"},Se={boxSizing:"border-box",width:"100%",minHeight:34,padding:"6px 12px",border:"1px solid var(--dsw-alias-border-l2)",borderRadius:8,background:"var(--dsw-alias-bg-layer-1)",color:"var(--dsw-alias-label-primary)",font:"inherit",fontSize:13},re={display:"flex",flexDirection:"column",gap:8,padding:"12px 14px",border:"1px solid var(--dsw-alias-border-l2)",borderRadius:8,background:"var(--dsw-alias-bg-layer-1)"},m={...f,fontSize:13},it={display:"flex",flexWrap:"wrap",gap:8},tt={...I,borderRadius:10},nt={...ee,borderRadius:10},ot={display:"flex",flexDirection:"column",gap:14,minWidth:0},at={display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(320px, 1fr))",gap:14},Oe={display:"flex",alignItems:"center",justifyContent:"space-between",flexWrap:"wrap",gap:8},ge={...Y,minHeight:88,background:"linear-gradient(90deg, var(--dsw-alias-bg-layer-1) 0%, var(--dsw-alias-bg-module-platform) 50%, var(--dsw-alias-bg-layer-1) 100%)",backgroundSize:"200% 100%"};function J(e,i=!0){return{width:9,height:9,borderRadius:"50%",flex:"0 0 auto",background:i?e==="signed-in"||e==="available"?"var(--dsw-alias-state-success-primary, #22a06b)":e==="error"?"var(--dsw-alias-state-error-primary, #d92d20)":e==="signing-in"||e==="loading"?"var(--dsw-alias-brand-primary, #1677ff)":"var(--dsw-alias-label-dimmed, #9aa0a6)":"var(--dsw-alias-label-dimmed, #9aa0a6)"}}var ye=require("react/jsx-runtime");function rt({t:e}){return(0,ye.jsxs)("section",{style:Y,"aria-labelledby":"coding-oauth-about-title",children:[(0,ye.jsx)("p",{style:_e,children:e("termsWarning")}),(0,ye.jsx)("p",{style:{...f,marginTop:12},children:e("remoteLoginHelp")}),(0,ye.jsx)("p",{style:{...m,marginTop:12},children:e("pluginVersion",{version:ji})}),(0,ye.jsx)("p",{style:{...m,marginTop:8},children:e("aboutDocsHint")})]})}var vn=new Set(["localhost","127.0.0.1","[::1]","::1"]);function st(e){let i=e.trim().toLowerCase();return!(i.length===0||vn.has(i)||i.endsWith(".localhost"))}function kn(e,i){return i&&e.remoteRecommended!==void 0&&e.methods.includes(e.remoteRecommended)?e.remoteRecommended:e.recommended}function dt(e,i){let t=kn(e,i),o=e.methods.filter(r=>r!==t);return e.methods.includes(t)?[t,...o]:[...e.methods]}function lt(e){return e===void 0||e.available||e.reason===void 0?!1:e.reason!=="missing"}function ct(e){return e===void 0||e.length===0?!1:e.every(i=>!i.available&&(i.reason===void 0||i.reason==="missing"))}function ut(e){return e?.some(i=>i.available)===!0}function oi(e,i,t){return e==="device"?t?.remote===!0&&t.primary===!0?i("deviceLoginRemote"):i("deviceLogin"):i(e==="browser"?"browserLogin":"pkceLogin")}function T(e){return typeof e=="string"&&e.length>0&&e.length<500?e:void 0}function Q(e){return typeof e=="number"&&Number.isFinite(e)?e:void 0}function Ke(e){return typeof e=="boolean"?e:void 0}function ri(e){let i=Q(e);return i!==void 0&&i>=0&&i<=100?i:void 0}function pt(e){return Ze.includes(e)}function xn(e){return Oi.includes(e)}function In(e){return Gi.includes(e)}function An(e){return Hi.includes(e)}function Pn(e){return Ui.includes(e)}function Fe(e){return/eyJ[A-Za-z0-9_-]+\.|sk-[A-Za-z0-9_-]{8,}|Bearer\s+\S+/u.test(e)}function gt(e,i){let t=T(e);return t===void 0||Fe(t)||t.length>180?ei[i]:t}function Tn(e){let i=T(e);if(!(i===void 0||Fe(i)))return i}function we(e){if(e===void 0||!Number.isFinite(e)||e<=0)return;let i=e>1e12?e:e>1e9?e*1e3:void 0;if(i===void 0)return;let t=new Date(i).toLocaleString();return t.length>0?t:void 0}function En(e){if(!x(e)||typeof e.kind!="string"||!pt(e.kind))return;let i=e.kind,t=T(e.reason),o=Q(e.expiresAt);return{kind:i,displayPath:gt(e.displayPath,i),available:e.available===!0,...o===void 0?{}:{expiresAt:o},...t!==void 0&&xn(t)?{reason:t}:{}}}function si(e){return Ze.map(i=>e.find(o=>o.kind===i)??{kind:i,displayPath:ei[i],available:!1,reason:"missing"})}function yt(e){let i=Array.isArray(e)?e:x(e)&&Array.isArray(e.sources)?e.sources:[];return si(i.map(En).filter(t=>t!==void 0))}function ft(e){if(!x(e))return;let i=T(e.previewId),t=T(e.kind);if(i===void 0||t===void 0||!pt(t))return;let o=T(e.conflict),r=T(e.action),s=Q(e.expiresAt),d=Q(e.ticketExpiresAt),v=Array.isArray(e.warnings)?e.warnings.map(Tn).filter(C=>C!==void 0):[];return{previewId:i,kind:t,displayPath:gt(e.displayPath,t),confirmOverwriteRequired:e.confirmOverwriteRequired===!0,warnings:v,...s===void 0?{}:{expiresAt:s},...d===void 0?{}:{ticketExpiresAt:d},...o!==void 0&&In(o)?{conflict:o}:{},...r!==void 0&&An(r)?{action:r}:{}}}function mt(e){if(!x(e))return;let i=T(e.action);return i!==void 0&&Pn(i)?i:void 0}function ai(e,i,t,o){let r=Q(e);return r!==void 0&&Number.isInteger(r)&&r>=i&&r<=t?r:o}function di(){return{codexSearch:!1,codexImages:!1,codexImageEdits:!1,codexUsage:!1,codexFast:!1,grokImagineImage:!1,grokImagineVideo:!1,searchResults:5,imageCount:1,videoArtifactTtlMs:168*36e5}}function Rn(e){let i=x(e)?e:{};return{codexSearch:i.codexSearch===!0,codexImages:i.codexImages===!0,codexImageEdits:i.codexImageEdits===!0,codexUsage:i.codexUsage===!0,codexFast:i.codexFast===!0,grokImagineImage:i.grokImagineImage===!0,grokImagineVideo:i.grokImagineVideo===!0,searchResults:ai(i.searchResults,1,20,5),imageCount:ai(i.imageCount,1,4,1),videoArtifactTtlMs:ai(i.videoArtifactTtlMs,36e5,168*36e5,168*36e5)}}function li(e){if(!x(e))return;let i=x(e.value)?e.value:e,t=Q(e.revision);if(!(t===void 0&&!x(e.value)&&e.writable===void 0))return{value:Rn(i),revision:t??0,writable:e.writable===!0}}function Ge(e){if(!x(e))return;let i=ri(e.usedPercent??e.used_percent),t=ri(e.remainingPercent??e.remaining_percent),o=Q(e.windowSeconds??e.limit_window_seconds),r=Q(e.resetsAt??e.reset_at);if(!(i===void 0&&t===void 0&&o===void 0&&r===void 0))return{...i===void 0?{}:{usedPercent:i},...t===void 0?{}:{remainingPercent:t},...o!==void 0&&o>0?{windowSeconds:o}:{},...r===void 0?{}:{resetsAt:r}}}function He(e,i){if(!x(e))return;let t=T(e.id)??T(e.metered_feature)??i,o=T(e.name)??T(e.limit_name),r=x(e.rate_limit)?e.rate_limit:e,s=Array.isArray(e.windows)?e.windows.map(Ge).filter(d=>d!==void 0):[Ge(r.primary_window),Ge(r.secondary_window),Ge(r)].filter(d=>d!==void 0);if(!(s.length===0&&o===void 0&&T(e.id)===void 0))return{id:t,windows:s,...o===void 0?{}:{name:o}}}function bt(e){if(!x(e))return;let i=x(e.usage)?e.usage:e,t=[],o=new Set,r=w=>{w===void 0||o.has(w.id)||(o.add(w.id),t.push(w))};Array.isArray(i.rateLimits)?i.rateLimits.forEach((w,H)=>r(He(w,`limit-${String(H)}`))):(r(He(i.rate_limit,"codex")),Array.isArray(i.additional_rate_limits)&&i.additional_rate_limits.forEach((w,H)=>r(He(w,`extra-${String(H)}`))),r(He(i.code_review_rate_limit,"code_review")));let s=x(i.credits)?i.credits:void 0,d=x(i.individualLimit)?i.individualLimit:x(i.spend_control)?x(i.spend_control.individual_limit)?i.spend_control.individual_limit:i.spend_control:void 0,v=x(i.resetCredits)?i.resetCredits.availableCount:x(i.rate_limit_reset_credits)?i.rate_limit_reset_credits.available_count:void 0,C=Q(v),l=Q(i.fetchedAt),E=Ke(i.spendControlReached)??(x(i.spend_control)?Ke(i.spend_control.reached):void 0),h=s===void 0?void 0:T(s.balance),S=d===void 0?void 0:T(d.limit),R=d===void 0?void 0:T(d.used),A=d===void 0?void 0:T(d.remaining),F=d===void 0?void 0:ri(d.remainingPercent??d.remaining_percent),G=d===void 0?void 0:Q(d.resetsAt??d.reset_at);return{rateLimits:t,...s!==void 0&&typeof s.unlimited=="boolean"?{creditsUnlimited:s.unlimited}:{},...h===void 0?{}:{creditsBalance:h},...S===void 0?{}:{individualLimit:S},...R===void 0?{}:{individualUsed:R},...A===void 0?{}:{individualRemaining:A},...F===void 0?{}:{individualRemainingPercent:F},...G===void 0?{}:{individualResetsAt:G},...E===void 0?{}:{spendControlReached:E},...C!==void 0&&C>=0&&Number.isSafeInteger(C)?{resetCredits:C}:{},...l===void 0?{}:{fetchedAt:l}}}function Ct(e){return e.rateLimits.some(i=>i.windows.length>0||i.name!==void 0)||e.creditsUnlimited!==void 0||e.creditsBalance!==void 0||e.individualLimit!==void 0||e.individualUsed!==void 0||e.individualRemaining!==void 0||e.individualRemainingPercent!==void 0||e.spendControlReached===!0||e.resetCredits!==void 0}function De(e){if(!x(e))return;let i=T(e.bind),t=Q(e.port);if(!(i===void 0||t===void 0))return{enabled:e.enabled===!0,running:e.running===!0,bind:i,port:t,keyHint:T(e.keyHint)??"",warning:T(e.warning)??""}}function Ie(e,i){return`http://${e.includes(":")&&!e.startsWith("[")?`[${e}]`:e}:${String(i)}`}function ht(e){for(let i=0;i<32;i+=1){let t=Wi-he+1,o=he+Math.floor(Math.random()*t);if(o!==e&&!qi.has(o))return o}return e===he?he+1:he}function Be(e){let i=Number(e);if(!(!Number.isInteger(i)||i<Ee||i>Re))return i}function St(e){if(!x(e))return;let i=Ke(e.configured);if(i===void 0&&e.source===void 0&&e.writable===void 0)return;let t=T(e.source),o=Ke(e.writable);return{configured:i===!0,...t===void 0||Fe(t)?{}:{source:t},...o===void 0?{}:{writable:o}}}function wt(e,i){if(e===void 0)return i("imagineSourceUnknown");let t=ti[e]??ti[e.toLowerCase()];return t!==void 0?i(t):e.length<=40&&/^[a-z0-9._-]+$/iu.test(e)&&!Fe(e)?e:i("imagineSourceUnknown")}function vt(e){return e.status!=="signed-in"?{available:[],selected:[]}:{available:"available"in e?e.available:[],selected:"selected"in e?e.selected:[]}}var _=require("react/jsx-runtime");function kt({t:e,preview:i,confirmOverwrite:t,sourcesBusy:o,onConfirmOverwriteChange:r,onCommit:s,onCancel:d}){let v=we(i.expiresAt),C=we(i.ticketExpiresAt);return(0,_.jsxs)("div",{style:Y,"aria-live":"polite",children:[(0,_.jsxs)("p",{style:f,children:[e("sourcesPreviewTitle")," \xB7 ",e(Ki[i.kind])]}),(0,_.jsx)("p",{style:m,children:(0,_.jsx)("span",{style:j,children:i.displayPath})}),(0,_.jsx)("p",{style:f,children:e("sourcesConflict",{detail:e(i.conflict===void 0?"sourceConflictUnrecognized":Di[i.conflict])})}),(0,_.jsx)("p",{style:f,children:e("sourcesAction",{detail:e(i.action===void 0?"sourceActionUnrecognized":Bi[i.action])})}),v===void 0?null:(0,_.jsx)("p",{style:m,children:e("sourcesPreviewExpires",{time:v})}),C===void 0?null:(0,_.jsx)("p",{style:m,children:e("sourcesTicketExpires",{time:C})}),i.warnings.length===0?null:(0,_.jsx)("ul",{style:{...ce,gap:4},"aria-label":e("sourcesWarnings"),children:i.warnings.map(l=>(0,_.jsx)("li",{style:m,children:l},l))}),i.confirmOverwriteRequired?(0,_.jsxs)("label",{style:ae,children:[(0,_.jsx)("input",{type:"checkbox",checked:t,disabled:o||i.action==="blocked",onChange:l=>{r(l.target.checked)}}),(0,_.jsxs)("span",{children:[e("sourcesConfirmOverwrite"),(0,_.jsx)("span",{style:{display:"block",...m},children:e("sourcesConfirmOverwriteHint")})]})]}):null,(0,_.jsxs)("div",{style:{display:"flex",flexWrap:"wrap",gap:8},children:[(0,_.jsx)("button",{type:"button",style:ee,disabled:o||i.action==="blocked"||i.confirmOverwriteRequired&&!t,onClick:s,children:e("sourcesCommit")}),(0,_.jsx)("button",{type:"button",style:I,disabled:o,onClick:d,children:e("sourcesCancelPreview")})]})]})}var a=require("react/jsx-runtime");function xt({t:e,definition:i,providerStatus:t,busy:o,sourcesBusy:r,remote:s,codeInput:d,popupBlocked:v,expanded:C,source:l,showUsage:E,usage:h,usageError:S,usageLoading:R,onSignIn:A,onSignOut:F,onCancelLogin:G,onSubmitCode:w,onCodeChange:H,onToggleExpanded:D,onPreviewSource:V,onSaveModels:B}){let M=dt(i,s),W=t.status==="signed-in"?e("signedIn"):t.status==="signing-in"?e("signingIn"):t.status==="error"?e("requestFailed"):e("signedOut"),O=t.status==="signing-in"?t.method:M[0],{available:ie,selected:K}=vt(t),Z=i.slug==="grok"?t:void 0,ve=lt(l),ne=i.slug==="codex"&&E?h?.individualRemainingPercent===void 0?h?.rateLimits[0]?.windows[0]?.usedPercent:100-h.individualRemainingPercent:void 0,fe=we(h?.fetchedAt);return(0,a.jsxs)("div",{style:Y,children:[(0,a.jsxs)("div",{style:pe,children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("h3",{style:{...q,fontSize:16},children:e(i.titleKey)}),t.status==="signed-in"&&!C?(0,a.jsxs)("p",{style:{...m,marginTop:4},children:[e("modelsSummary",{selected:K.length,total:ie.length}),ne===void 0?"":` \xB7 ${e("usageUsedShort",{value:`${String(ne)}%`})}`]}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("p",{style:{...f,marginTop:4},children:e(i.descriptionKey)}),(0,a.jsx)("p",{style:{...f,marginTop:4},children:(0,a.jsx)("span",{style:j,children:i.route})})]})]}),(0,a.jsxs)("div",{style:X,role:"status",children:[(0,a.jsx)("span",{"aria-hidden":"true",style:J(t.status)}),(0,a.jsx)("span",{children:W})]})]}),(0,a.jsx)("div",{style:{display:"flex",flexWrap:"wrap",gap:8},children:t.status==="signed-in"?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("button",{type:"button",style:I,disabled:o,onClick:F,children:e(o?"working":"logout")}),(0,a.jsx)("button",{type:"button",style:I,onClick:D,children:e(C?"collapseModels":"expandModels")}),l?.available===!0?(0,a.jsx)("button",{type:"button",style:I,disabled:r,onClick:V,children:e("sourcesPullCopy")}):null]}):t.status==="signing-in"?(0,a.jsxs)(a.Fragment,{children:[M.filter(g=>g!==O).map(g=>(0,a.jsx)("button",{type:"button",style:I,disabled:o,onClick:()=>{A(g)},children:oi(g,e,{remote:s,primary:g===M[0]})},g)),(0,a.jsx)("button",{type:"button",style:I,disabled:o,onClick:G,children:e("cancelLogin")})]}):(0,a.jsxs)(a.Fragment,{children:[M.map((g,U)=>(0,a.jsx)("button",{type:"button",style:U===0?ee:I,disabled:o,onClick:()=>{A(g)},children:o?e("working"):oi(g,e,{remote:s,primary:U===0})},g)),l?.available===!0?(0,a.jsx)("button",{type:"button",style:I,disabled:r,onClick:V,children:e("sourcesPullCopy")}):ve&&l?.reason!==void 0?(0,a.jsx)("span",{style:m,children:e(Fi[l.reason])}):null]})}),t.status==="error"?(0,a.jsx)("p",{style:N,children:t.message}):null,t.status==="signing-in"&&t.userCode!==void 0?(0,a.jsxs)("p",{style:f,children:[e("userCode")," ",(0,a.jsx)("span",{style:Zi,children:t.userCode})]}):null,t.status==="signing-in"&&t.url!==void 0?(0,a.jsxs)("p",{style:f,children:[e(v?"popupBlocked":"openUrl")," ",(0,a.jsx)("a",{href:t.url,target:"_blank",rel:"noreferrer",style:et,children:t.url})]}):null,t.status==="signing-in"&&O!=="device"?(0,a.jsxs)("div",{style:{display:"flex",flexDirection:"column",gap:8},children:[(0,a.jsx)("p",{style:f,children:e(O==="browser"?"pasteBrowserCodeHint":"pasteCodeHint")}),(0,a.jsxs)("div",{style:{display:"flex",flexWrap:"wrap",gap:8},children:[(0,a.jsx)("input",{style:{...Se,flex:"1 1 360px"},value:d,placeholder:e("pasteCodePlaceholder"),disabled:o,onChange:g=>{H(g.target.value)},onKeyDown:g=>{g.key==="Enter"&&(g.preventDefault(),w())}}),(0,a.jsx)("button",{type:"button",style:ee,disabled:o||d.trim().length===0,onClick:w,children:e("submitCode")})]})]}):null,t.status==="signed-in"&&C?(0,a.jsxs)("div",{style:{display:"flex",flexDirection:"column",gap:8},children:[(0,a.jsxs)("div",{style:pe,children:[(0,a.jsx)("h4",{style:{...q,fontSize:14},children:e("models")}),(0,a.jsx)("button",{type:"button",style:I,disabled:o,onClick:()=>{B([])},children:e("selectAll")})]}),Z?.status==="signed-in"?(0,a.jsx)("p",{style:f,children:Z.catalogSource==="live"?e("catalogLive"):Z.catalogSource==="cache"?e("catalogCache"):e("catalogFallback")}):null,(0,a.jsxs)("p",{style:f,children:[e("modelHint")," ",(0,a.jsxs)("span",{style:j,children:[i.route,"/<id>"]})]}),(0,a.jsx)("ul",{style:ce,children:ie.map(g=>{let U=K.includes(g);return(0,a.jsx)("li",{children:(0,a.jsxs)("label",{style:ae,children:[(0,a.jsx)("input",{type:"checkbox",checked:U,disabled:o,onChange:()=>{let ue=new Set(K);U?ue.delete(g):ue.add(g),B([...ue])}}),(0,a.jsx)("span",{style:j,children:g})]})},g)})}),Z?.status==="signed-in"&&Z.catalogError!==void 0?(0,a.jsx)("p",{style:N,children:e("catalogError")}):null,i.slug==="codex"&&E?(0,a.jsxs)("div",{style:re,children:[(0,a.jsx)("p",{style:{...f,color:"var(--dsw-alias-label-primary)"},children:e("usageTitle")}),S===void 0?null:(0,a.jsx)("p",{style:N,role:"alert",children:S}),R&&h===void 0?(0,a.jsx)("p",{style:m,children:e("usageLoading")}):h===void 0||!Ct(h)?(0,a.jsx)("p",{style:m,children:e("usageEmpty")}):(0,a.jsxs)(a.Fragment,{children:[fe===void 0?null:(0,a.jsx)("p",{style:m,children:e("usageFetchedAt",{time:fe})}),h.rateLimits.map(g=>{let U=we(g.windows[0]?.resetsAt);return(0,a.jsxs)("p",{style:m,children:[g.name??e("usageRateLimit"),g.windows[0]?.usedPercent===void 0?"":` \xB7 ${e("usageUsed",{value:`${String(g.windows[0].usedPercent)}%`})}`,U===void 0?"":` \xB7 ${e("usageResets",{time:U})}`]},g.id)})]})]}):null]}):null]})}var b=require("react/jsx-runtime");function It({t:e,status:i,remote:t,remoteTipDismissed:o,onDismissRemoteTip:r,sources:s,sourcesError:d,sourcesNotice:v,sourcesBusy:C,preview:l,confirmOverwrite:E,busyProvider:h,codeInputs:S,popupBlocked:R,expandedProviders:A,showUsage:F,usage:G,usageError:w,usageLoading:H,onSignIn:D,onSignOut:V,onCancelLogin:B,onSubmitCode:M,onCodeChange:W,onToggleExpanded:O,onPreviewSource:ie,onSaveModels:K,onConfirmOverwriteChange:Z,onCommitSource:ve,onCancelSourcePreview:ne,onRefreshSources:fe}){return i===void 0?(0,b.jsx)("div",{style:ge,role:"status","aria-busy":"true",children:(0,b.jsxs)("div",{style:X,children:[(0,b.jsx)("span",{"aria-hidden":"true",style:J("loading")}),e("loadingAccount")]})}):(0,b.jsxs)(b.Fragment,{children:[t&&!o?(0,b.jsxs)("div",{style:{...ni,display:"flex",alignItems:"flex-start",justifyContent:"space-between",gap:12},children:[(0,b.jsx)("p",{style:{...f,margin:0,color:"var(--dsw-alias-label-primary)"},children:e("remoteAccountsTip")}),(0,b.jsx)("button",{type:"button",style:I,onClick:r,children:e("remoteTipDismiss")})]}):null,ct(s)?(0,b.jsxs)("div",{style:{...ni,display:"flex",alignItems:"flex-start",justifyContent:"space-between",gap:12},children:[(0,b.jsx)("p",{style:{...f,margin:0,color:"var(--dsw-alias-label-primary)"},children:e("sourcesAllMissingHint")}),(0,b.jsx)("button",{type:"button",style:I,disabled:C,onClick:fe,children:e("sourcesCheckAgain")})]}):null,ut(s)?(0,b.jsx)("p",{style:m,children:e("sourcesAvailableHint")}):null,d===void 0?null:(0,b.jsx)("p",{style:N,role:"alert",children:d}),v===void 0?null:(0,b.jsx)("p",{style:f,role:"status",children:v}),(0,b.jsxs)("div",{style:at,children:[Vi.map(g=>{let U=i.providers[g.slug],ue=U.status==="signing-in"||A[g.slug]===!0;return(0,b.jsx)(xt,{t:e,definition:g,providerStatus:U,busy:h===g.slug,sourcesBusy:C,remote:t,codeInput:S[g.slug]??"",popupBlocked:R[g.slug]===!0,expanded:ue,source:s?.find(oe=>oe.kind===g.slug),showUsage:F,usage:G,usageError:w,usageLoading:H,onSignIn:oe=>{D(g.slug,oe)},onSignOut:()=>{V(g.slug)},onCancelLogin:()=>{B(g.slug)},onSubmitCode:()=>{M(g.slug)},onCodeChange:oe=>{W(g.slug,oe)},onToggleExpanded:()=>{O(g.slug)},onPreviewSource:()=>{ie(g.slug)},onSaveModels:oe=>{K(g.slug,oe)}},g.slug)}),(0,b.jsxs)("div",{style:Y,children:[(0,b.jsxs)("div",{style:pe,children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("h3",{style:{...q,fontSize:16},children:e("antigravityTitle")}),(0,b.jsx)("p",{style:{...f,marginTop:4},children:e("antigravityDescription")}),(0,b.jsx)("p",{style:{...f,marginTop:4},children:(0,b.jsx)("span",{style:j,children:i.antigravity.route})})]}),(0,b.jsxs)("div",{style:X,role:"status",children:[(0,b.jsx)("span",{"aria-hidden":"true",style:J("signed-out",i.antigravity.installed)}),(0,b.jsx)("span",{children:i.antigravity.installed?e("antigravityInstalled"):e("antigravityMissing")})]})]}),(0,b.jsx)("p",{style:f,children:e("antigravityCliHint")}),(0,b.jsx)("code",{style:{...j,fontSize:12,overflowWrap:"anywhere"},children:e("antigravityCliCommand")})]})]}),l===void 0?null:(0,b.jsx)(kt,{t:e,preview:l,confirmOverwrite:E,sourcesBusy:C,onConfirmOverwriteChange:Z,onCommit:ve,onCancel:ne})]})}var y=require("react/jsx-runtime");function At({t:e,capabilities:i,capabilitiesError:t,capabilitiesBusy:o,imagine:r,imagineError:s,onPatchCapability:d}){let v=ii.filter(l=>!l.key.startsWith("grokImagine")),C=ii.filter(l=>l.key.startsWith("grokImagine"));return(0,y.jsxs)("section",{style:Y,"aria-labelledby":"coding-oauth-capabilities-title",children:[(0,y.jsxs)("div",{children:[(0,y.jsx)("h3",{id:"coding-oauth-capabilities-title",style:{...q,fontSize:16},children:e("capabilitiesTitle")}),(0,y.jsx)("p",{style:{...f,marginTop:4},children:e("capabilitiesIntro")})]}),s===void 0?null:(0,y.jsx)("p",{style:N,role:"alert",children:s}),r===void 0&&s===void 0?(0,y.jsx)("div",{style:ge,role:"status","aria-busy":"true",children:(0,y.jsxs)("div",{style:X,children:[(0,y.jsx)("span",{"aria-hidden":"true",style:J("loading")}),e("imagineLoading")]})}):r===void 0?null:(0,y.jsxs)("div",{style:re,children:[(0,y.jsxs)("p",{style:X,role:"status",children:[(0,y.jsx)("span",{"aria-hidden":"true",style:J(r.configured?"available":"unavailable")}),(0,y.jsx)("span",{children:r.configured?e("imagineConfigured"):e("imagineNotConfigured")})]}),(0,y.jsx)("p",{style:m,children:e("imagineSource",{source:wt(r.source,e)})})]}),t===void 0?null:(0,y.jsx)("p",{style:N,role:"alert",children:t}),i===void 0?(0,y.jsx)("div",{style:ge,role:"status","aria-busy":"true",children:(0,y.jsxs)("div",{style:X,children:[(0,y.jsx)("span",{"aria-hidden":"true",style:J("loading")}),e("capabilitiesLoading")]})}):(0,y.jsxs)("fieldset",{style:{border:0,margin:0,padding:0,minWidth:0},children:[(0,y.jsx)("legend",{style:{...f,position:"absolute",width:1,height:1,overflow:"hidden"},children:e("capabilitiesTitle")}),i.writable?null:(0,y.jsx)("p",{style:m,children:e("capabilitiesReadOnly")}),(0,y.jsx)("ul",{style:ce,children:v.map(l=>{let E=i.value[l.key],h=l.requiresImages===!0&&!i.value.codexImages,S=o||!i.writable||h;return(0,y.jsx)("li",{children:(0,y.jsxs)("label",{style:ae,children:[(0,y.jsx)("input",{type:"checkbox",checked:E,disabled:S,"aria-describedby":`cap-hint-${l.key}`,onChange:R=>{d(l.key,R.target.checked)}}),(0,y.jsxs)("span",{children:[(0,y.jsx)("span",{style:{display:"block"},children:e(l.label)}),(0,y.jsx)("span",{id:`cap-hint-${l.key}`,style:{display:"block",...m},children:e(l.hint)})]})]})},l.key)})}),(0,y.jsx)("h4",{style:{...q,fontSize:14},children:e("imagineTitle")}),(0,y.jsx)("ul",{style:ce,children:C.map(l=>{let E=i.value[l.key],h=o||!i.writable;return(0,y.jsx)("li",{children:(0,y.jsxs)("label",{style:ae,children:[(0,y.jsx)("input",{type:"checkbox",checked:E,disabled:h,"aria-describedby":`cap-hint-${l.key}`,onChange:S=>{d(l.key,S.target.checked)}}),(0,y.jsxs)("span",{children:[(0,y.jsx)("span",{style:{display:"block"},children:e(l.label)}),(0,y.jsx)("span",{id:`cap-hint-${l.key}`,style:{display:"block",...m},children:e(l.hint)})]})]})},l.key)})}),(0,y.jsxs)("div",{style:re,children:[(0,y.jsx)("h4",{style:{...q,fontSize:14},children:e("capabilityLimitsTitle")}),(0,y.jsx)("p",{style:m,children:e("capabilityLimitsHint")}),(0,y.jsx)("ul",{style:ce,children:Ni.map(l=>{let E=i.value[l.key]/l.scale,h=`cap-limit-${l.key}`;return(0,y.jsxs)("li",{style:pe,children:[(0,y.jsxs)("label",{htmlFor:h,style:{...f,flex:"1 1 360px"},children:[(0,y.jsx)("span",{style:{display:"block",color:"var(--dsw-alias-label-primary)"},children:e(l.label)}),(0,y.jsx)("span",{id:`${h}-hint`,style:{display:"block",...m},children:e(l.hint)})]}),(0,y.jsx)("input",{id:h,type:"number",inputMode:"numeric",min:l.min,max:l.max,step:1,defaultValue:E,disabled:o||!i.writable,"aria-describedby":`${h}-hint`,style:{...Se,width:112,flex:"0 0 112px"},onInput:S=>{S.currentTarget.setCustomValidity("")},onKeyDown:S=>{S.key==="Enter"&&S.currentTarget.blur(),S.key==="Escape"&&(S.currentTarget.value=String(E),S.currentTarget.setCustomValidity(""))},onBlur:S=>{let R=S.currentTarget,A=Number(R.value);if(!Number.isInteger(A)||A<l.min||A>l.max){R.setCustomValidity(e("capabilityLimitInvalid",{min:l.min,max:l.max})),R.reportValidity();return}R.setCustomValidity("");let F=A*l.scale;F!==i.value[l.key]&&Promise.resolve(d(l.key,F)).then(G=>{G===!1&&R.isConnected&&(R.value=String(E))})}},`${l.key}-${String(i.revision)}-${String(E)}`)]},l.key)})})]})]})]})}var Pt=require("react");var u=require("react/jsx-runtime");function Tt({t:e,gateway:i,gatewayError:t,gatewayBusy:o,gatewayOnceKey:r,gatewayKeyVisible:s,gatewayRotateConfirm:d,gatewayRevealError:v,portDraft:C,copiedField:l,copyFailedField:E,onEnabledChange:h,onPortDraftChange:S,onApplyPort:R,onRandomPort:A,onCopy:F,onCopyKey:G,onToggleKeyVisible:w,onRotateConfirm:H,onRotateCancel:D,onRotate:V}){let[B,M]=(0,Pt.useState)(!1),W=(O,ie)=>E===O?e("copyFailed"):l===O?e("copied"):ie??e("copy");return(0,u.jsxs)("section",{style:Y,"aria-labelledby":"coding-oauth-gateway-title",children:[(0,u.jsxs)("div",{children:[(0,u.jsx)("h3",{id:"coding-oauth-gateway-title",style:{...q,fontSize:16},children:e("gatewayTitle")}),(0,u.jsx)("p",{style:{...f,marginTop:4},children:e("gatewayIntro")}),(0,u.jsx)("p",{style:{..._e,marginTop:8},children:e("gatewayWarning")}),(0,u.jsx)("p",{style:{...m,marginTop:8},children:e("gatewayLoopbackHint")})]}),t===void 0?null:(0,u.jsx)("p",{style:N,role:"alert",children:t}),v===void 0?null:(0,u.jsx)("p",{style:N,role:"alert",children:v}),i===void 0&&t===void 0?(0,u.jsx)("div",{style:ge,role:"status","aria-busy":"true",children:(0,u.jsxs)("div",{style:X,children:[(0,u.jsx)("span",{"aria-hidden":"true",style:J("loading")}),e("gatewayLoading")]})}):i===void 0?null:(0,u.jsxs)("div",{style:re,children:[(0,u.jsxs)("p",{style:X,role:"status",children:[(0,u.jsx)("span",{"aria-hidden":"true",style:J(i.running?"available":"unavailable")}),(0,u.jsx)("span",{children:i.running?e("gatewayRunning"):e("gatewayStopped")})]}),B?(0,u.jsxs)("div",{style:re,children:[(0,u.jsx)("p",{style:f,children:e("gatewayEnableConfirm")}),(0,u.jsxs)("div",{style:{display:"flex",flexWrap:"wrap",gap:8},children:[(0,u.jsx)("button",{type:"button",style:ee,disabled:o,onClick:()=>{M(!1),h(!0)},children:e("gatewayEnableConfirmAction")}),(0,u.jsx)("button",{type:"button",style:I,disabled:o,onClick:()=>{M(!1)},children:e("gatewayEnableCancel")})]})]}):(0,u.jsxs)("label",{style:ae,children:[(0,u.jsx)("input",{type:"checkbox",checked:i.enabled,disabled:o,onChange:O=>{if(O.target.checked){M(!0);return}h(!1)}}),(0,u.jsx)("span",{children:e("gatewayEnabled")})]}),(0,u.jsxs)("div",{children:[(0,u.jsx)("label",{htmlFor:"coding-oauth-gateway-port",style:{...f,color:"var(--dsw-alias-label-primary)"},children:e("gatewayPort")}),(0,u.jsx)("p",{id:"coding-oauth-gateway-port-hint",style:m,children:e("gatewayPortHint")}),(0,u.jsxs)("div",{style:{display:"flex",flexWrap:"wrap",gap:8,marginTop:8},children:[(0,u.jsx)("input",{id:"coding-oauth-gateway-port",type:"number",inputMode:"numeric",min:Ee,max:Re,step:1,value:C,disabled:o,"aria-describedby":"coding-oauth-gateway-port-hint",style:{...Se,width:112,flex:"0 0 112px"},onChange:O=>{S(O.target.value)},onKeyDown:O=>{O.key==="Enter"&&(O.preventDefault(),R()),O.key==="Escape"&&S(String(i.port))}}),(0,u.jsx)("button",{type:"button",style:ee,disabled:o||C===String(i.port)||Be(C)===void 0,onClick:R,children:e("gatewayPortApply")}),(0,u.jsx)("button",{type:"button",style:I,disabled:o,onClick:()=>{A(ht(i.port))},children:e("gatewayPortRandom")})]})]}),(0,u.jsxs)("p",{style:Oe,children:[(0,u.jsxs)("span",{style:m,children:[e("gatewayOpenAiUrl"),(0,u.jsx)("span",{style:{display:"block",...j},children:`${Ie(i.bind,i.port)}/v1`})]}),(0,u.jsx)("button",{type:"button",style:ee,onClick:()=>{F("openai",`${Ie(i.bind,i.port)}/v1`)},children:W("openai")})]}),(0,u.jsxs)("p",{style:Oe,children:[(0,u.jsxs)("span",{style:m,children:[e("gatewayAnthropicUrl"),(0,u.jsx)("span",{style:{display:"block",...j},children:Ie(i.bind,i.port)})]}),(0,u.jsx)("button",{type:"button",style:I,onClick:()=>{F("anthropic",Ie(i.bind,i.port))},children:W("anthropic")})]}),(0,u.jsxs)("p",{style:Oe,children:[(0,u.jsxs)("span",{style:m,children:[e("gatewayKeyHint"),(0,u.jsx)("span",{style:{display:"block",...j,overflowWrap:"anywhere"},children:s&&r!==void 0?r:i.keyHint||"\u2014"})]}),(0,u.jsxs)("span",{style:{display:"flex",flexWrap:"wrap",gap:8},children:[(0,u.jsx)("button",{type:"button",style:ee,disabled:o,onClick:G,children:W("key",e("gatewayCopyKey"))}),(0,u.jsx)("button",{type:"button",style:I,disabled:o,onClick:w,children:e(s?"gatewayHideKey":"gatewayShowKey")})]})]}),(0,u.jsx)("p",{style:m,children:e("gatewayKeyCopyHint")}),d?(0,u.jsxs)("div",{style:re,children:[(0,u.jsx)("p",{style:f,children:e("gatewayRotateConfirm")}),(0,u.jsx)("p",{style:m,children:e("gatewayRotateConfirmHint")}),(0,u.jsxs)("div",{style:{display:"flex",flexWrap:"wrap",gap:8},children:[(0,u.jsx)("button",{type:"button",style:I,disabled:o,onClick:V,children:e("gatewayRotateConfirmAction")}),(0,u.jsx)("button",{type:"button",style:I,disabled:o,onClick:D,children:e("gatewayRotateCancel")})]})]}):(0,u.jsx)("button",{type:"button",style:I,disabled:o,onClick:H,children:e("gatewayRotate")})]})]})}var ci=require("react/jsx-runtime");function Et({t:e,activeTab:i,onChange:t}){let o=s=>{let d=le[s];if(d===void 0)return;t(d.id),document.getElementById(`coding-oauth-tab-${d.id}`)?.focus()},r=s=>{let d=le.findIndex(v=>v.id===i);d<0||(s.key==="ArrowRight"||s.key==="ArrowDown"?(s.preventDefault(),o((d+1)%le.length)):s.key==="ArrowLeft"||s.key==="ArrowUp"?(s.preventDefault(),o((d-1+le.length)%le.length)):s.key==="Home"?(s.preventDefault(),o(0)):s.key==="End"&&(s.preventDefault(),o(le.length-1)))};return(0,ci.jsx)("div",{role:"tablist","aria-label":e("title"),style:it,onKeyDown:r,children:le.map(s=>{let d=i===s.id;return(0,ci.jsx)("button",{id:`coding-oauth-tab-${s.id}`,type:"button",role:"tab","aria-selected":d,"aria-controls":`coding-oauth-panel-${s.id}`,tabIndex:d?0:-1,style:d?nt:tt,onClick:()=>{t(s.id)},children:e(s.label)},s.id)})})}var z=require("react/jsx-runtime"),Rt="dsh-coding-oauth-remote-tip-dismissed";function _n(){try{return globalThis.sessionStorage?.getItem(Rt)==="1"}catch{return!1}}function Lt({t:e}){if(e===void 0)throw new Error("Coding OAuth settings requires its translation function");let[i,t]=(0,c.useState)(void 0),[o,r]=(0,c.useState)(void 0),[s,d]=(0,c.useState)(void 0),[v,C]=(0,c.useState)({}),[l,E]=(0,c.useState)({}),[h,S]=(0,c.useState)(void 0),[R,A]=(0,c.useState)(void 0),[F,G]=(0,c.useState)(!1),[w,H]=(0,c.useState)(void 0),D=(0,c.useRef)(void 0),V=(0,c.useRef)(0),B=(0,c.useRef)(!0),[M,W]=(0,c.useState)(!1),[O,ie]=(0,c.useState)(void 0),[K,Z]=(0,c.useState)(void 0),[ve,ne]=(0,c.useState)(void 0),[fe,g]=(0,c.useState)(!1),[U,ue]=(0,c.useState)(!1),[oe,Me]=(0,c.useState)(void 0),[Gt,Ne]=(0,c.useState)(void 0),[Ht,Ve]=(0,c.useState)(!1),[Ut,Kt]=(0,c.useState)(void 0),[Ft,ui]=(0,c.useState)(void 0),[te,We]=(0,c.useState)(void 0),[Dt,se]=(0,c.useState)(void 0),[Bt,me]=(0,c.useState)(!1),[pi,Mt]=(0,c.useState)(!1),[qe,gi]=(0,c.useState)(void 0),[yi,Ye]=(0,c.useState)(!1),[Nt,je]=(0,c.useState)(!1),[Vt,ke]=(0,c.useState)(void 0),[fi,Ae]=(0,c.useState)(""),[$,Wt]=(0,c.useState)("accounts"),[qt,ze]=(0,c.useState)(void 0),[Yt,$e]=(0,c.useState)(void 0),[jt,zt]=(0,c.useState)({}),[$t,Xt]=(0,c.useState)(_n),be=(0,c.useRef)(void 0),Jt=typeof window<"u"?st(window.location.hostname):!1,de=(0,c.useCallback)(async()=>{try{t(await L(Si)),r(void 0)}catch(n){r(n instanceof Error?n.message:e("requestFailed"))}},[e]),xe=(0,c.useCallback)(async()=>{try{S(yt(await L(Ai))),A(void 0)}catch(n){S(si([])),A(n instanceof Error?n.message:e("sourcesLoadFailed"))}},[e]),Ce=(0,c.useCallback)(async()=>{try{let n=li(await L(Qe));return Z(n??{value:di(),revision:0,writable:!1}),ne(void 0),n}catch(n){Z({value:di(),revision:0,writable:!1}),ne(n instanceof Error?n.message:e("capabilitiesLoadFailed"));return}finally{ue(!0)}},[e]),Xe=(0,c.useCallback)(async()=>{try{We(De(await L(Te))),se(void 0)}catch(n){se(n instanceof Error?n.message:e("gatewayLoadFailed"))}finally{Mt(!0)}},[e]),mi=(0,c.useCallback)(async()=>{try{Kt(St(await L(Ri))),ui(void 0)}catch(n){ui(n instanceof Error?n.message:e("imagineLoadFailed"))}},[e]),bi=(0,c.useCallback)(async()=>{Ve(!0);try{Me(bt(await L(Ei))),Ne(void 0)}catch(n){Me(void 0),Ne(n instanceof Error?n.message:e("usageUnavailable"))}finally{Ve(!1)}},[e]);(0,c.useEffect)(()=>{de();let n=window.setTimeout(()=>{xe()},0);return()=>{window.clearTimeout(n)}},[de,xe]),(0,c.useEffect)(()=>{$==="capabilities"&&(U||Ce(),mi())},[$,U,Ce,mi]),(0,c.useEffect)(()=>{U||i?.providers.codex.status==="signed-in"&&Ce()},[U,Ce,i?.providers.codex.status]),(0,c.useEffect)(()=>{$!=="gateway"||pi||Xe()},[$,pi,Xe]),(0,c.useEffect)(()=>{D.current=w},[w]),(0,c.useEffect)(()=>(B.current=!0,()=>{B.current=!1,be.current!==void 0&&window.clearTimeout(be.current),V.current+=1;let n=D.current;n!==void 0&&Le(n.previewId,!0)}),[]),(0,c.useEffect)(()=>{if(!(i!==void 0&&Object.values(i.providers).some(k=>k.status==="signing-in")))return;let p=window.setInterval(()=>{de()},1e3);return()=>{window.clearInterval(p)}},[de,i]),(0,c.useEffect)(()=>{let n=i?.providers.codex.status==="signed-in";if(K?.value.codexUsage===!0&&n){bi();return}Me(void 0),Ne(void 0),Ve(!1)},[K?.value.codexUsage,bi,i?.providers.codex.status]),(0,c.useEffect)(()=>{te!==void 0&&Ae(String(te.port))},[te]);let Qt=async(n,p)=>{let k=window.open("about:blank","_blank");k!==null&&(k.opener=null),d(n),r(void 0),E(P=>({...P,[n]:k===null}));try{let P=await L(wi,"POST",{provider:n,method:p});k!==null&&k.location.replace(P.url),await de()}catch(P){k?.close(),r(P instanceof Error?P.message:e("requestFailed")),await de()}finally{d(void 0)}},Zt=async n=>{let p=v[n]?.trim()??"";if(p.length!==0){d(n);try{await L(vi,"POST",{provider:n,code:p}),C(k=>({...k,[n]:""})),await de()}catch(k){r(k instanceof Error?k.message:e("requestFailed"))}finally{d(void 0)}}},en=async n=>{d(n);try{t(await L(ki,"POST",{provider:n}))}catch(p){r(p instanceof Error?p.message:e("requestFailed"))}finally{d(void 0)}},tn=async n=>{d(n);try{t(await L(xi,"POST",{provider:n}))}catch(p){r(p instanceof Error?p.message:e("requestFailed"))}finally{d(void 0)}},nn=async(n,p)=>{d(n);try{t(await L(Ii,"POST",{provider:n,selected:p}))}catch(k){r(k instanceof Error?k.message:e("requestFailed"))}finally{d(void 0)}},on=async n=>{let p=++V.current,k=D.current;k!==void 0&&(D.current=void 0,H(void 0),Le(k.previewId)),G(!0),ie(void 0),W(!1);try{let P=ft(await L(Pi,"POST",{kind:n}));if(P===void 0)throw new Error(e("sourcesPreviewFailed"));if(!B.current||p!==V.current){Le(P.previewId,!B.current);return}D.current=P,H(P),A(void 0)}catch(P){if(!B.current||p!==V.current)return;H(void 0),A(P instanceof Error?P.message:e("sourcesPreviewFailed"))}finally{B.current&&p===V.current&&G(!1)}},an=async()=>{if(w!==void 0&&w.action!=="blocked"&&!(w.confirmOverwriteRequired&&!M)){G(!0);try{let n=await L(Ti,"POST",{kind:w.kind,previewId:w.previewId,confirmOverwrite:M}),p=mt(n);D.current=void 0,H(void 0),W(!1),ie(e("sourcesCommitSuccess",{action:p===void 0?"":e(Mi[p])})),A(void 0),await xe(),await de()}catch(n){Xi(n)&&(D.current=void 0,H(void 0),W(!1)),A(n instanceof Error?n.message:e("sourcesCommitFailed")),await xe()}finally{G(!1)}}},rn=async()=>{if(w===void 0)return;let n=w.previewId;V.current+=1,D.current=void 0,H(void 0),W(!1),G(!0);try{await L(Pe,"POST",{previewId:n}),A(void 0)}catch(p){A(p instanceof Error?p.message:e("requestFailed"))}finally{G(!1)}},sn=async(n,p)=>{if(K===void 0||!K.writable||n==="codexImageEdits"&&p===!0&&!K.value.codexImages)return!1;let k=n==="codexImages"&&p===!1&&K.value.codexImageEdits?{codexImages:!1,codexImageEdits:!1}:{[n]:p};g(!0);try{let P=li(await L(Qe,"PATCH",{expectedRevision:K.revision,patch:k}));return P!==void 0?Z(P):await Ce(),ne(void 0),!0}catch(P){return await Ce(),ne($i(P)?e("capabilitiesConflictRefreshed"):P instanceof Error?P.message:e("capabilitiesSaveFailed")),!1}finally{g(!1)}},dn=K?.value.codexUsage===!0&&i?.providers.codex.status==="signed-in",ln=n=>{be.current!==void 0&&window.clearTimeout(be.current),ze(n),$e(void 0),be.current=window.setTimeout(()=>{B.current&&(ze(void 0),$e(void 0)),be.current=void 0},2e3)},Ci=async(n,p)=>{if(await Ji(p)){ln(n);return}ze(void 0),$e(n)},hi=async()=>{if(qe!==void 0)return qe;let n=await L(Li,"POST");if(typeof n.apiKey!="string"||n.apiKey.length===0)throw new Error(e("gatewayRevealFailed"));return gi(n.apiKey),n.apiKey},cn=async()=>{try{let n=await hi();await Ci("key",n),ke(void 0)}catch{ke(e("gatewayRevealFailed"))}},un=async()=>{if(yi){Ye(!1);return}try{await hi(),Ye(!0),ke(void 0)}catch{ke(e("gatewayRevealFailed"))}},pn=async()=>{let n=Be(fi);if(n===void 0){se(e("gatewayPortInvalid"));return}if(!(te!==void 0&&n===te.port)){me(!0);try{We(De(await L(Te,"PATCH",{port:n}))??te),se(void 0)}catch(p){se(p instanceof Error?p.message:e("gatewaySaveFailed")),te!==void 0&&Ae(String(te.port))}finally{me(!1)}}},gn=async()=>{me(!0);try{let n=await L(_i,"POST");typeof n.apiKey=="string"&&gi(n.apiKey),Ye(!0),je(!1),ke(void 0),await Xe()}catch(n){se(n instanceof Error?n.message:e("gatewaySaveFailed"))}finally{me(!1)}},yn=n=>{me(!0),L(Te,"PATCH",{enabled:n}).then(p=>{We(De(p)??te),se(void 0)}).catch(p=>{se(p instanceof Error?p.message:e("gatewaySaveFailed"))}).finally(()=>{me(!1)})},fn=()=>{Xt(!0);try{globalThis.sessionStorage?.setItem(Rt,"1")}catch{}};return(0,z.jsxs)("section",{style:Qi,"aria-labelledby":"coding-oauth-settings-title",children:[(0,z.jsxs)("div",{children:[(0,z.jsx)("h2",{id:"coding-oauth-settings-title",style:q,children:e("title")}),$==="accounts"?(0,z.jsx)("p",{style:{...f,marginTop:6},children:e("intro")}):null]}),o===void 0?null:(0,z.jsx)("p",{style:N,role:"alert",children:o}),(0,z.jsx)(Et,{t:e,activeTab:$,onChange:Wt}),(0,z.jsxs)("div",{id:`coding-oauth-panel-${$}`,role:"tabpanel","aria-labelledby":`coding-oauth-tab-${$}`,style:ot,children:[$==="accounts"?(0,z.jsx)(It,{t:e,status:i,remote:Jt,remoteTipDismissed:$t,onDismissRemoteTip:fn,sources:h,sourcesError:R,sourcesNotice:O,sourcesBusy:F,preview:w,confirmOverwrite:M,busyProvider:s,codeInputs:v,popupBlocked:l,expandedProviders:jt,showUsage:dn===!0,usage:oe,usageError:Gt,usageLoading:Ht,onSignIn:(n,p)=>{Qt(n,p)},onSignOut:n=>{tn(n)},onCancelLogin:n=>{en(n)},onSubmitCode:n=>{Zt(n)},onCodeChange:(n,p)=>{C(k=>({...k,[n]:p}))},onToggleExpanded:n=>{zt(p=>({...p,[n]:p[n]!==!0}))},onPreviewSource:n=>{on(n)},onSaveModels:(n,p)=>{nn(n,p)},onConfirmOverwriteChange:W,onCommitSource:()=>{an()},onCancelSourcePreview:()=>{rn()},onRefreshSources:()=>{xe()}}):null,$==="capabilities"?(0,z.jsx)(At,{t:e,capabilities:K,capabilitiesError:ve,capabilitiesBusy:fe,imagine:Ut,imagineError:Ft,onPatchCapability:(n,p)=>sn(n,p)}):null,$==="gateway"?(0,z.jsx)(Tt,{t:e,gateway:te,gatewayError:Dt,gatewayBusy:Bt,gatewayOnceKey:qe,gatewayKeyVisible:yi,gatewayRotateConfirm:Nt,gatewayRevealError:Vt,portDraft:fi,copiedField:qt,copyFailedField:Yt,onEnabledChange:yn,onPortDraftChange:Ae,onApplyPort:()=>{pn()},onRandomPort:n=>{Ae(String(n))},onCopy:(n,p)=>{Ci(n,p)},onCopyKey:()=>{cn()},onToggleKeyVisible:()=>{un()},onRotateConfirm:()=>{je(!0)},onRotateCancel:()=>{je(!1)},onRotate:()=>{gn()}}):null,$==="about"?(0,z.jsx)(rt,{t:e}):null]})]})}var _t={nav:"Coding OAuth",title:"Coding subscriptions",intro:"Use your own Grok Build, ChatGPT Codex, Kimi Code, and Claude Code subscriptions in dsh. API-key routes remain separate.",termsWarning:"These are unofficial third-party integrations with subscription services. Provider terms, quotas, regions, and account-risk policies still apply.",loadingAccount:"Loading accounts\u2026",signedOut:"Not signed in",signingIn:"Waiting for authorization\u2026",signedIn:"Signed in",requestFailed:"The account request failed.",logout:"Sign out",working:"Working\u2026",cancelLogin:"Cancel sign-in",deviceLogin:"Sign in with device code",deviceLoginRemote:"Sign in with device code (best for remote)",browserLogin:"Sign in in browser",pkceLogin:"Sign in with authorization code",userCode:"Enter this code when the provider asks:",openUrl:"Complete sign-in at:",popupBlocked:"The browser blocked the sign-in window. Open this URL manually:",pasteCodeHint:"Paste the authorization code or complete redirect URL returned by the provider. For local PKCE, use this only if the callback could not reach this DSH host:",pasteBrowserCodeHint:"Paste the authorization code or complete redirect URL returned by the provider to finish this browser sign-in:",pasteCodePlaceholder:"authorization code or complete redirect URL",submitCode:"Submit code",importGrok:"Import from Grok CLI",importHint:"Copies ~/.grok/auth.json into dsh. A later dsh refresh may rotate the token and sign the Grok CLI out.",models:"Visible models",catalogLive:"From your current xAI account",catalogCache:"From the last successful xAI listing",catalogFallback:"Built-in Grok baseline (live listing unavailable)",catalogError:"Could not refresh the live Grok model list.",selectAll:"Show all",modelHint:"Checked models appear in the model picker as",grokTitle:"xAI Grok Build",grokDescription:"SuperGrok / X Premium coding subscription through the Grok Build endpoint.",codexTitle:"OpenAI Codex",codexDescription:"ChatGPT Plus/Pro Codex entitlement. Device code is recommended for a remote DSH host.",kimiTitle:"Kimi Code",kimiDescription:"Kimi Code membership through auth.kimi.com and api.kimi.com/coding; this is not the Moonshot API-key platform.",claudeTitle:"Claude Code",claudeDescription:"Claude Pro/Max OAuth with Claude Code scopes and automatic refresh.",antigravityTitle:"Google Antigravity",antigravityDescription:"Provided by the separately pinned MIT dsh-agy plugin and exposed as the agy route.",antigravityInstalled:"Installed (CLI-managed)",antigravityMissing:"Not installed",antigravityCliHint:"The unauthenticated dsh-agy web export dashboard is disabled. Manage Google OAuth with the profile-local CLI when needed.",antigravityCliCommand:"dsh plugin --profile web exec dsh-agy login --headless",sourcesTitle:"Pull a copy from official CLI files",sourcesIntro:"dsh can discover a local official CLI login and pull a one-way copy into its own store. Official CLI files stay read-only and are never modified.",sourcesReadOnlyHint:"This is a one-way pull of a copy. dsh does not update, replace, or write back the official CLI documents.",sourcesLoading:"Looking for official CLI login files\u2026",sourcesCheckAgain:"Check again",sourcesAvailable:"A readable copy is available",sourcesUnavailable:"No usable copy found",sourcesAllMissingHint:"No official CLI login files were found on this host. That is normal on a remote DSH machine \u2014 use device-code sign-in instead, or check again after logging in on this same host.",sourcesAvailableHint:"An official CLI login was found on this host. You can pull a one-way copy into dsh from a provider card.",sourcesPullCopy:"Pull a copy",remoteAccountsTip:"This Settings page looks remote (not loopback). Prefer device-code sign-in; browser pop-ups and local PKCE callbacks often fail from another machine.",remoteTipDismiss:"Dismiss",sourcesPreviewTitle:"Review this copy before saving it in dsh",sourcesPreviewExpires:"CLI credential expiry: {time}",sourcesTicketExpires:"This preview expires at {time}",sourcesConflict:"Stored dsh credential: {detail}",sourcesAction:"If you continue: {detail}",sourcesWarnings:"Notes",sourcesConfirmOverwrite:"Replace the credential already stored in dsh with this copy",sourcesConfirmOverwriteHint:"A different credential is already stored. Check the box, then confirm the pull.",sourcesCommit:"Confirm pull",sourcesCancelPreview:"Cancel preview",sourcesCommitSuccess:"Copied into dsh ({action}).",sourcesPreviewFailed:"Could not prepare a copy from that CLI file.",sourcesCommitFailed:"Could not save the copy in dsh.",sourcesLoadFailed:"Could not look for official CLI login files.",sourceKindGrok:"Grok CLI",sourceKindCodex:"Codex CLI",sourceKindKimi:"Kimi Code CLI",sourceKindClaude:"Claude Code CLI",sourceReasonMissing:"No official CLI file was found at the expected location.",sourceReasonUnsafe:"The official CLI file is not safe to read (permissions or file type).",sourceReasonInvalid:"The official CLI file is present but is not a usable OAuth login.",sourceReasonTooLarge:"The official CLI file is larger than the allowed read limit.",sourceConflictNone:"dsh has no stored credential yet",sourceConflictSameCredential:"same credential already stored",sourceConflictSameAccount:"same account, different credential",sourceConflictDifferentAccount:"a different account is already stored",sourceConflictUnknownAccount:"an existing credential is stored (account could not be compared)",sourceConflictUnreadableDestination:"the stored dsh credential could not be read",sourceConflictUnsafeDestination:"the stored dsh credential file is not safe to replace",sourceConflictUnrecognized:"the stored credential needs a review",sourceActionImport:"save this copy in dsh",sourceActionReuse:"keep the stored dsh credential (it already matches)",sourceActionOverwrite:"replace the stored dsh credential",sourceActionBlocked:"blocked \u2014 the stored dsh file cannot be replaced from here",sourceActionUnrecognized:"needs a review",sourceCommitImported:"saved",sourceCommitUnchanged:"already matched",sourceCommitOverwritten:"replaced",capabilitiesTitle:"Subscription capabilities",capabilitiesIntro:"Every switch starts off. Turning one on uses that vendor\u2019s subscription quota, not a separate API-key bill.",capabilitiesQuotaHint:"Search, images, edits, Fast, usage, and Grok Imagine all consume the matching subscription quota when they run.",capabilitiesReadOnly:"These switches are read-only in this deployment.",capabilitiesLoading:"Loading capability settings\u2026",capabilitiesLoadFailed:"Could not load capability settings.",capabilitiesSaveFailed:"Could not save that capability setting.",capabilitiesConflictRefreshed:"Those settings changed elsewhere. The page was refreshed; try again.",capabilityLimitsTitle:"Capability limits",capabilityLimitsHint:"Limits apply live to newly started operations and remain within the audited safety bounds.",capSearchResults:"Maximum search results",capSearchResultsHint:"Codex search returns at most this many results (1\u201320).",capImageCount:"Maximum images per call",capImageCountHint:"Codex and Imagine image tools can return at most this many images (1\u20134).",capVideoTtlHours:"Video artifact retention (hours)",capVideoTtlHoursHint:"Completed Imagine video artifacts are kept for 1\u2013168 hours. Lowering retention cleans older artifacts immediately; raising it applies to new artifacts.",capabilityLimitInvalid:"Enter a whole number from {min} through {max}.",capCodexSearch:"Codex subscription search",capCodexSearchHint:"Optional search using Codex quota.",capCodexImages:"Codex images",capCodexImagesHint:"Generate images with ChatGPT/Codex quota.",capCodexImageEdits:"Codex image edits",capCodexImageEditsHint:"Edit images; requires Codex images.",capCodexUsage:"Show Codex quota",capCodexUsageHint:"Show remaining quota on the Codex account card when available.",capCodexFast:"Fast requested",capCodexFastHint:"Publish the Fast route when the live catalog confirms priority eligibility.",capGrokImagineImage:"Grok Imagine images",capGrokImagineImageHint:"Needs a separate Imagine credential (not Grok OAuth alone).",capGrokImagineVideo:"Grok Imagine video",capGrokImagineVideoHint:"Needs a separate Imagine credential (not Grok OAuth alone).",usageTitle:"Codex quota",usageLoading:"Loading Codex quota\u2026",usageUnavailable:"Codex quota is not available right now.",usageEmpty:"The vendor did not return any displayable quota fields.",usageFetchedAt:"Last read: {time}",usageRateLimit:"Rate limit",usageWindow:"{seconds}s window",usageUsed:"Used {value}",usageRemaining:"Remaining {value}",usageResets:"Resets {time}",usageCredits:"Credits",usageCreditsUnlimited:"Unlimited credits",usageCreditsLimited:"Limited credits",usageBalance:"Balance {value}",usageIndividualLimit:"Individual limit",usageLimit:"Limit {value}",usageUsedAmount:"Used {value}",usageRemainingAmount:"Remaining {value}",usageSpendControlReached:"Spend control has been reached.",usageResetCredits:"Reset credits available: {value}",imagineTitle:"Grok Imagine credential",imagineIntro:"Official Imagine calls use an xAI API credential (for example $XAI_API_KEY). That key is separate from a Grok Build OAuth login and is never shown here.",imagineLoading:"Checking the Imagine credential\u2026",imagineLoadFailed:"Could not read the Imagine credential status.",imagineConfigured:"An Imagine credential is configured",imagineNotConfigured:"No Imagine credential is configured",imagineSource:"Source: {source}",imagineWritable:"This deployment can update the Imagine credential store.",imagineReadOnly:"This deployment cannot update the Imagine credential store.",imagineSourceNone:"none",imagineSourceEnv:"environment variable",imagineSourceApiKey:"stored API key",imagineSourceOAuth:"OAuth access (only if Imagine accepted it)",imagineSourceCliKey:"Grok CLI key field",imagineSourceUnknown:"configured (details withheld)",tabAccounts:"Accounts",tabCapabilities:"Capabilities",tabGateway:"Gateway",tabAbout:"About",copy:"Copy",copied:"Copied",copyFailed:"Could not copy",modelsSummary:"{selected}/{total} models visible",expandModels:"Models",collapseModels:"Hide models",usageUsedShort:"Used {value}",gatewayTitle:"Local API gateway",gatewayIntro:"Loopback OpenAI/Anthropic-compatible server for your own tools. Off until you enable it.",gatewayWarning:"Exposes signed-in subscriptions as a local API. Can violate provider terms and uses quota.",gatewayLoopbackHint:"Binds to loopback only. Do not port-forward or expose this gateway on a public interface.",gatewayEnableConfirm:"Enable the local API gateway? It exposes your signed-in subscriptions to tools on this host and consumes provider quota.",gatewayEnableConfirmAction:"Confirm",gatewayEnableCancel:"Cancel",gatewayEnabled:"Enable local gateway",gatewayBind:"Bind",gatewayPort:"Port",gatewayPortHint:"Integer from 1024 through 65535. Apply to save; Random fills a high port, then Apply.",gatewayPortApply:"Apply",gatewayPortRandom:"Random",gatewayPortInvalid:"Enter a whole port number from 1024 through 65535.",gatewayAddress:"Gateway address",gatewayOpenAiUrl:"OpenAI-compatible base URL",gatewayAnthropicUrl:"Anthropic-compatible base URL",gatewayKeyHint:"Bearer key",gatewayKeyCopyHint:"Copy uses the current key. Rotate only if you want to invalidate existing clients.",gatewayCopyKey:"Copy key",gatewayShowKey:"Show",gatewayHideKey:"Hide",gatewayRevealFailed:"Could not read the current key.",gatewayRotateConfirm:"Rotate the key? Existing clients will stop working.",gatewayRotateConfirmHint:"This replaces the current Bearer key.",gatewayRotateConfirmAction:"Confirm rotate",gatewayRotateCancel:"Cancel",gatewayRunning:"Listening",gatewayStopped:"Not listening",gatewayRotate:"Rotate API key",gatewayRotated:"New key (shown once): {key}",gatewayLoadFailed:"Could not load gateway settings.",gatewaySaveFailed:"Could not update the gateway.",gatewayLoading:"Loading gateway settings\u2026",remoteLoginHelp:"On a remote DSH host, open Settings here and use device-code sign-in for each provider. Complete the code on any browser that can reach the provider, then return to chat and pick the provider route model.",pluginVersion:"Plugin version {version}",aboutDocsHint:"See the plugin README and INSTALL docs in the repository for setup, supported providers, and gateway safety notes."},Ot={nav:"\u7F16\u7801 OAuth",title:"\u7F16\u7801\u8BA2\u9605\u8D26\u6237",intro:"\u5728 dsh \u4E2D\u4F7F\u7528\u81EA\u5DF1\u7684 Grok Build\u3001ChatGPT Codex\u3001Kimi Code \u548C Claude Code \u8BA2\u9605\uFF1B\u73B0\u6709 API-key \u8DEF\u7531\u7EE7\u7EED\u72EC\u7ACB\u4FDD\u7559\u3002",termsWarning:"\u8FD9\u4E9B\u662F\u8BA2\u9605\u670D\u52A1\u7684\u975E\u5B98\u65B9\u7B2C\u4E09\u65B9\u96C6\u6210\uFF0C\u4ECD\u53D7\u4F9B\u5E94\u5546\u6761\u6B3E\u3001\u914D\u989D\u3001\u5730\u533A\u9650\u5236\u548C\u8D26\u53F7\u98CE\u63A7\u7EA6\u675F\u3002",loadingAccount:"\u6B63\u5728\u52A0\u8F7D\u8D26\u6237\u2026",signedOut:"\u5C1A\u672A\u767B\u5F55",signingIn:"\u6B63\u5728\u7B49\u5F85\u6388\u6743\u2026",signedIn:"\u5DF2\u767B\u5F55",requestFailed:"\u8D26\u6237\u8BF7\u6C42\u5931\u8D25\u3002",logout:"\u9000\u51FA\u767B\u5F55",working:"\u5904\u7406\u4E2D\u2026",cancelLogin:"\u53D6\u6D88\u767B\u5F55",deviceLogin:"\u4F7F\u7528\u8BBE\u5907\u7801\u767B\u5F55",deviceLoginRemote:"\u4F7F\u7528\u8BBE\u5907\u7801\u767B\u5F55\uFF08\u9002\u5408\u8FDC\u7A0B\uFF09",browserLogin:"\u5728\u6D4F\u89C8\u5668\u4E2D\u767B\u5F55",pkceLogin:"\u4F7F\u7528\u6388\u6743\u7801\u767B\u5F55",userCode:"\u4F9B\u5E94\u5546\u8981\u6C42\u8F93\u5165\u4EE3\u7801\u65F6\uFF0C\u8BF7\u8F93\u5165\uFF1A",openUrl:"\u8BF7\u5728\u6B64\u5B8C\u6210\u767B\u5F55\uFF1A",popupBlocked:"\u6D4F\u89C8\u5668\u963B\u6B62\u4E86\u767B\u5F55\u7A97\u53E3\uFF0C\u8BF7\u624B\u52A8\u6253\u5F00\uFF1A",pasteCodeHint:"\u8BF7\u7C98\u8D34\u4F9B\u5E94\u5546\u8FD4\u56DE\u7684\u6388\u6743 code \u6216\u5B8C\u6574\u8DF3\u8F6C\u94FE\u63A5\u3002\u672C\u5730 PKCE \u4EC5\u5728\u56DE\u8C03\u65E0\u6CD5\u5230\u8FBE\u8FD9\u53F0 DSH \u4E3B\u673A\u65F6\u4F7F\u7528\uFF1A",pasteBrowserCodeHint:"\u8BF7\u7C98\u8D34\u4F9B\u5E94\u5546\u8FD4\u56DE\u7684\u6388\u6743 code \u6216\u5B8C\u6574\u8DF3\u8F6C\u94FE\u63A5\uFF0C\u4EE5\u5B8C\u6210\u6B64\u6B21\u6D4F\u89C8\u5668\u767B\u5F55\uFF1A",pasteCodePlaceholder:"\u6388\u6743 code \u6216\u5B8C\u6574\u8DF3\u8F6C\u94FE\u63A5",submitCode:"\u63D0\u4EA4 code",importGrok:"\u4ECE Grok CLI \u5BFC\u5165",importHint:"\u628A ~/.grok/auth.json \u590D\u5236\u8FDB dsh\uFF1B\u4E4B\u540E dsh \u5237\u65B0 token \u53EF\u80FD\u8BA9 Grok CLI \u6389\u7EBF\u3002",models:"\u53EF\u89C1\u6A21\u578B",catalogLive:"\u6765\u81EA\u5F53\u524D xAI \u8D26\u53F7",catalogCache:"\u6765\u81EA\u4E0A\u4E00\u6B21\u6210\u529F\u62C9\u53D6\u7684 xAI \u5217\u8868",catalogFallback:"\u5185\u7F6E Grok \u57FA\u7EBF\u76EE\u5F55\uFF08\u7EBF\u4E0A\u5217\u8868\u4E0D\u53EF\u7528\uFF09",catalogError:"\u65E0\u6CD5\u5237\u65B0\u7EBF\u4E0A Grok \u6A21\u578B\u5217\u8868\u3002",selectAll:"\u5168\u90E8\u663E\u793A",modelHint:"\u52FE\u9009\u6A21\u578B\u4F1A\u4EE5\u8BE5\u524D\u7F00\u51FA\u73B0\u5728\u6A21\u578B\u9009\u62E9\u5668\uFF1A",grokTitle:"xAI Grok Build",grokDescription:"\u901A\u8FC7 Grok Build \u7AEF\u70B9\u4F7F\u7528 SuperGrok / X Premium \u7F16\u7801\u8BA2\u9605\u3002",codexTitle:"OpenAI Codex",codexDescription:"\u4F7F\u7528 ChatGPT Plus/Pro \u7684 Codex \u6743\u76CA\uFF1B\u8FDC\u7A0B DSH \u4E3B\u673A\u63A8\u8350\u8BBE\u5907\u7801\u767B\u5F55\u3002",kimiTitle:"Kimi Code",kimiDescription:"\u901A\u8FC7 auth.kimi.com \u4E0E api.kimi.com/coding \u4F7F\u7528 Kimi Code \u4F1A\u5458\uFF1B\u4E0D\u662F Moonshot API-key \u5F00\u653E\u5E73\u53F0\u3002",claudeTitle:"Claude Code",claudeDescription:"Claude Pro/Max OAuth\uFF0C\u5305\u542B Claude Code scope \u548C\u81EA\u52A8\u5237\u65B0\u3002",antigravityTitle:"Google Antigravity",antigravityDescription:"\u7531\u5355\u72EC\u56FA\u5B9A\u7248\u672C\u7684 MIT \u5F00\u6E90 dsh-agy \u63D2\u4EF6\u63D0\u4F9B\uFF0C\u5BF9\u5916\u8DEF\u7531\u4E3A agy\u3002",antigravityInstalled:"\u5DF2\u5B89\u88C5\uFF08CLI \u7BA1\u7406\uFF09",antigravityMissing:"\u5C1A\u672A\u5B89\u88C5",antigravityCliHint:"\u4E3A\u907F\u514D\u66B4\u9732\u65E0\u8BA4\u8BC1\u7684\u51ED\u636E\u5BFC\u51FA\u9875\u9762\uFF0C\u9ED8\u8BA4\u7981\u7528 dsh-agy Web \u7BA1\u7406\u9875\uFF1B\u9700\u8981\u65F6\u4F7F\u7528 profile \u5185 CLI \u7BA1\u7406 Google OAuth\u3002",antigravityCliCommand:"dsh plugin --profile web exec dsh-agy login --headless",sourcesTitle:"\u4ECE\u5B98\u65B9 CLI \u6587\u4EF6\u62C9\u53D6\u526F\u672C",sourcesIntro:"dsh \u53EF\u4EE5\u81EA\u52A8\u53D1\u73B0\u672C\u673A\u5B98\u65B9 CLI \u767B\u5F55\uFF0C\u5E76\u5355\u5411\u62C9\u53D6\u4E00\u4EFD\u526F\u672C\u5230\u81EA\u5DF1\u7684\u5B58\u50A8\u3002\u5B98\u65B9 CLI \u6587\u4EF6\u4FDD\u6301\u53EA\u8BFB\uFF0C\u7EDD\u4E0D\u4F1A\u88AB\u4FEE\u6539\u3002",sourcesReadOnlyHint:"\u8FD9\u662F\u5355\u5411\u62C9\u53D6\u526F\u672C\u3002dsh \u4E0D\u4F1A\u66F4\u65B0\u3001\u8986\u76D6\u6216\u56DE\u5199\u5B98\u65B9 CLI \u6587\u6863\u3002",sourcesLoading:"\u6B63\u5728\u67E5\u627E\u5B98\u65B9 CLI \u767B\u5F55\u6587\u4EF6\u2026",sourcesCheckAgain:"\u518D\u68C0\u67E5\u4E00\u6B21",sourcesAvailable:"\u53EF\u4EE5\u8BFB\u53D6\u4E00\u4EFD\u526F\u672C",sourcesUnavailable:"\u6CA1\u6709\u53EF\u7528\u7684\u526F\u672C",sourcesAllMissingHint:"\u8FD9\u53F0\u4E3B\u673A\u4E0A\u6CA1\u6709\u627E\u5230\u5B98\u65B9 CLI \u767B\u5F55\u6587\u4EF6\u3002\u8FDC\u7A0B DSH \u4E0A\u8FD9\u5F88\u5E38\u89C1\u2014\u2014\u8BF7\u6539\u7528\u8BBE\u5907\u7801\u767B\u5F55\uFF1B\u82E5\u5DF2\u5728\u672C\u673A CLI \u767B\u5F55\uFF0C\u53EF\u518D\u68C0\u67E5\u4E00\u6B21\u3002",sourcesAvailableHint:"\u672C\u673A\u53D1\u73B0\u4E86\u5B98\u65B9 CLI \u767B\u5F55\u3002\u53EF\u5728\u5BF9\u5E94\u8D26\u6237\u5361\u7247\u91CC\u5355\u5411\u62C9\u53D6\u4E00\u4EFD\u526F\u672C\u5230 dsh\u3002",sourcesPullCopy:"\u62C9\u53D6\u526F\u672C",remoteAccountsTip:"\u5F53\u524D Settings \u9875\u9762\u770B\u8D77\u6765\u662F\u8FDC\u7A0B\u8BBF\u95EE\uFF08\u975E\u672C\u673A\u56DE\u73AF\uFF09\u3002\u8BF7\u4F18\u5148\u4F7F\u7528\u8BBE\u5907\u7801\u767B\u5F55\uFF1B\u4ECE\u53E6\u4E00\u53F0\u673A\u5668\u6253\u5F00\u65F6\uFF0C\u6D4F\u89C8\u5668\u5F39\u7A97\u548C\u672C\u5730 PKCE \u56DE\u8C03\u7ECF\u5E38\u4F1A\u5931\u8D25\u3002",remoteTipDismiss:"\u77E5\u9053\u4E86",sourcesPreviewTitle:"\u5148\u6838\u5BF9\u8FD9\u4EFD\u526F\u672C\uFF0C\u518D\u5199\u5165 dsh",sourcesPreviewExpires:"CLI \u51ED\u636E\u5230\u671F\u65F6\u95F4\uFF1A{time}",sourcesTicketExpires:"\u6B64\u6B21\u9884\u89C8\u5C06\u4E8E {time} \u5931\u6548",sourcesConflict:"dsh \u4E2D\u5DF2\u5B58\u51ED\u636E\uFF1A{detail}",sourcesAction:"\u82E5\u7EE7\u7EED\uFF1A{detail}",sourcesWarnings:"\u8BF4\u660E",sourcesConfirmOverwrite:"\u7528\u8FD9\u4EFD\u526F\u672C\u66FF\u6362 dsh \u4E2D\u5DF2\u4FDD\u5B58\u7684\u51ED\u636E",sourcesConfirmOverwriteHint:"dsh \u91CC\u5DF2\u6709\u53E6\u4E00\u4EFD\u51ED\u636E\u3002\u8BF7\u5148\u52FE\u9009\uFF0C\u518D\u786E\u8BA4\u62C9\u53D6\u3002",sourcesCommit:"\u786E\u8BA4\u62C9\u53D6",sourcesCancelPreview:"\u53D6\u6D88\u9884\u89C8",sourcesCommitSuccess:"\u5DF2\u590D\u5236\u5230 dsh\uFF08{action}\uFF09\u3002",sourcesPreviewFailed:"\u65E0\u6CD5\u4ECE\u8BE5 CLI \u6587\u4EF6\u51C6\u5907\u526F\u672C\u3002",sourcesCommitFailed:"\u65E0\u6CD5\u628A\u526F\u672C\u4FDD\u5B58\u5230 dsh\u3002",sourcesLoadFailed:"\u65E0\u6CD5\u67E5\u627E\u5B98\u65B9 CLI \u767B\u5F55\u6587\u4EF6\u3002",sourceKindGrok:"Grok CLI",sourceKindCodex:"Codex CLI",sourceKindKimi:"Kimi Code CLI",sourceKindClaude:"Claude Code CLI",sourceReasonMissing:"\u5728\u9884\u671F\u4F4D\u7F6E\u6CA1\u6709\u627E\u5230\u5B98\u65B9 CLI \u6587\u4EF6\u3002",sourceReasonUnsafe:"\u5B98\u65B9 CLI \u6587\u4EF6\u4E0D\u5B89\u5168\uFF0C\u65E0\u6CD5\u8BFB\u53D6\uFF08\u6743\u9650\u6216\u6587\u4EF6\u7C7B\u578B\uFF09\u3002",sourceReasonInvalid:"\u5B98\u65B9 CLI \u6587\u4EF6\u5B58\u5728\uFF0C\u4F46\u4E0D\u662F\u53EF\u7528\u7684 OAuth \u767B\u5F55\u3002",sourceReasonTooLarge:"\u5B98\u65B9 CLI \u6587\u4EF6\u8D85\u8FC7\u5141\u8BB8\u7684\u8BFB\u53D6\u4E0A\u9650\u3002",sourceConflictNone:"dsh \u5C1A\u672A\u4FDD\u5B58\u51ED\u636E",sourceConflictSameCredential:"\u5DF2\u4FDD\u5B58\u540C\u4E00\u4EFD\u51ED\u636E",sourceConflictSameAccount:"\u540C\u4E00\u8D26\u53F7\uFF0C\u4F46\u51ED\u636E\u4E0D\u540C",sourceConflictDifferentAccount:"\u5DF2\u4FDD\u5B58\u53E6\u4E00\u4E2A\u8D26\u53F7",sourceConflictUnknownAccount:"\u5DF2\u4FDD\u5B58\u51ED\u636E\uFF08\u65E0\u6CD5\u6BD4\u8F83\u8D26\u53F7\uFF09",sourceConflictUnreadableDestination:"\u65E0\u6CD5\u8BFB\u53D6 dsh \u4E2D\u5DF2\u5B58\u51ED\u636E",sourceConflictUnsafeDestination:"dsh \u4E2D\u7684\u51ED\u636E\u6587\u4EF6\u4E0D\u5B89\u5168\uFF0C\u4E0D\u80FD\u4ECE\u8FD9\u91CC\u66FF\u6362",sourceConflictUnrecognized:"\u5DF2\u5B58\u51ED\u636E\u9700\u8981\u6838\u5BF9",sourceActionImport:"\u628A\u8FD9\u4EFD\u526F\u672C\u4FDD\u5B58\u5230 dsh",sourceActionReuse:"\u4FDD\u7559 dsh \u4E2D\u5DF2\u5B58\u51ED\u636E\uFF08\u5185\u5BB9\u5DF2\u76F8\u540C\uFF09",sourceActionOverwrite:"\u66FF\u6362 dsh \u4E2D\u5DF2\u5B58\u51ED\u636E",sourceActionBlocked:"\u5DF2\u963B\u6B62 \u2014 \u4E0D\u80FD\u4ECE\u8FD9\u91CC\u66FF\u6362 dsh \u4E2D\u7684\u6587\u4EF6",sourceActionUnrecognized:"\u9700\u8981\u6838\u5BF9",sourceCommitImported:"\u5DF2\u4FDD\u5B58",sourceCommitUnchanged:"\u539F\u672C\u5C31\u76F8\u540C",sourceCommitOverwritten:"\u5DF2\u66FF\u6362",capabilitiesTitle:"\u8BA2\u9605\u80FD\u529B",capabilitiesIntro:"\u6240\u6709\u5F00\u5173\u9ED8\u8BA4\u5173\u95ED\u3002\u6253\u5F00\u540E\u6D88\u8017\u7684\u662F\u5BF9\u5E94\u4F9B\u5E94\u5546\u7684\u8BA2\u9605\u914D\u989D\uFF0C\u4E0D\u662F\u53E6\u4E00\u5957 API-key \u8D26\u5355\u3002",capabilitiesQuotaHint:"\u641C\u7D22\u3001\u51FA\u56FE\u3001\u6539\u56FE\u3001Fast\u3001\u989D\u5EA6\u5C55\u793A\u548C Grok Imagine \u5728\u5B9E\u9645\u8C03\u7528\u65F6\u90FD\u4F1A\u6D88\u8017\u5BF9\u5E94\u8BA2\u9605\u914D\u989D\u3002",capabilitiesReadOnly:"\u5F53\u524D\u90E8\u7F72\u4E2D\u8FD9\u4E9B\u5F00\u5173\u4E3A\u53EA\u8BFB\u3002",capabilitiesLoading:"\u6B63\u5728\u52A0\u8F7D\u80FD\u529B\u8BBE\u7F6E\u2026",capabilitiesLoadFailed:"\u65E0\u6CD5\u52A0\u8F7D\u80FD\u529B\u8BBE\u7F6E\u3002",capabilitiesSaveFailed:"\u65E0\u6CD5\u4FDD\u5B58\u8BE5\u80FD\u529B\u8BBE\u7F6E\u3002",capabilitiesConflictRefreshed:"\u8FD9\u4E9B\u8BBE\u7F6E\u5DF2\u5728\u522B\u5904\u88AB\u6539\u8FC7\u3002\u9875\u9762\u5DF2\u5237\u65B0\uFF0C\u8BF7\u518D\u8BD5\u4E00\u6B21\u3002",capabilityLimitsTitle:"\u80FD\u529B\u9650\u5236",capabilityLimitsHint:"\u9650\u5236\u4F1A\u5B9E\u65F6\u5E94\u7528\u4E8E\u65B0\u53D1\u8D77\u7684\u64CD\u4F5C\uFF0C\u5E76\u59CB\u7EC8\u4FDD\u6301\u5728\u5DF2\u5BA1\u8BA1\u7684\u5B89\u5168\u8303\u56F4\u5185\u3002",capSearchResults:"\u6700\u591A\u641C\u7D22\u7ED3\u679C\u6570",capSearchResultsHint:"Codex \u641C\u7D22\u6700\u591A\u8FD4\u56DE\u8FD9\u4E48\u591A\u6761\u7ED3\u679C\uFF081\u201320\uFF09\u3002",capImageCount:"\u5355\u6B21\u6700\u591A\u56FE\u7247\u6570",capImageCountHint:"Codex \u4E0E Imagine \u56FE\u7247\u5DE5\u5177\u5355\u6B21\u6700\u591A\u8FD4\u56DE\u8FD9\u4E48\u591A\u5F20\u56FE\u7247\uFF081\u20134\uFF09\u3002",capVideoTtlHours:"\u89C6\u9891\u4EA7\u7269\u4FDD\u7559\u65F6\u95F4\uFF08\u5C0F\u65F6\uFF09",capVideoTtlHoursHint:"Imagine \u89C6\u9891\u4EA7\u7269\u4FDD\u7559 1\u2013168 \u5C0F\u65F6\uFF1B\u964D\u4F4E\u4FDD\u7559\u65F6\u95F4\u4F1A\u7ACB\u5373\u6E05\u7406\u8FC7\u671F\u65E7\u4EA7\u7269\uFF0C\u63D0\u9AD8\u53EA\u5F71\u54CD\u65B0\u4EA7\u7269\u3002",capabilityLimitInvalid:"\u8BF7\u8F93\u5165 {min} \u5230 {max} \u4E4B\u95F4\u7684\u6574\u6570\u3002",capCodexSearch:"Codex \u8BA2\u9605\u641C\u7D22",capCodexSearchHint:"\u53EF\u9009\u641C\u7D22\uFF0C\u6D88\u8017 Codex \u914D\u989D\u3002",capCodexImages:"Codex \u51FA\u56FE",capCodexImagesHint:"\u7528 ChatGPT/Codex \u914D\u989D\u51FA\u56FE\u3002",capCodexImageEdits:"Codex \u6539\u56FE",capCodexImageEditsHint:"\u6539\u56FE\uFF1B\u9700\u5148\u6253\u5F00 Codex \u51FA\u56FE\u3002",capCodexUsage:"\u663E\u793A Codex \u989D\u5EA6",capCodexUsageHint:"\u6709\u6570\u636E\u65F6\u5728 Codex \u8D26\u6237\u5361\u7247\u4E0A\u663E\u793A\u5269\u4F59\u989D\u5EA6\u3002",capCodexFast:"\u5DF2\u8BF7\u6C42 Fast",capCodexFastHint:"\u5728\u7EBF\u76EE\u5F55\u786E\u8BA4\u4F18\u5148\u8D44\u683C\u540E\u53D1\u5E03 Fast \u8DEF\u7531\u3002",capGrokImagineImage:"Grok Imagine \u51FA\u56FE",capGrokImagineImageHint:"\u9700\u8981\u5355\u72EC\u7684 Imagine \u51ED\u636E\uFF0C\u4EC5\u6709 Grok OAuth \u4E0D\u591F\u3002",capGrokImagineVideo:"Grok Imagine \u51FA\u89C6\u9891",capGrokImagineVideoHint:"\u9700\u8981\u5355\u72EC\u7684 Imagine \u51ED\u636E\uFF0C\u4EC5\u6709 Grok OAuth \u4E0D\u591F\u3002",usageTitle:"Codex \u989D\u5EA6",usageLoading:"\u6B63\u5728\u52A0\u8F7D Codex \u989D\u5EA6\u2026",usageUnavailable:"\u5F53\u524D\u65E0\u6CD5\u8BFB\u53D6 Codex \u989D\u5EA6\u3002",usageEmpty:"\u4F9B\u5E94\u5546\u6CA1\u6709\u8FD4\u56DE\u53EF\u5C55\u793A\u7684\u989D\u5EA6\u5B57\u6BB5\u3002",usageFetchedAt:"\u6700\u8FD1\u8BFB\u53D6\uFF1A{time}",usageRateLimit:"\u901F\u7387\u9650\u5236",usageWindow:"{seconds} \u79D2\u7A97\u53E3",usageUsed:"\u5DF2\u7528 {value}",usageRemaining:"\u5269\u4F59 {value}",usageResets:"\u91CD\u7F6E\u65F6\u95F4 {time}",usageCredits:"\u79EF\u5206",usageCreditsUnlimited:"\u65E0\u9650\u79EF\u5206",usageCreditsLimited:"\u6709\u9650\u79EF\u5206",usageBalance:"\u4F59\u989D {value}",usageIndividualLimit:"\u4E2A\u4EBA\u989D\u5EA6",usageLimit:"\u4E0A\u9650 {value}",usageUsedAmount:"\u5DF2\u7528 {value}",usageRemainingAmount:"\u5269\u4F59 {value}",usageSpendControlReached:"\u5DF2\u8FBE\u5230\u652F\u51FA\u63A7\u5236\u4E0A\u9650\u3002",usageResetCredits:"\u53EF\u7528\u91CD\u7F6E\u6B21\u6570\uFF1A{value}",imagineTitle:"Grok Imagine \u51ED\u636E",imagineIntro:"\u5B98\u65B9 Imagine \u8C03\u7528\u4F7F\u7528 xAI API \u51ED\u636E\uFF08\u4F8B\u5982 $XAI_API_KEY\uFF09\u3002\u5B83\u4E0E Grok Build OAuth \u767B\u5F55\u4E0D\u662F\u540C\u4E00\u4EFD\u51ED\u636E\uFF0C\u8FD9\u91CC\u4E5F\u4E0D\u4F1A\u663E\u793A\u5BC6\u94A5\u3002",imagineLoading:"\u6B63\u5728\u68C0\u67E5 Imagine \u51ED\u636E\u2026",imagineLoadFailed:"\u65E0\u6CD5\u8BFB\u53D6 Imagine \u51ED\u636E\u72B6\u6001\u3002",imagineConfigured:"\u5DF2\u914D\u7F6E Imagine \u51ED\u636E",imagineNotConfigured:"\u5C1A\u672A\u914D\u7F6E Imagine \u51ED\u636E",imagineSource:"\u6765\u6E90\uFF1A{source}",imagineWritable:"\u5F53\u524D\u90E8\u7F72\u53EF\u4EE5\u66F4\u65B0 Imagine \u51ED\u636E\u5B58\u50A8\u3002",imagineReadOnly:"\u5F53\u524D\u90E8\u7F72\u4E0D\u80FD\u66F4\u65B0 Imagine \u51ED\u636E\u5B58\u50A8\u3002",imagineSourceNone:"\u65E0",imagineSourceEnv:"\u73AF\u5883\u53D8\u91CF",imagineSourceApiKey:"\u5DF2\u4FDD\u5B58\u7684 API key",imagineSourceOAuth:"OAuth access\uFF08\u4EC5\u5F53 Imagine \u63A5\u53D7\u65F6\uFF09",imagineSourceCliKey:"Grok CLI \u7684 key \u5B57\u6BB5",imagineSourceUnknown:"\u5DF2\u914D\u7F6E\uFF08\u7EC6\u8282\u4E0D\u5C55\u793A\uFF09",tabAccounts:"\u8D26\u6237",tabCapabilities:"\u80FD\u529B",tabGateway:"\u7F51\u5173",tabAbout:"\u5173\u4E8E",copy:"\u590D\u5236",copied:"\u5DF2\u590D\u5236",copyFailed:"\u590D\u5236\u5931\u8D25",modelsSummary:"\u5DF2\u663E\u793A {selected}/{total} \u4E2A\u6A21\u578B",expandModels:"\u6A21\u578B",collapseModels:"\u6536\u8D77\u6A21\u578B",usageUsedShort:"\u5DF2\u7528 {value}",gatewayTitle:"\u672C\u5730 API \u7F51\u5173",gatewayIntro:"\u672C\u673A loopback \u4E0A\u7684 OpenAI/Anthropic \u517C\u5BB9\u670D\u52A1\uFF0C\u4F9B\u4F60\u81EA\u5DF1\u7684\u5DE5\u5177\u4F7F\u7528\u3002\u9ED8\u8BA4\u5173\u95ED\u3002",gatewayWarning:"\u6253\u5F00\u540E\u4F1A\u628A\u5DF2\u767B\u5F55\u8BA2\u9605\u66B4\u9732\u6210\u672C\u5730 API\u3002\u53EF\u80FD\u8FDD\u53CD\u4F9B\u5E94\u5546\u6761\u6B3E\u5E76\u6D88\u8017\u914D\u989D\u3002",gatewayLoopbackHint:"\u4EC5\u7ED1\u5B9A\u672C\u673A\u56DE\u73AF\u5730\u5740\u3002\u8BF7\u52FF\u505A\u7AEF\u53E3\u8F6C\u53D1\uFF0C\u4E5F\u4E0D\u8981\u628A\u5B83\u66B4\u9732\u5230\u516C\u7F51\u3002",gatewayEnableConfirm:"\u8981\u542F\u7528\u672C\u5730 API \u7F51\u5173\u5417\uFF1F\u5B83\u4F1A\u628A\u5DF2\u767B\u5F55\u7684\u8BA2\u9605\u66B4\u9732\u7ED9\u672C\u673A\u5DE5\u5177\uFF0C\u5E76\u6D88\u8017\u4F9B\u5E94\u5546\u914D\u989D\u3002",gatewayEnableConfirmAction:"\u786E\u8BA4\u542F\u7528",gatewayEnableCancel:"\u53D6\u6D88",gatewayEnabled:"\u542F\u7528\u672C\u5730\u7F51\u5173",gatewayBind:"\u7ED1\u5B9A\u5730\u5740",gatewayPort:"\u7AEF\u53E3",gatewayPortHint:"1024\u201365535 \u7684\u6574\u6570\u3002\u6539\u5B8C\u70B9\u786E\u5B9A\u4FDD\u5B58\uFF1B\u968F\u673A\u4F1A\u586B\u4E00\u4E2A\u9AD8\u4F4D\u7AEF\u53E3\uFF0C\u4ECD\u9700\u786E\u5B9A\u3002",gatewayPortApply:"\u786E\u5B9A",gatewayPortRandom:"\u968F\u673A",gatewayPortInvalid:"\u8BF7\u8F93\u5165 1024 \u5230 65535 \u4E4B\u95F4\u7684\u6574\u6570\u7AEF\u53E3\u3002",gatewayAddress:"\u7F51\u5173\u5730\u5740",gatewayOpenAiUrl:"OpenAI \u517C\u5BB9\u5730\u5740",gatewayAnthropicUrl:"Anthropic \u517C\u5BB9\u5730\u5740",gatewayKeyHint:"Bearer key",gatewayKeyCopyHint:"\u590D\u5236\u7684\u662F\u5F53\u524D key\u3002\u53EA\u6709\u8981\u4F5C\u5E9F\u5DF2\u6709\u5BA2\u6237\u7AEF\u65F6\u624D\u8F6E\u6362\u3002",gatewayCopyKey:"\u590D\u5236 key",gatewayShowKey:"\u663E\u793A",gatewayHideKey:"\u9690\u85CF",gatewayRevealFailed:"\u65E0\u6CD5\u8BFB\u53D6\u5F53\u524D key\u3002",gatewayRotateConfirm:"\u786E\u5B9A\u8F6E\u6362 key\uFF1F\u73B0\u6709\u5BA2\u6237\u7AEF\u5C06\u5931\u6548\u3002",gatewayRotateConfirmHint:"\u8FD9\u4F1A\u66FF\u6362\u5F53\u524D Bearer key\u3002",gatewayRotateConfirmAction:"\u786E\u8BA4\u8F6E\u6362",gatewayRotateCancel:"\u53D6\u6D88",gatewayRunning:"\u6B63\u5728\u76D1\u542C",gatewayStopped:"\u672A\u76D1\u542C",gatewayRotate:"\u8F6E\u6362 API key",gatewayRotated:"\u65B0 key\uFF08\u53EA\u663E\u793A\u4E00\u6B21\uFF09\uFF1A{key}",gatewayLoadFailed:"\u65E0\u6CD5\u52A0\u8F7D\u7F51\u5173\u8BBE\u7F6E\u3002",gatewaySaveFailed:"\u65E0\u6CD5\u66F4\u65B0\u7F51\u5173\u3002",gatewayLoading:"\u6B63\u5728\u52A0\u8F7D\u7F51\u5173\u8BBE\u7F6E\u2026",remoteLoginHelp:"\u5728\u8FDC\u7A0B DSH \u4E3B\u673A\u4E0A\uFF0C\u6253\u5F00\u6B64\u5904 Settings\uFF0C\u5BF9\u6BCF\u4E2A\u4F9B\u5E94\u5546\u4F7F\u7528\u8BBE\u5907\u7801\u767B\u5F55\u3002\u5728\u80FD\u8BBF\u95EE\u4F9B\u5E94\u5546\u7684\u4EFB\u610F\u6D4F\u89C8\u5668\u5B8C\u6210\u9A8C\u8BC1\u7801\uFF0C\u518D\u56DE\u5230\u804A\u5929\u9009\u62E9\u5BF9\u5E94\u8DEF\u7531\u6A21\u578B\u3002",pluginVersion:"\u63D2\u4EF6\u7248\u672C {version}",aboutDocsHint:"\u4ED3\u5E93\u4E2D\u7684 README \u4E0E INSTALL \u6587\u6863\u4ECB\u7ECD\u4E86\u5B89\u88C5\u6B65\u9AA4\u3001\u652F\u6301\u7684\u4F9B\u5E94\u5546\u4EE5\u53CA\u7F51\u5173\u5B89\u5168\u6CE8\u610F\u4E8B\u9879\u3002"};var On="dsh-grok-build-client",Gn=["slots","locale"];function Hn(e){let i="settings.grok-build";e.effect(()=>e.locale.register(i,{zh:Ot,en:_t}),"dsh-coding-subscription-oauth: settings copy");let t=e.locale.bind(i);e.slots.inject("settings.section",()=>e.slots.register({name:"settings.section",id:"grok-build",order:17,label:()=>t("nav"),inject:()=>({t})},Lt))}
3
3
  return module.exports;}});