@sifxprime/krouter 0.5.96 → 0.5.97
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/app/.next-cli-build/BUILD_ID +1 -1
- package/app/.next-cli-build/app-path-routes-manifest.json +7 -6
- package/app/.next-cli-build/build-manifest.json +3 -3
- package/app/.next-cli-build/prerender-manifest.json +24 -0
- package/app/.next-cli-build/react-loadable-manifest.json +9 -0
- package/app/.next-cli-build/required-server-files.json +5 -0
- package/app/.next-cli-build/routes-manifest.json +6 -0
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/basic-chat/page.js +2 -2
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/basic-chat/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/basic-chat/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/[toolId]/page.js +2 -2
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/[toolId]/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/[toolId]/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/page.js +2 -2
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/combos/page.js +2 -2
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/combos/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/combos/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/console-log/page.js +2 -2
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/console-log/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/console-log/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/endpoint/page.js +2 -2
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/endpoint/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/endpoint/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/environment/page.js +2 -2
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/environment/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/environment/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/[kind]/[id]/page.js +2 -2
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/[kind]/[id]/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/[kind]/[id]/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/[kind]/page.js +2 -2
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/[kind]/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/[kind]/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/combo/[id]/page.js +3 -3
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/combo/[id]/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/combo/[id]/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/web/page.js +2 -2
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/web/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/web/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/mitm/page.js +2 -2
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/mitm/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/mitm/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/page.js +2 -2
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/profile/page.js +2 -2
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/profile/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/profile/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/[id]/page.js +3 -3
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/[id]/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/[id]/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/new/page.js +2 -2
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/new/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/new/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/page.js +2 -2
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/proxy-pools/page.js +3 -3
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/proxy-pools/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/proxy-pools/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/quota/page.js +2 -2
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/quota/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/quota/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/skills/page.js +2 -2
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/skills/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/skills/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/token-saver/page.js +2 -0
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/token-saver/page.js.nft.json +1 -0
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/token-saver/page_client-reference-manifest.js +1 -0
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/translator/page.js +2 -2
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/translator/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/translator/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/usage/page.js +2 -2
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/usage/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/usage/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/_global-error/page.js +2 -2
- package/app/.next-cli-build/server/app/_global-error/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/_global-error/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/_global-error.html +1 -1
- package/app/.next-cli-build/server/app/_global-error.rsc +1 -1
- package/app/.next-cli-build/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/_global-error.segments/_global-error.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/_global-error.segments/_head.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/_global-error.segments/_index.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/_not-found/page.js +2 -2
- package/app/.next-cli-build/server/app/_not-found/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/_not-found.html +1 -1
- package/app/.next-cli-build/server/app/_not-found.rsc +4 -4
- package/app/.next-cli-build/server/app/_not-found.segments/_full.segment.rsc +4 -4
- package/app/.next-cli-build/server/app/_not-found.segments/_head.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/_not-found.segments/_index.segment.rsc +4 -4
- package/app/.next-cli-build/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/_not-found.segments/_tree.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/api/auth/login/route.js +1 -1
- package/app/.next-cli-build/server/app/api/auth/login/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/auth/logout/route.js +1 -1
- package/app/.next-cli-build/server/app/api/auth/logout/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/auth/oidc/callback/route.js +1 -1
- package/app/.next-cli-build/server/app/api/auth/oidc/callback/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/auth/oidc/start/route.js +1 -1
- package/app/.next-cli-build/server/app/api/auth/oidc/start/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/auth/oidc/test/route.js +1 -1
- package/app/.next-cli-build/server/app/api/auth/oidc/test/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/auth/reset-password/route.js +1 -1
- package/app/.next-cli-build/server/app/api/auth/reset-password/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/auth/status/route.js +1 -1
- package/app/.next-cli-build/server/app/api/auth/status/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/cache/route.js +1 -1
- package/app/.next-cli-build/server/app/api/cache/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/all-statuses/route.js +2 -2
- package/app/.next-cli-build/server/app/api/cli-tools/all-statuses/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/antigravity-mitm/alias/route.js +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/antigravity-mitm/alias/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/antigravity-mitm/route.js +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/antigravity-mitm/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/claude-settings/route.js +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/claude-settings/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/cline-settings/route.js +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/cline-settings/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/codex-settings/route.js +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/codex-settings/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/copilot-settings/route.js +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/copilot-settings/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/cowork-mcp-registry/route.js +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/cowork-mcp-registry/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/cowork-mcp-tools/route.js +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/cowork-mcp-tools/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/cowork-settings/route.js +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/cowork-settings/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/deepseek-tui-settings/route.js +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/deepseek-tui-settings/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/droid-settings/route.js +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/droid-settings/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/hermes-settings/route.js +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/hermes-settings/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/jcode-settings/route.js +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/jcode-settings/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/kilo-settings/route.js +2 -2
- package/app/.next-cli-build/server/app/api/cli-tools/kilo-settings/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/openclaw-settings/route.js +2 -2
- package/app/.next-cli-build/server/app/api/cli-tools/openclaw-settings/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/opencode-settings/route.js +2 -2
- package/app/.next-cli-build/server/app/api/cli-tools/opencode-settings/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/combos/[id]/route.js +1 -1
- package/app/.next-cli-build/server/app/api/combos/[id]/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/combos/route.js +1 -1
- package/app/.next-cli-build/server/app/api/combos/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/health/route.js +1 -1
- package/app/.next-cli-build/server/app/api/health/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/import/route.js +1 -1
- package/app/.next-cli-build/server/app/api/import/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/init/route.js +1 -1
- package/app/.next-cli-build/server/app/api/init/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/keys/[id]/route.js +1 -1
- package/app/.next-cli-build/server/app/api/keys/[id]/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/keys/route.js +1 -1
- package/app/.next-cli-build/server/app/api/keys/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/locale/route.js +1 -1
- package/app/.next-cli-build/server/app/api/locale/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/mcp/[plugin]/message/route.js +1 -1
- package/app/.next-cli-build/server/app/api/mcp/[plugin]/message/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/mcp/[plugin]/sse/route.js +2 -2
- package/app/.next-cli-build/server/app/api/mcp/[plugin]/sse/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/media-providers/tts/deepgram/voices/route.js +1 -1
- package/app/.next-cli-build/server/app/api/media-providers/tts/deepgram/voices/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/media-providers/tts/elevenlabs/voices/route.js +1 -1
- package/app/.next-cli-build/server/app/api/media-providers/tts/elevenlabs/voices/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/media-providers/tts/inworld/voices/route.js +1 -1
- package/app/.next-cli-build/server/app/api/media-providers/tts/inworld/voices/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/media-providers/tts/minimax/voices/route.js +1 -1
- package/app/.next-cli-build/server/app/api/media-providers/tts/minimax/voices/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/media-providers/tts/voices/route.js +1 -1
- package/app/.next-cli-build/server/app/api/media-providers/tts/voices/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/mitm/cert/route.js +1 -1
- package/app/.next-cli-build/server/app/api/mitm/cert/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/models/alias/route.js +1 -1
- package/app/.next-cli-build/server/app/api/models/alias/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/models/availability/route.js +1 -1
- package/app/.next-cli-build/server/app/api/models/availability/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/models/custom/route.js +1 -1
- package/app/.next-cli-build/server/app/api/models/custom/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/models/disabled/route.js +1 -1
- package/app/.next-cli-build/server/app/api/models/disabled/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/models/live/route.js +1 -1
- package/app/.next-cli-build/server/app/api/models/live/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/models/live-by-connection/route.js +1 -1
- package/app/.next-cli-build/server/app/api/models/live-by-connection/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/models/preview/route.js +1 -1
- package/app/.next-cli-build/server/app/api/models/preview/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/models/route.js +1 -1
- package/app/.next-cli-build/server/app/api/models/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/models/test/route.js +1 -1
- package/app/.next-cli-build/server/app/api/models/test/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/oauth/[provider]/[action]/route.js +1 -1
- package/app/.next-cli-build/server/app/api/oauth/[provider]/[action]/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/oauth/codex/bulk-import/route.js +1 -1
- package/app/.next-cli-build/server/app/api/oauth/codex/bulk-import/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/oauth/codex/import-token/route.js +1 -1
- package/app/.next-cli-build/server/app/api/oauth/codex/import-token/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/oauth/cursor/auto-import/route.js +2 -2
- package/app/.next-cli-build/server/app/api/oauth/cursor/auto-import/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/oauth/cursor/import/route.js +1 -1
- package/app/.next-cli-build/server/app/api/oauth/cursor/import/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/oauth/gitlab/pat/route.js +1 -1
- package/app/.next-cli-build/server/app/api/oauth/gitlab/pat/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/oauth/iflow/cookie/route.js +1 -1
- package/app/.next-cli-build/server/app/api/oauth/iflow/cookie/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/oauth/kiro/auto-import/route.js +1 -1
- package/app/.next-cli-build/server/app/api/oauth/kiro/auto-import/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/oauth/kiro/import/route.js +1 -1
- package/app/.next-cli-build/server/app/api/oauth/kiro/import/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/oauth/kiro/social-authorize/route.js +1 -1
- package/app/.next-cli-build/server/app/api/oauth/kiro/social-authorize/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/oauth/kiro/social-exchange/route.js +1 -1
- package/app/.next-cli-build/server/app/api/oauth/kiro/social-exchange/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/pricing/route.js +1 -1
- package/app/.next-cli-build/server/app/api/pricing/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/provider-nodes/[id]/route.js +1 -1
- package/app/.next-cli-build/server/app/api/provider-nodes/[id]/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/provider-nodes/route.js +1 -1
- package/app/.next-cli-build/server/app/api/provider-nodes/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/provider-nodes/validate/route.js +1 -1
- package/app/.next-cli-build/server/app/api/provider-nodes/validate/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/providers/[id]/models/route.js +1 -1
- package/app/.next-cli-build/server/app/api/providers/[id]/models/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/providers/[id]/route.js +1 -1
- package/app/.next-cli-build/server/app/api/providers/[id]/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/providers/[id]/test/route.js +1 -1
- package/app/.next-cli-build/server/app/api/providers/[id]/test/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/providers/[id]/test-models/route.js +1 -1
- package/app/.next-cli-build/server/app/api/providers/[id]/test-models/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/providers/client/route.js +1 -1
- package/app/.next-cli-build/server/app/api/providers/client/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/providers/health/route.js +1 -1
- package/app/.next-cli-build/server/app/api/providers/health/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/providers/kilo/free-models/route.js +1 -1
- package/app/.next-cli-build/server/app/api/providers/kilo/free-models/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/providers/route.js +1 -1
- package/app/.next-cli-build/server/app/api/providers/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/providers/suggested-models/route.js +1 -1
- package/app/.next-cli-build/server/app/api/providers/suggested-models/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/providers/test-batch/route.js +1 -1
- package/app/.next-cli-build/server/app/api/providers/test-batch/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/providers/validate/route.js +1 -1
- package/app/.next-cli-build/server/app/api/providers/validate/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/providers/zenith/log/route.js +1 -1
- package/app/.next-cli-build/server/app/api/providers/zenith/log/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/providers/zenith/route.js +1 -1
- package/app/.next-cli-build/server/app/api/providers/zenith/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/proxy-pools/[id]/route.js +1 -1
- package/app/.next-cli-build/server/app/api/proxy-pools/[id]/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/proxy-pools/[id]/test/route.js +1 -1
- package/app/.next-cli-build/server/app/api/proxy-pools/[id]/test/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/proxy-pools/cloudflare-deploy/route.js +2 -2
- package/app/.next-cli-build/server/app/api/proxy-pools/cloudflare-deploy/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/proxy-pools/deno-deploy/route.js +2 -2
- package/app/.next-cli-build/server/app/api/proxy-pools/deno-deploy/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/proxy-pools/route.js +1 -1
- package/app/.next-cli-build/server/app/api/proxy-pools/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/proxy-pools/vercel-deploy/route.js +2 -2
- package/app/.next-cli-build/server/app/api/proxy-pools/vercel-deploy/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/settings/database/route.js +1 -1
- package/app/.next-cli-build/server/app/api/settings/database/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/settings/environment/route.js +1 -1
- package/app/.next-cli-build/server/app/api/settings/environment/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/settings/proxy-test/route.js +1 -1
- package/app/.next-cli-build/server/app/api/settings/proxy-test/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/settings/require-login/route.js +1 -1
- package/app/.next-cli-build/server/app/api/settings/require-login/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/settings/route.js +1 -1
- package/app/.next-cli-build/server/app/api/settings/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/shutdown/route.js +1 -1
- package/app/.next-cli-build/server/app/api/shutdown/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/tags/route.js +1 -1
- package/app/.next-cli-build/server/app/api/tags/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/translator/console-logs/route.js +1 -1
- package/app/.next-cli-build/server/app/api/translator/console-logs/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/translator/console-logs/stream/route.js +2 -2
- package/app/.next-cli-build/server/app/api/translator/console-logs/stream/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/translator/load/route.js +1 -1
- package/app/.next-cli-build/server/app/api/translator/load/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/translator/save/route.js +1 -1
- package/app/.next-cli-build/server/app/api/translator/save/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/translator/send/route.js +1 -1
- package/app/.next-cli-build/server/app/api/translator/send/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/translator/translate/route.js +1 -1
- package/app/.next-cli-build/server/app/api/translator/translate/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/tunnel/disable/route.js +1 -1
- package/app/.next-cli-build/server/app/api/tunnel/disable/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/tunnel/enable/route.js +1 -1
- package/app/.next-cli-build/server/app/api/tunnel/enable/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/tunnel/status/route.js +1 -1
- package/app/.next-cli-build/server/app/api/tunnel/status/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/tunnel/tailscale-check/route.js +1 -1
- package/app/.next-cli-build/server/app/api/tunnel/tailscale-check/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/tunnel/tailscale-disable/route.js +1 -1
- package/app/.next-cli-build/server/app/api/tunnel/tailscale-disable/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/tunnel/tailscale-enable/route.js +1 -1
- package/app/.next-cli-build/server/app/api/tunnel/tailscale-enable/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/tunnel/tailscale-install/route.js +3 -3
- package/app/.next-cli-build/server/app/api/tunnel/tailscale-install/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/usage/[connectionId]/route.js +1 -1
- package/app/.next-cli-build/server/app/api/usage/[connectionId]/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/usage/chart/route.js +1 -1
- package/app/.next-cli-build/server/app/api/usage/chart/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/usage/history/route.js +1 -1
- package/app/.next-cli-build/server/app/api/usage/history/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/usage/providers/route.js +1 -1
- package/app/.next-cli-build/server/app/api/usage/providers/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/usage/request-details/route.js +1 -1
- package/app/.next-cli-build/server/app/api/usage/request-details/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/usage/request-logs/route.js +1 -1
- package/app/.next-cli-build/server/app/api/usage/request-logs/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/usage/stats/route.js +1 -1
- package/app/.next-cli-build/server/app/api/usage/stats/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/usage/stream/route.js +2 -2
- package/app/.next-cli-build/server/app/api/usage/stream/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/v1/api/chat/route.js +1 -1
- package/app/.next-cli-build/server/app/api/v1/api/chat/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/v1/audio/speech/route.js +1 -1
- package/app/.next-cli-build/server/app/api/v1/audio/speech/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/v1/audio/transcriptions/route.js +1 -1
- package/app/.next-cli-build/server/app/api/v1/audio/transcriptions/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/v1/audio/voices/route.js +1 -1
- package/app/.next-cli-build/server/app/api/v1/audio/voices/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/v1/chat/completions/route.js +1 -1
- package/app/.next-cli-build/server/app/api/v1/chat/completions/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/v1/embeddings/route.js +1 -1
- package/app/.next-cli-build/server/app/api/v1/embeddings/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/v1/images/generations/route.js +1 -1
- package/app/.next-cli-build/server/app/api/v1/images/generations/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/v1/messages/count_tokens/route.js +1 -1
- package/app/.next-cli-build/server/app/api/v1/messages/count_tokens/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/v1/messages/route.js +1 -1
- package/app/.next-cli-build/server/app/api/v1/messages/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/v1/models/[kind]/route.js +1 -1
- package/app/.next-cli-build/server/app/api/v1/models/[kind]/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/v1/models/info/route.js +1 -1
- package/app/.next-cli-build/server/app/api/v1/models/info/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/v1/models/route.js +1 -1
- package/app/.next-cli-build/server/app/api/v1/models/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/v1/responses/compact/route.js +1 -1
- package/app/.next-cli-build/server/app/api/v1/responses/compact/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/v1/responses/route.js +1 -1
- package/app/.next-cli-build/server/app/api/v1/responses/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/v1/route.js +1 -1
- package/app/.next-cli-build/server/app/api/v1/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/v1/search/route.js +1 -1
- package/app/.next-cli-build/server/app/api/v1/search/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/v1/web/fetch/route.js +1 -1
- package/app/.next-cli-build/server/app/api/v1/web/fetch/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/v1beta/models/[...path]/route.js +1 -1
- package/app/.next-cli-build/server/app/api/v1beta/models/[...path]/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/v1beta/models/route.js +1 -1
- package/app/.next-cli-build/server/app/api/v1beta/models/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/version/route.js +1 -1
- package/app/.next-cli-build/server/app/api/version/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/version/shutdown/route.js +1 -1
- package/app/.next-cli-build/server/app/api/version/shutdown/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/version/update/route.js +1 -1
- package/app/.next-cli-build/server/app/api/version/update/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/callback/page.js +2 -2
- package/app/.next-cli-build/server/app/callback/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/callback/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/callback.html +1 -1
- package/app/.next-cli-build/server/app/callback.rsc +4 -4
- package/app/.next-cli-build/server/app/callback.segments/_full.segment.rsc +4 -4
- package/app/.next-cli-build/server/app/callback.segments/_head.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/callback.segments/_index.segment.rsc +4 -4
- package/app/.next-cli-build/server/app/callback.segments/_tree.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/callback.segments/callback/__PAGE__.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/callback.segments/callback.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/basic-chat.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/basic-chat.rsc +6 -7
- package/app/.next-cli-build/server/app/dashboard/basic-chat.segments/!KGRhc2hib2FyZCk/dashboard/basic-chat/__PAGE__.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/basic-chat.segments/!KGRhc2hib2FyZCk/dashboard/basic-chat.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/basic-chat.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/basic-chat.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -3
- package/app/.next-cli-build/server/app/dashboard/basic-chat.segments/_full.segment.rsc +6 -7
- package/app/.next-cli-build/server/app/dashboard/basic-chat.segments/_head.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/basic-chat.segments/_index.segment.rsc +4 -4
- package/app/.next-cli-build/server/app/dashboard/basic-chat.segments/_tree.segment.rsc +2 -3
- package/app/.next-cli-build/server/app/dashboard/cli-tools.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/cli-tools.rsc +6 -7
- package/app/.next-cli-build/server/app/dashboard/cli-tools.segments/!KGRhc2hib2FyZCk/dashboard/cli-tools/__PAGE__.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/cli-tools.segments/!KGRhc2hib2FyZCk/dashboard/cli-tools.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/cli-tools.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/cli-tools.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -3
- package/app/.next-cli-build/server/app/dashboard/cli-tools.segments/_full.segment.rsc +6 -7
- package/app/.next-cli-build/server/app/dashboard/cli-tools.segments/_head.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/cli-tools.segments/_index.segment.rsc +4 -4
- package/app/.next-cli-build/server/app/dashboard/cli-tools.segments/_tree.segment.rsc +2 -3
- package/app/.next-cli-build/server/app/dashboard/combos.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/combos.rsc +6 -7
- package/app/.next-cli-build/server/app/dashboard/combos.segments/!KGRhc2hib2FyZCk/dashboard/combos/__PAGE__.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/combos.segments/!KGRhc2hib2FyZCk/dashboard/combos.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/combos.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/combos.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -3
- package/app/.next-cli-build/server/app/dashboard/combos.segments/_full.segment.rsc +6 -7
- package/app/.next-cli-build/server/app/dashboard/combos.segments/_head.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/combos.segments/_index.segment.rsc +4 -4
- package/app/.next-cli-build/server/app/dashboard/combos.segments/_tree.segment.rsc +2 -3
- package/app/.next-cli-build/server/app/dashboard/endpoint.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/endpoint.rsc +6 -7
- package/app/.next-cli-build/server/app/dashboard/endpoint.segments/!KGRhc2hib2FyZCk/dashboard/endpoint/__PAGE__.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/endpoint.segments/!KGRhc2hib2FyZCk/dashboard/endpoint.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/endpoint.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/endpoint.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -3
- package/app/.next-cli-build/server/app/dashboard/endpoint.segments/_full.segment.rsc +6 -7
- package/app/.next-cli-build/server/app/dashboard/endpoint.segments/_head.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/endpoint.segments/_index.segment.rsc +4 -4
- package/app/.next-cli-build/server/app/dashboard/endpoint.segments/_tree.segment.rsc +2 -3
- package/app/.next-cli-build/server/app/dashboard/environment.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/environment.rsc +6 -7
- package/app/.next-cli-build/server/app/dashboard/environment.segments/!KGRhc2hib2FyZCk/dashboard/environment/__PAGE__.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/environment.segments/!KGRhc2hib2FyZCk/dashboard/environment.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/environment.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/environment.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -3
- package/app/.next-cli-build/server/app/dashboard/environment.segments/_full.segment.rsc +6 -7
- package/app/.next-cli-build/server/app/dashboard/environment.segments/_head.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/environment.segments/_index.segment.rsc +4 -4
- package/app/.next-cli-build/server/app/dashboard/environment.segments/_tree.segment.rsc +2 -3
- package/app/.next-cli-build/server/app/dashboard/media-providers/web.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/media-providers/web.rsc +6 -7
- package/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/!KGRhc2hib2FyZCk/dashboard/media-providers/web/__PAGE__.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/!KGRhc2hib2FyZCk/dashboard/media-providers/web.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/!KGRhc2hib2FyZCk/dashboard/media-providers.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -3
- package/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/_full.segment.rsc +6 -7
- package/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/_head.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/_index.segment.rsc +4 -4
- package/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/_tree.segment.rsc +2 -3
- package/app/.next-cli-build/server/app/dashboard/mitm.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/mitm.rsc +6 -7
- package/app/.next-cli-build/server/app/dashboard/mitm.segments/!KGRhc2hib2FyZCk/dashboard/mitm/__PAGE__.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/mitm.segments/!KGRhc2hib2FyZCk/dashboard/mitm.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/mitm.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/mitm.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -3
- package/app/.next-cli-build/server/app/dashboard/mitm.segments/_full.segment.rsc +6 -7
- package/app/.next-cli-build/server/app/dashboard/mitm.segments/_head.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/mitm.segments/_index.segment.rsc +4 -4
- package/app/.next-cli-build/server/app/dashboard/mitm.segments/_tree.segment.rsc +2 -3
- package/app/.next-cli-build/server/app/dashboard/profile.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/profile.rsc +6 -7
- package/app/.next-cli-build/server/app/dashboard/profile.segments/!KGRhc2hib2FyZCk/dashboard/profile/__PAGE__.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/profile.segments/!KGRhc2hib2FyZCk/dashboard/profile.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/profile.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/profile.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -3
- package/app/.next-cli-build/server/app/dashboard/profile.segments/_full.segment.rsc +6 -7
- package/app/.next-cli-build/server/app/dashboard/profile.segments/_head.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/profile.segments/_index.segment.rsc +4 -4
- package/app/.next-cli-build/server/app/dashboard/profile.segments/_tree.segment.rsc +2 -3
- package/app/.next-cli-build/server/app/dashboard/providers/new.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/providers/new.rsc +6 -7
- package/app/.next-cli-build/server/app/dashboard/providers/new.segments/!KGRhc2hib2FyZCk/dashboard/providers/new/__PAGE__.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/providers/new.segments/!KGRhc2hib2FyZCk/dashboard/providers/new.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/providers/new.segments/!KGRhc2hib2FyZCk/dashboard/providers.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/providers/new.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/providers/new.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -3
- package/app/.next-cli-build/server/app/dashboard/providers/new.segments/_full.segment.rsc +6 -7
- package/app/.next-cli-build/server/app/dashboard/providers/new.segments/_head.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/providers/new.segments/_index.segment.rsc +4 -4
- package/app/.next-cli-build/server/app/dashboard/providers/new.segments/_tree.segment.rsc +2 -3
- package/app/.next-cli-build/server/app/dashboard/providers.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/providers.rsc +6 -7
- package/app/.next-cli-build/server/app/dashboard/providers.segments/!KGRhc2hib2FyZCk/dashboard/providers/__PAGE__.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/providers.segments/!KGRhc2hib2FyZCk/dashboard/providers.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/providers.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/providers.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -3
- package/app/.next-cli-build/server/app/dashboard/providers.segments/_full.segment.rsc +6 -7
- package/app/.next-cli-build/server/app/dashboard/providers.segments/_head.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/providers.segments/_index.segment.rsc +4 -4
- package/app/.next-cli-build/server/app/dashboard/providers.segments/_tree.segment.rsc +2 -3
- package/app/.next-cli-build/server/app/dashboard/proxy-pools.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/proxy-pools.rsc +6 -7
- package/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/!KGRhc2hib2FyZCk/dashboard/proxy-pools/__PAGE__.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/!KGRhc2hib2FyZCk/dashboard/proxy-pools.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -3
- package/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/_full.segment.rsc +6 -7
- package/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/_head.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/_index.segment.rsc +4 -4
- package/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/_tree.segment.rsc +2 -3
- package/app/.next-cli-build/server/app/dashboard/quota.html +2 -2
- package/app/.next-cli-build/server/app/dashboard/quota.rsc +7 -8
- package/app/.next-cli-build/server/app/dashboard/quota.segments/!KGRhc2hib2FyZCk/dashboard/quota/__PAGE__.segment.rsc +3 -3
- package/app/.next-cli-build/server/app/dashboard/quota.segments/!KGRhc2hib2FyZCk/dashboard/quota.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/quota.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/quota.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -3
- package/app/.next-cli-build/server/app/dashboard/quota.segments/_full.segment.rsc +7 -8
- package/app/.next-cli-build/server/app/dashboard/quota.segments/_head.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/quota.segments/_index.segment.rsc +4 -4
- package/app/.next-cli-build/server/app/dashboard/quota.segments/_tree.segment.rsc +2 -3
- package/app/.next-cli-build/server/app/dashboard/settings/pricing/page.js +2 -2
- package/app/.next-cli-build/server/app/dashboard/settings/pricing/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/dashboard/settings/pricing/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/dashboard/settings/pricing.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/settings/pricing.rsc +4 -4
- package/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/_full.segment.rsc +4 -4
- package/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/_head.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/_index.segment.rsc +4 -4
- package/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/_tree.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/dashboard/settings/pricing/__PAGE__.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/dashboard/settings/pricing.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/dashboard/settings.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/dashboard.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/skills.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/skills.rsc +6 -7
- package/app/.next-cli-build/server/app/dashboard/skills.segments/!KGRhc2hib2FyZCk/dashboard/skills/__PAGE__.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/skills.segments/!KGRhc2hib2FyZCk/dashboard/skills.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/skills.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/skills.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -3
- package/app/.next-cli-build/server/app/dashboard/skills.segments/_full.segment.rsc +6 -7
- package/app/.next-cli-build/server/app/dashboard/skills.segments/_head.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/skills.segments/_index.segment.rsc +4 -4
- package/app/.next-cli-build/server/app/dashboard/skills.segments/_tree.segment.rsc +2 -3
- package/app/.next-cli-build/server/app/dashboard/token-saver.html +1 -0
- package/app/.next-cli-build/server/app/dashboard/token-saver.meta +17 -0
- package/app/.next-cli-build/server/app/dashboard/token-saver.rsc +23 -0
- package/app/.next-cli-build/server/app/dashboard/token-saver.segments/!KGRhc2hib2FyZCk/dashboard/token-saver/__PAGE__.segment.rsc +6 -0
- package/app/.next-cli-build/server/app/dashboard/token-saver.segments/!KGRhc2hib2FyZCk/dashboard/token-saver.segment.rsc +5 -0
- package/app/.next-cli-build/server/app/dashboard/token-saver.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +5 -0
- package/app/.next-cli-build/server/app/dashboard/token-saver.segments/!KGRhc2hib2FyZCk.segment.rsc +5 -0
- package/app/.next-cli-build/server/app/dashboard/token-saver.segments/_full.segment.rsc +23 -0
- package/app/.next-cli-build/server/app/dashboard/token-saver.segments/_head.segment.rsc +6 -0
- package/app/.next-cli-build/server/app/dashboard/token-saver.segments/_index.segment.rsc +8 -0
- package/app/.next-cli-build/server/app/dashboard/token-saver.segments/_tree.segment.rsc +5 -0
- package/app/.next-cli-build/server/app/dashboard/translator.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/translator.rsc +6 -7
- package/app/.next-cli-build/server/app/dashboard/translator.segments/!KGRhc2hib2FyZCk/dashboard/translator/__PAGE__.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/translator.segments/!KGRhc2hib2FyZCk/dashboard/translator.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/translator.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/translator.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -3
- package/app/.next-cli-build/server/app/dashboard/translator.segments/_full.segment.rsc +6 -7
- package/app/.next-cli-build/server/app/dashboard/translator.segments/_head.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/translator.segments/_index.segment.rsc +4 -4
- package/app/.next-cli-build/server/app/dashboard/translator.segments/_tree.segment.rsc +2 -3
- package/app/.next-cli-build/server/app/dashboard/usage.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/usage.rsc +6 -7
- package/app/.next-cli-build/server/app/dashboard/usage.segments/!KGRhc2hib2FyZCk/dashboard/usage/__PAGE__.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/usage.segments/!KGRhc2hib2FyZCk/dashboard/usage.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/usage.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/usage.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -3
- package/app/.next-cli-build/server/app/dashboard/usage.segments/_full.segment.rsc +6 -7
- package/app/.next-cli-build/server/app/dashboard/usage.segments/_head.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/usage.segments/_index.segment.rsc +4 -4
- package/app/.next-cli-build/server/app/dashboard/usage.segments/_tree.segment.rsc +2 -3
- package/app/.next-cli-build/server/app/dashboard.html +1 -1
- package/app/.next-cli-build/server/app/dashboard.rsc +6 -7
- package/app/.next-cli-build/server/app/dashboard.segments/!KGRhc2hib2FyZCk/dashboard/__PAGE__.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -3
- package/app/.next-cli-build/server/app/dashboard.segments/_full.segment.rsc +6 -7
- package/app/.next-cli-build/server/app/dashboard.segments/_head.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard.segments/_index.segment.rsc +4 -4
- package/app/.next-cli-build/server/app/dashboard.segments/_tree.segment.rsc +2 -3
- package/app/.next-cli-build/server/app/favicon.ico/route.js +1 -1
- package/app/.next-cli-build/server/app/favicon.ico/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/index.html +1 -1
- package/app/.next-cli-build/server/app/index.rsc +4 -4
- package/app/.next-cli-build/server/app/index.segments/__PAGE__.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/index.segments/_full.segment.rsc +4 -4
- package/app/.next-cli-build/server/app/index.segments/_head.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/index.segments/_index.segment.rsc +4 -4
- package/app/.next-cli-build/server/app/index.segments/_tree.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/landing/page.js +2 -2
- package/app/.next-cli-build/server/app/landing/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/landing/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/landing.html +1 -1
- package/app/.next-cli-build/server/app/landing.rsc +4 -4
- package/app/.next-cli-build/server/app/landing.segments/_full.segment.rsc +4 -4
- package/app/.next-cli-build/server/app/landing.segments/_head.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/landing.segments/_index.segment.rsc +4 -4
- package/app/.next-cli-build/server/app/landing.segments/_tree.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/landing.segments/landing/__PAGE__.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/landing.segments/landing.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/login/page.js +2 -2
- package/app/.next-cli-build/server/app/login/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/login/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/login.html +1 -1
- package/app/.next-cli-build/server/app/login.rsc +5 -6
- package/app/.next-cli-build/server/app/login.segments/_full.segment.rsc +5 -6
- package/app/.next-cli-build/server/app/login.segments/_head.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/login.segments/_index.segment.rsc +4 -4
- package/app/.next-cli-build/server/app/login.segments/_tree.segment.rsc +2 -3
- package/app/.next-cli-build/server/app/login.segments/login/__PAGE__.segment.rsc +2 -3
- package/app/.next-cli-build/server/app/login.segments/login.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/manifest.webmanifest/route.js +2 -2
- package/app/.next-cli-build/server/app/manifest.webmanifest/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/page.js +2 -2
- package/app/.next-cli-build/server/app/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app-paths-manifest.json +7 -6
- package/app/.next-cli-build/server/chunks/2365.js +1 -1
- package/app/.next-cli-build/server/chunks/412.js +2 -2
- package/app/.next-cli-build/server/chunks/4161.js +1 -1
- package/app/.next-cli-build/server/chunks/706.js +1 -1
- package/app/.next-cli-build/server/chunks/7153.js +1 -1
- package/app/.next-cli-build/server/chunks/8172.js +64 -0
- package/app/.next-cli-build/server/chunks/8361.js +1 -1
- package/app/.next-cli-build/server/chunks/9560.js +1 -1
- package/app/.next-cli-build/server/middleware-build-manifest.js +1 -1
- package/app/.next-cli-build/server/middleware-react-loadable-manifest.js +1 -1
- package/app/.next-cli-build/server/pages/404.html +1 -1
- package/app/.next-cli-build/server/pages/500.html +1 -1
- package/app/.next-cli-build/static/RHPBijCmQR-ky8eDZ9YnR/_buildManifest.js +1 -0
- package/app/.next-cli-build/static/chunks/{1321-4d166ca4db57cb5a.js → 1321-6bc6770ae57a8024.js} +1 -1
- package/app/.next-cli-build/static/chunks/3521.d7c4fc60caef7548.js +1 -0
- package/app/.next-cli-build/static/chunks/{7055-e60e20f43bfbe5f8.js → 5353-d31cc8d476bc534e.js} +1 -1
- package/app/.next-cli-build/static/chunks/5497-56c50577596c7b2e.js +7 -0
- package/app/.next-cli-build/static/chunks/6357.0b212127f3a14e79.js +1 -0
- package/app/.next-cli-build/static/chunks/7504-8cd7f93fa36b3f0a.js +64 -0
- package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/basic-chat/{page-e3d49d83c2ab8f9a.js → page-0ae8d0b50b95b728.js} +1 -1
- package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/cli-tools/[toolId]/{page-3d0c2d2d01f1cf95.js → page-9b8b79cce7b923e4.js} +1 -1
- package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/cli-tools/{page-493e738174ef8e56.js → page-078e371cd28497b6.js} +1 -1
- package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/combos/page-ad8dd713911cdb81.js +1 -0
- package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/console-log/{page-3961f948015bdd56.js → page-b0ca04fb70605405.js} +1 -1
- package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/endpoint/page-c0336422a593932c.js +1 -0
- package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/environment/{page-c4bf05bcf846ba6d.js → page-b0ce20cbd713579f.js} +1 -1
- package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/media-providers/[kind]/[id]/{page-a48bba2b9791ba15.js → page-783b478197298c31.js} +1 -1
- package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/media-providers/[kind]/{page-db16d9a62a940eb6.js → page-5f2ec58004dc0876.js} +1 -1
- package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/media-providers/combo/[id]/{page-e115ded40451deaa.js → page-3f38ec37b17f0037.js} +1 -1
- package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/media-providers/web/{page-3f60d4eb80de903e.js → page-3916c3d0c200ed7f.js} +1 -1
- package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/mitm/{page-6d237c357ec6a059.js → page-6c89f0a1ddd99c41.js} +1 -1
- package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/page-dcf16d0f112217c2.js +1 -0
- package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/profile/{page-2d2be8b7e502d97e.js → page-213eca892abcc206.js} +1 -1
- package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/providers/[id]/{page-4edc641b96a421fd.js → page-3a434c9328af6cef.js} +1 -1
- package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/providers/new/{page-ea34f15d93e8012c.js → page-c3622a7d7cc18cbf.js} +1 -1
- package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/providers/{page-a5d3b3ef7308f1ac.js → page-64fc5c6c998f5551.js} +1 -1
- package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/proxy-pools/{page-ce9c68b763a5195c.js → page-4f7edeb50d89e01e.js} +1 -1
- package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/quota/{page-a54ef4859de62663.js → page-4937d5646f7b17c6.js} +1 -1
- package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/skills/{page-bff87b71ed7474bb.js → page-8efc0655ff743589.js} +1 -1
- package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/token-saver/page-e56b00716fbf6500.js +1 -0
- package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/translator/page-97596f6b0ed5c791.js +1 -0
- package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/usage/{page-9ed1de0c5b1ef123.js → page-a9f7994c00065149.js} +1 -1
- package/app/.next-cli-build/static/chunks/app/(dashboard)/{layout-7de80778aa0f41e3.js → layout-7757ccc2ebe422f2.js} +1 -1
- package/app/.next-cli-build/static/chunks/app/login/{page-a85af94847098e15.js → page-b0a05c2c647c4675.js} +1 -1
- package/app/.next-cli-build/static/chunks/webpack-9b32012c794c6add.js +1 -0
- package/app/.next-cli-build/static/css/701ed312539668cd.css +1 -0
- package/app/cli/.build-home/.krouter/db/backups/{upgrade-0.5.91-to-0.5.92-0.5.92-20260703-192000 → upgrade-0.5.95-to-0.5.96-0.5.96-20260713-161643}/data.sqlite +0 -0
- package/app/cli/.build-home/.krouter/db/backups/upgrade-0.5.96-to-0.5.97-0.5.97-20260713-163014/data.sqlite +0 -0
- package/app/cli/.build-home/.krouter/db/data.sqlite +0 -0
- package/app/cli/package.json +1 -1
- package/app/package.json +1 -1
- package/app/server.js +1 -1
- package/package.json +1 -1
- package/app/.next-cli-build/server/chunks/7013.js +0 -64
- package/app/.next-cli-build/static/LHkMLf_KY1oZOIW8ZhM-4/_buildManifest.js +0 -1
- package/app/.next-cli-build/static/chunks/2649-64ab34e3d24f7ee7.js +0 -64
- package/app/.next-cli-build/static/chunks/5497-97c1b2d72d42c386.js +0 -7
- package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/combos/page-4c1e725bd992da4a.js +0 -1
- package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/endpoint/page-638261f114da6526.js +0 -1
- package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/page-43a506f323765017.js +0 -1
- package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/translator/page-82fb537550ed3b7a.js +0 -1
- package/app/.next-cli-build/static/chunks/webpack-13d7ea85a35aef77.js +0 -1
- package/app/.next-cli-build/static/css/7474021d86f2b7e6.css +0 -1
- /package/app/.next-cli-build/static/{LHkMLf_KY1oZOIW8ZhM-4 → RHPBijCmQR-ky8eDZ9YnR}/_ssgManifest.js +0 -0
- /package/app/.next-cli-build/static/chunks/{1a258343-bc0b514c079d8898.js → 1a258343.bc0b514c079d8898.js} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3471],{38048:(e,t,s)=>{Promise.resolve().then(s.bind(s,64561))},64561:(e,t,s)=>{"use strict";s.r(t),s.d(t,{default:()=>u});var a=s(95155),r=s(12115),o=s(73321),l=s(35497),i=s(81127),n=s(21931),d=s(1620),c=s(31474),m=s(90620),x=s(93308),p=s(38202);function u(){let e=(0,o.useRouter)(),{theme:t,setTheme:s,isDark:u}=(0,d.D)(),[h,b]=(0,r.useState)("en"),[g,y]=(0,r.useState)(!1),[f,j]=(0,r.useState)(!1),[N,v]=(0,r.useState)(!1),[w,C]=(0,r.useState)({fallbackStrategy:"fill-first"}),[k,S]=(0,r.useState)(!0),[P,I]=(0,r.useState)({current:"",new:"",confirm:""}),[O,L]=(0,r.useState)({type:"",message:""}),[R,F]=(0,r.useState)(!1),[D,M]=(0,r.useState)(!1),[T,U]=(0,r.useState)({type:"",message:""}),[E,A]=(0,r.useState)({open:!1,mode:"",password:""}),$=(0,r.useRef)(null),[q,J]=(0,r.useState)({authMode:"password",oidcIssuerUrl:"",oidcClientId:"",oidcScopes:"openid profile email",oidcLoginLabel:"Sign in with OIDC"}),[_,H]=(0,r.useState)(""),[Z,K]=(0,r.useState)({type:"",message:""}),[W,z]=(0,r.useState)(!1),[B,Q]=(0,r.useState)(!1),[G,V]=(0,r.useState)({type:"",message:""}),[Y,X]=(0,r.useState)("/api/auth/oidc/callback"),[ee,et]=(0,r.useState)(!1),es=(0,r.useRef)(null),[ea,er]=(0,r.useState)({outboundProxyEnabled:!1,outboundProxyUrl:"",outboundNoProxy:""}),[eo,el]=(0,r.useState)({type:"",message:""}),[ei,en]=(0,r.useState)(!1),[ed,ec]=(0,r.useState)(!1);(0,r.useEffect)(()=>{b(function(){if("u"<typeof document)return"en";let e=document.cookie.split(";").find(e=>e.trim().startsWith(`${x.CL}=`)),t=e?decodeURIComponent(e.split("=")[1]):"en";return(0,x.QC)(t)}())},[g]),(0,r.useEffect)(()=>{fetch("/api/settings").then(e=>e.json()).then(e=>{C(e),J({authMode:e?.authMode||"password",oidcIssuerUrl:e?.oidcIssuerUrl||"",oidcClientId:e?.oidcClientId||"",oidcScopes:e?.oidcScopes||"openid profile email",oidcLoginLabel:e?.oidcLoginLabel||"Sign in with OIDC"}),H(""),(e?.authMode==="oidc"||e?.authMode==="both")&&et(!0),er({outboundProxyEnabled:e?.outboundProxyEnabled===!0,outboundProxyUrl:e?.outboundProxyUrl||"",outboundNoProxy:e?.outboundNoProxy||""}),S(!1)}).catch(e=>{console.error("Failed to fetch settings:",e),S(!1)})},[]),(0,r.useEffect)(()=>{X(`${window.location.origin}/api/auth/oidc/callback`)},[]);let em=async e=>{if(e.preventDefault(),!0===w.outboundProxyEnabled){en(!0),el({type:"",message:""});try{let e=await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({outboundProxyUrl:ea.outboundProxyUrl,outboundNoProxy:ea.outboundNoProxy})}),t=await e.json();e.ok?(C(e=>({...e,...t})),el({type:"success",message:"Proxy settings applied"})):el({type:"error",message:t.error||"Failed to update proxy settings"})}catch(e){el({type:"error",message:"An error occurred"})}finally{en(!1)}}},ex=async()=>{if(!0!==w.outboundProxyEnabled)return;let e=(ea.outboundProxyUrl||"").trim();if(!e)return void el({type:"error",message:"Please enter a Proxy URL to test"});ec(!0),el({type:"",message:""});try{let t=await fetch("/api/settings/proxy-test",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({proxyUrl:e})}),s=await t.json();t.ok&&s?.ok?el({type:"success",message:`Proxy test OK (${s.status}) in ${s.elapsedMs}ms`}):el({type:"error",message:s?.error||"Proxy test failed"})}catch(e){el({type:"error",message:"An error occurred"})}finally{ec(!1)}},ep=async e=>{en(!0),el({type:"",message:""});try{let t=await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({outboundProxyEnabled:e})}),s=await t.json();t.ok?(C(e=>({...e,...s})),er(e=>({...e,outboundProxyEnabled:s?.outboundProxyEnabled===!0})),el({type:"success",message:e?"Proxy enabled":"Proxy disabled"})):el({type:"error",message:s.error||"Failed to update proxy settings"})}catch(e){el({type:"error",message:"An error occurred"})}finally{en(!1)}},eu=async e=>{if(e.preventDefault(),P.new!==P.confirm)return void L({type:"error",message:"Passwords do not match"});F(!0),L({type:"",message:""});try{let e=await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({currentPassword:P.current,newPassword:P.new})}),t=await e.json();e.ok?(L({type:"success",message:"Password updated successfully"}),I({current:"",new:"",confirm:""})):L({type:"error",message:t.error||"Failed to update password"})}catch(e){L({type:"error",message:"An error occurred"})}finally{F(!1)}},eh=async e=>{try{(await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({fallbackStrategy:e})})).ok&&C(t=>({...t,fallbackStrategy:e}))}catch(e){console.error("Failed to update settings:",e)}},eb=async(e,t)=>{try{(await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({[e]:t})})).ok&&C(s=>({...s,[e]:t}))}catch(t){console.error(`Failed to update ${e}:`,t)}},eg=async e=>{try{(await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({comboStrategy:e})})).ok&&C(t=>({...t,comboStrategy:e}))}catch(e){console.error("Failed to update combo strategy:",e)}},ey=async e=>{let t=parseInt(e);if(!isNaN(t)&&!(t<1))try{(await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({stickyRoundRobinLimit:t})})).ok&&C(e=>({...e,stickyRoundRobinLimit:t}))}catch(e){console.error("Failed to update sticky limit:",e)}},ef=async e=>{let t=parseInt(e);if(!isNaN(t)&&!(t<1))try{(await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({comboStickyRoundRobinLimit:t})})).ok&&C(e=>({...e,comboStickyRoundRobinLimit:t}))}catch(e){console.error("Failed to update combo sticky limit:",e)}},ej=async e=>{try{(await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({requireLogin:e})})).ok&&C(t=>({...t,requireLogin:e}))}catch(e){console.error("Failed to update require login:",e)}},eN=(e,t)=>{J(s=>({...s,[e]:t}))},ev=async(e=q.authMode||"password")=>{let t=q.oidcIssuerUrl.trim(),s=q.oidcClientId.trim(),a=q.oidcScopes.trim(),r=q.oidcLoginLabel.trim(),o=_.trim();if("password"!==e&&(!t||!s||!o)&&!w.oidcConfigured)return void K({type:"error",message:"Issuer URL, client ID, and client secret are required to enable OIDC."});z(!0),K({type:"",message:""}),V({type:"",message:""});try{let l={authMode:e,oidcIssuerUrl:t,oidcClientId:s,oidcScopes:a||"openid profile email",oidcLoginLabel:r||"Sign in with OIDC"};o&&(l.oidcClientSecret=o);let i=await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(l)}),n=await i.json();i.ok?(C(e=>({...e,...n})),J({authMode:n?.authMode||e,oidcIssuerUrl:n?.oidcIssuerUrl||t,oidcClientId:n?.oidcClientId||s,oidcScopes:n?.oidcScopes||a||"openid profile email",oidcLoginLabel:n?.oidcLoginLabel||r||"Sign in with OIDC"}),H(""),K({type:"success",message:"oidc"===e?"OIDC login enabled":"both"===e?"Password and OIDC login enabled":"OIDC settings saved"})):K({type:"error",message:n.error||"Failed to save OIDC settings"})}catch(e){K({type:"error",message:"An error occurred"})}finally{z(!1)}},ew=async()=>{let e=q.oidcIssuerUrl.trim(),t=q.oidcClientId.trim(),s=q.oidcScopes.trim(),a=_.trim();if(!e||!t)return void V({type:"error",message:"Issuer URL and client ID are required to test the connection."});Q(!0),K({type:"",message:""}),V({type:"",message:""});try{let r=await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({authMode:q.authMode||w.authMode||"password",oidcIssuerUrl:e,oidcClientId:t,oidcScopes:s||"openid profile email",oidcLoginLabel:q.oidcLoginLabel.trim()||"Sign in with OIDC",...a?{oidcClientSecret:a}:{}})}),o=await r.json().catch(()=>({}));if(!r.ok)return void V({type:"error",message:o.error||"Failed to save OIDC settings before testing"});let l=await fetch("/api/auth/oidc/test",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({issuerUrl:o.oidcIssuerUrl||e,clientId:o.oidcClientId||t,scopes:o.oidcScopes||s||"openid profile email"})}),i=await l.json().catch(()=>({}));if(l.ok&&i?.ok){let e=i.clientSecretTested?!0===i.clientSecretValid?`Connection OK. Discovery loaded from ${i.issuerUrl}. Client secret validated too.`:`Connection OK. Discovery loaded from ${i.issuerUrl}. Client secret was not checked.`:`Connection OK. Discovery loaded from ${i.issuerUrl}.`;V({type:"success",message:e})}else V({type:"error",message:i.error||"OIDC connection test failed"})}catch(e){V({type:"error",message:"An error occurred"})}finally{Q(!1)}},eC=async e=>{try{(await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({enableObservability:e})})).ok&&C(t=>({...t,enableObservability:e}))}catch(e){console.error("Failed to update enableObservability:",e)}},ek=async()=>{try{let e=await fetch("/api/settings");if(!e.ok)return;let t=await e.json();C(t)}catch(e){console.error("Failed to reload settings:",e)}},eS=async e=>{M(!0),U({type:"",message:""});try{let t=await fetch("/api/settings/database",{headers:{"x-9r-password":e}});if(!t.ok){let e=await t.json().catch(()=>({}));throw Error(e.error||"Failed to export database")}let s=await t.json(),a=JSON.stringify(s,null,2),r=new Blob([a],{type:"application/json"}),o=URL.createObjectURL(r),l=document.createElement("a"),i=new Date().toISOString().replace(/[.:]/g,"-");l.href=o,l.download=`krouter-backup-${i}.json`,document.body.appendChild(l),l.click(),document.body.removeChild(l),URL.revokeObjectURL(o),U({type:"success",message:"Database backup downloaded"})}catch(e){U({type:"error",message:e.message||"Failed to export database"})}finally{M(!1)}},eP=async e=>{let t=$.current;if(t){M(!0);try{let s=await t.text(),a=JSON.parse(s),r=await fetch("/api/settings/database",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...a,password:e})}),o=await r.json().catch(()=>({}));if(!r.ok)throw Error(o.error||"Failed to import database");await ek(),U({type:"success",message:"Database imported successfully"})}catch(e){U({type:"error",message:e.message||"Invalid backup file"})}finally{$.current=null,M(!1)}}},eI=async()=>{let{mode:e,password:t}=E;A({open:!1,mode:"",password:""}),"export"===e?await eS(t):"import"===e&&await eP(t)},eO=!0===w.enableObservability,eL=async()=>{v(!0);try{await fetch("/api/version/shutdown",{method:"POST"})}catch(e){}v(!1),j(!1)},eR=async()=>{try{(await fetch("/api/auth/logout",{method:"POST"})).ok&&(e.push("/login"),e.refresh())}catch(e){console.error("Failed to logout:",e)}};return(0,a.jsxs)("div",{className:"max-w-2xl mx-auto px-4 sm:px-0",children:[(0,a.jsxs)("div",{className:"flex flex-col gap-6",children:[(0,a.jsxs)(l.Zp,{children:[(0,a.jsxs)("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-4 mb-4",children:[(0,a.jsxs)("div",{className:"flex items-center gap-3 sm:gap-4",children:[(0,a.jsx)("div",{className:"size-10 sm:size-12 rounded-lg bg-green-500/10 text-green-500 flex items-center justify-center shrink-0",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-xl sm:text-2xl",children:"computer"})}),(0,a.jsxs)("div",{children:[(0,a.jsx)("h2",{className:"text-lg sm:text-xl font-semibold",children:"Local Mode"}),(0,a.jsx)("p",{className:"text-sm text-text-muted",children:"Running on your machine"})]})]}),(0,a.jsx)("div",{className:"inline-flex p-1 rounded-lg bg-black/5 dark:bg-white/5 w-full sm:w-auto",children:["light","dark","system"].map(e=>(0,a.jsxs)("button",{type:"button",onClick:()=>s(e),className:(0,c.cn)("flex items-center justify-center gap-1 sm:gap-1.5 px-2 sm:px-3 py-1.5 rounded-md font-medium transition-all flex-1 sm:flex-initial",t===e?"bg-white dark:bg-white/10 text-text-main shadow-sm":"text-text-muted hover:text-text-main"),children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"light"===e?"light_mode":"dark"===e?"dark_mode":"contrast"}),(0,a.jsx)("span",{className:"capitalize text-xs sm:text-sm",children:e})]},e))})]}),(0,a.jsxs)("div",{className:"flex flex-col gap-3 pt-4 border-t border-border",children:[(0,a.jsx)("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between p-3 rounded-lg bg-bg border border-border gap-2",children:(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"font-medium text-sm sm:text-base",children:"Database Location"}),(0,a.jsx)("p",{className:"text-xs sm:text-sm text-text-muted font-mono break-all",children:"~/.krouter/db/data.sqlite"})]})}),(0,a.jsxs)("div",{className:"flex flex-col sm:flex-row gap-2",children:[(0,a.jsx)(l.$n,{variant:"secondary",icon:"download",onClick:()=>A({open:!0,mode:"export",password:""}),loading:D,className:"w-full sm:w-auto",children:"Download Backup"}),(0,a.jsx)(l.$n,{variant:"outline",icon:"upload",onClick:()=>es.current?.click(),disabled:D,className:"w-full sm:w-auto",children:"Import Backup"}),(0,a.jsx)("input",{ref:es,type:"file",accept:"application/json,.json",className:"hidden",onChange:e=>{let t=e.target.files?.[0];es.current&&(es.current.value=""),t&&($.current=t,U({type:"",message:""}),A({open:!0,mode:"import",password:""}))}})]}),T.message&&(0,a.jsx)("p",{className:`text-sm ${"error"===T.type?"text-red-500":"text-green-600 dark:text-green-400"}`,children:T.message})]})]}),(0,a.jsxs)(l.Zp,{children:[(0,a.jsxs)("div",{className:"flex items-center gap-3 mb-4",children:[(0,a.jsx)("div",{className:"size-10 rounded-lg bg-blue-500/10 text-blue-500 flex items-center justify-center shrink-0",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[20px]",children:"language"})}),(0,a.jsx)("h3",{className:"text-base sm:text-lg font-semibold",children:"Language"})]}),(0,a.jsxs)("button",{onClick:()=>y(!0),className:"flex items-center justify-between w-full p-3 rounded-lg bg-bg border border-border hover:border-primary/50 transition-colors","data-i18n-skip":"true",children:[(0,a.jsx)("span",{className:"text-sm text-text-muted",children:"Display language"}),(0,a.jsx)("span",{className:"text-2xl",children:p.h[h]||"\uD83C\uDF10"})]})]}),(0,a.jsxs)(l.Zp,{children:[(0,a.jsxs)("div",{className:"flex items-center gap-3 mb-4",children:[(0,a.jsx)("div",{className:"p-2 rounded-lg bg-primary/10 text-primary shrink-0",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[20px]",children:"shield"})}),(0,a.jsx)("h3",{className:"text-base sm:text-lg font-semibold",children:"Security"})]}),(0,a.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,a.jsxs)("div",{className:"flex items-start sm:items-center justify-between gap-4",children:[(0,a.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,a.jsx)("p",{className:"font-medium text-sm sm:text-base",children:"Require login"}),(0,a.jsx)("p",{className:"text-xs sm:text-sm text-text-muted",children:"When ON, dashboard requires password. When OFF, access without login."})]}),(0,a.jsx)(l.lM,{checked:!0===w.requireLogin,onChange:()=>ej(!w.requireLogin),disabled:k})]}),!0===w.requireLogin&&(0,a.jsxs)("form",{onSubmit:eu,className:"flex flex-col gap-4 pt-4 border-t border-border/50",children:[w.hasPassword&&(0,a.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,a.jsx)("label",{className:"text-xs sm:text-sm font-medium",children:"Current Password"}),(0,a.jsx)(l.pd,{type:"password",placeholder:"Enter current password",value:P.current,onChange:e=>I({...P,current:e.target.value}),required:!0})]}),(0,a.jsxs)("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[(0,a.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,a.jsx)("label",{className:"text-xs sm:text-sm font-medium",children:"New Password"}),(0,a.jsx)(l.pd,{type:"password",placeholder:"Enter new password",value:P.new,onChange:e=>I({...P,new:e.target.value}),required:!0})]}),(0,a.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,a.jsx)("label",{className:"text-xs sm:text-sm font-medium",children:"Confirm New Password"}),(0,a.jsx)(l.pd,{type:"password",placeholder:"Confirm new password",value:P.confirm,onChange:e=>I({...P,confirm:e.target.value}),required:!0})]})]}),O.message&&(0,a.jsx)("p",{className:`text-xs sm:text-sm ${"error"===O.type?"text-red-500":"text-green-500"}`,children:O.message}),(0,a.jsx)("div",{className:"pt-2",children:(0,a.jsx)(l.$n,{type:"submit",variant:"primary",loading:R,className:"w-full sm:w-auto",children:w.hasPassword?"Update Password":"Set Password"})})]})]})]}),(0,a.jsxs)(l.Zp,{children:[(0,a.jsxs)("button",{type:"button",onClick:()=>et(e=>!e),className:"w-full flex items-center gap-3 text-left",children:[(0,a.jsx)("div",{className:"p-2 rounded-lg bg-indigo-500/10 text-indigo-500 shrink-0",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[20px]",children:"lock_open"})}),(0,a.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,a.jsx)("h3",{className:"text-base sm:text-lg font-semibold",children:"OIDC Dashboard Login"}),(0,a.jsx)("p",{className:"text-xs text-text-muted",children:"oidc"===w.authMode?"OIDC active":"both"===w.authMode?"Password + OIDC active":"Optional SSO via Authentik/Keycloak/Google"})]}),(0,a.jsx)("span",{className:"material-symbols-outlined text-text-muted shrink-0",children:ee?"expand_less":"expand_more"})]}),ee&&(0,a.jsxs)("div",{className:"flex flex-col gap-4 mt-4",children:[(0,a.jsx)("p",{className:"text-xs sm:text-sm text-text-muted",children:"Use Authentik or any OIDC provider to sign in to the dashboard. You can enable password-only, OIDC-only, or both for the dashboard; model API access still uses API keys."}),(0,a.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,a.jsx)("label",{className:"font-medium text-sm sm:text-base",children:"Auth Mode"}),(0,a.jsx)("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-2",children:[{value:"password",title:"Password only",desc:"Keep the legacy password login."},{value:"oidc",title:"OIDC only",desc:"Require OIDC for dashboard access."},{value:"both",title:"Both",desc:"Allow either password or OIDC."}].map(e=>{let t=q.authMode===e.value;return(0,a.jsxs)("button",{type:"button",onClick:()=>eN("authMode",e.value),className:(0,c.cn)("text-left rounded-lg border p-3 transition-colors",t?"border-primary bg-primary/5":"border-border bg-bg hover:bg-black/5 dark:hover:bg-white/5"),disabled:k||W,children:[(0,a.jsx)("p",{className:"font-medium text-sm sm:text-base",children:e.title}),(0,a.jsx)("p",{className:"text-xs sm:text-sm text-text-muted mt-1",children:e.desc})]},e.value)})})]}),(0,a.jsxs)("div",{className:"grid grid-cols-1 gap-4",children:[(0,a.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,a.jsx)("label",{className:"font-medium text-sm sm:text-base",children:"Issuer URL"}),(0,a.jsx)(l.pd,{placeholder:"https://auth.example.com/application/o/krouter/",value:q.oidcIssuerUrl,onChange:e=>eN("oidcIssuerUrl",e.target.value),disabled:k||W})]}),(0,a.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,a.jsx)("label",{className:"font-medium text-sm sm:text-base",children:"Client ID"}),(0,a.jsx)(l.pd,{placeholder:"krouter-dashboard",value:q.oidcClientId,onChange:e=>eN("oidcClientId",e.target.value),disabled:k||W})]}),(0,a.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,a.jsx)("label",{className:"font-medium text-sm sm:text-base",children:"Client Secret"}),(0,a.jsx)(l.pd,{type:"password",placeholder:"Leave blank to keep existing secret",value:_,onChange:e=>H(e.target.value),disabled:k||W}),(0,a.jsx)("p",{className:"text-xs sm:text-sm text-text-muted",children:"This value is write-only after saving."})]}),(0,a.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,a.jsx)("label",{className:"font-medium text-sm sm:text-base",children:"Scopes"}),(0,a.jsx)(l.pd,{placeholder:"openid profile email",value:q.oidcScopes,onChange:e=>eN("oidcScopes",e.target.value),disabled:k||W})]}),(0,a.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,a.jsx)("label",{className:"font-medium text-sm sm:text-base",children:"Login Button Label"}),(0,a.jsx)(l.pd,{placeholder:"Sign in with OIDC",value:q.oidcLoginLabel,onChange:e=>eN("oidcLoginLabel",e.target.value),disabled:k||W})]})]}),(0,a.jsxs)("div",{className:"rounded-lg border border-border bg-bg p-3 text-xs sm:text-sm text-text-muted",children:[(0,a.jsx)("p",{className:"font-medium text-text-main mb-1",children:"Redirect URI"}),(0,a.jsx)("code",{className:"block break-all font-mono",children:Y})]}),(0,a.jsxs)("div",{className:"flex flex-col sm:flex-row gap-2 pt-2 border-t border-border/50",children:[(0,a.jsx)(l.$n,{type:"button",variant:"primary",loading:W,onClick:()=>ev(),className:"w-full sm:w-auto",children:"Save auth mode"}),(0,a.jsx)(l.$n,{type:"button",variant:"outline",loading:B,onClick:ew,className:"w-full sm:w-auto",children:"Test connection"})]}),G.message&&(0,a.jsx)("p",{className:`text-xs sm:text-sm ${"error"===G.type?"text-red-500":"text-green-500"}`,children:G.message}),Z.message&&(0,a.jsx)("p",{className:`text-xs sm:text-sm ${"error"===Z.type?"text-red-500":"text-green-500"}`,children:Z.message}),"oidc"===w.authMode&&(0,a.jsx)("p",{className:"text-xs sm:text-sm text-amber-600 dark:text-amber-400",children:"OIDC login is currently active. Password login is disabled until you switch back."}),"both"===w.authMode&&(0,a.jsx)("p",{className:"text-xs sm:text-sm text-amber-600 dark:text-amber-400",children:"Password and OIDC login are both active."})]})]}),(0,a.jsxs)(l.Zp,{children:[(0,a.jsxs)("div",{className:"flex items-center gap-3 mb-4",children:[(0,a.jsx)("div",{className:"p-2 rounded-lg bg-blue-500/10 text-blue-500 shrink-0",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[20px]",children:"route"})}),(0,a.jsx)("h3",{className:"text-base sm:text-lg font-semibold",children:"Routing Strategy"})]}),(0,a.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,a.jsxs)("div",{className:"flex items-start sm:items-center justify-between gap-4",children:[(0,a.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,a.jsx)("p",{className:"font-medium text-sm sm:text-base",children:"Strategy"}),(0,a.jsx)("p",{className:"text-xs sm:text-sm text-text-muted",children:"How kRouter picks the next available account"})]}),(0,a.jsx)(l.l6,{value:w.fallbackStrategy||"fill-first",onChange:e=>eh(e.target.value),disabled:k,className:"w-44 sm:w-56 shrink-0",options:[{value:"fill-first",label:"Fill First (default)"},{value:"round-robin",label:"Round Robin"},{value:"p2c",label:"P2C (Power of 2 Choices)"},{value:"random",label:"Random"}]})]}),"round-robin"===w.fallbackStrategy&&(0,a.jsxs)("div",{className:"flex items-start sm:items-center justify-between gap-4 pt-2 border-t border-border/50",children:[(0,a.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,a.jsx)("p",{className:"font-medium text-sm sm:text-base",children:"Sticky Limit"}),(0,a.jsx)("p",{className:"text-xs sm:text-sm text-text-muted",children:"Calls per account before switching"})]}),(0,a.jsx)(l.pd,{type:"number",min:"1",max:"10",value:w.stickyRoundRobinLimit||3,onChange:e=>ey(e.target.value),disabled:k,className:"w-16 sm:w-20 text-center shrink-0"})]}),(0,a.jsxs)("div",{className:"flex items-start sm:items-center justify-between gap-4 pt-4 border-t border-border/50",children:[(0,a.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,a.jsx)("p",{className:"font-medium text-sm sm:text-base",children:"Combo Round Robin"}),(0,a.jsx)("p",{className:"text-xs sm:text-sm text-text-muted",children:"Cycle through providers in combos instead of always starting with first"})]}),(0,a.jsx)(l.lM,{checked:"round-robin"===w.comboStrategy,onChange:()=>eg("round-robin"===w.comboStrategy?"fallback":"round-robin"),disabled:k})]}),"round-robin"===w.comboStrategy&&(0,a.jsxs)("div",{className:"flex items-center justify-between pt-2 border-t border-border/50",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"font-medium",children:"Combo Sticky Limit"}),(0,a.jsx)("p",{className:"text-sm text-text-muted",children:"Calls per combo model before switching"})]}),(0,a.jsx)(l.pd,{type:"number",min:"1",max:"100",value:w.comboStickyRoundRobinLimit||1,onChange:e=>ef(e.target.value),disabled:k,className:"w-20 text-center"})]}),(0,a.jsxs)("p",{className:"text-xs text-text-muted italic pt-2 border-t border-border/50",children:["round-robin"===w.fallbackStrategy?`Distributing requests across all available accounts with ${w.stickyRoundRobinLimit||3} calls per account.`:"p2c"===w.fallbackStrategy?"Picking the healthier of 2 random accounts on each request (good for load-balancing equal-tier accounts).":"random"===w.fallbackStrategy?"Picking a uniformly random account on each request.":"Using accounts in priority order (Fill First).","round-robin"===w.comboStrategy?` Combos rotate after ${w.comboStickyRoundRobinLimit||1} call${1===(w.comboStickyRoundRobinLimit||1)?"":"s"} per model.`:" Combos always start with their first model."]})]})]}),(0,a.jsxs)(l.Zp,{children:[(0,a.jsxs)("div",{className:"flex items-center gap-3 mb-4",children:[(0,a.jsx)("div",{className:"p-2 rounded-lg bg-purple-500/10 text-purple-500 shrink-0",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[20px]",children:"psychology"})}),(0,a.jsx)("h3",{className:"text-base sm:text-lg font-semibold",children:"Task-Aware Routing"})]}),(0,a.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,a.jsxs)("div",{className:"flex items-start sm:items-center justify-between gap-4",children:[(0,a.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,a.jsx)("p",{className:"font-medium text-sm sm:text-base",children:"Show intent suggestions in logs"}),(0,a.jsx)("p",{className:"text-xs sm:text-sm text-text-muted",children:"Classify every request as code / math / reasoning / creative / simple (9 languages) and log the suggested combo. Log-only; never overrides your chosen model."})]}),(0,a.jsx)(l.lM,{checked:!1!==w.routingIntelligenceEnabled,onChange:()=>eb("routingIntelligenceEnabled",!1===w.routingIntelligenceEnabled),disabled:k})]}),!1!==w.routingIntelligenceEnabled&&(0,a.jsxs)("p",{className:"text-xs text-text-muted italic pt-2 border-t border-border/50",children:["Active — check the dev console for ",(0,a.jsx)("code",{children:"[ROUTING] intent=X complexity=Y score=N tier=Z"})," lines. Custom intent→combo overrides via ",(0,a.jsx)("code",{children:"taskAwareRouterMap"})," setting (JSON)."]})]})]}),(0,a.jsxs)(l.Zp,{children:[(0,a.jsxs)("div",{className:"flex items-center gap-3 mb-4",children:[(0,a.jsx)("div",{className:"p-2 rounded-lg bg-amber-500/10 text-amber-500 shrink-0",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[20px]",children:"emergency"})}),(0,a.jsx)("h3",{className:"text-base sm:text-lg font-semibold",children:"Emergency Fallback"})]}),(0,a.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,a.jsxs)("div",{className:"flex items-start sm:items-center justify-between gap-4",children:[(0,a.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,a.jsx)("p",{className:"font-medium text-sm sm:text-base",children:"Redirect on budget exhaustion"}),(0,a.jsx)("p",{className:"text-xs sm:text-sm text-text-muted",children:'When an upstream returns 402 or "insufficient funds", transparently re-route the request to a free model so the user still gets a response.'})]}),(0,a.jsx)(l.lM,{checked:!!w.emergencyFallbackEnabled,onChange:()=>eb("emergencyFallbackEnabled",!w.emergencyFallbackEnabled),disabled:k})]}),w.emergencyFallbackEnabled&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("div",{className:"flex items-start sm:items-center justify-between gap-4 pt-3 border-t border-border/50",children:[(0,a.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,a.jsx)("p",{className:"font-medium text-sm sm:text-base",children:"Fallback provider"}),(0,a.jsxs)("p",{className:"text-xs sm:text-sm text-text-muted",children:["Provider ID used for the redirect (e.g. ",(0,a.jsx)("code",{children:"nvidia"}),", ",(0,a.jsx)("code",{children:"openrouter"}),", ",(0,a.jsx)("code",{children:"opencode"}),")"]})]}),(0,a.jsx)(l.pd,{type:"text",value:w.emergencyFallbackProvider||"nvidia",onChange:e=>eb("emergencyFallbackProvider",e.target.value.trim()),disabled:k,className:"w-32 sm:w-44 text-center shrink-0",placeholder:"nvidia"})]}),(0,a.jsxs)("div",{className:"flex items-start sm:items-center justify-between gap-4 pt-3 border-t border-border/50",children:[(0,a.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,a.jsx)("p",{className:"font-medium text-sm sm:text-base",children:"Fallback model"}),(0,a.jsxs)("p",{className:"text-xs sm:text-sm text-text-muted",children:["Model ID at that provider. Default ",(0,a.jsx)("code",{children:"openai/gpt-oss-120b"})," is free on NVIDIA NIM."]})]}),(0,a.jsx)(l.pd,{type:"text",value:w.emergencyFallbackModel||"openai/gpt-oss-120b",onChange:e=>eb("emergencyFallbackModel",e.target.value.trim()),disabled:k,className:"w-40 sm:w-56 text-center shrink-0",placeholder:"openai/gpt-oss-120b"})]}),(0,a.jsxs)("div",{className:"flex items-start sm:items-center justify-between gap-4 pt-3 border-t border-border/50",children:[(0,a.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,a.jsx)("p",{className:"font-medium text-sm sm:text-base",children:"Skip for tool requests"}),(0,a.jsx)("p",{className:"text-xs sm:text-sm text-text-muted",children:"Don't redirect when the request has tools — the free model may not support tool calling."})]}),(0,a.jsx)(l.lM,{checked:!1!==w.emergencyFallbackSkipForTools,onChange:()=>eb("emergencyFallbackSkipForTools",!1===w.emergencyFallbackSkipForTools),disabled:k})]}),(0,a.jsxs)("p",{className:"text-xs text-text-muted italic pt-2 border-t border-border/50",children:["Currently redirecting 402 / budget errors to"," ",(0,a.jsxs)("code",{children:[w.emergencyFallbackProvider||"nvidia","/",w.emergencyFallbackModel||"openai/gpt-oss-120b"]}),"."]})]}),!w.emergencyFallbackEnabled&&(0,a.jsx)("p",{className:"text-xs text-text-muted italic pt-2 border-t border-border/50",children:"Disabled — 402 / budget errors are returned to the user as-is."})]})]}),(0,a.jsxs)(l.Zp,{children:[(0,a.jsxs)("div",{className:"flex items-center gap-3 mb-4",children:[(0,a.jsx)("div",{className:"p-2 rounded-lg bg-cyan-500/10 text-cyan-500 shrink-0",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[20px]",children:"database"})}),(0,a.jsx)("h3",{className:"text-base sm:text-lg font-semibold",children:"Cache Control"})]}),(0,a.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,a.jsxs)("div",{className:"flex items-start sm:items-center justify-between gap-4",children:[(0,a.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,a.jsx)("p",{className:"font-medium text-sm sm:text-base",children:"Mode"}),(0,a.jsxs)("p",{className:"text-xs sm:text-sm text-text-muted",children:["Controls whether kRouter mutates ",(0,a.jsx)("code",{children:"cache_control"})," markers on Claude-shape requests. Anthropic's prompt cache is byte-keyed; any mutation busts the cache."]})]}),(0,a.jsxs)("select",{value:w.cacheControlMode||"auto",onChange:e=>eb("cacheControlMode",e.target.value),disabled:k,className:"w-32 sm:w-44 px-3 py-2 text-sm rounded border border-border bg-bg text-text-main shrink-0",children:[(0,a.jsx)("option",{value:"auto",children:"Auto (recommended)"}),(0,a.jsx)("option",{value:"always",children:"Always preserve"}),(0,a.jsx)("option",{value:"never",children:"Never preserve (legacy)"})]})]}),(0,a.jsxs)("div",{className:"flex items-start sm:items-center justify-between gap-4 pt-3 border-t border-border/50",children:[(0,a.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,a.jsx)("p",{className:"font-medium text-sm sm:text-base",children:"Quick toggle"}),(0,a.jsx)("p",{className:"text-xs sm:text-sm text-text-muted",children:"Got a fresh-turn 429 because your prompt is bigger than your tier's TPM? Click once to switch into legacy trimming, send your first turn, then click again to return to cache-preserve mode."})]}),(0,a.jsx)("button",{type:"button",onClick:()=>eb("cacheControlMode","never"===(w.cacheControlMode||"auto")?"auto":"never"),disabled:k,className:`w-32 sm:w-44 px-3 py-2 text-sm font-medium rounded shrink-0 transition-colors ${"never"===(w.cacheControlMode||"auto")?"bg-amber-500/15 text-amber-600 border border-amber-500/40 hover:bg-amber-500/25":"bg-cyan-500/15 text-cyan-600 border border-cyan-500/40 hover:bg-cyan-500/25"}`,children:"never"===(w.cacheControlMode||"auto")?"Restore cache preserve":"Emergency: trim prompt"})]}),(0,a.jsxs)("p",{className:"text-xs text-text-muted italic pt-2 border-t border-border/50",children:["auto"===(w.cacheControlMode||"auto")&&(0,a.jsxs)(a.Fragment,{children:["Currently ",(0,a.jsx)("strong",{children:"auto"}),": preserves ",(0,a.jsx)("code",{children:"cache_control"})," only on Claude Desktop / Claude Code passthrough (",(0,a.jsx)("code",{children:'clientTool==="claude"'})," & ",(0,a.jsx)("code",{children:'provider==="claude"'}),"). All other paths mutate as before."]}),"always"===w.cacheControlMode&&(0,a.jsxs)(a.Fragment,{children:["Currently ",(0,a.jsx)("strong",{children:"always"}),": preserves ",(0,a.jsx)("code",{children:"cache_control"})," on any Claude-shape target (including ",(0,a.jsx)("code",{children:"anthropic-compatible-*"})," resellers and translated requests). Paranoid mode."]}),"never"===w.cacheControlMode&&(0,a.jsxs)(a.Fragment,{children:["Currently ",(0,a.jsx)("strong",{children:"never"}),": legacy 0.5.31-and-earlier behaviour — always strip and rewrite ",(0,a.jsx)("code",{children:"cache_control"}),". Escape hatch only."]})]})]})]}),(0,a.jsxs)(l.Zp,{children:[(0,a.jsxs)("div",{className:"flex items-center gap-3 mb-4",children:[(0,a.jsx)("div",{className:"p-2 rounded-lg bg-purple-500/10 text-purple-500 shrink-0",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[20px]",children:"wifi"})}),(0,a.jsx)("h3",{className:"text-base sm:text-lg font-semibold",children:"Network"})]}),(0,a.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,a.jsxs)("div",{className:"flex items-start sm:items-center justify-between gap-4",children:[(0,a.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,a.jsx)("p",{className:"font-medium text-sm sm:text-base",children:"Outbound Proxy"}),(0,a.jsx)("p",{className:"text-xs sm:text-sm text-text-muted",children:"Enable proxy for OAuth + provider outbound requests."})]}),(0,a.jsx)(l.lM,{checked:!0===w.outboundProxyEnabled,onChange:()=>ep(!0!==w.outboundProxyEnabled),disabled:k||ei})]}),!0===w.outboundProxyEnabled&&(0,a.jsxs)("form",{onSubmit:em,className:"flex flex-col gap-4 pt-2 border-t border-border/50",children:[(0,a.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,a.jsx)("label",{className:"font-medium text-sm sm:text-base",children:"Proxy URL"}),(0,a.jsx)(l.pd,{placeholder:"http://127.0.0.1:7897",value:ea.outboundProxyUrl,onChange:e=>er(t=>({...t,outboundProxyUrl:e.target.value})),disabled:k||ei}),(0,a.jsx)("p",{className:"text-xs sm:text-sm text-text-muted",children:"Leave empty to inherit existing env proxy (if any)."})]}),(0,a.jsxs)("div",{className:"flex flex-col gap-2 pt-2 border-t border-border/50",children:[(0,a.jsx)("label",{className:"font-medium text-sm sm:text-base",children:"No Proxy"}),(0,a.jsx)(l.pd,{placeholder:"localhost,127.0.0.1",value:ea.outboundNoProxy,onChange:e=>er(t=>({...t,outboundNoProxy:e.target.value})),disabled:k||ei}),(0,a.jsx)("p",{className:"text-xs sm:text-sm text-text-muted",children:"Comma-separated hostnames/domains to bypass the proxy."})]}),(0,a.jsxs)("div",{className:"pt-2 border-t border-border/50 flex flex-col sm:flex-row items-stretch sm:items-center gap-2",children:[(0,a.jsx)(l.$n,{type:"button",variant:"secondary",loading:ed,disabled:k||ei,onClick:ex,className:"w-full sm:w-auto",children:"Test proxy URL"}),(0,a.jsx)(l.$n,{type:"submit",variant:"primary",loading:ei,className:"w-full sm:w-auto",children:"Apply"})]})]}),eo.message&&(0,a.jsx)("p",{className:`text-xs sm:text-sm ${"error"===eo.type?"text-red-500":"text-green-500"} pt-2 border-t border-border/50`,children:eo.message})]})]}),(0,a.jsxs)(l.Zp,{children:[(0,a.jsxs)("div",{className:"flex items-center gap-3 mb-4",children:[(0,a.jsx)("div",{className:"p-2 rounded-lg bg-orange-500/10 text-orange-500 shrink-0",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[20px]",children:"monitoring"})}),(0,a.jsx)("h3",{className:"text-base sm:text-lg font-semibold",children:"Observability"})]}),(0,a.jsxs)("div",{className:"flex items-start sm:items-center justify-between gap-4",children:[(0,a.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,a.jsx)("p",{className:"font-medium text-sm sm:text-base",children:"Enable Observability"}),(0,a.jsx)("p",{className:"text-xs sm:text-sm text-text-muted",children:"Record request details for inspection in the logs view"})]}),(0,a.jsx)(l.lM,{checked:eO,onChange:eC,disabled:k})]})]}),(0,a.jsxs)("div",{className:"flex flex-col sm:flex-row gap-2",children:[(0,a.jsx)(l.$n,{variant:"outline",fullWidth:!0,icon:"power_settings_new",onClick:()=>j(!0),className:"text-red-500 border-red-200 hover:bg-red-50 hover:border-red-300",children:"Shutdown"}),(0,a.jsx)(l.$n,{variant:"outline",fullWidth:!0,icon:"logout",onClick:eR,children:"Logout"})]}),(0,a.jsxs)("div",{className:"text-center text-xs sm:text-sm text-text-muted py-4",children:[(0,a.jsxs)("p",{children:[m.vQ.name," v",m.vQ.version]}),(0,a.jsx)("p",{className:"mt-1",children:"Local Mode - All data stored on your machine"})]})]}),(0,a.jsx)(n.default,{hideTrigger:!0,isOpen:g,onClose:e=>{y(!1),b(e)}}),(0,a.jsx)(i.ConfirmModal,{isOpen:f,onClose:()=>j(!1),onConfirm:eL,title:"Close Proxy",message:"Are you sure you want to close the proxy server?",confirmText:"Close",cancelText:"Cancel",variant:"danger",loading:N}),(0,a.jsxs)(i.default,{isOpen:E.open,onClose:()=>A({open:!1,mode:"",password:""}),title:"Confirm Password",size:"sm",footer:(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(l.$n,{variant:"ghost",onClick:()=>A({open:!1,mode:"",password:""}),disabled:D,children:"Cancel"}),(0,a.jsx)(l.$n,{variant:"primary",onClick:eI,loading:D,disabled:!E.password,children:"Confirm"})]}),children:[(0,a.jsxs)("p",{className:"text-text-muted mb-3 text-sm",children:["Enter your current password to ","export"===E.mode?"export":"import"," the database."]}),(0,a.jsx)(l.pd,{type:"password",value:E.password,onChange:e=>A(t=>({...t,password:e.target.value})),onKeyDown:e=>{"Enter"===e.key&&E.password&&eI()},placeholder:"Current password",autoFocus:!0})]})]})}}},e=>{e.O(0,[2574,3862,2649,1321,5497,8441,3794,7358],()=>e(e.s=38048)),_N_E=e.O()}]);
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3471],{38048:(e,t,s)=>{Promise.resolve().then(s.bind(s,64561))},64561:(e,t,s)=>{"use strict";s.r(t),s.d(t,{default:()=>u});var a=s(95155),r=s(12115),o=s(73321),l=s(35497),i=s(81127),n=s(21931),d=s(1620),c=s(31474),m=s(90620),x=s(93308),p=s(38202);function u(){let e=(0,o.useRouter)(),{theme:t,setTheme:s,isDark:u}=(0,d.D)(),[h,b]=(0,r.useState)("en"),[g,y]=(0,r.useState)(!1),[f,j]=(0,r.useState)(!1),[N,v]=(0,r.useState)(!1),[w,C]=(0,r.useState)({fallbackStrategy:"fill-first"}),[k,S]=(0,r.useState)(!0),[P,I]=(0,r.useState)({current:"",new:"",confirm:""}),[O,L]=(0,r.useState)({type:"",message:""}),[R,F]=(0,r.useState)(!1),[D,M]=(0,r.useState)(!1),[T,U]=(0,r.useState)({type:"",message:""}),[E,A]=(0,r.useState)({open:!1,mode:"",password:""}),$=(0,r.useRef)(null),[q,J]=(0,r.useState)({authMode:"password",oidcIssuerUrl:"",oidcClientId:"",oidcScopes:"openid profile email",oidcLoginLabel:"Sign in with OIDC"}),[_,H]=(0,r.useState)(""),[Z,K]=(0,r.useState)({type:"",message:""}),[W,z]=(0,r.useState)(!1),[B,Q]=(0,r.useState)(!1),[G,V]=(0,r.useState)({type:"",message:""}),[Y,X]=(0,r.useState)("/api/auth/oidc/callback"),[ee,et]=(0,r.useState)(!1),es=(0,r.useRef)(null),[ea,er]=(0,r.useState)({outboundProxyEnabled:!1,outboundProxyUrl:"",outboundNoProxy:""}),[eo,el]=(0,r.useState)({type:"",message:""}),[ei,en]=(0,r.useState)(!1),[ed,ec]=(0,r.useState)(!1);(0,r.useEffect)(()=>{b(function(){if("u"<typeof document)return"en";let e=document.cookie.split(";").find(e=>e.trim().startsWith(`${x.CL}=`)),t=e?decodeURIComponent(e.split("=")[1]):"en";return(0,x.QC)(t)}())},[g]),(0,r.useEffect)(()=>{fetch("/api/settings").then(e=>e.json()).then(e=>{C(e),J({authMode:e?.authMode||"password",oidcIssuerUrl:e?.oidcIssuerUrl||"",oidcClientId:e?.oidcClientId||"",oidcScopes:e?.oidcScopes||"openid profile email",oidcLoginLabel:e?.oidcLoginLabel||"Sign in with OIDC"}),H(""),(e?.authMode==="oidc"||e?.authMode==="both")&&et(!0),er({outboundProxyEnabled:e?.outboundProxyEnabled===!0,outboundProxyUrl:e?.outboundProxyUrl||"",outboundNoProxy:e?.outboundNoProxy||""}),S(!1)}).catch(e=>{console.error("Failed to fetch settings:",e),S(!1)})},[]),(0,r.useEffect)(()=>{X(`${window.location.origin}/api/auth/oidc/callback`)},[]);let em=async e=>{if(e.preventDefault(),!0===w.outboundProxyEnabled){en(!0),el({type:"",message:""});try{let e=await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({outboundProxyUrl:ea.outboundProxyUrl,outboundNoProxy:ea.outboundNoProxy})}),t=await e.json();e.ok?(C(e=>({...e,...t})),el({type:"success",message:"Proxy settings applied"})):el({type:"error",message:t.error||"Failed to update proxy settings"})}catch(e){el({type:"error",message:"An error occurred"})}finally{en(!1)}}},ex=async()=>{if(!0!==w.outboundProxyEnabled)return;let e=(ea.outboundProxyUrl||"").trim();if(!e)return void el({type:"error",message:"Please enter a Proxy URL to test"});ec(!0),el({type:"",message:""});try{let t=await fetch("/api/settings/proxy-test",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({proxyUrl:e})}),s=await t.json();t.ok&&s?.ok?el({type:"success",message:`Proxy test OK (${s.status}) in ${s.elapsedMs}ms`}):el({type:"error",message:s?.error||"Proxy test failed"})}catch(e){el({type:"error",message:"An error occurred"})}finally{ec(!1)}},ep=async e=>{en(!0),el({type:"",message:""});try{let t=await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({outboundProxyEnabled:e})}),s=await t.json();t.ok?(C(e=>({...e,...s})),er(e=>({...e,outboundProxyEnabled:s?.outboundProxyEnabled===!0})),el({type:"success",message:e?"Proxy enabled":"Proxy disabled"})):el({type:"error",message:s.error||"Failed to update proxy settings"})}catch(e){el({type:"error",message:"An error occurred"})}finally{en(!1)}},eu=async e=>{if(e.preventDefault(),P.new!==P.confirm)return void L({type:"error",message:"Passwords do not match"});F(!0),L({type:"",message:""});try{let e=await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({currentPassword:P.current,newPassword:P.new})}),t=await e.json();e.ok?(L({type:"success",message:"Password updated successfully"}),I({current:"",new:"",confirm:""})):L({type:"error",message:t.error||"Failed to update password"})}catch(e){L({type:"error",message:"An error occurred"})}finally{F(!1)}},eh=async e=>{try{(await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({fallbackStrategy:e})})).ok&&C(t=>({...t,fallbackStrategy:e}))}catch(e){console.error("Failed to update settings:",e)}},eb=async(e,t)=>{try{(await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({[e]:t})})).ok&&C(s=>({...s,[e]:t}))}catch(t){console.error(`Failed to update ${e}:`,t)}},eg=async e=>{try{(await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({comboStrategy:e})})).ok&&C(t=>({...t,comboStrategy:e}))}catch(e){console.error("Failed to update combo strategy:",e)}},ey=async e=>{let t=parseInt(e);if(!isNaN(t)&&!(t<1))try{(await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({stickyRoundRobinLimit:t})})).ok&&C(e=>({...e,stickyRoundRobinLimit:t}))}catch(e){console.error("Failed to update sticky limit:",e)}},ef=async e=>{let t=parseInt(e);if(!isNaN(t)&&!(t<1))try{(await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({comboStickyRoundRobinLimit:t})})).ok&&C(e=>({...e,comboStickyRoundRobinLimit:t}))}catch(e){console.error("Failed to update combo sticky limit:",e)}},ej=async e=>{try{(await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({requireLogin:e})})).ok&&C(t=>({...t,requireLogin:e}))}catch(e){console.error("Failed to update require login:",e)}},eN=(e,t)=>{J(s=>({...s,[e]:t}))},ev=async(e=q.authMode||"password")=>{let t=q.oidcIssuerUrl.trim(),s=q.oidcClientId.trim(),a=q.oidcScopes.trim(),r=q.oidcLoginLabel.trim(),o=_.trim();if("password"!==e&&(!t||!s||!o)&&!w.oidcConfigured)return void K({type:"error",message:"Issuer URL, client ID, and client secret are required to enable OIDC."});z(!0),K({type:"",message:""}),V({type:"",message:""});try{let l={authMode:e,oidcIssuerUrl:t,oidcClientId:s,oidcScopes:a||"openid profile email",oidcLoginLabel:r||"Sign in with OIDC"};o&&(l.oidcClientSecret=o);let i=await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(l)}),n=await i.json();i.ok?(C(e=>({...e,...n})),J({authMode:n?.authMode||e,oidcIssuerUrl:n?.oidcIssuerUrl||t,oidcClientId:n?.oidcClientId||s,oidcScopes:n?.oidcScopes||a||"openid profile email",oidcLoginLabel:n?.oidcLoginLabel||r||"Sign in with OIDC"}),H(""),K({type:"success",message:"oidc"===e?"OIDC login enabled":"both"===e?"Password and OIDC login enabled":"OIDC settings saved"})):K({type:"error",message:n.error||"Failed to save OIDC settings"})}catch(e){K({type:"error",message:"An error occurred"})}finally{z(!1)}},ew=async()=>{let e=q.oidcIssuerUrl.trim(),t=q.oidcClientId.trim(),s=q.oidcScopes.trim(),a=_.trim();if(!e||!t)return void V({type:"error",message:"Issuer URL and client ID are required to test the connection."});Q(!0),K({type:"",message:""}),V({type:"",message:""});try{let r=await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({authMode:q.authMode||w.authMode||"password",oidcIssuerUrl:e,oidcClientId:t,oidcScopes:s||"openid profile email",oidcLoginLabel:q.oidcLoginLabel.trim()||"Sign in with OIDC",...a?{oidcClientSecret:a}:{}})}),o=await r.json().catch(()=>({}));if(!r.ok)return void V({type:"error",message:o.error||"Failed to save OIDC settings before testing"});let l=await fetch("/api/auth/oidc/test",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({issuerUrl:o.oidcIssuerUrl||e,clientId:o.oidcClientId||t,scopes:o.oidcScopes||s||"openid profile email"})}),i=await l.json().catch(()=>({}));if(l.ok&&i?.ok){let e=i.clientSecretTested?!0===i.clientSecretValid?`Connection OK. Discovery loaded from ${i.issuerUrl}. Client secret validated too.`:`Connection OK. Discovery loaded from ${i.issuerUrl}. Client secret was not checked.`:`Connection OK. Discovery loaded from ${i.issuerUrl}.`;V({type:"success",message:e})}else V({type:"error",message:i.error||"OIDC connection test failed"})}catch(e){V({type:"error",message:"An error occurred"})}finally{Q(!1)}},eC=async e=>{try{(await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({enableObservability:e})})).ok&&C(t=>({...t,enableObservability:e}))}catch(e){console.error("Failed to update enableObservability:",e)}},ek=async()=>{try{let e=await fetch("/api/settings");if(!e.ok)return;let t=await e.json();C(t)}catch(e){console.error("Failed to reload settings:",e)}},eS=async e=>{M(!0),U({type:"",message:""});try{let t=await fetch("/api/settings/database",{headers:{"x-9r-password":e}});if(!t.ok){let e=await t.json().catch(()=>({}));throw Error(e.error||"Failed to export database")}let s=await t.json(),a=JSON.stringify(s,null,2),r=new Blob([a],{type:"application/json"}),o=URL.createObjectURL(r),l=document.createElement("a"),i=new Date().toISOString().replace(/[.:]/g,"-");l.href=o,l.download=`krouter-backup-${i}.json`,document.body.appendChild(l),l.click(),document.body.removeChild(l),URL.revokeObjectURL(o),U({type:"success",message:"Database backup downloaded"})}catch(e){U({type:"error",message:e.message||"Failed to export database"})}finally{M(!1)}},eP=async e=>{let t=$.current;if(t){M(!0);try{let s=await t.text(),a=JSON.parse(s),r=await fetch("/api/settings/database",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...a,password:e})}),o=await r.json().catch(()=>({}));if(!r.ok)throw Error(o.error||"Failed to import database");await ek(),U({type:"success",message:"Database imported successfully"})}catch(e){U({type:"error",message:e.message||"Invalid backup file"})}finally{$.current=null,M(!1)}}},eI=async()=>{let{mode:e,password:t}=E;A({open:!1,mode:"",password:""}),"export"===e?await eS(t):"import"===e&&await eP(t)},eO=!0===w.enableObservability,eL=async()=>{v(!0);try{await fetch("/api/version/shutdown",{method:"POST"})}catch(e){}v(!1),j(!1)},eR=async()=>{try{(await fetch("/api/auth/logout",{method:"POST"})).ok&&(e.push("/login"),e.refresh())}catch(e){console.error("Failed to logout:",e)}};return(0,a.jsxs)("div",{className:"max-w-2xl mx-auto px-4 sm:px-0",children:[(0,a.jsxs)("div",{className:"flex flex-col gap-6",children:[(0,a.jsxs)(l.Zp,{children:[(0,a.jsxs)("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-4 mb-4",children:[(0,a.jsxs)("div",{className:"flex items-center gap-3 sm:gap-4",children:[(0,a.jsx)("div",{className:"size-10 sm:size-12 rounded-lg bg-green-500/10 text-green-500 flex items-center justify-center shrink-0",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-xl sm:text-2xl",children:"computer"})}),(0,a.jsxs)("div",{children:[(0,a.jsx)("h2",{className:"text-lg sm:text-xl font-semibold",children:"Local Mode"}),(0,a.jsx)("p",{className:"text-sm text-text-muted",children:"Running on your machine"})]})]}),(0,a.jsx)("div",{className:"inline-flex p-1 rounded-lg bg-black/5 dark:bg-white/5 w-full sm:w-auto",children:["light","dark","system"].map(e=>(0,a.jsxs)("button",{type:"button",onClick:()=>s(e),className:(0,c.cn)("flex items-center justify-center gap-1 sm:gap-1.5 px-2 sm:px-3 py-1.5 rounded-md font-medium transition-all flex-1 sm:flex-initial",t===e?"bg-white dark:bg-white/10 text-text-main shadow-sm":"text-text-muted hover:text-text-main"),children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"light"===e?"light_mode":"dark"===e?"dark_mode":"contrast"}),(0,a.jsx)("span",{className:"capitalize text-xs sm:text-sm",children:e})]},e))})]}),(0,a.jsxs)("div",{className:"flex flex-col gap-3 pt-4 border-t border-border",children:[(0,a.jsx)("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between p-3 rounded-lg bg-bg border border-border gap-2",children:(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"font-medium text-sm sm:text-base",children:"Database Location"}),(0,a.jsx)("p",{className:"text-xs sm:text-sm text-text-muted font-mono break-all",children:"~/.krouter/db/data.sqlite"})]})}),(0,a.jsxs)("div",{className:"flex flex-col sm:flex-row gap-2",children:[(0,a.jsx)(l.$n,{variant:"secondary",icon:"download",onClick:()=>A({open:!0,mode:"export",password:""}),loading:D,className:"w-full sm:w-auto",children:"Download Backup"}),(0,a.jsx)(l.$n,{variant:"outline",icon:"upload",onClick:()=>es.current?.click(),disabled:D,className:"w-full sm:w-auto",children:"Import Backup"}),(0,a.jsx)("input",{ref:es,type:"file",accept:"application/json,.json",className:"hidden",onChange:e=>{let t=e.target.files?.[0];es.current&&(es.current.value=""),t&&($.current=t,U({type:"",message:""}),A({open:!0,mode:"import",password:""}))}})]}),T.message&&(0,a.jsx)("p",{className:`text-sm ${"error"===T.type?"text-red-500":"text-green-600 dark:text-green-400"}`,children:T.message})]})]}),(0,a.jsxs)(l.Zp,{children:[(0,a.jsxs)("div",{className:"flex items-center gap-3 mb-4",children:[(0,a.jsx)("div",{className:"size-10 rounded-lg bg-blue-500/10 text-blue-500 flex items-center justify-center shrink-0",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[20px]",children:"language"})}),(0,a.jsx)("h3",{className:"text-base sm:text-lg font-semibold",children:"Language"})]}),(0,a.jsxs)("button",{onClick:()=>y(!0),className:"flex items-center justify-between w-full p-3 rounded-lg bg-bg border border-border hover:border-primary/50 transition-colors","data-i18n-skip":"true",children:[(0,a.jsx)("span",{className:"text-sm text-text-muted",children:"Display language"}),(0,a.jsx)("span",{className:"text-2xl",children:p.h[h]||"\uD83C\uDF10"})]})]}),(0,a.jsxs)(l.Zp,{children:[(0,a.jsxs)("div",{className:"flex items-center gap-3 mb-4",children:[(0,a.jsx)("div",{className:"p-2 rounded-lg bg-primary/10 text-primary shrink-0",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[20px]",children:"shield"})}),(0,a.jsx)("h3",{className:"text-base sm:text-lg font-semibold",children:"Security"})]}),(0,a.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,a.jsxs)("div",{className:"flex items-start sm:items-center justify-between gap-4",children:[(0,a.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,a.jsx)("p",{className:"font-medium text-sm sm:text-base",children:"Require login"}),(0,a.jsx)("p",{className:"text-xs sm:text-sm text-text-muted",children:"When ON, dashboard requires password. When OFF, access without login."})]}),(0,a.jsx)(l.lM,{checked:!0===w.requireLogin,onChange:()=>ej(!w.requireLogin),disabled:k})]}),!0===w.requireLogin&&(0,a.jsxs)("form",{onSubmit:eu,className:"flex flex-col gap-4 pt-4 border-t border-border/50",children:[w.hasPassword&&(0,a.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,a.jsx)("label",{className:"text-xs sm:text-sm font-medium",children:"Current Password"}),(0,a.jsx)(l.pd,{type:"password",placeholder:"Enter current password",value:P.current,onChange:e=>I({...P,current:e.target.value}),required:!0})]}),(0,a.jsxs)("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[(0,a.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,a.jsx)("label",{className:"text-xs sm:text-sm font-medium",children:"New Password"}),(0,a.jsx)(l.pd,{type:"password",placeholder:"Enter new password",value:P.new,onChange:e=>I({...P,new:e.target.value}),required:!0})]}),(0,a.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,a.jsx)("label",{className:"text-xs sm:text-sm font-medium",children:"Confirm New Password"}),(0,a.jsx)(l.pd,{type:"password",placeholder:"Confirm new password",value:P.confirm,onChange:e=>I({...P,confirm:e.target.value}),required:!0})]})]}),O.message&&(0,a.jsx)("p",{className:`text-xs sm:text-sm ${"error"===O.type?"text-red-500":"text-green-500"}`,children:O.message}),(0,a.jsx)("div",{className:"pt-2",children:(0,a.jsx)(l.$n,{type:"submit",variant:"primary",loading:R,className:"w-full sm:w-auto",children:w.hasPassword?"Update Password":"Set Password"})})]})]})]}),(0,a.jsxs)(l.Zp,{children:[(0,a.jsxs)("button",{type:"button",onClick:()=>et(e=>!e),className:"w-full flex items-center gap-3 text-left",children:[(0,a.jsx)("div",{className:"p-2 rounded-lg bg-indigo-500/10 text-indigo-500 shrink-0",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[20px]",children:"lock_open"})}),(0,a.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,a.jsx)("h3",{className:"text-base sm:text-lg font-semibold",children:"OIDC Dashboard Login"}),(0,a.jsx)("p",{className:"text-xs text-text-muted",children:"oidc"===w.authMode?"OIDC active":"both"===w.authMode?"Password + OIDC active":"Optional SSO via Authentik/Keycloak/Google"})]}),(0,a.jsx)("span",{className:"material-symbols-outlined text-text-muted shrink-0",children:ee?"expand_less":"expand_more"})]}),ee&&(0,a.jsxs)("div",{className:"flex flex-col gap-4 mt-4",children:[(0,a.jsx)("p",{className:"text-xs sm:text-sm text-text-muted",children:"Use Authentik or any OIDC provider to sign in to the dashboard. You can enable password-only, OIDC-only, or both for the dashboard; model API access still uses API keys."}),(0,a.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,a.jsx)("label",{className:"font-medium text-sm sm:text-base",children:"Auth Mode"}),(0,a.jsx)("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-2",children:[{value:"password",title:"Password only",desc:"Keep the legacy password login."},{value:"oidc",title:"OIDC only",desc:"Require OIDC for dashboard access."},{value:"both",title:"Both",desc:"Allow either password or OIDC."}].map(e=>{let t=q.authMode===e.value;return(0,a.jsxs)("button",{type:"button",onClick:()=>eN("authMode",e.value),className:(0,c.cn)("text-left rounded-lg border p-3 transition-colors",t?"border-primary bg-primary/5":"border-border bg-bg hover:bg-black/5 dark:hover:bg-white/5"),disabled:k||W,children:[(0,a.jsx)("p",{className:"font-medium text-sm sm:text-base",children:e.title}),(0,a.jsx)("p",{className:"text-xs sm:text-sm text-text-muted mt-1",children:e.desc})]},e.value)})})]}),(0,a.jsxs)("div",{className:"grid grid-cols-1 gap-4",children:[(0,a.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,a.jsx)("label",{className:"font-medium text-sm sm:text-base",children:"Issuer URL"}),(0,a.jsx)(l.pd,{placeholder:"https://auth.example.com/application/o/krouter/",value:q.oidcIssuerUrl,onChange:e=>eN("oidcIssuerUrl",e.target.value),disabled:k||W})]}),(0,a.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,a.jsx)("label",{className:"font-medium text-sm sm:text-base",children:"Client ID"}),(0,a.jsx)(l.pd,{placeholder:"krouter-dashboard",value:q.oidcClientId,onChange:e=>eN("oidcClientId",e.target.value),disabled:k||W})]}),(0,a.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,a.jsx)("label",{className:"font-medium text-sm sm:text-base",children:"Client Secret"}),(0,a.jsx)(l.pd,{type:"password",placeholder:"Leave blank to keep existing secret",value:_,onChange:e=>H(e.target.value),disabled:k||W}),(0,a.jsx)("p",{className:"text-xs sm:text-sm text-text-muted",children:"This value is write-only after saving."})]}),(0,a.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,a.jsx)("label",{className:"font-medium text-sm sm:text-base",children:"Scopes"}),(0,a.jsx)(l.pd,{placeholder:"openid profile email",value:q.oidcScopes,onChange:e=>eN("oidcScopes",e.target.value),disabled:k||W})]}),(0,a.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,a.jsx)("label",{className:"font-medium text-sm sm:text-base",children:"Login Button Label"}),(0,a.jsx)(l.pd,{placeholder:"Sign in with OIDC",value:q.oidcLoginLabel,onChange:e=>eN("oidcLoginLabel",e.target.value),disabled:k||W})]})]}),(0,a.jsxs)("div",{className:"rounded-lg border border-border bg-bg p-3 text-xs sm:text-sm text-text-muted",children:[(0,a.jsx)("p",{className:"font-medium text-text-main mb-1",children:"Redirect URI"}),(0,a.jsx)("code",{className:"block break-all font-mono",children:Y})]}),(0,a.jsxs)("div",{className:"flex flex-col sm:flex-row gap-2 pt-2 border-t border-border/50",children:[(0,a.jsx)(l.$n,{type:"button",variant:"primary",loading:W,onClick:()=>ev(),className:"w-full sm:w-auto",children:"Save auth mode"}),(0,a.jsx)(l.$n,{type:"button",variant:"outline",loading:B,onClick:ew,className:"w-full sm:w-auto",children:"Test connection"})]}),G.message&&(0,a.jsx)("p",{className:`text-xs sm:text-sm ${"error"===G.type?"text-red-500":"text-green-500"}`,children:G.message}),Z.message&&(0,a.jsx)("p",{className:`text-xs sm:text-sm ${"error"===Z.type?"text-red-500":"text-green-500"}`,children:Z.message}),"oidc"===w.authMode&&(0,a.jsx)("p",{className:"text-xs sm:text-sm text-amber-600 dark:text-amber-400",children:"OIDC login is currently active. Password login is disabled until you switch back."}),"both"===w.authMode&&(0,a.jsx)("p",{className:"text-xs sm:text-sm text-amber-600 dark:text-amber-400",children:"Password and OIDC login are both active."})]})]}),(0,a.jsxs)(l.Zp,{children:[(0,a.jsxs)("div",{className:"flex items-center gap-3 mb-4",children:[(0,a.jsx)("div",{className:"p-2 rounded-lg bg-blue-500/10 text-blue-500 shrink-0",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[20px]",children:"route"})}),(0,a.jsx)("h3",{className:"text-base sm:text-lg font-semibold",children:"Routing Strategy"})]}),(0,a.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,a.jsxs)("div",{className:"flex items-start sm:items-center justify-between gap-4",children:[(0,a.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,a.jsx)("p",{className:"font-medium text-sm sm:text-base",children:"Strategy"}),(0,a.jsx)("p",{className:"text-xs sm:text-sm text-text-muted",children:"How kRouter picks the next available account"})]}),(0,a.jsx)(l.l6,{value:w.fallbackStrategy||"fill-first",onChange:e=>eh(e.target.value),disabled:k,className:"w-44 sm:w-56 shrink-0",options:[{value:"fill-first",label:"Fill First (default)"},{value:"round-robin",label:"Round Robin"},{value:"p2c",label:"P2C (Power of 2 Choices)"},{value:"random",label:"Random"}]})]}),"round-robin"===w.fallbackStrategy&&(0,a.jsxs)("div",{className:"flex items-start sm:items-center justify-between gap-4 pt-2 border-t border-border/50",children:[(0,a.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,a.jsx)("p",{className:"font-medium text-sm sm:text-base",children:"Sticky Limit"}),(0,a.jsx)("p",{className:"text-xs sm:text-sm text-text-muted",children:"Calls per account before switching"})]}),(0,a.jsx)(l.pd,{type:"number",min:"1",max:"10",value:w.stickyRoundRobinLimit||3,onChange:e=>ey(e.target.value),disabled:k,className:"w-16 sm:w-20 text-center shrink-0"})]}),(0,a.jsxs)("div",{className:"flex items-start sm:items-center justify-between gap-4 pt-4 border-t border-border/50",children:[(0,a.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,a.jsx)("p",{className:"font-medium text-sm sm:text-base",children:"Combo Round Robin"}),(0,a.jsx)("p",{className:"text-xs sm:text-sm text-text-muted",children:"Cycle through providers in combos instead of always starting with first"})]}),(0,a.jsx)(l.lM,{checked:"round-robin"===w.comboStrategy,onChange:()=>eg("round-robin"===w.comboStrategy?"fallback":"round-robin"),disabled:k})]}),"round-robin"===w.comboStrategy&&(0,a.jsxs)("div",{className:"flex items-center justify-between pt-2 border-t border-border/50",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"font-medium",children:"Combo Sticky Limit"}),(0,a.jsx)("p",{className:"text-sm text-text-muted",children:"Calls per combo model before switching"})]}),(0,a.jsx)(l.pd,{type:"number",min:"1",max:"100",value:w.comboStickyRoundRobinLimit||1,onChange:e=>ef(e.target.value),disabled:k,className:"w-20 text-center"})]}),(0,a.jsxs)("p",{className:"text-xs text-text-muted italic pt-2 border-t border-border/50",children:["round-robin"===w.fallbackStrategy?`Distributing requests across all available accounts with ${w.stickyRoundRobinLimit||3} calls per account.`:"p2c"===w.fallbackStrategy?"Picking the healthier of 2 random accounts on each request (good for load-balancing equal-tier accounts).":"random"===w.fallbackStrategy?"Picking a uniformly random account on each request.":"Using accounts in priority order (Fill First).","round-robin"===w.comboStrategy?` Combos rotate after ${w.comboStickyRoundRobinLimit||1} call${1===(w.comboStickyRoundRobinLimit||1)?"":"s"} per model.`:" Combos always start with their first model."]})]})]}),(0,a.jsxs)(l.Zp,{children:[(0,a.jsxs)("div",{className:"flex items-center gap-3 mb-4",children:[(0,a.jsx)("div",{className:"p-2 rounded-lg bg-purple-500/10 text-purple-500 shrink-0",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[20px]",children:"psychology"})}),(0,a.jsx)("h3",{className:"text-base sm:text-lg font-semibold",children:"Task-Aware Routing"})]}),(0,a.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,a.jsxs)("div",{className:"flex items-start sm:items-center justify-between gap-4",children:[(0,a.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,a.jsx)("p",{className:"font-medium text-sm sm:text-base",children:"Show intent suggestions in logs"}),(0,a.jsx)("p",{className:"text-xs sm:text-sm text-text-muted",children:"Classify every request as code / math / reasoning / creative / simple (9 languages) and log the suggested combo. Log-only; never overrides your chosen model."})]}),(0,a.jsx)(l.lM,{checked:!1!==w.routingIntelligenceEnabled,onChange:()=>eb("routingIntelligenceEnabled",!1===w.routingIntelligenceEnabled),disabled:k})]}),!1!==w.routingIntelligenceEnabled&&(0,a.jsxs)("p",{className:"text-xs text-text-muted italic pt-2 border-t border-border/50",children:["Active — check the dev console for ",(0,a.jsx)("code",{children:"[ROUTING] intent=X complexity=Y score=N tier=Z"})," lines. Custom intent→combo overrides via ",(0,a.jsx)("code",{children:"taskAwareRouterMap"})," setting (JSON)."]})]})]}),(0,a.jsxs)(l.Zp,{children:[(0,a.jsxs)("div",{className:"flex items-center gap-3 mb-4",children:[(0,a.jsx)("div",{className:"p-2 rounded-lg bg-amber-500/10 text-amber-500 shrink-0",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[20px]",children:"emergency"})}),(0,a.jsx)("h3",{className:"text-base sm:text-lg font-semibold",children:"Emergency Fallback"})]}),(0,a.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,a.jsxs)("div",{className:"flex items-start sm:items-center justify-between gap-4",children:[(0,a.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,a.jsx)("p",{className:"font-medium text-sm sm:text-base",children:"Redirect on budget exhaustion"}),(0,a.jsx)("p",{className:"text-xs sm:text-sm text-text-muted",children:'When an upstream returns 402 or "insufficient funds", transparently re-route the request to a free model so the user still gets a response.'})]}),(0,a.jsx)(l.lM,{checked:!!w.emergencyFallbackEnabled,onChange:()=>eb("emergencyFallbackEnabled",!w.emergencyFallbackEnabled),disabled:k})]}),w.emergencyFallbackEnabled&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("div",{className:"flex items-start sm:items-center justify-between gap-4 pt-3 border-t border-border/50",children:[(0,a.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,a.jsx)("p",{className:"font-medium text-sm sm:text-base",children:"Fallback provider"}),(0,a.jsxs)("p",{className:"text-xs sm:text-sm text-text-muted",children:["Provider ID used for the redirect (e.g. ",(0,a.jsx)("code",{children:"nvidia"}),", ",(0,a.jsx)("code",{children:"openrouter"}),", ",(0,a.jsx)("code",{children:"opencode"}),")"]})]}),(0,a.jsx)(l.pd,{type:"text",value:w.emergencyFallbackProvider||"nvidia",onChange:e=>eb("emergencyFallbackProvider",e.target.value.trim()),disabled:k,className:"w-32 sm:w-44 text-center shrink-0",placeholder:"nvidia"})]}),(0,a.jsxs)("div",{className:"flex items-start sm:items-center justify-between gap-4 pt-3 border-t border-border/50",children:[(0,a.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,a.jsx)("p",{className:"font-medium text-sm sm:text-base",children:"Fallback model"}),(0,a.jsxs)("p",{className:"text-xs sm:text-sm text-text-muted",children:["Model ID at that provider. Default ",(0,a.jsx)("code",{children:"openai/gpt-oss-120b"})," is free on NVIDIA NIM."]})]}),(0,a.jsx)(l.pd,{type:"text",value:w.emergencyFallbackModel||"openai/gpt-oss-120b",onChange:e=>eb("emergencyFallbackModel",e.target.value.trim()),disabled:k,className:"w-40 sm:w-56 text-center shrink-0",placeholder:"openai/gpt-oss-120b"})]}),(0,a.jsxs)("div",{className:"flex items-start sm:items-center justify-between gap-4 pt-3 border-t border-border/50",children:[(0,a.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,a.jsx)("p",{className:"font-medium text-sm sm:text-base",children:"Skip for tool requests"}),(0,a.jsx)("p",{className:"text-xs sm:text-sm text-text-muted",children:"Don't redirect when the request has tools — the free model may not support tool calling."})]}),(0,a.jsx)(l.lM,{checked:!1!==w.emergencyFallbackSkipForTools,onChange:()=>eb("emergencyFallbackSkipForTools",!1===w.emergencyFallbackSkipForTools),disabled:k})]}),(0,a.jsxs)("p",{className:"text-xs text-text-muted italic pt-2 border-t border-border/50",children:["Currently redirecting 402 / budget errors to"," ",(0,a.jsxs)("code",{children:[w.emergencyFallbackProvider||"nvidia","/",w.emergencyFallbackModel||"openai/gpt-oss-120b"]}),"."]})]}),!w.emergencyFallbackEnabled&&(0,a.jsx)("p",{className:"text-xs text-text-muted italic pt-2 border-t border-border/50",children:"Disabled — 402 / budget errors are returned to the user as-is."})]})]}),(0,a.jsxs)(l.Zp,{children:[(0,a.jsxs)("div",{className:"flex items-center gap-3 mb-4",children:[(0,a.jsx)("div",{className:"p-2 rounded-lg bg-cyan-500/10 text-cyan-500 shrink-0",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[20px]",children:"database"})}),(0,a.jsx)("h3",{className:"text-base sm:text-lg font-semibold",children:"Cache Control"})]}),(0,a.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,a.jsxs)("div",{className:"flex items-start sm:items-center justify-between gap-4",children:[(0,a.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,a.jsx)("p",{className:"font-medium text-sm sm:text-base",children:"Mode"}),(0,a.jsxs)("p",{className:"text-xs sm:text-sm text-text-muted",children:["Controls whether kRouter mutates ",(0,a.jsx)("code",{children:"cache_control"})," markers on Claude-shape requests. Anthropic's prompt cache is byte-keyed; any mutation busts the cache."]})]}),(0,a.jsxs)("select",{value:w.cacheControlMode||"auto",onChange:e=>eb("cacheControlMode",e.target.value),disabled:k,className:"w-32 sm:w-44 px-3 py-2 text-sm rounded border border-border bg-bg text-text-main shrink-0",children:[(0,a.jsx)("option",{value:"auto",children:"Auto (recommended)"}),(0,a.jsx)("option",{value:"always",children:"Always preserve"}),(0,a.jsx)("option",{value:"never",children:"Never preserve (legacy)"})]})]}),(0,a.jsxs)("div",{className:"flex items-start sm:items-center justify-between gap-4 pt-3 border-t border-border/50",children:[(0,a.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,a.jsx)("p",{className:"font-medium text-sm sm:text-base",children:"Quick toggle"}),(0,a.jsx)("p",{className:"text-xs sm:text-sm text-text-muted",children:"Got a fresh-turn 429 because your prompt is bigger than your tier's TPM? Click once to switch into legacy trimming, send your first turn, then click again to return to cache-preserve mode."})]}),(0,a.jsx)("button",{type:"button",onClick:()=>eb("cacheControlMode","never"===(w.cacheControlMode||"auto")?"auto":"never"),disabled:k,className:`w-32 sm:w-44 px-3 py-2 text-sm font-medium rounded shrink-0 transition-colors ${"never"===(w.cacheControlMode||"auto")?"bg-amber-500/15 text-amber-600 border border-amber-500/40 hover:bg-amber-500/25":"bg-cyan-500/15 text-cyan-600 border border-cyan-500/40 hover:bg-cyan-500/25"}`,children:"never"===(w.cacheControlMode||"auto")?"Restore cache preserve":"Emergency: trim prompt"})]}),(0,a.jsxs)("p",{className:"text-xs text-text-muted italic pt-2 border-t border-border/50",children:["auto"===(w.cacheControlMode||"auto")&&(0,a.jsxs)(a.Fragment,{children:["Currently ",(0,a.jsx)("strong",{children:"auto"}),": preserves ",(0,a.jsx)("code",{children:"cache_control"})," only on Claude Desktop / Claude Code passthrough (",(0,a.jsx)("code",{children:'clientTool==="claude"'})," & ",(0,a.jsx)("code",{children:'provider==="claude"'}),"). All other paths mutate as before."]}),"always"===w.cacheControlMode&&(0,a.jsxs)(a.Fragment,{children:["Currently ",(0,a.jsx)("strong",{children:"always"}),": preserves ",(0,a.jsx)("code",{children:"cache_control"})," on any Claude-shape target (including ",(0,a.jsx)("code",{children:"anthropic-compatible-*"})," resellers and translated requests). Paranoid mode."]}),"never"===w.cacheControlMode&&(0,a.jsxs)(a.Fragment,{children:["Currently ",(0,a.jsx)("strong",{children:"never"}),": legacy 0.5.31-and-earlier behaviour — always strip and rewrite ",(0,a.jsx)("code",{children:"cache_control"}),". Escape hatch only."]})]})]})]}),(0,a.jsxs)(l.Zp,{children:[(0,a.jsxs)("div",{className:"flex items-center gap-3 mb-4",children:[(0,a.jsx)("div",{className:"p-2 rounded-lg bg-purple-500/10 text-purple-500 shrink-0",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[20px]",children:"wifi"})}),(0,a.jsx)("h3",{className:"text-base sm:text-lg font-semibold",children:"Network"})]}),(0,a.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,a.jsxs)("div",{className:"flex items-start sm:items-center justify-between gap-4",children:[(0,a.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,a.jsx)("p",{className:"font-medium text-sm sm:text-base",children:"Outbound Proxy"}),(0,a.jsx)("p",{className:"text-xs sm:text-sm text-text-muted",children:"Enable proxy for OAuth + provider outbound requests."})]}),(0,a.jsx)(l.lM,{checked:!0===w.outboundProxyEnabled,onChange:()=>ep(!0!==w.outboundProxyEnabled),disabled:k||ei})]}),!0===w.outboundProxyEnabled&&(0,a.jsxs)("form",{onSubmit:em,className:"flex flex-col gap-4 pt-2 border-t border-border/50",children:[(0,a.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,a.jsx)("label",{className:"font-medium text-sm sm:text-base",children:"Proxy URL"}),(0,a.jsx)(l.pd,{placeholder:"http://127.0.0.1:7897",value:ea.outboundProxyUrl,onChange:e=>er(t=>({...t,outboundProxyUrl:e.target.value})),disabled:k||ei}),(0,a.jsx)("p",{className:"text-xs sm:text-sm text-text-muted",children:"Leave empty to inherit existing env proxy (if any)."})]}),(0,a.jsxs)("div",{className:"flex flex-col gap-2 pt-2 border-t border-border/50",children:[(0,a.jsx)("label",{className:"font-medium text-sm sm:text-base",children:"No Proxy"}),(0,a.jsx)(l.pd,{placeholder:"localhost,127.0.0.1",value:ea.outboundNoProxy,onChange:e=>er(t=>({...t,outboundNoProxy:e.target.value})),disabled:k||ei}),(0,a.jsx)("p",{className:"text-xs sm:text-sm text-text-muted",children:"Comma-separated hostnames/domains to bypass the proxy."})]}),(0,a.jsxs)("div",{className:"pt-2 border-t border-border/50 flex flex-col sm:flex-row items-stretch sm:items-center gap-2",children:[(0,a.jsx)(l.$n,{type:"button",variant:"secondary",loading:ed,disabled:k||ei,onClick:ex,className:"w-full sm:w-auto",children:"Test proxy URL"}),(0,a.jsx)(l.$n,{type:"submit",variant:"primary",loading:ei,className:"w-full sm:w-auto",children:"Apply"})]})]}),eo.message&&(0,a.jsx)("p",{className:`text-xs sm:text-sm ${"error"===eo.type?"text-red-500":"text-green-500"} pt-2 border-t border-border/50`,children:eo.message})]})]}),(0,a.jsxs)(l.Zp,{children:[(0,a.jsxs)("div",{className:"flex items-center gap-3 mb-4",children:[(0,a.jsx)("div",{className:"p-2 rounded-lg bg-orange-500/10 text-orange-500 shrink-0",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[20px]",children:"monitoring"})}),(0,a.jsx)("h3",{className:"text-base sm:text-lg font-semibold",children:"Observability"})]}),(0,a.jsxs)("div",{className:"flex items-start sm:items-center justify-between gap-4",children:[(0,a.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,a.jsx)("p",{className:"font-medium text-sm sm:text-base",children:"Enable Observability"}),(0,a.jsx)("p",{className:"text-xs sm:text-sm text-text-muted",children:"Record request details for inspection in the logs view"})]}),(0,a.jsx)(l.lM,{checked:eO,onChange:eC,disabled:k})]})]}),(0,a.jsxs)("div",{className:"flex flex-col sm:flex-row gap-2",children:[(0,a.jsx)(l.$n,{variant:"outline",fullWidth:!0,icon:"power_settings_new",onClick:()=>j(!0),className:"text-red-500 border-red-200 hover:bg-red-50 hover:border-red-300",children:"Shutdown"}),(0,a.jsx)(l.$n,{variant:"outline",fullWidth:!0,icon:"logout",onClick:eR,children:"Logout"})]}),(0,a.jsxs)("div",{className:"text-center text-xs sm:text-sm text-text-muted py-4",children:[(0,a.jsxs)("p",{children:[m.vQ.name," v",m.vQ.version]}),(0,a.jsx)("p",{className:"mt-1",children:"Local Mode - All data stored on your machine"})]})]}),(0,a.jsx)(n.default,{hideTrigger:!0,isOpen:g,onClose:e=>{y(!1),b(e)}}),(0,a.jsx)(i.ConfirmModal,{isOpen:f,onClose:()=>j(!1),onConfirm:eL,title:"Close Proxy",message:"Are you sure you want to close the proxy server?",confirmText:"Close",cancelText:"Cancel",variant:"danger",loading:N}),(0,a.jsxs)(i.default,{isOpen:E.open,onClose:()=>A({open:!1,mode:"",password:""}),title:"Confirm Password",size:"sm",footer:(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(l.$n,{variant:"ghost",onClick:()=>A({open:!1,mode:"",password:""}),disabled:D,children:"Cancel"}),(0,a.jsx)(l.$n,{variant:"primary",onClick:eI,loading:D,disabled:!E.password,children:"Confirm"})]}),children:[(0,a.jsxs)("p",{className:"text-text-muted mb-3 text-sm",children:["Enter your current password to ","export"===E.mode?"export":"import"," the database."]}),(0,a.jsx)(l.pd,{type:"password",value:E.password,onChange:e=>A(t=>({...t,password:e.target.value})),onKeyDown:e=>{"Enter"===e.key&&E.password&&eI()},placeholder:"Current password",autoFocus:!0})]})]})}}},e=>{e.O(0,[7504,1321,5497,8441,3794,7358],()=>e(e.s=38048)),_N_E=e.O()}]);
|
|
@@ -8,4 +8,4 @@ sk-key-only-auto-named`;function k({isOpen:e,provider:t,providerName:s,isCompati
|
|
|
8
8
|
"idToken": "eyJhbGc...",
|
|
9
9
|
"email": "user@example.com"
|
|
10
10
|
}
|
|
11
|
-
]`;function $({isOpen:e,onClose:t,onSuccess:s}){let[l,r]=(0,i.useState)(""),[n,o]=(0,i.useState)(!1),[c,m]=(0,i.useState)(""),[p,u]=(0,i.useState)(null),h=()=>{n||(r(""),m(""),u(null),t())},f=async()=>{var e;let t;m(""),u(null);let a=l.trim();if(!a)return;try{t=JSON.parse(a)}catch(e){m(`${(0,x.Tl)("Invalid JSON")}: ${e.message}`);return}let i=Array.isArray(e=t)?e:e&&"object"==typeof e?Array.isArray(e.accounts)?e.accounts:[e]:null;if(!i||0===i.length)return void m((0,x.Tl)("No accounts found in input"));o(!0);try{let e=await fetch("/api/oauth/codex/bulk-import",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({accounts:i})}),t=await e.json();if(!e.ok)return void m(t?.error||`Request failed: ${e.status}`);u(t),t.success>0&&"function"==typeof s&&s()}catch(e){m(e.message||(0,x.Tl)("Request failed"))}finally{o(!1)}},g=p?.results?.filter(e=>!e.ok)||[];return(0,a.jsx)(d.aF,{isOpen:e,title:(0,x.Tl)("Bulk Add Codex Accounts"),onClose:h,children:(0,a.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,a.jsx)("p",{className:"text-xs text-text-muted",children:(0,x.Tl)("Paste an array of codex account JSON objects. Each must include accessToken (and ideally refreshToken, idToken).")}),(0,a.jsx)("textarea",{className:"w-full rounded border border-accent/30 bg-sidebar p-2 text-sm font-mono resize-y min-h-[240px] focus:outline-none focus:ring-1 focus:ring-primary",placeholder:A,value:l,onChange:e=>r(e.target.value),disabled:n}),c&&(0,a.jsx)("p",{className:"text-xs text-red-500 break-words",children:c}),p&&(0,a.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,a.jsxs)("div",{className:`text-sm font-medium ${p.failed>0?"text-yellow-400":"text-green-400"}`,children:["✓ ",p.success," ",(0,x.Tl)("added"),p.failed>0?`, ✗ ${p.failed} ${(0,x.Tl)("failed")}`:""]}),g.length>0&&(0,a.jsx)("ul",{className:"rounded border border-accent/20 bg-sidebar/50 p-2 text-xs font-mono max-h-40 overflow-y-auto",children:g.map(e=>(0,a.jsxs)("li",{className:"text-red-400",children:["[",e.index,"] ",e.error]},e.index))})]}),(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsx)(d.$n,{onClick:f,fullWidth:!0,disabled:n||!l.trim(),children:n?(0,x.Tl)("Importing..."):(0,x.Tl)("Import All")}),(0,a.jsx)(d.$n,{onClick:h,variant:"ghost",fullWidth:!0,disabled:n,children:(0,x.Tl)("Close")})]})]})})}$.propTypes={isOpen:g().bool.isRequired,onClose:g().func.isRequired,onSuccess:g().func};let T={free:{label:"Free",variant:"success",accent:"green"},freetier:{label:"Free tier",variant:"success",accent:"emerald"},oauth:{label:"OAuth",variant:"primary",accent:"primary"},paid:{label:"API key",variant:"default",accent:"neutral"},webcookie:{label:"Cookie",variant:"warning",accent:"amber"}};function I({capabilities:e,connectionCount:t=0,headerIconPath:s}){let[l,r]=(0,i.useState)(!1);if(!e)return null;let c=T[e.tier]||T.paid,m=e.color?`${e.color}10`:"rgba(148,163,184,0.08)",p=e.color?`${e.color}30`:"rgba(148,163,184,0.20)",x=[];return e.links.apiKey&&x.push({href:e.links.apiKey,icon:"key",label:"Get API key"}),e.links.signup&&!e.links.apiKey&&x.push({href:e.links.signup,icon:"person_add",label:"Sign up"}),e.links.homepage&&x.push({href:e.links.homepage,icon:"language",label:"Homepage"}),e.links.docs&&x.push({href:e.links.docs,icon:"menu_book",label:"Docs"}),e.links.pricing&&x.push({href:e.links.pricing,icon:"sell",label:"Pricing"}),(0,a.jsxs)("div",{className:"flex min-w-0 flex-col gap-4",children:[(0,a.jsxs)(n(),{href:"/dashboard/providers",className:"inline-flex items-center gap-1 text-sm text-text-muted hover:text-primary transition-colors",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-lg",children:"arrow_back"}),"Back to Providers"]}),(0,a.jsxs)("div",{className:"relative overflow-hidden rounded-2xl border p-5 sm:p-7",style:{borderColor:p,background:`linear-gradient(140deg, ${m} 0%, transparent 55%)`},children:[(0,a.jsxs)("div",{className:"flex min-w-0 flex-col gap-5 sm:flex-row sm:items-start sm:justify-between",children:[(0,a.jsxs)("div",{className:"flex min-w-0 items-start gap-4",children:[(0,a.jsx)("div",{className:"flex size-14 shrink-0 items-center justify-center rounded-xl shadow-sm",style:{backgroundColor:e.color?`${e.color}20`:"rgba(148,163,184,0.15)"},children:l||!s?(0,a.jsx)("span",{className:"text-base font-bold",style:{color:e.color||"inherit"},children:e.textIcon||e.id.slice(0,2).toUpperCase()}):(0,a.jsx)(o.default,{src:s,alt:e.name,width:56,height:56,className:"max-h-14 max-w-14 rounded-xl object-contain",sizes:"56px",onError:()=>r(!0)})}),(0,a.jsxs)("div",{className:"min-w-0",children:[(0,a.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,a.jsx)("h1",{className:"truncate text-2xl font-semibold tracking-tight sm:text-3xl",children:e.name}),(0,a.jsx)(d.Ex,{variant:c.variant,size:"sm",children:c.label}),e.deprecated&&(0,a.jsx)(d.Ex,{variant:"warning",size:"sm",children:"deprecated"})]}),(0,a.jsxs)("p",{className:"mt-1 text-sm text-text-muted",children:[t," connection",1===t?"":"s",e.serviceKinds.length>1&&(0,a.jsxs)(a.Fragment,{children:[" \xb7 ",e.serviceKinds.join(" \xb7 ")]})]})]})]}),x.length>0&&(0,a.jsx)("div",{className:"flex flex-wrap gap-1.5 sm:justify-end",children:x.map(e=>(0,a.jsxs)("a",{href:e.href,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1 rounded-full border border-border bg-bg/60 px-2.5 py-1 text-xs text-text-main hover:border-primary hover:text-primary transition-colors backdrop-blur",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-sm",children:e.icon}),e.label]},e.label))})]}),e.notices.body&&!e.deprecated&&(0,a.jsx)("p",{className:"mt-4 max-w-3xl text-sm leading-relaxed text-text-muted",children:e.notices.body})]}),e.deprecated&&e.notices.warning&&(0,a.jsxs)("div",{className:"flex items-start gap-2 rounded-lg border border-yellow-500/30 bg-yellow-500/10 px-3 py-2",children:[(0,a.jsx)("span",{className:"material-symbols-outlined mt-0.5 shrink-0 text-[16px] text-yellow-500",children:"warning"}),(0,a.jsx)("p",{className:"text-xs leading-relaxed text-red-600 dark:text-yellow-400",children:e.notices.warning})]})]})}I.propTypes={capabilities:g().object,connectionCount:g().number,headerIconPath:g().string};let P={oauth:{icon:"lock",label:"Sign in with OAuth",tabLabel:"OAuth"},apikey:{icon:"key",label:"Add API key",tabLabel:"API key"},free:{icon:"bolt",label:"Connect for free",tabLabel:"Free"},cookie:{icon:"cookie",label:"Paste session cookie",tabLabel:"Cookie"},compatible:{icon:"developer_board",label:"Configure endpoint",tabLabel:"Compatible"}};function O({children:e,accentColor:t}){return(0,a.jsx)("div",{className:"rounded-xl border p-5 sm:p-6",style:{borderColor:t?`${t}25`:void 0,background:t?`linear-gradient(160deg, ${t}08, transparent 70%)`:void 0},children:e})}let E={oauth:function({capabilities:e,onOAuth:t,onBulkImport:s}){return(0,a.jsx)(O,{accentColor:e.color,children:(0,a.jsxs)("div",{className:"flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between",children:[(0,a.jsxs)("div",{className:"min-w-0",children:[(0,a.jsxs)("h3",{className:"text-base font-semibold",children:["Sign in with ",e.name]}),(0,a.jsx)("p",{className:"mt-0.5 text-sm text-text-muted",children:"One click. We handle the OAuth callback and store your session locally. You can add multiple accounts."})]}),(0,a.jsxs)("div",{className:"flex flex-wrap gap-2 sm:flex-nowrap",children:[e.features.bulkImport&&s&&(0,a.jsx)(d.$n,{size:"md",icon:"playlist_add",variant:"secondary",onClick:s,children:"Bulk import"}),(0,a.jsxs)(d.$n,{size:"md",icon:"lock",onClick:t,children:["Sign in with ",e.name]})]})]})})},apikey:function({capabilities:e,onApiKey:t}){return(0,a.jsx)(O,{accentColor:e.color,children:(0,a.jsxs)("div",{className:"flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between",children:[(0,a.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,a.jsxs)("h3",{className:"text-base font-semibold",children:["Paste your ",e.name," API key"]}),(0,a.jsxs)("p",{className:"mt-0.5 text-sm text-text-muted",children:[e.links.apiKey?(0,a.jsxs)(a.Fragment,{children:["Grab a key from"," ",(0,a.jsx)("a",{href:e.links.apiKey,target:"_blank",rel:"noopener noreferrer",className:"text-primary underline decoration-primary/40 underline-offset-4 hover:decoration-primary",children:new URL(e.links.apiKey).hostname})," ","and paste it in."]}):(0,a.jsx)(a.Fragment,{children:"Paste your API key to connect."})," ","Stored locally, never sent anywhere except ",e.name,"."]})]}),(0,a.jsx)(d.$n,{size:"md",icon:"key",onClick:t,children:"Add API key"})]})})},free:function({capabilities:e,onFree:t}){return(0,a.jsx)(O,{accentColor:e.color||"#10B981",children:(0,a.jsxs)("div",{className:"flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between",children:[(0,a.jsxs)("div",{className:"min-w-0",children:[(0,a.jsxs)("div",{className:"mb-1 flex items-center gap-2",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[18px] text-green-500",children:"bolt"}),(0,a.jsxs)("h3",{className:"text-base font-semibold",children:[e.name," is free — one click to connect"]})]}),(0,a.jsx)("p",{className:"text-sm text-text-muted",children:"No key, no signup, no card. Just click connect and start using it."})]}),(0,a.jsx)(d.$n,{size:"md",icon:"add",onClick:t,children:"Connect"})]})})},cookie:function({capabilities:e,onCookie:t}){let[s,l]=(0,i.useState)(!1);return(0,a.jsx)(O,{accentColor:e.color||"#F59E0B",children:(0,a.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,a.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,a.jsxs)("div",{className:"min-w-0",children:[(0,a.jsx)("h3",{className:"text-base font-semibold",children:"Advanced: connect with session cookie"}),(0,a.jsxs)("p",{className:"mt-0.5 text-sm text-text-muted",children:["For power users. Extract the ",e.name," cookie from your browser and paste it here."]})]}),(0,a.jsx)("button",{type:"button",onClick:()=>l(e=>!e),className:"text-xs text-text-muted hover:text-primary",children:s?"hide":"show"})]}),s&&(0,a.jsxs)("div",{className:"rounded-lg border border-border bg-bg/70 p-3",children:[(0,a.jsxs)("ol",{className:"mb-3 list-decimal space-y-1 pl-4 text-xs text-text-muted",children:[(0,a.jsxs)("li",{children:["Open ",e.name," in your browser and sign in."]}),(0,a.jsx)("li",{children:"Open DevTools → Application → Cookies."}),(0,a.jsx)("li",{children:"Copy the session cookie value."}),(0,a.jsx)("li",{children:"Paste it in the modal."})]}),(0,a.jsx)(d.$n,{size:"sm",icon:"cookie",onClick:t,children:"Paste cookie"})]})]})})},compatible:function({capabilities:e,onCompatible:t}){return(0,a.jsx)(O,{accentColor:e.color,children:(0,a.jsxs)("div",{className:"flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between",children:[(0,a.jsxs)("div",{className:"min-w-0",children:[(0,a.jsx)("h3",{className:"text-base font-semibold",children:"Use as OpenAI-compatible endpoint"}),(0,a.jsx)("p",{className:"mt-0.5 text-sm text-text-muted",children:"Point at any OpenAI-shaped base URL (self-hosted, LiteLLM, custom proxy). Fetches the live model list after you connect."})]}),(0,a.jsx)(d.$n,{size:"md",icon:"developer_board",onClick:t,children:"Configure endpoint"})]})})}};function R({capabilities:e,onOAuth:t,onApiKey:s,onFree:l,onCookie:r,onCompatible:n,onBulkImport:o}){let d=e?.authModes||[],[c,m]=(0,i.useState)(d[0]||"apikey");if(!e||0===d.length)return null;let p=E[c]||E.apikey,x=d.length>1;return(0,a.jsxs)("div",{className:"flex min-w-0 flex-col gap-3",children:[x&&(0,a.jsx)("div",{className:"flex flex-wrap gap-1 rounded-lg border border-border bg-sidebar/40 p-1",children:d.map(e=>{let t=P[e]||{icon:"add",tabLabel:e},s=e===c;return(0,a.jsxs)("button",{type:"button",onClick:()=>m(e),className:`inline-flex items-center gap-1.5 rounded-md px-3 py-1.5 text-xs font-medium transition-colors ${s?"bg-bg text-text-main shadow-sm":"text-text-muted hover:text-text-main"}`,children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-sm",children:t.icon}),t.tabLabel]},e)})}),(0,a.jsx)(p,{capabilities:e,onOAuth:t,onApiKey:s,onFree:l,onCookie:r,onCompatible:n,onBulkImport:o})]})}function _({providerId:e,models:t=[]}){let[s,l]=(0,i.useState)(""),[r,n]=(0,i.useState)({status:"idle"}),o=(0,i.useCallback)(async()=>{if(e){n(e=>({...e,status:"ok"===e.status?"refreshing":"loading"}));try{let t=new URLSearchParams({providerId:e});s&&t.set("model",s);let a=await fetch(`/api/providers/zenith?${t.toString()}`,{cache:"no-store"}),i=await a.json();i.success?n({status:"ok",winner:i.winner,count:i.count,leaderboard:i.leaderboard}):n({status:"error",error:i.error||"Zenith read failed"})}catch(e){n({status:"error",error:e?.message||"Network error"})}}},[e,s]);if((0,i.useEffect)(()=>{o();let e=setInterval(o,1e4);return()=>clearInterval(e)},[o]),"idle"===r.status||"loading"===r.status||"error"===r.status||!r.winner||(r.count??0)<2)return null;let d=r.winner;return(0,a.jsxs)("div",{className:"mb-3 flex flex-wrap items-center gap-2 rounded-lg border border-primary/20 bg-primary/[0.04] px-3 py-2 text-xs",children:[(0,a.jsxs)("span",{className:"inline-flex items-center gap-1 text-primary font-medium",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-sm",children:"route"}),"Next request →"]}),(0,a.jsx)("span",{className:"font-medium text-text-main",children:d.name}),(0,a.jsxs)("span",{className:"rounded-md border border-primary/30 bg-primary/10 px-1.5 py-0.5 font-mono text-[10px] text-primary",children:["Z:",d.finalScore]}),(0,a.jsxs)("span",{className:"text-text-muted",children:["health ",d.healthScore," \xb7 quota \xd7",d.quotaFactor," \xb7 priority +",d.priorityBonus]}),t.length>0&&(0,a.jsxs)("div",{className:"ml-auto flex items-center gap-1.5",children:[(0,a.jsx)("span",{className:"text-text-muted",children:"Model:"}),(0,a.jsxs)("select",{value:s,onChange:e=>l(e.target.value),className:"rounded-md border border-border bg-bg px-1.5 py-0.5 text-[11px] focus:outline-none focus:border-primary",children:[(0,a.jsx)("option",{value:"",children:"(any)"}),t.map(e=>(0,a.jsx)("option",{value:e.id,children:e.id},e.id))]})]})]})}function D({providerId:e}){let[t,s]=(0,i.useState)(!1),[l,r]=(0,i.useState)([]),[n,o]=(0,i.useState)(!1),d=(0,i.useCallback)(async()=>{if(e){o(!0);try{let t=await fetch(`/api/providers/zenith/log?providerId=${e}&limit=50`,{cache:"no-store"}),s=await t.json();s.success&&r(s.entries||[])}catch{}finally{o(!1)}}},[e]);return(0,i.useEffect)(()=>{if(!t)return;d();let e=setInterval(d,5e3);return()=>clearInterval(e)},[t,d]),(0,a.jsxs)("div",{className:"mt-4 rounded-lg border border-border",children:[(0,a.jsxs)("button",{type:"button",onClick:()=>s(e=>!e),className:"flex w-full items-center justify-between px-3 py-2 text-xs text-text-muted hover:text-text-main",children:[(0,a.jsxs)("span",{className:"inline-flex items-center gap-1.5",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-sm",children:"history"}),"Routing decisions",l.length>0&&(0,a.jsxs)("span",{className:"text-text-muted",children:["(",l.length,")"]})]}),(0,a.jsx)("span",{className:"material-symbols-outlined text-sm",children:t?"expand_less":"expand_more"})]}),t&&(0,a.jsxs)("div",{className:"max-h-64 overflow-y-auto border-t border-border/50 px-3 py-2",children:[n&&0===l.length&&(0,a.jsx)("p",{className:"text-xs text-text-muted",children:"Loading…"}),!n&&0===l.length&&(0,a.jsx)("p",{className:"text-xs text-text-muted",children:"No decisions recorded yet. Fire a request through kRouter to populate."}),(0,a.jsx)("ul",{className:"space-y-1",children:l.map((e,t)=>(0,a.jsxs)("li",{className:"flex flex-wrap items-center gap-2 border-b border-border/30 py-1 text-[11px] font-mono last:border-0",children:[(0,a.jsx)("span",{className:"text-text-muted",children:function(e){let t=Math.floor((Date.now()-e)/1e3);if(t<5)return"just now";if(t<60)return`${t}s ago`;let s=Math.floor(t/60);return s<60?`${s}m ago`:`${Math.floor(s/60)}h ago`}(e.at)}),e.model&&(0,a.jsx)("span",{className:"text-text-main",children:e.model}),(0,a.jsx)("span",{className:"text-text-muted",children:"→"}),(0,a.jsx)("span",{className:"text-text-main",children:e.connectionId.slice(0,8)}),null!=e.score&&(0,a.jsxs)("span",{className:"text-primary",children:["Z:",e.score]}),null!=e.latencyMs&&(0,a.jsxs)("span",{className:"text-text-muted",children:[e.latencyMs,"ms"]}),(0,a.jsx)("span",{className:e.success?"text-green-500":"text-red-500",children:e.success?"✓":"✗"})]},`${e.at}-${t}`))})]})]})}function z(){let e,t=(0,l.useParams)(),s=(0,l.useRouter)(),r=t.id,[u,f]=(0,i.useState)([]),[g,y]=(0,i.useState)(!0),[j,w]=(0,i.useState)(null),[A,T]=(0,i.useState)([]),[P,O]=(0,i.useState)(!1),[E,z]=(0,i.useState)(!1),[U,q]=(0,i.useState)(!1),[M,F]=(0,i.useState)(""),[L,K]=(0,i.useState)(!1),[J,B]=(0,i.useState)(!1),[W,V]=(0,i.useState)(!1),[H,G]=(0,i.useState)(!1),[Q,Z]=(0,i.useState)(null),[Y,X]=(0,i.useState)({}),[ee,et]=(0,i.useState)(!1),[es,ea]=(0,i.useState)({}),[ei,el]=(0,i.useState)(""),[er,en]=(0,i.useState)(new Set),[eo,ed]=(0,i.useState)(!1),[ec,em]=(0,i.useState)(!1),[ep,ex]=(0,i.useState)([]),[eu,eh]=(0,i.useState)("__none__"),[ef,eg]=(0,i.useState)(!1),[eb,ey]=(0,i.useState)(null),[ev,ej]=(0,i.useState)(""),[eN,ew]=(0,i.useState)("auto"),[ek,eC]=(0,i.useState)({enabled:!1,connections:{}}),[eS,eA]=(0,i.useState)([]),[e$,eT]=(0,i.useState)([]),[eI,eP]=(0,i.useState)(!1),[eO,eE]=(0,i.useState)(""),[eR,e_]=(0,i.useState)(new Set),[eD,ez]=(0,i.useState)([]),[eU,eq]=(0,i.useState)([]),[eM,eF]=(0,i.useState)(null),[eL,eK]=(0,i.useState)(!1),[eJ,eB]=(0,i.useState)(!1),[eW,eV]=(0,i.useState)(!1),[eH,eG]=(0,i.useState)(null),[eQ,eZ]=(0,i.useState)({}),[eY,eX]=(0,i.useState)(null),e0=(0,i.useRef)(!1),[e1,e5]=(0,i.useState)(!1),{copied:e2,copy:e4}=(0,p.C)(),e3="ag_risk_confirmed",e6=()=>{O(!0)},e7=()=>{"antigravity"===r&&"true"!==window.localStorage.getItem(e3)?eK(!0):ta?e6():(F(""),q(!0))},e8=()=>{F(""),q(!0)},e9=()=>{ta?e7():e8()},te=j?{id:j.id,name:j.name||("anthropic-compatible"===j.type?"Anthropic Compatible":"OpenAI Compatible"),color:"anthropic-compatible"===j.type?"#D97757":"#10A37F",textIcon:"anthropic-compatible"===j.type?"AC":"OC",apiType:j.apiType,baseUrl:j.baseUrl,type:j.type}:c.zN[r]||c.fg[r]||c.IS[r]||c.nJ[r]||c.br[r],tt=j?null:function(e){let t=c.zN[e]?c.zN:c.fg[e]?c.fg:c.IS[e]?c.IS:c.nJ[e]?c.nJ:c.br[e]?c.br:null;if(!t)return null;let s=t[e],a=t===c.IS&&s?.noAuth?"free":t===c.IS||t===c.zN?"oauth":t===c.br?"cookie":t===c.fg&&s?.noAuth?"free":(t===c.fg||c.nJ,"apikey"),i=Array.isArray(s.authModes)?s.authModes.filter(e=>e!==a):[],l=[a,...i],r=(0,c.mq)(e)||(0,c.gb)(e);r&&!l.includes("compatible")&&l.push("compatible");let n=s.notice||{};return{id:e,name:s.name||e,icon:s.icon,image:s.image,textIcon:s.textIcon,color:s.color,tier:t===c.IS?"free":t===c.nJ?"freetier":t===c.zN?"oauth":t===c.br?"webcookie":s?.noAuth?"free":"paid",authModes:l,links:{homepage:s.website,apiKey:n.apiKeyUrl,signup:n.signupUrl,pricing:s.searchViaChat?.pricingUrl,docs:s.docsUrl},features:{autoPing:"claude"===e&&"oauth"===a,bulkImport:"codex"===e,compatibleModels:r,customModels:!s.passthroughModels,passthroughModels:!!s.passthroughModels,hasRegions:Array.isArray(s.regions)&&s.regions.length>0,hasProviderSpecificData:!!s.hasProviderSpecificData},serviceKinds:s.serviceKinds||["llm"],thinking:s.thinkingConfig||null,notices:{body:n.text,warning:s.deprecationNotice},deprecated:!!s.deprecated,regions:s.regions,defaultRegion:s.defaultRegion,noAuth:!!s.noAuth,_raw:s}}(r),ts=te?.authModes||[],ta=!!c.zN[r]||!!c.IS[r]||ts.includes("oauth"),ti=!!c.fg[r]||ts.includes("apikey"),tl=!!c.IS[r]?.noAuth,tr=(0,m.KC)(r),tn=(0,c.wG)(r),to=(0,c.mq)(r),td=(0,c.gb)(r),tc=to||td,tm=!tc&&ta&&ti,tp="xai"===r?"Grok Build OAuth":"OAuth",tx="xai"===r?"xAI API Key":"API Key";c.Q2[r]?.thinkingConfig||c.s9.extended;let tu=tc?r:tn,th=tc?j?.prefix||r:tn,tf=(0,i.useCallback)(async()=>{try{let e=await fetch(`/api/models/disabled?providerAlias=${encodeURIComponent(tu)}`,{cache:"no-store"}),t=await e.json();e.ok&&eq(t.ids||[])}catch(e){console.log("Error fetching disabled models:",e)}},[tu]),tg=async e=>{try{(await fetch("/api/models/disabled",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({providerAlias:tu,ids:[e]})})).ok&&await tf()}catch(e){console.log("Error disabling model:",e)}},tb=async e=>{try{(await fetch(`/api/models/disabled?providerAlias=${encodeURIComponent(tu)}&id=${encodeURIComponent(e)}`,{method:"DELETE"})).ok&&await tf()}catch(e){console.log("Error enabling model:",e)}},ty=async e=>{e.length&&eF({title:"Disable All Models",message:`Disable all ${e.length} model(s)?`,onConfirm:async()=>{eF(null);try{(await fetch("/api/models/disabled",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({providerAlias:tu,ids:e})})).ok&&await tf()}catch(e){console.log("Error disabling all models:",e)}}})},tv=async()=>{try{(await fetch(`/api/models/disabled?providerAlias=${encodeURIComponent(tu)}`,{method:"DELETE"})).ok&&await tf()}catch(e){console.log("Error enabling all models:",e)}},tj=(0,i.useCallback)(async()=>{try{let e=await fetch("/api/models/alias"),t=await e.json();e.ok&&X(t.aliases||{})}catch(e){console.log("Error fetching aliases:",e)}},[]);(0,i.useEffect)(()=>{"kilocode"===r&&fetch("/api/providers/kilo/free-models").then(e=>e.json()).then(e=>{e.models?.length&&ez(e.models)}).catch(()=>{})},[r]);let tN=(0,i.useCallback)(async()=>{try{let[e,t,s,a]=await Promise.all([fetch("/api/providers",{cache:"no-store"}),fetch("/api/provider-nodes",{cache:"no-store"}),fetch("/api/proxy-pools?isActive=true",{cache:"no-store"}),fetch("/api/settings",{cache:"no-store"})]),i=await e.json(),l=await t.json(),n=await s.json(),o=a.ok?await a.json():{};if(e.ok){let e=(i.connections||[]).filter(e=>e.provider===r);f(e)}s.ok&&T(n.proxyPools||[]);let d=(o.providerStrategies||{})[r]||{};ey(d.fallbackStrategy||null),ej(null!=d.stickyRoundRobinLimit?String(d.stickyRoundRobinLimit):"1");let c=(o.providerThinking||{})[r]||{};ew(c.mode||"auto");let m=o.claudeAutoPing||{};if(eC({enabled:!0===m.enabled,connections:m.connections||{}}),t.ok){let e=(l.nodes||[]).find(e=>e.id===r)||null;if(!e&&tc)for(let t=0;t<3;t+=1){await new Promise(e=>setTimeout(e,150));let t=await fetch("/api/provider-nodes",{cache:"no-store"});if(t.ok&&(e=((await t.json()).nodes||[]).find(e=>e.id===r)||null))break}w(e)}}catch(e){console.log("Error fetching connections:",e)}finally{y(!1)}},[r,tc]),tw=async e=>{try{let t=await fetch(`/api/provider-nodes/${r}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}),s=await t.json();t.ok&&(w(s.node),await tN(),V(!1))}catch(e){console.log("Error updating provider node:",e)}},tk=async(e,t)=>{try{let s=await fetch("/api/settings",{cache:"no-store"}),a=(s.ok?await s.json():{}).providerStrategies||{},i={};e&&(i.fallbackStrategy=e),"round-robin"===e&&""!==t&&(i.stickyRoundRobinLimit=Number(t)||3);let l={...a};0===Object.keys(i).length?delete l[r]:l[r]=i,await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({providerStrategies:l})})}catch(e){console.log("Error saving provider strategy:",e)}},tC=async(e,t)=>{eC({...ek,connections:{...ek.connections,[e]:t}});try{let s=await fetch("/api/settings",{cache:"no-store"}),a=(s.ok?await s.json():{}).claudeAutoPing||{},i={...a,connections:{...a.connections||{},[e]:t}};await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({claudeAutoPing:i})}),eC({enabled:!0===i.enabled,connections:i.connections})}catch(e){console.log("Error saving auto-ping config:",e),eC(ek)}};(0,i.useEffect)(()=>{tN(),tj(),tf()},[tN,tj,tf]);let[tS,tA]=(0,i.useState)({});(0,i.useEffect)(()=>{let e=!1,t=async()=>{try{let t=await fetch("/api/providers/health",{cache:"no-store"});if(!t.ok)return;let s=await t.json();!e&&s?.success&&s.snapshot&&tA(s.snapshot)}catch{}};t();let s=setInterval(t,1e4);return()=>{e=!0,clearInterval(s)}},[]),(0,i.useEffect)(()=>{let e=(c.zN[r]||c.fg[r]||c.IS[r]||c.nJ[r])?.modelsFetcher;e&&h(e).then(eA)},[r]);let t$=(0,i.useCallback)(async()=>{if(0===u.length)return;let e=u.find(e=>!1!==e.isActive)||u[0];if(e){eP(!0);try{let t=null;try{let s=await fetch(`/api/models/live-by-connection?connectionId=${e.id}`),a=s.ok?await s.json():null;a?.success&&a?.models?.length?t={models:a.models}:a?.code==="no_fetcher"&&(t=null)}catch{}if(!t){let s=await fetch(`/api/providers/${e.id}/models`);t=s.ok?await s.json():null}t?.models?.length&&(eT(t.models),e_(e=>{if(e.size>0)return e;let s=t.models[0]?.id||"",a=s.includes("/")?s.split("/")[0]:"other";return new Set([a])}))}catch{}finally{eP(!1)}}},[r,u]);(0,i.useEffect)(()=>{t$()},[t$]);let tT=async(e,t,s=tn)=>{let a=`${s}/${e}`;try{let e=await fetch("/api/models/alias",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({model:a,alias:t})});if(e.ok)await tj();else{let t=await e.json();alert(t.error||"Failed to set alias")}}catch(e){console.log("Error setting alias:",e)}},tI=async e=>{try{(await fetch(`/api/models/alias?alias=${encodeURIComponent(e)}`,{method:"DELETE"})).ok&&await tj()}catch(e){console.log("Error deleting alias:",e)}},tP=async()=>{if(e1)return;let e=u.find(e=>!1!==e.isActive);if(!e)return void alert((0,x.Tl)("Please add an active Qoder connection first"));e5(!0);try{let t=await fetch(`/api/providers/${e.id}/models`),s=await t.json();if(!t.ok)return void alert(s.error||(0,x.Tl)("Failed to fetch models"));let a=s.models||[];if(0===a.length)return void alert((0,x.Tl)("No models returned"));let i=0;for(let e of a){let t=e.id||e.name;if(!t)continue;let s=t.replace(/^qoder\//,""),a=`${tu}/${s}`;!Object.values(Y).includes(a)&&(Y[s]||(await tT(s,s,tu),i+=1))}0===i?alert((0,x.Tl)("All models already exist, no new models added")):alert((0,x.Tl)("Successfully added")+` ${i} `+(0,x.Tl)("models"))}catch(e){console.log("Error importing Qoder models:",e),alert((0,x.Tl)("Error fetching models")+": "+e.message)}finally{e5(!1)}},tO=async()=>{if(eJ||0===u.length)return;let e=Object.fromEntries(u.map(e=>[e.id,{state:"queued",error:null}]));e0.current=!1,eB(!0),eV(!1),eG(null),eZ(e),eX({total:u.length,completed:0,passed:0,failed:0,stopped:!1});let t=0,s=0;try{for(let e=0;e<u.length;e+=1){if(e0.current){eX({total:u.length,completed:e,passed:t,failed:s,stopped:!0});break}let a=u[e];eG(a.id),eZ(e=>({...e,[a.id]:{state:"testing",error:null}}));try{let e=await fetch(`/api/providers/${a.id}/test`,{method:"POST"}),i=await e.json(),l=!!i.valid;l?t+=1:s+=1,eZ(e=>({...e,[a.id]:{state:l?"success":"failed",error:l?null:i.error||null}}))}catch(e){s+=1,eZ(t=>({...t,[a.id]:{state:"failed",error:e.message||"Test failed"}}))}eX({total:u.length,completed:e+1,passed:t,failed:s,stopped:!1}),e<u.length-1&&await new Promise(e=>setTimeout(e,1e3))}}finally{eG(null),eB(!1),eV(!1),e0.current=!1}},tE=async e=>{eF({title:"Delete Connection",message:"Delete this connection?",onConfirm:async()=>{eF(null);try{(await fetch(`/api/providers/${e}`,{method:"DELETE"})).ok&&f(u.filter(t=>t.id!==e))}catch(e){console.log("Error deleting connection:",e)}}})},tR=()=>{tN(),O(!1)},t_=async e=>{F("");try{let t=await fetch("/api/providers",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:r,...e})}),s=null;try{s=await t.json()}catch{s=null}if(t.ok){await tN(),q(!1);return}F(s?.error||"Failed to save connection")}catch(e){console.log("Error saving connection:",e),F("Failed to save connection")}},tD=async e=>{try{(await fetch(`/api/providers/${Q.id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})).ok&&(await tN(),B(!1))}catch(e){console.log("Error updating connection:",e)}},tz=async(e,t)=>{try{(await fetch(`/api/providers/${e}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({isActive:t})})).ok&&f(s=>s.map(s=>s.id===e?{...s,isActive:t}:s))}catch(e){console.log("Error updating connection status:",e)}},tU=async(e,t)=>{let s=[...u];[s[e],s[t]]=[s[t],s[e]],f(s);try{await Promise.all([fetch(`/api/providers/${s[e].id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({priority:e})}),fetch(`/api/providers/${s[t].id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({priority:t})})])}catch(e){console.log("Error swapping priority:",e),await tN()}},tq=u.filter(e=>ep.includes(e.id));u.length>0&&(ep.length,u.length),(0,i.useEffect)(()=>{ex(e=>e.filter(e=>u.some(t=>t.id===e)))},[u]),(()=>{if(0===tq.length)return;let e=new Set(tq.map(e=>e.providerSpecificData?.proxyPoolId||"__none__"));if(1===e.size){let t=[...e][0];if("__none__"===t)return;let s=A.find(e=>e.id===t);return s?.name}})();let tM=()=>{ef||G(!1)},tF=async e=>{eg(!0);try{let t=0;for(let{connectionId:s,proxyPoolId:a}of e)try{(await fetch(`/api/providers/${s}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({proxyPoolId:a})})).ok||(t+=1)}catch(e){console.log("Error applying proxy for",s,e),t+=1}t>0&&alert(`Updated with ${t} failed request(s).`),await tN(),G(!1)}finally{eg(!1)}},tL=e=>tF(u.map(t=>({connectionId:t.id,proxyPoolId:e}))),tK=(0,a.jsx)("div",{className:"flex min-w-0 flex-col divide-y divide-black/[0.03] dark:divide-white/[0.03]",children:u.map((e,t)=>(0,a.jsx)("div",{className:"flex min-w-0 items-stretch",children:(0,a.jsx)("div",{className:"flex-1 min-w-0",children:(0,a.jsx)(N,{connection:e,proxyPools:A,health:tS[e.id],isOAuth:ta,isFirst:0===t,isLast:t===u.length-1,onMoveUp:()=>tU(t,t-1),onMoveDown:()=>tU(t,t+1),onToggleActive:t=>tz(e.id,t),autoPing:"claude"===r&&"oauth"===e.authType?{on:!0===ek.connections[e.id],onToggle:t=>tC(e.id,t)}:null,onUpdateProxy:async t=>{try{(await fetch(`/api/providers/${e.id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({proxyPoolId:t||null})})).ok&&f(s=>s.map(s=>s.id===e.id?{...s,providerSpecificData:{...s.providerSpecificData,proxyPoolId:t||null}}:s))}catch(e){console.log("Error updating proxy:",e)}},onEdit:()=>{Z(e),B(!0)},onDelete:()=>tE(e.id),oneByOneStatus:eQ[e.id]||null})})},e.id))}),tJ=A.filter(e=>!0===e.isActive),tB=(0,a.jsx)(d.aF,{isOpen:H,onClose:tM,title:`Apply Proxy (${u.length} connections)`,children:(0,a.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,a.jsxs)("div",{className:"flex flex-col",children:[(0,a.jsxs)("button",{onClick:()=>{let e=A.filter(e=>!0===e.isActive);return 0===e.length?void alert("No active proxy pools available."):tF(u.map((t,s)=>({connectionId:t.id,proxyPoolId:e[s%e.length].id})))},disabled:ef||0===tJ.length,className:"flex items-center gap-2 rounded-lg px-3 py-2 text-left transition-colors hover:bg-black/[0.04] dark:hover:bg-white/[0.04] disabled:cursor-not-allowed disabled:opacity-50",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[18px]",children:"sync_alt"}),(0,a.jsx)("span",{className:"text-sm text-text-main",children:"One-to-one (rotate)"})]}),(0,a.jsxs)("button",{onClick:()=>tL(null),disabled:ef,className:"flex items-center gap-2 rounded-lg px-3 py-2 text-left transition-colors hover:bg-black/[0.04] dark:hover:bg-white/[0.04] disabled:cursor-not-allowed disabled:opacity-50",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[18px]",children:"link_off"}),(0,a.jsx)("span",{className:"text-sm text-text-main",children:"None (unbind all)"})]}),A.map(e=>(0,a.jsxs)("button",{onClick:()=>tL(e.id),disabled:ef||!0!==e.isActive,className:"flex items-center gap-2 rounded-lg px-3 py-2 text-left transition-colors hover:bg-black/[0.04] dark:hover:bg-white/[0.04] disabled:cursor-not-allowed disabled:opacity-50",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[18px]",children:"lan"}),(0,a.jsx)("span",{className:"truncate text-sm text-text-main",children:e.name}),!0!==e.isActive&&(0,a.jsx)("span",{className:"text-[10px] text-text-muted",children:"(inactive)"})]},e.id))]}),ef&&(0,a.jsx)("p",{className:"text-xs text-text-muted",children:"Applying..."}),(0,a.jsx)(d.$n,{onClick:tM,variant:"ghost",fullWidth:!0,disabled:ef,children:"Cancel"})]})}),tW=async e=>{if(!er.has(e)){en(t=>new Set([...t,e]));try{let t=await fetch("/api/models/test",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({model:`${tu}/${e}`})}),s=await t.json();ea(t=>({...t,[e]:s.ok?"ok":"error"})),s.ok||el(s.error||"Model not reachable")}catch{ea(t=>({...t,[e]:"error"}))}finally{en(t=>{let s=new Set(t);return s.delete(e),s})}}},tV=async e=>{if(eo)return;ed(!0);let t=[];try{for(let s=0;s<e.length;s+=5){let a=e.slice(s,s+5);await Promise.all(a.map(async e=>{en(t=>new Set([...t,e.id]));try{let s=await fetch("/api/models/test",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({model:`${tu}/${e.id}`})}),a=await s.json(),i=a.ok?"ok":"error";ea(t=>({...t,[e.id]:i})),a.ok&&t.push(e)}catch{ea(t=>({...t,[e.id]:"error"}))}finally{en(t=>{let s=new Set(t);return s.delete(e.id),s})}}))}for(let e of t)await tT(e.id,e.id,tu);t.length>0&&document.getElementById("available-models-section")?.scrollIntoView({behavior:"smooth"})}finally{ed(!1)}};if(g)return(0,a.jsxs)("div",{className:"flex flex-col gap-8",children:[(0,a.jsx)(d.Qv,{}),(0,a.jsx)(d.Qv,{})]});if(!te)return(0,a.jsxs)("div",{className:"text-center py-20",children:[(0,a.jsx)("p",{className:"text-text-muted",children:"Provider not found"}),(0,a.jsx)(n(),{href:"/dashboard/providers",className:"text-primary mt-4 inline-block",children:"Back to Providers"})]});let tH=()=>to&&te.apiType?"responses"===te.apiType?"/providers/oai-r.png":"/providers/oai-cc.png":td?"/providers/anthropic-m.png":`/providers/${te.id}.png`;return(0,a.jsxs)("div",{className:"flex min-w-0 flex-col gap-6 px-1 sm:gap-8 sm:px-0",children:[tt?(0,a.jsx)(I,{capabilities:tt,connectionCount:u.length,headerIconPath:ee?null:tH()}):(0,a.jsxs)("div",{className:"min-w-0",children:[(0,a.jsxs)(n(),{href:"/dashboard/providers",className:"inline-flex items-center gap-1 text-sm text-text-muted hover:text-primary transition-colors mb-4",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-lg",children:"arrow_back"}),"Back to Providers"]}),(0,a.jsxs)("div",{className:"flex min-w-0 items-center gap-3 sm:gap-4",children:[(0,a.jsx)("div",{className:"flex size-12 shrink-0 items-center justify-center rounded-lg",style:{backgroundColor:`${te.color}15`},children:ee?(0,a.jsx)("span",{className:"text-sm font-bold",style:{color:te.color},children:te.textIcon||te.id.slice(0,2).toUpperCase()}):(0,a.jsx)(o.default,{src:tH(),alt:te.name,width:48,height:48,className:"max-h-12 max-w-12 rounded-lg object-contain",sizes:"48px",onError:()=>et(!0)})}),(0,a.jsxs)("div",{className:"min-w-0",children:[(0,a.jsx)("h1",{className:"truncate text-2xl font-semibold tracking-tight sm:text-3xl",children:te.name}),(0,a.jsxs)("p",{className:"text-text-muted",children:[u.length," connection",1===u.length?"":"s"]})]})]})]}),tc&&j&&(0,a.jsx)(d.Zp,{children:(0,a.jsxs)("div",{className:"mb-4 flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between",children:[(0,a.jsxs)("div",{className:"min-w-0",children:[(0,a.jsx)("h2",{className:"text-lg font-semibold",children:td?"Anthropic Compatible Details":"OpenAI Compatible Details"}),(0,a.jsxs)("p",{className:"break-all text-sm text-text-muted",children:[td?"Messages API":"responses"===j.apiType?"Responses API":"Chat Completions"," \xb7 ",(j.baseUrl||"").replace(/\/$/,""),"/",td?"messages":"responses"===j.apiType?"responses":"chat/completions"]})]}),(0,a.jsxs)("div",{className:"grid grid-cols-1 gap-2 sm:flex sm:items-center",children:[(0,a.jsx)(d.$n,{size:"sm",icon:"add",onClick:()=>{F(""),q(!0)},className:"w-full sm:w-auto",children:"Add API Key"}),(0,a.jsx)(d.$n,{size:"sm",variant:"secondary",icon:"edit",onClick:()=>V(!0),className:"w-full sm:w-auto",children:"Edit"}),(0,a.jsx)(d.$n,{size:"sm",variant:"secondary",icon:"delete",onClick:async()=>{eF({title:"Delete Compatible Node",message:`Delete this ${td?"Anthropic":"OpenAI"} Compatible node?`,onConfirm:async()=>{eF(null);try{(await fetch(`/api/provider-nodes/${r}`,{method:"DELETE"})).ok&&s.push("/dashboard/providers")}catch(e){console.log("Error deleting provider node:",e)}}})},className:"w-full sm:w-auto",children:"Delete"})]})]})}),tl?(0,a.jsx)(d.gw,{providerId:r}):(0,a.jsxs)(d.Zp,{children:[(0,a.jsxs)("div",{className:"mb-4 flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[(0,a.jsx)("h2",{className:"text-lg font-semibold",children:"Connections"}),(0,a.jsxs)("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:gap-4",children:[u.length>0&&A.length>0&&(0,a.jsx)(d.$n,{size:"sm",variant:"secondary",icon:"lan",onClick:()=>G(!0),children:"Apply Proxy"}),u.length>0&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(d.$n,{size:"sm",variant:"secondary",icon:"sync",onClick:tO,disabled:eJ,children:eJ?"Testing Connection One-by-One...":"Test Connection One-by-One"}),eJ&&(0,a.jsx)(d.$n,{size:"sm",variant:"ghost",icon:"stop",onClick:()=>{eJ&&(e0.current=!0,eV(!0))},disabled:eW,children:eW?"Stopping...":"Stop"})]}),(0,a.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,a.jsx)("span",{className:"text-xs text-text-muted font-medium",children:"Round Robin"}),(0,a.jsx)(d.lM,{checked:"round-robin"===eb,onChange:e=>{let t=e?"round-robin":null,s=e?ev||"1":ev;e&&!ev&&ej("1"),ey(t),tk(t,s)}}),"round-robin"===eb&&(0,a.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,a.jsx)("span",{className:"text-xs text-text-muted",children:"Sticky:"}),(0,a.jsx)("input",{type:"number",min:1,value:ev,onChange:e=>{var t;ej(t=e.target.value),tk("round-robin",t)},placeholder:"1",className:"w-14 px-2 py-1 text-xs border border-border rounded-md bg-background focus:outline-none focus:border-primary"})]})]})]})]}),0===u.length?tt?(0,a.jsx)(R,{capabilities:tt,onOAuth:e7,onApiKey:e8,onFree:e9,onCookie:()=>z(!0),onCompatible:e8,onBulkImport:()=>K(!0)}):(0,a.jsxs)("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[(0,a.jsx)("div",{className:"inline-flex items-center justify-center w-9 h-9 rounded-full bg-primary/10 text-primary shrink-0",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"key"})}),(0,a.jsx)("p",{className:"text-sm text-text-muted",children:"No connections yet"})]}),(0,a.jsx)(d.$n,{size:"sm",icon:"add",onClick:e9,children:"Add API Key"})]}):(0,a.jsxs)(a.Fragment,{children:[eY&&(0,a.jsx)("div",{className:"mb-4 rounded-lg border border-black/10 bg-black/[0.02] px-3 py-2 text-xs text-text-muted dark:border-white/10 dark:bg-white/[0.03]",children:(0,a.jsxs)("div",{className:"flex flex-wrap items-center gap-3",children:[(0,a.jsxs)("span",{children:["Total: ",eY.total]}),(0,a.jsxs)("span",{children:["Completed: ",eY.completed]}),(0,a.jsxs)("span",{children:["Passed: ",eY.passed]}),(0,a.jsxs)("span",{children:["Failed: ",eY.failed]}),eY.stopped&&(0,a.jsx)("span",{className:"text-amber-600 dark:text-amber-400",children:"Stopped"}),eJ&&eH&&(0,a.jsxs)("span",{children:["Running: ",u.find(e=>e.id===eH)?.name||eH]})]})}),!tc&&tt&&(0,a.jsx)(_,{providerId:r,models:e$}),tK,!tc&&tt&&(0,a.jsx)(D,{providerId:r}),!tc&&(0,a.jsxs)("div",{className:"mt-4 grid grid-cols-1 gap-2 sm:flex",children:["iflow"===r&&(0,a.jsx)(d.$n,{size:"sm",icon:"cookie",variant:"secondary",onClick:()=>z(!0),title:"Add connection using browser cookie",className:"w-full sm:w-auto",children:"Cookie"}),"codex"===r&&(0,a.jsx)(d.$n,{size:"sm",icon:"playlist_add",variant:"secondary",onClick:()=>K(!0),title:(0,x.Tl)("Bulk import codex accounts from JSON"),className:"w-full sm:w-auto",children:(0,x.Tl)("Bulk Add")}),tm?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(d.$n,{size:"sm",icon:"lock",variant:"secondary",onClick:e7,className:"w-full sm:w-auto",children:tp}),(0,a.jsx)(d.$n,{size:"sm",icon:"key",onClick:e8,className:"w-full sm:w-auto",children:tx})]}):(0,a.jsx)(d.$n,{size:"sm",icon:"add",onClick:e9,className:"w-full sm:w-auto",children:"Add"})]})]})]}),(0,a.jsxs)(d.Zp,{id:"available-models-section",children:[(0,a.jsxs)("div",{className:"mb-4 flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between",children:[(0,a.jsx)("h2",{className:"text-lg font-semibold",children:"Available Models"}),!tc&&(e=[...tr,...eD.filter(e=>!tr.some(t=>t.id===e.id))].filter(e=>!e.type||"llm"===e.type).map(e=>e.id).filter(e=>!eU.includes(e)),(0,a.jsxs)("div",{className:"flex gap-2",children:[eU.length>0&&(0,a.jsx)(d.$n,{size:"sm",variant:"secondary",icon:"restart_alt",onClick:tv,children:"Active All"}),e.length>0&&(0,a.jsx)(d.$n,{size:"sm",variant:"secondary",icon:"block",onClick:()=>ty(e),children:"Disable All"})]}))]}),!!ei&&(0,a.jsx)("p",{className:"text-xs text-red-500 mb-3 break-words",children:ei}),(()=>{if(tc)return(0,a.jsx)(v,{providerStorageAlias:tu,providerDisplayAlias:th,modelAliases:Y,copied:e2,onCopy:e4,onSetAlias:tT,onDeleteAlias:tI,connections:u,isAnthropic:td});let e=[...tr,...eD.filter(e=>!tr.some(t=>t.id===e.id))].filter(e=>!e.type||"llm"===e.type),t=new Set(eU),s=e.filter(e=>!t.has(e.id)),i=e.filter(e=>t.has(e.id)),l=Object.entries(Y).filter(([e,t])=>{let s=`${tu}/`;if(!t.startsWith(s))return!1;let a=t.slice(s.length);return te.passthroughModels?!tr.some(e=>e.id===a):!tr.some(e=>e.id===a)&&e===a}).map(([e,t])=>({id:t.slice(`${tu}/`.length),alias:e,fullModel:t}));return(0,a.jsxs)("div",{className:"flex flex-wrap gap-3",children:[l.map(e=>(0,a.jsx)(b,{model:{id:e.id},fullModel:`${th}/${e.id}`,alias:e.alias,copied:e2,onCopy:e4,onSetAlias:()=>{},onDeleteAlias:()=>tI(e.alias),testStatus:es[e.id],onTest:u.length>0||tl?()=>tW(e.id):void 0,isTesting:er.has(e.id),isCustom:!0,isFree:!1},e.id)),s.map(e=>{let t=`${tu}/${e.id}`,s=`${r}/${e.id}`,i=Object.entries(Y).find(([,e])=>e===t||e===s)?.[0];return(0,a.jsx)(b,{model:e,fullModel:`${th}/${e.id}`,alias:i,copied:e2,onCopy:e4,onSetAlias:t=>tT(e.id,t,tu),onDeleteAlias:()=>tI(i),testStatus:es[e.id],onTest:u.length>0||tl?()=>tW(e.id):void 0,isTesting:er.has(e.id),isFree:e.isFree,onDisable:()=>tg(e.id)},e.id)}),(0,a.jsxs)("button",{onClick:()=>em(!0),className:"flex w-full items-center justify-center gap-1.5 rounded-lg border border-dashed border-primary/40 px-3 py-2 text-xs text-primary transition-colors hover:border-primary hover:bg-primary/5 sm:w-auto",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-sm",children:"add"}),"Add Model"]}),"qoder"===r&&u.some(e=>!1!==e.isActive)&&(0,a.jsxs)("button",{onClick:tP,disabled:e1,className:"flex w-full items-center justify-center gap-1.5 rounded-lg border border-dashed border-blue-500/40 px-3 py-2 text-xs text-blue-600 dark:text-blue-400 transition-colors hover:border-blue-500 hover:bg-blue-500/5 sm:w-auto disabled:opacity-50 disabled:cursor-not-allowed",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-sm",style:e1?{animation:"spin 1s linear infinite"}:void 0,children:e1?"progress_activity":"download"}),e1?(0,x.Tl)("Fetching..."):(0,x.Tl)("Fetch Qoder Models")]}),(()=>{let e=new Set([...s.map(e=>e.id),...l.map(e=>e.id)]),t=e$.length>0?e$:eS,r=e$.length>0,n=t.filter(t=>t.id&&!e.has(t.id)),o=new Set(e$.map(e=>e.id).filter(Boolean)),d=i.filter(e=>e.id&&!o.has(e.id)).map(e=>({...e,dropped:!0})),c=new Set(d.map(e=>e.id)),m=[...n.filter(e=>!c.has(e.id)),...d];if(!eI&&0===m.length&&0===t.length)return null;let p=eO.trim().toLowerCase(),x=p?m.filter(e=>e.id.toLowerCase().includes(p)||e.name&&e.name.toLowerCase().includes(p)):m,u={};x.forEach(e=>{if(!e.id)return;let t=e.id.includes("/")?e.id.split("/")[0]:"models";u[t]||(u[t]=[]),u[t].push(e)});let h=Object.entries(u).sort((e,t)=>t[1].length-e[1].length),f=x.filter(e=>!e.dropped).slice(0,50);return(0,a.jsxs)("div",{className:"w-full mt-4 space-y-2",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:"text-xs font-medium text-text-muted shrink-0",children:eI?"Loading...":`${r?"From API":"Suggested"} (${n.length})${d.length>0?` \xb7 ${d.length} dropped`:""}`}),(0,a.jsxs)("div",{className:"relative flex-1 min-w-0",children:[(0,a.jsx)("span",{className:"material-symbols-outlined absolute left-2.5 top-1/2 -translate-y-1/2 text-[13px] text-text-muted/60 pointer-events-none select-none",children:"search"}),(0,a.jsx)("input",{type:"text",value:eO,onChange:e=>eE(e.target.value),placeholder:"Search models...",className:"w-full h-7 pl-7 pr-7 text-xs rounded-lg bg-bg border border-border-subtle text-text-main placeholder:text-text-muted/50 focus:outline-none focus:ring-1 focus:ring-primary/30 focus:border-primary/40 transition-colors"}),eO&&(0,a.jsx)("button",{onClick:()=>eE(""),className:"absolute right-2 top-1/2 -translate-y-1/2 text-text-muted/50 hover:text-text-muted transition-colors",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[13px]",children:"close"})})]}),(0,a.jsx)("button",{onClick:t$,disabled:eI,title:"Refresh",className:"shrink-0 h-7 w-7 flex items-center justify-center rounded-lg border border-border-subtle text-text-muted hover:text-primary hover:border-primary/40 hover:bg-primary/5 transition-colors disabled:opacity-40",children:(0,a.jsx)("span",{className:`material-symbols-outlined text-[14px] ${eI?"animate-spin":""}`,children:"refresh"})}),!eI&&f.length>0&&(0,a.jsxs)("button",{onClick:()=>tV(f),disabled:eo,title:`Test up to ${f.length} models and auto-add passing ones`,className:"shrink-0 h-7 flex items-center gap-1 px-2.5 rounded-lg border border-border-subtle text-xs text-text-muted hover:text-green-600 hover:border-green-500/40 hover:bg-green-500/5 transition-colors disabled:opacity-40",children:[(0,a.jsx)("span",{className:`material-symbols-outlined text-[13px] ${eo?"animate-spin":""}`,children:eo?"progress_activity":"play_circle"}),eo?"Testing...":"Test All"]})]}),p&&(0,a.jsxs)("p",{className:"text-xs text-text-muted",children:[x.length," result",1!==x.length?"s":""]}),eI?(0,a.jsxs)("div",{className:"flex items-center gap-2 py-4 text-xs text-text-muted",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[15px] animate-spin",children:"progress_activity"}),"Fetching models from provider API..."]}):0===h.length?p?(0,a.jsxs)("p",{className:"text-xs text-text-muted py-2",children:['No models match "',eO,'"']}):null:(0,a.jsx)("div",{className:"space-y-1",children:h.map(([e,t])=>{let s=eR.has(e),i=t.filter(e=>!e.dropped&&"ok"===es[e.id]).length,l=t.filter(e=>!e.dropped&&"error"===es[e.id]).length,r=t.filter(e=>e.dropped).length;return(0,a.jsxs)("div",{className:"rounded-xl border border-border-subtle overflow-hidden",children:[(0,a.jsxs)("button",{onClick:()=>e_(t=>{let s=new Set(t);return s.has(e)?s.delete(e):s.add(e),s}),className:"w-full flex items-center gap-2 px-3 py-2 text-xs bg-bg hover:bg-surface-2/60 transition-colors text-left",children:[(0,a.jsx)("span",{className:"font-semibold text-text-main flex-1",children:e}),i>0&&(0,a.jsxs)("span",{className:"text-green-600 dark:text-green-400 font-medium",children:[i," ✓"]}),l>0&&(0,a.jsxs)("span",{className:"text-red-500 font-medium",children:[l," ✗"]}),r>0&&(0,a.jsxs)("span",{className:"px-1.5 py-0.5 rounded-md bg-amber-500/10 text-amber-600 dark:text-amber-400 text-[10px] font-medium",children:[r," dropped"]}),(0,a.jsx)("span",{className:"px-1.5 py-0.5 rounded-md bg-black/[0.06] dark:bg-white/[0.06] text-text-muted tabular-nums font-medium",children:t.length}),(0,a.jsx)("span",{className:"material-symbols-outlined text-[15px] text-text-muted/60",children:s?"expand_less":"expand_more"})]}),s&&(0,a.jsx)("div",{className:"px-3 pt-2 pb-3 flex flex-wrap gap-1.5 border-t border-border-subtle bg-surface/50",children:t.map(e=>{let t=e.id.includes("/")?e.id.split("/").slice(1).join("/"):e.id,s=es[e.id],i=er.has(e.id);return e.dropped?(0,a.jsxs)("button",{onClick:async()=>{await tb(e.id),document.getElementById("available-models-section")?.scrollIntoView({behavior:"smooth"})},title:`Recently Dropped — click to restore: ${e.id}`,className:"group flex items-center gap-1 px-2.5 py-1.5 rounded-lg border border-amber-400/40 bg-amber-500/5 text-amber-700 dark:text-amber-400 text-xs hover:bg-amber-500/10 hover:border-amber-400/60 transition-colors",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[12px]",children:"history"}),(0,a.jsx)("span",{children:t}),e.contextLength>0&&(0,a.jsxs)("span",{className:"opacity-50 text-[10px] ml-0.5",children:[(e.contextLength/1e3).toFixed(0),"k"]})]},e.id):(0,a.jsxs)("button",{onClick:async()=>{await tT(e.id,e.id,tu),document.getElementById("available-models-section")?.scrollIntoView({behavior:"smooth"})},title:`Add: ${e.name||e.id}`,className:["group flex items-center gap-1 px-2.5 py-1.5 rounded-lg border text-xs transition-colors","ok"===s?"border-green-500/30 bg-green-500/5 text-green-700 dark:text-green-400 hover:bg-green-500/10":"error"===s?"border-red-400/30 bg-red-500/5 text-red-600 dark:text-red-400 hover:bg-red-500/10":"border-border-subtle text-text-muted hover:text-primary hover:border-primary/40 hover:bg-primary/5"].join(" "),children:[i?(0,a.jsx)("span",{className:"material-symbols-outlined text-[12px] animate-spin",children:"progress_activity"}):"ok"===s?(0,a.jsx)("span",{className:"material-symbols-outlined text-[12px]",children:"check"}):"error"===s?(0,a.jsx)("span",{className:"material-symbols-outlined text-[12px]",children:"close"}):(0,a.jsx)("span",{className:"material-symbols-outlined text-[12px] opacity-50 group-hover:opacity-100",children:"add"}),(0,a.jsx)("span",{children:t}),e.contextLength>0&&(0,a.jsxs)("span",{className:"opacity-40 text-[10px] ml-0.5",children:[(e.contextLength/1e3).toFixed(0),"k"]})]},e.id)})})]},e)})})]})})()]})})()]}),tB,"kiro"===r?(0,a.jsx)(d.Mh,{isOpen:P,providerInfo:te,onSuccess:tR,onClose:()=>O(!1)}):"cursor"===r?(0,a.jsx)(d.G9,{isOpen:P,onSuccess:tR,onClose:()=>O(!1)}):"gitlab"===r?(0,a.jsx)(d.vj,{isOpen:P,providerInfo:te,onSuccess:tR,onClose:()=>O(!1)}):(0,a.jsx)(d.LF,{isOpen:P,provider:r,providerInfo:te,onSuccess:tR,onClose:()=>O(!1)}),"iflow"===r&&(0,a.jsx)(d.vE,{isOpen:E,onSuccess:()=>{tN(),z(!1)},onClose:()=>z(!1)}),(0,a.jsx)(k,{isOpen:U,provider:r,providerName:te.name,isCompatible:tc,isAnthropic:td,authType:te?.authType,authHint:te?.authHint,website:te?.website,proxyPools:A,error:M,onSave:t_,onBulkDone:tN,onClose:()=>{F(""),q(!1)}}),(0,a.jsx)(d.wI,{isOpen:J,connection:Q,proxyPools:A,onSave:tD,onClose:()=>B(!1)}),tc&&(0,a.jsx)(C,{isOpen:W,node:j,onSave:tw,onClose:()=>V(!1),isAnthropic:td}),!tc&&(0,a.jsx)(S,{isOpen:ec,providerAlias:tu,providerDisplayAlias:th,onSave:async e=>{let t=te?.passthroughModels?e.split("/").pop():e;await tT(e,t,tu),em(!1)},onClose:()=>em(!1)}),"codex"===r&&(0,a.jsx)($,{isOpen:L,onClose:()=>K(!1),onSuccess:tN}),(0,a.jsx)(d.uo,{isOpen:eL,onClose:()=>eK(!1),onConfirm:()=>{(window.localStorage.setItem(e3,"true"),eK(!1),ta)?e6():e8()},title:"Risk Notice",message:te?.deprecationNotice,confirmText:"I Understand, Continue",cancelText:"Cancel",variant:"danger"}),(0,a.jsx)(d.uo,{isOpen:!!eM,onClose:()=>eF(null),onConfirm:eM?.onConfirm,title:eM?.title||"Confirm",message:eM?.message,variant:"danger"})]})}R.propTypes={capabilities:g().object,onOAuth:g().func,onApiKey:g().func,onFree:g().func,onCookie:g().func,onCompatible:g().func,onBulkImport:g().func},_.propTypes={providerId:g().string.isRequired,models:g().array},D.propTypes={providerId:g().string.isRequired}},76487:(e,t,s)=>{Promise.resolve().then(s.bind(s,14182))}},e=>{e.O(0,[2574,3862,2649,5772,1321,5497,8441,3794,7358],()=>e(e.s=76487)),_N_E=e.O()}]);
|
|
11
|
+
]`;function $({isOpen:e,onClose:t,onSuccess:s}){let[l,r]=(0,i.useState)(""),[n,o]=(0,i.useState)(!1),[c,m]=(0,i.useState)(""),[p,u]=(0,i.useState)(null),h=()=>{n||(r(""),m(""),u(null),t())},f=async()=>{var e;let t;m(""),u(null);let a=l.trim();if(!a)return;try{t=JSON.parse(a)}catch(e){m(`${(0,x.Tl)("Invalid JSON")}: ${e.message}`);return}let i=Array.isArray(e=t)?e:e&&"object"==typeof e?Array.isArray(e.accounts)?e.accounts:[e]:null;if(!i||0===i.length)return void m((0,x.Tl)("No accounts found in input"));o(!0);try{let e=await fetch("/api/oauth/codex/bulk-import",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({accounts:i})}),t=await e.json();if(!e.ok)return void m(t?.error||`Request failed: ${e.status}`);u(t),t.success>0&&"function"==typeof s&&s()}catch(e){m(e.message||(0,x.Tl)("Request failed"))}finally{o(!1)}},g=p?.results?.filter(e=>!e.ok)||[];return(0,a.jsx)(d.aF,{isOpen:e,title:(0,x.Tl)("Bulk Add Codex Accounts"),onClose:h,children:(0,a.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,a.jsx)("p",{className:"text-xs text-text-muted",children:(0,x.Tl)("Paste an array of codex account JSON objects. Each must include accessToken (and ideally refreshToken, idToken).")}),(0,a.jsx)("textarea",{className:"w-full rounded border border-accent/30 bg-sidebar p-2 text-sm font-mono resize-y min-h-[240px] focus:outline-none focus:ring-1 focus:ring-primary",placeholder:A,value:l,onChange:e=>r(e.target.value),disabled:n}),c&&(0,a.jsx)("p",{className:"text-xs text-red-500 break-words",children:c}),p&&(0,a.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,a.jsxs)("div",{className:`text-sm font-medium ${p.failed>0?"text-yellow-400":"text-green-400"}`,children:["✓ ",p.success," ",(0,x.Tl)("added"),p.failed>0?`, ✗ ${p.failed} ${(0,x.Tl)("failed")}`:""]}),g.length>0&&(0,a.jsx)("ul",{className:"rounded border border-accent/20 bg-sidebar/50 p-2 text-xs font-mono max-h-40 overflow-y-auto",children:g.map(e=>(0,a.jsxs)("li",{className:"text-red-400",children:["[",e.index,"] ",e.error]},e.index))})]}),(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsx)(d.$n,{onClick:f,fullWidth:!0,disabled:n||!l.trim(),children:n?(0,x.Tl)("Importing..."):(0,x.Tl)("Import All")}),(0,a.jsx)(d.$n,{onClick:h,variant:"ghost",fullWidth:!0,disabled:n,children:(0,x.Tl)("Close")})]})]})})}$.propTypes={isOpen:g().bool.isRequired,onClose:g().func.isRequired,onSuccess:g().func};let T={free:{label:"Free",variant:"success",accent:"green"},freetier:{label:"Free tier",variant:"success",accent:"emerald"},oauth:{label:"OAuth",variant:"primary",accent:"primary"},paid:{label:"API key",variant:"default",accent:"neutral"},webcookie:{label:"Cookie",variant:"warning",accent:"amber"}};function I({capabilities:e,connectionCount:t=0,headerIconPath:s}){let[l,r]=(0,i.useState)(!1);if(!e)return null;let c=T[e.tier]||T.paid,m=e.color?`${e.color}10`:"rgba(148,163,184,0.08)",p=e.color?`${e.color}30`:"rgba(148,163,184,0.20)",x=[];return e.links.apiKey&&x.push({href:e.links.apiKey,icon:"key",label:"Get API key"}),e.links.signup&&!e.links.apiKey&&x.push({href:e.links.signup,icon:"person_add",label:"Sign up"}),e.links.homepage&&x.push({href:e.links.homepage,icon:"language",label:"Homepage"}),e.links.docs&&x.push({href:e.links.docs,icon:"menu_book",label:"Docs"}),e.links.pricing&&x.push({href:e.links.pricing,icon:"sell",label:"Pricing"}),(0,a.jsxs)("div",{className:"flex min-w-0 flex-col gap-4",children:[(0,a.jsxs)(n(),{href:"/dashboard/providers",className:"inline-flex items-center gap-1 text-sm text-text-muted hover:text-primary transition-colors",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-lg",children:"arrow_back"}),"Back to Providers"]}),(0,a.jsxs)("div",{className:"relative overflow-hidden rounded-2xl border p-5 sm:p-7",style:{borderColor:p,background:`linear-gradient(140deg, ${m} 0%, transparent 55%)`},children:[(0,a.jsxs)("div",{className:"flex min-w-0 flex-col gap-5 sm:flex-row sm:items-start sm:justify-between",children:[(0,a.jsxs)("div",{className:"flex min-w-0 items-start gap-4",children:[(0,a.jsx)("div",{className:"flex size-14 shrink-0 items-center justify-center rounded-xl shadow-sm",style:{backgroundColor:e.color?`${e.color}20`:"rgba(148,163,184,0.15)"},children:l||!s?(0,a.jsx)("span",{className:"text-base font-bold",style:{color:e.color||"inherit"},children:e.textIcon||e.id.slice(0,2).toUpperCase()}):(0,a.jsx)(o.default,{src:s,alt:e.name,width:56,height:56,className:"max-h-14 max-w-14 rounded-xl object-contain",sizes:"56px",onError:()=>r(!0)})}),(0,a.jsxs)("div",{className:"min-w-0",children:[(0,a.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,a.jsx)("h1",{className:"truncate text-2xl font-semibold tracking-tight sm:text-3xl",children:e.name}),(0,a.jsx)(d.Ex,{variant:c.variant,size:"sm",children:c.label}),e.deprecated&&(0,a.jsx)(d.Ex,{variant:"warning",size:"sm",children:"deprecated"})]}),(0,a.jsxs)("p",{className:"mt-1 text-sm text-text-muted",children:[t," connection",1===t?"":"s",e.serviceKinds.length>1&&(0,a.jsxs)(a.Fragment,{children:[" \xb7 ",e.serviceKinds.join(" \xb7 ")]})]})]})]}),x.length>0&&(0,a.jsx)("div",{className:"flex flex-wrap gap-1.5 sm:justify-end",children:x.map(e=>(0,a.jsxs)("a",{href:e.href,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1 rounded-full border border-border bg-bg/60 px-2.5 py-1 text-xs text-text-main hover:border-primary hover:text-primary transition-colors backdrop-blur",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-sm",children:e.icon}),e.label]},e.label))})]}),e.notices.body&&!e.deprecated&&(0,a.jsx)("p",{className:"mt-4 max-w-3xl text-sm leading-relaxed text-text-muted",children:e.notices.body})]}),e.deprecated&&e.notices.warning&&(0,a.jsxs)("div",{className:"flex items-start gap-2 rounded-lg border border-yellow-500/30 bg-yellow-500/10 px-3 py-2",children:[(0,a.jsx)("span",{className:"material-symbols-outlined mt-0.5 shrink-0 text-[16px] text-yellow-500",children:"warning"}),(0,a.jsx)("p",{className:"text-xs leading-relaxed text-red-600 dark:text-yellow-400",children:e.notices.warning})]})]})}I.propTypes={capabilities:g().object,connectionCount:g().number,headerIconPath:g().string};let P={oauth:{icon:"lock",label:"Sign in with OAuth",tabLabel:"OAuth"},apikey:{icon:"key",label:"Add API key",tabLabel:"API key"},free:{icon:"bolt",label:"Connect for free",tabLabel:"Free"},cookie:{icon:"cookie",label:"Paste session cookie",tabLabel:"Cookie"},compatible:{icon:"developer_board",label:"Configure endpoint",tabLabel:"Compatible"}};function O({children:e,accentColor:t}){return(0,a.jsx)("div",{className:"rounded-xl border p-5 sm:p-6",style:{borderColor:t?`${t}25`:void 0,background:t?`linear-gradient(160deg, ${t}08, transparent 70%)`:void 0},children:e})}let E={oauth:function({capabilities:e,onOAuth:t,onBulkImport:s}){return(0,a.jsx)(O,{accentColor:e.color,children:(0,a.jsxs)("div",{className:"flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between",children:[(0,a.jsxs)("div",{className:"min-w-0",children:[(0,a.jsxs)("h3",{className:"text-base font-semibold",children:["Sign in with ",e.name]}),(0,a.jsx)("p",{className:"mt-0.5 text-sm text-text-muted",children:"One click. We handle the OAuth callback and store your session locally. You can add multiple accounts."})]}),(0,a.jsxs)("div",{className:"flex flex-wrap gap-2 sm:flex-nowrap",children:[e.features.bulkImport&&s&&(0,a.jsx)(d.$n,{size:"md",icon:"playlist_add",variant:"secondary",onClick:s,children:"Bulk import"}),(0,a.jsxs)(d.$n,{size:"md",icon:"lock",onClick:t,children:["Sign in with ",e.name]})]})]})})},apikey:function({capabilities:e,onApiKey:t}){return(0,a.jsx)(O,{accentColor:e.color,children:(0,a.jsxs)("div",{className:"flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between",children:[(0,a.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,a.jsxs)("h3",{className:"text-base font-semibold",children:["Paste your ",e.name," API key"]}),(0,a.jsxs)("p",{className:"mt-0.5 text-sm text-text-muted",children:[e.links.apiKey?(0,a.jsxs)(a.Fragment,{children:["Grab a key from"," ",(0,a.jsx)("a",{href:e.links.apiKey,target:"_blank",rel:"noopener noreferrer",className:"text-primary underline decoration-primary/40 underline-offset-4 hover:decoration-primary",children:new URL(e.links.apiKey).hostname})," ","and paste it in."]}):(0,a.jsx)(a.Fragment,{children:"Paste your API key to connect."})," ","Stored locally, never sent anywhere except ",e.name,"."]})]}),(0,a.jsx)(d.$n,{size:"md",icon:"key",onClick:t,children:"Add API key"})]})})},free:function({capabilities:e,onFree:t}){return(0,a.jsx)(O,{accentColor:e.color||"#10B981",children:(0,a.jsxs)("div",{className:"flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between",children:[(0,a.jsxs)("div",{className:"min-w-0",children:[(0,a.jsxs)("div",{className:"mb-1 flex items-center gap-2",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[18px] text-green-500",children:"bolt"}),(0,a.jsxs)("h3",{className:"text-base font-semibold",children:[e.name," is free — one click to connect"]})]}),(0,a.jsx)("p",{className:"text-sm text-text-muted",children:"No key, no signup, no card. Just click connect and start using it."})]}),(0,a.jsx)(d.$n,{size:"md",icon:"add",onClick:t,children:"Connect"})]})})},cookie:function({capabilities:e,onCookie:t}){let[s,l]=(0,i.useState)(!1);return(0,a.jsx)(O,{accentColor:e.color||"#F59E0B",children:(0,a.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,a.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,a.jsxs)("div",{className:"min-w-0",children:[(0,a.jsx)("h3",{className:"text-base font-semibold",children:"Advanced: connect with session cookie"}),(0,a.jsxs)("p",{className:"mt-0.5 text-sm text-text-muted",children:["For power users. Extract the ",e.name," cookie from your browser and paste it here."]})]}),(0,a.jsx)("button",{type:"button",onClick:()=>l(e=>!e),className:"text-xs text-text-muted hover:text-primary",children:s?"hide":"show"})]}),s&&(0,a.jsxs)("div",{className:"rounded-lg border border-border bg-bg/70 p-3",children:[(0,a.jsxs)("ol",{className:"mb-3 list-decimal space-y-1 pl-4 text-xs text-text-muted",children:[(0,a.jsxs)("li",{children:["Open ",e.name," in your browser and sign in."]}),(0,a.jsx)("li",{children:"Open DevTools → Application → Cookies."}),(0,a.jsx)("li",{children:"Copy the session cookie value."}),(0,a.jsx)("li",{children:"Paste it in the modal."})]}),(0,a.jsx)(d.$n,{size:"sm",icon:"cookie",onClick:t,children:"Paste cookie"})]})]})})},compatible:function({capabilities:e,onCompatible:t}){return(0,a.jsx)(O,{accentColor:e.color,children:(0,a.jsxs)("div",{className:"flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between",children:[(0,a.jsxs)("div",{className:"min-w-0",children:[(0,a.jsx)("h3",{className:"text-base font-semibold",children:"Use as OpenAI-compatible endpoint"}),(0,a.jsx)("p",{className:"mt-0.5 text-sm text-text-muted",children:"Point at any OpenAI-shaped base URL (self-hosted, LiteLLM, custom proxy). Fetches the live model list after you connect."})]}),(0,a.jsx)(d.$n,{size:"md",icon:"developer_board",onClick:t,children:"Configure endpoint"})]})})}};function R({capabilities:e,onOAuth:t,onApiKey:s,onFree:l,onCookie:r,onCompatible:n,onBulkImport:o}){let d=e?.authModes||[],[c,m]=(0,i.useState)(d[0]||"apikey");if(!e||0===d.length)return null;let p=E[c]||E.apikey,x=d.length>1;return(0,a.jsxs)("div",{className:"flex min-w-0 flex-col gap-3",children:[x&&(0,a.jsx)("div",{className:"flex flex-wrap gap-1 rounded-lg border border-border bg-sidebar/40 p-1",children:d.map(e=>{let t=P[e]||{icon:"add",tabLabel:e},s=e===c;return(0,a.jsxs)("button",{type:"button",onClick:()=>m(e),className:`inline-flex items-center gap-1.5 rounded-md px-3 py-1.5 text-xs font-medium transition-colors ${s?"bg-bg text-text-main shadow-sm":"text-text-muted hover:text-text-main"}`,children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-sm",children:t.icon}),t.tabLabel]},e)})}),(0,a.jsx)(p,{capabilities:e,onOAuth:t,onApiKey:s,onFree:l,onCookie:r,onCompatible:n,onBulkImport:o})]})}function _({providerId:e,models:t=[]}){let[s,l]=(0,i.useState)(""),[r,n]=(0,i.useState)({status:"idle"}),o=(0,i.useCallback)(async()=>{if(e){n(e=>({...e,status:"ok"===e.status?"refreshing":"loading"}));try{let t=new URLSearchParams({providerId:e});s&&t.set("model",s);let a=await fetch(`/api/providers/zenith?${t.toString()}`,{cache:"no-store"}),i=await a.json();i.success?n({status:"ok",winner:i.winner,count:i.count,leaderboard:i.leaderboard}):n({status:"error",error:i.error||"Zenith read failed"})}catch(e){n({status:"error",error:e?.message||"Network error"})}}},[e,s]);if((0,i.useEffect)(()=>{o();let e=setInterval(o,1e4);return()=>clearInterval(e)},[o]),"idle"===r.status||"loading"===r.status||"error"===r.status||!r.winner||(r.count??0)<2)return null;let d=r.winner;return(0,a.jsxs)("div",{className:"mb-3 flex flex-wrap items-center gap-2 rounded-lg border border-primary/20 bg-primary/[0.04] px-3 py-2 text-xs",children:[(0,a.jsxs)("span",{className:"inline-flex items-center gap-1 text-primary font-medium",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-sm",children:"route"}),"Next request →"]}),(0,a.jsx)("span",{className:"font-medium text-text-main",children:d.name}),(0,a.jsxs)("span",{className:"rounded-md border border-primary/30 bg-primary/10 px-1.5 py-0.5 font-mono text-[10px] text-primary",children:["Z:",d.finalScore]}),(0,a.jsxs)("span",{className:"text-text-muted",children:["health ",d.healthScore," \xb7 quota \xd7",d.quotaFactor," \xb7 priority +",d.priorityBonus]}),t.length>0&&(0,a.jsxs)("div",{className:"ml-auto flex items-center gap-1.5",children:[(0,a.jsx)("span",{className:"text-text-muted",children:"Model:"}),(0,a.jsxs)("select",{value:s,onChange:e=>l(e.target.value),className:"rounded-md border border-border bg-bg px-1.5 py-0.5 text-[11px] focus:outline-none focus:border-primary",children:[(0,a.jsx)("option",{value:"",children:"(any)"}),t.map(e=>(0,a.jsx)("option",{value:e.id,children:e.id},e.id))]})]})]})}function D({providerId:e}){let[t,s]=(0,i.useState)(!1),[l,r]=(0,i.useState)([]),[n,o]=(0,i.useState)(!1),d=(0,i.useCallback)(async()=>{if(e){o(!0);try{let t=await fetch(`/api/providers/zenith/log?providerId=${e}&limit=50`,{cache:"no-store"}),s=await t.json();s.success&&r(s.entries||[])}catch{}finally{o(!1)}}},[e]);return(0,i.useEffect)(()=>{if(!t)return;d();let e=setInterval(d,5e3);return()=>clearInterval(e)},[t,d]),(0,a.jsxs)("div",{className:"mt-4 rounded-lg border border-border",children:[(0,a.jsxs)("button",{type:"button",onClick:()=>s(e=>!e),className:"flex w-full items-center justify-between px-3 py-2 text-xs text-text-muted hover:text-text-main",children:[(0,a.jsxs)("span",{className:"inline-flex items-center gap-1.5",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-sm",children:"history"}),"Routing decisions",l.length>0&&(0,a.jsxs)("span",{className:"text-text-muted",children:["(",l.length,")"]})]}),(0,a.jsx)("span",{className:"material-symbols-outlined text-sm",children:t?"expand_less":"expand_more"})]}),t&&(0,a.jsxs)("div",{className:"max-h-64 overflow-y-auto border-t border-border/50 px-3 py-2",children:[n&&0===l.length&&(0,a.jsx)("p",{className:"text-xs text-text-muted",children:"Loading…"}),!n&&0===l.length&&(0,a.jsx)("p",{className:"text-xs text-text-muted",children:"No decisions recorded yet. Fire a request through kRouter to populate."}),(0,a.jsx)("ul",{className:"space-y-1",children:l.map((e,t)=>(0,a.jsxs)("li",{className:"flex flex-wrap items-center gap-2 border-b border-border/30 py-1 text-[11px] font-mono last:border-0",children:[(0,a.jsx)("span",{className:"text-text-muted",children:function(e){let t=Math.floor((Date.now()-e)/1e3);if(t<5)return"just now";if(t<60)return`${t}s ago`;let s=Math.floor(t/60);return s<60?`${s}m ago`:`${Math.floor(s/60)}h ago`}(e.at)}),e.model&&(0,a.jsx)("span",{className:"text-text-main",children:e.model}),(0,a.jsx)("span",{className:"text-text-muted",children:"→"}),(0,a.jsx)("span",{className:"text-text-main",children:e.connectionId.slice(0,8)}),null!=e.score&&(0,a.jsxs)("span",{className:"text-primary",children:["Z:",e.score]}),null!=e.latencyMs&&(0,a.jsxs)("span",{className:"text-text-muted",children:[e.latencyMs,"ms"]}),(0,a.jsx)("span",{className:e.success?"text-green-500":"text-red-500",children:e.success?"✓":"✗"})]},`${e.at}-${t}`))})]})]})}function z(){let e,t=(0,l.useParams)(),s=(0,l.useRouter)(),r=t.id,[u,f]=(0,i.useState)([]),[g,y]=(0,i.useState)(!0),[j,w]=(0,i.useState)(null),[A,T]=(0,i.useState)([]),[P,O]=(0,i.useState)(!1),[E,z]=(0,i.useState)(!1),[U,q]=(0,i.useState)(!1),[M,F]=(0,i.useState)(""),[L,K]=(0,i.useState)(!1),[J,B]=(0,i.useState)(!1),[W,V]=(0,i.useState)(!1),[H,G]=(0,i.useState)(!1),[Q,Z]=(0,i.useState)(null),[Y,X]=(0,i.useState)({}),[ee,et]=(0,i.useState)(!1),[es,ea]=(0,i.useState)({}),[ei,el]=(0,i.useState)(""),[er,en]=(0,i.useState)(new Set),[eo,ed]=(0,i.useState)(!1),[ec,em]=(0,i.useState)(!1),[ep,ex]=(0,i.useState)([]),[eu,eh]=(0,i.useState)("__none__"),[ef,eg]=(0,i.useState)(!1),[eb,ey]=(0,i.useState)(null),[ev,ej]=(0,i.useState)(""),[eN,ew]=(0,i.useState)("auto"),[ek,eC]=(0,i.useState)({enabled:!1,connections:{}}),[eS,eA]=(0,i.useState)([]),[e$,eT]=(0,i.useState)([]),[eI,eP]=(0,i.useState)(!1),[eO,eE]=(0,i.useState)(""),[eR,e_]=(0,i.useState)(new Set),[eD,ez]=(0,i.useState)([]),[eU,eq]=(0,i.useState)([]),[eM,eF]=(0,i.useState)(null),[eL,eK]=(0,i.useState)(!1),[eJ,eB]=(0,i.useState)(!1),[eW,eV]=(0,i.useState)(!1),[eH,eG]=(0,i.useState)(null),[eQ,eZ]=(0,i.useState)({}),[eY,eX]=(0,i.useState)(null),e0=(0,i.useRef)(!1),[e1,e5]=(0,i.useState)(!1),{copied:e2,copy:e4}=(0,p.C)(),e3="ag_risk_confirmed",e6=()=>{O(!0)},e7=()=>{"antigravity"===r&&"true"!==window.localStorage.getItem(e3)?eK(!0):ta?e6():(F(""),q(!0))},e8=()=>{F(""),q(!0)},e9=()=>{ta?e7():e8()},te=j?{id:j.id,name:j.name||("anthropic-compatible"===j.type?"Anthropic Compatible":"OpenAI Compatible"),color:"anthropic-compatible"===j.type?"#D97757":"#10A37F",textIcon:"anthropic-compatible"===j.type?"AC":"OC",apiType:j.apiType,baseUrl:j.baseUrl,type:j.type}:c.zN[r]||c.fg[r]||c.IS[r]||c.nJ[r]||c.br[r],tt=j?null:function(e){let t=c.zN[e]?c.zN:c.fg[e]?c.fg:c.IS[e]?c.IS:c.nJ[e]?c.nJ:c.br[e]?c.br:null;if(!t)return null;let s=t[e],a=t===c.IS&&s?.noAuth?"free":t===c.IS||t===c.zN?"oauth":t===c.br?"cookie":t===c.fg&&s?.noAuth?"free":(t===c.fg||c.nJ,"apikey"),i=Array.isArray(s.authModes)?s.authModes.filter(e=>e!==a):[],l=[a,...i],r=(0,c.mq)(e)||(0,c.gb)(e);r&&!l.includes("compatible")&&l.push("compatible");let n=s.notice||{};return{id:e,name:s.name||e,icon:s.icon,image:s.image,textIcon:s.textIcon,color:s.color,tier:t===c.IS?"free":t===c.nJ?"freetier":t===c.zN?"oauth":t===c.br?"webcookie":s?.noAuth?"free":"paid",authModes:l,links:{homepage:s.website,apiKey:n.apiKeyUrl,signup:n.signupUrl,pricing:s.searchViaChat?.pricingUrl,docs:s.docsUrl},features:{autoPing:"claude"===e&&"oauth"===a,bulkImport:"codex"===e,compatibleModels:r,customModels:!s.passthroughModels,passthroughModels:!!s.passthroughModels,hasRegions:Array.isArray(s.regions)&&s.regions.length>0,hasProviderSpecificData:!!s.hasProviderSpecificData},serviceKinds:s.serviceKinds||["llm"],thinking:s.thinkingConfig||null,notices:{body:n.text,warning:s.deprecationNotice},deprecated:!!s.deprecated,regions:s.regions,defaultRegion:s.defaultRegion,noAuth:!!s.noAuth,_raw:s}}(r),ts=te?.authModes||[],ta=!!c.zN[r]||!!c.IS[r]||ts.includes("oauth"),ti=!!c.fg[r]||ts.includes("apikey"),tl=!!c.IS[r]?.noAuth,tr=(0,m.KC)(r),tn=(0,c.wG)(r),to=(0,c.mq)(r),td=(0,c.gb)(r),tc=to||td,tm=!tc&&ta&&ti,tp="xai"===r?"Grok Build OAuth":"OAuth",tx="xai"===r?"xAI API Key":"API Key";c.Q2[r]?.thinkingConfig||c.s9.extended;let tu=tc?r:tn,th=tc?j?.prefix||r:tn,tf=(0,i.useCallback)(async()=>{try{let e=await fetch(`/api/models/disabled?providerAlias=${encodeURIComponent(tu)}`,{cache:"no-store"}),t=await e.json();e.ok&&eq(t.ids||[])}catch(e){console.log("Error fetching disabled models:",e)}},[tu]),tg=async e=>{try{(await fetch("/api/models/disabled",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({providerAlias:tu,ids:[e]})})).ok&&await tf()}catch(e){console.log("Error disabling model:",e)}},tb=async e=>{try{(await fetch(`/api/models/disabled?providerAlias=${encodeURIComponent(tu)}&id=${encodeURIComponent(e)}`,{method:"DELETE"})).ok&&await tf()}catch(e){console.log("Error enabling model:",e)}},ty=async e=>{e.length&&eF({title:"Disable All Models",message:`Disable all ${e.length} model(s)?`,onConfirm:async()=>{eF(null);try{(await fetch("/api/models/disabled",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({providerAlias:tu,ids:e})})).ok&&await tf()}catch(e){console.log("Error disabling all models:",e)}}})},tv=async()=>{try{(await fetch(`/api/models/disabled?providerAlias=${encodeURIComponent(tu)}`,{method:"DELETE"})).ok&&await tf()}catch(e){console.log("Error enabling all models:",e)}},tj=(0,i.useCallback)(async()=>{try{let e=await fetch("/api/models/alias"),t=await e.json();e.ok&&X(t.aliases||{})}catch(e){console.log("Error fetching aliases:",e)}},[]);(0,i.useEffect)(()=>{"kilocode"===r&&fetch("/api/providers/kilo/free-models").then(e=>e.json()).then(e=>{e.models?.length&&ez(e.models)}).catch(()=>{})},[r]);let tN=(0,i.useCallback)(async()=>{try{let[e,t,s,a]=await Promise.all([fetch("/api/providers",{cache:"no-store"}),fetch("/api/provider-nodes",{cache:"no-store"}),fetch("/api/proxy-pools?isActive=true",{cache:"no-store"}),fetch("/api/settings",{cache:"no-store"})]),i=await e.json(),l=await t.json(),n=await s.json(),o=a.ok?await a.json():{};if(e.ok){let e=(i.connections||[]).filter(e=>e.provider===r);f(e)}s.ok&&T(n.proxyPools||[]);let d=(o.providerStrategies||{})[r]||{};ey(d.fallbackStrategy||null),ej(null!=d.stickyRoundRobinLimit?String(d.stickyRoundRobinLimit):"1");let c=(o.providerThinking||{})[r]||{};ew(c.mode||"auto");let m=o.claudeAutoPing||{};if(eC({enabled:!0===m.enabled,connections:m.connections||{}}),t.ok){let e=(l.nodes||[]).find(e=>e.id===r)||null;if(!e&&tc)for(let t=0;t<3;t+=1){await new Promise(e=>setTimeout(e,150));let t=await fetch("/api/provider-nodes",{cache:"no-store"});if(t.ok&&(e=((await t.json()).nodes||[]).find(e=>e.id===r)||null))break}w(e)}}catch(e){console.log("Error fetching connections:",e)}finally{y(!1)}},[r,tc]),tw=async e=>{try{let t=await fetch(`/api/provider-nodes/${r}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}),s=await t.json();t.ok&&(w(s.node),await tN(),V(!1))}catch(e){console.log("Error updating provider node:",e)}},tk=async(e,t)=>{try{let s=await fetch("/api/settings",{cache:"no-store"}),a=(s.ok?await s.json():{}).providerStrategies||{},i={};e&&(i.fallbackStrategy=e),"round-robin"===e&&""!==t&&(i.stickyRoundRobinLimit=Number(t)||3);let l={...a};0===Object.keys(i).length?delete l[r]:l[r]=i,await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({providerStrategies:l})})}catch(e){console.log("Error saving provider strategy:",e)}},tC=async(e,t)=>{eC({...ek,connections:{...ek.connections,[e]:t}});try{let s=await fetch("/api/settings",{cache:"no-store"}),a=(s.ok?await s.json():{}).claudeAutoPing||{},i={...a,connections:{...a.connections||{},[e]:t}};await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({claudeAutoPing:i})}),eC({enabled:!0===i.enabled,connections:i.connections})}catch(e){console.log("Error saving auto-ping config:",e),eC(ek)}};(0,i.useEffect)(()=>{tN(),tj(),tf()},[tN,tj,tf]);let[tS,tA]=(0,i.useState)({});(0,i.useEffect)(()=>{let e=!1,t=async()=>{try{let t=await fetch("/api/providers/health",{cache:"no-store"});if(!t.ok)return;let s=await t.json();!e&&s?.success&&s.snapshot&&tA(s.snapshot)}catch{}};t();let s=setInterval(t,1e4);return()=>{e=!0,clearInterval(s)}},[]),(0,i.useEffect)(()=>{let e=(c.zN[r]||c.fg[r]||c.IS[r]||c.nJ[r])?.modelsFetcher;e&&h(e).then(eA)},[r]);let t$=(0,i.useCallback)(async()=>{if(0===u.length)return;let e=u.find(e=>!1!==e.isActive)||u[0];if(e){eP(!0);try{let t=null;try{let s=await fetch(`/api/models/live-by-connection?connectionId=${e.id}`),a=s.ok?await s.json():null;a?.success&&a?.models?.length?t={models:a.models}:a?.code==="no_fetcher"&&(t=null)}catch{}if(!t){let s=await fetch(`/api/providers/${e.id}/models`);t=s.ok?await s.json():null}t?.models?.length&&(eT(t.models),e_(e=>{if(e.size>0)return e;let s=t.models[0]?.id||"",a=s.includes("/")?s.split("/")[0]:"other";return new Set([a])}))}catch{}finally{eP(!1)}}},[r,u]);(0,i.useEffect)(()=>{t$()},[t$]);let tT=async(e,t,s=tn)=>{let a=`${s}/${e}`;try{let e=await fetch("/api/models/alias",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({model:a,alias:t})});if(e.ok)await tj();else{let t=await e.json();alert(t.error||"Failed to set alias")}}catch(e){console.log("Error setting alias:",e)}},tI=async e=>{try{(await fetch(`/api/models/alias?alias=${encodeURIComponent(e)}`,{method:"DELETE"})).ok&&await tj()}catch(e){console.log("Error deleting alias:",e)}},tP=async()=>{if(e1)return;let e=u.find(e=>!1!==e.isActive);if(!e)return void alert((0,x.Tl)("Please add an active Qoder connection first"));e5(!0);try{let t=await fetch(`/api/providers/${e.id}/models`),s=await t.json();if(!t.ok)return void alert(s.error||(0,x.Tl)("Failed to fetch models"));let a=s.models||[];if(0===a.length)return void alert((0,x.Tl)("No models returned"));let i=0;for(let e of a){let t=e.id||e.name;if(!t)continue;let s=t.replace(/^qoder\//,""),a=`${tu}/${s}`;!Object.values(Y).includes(a)&&(Y[s]||(await tT(s,s,tu),i+=1))}0===i?alert((0,x.Tl)("All models already exist, no new models added")):alert((0,x.Tl)("Successfully added")+` ${i} `+(0,x.Tl)("models"))}catch(e){console.log("Error importing Qoder models:",e),alert((0,x.Tl)("Error fetching models")+": "+e.message)}finally{e5(!1)}},tO=async()=>{if(eJ||0===u.length)return;let e=Object.fromEntries(u.map(e=>[e.id,{state:"queued",error:null}]));e0.current=!1,eB(!0),eV(!1),eG(null),eZ(e),eX({total:u.length,completed:0,passed:0,failed:0,stopped:!1});let t=0,s=0;try{for(let e=0;e<u.length;e+=1){if(e0.current){eX({total:u.length,completed:e,passed:t,failed:s,stopped:!0});break}let a=u[e];eG(a.id),eZ(e=>({...e,[a.id]:{state:"testing",error:null}}));try{let e=await fetch(`/api/providers/${a.id}/test`,{method:"POST"}),i=await e.json(),l=!!i.valid;l?t+=1:s+=1,eZ(e=>({...e,[a.id]:{state:l?"success":"failed",error:l?null:i.error||null}}))}catch(e){s+=1,eZ(t=>({...t,[a.id]:{state:"failed",error:e.message||"Test failed"}}))}eX({total:u.length,completed:e+1,passed:t,failed:s,stopped:!1}),e<u.length-1&&await new Promise(e=>setTimeout(e,1e3))}}finally{eG(null),eB(!1),eV(!1),e0.current=!1}},tE=async e=>{eF({title:"Delete Connection",message:"Delete this connection?",onConfirm:async()=>{eF(null);try{(await fetch(`/api/providers/${e}`,{method:"DELETE"})).ok&&f(u.filter(t=>t.id!==e))}catch(e){console.log("Error deleting connection:",e)}}})},tR=()=>{tN(),O(!1)},t_=async e=>{F("");try{let t=await fetch("/api/providers",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:r,...e})}),s=null;try{s=await t.json()}catch{s=null}if(t.ok){await tN(),q(!1);return}F(s?.error||"Failed to save connection")}catch(e){console.log("Error saving connection:",e),F("Failed to save connection")}},tD=async e=>{try{(await fetch(`/api/providers/${Q.id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})).ok&&(await tN(),B(!1))}catch(e){console.log("Error updating connection:",e)}},tz=async(e,t)=>{try{(await fetch(`/api/providers/${e}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({isActive:t})})).ok&&f(s=>s.map(s=>s.id===e?{...s,isActive:t}:s))}catch(e){console.log("Error updating connection status:",e)}},tU=async(e,t)=>{let s=[...u];[s[e],s[t]]=[s[t],s[e]],f(s);try{await Promise.all([fetch(`/api/providers/${s[e].id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({priority:e})}),fetch(`/api/providers/${s[t].id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({priority:t})})])}catch(e){console.log("Error swapping priority:",e),await tN()}},tq=u.filter(e=>ep.includes(e.id));u.length>0&&(ep.length,u.length),(0,i.useEffect)(()=>{ex(e=>e.filter(e=>u.some(t=>t.id===e)))},[u]),(()=>{if(0===tq.length)return;let e=new Set(tq.map(e=>e.providerSpecificData?.proxyPoolId||"__none__"));if(1===e.size){let t=[...e][0];if("__none__"===t)return;let s=A.find(e=>e.id===t);return s?.name}})();let tM=()=>{ef||G(!1)},tF=async e=>{eg(!0);try{let t=0;for(let{connectionId:s,proxyPoolId:a}of e)try{(await fetch(`/api/providers/${s}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({proxyPoolId:a})})).ok||(t+=1)}catch(e){console.log("Error applying proxy for",s,e),t+=1}t>0&&alert(`Updated with ${t} failed request(s).`),await tN(),G(!1)}finally{eg(!1)}},tL=e=>tF(u.map(t=>({connectionId:t.id,proxyPoolId:e}))),tK=(0,a.jsx)("div",{className:"flex min-w-0 flex-col divide-y divide-black/[0.03] dark:divide-white/[0.03]",children:u.map((e,t)=>(0,a.jsx)("div",{className:"flex min-w-0 items-stretch",children:(0,a.jsx)("div",{className:"flex-1 min-w-0",children:(0,a.jsx)(N,{connection:e,proxyPools:A,health:tS[e.id],isOAuth:ta,isFirst:0===t,isLast:t===u.length-1,onMoveUp:()=>tU(t,t-1),onMoveDown:()=>tU(t,t+1),onToggleActive:t=>tz(e.id,t),autoPing:"claude"===r&&"oauth"===e.authType?{on:!0===ek.connections[e.id],onToggle:t=>tC(e.id,t)}:null,onUpdateProxy:async t=>{try{(await fetch(`/api/providers/${e.id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({proxyPoolId:t||null})})).ok&&f(s=>s.map(s=>s.id===e.id?{...s,providerSpecificData:{...s.providerSpecificData,proxyPoolId:t||null}}:s))}catch(e){console.log("Error updating proxy:",e)}},onEdit:()=>{Z(e),B(!0)},onDelete:()=>tE(e.id),oneByOneStatus:eQ[e.id]||null})})},e.id))}),tJ=A.filter(e=>!0===e.isActive),tB=(0,a.jsx)(d.aF,{isOpen:H,onClose:tM,title:`Apply Proxy (${u.length} connections)`,children:(0,a.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,a.jsxs)("div",{className:"flex flex-col",children:[(0,a.jsxs)("button",{onClick:()=>{let e=A.filter(e=>!0===e.isActive);return 0===e.length?void alert("No active proxy pools available."):tF(u.map((t,s)=>({connectionId:t.id,proxyPoolId:e[s%e.length].id})))},disabled:ef||0===tJ.length,className:"flex items-center gap-2 rounded-lg px-3 py-2 text-left transition-colors hover:bg-black/[0.04] dark:hover:bg-white/[0.04] disabled:cursor-not-allowed disabled:opacity-50",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[18px]",children:"sync_alt"}),(0,a.jsx)("span",{className:"text-sm text-text-main",children:"One-to-one (rotate)"})]}),(0,a.jsxs)("button",{onClick:()=>tL(null),disabled:ef,className:"flex items-center gap-2 rounded-lg px-3 py-2 text-left transition-colors hover:bg-black/[0.04] dark:hover:bg-white/[0.04] disabled:cursor-not-allowed disabled:opacity-50",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[18px]",children:"link_off"}),(0,a.jsx)("span",{className:"text-sm text-text-main",children:"None (unbind all)"})]}),A.map(e=>(0,a.jsxs)("button",{onClick:()=>tL(e.id),disabled:ef||!0!==e.isActive,className:"flex items-center gap-2 rounded-lg px-3 py-2 text-left transition-colors hover:bg-black/[0.04] dark:hover:bg-white/[0.04] disabled:cursor-not-allowed disabled:opacity-50",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[18px]",children:"lan"}),(0,a.jsx)("span",{className:"truncate text-sm text-text-main",children:e.name}),!0!==e.isActive&&(0,a.jsx)("span",{className:"text-[10px] text-text-muted",children:"(inactive)"})]},e.id))]}),ef&&(0,a.jsx)("p",{className:"text-xs text-text-muted",children:"Applying..."}),(0,a.jsx)(d.$n,{onClick:tM,variant:"ghost",fullWidth:!0,disabled:ef,children:"Cancel"})]})}),tW=async e=>{if(!er.has(e)){en(t=>new Set([...t,e]));try{let t=await fetch("/api/models/test",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({model:`${tu}/${e}`})}),s=await t.json();ea(t=>({...t,[e]:s.ok?"ok":"error"})),s.ok||el(s.error||"Model not reachable")}catch{ea(t=>({...t,[e]:"error"}))}finally{en(t=>{let s=new Set(t);return s.delete(e),s})}}},tV=async e=>{if(eo)return;ed(!0);let t=[];try{for(let s=0;s<e.length;s+=5){let a=e.slice(s,s+5);await Promise.all(a.map(async e=>{en(t=>new Set([...t,e.id]));try{let s=await fetch("/api/models/test",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({model:`${tu}/${e.id}`})}),a=await s.json(),i=a.ok?"ok":"error";ea(t=>({...t,[e.id]:i})),a.ok&&t.push(e)}catch{ea(t=>({...t,[e.id]:"error"}))}finally{en(t=>{let s=new Set(t);return s.delete(e.id),s})}}))}for(let e of t)await tT(e.id,e.id,tu);t.length>0&&document.getElementById("available-models-section")?.scrollIntoView({behavior:"smooth"})}finally{ed(!1)}};if(g)return(0,a.jsxs)("div",{className:"flex flex-col gap-8",children:[(0,a.jsx)(d.Qv,{}),(0,a.jsx)(d.Qv,{})]});if(!te)return(0,a.jsxs)("div",{className:"text-center py-20",children:[(0,a.jsx)("p",{className:"text-text-muted",children:"Provider not found"}),(0,a.jsx)(n(),{href:"/dashboard/providers",className:"text-primary mt-4 inline-block",children:"Back to Providers"})]});let tH=()=>to&&te.apiType?"responses"===te.apiType?"/providers/oai-r.png":"/providers/oai-cc.png":td?"/providers/anthropic-m.png":`/providers/${te.id}.png`;return(0,a.jsxs)("div",{className:"flex min-w-0 flex-col gap-6 px-1 sm:gap-8 sm:px-0",children:[tt?(0,a.jsx)(I,{capabilities:tt,connectionCount:u.length,headerIconPath:ee?null:tH()}):(0,a.jsxs)("div",{className:"min-w-0",children:[(0,a.jsxs)(n(),{href:"/dashboard/providers",className:"inline-flex items-center gap-1 text-sm text-text-muted hover:text-primary transition-colors mb-4",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-lg",children:"arrow_back"}),"Back to Providers"]}),(0,a.jsxs)("div",{className:"flex min-w-0 items-center gap-3 sm:gap-4",children:[(0,a.jsx)("div",{className:"flex size-12 shrink-0 items-center justify-center rounded-lg",style:{backgroundColor:`${te.color}15`},children:ee?(0,a.jsx)("span",{className:"text-sm font-bold",style:{color:te.color},children:te.textIcon||te.id.slice(0,2).toUpperCase()}):(0,a.jsx)(o.default,{src:tH(),alt:te.name,width:48,height:48,className:"max-h-12 max-w-12 rounded-lg object-contain",sizes:"48px",onError:()=>et(!0)})}),(0,a.jsxs)("div",{className:"min-w-0",children:[(0,a.jsx)("h1",{className:"truncate text-2xl font-semibold tracking-tight sm:text-3xl",children:te.name}),(0,a.jsxs)("p",{className:"text-text-muted",children:[u.length," connection",1===u.length?"":"s"]})]})]})]}),tc&&j&&(0,a.jsx)(d.Zp,{children:(0,a.jsxs)("div",{className:"mb-4 flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between",children:[(0,a.jsxs)("div",{className:"min-w-0",children:[(0,a.jsx)("h2",{className:"text-lg font-semibold",children:td?"Anthropic Compatible Details":"OpenAI Compatible Details"}),(0,a.jsxs)("p",{className:"break-all text-sm text-text-muted",children:[td?"Messages API":"responses"===j.apiType?"Responses API":"Chat Completions"," \xb7 ",(j.baseUrl||"").replace(/\/$/,""),"/",td?"messages":"responses"===j.apiType?"responses":"chat/completions"]})]}),(0,a.jsxs)("div",{className:"grid grid-cols-1 gap-2 sm:flex sm:items-center",children:[(0,a.jsx)(d.$n,{size:"sm",icon:"add",onClick:()=>{F(""),q(!0)},className:"w-full sm:w-auto",children:"Add API Key"}),(0,a.jsx)(d.$n,{size:"sm",variant:"secondary",icon:"edit",onClick:()=>V(!0),className:"w-full sm:w-auto",children:"Edit"}),(0,a.jsx)(d.$n,{size:"sm",variant:"secondary",icon:"delete",onClick:async()=>{eF({title:"Delete Compatible Node",message:`Delete this ${td?"Anthropic":"OpenAI"} Compatible node?`,onConfirm:async()=>{eF(null);try{(await fetch(`/api/provider-nodes/${r}`,{method:"DELETE"})).ok&&s.push("/dashboard/providers")}catch(e){console.log("Error deleting provider node:",e)}}})},className:"w-full sm:w-auto",children:"Delete"})]})]})}),tl?(0,a.jsx)(d.gw,{providerId:r}):(0,a.jsxs)(d.Zp,{children:[(0,a.jsxs)("div",{className:"mb-4 flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[(0,a.jsx)("h2",{className:"text-lg font-semibold",children:"Connections"}),(0,a.jsxs)("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:gap-4",children:[u.length>0&&A.length>0&&(0,a.jsx)(d.$n,{size:"sm",variant:"secondary",icon:"lan",onClick:()=>G(!0),children:"Apply Proxy"}),u.length>0&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(d.$n,{size:"sm",variant:"secondary",icon:"sync",onClick:tO,disabled:eJ,children:eJ?"Testing Connection One-by-One...":"Test Connection One-by-One"}),eJ&&(0,a.jsx)(d.$n,{size:"sm",variant:"ghost",icon:"stop",onClick:()=>{eJ&&(e0.current=!0,eV(!0))},disabled:eW,children:eW?"Stopping...":"Stop"})]}),(0,a.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,a.jsx)("span",{className:"text-xs text-text-muted font-medium",children:"Round Robin"}),(0,a.jsx)(d.lM,{checked:"round-robin"===eb,onChange:e=>{let t=e?"round-robin":null,s=e?ev||"1":ev;e&&!ev&&ej("1"),ey(t),tk(t,s)}}),"round-robin"===eb&&(0,a.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,a.jsx)("span",{className:"text-xs text-text-muted",children:"Sticky:"}),(0,a.jsx)("input",{type:"number",min:1,value:ev,onChange:e=>{var t;ej(t=e.target.value),tk("round-robin",t)},placeholder:"1",className:"w-14 px-2 py-1 text-xs border border-border rounded-md bg-background focus:outline-none focus:border-primary"})]})]})]})]}),0===u.length?tt?(0,a.jsx)(R,{capabilities:tt,onOAuth:e7,onApiKey:e8,onFree:e9,onCookie:()=>z(!0),onCompatible:e8,onBulkImport:()=>K(!0)}):(0,a.jsxs)("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[(0,a.jsx)("div",{className:"inline-flex items-center justify-center w-9 h-9 rounded-full bg-primary/10 text-primary shrink-0",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"key"})}),(0,a.jsx)("p",{className:"text-sm text-text-muted",children:"No connections yet"})]}),(0,a.jsx)(d.$n,{size:"sm",icon:"add",onClick:e9,children:"Add API Key"})]}):(0,a.jsxs)(a.Fragment,{children:[eY&&(0,a.jsx)("div",{className:"mb-4 rounded-lg border border-black/10 bg-black/[0.02] px-3 py-2 text-xs text-text-muted dark:border-white/10 dark:bg-white/[0.03]",children:(0,a.jsxs)("div",{className:"flex flex-wrap items-center gap-3",children:[(0,a.jsxs)("span",{children:["Total: ",eY.total]}),(0,a.jsxs)("span",{children:["Completed: ",eY.completed]}),(0,a.jsxs)("span",{children:["Passed: ",eY.passed]}),(0,a.jsxs)("span",{children:["Failed: ",eY.failed]}),eY.stopped&&(0,a.jsx)("span",{className:"text-amber-600 dark:text-amber-400",children:"Stopped"}),eJ&&eH&&(0,a.jsxs)("span",{children:["Running: ",u.find(e=>e.id===eH)?.name||eH]})]})}),!tc&&tt&&(0,a.jsx)(_,{providerId:r,models:e$}),tK,!tc&&tt&&(0,a.jsx)(D,{providerId:r}),!tc&&(0,a.jsxs)("div",{className:"mt-4 grid grid-cols-1 gap-2 sm:flex",children:["iflow"===r&&(0,a.jsx)(d.$n,{size:"sm",icon:"cookie",variant:"secondary",onClick:()=>z(!0),title:"Add connection using browser cookie",className:"w-full sm:w-auto",children:"Cookie"}),"codex"===r&&(0,a.jsx)(d.$n,{size:"sm",icon:"playlist_add",variant:"secondary",onClick:()=>K(!0),title:(0,x.Tl)("Bulk import codex accounts from JSON"),className:"w-full sm:w-auto",children:(0,x.Tl)("Bulk Add")}),tm?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(d.$n,{size:"sm",icon:"lock",variant:"secondary",onClick:e7,className:"w-full sm:w-auto",children:tp}),(0,a.jsx)(d.$n,{size:"sm",icon:"key",onClick:e8,className:"w-full sm:w-auto",children:tx})]}):(0,a.jsx)(d.$n,{size:"sm",icon:"add",onClick:e9,className:"w-full sm:w-auto",children:"Add"})]})]})]}),(0,a.jsxs)(d.Zp,{id:"available-models-section",children:[(0,a.jsxs)("div",{className:"mb-4 flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between",children:[(0,a.jsx)("h2",{className:"text-lg font-semibold",children:"Available Models"}),!tc&&(e=[...tr,...eD.filter(e=>!tr.some(t=>t.id===e.id))].filter(e=>!e.type||"llm"===e.type).map(e=>e.id).filter(e=>!eU.includes(e)),(0,a.jsxs)("div",{className:"flex gap-2",children:[eU.length>0&&(0,a.jsx)(d.$n,{size:"sm",variant:"secondary",icon:"restart_alt",onClick:tv,children:"Active All"}),e.length>0&&(0,a.jsx)(d.$n,{size:"sm",variant:"secondary",icon:"block",onClick:()=>ty(e),children:"Disable All"})]}))]}),!!ei&&(0,a.jsx)("p",{className:"text-xs text-red-500 mb-3 break-words",children:ei}),(()=>{if(tc)return(0,a.jsx)(v,{providerStorageAlias:tu,providerDisplayAlias:th,modelAliases:Y,copied:e2,onCopy:e4,onSetAlias:tT,onDeleteAlias:tI,connections:u,isAnthropic:td});let e=[...tr,...eD.filter(e=>!tr.some(t=>t.id===e.id))].filter(e=>!e.type||"llm"===e.type),t=new Set(eU),s=e.filter(e=>!t.has(e.id)),i=e.filter(e=>t.has(e.id)),l=Object.entries(Y).filter(([e,t])=>{let s=`${tu}/`;if(!t.startsWith(s))return!1;let a=t.slice(s.length);return te.passthroughModels?!tr.some(e=>e.id===a):!tr.some(e=>e.id===a)&&e===a}).map(([e,t])=>({id:t.slice(`${tu}/`.length),alias:e,fullModel:t}));return(0,a.jsxs)("div",{className:"flex flex-wrap gap-3",children:[l.map(e=>(0,a.jsx)(b,{model:{id:e.id},fullModel:`${th}/${e.id}`,alias:e.alias,copied:e2,onCopy:e4,onSetAlias:()=>{},onDeleteAlias:()=>tI(e.alias),testStatus:es[e.id],onTest:u.length>0||tl?()=>tW(e.id):void 0,isTesting:er.has(e.id),isCustom:!0,isFree:!1},e.id)),s.map(e=>{let t=`${tu}/${e.id}`,s=`${r}/${e.id}`,i=Object.entries(Y).find(([,e])=>e===t||e===s)?.[0];return(0,a.jsx)(b,{model:e,fullModel:`${th}/${e.id}`,alias:i,copied:e2,onCopy:e4,onSetAlias:t=>tT(e.id,t,tu),onDeleteAlias:()=>tI(i),testStatus:es[e.id],onTest:u.length>0||tl?()=>tW(e.id):void 0,isTesting:er.has(e.id),isFree:e.isFree,onDisable:()=>tg(e.id)},e.id)}),(0,a.jsxs)("button",{onClick:()=>em(!0),className:"flex w-full items-center justify-center gap-1.5 rounded-lg border border-dashed border-primary/40 px-3 py-2 text-xs text-primary transition-colors hover:border-primary hover:bg-primary/5 sm:w-auto",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-sm",children:"add"}),"Add Model"]}),"qoder"===r&&u.some(e=>!1!==e.isActive)&&(0,a.jsxs)("button",{onClick:tP,disabled:e1,className:"flex w-full items-center justify-center gap-1.5 rounded-lg border border-dashed border-blue-500/40 px-3 py-2 text-xs text-blue-600 dark:text-blue-400 transition-colors hover:border-blue-500 hover:bg-blue-500/5 sm:w-auto disabled:opacity-50 disabled:cursor-not-allowed",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-sm",style:e1?{animation:"spin 1s linear infinite"}:void 0,children:e1?"progress_activity":"download"}),e1?(0,x.Tl)("Fetching..."):(0,x.Tl)("Fetch Qoder Models")]}),(()=>{let e=new Set([...s.map(e=>e.id),...l.map(e=>e.id)]),t=e$.length>0?e$:eS,r=e$.length>0,n=t.filter(t=>t.id&&!e.has(t.id)),o=new Set(e$.map(e=>e.id).filter(Boolean)),d=i.filter(e=>e.id&&!o.has(e.id)).map(e=>({...e,dropped:!0})),c=new Set(d.map(e=>e.id)),m=[...n.filter(e=>!c.has(e.id)),...d];if(!eI&&0===m.length&&0===t.length)return null;let p=eO.trim().toLowerCase(),x=p?m.filter(e=>e.id.toLowerCase().includes(p)||e.name&&e.name.toLowerCase().includes(p)):m,u={};x.forEach(e=>{if(!e.id)return;let t=e.id.includes("/")?e.id.split("/")[0]:"models";u[t]||(u[t]=[]),u[t].push(e)});let h=Object.entries(u).sort((e,t)=>t[1].length-e[1].length),f=x.filter(e=>!e.dropped).slice(0,50);return(0,a.jsxs)("div",{className:"w-full mt-4 space-y-2",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:"text-xs font-medium text-text-muted shrink-0",children:eI?"Loading...":`${r?"From API":"Suggested"} (${n.length})${d.length>0?` \xb7 ${d.length} dropped`:""}`}),(0,a.jsxs)("div",{className:"relative flex-1 min-w-0",children:[(0,a.jsx)("span",{className:"material-symbols-outlined absolute left-2.5 top-1/2 -translate-y-1/2 text-[13px] text-text-muted/60 pointer-events-none select-none",children:"search"}),(0,a.jsx)("input",{type:"text",value:eO,onChange:e=>eE(e.target.value),placeholder:"Search models...",className:"w-full h-7 pl-7 pr-7 text-xs rounded-lg bg-bg border border-border-subtle text-text-main placeholder:text-text-muted/50 focus:outline-none focus:ring-1 focus:ring-primary/30 focus:border-primary/40 transition-colors"}),eO&&(0,a.jsx)("button",{onClick:()=>eE(""),className:"absolute right-2 top-1/2 -translate-y-1/2 text-text-muted/50 hover:text-text-muted transition-colors",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[13px]",children:"close"})})]}),(0,a.jsx)("button",{onClick:t$,disabled:eI,title:"Refresh",className:"shrink-0 h-7 w-7 flex items-center justify-center rounded-lg border border-border-subtle text-text-muted hover:text-primary hover:border-primary/40 hover:bg-primary/5 transition-colors disabled:opacity-40",children:(0,a.jsx)("span",{className:`material-symbols-outlined text-[14px] ${eI?"animate-spin":""}`,children:"refresh"})}),!eI&&f.length>0&&(0,a.jsxs)("button",{onClick:()=>tV(f),disabled:eo,title:`Test up to ${f.length} models and auto-add passing ones`,className:"shrink-0 h-7 flex items-center gap-1 px-2.5 rounded-lg border border-border-subtle text-xs text-text-muted hover:text-green-600 hover:border-green-500/40 hover:bg-green-500/5 transition-colors disabled:opacity-40",children:[(0,a.jsx)("span",{className:`material-symbols-outlined text-[13px] ${eo?"animate-spin":""}`,children:eo?"progress_activity":"play_circle"}),eo?"Testing...":"Test All"]})]}),p&&(0,a.jsxs)("p",{className:"text-xs text-text-muted",children:[x.length," result",1!==x.length?"s":""]}),eI?(0,a.jsxs)("div",{className:"flex items-center gap-2 py-4 text-xs text-text-muted",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[15px] animate-spin",children:"progress_activity"}),"Fetching models from provider API..."]}):0===h.length?p?(0,a.jsxs)("p",{className:"text-xs text-text-muted py-2",children:['No models match "',eO,'"']}):null:(0,a.jsx)("div",{className:"space-y-1",children:h.map(([e,t])=>{let s=eR.has(e),i=t.filter(e=>!e.dropped&&"ok"===es[e.id]).length,l=t.filter(e=>!e.dropped&&"error"===es[e.id]).length,r=t.filter(e=>e.dropped).length;return(0,a.jsxs)("div",{className:"rounded-xl border border-border-subtle overflow-hidden",children:[(0,a.jsxs)("button",{onClick:()=>e_(t=>{let s=new Set(t);return s.has(e)?s.delete(e):s.add(e),s}),className:"w-full flex items-center gap-2 px-3 py-2 text-xs bg-bg hover:bg-surface-2/60 transition-colors text-left",children:[(0,a.jsx)("span",{className:"font-semibold text-text-main flex-1",children:e}),i>0&&(0,a.jsxs)("span",{className:"text-green-600 dark:text-green-400 font-medium",children:[i," ✓"]}),l>0&&(0,a.jsxs)("span",{className:"text-red-500 font-medium",children:[l," ✗"]}),r>0&&(0,a.jsxs)("span",{className:"px-1.5 py-0.5 rounded-md bg-amber-500/10 text-amber-600 dark:text-amber-400 text-[10px] font-medium",children:[r," dropped"]}),(0,a.jsx)("span",{className:"px-1.5 py-0.5 rounded-md bg-black/[0.06] dark:bg-white/[0.06] text-text-muted tabular-nums font-medium",children:t.length}),(0,a.jsx)("span",{className:"material-symbols-outlined text-[15px] text-text-muted/60",children:s?"expand_less":"expand_more"})]}),s&&(0,a.jsx)("div",{className:"px-3 pt-2 pb-3 flex flex-wrap gap-1.5 border-t border-border-subtle bg-surface/50",children:t.map(e=>{let t=e.id.includes("/")?e.id.split("/").slice(1).join("/"):e.id,s=es[e.id],i=er.has(e.id);return e.dropped?(0,a.jsxs)("button",{onClick:async()=>{await tb(e.id),document.getElementById("available-models-section")?.scrollIntoView({behavior:"smooth"})},title:`Recently Dropped — click to restore: ${e.id}`,className:"group flex items-center gap-1 px-2.5 py-1.5 rounded-lg border border-amber-400/40 bg-amber-500/5 text-amber-700 dark:text-amber-400 text-xs hover:bg-amber-500/10 hover:border-amber-400/60 transition-colors",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[12px]",children:"history"}),(0,a.jsx)("span",{children:t}),e.contextLength>0&&(0,a.jsxs)("span",{className:"opacity-50 text-[10px] ml-0.5",children:[(e.contextLength/1e3).toFixed(0),"k"]})]},e.id):(0,a.jsxs)("button",{onClick:async()=>{await tT(e.id,e.id,tu),document.getElementById("available-models-section")?.scrollIntoView({behavior:"smooth"})},title:`Add: ${e.name||e.id}`,className:["group flex items-center gap-1 px-2.5 py-1.5 rounded-lg border text-xs transition-colors","ok"===s?"border-green-500/30 bg-green-500/5 text-green-700 dark:text-green-400 hover:bg-green-500/10":"error"===s?"border-red-400/30 bg-red-500/5 text-red-600 dark:text-red-400 hover:bg-red-500/10":"border-border-subtle text-text-muted hover:text-primary hover:border-primary/40 hover:bg-primary/5"].join(" "),children:[i?(0,a.jsx)("span",{className:"material-symbols-outlined text-[12px] animate-spin",children:"progress_activity"}):"ok"===s?(0,a.jsx)("span",{className:"material-symbols-outlined text-[12px]",children:"check"}):"error"===s?(0,a.jsx)("span",{className:"material-symbols-outlined text-[12px]",children:"close"}):(0,a.jsx)("span",{className:"material-symbols-outlined text-[12px] opacity-50 group-hover:opacity-100",children:"add"}),(0,a.jsx)("span",{children:t}),e.contextLength>0&&(0,a.jsxs)("span",{className:"opacity-40 text-[10px] ml-0.5",children:[(e.contextLength/1e3).toFixed(0),"k"]})]},e.id)})})]},e)})})]})})()]})})()]}),tB,"kiro"===r?(0,a.jsx)(d.Mh,{isOpen:P,providerInfo:te,onSuccess:tR,onClose:()=>O(!1)}):"cursor"===r?(0,a.jsx)(d.G9,{isOpen:P,onSuccess:tR,onClose:()=>O(!1)}):"gitlab"===r?(0,a.jsx)(d.vj,{isOpen:P,providerInfo:te,onSuccess:tR,onClose:()=>O(!1)}):(0,a.jsx)(d.LF,{isOpen:P,provider:r,providerInfo:te,onSuccess:tR,onClose:()=>O(!1)}),"iflow"===r&&(0,a.jsx)(d.vE,{isOpen:E,onSuccess:()=>{tN(),z(!1)},onClose:()=>z(!1)}),(0,a.jsx)(k,{isOpen:U,provider:r,providerName:te.name,isCompatible:tc,isAnthropic:td,authType:te?.authType,authHint:te?.authHint,website:te?.website,proxyPools:A,error:M,onSave:t_,onBulkDone:tN,onClose:()=>{F(""),q(!1)}}),(0,a.jsx)(d.wI,{isOpen:J,connection:Q,proxyPools:A,onSave:tD,onClose:()=>B(!1)}),tc&&(0,a.jsx)(C,{isOpen:W,node:j,onSave:tw,onClose:()=>V(!1),isAnthropic:td}),!tc&&(0,a.jsx)(S,{isOpen:ec,providerAlias:tu,providerDisplayAlias:th,onSave:async e=>{let t=te?.passthroughModels?e.split("/").pop():e;await tT(e,t,tu),em(!1)},onClose:()=>em(!1)}),"codex"===r&&(0,a.jsx)($,{isOpen:L,onClose:()=>K(!1),onSuccess:tN}),(0,a.jsx)(d.uo,{isOpen:eL,onClose:()=>eK(!1),onConfirm:()=>{(window.localStorage.setItem(e3,"true"),eK(!1),ta)?e6():e8()},title:"Risk Notice",message:te?.deprecationNotice,confirmText:"I Understand, Continue",cancelText:"Cancel",variant:"danger"}),(0,a.jsx)(d.uo,{isOpen:!!eM,onClose:()=>eF(null),onConfirm:eM?.onConfirm,title:eM?.title||"Confirm",message:eM?.message,variant:"danger"})]})}R.propTypes={capabilities:g().object,onOAuth:g().func,onApiKey:g().func,onFree:g().func,onCookie:g().func,onCompatible:g().func,onBulkImport:g().func},_.propTypes={providerId:g().string.isRequired,models:g().array},D.propTypes={providerId:g().string.isRequired}},76487:(e,t,s)=>{Promise.resolve().then(s.bind(s,14182))}},e=>{e.O(0,[7504,5772,1321,5497,8441,3794,7358],()=>e(e.s=76487)),_N_E=e.O()}]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9089],{15615:(e,r,t)=>{"use strict";t.r(r),t.d(r,{default:()=>u});var a=t(95155),s=t(12115),i=t(73321),l=t(98500),d=t.n(l),o=t(35497),n=t(90620);let c=Object.values(n.Q2).map(e=>({value:e.id,label:e.name})),p=Object.values(n.MA).map(e=>({value:e.id,label:e.name}));function u(){let e=(0,i.useRouter)(),[r,t]=(0,s.useState)(!1),[l,u]=(0,s.useState)({provider:"",authMethod:"api_key",apiKey:"",displayName:"",isActive:!0}),[h,m]=(0,s.useState)({}),x=(e,r)=>{u(t=>({...t,[e]:r})),h[e]&&m(r=>({...r,[e]:null}))},b=async r=>{let a;if(r.preventDefault(),a={},l.provider||(a.provider="Please select a provider"),"api_key"!==l.authMethod||l.apiKey||(a.apiKey="API Key is required"),m(a),0===Object.keys(a).length){t(!0);try{let r=await fetch("/api/providers",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(l)});if(r.ok)e.push("/dashboard/providers");else{let e=await r.json();m({submit:e.error||"Failed to create provider"})}}catch(e){m({submit:"An error occurred. Please try again."})}finally{t(!1)}}},v=n.Q2[l.provider];return(0,a.jsxs)("div",{className:"max-w-2xl mx-auto",children:[(0,a.jsxs)("div",{className:"mb-8",children:[(0,a.jsxs)(d(),{href:"/dashboard/providers",className:"inline-flex items-center gap-1 text-sm text-text-muted hover:text-primary transition-colors mb-4",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-lg",children:"arrow_back"}),"Back to Providers"]}),(0,a.jsx)("h1",{className:"text-3xl font-semibold tracking-tight",children:"Add New Provider"}),(0,a.jsx)("p",{className:"text-text-muted mt-2",children:"Configure a new AI provider to use with your applications."})]}),(0,a.jsx)(o.Zp,{children:(0,a.jsxs)("form",{onSubmit:b,className:"flex flex-col gap-6",children:[(0,a.jsx)(o.l6,{label:"Provider",options:c,value:l.provider,onChange:e=>x("provider",e.target.value),placeholder:"Select a provider",error:h.provider,required:!0}),v&&(0,a.jsxs)(o.Zp.Section,{className:"flex items-center gap-3",children:[(0,a.jsx)("div",{className:"size-10 rounded-lg flex items-center justify-center bg-bg border border-border",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-xl",style:{color:v.color},children:v.icon})}),(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"font-medium",children:v.name}),(0,a.jsx)("p",{className:"text-sm text-text-muted",children:"Selected provider"})]})]}),(0,a.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,a.jsxs)("label",{className:"text-sm font-medium",children:["Authentication Method ",(0,a.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,a.jsx)("div",{className:"flex gap-3",children:p.map(e=>(0,a.jsxs)("button",{type:"button",onClick:()=>x("authMethod",e.value),className:`flex-1 flex items-center justify-center gap-2 p-4 rounded-lg border transition-all ${l.authMethod===e.value?"border-primary bg-primary/5 text-primary":"border-border hover:border-primary/50"}`,children:[(0,a.jsx)("span",{className:"material-symbols-outlined",children:"api_key"===e.value?"key":"lock"}),(0,a.jsx)("span",{className:"font-medium",children:e.label})]},e.value))})]}),"api_key"===l.authMethod&&(0,a.jsx)(o.pd,{label:"API Key",type:"password",placeholder:"Enter your API key",value:l.apiKey,onChange:e=>x("apiKey",e.target.value),error:h.apiKey,hint:"Your API key will be encrypted and stored securely.",required:!0}),"oauth2"===l.authMethod&&(0,a.jsxs)(o.Zp.Section,{children:[(0,a.jsx)("p",{className:"text-sm text-text-muted mb-4",children:"Connect your account using OAuth2 authentication."}),(0,a.jsx)(o.$n,{type:"button",variant:"secondary",icon:"link",children:"Connect with OAuth2"})]}),(0,a.jsx)(o.pd,{label:"Display Name",placeholder:"e.g., Production API, Dev Environment",value:l.displayName,onChange:e=>x("displayName",e.target.value),hint:"Optional. A friendly name to identify this configuration."}),(0,a.jsx)(o.lM,{checked:l.isActive,onChange:e=>x("isActive",e),label:"Active",description:"Enable this provider for use in your applications"}),h.submit&&(0,a.jsx)("div",{className:"p-4 rounded-lg bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 text-red-600 dark:text-red-400 text-sm",children:h.submit}),(0,a.jsxs)("div",{className:"flex gap-3 pt-4 border-t border-border",children:[(0,a.jsx)(d(),{href:"/dashboard/providers",className:"flex-1",children:(0,a.jsx)(o.$n,{type:"button",variant:"ghost",fullWidth:!0,children:"Cancel"})}),(0,a.jsx)(o.$n,{type:"submit",loading:r,fullWidth:!0,className:"flex-1",children:"Create Provider"})]})]})})]})}},84736:(e,r,t)=>{Promise.resolve().then(t.bind(t,15615))}},e=>{e.O(0,[
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9089],{15615:(e,r,t)=>{"use strict";t.r(r),t.d(r,{default:()=>u});var a=t(95155),s=t(12115),i=t(73321),l=t(98500),d=t.n(l),o=t(35497),n=t(90620);let c=Object.values(n.Q2).map(e=>({value:e.id,label:e.name})),p=Object.values(n.MA).map(e=>({value:e.id,label:e.name}));function u(){let e=(0,i.useRouter)(),[r,t]=(0,s.useState)(!1),[l,u]=(0,s.useState)({provider:"",authMethod:"api_key",apiKey:"",displayName:"",isActive:!0}),[h,m]=(0,s.useState)({}),x=(e,r)=>{u(t=>({...t,[e]:r})),h[e]&&m(r=>({...r,[e]:null}))},b=async r=>{let a;if(r.preventDefault(),a={},l.provider||(a.provider="Please select a provider"),"api_key"!==l.authMethod||l.apiKey||(a.apiKey="API Key is required"),m(a),0===Object.keys(a).length){t(!0);try{let r=await fetch("/api/providers",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(l)});if(r.ok)e.push("/dashboard/providers");else{let e=await r.json();m({submit:e.error||"Failed to create provider"})}}catch(e){m({submit:"An error occurred. Please try again."})}finally{t(!1)}}},v=n.Q2[l.provider];return(0,a.jsxs)("div",{className:"max-w-2xl mx-auto",children:[(0,a.jsxs)("div",{className:"mb-8",children:[(0,a.jsxs)(d(),{href:"/dashboard/providers",className:"inline-flex items-center gap-1 text-sm text-text-muted hover:text-primary transition-colors mb-4",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-lg",children:"arrow_back"}),"Back to Providers"]}),(0,a.jsx)("h1",{className:"text-3xl font-semibold tracking-tight",children:"Add New Provider"}),(0,a.jsx)("p",{className:"text-text-muted mt-2",children:"Configure a new AI provider to use with your applications."})]}),(0,a.jsx)(o.Zp,{children:(0,a.jsxs)("form",{onSubmit:b,className:"flex flex-col gap-6",children:[(0,a.jsx)(o.l6,{label:"Provider",options:c,value:l.provider,onChange:e=>x("provider",e.target.value),placeholder:"Select a provider",error:h.provider,required:!0}),v&&(0,a.jsxs)(o.Zp.Section,{className:"flex items-center gap-3",children:[(0,a.jsx)("div",{className:"size-10 rounded-lg flex items-center justify-center bg-bg border border-border",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-xl",style:{color:v.color},children:v.icon})}),(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"font-medium",children:v.name}),(0,a.jsx)("p",{className:"text-sm text-text-muted",children:"Selected provider"})]})]}),(0,a.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,a.jsxs)("label",{className:"text-sm font-medium",children:["Authentication Method ",(0,a.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,a.jsx)("div",{className:"flex gap-3",children:p.map(e=>(0,a.jsxs)("button",{type:"button",onClick:()=>x("authMethod",e.value),className:`flex-1 flex items-center justify-center gap-2 p-4 rounded-lg border transition-all ${l.authMethod===e.value?"border-primary bg-primary/5 text-primary":"border-border hover:border-primary/50"}`,children:[(0,a.jsx)("span",{className:"material-symbols-outlined",children:"api_key"===e.value?"key":"lock"}),(0,a.jsx)("span",{className:"font-medium",children:e.label})]},e.value))})]}),"api_key"===l.authMethod&&(0,a.jsx)(o.pd,{label:"API Key",type:"password",placeholder:"Enter your API key",value:l.apiKey,onChange:e=>x("apiKey",e.target.value),error:h.apiKey,hint:"Your API key will be encrypted and stored securely.",required:!0}),"oauth2"===l.authMethod&&(0,a.jsxs)(o.Zp.Section,{children:[(0,a.jsx)("p",{className:"text-sm text-text-muted mb-4",children:"Connect your account using OAuth2 authentication."}),(0,a.jsx)(o.$n,{type:"button",variant:"secondary",icon:"link",children:"Connect with OAuth2"})]}),(0,a.jsx)(o.pd,{label:"Display Name",placeholder:"e.g., Production API, Dev Environment",value:l.displayName,onChange:e=>x("displayName",e.target.value),hint:"Optional. A friendly name to identify this configuration."}),(0,a.jsx)(o.lM,{checked:l.isActive,onChange:e=>x("isActive",e),label:"Active",description:"Enable this provider for use in your applications"}),h.submit&&(0,a.jsx)("div",{className:"p-4 rounded-lg bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 text-red-600 dark:text-red-400 text-sm",children:h.submit}),(0,a.jsxs)("div",{className:"flex gap-3 pt-4 border-t border-border",children:[(0,a.jsx)(d(),{href:"/dashboard/providers",className:"flex-1",children:(0,a.jsx)(o.$n,{type:"button",variant:"ghost",fullWidth:!0,children:"Cancel"})}),(0,a.jsx)(o.$n,{type:"submit",loading:r,fullWidth:!0,className:"flex-1",children:"Create Provider"})]})]})})]})}},84736:(e,r,t)=>{Promise.resolve().then(t.bind(t,15615))}},e=>{e.O(0,[7504,1321,5497,8441,3794,7358],()=>e(e.s=84736)),_N_E=e.O()}]);
|