vansrouter 0.91.0 → 0.91.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/app/.next-cli-build/BUILD_ID +1 -1
- package/app/.next-cli-build/app-path-routes-manifest.json +7 -7
- package/app/.next-cli-build/build-manifest.json +2 -2
- package/app/.next-cli-build/prerender-manifest.json +3 -3
- 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_client-reference-manifest.js +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_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/[kind]/[id]/page.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_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/providers/[id]/page.js +3 -3
- 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.js +2 -2
- 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-fitness/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/pxpipe/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/token-saver/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 +3 -3
- package/app/.next-cli-build/server/app/_not-found.segments/_full.segment.rsc +3 -3
- 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 +3 -3
- 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 +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/all-statuses/route.js +5 -5
- package/app/.next-cli-build/server/app/api/cli-tools/antigravity-mitm/alias/route.js +2 -2
- package/app/.next-cli-build/server/app/api/cli-tools/claude-settings/route.js +2 -2
- package/app/.next-cli-build/server/app/api/cli-tools/cline-settings/route.js +2 -2
- package/app/.next-cli-build/server/app/api/cli-tools/codex-settings/route.js +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/copilot-settings/route.js +2 -2
- package/app/.next-cli-build/server/app/api/cli-tools/cowork-mcp-registry/route.js +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/cowork-mcp-tools/route.js +2 -2
- package/app/.next-cli-build/server/app/api/cli-tools/cowork-settings/route.js +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/deepseek-tui-settings/route.js +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/devin-settings/route.js +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/droid-settings/route.js +2 -2
- package/app/.next-cli-build/server/app/api/cli-tools/grok-build-settings/route.js +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/hermes-settings/route.js +3 -3
- package/app/.next-cli-build/server/app/api/cli-tools/jcode-settings/route.js +2 -2
- package/app/.next-cli-build/server/app/api/cli-tools/kilo-settings/route.js +2 -2
- package/app/.next-cli-build/server/app/api/cli-tools/openclaw-settings/route.js +2 -2
- package/app/.next-cli-build/server/app/api/cli-tools/opencode-settings/route.js +1 -1
- package/app/.next-cli-build/server/app/api/providers/[id]/gcp-projects/route.js +1 -1
- package/app/.next-cli-build/server/app/api/providers/route.js +1 -1
- package/app/.next-cli-build/server/app/api/tunnel/tailscale-install/route.js +3 -3
- package/app/.next-cli-build/server/app/api/version/route.js +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 +3 -3
- package/app/.next-cli-build/server/app/callback.segments/_full.segment.rsc +3 -3
- 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 +3 -3
- package/app/.next-cli-build/server/app/callback.segments/_tree.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/callback.segments/callback/__PAGE__.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/callback.segments/callback.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/basic-chat.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/basic-chat.rsc +5 -5
- 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 +5 -5
- 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 +3 -3
- package/app/.next-cli-build/server/app/dashboard/basic-chat.segments/_tree.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/cli-tools.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/cli-tools.rsc +5 -5
- 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 +5 -5
- 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 +3 -3
- package/app/.next-cli-build/server/app/dashboard/cli-tools.segments/_tree.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/combos.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/combos.rsc +5 -5
- 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 +5 -5
- 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 +3 -3
- package/app/.next-cli-build/server/app/dashboard/combos.segments/_tree.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/endpoint.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/endpoint.rsc +5 -5
- package/app/.next-cli-build/server/app/dashboard/endpoint.segments/!KGRhc2hib2FyZCk/dashboard/endpoint/__PAGE__.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/endpoint.segments/!KGRhc2hib2FyZCk/dashboard/endpoint.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/endpoint.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/endpoint.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/endpoint.segments/_full.segment.rsc +5 -5
- 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 +3 -3
- package/app/.next-cli-build/server/app/dashboard/endpoint.segments/_tree.segment.rsc +1 -1
- 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 +5 -5
- 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 +5 -5
- 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 +3 -3
- package/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/_tree.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/mitm.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/mitm.rsc +5 -5
- 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 +5 -5
- 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 +3 -3
- package/app/.next-cli-build/server/app/dashboard/mitm.segments/_tree.segment.rsc +1 -1
- 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 +2 -2
- package/app/.next-cli-build/server/app/dashboard/profile.segments/!KGRhc2hib2FyZCk/dashboard/profile.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/profile.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/profile.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -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 +3 -3
- package/app/.next-cli-build/server/app/dashboard/profile.segments/_tree.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/providers/new.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/providers/new.rsc +5 -5
- 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 +5 -5
- 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 +3 -3
- package/app/.next-cli-build/server/app/dashboard/providers/new.segments/_tree.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/providers.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/providers.rsc +5 -5
- 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 +5 -5
- 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 +3 -3
- package/app/.next-cli-build/server/app/dashboard/providers.segments/_tree.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/proxy-fitness.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/proxy-fitness.rsc +5 -5
- package/app/.next-cli-build/server/app/dashboard/proxy-fitness.segments/!KGRhc2hib2FyZCk/dashboard/proxy-fitness/__PAGE__.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/proxy-fitness.segments/!KGRhc2hib2FyZCk/dashboard/proxy-fitness.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/proxy-fitness.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/proxy-fitness.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/proxy-fitness.segments/_full.segment.rsc +5 -5
- package/app/.next-cli-build/server/app/dashboard/proxy-fitness.segments/_head.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/proxy-fitness.segments/_index.segment.rsc +3 -3
- package/app/.next-cli-build/server/app/dashboard/proxy-fitness.segments/_tree.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/proxy-pools.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/proxy-pools.rsc +5 -5
- 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 +5 -5
- 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 +3 -3
- package/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/_tree.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/pxpipe.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/pxpipe.rsc +5 -5
- package/app/.next-cli-build/server/app/dashboard/pxpipe.segments/!KGRhc2hib2FyZCk/dashboard/pxpipe/__PAGE__.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/pxpipe.segments/!KGRhc2hib2FyZCk/dashboard/pxpipe.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/pxpipe.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/pxpipe.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/pxpipe.segments/_full.segment.rsc +5 -5
- package/app/.next-cli-build/server/app/dashboard/pxpipe.segments/_head.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/pxpipe.segments/_index.segment.rsc +3 -3
- package/app/.next-cli-build/server/app/dashboard/pxpipe.segments/_tree.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/quota.html +2 -2
- package/app/.next-cli-build/server/app/dashboard/quota.rsc +6 -6
- 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 +6 -6
- 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 +3 -3
- package/app/.next-cli-build/server/app/dashboard/quota.segments/_tree.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/settings/pricing/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/dashboard/settings/pricing.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/settings/pricing.rsc +3 -3
- package/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/_full.segment.rsc +3 -3
- 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 +3 -3
- package/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/_tree.segment.rsc +1 -1
- 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 +5 -5
- 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 +5 -5
- 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 +3 -3
- package/app/.next-cli-build/server/app/dashboard/skills.segments/_tree.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/token-saver.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/token-saver.rsc +5 -5
- package/app/.next-cli-build/server/app/dashboard/token-saver.segments/!KGRhc2hib2FyZCk/dashboard/token-saver/__PAGE__.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/token-saver.segments/!KGRhc2hib2FyZCk/dashboard/token-saver.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/token-saver.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/token-saver.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/token-saver.segments/_full.segment.rsc +5 -5
- package/app/.next-cli-build/server/app/dashboard/token-saver.segments/_head.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/token-saver.segments/_index.segment.rsc +3 -3
- package/app/.next-cli-build/server/app/dashboard/token-saver.segments/_tree.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/translator.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/translator.rsc +5 -5
- 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 +5 -5
- 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 +3 -3
- package/app/.next-cli-build/server/app/dashboard/translator.segments/_tree.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/usage.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/usage.rsc +5 -5
- 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 +5 -5
- 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 +3 -3
- package/app/.next-cli-build/server/app/dashboard/usage.segments/_tree.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard.html +1 -1
- package/app/.next-cli-build/server/app/dashboard.rsc +5 -5
- 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 +5 -5
- 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 +3 -3
- package/app/.next-cli-build/server/app/dashboard.segments/_tree.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/landing/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/landing.html +1 -1
- package/app/.next-cli-build/server/app/landing.rsc +3 -3
- package/app/.next-cli-build/server/app/landing.segments/_full.segment.rsc +3 -3
- 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 +3 -3
- package/app/.next-cli-build/server/app/landing.segments/_tree.segment.rsc +1 -1
- 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 +3 -3
- package/app/.next-cli-build/server/app/login.segments/_tree.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/login.segments/login/__PAGE__.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/login.segments/login.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/masuk/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app-paths-manifest.json +7 -7
- package/app/.next-cli-build/server/chunks/1632.js +1 -1
- package/app/.next-cli-build/server/chunks/2557.js +1 -1
- package/app/.next-cli-build/server/chunks/2764.js +1 -1
- package/app/.next-cli-build/server/chunks/3539.js +1 -1
- package/app/.next-cli-build/server/chunks/4502.js +1 -1
- package/app/.next-cli-build/server/chunks/4574.js +2 -2
- package/app/.next-cli-build/server/chunks/4836.js +1 -1
- package/app/.next-cli-build/server/chunks/5006.js +1 -1
- package/app/.next-cli-build/server/chunks/5302.js +1 -1
- package/app/.next-cli-build/server/chunks/5598.js +1 -1
- package/app/.next-cli-build/server/chunks/622.js +1 -1
- package/app/.next-cli-build/server/chunks/7104.js +1 -1
- package/app/.next-cli-build/server/chunks/9984.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/server/server-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/server-reference-manifest.json +1 -1
- package/app/.next-cli-build/static/chunks/4385-c0914bc328af003a.js +1 -0
- package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/media-providers/[kind]/[id]/{page-775d2e9133c07844.js → page-7e4411e7070e11c8.js} +1 -1
- package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/providers/[id]/page-5039d324c1af44cd.js +12 -0
- package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/providers/page-ac56e568902351a0.js +1 -0
- package/app/_nm/react/LICENSE +21 -0
- package/app/_nm/react/README.md +37 -0
- package/app/_nm/react/cjs/react-compiler-runtime.development.js +24 -0
- package/app/_nm/react/cjs/react-compiler-runtime.production.js +16 -0
- package/app/_nm/react/cjs/react-compiler-runtime.profiling.js +16 -0
- package/app/_nm/react/cjs/react-jsx-dev-runtime.development.js +338 -0
- package/app/_nm/react/cjs/react-jsx-dev-runtime.production.js +14 -0
- package/app/_nm/react/cjs/react-jsx-dev-runtime.profiling.js +14 -0
- package/app/_nm/react/cjs/react-jsx-dev-runtime.react-server.development.js +370 -0
- package/app/_nm/react/cjs/react-jsx-dev-runtime.react-server.production.js +40 -0
- package/app/_nm/react/cjs/react-jsx-runtime.development.js +352 -0
- package/app/_nm/react/cjs/react-jsx-runtime.production.js +34 -0
- package/app/_nm/react/cjs/react-jsx-runtime.profiling.js +34 -0
- package/app/_nm/react/cjs/react-jsx-runtime.react-server.development.js +370 -0
- package/app/_nm/react/cjs/react-jsx-runtime.react-server.production.js +40 -0
- package/app/_nm/react/cjs/react.development.js +1284 -0
- package/app/_nm/react/cjs/react.production.js +542 -0
- package/app/_nm/react/cjs/react.react-server.development.js +848 -0
- package/app/_nm/react/cjs/react.react-server.production.js +423 -0
- package/app/_nm/react/compiler-runtime.js +14 -0
- package/app/_nm/react/index.js +7 -0
- package/app/_nm/react/jsx-dev-runtime.js +7 -0
- package/app/_nm/react/jsx-dev-runtime.react-server.js +7 -0
- package/app/_nm/react/jsx-runtime.js +7 -0
- package/app/_nm/react/jsx-runtime.react-server.js +7 -0
- package/app/_nm/react/package.json +51 -0
- package/app/_nm/react/react.react-server.js +7 -0
- package/app/_nm/react-dom/LICENSE +21 -0
- package/app/_nm/react-dom/README.md +60 -0
- package/app/_nm/react-dom/cjs/react-dom-client.development.js +28121 -0
- package/app/_nm/react-dom/cjs/react-dom-client.production.js +16049 -0
- package/app/_nm/react-dom/cjs/react-dom-profiling.development.js +28503 -0
- package/app/_nm/react-dom/cjs/react-dom-profiling.profiling.js +18068 -0
- package/app/_nm/react-dom/cjs/react-dom-server-legacy.browser.development.js +9877 -0
- package/app/_nm/react-dom/cjs/react-dom-server-legacy.browser.production.js +6603 -0
- package/app/_nm/react-dom/cjs/react-dom-server-legacy.node.development.js +9877 -0
- package/app/_nm/react-dom/cjs/react-dom-server-legacy.node.production.js +6692 -0
- package/app/_nm/react-dom/cjs/react-dom-server.browser.development.js +10601 -0
- package/app/_nm/react-dom/cjs/react-dom-server.browser.production.js +7410 -0
- package/app/_nm/react-dom/cjs/react-dom-server.bun.development.js +9605 -0
- package/app/_nm/react-dom/cjs/react-dom-server.bun.production.js +6745 -0
- package/app/_nm/react-dom/cjs/react-dom-server.edge.development.js +10620 -0
- package/app/_nm/react-dom/cjs/react-dom-server.edge.production.js +7512 -0
- package/app/_nm/react-dom/cjs/react-dom-server.node.development.js +10802 -0
- package/app/_nm/react-dom/cjs/react-dom-server.node.production.js +7707 -0
- package/app/_nm/react-dom/cjs/react-dom-test-utils.development.js +24 -0
- package/app/_nm/react-dom/cjs/react-dom-test-utils.production.js +21 -0
- package/app/_nm/react-dom/cjs/react-dom.development.js +424 -0
- package/app/_nm/react-dom/cjs/react-dom.production.js +210 -0
- package/app/_nm/react-dom/cjs/react-dom.react-server.development.js +340 -0
- package/app/_nm/react-dom/cjs/react-dom.react-server.production.js +152 -0
- package/app/_nm/react-dom/client.js +38 -0
- package/app/_nm/react-dom/client.react-server.js +5 -0
- package/app/_nm/react-dom/index.js +38 -0
- package/app/_nm/react-dom/package.json +117 -0
- package/app/_nm/react-dom/profiling.js +38 -0
- package/app/_nm/react-dom/profiling.react-server.js +5 -0
- package/app/_nm/react-dom/react-dom.react-server.js +7 -0
- package/app/_nm/react-dom/server.browser.js +16 -0
- package/app/_nm/react-dom/server.bun.js +17 -0
- package/app/_nm/react-dom/server.edge.js +17 -0
- package/app/_nm/react-dom/server.js +3 -0
- package/app/_nm/react-dom/server.node.js +18 -0
- package/app/_nm/react-dom/server.react-server.js +5 -0
- package/app/_nm/react-dom/static.browser.js +12 -0
- package/app/_nm/react-dom/static.edge.js +12 -0
- package/app/_nm/react-dom/static.js +3 -0
- package/app/_nm/react-dom/static.node.js +14 -0
- package/app/_nm/react-dom/static.react-server.js +5 -0
- package/app/_nm/react-dom/test-utils.js +7 -0
- package/app/_nm/sql.js/.devcontainer/Dockerfile +76 -0
- package/app/_nm/sql.js/.devcontainer/devcontainer.json +20 -0
- package/app/_nm/sql.js/.eslintrc.js +68 -0
- package/app/_nm/sql.js/.jsdoc.config.json +38 -0
- package/app/_nm/sql.js/.nojekyll +0 -0
- package/app/_nm/sql.js/AUTHORS +8 -0
- package/app/_nm/sql.js/CONTRIBUTING.md +66 -0
- package/app/_nm/sql.js/LICENSE +44 -0
- package/app/_nm/sql.js/README.md +357 -0
- package/app/_nm/sql.js/dist/sql-asm-debug.js +140890 -0
- package/app/_nm/sql.js/dist/sql-asm-memory-growth.js +204 -0
- package/app/_nm/sql.js/dist/sql-asm.js +202 -0
- package/app/_nm/sql.js/dist/sql-wasm-browser-debug.js +7157 -0
- package/app/_nm/sql.js/dist/sql-wasm-browser-debug.wasm +0 -0
- package/app/_nm/sql.js/dist/sql-wasm-browser.js +183 -0
- package/app/_nm/sql.js/dist/sql-wasm-browser.wasm +0 -0
- package/app/_nm/sql.js/dist/sql-wasm-debug.js +7265 -0
- package/app/_nm/sql.js/dist/sql-wasm-debug.wasm +0 -0
- package/app/_nm/sql.js/dist/sql-wasm.wasm +0 -0
- package/app/_nm/sql.js/dist/worker.sql-asm-debug.js +141011 -0
- package/app/_nm/sql.js/dist/worker.sql-asm.js +323 -0
- package/app/_nm/sql.js/dist/worker.sql-wasm-debug.js +7386 -0
- package/app/_nm/sql.js/dist/worker.sql-wasm.js +306 -0
- package/app/_nm/sql.js/documentation_index.md +26 -0
- package/app/_nm/sql.js/eslint.config.cjs +57 -0
- package/app/_nm/sql.js/logo.svg +13 -0
- package/app/package.json +1 -1
- package/cli.js +0 -3
- package/hooks/sqliteRuntime.js +20 -5
- package/package.json +5 -2
- package/app/.next-cli-build/static/chunks/4385-f174ba7bd8d55a16.js +0 -1
- package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/providers/[id]/page-7554227adda5679e.js +0 -12
- package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/providers/page-44af31c220b203a8.js +0 -1
- package/app/_nm/.pnpm/better-sqlite3@12.10.0/node_modules/better-sqlite3/build/Release/better_sqlite3.node +0 -0
- package/app/_nm/.pnpm/better-sqlite3@12.10.0/node_modules/better-sqlite3/lib/database.js +0 -90
- package/app/_nm/.pnpm/better-sqlite3@12.10.0/node_modules/better-sqlite3/lib/index.js +0 -3
- package/app/_nm/.pnpm/better-sqlite3@12.10.0/node_modules/better-sqlite3/lib/methods/aggregate.js +0 -43
- package/app/_nm/.pnpm/better-sqlite3@12.10.0/node_modules/better-sqlite3/lib/methods/backup.js +0 -67
- package/app/_nm/.pnpm/better-sqlite3@12.10.0/node_modules/better-sqlite3/lib/methods/function.js +0 -31
- package/app/_nm/.pnpm/better-sqlite3@12.10.0/node_modules/better-sqlite3/lib/methods/inspect.js +0 -7
- package/app/_nm/.pnpm/better-sqlite3@12.10.0/node_modules/better-sqlite3/lib/methods/pragma.js +0 -12
- package/app/_nm/.pnpm/better-sqlite3@12.10.0/node_modules/better-sqlite3/lib/methods/serialize.js +0 -16
- package/app/_nm/.pnpm/better-sqlite3@12.10.0/node_modules/better-sqlite3/lib/methods/table.js +0 -189
- package/app/_nm/.pnpm/better-sqlite3@12.10.0/node_modules/better-sqlite3/lib/methods/transaction.js +0 -78
- package/app/_nm/.pnpm/better-sqlite3@12.10.0/node_modules/better-sqlite3/lib/methods/wrappers.js +0 -54
- package/app/_nm/.pnpm/better-sqlite3@12.10.0/node_modules/better-sqlite3/lib/sqlite-error.js +0 -20
- package/app/_nm/.pnpm/better-sqlite3@12.10.0/node_modules/better-sqlite3/lib/util.js +0 -12
- package/app/_nm/.pnpm/better-sqlite3@12.10.0/node_modules/better-sqlite3/package.json +0 -59
- /package/app/.next-cli-build/static/{v41gJTKLtRvPbsQjRtfLb → WuRuQCoSteIg58fPNKmNT}/_buildManifest.js +0 -0
- /package/app/.next-cli-build/static/{v41gJTKLtRvPbsQjRtfLb → WuRuQCoSteIg58fPNKmNT}/_ssgManifest.js +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[182],{2710:(e,t,a)=>{Promise.resolve().then(a.bind(a,64347))},21863:(e,t,a)=>{"use strict";function s(e,t){return!1===e?"default":"active"===t||"success"===t?"success":"error"===t||"expired"===t||"unavailable"===t?"error":"default"}a.d(t,{g:()=>s})},64347:(e,t,a)=>{"use strict";a.r(t),a.d(t,{default:()=>B});var s=a(15102),r=a(93278),l=a(93885),o=a.n(l),n=a(82030),i=a(92940),d=a(31704),c=a(31038),m=a(21863);function u({until:e}){let[t,a]=(0,n.useState)("");return((0,n.useEffect)(()=>{let t=()=>{let t=new Date(e).getTime()-Date.now();if(t<=0)return void a("");let s=Math.floor(t/1e3);s<60?a(`${s}s`):s<3600?a(`${Math.floor(s/60)}m ${s%60}s`):a(`${Math.floor(s/3600)}h ${Math.floor(s%3600/60)}m`)};t();let s=setInterval(t,1e3);return()=>clearInterval(s)},[e]),t)?(0,s.jsxs)("span",{className:"text-xs text-orange-500 font-mono",children:["⏱ ",t]}):null}function x({connection:e,proxyPools:t,isOAuth:a,isFirst:r,isLast:l,onMoveUp:o,onMoveDown:d,onToggleActive:c,onUpdateProxy:p,onEdit:h,onDelete:b}){let[g,f]=(0,n.useState)(!1),[y,j]=(0,n.useState)(!1),[v,w]=(0,n.useState)(!1),N=(0,n.useRef)(null),k=new Map((t||[]).map(e=>[e.id,e])),C=e.providerSpecificData?.proxyPoolId||null,S=C?k.get(C):null,$=e.providerSpecificData?.connectionProxyEnabled===!0&&!!e.providerSpecificData?.connectionProxyUrl,P=!!C||$,_=S?`Pool: ${S.name}`:C?`Pool: ${C} (inactive/missing)`:$?`Legacy: ${e.providerSpecificData?.connectionProxyUrl}`:"",I="",A=S?.proxyUrl||e.providerSpecificData?.connectionProxyUrl;if(A)try{let e=new URL(A);I=`${e.protocol}//${e.hostname}${e.port?`:${e.port}`:""}`}catch{I=A}let E=S?.noProxy||e.providerSpecificData?.connectionNoProxy||"",T=S?.isActive===!0?"success":C||$?"error":"default",B=Object.entries(e).filter(([e])=>e.startsWith("modelLock_")).map(([,e])=>e).filter(Boolean).sort()[0]||null;(0,n.useEffect)(()=>{let t=null,a=()=>{w(!!Object.entries(e).filter(([e])=>e.startsWith("modelLock_")).map(([,e])=>e).filter(e=>e&&new Date(e).getTime()>Date.now()).sort()[0])};return a(),B&&(t=setInterval(a,1e3)),()=>{t&&clearInterval(t)}},[B,e]),(0,n.useEffect)(()=>{if(!g)return;let e=e=>{N.current&&!N.current.contains(e.target)&&f(!1)};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[g]);let M="unavailable"!==e.testStatus||v?e.testStatus:"active",O=a?e.name||e.email||e.displayName||"OAuth Account":e.name,K=async e=>{j(!0);try{await p("__none__"===e?null:e)}finally{j(!1),f(!1)}};return(0,s.jsxs)("div",{className:`group flex flex-col gap-3 p-2 rounded-lg sm:flex-row sm:items-center sm:justify-between hover:bg-black/[0.02] dark:hover:bg-white/[0.02] transition-colors ${!1===e.isActive?"opacity-60":""}`,children:[(0,s.jsxs)("div",{className:"flex w-full min-w-0 flex-1 items-start gap-3 sm:items-center",children:[(0,s.jsxs)("div",{className:"flex flex-col",children:[(0,s.jsx)("button",{onClick:o,disabled:r,className:`p-0.5 rounded ${r?"text-text-muted/30 cursor-not-allowed":"hover:bg-sidebar text-text-muted hover:text-primary"}`,children:(0,s.jsx)("span",{className:"material-symbols-outlined text-sm",children:"keyboard_arrow_up"})}),(0,s.jsx)("button",{onClick:d,disabled:l,className:`p-0.5 rounded ${l?"text-text-muted/30 cursor-not-allowed":"hover:bg-sidebar text-text-muted hover:text-primary"}`,children:(0,s.jsx)("span",{className:"material-symbols-outlined text-sm",children:"keyboard_arrow_down"})})]}),(0,s.jsx)("span",{className:"material-symbols-outlined text-base text-text-muted",children:a?"lock":"key"}),(0,s.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,s.jsx)("p",{className:"text-sm font-medium truncate",children:O}),(0,s.jsxs)("div",{className:"flex flex-wrap items-center gap-2 mt-1",children:[(0,s.jsx)(i.Badge,{variant:(0,m.g)(e.isActive,M),size:"sm",dot:!0,children:!1===e.isActive?"disabled":M||"Unknown"}),P&&(0,s.jsx)(i.Badge,{variant:T,size:"sm",children:"Proxy"}),v&&!1!==e.isActive&&(0,s.jsx)(u,{until:B}),e.lastError&&!1!==e.isActive&&(0,s.jsx)("span",{className:"text-xs text-red-500 truncate max-w-[300px]",title:e.lastError,children:e.lastError}),(0,s.jsxs)("span",{className:"text-xs text-text-muted",children:["#",e.priority]})]}),P&&(0,s.jsxs)("div",{className:"mt-1 flex flex-wrap items-center gap-2",children:[(0,s.jsx)("span",{className:"text-[11px] text-text-muted truncate max-w-[420px]",title:_,children:_}),I&&(0,s.jsx)("code",{className:"text-[10px] font-mono bg-black/5 dark:bg-white/5 px-1 py-0.5 rounded text-text-muted",children:I}),E&&(0,s.jsxs)("span",{className:"text-[11px] text-text-muted truncate max-w-[320px]",title:E,children:["no_proxy: ",E]})]})]})]}),(0,s.jsxs)("div",{className:"flex w-full flex-wrap items-center justify-between gap-2 sm:w-auto sm:justify-end",children:[(0,s.jsxs)("div",{className:"flex flex-wrap gap-1",children:[(t||[]).length>0&&(0,s.jsxs)("div",{className:"relative",ref:N,children:[(0,s.jsxs)("button",{onClick:()=>f(e=>!e),className:`flex flex-col items-center px-2 py-1 rounded hover:bg-black/5 dark:hover:bg-white/5 transition-colors ${P?"text-primary":"text-text-muted hover:text-primary"}`,disabled:y,children:[(0,s.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:y?"progress_activity":"lan"}),(0,s.jsx)("span",{className:"text-[10px] leading-tight",children:"Proxy"})]}),g&&(0,s.jsxs)("div",{className:"absolute right-0 top-full mt-1 z-50 bg-bg border border-border rounded-lg shadow-lg py-1 min-w-[160px]",children:[(0,s.jsx)("button",{onClick:()=>K("__none__"),className:`w-full text-left px-3 py-1.5 text-sm hover:bg-black/5 dark:hover:bg-white/5 ${!C?"text-primary font-medium":"text-text-main"}`,children:"None"}),(t||[]).map(e=>(0,s.jsx)("button",{onClick:()=>K(e.id),className:`w-full text-left px-3 py-1.5 text-sm hover:bg-black/5 dark:hover:bg-white/5 ${C===e.id?"text-primary font-medium":"text-text-main"}`,children:e.name},e.id))]})]}),(0,s.jsxs)("button",{onClick:h,className:"flex flex-col items-center px-2 py-1 rounded hover:bg-black/5 dark:hover:bg-white/5 text-text-muted hover:text-primary",children:[(0,s.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"edit"}),(0,s.jsx)("span",{className:"text-[10px] leading-tight",children:"Edit"})]}),(0,s.jsxs)("button",{onClick:b,className:"flex flex-col items-center px-2 py-1 rounded hover:bg-red-500/10 text-red-500",children:[(0,s.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"delete"}),(0,s.jsx)("span",{className:"text-[10px] leading-tight",children:"Delete"})]})]}),(0,s.jsx)(i.Toggle,{size:"sm",checked:e.isActive??!0,onChange:c,title:e.isActive??!0?"Disable":"Enable"})]})]})}function p({isOpen:e,provider:t,providerName:a,proxyPools:r,onSave:l,onClose:o}){let d="__none__",[c,m]=(0,n.useState)({name:"",apiKey:"",priority:1,proxyPoolId:d}),[u,x]=(0,n.useState)(!1),[h,b]=(0,n.useState)(null),[g,f]=(0,n.useState)(!1),y=async()=>{x(!0);try{let e=await fetch("/api/providers/validate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:t,apiKey:c.apiKey})}),a=await e.json();b(a.valid?"success":"failed")}catch{b("failed")}finally{x(!1)}},j=async()=>{if(t&&c.apiKey){f(!0);try{let e=!1;try{x(!0),b(null);let a=await fetch("/api/providers/validate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:t,apiKey:c.apiKey})});e=!!(await a.json()).valid,b(e?"success":"failed")}catch{b("failed")}finally{x(!1)}await l({name:c.name,apiKey:c.apiKey,priority:c.priority,proxyPoolId:c.proxyPoolId===d?null:c.proxyPoolId,testStatus:e?"active":"unknown"})}finally{f(!1)}}};return t?(0,s.jsx)(i.Modal,{isOpen:e,title:`Add ${a||t} API Key`,onClose:o,children:(0,s.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"text-xs text-text-muted mb-1 block",children:"Name"}),(0,s.jsx)("input",{className:"w-full px-3 py-2 text-sm border border-border rounded-lg bg-background focus:outline-none focus:border-primary",value:c.name,onChange:e=>m({...c,name:e.target.value}),placeholder:"Production Key"})]}),(0,s.jsxs)("div",{className:"flex gap-2",children:[(0,s.jsxs)("div",{className:"flex-1",children:[(0,s.jsx)("label",{className:"text-xs text-text-muted mb-1 block",children:"API Key"}),(0,s.jsx)("input",{type:"password",className:"w-full px-3 py-2 text-sm border border-border rounded-lg bg-background focus:outline-none focus:border-primary",value:c.apiKey,onChange:e=>m({...c,apiKey:e.target.value})})]}),(0,s.jsx)("div",{className:"pt-6",children:(0,s.jsx)(i.Button,{onClick:y,disabled:!c.apiKey||u||g,variant:"secondary",children:u?"Checking...":"Check"})})]}),h&&(0,s.jsx)(i.Badge,{variant:"success"===h?"success":"error",children:"success"===h?"Valid":"Invalid"}),(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"text-xs text-text-muted mb-1 block",children:"Priority"}),(0,s.jsx)("input",{type:"number",className:"w-full px-3 py-2 text-sm border border-border rounded-lg bg-background focus:outline-none focus:border-primary",value:c.priority,onChange:e=>m({...c,priority:Number.parseInt(e.target.value)||1})})]}),(0,s.jsx)(i.Select,{label:"Proxy Pool",value:c.proxyPoolId,onChange:e=>m({...c,proxyPoolId:e.target.value}),options:[{value:d,label:"None"},...(r||[]).map(e=>({value:e.id,label:e.name}))]}),(0,s.jsxs)("div",{className:"flex gap-2",children:[(0,s.jsx)(i.Button,{onClick:j,fullWidth:!0,disabled:!c.name||!c.apiKey||g,children:g?"Saving...":"Save"}),(0,s.jsx)(i.Button,{onClick:o,variant:"ghost",fullWidth:!0,children:"Cancel"})]})]})}):null}function h({providerId:e,isOAuth:t}){let[a,r]=(0,n.useState)([]),[l,o]=(0,n.useState)([]),[d,c]=(0,n.useState)(!0),[m,u]=(0,n.useState)(!1),[b,g]=(0,n.useState)(!1),[f,y]=(0,n.useState)(null),[j,v]=(0,n.useState)(null),[w,N]=(0,n.useState)("1"),[k,C]=(0,n.useState)(null),S=(0,n.useCallback)(async()=>{try{let[t,a,s]=await Promise.all([fetch("/api/providers",{cache:"no-store"}),fetch("/api/proxy-pools?isActive=true",{cache:"no-store"}),fetch("/api/settings",{cache:"no-store"})]),l=await t.json(),n=await a.json(),i=s.ok?await s.json():{};t.ok&&r((l.connections||[]).filter(t=>t.provider===e)),a.ok&&o(n.proxyPools||[]);let d=(i.providerStrategies||{})[e]||{};v(d.fallbackStrategy||null),N(null!=d.stickyRoundRobinLimit?String(d.stickyRoundRobinLimit):"1")}catch(e){console.log("ConnectionsCard fetch error:",e)}finally{c(!1)}},[e]);(0,n.useEffect)(()=>{S()},[S]);let $=async(t,a)=>{try{let s=await fetch("/api/settings",{cache:"no-store"}),r=(s.ok?await s.json():{}).providerStrategies||{},l={};t&&(l.fallbackStrategy=t),"round-robin"===t&&""!==a&&(l.stickyRoundRobinLimit=Number(a)||3);let o={...r};0===Object.keys(l).length?delete o[e]:o[e]=l,await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({providerStrategies:o})})}catch(e){console.log("saveStrategy error:",e)}},P=async(e,t)=>{let s=[...a];[s[e],s[t]]=[s[t],s[e]],r(s);try{await Promise.all([fetch(`/api/providers/${s[e].id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({priority:e})}),fetch(`/api/providers/${s[t].id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({priority:t})})])}catch{await S()}},_=async e=>{C({title:"Delete Connection",message:"Delete this connection?",onConfirm:async()=>{C(null);try{(await fetch(`/api/providers/${e}`,{method:"DELETE"})).ok&&r(t=>t.filter(t=>t.id!==e))}catch(e){console.log("delete error:",e)}}})},I=async(e,t)=>{try{(await fetch(`/api/providers/${e}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({isActive:t})})).ok&&r(a=>a.map(a=>a.id===e?{...a,isActive:t}:a))}catch(e){console.log("toggle error:",e)}},A=async(e,t)=>{try{(await fetch(`/api/providers/${e}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({proxyPoolId:t||null})})).ok&&r(a=>a.map(a=>a.id===e?{...a,providerSpecificData:{...a.providerSpecificData,proxyPoolId:t||null}}:a))}catch(e){console.log("proxy error:",e)}},E=async t=>{try{(await fetch("/api/providers",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:e,...t})})).ok&&(await S(),u(!1))}catch(e){console.log("save apikey error:",e)}},T=async e=>{try{(await fetch(`/api/providers/${f.id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})).ok&&(await S(),g(!1))}catch(e){console.log("update connection error:",e)}};return d?(0,s.jsx)(i.Card,{children:(0,s.jsx)("div",{className:"h-20 animate-pulse bg-black/5 rounded-lg"})}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)(i.Card,{children:[(0,s.jsxs)("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between mb-4",children:[(0,s.jsx)("h2",{className:"text-lg font-semibold",children:"Connections"}),(0,s.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,s.jsx)("span",{className:"text-xs text-text-muted font-medium",children:"Round Robin"}),(0,s.jsx)(i.Toggle,{checked:"round-robin"===j,onChange:e=>{let t=e?"round-robin":null;v(t),e&&!w&&N("1"),$(t,e?w||"1":w)}}),"round-robin"===j&&(0,s.jsxs)("div",{className:"flex flex-wrap items-center gap-1.5",children:[(0,s.jsx)("span",{className:"text-xs text-text-muted",children:"Sticky:"}),(0,s.jsx)("input",{type:"number",min:1,value:w,onChange:e=>{N(e.target.value),$("round-robin",e.target.value)},className:"w-16 px-2 py-1 text-xs border border-border rounded-md bg-background focus:outline-none focus:border-primary"})]})]})]}),0===a.length?(0,s.jsxs)("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[(0,s.jsx)("p",{className:"text-sm text-text-muted",children:"No connections yet"}),(0,s.jsx)(i.Button,{size:"sm",icon:"add",onClick:()=>u(!0),children:"Add Connection"})]}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("div",{className:"flex flex-col divide-y divide-black/[0.03] dark:divide-white/[0.03]",children:a.map((e,r)=>(0,s.jsx)(x,{connection:e,proxyPools:l,isOAuth:t,isFirst:0===r,isLast:r===a.length-1,onMoveUp:()=>P(r,r-1),onMoveDown:()=>P(r,r+1),onToggleActive:t=>I(e.id,t),onUpdateProxy:t=>A(e.id,t),onEdit:()=>{y(e),g(!0)},onDelete:()=>_(e.id)},e.id))}),(0,s.jsx)("div",{className:"mt-4 flex justify-stretch sm:justify-start",children:(0,s.jsx)(i.Button,{size:"sm",icon:"add",onClick:()=>u(!0),children:"Add"})})]})]}),(0,s.jsx)(p,{isOpen:m,provider:e,proxyPools:l,onSave:E,onClose:()=>u(!1)}),(0,s.jsx)(i.EditConnectionModal,{isOpen:b,connection:f,proxyPools:l,onSave:T,onClose:()=>g(!1)}),(0,s.jsx)(i.ConfirmModal,{isOpen:!!k,onClose:()=>C(null),onConfirm:k?.onConfirm,title:k?.title||"Confirm",message:k?.message,variant:"danger"})]})}var b=a(55223),g=a(21577);function f({model:e,fullModel:t,copied:a,onCopy:r,testStatus:l,isCustom:o,isFree:n,onDeleteAlias:i,onTest:d,isTesting:c}){let m="ok"===l?"#22c55e":"error"===l?"#ef4444":void 0;return(0,s.jsx)("div",{className:`group px-3 py-2 rounded-lg border ${"ok"===l?"border-green-500/40":"error"===l?"border-red-500/40":"border-border"} hover:bg-sidebar/50`,children:(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)("span",{className:"material-symbols-outlined text-base",style:m?{color:m}:void 0,children:"ok"===l?"check_circle":"error"===l?"cancel":"smart_toy"}),(0,s.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,s.jsx)("code",{className:"text-xs text-text-muted font-mono bg-sidebar px-1.5 py-0.5 rounded",children:t}),e.name&&(0,s.jsx)("span",{className:"text-[9px] text-text-muted/70 italic pl-1",children:e.name})]}),d&&(0,s.jsxs)("div",{className:"relative group/btn",children:[(0,s.jsx)("button",{onClick:d,disabled:c,className:`p-0.5 hover:bg-sidebar rounded text-text-muted hover:text-primary transition-opacity ${c?"opacity-100":"opacity-0 group-hover:opacity-100"}`,children:(0,s.jsx)("span",{className:"material-symbols-outlined text-sm",style:c?{animation:"spin 1s linear infinite"}:void 0,children:c?"progress_activity":"science"})}),(0,s.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:c?"Testing...":"Test"})]}),(0,s.jsxs)("div",{className:"relative group/btn",children:[(0,s.jsx)("button",{onClick:()=>r(t,`model-${e.id}`),className:"p-0.5 hover:bg-sidebar rounded text-text-muted hover:text-primary",children:(0,s.jsx)("span",{className:"material-symbols-outlined text-sm",children:a===`model-${e.id}`?"check":"content_copy"})}),(0,s.jsx)("span",{className:"pointer-events-none absolute mt-1 top-5 left-1/2 -translate-x-1/2 text-[10px] text-text-muted whitespace-nowrap opacity-0 group-hover/btn:opacity-100 transition-opacity",children:a===`model-${e.id}`?"Copied!":"Copy"})]}),n&&(0,s.jsx)("span",{className:"text-[10px] font-bold text-green-500 bg-green-500/10 px-1.5 py-0.5 rounded",children:"FREE"}),o&&(0,s.jsx)("button",{onClick:i,className:"p-0.5 hover:bg-red-500/10 rounded text-text-muted hover:text-red-500 opacity-0 group-hover:opacity-100 transition-opacity ml-auto",title:"Remove custom model",children:(0,s.jsx)("span",{className:"material-symbols-outlined text-sm",children:"close"})})]})})}function y({isOpen:e,onSave:t,onClose:a}){let[r,l]=(0,n.useState)(""),o=()=>{r.trim()&&(t(r.trim()),l(""))};return(0,s.jsx)(i.Modal,{isOpen:e,title:"Add Custom Model",onClose:a,children:(0,s.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"text-xs text-text-muted mb-1 block",children:"Model ID"}),(0,s.jsx)("input",{className:"w-full px-3 py-2 text-sm border border-border rounded-lg bg-background focus:outline-none focus:border-primary",value:r,onChange:e=>l(e.target.value),onKeyDown:e=>"Enter"===e.key&&o(),placeholder:"e.g. tts-1-hd",autoFocus:!0})]}),(0,s.jsxs)("div",{className:"flex gap-2",children:[(0,s.jsx)(i.Button,{onClick:o,fullWidth:!0,disabled:!r.trim(),children:"Add"}),(0,s.jsx)(i.Button,{onClick:a,variant:"ghost",fullWidth:!0,children:"Cancel"})]})]})})}function j({providerId:e,kindFilter:t,providerAliasOverride:a}){let{copied:r,copy:l}=(0,g.C)(),[o,d]=(0,n.useState)({}),[m,u]=(0,n.useState)([]),[x,p]=(0,n.useState)({}),[h,v]=(0,n.useState)(null),[w,N]=(0,n.useState)(""),[k,C]=(0,n.useState)(!1),S=a||(0,c.wG)(e),$=t||"llm",P=(0,n.useCallback)(async()=>{try{let[e,t]=await Promise.all([fetch("/api/models/alias"),fetch("/api/models/custom",{cache:"no-store"})]),a=await e.json(),s=await t.json();e.ok&&d(a.aliases||{}),t.ok&&u(s.models||[])}catch(e){console.log("ModelsCard fetch error:",e)}},[]);(0,n.useEffect)(()=>{P()},[P]);let _=async(e,t)=>{let a=`${S}/${e}`;try{(await fetch("/api/models/alias",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({model:a,alias:t})})).ok&&await P()}catch(e){console.log("set alias error:",e)}},I=async e=>{try{(await fetch(`/api/models/alias?alias=${encodeURIComponent(e)}`,{method:"DELETE"})).ok&&await P()}catch(e){console.log("delete alias error:",e)}},A=async e=>{try{(await fetch("/api/models/custom",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({providerAlias:S,id:e,type:$})})).ok&&(await P(),window.dispatchEvent(new CustomEvent("customModelChanged")))}catch(e){console.log("add custom model error:",e)}},E=async e=>{try{let t=new URLSearchParams({providerAlias:S,id:e,type:$});(await fetch(`/api/models/custom?${t}`,{method:"DELETE"})).ok&&(await P(),window.dispatchEvent(new CustomEvent("customModelChanged")))}catch(e){console.log("delete custom model error:",e)}},T=async e=>{if(!h){v(e);try{let a=await fetch("/api/models/test",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({model:`${S}/${e}`,kind:t})}),s=await a.json();p(t=>({...t,[e]:s.ok?"ok":"error"})),N(s.ok?"":s.error||"Model not reachable")}catch{p(t=>({...t,[e]:"error"})),N("Network error")}finally{v(null)}}},B=(0,b.KC)(e),M=t?B.filter(e=>e.kinds?e.kinds.includes(t):(0,b.CP)(e,"llm")===t):B,O=m.filter(e=>e.providerAlias===S&&(0,b.CP)(e,"llm")===$&&!M.some(t=>t.id===e.id));return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)(i.Card,{children:[(0,s.jsx)("div",{className:"flex items-center justify-between mb-4",children:(0,s.jsxs)("h2",{className:"text-lg font-semibold",children:["Models",t?` — ${t.toUpperCase()}`:""]})}),w&&(0,s.jsx)("p",{className:"text-xs text-red-500 mb-3 break-words",children:w}),(0,s.jsxs)("div",{className:"flex flex-wrap gap-3",children:[M.map(e=>{let t=`${S}/${e.id}`,a=Object.entries(o).find(([,e])=>e===t)?.[0];return(0,s.jsx)(f,{model:e,fullModel:`${S}/${e.id}`,alias:a,copied:r,onCopy:l,onSetAlias:t=>_(e.id,t),onDeleteAlias:()=>I(a),testStatus:x[e.id],onTest:()=>T(e.id),isTesting:h===e.id,isFree:e.isFree},e.id)}),O.map(e=>(0,s.jsx)(f,{model:{id:e.id,name:e.name},fullModel:`${S}/${e.id}`,copied:r,onCopy:l,onSetAlias:()=>{},onDeleteAlias:()=>E(e.id),testStatus:x[e.id],onTest:()=>T(e.id),isTesting:h===e.id,isCustom:!0},`${e.id}-${e.type}`)),(0,s.jsxs)("button",{onClick:()=>C(!0),className:"flex items-center gap-1.5 px-3 py-2 rounded-lg border border-dashed border-black/15 dark:border-white/15 text-xs text-text-muted hover:text-primary hover:border-primary/40 transition-colors",children:[(0,s.jsx)("span",{className:"material-symbols-outlined text-sm",children:"add"}),"Add Model"]})]})]}),(0,s.jsx)(y,{isOpen:k,onSave:async e=>{await A(e),C(!1)},onClose:()=>C(!1)})]})}function v({label:e,children:t}){return(0,s.jsxs)("div",{className:"flex min-w-0 flex-col gap-1.5 sm:flex-row sm:items-center sm:gap-3",children:[(0,s.jsx)("span",{className:"w-full text-xs font-medium text-text-muted sm:w-20 sm:shrink-0",children:e}),(0,s.jsx)("div",{className:"w-full min-w-0 flex-1",children:t})]})}let w={webSearch:{inputLabel:"Query",inputPlaceholder:"What is the latest news about AI?",defaultInput:"What is the latest news about AI?",bodyKey:"query",defaultResponse:`{
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[182],{2710:(e,t,a)=>{Promise.resolve().then(a.bind(a,64347))},21863:(e,t,a)=>{"use strict";function s(e,t){return!1===e?"default":"active"===t||"success"===t?"success":"error"===t||"expired"===t||"unavailable"===t?"error":"default"}function r(e){let t=e?.testStatus;return e?.isActive===!1||"unavailable"===t||"error"===t||"expired"===t?"unavailable":"active"}a.d(t,{d:()=>r,g:()=>s})},64347:(e,t,a)=>{"use strict";a.r(t),a.d(t,{default:()=>B});var s=a(15102),r=a(93278),l=a(93885),o=a.n(l),n=a(82030),i=a(92940),d=a(31704),c=a(31038),m=a(21863);function u({until:e}){let[t,a]=(0,n.useState)("");return((0,n.useEffect)(()=>{let t=()=>{let t=new Date(e).getTime()-Date.now();if(t<=0)return void a("");let s=Math.floor(t/1e3);s<60?a(`${s}s`):s<3600?a(`${Math.floor(s/60)}m ${s%60}s`):a(`${Math.floor(s/3600)}h ${Math.floor(s%3600/60)}m`)};t();let s=setInterval(t,1e3);return()=>clearInterval(s)},[e]),t)?(0,s.jsxs)("span",{className:"text-xs text-orange-500 font-mono",children:["⏱ ",t]}):null}function x({connection:e,proxyPools:t,isOAuth:a,isFirst:r,isLast:l,onMoveUp:o,onMoveDown:d,onToggleActive:c,onUpdateProxy:p,onEdit:h,onDelete:b}){let[g,f]=(0,n.useState)(!1),[y,j]=(0,n.useState)(!1),[v,w]=(0,n.useState)(!1),N=(0,n.useRef)(null),k=new Map((t||[]).map(e=>[e.id,e])),C=e.providerSpecificData?.proxyPoolId||null,S=C?k.get(C):null,$=e.providerSpecificData?.connectionProxyEnabled===!0&&!!e.providerSpecificData?.connectionProxyUrl,P=!!C||$,_=S?`Pool: ${S.name}`:C?`Pool: ${C} (inactive/missing)`:$?`Legacy: ${e.providerSpecificData?.connectionProxyUrl}`:"",I="",A=S?.proxyUrl||e.providerSpecificData?.connectionProxyUrl;if(A)try{let e=new URL(A);I=`${e.protocol}//${e.hostname}${e.port?`:${e.port}`:""}`}catch{I=A}let E=S?.noProxy||e.providerSpecificData?.connectionNoProxy||"",T=S?.isActive===!0?"success":C||$?"error":"default",B=Object.entries(e).filter(([e])=>e.startsWith("modelLock_")).map(([,e])=>e).filter(Boolean).sort()[0]||null;(0,n.useEffect)(()=>{let t=null,a=()=>{w(!!Object.entries(e).filter(([e])=>e.startsWith("modelLock_")).map(([,e])=>e).filter(e=>e&&new Date(e).getTime()>Date.now()).sort()[0])};return a(),B&&(t=setInterval(a,1e3)),()=>{t&&clearInterval(t)}},[B,e]),(0,n.useEffect)(()=>{if(!g)return;let e=e=>{N.current&&!N.current.contains(e.target)&&f(!1)};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[g]);let M="unavailable"!==e.testStatus||v?e.testStatus:"active",O=a?e.name||e.email||e.displayName||"OAuth Account":e.name,K=async e=>{j(!0);try{await p("__none__"===e?null:e)}finally{j(!1),f(!1)}};return(0,s.jsxs)("div",{className:`group flex flex-col gap-3 p-2 rounded-lg sm:flex-row sm:items-center sm:justify-between hover:bg-black/[0.02] dark:hover:bg-white/[0.02] transition-colors ${!1===e.isActive?"opacity-60":""}`,children:[(0,s.jsxs)("div",{className:"flex w-full min-w-0 flex-1 items-start gap-3 sm:items-center",children:[(0,s.jsxs)("div",{className:"flex flex-col",children:[(0,s.jsx)("button",{onClick:o,disabled:r,className:`p-0.5 rounded ${r?"text-text-muted/30 cursor-not-allowed":"hover:bg-sidebar text-text-muted hover:text-primary"}`,children:(0,s.jsx)("span",{className:"material-symbols-outlined text-sm",children:"keyboard_arrow_up"})}),(0,s.jsx)("button",{onClick:d,disabled:l,className:`p-0.5 rounded ${l?"text-text-muted/30 cursor-not-allowed":"hover:bg-sidebar text-text-muted hover:text-primary"}`,children:(0,s.jsx)("span",{className:"material-symbols-outlined text-sm",children:"keyboard_arrow_down"})})]}),(0,s.jsx)("span",{className:"material-symbols-outlined text-base text-text-muted",children:a?"lock":"key"}),(0,s.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,s.jsx)("p",{className:"text-sm font-medium truncate",children:O}),(0,s.jsxs)("div",{className:"flex flex-wrap items-center gap-2 mt-1",children:[(0,s.jsx)(i.Badge,{variant:(0,m.g)(e.isActive,M),size:"sm",dot:!0,children:!1===e.isActive?"disabled":M||"Unknown"}),P&&(0,s.jsx)(i.Badge,{variant:T,size:"sm",children:"Proxy"}),v&&!1!==e.isActive&&(0,s.jsx)(u,{until:B}),e.lastError&&!1!==e.isActive&&(0,s.jsx)("span",{className:"text-xs text-red-500 truncate max-w-[300px]",title:e.lastError,children:e.lastError}),(0,s.jsxs)("span",{className:"text-xs text-text-muted",children:["#",e.priority]})]}),P&&(0,s.jsxs)("div",{className:"mt-1 flex flex-wrap items-center gap-2",children:[(0,s.jsx)("span",{className:"text-[11px] text-text-muted truncate max-w-[420px]",title:_,children:_}),I&&(0,s.jsx)("code",{className:"text-[10px] font-mono bg-black/5 dark:bg-white/5 px-1 py-0.5 rounded text-text-muted",children:I}),E&&(0,s.jsxs)("span",{className:"text-[11px] text-text-muted truncate max-w-[320px]",title:E,children:["no_proxy: ",E]})]})]})]}),(0,s.jsxs)("div",{className:"flex w-full flex-wrap items-center justify-between gap-2 sm:w-auto sm:justify-end",children:[(0,s.jsxs)("div",{className:"flex flex-wrap gap-1",children:[(t||[]).length>0&&(0,s.jsxs)("div",{className:"relative",ref:N,children:[(0,s.jsxs)("button",{onClick:()=>f(e=>!e),className:`flex flex-col items-center px-2 py-1 rounded hover:bg-black/5 dark:hover:bg-white/5 transition-colors ${P?"text-primary":"text-text-muted hover:text-primary"}`,disabled:y,children:[(0,s.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:y?"progress_activity":"lan"}),(0,s.jsx)("span",{className:"text-[10px] leading-tight",children:"Proxy"})]}),g&&(0,s.jsxs)("div",{className:"absolute right-0 top-full mt-1 z-50 bg-bg border border-border rounded-lg shadow-lg py-1 min-w-[160px]",children:[(0,s.jsx)("button",{onClick:()=>K("__none__"),className:`w-full text-left px-3 py-1.5 text-sm hover:bg-black/5 dark:hover:bg-white/5 ${!C?"text-primary font-medium":"text-text-main"}`,children:"None"}),(t||[]).map(e=>(0,s.jsx)("button",{onClick:()=>K(e.id),className:`w-full text-left px-3 py-1.5 text-sm hover:bg-black/5 dark:hover:bg-white/5 ${C===e.id?"text-primary font-medium":"text-text-main"}`,children:e.name},e.id))]})]}),(0,s.jsxs)("button",{onClick:h,className:"flex flex-col items-center px-2 py-1 rounded hover:bg-black/5 dark:hover:bg-white/5 text-text-muted hover:text-primary",children:[(0,s.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"edit"}),(0,s.jsx)("span",{className:"text-[10px] leading-tight",children:"Edit"})]}),(0,s.jsxs)("button",{onClick:b,className:"flex flex-col items-center px-2 py-1 rounded hover:bg-red-500/10 text-red-500",children:[(0,s.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"delete"}),(0,s.jsx)("span",{className:"text-[10px] leading-tight",children:"Delete"})]})]}),(0,s.jsx)(i.Toggle,{size:"sm",checked:e.isActive??!0,onChange:c,title:e.isActive??!0?"Disable":"Enable"})]})]})}function p({isOpen:e,provider:t,providerName:a,proxyPools:r,onSave:l,onClose:o}){let d="__none__",[c,m]=(0,n.useState)({name:"",apiKey:"",priority:1,proxyPoolId:d}),[u,x]=(0,n.useState)(!1),[h,b]=(0,n.useState)(null),[g,f]=(0,n.useState)(!1),y=async()=>{x(!0);try{let e=await fetch("/api/providers/validate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:t,apiKey:c.apiKey})}),a=await e.json();b(a.valid?"success":"failed")}catch{b("failed")}finally{x(!1)}},j=async()=>{if(t&&c.apiKey){f(!0);try{let e=!1;try{x(!0),b(null);let a=await fetch("/api/providers/validate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:t,apiKey:c.apiKey})});e=!!(await a.json()).valid,b(e?"success":"failed")}catch{b("failed")}finally{x(!1)}await l({name:c.name,apiKey:c.apiKey,priority:c.priority,proxyPoolId:c.proxyPoolId===d?null:c.proxyPoolId,testStatus:e?"active":"unknown"})}finally{f(!1)}}};return t?(0,s.jsx)(i.Modal,{isOpen:e,title:`Add ${a||t} API Key`,onClose:o,children:(0,s.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"text-xs text-text-muted mb-1 block",children:"Name"}),(0,s.jsx)("input",{className:"w-full px-3 py-2 text-sm border border-border rounded-lg bg-background focus:outline-none focus:border-primary",value:c.name,onChange:e=>m({...c,name:e.target.value}),placeholder:"Production Key"})]}),(0,s.jsxs)("div",{className:"flex gap-2",children:[(0,s.jsxs)("div",{className:"flex-1",children:[(0,s.jsx)("label",{className:"text-xs text-text-muted mb-1 block",children:"API Key"}),(0,s.jsx)("input",{type:"password",className:"w-full px-3 py-2 text-sm border border-border rounded-lg bg-background focus:outline-none focus:border-primary",value:c.apiKey,onChange:e=>m({...c,apiKey:e.target.value})})]}),(0,s.jsx)("div",{className:"pt-6",children:(0,s.jsx)(i.Button,{onClick:y,disabled:!c.apiKey||u||g,variant:"secondary",children:u?"Checking...":"Check"})})]}),h&&(0,s.jsx)(i.Badge,{variant:"success"===h?"success":"error",children:"success"===h?"Valid":"Invalid"}),(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"text-xs text-text-muted mb-1 block",children:"Priority"}),(0,s.jsx)("input",{type:"number",className:"w-full px-3 py-2 text-sm border border-border rounded-lg bg-background focus:outline-none focus:border-primary",value:c.priority,onChange:e=>m({...c,priority:Number.parseInt(e.target.value)||1})})]}),(0,s.jsx)(i.Select,{label:"Proxy Pool",value:c.proxyPoolId,onChange:e=>m({...c,proxyPoolId:e.target.value}),options:[{value:d,label:"None"},...(r||[]).map(e=>({value:e.id,label:e.name}))]}),(0,s.jsxs)("div",{className:"flex gap-2",children:[(0,s.jsx)(i.Button,{onClick:j,fullWidth:!0,disabled:!c.name||!c.apiKey||g,children:g?"Saving...":"Save"}),(0,s.jsx)(i.Button,{onClick:o,variant:"ghost",fullWidth:!0,children:"Cancel"})]})]})}):null}function h({providerId:e,isOAuth:t}){let[a,r]=(0,n.useState)([]),[l,o]=(0,n.useState)([]),[d,c]=(0,n.useState)(!0),[m,u]=(0,n.useState)(!1),[b,g]=(0,n.useState)(!1),[f,y]=(0,n.useState)(null),[j,v]=(0,n.useState)(null),[w,N]=(0,n.useState)("1"),[k,C]=(0,n.useState)(null),S=(0,n.useCallback)(async()=>{try{let[t,a,s]=await Promise.all([fetch("/api/providers",{cache:"no-store"}),fetch("/api/proxy-pools?isActive=true",{cache:"no-store"}),fetch("/api/settings",{cache:"no-store"})]),l=await t.json(),n=await a.json(),i=s.ok?await s.json():{};t.ok&&r((l.connections||[]).filter(t=>t.provider===e)),a.ok&&o(n.proxyPools||[]);let d=(i.providerStrategies||{})[e]||{};v(d.fallbackStrategy||null),N(null!=d.stickyRoundRobinLimit?String(d.stickyRoundRobinLimit):"1")}catch(e){console.log("ConnectionsCard fetch error:",e)}finally{c(!1)}},[e]);(0,n.useEffect)(()=>{S()},[S]);let $=async(t,a)=>{try{let s=await fetch("/api/settings",{cache:"no-store"}),r=(s.ok?await s.json():{}).providerStrategies||{},l={};t&&(l.fallbackStrategy=t),"round-robin"===t&&""!==a&&(l.stickyRoundRobinLimit=Number(a)||3);let o={...r};0===Object.keys(l).length?delete o[e]:o[e]=l,await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({providerStrategies:o})})}catch(e){console.log("saveStrategy error:",e)}},P=async(e,t)=>{let s=[...a];[s[e],s[t]]=[s[t],s[e]],r(s);try{await Promise.all([fetch(`/api/providers/${s[e].id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({priority:e})}),fetch(`/api/providers/${s[t].id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({priority:t})})])}catch{await S()}},_=async e=>{C({title:"Delete Connection",message:"Delete this connection?",onConfirm:async()=>{C(null);try{(await fetch(`/api/providers/${e}`,{method:"DELETE"})).ok&&r(t=>t.filter(t=>t.id!==e))}catch(e){console.log("delete error:",e)}}})},I=async(e,t)=>{try{(await fetch(`/api/providers/${e}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({isActive:t})})).ok&&r(a=>a.map(a=>a.id===e?{...a,isActive:t}:a))}catch(e){console.log("toggle error:",e)}},A=async(e,t)=>{try{(await fetch(`/api/providers/${e}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({proxyPoolId:t||null})})).ok&&r(a=>a.map(a=>a.id===e?{...a,providerSpecificData:{...a.providerSpecificData,proxyPoolId:t||null}}:a))}catch(e){console.log("proxy error:",e)}},E=async t=>{try{(await fetch("/api/providers",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:e,...t})})).ok&&(await S(),u(!1))}catch(e){console.log("save apikey error:",e)}},T=async e=>{try{(await fetch(`/api/providers/${f.id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})).ok&&(await S(),g(!1))}catch(e){console.log("update connection error:",e)}};return d?(0,s.jsx)(i.Card,{children:(0,s.jsx)("div",{className:"h-20 animate-pulse bg-black/5 rounded-lg"})}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)(i.Card,{children:[(0,s.jsxs)("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between mb-4",children:[(0,s.jsx)("h2",{className:"text-lg font-semibold",children:"Connections"}),(0,s.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,s.jsx)("span",{className:"text-xs text-text-muted font-medium",children:"Round Robin"}),(0,s.jsx)(i.Toggle,{checked:"round-robin"===j,onChange:e=>{let t=e?"round-robin":null;v(t),e&&!w&&N("1"),$(t,e?w||"1":w)}}),"round-robin"===j&&(0,s.jsxs)("div",{className:"flex flex-wrap items-center gap-1.5",children:[(0,s.jsx)("span",{className:"text-xs text-text-muted",children:"Sticky:"}),(0,s.jsx)("input",{type:"number",min:1,value:w,onChange:e=>{N(e.target.value),$("round-robin",e.target.value)},className:"w-16 px-2 py-1 text-xs border border-border rounded-md bg-background focus:outline-none focus:border-primary"})]})]})]}),0===a.length?(0,s.jsxs)("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[(0,s.jsx)("p",{className:"text-sm text-text-muted",children:"No connections yet"}),(0,s.jsx)(i.Button,{size:"sm",icon:"add",onClick:()=>u(!0),children:"Add Connection"})]}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("div",{className:"flex flex-col divide-y divide-black/[0.03] dark:divide-white/[0.03]",children:a.map((e,r)=>(0,s.jsx)(x,{connection:e,proxyPools:l,isOAuth:t,isFirst:0===r,isLast:r===a.length-1,onMoveUp:()=>P(r,r-1),onMoveDown:()=>P(r,r+1),onToggleActive:t=>I(e.id,t),onUpdateProxy:t=>A(e.id,t),onEdit:()=>{y(e),g(!0)},onDelete:()=>_(e.id)},e.id))}),(0,s.jsx)("div",{className:"mt-4 flex justify-stretch sm:justify-start",children:(0,s.jsx)(i.Button,{size:"sm",icon:"add",onClick:()=>u(!0),children:"Add"})})]})]}),(0,s.jsx)(p,{isOpen:m,provider:e,proxyPools:l,onSave:E,onClose:()=>u(!1)}),(0,s.jsx)(i.EditConnectionModal,{isOpen:b,connection:f,proxyPools:l,onSave:T,onClose:()=>g(!1)}),(0,s.jsx)(i.ConfirmModal,{isOpen:!!k,onClose:()=>C(null),onConfirm:k?.onConfirm,title:k?.title||"Confirm",message:k?.message,variant:"danger"})]})}var b=a(55223),g=a(21577);function f({model:e,fullModel:t,copied:a,onCopy:r,testStatus:l,isCustom:o,isFree:n,onDeleteAlias:i,onTest:d,isTesting:c}){let m="ok"===l?"#22c55e":"error"===l?"#ef4444":void 0;return(0,s.jsx)("div",{className:`group px-3 py-2 rounded-lg border ${"ok"===l?"border-green-500/40":"error"===l?"border-red-500/40":"border-border"} hover:bg-sidebar/50`,children:(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)("span",{className:"material-symbols-outlined text-base",style:m?{color:m}:void 0,children:"ok"===l?"check_circle":"error"===l?"cancel":"smart_toy"}),(0,s.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,s.jsx)("code",{className:"text-xs text-text-muted font-mono bg-sidebar px-1.5 py-0.5 rounded",children:t}),e.name&&(0,s.jsx)("span",{className:"text-[9px] text-text-muted/70 italic pl-1",children:e.name})]}),d&&(0,s.jsxs)("div",{className:"relative group/btn",children:[(0,s.jsx)("button",{onClick:d,disabled:c,className:`p-0.5 hover:bg-sidebar rounded text-text-muted hover:text-primary transition-opacity ${c?"opacity-100":"opacity-0 group-hover:opacity-100"}`,children:(0,s.jsx)("span",{className:"material-symbols-outlined text-sm",style:c?{animation:"spin 1s linear infinite"}:void 0,children:c?"progress_activity":"science"})}),(0,s.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:c?"Testing...":"Test"})]}),(0,s.jsxs)("div",{className:"relative group/btn",children:[(0,s.jsx)("button",{onClick:()=>r(t,`model-${e.id}`),className:"p-0.5 hover:bg-sidebar rounded text-text-muted hover:text-primary",children:(0,s.jsx)("span",{className:"material-symbols-outlined text-sm",children:a===`model-${e.id}`?"check":"content_copy"})}),(0,s.jsx)("span",{className:"pointer-events-none absolute mt-1 top-5 left-1/2 -translate-x-1/2 text-[10px] text-text-muted whitespace-nowrap opacity-0 group-hover/btn:opacity-100 transition-opacity",children:a===`model-${e.id}`?"Copied!":"Copy"})]}),n&&(0,s.jsx)("span",{className:"text-[10px] font-bold text-green-500 bg-green-500/10 px-1.5 py-0.5 rounded",children:"FREE"}),o&&(0,s.jsx)("button",{onClick:i,className:"p-0.5 hover:bg-red-500/10 rounded text-text-muted hover:text-red-500 opacity-0 group-hover:opacity-100 transition-opacity ml-auto",title:"Remove custom model",children:(0,s.jsx)("span",{className:"material-symbols-outlined text-sm",children:"close"})})]})})}function y({isOpen:e,onSave:t,onClose:a}){let[r,l]=(0,n.useState)(""),o=()=>{r.trim()&&(t(r.trim()),l(""))};return(0,s.jsx)(i.Modal,{isOpen:e,title:"Add Custom Model",onClose:a,children:(0,s.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"text-xs text-text-muted mb-1 block",children:"Model ID"}),(0,s.jsx)("input",{className:"w-full px-3 py-2 text-sm border border-border rounded-lg bg-background focus:outline-none focus:border-primary",value:r,onChange:e=>l(e.target.value),onKeyDown:e=>"Enter"===e.key&&o(),placeholder:"e.g. tts-1-hd",autoFocus:!0})]}),(0,s.jsxs)("div",{className:"flex gap-2",children:[(0,s.jsx)(i.Button,{onClick:o,fullWidth:!0,disabled:!r.trim(),children:"Add"}),(0,s.jsx)(i.Button,{onClick:a,variant:"ghost",fullWidth:!0,children:"Cancel"})]})]})})}function j({providerId:e,kindFilter:t,providerAliasOverride:a}){let{copied:r,copy:l}=(0,g.C)(),[o,d]=(0,n.useState)({}),[m,u]=(0,n.useState)([]),[x,p]=(0,n.useState)({}),[h,v]=(0,n.useState)(null),[w,N]=(0,n.useState)(""),[k,C]=(0,n.useState)(!1),S=a||(0,c.wG)(e),$=t||"llm",P=(0,n.useCallback)(async()=>{try{let[e,t]=await Promise.all([fetch("/api/models/alias"),fetch("/api/models/custom",{cache:"no-store"})]),a=await e.json(),s=await t.json();e.ok&&d(a.aliases||{}),t.ok&&u(s.models||[])}catch(e){console.log("ModelsCard fetch error:",e)}},[]);(0,n.useEffect)(()=>{P()},[P]);let _=async(e,t)=>{let a=`${S}/${e}`;try{(await fetch("/api/models/alias",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({model:a,alias:t})})).ok&&await P()}catch(e){console.log("set alias error:",e)}},I=async e=>{try{(await fetch(`/api/models/alias?alias=${encodeURIComponent(e)}`,{method:"DELETE"})).ok&&await P()}catch(e){console.log("delete alias error:",e)}},A=async e=>{try{(await fetch("/api/models/custom",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({providerAlias:S,id:e,type:$})})).ok&&(await P(),window.dispatchEvent(new CustomEvent("customModelChanged")))}catch(e){console.log("add custom model error:",e)}},E=async e=>{try{let t=new URLSearchParams({providerAlias:S,id:e,type:$});(await fetch(`/api/models/custom?${t}`,{method:"DELETE"})).ok&&(await P(),window.dispatchEvent(new CustomEvent("customModelChanged")))}catch(e){console.log("delete custom model error:",e)}},T=async e=>{if(!h){v(e);try{let a=await fetch("/api/models/test",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({model:`${S}/${e}`,kind:t})}),s=await a.json();p(t=>({...t,[e]:s.ok?"ok":"error"})),N(s.ok?"":s.error||"Model not reachable")}catch{p(t=>({...t,[e]:"error"})),N("Network error")}finally{v(null)}}},B=(0,b.KC)(e),M=t?B.filter(e=>e.kinds?e.kinds.includes(t):(0,b.CP)(e,"llm")===t):B,O=m.filter(e=>e.providerAlias===S&&(0,b.CP)(e,"llm")===$&&!M.some(t=>t.id===e.id));return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)(i.Card,{children:[(0,s.jsx)("div",{className:"flex items-center justify-between mb-4",children:(0,s.jsxs)("h2",{className:"text-lg font-semibold",children:["Models",t?` — ${t.toUpperCase()}`:""]})}),w&&(0,s.jsx)("p",{className:"text-xs text-red-500 mb-3 break-words",children:w}),(0,s.jsxs)("div",{className:"flex flex-wrap gap-3",children:[M.map(e=>{let t=`${S}/${e.id}`,a=Object.entries(o).find(([,e])=>e===t)?.[0];return(0,s.jsx)(f,{model:e,fullModel:`${S}/${e.id}`,alias:a,copied:r,onCopy:l,onSetAlias:t=>_(e.id,t),onDeleteAlias:()=>I(a),testStatus:x[e.id],onTest:()=>T(e.id),isTesting:h===e.id,isFree:e.isFree},e.id)}),O.map(e=>(0,s.jsx)(f,{model:{id:e.id,name:e.name},fullModel:`${S}/${e.id}`,copied:r,onCopy:l,onSetAlias:()=>{},onDeleteAlias:()=>E(e.id),testStatus:x[e.id],onTest:()=>T(e.id),isTesting:h===e.id,isCustom:!0},`${e.id}-${e.type}`)),(0,s.jsxs)("button",{onClick:()=>C(!0),className:"flex items-center gap-1.5 px-3 py-2 rounded-lg border border-dashed border-black/15 dark:border-white/15 text-xs text-text-muted hover:text-primary hover:border-primary/40 transition-colors",children:[(0,s.jsx)("span",{className:"material-symbols-outlined text-sm",children:"add"}),"Add Model"]})]})]}),(0,s.jsx)(y,{isOpen:k,onSave:async e=>{await A(e),C(!1)},onClose:()=>C(!1)})]})}function v({label:e,children:t}){return(0,s.jsxs)("div",{className:"flex min-w-0 flex-col gap-1.5 sm:flex-row sm:items-center sm:gap-3",children:[(0,s.jsx)("span",{className:"w-full text-xs font-medium text-text-muted sm:w-20 sm:shrink-0",children:e}),(0,s.jsx)("div",{className:"w-full min-w-0 flex-1",children:t})]})}let w={webSearch:{inputLabel:"Query",inputPlaceholder:"What is the latest news about AI?",defaultInput:"What is the latest news about AI?",bodyKey:"query",defaultResponse:`{
|
|
2
2
|
"results": [
|
|
3
3
|
{ "title": "...", "url": "...", "snippet": "..." }
|
|
4
4
|
]
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2134],{6:(e,t,a)=>{"use strict";a.r(t),a.d(t,{default:()=>L});var s=a(15102),i=a(82030),l=a(93278),r=a(93885),o=a.n(r);a(37837),a(19965);var n=a(31704),d=a(92940),c=a(31038),m=a(55223),p=a(58788),x=a(47236);a(5477);let u={base:["none","low","medium","high"],onOff:["none","thinking"],openai:["none","minimal","low","medium","high","xhigh"],levelMax:["none","low","medium","high","max"],budgetX:["none","low","medium","high","xhigh","max"],gemini:["minimal","low","medium","high"],hiMax:["none","high","max"]},h={openai:u.openai,"claude-adaptive":u.levelMax,"claude-budget":u.budgetX,"gemini-level":u.gemini,"gemini-budget":u.base,zai:u.onOff,qwen:u.base,kimi:u.levelMax,deepseek:u.hiMax,minimax:u.onOff,hunyuan:u.base,step:u.base},f=["none","minimal","low","medium","high","xhigh","max"],g=[{provider:"codex",pattern:"*gpt-5.6-sol*",levels:f},{provider:"codex",pattern:"*gpt-5.6-terra*",levels:f},{provider:"codex",pattern:"*gpt-5.6-luna*",levels:f},{pattern:"*gpt-5.6-sol*",levels:["none","minimal","low","medium","high","xhigh","max"]},{pattern:"*claude*opus-5*",levels:u.CLAUDE_EFFORT},{pattern:"*codex*",levels:["low","medium","high","xhigh"]}];function y(e,t){if("kiro"===e&&null===function(e){if("string"!=typeof e)return null;let t=e.toLowerCase().replace(/-/g,".");if(/(?:^|[/.])gpt[/.]5[/.]6(?:[/.]|$)/.test(t))return"reasoning";if(!t.includes("claude"))return null;let a=t.match(/(?:^|[/.])claude(?:[/.][a-z]+)*[/.](\d+)(?:[/.](\d+))?(?:[/.]|$)/);if(!a)return null;let[,s,i]=a,l=Number(s),r=void 0===i?null:Number(i);return l<4||4===l&&(null===r||r<=5||null!==r&&r>=1e3)?null:"output_config"}(t))return null;let a=(0,p.nl)(e,t);if(!a.reasoning)return null;let s=g.find(a=>(!a.provider||a.provider===e)&&(0,x.gH)(a.pattern,t)),i=s?.levels||h[a.thinkingFormat]||u.base;return!1===a.thinkingCanDisable&&(i=i.filter(e=>"none"!==e)),i}var b=a(21577),v=a(85479),j=a(20264);let w=new Map;async function N(e){if(!e?.url||!e?.type)return[];let t=w.get(e.url);if(t&&Date.now()<t.expiresAt)return t.data;try{let t=new URLSearchParams({url:e.url,type:e.type}),a=await fetch(`/api/providers/suggested-models?${t}`);if(!a.ok)return[];let s=(await a.json()).data??[];return w.set(e.url,{data:s,expiresAt:Date.now()+6e5}),s}catch{return[]}}function k({customModels:e=[],modelAliases:t={},providerAlias:a,builtInModels:s=[],type:i="llm",includeLegacyAliases:l=!0}){let r=new Set(s.map(e=>e.id)),o=new Set,n=[];for(let t of e){if(!t?.id||t.providerAlias!==a)continue;let e=t?.kind||t?.type||"llm";if(i&&e!==i||r.has(t.id))continue;let s=`${a}/${t.id}`;o.has(s)||(o.add(s),n.push({id:t.id,name:t.name||t.id,fullModel:s,source:"custom",type:e}))}if(!l)return n;let d=`${a}/`;for(let[e,a]of Object.entries(t||{})){if("string"!=typeof a||!a.startsWith(d))continue;let t=a.slice(d.length);!t||r.has(t)||o.has(a)||(o.add(a),n.push({id:t,alias:e,fullModel:a,source:"legacyAlias",type:i||"llm"}))}return n}function S({model:e,fullModel:t,alias:a,copied:i,onCopy:l,testStatus:r,isCustom:o,isFree:n,onDeleteAlias:c,onTest:m,isTesting:p,onDisable:x,caps:u}){let h="ok"===r?"#22c55e":"error"===r?"#ef4444":void 0;return(0,s.jsx)("div",{className:`group min-w-0 max-w-full rounded-lg border px-3 py-2 ${"ok"===r?"border-green-500/40":"error"===r?"border-red-500/40":"border-border"} hover:bg-sidebar/50`,children:(0,s.jsxs)("div",{className:"flex min-w-0 items-start gap-2 sm:items-center",children:[(0,s.jsx)("span",{className:"material-symbols-outlined shrink-0 text-base",style:h?{color:h}:void 0,children:"ok"===r?"check_circle":"error"===r?"cancel":"smart_toy"}),(0,s.jsxs)("div",{className:"flex min-w-0 flex-1 flex-col gap-1",children:[(0,s.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:t}),(0,s.jsxs)("span",{className:"flex min-w-0 items-center text-[9px] gap-1 pl-1",children:[e.name&&(0,s.jsx)("span",{className:"truncate text-[9px] italic text-text-muted/70",children:e.name}),(0,s.jsx)(d.CapacityBadges,{caps:u,colorOverride:"text-text-muted/70",size:12})]})]}),m&&(0,s.jsxs)("div",{className:"relative shrink-0 group/btn",children:[(0,s.jsx)("button",{onClick:m,disabled:p,className:`rounded p-0.5 text-text-muted transition-opacity hover:bg-sidebar hover:text-primary ${p?"opacity-100":"opacity-100 sm:opacity-0 sm:group-hover:opacity-100"}`,children:(0,s.jsx)("span",{className:"material-symbols-outlined text-sm",style:p?{animation:"spin 1s linear infinite"}:void 0,children:p?"progress_activity":"science"})}),(0,s.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:p?"Testing...":"Test"})]}),(0,s.jsxs)("div",{className:"relative shrink-0 group/btn",children:[(0,s.jsx)("button",{onClick:()=>l(t,`model-${e.id}`),className:"rounded p-0.5 text-text-muted hover:bg-sidebar hover:text-primary",children:(0,s.jsx)("span",{className:"material-symbols-outlined text-sm",children:i===`model-${e.id}`?"check":"content_copy"})}),(0,s.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:i===`model-${e.id}`?"Copied!":"Copy"})]}),o?(0,s.jsx)("button",{onClick:c,className:"ml-auto rounded p-0.5 text-text-muted opacity-100 transition-opacity hover:bg-red-500/10 hover:text-red-500 sm:opacity-0 sm:group-hover:opacity-100",title:"Remove custom model",children:(0,s.jsx)("span",{className:"material-symbols-outlined text-sm",children:"close"})}):x?(0,s.jsx)("button",{onClick:x,className:"ml-auto rounded p-0.5 text-text-muted opacity-100 transition-opacity hover:bg-red-500/10 hover:text-red-500 sm:opacity-0 sm:group-hover:opacity-100",title:"Disable this model",children:(0,s.jsx)("span",{className:"material-symbols-outlined text-sm",children:"close"})}):null]})})}function C({modelId:e,fullModel:t,copied:a,onCopy:i,onDeleteAlias:l,onTest:r,testStatus:o,isTesting:n}){let d="ok"===o?"#22c55e":"error"===o?"#ef4444":void 0;return(0,s.jsxs)("div",{className:`flex items-center gap-3 p-3 rounded-lg border ${"ok"===o?"border-green-500/40":"error"===o?"border-red-500/40":"border-border"} hover:bg-sidebar/50`,children:[(0,s.jsx)("span",{className:"material-symbols-outlined text-base text-text-muted",style:d?{color:d}:void 0,children:"ok"===o?"check_circle":"error"===o?"cancel":"smart_toy"}),(0,s.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,s.jsx)("p",{className:"text-sm font-medium truncate",children:e}),(0,s.jsxs)("div",{className:"flex items-center gap-1 mt-1",children:[(0,s.jsx)("code",{className:"text-xs text-text-muted font-mono bg-sidebar px-1.5 py-0.5 rounded",children:t}),(0,s.jsxs)("div",{className:"relative group/btn",children:[(0,s.jsx)("button",{onClick:()=>i(t,`model-${e}`),className:"p-0.5 hover:bg-sidebar rounded text-text-muted hover:text-primary",children:(0,s.jsx)("span",{className:"material-symbols-outlined text-sm",children:a===`model-${e}`?"check":"content_copy"})}),(0,s.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:a===`model-${e}`?"Copied!":"Copy"})]}),r&&(0,s.jsxs)("div",{className:"relative group/btn",children:[(0,s.jsx)("button",{onClick:r,disabled:n,className:"p-0.5 hover:bg-sidebar rounded text-text-muted hover:text-primary transition-colors",children:(0,s.jsx)("span",{className:"material-symbols-outlined text-sm",style:n?{animation:"spin 1s linear infinite"}:void 0,children:n?"progress_activity":"science"})}),(0,s.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:n?"Testing...":"Test"})]})]})]}),(0,s.jsx)("button",{onClick:l,className:"p-1 hover:bg-red-50 rounded text-red-500",title:"Remove model",children:(0,s.jsx)("span",{className:"material-symbols-outlined text-sm",children:"delete"})})]})}function A({providerStorageAlias:e,providerDisplayAlias:t,modelAliases:a,customModels:l,copied:r,onCopy:o,onDeleteAlias:n,onAddCustomModel:c,onDeleteCustomModel:m,connections:p,isAnthropic:x}){let[u,h]=(0,i.useState)(""),[f,g]=(0,i.useState)(!1),[y,b]=(0,i.useState)(!1),[v,j]=(0,i.useState)(null),[w,N]=(0,i.useState)({}),S=async t=>{if(!v){j(t);try{let a=await fetch("/api/models/test",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({model:`${e}/${t}`})}),s=await a.json();N(e=>({...e,[t]:s.ok?"ok":"error"}))}catch{N(e=>({...e,[t]:"error"}))}finally{j(null)}}},T=k({customModels:l,modelAliases:a,providerAlias:e,type:"llm"}),I=async()=>{if(!u.trim()||f)return;let e=u.trim();if(T.some(t=>t.id===e))return void alert("Model already exists for this provider.");g(!0);try{await c(e),h("")}catch(e){console.log("Error adding model:",e)}finally{g(!1)}},P=async()=>{if(y)return;let e=p.find(e=>!1!==e.isActive);if(e){b(!0);try{let t=await fetch(`/api/providers/${e.id}/models`),a=await t.json();if(!t.ok)return void alert(a.error||"Failed to import models");let s=a.models||[];if(0===s.length)return void alert("No models returned from /models.");let i=0;for(let e of s){let t=e.id||e.name||e.model;t&&(T.some(e=>e.id===t)||(await c(t),i+=1))}0===i&&alert("No new models were added.")}catch(e){console.log("Error importing models:",e)}finally{b(!1)}}},$=p.some(e=>!1!==e.isActive);return(0,s.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,s.jsxs)("p",{className:"text-sm text-text-muted",children:["Add ",x?"Anthropic":"OpenAI","-compatible models manually or import them from the /models endpoint."]}),(0,s.jsxs)("div",{className:"flex items-end gap-2 flex-wrap",children:[(0,s.jsxs)("div",{className:"flex-1 min-w-[240px]",children:[(0,s.jsx)("label",{htmlFor:"new-compatible-model-input",className:"text-xs text-text-muted mb-1 block",children:"Model ID"}),(0,s.jsx)("input",{id:"new-compatible-model-input",type:"text",value:u,onChange:e=>h(e.target.value),onKeyDown:e=>"Enter"===e.key&&I(),placeholder:x?"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,s.jsx)(d.Button,{size:"sm",icon:"add",onClick:I,disabled:!u.trim()||f,children:f?"Adding...":"Add"}),(0,s.jsx)(d.Button,{size:"sm",variant:"secondary",icon:"download",onClick:P,disabled:!$||y,children:y?"Importing...":"Import from /models"})]}),!$&&(0,s.jsx)("p",{className:"text-xs text-text-muted",children:"Add a connection to enable importing models."}),T.length>0&&(0,s.jsx)("div",{className:"flex flex-col gap-3",children:T.map(({id:a,alias:i,source:l})=>(0,s.jsx)(C,{modelId:a,fullModel:`${t}/${a}`,copied:r,onCopy:o,onDeleteAlias:()=>"custom"===l?m(a):n(i),onTest:p.length>0?()=>S(a):void 0,testStatus:w[a],isTesting:v===a},`${l}-${e}/${a}`))})]})}var T=a(21863);function I({until:e}){let[t,a]=(0,i.useState)("");return((0,i.useEffect)(()=>{let t=()=>{let t=new Date(e).getTime()-Date.now();if(t<=0)return void a("");let s=Math.floor(t/1e3);if(s<60)a(`${s}s`);else if(s<3600)a(`${Math.floor(s/60)}m ${s%60}s`);else{let e=Math.floor(s/3600),t=Math.floor(s%3600/60);a(`${e}h ${t}m`)}};t();let s=setInterval(t,1e3);return()=>clearInterval(s)},[e]),t)?(0,s.jsxs)("span",{className:"text-xs text-orange-500 font-mono",children:["⏱ ",t]}):null}function P({connection:e,proxyPools:t,isOAuth:a,isFirst:l,isLast:r,onMoveUp:o,onMoveDown:n,onToggleActive:c,onUpdateProxy:m,onEdit:p,onDelete:x,oneByOneStatus:u=null,autoPing:h=null,modelAssignmentOptions:f=null,onModelAssignmentChange:g=null,strictModelAssignment:y=!1}){let[b,v]=(0,i.useState)(!1),[j,w]=(0,i.useState)(!1),N=(0,i.useRef)(null),k=new Map((t||[]).map(e=>[e.id,e])),S=e.providerSpecificData?.proxyPoolIds||(e.providerSpecificData?.proxyPoolId?[e.providerSpecificData.proxyPoolId]:[]),C=e.providerSpecificData?.proxyRotationStrategy||"none",A=S[0]||e.providerSpecificData?.proxyPoolId||null,$=A?k.get(A):null,E=e.providerSpecificData?.connectionProxyEnabled===!0&&!!e.providerSpecificData?.connectionProxyUrl,O=!!A||E,D=S.length>1?`${S.length} pools (${C})`:$?`Pool: ${$.name}`:A?`Pool: ${A} (inactive/missing)`:E?`Legacy: ${e.providerSpecificData?.connectionProxyUrl}`:"",_=h?.provider==="codex"?"Auto-starts the next 5h Codex window after reset by sending a tiny gpt-5.5 request. Consumes a small amount of quota.":"When your 5h quota runs out, auto-sends a request the moment it resets so a new window starts right away.",U="";if($?.proxyUrl||e.providerSpecificData?.connectionProxyUrl){let t=$?.proxyUrl||e.providerSpecificData?.connectionProxyUrl;try{let e=new URL(t);U=`${e.protocol}//${e.hostname}${e.port?`:${e.port}`:""}`}catch{U=t}}let M=$?.noProxy||e.providerSpecificData?.connectionNoProxy||"",z="default";$?.isActive===!0?z="success":(A||E)&&(z="error"),(0,i.useEffect)(()=>{if(!b)return;let e=e=>{N.current&&!N.current.contains(e.target)&&v(!1)};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[b]);let B=async e=>{w(!0);try{"__none__"===e?await m(null):await m(e),v(!1)}finally{w(!1)}},R=async(e,t)=>{let a=t.filter(e=>k.get(e)?.isActive===!0);if(a.length){w(!0);try{await m({proxyPoolIds:a,proxyRotationStrategy:e}),v(!1)}finally{w(!1)}}},K=e.authType||(a?"oauth":"apikey"),L="oauth"===K,F="cookie"===K,J=e.name?.trim()||e.email?.trim()||e.displayName?.trim()||(L?"OAuth Account":F?"Cookie Account":"API Key"),q=e.name?.trim()&&e.email?.trim()&&e.name.trim()!==e.email.trim()?e.email.trim():e.name?.trim()&&e.displayName?.trim()&&e.name.trim()!==e.displayName.trim()?e.displayName.trim():null,[W,H]=(0,i.useState)(!1),V=Object.entries(e).filter(([e])=>e.startsWith("modelLock_")).map(([,e])=>e).filter(e=>!!e).sort()[0]||null;(0,i.useEffect)(()=>{let t=null,a=()=>{H(!!Object.entries(e).filter(([e])=>e.startsWith("modelLock_")).map(([,e])=>e).filter(e=>e&&new Date(e).getTime()>Date.now()).sort()[0])};return a(),V&&(t=setInterval(a,1e3)),()=>{t&&clearInterval(t)}},[V,e]);let G="unavailable"!==e.testStatus||W?e.testStatus:"active",Q=()=>u?"queued"===u.state?"queued":"testing"===u.state?"testing":"success"===u.state?"success":"failed"===u.state?u.error?`failed: ${u.error}`:"failed":null:null;return(0,s.jsxs)("div",{className:`group flex min-w-0 flex-col gap-3 rounded-lg p-2 transition-colors hover:bg-black/[0.02] dark:hover:bg-white/[0.02] sm:flex-row sm:items-center sm:justify-between ${!1===e.isActive?"opacity-60":""}`,children:[(0,s.jsxs)("div",{className:"flex min-w-0 flex-1 items-start gap-2 sm:items-center sm:gap-3",children:[(0,s.jsxs)("div",{className:"flex shrink-0 flex-col",children:[(0,s.jsx)("button",{onClick:o,disabled:l,className:`p-0.5 rounded ${l?"text-text-muted/30 cursor-not-allowed":"hover:bg-sidebar text-text-muted hover:text-primary"}`,children:(0,s.jsx)("span",{className:"material-symbols-outlined text-sm",children:"keyboard_arrow_up"})}),(0,s.jsx)("button",{onClick:n,disabled:r,className:`p-0.5 rounded ${r?"text-text-muted/30 cursor-not-allowed":"hover:bg-sidebar text-text-muted hover:text-primary"}`,children:(0,s.jsx)("span",{className:"material-symbols-outlined text-sm",children:"keyboard_arrow_down"})})]}),(0,s.jsx)("span",{className:"material-symbols-outlined shrink-0 text-base text-text-muted",children:F?"cookie":L?"lock":"key"}),(0,s.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,s.jsx)("p",{className:"text-sm font-medium truncate",children:J}),q&&(0,s.jsx)("p",{className:"text-xs text-text-muted truncate",children:q}),(0,s.jsxs)("div",{className:"mt-1 flex min-w-0 flex-wrap items-center gap-1.5 sm:gap-2",children:[(0,s.jsx)(d.Badge,{variant:(0,T.g)(e.isActive,G),size:"sm",dot:!0,children:!1===e.isActive?"disabled":G||"Unknown"}),(0,s.jsx)(d.Badge,{variant:"default",size:"sm",children:L?"OAuth":F?"Cookie":"API Key"}),O&&(0,s.jsx)(d.Badge,{variant:z,size:"sm",children:"Proxy"}),W&&!1!==e.isActive&&(0,s.jsx)(I,{until:V}),e.lastError&&!1!==e.isActive&&(0,s.jsx)("span",{className:"max-w-full truncate text-xs text-red-500 sm:max-w-[300px]",title:e.lastError,children:e.lastError}),(0,s.jsxs)("span",{className:"text-xs text-text-muted",children:["#",e.priority]}),e.globalPriority&&(0,s.jsxs)("span",{className:"text-xs text-text-muted",children:["Auto: ",e.globalPriority]}),Q()&&(0,s.jsx)(d.Badge,{variant:u?"success"===u.state?"success":"failed"===u.state?"error":"testing"===u.state?"primary":"default":"default",size:"sm",children:Q()})]}),O&&(0,s.jsxs)("div",{className:"mt-1 flex items-center gap-2 flex-wrap",children:[(0,s.jsx)("span",{className:"max-w-full truncate text-[11px] text-text-muted sm:max-w-[420px]",title:D,children:D}),U&&(0,s.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:U}),M&&(0,s.jsxs)("span",{className:"max-w-full truncate text-[11px] text-text-muted sm:max-w-[320px]",title:M,children:["no_proxy: ",M]})]}),f&&g&&(0,s.jsxs)("select",{value:Object.prototype.hasOwnProperty.call(e.providerSpecificData||{},"assignedModel")?e.providerSpecificData.assignedModel||"":e.providerSpecificData?.freebuffModel||"",onChange:e=>g(e.target.value),disabled:!y,className:"mt-2 max-w-full rounded-md border border-border bg-background px-2 py-1 text-[11px] text-text-main",title:"Model assignment",children:[(0,s.jsx)("option",{value:"",children:"Unassigned"}),f.map(e=>(0,s.jsx)("option",{value:e.id,children:e.name||e.id},e.id))]})]})]}),(0,s.jsxs)("div",{className:"flex w-full items-center justify-between gap-2 sm:w-auto sm:justify-end",children:[(0,s.jsxs)("div",{className:"grid flex-1 grid-cols-3 gap-1 sm:flex sm:flex-none",children:[(t||[]).length>0&&(0,s.jsxs)("div",{className:"relative",ref:N,children:[(0,s.jsxs)("button",{type:"button",onClick:()=>v(e=>!e),className:`flex w-full flex-col items-center rounded px-2 py-1 transition-colors hover:bg-black/5 dark:hover:bg-white/5 ${O?"text-primary":"text-text-muted hover:text-primary"}`,disabled:j,children:[(0,s.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:j?"progress_activity":"lan"}),(0,s.jsx)("span",{className:"text-[10px] leading-tight",children:"Proxy"})]}),b&&(0,s.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:["smart"===C&&(0,s.jsx)("p",{className:"px-3 py-1 text-[10px] text-text-muted",children:"Smart skips unfit pools for this provider/model."}),(0,s.jsx)("button",{type:"button",onClick:()=>B("__none__"),className:`w-full text-left px-3 py-1.5 text-sm hover:bg-black/5 dark:hover:bg-white/5 ${!A?"text-primary font-medium":"text-text-main"}`,children:"None"}),(0,s.jsx)("p",{className:"px-3 pt-2 text-[10px] font-medium uppercase text-text-muted",children:"Rotation"}),["fill-first","round-robin","random","smart"].map(e=>(0,s.jsx)("button",{type:"button",onClick:()=>R(e,S.length>1?S:(t||[]).filter(e=>e.isActive).map(e=>e.id)),disabled:j,className:`w-full px-3 py-1.5 text-left text-sm hover:bg-black/5 dark:hover:bg-white/5 ${C===e?"font-medium text-primary":"text-text-main"}`,children:"smart"===e?"Smart (provider/model aware)":e},e)),(0,s.jsx)("p",{className:"px-3 pt-2 text-[10px] font-medium uppercase text-text-muted",children:"Single pool"}),(t||[]).map(e=>(0,s.jsx)("button",{type:"button",onClick:()=>B(e.id),disabled:j||!0!==e.isActive,className:`w-full text-left px-3 py-1.5 text-sm hover:bg-black/5 dark:hover:bg-white/5 ${A===e.id?"text-primary font-medium":"text-text-main"}`,children:e.name},e.id))]})]}),h&&(0,s.jsx)(d.Tooltip,{text:_,children:(0,s.jsxs)("button",{onClick:()=>h.onToggle(!h.on),className:`flex w-full flex-col items-center rounded px-2 py-1 transition-colors hover:bg-black/5 dark:hover:bg-white/5 ${h.on?"text-primary":"text-text-muted hover:text-primary"}`,children:[(0,s.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"bolt"}),(0,s.jsx)("span",{className:"text-[10px] leading-tight",children:"Auto-ping"})]})}),(0,s.jsxs)("button",{onClick:p,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,s.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"edit"}),(0,s.jsx)("span",{className:"text-[10px] leading-tight",children:"Edit"})]}),(0,s.jsxs)("button",{onClick:x,className:"flex flex-col items-center rounded px-2 py-1 text-red-500 hover:bg-red-500/10",children:[(0,s.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"delete"}),(0,s.jsx)("span",{className:"text-[10px] leading-tight",children:"Delete"})]})]}),(0,s.jsx)(d.Toggle,{size:"sm",checked:e.isActive??!0,onChange:c,title:e.isActive??!0?"Disable connection":"Enable connection"})]})]})}var $=a(28937),E=a.n($);let O=`name1|sk-key1
|
|
2
|
+
name2|sk-key2
|
|
3
|
+
sk-key-only-auto-named`;function D({isOpen:e,provider:t,providerName:a,isCompatible:l,isAnthropic:r,authType:o,authHint:n,website:m,proxyPools:p,error:x,existingNames:u,onSave:h,onBulkDone:f,onClose:g}){let y="__none__",b="ollama-local"===t,v="cookie"===o,j="xai"===t&&!v,w=v?"Cookie Value":"API Key",N="azure"===t,k="cloudflare-ai"===t,S=c.Q2?.[t]?.regions||null,C=c.Q2?.[t]?.defaultRegion||S?.[0]?.id||"",[A,T]=(0,i.useState)({name:"",apiKey:"",priority:1,proxyPoolId:y,ollamaHostUrl:""}),[I,P]=(0,i.useState)({azureEndpoint:"",apiVersion:"2024-10-01-preview",deployment:"",organization:""}),[$,E]=(0,i.useState)({accountId:""}),[_,U]=(0,i.useState)(C),[M,z]=(0,i.useState)(!1),[B,R]=(0,i.useState)(null),[K,L]=(0,i.useState)(!1),F=k?`name1|sk-key1|acc123456
|
|
4
|
+
name2|sk-key2|def789012
|
|
5
|
+
sk-key-only-auto-named`:O,[J,q]=(0,i.useState)("single"),[W,H]=(0,i.useState)(""),[V,G]=(0,i.useState)(null),Q=()=>b&&A.ollamaHostUrl.trim()?{baseUrl:A.ollamaHostUrl.trim()}:N?{azureEndpoint:I.azureEndpoint,apiVersion:I.apiVersion,deployment:I.deployment,organization:I.organization}:k?{accountId:$.accountId}:S&&_?{region:_}:void 0,X=async()=>{z(!0);try{let e=await fetch("/api/providers/validate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:t,apiKey:A.apiKey,providerSpecificData:Q()})}),a=await e.json();R(a.valid?"success":"failed")}catch{R("failed")}finally{z(!1)}},Y=async()=>{if(t&&(b||A.apiKey)&&(b||A.name)){L(!0);try{let e=!1;try{z(!0),R(null);let a=await fetch("/api/providers/validate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:t,apiKey:A.apiKey,providerSpecificData:Q()})});e=!!(await a.json()).valid,R(e?"success":"failed")}catch{R("failed")}finally{z(!1)}await h({name:A.name||(b?"Ollama Local":""),apiKey:A.apiKey,priority:A.priority,proxyPoolId:A.proxyPoolId===y?null:A.proxyPoolId,testStatus:e?"active":"unknown",providerSpecificData:Q()})}finally{L(!1)}}},Z=async()=>{let e=W.split("\n");if(!e.length)return;let a=function(e,t,a={}){let{isCloudflareAi:s=!1}=a,i=new Set((Array.isArray(t)?t:[]).map(e=>"string"==typeof e?e.toLowerCase():"")),l=[];for(let t of e){let e,a="string"==typeof t?t.trim():"";if(!a)continue;let r=function(e,t={}){let{isCloudflareAi:a=!1}=t,s=e.split("|");if(a&&s.length>=3){let e=s[0].trim();return{baseName:e||"Key",apiKey:s.slice(1,-1).join("|").trim(),providerSpecificData:{accountId:s[s.length-1].trim()}}}return s.length>=2?{baseName:s[0].trim()||"Key",apiKey:s.slice(1).join("|").trim()}:{baseName:"Key",apiKey:s[0].trim()}}(a,{isCloudflareAi:s});if(!r||!r.apiKey)continue;let o=r.baseName,n=1;for(;e=`${o} ${n}`,i.has(e.toLowerCase());)n+=1;i.add(e.toLowerCase());let d={name:e,apiKey:r.apiKey,skipped:!1};r.providerSpecificData&&(d.providerSpecificData=r.providerSpecificData),l.push(d)}return l}(e,u,{isCloudflareAi:k});if(!a.length)return;L(!0),G(null);let s=0,i=0;for(let e of a)try{(await fetch("/api/providers",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:t,apiKey:e.apiKey,name:e.name,priority:1,testStatus:"unknown",...e.providerSpecificData?{providerSpecificData:e.providerSpecificData}:{}})})).ok?s++:i++}catch{i++}L(!1),G({success:s,failed:i}),s>0&&f&&f()};return t?(0,s.jsx)(d.Modal,{isOpen:e,title:`Add ${a||t} ${w}`,onClose:g,children:(0,s.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,s.jsxs)("div",{className:"flex gap-2",children:[(0,s.jsx)(d.Button,{size:"sm",variant:"single"===J?"primary":"ghost",onClick:()=>{q("single"),G(null)},children:"Single"}),(0,s.jsx)(d.Button,{size:"sm",variant:"bulk"===J?"primary":"ghost",onClick:()=>{q("bulk"),G(null)},children:"Bulk Add"})]}),"bulk"===J&&(0,s.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,s.jsx)("p",{className:"text-xs text-text-muted",children:k?(0,s.jsxs)(s.Fragment,{children:["One key per line. Format: ",(0,s.jsx)("code",{children:"name|apiKey|accountId"})," or just ",(0,s.jsx)("code",{children:"apiKey"})," (auto-named by index)."]}):(0,s.jsxs)(s.Fragment,{children:["One key per line. Format: ",(0,s.jsx)("code",{children:"name|apiKey"})," or just ",(0,s.jsx)("code",{children:"apiKey"})," (auto-named by index)."]})}),(0,s.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:F,value:W,onChange:e=>H(e.target.value)}),V&&(0,s.jsxs)("div",{className:`text-sm font-medium ${V.failed>0?"text-yellow-400":"text-green-400"}`,children:["✓ ",V.success," added",V.failed>0?`, ✗ ${V.failed} failed`:""]}),(0,s.jsxs)("div",{className:"flex gap-2",children:[(0,s.jsx)(d.Button,{onClick:Z,fullWidth:!0,disabled:K||!W.trim(),children:K?"Adding...":"Add All Keys"}),(0,s.jsx)(d.Button,{onClick:g,variant:"ghost",fullWidth:!0,children:"Cancel"})]})]}),"single"===J&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(d.Input,{label:"Name",value:A.name,onChange:e=>T({...A,name:e.target.value}),placeholder:b?"Ollama Local":"Production Key"}),b&&(0,s.jsxs)("div",{className:"flex gap-2",children:[(0,s.jsx)(d.Input,{label:"Ollama Host URL",value:A.ollamaHostUrl,onChange:e=>T({...A,ollamaHostUrl:e.target.value}),placeholder:"http://localhost:11434",className:"flex-1"}),(0,s.jsx)("div",{className:"pt-6",children:(0,s.jsx)(d.Button,{onClick:X,disabled:M||K,variant:"secondary",children:M?"Checking...":"Check"})})]}),!b&&(0,s.jsxs)("div",{className:"flex gap-2",children:[(0,s.jsx)(d.Input,{label:w,type:v?"text":"password",value:A.apiKey,onChange:e=>T({...A,apiKey:e.target.value}),placeholder:v?"grok-web"===t?"sso=xxxxx... or just the raw value":"eyJhbGciOi...":j?"xai-...":"",className:"flex-1"}),(0,s.jsx)("div",{className:"pt-6",children:(0,s.jsx)(d.Button,{onClick:X,disabled:!A.apiKey||M||K,variant:"secondary",children:M?"Checking...":"Check"})})]}),j&&(0,s.jsx)("p",{className:"text-xs text-text-muted",children:"Use a direct xAI API key from console.x.ai. This is separate from Grok Build OAuth."}),v&&n&&(0,s.jsxs)("p",{className:"text-xs text-text-muted",children:[n,m&&(0,s.jsxs)(s.Fragment,{children:[" ",(0,s.jsxs)("a",{href:m,target:"_blank",rel:"noopener noreferrer",className:"text-primary underline",children:["Open ",m.replace(/^https?:\/\//,"")]})]})]}),S&&(0,s.jsx)(d.Select,{label:"Region",value:_,onChange:e=>U(e.target.value),options:S.map(e=>({value:e.id,label:e.label}))}),b&&(0,s.jsxs)("p",{className:"text-xs text-text-muted",children:["Leave blank to use ",(0,s.jsx)("code",{children:"http://localhost:11434"}),". For remote Ollama, enter the full host URL (e.g. ",(0,s.jsx)("code",{children:"http://192.168.1.10:11434"}),")."]}),B&&(0,s.jsx)(d.Badge,{variant:"success"===B?"success":"error",children:"success"===B?"Valid":"Invalid"}),x&&(0,s.jsx)("p",{className:"text-xs text-red-500 break-words",children:x}),k&&(0,s.jsxs)("div",{className:"bg-sidebar/50 p-4 rounded-lg border border-accent/20",children:[(0,s.jsx)("h3",{className:"font-semibold mb-3 text-sm",children:"Cloudflare Workers AI"}),(0,s.jsx)(d.Input,{label:"Account ID",value:$.accountId,onChange:e=>E({...$,accountId:e.target.value}),placeholder:"abc123def456..."}),(0,s.jsxs)("p",{className:"text-xs text-text-muted mt-2",children:["Find your Account ID in the right sidebar of ",(0,s.jsx)("a",{href:"https://dash.cloudflare.com",target:"_blank",rel:"noopener noreferrer",className:"text-primary underline",children:"dash.cloudflare.com"})]})]}),N&&(0,s.jsxs)("div",{className:"bg-sidebar/50 p-4 rounded-lg border border-accent/20",children:[(0,s.jsx)("h3",{className:"font-semibold mb-3 text-sm",children:"Azure OpenAI Configuration"}),(0,s.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,s.jsx)(d.Input,{label:"Azure Endpoint",value:I.azureEndpoint,onChange:e=>P({...I,azureEndpoint:e.target.value}),placeholder:"https://your-resource.openai.azure.com"}),(0,s.jsx)(d.Input,{label:"Deployment Name",value:I.deployment,onChange:e=>P({...I,deployment:e.target.value}),placeholder:"gpt-4"}),(0,s.jsx)(d.Input,{label:"API Version",value:I.apiVersion,onChange:e=>P({...I,apiVersion:e.target.value}),placeholder:"2024-10-01-preview"}),(0,s.jsx)(d.Input,{label:"Organization",value:I.organization,onChange:e=>P({...I,organization:e.target.value}),placeholder:"Organization ID"})]})]}),(0,s.jsx)(d.Input,{label:"Priority",type:"number",value:A.priority,onChange:e=>T({...A,priority:Number.parseInt(e.target.value)||1})}),(0,s.jsx)(d.Select,{label:"Proxy Pool",value:A.proxyPoolId,onChange:e=>T({...A,proxyPoolId:e.target.value}),options:[{value:y,label:"None"},...(p||[]).map(e=>({value:e.id,label:e.name}))],placeholder:"None"}),0===(p||[]).length&&(0,s.jsx)("p",{className:"text-xs text-text-muted",children:"No active proxy pools available. Create one in Proxy Pools page first."}),(0,s.jsx)("p",{className:"text-xs text-text-muted",children:"Legacy manual proxy fields are still accepted by API for backward compatibility."}),(0,s.jsxs)("div",{className:"flex gap-2",children:[(0,s.jsx)(d.Button,{onClick:Y,fullWidth:!0,disabled:K||!b&&(!A.name||!A.apiKey)||N&&(!I.azureEndpoint||!I.deployment||!I.organization)||k&&!$.accountId,children:K?"Saving...":"Save"}),(0,s.jsx)(d.Button,{onClick:g,variant:"ghost",fullWidth:!0,children:"Cancel"})]})]})]})}):null}D.propTypes={isOpen:E().bool.isRequired,provider:E().string,providerName:E().string,isCompatible:E().bool,isAnthropic:E().bool,authType:E().string,authHint:E().string,website:E().string,proxyPools:E().arrayOf(E().shape({id:E().string,name:E().string})),error:E().string,existingNames:E().arrayOf(E().string),onSave:E().func.isRequired,onBulkDone:E().func,onClose:E().func.isRequired};let _=[{value:"chat",label:"Chat Completions"},{value:"responses",label:"Responses API"}];function U({isOpen:e,node:t,onSave:a,onClose:l,isAnthropic:r}){let[o,n]=(0,i.useState)(()=>({name:t?.name||"",prefix:t?.prefix||"",apiType:t?.apiType||"chat",baseUrl:t?.baseUrl||(r?"https://api.anthropic.com/v1":"https://api.openai.com/v1")})),[c,m]=(0,i.useState)(!1),[p,x]=(0,i.useState)(""),[u,h]=(0,i.useState)(""),[f,g]=(0,i.useState)(!1),[y,b]=(0,i.useState)(null),[v,j]=(0,i.useState)(t);t!==v&&(j(t),t&&n({name:t.name||"",prefix:t.prefix||"",apiType:t.apiType||"chat",baseUrl:t.baseUrl||(r?"https://api.anthropic.com/v1":"https://api.openai.com/v1")}));let w=async()=>{if(o.name.trim()&&o.prefix.trim()&&o.baseUrl.trim()){m(!0);try{let e={name:o.name,prefix:o.prefix,baseUrl:o.baseUrl};r||(e.apiType=o.apiType),await a(e)}finally{m(!1)}}},N=async()=>{g(!0);try{let e=await fetch("/api/provider-nodes/validate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({baseUrl:o.baseUrl,apiKey:p,type:r?"anthropic-compatible":"openai-compatible",modelId:u.trim()||void 0})}),t=await e.json();b(t.valid?"success":"failed")}catch{b("failed")}finally{g(!1)}};return t?(0,s.jsx)(d.Modal,{isOpen:e,title:`Edit ${r?"Anthropic":"OpenAI"} Compatible`,onClose:l,children:(0,s.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,s.jsx)(d.Input,{label:"Name",value:o.name,onChange:e=>n({...o,name:e.target.value}),placeholder:`${r?"Anthropic":"OpenAI"} Compatible (Prod)`,hint:"Required. A friendly label for this node."}),(0,s.jsx)(d.Input,{label:"Prefix",value:o.prefix,onChange:e=>n({...o,prefix:e.target.value}),placeholder:r?"ac-prod":"oc-prod",hint:"Required. Used as the provider prefix for model IDs."}),!r&&(0,s.jsx)(d.Select,{label:"API Type",options:_,value:o.apiType,onChange:e=>n({...o,apiType:e.target.value})}),(0,s.jsx)(d.Input,{label:"Base URL",value:o.baseUrl,onChange:e=>n({...o,baseUrl:e.target.value}),placeholder:r?"https://api.anthropic.com/v1":"https://api.openai.com/v1",hint:`Use the base URL (ending in /v1) for your ${r?"Anthropic":"OpenAI"}-compatible API.`}),(0,s.jsxs)("div",{className:"flex gap-2",children:[(0,s.jsx)(d.Input,{label:"API Key (for Check)",type:"password",value:p,onChange:e=>x(e.target.value),className:"flex-1"}),(0,s.jsx)("div",{className:"pt-6",children:(0,s.jsx)(d.Button,{onClick:N,disabled:!p||f||!o.baseUrl.trim(),variant:"secondary",children:f?"Checking...":"Check"})})]}),(0,s.jsx)(d.Input,{label:"Model ID (optional)",value:u,onChange:e=>h(e.target.value),placeholder:"e.g. my-model-id",hint:"If provider lacks /models endpoint, enter a model ID to validate via chat/completions instead."}),y&&(0,s.jsx)(d.Badge,{variant:"success"===y?"success":"error",children:"success"===y?"Valid":"Invalid"}),(0,s.jsxs)("div",{className:"flex gap-2",children:[(0,s.jsx)(d.Button,{onClick:w,fullWidth:!0,disabled:!o.name.trim()||!o.prefix.trim()||!o.baseUrl.trim()||c,children:c?"Saving...":"Save"}),(0,s.jsx)(d.Button,{onClick:l,variant:"ghost",fullWidth:!0,children:"Cancel"})]})]})}):null}function M(e,t){switch(t.type){case"RESET":return{modelId:"",testStatus:null,testError:"",saving:!1};case"SET_MODEL":return{...e,modelId:t.value,testStatus:null,testError:""};case"TEST_START":return{...e,testStatus:"testing",testError:""};case"TEST_RESULT":return{...e,testStatus:t.ok?"ok":"error",testError:t.error||""};case"SAVE_START":return{...e,saving:!0};case"SAVE_DONE":return{...e,saving:!1};default:return e}}function z({isOpen:e,providerAlias:t,providerDisplayAlias:a,onSave:l,onClose:r}){let[o,n]=(0,i.useReducer)(M,{modelId:"",testStatus:null,testError:"",saving:!1}),{modelId:c,testStatus:m,testError:p,saving:x}=o,[u,h]=(0,i.useState)(!1);e&&!u?(h(!0),n({type:"RESET"})):!e&&u&&h(!1);let f=e=>{let a=`${t}/`;return e.startsWith(a)?e.slice(a.length):e},g=async()=>{let e=f(c.trim());if(e){n({type:"TEST_START"});try{let a=await fetch("/api/models/test",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({model:`${t}/${e}`})}),s=await a.json();n({type:"TEST_RESULT",ok:s.ok,error:s.error})}catch(e){n({type:"TEST_RESULT",ok:!1,error:e.message})}}},y=async()=>{let e=f(c.trim());if(e&&!x){n({type:"SAVE_START"});try{await l(e)}finally{n({type:"SAVE_DONE"})}}};return(0,s.jsx)(d.Modal,{isOpen:e,onClose:r,title:"Add Custom Model",children:(0,s.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{htmlFor:"add-custom-model-id",className:"text-sm font-medium mb-1.5 block",children:"Model ID"}),(0,s.jsxs)("div",{className:"flex gap-2",children:[(0,s.jsx)("input",{id:"add-custom-model-id",type:"text",value:c,onChange:e=>n({type:"SET_MODEL",value:e.target.value}),onKeyDown:e=>{"Enter"===e.key&&g()},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"}),(0,s.jsx)(d.Button,{variant:"secondary",icon:"science",loading:"testing"===m,onClick:g,disabled:!c.trim()||"testing"===m,children:"testing"===m?"Testing...":"Test"})]}),(0,s.jsxs)("p",{className:"text-xs text-text-muted mt-1",children:["Sent to provider as: ",(0,s.jsx)("code",{className:"font-mono bg-sidebar px-1 rounded",children:f(c.trim())||"model-id"})]})]}),"ok"===m&&(0,s.jsxs)("div",{className:"flex items-center gap-2 text-sm text-green-600",children:[(0,s.jsx)("span",{className:"material-symbols-outlined text-base",children:"check_circle"}),"Model is reachable"]}),"error"===m&&(0,s.jsxs)("div",{className:"flex items-start gap-2 text-sm text-red-500",children:[(0,s.jsx)("span",{className:"material-symbols-outlined text-base shrink-0",children:"cancel"}),(0,s.jsx)("span",{children:p||"Model not reachable"})]}),(0,s.jsxs)("div",{className:"flex gap-2 pt-1",children:[(0,s.jsx)(d.Button,{onClick:r,variant:"ghost",fullWidth:!0,size:"sm",children:"Cancel"}),(0,s.jsx)(d.Button,{onClick:y,fullWidth:!0,size:"sm",disabled:!c.trim()||x,children:x?"Adding...":"Add Model"})]})]})})}let B=`[
|
|
6
|
+
{
|
|
7
|
+
"accessToken": "eyJhbGc...",
|
|
8
|
+
"refreshToken": "rt_...",
|
|
9
|
+
"idToken": "eyJhbGc...",
|
|
10
|
+
"email": "user@example.com"
|
|
11
|
+
}
|
|
12
|
+
]`;function R({isOpen:e,onClose:t,onSuccess:a}){let[l,r]=(0,i.useState)(""),[o,n]=(0,i.useState)(!1),[c,m]=(0,i.useState)(""),[p,x]=(0,i.useState)(null),u=()=>{o||(r(""),m(""),x(null),t())},h=async()=>{var e;let t;m(""),x(null);let s=l.trim();if(!s)return;try{t=JSON.parse(s)}catch(e){m(`${(0,j.Tl)("Invalid JSON")}: ${e.message}`);return}let i=Array.isArray(e=t)?e:e&&"object"==typeof e?Array.isArray(e.accounts)?e.accounts:[e]:null;if(!i||0===i.length)return void m((0,j.Tl)("No accounts found in input"));n(!0);try{let e=await fetch("/api/oauth/codex/bulk-import",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({accounts:i})}),t=await e.json();if(!e.ok)return void m(t?.error||`Request failed: ${e.status}`);x(t),t.success>0&&"function"==typeof a&&a()}catch(e){m(e.message||(0,j.Tl)("Request failed"))}finally{n(!1)}},f=p?.results?.filter(e=>!e.ok)||[];return(0,s.jsx)(d.Modal,{isOpen:e,title:(0,j.Tl)("Bulk Add Codex Accounts"),onClose:u,children:(0,s.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,s.jsx)("p",{className:"text-xs text-text-muted",children:(0,j.Tl)("Paste an array of codex account JSON objects. Each must include accessToken (and ideally refreshToken, idToken).")}),(0,s.jsx)("textarea",{className:"w-full rounded border border-accent/30 bg-sidebar p-2 text-sm font-mono resize-y min-h-[240px] focus:outline-none focus:ring-1 focus:ring-primary",placeholder:B,value:l,onChange:e=>r(e.target.value),disabled:o}),c&&(0,s.jsx)("p",{className:"text-xs text-red-500 break-words",children:c}),p&&(0,s.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,s.jsxs)("div",{className:`text-sm font-medium ${p.failed>0?"text-yellow-400":"text-green-400"}`,children:["✓ ",p.success," ",(0,j.Tl)("added"),p.failed>0?`, ✗ ${p.failed} ${(0,j.Tl)("failed")}`:""]}),f.length>0&&(0,s.jsx)("ul",{className:"rounded border border-accent/20 bg-sidebar/50 p-2 text-xs font-mono max-h-40 overflow-y-auto",children:f.map(e=>(0,s.jsxs)("li",{className:"text-red-400",children:["[",e.index,"] ",e.error]},e.index))})]}),(0,s.jsxs)("div",{className:"flex gap-2",children:[(0,s.jsx)(d.Button,{onClick:h,fullWidth:!0,disabled:o||!l.trim(),children:o?(0,j.Tl)("Importing..."):(0,j.Tl)("Import All")}),(0,s.jsx)(d.Button,{onClick:u,variant:"ghost",fullWidth:!0,disabled:o,children:(0,j.Tl)("Close")})]})]})})}let K={claude:"claudeAutoPing",codex:"codexAutoPing"};function L(){let e,t,a,r,p=(0,l.useParams)(),x=(0,l.useRouter)(),u=p.id,{getCaps:h}=(0,v.y)(),[f,g]=(0,i.useState)([]),[w,C]=(0,i.useState)(!0),[T,I]=(0,i.useState)(null),[$,E]=(0,i.useState)([]),[O,_]=(0,i.useState)(!1),[M,B]=(0,i.useState)(!1),[L,F]=(0,i.useState)(!1),[J,q]=(0,i.useState)(""),[W,H]=(0,i.useState)(!1),[V,G]=(0,i.useState)(!1),[Q,X]=(0,i.useState)(!1),[Y,Z]=(0,i.useState)(!1),[ee,et]=(0,i.useState)(null),[ea,es]=(0,i.useState)({}),[ei,el]=(0,i.useState)([]),[er,eo]=(0,i.useState)(!1),[en,ed]=(0,i.useState)({}),[ec,em]=(0,i.useState)(""),[ep,ex]=(0,i.useState)(()=>new Set),[eu,eh]=(0,i.useState)(!1),[ef,eg]=(0,i.useState)([]),[ey,eb]=(0,i.useState)(1),[ev,ej]=(0,i.useState)("__none__"),[ew,eN]=(0,i.useState)(!1),[ek,eS]=(0,i.useState)(null),[eC,eA]=(0,i.useState)(""),[eT,eI]=(0,i.useState)(!1),[eP,e$]=(0,i.useState)("auto"),[eE,eO]=(0,i.useState)({enabled:!1,connections:{}}),[eD,e_]=(0,i.useState)([]),[eU,eM]=(0,i.useState)([]),[ez,eB]=(0,i.useState)([]),[eR,eK]=(0,i.useState)([]),[eL,eF]=(0,i.useState)(null),[eJ,eq]=(0,i.useState)(!1),[eW,eH]=(0,i.useState)(!1),[eV,eG]=(0,i.useState)(!1),[eQ,eX]=(0,i.useState)(null),[eY,eZ]=(0,i.useState)({}),[e0,e1]=(0,i.useState)(null),e2=(0,i.useRef)(!1),[e5,e3]=(0,i.useState)(!1),{copied:e4,copy:e6}=(0,b.C)(),e8="ag_risk_confirmed",e7=()=>{_(!0)},e9=()=>{"antigravity"===u&&"true"!==window.localStorage.getItem(e8)?eq(!0):ti?e7():(q(""),F(!0))},te=()=>{q(""),F(!0)},tt=()=>{ti?e9():te()},ta=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}:c.zN[u]||c.fg[u]||c.IS[u]||c.nJ[u]||c.br[u],ts=ta?.authModes||[],ti=!!c.zN[u]||!!c.IS[u]||ts.includes("oauth"),tl=!!c.fg[u]||ts.includes("apikey"),tr=!!c.IS[u]?.noAuth,to=(0,m.KC)(u),tn="cursor"===u&&eU.length>0?eU:to,td=(0,c.wG)(u),tc=(0,c.mq)(u),tm=(0,c.gb)(u),tp=tc||tm,tx=!tp&&ti&&tl,tu="xai"===u?"Grok Build OAuth":"grok-cli"===u?"Grok CLI Device Login":"kimi"===u?"Kimi Coding OAuth":"OAuth",th="xai"===u?"xAI API Key":"kimi"===u?"Kimi API Key":"qoder"===u?"PAT":"API Key",tf=e=>{if(!eP||"auto"===eP)return null;let t=y(u,e);return t&&t.includes(eP)?eP:null},tg=tp?u:td,ty=(e=new Map,t=t=>{t?.id&&!e.has(t.id)&&e.set(t.id,t)},tn.forEach(t),ei.forEach(e=>{e.providerAlias===tg&&"llm"===(e.kind||e.type||"llm")&&t(e)}),a=new Set(eR),[...e.values()].filter(e=>!a.has(e.id))),tb=(()=>{let e=new Set,t=new Set,a=a=>{if(!a||t.has(a))return;t.add(a);let s=y(u,a);s&&s.forEach(t=>{"none"!==t&&e.add(t)})};for(let e of tn)a(e.id);for(let e of ez)a(e.id);for(let e of ei)e.providerAlias===tg&&"llm"===(e.kind||e.type||"llm")&&a(e.id);return e.size?["auto",...e]:null})(),tv=tp?T?.prefix||u:td,tj=(0,i.useCallback)(async()=>{try{let e=await fetch(`/api/models/disabled?providerAlias=${encodeURIComponent(tg)}`,{cache:"no-store"}),t=await e.json();e.ok&&eK(t.ids||[])}catch(e){console.log("Error fetching disabled models:",e)}},[tg]),tw=async e=>{try{(await fetch("/api/models/disabled",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({providerAlias:tg,ids:[e]})})).ok&&await tj()}catch(e){console.log("Error disabling model:",e)}},tN=async e=>{try{(await fetch(`/api/models/disabled?providerAlias=${encodeURIComponent(tg)}&id=${encodeURIComponent(e)}`,{method:"DELETE"})).ok&&await tj()}catch(e){console.log("Error enabling model:",e)}},tk=async e=>{e.length&&eF({title:"Disable All Models",message:`Disable all ${e.length} model(s)?`,onConfirm:async()=>{eF(null);try{(await fetch("/api/models/disabled",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({providerAlias:tg,ids:e})})).ok&&await tj()}catch(e){console.log("Error disabling all models:",e)}}})},tS=async()=>{try{(await fetch(`/api/models/disabled?providerAlias=${encodeURIComponent(tg)}`,{method:"DELETE"})).ok&&await tj()}catch(e){console.log("Error enabling all models:",e)}},tC=(0,i.useCallback)(async()=>{try{let e=await fetch("/api/models/alias"),t=await e.json();e.ok&&es(t.aliases||{})}catch(e){console.log("Error fetching aliases:",e)}},[]),tA=(0,i.useCallback)(async()=>{try{let e=await fetch("/api/models/custom",{cache:"no-store"}),t=await e.json();e.ok&&el(t.models||[])}catch(e){console.log("Error fetching custom models:",e)}},[]);(0,i.useEffect)(()=>{"kilocode"===u&&fetch("/api/providers/kilo/free-models").then(e=>e.json()).then(e=>{e.models?.length&&eB(e.models)}).catch(()=>{})},[u]);let tT=(0,i.useCallback)(async()=>{try{let[e,t,a,s]=await Promise.all([fetch("/api/providers",{cache:"no-store"}),fetch("/api/provider-nodes",{cache:"no-store"}),fetch("/api/proxy-pools?isActive=true",{cache:"no-store"}),fetch("/api/settings",{cache:"no-store"})]),i=await e.json(),l=await t.json(),r=await a.json(),o=s.ok?await s.json():{};if(e.ok){let e=(i.connections||[]).filter(e=>e.provider===u);g(e)}a.ok&&E(r.proxyPools||[]);let n=(o.providerStrategies||{})[u]||{};eS(n.fallbackStrategy||null),eA(null!=n.stickyRoundRobinLimit?String(n.stickyRoundRobinLimit):"1"),eI(!0===n.strictModelAssignment);let d=(o.providerThinking||{})[u]||{};e$(d.mode||"auto");let c=K[u],m=c&&o[c]||{};if(eO({enabled:!0===m.enabled,connections:m.connections||{}}),t.ok){let e=(l.nodes||[]).find(e=>e.id===u)||null;if(!e&&tp)for(let t=0;t<3;t+=1){await new Promise(e=>setTimeout(e,150));let t=await fetch("/api/provider-nodes",{cache:"no-store"});if(t.ok&&(e=((await t.json()).nodes||[]).find(e=>e.id===u)||null))break}I(e)}}catch(e){console.log("Error fetching connections:",e)}finally{C(!1)}},[u,tp]),tI=async e=>{try{let t=await fetch(`/api/provider-nodes/${u}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}),a=await t.json();t.ok&&(I(a.node),await tT(),X(!1))}catch(e){console.log("Error updating provider node:",e)}},tP=async(e,t)=>{try{let a=await fetch("/api/settings",{cache:"no-store"}),s=(a.ok?await a.json():{}).providerStrategies||{},i={...s[u]||{}};e?i.fallbackStrategy=e:(delete i.fallbackStrategy,delete i.stickyRoundRobinLimit),"round-robin"===e&&""!==t&&(i.stickyRoundRobinLimit=Number(t)||3);let l={...s};0===Object.keys(i).length?delete l[u]:l[u]=i,await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({providerStrategies:l})})}catch(e){console.log("Error saving provider strategy:",e)}},t$=async e=>{eI(e);try{let t=await fetch("/api/settings",{cache:"no-store"}),a=(t.ok?await t.json():{}).providerStrategies||{};await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({providerStrategies:{...a,[u]:{...a[u]||{},strictModelAssignment:e}}})})}catch(e){console.log("Error saving Freebuff strict assignment:",e)}},tE=async(e,t)=>{try{(await fetch(`/api/providers/${e}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({providerSpecificData:{assignedModel:t||null}})})).ok&&g(a=>a.map(a=>a.id===e?{...a,providerSpecificData:{...a.providerSpecificData||{},assignedModel:t||null}}:a))}catch(e){console.log("Error saving Freebuff model assignment:",e)}},tO=async e=>{try{let t=await fetch("/api/settings",{cache:"no-store"}),a={...(t.ok?await t.json():{}).providerThinking||{}};e&&"auto"!==e?a[u]={mode:e}:delete a[u],await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({providerThinking:a})})}catch(e){console.log("Error saving thinking config:",e)}},tD=async e=>{let t=K[u];if(t){eO(e);try{await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({[t]:e})})}catch(e){console.log("Error saving auto-ping config:",e)}}};(0,i.useEffect)(()=>{tT(),tC(),tA(),tj()},[tT,tC,tA,tj]),(0,i.useEffect)(()=>{if("cursor"!==u)return void eM([]);let e=f.find(e=>!1!==e.isActive);if(!e?.id)return void eM([]);let t=!1;return fetch(`/api/providers/${e.id}/models`,{cache:"no-store"}).then(async e=>({ok:e.ok,data:await e.json()})).then(({ok:e,data:a})=>{!t&&e&&Array.isArray(a.models)&&a.models.length>0&&eM(a.models)}).catch(()=>{}),()=>{t=!0}},[u,f]),(0,i.useEffect)(()=>{let e=(c.zN[u]||c.fg[u]||c.IS[u]||c.nJ[u])?.modelsFetcher;e&&N(e).then(e_)},[u]);let t_=async(e,t,a=td)=>{let s=`${a}/${e}`;try{let e=await fetch("/api/models/alias",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({model:s,alias:t})});if(e.ok)await tC();else{let t=await e.json();alert(t.error||"Failed to set alias")}}catch(e){console.log("Error setting alias:",e)}},tU=async e=>{try{(await fetch(`/api/models/alias?alias=${encodeURIComponent(e)}`,{method:"DELETE"})).ok&&await tC()}catch(e){console.log("Error deleting alias:",e)}},tM=async(e,t="llm",a=tg)=>{try{let s=await fetch("/api/models/custom",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({providerAlias:a,id:e,type:t})});if(s.ok)await tA(),window.dispatchEvent(new CustomEvent("customModelChanged"));else{let e=await s.json();alert(e.error||"Failed to add custom model")}}catch(e){console.log("Error adding custom model:",e)}},tz=async(e,t="llm",a=tg)=>{try{let s=new URLSearchParams({providerAlias:a,id:e,type:t});(await fetch(`/api/models/custom?${s}`,{method:"DELETE"})).ok&&(await tA(),window.dispatchEvent(new CustomEvent("customModelChanged")))}catch(e){console.log("Error deleting custom model:",e)}},tB=async()=>{if(e5)return;let e=f.find(e=>!1!==e.isActive);if(!e)return void alert((0,j.Tl)("Please add an active Qoder connection first"));e3(!0);try{let t=await fetch(`/api/providers/${e.id}/models`),a=await t.json();if(!t.ok)return void alert(a.error||(0,j.Tl)("Failed to fetch models"));let s=a.models||[];if(0===s.length)return void alert((0,j.Tl)("No models returned"));let i=0;for(let e of s){let t=e.id||e.name;if(!t)continue;let a=t.replace(/^qoder\//,"");ei.some(e=>e.providerAlias===tg&&e.id===a&&"llm"===(e.kind||e.type||"llm"))||Object.values(ea).includes(`${tg}/${a}`)||(await tM(a,"llm",tg),i+=1)}0===i?alert((0,j.Tl)("All models already exist, no new models added")):alert((0,j.Tl)("Successfully added")+` ${i} `+(0,j.Tl)("models"))}catch(e){console.log("Error importing Qoder models:",e),alert((0,j.Tl)("Error fetching models")+": "+e.message)}finally{e3(!1)}},tR=async()=>{if(eW||0===f.length)return;let e=Object.fromEntries(f.map(e=>[e.id,{state:"queued",error:null}]));e2.current=!1,eH(!0),eG(!1),eX(null),eZ(e),e1({total:f.length,completed:0,passed:0,failed:0,stopped:!1});let t=0,a=0;try{for(let e=0;e<f.length;e+=1){if(e2.current){e1({total:f.length,completed:e,passed:t,failed:a,stopped:!0});break}let s=f[e];eX(s.id),eZ(e=>({...e,[s.id]:{state:"testing",error:null}}));try{let e=await fetch(`/api/providers/${s.id}/test`,{method:"POST"}),i=await e.json(),l=!!i.valid;l?t+=1:a+=1,eZ(e=>({...e,[s.id]:{state:l?"success":"failed",error:l?null:i.error||null}}))}catch(e){a+=1,eZ(t=>({...t,[s.id]:{state:"failed",error:e.message||"Test failed"}}))}e1({total:f.length,completed:e+1,passed:t,failed:a,stopped:!1}),e<f.length-1&&await new Promise(e=>setTimeout(e,1e3))}}finally{eX(null),eH(!1),eG(!1),e2.current=!1}},tK=async e=>{eF({title:"Delete Connection",message:"Delete this connection?",onConfirm:async()=>{eF(null);try{(await fetch(`/api/providers/${e}`,{method:"DELETE"})).ok&&g(t=>t.filter(t=>t.id!==e))}catch(e){console.log("Error deleting connection:",e)}}})},tL=()=>{tT(),_(!1)},tF=async e=>{q("");try{let t=await fetch("/api/providers",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:u,...e})}),a=null;try{a=await t.json()}catch{a=null}if(t.ok){await tT(),F(!1);return}q(a?.error||"Failed to save connection")}catch(e){console.log("Error saving connection:",e),q("Failed to save connection")}},tJ=async e=>{try{(await fetch(`/api/providers/${ee.id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})).ok&&(await tT(),G(!1))}catch(e){console.log("Error updating connection:",e)}},tq=async(e,t)=>{try{(await fetch(`/api/providers/${e}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({isActive:t})})).ok&&g(a=>a.map(a=>a.id===e?{...a,isActive:t}:a))}catch(e){console.log("Error updating connection status:",e)}},tW=async(e,t)=>{let a=[...f];[a[e],a[t]]=[a[t],a[e]],g(a);try{await Promise.all([fetch(`/api/providers/${a[e].id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({priority:e})}),fetch(`/api/providers/${a[t].id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({priority:t})})])}catch(e){console.log("Error swapping priority:",e),await tT()}},tH=f.filter(e=>ef.includes(e.id)),{currentPage:tV,totalPages:tG,items:tQ,start:tX}=function(e=[],t=1){let a=Array.isArray(e)?e:[],s=a.length,i=Math.max(1,Math.ceil(s/10)),l=Math.floor(Number(t)),r=Math.min(Number.isFinite(l)&&l>0?l:1,i),o=(r-1)*10,n=a.slice(o,o+10);return{currentPage:r,totalPages:i,totalItems:s,start:o,items:n,pageSize:10}}(f,ey),tY=f.length>0&&ef.length===f.length;(0,i.useEffect)(()=>{eg(e=>e.filter(e=>f.some(t=>t.id===e)))},[f]);let tZ=(()=>{if(0===tH.length)return"";let e=new Set(tH.map(e=>e.providerSpecificData?.proxyPoolId||"__none__"));if(1===e.size){let t=[...e][0];if("__none__"===t)return"All selected currently unbound";let a=$.find(e=>e.id===t);return`All selected currently bound to ${a?.name||t}`}return"Selected connections have mixed proxy bindings"})(),t0=()=>{ew||Z(!1)},t1=async(e,t)=>{let a=await fetch(`/api/providers/${e}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});if(!a.ok)throw Error((await a.json().catch(()=>({}))).error||`Proxy update failed (${a.status})`);return a.json()},t2=async e=>{eN(!0);try{let t=[];for(let{connectionId:a,proxyPoolId:s,proxyPoolIds:i,proxyRotationStrategy:l}of e)try{let e=i?{proxyPoolIds:i,proxyRotationStrategy:l}:{proxyPoolId:s};await t1(a,e)}catch(e){console.log("Error applying proxy for",a,e),t.push(a)}if(await tT(),t.length>0)return void alert(`Updated with ${t.length} failed request(s). Retry the selected connections.`);Z(!1),eg([]),ej("__none__")}finally{eN(!1)}},t5=e=>t2((ef.length>0?tH:f).map(t=>({connectionId:t.id,proxyPoolId:e}))),t3=(0,s.jsxs)("div",{className:"flex min-w-0 flex-col divide-y divide-black/[0.03] dark:divide-white/[0.03]",children:[tQ.map((e,t)=>{let a,i=tX+t;return(0,s.jsxs)("div",{className:"flex min-w-0 items-stretch",children:[(0,s.jsx)("div",{className:"flex shrink-0 items-center pl-1 sm:pl-2",children:(0,s.jsx)("input",{type:"checkbox",checked:(a=e.id,ef.includes(a)),onChange:()=>{var t;return t=e.id,void eg(e=>e.includes(t)?e.filter(e=>e!==t):[...e,t])},className:"h-4 w-4 rounded border-gray-300 text-primary focus:ring-primary"})}),(0,s.jsx)("div",{className:"flex-1 min-w-0",children:(0,s.jsx)(P,{connection:e,proxyPools:$,isOAuth:ti,isFirst:0===i,isLast:i===f.length-1,onMoveUp:()=>tW(i,i-1),onMoveDown:()=>tW(i,i+1),onToggleActive:t=>tq(e.id,t),autoPing:K[u]&&"oauth"===e.authType?{on:!0===eE.connections[e.id],onToggle:t=>{var a;return a=e.id,void tD({...eE,connections:{...eE.connections,[a]:t}})},provider:u}:null,onUpdateProxy:async t=>{try{let a="object"==typeof t?t:{proxyPoolId:t||null};if((await fetch(`/api/providers/${e.id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)})).ok){let t={...e.providerSpecificData};a.proxyPoolIds?(t.proxyPoolIds=a.proxyPoolIds,t.proxyRotationStrategy=a.proxyRotationStrategy,delete t.proxyPoolId):(a.proxyPoolId?t.proxyPoolId=a.proxyPoolId:delete t.proxyPoolId,delete t.proxyPoolIds,delete t.proxyRotationStrategy),g(a=>a.map(a=>a.id===e.id?{...a,providerSpecificData:t}:a))}}catch(e){console.log("Error updating proxy:",e)}},onEdit:()=>{et(e),G(!0)},onDelete:()=>tK(e.id),oneByOneStatus:eY[e.id]||null,modelAssignmentOptions:"freebuff"===u?ty:null,onModelAssignmentChange:"freebuff"===u?t=>tE(e.id,t):null,strictModelAssignment:eT})})]},e.id)}),f.length>10&&(0,s.jsx)(d.Pagination,{currentPage:tV,pageSize:10,totalItems:f.length,onPageChange:eb})]}),t4=$.filter(e=>!0===e.isActive),t6=(0,s.jsx)(d.Modal,{isOpen:Y,onClose:t0,title:ef.length>0?`Apply Proxy (${ef.length} selected)`:`Apply Proxy (All ${f.length} connections)`,children:(0,s.jsxs)("div",{className:"flex flex-col gap-4",children:[tZ&&(0,s.jsx)("p",{className:"text-xs text-text-muted bg-surface-2 px-3 py-2 rounded-lg border border-border/50",children:tZ}),(0,s.jsxs)("div",{className:"flex flex-col divide-y divide-border/30 border border-border/50 rounded-xl overflow-hidden bg-surface",children:[(0,s.jsxs)("div",{className:"p-3 flex flex-col gap-1",children:[(0,s.jsx)("p",{className:"px-3 pb-1 text-[10px] font-semibold uppercase tracking-wider text-text-muted",children:"Dynamic Strategies"}),(0,s.jsxs)("button",{type:"button",onClick:()=>{let e=$.filter(e=>!0===e.isActive);return 0===e.length?void alert("No active proxy pools available."):t2((ef.length>0?tH:f).map((t,a)=>({connectionId:t.id,proxyPoolId:e[a%e.length].id})))},disabled:ew||0===t4.length,className:"flex items-center gap-3 rounded-lg px-3 py-2 text-left transition-colors hover:bg-surface-2 disabled:cursor-not-allowed disabled:opacity-50",children:[(0,s.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[20px]",children:"sync_alt"}),(0,s.jsxs)("div",{className:"flex flex-col",children:[(0,s.jsx)("span",{className:"text-sm font-medium text-text-main",children:"One-to-one (rotate)"}),(0,s.jsx)("span",{className:"text-[10px] text-text-muted mt-0.5",children:"Distribute active proxy pools round-robin"})]})]}),["fill-first","round-robin","random","smart"].map(e=>(0,s.jsxs)("button",{type:"button",onClick:()=>{let t;return(t=t4.map(e=>e.id).filter(e=>$.find(t=>t.id===e)?.isActive===!0)).length?t2((ef.length>0?tH:f).map(a=>({connectionId:a.id,proxyPoolIds:t,proxyRotationStrategy:e}))):void alert("No active proxy pools selected.")},disabled:ew||0===t4.length,className:"flex items-center gap-3 rounded-lg px-3 py-2 text-left transition-colors hover:bg-surface-2 disabled:cursor-not-allowed disabled:opacity-50",children:[(0,s.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[20px]",children:"autorenew"}),(0,s.jsxs)("div",{className:"flex flex-col",children:[(0,s.jsxs)("span",{className:"text-sm font-medium text-text-main capitalize",children:[e," strategy"]}),(0,s.jsx)("span",{className:"text-[10px] text-text-muted mt-0.5",children:"smart"===e?"Bypass pools marked unfit for provider/model":`Rotate over all active pools using ${e}`})]})]},e))]}),(0,s.jsxs)("div",{className:"p-3 flex flex-col gap-1",children:[(0,s.jsx)("p",{className:"px-3 pb-1 text-[10px] font-semibold uppercase tracking-wider text-text-muted",children:"Static Assignment"}),(0,s.jsxs)("button",{type:"button",onClick:()=>t5(null),disabled:ew,className:"flex items-center gap-3 rounded-lg px-3 py-2 text-left transition-colors hover:bg-surface-2 disabled:cursor-not-allowed disabled:opacity-50",children:[(0,s.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[20px]",children:"link_off"}),(0,s.jsxs)("div",{className:"flex flex-col",children:[(0,s.jsx)("span",{className:"text-sm font-medium text-text-main",children:"None (unbind all)"}),(0,s.jsx)("span",{className:"text-[10px] text-text-muted mt-0.5",children:"Direct routing without proxy"})]})]}),$.map(e=>(0,s.jsxs)("button",{type:"button",onClick:()=>t5(e.id),disabled:ew||!0!==e.isActive,className:"flex items-center gap-3 rounded-lg px-3 py-2 text-left transition-colors hover:bg-surface-2 disabled:cursor-not-allowed disabled:opacity-50",children:[(0,s.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[20px]",children:"lan"}),(0,s.jsxs)("div",{className:"flex flex-col min-w-0 flex-1",children:[(0,s.jsx)("span",{className:"truncate text-sm font-medium text-text-main",children:e.name}),(0,s.jsx)("span",{className:"text-[10px] text-text-muted truncate mt-0.5",children:e.proxyUrl})]}),!0!==e.isActive&&(0,s.jsx)(d.Badge,{variant:"secondary",size:"sm",className:"ml-auto shrink-0",children:"inactive"})]},e.id))]})]}),ew&&(0,s.jsx)("p",{className:"text-xs text-text-muted animate-pulse px-1",children:"Applying proxy configuration..."}),(0,s.jsx)(d.Button,{onClick:t0,variant:"ghost",fullWidth:!0,disabled:ew,children:"Cancel"})]})}),t8=async e=>{if(!ep.has(e)){ex(t=>new Set(t).add(e));try{let t=await fetch("/api/models/test",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({model:`${tg}/${e}`})}),a=await t.json();ed(t=>({...t,[e]:a.ok?"ok":"error"})),em(a.ok?"":a.error||"Model not reachable")}catch{ed(t=>({...t,[e]:"error"})),em("Network error")}finally{ex(t=>{let a=new Set(t);return a.delete(e),a})}}};return w?(0,s.jsxs)("div",{className:"flex flex-col gap-8",children:[(0,s.jsx)(d.CardSkeleton,{}),(0,s.jsx)(d.CardSkeleton,{})]}):ta?(0,s.jsxs)("div",{className:"flex min-w-0 flex-col gap-6 px-1 sm:gap-8 sm:px-0",children:[(0,s.jsxs)("div",{className:"min-w-0",children:[(0,s.jsxs)(o(),{href:"/dashboard/providers",className:"inline-flex items-center gap-1 text-sm text-text-muted hover:text-primary transition-colors mb-4",children:[(0,s.jsx)("span",{className:"material-symbols-outlined text-lg",children:"arrow_back"}),"Back to Providers"]}),(0,s.jsxs)("div",{className:"flex min-w-0 items-center gap-3 sm:gap-4",children:[(0,s.jsx)(n.A,{providerId:ta.id,size:48,alt:ta.name,className:"shrink-0 rounded-lg",fallbackText:ta.textIcon||ta.id.slice(0,2).toUpperCase(),fallbackColor:ta.color}),(0,s.jsxs)("div",{className:"min-w-0",children:[(0,s.jsxs)("div",{className:"flex items-center gap-3 flex-wrap",children:[(0,s.jsx)("h1",{className:"truncate text-2xl font-semibold tracking-tight sm:text-3xl",children:ta.name}),(ta.notice?.apiKeyUrl||ta.notice?.signupUrl||ta.website)&&(0,s.jsxs)("a",{href:ta.notice?.apiKeyUrl||ta.notice?.signupUrl||ta.website,target:"_blank",rel:"noopener noreferrer",className:"text-xs text-primary hover:underline inline-flex items-center gap-1",children:[(0,s.jsx)("span",{className:"material-symbols-outlined text-sm",children:"open_in_new"}),ta.notice?.apiKeyUrl?"Get API Key":"Sign up / Learn more"]})]}),(0,s.jsxs)("p",{className:"text-text-muted",children:[f.length," connection",1===f.length?"":"s"]})]})]})]}),ta.deprecated&&(0,s.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,s.jsx)("span",{className:"material-symbols-outlined text-[16px] text-yellow-500 mt-0.5 shrink-0",children:"warning"}),(0,s.jsx)("p",{className:"text-xs text-red-600 dark:text-yellow-400 leading-relaxed",children:ta.deprecationNotice})]}),ta.notice?.text&&!ta.deprecated&&(0,s.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,s.jsx)("span",{className:"material-symbols-outlined text-[16px] text-blue-500 shrink-0",children:"info"}),(0,s.jsx)("p",{className:"min-w-0 flex-1 text-xs leading-relaxed text-blue-600 dark:text-blue-400",children:ta.notice.text}),ta.notice.apiKeyUrl&&(0,s.jsx)("a",{href:ta.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 →"})]}),tp&&T&&(0,s.jsx)(d.Card,{children:(0,s.jsxs)("div",{className:"mb-4 flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between",children:[(0,s.jsxs)("div",{className:"min-w-0",children:[(0,s.jsx)("h2",{className:"text-lg font-semibold",children:tm?"Anthropic Compatible Details":"OpenAI Compatible Details"}),(0,s.jsxs)("p",{className:"break-all text-sm text-text-muted",children:[tm?"Messages API":"responses"===T.apiType?"Responses API":"Chat Completions"," \xb7 ",(T.baseUrl||"").replace(/\/$/,""),"/",tm?"messages":"responses"===T.apiType?"responses":"chat/completions"]})]}),(0,s.jsxs)("div",{className:"grid grid-cols-1 gap-2 sm:flex sm:items-center",children:[(0,s.jsx)(d.Button,{size:"sm",icon:"add",onClick:()=>{q(""),F(!0)},className:"w-full sm:w-auto",children:"Add API Key"}),(0,s.jsx)(d.Button,{size:"sm",variant:"secondary",icon:"edit",onClick:()=>X(!0),className:"w-full sm:w-auto",children:"Edit"}),(0,s.jsx)(d.Button,{size:"sm",variant:"secondary",icon:"delete",onClick:async()=>{eF({title:"Delete Compatible Node",message:`Delete this ${tm?"Anthropic":"OpenAI"} Compatible node?`,onConfirm:async()=>{eF(null);try{(await fetch(`/api/provider-nodes/${u}`,{method:"DELETE"})).ok&&x.push("/dashboard/providers")}catch(e){console.log("Error deleting provider node:",e)}}})},className:"w-full sm:w-auto",children:"Delete"})]})]})}),tr?(0,s.jsx)(d.NoAuthProxyCard,{providerId:u}):(0,s.jsxs)(d.Card,{children:[(0,s.jsxs)("div",{className:"mb-4 flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[(0,s.jsx)("h2",{className:"text-lg font-semibold",children:"Connections"}),(0,s.jsxs)("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:gap-4",children:[f.length>0&&$.length>0&&(0,s.jsx)(d.Button,{size:"sm",variant:"secondary",icon:"lan",onClick:()=>Z(!0),children:"Apply Proxy"}),f.length>0&&(0,s.jsxs)(s.Fragment,{children:[ef.length>0&&(0,s.jsxs)(d.Button,{size:"sm",variant:"danger",icon:"delete",onClick:()=>{let e=ef.length;0!==e&&eF({title:`Delete ${e} Connection${e>1?"s":""}`,message:`Delete ${e} connection${e>1?"s":""}? This cannot be undone.`,onConfirm:async()=>{eF(null);let e=0,t=[...ef];for(let a of t)try{(await fetch(`/api/providers/${a}`,{method:"DELETE"})).ok||(e+=1)}catch(t){console.log("Error deleting connection:",t),e+=1}g(e=>e.filter(e=>!t.includes(e.id))),eg([]),e>0&&alert(`Deleted ${t.length-e} connection(s), ${e} failed.`)}})},children:["Delete Selected (",ef.length,")"]}),(0,s.jsx)(d.Button,{size:"sm",variant:"secondary",icon:"sync",onClick:tR,disabled:eW,children:eW?"Testing Connection One-by-One...":"Test Connection One-by-One"}),eW&&(0,s.jsx)(d.Button,{size:"sm",variant:"ghost",icon:"stop",onClick:()=>{eW&&(e2.current=!0,eG(!0))},disabled:eV,children:eV?"Stopping...":"Stop"})]}),(0,s.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,s.jsx)("span",{className:"text-xs text-text-muted font-medium",children:"Round Robin"}),(0,s.jsx)(d.Toggle,{checked:"round-robin"===ek,onChange:e=>{let t=e?"round-robin":null,a=e?eC||"1":eC;e&&!eC&&eA("1"),eS(t),tP(t,a)}}),"round-robin"===ek&&(0,s.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,s.jsx)("span",{className:"text-xs text-text-muted",children:"Sticky:"}),(0,s.jsx)("input",{type:"number",min:1,value:eC,onChange:e=>{var t;eA(t=e.target.value),tP("round-robin",t)},placeholder:"1",className:"w-14 px-2 py-1 text-xs border border-border rounded-md bg-background focus:outline-none focus:border-primary"})]})]}),"freebuff"===u&&(0,s.jsxs)("div",{className:"flex flex-wrap items-center gap-2 border-t border-black/[0.03] pt-2 dark:border-white/[0.03]",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("span",{className:"text-xs text-text-muted font-medium",children:"Strict Model Assignment"}),(0,s.jsx)("p",{className:"text-[10px] text-text-muted",children:"Only assigned accounts can serve each Freebuff model."})]}),(0,s.jsx)(d.Toggle,{checked:eT,onChange:t$})]})]})]}),0===f.length?(0,s.jsxs)("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[(0,s.jsxs)("div",{className:"flex items-center gap-3",children:[(0,s.jsx)("div",{className:"inline-flex items-center justify-center w-9 h-9 rounded-full bg-primary/10 text-primary shrink-0",children:(0,s.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:ti?"lock":"key"})}),(0,s.jsxs)("div",{className:"min-w-0",children:[(0,s.jsx)("p",{className:"text-sm text-text-muted",children:"No connections yet"}),tx&&(0,s.jsxs)("p",{className:"text-xs text-text-muted",children:["Choose ",tu," or ",th,"."]})]})]}),(0,s.jsx)("div",{className:"flex gap-2",children:tx?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(d.Button,{size:"sm",icon:"lock",variant:"secondary",onClick:e9,children:tu}),(0,s.jsx)(d.Button,{size:"sm",icon:"key",onClick:te,children:th})]}):(0,s.jsxs)(s.Fragment,{children:[!tp&&"iflow"===u&&(0,s.jsx)(d.Button,{size:"sm",icon:"cookie",variant:"secondary",onClick:()=>B(!0),children:"Cookie"}),"codex"===u&&(0,s.jsx)(d.Button,{size:"sm",icon:"playlist_add",variant:"secondary",onClick:()=>H(!0),children:(0,j.Tl)("Bulk Add")}),(0,s.jsx)(d.Button,{size:"sm",icon:"add",onClick:tt,children:tp?"Add API Key":"iflow"===u?"OAuth":"Add Connection"})]})})]}):(0,s.jsxs)(s.Fragment,{children:[e0&&(0,s.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,s.jsxs)("div",{className:"flex flex-wrap items-center gap-3",children:[(0,s.jsxs)("span",{children:["Total: ",e0.total]}),(0,s.jsxs)("span",{children:["Completed: ",e0.completed]}),(0,s.jsxs)("span",{children:["Passed: ",e0.passed]}),(0,s.jsxs)("span",{children:["Failed: ",e0.failed]}),e0.stopped&&(0,s.jsx)("span",{className:"text-amber-600 dark:text-amber-400",children:"Stopped"}),eW&&eQ&&(0,s.jsxs)("span",{children:["Running: ",f.find(e=>e.id===eQ)?.name||eQ]})]})}),f.length>0&&(0,s.jsx)("div",{className:"mb-3 flex items-center gap-2 border-b border-black/[0.03] pb-2 dark:border-white/[0.03]",children:(0,s.jsxs)("label",{className:"flex cursor-pointer items-center gap-1.5 text-xs text-text-muted hover:text-primary",children:[(0,s.jsx)("input",{type:"checkbox",checked:tY,onChange:()=>{tY?eg([]):eg(f.map(e=>e.id))},className:"h-3.5 w-3.5 rounded border-gray-300 text-primary focus:ring-primary"}),"Select All"]})}),t3,!tp&&(0,s.jsxs)("div",{className:"mt-4 grid grid-cols-1 gap-2 sm:flex",children:["iflow"===u&&(0,s.jsx)(d.Button,{size:"sm",icon:"cookie",variant:"secondary",onClick:()=>B(!0),title:"Add connection using browser cookie",className:"w-full sm:w-auto",children:"Cookie"}),"codex"===u&&(0,s.jsx)(d.Button,{size:"sm",icon:"playlist_add",variant:"secondary",onClick:()=>H(!0),title:(0,j.Tl)("Bulk import codex accounts from JSON"),className:"w-full sm:w-auto",children:(0,j.Tl)("Bulk Add")}),tx?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(d.Button,{size:"sm",icon:"lock",variant:"secondary",onClick:e9,className:"w-full sm:w-auto",children:tu}),(0,s.jsx)(d.Button,{size:"sm",icon:"key",onClick:te,className:"w-full sm:w-auto",children:th})]}):(0,s.jsx)(d.Button,{size:"sm",icon:"add",onClick:tt,className:"w-full sm:w-auto",children:"Add"})]})]})]}),(0,s.jsxs)(d.Card,{children:[(0,s.jsxs)("div",{className:"mb-4 flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between",children:[(0,s.jsxs)("div",{className:"flex items-center gap-3",children:[(0,s.jsx)("h2",{className:"text-lg font-semibold",children:"Available Models"}),tb&&(0,s.jsx)("select",{value:eP,onChange:e=>{var t;e$(t=e.target.value),tO(t)},title:"Appends (level) suffix to copied model names",className:"rounded-md border border-border bg-background px-2 py-1 text-xs focus:border-primary focus:outline-none",children:tb.map(e=>(0,s.jsx)("option",{value:e,children:`Thinking: ${e.charAt(0).toUpperCase()+e.slice(1)}`},e))})]}),!tp&&(r=[...tn,...ez.filter(e=>!tn.some(t=>t.id===e.id))].filter(e=>{let t=(0,m.CP)(e);return!t||"llm"===t}).map(e=>e.id).filter(e=>!eR.includes(e)),(0,s.jsxs)("div",{className:"flex gap-2",children:[eR.length>0&&(0,s.jsx)(d.Button,{size:"sm",variant:"secondary",icon:"restart_alt",onClick:tS,children:"Active All"}),r.length>0&&(0,s.jsx)(d.Button,{size:"sm",variant:"secondary",icon:"block",onClick:()=>tk(r),children:"Disable All"})]}))]}),!!ec&&(0,s.jsx)("p",{className:"text-xs text-red-500 mb-3 break-words",children:ec}),(()=>{let e,t,a;if(tp)return(0,s.jsx)(A,{providerStorageAlias:tg,providerDisplayAlias:tv,modelAliases:ea,customModels:ei,copied:e4,onCopy:e6,onSetAlias:t_,onDeleteAlias:tU,onAddCustomModel:e=>tM(e,"llm",tg),onDeleteCustomModel:e=>tz(e,"llm",tg),connections:f,isAnthropic:tm});let i=[...tn,...ez.filter(e=>!tn.some(t=>t.id===e.id))].filter(e=>{let t=(0,m.CP)(e);return!t||"llm"===t}),l=new Set(eR),r=i.filter(e=>!l.has(e.id)),o=i.filter(e=>l.has(e.id)),n=k({customModels:ei,modelAliases:ea,providerAlias:tg,builtInModels:tn,type:"llm"});return(0,s.jsxs)("div",{className:"flex flex-wrap gap-3",children:[n.map(e=>(0,s.jsx)(S,{model:{id:e.id,name:e.name},fullModel:`${tv}/${e.id}`,alias:e.alias,copied:e4,onCopy:e6,onSetAlias:()=>{},onDeleteAlias:()=>{"custom"===e.source?tz(e.id,"llm",tg):tU(e.alias)},testStatus:en[e.id],onTest:f.length>0||tr?()=>t8(e.id):void 0,isTesting:ep.has(e.id),isCustom:!0,isFree:!1,caps:h(`${u}/${e.id}`),thinkingSuffix:tf(e.id)},`${e.source}-${e.fullModel}`)),r.map(e=>{let t=`${tg}/${e.id}`,a=`${u}/${e.id}`,i=Object.entries(ea).find(([,e])=>e===t||e===a)?.[0];return(0,s.jsx)(S,{model:e,fullModel:`${tv}/${e.id}`,alias:i,copied:e4,onCopy:e6,onSetAlias:t=>t_(e.id,t,tg),onDeleteAlias:()=>tU(i),testStatus:en[e.id],onTest:f.length>0||tr?()=>t8(e.id):void 0,isTesting:ep.has(e.id),isFree:e.isFree,onDisable:()=>tw(e.id),caps:h(`${u}/${e.id}`),thinkingSuffix:tf(e.id)},e.id)}),(0,s.jsxs)("button",{onClick:()=>eh(!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,s.jsx)("span",{className:"material-symbols-outlined text-sm",children:"add"}),"Add Model"]}),"qoder"===u&&f.some(e=>!1!==e.isActive)&&(0,s.jsxs)("button",{onClick:tB,disabled:e5,className:"flex w-full items-center justify-center gap-1.5 rounded-lg border border-dashed border-blue-500/40 px-3 py-2 text-xs text-blue-600 dark:text-blue-400 transition-colors hover:border-blue-500 hover:bg-blue-500/5 sm:w-auto disabled:opacity-50 disabled:cursor-not-allowed",children:[(0,s.jsx)("span",{className:"material-symbols-outlined text-sm",style:e5?{animation:"spin 1s linear infinite"}:void 0,children:e5?"progress_activity":"download"}),e5?(0,j.Tl)("Fetching..."):(0,j.Tl)("Fetch Qoder Models")]}),eD.length>0&&(e=new Set([...Object.values(ea),...n.map(e=>e.fullModel)]),t=new Set(tn.map(e=>e.id)),0===(a=eD.filter(a=>!e.has(`${tg}/${a.id}`)&&!t.has(a.id))).length?null:(0,s.jsxs)("div",{className:"w-full mt-2",children:[(0,s.jsx)("p",{className:"text-xs text-text-muted mb-2",children:"Suggested free models (≥200k context):"}),(0,s.jsx)("div",{className:"flex flex-wrap gap-2",children:a.map(e=>(0,s.jsxs)("button",{onClick:async()=>{await tM(e.id,"llm",tg)},className:"flex items-center gap-1 px-2.5 py-1.5 rounded-lg border border-black/10 dark:border-white/10 text-xs text-text-muted hover:text-primary hover:border-primary/40 hover:bg-primary/5 transition-colors",title:`${e.name} \xb7 ${(e.contextLength/1e3).toFixed(0)}k ctx`,children:[(0,s.jsx)("span",{className:"material-symbols-outlined text-[13px]",children:"add"}),e.id.split("/").pop()]},e.id))})]})),o.length>0&&(0,s.jsxs)("div",{className:"w-full mt-2",children:[(0,s.jsxs)("p",{className:"text-xs text-text-muted mb-2",children:["Disabled models (",o.length,"):"]}),(0,s.jsx)("div",{className:"flex flex-wrap gap-2",children:o.map(e=>(0,s.jsxs)("button",{onClick:()=>tN(e.id),className:"flex items-center gap-1 px-2.5 py-1.5 rounded-lg border border-dashed border-black/10 dark:border-white/10 text-xs text-text-muted hover:text-primary hover:border-primary/40 hover:bg-primary/5 transition-colors",title:"Restore model",children:[(0,s.jsx)("span",{className:"material-symbols-outlined text-[13px]",children:"add"}),e.id]},e.id))})]})]})})()]}),t6,"kiro"===u?(0,s.jsx)(d.KiroOAuthWrapper,{isOpen:O,providerInfo:ta,onSuccess:tL,onClose:()=>_(!1)}):"cursor"===u?(0,s.jsx)(d.CursorAuthModal,{isOpen:O,onSuccess:tL,onClose:()=>_(!1)}):"gitlab"===u?(0,s.jsx)(d.GitLabAuthModal,{isOpen:O,providerInfo:ta,onSuccess:tL,onClose:()=>_(!1)}):(0,s.jsx)(d.OAuthModal,{isOpen:O,provider:u,providerInfo:ta,onSuccess:tL,onClose:()=>_(!1)}),"iflow"===u&&(0,s.jsx)(d.IFlowCookieModal,{isOpen:M,onSuccess:()=>{tT(),B(!1)},onClose:()=>B(!1)}),(0,s.jsx)(D,{isOpen:L,provider:u,providerName:ta.name,isCompatible:tp,isAnthropic:tm,authType:ta?.authType,authHint:ta?.authHint,website:ta?.website,proxyPools:$,error:J,existingNames:f.map(e=>e.name).filter(Boolean),onSave:tF,onBulkDone:tT,onClose:()=>{q(""),F(!1)}}),(0,s.jsx)(d.EditConnectionModal,{isOpen:V,connection:ee,proxyPools:$,onSave:tJ,onClose:()=>G(!1)}),tp&&(0,s.jsx)(U,{isOpen:Q,node:T,onSave:tI,onClose:()=>X(!1),isAnthropic:tm}),!tp&&(0,s.jsx)(z,{isOpen:eu,providerAlias:tg,providerDisplayAlias:tv,onSave:async e=>{await tM(e,"llm",tg),eh(!1)},onClose:()=>eh(!1)}),"codex"===u&&(0,s.jsx)(R,{isOpen:W,onClose:()=>H(!1),onSuccess:tT}),(0,s.jsx)(d.ConfirmModal,{isOpen:eJ,onClose:()=>eq(!1),onConfirm:()=>{(window.localStorage.setItem(e8,"true"),eq(!1),ti)?e7():te()},title:"Risk Notice",message:ta?.deprecationNotice,confirmText:"I Understand, Continue",cancelText:"Cancel",variant:"danger"}),(0,s.jsx)(d.ConfirmModal,{isOpen:!!eL,onClose:()=>eF(null),onConfirm:eL?.onConfirm,title:eL?.title||"Confirm",message:eL?.message,variant:"danger"})]}):(0,s.jsxs)("div",{className:"text-center py-20",children:[(0,s.jsx)("p",{className:"text-text-muted",children:"Provider not found"}),(0,s.jsx)(o(),{href:"/dashboard/providers",className:"text-primary mt-4 inline-block",children:"Back to Providers"})]})}},21863:(e,t,a)=>{"use strict";function s(e,t){return!1===e?"default":"active"===t||"success"===t?"success":"error"===t||"expired"===t||"unavailable"===t?"error":"default"}function i(e){let t=e?.testStatus;return e?.isActive===!1||"unavailable"===t||"error"===t||"expired"===t?"unavailable":"active"}a.d(t,{d:()=>i,g:()=>s})},68810:(e,t,a)=>{Promise.resolve().then(a.bind(a,6))}},e=>{e.O(0,[3885,2318,4385,2940,7236,5479,2147,3204,7358],()=>e(e.s=68810)),_N_E=e.O()}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8460],{21511:(e,t,s)=>{"use strict";s.r(t),s.d(t,{default:()=>w});var a=s(15102),r=s(82030),l=s(92940),i=s(31704),n=s(19965);function o(e,t){return"kiro"===t?["oauth","apikey","api_key"]:Array.isArray(e?.authModes)&&e.authModes.length>0?e.authModes:e?.hasOAuth?["oauth"]:["apikey"]}var c=s(11434),d=s(31038),m=s(93885),p=s.n(m),x=s(25795),u=s(71389);s(48271);let h={available:{icon:"check_circle",color:"#22c55e",label:"Available"},cooldown:{icon:"schedule",color:"#f59e0b",label:"Cooldown"},unavailable:{icon:"error",color:"#ef4444",label:"Unavailable"},unknown:{icon:"help",color:"#6b7280",label:"Unknown"}};function f(){let[e,t]=(0,r.useState)(null),[s,i]=(0,r.useState)(!0),[n,o]=(0,r.useState)(!1),[c,d]=(0,r.useState)(null),m=(0,r.useRef)(null),p=(0,x.i)(),u=(0,r.useCallback)(async()=>{try{let e=await fetch("/api/models/availability");if(e.ok){let s=await e.json();t(s)}}catch{}finally{i(!1)}},[]);(0,r.useEffect)(()=>{u();let e=setInterval(u,3e4);return()=>clearInterval(e)},[u]),(0,r.useEffect)(()=>{let e=e=>{m.current&&!m.current.contains(e.target)&&o(!1)};return n&&document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[n]);let f=async(e,t)=>{d(`${e}:${t}`);try{(await fetch("/api/models/availability",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"clearCooldown",provider:e,model:t})})).ok?(p.success(`Cooldown cleared for ${t}`),await u()):p.error("Failed to clear cooldown")}catch{p.error("Failed to clear cooldown")}finally{d(null)}};if(s)return null;let b=e?.models||[],g=0===(e?.unavailableCount||b.filter(e=>"available"!==e.status).length),y={};return b.forEach(e=>{if("available"===e.status)return;let t=e.provider||"unknown";y[t]||(y[t]=[]),y[t].push(e)}),(0,a.jsx)("div",{className:"relative",ref:m,children:n&&(0,a.jsxs)("div",{className:"absolute top-full right-0 mt-2 w-80 bg-surface border border-border rounded-xl shadow-2xl z-50 overflow-hidden",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between px-4 py-3 border-b border-border bg-bg",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[16px]",style:{color:g?"#22c55e":"#f59e0b"},children:g?"verified":"warning"}),(0,a.jsx)("span",{className:"text-sm font-semibold text-text-main",children:"Model Status"})]}),(0,a.jsx)("button",{type:"button",onClick:u,className:"p-1 rounded-lg hover:bg-surface text-text-muted hover:text-text-main transition-colors",title:"Refresh",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"refresh"})})]}),(0,a.jsx)("div",{className:"px-4 py-3 max-h-60 overflow-y-auto",children:g?(0,a.jsx)("p",{className:"text-sm text-text-muted text-center py-2",children:"All models are responding normally."}):(0,a.jsx)("div",{className:"flex flex-col gap-2.5",children:Object.entries(y).map(([e,t])=>(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"text-xs font-semibold text-text-main mb-1.5 capitalize",children:e}),(0,a.jsx)("div",{className:"flex flex-col gap-1",children:t.map(e=>{let t=h[e.status]||h.unknown,s=c===`${e.provider}:${e.model}`;return(0,a.jsxs)("div",{className:"flex items-center justify-between px-2.5 py-1.5 rounded-lg bg-surface/30",children:[(0,a.jsxs)("div",{className:"flex items-center gap-1.5 min-w-0",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px] shrink-0",style:{color:t.color},children:t.icon}),(0,a.jsx)("span",{className:"font-mono text-xs text-text-main truncate",children:e.model})]}),"cooldown"===e.status&&(0,a.jsx)(l.Button,{size:"sm",variant:"ghost",onClick:()=>f(e.provider,e.model),disabled:s,className:"text-[10px] px-1.5! py-0.5! ml-2",children:s?"...":"Clear"})]},`${e.provider}-${e.model}`)})})]},e))})})]})})}let b={openai:{title:"Add OpenAI Compatible",type:"openai-compatible",defaultBaseUrl:"https://api.openai.com/v1",namePlaceholder:"OpenAI Compatible (Prod)",prefixPlaceholder:"oc-prod",baseUrlHint:"Use the base URL (ending in /v1) for your OpenAI-compatible API.",modelIdPlaceholder:"e.g. gpt-4, claude-3-opus",errorLabel:"OpenAI Compatible",hasApiType:!0},anthropic:{title:"Add Anthropic Compatible",type:"anthropic-compatible",defaultBaseUrl:"https://api.anthropic.com/v1",namePlaceholder:"Anthropic Compatible (Prod)",prefixPlaceholder:"ac-prod",baseUrlHint:"Use the base URL (ending in /v1) for your Anthropic-compatible API. The system will append /messages.",modelIdPlaceholder:"e.g. claude-3-opus",errorLabel:"Anthropic Compatible",hasApiType:!1}},g=[{value:"chat",label:"Chat Completions"},{value:"responses",label:"Responses API"}],y=function({variant:e,isOpen:t,onClose:s,onCreated:i}){let n=b[e],o=()=>({name:"",prefix:"",...n.hasApiType?{apiType:"chat"}:{},baseUrl:n.defaultBaseUrl}),[c,d]=(0,r.useState)(o),[m,p]=(0,r.useState)(!1),[x,u]=(0,r.useState)(""),[h,f]=(0,r.useState)(""),[y,v]=(0,r.useState)(!1),[j,N]=(0,r.useState)(null);(0,r.useEffect)(()=>{n.hasApiType?d(e=>({...e,baseUrl:n.defaultBaseUrl})):t&&(N(null),u(""),f(""))},[n.hasApiType?c.apiType:t]);let w=async()=>{if(c.name.trim()&&c.prefix.trim()&&c.baseUrl.trim()){p(!0);try{let e=await fetch("/api/provider-nodes",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:c.name,prefix:c.prefix,...n.hasApiType?{apiType:c.apiType}:{},baseUrl:c.baseUrl,type:n.type})}),t=await e.json();e.ok&&(i(t.node),d(o()),u(""),N(null))}catch(e){console.log(`Error creating ${n.errorLabel} node:`,e)}finally{p(!1)}}},k=async()=>{v(!0);try{let e=await fetch("/api/provider-nodes/validate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({baseUrl:c.baseUrl,apiKey:x,type:n.type,modelId:h.trim()||void 0})}),t=await e.json();N(t)}catch{N({valid:!1,error:"Network error"})}finally{v(!1)}};return(0,a.jsx)(l.Modal,{isOpen:t,title:n.title,onClose:s,children:(0,a.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,a.jsx)(l.Input,{label:"Name",value:c.name,onChange:e=>d({...c,name:e.target.value}),placeholder:n.namePlaceholder,hint:"Required. A friendly label for this node."}),(0,a.jsx)(l.Input,{label:"Prefix",value:c.prefix,onChange:e=>d({...c,prefix:e.target.value}),placeholder:n.prefixPlaceholder,hint:"Required. Used as the provider prefix for model IDs."}),n.hasApiType&&(0,a.jsx)(l.Select,{label:"API Type",options:g,value:c.apiType,onChange:e=>d({...c,apiType:e.target.value})}),(0,a.jsx)(l.Input,{label:"Base URL",value:c.baseUrl,onChange:e=>d({...c,baseUrl:e.target.value}),placeholder:n.defaultBaseUrl,hint:n.baseUrlHint}),(0,a.jsx)(l.Input,{label:"API Key (for Check)",type:"password",value:x,onChange:e=>u(e.target.value)}),(0,a.jsx)(l.Input,{label:"Model ID (optional)",value:h,onChange:e=>f(e.target.value),placeholder:n.modelIdPlaceholder,hint:"If provider lacks /models endpoint, enter a model ID to validate via chat/completions instead."}),(0,a.jsxs)("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center",children:[(0,a.jsx)(l.Button,{onClick:k,disabled:!x||y||!c.baseUrl.trim(),variant:"secondary",className:"w-full sm:w-auto",children:y?"Checking...":"Check"}),(()=>{if(!j)return null;let{valid:e,error:t,method:s}=j;return e?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(l.Badge,{variant:"success",children:"Valid"}),"chat"===s&&(0,a.jsx)("span",{className:"text-sm text-text-muted",children:"(via inference test)"})]}):(0,a.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,a.jsx)(l.Badge,{variant:"error",children:"Invalid"}),t&&(0,a.jsx)("span",{className:"text-sm text-red-500",children:t})]})})()]}),(0,a.jsxs)("div",{className:"flex flex-col gap-2 sm:flex-row",children:[(0,a.jsx)(l.Button,{onClick:w,fullWidth:!0,disabled:!c.name.trim()||!c.prefix.trim()||!c.baseUrl.trim()||m,children:m?"Creating...":"Create"}),(0,a.jsx)(l.Button,{onClick:s,variant:"ghost",fullWidth:!0,children:"Cancel"})]})]})})};function v({status:e,onReset:t}){if(!e||"CLOSED"===e.state)return null;let s={DEGRADED:{color:"bg-amber-100 text-amber-700 dark:bg-amber-900/30 dark:text-amber-400",icon:"warning",label:"Degraded"},OPEN:{color:"bg-red-100 text-red-700 dark:bg-red-900/30 dark:text-red-400",icon:"power",label:"Circuit Open"},HALF_OPEN:{color:"bg-blue-100 text-blue-700 dark:bg-blue-900/30 dark:text-blue-400",icon:"autorenew",label:"Recovering"}},r=s[e.state]||s.DEGRADED,l=e.retryAfterMs>0?` (${Math.ceil(e.retryAfterMs/1e3)}s)`:"";return(0,a.jsxs)("span",{className:`inline-flex items-center gap-1 rounded-full px-2 py-0.5 text-[10px] font-medium ${r.color}`,children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[12px]",children:r.icon}),r.label,l,"OPEN"===e.state&&t&&(0,a.jsx)("button",{onClick:e=>{e.preventDefault(),e.stopPropagation(),t()},className:"ml-0.5 hover:opacity-70 transition-opacity",title:"Reset circuit breaker",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[12px]",children:"refresh"})})]})}var j=s(21863);function N(e){let{connected:t,unavailable:s}=e,r=[];return(t>0&&r.push((0,a.jsxs)(l.Badge,{variant:"success",size:"sm",dot:!0,children:[t," Connected"]},"connected")),s>0&&r.push((0,a.jsxs)(l.Badge,{variant:"warning",size:"sm",dot:!0,children:[s," Unavailable"]},"unavailable")),0===r.length)?(0,a.jsx)("span",{className:"text-text-muted",children:"No connections"}):r}function w(){let e,t,[s,i]=(0,r.useState)([]),[n,m]=(0,r.useState)([]),[p,h]=(0,r.useState)(!0),[b,g]=(0,r.useState)(!1),[v,N]=(0,r.useState)(!1),[w,T]=(0,r.useState)(!1),[I,P]=(0,r.useState)(null),[O,S]=(0,r.useState)(null),U=(0,x.i)(),$=(0,u.C)(e=>e.query),B=(0,u.C)(e=>e.register),E=(0,u.C)(e=>e.unregister),{getCircuitBreakerForProvider:R,resetCircuitBreaker:z}=function(){let[e,t]=(0,r.useState)([]),[s,a]=(0,r.useState)(!0),l=(0,r.useCallback)(async()=>{try{let e=await fetch("/api/providers/circuit-breakers"),s=await e.json();t(s.statuses||[])}catch(e){console.error("Failed to fetch circuit breakers:",e)}finally{a(!1)}},[]);return(0,r.useEffect)(()=>{let e=!1,s=async()=>{try{let s=await fetch("/api/providers/circuit-breakers"),a=await s.json();e||t(a.statuses||[])}catch(t){e||console.error("Failed to fetch circuit breakers:",t)}finally{e||a(!1)}};s();let r=setInterval(s,5e3);return()=>{e=!0,clearInterval(r)}},[]),{statuses:e,loading:s,getCircuitBreakerForProvider:t=>e.find(e=>e.name===t),resetCircuitBreaker:async e=>{try{return await fetch(`/api/providers/circuit-breakers/${encodeURIComponent(e)}/reset`,{method:"POST"}),await l(),!0}catch(e){return console.error("Failed to reset circuit breaker:",e),!1}},refresh:l}}();(0,r.useEffect)(()=>(B("Search providers..."),()=>E()),[B,E]);let D=e=>!$.trim()||e.toLowerCase().includes($.trim().toLowerCase());(0,r.useEffect)(()=>{(async()=>{try{let[e,t]=await Promise.all([fetch("/api/providers",{cache:"no-store"}),fetch("/api/provider-nodes",{cache:"no-store"})]),s=await e.json(),a=await t.json();e.ok&&i(s.connections||[]),t.ok&&m(a.nodes||[])}catch(e){console.log("Error fetching data:",e)}finally{h(!1)}})()},[]);let _=(e,t)=>{let a=Array.isArray(t)?t:[t],r=s.filter(t=>t.provider===e&&a.includes(t.authType)),l=r.filter(e=>"active"===(0,j.d)(e)).length,i=r.length-l,n=r.length,o=n>0&&r.every(e=>!1===e.isActive);return{connected:l,unavailable:i,total:n,allDisabled:o}},F=async(e,t,a)=>{let r=Array.isArray(t)?t:[t],l=t=>t.provider===e&&r.includes(t.authType),n=s.filter(l);i(e=>e.map(e=>l(e)?{...e,isActive:a}:e)),await Promise.allSettled(n.map(e=>fetch(`/api/providers/${e.id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({isActive:a})})))},M=async(e,t=null)=>{if(!I){P("provider"===e?t:e),S(null);try{let s=await fetch("/api/providers/test-batch",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({mode:e,providerId:t})}),a=await s.json();if(S(a),a.summary){let{passed:e,failed:t,total:s}=a.summary;0===t?U.success(`All ${s} tests passed`):U.warning(`${e}/${s} passed, ${t} failed`)}}catch(e){S({error:"Test request failed"}),U.error("Provider test failed")}finally{P(null)}}},L=n.filter(e=>"openai-compatible"===e.type).map(e=>({id:e.id,name:e.name||"OpenAI Compatible",color:"#10A37F",textIcon:"OC",apiType:e.apiType})).filter(e=>D(e.name)),K=n.filter(e=>"anthropic-compatible"===e.type).map(e=>({id:e.id,name:e.name||"Anthropic Compatible",color:"#D97757",textIcon:"AC"})).filter(e=>D(e.name)),J=(e=Object.entries(c.zN).filter(([,e])=>!e.hidden&&D(e.name)),t="oauth",[...e].sort(([e,s],[a,r])=>{let l=s.priority??999,i=r.priority??999;if(l!==i)return l-i;let n=_(e,t),o=_(a,t),c=+(n.connected>0),d=+(o.connected>0);return c!==d?d-c:(s.name||"").localeCompare(r.name||"")})),H=Object.entries(d.IS).filter(([,e])=>!e.hidden&&D(e.name)).sort(([,e],[,t])=>!!t.noAuth-!!e.noAuth),W=Object.entries(d.nJ).filter(([,e])=>!e.hidden&&D(e.name)&&(e.serviceKinds??["llm"]).includes("llm")).sort(([e,t],[s,a])=>{let r=t.priority??999,l=a.priority??999;if(r!==l)return r-l;let i=!!a.noAuth-!!t.noAuth;if(0!==i)return i;let n=_(e,o(t,e)).connected>0?0:1,c=_(s,o(a,s)).connected>0?0:1;return n!==c?n-c:(t.name||"").localeCompare(a.name||"")}),q=Object.entries(c.fg).filter(([,e])=>!e.hidden&&(e.serviceKinds??["llm"]).includes("llm")&&D(e.name)).sort(([e,t],[s,a])=>{let r=_(e,"apikey").total>0?0:1,l=_(s,"apikey").total>0?0:1;return r!==l?r-l:(t.name||"").localeCompare(a.name||"")}),G=Object.entries(d.br).filter(([,e])=>!e.hidden&&D(e.name)).sort(([e,t],[s,a])=>{let r=_(e,"cookie").total>0?0:1,l=_(s,"cookie").total>0?0:1;return r!==l?r-l:(t.name||"").localeCompare(a.name||"")}),V=!!$.trim(),Y=V||b?q:q.slice(0,20),Q=q.length-20;if(p)return(0,a.jsxs)("div",{className:"flex flex-col gap-8",children:[(0,a.jsx)(l.CardSkeleton,{}),(0,a.jsx)(l.CardSkeleton,{})]});let X=J.length>0||H.length>0||W.length>0||q.length>0||G.length>0||L.length>0||K.length>0;return(0,a.jsxs)("div",{className:"flex min-w-0 flex-col gap-6 px-1 sm:px-0",children:[!X&&(0,a.jsxs)("div",{className:"text-center py-8 border border-dashed border-border rounded-xl",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[32px] text-text-muted mb-2",children:"search_off"}),(0,a.jsx)("p",{className:"text-text-muted text-sm",children:"No providers match your search"})]}),(0,a.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,a.jsxs)("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[(0,a.jsxs)("h2",{className:"text-lg sm:text-xl font-semibold flex items-center gap-2 leading-tight",children:["Custom Providers (OpenAI/Anthropic Compatible)"," "]}),(0,a.jsxs)("div",{className:"grid grid-cols-1 gap-2 sm:flex sm:w-auto",children:[(0,a.jsx)(l.Button,{size:"sm",icon:"add",onClick:()=>T(!0),className:"w-full sm:w-auto",children:"Add Anthropic Compatible"}),(0,a.jsx)(l.Button,{size:"sm",variant:"secondary",icon:"add",onClick:()=>N(!0),className:"w-full !bg-white !text-black hover:!bg-gray-100 sm:w-auto",children:"Add OpenAI Compatible"})]})]}),0===L.length&&0===K.length?(0,a.jsxs)("div",{className:"flex items-center justify-center gap-2 py-2 border border-dashed border-border rounded-xl text-text-muted text-sm",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"extension"}),(0,a.jsx)("span",{children:"No custom providers — use buttons above to add OpenAI/Anthropic compatible endpoints"})]}):(0,a.jsx)("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-2 sm:gap-4 lg:grid-cols-3 xl:grid-cols-4",children:[...L,...K].map(e=>(0,a.jsx)(C,{providerId:e.id,provider:e,stats:_(e.id,"apikey"),authType:"compatible",circuitBreaker:R(e.id),onResetCircuit:z,onToggle:t=>F(e.id,"apikey",t)},e.id))})]}),J.length>0&&(0,a.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,a.jsxs)("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[(0,a.jsx)("h2",{className:"text-lg sm:text-xl font-semibold flex items-center gap-2 leading-tight",children:"OAuth Providers"}),(0,a.jsxs)("div",{className:"flex w-full flex-col gap-2 sm:w-auto sm:flex-row sm:items-center",children:[(0,a.jsx)(f,{}),(0,a.jsxs)("button",{onClick:()=>M("oauth"),disabled:!!I,className:`flex w-full items-center justify-center gap-1.5 rounded-lg border px-3 py-2 text-xs font-medium transition-colors sm:w-auto sm:py-1.5 ${"oauth"===I?"bg-primary/20 border-primary/40 text-primary animate-pulse":"bg-bg border-border text-text-muted hover:text-text-main hover:border-primary/40"}`,title:"Test all OAuth connections","aria-label":"Test all OAuth connections",children:[(0,a.jsx)("span",{className:`material-symbols-outlined text-[14px]${"oauth"===I?" animate-spin":""}`,children:"play_arrow"}),"oauth"===I?"Testing...":"Test All"]})]})]}),(0,a.jsx)("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-2 sm:gap-4 lg:grid-cols-3 xl:grid-cols-4",children:J.map(([e,t])=>(0,a.jsx)(k,{providerId:e,provider:t,stats:_(e,"oauth"),authType:"oauth",circuitBreaker:R(e),onResetCircuit:z,onToggle:t=>F(e,"oauth",t)},e))})]}),(H.length>0||W.length>0)&&(0,a.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,a.jsxs)("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[(0,a.jsx)("h2",{className:"text-lg sm:text-xl font-semibold flex items-center gap-2 leading-tight",children:"Free Tier Providers"}),(0,a.jsxs)("button",{onClick:()=>M("free"),disabled:!!I,className:`flex w-full items-center justify-center gap-1.5 rounded-lg border px-3 py-2 text-xs font-medium transition-colors sm:w-auto sm:py-1.5 ${"free"===I?"bg-primary/20 border-primary/40 text-primary animate-pulse":"bg-bg border-border text-text-muted hover:text-text-main hover:border-primary/40"}`,title:"Test all Free connections","aria-label":"Test all Free provider connections",children:[(0,a.jsx)("span",{className:`material-symbols-outlined text-[14px]${"free"===I?" animate-spin":""}`,children:"play_arrow"}),"free"===I?"Testing...":"Test All"]})]}),(0,a.jsxs)("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-2 sm:gap-4 lg:grid-cols-3 xl:grid-cols-4",children:[H.map(([e,t])=>{let s="kiro"===e?["oauth","apikey","api_key"]:"oauth";return(0,a.jsx)(k,{providerId:e,provider:t,stats:_(e,s),authType:"free",circuitBreaker:R(e),onResetCircuit:z,onToggle:t=>F(e,s,t)},e)}),W.map(([e,t])=>{let s=o(t,e);return(0,a.jsx)(C,{providerId:e,provider:t,stats:_(e,s),authType:Array.isArray(s)?s[0]??"apikey":s,onToggle:t=>F(e,s,t)},e)})]})]}),q.length>0&&(0,a.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,a.jsxs)("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[(0,a.jsxs)("h2",{className:"text-lg sm:text-xl font-semibold flex items-center gap-2 leading-tight",children:["API Key Providers"," "]}),(0,a.jsxs)("button",{onClick:()=>M("apikey"),disabled:!!I,className:`flex w-full items-center justify-center gap-1.5 rounded-lg border px-3 py-2 text-xs font-medium transition-colors sm:w-auto sm:py-1.5 ${"apikey"===I?"bg-primary/20 border-primary/40 text-primary animate-pulse":"bg-bg border-border text-text-muted hover:text-text-main hover:border-primary/40"}`,title:"Test all API Key connections","aria-label":"Test all API Key connections",children:[(0,a.jsx)("span",{className:`material-symbols-outlined text-[14px]${"apikey"===I?" animate-spin":""}`,children:"play_arrow"}),"apikey"===I?"Testing...":"Test All"]})]}),(0,a.jsx)("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-2 sm:gap-4 lg:grid-cols-3 xl:grid-cols-4",children:Y.map(([e,t])=>(0,a.jsx)(C,{providerId:e,provider:t,stats:_(e,"apikey"),authType:"apikey",onToggle:t=>F(e,"apikey",t)},e))}),!V&&!b&&Q>0&&(0,a.jsxs)("button",{onClick:()=>g(!0),className:"flex w-full items-center justify-center gap-1.5 rounded-lg border border-dashed border-primary/40 px-3 py-2.5 text-sm font-medium text-primary transition-colors hover:border-primary hover:bg-primary/5",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"expand_more"}),"Show all ",q.length," providers"]})]}),G.length>0&&(0,a.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,a.jsx)("div",{className:"flex items-center justify-between",children:(0,a.jsxs)("h2",{className:"text-lg sm:text-xl font-semibold flex items-center gap-2 leading-tight",children:["Web Cookie Providers"," "]})}),(0,a.jsx)("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-4",children:G.map(([e,t])=>(0,a.jsx)(C,{providerId:e,provider:t,stats:_(e,"cookie"),authType:"cookie",onToggle:t=>F(e,"cookie",t)},e))})]}),(0,a.jsx)(y,{variant:"openai",isOpen:v,onClose:()=>N(!1),onCreated:e=>{m(t=>[...t,e]),N(!1)}}),(0,a.jsx)(y,{variant:"anthropic",isOpen:w,onClose:()=>T(!1),onCreated:e=>{m(t=>[...t,e]),T(!1)}}),O&&(0,a.jsxs)("div",{className:"fixed inset-0 z-50 flex items-start justify-center px-3 pt-[6vh] sm:pt-[10vh]",onClick:()=>S(null),children:[(0,a.jsx)("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm"}),(0,a.jsxs)("div",{className:"relative bg-surface border border-border rounded-xl w-full max-w-[600px] max-h-[86vh] sm:max-h-[80vh] overflow-y-auto shadow-2xl",onClick:e=>e.stopPropagation(),children:[(0,a.jsxs)("div",{className:"sticky top-0 z-10 flex items-center justify-between px-5 py-3 border-b border-border bg-surface/95 backdrop-blur-sm rounded-t-xl",children:[(0,a.jsx)("h3",{className:"font-semibold",children:"Test Results"}),(0,a.jsx)("button",{onClick:()=>S(null),className:"p-1 rounded-lg hover:bg-bg text-text-muted hover:text-text-main transition-colors","aria-label":"Close test results",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-lg",children:"close"})})]}),(0,a.jsx)("div",{className:"p-5",children:(0,a.jsx)(A,{results:O})})]})]})]})}function k({providerId:e,provider:t,stats:s,authType:r,onToggle:n,circuitBreaker:o,onResetCircuit:c}){let{allDisabled:d}=s,m=!!t.noAuth;return(0,a.jsx)(p(),{href:`/dashboard/providers/${e}`,className:"group min-w-0",children:(0,a.jsx)(l.Card,{padding:"xs",className:`h-full hover:bg-black/[0.01] dark:hover:bg-white/[0.01] transition-colors cursor-pointer ${d?"opacity-50":""}`,children:(0,a.jsxs)("div",{className:"flex min-w-0 items-center justify-between gap-3",children:[(0,a.jsxs)("div",{className:"flex min-w-0 items-center gap-3",children:[(0,a.jsx)("div",{className:"size-8 shrink-0 rounded-lg flex items-center justify-center",style:{backgroundColor:`${t.color?.length>7?t.color:t.color+"15"}`},children:(0,a.jsx)(i.A,{src:`/providers/${t.id}.webp`,alt:t.name,size:30,className:"object-contain rounded-lg max-w-[32px] max-h-[32px]",fallbackText:t.textIcon||t.id.slice(0,2).toUpperCase(),fallbackColor:t.color})}),(0,a.jsxs)("div",{className:"min-w-0",children:[(0,a.jsx)("h3",{className:"truncate font-semibold",children:t.name}),(0,a.jsx)("div",{className:"flex min-w-0 items-center gap-1.5 text-xs flex-wrap",children:d?(0,a.jsx)(l.Badge,{variant:"default",size:"sm",children:(0,a.jsxs)("span",{className:"flex items-center gap-1",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[12px]",children:"pause_circle"}),"Disabled"]})}):m?(0,a.jsx)(l.Badge,{variant:"success",size:"sm",dot:!0,children:"Ready"}):(0,a.jsxs)(a.Fragment,{children:[N(s),o&&(0,a.jsx)(v,{status:o,onReset:()=>c(e)})]})})]})]}),(0,a.jsx)("div",{className:"flex shrink-0 items-center gap-2",children:s.total>0&&(0,a.jsx)("div",{className:"opacity-100 transition-opacity sm:opacity-0 sm:group-hover:opacity-100",onClick:e=>{e.preventDefault(),e.stopPropagation(),n(!!d)},children:(0,a.jsx)(l.Toggle,{size:"sm",checked:!d,onChange:()=>{},title:d?"Enable provider":"Disable provider"})})})]})})})}function C({providerId:e,provider:t,stats:s,authType:r,onToggle:o,circuitBreaker:c,onResetCircuit:m}){let{allDisabled:x}=s,u=e.startsWith(d.JH),h=e.startsWith(d.DI);return(0,a.jsx)(p(),{href:`/dashboard/providers/${e}`,className:"group min-w-0",children:(0,a.jsx)(l.Card,{padding:"xs",className:`h-full hover:bg-black/[0.01] dark:hover:bg-white/[0.01] transition-colors cursor-pointer ${x?"opacity-50":""}`,children:(0,a.jsxs)("div",{className:"flex min-w-0 items-center justify-between gap-3",children:[(0,a.jsxs)("div",{className:"flex min-w-0 items-center gap-3",children:[(0,a.jsx)("div",{className:"size-8 shrink-0 rounded-lg flex items-center justify-center",style:{backgroundColor:`${t.color?.length>7?t.color:t.color+"15"}`},children:(0,a.jsx)(i.A,{src:u&&t.apiType?"responses"===t.apiType?"/providers/oai-r.webp":"/providers/oai-cc.webp":h?"/providers/anthropic-m.webp":(0,n.HY)(t.id),alt:t.name,size:30,className:"object-contain rounded-lg max-w-[30px] max-h-[30px]",fallbackText:t.textIcon||t.id.slice(0,2).toUpperCase(),fallbackColor:t.color})}),(0,a.jsxs)("div",{className:"min-w-0",children:[(0,a.jsx)("h3",{className:"truncate font-semibold",children:t.name}),(0,a.jsx)("div",{className:"flex min-w-0 items-center gap-1.5 text-xs flex-wrap",children:x?(0,a.jsx)(l.Badge,{variant:"default",size:"sm",children:(0,a.jsxs)("span",{className:"flex items-center gap-1",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[12px]",children:"pause_circle"}),"Disabled"]})}):(0,a.jsxs)(a.Fragment,{children:[N(s),u&&(0,a.jsx)(l.Badge,{variant:"default",size:"sm",children:"responses"===t.apiType?"Responses":"Chat"}),h&&(0,a.jsx)(l.Badge,{variant:"default",size:"sm",children:"Messages"})]})})]})]}),(0,a.jsx)("div",{className:"flex shrink-0 items-center gap-2",children:s.total>0&&(0,a.jsx)("div",{className:"opacity-100 transition-opacity sm:opacity-0 sm:group-hover:opacity-100",onClick:e=>{e.preventDefault(),e.stopPropagation(),o(!!x)},children:(0,a.jsx)(l.Toggle,{size:"sm",checked:!x,onChange:()=>{},title:x?"Enable provider":"Disable provider"})})})]})})})}function A({results:e}){if(e.error&&!e.results)return(0,a.jsxs)("div",{className:"text-center py-6",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-red-500 text-[32px] mb-2 block",children:"error"}),(0,a.jsx)("p",{className:"text-sm text-red-400",children:e.error})]});let{summary:t,mode:s}=e,r=e.results||[];return(0,a.jsxs)("div",{className:"flex min-w-0 flex-col gap-3",children:[t&&(0,a.jsxs)("div",{className:"flex flex-wrap items-center gap-2 text-xs mb-1 sm:gap-3",children:[(0,a.jsxs)("span",{className:"text-text-muted",children:[{oauth:"OAuth",free:"Free",apikey:"API Key",provider:"Provider",all:"All"}[s]||s," Test"]}),(0,a.jsxs)("span",{className:"px-2 py-0.5 rounded bg-emerald-500/15 text-emerald-400 font-medium",children:[t.passed," passed"]}),t.failed>0&&(0,a.jsxs)("span",{className:"px-2 py-0.5 rounded bg-red-500/15 text-red-400 font-medium",children:[t.failed," failed"]}),(0,a.jsxs)("span",{className:"text-text-muted sm:ml-auto",children:[t.total," tested"]})]}),r.map((e,t)=>(0,a.jsxs)("div",{className:"flex min-w-0 flex-wrap items-center gap-2 rounded-lg bg-black/[0.03] px-3 py-2 text-xs dark:bg-white/[0.03] sm:flex-nowrap",children:[(0,a.jsx)("span",{className:`material-symbols-outlined text-[16px] ${e.valid?"text-emerald-500":"text-red-500"}`,children:e.valid?"check_circle":"error"}),(0,a.jsxs)("div",{className:"min-w-0 flex-[1_1_160px]",children:[(0,a.jsx)("span",{className:"block truncate font-medium sm:inline",children:e.connectionName}),(0,a.jsxs)("span",{className:"block truncate text-text-muted sm:ml-1.5 sm:inline",children:["(",e.provider,")"]})]}),void 0!==e.latencyMs&&(0,a.jsxs)("span",{className:"shrink-0 text-text-muted font-mono tabular-nums",children:[e.latencyMs,"ms"]}),(0,a.jsx)("span",{className:`shrink-0 text-[10px] uppercase font-bold px-1.5 py-0.5 rounded ${e.valid?"bg-emerald-500/15 text-emerald-400":"bg-red-500/15 text-red-400"}`,children:e.valid?"OK":e.diagnosis?.type||"ERROR"})]},e.connectionId||t)),0===r.length&&(0,a.jsx)("div",{className:"text-center py-4 text-text-muted text-sm",children:"No active connections found for this group."})]})}},21863:(e,t,s)=>{"use strict";function a(e,t){return!1===e?"default":"active"===t||"success"===t?"success":"error"===t||"expired"===t||"unavailable"===t?"error":"default"}function r(e){let t=e?.testStatus;return e?.isActive===!1||"unavailable"===t||"error"===t||"expired"===t?"unavailable":"active"}s.d(t,{d:()=>r,g:()=>a})},48271:(e,t,s)=>{"use strict";s.d(t,{gm:()=>r});let a=new Map;function r(e,t={}){a.delete(JSON.stringify([String(e),t?.method||"GET",t?.headers||{},t?.body||null]))}},77048:(e,t,s)=>{Promise.resolve().then(s.bind(s,21511))}},e=>{e.O(0,[3885,2318,4385,2940,2147,3204,7358],()=>e(e.s=77048)),_N_E=e.O()}]);
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# `react`
|
|
2
|
+
|
|
3
|
+
React is a JavaScript library for creating user interfaces.
|
|
4
|
+
|
|
5
|
+
The `react` package contains only the functionality necessary to define React components. It is typically used together with a React renderer like `react-dom` for the web, or `react-native` for the native environments.
|
|
6
|
+
|
|
7
|
+
**Note:** by default, React will be in development mode. The development version includes extra warnings about common mistakes, whereas the production version includes extra performance optimizations and strips all error messages. Don't forget to use the [production build](https://reactjs.org/docs/optimizing-performance.html#use-the-production-build) when deploying your application.
|
|
8
|
+
|
|
9
|
+
## Usage
|
|
10
|
+
|
|
11
|
+
```js
|
|
12
|
+
import { useState } from 'react';
|
|
13
|
+
import { createRoot } from 'react-dom/client';
|
|
14
|
+
|
|
15
|
+
function Counter() {
|
|
16
|
+
const [count, setCount] = useState(0);
|
|
17
|
+
return (
|
|
18
|
+
<>
|
|
19
|
+
<h1>{count}</h1>
|
|
20
|
+
<button onClick={() => setCount(count + 1)}>
|
|
21
|
+
Increment
|
|
22
|
+
</button>
|
|
23
|
+
</>
|
|
24
|
+
);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
const root = createRoot(document.getElementById('root'));
|
|
28
|
+
root.render(<Counter />);
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## Documentation
|
|
32
|
+
|
|
33
|
+
See https://react.dev/
|
|
34
|
+
|
|
35
|
+
## API
|
|
36
|
+
|
|
37
|
+
See https://react.dev/reference/react
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license React
|
|
3
|
+
* react-compiler-runtime.development.js
|
|
4
|
+
*
|
|
5
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
6
|
+
*
|
|
7
|
+
* This source code is licensed under the MIT license found in the
|
|
8
|
+
* LICENSE file in the root directory of this source tree.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
"use strict";
|
|
12
|
+
"production" !== process.env.NODE_ENV &&
|
|
13
|
+
(function () {
|
|
14
|
+
var ReactSharedInternals =
|
|
15
|
+
require("react").__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;
|
|
16
|
+
exports.c = function (size) {
|
|
17
|
+
var dispatcher = ReactSharedInternals.H;
|
|
18
|
+
null === dispatcher &&
|
|
19
|
+
console.error(
|
|
20
|
+
"Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:\n1. You might have mismatching versions of React and the renderer (such as React DOM)\n2. You might be breaking the Rules of Hooks\n3. You might have more than one copy of React in the same app\nSee https://react.dev/link/invalid-hook-call for tips about how to debug and fix this problem."
|
|
21
|
+
);
|
|
22
|
+
return dispatcher.useMemoCache(size);
|
|
23
|
+
};
|
|
24
|
+
})();
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license React
|
|
3
|
+
* react-compiler-runtime.production.js
|
|
4
|
+
*
|
|
5
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
6
|
+
*
|
|
7
|
+
* This source code is licensed under the MIT license found in the
|
|
8
|
+
* LICENSE file in the root directory of this source tree.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
"use strict";
|
|
12
|
+
var ReactSharedInternals =
|
|
13
|
+
require("react").__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;
|
|
14
|
+
exports.c = function (size) {
|
|
15
|
+
return ReactSharedInternals.H.useMemoCache(size);
|
|
16
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license React
|
|
3
|
+
* react-compiler-runtime.profiling.js
|
|
4
|
+
*
|
|
5
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
6
|
+
*
|
|
7
|
+
* This source code is licensed under the MIT license found in the
|
|
8
|
+
* LICENSE file in the root directory of this source tree.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
"use strict";
|
|
12
|
+
var ReactSharedInternals =
|
|
13
|
+
require("react").__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;
|
|
14
|
+
exports.c = function (size) {
|
|
15
|
+
return ReactSharedInternals.H.useMemoCache(size);
|
|
16
|
+
};
|