@amir83nasr/10router 0.1.11 → 0.1.14
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/.next/BUILD_ID +1 -1
- package/.next/app-path-routes-manifest.json +5 -6
- package/.next/build-manifest.json +2 -2
- package/.next/prerender-manifest.json +22 -50
- package/.next/routes-manifest.json +0 -6
- package/.next/server/app/(dashboard)/dashboard/cli-tools/[toolId]/page.js +2 -2
- package/.next/server/app/(dashboard)/dashboard/cli-tools/[toolId]/page_client-reference-manifest.js +1 -1
- package/.next/server/app/(dashboard)/dashboard/cli-tools/page.js +1 -1
- package/.next/server/app/(dashboard)/dashboard/cli-tools/page_client-reference-manifest.js +1 -1
- package/.next/server/app/(dashboard)/dashboard/combos/page.js +1 -1
- package/.next/server/app/(dashboard)/dashboard/combos/page_client-reference-manifest.js +1 -1
- package/.next/server/app/(dashboard)/dashboard/console-log/page.js +1 -1
- package/.next/server/app/(dashboard)/dashboard/console-log/page_client-reference-manifest.js +1 -1
- package/.next/server/app/(dashboard)/dashboard/endpoint/page.js +1 -1
- package/.next/server/app/(dashboard)/dashboard/endpoint/page_client-reference-manifest.js +1 -1
- package/.next/server/app/(dashboard)/dashboard/media-providers/systemone/[id]/page.js +2 -2
- package/.next/server/app/(dashboard)/dashboard/media-providers/systemone/[id]/page_client-reference-manifest.js +1 -1
- package/.next/server/app/(dashboard)/dashboard/media-providers/systemone/page.js +1 -1
- package/.next/server/app/(dashboard)/dashboard/media-providers/systemone/page_client-reference-manifest.js +1 -1
- package/.next/server/app/(dashboard)/dashboard/page.js +1 -1
- package/.next/server/app/(dashboard)/dashboard/page_client-reference-manifest.js +1 -1
- package/.next/server/app/(dashboard)/dashboard/profile/page.js +1 -1
- package/.next/server/app/(dashboard)/dashboard/profile/page_client-reference-manifest.js +1 -1
- package/.next/server/app/(dashboard)/dashboard/providers/[id]/page.js +2 -2
- package/.next/server/app/(dashboard)/dashboard/providers/[id]/page_client-reference-manifest.js +1 -1
- package/.next/server/app/(dashboard)/dashboard/providers/new/page.js +1 -1
- package/.next/server/app/(dashboard)/dashboard/providers/new/page_client-reference-manifest.js +1 -1
- package/.next/server/app/(dashboard)/dashboard/providers/page.js +1 -1
- package/.next/server/app/(dashboard)/dashboard/providers/page_client-reference-manifest.js +1 -1
- package/.next/server/app/(dashboard)/dashboard/proxy-pools/page.js +1 -1
- package/.next/server/app/(dashboard)/dashboard/proxy-pools/page_client-reference-manifest.js +1 -1
- package/.next/server/app/(dashboard)/dashboard/pxpipe/page.js +1 -1
- package/.next/server/app/(dashboard)/dashboard/pxpipe/page_client-reference-manifest.js +1 -1
- package/.next/server/app/(dashboard)/dashboard/quota/page.js +1 -1
- package/.next/server/app/(dashboard)/dashboard/quota/page_client-reference-manifest.js +1 -1
- package/.next/server/app/(dashboard)/dashboard/token-saver/page.js +1 -1
- package/.next/server/app/(dashboard)/dashboard/token-saver/page_client-reference-manifest.js +1 -1
- package/.next/server/app/(dashboard)/dashboard/usage/page.js +1 -1
- package/.next/server/app/(dashboard)/dashboard/usage/page_client-reference-manifest.js +1 -1
- package/.next/server/app/_global-error/page.js +2 -2
- package/.next/server/app/_global-error/page_client-reference-manifest.js +1 -1
- package/.next/server/app/_global-error.html +1 -1
- package/.next/server/app/_global-error.rsc +1 -1
- package/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/.next/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
- package/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/.next/server/app/_not-found/page.js +1 -1
- package/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/.next/server/app/_not-found.html +1 -1
- package/.next/server/app/_not-found.rsc +6 -6
- package/.next/server/app/_not-found.segments/_full.segment.rsc +6 -6
- package/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +6 -6
- package/.next/server/app/_not-found.segments/_tree.segment.rsc +2 -2
- package/.next/server/app/api/auth/login/route.js +1 -1
- package/.next/server/app/api/auth/logout/route.js +1 -1
- package/.next/server/app/api/auth/oidc/callback/route.js +1 -1
- package/.next/server/app/api/auth/oidc/start/route.js +1 -1
- package/.next/server/app/api/auth/oidc/test/route.js +1 -1
- package/.next/server/app/api/auth/reset-password/route.js +1 -1
- package/.next/server/app/api/auth/saml/acs/route.js +1 -1
- package/.next/server/app/api/auth/saml/metadata/route.js +2 -2
- package/.next/server/app/api/auth/saml/start/route.js +2 -2
- package/.next/server/app/api/auth/saml/test/route.js +1 -1
- package/.next/server/app/api/auth/status/route.js +1 -1
- package/.next/server/app/api/changelog/route.js +1 -1
- package/.next/server/app/api/cli-tools/all-statuses/route.js +1 -1
- package/.next/server/app/api/cli-tools/claude-settings/route.js +1 -1
- package/.next/server/app/api/cli-tools/codex-settings/route.js +1 -1
- package/.next/server/app/api/cli-tools/cowork-mcp-registry/route.js +1 -1
- package/.next/server/app/api/cli-tools/cowork-mcp-tools/route.js +2 -2
- package/.next/server/app/api/cli-tools/cowork-settings/route.js +1 -1
- package/.next/server/app/api/cli-tools/dsh-settings/route.js +1 -1
- package/.next/server/app/api/cli-tools/opencode-settings/route.js +1 -1
- package/.next/server/app/api/combos/[id]/route.js +1 -1
- package/.next/server/app/api/combos/route.js +1 -1
- package/.next/server/app/api/headroom/extras/route.js +1 -1
- package/.next/server/app/api/headroom/proxy/[...path]/route.js +1 -1
- package/.next/server/app/api/headroom/restart/route.js +1 -1
- package/.next/server/app/api/headroom/start/route.js +1 -1
- package/.next/server/app/api/headroom/status/route.js +1 -1
- package/.next/server/app/api/headroom/stop/route.js +1 -1
- package/.next/server/app/api/health/route.js +1 -1
- package/.next/server/app/api/init/route.js +1 -1
- package/.next/server/app/api/keys/[id]/route.js +1 -1
- package/.next/server/app/api/keys/route.js +1 -1
- package/.next/server/app/api/locale/route.js +1 -1
- package/.next/server/app/api/mcp/[plugin]/message/route.js +1 -1
- package/.next/server/app/api/mcp/[plugin]/sse/route.js +1 -1
- package/.next/server/app/api/media-providers/tts/deepgram/voices/route.js +1 -1
- package/.next/server/app/api/media-providers/tts/elevenlabs/voices/route.js +1 -1
- package/.next/server/app/api/media-providers/tts/inworld/voices/route.js +1 -1
- package/.next/server/app/api/media-providers/tts/minimax/voices/route.js +1 -1
- package/.next/server/app/api/media-providers/tts/voices/route.js +1 -1
- package/.next/server/app/api/models/alias/route.js +1 -1
- package/.next/server/app/api/models/availability/route.js +1 -1
- package/.next/server/app/api/models/catalog-sync/route.js +1 -1
- package/.next/server/app/api/models/custom/route.js +1 -1
- package/.next/server/app/api/models/disabled/route.js +1 -1
- package/.next/server/app/api/models/route.js +1 -1
- package/.next/server/app/api/models/test/route.js +1 -1
- package/.next/server/app/api/oauth/[provider]/[action]/route.js +1 -1
- package/.next/server/app/api/oauth/codex/bulk-import/route.js +1 -1
- package/.next/server/app/api/oauth/codex/import-token/route.js +1 -1
- package/.next/server/app/api/oauth/cursor/auto-import/route.js +2 -2
- package/.next/server/app/api/oauth/cursor/import/route.js +1 -1
- package/.next/server/app/api/oauth/gitlab/pat/route.js +1 -1
- package/.next/server/app/api/oauth/grok-cli/bulk-import/route.js +1 -1
- package/.next/server/app/api/oauth/iflow/cookie/route.js +1 -1
- package/.next/server/app/api/oauth/xiaomi-mimo/api-key/route.js +1 -1
- package/.next/server/app/api/oauth/xiaomi-mimo/auto-import/route.js +2 -2
- package/.next/server/app/api/pricing/route.js +1 -1
- package/.next/server/app/api/provider-nodes/[id]/route.js +1 -1
- package/.next/server/app/api/provider-nodes/route.js +1 -1
- package/.next/server/app/api/provider-nodes/validate/route.js +1 -1
- package/.next/server/app/api/providers/[id]/models/route.js +1 -1
- package/.next/server/app/api/providers/[id]/route.js +1 -1
- package/.next/server/app/api/providers/[id]/test/route.js +1 -1
- package/.next/server/app/api/providers/[id]/test-models/route.js +1 -1
- package/.next/server/app/api/providers/client/route.js +1 -1
- package/.next/server/app/api/providers/kilo/free-models/route.js +1 -1
- package/.next/server/app/api/providers/route.js +1 -1
- package/.next/server/app/api/providers/suggested-models/route.js +1 -1
- package/.next/server/app/api/providers/test-batch/route.js +1 -1
- package/.next/server/app/api/providers/validate/route.js +1 -1
- package/.next/server/app/api/proxy-pools/[id]/route.js +1 -1
- package/.next/server/app/api/proxy-pools/[id]/test/route.js +1 -1
- package/.next/server/app/api/proxy-pools/cloudflare-deploy/route.js +2 -2
- package/.next/server/app/api/proxy-pools/deno-deploy/route.js +2 -2
- package/.next/server/app/api/proxy-pools/route.js +1 -1
- package/.next/server/app/api/proxy-pools/vercel-deploy/route.js +2 -2
- package/.next/server/app/api/pxpipe/health/route.js +2 -2
- package/.next/server/app/api/pxpipe/install/route.js +1 -1
- package/.next/server/app/api/pxpipe/logs/route.js +1 -1
- package/.next/server/app/api/pxpipe/restart/route.js +1 -1
- package/.next/server/app/api/pxpipe/start/route.js +1 -1
- package/.next/server/app/api/pxpipe/stats/route.js +1 -1
- package/.next/server/app/api/pxpipe/status/route.js +1 -1
- package/.next/server/app/api/pxpipe/stop/route.js +1 -1
- package/.next/server/app/api/settings/database/route.js +1 -1
- package/.next/server/app/api/settings/proxy-test/route.js +1 -1
- package/.next/server/app/api/settings/require-login/route.js +1 -1
- package/.next/server/app/api/settings/route.js +1 -1
- package/.next/server/app/api/shutdown/route.js +1 -1
- package/.next/server/app/api/tags/route.js +1 -1
- package/.next/server/app/api/translator/console-logs/route.js +1 -1
- package/.next/server/app/api/translator/console-logs/stream/route.js +1 -1
- package/.next/server/app/api/translator/load/route.js +1 -1
- package/.next/server/app/api/translator/save/route.js +1 -1
- package/.next/server/app/api/translator/send/route.js +1 -1
- package/.next/server/app/api/translator/translate/route.js +1 -1
- package/.next/server/app/api/tunnel/disable/route.js +1 -1
- package/.next/server/app/api/tunnel/enable/route.js +1 -1
- package/.next/server/app/api/tunnel/status/route.js +1 -1
- package/.next/server/app/api/tunnel/tailscale-check/route.js +1 -1
- package/.next/server/app/api/tunnel/tailscale-disable/route.js +1 -1
- package/.next/server/app/api/tunnel/tailscale-enable/route.js +1 -1
- package/.next/server/app/api/tunnel/tailscale-install/route.js +2 -2
- package/.next/server/app/api/usage/[connectionId]/codex-reset-credits/route.js +1 -1
- package/.next/server/app/api/usage/[connectionId]/route.js +1 -1
- package/.next/server/app/api/usage/chart/route.js +1 -1
- package/.next/server/app/api/usage/health/route.js +1 -1
- package/.next/server/app/api/usage/history/route.js +1 -1
- package/.next/server/app/api/usage/logs/route.js +1 -1
- package/.next/server/app/api/usage/providers/route.js +1 -1
- package/.next/server/app/api/usage/request-details/route.js +1 -1
- package/.next/server/app/api/usage/request-logs/route.js +1 -1
- package/.next/server/app/api/usage/stats/route.js +1 -1
- package/.next/server/app/api/usage/stream/route.js +2 -2
- package/.next/server/app/api/v1/api/chat/route.js +1 -1
- package/.next/server/app/api/v1/audio/speech/route.js +1 -1
- package/.next/server/app/api/v1/audio/transcriptions/route.js +1 -1
- package/.next/server/app/api/v1/audio/voices/route.js +1 -1
- package/.next/server/app/api/v1/chat/completions/route.js +1 -1
- package/.next/server/app/api/v1/embeddings/route.js +1 -1
- package/.next/server/app/api/v1/images/generations/route.js +2 -2
- package/.next/server/app/api/v1/messages/count_tokens/route.js +1 -1
- package/.next/server/app/api/v1/messages/route.js +1 -1
- package/.next/server/app/api/v1/models/[...model]/route.js +1 -1
- package/.next/server/app/api/v1/models/info/route.js +1 -1
- package/.next/server/app/api/v1/models/route.js +1 -1
- package/.next/server/app/api/v1/responses/compact/route.js +1 -1
- package/.next/server/app/api/v1/responses/route.js +1 -1
- package/.next/server/app/api/v1/route.js +1 -1
- package/.next/server/app/api/v1/search/route.js +1 -1
- package/.next/server/app/api/v1/systemone/route.js +1 -1
- package/.next/server/app/api/v1/videos/[id]/route.js +1 -1
- package/.next/server/app/api/v1/videos/edits/route.js +1 -1
- package/.next/server/app/api/v1/videos/extensions/route.js +1 -1
- package/.next/server/app/api/v1/videos/generations/route.js +1 -1
- package/.next/server/app/api/v1/web/fetch/route.js +1 -1
- package/.next/server/app/api/v1beta/models/[...path]/route.js +1 -1
- package/.next/server/app/api/v1beta/models/route.js +1 -1
- package/.next/server/app/api/version/route.js +1 -1
- package/.next/server/app/api/version/shutdown/route.js +1 -1
- package/.next/server/app/api/version/update/route.js +1 -1
- package/.next/server/app/callback/page.js +1 -1
- package/.next/server/app/callback/page_client-reference-manifest.js +1 -1
- package/.next/server/app/callback.html +1 -1
- package/.next/server/app/callback.rsc +7 -7
- package/.next/server/app/callback.segments/_full.segment.rsc +7 -7
- package/.next/server/app/callback.segments/_tree.segment.rsc +2 -2
- package/.next/server/app/callback.segments/callback/__PAGE__.segment.rsc +7 -7
- package/.next/server/app/dashboard/cli-tools.html +1 -1
- package/.next/server/app/dashboard/cli-tools.rsc +9 -9
- package/.next/server/app/dashboard/cli-tools.segments/!KGRhc2hib2FyZCk/dashboard/cli-tools/__PAGE__.segment.rsc +8 -8
- package/.next/server/app/dashboard/cli-tools.segments/_full.segment.rsc +9 -9
- package/.next/server/app/dashboard/cli-tools.segments/_tree.segment.rsc +2 -2
- package/.next/server/app/dashboard/combos.html +1 -1
- package/.next/server/app/dashboard/combos.rsc +8 -8
- package/.next/server/app/dashboard/combos.segments/!KGRhc2hib2FyZCk/dashboard/combos/__PAGE__.segment.rsc +8 -8
- package/.next/server/app/dashboard/combos.segments/_full.segment.rsc +8 -8
- package/.next/server/app/dashboard/combos.segments/_tree.segment.rsc +2 -2
- package/.next/server/app/dashboard/endpoint.html +1 -1
- package/.next/server/app/dashboard/endpoint.rsc +9 -9
- package/.next/server/app/dashboard/endpoint.segments/!KGRhc2hib2FyZCk/dashboard/endpoint/__PAGE__.segment.rsc +8 -8
- package/.next/server/app/dashboard/endpoint.segments/_full.segment.rsc +9 -9
- package/.next/server/app/dashboard/endpoint.segments/_tree.segment.rsc +2 -2
- package/.next/server/app/dashboard/media-providers/systemone.html +1 -1
- package/.next/server/app/dashboard/media-providers/systemone.rsc +8 -8
- package/.next/server/app/dashboard/media-providers/systemone.segments/!KGRhc2hib2FyZCk/dashboard/media-providers/systemone/__PAGE__.segment.rsc +8 -8
- package/.next/server/app/dashboard/media-providers/systemone.segments/_full.segment.rsc +8 -8
- package/.next/server/app/dashboard/media-providers/systemone.segments/_tree.segment.rsc +2 -2
- package/.next/server/app/dashboard/profile.html +1 -1
- package/.next/server/app/dashboard/profile.rsc +8 -8
- package/.next/server/app/dashboard/profile.segments/!KGRhc2hib2FyZCk/dashboard/profile/__PAGE__.segment.rsc +8 -8
- package/.next/server/app/dashboard/profile.segments/_full.segment.rsc +8 -8
- package/.next/server/app/dashboard/profile.segments/_tree.segment.rsc +2 -2
- package/.next/server/app/dashboard/providers/new.html +1 -1
- package/.next/server/app/dashboard/providers/new.rsc +8 -8
- package/.next/server/app/dashboard/providers/new.segments/!KGRhc2hib2FyZCk/dashboard/providers/new/__PAGE__.segment.rsc +8 -8
- package/.next/server/app/dashboard/providers/new.segments/_full.segment.rsc +8 -8
- package/.next/server/app/dashboard/providers/new.segments/_tree.segment.rsc +2 -2
- package/.next/server/app/dashboard/providers.html +1 -1
- package/.next/server/app/dashboard/providers.rsc +8 -8
- package/.next/server/app/dashboard/providers.segments/!KGRhc2hib2FyZCk/dashboard/providers/__PAGE__.segment.rsc +8 -8
- package/.next/server/app/dashboard/providers.segments/_full.segment.rsc +8 -8
- package/.next/server/app/dashboard/providers.segments/_tree.segment.rsc +2 -2
- package/.next/server/app/dashboard/proxy-pools.html +1 -1
- package/.next/server/app/dashboard/proxy-pools.rsc +8 -8
- package/.next/server/app/dashboard/proxy-pools.segments/!KGRhc2hib2FyZCk/dashboard/proxy-pools/__PAGE__.segment.rsc +8 -8
- package/.next/server/app/dashboard/proxy-pools.segments/_full.segment.rsc +8 -8
- package/.next/server/app/dashboard/proxy-pools.segments/_tree.segment.rsc +2 -2
- package/.next/server/app/dashboard/pxpipe.html +1 -1
- package/.next/server/app/dashboard/pxpipe.rsc +7 -7
- package/.next/server/app/dashboard/pxpipe.segments/!KGRhc2hib2FyZCk/dashboard/pxpipe/__PAGE__.segment.rsc +7 -7
- package/.next/server/app/dashboard/pxpipe.segments/_full.segment.rsc +7 -7
- package/.next/server/app/dashboard/pxpipe.segments/_tree.segment.rsc +2 -2
- package/.next/server/app/dashboard/quota.html +2 -2
- package/.next/server/app/dashboard/quota.rsc +9 -9
- package/.next/server/app/dashboard/quota.segments/!KGRhc2hib2FyZCk/dashboard/quota/__PAGE__.segment.rsc +9 -9
- package/.next/server/app/dashboard/quota.segments/_full.segment.rsc +9 -9
- package/.next/server/app/dashboard/quota.segments/_tree.segment.rsc +2 -2
- package/.next/server/app/dashboard/settings/pricing/page.js +1 -1
- package/.next/server/app/dashboard/settings/pricing/page_client-reference-manifest.js +1 -1
- package/.next/server/app/dashboard/settings/pricing.html +1 -1
- package/.next/server/app/dashboard/settings/pricing.rsc +7 -7
- package/.next/server/app/dashboard/settings/pricing.segments/_full.segment.rsc +7 -7
- package/.next/server/app/dashboard/settings/pricing.segments/_tree.segment.rsc +2 -2
- package/.next/server/app/dashboard/settings/pricing.segments/dashboard/settings/pricing/__PAGE__.segment.rsc +7 -7
- package/.next/server/app/dashboard/token-saver.html +1 -1
- package/.next/server/app/dashboard/token-saver.rsc +8 -8
- package/.next/server/app/dashboard/token-saver.segments/!KGRhc2hib2FyZCk/dashboard/token-saver/__PAGE__.segment.rsc +8 -8
- package/.next/server/app/dashboard/token-saver.segments/_full.segment.rsc +8 -8
- package/.next/server/app/dashboard/token-saver.segments/_tree.segment.rsc +2 -2
- package/.next/server/app/dashboard/usage.html +2 -2
- package/.next/server/app/dashboard/usage.rsc +8 -8
- package/.next/server/app/dashboard/usage.segments/!KGRhc2hib2FyZCk/dashboard/usage/__PAGE__.segment.rsc +8 -8
- package/.next/server/app/dashboard/usage.segments/_full.segment.rsc +8 -8
- package/.next/server/app/dashboard/usage.segments/_tree.segment.rsc +2 -2
- package/.next/server/app/dashboard.html +1 -1
- package/.next/server/app/dashboard.rsc +9 -9
- package/.next/server/app/dashboard.segments/!KGRhc2hib2FyZCk/dashboard/__PAGE__.segment.rsc +8 -8
- package/.next/server/app/dashboard.segments/_full.segment.rsc +9 -9
- package/.next/server/app/dashboard.segments/_tree.segment.rsc +2 -2
- package/.next/server/app/index.html +1 -1
- package/.next/server/app/index.rsc +6 -6
- package/.next/server/app/index.segments/__PAGE__.segment.rsc +6 -6
- package/.next/server/app/index.segments/_full.segment.rsc +6 -6
- package/.next/server/app/index.segments/_tree.segment.rsc +2 -2
- package/.next/server/app/landing/page.js +1 -1
- package/.next/server/app/landing/page_client-reference-manifest.js +1 -1
- package/.next/server/app/landing.html +1 -1
- package/.next/server/app/landing.rsc +7 -7
- package/.next/server/app/landing.segments/_full.segment.rsc +7 -7
- package/.next/server/app/landing.segments/_tree.segment.rsc +2 -2
- package/.next/server/app/landing.segments/landing/__PAGE__.segment.rsc +7 -7
- package/.next/server/app/login/page.js +1 -1
- package/.next/server/app/login/page_client-reference-manifest.js +1 -1
- package/.next/server/app/login.html +1 -1
- package/.next/server/app/login.rsc +6 -6
- package/.next/server/app/login.segments/_full.segment.rsc +6 -6
- package/.next/server/app/login.segments/_tree.segment.rsc +2 -2
- package/.next/server/app/login.segments/login/__PAGE__.segment.rsc +6 -6
- package/.next/server/app/manifest.webmanifest/route.js +2 -2
- package/.next/server/app/page.js +1 -1
- package/.next/server/app/page_client-reference-manifest.js +1 -1
- package/.next/server/app-paths-manifest.json +5 -6
- package/.next/server/chunks/1011.js +1 -1
- package/.next/server/chunks/1194.js +1 -1
- package/.next/server/chunks/1289.js +1 -1
- package/.next/server/chunks/1633.js +1 -1
- package/.next/server/chunks/2282.js +7 -7
- package/.next/server/chunks/2339.js +1 -1
- package/.next/server/chunks/2706.js +1 -1
- package/.next/server/chunks/2801.js +1 -1
- package/.next/server/chunks/3425.js +1 -1
- package/.next/server/chunks/4129.js +1 -1
- package/.next/server/chunks/6056.js +1 -1
- package/.next/server/chunks/7816.js +1 -1
- package/.next/server/chunks/9429.js +1 -1
- package/.next/server/middleware-build-manifest.js +1 -1
- package/.next/server/pages/404.html +1 -1
- package/.next/server/pages/500.html +1 -1
- package/.next/server/prefetch-hints.json +0 -24
- package/.next/server/server-reference-manifest.js +1 -1
- package/.next/server/server-reference-manifest.json +1 -1
- package/.next/static/chunks/1278-1bef1ffb32ea7f41.js +1 -0
- package/.next/static/chunks/1660-25564899e7912146.js +1 -0
- package/.next/static/chunks/{1699-13ee6864a8a31a96.js → 1699-49be310981e2759e.js} +2 -2
- package/.next/static/chunks/{3577-cd98d40e3099e1b0.js → 3577-1f02993330d7fba7.js} +1 -1
- package/.next/static/chunks/5148-7d67073becfaf162.js +1 -0
- package/.next/static/chunks/{5862-f98c2f3d480b80d2.js → 5862-6f3a3a6d4c00100d.js} +1 -1
- package/.next/static/chunks/6428-5a5f71440049a4e6.js +1 -0
- package/.next/static/chunks/7128-78b41798c1177008.js +1 -0
- package/.next/static/chunks/7835-06b436358f3395f6.js +1 -0
- package/.next/static/chunks/9150-32b4247b1af5e206.js +1 -0
- package/.next/static/chunks/{9ce8c186-3c7d7dbc5d428052.js → 9ce8c186-6cd204e9c27ecee1.js} +1 -1
- package/.next/static/chunks/app/(dashboard)/dashboard/cli-tools/[toolId]/{page-e8bceccb95695755.js → page-c913b130003c1672.js} +3 -3
- package/.next/static/chunks/app/(dashboard)/dashboard/cli-tools/{page-adee408d9de02423.js → page-3bab0c661f222ea3.js} +1 -1
- package/.next/static/chunks/app/(dashboard)/dashboard/combos/{page-d4c1e29e8d038f09.js → page-76cc2c386af12738.js} +1 -1
- package/.next/static/chunks/app/(dashboard)/dashboard/console-log/page-58a29f3cb409597a.js +1 -0
- package/.next/static/chunks/app/(dashboard)/dashboard/endpoint/page-d5f693c646ae044b.js +1 -0
- package/.next/static/chunks/app/(dashboard)/dashboard/media-providers/systemone/[id]/{page-b751d9603cb82e62.js → page-7340dad2b87640cf.js} +1 -1
- package/.next/static/chunks/app/(dashboard)/dashboard/media-providers/systemone/{page-49b3b4867d06cbe0.js → page-32e3e07a8f54ec11.js} +1 -1
- package/.next/static/chunks/app/(dashboard)/dashboard/page-a7f59da8c0db5cf1.js +1 -0
- package/.next/static/chunks/app/(dashboard)/dashboard/profile/{page-65b2c7989dbe2663.js → page-7123127fd841cfa5.js} +1 -1
- package/.next/static/chunks/app/(dashboard)/dashboard/providers/[id]/{page-d5d480e209fdc55a.js → page-fab6f4b4cccc1a6f.js} +1 -1
- package/.next/static/chunks/app/(dashboard)/dashboard/providers/new/{page-9b68243ab9555702.js → page-819e98f53bf2f4f7.js} +1 -1
- package/.next/static/chunks/app/(dashboard)/dashboard/providers/{page-2396571281d02804.js → page-9054f870a5e0f5c6.js} +1 -1
- package/.next/static/chunks/app/(dashboard)/dashboard/proxy-pools/{page-cfd6bcb7e55d7d18.js → page-3e4657b108582404.js} +1 -1
- package/.next/static/chunks/app/(dashboard)/dashboard/quota/{page-fef6edb7aafd8bd0.js → page-61780f0a2b494680.js} +1 -1
- package/.next/static/chunks/app/(dashboard)/dashboard/token-saver/{page-bcc37fc2b4089f2f.js → page-4e366abb76514be7.js} +1 -1
- package/.next/static/chunks/app/(dashboard)/dashboard/usage/{page-697f46461825d7fc.js → page-2d71fa2936b16f45.js} +1 -1
- package/.next/static/chunks/app/(dashboard)/{layout-5039502fc12707c9.js → layout-91f41c68685ed739.js} +1 -1
- package/.next/static/chunks/app/callback/page-8b6862b2e58a129e.js +1 -0
- package/.next/static/chunks/app/dashboard/settings/pricing/page-c1dfa7608ff710d1.js +1 -0
- package/.next/static/chunks/app/landing/page-a76ba2642bd02bf5.js +1 -0
- package/.next/static/chunks/app/layout-cc98f6c7473b86a3.js +1 -0
- package/.next/static/css/efaf98e3b295f727.css +1 -0
- package/.next/static/wBARQPScPhD6SLn7WQvI9/_buildManifest.js +1 -0
- package/CHANGELOG.md +19 -0
- package/open-sse/providers/registry/opencode-go.js +4 -0
- package/open-sse/providers/registry/opencode-zen.js +4 -0
- package/open-sse/providers/registry/opencode.js +3 -0
- package/open-sse/translator/concerns/thinkingUnified.js +16 -1
- package/open-sse/translator/concerns/toolCall.js +2 -1
- package/open-sse/translator/formats/openai.js +10 -2
- package/open-sse/translator/request/claude-to-openai.js +9 -5
- package/open-sse/translator/response/openai-to-claude.js +66 -32
- package/open-sse/translator/schema/defaults.js +6 -0
- package/open-sse/translator/schema/index.js +1 -1
- package/package.json +1 -1
- package/src/app/(dashboard)/dashboard/cli-tools/components/cards/ClaudeToolCard.tsx +10 -0
- package/src/app/api/cli-tools/claude-settings/route.js +10 -0
- package/src/app/globals.css +21 -1
- package/src/shared/components/layouts/DashboardLayout.tsx +2 -8
- package/src/shared/constants/cliTools.js +5 -0
- package/.next/server/app/(dashboard)/dashboard/basic-chat/page.js +0 -1
- package/.next/server/app/(dashboard)/dashboard/basic-chat/page.js.nft.json +0 -1
- package/.next/server/app/(dashboard)/dashboard/basic-chat/page_client-reference-manifest.js +0 -1
- package/.next/server/app/dashboard/basic-chat.html +0 -1
- package/.next/server/app/dashboard/basic-chat.meta +0 -36
- package/.next/server/app/dashboard/basic-chat.rsc +0 -26
- package/.next/server/app/dashboard/basic-chat.segments/!KGRhc2hib2FyZCk/dashboard/basic-chat/__PAGE__.segment.rsc +0 -31
- package/.next/server/app/dashboard/basic-chat.segments/_full.segment.rsc +0 -26
- package/.next/server/app/dashboard/basic-chat.segments/_tree.segment.rsc +0 -6
- package/.next/static/Xxof6vr5MvX0-6oReU23d/_buildManifest.js +0 -1
- package/.next/static/chunks/1278-f11c7d84c52342fc.js +0 -1
- package/.next/static/chunks/1471-10f225f62f7469cc.js +0 -1
- package/.next/static/chunks/159-ec207a220d7d5c16.js +0 -1
- package/.next/static/chunks/5113-5c4f5181388aab72.js +0 -1
- package/.next/static/chunks/5778-9d97ce04f2ac118c.js +0 -1
- package/.next/static/chunks/6920-e2b533c1eafa9521.js +0 -1
- package/.next/static/chunks/7835-c1ef8f5cdaaad483.js +0 -1
- package/.next/static/chunks/app/(dashboard)/dashboard/basic-chat/page-ce1364b2b9589785.js +0 -1
- package/.next/static/chunks/app/(dashboard)/dashboard/console-log/page-3cc58622294c8c8a.js +0 -1
- package/.next/static/chunks/app/(dashboard)/dashboard/endpoint/page-67516b120adbc4d7.js +0 -1
- package/.next/static/chunks/app/(dashboard)/dashboard/page-315c9f52c472a700.js +0 -1
- package/.next/static/chunks/app/callback/page-f714c2306a1e9004.js +0 -1
- package/.next/static/chunks/app/dashboard/settings/pricing/page-86197107690a0580.js +0 -1
- package/.next/static/chunks/app/landing/page-7a83d1be493ddc8c.js +0 -1
- package/.next/static/chunks/app/layout-dc929483cad9f77f.js +0 -1
- package/.next/static/css/c66cbd684164cacf.css +0 -1
- package/src/app/(dashboard)/dashboard/basic-chat/BasicChatPageClient.tsx +0 -1140
- package/src/app/(dashboard)/dashboard/basic-chat/page.tsx +0 -5
- /package/.next/static/{Xxof6vr5MvX0-6oReU23d → wBARQPScPhD6SLn7WQvI9}/_ssgManifest.js +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3649],{15764:(e,s,t)=>{"use strict";t.d(s,{CK:()=>i.default,G9:()=>m.default,Iz:()=>p.default,KX:()=>g.PanelSkeleton,LF:()=>a.default,LH:()=>x.default,Mu:()=>g.StatCardSkeleton,Nf:()=>d.default,Qv:()=>l.CardSkeleton,YW:()=>v.YW,gw:()=>f.default,jK:()=>c.default,nh:()=>b.default,pV:()=>v.pV,rq:()=>o.default,uR:()=>n.default,uo:()=>r.ConfirmModal,vE:()=>u.default,vj:()=>h.default,wI:()=>j.default,wn:()=>v.wn,zY:()=>v.zY}),t(58913);var r=t(3537),l=t(58350);t(30872),t(33526),t(42535),t(1279);var a=t(92802),o=t(25908),n=t(58729),i=t(24873),d=t(5258),c=t(80599);t(949),t(56776),t(53599),t(88336),t(69561);var m=t(37753),x=t(23444),u=t(93624),h=t(86920),j=t(65461);t(14580);var f=t(14670),p=t(70296);t(57779),t(22205);var g=t(43276),b=t(75862),v=t(92412)},29982:(e,s,t)=>{"use strict";t.r(s),t.d(s,{default:()=>A});var r=t(29798),l=t(15814),a=t(31872),o=t(59732),n=t(7155),i=t(70684),d=t(75669),c=t(18055),m=t(77345),x=t(1352),u=t(49787),h=t(45111),j=t(36395),f=t(10205),p=t(15054),g=t(6403),b=t(63587),v=t(76260),y=t(3308),k=t(75877),N=t(50860),w=t(1280),C=t(26339),S=t(15764),$=t(63523),z=t(90619);let E=/^[a-zA-Z0-9_.\-]+$/;function A(){let[e,s]=(0,l.useState)([]),[t,a]=(0,l.useState)(!0),[o,n]=(0,l.useState)(!1),[i,m]=(0,l.useState)(null),[x,h]=(0,l.useState)([]),[p,g]=(0,l.useState)({}),{getCaps:b}=(0,z.y)(),[v,y]=(0,l.useState)(null),{copied:k,copy:N}=(0,$.C)(),w=async()=>{try{let[e,t,r]=await Promise.all([fetch("/api/combos"),fetch("/api/providers"),fetch("/api/settings")]),l=await e.json(),a=await t.json(),o=r.ok?await r.json():{};e.ok&&s((l.combos||[]).filter(e=>!e.kind||"llm"===e.kind)),t.ok&&h(a.connections||[]),g(o.comboStrategies||{})}catch(e){console.log("Error fetching data:",e)}finally{a(!1)}};(0,l.useEffect)(()=>{w()},[]);let C=async e=>{try{let s=await fetch("/api/combos",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(s.ok)await w(),n(!1);else{let e=await s.json();alert(e.error||"Failed to create combo")}}catch(e){console.log("Error creating combo:",e)}},E=async(e,s)=>{try{let t=await fetch(`/api/combos/${e}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(s)});if(t.ok)await w(),m(null);else{let e=await t.json();alert(e.error||"Failed to update combo")}}catch(e){console.log("Error updating combo:",e)}},A=async(e,s)=>{try{let t={...p},r={...t[e]||{},...s};r.fallbackStrategy&&"fallback"!==r.fallbackStrategy?t[e]=r:delete t[e],await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({comboStrategies:t})}),g(t)}catch(e){console.log("Error updating combo strategy:",e)}};return t?(0,r.jsxs)(S.YW,{children:[(0,r.jsx)(S.KX,{}),(0,r.jsx)(S.KX,{})]}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(S.YW,{children:[(0,r.jsx)(S.zY,{title:"Combos",description:"Group models under one name, then pick a strategy per combo:",actions:(0,r.jsxs)(c.$,{onClick:()=>n(!0),className:"w-full whitespace-nowrap sm:w-auto",children:[(0,r.jsx)(j.A,{}),"Create Combo"]})}),(0,r.jsx)(S.wn,{children:(0,r.jsx)("div",{className:"min-w-0",children:(0,r.jsxs)("ul",{className:"text-sm text-muted-foreground flex flex-col gap-1",children:[(0,r.jsxs)("li",{children:[(0,r.jsx)("span",{className:"font-medium text-foreground",children:"Fallback"})," — tries models in order (next on failure)"]}),(0,r.jsxs)("li",{children:[(0,r.jsx)("span",{className:"font-medium text-foreground",children:"Round Robin"})," — rotates models across requests to spread load"]}),(0,r.jsxs)("li",{children:[(0,r.jsx)("span",{className:"font-medium text-foreground",children:"Fusion"})," — queries all models in parallel, then a judge synthesizes one answer. Best quality, but costs the most: every request bills all panel models + the judge (N+1 calls)"]})]})})}),(0,r.jsx)(S.wn,{children:0===e.length?(0,r.jsx)(d.Zp,{children:(0,r.jsxs)("div",{className:"py-12 text-center",children:[(0,r.jsx)("div",{className:"inline-flex items-center justify-center w-16 h-16 rounded-full bg-primary/10 text-primary mb-4",children:(0,r.jsx)(f.A,{className:"size-8"})}),(0,r.jsx)("p",{className:"text-foreground font-medium mb-1",children:"No combos yet"}),(0,r.jsx)("p",{className:"text-sm text-muted-foreground mb-4",children:"Create model combos with fallback support"}),(0,r.jsxs)(c.$,{onClick:()=>n(!0),className:"w-full sm:w-auto",children:[(0,r.jsx)(j.A,{}),"Create Combo"]})]})}):(0,r.jsx)("div",{className:"flex flex-col gap-4",children:e.map(t=>(0,r.jsx)(_,{combo:t,getCaps:b,activeProviders:x,copied:k,onCopy:N,onEdit:()=>m(t),onDelete:()=>{var r;return r=t.id,void y({title:"Delete Combo",message:"Delete this combo?",onConfirm:async()=>{y(null);try{(await fetch(`/api/combos/${r}`,{method:"DELETE"})).ok&&s(e.filter(e=>e.id!==r))}catch(e){console.log("Error deleting combo:",e)}}})},strategy:p[t.name]||{},onSetStrategy:e=>A(t.name,e)},t.id))})})]}),o&&(0,r.jsx)(F,{isOpen:o,onClose:()=>n(!1),onSave:C,activeProviders:x},"create"),i&&(0,r.jsx)(F,{isOpen:!!i,combo:i,onClose:()=>m(null),onSave:e=>E(i.id,e),activeProviders:x},i.id),v&&(0,r.jsx)(u.lG,{open:!0,onOpenChange:e=>{e||y(null)},children:(0,r.jsxs)(u.Cf,{className:"max-w-sm",children:[(0,r.jsx)(u.c7,{children:(0,r.jsx)(u.L3,{children:v.title})}),(0,r.jsx)("p",{className:"p-4 text-sm text-muted-foreground",children:v.message}),(0,r.jsxs)(u.Es,{children:[(0,r.jsx)(c.$,{variant:"ghost",onClick:()=>y(null),children:"Cancel"}),(0,r.jsx)(c.$,{variant:"destructive",onClick:v.onConfirm,children:v.confirmText||"Confirm"})]})]})})]})}let M=[{value:"fallback",label:"Fallback — try in order"},{value:"round-robin",label:"Round Robin — rotate"},{value:"fusion",label:"Fusion — panel + judge"}];function _({combo:e,getCaps:s,activeProviders:t=[],copied:a,onCopy:o,onEdit:n,onDelete:i,strategy:m={},onSetStrategy:u}){let[j,N]=(0,l.useState)(!1),w=m.fallbackStrategy||"fallback",C=m.judgeModel||"";return(0,r.jsxs)(d.Zp,{size:"sm",className:"group",children:[(0,r.jsx)(d.Wu,{className:"min-w-0",children:(0,r.jsxs)("div",{className:"flex min-w-0 flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[(0,r.jsxs)("div",{className:"flex min-w-0 flex-1 items-start gap-3 sm:items-center",children:[(0,r.jsx)("div",{className:"size-8 rounded-lg bg-primary/10 flex items-center justify-center shrink-0",children:(0,r.jsx)(f.A,{className:"size-4 text-primary"})}),(0,r.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,r.jsx)("code",{className:"block truncate font-mono text-sm font-medium",children:e.name}),(0,r.jsxs)("div",{className:"mt-1 flex min-w-0 flex-wrap items-center gap-1",children:[0===e.models.length?(0,r.jsx)("span",{className:"text-xs text-muted-foreground italic",children:"No models"}):e.models.slice(0,3).map((e,t)=>(0,r.jsxs)("code",{className:"inline-flex items-center gap-1 rounded bg-black/5 px-1.5 py-0.5 font-mono text-xs text-muted-foreground dark:bg-white/5",children:[(0,r.jsx)("span",{children:e}),(0,r.jsx)(S.nh,{caps:s?.(e)})]},t)),e.models.length>3&&(0,r.jsxs)("span",{className:"text-[10px] text-muted-foreground",children:["+",e.models.length-3," more"]})]}),"fusion"===w&&(0,r.jsxs)("div",{className:"mt-2 flex min-w-0 flex-wrap items-center gap-1.5",children:[(0,r.jsx)("span",{className:"text-[11px] font-medium text-muted-foreground",children:"Judge"}),(0,r.jsxs)(x.m_,{children:[(0,r.jsx)(x.k$,{asChild:!0,children:(0,r.jsxs)("button",{onClick:()=>N(!0),className:"inline-flex max-w-full items-center gap-1 rounded border border-dashed border-primary/40 px-1.5 py-0.5 font-mono text-[11px] text-primary hover:border-primary hover:bg-primary/5 transition-colors",children:[(0,r.jsx)(p.A,{className:"size-3.5"}),(0,r.jsx)("span",{className:"truncate",children:C||`Auto — ${e.models[0]||"first model"}`})]})}),(0,r.jsx)(x.ZI,{children:"Pick the model that fuses panel answers"})]}),C&&(0,r.jsxs)(x.m_,{children:[(0,r.jsx)(x.k$,{asChild:!0,children:(0,r.jsx)("button",{onClick:()=>u({judgeModel:""}),className:"p-0.5 rounded text-muted-foreground hover:text-red-500 hover:bg-red-500/10 transition-colors",children:(0,r.jsx)(g.A,{className:"size-3.5"})})}),(0,r.jsx)(x.ZI,{children:"Reset judge to Auto"})]})]})]})]}),(0,r.jsxs)("div",{className:"flex w-full flex-col gap-2 sm:w-auto sm:flex-row sm:items-center sm:gap-3 sm:shrink-0",children:[(0,r.jsx)("div",{className:"w-full sm:w-[200px]",children:(0,r.jsxs)(h.l6,{value:w,onValueChange:e=>u({fallbackStrategy:e}),children:[(0,r.jsx)(h.bq,{className:"py-1.5 text-xs",children:(0,r.jsx)(h.yv,{})}),(0,r.jsx)(h.gC,{children:M.map(e=>(0,r.jsx)(h.eb,{value:e.value,children:e.label},e.value))})]})}),(0,r.jsxs)("div",{className:"grid grid-cols-3 gap-1 sm:flex",children:[(0,r.jsxs)(x.m_,{children:[(0,r.jsx)(x.k$,{asChild:!0,children:(0,r.jsx)(c.$,{variant:"ghost",size:"icon-sm",onClick:s=>{s.stopPropagation(),o(e.name,`combo-${e.id}`)},"aria-label":"Copy combo name",children:a===`combo-${e.id}`?(0,r.jsx)(b.A,{}):(0,r.jsx)(v.A,{})})}),(0,r.jsx)(x.ZI,{children:"Copy combo name"})]}),(0,r.jsxs)(x.m_,{children:[(0,r.jsx)(x.k$,{asChild:!0,children:(0,r.jsx)(c.$,{variant:"ghost",size:"icon-sm",onClick:n,"aria-label":"Edit",children:(0,r.jsx)(y.A,{})})}),(0,r.jsx)(x.ZI,{children:"Edit"})]}),(0,r.jsxs)(x.m_,{children:[(0,r.jsx)(x.k$,{asChild:!0,children:(0,r.jsx)(c.$,{variant:"ghost",size:"icon-sm",onClick:i,"aria-label":"Delete",className:"text-red-500 hover:bg-red-500/10 hover:text-red-500",children:(0,r.jsx)(k.A,{})})}),(0,r.jsx)(x.ZI,{children:"Delete"})]})]})]})]})}),j&&(0,r.jsx)(S.rq,{isOpen:j,onClose:()=>N(!1),onSelect:e=>{u({judgeModel:e?.value||""}),N(!1)},activeProviders:t,title:"Select Judge Model",addedModelValues:C?[C]:[],closeOnSelect:!0})]})}function P({id:e,index:s,model:t,isFirst:a,isLast:i,onEdit:d,onMoveUp:c,onMoveDown:m,onRemove:u}){let{attributes:h,listeners:j,setNodeRef:f,transform:p,isDragging:b}=(0,o.gl)({id:e}),v={transform:n.Ks.Transform.toString(p),opacity:b?.4:1,zIndex:b?999:void 0},[y,k]=(0,l.useState)(!1),[S,$]=(0,l.useState)(t),z=()=>{let e=S.trim();e&&e!==t?d(e):$(t),k(!1)};return(0,r.jsxs)("div",{ref:f,style:v,className:`group flex min-w-0 items-center gap-1.5 rounded-md px-2 py-1 bg-black/[0.02] hover:bg-black/[0.04] dark:bg-white/[0.02] dark:hover:bg-white/[0.04] transition-colors ${b?"shadow-md ring-1 ring-primary/30":""}`,children:[(0,r.jsxs)(x.m_,{children:[(0,r.jsx)(x.k$,{asChild:!0,children:(0,r.jsx)("button",{...h,...j,type:"button",className:"cursor-grab touch-none p-0.5 rounded text-muted-foreground hover:text-primary active:cursor-grabbing shrink-0",children:(0,r.jsx)(N.A,{className:"size-4"})})}),(0,r.jsx)(x.ZI,{children:"Drag to reorder"})]}),(0,r.jsx)("span",{className:"text-[10px] font-medium text-muted-foreground w-3 text-center shrink-0",children:s+1}),y?(0,r.jsx)("input",{autoFocus:!0,value:S,onChange:e=>$(e.target.value),onBlur:z,onKeyDown:e=>{"Enter"===e.key&&z(),"Escape"===e.key&&($(t),k(!1))},className:"min-w-0 flex-1 rounded border border-primary/40 bg-white px-1.5 py-0.5 font-mono text-xs text-foreground outline-none dark:bg-black/20"}):(0,r.jsxs)(x.m_,{children:[(0,r.jsx)(x.k$,{asChild:!0,children:(0,r.jsx)("div",{className:"min-w-0 flex-1 cursor-text truncate rounded px-1.5 py-0.5 font-mono text-xs text-foreground hover:bg-black/5 dark:hover:bg-white/5",onClick:()=>k(!0),children:t})}),(0,r.jsx)(x.ZI,{children:"Click to edit"})]}),(0,r.jsxs)("div",{className:"flex shrink-0 items-center gap-0.5",children:[(0,r.jsxs)(x.m_,{children:[(0,r.jsx)(x.k$,{asChild:!0,children:(0,r.jsx)("button",{onClick:c,disabled:a,className:`p-0.5 rounded ${a?"text-muted-foreground/20 cursor-not-allowed":"text-muted-foreground hover:text-primary hover:bg-black/5 dark:hover:bg-white/5"}`,children:(0,r.jsx)(w.A,{className:"size-3"})})}),(0,r.jsx)(x.ZI,{children:"Move up"})]}),(0,r.jsxs)(x.m_,{children:[(0,r.jsx)(x.k$,{asChild:!0,children:(0,r.jsx)("button",{onClick:m,disabled:i,className:`p-0.5 rounded ${i?"text-muted-foreground/20 cursor-not-allowed":"text-muted-foreground hover:text-primary hover:bg-black/5 dark:hover:bg-white/5"}`,children:(0,r.jsx)(C.A,{className:"size-3"})})}),(0,r.jsx)(x.ZI,{children:"Move down"})]})]}),(0,r.jsxs)(x.m_,{children:[(0,r.jsx)(x.k$,{asChild:!0,children:(0,r.jsx)("button",{onClick:u,className:"p-0.5 hover:bg-red-500/10 rounded text-muted-foreground hover:text-red-500 transition-all",children:(0,r.jsx)(g.A,{className:"size-3"})})}),(0,r.jsx)(x.ZI,{children:"Remove"})]})]})}function F({isOpen:e,combo:s,onClose:t,onSave:n,activeProviders:d,kindFilter:x=null}){let[h,p]=(0,l.useState)(s?.name||""),[g,b]=(0,l.useState)(s?.models||[]),[v,y]=(0,l.useState)(!1),[k,N]=(0,l.useState)(!1),[w,C]=(0,l.useState)(""),[$,z]=(0,l.useState)({}),A=(0,a.FR)((0,a.MS)(a.AN,{activationConstraint:{distance:5}}),(0,a.MS)(a.uN,{coordinateGetter:o.JR})),M=g.map((e,s)=>({uid:`item-${s}`,model:e})),_=async()=>{try{let e=await fetch("/api/models/alias");if(!e.ok)return;let s=await e.json();z(s.aliases||{})}catch(e){console.error("Error fetching modal data:",e)}};(0,l.useEffect)(()=>{e&&_()},[e]);let O=e=>e.trim()?E.test(e)?(C(""),!0):(C("Only letters, numbers, -, _ and . allowed"),!1):(C("Name is required"),!1),I=async()=>{O(h)&&(N(!0),await n({name:h.trim(),models:g}),N(!1))},Z=!!s;return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(u.lG,{open:e,onOpenChange:e=>{e||t()},children:(0,r.jsxs)(u.Cf,{className:"max-w-md",children:[(0,r.jsx)(u.c7,{children:(0,r.jsx)(u.L3,{children:Z?"Edit Combo":"Create Combo"})}),(0,r.jsxs)("div",{className:"flex flex-col gap-3 p-4",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"text-sm font-medium text-foreground mb-1.5 block",children:"Combo Name"}),(0,r.jsx)(m.p,{value:h,onChange:e=>{let s=e.target.value;p(s),s?O(s):C("")},placeholder:"my-combo","aria-invalid":!!w,className:w?"ring-1 ring-red-500 border-red-500/40":""}),w&&(0,r.jsx)("p",{className:"mt-1 text-xs text-red-500",children:w}),(0,r.jsx)("p",{className:"text-[10px] text-muted-foreground mt-0.5",children:"Only letters, numbers, -, _ and . allowed"})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"text-sm font-medium mb-1.5 block",children:"Models"}),0===g.length?(0,r.jsxs)("div",{className:"text-center py-4 border border-dashed border-black/10 dark:border-white/10 rounded-lg bg-black/[0.01] dark:bg-white/[0.01]",children:[(0,r.jsx)(f.A,{className:"mb-1 mx-auto size-6 text-muted-foreground"}),(0,r.jsx)("p",{className:"text-xs text-muted-foreground",children:"No models added yet"})]}):(0,r.jsx)(a.Mp,{sensors:A,collisionDetection:a.fp,onDragEnd:e=>{let{active:s,over:t}=e;if(t&&s.id!==t.id){let e=M.findIndex(e=>e.uid===s.id),r=M.findIndex(e=>e.uid===t.id);-1!==e&&-1!==r&&b(s=>(0,o.be)(s,e,r))}},modifiers:[i.FN,i.gj],children:(0,r.jsx)(o.gB,{items:M.map(e=>e.uid),strategy:o._G,children:(0,r.jsx)("div",{className:"flex max-h-[55vh] min-w-0 flex-col gap-1 overflow-y-auto sm:max-h-[350px]",children:M.map(({uid:e,model:s},t)=>(0,r.jsx)(P,{id:e,index:t,model:s,isFirst:0===t,isLast:t===M.length-1,onEdit:e=>{let s=[...g];s[t]=e,b(s)},onMoveUp:()=>(e=>{if(0===e)return;let s=[...g];[s[e-1],s[e]]=[s[e],s[e-1]],b(s)})(t),onMoveDown:()=>(e=>{if(e===g.length-1)return;let s=[...g];[s[e],s[e+1]]=[s[e+1],s[e]],b(s)})(t),onRemove:()=>{b(g.filter((e,s)=>s!==t))}},e))})})}),(0,r.jsxs)("button",{onClick:()=>y(!0),className:"w-full mt-2 py-2 border border-dashed border-black/10 dark:border-white/10 rounded-lg text-xs text-primary font-medium hover:text-primary hover:border-primary/50 transition-colors flex items-center justify-center gap-1",children:[(0,r.jsx)(j.A,{className:"size-4"}),"Add Model"]})]})]}),(0,r.jsx)(u.Es,{children:(0,r.jsx)("div",{className:"flex w-full flex-col gap-2 pt-1 sm:flex-row",children:(0,r.jsx)(c.$,{onClick:I,size:"sm",className:"flex-1",disabled:!h.trim()||!!w||k,children:k?"Saving...":Z?"Save":"Create"})})})]})}),v&&(0,r.jsx)(S.rq,{isOpen:v,onClose:()=>y(!1),onSelect:e=>{g.includes(e.value)||b([...g,e.value])},onDeselect:e=>{b(g.filter(s=>s!==e.value))},activeProviders:d,modelAliases:$,title:"Add Model to Combo",kindFilter:x,addedModelValues:g,closeOnSelect:!1})]})}},67053:(e,s,t)=>{Promise.resolve().then(t.bind(t,29982))},92412:(e,s,t)=>{"use strict";t.d(s,{YW:()=>r.Page,pV:()=>r.CardGrid,wn:()=>r.Section,zY:()=>r.PageHeader}),t(16675),t(72778);var r=t(29575)},99656:(e,s,t)=>{"use strict";t.d(s,{PM:()=>r.PM,Sj:()=>r.Sj,Vy:()=>r.Vy,fF:()=>r.fF,sl:()=>r.sl,vL:()=>r.vL,y$:()=>r.y$,zM:()=>r.zM});var r=t(31872)}},e=>{e.O(0,[6766,5166,7552,9980,1471,5778,4484,3577,5862,5113,1699,1722,1078,159,4489,1278,1830,6770,427,9966,7358],()=>e(e.s=67053)),_N_E=e.O()}]);
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3649],{15764:(e,s,t)=>{"use strict";t.d(s,{CK:()=>i.default,G9:()=>m.default,Iz:()=>p.default,KX:()=>g.PanelSkeleton,LF:()=>a.default,LH:()=>x.default,Mu:()=>g.StatCardSkeleton,Nf:()=>d.default,Qv:()=>l.CardSkeleton,YW:()=>v.YW,gw:()=>f.default,jK:()=>c.default,nh:()=>b.default,pV:()=>v.pV,rq:()=>o.default,uR:()=>n.default,uo:()=>r.ConfirmModal,vE:()=>u.default,vj:()=>h.default,wI:()=>j.default,wn:()=>v.wn,zY:()=>v.zY}),t(58913);var r=t(3537),l=t(58350);t(30872),t(33526),t(42535),t(1279);var a=t(92802),o=t(25908),n=t(58729),i=t(24873),d=t(5258),c=t(80599);t(949),t(56776),t(53599),t(88336),t(69561);var m=t(37753),x=t(23444),u=t(93624),h=t(86920),j=t(65461);t(14580);var f=t(14670),p=t(70296);t(57779),t(22205);var g=t(43276),b=t(75862),v=t(92412)},29982:(e,s,t)=>{"use strict";t.r(s),t.d(s,{default:()=>A});var r=t(29798),l=t(15814),a=t(31872),o=t(59732),n=t(7155),i=t(70684),d=t(75669),c=t(18055),m=t(77345),x=t(1352),u=t(49787),h=t(45111),j=t(36395),f=t(10205),p=t(15054),g=t(6403),b=t(63587),v=t(76260),y=t(3308),k=t(75877),N=t(50860),w=t(1280),C=t(26339),S=t(15764),$=t(63523),z=t(90619);let E=/^[a-zA-Z0-9_.\-]+$/;function A(){let[e,s]=(0,l.useState)([]),[t,a]=(0,l.useState)(!0),[o,n]=(0,l.useState)(!1),[i,m]=(0,l.useState)(null),[x,h]=(0,l.useState)([]),[p,g]=(0,l.useState)({}),{getCaps:b}=(0,z.y)(),[v,y]=(0,l.useState)(null),{copied:k,copy:N}=(0,$.C)(),w=async()=>{try{let[e,t,r]=await Promise.all([fetch("/api/combos"),fetch("/api/providers"),fetch("/api/settings")]),l=await e.json(),a=await t.json(),o=r.ok?await r.json():{};e.ok&&s((l.combos||[]).filter(e=>!e.kind||"llm"===e.kind)),t.ok&&h(a.connections||[]),g(o.comboStrategies||{})}catch(e){console.log("Error fetching data:",e)}finally{a(!1)}};(0,l.useEffect)(()=>{w()},[]);let C=async e=>{try{let s=await fetch("/api/combos",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(s.ok)await w(),n(!1);else{let e=await s.json();alert(e.error||"Failed to create combo")}}catch(e){console.log("Error creating combo:",e)}},E=async(e,s)=>{try{let t=await fetch(`/api/combos/${e}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(s)});if(t.ok)await w(),m(null);else{let e=await t.json();alert(e.error||"Failed to update combo")}}catch(e){console.log("Error updating combo:",e)}},A=async(e,s)=>{try{let t={...p},r={...t[e]||{},...s};r.fallbackStrategy&&"fallback"!==r.fallbackStrategy?t[e]=r:delete t[e],await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({comboStrategies:t})}),g(t)}catch(e){console.log("Error updating combo strategy:",e)}};return t?(0,r.jsxs)(S.YW,{children:[(0,r.jsx)(S.KX,{}),(0,r.jsx)(S.KX,{})]}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(S.YW,{children:[(0,r.jsx)(S.zY,{title:"Combos",description:"Group models under one name, then pick a strategy per combo:",actions:(0,r.jsxs)(c.$,{onClick:()=>n(!0),className:"w-full whitespace-nowrap sm:w-auto",children:[(0,r.jsx)(j.A,{}),"Create Combo"]})}),(0,r.jsx)(S.wn,{children:(0,r.jsx)("div",{className:"min-w-0",children:(0,r.jsxs)("ul",{className:"text-sm text-muted-foreground flex flex-col gap-1",children:[(0,r.jsxs)("li",{children:[(0,r.jsx)("span",{className:"font-medium text-foreground",children:"Fallback"})," — tries models in order (next on failure)"]}),(0,r.jsxs)("li",{children:[(0,r.jsx)("span",{className:"font-medium text-foreground",children:"Round Robin"})," — rotates models across requests to spread load"]}),(0,r.jsxs)("li",{children:[(0,r.jsx)("span",{className:"font-medium text-foreground",children:"Fusion"})," — queries all models in parallel, then a judge synthesizes one answer. Best quality, but costs the most: every request bills all panel models + the judge (N+1 calls)"]})]})})}),(0,r.jsx)(S.wn,{children:0===e.length?(0,r.jsx)(d.Zp,{children:(0,r.jsxs)("div",{className:"py-12 text-center",children:[(0,r.jsx)("div",{className:"inline-flex items-center justify-center w-16 h-16 rounded-full bg-primary/10 text-primary mb-4",children:(0,r.jsx)(f.A,{className:"size-8"})}),(0,r.jsx)("p",{className:"text-foreground font-medium mb-1",children:"No combos yet"}),(0,r.jsx)("p",{className:"text-sm text-muted-foreground mb-4",children:"Create model combos with fallback support"}),(0,r.jsxs)(c.$,{onClick:()=>n(!0),className:"w-full sm:w-auto",children:[(0,r.jsx)(j.A,{}),"Create Combo"]})]})}):(0,r.jsx)("div",{className:"flex flex-col gap-4",children:e.map(t=>(0,r.jsx)(_,{combo:t,getCaps:b,activeProviders:x,copied:k,onCopy:N,onEdit:()=>m(t),onDelete:()=>{var r;return r=t.id,void y({title:"Delete Combo",message:"Delete this combo?",onConfirm:async()=>{y(null);try{(await fetch(`/api/combos/${r}`,{method:"DELETE"})).ok&&s(e.filter(e=>e.id!==r))}catch(e){console.log("Error deleting combo:",e)}}})},strategy:p[t.name]||{},onSetStrategy:e=>A(t.name,e)},t.id))})})]}),o&&(0,r.jsx)(F,{isOpen:o,onClose:()=>n(!1),onSave:C,activeProviders:x},"create"),i&&(0,r.jsx)(F,{isOpen:!!i,combo:i,onClose:()=>m(null),onSave:e=>E(i.id,e),activeProviders:x},i.id),v&&(0,r.jsx)(u.lG,{open:!0,onOpenChange:e=>{e||y(null)},children:(0,r.jsxs)(u.Cf,{className:"max-w-sm",children:[(0,r.jsx)(u.c7,{children:(0,r.jsx)(u.L3,{children:v.title})}),(0,r.jsx)("p",{className:"p-4 text-sm text-muted-foreground",children:v.message}),(0,r.jsxs)(u.Es,{children:[(0,r.jsx)(c.$,{variant:"ghost",onClick:()=>y(null),children:"Cancel"}),(0,r.jsx)(c.$,{variant:"destructive",onClick:v.onConfirm,children:v.confirmText||"Confirm"})]})]})})]})}let M=[{value:"fallback",label:"Fallback — try in order"},{value:"round-robin",label:"Round Robin — rotate"},{value:"fusion",label:"Fusion — panel + judge"}];function _({combo:e,getCaps:s,activeProviders:t=[],copied:a,onCopy:o,onEdit:n,onDelete:i,strategy:m={},onSetStrategy:u}){let[j,N]=(0,l.useState)(!1),w=m.fallbackStrategy||"fallback",C=m.judgeModel||"";return(0,r.jsxs)(d.Zp,{size:"sm",className:"group",children:[(0,r.jsx)(d.Wu,{className:"min-w-0",children:(0,r.jsxs)("div",{className:"flex min-w-0 flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[(0,r.jsxs)("div",{className:"flex min-w-0 flex-1 items-start gap-3 sm:items-center",children:[(0,r.jsx)("div",{className:"size-8 rounded-lg bg-primary/10 flex items-center justify-center shrink-0",children:(0,r.jsx)(f.A,{className:"size-4 text-primary"})}),(0,r.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,r.jsx)("code",{className:"block truncate font-mono text-sm font-medium",children:e.name}),(0,r.jsxs)("div",{className:"mt-1 flex min-w-0 flex-wrap items-center gap-1",children:[0===e.models.length?(0,r.jsx)("span",{className:"text-xs text-muted-foreground italic",children:"No models"}):e.models.slice(0,3).map((e,t)=>(0,r.jsxs)("code",{className:"inline-flex items-center gap-1 rounded bg-black/5 px-1.5 py-0.5 font-mono text-xs text-muted-foreground dark:bg-white/5",children:[(0,r.jsx)("span",{children:e}),(0,r.jsx)(S.nh,{caps:s?.(e)})]},t)),e.models.length>3&&(0,r.jsxs)("span",{className:"text-[10px] text-muted-foreground",children:["+",e.models.length-3," more"]})]}),"fusion"===w&&(0,r.jsxs)("div",{className:"mt-2 flex min-w-0 flex-wrap items-center gap-1.5",children:[(0,r.jsx)("span",{className:"text-[11px] font-medium text-muted-foreground",children:"Judge"}),(0,r.jsxs)(x.m_,{children:[(0,r.jsx)(x.k$,{asChild:!0,children:(0,r.jsxs)("button",{onClick:()=>N(!0),className:"inline-flex max-w-full items-center gap-1 rounded border border-dashed border-primary/40 px-1.5 py-0.5 font-mono text-[11px] text-primary hover:border-primary hover:bg-primary/5 transition-colors",children:[(0,r.jsx)(p.A,{className:"size-3.5"}),(0,r.jsx)("span",{className:"truncate",children:C||`Auto — ${e.models[0]||"first model"}`})]})}),(0,r.jsx)(x.ZI,{children:"Pick the model that fuses panel answers"})]}),C&&(0,r.jsxs)(x.m_,{children:[(0,r.jsx)(x.k$,{asChild:!0,children:(0,r.jsx)("button",{onClick:()=>u({judgeModel:""}),className:"p-0.5 rounded text-muted-foreground hover:text-red-500 hover:bg-red-500/10 transition-colors",children:(0,r.jsx)(g.A,{className:"size-3.5"})})}),(0,r.jsx)(x.ZI,{children:"Reset judge to Auto"})]})]})]})]}),(0,r.jsxs)("div",{className:"flex w-full flex-col gap-2 sm:w-auto sm:flex-row sm:items-center sm:gap-3 sm:shrink-0",children:[(0,r.jsx)("div",{className:"w-full sm:w-[200px]",children:(0,r.jsxs)(h.l6,{value:w,onValueChange:e=>u({fallbackStrategy:e}),children:[(0,r.jsx)(h.bq,{className:"py-1.5 text-xs",children:(0,r.jsx)(h.yv,{})}),(0,r.jsx)(h.gC,{children:M.map(e=>(0,r.jsx)(h.eb,{value:e.value,children:e.label},e.value))})]})}),(0,r.jsxs)("div",{className:"grid grid-cols-3 gap-1 sm:flex",children:[(0,r.jsxs)(x.m_,{children:[(0,r.jsx)(x.k$,{asChild:!0,children:(0,r.jsx)(c.$,{variant:"ghost",size:"icon-sm",onClick:s=>{s.stopPropagation(),o(e.name,`combo-${e.id}`)},"aria-label":"Copy combo name",children:a===`combo-${e.id}`?(0,r.jsx)(b.A,{}):(0,r.jsx)(v.A,{})})}),(0,r.jsx)(x.ZI,{children:"Copy combo name"})]}),(0,r.jsxs)(x.m_,{children:[(0,r.jsx)(x.k$,{asChild:!0,children:(0,r.jsx)(c.$,{variant:"ghost",size:"icon-sm",onClick:n,"aria-label":"Edit",children:(0,r.jsx)(y.A,{})})}),(0,r.jsx)(x.ZI,{children:"Edit"})]}),(0,r.jsxs)(x.m_,{children:[(0,r.jsx)(x.k$,{asChild:!0,children:(0,r.jsx)(c.$,{variant:"ghost",size:"icon-sm",onClick:i,"aria-label":"Delete",className:"text-red-500 hover:bg-red-500/10 hover:text-red-500",children:(0,r.jsx)(k.A,{})})}),(0,r.jsx)(x.ZI,{children:"Delete"})]})]})]})]})}),j&&(0,r.jsx)(S.rq,{isOpen:j,onClose:()=>N(!1),onSelect:e=>{u({judgeModel:e?.value||""}),N(!1)},activeProviders:t,title:"Select Judge Model",addedModelValues:C?[C]:[],closeOnSelect:!0})]})}function P({id:e,index:s,model:t,isFirst:a,isLast:i,onEdit:d,onMoveUp:c,onMoveDown:m,onRemove:u}){let{attributes:h,listeners:j,setNodeRef:f,transform:p,isDragging:b}=(0,o.gl)({id:e}),v={transform:n.Ks.Transform.toString(p),opacity:b?.4:1,zIndex:b?999:void 0},[y,k]=(0,l.useState)(!1),[S,$]=(0,l.useState)(t),z=()=>{let e=S.trim();e&&e!==t?d(e):$(t),k(!1)};return(0,r.jsxs)("div",{ref:f,style:v,className:`group flex min-w-0 items-center gap-1.5 rounded-md px-2 py-1 bg-black/[0.02] hover:bg-black/[0.04] dark:bg-white/[0.02] dark:hover:bg-white/[0.04] transition-colors ${b?"shadow-md ring-1 ring-primary/30":""}`,children:[(0,r.jsxs)(x.m_,{children:[(0,r.jsx)(x.k$,{asChild:!0,children:(0,r.jsx)("button",{...h,...j,type:"button",className:"cursor-grab touch-none p-0.5 rounded text-muted-foreground hover:text-primary active:cursor-grabbing shrink-0",children:(0,r.jsx)(N.A,{className:"size-4"})})}),(0,r.jsx)(x.ZI,{children:"Drag to reorder"})]}),(0,r.jsx)("span",{className:"text-[10px] font-medium text-muted-foreground w-3 text-center shrink-0",children:s+1}),y?(0,r.jsx)("input",{autoFocus:!0,value:S,onChange:e=>$(e.target.value),onBlur:z,onKeyDown:e=>{"Enter"===e.key&&z(),"Escape"===e.key&&($(t),k(!1))},className:"min-w-0 flex-1 rounded border border-primary/40 bg-white px-1.5 py-0.5 font-mono text-xs text-foreground outline-none dark:bg-black/20"}):(0,r.jsxs)(x.m_,{children:[(0,r.jsx)(x.k$,{asChild:!0,children:(0,r.jsx)("div",{className:"min-w-0 flex-1 cursor-text truncate rounded px-1.5 py-0.5 font-mono text-xs text-foreground hover:bg-black/5 dark:hover:bg-white/5",onClick:()=>k(!0),children:t})}),(0,r.jsx)(x.ZI,{children:"Click to edit"})]}),(0,r.jsxs)("div",{className:"flex shrink-0 items-center gap-0.5",children:[(0,r.jsxs)(x.m_,{children:[(0,r.jsx)(x.k$,{asChild:!0,children:(0,r.jsx)("button",{onClick:c,disabled:a,className:`p-0.5 rounded ${a?"text-muted-foreground/20 cursor-not-allowed":"text-muted-foreground hover:text-primary hover:bg-black/5 dark:hover:bg-white/5"}`,children:(0,r.jsx)(w.A,{className:"size-3"})})}),(0,r.jsx)(x.ZI,{children:"Move up"})]}),(0,r.jsxs)(x.m_,{children:[(0,r.jsx)(x.k$,{asChild:!0,children:(0,r.jsx)("button",{onClick:m,disabled:i,className:`p-0.5 rounded ${i?"text-muted-foreground/20 cursor-not-allowed":"text-muted-foreground hover:text-primary hover:bg-black/5 dark:hover:bg-white/5"}`,children:(0,r.jsx)(C.A,{className:"size-3"})})}),(0,r.jsx)(x.ZI,{children:"Move down"})]})]}),(0,r.jsxs)(x.m_,{children:[(0,r.jsx)(x.k$,{asChild:!0,children:(0,r.jsx)("button",{onClick:u,className:"p-0.5 hover:bg-red-500/10 rounded text-muted-foreground hover:text-red-500 transition-all",children:(0,r.jsx)(g.A,{className:"size-3"})})}),(0,r.jsx)(x.ZI,{children:"Remove"})]})]})}function F({isOpen:e,combo:s,onClose:t,onSave:n,activeProviders:d,kindFilter:x=null}){let[h,p]=(0,l.useState)(s?.name||""),[g,b]=(0,l.useState)(s?.models||[]),[v,y]=(0,l.useState)(!1),[k,N]=(0,l.useState)(!1),[w,C]=(0,l.useState)(""),[$,z]=(0,l.useState)({}),A=(0,a.FR)((0,a.MS)(a.AN,{activationConstraint:{distance:5}}),(0,a.MS)(a.uN,{coordinateGetter:o.JR})),M=g.map((e,s)=>({uid:`item-${s}`,model:e})),_=async()=>{try{let e=await fetch("/api/models/alias");if(!e.ok)return;let s=await e.json();z(s.aliases||{})}catch(e){console.error("Error fetching modal data:",e)}};(0,l.useEffect)(()=>{e&&_()},[e]);let O=e=>e.trim()?E.test(e)?(C(""),!0):(C("Only letters, numbers, -, _ and . allowed"),!1):(C("Name is required"),!1),I=async()=>{O(h)&&(N(!0),await n({name:h.trim(),models:g}),N(!1))},Z=!!s;return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(u.lG,{open:e,onOpenChange:e=>{e||t()},children:(0,r.jsxs)(u.Cf,{className:"max-w-md",children:[(0,r.jsx)(u.c7,{children:(0,r.jsx)(u.L3,{children:Z?"Edit Combo":"Create Combo"})}),(0,r.jsxs)("div",{className:"flex flex-col gap-3 p-4",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"text-sm font-medium text-foreground mb-1.5 block",children:"Combo Name"}),(0,r.jsx)(m.p,{value:h,onChange:e=>{let s=e.target.value;p(s),s?O(s):C("")},placeholder:"my-combo","aria-invalid":!!w,className:w?"ring-1 ring-red-500 border-red-500/40":""}),w&&(0,r.jsx)("p",{className:"mt-1 text-xs text-red-500",children:w}),(0,r.jsx)("p",{className:"text-[10px] text-muted-foreground mt-0.5",children:"Only letters, numbers, -, _ and . allowed"})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"text-sm font-medium mb-1.5 block",children:"Models"}),0===g.length?(0,r.jsxs)("div",{className:"text-center py-4 border border-dashed border-black/10 dark:border-white/10 rounded-lg bg-black/[0.01] dark:bg-white/[0.01]",children:[(0,r.jsx)(f.A,{className:"mb-1 mx-auto size-6 text-muted-foreground"}),(0,r.jsx)("p",{className:"text-xs text-muted-foreground",children:"No models added yet"})]}):(0,r.jsx)(a.Mp,{sensors:A,collisionDetection:a.fp,onDragEnd:e=>{let{active:s,over:t}=e;if(t&&s.id!==t.id){let e=M.findIndex(e=>e.uid===s.id),r=M.findIndex(e=>e.uid===t.id);-1!==e&&-1!==r&&b(s=>(0,o.be)(s,e,r))}},modifiers:[i.FN,i.gj],children:(0,r.jsx)(o.gB,{items:M.map(e=>e.uid),strategy:o._G,children:(0,r.jsx)("div",{className:"flex max-h-[55vh] min-w-0 flex-col gap-1 overflow-y-auto sm:max-h-[350px]",children:M.map(({uid:e,model:s},t)=>(0,r.jsx)(P,{id:e,index:t,model:s,isFirst:0===t,isLast:t===M.length-1,onEdit:e=>{let s=[...g];s[t]=e,b(s)},onMoveUp:()=>(e=>{if(0===e)return;let s=[...g];[s[e-1],s[e]]=[s[e],s[e-1]],b(s)})(t),onMoveDown:()=>(e=>{if(e===g.length-1)return;let s=[...g];[s[e],s[e+1]]=[s[e+1],s[e]],b(s)})(t),onRemove:()=>{b(g.filter((e,s)=>s!==t))}},e))})})}),(0,r.jsxs)("button",{onClick:()=>y(!0),className:"w-full mt-2 py-2 border border-dashed border-black/10 dark:border-white/10 rounded-lg text-xs text-primary font-medium hover:text-primary hover:border-primary/50 transition-colors flex items-center justify-center gap-1",children:[(0,r.jsx)(j.A,{className:"size-4"}),"Add Model"]})]})]}),(0,r.jsx)(u.Es,{children:(0,r.jsx)("div",{className:"flex w-full flex-col gap-2 pt-1 sm:flex-row",children:(0,r.jsx)(c.$,{onClick:I,size:"sm",className:"flex-1",disabled:!h.trim()||!!w||k,children:k?"Saving...":Z?"Save":"Create"})})})]})}),v&&(0,r.jsx)(S.rq,{isOpen:v,onClose:()=>y(!1),onSelect:e=>{g.includes(e.value)||b([...g,e.value])},onDeselect:e=>{b(g.filter(s=>s!==e.value))},activeProviders:d,modelAliases:$,title:"Add Model to Combo",kindFilter:x,addedModelValues:g,closeOnSelect:!1})]})}},67053:(e,s,t)=>{Promise.resolve().then(t.bind(t,29982))},92412:(e,s,t)=>{"use strict";t.d(s,{YW:()=>r.Page,pV:()=>r.CardGrid,wn:()=>r.Section,zY:()=>r.PageHeader}),t(16675),t(72778);var r=t(29575)},99656:(e,s,t)=>{"use strict";t.d(s,{PM:()=>r.PM,Sj:()=>r.Sj,Vy:()=>r.Vy,fF:()=>r.fF,sl:()=>r.sl,vL:()=>r.vL,y$:()=>r.y$,zM:()=>r.zM});var r=t(31872)}},e=>{e.O(0,[6766,5166,7552,9980,6428,4484,9150,3577,5862,5148,1699,1722,1078,1660,4489,1278,1830,6770,427,9966,7358],()=>e(e.s=67053)),_N_E=e.O()}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[712],{1352:(e,t,r)=>{"use strict";r.d(t,{Bc:()=>i,ZI:()=>l,k$:()=>o,m_:()=>d});var a=r(29798);r(15814);var s=r(5471),n=r(44484);function i({delayDuration:e=0,...t}){return(0,a.jsx)(n.Kq,{"data-slot":"tooltip-provider",delayDuration:e,...t})}function d({...e}){return(0,a.jsx)(n.bL,{"data-slot":"tooltip",...e})}function o({...e}){return(0,a.jsx)(n.l9,{"data-slot":"tooltip-trigger",...e})}function l({className:e,sideOffset:t=0,children:r,...i}){return(0,a.jsx)(n.ZL,{children:(0,a.jsxs)(n.UC,{"data-slot":"tooltip-content",sideOffset:t,className:(0,s.cn)("z-50 inline-flex w-fit max-w-xs origin-(--radix-tooltip-content-transform-origin) items-center gap-1.5 rounded-md bg-foreground px-3 py-1.5 text-xs text-background has-data-[slot=kbd]:pr-1.5 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 **:data-[slot=kbd]:relative **:data-[slot=kbd]:isolate **:data-[slot=kbd]:z-50 **:data-[slot=kbd]:rounded-sm data-[state=delayed-open]:animate-in data-[state=delayed-open]:fade-in-0 data-[state=delayed-open]:zoom-in-95 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",e),...i,children:[r,(0,a.jsx)(n.i3,{className:"z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px] bg-foreground fill-foreground"})]})})}},13189:(e,t,r)=>{"use strict";r.d(t,{default:()=>D});var a=r(29798),s=r(15814),n=r(75669),i=r(18055),d=r(53784),o=r(77345),l=r(1352),c=r(45111),u=r(74719),g=r(66685),p=r(24477),x=r(26339),m=r(75877),f=r(51660);let h={USAGE:"usage",STREAM:"stream","STREAM USAGE":"usage",COMBO:"combo",FUSION:"combo",TOKEN:"token",RTK:"rtk",HEADROOM:"rtk",REQUEST:"request",PROXY:"proxy",AUTH:"auth",AG_QUOTA:"auth",DB:"db",TUNNEL:"tunnel",PROJECTID:"other"},v={debug:"debug",info:"info",log:"info",warn:"warn",error:"error"},b={debug:0,info:1,warn:2,error:3};function y(e,t){return b[t]>b[e]?t:e}function j(e,t){let r=v[e]??"info",a="other";if(/\[DBG:[^\]]+\]/.test(t)||t.includes("\uD83D\uDC1B"))return{level:"debug",category:"debug"};let s=t.match(/^\[\d{1,2}:\d{2}(:\d{2})?\]\s+(DEBUG|INFO|WARN|ERROR)\b/);if(s){let e=s[2].toLowerCase();b[e]>b[r]&&(r=e)}let n=t.match(/^\[\d{1,2}:\d{2}(:\d{2})?\]\s+\[[0-9a-f]{4}\]\s+([A-Z]+)\b/);if(n){let e=n[2];"REQ"===e?a="request":"DONE"===e?a="done":"SAVERS"===e?a="rtk":"REFRESH"===e?a="token":"BLOCKED"===e||"ABORT"===e?a="stream":"ERROR"===e&&(r=y(r,"error"),"other"===a&&(a="request"))}if("other"===a&&/^\[\d{1,2}:\d{2}(:\d{2})?\]\s+\[(http|stream|usage)\]/i.test(t)){let e=t.match(/^\[\d{1,2}:\d{2}(:\d{2})?\]\s+\[(http|stream|usage)\]/i)[2].toLowerCase();a="http"===e?"request":e}let i=t.match(/\[([A-Z][A-Z _-]*)\]/g);if(i)for(let e of i){let t=e.slice(1,-1).trim();if(h[t]){a=h[t];break}if("DBG"===t||t.startsWith("DBG:"))return{level:"debug",category:"debug"}}return t.includes("✗")||t.includes("❌")?(r=y(r,"error"),"other"===a&&(a="request")):t.includes("\uD83D\uDCCA")?t.includes("DONE")?a="done":"other"===a&&(a="usage"):t.includes("⚠️")?r=y(r,"warn"):t.includes("\uD83C\uDF0A")?"other"===a&&(a="stream"):t.includes("\uD83D\uDD11")||t.includes("TOKEN REFRESHED")?"other"===a&&(a="token"):t.includes("ℹ️")||t.includes("\uD83D\uDD0D")?t.includes("\uD83D\uDD0D")&&(r=y(r,"debug")):t.includes("\uD83D\uDCE5")&&"other"===a&&(a="request"),"other"===a&&/\b(POST|GET|PUT|DELETE|PATCH)\b/.test(t)&&(a="request"),/\bERROR \d{3}\b/.test(t)||/\bFAILED\b/.test(t)||/\bBLOCKED\b/.test(t)?r=y(r,"error"):/\b(falling back|fallback|unavailable|skipped|retry)\b/i.test(t)&&(r=y(r,"warn")),"other"===a&&(t.includes("[RTK]")||t.includes("HEADROOM")||t.includes("PXPIPE")?a="rtk":t.includes("[ProjectId]")?a="other":t.includes("[ProxyFetch]")?a="proxy":t.includes("[Tunnel]")?a="tunnel":t.includes("[DB]")?a="db":t.includes("[RequestDetail]")?a="request":t.includes("[STREAM]")?a="stream":t.includes("[TOKEN]")?a="token":t.includes("[COMBO]")||t.includes("[FUSION]")?a="combo":t.includes("[CHAT]")&&(a="request")),{level:r,category:a}}function k(e,t="log"){if("string"==typeof e){let{level:r,category:a}=j(t,e);return{ts:Date.now(),level:r,category:a,text:e}}if(e&&"object"==typeof e&&"string"==typeof e.text){if("number"==typeof e.ts&&e.level&&e.category)return e;let{level:r,category:a}=j(t,e.text);return{ts:"number"==typeof e.ts?e.ts:Date.now(),level:e.level??r,category:e.category??a,text:e.text}}let r=String(e??""),{level:a,category:s}=j(t,r);return{ts:Date.now(),level:a,category:s,text:r}}let w={debug:"secondary",info:"default",warn:"secondary",error:"destructive"},N={debug:"bg-muted text-muted-foreground",info:"bg-sky-500/15 text-sky-700 dark:text-sky-300",warn:"bg-amber-500/15 text-amber-700 dark:text-amber-300",error:""},z={debug:"DEBUG",info:"INFO",warn:"WARN",error:"ERROR"},A=["debug","info","warn","error"],E={all:"All categories",request:"Request",done:"Done",usage:"Usage",combo:"Combo",token:"Token",rtk:"RTK",stream:"Stream",debug:"Debug",auth:"Auth",proxy:"Proxy",db:"DB",tunnel:"Tunnel",other:"Other"},R=["request","done","usage","combo","token","rtk","stream","debug","auth","proxy","db","tunnel","other"],O=/^\[\d{1,2}:\d{2}(:\d{2})?(\s?[AP]M)?\]\s*/,C=/\b(IN|OUT) \d[\d,]*( \(CACHE [^)]*\))?|\b\d[\d,]*ms\b|\b[A-Za-z_][\w.-]*=[^\s·|,]+/g;function T({text:e,isError:t}){let[r,n]=(0,s.useMemo)(()=>{let t;return -1===(t=e.indexOf("\n"))?[e,null]:[e.slice(0,t),e.slice(t+1)]},[e]),i=(0,s.useMemo)(()=>(function(e){let t=[],r=0;for(let a of e.matchAll(C)){let s=a[0],n=a.index??0;if(n>r&&t.push({kind:"plain",text:e.slice(r,n)}),/^(IN|OUT) /.test(s))t.push({kind:"tokens",text:s});else if(/ms$/.test(s))t.push({kind:"duration",text:s});else{let e=s.indexOf("=");t.push({kind:"kv",key:s.slice(0,e+1),value:s.slice(e+1)})}r=n+s.length}return r<e.length&&t.push({kind:"plain",text:e.slice(r)}),0===t.length&&t.push({kind:"plain",text:e}),t})(r.replace(O,"")),[r]);return(0,a.jsxs)("span",{className:"break-words",children:[i.map((e,t)=>"duration"===e.kind?(0,a.jsx)("span",{className:"font-semibold text-amber-700",children:e.text},t):"tokens"===e.kind?(0,a.jsx)("span",{className:"font-semibold text-emerald-700",children:e.text},t):"kv"===e.kind?(0,a.jsxs)("span",{children:[(0,a.jsx)("span",{className:"text-muted-foreground",children:e.key}),(0,a.jsx)("span",{className:"font-medium text-sky-700",children:e.value})]},t):(0,a.jsx)("span",{children:e.text},t)),n&&(0,a.jsxs)("details",{className:"mt-1",children:[(0,a.jsx)("summary",{className:`cursor-pointer text-[11px] font-medium ${t?"text-red-600":"text-muted-foreground"} hover:underline`,children:"Stack trace"}),(0,a.jsx)("pre",{className:"mt-1 max-h-40 overflow-auto rounded bg-muted p-2 text-[11px] whitespace-pre-wrap text-muted-foreground",children:n})]})]})}function _({entry:e}){let t="error"===e.level,r="warn"===e.level,s="done"===e.category;return(0,a.jsxs)("div",{className:`flex items-start gap-2 px-3 py-1.5 leading-relaxed ${t?"border-l-2 border-red-500 bg-red-500/5":r?"border-l-2 border-amber-500 bg-amber-500/5":s?"border-l-2 border-green-500 bg-green-500/5":"border-l-2 border-transparent hover:bg-muted/50"}`,children:[(0,a.jsx)("span",{className:"shrink-0 pt-0.5 text-[11px] text-muted-foreground tabular-nums",children:new Date(e.ts).toLocaleTimeString("en-US",{hour12:!1})}),(0,a.jsx)(d.E,{variant:w[e.level],className:`shrink-0 ${N[e.level]}`,children:z[e.level]}),(0,a.jsx)("span",{className:"shrink-0 rounded bg-muted px-1.5 py-0.5 text-[10px] font-semibold text-muted-foreground uppercase",children:E[e.category]}),(0,a.jsx)("span",{className:"min-w-0 flex-1 text-foreground",children:(0,a.jsx)(T,{text:e.text,isError:t})})]})}function S(e){return e.map(e=>k(e))}function D(){let[e,t]=(0,s.useState)([]),[r,h]=(0,s.useState)(!1),[v,b]=(0,s.useState)(!1),[y,j]=(0,s.useState)(!0),[N,O]=(0,s.useState)(""),[C,T]=(0,s.useState)(new Set(A)),[D,L]=(0,s.useState)("all"),M=(0,s.useRef)(null),U=(0,s.useRef)(v);(0,s.useEffect)(()=>{U.current=v},[v]);let q=async()=>{try{await fetch("/api/translator/console-logs",{method:"DELETE"})}catch(e){console.error("Failed to clear console logs:",e)}};(0,s.useEffect)(()=>{let e=new EventSource("/api/translator/console-logs/stream");return e.onopen=()=>h(!0),e.onmessage=e=>{if(U.current)return;let r=JSON.parse(e.data);if("init"===r.type)t(S(r.logs).slice(-f.UY.maxLines));else if("line"===r.type){let e=k(r.line);t(t=>{let r=[...t,e];return r.length>f.UY.maxLines?r.slice(-f.UY.maxLines):r})}else if("lines"===r.type){let e=S(r.lines);t(t=>{let r=[...t,...e];return r.length>f.UY.maxLines?r.slice(-f.UY.maxLines):r})}else"clear"===r.type&&t([])},e.onerror=()=>h(!1),()=>e.close()},[]),(0,s.useEffect)(()=>{y&&M.current&&(M.current.scrollTop=M.current.scrollHeight)},[e,y]);let B=(0,s.useMemo)(()=>{let t=N.trim().toLowerCase();return e.filter(e=>!!C.has(e.level)&&("all"===D||e.category===D)&&(!t||!!e.text.toLowerCase().includes(t)))},[e,C,D,N]),P=(0,s.useMemo)(()=>e.filter(e=>"error"===e.level).length,[e]),I=(0,s.useMemo)(()=>e.filter(e=>"warn"===e.level).length,[e]);return(0,a.jsxs)(n.Zp,{children:[(0,a.jsxs)(n.aR,{children:[(0,a.jsx)(n.ZB,{className:"sr-only",children:"Console logs"}),(0,a.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,a.jsxs)(l.m_,{children:[(0,a.jsx)(l.k$,{asChild:!0,children:(0,a.jsx)("span",{className:r?"size-2 rounded-full bg-green-500":"size-2 rounded-full bg-red-500"})}),(0,a.jsx)(l.ZI,{children:r?"Connected":"Disconnected"})]}),(0,a.jsxs)("span",{className:"text-xs text-muted-foreground",children:[B.length,"/",e.length," lines",P>0&&(0,a.jsxs)("span",{className:"font-semibold text-red-600",children:[" \xb7 ",P," errors"]}),I>0&&(0,a.jsxs)("span",{className:"font-semibold text-yellow-600",children:[" \xb7 ",I," warnings"]})]}),(0,a.jsxs)("div",{className:"ml-auto flex flex-wrap items-center gap-2",children:[(0,a.jsxs)("div",{className:"relative",children:[(0,a.jsx)(u.A,{className:"pointer-events-none absolute top-1/2 left-2.5 size-3.5 -translate-y-1/2 text-muted-foreground"}),(0,a.jsx)(o.p,{value:N,onChange:e=>O(e.target.value),placeholder:"Search logs…",className:"h-7 w-44 pl-8 text-xs"})]}),(0,a.jsx)("div",{className:"flex items-center gap-1",children:A.map(e=>(0,a.jsxs)(l.m_,{children:[(0,a.jsx)(l.k$,{asChild:!0,children:(0,a.jsx)("button",{type:"button",onClick:()=>{T(t=>{let r=new Set(t);return r.has(e)?r.delete(e):r.add(e),r})},className:`cursor-pointer transition-opacity ${C.has(e)?"opacity-100":"opacity-30 grayscale"}`,children:(0,a.jsx)(d.E,{variant:w[e],children:z[e]})})}),(0,a.jsx)(l.ZI,{children:`Toggle ${z[e]}`})]},e))}),(0,a.jsxs)(c.l6,{value:D,onValueChange:e=>L(e),children:[(0,a.jsx)(c.bq,{className:"h-7 w-32 text-xs",children:(0,a.jsx)(c.yv,{})}),(0,a.jsxs)(c.gC,{children:[(0,a.jsx)(c.eb,{value:"all",children:E.all}),R.map(e=>(0,a.jsx)(c.eb,{value:e,children:E[e]},e))]})]}),(0,a.jsxs)(i.$,{size:"sm",variant:"outline",onClick:()=>b(e=>!e),children:[v?(0,a.jsx)(g.A,{}):(0,a.jsx)(p.A,{}),v?"Resume":"Pause"]}),(0,a.jsxs)(l.m_,{children:[(0,a.jsx)(l.k$,{asChild:!0,children:(0,a.jsxs)(i.$,{size:"sm",variant:y?"secondary":"outline",onClick:()=>j(e=>!e),children:[(0,a.jsx)(x.A,{}),"Follow"]})}),(0,a.jsx)(l.ZI,{children:"Auto-scroll to newest"})]}),(0,a.jsxs)(i.$,{size:"sm",variant:"outline",onClick:q,children:[(0,a.jsx)(m.A,{}),"Clear"]})]})]})]}),(0,a.jsx)(n.Wu,{className:"pt-0",children:(0,a.jsx)("div",{ref:M,className:"h-[calc(100vh-220px)] overflow-y-auto rounded-b-lg border border-border bg-card p-2 font-mono text-xs",children:0===e.length?(0,a.jsx)("span",{className:"text-muted-foreground",children:"No console logs yet."}):0===B.length?(0,a.jsx)("span",{className:"text-muted-foreground",children:"No logs match the current filters."}):(0,a.jsx)("div",{className:"divide-y divide-border/50",children:B.map((e,t)=>(0,a.jsx)(_,{entry:e},t))})})})]})}},15298:(e,t,r)=>{Promise.resolve().then(r.bind(r,13189))},18055:(e,t,r)=>{"use strict";r.d(t,{$:()=>o});var a=r(29798);r(15814);var s=r(54366),n=r(5471),i=r(80954);let d=(0,s.F)("group/button inline-flex shrink-0 items-center justify-center rounded-md border border-transparent bg-clip-padding text-sm font-medium whitespace-nowrap transition-all outline-none select-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 active:not-aria-[haspopup]:translate-y-px disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/80",outline:"border-border bg-background shadow-xs hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:border-input dark:bg-input/30 dark:hover:bg-input/50",secondary:"bg-secondary text-secondary-foreground hover:bg-[color-mix(in_oklch,var(--secondary),var(--foreground)_5%)] aria-expanded:bg-secondary aria-expanded:text-secondary-foreground",ghost:"hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:hover:bg-muted/50",destructive:"bg-destructive/10 text-destructive hover:bg-destructive/20 focus-visible:border-destructive/40 focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:hover:bg-destructive/30 dark:focus-visible:ring-destructive/40",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 gap-1.5 px-2.5 in-data-[slot=button-group]:rounded-md has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",xs:"h-6 gap-1 rounded-[min(var(--radius-md),8px)] px-2 text-xs in-data-[slot=button-group]:rounded-md has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3",sm:"h-8 gap-1 rounded-[min(var(--radius-md),10px)] px-2.5 in-data-[slot=button-group]:rounded-md has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5",lg:"h-10 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",icon:"size-9","icon-xs":"size-6 rounded-[min(var(--radius-md),8px)] in-data-[slot=button-group]:rounded-md [&_svg:not([class*='size-'])]:size-3","icon-sm":"size-8 rounded-[min(var(--radius-md),10px)] in-data-[slot=button-group]:rounded-md","icon-lg":"size-10"}},defaultVariants:{variant:"default",size:"default"}});function o({className:e,variant:t="default",size:r="default",asChild:s=!1,...l}){let c=s?i.bL:"button";return(0,a.jsx)(c,{"data-slot":"button","data-variant":t,"data-size":r,className:(0,n.cn)(d({variant:t,size:r,className:e})),...l})}},24477:(e,t,r)=>{"use strict";r.d(t,{A:()=>n});var a=r(50009);let s={name:"pause",size:24,node:[["rect",{x:"14",y:"3",width:"5",height:"18",rx:"1",key:"kaeet6"}],["rect",{x:"5",y:"3",width:"5",height:"18",rx:"1",key:"1wsw3u"}]]};s.node;let n=(0,a.A)(s)},26339:(e,t,r)=>{"use strict";r.d(t,{A:()=>n});var a=r(50009);let s={name:"arrow-down",size:24,node:[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]]};s.node;let n=(0,a.A)(s)},28830:(e,t,r)=>{"use strict";r.d(t,{A:()=>n});var a=r(50009);let s={name:"chevron-up",size:24,node:[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]};s.node;let n=(0,a.A)(s)},45111:(e,t,r)=>{"use strict";r.d(t,{bq:()=>u,eb:()=>p,gC:()=>g,l6:()=>l,yv:()=>c});var a=r(29798);r(15814);var s=r(5471),n=r(95862),i=r(58765),d=r(63587),o=r(28830);function l({...e}){return(0,a.jsx)(n.bL,{"data-slot":"select",...e})}function c({...e}){return(0,a.jsx)(n.WT,{"data-slot":"select-value",...e})}function u({className:e,size:t="default",children:r,...d}){return(0,a.jsxs)(n.l9,{"data-slot":"select-trigger","data-size":t,className:(0,s.cn)("flex w-fit items-center justify-between gap-1.5 rounded-md border border-input bg-background py-2 pr-2 pl-2.5 text-sm whitespace-nowrap shadow-xs transition-[color,box-shadow] outline-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 data-placeholder:text-muted-foreground data-[size=default]:h-9 data-[size=sm]:h-8 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-1.5 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),...d,children:[r,(0,a.jsx)(n.In,{asChild:!0,children:(0,a.jsx)(i.A,{className:"pointer-events-none size-4 text-muted-foreground"})})]})}function g({className:e,children:t,position:r="popper",align:i="center",...d}){return(0,a.jsx)(n.ZL,{children:(0,a.jsxs)(n.UC,{"data-slot":"select-content","data-align-trigger":"item-aligned"===r,className:(0,s.cn)("relative z-50 max-h-(--radix-select-content-available-height) min-w-36 origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md bg-popover text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 data-[align-trigger=true]:animate-none data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95","popper"===r&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",e),position:r,align:i,...d,children:[(0,a.jsx)(x,{}),(0,a.jsx)(n.LM,{"data-position":r,className:(0,s.cn)("data-[position=popper]:h-(--radix-select-trigger-height) data-[position=popper]:w-full data-[position=popper]:min-w-(--radix-select-trigger-width)","popper"===r&&""),children:t}),(0,a.jsx)(m,{})]})})}function p({className:e,children:t,...r}){return(0,a.jsxs)(n.q7,{"data-slot":"select-item",className:(0,s.cn)("relative flex w-full cursor-default items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2",e),...r,children:[(0,a.jsx)("span",{className:"pointer-events-none absolute right-2 flex size-4 items-center justify-center",children:(0,a.jsx)(n.VF,{children:(0,a.jsx)(d.A,{className:"pointer-events-none"})})}),(0,a.jsx)(n.p4,{children:t})]})}function x({className:e,...t}){return(0,a.jsx)(n.PP,{"data-slot":"select-scroll-up-button",className:(0,s.cn)("z-10 flex cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-4",e),...t,children:(0,a.jsx)(o.A,{})})}function m({className:e,...t}){return(0,a.jsx)(n.wn,{"data-slot":"select-scroll-down-button",className:(0,s.cn)("z-10 flex cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-4",e),...t,children:(0,a.jsx)(i.A,{})})}},53784:(e,t,r)=>{"use strict";r.d(t,{E:()=>o});var a=r(29798);r(15814);var s=r(54366),n=r(5471),i=r(80954);let d=(0,s.F)("group/badge inline-flex h-5 w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-4xl border border-transparent px-2 py-0.5 text-xs font-medium whitespace-nowrap transition-all focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&>svg]:pointer-events-none [&>svg]:size-3!",{variants:{variant:{default:"bg-primary text-primary-foreground [a]:hover:bg-primary/80",secondary:"bg-secondary text-secondary-foreground [a]:hover:bg-secondary/80",destructive:"bg-destructive/10 text-destructive focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:focus-visible:ring-destructive/40 [a]:hover:bg-destructive/20",outline:"border-border text-foreground [a]:hover:bg-muted [a]:hover:text-muted-foreground",ghost:"hover:bg-muted hover:text-muted-foreground dark:hover:bg-muted/50",link:"text-primary underline-offset-4 hover:underline"}},defaultVariants:{variant:"default"}});function o({className:e,variant:t="default",asChild:r=!1,...s}){let l=r?i.bL:"span";return(0,a.jsx)(l,{"data-slot":"badge","data-variant":t,className:(0,n.cn)(d({variant:t}),e),...s})}},58765:(e,t,r)=>{"use strict";r.d(t,{A:()=>n});var a=r(50009);let s={name:"chevron-down",size:24,node:[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]};s.node;let n=(0,a.A)(s)},63587:(e,t,r)=>{"use strict";r.d(t,{A:()=>n});var a=r(50009);let s={name:"check",size:24,node:[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]};s.node;let n=(0,a.A)(s)},66685:(e,t,r)=>{"use strict";r.d(t,{A:()=>n});var a=r(50009);let s={name:"play",size:24,node:[["path",{d:"M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z",key:"10ikf1"}]]};s.node;let n=(0,a.A)(s)},74719:(e,t,r)=>{"use strict";r.d(t,{A:()=>n});var a=r(50009);let s={name:"search",size:24,node:[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]]};s.node;let n=(0,a.A)(s)},75669:(e,t,r)=>{"use strict";r.d(t,{BT:()=>o,Wu:()=>c,X9:()=>l,ZB:()=>d,Zp:()=>n,aR:()=>i});var a=r(29798);r(15814);var s=r(5471);function n({className:e,size:t="default",...r}){return(0,a.jsx)("div",{"data-slot":"card","data-size":t,className:(0,s.cn)("group/card flex flex-col gap-(--card-spacing) overflow-hidden rounded-xl bg-card py-(--card-spacing) text-sm text-card-foreground shadow-xs ring-1 ring-foreground/10 [--card-spacing:--spacing(6)] has-[>img:first-child]:pt-0 data-[size=sm]:[--card-spacing:--spacing(4)] *:[img:first-child]:rounded-t-xl *:[img:last-child]:rounded-b-xl",e),...r})}function i({className:e,...t}){return(0,a.jsx)("div",{"data-slot":"card-header",className:(0,s.cn)("group/card-header @container/card-header grid auto-rows-min items-start gap-1 rounded-t-xl px-(--card-spacing) has-data-[slot=card-action]:grid-cols-[1fr_auto] has-data-[slot=card-description]:grid-rows-[auto_auto] [.border-b]:pb-(--card-spacing)",e),...t})}function d({className:e,...t}){return(0,a.jsx)("div",{"data-slot":"card-title",className:(0,s.cn)("font-heading text-base leading-normal font-medium group-data-[size=sm]/card:text-sm",e),...t})}function o({className:e,...t}){return(0,a.jsx)("div",{"data-slot":"card-description",className:(0,s.cn)("text-sm text-muted-foreground",e),...t})}function l({className:e,...t}){return(0,a.jsx)("div",{"data-slot":"card-action",className:(0,s.cn)("col-start-2 row-span-2 row-start-1 self-start justify-self-end",e),...t})}function c({className:e,...t}){return(0,a.jsx)("div",{"data-slot":"card-content",className:(0,s.cn)("flex flex-col gap-3 px-(--card-spacing)",e),...t})}},75877:(e,t,r)=>{"use strict";r.d(t,{A:()=>n});var a=r(50009);let s={name:"trash",size:24,node:[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],aliases:["trash-2"]};s.node;let n=(0,a.A)(s)},77345:(e,t,r)=>{"use strict";r.d(t,{p:()=>n});var a=r(29798);r(15814);var s=r(5471);function n({className:e,type:t,...r}){return(0,a.jsx)("input",{type:t,"data-slot":"input",className:(0,s.cn)("h-9 w-full min-w-0 rounded-md border border-input bg-background px-2.5 py-1 text-base shadow-xs transition-[color,box-shadow] outline-none file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 md:text-sm dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40",e),...r})}}},e=>{e.O(0,[5166,7552,9980,6428,4484,3577,5862,1660,427,9966,7358],()=>e(e.s=15298)),_N_E=e.O()}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[6099],{},_=>{_.O(0,[6766,5166,7552,9980,6428,4484,9150,3577,5862,5148,1699,1722,1660,4489,1278,1830,6770,2836,427,9966,7358],()=>_(_.s=92836)),_N_E=_.O()}]);
|
|
@@ -7,4 +7,4 @@
|
|
|
7
7
|
"is_urgent": { "type": "noul", "noul": 0.99 }
|
|
8
8
|
},
|
|
9
9
|
"usage": { "input_tokens": 312, "output_tokens": 48 }
|
|
10
|
-
}`})]})]})]})})]})}}},e=>{e.O(0,[6766,5166,7552,9980,
|
|
10
|
+
}`})]})]})]})})]})}}},e=>{e.O(0,[6766,5166,7552,9980,6428,4484,9150,3577,5862,5148,1699,1722,1660,4489,1278,1830,6770,9369,427,9966,7358],()=>e(e.s=24715)),_N_E=e.O()}]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[113],{22205:(e,s,t)=>{"use strict";t.d(s,{default:()=>h});var r=t(29798),n=t(50141),a=t.n(n),i=t(5471),d=t(75669),l=t(14231),o=t(1352),c=t(58913);function h({href:e,icon:s,iconBg:t,title:n,children:u,meta:x,dimmed:m,toggle:p,className:f}){let g=p?p.checked?p.disabledLabel??"Disable":p.enabledLabel??"Enable":void 0;return(0,r.jsx)(a(),{href:e,className:"group block h-full min-w-0",children:(0,r.jsx)(d.Zp,{size:"sm",className:(0,i.cn)("h-full transition-all hover:border-primary/40 hover:shadow-sm",m&&"opacity-50",f),children:(0,r.jsx)(d.Wu,{children:(0,r.jsxs)("div",{className:"flex min-w-0 items-center gap-3",children:[(0,r.jsx)("div",{className:"flex size-10 shrink-0 items-center justify-center rounded-xl ring-1 ring-inset ring-foreground/5",style:t?{backgroundColor:t}:void 0,children:s}),(0,r.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,r.jsx)("h3",{className:"truncate text-sm font-semibold",children:n}),(0,r.jsxs)("div",{className:"mt-1 flex min-w-0 flex-wrap items-center gap-1.5 text-xs",children:[u,x]})]}),(0,r.jsxs)("div",{className:"flex shrink-0 items-center gap-1",children:[p&&(0,r.jsx)("div",{className:"opacity-100 transition-opacity sm:opacity-0 sm:group-hover:opacity-100 sm:group-focus-within:opacity-100",onClick:e=>{p&&(e.preventDefault(),e.stopPropagation(),p.onToggle(!p.checked))},children:(0,r.jsxs)(o.m_,{children:[(0,r.jsx)(o.k$,{asChild:!0,children:(0,r.jsx)(l.d,{size:"sm",checked:p.checked,onCheckedChange:()=>{},"aria-label":g})}),(0,r.jsx)(o.ZI,{side:"top",children:g})]})}),(0,r.jsx)(c.default,{name:"chevron_right",className:"shrink-0 text-[18px] text-muted-foreground transition-transform group-hover:translate-x-0.5"})]})]})})})})}},30067:(e,s,t)=>{Promise.resolve().then(t.bind(t,72745))},72745:(e,s,t)=>{"use strict";t.r(s),t.d(s,{default:()=>h});var r=t(29798),n=t(15814),a=t(53784),i=t(92412),d=t(22205),l=t(738),o=t(13794);function c(e){let s=Object.entries(e).some(([e,s])=>e.startsWith("modelLock_")&&s&&new Date(s).getTime()>Date.now());return"unavailable"!==e.testStatus||s?e.testStatus:"active"}function h(){let[e,s]=(0,n.useState)([]);(0,n.useEffect)(()=>{fetch("/api/providers",{cache:"no-store"}).then(e=>e.json()).then(e=>s(e.connections||[])).catch(()=>{})},[]);let t=o.rj.find(e=>"systemone"===e.id),h=(0,o.o5)("systemone");return(0,r.jsxs)(i.YW,{children:[(0,r.jsx)(i.zY,{title:"System One",backHref:"/dashboard/providers",backLabel:"Providers",description:(0,r.jsxs)(r.Fragment,{children:[t?.label??"Decision models"," (Jev) — native"," ",(0,r.jsx)("code",{className:"font-mono text-xs bg-sidebar px-1 py-0.5 rounded",children:"POST /v1/systemone"})," ","endpoint. Send a state + questions, get scored answers back."]})}),0===h.length?(0,r.jsxs)("div",{className:"text-center py-12 border border-dashed border-border rounded-xl text-muted-foreground text-sm",children:["No providers support ",(0,r.jsx)("strong",{children:"System One"})," yet."]}):(0,r.jsx)(i.pV,{children:h.map(s=>{let t=e.filter(e=>e.provider===s.id),n=t.filter(e=>{let s=c(e);return"active"===s||"success"===s}).length,i=t.filter(e=>{let s=c(e);return"error"===s||"expired"===s||"unavailable"===s}).length,h=!!o.Q2[s.id]?.noAuth;return(0,r.jsx)(d.default,{href:`/dashboard/media-providers/systemone/${s.id}`,title:s.name,iconBg:function(e){if(e)return e.length>7?e:`${e}15`}(s.color??"#888"),icon:(0,r.jsx)(l.A,{src:`/providers/${s.id}.png`,alt:s.name,size:30,className:"max-h-[30px] max-w-[30px] rounded-lg object-contain",fallbackText:s.textIcon||s.id.slice(0,2).toUpperCase(),fallbackColor:s.color}),children:h?(0,r.jsxs)(a.E,{variant:"default",children:[(0,r.jsx)("span",{className:"size-1.5 rounded-full bg-green-500"}),"Ready"]}):0===t.length?(0,r.jsx)("span",{className:"text-xs text-muted-foreground",children:"No connections"}):(0,r.jsxs)(r.Fragment,{children:[n>0&&(0,r.jsxs)(a.E,{variant:"default",children:[(0,r.jsx)("span",{className:"size-1.5 rounded-full bg-green-500"}),n," Connected"]}),i>0&&(0,r.jsxs)(a.E,{variant:"destructive",children:[(0,r.jsx)("span",{className:"size-1.5 rounded-full bg-red-500"}),i," Error"]}),0===n&&0===i&&(0,r.jsxs)(a.E,{variant:"default",children:[t.length," Added"]})]})},s.id)})})]})}},92412:(e,s,t)=>{"use strict";t.d(s,{YW:()=>r.Page,pV:()=>r.CardGrid,wn:()=>r.Section,zY:()=>r.PageHeader}),t(16675),t(72778);var r=t(29575)}},e=>{e.O(0,[6766,5166,7552,9980,
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[113],{22205:(e,s,t)=>{"use strict";t.d(s,{default:()=>h});var r=t(29798),n=t(50141),a=t.n(n),i=t(5471),d=t(75669),l=t(14231),o=t(1352),c=t(58913);function h({href:e,icon:s,iconBg:t,title:n,children:u,meta:x,dimmed:m,toggle:p,className:f}){let g=p?p.checked?p.disabledLabel??"Disable":p.enabledLabel??"Enable":void 0;return(0,r.jsx)(a(),{href:e,className:"group block h-full min-w-0",children:(0,r.jsx)(d.Zp,{size:"sm",className:(0,i.cn)("h-full transition-all hover:border-primary/40 hover:shadow-sm",m&&"opacity-50",f),children:(0,r.jsx)(d.Wu,{children:(0,r.jsxs)("div",{className:"flex min-w-0 items-center gap-3",children:[(0,r.jsx)("div",{className:"flex size-10 shrink-0 items-center justify-center rounded-xl ring-1 ring-inset ring-foreground/5",style:t?{backgroundColor:t}:void 0,children:s}),(0,r.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,r.jsx)("h3",{className:"truncate text-sm font-semibold",children:n}),(0,r.jsxs)("div",{className:"mt-1 flex min-w-0 flex-wrap items-center gap-1.5 text-xs",children:[u,x]})]}),(0,r.jsxs)("div",{className:"flex shrink-0 items-center gap-1",children:[p&&(0,r.jsx)("div",{className:"opacity-100 transition-opacity sm:opacity-0 sm:group-hover:opacity-100 sm:group-focus-within:opacity-100",onClick:e=>{p&&(e.preventDefault(),e.stopPropagation(),p.onToggle(!p.checked))},children:(0,r.jsxs)(o.m_,{children:[(0,r.jsx)(o.k$,{asChild:!0,children:(0,r.jsx)(l.d,{size:"sm",checked:p.checked,onCheckedChange:()=>{},"aria-label":g})}),(0,r.jsx)(o.ZI,{side:"top",children:g})]})}),(0,r.jsx)(c.default,{name:"chevron_right",className:"shrink-0 text-[18px] text-muted-foreground transition-transform group-hover:translate-x-0.5"})]})]})})})})}},30067:(e,s,t)=>{Promise.resolve().then(t.bind(t,72745))},72745:(e,s,t)=>{"use strict";t.r(s),t.d(s,{default:()=>h});var r=t(29798),n=t(15814),a=t(53784),i=t(92412),d=t(22205),l=t(738),o=t(13794);function c(e){let s=Object.entries(e).some(([e,s])=>e.startsWith("modelLock_")&&s&&new Date(s).getTime()>Date.now());return"unavailable"!==e.testStatus||s?e.testStatus:"active"}function h(){let[e,s]=(0,n.useState)([]);(0,n.useEffect)(()=>{fetch("/api/providers",{cache:"no-store"}).then(e=>e.json()).then(e=>s(e.connections||[])).catch(()=>{})},[]);let t=o.rj.find(e=>"systemone"===e.id),h=(0,o.o5)("systemone");return(0,r.jsxs)(i.YW,{children:[(0,r.jsx)(i.zY,{title:"System One",backHref:"/dashboard/providers",backLabel:"Providers",description:(0,r.jsxs)(r.Fragment,{children:[t?.label??"Decision models"," (Jev) — native"," ",(0,r.jsx)("code",{className:"font-mono text-xs bg-sidebar px-1 py-0.5 rounded",children:"POST /v1/systemone"})," ","endpoint. Send a state + questions, get scored answers back."]})}),0===h.length?(0,r.jsxs)("div",{className:"text-center py-12 border border-dashed border-border rounded-xl text-muted-foreground text-sm",children:["No providers support ",(0,r.jsx)("strong",{children:"System One"})," yet."]}):(0,r.jsx)(i.pV,{children:h.map(s=>{let t=e.filter(e=>e.provider===s.id),n=t.filter(e=>{let s=c(e);return"active"===s||"success"===s}).length,i=t.filter(e=>{let s=c(e);return"error"===s||"expired"===s||"unavailable"===s}).length,h=!!o.Q2[s.id]?.noAuth;return(0,r.jsx)(d.default,{href:`/dashboard/media-providers/systemone/${s.id}`,title:s.name,iconBg:function(e){if(e)return e.length>7?e:`${e}15`}(s.color??"#888"),icon:(0,r.jsx)(l.A,{src:`/providers/${s.id}.png`,alt:s.name,size:30,className:"max-h-[30px] max-w-[30px] rounded-lg object-contain",fallbackText:s.textIcon||s.id.slice(0,2).toUpperCase(),fallbackColor:s.color}),children:h?(0,r.jsxs)(a.E,{variant:"default",children:[(0,r.jsx)("span",{className:"size-1.5 rounded-full bg-green-500"}),"Ready"]}):0===t.length?(0,r.jsx)("span",{className:"text-xs text-muted-foreground",children:"No connections"}):(0,r.jsxs)(r.Fragment,{children:[n>0&&(0,r.jsxs)(a.E,{variant:"default",children:[(0,r.jsx)("span",{className:"size-1.5 rounded-full bg-green-500"}),n," Connected"]}),i>0&&(0,r.jsxs)(a.E,{variant:"destructive",children:[(0,r.jsx)("span",{className:"size-1.5 rounded-full bg-red-500"}),i," Error"]}),0===n&&0===i&&(0,r.jsxs)(a.E,{variant:"default",children:[t.length," Added"]})]})},s.id)})})]})}},92412:(e,s,t)=>{"use strict";t.d(s,{YW:()=>r.Page,pV:()=>r.CardGrid,wn:()=>r.Section,zY:()=>r.PageHeader}),t(16675),t(72778);var r=t(29575)}},e=>{e.O(0,[6766,5166,7552,9980,6428,4484,9150,3577,5148,1699,1660,4489,1278,427,9966,7358],()=>e(e.s=30067)),_N_E=e.O()}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[6337],{},_=>{_.O(0,[6766,5166,7552,9980,6428,4484,9150,3577,5862,5148,1699,1722,1660,4489,1278,1830,6770,2836,427,9966,7358],()=>_(_.s=92836)),_N_E=_.O()}]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3471],{39647:(e,t,s)=>{Promise.resolve().then(s.bind(s,66291))},45111:(e,t,s)=>{"use strict";s.d(t,{bq:()=>u,eb:()=>m,gC:()=>x,l6:()=>d,yv:()=>c});var a=s(29798);s(15814);var r=s(5471),o=s(95862),n=s(58765),i=s(63587),l=s(28830);function d({...e}){return(0,a.jsx)(o.bL,{"data-slot":"select",...e})}function c({...e}){return(0,a.jsx)(o.WT,{"data-slot":"select-value",...e})}function u({className:e,size:t="default",children:s,...i}){return(0,a.jsxs)(o.l9,{"data-slot":"select-trigger","data-size":t,className:(0,r.cn)("flex w-fit items-center justify-between gap-1.5 rounded-md border border-input bg-background py-2 pr-2 pl-2.5 text-sm whitespace-nowrap shadow-xs transition-[color,box-shadow] outline-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 data-placeholder:text-muted-foreground data-[size=default]:h-9 data-[size=sm]:h-8 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-1.5 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),...i,children:[s,(0,a.jsx)(o.In,{asChild:!0,children:(0,a.jsx)(n.A,{className:"pointer-events-none size-4 text-muted-foreground"})})]})}function x({className:e,children:t,position:s="popper",align:n="center",...i}){return(0,a.jsx)(o.ZL,{children:(0,a.jsxs)(o.UC,{"data-slot":"select-content","data-align-trigger":"item-aligned"===s,className:(0,r.cn)("relative z-50 max-h-(--radix-select-content-available-height) min-w-36 origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md bg-popover text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 data-[align-trigger=true]:animate-none data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95","popper"===s&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",e),position:s,align:n,...i,children:[(0,a.jsx)(p,{}),(0,a.jsx)(o.LM,{"data-position":s,className:(0,r.cn)("data-[position=popper]:h-(--radix-select-trigger-height) data-[position=popper]:w-full data-[position=popper]:min-w-(--radix-select-trigger-width)","popper"===s&&""),children:t}),(0,a.jsx)(h,{})]})})}function m({className:e,children:t,...s}){return(0,a.jsxs)(o.q7,{"data-slot":"select-item",className:(0,r.cn)("relative flex w-full cursor-default items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2",e),...s,children:[(0,a.jsx)("span",{className:"pointer-events-none absolute right-2 flex size-4 items-center justify-center",children:(0,a.jsx)(o.VF,{children:(0,a.jsx)(i.A,{className:"pointer-events-none"})})}),(0,a.jsx)(o.p4,{children:t})]})}function p({className:e,...t}){return(0,a.jsx)(o.PP,{"data-slot":"select-scroll-up-button",className:(0,r.cn)("z-10 flex cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-4",e),...t,children:(0,a.jsx)(l.A,{})})}function h({className:e,...t}){return(0,a.jsx)(o.wn,{"data-slot":"select-scroll-down-button",className:(0,r.cn)("z-10 flex cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-4",e),...t,children:(0,a.jsx)(n.A,{})})}},66291:(e,t,s)=>{"use strict";s.r(t),s.d(t,{default:()=>f});var a=s(29798),r=s(15814),o=s(75669),n=s(18055),i=s(77345),l=s(45111),d=s(49787),c=s(69221),u=s(58913),x=s(53599),m=s(92412),p=s(63175),h=s(14231),b=s(51660);function f(){let e=(0,p.c)(),[t,s]=(0,r.useState)({fallbackStrategy:"fill-first"}),[f,g]=(0,r.useState)(!0),[y,j]=(0,r.useState)({current:"",new:"",confirm:""}),[w,v]=(0,r.useState)({type:"",message:""}),[N,P]=(0,r.useState)(!1),[k,C]=(0,r.useState)(!1),[S,R]=(0,r.useState)({type:"",message:""}),[L,O]=(0,r.useState)({open:!1,mode:"",password:""}),T=(0,r.useRef)(null),_=(0,r.useRef)(null),[A,E]=(0,r.useState)({outboundProxyEnabled:!1,outboundProxyPoolId:"",outboundProxyUrl:"",outboundNoProxy:""}),[U,I]=(0,r.useState)([]),[F,z]=(0,r.useState)({type:"",message:""}),[$,q]=(0,r.useState)(!1),[H,J]=(0,r.useState)(!1),[B,D]=(0,r.useState)(!1);(0,r.useEffect)(()=>{D(!["localhost","127.0.0.1","::1"].includes(window.location.hostname))},[]),(0,r.useEffect)(()=>{Promise.all([fetch("/api/settings").then(e=>e.json()),fetch("/api/proxy-pools?isActive=true",{cache:"no-store"}).then(e=>e.json()).catch(()=>({}))]).then(([e,t])=>{s(e),I(t?.proxyPools||[]),E({outboundProxyEnabled:e?.outboundProxyEnabled===!0,outboundProxyPoolId:e?.outboundProxyPoolId||"",outboundProxyUrl:e?.outboundProxyUrl||"",outboundNoProxy:e?.outboundNoProxy||""}),g(!1)}).catch(e=>{console.error("Failed to fetch settings:",e),g(!1)})},[]);let W=async e=>{if(e.preventDefault(),!0===t.outboundProxyEnabled){q(!0),z({type:"",message:""});try{let e=await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({outboundProxyPoolId:A.outboundProxyPoolId||"",outboundProxyUrl:A.outboundProxyUrl,outboundNoProxy:A.outboundNoProxy})}),t=await e.json();e.ok?(s(e=>({...e,...t})),E(e=>({...e,outboundProxyPoolId:t?.outboundProxyPoolId??e.outboundProxyPoolId})),z({type:"success",message:"Proxy settings applied"})):z({type:"error",message:t.error||"Failed to update proxy settings"})}catch(e){z({type:"error",message:"An error occurred"})}finally{q(!1)}}},Z=async()=>{if(!0!==t.outboundProxyEnabled)return;let e=(A.outboundProxyPoolId||"").trim(),s=(A.outboundProxyUrl||"").trim(),a=U.find(t=>t.id===e),r=e&&a?a.proxyUrl:s;if(e&&!a)return void z({type:"error",message:"Selected proxy pool no longer exists"});if(!r)return void z({type:"error",message:"Please select a proxy pool or enter a Proxy URL to test"});J(!0),z({type:"",message:""});try{let e=await fetch("/api/settings/proxy-test",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({proxyUrl:r})}),t=await e.json();e.ok&&t?.ok?z({type:"success",message:`Proxy test OK (${t.status}) in ${t.elapsedMs}ms`}):z({type:"error",message:t?.error||"Proxy test failed"})}catch(e){z({type:"error",message:"An error occurred"})}finally{J(!1)}},M=async e=>{q(!0),z({type:"",message:""});try{let t=await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({outboundProxyEnabled:e})}),a=await t.json();t.ok?(s(e=>({...e,...a})),E(e=>({...e,outboundProxyEnabled:a?.outboundProxyEnabled===!0})),z({type:"success",message:e?"Proxy enabled":"Proxy disabled"})):z({type:"error",message:a.error||"Failed to update proxy settings"})}catch(e){z({type:"error",message:"An error occurred"})}finally{q(!1)}},V=async e=>{if(e.preventDefault(),y.new!==y.confirm)return void v({type:"error",message:"Passwords do not match"});P(!0),v({type:"",message:""});try{let e=await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({currentPassword:y.current,newPassword:y.new})}),t=await e.json();e.ok?(v({type:"success",message:"Password updated successfully"}),j({current:"",new:"",confirm:""})):v({type:"error",message:t.error||"Failed to update password"})}catch(e){v({type:"error",message:"An error occurred"})}finally{P(!1)}},Y=async e=>{try{(await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({fallbackStrategy:e})})).ok&&s(t=>({...t,fallbackStrategy:e}))}catch(e){console.error("Failed to update settings:",e)}},G=async e=>{try{(await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({comboStrategy:e})})).ok&&s(t=>({...t,comboStrategy:e}))}catch(e){console.error("Failed to update combo strategy:",e)}},K=async e=>{let t=parseInt(e);if(!isNaN(t)&&!(t<1))try{(await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({stickyRoundRobinLimit:t})})).ok&&s(e=>({...e,stickyRoundRobinLimit:t}))}catch(e){console.error("Failed to update sticky limit:",e)}},Q=async e=>{let t=parseInt(e);if(!isNaN(t)&&!(t<1))try{(await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({comboStickyRoundRobinLimit:t})})).ok&&s(e=>({...e,comboStickyRoundRobinLimit:t}))}catch(e){console.error("Failed to update combo sticky limit:",e)}},X=async e=>{try{(await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({requireLogin:e})})).ok&&s(t=>({...t,requireLogin:e}))}catch(e){console.error("Failed to update require login:",e)}},ee=async()=>{try{let e=await fetch("/api/settings");if(!e.ok)return;let t=await e.json();s(t)}catch(e){console.error("Failed to reload settings:",e)}},et=async e=>{C(!0),R({type:"",message:""});try{let t=await fetch("/api/settings/database",{headers:{"x-10r-password":e}});if(!t.ok){let e=await t.json().catch(()=>({}));throw Error(e.error||"Failed to export database")}let s=await t.json(),a=JSON.stringify(s,null,2),r=new Blob([a],{type:"application/json"}),o=URL.createObjectURL(r),n=document.createElement("a"),i=new Date().toISOString().replace(/[.:]/g,"-");n.href=o,n.download=`10router-backup-${i}.json`,document.body.appendChild(n),n.click(),document.body.removeChild(n),URL.revokeObjectURL(o),R({type:"success",message:"Database backup downloaded"})}catch(e){R({type:"error",message:e.message||"Failed to export database"})}finally{C(!1)}},es=async e=>{let t=T.current;if(t){C(!0);try{let s=await t.text(),a=JSON.parse(s),r=await fetch("/api/settings/database",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...a,password:e})}),o=await r.json().catch(()=>({}));if(!r.ok)throw Error(o.error||"Failed to import database");await ee(),R({type:"success",message:"Database imported successfully"})}catch(e){R({type:"error",message:e.message||"Invalid backup file"})}finally{T.current=null,C(!1)}}},ea=async()=>{let{mode:e,password:t}=L;O({open:!1,mode:"",password:""}),"export"===e?await et(t):"import"===e&&await es(t)},er=async()=>{try{(await fetch("/api/auth/logout",{method:"POST"})).ok&&window.location.assign("/login")}catch(e){console.error("Failed to logout:",e)}};return(0,a.jsxs)(m.YW,{width:"narrow",children:[(0,a.jsxs)("div",{className:"flex flex-col gap-6",children:[(0,a.jsxs)(o.Zp,{children:[(0,a.jsx)(o.aR,{children:(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[(0,a.jsx)("div",{className:"p-2 rounded-[10px] bg-background text-muted-foreground",children:(0,a.jsx)(u.default,{name:"computer",className:"text-[20px]"})}),(0,a.jsxs)("div",{children:[(0,a.jsx)(o.ZB,{children:"Local Mode"}),(0,a.jsx)(o.BT,{children:"Running on your machine"})]})]})}),(0,a.jsx)(o.Wu,{children:(0,a.jsxs)("div",{className:"flex flex-col gap-3 pt-4 border-t border-border",children:[(0,a.jsx)("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between p-3 rounded-lg bg-background border border-border gap-2",children:(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"font-medium text-sm sm:text-base",children:"Database Location"}),(0,a.jsx)("p",{className:"text-xs sm:text-sm text-muted-foreground font-mono break-all",children:"~/.10router/db/data.sqlite"})]})}),(0,a.jsxs)("div",{className:"flex flex-col sm:flex-row gap-2",children:[(0,a.jsxs)(n.$,{variant:"secondary",onClick:()=>O({open:!0,mode:"export",password:""}),disabled:k,className:"w-full sm:w-auto",children:[k?(0,a.jsx)(c.A,{className:"animate-spin"}):(0,a.jsx)(u.default,{name:"download"}),"Download Backup"]}),(0,a.jsxs)(n.$,{variant:"outline",onClick:()=>_.current?.click(),disabled:k,className:"w-full sm:w-auto",children:[(0,a.jsx)(u.default,{name:"upload"}),"Import Backup"]}),(0,a.jsx)("input",{ref:_,type:"file",accept:"application/json,.json",className:"hidden",onChange:e=>{let t=e.target.files?.[0];_.current&&(_.current.value=""),t&&(T.current=t,R({type:"",message:""}),O({open:!0,mode:"import",password:""}))}})]}),S.message&&(0,a.jsx)("p",{className:`text-sm ${"error"===S.type?"text-red-500":"text-green-600 dark:text-green-400"}`,children:S.message})]})})]}),(0,a.jsxs)(o.Zp,{children:[(0,a.jsx)(o.aR,{children:(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[(0,a.jsx)("div",{className:"p-2 rounded-[10px] bg-background text-muted-foreground",children:(0,a.jsx)(u.default,{name:"shield",className:"text-[20px]"})}),(0,a.jsxs)("div",{children:[(0,a.jsx)(o.ZB,{children:"Security"}),(0,a.jsx)(o.BT,{children:"Login and password settings"})]})]})}),(0,a.jsx)(o.Wu,{children:(0,a.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,a.jsxs)("div",{className:"flex items-start sm:items-center justify-between gap-4",children:[(0,a.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,a.jsx)("p",{className:"font-medium text-sm sm:text-base",children:"Require login"}),(0,a.jsx)("p",{className:"text-xs sm:text-sm text-muted-foreground",children:"When ON, dashboard requires password. When OFF, access without login."})]}),(0,a.jsx)(h.d,{checked:!0===t.requireLogin,onCheckedChange:()=>X(!t.requireLogin),disabled:f})]}),!0===t.requireLogin&&(0,a.jsxs)("form",{onSubmit:V,className:"flex flex-col gap-4 pt-4 border-t border-border/50",children:[t.hasPassword&&(0,a.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,a.jsx)("label",{className:"text-xs sm:text-sm font-medium",children:"Current Password"}),(0,a.jsx)(i.p,{type:"password",placeholder:"Enter current password",value:y.current,onChange:e=>j({...y,current:e.target.value}),required:!0})]}),(0,a.jsxs)("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[(0,a.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,a.jsx)("label",{className:"text-xs sm:text-sm font-medium",children:"New Password"}),(0,a.jsx)(i.p,{type:"password",placeholder:"Enter new password",value:y.new,onChange:e=>j({...y,new:e.target.value}),required:!0})]}),(0,a.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,a.jsx)("label",{className:"text-xs sm:text-sm font-medium",children:"Confirm New Password"}),(0,a.jsx)(i.p,{type:"password",placeholder:"Confirm new password",value:y.confirm,onChange:e=>j({...y,confirm:e.target.value}),required:!0})]})]}),w.message&&(0,a.jsx)("p",{className:`text-xs sm:text-sm ${"error"===w.type?"text-red-500":"text-green-500"}`,children:w.message}),(0,a.jsx)("div",{className:"pt-2",children:(0,a.jsxs)(n.$,{type:"submit",disabled:N,className:"w-full sm:w-auto",children:[N&&(0,a.jsx)(c.A,{className:"animate-spin"}),t.hasPassword?"Update Password":"Set Password"]})})]})]})})]}),(0,a.jsxs)(o.Zp,{children:[(0,a.jsx)(o.aR,{children:(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[(0,a.jsx)("div",{className:"p-2 rounded-[10px] bg-background text-muted-foreground",children:(0,a.jsx)(u.default,{name:"route",className:"text-[20px]"})}),(0,a.jsxs)("div",{children:[(0,a.jsx)(o.ZB,{children:"Routing Strategy"}),(0,a.jsx)(o.BT,{children:"How requests distribute across accounts"})]})]})}),(0,a.jsx)(o.Wu,{children:(0,a.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,a.jsxs)("div",{className:"flex items-start sm:items-center justify-between gap-4",children:[(0,a.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,a.jsx)("p",{className:"font-medium text-sm sm:text-base",children:"Round Robin"}),(0,a.jsx)("p",{className:"text-xs sm:text-sm text-muted-foreground",children:"Cycle through accounts to distribute load"})]}),(0,a.jsx)(h.d,{checked:"round-robin"===t.fallbackStrategy,onCheckedChange:()=>Y("round-robin"===t.fallbackStrategy?"fill-first":"round-robin"),disabled:f})]}),"round-robin"===t.fallbackStrategy&&(0,a.jsxs)("div",{className:"flex items-start sm:items-center justify-between gap-4 pt-2 border-t border-border/50",children:[(0,a.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,a.jsx)("p",{className:"font-medium text-sm sm:text-base",children:"Sticky Limit"}),(0,a.jsx)("p",{className:"text-xs sm:text-sm text-muted-foreground",children:"Calls per account before switching"})]}),(0,a.jsx)(i.p,{type:"number",min:"1",max:"10",value:t.stickyRoundRobinLimit||3,onChange:e=>K(e.target.value),disabled:f,className:"w-16 sm:w-20 text-center shrink-0"})]}),(0,a.jsxs)("div",{className:"flex items-start sm:items-center justify-between gap-4 pt-4 border-t border-border/50",children:[(0,a.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,a.jsx)("p",{className:"font-medium text-sm sm:text-base",children:"Combo Round Robin"}),(0,a.jsx)("p",{className:"text-xs sm:text-sm text-muted-foreground",children:"Cycle through providers in combos instead of always starting with first"})]}),(0,a.jsx)(h.d,{checked:"round-robin"===t.comboStrategy,onCheckedChange:()=>G("round-robin"===t.comboStrategy?"fallback":"round-robin"),disabled:f})]}),"round-robin"===t.comboStrategy&&(0,a.jsxs)("div",{className:"flex items-center justify-between pt-2 border-t border-border/50",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"font-medium",children:"Combo Sticky Limit"}),(0,a.jsx)("p",{className:"text-sm text-muted-foreground",children:"Calls per combo model before switching"})]}),(0,a.jsx)(i.p,{type:"number",min:"1",max:"100",value:t.comboStickyRoundRobinLimit||1,onChange:e=>Q(e.target.value),disabled:f,className:"w-20 text-center"})]}),(0,a.jsxs)("p",{className:"text-xs text-muted-foreground italic pt-2 border-t border-border/50",children:["round-robin"===t.fallbackStrategy?`Currently distributing requests across all available accounts with ${t.stickyRoundRobinLimit||3} calls per account.`:"Currently using accounts in priority order (Fill First).","round-robin"===t.comboStrategy?` Combos rotate after ${t.comboStickyRoundRobinLimit||1} call${1===(t.comboStickyRoundRobinLimit||1)?"":"s"} per model.`:" Combos always start with their first model."]})]})})]}),(0,a.jsxs)(o.Zp,{children:[(0,a.jsx)(o.aR,{children:(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[(0,a.jsx)("div",{className:"p-2 rounded-[10px] bg-background text-muted-foreground",children:(0,a.jsx)(u.default,{name:"wifi",className:"text-[20px]"})}),(0,a.jsxs)("div",{children:[(0,a.jsx)(o.ZB,{children:"Network"}),(0,a.jsx)(o.BT,{children:"Outbound proxy for provider requests"})]})]})}),(0,a.jsx)(o.Wu,{children:(0,a.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,a.jsxs)("div",{className:"flex items-start sm:items-center justify-between gap-4",children:[(0,a.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,a.jsx)("p",{className:"font-medium text-sm sm:text-base",children:"Outbound Proxy"}),(0,a.jsx)("p",{className:"text-xs sm:text-sm text-muted-foreground",children:"Enable proxy for OAuth + provider outbound requests."})]}),(0,a.jsx)(h.d,{checked:!0===t.outboundProxyEnabled,onCheckedChange:()=>M(!0!==t.outboundProxyEnabled),disabled:f||$})]}),!0===t.outboundProxyEnabled&&(0,a.jsxs)("form",{onSubmit:W,className:"flex flex-col gap-4 pt-2 border-t border-border/50",children:[(0,a.jsx)("div",{className:"flex flex-col gap-2",children:(0,a.jsxs)("div",{className:"flex flex-col gap-1.5",children:[(0,a.jsx)("label",{className:"text-sm font-medium text-foreground",children:"Proxy Pool"}),(0,a.jsxs)(l.l6,{value:A.outboundProxyPoolId||"__manual__",onValueChange:e=>E(t=>({...t,outboundProxyPoolId:"__manual__"===e?"":e})),disabled:f||$,children:[(0,a.jsx)(l.bq,{className:"w-full",children:(0,a.jsx)(l.yv,{placeholder:"Select an option"})}),(0,a.jsxs)(l.gC,{children:[(0,a.jsx)(l.eb,{value:"__manual__",children:"Manual URL (below)"}),U.filter(e=>"http"===(e?.type||"http")).map(e=>(0,a.jsx)(l.eb,{value:String(e.id),children:e.name},e.id))]})]}),(0,a.jsx)("p",{className:"text-xs text-muted-foreground",children:"An HTTP pool overrides the manual URL. Relay pools can't be a global proxy."}),0===U.filter(e=>"http"===(e?.type||"http")).length&&(0,a.jsxs)("p",{className:"text-xs text-amber-500",children:["No HTTP proxy pools yet —"," ",(0,a.jsx)("a",{href:"/dashboard/proxy-pools",className:"underline",children:"create one in Proxy Pools"}),"."]})]})}),(0,a.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,a.jsx)("label",{className:"font-medium text-sm sm:text-base",children:"Proxy URL"}),(0,a.jsx)(i.p,{placeholder:"http://127.0.0.1:7897",value:A.outboundProxyUrl,onChange:e=>E(t=>({...t,outboundProxyUrl:e.target.value})),disabled:f||$||!!A.outboundProxyPoolId}),(0,a.jsx)("p",{className:"text-xs sm:text-sm text-muted-foreground",children:A.outboundProxyPoolId?"Using the selected pool — clear it to edit the URL.":"Leave empty to inherit existing env proxy (if any)."})]}),(0,a.jsxs)("div",{className:"flex flex-col gap-2 pt-2 border-t border-border/50",children:[(0,a.jsx)("label",{className:"font-medium text-sm sm:text-base",children:"No Proxy"}),(0,a.jsx)(i.p,{placeholder:"localhost,127.0.0.1",value:A.outboundNoProxy,onChange:e=>E(t=>({...t,outboundNoProxy:e.target.value})),disabled:f||$||!!A.outboundProxyPoolId}),(0,a.jsx)("p",{className:"text-xs sm:text-sm text-muted-foreground",children:A.outboundProxyPoolId?"Using the pool's No Proxy — clear the pool to edit.":"Comma-separated hostnames/domains to bypass the proxy."})]}),(0,a.jsxs)("div",{className:"pt-2 border-t border-border/50 flex flex-col sm:flex-row items-stretch sm:items-center gap-2",children:[(0,a.jsxs)(n.$,{type:"button",variant:"secondary",disabled:f||$||H,onClick:Z,className:"w-full sm:w-auto",children:[H&&(0,a.jsx)(c.A,{className:"animate-spin"}),"Test proxy URL"]}),(0,a.jsxs)(n.$,{type:"submit",disabled:$,className:"w-full sm:w-auto",children:[$&&(0,a.jsx)(c.A,{className:"animate-spin"}),"Apply"]})]})]}),F.message&&(0,a.jsx)("p",{className:`text-xs sm:text-sm ${"error"===F.type?"text-red-500":"text-green-500"} pt-2 border-t border-border/50`,children:F.message})]})})]}),(0,a.jsxs)("div",{className:"flex flex-col sm:flex-row gap-2",children:[(0,a.jsxs)(n.$,{variant:"outline",onClick:()=>e.open(),className:"flex-1 text-red-500 border-red-200 hover:text-red-500 hover:bg-red-50 hover:border-red-300",children:[(0,a.jsx)(u.default,{name:"power_settings_new"}),"Shutdown"]}),(0,a.jsxs)(n.$,{variant:"outline",onClick:er,className:"flex-1 hover:text-red-500 hover:bg-red-50 hover:border-red-300",children:[(0,a.jsx)(u.default,{name:"logout"}),"Logout"]})]}),(0,a.jsxs)("div",{className:"text-center text-xs sm:text-sm text-muted-foreground py-4",children:[(0,a.jsxs)("p",{children:[b.vQ.name," v",b.vQ.version]}),(0,a.jsx)("p",{className:"mt-1",children:B?"Remote Mode":"Local Mode - All data stored on your machine"})]})]}),(0,a.jsx)(x.default,{isOpen:e.confirmOpen||e.stopped||e.timedOut,onClose:e.reset,onConfirm:e.confirm,shuttingDown:e.shuttingDown,stopped:e.stopped,timedOut:e.timedOut}),(0,a.jsx)(d.lG,{open:L.open,onOpenChange:e=>{e||O({open:!1,mode:"",password:""})},children:(0,a.jsxs)(d.Cf,{className:"max-w-sm",children:[(0,a.jsx)(d.c7,{children:(0,a.jsx)(d.L3,{children:"Confirm Password"})}),(0,a.jsxs)("div",{className:"max-h-[calc(85vh-100px)] overflow-y-auto p-4",children:[(0,a.jsxs)("p",{className:"text-muted-foreground mb-3 text-sm",children:["Enter your current password to ","export"===L.mode?"export":"import"," the database."]}),(0,a.jsx)(i.p,{type:"password",value:L.password,onChange:e=>O(t=>({...t,password:e.target.value})),onKeyDown:e=>{"Enter"===e.key&&L.password&&ea()},placeholder:"Current password",autoFocus:!0})]}),(0,a.jsxs)(d.Es,{children:[(0,a.jsx)(n.$,{variant:"ghost",onClick:()=>O({open:!1,mode:"",password:""}),disabled:k,children:"Cancel"}),(0,a.jsxs)(n.$,{onClick:ea,disabled:k||!L.password,children:[k&&(0,a.jsx)(c.A,{className:"animate-spin"}),"Confirm"]})]})]})})]})}},92412:(e,t,s)=>{"use strict";s.d(t,{YW:()=>a.Page,pV:()=>a.CardGrid,wn:()=>a.Section,zY:()=>a.PageHeader}),s(16675),s(72778);var a=s(29575)}},e=>{e.O(0,[6766,5166,7552,9980,1471,5778,4484,3577,5862,5113,1699,159,4489,1278,427,9966,7358],()=>e(e.s=39647)),_N_E=e.O()}]);
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3471],{39647:(e,t,s)=>{Promise.resolve().then(s.bind(s,66291))},45111:(e,t,s)=>{"use strict";s.d(t,{bq:()=>u,eb:()=>m,gC:()=>x,l6:()=>d,yv:()=>c});var a=s(29798);s(15814);var r=s(5471),o=s(95862),n=s(58765),i=s(63587),l=s(28830);function d({...e}){return(0,a.jsx)(o.bL,{"data-slot":"select",...e})}function c({...e}){return(0,a.jsx)(o.WT,{"data-slot":"select-value",...e})}function u({className:e,size:t="default",children:s,...i}){return(0,a.jsxs)(o.l9,{"data-slot":"select-trigger","data-size":t,className:(0,r.cn)("flex w-fit items-center justify-between gap-1.5 rounded-md border border-input bg-background py-2 pr-2 pl-2.5 text-sm whitespace-nowrap shadow-xs transition-[color,box-shadow] outline-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 data-placeholder:text-muted-foreground data-[size=default]:h-9 data-[size=sm]:h-8 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-1.5 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),...i,children:[s,(0,a.jsx)(o.In,{asChild:!0,children:(0,a.jsx)(n.A,{className:"pointer-events-none size-4 text-muted-foreground"})})]})}function x({className:e,children:t,position:s="popper",align:n="center",...i}){return(0,a.jsx)(o.ZL,{children:(0,a.jsxs)(o.UC,{"data-slot":"select-content","data-align-trigger":"item-aligned"===s,className:(0,r.cn)("relative z-50 max-h-(--radix-select-content-available-height) min-w-36 origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md bg-popover text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 data-[align-trigger=true]:animate-none data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95","popper"===s&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",e),position:s,align:n,...i,children:[(0,a.jsx)(p,{}),(0,a.jsx)(o.LM,{"data-position":s,className:(0,r.cn)("data-[position=popper]:h-(--radix-select-trigger-height) data-[position=popper]:w-full data-[position=popper]:min-w-(--radix-select-trigger-width)","popper"===s&&""),children:t}),(0,a.jsx)(h,{})]})})}function m({className:e,children:t,...s}){return(0,a.jsxs)(o.q7,{"data-slot":"select-item",className:(0,r.cn)("relative flex w-full cursor-default items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2",e),...s,children:[(0,a.jsx)("span",{className:"pointer-events-none absolute right-2 flex size-4 items-center justify-center",children:(0,a.jsx)(o.VF,{children:(0,a.jsx)(i.A,{className:"pointer-events-none"})})}),(0,a.jsx)(o.p4,{children:t})]})}function p({className:e,...t}){return(0,a.jsx)(o.PP,{"data-slot":"select-scroll-up-button",className:(0,r.cn)("z-10 flex cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-4",e),...t,children:(0,a.jsx)(l.A,{})})}function h({className:e,...t}){return(0,a.jsx)(o.wn,{"data-slot":"select-scroll-down-button",className:(0,r.cn)("z-10 flex cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-4",e),...t,children:(0,a.jsx)(n.A,{})})}},66291:(e,t,s)=>{"use strict";s.r(t),s.d(t,{default:()=>f});var a=s(29798),r=s(15814),o=s(75669),n=s(18055),i=s(77345),l=s(45111),d=s(49787),c=s(69221),u=s(58913),x=s(53599),m=s(92412),p=s(63175),h=s(14231),b=s(51660);function f(){let e=(0,p.c)(),[t,s]=(0,r.useState)({fallbackStrategy:"fill-first"}),[f,g]=(0,r.useState)(!0),[y,j]=(0,r.useState)({current:"",new:"",confirm:""}),[w,v]=(0,r.useState)({type:"",message:""}),[N,P]=(0,r.useState)(!1),[k,C]=(0,r.useState)(!1),[S,R]=(0,r.useState)({type:"",message:""}),[L,O]=(0,r.useState)({open:!1,mode:"",password:""}),T=(0,r.useRef)(null),_=(0,r.useRef)(null),[A,E]=(0,r.useState)({outboundProxyEnabled:!1,outboundProxyPoolId:"",outboundProxyUrl:"",outboundNoProxy:""}),[U,I]=(0,r.useState)([]),[F,z]=(0,r.useState)({type:"",message:""}),[$,q]=(0,r.useState)(!1),[H,J]=(0,r.useState)(!1),[B,D]=(0,r.useState)(!1);(0,r.useEffect)(()=>{D(!["localhost","127.0.0.1","::1"].includes(window.location.hostname))},[]),(0,r.useEffect)(()=>{Promise.all([fetch("/api/settings").then(e=>e.json()),fetch("/api/proxy-pools?isActive=true",{cache:"no-store"}).then(e=>e.json()).catch(()=>({}))]).then(([e,t])=>{s(e),I(t?.proxyPools||[]),E({outboundProxyEnabled:e?.outboundProxyEnabled===!0,outboundProxyPoolId:e?.outboundProxyPoolId||"",outboundProxyUrl:e?.outboundProxyUrl||"",outboundNoProxy:e?.outboundNoProxy||""}),g(!1)}).catch(e=>{console.error("Failed to fetch settings:",e),g(!1)})},[]);let W=async e=>{if(e.preventDefault(),!0===t.outboundProxyEnabled){q(!0),z({type:"",message:""});try{let e=await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({outboundProxyPoolId:A.outboundProxyPoolId||"",outboundProxyUrl:A.outboundProxyUrl,outboundNoProxy:A.outboundNoProxy})}),t=await e.json();e.ok?(s(e=>({...e,...t})),E(e=>({...e,outboundProxyPoolId:t?.outboundProxyPoolId??e.outboundProxyPoolId})),z({type:"success",message:"Proxy settings applied"})):z({type:"error",message:t.error||"Failed to update proxy settings"})}catch(e){z({type:"error",message:"An error occurred"})}finally{q(!1)}}},Z=async()=>{if(!0!==t.outboundProxyEnabled)return;let e=(A.outboundProxyPoolId||"").trim(),s=(A.outboundProxyUrl||"").trim(),a=U.find(t=>t.id===e),r=e&&a?a.proxyUrl:s;if(e&&!a)return void z({type:"error",message:"Selected proxy pool no longer exists"});if(!r)return void z({type:"error",message:"Please select a proxy pool or enter a Proxy URL to test"});J(!0),z({type:"",message:""});try{let e=await fetch("/api/settings/proxy-test",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({proxyUrl:r})}),t=await e.json();e.ok&&t?.ok?z({type:"success",message:`Proxy test OK (${t.status}) in ${t.elapsedMs}ms`}):z({type:"error",message:t?.error||"Proxy test failed"})}catch(e){z({type:"error",message:"An error occurred"})}finally{J(!1)}},M=async e=>{q(!0),z({type:"",message:""});try{let t=await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({outboundProxyEnabled:e})}),a=await t.json();t.ok?(s(e=>({...e,...a})),E(e=>({...e,outboundProxyEnabled:a?.outboundProxyEnabled===!0})),z({type:"success",message:e?"Proxy enabled":"Proxy disabled"})):z({type:"error",message:a.error||"Failed to update proxy settings"})}catch(e){z({type:"error",message:"An error occurred"})}finally{q(!1)}},V=async e=>{if(e.preventDefault(),y.new!==y.confirm)return void v({type:"error",message:"Passwords do not match"});P(!0),v({type:"",message:""});try{let e=await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({currentPassword:y.current,newPassword:y.new})}),t=await e.json();e.ok?(v({type:"success",message:"Password updated successfully"}),j({current:"",new:"",confirm:""})):v({type:"error",message:t.error||"Failed to update password"})}catch(e){v({type:"error",message:"An error occurred"})}finally{P(!1)}},Y=async e=>{try{(await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({fallbackStrategy:e})})).ok&&s(t=>({...t,fallbackStrategy:e}))}catch(e){console.error("Failed to update settings:",e)}},G=async e=>{try{(await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({comboStrategy:e})})).ok&&s(t=>({...t,comboStrategy:e}))}catch(e){console.error("Failed to update combo strategy:",e)}},K=async e=>{let t=parseInt(e);if(!isNaN(t)&&!(t<1))try{(await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({stickyRoundRobinLimit:t})})).ok&&s(e=>({...e,stickyRoundRobinLimit:t}))}catch(e){console.error("Failed to update sticky limit:",e)}},Q=async e=>{let t=parseInt(e);if(!isNaN(t)&&!(t<1))try{(await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({comboStickyRoundRobinLimit:t})})).ok&&s(e=>({...e,comboStickyRoundRobinLimit:t}))}catch(e){console.error("Failed to update combo sticky limit:",e)}},X=async e=>{try{(await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({requireLogin:e})})).ok&&s(t=>({...t,requireLogin:e}))}catch(e){console.error("Failed to update require login:",e)}},ee=async()=>{try{let e=await fetch("/api/settings");if(!e.ok)return;let t=await e.json();s(t)}catch(e){console.error("Failed to reload settings:",e)}},et=async e=>{C(!0),R({type:"",message:""});try{let t=await fetch("/api/settings/database",{headers:{"x-10r-password":e}});if(!t.ok){let e=await t.json().catch(()=>({}));throw Error(e.error||"Failed to export database")}let s=await t.json(),a=JSON.stringify(s,null,2),r=new Blob([a],{type:"application/json"}),o=URL.createObjectURL(r),n=document.createElement("a"),i=new Date().toISOString().replace(/[.:]/g,"-");n.href=o,n.download=`10router-backup-${i}.json`,document.body.appendChild(n),n.click(),document.body.removeChild(n),URL.revokeObjectURL(o),R({type:"success",message:"Database backup downloaded"})}catch(e){R({type:"error",message:e.message||"Failed to export database"})}finally{C(!1)}},es=async e=>{let t=T.current;if(t){C(!0);try{let s=await t.text(),a=JSON.parse(s),r=await fetch("/api/settings/database",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...a,password:e})}),o=await r.json().catch(()=>({}));if(!r.ok)throw Error(o.error||"Failed to import database");await ee(),R({type:"success",message:"Database imported successfully"})}catch(e){R({type:"error",message:e.message||"Invalid backup file"})}finally{T.current=null,C(!1)}}},ea=async()=>{let{mode:e,password:t}=L;O({open:!1,mode:"",password:""}),"export"===e?await et(t):"import"===e&&await es(t)},er=async()=>{try{(await fetch("/api/auth/logout",{method:"POST"})).ok&&window.location.assign("/login")}catch(e){console.error("Failed to logout:",e)}};return(0,a.jsxs)(m.YW,{width:"narrow",children:[(0,a.jsxs)("div",{className:"flex flex-col gap-6",children:[(0,a.jsxs)(o.Zp,{children:[(0,a.jsx)(o.aR,{children:(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[(0,a.jsx)("div",{className:"p-2 rounded-[10px] bg-background text-muted-foreground",children:(0,a.jsx)(u.default,{name:"computer",className:"text-[20px]"})}),(0,a.jsxs)("div",{children:[(0,a.jsx)(o.ZB,{children:"Local Mode"}),(0,a.jsx)(o.BT,{children:"Running on your machine"})]})]})}),(0,a.jsx)(o.Wu,{children:(0,a.jsxs)("div",{className:"flex flex-col gap-3 pt-4 border-t border-border",children:[(0,a.jsx)("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between p-3 rounded-lg bg-background border border-border gap-2",children:(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"font-medium text-sm sm:text-base",children:"Database Location"}),(0,a.jsx)("p",{className:"text-xs sm:text-sm text-muted-foreground font-mono break-all",children:"~/.10router/db/data.sqlite"})]})}),(0,a.jsxs)("div",{className:"flex flex-col sm:flex-row gap-2",children:[(0,a.jsxs)(n.$,{variant:"secondary",onClick:()=>O({open:!0,mode:"export",password:""}),disabled:k,className:"w-full sm:w-auto",children:[k?(0,a.jsx)(c.A,{className:"animate-spin"}):(0,a.jsx)(u.default,{name:"download"}),"Download Backup"]}),(0,a.jsxs)(n.$,{variant:"outline",onClick:()=>_.current?.click(),disabled:k,className:"w-full sm:w-auto",children:[(0,a.jsx)(u.default,{name:"upload"}),"Import Backup"]}),(0,a.jsx)("input",{ref:_,type:"file",accept:"application/json,.json",className:"hidden",onChange:e=>{let t=e.target.files?.[0];_.current&&(_.current.value=""),t&&(T.current=t,R({type:"",message:""}),O({open:!0,mode:"import",password:""}))}})]}),S.message&&(0,a.jsx)("p",{className:`text-sm ${"error"===S.type?"text-red-500":"text-green-600 dark:text-green-400"}`,children:S.message})]})})]}),(0,a.jsxs)(o.Zp,{children:[(0,a.jsx)(o.aR,{children:(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[(0,a.jsx)("div",{className:"p-2 rounded-[10px] bg-background text-muted-foreground",children:(0,a.jsx)(u.default,{name:"shield",className:"text-[20px]"})}),(0,a.jsxs)("div",{children:[(0,a.jsx)(o.ZB,{children:"Security"}),(0,a.jsx)(o.BT,{children:"Login and password settings"})]})]})}),(0,a.jsx)(o.Wu,{children:(0,a.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,a.jsxs)("div",{className:"flex items-start sm:items-center justify-between gap-4",children:[(0,a.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,a.jsx)("p",{className:"font-medium text-sm sm:text-base",children:"Require login"}),(0,a.jsx)("p",{className:"text-xs sm:text-sm text-muted-foreground",children:"When ON, dashboard requires password. When OFF, access without login."})]}),(0,a.jsx)(h.d,{checked:!0===t.requireLogin,onCheckedChange:()=>X(!t.requireLogin),disabled:f})]}),!0===t.requireLogin&&(0,a.jsxs)("form",{onSubmit:V,className:"flex flex-col gap-4 pt-4 border-t border-border/50",children:[t.hasPassword&&(0,a.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,a.jsx)("label",{className:"text-xs sm:text-sm font-medium",children:"Current Password"}),(0,a.jsx)(i.p,{type:"password",placeholder:"Enter current password",value:y.current,onChange:e=>j({...y,current:e.target.value}),required:!0})]}),(0,a.jsxs)("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[(0,a.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,a.jsx)("label",{className:"text-xs sm:text-sm font-medium",children:"New Password"}),(0,a.jsx)(i.p,{type:"password",placeholder:"Enter new password",value:y.new,onChange:e=>j({...y,new:e.target.value}),required:!0})]}),(0,a.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,a.jsx)("label",{className:"text-xs sm:text-sm font-medium",children:"Confirm New Password"}),(0,a.jsx)(i.p,{type:"password",placeholder:"Confirm new password",value:y.confirm,onChange:e=>j({...y,confirm:e.target.value}),required:!0})]})]}),w.message&&(0,a.jsx)("p",{className:`text-xs sm:text-sm ${"error"===w.type?"text-red-500":"text-green-500"}`,children:w.message}),(0,a.jsx)("div",{className:"pt-2",children:(0,a.jsxs)(n.$,{type:"submit",disabled:N,className:"w-full sm:w-auto",children:[N&&(0,a.jsx)(c.A,{className:"animate-spin"}),t.hasPassword?"Update Password":"Set Password"]})})]})]})})]}),(0,a.jsxs)(o.Zp,{children:[(0,a.jsx)(o.aR,{children:(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[(0,a.jsx)("div",{className:"p-2 rounded-[10px] bg-background text-muted-foreground",children:(0,a.jsx)(u.default,{name:"route",className:"text-[20px]"})}),(0,a.jsxs)("div",{children:[(0,a.jsx)(o.ZB,{children:"Routing Strategy"}),(0,a.jsx)(o.BT,{children:"How requests distribute across accounts"})]})]})}),(0,a.jsx)(o.Wu,{children:(0,a.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,a.jsxs)("div",{className:"flex items-start sm:items-center justify-between gap-4",children:[(0,a.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,a.jsx)("p",{className:"font-medium text-sm sm:text-base",children:"Round Robin"}),(0,a.jsx)("p",{className:"text-xs sm:text-sm text-muted-foreground",children:"Cycle through accounts to distribute load"})]}),(0,a.jsx)(h.d,{checked:"round-robin"===t.fallbackStrategy,onCheckedChange:()=>Y("round-robin"===t.fallbackStrategy?"fill-first":"round-robin"),disabled:f})]}),"round-robin"===t.fallbackStrategy&&(0,a.jsxs)("div",{className:"flex items-start sm:items-center justify-between gap-4 pt-2 border-t border-border/50",children:[(0,a.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,a.jsx)("p",{className:"font-medium text-sm sm:text-base",children:"Sticky Limit"}),(0,a.jsx)("p",{className:"text-xs sm:text-sm text-muted-foreground",children:"Calls per account before switching"})]}),(0,a.jsx)(i.p,{type:"number",min:"1",max:"10",value:t.stickyRoundRobinLimit||3,onChange:e=>K(e.target.value),disabled:f,className:"w-16 sm:w-20 text-center shrink-0"})]}),(0,a.jsxs)("div",{className:"flex items-start sm:items-center justify-between gap-4 pt-4 border-t border-border/50",children:[(0,a.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,a.jsx)("p",{className:"font-medium text-sm sm:text-base",children:"Combo Round Robin"}),(0,a.jsx)("p",{className:"text-xs sm:text-sm text-muted-foreground",children:"Cycle through providers in combos instead of always starting with first"})]}),(0,a.jsx)(h.d,{checked:"round-robin"===t.comboStrategy,onCheckedChange:()=>G("round-robin"===t.comboStrategy?"fallback":"round-robin"),disabled:f})]}),"round-robin"===t.comboStrategy&&(0,a.jsxs)("div",{className:"flex items-center justify-between pt-2 border-t border-border/50",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"font-medium",children:"Combo Sticky Limit"}),(0,a.jsx)("p",{className:"text-sm text-muted-foreground",children:"Calls per combo model before switching"})]}),(0,a.jsx)(i.p,{type:"number",min:"1",max:"100",value:t.comboStickyRoundRobinLimit||1,onChange:e=>Q(e.target.value),disabled:f,className:"w-20 text-center"})]}),(0,a.jsxs)("p",{className:"text-xs text-muted-foreground italic pt-2 border-t border-border/50",children:["round-robin"===t.fallbackStrategy?`Currently distributing requests across all available accounts with ${t.stickyRoundRobinLimit||3} calls per account.`:"Currently using accounts in priority order (Fill First).","round-robin"===t.comboStrategy?` Combos rotate after ${t.comboStickyRoundRobinLimit||1} call${1===(t.comboStickyRoundRobinLimit||1)?"":"s"} per model.`:" Combos always start with their first model."]})]})})]}),(0,a.jsxs)(o.Zp,{children:[(0,a.jsx)(o.aR,{children:(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[(0,a.jsx)("div",{className:"p-2 rounded-[10px] bg-background text-muted-foreground",children:(0,a.jsx)(u.default,{name:"wifi",className:"text-[20px]"})}),(0,a.jsxs)("div",{children:[(0,a.jsx)(o.ZB,{children:"Network"}),(0,a.jsx)(o.BT,{children:"Outbound proxy for provider requests"})]})]})}),(0,a.jsx)(o.Wu,{children:(0,a.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,a.jsxs)("div",{className:"flex items-start sm:items-center justify-between gap-4",children:[(0,a.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,a.jsx)("p",{className:"font-medium text-sm sm:text-base",children:"Outbound Proxy"}),(0,a.jsx)("p",{className:"text-xs sm:text-sm text-muted-foreground",children:"Enable proxy for OAuth + provider outbound requests."})]}),(0,a.jsx)(h.d,{checked:!0===t.outboundProxyEnabled,onCheckedChange:()=>M(!0!==t.outboundProxyEnabled),disabled:f||$})]}),!0===t.outboundProxyEnabled&&(0,a.jsxs)("form",{onSubmit:W,className:"flex flex-col gap-4 pt-2 border-t border-border/50",children:[(0,a.jsx)("div",{className:"flex flex-col gap-2",children:(0,a.jsxs)("div",{className:"flex flex-col gap-1.5",children:[(0,a.jsx)("label",{className:"text-sm font-medium text-foreground",children:"Proxy Pool"}),(0,a.jsxs)(l.l6,{value:A.outboundProxyPoolId||"__manual__",onValueChange:e=>E(t=>({...t,outboundProxyPoolId:"__manual__"===e?"":e})),disabled:f||$,children:[(0,a.jsx)(l.bq,{className:"w-full",children:(0,a.jsx)(l.yv,{placeholder:"Select an option"})}),(0,a.jsxs)(l.gC,{children:[(0,a.jsx)(l.eb,{value:"__manual__",children:"Manual URL (below)"}),U.filter(e=>"http"===(e?.type||"http")).map(e=>(0,a.jsx)(l.eb,{value:String(e.id),children:e.name},e.id))]})]}),(0,a.jsx)("p",{className:"text-xs text-muted-foreground",children:"An HTTP pool overrides the manual URL. Relay pools can't be a global proxy."}),0===U.filter(e=>"http"===(e?.type||"http")).length&&(0,a.jsxs)("p",{className:"text-xs text-amber-500",children:["No HTTP proxy pools yet —"," ",(0,a.jsx)("a",{href:"/dashboard/proxy-pools",className:"underline",children:"create one in Proxy Pools"}),"."]})]})}),(0,a.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,a.jsx)("label",{className:"font-medium text-sm sm:text-base",children:"Proxy URL"}),(0,a.jsx)(i.p,{placeholder:"http://127.0.0.1:7897",value:A.outboundProxyUrl,onChange:e=>E(t=>({...t,outboundProxyUrl:e.target.value})),disabled:f||$||!!A.outboundProxyPoolId}),(0,a.jsx)("p",{className:"text-xs sm:text-sm text-muted-foreground",children:A.outboundProxyPoolId?"Using the selected pool — clear it to edit the URL.":"Leave empty to inherit existing env proxy (if any)."})]}),(0,a.jsxs)("div",{className:"flex flex-col gap-2 pt-2 border-t border-border/50",children:[(0,a.jsx)("label",{className:"font-medium text-sm sm:text-base",children:"No Proxy"}),(0,a.jsx)(i.p,{placeholder:"localhost,127.0.0.1",value:A.outboundNoProxy,onChange:e=>E(t=>({...t,outboundNoProxy:e.target.value})),disabled:f||$||!!A.outboundProxyPoolId}),(0,a.jsx)("p",{className:"text-xs sm:text-sm text-muted-foreground",children:A.outboundProxyPoolId?"Using the pool's No Proxy — clear the pool to edit.":"Comma-separated hostnames/domains to bypass the proxy."})]}),(0,a.jsxs)("div",{className:"pt-2 border-t border-border/50 flex flex-col sm:flex-row items-stretch sm:items-center gap-2",children:[(0,a.jsxs)(n.$,{type:"button",variant:"secondary",disabled:f||$||H,onClick:Z,className:"w-full sm:w-auto",children:[H&&(0,a.jsx)(c.A,{className:"animate-spin"}),"Test proxy URL"]}),(0,a.jsxs)(n.$,{type:"submit",disabled:$,className:"w-full sm:w-auto",children:[$&&(0,a.jsx)(c.A,{className:"animate-spin"}),"Apply"]})]})]}),F.message&&(0,a.jsx)("p",{className:`text-xs sm:text-sm ${"error"===F.type?"text-red-500":"text-green-500"} pt-2 border-t border-border/50`,children:F.message})]})})]}),(0,a.jsxs)("div",{className:"flex flex-col sm:flex-row gap-2",children:[(0,a.jsxs)(n.$,{variant:"outline",onClick:()=>e.open(),className:"flex-1 text-red-500 border-red-200 hover:text-red-500 hover:bg-red-50 hover:border-red-300",children:[(0,a.jsx)(u.default,{name:"power_settings_new"}),"Shutdown"]}),(0,a.jsxs)(n.$,{variant:"outline",onClick:er,className:"flex-1 hover:text-red-500 hover:bg-red-50 hover:border-red-300",children:[(0,a.jsx)(u.default,{name:"logout"}),"Logout"]})]}),(0,a.jsxs)("div",{className:"text-center text-xs sm:text-sm text-muted-foreground py-4",children:[(0,a.jsxs)("p",{children:[b.vQ.name," v",b.vQ.version]}),(0,a.jsx)("p",{className:"mt-1",children:B?"Remote Mode":"Local Mode - All data stored on your machine"})]})]}),(0,a.jsx)(x.default,{isOpen:e.confirmOpen||e.stopped||e.timedOut,onClose:e.reset,onConfirm:e.confirm,shuttingDown:e.shuttingDown,stopped:e.stopped,timedOut:e.timedOut}),(0,a.jsx)(d.lG,{open:L.open,onOpenChange:e=>{e||O({open:!1,mode:"",password:""})},children:(0,a.jsxs)(d.Cf,{className:"max-w-sm",children:[(0,a.jsx)(d.c7,{children:(0,a.jsx)(d.L3,{children:"Confirm Password"})}),(0,a.jsxs)("div",{className:"max-h-[calc(85vh-100px)] overflow-y-auto p-4",children:[(0,a.jsxs)("p",{className:"text-muted-foreground mb-3 text-sm",children:["Enter your current password to ","export"===L.mode?"export":"import"," the database."]}),(0,a.jsx)(i.p,{type:"password",value:L.password,onChange:e=>O(t=>({...t,password:e.target.value})),onKeyDown:e=>{"Enter"===e.key&&L.password&&ea()},placeholder:"Current password",autoFocus:!0})]}),(0,a.jsxs)(d.Es,{children:[(0,a.jsx)(n.$,{variant:"ghost",onClick:()=>O({open:!1,mode:"",password:""}),disabled:k,children:"Cancel"}),(0,a.jsxs)(n.$,{onClick:ea,disabled:k||!L.password,children:[k&&(0,a.jsx)(c.A,{className:"animate-spin"}),"Confirm"]})]})]})})]})}},92412:(e,t,s)=>{"use strict";s.d(t,{YW:()=>a.Page,pV:()=>a.CardGrid,wn:()=>a.Section,zY:()=>a.PageHeader}),s(16675),s(72778);var a=s(29575)}},e=>{e.O(0,[6766,5166,7552,9980,6428,4484,9150,3577,5862,5148,1699,1660,4489,1278,427,9966,7358],()=>e(e.s=39647)),_N_E=e.O()}]);
|
|
@@ -18,4 +18,4 @@
|
|
|
18
18
|
"id_token": "eyJ0eXAiOiJKV1QiLCJhbGci...",
|
|
19
19
|
"email": "account2@example.com"
|
|
20
20
|
}
|
|
21
|
-
]`;function q(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 Z({isOpen:e,onClose:t,onSuccess:s}){let[n,i]=(0,r.useState)(""),[o,d]=(0,r.useState)(!1),[c,m]=(0,r.useState)(""),[p,u]=(0,r.useState)(null),[h,f]=(0,r.useState)(!1),[g,j]=(0,r.useState)(null),b=(0,r.useRef)(null),v=()=>{o||(i(""),m(""),u(null),j(null),f(!1),t())},N=async e=>{if(!e||0===e.length)return;m("");let t=Array.from(e).filter(e=>e.name.endsWith(".json")||"application/json"===e.type||""===e.type);if(0===t.length)return void m((0,y.Tl)("Please select valid .json files"));try{let e=[];for(let s of t){let t=await s.text(),a=q(t);Array.isArray(a)?e.push(...a):a&&e.push(a)}if(0===e.length)return void m((0,y.Tl)("No accounts found in selected files"));i(JSON.stringify(e,null,2)),j({filesCount:t.length,accountsCount:e.length})}catch(e){m(`${(0,y.Tl)("Error reading files")}: ${e.message}`)}},w=async()=>{let e;m(""),u(null);try{e=q(n)}catch(e){m(`${(0,y.Tl)("Invalid JSON")}: ${e.message}`);return}if(!e||0===e.length)return void m((0,y.Tl)("No accounts found in input"));d(!0);try{let t=await fetch("/api/oauth/grok-cli/bulk-import",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({accounts:e})}),a=await t.json();if(!t.ok)return void m(a?.error||`Request failed: ${t.status}`);u(a),a.success>0&&"function"==typeof s&&s()}catch(e){m(e.message||(0,y.Tl)("Request failed"))}finally{d(!1)}},k=p?.results?.filter(e=>!e.ok)||[];return(0,a.jsx)(S.lG,{open:e,onOpenChange:e=>!e&&v(),children:(0,a.jsxs)(S.Cf,{className:"max-w-md",children:[(0,a.jsx)(S.c7,{children:(0,a.jsx)(S.L3,{children:(0,y.Tl)("Bulk Add Grok CLI Accounts")})}),(0,a.jsxs)("div",{className:"flex max-h-[calc(85vh-120px)] flex-col gap-4 overflow-y-auto p-4",children:[(0,a.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[(0,a.jsx)("p",{className:"text-xs text-muted-foreground",children:(0,y.Tl)("Upload multiple .json files or paste JSON array / object.")}),(0,a.jsx)("input",{ref:b,type:"file",accept:".json,application/json",multiple:!0,className:"hidden",onChange:e=>{N(e.target.files),e.target&&(e.target.value="")}}),(0,a.jsxs)(x.$,{type:"button",size:"sm",variant:"secondary",onClick:()=>b.current?.click(),disabled:o,children:[(0,a.jsx)(l.default,{name:"upload_file"}),(0,y.Tl)("Upload JSON Files")]})]}),(0,a.jsxs)("div",{onDragOver:e=>{e.preventDefault(),f(!0)},onDragLeave:e=>{e.preventDefault(),f(!1)},onDrop:e=>{e.preventDefault(),f(!1),e.dataTransfer?.files?.length>0&&N(e.dataTransfer.files)},className:`relative rounded border transition-colors ${h?"border-primary bg-primary/10 ring-2 ring-primary/30":"border-accent/30 bg-sidebar"}`,children:[(0,a.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:n,onChange:e=>{i(e.target.value),j(null)},disabled:o}),h&&(0,a.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,a.jsx)(l.default,{name:"upload_file",className:"text-3xl text-primary mb-1"}),(0,a.jsx)("span",{className:"text-sm font-medium text-primary",children:(0,y.Tl)("Drop .json files here")})]})]}),g&&(0,a.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,a.jsx)(l.default,{name:"check_circle",className:"text-sm"}),(0,a.jsxs)("span",{children:[(0,y.Tl)("Loaded")," ",g.accountsCount," ",(0,y.Tl)("account(s) from")," ",g.filesCount," ",(0,y.Tl)("file(s)")]})]}),c&&(0,a.jsx)("p",{className:"text-xs text-red-500 break-words",children:c}),p&&p.failed>0&&(0,a.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,a.jsxs)("div",{className:"text-sm font-medium text-yellow-400",children:["✗ ",p.failed," ",(0,y.Tl)("failed")]}),k.length>0&&(0,a.jsx)("ul",{className:"rounded border border-accent/20 bg-sidebar/50 p-2 text-xs font-mono max-h-40 overflow-y-auto",children:k.map(e=>(0,a.jsxs)("li",{className:"text-red-400",children:["[",e.index,"] ",e.error]},e.index))})]}),(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsx)(x.$,{onClick:w,className:"w-full",disabled:o||!n.trim(),children:o?(0,y.Tl)("Importing..."):(0,y.Tl)("Import All")}),(0,a.jsx)(x.$,{onClick:v,variant:"ghost",className:"w-full",disabled:o,children:(0,y.Tl)("Close")})]})]})]})})}let B={claude:"claudeAutoPing",codex:"codexAutoPing"};function H(){let e,t,s,i,j,O=(0,n.useParams)(),I=(0,n.useRouter)(),z=O.id,{getCaps:D}=(0,g.y)(),[U,L]=(0,r.useState)([]),[R,F]=(0,r.useState)(!0),[G,q]=(0,r.useState)(null),[H,V]=(0,r.useState)([]),[W,Q]=(0,r.useState)(!1),[X,Y]=(0,r.useState)(!1),[ee,et]=(0,r.useState)(!1),[es,ea]=(0,r.useState)(!1),[el,er]=(0,r.useState)(""),[en,ei]=(0,r.useState)(!1),[eo,ed]=(0,r.useState)(!1),[ec,em]=(0,r.useState)(!1),[ep,ex]=(0,r.useState)(!1),[eu,eh]=(0,r.useState)(!1),[ef,eg]=(0,r.useState)(null),[ey,ej]=(0,r.useState)({}),[eb,ev]=(0,r.useState)([]),[eN,ew]=(0,r.useState)(!1),[ek,eC]=(0,r.useState)({}),[eS,eA]=(0,r.useState)(""),[e$,eT]=(0,r.useState)(()=>new Set),[eO,eP]=(0,r.useState)(!1),[eE,eI]=(0,r.useState)([]),[ez,eD]=(0,r.useState)(!1),[e_,eU]=(0,r.useState)(null),[eJ,eL]=(0,r.useState)(""),[eR,eK]=(0,r.useState)({enabled:!1,connections:{}}),[eF,eM]=(0,r.useState)([]),[eG,eq]=(0,r.useState)([]),[eZ,eB]=(0,r.useState)(null),[eH,eV]=(0,r.useState)([]),[eW,eQ]=(0,r.useState)([]),[eX,eY]=(0,r.useState)(null),[e0,e1]=(0,r.useState)(!1),e5=function(e){let[t,s]=(0,r.useState)(!1),[a,l]=(0,r.useState)(!1),[n,i]=(0,r.useState)(null),[o,d]=(0,r.useState)({}),[c,m]=(0,r.useState)(null),p=(0,r.useRef)(!1),x=async()=>{if(t||0===e.length)return;let a=Object.fromEntries(e.map(e=>[e.id,{state:"queued",error:null}]));p.current=!1,s(!0),l(!1),i(null),d(a),m({total:e.length,completed:0,passed:0,failed:0,stopped:!1});let r=0,n=0;try{for(let t=0;t<e.length;t+=1){if(p.current){m({total:e.length,completed:t,passed:r,failed:n,stopped:!0});break}let s=e[t];i(s.id),d(e=>({...e,[s.id]:{state:"testing",error:null}}));try{let e=await fetch(`/api/providers/${s.id}/test`,{method:"POST"}),t=await e.json(),a=!!t.valid;a?r+=1:n+=1,d(e=>({...e,[s.id]:{state:a?"success":"failed",error:a?null:t.error||null}}))}catch(e){n+=1,d(t=>({...t,[s.id]:{state:"failed",error:e.message||"Test failed"}}))}m({total:e.length,completed:t+1,passed:r,failed:n,stopped:!1}),t<e.length-1&&await new Promise(e=>setTimeout(e,1e3))}}finally{i(null),s(!1),l(!1),p.current=!1}};return{running:t,stopping:a,currentConnectionId:n,results:o,summary:c,run:x,stop:()=>{t&&(p.current=!0,l(!0))}}}(U),e2=e5.running,e4=e5.stopping,e3=e5.currentConnectionId,e7=e5.results,e6=e5.summary,e9=e5.run,e8=e5.stop,[te,tt]=(0,r.useState)(!1),{copied:ts,copy:ta}=(0,f.C)(),tl="ag_risk_confirmed",tr=()=>{Q(!0)},tn=()=>{"antigravity"===z&&"true"!==window.localStorage.getItem(tl)?e1(!0):"xiaomi-mimo"===z?Y(!0):tm?tr():(er(""),ea(!0))},ti=()=>{er(""),ea(!0)},to=()=>{tm?tn():ti()},td=G?{id:G.id,name:G.name||("anthropic-compatible"===G.type?"Anthropic Compatible":"OpenAI Compatible"),color:"anthropic-compatible"===G.type?"#D97757":"#10A37F",textIcon:"anthropic-compatible"===G.type?"AC":"OC",apiType:G.apiType,baseUrl:G.baseUrl,type:G.type}:u.zN[z]||u.fg[z]||u.IS[z]||u.nJ[z]||u.br[z],tc=td?.authModes||[],tm=!!u.zN[z]||!!u.IS[z]||tc.includes("oauth"),tp=!!u.fg[z]||tc.includes("apikey"),tx=!!u.IS[z]?.noAuth,tu=(0,h.KC)(z),th=("cursor"===z||"zed"===z)&&eG.length>0?eG:tu,tf=(0,u.wG)(z),tg=(0,u.mq)(z),ty=(0,u.gb)(z),tj=tg||ty,tb=!tj&&tm&&tp,tv="xai"===z?"Grok Build OAuth":"grok-cli"===z?"Grok CLI Device Login":"OAuth",tN="xai"===z?"xAI API Key":"qoder"===z?"PAT":"API Key",tw=tj?z:tf,tk=tj?G?.prefix||z:tf,tC=(0,r.useCallback)(async()=>{try{let e=await fetch(`/api/models/disabled?providerAlias=${encodeURIComponent(tw)}`,{cache:"no-store"}),t=await e.json();e.ok&&eQ(t.ids||[])}catch(e){console.log("Error fetching disabled models:",e)}},[tw]),tS=async e=>{try{(await fetch("/api/models/disabled",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({providerAlias:tw,ids:[e]})})).ok&&await tC()}catch(e){console.log("Error disabling model:",e)}},tA=async e=>{try{(await fetch(`/api/models/disabled?providerAlias=${encodeURIComponent(tw)}&id=${encodeURIComponent(e)}`,{method:"DELETE"})).ok&&await tC()}catch(e){console.log("Error enabling model:",e)}},t$=async e=>{e.length&&eY({title:"Disable All Models",message:`Disable all ${e.length} model(s)?`,onConfirm:async()=>{eY(null);try{(await fetch("/api/models/disabled",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({providerAlias:tw,ids:e})})).ok&&await tC()}catch(e){console.log("Error disabling all models:",e)}}})},tT=async()=>{try{(await fetch(`/api/models/disabled?providerAlias=${encodeURIComponent(tw)}`,{method:"DELETE"})).ok&&await tC()}catch(e){console.log("Error enabling all models:",e)}},tO=(0,r.useCallback)(async()=>{try{let e=await fetch("/api/models/alias"),t=await e.json();e.ok&&ej(t.aliases||{})}catch(e){console.log("Error fetching aliases:",e)}},[]),tP=(0,r.useCallback)(async()=>{try{let e=await fetch("/api/models/custom",{cache:"no-store"}),t=await e.json();e.ok&&ev(t.models||[])}catch(e){console.log("Error fetching custom models:",e)}},[]);(0,r.useEffect)(()=>{"kilocode"===z&&fetch("/api/providers/kilo/free-models").then(e=>e.json()).then(e=>{e.models?.length&&eV(e.models)}).catch(()=>{})},[z]);let tE=(0,r.useCallback)(async()=>{try{let[e,t,s,a]=await Promise.all([fetch("/api/providers",{cache:"no-store"}),fetch("/api/provider-nodes",{cache:"no-store"}),fetch("/api/proxy-pools?isActive=true",{cache:"no-store"}),fetch("/api/settings",{cache:"no-store"})]),l=await e.json(),r=await t.json(),n=await s.json(),i=a.ok?await a.json():{};if(e.ok){let e=(l.connections||[]).filter(e=>e.provider===z);L(e)}s.ok&&V(n.proxyPools||[]);let o=(i.providerStrategies||{})[z]||{};eU(o.fallbackStrategy||null),eL(null!=o.stickyRoundRobinLimit?String(o.stickyRoundRobinLimit):"1");let d=B[z],c=d&&i[d]||{};if(eK({enabled:!0===c.enabled,connections:c.connections||{}}),t.ok){let e=(r.nodes||[]).find(e=>e.id===z)||null;if(!e&&tj)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===z)||null))break}q(e)}}catch(e){console.log("Error fetching connections:",e)}finally{F(!1)}},[z,tj]),tI=async e=>{try{let t=await fetch(`/api/provider-nodes/${z}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}),s=await t.json();t.ok&&(q(s.node),await tE(),ex(!1))}catch(e){console.log("Error updating provider node:",e)}},tz=async(e,t)=>{try{let s=await fetch("/api/settings",{cache:"no-store"}),a=(s.ok?await s.json():{}).providerStrategies||{},l={};e&&(l.fallbackStrategy=e),"round-robin"===e&&""!==t&&(l.stickyRoundRobinLimit=Number(t)||3);let r={...a};0===Object.keys(l).length?delete r[z]:r[z]=l,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)}},tD=async e=>{let t=B[z];if(t){eK(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,r.useEffect)(()=>{tE(),tO(),tP(),tC()},[tE,tO,tP,tC]),(0,r.useEffect)(()=>{if("cursor"!==z&&"zed"!==z)return void eq([]);let e=U.find(e=>!1!==e.isActive);if(!e?.id){eq([]),"zed"===z&&eB(null);return}let t=!1;return"zed"===z&&eB(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"===z&&s?.warning&&eB(s.warning);return}"zed"===z&&(eq([]),eB(s?.warning||s?.error||"Zed returned no live models."))}}).catch(()=>{t||"zed"!==z||(eq([]),eB("Failed to reach the Zed model catalog."))}),()=>{t=!0}},[z,U]),(0,r.useEffect)(()=>{let e=(u.zN[z]||u.fg[z]||u.IS[z]||u.nJ[z])?.modelsFetcher;e&&b(e).then(eM)},[z]);let t_=async(e,t,s=tf)=>{let a=`${s}/${e}`;try{let e=await fetch("/api/models/alias",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({model:a,alias:t})});if(e.ok)await tO();else{let t=await e.json();alert(t.error||"Failed to set alias")}}catch(e){console.log("Error setting alias:",e)}},tU=async e=>{try{(await fetch(`/api/models/alias?alias=${encodeURIComponent(e)}`,{method:"DELETE"})).ok&&await tO()}catch(e){console.log("Error deleting alias:",e)}},tJ=async(e,t="llm",s=tw,a)=>{try{let l=await fetch("/api/models/custom",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({providerAlias:s,id:e,type:t,...a?{caps:a}:{}})});if(l.ok)await tP(),window.dispatchEvent(new CustomEvent("customModelChanged"));else{let e=await l.json();alert(e.error||"Failed to add custom model")}}catch(e){console.log("Error adding custom model:",e)}},tL=async(e,t="llm",s=tw)=>{try{let a=new URLSearchParams({providerAlias:s,id:e,type:t});(await fetch(`/api/models/custom?${a}`,{method:"DELETE"})).ok&&(await tP(),window.dispatchEvent(new CustomEvent("customModelChanged")))}catch(e){console.log("Error deleting custom model:",e)}},tR=async()=>{if(te)return;let e=U.find(e=>!1!==e.isActive);if(!e)return void alert((0,y.Tl)("Please add an active Qoder connection first"));tt(!0);try{let t=await fetch(`/api/providers/${e.id}/models`),s=await t.json();if(!t.ok)return void alert(s.error||(0,y.Tl)("Failed to fetch models"));let a=s.models||[];if(0===a.length)return void alert((0,y.Tl)("No models returned"));let l=0;for(let e of a){let t=e.id||e.name;if(!t)continue;let s=t.replace(/^qoder\//,"");eb.some(e=>e.providerAlias===tw&&e.id===s&&"llm"===(e.kind||e.type||"llm"))||Object.values(ey).includes(`${tw}/${s}`)||(await tJ(s,"llm",tw),l+=1)}0===l?alert((0,y.Tl)("All models already exist, no new models added")):alert((0,y.Tl)("Successfully added")+` ${l} `+(0,y.Tl)("models"))}catch(e){console.log("Error importing Qoder models:",e),alert((0,y.Tl)("Error fetching models")+": "+e.message)}finally{tt(!1)}},tK=async e=>{eY({title:"Delete Connection",message:"Delete this connection?",onConfirm:async()=>{eY(null);try{(await fetch(`/api/providers/${e}`,{method:"DELETE"})).ok&&L(t=>t.filter(t=>t.id!==e))}catch(e){console.log("Error deleting connection:",e)}}})},tF=()=>{tE(),Q(!1)},tM=async e=>{er("");try{let t=await fetch("/api/providers",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:z,...e})}),s=null;try{s=await t.json()}catch{s=null}if(t.ok){await tE(),ea(!1);return}er(s?.error||"Failed to save connection")}catch(e){console.log("Error saving connection:",e),er("Failed to save connection")}},tG=async e=>{try{(await fetch(`/api/providers/${ef.id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})).ok&&(await tE(),em(!1))}catch(e){console.log("Error updating connection:",e)}},tq=async(e,t)=>{try{(await fetch(`/api/providers/${e}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({isActive:t})})).ok&&L(s=>s.map(s=>s.id===e?{...s,isActive:t}:s))}catch(e){console.log("Error updating connection status:",e)}},tZ=async(e,t)=>{let s=[...U];[s[e],s[t]]=[s[t],s[e]],L(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 tE()}},tB=U.length>0&&eE.length===U.length;(0,r.useEffect)(()=>{eI(e=>e.filter(e=>U.some(t=>t.id===e)))},[U]);let tH=async e=>{eD(!0);try{let t=0;for(let{connectionId:s,proxyPoolId:a}of e)try{(await fetch(`/api/providers/${s}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({proxyPoolId:a})})).ok||(t+=1)}catch(e){console.log("Error applying proxy for",s,e),t+=1}t>0&&alert(`Updated with ${t} failed request(s).`),await tE(),eh(!1)}finally{eD(!1)}},tV=e=>tH(U.map(t=>({connectionId:t.id,proxyPoolId:e}))),tW=(0,a.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:U.map((e,t)=>{let s;return(0,a.jsxs)("div",{className:"flex min-w-0 items-stretch",children:[(0,a.jsx)("div",{className:"flex shrink-0 items-center pl-1 sm:pl-2",children:(0,a.jsx)(C.S,{checked:(s=e.id,eE.includes(s)),onCheckedChange:()=>{var t;return t=e.id,void eI(e=>e.includes(t)?e.filter(e=>e!==t):[...e,t])}})}),(0,a.jsx)("div",{className:"flex-1 min-w-0",children:(0,a.jsx)(E.A,{connection:e,proxyPools:H,isOAuth:tm,isFirst:0===t,isLast:t===U.length-1,onMoveUp:()=>tZ(t,t-1),onMoveDown:()=>tZ(t,t+1),onToggleActive:t=>tq(e.id,t),autoPing:B[z]&&"oauth"===e.authType?{on:!0===eR.connections[e.id],onToggle:t=>{var s;return s=e.id,void tD({...eR,connections:{...eR.connections,[s]:t}})},provider:z}: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&&L(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:()=>tK(e.id),oneByOneStatus:e7[e.id]||null})})]},e.id)})}),tQ=H.filter(e=>!0===e.isActive),tX=(0,a.jsx)(S.lG,{open:eu,onOpenChange:e=>{!e&&(ez||eh(!1))},children:(0,a.jsxs)(S.Cf,{className:"max-w-md",children:[(0,a.jsx)(S.c7,{children:(0,a.jsxs)(S.L3,{children:["Apply Proxy (",U.length," connections)"]})}),(0,a.jsxs)("div",{className:"flex flex-col gap-2 p-4",children:[(0,a.jsxs)("button",{onClick:()=>{let e=H.filter(e=>!0===e.isActive);return 0===e.length?void alert("No active proxy pools available."):tH(U.map((t,s)=>({connectionId:t.id,proxyPoolId:e[s%e.length].id})))},disabled:ez||0===tQ.length,className:"flex items-center gap-3 rounded-lg border border-border px-3 py-2.5 text-left transition-colors hover:bg-muted disabled:cursor-not-allowed disabled:opacity-50",children:[(0,a.jsx)(A.A,{className:"size-4 shrink-0 text-muted-foreground"}),(0,a.jsxs)("span",{className:"flex min-w-0 flex-col",children:[(0,a.jsx)("span",{className:"text-sm font-medium text-foreground",children:"One-to-one (rotate)"}),(0,a.jsxs)("span",{className:"text-xs text-muted-foreground",children:["Distribute connections across ",tQ.length," active pool(s)"]})]})]}),(0,a.jsxs)("button",{onClick:()=>tV(null),disabled:ez,className:"flex items-center gap-3 rounded-lg border border-border px-3 py-2.5 text-left transition-colors hover:bg-muted disabled:cursor-not-allowed disabled:opacity-50",children:[(0,a.jsx)($.A,{className:"size-4 shrink-0 text-muted-foreground"}),(0,a.jsxs)("span",{className:"flex min-w-0 flex-col",children:[(0,a.jsx)("span",{className:"text-sm font-medium text-foreground",children:"None (unbind all)"}),(0,a.jsx)("span",{className:"text-xs text-muted-foreground",children:"Remove proxy from all connections"})]})]}),H.map(e=>(0,a.jsxs)("button",{onClick:()=>tV(e.id),disabled:ez||!0!==e.isActive,className:"flex items-center gap-3 rounded-lg border border-border px-3 py-2.5 text-left transition-colors hover:bg-muted disabled:cursor-not-allowed disabled:opacity-50",children:[(0,a.jsx)(T.A,{className:"size-4 shrink-0 text-muted-foreground"}),(0,a.jsx)("span",{className:"truncate text-sm font-medium text-foreground",children:e.name}),!0!==e.isActive&&(0,a.jsx)("span",{className:"text-[10px] text-muted-foreground",children:"(inactive)"})]},e.id)),ez&&(0,a.jsx)("p",{className:"text-xs text-muted-foreground",children:"Applying..."})]})]})}),tY=async(e,t="llm")=>{if(!e$.has(e)){eT(t=>new Set(t).add(e));try{let s=await fetch("/api/models/test",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({model:`${tw}/${e}`,kind:t})}),a=await s.json();eC(t=>({...t,[e]:a.ok?"ok":"error"})),eA(a.ok?"":a.error||"Model not reachable")}catch{eC(t=>({...t,[e]:"error"})),eA("Network error")}finally{eT(t=>{let s=new Set(t);return s.delete(e),s})}}};if(R)return(0,a.jsxs)(m.YW,{children:[(0,a.jsx)(m.KX,{}),(0,a.jsx)(m.KX,{})]});if(!td)return(0,a.jsxs)("div",{className:"text-center py-20",children:[(0,a.jsx)("p",{className:"text-muted-foreground",children:"Provider not found"}),(0,a.jsx)(o(),{href:"/dashboard/providers",className:"text-primary mt-4 inline-block",children:"Back to Providers"})]});let t0=()=>{if(tj){let e=(0,c.HY)((0,c.uM)(G?.baseUrl));return e||(ty?"/providers/anthropic.png":"/providers/openai.png")}return(0,c.HY)(td.id)};return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)(m.YW,{children:[(0,a.jsxs)("div",{className:"min-w-0",children:[(0,a.jsx)(x.$,{variant:"outline",size:"sm",asChild:!0,className:"mb-4",children:(0,a.jsxs)(o(),{href:"/dashboard/providers",children:[(0,a.jsx)(l.default,{name:"arrow_back",className:"text-lg"}),"Back to Providers"]})}),(0,a.jsxs)("div",{className:"flex min-w-0 items-center gap-3 sm:gap-4",children:[(0,a.jsx)("div",{className:"flex size-12 shrink-0 items-center justify-center rounded-lg",style:{backgroundColor:`${td.color}15`},children:eN||!t0()?(0,a.jsx)("span",{className:"text-sm font-bold",style:{color:td.color},children:(0,c.IM)(td.name)||td.textIcon||td.id.slice(0,2).toUpperCase()}):(0,a.jsx)(d.default,{src:t0(),alt:td.name,width:48,height:48,className:"max-h-12 max-w-12 rounded-lg object-contain",sizes:"48px",onError:()=>{(0,c.Kw)(td.id),ew(!0)},loading:"lazy",decoding:"async"})}),(0,a.jsxs)("div",{className:"min-w-0",children:[(0,a.jsxs)("div",{className:"flex items-center gap-3 flex-wrap",children:[(0,a.jsx)("h1",{className:"truncate text-2xl font-semibold tracking-tight sm:text-3xl",children:td.name}),(td.notice?.apiKeyUrl||td.notice?.signupUrl||td.website)&&(0,a.jsxs)("a",{href:td.notice?.apiKeyUrl||td.notice?.signupUrl||td.website,target:"_blank",rel:"noopener noreferrer",className:"text-xs text-primary hover:underline inline-flex items-center gap-1",children:[(0,a.jsx)(l.default,{name:"open_in_new",className:"text-sm"}),td.notice?.apiKeyUrl?"Get API Key":"Sign up / Learn more"]})]}),(0,a.jsxs)("p",{className:"text-muted-foreground",children:[U.length," connection",1===U.length?"":"s"]})]})]})]}),td.deprecated&&(0,a.jsxs)("div",{className:"flex items-center gap-2 px-3 py-2 rounded-lg bg-yellow-500/10 border border-yellow-500/30",children:[(0,a.jsx)(l.default,{name:"warning",className:"text-[16px] text-yellow-500 mt-0.5 shrink-0"}),(0,a.jsx)("p",{className:"text-xs text-red-600 dark:text-yellow-400 leading-relaxed",children:td.deprecationNotice})]}),td.notice?.text&&!td.deprecated&&(0,a.jsxs)("div",{className:"flex flex-col gap-2 rounded-lg border border-blue-500/30 bg-blue-500/10 px-3 py-2 sm:flex-row sm:items-center",children:[(0,a.jsx)(l.default,{name:"info",className:"text-[16px] text-blue-500 shrink-0"}),(0,a.jsx)("p",{className:"min-w-0 flex-1 text-xs leading-relaxed text-blue-600 dark:text-blue-400",children:td.notice.text}),td.notice.apiKeyUrl&&(0,a.jsx)("a",{href:td.notice.apiKeyUrl,target:"_blank",rel:"noopener noreferrer",className:"inline-flex justify-center rounded bg-blue-500 px-2 py-1 text-xs font-medium text-white transition-colors hover:bg-blue-600 sm:py-0.5",children:"Get API Key →"})]}),tj&&G&&(0,a.jsx)(p.Zp,{children:(0,a.jsx)(p.Wu,{children:(0,a.jsxs)("div",{className:"mb-4 flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between",children:[(0,a.jsxs)("div",{className:"min-w-0",children:[(0,a.jsx)("h2",{className:"text-lg font-semibold",children:ty?"Anthropic Compatible Details":"OpenAI Compatible Details"}),(0,a.jsxs)("p",{className:"break-all text-sm text-muted-foreground",children:[ty?"Messages API":"responses"===G.apiType?"Responses API":"Chat Completions"," ","\xb7 ",(G.baseUrl||"").replace(/\/$/,""),"/",ty?"messages":"responses"===G.apiType?"responses":"chat/completions"]})]}),(0,a.jsxs)("div",{className:"grid grid-cols-1 gap-2 sm:flex sm:items-center",children:[(0,a.jsxs)(x.$,{size:"sm",onClick:()=>{er(""),ea(!0)},className:"w-full sm:w-auto",children:[(0,a.jsx)(l.default,{name:"add"}),"Add API Key"]}),(0,a.jsxs)(x.$,{size:"sm",variant:"secondary",onClick:()=>ex(!0),className:"w-full sm:w-auto",children:[(0,a.jsx)(l.default,{name:"edit"}),"Edit"]}),(0,a.jsxs)(x.$,{size:"sm",variant:"secondary",onClick:async()=>{eY({title:"Delete Compatible Node",message:`Delete this ${ty?"Anthropic":"OpenAI"} Compatible node?`,onConfirm:async()=>{eY(null);try{(await fetch(`/api/provider-nodes/${z}`,{method:"DELETE"})).ok&&I.push("/dashboard/providers")}catch(e){console.log("Error deleting provider node:",e)}}})},className:"w-full sm:w-auto",children:[(0,a.jsx)(l.default,{name:"delete"}),"Delete"]})]})]})})}),tx?(0,a.jsx)(m.gw,{providerId:z}):(0,a.jsx)(p.Zp,{children:(0,a.jsxs)(p.Wu,{children:[(0,a.jsxs)("div",{className:"mb-4 flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[(0,a.jsx)("h2",{className:"text-lg font-semibold",children:"Connections"}),(0,a.jsxs)("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:gap-4",children:[U.length>0&&H.length>0&&(0,a.jsxs)(x.$,{size:"sm",variant:"secondary",onClick:()=>eh(!0),children:[(0,a.jsx)(l.default,{name:"lan"}),"Apply Proxy"]}),U.length>0&&(0,a.jsxs)(a.Fragment,{children:[eE.length>0&&(0,a.jsxs)(x.$,{size:"sm",variant:"destructive",onClick:()=>{let e=eE.length;0!==e&&eY({title:`Delete ${e} Connection${e>1?"s":""}`,message:`Delete ${e} connection${e>1?"s":""}? This cannot be undone.`,onConfirm:async()=>{eY(null);let e=0,t=[...eE];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}L(e=>e.filter(e=>!t.includes(e.id))),eI([]),e>0&&alert(`Deleted ${t.length-e} connection(s), ${e} failed.`)}})},children:[(0,a.jsx)(l.default,{name:"delete"}),"Delete Selected (",eE.length,")"]}),(0,a.jsxs)(x.$,{size:"sm",variant:"secondary",onClick:e9,disabled:e2,children:[(0,a.jsx)(l.default,{name:"sync"}),e2?"Testing Connection One-by-One...":"Test Connection One-by-One"]}),e2&&(0,a.jsxs)(x.$,{size:"sm",variant:"ghost",onClick:e8,disabled:e4,children:[(0,a.jsx)(l.default,{name:"stop"}),e4?"Stopping...":"Stop"]})]}),(0,a.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,a.jsx)("span",{className:"text-xs text-muted-foreground font-medium",children:"Round Robin"}),(0,a.jsx)(k.d,{checked:"round-robin"===e_,onCheckedChange:e=>{let t=e?"round-robin":null,s=e?eJ||"1":eJ;e&&!eJ&&eL("1"),eU(t),tz(t,s)}}),"round-robin"===e_&&(0,a.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,a.jsx)("span",{className:"text-xs text-muted-foreground",children:"Sticky:"}),(0,a.jsx)("input",{type:"number",min:1,value:eJ,onChange:e=>{var t;eL(t=e.target.value),tz("round-robin",t)},placeholder:"1",className:"w-14 px-2 py-1 text-xs border border-border rounded-md bg-background focus:outline-none focus:border-primary"})]})]})]})]}),0===U.length?(0,a.jsxs)("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[(0,a.jsx)("div",{className:"inline-flex items-center justify-center w-9 h-9 rounded-full bg-primary/10 text-primary shrink-0",children:(0,a.jsx)(l.default,{name:tm?"lock":"key",className:"text-[18px]"})}),(0,a.jsxs)("div",{className:"min-w-0",children:[(0,a.jsx)("p",{className:"text-sm text-muted-foreground",children:"No connections yet"}),tb&&(0,a.jsxs)("p",{className:"text-xs text-muted-foreground",children:["Choose ",tv," or ",tN,"."]})]})]}),(0,a.jsx)("div",{className:"flex gap-2",children:tb?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)(x.$,{size:"sm",variant:"secondary",onClick:tn,children:[(0,a.jsx)(l.default,{name:"lock"}),tv]}),(0,a.jsxs)(x.$,{size:"sm",onClick:ti,children:[(0,a.jsx)(l.default,{name:"key"}),tN]})]}):(0,a.jsxs)(a.Fragment,{children:[!tj&&"iflow"===z&&(0,a.jsxs)(x.$,{size:"sm",variant:"secondary",onClick:()=>et(!0),children:[(0,a.jsx)(l.default,{name:"cookie"}),"Cookie"]}),"codex"===z&&(0,a.jsxs)(x.$,{size:"sm",variant:"secondary",onClick:()=>ei(!0),children:[(0,a.jsx)(l.default,{name:"playlist_add"}),(0,y.Tl)("Bulk Add")]}),"grok-cli"===z&&(0,a.jsxs)(x.$,{size:"sm",variant:"secondary",onClick:()=>ed(!0),children:[(0,a.jsx)(l.default,{name:"playlist_add"}),(0,y.Tl)("Bulk Add")]}),(0,a.jsxs)(x.$,{size:"sm",onClick:to,children:[(0,a.jsx)(l.default,{name:"add"}),tj?"Add API Key":"iflow"===z?"OAuth":"Add Connection"]})]})})]}):(0,a.jsxs)(a.Fragment,{children:[e6&&(0,a.jsx)("div",{className:"mb-4 rounded-lg border border-black/10 bg-black/[0.02] px-3 py-2 text-xs text-muted-foreground dark:border-white/10 dark:bg-white/[0.03]",children:(0,a.jsxs)("div",{className:"flex flex-wrap items-center gap-3",children:[(0,a.jsxs)("span",{children:["Total: ",e6.total]}),(0,a.jsxs)("span",{children:["Completed: ",e6.completed]}),(0,a.jsxs)("span",{children:["Passed: ",e6.passed]}),(0,a.jsxs)("span",{children:["Failed: ",e6.failed]}),e6.stopped&&(0,a.jsx)("span",{className:"text-amber-600 dark:text-amber-400",children:"Stopped"}),e2&&e3&&(0,a.jsxs)("span",{children:["Running:"," ",U.find(e=>e.id===e3)?.name||e3]})]})}),U.length>0&&(0,a.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,a.jsxs)("label",{className:"flex cursor-pointer items-center gap-1.5 text-xs text-muted-foreground hover:text-primary",children:[(0,a.jsx)(C.S,{checked:tB,onCheckedChange:()=>{tB?eI([]):eI(U.map(e=>e.id))},className:"size-3.5 [&_svg]:size-2.5"}),"Select All"]})}),tW,!tj&&(0,a.jsxs)("div",{className:"mt-4 grid grid-cols-1 gap-2 sm:flex",children:["iflow"===z&&(0,a.jsxs)(N.m_,{children:[(0,a.jsx)(N.k$,{asChild:!0,children:(0,a.jsxs)(x.$,{size:"sm",variant:"secondary",onClick:()=>et(!0),className:"w-full sm:w-auto",children:[(0,a.jsx)(l.default,{name:"cookie"}),"Cookie"]})}),(0,a.jsx)(N.ZI,{children:"Add connection using browser cookie"})]}),"codex"===z&&(0,a.jsxs)(N.m_,{children:[(0,a.jsx)(N.k$,{asChild:!0,children:(0,a.jsxs)(x.$,{size:"sm",variant:"secondary",onClick:()=>ei(!0),className:"w-full sm:w-auto",children:[(0,a.jsx)(l.default,{name:"playlist_add"}),(0,y.Tl)("Bulk Add")]})}),(0,a.jsx)(N.ZI,{children:(0,y.Tl)("Bulk import codex accounts from JSON")})]}),"grok-cli"===z&&(0,a.jsxs)(N.m_,{children:[(0,a.jsx)(N.k$,{asChild:!0,children:(0,a.jsxs)(x.$,{size:"sm",variant:"secondary",onClick:()=>ed(!0),className:"w-full sm:w-auto",children:[(0,a.jsx)(l.default,{name:"playlist_add"}),(0,y.Tl)("Bulk Add")]})}),(0,a.jsx)(N.ZI,{children:(0,y.Tl)("Bulk import Grok CLI accounts from JSON")})]}),tb?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)(x.$,{size:"sm",variant:"secondary",onClick:tn,className:"w-full sm:w-auto",children:[(0,a.jsx)(l.default,{name:"lock"}),tv]}),(0,a.jsxs)(x.$,{size:"sm",onClick:ti,className:"w-full sm:w-auto",children:[(0,a.jsx)(l.default,{name:"key"}),tN]})]}):(0,a.jsxs)(x.$,{size:"sm",onClick:to,className:"w-full sm:w-auto",children:[(0,a.jsx)(l.default,{name:"add"}),"Add"]})]})]})]})}),(0,a.jsx)(p.Zp,{children:(0,a.jsxs)(p.Wu,{children:[(0,a.jsxs)("div",{className:"mb-4 flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between",children:[(0,a.jsx)("div",{className:"flex items-center gap-3",children:(0,a.jsx)("h2",{className:"text-lg font-semibold",children:"Available Models"})}),!tj&&(e=[...th,...eH.filter(e=>!th.some(t=>t.id===e.id))].filter(e=>{let t=(0,h.CP)(e);return!t||"llm"===t}).map(e=>e.id).filter(e=>!eW.includes(e)),(0,a.jsxs)("div",{className:"flex gap-2",children:[eW.length>0&&(0,a.jsxs)(x.$,{size:"sm",variant:"secondary",onClick:tT,children:[(0,a.jsx)(l.default,{name:"restart_alt"}),"Active All"]}),e.length>0&&(0,a.jsxs)(x.$,{size:"sm",variant:"secondary",onClick:()=>t$(e),children:[(0,a.jsx)(l.default,{name:"block"}),"Disable All"]})]}))]}),!!eS&&(0,a.jsxs)("div",{className:"mb-3",children:[(0,a.jsx)("p",{className:"text-xs text-red-500 break-words",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"')]+/),i=t.match(/wrk_[0-9A-Za-z]+/),j=s?s[0].endsWith("/go")?s[0]:`${s[0]}/go`:i?`https://opencode.ai/workspace/${i[0]}/go`:"https://opencode.ai",(0,a.jsx)("div",{className:"mt-1.5",children:(0,a.jsxs)("a",{href:j,target:"_blank",rel:"noreferrer",className:"inline-flex items-center gap-1 rounded-md bg-amber-500/10 px-2 py-0.5 text-xs font-medium text-amber-600 hover:bg-amber-500/20 dark:text-amber-400 transition-colors",children:[(0,a.jsx)("span",{children:"Allow China-hosted models"}),(0,a.jsx)(l.default,{name:"open_in_new",className:"text-[13px]"})]})}))]}),"zed"===z&&!!eZ&&(0,a.jsx)("p",{className:"text-xs text-red-500 mb-3 break-words",children:eZ}),(()=>{let e,t,s;if(tj)return(0,a.jsx)(P,{providerStorageAlias:tw,providerDisplayAlias:tk,modelAliases:ey,customModels:eb,copied:ts,onCopy:ta,onSetAlias:t_,onDeleteAlias:tU,onAddCustomModel:e=>tJ(e,"llm",tw),onDeleteCustomModel:e=>tL(e,"llm",tw),connections:U,isAnthropic:ty});let r=[...th,...eH.filter(e=>!th.some(t=>t.id===e.id))].filter(e=>{let t=(0,h.CP)(e);return!t||"llm"===t}),n=new Set(eW),i=r.filter(e=>!n.has(e.id)),o=r.filter(e=>n.has(e.id)),d=v({customModels:eb,modelAliases:ey,providerAlias:tw,builtInModels:th,type:"llm"});return(0,a.jsxs)("div",{className:"flex flex-wrap gap-3",children:[d.map(e=>(0,a.jsx)(w,{model:{id:e.id,name:e.name},fullModel:`${tk}/${e.id}`,alias:e.alias,copied:ts,onCopy:ta,onSetAlias:()=>{},onDeleteAlias:()=>{"custom"===e.source?tL(e.id,"llm",tw):tU(e.alias)},testStatus:ek[e.id],onTest:U.length>0||tx?()=>tY(e.id,(0,h.CP)(e,"llm")):void 0,isTesting:e$.has(e.id),isCustom:!0,isFree:!1,caps:D(`${z}/${e.id}`)},`${e.source}-${e.fullModel}`)),i.map(e=>{let t=`${tw}/${e.id}`,s=`${z}/${e.id}`,l=Object.entries(ey).find(([,e])=>e===t||e===s)?.[0];return(0,a.jsx)(w,{model:e,fullModel:`${tk}/${e.id}`,alias:l,copied:ts,onCopy:ta,onSetAlias:t=>t_(e.id,t,tw),onDeleteAlias:()=>tU(l),testStatus:ek[e.id],onTest:U.length>0||tx?()=>tY(e.id,(0,h.CP)(e,"llm")):void 0,isTesting:e$.has(e.id),isFree:e.isFree,onDisable:()=>tS(e.id),caps:D(`${z}/${e.id}`)},e.id)}),(0,a.jsxs)("button",{onClick:()=>eP(!0),className:"flex w-full items-center justify-center gap-1.5 rounded-lg border border-dashed border-primary/40 px-3 py-2 text-xs text-primary transition-colors hover:border-primary hover:bg-primary/5 sm:w-auto",children:[(0,a.jsx)(l.default,{name:"add",className:"text-sm"}),"Add Model"]}),"qoder"===z&&U.some(e=>!1!==e.isActive)&&(0,a.jsxs)("button",{onClick:tR,disabled:te,className:"flex w-full items-center justify-center gap-1.5 rounded-lg border border-dashed border-blue-500/40 px-3 py-2 text-xs text-blue-600 dark:text-blue-400 transition-colors hover:border-blue-500 hover:bg-blue-500/5 sm:w-auto disabled:opacity-50 disabled:cursor-not-allowed",children:[(0,a.jsx)(l.default,{name:te?"progress_activity":"download",className:"text-sm",style:te?{animation:"spin 1s linear infinite"}:void 0}),te?(0,y.Tl)("Fetching..."):(0,y.Tl)("Fetch Qoder Models")]}),eF.length>0&&(e=new Set([...Object.values(ey),...d.map(e=>e.fullModel)]),t=new Set(th.map(e=>e.id)),0===(s=eF.filter(s=>!e.has(`${tw}/${s.id}`)&&!t.has(s.id))).length?null:(0,a.jsxs)("div",{className:"w-full mt-2",children:[(0,a.jsx)("p",{className:"text-xs text-muted-foreground mb-2",children:"Suggested free models (≥200k context):"}),(0,a.jsx)("div",{className:"flex flex-wrap gap-2",children:s.map(e=>(0,a.jsxs)(N.m_,{children:[(0,a.jsx)(N.k$,{asChild:!0,children:(0,a.jsxs)("button",{onClick:async()=>{await tJ(e.id,"llm",tw)},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-muted-foreground hover:text-primary hover:border-primary/40 hover:bg-primary/5 transition-colors",children:[(0,a.jsx)(l.default,{name:"add",className:"text-[13px]"}),e.id.split("/").pop()]})}),(0,a.jsx)(N.ZI,{children:`${e.name} \xb7 ${(e.contextLength/1e3).toFixed(0)}k ctx`})]},e.id))})]})),o.length>0&&(0,a.jsxs)("div",{className:"w-full mt-2",children:[(0,a.jsxs)("p",{className:"text-xs text-muted-foreground mb-2",children:["Disabled models (",o.length,"):"]}),(0,a.jsx)("div",{className:"flex flex-wrap gap-2",children:o.map(e=>(0,a.jsxs)(N.m_,{children:[(0,a.jsx)(N.k$,{asChild:!0,children:(0,a.jsxs)("button",{onClick:()=>tA(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-muted-foreground hover:text-primary hover:border-primary/40 hover:bg-primary/5 transition-colors",children:[(0,a.jsx)(l.default,{name:"add",className:"text-[13px]"}),e.id]})}),(0,a.jsx)(N.ZI,{children:"Restore model"})]},e.id))})]})]})})()]})}),tX,"cursor"===z?(0,a.jsx)(m.G9,{isOpen:W,onSuccess:tF,onClose:()=>Q(!1)}):"gitlab"===z?(0,a.jsx)(m.vj,{isOpen:W,providerInfo:td,onSuccess:tF,onClose:()=>Q(!1)}):(0,a.jsx)(m.LF,{isOpen:W,provider:z,providerInfo:td,onSuccess:tF,onClose:()=>Q(!1)}),(0,a.jsx)(m.LH,{isOpen:X,onSuccess:tF,onClose:()=>Y(!1)}),"iflow"===z&&(0,a.jsx)(m.vE,{isOpen:ee,onSuccess:()=>{tE(),et(!1)},onClose:()=>et(!1)})]}),(0,a.jsx)(_,{isOpen:es,provider:z,providerName:td.name,authType:td?.authType,authHint:td?.authHint,website:td?.website,proxyPools:H,error:el,onSave:tM,onClose:()=>{er(""),ea(!1)}}),(0,a.jsx)(m.wI,{isOpen:ec,connection:ef,proxyPools:H,onSave:tG,onClose:()=>em(!1)}),tj&&(0,a.jsx)(J,{isOpen:ep,node:G,onSave:tI,onClose:()=>ex(!1),isAnthropic:ty}),!tj&&(0,a.jsx)(K,{isOpen:eO,providerAlias:tw,providerDisplayAlias:tk,onSave:async(e,t)=>{await tJ(e,"llm",tw,t),eP(!1)},onClose:()=>eP(!1)}),"codex"===z&&(0,a.jsx)(M,{isOpen:en,onClose:()=>ei(!1),onSuccess:tE}),"grok-cli"===z&&(0,a.jsx)(Z,{isOpen:eo,onClose:()=>ed(!1),onSuccess:tE}),(0,a.jsx)(m.uo,{isOpen:e0,onClose:()=>e1(!1),onConfirm:()=>{(window.localStorage.setItem(tl,"true"),e1(!1),tm)?tr():ti()},title:"Risk Notice",message:td?.deprecationNotice,confirmText:"I Understand, Continue",cancelText:"Cancel",variant:"danger"}),(0,a.jsx)(m.uo,{isOpen:!!eX,onClose:()=>eY(null),onConfirm:eX?.onConfirm,title:eX?.title||"Confirm",message:eX?.message,variant:"danger"})]})}}},e=>{e.O(0,[6766,5166,7552,9980,1471,5778,4484,3577,5862,5113,1699,1722,159,4489,1278,1830,6770,9369,427,9966,7358],()=>e(e.s=52908)),_N_E=e.O()}]);
|
|
21
|
+
]`;function q(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 Z({isOpen:e,onClose:t,onSuccess:s}){let[n,i]=(0,r.useState)(""),[o,d]=(0,r.useState)(!1),[c,m]=(0,r.useState)(""),[p,u]=(0,r.useState)(null),[h,f]=(0,r.useState)(!1),[g,j]=(0,r.useState)(null),b=(0,r.useRef)(null),v=()=>{o||(i(""),m(""),u(null),j(null),f(!1),t())},N=async e=>{if(!e||0===e.length)return;m("");let t=Array.from(e).filter(e=>e.name.endsWith(".json")||"application/json"===e.type||""===e.type);if(0===t.length)return void m((0,y.Tl)("Please select valid .json files"));try{let e=[];for(let s of t){let t=await s.text(),a=q(t);Array.isArray(a)?e.push(...a):a&&e.push(a)}if(0===e.length)return void m((0,y.Tl)("No accounts found in selected files"));i(JSON.stringify(e,null,2)),j({filesCount:t.length,accountsCount:e.length})}catch(e){m(`${(0,y.Tl)("Error reading files")}: ${e.message}`)}},w=async()=>{let e;m(""),u(null);try{e=q(n)}catch(e){m(`${(0,y.Tl)("Invalid JSON")}: ${e.message}`);return}if(!e||0===e.length)return void m((0,y.Tl)("No accounts found in input"));d(!0);try{let t=await fetch("/api/oauth/grok-cli/bulk-import",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({accounts:e})}),a=await t.json();if(!t.ok)return void m(a?.error||`Request failed: ${t.status}`);u(a),a.success>0&&"function"==typeof s&&s()}catch(e){m(e.message||(0,y.Tl)("Request failed"))}finally{d(!1)}},k=p?.results?.filter(e=>!e.ok)||[];return(0,a.jsx)(S.lG,{open:e,onOpenChange:e=>!e&&v(),children:(0,a.jsxs)(S.Cf,{className:"max-w-md",children:[(0,a.jsx)(S.c7,{children:(0,a.jsx)(S.L3,{children:(0,y.Tl)("Bulk Add Grok CLI Accounts")})}),(0,a.jsxs)("div",{className:"flex max-h-[calc(85vh-120px)] flex-col gap-4 overflow-y-auto p-4",children:[(0,a.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[(0,a.jsx)("p",{className:"text-xs text-muted-foreground",children:(0,y.Tl)("Upload multiple .json files or paste JSON array / object.")}),(0,a.jsx)("input",{ref:b,type:"file",accept:".json,application/json",multiple:!0,className:"hidden",onChange:e=>{N(e.target.files),e.target&&(e.target.value="")}}),(0,a.jsxs)(x.$,{type:"button",size:"sm",variant:"secondary",onClick:()=>b.current?.click(),disabled:o,children:[(0,a.jsx)(l.default,{name:"upload_file"}),(0,y.Tl)("Upload JSON Files")]})]}),(0,a.jsxs)("div",{onDragOver:e=>{e.preventDefault(),f(!0)},onDragLeave:e=>{e.preventDefault(),f(!1)},onDrop:e=>{e.preventDefault(),f(!1),e.dataTransfer?.files?.length>0&&N(e.dataTransfer.files)},className:`relative rounded border transition-colors ${h?"border-primary bg-primary/10 ring-2 ring-primary/30":"border-accent/30 bg-sidebar"}`,children:[(0,a.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:n,onChange:e=>{i(e.target.value),j(null)},disabled:o}),h&&(0,a.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,a.jsx)(l.default,{name:"upload_file",className:"text-3xl text-primary mb-1"}),(0,a.jsx)("span",{className:"text-sm font-medium text-primary",children:(0,y.Tl)("Drop .json files here")})]})]}),g&&(0,a.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,a.jsx)(l.default,{name:"check_circle",className:"text-sm"}),(0,a.jsxs)("span",{children:[(0,y.Tl)("Loaded")," ",g.accountsCount," ",(0,y.Tl)("account(s) from")," ",g.filesCount," ",(0,y.Tl)("file(s)")]})]}),c&&(0,a.jsx)("p",{className:"text-xs text-red-500 break-words",children:c}),p&&p.failed>0&&(0,a.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,a.jsxs)("div",{className:"text-sm font-medium text-yellow-400",children:["✗ ",p.failed," ",(0,y.Tl)("failed")]}),k.length>0&&(0,a.jsx)("ul",{className:"rounded border border-accent/20 bg-sidebar/50 p-2 text-xs font-mono max-h-40 overflow-y-auto",children:k.map(e=>(0,a.jsxs)("li",{className:"text-red-400",children:["[",e.index,"] ",e.error]},e.index))})]}),(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsx)(x.$,{onClick:w,className:"w-full",disabled:o||!n.trim(),children:o?(0,y.Tl)("Importing..."):(0,y.Tl)("Import All")}),(0,a.jsx)(x.$,{onClick:v,variant:"ghost",className:"w-full",disabled:o,children:(0,y.Tl)("Close")})]})]})]})})}let B={claude:"claudeAutoPing",codex:"codexAutoPing"};function H(){let e,t,s,i,j,O=(0,n.useParams)(),I=(0,n.useRouter)(),z=O.id,{getCaps:D}=(0,g.y)(),[U,L]=(0,r.useState)([]),[R,F]=(0,r.useState)(!0),[G,q]=(0,r.useState)(null),[H,V]=(0,r.useState)([]),[W,Q]=(0,r.useState)(!1),[X,Y]=(0,r.useState)(!1),[ee,et]=(0,r.useState)(!1),[es,ea]=(0,r.useState)(!1),[el,er]=(0,r.useState)(""),[en,ei]=(0,r.useState)(!1),[eo,ed]=(0,r.useState)(!1),[ec,em]=(0,r.useState)(!1),[ep,ex]=(0,r.useState)(!1),[eu,eh]=(0,r.useState)(!1),[ef,eg]=(0,r.useState)(null),[ey,ej]=(0,r.useState)({}),[eb,ev]=(0,r.useState)([]),[eN,ew]=(0,r.useState)(!1),[ek,eC]=(0,r.useState)({}),[eS,eA]=(0,r.useState)(""),[e$,eT]=(0,r.useState)(()=>new Set),[eO,eP]=(0,r.useState)(!1),[eE,eI]=(0,r.useState)([]),[ez,eD]=(0,r.useState)(!1),[e_,eU]=(0,r.useState)(null),[eJ,eL]=(0,r.useState)(""),[eR,eK]=(0,r.useState)({enabled:!1,connections:{}}),[eF,eM]=(0,r.useState)([]),[eG,eq]=(0,r.useState)([]),[eZ,eB]=(0,r.useState)(null),[eH,eV]=(0,r.useState)([]),[eW,eQ]=(0,r.useState)([]),[eX,eY]=(0,r.useState)(null),[e0,e1]=(0,r.useState)(!1),e5=function(e){let[t,s]=(0,r.useState)(!1),[a,l]=(0,r.useState)(!1),[n,i]=(0,r.useState)(null),[o,d]=(0,r.useState)({}),[c,m]=(0,r.useState)(null),p=(0,r.useRef)(!1),x=async()=>{if(t||0===e.length)return;let a=Object.fromEntries(e.map(e=>[e.id,{state:"queued",error:null}]));p.current=!1,s(!0),l(!1),i(null),d(a),m({total:e.length,completed:0,passed:0,failed:0,stopped:!1});let r=0,n=0;try{for(let t=0;t<e.length;t+=1){if(p.current){m({total:e.length,completed:t,passed:r,failed:n,stopped:!0});break}let s=e[t];i(s.id),d(e=>({...e,[s.id]:{state:"testing",error:null}}));try{let e=await fetch(`/api/providers/${s.id}/test`,{method:"POST"}),t=await e.json(),a=!!t.valid;a?r+=1:n+=1,d(e=>({...e,[s.id]:{state:a?"success":"failed",error:a?null:t.error||null}}))}catch(e){n+=1,d(t=>({...t,[s.id]:{state:"failed",error:e.message||"Test failed"}}))}m({total:e.length,completed:t+1,passed:r,failed:n,stopped:!1}),t<e.length-1&&await new Promise(e=>setTimeout(e,1e3))}}finally{i(null),s(!1),l(!1),p.current=!1}};return{running:t,stopping:a,currentConnectionId:n,results:o,summary:c,run:x,stop:()=>{t&&(p.current=!0,l(!0))}}}(U),e2=e5.running,e4=e5.stopping,e3=e5.currentConnectionId,e6=e5.results,e7=e5.summary,e9=e5.run,e8=e5.stop,[te,tt]=(0,r.useState)(!1),{copied:ts,copy:ta}=(0,f.C)(),tl="ag_risk_confirmed",tr=()=>{Q(!0)},tn=()=>{"antigravity"===z&&"true"!==window.localStorage.getItem(tl)?e1(!0):"xiaomi-mimo"===z?Y(!0):tm?tr():(er(""),ea(!0))},ti=()=>{er(""),ea(!0)},to=()=>{tm?tn():ti()},td=G?{id:G.id,name:G.name||("anthropic-compatible"===G.type?"Anthropic Compatible":"OpenAI Compatible"),color:"anthropic-compatible"===G.type?"#D97757":"#10A37F",textIcon:"anthropic-compatible"===G.type?"AC":"OC",apiType:G.apiType,baseUrl:G.baseUrl,type:G.type}:u.zN[z]||u.fg[z]||u.IS[z]||u.nJ[z]||u.br[z],tc=td?.authModes||[],tm=!!u.zN[z]||!!u.IS[z]||tc.includes("oauth"),tp=!!u.fg[z]||tc.includes("apikey"),tx=!!u.IS[z]?.noAuth,tu=(0,h.KC)(z),th=("cursor"===z||"zed"===z)&&eG.length>0?eG:tu,tf=(0,u.wG)(z),tg=(0,u.mq)(z),ty=(0,u.gb)(z),tj=tg||ty,tb=!tj&&tm&&tp,tv="xai"===z?"Grok Build OAuth":"grok-cli"===z?"Grok CLI Device Login":"OAuth",tN="xai"===z?"xAI API Key":"qoder"===z?"PAT":"API Key",tw=tj?z:tf,tk=tj?G?.prefix||z:tf,tC=(0,r.useCallback)(async()=>{try{let e=await fetch(`/api/models/disabled?providerAlias=${encodeURIComponent(tw)}`,{cache:"no-store"}),t=await e.json();e.ok&&eQ(t.ids||[])}catch(e){console.log("Error fetching disabled models:",e)}},[tw]),tS=async e=>{try{(await fetch("/api/models/disabled",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({providerAlias:tw,ids:[e]})})).ok&&await tC()}catch(e){console.log("Error disabling model:",e)}},tA=async e=>{try{(await fetch(`/api/models/disabled?providerAlias=${encodeURIComponent(tw)}&id=${encodeURIComponent(e)}`,{method:"DELETE"})).ok&&await tC()}catch(e){console.log("Error enabling model:",e)}},t$=async e=>{e.length&&eY({title:"Disable All Models",message:`Disable all ${e.length} model(s)?`,onConfirm:async()=>{eY(null);try{(await fetch("/api/models/disabled",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({providerAlias:tw,ids:e})})).ok&&await tC()}catch(e){console.log("Error disabling all models:",e)}}})},tT=async()=>{try{(await fetch(`/api/models/disabled?providerAlias=${encodeURIComponent(tw)}`,{method:"DELETE"})).ok&&await tC()}catch(e){console.log("Error enabling all models:",e)}},tO=(0,r.useCallback)(async()=>{try{let e=await fetch("/api/models/alias"),t=await e.json();e.ok&&ej(t.aliases||{})}catch(e){console.log("Error fetching aliases:",e)}},[]),tP=(0,r.useCallback)(async()=>{try{let e=await fetch("/api/models/custom",{cache:"no-store"}),t=await e.json();e.ok&&ev(t.models||[])}catch(e){console.log("Error fetching custom models:",e)}},[]);(0,r.useEffect)(()=>{"kilocode"===z&&fetch("/api/providers/kilo/free-models").then(e=>e.json()).then(e=>{e.models?.length&&eV(e.models)}).catch(()=>{})},[z]);let tE=(0,r.useCallback)(async()=>{try{let[e,t,s,a]=await Promise.all([fetch("/api/providers",{cache:"no-store"}),fetch("/api/provider-nodes",{cache:"no-store"}),fetch("/api/proxy-pools?isActive=true",{cache:"no-store"}),fetch("/api/settings",{cache:"no-store"})]),l=await e.json(),r=await t.json(),n=await s.json(),i=a.ok?await a.json():{};if(e.ok){let e=(l.connections||[]).filter(e=>e.provider===z);L(e)}s.ok&&V(n.proxyPools||[]);let o=(i.providerStrategies||{})[z]||{};eU(o.fallbackStrategy||null),eL(null!=o.stickyRoundRobinLimit?String(o.stickyRoundRobinLimit):"1");let d=B[z],c=d&&i[d]||{};if(eK({enabled:!0===c.enabled,connections:c.connections||{}}),t.ok){let e=(r.nodes||[]).find(e=>e.id===z)||null;if(!e&&tj)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===z)||null))break}q(e)}}catch(e){console.log("Error fetching connections:",e)}finally{F(!1)}},[z,tj]),tI=async e=>{try{let t=await fetch(`/api/provider-nodes/${z}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}),s=await t.json();t.ok&&(q(s.node),await tE(),ex(!1))}catch(e){console.log("Error updating provider node:",e)}},tz=async(e,t)=>{try{let s=await fetch("/api/settings",{cache:"no-store"}),a=(s.ok?await s.json():{}).providerStrategies||{},l={};e&&(l.fallbackStrategy=e),"round-robin"===e&&""!==t&&(l.stickyRoundRobinLimit=Number(t)||3);let r={...a};0===Object.keys(l).length?delete r[z]:r[z]=l,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)}},tD=async e=>{let t=B[z];if(t){eK(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,r.useEffect)(()=>{tE(),tO(),tP(),tC()},[tE,tO,tP,tC]),(0,r.useEffect)(()=>{if("cursor"!==z&&"zed"!==z)return void eq([]);let e=U.find(e=>!1!==e.isActive);if(!e?.id){eq([]),"zed"===z&&eB(null);return}let t=!1;return"zed"===z&&eB(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"===z&&s?.warning&&eB(s.warning);return}"zed"===z&&(eq([]),eB(s?.warning||s?.error||"Zed returned no live models."))}}).catch(()=>{t||"zed"!==z||(eq([]),eB("Failed to reach the Zed model catalog."))}),()=>{t=!0}},[z,U]),(0,r.useEffect)(()=>{let e=(u.zN[z]||u.fg[z]||u.IS[z]||u.nJ[z])?.modelsFetcher;e&&b(e).then(eM)},[z]);let t_=async(e,t,s=tf)=>{let a=`${s}/${e}`;try{let e=await fetch("/api/models/alias",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({model:a,alias:t})});if(e.ok)await tO();else{let t=await e.json();alert(t.error||"Failed to set alias")}}catch(e){console.log("Error setting alias:",e)}},tU=async e=>{try{(await fetch(`/api/models/alias?alias=${encodeURIComponent(e)}`,{method:"DELETE"})).ok&&await tO()}catch(e){console.log("Error deleting alias:",e)}},tJ=async(e,t="llm",s=tw,a)=>{try{let l=await fetch("/api/models/custom",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({providerAlias:s,id:e,type:t,...a?{caps:a}:{}})});if(l.ok)await tP(),window.dispatchEvent(new CustomEvent("customModelChanged"));else{let e=await l.json();alert(e.error||"Failed to add custom model")}}catch(e){console.log("Error adding custom model:",e)}},tL=async(e,t="llm",s=tw)=>{try{let a=new URLSearchParams({providerAlias:s,id:e,type:t});(await fetch(`/api/models/custom?${a}`,{method:"DELETE"})).ok&&(await tP(),window.dispatchEvent(new CustomEvent("customModelChanged")))}catch(e){console.log("Error deleting custom model:",e)}},tR=async()=>{if(te)return;let e=U.find(e=>!1!==e.isActive);if(!e)return void alert((0,y.Tl)("Please add an active Qoder connection first"));tt(!0);try{let t=await fetch(`/api/providers/${e.id}/models`),s=await t.json();if(!t.ok)return void alert(s.error||(0,y.Tl)("Failed to fetch models"));let a=s.models||[];if(0===a.length)return void alert((0,y.Tl)("No models returned"));let l=0;for(let e of a){let t=e.id||e.name;if(!t)continue;let s=t.replace(/^qoder\//,"");eb.some(e=>e.providerAlias===tw&&e.id===s&&"llm"===(e.kind||e.type||"llm"))||Object.values(ey).includes(`${tw}/${s}`)||(await tJ(s,"llm",tw),l+=1)}0===l?alert((0,y.Tl)("All models already exist, no new models added")):alert((0,y.Tl)("Successfully added")+` ${l} `+(0,y.Tl)("models"))}catch(e){console.log("Error importing Qoder models:",e),alert((0,y.Tl)("Error fetching models")+": "+e.message)}finally{tt(!1)}},tK=async e=>{eY({title:"Delete Connection",message:"Delete this connection?",onConfirm:async()=>{eY(null);try{(await fetch(`/api/providers/${e}`,{method:"DELETE"})).ok&&L(t=>t.filter(t=>t.id!==e))}catch(e){console.log("Error deleting connection:",e)}}})},tF=()=>{tE(),Q(!1)},tM=async e=>{er("");try{let t=await fetch("/api/providers",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:z,...e})}),s=null;try{s=await t.json()}catch{s=null}if(t.ok){await tE(),ea(!1);return}er(s?.error||"Failed to save connection")}catch(e){console.log("Error saving connection:",e),er("Failed to save connection")}},tG=async e=>{try{(await fetch(`/api/providers/${ef.id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})).ok&&(await tE(),em(!1))}catch(e){console.log("Error updating connection:",e)}},tq=async(e,t)=>{try{(await fetch(`/api/providers/${e}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({isActive:t})})).ok&&L(s=>s.map(s=>s.id===e?{...s,isActive:t}:s))}catch(e){console.log("Error updating connection status:",e)}},tZ=async(e,t)=>{let s=[...U];[s[e],s[t]]=[s[t],s[e]],L(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 tE()}},tB=U.length>0&&eE.length===U.length;(0,r.useEffect)(()=>{eI(e=>e.filter(e=>U.some(t=>t.id===e)))},[U]);let tH=async e=>{eD(!0);try{let t=0;for(let{connectionId:s,proxyPoolId:a}of e)try{(await fetch(`/api/providers/${s}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({proxyPoolId:a})})).ok||(t+=1)}catch(e){console.log("Error applying proxy for",s,e),t+=1}t>0&&alert(`Updated with ${t} failed request(s).`),await tE(),eh(!1)}finally{eD(!1)}},tV=e=>tH(U.map(t=>({connectionId:t.id,proxyPoolId:e}))),tW=(0,a.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:U.map((e,t)=>{let s;return(0,a.jsxs)("div",{className:"flex min-w-0 items-stretch",children:[(0,a.jsx)("div",{className:"flex shrink-0 items-center pl-1 sm:pl-2",children:(0,a.jsx)(C.S,{checked:(s=e.id,eE.includes(s)),onCheckedChange:()=>{var t;return t=e.id,void eI(e=>e.includes(t)?e.filter(e=>e!==t):[...e,t])}})}),(0,a.jsx)("div",{className:"flex-1 min-w-0",children:(0,a.jsx)(E.A,{connection:e,proxyPools:H,isOAuth:tm,isFirst:0===t,isLast:t===U.length-1,onMoveUp:()=>tZ(t,t-1),onMoveDown:()=>tZ(t,t+1),onToggleActive:t=>tq(e.id,t),autoPing:B[z]&&"oauth"===e.authType?{on:!0===eR.connections[e.id],onToggle:t=>{var s;return s=e.id,void tD({...eR,connections:{...eR.connections,[s]:t}})},provider:z}: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&&L(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:()=>tK(e.id),oneByOneStatus:e6[e.id]||null})})]},e.id)})}),tQ=H.filter(e=>!0===e.isActive),tX=(0,a.jsx)(S.lG,{open:eu,onOpenChange:e=>{!e&&(ez||eh(!1))},children:(0,a.jsxs)(S.Cf,{className:"max-w-md",children:[(0,a.jsx)(S.c7,{children:(0,a.jsxs)(S.L3,{children:["Apply Proxy (",U.length," connections)"]})}),(0,a.jsxs)("div",{className:"flex flex-col gap-2 p-4",children:[(0,a.jsxs)("button",{onClick:()=>{let e=H.filter(e=>!0===e.isActive);return 0===e.length?void alert("No active proxy pools available."):tH(U.map((t,s)=>({connectionId:t.id,proxyPoolId:e[s%e.length].id})))},disabled:ez||0===tQ.length,className:"flex items-center gap-3 rounded-lg border border-border px-3 py-2.5 text-left transition-colors hover:bg-muted disabled:cursor-not-allowed disabled:opacity-50",children:[(0,a.jsx)(A.A,{className:"size-4 shrink-0 text-muted-foreground"}),(0,a.jsxs)("span",{className:"flex min-w-0 flex-col",children:[(0,a.jsx)("span",{className:"text-sm font-medium text-foreground",children:"One-to-one (rotate)"}),(0,a.jsxs)("span",{className:"text-xs text-muted-foreground",children:["Distribute connections across ",tQ.length," active pool(s)"]})]})]}),(0,a.jsxs)("button",{onClick:()=>tV(null),disabled:ez,className:"flex items-center gap-3 rounded-lg border border-border px-3 py-2.5 text-left transition-colors hover:bg-muted disabled:cursor-not-allowed disabled:opacity-50",children:[(0,a.jsx)($.A,{className:"size-4 shrink-0 text-muted-foreground"}),(0,a.jsxs)("span",{className:"flex min-w-0 flex-col",children:[(0,a.jsx)("span",{className:"text-sm font-medium text-foreground",children:"None (unbind all)"}),(0,a.jsx)("span",{className:"text-xs text-muted-foreground",children:"Remove proxy from all connections"})]})]}),H.map(e=>(0,a.jsxs)("button",{onClick:()=>tV(e.id),disabled:ez||!0!==e.isActive,className:"flex items-center gap-3 rounded-lg border border-border px-3 py-2.5 text-left transition-colors hover:bg-muted disabled:cursor-not-allowed disabled:opacity-50",children:[(0,a.jsx)(T.A,{className:"size-4 shrink-0 text-muted-foreground"}),(0,a.jsx)("span",{className:"truncate text-sm font-medium text-foreground",children:e.name}),!0!==e.isActive&&(0,a.jsx)("span",{className:"text-[10px] text-muted-foreground",children:"(inactive)"})]},e.id)),ez&&(0,a.jsx)("p",{className:"text-xs text-muted-foreground",children:"Applying..."})]})]})}),tY=async(e,t="llm")=>{if(!e$.has(e)){eT(t=>new Set(t).add(e));try{let s=await fetch("/api/models/test",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({model:`${tw}/${e}`,kind:t})}),a=await s.json();eC(t=>({...t,[e]:a.ok?"ok":"error"})),eA(a.ok?"":a.error||"Model not reachable")}catch{eC(t=>({...t,[e]:"error"})),eA("Network error")}finally{eT(t=>{let s=new Set(t);return s.delete(e),s})}}};if(R)return(0,a.jsxs)(m.YW,{children:[(0,a.jsx)(m.KX,{}),(0,a.jsx)(m.KX,{})]});if(!td)return(0,a.jsxs)("div",{className:"text-center py-20",children:[(0,a.jsx)("p",{className:"text-muted-foreground",children:"Provider not found"}),(0,a.jsx)(o(),{href:"/dashboard/providers",className:"text-primary mt-4 inline-block",children:"Back to Providers"})]});let t0=()=>{if(tj){let e=(0,c.HY)((0,c.uM)(G?.baseUrl));return e||(ty?"/providers/anthropic.png":"/providers/openai.png")}return(0,c.HY)(td.id)};return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)(m.YW,{children:[(0,a.jsxs)("div",{className:"min-w-0",children:[(0,a.jsx)(x.$,{variant:"outline",size:"sm",asChild:!0,className:"mb-4",children:(0,a.jsxs)(o(),{href:"/dashboard/providers",children:[(0,a.jsx)(l.default,{name:"arrow_back",className:"text-lg"}),"Back to Providers"]})}),(0,a.jsxs)("div",{className:"flex min-w-0 items-center gap-3 sm:gap-4",children:[(0,a.jsx)("div",{className:"flex size-12 shrink-0 items-center justify-center rounded-lg",style:{backgroundColor:`${td.color}15`},children:eN||!t0()?(0,a.jsx)("span",{className:"text-sm font-bold",style:{color:td.color},children:(0,c.IM)(td.name)||td.textIcon||td.id.slice(0,2).toUpperCase()}):(0,a.jsx)(d.default,{src:t0(),alt:td.name,width:48,height:48,className:"max-h-12 max-w-12 rounded-lg object-contain",sizes:"48px",onError:()=>{(0,c.Kw)(td.id),ew(!0)},loading:"lazy",decoding:"async"})}),(0,a.jsxs)("div",{className:"min-w-0",children:[(0,a.jsxs)("div",{className:"flex items-center gap-3 flex-wrap",children:[(0,a.jsx)("h1",{className:"truncate text-2xl font-semibold tracking-tight sm:text-3xl",children:td.name}),(td.notice?.apiKeyUrl||td.notice?.signupUrl||td.website)&&(0,a.jsxs)("a",{href:td.notice?.apiKeyUrl||td.notice?.signupUrl||td.website,target:"_blank",rel:"noopener noreferrer",className:"text-xs text-primary hover:underline inline-flex items-center gap-1",children:[(0,a.jsx)(l.default,{name:"open_in_new",className:"text-sm"}),td.notice?.apiKeyUrl?"Get API Key":"Sign up / Learn more"]})]}),(0,a.jsxs)("p",{className:"text-muted-foreground",children:[U.length," connection",1===U.length?"":"s"]})]})]})]}),td.deprecated&&(0,a.jsxs)("div",{className:"flex items-center gap-2 px-3 py-2 rounded-lg bg-yellow-500/10 border border-yellow-500/30",children:[(0,a.jsx)(l.default,{name:"warning",className:"text-[16px] text-yellow-500 mt-0.5 shrink-0"}),(0,a.jsx)("p",{className:"text-xs text-red-600 dark:text-yellow-400 leading-relaxed",children:td.deprecationNotice})]}),td.notice?.text&&!td.deprecated&&(0,a.jsxs)("div",{className:"flex flex-col gap-2 rounded-lg border border-blue-500/30 bg-blue-500/10 px-3 py-2 sm:flex-row sm:items-center",children:[(0,a.jsx)(l.default,{name:"info",className:"text-[16px] text-blue-500 shrink-0"}),(0,a.jsx)("p",{className:"min-w-0 flex-1 text-xs leading-relaxed text-blue-600 dark:text-blue-400",children:td.notice.text}),td.notice.apiKeyUrl&&(0,a.jsx)("a",{href:td.notice.apiKeyUrl,target:"_blank",rel:"noopener noreferrer",className:"inline-flex justify-center rounded bg-blue-500 px-2 py-1 text-xs font-medium text-white transition-colors hover:bg-blue-600 sm:py-0.5",children:"Get API Key →"})]}),tj&&G&&(0,a.jsx)(p.Zp,{children:(0,a.jsx)(p.Wu,{children:(0,a.jsxs)("div",{className:"mb-4 flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between",children:[(0,a.jsxs)("div",{className:"min-w-0",children:[(0,a.jsx)("h2",{className:"text-lg font-semibold",children:ty?"Anthropic Compatible Details":"OpenAI Compatible Details"}),(0,a.jsxs)("p",{className:"break-all text-sm text-muted-foreground",children:[ty?"Messages API":"responses"===G.apiType?"Responses API":"Chat Completions"," ","\xb7 ",(G.baseUrl||"").replace(/\/$/,""),"/",ty?"messages":"responses"===G.apiType?"responses":"chat/completions"]})]}),(0,a.jsxs)("div",{className:"grid grid-cols-1 gap-2 sm:flex sm:items-center",children:[(0,a.jsxs)(x.$,{size:"sm",onClick:()=>{er(""),ea(!0)},className:"w-full sm:w-auto",children:[(0,a.jsx)(l.default,{name:"add"}),"Add API Key"]}),(0,a.jsxs)(x.$,{size:"sm",variant:"secondary",onClick:()=>ex(!0),className:"w-full sm:w-auto",children:[(0,a.jsx)(l.default,{name:"edit"}),"Edit"]}),(0,a.jsxs)(x.$,{size:"sm",variant:"secondary",onClick:async()=>{eY({title:"Delete Compatible Node",message:`Delete this ${ty?"Anthropic":"OpenAI"} Compatible node?`,onConfirm:async()=>{eY(null);try{(await fetch(`/api/provider-nodes/${z}`,{method:"DELETE"})).ok&&I.push("/dashboard/providers")}catch(e){console.log("Error deleting provider node:",e)}}})},className:"w-full sm:w-auto",children:[(0,a.jsx)(l.default,{name:"delete"}),"Delete"]})]})]})})}),tx?(0,a.jsx)(m.gw,{providerId:z}):(0,a.jsx)(p.Zp,{children:(0,a.jsxs)(p.Wu,{children:[(0,a.jsxs)("div",{className:"mb-4 flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[(0,a.jsx)("h2",{className:"text-lg font-semibold",children:"Connections"}),(0,a.jsxs)("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:gap-4",children:[U.length>0&&H.length>0&&(0,a.jsxs)(x.$,{size:"sm",variant:"secondary",onClick:()=>eh(!0),children:[(0,a.jsx)(l.default,{name:"lan"}),"Apply Proxy"]}),U.length>0&&(0,a.jsxs)(a.Fragment,{children:[eE.length>0&&(0,a.jsxs)(x.$,{size:"sm",variant:"destructive",onClick:()=>{let e=eE.length;0!==e&&eY({title:`Delete ${e} Connection${e>1?"s":""}`,message:`Delete ${e} connection${e>1?"s":""}? This cannot be undone.`,onConfirm:async()=>{eY(null);let e=0,t=[...eE];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}L(e=>e.filter(e=>!t.includes(e.id))),eI([]),e>0&&alert(`Deleted ${t.length-e} connection(s), ${e} failed.`)}})},children:[(0,a.jsx)(l.default,{name:"delete"}),"Delete Selected (",eE.length,")"]}),(0,a.jsxs)(x.$,{size:"sm",variant:"secondary",onClick:e9,disabled:e2,children:[(0,a.jsx)(l.default,{name:"sync"}),e2?"Testing Connection One-by-One...":"Test Connection One-by-One"]}),e2&&(0,a.jsxs)(x.$,{size:"sm",variant:"ghost",onClick:e8,disabled:e4,children:[(0,a.jsx)(l.default,{name:"stop"}),e4?"Stopping...":"Stop"]})]}),(0,a.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,a.jsx)("span",{className:"text-xs text-muted-foreground font-medium",children:"Round Robin"}),(0,a.jsx)(k.d,{checked:"round-robin"===e_,onCheckedChange:e=>{let t=e?"round-robin":null,s=e?eJ||"1":eJ;e&&!eJ&&eL("1"),eU(t),tz(t,s)}}),"round-robin"===e_&&(0,a.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,a.jsx)("span",{className:"text-xs text-muted-foreground",children:"Sticky:"}),(0,a.jsx)("input",{type:"number",min:1,value:eJ,onChange:e=>{var t;eL(t=e.target.value),tz("round-robin",t)},placeholder:"1",className:"w-14 px-2 py-1 text-xs border border-border rounded-md bg-background focus:outline-none focus:border-primary"})]})]})]})]}),0===U.length?(0,a.jsxs)("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[(0,a.jsx)("div",{className:"inline-flex items-center justify-center w-9 h-9 rounded-full bg-primary/10 text-primary shrink-0",children:(0,a.jsx)(l.default,{name:tm?"lock":"key",className:"text-[18px]"})}),(0,a.jsxs)("div",{className:"min-w-0",children:[(0,a.jsx)("p",{className:"text-sm text-muted-foreground",children:"No connections yet"}),tb&&(0,a.jsxs)("p",{className:"text-xs text-muted-foreground",children:["Choose ",tv," or ",tN,"."]})]})]}),(0,a.jsx)("div",{className:"flex gap-2",children:tb?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)(x.$,{size:"sm",variant:"secondary",onClick:tn,children:[(0,a.jsx)(l.default,{name:"lock"}),tv]}),(0,a.jsxs)(x.$,{size:"sm",onClick:ti,children:[(0,a.jsx)(l.default,{name:"key"}),tN]})]}):(0,a.jsxs)(a.Fragment,{children:[!tj&&"iflow"===z&&(0,a.jsxs)(x.$,{size:"sm",variant:"secondary",onClick:()=>et(!0),children:[(0,a.jsx)(l.default,{name:"cookie"}),"Cookie"]}),"codex"===z&&(0,a.jsxs)(x.$,{size:"sm",variant:"secondary",onClick:()=>ei(!0),children:[(0,a.jsx)(l.default,{name:"playlist_add"}),(0,y.Tl)("Bulk Add")]}),"grok-cli"===z&&(0,a.jsxs)(x.$,{size:"sm",variant:"secondary",onClick:()=>ed(!0),children:[(0,a.jsx)(l.default,{name:"playlist_add"}),(0,y.Tl)("Bulk Add")]}),(0,a.jsxs)(x.$,{size:"sm",onClick:to,children:[(0,a.jsx)(l.default,{name:"add"}),tj?"Add API Key":"iflow"===z?"OAuth":"Add Connection"]})]})})]}):(0,a.jsxs)(a.Fragment,{children:[e7&&(0,a.jsx)("div",{className:"mb-4 rounded-lg border border-black/10 bg-black/[0.02] px-3 py-2 text-xs text-muted-foreground dark:border-white/10 dark:bg-white/[0.03]",children:(0,a.jsxs)("div",{className:"flex flex-wrap items-center gap-3",children:[(0,a.jsxs)("span",{children:["Total: ",e7.total]}),(0,a.jsxs)("span",{children:["Completed: ",e7.completed]}),(0,a.jsxs)("span",{children:["Passed: ",e7.passed]}),(0,a.jsxs)("span",{children:["Failed: ",e7.failed]}),e7.stopped&&(0,a.jsx)("span",{className:"text-amber-600 dark:text-amber-400",children:"Stopped"}),e2&&e3&&(0,a.jsxs)("span",{children:["Running:"," ",U.find(e=>e.id===e3)?.name||e3]})]})}),U.length>0&&(0,a.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,a.jsxs)("label",{className:"flex cursor-pointer items-center gap-1.5 text-xs text-muted-foreground hover:text-primary",children:[(0,a.jsx)(C.S,{checked:tB,onCheckedChange:()=>{tB?eI([]):eI(U.map(e=>e.id))},className:"size-3.5 [&_svg]:size-2.5"}),"Select All"]})}),tW,!tj&&(0,a.jsxs)("div",{className:"mt-4 grid grid-cols-1 gap-2 sm:flex",children:["iflow"===z&&(0,a.jsxs)(N.m_,{children:[(0,a.jsx)(N.k$,{asChild:!0,children:(0,a.jsxs)(x.$,{size:"sm",variant:"secondary",onClick:()=>et(!0),className:"w-full sm:w-auto",children:[(0,a.jsx)(l.default,{name:"cookie"}),"Cookie"]})}),(0,a.jsx)(N.ZI,{children:"Add connection using browser cookie"})]}),"codex"===z&&(0,a.jsxs)(N.m_,{children:[(0,a.jsx)(N.k$,{asChild:!0,children:(0,a.jsxs)(x.$,{size:"sm",variant:"secondary",onClick:()=>ei(!0),className:"w-full sm:w-auto",children:[(0,a.jsx)(l.default,{name:"playlist_add"}),(0,y.Tl)("Bulk Add")]})}),(0,a.jsx)(N.ZI,{children:(0,y.Tl)("Bulk import codex accounts from JSON")})]}),"grok-cli"===z&&(0,a.jsxs)(N.m_,{children:[(0,a.jsx)(N.k$,{asChild:!0,children:(0,a.jsxs)(x.$,{size:"sm",variant:"secondary",onClick:()=>ed(!0),className:"w-full sm:w-auto",children:[(0,a.jsx)(l.default,{name:"playlist_add"}),(0,y.Tl)("Bulk Add")]})}),(0,a.jsx)(N.ZI,{children:(0,y.Tl)("Bulk import Grok CLI accounts from JSON")})]}),tb?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)(x.$,{size:"sm",variant:"secondary",onClick:tn,className:"w-full sm:w-auto",children:[(0,a.jsx)(l.default,{name:"lock"}),tv]}),(0,a.jsxs)(x.$,{size:"sm",onClick:ti,className:"w-full sm:w-auto",children:[(0,a.jsx)(l.default,{name:"key"}),tN]})]}):(0,a.jsxs)(x.$,{size:"sm",onClick:to,className:"w-full sm:w-auto",children:[(0,a.jsx)(l.default,{name:"add"}),"Add"]})]})]})]})}),(0,a.jsx)(p.Zp,{children:(0,a.jsxs)(p.Wu,{children:[(0,a.jsxs)("div",{className:"mb-4 flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between",children:[(0,a.jsx)("div",{className:"flex items-center gap-3",children:(0,a.jsx)("h2",{className:"text-lg font-semibold",children:"Available Models"})}),!tj&&(e=[...th,...eH.filter(e=>!th.some(t=>t.id===e.id))].filter(e=>{let t=(0,h.CP)(e);return!t||"llm"===t}).map(e=>e.id).filter(e=>!eW.includes(e)),(0,a.jsxs)("div",{className:"flex gap-2",children:[eW.length>0&&(0,a.jsxs)(x.$,{size:"sm",variant:"secondary",onClick:tT,children:[(0,a.jsx)(l.default,{name:"restart_alt"}),"Active All"]}),e.length>0&&(0,a.jsxs)(x.$,{size:"sm",variant:"secondary",onClick:()=>t$(e),children:[(0,a.jsx)(l.default,{name:"block"}),"Disable All"]})]}))]}),!!eS&&(0,a.jsxs)("div",{className:"mb-3",children:[(0,a.jsx)("p",{className:"text-xs text-red-500 break-words",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"')]+/),i=t.match(/wrk_[0-9A-Za-z]+/),j=s?s[0].endsWith("/go")?s[0]:`${s[0]}/go`:i?`https://opencode.ai/workspace/${i[0]}/go`:"https://opencode.ai",(0,a.jsx)("div",{className:"mt-1.5",children:(0,a.jsxs)("a",{href:j,target:"_blank",rel:"noreferrer",className:"inline-flex items-center gap-1 rounded-md bg-amber-500/10 px-2 py-0.5 text-xs font-medium text-amber-600 hover:bg-amber-500/20 dark:text-amber-400 transition-colors",children:[(0,a.jsx)("span",{children:"Allow China-hosted models"}),(0,a.jsx)(l.default,{name:"open_in_new",className:"text-[13px]"})]})}))]}),"zed"===z&&!!eZ&&(0,a.jsx)("p",{className:"text-xs text-red-500 mb-3 break-words",children:eZ}),(()=>{let e,t,s;if(tj)return(0,a.jsx)(P,{providerStorageAlias:tw,providerDisplayAlias:tk,modelAliases:ey,customModels:eb,copied:ts,onCopy:ta,onSetAlias:t_,onDeleteAlias:tU,onAddCustomModel:e=>tJ(e,"llm",tw),onDeleteCustomModel:e=>tL(e,"llm",tw),connections:U,isAnthropic:ty});let r=[...th,...eH.filter(e=>!th.some(t=>t.id===e.id))].filter(e=>{let t=(0,h.CP)(e);return!t||"llm"===t}),n=new Set(eW),i=r.filter(e=>!n.has(e.id)),o=r.filter(e=>n.has(e.id)),d=v({customModels:eb,modelAliases:ey,providerAlias:tw,builtInModels:th,type:"llm"});return(0,a.jsxs)("div",{className:"flex flex-wrap gap-3",children:[d.map(e=>(0,a.jsx)(w,{model:{id:e.id,name:e.name},fullModel:`${tk}/${e.id}`,alias:e.alias,copied:ts,onCopy:ta,onSetAlias:()=>{},onDeleteAlias:()=>{"custom"===e.source?tL(e.id,"llm",tw):tU(e.alias)},testStatus:ek[e.id],onTest:U.length>0||tx?()=>tY(e.id,(0,h.CP)(e,"llm")):void 0,isTesting:e$.has(e.id),isCustom:!0,isFree:!1,caps:D(`${z}/${e.id}`)},`${e.source}-${e.fullModel}`)),i.map(e=>{let t=`${tw}/${e.id}`,s=`${z}/${e.id}`,l=Object.entries(ey).find(([,e])=>e===t||e===s)?.[0];return(0,a.jsx)(w,{model:e,fullModel:`${tk}/${e.id}`,alias:l,copied:ts,onCopy:ta,onSetAlias:t=>t_(e.id,t,tw),onDeleteAlias:()=>tU(l),testStatus:ek[e.id],onTest:U.length>0||tx?()=>tY(e.id,(0,h.CP)(e,"llm")):void 0,isTesting:e$.has(e.id),isFree:e.isFree,onDisable:()=>tS(e.id),caps:D(`${z}/${e.id}`)},e.id)}),(0,a.jsxs)("button",{onClick:()=>eP(!0),className:"flex w-full items-center justify-center gap-1.5 rounded-lg border border-dashed border-primary/40 px-3 py-2 text-xs text-primary transition-colors hover:border-primary hover:bg-primary/5 sm:w-auto",children:[(0,a.jsx)(l.default,{name:"add",className:"text-sm"}),"Add Model"]}),"qoder"===z&&U.some(e=>!1!==e.isActive)&&(0,a.jsxs)("button",{onClick:tR,disabled:te,className:"flex w-full items-center justify-center gap-1.5 rounded-lg border border-dashed border-blue-500/40 px-3 py-2 text-xs text-blue-600 dark:text-blue-400 transition-colors hover:border-blue-500 hover:bg-blue-500/5 sm:w-auto disabled:opacity-50 disabled:cursor-not-allowed",children:[(0,a.jsx)(l.default,{name:te?"progress_activity":"download",className:"text-sm",style:te?{animation:"spin 1s linear infinite"}:void 0}),te?(0,y.Tl)("Fetching..."):(0,y.Tl)("Fetch Qoder Models")]}),eF.length>0&&(e=new Set([...Object.values(ey),...d.map(e=>e.fullModel)]),t=new Set(th.map(e=>e.id)),0===(s=eF.filter(s=>!e.has(`${tw}/${s.id}`)&&!t.has(s.id))).length?null:(0,a.jsxs)("div",{className:"w-full mt-2",children:[(0,a.jsx)("p",{className:"text-xs text-muted-foreground mb-2",children:"Suggested free models (≥200k context):"}),(0,a.jsx)("div",{className:"flex flex-wrap gap-2",children:s.map(e=>(0,a.jsxs)(N.m_,{children:[(0,a.jsx)(N.k$,{asChild:!0,children:(0,a.jsxs)("button",{onClick:async()=>{await tJ(e.id,"llm",tw)},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-muted-foreground hover:text-primary hover:border-primary/40 hover:bg-primary/5 transition-colors",children:[(0,a.jsx)(l.default,{name:"add",className:"text-[13px]"}),e.id.split("/").pop()]})}),(0,a.jsx)(N.ZI,{children:`${e.name} \xb7 ${(e.contextLength/1e3).toFixed(0)}k ctx`})]},e.id))})]})),o.length>0&&(0,a.jsxs)("div",{className:"w-full mt-2",children:[(0,a.jsxs)("p",{className:"text-xs text-muted-foreground mb-2",children:["Disabled models (",o.length,"):"]}),(0,a.jsx)("div",{className:"flex flex-wrap gap-2",children:o.map(e=>(0,a.jsxs)(N.m_,{children:[(0,a.jsx)(N.k$,{asChild:!0,children:(0,a.jsxs)("button",{onClick:()=>tA(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-muted-foreground hover:text-primary hover:border-primary/40 hover:bg-primary/5 transition-colors",children:[(0,a.jsx)(l.default,{name:"add",className:"text-[13px]"}),e.id]})}),(0,a.jsx)(N.ZI,{children:"Restore model"})]},e.id))})]})]})})()]})}),tX,"cursor"===z?(0,a.jsx)(m.G9,{isOpen:W,onSuccess:tF,onClose:()=>Q(!1)}):"gitlab"===z?(0,a.jsx)(m.vj,{isOpen:W,providerInfo:td,onSuccess:tF,onClose:()=>Q(!1)}):(0,a.jsx)(m.LF,{isOpen:W,provider:z,providerInfo:td,onSuccess:tF,onClose:()=>Q(!1)}),(0,a.jsx)(m.LH,{isOpen:X,onSuccess:tF,onClose:()=>Y(!1)}),"iflow"===z&&(0,a.jsx)(m.vE,{isOpen:ee,onSuccess:()=>{tE(),et(!1)},onClose:()=>et(!1)})]}),(0,a.jsx)(_,{isOpen:es,provider:z,providerName:td.name,authType:td?.authType,authHint:td?.authHint,website:td?.website,proxyPools:H,error:el,onSave:tM,onClose:()=>{er(""),ea(!1)}}),(0,a.jsx)(m.wI,{isOpen:ec,connection:ef,proxyPools:H,onSave:tG,onClose:()=>em(!1)}),tj&&(0,a.jsx)(J,{isOpen:ep,node:G,onSave:tI,onClose:()=>ex(!1),isAnthropic:ty}),!tj&&(0,a.jsx)(K,{isOpen:eO,providerAlias:tw,providerDisplayAlias:tk,onSave:async(e,t)=>{await tJ(e,"llm",tw,t),eP(!1)},onClose:()=>eP(!1)}),"codex"===z&&(0,a.jsx)(M,{isOpen:en,onClose:()=>ei(!1),onSuccess:tE}),"grok-cli"===z&&(0,a.jsx)(Z,{isOpen:eo,onClose:()=>ed(!1),onSuccess:tE}),(0,a.jsx)(m.uo,{isOpen:e0,onClose:()=>e1(!1),onConfirm:()=>{(window.localStorage.setItem(tl,"true"),e1(!1),tm)?tr():ti()},title:"Risk Notice",message:td?.deprecationNotice,confirmText:"I Understand, Continue",cancelText:"Cancel",variant:"danger"}),(0,a.jsx)(m.uo,{isOpen:!!eX,onClose:()=>eY(null),onConfirm:eX?.onConfirm,title:eX?.title||"Confirm",message:eX?.message,variant:"danger"})]})}}},e=>{e.O(0,[6766,5166,7552,9980,6428,4484,9150,3577,5862,5148,1699,1722,1660,4489,1278,1830,6770,9369,427,9966,7358],()=>e(e.s=52908)),_N_E=e.O()}]);
|