@jheavenknows/bluerouter 1.0.117 → 1.0.119
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/app/.next-cli-build/BUILD_ID +1 -1
- package/app/.next-cli-build/app-path-routes-manifest.json +3 -3
- package/app/.next-cli-build/build-manifest.json +2 -2
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/api-keys/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/basic-chat/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/[toolId]/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/[toolId]/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/combos/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/console-log/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/endpoint/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/endpoint/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/[kind]/[id]/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/[kind]/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/combo/[id]/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/web/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/mitm/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/profile/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/prompt-logs/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/provider-health/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/[id]/page.js +2 -2
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/[id]/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/new/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/proxy-pools/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/quota/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/skills/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/translator/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/usage/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/_global-error/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/_global-error.html +1 -1
- package/app/.next-cli-build/server/app/_global-error.rsc +1 -1
- package/app/.next-cli-build/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/_global-error.segments/_global-error.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/_global-error.segments/_head.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/_global-error.segments/_index.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/_not-found.html +1 -1
- package/app/.next-cli-build/server/app/_not-found.rsc +4 -4
- package/app/.next-cli-build/server/app/_not-found.segments/_full.segment.rsc +4 -4
- package/app/.next-cli-build/server/app/_not-found.segments/_head.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/_not-found.segments/_index.segment.rsc +4 -4
- package/app/.next-cli-build/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/_not-found.segments/_tree.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/api/auth/ldap/test/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/auth/ldap/users/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/auth/login/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/auth/logout/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/auth/oidc/callback/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/auth/oidc/start/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/auth/oidc/test/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/auth/status/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/all-statuses/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/antigravity-mitm/alias/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/antigravity-mitm/autostart/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/antigravity-mitm/prompt-log-db/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/antigravity-mitm/root-ca/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/antigravity-mitm/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/copilot-settings/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/cowork-settings/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/combos/[id]/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/combos/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/dashboard/prompt-logs/[id]/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/dashboard/prompt-logs/options/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/dashboard/prompt-logs/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/keys/[id]/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/keys/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/mcp/[plugin]/message/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/mcp/[plugin]/sse/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/media-providers/tts/deepgram/voices/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/media-providers/tts/elevenlabs/voices/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/media-providers/tts/inworld/voices/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/media-providers/tts/minimax/voices/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/models/alias/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/models/availability/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/models/custom/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/models/disabled/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/models/route.js +1 -1
- package/app/.next-cli-build/server/app/api/models/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/models/test/route.js +1 -1
- package/app/.next-cli-build/server/app/api/models/test/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/oauth/[provider]/[action]/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/oauth/codex/import-token/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/oauth/cursor/auto-import/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/oauth/cursor/import/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/oauth/gitlab/pat/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/oauth/iflow/cookie/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/oauth/kiro/import/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/oauth/kiro/social-exchange/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/pricing/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/provider-health/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/provider-nodes/[id]/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/provider-nodes/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/providers/[id]/models/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/providers/[id]/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/providers/[id]/test/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/providers/[id]/test-models/route.js +1 -1
- package/app/.next-cli-build/server/app/api/providers/[id]/test-models/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/providers/client/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/providers/route.js +1 -1
- package/app/.next-cli-build/server/app/api/providers/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/providers/test-batch/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/providers/validate/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/proxy-pools/[id]/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/proxy-pools/[id]/test/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/proxy-pools/cloudflare-deploy/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/proxy-pools/deno-deploy/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/proxy-pools/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/proxy-pools/vercel-deploy/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/settings/database/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/settings/require-login/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/settings/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/translator/console-logs/route.js +1 -1
- package/app/.next-cli-build/server/app/api/translator/console-logs/stream/route.js +1 -1
- package/app/.next-cli-build/server/app/api/translator/send/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/translator/translate/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/tunnel/disable/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/tunnel/enable/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/tunnel/status/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/tunnel/tailscale-check/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/tunnel/tailscale-disable/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/tunnel/tailscale-enable/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/tunnel/tailscale-install/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/tunnel/tailscale-login/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/tunnel/tailscale-start-daemon/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/usage/[connectionId]/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/usage/chart/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/usage/history/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/usage/providers/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/usage/request-details/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/usage/request-logs/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/usage/stats/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/usage/stream/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/v1/api/chat/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/v1/audio/speech/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/v1/audio/transcriptions/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/v1/chat/completions/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/v1/embeddings/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/v1/images/generations/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/v1/messages/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/v1/models/[kind]/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/v1/models/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/v1/responses/compact/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/v1/responses/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/v1/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/v1/search/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/v1/web/fetch/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/v1beta/models/[...path]/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/v1beta/models/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/version/route.js +1 -1
- package/app/.next-cli-build/server/app/api/version/shutdown/route.js +1 -1
- package/app/.next-cli-build/server/app/api/version/shutdown/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/version/update/route.js +1 -1
- package/app/.next-cli-build/server/app/api/version/update/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/callback/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/callback.html +1 -1
- package/app/.next-cli-build/server/app/callback.rsc +4 -4
- package/app/.next-cli-build/server/app/callback.segments/_full.segment.rsc +4 -4
- package/app/.next-cli-build/server/app/callback.segments/_head.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/callback.segments/_index.segment.rsc +4 -4
- package/app/.next-cli-build/server/app/callback.segments/_tree.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/callback.segments/callback/__PAGE__.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/callback.segments/callback.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/api-keys.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/api-keys.rsc +6 -6
- package/app/.next-cli-build/server/app/dashboard/api-keys.segments/!KGRhc2hib2FyZCk/dashboard/api-keys/__PAGE__.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/api-keys.segments/!KGRhc2hib2FyZCk/dashboard/api-keys.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/api-keys.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/api-keys.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/api-keys.segments/_full.segment.rsc +6 -6
- package/app/.next-cli-build/server/app/dashboard/api-keys.segments/_head.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/api-keys.segments/_index.segment.rsc +4 -4
- package/app/.next-cli-build/server/app/dashboard/api-keys.segments/_tree.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/basic-chat.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/basic-chat.rsc +6 -6
- package/app/.next-cli-build/server/app/dashboard/basic-chat.segments/!KGRhc2hib2FyZCk/dashboard/basic-chat/__PAGE__.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/basic-chat.segments/!KGRhc2hib2FyZCk/dashboard/basic-chat.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/basic-chat.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/basic-chat.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/basic-chat.segments/_full.segment.rsc +6 -6
- package/app/.next-cli-build/server/app/dashboard/basic-chat.segments/_head.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/basic-chat.segments/_index.segment.rsc +4 -4
- package/app/.next-cli-build/server/app/dashboard/basic-chat.segments/_tree.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/cli-tools.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/cli-tools.rsc +6 -6
- package/app/.next-cli-build/server/app/dashboard/cli-tools.segments/!KGRhc2hib2FyZCk/dashboard/cli-tools/__PAGE__.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/cli-tools.segments/!KGRhc2hib2FyZCk/dashboard/cli-tools.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/cli-tools.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/cli-tools.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/cli-tools.segments/_full.segment.rsc +6 -6
- package/app/.next-cli-build/server/app/dashboard/cli-tools.segments/_head.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/cli-tools.segments/_index.segment.rsc +4 -4
- package/app/.next-cli-build/server/app/dashboard/cli-tools.segments/_tree.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/combos.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/combos.rsc +6 -6
- package/app/.next-cli-build/server/app/dashboard/combos.segments/!KGRhc2hib2FyZCk/dashboard/combos/__PAGE__.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/combos.segments/!KGRhc2hib2FyZCk/dashboard/combos.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/combos.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/combos.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/combos.segments/_full.segment.rsc +6 -6
- package/app/.next-cli-build/server/app/dashboard/combos.segments/_head.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/combos.segments/_index.segment.rsc +4 -4
- package/app/.next-cli-build/server/app/dashboard/combos.segments/_tree.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/endpoint.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/endpoint.rsc +7 -7
- package/app/.next-cli-build/server/app/dashboard/endpoint.segments/!KGRhc2hib2FyZCk/dashboard/endpoint/__PAGE__.segment.rsc +3 -3
- package/app/.next-cli-build/server/app/dashboard/endpoint.segments/!KGRhc2hib2FyZCk/dashboard/endpoint.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/endpoint.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/endpoint.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/endpoint.segments/_full.segment.rsc +7 -7
- package/app/.next-cli-build/server/app/dashboard/endpoint.segments/_head.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/endpoint.segments/_index.segment.rsc +4 -4
- package/app/.next-cli-build/server/app/dashboard/endpoint.segments/_tree.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/media-providers/web.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/media-providers/web.rsc +6 -6
- package/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/!KGRhc2hib2FyZCk/dashboard/media-providers/web/__PAGE__.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/!KGRhc2hib2FyZCk/dashboard/media-providers/web.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/!KGRhc2hib2FyZCk/dashboard/media-providers.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/_full.segment.rsc +6 -6
- package/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/_head.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/_index.segment.rsc +4 -4
- package/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/_tree.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/mitm.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/mitm.rsc +6 -6
- package/app/.next-cli-build/server/app/dashboard/mitm.segments/!KGRhc2hib2FyZCk/dashboard/mitm/__PAGE__.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/mitm.segments/!KGRhc2hib2FyZCk/dashboard/mitm.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/mitm.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/mitm.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/mitm.segments/_full.segment.rsc +6 -6
- package/app/.next-cli-build/server/app/dashboard/mitm.segments/_head.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/mitm.segments/_index.segment.rsc +4 -4
- package/app/.next-cli-build/server/app/dashboard/mitm.segments/_tree.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/profile.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/profile.rsc +5 -5
- package/app/.next-cli-build/server/app/dashboard/profile.segments/!KGRhc2hib2FyZCk/dashboard/profile/__PAGE__.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/profile.segments/!KGRhc2hib2FyZCk/dashboard/profile.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/profile.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/profile.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/profile.segments/_full.segment.rsc +5 -5
- package/app/.next-cli-build/server/app/dashboard/profile.segments/_head.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/profile.segments/_index.segment.rsc +4 -4
- package/app/.next-cli-build/server/app/dashboard/profile.segments/_tree.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/prompt-logs.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/prompt-logs.rsc +5 -5
- package/app/.next-cli-build/server/app/dashboard/prompt-logs.segments/!KGRhc2hib2FyZCk/dashboard/prompt-logs/__PAGE__.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/prompt-logs.segments/!KGRhc2hib2FyZCk/dashboard/prompt-logs.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/prompt-logs.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/prompt-logs.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/prompt-logs.segments/_full.segment.rsc +5 -5
- package/app/.next-cli-build/server/app/dashboard/prompt-logs.segments/_head.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/prompt-logs.segments/_index.segment.rsc +4 -4
- package/app/.next-cli-build/server/app/dashboard/prompt-logs.segments/_tree.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/provider-health.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/provider-health.rsc +5 -5
- package/app/.next-cli-build/server/app/dashboard/provider-health.segments/!KGRhc2hib2FyZCk/dashboard/provider-health/__PAGE__.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/provider-health.segments/!KGRhc2hib2FyZCk/dashboard/provider-health.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/provider-health.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/provider-health.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/provider-health.segments/_full.segment.rsc +5 -5
- package/app/.next-cli-build/server/app/dashboard/provider-health.segments/_head.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/provider-health.segments/_index.segment.rsc +4 -4
- package/app/.next-cli-build/server/app/dashboard/provider-health.segments/_tree.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/providers/new.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/providers/new.rsc +6 -6
- package/app/.next-cli-build/server/app/dashboard/providers/new.segments/!KGRhc2hib2FyZCk/dashboard/providers/new/__PAGE__.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/providers/new.segments/!KGRhc2hib2FyZCk/dashboard/providers/new.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/providers/new.segments/!KGRhc2hib2FyZCk/dashboard/providers.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/providers/new.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/providers/new.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/providers/new.segments/_full.segment.rsc +6 -6
- package/app/.next-cli-build/server/app/dashboard/providers/new.segments/_head.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/providers/new.segments/_index.segment.rsc +4 -4
- package/app/.next-cli-build/server/app/dashboard/providers/new.segments/_tree.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/providers.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/providers.rsc +6 -6
- package/app/.next-cli-build/server/app/dashboard/providers.segments/!KGRhc2hib2FyZCk/dashboard/providers/__PAGE__.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/providers.segments/!KGRhc2hib2FyZCk/dashboard/providers.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/providers.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/providers.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/providers.segments/_full.segment.rsc +6 -6
- package/app/.next-cli-build/server/app/dashboard/providers.segments/_head.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/providers.segments/_index.segment.rsc +4 -4
- package/app/.next-cli-build/server/app/dashboard/providers.segments/_tree.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/proxy-pools.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/proxy-pools.rsc +6 -6
- package/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/!KGRhc2hib2FyZCk/dashboard/proxy-pools/__PAGE__.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/!KGRhc2hib2FyZCk/dashboard/proxy-pools.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/_full.segment.rsc +6 -6
- package/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/_head.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/_index.segment.rsc +4 -4
- package/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/_tree.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/quota.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/quota.rsc +7 -7
- package/app/.next-cli-build/server/app/dashboard/quota.segments/!KGRhc2hib2FyZCk/dashboard/quota/__PAGE__.segment.rsc +3 -3
- package/app/.next-cli-build/server/app/dashboard/quota.segments/!KGRhc2hib2FyZCk/dashboard/quota.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/quota.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/quota.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/quota.segments/_full.segment.rsc +7 -7
- package/app/.next-cli-build/server/app/dashboard/quota.segments/_head.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/quota.segments/_index.segment.rsc +4 -4
- package/app/.next-cli-build/server/app/dashboard/quota.segments/_tree.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/settings/pricing/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/dashboard/settings/pricing.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/settings/pricing.rsc +4 -4
- package/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/_full.segment.rsc +4 -4
- package/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/_head.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/_index.segment.rsc +4 -4
- package/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/_tree.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/dashboard/settings/pricing/__PAGE__.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/dashboard/settings/pricing.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/dashboard/settings.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/dashboard.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/skills.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/skills.rsc +6 -6
- package/app/.next-cli-build/server/app/dashboard/skills.segments/!KGRhc2hib2FyZCk/dashboard/skills/__PAGE__.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/skills.segments/!KGRhc2hib2FyZCk/dashboard/skills.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/skills.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/skills.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/skills.segments/_full.segment.rsc +6 -6
- package/app/.next-cli-build/server/app/dashboard/skills.segments/_head.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/skills.segments/_index.segment.rsc +4 -4
- package/app/.next-cli-build/server/app/dashboard/skills.segments/_tree.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/translator.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/translator.rsc +6 -6
- package/app/.next-cli-build/server/app/dashboard/translator.segments/!KGRhc2hib2FyZCk/dashboard/translator/__PAGE__.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/translator.segments/!KGRhc2hib2FyZCk/dashboard/translator.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/translator.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/translator.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/translator.segments/_full.segment.rsc +6 -6
- package/app/.next-cli-build/server/app/dashboard/translator.segments/_head.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/translator.segments/_index.segment.rsc +4 -4
- package/app/.next-cli-build/server/app/dashboard/translator.segments/_tree.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/usage.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/usage.rsc +6 -6
- package/app/.next-cli-build/server/app/dashboard/usage.segments/!KGRhc2hib2FyZCk/dashboard/usage/__PAGE__.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/usage.segments/!KGRhc2hib2FyZCk/dashboard/usage.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/usage.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/usage.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/usage.segments/_full.segment.rsc +6 -6
- package/app/.next-cli-build/server/app/dashboard/usage.segments/_head.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/usage.segments/_index.segment.rsc +4 -4
- package/app/.next-cli-build/server/app/dashboard/usage.segments/_tree.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard.html +1 -1
- package/app/.next-cli-build/server/app/dashboard.rsc +6 -6
- package/app/.next-cli-build/server/app/dashboard.segments/!KGRhc2hib2FyZCk/dashboard/__PAGE__.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard.segments/_full.segment.rsc +6 -6
- package/app/.next-cli-build/server/app/dashboard.segments/_head.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard.segments/_index.segment.rsc +4 -4
- package/app/.next-cli-build/server/app/dashboard.segments/_tree.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/index.html +1 -1
- package/app/.next-cli-build/server/app/index.rsc +4 -4
- package/app/.next-cli-build/server/app/index.segments/__PAGE__.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/index.segments/_full.segment.rsc +4 -4
- package/app/.next-cli-build/server/app/index.segments/_head.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/index.segments/_index.segment.rsc +4 -4
- package/app/.next-cli-build/server/app/index.segments/_tree.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/landing/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/landing.html +1 -1
- package/app/.next-cli-build/server/app/landing.rsc +4 -4
- package/app/.next-cli-build/server/app/landing.segments/_full.segment.rsc +4 -4
- package/app/.next-cli-build/server/app/landing.segments/_head.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/landing.segments/_index.segment.rsc +4 -4
- package/app/.next-cli-build/server/app/landing.segments/_tree.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/landing.segments/landing/__PAGE__.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/landing.segments/landing.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/login/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/login.html +1 -1
- package/app/.next-cli-build/server/app/login.rsc +4 -4
- package/app/.next-cli-build/server/app/login.segments/_full.segment.rsc +4 -4
- package/app/.next-cli-build/server/app/login.segments/_head.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/login.segments/_index.segment.rsc +4 -4
- package/app/.next-cli-build/server/app/login.segments/_tree.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/login.segments/login/__PAGE__.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/login.segments/login.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app-paths-manifest.json +3 -3
- package/app/.next-cli-build/server/chunks/2496.js +1 -1
- package/app/.next-cli-build/server/chunks/3110.js +1 -1
- package/app/.next-cli-build/server/chunks/4746.js +1 -1
- package/app/.next-cli-build/server/chunks/6604.js +1 -1
- package/app/.next-cli-build/server/chunks/7130.js +1 -1
- package/app/.next-cli-build/server/chunks/7153.js +1 -1
- package/app/.next-cli-build/server/middleware-build-manifest.js +1 -1
- package/app/.next-cli-build/server/pages/404.html +1 -1
- package/app/.next-cli-build/server/pages/500.html +1 -1
- package/app/.next-cli-build/static/chunks/{1321-73a8b866ebb04620.js → 1321-471862e81229a7b9.js} +1 -1
- package/app/.next-cli-build/static/chunks/5497-89c313367ff90255.js +7 -0
- package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/providers/[id]/{page-9bbf81d81bdeb810.js → page-a8ce9e441cbc67b3.js} +2 -2
- package/app/.next-cli-build/static/css/e6e57b3fbfd16fc4.css +1 -0
- package/app/cli/.build-home/AppData/Roaming/bluerouter/db/data.sqlite-shm +0 -0
- package/app/cli/.build-home/AppData/Roaming/bluerouter/db/data.sqlite-wal +0 -0
- package/app/package.json +1 -1
- package/package.json +1 -1
- package/app/.next-cli-build/static/chunks/5497-29482bef7f947c2b.js +0 -7
- package/app/.next-cli-build/static/css/706876854798b6ab.css +0 -1
- /package/app/.next-cli-build/static/{v1W6R8o5ap5BTF0x3a7Xd → Kn6gx-6qm3F1d1lL4KoaP}/_buildManifest.js +0 -0
- /package/app/.next-cli-build/static/{v1W6R8o5ap5BTF0x3a7Xd → Kn6gx-6qm3F1d1lL4KoaP}/_ssgManifest.js +0 -0
- /package/app/cli/.build-home/AppData/Roaming/bluerouter/db/backups/{upgrade-1.0.111-to-1.0.112-1.0.112-20260609-204126 → upgrade-1.0.117-to-1.0.118-1.0.118-20260609-222041}/data.sqlite +0 -0
- /package/app/cli/.build-home/AppData/Roaming/bluerouter/db/backups/{upgrade-1.0.112-to-1.0.113-1.0.113-20260609-204959 → upgrade-1.0.118-to-1.0.119-1.0.119-20260609-224309}/data.sqlite +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
(()=>{var a={};a.id=2134,a.ids=[2134],a.modules={261:a=>{"use strict";a.exports=require("next/dist/shared/lib/router/utils/app-paths")},3295:a=>{"use strict";a.exports=require("next/dist/server/app-render/after-task-async-storage.external.js")},5091:(a,b,c)=>{Promise.resolve().then(c.bind(c,59436))},10846:a=>{"use strict";a.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},17891:a=>{"use strict";a.exports=require("next/dist/shared/lib/router/utils/get-segment-param")},19121:a=>{"use strict";a.exports=require("next/dist/server/app-render/action-async-storage.external.js")},21820:a=>{"use strict";a.exports=require("os")},26713:a=>{"use strict";a.exports=require("next/dist/shared/lib/router/utils/is-bot")},28354:a=>{"use strict";a.exports=require("util")},29067:(a,b,c)=>{Promise.resolve().then(c.bind(c,93110))},29294:a=>{"use strict";a.exports=require("next/dist/server/app-render/work-async-storage.external.js")},33873:a=>{"use strict";a.exports=require("path")},41025:a=>{"use strict";a.exports=require("next/dist/server/app-render/dynamic-access-async-storage.external.js")},43954:a=>{"use strict";a.exports=require("next/dist/shared/lib/router/utils/interception-routes")},46293:a=>{"use strict";a.exports=require("sql.js")},52362:(a,b,c)=>{"use strict";c.r(b),c.d(b,{__next_app__:()=>O,handler:()=>Q,routeModule:()=>P});var d=c(7553),e=c(84006),f=c(67798),g=c(34775),h=c(99373),i=c(73461),j=c(1020),k=c(26349),l=c(54365),m=c(16023),n=c(14965),o=c(63747),p=c(24235),q=c(23938),r=c(261),s=c(66758),t=c(77243),u=c(26713),v=c(37527),w=c(22820),x=c(88216),y=c(47929),z=c(79551),A=c(71797),B=c(89125),C=c(86439),D=c(77068),E=c(27269),F=c(37525),G=c(61287),H=c(81494),I=c(70722),J=c(70753),K=c(43954),L=c(17891),M={};for(let a in G)0>["default","__next_app__","routeModule","handler"].indexOf(a)&&(M[a]=()=>G[a]);c.d(b,M);let N={children:["",{children:["(dashboard)",{children:["dashboard",{children:["providers",{children:["[id]",{children:["__PAGE__",{},{page:[()=>Promise.resolve().then(c.bind(c,93110)),"D:\\bluerouter\\src\\app\\(dashboard)\\dashboard\\providers\\[id]\\page.js"]}]},{"global-error":[()=>Promise.resolve().then(c.t.bind(c,95547,23)),"next/dist/client/components/builtin/global-error.js"]},["new"]]},{"global-error":[()=>Promise.resolve().then(c.t.bind(c,95547,23)),"next/dist/client/components/builtin/global-error.js"]},[]]},{"global-error":[()=>Promise.resolve().then(c.t.bind(c,95547,23)),"next/dist/client/components/builtin/global-error.js"]},[]]},{layout:[()=>Promise.resolve().then(c.bind(c,30508)),"D:\\bluerouter\\src\\app\\(dashboard)\\layout.js"],"global-error":[()=>Promise.resolve().then(c.t.bind(c,95547,23)),"next/dist/client/components/builtin/global-error.js"],"not-found":[()=>Promise.resolve().then(c.t.bind(c,55091,23)),"next/dist/client/components/builtin/not-found.js"],forbidden:[()=>Promise.resolve().then(c.t.bind(c,45270,23)),"next/dist/client/components/builtin/forbidden.js"],unauthorized:[()=>Promise.resolve().then(c.t.bind(c,28193,23)),"next/dist/client/components/builtin/unauthorized.js"],metadata:{icon:[async a=>(await Promise.resolve().then(c.bind(c,70440))).default(a)],apple:[],openGraph:[],twitter:[],manifest:"/manifest.webmanifest"}},[]]},{layout:[()=>Promise.resolve().then(c.bind(c,32059)),"D:\\bluerouter\\src\\app\\layout.js"],"global-error":[()=>Promise.resolve().then(c.t.bind(c,95547,23)),"next/dist/client/components/builtin/global-error.js"],"not-found":[()=>Promise.resolve().then(c.t.bind(c,55091,23)),"next/dist/client/components/builtin/not-found.js"],forbidden:[()=>Promise.resolve().then(c.t.bind(c,45270,23)),"next/dist/client/components/builtin/forbidden.js"],unauthorized:[()=>Promise.resolve().then(c.t.bind(c,28193,23)),"next/dist/client/components/builtin/unauthorized.js"],metadata:{icon:[async a=>(await Promise.resolve().then(c.bind(c,70440))).default(a)],apple:[],openGraph:[],twitter:[],manifest:"/manifest.webmanifest"}},[]]}.children,O={require:c,loadChunk:()=>Promise.resolve()},P=new d.AppPageRouteModule({definition:{kind:e.RouteKind.APP_PAGE,page:"/(dashboard)/dashboard/providers/[id]/page",pathname:"/dashboard/providers/[id]",bundlePath:"",filename:"",appPaths:[]},userland:{loaderTree:N},distDir:".next-cli-build",relativeProjectDir:""});async function Q(a,b,d){var M,R,S,T,U;d.requestMeta&&(0,h.setRequestMeta)(a,d.requestMeta),P.isDev&&(0,h.addRequestMeta)(a,"devRequestTimingInternalsEnd",process.hrtime.bigint());let V=!!(0,h.getRequestMeta)(a,"minimalMode"),W="/(dashboard)/dashboard/providers/[id]/page";"/index"===W&&(W="/");let X=await P.prepare(a,b,{srcPage:W,multiZoneDraftMode:!1});if(!X)return b.statusCode=400,b.end("Bad Request"),null==d.waitUntil||d.waitUntil.call(d,Promise.resolve()),null;let{buildId:Y,query:Z,params:$,pageIsDynamic:_,buildManifest:aa,nextFontManifest:ab,reactLoadableManifest:ac,serverActionsManifest:ad,clientReferenceManifest:ae,subresourceIntegrityManifest:af,prerenderManifest:ag,isDraftMode:ah,resolvedPathname:ai,revalidateOnlyGenerated:aj,routerServerContext:ak,nextConfig:al,parsedUrl:am,interceptionRoutePatterns:an,deploymentId:ao,clientAssetToken:ap}=X,aq=(0,r.normalizeAppPath)(W),{isOnDemandRevalidate:ar}=X,as=al.experimental.ppr&&!al.cacheComponents&&(0,K.isInterceptionRouteAppPath)(ai)?null:P.match(ai,ag),at=(null==as?void 0:as.route)??null,au=!!ag.routes[ai],av=a.headers["user-agent"]||"",aw=(0,u.getBotType)(av),ax=(0,q.isHtmlBotRequest)(a),ay=(0,h.getRequestMeta)(a,"isPrefetchRSCRequest")??"1"===a.headers[t.NEXT_ROUTER_PREFETCH_HEADER],az=(0,h.getRequestMeta)(a,"isRSCRequest")??(0,n.f)(a.headers[t.RSC_HEADER]),aA=(0,s.getIsPossibleServerAction)(a),aB=(0,m.checkIsAppPPREnabled)(al.experimental.ppr),aC=a.headers[y.NEXT_RESUME_STATE_LENGTH_HEADER];if(!(0,h.getRequestMeta)(a,"postponed")&&V&&aB&&aA&&aC&&"string"==typeof aC){let e=parseInt(aC,10),{maxPostponedStateSize:f,maxPostponedStateSizeBytes:g}=(0,E.getMaxPostponedStateSize)(al.experimental.maxPostponedStateSize);if(!isNaN(e)&&e>0){if(e>g)return b.statusCode=413,b.end((0,E.getPostponedStateExceededErrorMessage)(f)),null==d.waitUntil||d.waitUntil.call(d,Promise.resolve()),null;let i="1 MB",j=(null==(U=al.experimental.serverActions)?void 0:U.bodySizeLimit)??i,k=e+(j!==i?c(95726).parse(j):1048576),l=await (0,E.readBodyWithSizeLimit)(a,k);if(null===l)return b.statusCode=413,b.end("Request body exceeded limit. To configure the body size limit for Server Actions, see: https://nextjs.org/docs/app/api-reference/next-config-js/serverActions#bodysizelimit"),null==d.waitUntil||d.waitUntil.call(d,Promise.resolve()),null;if(l.length>=e){let b=l.subarray(0,e).toString("utf8");(0,h.addRequestMeta)(a,"postponed",b);let c=l.subarray(e);(0,h.addRequestMeta)(a,"actionBody",c)}else throw Object.defineProperty(Error(`invariant: expected ${e} bytes of postponed state but only received ${l.length} bytes`),"__NEXT_ERROR_CODE",{value:"E979",enumerable:!1,configurable:!0})}}if(!(0,h.getRequestMeta)(a,"postponed")&&aB&&"1"===a.headers[y.NEXT_RESUME_HEADER]&&"POST"===a.method){let{maxPostponedStateSize:c,maxPostponedStateSizeBytes:e}=(0,E.getMaxPostponedStateSize)(al.experimental.maxPostponedStateSize),f=await (0,E.readBodyWithSizeLimit)(a,e);if(null===f)return b.statusCode=413,b.end((0,E.getPostponedStateExceededErrorMessage)(c)),null==d.waitUntil||d.waitUntil.call(d,Promise.resolve()),null;let g=f.toString("utf8");(0,h.addRequestMeta)(a,"postponed",g)}let aD=!0===P.isDev||!0===al.experimental.exposeTestingApiInProductionBuild,aE=aD&&("1"===a.headers[t.NEXT_INSTANT_PREFETCH_HEADER]||!(0,n.f)(a.headers[t.RSC_HEADER])&&"string"==typeof a.headers.cookie&&a.headers.cookie.includes(t.NEXT_INSTANT_TEST_COOKIE+"=")),aF=(aB||aE)&&((null==(M=ag.routes[aq]??ag.dynamicRoutes[aq])?void 0:M.renderingMode)==="PARTIALLY_STATIC"||aE&&(aD||(null==ak?void 0:ak.experimentalTestProxy)===!0)),aG=aE&&aF,aH=aG&&!0===P.isDev,aI=!1,aJ=aF?(0,h.getRequestMeta)(a,"postponed"):void 0,aK=null==(R=ag.routes[ai])?void 0:R.prefetchDataRoute,aL=aF&&az&&!ay&&!aK;V&&(aL=aL&&!!aJ);let aM=(0,h.getRequestMeta)(a,"segmentPrefetchRSCRequest"),aN=(!aw||!aF)&&(!av||(0,q.shouldServeStreamingMetadata)(av,al.htmlLimitedBots)),aO=!!((at||au||ag.routes[aq])&&!(aw&&aF)),aP=aF&&!0===al.cacheComponents,aQ=!0===P.isDev||!aO||"string"==typeof aJ||(aP&&(0,h.getRequestMeta)(a,"onCacheEntryV2")?aL&&!V:aL),aR=!!aw&&aF,aS=(null==at?void 0:at.remainingPrerenderableParams)??[],aT=(null==at?void 0:at.fallback)===null&&((null==(S=at.fallbackRootParams)?void 0:S.length)??0)>0,aU=null;if(!ah&&aO&&!aQ&&!aA&&!aJ&&!aL){let a=as?"string"==typeof(null==at?void 0:at.fallback)?at.fallback:as.source:null;if(!0===al.experimental.partialFallbacks&&a&&(null==at?void 0:at.fallbackRouteParams)&&!aT){if(aS.length>0){let b,c=(b=new Map(aS.map(a=>[a.paramName,a])),a.split("/").map(a=>{let c=(0,L.getSegmentParam)(a);if(!c)return a;let d=b.get(c.paramName);if(!d)return a;let e=null==$?void 0:$[d.paramName];if(!e)return a;let f=Array.isArray(e)?e.map(a=>encodeURIComponent(a)).join("/"):encodeURIComponent(e);return a.replace((0,o.buildDynamicSegmentPlaceholder)(d),f)}).join("/")||"/");aU=c!==a?c:null}}else aU=ai}let aV=aU;!aV&&(P.isDev||aO&&_&&(null==at?void 0:at.fallbackRouteParams)&&!aA)&&(aV=ai),P.isDev||ah||!aO||!az||aL||(0,k.d)(a.headers);let aW={...G,tree:N,handler:Q,routeModule:P,__next_app__:O};ad&&ae&&(0,p.setManifestsSingleton)({page:W,clientReferenceManifest:ae,serverActionsManifest:ad});let aX=a.method||"GET",aY=(0,g.getTracer)(),aZ=aY.getActiveScopeSpan(),a$=!!(null==ak?void 0:ak.isWrappedByNextServer),a_=!0===al.experimental.partialFallbacks&&aS.length>0?(null==at||null==(T=at.fallbackRouteParams)?void 0:T.filter(a=>!aS.some(b=>b.paramName===a.paramName)))??[]:[],a0=async()=>((null==ak?void 0:ak.render404)?await ak.render404(a,b,am,!1):b.end("This page could not be found"),null);try{let k,m=P.getVaryHeader(ai,an);b.setHeader("Vary",m);let n=async(c,d)=>{let e=new l.NodeNextRequest(a),f=new l.NodeNextResponse(b);return P.render(e,f,d).finally(()=>{if(!c)return;c.setAttributes({"http.status_code":b.statusCode,"next.rsc":!1});let a=aY.getRootSpanAttributes();if(!a)return;if(a.get("next.span_type")!==i.BaseServerSpan.handleRequest)return void console.warn(`Unexpected root span type '${a.get("next.span_type")}'. Please report this Next.js issue https://github.com/vercel/next.js`);let d=a.get("next.route");if(d){let a=`${aX} ${d}`;c.setAttributes({"next.route":d,"http.route":d,"next.span_name":a}),c.updateName(a),k&&k!==c&&(k.setAttribute("http.route",d),k.updateName(a))}else c.updateName(`${aX} ${W}`)})},p=(0,h.getRequestMeta)(a,"incrementalCache")||await P.getIncrementalCache(a,al,ag,V);null==p||p.resetRequestCache(),globalThis.__incrementalCache=p;let q=async({span:e,postponed:f,fallbackRouteParams:g,forceStaticRender:i})=>{let k={query:Z,params:$,page:aq,sharedContext:{buildId:Y,deploymentId:ao,clientAssetToken:ap},serverComponentsHmrCache:(0,h.getRequestMeta)(a,"serverComponentsHmrCache"),fallbackRouteParams:g,renderOpts:{App:()=>null,Document:()=>null,pageConfig:{},ComponentMod:aW,Component:(0,j.T)(aW),params:$,routeModule:P,page:W,postponed:f,shouldWaitOnAllReady:aR,serveStreamingMetadata:aN,supportsDynamicResponse:"string"==typeof f||aQ,buildManifest:aa,nextFontManifest:ab,reactLoadableManifest:ac,subresourceIntegrityManifest:af,setCacheStatus:null==ak?void 0:ak.setCacheStatus,setIsrStatus:null==ak?void 0:ak.setIsrStatus,setReactDebugChannel:null==ak?void 0:ak.setReactDebugChannel,sendErrorsToBrowser:null==ak?void 0:ak.sendErrorsToBrowser,dir:c(33873).join(process.cwd(),P.relativeProjectDir),isDraftMode:ah,botType:aw,isOnDemandRevalidate:ar,isPossibleServerAction:aA,assetPrefix:al.assetPrefix,nextConfigOutput:al.output,crossOrigin:al.crossOrigin,trailingSlash:al.trailingSlash,images:al.images,previewProps:ag.preview,enableTainting:al.experimental.taint,htmlLimitedBots:al.htmlLimitedBots,reactMaxHeadersLength:al.reactMaxHeadersLength,multiZoneDraftMode:!1,incrementalCache:p,cacheLifeProfiles:al.cacheLife,basePath:al.basePath,serverActions:al.experimental.serverActions,logServerFunctions:"object"==typeof al.logging&&!!al.logging.serverFunctions,...aG||aH||aI?{isBuildTimePrerendering:!0,supportsDynamicResponse:!1,isStaticGeneration:!0,isDebugDynamicAccesses:aH}:{},cacheComponents:!!al.cacheComponents,experimental:{isRoutePPREnabled:aF,expireTime:al.expireTime,staleTimes:al.experimental.staleTimes,dynamicOnHover:!!al.experimental.dynamicOnHover,optimisticRouting:!!al.experimental.optimisticRouting,inlineCss:!!al.experimental.inlineCss,prefetchInlining:al.experimental.prefetchInlining??!1,authInterrupts:!!al.experimental.authInterrupts,cachedNavigations:!!al.experimental.cachedNavigations,clientTraceMetadata:al.experimental.clientTraceMetadata||[],clientParamParsingOrigins:al.experimental.clientParamParsingOrigins,maxPostponedStateSizeBytes:(0,D.parseMaxPostponedStateSize)(al.experimental.maxPostponedStateSize)},waitUntil:d.waitUntil,onClose:a=>{b.on("close",a)},onAfterTaskError:()=>{},onInstrumentationRequestError:(b,c,d,e)=>P.onRequestError(a,b,d,e,ak),err:(0,h.getRequestMeta)(a,"invokeError")}};i&&(k.renderOpts.supportsDynamicResponse=!1);let l=await n(e,k),{metadata:m}=l,{cacheControl:o,headers:q={},fetchTags:r,fetchMetrics:s}=m;if(r&&(q[y.NEXT_CACHE_TAGS_HEADER]=r),a.fetchMetrics=s,aO&&(null==o?void 0:o.revalidate)===0&&!P.isDev&&!aF){let a=m.staticBailoutInfo,b=Object.defineProperty(Error(`Page changed from static to dynamic at runtime ${ai}${(null==a?void 0:a.description)?`, reason: ${a.description}`:""}
|
|
2
|
-
see more here https://nextjs.org/docs/messages/app-static-to-dynamic-error`),"__NEXT_ERROR_CODE",{value:"E132",enumerable:!1,configurable:!0});if(null==a?void 0:a.stack){let c=a.stack;b.stack=b.message+c.substring(c.indexOf("\n"))}throw b}return{value:{kind:v.CachedRouteKind.APP_PAGE,html:l,headers:q,rscData:m.flightData,postponed:m.postponed,status:m.statusCode,segmentData:m.segmentData},cacheControl:o}},r=async({hasResolved:c,previousCacheEntry:g,isRevalidating:i,span:j,forceStaticRender:k=!1})=>{let l=!1===P.isDev,m=c||b.writableEnded;try{var n;let f;if(ar&&aj&&!g&&!V)return(null==ak?void 0:ak.render404)?await ak.render404(a,b):(b.statusCode=404,b.end("This page could not be found")),null;if(at&&(f=(0,w.parseFallbackField)(at.fallback)),!0===al.experimental.partialFallbacks&&(null==at?void 0:at.fallback)===null&&!aT&&aS.length>0&&(f=w.FallbackMode.PRERENDER),f===w.FallbackMode.PRERENDER&&(0,u.isBot)(av)&&(!aF||ax)&&(f=w.FallbackMode.BLOCKING_STATIC_RENDER),(null==g?void 0:g.isStale)===-1&&(ar=!0),ar&&(f!==w.FallbackMode.NOT_FOUND||g)&&(f=w.FallbackMode.BLOCKING_STATIC_RENDER),!V&&f!==w.FallbackMode.BLOCKING_STATIC_RENDER&&aV&&!m&&!ah&&_&&(l||!au)){if((l||at)&&f===w.FallbackMode.NOT_FOUND){if(al.adapterPath)return await a0();throw new C.NoFallbackError}if(aF&&(al.cacheComponents?!aL:!az)){let b=l&&"string"==typeof(null==at?void 0:at.fallback)?at.fallback:aq,f=(l||aG)&&(null==at?void 0:at.fallbackRouteParams)?(0,o.createOpaqueFallbackRouteParams)(at.fallbackRouteParams):aI?(0,o.getFallbackRouteParams)(aq,P):null;aG&&f&&(0,h.addRequestMeta)(a,"fallbackParams",f);let g=await P.handleResponse({cacheKey:b,req:a,nextConfig:al,routeKind:e.RouteKind.APP_PAGE,isFallback:!0,prerenderManifest:ag,isRoutePPREnabled:aF,responseGenerator:async()=>q({span:j,postponed:void 0,fallbackRouteParams:f,forceStaticRender:!0}),waitUntil:d.waitUntil,isMinimalMode:V});if(null===g)return null;if(g)return V||!aF||!(aS.length>0)||!0!==al.experimental.partialFallbacks||!aU||!p||ar||aI||aD||aE||ay||(0,J.scheduleOnNextTick)(async()=>{let b=P.getResponseCache(a);try{await b.revalidate(aU,p,aF,!1,a=>q({span:a.span,postponed:void 0,fallbackRouteParams:a_.length>0?(0,o.createOpaqueFallbackRouteParams)(a_):null,forceStaticRender:!0}),null,c,d.waitUntil)}catch(a){console.error("Error revalidating the page in the background",a)}}),delete g.cacheControl,g}}let s=ar||i||!aJ?void 0:aJ;if(aP&&!V&&p&&(aL||aA)&&!k){let b=await p.get(ai,{kind:v.IncrementalCacheKind.APP_PAGE,isRoutePPREnabled:!0,isFallback:!1});b&&b.value&&b.value.kind===v.CachedRouteKind.APP_PAGE&&(s=b.value.postponed,b&&(-1===b.isStale||!0===b.isStale)&&(0,J.scheduleOnNextTick)(async()=>{let b=P.getResponseCache(a);try{await b.revalidate(ai,p,aF,!1,a=>r({...a,forceStaticRender:!0}),null,c,d.waitUntil)}catch(a){console.error("Error revalidating the page in the background",a)}}))}if((aG||aH)&&void 0!==s)return{cacheControl:{revalidate:1,expire:void 0},value:{kind:v.CachedRouteKind.PAGES,html:x.default.EMPTY,pageData:{},headers:void 0,status:void 0}};let t=!P.isDev&&_&&(null==at?void 0:at.fallbackRouteParams)?(0,o.getPlaceholderFallbackRouteParams)($,at.fallbackRouteParams):null,y=t&&t.length>0?t:null==at?void 0:at.fallbackRouteParams,z=null!=t&&t.length>0,A=null;if(al.cacheComponents&&(null==at?void 0:at.fallbackRouteParams)){let b=(0,h.getRequestMeta)(a,"resolvedRouteParamKeys");b&&b.size>0&&(A=at.fallbackRouteParams.filter(a=>!b.has(a.paramName)))}let B=(l&&(0,h.getRequestMeta)(a,"renderFallbackShell")||z||aG&&!au)&&y?(0,o.createOpaqueFallbackRouteParams)(y):A&&A.length>0&&A.length<((null==at||null==(n=at.fallbackRouteParams)?void 0:n.length)??0)?(0,o.createOpaqueFallbackRouteParams)(A):aI?(0,o.getFallbackRouteParams)(aq,P):null;if((l||aG)&&al.cacheComponents&&!au&&(null==at?void 0:at.fallbackRouteParams)){let b=(0,o.createOpaqueFallbackRouteParams)(y??at.fallbackRouteParams);b&&(0,h.addRequestMeta)(a,"fallbackParams",b)}return q({span:j,postponed:s,fallbackRouteParams:B,forceStaticRender:k})}catch(b){throw(null==g?void 0:g.isStale)&&await P.onRequestError(a,b,{routerKind:"App Router",routePath:W,routeType:"render",revalidateReason:(0,f.c)({isStaticGeneration:aO,isOnDemandRevalidate:ar})},!1,ak),b}},s=async c=>{var f,g,i,j,k,l;let m,n=await P.handleResponse({cacheKey:aU,responseGenerator:a=>r({span:c,...a}),routeKind:e.RouteKind.APP_PAGE,isOnDemandRevalidate:ar,isRoutePPREnabled:aF,req:a,nextConfig:al,prerenderManifest:ag,waitUntil:d.waitUntil,isMinimalMode:V});if(ah&&b.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate"),P.isDev&&b.setHeader("Cache-Control","no-cache, must-revalidate"),!n){if(aU)throw Object.defineProperty(Error("invariant: cache entry required but not generated"),"__NEXT_ERROR_CODE",{value:"E62",enumerable:!1,configurable:!0});return null}if((null==(f=n.value)?void 0:f.kind)!==v.CachedRouteKind.APP_PAGE)throw Object.defineProperty(Error(`Invariant app-page handler received invalid cache entry ${null==(i=n.value)?void 0:i.kind}`),"__NEXT_ERROR_CODE",{value:"E707",enumerable:!1,configurable:!0});let o="string"==typeof n.value.postponed;az&&!aA&&ao&&b.setHeader(y.NEXT_NAV_DEPLOYMENT_ID_HEADER,ao),aO&&!aL&&(!o||ay)&&(V||b.setHeader("x-nextjs-cache",ar?"REVALIDATED":n.isMiss?"MISS":n.isStale?"STALE":"HIT"),b.setHeader(t.NEXT_IS_PRERENDER_HEADER,"1"));let{value:p}=n;if(aJ)m={revalidate:0,expire:void 0};else if(aL)m={revalidate:0,expire:void 0};else if(!P.isDev)if(ah)m={revalidate:0,expire:void 0};else if(aO){if(n.cacheControl)if("number"==typeof n.cacheControl.revalidate){if(n.cacheControl.revalidate<1)throw Object.defineProperty(Error(`Invalid revalidate configuration provided: ${n.cacheControl.revalidate} < 1`),"__NEXT_ERROR_CODE",{value:"E22",enumerable:!1,configurable:!0});m={revalidate:n.cacheControl.revalidate,expire:(null==(j=n.cacheControl)?void 0:j.expire)??al.expireTime}}else m={revalidate:y.CACHE_ONE_YEAR_SECONDS,expire:void 0}}else b.getHeader("Cache-Control")||(m={revalidate:0,expire:void 0});if(n.cacheControl=m,"string"==typeof aM&&(null==p?void 0:p.kind)===v.CachedRouteKind.APP_PAGE&&p.segmentData){b.setHeader(t.NEXT_DID_POSTPONE_HEADER,"2");let c=null==(k=p.headers)?void 0:k[y.NEXT_CACHE_TAGS_HEADER];V&&aO&&c&&"string"==typeof c&&b.setHeader(y.NEXT_CACHE_TAGS_HEADER,c);let d=p.segmentData.get(aM);return void 0!==d?(0,B.sendRenderResult)({req:a,res:b,generateEtags:al.generateEtags,poweredByHeader:al.poweredByHeader,result:x.default.fromStatic(d,t.RSC_CONTENT_TYPE_HEADER),cacheControl:n.cacheControl}):(b.statusCode=204,(0,B.sendRenderResult)({req:a,res:b,generateEtags:al.generateEtags,poweredByHeader:al.poweredByHeader,result:x.default.EMPTY,cacheControl:n.cacheControl}))}let s=aP?(0,h.getRequestMeta)(a,"onCacheEntryV2")??(0,h.getRequestMeta)(a,"onCacheEntry"):(0,h.getRequestMeta)(a,"onCacheEntry");if(s){let b=(0,h.getRequestMeta)(a,"initURL")??a.url,c=b?(null==(l=(0,F.parseUrl)(b))?void 0:l.pathname)??b:void 0;if(await s(n,{url:c}))return null}if(p.headers){let a={...p.headers};for(let[c,d]of(V&&aO||delete a[y.NEXT_CACHE_TAGS_HEADER],Object.entries(a)))if(void 0!==d)if(Array.isArray(d))for(let a of d)b.appendHeader(c,a);else"number"==typeof d&&(d=d.toString()),b.appendHeader(c,d)}let u=null==(g=p.headers)?void 0:g[y.NEXT_CACHE_TAGS_HEADER];if(V&&aO&&u&&"string"==typeof u&&b.setHeader(y.NEXT_CACHE_TAGS_HEADER,u),!p.status||az&&aF||(b.statusCode=p.status),!V&&p.status&&H.RedirectStatusCode[p.status]&&az&&(b.statusCode=200),o&&!aL&&b.setHeader(t.NEXT_DID_POSTPONE_HEADER,"1"),az&&!ah){if(void 0===p.rscData){if(p.html.contentType!==t.RSC_CONTENT_TYPE_HEADER)if(al.cacheComponents)return b.statusCode=404,(0,B.sendRenderResult)({req:a,res:b,generateEtags:al.generateEtags,poweredByHeader:al.poweredByHeader,result:x.default.EMPTY,cacheControl:n.cacheControl});else throw Object.defineProperty(new I.InvariantError(`Expected RSC response, got ${p.html.contentType}`),"__NEXT_ERROR_CODE",{value:"E789",enumerable:!1,configurable:!0});return(0,B.sendRenderResult)({req:a,res:b,generateEtags:al.generateEtags,poweredByHeader:al.poweredByHeader,result:p.html,cacheControl:n.cacheControl})}return(0,B.sendRenderResult)({req:a,res:b,generateEtags:al.generateEtags,poweredByHeader:al.poweredByHeader,result:x.default.fromStatic(p.rscData,t.RSC_CONTENT_TYPE_HEADER),cacheControl:n.cacheControl})}let w=p.html;if(aE&&aG){let c=!0===P.isDev?crypto.randomUUID():null;return w.pipeThrough(await (0,A.createInstantTestScriptInsertionTransformStream)(c)),(0,B.sendRenderResult)({req:a,res:b,generateEtags:al.generateEtags,poweredByHeader:al.poweredByHeader,result:w,cacheControl:{revalidate:0,expire:void 0}})}if(!o||V||az)return(0,B.sendRenderResult)({req:a,res:b,generateEtags:al.generateEtags,poweredByHeader:al.poweredByHeader,result:w,cacheControl:n.cacheControl});if(aG||aH)return w.push(new ReadableStream({start(a){a.enqueue(z.ENCODED_TAGS.CLOSED.BODY_AND_HTML),a.close()}})),(0,B.sendRenderResult)({req:a,res:b,generateEtags:al.generateEtags,poweredByHeader:al.poweredByHeader,result:w,cacheControl:{revalidate:0,expire:void 0}});let C=new TransformStream;return w.push(C.readable),q({span:c,postponed:p.postponed,fallbackRouteParams:null,forceStaticRender:!1}).then(async a=>{var b,c;if(!a)throw Object.defineProperty(Error("Invariant: expected a result to be returned"),"__NEXT_ERROR_CODE",{value:"E463",enumerable:!1,configurable:!0});if((null==(b=a.value)?void 0:b.kind)!==v.CachedRouteKind.APP_PAGE)throw Object.defineProperty(Error(`Invariant: expected a page response, got ${null==(c=a.value)?void 0:c.kind}`),"__NEXT_ERROR_CODE",{value:"E305",enumerable:!1,configurable:!0});await a.value.html.pipeTo(C.writable)}).catch(a=>{C.writable.abort(a).catch(a=>{console.error("couldn't abort transformer",a)})}),(0,B.sendRenderResult)({req:a,res:b,generateEtags:al.generateEtags,poweredByHeader:al.poweredByHeader,result:w,cacheControl:{revalidate:0,expire:void 0}})};if(!a$||!aZ)return k=aY.getActiveScopeSpan(),await aY.withPropagatedContext(a.headers,()=>aY.trace(i.BaseServerSpan.handleRequest,{spanName:`${aX} ${W}`,kind:g.SpanKind.SERVER,attributes:{"http.method":aX,"http.target":a.url}},s),void 0,!a$);await s(aZ)}catch(b){throw b instanceof C.NoFallbackError||await P.onRequestError(a,b,{routerKind:"App Router",routePath:W,routeType:"render",revalidateReason:(0,f.c)({isStaticGeneration:aO,isOnDemandRevalidate:ar})},!1,ak),b}}},55511:a=>{"use strict";a.exports=require("crypto")},59436:(a,b,c)=>{"use strict";c.r(b),c.d(b,{default:()=>L});var d=c(48249),e=c(67484),f=c(19099),g=c(2116),h=c.n(g),i=c(81220),j=c(50412),k=c(96919),l=c(91431),m=c(50377),n=c(49885),o=c.n(n);function p({model:a,fullModel:b,alias:c,copied:e,onCopy:f,testStatus:g,isCustom:h,isFree:i,onDeleteAlias:j,onTest:k,isTesting:l,onDisable:m}){let n="ok"===g?"#22c55e":"error"===g?"#ef4444":void 0;return(0,d.jsx)("div",{className:`group min-w-0 max-w-full rounded-lg border px-3 py-2 ${"ok"===g?"border-green-500/40":"error"===g?"border-red-500/40":"border-border"} hover:bg-sidebar/50`,children:(0,d.jsxs)("div",{className:"flex min-w-0 items-start gap-2 sm:items-center",children:[(0,d.jsx)("span",{className:"material-symbols-outlined shrink-0 text-base",style:n?{color:n}:void 0,children:"ok"===g?"check_circle":"error"===g?"cancel":"smart_toy"}),(0,d.jsxs)("div",{className:"flex min-w-0 flex-1 flex-col gap-1",children:[(0,d.jsx)("code",{className:"max-w-[72vw] truncate rounded bg-sidebar px-1.5 py-0.5 font-mono text-xs text-text-muted sm:max-w-[360px]",children:b}),a.name&&(0,d.jsx)("span",{className:"truncate pl-1 text-[9px] italic text-text-muted/70",children:a.name})]}),k&&(0,d.jsxs)("div",{className:"relative shrink-0 group/btn",children:[(0,d.jsx)("button",{onClick:k,disabled:l,className:`rounded p-0.5 text-text-muted transition-opacity hover:bg-sidebar hover:text-primary ${l?"opacity-100":"opacity-100 sm:opacity-0 sm:group-hover:opacity-100"}`,children:(0,d.jsx)("span",{className:"material-symbols-outlined text-sm",style:l?{animation:"spin 1s linear infinite"}:void 0,children:l?"progress_activity":"science"})}),(0,d.jsx)("span",{className:"pointer-events-none absolute mt-1 top-5 left-1/2 -translate-x-1/2 text-[10px] text-text-muted whitespace-nowrap opacity-0 group-hover/btn:opacity-100 transition-opacity",children:l?"Testing...":"Test"})]}),(0,d.jsxs)("div",{className:"relative shrink-0 group/btn",children:[(0,d.jsx)("button",{onClick:()=>f(b,`model-${a.id}`),className:"rounded p-0.5 text-text-muted hover:bg-sidebar hover:text-primary",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-sm",children:e===`model-${a.id}`?"check":"content_copy"})}),(0,d.jsx)("span",{className:"pointer-events-none absolute mt-1 top-5 left-1/2 -translate-x-1/2 text-[10px] text-text-muted whitespace-nowrap opacity-0 group-hover/btn:opacity-100 transition-opacity",children:e===`model-${a.id}`?"Copied!":"Copy"})]}),h?(0,d.jsx)("button",{onClick:j,className:"ml-auto rounded p-0.5 text-text-muted opacity-100 transition-opacity hover:bg-red-500/10 hover:text-red-500 sm:opacity-0 sm:group-hover:opacity-100",title:"Remove custom model",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-sm",children:"close"})}):m?(0,d.jsx)("button",{onClick:m,className:"ml-auto rounded p-0.5 text-text-muted opacity-100 transition-opacity hover:bg-red-500/10 hover:text-red-500 sm:opacity-0 sm:group-hover:opacity-100",title:"Disable this model",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-sm",children:"close"})}):null]})})}function q({modelId:a,fullModel:b,copied:c,onCopy:e,onDeleteAlias:f,onTest:g,testStatus:h,isTesting:i}){let j=`model_support:${a}`,k="ok"===h?"#22c55e":"error"===h?"#ef4444":void 0;return(0,d.jsxs)("div",{className:`flex items-center gap-3 p-3 rounded-lg border ${"ok"===h?"border-green-500/40":"error"===h?"border-red-500/40":"border-border"} hover:bg-sidebar/50`,children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-base text-text-muted",style:k?{color:k}:void 0,children:"ok"===h?"check_circle":"error"===h?"cancel":"smart_toy"}),(0,d.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,d.jsx)("p",{className:"text-sm font-medium truncate",children:a}),(0,d.jsxs)("div",{className:"flex items-center gap-1 mt-1",children:[(0,d.jsx)("code",{className:"text-xs text-text-muted font-mono bg-sidebar px-1.5 py-0.5 rounded",children:b}),(0,d.jsxs)("div",{className:"relative group/btn",children:[(0,d.jsx)("button",{onClick:()=>e(b,`model-${a}`),className:"p-0.5 hover:bg-sidebar rounded text-text-muted hover:text-primary",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-sm",children:c===`model-${a}`?"check":"content_copy"})}),(0,d.jsx)("span",{className:"pointer-events-none absolute top-5 left-1/2 -translate-x-1/2 text-[10px] text-text-muted whitespace-nowrap opacity-0 group-hover/btn:opacity-100 transition-opacity",children:c===`model-${a}`?"Copied!":"Copy"})]}),g&&(0,d.jsxs)("div",{className:"relative group/btn",children:[(0,d.jsx)("button",{onClick:g,disabled:i,className:"p-0.5 hover:bg-sidebar rounded text-text-muted hover:text-primary transition-colors",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-sm",style:i?{animation:"spin 1s linear infinite"}:void 0,children:i?"progress_activity":"science"})}),(0,d.jsx)("span",{className:"pointer-events-none absolute top-5 left-1/2 -translate-x-1/2 text-[10px] text-text-muted whitespace-nowrap opacity-0 group-hover/btn:opacity-100 transition-opacity",children:i?"Testing...":"Test"})]})]}),(0,d.jsxs)("div",{className:"mt-2 flex flex-wrap items-center gap-1.5",children:[(0,d.jsx)("span",{className:"text-[10px] text-text-muted",children:"LAN tag:"}),(0,d.jsx)("code",{className:"rounded bg-primary/10 px-1.5 py-0.5 font-mono text-[10px] text-primary",children:j}),(0,d.jsx)("button",{type:"button",onClick:()=>e(j,`tag-${a}`),className:"rounded px-1 py-0.5 text-[10px] text-text-muted hover:bg-sidebar hover:text-primary",title:"Copy model_support tag",children:c===`tag-${a}`?"Copied":"Copy tag"})]})]}),(0,d.jsx)("button",{onClick:f,className:"p-1 hover:bg-red-50 rounded text-red-500",title:"Remove model",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-sm",children:"delete"})})]})}function r({providerStorageAlias:a,providerDisplayAlias:b,modelAliases:c,copied:f,onCopy:g,onSetAlias:h,onDeleteAlias:i,connections:k,isAnthropic:l}){let[m,n]=(0,e.useState)(""),[o,p]=(0,e.useState)(!1),[s,t]=(0,e.useState)(!1),[u,v]=(0,e.useState)(null),[w,x]=(0,e.useState)({}),y=async b=>{if(!u){v(b);try{let c=await fetch("/api/models/test",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({model:`${a}/${b}`})}),d=await c.json();x(a=>({...a,[b]:d.ok?"ok":"error"}))}catch{x(a=>({...a,[b]:"error"}))}finally{v(null)}}},z=Object.entries(c).filter(([,b])=>b.startsWith(`${a}/`)).map(([b,c])=>({modelId:c.replace(`${a}/`,""),fullModel:c,alias:b})),A=d=>{let e,f=`${a}/${d}`;if(Object.values(c).includes(f))return null;let g=(e=d.split("/"))[e.length-1];if(!c[g])return g;let h=`${b}-${g}`;return c[h]?null:h},B=async()=>{if(!m.trim()||o)return;let b=m.trim(),c=A(b);if(!c)return void alert("All suggested aliases already exist. Please choose a different model or remove conflicting aliases.");p(!0);try{await h(b,c,a),n("")}catch(a){console.log("Error adding model:",a)}finally{p(!1)}},C=async()=>{if(s)return;let b=k.find(a=>!1!==a.isActive);if(b){t(!0);try{let c=await fetch(`/api/providers/${b.id}/models`),d=await c.json();if(!c.ok)return void alert(d.error||"Failed to import models");let e=d.models||[];if(0===e.length)return void alert("No models returned from /models.");let f=0;for(let b of e){let c=b.id||b.name||b.model;if(!c)continue;let d=A(c);d&&(await h(c,d,a),f+=1)}0===f&&alert("No new models were added.")}catch(a){console.log("Error importing models:",a)}finally{t(!1)}}},D=k.some(a=>!1!==a.isActive);return(0,d.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,d.jsxs)("p",{className:"text-sm text-text-muted",children:["Add ",l?"Anthropic":"OpenAI","-compatible models manually or import them from the /models endpoint. Each model also shows a ",(0,d.jsx)("code",{className:"rounded bg-sidebar px-1 py-0.5 font-mono text-xs",children:"model_support:*"})," tag you can paste into an Ollama endpoint label for Combo tag routing."]}),(0,d.jsxs)("div",{className:"flex items-end gap-2 flex-wrap",children:[(0,d.jsxs)("div",{className:"flex-1 min-w-[240px]",children:[(0,d.jsx)("label",{htmlFor:"new-compatible-model-input",className:"text-xs text-text-muted mb-1 block",children:"Model ID"}),(0,d.jsx)("input",{id:"new-compatible-model-input",type:"text",value:m,onChange:a=>n(a.target.value),onKeyDown:a=>"Enter"===a.key&&B(),placeholder:l?"claude-3-opus-20240229":"gpt-4o",className:"w-full px-3 py-2 text-sm border border-border rounded-lg bg-background focus:outline-none focus:border-primary"})]}),(0,d.jsx)(j.$n,{size:"sm",icon:"add",onClick:B,disabled:!m.trim()||o,children:o?"Adding...":"Add"}),(0,d.jsx)(j.$n,{size:"sm",variant:"secondary",icon:"download",onClick:C,disabled:!D||s,children:s?"Importing...":"Import from /models"})]}),!D&&(0,d.jsx)("p",{className:"text-xs text-text-muted",children:"Add a connection to enable importing models."}),z.length>0&&(0,d.jsx)("div",{className:"flex flex-col gap-3",children:z.map(({modelId:a,fullModel:c,alias:e})=>(0,d.jsx)(q,{modelId:a,fullModel:`${b}/${a}`,copied:f,onCopy:g,onDeleteAlias:()=>i(e),onTest:k.length>0?()=>y(a):void 0,testStatus:w[a],isTesting:u===a},c))})]})}function s({until:a}){let[b,c]=(0,e.useState)("");return b?(0,d.jsxs)("span",{className:"text-xs text-orange-500 font-mono",children:["⏱ ",b]}):null}function t(a){if(!a)return"never";try{return new Date(a).toLocaleString()}catch{return a}}function u(a={}){let b=a&&"object"==typeof a?a:{};return{enabled:!0===b.enabled,intervalSec:Math.max(10,Number.parseInt(b.intervalSec||60,10)||60),failureThreshold:Math.max(1,Number.parseInt(b.failureThreshold||3,10)||3),timeoutMs:Math.max(1e3,Number.parseInt(b.timeoutMs||15e3,10)||15e3),prompt:b.prompt||"Say hi",disableThinking:!1!==b.disableThinking}}function v({connection:a,proxyPools:b,isOAuth:c,isFirst:f,isLast:g,onMoveUp:h,onMoveDown:i,onToggleActive:k,onUpdateProxy:l,onEdit:m,onDelete:n,oneByOneStatus:o=null,providerHealthConfig:p=null,healthCheckRunning:q=!1,onRunHealthCheck:r=null}){let[w,x]=(0,e.useState)(!1),[y,z]=(0,e.useState)(!1),A=(0,e.useRef)(null),B=new Map((b||[]).map(a=>[a.id,a])),C=a.providerSpecificData?.proxyPoolId||null,D=C?B.get(C):null,E=a.providerSpecificData?.connectionProxyEnabled===!0&&!!a.providerSpecificData?.connectionProxyUrl,F=!!C||E,G=D?`Pool: ${D.name}`:C?`Pool: ${C} (inactive/missing)`:E?`Legacy: ${a.providerSpecificData?.connectionProxyUrl}`:"",H="";if(D?.proxyUrl||a.providerSpecificData?.connectionProxyUrl){let b=D?.proxyUrl||a.providerSpecificData?.connectionProxyUrl;try{let a=new URL(b);H=`${a.protocol}//${a.hostname}${a.port?`:${a.port}`:""}`}catch{H=b}}let I=D?.noProxy||a.providerSpecificData?.connectionNoProxy||"",J=function(a={}){let b=a.tags||a.labels||a.providerSpecificData?.routingTags||a.providerSpecificData?.tags||a.providerSpecificData?.labels||[];return Array.isArray(b)?b.map(a=>String(a||"").trim()).filter(Boolean):"string"==typeof b?b.split(/[\n,;\s]+/).map(a=>a.trim()).filter(Boolean):b&&"object"==typeof b?Object.entries(b).filter(([,a])=>!1!==a&&null!=a).map(([a,b])=>!0===b?a:`${a}:${b}`):[]}(a),K=a.providerSpecificData?.maxInFlight||a.maxInFlight||null,L="default";D?.isActive===!0?L="success":(C||E)&&(L="error");let M=async a=>{z(!0);try{await l("__none__"===a?null:a)}finally{z(!1),x(!1)}},N=a.authType||(c?"oauth":"apikey"),O="oauth"===N,P="cookie"===N,Q=a=>"string"==typeof a&&/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(a),R=O?Q(a.email)?a.email:Q(a.name)?a.name:a.name||a.email||a.displayName||"OAuth Account":a.name||a.email||a.displayName||"API Key",[S,T]=(0,e.useState)(!1),U=Object.entries(a).filter(([a])=>a.startsWith("modelLock_")).map(([,a])=>a).filter(a=>!!a).sort()[0]||null,V="unavailable"!==a.testStatus||S?a.testStatus:"active",W=()=>o?"queued"===o.state?"queued":"testing"===o.state?"testing":"success"===o.state?"success":"failed"===o.state?o.error?`failed: ${o.error}`:"failed":null:null,X=function(a={},b=null){let c=b&&"object"==typeof b?b:{};return!0===c.overrideConnections?{healthCheck:u(c.healthCheck||c),source:"provider",override:!0}:{healthCheck:u(a.healthCheck||{}),source:"account",override:!1}}(a,p),Y=X.healthCheck,Z=!0===Y.enabled,$=a.healthStatus||"unknown",_=Number(a.healthConsecutiveFailures||0),aa=Number(Y.failureThreshold||3),ab=Z?"degraded"===$?`Health: Degraded ${_}/${aa}`:"dead"===$?"Health: Dead":"alive"===$?"Health: Alive":"Health: Unknown":"Health: off";return(0,d.jsxs)("div",{className:`group flex min-w-0 flex-col gap-3 rounded-lg p-2 transition-colors hover:bg-black/[0.02] dark:hover:bg-white/[0.02] sm:flex-row sm:items-center sm:justify-between ${!1===a.isActive?"opacity-60":""}`,children:[(0,d.jsxs)("div",{className:"flex min-w-0 flex-1 items-start gap-2 sm:items-center sm:gap-3",children:[(0,d.jsxs)("div",{className:"flex shrink-0 flex-col",children:[(0,d.jsx)("button",{onClick:h,disabled:f,className:`p-0.5 rounded ${f?"text-text-muted/30 cursor-not-allowed":"hover:bg-sidebar text-text-muted hover:text-primary"}`,children:(0,d.jsx)("span",{className:"material-symbols-outlined text-sm",children:"keyboard_arrow_up"})}),(0,d.jsx)("button",{onClick:i,disabled:g,className:`p-0.5 rounded ${g?"text-text-muted/30 cursor-not-allowed":"hover:bg-sidebar text-text-muted hover:text-primary"}`,children:(0,d.jsx)("span",{className:"material-symbols-outlined text-sm",children:"keyboard_arrow_down"})})]}),(0,d.jsx)("span",{className:"material-symbols-outlined shrink-0 text-base text-text-muted",children:P?"cookie":O?"lock":"key"}),(0,d.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,d.jsx)("p",{className:"text-sm font-medium truncate",children:R}),(0,d.jsxs)("div",{className:"mt-1 flex min-w-0 flex-wrap items-center gap-1.5 sm:gap-2",children:[(0,d.jsx)(j.Ex,{variant:!1===a.isActive?"default":"active"===V||"success"===V?"success":"error"===V||"expired"===V||"unavailable"===V?"error":"default",size:"sm",dot:!0,children:!1===a.isActive?"disabled":V||"Unknown"}),(0,d.jsx)(j.Ex,{variant:"default",size:"sm",children:O?"OAuth":P?"Cookie":"API Key"}),F&&(0,d.jsx)(j.Ex,{variant:L,size:"sm",children:"Proxy"}),K&&(0,d.jsxs)(j.Ex,{variant:"default",size:"sm",children:["max ",K," in-flight"]}),J.slice(0,3).map(a=>(0,d.jsx)(j.Ex,{variant:"primary",size:"sm",children:a},a)),J.length>3&&(0,d.jsxs)(j.Ex,{variant:"default",size:"sm",children:["+",J.length-3," tags"]}),S&&!1!==a.isActive&&(0,d.jsx)(s,{until:U}),a.lastError&&!1!==a.isActive&&(0,d.jsx)("span",{className:"max-w-full truncate text-xs text-red-500 sm:max-w-[300px]",title:a.lastError,children:a.lastError}),(0,d.jsxs)("span",{className:"text-xs text-text-muted",children:["#",a.priority]}),a.globalPriority&&(0,d.jsxs)("span",{className:"text-xs text-text-muted",children:["Auto: ",a.globalPriority]}),W()&&(0,d.jsx)(j.Ex,{variant:o?"success"===o.state?"success":"failed"===o.state?"error":"testing"===o.state?"primary":"default":"default",size:"sm",children:W()})]}),(0,d.jsxs)("div",{className:"mt-2 flex flex-wrap items-center gap-2 text-xs text-text-muted",children:[" ",(0,d.jsx)(j.Ex,{variant:"alive"===$?"success":"dead"===$?"error":"default",children:ab})," ",(0,d.jsx)("span",{children:X.override?"provider policy":"account policy"})," ",(0,d.jsxs)("span",{children:["last check: ",t(a.healthLastCheckedAt)]})," ",null!=a.healthLastLatencyMs&&(0,d.jsxs)("span",{children:[a.healthLastLatencyMs,"ms"]})," ",a.healthLastRecoveredAt&&(0,d.jsxs)("span",{children:["recovered: ",t(a.healthLastRecoveredAt)]})," ",a.healthLastError&&(0,d.jsx)("span",{className:"text-red-500",children:a.healthLastError})," ",(0,d.jsx)("button",{type:"button",onClick:r||void 0,disabled:!r||q,className:"rounded border border-border px-2 py-1 text-xs text-text-main transition-colors hover:border-primary hover:text-primary disabled:cursor-not-allowed disabled:opacity-50",children:q?"Checking...":"Run health check now"})," "]})," ",J.length>0&&(0,d.jsxs)("div",{className:"mt-1 flex items-center gap-1.5 flex-wrap",children:[(0,d.jsx)("span",{className:"text-[11px] text-text-muted",children:"routing tags:"}),J.map(a=>(0,d.jsx)("code",{className:"rounded bg-primary/10 px-1 py-0.5 font-mono text-[10px] text-primary",children:a},a))]}),F&&(0,d.jsxs)("div",{className:"mt-1 flex items-center gap-2 flex-wrap",children:[(0,d.jsx)("span",{className:"max-w-full truncate text-[11px] text-text-muted sm:max-w-[420px]",title:G,children:G}),H&&(0,d.jsx)("code",{className:"max-w-full truncate rounded bg-black/5 px-1 py-0.5 font-mono text-[10px] text-text-muted dark:bg-white/5 sm:max-w-[260px]",children:H}),I&&(0,d.jsxs)("span",{className:"max-w-full truncate text-[11px] text-text-muted sm:max-w-[320px]",title:I,children:["no_proxy: ",I]})]})]})]}),(0,d.jsxs)("div",{className:"flex w-full items-center justify-between gap-2 sm:w-auto sm:justify-end",children:[(0,d.jsxs)("div",{className:"grid flex-1 grid-cols-3 gap-1 sm:flex sm:flex-none",children:[(b||[]).length>0&&(0,d.jsxs)("div",{className:"relative",ref:A,children:[(0,d.jsxs)("button",{onClick:()=>x(a=>!a),className:`flex w-full flex-col items-center rounded px-2 py-1 transition-colors hover:bg-black/5 dark:hover:bg-white/5 ${F?"text-primary":"text-text-muted hover:text-primary"}`,disabled:y,children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:y?"progress_activity":"lan"}),(0,d.jsx)("span",{className:"text-[10px] leading-tight",children:"Proxy"})]}),w&&(0,d.jsxs)("div",{className:"absolute right-0 top-full z-50 mt-1 max-w-[78vw] min-w-[160px] rounded-lg border border-border bg-bg py-1 shadow-lg",children:[(0,d.jsx)("button",{onClick:()=>M("__none__"),className:`w-full text-left px-3 py-1.5 text-sm hover:bg-black/5 dark:hover:bg-white/5 ${!C?"text-primary font-medium":"text-text-main"}`,children:"None"}),(b||[]).map(a=>(0,d.jsx)("button",{onClick:()=>M(a.id),className:`w-full text-left px-3 py-1.5 text-sm hover:bg-black/5 dark:hover:bg-white/5 ${C===a.id?"text-primary font-medium":"text-text-main"}`,children:a.name},a.id))]})]}),(0,d.jsxs)("button",{onClick:m,className:"flex flex-col items-center rounded px-2 py-1 text-text-muted hover:bg-black/5 hover:text-primary dark:hover:bg-white/5",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"edit"}),(0,d.jsx)("span",{className:"text-[10px] leading-tight",children:"Edit"})]}),(0,d.jsxs)("button",{onClick:n,className:"flex flex-col items-center rounded px-2 py-1 text-red-500 hover:bg-red-500/10",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"delete"}),(0,d.jsx)("span",{className:"text-[10px] leading-tight",children:"Delete"})]})]}),(0,d.jsx)(j.lM,{size:"sm",checked:a.isActive??!0,onChange:k,title:a.isActive??!0?"Disable connection":"Enable connection"})]})]})}p.propTypes={model:o().shape({id:o().string.isRequired}).isRequired,fullModel:o().string.isRequired,alias:o().string,copied:o().string,onCopy:o().func.isRequired,testStatus:o().oneOf(["ok","error"]),isCustom:o().bool,isFree:o().bool,onDeleteAlias:o().func,onTest:o().func,isTesting:o().bool,onDisable:o().func},o().string.isRequired,o().string.isRequired,o().string,o().func.isRequired,o().func.isRequired,o().func,o().oneOf(["ok","error"]),o().bool,o().string.isRequired,o().object.isRequired,o().string,o().func.isRequired,o().func.isRequired,o().func.isRequired,r.propTypes={providerStorageAlias:o().string.isRequired,providerDisplayAlias:o().string.isRequired,modelAliases:o().object.isRequired,copied:o().string,onCopy:o().func.isRequired,onSetAlias:o().func.isRequired,onDeleteAlias:o().func.isRequired,connections:o().arrayOf(o().shape({id:o().string,isActive:o().bool})).isRequired,isAnthropic:o().bool},s.propTypes={until:o().string.isRequired},v.propTypes={connection:o().shape({id:o().string,name:o().string,email:o().string,displayName:o().string,modelLockUntil:o().string,testStatus:o().string,isActive:o().bool,lastError:o().string,priority:o().number,globalPriority:o().number,providerSpecificData:o().object,tags:o().oneOfType([o().string,o().array]),labels:o().oneOfType([o().string,o().array]),maxInFlight:o().oneOfType([o().string,o().number]),healthCheck:o().object,healthStatus:o().string,healthConsecutiveFailures:o().number,healthLastCheckedAt:o().string,healthLastOkAt:o().string,healthLastRecoveredAt:o().string,healthLastLatencyMs:o().number,healthLastError:o().string}).isRequired,proxyPools:o().arrayOf(o().shape({id:o().string,name:o().string,proxyUrl:o().string,noProxy:o().string,isActive:o().bool})),isOAuth:o().bool.isRequired,isFirst:o().bool.isRequired,isLast:o().bool.isRequired,onMoveUp:o().func.isRequired,onMoveDown:o().func.isRequired,onToggleActive:o().func.isRequired,onUpdateProxy:o().func,onEdit:o().func.isRequired,onDelete:o().func.isRequired,oneByOneStatus:o().shape({state:o().string,error:o().string}),providerHealthConfig:o().object,healthCheckRunning:o().bool,onRunHealthCheck:o().func};var w=c(12020);let x=[{value:1,label:"Mon"},{value:2,label:"Tue"},{value:3,label:"Wed"},{value:4,label:"Thu"},{value:5,label:"Fri"},{value:6,label:"Sat"},{value:0,label:"Sun"}],y=[0,1,2,3,4,5,6],z={enabled:!0,weekdays:y,fromTime:"00:00",toTime:"23:59"},A={enabled:!1,intervalSec:60,failureThreshold:3,timeoutMs:15e3,prompt:"Say hi",disableThinking:!0,model:""};function B(a,b){let c=String(a||"").trim();return/^([01]\d|2[0-3]):([0-5]\d)$/.test(c)?c:b}function C(a={}){let b=a&&"object"==typeof a?a:{},c=Array.isArray(b.weekdays)?b.weekdays.map(Number).filter(a=>a>=0&&a<=6):y;return{enabled:!1!==b.enabled,weekdays:[...new Set(c)].sort((a,b)=>a-b),fromTime:B(b.fromTime||b.from,"00:00"),toTime:B(b.toTime||b.to,"23:59")}}function D(a={}){return{overrideConnections:!0===a.overrideConnections,schedule:C(a.schedule||z)}}function E(a={}){var b;let c=a&&"object"==typeof a?a:{};return{enabled:!0===c.enabled,intervalSec:Math.max(10,Number.parseInt(c.intervalSec||A.intervalSec,10)||A.intervalSec),failureThreshold:Math.max(1,Number.parseInt(c.failureThreshold||A.failureThreshold,10)||A.failureThreshold),timeoutMs:Math.max(1e3,Number.parseInt(c.timeoutMs||A.timeoutMs,10)||A.timeoutMs),prompt:"string"==typeof c.prompt&&c.prompt.trim()?c.prompt.trim():A.prompt,disableThinking:!1!==c.disableThinking,model:"string"==typeof(b=c.model||c.healthModel||c.testModel)?b.trim():""}}function F(a={}){return{overrideConnections:!0===a.overrideConnections,healthCheck:E(a.healthCheck||a||A)}}function G({providerId:a,onSaved:b}){let[c,f]=(0,e.useState)(D()),[g,h]=(0,e.useState)(F()),[i,j]=(0,e.useState)([]),[l,m]=(0,e.useState)(!1),[n,o]=(0,e.useState)(""),[p,q]=(0,e.useState)(!0),[r,s]=(0,e.useState)(!1),[t,u]=(0,e.useState)(!1),v=function(a=""){if((0,k.gb)(a))return"anthropic";if((0,k.mq)(a)||"cloudflare-ai"===a)return"openai";if("gemini"===a)return"gemini";if("github"===a)return"openai";let b=w.X3?.[a]||"";return b.includes("/messages")?"anthropic":b.includes("/chat/completions")||b.includes("/responses")?"openai":null}(a),z=!!v,A="anthropic"===v,B=a=>{f(b=>({...b,schedule:C({...b.schedule,...a})})),u(!1)},H=a=>{h(b=>({...b,healthCheck:E({...b.healthCheck,...a})})),u(!1)},I=async()=>{s(!0),u(!1);try{let d=await fetch("/api/settings",{cache:"no-store"}),e=d.ok?await d.json():{},f={...e.providerSchedules||{},[a]:D(c)},h={...e.providerHealthChecks||{},[a]:F(g)};(await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({providerSchedules:f,providerHealthChecks:h})})).ok&&(u(!0),"function"==typeof b&&await b())}finally{s(!1)}};return p?null:(0,d.jsxs)("div",{className:"space-y-5 rounded-xl border border-border bg-card p-4",children:[(0,d.jsxs)("section",{className:"space-y-3",children:[(0,d.jsx)("h3",{className:"text-base font-semibold text-text-main",children:"Provider Scheduler Override"}),(0,d.jsx)("p",{className:"text-sm text-text-muted",children:"When enabled, every account in this provider uses this provider-level schedule and account schedulers are locked."}),(0,d.jsxs)("label",{className:"flex items-center gap-2 text-sm",children:[(0,d.jsx)("input",{type:"checkbox",checked:c.overrideConnections,onChange:a=>{f(b=>({...b,overrideConnections:a.target.checked})),u(!1)}}),"Override all accounts"]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("div",{className:"mb-2 text-sm text-text-muted",children:"Weekdays"}),(0,d.jsx)("div",{className:"flex flex-wrap gap-2",children:x.map(a=>(0,d.jsxs)("label",{className:"flex items-center gap-1 rounded border border-border px-2 py-1 text-xs",children:[(0,d.jsx)("input",{type:"checkbox",checked:(c.schedule.weekdays||[]).includes(a.value),onChange:()=>{var b;return b=a.value,void(f(a=>{let c=new Set(Array.isArray(a.schedule.weekdays)?a.schedule.weekdays:y);return c.has(b)?c.delete(b):c.add(b),{...a,schedule:{...a.schedule,weekdays:[...c].sort((a,b)=>a-b)}}}),u(!1))}}),a.label]},a.value))})]}),!1!==c.schedule.enabled&&0===c.schedule.weekdays.length&&(0,d.jsx)("div",{className:"rounded-md border border-warning/30 bg-warning/10 p-2 text-xs text-warning",children:"No weekdays selected. This provider schedule will make accounts unavailable until at least one weekday is selected."}),(0,d.jsxs)("div",{className:"grid gap-3 sm:grid-cols-2",children:[(0,d.jsxs)("label",{className:"text-sm text-text-muted",children:["From time",(0,d.jsx)("input",{type:"time",value:c.schedule.fromTime,onChange:a=>B({fromTime:a.target.value}),className:"mt-1 w-full rounded-lg border border-border bg-background px-3 py-2 text-sm text-text-main outline-none focus:border-primary"})]}),(0,d.jsxs)("label",{className:"text-sm text-text-muted",children:["To time",(0,d.jsx)("input",{type:"time",value:c.schedule.toTime,onChange:a=>B({toTime:a.target.value}),className:"mt-1 w-full rounded-lg border border-border bg-background px-3 py-2 text-sm text-text-main outline-none focus:border-primary"})]})]})]}),(0,d.jsxs)("section",{className:"space-y-3 border-t border-border pt-5",children:[(0,d.jsx)("h3",{className:"text-base font-semibold text-text-main",children:"Provider Health Check Override"}),(0,d.jsx)("p",{className:"text-sm text-text-muted",children:"When enabled, every account in this provider uses the same periodic ping policy and account health settings are locked."}),(0,d.jsxs)("label",{className:"flex items-center gap-2 text-sm",children:[(0,d.jsx)("input",{type:"checkbox",checked:g.overrideConnections,onChange:a=>{h(b=>({...b,overrideConnections:a.target.checked})),u(!1)}}),"Override all accounts"]}),(0,d.jsxs)("label",{className:"flex items-center gap-2 text-sm",children:[(0,d.jsx)("input",{type:"checkbox",checked:g.healthCheck.enabled,onChange:a=>H({enabled:a.target.checked})}),"Enable periodic ping healthcheck"]}),(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("label",{className:"text-sm text-text-muted",children:["Healthcheck model",(0,d.jsxs)("select",{value:g.healthCheck.model||"",disabled:!g.healthCheck.enabled,onChange:a=>H({model:a.target.value}),className:"mt-1 w-full rounded-lg border border-border bg-background px-3 py-2 text-sm text-text-main outline-none focus:border-primary disabled:opacity-50",children:[(0,d.jsx)("option",{value:"",children:"Connection/base URL only — no chat ping"}),i.map(a=>(0,d.jsx)("option",{value:a.id,children:a.name||a.id},a.id))]})]}),(0,d.jsxs)("label",{className:"text-sm text-text-muted",children:["Manual healthcheck model",(0,d.jsx)("input",{type:"text",value:g.healthCheck.model||"",disabled:!g.healthCheck.enabled,onChange:a=>H({model:a.target.value}),placeholder:A?"claude/model name from this endpoint":"gemini"===v?"gemini model, e.g. gemini-2.5-flash":"model name from this endpoint",className:"mt-1 w-full rounded-lg border border-border bg-background px-3 py-2 text-sm text-text-main outline-none focus:border-primary disabled:opacity-50"})]}),l&&(0,d.jsx)("div",{className:"text-xs text-text-muted",children:"Loading models..."}),n&&(0,d.jsxs)("div",{className:"text-xs text-warning",children:["Model list note: ",n]}),A&&(0,d.jsxs)("div",{className:"rounded-md bg-surface p-2 text-xs text-text-muted",children:["Anthropic-compatible healthcheck sends Say hi to ",(0,d.jsx)("code",{children:"/v1/messages"})," only when a model is selected. If this endpoint does not expose ",(0,d.jsx)("code",{children:"/v1/models"}),", type the model name manually."]}),"gemini"===v&&(0,d.jsxs)("div",{className:"rounded-md bg-surface p-2 text-xs text-text-muted",children:["Gemini healthcheck sends Say hi with the native ",(0,d.jsx)("code",{children:"generateContent"})," API only when a model is selected."]}),"cloudflare-ai"===a&&(0,d.jsxs)("div",{className:"rounded-md bg-surface p-2 text-xs text-text-muted",children:["Cloudflare healthcheck sends Say hi to the Workers AI OpenAI-style chat endpoint only when a model is selected. If the model list is incomplete, type the exact ",(0,d.jsx)("code",{children:"@cf/..."})," model manually."]}),!z&&(0,d.jsx)("div",{className:"rounded-md bg-surface p-2 text-xs text-text-muted",children:"This provider can still load/show models if its model resolver supports it. Selecting a model here only triggers a Say hi chat ping for providers with a known direct chat endpoint; otherwise auto healthcheck keeps using the original connection/token/account probe."})]}),g.healthCheck.enabled&&(!z||!g.healthCheck.model)&&(0,d.jsx)("div",{className:"rounded-md border border-warning/30 bg-warning/10 p-2 text-xs text-warning",children:"No direct chat healthcheck model/endpoint is active. Auto healthcheck will test connection/base URL/key/token/account and will not send the Say hi chat ping."}),(0,d.jsxs)("div",{className:"grid gap-3 sm:grid-cols-3",children:[(0,d.jsxs)("label",{className:"text-sm text-text-muted",children:["Interval seconds",(0,d.jsx)("input",{type:"number",value:g.healthCheck.intervalSec,disabled:!g.healthCheck.enabled,onChange:a=>H({intervalSec:Math.max(10,Number.parseInt(a.target.value,10)||60)}),className:"mt-1 w-full rounded-lg border border-border bg-background px-3 py-2 text-sm text-text-main outline-none focus:border-primary disabled:opacity-50"})]}),(0,d.jsxs)("label",{className:"text-sm text-text-muted",children:["Fail threshold",(0,d.jsx)("input",{type:"number",value:g.healthCheck.failureThreshold,disabled:!g.healthCheck.enabled,onChange:a=>H({failureThreshold:Math.max(1,Number.parseInt(a.target.value,10)||3)}),className:"mt-1 w-full rounded-lg border border-border bg-background px-3 py-2 text-sm text-text-main outline-none focus:border-primary disabled:opacity-50"})]}),(0,d.jsxs)("label",{className:"text-sm text-text-muted",children:["Timeout ms",(0,d.jsx)("input",{type:"number",value:g.healthCheck.timeoutMs,disabled:!g.healthCheck.enabled,onChange:a=>H({timeoutMs:Math.max(1e3,Number.parseInt(a.target.value,10)||15e3)}),className:"mt-1 w-full rounded-lg border border-border bg-background px-3 py-2 text-sm text-text-main outline-none focus:border-primary disabled:opacity-50"})]})]}),(0,d.jsxs)("label",{className:"text-sm text-text-muted",children:["Prompt",(0,d.jsx)("input",{type:"text",value:g.healthCheck.prompt,disabled:!g.healthCheck.enabled||!g.healthCheck.model,onChange:a=>H({prompt:a.target.value}),className:"mt-1 w-full rounded-lg border border-border bg-background px-3 py-2 text-sm text-text-main outline-none focus:border-primary disabled:opacity-50"})]}),(0,d.jsxs)("label",{className:"flex items-center gap-2 text-sm",children:[(0,d.jsx)("input",{type:"checkbox",checked:!1!==g.healthCheck.disableThinking,disabled:!g.healthCheck.enabled||!g.healthCheck.model,onChange:a=>H({disableThinking:a.target.checked})}),"Force lightweight test payload / disable thinking when provider supports it"]})]}),(0,d.jsxs)("div",{className:"flex items-center gap-3 pt-2",children:[(0,d.jsx)("button",{type:"button",onClick:I,disabled:r,className:"rounded-lg bg-primary px-4 py-2 text-sm font-medium text-white disabled:opacity-50",children:r?"Saving...":"Save Provider Policy"}),t&&(0,d.jsx)("span",{className:"text-sm text-success",children:"Saved"})]})]})}let H=`name1|sk-key1
|
|
2
|
+
see more here https://nextjs.org/docs/messages/app-static-to-dynamic-error`),"__NEXT_ERROR_CODE",{value:"E132",enumerable:!1,configurable:!0});if(null==a?void 0:a.stack){let c=a.stack;b.stack=b.message+c.substring(c.indexOf("\n"))}throw b}return{value:{kind:v.CachedRouteKind.APP_PAGE,html:l,headers:q,rscData:m.flightData,postponed:m.postponed,status:m.statusCode,segmentData:m.segmentData},cacheControl:o}},r=async({hasResolved:c,previousCacheEntry:g,isRevalidating:i,span:j,forceStaticRender:k=!1})=>{let l=!1===P.isDev,m=c||b.writableEnded;try{var n;let f;if(ar&&aj&&!g&&!V)return(null==ak?void 0:ak.render404)?await ak.render404(a,b):(b.statusCode=404,b.end("This page could not be found")),null;if(at&&(f=(0,w.parseFallbackField)(at.fallback)),!0===al.experimental.partialFallbacks&&(null==at?void 0:at.fallback)===null&&!aT&&aS.length>0&&(f=w.FallbackMode.PRERENDER),f===w.FallbackMode.PRERENDER&&(0,u.isBot)(av)&&(!aF||ax)&&(f=w.FallbackMode.BLOCKING_STATIC_RENDER),(null==g?void 0:g.isStale)===-1&&(ar=!0),ar&&(f!==w.FallbackMode.NOT_FOUND||g)&&(f=w.FallbackMode.BLOCKING_STATIC_RENDER),!V&&f!==w.FallbackMode.BLOCKING_STATIC_RENDER&&aV&&!m&&!ah&&_&&(l||!au)){if((l||at)&&f===w.FallbackMode.NOT_FOUND){if(al.adapterPath)return await a0();throw new C.NoFallbackError}if(aF&&(al.cacheComponents?!aL:!az)){let b=l&&"string"==typeof(null==at?void 0:at.fallback)?at.fallback:aq,f=(l||aG)&&(null==at?void 0:at.fallbackRouteParams)?(0,o.createOpaqueFallbackRouteParams)(at.fallbackRouteParams):aI?(0,o.getFallbackRouteParams)(aq,P):null;aG&&f&&(0,h.addRequestMeta)(a,"fallbackParams",f);let g=await P.handleResponse({cacheKey:b,req:a,nextConfig:al,routeKind:e.RouteKind.APP_PAGE,isFallback:!0,prerenderManifest:ag,isRoutePPREnabled:aF,responseGenerator:async()=>q({span:j,postponed:void 0,fallbackRouteParams:f,forceStaticRender:!0}),waitUntil:d.waitUntil,isMinimalMode:V});if(null===g)return null;if(g)return V||!aF||!(aS.length>0)||!0!==al.experimental.partialFallbacks||!aU||!p||ar||aI||aD||aE||ay||(0,J.scheduleOnNextTick)(async()=>{let b=P.getResponseCache(a);try{await b.revalidate(aU,p,aF,!1,a=>q({span:a.span,postponed:void 0,fallbackRouteParams:a_.length>0?(0,o.createOpaqueFallbackRouteParams)(a_):null,forceStaticRender:!0}),null,c,d.waitUntil)}catch(a){console.error("Error revalidating the page in the background",a)}}),delete g.cacheControl,g}}let s=ar||i||!aJ?void 0:aJ;if(aP&&!V&&p&&(aL||aA)&&!k){let b=await p.get(ai,{kind:v.IncrementalCacheKind.APP_PAGE,isRoutePPREnabled:!0,isFallback:!1});b&&b.value&&b.value.kind===v.CachedRouteKind.APP_PAGE&&(s=b.value.postponed,b&&(-1===b.isStale||!0===b.isStale)&&(0,J.scheduleOnNextTick)(async()=>{let b=P.getResponseCache(a);try{await b.revalidate(ai,p,aF,!1,a=>r({...a,forceStaticRender:!0}),null,c,d.waitUntil)}catch(a){console.error("Error revalidating the page in the background",a)}}))}if((aG||aH)&&void 0!==s)return{cacheControl:{revalidate:1,expire:void 0},value:{kind:v.CachedRouteKind.PAGES,html:x.default.EMPTY,pageData:{},headers:void 0,status:void 0}};let t=!P.isDev&&_&&(null==at?void 0:at.fallbackRouteParams)?(0,o.getPlaceholderFallbackRouteParams)($,at.fallbackRouteParams):null,y=t&&t.length>0?t:null==at?void 0:at.fallbackRouteParams,z=null!=t&&t.length>0,A=null;if(al.cacheComponents&&(null==at?void 0:at.fallbackRouteParams)){let b=(0,h.getRequestMeta)(a,"resolvedRouteParamKeys");b&&b.size>0&&(A=at.fallbackRouteParams.filter(a=>!b.has(a.paramName)))}let B=(l&&(0,h.getRequestMeta)(a,"renderFallbackShell")||z||aG&&!au)&&y?(0,o.createOpaqueFallbackRouteParams)(y):A&&A.length>0&&A.length<((null==at||null==(n=at.fallbackRouteParams)?void 0:n.length)??0)?(0,o.createOpaqueFallbackRouteParams)(A):aI?(0,o.getFallbackRouteParams)(aq,P):null;if((l||aG)&&al.cacheComponents&&!au&&(null==at?void 0:at.fallbackRouteParams)){let b=(0,o.createOpaqueFallbackRouteParams)(y??at.fallbackRouteParams);b&&(0,h.addRequestMeta)(a,"fallbackParams",b)}return q({span:j,postponed:s,fallbackRouteParams:B,forceStaticRender:k})}catch(b){throw(null==g?void 0:g.isStale)&&await P.onRequestError(a,b,{routerKind:"App Router",routePath:W,routeType:"render",revalidateReason:(0,f.c)({isStaticGeneration:aO,isOnDemandRevalidate:ar})},!1,ak),b}},s=async c=>{var f,g,i,j,k,l;let m,n=await P.handleResponse({cacheKey:aU,responseGenerator:a=>r({span:c,...a}),routeKind:e.RouteKind.APP_PAGE,isOnDemandRevalidate:ar,isRoutePPREnabled:aF,req:a,nextConfig:al,prerenderManifest:ag,waitUntil:d.waitUntil,isMinimalMode:V});if(ah&&b.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate"),P.isDev&&b.setHeader("Cache-Control","no-cache, must-revalidate"),!n){if(aU)throw Object.defineProperty(Error("invariant: cache entry required but not generated"),"__NEXT_ERROR_CODE",{value:"E62",enumerable:!1,configurable:!0});return null}if((null==(f=n.value)?void 0:f.kind)!==v.CachedRouteKind.APP_PAGE)throw Object.defineProperty(Error(`Invariant app-page handler received invalid cache entry ${null==(i=n.value)?void 0:i.kind}`),"__NEXT_ERROR_CODE",{value:"E707",enumerable:!1,configurable:!0});let o="string"==typeof n.value.postponed;az&&!aA&&ao&&b.setHeader(y.NEXT_NAV_DEPLOYMENT_ID_HEADER,ao),aO&&!aL&&(!o||ay)&&(V||b.setHeader("x-nextjs-cache",ar?"REVALIDATED":n.isMiss?"MISS":n.isStale?"STALE":"HIT"),b.setHeader(t.NEXT_IS_PRERENDER_HEADER,"1"));let{value:p}=n;if(aJ)m={revalidate:0,expire:void 0};else if(aL)m={revalidate:0,expire:void 0};else if(!P.isDev)if(ah)m={revalidate:0,expire:void 0};else if(aO){if(n.cacheControl)if("number"==typeof n.cacheControl.revalidate){if(n.cacheControl.revalidate<1)throw Object.defineProperty(Error(`Invalid revalidate configuration provided: ${n.cacheControl.revalidate} < 1`),"__NEXT_ERROR_CODE",{value:"E22",enumerable:!1,configurable:!0});m={revalidate:n.cacheControl.revalidate,expire:(null==(j=n.cacheControl)?void 0:j.expire)??al.expireTime}}else m={revalidate:y.CACHE_ONE_YEAR_SECONDS,expire:void 0}}else b.getHeader("Cache-Control")||(m={revalidate:0,expire:void 0});if(n.cacheControl=m,"string"==typeof aM&&(null==p?void 0:p.kind)===v.CachedRouteKind.APP_PAGE&&p.segmentData){b.setHeader(t.NEXT_DID_POSTPONE_HEADER,"2");let c=null==(k=p.headers)?void 0:k[y.NEXT_CACHE_TAGS_HEADER];V&&aO&&c&&"string"==typeof c&&b.setHeader(y.NEXT_CACHE_TAGS_HEADER,c);let d=p.segmentData.get(aM);return void 0!==d?(0,B.sendRenderResult)({req:a,res:b,generateEtags:al.generateEtags,poweredByHeader:al.poweredByHeader,result:x.default.fromStatic(d,t.RSC_CONTENT_TYPE_HEADER),cacheControl:n.cacheControl}):(b.statusCode=204,(0,B.sendRenderResult)({req:a,res:b,generateEtags:al.generateEtags,poweredByHeader:al.poweredByHeader,result:x.default.EMPTY,cacheControl:n.cacheControl}))}let s=aP?(0,h.getRequestMeta)(a,"onCacheEntryV2")??(0,h.getRequestMeta)(a,"onCacheEntry"):(0,h.getRequestMeta)(a,"onCacheEntry");if(s){let b=(0,h.getRequestMeta)(a,"initURL")??a.url,c=b?(null==(l=(0,F.parseUrl)(b))?void 0:l.pathname)??b:void 0;if(await s(n,{url:c}))return null}if(p.headers){let a={...p.headers};for(let[c,d]of(V&&aO||delete a[y.NEXT_CACHE_TAGS_HEADER],Object.entries(a)))if(void 0!==d)if(Array.isArray(d))for(let a of d)b.appendHeader(c,a);else"number"==typeof d&&(d=d.toString()),b.appendHeader(c,d)}let u=null==(g=p.headers)?void 0:g[y.NEXT_CACHE_TAGS_HEADER];if(V&&aO&&u&&"string"==typeof u&&b.setHeader(y.NEXT_CACHE_TAGS_HEADER,u),!p.status||az&&aF||(b.statusCode=p.status),!V&&p.status&&H.RedirectStatusCode[p.status]&&az&&(b.statusCode=200),o&&!aL&&b.setHeader(t.NEXT_DID_POSTPONE_HEADER,"1"),az&&!ah){if(void 0===p.rscData){if(p.html.contentType!==t.RSC_CONTENT_TYPE_HEADER)if(al.cacheComponents)return b.statusCode=404,(0,B.sendRenderResult)({req:a,res:b,generateEtags:al.generateEtags,poweredByHeader:al.poweredByHeader,result:x.default.EMPTY,cacheControl:n.cacheControl});else throw Object.defineProperty(new I.InvariantError(`Expected RSC response, got ${p.html.contentType}`),"__NEXT_ERROR_CODE",{value:"E789",enumerable:!1,configurable:!0});return(0,B.sendRenderResult)({req:a,res:b,generateEtags:al.generateEtags,poweredByHeader:al.poweredByHeader,result:p.html,cacheControl:n.cacheControl})}return(0,B.sendRenderResult)({req:a,res:b,generateEtags:al.generateEtags,poweredByHeader:al.poweredByHeader,result:x.default.fromStatic(p.rscData,t.RSC_CONTENT_TYPE_HEADER),cacheControl:n.cacheControl})}let w=p.html;if(aE&&aG){let c=!0===P.isDev?crypto.randomUUID():null;return w.pipeThrough(await (0,A.createInstantTestScriptInsertionTransformStream)(c)),(0,B.sendRenderResult)({req:a,res:b,generateEtags:al.generateEtags,poweredByHeader:al.poweredByHeader,result:w,cacheControl:{revalidate:0,expire:void 0}})}if(!o||V||az)return(0,B.sendRenderResult)({req:a,res:b,generateEtags:al.generateEtags,poweredByHeader:al.poweredByHeader,result:w,cacheControl:n.cacheControl});if(aG||aH)return w.push(new ReadableStream({start(a){a.enqueue(z.ENCODED_TAGS.CLOSED.BODY_AND_HTML),a.close()}})),(0,B.sendRenderResult)({req:a,res:b,generateEtags:al.generateEtags,poweredByHeader:al.poweredByHeader,result:w,cacheControl:{revalidate:0,expire:void 0}});let C=new TransformStream;return w.push(C.readable),q({span:c,postponed:p.postponed,fallbackRouteParams:null,forceStaticRender:!1}).then(async a=>{var b,c;if(!a)throw Object.defineProperty(Error("Invariant: expected a result to be returned"),"__NEXT_ERROR_CODE",{value:"E463",enumerable:!1,configurable:!0});if((null==(b=a.value)?void 0:b.kind)!==v.CachedRouteKind.APP_PAGE)throw Object.defineProperty(Error(`Invariant: expected a page response, got ${null==(c=a.value)?void 0:c.kind}`),"__NEXT_ERROR_CODE",{value:"E305",enumerable:!1,configurable:!0});await a.value.html.pipeTo(C.writable)}).catch(a=>{C.writable.abort(a).catch(a=>{console.error("couldn't abort transformer",a)})}),(0,B.sendRenderResult)({req:a,res:b,generateEtags:al.generateEtags,poweredByHeader:al.poweredByHeader,result:w,cacheControl:{revalidate:0,expire:void 0}})};if(!a$||!aZ)return k=aY.getActiveScopeSpan(),await aY.withPropagatedContext(a.headers,()=>aY.trace(i.BaseServerSpan.handleRequest,{spanName:`${aX} ${W}`,kind:g.SpanKind.SERVER,attributes:{"http.method":aX,"http.target":a.url}},s),void 0,!a$);await s(aZ)}catch(b){throw b instanceof C.NoFallbackError||await P.onRequestError(a,b,{routerKind:"App Router",routePath:W,routeType:"render",revalidateReason:(0,f.c)({isStaticGeneration:aO,isOnDemandRevalidate:ar})},!1,ak),b}}},55511:a=>{"use strict";a.exports=require("crypto")},59436:(a,b,c)=>{"use strict";c.r(b),c.d(b,{default:()=>O});var d=c(48249),e=c(67484),f=c(19099),g=c(2116),h=c.n(g),i=c(81220),j=c(50412),k=c(96919),l=c(91431),m=c(50377),n=c(49885),o=c.n(n);function p({model:a,fullModel:b,alias:c,copied:e,onCopy:f,testStatus:g,isCustom:h,isFree:i,onDeleteAlias:j,onTest:k,isTesting:l,onDisable:m}){let n="ok"===g?"#22c55e":"error"===g?"#ef4444":void 0;return(0,d.jsx)("div",{className:`group min-w-0 max-w-full rounded-lg border px-3 py-2 ${"ok"===g?"border-green-500/40":"error"===g?"border-red-500/40":"border-border"} hover:bg-sidebar/50`,children:(0,d.jsxs)("div",{className:"flex min-w-0 items-start gap-2 sm:items-center",children:[(0,d.jsx)("span",{className:"material-symbols-outlined shrink-0 text-base",style:n?{color:n}:void 0,children:"ok"===g?"check_circle":"error"===g?"cancel":"smart_toy"}),(0,d.jsxs)("div",{className:"flex min-w-0 flex-1 flex-col gap-1",children:[(0,d.jsx)("code",{className:"max-w-[72vw] truncate rounded bg-sidebar px-1.5 py-0.5 font-mono text-xs text-text-muted sm:max-w-[360px]",children:b}),a.name&&(0,d.jsx)("span",{className:"truncate pl-1 text-[9px] italic text-text-muted/70",children:a.name})]}),k&&(0,d.jsxs)("div",{className:"relative shrink-0 group/btn",children:[(0,d.jsx)("button",{onClick:k,disabled:l,className:`rounded p-0.5 text-text-muted transition-opacity hover:bg-sidebar hover:text-primary ${l?"opacity-100":"opacity-100 sm:opacity-0 sm:group-hover:opacity-100"}`,children:(0,d.jsx)("span",{className:"material-symbols-outlined text-sm",style:l?{animation:"spin 1s linear infinite"}:void 0,children:l?"progress_activity":"science"})}),(0,d.jsx)("span",{className:"pointer-events-none absolute mt-1 top-5 left-1/2 -translate-x-1/2 text-[10px] text-text-muted whitespace-nowrap opacity-0 group-hover/btn:opacity-100 transition-opacity",children:l?"Testing...":"Test"})]}),(0,d.jsxs)("div",{className:"relative shrink-0 group/btn",children:[(0,d.jsx)("button",{onClick:()=>f(b,`model-${a.id}`),className:"rounded p-0.5 text-text-muted hover:bg-sidebar hover:text-primary",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-sm",children:e===`model-${a.id}`?"check":"content_copy"})}),(0,d.jsx)("span",{className:"pointer-events-none absolute mt-1 top-5 left-1/2 -translate-x-1/2 text-[10px] text-text-muted whitespace-nowrap opacity-0 group-hover/btn:opacity-100 transition-opacity",children:e===`model-${a.id}`?"Copied!":"Copy"})]}),h?(0,d.jsx)("button",{onClick:j,className:"ml-auto rounded p-0.5 text-text-muted opacity-100 transition-opacity hover:bg-red-500/10 hover:text-red-500 sm:opacity-0 sm:group-hover:opacity-100",title:"Remove custom model",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-sm",children:"close"})}):m?(0,d.jsx)("button",{onClick:m,className:"ml-auto rounded p-0.5 text-text-muted opacity-100 transition-opacity hover:bg-red-500/10 hover:text-red-500 sm:opacity-0 sm:group-hover:opacity-100",title:"Disable this model",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-sm",children:"close"})}):null]})})}function q({modelId:a,fullModel:b,copied:c,onCopy:e,onDeleteAlias:f,onTest:g,testStatus:h,isTesting:i}){let j=`model_support:${a}`,k="ok"===h?"#22c55e":"error"===h?"#ef4444":void 0;return(0,d.jsxs)("div",{className:`flex items-center gap-3 p-3 rounded-lg border ${"ok"===h?"border-green-500/40":"error"===h?"border-red-500/40":"border-border"} hover:bg-sidebar/50`,children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-base text-text-muted",style:k?{color:k}:void 0,children:"ok"===h?"check_circle":"error"===h?"cancel":"smart_toy"}),(0,d.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,d.jsx)("p",{className:"text-sm font-medium truncate",children:a}),(0,d.jsxs)("div",{className:"flex items-center gap-1 mt-1",children:[(0,d.jsx)("code",{className:"text-xs text-text-muted font-mono bg-sidebar px-1.5 py-0.5 rounded",children:b}),(0,d.jsxs)("div",{className:"relative group/btn",children:[(0,d.jsx)("button",{onClick:()=>e(b,`model-${a}`),className:"p-0.5 hover:bg-sidebar rounded text-text-muted hover:text-primary",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-sm",children:c===`model-${a}`?"check":"content_copy"})}),(0,d.jsx)("span",{className:"pointer-events-none absolute top-5 left-1/2 -translate-x-1/2 text-[10px] text-text-muted whitespace-nowrap opacity-0 group-hover/btn:opacity-100 transition-opacity",children:c===`model-${a}`?"Copied!":"Copy"})]}),g&&(0,d.jsxs)("div",{className:"relative group/btn",children:[(0,d.jsx)("button",{onClick:g,disabled:i,className:"p-0.5 hover:bg-sidebar rounded text-text-muted hover:text-primary transition-colors",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-sm",style:i?{animation:"spin 1s linear infinite"}:void 0,children:i?"progress_activity":"science"})}),(0,d.jsx)("span",{className:"pointer-events-none absolute top-5 left-1/2 -translate-x-1/2 text-[10px] text-text-muted whitespace-nowrap opacity-0 group-hover/btn:opacity-100 transition-opacity",children:i?"Testing...":"Test"})]})]}),(0,d.jsxs)("div",{className:"mt-2 flex flex-wrap items-center gap-1.5",children:[(0,d.jsx)("span",{className:"text-[10px] text-text-muted",children:"LAN tag:"}),(0,d.jsx)("code",{className:"rounded bg-primary/10 px-1.5 py-0.5 font-mono text-[10px] text-primary",children:j}),(0,d.jsx)("button",{type:"button",onClick:()=>e(j,`tag-${a}`),className:"rounded px-1 py-0.5 text-[10px] text-text-muted hover:bg-sidebar hover:text-primary",title:"Copy model_support tag",children:c===`tag-${a}`?"Copied":"Copy tag"})]})]}),(0,d.jsx)("button",{onClick:f,className:"p-1 hover:bg-red-50 rounded text-red-500",title:"Remove model",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-sm",children:"delete"})})]})}function r({providerStorageAlias:a,providerDisplayAlias:b,modelAliases:c,copied:f,onCopy:g,onSetAlias:h,onDeleteAlias:i,connections:k,isAnthropic:l}){let[m,n]=(0,e.useState)(""),[o,p]=(0,e.useState)(!1),[s,t]=(0,e.useState)(!1),[u,v]=(0,e.useState)(null),[w,x]=(0,e.useState)({}),y=async b=>{if(!u){v(b);try{let c=await fetch("/api/models/test",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({model:`${a}/${b}`})}),d=await c.json();x(a=>({...a,[b]:d.ok?"ok":"error"}))}catch{x(a=>({...a,[b]:"error"}))}finally{v(null)}}},z=Object.entries(c).filter(([,b])=>b.startsWith(`${a}/`)).map(([b,c])=>({modelId:c.replace(`${a}/`,""),fullModel:c,alias:b})),A=d=>{let e,f=`${a}/${d}`;if(Object.values(c).includes(f))return null;let g=(e=d.split("/"))[e.length-1];if(!c[g])return g;let h=`${b}-${g}`;return c[h]?null:h},B=async()=>{if(!m.trim()||o)return;let b=m.trim(),c=A(b);if(!c)return void alert("All suggested aliases already exist. Please choose a different model or remove conflicting aliases.");p(!0);try{await h(b,c,a),n("")}catch(a){console.log("Error adding model:",a)}finally{p(!1)}},C=async()=>{if(s)return;let b=k.find(a=>!1!==a.isActive);if(b){t(!0);try{let c=await fetch(`/api/providers/${b.id}/models`),d=await c.json();if(!c.ok)return void alert(d.error||"Failed to import models");let e=d.models||[];if(0===e.length)return void alert("No models returned from /models.");let f=0;for(let b of e){let c=b.id||b.name||b.model;if(!c)continue;let d=A(c);d&&(await h(c,d,a),f+=1)}0===f&&alert("No new models were added.")}catch(a){console.log("Error importing models:",a)}finally{t(!1)}}},D=k.some(a=>!1!==a.isActive);return(0,d.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,d.jsxs)("p",{className:"text-sm text-text-muted",children:["Add ",l?"Anthropic":"OpenAI","-compatible models manually or import them from the /models endpoint. Each model also shows a ",(0,d.jsx)("code",{className:"rounded bg-sidebar px-1 py-0.5 font-mono text-xs",children:"model_support:*"})," tag you can paste into an Ollama endpoint label for Combo tag routing."]}),(0,d.jsxs)("div",{className:"flex items-end gap-2 flex-wrap",children:[(0,d.jsxs)("div",{className:"flex-1 min-w-[240px]",children:[(0,d.jsx)("label",{htmlFor:"new-compatible-model-input",className:"text-xs text-text-muted mb-1 block",children:"Model ID"}),(0,d.jsx)("input",{id:"new-compatible-model-input",type:"text",value:m,onChange:a=>n(a.target.value),onKeyDown:a=>"Enter"===a.key&&B(),placeholder:l?"claude-3-opus-20240229":"gpt-4o",className:"w-full px-3 py-2 text-sm border border-border rounded-lg bg-background focus:outline-none focus:border-primary"})]}),(0,d.jsx)(j.$n,{size:"sm",icon:"add",onClick:B,disabled:!m.trim()||o,children:o?"Adding...":"Add"}),(0,d.jsx)(j.$n,{size:"sm",variant:"secondary",icon:"download",onClick:C,disabled:!D||s,children:s?"Importing...":"Import from /models"})]}),!D&&(0,d.jsx)("p",{className:"text-xs text-text-muted",children:"Add a connection to enable importing models."}),z.length>0&&(0,d.jsx)("div",{className:"flex flex-col gap-3",children:z.map(({modelId:a,fullModel:c,alias:e})=>(0,d.jsx)(q,{modelId:a,fullModel:`${b}/${a}`,copied:f,onCopy:g,onDeleteAlias:()=>i(e),onTest:k.length>0?()=>y(a):void 0,testStatus:w[a],isTesting:u===a},c))})]})}function s({until:a}){let[b,c]=(0,e.useState)("");return b?(0,d.jsxs)("span",{className:"text-xs text-orange-500 font-mono",children:["⏱ ",b]}):null}function t(a){if(!a)return"never";try{return new Date(a).toLocaleString()}catch{return a}}function u(a={}){let b=a&&"object"==typeof a?a:{};return{enabled:!0===b.enabled,intervalSec:Math.max(10,Number.parseInt(b.intervalSec||60,10)||60),failureThreshold:Math.max(1,Number.parseInt(b.failureThreshold||3,10)||3),timeoutMs:Math.max(1e3,Number.parseInt(b.timeoutMs||15e3,10)||15e3),prompt:b.prompt||"Say hi",disableThinking:!1!==b.disableThinking}}function v({connection:a,proxyPools:b,isOAuth:c,isFirst:f,isLast:g,onMoveUp:h,onMoveDown:i,onToggleActive:k,onUpdateProxy:l,onEdit:m,onDelete:n,oneByOneStatus:o=null,providerHealthConfig:p=null,healthCheckRunning:q=!1,onRunHealthCheck:r=null}){let[w,x]=(0,e.useState)(!1),[y,z]=(0,e.useState)(!1),A=(0,e.useRef)(null),B=new Map((b||[]).map(a=>[a.id,a])),C=a.providerSpecificData?.proxyPoolId||null,D=C?B.get(C):null,E=a.providerSpecificData?.connectionProxyEnabled===!0&&!!a.providerSpecificData?.connectionProxyUrl,F=!!C||E,G=D?`Pool: ${D.name}`:C?`Pool: ${C} (inactive/missing)`:E?`Legacy: ${a.providerSpecificData?.connectionProxyUrl}`:"",H="";if(D?.proxyUrl||a.providerSpecificData?.connectionProxyUrl){let b=D?.proxyUrl||a.providerSpecificData?.connectionProxyUrl;try{let a=new URL(b);H=`${a.protocol}//${a.hostname}${a.port?`:${a.port}`:""}`}catch{H=b}}let I=D?.noProxy||a.providerSpecificData?.connectionNoProxy||"",J=function(a={}){let b=a.tags||a.labels||a.providerSpecificData?.routingTags||a.providerSpecificData?.tags||a.providerSpecificData?.labels||[];return Array.isArray(b)?b.map(a=>String(a||"").trim()).filter(Boolean):"string"==typeof b?b.split(/[\n,;\s]+/).map(a=>a.trim()).filter(Boolean):b&&"object"==typeof b?Object.entries(b).filter(([,a])=>!1!==a&&null!=a).map(([a,b])=>!0===b?a:`${a}:${b}`):[]}(a),K=a.providerSpecificData?.maxInFlight||a.maxInFlight||null,L="default";D?.isActive===!0?L="success":(C||E)&&(L="error");let M=async a=>{z(!0);try{await l("__none__"===a?null:a)}finally{z(!1),x(!1)}},N=a.authType||(c?"oauth":"apikey"),O="oauth"===N,P="cookie"===N,Q=a=>"string"==typeof a&&/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(a),R=O?Q(a.email)?a.email:Q(a.name)?a.name:a.name||a.email||a.displayName||"OAuth Account":a.name||a.email||a.displayName||"API Key",[S,T]=(0,e.useState)(!1),U=Object.entries(a).filter(([a])=>a.startsWith("modelLock_")).map(([,a])=>a).filter(a=>!!a).sort()[0]||null,V="unavailable"!==a.testStatus||S?a.testStatus:"active",W=()=>o?"queued"===o.state?"queued":"testing"===o.state?"testing":"success"===o.state?"success":"failed"===o.state?o.error?`failed: ${o.error}`:"failed":null:null,X=function(a={},b=null){let c=b&&"object"==typeof b?b:{};return!0===c.overrideConnections?{healthCheck:u(c.healthCheck||c),source:"provider",override:!0}:{healthCheck:u(a.healthCheck||{}),source:"account",override:!1}}(a,p),Y=X.healthCheck,Z=!0===Y.enabled,$=a.healthStatus||"unknown",_=Number(a.healthConsecutiveFailures||0),aa=Number(Y.failureThreshold||3),ab=Z?"degraded"===$?`Health: Degraded ${_}/${aa}`:"dead"===$?"Health: Dead":"alive"===$?"Health: Alive":"Health: Unknown":"Health: off";return(0,d.jsxs)("div",{className:`group flex min-w-0 flex-col gap-3 rounded-lg p-2 transition-colors hover:bg-black/[0.02] dark:hover:bg-white/[0.02] sm:flex-row sm:items-center sm:justify-between ${!1===a.isActive?"opacity-60":""}`,children:[(0,d.jsxs)("div",{className:"flex min-w-0 flex-1 items-start gap-2 sm:items-center sm:gap-3",children:[(0,d.jsxs)("div",{className:"flex shrink-0 flex-col",children:[(0,d.jsx)("button",{onClick:h,disabled:f,className:`p-0.5 rounded ${f?"text-text-muted/30 cursor-not-allowed":"hover:bg-sidebar text-text-muted hover:text-primary"}`,children:(0,d.jsx)("span",{className:"material-symbols-outlined text-sm",children:"keyboard_arrow_up"})}),(0,d.jsx)("button",{onClick:i,disabled:g,className:`p-0.5 rounded ${g?"text-text-muted/30 cursor-not-allowed":"hover:bg-sidebar text-text-muted hover:text-primary"}`,children:(0,d.jsx)("span",{className:"material-symbols-outlined text-sm",children:"keyboard_arrow_down"})})]}),(0,d.jsx)("span",{className:"material-symbols-outlined shrink-0 text-base text-text-muted",children:P?"cookie":O?"lock":"key"}),(0,d.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,d.jsx)("p",{className:"text-sm font-medium truncate",children:R}),(0,d.jsxs)("div",{className:"mt-1 flex min-w-0 flex-wrap items-center gap-1.5 sm:gap-2",children:[(0,d.jsx)(j.Ex,{variant:!1===a.isActive?"default":"active"===V||"success"===V?"success":"error"===V||"expired"===V||"unavailable"===V?"error":"default",size:"sm",dot:!0,children:!1===a.isActive?"disabled":V||"Unknown"}),(0,d.jsx)(j.Ex,{variant:"default",size:"sm",children:O?"OAuth":P?"Cookie":"API Key"}),F&&(0,d.jsx)(j.Ex,{variant:L,size:"sm",children:"Proxy"}),K&&(0,d.jsxs)(j.Ex,{variant:"default",size:"sm",children:["max ",K," in-flight"]}),J.slice(0,3).map(a=>(0,d.jsx)(j.Ex,{variant:"primary",size:"sm",children:a},a)),J.length>3&&(0,d.jsxs)(j.Ex,{variant:"default",size:"sm",children:["+",J.length-3," tags"]}),S&&!1!==a.isActive&&(0,d.jsx)(s,{until:U}),a.lastError&&!1!==a.isActive&&(0,d.jsx)("span",{className:"max-w-full truncate text-xs text-red-500 sm:max-w-[300px]",title:a.lastError,children:a.lastError}),(0,d.jsxs)("span",{className:"text-xs text-text-muted",children:["#",a.priority]}),a.globalPriority&&(0,d.jsxs)("span",{className:"text-xs text-text-muted",children:["Auto: ",a.globalPriority]}),W()&&(0,d.jsx)(j.Ex,{variant:o?"success"===o.state?"success":"failed"===o.state?"error":"testing"===o.state?"primary":"default":"default",size:"sm",children:W()})]}),(0,d.jsxs)("div",{className:"mt-2 flex flex-wrap items-center gap-2 text-xs text-text-muted",children:[" ",(0,d.jsx)(j.Ex,{variant:"alive"===$?"success":"dead"===$?"error":"default",children:ab})," ",(0,d.jsx)("span",{children:X.override?"provider policy":"account policy"})," ",(0,d.jsxs)("span",{children:["last check: ",t(a.healthLastCheckedAt)]})," ",null!=a.healthLastLatencyMs&&(0,d.jsxs)("span",{children:[a.healthLastLatencyMs,"ms"]})," ",a.healthLastRecoveredAt&&(0,d.jsxs)("span",{children:["recovered: ",t(a.healthLastRecoveredAt)]})," ",a.healthLastError&&(0,d.jsx)("span",{className:"text-red-500",children:a.healthLastError})," ",(0,d.jsx)("button",{type:"button",onClick:r||void 0,disabled:!r||q,className:"rounded border border-border px-2 py-1 text-xs text-text-main transition-colors hover:border-primary hover:text-primary disabled:cursor-not-allowed disabled:opacity-50",children:q?"Checking...":"Run health check now"})," "]})," ",J.length>0&&(0,d.jsxs)("div",{className:"mt-1 flex items-center gap-1.5 flex-wrap",children:[(0,d.jsx)("span",{className:"text-[11px] text-text-muted",children:"routing tags:"}),J.map(a=>(0,d.jsx)("code",{className:"rounded bg-primary/10 px-1 py-0.5 font-mono text-[10px] text-primary",children:a},a))]}),F&&(0,d.jsxs)("div",{className:"mt-1 flex items-center gap-2 flex-wrap",children:[(0,d.jsx)("span",{className:"max-w-full truncate text-[11px] text-text-muted sm:max-w-[420px]",title:G,children:G}),H&&(0,d.jsx)("code",{className:"max-w-full truncate rounded bg-black/5 px-1 py-0.5 font-mono text-[10px] text-text-muted dark:bg-white/5 sm:max-w-[260px]",children:H}),I&&(0,d.jsxs)("span",{className:"max-w-full truncate text-[11px] text-text-muted sm:max-w-[320px]",title:I,children:["no_proxy: ",I]})]})]})]}),(0,d.jsxs)("div",{className:"flex w-full items-center justify-between gap-2 sm:w-auto sm:justify-end",children:[(0,d.jsxs)("div",{className:"grid flex-1 grid-cols-3 gap-1 sm:flex sm:flex-none",children:[(b||[]).length>0&&(0,d.jsxs)("div",{className:"relative",ref:A,children:[(0,d.jsxs)("button",{onClick:()=>x(a=>!a),className:`flex w-full flex-col items-center rounded px-2 py-1 transition-colors hover:bg-black/5 dark:hover:bg-white/5 ${F?"text-primary":"text-text-muted hover:text-primary"}`,disabled:y,children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:y?"progress_activity":"lan"}),(0,d.jsx)("span",{className:"text-[10px] leading-tight",children:"Proxy"})]}),w&&(0,d.jsxs)("div",{className:"absolute right-0 top-full z-50 mt-1 max-w-[78vw] min-w-[160px] rounded-lg border border-border bg-bg py-1 shadow-lg",children:[(0,d.jsx)("button",{onClick:()=>M("__none__"),className:`w-full text-left px-3 py-1.5 text-sm hover:bg-black/5 dark:hover:bg-white/5 ${!C?"text-primary font-medium":"text-text-main"}`,children:"None"}),(b||[]).map(a=>(0,d.jsx)("button",{onClick:()=>M(a.id),className:`w-full text-left px-3 py-1.5 text-sm hover:bg-black/5 dark:hover:bg-white/5 ${C===a.id?"text-primary font-medium":"text-text-main"}`,children:a.name},a.id))]})]}),(0,d.jsxs)("button",{onClick:m,className:"flex flex-col items-center rounded px-2 py-1 text-text-muted hover:bg-black/5 hover:text-primary dark:hover:bg-white/5",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"edit"}),(0,d.jsx)("span",{className:"text-[10px] leading-tight",children:"Edit"})]}),(0,d.jsxs)("button",{onClick:n,className:"flex flex-col items-center rounded px-2 py-1 text-red-500 hover:bg-red-500/10",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"delete"}),(0,d.jsx)("span",{className:"text-[10px] leading-tight",children:"Delete"})]})]}),(0,d.jsx)(j.lM,{size:"sm",checked:a.isActive??!0,onChange:k,title:a.isActive??!0?"Disable connection":"Enable connection"})]})]})}p.propTypes={model:o().shape({id:o().string.isRequired}).isRequired,fullModel:o().string.isRequired,alias:o().string,copied:o().string,onCopy:o().func.isRequired,testStatus:o().oneOf(["ok","error"]),isCustom:o().bool,isFree:o().bool,onDeleteAlias:o().func,onTest:o().func,isTesting:o().bool,onDisable:o().func},o().string.isRequired,o().string.isRequired,o().string,o().func.isRequired,o().func.isRequired,o().func,o().oneOf(["ok","error"]),o().bool,o().string.isRequired,o().object.isRequired,o().string,o().func.isRequired,o().func.isRequired,o().func.isRequired,r.propTypes={providerStorageAlias:o().string.isRequired,providerDisplayAlias:o().string.isRequired,modelAliases:o().object.isRequired,copied:o().string,onCopy:o().func.isRequired,onSetAlias:o().func.isRequired,onDeleteAlias:o().func.isRequired,connections:o().arrayOf(o().shape({id:o().string,isActive:o().bool})).isRequired,isAnthropic:o().bool},s.propTypes={until:o().string.isRequired},v.propTypes={connection:o().shape({id:o().string,name:o().string,email:o().string,displayName:o().string,modelLockUntil:o().string,testStatus:o().string,isActive:o().bool,lastError:o().string,priority:o().number,globalPriority:o().number,providerSpecificData:o().object,tags:o().oneOfType([o().string,o().array]),labels:o().oneOfType([o().string,o().array]),maxInFlight:o().oneOfType([o().string,o().number]),healthCheck:o().object,healthStatus:o().string,healthConsecutiveFailures:o().number,healthLastCheckedAt:o().string,healthLastOkAt:o().string,healthLastRecoveredAt:o().string,healthLastLatencyMs:o().number,healthLastError:o().string}).isRequired,proxyPools:o().arrayOf(o().shape({id:o().string,name:o().string,proxyUrl:o().string,noProxy:o().string,isActive:o().bool})),isOAuth:o().bool.isRequired,isFirst:o().bool.isRequired,isLast:o().bool.isRequired,onMoveUp:o().func.isRequired,onMoveDown:o().func.isRequired,onToggleActive:o().func.isRequired,onUpdateProxy:o().func,onEdit:o().func.isRequired,onDelete:o().func.isRequired,oneByOneStatus:o().shape({state:o().string,error:o().string}),providerHealthConfig:o().object,healthCheckRunning:o().bool,onRunHealthCheck:o().func};var w=c(12020),x=c(73050);let y=[{value:1,label:"T2"},{value:2,label:"T3"},{value:3,label:"T4"},{value:4,label:"T5"},{value:5,label:"T6"},{value:6,label:"T7"},{value:0,label:"CN"}],z=[0,1,2,3,4,5,6],A={enabled:!0,weekdays:z,fromTime:"00:00",toTime:"23:59"},B={enabled:!1,intervalSec:60,failureThreshold:3,timeoutMs:15e3,prompt:"Say hi",disableThinking:!0,model:""};function C(a,b){let c=String(a||"").trim();return/^([01]\d|2[0-3]):([0-5]\d)$/.test(c)?c:b}function D(a={}){let b=a&&"object"==typeof a?a:{},c=Array.isArray(b.weekdays)?b.weekdays.map(Number).filter(a=>a>=0&&a<=6):z;return{enabled:!1!==b.enabled,weekdays:[...new Set(c)].sort((a,b)=>a-b),fromTime:C(b.fromTime||b.from,"00:00"),toTime:C(b.toTime||b.to,"23:59")}}function E(a={}){return{overrideConnections:!0===a.overrideConnections,schedule:D(a.schedule||A)}}function F(a={}){var b;let c=a&&"object"==typeof a?a:{};return{enabled:!0===c.enabled,intervalSec:Math.max(10,Number.parseInt(c.intervalSec||B.intervalSec,10)||B.intervalSec),failureThreshold:Math.max(1,Number.parseInt(c.failureThreshold||B.failureThreshold,10)||B.failureThreshold),timeoutMs:Math.max(1e3,Number.parseInt(c.timeoutMs||B.timeoutMs,10)||B.timeoutMs),prompt:"string"==typeof c.prompt&&c.prompt.trim()?c.prompt.trim():B.prompt,disableThinking:!1!==c.disableThinking,model:"string"==typeof(b=c.model||c.healthModel||c.testModel)?b.trim():""}}function G(a={}){return{overrideConnections:!0===a.overrideConnections,healthCheck:F(a.healthCheck||a||B)}}function H(){return"text-xs font-medium text-text-muted"}function I(){return"mt-1 w-full rounded-lg border border-border bg-background px-3 py-2 text-sm text-text-main outline-none focus:border-primary disabled:cursor-not-allowed disabled:opacity-50"}function J({providerId:a,onSaved:b}){let[c,f]=(0,e.useState)(E()),[g,h]=(0,e.useState)(G()),[i,j]=(0,e.useState)([]),[l,m]=(0,e.useState)(!1),[n,o]=(0,e.useState)(""),[p,q]=(0,e.useState)(!0),[r,s]=(0,e.useState)(!1),[t,u]=(0,e.useState)(!1),v=function(a=""){if((0,k.gb)(a))return"anthropic";if((0,k.mq)(a)||"cloudflare-ai"===a)return"openai";if("gemini"===a)return"gemini";if("github"===a)return"openai";let b=w.X3?.[a]||"";return b.includes("/messages")?"anthropic":b.includes("/chat/completions")||b.includes("/responses")?"openai":null}(a),A=!!v,B="anthropic"===v,C=(0,x.wB)(i,g.healthCheck.model),K=a=>{f(b=>({...b,schedule:D({...b.schedule,...a})})),u(!1)},L=a=>{h(b=>({...b,healthCheck:F({...b.healthCheck,...a})})),u(!1)},M=async()=>{s(!0),u(!1);try{let d=await fetch("/api/settings",{cache:"no-store"}),e=d.ok?await d.json():{},f={...e.providerSchedules||{},[a]:E(c)},h={...e.providerHealthChecks||{},[a]:G(g)};(await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({providerSchedules:f,providerHealthChecks:h})})).ok&&(u(!0),"function"==typeof b&&await b())}finally{s(!1)}};return p?null:(0,d.jsxs)("div",{className:"rounded-2xl border border-border bg-card p-4",children:[(0,d.jsxs)("div",{className:"mb-5",children:[(0,d.jsx)("h3",{className:"text-sm font-semibold text-text-main",children:"Ghi đ\xe8 lịch cho Provider"}),(0,d.jsx)("p",{className:"mt-1 text-xs text-text-muted",children:"Khi bật, mọi t\xe0i khoản trong provider n\xe0y sẽ d\xf9ng lịch cấp provider; lịch ri\xeang của từng t\xe0i khoản sẽ bị kh\xf3a."})]}),(0,d.jsxs)("label",{className:"mb-4 flex items-center gap-2 text-sm text-text-main",children:[(0,d.jsx)("input",{type:"checkbox",checked:c.overrideConnections,onChange:a=>{f(b=>({...b,overrideConnections:a.target.checked})),u(!1)}}),"Ghi đ\xe8 to\xe0n bộ t\xe0i khoản"]}),(0,d.jsxs)("div",{className:"mb-5 space-y-3",children:[(0,d.jsx)("p",{className:H(),children:"Ng\xe0y trong tuần"}),(0,d.jsx)("div",{className:"flex flex-wrap gap-2",children:y.map(a=>(0,d.jsxs)("label",{className:"flex items-center gap-1.5 rounded-lg border border-border px-2.5 py-1.5 text-xs text-text-main",children:[(0,d.jsx)("input",{type:"checkbox",checked:c.schedule.weekdays.includes(a.value),onChange:()=>{var b;return b=a.value,void(f(a=>{let c=new Set(Array.isArray(a.schedule.weekdays)?a.schedule.weekdays:z);return c.has(b)?c.delete(b):c.add(b),{...a,schedule:{...a.schedule,weekdays:[...c].sort((a,b)=>a-b)}}}),u(!1))}}),a.label]},a.value))}),!1!==c.schedule.enabled&&0===c.schedule.weekdays.length&&(0,d.jsx)("p",{className:"text-xs text-yellow-500",children:"Chưa chọn ng\xe0y n\xe0o. Lịch provider n\xe0y sẽ l\xe0m c\xe1c t\xe0i khoản kh\xf4ng khả dụng cho đến khi chọn \xedt nhất một ng\xe0y."})]}),(0,d.jsxs)("div",{className:"mb-6 grid gap-3 sm:grid-cols-2",children:[(0,d.jsxs)("label",{className:H(),children:["Từ giờ",(0,d.jsx)("input",{type:"time",value:c.schedule.fromTime,onChange:a=>K({fromTime:a.target.value}),className:I()})]}),(0,d.jsxs)("label",{className:H(),children:["Đến giờ",(0,d.jsx)("input",{type:"time",value:c.schedule.toTime,onChange:a=>K({toTime:a.target.value}),className:I()})]})]}),(0,d.jsxs)("div",{className:"mb-5 border-t border-border pt-5",children:[(0,d.jsx)("h3",{className:"text-sm font-semibold text-text-main",children:"Ghi đ\xe8 Health Check cho Provider"}),(0,d.jsx)("p",{className:"mt-1 text-xs text-text-muted",children:"Khi bật, mọi t\xe0i khoản trong provider n\xe0y sẽ d\xf9ng c\xf9ng ch\xednh s\xe1ch ping định kỳ; cấu h\xecnh health ri\xeang của từng t\xe0i khoản sẽ bị kh\xf3a."})]}),(0,d.jsxs)("div",{className:"mb-4 flex flex-col gap-2 sm:flex-row sm:items-center sm:gap-5",children:[(0,d.jsxs)("label",{className:"flex items-center gap-2 text-sm text-text-main",children:[(0,d.jsx)("input",{type:"checkbox",checked:g.overrideConnections,onChange:a=>{h(b=>({...b,overrideConnections:a.target.checked})),u(!1)}}),"Ghi đ\xe8 to\xe0n bộ t\xe0i khoản"]}),(0,d.jsxs)("label",{className:"flex items-center gap-2 text-sm text-text-main",children:[(0,d.jsx)("input",{type:"checkbox",checked:g.healthCheck.enabled,onChange:a=>L({enabled:a.target.checked})}),"Bật healthcheck ping định kỳ"]})]}),g.healthCheck.enabled&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("label",{className:H(),children:["Healthcheck model",(0,d.jsxs)("select",{value:g.healthCheck.model||"",onChange:a=>L({model:a.target.value}),className:I(),disabled:l,children:[(0,d.jsx)("option",{value:"",children:"Chỉ kiểm tra connection/base URL — kh\xf4ng ping chat"}),C.map(a=>(0,d.jsx)("option",{value:a.id,children:a.name||a.id},a.id))]})]}),(0,d.jsxs)("label",{className:`${H()} mt-3 block`,children:["Nhập model healthcheck thủ c\xf4ng",(0,d.jsx)("input",{value:g.healthCheck.model||"",onChange:a=>L({model:a.target.value}),placeholder:B?"t\xean model Claude từ endpoint n\xe0y":"gemini"===v?"model Gemini, v\xed dụ gemini-2.5-flash":"t\xean model từ Available Models",className:I(),disabled:l})]}),l&&(0,d.jsx)("p",{className:"mt-2 text-xs text-text-muted",children:"Đang tải Available Models cục bộ..."}),n&&(0,d.jsxs)("p",{className:"mt-2 text-xs text-yellow-500",children:["Ghi ch\xfa danh s\xe1ch model: ",n]}),!l&&!n&&(0,d.jsx)("p",{className:"mt-2 text-xs text-text-muted",children:"Danh s\xe1ch model được lấy từ Available Models / DB cục bộ, kh\xf4ng gọi API /models của provider."}),B&&(0,d.jsxs)("p",{className:"mt-2 text-xs text-text-muted",children:["Healthcheck tương th\xedch Anthropic gửi ",(0,d.jsx)("code",{children:"Say hi"})," tới ",(0,d.jsx)("code",{children:"/v1/messages"})," chỉ khi đ\xe3 chọn model."]}),"gemini"===v&&(0,d.jsxs)("p",{className:"mt-2 text-xs text-text-muted",children:["Healthcheck Gemini gửi ",(0,d.jsx)("code",{children:"Say hi"})," bằng API native ",(0,d.jsx)("code",{children:"generateContent"})," chỉ khi đ\xe3 chọn model."]}),"cloudflare-ai"===a&&(0,d.jsxs)("p",{className:"mt-2 text-xs text-text-muted",children:["Healthcheck Cloudflare gửi ",(0,d.jsx)("code",{children:"Say hi"})," tới Workers AI OpenAI-style chat endpoint chỉ khi đ\xe3 chọn model."]}),!A&&(0,d.jsx)("p",{className:"mt-2 text-xs text-text-muted",children:"Provider n\xe0y vẫn c\xf3 thể hiển thị Available Models cục bộ. Auto healthcheck sẽ tiếp tục d\xf9ng kiểm tra connection/token/account gốc cho đến khi c\xf3 direct chat endpoint."})]}),g.healthCheck.enabled&&(!A||!g.healthCheck.model)&&(0,d.jsx)("p",{className:"mt-4 rounded-lg border border-border bg-sidebar/40 px-3 py-2 text-xs text-text-muted",children:"Chưa bật model/endpoint direct chat healthcheck. Auto healthcheck sẽ kiểm tra connection/base URL/key/token/account v\xe0 kh\xf4ng gửi ping chat Say hi."}),(0,d.jsxs)("div",{className:"mt-4 grid gap-3 sm:grid-cols-3",children:[(0,d.jsxs)("label",{className:H(),children:["Chu kỳ (gi\xe2y)",(0,d.jsx)("input",{type:"number",min:"10",value:g.healthCheck.intervalSec,onChange:a=>L({intervalSec:Math.max(10,Number.parseInt(a.target.value,10)||60)}),className:I()})]}),(0,d.jsxs)("label",{className:H(),children:["Ngưỡng lỗi",(0,d.jsx)("input",{type:"number",min:"1",value:g.healthCheck.failureThreshold,onChange:a=>L({failureThreshold:Math.max(1,Number.parseInt(a.target.value,10)||3)}),className:I()})]}),(0,d.jsxs)("label",{className:H(),children:["Timeout (ms)",(0,d.jsx)("input",{type:"number",min:"1000",value:g.healthCheck.timeoutMs,onChange:a=>L({timeoutMs:Math.max(1e3,Number.parseInt(a.target.value,10)||15e3)}),className:I()})]})]}),(0,d.jsxs)("label",{className:`${H()} mt-3 block`,children:["Prompt",(0,d.jsx)("input",{value:g.healthCheck.prompt,onChange:a=>L({prompt:a.target.value}),className:I()})]}),(0,d.jsxs)("label",{className:"mt-3 flex items-center gap-2 text-sm text-text-main",children:[(0,d.jsx)("input",{type:"checkbox",checked:g.healthCheck.disableThinking,onChange:a=>L({disableThinking:a.target.checked})}),"Force lightweight test payload / disable thinking when provider supports it"]}),(0,d.jsxs)("div",{className:"mt-5 flex items-center gap-3",children:[(0,d.jsx)("button",{type:"button",onClick:M,disabled:r,className:"rounded-lg bg-primary px-4 py-2 text-sm font-medium text-white transition-colors hover:opacity-90 disabled:cursor-not-allowed disabled:opacity-60",children:r?"Đang lưu...":"Lưu ch\xednh s\xe1ch Provider"}),t&&(0,d.jsx)("span",{className:"text-xs font-medium text-green-500",children:"Đ\xe3 lưu"})]})]})}let K=`name1|sk-key1
|
|
3
3
|
name2|sk-key2
|
|
4
|
-
sk-key-only-auto-named`;function I({isOpen:a,provider:b,providerName:c,isCompatible:f,isAnthropic:g,authType:h,authHint:i,website:l,proxyPools:m,error:n,onSave:o,onBulkDone:p,onClose:q}){let r="__none__",s="ollama-local"===b,t="cookie"===h,u="xai"===b&&!t,v=t?"Cookie Value":"API Key",w="azure"===b,x="cloudflare-ai"===b,y=k.Q2?.[b]?.regions||null,z=k.Q2?.[b]?.defaultRegion||y?.[0]?.id||"",[A,B]=(0,e.useState)({name:"",apiKey:"",defaultModel:"",priority:1,proxyPoolId:r,ollamaHostUrl:""}),[C,D]=(0,e.useState)({azureEndpoint:"",apiVersion:"2024-10-01-preview",deployment:"",organization:""}),[E,F]=(0,e.useState)({accountId:""}),[G,J]=(0,e.useState)(z),[K,L]=(0,e.useState)(!1),[M,N]=(0,e.useState)(null),[O,P]=(0,e.useState)(!1),[Q,R]=(0,e.useState)("single"),[S,T]=(0,e.useState)(""),[U,V]=(0,e.useState)(null),W=()=>s&&A.ollamaHostUrl.trim()?{baseUrl:A.ollamaHostUrl.trim()}:w?{azureEndpoint:C.azureEndpoint,apiVersion:C.apiVersion,deployment:C.deployment,organization:C.organization}:x?{accountId:E.accountId}:y&&G?{region:G}:void 0,X=async()=>{L(!0);try{let a=await fetch("/api/providers/validate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:b,apiKey:A.apiKey,providerSpecificData:W()})}),c=await a.json();N(c.valid?"success":"failed")}catch{N("failed")}finally{L(!1)}},Y=async()=>{if(b&&(s||A.apiKey)&&(s||A.name)&&(!f||A.defaultModel.trim())){P(!0);try{let a=!1;try{L(!0),N(null);let c=await fetch("/api/providers/validate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:b,apiKey:A.apiKey,providerSpecificData:W()})});a=!!(await c.json()).valid,N(a?"success":"failed")}catch{N("failed")}finally{L(!1)}await o({name:A.name||(s?"Ollama Local":""),apiKey:A.apiKey,defaultModel:f?A.defaultModel.trim():void 0,priority:A.priority,proxyPoolId:A.proxyPoolId===r?null:A.proxyPoolId,testStatus:a?"active":"unknown",providerSpecificData:W()})}finally{P(!1)}}},Z=async()=>{let a=S.split("\n").map(a=>a.trim()).filter(Boolean);if(!a.length)return;P(!0),V(null);let c=0,d=0;for(let e=0;e<a.length;e++){let f=a[e].split("|"),g=f.length>=2?f.slice(1).join("|").trim():f[0].trim(),h=f.length>=2?f[0].trim():"Key",i=`${h} ${e+1}`;try{(await fetch("/api/providers",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:b,apiKey:g,name:i,priority:1,testStatus:"unknown"})})).ok?c++:d++}catch{d++}}P(!1),V({success:c,failed:d}),c>0&&p&&p()};return b?(0,d.jsx)(j.aF,{isOpen:a,title:`Add ${c||b} ${v}`,onClose:q,children:(0,d.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,d.jsxs)("div",{className:"flex gap-2",children:[(0,d.jsx)(j.$n,{size:"sm",variant:"single"===Q?"primary":"ghost",onClick:()=>{R("single"),V(null)},children:"Single"}),(0,d.jsx)(j.$n,{size:"sm",variant:"bulk"===Q?"primary":"ghost",onClick:()=>{R("bulk"),V(null)},children:"Bulk Add"})]}),"bulk"===Q&&(0,d.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,d.jsxs)("p",{className:"text-xs text-text-muted",children:["One key per line. Format: ",(0,d.jsx)("code",{children:"name|apiKey"})," or just ",(0,d.jsx)("code",{children:"apiKey"})," (auto-named by index)."]}),(0,d.jsx)("textarea",{className:"w-full rounded border border-accent/30 bg-sidebar p-2 text-sm font-mono resize-y min-h-[140px] focus:outline-none focus:ring-1 focus:ring-primary",placeholder:H,value:S,onChange:a=>T(a.target.value)}),U&&(0,d.jsxs)("div",{className:`text-sm font-medium ${U.failed>0?"text-yellow-400":"text-green-400"}`,children:["✓ ",U.success," added",U.failed>0?`, ✗ ${U.failed} failed`:""]}),(0,d.jsxs)("div",{className:"flex gap-2",children:[(0,d.jsx)(j.$n,{onClick:Z,fullWidth:!0,disabled:O||!S.trim(),children:O?"Adding...":"Add All Keys"}),(0,d.jsx)(j.$n,{onClick:q,variant:"ghost",fullWidth:!0,children:"Cancel"})]})]}),"single"===Q&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(j.pd,{label:"Name",value:A.name,onChange:a=>B({...A,name:a.target.value}),placeholder:s?"Ollama Local":"Production Key"}),s&&(0,d.jsxs)("div",{className:"flex gap-2",children:[(0,d.jsx)(j.pd,{label:"Ollama Host URL",value:A.ollamaHostUrl,onChange:a=>B({...A,ollamaHostUrl:a.target.value}),placeholder:"http://localhost:11434",className:"flex-1"}),(0,d.jsx)("div",{className:"pt-6",children:(0,d.jsx)(j.$n,{onClick:X,disabled:K||O,variant:"secondary",children:K?"Checking...":"Check"})})]}),!s&&(0,d.jsxs)("div",{className:"flex gap-2",children:[(0,d.jsx)(j.pd,{label:v,type:t?"text":"password",value:A.apiKey,onChange:a=>B({...A,apiKey:a.target.value}),placeholder:t?"grok-web"===b?"sso=xxxxx... or just the raw value":"eyJhbGciOi...":u?"xai-...":"",className:"flex-1"}),(0,d.jsx)("div",{className:"pt-6",children:(0,d.jsx)(j.$n,{onClick:X,disabled:!A.apiKey||K||O,variant:"secondary",children:K?"Checking...":"Check"})})]}),u&&(0,d.jsx)("p",{className:"text-xs text-text-muted",children:"Use a direct xAI API key from console.x.ai. This is separate from Grok Build OAuth."}),t&&i&&(0,d.jsxs)("p",{className:"text-xs text-text-muted",children:[i,l&&(0,d.jsxs)(d.Fragment,{children:[" ",(0,d.jsxs)("a",{href:l,target:"_blank",rel:"noopener noreferrer",className:"text-primary underline",children:["Open ",l.replace(/^https?:\/\//,"")]})]})]}),y&&(0,d.jsx)(j.l6,{label:"Region",value:G,onChange:a=>J(a.target.value),options:y.map(a=>({value:a.id,label:a.label}))}),f&&(0,d.jsx)(j.pd,{label:"Default Model",value:A.defaultModel,onChange:a=>B({...A,defaultModel:a.target.value}),placeholder:g?"claude-3-5-sonnet-latest":"gpt-4o-mini"}),s&&(0,d.jsxs)("p",{className:"text-xs text-text-muted",children:["Leave blank to use ",(0,d.jsx)("code",{children:"http://localhost:11434"}),". For remote Ollama, enter the full host URL (e.g. ",(0,d.jsx)("code",{children:"http://192.168.1.10:11434"}),")."]}),M&&(0,d.jsx)(j.Ex,{variant:"success"===M?"success":"error",children:"success"===M?"Valid":"Invalid"}),n&&(0,d.jsx)("p",{className:"text-xs text-red-500 break-words",children:n}),f&&(0,d.jsx)("p",{className:"text-xs text-text-muted",children:"Enter the model ID exactly as your compatible endpoint expects it. This model will be saved as the connection default."}),x&&(0,d.jsxs)("div",{className:"bg-sidebar/50 p-4 rounded-lg border border-accent/20",children:[(0,d.jsx)("h3",{className:"font-semibold mb-3 text-sm",children:"Cloudflare Workers AI"}),(0,d.jsx)(j.pd,{label:"Account ID",value:E.accountId,onChange:a=>F({...E,accountId:a.target.value}),placeholder:"abc123def456..."}),(0,d.jsxs)("p",{className:"text-xs text-text-muted mt-2",children:["Find your Account ID in the right sidebar of ",(0,d.jsx)("a",{href:"https://dash.cloudflare.com",target:"_blank",rel:"noopener noreferrer",className:"text-primary underline",children:"dash.cloudflare.com"})]})]}),w&&(0,d.jsxs)("div",{className:"bg-sidebar/50 p-4 rounded-lg border border-accent/20",children:[(0,d.jsx)("h3",{className:"font-semibold mb-3 text-sm",children:"Azure OpenAI Configuration"}),(0,d.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,d.jsx)(j.pd,{label:"Azure Endpoint",value:C.azureEndpoint,onChange:a=>D({...C,azureEndpoint:a.target.value}),placeholder:"https://your-resource.openai.azure.com"}),(0,d.jsx)(j.pd,{label:"Deployment Name",value:C.deployment,onChange:a=>D({...C,deployment:a.target.value}),placeholder:"gpt-4"}),(0,d.jsx)(j.pd,{label:"API Version",value:C.apiVersion,onChange:a=>D({...C,apiVersion:a.target.value}),placeholder:"2024-10-01-preview"}),(0,d.jsx)(j.pd,{label:"Organization",value:C.organization,onChange:a=>D({...C,organization:a.target.value}),placeholder:"Organization ID"})]})]}),(0,d.jsx)(j.pd,{label:"Priority",type:"number",value:A.priority,onChange:a=>B({...A,priority:Number.parseInt(a.target.value)||1})}),(0,d.jsx)(j.l6,{label:"Proxy Pool",value:A.proxyPoolId,onChange:a=>B({...A,proxyPoolId:a.target.value}),options:[{value:r,label:"None"},...(m||[]).map(a=>({value:a.id,label:a.name}))],placeholder:"None"}),0===(m||[]).length&&(0,d.jsx)("p",{className:"text-xs text-text-muted",children:"No active proxy pools available. Create one in Proxy Pools page first."}),(0,d.jsx)("p",{className:"text-xs text-text-muted",children:"Legacy manual proxy fields are still accepted by API for backward compatibility."}),(0,d.jsxs)("div",{className:"flex gap-2",children:[(0,d.jsx)(j.$n,{onClick:Y,fullWidth:!0,disabled:O||!s&&(!A.name||!A.apiKey)||f&&!A.defaultModel.trim()||w&&(!C.azureEndpoint||!C.deployment||!C.organization)||x&&!E.accountId,children:O?"Saving...":"Save"}),(0,d.jsx)(j.$n,{onClick:q,variant:"ghost",fullWidth:!0,children:"Cancel"})]})]})]})}):null}function J({isOpen:a,node:b,onSave:c,onClose:f,isAnthropic:g}){let[h,i]=(0,e.useState)({name:"",prefix:"",apiType:"chat",baseUrl:"https://api.openai.com/v1",routingTags:"",maxInFlight:""}),[k,l]=(0,e.useState)(!1),[m,n]=(0,e.useState)(""),[o,p]=(0,e.useState)(""),[q,r]=(0,e.useState)(!1),[s,t]=(0,e.useState)(null),u=async()=>{if(h.name.trim()&&h.prefix.trim()&&h.baseUrl.trim()){l(!0);try{let a=String(h.routingTags||"").split(/[\n,;]+/).map(a=>a.trim()).filter(Boolean),d=Number(h.maxInFlight),e={...b.providerSpecificData||{},routingTags:a,tags:a};Number.isFinite(d)&&d>0?e.maxInFlight=d:delete e.maxInFlight;let f={name:h.name,prefix:h.prefix,baseUrl:h.baseUrl,routingTags:a,tags:a,providerSpecificData:e};g||(f.apiType=h.apiType),await c(f)}finally{l(!1)}}},v=async()=>{r(!0);try{let a=await fetch("/api/provider-nodes/validate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({baseUrl:h.baseUrl,apiKey:m,type:g?"anthropic-compatible":"openai-compatible",modelId:o.trim()||void 0})}),b=await a.json();t(b.valid?"success":"failed")}catch{t("failed")}finally{r(!1)}};return b?(0,d.jsx)(j.aF,{isOpen:a,title:`Edit ${g?"Anthropic":"OpenAI"} Compatible`,onClose:f,children:(0,d.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,d.jsx)(j.pd,{label:"Name",value:h.name,onChange:a=>i({...h,name:a.target.value}),placeholder:`${g?"Anthropic":"OpenAI"} Compatible (Prod)`,hint:"Required. A friendly label for this node."}),(0,d.jsx)(j.pd,{label:"Prefix",value:h.prefix,onChange:a=>i({...h,prefix:a.target.value}),placeholder:g?"ac-prod":"oc-prod",hint:"Required. Used as the provider prefix for model IDs."}),!g&&(0,d.jsx)(j.l6,{label:"API Type",options:[{value:"chat",label:"Chat Completions"},{value:"responses",label:"Responses API"}],value:h.apiType,onChange:a=>i({...h,apiType:a.target.value})}),(0,d.jsx)(j.pd,{label:"Base URL",value:h.baseUrl,onChange:a=>i({...h,baseUrl:a.target.value}),placeholder:g?"https://api.anthropic.com/v1":"https://api.openai.com/v1",hint:`Use the base URL (ending in /v1) for your ${g?"Anthropic":"OpenAI"}-compatible API.`}),(0,d.jsx)(j.pd,{label:"Routing Tags / Labels",value:h.routingTags,onChange:a=>i({...h,routingTags:a.target.value}),placeholder:"gpu, vram:8gb, model_support:qwen3:8b",hint:"Comma or newline separated. Used by Combo least-latency/P2C tag rules for LAN Ollama."}),(0,d.jsx)(j.pd,{label:"Max In-flight Requests",type:"number",value:h.maxInFlight,onChange:a=>i({...h,maxInFlight:a.target.value}),placeholder:"2",hint:"Optional per-endpoint concurrency cap used by P2C and circuit-aware routing."}),(0,d.jsxs)("div",{className:"flex gap-2",children:[(0,d.jsx)(j.pd,{label:"API Key (for Check)",type:"password",value:m,onChange:a=>n(a.target.value),className:"flex-1"}),(0,d.jsx)("div",{className:"pt-6",children:(0,d.jsx)(j.$n,{onClick:v,disabled:!m||q||!h.baseUrl.trim(),variant:"secondary",children:q?"Checking...":"Check"})})]}),(0,d.jsx)(j.pd,{label:"Model ID (optional)",value:o,onChange:a=>p(a.target.value),placeholder:"e.g. my-model-id",hint:"If provider lacks /models endpoint, enter a model ID to validate via chat/completions instead."}),s&&(0,d.jsx)(j.Ex,{variant:"success"===s?"success":"error",children:"success"===s?"Valid":"Invalid"}),(0,d.jsxs)("div",{className:"flex gap-2",children:[(0,d.jsx)(j.$n,{onClick:u,fullWidth:!0,disabled:!h.name.trim()||!h.prefix.trim()||!h.baseUrl.trim()||k,children:k?"Saving...":"Save"}),(0,d.jsx)(j.$n,{onClick:f,variant:"ghost",fullWidth:!0,children:"Cancel"})]})]})}):null}function K({isOpen:a,providerAlias:b,providerDisplayAlias:c,onSave:f,onClose:g}){let[h,i]=(0,e.useState)(""),[k,l]=(0,e.useState)(null),[m,n]=(0,e.useState)(""),[o,p]=(0,e.useState)(!1),q=a=>{let c=`${b}/`;return a.startsWith(c)?a.slice(c.length):a},r=async()=>{let a=q(h.trim());if(a){l("testing"),n("");try{let c=await fetch("/api/models/test",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({model:`${b}/${a}`})}),d=await c.json();l(d.ok?"ok":"error"),n(d.error||"")}catch(a){l("error"),n(a.message)}}},s=async()=>{let a=q(h.trim());if(a&&!o){p(!0);try{await f(a)}finally{p(!1)}}};return(0,d.jsx)(j.aF,{isOpen:a,onClose:g,title:"Add Custom Model",children:(0,d.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,d.jsxs)("div",{children:[(0,d.jsx)("label",{className:"text-sm font-medium mb-1.5 block",children:"Model ID"}),(0,d.jsxs)("div",{className:"flex gap-2",children:[(0,d.jsx)("input",{type:"text",value:h,onChange:a=>{i(a.target.value),l(null),n("")},onKeyDown:a=>{"Enter"===a.key&&r()},placeholder:"e.g. claude-opus-4-5",className:"flex-1 px-3 py-2 text-sm border border-border rounded-lg bg-background focus:outline-none focus:border-primary",autoFocus:!0}),(0,d.jsx)(j.$n,{variant:"secondary",icon:"science",loading:"testing"===k,onClick:r,disabled:!h.trim()||"testing"===k,children:"testing"===k?"Testing...":"Test"})]}),(0,d.jsxs)("p",{className:"text-xs text-text-muted mt-1",children:["Sent to provider as: ",(0,d.jsx)("code",{className:"font-mono bg-sidebar px-1 rounded",children:q(h.trim())||"model-id"})]})]}),"ok"===k&&(0,d.jsxs)("div",{className:"flex items-center gap-2 text-sm text-green-600",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-base",children:"check_circle"}),"Model is reachable"]}),"error"===k&&(0,d.jsxs)("div",{className:"flex items-start gap-2 text-sm text-red-500",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-base shrink-0",children:"cancel"}),(0,d.jsx)("span",{children:m||"Model not reachable"})]}),(0,d.jsxs)("div",{className:"flex gap-2 pt-1",children:[(0,d.jsx)(j.$n,{onClick:g,variant:"ghost",fullWidth:!0,size:"sm",children:"Cancel"}),(0,d.jsx)(j.$n,{onClick:s,fullWidth:!0,size:"sm",disabled:!h.trim()||o,children:o?"Adding...":"Add Model"})]})]})})}function L(){let a,b=(0,f.useParams)(),c=(0,f.useRouter)(),g=b.id,[n,o]=(0,e.useState)([]),[q,s]=(0,e.useState)(!0),[t,u]=(0,e.useState)(null),[w,x]=(0,e.useState)([]),[y,z]=(0,e.useState)(!1),[A,B]=(0,e.useState)(!1),[C,D]=(0,e.useState)(!1),[E,F]=(0,e.useState)(""),[H,L]=(0,e.useState)(!1),[M,N]=(0,e.useState)(!1),[O,P]=(0,e.useState)(!1),[Q,R]=(0,e.useState)(null),[S,T]=(0,e.useState)({}),[U,V]=(0,e.useState)(!1),[W,X]=(0,e.useState)({}),[Y,Z]=(0,e.useState)(""),[$,_]=(0,e.useState)(null),[aa,ab]=(0,e.useState)(!1),[ac,ad]=(0,e.useState)([]),[ae,af]=(0,e.useState)("__none__"),[ag,ah]=(0,e.useState)(!1),[ai,aj]=(0,e.useState)(null),[ak,al]=(0,e.useState)({}),[am,an]=(0,e.useState)(null),[ao,ap]=(0,e.useState)(""),[aq,ar]=(0,e.useState)("global"),[as,at]=(0,e.useState)("120"),[au,av]=(0,e.useState)(!0),[aw,ax]=(0,e.useState)(!0),[ay,az]=(0,e.useState)("3"),[aA,aB]=(0,e.useState)("auto"),[aC,aD]=(0,e.useState)([]),[aE,aF]=(0,e.useState)([]),[aG,aH]=(0,e.useState)([]),[aI,aJ]=(0,e.useState)(null),[aK,aL]=(0,e.useState)(!1),[aM,aN]=(0,e.useState)(!1),[aO,aP]=(0,e.useState)(!1),[aQ,aR]=(0,e.useState)(null),[aS,aT]=(0,e.useState)({}),[aU,aV]=(0,e.useState)(null),aW=(0,e.useRef)(!1),{copied:aX,copy:aY}=(0,m.C)(),aZ=()=>{z(!0)},a$=()=>{a3?aZ():(F(""),D(!0))},a_=()=>{F(""),D(!0)},a0=()=>{a3?a$():a_()},a1=t?{id:t.id,name:t.name||("anthropic-compatible"===t.type?"Anthropic Compatible":"OpenAI Compatible"),color:"anthropic-compatible"===t.type?"#D97757":"#10A37F",textIcon:"anthropic-compatible"===t.type?"AC":"OC",apiType:t.apiType,baseUrl:t.baseUrl,type:t.type}:k.zN[g]||k.fg[g]||k.IS[g]||k.nJ[g]||k.br[g],a2=a1?.authModes||[],a3=!!k.zN[g]||!!k.IS[g]||a2.includes("oauth"),a4=!!k.fg[g]||a2.includes("apikey"),a5=!!k.IS[g]?.noAuth,a6=(0,l.KC)(g),a7=(0,k.wG)(g),a8=(0,k.mq)(g),a9=(0,k.gb)(g),ba=a8||a9,bb=!ba&&a3&&a4,bc="xai"===g?"Grok Build OAuth":"OAuth",bd="xai"===g?"xAI API Key":"API Key";k.Q2[g]?.thinkingConfig||k.s9.extended;let be=ba?g:a7,bf=ba?t?.prefix||g:a7,bg=(0,e.useCallback)(async()=>{try{let a=await fetch(`/api/models/disabled?providerAlias=${encodeURIComponent(be)}`,{cache:"no-store"}),b=await a.json();a.ok&&aH(b.ids||[])}catch(a){console.log("Error fetching disabled models:",a)}},[be]),bh=async a=>{try{(await fetch("/api/models/disabled",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({providerAlias:be,ids:[a]})})).ok&&await bg()}catch(a){console.log("Error disabling model:",a)}},bi=async a=>{try{(await fetch(`/api/models/disabled?providerAlias=${encodeURIComponent(be)}&id=${encodeURIComponent(a)}`,{method:"DELETE"})).ok&&await bg()}catch(a){console.log("Error enabling model:",a)}},bj=async a=>{a.length&&aJ({title:"Disable All Models",message:`Disable all ${a.length} model(s)?`,onConfirm:async()=>{aJ(null);try{(await fetch("/api/models/disabled",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({providerAlias:be,ids:a})})).ok&&await bg()}catch(a){console.log("Error disabling all models:",a)}}})},bk=async()=>{try{(await fetch(`/api/models/disabled?providerAlias=${encodeURIComponent(be)}`,{method:"DELETE"})).ok&&await bg()}catch(a){console.log("Error enabling all models:",a)}},bl=(0,e.useCallback)(async()=>{try{let a=await fetch("/api/models/alias"),b=await a.json();a.ok&&T(b.aliases||{})}catch(a){console.log("Error fetching aliases:",a)}},[]),bm=(0,e.useCallback)(async()=>{try{let[a,b,c,d]=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"})]),e=await a.json(),f=await b.json(),h=await c.json(),i=d.ok?await d.json():{};if(a.ok){let a=(e.connections||[]).filter(a=>a.provider===g);o(a)}c.ok&&x(h.proxyPools||[]),aj((i.providerHealthChecks||{})[g]||null);let j=(i.providerStrategies||{})[g]||{};an(j.fallbackStrategy||null),ap(null!=j.stickyRoundRobinLimit?String(j.stickyRoundRobinLimit):"1"),ar(j.stickyScope||"global"),at(null!=j.stickyTtlMinutes?String(j.stickyTtlMinutes):"120"),av(!1!==j.stickyFallbackToClientIp),ax(!1!==j.stickyRebindOnFailure),az(null!=j.stickyRebindFailureThreshold?String(j.stickyRebindFailureThreshold):"3");let k=(i.providerThinking||{})[g]||{};if(aB(k.mode||"auto"),b.ok){let a=(f.nodes||[]).find(a=>a.id===g)||null;if(!a&&ba)for(let b=0;b<3;b+=1){await new Promise(a=>setTimeout(a,150));let b=await fetch("/api/provider-nodes",{cache:"no-store"});if(b.ok&&(a=((await b.json()).nodes||[]).find(a=>a.id===g)||null))break}u(a)}}catch(a){console.log("Error fetching connections:",a)}finally{s(!1)}},[g,ba]),bn=async a=>{try{let b=await fetch(`/api/provider-nodes/${g}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)}),c=await b.json();b.ok&&(u(c.node),await bm(),N(!1))}catch(a){console.log("Error updating provider node:",a)}},bo=async(a,b,c={})=>{try{let d=await fetch("/api/settings",{cache:"no-store"}),e=(d.ok?await d.json():{}).providerStrategies||{},f={...e[g]||{}};delete f.fallbackStrategy,delete f.stickyRoundRobinLimit,delete f.stickyScope,delete f.stickyTtlMinutes,delete f.stickyFallbackToClientIp,delete f.stickyRebindOnFailure,delete f.stickyRebindFailureThreshold,a&&(f.fallbackStrategy=a),"round-robin"===a&&(f.stickyRoundRobinLimit=Number(b||ao||1)||1,f.stickyScope=c.stickyScope??aq??"global",f.stickyTtlMinutes=Number(c.stickyTtlMinutes??as??120)||120,f.stickyFallbackToClientIp=void 0!==c.stickyFallbackToClientIp?!!c.stickyFallbackToClientIp:!1!==au,f.stickyRebindOnFailure=void 0!==c.stickyRebindOnFailure?!!c.stickyRebindOnFailure:!1!==aw,f.stickyRebindFailureThreshold=Number(c.stickyRebindFailureThreshold??ay??3)||3);let h={...e};0===Object.keys(f).length?delete h[g]:h[g]=f,await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({providerStrategies:h})})}catch(a){console.log("Error saving provider strategy:",a)}},bp=async(a,b,c=a7)=>{let d=`${c}/${a}`;try{let a=await fetch("/api/models/alias",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({model:d,alias:b})});if(a.ok)await bl();else{let b=await a.json();alert(b.error||"Failed to set alias")}}catch(a){console.log("Error setting alias:",a)}},bq=async a=>{try{(await fetch(`/api/models/alias?alias=${encodeURIComponent(a)}`,{method:"DELETE"})).ok&&await bl()}catch(a){console.log("Error deleting alias:",a)}},br=async()=>{if(aM||0===n.length)return;let a=Object.fromEntries(n.map(a=>[a.id,{state:"queued",error:null}]));aW.current=!1,aN(!0),aP(!1),aR(null),aT(a),aV({total:n.length,completed:0,passed:0,failed:0,stopped:!1});let b=0,c=0;try{for(let a=0;a<n.length;a+=1){if(aW.current){aV({total:n.length,completed:a,passed:b,failed:c,stopped:!0});break}let d=n[a];aR(d.id),aT(a=>({...a,[d.id]:{state:"testing",error:null}}));try{let a=await fetch(`/api/providers/${d.id}/test`,{method:"POST"}),e=await a.json(),f=!!e.valid;f?b+=1:c+=1,aT(a=>({...a,[d.id]:{state:f?"success":"failed",error:f?null:e.error||null}}))}catch(a){c+=1,aT(b=>({...b,[d.id]:{state:"failed",error:a.message||"Test failed"}}))}aV({total:n.length,completed:a+1,passed:b,failed:c,stopped:!1}),a<n.length-1&&await new Promise(a=>setTimeout(a,1e3))}}finally{aR(null),aN(!1),aP(!1),aW.current=!1}},bs=async a=>{al(b=>({...b,[a]:!0}));try{let b=await fetch("/api/provider-health",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({connectionId:a})}),c=await b.json().catch(()=>({}));b.ok||alert(c.error||"Health check failed"),await bm()}catch(a){console.log("Error running health check:",a),alert(a.message||"Health check failed")}finally{al(b=>({...b,[a]:!1}))}},bt=async a=>{aJ({title:"Delete Connection",message:"Delete this connection?",onConfirm:async()=>{aJ(null);try{(await fetch(`/api/providers/${a}`,{method:"DELETE"})).ok&&o(n.filter(b=>b.id!==a))}catch(a){console.log("Error deleting connection:",a)}}})},bu=()=>{bm(),z(!1)},bv=async a=>{F("");try{let b=await fetch("/api/providers",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:g,...a})}),c=null;try{c=await b.json()}catch{c=null}if(b.ok){await bm(),D(!1);return}F(c?.error||"Failed to save connection")}catch(a){console.log("Error saving connection:",a),F("Failed to save connection")}},bw=async a=>{try{(await fetch(`/api/providers/${Q.id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)})).ok&&(await bm(),L(!1))}catch(a){console.log("Error updating connection:",a)}},bx=async(a,b)=>{try{(await fetch(`/api/providers/${a}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({isActive:b})})).ok&&o(c=>c.map(c=>c.id===a?{...c,isActive:b}:c))}catch(a){console.log("Error updating connection status:",a)}},by=async(a,b)=>{let c=[...n];[c[a],c[b]]=[c[b],c[a]],o(c);try{await Promise.all([fetch(`/api/providers/${c[a].id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({priority:a})}),fetch(`/api/providers/${c[b].id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({priority:b})})])}catch(a){console.log("Error swapping priority:",a),await bm()}},bz=n.filter(a=>ac.includes(a.id));n.length>0&&(ac.length,n.length),(()=>{if(0===bz.length)return;let a=new Set(bz.map(a=>a.providerSpecificData?.proxyPoolId||"__none__"));if(1===a.size){let b=[...a][0];if("__none__"===b)return;let c=w.find(a=>a.id===b);return c?.name}})();let bA=()=>{ag||P(!1)},bB=async a=>{ah(!0);try{let b=0;for(let{connectionId:c,proxyPoolId:d}of a)try{(await fetch(`/api/providers/${c}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({proxyPoolId:d})})).ok||(b+=1)}catch(a){console.log("Error applying proxy for",c,a),b+=1}b>0&&alert(`Updated with ${b} failed request(s).`),await bm(),P(!1)}finally{ah(!1)}},bC=a=>bB(n.map(b=>({connectionId:b.id,proxyPoolId:a}))),bD=(0,d.jsx)("div",{className:"flex min-w-0 flex-col divide-y divide-black/[0.03] dark:divide-white/[0.03]",children:n.map((a,b)=>(0,d.jsx)("div",{className:"flex min-w-0 items-stretch",children:(0,d.jsx)("div",{className:"flex-1 min-w-0",children:(0,d.jsx)(v,{connection:a,proxyPools:w,isOAuth:a3,isFirst:0===b,isLast:b===n.length-1,onMoveUp:()=>by(b,b-1),onMoveDown:()=>by(b,b+1),onToggleActive:b=>bx(a.id,b),onUpdateProxy:async b=>{try{(await fetch(`/api/providers/${a.id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({proxyPoolId:b||null})})).ok&&o(c=>c.map(c=>c.id===a.id?{...c,providerSpecificData:{...c.providerSpecificData,proxyPoolId:b||null}}:c))}catch(a){console.log("Error updating proxy:",a)}},onEdit:()=>{R(a),L(!0)},onDelete:()=>bt(a.id),oneByOneStatus:aS[a.id]||null,providerHealthConfig:ai,healthCheckRunning:!!ak[a.id],onRunHealthCheck:()=>bs(a.id)})})},a.id))}),bE=w.filter(a=>!0===a.isActive),bF=(0,d.jsx)(j.aF,{isOpen:O,onClose:bA,title:`Apply Proxy (${n.length} connections)`,children:(0,d.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,d.jsxs)("div",{className:"flex flex-col",children:[(0,d.jsxs)("button",{onClick:()=>{let a=w.filter(a=>!0===a.isActive);return 0===a.length?void alert("No active proxy pools available."):bB(n.map((b,c)=>({connectionId:b.id,proxyPoolId:a[c%a.length].id})))},disabled:ag||0===bE.length,className:"flex items-center gap-2 rounded-lg px-3 py-2 text-left transition-colors hover:bg-black/[0.04] dark:hover:bg-white/[0.04] disabled:cursor-not-allowed disabled:opacity-50",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[18px]",children:"sync_alt"}),(0,d.jsx)("span",{className:"text-sm text-text-main",children:"One-to-one (rotate)"})]}),(0,d.jsxs)("button",{onClick:()=>bC(null),disabled:ag,className:"flex items-center gap-2 rounded-lg px-3 py-2 text-left transition-colors hover:bg-black/[0.04] dark:hover:bg-white/[0.04] disabled:cursor-not-allowed disabled:opacity-50",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[18px]",children:"link_off"}),(0,d.jsx)("span",{className:"text-sm text-text-main",children:"None (unbind all)"})]}),w.map(a=>(0,d.jsxs)("button",{onClick:()=>bC(a.id),disabled:ag||!0!==a.isActive,className:"flex items-center gap-2 rounded-lg px-3 py-2 text-left transition-colors hover:bg-black/[0.04] dark:hover:bg-white/[0.04] disabled:cursor-not-allowed disabled:opacity-50",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[18px]",children:"lan"}),(0,d.jsx)("span",{className:"truncate text-sm text-text-main",children:a.name}),!0!==a.isActive&&(0,d.jsx)("span",{className:"text-[10px] text-text-muted",children:"(inactive)"})]},a.id))]}),ag&&(0,d.jsx)("p",{className:"text-xs text-text-muted",children:"Applying..."}),(0,d.jsx)(j.$n,{onClick:bA,variant:"ghost",fullWidth:!0,disabled:ag,children:"Cancel"})]})}),bG=async a=>{if(!$){_(a);try{let b=await fetch("/api/models/test",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({model:`${be}/${a}`})}),c=await b.json();X(b=>({...b,[a]:c.ok?"ok":"error"})),Z(c.ok?"":c.error||"Model not reachable")}catch{X(b=>({...b,[a]:"error"})),Z("Network error")}finally{_(null)}}};return q?(0,d.jsxs)("div",{className:"flex flex-col gap-8",children:[(0,d.jsx)(j.Qv,{}),(0,d.jsx)(j.Qv,{})]}):a1?(0,d.jsxs)("div",{className:"flex min-w-0 flex-col gap-6 px-1 sm:gap-8 sm:px-0",children:[(0,d.jsxs)("div",{className:"min-w-0",children:[(0,d.jsxs)(h(),{href:"/dashboard/providers",className:"inline-flex items-center gap-1 text-sm text-text-muted hover:text-primary transition-colors mb-4",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-lg",children:"arrow_back"}),"Back to Providers"]}),(0,d.jsxs)("div",{className:"flex min-w-0 items-center gap-3 sm:gap-4",children:[(0,d.jsx)("div",{className:"flex size-12 shrink-0 items-center justify-center rounded-lg",style:{backgroundColor:`${a1.color}15`},children:U?(0,d.jsx)("span",{className:"text-sm font-bold",style:{color:a1.color},children:a1.textIcon||a1.id.slice(0,2).toUpperCase()}):(0,d.jsx)(i.default,{src:a8&&a1.apiType?"responses"===a1.apiType?"/providers/oai-r.png":"/providers/oai-cc.png":a9?"/providers/anthropic-m.png":`/providers/${a1.id}.png`,alt:a1.name,width:48,height:48,className:"max-h-12 max-w-12 rounded-lg object-contain",sizes:"48px",onError:()=>V(!0)})}),(0,d.jsxs)("div",{className:"min-w-0",children:[(0,d.jsxs)("div",{className:"flex items-center gap-3 flex-wrap",children:[(0,d.jsx)("h1",{className:"truncate text-2xl font-semibold tracking-tight sm:text-3xl",children:a1.name}),(a1.notice?.apiKeyUrl||a1.notice?.signupUrl||a1.website)&&(0,d.jsxs)("a",{href:a1.notice?.apiKeyUrl||a1.notice?.signupUrl||a1.website,target:"_blank",rel:"noopener noreferrer",className:"text-xs text-primary hover:underline inline-flex items-center gap-1",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-sm",children:"open_in_new"}),a1.notice?.apiKeyUrl?"Get API Key":"Sign up / Learn more"]})]}),(0,d.jsxs)("p",{className:"text-text-muted",children:[n.length," connection",1===n.length?"":"s"]})]})]})]}),a1.deprecated&&(0,d.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,d.jsx)("span",{className:"material-symbols-outlined text-[16px] text-yellow-500 mt-0.5 shrink-0",children:"warning"}),(0,d.jsx)("p",{className:"text-xs text-red-600 dark:text-yellow-400 leading-relaxed",children:a1.deprecationNotice})]}),a1.notice?.text&&!a1.deprecated&&(0,d.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,d.jsx)("span",{className:"material-symbols-outlined text-[16px] text-blue-500 shrink-0",children:"info"}),(0,d.jsx)("p",{className:"min-w-0 flex-1 text-xs leading-relaxed text-blue-600 dark:text-blue-400",children:a1.notice.text}),a1.notice.apiKeyUrl&&(0,d.jsx)("a",{href:a1.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 →"})]}),ba&&t&&(0,d.jsx)(j.Zp,{children:(0,d.jsxs)("div",{className:"mb-4 flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between",children:[(0,d.jsxs)("div",{className:"min-w-0",children:[(0,d.jsx)("h2",{className:"text-lg font-semibold",children:a9?"Anthropic Compatible Details":"OpenAI Compatible Details"}),(0,d.jsxs)("p",{className:"break-all text-sm text-text-muted",children:[a9?"Messages API":"responses"===t.apiType?"Responses API":"Chat Completions"," \xb7 ",(t.baseUrl||"").replace(/\/$/,""),"/",a9?"messages":"responses"===t.apiType?"responses":"chat/completions"]})]}),(0,d.jsxs)("div",{className:"grid grid-cols-1 gap-2 sm:flex sm:items-center",children:[(0,d.jsx)(j.$n,{size:"sm",icon:"add",onClick:()=>{F(""),D(!0)},className:"w-full sm:w-auto",children:"Add API Key"}),(0,d.jsx)(j.$n,{size:"sm",variant:"secondary",icon:"edit",onClick:()=>N(!0),className:"w-full sm:w-auto",children:"Edit"}),(0,d.jsx)(j.$n,{size:"sm",variant:"secondary",icon:"delete",onClick:async()=>{aJ({title:"Delete Compatible Node",message:`Delete this ${a9?"Anthropic":"OpenAI"} Compatible node?`,onConfirm:async()=>{aJ(null);try{(await fetch(`/api/provider-nodes/${g}`,{method:"DELETE"})).ok&&c.push("/dashboard/providers")}catch(a){console.log("Error deleting provider node:",a)}}})},className:"w-full sm:w-auto",children:"Delete"})]})]})}),a5?(0,d.jsx)(j.gw,{providerId:g}):(0,d.jsxs)(j.Zp,{children:[(0,d.jsxs)("div",{className:"mb-5 flex flex-col gap-4",children:[(0,d.jsxs)("div",{className:"flex flex-col gap-3 lg:flex-row lg:items-center lg:justify-between",children:[(0,d.jsxs)("div",{className:"min-w-0",children:[(0,d.jsx)("h2",{className:"text-lg font-semibold",children:"Connections"}),"round-robin"===am&&(0,d.jsx)("p",{className:"mt-1 text-xs text-text-muted",children:"Round Robin distributes requests across active accounts for this provider."})]}),(0,d.jsxs)("div",{className:"flex flex-wrap items-center gap-2 lg:justify-end",children:[n.length>0&&w.length>0&&(0,d.jsx)(j.$n,{size:"sm",variant:"secondary",icon:"lan",onClick:()=>P(!0),children:"Apply Proxy"}),n.length>0&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(j.$n,{size:"sm",variant:"secondary",icon:"sync",onClick:br,disabled:aM,children:aM?"Testing Connection One-by-One...":"Test Connection One-by-One"}),aM&&(0,d.jsx)(j.$n,{size:"sm",variant:"ghost",icon:"stop",onClick:()=>{aM&&(aW.current=!0,aP(!0))},disabled:aO,children:aO?"Stopping...":"Stop"})]}),(0,d.jsxs)("div",{className:"flex items-center gap-2 rounded-xl border border-border bg-surface/60 px-3 py-2 shadow-sm",children:[(0,d.jsx)("span",{className:"text-xs font-medium text-text-muted",children:"Round Robin"}),(0,d.jsx)(j.lM,{checked:"round-robin"===am,onChange:a=>{let b=a?"round-robin":null,c=a?ao||"1":ao;a&&!ao&&ap("1"),an(b),bo(b,c)}}),"round-robin"===am&&(0,d.jsxs)("label",{className:"flex items-center gap-1.5 border-l border-border pl-2",children:[(0,d.jsx)("span",{className:"text-xs text-text-muted",children:"Sticky:"}),(0,d.jsx)("input",{type:"number",min:1,value:ao,onChange:a=>{var b;ap(b=a.target.value),bo("round-robin",b)},placeholder:"1",className:"w-14 rounded-md border border-border bg-background px-2 py-1 text-xs focus:border-primary focus:outline-none",title:"How many selections/sessions use the same account before global round-robin advances."})]})]})]})]}),"round-robin"===am&&(0,d.jsxs)("div",{className:"rounded-2xl border border-border bg-surface/70 p-4 shadow-sm",children:[(0,d.jsxs)("div",{className:"mb-4 flex flex-col gap-2 lg:flex-row lg:items-start lg:justify-between",children:[(0,d.jsxs)("div",{className:"min-w-0",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[18px] text-primary",children:"sticky_note_2"}),(0,d.jsx)("h3",{className:"text-sm font-semibold text-text-main",children:"Provider Round Robin Sticky"})]}),(0,d.jsx)("p",{className:"mt-1 max-w-3xl text-xs leading-relaxed text-text-muted",children:"Choose how this provider keeps the same account/API key/OAuth connection for a client. Leave it on Global to keep the current behavior."})]}),(0,d.jsx)(j.Ex,{variant:"secondary",className:"w-fit shrink-0",children:"Per provider"})]}),(0,d.jsxs)("div",{className:"grid gap-4 lg:grid-cols-3",children:[(0,d.jsxs)("label",{className:"block",children:[(0,d.jsx)("span",{className:"mb-1 block text-[11px] font-semibold uppercase tracking-wide text-text-muted",children:"Sticky mode"}),(0,d.jsxs)("select",{value:aq,onChange:a=>{var b;ar(b=a.target.value),bo("round-robin",ao||"1",{stickyScope:b})},className:"w-full rounded-lg border border-border bg-background px-3 py-2 text-sm text-text-main outline-none focus:border-primary",children:[(0,d.jsx)("option",{value:"global",children:"Global / current behavior"}),(0,d.jsx)("option",{value:"client_ip",children:"Client IP"}),(0,d.jsx)("option",{value:"client_session",children:"Client IP + chat session"})]}),(0,d.jsx)("p",{className:"mt-1 text-[11px] leading-relaxed text-text-muted",children:"Global rotates like before. Client/session modes keep account identity more stable."})]}),(0,d.jsxs)("label",{className:"block",children:[(0,d.jsx)("span",{className:"mb-1 block text-[11px] font-semibold uppercase tracking-wide text-text-muted",children:"Sticky TTL minutes"}),(0,d.jsx)("input",{type:"number",min:1,max:10080,value:as,onChange:a=>{var b;at(b=a.target.value),bo("round-robin",ao||"1",{stickyTtlMinutes:Number(b)||120})},className:"w-full rounded-lg border border-border bg-background px-3 py-2 text-sm text-text-main outline-none focus:border-primary"}),(0,d.jsx)("p",{className:"mt-1 text-[11px] leading-relaxed text-text-muted",children:"Sticky assignments stay in memory and expire after this time."})]}),(0,d.jsxs)("label",{className:"block",children:[(0,d.jsx)("span",{className:"mb-1 block text-[11px] font-semibold uppercase tracking-wide text-text-muted",children:"Rebind after fallback count"}),(0,d.jsx)("input",{type:"number",min:1,max:50,value:ay,onChange:a=>{var b;az(b=a.target.value),bo("round-robin",ao||"1",{stickyRebindFailureThreshold:Number(b)||3})},disabled:!aw,className:"w-full rounded-lg border border-border bg-background px-3 py-2 text-sm text-text-main outline-none focus:border-primary disabled:cursor-not-allowed disabled:opacity-50"}),(0,d.jsx)("p",{className:"mt-1 text-[11px] leading-relaxed text-text-muted",children:"After this many temporary fallbacks, the session is rebound to the fallback account."})]})]}),(0,d.jsxs)("div",{className:"mt-4 grid gap-3 lg:grid-cols-2",children:[(0,d.jsxs)("label",{className:"flex items-start gap-3 rounded-xl border border-border bg-background/70 p-3",children:[(0,d.jsx)("input",{type:"checkbox",checked:au,onChange:a=>{var b;av(b=a.target.checked),bo("round-robin",ao||"1",{stickyFallbackToClientIp:b})},className:"mt-0.5"}),(0,d.jsxs)("span",{children:[(0,d.jsx)("span",{className:"block text-xs font-medium text-text-main",children:"Fallback to Client IP when session id is missing"}),(0,d.jsx)("span",{className:"mt-1 block text-[11px] leading-relaxed text-text-muted",children:"Useful when the app does not send a stable chat session id."})]})]}),(0,d.jsxs)("label",{className:"flex items-start gap-3 rounded-xl border border-border bg-background/70 p-3",children:[(0,d.jsx)("input",{type:"checkbox",checked:aw,onChange:a=>{var b;ax(b=a.target.checked),bo("round-robin",ao||"1",{stickyRebindOnFailure:b})},className:"mt-0.5"}),(0,d.jsxs)("span",{children:[(0,d.jsx)("span",{className:"block text-xs font-medium text-text-main",children:"Rebind session after repeated unavailable/rate-limited hits"}),(0,d.jsx)("span",{className:"mt-1 block text-[11px] leading-relaxed text-text-muted",children:"First fallbacks are temporary; repeated failures switch that sticky session to a healthier account."})]})]})]}),(0,d.jsxs)("div",{className:"mt-4 rounded-xl border border-primary/20 bg-primary/5 px-3 py-2 text-[11px] leading-relaxed text-text-muted",children:["Recommended for Codex/Copilot-style OAuth providers:",(0,d.jsx)("span",{className:"font-medium text-text-main",children:" Client IP + chat session"}),", TTL 120 minutes, Client IP fallback enabled, rebind enabled after 3 fallbacks."]})]})]}),(0,d.jsx)(G,{providerId:g,onSaved:bm})," ",0===n.length?(0,d.jsxs)("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[(0,d.jsxs)("div",{className:"flex items-center gap-3",children:[(0,d.jsx)("div",{className:"inline-flex items-center justify-center w-9 h-9 rounded-full bg-primary/10 text-primary shrink-0",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:a3?"lock":"key"})}),(0,d.jsxs)("div",{className:"min-w-0",children:[(0,d.jsx)("p",{className:"text-sm text-text-muted",children:"No connections yet"}),bb&&(0,d.jsxs)("p",{className:"text-xs text-text-muted",children:["Choose ",bc," or ",bd,"."]})]})]}),(0,d.jsx)("div",{className:"flex gap-2",children:bb?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(j.$n,{size:"sm",icon:"lock",variant:"secondary",onClick:a$,children:bc}),(0,d.jsx)(j.$n,{size:"sm",icon:"key",onClick:a_,children:bd})]}):(0,d.jsxs)(d.Fragment,{children:[!ba&&"iflow"===g&&(0,d.jsx)(j.$n,{size:"sm",icon:"cookie",variant:"secondary",onClick:()=>B(!0),children:"Cookie"}),(0,d.jsx)(j.$n,{size:"sm",icon:"add",onClick:a0,children:ba?"Add API Key":"iflow"===g?"OAuth":"Add Connection"})]})})]}):(0,d.jsxs)(d.Fragment,{children:[aU&&(0,d.jsx)("div",{className:"mb-4 rounded-lg border border-black/10 bg-black/[0.02] px-3 py-2 text-xs text-text-muted dark:border-white/10 dark:bg-white/[0.03]",children:(0,d.jsxs)("div",{className:"flex flex-wrap items-center gap-3",children:[(0,d.jsxs)("span",{children:["Total: ",aU.total]}),(0,d.jsxs)("span",{children:["Completed: ",aU.completed]}),(0,d.jsxs)("span",{children:["Passed: ",aU.passed]}),(0,d.jsxs)("span",{children:["Failed: ",aU.failed]}),aU.stopped&&(0,d.jsx)("span",{className:"text-amber-600 dark:text-amber-400",children:"Stopped"}),aM&&aQ&&(0,d.jsxs)("span",{children:["Running: ",n.find(a=>a.id===aQ)?.name||aQ]})]})}),bD,!ba&&(0,d.jsxs)("div",{className:"mt-4 grid grid-cols-1 gap-2 sm:flex",children:["iflow"===g&&(0,d.jsx)(j.$n,{size:"sm",icon:"cookie",variant:"secondary",onClick:()=>B(!0),title:"Add connection using browser cookie",className:"w-full sm:w-auto",children:"Cookie"}),bb?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(j.$n,{size:"sm",icon:"lock",variant:"secondary",onClick:a$,className:"w-full sm:w-auto",children:bc}),(0,d.jsx)(j.$n,{size:"sm",icon:"key",onClick:a_,className:"w-full sm:w-auto",children:bd})]}):(0,d.jsx)(j.$n,{size:"sm",icon:"add",onClick:a0,className:"w-full sm:w-auto",children:"Add"})]})]})]}),(0,d.jsxs)(j.Zp,{children:[(0,d.jsxs)("div",{className:"mb-4 flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between",children:[(0,d.jsx)("h2",{className:"text-lg font-semibold",children:"Available Models"}),!ba&&(a=[...a6,...aE.filter(a=>!a6.some(b=>b.id===a.id))].filter(a=>!a.type||"llm"===a.type).map(a=>a.id).filter(a=>!aG.includes(a)),(0,d.jsxs)("div",{className:"flex gap-2",children:[aG.length>0&&(0,d.jsx)(j.$n,{size:"sm",variant:"secondary",icon:"restart_alt",onClick:bk,children:"Active All"}),a.length>0&&(0,d.jsx)(j.$n,{size:"sm",variant:"secondary",icon:"block",onClick:()=>bj(a),children:"Disable All"})]}))]}),!!Y&&(0,d.jsx)("p",{className:"text-xs text-red-500 mb-3 break-words",children:Y}),(()=>{let a,b,c;if(ba)return(0,d.jsx)(r,{providerStorageAlias:be,providerDisplayAlias:bf,modelAliases:S,copied:aX,onCopy:aY,onSetAlias:bp,onDeleteAlias:bq,connections:n,isAnthropic:a9});let e=[...a6,...aE.filter(a=>!a6.some(b=>b.id===a.id))].filter(a=>!a.type||"llm"===a.type),f=new Set(aG),h=e.filter(a=>!f.has(a.id)),i=e.filter(a=>f.has(a.id)),j=Object.entries(S).filter(([a,b])=>{let c=`${be}/`;if(!b.startsWith(c))return!1;let d=b.slice(c.length);return a1.passthroughModels?!a6.some(a=>a.id===d):!a6.some(a=>a.id===d)&&a===d}).map(([a,b])=>({id:b.slice(`${be}/`.length),alias:a,fullModel:b}));return(0,d.jsxs)("div",{className:"flex flex-wrap gap-3",children:[j.map(a=>(0,d.jsx)(p,{model:{id:a.id},fullModel:`${bf}/${a.id}`,alias:a.alias,copied:aX,onCopy:aY,onSetAlias:()=>{},onDeleteAlias:()=>bq(a.alias),testStatus:W[a.id],onTest:n.length>0||a5?()=>bG(a.id):void 0,isTesting:$===a.id,isCustom:!0,isFree:!1},a.id)),h.map(a=>{let b=`${be}/${a.id}`,c=`${g}/${a.id}`,e=Object.entries(S).find(([,a])=>a===b||a===c)?.[0];return(0,d.jsx)(p,{model:a,fullModel:`${bf}/${a.id}`,alias:e,copied:aX,onCopy:aY,onSetAlias:b=>bp(a.id,b,be),onDeleteAlias:()=>bq(e),testStatus:W[a.id],onTest:n.length>0||a5?()=>bG(a.id):void 0,isTesting:$===a.id,isFree:a.isFree,onDisable:()=>bh(a.id)},a.id)}),(0,d.jsxs)("button",{onClick:()=>ab(!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,d.jsx)("span",{className:"material-symbols-outlined text-sm",children:"add"}),"Add Model"]}),aC.length>0&&(a=new Set(Object.values(S)),b=new Set(a6.map(a=>a.id)),0===(c=aC.filter(c=>!a.has(`${be}/${c.id}`)&&!b.has(c.id))).length?null:(0,d.jsxs)("div",{className:"w-full mt-2",children:[(0,d.jsx)("p",{className:"text-xs text-text-muted mb-2",children:"Suggested free models (≥200k context):"}),(0,d.jsx)("div",{className:"flex flex-wrap gap-2",children:c.map(a=>(0,d.jsxs)("button",{onClick:async()=>{let b=a.id.split("/").pop();await bp(a.id,b,be)},className:"flex items-center gap-1 px-2.5 py-1.5 rounded-lg border border-black/10 dark:border-white/10 text-xs text-text-muted hover:text-primary hover:border-primary/40 hover:bg-primary/5 transition-colors",title:`${a.name} \xb7 ${(a.contextLength/1e3).toFixed(0)}k ctx`,children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[13px]",children:"add"}),a.id.split("/").pop()]},a.id))})]})),i.length>0&&(0,d.jsxs)("div",{className:"w-full mt-2",children:[(0,d.jsxs)("p",{className:"text-xs text-text-muted mb-2",children:["Disabled models (",i.length,"):"]}),(0,d.jsx)("div",{className:"flex flex-wrap gap-2",children:i.map(a=>(0,d.jsxs)("button",{onClick:()=>bi(a.id),className:"flex items-center gap-1 px-2.5 py-1.5 rounded-lg border border-dashed border-black/10 dark:border-white/10 text-xs text-text-muted hover:text-primary hover:border-primary/40 hover:bg-primary/5 transition-colors",title:"Restore model",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[13px]",children:"add"}),a.id]},a.id))})]})]})})()]}),bF,"kiro"===g?(0,d.jsx)(j.Mh,{isOpen:y,providerInfo:a1,onSuccess:bu,onClose:()=>z(!1)}):"cursor"===g?(0,d.jsx)(j.G9,{isOpen:y,onSuccess:bu,onClose:()=>z(!1)}):"gitlab"===g?(0,d.jsx)(j.vj,{isOpen:y,providerInfo:a1,onSuccess:bu,onClose:()=>z(!1)}):(0,d.jsx)(j.LF,{isOpen:y,provider:g,providerInfo:a1,onSuccess:bu,onClose:()=>z(!1)}),"iflow"===g&&(0,d.jsx)(j.vE,{isOpen:A,onSuccess:()=>{bm(),B(!1)},onClose:()=>B(!1)}),(0,d.jsx)(I,{isOpen:C,provider:g,providerName:a1.name,isCompatible:ba,isAnthropic:a9,authType:a1?.authType,authHint:a1?.authHint,website:a1?.website,proxyPools:w,error:E,onSave:bv,onBulkDone:bm,onClose:()=>{F(""),D(!1)}}),(0,d.jsx)(j.wI,{isOpen:H,connection:Q,proxyPools:w,onSave:bw,onClose:()=>L(!1)}),ba&&(0,d.jsx)(J,{isOpen:M,node:t,onSave:bn,onClose:()=>N(!1),isAnthropic:a9}),!ba&&(0,d.jsx)(K,{isOpen:aa,providerAlias:be,providerDisplayAlias:bf,onSave:async a=>{let b=a1?.passthroughModels?a.split("/").pop():a;await bp(a,b,be),ab(!1)},onClose:()=>ab(!1)}),(0,d.jsx)(j.uo,{isOpen:aK,onClose:()=>aL(!1),onConfirm:()=>{(aL(!1),a3)?aZ():a_()},title:"Risk Notice",message:a1?.deprecationNotice,confirmText:"I Understand, Continue",cancelText:"Cancel",variant:"danger"}),(0,d.jsx)(j.uo,{isOpen:!!aI,onClose:()=>aJ(null),onConfirm:aI?.onConfirm,title:aI?.title||"Confirm",message:aI?.message,variant:"danger"})]}):(0,d.jsxs)("div",{className:"text-center py-20",children:[(0,d.jsx)("p",{className:"text-text-muted",children:"Provider not found"}),(0,d.jsx)(h(),{href:"/dashboard/providers",className:"text-primary mt-4 inline-block",children:"Back to Providers"})]})}I.propTypes={isOpen:o().bool.isRequired,provider:o().string,providerName:o().string,isCompatible:o().bool,isAnthropic:o().bool,authType:o().string,authHint:o().string,website:o().string,proxyPools:o().arrayOf(o().shape({id:o().string,name:o().string})),error:o().string,onSave:o().func.isRequired,onBulkDone:o().func,onClose:o().func.isRequired},J.propTypes={isOpen:o().bool.isRequired,node:o().shape({id:o().string,name:o().string,prefix:o().string,apiType:o().string,baseUrl:o().string,providerSpecificData:o().object,tags:o().oneOfType([o().string,o().array]),maxInFlight:o().oneOfType([o().string,o().number])}),onSave:o().func.isRequired,onClose:o().func.isRequired,isAnthropic:o().bool},K.propTypes={isOpen:o().bool.isRequired,providerAlias:o().string.isRequired,providerDisplayAlias:o().string.isRequired,onSave:o().func.isRequired,onClose:o().func.isRequired}},63033:a=>{"use strict";a.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},70722:a=>{"use strict";a.exports=require("next/dist/shared/lib/invariant-error")},73024:a=>{"use strict";a.exports=require("node:fs")},76760:a=>{"use strict";a.exports=require("node:path")},77068:a=>{"use strict";a.exports=require("next/dist/shared/lib/size-limit")},77598:a=>{"use strict";a.exports=require("node:crypto")},80099:a=>{"use strict";a.exports=require("node:sqlite")},81787:a=>{"use strict";a.exports=require("bun:sqlite")},86439:a=>{"use strict";a.exports=require("next/dist/shared/lib/no-fallback-error.external")},87550:a=>{"use strict";a.exports=require("better-sqlite3")},93110:(a,b,c)=>{"use strict";c.r(b),c.d(b,{default:()=>d});let d=(0,c(77943).registerClientReference)(function(){throw Error("Attempted to call the default export of \"D:\\\\bluerouter\\\\src\\\\app\\\\(dashboard)\\\\dashboard\\\\providers\\\\[id]\\\\page.js\" from the server, but it's on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"D:\\bluerouter\\src\\app\\(dashboard)\\dashboard\\providers\\[id]\\page.js","default")},94735:a=>{"use strict";a.exports=require("events")}};var b=require("../../../../../webpack-runtime.js");b.C(a);var c=b.X(0,[4741,319,533,3913,1220,4884,5681,4404,6064,7130,6604],()=>b(b.s=52362));module.exports=c})();
|
|
4
|
+
sk-key-only-auto-named`;function L({isOpen:a,provider:b,providerName:c,isCompatible:f,isAnthropic:g,authType:h,authHint:i,website:l,proxyPools:m,error:n,onSave:o,onBulkDone:p,onClose:q}){let r="__none__",s="ollama-local"===b,t="cookie"===h,u="xai"===b&&!t,v=t?"Cookie Value":"API Key",w="azure"===b,x="cloudflare-ai"===b,y=k.Q2?.[b]?.regions||null,z=k.Q2?.[b]?.defaultRegion||y?.[0]?.id||"",[A,B]=(0,e.useState)({name:"",apiKey:"",defaultModel:"",priority:1,proxyPoolId:r,ollamaHostUrl:""}),[C,D]=(0,e.useState)({azureEndpoint:"",apiVersion:"2024-10-01-preview",deployment:"",organization:""}),[E,F]=(0,e.useState)({accountId:""}),[G,H]=(0,e.useState)(z),[I,J]=(0,e.useState)(!1),[M,N]=(0,e.useState)(null),[O,P]=(0,e.useState)(!1),[Q,R]=(0,e.useState)("single"),[S,T]=(0,e.useState)(""),[U,V]=(0,e.useState)(null),W=()=>s&&A.ollamaHostUrl.trim()?{baseUrl:A.ollamaHostUrl.trim()}:w?{azureEndpoint:C.azureEndpoint,apiVersion:C.apiVersion,deployment:C.deployment,organization:C.organization}:x?{accountId:E.accountId}:y&&G?{region:G}:void 0,X=async()=>{J(!0);try{let a=await fetch("/api/providers/validate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:b,apiKey:A.apiKey,providerSpecificData:W()})}),c=await a.json();N(c.valid?"success":"failed")}catch{N("failed")}finally{J(!1)}},Y=async()=>{if(b&&(s||A.apiKey)&&(s||A.name)&&(!f||A.defaultModel.trim())){P(!0);try{let a=!1;try{J(!0),N(null);let c=await fetch("/api/providers/validate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:b,apiKey:A.apiKey,providerSpecificData:W()})});a=!!(await c.json()).valid,N(a?"success":"failed")}catch{N("failed")}finally{J(!1)}await o({name:A.name||(s?"Ollama Local":""),apiKey:A.apiKey,defaultModel:f?A.defaultModel.trim():void 0,priority:A.priority,proxyPoolId:A.proxyPoolId===r?null:A.proxyPoolId,testStatus:a?"active":"unknown",providerSpecificData:W()})}finally{P(!1)}}},Z=async()=>{let a=S.split("\n").map(a=>a.trim()).filter(Boolean);if(!a.length)return;P(!0),V(null);let c=0,d=0;for(let e=0;e<a.length;e++){let f=a[e].split("|"),g=f.length>=2?f.slice(1).join("|").trim():f[0].trim(),h=f.length>=2?f[0].trim():"Key",i=`${h} ${e+1}`;try{(await fetch("/api/providers",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:b,apiKey:g,name:i,priority:1,testStatus:"unknown"})})).ok?c++:d++}catch{d++}}P(!1),V({success:c,failed:d}),c>0&&p&&p()};return b?(0,d.jsx)(j.aF,{isOpen:a,title:`Add ${c||b} ${v}`,onClose:q,children:(0,d.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,d.jsxs)("div",{className:"flex gap-2",children:[(0,d.jsx)(j.$n,{size:"sm",variant:"single"===Q?"primary":"ghost",onClick:()=>{R("single"),V(null)},children:"Single"}),(0,d.jsx)(j.$n,{size:"sm",variant:"bulk"===Q?"primary":"ghost",onClick:()=>{R("bulk"),V(null)},children:"Bulk Add"})]}),"bulk"===Q&&(0,d.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,d.jsxs)("p",{className:"text-xs text-text-muted",children:["One key per line. Format: ",(0,d.jsx)("code",{children:"name|apiKey"})," or just ",(0,d.jsx)("code",{children:"apiKey"})," (auto-named by index)."]}),(0,d.jsx)("textarea",{className:"w-full rounded border border-accent/30 bg-sidebar p-2 text-sm font-mono resize-y min-h-[140px] focus:outline-none focus:ring-1 focus:ring-primary",placeholder:K,value:S,onChange:a=>T(a.target.value)}),U&&(0,d.jsxs)("div",{className:`text-sm font-medium ${U.failed>0?"text-yellow-400":"text-green-400"}`,children:["✓ ",U.success," added",U.failed>0?`, ✗ ${U.failed} failed`:""]}),(0,d.jsxs)("div",{className:"flex gap-2",children:[(0,d.jsx)(j.$n,{onClick:Z,fullWidth:!0,disabled:O||!S.trim(),children:O?"Adding...":"Add All Keys"}),(0,d.jsx)(j.$n,{onClick:q,variant:"ghost",fullWidth:!0,children:"Cancel"})]})]}),"single"===Q&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(j.pd,{label:"Name",value:A.name,onChange:a=>B({...A,name:a.target.value}),placeholder:s?"Ollama Local":"Production Key"}),s&&(0,d.jsxs)("div",{className:"flex gap-2",children:[(0,d.jsx)(j.pd,{label:"Ollama Host URL",value:A.ollamaHostUrl,onChange:a=>B({...A,ollamaHostUrl:a.target.value}),placeholder:"http://localhost:11434",className:"flex-1"}),(0,d.jsx)("div",{className:"pt-6",children:(0,d.jsx)(j.$n,{onClick:X,disabled:I||O,variant:"secondary",children:I?"Checking...":"Check"})})]}),!s&&(0,d.jsxs)("div",{className:"flex gap-2",children:[(0,d.jsx)(j.pd,{label:v,type:t?"text":"password",value:A.apiKey,onChange:a=>B({...A,apiKey:a.target.value}),placeholder:t?"grok-web"===b?"sso=xxxxx... or just the raw value":"eyJhbGciOi...":u?"xai-...":"",className:"flex-1"}),(0,d.jsx)("div",{className:"pt-6",children:(0,d.jsx)(j.$n,{onClick:X,disabled:!A.apiKey||I||O,variant:"secondary",children:I?"Checking...":"Check"})})]}),u&&(0,d.jsx)("p",{className:"text-xs text-text-muted",children:"Use a direct xAI API key from console.x.ai. This is separate from Grok Build OAuth."}),t&&i&&(0,d.jsxs)("p",{className:"text-xs text-text-muted",children:[i,l&&(0,d.jsxs)(d.Fragment,{children:[" ",(0,d.jsxs)("a",{href:l,target:"_blank",rel:"noopener noreferrer",className:"text-primary underline",children:["Open ",l.replace(/^https?:\/\//,"")]})]})]}),y&&(0,d.jsx)(j.l6,{label:"Region",value:G,onChange:a=>H(a.target.value),options:y.map(a=>({value:a.id,label:a.label}))}),f&&(0,d.jsx)(j.pd,{label:"Default Model",value:A.defaultModel,onChange:a=>B({...A,defaultModel:a.target.value}),placeholder:g?"claude-3-5-sonnet-latest":"gpt-4o-mini"}),s&&(0,d.jsxs)("p",{className:"text-xs text-text-muted",children:["Leave blank to use ",(0,d.jsx)("code",{children:"http://localhost:11434"}),". For remote Ollama, enter the full host URL (e.g. ",(0,d.jsx)("code",{children:"http://192.168.1.10:11434"}),")."]}),M&&(0,d.jsx)(j.Ex,{variant:"success"===M?"success":"error",children:"success"===M?"Valid":"Invalid"}),n&&(0,d.jsx)("p",{className:"text-xs text-red-500 break-words",children:n}),f&&(0,d.jsx)("p",{className:"text-xs text-text-muted",children:"Enter the model ID exactly as your compatible endpoint expects it. This model will be saved as the connection default."}),x&&(0,d.jsxs)("div",{className:"bg-sidebar/50 p-4 rounded-lg border border-accent/20",children:[(0,d.jsx)("h3",{className:"font-semibold mb-3 text-sm",children:"Cloudflare Workers AI"}),(0,d.jsx)(j.pd,{label:"Account ID",value:E.accountId,onChange:a=>F({...E,accountId:a.target.value}),placeholder:"abc123def456..."}),(0,d.jsxs)("p",{className:"text-xs text-text-muted mt-2",children:["Find your Account ID in the right sidebar of ",(0,d.jsx)("a",{href:"https://dash.cloudflare.com",target:"_blank",rel:"noopener noreferrer",className:"text-primary underline",children:"dash.cloudflare.com"})]})]}),w&&(0,d.jsxs)("div",{className:"bg-sidebar/50 p-4 rounded-lg border border-accent/20",children:[(0,d.jsx)("h3",{className:"font-semibold mb-3 text-sm",children:"Azure OpenAI Configuration"}),(0,d.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,d.jsx)(j.pd,{label:"Azure Endpoint",value:C.azureEndpoint,onChange:a=>D({...C,azureEndpoint:a.target.value}),placeholder:"https://your-resource.openai.azure.com"}),(0,d.jsx)(j.pd,{label:"Deployment Name",value:C.deployment,onChange:a=>D({...C,deployment:a.target.value}),placeholder:"gpt-4"}),(0,d.jsx)(j.pd,{label:"API Version",value:C.apiVersion,onChange:a=>D({...C,apiVersion:a.target.value}),placeholder:"2024-10-01-preview"}),(0,d.jsx)(j.pd,{label:"Organization",value:C.organization,onChange:a=>D({...C,organization:a.target.value}),placeholder:"Organization ID"})]})]}),(0,d.jsx)(j.pd,{label:"Priority",type:"number",value:A.priority,onChange:a=>B({...A,priority:Number.parseInt(a.target.value)||1})}),(0,d.jsx)(j.l6,{label:"Proxy Pool",value:A.proxyPoolId,onChange:a=>B({...A,proxyPoolId:a.target.value}),options:[{value:r,label:"None"},...(m||[]).map(a=>({value:a.id,label:a.name}))],placeholder:"None"}),0===(m||[]).length&&(0,d.jsx)("p",{className:"text-xs text-text-muted",children:"No active proxy pools available. Create one in Proxy Pools page first."}),(0,d.jsx)("p",{className:"text-xs text-text-muted",children:"Legacy manual proxy fields are still accepted by API for backward compatibility."}),(0,d.jsxs)("div",{className:"flex gap-2",children:[(0,d.jsx)(j.$n,{onClick:Y,fullWidth:!0,disabled:O||!s&&(!A.name||!A.apiKey)||f&&!A.defaultModel.trim()||w&&(!C.azureEndpoint||!C.deployment||!C.organization)||x&&!E.accountId,children:O?"Saving...":"Save"}),(0,d.jsx)(j.$n,{onClick:q,variant:"ghost",fullWidth:!0,children:"Cancel"})]})]})]})}):null}function M({isOpen:a,node:b,onSave:c,onClose:f,isAnthropic:g}){let[h,i]=(0,e.useState)({name:"",prefix:"",apiType:"chat",baseUrl:"https://api.openai.com/v1",routingTags:"",maxInFlight:""}),[k,l]=(0,e.useState)(!1),[m,n]=(0,e.useState)(""),[o,p]=(0,e.useState)(""),[q,r]=(0,e.useState)(!1),[s,t]=(0,e.useState)(null),u=async()=>{if(h.name.trim()&&h.prefix.trim()&&h.baseUrl.trim()){l(!0);try{let a=String(h.routingTags||"").split(/[\n,;]+/).map(a=>a.trim()).filter(Boolean),d=Number(h.maxInFlight),e={...b.providerSpecificData||{},routingTags:a,tags:a};Number.isFinite(d)&&d>0?e.maxInFlight=d:delete e.maxInFlight;let f={name:h.name,prefix:h.prefix,baseUrl:h.baseUrl,routingTags:a,tags:a,providerSpecificData:e};g||(f.apiType=h.apiType),await c(f)}finally{l(!1)}}},v=async()=>{r(!0);try{let a=await fetch("/api/provider-nodes/validate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({baseUrl:h.baseUrl,apiKey:m,type:g?"anthropic-compatible":"openai-compatible",modelId:o.trim()||void 0})}),b=await a.json();t(b.valid?"success":"failed")}catch{t("failed")}finally{r(!1)}};return b?(0,d.jsx)(j.aF,{isOpen:a,title:`Edit ${g?"Anthropic":"OpenAI"} Compatible`,onClose:f,children:(0,d.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,d.jsx)(j.pd,{label:"Name",value:h.name,onChange:a=>i({...h,name:a.target.value}),placeholder:`${g?"Anthropic":"OpenAI"} Compatible (Prod)`,hint:"Required. A friendly label for this node."}),(0,d.jsx)(j.pd,{label:"Prefix",value:h.prefix,onChange:a=>i({...h,prefix:a.target.value}),placeholder:g?"ac-prod":"oc-prod",hint:"Required. Used as the provider prefix for model IDs."}),!g&&(0,d.jsx)(j.l6,{label:"API Type",options:[{value:"chat",label:"Chat Completions"},{value:"responses",label:"Responses API"}],value:h.apiType,onChange:a=>i({...h,apiType:a.target.value})}),(0,d.jsx)(j.pd,{label:"Base URL",value:h.baseUrl,onChange:a=>i({...h,baseUrl:a.target.value}),placeholder:g?"https://api.anthropic.com/v1":"https://api.openai.com/v1",hint:`Use the base URL (ending in /v1) for your ${g?"Anthropic":"OpenAI"}-compatible API.`}),(0,d.jsx)(j.pd,{label:"Routing Tags / Labels",value:h.routingTags,onChange:a=>i({...h,routingTags:a.target.value}),placeholder:"gpu, vram:8gb, model_support:qwen3:8b",hint:"Comma or newline separated. Used by Combo least-latency/P2C tag rules for LAN Ollama."}),(0,d.jsx)(j.pd,{label:"Max In-flight Requests",type:"number",value:h.maxInFlight,onChange:a=>i({...h,maxInFlight:a.target.value}),placeholder:"2",hint:"Optional per-endpoint concurrency cap used by P2C and circuit-aware routing."}),(0,d.jsxs)("div",{className:"flex gap-2",children:[(0,d.jsx)(j.pd,{label:"API Key (for Check)",type:"password",value:m,onChange:a=>n(a.target.value),className:"flex-1"}),(0,d.jsx)("div",{className:"pt-6",children:(0,d.jsx)(j.$n,{onClick:v,disabled:!m||q||!h.baseUrl.trim(),variant:"secondary",children:q?"Checking...":"Check"})})]}),(0,d.jsx)(j.pd,{label:"Model ID (optional)",value:o,onChange:a=>p(a.target.value),placeholder:"e.g. my-model-id",hint:"If provider lacks /models endpoint, enter a model ID to validate via chat/completions instead."}),s&&(0,d.jsx)(j.Ex,{variant:"success"===s?"success":"error",children:"success"===s?"Valid":"Invalid"}),(0,d.jsxs)("div",{className:"flex gap-2",children:[(0,d.jsx)(j.$n,{onClick:u,fullWidth:!0,disabled:!h.name.trim()||!h.prefix.trim()||!h.baseUrl.trim()||k,children:k?"Saving...":"Save"}),(0,d.jsx)(j.$n,{onClick:f,variant:"ghost",fullWidth:!0,children:"Cancel"})]})]})}):null}function N({isOpen:a,providerAlias:b,providerDisplayAlias:c,onSave:f,onClose:g}){let[h,i]=(0,e.useState)(""),[k,l]=(0,e.useState)(null),[m,n]=(0,e.useState)(""),[o,p]=(0,e.useState)(!1),q=a=>{let c=`${b}/`;return a.startsWith(c)?a.slice(c.length):a},r=async()=>{let a=q(h.trim());if(a){l("testing"),n("");try{let c=await fetch("/api/models/test",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({model:`${b}/${a}`})}),d=await c.json();l(d.ok?"ok":"error"),n(d.error||"")}catch(a){l("error"),n(a.message)}}},s=async()=>{let a=q(h.trim());if(a&&!o){p(!0);try{await f(a)}finally{p(!1)}}};return(0,d.jsx)(j.aF,{isOpen:a,onClose:g,title:"Add Custom Model",children:(0,d.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,d.jsxs)("div",{children:[(0,d.jsx)("label",{className:"text-sm font-medium mb-1.5 block",children:"Model ID"}),(0,d.jsxs)("div",{className:"flex gap-2",children:[(0,d.jsx)("input",{type:"text",value:h,onChange:a=>{i(a.target.value),l(null),n("")},onKeyDown:a=>{"Enter"===a.key&&r()},placeholder:"e.g. claude-opus-4-5",className:"flex-1 px-3 py-2 text-sm border border-border rounded-lg bg-background focus:outline-none focus:border-primary",autoFocus:!0}),(0,d.jsx)(j.$n,{variant:"secondary",icon:"science",loading:"testing"===k,onClick:r,disabled:!h.trim()||"testing"===k,children:"testing"===k?"Testing...":"Test"})]}),(0,d.jsxs)("p",{className:"text-xs text-text-muted mt-1",children:["Sent to provider as: ",(0,d.jsx)("code",{className:"font-mono bg-sidebar px-1 rounded",children:q(h.trim())||"model-id"})]})]}),"ok"===k&&(0,d.jsxs)("div",{className:"flex items-center gap-2 text-sm text-green-600",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-base",children:"check_circle"}),"Model is reachable"]}),"error"===k&&(0,d.jsxs)("div",{className:"flex items-start gap-2 text-sm text-red-500",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-base shrink-0",children:"cancel"}),(0,d.jsx)("span",{children:m||"Model not reachable"})]}),(0,d.jsxs)("div",{className:"flex gap-2 pt-1",children:[(0,d.jsx)(j.$n,{onClick:g,variant:"ghost",fullWidth:!0,size:"sm",children:"Cancel"}),(0,d.jsx)(j.$n,{onClick:s,fullWidth:!0,size:"sm",disabled:!h.trim()||o,children:o?"Adding...":"Add Model"})]})]})})}function O(){let a,b=(0,f.useParams)(),c=(0,f.useRouter)(),g=b.id,[n,o]=(0,e.useState)([]),[q,s]=(0,e.useState)(!0),[t,u]=(0,e.useState)(null),[w,x]=(0,e.useState)([]),[y,z]=(0,e.useState)(!1),[A,B]=(0,e.useState)(!1),[C,D]=(0,e.useState)(!1),[E,F]=(0,e.useState)(""),[G,H]=(0,e.useState)(!1),[I,K]=(0,e.useState)(!1),[O,P]=(0,e.useState)(!1),[Q,R]=(0,e.useState)(null),[S,T]=(0,e.useState)({}),[U,V]=(0,e.useState)(!1),[W,X]=(0,e.useState)({}),[Y,Z]=(0,e.useState)(""),[$,_]=(0,e.useState)(null),[aa,ab]=(0,e.useState)(!1),[ac,ad]=(0,e.useState)([]),[ae,af]=(0,e.useState)("__none__"),[ag,ah]=(0,e.useState)(!1),[ai,aj]=(0,e.useState)(null),[ak,al]=(0,e.useState)({}),[am,an]=(0,e.useState)(null),[ao,ap]=(0,e.useState)(""),[aq,ar]=(0,e.useState)("global"),[as,at]=(0,e.useState)("120"),[au,av]=(0,e.useState)(!0),[aw,ax]=(0,e.useState)(!0),[ay,az]=(0,e.useState)("3"),[aA,aB]=(0,e.useState)("auto"),[aC,aD]=(0,e.useState)([]),[aE,aF]=(0,e.useState)([]),[aG,aH]=(0,e.useState)([]),[aI,aJ]=(0,e.useState)(null),[aK,aL]=(0,e.useState)(!1),[aM,aN]=(0,e.useState)(!1),[aO,aP]=(0,e.useState)(!1),[aQ,aR]=(0,e.useState)(null),[aS,aT]=(0,e.useState)({}),[aU,aV]=(0,e.useState)(null),aW=(0,e.useRef)(!1),{copied:aX,copy:aY}=(0,m.C)(),aZ=()=>{z(!0)},a$=()=>{a3?aZ():(F(""),D(!0))},a_=()=>{F(""),D(!0)},a0=()=>{a3?a$():a_()},a1=t?{id:t.id,name:t.name||("anthropic-compatible"===t.type?"Anthropic Compatible":"OpenAI Compatible"),color:"anthropic-compatible"===t.type?"#D97757":"#10A37F",textIcon:"anthropic-compatible"===t.type?"AC":"OC",apiType:t.apiType,baseUrl:t.baseUrl,type:t.type}:k.zN[g]||k.fg[g]||k.IS[g]||k.nJ[g]||k.br[g],a2=a1?.authModes||[],a3=!!k.zN[g]||!!k.IS[g]||a2.includes("oauth"),a4=!!k.fg[g]||a2.includes("apikey"),a5=!!k.IS[g]?.noAuth,a6=(0,l.KC)(g),a7=(0,k.wG)(g),a8=(0,k.mq)(g),a9=(0,k.gb)(g),ba=a8||a9,bb=!ba&&a3&&a4,bc="xai"===g?"Grok Build OAuth":"OAuth",bd="xai"===g?"xAI API Key":"API Key";k.Q2[g]?.thinkingConfig||k.s9.extended;let be=ba?g:a7,bf=ba?t?.prefix||g:a7,bg=(0,e.useCallback)(async()=>{try{let a=await fetch(`/api/models/disabled?providerAlias=${encodeURIComponent(be)}`,{cache:"no-store"}),b=await a.json();a.ok&&aH(b.ids||[])}catch(a){console.log("Error fetching disabled models:",a)}},[be]),bh=async a=>{try{(await fetch("/api/models/disabled",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({providerAlias:be,ids:[a]})})).ok&&await bg()}catch(a){console.log("Error disabling model:",a)}},bi=async a=>{try{(await fetch(`/api/models/disabled?providerAlias=${encodeURIComponent(be)}&id=${encodeURIComponent(a)}`,{method:"DELETE"})).ok&&await bg()}catch(a){console.log("Error enabling model:",a)}},bj=async a=>{a.length&&aJ({title:"Disable All Models",message:`Disable all ${a.length} model(s)?`,onConfirm:async()=>{aJ(null);try{(await fetch("/api/models/disabled",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({providerAlias:be,ids:a})})).ok&&await bg()}catch(a){console.log("Error disabling all models:",a)}}})},bk=async()=>{try{(await fetch(`/api/models/disabled?providerAlias=${encodeURIComponent(be)}`,{method:"DELETE"})).ok&&await bg()}catch(a){console.log("Error enabling all models:",a)}},bl=(0,e.useCallback)(async()=>{try{let a=await fetch("/api/models/alias"),b=await a.json();a.ok&&T(b.aliases||{})}catch(a){console.log("Error fetching aliases:",a)}},[]),bm=(0,e.useCallback)(async()=>{try{let[a,b,c,d]=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"})]),e=await a.json(),f=await b.json(),h=await c.json(),i=d.ok?await d.json():{};if(a.ok){let a=(e.connections||[]).filter(a=>a.provider===g);o(a)}c.ok&&x(h.proxyPools||[]),aj((i.providerHealthChecks||{})[g]||null);let j=(i.providerStrategies||{})[g]||{};an(j.fallbackStrategy||null),ap(null!=j.stickyRoundRobinLimit?String(j.stickyRoundRobinLimit):"1"),ar(j.stickyScope||"global"),at(null!=j.stickyTtlMinutes?String(j.stickyTtlMinutes):"120"),av(!1!==j.stickyFallbackToClientIp),ax(!1!==j.stickyRebindOnFailure),az(null!=j.stickyRebindFailureThreshold?String(j.stickyRebindFailureThreshold):"3");let k=(i.providerThinking||{})[g]||{};if(aB(k.mode||"auto"),b.ok){let a=(f.nodes||[]).find(a=>a.id===g)||null;if(!a&&ba)for(let b=0;b<3;b+=1){await new Promise(a=>setTimeout(a,150));let b=await fetch("/api/provider-nodes",{cache:"no-store"});if(b.ok&&(a=((await b.json()).nodes||[]).find(a=>a.id===g)||null))break}u(a)}}catch(a){console.log("Error fetching connections:",a)}finally{s(!1)}},[g,ba]),bn=async a=>{try{let b=await fetch(`/api/provider-nodes/${g}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)}),c=await b.json();b.ok&&(u(c.node),await bm(),K(!1))}catch(a){console.log("Error updating provider node:",a)}},bo=async(a,b,c={})=>{try{let d=await fetch("/api/settings",{cache:"no-store"}),e=(d.ok?await d.json():{}).providerStrategies||{},f={...e[g]||{}};delete f.fallbackStrategy,delete f.stickyRoundRobinLimit,delete f.stickyScope,delete f.stickyTtlMinutes,delete f.stickyFallbackToClientIp,delete f.stickyRebindOnFailure,delete f.stickyRebindFailureThreshold,a&&(f.fallbackStrategy=a),"round-robin"===a&&(f.stickyRoundRobinLimit=Number(b||ao||1)||1,f.stickyScope=c.stickyScope??aq??"global",f.stickyTtlMinutes=Number(c.stickyTtlMinutes??as??120)||120,f.stickyFallbackToClientIp=void 0!==c.stickyFallbackToClientIp?!!c.stickyFallbackToClientIp:!1!==au,f.stickyRebindOnFailure=void 0!==c.stickyRebindOnFailure?!!c.stickyRebindOnFailure:!1!==aw,f.stickyRebindFailureThreshold=Number(c.stickyRebindFailureThreshold??ay??3)||3);let h={...e};0===Object.keys(f).length?delete h[g]:h[g]=f,await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({providerStrategies:h})})}catch(a){console.log("Error saving provider strategy:",a)}},bp=async(a,b,c=a7)=>{let d=`${c}/${a}`;try{let a=await fetch("/api/models/alias",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({model:d,alias:b})});if(a.ok)await bl();else{let b=await a.json();alert(b.error||"Failed to set alias")}}catch(a){console.log("Error setting alias:",a)}},bq=async a=>{try{(await fetch(`/api/models/alias?alias=${encodeURIComponent(a)}`,{method:"DELETE"})).ok&&await bl()}catch(a){console.log("Error deleting alias:",a)}},br=async()=>{if(aM||0===n.length)return;let a=Object.fromEntries(n.map(a=>[a.id,{state:"queued",error:null}]));aW.current=!1,aN(!0),aP(!1),aR(null),aT(a),aV({total:n.length,completed:0,passed:0,failed:0,stopped:!1});let b=0,c=0;try{for(let a=0;a<n.length;a+=1){if(aW.current){aV({total:n.length,completed:a,passed:b,failed:c,stopped:!0});break}let d=n[a];aR(d.id),aT(a=>({...a,[d.id]:{state:"testing",error:null}}));try{let a=await fetch(`/api/providers/${d.id}/test`,{method:"POST"}),e=await a.json(),f=!!e.valid;f?b+=1:c+=1,aT(a=>({...a,[d.id]:{state:f?"success":"failed",error:f?null:e.error||null}}))}catch(a){c+=1,aT(b=>({...b,[d.id]:{state:"failed",error:a.message||"Test failed"}}))}aV({total:n.length,completed:a+1,passed:b,failed:c,stopped:!1}),a<n.length-1&&await new Promise(a=>setTimeout(a,1e3))}}finally{aR(null),aN(!1),aP(!1),aW.current=!1}},bs=async a=>{al(b=>({...b,[a]:!0}));try{let b=await fetch("/api/provider-health",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({connectionId:a})}),c=await b.json().catch(()=>({}));b.ok||alert(c.error||"Health check failed"),await bm()}catch(a){console.log("Error running health check:",a),alert(a.message||"Health check failed")}finally{al(b=>({...b,[a]:!1}))}},bt=async a=>{aJ({title:"Delete Connection",message:"Delete this connection?",onConfirm:async()=>{aJ(null);try{(await fetch(`/api/providers/${a}`,{method:"DELETE"})).ok&&o(n.filter(b=>b.id!==a))}catch(a){console.log("Error deleting connection:",a)}}})},bu=()=>{bm(),z(!1)},bv=async a=>{F("");try{let b=await fetch("/api/providers",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:g,...a})}),c=null;try{c=await b.json()}catch{c=null}if(b.ok){await bm(),D(!1);return}F(c?.error||"Failed to save connection")}catch(a){console.log("Error saving connection:",a),F("Failed to save connection")}},bw=async a=>{try{(await fetch(`/api/providers/${Q.id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)})).ok&&(await bm(),H(!1))}catch(a){console.log("Error updating connection:",a)}},bx=async(a,b)=>{try{(await fetch(`/api/providers/${a}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({isActive:b})})).ok&&o(c=>c.map(c=>c.id===a?{...c,isActive:b}:c))}catch(a){console.log("Error updating connection status:",a)}},by=async(a,b)=>{let c=[...n];[c[a],c[b]]=[c[b],c[a]],o(c);try{await Promise.all([fetch(`/api/providers/${c[a].id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({priority:a})}),fetch(`/api/providers/${c[b].id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({priority:b})})])}catch(a){console.log("Error swapping priority:",a),await bm()}},bz=n.filter(a=>ac.includes(a.id));n.length>0&&(ac.length,n.length),(()=>{if(0===bz.length)return;let a=new Set(bz.map(a=>a.providerSpecificData?.proxyPoolId||"__none__"));if(1===a.size){let b=[...a][0];if("__none__"===b)return;let c=w.find(a=>a.id===b);return c?.name}})();let bA=()=>{ag||P(!1)},bB=async a=>{ah(!0);try{let b=0;for(let{connectionId:c,proxyPoolId:d}of a)try{(await fetch(`/api/providers/${c}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({proxyPoolId:d})})).ok||(b+=1)}catch(a){console.log("Error applying proxy for",c,a),b+=1}b>0&&alert(`Updated with ${b} failed request(s).`),await bm(),P(!1)}finally{ah(!1)}},bC=a=>bB(n.map(b=>({connectionId:b.id,proxyPoolId:a}))),bD=(0,d.jsx)("div",{className:"flex min-w-0 flex-col divide-y divide-black/[0.03] dark:divide-white/[0.03]",children:n.map((a,b)=>(0,d.jsx)("div",{className:"flex min-w-0 items-stretch",children:(0,d.jsx)("div",{className:"flex-1 min-w-0",children:(0,d.jsx)(v,{connection:a,proxyPools:w,isOAuth:a3,isFirst:0===b,isLast:b===n.length-1,onMoveUp:()=>by(b,b-1),onMoveDown:()=>by(b,b+1),onToggleActive:b=>bx(a.id,b),onUpdateProxy:async b=>{try{(await fetch(`/api/providers/${a.id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({proxyPoolId:b||null})})).ok&&o(c=>c.map(c=>c.id===a.id?{...c,providerSpecificData:{...c.providerSpecificData,proxyPoolId:b||null}}:c))}catch(a){console.log("Error updating proxy:",a)}},onEdit:()=>{R(a),H(!0)},onDelete:()=>bt(a.id),oneByOneStatus:aS[a.id]||null,providerHealthConfig:ai,healthCheckRunning:!!ak[a.id],onRunHealthCheck:()=>bs(a.id)})})},a.id))}),bE=w.filter(a=>!0===a.isActive),bF=(0,d.jsx)(j.aF,{isOpen:O,onClose:bA,title:`Apply Proxy (${n.length} connections)`,children:(0,d.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,d.jsxs)("div",{className:"flex flex-col",children:[(0,d.jsxs)("button",{onClick:()=>{let a=w.filter(a=>!0===a.isActive);return 0===a.length?void alert("No active proxy pools available."):bB(n.map((b,c)=>({connectionId:b.id,proxyPoolId:a[c%a.length].id})))},disabled:ag||0===bE.length,className:"flex items-center gap-2 rounded-lg px-3 py-2 text-left transition-colors hover:bg-black/[0.04] dark:hover:bg-white/[0.04] disabled:cursor-not-allowed disabled:opacity-50",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[18px]",children:"sync_alt"}),(0,d.jsx)("span",{className:"text-sm text-text-main",children:"One-to-one (rotate)"})]}),(0,d.jsxs)("button",{onClick:()=>bC(null),disabled:ag,className:"flex items-center gap-2 rounded-lg px-3 py-2 text-left transition-colors hover:bg-black/[0.04] dark:hover:bg-white/[0.04] disabled:cursor-not-allowed disabled:opacity-50",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[18px]",children:"link_off"}),(0,d.jsx)("span",{className:"text-sm text-text-main",children:"None (unbind all)"})]}),w.map(a=>(0,d.jsxs)("button",{onClick:()=>bC(a.id),disabled:ag||!0!==a.isActive,className:"flex items-center gap-2 rounded-lg px-3 py-2 text-left transition-colors hover:bg-black/[0.04] dark:hover:bg-white/[0.04] disabled:cursor-not-allowed disabled:opacity-50",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[18px]",children:"lan"}),(0,d.jsx)("span",{className:"truncate text-sm text-text-main",children:a.name}),!0!==a.isActive&&(0,d.jsx)("span",{className:"text-[10px] text-text-muted",children:"(inactive)"})]},a.id))]}),ag&&(0,d.jsx)("p",{className:"text-xs text-text-muted",children:"Applying..."}),(0,d.jsx)(j.$n,{onClick:bA,variant:"ghost",fullWidth:!0,disabled:ag,children:"Cancel"})]})}),bG=async a=>{if(!$){_(a);try{let b=await fetch("/api/models/test",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({model:`${be}/${a}`})}),c=await b.json();X(b=>({...b,[a]:c.ok?"ok":"error"})),Z(c.ok?"":c.error||"Model not reachable")}catch{X(b=>({...b,[a]:"error"})),Z("Network error")}finally{_(null)}}};return q?(0,d.jsxs)("div",{className:"flex flex-col gap-8",children:[(0,d.jsx)(j.Qv,{}),(0,d.jsx)(j.Qv,{})]}):a1?(0,d.jsxs)("div",{className:"flex min-w-0 flex-col gap-6 px-1 sm:gap-8 sm:px-0",children:[(0,d.jsxs)("div",{className:"min-w-0",children:[(0,d.jsxs)(h(),{href:"/dashboard/providers",className:"inline-flex items-center gap-1 text-sm text-text-muted hover:text-primary transition-colors mb-4",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-lg",children:"arrow_back"}),"Back to Providers"]}),(0,d.jsxs)("div",{className:"flex min-w-0 items-center gap-3 sm:gap-4",children:[(0,d.jsx)("div",{className:"flex size-12 shrink-0 items-center justify-center rounded-lg",style:{backgroundColor:`${a1.color}15`},children:U?(0,d.jsx)("span",{className:"text-sm font-bold",style:{color:a1.color},children:a1.textIcon||a1.id.slice(0,2).toUpperCase()}):(0,d.jsx)(i.default,{src:a8&&a1.apiType?"responses"===a1.apiType?"/providers/oai-r.png":"/providers/oai-cc.png":a9?"/providers/anthropic-m.png":`/providers/${a1.id}.png`,alt:a1.name,width:48,height:48,className:"max-h-12 max-w-12 rounded-lg object-contain",sizes:"48px",onError:()=>V(!0)})}),(0,d.jsxs)("div",{className:"min-w-0",children:[(0,d.jsxs)("div",{className:"flex items-center gap-3 flex-wrap",children:[(0,d.jsx)("h1",{className:"truncate text-2xl font-semibold tracking-tight sm:text-3xl",children:a1.name}),(a1.notice?.apiKeyUrl||a1.notice?.signupUrl||a1.website)&&(0,d.jsxs)("a",{href:a1.notice?.apiKeyUrl||a1.notice?.signupUrl||a1.website,target:"_blank",rel:"noopener noreferrer",className:"text-xs text-primary hover:underline inline-flex items-center gap-1",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-sm",children:"open_in_new"}),a1.notice?.apiKeyUrl?"Get API Key":"Sign up / Learn more"]})]}),(0,d.jsxs)("p",{className:"text-text-muted",children:[n.length," connection",1===n.length?"":"s"]})]})]})]}),a1.deprecated&&(0,d.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,d.jsx)("span",{className:"material-symbols-outlined text-[16px] text-yellow-500 mt-0.5 shrink-0",children:"warning"}),(0,d.jsx)("p",{className:"text-xs text-red-600 dark:text-yellow-400 leading-relaxed",children:a1.deprecationNotice})]}),a1.notice?.text&&!a1.deprecated&&(0,d.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,d.jsx)("span",{className:"material-symbols-outlined text-[16px] text-blue-500 shrink-0",children:"info"}),(0,d.jsx)("p",{className:"min-w-0 flex-1 text-xs leading-relaxed text-blue-600 dark:text-blue-400",children:a1.notice.text}),a1.notice.apiKeyUrl&&(0,d.jsx)("a",{href:a1.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 →"})]}),ba&&t&&(0,d.jsx)(j.Zp,{children:(0,d.jsxs)("div",{className:"mb-4 flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between",children:[(0,d.jsxs)("div",{className:"min-w-0",children:[(0,d.jsx)("h2",{className:"text-lg font-semibold",children:a9?"Anthropic Compatible Details":"OpenAI Compatible Details"}),(0,d.jsxs)("p",{className:"break-all text-sm text-text-muted",children:[a9?"Messages API":"responses"===t.apiType?"Responses API":"Chat Completions"," \xb7 ",(t.baseUrl||"").replace(/\/$/,""),"/",a9?"messages":"responses"===t.apiType?"responses":"chat/completions"]})]}),(0,d.jsxs)("div",{className:"grid grid-cols-1 gap-2 sm:flex sm:items-center",children:[(0,d.jsx)(j.$n,{size:"sm",icon:"add",onClick:()=>{F(""),D(!0)},className:"w-full sm:w-auto",children:"Add API Key"}),(0,d.jsx)(j.$n,{size:"sm",variant:"secondary",icon:"edit",onClick:()=>K(!0),className:"w-full sm:w-auto",children:"Edit"}),(0,d.jsx)(j.$n,{size:"sm",variant:"secondary",icon:"delete",onClick:async()=>{aJ({title:"Delete Compatible Node",message:`Delete this ${a9?"Anthropic":"OpenAI"} Compatible node?`,onConfirm:async()=>{aJ(null);try{(await fetch(`/api/provider-nodes/${g}`,{method:"DELETE"})).ok&&c.push("/dashboard/providers")}catch(a){console.log("Error deleting provider node:",a)}}})},className:"w-full sm:w-auto",children:"Delete"})]})]})}),a5?(0,d.jsx)(j.gw,{providerId:g}):(0,d.jsxs)(j.Zp,{children:[(0,d.jsxs)("div",{className:"mb-5 flex flex-col gap-4",children:[(0,d.jsxs)("div",{className:"flex flex-col gap-3 lg:flex-row lg:items-center lg:justify-between",children:[(0,d.jsxs)("div",{className:"min-w-0",children:[(0,d.jsx)("h2",{className:"text-lg font-semibold",children:"Connections"}),"round-robin"===am&&(0,d.jsx)("p",{className:"mt-1 text-xs text-text-muted",children:"Round Robin distributes requests across active accounts for this provider."})]}),(0,d.jsxs)("div",{className:"flex flex-wrap items-center gap-2 lg:justify-end",children:[n.length>0&&w.length>0&&(0,d.jsx)(j.$n,{size:"sm",variant:"secondary",icon:"lan",onClick:()=>P(!0),children:"Apply Proxy"}),n.length>0&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(j.$n,{size:"sm",variant:"secondary",icon:"sync",onClick:br,disabled:aM,children:aM?"Testing Connection One-by-One...":"Test Connection One-by-One"}),aM&&(0,d.jsx)(j.$n,{size:"sm",variant:"ghost",icon:"stop",onClick:()=>{aM&&(aW.current=!0,aP(!0))},disabled:aO,children:aO?"Stopping...":"Stop"})]}),(0,d.jsxs)("div",{className:"flex items-center gap-2 rounded-xl border border-border bg-surface/60 px-3 py-2 shadow-sm",children:[(0,d.jsx)("span",{className:"text-xs font-medium text-text-muted",children:"Round Robin"}),(0,d.jsx)(j.lM,{checked:"round-robin"===am,onChange:a=>{let b=a?"round-robin":null,c=a?ao||"1":ao;a&&!ao&&ap("1"),an(b),bo(b,c)}}),"round-robin"===am&&(0,d.jsxs)("label",{className:"flex items-center gap-1.5 border-l border-border pl-2",children:[(0,d.jsx)("span",{className:"text-xs text-text-muted",children:"Sticky:"}),(0,d.jsx)("input",{type:"number",min:1,value:ao,onChange:a=>{var b;ap(b=a.target.value),bo("round-robin",b)},placeholder:"1",className:"w-14 rounded-md border border-border bg-background px-2 py-1 text-xs focus:border-primary focus:outline-none",title:"How many selections/sessions use the same account before global round-robin advances."})]})]})]})]}),"round-robin"===am&&(0,d.jsxs)("div",{className:"rounded-2xl border border-border bg-surface/70 p-4 shadow-sm",children:[(0,d.jsxs)("div",{className:"mb-4 flex flex-col gap-2 lg:flex-row lg:items-start lg:justify-between",children:[(0,d.jsxs)("div",{className:"min-w-0",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[18px] text-primary",children:"sticky_note_2"}),(0,d.jsx)("h3",{className:"text-sm font-semibold text-text-main",children:"Provider Round Robin Sticky"})]}),(0,d.jsx)("p",{className:"mt-1 max-w-3xl text-xs leading-relaxed text-text-muted",children:"Choose how this provider keeps the same account/API key/OAuth connection for a client. Leave it on Global to keep the current behavior."})]}),(0,d.jsx)(j.Ex,{variant:"secondary",className:"w-fit shrink-0",children:"Per provider"})]}),(0,d.jsxs)("div",{className:"grid gap-4 lg:grid-cols-3",children:[(0,d.jsxs)("label",{className:"block",children:[(0,d.jsx)("span",{className:"mb-1 block text-[11px] font-semibold uppercase tracking-wide text-text-muted",children:"Sticky mode"}),(0,d.jsxs)("select",{value:aq,onChange:a=>{var b;ar(b=a.target.value),bo("round-robin",ao||"1",{stickyScope:b})},className:"w-full rounded-lg border border-border bg-background px-3 py-2 text-sm text-text-main outline-none focus:border-primary",children:[(0,d.jsx)("option",{value:"global",children:"Global / current behavior"}),(0,d.jsx)("option",{value:"client_ip",children:"Client IP"}),(0,d.jsx)("option",{value:"client_session",children:"Client IP + chat session"})]}),(0,d.jsx)("p",{className:"mt-1 text-[11px] leading-relaxed text-text-muted",children:"Global rotates like before. Client/session modes keep account identity more stable."})]}),(0,d.jsxs)("label",{className:"block",children:[(0,d.jsx)("span",{className:"mb-1 block text-[11px] font-semibold uppercase tracking-wide text-text-muted",children:"Sticky TTL minutes"}),(0,d.jsx)("input",{type:"number",min:1,max:10080,value:as,onChange:a=>{var b;at(b=a.target.value),bo("round-robin",ao||"1",{stickyTtlMinutes:Number(b)||120})},className:"w-full rounded-lg border border-border bg-background px-3 py-2 text-sm text-text-main outline-none focus:border-primary"}),(0,d.jsx)("p",{className:"mt-1 text-[11px] leading-relaxed text-text-muted",children:"Sticky assignments stay in memory and expire after this time."})]}),(0,d.jsxs)("label",{className:"block",children:[(0,d.jsx)("span",{className:"mb-1 block text-[11px] font-semibold uppercase tracking-wide text-text-muted",children:"Rebind after fallback count"}),(0,d.jsx)("input",{type:"number",min:1,max:50,value:ay,onChange:a=>{var b;az(b=a.target.value),bo("round-robin",ao||"1",{stickyRebindFailureThreshold:Number(b)||3})},disabled:!aw,className:"w-full rounded-lg border border-border bg-background px-3 py-2 text-sm text-text-main outline-none focus:border-primary disabled:cursor-not-allowed disabled:opacity-50"}),(0,d.jsx)("p",{className:"mt-1 text-[11px] leading-relaxed text-text-muted",children:"After this many temporary fallbacks, the session is rebound to the fallback account."})]})]}),(0,d.jsxs)("div",{className:"mt-4 grid gap-3 lg:grid-cols-2",children:[(0,d.jsxs)("label",{className:"flex items-start gap-3 rounded-xl border border-border bg-background/70 p-3",children:[(0,d.jsx)("input",{type:"checkbox",checked:au,onChange:a=>{var b;av(b=a.target.checked),bo("round-robin",ao||"1",{stickyFallbackToClientIp:b})},className:"mt-0.5"}),(0,d.jsxs)("span",{children:[(0,d.jsx)("span",{className:"block text-xs font-medium text-text-main",children:"Fallback to Client IP when session id is missing"}),(0,d.jsx)("span",{className:"mt-1 block text-[11px] leading-relaxed text-text-muted",children:"Useful when the app does not send a stable chat session id."})]})]}),(0,d.jsxs)("label",{className:"flex items-start gap-3 rounded-xl border border-border bg-background/70 p-3",children:[(0,d.jsx)("input",{type:"checkbox",checked:aw,onChange:a=>{var b;ax(b=a.target.checked),bo("round-robin",ao||"1",{stickyRebindOnFailure:b})},className:"mt-0.5"}),(0,d.jsxs)("span",{children:[(0,d.jsx)("span",{className:"block text-xs font-medium text-text-main",children:"Rebind session after repeated unavailable/rate-limited hits"}),(0,d.jsx)("span",{className:"mt-1 block text-[11px] leading-relaxed text-text-muted",children:"First fallbacks are temporary; repeated failures switch that sticky session to a healthier account."})]})]})]}),(0,d.jsxs)("div",{className:"mt-4 rounded-xl border border-primary/20 bg-primary/5 px-3 py-2 text-[11px] leading-relaxed text-text-muted",children:["Recommended for Codex/Copilot-style OAuth providers:",(0,d.jsx)("span",{className:"font-medium text-text-main",children:" Client IP + chat session"}),", TTL 120 minutes, Client IP fallback enabled, rebind enabled after 3 fallbacks."]})]})]}),(0,d.jsx)(J,{providerId:g,onSaved:bm})," ",0===n.length?(0,d.jsxs)("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[(0,d.jsxs)("div",{className:"flex items-center gap-3",children:[(0,d.jsx)("div",{className:"inline-flex items-center justify-center w-9 h-9 rounded-full bg-primary/10 text-primary shrink-0",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:a3?"lock":"key"})}),(0,d.jsxs)("div",{className:"min-w-0",children:[(0,d.jsx)("p",{className:"text-sm text-text-muted",children:"No connections yet"}),bb&&(0,d.jsxs)("p",{className:"text-xs text-text-muted",children:["Choose ",bc," or ",bd,"."]})]})]}),(0,d.jsx)("div",{className:"flex gap-2",children:bb?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(j.$n,{size:"sm",icon:"lock",variant:"secondary",onClick:a$,children:bc}),(0,d.jsx)(j.$n,{size:"sm",icon:"key",onClick:a_,children:bd})]}):(0,d.jsxs)(d.Fragment,{children:[!ba&&"iflow"===g&&(0,d.jsx)(j.$n,{size:"sm",icon:"cookie",variant:"secondary",onClick:()=>B(!0),children:"Cookie"}),(0,d.jsx)(j.$n,{size:"sm",icon:"add",onClick:a0,children:ba?"Add API Key":"iflow"===g?"OAuth":"Add Connection"})]})})]}):(0,d.jsxs)(d.Fragment,{children:[aU&&(0,d.jsx)("div",{className:"mb-4 rounded-lg border border-black/10 bg-black/[0.02] px-3 py-2 text-xs text-text-muted dark:border-white/10 dark:bg-white/[0.03]",children:(0,d.jsxs)("div",{className:"flex flex-wrap items-center gap-3",children:[(0,d.jsxs)("span",{children:["Total: ",aU.total]}),(0,d.jsxs)("span",{children:["Completed: ",aU.completed]}),(0,d.jsxs)("span",{children:["Passed: ",aU.passed]}),(0,d.jsxs)("span",{children:["Failed: ",aU.failed]}),aU.stopped&&(0,d.jsx)("span",{className:"text-amber-600 dark:text-amber-400",children:"Stopped"}),aM&&aQ&&(0,d.jsxs)("span",{children:["Running: ",n.find(a=>a.id===aQ)?.name||aQ]})]})}),bD,!ba&&(0,d.jsxs)("div",{className:"mt-4 grid grid-cols-1 gap-2 sm:flex",children:["iflow"===g&&(0,d.jsx)(j.$n,{size:"sm",icon:"cookie",variant:"secondary",onClick:()=>B(!0),title:"Add connection using browser cookie",className:"w-full sm:w-auto",children:"Cookie"}),bb?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(j.$n,{size:"sm",icon:"lock",variant:"secondary",onClick:a$,className:"w-full sm:w-auto",children:bc}),(0,d.jsx)(j.$n,{size:"sm",icon:"key",onClick:a_,className:"w-full sm:w-auto",children:bd})]}):(0,d.jsx)(j.$n,{size:"sm",icon:"add",onClick:a0,className:"w-full sm:w-auto",children:"Add"})]})]})]}),(0,d.jsxs)(j.Zp,{children:[(0,d.jsxs)("div",{className:"mb-4 flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between",children:[(0,d.jsx)("h2",{className:"text-lg font-semibold",children:"Available Models"}),!ba&&(a=[...a6,...aE.filter(a=>!a6.some(b=>b.id===a.id))].filter(a=>!a.type||"llm"===a.type).map(a=>a.id).filter(a=>!aG.includes(a)),(0,d.jsxs)("div",{className:"flex gap-2",children:[aG.length>0&&(0,d.jsx)(j.$n,{size:"sm",variant:"secondary",icon:"restart_alt",onClick:bk,children:"Active All"}),a.length>0&&(0,d.jsx)(j.$n,{size:"sm",variant:"secondary",icon:"block",onClick:()=>bj(a),children:"Disable All"})]}))]}),!!Y&&(0,d.jsx)("p",{className:"text-xs text-red-500 mb-3 break-words",children:Y}),(()=>{let a,b,c;if(ba)return(0,d.jsx)(r,{providerStorageAlias:be,providerDisplayAlias:bf,modelAliases:S,copied:aX,onCopy:aY,onSetAlias:bp,onDeleteAlias:bq,connections:n,isAnthropic:a9});let e=[...a6,...aE.filter(a=>!a6.some(b=>b.id===a.id))].filter(a=>!a.type||"llm"===a.type),f=new Set(aG),h=e.filter(a=>!f.has(a.id)),i=e.filter(a=>f.has(a.id)),j=Object.entries(S).filter(([a,b])=>{let c=`${be}/`;if(!b.startsWith(c))return!1;let d=b.slice(c.length);return a1.passthroughModels?!a6.some(a=>a.id===d):!a6.some(a=>a.id===d)&&a===d}).map(([a,b])=>({id:b.slice(`${be}/`.length),alias:a,fullModel:b}));return(0,d.jsxs)("div",{className:"flex flex-wrap gap-3",children:[j.map(a=>(0,d.jsx)(p,{model:{id:a.id},fullModel:`${bf}/${a.id}`,alias:a.alias,copied:aX,onCopy:aY,onSetAlias:()=>{},onDeleteAlias:()=>bq(a.alias),testStatus:W[a.id],onTest:n.length>0||a5?()=>bG(a.id):void 0,isTesting:$===a.id,isCustom:!0,isFree:!1},a.id)),h.map(a=>{let b=`${be}/${a.id}`,c=`${g}/${a.id}`,e=Object.entries(S).find(([,a])=>a===b||a===c)?.[0];return(0,d.jsx)(p,{model:a,fullModel:`${bf}/${a.id}`,alias:e,copied:aX,onCopy:aY,onSetAlias:b=>bp(a.id,b,be),onDeleteAlias:()=>bq(e),testStatus:W[a.id],onTest:n.length>0||a5?()=>bG(a.id):void 0,isTesting:$===a.id,isFree:a.isFree,onDisable:()=>bh(a.id)},a.id)}),(0,d.jsxs)("button",{onClick:()=>ab(!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,d.jsx)("span",{className:"material-symbols-outlined text-sm",children:"add"}),"Add Model"]}),aC.length>0&&(a=new Set(Object.values(S)),b=new Set(a6.map(a=>a.id)),0===(c=aC.filter(c=>!a.has(`${be}/${c.id}`)&&!b.has(c.id))).length?null:(0,d.jsxs)("div",{className:"w-full mt-2",children:[(0,d.jsx)("p",{className:"text-xs text-text-muted mb-2",children:"Suggested free models (≥200k context):"}),(0,d.jsx)("div",{className:"flex flex-wrap gap-2",children:c.map(a=>(0,d.jsxs)("button",{onClick:async()=>{let b=a.id.split("/").pop();await bp(a.id,b,be)},className:"flex items-center gap-1 px-2.5 py-1.5 rounded-lg border border-black/10 dark:border-white/10 text-xs text-text-muted hover:text-primary hover:border-primary/40 hover:bg-primary/5 transition-colors",title:`${a.name} \xb7 ${(a.contextLength/1e3).toFixed(0)}k ctx`,children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[13px]",children:"add"}),a.id.split("/").pop()]},a.id))})]})),i.length>0&&(0,d.jsxs)("div",{className:"w-full mt-2",children:[(0,d.jsxs)("p",{className:"text-xs text-text-muted mb-2",children:["Disabled models (",i.length,"):"]}),(0,d.jsx)("div",{className:"flex flex-wrap gap-2",children:i.map(a=>(0,d.jsxs)("button",{onClick:()=>bi(a.id),className:"flex items-center gap-1 px-2.5 py-1.5 rounded-lg border border-dashed border-black/10 dark:border-white/10 text-xs text-text-muted hover:text-primary hover:border-primary/40 hover:bg-primary/5 transition-colors",title:"Restore model",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[13px]",children:"add"}),a.id]},a.id))})]})]})})()]}),bF,"kiro"===g?(0,d.jsx)(j.Mh,{isOpen:y,providerInfo:a1,onSuccess:bu,onClose:()=>z(!1)}):"cursor"===g?(0,d.jsx)(j.G9,{isOpen:y,onSuccess:bu,onClose:()=>z(!1)}):"gitlab"===g?(0,d.jsx)(j.vj,{isOpen:y,providerInfo:a1,onSuccess:bu,onClose:()=>z(!1)}):(0,d.jsx)(j.LF,{isOpen:y,provider:g,providerInfo:a1,onSuccess:bu,onClose:()=>z(!1)}),"iflow"===g&&(0,d.jsx)(j.vE,{isOpen:A,onSuccess:()=>{bm(),B(!1)},onClose:()=>B(!1)}),(0,d.jsx)(L,{isOpen:C,provider:g,providerName:a1.name,isCompatible:ba,isAnthropic:a9,authType:a1?.authType,authHint:a1?.authHint,website:a1?.website,proxyPools:w,error:E,onSave:bv,onBulkDone:bm,onClose:()=>{F(""),D(!1)}}),(0,d.jsx)(j.wI,{isOpen:G,connection:Q,proxyPools:w,onSave:bw,onClose:()=>H(!1)}),ba&&(0,d.jsx)(M,{isOpen:I,node:t,onSave:bn,onClose:()=>K(!1),isAnthropic:a9}),!ba&&(0,d.jsx)(N,{isOpen:aa,providerAlias:be,providerDisplayAlias:bf,onSave:async a=>{let b=a1?.passthroughModels?a.split("/").pop():a;await bp(a,b,be),ab(!1)},onClose:()=>ab(!1)}),(0,d.jsx)(j.uo,{isOpen:aK,onClose:()=>aL(!1),onConfirm:()=>{(aL(!1),a3)?aZ():a_()},title:"Risk Notice",message:a1?.deprecationNotice,confirmText:"I Understand, Continue",cancelText:"Cancel",variant:"danger"}),(0,d.jsx)(j.uo,{isOpen:!!aI,onClose:()=>aJ(null),onConfirm:aI?.onConfirm,title:aI?.title||"Confirm",message:aI?.message,variant:"danger"})]}):(0,d.jsxs)("div",{className:"text-center py-20",children:[(0,d.jsx)("p",{className:"text-text-muted",children:"Provider not found"}),(0,d.jsx)(h(),{href:"/dashboard/providers",className:"text-primary mt-4 inline-block",children:"Back to Providers"})]})}L.propTypes={isOpen:o().bool.isRequired,provider:o().string,providerName:o().string,isCompatible:o().bool,isAnthropic:o().bool,authType:o().string,authHint:o().string,website:o().string,proxyPools:o().arrayOf(o().shape({id:o().string,name:o().string})),error:o().string,onSave:o().func.isRequired,onBulkDone:o().func,onClose:o().func.isRequired},M.propTypes={isOpen:o().bool.isRequired,node:o().shape({id:o().string,name:o().string,prefix:o().string,apiType:o().string,baseUrl:o().string,providerSpecificData:o().object,tags:o().oneOfType([o().string,o().array]),maxInFlight:o().oneOfType([o().string,o().number])}),onSave:o().func.isRequired,onClose:o().func.isRequired,isAnthropic:o().bool},N.propTypes={isOpen:o().bool.isRequired,providerAlias:o().string.isRequired,providerDisplayAlias:o().string.isRequired,onSave:o().func.isRequired,onClose:o().func.isRequired}},63033:a=>{"use strict";a.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},70722:a=>{"use strict";a.exports=require("next/dist/shared/lib/invariant-error")},73024:a=>{"use strict";a.exports=require("node:fs")},76760:a=>{"use strict";a.exports=require("node:path")},77068:a=>{"use strict";a.exports=require("next/dist/shared/lib/size-limit")},77598:a=>{"use strict";a.exports=require("node:crypto")},80099:a=>{"use strict";a.exports=require("node:sqlite")},81787:a=>{"use strict";a.exports=require("bun:sqlite")},86439:a=>{"use strict";a.exports=require("next/dist/shared/lib/no-fallback-error.external")},87550:a=>{"use strict";a.exports=require("better-sqlite3")},93110:(a,b,c)=>{"use strict";c.r(b),c.d(b,{default:()=>d});let d=(0,c(77943).registerClientReference)(function(){throw Error("Attempted to call the default export of \"D:\\\\bluerouter\\\\src\\\\app\\\\(dashboard)\\\\dashboard\\\\providers\\\\[id]\\\\page.js\" from the server, but it's on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"D:\\bluerouter\\src\\app\\(dashboard)\\dashboard\\providers\\[id]\\page.js","default")},94735:a=>{"use strict";a.exports=require("events")}};var b=require("../../../../../webpack-runtime.js");b.C(a);var c=b.X(0,[4741,319,533,3913,1220,4884,5681,4404,6064,7130,6604],()=>b(b.s=52362));module.exports=c})();
|