keyrouter 1.0.4 → 1.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/app/.next-cli-build/BUILD_ID +1 -1
- package/app/.next-cli-build/app-path-routes-manifest.json +19 -19
- package/app/.next-cli-build/build-manifest.json +3 -3
- package/app/.next-cli-build/prerender-manifest.json +19 -19
- package/app/.next-cli-build/react-loadable-manifest.json +8 -8
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/basic-chat/page.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/basic-chat/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/basic-chat/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/[toolId]/page.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/[toolId]/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/[toolId]/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/page.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/combos/page.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/combos/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/combos/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/console-log/page.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/console-log/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/console-log/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/endpoint/page.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/endpoint/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/endpoint/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/[kind]/[id]/page.js +5 -5
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/[kind]/[id]/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/[kind]/[id]/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/[kind]/page.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/[kind]/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/[kind]/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/combo/[id]/page.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/combo/[id]/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/combo/[id]/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/web/page.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/web/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/web/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/mitm/page.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/mitm/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/mitm/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/page.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/profile/page.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/profile/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/profile/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/prompt-injection/page.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/prompt-injection/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/prompt-injection/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/[id]/page.js +2 -2
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/[id]/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/[id]/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/new/page.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/new/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/new/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/page.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/proxy-pools/page.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/proxy-pools/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/proxy-pools/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/pxpipe/page.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/pxpipe/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/pxpipe/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/quota/page.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/quota/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/quota/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/skills/page.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/skills/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/skills/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/token-saver/page.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/token-saver/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/token-saver/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/translator/page.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/translator/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/translator/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/usage/page.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/usage/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/usage/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/_global-error/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/_global-error/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/_global-error.html +1 -1
- package/app/.next-cli-build/server/app/_global-error.rsc +1 -1
- package/app/.next-cli-build/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/_not-found/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/_not-found.html +1 -1
- package/app/.next-cli-build/server/app/_not-found.rsc +7 -7
- package/app/.next-cli-build/server/app/_not-found.segments/_full.segment.rsc +7 -7
- package/app/.next-cli-build/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +7 -7
- package/app/.next-cli-build/server/app/_not-found.segments/_tree.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/api/auth/login/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/auth/logout/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/auth/oidc/callback/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/auth/oidc/start/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/auth/oidc/test/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/auth/reset-password/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/auth/saml/acs/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/auth/saml/metadata/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/auth/saml/start/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/auth/saml/test/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/auth/status/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/all-statuses/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/antigravity-mitm/alias/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/antigravity-mitm/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/claude-settings/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/cline-settings/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/codewhale-settings/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/codex-profiles/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/codex-settings/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/copilot-settings/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/cowork-mcp-registry/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/cowork-mcp-tools/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/cowork-settings/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/crush-settings/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/deepseek-tui-settings/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/devin-settings/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/droid-settings/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/forge-settings/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/grok-build-settings/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/hermes-profiles/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/hermes-settings/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/jcode-settings/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/kilo-settings/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/omp-settings/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/openclaw-settings/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/opencode-settings/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/pi-settings/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/smelt-settings/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/combos/[id]/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/combos/presets/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/combos/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/headroom/extras/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/headroom/proxy/[...path]/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/headroom/restart/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/headroom/start/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/headroom/status/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/headroom/stop/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/health/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/init/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/keys/[id]/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/keys/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/locale/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/mcp/[plugin]/message/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/mcp/[plugin]/sse/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/media-providers/tts/deepgram/voices/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/media-providers/tts/elevenlabs/voices/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/media-providers/tts/inworld/voices/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/media-providers/tts/minimax/voices/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/media-providers/tts/voices/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/models/alias/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/models/availability/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/models/catalog-sync/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/models/custom/route.js +1 -1
- package/app/.next-cli-build/server/app/api/models/custom/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/models/disabled/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/models/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/models/test/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/oauth/[provider]/[action]/route.js +1 -1
- package/app/.next-cli-build/server/app/api/oauth/[provider]/[action]/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/oauth/codex/bulk-import/route.js +1 -1
- package/app/.next-cli-build/server/app/api/oauth/codex/bulk-import/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/oauth/codex/import-token/route.js +1 -1
- package/app/.next-cli-build/server/app/api/oauth/codex/import-token/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/oauth/cursor/auto-import/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/oauth/cursor/import/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/oauth/gitlab/pat/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/oauth/grok-cli/bulk-import/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/oauth/iflow/cookie/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/oauth/kiro/api-key/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/oauth/kiro/auto-import/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/oauth/kiro/import/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/oauth/kiro/import-cli-proxy/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/oauth/kiro/social-authorize/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/oauth/kiro/social-exchange/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/oauth/xiaomi-mimo/api-key/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/oauth/xiaomi-mimo/auto-import/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/oauth/xiaomi-mimo/login/start/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/oauth/xiaomi-mimo/login/status/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/oauth/zed/auto-import/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/oauth/zed/import/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/pricing/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/prompt-injection/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/provider-nodes/[id]/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/provider-nodes/route.js +1 -1
- package/app/.next-cli-build/server/app/api/provider-nodes/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/provider-nodes/validate/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/providers/[id]/models/route.js +1 -1
- package/app/.next-cli-build/server/app/api/providers/[id]/models/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/providers/[id]/overrides/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/providers/[id]/route.js +1 -1
- package/app/.next-cli-build/server/app/api/providers/[id]/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/providers/[id]/test/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/providers/[id]/test-models/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/providers/client/route.js +1 -1
- package/app/.next-cli-build/server/app/api/providers/client/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/providers/kilo/free-models/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/providers/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/providers/suggested-models/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/providers/test-batch/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/providers/validate/route.js +1 -1
- package/app/.next-cli-build/server/app/api/providers/validate/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/providers/web-login/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/proxy-pools/[id]/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/proxy-pools/[id]/test/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/proxy-pools/cloudflare-deploy/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/proxy-pools/deno-deploy/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/proxy-pools/netlify-deploy/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/proxy-pools/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/proxy-pools/vercel-deploy/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/pxpipe/health/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/pxpipe/install/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/pxpipe/logs/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/pxpipe/restart/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/pxpipe/start/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/pxpipe/stats/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/pxpipe/status/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/pxpipe/stop/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/settings/database/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/settings/proxy-test/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/settings/require-login/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/settings/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/shutdown/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/tags/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/translator/console-logs/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/translator/console-logs/stream/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/translator/load/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/translator/save/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/translator/send/route.js +1 -1
- package/app/.next-cli-build/server/app/api/translator/send/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/translator/translate/route.js +1 -1
- package/app/.next-cli-build/server/app/api/translator/translate/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/tunnel/disable/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/tunnel/enable/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/tunnel/status/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/tunnel/tailscale-check/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/tunnel/tailscale-disable/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/tunnel/tailscale-enable/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/tunnel/tailscale-install/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/usage/[connectionId]/claude-reset/route.js +1 -1
- package/app/.next-cli-build/server/app/api/usage/[connectionId]/claude-reset/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/usage/[connectionId]/codex-reset-credits/route.js +1 -1
- package/app/.next-cli-build/server/app/api/usage/[connectionId]/codex-reset-credits/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/usage/[connectionId]/route.js +1 -1
- package/app/.next-cli-build/server/app/api/usage/[connectionId]/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/usage/chart/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/usage/history/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/usage/logs/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/usage/providers/route.js +1 -1
- package/app/.next-cli-build/server/app/api/usage/providers/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/usage/request-details/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/usage/request-logs/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/usage/stats/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/usage/stream/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/v1/api/chat/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/v1/audio/speech/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/v1/audio/transcriptions/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/v1/audio/voices/route.js +1 -1
- package/app/.next-cli-build/server/app/api/v1/audio/voices/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/v1/chat/completions/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/v1/embeddings/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/v1/images/generations/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/v1/messages/count_tokens/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/v1/messages/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/v1/models/[...model]/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/v1/models/info/route.js +1 -1
- package/app/.next-cli-build/server/app/api/v1/models/info/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/v1/models/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/v1/responses/compact/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/v1/responses/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/v1/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/v1/search/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/v1/systemone/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/v1/videos/[id]/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/v1/videos/edits/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/v1/videos/extensions/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/v1/videos/generations/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/v1/web/fetch/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/v1beta/models/[...path]/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/v1beta/models/route.js +1 -1
- package/app/.next-cli-build/server/app/api/v1beta/models/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/version/route.js +1 -1
- package/app/.next-cli-build/server/app/api/version/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/version/shutdown/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/version/update/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/callback/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/callback/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/callback.html +1 -1
- package/app/.next-cli-build/server/app/callback.rsc +7 -7
- package/app/.next-cli-build/server/app/callback.segments/_full.segment.rsc +7 -7
- package/app/.next-cli-build/server/app/callback.segments/_tree.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/callback.segments/callback/__PAGE__.segment.rsc +7 -7
- package/app/.next-cli-build/server/app/dashboard/basic-chat.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/basic-chat.rsc +7 -7
- package/app/.next-cli-build/server/app/dashboard/basic-chat.segments/!KGRhc2hib2FyZCk/dashboard/basic-chat/__PAGE__.segment.rsc +7 -7
- package/app/.next-cli-build/server/app/dashboard/basic-chat.segments/_full.segment.rsc +7 -7
- package/app/.next-cli-build/server/app/dashboard/basic-chat.segments/_tree.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/cli-tools.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/cli-tools.rsc +8 -8
- package/app/.next-cli-build/server/app/dashboard/cli-tools.segments/!KGRhc2hib2FyZCk/dashboard/cli-tools/__PAGE__.segment.rsc +8 -8
- package/app/.next-cli-build/server/app/dashboard/cli-tools.segments/_full.segment.rsc +8 -8
- package/app/.next-cli-build/server/app/dashboard/cli-tools.segments/_tree.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/combos.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/combos.rsc +8 -8
- package/app/.next-cli-build/server/app/dashboard/combos.segments/!KGRhc2hib2FyZCk/dashboard/combos/__PAGE__.segment.rsc +8 -8
- package/app/.next-cli-build/server/app/dashboard/combos.segments/_full.segment.rsc +8 -8
- package/app/.next-cli-build/server/app/dashboard/combos.segments/_tree.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/endpoint.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/endpoint.rsc +8 -8
- package/app/.next-cli-build/server/app/dashboard/endpoint.segments/!KGRhc2hib2FyZCk/dashboard/endpoint/__PAGE__.segment.rsc +8 -8
- package/app/.next-cli-build/server/app/dashboard/endpoint.segments/_full.segment.rsc +8 -8
- package/app/.next-cli-build/server/app/dashboard/endpoint.segments/_tree.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/media-providers/web.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/media-providers/web.rsc +7 -7
- package/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/!KGRhc2hib2FyZCk/dashboard/media-providers/web/__PAGE__.segment.rsc +7 -7
- package/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/_full.segment.rsc +7 -7
- package/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/_tree.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/mitm.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/mitm.rsc +8 -8
- package/app/.next-cli-build/server/app/dashboard/mitm.segments/!KGRhc2hib2FyZCk/dashboard/mitm/__PAGE__.segment.rsc +8 -8
- package/app/.next-cli-build/server/app/dashboard/mitm.segments/_full.segment.rsc +8 -8
- package/app/.next-cli-build/server/app/dashboard/mitm.segments/_tree.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/profile.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/profile.rsc +8 -8
- package/app/.next-cli-build/server/app/dashboard/profile.segments/!KGRhc2hib2FyZCk/dashboard/profile/__PAGE__.segment.rsc +8 -8
- package/app/.next-cli-build/server/app/dashboard/profile.segments/_full.segment.rsc +8 -8
- package/app/.next-cli-build/server/app/dashboard/profile.segments/_tree.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/prompt-injection.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/prompt-injection.rsc +8 -8
- package/app/.next-cli-build/server/app/dashboard/prompt-injection.segments/!KGRhc2hib2FyZCk/dashboard/prompt-injection/__PAGE__.segment.rsc +8 -8
- package/app/.next-cli-build/server/app/dashboard/prompt-injection.segments/_full.segment.rsc +8 -8
- package/app/.next-cli-build/server/app/dashboard/prompt-injection.segments/_tree.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/providers/new.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/providers/new.rsc +7 -7
- package/app/.next-cli-build/server/app/dashboard/providers/new.segments/!KGRhc2hib2FyZCk/dashboard/providers/new/__PAGE__.segment.rsc +7 -7
- package/app/.next-cli-build/server/app/dashboard/providers/new.segments/_full.segment.rsc +7 -7
- package/app/.next-cli-build/server/app/dashboard/providers/new.segments/_tree.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/providers.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/providers.rsc +8 -8
- package/app/.next-cli-build/server/app/dashboard/providers.segments/!KGRhc2hib2FyZCk/dashboard/providers/__PAGE__.segment.rsc +8 -8
- package/app/.next-cli-build/server/app/dashboard/providers.segments/_full.segment.rsc +8 -8
- package/app/.next-cli-build/server/app/dashboard/providers.segments/_tree.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/proxy-pools.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/proxy-pools.rsc +8 -8
- package/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/!KGRhc2hib2FyZCk/dashboard/proxy-pools/__PAGE__.segment.rsc +8 -8
- package/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/_full.segment.rsc +8 -8
- package/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/_tree.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/pxpipe.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/pxpipe.rsc +8 -8
- package/app/.next-cli-build/server/app/dashboard/pxpipe.segments/!KGRhc2hib2FyZCk/dashboard/pxpipe/__PAGE__.segment.rsc +8 -8
- package/app/.next-cli-build/server/app/dashboard/pxpipe.segments/_full.segment.rsc +8 -8
- package/app/.next-cli-build/server/app/dashboard/pxpipe.segments/_tree.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/quota.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/quota.rsc +8 -8
- package/app/.next-cli-build/server/app/dashboard/quota.segments/!KGRhc2hib2FyZCk/dashboard/quota/__PAGE__.segment.rsc +8 -8
- package/app/.next-cli-build/server/app/dashboard/quota.segments/_full.segment.rsc +8 -8
- package/app/.next-cli-build/server/app/dashboard/quota.segments/_tree.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/settings/pricing/page.js +1 -1
- package/app/.next-cli-build/server/app/dashboard/settings/pricing/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/dashboard/settings/pricing/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/dashboard/settings/pricing.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/settings/pricing.rsc +8 -8
- package/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/_full.segment.rsc +8 -8
- package/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/_tree.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/dashboard/settings/pricing/__PAGE__.segment.rsc +8 -8
- package/app/.next-cli-build/server/app/dashboard/skills.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/skills.rsc +8 -8
- package/app/.next-cli-build/server/app/dashboard/skills.segments/!KGRhc2hib2FyZCk/dashboard/skills/__PAGE__.segment.rsc +8 -8
- package/app/.next-cli-build/server/app/dashboard/skills.segments/_full.segment.rsc +8 -8
- package/app/.next-cli-build/server/app/dashboard/skills.segments/_tree.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/token-saver.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/token-saver.rsc +8 -8
- package/app/.next-cli-build/server/app/dashboard/token-saver.segments/!KGRhc2hib2FyZCk/dashboard/token-saver/__PAGE__.segment.rsc +8 -8
- package/app/.next-cli-build/server/app/dashboard/token-saver.segments/_full.segment.rsc +8 -8
- package/app/.next-cli-build/server/app/dashboard/token-saver.segments/_tree.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/translator.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/translator.rsc +7 -7
- package/app/.next-cli-build/server/app/dashboard/translator.segments/!KGRhc2hib2FyZCk/dashboard/translator/__PAGE__.segment.rsc +7 -7
- package/app/.next-cli-build/server/app/dashboard/translator.segments/_full.segment.rsc +7 -7
- package/app/.next-cli-build/server/app/dashboard/translator.segments/_tree.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/usage.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/usage.rsc +9 -9
- package/app/.next-cli-build/server/app/dashboard/usage.segments/!KGRhc2hib2FyZCk/dashboard/usage/__PAGE__.segment.rsc +9 -9
- package/app/.next-cli-build/server/app/dashboard/usage.segments/_full.segment.rsc +9 -9
- package/app/.next-cli-build/server/app/dashboard/usage.segments/_tree.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard.html +1 -1
- package/app/.next-cli-build/server/app/dashboard.rsc +8 -8
- package/app/.next-cli-build/server/app/dashboard.segments/!KGRhc2hib2FyZCk/dashboard/__PAGE__.segment.rsc +8 -8
- package/app/.next-cli-build/server/app/dashboard.segments/_full.segment.rsc +8 -8
- package/app/.next-cli-build/server/app/dashboard.segments/_tree.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/favicon.ico/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/index.html +1 -1
- package/app/.next-cli-build/server/app/index.rsc +7 -7
- package/app/.next-cli-build/server/app/index.segments/__PAGE__.segment.rsc +7 -7
- package/app/.next-cli-build/server/app/index.segments/_full.segment.rsc +7 -7
- package/app/.next-cli-build/server/app/index.segments/_tree.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/landing/page.js +1 -1
- package/app/.next-cli-build/server/app/landing/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/landing/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/landing.html +1 -1
- package/app/.next-cli-build/server/app/landing.rsc +8 -8
- package/app/.next-cli-build/server/app/landing.segments/_full.segment.rsc +8 -8
- package/app/.next-cli-build/server/app/landing.segments/_tree.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/landing.segments/landing/__PAGE__.segment.rsc +8 -8
- package/app/.next-cli-build/server/app/login/page.js +1 -1
- package/app/.next-cli-build/server/app/login/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/login/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/login.html +1 -1
- package/app/.next-cli-build/server/app/login.rsc +8 -8
- package/app/.next-cli-build/server/app/login.segments/_full.segment.rsc +8 -8
- package/app/.next-cli-build/server/app/login.segments/_tree.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/login.segments/login/__PAGE__.segment.rsc +8 -8
- package/app/.next-cli-build/server/app/manifest.webmanifest/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app-paths-manifest.json +19 -19
- package/app/.next-cli-build/server/chunks/1051.js +1 -1
- package/app/.next-cli-build/server/chunks/2172.js +1 -1
- package/app/.next-cli-build/server/chunks/3449.js +1 -1
- package/app/.next-cli-build/server/chunks/3697.js +1 -1
- package/app/.next-cli-build/server/chunks/412.js +6 -6
- package/app/.next-cli-build/server/chunks/4190.js +1 -1
- package/app/.next-cli-build/server/chunks/4620.js +1 -0
- package/app/.next-cli-build/server/chunks/5299.js +7 -7
- package/app/.next-cli-build/server/chunks/615.js +1 -1
- package/app/.next-cli-build/server/chunks/6708.js +1 -1
- package/app/.next-cli-build/server/chunks/7066.js +1 -1
- package/app/.next-cli-build/server/chunks/8128.js +1 -1
- package/app/.next-cli-build/server/chunks/8251.js +1 -1
- package/app/.next-cli-build/server/chunks/8682.js +3 -3
- package/app/.next-cli-build/server/chunks/869.js +1 -1
- package/app/.next-cli-build/server/chunks/9604.js +1 -1
- package/app/.next-cli-build/server/instrumentation.js.nft.json +1 -1
- package/app/.next-cli-build/server/middleware-build-manifest.js +1 -1
- package/app/.next-cli-build/server/middleware-react-loadable-manifest.js +1 -1
- package/app/.next-cli-build/server/middleware.js.nft.json +1 -1
- package/app/.next-cli-build/server/pages/404.html +1 -1
- package/app/.next-cli-build/server/pages/500.html +1 -1
- package/app/.next-cli-build/static/chunks/{124.b7052d76521ac60b.js → 124.2dcfd9a087c9e48b.js} +1 -1
- package/app/.next-cli-build/static/chunks/{2435.51481baa53b475e1.js → 2435.7cc8c894f4a21999.js} +1 -1
- package/app/.next-cli-build/static/chunks/{2470-e9f1fd5f21c43fac.js → 2470-73a591ec7a5bdf40.js} +1 -1
- package/app/.next-cli-build/static/chunks/3521.96065c08772d432e.js +1 -0
- package/app/.next-cli-build/static/chunks/3557-ab733a862d0bba72.js +10 -0
- package/app/.next-cli-build/static/chunks/{5462.500e87268a882da6.js → 5462.b5dccc4c3626a6a1.js} +1 -1
- package/app/.next-cli-build/static/chunks/5496-336ad33bc5785fb5.js +9 -0
- package/app/.next-cli-build/static/chunks/5497-b6161d058c4b63f4.js +1 -0
- package/app/.next-cli-build/static/chunks/6808-ecaf0603c2c647dd.js +1 -0
- package/app/.next-cli-build/static/chunks/761-748923a2523301a7.js +132 -0
- package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/cli-tools/[toolId]/page-dc2bbddae0338265.js +1 -0
- package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/combos/page-946dbaff84568fd1.js +1 -0
- package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/console-log/page-c995565de72de5d6.js +1 -0
- package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/media-providers/[kind]/[id]/{page-569d2ce1c361cb5b.js → page-e9856c47cc41d2f2.js} +5 -5
- package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/profile/page-d8d32b819432e76e.js +1 -0
- package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/prompt-injection/page-c0c7f0ec4d840259.js +1 -0
- package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/providers/[id]/page-745147f2bf98d096.js +27 -0
- package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/providers/page-3006aca559388a7a.js +1 -0
- package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/proxy-pools/page-c832cd28ad361668.js +4 -0
- package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/pxpipe/page-f4d89bf3d96928c9.js +1 -0
- package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/quota/page-33826a8bc196b7de.js +1 -0
- package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/skills/page-6acecf90f03a1af3.js +1 -0
- package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/token-saver/page-71814d68cea6ef7d.js +1 -0
- package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/usage/page-ebe244550b022a8f.js +1 -0
- package/app/.next-cli-build/static/chunks/app/(dashboard)/layout-84ba30538381db07.js +1 -0
- package/app/.next-cli-build/static/chunks/app/dashboard/settings/pricing/page-607b1f15b82c8bba.js +1 -0
- package/app/.next-cli-build/static/chunks/app/landing/page-3e38f4876602c2fb.js +1 -0
- package/app/.next-cli-build/static/chunks/app/{layout-5be078fd5da689ca.js → layout-8e337d947af1970c.js} +1 -1
- package/app/.next-cli-build/static/chunks/app/login/{page-d50a71c8703d2790.js → page-17082356385ade34.js} +1 -1
- package/app/.next-cli-build/static/chunks/{webpack-01b0b9fe7dbba18d.js → webpack-a1905b20ab1a879d.js} +1 -1
- package/app/.next-cli-build/static/css/d7b388223f36a397.css +1 -0
- package/app/package.json +1 -1
- package/app/public/favicon.svg +2 -12
- package/app/public/fonts/arabic-subset.ttf +0 -0
- package/app/public/fonts/bengali-subset.ttf +0 -0
- package/app/public/fonts/devanagari-subset.ttf +0 -0
- package/app/public/fonts/hebrew-subset.ttf +0 -0
- package/app/public/fonts/jp-subset.ttf +0 -0
- package/app/public/fonts/khmer-subset.ttf +0 -0
- package/app/public/fonts/kr-subset.ttf +0 -0
- package/app/public/fonts/sc-subset.ttf +0 -0
- package/app/public/fonts/tc-subset.ttf +0 -0
- package/app/public/fonts/thai-subset.ttf +0 -0
- package/package.json +1 -1
- package/app/.next-cli-build/server/chunks/5626.js +0 -1
- package/app/.next-cli-build/static/chunks/3521.03e47d524e0fcbf6.js +0 -1
- package/app/.next-cli-build/static/chunks/3557-437defff109ccb42.js +0 -10
- package/app/.next-cli-build/static/chunks/5496-a3a9ad577f310490.js +0 -9
- package/app/.next-cli-build/static/chunks/5497-3add1c35ece30dbf.js +0 -1
- package/app/.next-cli-build/static/chunks/6808-4e4ca2233c09ffad.js +0 -1
- package/app/.next-cli-build/static/chunks/761-00700c1c25957243.js +0 -132
- package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/cli-tools/[toolId]/page-7feaa4a67a8eb771.js +0 -1
- package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/combos/page-624e8d61fe459544.js +0 -1
- package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/console-log/page-5da47ad2a6d8d5de.js +0 -1
- package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/profile/page-628c4ef1c9482980.js +0 -1
- package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/prompt-injection/page-35a6881f7569aa64.js +0 -1
- package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/providers/[id]/page-3b9d43febf1e79d4.js +0 -27
- package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/providers/page-e9c955f52e5ae812.js +0 -1
- package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/proxy-pools/page-bbf57717de4a9782.js +0 -4
- package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/pxpipe/page-b275a947fc978997.js +0 -1
- package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/quota/page-5434337e59f24de1.js +0 -1
- package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/skills/page-c7eb81dfb0b4fd77.js +0 -1
- package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/token-saver/page-1b0510b28ff8de92.js +0 -1
- package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/usage/page-be974a86e9053540.js +0 -1
- package/app/.next-cli-build/static/chunks/app/(dashboard)/layout-18c2613dd78ff66f.js +0 -1
- package/app/.next-cli-build/static/chunks/app/dashboard/settings/pricing/page-c439d82cf7840dc9.js +0 -1
- package/app/.next-cli-build/static/chunks/app/landing/page-38fc3c430a1a29dc.js +0 -1
- package/app/.next-cli-build/static/css/841943e9a30fe5cd.css +0 -1
- /package/app/.next-cli-build/static/{7Sq72xYQxt_cCm5BESVbY → nPdnpoRoh59z5OwsCS3Vd}/_buildManifest.js +0 -0
- /package/app/.next-cli-build/static/{7Sq72xYQxt_cCm5BESVbY → nPdnpoRoh59z5OwsCS3Vd}/_ssgManifest.js +0 -0
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2134],{5539:(e,t,s)=>{"use strict";s.d(t,{A:()=>p,w:()=>d});var i=s(95155),a=s(12115),r=s(14051),l=s.n(r),n=s(35497),o=s(73006);let d=new Set(["grok-web","chatgpt-web","gemini-web","muse-web","deepseek-web","uc-web"]),c={default:"person",grok:"bolt",work:"work",personal:"home"},m=[{key:"opening",label:"Opening browser window",icon:"open_in_new"},{key:"waiting",label:"Waiting for you to log in",icon:"hourglass_top"},{key:"saving",label:"Saving connection",icon:"save"}];function p({providerId:e,onConnected:t,size:s="sm"}){let[r,l]=(0,a.useState)(!1),[d,u]=(0,a.useState)("idle"),[x,h]=(0,a.useState)(""),[f,g]=(0,a.useState)(["default"]),[y,b]=(0,a.useState)("default"),v=(0,a.useRef)(null),j=(0,a.useRef)(null),w=(0,a.useCallback)(()=>{v.current&&(clearInterval(v.current),v.current=null)},[]);(0,a.useEffect)(()=>()=>{w(),j.current&&clearTimeout(j.current)},[w]),(0,a.useEffect)(()=>{if(!r)return;let t=!1;return fetch("/api/providers/web-login",{cache:"no-store"}).then(e=>e.json()).then(s=>{if(t||!Array.isArray(s.profiles))return;let i=window.localStorage.getItem(`weblogin:profile:${e}`),a=s.profiles.includes("default")?s.profiles:["default",...s.profiles];g(a),b(i&&a.includes(i)?i:"default")}).catch(()=>{}),()=>{t=!0}},[r,e]);let k=(0,a.useCallback)(t=>{b(t),window.localStorage.setItem(`weblogin:profile:${e}`,t)},[e]),N="opening"===d||"waiting"===d,C=(0,a.useCallback)(()=>{N||(w(),l(!1),"error"===d&&(u("idle"),h("")))},[N,d,w]),S=(0,a.useCallback)(()=>{w(),v.current=setInterval(async()=>{try{let s=await fetch(`/api/providers/web-login?provider=${encodeURIComponent(e)}`,{cache:"no-store"}),i=await s.json();"success"===i.status?(w(),u("success"),h(i.email?`${(0,o.Tl)("Signed in as")} ${i.email}`:"Connection saved"),"function"==typeof t&&t(),j.current=setTimeout(()=>{l(!1),h("")},1500)):"error"===i.status||"timeout"===i.status||"cancelled"===i.status?(w(),u("error"),h(i.error||(0,o.Tl)("Login failed"))):u(e=>"opening"===e?"waiting":e)}catch{}},2e3)},[e,t,w]),A=(0,a.useCallback)(async()=>{u("opening"),h("");try{let t=await fetch("/api/providers/web-login",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:e,profile:y})}),s=await t.json();if(!t.ok){u("error"),h(s.error||(0,o.Tl)("Failed to start login"));return}u("waiting"),h((0,o.Tl)("A browser window has opened - log in there, this page updates itself.")),S()}catch(e){u("error"),h(e?.message||(0,o.Tl)("Failed to start login"))}},[e,y,S]),T=(0,a.useCallback)(()=>{fetch(`/api/providers/web-login?provider=${encodeURIComponent(e)}`,{method:"DELETE"}).catch(()=>{}),w(),u("idle"),h("")},[e,w]),$=(0,a.useCallback)(()=>{let e=window.prompt((0,o.Tl)("New browser profile name (e.g. work, personal):"),"");if(!e)return;let t=e.trim().replace(/[^a-zA-Z0-9_-]/g,"-").slice(0,40);t&&(g(e=>e.includes(t)?e:[...e,t]),k(t))},[k]),O="opening"===d?0:"waiting"===d?1:"success"===d?2:-1;return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(n.$n,{size:s,icon:"success"===d?"check_circle":"language",variant:"secondary",onClick:()=>{u("idle"),h(""),l(!0)},title:(0,o.Tl)("Open a browser window, log in by hand - the cookie is captured automatically"),children:"success"===d?(0,o.Tl)("Connected"):(0,o.Tl)("Login via Browser")}),(0,i.jsx)(n.aF,{isOpen:r,onClose:C,title:(0,o.Tl)("Login via Browser"),size:"sm",children:(0,i.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,i.jsx)("p",{className:"text-xs text-text-muted",children:(0,o.Tl)("A Chrome window opens on a shared browser profile. Log in there - the session is captured automatically. One Google login in a profile makes every other provider a single “Continue with Google” click.")}),(0,i.jsxs)("div",{children:[(0,i.jsxs)("div",{className:"mb-2 flex items-center justify-between",children:[(0,i.jsx)("span",{className:"text-xs font-medium uppercase tracking-wide text-text-muted",children:(0,o.Tl)("Browser profile")}),(0,i.jsxs)("button",{type:"button",onClick:$,disabled:N,className:"flex items-center gap-1 text-xs text-primary hover:underline disabled:opacity-50",children:[(0,i.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"add"}),(0,o.Tl)("New profile")]})]}),(0,i.jsx)("div",{className:"grid grid-cols-2 gap-2",children:f.map(e=>{let t=e===y;return(0,i.jsxs)("button",{type:"button",disabled:N,onClick:()=>k(e),className:`flex items-center gap-2 rounded border border-accent/30 bg-sidebar p-2 text-left text-sm transition-colors focus:outline-none focus:ring-1 focus:ring-primary disabled:opacity-50 ${t?"border-primary ring-1 ring-primary":"hover:border-accent/60"}`,children:[(0,i.jsx)("span",{className:"material-symbols-outlined text-[18px] text-text-muted",children:function(e){let t=String(e).toLowerCase();for(let[e,s]of Object.entries(c))if(t.includes(e))return s;return"folder_shared"}(e)}),(0,i.jsx)("span",{className:"min-w-0 flex-1 truncate",children:e}),t&&(0,i.jsx)("span",{className:"material-symbols-outlined text-[16px] text-primary",children:"check_circle"})]},e)})})]}),"idle"!==d&&(0,i.jsx)("div",{className:"rounded border border-accent/20 bg-sidebar/50 p-3",children:"success"===d?(0,i.jsxs)("div",{className:"flex items-center gap-2 text-sm font-medium text-green-400",children:[(0,i.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"check_circle"}),"✓ ",x||(0,o.Tl)("Connection saved")]}):"error"===d?(0,i.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,i.jsxs)("div",{className:"flex items-center gap-2 text-sm font-medium text-yellow-400",children:[(0,i.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"error"}),(0,o.Tl)("Login failed")]}),x&&(0,i.jsx)("p",{className:"pl-6 text-xs text-red-500 break-words",children:x})]}):(0,i.jsxs)("ol",{className:"flex flex-col gap-2",children:[m.map((e,t)=>{let s=t<O,a=t===O;return(0,i.jsxs)("li",{className:`flex items-center gap-2 text-sm ${s?"text-green-400":a?"text-primary":"text-text-muted opacity-50"}`,children:[(0,i.jsx)("span",{className:`material-symbols-outlined text-[18px] ${a?"animate-pulse":""}`,children:s?"check_circle":e.icon}),(0,o.Tl)(e.label)]},e.key)}),x&&(0,i.jsx)("li",{className:"pl-6 text-xs text-text-muted",children:x})]})}),(0,i.jsx)("div",{className:"flex gap-2",children:"success"===d?(0,i.jsx)(n.$n,{onClick:C,fullWidth:!0,children:(0,o.Tl)("Done")}):N?(0,i.jsx)(n.$n,{onClick:T,variant:"ghost",fullWidth:!0,children:(0,o.Tl)("Cancel")}):(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(n.$n,{onClick:A,fullWidth:!0,disabled:"error"===d&&!x,children:(0,o.Tl)("Open Browser & Login")}),(0,i.jsx)(n.$n,{onClick:C,variant:"ghost",fullWidth:!0,disabled:N,children:(0,o.Tl)("Close")})]})})]})})]})}p.propTypes={providerId:l().string.isRequired,onConnected:l().func,size:l().oneOf(["sm","md","lg"])}},46584:(e,t,s)=>{"use strict";s.r(t),s.d(t,{default:()=>eo});var i=s(95155),a=s(12115),r=s(14051),l=s.n(r),n=s(73321),o=s(98500),d=s.n(o),c=s(5772),m=s(8247),p=s(35497),u=s(39403),x=s(88105),h=s(28777),f=s(67899),g=s(62630);s(67468);var y=s(13097);let b=["none","low","medium","high"],v=["none","thinking"],j=["none","low","medium","high","xhigh","max"],w={openai:["none","minimal","low","medium","high","xhigh"],"claude-adaptive":j,"claude-budget":j,"gemini-level":["minimal","low","medium","high"],"gemini-budget":b,zai:v,qwen:b,kimi:["none","low","medium","high","max"],deepseek:["none","high","max"],commandcode:["none","low","medium","high","xhigh","max"],minimax:v,hunyuan:b,step:b,nous:b},k=["none","minimal","low","medium","high","xhigh","max"],N=["none","low","medium","high","max"],C=[{pattern:"*gemini-4*",levels:["low","medium","high"]},{pattern:"*claude*4.6*",levels:N},{pattern:"*claude*4-6*",levels:N},{provider:"codex",pattern:"*gpt-6*",levels:k},{provider:"codex",pattern:"*gpt-5.6-sol*",levels:[...k,"ultra"]},{provider:"codex",pattern:"*gpt-5.6-terra*",levels:[...k,"ultra"]},{provider:"codex",pattern:"*gpt-5.6-luna*",levels:k},{pattern:"*codex*",levels:["low","medium","high","xhigh"]},{provider:"opencode",pattern:"*mimo*v2.6*",levels:["none","minimal","low","medium","high","xhigh","max"]},{pattern:"*mimo*v2.6*",levels:["none","low","medium","high","xhigh"]},{pattern:"*mimo*v2.5-pro*",levels:["none","low","medium","high","xhigh"]},{provider:"codebuddy-cn",pattern:"deepseek-v4-pro",levels:["low","high","xhigh"]},{provider:"codebuddy-cn",pattern:"deepseek-v4.1-flash",levels:["low","high","max"]},{pattern:"*deepseek-v4.1-flash-free*",levels:["low","high","max"]},{pattern:"*deepseek-v4.*",levels:["none","low","medium","high","xhigh","max"]},{provider:"codebuddy-cn",pattern:"glm-5.3",levels:["low","high","max"]},{provider:"codebuddy-cn",pattern:"glm-5.3-flash",levels:["low","high","max"]},{provider:"codebuddy-cn",pattern:"glm-5.2",levels:["high","xhigh"]},{provider:"codebuddy-cn",pattern:"kimi-k2.8-preview",levels:["low","medium","high"]},{provider:"codebuddy-cn",pattern:"hy3",levels:["low","high"]},{provider:"codebuddy-cn",pattern:"hy4-preview",levels:["high"]},{provider:"codebuddy-intl",pattern:"deepseek-v4*",levels:["low","high","xhigh"]},{provider:"minimax-code",pattern:"MiniMax-M3.1*",levels:["low","medium","high","xhigh","max"]},{provider:"minimax-code",pattern:"MiniMax-M3",levels:["none","high"]},{provider:"minimax-code-global",pattern:"MiniMax-M3.1*",levels:["low","medium","high","xhigh","max"]},{provider:"minimax-code-global",pattern:"MiniMax-M3",levels:["none","high"]}],S=/(?:^|\/)gpt-(?:5\.6|6)(?:[.-]|$)/i;function A(e,t){if("kiro"===e&&null===function(e){if("string"!=typeof e)return null;let t=e.toLowerCase().replace(/-/g,".");if(/(?:^|[/.])gpt[/.]5[/.]6(?:[/.]|$)/.test(t))return"reasoning";if(!t.includes("claude"))return null;let s=function(e){if("string"!=typeof e)return null;let t=e.toLowerCase().replace(/-/g,".").match(/(?:^|[/.])claude(?:[/.][a-z]+)*[/.](\d+)(?:[/.](\d+))?(?:[/.]|$)/);return t?{major:Number(t[1]),minor:void 0===t[2]?null:Number(t[2])}:null}(e);if(!s)return null;let{major:i,minor:a}=s;return i<4||4===i&&(null===a||a<=5||null!==a&&a>=1e3)?null:"output_config"}(t))return null;let s=(0,f.nl)(e,t);if(!s.reasoning)return null;let i=String(t||"").replace(/\([^()]+\)\s*$/,""),a="codex"===e?(0,y.SM)("cx").find(e=>e.id===i)?.thinkingLevels:null,r=C.find(s=>(!s.provider||s.provider===e)&&(0,g.gH)(s.pattern,t)),l=a||r?.levels||(String(e||"").startsWith("openai-compatible-")&&S.test(i)?k:null)||w[s.thinkingFormat]||b;return!1===s.thinkingCanDisable&&(l=l.filter(e=>"none"!==e)),l}var T=s(11059),$=s(929),O=s(73006);let P=new Map;async function I(e){if(!e?.url||!e?.type)return[];let t=P.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 i=(await s.json()).data??[];return P.set(e.url,{data:i,expiresAt:Date.now()+6e5}),i}catch{return[]}}function E({customModels:e=[],modelAliases:t={},providerAlias:s,builtInModels:i=[],type:a="llm",includeLegacyAliases:r=!0}){let l=new Set(i.map(e=>e.id)),n=new Set,o=[];for(let t of e){if(!t?.id||t.providerAlias!==s)continue;let e=t?.kind||t?.type||"llm";if(a&&e!==a||l.has(t.id))continue;let i=`${s}/${t.id}`;n.has(i)||(n.add(i),o.push({id:t.id,name:t.name||t.id,fullModel:i,source:"custom",type:e}))}if(!r)return o;let d=`${s}/`;for(let[e,s]of Object.entries(t||{})){if("string"!=typeof s||!s.startsWith(d))continue;let t=s.slice(d.length);!t||l.has(t)||n.has(s)||(n.add(s),o.push({id:t,alias:e,fullModel:s,source:"legacyAlias",type:a||"llm"}))}return o}function D({model:e,fullModel:t,alias:s,copied:a,onCopy:r,testStatus:l,isCustom:n,isFree:o,onDeleteAlias:d,onTest:c,isTesting:m,onDisable:u,caps:x,thinkingSuffix:h}){let f=h?`${t}(${h})`:t;return(0,i.jsx)("div",{className:`group w-full sm:w-auto min-w-0 max-w-full rounded-lg border px-3 py-2 ${"ok"===l?"border-success/30":"error"===l?"border-danger/30":"border-border"} transition-colors hover:bg-surface-2/60`,children:(0,i.jsxs)("div",{className:"flex min-w-0 items-start gap-2 sm:items-center",children:[(0,i.jsx)("span",{className:`material-symbols-outlined shrink-0 text-base mt-0.5 sm:mt-0 ${"ok"===l?"text-success":"error"===l?"text-danger":"text-text-muted"}`,children:"ok"===l?"check_circle":"error"===l?"cancel":"smart_toy"}),(0,i.jsxs)("div",{className:"flex min-w-0 flex-1 flex-col gap-1",children:[(0,i.jsx)("code",{className:"w-fit max-w-full break-all rounded bg-surface-2 px-1.5 py-0.5 font-mono text-xs text-text-muted sm:max-w-[360px] sm:truncate",children:f}),(0,i.jsxs)("span",{className:"flex min-w-0 items-center text-[9px] gap-1 pl-1",children:[e.name&&(0,i.jsx)("span",{className:"break-all sm:truncate text-[9px] italic text-text-muted/70",children:e.name}),(0,i.jsx)(p.nh,{caps:x,colorOverride:"text-text-muted/70",size:12})]})]}),(0,i.jsxs)("div",{className:"flex shrink-0 items-center gap-0.5 sm:gap-1",children:[c&&(0,i.jsxs)("div",{className:"relative shrink-0 group/btn",children:[(0,i.jsx)("button",{onClick:c,disabled:m,className:`rounded p-0.5 text-text-muted transition-opacity hover:bg-surface-2 hover:text-primary ${m?"opacity-100":"opacity-100 sm:opacity-0 sm:group-hover:opacity-100"}`,children:(0,i.jsx)("span",{className:"material-symbols-outlined text-sm",style:m?{animation:"spin 1s linear infinite"}:void 0,children:m?"progress_activity":"science"})}),(0,i.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,i.jsxs)("div",{className:"relative shrink-0 group/btn",children:[(0,i.jsx)("button",{onClick:()=>r(f,`model-${e.id}`),className:"rounded p-0.5 text-text-muted hover:bg-surface-2 hover:text-primary",children:(0,i.jsx)("span",{className:"material-symbols-outlined text-sm",children:a===`model-${e.id}`?"check":"content_copy"})}),(0,i.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:a===`model-${e.id}`?"Copied!":"Copy"})]}),n?(0,i.jsx)("button",{onClick:d,className:"rounded p-0.5 text-text-muted opacity-100 transition-opacity hover:bg-danger/10 hover:text-danger sm:opacity-0 sm:group-hover:opacity-100",title:"Remove custom model",children:(0,i.jsx)("span",{className:"material-symbols-outlined text-sm",children:"close"})}):u?(0,i.jsx)("button",{onClick:u,className:"rounded p-0.5 text-text-muted opacity-100 transition-opacity hover:bg-danger/10 hover:text-danger sm:opacity-0 sm:group-hover:opacity-100",title:"Disable this model",children:(0,i.jsx)("span",{className:"material-symbols-outlined text-sm",children:"close"})}):null]})]})})}function R({modelId:e,fullModel:t,copied:s,onCopy:a,onDeleteAlias:r,onTest:l,testStatus:n,isTesting:o}){let d="ok"===n?"#22c55e":"error"===n?"#ef4444":void 0;return(0,i.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,i.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,i.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,i.jsx)("p",{className:"text-sm font-medium truncate",children:e}),(0,i.jsxs)("div",{className:"flex items-center gap-1 mt-1",children:[(0,i.jsx)("code",{className:"text-xs text-text-muted font-mono bg-sidebar px-1.5 py-0.5 rounded",children:t}),(0,i.jsxs)("div",{className:"relative group/btn",children:[(0,i.jsx)("button",{onClick:()=>a(t,`model-${e}`),className:"p-0.5 hover:bg-sidebar rounded text-text-muted hover:text-primary",children:(0,i.jsx)("span",{className:"material-symbols-outlined text-sm",children:s===`model-${e}`?"check":"content_copy"})}),(0,i.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"})]}),l&&(0,i.jsxs)("div",{className:"relative group/btn",children:[(0,i.jsx)("button",{onClick:l,disabled:o,className:"p-0.5 hover:bg-sidebar rounded text-text-muted hover:text-primary transition-colors",children:(0,i.jsx)("span",{className:"material-symbols-outlined text-sm",style:o?{animation:"spin 1s linear infinite"}:void 0,children:o?"progress_activity":"science"})}),(0,i.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,i.jsx)("button",{onClick:r,className:"p-1 hover:bg-red-50 rounded text-red-500",title:"Remove model",children:(0,i.jsx)("span",{className:"material-symbols-outlined text-sm",children:"delete"})})]})}function _({providerStorageAlias:e,providerDisplayAlias:t,modelAliases:s,customModels:r,copied:l,onCopy:n,onDeleteAlias:o,onAddCustomModel:d,onDeleteCustomModel:c,connections:m,isAnthropic:u}){let[x,h]=(0,a.useState)(""),[f,g]=(0,a.useState)(!1),[y,b]=(0,a.useState)(!1),[v,j]=(0,a.useState)(null),[w,k]=(0,a.useState)({}),N=async t=>{if(!v){j(t);try{let s=await fetch("/api/models/test",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({model:`${e}/${t}`})}),i=await s.json();k(e=>({...e,[t]:i.ok?"ok":"error"}))}catch{k(e=>({...e,[t]:"error"}))}finally{j(null)}}},C=E({customModels:r,modelAliases:s,providerAlias:e,type:"llm"}),S=async()=>{if(!x.trim()||f)return;let e=x.trim();if(C.some(t=>t.id===e))return void alert("Model already exists for this provider.");g(!0);try{await d(e),h("")}catch(e){console.log("Error adding model:",e)}finally{g(!1)}},A=async()=>{if(y)return;let e=m.find(e=>!1!==e.isActive);if(e){b(!0);try{let t=await fetch(`/api/providers/${e.id}/models`),s=await t.json();if(!t.ok)return void alert(s.error||"Failed to import models");let i=s.models||[];if(0===i.length)return void alert("No models returned from /models.");let a=0;for(let e of i){let t=e.id||e.name||e.model;t&&(C.some(e=>e.id===t)||(await d(t),a+=1))}0===a&&alert("No new models were added.")}catch(e){console.log("Error importing models:",e)}finally{b(!1)}}},T=m.some(e=>!1!==e.isActive);return(0,i.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,i.jsxs)("p",{className:"text-sm text-text-muted",children:["Add ",u?"Anthropic":"OpenAI","-compatible models manually or import them from the /models endpoint."]}),(0,i.jsxs)("div",{className:"flex items-end gap-2 flex-wrap",children:[(0,i.jsxs)("div",{className:"flex-1 min-w-[240px]",children:[(0,i.jsx)("label",{htmlFor:"new-compatible-model-input",className:"text-xs text-text-muted mb-1 block",children:"Model ID"}),(0,i.jsx)("input",{id:"new-compatible-model-input",type:"text",value:x,onChange:e=>h(e.target.value),onKeyDown:e=>"Enter"===e.key&&S(),placeholder:u?"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,i.jsx)(p.$n,{size:"sm",icon:"add",onClick:S,disabled:!x.trim()||f,children:f?"Adding...":"Add"}),(0,i.jsx)(p.$n,{size:"sm",variant:"secondary",icon:"download",onClick:A,disabled:!T||y,children:y?"Importing...":"Import from /models"})]}),!T&&(0,i.jsx)("p",{className:"text-xs text-text-muted",children:"Add a connection to enable importing models."}),C.length>0&&(0,i.jsx)("div",{className:"flex flex-col gap-3",children:C.map(({id:s,alias:a,source:r})=>(0,i.jsx)(R,{modelId:s,fullModel:`${t}/${s}`,copied:l,onCopy:n,onDeleteAlias:()=>"custom"===r?c(s):o(a),onTest:m.length>0?()=>N(s):void 0,testStatus:w[s],isTesting:v===s},`${r}-${e}/${s}`))})]})}D.propTypes={model:l().shape({id:l().string.isRequired}).isRequired,fullModel:l().string.isRequired,alias:l().string,copied:l().string,onCopy:l().func.isRequired,testStatus:l().oneOf(["ok","error"]),isCustom:l().bool,isFree:l().bool,onDeleteAlias:l().func,onTest:l().func,isTesting:l().bool,onDisable:l().func,caps:l().object,thinkingSuffix:l().string},l().string.isRequired,l().string.isRequired,l().string,l().func.isRequired,l().func.isRequired,l().func,l().oneOf(["ok","error"]),l().bool,l().string.isRequired,l().object.isRequired,l().arrayOf(l().object),l().string,l().func.isRequired,l().func.isRequired,l().func.isRequired,l().func.isRequired,_.propTypes={providerStorageAlias:l().string.isRequired,providerDisplayAlias:l().string.isRequired,modelAliases:l().object.isRequired,customModels:l().arrayOf(l().object),copied:l().string,onCopy:l().func.isRequired,onDeleteAlias:l().func.isRequired,onAddCustomModel:l().func.isRequired,onDeleteCustomModel:l().func.isRequired,connections:l().arrayOf(l().shape({id:l().string,isActive:l().bool})).isRequired,isAnthropic:l().bool};var z=s(47650),M=s(70217);function q({until:e}){let[t,s]=(0,a.useState)("");return((0,a.useEffect)(()=>{let t=()=>{let t=new Date(e).getTime()-Date.now();if(t<=0)return void s("");let i=Math.floor(t/1e3);if(i<60)s(`${i}s`);else if(i<3600)s(`${Math.floor(i/60)}m ${i%60}s`);else{let e=Math.floor(i/3600),t=Math.floor(i%3600/60);s(`${e}h ${t}m`)}};t();let i=setInterval(t,1e3);return()=>clearInterval(i)},[e]),t)?(0,i.jsxs)("span",{className:"text-xs text-warning font-mono",children:["⏱ ",t]}):null}function U({connection:e,proxyPools:t,isOAuth:s,isFirst:r,isLast:l,onMoveUp:n,onMoveDown:o,onToggleActive:d,onUpdateProxy:c,onEdit:m,onDelete:u,oneByOneStatus:x=null,autoPing:h=null}){let[f,g]=(0,a.useState)(!1),[y,b]=(0,a.useState)(!1),v=(0,a.useRef)(null),j=(0,a.useRef)(null),[w,k]=(0,a.useState)(null),N=new Map((t||[]).map(e=>[e.id,e])),C=e.providerSpecificData?.proxyPoolId||null,S=C?N.get(C):null,A=e.providerSpecificData?.connectionProxyEnabled===!0&&!!e.providerSpecificData?.connectionProxyUrl,T=!!C||A,$=S?`Pool: ${S.name}`:C?`Pool: ${C} (inactive/missing)`:A?`Legacy: ${e.providerSpecificData?.connectionProxyUrl}`:"",O=(()=>{if(!h)return"";let e=[];return(h.reactiveOn&&e.push("On reset"),h.scheduleOn&&e.push(`Scheduled (${h.scheduleSummary||"active"})`),e.length>0)?`Auto-ping active: ${e.join(" + ")}. Click to configure.`:"codex"===h.provider?"Auto-starts the next 5h Codex window after reset or on schedule. Click to configure.":"Auto-starts a new window on quota reset or fixed schedule. Click to configure."})(),P="";if(S?.proxyUrl||e.providerSpecificData?.connectionProxyUrl){let t=S?.proxyUrl||e.providerSpecificData?.connectionProxyUrl;try{let e=new URL(t);P=`${e.protocol}//${e.hostname}${e.port?`:${e.port}`:""}`}catch{P=t}}let I=S?.noProxy||e.providerSpecificData?.connectionNoProxy||"",E="default";S?.isActive===!0?E="success":(C||A)&&(E="error"),(0,a.useEffect)(()=>{if(!f)return;let e=e=>{v.current?.contains(e.target)||j.current?.contains(e.target)||g(!1)},t=()=>g(!1);return document.addEventListener("mousedown",e),window.addEventListener("resize",t),document.addEventListener("scroll",t,!0),()=>{document.removeEventListener("mousedown",e),window.removeEventListener("resize",t),document.removeEventListener("scroll",t,!0)}},[f]);let D=async e=>{b(!0);try{await c("__none__"===e?null:e)}finally{b(!1),g(!1)}},R=e.authType||(s?"oauth":"apikey"),_="oauth"===R,L="cookie"===R,K="mcode-lease"===R,F=e.name?.trim()||e.email?.trim()||e.displayName?.trim()||(K?"Desktop Lease":_?"OAuth Account":L?"Cookie Account":"API Key"),J=e.name?.trim()&&e.email?.trim()&&e.name.trim()!==e.email.trim()?e.email.trim():e.name?.trim()&&e.displayName?.trim()&&e.name.trim()!==e.displayName.trim()?e.displayName.trim():null,[W,H]=(0,a.useState)(!1),B=Object.entries(e).filter(([e])=>e.startsWith("modelLock_")).map(([,e])=>e).filter(e=>!!e).sort()[0]||null;(0,a.useEffect)(()=>{let t=()=>{H(!!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=B?setInterval(t,1e3):null;return()=>{s&&clearInterval(s)}},[B]);let G="unavailable"!==e.testStatus||W?e.testStatus:"active",Z=()=>x?"queued"===x.state?"queued":"testing"===x.state?"testing":"success"===x.state?"success":"failed"===x.state?x.error?`failed: ${x.error}`:"failed":null:null,V=!1===e.isActive?"":"error"===G||"expired"===G||"unavailable"===G?"shadow-[inset_2px_0_0_0_var(--color-danger)]":"";return(0,i.jsxs)("div",{className:`group flex min-w-0 flex-col gap-2.5 rounded-xl px-3 py-3 transition-colors hover:bg-surface-2/60 sm:flex-row sm:items-center sm:justify-between ${V} ${!1===e.isActive?"opacity-60":""}`,children:[(0,i.jsxs)("div",{className:"flex min-w-0 flex-1 items-start gap-2 sm:items-center sm:gap-3",children:[(0,i.jsxs)("div",{className:"flex shrink-0 flex-col",children:[(0,i.jsx)("button",{onClick:n,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,i.jsx)("span",{className:"material-symbols-outlined text-sm",children:"keyboard_arrow_up"})}),(0,i.jsx)("button",{onClick:o,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,i.jsx)("span",{className:"material-symbols-outlined text-sm",children:"keyboard_arrow_down"})})]}),(0,i.jsx)("span",{className:"material-symbols-outlined shrink-0 text-base text-text-muted",children:K?"desktop_windows":L?"cookie":_?"lock":"key"}),(0,i.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,i.jsx)("p",{className:"font-display text-sm font-medium truncate",children:F}),J&&(0,i.jsx)("p",{className:"font-mono text-xs text-text-muted truncate",children:J}),(0,i.jsxs)("div",{className:"mt-1 flex min-w-0 flex-wrap items-center gap-1.5 sm:gap-2",children:[(0,i.jsx)(p.Ex,{variant:(0,M.g)(e.isActive,G),size:"sm",dot:!0,children:!1===e.isActive?"disabled":G||"Unknown"}),(0,i.jsx)(p.Ex,{variant:"default",size:"sm",children:K?"Desktop Lease":_?"OAuth":L?"Cookie":"API Key"}),T&&(0,i.jsx)(p.Ex,{variant:E,size:"sm",children:"Proxy"}),W&&!1!==e.isActive&&(0,i.jsx)(q,{until:B}),e.lastError&&!1!==e.isActive&&(0,i.jsx)("span",{className:"max-w-full truncate text-xs text-danger sm:max-w-[300px]",title:e.lastError,children:e.lastError}),(0,i.jsxs)("span",{className:"text-xs text-text-muted",children:["#",e.priority]}),e.globalPriority&&(0,i.jsxs)("span",{className:"text-xs text-text-muted",children:["Auto: ",e.globalPriority]}),Z()&&(0,i.jsx)(p.Ex,{variant:x?"success"===x.state?"success":"failed"===x.state?"error":"testing"===x.state?"primary":"default":"default",size:"sm",children:Z()})]}),T&&(0,i.jsxs)("div",{className:"mt-1 flex items-center gap-2 flex-wrap",children:[(0,i.jsx)("span",{className:"max-w-full truncate text-[11px] text-text-muted sm:max-w-[420px]",title:$,children:$}),P&&(0,i.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:P}),I&&(0,i.jsxs)("span",{className:"max-w-full truncate text-[11px] text-text-muted sm:max-w-[320px]",title:I,children:["no_proxy: ",I]})]})]})]}),(0,i.jsxs)("div",{className:"flex w-full items-center justify-between gap-2 sm:w-auto sm:justify-end",children:[(0,i.jsxs)("div",{className:"grid flex-1 grid-cols-3 gap-1 sm:flex sm:flex-none",children:[(t||[]).length>0&&(0,i.jsxs)("div",{children:[(0,i.jsxs)("button",{ref:j,onClick:()=>{if(f)return void g(!1);let e=j.current?.getBoundingClientRect();if(!e)return void g(!0);let s=((t?.length||0)+1)*34+8,i=window.innerHeight-e.bottom,a=i<s&&e.top>i;k({position:"fixed",right:window.innerWidth-e.right,...a?{bottom:window.innerHeight-e.top+4,maxHeight:Math.max(e.top-8,120)}:{top:e.bottom+4,maxHeight:Math.max(i-8,120)}}),g(!0)},className:`flex w-full flex-col items-center rounded px-2 py-1 transition-colors hover:bg-black/5 dark:hover:bg-white/5 ${T?"text-primary":"text-text-muted hover:text-primary"}`,disabled:y,children:[(0,i.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:y?"progress_activity":"lan"}),(0,i.jsx)("span",{className:"text-[10px] leading-tight",children:"Proxy"})]}),f&&(0,z.createPortal)((0,i.jsxs)("div",{ref:v,style:w,className:"z-50 max-w-[78vw] min-w-[160px] overflow-y-auto rounded-lg border border-border bg-bg py-1 shadow-lg",children:[(0,i.jsx)("button",{onClick:()=>D("__none__"),className:`w-full text-left px-3 py-1.5 text-sm hover:bg-black/5 dark:hover:bg-white/5 ${!C?"text-primary font-medium":"text-text-main"}`,children:"None"}),(t||[]).map(e=>(0,i.jsx)("button",{onClick:()=>D(e.id),className:`w-full text-left px-3 py-1.5 text-sm hover:bg-black/5 dark:hover:bg-white/5 ${C===e.id?"text-primary font-medium":"text-text-main"}`,children:e.name},e.id))]}),document.body)]}),h&&(0,i.jsx)(p.m_,{text:O,children:(0,i.jsxs)("button",{onClick:h.onConfigure,className:`flex w-full flex-col items-center rounded px-2 py-1 transition-colors hover:bg-black/5 dark:hover:bg-white/5 ${h.isActive?"text-primary":"text-text-muted hover:text-primary"}`,children:[(0,i.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"bolt"}),(0,i.jsx)("span",{className:"text-[10px] leading-tight",children:"Auto-ping"})]})}),(0,i.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,i.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"edit"}),(0,i.jsx)("span",{className:"text-[10px] leading-tight",children:"Edit"})]}),(0,i.jsxs)("button",{onClick:u,className:"flex flex-col items-center rounded px-2 py-1 text-text-muted hover:bg-red-500/10 hover:text-danger",children:[(0,i.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"delete"}),(0,i.jsx)("span",{className:"text-[10px] leading-tight",children:"Delete"})]})]}),(0,i.jsx)(p.lM,{size:"sm",checked:e.isActive??!0,onChange:d,title:e.isActive??!0?"Disable connection":"Enable connection"})]})]})}q.propTypes={until:l().string.isRequired},U.propTypes={connection:l().shape({id:l().string,name:l().string,email:l().string,displayName:l().string,modelLockUntil:l().string,testStatus:l().string,isActive:l().bool,lastError:l().string,priority:l().number,globalPriority:l().number}).isRequired,proxyPools:l().arrayOf(l().shape({id:l().string,name:l().string,proxyUrl:l().string,noProxy:l().string,isActive:l().bool})),isOAuth:l().bool.isRequired,isFirst:l().bool.isRequired,isLast:l().bool.isRequired,onMoveUp:l().func.isRequired,onMoveDown:l().func.isRequired,onToggleActive:l().func.isRequired,onUpdateProxy:l().func,onEdit:l().func.isRequired,onDelete:l().func.isRequired,oneByOneStatus:l().shape({state:l().string,error:l().string}),autoPing:l().shape({isActive:l().bool,provider:l().string,reactiveOn:l().bool,scheduleOn:l().bool,scheduleSummary:l().string,onConfigure:l().func})};let L=`name1|sk-key1
|
|
2
|
-
name2|sk-key2
|
|
3
|
-
sk-key-only-auto-named`;function K({isOpen:e,provider:t,providerName:s,isCompatible:r,isAnthropic:l,authType:n,authHint:o,website:d,proxyPools:c,error:m,existingNames:u,onSave:h,onBulkDone:f,onClose:g}){let y="__none__",b="ollama-local"===t,v="cookie"===n,j="xai"===t&&!v,w=v?"Cookie Value":"qoder"===t||"qoder-cn"===t?"Personal Access Token (PAT)":"API Key",k="azure"===t,N="cloudflare-ai"===t,C=x.Q2?.[t]?.credentialForm==="aws",S=x.Q2?.[t]?.apiKeyOptionalWith||null,A=x.Q2?.[t]?.regions||null,T=x.Q2?.[t]?.defaultRegion||A?.[0]?.id||"",[$,O]=(0,a.useState)({name:"",apiKey:"",defaultModel:"",priority:1,proxyPoolId:y,ollamaHostUrl:""}),[P,I]=(0,a.useState)({azureEndpoint:"",apiVersion:"2024-10-01-preview",deployment:"",organization:""}),[E,D]=(0,a.useState)({accountId:""}),[R,_]=(0,a.useState)({profile:"",region:"",accessKeyId:"",sessionToken:""}),[z,M]=(0,a.useState)(T),[q,U]=(0,a.useState)(!1),[F,J]=(0,a.useState)(null),[W,H]=(0,a.useState)(!1),B=N?`name1|sk-key1|acc123456
|
|
4
|
-
name2|sk-key2|def789012
|
|
5
|
-
sk-key-only-auto-named`:"qoder"===t||"qoder-cn"===t?`name1|pt-xxxxx
|
|
6
|
-
name2|pt-yyyyy
|
|
7
|
-
pt-only-auto-named`:L,[G,Z]=(0,a.useState)("single"),[V,Q]=(0,a.useState)(""),[X,Y]=(0,a.useState)(null),ee=()=>{if(b&&$.ollamaHostUrl.trim())return{baseUrl:$.ollamaHostUrl.trim()};if(k)return{azureEndpoint:P.azureEndpoint,apiVersion:P.apiVersion,deployment:P.deployment,organization:P.organization};if(N)return{accountId:E.accountId};if(C){let e={};return R.profile.trim()&&(e.profile=R.profile.trim()),R.region.trim()&&(e.region=R.region.trim()),R.accessKeyId.trim()&&(e.accessKeyId=R.accessKeyId.trim()),R.sessionToken.trim()&&(e.sessionToken=R.sessionToken.trim()),Object.keys(e).length?e:void 0}if(A&&z)return{region:z}},et=()=>{let e=ee();return!!(S&&e?.[S])||(C?!!$.apiKey&&!!e?.accessKeyId:!!$.apiKey)},es=async()=>{U(!0);try{let e=await fetch("/api/providers/validate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:t,apiKey:$.apiKey,providerSpecificData:ee()})}),s=await e.json();J(s.valid?"success":"failed")}catch{J("failed")}finally{U(!1)}},ei=async()=>{if(t&&(b||et())&&(b||$.name)&&(!r||$.defaultModel.trim())){H(!0);try{let e=!1;try{U(!0),J(null);let s=await fetch("/api/providers/validate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:t,apiKey:$.apiKey,providerSpecificData:ee()})});e=!!(await s.json()).valid,J(e?"success":"failed")}catch{J("failed")}finally{U(!1)}await h({name:$.name||(b?"Ollama Local":""),apiKey:$.apiKey,defaultModel:r?$.defaultModel.trim():void 0,priority:$.priority,proxyPoolId:$.proxyPoolId===y?null:$.proxyPoolId,testStatus:e?"active":"unknown",providerSpecificData:ee()})}finally{H(!1)}}},ea=async()=>{let e=V.split("\n");if(!e.length)return;let s=function(e,t,s={}){let{isCloudflareAi:i=!1}=s,a=new Set((Array.isArray(t)?t:[]).map(e=>"string"==typeof e?e.toLowerCase():"")),r=[];for(let t of e){let e,s="string"==typeof t?t.trim():"";if(!s)continue;let l=function(e,t={}){let{isCloudflareAi:s=!1}=t;if(!s&&/^LLM\|/i.test(e.trim()))return{baseName:"LLM",apiKey:e.trim()};let i=e.split("|");if(s&&i.length>=3){let e=i[0].trim();return{baseName:e||"Key",apiKey:i.slice(1,-1).join("|").trim(),providerSpecificData:{accountId:i[i.length-1].trim()}}}return i.length>=2?{baseName:i[0].trim()||"Key",apiKey:i.slice(1).join("|").trim()}:{baseName:"Key",apiKey:i[0].trim()}}(s,{isCloudflareAi:i});if(!l||!l.apiKey)continue;let n=l.baseName,o=1;for(;e=`${n} ${o}`,a.has(e.toLowerCase());)o+=1;a.add(e.toLowerCase());let d={name:e,apiKey:l.apiKey,skipped:!1};l.providerSpecificData&&(d.providerSpecificData=l.providerSpecificData),r.push(d)}return r}(e,u,{isCloudflareAi:N});if(!s.length)return;H(!0),Y(null);let i=0,a=0;for(let e of s)try{let s=!1;try{let i=await fetch("/api/providers/validate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:t,apiKey:e.apiKey})});s=!!(await i.json().catch(()=>({}))).valid}catch{s=!1}(await fetch("/api/providers",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:t,apiKey:e.apiKey,name:e.name,priority:1,testStatus:s?"active":"unknown",...e.providerSpecificData?{providerSpecificData:e.providerSpecificData}:{}})})).ok?i++:a++}catch{a++}H(!1),Y({success:i,failed:a}),i>0&&f&&f()};return t?(0,i.jsx)(p.aF,{isOpen:e,title:`Add ${s||t} ${w}`,onClose:g,children:(0,i.jsxs)("div",{className:"flex flex-col gap-4",children:[!C&&(0,i.jsxs)("div",{className:"flex gap-2",children:[(0,i.jsx)(p.$n,{size:"sm",variant:"single"===G?"primary":"ghost",onClick:()=>{Z("single"),Y(null)},children:"Single"}),(0,i.jsx)(p.$n,{size:"sm",variant:"bulk"===G?"primary":"ghost",onClick:()=>{Z("bulk"),Y(null)},children:"Bulk Add"})]}),"bulk"===G&&(0,i.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,i.jsx)("p",{className:"text-xs text-text-muted",children:N?(0,i.jsxs)(i.Fragment,{children:["One key per line. Format: ",(0,i.jsx)("code",{children:"name|apiKey|accountId"})," or just ",(0,i.jsx)("code",{children:"apiKey"})," (auto-named by index)."]}):"qoder"===t||"qoder-cn"===t?(0,i.jsxs)(i.Fragment,{children:["One PAT per line. Format: ",(0,i.jsx)("code",{children:"name|pt-..."})," or just ",(0,i.jsx)("code",{children:"pt-..."})," (auto-named by index)."]}):(0,i.jsxs)(i.Fragment,{children:["One key per line. Format: ",(0,i.jsx)("code",{children:"name|apiKey"})," or just ",(0,i.jsx)("code",{children:"apiKey"})," (auto-named by index)."]})}),(0,i.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:B,value:V,onChange:e=>Q(e.target.value)}),X&&(0,i.jsxs)("div",{className:`text-sm font-medium ${X.failed>0?"text-yellow-400":"text-green-400"}`,children:["✓ ",X.success," added",X.failed>0?`, ✗ ${X.failed} failed`:""]}),(0,i.jsxs)("div",{className:"flex gap-2",children:[(0,i.jsx)(p.$n,{onClick:ea,fullWidth:!0,disabled:W||!V.trim(),children:W?"Adding...":"Add All Keys"}),(0,i.jsx)(p.$n,{onClick:g,variant:"ghost",fullWidth:!0,children:"Cancel"})]})]}),"single"===G&&(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(p.pd,{label:"Name",value:$.name,onChange:e=>O({...$,name:e.target.value}),placeholder:b?"Ollama Local":"Production Key"}),b&&(0,i.jsxs)("div",{className:"flex gap-2",children:[(0,i.jsx)(p.pd,{label:"Ollama Host URL",value:$.ollamaHostUrl,onChange:e=>O({...$,ollamaHostUrl:e.target.value}),placeholder:"http://localhost:11434",className:"flex-1"}),(0,i.jsx)("div",{className:"pt-6",children:(0,i.jsx)(p.$n,{onClick:es,disabled:q||W,variant:"secondary",children:q?"Checking...":"Check"})})]}),!b&&(0,i.jsxs)("div",{className:"flex gap-2",children:[(0,i.jsx)(p.pd,{label:w,type:v?"text":"password",value:$.apiKey,onChange:e=>O({...$,apiKey:e.target.value}),placeholder:v?"grok-web"===t?"sso=xxxxx... or just the raw value":"eyJhbGciOi...":j?"xai-...":"qoder"===t||"qoder-cn"===t?"pt-...":"",className:"flex-1"}),(0,i.jsx)("div",{className:"pt-6",children:(0,i.jsx)(p.$n,{onClick:es,disabled:!et()||q||W,variant:"secondary",children:q?"Checking...":"Check"})})]}),j&&(0,i.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."}),v&&o&&(0,i.jsxs)("p",{className:"text-xs text-text-muted",children:[o,d&&(0,i.jsxs)(i.Fragment,{children:[" ",(0,i.jsxs)("a",{href:d,target:"_blank",rel:"noopener noreferrer",className:"text-primary underline",children:["Open ",d.replace(/^https?:\/\//,"")]})]})]}),A&&(0,i.jsx)(p.l6,{label:"Region",value:z,onChange:e=>M(e.target.value),options:A.map(e=>({value:e.id,label:e.label}))}),r&&(0,i.jsx)(p.pd,{label:"Default Model",value:$.defaultModel,onChange:e=>O({...$,defaultModel:e.target.value}),placeholder:l?"claude-3-5-sonnet-latest":"gpt-4o-mini"}),b&&(0,i.jsxs)("p",{className:"text-xs text-text-muted",children:["Leave blank to use ",(0,i.jsx)("code",{children:"http://localhost:11434"}),". For remote Ollama, enter the full host URL (e.g. ",(0,i.jsx)("code",{children:"http://192.168.1.10:11434"}),")."]}),F&&(0,i.jsx)(p.Ex,{variant:"success"===F?"success":"error",children:"success"===F?"Valid":"Invalid"}),m&&(0,i.jsx)("p",{className:"text-xs text-red-500 break-words",children:m}),r&&(0,i.jsx)("p",{className:"text-xs text-text-muted",children:"Enter the model ID exactly as your compatible endpoint expects it. This model will be saved as the connection default."}),N&&(0,i.jsxs)("div",{className:"bg-sidebar/50 p-4 rounded-lg border border-accent/20",children:[(0,i.jsx)("h3",{className:"font-semibold mb-3 text-sm",children:"Cloudflare Workers AI"}),(0,i.jsx)(p.pd,{label:"Account ID",value:E.accountId,onChange:e=>D({...E,accountId:e.target.value}),placeholder:"abc123def456..."}),(0,i.jsxs)("p",{className:"text-xs text-text-muted mt-2",children:["Find your Account ID in the right sidebar of ",(0,i.jsx)("a",{href:"https://dash.cloudflare.com",target:"_blank",rel:"noopener noreferrer",className:"text-primary underline",children:"dash.cloudflare.com"})]})]}),C&&(0,i.jsxs)("div",{className:"bg-sidebar/50 p-4 rounded-lg border border-accent/20",children:[(0,i.jsx)("h3",{className:"font-semibold mb-3 text-sm",children:"AWS Bedrock Credentials"}),(0,i.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,i.jsx)(p.pd,{label:"AWS Profile (SSO - recommended)",value:R.profile,onChange:e=>_({...R,profile:e.target.value}),placeholder:"my-sso-profile"}),(0,i.jsx)(p.pd,{label:"Region",value:R.region,onChange:e=>_({...R,region:e.target.value}),placeholder:"us-east-1"})]}),(0,i.jsxs)("p",{className:"text-xs text-text-muted mt-2",children:["Set a profile from ",(0,i.jsx)("code",{children:"~/.aws/config"})," and leave the API key empty, then run"," ",(0,i.jsxs)("code",{children:["aws sso login --profile ",R.profile||"my-sso-profile"]}),". Credentials refresh automatically."]}),(0,i.jsxs)("div",{className:"flex flex-col gap-3 mt-4",children:[(0,i.jsx)(p.pd,{label:"Access Key ID (only for static keys)",value:R.accessKeyId,onChange:e=>_({...R,accessKeyId:e.target.value}),placeholder:"AKIA..."}),(0,i.jsx)(p.pd,{label:"Session Token (only for temporary ASIA… keys)",type:"password",value:R.sessionToken,onChange:e=>_({...R,sessionToken:e.target.value}),placeholder:"FwoGZXIvYXdz..."})]}),(0,i.jsxs)("p",{className:"text-xs text-text-muted mt-2",children:["For static keys instead: put the AWS ",(0,i.jsx)("strong",{children:"secret"})," access key in the API Key field above and the access key id here. A profile, if set, takes precedence."]})]}),k&&(0,i.jsxs)("div",{className:"bg-sidebar/50 p-4 rounded-lg border border-accent/20",children:[(0,i.jsx)("h3",{className:"font-semibold mb-3 text-sm",children:"Azure OpenAI Configuration"}),(0,i.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,i.jsx)(p.pd,{label:"Azure Endpoint",value:P.azureEndpoint,onChange:e=>I({...P,azureEndpoint:e.target.value}),placeholder:"https://your-resource.openai.azure.com"}),(0,i.jsx)(p.pd,{label:"Deployment Name",value:P.deployment,onChange:e=>I({...P,deployment:e.target.value}),placeholder:"gpt-4"}),(0,i.jsx)(p.pd,{label:"API Version",value:P.apiVersion,onChange:e=>I({...P,apiVersion:e.target.value}),placeholder:"2024-10-01-preview"}),(0,i.jsx)(p.pd,{label:"Organization",value:P.organization,onChange:e=>I({...P,organization:e.target.value}),placeholder:"Organization ID"})]})]}),(0,i.jsx)(p.pd,{label:"Priority",type:"number",value:$.priority,onChange:e=>O({...$,priority:Number.parseInt(e.target.value)||1})}),(0,i.jsx)(p.l6,{label:"Proxy Pool",value:$.proxyPoolId,onChange:e=>O({...$,proxyPoolId:e.target.value}),options:[{value:y,label:"None"},...(c||[]).map(e=>({value:e.id,label:e.name}))],placeholder:"None"}),0===(c||[]).length&&(0,i.jsx)("p",{className:"text-xs text-text-muted",children:"No active proxy pools available. Create one in Proxy Pools page first."}),(0,i.jsx)("p",{className:"text-xs text-text-muted",children:"Legacy manual proxy fields are still accepted by API for backward compatibility."}),(0,i.jsxs)("div",{className:"flex gap-2",children:[(0,i.jsx)(p.$n,{onClick:ei,fullWidth:!0,disabled:W||!b&&(!$.name||!et())||r&&!$.defaultModel.trim()||k&&(!P.azureEndpoint||!P.deployment||!P.organization)||N&&!E.accountId,children:W?"Saving...":"Save"}),(0,i.jsx)(p.$n,{onClick:g,variant:"ghost",fullWidth:!0,children:"Cancel"})]})]})]})}):null}function F({isOpen:e,node:t,onSave:s,onClose:r,isAnthropic:l}){let[n,o]=(0,a.useState)({name:"",prefix:"",apiType:"chat",baseUrl:"https://api.openai.com/v1"}),[d,c]=(0,a.useState)(!1),[m,u]=(0,a.useState)(""),[x,h]=(0,a.useState)(""),[f,g]=(0,a.useState)(!1),[y,b]=(0,a.useState)(null);(0,a.useEffect)(()=>{t&&o({name:t.name||"",prefix:t.prefix||"",apiType:t.apiType||"chat",baseUrl:t.baseUrl||(l?"https://api.anthropic.com/v1":"https://api.openai.com/v1")})},[t,l]);let v=async()=>{if(n.name.trim()&&n.prefix.trim()&&n.baseUrl.trim()){c(!0);try{let e={name:n.name,prefix:n.prefix,baseUrl:n.baseUrl};l||(e.apiType=n.apiType),await s(e)}finally{c(!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:l?"anthropic-compatible":"openai-compatible",modelId:x.trim()||void 0})}),t=await e.json();b(t.valid?"success":"failed")}catch{b("failed")}finally{g(!1)}};return t?(0,i.jsx)(p.aF,{isOpen:e,title:`Edit ${l?"Anthropic":"OpenAI"} Compatible`,onClose:r,children:(0,i.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,i.jsx)(p.pd,{label:"Name",value:n.name,onChange:e=>o({...n,name:e.target.value}),placeholder:`${l?"Anthropic":"OpenAI"} Compatible (Prod)`,hint:"Required. A friendly label for this node."}),(0,i.jsx)(p.pd,{label:"Prefix",value:n.prefix,onChange:e=>o({...n,prefix:e.target.value}),placeholder:l?"ac-prod":"oc-prod",hint:"Required. Used as the provider prefix for model IDs."}),!l&&(0,i.jsx)(p.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,i.jsx)(p.pd,{label:"Base URL",value:n.baseUrl,onChange:e=>o({...n,baseUrl:e.target.value}),placeholder:l?"https://api.anthropic.com/v1":"https://api.openai.com/v1",hint:`Use the base URL (ending in /v1) for your ${l?"Anthropic":"OpenAI"}-compatible API.`}),(0,i.jsxs)("div",{className:"flex gap-2",children:[(0,i.jsx)(p.pd,{label:"API Key (for Check)",type:"password",value:m,onChange:e=>u(e.target.value),className:"flex-1"}),(0,i.jsx)("div",{className:"pt-6",children:(0,i.jsx)(p.$n,{onClick:j,disabled:!m||f||!n.baseUrl.trim(),variant:"secondary",children:f?"Checking...":"Check"})})]}),(0,i.jsx)(p.pd,{label:"Model ID (optional)",value:x,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,i.jsx)(p.Ex,{variant:"success"===y?"success":"error",children:"success"===y?"Valid":"Invalid"}),(0,i.jsxs)("div",{className:"flex gap-2",children:[(0,i.jsx)(p.$n,{onClick:v,fullWidth:!0,disabled:!n.name.trim()||!n.prefix.trim()||!n.baseUrl.trim()||d,children:d?"Saving...":"Save"}),(0,i.jsx)(p.$n,{onClick:r,variant:"ghost",fullWidth:!0,children:"Cancel"})]})]})}):null}K.propTypes={isOpen:l().bool.isRequired,provider:l().string,providerName:l().string,isCompatible:l().bool,isAnthropic:l().bool,authType:l().string,authHint:l().string,website:l().string,proxyPools:l().arrayOf(l().shape({id:l().string,name:l().string})),error:l().string,existingNames:l().arrayOf(l().string),onSave:l().func.isRequired,onBulkDone:l().func,onClose:l().func.isRequired},F.propTypes={isOpen:l().bool.isRequired,node:l().shape({id:l().string,name:l().string,prefix:l().string,apiType:l().string,baseUrl:l().string}),onSave:l().func.isRequired,onClose:l().func.isRequired,isAnthropic:l().bool};let J=()=>Object.fromEntries(Object.keys(h.bs).map(e=>[e,!1]));function W({isOpen:e,providerAlias:t,providerDisplayAlias:s,onSave:r,onClose:l}){let[n,o]=(0,a.useState)(""),[d,c]=(0,a.useState)(J),[m,u]=(0,a.useState)(null),[x,f]=(0,a.useState)(""),[g,y]=(0,a.useState)(!1),[b,v]=(0,a.useState)("");(0,a.useEffect)(()=>{e&&(o(""),c(J()),v(""),u(null),f(""))},[e]);let j=e=>{let s=`${t}/`;return e.startsWith(s)?e.slice(s.length):e},w=async()=>{let e=j(n.trim());if(e){u("testing"),f("");try{let s=await fetch("/api/models/test",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({model:`${t}/${e}`})}),i=await s.json();u(i.ok?"ok":"error"),f(i.error||"")}catch(e){u("error"),f(e.message)}}},k=async()=>{let e=j(n.trim());if(e&&!g){y(!0);try{await r(e,d,d.stt?b:null)}finally{y(!1)}}};return(0,i.jsx)(p.aF,{isOpen:e,onClose:l,title:"Add Custom Model",children:(0,i.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,i.jsxs)("div",{children:[(0,i.jsx)("label",{className:"text-sm font-medium mb-1.5 block",children:"Model ID"}),(0,i.jsxs)("div",{className:"flex gap-2",children:[(0,i.jsx)("input",{type:"text",value:n,onChange:e=>{o(e.target.value),u(null),f("")},onKeyDown:e=>{"Enter"===e.key&&w()},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,i.jsx)(p.$n,{variant:"secondary",icon:"science",loading:"testing"===m,onClick:w,disabled:!n.trim()||"testing"===m,children:"testing"===m?"Testing...":"Test"})]}),(0,i.jsxs)("p",{className:"text-xs text-text-muted mt-1",children:["Sent to provider as: ",(0,i.jsx)("code",{className:"font-mono bg-sidebar px-1 rounded",children:j(n.trim())||"model-id"})]})]}),(0,i.jsxs)("div",{children:[(0,i.jsx)("label",{className:"text-sm font-medium mb-1.5 block",children:"Capabilities"}),(0,i.jsx)("div",{className:"flex flex-wrap gap-4",children:Object.entries(h.bs).map(([e,t])=>(0,i.jsx)(p.lM,{checked:!!d[e],onChange:t=>c(s=>({...s,[e]:t})),label:t.label,description:t.desc,size:"sm"},e))})]}),(0,i.jsxs)("div",{children:[(0,i.jsx)(p.lM,{checked:!!d.stt,onChange:e=>{c(t=>({...t,stt:e})),e||v("")},label:"Speech to text",description:"Transcribes audio via /v1/audio/transcriptions",size:"sm"}),d.stt&&(0,i.jsx)("div",{className:"mt-3",children:(0,i.jsx)(p.l6,{label:"Transport",value:b,onChange:e=>v(e.target.value),placeholder:"Provider default (REST)",options:h.vp.map(e=>({value:e,label:h.qw[e].label})),hint:"Realtime transport marker for the STT dispatcher. Empty keeps the provider's REST format."})})]}),"ok"===m&&(0,i.jsxs)("div",{className:"flex items-center gap-2 text-sm text-green-600",children:[(0,i.jsx)("span",{className:"material-symbols-outlined text-base",children:"check_circle"}),"Model is reachable"]}),"error"===m&&(0,i.jsxs)("div",{className:"flex items-start gap-2 text-sm text-red-500",children:[(0,i.jsx)("span",{className:"material-symbols-outlined text-base shrink-0",children:"cancel"}),(0,i.jsx)("span",{children:x||"Model not reachable"})]}),(0,i.jsxs)("div",{className:"flex gap-2 pt-1",children:[(0,i.jsx)(p.$n,{onClick:l,variant:"ghost",fullWidth:!0,size:"sm",children:"Cancel"}),(0,i.jsx)(p.$n,{onClick:k,fullWidth:!0,size:"sm",disabled:!n.trim()||g,children:g?"Adding...":"Add Model"})]})]})})}W.propTypes={isOpen:l().bool.isRequired,providerAlias:l().string.isRequired,providerDisplayAlias:l().string.isRequired,onSave:l().func.isRequired,onClose:l().func.isRequired};let H=`[
|
|
8
|
-
{
|
|
9
|
-
"accessToken": "eyJhbGc...",
|
|
10
|
-
"refreshToken": "rt_...",
|
|
11
|
-
"idToken": "eyJhbGc...",
|
|
12
|
-
"email": "user@example.com"
|
|
13
|
-
}
|
|
14
|
-
]`;function B({isOpen:e,onClose:t,onSuccess:s}){let[r,l]=(0,a.useState)(""),[n,o]=(0,a.useState)(!1),[d,c]=(0,a.useState)(""),[m,u]=(0,a.useState)(null),x=()=>{n||(l(""),c(""),u(null),t())},h=async()=>{var e;let t;c(""),u(null);let i=r.trim();if(!i)return;try{t=JSON.parse(i)}catch(e){c(`${(0,O.Tl)("Invalid JSON")}: ${e.message}`);return}let a=Array.isArray(e=t)?e:e&&"object"==typeof e?Array.isArray(e.accounts)?e.accounts:[e]:null;if(!a||0===a.length)return void c((0,O.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:a})}),t=await e.json();if(!e.ok)return void c(t?.error||`Request failed: ${e.status}`);u(t),t.success>0&&"function"==typeof s&&s()}catch(e){c(e.message||(0,O.Tl)("Request failed"))}finally{o(!1)}},f=m?.results?.filter(e=>!e.ok)||[];return(0,i.jsx)(p.aF,{isOpen:e,title:(0,O.Tl)("Bulk Add Codex Accounts"),onClose:x,children:(0,i.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,i.jsx)("p",{className:"text-xs text-text-muted",children:(0,O.Tl)("Paste an array of codex account JSON objects. Each must include accessToken (and ideally refreshToken, idToken).")}),(0,i.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:H,value:r,onChange:e=>l(e.target.value),disabled:n}),d&&(0,i.jsx)("p",{className:"text-xs text-red-500 break-words",children:d}),m&&(0,i.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,i.jsxs)("div",{className:`text-sm font-medium ${m.failed>0?"text-yellow-400":"text-green-400"}`,children:["✓ ",m.success," ",(0,O.Tl)("added"),m.failed>0?`, ✗ ${m.failed} ${(0,O.Tl)("failed")}`:""]}),f.length>0&&(0,i.jsx)("ul",{className:"rounded border border-accent/20 bg-sidebar/50 p-2 text-xs font-mono max-h-40 overflow-y-auto",children:f.map(e=>(0,i.jsxs)("li",{className:"text-red-400",children:["[",e.index,"] ",e.error]},e.index))})]}),(0,i.jsxs)("div",{className:"flex gap-2",children:[(0,i.jsx)(p.$n,{onClick:h,fullWidth:!0,disabled:n||!r.trim(),children:n?(0,O.Tl)("Importing..."):(0,O.Tl)("Import All")}),(0,i.jsx)(p.$n,{onClick:x,variant:"ghost",fullWidth:!0,disabled:n,children:(0,O.Tl)("Close")})]})]})})}B.propTypes={isOpen:l().bool.isRequired,onClose:l().func.isRequired,onSuccess:l().func};let G=`[
|
|
15
|
-
{
|
|
16
|
-
"access_token": "eyJ0eXAiOiJhdCtqd3Qi...",
|
|
17
|
-
"refresh_token": "LZhriF9bf88pPykpXCuZ9...",
|
|
18
|
-
"id_token": "eyJ0eXAiOiJKV1QiLCJhbGci...",
|
|
19
|
-
"email": "account1@example.com"
|
|
20
|
-
},
|
|
21
|
-
{
|
|
22
|
-
"access_token": "eyJ0eXAiOiJhdCtqd3Qi...",
|
|
23
|
-
"refresh_token": "LZhriF9bf88pPykpXCuZ9...",
|
|
24
|
-
"id_token": "eyJ0eXAiOiJKV1QiLCJhbGci...",
|
|
25
|
-
"email": "account2@example.com"
|
|
26
|
-
}
|
|
27
|
-
]`;function Z(e){let t,s=e.trim();if(!s)return[];try{t=JSON.parse(s)}catch(e){try{let e=s;e.startsWith("[")||((e=e.replace(/\}\s*,\s*\{/g,"},{").replace(/\}\s*\{/g,"},{")).endsWith(",")&&(e=e.slice(0,-1)),e=`[${e}]`),t=JSON.parse(e)}catch{throw e}}if(Array.isArray(t))return t;if(t&&"object"==typeof t)return Array.isArray(t.accounts)?t.accounts:[t];throw Error("Input must be a JSON object or array of objects")}function V({isOpen:e,onClose:t,onSuccess:s}){let[r,l]=(0,a.useState)(""),[n,o]=(0,a.useState)(!1),[d,c]=(0,a.useState)(""),[m,u]=(0,a.useState)(null),[x,h]=(0,a.useState)(!1),[f,g]=(0,a.useState)(null),y=(0,a.useRef)(null),b=()=>{n||(l(""),c(""),u(null),g(null),h(!1),t())},v=async e=>{if(!e||0===e.length)return;c("");let t=Array.from(e).filter(e=>e.name.endsWith(".json")||"application/json"===e.type||""===e.type);if(0===t.length)return void c((0,O.Tl)("Please select valid .json files"));try{let e=[];for(let s of t){let t=await s.text(),i=Z(t);Array.isArray(i)?e.push(...i):i&&e.push(i)}if(0===e.length)return void c((0,O.Tl)("No accounts found in selected files"));l(JSON.stringify(e,null,2)),g({filesCount:t.length,accountsCount:e.length})}catch(e){c(`${(0,O.Tl)("Error reading files")}: ${e.message}`)}},j=async()=>{let e;c(""),u(null);try{e=Z(r)}catch(e){c(`${(0,O.Tl)("Invalid JSON")}: ${e.message}`);return}if(!e||0===e.length)return void c((0,O.Tl)("No accounts found in input"));o(!0);try{let t=await fetch("/api/oauth/grok-cli/bulk-import",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({accounts:e})}),i=await t.json();if(!t.ok)return void c(i?.error||`Request failed: ${t.status}`);u(i),i.success>0&&"function"==typeof s&&s()}catch(e){c(e.message||(0,O.Tl)("Request failed"))}finally{o(!1)}},w=m?.results?.filter(e=>!e.ok)||[];return(0,i.jsx)(p.aF,{isOpen:e,title:(0,O.Tl)("Bulk Add Grok CLI Accounts"),onClose:b,children:(0,i.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,i.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[(0,i.jsx)("p",{className:"text-xs text-text-muted",children:(0,O.Tl)("Upload multiple .json files or paste JSON array / object.")}),(0,i.jsx)("input",{ref:y,type:"file",accept:".json,application/json",multiple:!0,className:"hidden",onChange:e=>{v(e.target.files),e.target&&(e.target.value="")}}),(0,i.jsx)(p.$n,{type:"button",size:"sm",variant:"secondary",icon:"upload_file",onClick:()=>y.current?.click(),disabled:n,children:(0,O.Tl)("Upload JSON Files")})]}),(0,i.jsxs)("div",{onDragOver:e=>{e.preventDefault(),h(!0)},onDragLeave:e=>{e.preventDefault(),h(!1)},onDrop:e=>{e.preventDefault(),h(!1),e.dataTransfer?.files?.length>0&&v(e.dataTransfer.files)},className:`relative rounded border transition-colors ${x?"border-primary bg-primary/10 ring-2 ring-primary/30":"border-accent/30 bg-sidebar"}`,children:[(0,i.jsx)("textarea",{className:"w-full rounded bg-transparent p-2.5 text-sm font-mono resize-y min-h-[240px] focus:outline-none focus:ring-1 focus:ring-primary",placeholder:G,value:r,onChange:e=>{l(e.target.value),g(null)},disabled:n}),x&&(0,i.jsxs)("div",{className:"absolute inset-0 flex flex-col items-center justify-center bg-sidebar/90 rounded pointer-events-none backdrop-blur-xs",children:[(0,i.jsx)("span",{className:"material-symbols-outlined text-3xl text-primary mb-1",children:"upload_file"}),(0,i.jsx)("span",{className:"text-sm font-medium text-primary",children:(0,O.Tl)("Drop .json files here")})]})]}),f&&(0,i.jsxs)("div",{className:"flex items-center gap-1.5 text-xs text-green-400 font-medium bg-green-500/10 border border-green-500/20 px-2.5 py-1.5 rounded",children:[(0,i.jsx)("span",{className:"material-symbols-outlined text-sm",children:"check_circle"}),(0,i.jsxs)("span",{children:[(0,O.Tl)("Loaded")," ",f.accountsCount," ",(0,O.Tl)("account(s) from")," ",f.filesCount," ",(0,O.Tl)("file(s)")]})]}),d&&(0,i.jsx)("p",{className:"text-xs text-red-500 break-words",children:d}),m&&m.failed>0&&(0,i.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,i.jsxs)("div",{className:"text-sm font-medium text-yellow-400",children:["✗ ",m.failed," ",(0,O.Tl)("failed")]}),w.length>0&&(0,i.jsx)("ul",{className:"rounded border border-accent/20 bg-sidebar/50 p-2 text-xs font-mono max-h-40 overflow-y-auto",children:w.map(e=>(0,i.jsxs)("li",{className:"text-red-400",children:["[",e.index,"] ",e.error]},e.index))})]}),(0,i.jsxs)("div",{className:"flex gap-2",children:[(0,i.jsx)(p.$n,{onClick:j,fullWidth:!0,disabled:n||!r.trim(),children:n?(0,O.Tl)("Importing..."):(0,O.Tl)("Import All")}),(0,i.jsx)(p.$n,{onClick:b,variant:"ghost",fullWidth:!0,disabled:n,children:(0,O.Tl)("Close")})]})]})})}var Q=s(65921);let X=["host","content-length","content-type","connection","transfer-encoding","authorization","cookie"],Y=/^[A-Za-z0-9-]+$/;function ee({providerId:e}){let t=(0,Q.i)(),[s,r]=(0,a.useState)(!1),[l,n]=(0,a.useState)([{name:"",value:""}]),[o,d]=(0,a.useState)({}),[c,m]=(0,a.useState)(!1),[u,x]=(0,a.useState)(!1);(0,a.useEffect)(()=>{let t=!1;return fetch(`/api/providers/${e}/overrides`,{cache:"no-store"}).then(e=>e.ok?e.json():null).then(e=>{if(t||!e)return;let s=e.builtinHeaders||{},i=Object.entries({...s,...e.headers||{}}).map(([e,t])=>({name:e,value:t}));d(s),n(i.length?i:[{name:"",value:""}]),m(Object.keys(e.headers||{}).length>0)}).catch(()=>{}),()=>{t=!0}},[e]);let h=(e,t,s)=>{n(i=>i.map((i,a)=>a===e?{...i,[t]:s}:i))},f=(0,a.useCallback)(async()=>{let s={};for(let e of l.filter(e=>e.name.trim())){let i=e.name.trim();if(!Y.test(i))return void t.error(`Invalid header name: ${i}`);if(X.includes(i.toLowerCase()))return void t.error(`Header ${i} cannot be overridden`);if(i in s)return void t.error(`Duplicate header name: ${i}`);e.value!==o[i]&&(s[i]=e.value)}x(!0);try{let i=await fetch(`/api/providers/${e}/overrides`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({headers:s})});if(!i.ok){let e=await i.json().catch(()=>({}));t.error(e.error||"Failed to save");return}m(Object.keys(s).length>0),t.success("Custom headers saved")}finally{x(!1)}},[l,o,e,t]);return 0!==Object.keys(o).length||c?(0,i.jsxs)(p.Zp,{padding:"xs",children:[(0,i.jsxs)("button",{type:"button",onClick:()=>r(e=>!e),className:"flex w-full items-center justify-between text-left",children:[(0,i.jsxs)("div",{className:"flex items-center gap-2",children:[(0,i.jsx)("span",{className:"material-symbols-outlined text-primary text-[20px]",children:"tune"}),(0,i.jsx)("span",{className:"font-display text-sm font-semibold text-text-main",children:"Custom Headers"}),c&&(0,i.jsx)(p.Ex,{variant:"success",size:"sm",children:"Active"})]}),(0,i.jsx)("span",{className:"material-symbols-outlined text-text-muted",children:s?"expand_less":"expand_more"})]}),s&&(0,i.jsxs)("div",{className:"mt-3 border-t border-border pt-3",children:[(0,i.jsx)("div",{className:"flex flex-col gap-2",children:l.map((e,t)=>{let s=e.name.trim()in o&&e.value!==o[e.name.trim()];return(0,i.jsxs)("div",{className:"flex items-center gap-2",children:[(0,i.jsx)("input",{value:e.name,onChange:e=>h(t,"name",e.target.value),placeholder:"Header-Name",spellCheck:!1,className:"w-44 rounded-md border border-border bg-background px-2 py-1.5 text-sm focus:border-primary focus:outline-none"}),(0,i.jsx)("input",{value:e.value,onChange:e=>h(t,"value",e.target.value),placeholder:"Value",spellCheck:!1,title:s?"Overridden":e.name.trim()in o?"Registry default":"",className:`min-w-0 flex-1 rounded-md border bg-background px-2 py-1.5 text-sm focus:border-primary focus:outline-none ${s?"border-amber-400/60":"border-border"}`}),(0,i.jsx)("button",{type:"button",title:"Remove header",onClick:()=>n(e=>e.length>1?e.filter((e,s)=>s!==t):[{name:"",value:""}]),className:"shrink-0 text-text-muted hover:text-red-500",children:(0,i.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"delete"})})]},t)})}),(0,i.jsxs)("div",{className:"mt-3 flex items-center justify-between gap-2",children:[(0,i.jsxs)("button",{type:"button",onClick:()=>n(e=>[...e,{name:"",value:""}]),className:"flex items-center gap-1 text-xs text-primary hover:underline",children:[(0,i.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"add"}),"Add header"]}),(0,i.jsxs)("div",{className:"flex gap-2",children:[(0,i.jsx)("button",{type:"button",disabled:u,onClick:()=>{n(Object.entries(o).map(([e,t])=>({name:e,value:t})))},className:"rounded-md border border-border px-3 py-1.5 text-xs hover:bg-black/[0.03] dark:hover:bg-white/[0.03] disabled:opacity-50",children:"Reset"}),(0,i.jsx)("button",{type:"button",disabled:u,onClick:f,className:"rounded-md bg-primary px-3 py-1.5 text-xs font-medium text-white hover:opacity-90 disabled:opacity-50",children:u?"Saving...":"Save"})]})]})]})]}):null}ee.propTypes={providerId:l().string.isRequired};var et=s(97132),es=s(5539);function ei({providerId:e,onConnected:t,size:s="sm"}){let[r,l]=(0,a.useState)(!1),[n,o]=(0,a.useState)(""),d=async()=>{l(!0),o("");try{let s=await fetch(`/api/oauth/${e}/lease-connect`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({})}),i=await s.json().catch(()=>({}));if(!s.ok)return void o(i.error||"Could not reach the MiniMax Code desktop app");"function"==typeof t&&t()}catch(e){o(e?.message||"Could not reach the MiniMax Code desktop app")}finally{l(!1)}};return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(p.$n,{size:s,icon:"desktop_windows",variant:"secondary",disabled:r,onClick:d,title:(0,O.Tl)("Borrow the signed-in MiniMax Code desktop app's login - no second sign-in, refresh stays with the desktop app"),children:r?(0,O.Tl)("Connecting..."):(0,O.Tl)("Use Desktop App")}),n&&(0,i.jsx)("p",{className:"w-full text-xs text-red-500 break-words",children:n})]})}ei.propTypes={providerId:l().string.isRequired,onConnected:l().func,size:l().oneOf(["sm","md","lg"])};var ea=s(93195);let er=new Set(["minimax-code","minimax-code-global"]),el={claude:"claudeAutoPing",codex:"codexAutoPing"};function en(e){let t=Object.entries(e).some(([e,t])=>e.startsWith("modelLock_")&&t&&new Date(t).getTime()>Date.now());return"unavailable"!==e.testStatus||t?e.testStatus:"active"}function eo(){let e,t,s,r,l,o=(0,n.useParams)(),f=(0,n.useRouter)(),g=o.id,{getCaps:y}=(0,$.y)(),[b,v]=(0,a.useState)([]),[j,w]=(0,a.useState)(!0),[k,N]=(0,a.useState)(null),[C,S]=(0,a.useState)([]),[P,R]=(0,a.useState)(!1),[z,M]=(0,a.useState)(!1),[q,L]=(0,a.useState)(!1),[J,H]=(0,a.useState)(!1),[G,Z]=(0,a.useState)(""),[Q,X]=(0,a.useState)(!1),[Y,eo]=(0,a.useState)(!1),[ec,em]=(0,a.useState)(!1),[ep,eu]=(0,a.useState)(!1),[ex,eh]=(0,a.useState)(!1),[ef,eg]=(0,a.useState)(null),[ey,eb]=(0,a.useState)({}),[ev,ej]=(0,a.useState)([]),[ew,ek]=(0,a.useState)(!1),[eN,eC]=(0,a.useState)({}),[eS,eA]=(0,a.useState)(""),[eT,e$]=(0,a.useState)(()=>new Set),[eO,eP]=(0,a.useState)(!1),[eI,eE]=(0,a.useState)([]),[eD,eR]=(0,a.useState)("__none__"),[e_,ez]=(0,a.useState)(!1),[eM,eq]=(0,a.useState)(null),[eU,eL]=(0,a.useState)(""),[eK,eF]=(0,a.useState)("auto"),[eJ,eW]=(0,a.useState)({enabled:!1,connections:{},schedules:{}}),[eH,eB]=(0,a.useState)(null),[eG,eZ]=(0,a.useState)([]),[eV,eQ]=(0,a.useState)([]),[eX,eY]=(0,a.useState)(null),[e0,e1]=(0,a.useState)([]),[e2,e5]=(0,a.useState)([]),[e3,e4]=(0,a.useState)(null),[e6,e8]=(0,a.useState)(!1),[e9,e7]=(0,a.useState)(!1),[te,tt]=(0,a.useState)(!1),[ts,ti]=(0,a.useState)(null),[ta,tr]=(0,a.useState)({}),[tl,tn]=(0,a.useState)(null),to=(0,a.useRef)(!1),[td,tc]=(0,a.useState)(!1),[tm,tp]=(0,a.useState)(!1),{copied:tu,copy:tx}=(0,T.C)(),th="ag_risk_confirmed",tf=()=>{R(!0)},tg=()=>{"antigravity"===g&&"true"!==window.localStorage.getItem(th)?e8(!0):"xiaomi-mimo"===g?M(!0):tw?tf():(Z(""),H(!0))},ty=()=>{Z(""),H(!0)},tb=()=>{tw?tg():ty()},tv=k?{id:k.id,name:k.name||("anthropic-compatible"===k.type?"Anthropic Compatible":"OpenAI Compatible"),color:"anthropic-compatible"===k.type?"#D97757":"#10A37F",textIcon:"anthropic-compatible"===k.type?"AC":"OC",apiType:k.apiType,baseUrl:k.baseUrl,type:k.type}:x.zN[g]||x.fg[g]||x.IS[g]||x.nJ[g]||x.br[g],tj=tv?.authModes||[],tw=!!x.zN[g]||!!x.IS[g]||tj.includes("oauth"),tk=!!x.fg[g]||tj.includes("apikey"),tN=!!x.IS[g]?.noAuth,tC=(0,h.KC)(g),tS=("cursor"===g||"zed"===g)&&eV.length>0?eV:tC,tA=(0,x.wG)(g),tT=(0,x.mq)(g),t$=(0,x.gb)(g),tO=tT||t$,tP=!tO&&tw&&tk,tI="xai"===g?"Grok Build OAuth":"grok-cli"===g?"Grok CLI Device Login":"kimi"===g?"Kimi Coding OAuth":"OAuth",tE="xai"===g?"xAI API Key":"kimi"===g?"Kimi API Key":"qoder"===g||"qoder-cn"===g?"PAT":"API Key",tD=e=>{if(!eK||"auto"===eK)return null;let t=A(g,e);return t&&t.includes(eK)?eK:null},tR=tO?g:tA,t_=(()=>{let e=new Set,t=new Set,s=s=>{if(!s||t.has(s))return;t.add(s);let i=A(g,s);i&&i.forEach(t=>{"none"!==t&&e.add(t)})};for(let e of tS)s(e.id);for(let e of e0)s(e.id);for(let e of ev)e.providerAlias===tR&&"llm"===(e.kind||e.type||"llm")&&s(e.id);return e.size?["auto",...e]:null})(),tz=tO?k?.prefix||g:tA,tM=(0,a.useCallback)(async()=>{try{let e=await fetch(`/api/models/disabled?providerAlias=${encodeURIComponent(tR)}`,{cache:"no-store"}),t=await e.json();e.ok&&e5(t.ids||[])}catch(e){console.log("Error fetching disabled models:",e)}},[tR]),tq=async e=>{try{(await fetch("/api/models/disabled",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({providerAlias:tR,ids:[e]})})).ok&&await tM()}catch(e){console.log("Error disabling model:",e)}},tU=async e=>{try{(await fetch(`/api/models/disabled?providerAlias=${encodeURIComponent(tR)}&id=${encodeURIComponent(e)}`,{method:"DELETE"})).ok&&await tM()}catch(e){console.log("Error enabling model:",e)}},tL=async e=>{e.length&&e4({title:"Disable All Models",message:`Disable all ${e.length} model(s)?`,onConfirm:async()=>{e4(null);try{(await fetch("/api/models/disabled",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({providerAlias:tR,ids:e})})).ok&&await tM()}catch(e){console.log("Error disabling all models:",e)}}})},tK=async()=>{try{(await fetch(`/api/models/disabled?providerAlias=${encodeURIComponent(tR)}`,{method:"DELETE"})).ok&&await tM()}catch(e){console.log("Error enabling all models:",e)}},tF=(0,a.useCallback)(async()=>{try{let e=await fetch("/api/models/alias"),t=await e.json();e.ok&&eb(t.aliases||{})}catch(e){console.log("Error fetching aliases:",e)}},[]),tJ=(0,a.useCallback)(async()=>{try{let e=await fetch("/api/models/custom",{cache:"no-store"}),t=await e.json();e.ok&&ej(t.models||[])}catch(e){console.log("Error fetching custom models:",e)}},[]);(0,a.useEffect)(()=>{"kilocode"===g&&fetch("/api/providers/kilo/free-models").then(e=>e.json()).then(e=>{e.models?.length&&e1(e.models)}).catch(()=>{})},[g]);let tW=(0,a.useCallback)(async()=>{try{let[e,t,s,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"})]),a=await e.json(),r=await t.json(),l=await s.json(),n=i.ok?await i.json():{};if(e.ok){let e=(a.connections||[]).filter(e=>e.provider===g);v(e)}s.ok&&S(l.proxyPools||[]);let o=(n.providerStrategies||{})[g]||{};eq(o.fallbackStrategy||null),eL(null!=o.stickyRoundRobinLimit?String(o.stickyRoundRobinLimit):"1");let d=(n.providerThinking||{})[g]||{};eF(d.mode||"auto");let c=el[g],m=c&&n[c]||{};if(eW({enabled:!0===m.enabled,connections:m.connections||{},schedules:m.schedules||{}}),t.ok){let e=(r.nodes||[]).find(e=>e.id===g)||null;if(!e&&tO)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===g)||null))break}N(e)}}catch(e){console.log("Error fetching connections:",e)}finally{w(!1)}},[g,tO]),tH=async e=>{try{let t=await fetch(`/api/provider-nodes/${g}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}),s=await t.json();t.ok&&(N(s.node),await tW(),eu(!1))}catch(e){console.log("Error updating provider node:",e)}},tB=async(e,t)=>{try{let s=await fetch("/api/settings",{cache:"no-store"}),i=(s.ok?await s.json():{}).providerStrategies||{},a={};e&&(a.fallbackStrategy=e),"round-robin"===e&&""!==t&&(a.stickyRoundRobinLimit=Number(t)||3);let r={...i};0===Object.keys(a).length?delete r[g]:r[g]=a,await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({providerStrategies:r})})}catch(e){console.log("Error saving provider strategy:",e)}},tG=async e=>{try{let t=await fetch("/api/settings",{cache:"no-store"}),s={...(t.ok?await t.json():{}).providerThinking||{}};e&&"auto"!==e?s[g]={mode:e}:delete s[g],await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({providerThinking:s})})}catch(e){console.log("Error saving thinking config:",e)}},tZ=async e=>{let t=el[g];if(t){eW(e);try{await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({[t]:e})})}catch(e){console.log("Error saving auto-ping config:",e)}}};(0,a.useEffect)(()=>{tW(),tF(),tJ(),tM()},[tW,tF,tJ,tM]),(0,a.useEffect)(()=>{if("cursor"!==g&&"zed"!==g)return void eQ([]);let e=b.find(e=>!1!==e.isActive);if(!e?.id){eQ([]),"zed"===g&&eY(null);return}let t=!1;return"zed"===g&&eY(null),fetch(`/api/providers/${e.id}/models`,{cache:"no-store"}).then(async e=>({ok:e.ok,data:await e.json().catch(()=>null)})).then(({ok:e,data:s})=>{if(!t){if(e&&Array.isArray(s?.models)&&s.models.length>0){eQ(s.models),"zed"===g&&s?.warning&&eY(s.warning);return}"zed"===g&&(eQ([]),eY(s?.warning||s?.error||"Zed returned no live models."))}}).catch(()=>{t||"zed"!==g||(eQ([]),eY("Failed to reach the Zed model catalog."))}),()=>{t=!0}},[g,b]),(0,a.useEffect)(()=>{let e=(x.zN[g]||x.fg[g]||x.IS[g]||x.nJ[g])?.modelsFetcher;e&&I(e).then(eZ)},[g]);let tV=async(e,t,s=tA)=>{let i=`${s}/${e}`;try{let e=await fetch("/api/models/alias",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({model:i,alias:t})});if(e.ok)await tF();else{let t=await e.json();alert(t.error||"Failed to set alias")}}catch(e){console.log("Error setting alias:",e)}},tQ=async e=>{try{(await fetch(`/api/models/alias?alias=${encodeURIComponent(e)}`,{method:"DELETE"})).ok&&await tF()}catch(e){console.log("Error deleting alias:",e)}},tX=async(e,t="llm",s=tR,i,a)=>{try{let r=await fetch("/api/models/custom",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({providerAlias:s,id:e,type:t,...i?{caps:i}:{},...a?{transport:a}:{}})});if(r.ok)await tJ(),window.dispatchEvent(new CustomEvent("customModelChanged"));else{let e=await r.json();alert(e.error||"Failed to add custom model")}}catch(e){console.log("Error adding custom model:",e)}},tY=async(e,t="llm",s=tR)=>{try{let i=new URLSearchParams({providerAlias:s,id:e,type:t});(await fetch(`/api/models/custom?${i}`,{method:"DELETE"})).ok&&(await tJ(),window.dispatchEvent(new CustomEvent("customModelChanged")))}catch(e){console.log("Error deleting custom model:",e)}},t0=async()=>{if(td)return;let e=b.find(e=>!1!==e.isActive);if(!e)return void alert((0,O.Tl)("Please add an active Qoder connection first"));tc(!0);try{let t=await fetch(`/api/providers/${e.id}/models`),s=await t.json();if(!t.ok)return void alert(s.error||(0,O.Tl)("Failed to fetch models"));let i=s.models||[];if(0===i.length)return void alert((0,O.Tl)("No models returned"));let a=0;for(let e of i){let t=e.id||e.name;if(!t)continue;let s=t.replace(/^(qoder-cn|qoder)\//,"");ev.some(e=>e.providerAlias===tR&&e.id===s&&"llm"===(e.kind||e.type||"llm"))||Object.values(ey).includes(`${tR}/${s}`)||(await tX(s,"llm",tR),a+=1)}0===a?alert((0,O.Tl)("All models already exist, no new models added")):alert((0,O.Tl)("Successfully added")+` ${a} `+(0,O.Tl)("models"))}catch(e){console.log("Error importing Qoder models:",e),alert((0,O.Tl)("Error fetching models")+": "+e.message)}finally{tc(!1)}},t1=async()=>{if(tm)return;let e=b.find(e=>!1!==e.isActive);if(!e)return void alert((0,O.Tl)("Please add an active Cline connection first"));tp(!0);try{let t=await fetch(`/api/providers/${e.id}/models`),s=await t.json();if(!t.ok)return void alert(s.error||(0,O.Tl)("Failed to fetch models"));let i=s.models||[];if(0===i.length)return void alert((0,O.Tl)("No models returned"));let a=0;for(let e of i){let t=e.id||e.name;t&&(ev.some(e=>e.providerAlias===tR&&e.id===t&&"llm"===(e.kind||e.type||"llm"))||Object.values(ey).includes(`${tR}/${t}`)||(await tX(t,"llm",tR),a+=1))}0===a?alert((0,O.Tl)("All models already exist, no new models added")):alert((0,O.Tl)("Successfully added")+` ${a} `+(0,O.Tl)("models"))}catch(e){console.log("Error importing Cline models:",e),alert((0,O.Tl)("Error fetching models")+": "+e.message)}finally{tp(!1)}},t2=async()=>{if(e9||0===b.length)return;let e=Object.fromEntries(b.map(e=>[e.id,{state:"queued",error:null}]));to.current=!1,e7(!0),tt(!1),ti(null),tr(e),tn({total:b.length,completed:0,passed:0,failed:0,stopped:!1});let t=0,s=0;try{for(let e=0;e<b.length;e+=1){if(to.current){tn({total:b.length,completed:e,passed:t,failed:s,stopped:!0});break}let i=b[e];ti(i.id),tr(e=>({...e,[i.id]:{state:"testing",error:null}}));try{let e=await fetch(`/api/providers/${i.id}/test`,{method:"POST"}),a=await e.json(),r=!!a.valid;r?t+=1:s+=1,tr(e=>({...e,[i.id]:{state:r?"success":"failed",error:r?null:a.error||null}}))}catch(e){s+=1,tr(t=>({...t,[i.id]:{state:"failed",error:e.message||"Test failed"}}))}tn({total:b.length,completed:e+1,passed:t,failed:s,stopped:!1}),e<b.length-1&&await new Promise(e=>setTimeout(e,1e3))}}finally{ti(null),e7(!1),tt(!1),to.current=!1}},t5=async e=>{e4({title:"Delete Connection",message:"Delete this connection?",onConfirm:async()=>{e4(null);try{(await fetch(`/api/providers/${e}`,{method:"DELETE"})).ok&&v(t=>t.filter(t=>t.id!==e))}catch(e){console.log("Error deleting connection:",e)}}})},t3=()=>{tW(),R(!1)},t4=async e=>{Z("");try{let t=await fetch("/api/providers",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:g,...e})}),s=null;try{s=await t.json()}catch{s=null}if(t.ok){await tW(),H(!1);return}Z(s?.error||"Failed to save connection")}catch(e){console.log("Error saving connection:",e),Z("Failed to save connection")}},t6=async e=>{try{(await fetch(`/api/providers/${ef.id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})).ok&&(await tW(),em(!1))}catch(e){console.log("Error updating connection:",e)}},t8=async(e,t)=>{try{(await fetch(`/api/providers/${e}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({isActive:t})})).ok&&v(s=>s.map(s=>s.id===e?{...s,isActive:t}:s))}catch(e){console.log("Error updating connection status:",e)}},t9=async(e,t)=>{let s=[...b];[s[e],s[t]]=[s[t],s[e]],v(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 tW()}},t7=b.filter(e=>eI.includes(e.id)),se=b.length>0&&eI.length===b.length;(0,a.useEffect)(()=>{eE(e=>e.filter(e=>b.some(t=>t.id===e)))},[b]),(()=>{if(0===t7.length)return;let e=new Set(t7.map(e=>e.providerSpecificData?.proxyPoolId||"__none__"));if(1===e.size){let t=[...e][0];if("__none__"===t)return;let s=C.find(e=>e.id===t);return s?.name}})();let st=()=>{e_||eh(!1)},ss=async e=>{ez(!0);try{let t=0;for(let{connectionId:s,proxyPoolId:i}of e)try{(await fetch(`/api/providers/${s}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({proxyPoolId:i})})).ok||(t+=1)}catch(e){console.log("Error applying proxy for",s,e),t+=1}t>0&&alert(`Updated with ${t} failed request(s).`),await tW(),eh(!1)}finally{ez(!1)}},si=e=>ss(b.map(t=>({connectionId:t.id,proxyPoolId:e}))),sa=(0,i.jsx)("div",{className:"flex min-w-0 flex-col divide-y divide-black/[0.03] dark:divide-white/[0.03] max-h-[500px] overflow-y-auto pr-1",children:b.map((e,t)=>{let s;return(0,i.jsxs)("div",{className:"flex min-w-0 items-stretch",children:[(0,i.jsx)("div",{className:"flex shrink-0 items-center pl-1 sm:pl-2",children:(0,i.jsx)("input",{type:"checkbox",checked:(s=e.id,eI.includes(s)),onChange:()=>{var t;return t=e.id,void eE(e=>e.includes(t)?e.filter(e=>e!==t):[...e,t])},className:"h-4 w-4 rounded border-gray-300 text-primary focus:ring-primary"})}),(0,i.jsx)("div",{className:"flex-1 min-w-0 ml-2 sm:ml-4",children:(0,i.jsx)(U,{connection:e,proxyPools:C,isOAuth:tw,isFirst:0===t,isLast:t===b.length-1,onMoveUp:()=>t9(t,t-1),onMoveDown:()=>t9(t,t+1),onToggleActive:t=>t8(e.id,t),autoPing:el[g]&&"oauth"===e.authType?{isActive:!0===eJ.connections[e.id]||eJ.schedules?.[e.id]?.enabled===!0,reactiveOn:!0===eJ.connections[e.id],provider:g,scheduleOn:eJ.schedules?.[e.id]?.enabled===!0,scheduleSummary:(0,ea.JW)(eJ.schedules?.[e.id]).join(" / "),onConfigure:()=>eB(e)}:null,onUpdateProxy:async t=>{try{(await fetch(`/api/providers/${e.id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({proxyPoolId:t||null})})).ok&&v(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:()=>{eg(e),em(!0)},onDelete:()=>t5(e.id),oneByOneStatus:ta[e.id]||null})})]},e.id)})}),sr=C.filter(e=>!0===e.isActive),sl=(0,i.jsx)(p.aF,{isOpen:ex,onClose:st,title:`Apply Proxy (${b.length} connections)`,children:(0,i.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,i.jsxs)("div",{className:"flex flex-col",children:[(0,i.jsxs)("button",{onClick:()=>{let e=C.filter(e=>!0===e.isActive);return 0===e.length?void alert("No active proxy pools available."):ss(b.map((t,s)=>({connectionId:t.id,proxyPoolId:e[s%e.length].id})))},disabled:e_||0===sr.length,className:"flex items-center gap-2 rounded-lg px-3 py-2 text-left transition-colors hover:bg-black/[0.04] dark:hover:bg-white/[0.04] disabled:cursor-not-allowed disabled:opacity-50",children:[(0,i.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[18px]",children:"sync_alt"}),(0,i.jsx)("span",{className:"text-sm text-text-main",children:"One-to-one (rotate)"})]}),(0,i.jsxs)("button",{onClick:()=>si(null),disabled:e_,className:"flex items-center gap-2 rounded-lg px-3 py-2 text-left transition-colors hover:bg-black/[0.04] dark:hover:bg-white/[0.04] disabled:cursor-not-allowed disabled:opacity-50",children:[(0,i.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[18px]",children:"link_off"}),(0,i.jsx)("span",{className:"text-sm text-text-main",children:"None (unbind all)"})]}),C.map(e=>(0,i.jsxs)("button",{onClick:()=>si(e.id),disabled:e_||!0!==e.isActive,className:"flex items-center gap-2 rounded-lg px-3 py-2 text-left transition-colors hover:bg-black/[0.04] dark:hover:bg-white/[0.04] disabled:cursor-not-allowed disabled:opacity-50",children:[(0,i.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[18px]",children:"lan"}),(0,i.jsx)("span",{className:"truncate text-sm text-text-main",children:e.name}),!0!==e.isActive&&(0,i.jsx)("span",{className:"text-[10px] text-text-muted",children:"(inactive)"})]},e.id))]}),e_&&(0,i.jsx)("p",{className:"text-xs text-text-muted",children:"Applying..."}),(0,i.jsx)(p.$n,{onClick:st,variant:"ghost",fullWidth:!0,disabled:e_,children:"Cancel"})]})}),sn=async e=>{if(!eT.has(e)){e$(t=>new Set(t).add(e));try{let t=await fetch("/api/models/test",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({model:`${tR}/${e}`})}),s=await t.json();eC(t=>({...t,[e]:s.ok?"ok":"error"})),eA(s.ok?"":s.error||"Model not reachable")}catch{eC(t=>({...t,[e]:"error"})),eA("Network error")}finally{e$(t=>{let s=new Set(t);return s.delete(e),s})}}};if(j)return(0,i.jsxs)("div",{className:"flex flex-col gap-8",children:[(0,i.jsx)(p.Qv,{}),(0,i.jsx)(p.Qv,{})]});if(!tv)return(0,i.jsxs)("div",{className:"text-center py-20",children:[(0,i.jsx)("p",{className:"text-text-muted",children:"Provider not found"}),(0,i.jsx)(d(),{href:"/dashboard/providers",className:"text-primary mt-4 inline-block",children:"Back to Providers"})]});let so=()=>tT&&tv.apiType?"responses"===tv.apiType?"/providers/oai-r.png":"/providers/oai-cc.png":t$?"/providers/anthropic-m.png":(0,m.HY)(tv.id),sd={total:b.length,connected:b.filter(e=>{let t=en(e);return"active"===t||"success"===t}).length,errors:b.filter(e=>{let t=en(e);return"error"===t||"expired"===t||"unavailable"===t}).length,active:b.filter(e=>!1!==e.isActive).length};return(0,i.jsxs)("div",{className:"flex min-w-0 flex-col gap-6 px-1 sm:gap-8 sm:px-0",children:[(0,i.jsxs)("div",{className:"min-w-0",children:[(0,i.jsxs)(d(),{href:"/dashboard/providers",className:"mb-4 inline-flex h-8 items-center gap-1.5 rounded-lg border border-border bg-surface pl-1.5 pr-3 text-sm font-display font-medium text-text-main transition-colors hover:border-text-subtle hover:bg-surface-2",children:[(0,i.jsx)("span",{className:"material-symbols-outlined text-[17px] text-text-muted",children:"arrow_back"}),"Back to Providers"]}),(0,i.jsx)("div",{className:"relative overflow-hidden rounded-xl border border-border-subtle bg-surface/60",children:(0,i.jsxs)("div",{className:"flex items-center gap-4 p-4 sm:p-5",children:[(0,i.jsx)("div",{className:"grid size-14 shrink-0 place-items-center rounded-xl border border-border bg-surface-2 sm:size-16",style:{backgroundColor:`${tv.color}12`},children:ew||!so()?(0,i.jsx)("span",{className:"text-lg font-bold sm:text-xl",style:{color:tv.color},children:tv.textIcon||tv.id.slice(0,2).toUpperCase()}):(0,i.jsx)(c.A,{src:so(),alt:tv.name,width:56,height:56,className:"max-h-14 max-w-14 rounded-lg object-contain sm:max-h-16 sm:max-w-16",sizes:"56px",onError:()=>{(0,m.Kw)(tv.id),ek(!0)},loading:"lazy",decoding:"async"})}),(0,i.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,i.jsxs)("div",{className:"flex items-center gap-2 flex-wrap",children:[(0,i.jsx)("h1",{className:"truncate font-display text-2xl font-bold tracking-tight sm:text-3xl",children:tv.name}),(0,i.jsx)(p.Ex,{variant:"default",size:"sm",children:tO?"Compatible":tN?"Free":tk&&tw?"Dual Auth":tw?"OAuth":"API Key"})]}),(0,i.jsxs)("p",{className:"mt-1 text-sm text-text-muted",children:[sd.total," connection",1===sd.total?"":"s",sd.total>0&&` \xb7 ${sd.connected} connected`]}),(tv.notice?.apiKeyUrl||tv.notice?.signupUrl||tv.website)&&(0,i.jsxs)("a",{href:tv.notice?.apiKeyUrl||tv.notice?.signupUrl||tv.website,target:"_blank",rel:"noopener noreferrer",className:"mt-2 inline-flex items-center gap-1 text-xs text-primary hover:underline",children:[(0,i.jsx)("span",{className:"material-symbols-outlined text-sm",children:"open_in_new"}),tv.notice?.apiKeyUrl?"Get API Key":"Sign up / Learn more"]})]})]})})]}),(0,i.jsxs)("div",{className:"grid grid-cols-2 gap-3 lg:grid-cols-4",children:[(0,i.jsx)(ed,{icon:"hub",label:"Total koneksi",value:sd.total}),(0,i.jsx)(ed,{icon:"check_circle",label:"Connected",value:sd.connected,tone:"success"}),(0,i.jsx)(ed,{icon:"error",label:"Error",value:sd.errors,tone:"danger"}),(0,i.jsx)(ed,{icon:"toggle_on",label:"Aktif",value:sd.active,sub:sd.total>0?`dari ${sd.total} koneksi`:null})]}),tv.deprecated&&(0,i.jsxs)("div",{className:"flex items-center gap-2.5 rounded-lg border border-danger/25 bg-danger/5 px-3 py-2.5",children:[(0,i.jsx)("span",{className:"material-symbols-outlined text-[16px] text-danger shrink-0",children:"warning"}),(0,i.jsx)("p",{className:"text-xs text-danger leading-relaxed",children:tv.deprecationNotice})]}),tv.notice?.text&&!tv.deprecated&&(0,i.jsxs)("div",{className:"flex flex-col gap-2.5 rounded-lg border border-border bg-surface-2/60 px-3 py-2.5 sm:flex-row sm:items-center",children:[(0,i.jsx)("span",{className:"material-symbols-outlined text-[16px] text-text-muted shrink-0",children:"info"}),(0,i.jsx)("p",{className:"min-w-0 flex-1 text-xs leading-relaxed text-text-muted",children:tv.notice.text}),tv.notice.apiKeyUrl&&(0,i.jsx)("a",{href:tv.notice.apiKeyUrl,target:"_blank",rel:"noopener noreferrer",className:"inline-flex h-7 items-center justify-center rounded-lg bg-primary px-3 text-xs font-display font-medium text-white transition-colors hover:bg-primary-hover sm:py-0",children:"Get API Key →"})]}),tO&&k&&(0,i.jsx)(p.Zp,{children:(0,i.jsxs)("div",{className:"mb-4 flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between",children:[(0,i.jsxs)("div",{className:"min-w-0",children:[(0,i.jsx)("h2",{className:"font-display text-lg font-semibold text-text-main",children:t$?"Anthropic Compatible Details":"OpenAI Compatible Details"}),(0,i.jsxs)("p",{className:"mt-0.5 break-all font-mono text-xs text-text-muted",children:[t$?"Messages API":"responses"===k.apiType?"Responses API":"Chat Completions"," \xb7 ",(k.baseUrl||"").replace(/\/$/,""),"/",t$?"messages":"responses"===k.apiType?"responses":"chat/completions"]})]}),(0,i.jsxs)("div",{className:"grid grid-cols-1 gap-2 sm:flex sm:items-center",children:[(0,i.jsx)(p.$n,{size:"sm",icon:"add",onClick:()=>{Z(""),H(!0)},className:"w-full sm:w-auto",children:"Add API Key"}),(0,i.jsx)(p.$n,{size:"sm",variant:"secondary",icon:"edit",onClick:()=>eu(!0),className:"w-full sm:w-auto",children:"Edit"}),(0,i.jsx)(p.$n,{size:"sm",variant:"secondary",icon:"delete",onClick:async()=>{e4({title:"Delete Compatible Node",message:`Delete this ${t$?"Anthropic":"OpenAI"} Compatible node?`,onConfirm:async()=>{e4(null);try{(await fetch(`/api/provider-nodes/${g}`,{method:"DELETE"})).ok&&f.push("/dashboard/providers")}catch(e){console.log("Error deleting provider node:",e)}}})},className:"w-full sm:w-auto",children:"Delete"})]})]})}),tN?(0,i.jsx)(p.gw,{providerId:g}):(0,i.jsxs)(p.Zp,{children:[(0,i.jsxs)("div",{className:"mb-4 flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[(0,i.jsxs)("div",{className:"flex items-center gap-2",children:[(0,i.jsx)("h2",{className:"font-display text-lg font-semibold text-text-main",children:"Connections"}),(0,i.jsx)("span",{className:"rounded-full bg-surface-2 px-2 py-0.5 font-mono text-[11px] font-semibold text-text-main",children:b.length})]}),(0,i.jsxs)("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:gap-4",children:[b.length>0&&C.length>0&&(0,i.jsx)(p.$n,{size:"sm",variant:"secondary",icon:"lan",onClick:()=>eh(!0),children:"Apply Proxy"}),b.length>0&&(0,i.jsxs)(i.Fragment,{children:[eI.length>0&&(0,i.jsxs)(p.$n,{size:"sm",variant:"danger",icon:"delete",onClick:()=>{let e=eI.length;0!==e&&e4({title:`Delete ${e} Connection${e>1?"s":""}`,message:`Delete ${e} connection${e>1?"s":""}? This cannot be undone.`,onConfirm:async()=>{e4(null);let e=0,t=[...eI];for(let s of t)try{(await fetch(`/api/providers/${s}`,{method:"DELETE"})).ok||(e+=1)}catch(t){console.log("Error deleting connection:",t),e+=1}v(e=>e.filter(e=>!t.includes(e.id))),eE([]),e>0&&alert(`Deleted ${t.length-e} connection(s), ${e} failed.`)}})},children:["Delete Selected (",eI.length,")"]}),(0,i.jsx)(p.$n,{size:"sm",variant:"secondary",icon:"sync",onClick:t2,disabled:e9,children:e9?"Testing Connection One-by-One...":"Test Connection One-by-One"}),e9&&(0,i.jsx)(p.$n,{size:"sm",variant:"ghost",icon:"stop",onClick:()=>{e9&&(to.current=!0,tt(!0))},disabled:te,children:te?"Stopping...":"Stop"})]}),(0,i.jsxs)("div",{className:"flex flex-wrap items-center gap-2.5 rounded-lg border border-border bg-surface-2/40 px-3 py-2",children:[(0,i.jsx)("span",{className:"font-mono text-[10px] uppercase tracking-wider text-text-subtle",children:"Round Robin"}),(0,i.jsx)(p.lM,{checked:"round-robin"===eM,onChange:e=>{let t=e?"round-robin":null,s=e?eU||"1":eU;e&&!eU&&eL("1"),eq(t),tB(t,s)}}),"round-robin"===eM&&(0,i.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,i.jsx)("span",{className:"font-mono text-[10px] uppercase tracking-wider text-text-subtle",children:"Sticky:"}),(0,i.jsx)("input",{type:"number",min:1,value:eU,onChange:e=>{var t;eL(t=e.target.value),tB("round-robin",t)},placeholder:"1",className:"w-14 rounded-md border border-border bg-surface px-2 py-1 font-mono text-xs text-text-main focus:border-text-subtle focus:outline-none"})]})]})]})]}),0===b.length?(0,i.jsxs)("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[(0,i.jsxs)("div",{className:"flex items-center gap-3",children:[(0,i.jsx)("div",{className:"inline-flex items-center justify-center w-9 h-9 rounded-full bg-primary/10 text-primary shrink-0",children:(0,i.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:tw?"lock":"key"})}),(0,i.jsxs)("div",{className:"min-w-0",children:[(0,i.jsx)("p",{className:"text-sm text-text-muted",children:"No connections yet"}),tP&&(0,i.jsxs)("p",{className:"text-xs text-text-muted",children:["Choose ",tI," or ",tE,"."]})]})]}),(0,i.jsx)("div",{className:"flex gap-2",children:tP?(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)("button",{onClick:tg,className:"inline-flex h-8 items-center justify-center gap-2 rounded-lg border border-border bg-surface px-3.5 text-sm font-display font-medium text-text-main transition-colors hover:border-text-subtle hover:bg-surface-2",children:[(0,i.jsx)("span",{className:"material-symbols-outlined text-[17px]",children:"lock"}),tI]}),(0,i.jsxs)("button",{onClick:ty,className:"inline-flex h-8 items-center justify-center gap-2 rounded-lg bg-primary px-3.5 text-sm font-display font-medium text-white transition-colors hover:bg-primary-hover",children:[(0,i.jsx)("span",{className:"material-symbols-outlined text-[17px]",children:"key"}),tE]})]}):(0,i.jsxs)(i.Fragment,{children:[!tO&&es.w.has(g)&&(0,i.jsx)(es.A,{providerId:g,onConnected:tW}),!tO&&er.has(g)&&(0,i.jsx)(ei,{providerId:g,onConnected:tW}),!tO&&"iflow"===g&&(0,i.jsx)(p.$n,{size:"sm",icon:"cookie",variant:"secondary",onClick:()=>L(!0),children:"Cookie"}),"codex"===g&&(0,i.jsx)(p.$n,{size:"sm",icon:"playlist_add",variant:"secondary",onClick:()=>X(!0),children:(0,O.Tl)("Bulk Add")}),"grok-cli"===g&&(0,i.jsx)(p.$n,{size:"sm",icon:"playlist_add",variant:"secondary",onClick:()=>eo(!0),children:(0,O.Tl)("Bulk Add")}),(0,i.jsx)(p.$n,{size:"sm",icon:"add",onClick:tb,children:tO?"Add API Key":"iflow"===g?"OAuth":"Add Connection"})]})})]}):(0,i.jsxs)(i.Fragment,{children:[tl&&(0,i.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,i.jsxs)("div",{className:"flex flex-wrap items-center gap-3",children:[(0,i.jsxs)("span",{children:["Total: ",tl.total]}),(0,i.jsxs)("span",{children:["Completed: ",tl.completed]}),(0,i.jsxs)("span",{children:["Passed: ",tl.passed]}),(0,i.jsxs)("span",{children:["Failed: ",tl.failed]}),tl.stopped&&(0,i.jsx)("span",{className:"text-amber-600 dark:text-amber-400",children:"Stopped"}),e9&&ts&&(0,i.jsxs)("span",{children:["Running: ",b.find(e=>e.id===ts)?.name||ts]})]})}),b.length>0&&(0,i.jsx)("div",{className:"mb-3 flex items-center gap-2 border-b border-black/[0.03] pb-2 dark:border-white/[0.03]",children:(0,i.jsxs)("label",{className:"flex cursor-pointer items-center gap-1.5 text-xs text-text-muted hover:text-primary",children:[(0,i.jsx)("input",{type:"checkbox",checked:se,onChange:()=>{se?eE([]):eE(b.map(e=>e.id))},className:"h-3.5 w-3.5 rounded border-gray-300 text-primary focus:ring-primary"}),"Select All"]})}),sa,!tO&&(0,i.jsxs)("div",{className:"mt-4 grid grid-cols-1 gap-2 sm:flex",children:[es.w.has(g)&&(0,i.jsx)(es.A,{providerId:g,onConnected:tW}),er.has(g)&&(0,i.jsx)(ei,{providerId:g,onConnected:tW}),"iflow"===g&&(0,i.jsx)(p.$n,{size:"sm",icon:"cookie",variant:"secondary",onClick:()=>L(!0),title:"Add connection using browser cookie",className:"w-full sm:w-auto",children:"Cookie"}),"codex"===g&&(0,i.jsx)(p.$n,{size:"sm",icon:"playlist_add",variant:"secondary",onClick:()=>X(!0),title:(0,O.Tl)("Bulk import codex accounts from JSON"),className:"w-full sm:w-auto",children:(0,O.Tl)("Bulk Add")}),"grok-cli"===g&&(0,i.jsx)(p.$n,{size:"sm",icon:"playlist_add",variant:"secondary",onClick:()=>eo(!0),title:(0,O.Tl)("Bulk import Grok CLI accounts from JSON"),className:"w-full sm:w-auto",children:(0,O.Tl)("Bulk Add")}),tP?(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)("button",{onClick:tg,className:"inline-flex h-8 items-center justify-center gap-2 rounded-lg border border-border bg-surface px-3.5 text-sm font-display font-medium text-text-main transition-colors hover:border-text-subtle hover:bg-surface-2 w-full sm:w-auto",children:[(0,i.jsx)("span",{className:"material-symbols-outlined text-[17px]",children:"lock"}),tI]}),(0,i.jsxs)("button",{onClick:ty,className:"inline-flex h-8 items-center justify-center gap-2 rounded-lg bg-primary px-3.5 text-sm font-display font-medium text-white transition-colors hover:bg-primary-hover w-full sm:w-auto",children:[(0,i.jsx)("span",{className:"material-symbols-outlined text-[17px]",children:"key"}),tE]})]}):(0,i.jsx)(p.$n,{size:"sm",icon:"add",onClick:tb,className:"w-full sm:w-auto",children:"Add"})]})]})]}),(0,i.jsx)(ee,{providerId:g}),(0,i.jsxs)(p.Zp,{children:[(0,i.jsxs)("div",{className:"mb-4 flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[(0,i.jsxs)("div",{className:"flex flex-col gap-1.5",children:[(0,i.jsx)("h2",{className:"font-display text-lg font-semibold text-text-main",children:"Available Models"}),(0,i.jsx)("p",{className:"font-mono text-[10px] uppercase tracking-wider text-text-subtle",children:"Model IDs served by this provider"})]}),(0,i.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[t_&&(0,i.jsx)(u.A,{value:eK,onChange:e=>{eF(e),tG(e)},options:t_.map(e=>({value:e,label:`Thinking: ${e.charAt(0).toUpperCase()+e.slice(1)}`,icon:"psychology"})),buttonClassName:"h-8 rounded-lg pl-3 pr-1.5 font-mono text-xs",menuClassName:"w-64"}),!tO&&(e=[...tS,...e0.filter(e=>!tS.some(t=>t.id===e.id))].filter(e=>{let t=(0,h.CP)(e);return!t||"llm"===t}).map(e=>e.id).filter(e=>!e2.includes(e)),(0,i.jsxs)("div",{className:"flex gap-2",children:[e2.length>0&&(0,i.jsxs)("button",{onClick:tK,className:"inline-flex h-8 items-center gap-1.5 rounded-lg border border-border bg-surface px-3 text-sm font-display font-medium text-text-main transition-colors hover:border-text-subtle hover:bg-surface-2",children:[(0,i.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"restart_alt"}),"Activate All"]}),e.length>0&&(0,i.jsxs)("button",{onClick:()=>tL(e),className:"inline-flex h-8 items-center gap-1.5 rounded-lg border border-border bg-surface px-3 text-sm font-display font-medium text-text-main transition-colors hover:border-text-subtle hover:bg-surface-2",children:[(0,i.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"block"}),"Disable All"]})]}))]})]}),!!eS&&(0,i.jsxs)("div",{className:"mb-3 flex items-center gap-2.5 rounded-lg border border-danger/25 bg-danger/5 px-3 py-2.5",children:[(0,i.jsx)("span",{className:"material-symbols-outlined shrink-0 text-[18px] text-danger",children:"error"}),(0,i.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,i.jsx)("p",{className:"break-words font-mono text-xs leading-relaxed text-danger",children:eS}),/RegionError|hosted in China|regionNotAllowed/i.test(eS)&&(s=(t="string"==typeof eS?eS:JSON.stringify(eS)).match(/https:\/\/opencode\.ai\/workspace\/[^\s"')]+/),r=t.match(/wrk_[0-9A-Za-z]+/),l=s?s[0].endsWith("/go")?s[0]:`${s[0]}/go`:r?`https://opencode.ai/workspace/${r[0]}/go`:"https://opencode.ai",(0,i.jsx)("div",{className:"mt-2",children:(0,i.jsxs)("a",{href:l,target:"_blank",rel:"noreferrer",className:"inline-flex h-7 items-center gap-1.5 rounded-lg border border-border bg-surface px-2.5 text-xs font-display font-medium text-text-main transition-colors hover:border-text-subtle hover:bg-surface-2",children:[(0,i.jsx)("span",{children:"Allow China-hosted models"}),(0,i.jsx)("span",{className:"material-symbols-outlined text-[13px]",children:"open_in_new"})]})}))]})]}),"zed"===g&&!!eX&&(0,i.jsxs)("div",{className:"mb-3 flex items-center gap-2.5 rounded-lg border border-danger/25 bg-danger/5 px-3 py-2.5",children:[(0,i.jsx)("span",{className:"material-symbols-outlined shrink-0 text-[18px] text-danger",children:"error"}),(0,i.jsx)("p",{className:"break-words font-mono text-xs leading-relaxed text-danger",children:eX})]}),(()=>{let e,t,s;if(tO)return(0,i.jsx)(_,{providerStorageAlias:tR,providerDisplayAlias:tz,modelAliases:ey,customModels:ev,copied:tu,onCopy:tx,onSetAlias:tV,onDeleteAlias:tQ,onAddCustomModel:e=>tX(e,"llm",tR),onDeleteCustomModel:e=>tY(e,"llm",tR),connections:b,isAnthropic:t$});let a=[...tS,...e0.filter(e=>!tS.some(t=>t.id===e.id))].filter(e=>{let t=(0,h.CP)(e);return!t||"llm"===t}),r=new Set(e2),l=a.filter(e=>!r.has(e.id)),n=a.filter(e=>r.has(e.id)),o=E({customModels:ev,modelAliases:ey,providerAlias:tR,builtInModels:tS,type:"llm"});return(0,i.jsxs)("div",{className:"flex flex-wrap gap-3",children:[o.map(e=>(0,i.jsx)(D,{model:{id:e.id,name:e.name},fullModel:`${tz}/${e.id}`,alias:e.alias,copied:tu,onCopy:tx,onSetAlias:()=>{},onDeleteAlias:()=>{"custom"===e.source?tY(e.id,"llm",tR):tQ(e.alias)},testStatus:eN[e.id],onTest:b.length>0||tN?()=>sn(e.id):void 0,isTesting:eT.has(e.id),isCustom:!0,isFree:!1,caps:y(`${g}/${e.id}`),thinkingSuffix:tD(e.id)},`${e.source}-${e.fullModel}`)),l.map(e=>{let t=`${tR}/${e.id}`,s=`${g}/${e.id}`,a=Object.entries(ey).find(([,e])=>e===t||e===s)?.[0];return(0,i.jsx)(D,{model:e,fullModel:`${tz}/${e.id}`,alias:a,copied:tu,onCopy:tx,onSetAlias:t=>tV(e.id,t,tR),onDeleteAlias:()=>tQ(a),testStatus:eN[e.id],onTest:b.length>0||tN?()=>sn(e.id):void 0,isTesting:eT.has(e.id),isFree:e.isFree,onDisable:()=>tq(e.id),caps:y(`${g}/${e.id}`),thinkingSuffix:tD(e.id)},e.id)}),(0,i.jsxs)("button",{onClick:()=>eP(!0),className:"flex w-full items-center justify-center gap-1.5 rounded-lg border border-dashed border-border px-3 py-2 text-xs font-display font-medium text-text-muted transition-colors hover:border-text-subtle hover:bg-surface-2/60 hover:text-text-main sm:w-auto",children:[(0,i.jsx)("span",{className:"material-symbols-outlined text-sm",children:"add"}),"Add Model"]}),("qoder"===g||"qoder-cn"===g)&&b.some(e=>!1!==e.isActive)&&(0,i.jsxs)("button",{onClick:t0,disabled:td,className:"flex w-full items-center justify-center gap-1.5 rounded-lg border border-dashed border-border px-3 py-2 text-xs font-display font-medium text-text-muted transition-colors hover:border-text-subtle hover:bg-surface-2/60 hover:text-text-main sm:w-auto disabled:opacity-50 disabled:cursor-not-allowed",children:[(0,i.jsx)("span",{className:"material-symbols-outlined text-sm",style:td?{animation:"spin 1s linear infinite"}:void 0,children:td?"progress_activity":"download"}),td?(0,O.Tl)("Fetching..."):(0,O.Tl)("Fetch Qoder Models")]}),("cline"===g||"clinepass"===g)&&b.some(e=>!1!==e.isActive)&&(0,i.jsxs)("button",{onClick:t1,disabled:tm,className:"flex w-full items-center justify-center gap-1.5 rounded-lg border border-dashed border-border px-3 py-2 text-xs font-display font-medium text-text-muted transition-colors hover:border-text-subtle hover:bg-surface-2/60 hover:text-text-main sm:w-auto disabled:opacity-50 disabled:cursor-not-allowed",children:[(0,i.jsx)("span",{className:"material-symbols-outlined text-sm",style:tm?{animation:"spin 1s linear infinite"}:void 0,children:tm?"progress_activity":"download"}),tm?(0,O.Tl)("Fetching..."):(0,O.Tl)("Import from /models")]}),eG.length>0&&(e=new Set([...Object.values(ey),...o.map(e=>e.fullModel)]),t=new Set(tS.map(e=>e.id)),0===(s=eG.filter(s=>!e.has(`${tR}/${s.id}`)&&!t.has(s.id))).length?null:(0,i.jsxs)("div",{className:"w-full mt-2",children:[(0,i.jsx)("p",{className:"text-xs text-text-muted mb-2",children:"Suggested free models (≥200k context):"}),(0,i.jsx)("div",{className:"flex flex-wrap gap-2",children:s.map(e=>(0,i.jsxs)("button",{onClick:async()=>{await tX(e.id,"llm",tR)},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,i.jsx)("span",{className:"material-symbols-outlined text-[13px]",children:"add"}),e.id.split("/").pop()]},e.id))})]})),n.length>0&&(0,i.jsxs)("div",{className:"w-full mt-2",children:[(0,i.jsxs)("p",{className:"text-xs text-text-muted mb-2",children:["Disabled models (",n.length,"):"]}),(0,i.jsx)("div",{className:"flex flex-wrap gap-2",children:n.map(e=>(0,i.jsxs)("button",{onClick:()=>tU(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,i.jsx)("span",{className:"material-symbols-outlined text-[13px]",children:"add"}),e.id]},e.id))})]})]})})()]}),sl,"kiro"===g?(0,i.jsx)(p.Mh,{isOpen:P,providerInfo:tv,onSuccess:t3,onClose:()=>R(!1)}):"cursor"===g?(0,i.jsx)(p.G9,{isOpen:P,onSuccess:t3,onClose:()=>R(!1)}):"zed"===g?(0,i.jsx)(p.TE,{isOpen:P,providerInfo:tv,onSuccess:t3,onClose:()=>R(!1)}):"gitlab"===g?(0,i.jsx)(p.vj,{isOpen:P,providerInfo:tv,onSuccess:t3,onClose:()=>R(!1)}):(0,i.jsx)(p.LF,{isOpen:P,provider:g,providerInfo:tv,onSuccess:t3,onClose:()=>R(!1)}),(0,i.jsx)(p.LH,{isOpen:z,onSuccess:t3,onClose:()=>M(!1)}),"iflow"===g&&(0,i.jsx)(p.vE,{isOpen:q,onSuccess:()=>{tW(),L(!1)},onClose:()=>L(!1)}),(0,i.jsx)(K,{isOpen:J,provider:g,providerName:tv.name,isCompatible:tO,isAnthropic:t$,authType:tv?.authType,authHint:tv?.authHint,website:tv?.website,proxyPools:C,error:G,existingNames:b.map(e=>e.name).filter(Boolean),onSave:t4,onBulkDone:tW,onClose:()=>{Z(""),H(!1)}}),(0,i.jsx)(p.wI,{isOpen:ec,connection:ef,proxyPools:C,onSave:t6,onClose:()=>em(!1)}),tO&&(0,i.jsx)(F,{isOpen:ep,node:k,onSave:tH,onClose:()=>eu(!1),isAnthropic:t$}),!tO&&(0,i.jsx)(W,{isOpen:eO,providerAlias:tR,providerDisplayAlias:tz,onSave:async(e,t,s)=>{await tX(e,t?.stt?"stt":"llm",tR,t,s),eP(!1)},onClose:()=>eP(!1)}),"codex"===g&&(0,i.jsx)(B,{isOpen:Q,onClose:()=>X(!1),onSuccess:tW}),"grok-cli"===g&&(0,i.jsx)(V,{isOpen:Y,onClose:()=>eo(!1),onSuccess:tW}),eH&&(0,i.jsx)(et.A,{isOpen:!!eH,onClose:()=>eB(null),connection:eH,reactive:!0===eJ.connections[eH.id],schedule:eJ.schedules?.[eH.id]||null,onSave:e=>((e,{reactive:t,schedule:s})=>{tZ({...eJ,connections:{...eJ.connections,[e]:t},schedules:{...eJ.schedules,[e]:s}})})(eH.id,e)}),(0,i.jsx)(p.uo,{isOpen:e6,onClose:()=>e8(!1),onConfirm:()=>{(window.localStorage.setItem(th,"true"),e8(!1),tw)?tf():ty()},title:"Risk Notice",message:tv?.deprecationNotice,confirmText:"I Understand, Continue",cancelText:"Cancel",variant:"danger"}),(0,i.jsx)(p.uo,{isOpen:!!e3,onClose:()=>e4(null),onConfirm:e3?.onConfirm,title:e3?.title||"Confirm",message:e3?.message,variant:"danger"})]})}function ed({icon:e,label:t,value:s,sub:a,tone:r}){return(0,i.jsxs)(p.Zp,{className:"flex items-center gap-3 p-3.5",children:[(0,i.jsx)("div",{className:"grid size-10 shrink-0 place-items-center rounded-lg bg-surface-2 text-text-muted",children:(0,i.jsx)("span",{className:"material-symbols-outlined text-[20px]",children:e})}),(0,i.jsxs)("div",{className:"min-w-0",children:[(0,i.jsx)("p",{className:"font-mono text-[10px] uppercase tracking-[0.15em] text-text-subtle",children:t}),(0,i.jsx)("p",{className:`font-display text-xl font-bold leading-tight ${{default:"text-text-main",success:"text-success",danger:"text-danger",brand:"text-text-main"}[r||"default"]}`,children:s}),a&&(0,i.jsx)("p",{className:"truncate text-[11px] text-text-muted",children:a})]})]})}ed.propTypes={icon:l().string.isRequired,label:l().string.isRequired,value:l().number.isRequired,sub:l().string,tone:l().string}},85226:(e,t,s)=>{Promise.resolve().then(s.bind(s,46584))},93195:(e,t,s)=>{"use strict";function i(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone||"UTC"}catch{return"UTC"}}s.d(t,{JW:()=>o,Vm:()=>i,fB:()=>r,gy:()=>a,nz:()=>l});let a={anchor:"09:30",timezone:i(),windowHours:5,slotsPerDay:3};function r(e){let t=/^(\d{1,2}):(\d{2})$/.exec(String(e||"").trim());if(!t)return null;let s=Number(t[1]),i=Number(t[2]);return s>23||i>59?null:{hour:s,minute:i}}function l(e){return Math.max(1,Math.floor(24/e))}function n(e,t,s,i){let a="number"==typeof e?e:Number(e);return Number.isFinite(a)?Math.min(i,Math.max(s,a)):t}function o(e){let t=function(e){if(!e||!0!==e.enabled)return null;let t=r(e.anchor)||r(a.anchor),s=`${String(t.hour).padStart(2,"0")}:${String(t.minute).padStart(2,"0")}`,i=!function(e){if(!e||"string"!=typeof e)return!1;try{return new Intl.DateTimeFormat("en-US",{timeZone:e}),!0}catch{return!1}}(e.timezone)?a.timezone:e.timezone,o=n(e.windowHours,a.windowHours,.5,24),d=Math.round(n(e.slotsPerDay,a.slotsPerDay,1,l(o)));return{enabled:!0,anchor:s,timezone:i,windowHours:o,slotsPerDay:d}}(e);if(!t)return[];let{hour:s,minute:i}=r(t.anchor),o=60*s+i;return Array.from({length:t.slotsPerDay},(e,s)=>{let i=Math.round(o+s*t.windowHours*60)%1440;return`${String(Math.floor(i/60)).padStart(2,"0")}:${String(i%60).padStart(2,"0")}`})}},97132:(e,t,s)=>{"use strict";s.d(t,{A:()=>m});var i=s(95155),a=s(12115),r=s(14051),l=s.n(r),n=s(35497),o=s(31474),d=s(93195);let c=[{value:"off",label:"Off",icon:"block"},{value:"reset",label:"On reset",icon:"bolt"},{value:"schedule",label:"Schedule",icon:"schedule"}];function m({isOpen:e,onClose:t,onSave:s,connection:r,reactive:l=!1,schedule:p=null}){let[u,x]=(0,a.useState)(()=>({mode:p?.enabled===!0?"schedule":!0===l?"reset":"off",anchor:p?.anchor||d.gy.anchor,timezone:(0,d.Vm)(),windowHours:String(p?.windowHours??d.gy.windowHours),slotsPerDay:String(p?.slotsPerDay??d.gy.slotsPerDay)})),h=Number(u.windowHours),f=Number(u.slotsPerDay),g=!!(0,d.fB)(u.anchor),y=Number.isFinite(h)&&h>=.5&&h<=24,b=y?(0,d.nz)(h):24,v=Number.isInteger(f)&&f>=1&&f<=b,j=g&&y&&v,w="schedule"!==u.mode||j,k=j?(0,d.JW)({enabled:!0,...u,windowHours:h,slotsPerDay:f}):[],N=k.length&&y?(()=>{let{hour:e,minute:t}=(0,d.fB)(u.anchor),s=Math.round(60*e+t+f*h*60)%1440;return`${String(Math.floor(s/60)).padStart(2,"0")}:${String(s%60).padStart(2,"0")}`})():"",C=e=>x(t=>({...t,...e}));return(0,i.jsx)(n.aF,{isOpen:e,onClose:t,title:"Auto-ping settings",size:"lg",footer:(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(n.$n,{variant:"secondary",onClick:t,children:"Cancel"}),(0,i.jsx)(n.$n,{onClick:()=>{w&&(s({reactive:"reset"===u.mode,schedule:"schedule"===u.mode?{enabled:!0,anchor:u.anchor,timezone:u.timezone,windowHours:h,slotsPerDay:f}:{enabled:!1}}),t())},disabled:!w,children:"Save"})]}),children:(0,i.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,i.jsxs)("p",{className:"text-sm text-text-muted",children:["Configure automated quota pings",r?.name?` for ${r.name}`:""," - pick one mode."]}),(0,i.jsx)("div",{className:"grid grid-cols-3 gap-1 rounded-[10px] bg-surface-2 p-1",children:c.map(e=>{let t=u.mode===e.value;return(0,i.jsxs)("button",{type:"button",onClick:()=>C({mode:e.value}),className:(0,o.cn)("flex h-9 items-center justify-center gap-1.5 rounded-[8px] px-3 text-sm font-medium transition-all",t?"bg-surface text-text-main shadow-sm":"text-text-muted hover:text-text-main"),children:[(0,i.jsx)("span",{className:"material-symbols-outlined text-[15px] leading-none",children:e.icon}),(0,i.jsx)("span",{children:e.label})]},e.value)})}),"reset"===u.mode&&(0,i.jsx)("p",{className:"text-xs text-text-muted",children:"Pings right after the 5h quota window resets, so a new window starts immediately."}),"schedule"===u.mode&&(0,i.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,i.jsx)("p",{className:"text-xs text-text-muted",children:"Pings at fixed local times so the 5h windows align with your workday."}),(0,i.jsxs)("div",{className:"grid grid-cols-1 gap-4 sm:grid-cols-3",children:[(0,i.jsx)(n.pd,{label:"Anchor time",type:"time",value:u.anchor,onChange:e=>C({anchor:e.target.value}),error:g?"":"Use HH:MM",inputClassName:"ring-1 ring-black/10 dark:ring-white/15"}),(0,i.jsx)(n.pd,{label:"Window (hours)",type:"number",min:"0.5",max:"24",step:"0.5",value:u.windowHours,onChange:e=>C({windowHours:e.target.value}),error:y?"":"0.5 – 24",inputClassName:"ring-1 ring-black/10 dark:ring-white/15"}),(0,i.jsx)(n.pd,{label:"Pings per day",type:"number",min:"1",max:String(b),step:"1",value:u.slotsPerDay,onChange:e=>C({slotsPerDay:e.target.value}),error:v?"":`1 – ${b}`,hint:v?`Max ${b}`:"",inputClassName:"ring-1 ring-black/10 dark:ring-white/15"})]}),k.length>0&&(0,i.jsxs)("div",{className:"rounded-[10px] bg-surface-2 px-3 py-2.5",children:[(0,i.jsxs)("p",{className:"text-xs font-medium uppercase tracking-wide text-text-muted",children:["Daily slots (",u.timezone,")"]}),(0,i.jsx)("p",{className:"mt-1 text-sm font-medium text-text-main",children:k.join(" → ")}),(0,i.jsxs)("p",{className:"mt-1 text-xs text-text-muted",children:["Covers ",k[0]," – ",N,", then pauses until ",k[0]," next day."]})]})]})]})})}m.propTypes={isOpen:l().bool.isRequired,onClose:l().func.isRequired,onSave:l().func.isRequired,connection:l().object,reactive:l().bool,schedule:l().object}}},e=>{e.O(0,[763,5772,2470,705,3557,5497,8441,3794,7358],()=>e(e.s=85226)),_N_E=e.O()}]);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8460],{13950:(e,t,s)=>{"use strict";s.r(t),s.d(t,{default:()=>A});var a=s(95155),r=s(12115),l=s(73321),i=s(14051),n=s.n(i),o=s(35497),c=s(57250),d=s(8247),m=s(90620),x=s(88105),p=s(98500),u=s.n(p),h=s(65921),f=s(38003);let b={available:{icon:"check_circle",color:"#22c55e",label:"Available"},cooldown:{icon:"schedule",color:"#f59e0b",label:"Cooldown"},unavailable:{icon:"error",color:"#ef4444",label:"Unavailable"},unknown:{icon:"help",color:"#6b7280",label:"Unknown"}};function g(){let[e,t]=(0,r.useState)(null),[s,l]=(0,r.useState)(!0),[i,n]=(0,r.useState)(!1),[c,d]=(0,r.useState)(null),m=(0,r.useRef)(null),x=(0,h.i)(),p=(0,r.useCallback)(async()=>{try{let e=await fetch("/api/models/availability");if(e.ok){let s=await e.json();t(s)}}catch{}finally{l(!1)}},[]);(0,r.useEffect)(()=>{p();let e=setInterval(p,3e4);return()=>clearInterval(e)},[p]),(0,r.useEffect)(()=>{let e=e=>{m.current&&!m.current.contains(e.target)&&n(!1)};return i&&document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[i]);let u=async(e,t)=>{d(`${e}:${t}`);try{(await fetch("/api/models/availability",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"clearCooldown",provider:e,model:t})})).ok?(x.success(`Cooldown cleared for ${t}`),await p()):x.error("Failed to clear cooldown")}catch{x.error("Failed to clear cooldown")}finally{d(null)}};if(s)return null;let f=e?.models||[],g=0===(e?.unavailableCount||f.filter(e=>"available"!==e.status).length),v={};return f.forEach(e=>{if("available"===e.status)return;let t=e.provider||"unknown";v[t]||(v[t]=[]),v[t].push(e)}),(0,a.jsx)("div",{className:"relative",ref:m,children:i&&(0,a.jsxs)("div",{className:"absolute top-full right-0 mt-2 w-80 bg-surface border border-border rounded-xl shadow-2xl z-50 overflow-hidden",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between px-4 py-3 border-b border-border bg-bg",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[16px]",style:{color:g?"#22c55e":"#f59e0b"},children:g?"verified":"warning"}),(0,a.jsx)("span",{className:"text-sm font-semibold text-text-main",children:"Model Status"})]}),(0,a.jsx)("button",{onClick:p,className:"p-1 rounded-lg hover:bg-surface text-text-muted hover:text-text-main transition-colors",title:"Refresh",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"refresh"})})]}),(0,a.jsx)("div",{className:"px-4 py-3 max-h-60 overflow-y-auto",children:g?(0,a.jsx)("p",{className:"text-sm text-text-muted text-center py-2",children:"All models are responding normally."}):(0,a.jsx)("div",{className:"flex flex-col gap-2.5",children:Object.entries(v).map(([e,t])=>(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"text-xs font-semibold text-text-main mb-1.5 capitalize",children:e}),(0,a.jsx)("div",{className:"flex flex-col gap-1",children:t.map(e=>{let t=b[e.status]||b.unknown,s=c===`${e.provider}:${e.model}`;return(0,a.jsxs)("div",{className:"flex items-center justify-between px-2.5 py-1.5 rounded-lg bg-surface/30",children:[(0,a.jsxs)("div",{className:"flex items-center gap-1.5 min-w-0",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px] shrink-0",style:{color:t.color},children:t.icon}),(0,a.jsx)("span",{className:"font-mono text-xs text-text-main truncate",children:e.model})]}),"cooldown"===e.status&&(0,a.jsx)(o.$n,{size:"sm",variant:"ghost",onClick:()=>u(e.provider,e.model),disabled:s,className:"text-[10px] px-1.5! py-0.5! ml-2",children:s?"...":"Clear"})]},`${e.provider}-${e.model}`)})})]},e))})})]})})}let v={openai:{title:"Add OpenAI Compatible",type:"openai-compatible",defaultBaseUrl:"https://api.openai.com/v1",namePlaceholder:"OpenAI Compatible (Prod)",prefixPlaceholder:"oc-prod",baseUrlHint:"Use the base URL (ending in /v1) for your OpenAI-compatible API.",modelIdPlaceholder:"e.g. gpt-4, claude-3-opus",errorLabel:"OpenAI Compatible",hasApiType:!0},anthropic:{title:"Add Anthropic Compatible",type:"anthropic-compatible",defaultBaseUrl:"https://api.anthropic.com/v1",namePlaceholder:"Anthropic Compatible (Prod)",prefixPlaceholder:"ac-prod",baseUrlHint:"Use the base URL (ending in /v1) for your Anthropic-compatible API. The system will append /messages.",modelIdPlaceholder:"e.g. claude-3-opus",errorLabel:"Anthropic Compatible",hasApiType:!1}},y=[{value:"chat",label:"Chat Completions"},{value:"responses",label:"Responses API"}];function j({variant:e,isOpen:t,onClose:s,onCreated:l}){let i=v[e],n=()=>({name:"",prefix:"",...i.hasApiType?{apiType:"chat"}:{},baseUrl:i.defaultBaseUrl}),[c,d]=(0,r.useState)(n),[m,x]=(0,r.useState)(!1),[p,u]=(0,r.useState)(""),[h,f]=(0,r.useState)(""),[b,g]=(0,r.useState)(!1),[N,w]=(0,r.useState)(null);(0,r.useEffect)(()=>{i.hasApiType?d(e=>({...e,baseUrl:i.defaultBaseUrl})):t&&(w(null),u(""),f(""))},[i.hasApiType?c.apiType:t]);let k=async()=>{if(c.name.trim()&&c.prefix.trim()&&c.baseUrl.trim()){x(!0);try{let e=await fetch("/api/provider-nodes",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:c.name,prefix:c.prefix,...i.hasApiType?{apiType:c.apiType}:{},baseUrl:c.baseUrl,type:i.type})}),t=await e.json();e.ok&&(l(t.node),d(n()),u(""),w(null))}catch(e){console.log(`Error creating ${i.errorLabel} node:`,e)}finally{x(!1)}}},C=async()=>{g(!0);try{let e=await fetch("/api/provider-nodes/validate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({baseUrl:c.baseUrl,apiKey:p,type:i.type,modelId:h.trim()||void 0})}),t=await e.json();w(t)}catch{w({valid:!1,error:"Network error"})}finally{g(!1)}};return(0,a.jsx)(o.aF,{isOpen:t,title:i.title,onClose:s,children:(0,a.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,a.jsx)(o.pd,{label:"Name",value:c.name,onChange:e=>d({...c,name:e.target.value}),placeholder:i.namePlaceholder,hint:"Required. A friendly label for this node."}),(0,a.jsx)(o.pd,{label:"Prefix",value:c.prefix,onChange:e=>d({...c,prefix:e.target.value}),placeholder:i.prefixPlaceholder,hint:"Required. Used as the provider prefix for model IDs."}),i.hasApiType&&(0,a.jsx)(o.l6,{label:"API Type",options:y,value:c.apiType,onChange:e=>d({...c,apiType:e.target.value})}),(0,a.jsx)(o.pd,{label:"Base URL",value:c.baseUrl,onChange:e=>d({...c,baseUrl:e.target.value}),placeholder:i.defaultBaseUrl,hint:i.baseUrlHint}),(0,a.jsx)(o.pd,{label:"API Key (for Check)",type:"password",value:p,onChange:e=>u(e.target.value)}),(0,a.jsx)(o.pd,{label:"Model ID (optional)",value:h,onChange:e=>f(e.target.value),placeholder:i.modelIdPlaceholder,hint:"If provider lacks /models endpoint, enter a model ID to validate via chat/completions instead."}),(0,a.jsxs)("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center",children:[(0,a.jsx)(o.$n,{onClick:C,disabled:!p||b||!c.baseUrl.trim(),variant:"secondary",className:"w-full sm:w-auto",children:b?"Checking...":"Check"}),(()=>{if(!N)return null;let{valid:e,error:t,method:s}=N;return e?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(o.Ex,{variant:"success",children:"Valid"}),"chat"===s&&(0,a.jsx)("span",{className:"text-sm text-text-muted",children:"(via inference test)"})]}):(0,a.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,a.jsx)(o.Ex,{variant:"error",children:"Invalid"}),t&&(0,a.jsx)("span",{className:"text-sm text-red-500",children:t})]})})()]}),(0,a.jsxs)("div",{className:"flex flex-col gap-2 sm:flex-row",children:[(0,a.jsx)(o.$n,{onClick:k,fullWidth:!0,disabled:!c.name.trim()||!c.prefix.trim()||!c.baseUrl.trim()||m,children:m?"Creating...":"Create"}),(0,a.jsx)(o.$n,{onClick:s,variant:"ghost",fullWidth:!0,children:"Cancel"})]})]})})}j.propTypes={variant:n().oneOf(["openai","anthropic"]).isRequired,isOpen:n().bool.isRequired,onClose:n().func.isRequired,onCreated:n().func.isRequired};let N={all:{icon:"apps"},active:{icon:"check_circle"},inactive:{icon:"pause_circle"},none:{icon:"link_off"}};function w({options:e,value:t,onChange:s}){let[l,i]=(0,r.useState)(!1),n=(0,r.useRef)(null);(0,r.useEffect)(()=>{let e=e=>{n.current&&!n.current.contains(e.target)&&i(!1)};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[]);let o=e.find(e=>e.value===t)||e[0];return(0,a.jsxs)("div",{className:"relative w-full sm:w-44",ref:n,children:[(0,a.jsxs)("button",{type:"button",onClick:()=>i(e=>!e),"aria-haspopup":"listbox","aria-expanded":l,className:"flex h-9 w-full items-center gap-2 rounded-lg border border-border bg-surface-2 px-3 font-display text-sm text-text-main outline-none transition-colors hover:border-text-subtle focus-visible:ring-2 focus-visible:ring-text-subtle/60",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[16px] text-text-muted",children:"filter_alt"}),(0,a.jsx)("span",{className:"flex-1 text-left font-display",children:o?.label}),(0,a.jsx)("span",{className:`material-symbols-outlined text-[16px] text-text-muted transition-transform duration-150 ${l?"rotate-180":""}`,children:"expand_more"})]}),l&&(0,a.jsx)("div",{role:"listbox",className:"absolute left-0 right-0 z-30 mt-2 overflow-hidden rounded-xl border border-border bg-surface p-1 shadow-[var(--shadow-elevated)]",children:e.map(e=>{let r=e.value===t,l=N[e.value]||{icon:"label"};return(0,a.jsxs)("button",{type:"button",role:"option","aria-selected":r,onClick:()=>{s(e.value),i(!1)},className:`flex w-full items-center gap-2.5 rounded-lg px-3 py-2 text-left text-sm transition-colors ${r?"bg-surface-2 text-text-main":"text-text-muted hover:bg-surface-2 hover:text-text-main"}`,children:[(0,a.jsx)("span",{className:`material-symbols-outlined text-[18px] ${r?"text-text-main":"text-text-subtle"}`,children:l.icon}),(0,a.jsx)("span",{className:"flex-1 font-display",children:e.label}),r&&(0,a.jsx)("span",{className:"material-symbols-outlined text-[18px] text-text-main",children:"check"})]},e.value)})})]})}w.propTypes={options:n().arrayOf(n().shape({value:n().string.isRequired,label:n().string.isRequired})).isRequired,value:n().string.isRequired,onChange:n().func.isRequired};let k=[{value:"all",label:"All"},{value:"active",label:"Active"},{value:"inactive",label:"Inactive"},{value:"none",label:"No connection"}];function C(e){let t=Object.entries(e).some(([e,t])=>e.startsWith("modelLock_")&&t&&new Date(t).getTime()>Date.now());return"unavailable"!==e.testStatus||t?e.testStatus:"active"}function A(){return(0,a.jsx)(r.Suspense,{fallback:(0,a.jsx)(o.Qv,{}),children:(0,a.jsx)(T,{})})}function T(){let e,t,s=(0,l.useSearchParams)(),i=(0,l.useRouter)(),n=["custom","oauth","free","apikey"],d="providersActiveTab",p=(()=>{let e=s.get("tab");if(e&&n.includes(e))return e;{let e=window.localStorage.getItem(d);if(e&&n.includes(e))return e}return"custom"})(),[u,b]=(0,r.useState)([]),[v,y]=(0,r.useState)([]),[N,A]=(0,r.useState)(!0),[T,$]=(0,r.useState)(!1),[R,O]=(0,r.useState)(!1),[E,_]=(0,r.useState)(!1),[U,z]=(0,r.useState)(null),[q,D]=(0,r.useState)(null),[L,M]=(0,r.useState)("all"),F=(0,h.i)(),K=(0,f.C)(e=>e.query),H=(0,f.C)(e=>e.register),J=(0,f.C)(e=>e.unregister);(0,r.useEffect)(()=>(H("Search providers..."),()=>J()),[H,J]);let B=e=>!K.trim()||!!e&&e.toLowerCase().includes(K.trim().toLowerCase());(0,r.useEffect)(()=>{(async()=>{try{let[e,t]=await Promise.all([fetch("/api/providers"),fetch("/api/provider-nodes")]),s=await e.json(),a=await t.json();e.ok&&b(s.connections||[]),t.ok&&y(a.nodes||[])}catch(e){console.log("Error fetching data:",e)}finally{A(!1)}})()},[]);let W=(e,t)=>{let s=Array.isArray(t)?t:[t],a=u.filter(t=>t.provider===e&&s.includes(t.authType)),r=a.filter(e=>{let t=C(e);return"active"===t||"success"===t}).length,l=a.filter(e=>{let t=C(e);return"error"===t||"expired"===t||"unavailable"===t}),i=l.length,n=a.length,o=n>0&&a.every(e=>!1===e.isActive),c=l.sort((e,t)=>new Date(t.lastErrorAt||0)-new Date(e.lastErrorAt||0))[0];return{connected:r,error:i,total:n,errorCode:c?function(e){if(!e)return null;let t=e.lastErrorType;if("runtime_error"===t)return"RUNTIME";if("upstream_auth_error"===t||"auth_missing"===t||"token_refresh_failed"===t||"token_expired"===t)return"AUTH";if("upstream_rate_limited"===t)return"429";if("upstream_unavailable"===t)return"5XX";if("network_error"===t)return"NET";let s=Number(e.errorCode);if(Number.isFinite(s)&&s>=400)return String(s);let a=function(e){if(!e)return null;let t=e.match(/\b([45]\d{2})\b/);return t?t[1]:"ERR"}(e.lastError);if("401"===a||"403"===a)return"AUTH";if(a&&"ERR"!==a)return a;let r=(e.lastError||"").toLowerCase();return r.includes("runtime")||r.includes("not runnable")||r.includes("not installed")?"RUNTIME":r.includes("invalid api key")||r.includes("token invalid")||r.includes("revoked")||r.includes("unauthorized")?"AUTH":"ERR"}(c):null,errorTime:c?.lastErrorAt?function(e){if(!e)return"";let t=Math.floor((Date.now()-new Date(e).getTime())/6e4);if(t<1)return"just now";if(t<60)return`${t}m ago`;let s=Math.floor(t/60);if(s<24)return`${s}h ago`;let a=Math.floor(s/24);return`${a}d ago`}(c.lastErrorAt):null,allDisabled:o}},Q=(e,t)=>(function(e,t,s=!1){return"all"===e||function(e,t=!1){return t?"active":e&&0!==e.total?e.allDisabled?"inactive":"active":"none"}(t,s)===e})(L,e,t),Z=async(e,t,s)=>{let a=Array.isArray(t)?t:[t],r=t=>t.provider===e&&a.includes(t.authType),l=u.filter(r);b(e=>e.map(e=>r(e)?{...e,isActive:s}:e)),await Promise.allSettled(l.map(e=>fetch(`/api/providers/${e.id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({isActive:s})})))},X=async(e,t=null)=>{if(!U){z("provider"===e?t:e),D(null);try{let s=await fetch("/api/providers/test-batch",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({mode:e,providerId:t})}),a=await s.json();if(D(a),a.summary){let{passed:e,failed:t,total:s}=a.summary;0===t?F.success(`All ${s} tests passed`):F.warning(`${e}/${s} passed, ${t} failed`)}}catch(e){D({error:"Test request failed"}),F.error("Provider test failed")}finally{z(null)}}},V=v.filter(e=>"openai-compatible"===e.type).map(e=>({id:e.id,name:e.name||"OpenAI Compatible",color:"#10A37F",textIcon:"OC",apiType:e.apiType})).filter(e=>B(e.name)&&Q(W(e.id,"apikey"))),Y=v.filter(e=>"anthropic-compatible"===e.type).map(e=>({id:e.id,name:e.name||"Anthropic Compatible",color:"#D97757",textIcon:"AC"})).filter(e=>B(e.name)&&Q(W(e.id,"apikey"))),G=(e,t)=>{if("kiro"===t)return["oauth","apikey","api_key"];let s=e?.authModes;return Array.isArray(s)?s.includes("apikey")?["oauth","apikey","api_key"]:"oauth":t in x.nJ||t in m.fg?["oauth","apikey","api_key"]:"oauth"},ee=(e=Object.entries(m.zN).filter(([e,t])=>!t.hidden&&B(t.name)&&Q(W(e,G(t,e)),t.noAuth)),t="oauth",[...e].sort(([e,s],[a,r])=>{let l=s.priority??999,i=r.priority??999;if(l!==i)return l-i;let n=W(e,t),o=W(a,t),c=+(n.connected>0),d=+(o.connected>0);return c!==d?d-c:(s.name||"").localeCompare(r.name||"")})),et=Object.entries(x.IS).filter(([e,t])=>!t.hidden&&B(t.name)&&Q(W(e,G(t,e)),t.noAuth)).sort(([,e],[,t])=>!!t.noAuth-!!e.noAuth),es=Object.entries(x.nJ).filter(([e,t])=>!t.hidden&&B(t.name)&&(t.serviceKinds??["llm"]).includes("llm")&&Q(W(e,G(t,e)),t.noAuth)).sort(([e,t],[s,a])=>{let r=t.priority??999,l=a.priority??999;if(r!==l)return r-l;let i=!!a.noAuth-!!t.noAuth;if(0!==i)return i;let n=W(e,G(t,e)).connected>0?0:1,o=W(s,G(a,s)).connected>0?0:1;return n!==o?n-o:(t.name||"").localeCompare(a.name||"")}),ea=Object.entries(m.fg).filter(([e,t])=>!t.hidden&&(t.serviceKinds??["llm"]).includes("llm")&&B(t.name)&&Q(W(e,"apikey"),t.noAuth)).sort(([e,t],[s,a])=>{let r=W(e,"apikey").total>0?0:1,l=W(s,"apikey").total>0?0:1;return r!==l?r-l:(t.name||"").localeCompare(a.name||"")}),er=!!K.trim()||"all"!==L,el=er||T?ea:ea.slice(0,20),ei=ea.length-20,en=Object.entries(x.br).filter(([e,t])=>!t.hidden&&(t.serviceKinds??["llm"]).includes("llm")&&B(t.name)&&Q(W(e,"cookie"),t.noAuth)).sort(([e,t],[s,a])=>{let r=W(e,"cookie").total>0?0:1,l=W(s,"cookie").total>0?0:1;return r!==l?r-l:(t.name||"").localeCompare(a.name||"")});if(N)return(0,a.jsxs)("div",{className:"flex flex-col gap-8",children:[(0,a.jsx)(o.Qv,{}),(0,a.jsx)(o.Qv,{})]});let eo=ee.length>0||et.length>0||es.length>0||ea.length>0||en.length>0||V.length>0||Y.length>0,ec={total:u.length,connected:u.filter(e=>{let t=C(e);return"active"===t||"success"===t}).length,errors:u.filter(e=>{let t=C(e);return"error"===t||"expired"===t||"unavailable"===t}).length,activeProviders:new Set(u.filter(e=>!1!==e.isActive).map(e=>e.provider)).size,uniqueProviders:new Set(u.map(e=>e.provider)).size},ed=e=>(0,a.jsxs)("button",{onClick:()=>X(e),disabled:!!U,className:`flex w-full items-center justify-center gap-2 rounded-lg px-3.5 py-2 font-display text-sm font-medium transition-colors sm:w-auto ${U===e?"bg-primary text-white animate-pulse":"border border-border bg-surface text-text-muted hover:border-text-subtle hover:text-text-main"}`,title:`Test all ${e} connections`,"aria-label":`Test all ${e} connections`,children:[(0,a.jsx)("span",{className:`material-symbols-outlined text-[16px]${U===e?" animate-spin":""}`,children:"play_arrow"}),U===e?"Testing...":"Test All"]}),em=[{id:"custom",label:"Custom",icon:"extension",count:V.length+Y.length},{id:"oauth",label:"OAuth",icon:"lock_open",count:ee.length},{id:"free",label:"Free Tier",icon:"spa",count:et.length+es.length},{id:"apikey",label:"API Key",icon:"vpn_key",count:ea.length+en.length}],ex=(e,t)=>e.map(e=>{let{id:s,key:a,info:r,stats:l,authType:i,onToggle:n}=t(e);return{key:a??s,id:s,info:r,stats:l,authType:i,onToggle:n,size:"compact"}}),ep=ex([...V,...Y],e=>({id:e.id,info:e,stats:W(e.id,"apikey"),authType:"compatible",onToggle:t=>Z(e.id,"apikey",t)})),eu=ex(ee,([e,t])=>{let s=G(t,e);return{id:e,info:t,stats:W(e,s),authType:"oauth",onToggle:t=>Z(e,s,t)}}),eh=ex([...et.map(([e,t])=>({key:e,info:t,kind:"free"})),...es.map(([e,t])=>({key:e,info:t,kind:"freeTier"}))],({key:e,info:t,kind:s})=>{let a=G(t,e),r="freeTier"===s?Array.isArray(a)?a[0]??"apikey":a:"free";return{id:e,key:`${s}-${e}`,info:t,stats:W(e,a),authType:r,onToggle:t=>Z(e,a,t)}}),ef=ex([...el.map(([e,t])=>({key:e,info:t,authType:"apikey"})),...en.map(([e,t])=>({key:e,info:t,authType:"cookie"}))],({key:e,info:t,authType:s})=>({id:e,key:`${s}-${e}`,info:t,stats:W(e,s),authType:s,onToggle:t=>Z(e,s,t)})),eb=e=>(0,a.jsx)("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-2 sm:gap-4 xl:grid-cols-4",children:e.map(e=>(0,a.jsx)(I,{providerId:e.id,provider:e.info,stats:e.stats,authType:e.authType,onToggle:e.onToggle,size:e.size},e.key))});return(0,a.jsxs)("div",{className:"flex min-w-0 flex-col gap-6 px-1 sm:px-0",children:[(0,a.jsxs)("div",{className:"grid grid-cols-2 gap-3 lg:grid-cols-4",children:[(0,a.jsx)(P,{icon:"hub",label:"Total koneksi",value:ec.total}),(0,a.jsx)(P,{icon:"check_circle",label:"Connected",value:ec.connected,tone:"success"}),(0,a.jsx)(P,{icon:"error",label:"Error",value:ec.errors,tone:"danger"}),(0,a.jsx)(P,{icon:"toggle_on",label:"Provider aktif",value:ec.activeProviders,sub:ec.uniqueProviders>0?`dari ${ec.uniqueProviders} unik`:null})]}),(0,a.jsx)("div",{className:"flex flex-col gap-3",children:(0,a.jsxs)("div",{className:"flex flex-col items-stretch gap-3 sm:flex-row sm:items-center sm:justify-between",children:[(0,a.jsx)("div",{role:"tablist","aria-label":"Provider categories",className:"inline-flex max-w-full items-center gap-1 overflow-x-auto rounded-full bg-surface-2 p-1",children:em.map(e=>{let t=p===e.id;return(0,a.jsxs)("button",{role:"tab","aria-selected":t,onClick:()=>(e=>{if(e===p)return;let t=new URLSearchParams(s);t.set("tab",e);try{window.localStorage.setItem(d,e)}catch{}i.push(`/dashboard/providers?${t.toString()}`,{scroll:!1})})(e.id),className:`flex shrink-0 items-center gap-1.5 rounded-full px-3.5 py-1.5 font-display text-[13px] font-medium transition-all duration-150 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-text-subtle/60 focus-visible:ring-offset-1 focus-visible:ring-offset-surface-2 ${t?"bg-surface text-text-main shadow-[var(--shadow-soft)]":"text-text-muted hover:text-text-main"}`,children:[(0,a.jsx)("span",{className:`material-symbols-outlined text-[15px] ${t?"text-text-main":"text-text-subtle"}`,children:e.icon}),e.label,(0,a.jsx)("span",{className:`rounded-full px-1.5 py-0.5 font-mono text-[10px] leading-none ${t?"bg-surface-2 text-text-main":"bg-bg text-text-muted"}`,children:e.count})]},e.id)})}),(0,a.jsx)(w,{options:k,value:L,onChange:M})]})}),!eo&&(0,a.jsxs)("div",{className:"text-center py-8 border border-dashed border-border rounded-md",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[32px] text-text-muted mb-2",children:"search_off"}),(0,a.jsx)("p",{className:"text-text-muted text-sm",children:"No providers match your search or filters"})]}),"custom"===p&&(0,a.jsxs)("div",{className:"flex flex-col gap-4",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",{children:[(0,a.jsx)("h2",{className:"font-display text-lg font-semibold text-text-main",children:"Custom Providers"}),(0,a.jsx)("p",{className:"mt-0.5 font-mono text-[10px] uppercase tracking-wider text-text-subtle",children:"OpenAI- & Anthropic-compatible endpoints"})]}),(0,a.jsxs)("div",{className:"grid grid-cols-1 gap-2 sm:flex sm:w-auto",children:[(0,a.jsxs)("button",{onClick:()=>_(!0),className:"group flex items-center gap-3 rounded-xl border border-border bg-surface px-4 py-2.5 text-left transition-colors hover:border-text-subtle hover:bg-surface-2",children:[(0,a.jsx)("span",{className:"grid size-9 shrink-0 place-items-center rounded-lg bg-surface-2",children:(0,a.jsx)(c.A,{src:"/providers/anthropic-m.png",alt:"Anthropic Compatible",size:24,className:"object-contain rounded-md"})}),(0,a.jsxs)("span",{className:"min-w-0",children:[(0,a.jsx)("span",{className:"block truncate font-display text-sm font-semibold text-text-main",children:"Anthropic Compatible"}),(0,a.jsxs)("span",{className:"mt-0.5 block text-xs text-text-muted",children:[(0,a.jsx)("span",{className:"font-mono","aria-hidden":"true",children:"+"})," ","endpoint"]})]})]}),(0,a.jsxs)("button",{onClick:()=>O(!0),className:"group flex items-center gap-3 rounded-xl border border-border bg-surface px-4 py-2.5 text-left transition-colors hover:border-text-subtle hover:bg-surface-2",children:[(0,a.jsx)("span",{className:"grid size-9 shrink-0 place-items-center rounded-lg bg-surface-2",children:(0,a.jsx)(c.A,{src:"/providers/oai-cc.png",alt:"OpenAI Compatible",size:24,className:"object-contain rounded-md"})}),(0,a.jsxs)("span",{className:"min-w-0",children:[(0,a.jsx)("span",{className:"block truncate font-display text-sm font-semibold text-text-main",children:"OpenAI Compatible"}),(0,a.jsxs)("span",{className:"mt-0.5 block text-xs text-text-muted",children:[(0,a.jsx)("span",{className:"font-mono","aria-hidden":"true",children:"+"})," ","endpoint"]})]})]})]})]}),0===ep.length?(0,a.jsxs)("div",{className:"flex flex-col items-center gap-4 rounded-xl border border-dashed border-border px-6 py-10 text-center",children:[(0,a.jsx)("span",{className:"grid size-12 shrink-0 place-items-center rounded-full bg-surface-2 text-text-muted",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[24px]",children:"extension"})}),(0,a.jsxs)("div",{className:"space-y-1.5",children:[(0,a.jsx)("p",{className:"font-display text-base font-semibold text-text-main",children:"No custom providers yet"}),(0,a.jsx)("p",{className:"mx-auto max-w-sm text-sm leading-relaxed text-text-muted",children:"Add an OpenAI- or Anthropic-compatible endpoint using the buttons above."})]})]}):eb(ep)]}),"oauth"===p&&eu.length>0&&(0,a.jsxs)("div",{className:"flex flex-col gap-4",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",{children:[(0,a.jsx)("p",{className:"font-mono text-[10px] uppercase tracking-[0.2em] text-text-subtle",children:"Sign in with provider account"}),(0,a.jsx)("h2",{className:"mt-0.5 text-lg font-semibold text-text-main",children:"OAuth Providers"})]}),(0,a.jsxs)("div",{className:"flex w-full flex-col gap-2 sm:w-auto sm:flex-row sm:items-center",children:[(0,a.jsx)(g,{}),ed("oauth")]})]}),eb(eu)]}),"free"===p&&eh.length>0&&(0,a.jsxs)("div",{className:"flex flex-col gap-4",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",{children:[(0,a.jsx)("p",{className:"font-mono text-[10px] uppercase tracking-[0.2em] text-text-subtle",children:"No-key / trial providers"}),(0,a.jsx)("h2",{className:"mt-0.5 text-lg font-semibold text-text-main",children:"Free Tier Providers"})]}),ed("free")]}),eb(eh)]}),"apikey"===p&&ef.length>0&&(0,a.jsxs)("div",{className:"flex flex-col gap-4",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",{children:[(0,a.jsx)("p",{className:"font-mono text-[10px] uppercase tracking-[0.2em] text-text-subtle",children:"Providers using an API key"}),(0,a.jsx)("h2",{className:"mt-0.5 text-lg font-semibold text-text-main",children:"API Key Providers"})]}),ed("apikey")]}),eb(ef),!er&&!T&&ei>0&&(0,a.jsxs)("button",{onClick:()=>$(!0),className:"flex w-full items-center justify-center gap-1.5 rounded-full border border-dashed border-text-subtle px-3 py-2.5 font-mono text-sm uppercase tracking-wider text-text-muted transition-colors hover:border-text-main hover:text-text-main focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-text-subtle/60",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"expand_more"}),"Show all ",ea.length," providers"]})]}),(0,a.jsx)(j,{variant:"openai",isOpen:R,onClose:()=>O(!1),onCreated:e=>{y(t=>[...t,e]),O(!1)}}),(0,a.jsx)(j,{variant:"anthropic",isOpen:E,onClose:()=>_(!1),onCreated:e=>{y(t=>[...t,e]),_(!1)}}),q&&(0,a.jsxs)("div",{className:"fixed inset-0 z-50 flex items-start justify-center px-3 pt-[6vh] sm:pt-[10vh]",onClick:()=>D(null),children:[(0,a.jsx)("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm"}),(0,a.jsxs)("div",{className:"relative bg-surface border border-border rounded-md w-full max-w-[600px] max-h-[86vh] sm:max-h-[80vh] overflow-y-auto shadow-2xl",onClick:e=>e.stopPropagation(),children:[(0,a.jsxs)("div",{className:"sticky top-0 z-10 flex items-center justify-between px-5 py-3 border-b border-border bg-surface/95 backdrop-blur-sm rounded-t-md",children:[(0,a.jsx)("h3",{className:"font-semibold",children:"Test Results"}),(0,a.jsx)("button",{onClick:()=>D(null),className:"p-1 rounded-lg hover:bg-bg text-text-muted hover:text-text-main transition-colors","aria-label":"Close test results",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-lg",children:"close"})})]}),(0,a.jsx)("div",{className:"p-5",children:(0,a.jsx)(S,{results:q})})]})]})]})}function P({icon:e,label:t,value:s,sub:r,tone:l}){return(0,a.jsxs)(o.Zp,{className:"flex items-center gap-3 p-3.5",children:[(0,a.jsx)("div",{className:"grid size-10 shrink-0 place-items-center rounded-lg bg-surface-2 text-text-muted",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[20px]",children:e})}),(0,a.jsxs)("div",{className:"min-w-0",children:[(0,a.jsx)("p",{className:"font-display text-xs font-medium text-text-muted",children:t}),(0,a.jsx)("p",{className:`font-display text-xl font-bold leading-tight ${{default:"text-text-main",success:"text-success",danger:"text-danger",brand:"text-text-main"}[l||"default"]}`,children:s}),r&&(0,a.jsx)("p",{className:"truncate text-[11px] text-text-muted",children:r})]})]})}function I({providerId:e,provider:t,stats:s,authType:r,onToggle:l,size:i="compact"}){let{connected:n,error:m,errorCode:p,errorTime:h,allDisabled:f}=s,b=!!t.noAuth,g=e.startsWith(x.JH),v=e.startsWith(x.DI),y=()=>g&&t.apiType?"responses"===t.apiType?"/providers/oai-r.png":"/providers/oai-cc.png":v?"/providers/anthropic-m.png":(0,d.HY)(t.id),j=f?"bg-text-subtle/40":m>0?"bg-danger":n>0?"bg-success":"bg-warning",N={free:"Free",oauth:"OAuth",apikey:"API Key",cookie:"Cookie",compatible:"Compatible"}[r]||"Provider",w=()=>f?(0,a.jsx)(o.Ex,{variant:"default",size:"sm",children:(0,a.jsxs)("span",{className:"flex items-center gap-1",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[12px]",children:"pause_circle"}),"Disabled"]})}):b?(0,a.jsx)(o.Ex,{variant:"success",size:"sm",dot:!0,children:"Ready"}):(0,a.jsxs)("span",{className:"flex items-center gap-1.5",children:[(0,a.jsx)("span",{className:`size-2 rounded-full ${j}`}),(0,a.jsx)("span",{className:"text-xs font-medium text-text-muted",children:m>0?p||"Error":n>0?"Connected":"Idle"}),"large"===i&&h&&(0,a.jsx)("span",{className:"font-mono text-[10px] uppercase tracking-wider text-text-subtle",children:h})]}),k=s.total>0&&(0,a.jsx)("div",{title:f?"Enable provider":"Disable provider",onClick:e=>{e.preventDefault(),e.stopPropagation(),l(!!f)},children:(0,a.jsx)(o.lM,{size:"sm",checked:!f,onChange:()=>{}})});return"large"===i?(0,a.jsx)(u(),{href:`/dashboard/providers/${e}`,className:"group min-w-0 sm:col-span-2",children:(0,a.jsxs)(o.Zp,{padding:"none",className:`relative h-full overflow-hidden transition-colors hover:bg-surface-2 cursor-pointer ${f?"opacity-60":""}`,children:[(0,a.jsxs)("div",{className:"flex items-center justify-between gap-2 px-4 pt-3",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:`size-2 rounded-full ${j}`}),(0,a.jsx)("span",{className:"font-mono text-[10px] uppercase tracking-[0.2em] text-text-subtle",children:f?"Disabled":m>0?"Error":n>0?"Connected":"Idle"})]}),(0,a.jsx)(o.Ex,{variant:"default",size:"sm",children:N})]}),(0,a.jsxs)("div",{className:"flex items-center gap-4 p-4 pt-3",children:[(0,a.jsx)("div",{className:"grid size-12 shrink-0 place-items-center rounded-xl bg-surface-2",children:(0,a.jsx)(c.A,{src:y(),alt:t.name,size:28,className:"object-contain rounded-md max-w-[30px] max-h-[30px]",fallbackText:t.textIcon||t.id.slice(0,2).toUpperCase(),fallbackColor:t.color})}),(0,a.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,a.jsx)("h3",{className:"truncate font-display text-base font-semibold text-text-main",children:t.name}),(0,a.jsx)("div",{className:"mt-1.5 flex min-w-0 flex-wrap items-center gap-2",children:w()})]}),(0,a.jsxs)("div",{className:"flex shrink-0 items-center gap-2",children:[k,(0,a.jsxs)("span",{className:"inline-flex h-7 items-center gap-1 rounded-md bg-bg px-2.5 text-xs font-medium text-text-muted transition-colors group-hover:text-text-main",children:["Manage",(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"chevron_right"})]})]})]})]})}):(0,a.jsx)(u(),{href:`/dashboard/providers/${e}`,className:"group min-w-0",children:(0,a.jsx)(o.Zp,{padding:"none",className:`relative h-full overflow-hidden transition-colors hover:bg-surface-2 cursor-pointer ${f?"opacity-60":""}`,children:(0,a.jsxs)("div",{className:"flex items-center gap-3 p-3",children:[(0,a.jsx)("div",{className:"grid size-11 shrink-0 place-items-center rounded-lg bg-surface-2",children:(0,a.jsx)(c.A,{src:y(),alt:t.name,size:24,className:"object-contain rounded-md max-w-[26px] max-h-[26px]",fallbackText:t.textIcon||t.id.slice(0,2).toUpperCase(),fallbackColor:t.color})}),(0,a.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,a.jsx)("h3",{className:"truncate font-display text-[13px] font-medium text-text-main",children:t.name}),(0,a.jsx)(o.Ex,{variant:"default",size:"sm",children:N})]}),(0,a.jsx)("div",{className:"mt-1 flex min-w-0 items-center gap-1.5",children:w()})]}),k,(0,a.jsx)("span",{className:"material-symbols-outlined text-[16px] text-text-subtle opacity-40 transition-opacity group-hover:opacity-100",children:"chevron_right"})]})})})}function S({results:e}){if(e.error&&!e.results)return(0,a.jsxs)("div",{className:"text-center py-6",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-red-500 text-[32px] mb-2 block",children:"error"}),(0,a.jsx)("p",{className:"text-sm text-red-400",children:e.error})]});let{summary:t,mode:s}=e,r=e.results||[];return(0,a.jsxs)("div",{className:"flex min-w-0 flex-col gap-3",children:[t&&(0,a.jsxs)("div",{className:"flex flex-wrap items-center gap-2 text-xs mb-1 sm:gap-3",children:[(0,a.jsxs)("span",{className:"text-text-muted",children:[{oauth:"OAuth",free:"Free",apikey:"API Key",provider:"Provider",all:"All"}[s]||s," Test"]}),(0,a.jsxs)("span",{className:"px-2 py-0.5 rounded bg-emerald-500/15 text-emerald-400 font-medium",children:[t.passed," passed"]}),t.failed>0&&(0,a.jsxs)("span",{className:"px-2 py-0.5 rounded bg-red-500/15 text-red-400 font-medium",children:[t.failed," failed"]}),(0,a.jsxs)("span",{className:"text-text-muted sm:ml-auto",children:[t.total," tested"]})]}),r.map((e,t)=>(0,a.jsxs)("div",{className:"flex min-w-0 flex-wrap items-center gap-2 rounded-md bg-surface-2 px-3 py-2 text-xs sm:flex-nowrap",children:[(0,a.jsx)("span",{className:`material-symbols-outlined text-[16px] ${e.valid?"text-emerald-500":"text-red-500"}`,children:e.valid?"check_circle":"error"}),(0,a.jsxs)("div",{className:"min-w-0 flex-[1_1_160px]",children:[(0,a.jsx)("span",{className:"block truncate font-medium sm:inline",children:e.connectionName}),(0,a.jsxs)("span",{className:"block truncate text-text-muted sm:ml-1.5 sm:inline",children:["(",e.provider,")"]})]}),void 0!==e.latencyMs&&(0,a.jsxs)("span",{className:"shrink-0 text-text-muted font-mono tabular-nums",children:[e.latencyMs,"ms"]}),(0,a.jsx)("span",{className:`shrink-0 text-[10px] uppercase font-bold px-1.5 py-0.5 rounded ${e.valid?"bg-emerald-500/15 text-emerald-400":"bg-red-500/15 text-red-400"}`,children:e.valid?"OK":e.diagnosis?.type||"ERROR"})]},e.connectionId||t)),0===r.length&&(0,a.jsx)("div",{className:"text-center py-4 text-text-muted text-sm",children:"No active connections found for this group."})]})}P.propTypes={icon:n().string.isRequired,label:n().string.isRequired,value:n().number.isRequired,sub:n().string,tone:n().string},I.propTypes={providerId:n().string.isRequired,provider:n().shape({id:n().string.isRequired,name:n().string.isRequired,color:n().string,textIcon:n().string,apiType:n().string}).isRequired,stats:n().shape({connected:n().number,error:n().number,errorCode:n().string,errorTime:n().string,total:n().number,allDisabled:n().bool}).isRequired,authType:n().string,onToggle:n().func,size:n().oneOf(["compact","large"])},S.propTypes={results:n().shape({mode:n().string,results:n().array,summary:n().shape({total:n().number,passed:n().number,failed:n().number}),error:n().string}).isRequired}},97080:(e,t,s)=>{Promise.resolve().then(s.bind(s,13950))}},e=>{e.O(0,[763,2470,705,3557,5497,8441,3794,7358],()=>e(e.s=97080)),_N_E=e.O()}]);
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[6812],{57076:(e,t,r)=>{"use strict";r.r(t),r.d(t,{default:()=>n});var l=r(95155),s=r(12115),o=r(35497),a=r(65921);function i(e={}){return{name:e.name||"",proxyUrl:e.proxyUrl||"",noProxy:e.noProxy||"",isActive:!1!==e.isActive,strictProxy:!0===e.strictProxy}}function n(){let[e,t]=(0,s.useState)([]),[r,n]=(0,s.useState)(!0),[d,c]=(0,s.useState)(!1),[x,p]=(0,s.useState)(!1),[m,h]=(0,s.useState)(!1),[u,y]=(0,s.useState)(!1),[f,g]=(0,s.useState)(!1),[j,b]=(0,s.useState)(!1),[v,k]=(0,s.useState)(!1),[N,w]=(0,s.useState)(null),[C,P]=(0,s.useState)(i()),[D,$]=(0,s.useState)(""),[T,S]=(0,s.useState)({vercelToken:"",projectName:"vercel-relay"}),[A,I]=(0,s.useState)({accountId:"",apiToken:"",projectName:"cloudflare-relay"}),[E,U]=(0,s.useState)({denoToken:"",orgDomain:"",projectName:""}),[O,R]=(0,s.useState)({netlifyToken:"",projectName:"netlify-relay"}),[F,W]=(0,s.useState)(!1),[z,_]=(0,s.useState)(!1),[L,q]=(0,s.useState)(!1),[V,G]=(0,s.useState)(null),[J,B]=(0,s.useState)([]),[M,H]=(0,s.useState)(!1),[Y,Q]=(0,s.useState)({current:0,total:0}),[K,Z]=(0,s.useState)(!1),[X,ee]=(0,s.useState)(null),et=(0,s.useRef)(null),er=(0,a.i)();(0,s.useEffect)(()=>{let e=e=>{et.current&&!et.current.contains(e.target)&&k(!1)};return v&&document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[v]);let el=(0,s.useCallback)(async()=>{try{let e=await fetch("/api/proxy-pools?includeUsage=true",{cache:"no-store"}),r=await e.json();e.ok&&t(r.proxyPools||[])}catch(e){console.log("Error fetching proxy pools:",e)}finally{n(!1)}},[]);(0,s.useEffect)(()=>{el()},[el]);let es=()=>{w(null),P(i())},eo=()=>{es(),c(!0)},ea=()=>{c(!1),es()},ei=async()=>{let e={name:C.name.trim(),proxyUrl:C.proxyUrl.trim(),noProxy:C.noProxy.trim(),isActive:!0===C.isActive,strictProxy:!0===C.strictProxy};if(e.name&&e.proxyUrl){W(!0);try{let t=!!N,r=await fetch(t?`/api/proxy-pools/${N.id}`:"/api/proxy-pools",{method:t?"PUT":"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(r.ok)await el(),ea(),er.success(N?"Proxy pool updated":"Proxy pool created");else{let e=await r.json();er.error(e.error||"Failed to save proxy pool")}}catch(e){console.log("Error saving proxy pool:",e)}finally{W(!1)}}},en=async e=>{ee({title:"Delete Proxy Pool",message:`Delete proxy pool "${e.name}"?`,onConfirm:async()=>{ee(null);try{let r=await fetch(`/api/proxy-pools/${e.id}`,{method:"DELETE"});if(r.ok){t(t=>t.filter(t=>t.id!==e.id)),er.success("Proxy pool deleted");return}let l=await r.json();409===r.status?er.warning(`Cannot delete: ${l.boundConnectionCount||0} connection(s) are still using this pool.`):er.error(l.error||"Failed to delete proxy pool")}catch(e){console.log("Error deleting proxy pool:",e),er.error("Failed to delete proxy pool")}}})},ed=async e=>{G(e);try{let t=await fetch(`/api/proxy-pools/${e}/test`,{method:"POST"}),r=await t.json();if(!t.ok)return void er.error(r.error||"Failed to test proxy");await el(),er.success(r.ok?"Proxy test passed":"Proxy test failed")}catch(e){console.log("Error testing proxy pool:",e),er.error("Failed to test proxy")}finally{G(null)}},ec=async e=>{let r=!e.isActive;t(t=>t.map(t=>t.id===e.id?{...t,isActive:r}:t));try{(await fetch(`/api/proxy-pools/${e.id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({isActive:r})})).ok||(t(t=>t.map(t=>t.id===e.id?{...t,isActive:e.isActive}:t)),er.error("Failed to update active state"))}catch(r){console.log("Error toggling active:",r),t(t=>t.map(t=>t.id===e.id?{...t,isActive:e.isActive}:t))}},ex=e.length>0&&J.length===e.length,ep=()=>B([]),em=async t=>{let r=J.length>0?J:e.map(e=>e.id);if(0!==r.length){Z(!0);try{let e=0,l=0;for(let s of r)try{(await fetch(`/api/proxy-pools/${s}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({isActive:t})})).ok?e+=1:l+=1}catch{l+=1}await el(),er.success(`${t?"Activated":"Deactivated"} ${e}${l?`, failed ${l}`:""}`)}finally{Z(!1)}}},eh=async()=>{0!==J.length&&ee({title:"Delete Proxy Pools",message:`Delete ${J.length} proxy pool(s)?`,onConfirm:async()=>{ee(null),Z(!0);try{let e=0,t=0,r=0;for(let l of J)try{let s=await fetch(`/api/proxy-pools/${l}`,{method:"DELETE"});s.ok?e+=1:409===s.status?t+=1:r+=1}catch{r+=1}await el(),ep(),er.success(`Deleted ${e}${t?`, ${t} bound`:""}${r?`, ${r} failed`:""}`)}finally{Z(!1)}}})},eu=async()=>{let t=J.length>0?e.filter(e=>J.includes(e.id)):e;if(0===t.length)return;H(!0),Q({current:0,total:t.length});let r=0,l=[],s=0,o=[...t],a=async()=>{for(;o.length>0;){let e=o.shift();if(!e)break;try{let t=await fetch(`/api/proxy-pools/${e.id}/test`,{method:"POST"}),s=await t.json();t.ok&&s.ok?r+=1:l.push(e.id)}catch{l.push(e.id)}finally{Q({current:s+=1,total:t.length})}}};await Promise.all(Array.from({length:Math.min(10,t.length)},a)),await el(),H(!1),Q({current:0,total:0}),l.length>0?ee({title:"Disable Dead Proxies",message:`Alive: ${r}, Dead: ${l.length}.
|
|
2
|
-
|
|
3
|
-
Disable ${l.length} dead proxies?`,onConfirm:async()=>{ee(null),Z(!0);try{for(let e of l)try{await fetch(`/api/proxy-pools/${e}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({isActive:!1})})}catch{}await el(),er.success(`Disabled ${l.length} dead proxies`)}finally{Z(!1)}}}):er.success(`Health check done. Alive: ${r}, Dead: ${l.length}`)};(0,s.useEffect)(()=>{B(t=>t.filter(t=>e.some(e=>e.id===t)))},[e]);let ey=()=>{z||p(!1)},ef=()=>{L||h(!1)},eg=()=>{L||y(!1)},ej=()=>{L||g(!1)},eb=()=>{L||b(!1)},ev=async()=>{if(T.vercelToken.trim()){q(!0);try{let e=await fetch("/api/proxy-pools/vercel-deploy",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(T)}),t=await e.json();e.ok?(await el(),ef(),er.success(`Deployed: ${t.deployUrl}`)):er.error(t.error||"Deploy failed")}catch(e){console.log("Error deploying Vercel relay:",e),er.error("Deploy failed")}finally{q(!1)}}},ek=async()=>{if(A.accountId.trim()&&A.apiToken.trim()){q(!0);try{let e=await fetch("/api/proxy-pools/cloudflare-deploy",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(A)}),t=await e.json();e.ok?(await el(),eg(),er.success(`Deployed: ${t.deployUrl}`)):er.error(t.error||"Deploy failed")}catch(e){console.log("Error deploying Cloudflare relay:",e),er.error("Deploy failed")}finally{q(!1)}}},eN=async()=>{if(E.denoToken.trim()){q(!0);try{let e=await fetch("/api/proxy-pools/deno-deploy",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(E)}),t=await e.json();e.ok?(await el(),ej(),er.success(`Deployed: ${t.deployUrl}`)):er.error(t.error||"Deploy failed")}catch(e){console.log("Error deploying Deno relay:",e),er.error("Deploy failed")}finally{q(!1)}}},ew=async()=>{if(O.netlifyToken.trim()){q(!0);try{let e=await fetch("/api/proxy-pools/netlify-deploy",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(O)}),t=await e.json();e.ok?(await el(),eb(),er.success(`Deployed: ${t.deployUrl}`)):er.error(t.error||"Deploy failed")}catch(e){console.log("Error deploying Netlify relay:",e),er.error("Deploy failed")}finally{q(!1)}}},eC=async()=>{let t=D.split(/\r?\n/).map(e=>e.trim()).filter(Boolean);if(0===t.length)return void er.warning("Please paste at least one proxy line.");let r=[],l=[];if(t.forEach((e,t)=>{try{let l=(e=>{let t=e.trim();if(!t)return null;if(t.includes("://")){let e=new URL(t),r=e.port?`${e.hostname}:${e.port}`:e.hostname;return{proxyUrl:e.toString(),name:`Imported ${r}`}}let r=t.split(":");if(4===r.length){let[e,t,l,s]=r;if(!e||!t||!l||!s)throw Error("Invalid host:port:user:pass format");return{proxyUrl:new URL(`http://${encodeURIComponent(l)}:${encodeURIComponent(s)}@${e}:${t}`).toString(),name:`Imported ${e}:${t}`}}throw Error("Unsupported format")})(e);l&&r.push({...l,lineNumber:t+1})}catch(e){l.push(`Line ${t+1}: ${e.message}`)}}),l.length>0)return void er.error(`Invalid proxy format:
|
|
4
|
-
${l.join("\n")}`);_(!0);try{let t=new Set(e.map(e=>`${(e.proxyUrl||"").trim()}|||${(e.noProxy||"").trim()}`)),l=0,s=0,o=0;for(let e of r){let r=`${e.proxyUrl}|||`;if(t.has(r)){s+=1;continue}(await fetch("/api/proxy-pools",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:e.name,proxyUrl:e.proxyUrl,noProxy:"",isActive:!0})})).ok?(l+=1,t.add(r)):o+=1}await el(),p(!1),er.success(`Batch import completed: Created ${l}, Skipped ${s}, Failed ${o}`)}catch(e){console.log("Error batch importing proxies:",e),er.error("Batch import failed")}finally{_(!1)}},eP=(0,s.useMemo)(()=>e.filter(e=>!0===e.isActive).length,[e]);return r?(0,l.jsxs)("div",{className:"flex w-full flex-col gap-4 px-1 sm:gap-6 sm:px-0",children:[(0,l.jsx)(o.Qv,{}),(0,l.jsx)(o.Qv,{})]}):(0,l.jsxs)("div",{className:"flex w-full flex-col gap-4 px-1 sm:gap-6 sm:px-0",children:[(0,l.jsxs)("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between",children:[(0,l.jsxs)("div",{className:"min-w-0",children:[(0,l.jsx)("h1",{className:"font-display text-2xl font-semibold tracking-tight text-text-main",children:"Proxy Pools"}),(0,l.jsx)("p",{className:"mt-1 font-mono text-[10px] uppercase tracking-wider text-text-subtle",children:"Rotating IP relay pools for outbound provider requests"})]}),(0,l.jsxs)("div",{className:"grid grid-cols-1 gap-2 sm:flex sm:items-center",children:[(0,l.jsxs)("div",{className:"relative",ref:et,children:[(0,l.jsxs)("button",{onClick:()=>k(!v),className:"inline-flex h-8 items-center justify-center gap-1.5 rounded-lg border border-border bg-surface px-3.5 text-sm font-display font-medium text-text-main transition-colors hover:border-text-subtle hover:bg-surface-2",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[17px] text-text-muted",children:"rocket_launch"}),"Deploy Relay",(0,l.jsx)("span",{className:"material-symbols-outlined text-[16px] text-text-subtle",children:v?"expand_less":"expand_more"})]}),v&&(0,l.jsxs)("div",{className:"absolute left-0 top-full z-50 mt-1 w-52 rounded-xl border border-border bg-surface p-1 shadow-warm sm:left-auto sm:right-0",children:[(0,l.jsxs)("button",{onClick:()=>{I({accountId:"",apiToken:"",projectName:"cloudflare-relay"}),y(!0),k(!1)},className:"flex w-full items-center gap-2 rounded-lg px-3 py-2 text-sm text-text-main transition-colors hover:bg-surface-2",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[18px] text-text-muted",children:"cloud"}),"Cloudflare Relay"]}),(0,l.jsxs)("button",{onClick:()=>{S({vercelToken:"",projectName:"vercel-relay"}),h(!0),k(!1)},className:"flex w-full items-center gap-2 rounded-lg px-3 py-2 text-sm text-text-main transition-colors hover:bg-surface-2",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[18px] text-text-muted",children:"cloud_upload"}),"Vercel Relay"]}),(0,l.jsxs)("button",{onClick:()=>{U({denoToken:"",orgDomain:"",projectName:""}),g(!0),k(!1)},className:"flex w-full items-center gap-2 rounded-lg px-3 py-2 text-sm text-text-main transition-colors hover:bg-surface-2",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[18px] text-text-muted",children:"terminal"}),"Deno Relay"]}),(0,l.jsxs)("button",{onClick:()=>{R({netlifyToken:"",projectName:"netlify-relay"}),b(!0),k(!1)},className:"flex w-full items-center gap-2 rounded-lg px-3 py-2 text-sm text-text-main transition-colors hover:bg-surface-2",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[18px] text-text-muted",children:"deployed_code"}),"Netlify Relay"]})]})]}),(0,l.jsxs)("button",{onClick:()=>{$(""),p(!0)},className:"inline-flex h-8 items-center justify-center gap-1.5 rounded-lg border border-border bg-surface px-3.5 text-sm font-display font-medium text-text-main transition-colors hover:border-text-subtle hover:bg-surface-2",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[17px] text-text-muted",children:"upload"}),"Batch Import"]}),(0,l.jsxs)("button",{onClick:eo,className:"inline-flex h-8 items-center justify-center gap-1.5 rounded-lg bg-primary px-3.5 text-sm font-display font-medium text-white transition-colors hover:bg-primary-hover",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[17px]",children:"add"}),"Add Proxy Pool"]})]})]}),(0,l.jsxs)(o.Zp,{children:[(0,l.jsxs)("div",{className:"mb-4 flex flex-wrap items-center gap-2",children:[e.length>0&&(0,l.jsxs)("label",{className:"flex items-center gap-1.5 text-xs text-text-muted cursor-pointer",children:[(0,l.jsx)("input",{type:"checkbox",checked:ex,onChange:()=>B(ex?[]:e.map(e=>e.id)),className:"size-4 rounded border-black/20 dark:border-white/20"}),ex?"Unselect all":"Select all"]}),(0,l.jsxs)("span",{className:"rounded-full border border-border bg-surface-2 px-2.5 py-0.5 font-mono text-[11px] uppercase tracking-wider text-text-muted",children:["Total: ",e.length]}),(0,l.jsxs)("span",{className:"rounded-full border border-border bg-surface-2 px-2.5 py-0.5 font-mono text-[11px] uppercase tracking-wider text-text-muted",children:["Active: ",eP]})]}),(J.length>0||M)&&(0,l.jsxs)("div",{className:"mb-4 flex flex-wrap items-center gap-2 rounded-lg border border-border bg-surface-2/50 px-3 py-2",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[18px] text-text-muted",children:"checklist"}),(0,l.jsx)("span",{className:"font-mono text-xs font-medium text-text-main",children:J.length>0?`${J.length} selected`:"All pools"}),(0,l.jsxs)("div",{className:"ml-auto flex flex-wrap items-center gap-2",children:[(0,l.jsx)(o.$n,{size:"sm",icon:M?"progress_activity":"health_and_safety",onClick:eu,disabled:M||K||0===e.length,children:M?`Checking ${Y.current}/${Y.total}`:"Health Check"}),J.length>0&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(o.$n,{size:"sm",variant:"secondary",icon:"toggle_on",onClick:()=>em(!0),disabled:K||M,children:"Activate"}),(0,l.jsx)(o.$n,{size:"sm",variant:"secondary",icon:"toggle_off",onClick:()=>em(!1),disabled:K||M,children:"Deactivate"}),(0,l.jsx)(o.$n,{size:"sm",variant:"secondary",icon:"delete",onClick:eh,disabled:K||M,children:"Delete"}),(0,l.jsx)(o.$n,{size:"sm",variant:"ghost",onClick:ep,disabled:K||M,children:"Clear"})]})]})]}),0===e.length?(0,l.jsxs)("div",{className:"flex flex-col items-center justify-center rounded-xl border border-dashed border-border bg-surface/40 px-6 py-12 text-center",children:[(0,l.jsx)("div",{className:"grid size-12 place-items-center rounded-xl border border-border bg-surface-2",children:(0,l.jsx)("span",{className:"material-symbols-outlined text-2xl text-text-muted",children:"public"})}),(0,l.jsx)("p",{className:"mt-4 font-display text-lg font-semibold text-text-main",children:"No proxy pool entries yet"}),(0,l.jsx)("p",{className:"mt-1 max-w-sm font-mono text-[11px] uppercase tracking-wider text-text-subtle",children:"Create a proxy pool entry, then assign it to connections."}),(0,l.jsxs)("button",{onClick:eo,className:"mt-6 inline-flex h-8 items-center justify-center gap-1.5 rounded-lg bg-primary px-3.5 text-sm font-display font-medium text-white transition-colors hover:bg-primary-hover",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[17px]",children:"add"}),"Add Proxy Pool"]})]}):(0,l.jsx)("div",{className:"flex flex-col divide-y divide-black/[0.04] dark:divide-white/[0.05]",children:e.map(e=>{var t;return(0,l.jsxs)("div",{className:"flex flex-col gap-3 py-3 sm:flex-row sm:items-center sm:justify-between",children:[(0,l.jsxs)("div",{className:"flex items-start gap-3 min-w-0 flex-1",children:[(0,l.jsx)("input",{type:"checkbox",checked:J.includes(e.id),onChange:()=>{let t;return t=e.id,B(e=>e.includes(t)?e.filter(e=>e!==t):[...e,t])},className:"mt-1 size-4 shrink-0 rounded border-black/20 dark:border-white/20"}),(0,l.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,l.jsxs)("div",{className:"flex items-center gap-2 flex-wrap",children:[(0,l.jsx)("p",{className:"min-w-0 max-w-full truncate font-display text-sm font-medium text-text-main sm:max-w-[18rem]",children:e.name}),(0,l.jsx)(o.Ex,{variant:"active"===(t=e.testStatus)?"success":"error"===t?"error":"default",size:"sm",dot:!0,children:e.testStatus||"unknown"}),(0,l.jsx)(o.Ex,{variant:e.isActive?"success":"default",size:"sm",children:e.isActive?"active":"inactive"}),"vercel"===e.type&&(0,l.jsx)(o.Ex,{variant:"default",size:"sm",children:"vercel relay"}),"cloudflare"===e.type&&(0,l.jsx)(o.Ex,{variant:"default",size:"sm",children:"cloudflare relay"}),"deno"===e.type&&(0,l.jsx)(o.Ex,{variant:"default",size:"sm",children:"deno relay"}),"netlify"===e.type&&(0,l.jsx)(o.Ex,{variant:"default",size:"sm",children:"netlify relay"}),(0,l.jsxs)(o.Ex,{variant:"default",size:"sm",children:[e.boundConnectionCount||0," bound"]})]}),(0,l.jsx)("p",{className:"truncate font-mono text-xs text-text-muted mt-1",children:e.proxyUrl}),e.noProxy?(0,l.jsxs)("p",{className:"truncate font-mono text-xs text-text-muted",children:["No proxy: ",e.noProxy]}):null,(0,l.jsxs)("p",{className:"font-mono text-[11px] text-text-muted mt-1",children:["Last tested: ",function(e){if(!e)return"Never";let t=new Date(e);return Number.isNaN(t.getTime())?"Never":t.toLocaleString()}(e.lastTestedAt),e.lastError?` \xb7 ${e.lastError}`:""]})]})]}),(0,l.jsxs)("div",{className:"flex items-center justify-end gap-1",children:[(0,l.jsx)(o.lM,{size:"sm",checked:!0===e.isActive,onChange:()=>ec(e),title:e.isActive?"Disable":"Enable"}),(0,l.jsx)("button",{onClick:()=>ed(e.id),className:"p-2 rounded hover:bg-surface-2 text-text-muted hover:text-primary",title:"Test proxy",disabled:V===e.id,children:(0,l.jsx)("span",{className:"material-symbols-outlined text-[18px]",style:V===e.id?{animation:"spin 1s linear infinite"}:void 0,children:V===e.id?"progress_activity":"science"})}),(0,l.jsx)("button",{onClick:()=>{w(e),P(i(e)),c(!0)},className:"p-2 rounded hover:bg-surface-2 text-text-muted hover:text-primary",title:"Edit",children:(0,l.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"edit"})}),(0,l.jsx)("button",{onClick:()=>en(e),className:"p-2 rounded hover:bg-danger/10 text-text-muted hover:text-danger",title:"Delete",children:(0,l.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"delete"})})]})]},e.id)})})]}),(0,l.jsx)(o.aF,{isOpen:x,title:"Batch Import Proxies",onClose:ey,children:(0,l.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,l.jsxs)("div",{children:[(0,l.jsx)("label",{className:"text-sm font-medium text-text-main mb-1 block",children:"Paste Proxy List (One per line)"}),(0,l.jsx)("textarea",{value:D,onChange:e=>$(e.target.value),placeholder:"http://user:pass@127.0.0.1:7897\n127.0.0.1:7897:user:pass",className:"w-full min-h-[180px] py-2 px-3 text-sm text-text-main bg-white dark:bg-white/5 border border-black/10 dark:border-white/10 rounded-md focus:ring-1 focus:ring-primary/30 focus:border-primary/50 focus:outline-none transition-all"}),(0,l.jsx)("p",{className:"text-xs text-text-muted mt-1",children:"Supported formats: protocol://user:pass@host:port, host:port:user:pass"})]}),(0,l.jsxs)("div",{className:"grid grid-cols-1 gap-2 sm:grid-cols-2",children:[(0,l.jsx)(o.$n,{fullWidth:!0,onClick:eC,disabled:!D.trim()||z,children:z?"Importing...":"Import"}),(0,l.jsx)(o.$n,{fullWidth:!0,variant:"ghost",onClick:ey,disabled:z,children:"Cancel"})]})]})}),(0,l.jsx)(o.aF,{isOpen:m,title:"Deploy Vercel Relay",onClose:ef,children:(0,l.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,l.jsxs)("div",{className:"rounded-lg border border-border bg-surface-2/50 p-3 flex flex-col gap-1.5",children:[(0,l.jsx)("p",{className:"text-sm text-text-main font-medium",children:"What is Vercel Relay?"}),(0,l.jsx)("p",{className:"text-xs text-text-muted",children:"Deploys an edge relay function to Vercel. All AI provider requests will be forwarded through Vercel's edge network, masking your real IP from providers."}),(0,l.jsxs)("ul",{className:"text-xs text-text-muted list-disc pl-4 space-y-0.5",children:[(0,l.jsx)("li",{children:"Your IP is replaced by Vercel's dynamic edge IPs (hundreds of IPs across 20+ global regions)"}),(0,l.jsx)("li",{children:"Vercel serves millions of apps - providers can't block Vercel IPs without affecting legitimate traffic"}),(0,l.jsx)("li",{children:"Free tier: 100GB bandwidth/month, 500K edge invocations"}),(0,l.jsx)("li",{children:"Deploy multiple relays on different accounts for more IP diversity"})]})]}),(0,l.jsx)(o.pd,{label:"Vercel API Token",value:T.vercelToken,onChange:e=>S(t=>({...t,vercelToken:e.target.value})),placeholder:"your-vercel-api-token",hint:(0,l.jsxs)(l.Fragment,{children:["Token is used once for deployment and not stored. ",(0,l.jsx)("a",{href:"https://vercel.com/account/tokens",target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline",children:"Get token →"})]}),type:"password"}),(0,l.jsx)(o.pd,{label:"Project Name",value:T.projectName,onChange:e=>S(t=>({...t,projectName:e.target.value})),placeholder:"my-relay",hint:"Unique name for your Vercel project. Leave empty for auto-generated name."}),(0,l.jsxs)("div",{className:"grid grid-cols-1 gap-2 sm:grid-cols-2",children:[(0,l.jsx)(o.$n,{fullWidth:!0,onClick:ev,disabled:!T.vercelToken.trim()||L,children:L?"Deploying... (may take ~1 min)":"Deploy"}),(0,l.jsx)(o.$n,{fullWidth:!0,variant:"ghost",onClick:ef,disabled:L,children:"Cancel"})]})]})}),(0,l.jsx)(o.aF,{isOpen:u,title:"Deploy Cloudflare Relay",onClose:eg,children:(0,l.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,l.jsxs)("div",{className:"rounded-lg border border-border bg-surface-2/50 p-3 flex flex-col gap-1.5",children:[(0,l.jsx)("p",{className:"text-sm text-text-main font-medium",children:"What is Cloudflare Relay?"}),(0,l.jsx)("p",{className:"text-xs text-text-muted",children:"Deploys a Cloudflare Worker as a proxy relay. All AI provider requests will be forwarded through Cloudflare's global edge network."}),(0,l.jsxs)("ul",{className:"text-xs text-text-muted list-disc pl-4 space-y-0.5",children:[(0,l.jsx)("li",{children:"High performance global routing and IP masking via Cloudflare Workers"}),(0,l.jsx)("li",{children:"Free tier: 100,000 requests per day"}),(0,l.jsx)("li",{children:"Requires Cloudflare Account ID and a Workers API Token (Edit Workers permission)"})]}),(0,l.jsxs)("div",{className:"mt-2 pt-2 border-t border-border text-xs text-text-muted",children:[(0,l.jsx)("p",{className:"font-medium text-text-main mb-1",children:"How to generate your API Token:"}),(0,l.jsxs)("ol",{className:"list-decimal pl-4 space-y-0.5",children:[(0,l.jsxs)("li",{children:["Go to ",(0,l.jsx)("b",{children:"My Profile"})," → ",(0,l.jsx)("b",{children:"API Tokens"})," → ",(0,l.jsx)("b",{children:"Create Token"})]}),(0,l.jsxs)("li",{children:["Scroll down to ",(0,l.jsx)("b",{children:"Custom Token"})," and click ",(0,l.jsx)("b",{children:"Get started"})]}),(0,l.jsxs)("li",{children:["Under ",(0,l.jsx)("b",{children:"Permissions"}),": Account | Workers Scripts | Edit"]}),(0,l.jsxs)("li",{children:["Under ",(0,l.jsx)("b",{children:"Account Resources"}),": Include | Account | ",(0,l.jsx)("i",{children:"Your Account Name"})]}),(0,l.jsxs)("li",{children:["Click ",(0,l.jsx)("b",{children:"Continue to summary"})," → ",(0,l.jsx)("b",{children:"Create Token"})]})]})]})]}),(0,l.jsx)(o.pd,{label:"Account ID",value:A.accountId,onChange:e=>I(t=>({...t,accountId:e.target.value})),placeholder:"your-cloudflare-account-id",hint:(0,l.jsx)(l.Fragment,{children:"Found on the right side of the Cloudflare dashboard overview page."})}),(0,l.jsx)(o.pd,{label:"API Token",value:A.apiToken,onChange:e=>I(t=>({...t,apiToken:e.target.value})),placeholder:"your-cloudflare-api-token",hint:(0,l.jsxs)(l.Fragment,{children:['Requires "Workers Scripts: Edit" permission. ',(0,l.jsx)("a",{href:"https://dash.cloudflare.com/profile/api-tokens",target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline",children:"Get token →"})]}),type:"password"}),(0,l.jsx)(o.pd,{label:"Worker Name",value:A.projectName,onChange:e=>I(t=>({...t,projectName:e.target.value})),placeholder:"my-relay",hint:"Unique name for your Cloudflare Worker. Leave empty for auto-generated name."}),(0,l.jsxs)("div",{className:"grid grid-cols-1 gap-2 sm:grid-cols-2",children:[(0,l.jsx)(o.$n,{fullWidth:!0,onClick:ek,disabled:!A.accountId.trim()||!A.apiToken.trim()||L,children:L?"Deploying...":"Deploy Worker"}),(0,l.jsx)(o.$n,{fullWidth:!0,variant:"ghost",onClick:eg,disabled:L,children:"Cancel"})]})]})}),(0,l.jsx)(o.aF,{isOpen:f,title:"Deploy Deno Relay",onClose:ej,children:(0,l.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,l.jsxs)("div",{className:"rounded-lg bg-surface-2/50 border border-border p-3 flex flex-col gap-1.5",children:[(0,l.jsx)("p",{className:"text-sm text-text-main font-medium",children:"What is Deno Relay?"}),(0,l.jsx)("p",{className:"text-xs text-text-muted",children:"Deploys a relay worker to Deno Deploy's global edge network. All AI provider requests are forwarded through Deno's edge, masking your real IP."}),(0,l.jsxs)("ul",{className:"text-xs text-text-muted list-disc pl-4 space-y-0.5",children:[(0,l.jsx)("li",{children:"Deno Deploy v2 runs on a high-performance global edge network"}),(0,l.jsx)("li",{children:"Free tier: 1M requests & 100GiB outbound traffic per month"}),(0,l.jsx)("li",{children:"No per-request CPU time limits (unlike Vercel/Cloudflare)"}),(0,l.jsx)("li",{children:"Support up to 20 active apps & 50 custom domains"}),(0,l.jsx)("li",{children:"Deploy multiple relays for maximum IP diversity"})]}),(0,l.jsxs)("div",{className:"mt-2 pt-2 border-t border-black/10 dark:border-white/10 text-xs text-text-muted",children:[(0,l.jsx)("p",{className:"font-medium text-text-main mb-1",children:"How to generate API token:"}),(0,l.jsxs)("ol",{className:"list-decimal pl-4 space-y-0.5",children:[(0,l.jsxs)("li",{children:["Go to ",(0,l.jsx)("b",{children:"console.deno.com"})]}),(0,l.jsxs)("li",{children:["Select your ",(0,l.jsx)("b",{children:"Organization"})," → ",(0,l.jsx)("b",{children:"Settings"})," → ",(0,l.jsx)("b",{children:"Organization Tokens"})]}),(0,l.jsxs)("li",{children:["Create a ",(0,l.jsx)("b",{children:"Organization Token"})," (prefix ",(0,l.jsx)("b",{children:"ddo_"}),")"]})]})]})]}),(0,l.jsx)(o.pd,{label:"Deno Deploy API Token",value:E.denoToken,onChange:e=>U(t=>({...t,denoToken:e.target.value})),placeholder:"ddo_xxxxxxxxxxxxxxxx",hint:(0,l.jsx)(l.Fragment,{children:"Token is used once for deployment, not stored. Found in Organization Settings."}),type:"password"}),(0,l.jsx)(o.pd,{label:"Organization Domain",value:E.orgDomain,onChange:e=>U(t=>({...t,orgDomain:e.target.value})),placeholder:"your-org.deno.net",hint:"Organization's default domain. Your relay URL will be in the format: https://my-relay.your-org.deno.net"}),(0,l.jsx)(o.pd,{label:"App Name",value:E.projectName,onChange:e=>U(t=>({...t,projectName:e.target.value})),placeholder:"deno-relay",hint:"Unique app name. Leave empty for auto-generated name."}),(0,l.jsxs)("div",{className:"grid grid-cols-1 gap-2 sm:grid-cols-2",children:[(0,l.jsx)(o.$n,{fullWidth:!0,onClick:eN,disabled:!E.denoToken.trim()||!E.orgDomain.trim()||L,children:L?"Deploying...":"Deploy Relay"}),(0,l.jsx)(o.$n,{fullWidth:!0,variant:"ghost",onClick:ej,disabled:L,children:"Cancel"})]})]})}),(0,l.jsx)(o.aF,{isOpen:j,title:"Deploy Netlify Relay",onClose:eb,children:(0,l.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,l.jsxs)("div",{className:"rounded-lg border border-border bg-surface-2/50 p-3 flex flex-col gap-1.5",children:[(0,l.jsx)("p",{className:"text-sm text-text-main font-medium",children:"What is Netlify Relay?"}),(0,l.jsx)("p",{className:"text-xs text-text-muted",children:"Deploys a serverless relay function to Netlify's global edge network. All AI provider requests are forwarded through Netlify's edge, masking your real IP."}),(0,l.jsxs)("ul",{className:"text-xs text-text-muted list-disc pl-4 space-y-0.5",children:[(0,l.jsx)("li",{children:"Runs on Netlify Functions with a 60-second execution limit and streaming support"}),(0,l.jsx)("li",{children:"Free tier: 125,000 function invocations and 100GB bandwidth per month"}),(0,l.jsx)("li",{children:"Relay URL format: https://your-site.netlify.app/.netlify/functions/relay"}),(0,l.jsx)("li",{children:"Deploy multiple relays on different accounts for more IP diversity"})]}),(0,l.jsxs)("div",{className:"mt-2 pt-2 border-t border-border text-xs text-text-muted",children:[(0,l.jsx)("p",{className:"font-medium text-text-main mb-1",children:"How to generate API token:"}),(0,l.jsxs)("ol",{className:"list-decimal pl-4 space-y-0.5",children:[(0,l.jsxs)("li",{children:["Go to ",(0,l.jsx)("b",{children:"User Settings"})," → ",(0,l.jsx)("b",{children:"Applications"})," → ",(0,l.jsx)("b",{children:"Personal access tokens"})]}),(0,l.jsxs)("li",{children:["Select ",(0,l.jsx)("b",{children:"New access token"})," and generate a token"]}),(0,l.jsx)("li",{children:"Copy the token - you won't see it again after leaving the page"})]})]})]}),(0,l.jsx)(o.pd,{label:"Netlify API Token",value:O.netlifyToken,onChange:e=>R(t=>({...t,netlifyToken:e.target.value})),placeholder:"nfp_xxxxxxxxxxxxxxxx",hint:(0,l.jsxs)(l.Fragment,{children:["Token is used once for deployment and not stored. ",(0,l.jsx)("a",{href:"https://app.netlify.com/user/applications#personal-access-tokens",target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline",children:"Get token →"})]}),type:"password"}),(0,l.jsx)(o.pd,{label:"Site Name",value:O.projectName,onChange:e=>R(t=>({...t,projectName:e.target.value})),placeholder:"netlify-relay",hint:"Unique site name (lowercase letters, numbers, hyphens). Your relay URL will be https://site-name.netlify.app/.netlify/functions/relay"}),(0,l.jsxs)("div",{className:"grid grid-cols-1 gap-2 sm:grid-cols-2",children:[(0,l.jsx)(o.$n,{fullWidth:!0,onClick:ew,disabled:!O.netlifyToken.trim()||L,children:L?"Deploying... (may take ~1 min)":"Deploy"}),(0,l.jsx)(o.$n,{fullWidth:!0,variant:"ghost",onClick:eb,disabled:L,children:"Cancel"})]})]})}),(0,l.jsx)(o.aF,{isOpen:d,title:N?"Edit Proxy Pool":"Add Proxy Pool",onClose:ea,children:(0,l.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,l.jsx)(o.pd,{label:"Name",value:C.name,onChange:e=>P(t=>({...t,name:e.target.value})),placeholder:"Office Proxy"}),(0,l.jsx)(o.pd,{label:"Proxy URL",value:C.proxyUrl,onChange:e=>P(t=>({...t,proxyUrl:e.target.value})),placeholder:"http://127.0.0.1:7897"}),(0,l.jsx)(o.pd,{label:"No Proxy",value:C.noProxy,onChange:e=>P(t=>({...t,noProxy:e.target.value})),placeholder:"localhost,127.0.0.1,.internal",hint:"Comma-separated hosts/domains to bypass proxy"}),(0,l.jsxs)("div",{className:"flex flex-col gap-3 rounded-lg border border-border/50 p-3 sm:flex-row sm:items-center sm:justify-between",children:[(0,l.jsxs)("div",{children:[(0,l.jsx)("p",{className:"font-medium text-sm",children:"Active"}),(0,l.jsx)("p",{className:"text-xs text-text-muted",children:"Inactive pools are ignored by runtime resolution."})]}),(0,l.jsx)(o.lM,{checked:!0===C.isActive,onChange:()=>P(e=>({...e,isActive:!e.isActive})),disabled:F})]}),(0,l.jsxs)("div",{className:"flex flex-col gap-3 rounded-lg border border-border/50 p-3 sm:flex-row sm:items-center sm:justify-between",children:[(0,l.jsxs)("div",{children:[(0,l.jsx)("p",{className:"font-medium text-sm",children:"Strict Proxy"}),(0,l.jsx)("p",{className:"text-xs text-text-muted",children:"Fail request if proxy is unreachable instead of falling back to direct."})]}),(0,l.jsx)(o.lM,{checked:!0===C.strictProxy,onChange:()=>P(e=>({...e,strictProxy:!e.strictProxy})),disabled:F})]}),(0,l.jsxs)("div",{className:"grid grid-cols-1 gap-2 sm:grid-cols-2",children:[(0,l.jsx)(o.$n,{fullWidth:!0,onClick:ei,disabled:!C.name.trim()||!C.proxyUrl.trim()||F,children:F?"Saving...":"Save"}),(0,l.jsx)(o.$n,{fullWidth:!0,variant:"ghost",onClick:ea,disabled:F,children:"Cancel"})]})]})}),(0,l.jsx)(o.uo,{isOpen:!!X,onClose:()=>ee(null),onConfirm:X?.onConfirm,title:X?.title||"Confirm",message:X?.message,variant:"danger"})]})}},81544:(e,t,r)=>{Promise.resolve().then(r.bind(r,57076))}},e=>{e.O(0,[763,2470,705,3557,5497,8441,3794,7358],()=>e(e.s=81544)),_N_E=e.O()}]);
|
package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/pxpipe/page-b275a947fc978997.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[7414],{15697:(e,t,s)=>{Promise.resolve().then(s.bind(s,71470))},71470:(e,t,s)=>{"use strict";s.d(t,{default:()=>j});var a=s(95155),l=s(12115),r=s(21742),i=s(90639),d=s(77496),n=s(32539),o=s(59656),x=s(1162),c=s(97779),m=s(35497);let p=e=>e>=1e6?`${(e/1e6).toFixed(2)}M`:e>=1e3?`${(e/1e3).toFixed(1)}K`:String(e||0),h=[{id:"today",label:"Today"},{id:"yesterday",label:"Yesterday"},{id:"last7d",label:"7 days"},{id:"last30d",label:"30 days"},{id:"all",label:"All time"}],u={applied:"Prompt exceeded threshold",below_threshold:"Below size threshold",not_profitable:"Compression not profitable",below_min_chars:"Below minimum chars",below_min_tokens:"Below minimum tokens",unsupported_model:"Model not in allowlist",unsupported_format:"Non-Claude request format",timeout:"Compression timed out",transform_error:"Transform error",passthrough:"Passthrough",disabled:"Disabled",not_installed:"Not installed"};function g({label:e,value:t,sub:s,tone:l}){return(0,a.jsxs)(m.Zp,{className:"p-4",children:[(0,a.jsx)("p",{className:"text-xs text-text-muted uppercase tracking-wide",children:e}),(0,a.jsx)("p",{className:`text-xl font-semibold mt-1 ${l||""}`,children:t}),s&&(0,a.jsx)("p",{className:"text-xs text-text-muted mt-0.5",children:s})]})}function j(){let[e,t]=(0,l.useState)(null),[s,j]=(0,l.useState)(null),[b,f]=(0,l.useState)(null),[N,y]=(0,l.useState)(null),[v,w]=(0,l.useState)("last7d"),[k,S]=(0,l.useState)(!0),P=(0,l.useCallback)(async()=>{S(!0);try{let[e,s,a]=await Promise.all([fetch("/api/pxpipe/status",{headers:{"Cache-Control":"no-store"}}),fetch("/api/pxpipe/stats"),fetch("/api/pxpipe/logs?limit=50")]);t(await e.json()),f(await s.json()),y(await a.json());let l=await fetch("/api/pxpipe/health",{method:"POST"});j(await l.json())}catch{}finally{S(!1)}},[]);(0,l.useEffect)(()=>{P()},[P]);let E=b?.windows?.[v],$=e?e.installed?s?.healthy?"Healthy":e.running?"Running":"Stopped":"Not installed":"-";return(0,a.jsxs)("div",{className:"space-y-6 p-6",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between flex-wrap gap-3",children:[(0,a.jsxs)("h2",{className:"text-lg font-semibold flex items-center gap-2",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-primary",children:"image"}),"PXPIPE Dashboard"]}),(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("a",{href:"/dashboard/token-saver",className:"text-xs text-primary underline hover:opacity-80",children:"Token Saver settings"}),(0,a.jsx)(m.$n,{size:"sm",variant:"ghost",onClick:P,disabled:k,children:k?"Refreshing…":"Refresh"})]})]}),(0,a.jsxs)("div",{className:"grid grid-cols-2 md:grid-cols-3 lg:grid-cols-6 gap-3",children:[(0,a.jsx)(g,{label:"Status",value:$,tone:s?.healthy?"text-success":e?.installed?"text-warning":"text-text-muted",sub:e?.enabled?"Enabled in pipeline":"Disabled in pipeline"}),(0,a.jsx)(g,{label:"Version",value:e?.version?`v${e.version}`:"-",sub:"pxpipe-proxy"}),(0,a.jsx)(g,{label:"Uptime",value:(e=>{if(!e||e<=0)return"-";let t=Math.floor(e/6e4),s=Math.floor(t/60);return s>0?`${s}h${String(t%60).padStart(2,"0")}m`:`${t}m`})(e?.uptimeMs),sub:"module loaded"}),(0,a.jsx)(g,{label:"Requests",value:E?E.requests.toLocaleString():"-"}),(0,a.jsx)(g,{label:"Compressed",value:E?E.compressed.toLocaleString():"-",tone:"text-success"}),(0,a.jsx)(g,{label:"Bypassed",value:E?E.bypassed.toLocaleString():"-"})]}),(0,a.jsxs)(m.Zp,{className:"p-4",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between flex-wrap gap-3 mb-4",children:[(0,a.jsx)("h3",{className:"font-medium",children:"Token savings (estimated)"}),(0,a.jsx)("div",{className:"flex items-center gap-1 rounded-lg border border-border bg-bg-subtle p-1",children:h.map(e=>(0,a.jsx)("button",{onClick:()=>w(e.id),className:`px-3 py-1 rounded-md text-xs font-medium transition-colors ${v===e.id?"bg-primary text-white shadow-sm":"text-text-muted hover:text-text hover:bg-bg-hover"}`,children:e.label},e.id))})]}),(0,a.jsxs)("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4 text-center",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"text-xs text-text-muted",children:"Original tokens"}),(0,a.jsx)("p",{className:"text-lg font-semibold",children:E?p(E.tokensBeforeEst):"-"})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"text-xs text-text-muted",children:"After PXPIPE"}),(0,a.jsx)("p",{className:"text-lg font-semibold",children:E?p(E.tokensAfterEst):"-"})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"text-xs text-text-muted",children:"Saved"}),(0,a.jsx)("p",{className:"text-lg font-semibold text-success",children:E?p(E.tokensSavedEst):"-"})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"text-xs text-text-muted",children:"Reduction"}),(0,a.jsx)("p",{className:"text-lg font-semibold text-success",children:E?`${E.savedPct}%`:"-"})]})]}),(0,a.jsxs)("p",{className:"text-xs text-text-muted mt-3",children:["Estimates from body size before/after imaging; billed usage per request (recorded on the Usage page) remains the ground truth. Images generated:"," ",E?E.imagesGenerated.toLocaleString():"-"," \xb7 avg compression time:"," ",E?`${E.avgCompressionMs}ms`:"-"," \xb7 errors: ",E?E.errors:"-"]})]}),(0,a.jsxs)(m.Zp,{className:"p-4",children:[(0,a.jsx)("h3",{className:"font-medium mb-3",children:"Tokens saved - last 30 days"}),b?.timeline?.some(e=>e.tokensSavedEst>0)?(0,a.jsx)(r.u,{width:"100%",height:220,children:(0,a.jsxs)(i.Q,{data:b.timeline,margin:{top:4,right:8,left:0,bottom:0},children:[(0,a.jsx)("defs",{children:(0,a.jsxs)("linearGradient",{id:"gradPxpipe",x1:"0",y1:"0",x2:"0",y2:"1",children:[(0,a.jsx)("stop",{offset:"5%",stopColor:"#10b981",stopOpacity:.25}),(0,a.jsx)("stop",{offset:"95%",stopColor:"#10b981",stopOpacity:0})]})}),(0,a.jsx)(d.d,{strokeDasharray:"3 3",strokeOpacity:.2}),(0,a.jsx)(n.W,{dataKey:"date",tick:{fontSize:11},tickFormatter:e=>e.slice(5)}),(0,a.jsx)(o.h,{tick:{fontSize:11},tickFormatter:p,width:48}),(0,a.jsx)(x.m,{formatter:e=>[p(e),"Tokens saved"],labelFormatter:e=>e}),(0,a.jsx)(c.Gk,{type:"monotone",dataKey:"tokensSavedEst",stroke:"#10b981",fill:"url(#gradPxpipe)",strokeWidth:2})]})}):(0,a.jsx)("div",{className:"h-32 flex items-center justify-center text-text-muted text-sm",children:"No savings recorded yet - enable PXPIPE in the Token Saver and route a large Claude-format request."})]}),(0,a.jsxs)(m.Zp,{className:"p-4",children:[(0,a.jsx)("h3",{className:"font-medium mb-3",children:"History"}),(0,a.jsx)("div",{className:"overflow-x-auto",children:(0,a.jsxs)("table",{className:"w-full text-sm",children:[(0,a.jsx)("thead",{children:(0,a.jsxs)("tr",{className:"text-left text-xs text-text-muted border-b border-border",children:[(0,a.jsx)("th",{className:"py-2 pr-3",children:"Time"}),(0,a.jsx)("th",{className:"py-2 pr-3",children:"Model"}),(0,a.jsx)("th",{className:"py-2 pr-3 text-right",children:"Original"}),(0,a.jsx)("th",{className:"py-2 pr-3 text-right",children:"Compressed"}),(0,a.jsx)("th",{className:"py-2 pr-3 text-right",children:"Saved"}),(0,a.jsx)("th",{className:"py-2 pr-3 text-right",children:"%"}),(0,a.jsx)("th",{className:"py-2 pr-3 text-right",children:"Duration"}),(0,a.jsx)("th",{className:"py-2",children:"Status"})]})}),(0,a.jsxs)("tbody",{children:[(b?.recent||[]).slice(0,50).map((e,t)=>(0,a.jsxs)("tr",{className:"border-b border-border/50",children:[(0,a.jsx)("td",{className:"py-1.5 pr-3 whitespace-nowrap text-text-muted",children:new Date(e.ts).toLocaleString()}),(0,a.jsx)("td",{className:"py-1.5 pr-3 font-mono text-xs",children:e.provider?`${e.provider}/${e.model}`:e.model||"-"}),(0,a.jsx)("td",{className:"py-1.5 pr-3 text-right font-mono text-xs",children:e.applied?p(e.tokensBeforeEst):"-"}),(0,a.jsx)("td",{className:"py-1.5 pr-3 text-right font-mono text-xs",children:e.applied?p(e.tokensAfterEst):"-"}),(0,a.jsx)("td",{className:"py-1.5 pr-3 text-right font-mono text-xs text-success",children:e.applied?p(e.tokensSavedEst):"-"}),(0,a.jsx)("td",{className:"py-1.5 pr-3 text-right font-mono text-xs",children:e.applied?`${e.savedPct}%`:"-"}),(0,a.jsx)("td",{className:"py-1.5 pr-3 text-right font-mono text-xs",children:null!=e.durationMs?`${e.durationMs}ms`:"-"}),(0,a.jsx)("td",{className:"py-1.5",children:(0,a.jsx)("span",{className:`text-xs px-2 py-0.5 rounded ${e.applied?"bg-success/15 text-success":"transform_error"===e.reason||"timeout"===e.reason?"bg-danger/15 text-danger":"bg-warning/15 text-warning"}`,title:e.detail||"",children:e.applied?"Compressed":u[e.reason]||e.reason})})]},`${e.ts}-${t}`)),(!b?.recent||0===b.recent.length)&&(0,a.jsx)("tr",{children:(0,a.jsx)("td",{colSpan:8,className:"py-6 text-center text-text-muted text-sm",children:"No PXPIPE activity yet"})})]})]})})]}),(0,a.jsxs)(m.Zp,{className:"p-4",id:"logs",children:[(0,a.jsx)("h3",{className:"font-medium mb-3",children:"PXPIPE Logs"}),N?.installLog?(0,a.jsx)("pre",{className:"rounded bg-black/5 dark:bg-white/5 p-3 text-xs font-mono overflow-x-auto max-h-64 overflow-y-auto whitespace-pre-wrap",children:N.installLog}):(0,a.jsx)("p",{className:"text-sm text-text-muted",children:"No install log yet."})]})]})}}},e=>{e.O(0,[763,3842,4285,1649,2470,705,3557,5497,8441,3794,7358],()=>e(e.s=15697)),_N_E=e.O()}]);
|