@yina-npm/openrouterx 0.4.71 → 0.4.80
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/BUILD_ID +1 -1
- package/app/.next/app-path-routes-manifest.json +3 -1
- package/app/.next/build-manifest.json +2 -2
- package/app/.next/routes-manifest.json +12 -0
- package/app/.next/server/app/(dashboard)/dashboard/admin/keys/page.js +2 -2
- package/app/.next/server/app/(dashboard)/dashboard/admin/keys/page.js.nft.json +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/admin/keys/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/admin/users/page.js +2 -2
- package/app/.next/server/app/(dashboard)/dashboard/admin/users/page.js.nft.json +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/admin/users/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/basic-chat/page.js +2 -2
- package/app/.next/server/app/(dashboard)/dashboard/basic-chat/page.js.nft.json +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/basic-chat/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/cli-tools/[toolId]/page.js +3 -3
- package/app/.next/server/app/(dashboard)/dashboard/cli-tools/[toolId]/page.js.nft.json +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/cli-tools/[toolId]/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/cli-tools/page.js +2 -2
- package/app/.next/server/app/(dashboard)/dashboard/cli-tools/page.js.nft.json +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/cli-tools/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/combos/page.js +2 -2
- package/app/.next/server/app/(dashboard)/dashboard/combos/page.js.nft.json +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/combos/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/console-log/page.js +2 -2
- package/app/.next/server/app/(dashboard)/dashboard/console-log/page.js.nft.json +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/console-log/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/endpoint/page.js +2 -2
- package/app/.next/server/app/(dashboard)/dashboard/endpoint/page.js.nft.json +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/endpoint/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/media-providers/[kind]/[id]/page.js +2 -2
- package/app/.next/server/app/(dashboard)/dashboard/media-providers/[kind]/[id]/page.js.nft.json +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/media-providers/[kind]/[id]/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/media-providers/[kind]/page.js +2 -2
- package/app/.next/server/app/(dashboard)/dashboard/media-providers/[kind]/page.js.nft.json +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/media-providers/[kind]/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/media-providers/combo/[id]/page.js +3 -3
- package/app/.next/server/app/(dashboard)/dashboard/media-providers/combo/[id]/page.js.nft.json +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/media-providers/combo/[id]/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/media-providers/web/page.js +2 -2
- package/app/.next/server/app/(dashboard)/dashboard/media-providers/web/page.js.nft.json +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/media-providers/web/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/mitm/page.js +2 -2
- package/app/.next/server/app/(dashboard)/dashboard/mitm/page.js.nft.json +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/mitm/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/page.js +2 -2
- package/app/.next/server/app/(dashboard)/dashboard/page.js.nft.json +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/profile/page.js +2 -2
- package/app/.next/server/app/(dashboard)/dashboard/profile/page.js.nft.json +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/profile/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/providers/[id]/page.js +10 -3
- package/app/.next/server/app/(dashboard)/dashboard/providers/[id]/page.js.nft.json +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/providers/[id]/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/providers/new/page.js +2 -2
- package/app/.next/server/app/(dashboard)/dashboard/providers/new/page.js.nft.json +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/providers/new/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/providers/page.js +2 -2
- package/app/.next/server/app/(dashboard)/dashboard/providers/page.js.nft.json +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/providers/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/proxy-pools/page.js +2 -2
- package/app/.next/server/app/(dashboard)/dashboard/proxy-pools/page.js.nft.json +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/proxy-pools/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/quota/page.js +3 -3
- package/app/.next/server/app/(dashboard)/dashboard/quota/page.js.nft.json +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/quota/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/skills/page.js +2 -2
- package/app/.next/server/app/(dashboard)/dashboard/skills/page.js.nft.json +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/skills/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/translator/page.js +2 -2
- package/app/.next/server/app/(dashboard)/dashboard/translator/page.js.nft.json +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/translator/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/usage/page.js +2 -2
- package/app/.next/server/app/(dashboard)/dashboard/usage/page.js.nft.json +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/usage/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/user/page.js +3 -3
- package/app/.next/server/app/(dashboard)/dashboard/user/page.js.nft.json +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/user/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/_global-error/page.js +3 -3
- package/app/.next/server/app/_global-error/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/_global-error.html +1 -1
- package/app/.next/server/app/_global-error.rsc +1 -1
- package/app/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/app/.next/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
- package/app/.next/server/app/_global-error.segments/_global-error.segment.rsc +1 -1
- package/app/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
- package/app/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
- package/app/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/app/.next/server/app/_not-found/page.js +2 -2
- package/app/.next/server/app/_not-found/page.js.nft.json +1 -1
- package/app/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/_not-found.html +1 -1
- package/app/.next/server/app/_not-found.rsc +4 -4
- package/app/.next/server/app/_not-found.segments/_full.segment.rsc +4 -4
- package/app/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
- package/app/.next/server/app/_not-found.segments/_index.segment.rsc +4 -4
- package/app/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
- package/app/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
- package/app/.next/server/app/_not-found.segments/_tree.segment.rsc +2 -2
- package/app/.next/server/app/api/auth/login/route.js +1 -1
- package/app/.next/server/app/api/auth/login/route.js.nft.json +1 -1
- package/app/.next/server/app/api/auth/logout/route.js +1 -1
- package/app/.next/server/app/api/auth/logout/route.js.nft.json +1 -1
- package/app/.next/server/app/api/auth/me/route.js +1 -1
- package/app/.next/server/app/api/auth/me/route.js.nft.json +1 -1
- package/app/.next/server/app/api/auth/oidc/callback/route.js +1 -1
- package/app/.next/server/app/api/auth/oidc/callback/route.js.nft.json +1 -1
- package/app/.next/server/app/api/auth/oidc/start/route.js +1 -1
- package/app/.next/server/app/api/auth/oidc/start/route.js.nft.json +1 -1
- package/app/.next/server/app/api/auth/oidc/test/route.js +1 -1
- package/app/.next/server/app/api/auth/oidc/test/route.js.nft.json +1 -1
- package/app/.next/server/app/api/auth/reset-password/route.js +1 -0
- package/app/.next/server/app/api/auth/reset-password/route.js.nft.json +1 -0
- package/app/.next/server/app/api/auth/reset-password/route_client-reference-manifest.js +1 -0
- package/app/.next/server/app/api/auth/status/route.js +1 -1
- package/app/.next/server/app/api/auth/status/route.js.nft.json +1 -1
- package/app/.next/server/app/api/cli-tools/all-statuses/route.js +3 -3
- package/app/.next/server/app/api/cli-tools/all-statuses/route.js.nft.json +1 -1
- package/app/.next/server/app/api/cli-tools/antigravity-mitm/alias/route.js +1 -1
- package/app/.next/server/app/api/cli-tools/antigravity-mitm/route.js +1 -1
- package/app/.next/server/app/api/cli-tools/claude-settings/route.js +2 -2
- package/app/.next/server/app/api/cli-tools/claude-settings/route.js.nft.json +1 -1
- package/app/.next/server/app/api/cli-tools/cline-settings/route.js +1 -1
- package/app/.next/server/app/api/cli-tools/codex-settings/activate-account/route.js +2 -2
- package/app/.next/server/app/api/cli-tools/codex-settings/activate-account/route.js.nft.json +1 -1
- package/app/.next/server/app/api/cli-tools/codex-settings/route.js +1 -1
- package/app/.next/server/app/api/cli-tools/codex-settings/route.js.nft.json +1 -1
- package/app/.next/server/app/api/cli-tools/copilot-settings/route.js +1 -1
- package/app/.next/server/app/api/cli-tools/cowork-mcp-registry/route.js +1 -1
- package/app/.next/server/app/api/cli-tools/cowork-mcp-tools/route.js +2 -2
- package/app/.next/server/app/api/cli-tools/cowork-settings/route.js +1 -1
- package/app/.next/server/app/api/cli-tools/cowork-settings/route.js.nft.json +1 -1
- package/app/.next/server/app/api/cli-tools/deepseek-tui-settings/route.js +3 -3
- package/app/.next/server/app/api/cli-tools/droid-settings/route.js +1 -1
- package/app/.next/server/app/api/cli-tools/droid-settings/route.js.nft.json +1 -1
- package/app/.next/server/app/api/cli-tools/hermes-settings/route.js +1 -1
- package/app/.next/server/app/api/cli-tools/hermes-settings/route.js.nft.json +1 -1
- package/app/.next/server/app/api/cli-tools/jcode-settings/route.js +2 -2
- package/app/.next/server/app/api/cli-tools/kilo-settings/route.js +1 -1
- package/app/.next/server/app/api/cli-tools/openclaw-settings/route.js +1 -1
- package/app/.next/server/app/api/cli-tools/openclaw-settings/route.js.nft.json +1 -1
- package/app/.next/server/app/api/cli-tools/opencode-settings/route.js +2 -2
- package/app/.next/server/app/api/cli-tools/opencode-settings/route.js.nft.json +1 -1
- package/app/.next/server/app/api/combos/[id]/route.js +1 -1
- package/app/.next/server/app/api/combos/route.js +1 -1
- package/app/.next/server/app/api/health/route.js +1 -1
- package/app/.next/server/app/api/init/route.js +1 -1
- package/app/.next/server/app/api/keys/[id]/route.js +1 -1
- package/app/.next/server/app/api/keys/[id]/route.js.nft.json +1 -1
- package/app/.next/server/app/api/keys/route.js +1 -1
- package/app/.next/server/app/api/keys/route.js.nft.json +1 -1
- package/app/.next/server/app/api/locale/route.js +1 -1
- package/app/.next/server/app/api/mcp/[plugin]/message/route.js +3 -3
- package/app/.next/server/app/api/mcp/[plugin]/sse/route.js +6 -3
- package/app/.next/server/app/api/media-providers/tts/deepgram/voices/route.js +1 -1
- package/app/.next/server/app/api/media-providers/tts/elevenlabs/voices/route.js +1 -1
- package/app/.next/server/app/api/media-providers/tts/inworld/voices/route.js +1 -1
- package/app/.next/server/app/api/media-providers/tts/minimax/voices/route.js +1 -1
- package/app/.next/server/app/api/media-providers/tts/voices/route.js +1 -1
- package/app/.next/server/app/api/models/alias/route.js +1 -1
- package/app/.next/server/app/api/models/availability/route.js +1 -1
- package/app/.next/server/app/api/models/custom/route.js +1 -1
- package/app/.next/server/app/api/models/disabled/route.js +1 -1
- package/app/.next/server/app/api/models/route.js +1 -1
- package/app/.next/server/app/api/models/route.js.nft.json +1 -1
- package/app/.next/server/app/api/models/test/route.js +1 -1
- package/app/.next/server/app/api/models/test/route.js.nft.json +1 -1
- package/app/.next/server/app/api/oauth/[provider]/[action]/route.js +1 -1
- package/app/.next/server/app/api/oauth/[provider]/[action]/route.js.nft.json +1 -1
- package/app/.next/server/app/api/oauth/codex/bulk-import/route.js +1 -0
- package/app/.next/server/app/api/oauth/codex/bulk-import/route.js.nft.json +1 -0
- package/app/.next/server/app/api/oauth/codex/bulk-import/route_client-reference-manifest.js +1 -0
- package/app/.next/server/app/api/oauth/codex/import-token/route.js +1 -1
- package/app/.next/server/app/api/oauth/codex/import-token/route.js.nft.json +1 -1
- package/app/.next/server/app/api/oauth/cursor/auto-import/route.js +2 -2
- package/app/.next/server/app/api/oauth/cursor/import/route.js +1 -1
- package/app/.next/server/app/api/oauth/gitlab/pat/route.js +1 -1
- package/app/.next/server/app/api/oauth/iflow/cookie/route.js +1 -1
- package/app/.next/server/app/api/oauth/kiro/auto-import/route.js +1 -1
- package/app/.next/server/app/api/oauth/kiro/import/route.js +1 -1
- package/app/.next/server/app/api/oauth/kiro/social-authorize/route.js +1 -1
- package/app/.next/server/app/api/oauth/kiro/social-exchange/route.js +1 -1
- package/app/.next/server/app/api/pricing/route.js +1 -1
- package/app/.next/server/app/api/provider-nodes/[id]/route.js +1 -1
- package/app/.next/server/app/api/provider-nodes/route.js +1 -1
- package/app/.next/server/app/api/provider-nodes/route.js.nft.json +1 -1
- package/app/.next/server/app/api/provider-nodes/validate/route.js +1 -1
- package/app/.next/server/app/api/providers/[id]/models/route.js +1 -1
- package/app/.next/server/app/api/providers/[id]/models/route.js.nft.json +1 -1
- package/app/.next/server/app/api/providers/[id]/route.js +1 -1
- package/app/.next/server/app/api/providers/[id]/route.js.nft.json +1 -1
- package/app/.next/server/app/api/providers/[id]/test/route.js +1 -1
- package/app/.next/server/app/api/providers/[id]/test/route.js.nft.json +1 -1
- package/app/.next/server/app/api/providers/[id]/test-models/route.js +1 -1
- package/app/.next/server/app/api/providers/[id]/test-models/route.js.nft.json +1 -1
- package/app/.next/server/app/api/providers/client/route.js +1 -1
- package/app/.next/server/app/api/providers/client/route.js.nft.json +1 -1
- package/app/.next/server/app/api/providers/kilo/free-models/route.js +1 -1
- package/app/.next/server/app/api/providers/route.js +1 -1
- package/app/.next/server/app/api/providers/route.js.nft.json +1 -1
- package/app/.next/server/app/api/providers/suggested-models/route.js +1 -1
- package/app/.next/server/app/api/providers/test-batch/route.js +1 -1
- package/app/.next/server/app/api/providers/test-batch/route.js.nft.json +1 -1
- package/app/.next/server/app/api/providers/validate/route.js +1 -1
- package/app/.next/server/app/api/providers/validate/route.js.nft.json +1 -1
- package/app/.next/server/app/api/proxy-pools/[id]/route.js +1 -1
- package/app/.next/server/app/api/proxy-pools/[id]/test/route.js +1 -1
- package/app/.next/server/app/api/proxy-pools/cloudflare-deploy/route.js +2 -2
- package/app/.next/server/app/api/proxy-pools/deno-deploy/route.js +2 -2
- package/app/.next/server/app/api/proxy-pools/route.js +1 -1
- package/app/.next/server/app/api/proxy-pools/vercel-deploy/route.js +2 -2
- package/app/.next/server/app/api/settings/database/route.js +1 -1
- package/app/.next/server/app/api/settings/database/route.js.nft.json +1 -1
- package/app/.next/server/app/api/settings/proxy-test/route.js +1 -1
- package/app/.next/server/app/api/settings/require-login/route.js +1 -1
- package/app/.next/server/app/api/settings/route.js +1 -1
- package/app/.next/server/app/api/shutdown/route.js +1 -1
- package/app/.next/server/app/api/tags/route.js +1 -1
- package/app/.next/server/app/api/translator/console-logs/route.js +1 -1
- package/app/.next/server/app/api/translator/console-logs/route.js.nft.json +1 -1
- package/app/.next/server/app/api/translator/console-logs/stream/route.js +2 -2
- package/app/.next/server/app/api/translator/console-logs/stream/route.js.nft.json +1 -1
- package/app/.next/server/app/api/translator/load/route.js +1 -1
- package/app/.next/server/app/api/translator/save/route.js +1 -1
- package/app/.next/server/app/api/translator/send/route.js +1 -1
- package/app/.next/server/app/api/translator/send/route.js.nft.json +1 -1
- package/app/.next/server/app/api/translator/translate/route.js +1 -1
- package/app/.next/server/app/api/translator/translate/route.js.nft.json +1 -1
- package/app/.next/server/app/api/tunnel/disable/route.js +1 -1
- package/app/.next/server/app/api/tunnel/enable/route.js +1 -1
- package/app/.next/server/app/api/tunnel/status/route.js +1 -1
- package/app/.next/server/app/api/tunnel/tailscale-check/route.js +1 -1
- package/app/.next/server/app/api/tunnel/tailscale-disable/route.js +1 -1
- package/app/.next/server/app/api/tunnel/tailscale-enable/route.js +1 -1
- package/app/.next/server/app/api/tunnel/tailscale-install/route.js +1 -1
- package/app/.next/server/app/api/usage/[connectionId]/route.js +1 -1
- package/app/.next/server/app/api/usage/[connectionId]/route.js.nft.json +1 -1
- package/app/.next/server/app/api/usage/api-keys/route.js +1 -1
- package/app/.next/server/app/api/usage/chart/route.js +1 -1
- package/app/.next/server/app/api/usage/chart/route.js.nft.json +1 -1
- package/app/.next/server/app/api/usage/history/route.js +1 -1
- package/app/.next/server/app/api/usage/logs/route.js +1 -1
- package/app/.next/server/app/api/usage/providers/route.js +1 -1
- package/app/.next/server/app/api/usage/request-details/route.js +1 -1
- package/app/.next/server/app/api/usage/request-logs/route.js +1 -1
- package/app/.next/server/app/api/usage/stats/route.js +1 -1
- package/app/.next/server/app/api/usage/stats/route.js.nft.json +1 -1
- package/app/.next/server/app/api/usage/stream/route.js +2 -2
- package/app/.next/server/app/api/users/[id]/route.js +1 -1
- package/app/.next/server/app/api/users/route.js +1 -1
- package/app/.next/server/app/api/v1/api/chat/route.js +1 -1
- package/app/.next/server/app/api/v1/api/chat/route.js.nft.json +1 -1
- package/app/.next/server/app/api/v1/audio/speech/route.js +1 -1
- package/app/.next/server/app/api/v1/audio/speech/route.js.nft.json +1 -1
- package/app/.next/server/app/api/v1/audio/transcriptions/route.js +1 -1
- package/app/.next/server/app/api/v1/audio/transcriptions/route.js.nft.json +1 -1
- package/app/.next/server/app/api/v1/audio/voices/route.js +1 -1
- package/app/.next/server/app/api/v1/chat/completions/route.js +1 -1
- package/app/.next/server/app/api/v1/chat/completions/route.js.nft.json +1 -1
- package/app/.next/server/app/api/v1/embeddings/route.js +1 -1
- package/app/.next/server/app/api/v1/embeddings/route.js.nft.json +1 -1
- package/app/.next/server/app/api/v1/images/generations/route.js +2 -2
- package/app/.next/server/app/api/v1/images/generations/route.js.nft.json +1 -1
- package/app/.next/server/app/api/v1/messages/count_tokens/route.js +1 -1
- package/app/.next/server/app/api/v1/messages/route.js +1 -1
- package/app/.next/server/app/api/v1/messages/route.js.nft.json +1 -1
- package/app/.next/server/app/api/v1/models/[kind]/route.js +1 -1
- package/app/.next/server/app/api/v1/models/[kind]/route.js.nft.json +1 -1
- package/app/.next/server/app/api/v1/models/info/route.js +1 -1
- package/app/.next/server/app/api/v1/models/info/route.js.nft.json +1 -1
- package/app/.next/server/app/api/v1/models/route.js +1 -1
- package/app/.next/server/app/api/v1/models/route.js.nft.json +1 -1
- package/app/.next/server/app/api/v1/responses/compact/route.js +1 -1
- package/app/.next/server/app/api/v1/responses/compact/route.js.nft.json +1 -1
- package/app/.next/server/app/api/v1/responses/route.js +1 -1
- package/app/.next/server/app/api/v1/responses/route.js.nft.json +1 -1
- package/app/.next/server/app/api/v1/route.js +1 -1
- package/app/.next/server/app/api/v1/route.js.nft.json +1 -1
- package/app/.next/server/app/api/v1/search/route.js +1 -1
- package/app/.next/server/app/api/v1/search/route.js.nft.json +1 -1
- package/app/.next/server/app/api/v1/web/fetch/route.js +1 -1
- package/app/.next/server/app/api/v1/web/fetch/route.js.nft.json +1 -1
- package/app/.next/server/app/api/v1beta/models/[...path]/route.js +1 -1
- package/app/.next/server/app/api/v1beta/models/[...path]/route.js.nft.json +1 -1
- package/app/.next/server/app/api/v1beta/models/route.js +1 -1
- package/app/.next/server/app/api/v1beta/models/route.js.nft.json +1 -1
- package/app/.next/server/app/api/version/route.js +1 -1
- package/app/.next/server/app/api/version/shutdown/route.js +1 -1
- package/app/.next/server/app/api/version/shutdown/route.js.nft.json +1 -1
- package/app/.next/server/app/api/version/update/route.js +1 -1
- package/app/.next/server/app/api/version/update/route.js.nft.json +1 -1
- package/app/.next/server/app/callback/page.js +2 -2
- package/app/.next/server/app/callback/page.js.nft.json +1 -1
- package/app/.next/server/app/callback/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/callback.html +1 -1
- package/app/.next/server/app/callback.rsc +4 -4
- package/app/.next/server/app/callback.segments/_full.segment.rsc +4 -4
- package/app/.next/server/app/callback.segments/_head.segment.rsc +1 -1
- package/app/.next/server/app/callback.segments/_index.segment.rsc +4 -4
- package/app/.next/server/app/callback.segments/_tree.segment.rsc +2 -2
- package/app/.next/server/app/callback.segments/callback/__PAGE__.segment.rsc +1 -1
- package/app/.next/server/app/callback.segments/callback.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/settings/pricing/page.js +2 -2
- package/app/.next/server/app/dashboard/settings/pricing/page.js.nft.json +1 -1
- package/app/.next/server/app/dashboard/settings/pricing/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/dashboard/settings/pricing.html +1 -1
- package/app/.next/server/app/dashboard/settings/pricing.rsc +4 -4
- package/app/.next/server/app/dashboard/settings/pricing.segments/_full.segment.rsc +4 -4
- package/app/.next/server/app/dashboard/settings/pricing.segments/_head.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/settings/pricing.segments/_index.segment.rsc +4 -4
- package/app/.next/server/app/dashboard/settings/pricing.segments/_tree.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/settings/pricing.segments/dashboard/settings/pricing/__PAGE__.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/settings/pricing.segments/dashboard/settings/pricing.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/settings/pricing.segments/dashboard/settings.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/settings/pricing.segments/dashboard.segment.rsc +1 -1
- package/app/.next/server/app/favicon.ico/route.js +1 -1
- package/app/.next/server/app/index.html +1 -1
- package/app/.next/server/app/index.rsc +4 -4
- package/app/.next/server/app/index.segments/__PAGE__.segment.rsc +1 -1
- package/app/.next/server/app/index.segments/_full.segment.rsc +4 -4
- package/app/.next/server/app/index.segments/_head.segment.rsc +1 -1
- package/app/.next/server/app/index.segments/_index.segment.rsc +4 -4
- package/app/.next/server/app/index.segments/_tree.segment.rsc +2 -2
- package/app/.next/server/app/landing/page.js +2 -2
- package/app/.next/server/app/landing/page.js.nft.json +1 -1
- package/app/.next/server/app/landing/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/landing.html +1 -1
- package/app/.next/server/app/landing.rsc +4 -4
- package/app/.next/server/app/landing.segments/_full.segment.rsc +4 -4
- package/app/.next/server/app/landing.segments/_head.segment.rsc +1 -1
- package/app/.next/server/app/landing.segments/_index.segment.rsc +4 -4
- package/app/.next/server/app/landing.segments/_tree.segment.rsc +2 -2
- package/app/.next/server/app/landing.segments/landing/__PAGE__.segment.rsc +1 -1
- package/app/.next/server/app/landing.segments/landing.segment.rsc +1 -1
- package/app/.next/server/app/login/page.js +2 -2
- package/app/.next/server/app/login/page.js.nft.json +1 -1
- package/app/.next/server/app/login/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/login.html +1 -1
- package/app/.next/server/app/login.rsc +5 -5
- package/app/.next/server/app/login.segments/_full.segment.rsc +5 -5
- package/app/.next/server/app/login.segments/_head.segment.rsc +1 -1
- package/app/.next/server/app/login.segments/_index.segment.rsc +4 -4
- package/app/.next/server/app/login.segments/_tree.segment.rsc +2 -2
- package/app/.next/server/app/login.segments/login/__PAGE__.segment.rsc +2 -2
- package/app/.next/server/app/login.segments/login.segment.rsc +1 -1
- package/app/.next/server/app/manifest.webmanifest/route.js +2 -2
- package/app/.next/server/app/page.js +2 -2
- package/app/.next/server/app/page.js.nft.json +1 -1
- package/app/.next/server/app/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app-paths-manifest.json +3 -1
- package/app/.next/server/chunks/1172.js +1 -1
- package/app/.next/server/chunks/1350.js +2 -8
- package/app/.next/server/chunks/2059.js +1 -0
- package/app/.next/server/chunks/2409.js +1 -1
- package/app/.next/server/chunks/2560.js +1 -0
- package/app/.next/server/chunks/2722.js +3 -3
- package/app/.next/server/chunks/3104.js +1 -1
- package/app/.next/server/chunks/3663.js +1 -0
- package/app/.next/server/chunks/3913.js +2 -2
- package/app/.next/server/chunks/412.js +1 -1
- package/app/.next/server/chunks/4177.js +1 -1
- package/app/.next/server/chunks/4404.js +1 -1
- package/app/.next/server/chunks/4922.js +2 -2
- package/app/.next/server/chunks/4989.js +2 -2
- package/app/.next/server/chunks/5681.js +1 -1
- package/app/.next/server/chunks/6327.js +1 -0
- package/app/.next/server/chunks/6457.js +4 -4
- package/app/.next/server/chunks/7221.js +1 -0
- package/app/.next/server/chunks/7540.js +67 -0
- package/app/.next/server/chunks/7937.js +8 -8
- package/app/.next/server/chunks/8220.js +1 -1
- package/app/.next/server/chunks/8238.js +1 -0
- package/app/.next/server/chunks/8342.js +1 -0
- package/app/.next/server/chunks/8895.js +4 -4
- package/app/.next/server/chunks/9203.js +1 -1
- package/app/.next/server/chunks/9259.js +1 -1
- package/app/.next/server/chunks/9460.js +1 -1
- package/app/.next/server/chunks/9489.js +1 -1
- package/app/.next/server/chunks/9501.js +2 -2
- package/app/.next/server/chunks/9660.js +1 -0
- package/app/.next/server/chunks/9718.js +1 -1
- package/app/.next/server/chunks/9856.js +1 -1
- package/app/.next/server/middleware-build-manifest.js +1 -1
- package/app/.next/server/middleware.js +2 -2
- package/app/.next/server/pages/404.html +1 -1
- package/app/.next/server/pages/500.html +1 -1
- package/app/.next/static/MxcY0EY8eMa4ouCwsP4Cl/_buildManifest.js +1 -0
- package/app/.next/static/chunks/1321-134c6f0196307f47.js +1 -0
- package/app/.next/static/chunks/5497-61f5cbbdfc3da704.js +7 -0
- package/app/.next/static/chunks/{6069-27d1adb0dbf83385.js → 6069-130fdae38088e4e7.js} +6 -6
- package/app/.next/static/chunks/app/(dashboard)/dashboard/combos/page-ca6a0263fcfc70df.js +1 -0
- package/app/.next/static/chunks/app/(dashboard)/dashboard/profile/page-96d7ec789592a2ec.js +1 -0
- package/app/.next/static/chunks/app/(dashboard)/dashboard/providers/[id]/page-a2ec9b595a5c5600.js +10 -0
- package/app/.next/static/chunks/app/(dashboard)/dashboard/quota/{page-5f1623351681fa43.js → page-51f915ba68f44424.js} +2 -2
- package/app/.next/static/chunks/app/(dashboard)/dashboard/translator/page-8d41d89fe12ae485.js +1 -0
- package/app/.next/static/chunks/app/_global-error/page-8d41d89fe12ae485.js +1 -0
- package/app/.next/static/chunks/app/api/auth/login/route-8d41d89fe12ae485.js +1 -0
- package/app/.next/static/chunks/app/api/auth/logout/route-8d41d89fe12ae485.js +1 -0
- package/app/.next/static/chunks/app/api/auth/me/route-8d41d89fe12ae485.js +1 -0
- package/app/.next/static/chunks/app/api/auth/oidc/callback/route-8d41d89fe12ae485.js +1 -0
- package/app/.next/static/chunks/app/api/auth/oidc/start/route-8d41d89fe12ae485.js +1 -0
- package/app/.next/static/chunks/app/api/auth/oidc/test/route-8d41d89fe12ae485.js +1 -0
- package/app/.next/static/chunks/app/api/auth/reset-password/route-8d41d89fe12ae485.js +1 -0
- package/app/.next/static/chunks/app/api/auth/status/route-8d41d89fe12ae485.js +1 -0
- package/app/.next/static/chunks/app/api/cli-tools/all-statuses/route-8d41d89fe12ae485.js +1 -0
- package/app/.next/static/chunks/app/api/cli-tools/antigravity-mitm/alias/route-8d41d89fe12ae485.js +1 -0
- package/app/.next/static/chunks/app/api/cli-tools/antigravity-mitm/route-8d41d89fe12ae485.js +1 -0
- package/app/.next/static/chunks/app/api/cli-tools/claude-settings/route-8d41d89fe12ae485.js +1 -0
- package/app/.next/static/chunks/app/api/cli-tools/cline-settings/route-8d41d89fe12ae485.js +1 -0
- package/app/.next/static/chunks/app/api/cli-tools/codex-settings/activate-account/route-8d41d89fe12ae485.js +1 -0
- package/app/.next/static/chunks/app/api/cli-tools/codex-settings/route-8d41d89fe12ae485.js +1 -0
- package/app/.next/static/chunks/app/api/cli-tools/copilot-settings/route-8d41d89fe12ae485.js +1 -0
- package/app/.next/static/chunks/app/api/cli-tools/cowork-mcp-registry/route-8d41d89fe12ae485.js +1 -0
- package/app/.next/static/chunks/app/api/cli-tools/cowork-mcp-tools/route-8d41d89fe12ae485.js +1 -0
- package/app/.next/static/chunks/app/api/cli-tools/cowork-settings/route-8d41d89fe12ae485.js +1 -0
- package/app/.next/static/chunks/app/api/cli-tools/deepseek-tui-settings/route-8d41d89fe12ae485.js +1 -0
- package/app/.next/static/chunks/app/api/cli-tools/droid-settings/route-8d41d89fe12ae485.js +1 -0
- package/app/.next/static/chunks/app/api/cli-tools/hermes-settings/route-8d41d89fe12ae485.js +1 -0
- package/app/.next/static/chunks/app/api/cli-tools/jcode-settings/route-8d41d89fe12ae485.js +1 -0
- package/app/.next/static/chunks/app/api/cli-tools/kilo-settings/route-8d41d89fe12ae485.js +1 -0
- package/app/.next/static/chunks/app/api/cli-tools/openclaw-settings/route-8d41d89fe12ae485.js +1 -0
- package/app/.next/static/chunks/app/api/cli-tools/opencode-settings/route-8d41d89fe12ae485.js +1 -0
- package/app/.next/static/chunks/app/api/combos/[id]/route-8d41d89fe12ae485.js +1 -0
- package/app/.next/static/chunks/app/api/combos/route-8d41d89fe12ae485.js +1 -0
- package/app/.next/static/chunks/app/api/health/route-8d41d89fe12ae485.js +1 -0
- package/app/.next/static/chunks/app/api/init/route-8d41d89fe12ae485.js +1 -0
- package/app/.next/static/chunks/app/api/keys/[id]/route-8d41d89fe12ae485.js +1 -0
- package/app/.next/static/chunks/app/api/keys/route-8d41d89fe12ae485.js +1 -0
- package/app/.next/static/chunks/app/api/locale/route-8d41d89fe12ae485.js +1 -0
- package/app/.next/static/chunks/app/api/mcp/[plugin]/message/route-8d41d89fe12ae485.js +1 -0
- package/app/.next/static/chunks/app/api/mcp/[plugin]/sse/route-8d41d89fe12ae485.js +1 -0
- package/app/.next/static/chunks/app/api/media-providers/tts/deepgram/voices/route-8d41d89fe12ae485.js +1 -0
- package/app/.next/static/chunks/app/api/media-providers/tts/elevenlabs/voices/route-8d41d89fe12ae485.js +1 -0
- package/app/.next/static/chunks/app/api/media-providers/tts/inworld/voices/route-8d41d89fe12ae485.js +1 -0
- package/app/.next/static/chunks/app/api/media-providers/tts/minimax/voices/route-8d41d89fe12ae485.js +1 -0
- package/app/.next/static/chunks/app/api/media-providers/tts/voices/route-8d41d89fe12ae485.js +1 -0
- package/app/.next/static/chunks/app/api/models/alias/route-8d41d89fe12ae485.js +1 -0
- package/app/.next/static/chunks/app/api/models/availability/route-8d41d89fe12ae485.js +1 -0
- package/app/.next/static/chunks/app/api/models/custom/route-8d41d89fe12ae485.js +1 -0
- package/app/.next/static/chunks/app/api/models/disabled/route-8d41d89fe12ae485.js +1 -0
- package/app/.next/static/chunks/app/api/models/route-8d41d89fe12ae485.js +1 -0
- package/app/.next/static/chunks/app/api/models/test/route-8d41d89fe12ae485.js +1 -0
- package/app/.next/static/chunks/app/api/oauth/[provider]/[action]/route-8d41d89fe12ae485.js +1 -0
- package/app/.next/static/chunks/app/api/oauth/codex/bulk-import/route-8d41d89fe12ae485.js +1 -0
- package/app/.next/static/chunks/app/api/oauth/codex/import-token/route-8d41d89fe12ae485.js +1 -0
- package/app/.next/static/chunks/app/api/oauth/cursor/auto-import/route-8d41d89fe12ae485.js +1 -0
- package/app/.next/static/chunks/app/api/oauth/cursor/import/route-8d41d89fe12ae485.js +1 -0
- package/app/.next/static/chunks/app/api/oauth/gitlab/pat/route-8d41d89fe12ae485.js +1 -0
- package/app/.next/static/chunks/app/api/oauth/iflow/cookie/route-8d41d89fe12ae485.js +1 -0
- package/app/.next/static/chunks/app/api/oauth/kiro/auto-import/route-8d41d89fe12ae485.js +1 -0
- package/app/.next/static/chunks/app/api/oauth/kiro/import/route-8d41d89fe12ae485.js +1 -0
- package/app/.next/static/chunks/app/api/oauth/kiro/social-authorize/route-8d41d89fe12ae485.js +1 -0
- package/app/.next/static/chunks/app/api/oauth/kiro/social-exchange/route-8d41d89fe12ae485.js +1 -0
- package/app/.next/static/chunks/app/api/pricing/route-8d41d89fe12ae485.js +1 -0
- package/app/.next/static/chunks/app/api/provider-nodes/[id]/route-8d41d89fe12ae485.js +1 -0
- package/app/.next/static/chunks/app/api/provider-nodes/route-8d41d89fe12ae485.js +1 -0
- package/app/.next/static/chunks/app/api/provider-nodes/validate/route-8d41d89fe12ae485.js +1 -0
- package/app/.next/static/chunks/app/api/providers/[id]/models/route-8d41d89fe12ae485.js +1 -0
- package/app/.next/static/chunks/app/api/providers/[id]/route-8d41d89fe12ae485.js +1 -0
- package/app/.next/static/chunks/app/api/providers/[id]/test/route-8d41d89fe12ae485.js +1 -0
- package/app/.next/static/chunks/app/api/providers/[id]/test-models/route-8d41d89fe12ae485.js +1 -0
- package/app/.next/static/chunks/app/api/providers/client/route-8d41d89fe12ae485.js +1 -0
- package/app/.next/static/chunks/app/api/providers/kilo/free-models/route-8d41d89fe12ae485.js +1 -0
- package/app/.next/static/chunks/app/api/providers/route-8d41d89fe12ae485.js +1 -0
- package/app/.next/static/chunks/app/api/providers/suggested-models/route-8d41d89fe12ae485.js +1 -0
- package/app/.next/static/chunks/app/api/providers/test-batch/route-8d41d89fe12ae485.js +1 -0
- package/app/.next/static/chunks/app/api/providers/validate/route-8d41d89fe12ae485.js +1 -0
- package/app/.next/static/chunks/app/api/proxy-pools/[id]/route-8d41d89fe12ae485.js +1 -0
- package/app/.next/static/chunks/app/api/proxy-pools/[id]/test/route-8d41d89fe12ae485.js +1 -0
- package/app/.next/static/chunks/app/api/proxy-pools/cloudflare-deploy/route-8d41d89fe12ae485.js +1 -0
- package/app/.next/static/chunks/app/api/proxy-pools/deno-deploy/route-8d41d89fe12ae485.js +1 -0
- package/app/.next/static/chunks/app/api/proxy-pools/route-8d41d89fe12ae485.js +1 -0
- package/app/.next/static/chunks/app/api/proxy-pools/vercel-deploy/route-8d41d89fe12ae485.js +1 -0
- package/app/.next/static/chunks/app/api/settings/database/route-8d41d89fe12ae485.js +1 -0
- package/app/.next/static/chunks/app/api/settings/proxy-test/route-8d41d89fe12ae485.js +1 -0
- package/app/.next/static/chunks/app/api/settings/require-login/route-8d41d89fe12ae485.js +1 -0
- package/app/.next/static/chunks/app/api/settings/route-8d41d89fe12ae485.js +1 -0
- package/app/.next/static/chunks/app/api/shutdown/route-8d41d89fe12ae485.js +1 -0
- package/app/.next/static/chunks/app/api/tags/route-8d41d89fe12ae485.js +1 -0
- package/app/.next/static/chunks/app/api/translator/console-logs/route-8d41d89fe12ae485.js +1 -0
- package/app/.next/static/chunks/app/api/translator/console-logs/stream/route-8d41d89fe12ae485.js +1 -0
- package/app/.next/static/chunks/app/api/translator/load/route-8d41d89fe12ae485.js +1 -0
- package/app/.next/static/chunks/app/api/translator/save/route-8d41d89fe12ae485.js +1 -0
- package/app/.next/static/chunks/app/api/translator/send/route-8d41d89fe12ae485.js +1 -0
- package/app/.next/static/chunks/app/api/translator/translate/route-8d41d89fe12ae485.js +1 -0
- package/app/.next/static/chunks/app/api/tunnel/disable/route-8d41d89fe12ae485.js +1 -0
- package/app/.next/static/chunks/app/api/tunnel/enable/route-8d41d89fe12ae485.js +1 -0
- package/app/.next/static/chunks/app/api/tunnel/status/route-8d41d89fe12ae485.js +1 -0
- package/app/.next/static/chunks/app/api/tunnel/tailscale-check/route-8d41d89fe12ae485.js +1 -0
- package/app/.next/static/chunks/app/api/tunnel/tailscale-disable/route-8d41d89fe12ae485.js +1 -0
- package/app/.next/static/chunks/app/api/tunnel/tailscale-enable/route-8d41d89fe12ae485.js +1 -0
- package/app/.next/static/chunks/app/api/tunnel/tailscale-install/route-8d41d89fe12ae485.js +1 -0
- package/app/.next/static/chunks/app/api/usage/[connectionId]/route-8d41d89fe12ae485.js +1 -0
- package/app/.next/static/chunks/app/api/usage/api-keys/route-8d41d89fe12ae485.js +1 -0
- package/app/.next/static/chunks/app/api/usage/chart/route-8d41d89fe12ae485.js +1 -0
- package/app/.next/static/chunks/app/api/usage/history/route-8d41d89fe12ae485.js +1 -0
- package/app/.next/static/chunks/app/api/usage/logs/route-8d41d89fe12ae485.js +1 -0
- package/app/.next/static/chunks/app/api/usage/providers/route-8d41d89fe12ae485.js +1 -0
- package/app/.next/static/chunks/app/api/usage/request-details/route-8d41d89fe12ae485.js +1 -0
- package/app/.next/static/chunks/app/api/usage/request-logs/route-8d41d89fe12ae485.js +1 -0
- package/app/.next/static/chunks/app/api/usage/stats/route-8d41d89fe12ae485.js +1 -0
- package/app/.next/static/chunks/app/api/usage/stream/route-8d41d89fe12ae485.js +1 -0
- package/app/.next/static/chunks/app/api/users/[id]/route-8d41d89fe12ae485.js +1 -0
- package/app/.next/static/chunks/app/api/users/route-8d41d89fe12ae485.js +1 -0
- package/app/.next/static/chunks/app/api/v1/api/chat/route-8d41d89fe12ae485.js +1 -0
- package/app/.next/static/chunks/app/api/v1/audio/speech/route-8d41d89fe12ae485.js +1 -0
- package/app/.next/static/chunks/app/api/v1/audio/transcriptions/route-8d41d89fe12ae485.js +1 -0
- package/app/.next/static/chunks/app/api/v1/audio/voices/route-8d41d89fe12ae485.js +1 -0
- package/app/.next/static/chunks/app/api/v1/chat/completions/route-8d41d89fe12ae485.js +1 -0
- package/app/.next/static/chunks/app/api/v1/embeddings/route-8d41d89fe12ae485.js +1 -0
- package/app/.next/static/chunks/app/api/v1/images/generations/route-8d41d89fe12ae485.js +1 -0
- package/app/.next/static/chunks/app/api/v1/messages/count_tokens/route-8d41d89fe12ae485.js +1 -0
- package/app/.next/static/chunks/app/api/v1/messages/route-8d41d89fe12ae485.js +1 -0
- package/app/.next/static/chunks/app/api/v1/models/[kind]/route-8d41d89fe12ae485.js +1 -0
- package/app/.next/static/chunks/app/api/v1/models/info/route-8d41d89fe12ae485.js +1 -0
- package/app/.next/static/chunks/app/api/v1/models/route-8d41d89fe12ae485.js +1 -0
- package/app/.next/static/chunks/app/api/v1/responses/compact/route-8d41d89fe12ae485.js +1 -0
- package/app/.next/static/chunks/app/api/v1/responses/route-8d41d89fe12ae485.js +1 -0
- package/app/.next/static/chunks/app/api/v1/route-8d41d89fe12ae485.js +1 -0
- package/app/.next/static/chunks/app/api/v1/search/route-8d41d89fe12ae485.js +1 -0
- package/app/.next/static/chunks/app/api/v1/web/fetch/route-8d41d89fe12ae485.js +1 -0
- package/app/.next/static/chunks/app/api/v1beta/models/[...path]/route-8d41d89fe12ae485.js +1 -0
- package/app/.next/static/chunks/app/api/v1beta/models/route-8d41d89fe12ae485.js +1 -0
- package/app/.next/static/chunks/app/api/version/route-8d41d89fe12ae485.js +1 -0
- package/app/.next/static/chunks/app/api/version/shutdown/route-8d41d89fe12ae485.js +1 -0
- package/app/.next/static/chunks/app/api/version/update/route-8d41d89fe12ae485.js +1 -0
- package/app/.next/static/chunks/app/login/page-3192fc777d7b8d4d.js +1 -0
- package/app/.next/static/chunks/app/manifest.webmanifest/route-8d41d89fe12ae485.js +1 -0
- package/app/.next/static/chunks/app/page-8d41d89fe12ae485.js +1 -0
- package/app/.next/static/chunks/next/dist/client/components/builtin/app-error-8d41d89fe12ae485.js +1 -0
- package/app/.next/static/chunks/next/dist/client/components/builtin/forbidden-8d41d89fe12ae485.js +1 -0
- package/app/.next/static/chunks/next/dist/client/components/builtin/not-found-8d41d89fe12ae485.js +1 -0
- package/app/.next/static/chunks/next/dist/client/components/builtin/unauthorized-8d41d89fe12ae485.js +1 -0
- package/app/.next/static/css/f240ded5456043a2.css +1 -0
- package/app/package.json +1 -1
- package/app/public/providers/mimo-free.png +0 -0
- package/app/src/mitm/config.js +3 -1
- package/app/src/shared/constants/mitmToolHosts.js +1 -1
- package/package.json +1 -1
- package/app/.next/server/chunks/1900.js +0 -1
- package/app/.next/server/chunks/2574.js +0 -1
- package/app/.next/server/chunks/3110.js +0 -67
- package/app/.next/server/chunks/5789.js +0 -1
- package/app/.next/server/chunks/6096.js +0 -1
- package/app/.next/server/chunks/8279.js +0 -1
- package/app/.next/server/chunks/8750.js +0 -1
- package/app/.next/static/chunks/1321-9d7d6181b08dfcf4.js +0 -1
- package/app/.next/static/chunks/5497-41bb54893ac4e384.js +0 -7
- package/app/.next/static/chunks/app/(dashboard)/dashboard/combos/page-7fabe6d07b1f8823.js +0 -1
- package/app/.next/static/chunks/app/(dashboard)/dashboard/profile/page-011af574663dfa07.js +0 -1
- package/app/.next/static/chunks/app/(dashboard)/dashboard/providers/[id]/page-7cd7e81cc32bcf4d.js +0 -3
- package/app/.next/static/chunks/app/(dashboard)/dashboard/translator/page-739dde37665780bc.js +0 -1
- package/app/.next/static/chunks/app/_global-error/page-739dde37665780bc.js +0 -1
- package/app/.next/static/chunks/app/api/auth/login/route-739dde37665780bc.js +0 -1
- package/app/.next/static/chunks/app/api/auth/logout/route-739dde37665780bc.js +0 -1
- package/app/.next/static/chunks/app/api/auth/me/route-739dde37665780bc.js +0 -1
- package/app/.next/static/chunks/app/api/auth/oidc/callback/route-739dde37665780bc.js +0 -1
- package/app/.next/static/chunks/app/api/auth/oidc/start/route-739dde37665780bc.js +0 -1
- package/app/.next/static/chunks/app/api/auth/oidc/test/route-739dde37665780bc.js +0 -1
- package/app/.next/static/chunks/app/api/auth/status/route-739dde37665780bc.js +0 -1
- package/app/.next/static/chunks/app/api/cli-tools/all-statuses/route-739dde37665780bc.js +0 -1
- package/app/.next/static/chunks/app/api/cli-tools/antigravity-mitm/alias/route-739dde37665780bc.js +0 -1
- package/app/.next/static/chunks/app/api/cli-tools/antigravity-mitm/route-739dde37665780bc.js +0 -1
- package/app/.next/static/chunks/app/api/cli-tools/claude-settings/route-739dde37665780bc.js +0 -1
- package/app/.next/static/chunks/app/api/cli-tools/cline-settings/route-739dde37665780bc.js +0 -1
- package/app/.next/static/chunks/app/api/cli-tools/codex-settings/activate-account/route-739dde37665780bc.js +0 -1
- package/app/.next/static/chunks/app/api/cli-tools/codex-settings/route-739dde37665780bc.js +0 -1
- package/app/.next/static/chunks/app/api/cli-tools/copilot-settings/route-739dde37665780bc.js +0 -1
- package/app/.next/static/chunks/app/api/cli-tools/cowork-mcp-registry/route-739dde37665780bc.js +0 -1
- package/app/.next/static/chunks/app/api/cli-tools/cowork-mcp-tools/route-739dde37665780bc.js +0 -1
- package/app/.next/static/chunks/app/api/cli-tools/cowork-settings/route-739dde37665780bc.js +0 -1
- package/app/.next/static/chunks/app/api/cli-tools/deepseek-tui-settings/route-739dde37665780bc.js +0 -1
- package/app/.next/static/chunks/app/api/cli-tools/droid-settings/route-739dde37665780bc.js +0 -1
- package/app/.next/static/chunks/app/api/cli-tools/hermes-settings/route-739dde37665780bc.js +0 -1
- package/app/.next/static/chunks/app/api/cli-tools/jcode-settings/route-739dde37665780bc.js +0 -1
- package/app/.next/static/chunks/app/api/cli-tools/kilo-settings/route-739dde37665780bc.js +0 -1
- package/app/.next/static/chunks/app/api/cli-tools/openclaw-settings/route-739dde37665780bc.js +0 -1
- package/app/.next/static/chunks/app/api/cli-tools/opencode-settings/route-739dde37665780bc.js +0 -1
- package/app/.next/static/chunks/app/api/combos/[id]/route-739dde37665780bc.js +0 -1
- package/app/.next/static/chunks/app/api/combos/route-739dde37665780bc.js +0 -1
- package/app/.next/static/chunks/app/api/health/route-739dde37665780bc.js +0 -1
- package/app/.next/static/chunks/app/api/init/route-739dde37665780bc.js +0 -1
- package/app/.next/static/chunks/app/api/keys/[id]/route-739dde37665780bc.js +0 -1
- package/app/.next/static/chunks/app/api/keys/route-739dde37665780bc.js +0 -1
- package/app/.next/static/chunks/app/api/locale/route-739dde37665780bc.js +0 -1
- package/app/.next/static/chunks/app/api/mcp/[plugin]/message/route-739dde37665780bc.js +0 -1
- package/app/.next/static/chunks/app/api/mcp/[plugin]/sse/route-739dde37665780bc.js +0 -1
- package/app/.next/static/chunks/app/api/media-providers/tts/deepgram/voices/route-739dde37665780bc.js +0 -1
- package/app/.next/static/chunks/app/api/media-providers/tts/elevenlabs/voices/route-739dde37665780bc.js +0 -1
- package/app/.next/static/chunks/app/api/media-providers/tts/inworld/voices/route-739dde37665780bc.js +0 -1
- package/app/.next/static/chunks/app/api/media-providers/tts/minimax/voices/route-739dde37665780bc.js +0 -1
- package/app/.next/static/chunks/app/api/media-providers/tts/voices/route-739dde37665780bc.js +0 -1
- package/app/.next/static/chunks/app/api/models/alias/route-739dde37665780bc.js +0 -1
- package/app/.next/static/chunks/app/api/models/availability/route-739dde37665780bc.js +0 -1
- package/app/.next/static/chunks/app/api/models/custom/route-739dde37665780bc.js +0 -1
- package/app/.next/static/chunks/app/api/models/disabled/route-739dde37665780bc.js +0 -1
- package/app/.next/static/chunks/app/api/models/route-739dde37665780bc.js +0 -1
- package/app/.next/static/chunks/app/api/models/test/route-739dde37665780bc.js +0 -1
- package/app/.next/static/chunks/app/api/oauth/[provider]/[action]/route-739dde37665780bc.js +0 -1
- package/app/.next/static/chunks/app/api/oauth/codex/import-token/route-739dde37665780bc.js +0 -1
- package/app/.next/static/chunks/app/api/oauth/cursor/auto-import/route-739dde37665780bc.js +0 -1
- package/app/.next/static/chunks/app/api/oauth/cursor/import/route-739dde37665780bc.js +0 -1
- package/app/.next/static/chunks/app/api/oauth/gitlab/pat/route-739dde37665780bc.js +0 -1
- package/app/.next/static/chunks/app/api/oauth/iflow/cookie/route-739dde37665780bc.js +0 -1
- package/app/.next/static/chunks/app/api/oauth/kiro/auto-import/route-739dde37665780bc.js +0 -1
- package/app/.next/static/chunks/app/api/oauth/kiro/import/route-739dde37665780bc.js +0 -1
- package/app/.next/static/chunks/app/api/oauth/kiro/social-authorize/route-739dde37665780bc.js +0 -1
- package/app/.next/static/chunks/app/api/oauth/kiro/social-exchange/route-739dde37665780bc.js +0 -1
- package/app/.next/static/chunks/app/api/pricing/route-739dde37665780bc.js +0 -1
- package/app/.next/static/chunks/app/api/provider-nodes/[id]/route-739dde37665780bc.js +0 -1
- package/app/.next/static/chunks/app/api/provider-nodes/route-739dde37665780bc.js +0 -1
- package/app/.next/static/chunks/app/api/provider-nodes/validate/route-739dde37665780bc.js +0 -1
- package/app/.next/static/chunks/app/api/providers/[id]/models/route-739dde37665780bc.js +0 -1
- package/app/.next/static/chunks/app/api/providers/[id]/route-739dde37665780bc.js +0 -1
- package/app/.next/static/chunks/app/api/providers/[id]/test/route-739dde37665780bc.js +0 -1
- package/app/.next/static/chunks/app/api/providers/[id]/test-models/route-739dde37665780bc.js +0 -1
- package/app/.next/static/chunks/app/api/providers/client/route-739dde37665780bc.js +0 -1
- package/app/.next/static/chunks/app/api/providers/kilo/free-models/route-739dde37665780bc.js +0 -1
- package/app/.next/static/chunks/app/api/providers/route-739dde37665780bc.js +0 -1
- package/app/.next/static/chunks/app/api/providers/suggested-models/route-739dde37665780bc.js +0 -1
- package/app/.next/static/chunks/app/api/providers/test-batch/route-739dde37665780bc.js +0 -1
- package/app/.next/static/chunks/app/api/providers/validate/route-739dde37665780bc.js +0 -1
- package/app/.next/static/chunks/app/api/proxy-pools/[id]/route-739dde37665780bc.js +0 -1
- package/app/.next/static/chunks/app/api/proxy-pools/[id]/test/route-739dde37665780bc.js +0 -1
- package/app/.next/static/chunks/app/api/proxy-pools/cloudflare-deploy/route-739dde37665780bc.js +0 -1
- package/app/.next/static/chunks/app/api/proxy-pools/deno-deploy/route-739dde37665780bc.js +0 -1
- package/app/.next/static/chunks/app/api/proxy-pools/route-739dde37665780bc.js +0 -1
- package/app/.next/static/chunks/app/api/proxy-pools/vercel-deploy/route-739dde37665780bc.js +0 -1
- package/app/.next/static/chunks/app/api/settings/database/route-739dde37665780bc.js +0 -1
- package/app/.next/static/chunks/app/api/settings/proxy-test/route-739dde37665780bc.js +0 -1
- package/app/.next/static/chunks/app/api/settings/require-login/route-739dde37665780bc.js +0 -1
- package/app/.next/static/chunks/app/api/settings/route-739dde37665780bc.js +0 -1
- package/app/.next/static/chunks/app/api/shutdown/route-739dde37665780bc.js +0 -1
- package/app/.next/static/chunks/app/api/tags/route-739dde37665780bc.js +0 -1
- package/app/.next/static/chunks/app/api/translator/console-logs/route-739dde37665780bc.js +0 -1
- package/app/.next/static/chunks/app/api/translator/console-logs/stream/route-739dde37665780bc.js +0 -1
- package/app/.next/static/chunks/app/api/translator/load/route-739dde37665780bc.js +0 -1
- package/app/.next/static/chunks/app/api/translator/save/route-739dde37665780bc.js +0 -1
- package/app/.next/static/chunks/app/api/translator/send/route-739dde37665780bc.js +0 -1
- package/app/.next/static/chunks/app/api/translator/translate/route-739dde37665780bc.js +0 -1
- package/app/.next/static/chunks/app/api/tunnel/disable/route-739dde37665780bc.js +0 -1
- package/app/.next/static/chunks/app/api/tunnel/enable/route-739dde37665780bc.js +0 -1
- package/app/.next/static/chunks/app/api/tunnel/status/route-739dde37665780bc.js +0 -1
- package/app/.next/static/chunks/app/api/tunnel/tailscale-check/route-739dde37665780bc.js +0 -1
- package/app/.next/static/chunks/app/api/tunnel/tailscale-disable/route-739dde37665780bc.js +0 -1
- package/app/.next/static/chunks/app/api/tunnel/tailscale-enable/route-739dde37665780bc.js +0 -1
- package/app/.next/static/chunks/app/api/tunnel/tailscale-install/route-739dde37665780bc.js +0 -1
- package/app/.next/static/chunks/app/api/usage/[connectionId]/route-739dde37665780bc.js +0 -1
- package/app/.next/static/chunks/app/api/usage/api-keys/route-739dde37665780bc.js +0 -1
- package/app/.next/static/chunks/app/api/usage/chart/route-739dde37665780bc.js +0 -1
- package/app/.next/static/chunks/app/api/usage/history/route-739dde37665780bc.js +0 -1
- package/app/.next/static/chunks/app/api/usage/logs/route-739dde37665780bc.js +0 -1
- package/app/.next/static/chunks/app/api/usage/providers/route-739dde37665780bc.js +0 -1
- package/app/.next/static/chunks/app/api/usage/request-details/route-739dde37665780bc.js +0 -1
- package/app/.next/static/chunks/app/api/usage/request-logs/route-739dde37665780bc.js +0 -1
- package/app/.next/static/chunks/app/api/usage/stats/route-739dde37665780bc.js +0 -1
- package/app/.next/static/chunks/app/api/usage/stream/route-739dde37665780bc.js +0 -1
- package/app/.next/static/chunks/app/api/users/[id]/route-739dde37665780bc.js +0 -1
- package/app/.next/static/chunks/app/api/users/route-739dde37665780bc.js +0 -1
- package/app/.next/static/chunks/app/api/v1/api/chat/route-739dde37665780bc.js +0 -1
- package/app/.next/static/chunks/app/api/v1/audio/speech/route-739dde37665780bc.js +0 -1
- package/app/.next/static/chunks/app/api/v1/audio/transcriptions/route-739dde37665780bc.js +0 -1
- package/app/.next/static/chunks/app/api/v1/audio/voices/route-739dde37665780bc.js +0 -1
- package/app/.next/static/chunks/app/api/v1/chat/completions/route-739dde37665780bc.js +0 -1
- package/app/.next/static/chunks/app/api/v1/embeddings/route-739dde37665780bc.js +0 -1
- package/app/.next/static/chunks/app/api/v1/images/generations/route-739dde37665780bc.js +0 -1
- package/app/.next/static/chunks/app/api/v1/messages/count_tokens/route-739dde37665780bc.js +0 -1
- package/app/.next/static/chunks/app/api/v1/messages/route-739dde37665780bc.js +0 -1
- package/app/.next/static/chunks/app/api/v1/models/[kind]/route-739dde37665780bc.js +0 -1
- package/app/.next/static/chunks/app/api/v1/models/info/route-739dde37665780bc.js +0 -1
- package/app/.next/static/chunks/app/api/v1/models/route-739dde37665780bc.js +0 -1
- package/app/.next/static/chunks/app/api/v1/responses/compact/route-739dde37665780bc.js +0 -1
- package/app/.next/static/chunks/app/api/v1/responses/route-739dde37665780bc.js +0 -1
- package/app/.next/static/chunks/app/api/v1/route-739dde37665780bc.js +0 -1
- package/app/.next/static/chunks/app/api/v1/search/route-739dde37665780bc.js +0 -1
- package/app/.next/static/chunks/app/api/v1/web/fetch/route-739dde37665780bc.js +0 -1
- package/app/.next/static/chunks/app/api/v1beta/models/[...path]/route-739dde37665780bc.js +0 -1
- package/app/.next/static/chunks/app/api/v1beta/models/route-739dde37665780bc.js +0 -1
- package/app/.next/static/chunks/app/api/version/route-739dde37665780bc.js +0 -1
- package/app/.next/static/chunks/app/api/version/shutdown/route-739dde37665780bc.js +0 -1
- package/app/.next/static/chunks/app/api/version/update/route-739dde37665780bc.js +0 -1
- package/app/.next/static/chunks/app/login/page-bf4ffdfcf4ec19bf.js +0 -1
- package/app/.next/static/chunks/app/manifest.webmanifest/route-739dde37665780bc.js +0 -1
- package/app/.next/static/chunks/app/page-739dde37665780bc.js +0 -1
- package/app/.next/static/chunks/next/dist/client/components/builtin/app-error-739dde37665780bc.js +0 -1
- package/app/.next/static/chunks/next/dist/client/components/builtin/forbidden-739dde37665780bc.js +0 -1
- package/app/.next/static/chunks/next/dist/client/components/builtin/not-found-739dde37665780bc.js +0 -1
- package/app/.next/static/chunks/next/dist/client/components/builtin/unauthorized-739dde37665780bc.js +0 -1
- package/app/.next/static/css/16b3fb40c238dedb.css +0 -1
- package/app/.next/static/jssxgK5Jb3snQyFlT_oQ6/_buildManifest.js +0 -1
- /package/app/.next/static/{jssxgK5Jb3snQyFlT_oQ6 → MxcY0EY8eMa4ouCwsP4Cl}/_ssgManifest.js +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3649],{2525:(e,t,s)=>{Promise.resolve().then(s.bind(s,47295))},47295:(e,t,s)=>{"use strict";s.r(t),s.d(t,{default:()=>x});var a=s(95155),l=s(12115),r=s(44923),o=s(87256),i=s(39768),n=s(5020),c=s(35497),d=s(11059);s(52679);let m=/^[a-zA-Z0-9_.\-]+$/;function x(){let[e,t]=(0,l.useState)([]),[s,r]=(0,l.useState)(!0),[o,i]=(0,l.useState)(!1),[n,m]=(0,l.useState)(null),[x,u]=(0,l.useState)([]),[b,f]=(0,l.useState)({}),[g,j]=(0,l.useState)(null),{copied:y,copy:v}=(0,d.C)();(0,l.useEffect)(()=>{fetch("/api/auth/me").then(e=>e.json()).then(e=>{"sub_user"===e.role&&(window.location.href="/dashboard/usage")}).catch(()=>{}),w()},[]);let w=async()=>{try{let[e,s,a]=await Promise.all([fetch("/api/combos"),fetch("/api/providers"),fetch("/api/settings")]),l=await e.json(),r=await s.json(),o=a.ok?await a.json():{};e.ok&&t((l.combos||[]).filter(e=>!e.kind||"llm"===e.kind)),s.ok&&u(r.connections||[]),f(o.comboStrategies||{})}catch(e){console.log("Error fetching data:",e)}finally{r(!1)}},N=async e=>{try{let t=await fetch("/api/combos",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(t.ok)await w(),i(!1);else{let e=await t.json();alert(e.error||"Failed to create combo")}}catch(e){console.log("Error creating combo:",e)}},k=async(e,t)=>{try{let s=await fetch(`/api/combos/${e}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});if(s.ok)await w(),m(null);else{let e=await s.json();alert(e.error||"Failed to update combo")}}catch(e){console.log("Error updating combo:",e)}},C=async s=>{j({title:"Delete Combo",message:"Delete this combo?",onConfirm:async()=>{j(null);try{(await fetch(`/api/combos/${s}`,{method:"DELETE"})).ok&&t(e.filter(e=>e.id!==s))}catch(e){console.log("Error deleting combo:",e)}}})},S=async(e,t)=>{try{let s={...b};t?s[e]={fallbackStrategy:"round-robin"}:delete s[e],await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({comboStrategies:s})}),f(s)}catch(e){console.log("Error updating combo strategy:",e)}};return s?(0,a.jsxs)("div",{className:"flex flex-col gap-6",children:[(0,a.jsx)(c.Qv,{}),(0,a.jsx)(c.Qv,{})]}):(0,a.jsxs)("div",{className:"flex min-w-0 flex-col gap-6 px-1 sm:px-0",children:[(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:"min-w-0",children:[(0,a.jsx)("h1",{className:"text-2xl font-semibold",children:"Combos"}),(0,a.jsx)("p",{className:"text-sm text-text-muted mt-1",children:"Create model combos with fallback support"})]}),(0,a.jsx)(c.$n,{icon:"add",onClick:()=>i(!0),className:"w-full sm:w-auto",children:"Create Combo"})]}),0===e.length?(0,a.jsx)(c.Zp,{children:(0,a.jsxs)("div",{className:"text-center py-12",children:[(0,a.jsx)("div",{className:"inline-flex items-center justify-center w-16 h-16 rounded-full bg-primary/10 text-primary mb-4",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[32px]",children:"layers"})}),(0,a.jsx)("p",{className:"text-text-main font-medium mb-1",children:"No combos yet"}),(0,a.jsx)("p",{className:"text-sm text-text-muted mb-4",children:"Create model combos with fallback support"}),(0,a.jsx)(c.$n,{icon:"add",onClick:()=>i(!0),className:"w-full sm:w-auto",children:"Create Combo"})]})}):(0,a.jsx)("div",{className:"flex flex-col gap-4",children:e.map(e=>(0,a.jsx)(h,{combo:e,copied:y,onCopy:v,onEdit:()=>m(e),onDelete:()=>C(e.id),roundRobinEnabled:b[e.name]?.fallbackStrategy==="round-robin",onToggleRoundRobin:t=>S(e.name,t)},e.id))}),(0,a.jsx)(p,{isOpen:o,onClose:()=>i(!1),onSave:N,activeProviders:x},"create"),(0,a.jsx)(p,{isOpen:!!n,combo:n,onClose:()=>m(null),onSave:e=>k(n.id,e),activeProviders:x},n?.id||"new"),(0,a.jsx)(c.uo,{isOpen:!!g,onClose:()=>j(null),onConfirm:g?.onConfirm,title:g?.title||"Confirm",message:g?.message,variant:"danger"})]})}function h({combo:e,copied:t,onCopy:s,onEdit:l,onDelete:r,roundRobinEnabled:o,onToggleRoundRobin:i}){return(0,a.jsx)(c.Zp,{padding:"sm",className:"group",children:(0,a.jsxs)("div",{className:"flex min-w-0 flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[(0,a.jsxs)("div",{className:"flex min-w-0 flex-1 items-start gap-3 sm:items-center",children:[(0,a.jsx)("div",{className:"size-8 rounded-lg bg-primary/10 flex items-center justify-center shrink-0",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-primary text-[18px]",children:"layers"})}),(0,a.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,a.jsx)("code",{className:"block truncate font-mono text-sm font-medium",children:e.name}),(0,a.jsxs)("div",{className:"mt-1 flex min-w-0 flex-wrap items-center gap-1",children:[0===e.models.length?(0,a.jsx)("span",{className:"text-xs text-text-muted italic",children:"No models"}):e.models.slice(0,3).map((e,t)=>(0,a.jsx)("code",{className:"max-w-full truncate rounded bg-black/5 px-1.5 py-0.5 font-mono text-[10px] text-text-muted dark:bg-white/5 sm:max-w-[220px]",children:e},t)),e.models.length>3&&(0,a.jsxs)("span",{className:"text-[10px] text-text-muted",children:["+",e.models.length-3," more"]})]})]})]}),(0,a.jsxs)("div",{className:"flex w-full flex-col gap-2 sm:w-auto sm:flex-row sm:items-center sm:gap-3 sm:shrink-0",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between gap-1.5 rounded-lg bg-black/[0.02] px-2 py-1.5 dark:bg-white/[0.02] sm:justify-start sm:bg-transparent sm:px-0 sm:py-0 sm:dark:bg-transparent",children:[(0,a.jsx)("span",{className:"text-xs text-text-muted font-medium",children:"Round Robin"}),(0,a.jsx)(c.lM,{size:"sm",checked:o,onChange:i})]}),(0,a.jsxs)("div",{className:"grid grid-cols-3 gap-1 sm:flex",children:[(0,a.jsxs)("button",{onClick:t=>{t.stopPropagation(),s(e.name,`combo-${e.id}`)},className:"flex flex-col items-center rounded px-2 py-1 text-text-muted transition-colors hover:bg-black/5 hover:text-primary dark:hover:bg-white/5",title:"Copy combo name",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:t===`combo-${e.id}`?"check":"content_copy"}),(0,a.jsx)("span",{className:"text-[10px] leading-tight",children:"Copy"})]}),(0,a.jsxs)("button",{onClick:l,className:"flex flex-col items-center rounded px-2 py-1 text-text-muted transition-colors hover:bg-black/5 hover:text-primary dark:hover:bg-white/5",title:"Edit",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"edit"}),(0,a.jsx)("span",{className:"text-[10px] leading-tight",children:"Edit"})]}),(0,a.jsxs)("button",{onClick:r,className:"flex flex-col items-center rounded px-2 py-1 text-red-500 transition-colors hover:bg-red-500/10",title:"Delete",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"delete"}),(0,a.jsx)("span",{className:"text-[10px] leading-tight",children:"Delete"})]})]})]})]})})}function u({id:e,index:t,model:s,isFirst:r,isLast:n,onEdit:c,onMoveUp:d,onMoveDown:m,onRemove:x}){let{attributes:h,listeners:p,setNodeRef:b,transform:f,isDragging:g}=(0,o.gl)({id:e}),j={transform:i.Ks.Transform.toString(f),opacity:g?.4:1,zIndex:g?999:void 0},[y,v]=(0,l.useState)(!1),[w,N]=(0,l.useState)(s),k=()=>{let e=w.trim();e&&e!==s?c(e):N(s),v(!1)};return(0,a.jsxs)("div",{ref:b,style:j,className:`group flex min-w-0 items-center gap-1.5 rounded-md px-2 py-1 bg-black/[0.02] hover:bg-black/[0.04] dark:bg-white/[0.02] dark:hover:bg-white/[0.04] transition-colors ${g?"shadow-md ring-1 ring-primary/30":""}`,children:[(0,a.jsx)("button",{...h,...p,type:"button",className:"cursor-grab touch-none p-0.5 rounded text-text-muted hover:text-primary active:cursor-grabbing shrink-0",title:"Drag to reorder",children:(0,a.jsxs)("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"currentColor",children:[(0,a.jsx)("circle",{cx:"9",cy:"4",r:"2"}),(0,a.jsx)("circle",{cx:"15",cy:"4",r:"2"}),(0,a.jsx)("circle",{cx:"9",cy:"12",r:"2"}),(0,a.jsx)("circle",{cx:"15",cy:"12",r:"2"}),(0,a.jsx)("circle",{cx:"9",cy:"20",r:"2"}),(0,a.jsx)("circle",{cx:"15",cy:"20",r:"2"})]})}),(0,a.jsx)("span",{className:"text-[10px] font-medium text-text-muted w-3 text-center shrink-0",children:t+1}),y?(0,a.jsx)("input",{autoFocus:!0,value:w,onChange:e=>N(e.target.value),onBlur:k,onKeyDown:e=>{"Enter"===e.key&&k(),"Escape"===e.key&&(N(s),v(!1))},className:"min-w-0 flex-1 rounded border border-primary/40 bg-white px-1.5 py-0.5 font-mono text-xs text-text-main outline-none dark:bg-black/20"}):(0,a.jsx)("div",{className:"min-w-0 flex-1 cursor-text truncate rounded px-1.5 py-0.5 font-mono text-xs text-text-main hover:bg-black/5 dark:hover:bg-white/5",onClick:()=>v(!0),title:"Click to edit",children:s}),(0,a.jsxs)("div",{className:"flex shrink-0 items-center gap-0.5",children:[(0,a.jsx)("button",{onClick:d,disabled:r,className:`p-0.5 rounded ${r?"text-text-muted/20 cursor-not-allowed":"text-text-muted hover:text-primary hover:bg-black/5 dark:hover:bg-white/5"}`,title:"Move up",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[12px]",children:"arrow_upward"})}),(0,a.jsx)("button",{onClick:m,disabled:n,className:`p-0.5 rounded ${n?"text-text-muted/20 cursor-not-allowed":"text-text-muted hover:text-primary hover:bg-black/5 dark:hover:bg-white/5"}`,title:"Move down",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[12px]",children:"arrow_downward"})})]}),(0,a.jsx)("button",{onClick:x,className:"p-0.5 hover:bg-red-500/10 rounded text-text-muted hover:text-red-500 transition-all",title:"Remove",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[12px]",children:"close"})})]})}function p({isOpen:e,combo:t,onClose:s,onSave:i,activeProviders:d,kindFilter:x=null}){let[h,b]=(0,l.useState)(t?.name||""),[f,g]=(0,l.useState)(t?.models||[]),[j,y]=(0,l.useState)(!1),[v,w]=(0,l.useState)(!1),[N,k]=(0,l.useState)(""),[C,S]=(0,l.useState)({}),E=(0,r.FR)((0,r.MS)(r.AN,{activationConstraint:{distance:5}}),(0,r.MS)(r.uN,{coordinateGetter:o.JR})),O=f.map((e,t)=>({uid:`item-${t}`,model:e})),_=async()=>{try{let e=await fetch("/api/models/alias");if(!e.ok)return;let t=await e.json();S(t.aliases||{})}catch(e){console.error("Error fetching modal data:",e)}};(0,l.useEffect)(()=>{e&&_()},[e]);let $=e=>e.trim()?m.test(e)?(k(""),!0):(k("Only letters, numbers, -, _ and . allowed"),!1):(k("Name is required"),!1),D=async()=>{$(h)&&(w(!0),await i({name:h.trim(),models:f}),w(!1))},M=!!t;return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(c.aF,{isOpen:e,onClose:s,title:M?"Edit Combo":"Create Combo",children:(0,a.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)(c.pd,{label:"Combo Name",value:h,onChange:e=>{let t=e.target.value;b(t),t?$(t):k("")},placeholder:"my-combo",error:N}),(0,a.jsx)("p",{className:"text-[10px] text-text-muted mt-0.5",children:"Only letters, numbers, -, _ and . allowed"})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"text-sm font-medium mb-1.5 block",children:"Models"}),0===f.length?(0,a.jsxs)("div",{className:"text-center py-4 border border-dashed border-black/10 dark:border-white/10 rounded-lg bg-black/[0.01] dark:bg-white/[0.01]",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-text-muted text-xl mb-1",children:"layers"}),(0,a.jsx)("p",{className:"text-xs text-text-muted",children:"No models added yet"})]}):(0,a.jsx)(r.Mp,{sensors:E,collisionDetection:r.fp,onDragEnd:e=>{let{active:t,over:s}=e;if(s&&t.id!==s.id){let e=O.findIndex(e=>e.uid===t.id),a=O.findIndex(e=>e.uid===s.id);-1!==e&&-1!==a&&g(t=>(0,o.be)(t,e,a))}},modifiers:[n.FN,n.gj],children:(0,a.jsx)(o.gB,{items:O.map(e=>e.uid),strategy:o._G,children:(0,a.jsx)("div",{className:"flex max-h-[55vh] min-w-0 flex-col gap-1 overflow-y-auto sm:max-h-[350px]",children:O.map(({uid:e,model:t},s)=>(0,a.jsx)(u,{id:e,index:s,model:t,isFirst:0===s,isLast:s===O.length-1,onEdit:e=>{let t=[...f];t[s]=e,g(t)},onMoveUp:()=>(e=>{if(0===e)return;let t=[...f];[t[e-1],t[e]]=[t[e],t[e-1]],g(t)})(s),onMoveDown:()=>(e=>{if(e===f.length-1)return;let t=[...f];[t[e],t[e+1]]=[t[e+1],t[e]],g(t)})(s),onRemove:()=>{g(f.filter((e,t)=>t!==s))}},e))})})}),(0,a.jsxs)("button",{onClick:()=>y(!0),className:"w-full mt-2 py-2 border border-dashed border-black/10 dark:border-white/10 rounded-lg text-xs text-primary font-medium hover:text-primary hover:border-primary/50 transition-colors flex items-center justify-center gap-1",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"add"}),"Add Model"]})]}),(0,a.jsxs)("div",{className:"flex flex-col gap-2 pt-1 sm:flex-row",children:[(0,a.jsx)(c.$n,{onClick:s,variant:"ghost",fullWidth:!0,size:"sm",children:"Cancel"}),(0,a.jsx)(c.$n,{onClick:D,fullWidth:!0,size:"sm",disabled:!h.trim()||!!N||v,children:v?"Saving...":M?"Save":"Create"})]})]})}),(0,a.jsx)(c.rq,{isOpen:j,onClose:()=>y(!1),onSelect:e=>{f.includes(e.value)||g([...f,e.value])},onDeselect:e=>{g(f.filter(t=>t!==e.value))},activeProviders:d,modelAliases:C,title:"Add Model to Combo",kindFilter:x,addedModelValues:f,closeOnSelect:!1})]})}}},e=>{e.O(0,[2574,3862,1051,7055,1321,5497,8441,3794,7358],()=>e(e.s=2525)),_N_E=e.O()}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3471],{64561:(e,t,s)=>{"use strict";s.r(t),s.d(t,{default:()=>j});var a=s(95155),r=s(12115),o=s(73321),i=s(35497),l=s(81127),n=s(21931),d=s(1620),c=s(31474),m=s(90620),x=s(93308),u=s(38202);let p=[{id:"openai",label:"OpenAI / Codex",targets:["api.openai.com","chatgpt.com"]},{id:"anthropic",label:"Anthropic",targets:["api.anthropic.com"]},{id:"google",label:"Google / Gemini",targets:["generativelanguage.googleapis.com","aiplatform.googleapis.com"]},{id:"antigravity",label:"Antigravity",targets:["cloudcode-pa.googleapis.com","daily-cloudcode-pa.googleapis.com","daily-cloudcode-pa.sandbox.googleapis.com"]},{id:"copilot",label:"GitHub Copilot",targets:["api.individual.githubcopilot.com"]},{id:"openrouter",label:"OpenRouter",targets:["openrouter.ai","api.openrouter.ai"]},{id:"cursor",label:"Cursor",targets:["api2.cursor.sh"]},{id:"kiro",label:"Kiro / AWS",targets:["q.us-east-1.amazonaws.com","codewhisperer.us-east-1.amazonaws.com"]}],h=new Set(p.flatMap(e=>e.targets));function b(e){return Array.from(new Set(e.map(e=>String(e||"").trim()).filter(Boolean)))}function g(e,t,s){let a=String(e||"").trim();if(!a||!t&&!s)return a;try{let e=/^[a-z][a-z0-9+.-]*:\/\//i.test(a),r=new URL(e?a:`http://${a}`);return r.username=t||"",r.password=s||"",r.toString()}catch{return a}}function y(e){try{return decodeURIComponent(e||"")}catch{return e||""}}function f(e){let t=String(e||"").trim();if(!t)return{proxyUrl:"",username:"",password:""};try{let e=/^[a-z][a-z0-9+.-]*:\/\//i.test(t),s=new URL(e?t:`http://${t}`),a=y(s.username),r=y(s.password);s.username="",s.password="";let o=e?s.toString():s.toString().replace(/^http:\/\//i,"");return"/"!==s.pathname||s.search||s.hash||(o=o.replace(/\/$/,"")),{proxyUrl:o,username:a,password:r}}catch{return{proxyUrl:t,username:"",password:""}}}function j(){let e=(0,o.useRouter)(),{theme:t,setTheme:s,isDark:y}=(0,d.D)(),[j,w]=(0,r.useState)("en"),[v,N]=(0,r.useState)(!1),[C,P]=(0,r.useState)(!1),[S,k]=(0,r.useState)(!1),[O,I]=(0,r.useState)({fallbackStrategy:"fill-first"}),[U,L]=(0,r.useState)(!0),[T,R]=(0,r.useState)({current:"",new:"",confirm:""}),[A,D]=(0,r.useState)({type:"",message:""}),[$,M]=(0,r.useState)(!1),[E,F]=(0,r.useState)(!1),[q,J]=(0,r.useState)({type:"",message:""}),[_,H]=(0,r.useState)({open:!1,mode:"",password:""}),z=(0,r.useRef)(null),[K,Z]=(0,r.useState)({authMode:"password",oidcIssuerUrl:"",oidcClientId:"",oidcScopes:"openid profile email",oidcLoginLabel:"Sign in with OIDC"}),[B,W]=(0,r.useState)(""),[G,Q]=(0,r.useState)({type:"",message:""}),[V,Y]=(0,r.useState)(!1),[X,ee]=(0,r.useState)(!1),[et,es]=(0,r.useState)({type:"",message:""}),[ea,er]=(0,r.useState)("/api/auth/oidc/callback"),[eo,ei]=(0,r.useState)(!1),el=(0,r.useRef)(null),[en,ed]=(0,r.useState)({outboundProxyEnabled:!1,outboundProxyUrl:"",outboundNoProxy:"",outboundProxyTargets:[],outboundProxyCustomTargets:"",outboundProxyUsername:"",outboundProxyPassword:"",outboundProxySavedUsername:"",outboundProxySavedPassword:""}),[ec,em]=(0,r.useState)({type:"",message:""}),[ex,eu]=(0,r.useState)(!1),[ep,eh]=(0,r.useState)(!1);(0,r.useEffect)(()=>{fetch("/api/auth/me").then(e=>e.json()).then(e=>{"sub_user"===e.role&&(window.location.href="/dashboard/usage")}).catch(()=>{}),w(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)}())},[v]),(0,r.useEffect)(()=>{fetch("/api/settings").then(e=>e.json()).then(e=>{let t=f(e?.outboundProxyUrl);I(e),Z({authMode:e?.authMode||"password",oidcIssuerUrl:e?.oidcIssuerUrl||"",oidcClientId:e?.oidcClientId||"",oidcScopes:e?.oidcScopes||"openid profile email",oidcLoginLabel:e?.oidcLoginLabel||"Sign in with OIDC"}),W(""),(e?.authMode==="oidc"||e?.authMode==="both")&&ei(!0),ed({outboundProxyEnabled:e?.outboundProxyEnabled===!0,outboundProxyUrl:t.proxyUrl,outboundNoProxy:e?.outboundNoProxy||"",outboundProxyTargets:Array.isArray(e?.outboundProxyTargets)?e.outboundProxyTargets:[],outboundProxyCustomTargets:Array.isArray(e?.outboundProxyTargets)?e.outboundProxyTargets.filter(e=>!h.has(e)).join(","):"",outboundProxyUsername:t.username,outboundProxyPassword:"",outboundProxySavedUsername:t.username,outboundProxySavedPassword:t.password}),L(!1)}).catch(e=>{console.error("Failed to fetch settings:",e),L(!1)})},[]),(0,r.useEffect)(()=>{er(`${window.location.origin}/api/auth/oidc/callback`)},[]);let eb=async e=>{if(e.preventDefault(),!0!==O.outboundProxyEnabled)return;eu(!0),em({type:"",message:""});let t=ef(),s=en.outboundProxyPassword||(en.outboundProxyUsername===en.outboundProxySavedUsername?en.outboundProxySavedPassword:""),a=g(en.outboundProxyUrl,en.outboundProxyUsername,s);try{let e=await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({outboundProxyUrl:a,outboundProxyTargets:t})}),s=await e.json();if(e.ok){let e=f(s?.outboundProxyUrl||a);I(e=>({...e,...s})),ed(a=>({...a,outboundProxyUrl:e.proxyUrl,outboundProxyTargets:Array.isArray(s?.outboundProxyTargets)?s.outboundProxyTargets:t,outboundProxyUsername:e.username,outboundProxyPassword:"",outboundProxySavedUsername:e.username,outboundProxySavedPassword:e.password})),em({type:"success",message:"Proxy settings applied"})}else em({type:"error",message:s.error||"Failed to update proxy settings"})}catch(e){em({type:"error",message:"An error occurred"})}finally{eu(!1)}},eg=async()=>{if(!0!==O.outboundProxyEnabled)return;let e=en.outboundProxyPassword||(en.outboundProxyUsername===en.outboundProxySavedUsername?en.outboundProxySavedPassword:""),t=g(en.outboundProxyUrl,en.outboundProxyUsername,e);if(!t)return void em({type:"error",message:"Please enter a Proxy URL to test"});eh(!0),em({type:"",message:""});try{let e=await fetch("/api/settings/proxy-test",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({proxyUrl:t})}),s=await e.json();e.ok&&s?.ok?em({type:"success",message:`Proxy test OK (${s.status}) in ${s.elapsedMs}ms`}):em({type:"error",message:s?.error||"Proxy test failed"})}catch(e){em({type:"error",message:"An error occurred"})}finally{eh(!1)}},ey=async e=>{eu(!0),em({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?(I(e=>({...e,...s})),ed(e=>({...e,outboundProxyEnabled:s?.outboundProxyEnabled===!0})),em({type:"success",message:e?"Proxy enabled":"Proxy disabled"})):em({type:"error",message:s.error||"Failed to update proxy settings"})}catch(e){em({type:"error",message:"An error occurred"})}finally{eu(!1)}},ef=()=>b([...Array.isArray(en.outboundProxyTargets)?en.outboundProxyTargets:[],...b(String(en.outboundProxyCustomTargets||"").split(","))]),ej=async e=>{if(e.preventDefault(),T.new!==T.confirm)return void D({type:"error",message:"Passwords do not match"});M(!0),D({type:"",message:""});try{let e=await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({currentPassword:T.current,newPassword:T.new})}),t=await e.json();e.ok?(D({type:"success",message:"Password updated successfully"}),R({current:"",new:"",confirm:""})):D({type:"error",message:t.error||"Failed to update password"})}catch(e){D({type:"error",message:"An error occurred"})}finally{M(!1)}},ew=async e=>{try{(await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({fallbackStrategy:e})})).ok&&I(t=>({...t,fallbackStrategy:e}))}catch(e){console.error("Failed to update settings:",e)}},ev=async e=>{try{(await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({comboStrategy:e})})).ok&&I(t=>({...t,comboStrategy:e}))}catch(e){console.error("Failed to update combo strategy:",e)}},eN=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&&I(e=>({...e,stickyRoundRobinLimit:t}))}catch(e){console.error("Failed to update sticky limit:",e)}},eC=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&&I(e=>({...e,comboStickyRoundRobinLimit:t}))}catch(e){console.error("Failed to update combo sticky limit:",e)}},eP=async e=>{try{(await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({requireLogin:e})})).ok&&I(t=>({...t,requireLogin:e}))}catch(e){console.error("Failed to update require login:",e)}},eS=(e,t)=>{Z(s=>({...s,[e]:t}))},ek=async(e=K.authMode||"password")=>{let t=K.oidcIssuerUrl.trim(),s=K.oidcClientId.trim(),a=K.oidcScopes.trim(),r=K.oidcLoginLabel.trim(),o=B.trim();if("password"!==e&&(!t||!s||!o)&&!O.oidcConfigured)return void Q({type:"error",message:"Issuer URL, client ID, and client secret are required to enable OIDC."});Y(!0),Q({type:"",message:""}),es({type:"",message:""});try{let i={authMode:e,oidcIssuerUrl:t,oidcClientId:s,oidcScopes:a||"openid profile email",oidcLoginLabel:r||"Sign in with OIDC"};o&&(i.oidcClientSecret=o);let l=await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(i)}),n=await l.json();l.ok?(I(e=>({...e,...n})),Z({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"}),W(""),Q({type:"success",message:"oidc"===e?"OIDC login enabled":"both"===e?"Password and OIDC login enabled":"OIDC settings saved"})):Q({type:"error",message:n.error||"Failed to save OIDC settings"})}catch(e){Q({type:"error",message:"An error occurred"})}finally{Y(!1)}},eO=async()=>{let e=K.oidcIssuerUrl.trim(),t=K.oidcClientId.trim(),s=K.oidcScopes.trim(),a=B.trim();if(!e||!t)return void es({type:"error",message:"Issuer URL and client ID are required to test the connection."});ee(!0),Q({type:"",message:""}),es({type:"",message:""});try{let r=await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({authMode:K.authMode||O.authMode||"password",oidcIssuerUrl:e,oidcClientId:t,oidcScopes:s||"openid profile email",oidcLoginLabel:K.oidcLoginLabel.trim()||"Sign in with OIDC",...a?{oidcClientSecret:a}:{}})}),o=await r.json().catch(()=>({}));if(!r.ok)return void es({type:"error",message:o.error||"Failed to save OIDC settings before testing"});let i=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"})}),l=await i.json().catch(()=>({}));if(i.ok&&l?.ok){let e=l.clientSecretTested?!0===l.clientSecretValid?`Connection OK. Discovery loaded from ${l.issuerUrl}. Client secret validated too.`:`Connection OK. Discovery loaded from ${l.issuerUrl}. Client secret was not checked.`:`Connection OK. Discovery loaded from ${l.issuerUrl}.`;es({type:"success",message:e})}else es({type:"error",message:l.error||"OIDC connection test failed"})}catch(e){es({type:"error",message:"An error occurred"})}finally{ee(!1)}},eI=async e=>{try{(await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({enableObservability:e})})).ok&&I(t=>({...t,enableObservability:e}))}catch(e){console.error("Failed to update enableObservability:",e)}},eU=async()=>{try{let e=await fetch("/api/settings");if(!e.ok)return;let t=await e.json();I(t)}catch(e){console.error("Failed to reload settings:",e)}},eL=async e=>{F(!0),J({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),i=document.createElement("a"),l=new Date().toISOString().replace(/[.:]/g,"-");i.href=o,i.download=`openrouterx-backup-${l}.json`,document.body.appendChild(i),i.click(),document.body.removeChild(i),URL.revokeObjectURL(o),J({type:"success",message:"Database backup downloaded"})}catch(e){J({type:"error",message:e.message||"Failed to export database"})}finally{F(!1)}},eT=async e=>{let t=z.current;if(t){F(!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 eU(),J({type:"success",message:"Database imported successfully"})}catch(e){J({type:"error",message:e.message||"Invalid backup file"})}finally{z.current=null,F(!1)}}},eR=async()=>{let{mode:e,password:t}=_;H({open:!1,mode:"",password:""}),"export"===e?await eL(t):"import"===e&&await eT(t)},eA=!0===O.enableObservability,eD=async()=>{k(!0);try{await fetch("/api/version/shutdown",{method:"POST"})}catch(e){}k(!1),P(!1)},e$=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)(i.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:O.databasePath||"~/.openrouterx/db.json"})]})}),(0,a.jsxs)("div",{className:"flex flex-col sm:flex-row gap-2",children:[(0,a.jsx)(i.$n,{variant:"secondary",icon:"download",onClick:()=>H({open:!0,mode:"export",password:""}),loading:E,className:"w-full sm:w-auto",children:"Download Backup"}),(0,a.jsx)(i.$n,{variant:"outline",icon:"upload",onClick:()=>el.current?.click(),disabled:E,className:"w-full sm:w-auto",children:"Import Backup"}),(0,a.jsx)("input",{ref:el,type:"file",accept:"application/json,.json",className:"hidden",onChange:e=>{let t=e.target.files?.[0];el.current&&(el.current.value=""),t&&(z.current=t,J({type:"",message:""}),H({open:!0,mode:"import",password:""}))}})]}),q.message&&(0,a.jsx)("p",{className:`text-sm ${"error"===q.type?"text-red-500":"text-green-600 dark:text-green-400"}`,children:q.message})]})]}),(0,a.jsxs)(i.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:()=>N(!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:u.h[j]||"\uD83C\uDF10"})]})]}),(0,a.jsxs)(i.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)(i.lM,{checked:!0===O.requireLogin,onChange:()=>eP(!O.requireLogin),disabled:U})]}),!0===O.requireLogin&&(0,a.jsxs)("form",{onSubmit:ej,className:"flex flex-col gap-4 pt-4 border-t border-border/50",children:[O.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)(i.pd,{type:"password",placeholder:"Enter current password",value:T.current,onChange:e=>R({...T,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)(i.pd,{type:"password",placeholder:"Enter new password",value:T.new,onChange:e=>R({...T,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)(i.pd,{type:"password",placeholder:"Confirm new password",value:T.confirm,onChange:e=>R({...T,confirm:e.target.value}),required:!0})]})]}),A.message&&(0,a.jsx)("p",{className:`text-xs sm:text-sm ${"error"===A.type?"text-red-500":"text-green-500"}`,children:A.message}),(0,a.jsx)("div",{className:"pt-2",children:(0,a.jsx)(i.$n,{type:"submit",variant:"primary",loading:$,className:"w-full sm:w-auto",children:O.hasPassword?"Update Password":"Set Password"})})]})]})]}),(0,a.jsxs)(i.Zp,{children:[(0,a.jsxs)("button",{type:"button",onClick:()=>ei(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"===O.authMode?"OIDC active":"both"===O.authMode?"Password + OIDC active":"Optional SSO via Authentik/Keycloak/Google"})]}),(0,a.jsx)("span",{className:"material-symbols-outlined text-text-muted shrink-0",children:eo?"expand_less":"expand_more"})]}),eo&&(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=K.authMode===e.value;return(0,a.jsxs)("button",{type:"button",onClick:()=>eS("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:U||V,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)(i.pd,{placeholder:"https://auth.example.com/application/o/9router/",value:K.oidcIssuerUrl,onChange:e=>eS("oidcIssuerUrl",e.target.value),disabled:U||V})]}),(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)(i.pd,{placeholder:"9router-dashboard",value:K.oidcClientId,onChange:e=>eS("oidcClientId",e.target.value),disabled:U||V})]}),(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)(i.pd,{type:"password",placeholder:"Leave blank to keep existing secret",value:B,onChange:e=>W(e.target.value),disabled:U||V}),(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)(i.pd,{placeholder:"openid profile email",value:K.oidcScopes,onChange:e=>eS("oidcScopes",e.target.value),disabled:U||V})]}),(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)(i.pd,{placeholder:"Sign in with OIDC",value:K.oidcLoginLabel,onChange:e=>eS("oidcLoginLabel",e.target.value),disabled:U||V})]})]}),(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:ea})]}),(0,a.jsxs)("div",{className:"flex flex-col sm:flex-row gap-2 pt-2 border-t border-border/50",children:[(0,a.jsx)(i.$n,{type:"button",variant:"primary",loading:V,onClick:()=>ek(),className:"w-full sm:w-auto",children:"Save auth mode"}),(0,a.jsx)(i.$n,{type:"button",variant:"outline",loading:X,onClick:eO,className:"w-full sm:w-auto",children:"Test connection"})]}),et.message&&(0,a.jsx)("p",{className:`text-xs sm:text-sm ${"error"===et.type?"text-red-500":"text-green-500"}`,children:et.message}),G.message&&(0,a.jsx)("p",{className:`text-xs sm:text-sm ${"error"===G.type?"text-red-500":"text-green-500"}`,children:G.message}),"oidc"===O.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"===O.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)(i.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:"Round Robin"}),(0,a.jsx)("p",{className:"text-xs sm:text-sm text-text-muted",children:"Cycle through accounts to distribute load"})]}),(0,a.jsx)(i.lM,{checked:"round-robin"===O.fallbackStrategy,onChange:()=>ew("round-robin"===O.fallbackStrategy?"fill-first":"round-robin"),disabled:U})]}),"round-robin"===O.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)(i.pd,{type:"number",min:"1",max:"10",value:O.stickyRoundRobinLimit||3,onChange:e=>eN(e.target.value),disabled:U,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)(i.lM,{checked:"round-robin"===O.comboStrategy,onChange:()=>ev("round-robin"===O.comboStrategy?"fallback":"round-robin"),disabled:U})]}),"round-robin"===O.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)(i.pd,{type:"number",min:"1",max:"100",value:O.comboStickyRoundRobinLimit||1,onChange:e=>eC(e.target.value),disabled:U,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"===O.fallbackStrategy?`Currently distributing requests across all available accounts with ${O.stickyRoundRobinLimit||3} calls per account.`:"Currently using accounts in priority order (Fill First).","round-robin"===O.comboStrategy?` Combos rotate after ${O.comboStickyRoundRobinLimit||1} call${1===(O.comboStickyRoundRobinLimit||1)?"":"s"} per model.`:" Combos always start with their first model."]})]})]}),(0,a.jsxs)(i.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)(i.lM,{checked:!0===O.outboundProxyEnabled,onChange:()=>ey(!0!==O.outboundProxyEnabled),disabled:U||ex})]}),!0===O.outboundProxyEnabled&&(0,a.jsxs)("form",{onSubmit:eb,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)(i.pd,{placeholder:"socks5://127.0.0.1:1080",value:en.outboundProxyUrl,onChange:e=>ed(t=>({...t,outboundProxyUrl:e.target.value})),disabled:U||ex}),(0,a.jsx)("p",{className:"text-xs sm:text-sm text-text-muted",children:"Supports http, https, socks4, socks4a, socks5, and socks5h."})]}),(0,a.jsxs)("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3",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 Username"}),(0,a.jsx)(i.pd,{placeholder:"optional",value:en.outboundProxyUsername,onChange:e=>ed(t=>({...t,outboundProxyUsername:e.target.value})),disabled:U||ex})]}),(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 Password"}),(0,a.jsx)(i.pd,{type:"password",placeholder:en.outboundProxySavedPassword?"saved (hidden)":"optional",value:en.outboundProxyPassword,onChange:e=>ed(t=>({...t,outboundProxyPassword:e.target.value})),disabled:U||ex})]})]}),(0,a.jsxs)("div",{className:"flex flex-col gap-3 pt-2 border-t border-border/50",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"font-medium text-sm sm:text-base",children:"Use Proxy For"}),(0,a.jsx)("p",{className:"text-xs sm:text-sm text-text-muted",children:"Default is direct. Checked targets use the proxy."})]}),(0,a.jsx)("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-2",children:p.map(e=>{let t=new Set(en.outboundProxyTargets||[]),s=e.targets.every(e=>t.has(e));return(0,a.jsxs)("label",{className:(0,c.cn)("flex items-center gap-2 rounded-lg border px-3 py-2 text-sm cursor-pointer transition-colors",s?"border-primary bg-primary/5 text-text-main":"border-border bg-surface text-text-muted hover:border-primary/50"),children:[(0,a.jsx)("input",{type:"checkbox",checked:s,onChange:()=>{ed(t=>{let s=new Set(t.outboundProxyTargets||[]),a=e.targets.every(e=>s.has(e));for(let t of e.targets)a?s.delete(t):s.add(t);return{...t,outboundProxyTargets:Array.from(s)}})},disabled:U||ex,className:"h-4 w-4 accent-primary"}),(0,a.jsx)("span",{className:"truncate",children:e.label})]},e.id)})}),(0,a.jsx)("label",{className:"font-medium text-sm sm:text-base",children:"Custom Proxy Hosts"}),(0,a.jsx)(i.pd,{placeholder:"api.example.com,.example.org",value:en.outboundProxyCustomTargets,onChange:e=>ed(t=>({...t,outboundProxyCustomTargets:e.target.value})),disabled:U||ex})]}),(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)(i.$n,{type:"button",variant:"secondary",loading:ep,disabled:U||ex,onClick:eg,className:"w-full sm:w-auto",children:"Test proxy URL"}),(0,a.jsx)(i.$n,{type:"submit",variant:"primary",loading:ex,className:"w-full sm:w-auto",children:"Apply"})]})]}),ec.message&&(0,a.jsx)("p",{className:`text-xs sm:text-sm ${"error"===ec.type?"text-red-500":"text-green-500"} pt-2 border-t border-border/50`,children:ec.message})]})]}),(0,a.jsxs)(i.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)(i.lM,{checked:eA,onChange:eI,disabled:U})]})]}),(0,a.jsxs)("div",{className:"flex flex-col sm:flex-row gap-2",children:[(0,a.jsx)(i.$n,{variant:"outline",fullWidth:!0,icon:"power_settings_new",onClick:()=>P(!0),className:"text-red-500 border-red-200 hover:bg-red-50 hover:border-red-300",children:"Shutdown"}),(0,a.jsx)(i.$n,{variant:"outline",fullWidth:!0,icon:"logout",onClick:e$,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:v,onClose:e=>{N(!1),w(e)}}),(0,a.jsx)(l.ConfirmModal,{isOpen:C,onClose:()=>P(!1),onConfirm:eD,title:"Close Proxy",message:"Are you sure you want to close the proxy server?",confirmText:"Close",cancelText:"Cancel",variant:"danger",loading:S}),(0,a.jsxs)(l.default,{isOpen:_.open,onClose:()=>H({open:!1,mode:"",password:""}),title:"Confirm Password",size:"sm",footer:(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(i.$n,{variant:"ghost",onClick:()=>H({open:!1,mode:"",password:""}),disabled:E,children:"Cancel"}),(0,a.jsx)(i.$n,{variant:"primary",onClick:eR,loading:E,disabled:!_.password,children:"Confirm"})]}),children:[(0,a.jsxs)("p",{className:"text-text-muted mb-3 text-sm",children:["Enter your current password to ","export"===_.mode?"export":"import"," the database."]}),(0,a.jsx)(i.pd,{type:"password",value:_.password,onChange:e=>H(t=>({...t,password:e.target.value})),onKeyDown:e=>{"Enter"===e.key&&_.password&&eR()},placeholder:"Current password",autoFocus:!0})]})]})}},95747:(e,t,s)=>{Promise.resolve().then(s.bind(s,64561))}},e=>{e.O(0,[2574,3862,1051,1321,5497,8441,3794,7358],()=>e(e.s=95747)),_N_E=e.O()}]);
|
package/app/.next/static/chunks/app/(dashboard)/dashboard/providers/[id]/page-a2ec9b595a5c5600.js
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2134],{29610:(e,t,s)=>{Promise.resolve().then(s.bind(s,79326))},79326:(e,t,s)=>{"use strict";s.r(t),s.d(t,{default:()=>O});var a=s(95155),i=s(12115),l=s(73321),r=s(98500),n=s.n(r),o=s(5772),d=s(35497),c=s(52679),p=s(28777),m=s(11059),x=s(73006);let u=new Map;async function h(e){if(!e?.url||!e?.type)return[];let t=u.get(e.url);if(t&&Date.now()<t.expiresAt)return t.data;try{let t=new URLSearchParams({url:e.url,type:e.type}),s=await fetch(`/api/providers/suggested-models?${t}`);if(!s.ok)return[];let a=(await s.json()).data??[];return u.set(e.url,{data:a,expiresAt:Date.now()+6e5}),a}catch{return[]}}var f=s(14051),g=s.n(f);function y({model:e,fullModel:t,displayModel:s,alias:i,copied:l,onCopy:r,testStatus:n,isCustom:o,isFree:d,onDeleteAlias:c,onTest:p,isTesting:m,onDisable:x}){let u="ok"===n?"#22c55e":"error"===n?"#ef4444":void 0;return(0,a.jsx)("div",{className:`group min-w-0 max-w-full rounded-lg border px-3 py-2 ${"ok"===n?"border-green-500/40":"error"===n?"border-red-500/40":"border-border"} hover:bg-sidebar/50`,children:(0,a.jsxs)("div",{className:"flex min-w-0 items-start gap-2 sm:items-center",children:[(0,a.jsx)("span",{className:"material-symbols-outlined shrink-0 text-base",style:u?{color:u}:void 0,children:"ok"===n?"check_circle":"error"===n?"cancel":"smart_toy"}),(0,a.jsxs)("div",{className:"flex min-w-0 flex-1 flex-col gap-1",children:[(0,a.jsx)("code",{className:"max-w-[72vw] truncate rounded bg-sidebar px-1.5 py-0.5 font-mono text-xs text-text-muted sm:max-w-[360px]",children:s||t}),e.name&&(0,a.jsx)("span",{className:"truncate pl-1 text-[9px] italic text-text-muted/70",children:e.name})]}),p&&(0,a.jsxs)("div",{className:"relative shrink-0 group/btn",children:[(0,a.jsx)("button",{onClick:p,disabled:m,className:`rounded p-0.5 text-text-muted transition-opacity hover:bg-sidebar hover:text-primary ${m?"opacity-100":"opacity-100 sm:opacity-0 sm:group-hover:opacity-100"}`,children:(0,a.jsx)("span",{className:"material-symbols-outlined text-sm",style:m?{animation:"spin 1s linear infinite"}:void 0,children:m?"progress_activity":"science"})}),(0,a.jsx)("span",{className:"pointer-events-none absolute mt-1 top-5 left-1/2 -translate-x-1/2 text-[10px] text-text-muted whitespace-nowrap opacity-0 group-hover/btn:opacity-100 transition-opacity",children:m?"Testing...":"Test"})]}),(0,a.jsxs)("div",{className:"relative shrink-0 group/btn",children:[(0,a.jsx)("button",{onClick:()=>r(t,`model-${e.id}`),className:"rounded p-0.5 text-text-muted hover:bg-sidebar hover:text-primary",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-sm",children:l===`model-${e.id}`?"check":"content_copy"})}),(0,a.jsx)("span",{className:"pointer-events-none absolute mt-1 top-5 left-1/2 -translate-x-1/2 text-[10px] text-text-muted whitespace-nowrap opacity-0 group-hover/btn:opacity-100 transition-opacity",children:l===`model-${e.id}`?"Copied!":"Copy"})]}),o?(0,a.jsx)("button",{onClick:c,className:"ml-auto rounded p-0.5 text-text-muted opacity-100 transition-opacity hover:bg-red-500/10 hover:text-red-500 sm:opacity-0 sm:group-hover:opacity-100",title:"Remove custom model",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-sm",children:"close"})}):x?(0,a.jsx)("button",{onClick:x,className:"ml-auto rounded p-0.5 text-text-muted opacity-100 transition-opacity hover:bg-red-500/10 hover:text-red-500 sm:opacity-0 sm:group-hover:opacity-100",title:"Disable this model",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-sm",children:"close"})}):null]})})}function b({modelId:e,fullModel:t,copied:s,onCopy:i,onDeleteAlias:l,onTest:r,testStatus:n,isTesting:o}){let d="ok"===n?"#22c55e":"error"===n?"#ef4444":void 0;return(0,a.jsxs)("div",{className:`flex items-center gap-3 p-3 rounded-lg border ${"ok"===n?"border-green-500/40":"error"===n?"border-red-500/40":"border-border"} hover:bg-sidebar/50`,children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-base text-text-muted",style:d?{color:d}:void 0,children:"ok"===n?"check_circle":"error"===n?"cancel":"smart_toy"}),(0,a.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,a.jsx)("p",{className:"text-sm font-medium truncate",children:e}),(0,a.jsxs)("div",{className:"flex items-center gap-1 mt-1",children:[(0,a.jsx)("code",{className:"text-xs text-text-muted font-mono bg-sidebar px-1.5 py-0.5 rounded",children:t}),(0,a.jsxs)("div",{className:"relative group/btn",children:[(0,a.jsx)("button",{onClick:()=>i(t,`model-${e}`),className:"p-0.5 hover:bg-sidebar rounded text-text-muted hover:text-primary",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-sm",children:s===`model-${e}`?"check":"content_copy"})}),(0,a.jsx)("span",{className:"pointer-events-none absolute top-5 left-1/2 -translate-x-1/2 text-[10px] text-text-muted whitespace-nowrap opacity-0 group-hover/btn:opacity-100 transition-opacity",children:s===`model-${e}`?"Copied!":"Copy"})]}),r&&(0,a.jsxs)("div",{className:"relative group/btn",children:[(0,a.jsx)("button",{onClick:r,disabled:o,className:"p-0.5 hover:bg-sidebar rounded text-text-muted hover:text-primary transition-colors",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-sm",style:o?{animation:"spin 1s linear infinite"}:void 0,children:o?"progress_activity":"science"})}),(0,a.jsx)("span",{className:"pointer-events-none absolute top-5 left-1/2 -translate-x-1/2 text-[10px] text-text-muted whitespace-nowrap opacity-0 group-hover/btn:opacity-100 transition-opacity",children:o?"Testing...":"Test"})]})]})]}),(0,a.jsx)("button",{onClick:l,className:"p-1 hover:bg-red-50 rounded text-red-500",title:"Remove model",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-sm",children:"delete"})})]})}function v({providerStorageAlias:e,providerDisplayAlias:t,modelAliases:s,copied:l,onCopy:r,onSetAlias:n,onDeleteAlias:o,connections:c,isAnthropic:p}){let[m,x]=(0,i.useState)(""),[u,h]=(0,i.useState)(!1),[f,g]=(0,i.useState)(!1),[y,j]=(0,i.useState)(null),[N,w]=(0,i.useState)({}),k=async t=>{if(!y){j(t);try{let s=await fetch("/api/models/test",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({model:`${e}/${t}`})}),a=await s.json();w(e=>({...e,[t]:a.ok?"ok":"error"}))}catch{w(e=>({...e,[t]:"error"}))}finally{j(null)}}},C=Object.entries(s).filter(([,t])=>t.startsWith(`${e}/`)).map(([t,s])=>({modelId:s.replace(`${e}/`,""),fullModel:s,alias:t})),S=a=>{let i,l=`${e}/${a}`;if(Object.values(s).includes(l))return null;let r=(i=a.split("/"))[i.length-1];if(!s[r])return r;let n=`${t}-${r}`;return s[n]?null:n},$=async()=>{if(!m.trim()||u)return;let t=m.trim(),s=S(t);if(!s)return void alert("All suggested aliases already exist. Please choose a different model or remove conflicting aliases.");h(!0);try{await n(t,s,e),x("")}catch(e){console.log("Error adding model:",e)}finally{h(!1)}},A=async()=>{if(f)return;let t=c.find(e=>!1!==e.isActive);if(t){g(!0);try{let s=await fetch(`/api/providers/${t.id}/models`),a=await s.json();if(!s.ok)return void alert(a.error||"Failed to import models");let i=a.models||[];if(0===i.length)return void alert("No models returned from /models.");let l=0;for(let t of i){let s=t.id||t.name||t.model;if(!s)continue;let a=S(s);a&&(await n(s,a,e),l+=1)}0===l&&alert("No new models were added.")}catch(e){console.log("Error importing models:",e)}finally{g(!1)}}},T=c.some(e=>!1!==e.isActive);return(0,a.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,a.jsxs)("p",{className:"text-sm text-text-muted",children:["Add ",p?"Anthropic":"OpenAI","-compatible models manually or import them from the /models endpoint."]}),(0,a.jsxs)("div",{className:"flex items-end gap-2 flex-wrap",children:[(0,a.jsxs)("div",{className:"flex-1 min-w-[240px]",children:[(0,a.jsx)("label",{htmlFor:"new-compatible-model-input",className:"text-xs text-text-muted mb-1 block",children:"Model ID"}),(0,a.jsx)("input",{id:"new-compatible-model-input",type:"text",value:m,onChange:e=>x(e.target.value),onKeyDown:e=>"Enter"===e.key&&$(),placeholder:p?"claude-3-opus-20240229":"gpt-4o",className:"w-full px-3 py-2 text-sm border border-border rounded-lg bg-background focus:outline-none focus:border-primary"})]}),(0,a.jsx)(d.$n,{size:"sm",icon:"add",onClick:$,disabled:!m.trim()||u,children:u?"Adding...":"Add"}),(0,a.jsx)(d.$n,{size:"sm",variant:"secondary",icon:"download",onClick:A,disabled:!T||f,children:f?"Importing...":"Import from /models"})]}),!T&&(0,a.jsx)("p",{className:"text-xs text-text-muted",children:"Add a connection to enable importing models."}),C.length>0&&(0,a.jsx)("div",{className:"flex flex-col gap-3",children:C.map(({modelId:e,fullModel:s,alias:i})=>(0,a.jsx)(b,{modelId:e,fullModel:`${t}/${e}`,copied:l,onCopy:r,onDeleteAlias:()=>o(i),onTest:c.length>0?()=>k(e):void 0,testStatus:N[e],isTesting:y===e},s))})]})}function j({until:e}){let[t,s]=(0,i.useState)("");return((0,i.useEffect)(()=>{let t=()=>{let t=new Date(e).getTime()-Date.now();if(t<=0)return void s("");let a=Math.floor(t/1e3);if(a<60)s(`${a}s`);else if(a<3600)s(`${Math.floor(a/60)}m ${a%60}s`);else{let e=Math.floor(a/3600),t=Math.floor(a%3600/60);s(`${e}h ${t}m`)}};t();let a=setInterval(t,1e3);return()=>clearInterval(a)},[e]),t)?(0,a.jsxs)("span",{className:"text-xs text-orange-500 font-mono",children:["⏱ ",t]}):null}function N({connection:e,proxyPools:t,isOAuth:s,isFirst:l,isLast:r,onMoveUp:n,onMoveDown:o,onToggleActive:c,onUpdateProxy:p,onEdit:m,onDelete:x,oneByOneStatus:u=null}){let[h,f]=(0,i.useState)(!1),[g,y]=(0,i.useState)(!1),b=(0,i.useRef)(null),v=new Map((t||[]).map(e=>[e.id,e])),w=e.providerSpecificData?.proxyPoolId||null,k=w?v.get(w):null,C=e.providerSpecificData?.connectionProxyEnabled===!0&&!!e.providerSpecificData?.connectionProxyUrl,S=!!w||C,$=k?`Pool: ${k.name}`:w?`Pool: ${w} (inactive/missing)`:C?`Legacy: ${e.providerSpecificData?.connectionProxyUrl}`:"",A="";if(k?.proxyUrl||e.providerSpecificData?.connectionProxyUrl){let t=k?.proxyUrl||e.providerSpecificData?.connectionProxyUrl;try{let e=new URL(t);A=`${e.protocol}//${e.hostname}${e.port?`:${e.port}`:""}`}catch{A=t}}let T=k?.noProxy||e.providerSpecificData?.connectionNoProxy||"",O="default";k?.isActive===!0?O="success":(w||C)&&(O="error"),(0,i.useEffect)(()=>{if(!h)return;let e=e=>{b.current&&!b.current.contains(e.target)&&f(!1)};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[h]);let P=async e=>{y(!0);try{await p("__none__"===e?null:e)}finally{y(!1),f(!1)}},I=e.authType||(s?"oauth":"apikey"),E="oauth"===I,R="cookie"===I,_=e=>"string"==typeof e&&/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(e),U=E?_(e.email)?e.email:_(e.name)?e.name:e.name||e.email||e.displayName||"OAuth Account":e.name||e.email||e.displayName||"API Key",[D,z]=(0,i.useState)(!1),q=Object.entries(e).filter(([e])=>e.startsWith("modelLock_")).map(([,e])=>e).filter(e=>!!e).sort()[0]||null;(0,i.useEffect)(()=>{let t=()=>{z(!!Object.entries(e).filter(([e])=>e.startsWith("modelLock_")).map(([,e])=>e).filter(e=>e&&new Date(e).getTime()>Date.now()).sort()[0])};t();let s=q?setInterval(t,1e3):null;return()=>{s&&clearInterval(s)}},[q]);let M="unavailable"!==e.testStatus||D?e.testStatus:"active",F=()=>u?"queued"===u.state?"queued":"testing"===u.state?"testing":"success"===u.state?"success":"failed"===u.state?u.error?`failed: ${u.error}`:"failed":null:null;return(0,a.jsxs)("div",{className:`group flex min-w-0 flex-col gap-3 rounded-lg p-2 transition-colors hover:bg-black/[0.02] dark:hover:bg-white/[0.02] sm:flex-row sm:items-center sm:justify-between ${!1===e.isActive?"opacity-60":""}`,children:[(0,a.jsxs)("div",{className:"flex min-w-0 flex-1 items-start gap-2 sm:items-center sm:gap-3",children:[(0,a.jsxs)("div",{className:"flex shrink-0 flex-col",children:[(0,a.jsx)("button",{onClick:n,disabled:l,className:`p-0.5 rounded ${l?"text-text-muted/30 cursor-not-allowed":"hover:bg-sidebar text-text-muted hover:text-primary"}`,children:(0,a.jsx)("span",{className:"material-symbols-outlined text-sm",children:"keyboard_arrow_up"})}),(0,a.jsx)("button",{onClick:o,disabled:r,className:`p-0.5 rounded ${r?"text-text-muted/30 cursor-not-allowed":"hover:bg-sidebar text-text-muted hover:text-primary"}`,children:(0,a.jsx)("span",{className:"material-symbols-outlined text-sm",children:"keyboard_arrow_down"})})]}),(0,a.jsx)("span",{className:"material-symbols-outlined shrink-0 text-base text-text-muted",children:R?"cookie":E?"lock":"key"}),(0,a.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,a.jsx)("p",{className:"text-sm font-medium truncate",children:U}),(0,a.jsxs)("div",{className:"mt-1 flex min-w-0 flex-wrap items-center gap-1.5 sm:gap-2",children:[(0,a.jsx)(d.Ex,{variant:!1===e.isActive?"default":"active"===M||"success"===M?"success":"error"===M||"expired"===M||"unavailable"===M?"error":"default",size:"sm",dot:!0,children:!1===e.isActive?"disabled":M||"Unknown"}),(0,a.jsx)(d.Ex,{variant:"default",size:"sm",children:E?"OAuth":R?"Cookie":"API Key"}),S&&(0,a.jsx)(d.Ex,{variant:O,size:"sm",children:"Proxy"}),D&&!1!==e.isActive&&(0,a.jsx)(j,{until:q}),e.lastError&&!1!==e.isActive&&(0,a.jsx)("span",{className:"max-w-full truncate text-xs text-red-500 sm:max-w-[300px]",title:e.lastError,children:e.lastError}),(0,a.jsxs)("span",{className:"text-xs text-text-muted",children:["#",e.priority]}),e.globalPriority&&(0,a.jsxs)("span",{className:"text-xs text-text-muted",children:["Auto: ",e.globalPriority]}),F()&&(0,a.jsx)(d.Ex,{variant:u?"success"===u.state?"success":"failed"===u.state?"error":"testing"===u.state?"primary":"default":"default",size:"sm",children:F()})]}),S&&(0,a.jsxs)("div",{className:"mt-1 flex items-center gap-2 flex-wrap",children:[(0,a.jsx)("span",{className:"max-w-full truncate text-[11px] text-text-muted sm:max-w-[420px]",title:$,children:$}),A&&(0,a.jsx)("code",{className:"max-w-full truncate rounded bg-black/5 px-1 py-0.5 font-mono text-[10px] text-text-muted dark:bg-white/5 sm:max-w-[260px]",children:A}),T&&(0,a.jsxs)("span",{className:"max-w-full truncate text-[11px] text-text-muted sm:max-w-[320px]",title:T,children:["no_proxy: ",T]})]})]})]}),(0,a.jsxs)("div",{className:"flex w-full items-center justify-between gap-2 sm:w-auto sm:justify-end",children:[(0,a.jsxs)("div",{className:"grid flex-1 grid-cols-3 gap-1 sm:flex sm:flex-none",children:[(t||[]).length>0&&(0,a.jsxs)("div",{className:"relative",ref:b,children:[(0,a.jsxs)("button",{onClick:()=>f(e=>!e),className:`flex w-full flex-col items-center rounded px-2 py-1 transition-colors hover:bg-black/5 dark:hover:bg-white/5 ${S?"text-primary":"text-text-muted hover:text-primary"}`,disabled:g,children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:g?"progress_activity":"lan"}),(0,a.jsx)("span",{className:"text-[10px] leading-tight",children:"Proxy"})]}),h&&(0,a.jsxs)("div",{className:"absolute right-0 top-full z-50 mt-1 max-w-[78vw] min-w-[160px] rounded-lg border border-border bg-bg py-1 shadow-lg",children:[(0,a.jsx)("button",{onClick:()=>P("__none__"),className:`w-full text-left px-3 py-1.5 text-sm hover:bg-black/5 dark:hover:bg-white/5 ${!w?"text-primary font-medium":"text-text-main"}`,children:"None"}),(t||[]).map(e=>(0,a.jsx)("button",{onClick:()=>P(e.id),className:`w-full text-left px-3 py-1.5 text-sm hover:bg-black/5 dark:hover:bg-white/5 ${w===e.id?"text-primary font-medium":"text-text-main"}`,children:e.name},e.id))]})]}),(0,a.jsxs)("button",{onClick:m,className:"flex flex-col items-center rounded px-2 py-1 text-text-muted hover:bg-black/5 hover:text-primary dark:hover:bg-white/5",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"edit"}),(0,a.jsx)("span",{className:"text-[10px] leading-tight",children:"Edit"})]}),(0,a.jsxs)("button",{onClick:x,className:"flex flex-col items-center rounded px-2 py-1 text-red-500 hover:bg-red-500/10",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"delete"}),(0,a.jsx)("span",{className:"text-[10px] leading-tight",children:"Delete"})]})]}),(0,a.jsx)(d.lM,{size:"sm",checked:e.isActive??!0,onChange:c,title:e.isActive??!0?"Disable connection":"Enable connection"})]})]})}y.propTypes={model:g().shape({id:g().string.isRequired}).isRequired,fullModel:g().string.isRequired,displayModel:g().string,alias:g().string,copied:g().string,onCopy:g().func.isRequired,testStatus:g().oneOf(["ok","error"]),isCustom:g().bool,isFree:g().bool,onDeleteAlias:g().func,onTest:g().func,isTesting:g().bool,onDisable:g().func},g().string.isRequired,g().string.isRequired,g().string,g().func.isRequired,g().func.isRequired,g().func,g().oneOf(["ok","error"]),g().bool,g().string.isRequired,g().object.isRequired,g().string,g().func.isRequired,g().func.isRequired,g().func.isRequired,v.propTypes={providerStorageAlias:g().string.isRequired,providerDisplayAlias:g().string.isRequired,modelAliases:g().object.isRequired,copied:g().string,onCopy:g().func.isRequired,onSetAlias:g().func.isRequired,onDeleteAlias:g().func.isRequired,connections:g().arrayOf(g().shape({id:g().string,isActive:g().bool})).isRequired,isAnthropic:g().bool},j.propTypes={until:g().string.isRequired},N.propTypes={connection:g().shape({id:g().string,name:g().string,email:g().string,displayName:g().string,modelLockUntil:g().string,testStatus:g().string,isActive:g().bool,lastError:g().string,priority:g().number,globalPriority:g().number}).isRequired,proxyPools:g().arrayOf(g().shape({id:g().string,name:g().string,proxyUrl:g().string,noProxy:g().string,isActive:g().bool})),isOAuth:g().bool.isRequired,isFirst:g().bool.isRequired,isLast:g().bool.isRequired,onMoveUp:g().func.isRequired,onMoveDown:g().func.isRequired,onToggleActive:g().func.isRequired,onUpdateProxy:g().func,onEdit:g().func.isRequired,onDelete:g().func.isRequired,oneByOneStatus:g().shape({state:g().string,error:g().string})};let w=`Production|sk-...
|
|
2
|
+
Backup|sk-...
|
|
3
|
+
sk-...`;function k({isOpen:e,provider:t,providerName:s,isCompatible:l,isAnthropic:r,authType:n,authHint:o,website:p,proxyPools:m,onSave:x,onBulkDone:u,onClose:h}){let f="__none__",g="ollama-local"===t,y="cookie"===n,b="xai"===t&&!y,v=y?"Cookie Value":"API Key",j=y?"grok-web"===t?"sso=xxxxx... or just the raw value":"eyJhbGciOi...":b?"xai-...":"",N="azure"===t,C="cloudflare-ai"===t,S=c.Q2?.[t]?.regions||null,$=c.Q2?.[t]?.defaultRegion||S?.[0]?.id||"",[A,T]=(0,i.useState)({name:"",apiKey:"",priority:1,proxyPoolId:f,ollamaHostUrl:""}),[O,P]=(0,i.useState)({azureEndpoint:"",apiVersion:"2024-10-01-preview",deployment:"",organization:""}),[I,E]=(0,i.useState)({accountId:""}),[R,_]=(0,i.useState)($),[U,D]=(0,i.useState)(!1),[z,q]=(0,i.useState)(null),[M,F]=(0,i.useState)(!1),[J,K]=(0,i.useState)("single"),[L,W]=(0,i.useState)(""),[B,H]=(0,i.useState)(null),V=g?"Ollama Local":y?`${s||t} Cookie`:"Production Key";(0,i.useEffect)(()=>{e&&(T({name:l?V:"",apiKey:"",priority:1,proxyPoolId:f,ollamaHostUrl:""}),P({azureEndpoint:"",apiVersion:"2024-10-01-preview",deployment:"",organization:""}),E({accountId:""}),D(!1),q(null),F(!1),K("single"),W(""),H(null))},[V,l,e]);let G=()=>g&&A.ollamaHostUrl.trim()?{baseUrl:A.ollamaHostUrl.trim()}:N?{azureEndpoint:O.azureEndpoint,apiVersion:O.apiVersion,deployment:O.deployment,organization:O.organization}:C?{accountId:I.accountId}:S&&R?{region:R}:void 0,Q=async()=>{D(!0);try{let e=await fetch("/api/providers/validate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:t,apiKey:A.apiKey,providerSpecificData:G()})}),s=await e.json();q(s.valid?"success":"failed")}catch{q("failed")}finally{D(!1)}},Z=async()=>{if(!t||!g&&!A.apiKey)return;let e=A.name.trim()||V;F(!0);try{let s=!1;try{D(!0),q(null);let e=await fetch("/api/providers/validate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:t,apiKey:A.apiKey,providerSpecificData:G()})});s=!!(await e.json()).valid,q(s?"success":"failed")}catch{q("failed")}finally{D(!1)}await x({name:e,apiKey:A.apiKey,priority:A.priority,proxyPoolId:A.proxyPoolId===f?null:A.proxyPoolId,testStatus:s?"active":"unknown",providerSpecificData:G()})}finally{F(!1)}},X=async()=>{let e=L.split("\n").map(e=>e.trim()).filter(Boolean);if(!e.length)return;F(!0),H(null);let s=0,a=0;for(let i=0;i<e.length;i++){let l=e[i].split("|"),r=l.length>=2?l.slice(1).join("|").trim():l[0].trim(),n=l.length>=2?l[0].trim():"Key",o=`${n} ${i+1}`;try{(await fetch("/api/providers",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:t,apiKey:r,name:o,priority:1,testStatus:"unknown"})})).ok?s++:a++}catch{a++}}F(!1),H({success:s,failed:a}),s>0&&u&&u()};return t?(0,a.jsx)(d.aF,{isOpen:e,title:`Add ${s||t} ${v}`,onClose:h,children:(0,a.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsx)(d.$n,{size:"sm",variant:"single"===J?"primary":"ghost",onClick:()=>{K("single"),H(null)},children:"Single"}),(0,a.jsx)(d.$n,{size:"sm",variant:"bulk"===J?"primary":"ghost",onClick:()=>{K("bulk"),H(null)},children:"Bulk Add"})]}),"bulk"===J&&(0,a.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,a.jsxs)("p",{className:"text-xs text-text-muted",children:["One key per line. Format: ",(0,a.jsx)("code",{children:"name|apiKey"})," or just ",(0,a.jsx)("code",{children:"apiKey"})," (auto-named by index)."]}),(0,a.jsx)("textarea",{className:"w-full rounded border border-accent/30 bg-sidebar p-2 text-sm font-mono resize-y min-h-[140px] focus:outline-none focus:ring-1 focus:ring-primary",placeholder:w,value:L,onChange:e=>W(e.target.value)}),B&&(0,a.jsxs)("div",{className:`text-sm font-medium ${B.failed>0?"text-yellow-400":"text-green-400"}`,children:["✓ ",B.success," added",B.failed>0?`, ✗ ${B.failed} failed`:""]}),(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsx)(d.$n,{onClick:X,fullWidth:!0,disabled:M||!L.trim(),children:M?"Adding...":"Add All Keys"}),(0,a.jsx)(d.$n,{onClick:h,variant:"ghost",fullWidth:!0,children:"Cancel"})]})]}),"single"===J&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(d.pd,{label:"Name",value:A.name,onChange:e=>T({...A,name:e.target.value}),placeholder:V}),g&&(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsx)(d.pd,{label:"Ollama Host URL",value:A.ollamaHostUrl,onChange:e=>T({...A,ollamaHostUrl:e.target.value}),placeholder:"http://localhost:11434",className:"flex-1"}),(0,a.jsx)("div",{className:"pt-6",children:(0,a.jsx)(d.$n,{onClick:Q,disabled:U||M,variant:"secondary",children:U?"Checking...":"Check"})})]}),!g&&(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsx)(d.pd,{label:v,type:y?"text":"password",value:A.apiKey,onChange:e=>T({...A,apiKey:e.target.value}),placeholder:j,className:"flex-1"}),(0,a.jsx)("div",{className:"pt-6",children:(0,a.jsx)(d.$n,{onClick:Q,disabled:!A.apiKey||U||M,variant:"secondary",children:U?"Checking...":"Check"})})]}),b&&(0,a.jsx)("p",{className:"text-xs text-text-muted",children:"Use a direct xAI API key from console.x.ai. This is separate from Grok Build OAuth."}),y&&o&&(0,a.jsxs)("p",{className:"text-xs text-text-muted",children:[o,p&&(0,a.jsxs)(a.Fragment,{children:[" ",(0,a.jsxs)("a",{href:p,target:"_blank",rel:"noopener noreferrer",className:"text-primary underline",children:["Open ",p.replace(/^https?:\/\//,"")]})]})]}),S&&(0,a.jsx)(d.l6,{label:"Region",value:R,onChange:e=>_(e.target.value),options:S.map(e=>({value:e.id,label:e.label}))}),l&&(0,a.jsx)(d.pd,{label:"Default Model",value:A.defaultModel,onChange:e=>T({...A,defaultModel:e.target.value}),placeholder:r?"claude-3-5-sonnet-latest":"gpt-4o-mini"}),g&&(0,a.jsxs)("p",{className:"text-xs text-text-muted",children:["Leave blank to use ",(0,a.jsx)("code",{children:"http://localhost:11434"}),". For remote Ollama, enter the full host URL (e.g. ",(0,a.jsx)("code",{children:"http://192.168.1.10:11434"}),")."]}),z&&(0,a.jsx)(d.Ex,{variant:"success"===z?"success":"error",children:"success"===z?"Valid":"Invalid"}),l&&(0,a.jsx)("p",{className:"text-xs text-text-muted",children:r?`Validation checks ${s||"Anthropic Compatible"} by verifying the API key.`:`Validation checks ${s||"OpenAI Compatible"} via /models on your base URL.`}),C&&(0,a.jsxs)("div",{className:"bg-sidebar/50 p-4 rounded-lg border border-accent/20",children:[(0,a.jsx)("h3",{className:"font-semibold mb-3 text-sm",children:"Cloudflare Workers AI"}),(0,a.jsx)(d.pd,{label:"Account ID",value:I.accountId,onChange:e=>E({...I,accountId:e.target.value}),placeholder:"abc123def456..."}),(0,a.jsxs)("p",{className:"text-xs text-text-muted mt-2",children:["Find your Account ID in the right sidebar of ",(0,a.jsx)("a",{href:"https://dash.cloudflare.com",target:"_blank",rel:"noopener noreferrer",className:"text-primary underline",children:"dash.cloudflare.com"})]})]}),N&&(0,a.jsxs)("div",{className:"bg-sidebar/50 p-4 rounded-lg border border-accent/20",children:[(0,a.jsx)("h3",{className:"font-semibold mb-3 text-sm",children:"Azure OpenAI Configuration"}),(0,a.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,a.jsx)(d.pd,{label:"Azure Endpoint",value:O.azureEndpoint,onChange:e=>P({...O,azureEndpoint:e.target.value}),placeholder:"https://your-resource.openai.azure.com"}),(0,a.jsx)(d.pd,{label:"Deployment Name",value:O.deployment,onChange:e=>P({...O,deployment:e.target.value}),placeholder:"gpt-4"}),(0,a.jsx)(d.pd,{label:"API Version",value:O.apiVersion,onChange:e=>P({...O,apiVersion:e.target.value}),placeholder:"2024-10-01-preview"}),(0,a.jsx)(d.pd,{label:"Organization",value:O.organization,onChange:e=>P({...O,organization:e.target.value}),placeholder:"Organization ID"})]})]}),(0,a.jsx)(d.pd,{label:"Priority",type:"number",value:A.priority,onChange:e=>T({...A,priority:Number.parseInt(e.target.value)||1})}),(0,a.jsx)(d.l6,{label:"Proxy Pool",value:A.proxyPoolId,onChange:e=>T({...A,proxyPoolId:e.target.value}),options:[{value:f,label:"None"},...(m||[]).map(e=>({value:e.id,label:e.name}))],placeholder:"None"}),0===(m||[]).length&&(0,a.jsx)("p",{className:"text-xs text-text-muted",children:"No active proxy pools available. Create one in Proxy Pools page first."}),(0,a.jsx)("p",{className:"text-xs text-text-muted",children:"Legacy manual proxy fields are still accepted by API for backward compatibility."}),(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsx)(d.$n,{onClick:Z,fullWidth:!0,disabled:M||!g&&!A.apiKey||N&&(!O.azureEndpoint||!O.deployment||!O.organization)||C&&!I.accountId,children:M?"Saving...":"Save"}),(0,a.jsx)(d.$n,{onClick:h,variant:"ghost",fullWidth:!0,children:"Cancel"})]})]})]})}):null}function C({isOpen:e,node:t,onSave:s,onClose:l,isAnthropic:r}){let[n,o]=(0,i.useState)({name:"",prefix:"",apiType:"chat",baseUrl:"https://api.openai.com/v1"}),[c,p]=(0,i.useState)(!1),[m,x]=(0,i.useState)(""),[u,h]=(0,i.useState)(""),[f,g]=(0,i.useState)(!1),[y,b]=(0,i.useState)(null);(0,i.useEffect)(()=>{t&&o({name:t.name||"",prefix:t.prefix||"",apiType:t.apiType||"chat",baseUrl:t.baseUrl||(r?"https://api.anthropic.com/v1":"https://api.openai.com/v1")})},[t,r]);let v=async()=>{if(n.name.trim()&&n.prefix.trim()&&n.baseUrl.trim()){p(!0);try{let e={name:n.name,prefix:n.prefix,baseUrl:n.baseUrl};r||(e.apiType=n.apiType),await s(e)}finally{p(!1)}}},j=async()=>{g(!0);try{let e=await fetch("/api/provider-nodes/validate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({baseUrl:n.baseUrl,apiKey:m,type:r?"anthropic-compatible":"openai-compatible",modelId:u.trim()||void 0})}),t=await e.json();b(t.valid?"success":"failed")}catch{b("failed")}finally{g(!1)}};return t?(0,a.jsx)(d.aF,{isOpen:e,title:`Edit ${r?"Anthropic":"OpenAI"} Compatible`,onClose:l,children:(0,a.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,a.jsx)(d.pd,{label:"Name",value:n.name,onChange:e=>o({...n,name:e.target.value}),placeholder:`${r?"Anthropic":"OpenAI"} Compatible (Prod)`,hint:"Required. A friendly label for this node."}),(0,a.jsx)(d.pd,{label:"Prefix",value:n.prefix,onChange:e=>o({...n,prefix:e.target.value}),placeholder:r?"ac-prod":"oc-prod",hint:"Required. Used as the provider prefix for model IDs."}),!r&&(0,a.jsx)(d.l6,{label:"API Type",options:[{value:"chat",label:"Chat Completions"},{value:"responses",label:"Responses API"}],value:n.apiType,onChange:e=>o({...n,apiType:e.target.value})}),(0,a.jsx)(d.pd,{label:"Base URL",value:n.baseUrl,onChange:e=>o({...n,baseUrl:e.target.value}),placeholder:r?"https://api.anthropic.com/v1":"https://api.openai.com/v1",hint:`Use the base URL (ending in /v1) for your ${r?"Anthropic":"OpenAI"}-compatible API.`}),(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsx)(d.pd,{label:"API Key (for Check)",type:"password",value:m,onChange:e=>x(e.target.value),className:"flex-1"}),(0,a.jsx)("div",{className:"pt-6",children:(0,a.jsx)(d.$n,{onClick:j,disabled:!m||f||!n.baseUrl.trim(),variant:"secondary",children:f?"Checking...":"Check"})})]}),(0,a.jsx)(d.pd,{label:"Model ID (optional)",value:u,onChange:e=>h(e.target.value),placeholder:"e.g. my-model-id",hint:"If provider lacks /models endpoint, enter a model ID to validate via chat/completions instead."}),y&&(0,a.jsx)(d.Ex,{variant:"success"===y?"success":"error",children:"success"===y?"Valid":"Invalid"}),(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsx)(d.$n,{onClick:v,fullWidth:!0,disabled:!n.name.trim()||!n.prefix.trim()||!n.baseUrl.trim()||c,children:c?"Saving...":"Save"}),(0,a.jsx)(d.$n,{onClick:l,variant:"ghost",fullWidth:!0,children:"Cancel"})]})]})}):null}function S({isOpen:e,providerAlias:t,providerDisplayAlias:s,onSave:l,onClose:r}){var n;let o,[c,p]=(0,i.useState)(""),[m,x]=(0,i.useState)(null),[u,h]=(0,i.useState)(""),[f,g]=(0,i.useState)(!1);(0,i.useEffect)(()=>{e&&(p(""),x(null),h(""),g(!1))},[e]);let y=(n=c.trim(),o=`${t}/`,n.startsWith(o)?n.slice(o.length):n),b=async()=>{if(y){x("testing"),h("");try{let e=await fetch("/api/models/test",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({model:`${t}/${y}`})}),s=await e.json();x(s.ok?"ok":"error"),h(s.error||"")}catch(e){x("error"),h(e.message)}}},v=async()=>{if(y&&!f){g(!0);try{await l(y)}finally{g(!1)}}};return(0,a.jsx)(d.aF,{isOpen:e,onClose:r,title:"Add Custom Model",children:(0,a.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"text-sm font-medium mb-1.5 block",children:"Model ID"}),(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsx)("input",{type:"text",value:c,onChange:e=>{p(e.target.value),x(null),h("")},onKeyDown:e=>{"Enter"===e.key&&b()},placeholder:"e.g. claude-opus-4-5",className:"flex-1 px-3 py-2 text-sm border border-border rounded-lg bg-background focus:outline-none focus:border-primary",autoFocus:!0}),(0,a.jsx)(d.$n,{type:"button",variant:"secondary",icon:"science",loading:"testing"===m,onClick:b,disabled:!y||"testing"===m,children:"testing"===m?"Testing...":"Test"})]}),(0,a.jsxs)("p",{className:"text-xs text-text-muted mt-1",children:["Sent to provider as: ",(0,a.jsx)("code",{className:"font-mono bg-sidebar px-1 rounded",children:y||"model-id"})]})]}),"ok"===m&&(0,a.jsxs)("div",{className:"flex items-center gap-2 text-sm text-green-600",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-base",children:"check_circle"}),"Model is reachable"]}),"error"===m&&(0,a.jsxs)("div",{className:"flex items-start gap-2 text-sm text-red-500",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-base shrink-0",children:"cancel"}),(0,a.jsx)("span",{children:u||"Model not reachable"})]}),(0,a.jsxs)("div",{className:"flex gap-2 pt-1",children:[(0,a.jsx)(d.$n,{type:"button",onClick:r,variant:"ghost",fullWidth:!0,size:"sm",children:"Cancel"}),(0,a.jsx)(d.$n,{type:"button",onClick:v,fullWidth:!0,size:"sm",disabled:!y||f,children:f?"Adding...":"Add Model"})]})]})})}function $({isOpen:e,onClose:t,onSuccess:s}){let[l,r]=(0,i.useState)([]),[n,o]=(0,i.useState)(""),[c,p]=(0,i.useState)(!1),[m,x]=(0,i.useState)(null),[u,h]=(0,i.useState)(null),f=()=>{r([]),o(""),x(null),h(null),t()},g=async()=>{p(!0),x(null),h(null);try{let e=await Promise.all(l.map(async e=>({filename:e.name,jsonText:await e.text()}))),t=n.trim()?[{filename:"pasted JSON",jsonText:n.trim()}]:[],a=[...e,...t];if(0===a.length)throw Error("Select JSON files or paste JSON first");let i=await fetch("/api/oauth/codex/import-batch",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({items:a})}),r=await i.json();if(!i.ok)throw Error(r.error||"Failed to import accounts");x(r),r.imported?.length>0&&s?.()}catch(e){h(e.message||"Failed to import accounts")}finally{p(!1)}},y=m?.imported?.length||0,b=m?.skipped?.length||0;return(0,a.jsx)(d.aF,{isOpen:e,title:"Import Codex Accounts",onClose:f,size:"lg",children:(0,a.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,a.jsxs)("div",{className:"rounded-lg border border-border bg-surface/50 p-3",children:[(0,a.jsx)("label",{className:"mb-2 block text-sm font-medium",children:"JSON files"}),(0,a.jsx)("input",{type:"file",accept:".json,application/json",multiple:!0,onChange:e=>r(Array.from(e.target.files||[])),className:"block w-full text-sm text-text-muted file:mr-3 file:rounded-md file:border-0 file:bg-primary file:px-3 file:py-1.5 file:text-sm file:font-medium file:text-white hover:file:bg-primary/90"}),l.length>0&&(0,a.jsx)("div",{className:"mt-2 flex flex-wrap gap-1.5",children:l.map(e=>(0,a.jsx)("span",{className:"rounded bg-primary/10 px-2 py-0.5 text-xs text-primary",children:e.name},`${e.name}-${e.size}`))})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"mb-2 block text-sm font-medium",children:"Paste JSON"}),(0,a.jsx)("textarea",{value:n,onChange:e=>o(e.target.value),placeholder:'[{ "type": "codex", "access_token": "...", "refresh_token": "..." }]',className:"h-36 w-full resize-none rounded-md border border-black/10 bg-white px-3 py-2 font-mono text-xs text-text-main shadow-inner transition-all placeholder-text-muted/60 focus:border-primary/50 focus:outline-none focus:ring-1 focus:ring-primary/30 dark:border-white/10 dark:bg-white/5"})]}),(0,a.jsx)("div",{className:"rounded-lg border border-border bg-background/60 px-3 py-2 text-xs text-text-muted",children:"Auto-detects Codex Session JSON, CLI Proxy API Auth JSON, and Sub2API JSON."}),u&&(0,a.jsx)("div",{className:"rounded-lg border border-red-500/30 bg-red-500/10 px-3 py-2 text-sm text-red-600",children:u}),m&&(0,a.jsxs)("div",{className:"rounded-lg border border-border bg-surface/40 p-3",children:[(0,a.jsxs)("div",{className:"mb-2 flex flex-wrap items-center gap-2 text-sm",children:[(0,a.jsxs)("span",{className:"font-medium text-green-600",children:[y," imported"]}),b>0&&(0,a.jsxs)("span",{className:"text-text-muted",children:[b," skipped"]})]}),m.imported?.length>0&&(0,a.jsx)("div",{className:"max-h-32 overflow-auto rounded border border-border/70",children:m.imported.map(e=>(0,a.jsxs)("div",{className:"flex items-center justify-between gap-2 border-b border-border/70 px-2 py-1.5 last:border-b-0",children:[(0,a.jsx)("span",{className:"min-w-0 truncate text-xs",children:e.email||e.displayName||e.name||e.id}),(0,a.jsx)("span",{className:"shrink-0 text-xs text-text-muted",children:e.sourceFormat})]},e.id))}),m.skipped?.length>0&&(0,a.jsx)("div",{className:"mt-2 max-h-28 overflow-auto rounded border border-border/70",children:m.skipped.map((e,t)=>(0,a.jsxs)("div",{className:"border-b border-border/70 px-2 py-1.5 text-xs last:border-b-0",children:[(0,a.jsx)("span",{className:"font-medium",children:e.filename}),(0,a.jsxs)("span",{className:"text-text-muted",children:[" \xb7 ",e.reason]})]},`${e.filename}-${t}`))})]}),(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsx)(d.$n,{onClick:g,loading:c,disabled:c||!l.length&&!n.trim(),fullWidth:!0,children:"Import"}),(0,a.jsx)(d.$n,{onClick:f,variant:"ghost",fullWidth:!0,children:"Close"})]})]})})}k.propTypes={isOpen:g().bool.isRequired,provider:g().string,providerName:g().string,isCompatible:g().bool,isAnthropic:g().bool,authType:g().string,authHint:g().string,website:g().string,proxyPools:g().arrayOf(g().shape({id:g().string,name:g().string})),onSave:g().func.isRequired,onBulkDone:g().func,onClose:g().func.isRequired},C.propTypes={isOpen:g().bool.isRequired,node:g().shape({id:g().string,name:g().string,prefix:g().string,apiType:g().string,baseUrl:g().string}),onSave:g().func.isRequired,onClose:g().func.isRequired,isAnthropic:g().bool},S.propTypes={isOpen:g().bool.isRequired,providerAlias:g().string.isRequired,providerDisplayAlias:g().string.isRequired,onSave:g().func.isRequired,onClose:g().func.isRequired},$.propTypes={isOpen:g().bool.isRequired,onClose:g().func.isRequired,onSuccess:g().func};let A=`[
|
|
4
|
+
{
|
|
5
|
+
"accessToken": "eyJhbGc...",
|
|
6
|
+
"refreshToken": "rt_...",
|
|
7
|
+
"idToken": "eyJhbGc...",
|
|
8
|
+
"email": "user@example.com"
|
|
9
|
+
}
|
|
10
|
+
]`;function T({isOpen:e,onClose:t,onSuccess:s}){let[l,r]=(0,i.useState)(""),[n,o]=(0,i.useState)(!1),[c,p]=(0,i.useState)(""),[m,u]=(0,i.useState)(null),h=()=>{n||(r(""),p(""),u(null),t())},f=async()=>{var e;let t;p(""),u(null);let a=l.trim();if(!a)return;try{t=JSON.parse(a)}catch(e){p(`${(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 p((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 p(t?.error||`Request failed: ${e.status}`);u(t),t.success>0&&"function"==typeof s&&s()}catch(e){p(e.message||(0,x.Tl)("Request failed"))}finally{o(!1)}},g=m?.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}),m&&(0,a.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,a.jsxs)("div",{className:`text-sm font-medium ${m.failed>0?"text-yellow-400":"text-green-400"}`,children:["✓ ",m.success," ",(0,x.Tl)("added"),m.failed>0?`, ✗ ${m.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")})]})]})})}function O(){let e,t=(0,l.useParams)(),s=(0,l.useRouter)(),r=t.id,[u,f]=(0,i.useState)([]),[g,b]=(0,i.useState)(!0),[j,w]=(0,i.useState)(null),[A,O]=(0,i.useState)([]),[P,I]=(0,i.useState)(!1),[E,R]=(0,i.useState)(!1),[_,U]=(0,i.useState)(!1),[D,z]=(0,i.useState)(!1),[q,M]=(0,i.useState)(null),[F,J]=(0,i.useState)(!1),[K,L]=(0,i.useState)(!1),[W,B]=(0,i.useState)(!1),[H,V]=(0,i.useState)(!1),[G,Q]=(0,i.useState)(!1),[Z,X]=(0,i.useState)(null),[Y,ee]=(0,i.useState)({}),[et,es]=(0,i.useState)(!1),[ea,ei]=(0,i.useState)({}),[el,er]=(0,i.useState)(""),[en,eo]=(0,i.useState)(null),[ed,ec]=(0,i.useState)(!1),[ep,em]=(0,i.useState)([]),[ex,eu]=(0,i.useState)("__none__"),[eh,ef]=(0,i.useState)(!1),[eg,ey]=(0,i.useState)(null),[eb,ev]=(0,i.useState)(""),[ej,eN]=(0,i.useState)("auto"),[ew,ek]=(0,i.useState)(!1),[eC,eS]=(0,i.useState)(!1),[e$,eA]=(0,i.useState)("super_admin"),[eT,eO]=(0,i.useState)([]),[eP,eI]=(0,i.useState)([]),[eE,eR]=(0,i.useState)([]),[e_,eU]=(0,i.useState)(null),[eD,ez]=(0,i.useState)(!1),[eq,eM]=(0,i.useState)(!1),[eF,eJ]=(0,i.useState)(!1),[eK,eL]=(0,i.useState)(null),[eW,eB]=(0,i.useState)({}),[eH,eV]=(0,i.useState)(null),eG=(0,i.useRef)(!1),[eQ,eZ]=(0,i.useState)(!1),{copied:eX,copy:eY}=(0,m.C)(),e0="ag_risk_confirmed",e1=()=>{I(!0)},e2=()=>{"antigravity"===r&&"true"!==window.localStorage.getItem(e0)?ez(!0):e7?e1():J(!0)},e5=()=>{J(!0)},e3=()=>{e7?e2():e5()},e4=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],e6=e4?.authModes||[],e7=!!c.zN[r]||!!c.IS[r]||e6.includes("oauth"),e9=!!c.fg[r]||e6.includes("apikey"),e8=!!c.IS[r]?.noAuth,te=(0,p.KC)(r),tt=(0,c.wG)(r),ts=(0,c.mq)(r),ta=(0,c.gb)(r),ti=ts||ta,tl=!ti&&e7&&e9,tr="xai"===r?"Grok Build OAuth":"OAuth",tn="xai"===r?"xAI API Key":"API Key",to=c.Q2[r]?.thinkingConfig||c.s9.extended,td=ti?r:tt,tc=ti?j?.prefix||r:tt,tp="codex"===r,tm=(to?.options||[]).map(e=>({value:e,label:"auto"===e?"codex"===r?"Auto (Medium)":"Auto":"xhigh"===e?"XHigh":e.charAt(0).toUpperCase()+e.slice(1)})),tx=(0,i.useCallback)(async()=>{try{let e=await fetch(`/api/models/disabled?providerAlias=${encodeURIComponent(td)}`,{cache:"no-store"}),t=await e.json();e.ok&&eR(t.ids||[])}catch(e){console.log("Error fetching disabled models:",e)}},[td]),tu=async e=>{try{(await fetch("/api/models/disabled",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({providerAlias:td,ids:[e]})})).ok&&await tx()}catch(e){console.log("Error disabling model:",e)}},th=async e=>{try{(await fetch(`/api/models/disabled?providerAlias=${encodeURIComponent(td)}&id=${encodeURIComponent(e)}`,{method:"DELETE"})).ok&&await tx()}catch(e){console.log("Error enabling model:",e)}},tf=async e=>{e.length&&eU({title:"Disable All Models",message:`Disable all ${e.length} model(s)?`,onConfirm:async()=>{eU(null);try{(await fetch("/api/models/disabled",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({providerAlias:td,ids:e})})).ok&&await tx()}catch(e){console.log("Error disabling all models:",e)}}})},tg=async()=>{try{(await fetch(`/api/models/disabled?providerAlias=${encodeURIComponent(td)}`,{method:"DELETE"})).ok&&await tx()}catch(e){console.log("Error enabling all models:",e)}},ty=(0,i.useCallback)(async()=>{try{let e=await fetch("/api/models/alias"),t=await e.json();e.ok&&ee(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&&eI(e.models)}).catch(()=>{})},[r]);let tb=(0,i.useCallback)(async()=>{try{let[e,t,s,a,i]=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"}),fetch("/api/auth/me",{cache:"no-store"})]),l=await e.json(),n=await t.json(),o=await s.json(),d=a.ok?await a.json():{},c=i.ok?await i.json():{};if(e.ok){let e=(l.connections||[]).filter(e=>e.provider===r);f(e)}s.ok&&O(o.proxyPools||[]);let p=(d.providerStrategies||{})[r]||{};ey(p.fallbackStrategy||null),ev(null!=p.stickyRoundRobinLimit?String(p.stickyRoundRobinLimit):"1");let m=(d.providerThinking||{})[r]||{},x=c.providerThinkingScopeKey||c.userId||"super_admin",u="sub_user"===c.role?(c.providerThinking||{})[r]||{}:(d.userProviderThinking||{})[x]?.[r]||{};if(eN(m.mode||"auto"),ek(!0===m.fastMode),eA(x),eS(Object.prototype.hasOwnProperty.call(u,"fastMode")?!0===u.fastMode:!0===m.fastMode),t.ok){let e=(n.nodes||[]).find(e=>e.id===r)||null;if(!e&&ti)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{b(!1)}},[r,ti]),tv=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 tb(),V(!1))}catch(e){console.log("Error updating provider node:",e)}},tj=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)}},tN=async(e,t=ew)=>{try{let s=await fetch("/api/settings",{cache:"no-store"}),a={...(s.ok?await s.json():{}).providerThinking||{}},i={};e&&"auto"!==e&&(i.mode=e),"codex"===r&&!0===t&&(i.fastMode=!0),0===Object.keys(i).length?delete a[r]:a[r]=i,await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({providerThinking:a})})}catch(e){console.log("Error saving thinking config:",e)}},tw=async e=>{try{let t=await fetch("/api/settings",{cache:"no-store"}),s=(t.ok?await t.json():{}).userProviderThinking||{},a=e$||"super_admin",i=s[a]||{},l=i[r]||{},n={...s,[a]:{...i,[r]:{...l,fastMode:e}}};await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({userProviderThinking:n})})}catch(e){console.log("Error saving account fast mode:",e)}};(0,i.useEffect)(()=>{(async()=>{await Promise.all([tb(),ty(),tx()])})()},[tb,ty,tx]),(0,i.useEffect)(()=>{let e=(c.zN[r]||c.fg[r]||c.IS[r]||c.nJ[r])?.modelsFetcher;e&&h(e).then(eO)},[r]);let tk=async(e,t,s=tt)=>{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 ty();else{let t=await e.json();alert(t.error||"Failed to set alias")}}catch(e){console.log("Error setting alias:",e)}},tC=async e=>{try{(await fetch(`/api/models/alias?alias=${encodeURIComponent(e)}`,{method:"DELETE"})).ok&&await ty()}catch(e){console.log("Error deleting alias:",e)}},tS=async()=>{if(eQ)return;let e=u.find(e=>!1!==e.isActive);if(!e)return void alert((0,x.Tl)("Please add an active Qoder connection first"));eZ(!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=`${td}/${s}`;!Object.values(Y).includes(a)&&(Y[s]||(await tk(s,s,td),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{eZ(!1)}},t$=async()=>{if(eq||0===u.length)return;let e=Object.fromEntries(u.map(e=>[e.id,{state:"queued",error:null}]));eG.current=!1,eM(!0),eJ(!1),eL(null),eB(e),eV({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(eG.current){eV({total:u.length,completed:e,passed:t,failed:s,stopped:!0});break}let a=u[e];eL(a.id),eB(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,eB(e=>({...e,[a.id]:{state:l?"success":"failed",error:l?null:i.error||null}}))}catch(e){s+=1,eB(t=>({...t,[a.id]:{state:"failed",error:e.message||"Test failed"}}))}eV({total:u.length,completed:e+1,passed:t,failed:s,stopped:!1}),e<u.length-1&&await new Promise(e=>setTimeout(e,1e3))}}finally{eL(null),eM(!1),eJ(!1),eG.current=!1}},tA=async e=>{eU({title:"Delete Connection",message:"Delete this connection?",onConfirm:async()=>{eU(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)}}})},tT=()=>{tb(),I(!1)},tO=async()=>{if(!D){z(!0),M(null);try{let e=await fetch("/api/oauth/codex/refresh-all",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({})}),t=await e.json();if(!e.ok&&!t?.refreshed?.length)throw Error(t.error||"Failed to refresh Codex tokens");M(t),await tb()}catch(e){M({error:e.message,refreshed:[],failed:[],skipped:[]})}finally{z(!1)}}},tP=async e=>{try{(await fetch("/api/providers",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:r,...e})})).ok&&(await tb(),J(!1))}catch(e){console.log("Error saving connection:",e)}},tI=async e=>{try{(await fetch(`/api/providers/${Z.id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})).ok&&(await tb(),B(!1))}catch(e){console.log("Error updating connection:",e)}},tE=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)}},tR=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 tb()}},t_=(0,i.useMemo)(()=>new Set(u.map(e=>e.id)),[u]),tU=(0,i.useMemo)(()=>ep.filter(e=>t_.has(e)),[ep,t_]),tD=u.filter(e=>tU.includes(e.id));u.length>0&&(tU.length,u.length);let tz=(()=>{if(0===tD.length)return"";let e=new Set(tD.map(e=>e.providerSpecificData?.proxyPoolId||"__none__"));if(1===e.size){let t=[...e][0];if("__none__"===t)return"All selected currently unbound";let s=A.find(e=>e.id===t);return`All selected currently bound to ${s?.name||t}`}return"Selected connections have mixed proxy bindings"})(),tq=()=>{eh||Q(!1)},tM=async()=>{if(0===tU.length)return;let e="__none__"===ex?null:ex;ef(!0);try{let t=[];for(let s of tU)try{let a=await fetch(`/api/providers/${s}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({proxyPoolId:e})});t.push(a.ok)}catch(e){console.log("Error applying bulk proxy pool for",s,e),t.push(!1)}let s=t.filter(e=>!e).length;s>0&&alert(`Updated with ${s} failed request(s).`),await tb(),em([]),eu("__none__"),Q(!1)}catch(e){console.log("Error applying bulk proxy pool:",e)}finally{ef(!1)}},tF=(0,a.jsx)("div",{className:"flex min-w-0 flex-col divide-y divide-black/3 dark:divide-white/3",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,isOAuth:e7,isFirst:0===t,isLast:t===u.length-1,onMoveUp:()=>tR(t,t-1),onMoveDown:()=>tR(t,t+1),onToggleActive:t=>tE(e.id,t),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:()=>{X(e),B(!0)},onDelete:()=>tA(e.id),oneByOneStatus:eW[e.id]||null})})},e.id))}),tJ=[{value:"__none__",label:"None"},...A.map(e=>({value:e.id,label:e.name}))],tK=0===tU.length?"Select one or more connections, then click Proxy Action.":tz,tL=tU.length>0&&!eh,tW=(0,a.jsx)(d.aF,{isOpen:G,onClose:tq,title:`Proxy Action (${tU.length} selected)`,children:(0,a.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,a.jsx)(d.l6,{label:"Proxy Pool",value:ex,onChange:e=>eu(e.target.value),options:tJ,placeholder:"None"}),(0,a.jsx)("p",{className:"text-xs text-text-muted",children:tK}),(0,a.jsx)("p",{className:"text-xs text-text-muted",children:"Selecting None will unbind selected connections from proxy pool."}),(0,a.jsxs)("div",{className:"flex flex-col gap-2 sm:flex-row",children:[(0,a.jsx)(d.$n,{onClick:tM,fullWidth:!0,disabled:!tL,children:eh?"Applying...":"Apply"}),(0,a.jsx)(d.$n,{onClick:tq,variant:"ghost",fullWidth:!0,disabled:eh,children:"Cancel"})]})]})}),tB=async e=>{if(!en){eo(e);try{let t=await fetch("/api/models/test",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({model:`${td}/${e}`})}),s=await t.json();ei(t=>({...t,[e]:s.ok?"ok":"error"})),er(s.ok?"":s.error||"Model not reachable")}catch{ei(t=>({...t,[e]:"error"})),er("Network error")}finally{eo(null)}}};return g?(0,a.jsxs)("div",{className:"flex flex-col gap-8",children:[(0,a.jsx)(d.Qv,{}),(0,a.jsx)(d.Qv,{})]}):e4?(0,a.jsxs)("div",{className:"flex min-w-0 flex-col gap-6 px-1 sm:gap-8 sm:px-0",children:[(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:`${e4.color}15`},children:et?(0,a.jsx)("span",{className:"text-sm font-bold",style:{color:e4.color},children:e4.textIcon||e4.id.slice(0,2).toUpperCase()}):(0,a.jsx)(o.default,{src:ts&&e4.apiType?"responses"===e4.apiType?"/providers/oai-r.png":"/providers/oai-cc.png":ta?"/providers/anthropic-m.png":`/providers/${e4.id}.png`,alt:e4.name,width:48,height:48,className:"max-h-12 max-w-12 rounded-lg object-contain",sizes:"48px",onError:()=>es(!0)})}),(0,a.jsxs)("div",{className:"min-w-0",children:[(0,a.jsxs)("div",{className:"flex items-center gap-3 flex-wrap",children:[(0,a.jsx)("h1",{className:"truncate text-2xl font-semibold tracking-tight sm:text-3xl",children:e4.name}),(e4.notice?.apiKeyUrl||e4.notice?.signupUrl||e4.website)&&(0,a.jsxs)("a",{href:e4.notice?.apiKeyUrl||e4.notice?.signupUrl||e4.website,target:"_blank",rel:"noopener noreferrer",className:"text-xs text-primary hover:underline inline-flex items-center gap-1",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-sm",children:"open_in_new"}),e4.notice?.apiKeyUrl?"Get API Key":"Sign up / Learn more"]})]}),(0,a.jsxs)("p",{className:"text-text-muted",children:[u.length," connection",1===u.length?"":"s"]})]})]})]}),e4.deprecated&&(0,a.jsxs)("div",{className:"flex items-center gap-2 px-3 py-2 rounded-lg bg-yellow-500/10 border border-yellow-500/30",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[16px] text-yellow-500 mt-0.5 shrink-0",children:"warning"}),(0,a.jsx)("p",{className:"text-xs text-red-600 dark:text-yellow-400 leading-relaxed",children:e4.deprecationNotice})]}),e4.notice?.text&&!e4.deprecated&&(0,a.jsxs)("div",{className:"flex flex-col gap-2 rounded-lg border border-blue-500/30 bg-blue-500/10 px-3 py-2 sm:flex-row sm:items-center",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[16px] text-blue-500 shrink-0",children:"info"}),(0,a.jsx)("p",{className:"min-w-0 flex-1 text-xs leading-relaxed text-blue-600 dark:text-blue-400",children:e4.notice.text}),e4.notice.apiKeyUrl&&(0,a.jsx)("a",{href:e4.notice.apiKeyUrl,target:"_blank",rel:"noopener noreferrer",className:"inline-flex justify-center rounded bg-blue-500 px-2 py-1 text-xs font-medium text-white transition-colors hover:bg-blue-600 sm:py-0.5",children:"Get API Key →"})]}),ti&&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:ta?"Anthropic Compatible Details":"OpenAI Compatible Details"}),(0,a.jsxs)("p",{className:"break-all text-sm text-text-muted",children:[ta?"Messages API":"responses"===j.apiType?"Responses API":"Chat Completions"," \xb7 ",(j.baseUrl||"").replace(/\/$/,""),"/",ta?"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:()=>J(!0),disabled:u.length>0,className:"w-full sm:w-auto",children:"Add"}),(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()=>{eU({title:"Delete Compatible Node",message:`Delete this ${ta?"Anthropic":"OpenAI"} Compatible node?`,onConfirm:async()=>{eU(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"})]})]})}),e8?(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:()=>Q(!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:t$,disabled:eq,children:eq?"Testing Connection One-by-One...":"Test Connection One-by-One"}),eq&&(0,a.jsx)(d.$n,{size:"sm",variant:"ghost",icon:"stop",onClick:()=>{eq&&(eG.current=!0,eJ(!0))},disabled:eF,children:eF?"Stopping...":"Stop"})]}),"codex"===r&&(0,a.jsxs)("div",{className:"flex flex-wrap items-center gap-3",children:[(0,a.jsxs)("label",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:"text-xs font-medium text-text-muted whitespace-nowrap",children:"Global Fast"}),(0,a.jsx)(d.lM,{checked:ew,onChange:e=>{ek(e),tN(ej,e)}})]}),(0,a.jsxs)("label",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:"text-xs font-medium text-text-muted whitespace-nowrap",children:"My Fast"}),(0,a.jsx)(d.lM,{checked:eC,onChange:e=>{eS(e),tw(e)}})]})]}),to&&(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("label",{htmlFor:"provider-default-reasoning",className:"text-xs font-medium text-text-muted whitespace-nowrap",children:"Default Reasoning"}),(0,a.jsxs)("div",{className:"relative",children:[(0,a.jsx)("select",{id:"provider-default-reasoning",value:ej,onChange:e=>{var t;eN(t=e.target.value),tN(t)},disabled:g,className:"h-6 w-28 appearance-none rounded-full border border-border/60 bg-surface-2 pl-3 pr-7 text-xs font-medium text-text-main transition-colors focus:border-primary/50 focus:outline-none focus:ring-2 focus:ring-primary/20 disabled:cursor-not-allowed disabled:opacity-50",children:tm.map(e=>(0,a.jsx)("option",{value:e.value,children:e.label},e.value))}),(0,a.jsx)("span",{className:"material-symbols-outlined pointer-events-none absolute right-2 top-1/2 -translate-y-1/2 text-[16px] text-text-muted",children:"expand_more"})]})]}),(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"===eg,onChange:e=>{let t=e?"round-robin":null,s=e?eb||"1":eb;e&&!eb&&ev("1"),ey(t),tj(t,s)}}),"round-robin"===eg&&(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:eb,onChange:e=>{var t;ev(t=e.target.value),tj("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?(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:e7?"lock":"key"})}),(0,a.jsxs)("div",{className:"min-w-0",children:[(0,a.jsx)("p",{className:"text-sm text-text-muted",children:"No connections yet"}),tl&&(0,a.jsxs)("p",{className:"text-xs text-text-muted",children:["Choose ",tr," or ",tn,"."]})]})]}),(0,a.jsxs)("div",{className:"flex gap-2",children:[tl?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(d.$n,{size:"sm",icon:"lock",variant:"secondary",onClick:e2,children:tr}),(0,a.jsx)(d.$n,{size:"sm",icon:"key",onClick:e5,children:tn})]}):(0,a.jsxs)(a.Fragment,{children:[!ti&&"iflow"===r&&(0,a.jsx)(d.$n,{size:"sm",icon:"cookie",variant:"secondary",onClick:()=>R(!0),children:"Cookie"}),"codex"===r&&(0,a.jsx)(d.$n,{size:"sm",icon:"playlist_add",variant:"secondary",onClick:()=>L(!0),children:(0,x.Tl)("Bulk Add")}),(0,a.jsx)(d.$n,{size:"sm",icon:"add",onClick:e3,children:ti?"Add API Key":"iflow"===r?"OAuth":"Add Connection"})]}),"codex"===r&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(d.$n,{size:"sm",icon:"upload_file",variant:"secondary",onClick:()=>U(!0),children:"Batch Import"}),(0,a.jsx)(d.$n,{size:"sm",icon:"sync",variant:"secondary",onClick:tO,loading:D,children:"Refresh Tokens"})]})]})]}):(0,a.jsxs)(a.Fragment,{children:[eH&&(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: ",eH.total]}),(0,a.jsxs)("span",{children:["Completed: ",eH.completed]}),(0,a.jsxs)("span",{children:["Passed: ",eH.passed]}),(0,a.jsxs)("span",{children:["Failed: ",eH.failed]}),eH.stopped&&(0,a.jsx)("span",{className:"text-amber-600 dark:text-amber-400",children:"Stopped"}),eq&&eK&&(0,a.jsxs)("span",{children:["Running: ",u.find(e=>e.id===eK)?.name||eK]})]})}),tF,!ti&&(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:()=>R(!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:()=>L(!0),title:(0,x.Tl)("Bulk import codex accounts from JSON"),className:"w-full sm:w-auto",children:(0,x.Tl)("Bulk Add")}),tl?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(d.$n,{size:"sm",icon:"lock",variant:"secondary",onClick:e2,className:"w-full sm:w-auto",children:tr}),(0,a.jsx)(d.$n,{size:"sm",icon:"key",onClick:e5,className:"w-full sm:w-auto",children:tn})]}):(0,a.jsx)(d.$n,{size:"sm",icon:"add",onClick:e3,className:"w-full sm:w-auto",children:"Add"}),"codex"===r&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(d.$n,{size:"sm",icon:"upload_file",variant:"secondary",onClick:()=>U(!0),className:"w-full sm:w-auto",children:"Batch Import"}),(0,a.jsx)(d.$n,{size:"sm",icon:"sync",variant:"secondary",onClick:tO,loading:D,className:"w-full sm:w-auto",children:"Refresh Tokens"})]})]})]}),"codex"===r&&q&&(0,a.jsx)("div",{className:`mt-4 rounded-lg border px-3 py-2 text-sm ${q.error?"border-red-500/30 bg-red-500/10 text-red-600":"border-green-500/30 bg-green-500/10 text-green-700 dark:text-green-300"}`,children:q.error?q.error:`Token refresh complete: ${q.refreshed?.length||0} refreshed, ${q.failed?.length||0} failed, ${q.skipped?.length||0} skipped.`})]}),(0,a.jsxs)(d.Zp,{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"}),!ti&&(e=[...te,...eP.filter(e=>!te.some(t=>t.id===e.id))].filter(e=>!e.type||"llm"===e.type).map(e=>e.id).filter(e=>!eE.includes(e)),(0,a.jsxs)("div",{className:"flex gap-2",children:[eE.length>0&&(0,a.jsx)(d.$n,{size:"sm",variant:"secondary",icon:"restart_alt",onClick:tg,children:"Active All"}),e.length>0&&(0,a.jsx)(d.$n,{size:"sm",variant:"secondary",icon:"block",onClick:()=>tf(e),children:"Disable All"})]}))]}),!!el&&(0,a.jsx)("p",{className:"text-xs text-red-500 mb-3 wrap-break-word",children:el}),(()=>{let e,t,s;if(ti)return(0,a.jsx)(v,{providerStorageAlias:td,providerDisplayAlias:tc,modelAliases:Y,copied:eX,onCopy:eY,onSetAlias:tk,onDeleteAlias:tC,connections:u,isAnthropic:ta});let i=[...te,...eP.filter(e=>!te.some(t=>t.id===e.id))].filter(e=>!e.type||"llm"===e.type),l=new Set(eE),n=i.filter(e=>!l.has(e.id)),o=i.filter(e=>l.has(e.id)),d=Object.entries(Y).filter(([e,t])=>{let s=`${td}/`;if(!t.startsWith(s))return!1;let a=t.slice(s.length);return e4.passthroughModels?!te.some(e=>e.id===a):!te.some(e=>e.id===a)&&e===a}).map(([e,t])=>({id:t.slice(`${td}/`.length),alias:e,fullModel:t}));return(0,a.jsxs)("div",{className:"flex flex-wrap gap-3",children:[d.map(e=>(0,a.jsx)(y,{model:{id:e.id},fullModel:`${tc}/${e.id}`,displayModel:tp?e.id:`${tc}/${e.id}`,alias:e.alias,copied:eX,onCopy:eY,onSetAlias:()=>{},onDeleteAlias:()=>tC(e.alias),testStatus:ea[e.id],onTest:u.length>0||e8?()=>tB(e.id):void 0,isTesting:en===e.id,isCustom:!0,isFree:!1},e.id)),n.map(e=>{let t=`${td}/${e.id}`,s=`${r}/${e.id}`,i=Object.entries(Y).find(([,e])=>e===t||e===s)?.[0];return(0,a.jsx)(y,{model:e,fullModel:`${tc}/${e.id}`,displayModel:tp?e.id:`${tc}/${e.id}`,alias:i,copied:eX,onCopy:eY,onSetAlias:t=>tk(e.id,t,td),onDeleteAlias:()=>tC(i),testStatus:ea[e.id],onTest:u.length>0||e8?()=>tB(e.id):void 0,isTesting:en===e.id,isFree:e.isFree,onDisable:()=>tu(e.id)},e.id)}),(0,a.jsxs)("button",{onClick:()=>ec(!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:tS,disabled:eQ,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:eQ?{animation:"spin 1s linear infinite"}:void 0,children:eQ?"progress_activity":"download"}),eQ?(0,x.Tl)("Fetching..."):(0,x.Tl)("Fetch Qoder Models")]}),eT.length>0&&(e=new Set(Object.values(Y)),t=new Set(te.map(e=>e.id)),0===(s=eT.filter(s=>!e.has(`${td}/${s.id}`)&&!t.has(s.id))).length?null:(0,a.jsxs)("div",{className:"w-full mt-2",children:[(0,a.jsx)("p",{className:"text-xs text-text-muted mb-2",children:"Suggested free models (≥200k context):"}),(0,a.jsx)("div",{className:"flex flex-wrap gap-2",children:s.map(e=>(0,a.jsxs)("button",{onClick:async()=>{let t=e.id.split("/").pop();await tk(e.id,t,td)},className:"flex items-center gap-1 px-2.5 py-1.5 rounded-lg border border-black/10 dark:border-white/10 text-xs text-text-muted hover:text-primary hover:border-primary/40 hover:bg-primary/5 transition-colors",title:`${e.name} \xb7 ${(e.contextLength/1e3).toFixed(0)}k ctx`,children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[13px]",children:"add"}),e.id.split("/").pop()]},e.id))})]})),o.length>0&&(0,a.jsxs)("div",{className:"w-full mt-2",children:[(0,a.jsxs)("p",{className:"text-xs text-text-muted mb-2",children:["Disabled models (",o.length,"):"]}),(0,a.jsx)("div",{className:"flex flex-wrap gap-2",children:o.map(e=>(0,a.jsxs)("button",{onClick:()=>th(e.id),className:"flex items-center gap-1 px-2.5 py-1.5 rounded-lg border border-dashed border-black/10 dark:border-white/10 text-xs text-text-muted hover:text-primary hover:border-primary/40 hover:bg-primary/5 transition-colors",title:"Restore model",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[13px]",children:"add"}),e.id]},e.id))})]})]})})()]}),tW,"kiro"===r?(0,a.jsx)(d.Mh,{isOpen:P,providerInfo:e4,onSuccess:tT,onClose:()=>I(!1)}):"cursor"===r?(0,a.jsx)(d.G9,{isOpen:P,onSuccess:tT,onClose:()=>I(!1)}):"gitlab"===r?(0,a.jsx)(d.vj,{isOpen:P,providerInfo:e4,onSuccess:tT,onClose:()=>I(!1)}):(0,a.jsx)(d.LF,{isOpen:P,provider:r,providerInfo:e4,onSuccess:tT,onClose:()=>I(!1)}),"iflow"===r&&(0,a.jsx)(d.vE,{isOpen:E,onSuccess:()=>{tb(),R(!1)},onClose:()=>R(!1)}),"codex"===r&&(0,a.jsx)($,{isOpen:_,onSuccess:tb,onClose:()=>U(!1)}),(0,a.jsx)(k,{isOpen:F,provider:r,providerName:e4.name,isCompatible:ti,isAnthropic:ta,authType:e4?.authType,authHint:e4?.authHint,website:e4?.website,proxyPools:A,onSave:tP,onClose:()=>J(!1)}),(0,a.jsx)(d.wI,{isOpen:W,connection:Z,proxyPools:A,onSave:tI,onClose:()=>B(!1)}),ti&&(0,a.jsx)(C,{isOpen:H,node:j,onSave:tv,onClose:()=>V(!1),isAnthropic:ta}),!ti&&(0,a.jsx)(S,{isOpen:ed,providerAlias:td,providerDisplayAlias:tc,onSave:async e=>{let t=e4?.passthroughModels?e.split("/").pop():e;await tk(e,t,td),ec(!1)},onClose:()=>ec(!1)}),"codex"===r&&(0,a.jsx)(T,{isOpen:K,onClose:()=>L(!1),onSuccess:tb}),(0,a.jsx)(d.uo,{isOpen:eD,onClose:()=>ez(!1),onConfirm:()=>{(window.localStorage.setItem(e0,"true"),ez(!1),e7)?e1():e5()},title:"Risk Notice",message:e4?.deprecationNotice,confirmText:"I Understand, Continue",cancelText:"Cancel",variant:"danger"}),(0,a.jsx)(d.uo,{isOpen:!!e_,onClose:()=>eU(null),onConfirm:e_?.onConfirm,title:e_?.title||"Confirm",message:e_?.message,variant:"danger"})]}):(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"})]})}T.propTypes={isOpen:g().bool.isRequired,onClose:g().func.isRequired,onSuccess:g().func}}},e=>{e.O(0,[2574,3862,1051,5772,1321,5497,8441,3794,7358],()=>e(e.s=29610)),_N_E=e.O()}]);
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3826],{61034:(e,t,a)=>{Promise.resolve().then(a.bind(a,84509))},84509:(e,t,a)=>{"use strict";a.r(t),a.d(t,{default:()=>A});var r=a(95155),s=a(12115),n=a(25086),l=a(57250),i=a(45564);function o(e,t){return t&&0!==t?!e||e<0?100:e>=t?0:Math.round((t-e)/t*100):0}function c({quotas:e=[],compact:t=!1,sortMode:a="default",showSortLabel:n=!1}){let[l,i]=(0,s.useState)(1),d=(0,s.useMemo)(()=>e.map((e,t)=>({...e,index:t,remaining:e?.remaining!==void 0?Math.max(0,Math.round(e.remaining)):e?.remainingPercentage!==void 0?Math.round(e.remainingPercentage):o(e?.used,e?.total)})),[e]),u=(0,s.useMemo)(()=>"remaining-asc"===a?[...d].sort((e,t)=>e.remaining-t.remaining||e.name.localeCompare(t.name)):"remaining-desc"===a?[...d].sort((e,t)=>t.remaining-e.remaining||e.name.localeCompare(t.name)):d,[d,a]),m=Math.max(1,Math.ceil(u.length/10));if((0,s.useEffect)(()=>{i(1)},[a,e]),(0,s.useEffect)(()=>{i(e=>Math.min(e,m))},[m]),!e||0===e.length)return null;let x=u.slice((l-1)*10,10*l),h=0===u.length?0:(l-1)*10+1,b=Math.min(10*l,u.length),p=t?"py-1 px-1.5":"py-2 px-3",g=t?"text-[11px]":"text-sm",f=t?"text-[11px]":"text-sm",v=t?"text-[10px] leading-tight":"text-xs";return(0,r.jsxs)("div",{className:"space-y-2",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,r.jsxs)("div",{className:"text-[10px] text-text-muted",children:[u.length," quota",u.length>1?"s":""]}),n&&(0,r.jsx)("div",{className:"rounded-md border border-black/10 bg-black/[0.02] px-2 py-1 text-[10px] text-text-muted dark:border-white/10 dark:bg-white/[0.03]",children:"Sorted by account remaining"})]}),(0,r.jsx)("div",{className:"overflow-x-auto",children:(0,r.jsx)("table",{className:"w-full table-fixed text-left",children:(0,r.jsx)("tbody",{children:x.map(e=>{var a;let s=(a=e.remaining)>70?{text:"text-green-600 dark:text-green-400",bg:"bg-green-500",bgLight:"bg-green-500/10",emoji:"\uD83D\uDFE2"}:a>=30?{text:"text-yellow-600 dark:text-yellow-400",bg:"bg-yellow-500",bgLight:"bg-yellow-500/10",emoji:"\uD83D\uDFE1"}:{text:"text-red-600 dark:text-red-400",bg:"bg-red-500",bgLight:"bg-red-500/10",emoji:"\uD83D\uDD34"},n=function(e){if(!e)return"-";try{let t="string"==typeof e?new Date(e):e,a=new Date,r=t-a;if(r<=0)return"-";let s=Math.ceil(r/6e4);if(s<60)return`${s}m`;let n=Math.floor(s/60),l=s%60;if(n<24)return`${n}h ${l}m`;let i=Math.floor(n/24);return`${i}d ${n%24}h ${l}m`}catch(e){return"-"}}(e.resetAt),l=function(e){if(!e)return null;try{let t=new Date(e),a=new Date,r=new Date(a.getFullYear(),a.getMonth(),a.getDate()),s=new Date(r);s.setDate(s.getDate()+1);let n="";n=t>=r&&t<s?"Today":t>=s&&t<new Date(s.getTime()+864e5)?"Tomorrow":t.toLocaleDateString("en-US",{month:"short",day:"numeric"});let l=t.toLocaleTimeString("en-US",{hour:"numeric",minute:"2-digit",hour12:!0});return`${n}, ${l}`}catch{return null}}(e.resetAt);return(0,r.jsxs)("tr",{className:"border-b border-black/5 dark:border-white/5 hover:bg-black/[0.02] dark:hover:bg-white/[0.02] transition-colors",children:[(0,r.jsx)("td",{className:`${p} w-[30%]`,children:(0,r.jsxs)("div",{className:"flex items-center gap-1.5 min-w-0",children:[(0,r.jsx)("span",{className:"text-[10px] shrink-0",children:s.emoji}),(0,r.jsx)("span",{className:`${g} font-medium text-text-primary truncate`,children:e.name})]})}),(0,r.jsx)("td",{className:`${p} w-[45%]`,children:(0,r.jsxs)("div",{className:t?"space-y-1":"space-y-1.5",children:[(0,r.jsx)("div",{className:`${t?"h-1":"h-1.5"} rounded-full overflow-hidden border ${s.bgLight} ${0===e.remaining?"border-black/10 dark:border-white/10":"border-transparent"}`,children:(0,r.jsx)("div",{className:`h-full transition-all duration-300 ${s.bg}`,style:{width:`${Math.min(e.remaining,100)}%`}})}),(0,r.jsxs)("div",{className:`flex items-center justify-between ${t?"text-[10px]":"text-xs"}`,children:[(0,r.jsxs)("span",{className:"text-text-muted",children:[e.used.toLocaleString()," / ",e.total>0?e.total.toLocaleString():"∞"]}),(0,r.jsxs)("span",{className:`font-medium ${s.text}`,children:[e.remaining,"%"]})]})]})}),(0,r.jsx)("td",{className:`${p} w-[25%]`,children:"-"!==n||l?t?(0,r.jsx)("div",{className:`${f} text-text-primary font-medium truncate`,title:l||"",children:"-"!==n?`in ${n}`:l}):(0,r.jsxs)("div",{className:"space-y-0.5",children:["-"!==n&&(0,r.jsxs)("div",{className:`${f} text-text-primary font-medium`,children:["in ",n]}),l&&(0,r.jsx)("div",{className:`${v} text-text-muted`,children:l})]}):(0,r.jsx)("div",{className:`${f} text-text-muted italic`,children:"N/A"})})]},`${e.name}-${e.index}`)})})})}),m>1&&(0,r.jsxs)("div",{className:"rounded-md border border-black/10 bg-black/[0.02] px-2 py-1.5 dark:border-white/10 dark:bg-white/[0.03]",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between gap-2 text-[10px] text-text-muted",children:[(0,r.jsxs)("span",{children:["Showing ",h,"-",b," of ",u.length]}),(0,r.jsxs)("span",{children:["Page ",l," / ",m]})]}),(0,r.jsxs)("div",{className:"mt-1.5 flex items-center justify-end gap-1",children:[(0,r.jsx)("button",{type:"button",onClick:()=>i(e=>Math.max(1,e-1)),disabled:1===l,className:"flex h-6 items-center rounded-md border border-black/10 px-2 text-[10px] text-text-primary transition-colors hover:bg-black/5 disabled:cursor-not-allowed disabled:opacity-40 dark:border-white/10 dark:hover:bg-white/5",children:"Prev"}),(0,r.jsx)("button",{type:"button",onClick:()=>i(e=>Math.min(m,e+1)),disabled:l===m,className:"flex h-6 items-center rounded-md border border-black/10 px-2 text-[10px] text-text-primary transition-colors hover:bg-black/5 disabled:cursor-not-allowed disabled:opacity-40 dark:border-white/10 dark:hover:bg-white/5",children:"Next"})]})]})]})}var d=a(98542),u=a(84588),m=a(35497),x=a(52679),h=a(65921);function b(e){let t=e=>"string"==typeof e&&/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(e);return t(e.email)?e.email:(t(e.name),e.name)}function p(e,t){let a=t[e.id]?.quotas?.[0];return a&&"number"==typeof a.remaining?a.remaining:1/0}function g(e){let t={};return e.forEach(e=>{t[e.id]=!0}),t}function f(e,t){let a=new Set(t.map(e=>e.id));return Object.fromEntries(Object.entries(e).filter(([e])=>a.has(e)))}async function v(e,t){return await e(t)}let y="quotaCacheData";function k(){try{let e=window.localStorage.getItem(y);return e?JSON.parse(e):{}}catch(e){return console.error("Error reading quota cache:",e),{}}}function w(e,t){try{let a=k();a[e]={...t,cachedAt:new Date().toISOString()},window.localStorage.setItem(y,JSON.stringify(a))}catch(e){console.error("Error writing quota cache:",e)}}let j="quotaAutoRefresh",N=[{value:"all",label:"All accounts"},{value:"active",label:"Active"},{value:"inactive",label:"Turned off"}],C=[{value:"default",label:"Default quota order"},{value:"remaining-asc",label:"% quota: low to high"},{value:"remaining-desc",label:"% quota: high to low"}],S=[10,20,50,100];function $({readOnly:e=!1,allowCodexActivation:t=!1,gridClassName:a="grid grid-cols-1 md:grid-cols-2 gap-3",activeFirst:n=!1,maxRows:A=null,maxColumns:E=4}){let[q,P]=(0,s.useState)([]),[M,T]=(0,s.useState)({}),[D,O]=(0,s.useState)({}),[I,_]=(0,s.useState)({}),[F,L]=(0,s.useState)(!0),[z,R]=(0,s.useState)(null),[U,J]=(0,s.useState)(!1),[K,Q]=(0,s.useState)(!1),[H,W]=(0,s.useState)(60),[B,G]=(0,s.useState)(!0),[Y,V]=(0,s.useState)(null),[X,Z]=(0,s.useState)(null),[ee,et]=(0,s.useState)(!1),[ea,er]=(0,s.useState)(null),[es,en]=(0,s.useState)([]),[el,ei]=(0,s.useState)("all"),[eo,ec]=(0,s.useState)([]),[ed,eu]=(0,s.useState)("all"),[em,ex]=(0,s.useState)("default"),[eh,eb]=(0,s.useState)(!1),[ep,eg]=(0,s.useState)(!1),[ef,ev]=(0,s.useState)(!1),[ey,ek]=(0,s.useState)(null),[ew,ej]=(0,s.useState)(1),[eN,eC]=(0,s.useState)(20),[eS,e$]=(0,s.useState)(String(20)),[eA,eE]=(0,s.useState)({page:1,pageSize:20,total:0,totalPages:1}),[eq,eP]=(0,s.useState)({eligibleConnections:0,providerFilteredConnections:0}),eM=(0,s.useRef)(null),eT=(0,s.useRef)(null),eD=(0,h.i)(),eO=!e||t,eI=(0,s.useCallback)(async(e=ew)=>{try{var t,a;let r=new URLSearchParams({page:String(e),pageSize:String(eN),accountStatus:ed,sort:"priority"});"all"!==el&&r.set("provider",el);let s=await fetch(`/api/providers/client?${r.toString()}`);if(!s.ok)throw Error("Failed to fetch connections");let n=await s.json(),l=n.connections||[],i=(t=n.pagination,t||{page:1,pageSize:eN,total:0,totalPages:1}),o=function(e,t=0){return e||{eligibleConnections:t,providerFilteredConnections:t}}(n.totals,l.length);return P(l),ec(n.providerOptions||[]),eE(i),eP(o),ej((a=n.pagination,a?.page||e)),l}catch(e){return console.error("Error fetching connections:",e),P([]),ec([]),eE({page:1,pageSize:eN,total:0,totalPages:1}),eP({eligibleConnections:0,providerFilteredConnections:0}),[]}},[ed,eh,ew,eN,el]),e_=(0,s.useCallback)(async(e,t)=>{O(t=>({...t,[e]:!0})),_(t=>({...t,[e]:null}));try{console.log(`[ProviderLimits] Fetching quota for ${t} (${e})`);let a=await fetch(`/api/usage/${e}`);if(!a.ok){let r=(await a.json().catch(()=>({}))).error||a.statusText;if(404===a.status)return void console.warn(`[ProviderLimits] Connection not found for ${t}, skipping`);if(401===a.status){console.warn(`[ProviderLimits] Auth error for ${t}:`,r);let a={quotas:[],message:r};T(t=>({...t,[e]:a})),w(e,a);return}throw Error(`HTTP ${a.status}: ${r}`)}let r=await a.json();console.log(`[ProviderLimits] Got quota for ${t}:`,r);let s={quotas:function(e,t){if(!t||"object"!=typeof t)return[];let a=[];try{switch(e.toLowerCase()){case"github":default:t.quotas&&Object.entries(t.quotas).forEach(([e,t])=>{a.push({name:e,used:t.used||0,total:t.total||0,resetAt:t.resetAt||null})});break;case"antigravity":t.quotas&&Object.entries(t.quotas).forEach(([e,t])=>{a.push({name:t.displayName||e,modelKey:e,used:t.used||0,total:t.total||0,resetAt:t.resetAt||null,remainingPercentage:t.remainingPercentage})});break;case"codex":t.quotas&&Object.entries(t.quotas).forEach(([e,t])=>{a.push({name:e,used:t.used||0,total:t.total||0,remaining:t.remaining,resetAt:t.resetAt||null})});break;case"kiro":t.quotas&&Object.entries(t.quotas).forEach(([e,t])=>{a.push({name:e,used:t.used||0,total:t.total||0,resetAt:t.resetAt||null})});break;case"qoder":t.quotas&&Object.entries(t.quotas).forEach(([e,t])=>{("organization"!==e||t&&0!==(Number(t.total)||0))&&a.push({name:"user"===e?"Personal":"organization"===e?"Organization":e,used:t.used||0,total:t.total||0,unit:t.unit,resetAt:t.resetAt||null})});break;case"claude":t.message?a.push({name:"error",used:0,total:0,resetAt:null,message:t.message}):t.quotas&&Object.entries(t.quotas).forEach(([e,t])=>{a.push({name:e,used:t.used||0,total:t.total||0,resetAt:t.resetAt||null})})}}catch(t){return console.error(`Error parsing quota data for ${e}:`,t),[]}let r=(0,i.KC)(e);if(r.length>0){let e=new Map(r.map((e,t)=>[e.id,t]));a.sort((t,a)=>{let r=t.modelKey||t.name,s=a.modelKey||a.name;return(e.get(r)??999)-(e.get(s)??999)})}return a}(t,r),plan:r.plan||null,message:r.message||null,raw:r};T(t=>({...t,[e]:s})),w(e,s)}catch(a){console.error(`[ProviderLimits] Error fetching quota for ${t} (${e}):`,a),_(t=>({...t,[e]:a.message||"Failed to fetch quota"}))}finally{O(t=>({...t,[e]:!1}))}},[]),eF=(0,s.useCallback)(async(e,t)=>{await e_(e,t),R(new Date)},[e_]),eL=(0,s.useCallback)(async e=>{if(confirm("Delete this connection?")){V(e);try{if((await fetch(`/api/providers/${e}`,{method:"DELETE"})).ok){T(t=>{let a={...t};return delete a[e],a}),O(t=>{let a={...t};return delete a[e],a}),_(t=>{let a={...t};return delete a[e],a});try{let t=k();t[e]&&(delete t[e],window.localStorage.setItem(y,JSON.stringify(t)))}catch(e){console.error("Error deleting cache entry:",e)}await v(eI,ew)}}catch(e){console.error("Error deleting connection:",e)}finally{V(null)}}},[eI,ew]),ez=(0,s.useCallback)(async(e,t)=>{Z(e);try{(await fetch(`/api/providers/${e}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({isActive:t})})).ok&&(T(e=>({...e})),await v(eI,ew))}catch(e){console.error("Error updating connection status:",e)}finally{Z(null)}},[eI,ew]),eR=(0,s.useCallback)(async e=>{if(!ea?.id)return;let t=ea.id,a=ea.provider;try{(await fetch(`/api/providers/${t}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})).ok&&(await eI(),et(!1),er(null),x.wb.includes(a)&&await e_(t,a))}catch(e){console.error("Error saving connection:",e)}},[ea,eI,e_]),eU=(0,s.useCallback)(async e=>{if(e?.id&&!ey){ek(e.id);try{let t=await fetch("/api/cli-tools/codex-settings/activate-account",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({connectionId:e.id,restartCodex:!0})}),a=await t.json().catch(()=>({}));if(!t.ok){let e=Array.isArray(a.installHints)&&a.installHints.length>0?a.installHints:a.installCommand?[a.installCommand]:[],t=e.length?`
|
|
2
|
-
Install: ${e.join(" or ")}`:"";throw Error(`${a.error||"Failed to activate Codex account"}${t}`)}let r=a.restart?.success?"Codex was restarted automatically.":a.restart?.reason?`Restart Codex manually: ${a.restart.reason}`:"Restart Codex to use it.",s=a.keychain?.success?"Keychain auth was updated.":a.keychain?.reason?`Keychain auth failed: ${a.keychain.reason}`:"",n=a.tokenWarning?` ${a.tokenWarning}`:"",l=`${a.account||e.email||e.name||"Account"} is now written to local Codex auth. ${s} ${r}${n}`.trim();a.keychain?.success&&a.restart?.success?eD.success(l,"Codex account activated"):eD.error(l,"Codex activation incomplete")}catch(e){eD.error(e.message||"Failed to activate Codex account","Codex activation failed")}finally{ek(null)}}},[ey,eD]);(0,s.useEffect)(()=>{let e=!1;return fetch("/api/proxy-pools?isActive=true",{cache:"no-store"}).then(e=>e.json()).then(t=>{!e&&t?.proxyPools&&en(t.proxyPools)}).catch(()=>{}),()=>{e=!0}},[]);let eJ=(0,s.useCallback)(async()=>{if(!K){Q(!0),W(60);try{let e=await eI(ew);O(g(e)),_(t=>f(t,e)),T(t=>f(t,e)),await Promise.all(e.map(e=>e_(e.id,e.provider))),R(new Date)}catch(e){console.error("Error refreshing all providers:",e)}finally{Q(!1)}}},[K,eI,e_,ew]);(0,s.useEffect)(()=>{(async()=>{G(!0);let e=await eI(ew);G(!1),O(g(e)),_(t=>f(t,e)),T(t=>f(t,e)),await Promise.all(e.map(e=>e_(e.id,e.provider))),R(new Date)})()},[eI,e_,ew]),(0,s.useEffect)(()=>{let e=window.localStorage.getItem(j);L(null===e||"true"===e),J(!0)},[]),(0,s.useEffect)(()=>{U&&window.localStorage.setItem(j,String(F))},[F,U]),(0,s.useEffect)(()=>{if(!U||!F){eM.current&&(clearInterval(eM.current),eM.current=null),eT.current&&(clearInterval(eT.current),eT.current=null);return}return eM.current=setInterval(()=>{eJ()},6e4),eT.current=setInterval(()=>{W(e=>e<=1?60:e-1)},1e3),()=>{eM.current&&clearInterval(eM.current),eT.current&&clearInterval(eT.current)}},[F,eJ,U]),(0,s.useEffect)(()=>{let e=()=>{document.hidden?(eM.current&&(clearInterval(eM.current),eM.current=null),eT.current&&(clearInterval(eT.current),eT.current=null)):F&&U&&(eM.current=setInterval(eJ,6e4),eT.current=setInterval(()=>{W(e=>e<=1?60:e-1)},1e3))};return document.addEventListener("visibilitychange",e),()=>{document.removeEventListener("visibilitychange",e)}},[F,eJ,U]);let eK=(0,s.useMemo)(()=>(function(e,t,a,r,s){if("codex"===r&&"default"!==s)return[...e].sort((e,a)=>{let r=p(e,t),n=p(a,t),l="remaining-asc"===s?r-n:n-r;return 0!==l?l:(b(e)||"").localeCompare(b(a)||"")});if(!a)return e;let n=e=>{let a=(t[e.id]?.quotas||[]).map(e=>e.resetAt?new Date(e.resetAt).getTime():1/0).filter(e=>Number.isFinite(e));return a.length>0?Math.min(...a):1/0};return[...e].sort((e,t)=>{let a=n(e)-n(t);return 0!==a?a:(e.provider||"").localeCompare(t.provider||"")||(b(e)||"").localeCompare(b(t)||"")})})(q,M,eh,el,em),[q,M,eh,el,em]),eQ=(0,s.useMemo)(()=>{let e=n?[...eK].sort((e,t)=>(!1===e.isActive)-(!1===t.isActive)):eK,t=Number.isFinite(A)&&A>0?Math.floor(A)*Math.max(1,Math.floor(E||1)):null;return t?e.slice(0,t):e},[n,E,A,eK]),eH=e=>{let t=M[e.id]?.quotas;return!!t?.length&&t.some(e=>!!e.total&&!(e.total<=0)&&5>=o(e.used,e.total))},eW=(0,s.useCallback)(async(e,t)=>{if(e.length&&!ef){ev(!0);try{await Promise.all(e.map(e=>fetch(`/api/providers/${e}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({isActive:t})}))),await v(eI,ew)}catch(e){console.error("Error bulk toggling connections:",e)}finally{ev(!1)}}},[ef,eI,ew]),eB="all"===el?"All providers":el,eG=eq.eligibleConnections>0,eY=eQ.length>0,eV=eq.eligibleConnections?eq.providerFilteredConnections?{icon:"filter_alt_off",title:"No Accounts On This Page",description:"Try moving to another page or refreshing the current filters."}:{icon:"filter_alt_off",title:"No Accounts Match Current Filters",description:"all"===el?"Try changing the account status filter to see more quota trackers.":`No ${"inactive"===ed?"turned off":"active"===ed?"active":"matching"} accounts found for ${el}.`}:{icon:"cloud_off",title:"No Providers Connected",description:"Connect to providers with OAuth to track your API quota limits and usage."},eX=function(e){var t;let{start:a,end:r}=(t=e).total?{start:(t.page-1)*t.pageSize+1,end:Math.min(t.page*t.pageSize,t.total)}:{start:0,end:0};return`Showing ${a}-${r} of ${e.total}`}(eA),eZ=!S.includes(eN);return B||eG?B||eY?(0,r.jsxs)("div",{className:"space-y-6",children:[(0,r.jsx)("div",{className:"flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-end",children:(0,r.jsxs)("div",{className:"flex flex-wrap items-center gap-1.5",children:[(0,r.jsxs)("div",{className:"relative",children:[(0,r.jsxs)("button",{type:"button",onClick:()=>eg(e=>!e),className:"flex h-8 items-center justify-between gap-1 rounded-lg border border-black/10 bg-black/[0.02] px-2 text-xs text-text-primary transition-colors hover:bg-black/5 dark:border-white/10 dark:bg-white/[0.03] dark:hover:bg-white/10","aria-haspopup":"menu","aria-expanded":ep,title:"Filter quota providers",children:[(0,r.jsxs)("span",{className:"flex min-w-0 items-center gap-1.5",children:["all"===el?(0,r.jsx)("span",{className:"material-symbols-outlined text-[14px] text-text-muted",children:"apps"}):(0,r.jsx)(l.A,{src:`/providers/${el}.png`,alt:el,size:18,className:"size-[18px] rounded object-contain",fallbackText:el.slice(0,2).toUpperCase()}),(0,r.jsx)("span",{className:"truncate capitalize hidden lg:inline",children:eB})]}),(0,r.jsx)("span",{className:"material-symbols-outlined text-[14px] text-text-muted",children:"expand_more"})]}),ep&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("button",{type:"button",className:"fixed inset-0 z-30 bg-transparent","aria-label":"Close provider filter",onClick:()=>eg(!1)}),(0,r.jsxs)("div",{className:"absolute left-0 z-40 mt-2 w-64 overflow-hidden rounded-2xl border border-black/10 bg-surface/95 p-1.5 shadow-xl shadow-black/10 backdrop-blur dark:border-white/10 dark:bg-surface/95 sm:w-72",children:[(0,r.jsxs)("button",{type:"button",onClick:()=>{"all"!==el&&ej(1),ei("all"),eg(!1)},className:`flex w-full items-center gap-3 rounded-xl px-3 py-2.5 text-left text-sm transition-colors ${"all"===el?"bg-primary/10 text-primary":"text-text-primary hover:bg-black/5 dark:hover:bg-white/10"}`,children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-[22px]",children:"apps"}),(0,r.jsx)("span",{className:"font-medium",children:"All providers"}),"all"===el&&(0,r.jsx)("span",{className:"material-symbols-outlined ml-auto text-[20px]",children:"check"})]}),(0,r.jsx)("div",{className:"my-1 h-px bg-black/10 dark:bg-white/10"}),(0,r.jsx)("div",{className:"max-h-72 overflow-y-auto pr-1",children:eo.map(e=>(0,r.jsxs)("button",{type:"button",onClick:()=>{el!==e&&ej(1),ei(e),eg(!1)},className:`flex w-full items-center gap-3 rounded-xl px-3 py-2.5 text-left text-sm transition-colors ${el===e?"bg-primary/10 text-primary":"text-text-primary hover:bg-black/5 dark:hover:bg-white/10"}`,children:[(0,r.jsx)(l.A,{src:`/providers/${e}.png`,alt:e,size:24,className:"size-6 rounded-md object-contain",fallbackText:e.slice(0,2).toUpperCase()}),(0,r.jsx)("span",{className:"font-medium capitalize",children:e}),el===e&&(0,r.jsx)("span",{className:"material-symbols-outlined ml-auto text-[20px]",children:"check"})]},e))})]})]})]}),(0,r.jsx)("select",{value:ed,onChange:e=>{let t=e.target.value;ed!==t&&ej(1),eu(t)},className:"h-8 rounded-lg border border-black/10 bg-black/[0.02] px-2 text-xs text-text-primary outline-none transition-colors hover:bg-black/5 dark:border-white/10 dark:bg-white/[0.03] dark:hover:bg-white/10","aria-label":"Filter accounts by status",children:N.map(e=>(0,r.jsx)("option",{value:e.value,children:e.label},e.value))}),"codex"===el&&(0,r.jsx)("select",{value:em,onChange:e=>ex(e.target.value),className:"h-8 rounded-lg border border-black/10 bg-black/[0.02] px-2 text-xs text-text-primary outline-none transition-colors hover:bg-black/5 dark:border-white/10 dark:bg-white/[0.03] dark:hover:bg-white/10","aria-label":"Sort Codex quotas by remaining",children:C.map(e=>(0,r.jsx)("option",{value:e.value,children:e.label},e.value))}),(0,r.jsxs)("button",{type:"button",onClick:()=>eb(e=>!e),"aria-pressed":eh,className:`flex h-8 shrink-0 items-center gap-1 rounded-lg border px-2 text-xs transition-colors ${eh?"border-amber-500/40 bg-amber-500/10 text-amber-500":"border-black/10 text-text-primary hover:bg-black/5 dark:border-white/10 dark:hover:bg-white/5"}`,title:"Sort accounts by earliest quota reset time",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"hourglass_top"}),(0,r.jsx)("span",{className:"hidden sm:inline",children:"Expiring first"})]}),!e&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("button",{type:"button",onClick:()=>{eW(eQ.filter(e=>(e.isActive??!0)&&eH(e)).map(e=>e.id),!1)},disabled:ef,className:"flex h-8 shrink-0 items-center gap-1 rounded-lg border border-red-500/30 px-2 text-xs text-red-500 transition-colors hover:bg-red-500/10 disabled:opacity-50",title:"Disable connections with depleted quota on the current page",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"block"}),(0,r.jsx)("span",{className:"hidden sm:inline",children:"Turn off Empty"})]}),(0,r.jsxs)("button",{type:"button",onClick:()=>{eW(eQ.filter(e=>!(e.isActive??!0)&&!eH(e)).map(e=>e.id),!0)},disabled:ef,className:"flex h-8 shrink-0 items-center gap-1 rounded-lg border border-emerald-500/30 px-2 text-xs text-emerald-500 transition-colors hover:bg-emerald-500/10 disabled:opacity-50",title:"Enable connections that still have quota on the current page",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"check_circle"}),(0,r.jsx)("span",{className:"hidden sm:inline",children:"Turn on Available"})]})]}),(0,r.jsxs)("button",{onClick:()=>L(e=>!e),className:"flex h-8 shrink-0 items-center gap-1 rounded-lg border border-black/10 px-2 text-xs transition-colors hover:bg-black/5 dark:border-white/10 dark:hover:bg-white/5",title:F?"Disable auto-refresh":"Enable auto-refresh",children:[(0,r.jsx)("span",{className:`material-symbols-outlined text-[14px] ${F?"text-primary":"text-text-muted"}`,children:F?"toggle_on":"toggle_off"}),(0,r.jsx)("span",{className:"hidden text-text-primary sm:inline",children:"Auto-refresh"}),F&&(0,r.jsxs)("span",{className:"text-[10px] text-text-muted tabular-nums",children:["(",H,"s)"]})]}),(0,r.jsx)("button",{type:"button",onClick:eJ,disabled:K,className:"flex h-8 shrink-0 items-center gap-1 rounded-lg border border-black/10 px-2 text-xs text-text-primary transition-colors hover:bg-black/5 dark:border-white/10 dark:hover:bg-white/5 disabled:opacity-50",title:"Refresh all",children:(0,r.jsx)("span",{className:`material-symbols-outlined text-[14px] ${K?"animate-spin":""}`,children:"refresh"})})]})}),eh&&(0,r.jsx)("div",{className:"rounded-xl border border-amber-500/20 bg-amber-500/10 px-3 py-2 text-xs text-amber-700 dark:text-amber-300",children:"Expiring-first currently reorders accounts inside the current page. Cross-page ordering still follows backend pagination."}),(0,r.jsx)("div",{className:a,children:eQ.map(t=>{let a=M[t.id],s=D[t.id],n=I[t.id],i=!1===t.isActive,o=Y===t.id||X===t.id,m=ey===t.id;return(0,r.jsxs)(u.default,{padding:"none",className:`min-w-0 ${i?"opacity-60":""}`,children:[(0,r.jsx)("div",{className:"px-3 py-2 border-b border-black/10 dark:border-white/10",children:(0,r.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2 min-w-0",children:[(0,r.jsx)("div",{className:"w-8 h-8 shrink-0 rounded-md flex items-center justify-center overflow-hidden",children:(0,r.jsx)(l.A,{src:`/providers/${t.provider}.png`,alt:t.provider,size:32,className:"object-contain",fallbackText:t.provider?.slice(0,2).toUpperCase()||"PR"})}),(0,r.jsxs)("div",{className:"min-w-0",children:[(0,r.jsx)("h3",{className:"text-sm font-semibold text-text-primary capitalize truncate",children:t.provider}),b(t)?(0,r.jsx)("p",{className:"text-xs text-text-muted truncate",children:b(t)}):null]})]}),(0,r.jsxs)("div",{className:"flex items-center gap-1 shrink-0",children:[(0,r.jsx)("button",{type:"button",onClick:()=>eF(t.id,t.provider),disabled:s||o,"aria-label":"Refresh quota",className:"p-1.5 rounded-lg hover:bg-black/5 dark:hover:bg-white/5 transition-colors disabled:opacity-50",title:"Refresh quota",children:(0,r.jsx)("span",{className:`material-symbols-outlined text-[18px] text-text-muted ${s?"animate-spin":""}`,children:"refresh"})}),eO&&"codex"===t.provider&&(0,r.jsxs)("button",{type:"button",onClick:()=>eU(t),disabled:o||m,className:"h-8 inline-flex items-center gap-1 rounded-lg border border-emerald-500/30 px-2 text-xs font-medium text-emerald-600 hover:bg-emerald-500/10 transition-colors disabled:opacity-50 dark:text-emerald-400",title:"Activate this account in local Codex",children:[(0,r.jsx)("span",{className:`material-symbols-outlined text-[18px] ${m?"animate-pulse":""}`,children:"key"}),(0,r.jsx)("span",{children:"Activate"})]}),!e&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("button",{type:"button",onClick:()=>{er(t),et(!0)},disabled:o,"aria-label":"Edit connection",className:"p-1.5 rounded-lg hover:bg-black/5 dark:hover:bg-white/5 text-text-muted hover:text-primary transition-colors disabled:opacity-50",title:"Edit connection",children:(0,r.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"edit"})}),(0,r.jsx)("button",{type:"button",onClick:()=>eL(t.id),disabled:o,"aria-label":"Delete connection",className:"p-1.5 rounded-lg hover:bg-red-500/10 text-red-500 transition-colors disabled:opacity-50",title:"Delete connection",children:(0,r.jsx)("span",{className:`material-symbols-outlined text-[18px] ${Y===t.id?"animate-pulse":""}`,children:"delete"})}),(0,r.jsx)("div",{className:"inline-flex items-center pl-0.5",title:t.isActive??!0?"Disable connection":"Enable connection",children:(0,r.jsx)(d.default,{size:"sm",checked:t.isActive??!0,disabled:o,onChange:e=>ez(t.id,e)})})]})]})]})}),(0,r.jsx)("div",{className:"px-2 py-1.5",children:s?(0,r.jsx)("div",{className:"text-center py-5 text-text-muted",children:(0,r.jsx)("span",{className:"material-symbols-outlined text-[28px] animate-spin",children:"progress_activity"})}):n?(0,r.jsxs)("div",{className:"text-center py-5",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-[28px] text-red-500",children:"error"}),(0,r.jsx)("p",{className:"mt-1.5 text-xs text-text-muted",children:n})]}):a?.message?(0,r.jsx)("div",{className:"text-center py-5",children:(0,r.jsx)("p",{className:"text-xs text-text-muted",children:a.message})}):(0,r.jsx)(c,{quotas:a?.quotas,compact:!0,sortMode:"default",showSortLabel:"codex"===t.provider&&"default"!==em})})]},t.id)})}),(0,r.jsx)("div",{className:"rounded-xl border border-black/10 bg-black/[0.02] px-3 py-2 dark:border-white/10 dark:bg-white/[0.03]",children:(0,r.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[(0,r.jsx)("span",{className:"text-xs text-text-muted",children:eX}),(0,r.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,r.jsxs)("select",{value:eZ?"custom":String(eN),onChange:e=>{let t=e.target.value;if("custom"===t)return;let a=Number.parseInt(t,10);Number.isFinite(a)&&(ej(1),eC(a),e$(String(a)))},className:"h-8 rounded-lg border border-black/10 bg-black/[0.02] px-2 text-xs text-text-primary outline-none transition-colors hover:bg-black/5 dark:border-white/10 dark:bg-white/[0.03] dark:hover:bg-white/10","aria-label":"Accounts per page",children:[S.map(e=>(0,r.jsxs)("option",{value:String(e),children:[e," / page"]},e)),(0,r.jsx)("option",{value:"custom",children:"Custom"})]}),(0,r.jsx)("input",{type:"number",min:"1",max:String(500),inputMode:"numeric",value:eS,onChange:e=>e$(e.target.value),onBlur:()=>{let e=Number.parseInt(eS,10);if(!Number.isFinite(e))return void e$(String(eN));let t=Math.min(500,Math.max(1,e));ej(1),eC(t),e$(String(t))},onKeyDown:e=>{if("Enter"!==e.key)return;let t=Number.parseInt(eS,10);if(!Number.isFinite(t))return void e$(String(eN));let a=Math.min(500,Math.max(1,t));ej(1),eC(a),e$(String(a))},className:"h-8 w-20 rounded-lg border border-black/10 bg-black/[0.02] px-2 text-xs text-text-primary outline-none transition-colors hover:bg-black/5 dark:border-white/10 dark:bg-white/[0.03] dark:hover:bg-white/10","aria-label":"Custom accounts per page",placeholder:"Custom"}),(0,r.jsxs)("span",{className:"text-xs text-text-muted",children:["Page ",eA.page," / ",eA.totalPages]})]}),(0,r.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,r.jsx)("button",{type:"button",onClick:()=>ej(1),disabled:eA.page<=1||B||K,className:"flex h-8 items-center rounded-lg border border-black/10 px-3 text-xs text-text-primary transition-colors hover:bg-black/5 disabled:cursor-not-allowed disabled:opacity-40 dark:border-white/10 dark:hover:bg-white/5",children:"First Page"}),(0,r.jsx)("button",{type:"button",onClick:()=>ej(e=>Math.max(1,e-1)),disabled:eA.page<=1||B||K,className:"flex h-8 w-8 items-center justify-center rounded-lg border border-black/10 text-text-primary transition-colors hover:bg-black/5 disabled:cursor-not-allowed disabled:opacity-40 dark:border-white/10 dark:hover:bg-white/5","aria-label":"Previous accounts page",children:(0,r.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"chevron_left"})}),(0,r.jsx)("button",{type:"button",onClick:()=>ej(e=>Math.min(eA.totalPages,e+1)),disabled:eA.page>=eA.totalPages||B||K,className:"flex h-8 w-8 items-center justify-center rounded-lg border border-black/10 text-text-primary transition-colors hover:bg-black/5 disabled:cursor-not-allowed disabled:opacity-40 dark:border-white/10 dark:hover:bg-white/5","aria-label":"Next accounts page",children:(0,r.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"chevron_right"})}),(0,r.jsx)("button",{type:"button",onClick:()=>ej(eA.totalPages),disabled:eA.page>=eA.totalPages||B||K,className:"flex h-8 items-center rounded-lg border border-black/10 px-3 text-xs text-text-primary transition-colors hover:bg-black/5 disabled:cursor-not-allowed disabled:opacity-40 dark:border-white/10 dark:hover:bg-white/5",children:"Last Page"})]})]})}),(0,r.jsx)(m.wI,{isOpen:ee,connection:ea,proxyPools:es,onSave:eR,onClose:()=>{et(!1),er(null)}})]}):(0,r.jsx)(u.default,{padding:"lg",children:(0,r.jsxs)("div",{className:"text-center py-12",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-[64px] text-text-muted opacity-20",children:eV.icon}),(0,r.jsx)("h3",{className:"mt-4 text-lg font-semibold text-text-primary",children:eV.title}),(0,r.jsx)("p",{className:"mt-2 text-sm text-text-muted max-w-md mx-auto",children:eV.description})]})}):(0,r.jsx)(u.default,{padding:"lg",children:(0,r.jsxs)("div",{className:"text-center py-12",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-[64px] text-text-muted opacity-20",children:"cloud_off"}),(0,r.jsx)("h3",{className:"mt-4 text-lg font-semibold text-text-primary",children:"No Providers Connected"}),(0,r.jsx)("p",{className:"mt-2 text-sm text-text-muted max-w-md mx-auto",children:"Connect to providers with OAuth to track your API quota limits and usage."})]})})}function A(){return(0,r.jsx)(s.Suspense,{fallback:(0,r.jsx)(n.CardSkeleton,{}),children:(0,r.jsx)(E,{})})}function E(){let[e,t]=(0,s.useState)({loading:!0,role:null,showQuotaTracker:!0});return((0,s.useEffect)(()=>{let e=!1;return fetch("/api/auth/me",{cache:"no-store"}).then(e=>e.json()).then(a=>{if(!e){if("sub_user"===a.role&&!1===a.showQuotaTracker){window.location.href="/dashboard/user";return}t({loading:!1,role:a.role||null,showQuotaTracker:!1!==a.showQuotaTracker})}}).catch(()=>{e||t({loading:!1,role:null,showQuotaTracker:!0})}),()=>{e=!0}},[]),e.loading)?(0,r.jsx)(n.CardSkeleton,{}):(0,r.jsx)($,{readOnly:"sub_user"===e.role,allowCodexActivation:"sub_user"===e.role})}}},e=>{e.O(0,[2574,3862,1051,1321,5497,8441,3794,7358],()=>e(e.s=61034)),_N_E=e.O()}]);
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3826],{61034:(e,t,a)=>{Promise.resolve().then(a.bind(a,84509))},84509:(e,t,a)=>{"use strict";a.r(t),a.d(t,{default:()=>A});var r=a(95155),s=a(12115),n=a(25086),l=a(57250),i=a(45564);function o(e,t){return t&&0!==t?!e||e<0?100:e>=t?0:Math.round((t-e)/t*100):0}function c({quotas:e=[],compact:t=!1,sortMode:a="default",showSortLabel:n=!1}){let[l,i]=(0,s.useState)(1),d=(0,s.useMemo)(()=>e.map((e,t)=>({...e,index:t,remaining:e?.remaining!==void 0?Math.max(0,Math.round(e.remaining)):e?.remainingPercentage!==void 0?Math.round(e.remainingPercentage):o(e?.used,e?.total)})),[e]),u=(0,s.useMemo)(()=>"remaining-asc"===a?[...d].sort((e,t)=>e.remaining-t.remaining||e.name.localeCompare(t.name)):"remaining-desc"===a?[...d].sort((e,t)=>t.remaining-e.remaining||e.name.localeCompare(t.name)):d,[d,a]),m=Math.max(1,Math.ceil(u.length/10));if((0,s.useEffect)(()=>{i(1)},[a,e]),(0,s.useEffect)(()=>{i(e=>Math.min(e,m))},[m]),!e||0===e.length)return null;let x=u.slice((l-1)*10,10*l),h=0===u.length?0:(l-1)*10+1,b=Math.min(10*l,u.length),p=t?"py-1 px-1.5":"py-2 px-3",g=t?"text-[11px]":"text-sm",f=t?"text-[11px]":"text-sm",v=t?"text-[10px] leading-tight":"text-xs";return(0,r.jsxs)("div",{className:"space-y-2",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,r.jsxs)("div",{className:"text-[10px] text-text-muted",children:[u.length," quota",u.length>1?"s":""]}),n&&(0,r.jsx)("div",{className:"rounded-md border border-black/10 bg-black/[0.02] px-2 py-1 text-[10px] text-text-muted dark:border-white/10 dark:bg-white/[0.03]",children:"Sorted by account remaining"})]}),(0,r.jsx)("div",{className:"overflow-x-auto",children:(0,r.jsx)("table",{className:"w-full table-fixed text-left",children:(0,r.jsx)("tbody",{children:x.map(e=>{var a;let s=(a=e.remaining)>70?{text:"text-green-600 dark:text-green-400",bg:"bg-green-500",bgLight:"bg-green-500/10",emoji:"\uD83D\uDFE2"}:a>=30?{text:"text-yellow-600 dark:text-yellow-400",bg:"bg-yellow-500",bgLight:"bg-yellow-500/10",emoji:"\uD83D\uDFE1"}:{text:"text-red-600 dark:text-red-400",bg:"bg-red-500",bgLight:"bg-red-500/10",emoji:"\uD83D\uDD34"},n=function(e){if(!e)return"-";try{let t="string"==typeof e?new Date(e):e,a=new Date,r=t-a;if(r<=0)return"-";let s=Math.ceil(r/6e4);if(s<60)return`${s}m`;let n=Math.floor(s/60),l=s%60;if(n<24)return`${n}h ${l}m`;let i=Math.floor(n/24);return`${i}d ${n%24}h ${l}m`}catch(e){return"-"}}(e.resetAt),l=function(e){if(!e)return null;try{let t=new Date(e),a=new Date,r=new Date(a.getFullYear(),a.getMonth(),a.getDate()),s=new Date(r);s.setDate(s.getDate()+1);let n="";n=t>=r&&t<s?"Today":t>=s&&t<new Date(s.getTime()+864e5)?"Tomorrow":t.toLocaleDateString("en-US",{month:"short",day:"numeric"});let l=t.toLocaleTimeString("en-US",{hour:"numeric",minute:"2-digit",hour12:!0});return`${n}, ${l}`}catch{return null}}(e.resetAt);return(0,r.jsxs)("tr",{className:"border-b border-black/5 dark:border-white/5 hover:bg-black/[0.02] dark:hover:bg-white/[0.02] transition-colors",children:[(0,r.jsx)("td",{className:`${p} w-[30%]`,children:(0,r.jsxs)("div",{className:"flex items-center gap-1.5 min-w-0",children:[(0,r.jsx)("span",{className:"text-[10px] shrink-0",children:s.emoji}),(0,r.jsx)("span",{className:`${g} font-medium text-text-primary truncate`,children:e.name})]})}),(0,r.jsx)("td",{className:`${p} w-[45%]`,children:(0,r.jsxs)("div",{className:t?"space-y-1":"space-y-1.5",children:[(0,r.jsx)("div",{className:`${t?"h-1":"h-1.5"} rounded-full overflow-hidden border ${s.bgLight} ${0===e.remaining?"border-black/10 dark:border-white/10":"border-transparent"}`,children:(0,r.jsx)("div",{className:`h-full transition-all duration-300 ${s.bg}`,style:{width:`${Math.min(e.remaining,100)}%`}})}),(0,r.jsxs)("div",{className:`flex items-center justify-between ${t?"text-[10px]":"text-xs"}`,children:[(0,r.jsxs)("span",{className:"text-text-muted",children:[e.used.toLocaleString()," / ",e.total>0?e.total.toLocaleString():"∞"]}),(0,r.jsxs)("span",{className:`font-medium ${s.text}`,children:[e.remaining,"%"]})]})]})}),(0,r.jsx)("td",{className:`${p} w-[25%]`,children:"-"!==n||l?t?(0,r.jsx)("div",{className:`${f} text-text-primary font-medium truncate`,title:l||"",children:"-"!==n?`in ${n}`:l}):(0,r.jsxs)("div",{className:"space-y-0.5",children:["-"!==n&&(0,r.jsxs)("div",{className:`${f} text-text-primary font-medium`,children:["in ",n]}),l&&(0,r.jsx)("div",{className:`${v} text-text-muted`,children:l})]}):(0,r.jsx)("div",{className:`${f} text-text-muted italic`,children:"N/A"})})]},`${e.name}-${e.index}`)})})})}),m>1&&(0,r.jsxs)("div",{className:"rounded-md border border-black/10 bg-black/[0.02] px-2 py-1.5 dark:border-white/10 dark:bg-white/[0.03]",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between gap-2 text-[10px] text-text-muted",children:[(0,r.jsxs)("span",{children:["Showing ",h,"-",b," of ",u.length]}),(0,r.jsxs)("span",{children:["Page ",l," / ",m]})]}),(0,r.jsxs)("div",{className:"mt-1.5 flex items-center justify-end gap-1",children:[(0,r.jsx)("button",{type:"button",onClick:()=>i(e=>Math.max(1,e-1)),disabled:1===l,className:"flex h-6 items-center rounded-md border border-black/10 px-2 text-[10px] text-text-primary transition-colors hover:bg-black/5 disabled:cursor-not-allowed disabled:opacity-40 dark:border-white/10 dark:hover:bg-white/5",children:"Prev"}),(0,r.jsx)("button",{type:"button",onClick:()=>i(e=>Math.min(m,e+1)),disabled:l===m,className:"flex h-6 items-center rounded-md border border-black/10 px-2 text-[10px] text-text-primary transition-colors hover:bg-black/5 disabled:cursor-not-allowed disabled:opacity-40 dark:border-white/10 dark:hover:bg-white/5",children:"Next"})]})]})]})}var d=a(98542),u=a(84588),m=a(35497),x=a(52679),h=a(65921);function b(e){let t=e=>"string"==typeof e&&/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(e);return t(e.email)?e.email:(t(e.name),e.name)}function p(e,t){let a=t[e.id]?.quotas?.[0];return a&&"number"==typeof a.remaining?a.remaining:1/0}function g(e){let t={};return e.forEach(e=>{t[e.id]=!0}),t}function f(e,t){let a=new Set(t.map(e=>e.id));return Object.fromEntries(Object.entries(e).filter(([e])=>a.has(e)))}async function v(e,t){return await e(t)}let y="quotaCacheData";function k(){try{let e=window.localStorage.getItem(y);return e?JSON.parse(e):{}}catch(e){return console.error("Error reading quota cache:",e),{}}}function w(e,t){try{let a=k();a[e]={...t,cachedAt:new Date().toISOString()},window.localStorage.setItem(y,JSON.stringify(a))}catch(e){console.error("Error writing quota cache:",e)}}let j="quotaAutoRefresh",N=[{value:"all",label:"All accounts"},{value:"active",label:"Active"},{value:"inactive",label:"Turned off"}],C=[{value:"default",label:"Default quota order"},{value:"remaining-asc",label:"% quota: low to high"},{value:"remaining-desc",label:"% quota: high to low"}],S=[10,20,50,100];function $({readOnly:e=!1,allowCodexActivation:t=!1,gridClassName:a="grid grid-cols-1 md:grid-cols-2 gap-3",activeFirst:n=!1,maxRows:A=null,maxColumns:E=4}){let[q,P]=(0,s.useState)([]),[M,T]=(0,s.useState)({}),[O,D]=(0,s.useState)({}),[I,_]=(0,s.useState)({}),[F,L]=(0,s.useState)(!0),[z,R]=(0,s.useState)(null),[U,J]=(0,s.useState)(!1),[K,Q]=(0,s.useState)(!1),[H,W]=(0,s.useState)(60),[B,G]=(0,s.useState)(!0),[Y,V]=(0,s.useState)(null),[X,Z]=(0,s.useState)(null),[ee,et]=(0,s.useState)(!1),[ea,er]=(0,s.useState)(null),[es,en]=(0,s.useState)([]),[el,ei]=(0,s.useState)("all"),[eo,ec]=(0,s.useState)([]),[ed,eu]=(0,s.useState)("all"),[em,ex]=(0,s.useState)("default"),[eh,eb]=(0,s.useState)(!1),[ep,eg]=(0,s.useState)(!1),[ef,ev]=(0,s.useState)(!1),[ey,ek]=(0,s.useState)(null),[ew,ej]=(0,s.useState)(1),[eN,eC]=(0,s.useState)(20),[eS,e$]=(0,s.useState)(String(20)),[eA,eE]=(0,s.useState)({page:1,pageSize:20,total:0,totalPages:1}),[eq,eP]=(0,s.useState)({eligibleConnections:0,providerFilteredConnections:0}),eM=(0,s.useRef)(null),eT=(0,s.useRef)(null),eO=(0,h.i)(),eD=!e||t,eI=(0,s.useCallback)(async(e=ew)=>{try{var t,a;let r=new URLSearchParams({page:String(e),pageSize:String(eN),accountStatus:ed,sort:"priority"});"all"!==el&&r.set("provider",el);let s=await fetch(`/api/providers/client?${r.toString()}`);if(!s.ok)throw Error("Failed to fetch connections");let n=await s.json(),l=n.connections||[],i=(t=n.pagination,t||{page:1,pageSize:eN,total:0,totalPages:1}),o=function(e,t=0){return e||{eligibleConnections:t,providerFilteredConnections:t}}(n.totals,l.length);return P(l),ec(n.providerOptions||[]),eE(i),eP(o),ej((a=n.pagination,a?.page||e)),l}catch(e){return console.error("Error fetching connections:",e),P([]),ec([]),eE({page:1,pageSize:eN,total:0,totalPages:1}),eP({eligibleConnections:0,providerFilteredConnections:0}),[]}},[ed,eh,ew,eN,el]),e_=(0,s.useCallback)(async(e,t)=>{D(t=>({...t,[e]:!0})),_(t=>({...t,[e]:null}));try{console.log(`[ProviderLimits] Fetching quota for ${t} (${e})`);let a=await fetch(`/api/usage/${e}`);if(!a.ok){let r=(await a.json().catch(()=>({}))).error||a.statusText;if(404===a.status)return void console.warn(`[ProviderLimits] Connection not found for ${t}, skipping`);if(401===a.status){console.warn(`[ProviderLimits] Auth error for ${t}:`,r);let a={quotas:[],message:r};T(t=>({...t,[e]:a})),w(e,a);return}throw Error(`HTTP ${a.status}: ${r}`)}let r=await a.json();console.log(`[ProviderLimits] Got quota for ${t}:`,r);let s={quotas:function(e,t){if(!t||"object"!=typeof t)return[];let a=[];try{switch(e.toLowerCase()){case"github":default:t.quotas&&Object.entries(t.quotas).forEach(([e,t])=>{a.push({name:e,used:t.used||0,total:t.total||0,resetAt:t.resetAt||null})});break;case"antigravity":t.quotas&&Object.entries(t.quotas).forEach(([e,t])=>{a.push({name:t.displayName||e,modelKey:e,used:t.used||0,total:t.total||0,resetAt:t.resetAt||null,remainingPercentage:t.remainingPercentage})});break;case"codex":t.quotas&&Object.entries(t.quotas).forEach(([e,t])=>{a.push({name:e,used:t.used||0,total:t.total||0,remaining:t.remaining,resetAt:t.resetAt||null})});break;case"kiro":t.quotas&&Object.entries(t.quotas).forEach(([e,t])=>{a.push({name:e,used:t.used||0,total:t.total||0,resetAt:t.resetAt||null})});break;case"qoder":t.quotas&&Object.entries(t.quotas).forEach(([e,t])=>{("organization"!==e||t&&0!==(Number(t.total)||0))&&a.push({name:"user"===e?"Personal":"organization"===e?"Organization":e,used:t.used||0,total:t.total||0,unit:t.unit,resetAt:t.resetAt||null})});break;case"claude":t.message?a.push({name:"error",used:0,total:0,resetAt:null,message:t.message}):t.quotas&&Object.entries(t.quotas).forEach(([e,t])=>{a.push({name:e,used:t.used||0,total:t.total||0,resetAt:t.resetAt||null})});break;case"vercel-ai-gateway":t.quotas&&Object.entries(t.quotas).forEach(([e,t])=>{a.push({name:e,used:t.used||0,total:t.total||0,resetAt:t.resetAt||null,remainingPercentage:t.remainingPercentage})})}}catch(t){return console.error(`Error parsing quota data for ${e}:`,t),[]}let r=(0,i.KC)(e);if(r.length>0){let e=new Map(r.map((e,t)=>[e.id,t]));a.sort((t,a)=>{let r=t.modelKey||t.name,s=a.modelKey||a.name;return(e.get(r)??999)-(e.get(s)??999)})}return a}(t,r),plan:r.plan||null,message:r.message||null,raw:r};T(t=>({...t,[e]:s})),w(e,s)}catch(a){console.error(`[ProviderLimits] Error fetching quota for ${t} (${e}):`,a),_(t=>({...t,[e]:a.message||"Failed to fetch quota"}))}finally{D(t=>({...t,[e]:!1}))}},[]),eF=(0,s.useCallback)(async(e,t)=>{await e_(e,t),R(new Date)},[e_]),eL=(0,s.useCallback)(async e=>{if(confirm("Delete this connection?")){V(e);try{if((await fetch(`/api/providers/${e}`,{method:"DELETE"})).ok){T(t=>{let a={...t};return delete a[e],a}),D(t=>{let a={...t};return delete a[e],a}),_(t=>{let a={...t};return delete a[e],a});try{let t=k();t[e]&&(delete t[e],window.localStorage.setItem(y,JSON.stringify(t)))}catch(e){console.error("Error deleting cache entry:",e)}await v(eI,ew)}}catch(e){console.error("Error deleting connection:",e)}finally{V(null)}}},[eI,ew]),ez=(0,s.useCallback)(async(e,t)=>{Z(e);try{(await fetch(`/api/providers/${e}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({isActive:t})})).ok&&(T(e=>({...e})),await v(eI,ew))}catch(e){console.error("Error updating connection status:",e)}finally{Z(null)}},[eI,ew]),eR=(0,s.useCallback)(async e=>{if(!ea?.id)return;let t=ea.id,a=ea.provider;try{(await fetch(`/api/providers/${t}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})).ok&&(await eI(),et(!1),er(null),x.wb.includes(a)&&await e_(t,a))}catch(e){console.error("Error saving connection:",e)}},[ea,eI,e_]),eU=(0,s.useCallback)(async e=>{if(e?.id&&!ey){ek(e.id);try{let t=await fetch("/api/cli-tools/codex-settings/activate-account",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({connectionId:e.id,restartCodex:!0})}),a=await t.json().catch(()=>({}));if(!t.ok){let e=Array.isArray(a.installHints)&&a.installHints.length>0?a.installHints:a.installCommand?[a.installCommand]:[],t=e.length?`
|
|
2
|
+
Install: ${e.join(" or ")}`:"";throw Error(`${a.error||"Failed to activate Codex account"}${t}`)}let r=a.restart?.success?"Codex was restarted automatically.":a.restart?.reason?`Restart Codex manually: ${a.restart.reason}`:"Restart Codex to use it.",s=a.keychain?.success?"Keychain auth was updated.":a.keychain?.reason?`Keychain auth failed: ${a.keychain.reason}`:"",n=a.tokenWarning?` ${a.tokenWarning}`:"",l=`${a.account||e.email||e.name||"Account"} is now written to local Codex auth. ${s} ${r}${n}`.trim();a.keychain?.success&&a.restart?.success?eO.success(l,"Codex account activated"):eO.error(l,"Codex activation incomplete")}catch(e){eO.error(e.message||"Failed to activate Codex account","Codex activation failed")}finally{ek(null)}}},[ey,eO]);(0,s.useEffect)(()=>{let e=!1;return fetch("/api/proxy-pools?isActive=true",{cache:"no-store"}).then(e=>e.json()).then(t=>{!e&&t?.proxyPools&&en(t.proxyPools)}).catch(()=>{}),()=>{e=!0}},[]);let eJ=(0,s.useCallback)(async()=>{if(!K){Q(!0),W(60);try{let e=await eI(ew);D(g(e)),_(t=>f(t,e)),T(t=>f(t,e)),await Promise.all(e.map(e=>e_(e.id,e.provider))),R(new Date)}catch(e){console.error("Error refreshing all providers:",e)}finally{Q(!1)}}},[K,eI,e_,ew]);(0,s.useEffect)(()=>{(async()=>{G(!0);let e=await eI(ew);G(!1),D(g(e)),_(t=>f(t,e)),T(t=>f(t,e)),await Promise.all(e.map(e=>e_(e.id,e.provider))),R(new Date)})()},[eI,e_,ew]),(0,s.useEffect)(()=>{let e=window.localStorage.getItem(j);L(null===e||"true"===e),J(!0)},[]),(0,s.useEffect)(()=>{U&&window.localStorage.setItem(j,String(F))},[F,U]),(0,s.useEffect)(()=>{if(!U||!F){eM.current&&(clearInterval(eM.current),eM.current=null),eT.current&&(clearInterval(eT.current),eT.current=null);return}return eM.current=setInterval(()=>{eJ()},6e4),eT.current=setInterval(()=>{W(e=>e<=1?60:e-1)},1e3),()=>{eM.current&&clearInterval(eM.current),eT.current&&clearInterval(eT.current)}},[F,eJ,U]),(0,s.useEffect)(()=>{let e=()=>{document.hidden?(eM.current&&(clearInterval(eM.current),eM.current=null),eT.current&&(clearInterval(eT.current),eT.current=null)):F&&U&&(eM.current=setInterval(eJ,6e4),eT.current=setInterval(()=>{W(e=>e<=1?60:e-1)},1e3))};return document.addEventListener("visibilitychange",e),()=>{document.removeEventListener("visibilitychange",e)}},[F,eJ,U]);let eK=(0,s.useMemo)(()=>(function(e,t,a,r,s){if("codex"===r&&"default"!==s)return[...e].sort((e,a)=>{let r=p(e,t),n=p(a,t),l="remaining-asc"===s?r-n:n-r;return 0!==l?l:(b(e)||"").localeCompare(b(a)||"")});if(!a)return e;let n=e=>{let a=(t[e.id]?.quotas||[]).map(e=>e.resetAt?new Date(e.resetAt).getTime():1/0).filter(e=>Number.isFinite(e));return a.length>0?Math.min(...a):1/0};return[...e].sort((e,t)=>{let a=n(e)-n(t);return 0!==a?a:(e.provider||"").localeCompare(t.provider||"")||(b(e)||"").localeCompare(b(t)||"")})})(q,M,eh,el,em),[q,M,eh,el,em]),eQ=(0,s.useMemo)(()=>{let e=n?[...eK].sort((e,t)=>(!1===e.isActive)-(!1===t.isActive)):eK,t=Number.isFinite(A)&&A>0?Math.floor(A)*Math.max(1,Math.floor(E||1)):null;return t?e.slice(0,t):e},[n,E,A,eK]),eH=e=>{let t=M[e.id]?.quotas;return!!t?.length&&t.some(e=>!!e.total&&!(e.total<=0)&&5>=o(e.used,e.total))},eW=(0,s.useCallback)(async(e,t)=>{if(e.length&&!ef){ev(!0);try{await Promise.all(e.map(e=>fetch(`/api/providers/${e}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({isActive:t})}))),await v(eI,ew)}catch(e){console.error("Error bulk toggling connections:",e)}finally{ev(!1)}}},[ef,eI,ew]),eB="all"===el?"All providers":el,eG=eq.eligibleConnections>0,eY=eQ.length>0,eV=eq.eligibleConnections?eq.providerFilteredConnections?{icon:"filter_alt_off",title:"No Accounts On This Page",description:"Try moving to another page or refreshing the current filters."}:{icon:"filter_alt_off",title:"No Accounts Match Current Filters",description:"all"===el?"Try changing the account status filter to see more quota trackers.":`No ${"inactive"===ed?"turned off":"active"===ed?"active":"matching"} accounts found for ${el}.`}:{icon:"cloud_off",title:"No Providers Connected",description:"Connect to providers with OAuth to track your API quota limits and usage."},eX=function(e){var t;let{start:a,end:r}=(t=e).total?{start:(t.page-1)*t.pageSize+1,end:Math.min(t.page*t.pageSize,t.total)}:{start:0,end:0};return`Showing ${a}-${r} of ${e.total}`}(eA),eZ=!S.includes(eN);return B||eG?B||eY?(0,r.jsxs)("div",{className:"space-y-6",children:[(0,r.jsx)("div",{className:"flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-end",children:(0,r.jsxs)("div",{className:"flex flex-wrap items-center gap-1.5",children:[(0,r.jsxs)("div",{className:"relative",children:[(0,r.jsxs)("button",{type:"button",onClick:()=>eg(e=>!e),className:"flex h-8 items-center justify-between gap-1 rounded-lg border border-black/10 bg-black/[0.02] px-2 text-xs text-text-primary transition-colors hover:bg-black/5 dark:border-white/10 dark:bg-white/[0.03] dark:hover:bg-white/10","aria-haspopup":"menu","aria-expanded":ep,title:"Filter quota providers",children:[(0,r.jsxs)("span",{className:"flex min-w-0 items-center gap-1.5",children:["all"===el?(0,r.jsx)("span",{className:"material-symbols-outlined text-[14px] text-text-muted",children:"apps"}):(0,r.jsx)(l.A,{src:`/providers/${el}.png`,alt:el,size:18,className:"size-[18px] rounded object-contain",fallbackText:el.slice(0,2).toUpperCase()}),(0,r.jsx)("span",{className:"truncate capitalize hidden lg:inline",children:eB})]}),(0,r.jsx)("span",{className:"material-symbols-outlined text-[14px] text-text-muted",children:"expand_more"})]}),ep&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("button",{type:"button",className:"fixed inset-0 z-30 bg-transparent","aria-label":"Close provider filter",onClick:()=>eg(!1)}),(0,r.jsxs)("div",{className:"absolute left-0 z-40 mt-2 w-64 overflow-hidden rounded-2xl border border-black/10 bg-surface/95 p-1.5 shadow-xl shadow-black/10 backdrop-blur dark:border-white/10 dark:bg-surface/95 sm:w-72",children:[(0,r.jsxs)("button",{type:"button",onClick:()=>{"all"!==el&&ej(1),ei("all"),eg(!1)},className:`flex w-full items-center gap-3 rounded-xl px-3 py-2.5 text-left text-sm transition-colors ${"all"===el?"bg-primary/10 text-primary":"text-text-primary hover:bg-black/5 dark:hover:bg-white/10"}`,children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-[22px]",children:"apps"}),(0,r.jsx)("span",{className:"font-medium",children:"All providers"}),"all"===el&&(0,r.jsx)("span",{className:"material-symbols-outlined ml-auto text-[20px]",children:"check"})]}),(0,r.jsx)("div",{className:"my-1 h-px bg-black/10 dark:bg-white/10"}),(0,r.jsx)("div",{className:"max-h-72 overflow-y-auto pr-1",children:eo.map(e=>(0,r.jsxs)("button",{type:"button",onClick:()=>{el!==e&&ej(1),ei(e),eg(!1)},className:`flex w-full items-center gap-3 rounded-xl px-3 py-2.5 text-left text-sm transition-colors ${el===e?"bg-primary/10 text-primary":"text-text-primary hover:bg-black/5 dark:hover:bg-white/10"}`,children:[(0,r.jsx)(l.A,{src:`/providers/${e}.png`,alt:e,size:24,className:"size-6 rounded-md object-contain",fallbackText:e.slice(0,2).toUpperCase()}),(0,r.jsx)("span",{className:"font-medium capitalize",children:e}),el===e&&(0,r.jsx)("span",{className:"material-symbols-outlined ml-auto text-[20px]",children:"check"})]},e))})]})]})]}),(0,r.jsx)("select",{value:ed,onChange:e=>{let t=e.target.value;ed!==t&&ej(1),eu(t)},className:"h-8 rounded-lg border border-black/10 bg-black/[0.02] px-2 text-xs text-text-primary outline-none transition-colors hover:bg-black/5 dark:border-white/10 dark:bg-white/[0.03] dark:hover:bg-white/10","aria-label":"Filter accounts by status",children:N.map(e=>(0,r.jsx)("option",{value:e.value,children:e.label},e.value))}),"codex"===el&&(0,r.jsx)("select",{value:em,onChange:e=>ex(e.target.value),className:"h-8 rounded-lg border border-black/10 bg-black/[0.02] px-2 text-xs text-text-primary outline-none transition-colors hover:bg-black/5 dark:border-white/10 dark:bg-white/[0.03] dark:hover:bg-white/10","aria-label":"Sort Codex quotas by remaining",children:C.map(e=>(0,r.jsx)("option",{value:e.value,children:e.label},e.value))}),(0,r.jsxs)("button",{type:"button",onClick:()=>eb(e=>!e),"aria-pressed":eh,className:`flex h-8 shrink-0 items-center gap-1 rounded-lg border px-2 text-xs transition-colors ${eh?"border-amber-500/40 bg-amber-500/10 text-amber-500":"border-black/10 text-text-primary hover:bg-black/5 dark:border-white/10 dark:hover:bg-white/5"}`,title:"Sort accounts by earliest quota reset time",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"hourglass_top"}),(0,r.jsx)("span",{className:"hidden sm:inline",children:"Expiring first"})]}),!e&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("button",{type:"button",onClick:()=>{eW(eQ.filter(e=>(e.isActive??!0)&&eH(e)).map(e=>e.id),!1)},disabled:ef,className:"flex h-8 shrink-0 items-center gap-1 rounded-lg border border-red-500/30 px-2 text-xs text-red-500 transition-colors hover:bg-red-500/10 disabled:opacity-50",title:"Disable connections with depleted quota on the current page",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"block"}),(0,r.jsx)("span",{className:"hidden sm:inline",children:"Turn off Empty"})]}),(0,r.jsxs)("button",{type:"button",onClick:()=>{eW(eQ.filter(e=>!(e.isActive??!0)&&!eH(e)).map(e=>e.id),!0)},disabled:ef,className:"flex h-8 shrink-0 items-center gap-1 rounded-lg border border-emerald-500/30 px-2 text-xs text-emerald-500 transition-colors hover:bg-emerald-500/10 disabled:opacity-50",title:"Enable connections that still have quota on the current page",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"check_circle"}),(0,r.jsx)("span",{className:"hidden sm:inline",children:"Turn on Available"})]})]}),(0,r.jsxs)("button",{onClick:()=>L(e=>!e),className:"flex h-8 shrink-0 items-center gap-1 rounded-lg border border-black/10 px-2 text-xs transition-colors hover:bg-black/5 dark:border-white/10 dark:hover:bg-white/5",title:F?"Disable auto-refresh":"Enable auto-refresh",children:[(0,r.jsx)("span",{className:`material-symbols-outlined text-[14px] ${F?"text-primary":"text-text-muted"}`,children:F?"toggle_on":"toggle_off"}),(0,r.jsx)("span",{className:"hidden text-text-primary sm:inline",children:"Auto-refresh"}),F&&(0,r.jsxs)("span",{className:"text-[10px] text-text-muted tabular-nums",children:["(",H,"s)"]})]}),(0,r.jsx)("button",{type:"button",onClick:eJ,disabled:K,className:"flex h-8 shrink-0 items-center gap-1 rounded-lg border border-black/10 px-2 text-xs text-text-primary transition-colors hover:bg-black/5 dark:border-white/10 dark:hover:bg-white/5 disabled:opacity-50",title:"Refresh all",children:(0,r.jsx)("span",{className:`material-symbols-outlined text-[14px] ${K?"animate-spin":""}`,children:"refresh"})})]})}),eh&&(0,r.jsx)("div",{className:"rounded-xl border border-amber-500/20 bg-amber-500/10 px-3 py-2 text-xs text-amber-700 dark:text-amber-300",children:"Expiring-first currently reorders accounts inside the current page. Cross-page ordering still follows backend pagination."}),(0,r.jsx)("div",{className:a,children:eQ.map(t=>{let a=M[t.id],s=O[t.id],n=I[t.id],i=!1===t.isActive,o=Y===t.id||X===t.id,m=ey===t.id;return(0,r.jsxs)(u.default,{padding:"none",className:`min-w-0 ${i?"opacity-60":""}`,children:[(0,r.jsx)("div",{className:"px-3 py-2 border-b border-black/10 dark:border-white/10",children:(0,r.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2 min-w-0",children:[(0,r.jsx)("div",{className:"w-8 h-8 shrink-0 rounded-md flex items-center justify-center overflow-hidden",children:(0,r.jsx)(l.A,{src:`/providers/${t.provider}.png`,alt:t.provider,size:32,className:"object-contain",fallbackText:t.provider?.slice(0,2).toUpperCase()||"PR"})}),(0,r.jsxs)("div",{className:"min-w-0",children:[(0,r.jsx)("h3",{className:"text-sm font-semibold text-text-primary capitalize truncate",children:t.provider}),b(t)?(0,r.jsx)("p",{className:"text-xs text-text-muted truncate",children:b(t)}):null]})]}),(0,r.jsxs)("div",{className:"flex items-center gap-1 shrink-0",children:[(0,r.jsx)("button",{type:"button",onClick:()=>eF(t.id,t.provider),disabled:s||o,"aria-label":"Refresh quota",className:"p-1.5 rounded-lg hover:bg-black/5 dark:hover:bg-white/5 transition-colors disabled:opacity-50",title:"Refresh quota",children:(0,r.jsx)("span",{className:`material-symbols-outlined text-[18px] text-text-muted ${s?"animate-spin":""}`,children:"refresh"})}),eD&&"codex"===t.provider&&(0,r.jsxs)("button",{type:"button",onClick:()=>eU(t),disabled:o||m,className:"h-8 inline-flex items-center gap-1 rounded-lg border border-emerald-500/30 px-2 text-xs font-medium text-emerald-600 hover:bg-emerald-500/10 transition-colors disabled:opacity-50 dark:text-emerald-400",title:"Activate this account in local Codex",children:[(0,r.jsx)("span",{className:`material-symbols-outlined text-[18px] ${m?"animate-pulse":""}`,children:"key"}),(0,r.jsx)("span",{children:"Activate"})]}),!e&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("button",{type:"button",onClick:()=>{er(t),et(!0)},disabled:o,"aria-label":"Edit connection",className:"p-1.5 rounded-lg hover:bg-black/5 dark:hover:bg-white/5 text-text-muted hover:text-primary transition-colors disabled:opacity-50",title:"Edit connection",children:(0,r.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"edit"})}),(0,r.jsx)("button",{type:"button",onClick:()=>eL(t.id),disabled:o,"aria-label":"Delete connection",className:"p-1.5 rounded-lg hover:bg-red-500/10 text-red-500 transition-colors disabled:opacity-50",title:"Delete connection",children:(0,r.jsx)("span",{className:`material-symbols-outlined text-[18px] ${Y===t.id?"animate-pulse":""}`,children:"delete"})}),(0,r.jsx)("div",{className:"inline-flex items-center pl-0.5",title:t.isActive??!0?"Disable connection":"Enable connection",children:(0,r.jsx)(d.default,{size:"sm",checked:t.isActive??!0,disabled:o,onChange:e=>ez(t.id,e)})})]})]})]})}),(0,r.jsx)("div",{className:"px-2 py-1.5",children:s?(0,r.jsx)("div",{className:"text-center py-5 text-text-muted",children:(0,r.jsx)("span",{className:"material-symbols-outlined text-[28px] animate-spin",children:"progress_activity"})}):n?(0,r.jsxs)("div",{className:"text-center py-5",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-[28px] text-red-500",children:"error"}),(0,r.jsx)("p",{className:"mt-1.5 text-xs text-text-muted",children:n})]}):a?.message?(0,r.jsx)("div",{className:"text-center py-5",children:(0,r.jsx)("p",{className:"text-xs text-text-muted",children:a.message})}):(0,r.jsx)(c,{quotas:a?.quotas,compact:!0,sortMode:"default",showSortLabel:"codex"===t.provider&&"default"!==em})})]},t.id)})}),(0,r.jsx)("div",{className:"rounded-xl border border-black/10 bg-black/[0.02] px-3 py-2 dark:border-white/10 dark:bg-white/[0.03]",children:(0,r.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[(0,r.jsx)("span",{className:"text-xs text-text-muted",children:eX}),(0,r.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,r.jsxs)("select",{value:eZ?"custom":String(eN),onChange:e=>{let t=e.target.value;if("custom"===t)return;let a=Number.parseInt(t,10);Number.isFinite(a)&&(ej(1),eC(a),e$(String(a)))},className:"h-8 rounded-lg border border-black/10 bg-black/[0.02] px-2 text-xs text-text-primary outline-none transition-colors hover:bg-black/5 dark:border-white/10 dark:bg-white/[0.03] dark:hover:bg-white/10","aria-label":"Accounts per page",children:[S.map(e=>(0,r.jsxs)("option",{value:String(e),children:[e," / page"]},e)),(0,r.jsx)("option",{value:"custom",children:"Custom"})]}),(0,r.jsx)("input",{type:"number",min:"1",max:String(500),inputMode:"numeric",value:eS,onChange:e=>e$(e.target.value),onBlur:()=>{let e=Number.parseInt(eS,10);if(!Number.isFinite(e))return void e$(String(eN));let t=Math.min(500,Math.max(1,e));ej(1),eC(t),e$(String(t))},onKeyDown:e=>{if("Enter"!==e.key)return;let t=Number.parseInt(eS,10);if(!Number.isFinite(t))return void e$(String(eN));let a=Math.min(500,Math.max(1,t));ej(1),eC(a),e$(String(a))},className:"h-8 w-20 rounded-lg border border-black/10 bg-black/[0.02] px-2 text-xs text-text-primary outline-none transition-colors hover:bg-black/5 dark:border-white/10 dark:bg-white/[0.03] dark:hover:bg-white/10","aria-label":"Custom accounts per page",placeholder:"Custom"}),(0,r.jsxs)("span",{className:"text-xs text-text-muted",children:["Page ",eA.page," / ",eA.totalPages]})]}),(0,r.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,r.jsx)("button",{type:"button",onClick:()=>ej(1),disabled:eA.page<=1||B||K,className:"flex h-8 items-center rounded-lg border border-black/10 px-3 text-xs text-text-primary transition-colors hover:bg-black/5 disabled:cursor-not-allowed disabled:opacity-40 dark:border-white/10 dark:hover:bg-white/5",children:"First Page"}),(0,r.jsx)("button",{type:"button",onClick:()=>ej(e=>Math.max(1,e-1)),disabled:eA.page<=1||B||K,className:"flex h-8 w-8 items-center justify-center rounded-lg border border-black/10 text-text-primary transition-colors hover:bg-black/5 disabled:cursor-not-allowed disabled:opacity-40 dark:border-white/10 dark:hover:bg-white/5","aria-label":"Previous accounts page",children:(0,r.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"chevron_left"})}),(0,r.jsx)("button",{type:"button",onClick:()=>ej(e=>Math.min(eA.totalPages,e+1)),disabled:eA.page>=eA.totalPages||B||K,className:"flex h-8 w-8 items-center justify-center rounded-lg border border-black/10 text-text-primary transition-colors hover:bg-black/5 disabled:cursor-not-allowed disabled:opacity-40 dark:border-white/10 dark:hover:bg-white/5","aria-label":"Next accounts page",children:(0,r.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"chevron_right"})}),(0,r.jsx)("button",{type:"button",onClick:()=>ej(eA.totalPages),disabled:eA.page>=eA.totalPages||B||K,className:"flex h-8 items-center rounded-lg border border-black/10 px-3 text-xs text-text-primary transition-colors hover:bg-black/5 disabled:cursor-not-allowed disabled:opacity-40 dark:border-white/10 dark:hover:bg-white/5",children:"Last Page"})]})]})}),(0,r.jsx)(m.wI,{isOpen:ee,connection:ea,proxyPools:es,onSave:eR,onClose:()=>{et(!1),er(null)}})]}):(0,r.jsx)(u.default,{padding:"lg",children:(0,r.jsxs)("div",{className:"text-center py-12",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-[64px] text-text-muted opacity-20",children:eV.icon}),(0,r.jsx)("h3",{className:"mt-4 text-lg font-semibold text-text-primary",children:eV.title}),(0,r.jsx)("p",{className:"mt-2 text-sm text-text-muted max-w-md mx-auto",children:eV.description})]})}):(0,r.jsx)(u.default,{padding:"lg",children:(0,r.jsxs)("div",{className:"text-center py-12",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-[64px] text-text-muted opacity-20",children:"cloud_off"}),(0,r.jsx)("h3",{className:"mt-4 text-lg font-semibold text-text-primary",children:"No Providers Connected"}),(0,r.jsx)("p",{className:"mt-2 text-sm text-text-muted max-w-md mx-auto",children:"Connect to providers with OAuth to track your API quota limits and usage."})]})})}function A(){return(0,r.jsx)(s.Suspense,{fallback:(0,r.jsx)(n.CardSkeleton,{}),children:(0,r.jsx)(E,{})})}function E(){let[e,t]=(0,s.useState)({loading:!0,role:null,showQuotaTracker:!0});return((0,s.useEffect)(()=>{let e=!1;return fetch("/api/auth/me",{cache:"no-store"}).then(e=>e.json()).then(a=>{if(!e){if("sub_user"===a.role&&!1===a.showQuotaTracker){window.location.href="/dashboard/user";return}t({loading:!1,role:a.role||null,showQuotaTracker:!1!==a.showQuotaTracker})}}).catch(()=>{e||t({loading:!1,role:null,showQuotaTracker:!0})}),()=>{e=!0}},[]),e.loading)?(0,r.jsx)(n.CardSkeleton,{}):(0,r.jsx)($,{readOnly:"sub_user"===e.role,allowCodexActivation:"sub_user"===e.role})}}},e=>{e.O(0,[2574,3862,1051,1321,5497,8441,3794,7358],()=>e(e.s=61034)),_N_E=e.O()}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[39,174,204,318,335,342,387,501,516,543,552,675,747,748,907,931,948,992,997,1077,1088,1091,1110,1118,1200,1288,1337,1382,1451,1512,1566,1666,1674,1697,1860,1907,1910,1946,1949,2121,2198,2284,2296,2536,2772,2785,2797,2919,2922,3025,3038,3079,3397,3472,3528,3549,3562,3568,3883,3888,4010,4061,4245,4286,4422,4444,4612,4648,4656,4674,4761,4896,4993,5018,5107,5177,5211,5226,5377,5466,5637,5685,5745,5922,6091,6100,6107,6121,6268,6319,6478,6479,6529,6580,6594,6619,6740,6743,6819,6919,6988,7131,7158,7241,7311,7429,7445,7473,7508,7520,7824,7851,8026,8167,8207,8246,8453,8489,8506,8573,8648,8673,8736,8791,8814,8870,8948,8974,8975,9027,9069,9088,9141,9199,9321,9461,9678,9709],{84441:()=>{}},_=>{_.O(0,[8441,3794,7358],()=>_(_.s=84441)),_N_E=_.O()}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[39,174,204,318,335,342,387,501,516,543,552,675,747,748,907,931,948,992,997,1077,1088,1091,1110,1118,1200,1288,1337,1382,1451,1512,1566,1666,1674,1697,1860,1907,1910,1946,1949,2121,2198,2284,2296,2536,2772,2785,2797,2919,2922,3025,3038,3079,3397,3472,3528,3549,3562,3568,3883,3888,4010,4061,4245,4286,4422,4444,4612,4648,4656,4674,4761,4896,4993,5018,5107,5177,5211,5226,5377,5466,5637,5685,5745,5922,6091,6100,6107,6121,6268,6319,6478,6479,6529,6580,6594,6619,6740,6743,6819,6919,6988,7131,7158,7241,7311,7429,7445,7473,7508,7520,7824,7851,8026,8167,8207,8246,8453,8489,8506,8573,8648,8673,8736,8791,8814,8870,8948,8974,8975,9027,9069,9088,9141,9199,9321,9461,9678,9709],{84441:()=>{}},_=>{_.O(0,[8441,3794,7358],()=>_(_.s=84441)),_N_E=_.O()}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[39,174,204,318,335,342,387,501,516,543,552,675,747,748,907,931,948,992,997,1077,1088,1091,1110,1118,1200,1288,1337,1382,1451,1512,1566,1666,1674,1697,1860,1907,1910,1946,1949,2121,2198,2284,2296,2536,2772,2785,2797,2919,2922,3025,3038,3079,3397,3472,3528,3549,3562,3568,3883,3888,4010,4061,4245,4286,4422,4444,4612,4648,4656,4674,4761,4896,4993,5018,5107,5177,5211,5226,5377,5466,5637,5685,5745,5922,6091,6100,6107,6121,6268,6319,6478,6479,6529,6580,6594,6619,6740,6743,6819,6919,6988,7131,7158,7241,7311,7429,7445,7473,7508,7520,7824,7851,8026,8167,8207,8246,8453,8489,8506,8573,8648,8673,8736,8791,8814,8870,8948,8974,8975,9027,9069,9088,9141,9199,9321,9461,9678,9709],{84441:()=>{}},_=>{_.O(0,[8441,3794,7358],()=>_(_.s=84441)),_N_E=_.O()}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[39,174,204,318,335,342,387,501,516,543,552,675,747,748,907,931,948,992,997,1077,1088,1091,1110,1118,1200,1288,1337,1382,1451,1512,1566,1666,1674,1697,1860,1907,1910,1946,1949,2121,2198,2284,2296,2536,2772,2785,2797,2919,2922,3025,3038,3079,3397,3472,3528,3549,3562,3568,3883,3888,4010,4061,4245,4286,4422,4444,4612,4648,4656,4674,4761,4896,4993,5018,5107,5177,5211,5226,5377,5466,5637,5685,5745,5922,6091,6100,6107,6121,6268,6319,6478,6479,6529,6580,6594,6619,6740,6743,6819,6919,6988,7131,7158,7241,7311,7429,7445,7473,7508,7520,7824,7851,8026,8167,8207,8246,8453,8489,8506,8573,8648,8673,8736,8791,8814,8870,8948,8974,8975,9027,9069,9088,9141,9199,9321,9461,9678,9709],{84441:()=>{}},_=>{_.O(0,[8441,3794,7358],()=>_(_.s=84441)),_N_E=_.O()}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[39,174,204,318,335,342,387,501,516,543,552,675,747,748,907,931,948,992,997,1077,1088,1091,1110,1118,1200,1288,1337,1382,1451,1512,1566,1666,1674,1697,1860,1907,1910,1946,1949,2121,2198,2284,2296,2536,2772,2785,2797,2919,2922,3025,3038,3079,3397,3472,3528,3549,3562,3568,3883,3888,4010,4061,4245,4286,4422,4444,4612,4648,4656,4674,4761,4896,4993,5018,5107,5177,5211,5226,5377,5466,5637,5685,5745,5922,6091,6100,6107,6121,6268,6319,6478,6479,6529,6580,6594,6619,6740,6743,6819,6919,6988,7131,7158,7241,7311,7429,7445,7473,7508,7520,7824,7851,8026,8167,8207,8246,8453,8489,8506,8573,8648,8673,8736,8791,8814,8870,8948,8974,8975,9027,9069,9088,9141,9199,9321,9461,9678,9709],{84441:()=>{}},_=>{_.O(0,[8441,3794,7358],()=>_(_.s=84441)),_N_E=_.O()}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[39,174,204,318,335,342,387,501,516,543,552,675,747,748,907,931,948,992,997,1077,1088,1091,1110,1118,1200,1288,1337,1382,1451,1512,1566,1666,1674,1697,1860,1907,1910,1946,1949,2121,2198,2284,2296,2536,2772,2785,2797,2919,2922,3025,3038,3079,3397,3472,3528,3549,3562,3568,3883,3888,4010,4061,4245,4286,4422,4444,4612,4648,4656,4674,4761,4896,4993,5018,5107,5177,5211,5226,5377,5466,5637,5685,5745,5922,6091,6100,6107,6121,6268,6319,6478,6479,6529,6580,6594,6619,6740,6743,6819,6919,6988,7131,7158,7241,7311,7429,7445,7473,7508,7520,7824,7851,8026,8167,8207,8246,8453,8489,8506,8573,8648,8673,8736,8791,8814,8870,8948,8974,8975,9027,9069,9088,9141,9199,9321,9461,9678,9709],{84441:()=>{}},_=>{_.O(0,[8441,3794,7358],()=>_(_.s=84441)),_N_E=_.O()}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[39,174,204,318,335,342,387,501,516,543,552,675,747,748,907,931,948,992,997,1077,1088,1091,1110,1118,1200,1288,1337,1382,1451,1512,1566,1666,1674,1697,1860,1907,1910,1946,1949,2121,2198,2284,2296,2536,2772,2785,2797,2919,2922,3025,3038,3079,3397,3472,3528,3549,3562,3568,3883,3888,4010,4061,4245,4286,4422,4444,4612,4648,4656,4674,4761,4896,4993,5018,5107,5177,5211,5226,5377,5466,5637,5685,5745,5922,6091,6100,6107,6121,6268,6319,6478,6479,6529,6580,6594,6619,6740,6743,6819,6919,6988,7131,7158,7241,7311,7429,7445,7473,7508,7520,7824,7851,8026,8167,8207,8246,8453,8489,8506,8573,8648,8673,8736,8791,8814,8870,8948,8974,8975,9027,9069,9088,9141,9199,9321,9461,9678,9709],{84441:()=>{}},_=>{_.O(0,[8441,3794,7358],()=>_(_.s=84441)),_N_E=_.O()}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[39,174,204,318,335,342,387,501,516,543,552,675,747,748,907,931,948,992,997,1077,1088,1091,1110,1118,1200,1288,1337,1382,1451,1512,1566,1666,1674,1697,1860,1907,1910,1946,1949,2121,2198,2284,2296,2536,2772,2785,2797,2919,2922,3025,3038,3079,3397,3472,3528,3549,3562,3568,3883,3888,4010,4061,4245,4286,4422,4444,4612,4648,4656,4674,4761,4896,4993,5018,5107,5177,5211,5226,5377,5466,5637,5685,5745,5922,6091,6100,6107,6121,6268,6319,6478,6479,6529,6580,6594,6619,6740,6743,6819,6919,6988,7131,7158,7241,7311,7429,7445,7473,7508,7520,7824,7851,8026,8167,8207,8246,8453,8489,8506,8573,8648,8673,8736,8791,8814,8870,8948,8974,8975,9027,9069,9088,9141,9199,9321,9461,9678,9709],{84441:()=>{}},_=>{_.O(0,[8441,3794,7358],()=>_(_.s=84441)),_N_E=_.O()}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[39,174,204,318,335,342,387,501,516,543,552,675,747,748,907,931,948,992,997,1077,1088,1091,1110,1118,1200,1288,1337,1382,1451,1512,1566,1666,1674,1697,1860,1907,1910,1946,1949,2121,2198,2284,2296,2536,2772,2785,2797,2919,2922,3025,3038,3079,3397,3472,3528,3549,3562,3568,3883,3888,4010,4061,4245,4286,4422,4444,4612,4648,4656,4674,4761,4896,4993,5018,5107,5177,5211,5226,5377,5466,5637,5685,5745,5922,6091,6100,6107,6121,6268,6319,6478,6479,6529,6580,6594,6619,6740,6743,6819,6919,6988,7131,7158,7241,7311,7429,7445,7473,7508,7520,7824,7851,8026,8167,8207,8246,8453,8489,8506,8573,8648,8673,8736,8791,8814,8870,8948,8974,8975,9027,9069,9088,9141,9199,9321,9461,9678,9709],{84441:()=>{}},_=>{_.O(0,[8441,3794,7358],()=>_(_.s=84441)),_N_E=_.O()}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[39,174,204,318,335,342,387,501,516,543,552,675,747,748,907,931,948,992,997,1077,1088,1091,1110,1118,1200,1288,1337,1382,1451,1512,1566,1666,1674,1697,1860,1907,1910,1946,1949,2121,2198,2284,2296,2536,2772,2785,2797,2919,2922,3025,3038,3079,3397,3472,3528,3549,3562,3568,3883,3888,4010,4061,4245,4286,4422,4444,4612,4648,4656,4674,4761,4896,4993,5018,5107,5177,5211,5226,5377,5466,5637,5685,5745,5922,6091,6100,6107,6121,6268,6319,6478,6479,6529,6580,6594,6619,6740,6743,6819,6919,6988,7131,7158,7241,7311,7429,7445,7473,7508,7520,7824,7851,8026,8167,8207,8246,8453,8489,8506,8573,8648,8673,8736,8791,8814,8870,8948,8974,8975,9027,9069,9088,9141,9199,9321,9461,9678,9709],{84441:()=>{}},_=>{_.O(0,[8441,3794,7358],()=>_(_.s=84441)),_N_E=_.O()}]);
|