zevairouter 1.1.78 → 1.1.80
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +13 -0
- package/cli/app/.next-cli-build/BUILD_ID +1 -1
- package/cli/app/.next-cli-build/app-path-routes-manifest.json +24 -24
- package/cli/app/.next-cli-build/build-manifest.json +2 -2
- package/cli/app/.next-cli-build/prerender-manifest.json +3 -3
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/automation/page_client-reference-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/basic-chat/page_client-reference-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/[toolId]/page_client-reference-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/page_client-reference-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/combos/page_client-reference-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/console-log/page_client-reference-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/context/page_client-reference-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/endpoint/page_client-reference-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/[kind]/[id]/page_client-reference-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/[kind]/page_client-reference-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/combo/[id]/page_client-reference-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/web/page_client-reference-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/mitm/page_client-reference-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/page_client-reference-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/playground/page_client-reference-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/profile/page_client-reference-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/[id]/page.js +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/[id]/page_client-reference-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/new/page_client-reference-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/page_client-reference-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/proxy-pools/page_client-reference-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/pxpipe/page_client-reference-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/quota/page_client-reference-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/settings/pricing/page_client-reference-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/skills/page_client-reference-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/terminal/page_client-reference-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/token-saver/page_client-reference-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/translator/page_client-reference-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/usage/page_client-reference-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/app/_global-error/page_client-reference-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/app/_global-error.html +1 -1
- package/cli/app/.next-cli-build/server/app/_global-error.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/app/_not-found.html +1 -1
- package/cli/app/.next-cli-build/server/app/_not-found.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/_not-found.segments/_full.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/_not-found.segments/_tree.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/api/cli-tools/all-statuses/route.js +5 -5
- package/cli/app/.next-cli-build/server/app/api/cli-tools/antigravity-mitm/alias/route.js +2 -2
- package/cli/app/.next-cli-build/server/app/api/cli-tools/claude-settings/route.js +2 -2
- package/cli/app/.next-cli-build/server/app/api/cli-tools/cline-settings/route.js +2 -2
- package/cli/app/.next-cli-build/server/app/api/cli-tools/codewhale-settings/route.js +2 -2
- package/cli/app/.next-cli-build/server/app/api/cli-tools/codex-settings/route.js +1 -1
- package/cli/app/.next-cli-build/server/app/api/cli-tools/copilot-settings/route.js +2 -2
- package/cli/app/.next-cli-build/server/app/api/cli-tools/cowork-mcp-registry/route.js +1 -1
- package/cli/app/.next-cli-build/server/app/api/cli-tools/cowork-mcp-tools/route.js +1 -1
- package/cli/app/.next-cli-build/server/app/api/cli-tools/cowork-settings/route.js +1 -1
- package/cli/app/.next-cli-build/server/app/api/cli-tools/crush-settings/route.js +2 -2
- package/cli/app/.next-cli-build/server/app/api/cli-tools/deepseek-tui-settings/route.js +3 -3
- package/cli/app/.next-cli-build/server/app/api/cli-tools/devin-settings/route.js +2 -2
- package/cli/app/.next-cli-build/server/app/api/cli-tools/droid-settings/route.js +2 -2
- package/cli/app/.next-cli-build/server/app/api/cli-tools/dsh-settings/route.js +1 -1
- package/cli/app/.next-cli-build/server/app/api/cli-tools/forge-settings/route.js +2 -2
- package/cli/app/.next-cli-build/server/app/api/cli-tools/grok-build-settings/route.js +1 -1
- package/cli/app/.next-cli-build/server/app/api/cli-tools/hermes-settings/route.js +2 -2
- package/cli/app/.next-cli-build/server/app/api/cli-tools/jcode-settings/route.js +2 -2
- package/cli/app/.next-cli-build/server/app/api/cli-tools/kilo-settings/route.js +2 -2
- package/cli/app/.next-cli-build/server/app/api/cli-tools/omp-settings/route.js +2 -2
- package/cli/app/.next-cli-build/server/app/api/cli-tools/openbot-settings/route.js +3 -3
- package/cli/app/.next-cli-build/server/app/api/cli-tools/openclaw-settings/route.js +1 -1
- package/cli/app/.next-cli-build/server/app/api/cli-tools/opencode-settings/route.js +1 -1
- package/cli/app/.next-cli-build/server/app/api/cli-tools/pi-settings/route.js +2 -2
- package/cli/app/.next-cli-build/server/app/api/cli-tools/smelt-settings/route.js +2 -2
- package/cli/app/.next-cli-build/server/app/api/models/route.js +1 -1
- package/cli/app/.next-cli-build/server/app/api/providers/opencode/discover-models/route.js +1 -1
- package/cli/app/.next-cli-build/server/app/api/providers/route.js +1 -1
- package/cli/app/.next-cli-build/server/app/api/translator/console-logs/route.js +1 -1
- package/cli/app/.next-cli-build/server/app/api/translator/console-logs/stream/route.js +1 -1
- package/cli/app/.next-cli-build/server/app/api/tunnel/tailscale-install/route.js +2 -2
- package/cli/app/.next-cli-build/server/app/api/version/route.js +1 -1
- package/cli/app/.next-cli-build/server/app/callback/page_client-reference-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/app/callback.html +1 -1
- package/cli/app/.next-cli-build/server/app/callback.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/callback.segments/_full.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/callback.segments/_tree.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/callback.segments/callback/__PAGE__.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/automation.html +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/automation.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/automation.segments/!KGRhc2hib2FyZCk/dashboard/automation/__PAGE__.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/automation.segments/_full.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/automation.segments/_tree.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/basic-chat.html +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/basic-chat.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/basic-chat.segments/!KGRhc2hib2FyZCk/dashboard/basic-chat/__PAGE__.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/basic-chat.segments/_full.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/basic-chat.segments/_tree.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/cli-tools.html +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/cli-tools.rsc +3 -3
- package/cli/app/.next-cli-build/server/app/dashboard/cli-tools.segments/!KGRhc2hib2FyZCk/dashboard/cli-tools/__PAGE__.segment.rsc +3 -3
- package/cli/app/.next-cli-build/server/app/dashboard/cli-tools.segments/_full.segment.rsc +3 -3
- package/cli/app/.next-cli-build/server/app/dashboard/cli-tools.segments/_tree.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/combos.html +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/combos.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/combos.segments/!KGRhc2hib2FyZCk/dashboard/combos/__PAGE__.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/combos.segments/_full.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/combos.segments/_tree.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/context.html +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/context.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/context.segments/!KGRhc2hib2FyZCk/dashboard/context/__PAGE__.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/context.segments/_full.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/context.segments/_tree.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/endpoint.html +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/endpoint.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/endpoint.segments/!KGRhc2hib2FyZCk/dashboard/endpoint/__PAGE__.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/endpoint.segments/_full.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/endpoint.segments/_tree.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/media-providers/web.html +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/media-providers/web.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/!KGRhc2hib2FyZCk/dashboard/media-providers/web/__PAGE__.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/_full.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/_tree.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/mitm.html +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/mitm.rsc +3 -3
- package/cli/app/.next-cli-build/server/app/dashboard/mitm.segments/!KGRhc2hib2FyZCk/dashboard/mitm/__PAGE__.segment.rsc +3 -3
- package/cli/app/.next-cli-build/server/app/dashboard/mitm.segments/_full.segment.rsc +3 -3
- package/cli/app/.next-cli-build/server/app/dashboard/mitm.segments/_tree.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/playground.html +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/playground.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/playground.segments/!KGRhc2hib2FyZCk/dashboard/playground/__PAGE__.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/playground.segments/_full.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/playground.segments/_tree.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/profile.html +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/profile.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/profile.segments/!KGRhc2hib2FyZCk/dashboard/profile/__PAGE__.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/profile.segments/_full.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/profile.segments/_tree.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/providers/new.html +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/providers/new.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/providers/new.segments/!KGRhc2hib2FyZCk/dashboard/providers/new/__PAGE__.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/providers/new.segments/_full.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/providers/new.segments/_tree.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/providers.html +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/providers.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/providers.segments/!KGRhc2hib2FyZCk/dashboard/providers/__PAGE__.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/providers.segments/_full.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/providers.segments/_tree.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/proxy-pools.html +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/proxy-pools.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/!KGRhc2hib2FyZCk/dashboard/proxy-pools/__PAGE__.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/_full.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/_tree.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/pxpipe.html +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/pxpipe.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/pxpipe.segments/!KGRhc2hib2FyZCk/dashboard/pxpipe/__PAGE__.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/pxpipe.segments/_full.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/pxpipe.segments/_tree.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/quota.html +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/quota.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/quota.segments/!KGRhc2hib2FyZCk/dashboard/quota/__PAGE__.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/quota.segments/_full.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/quota.segments/_tree.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/settings/pricing.html +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/settings/pricing.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/!KGRhc2hib2FyZCk/dashboard/settings/pricing/__PAGE__.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/_full.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/_tree.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/skills.html +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/skills.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/skills.segments/!KGRhc2hib2FyZCk/dashboard/skills/__PAGE__.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/skills.segments/_full.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/skills.segments/_tree.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/token-saver.html +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/token-saver.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/token-saver.segments/!KGRhc2hib2FyZCk/dashboard/token-saver/__PAGE__.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/token-saver.segments/_full.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/token-saver.segments/_tree.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/translator.html +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/translator.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/translator.segments/!KGRhc2hib2FyZCk/dashboard/translator/__PAGE__.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/translator.segments/_full.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/translator.segments/_tree.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/usage.html +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/usage.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/usage.segments/!KGRhc2hib2FyZCk/dashboard/usage/__PAGE__.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/usage.segments/_full.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/usage.segments/_tree.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard.html +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard.segments/!KGRhc2hib2FyZCk/dashboard/__PAGE__.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard.segments/_full.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard.segments/_tree.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/index.html +1 -1
- package/cli/app/.next-cli-build/server/app/index.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/index.segments/__PAGE__.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/index.segments/_full.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/index.segments/_tree.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/landing/page_client-reference-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/app/landing.html +1 -1
- package/cli/app/.next-cli-build/server/app/landing.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/landing.segments/_full.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/landing.segments/_tree.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/landing.segments/landing/__PAGE__.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/login/page_client-reference-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/app/login.html +1 -1
- package/cli/app/.next-cli-build/server/app/login.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/login.segments/_full.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/login.segments/_tree.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/login.segments/login/__PAGE__.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/page_client-reference-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/app-paths-manifest.json +24 -24
- package/cli/app/.next-cli-build/server/chunks/1283.js +1 -1
- package/cli/app/.next-cli-build/server/chunks/1350.js +1 -1
- package/cli/app/.next-cli-build/server/chunks/1757.js +1 -1
- package/cli/app/.next-cli-build/server/chunks/1852.js +1 -1
- package/cli/app/.next-cli-build/server/chunks/267.js +1 -1
- package/cli/app/.next-cli-build/server/chunks/4549.js +1 -1
- package/cli/app/.next-cli-build/server/chunks/5626.js +1 -1
- package/cli/app/.next-cli-build/server/chunks/5744.js +1 -1
- package/cli/app/.next-cli-build/server/chunks/5819.js +1 -1
- package/cli/app/.next-cli-build/server/chunks/5905.js +3 -3
- package/cli/app/.next-cli-build/server/chunks/6166.js +1 -1
- package/cli/app/.next-cli-build/server/chunks/6396.js +1 -1
- package/cli/app/.next-cli-build/server/chunks/6936.js +1 -1
- package/cli/app/.next-cli-build/server/chunks/7135.js +1 -1
- package/cli/app/.next-cli-build/server/chunks/7319.js +6 -6
- package/cli/app/.next-cli-build/server/chunks/7364.js +1 -1
- package/cli/app/.next-cli-build/server/chunks/8972.js +1 -1
- package/cli/app/.next-cli-build/server/chunks/9548.js +1 -1
- package/cli/app/.next-cli-build/server/middleware-build-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/pages/404.html +1 -1
- package/cli/app/.next-cli-build/server/pages/500.html +1 -1
- package/cli/app/.next-cli-build/server/preview-props.json +3 -3
- package/cli/app/.next-cli-build/server/server-reference-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/server-reference-manifest.json +1 -1
- package/cli/app/.next-cli-build/static/chunks/620-0f6bd4f59fa0cd33.js +1 -0
- package/cli/app/.next-cli-build/static/chunks/{7001-67d0f2aa165b8767.js → 7001-da01aaca36365276.js} +8 -8
- package/cli/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/providers/[id]/{page-c2b77eabb14f7642.js → page-936f29821afd7d28.js} +1 -1
- package/cli/app/CHANGELOG.md +13 -0
- package/cli/app/package.json +1 -1
- package/cli/app/src/mitm/server.js +1 -1
- package/cli/package.json +1 -1
- package/package.json +1 -1
- package/cli/app/.next-cli-build/static/chunks/620-11311598c4b9e95a.js +0 -1
- /package/cli/app/.next-cli-build/static/{BLnTNheSRSk8U0Uqmnbc4 → Vbe_S3ECwU1yAXUWqmRCl}/_buildManifest.js +0 -0
- /package/cli/app/.next-cli-build/static/{BLnTNheSRSk8U0Uqmnbc4 → Vbe_S3ECwU1yAXUWqmRCl}/_ssgManifest.js +0 -0
|
@@ -12,4 +12,4 @@ sk-key-only-auto-named`;function W({isOpen:a,provider:b,providerName:c,isCompati
|
|
|
12
12
|
"refresh_token": "rt_...",
|
|
13
13
|
"email": "user@example.com"
|
|
14
14
|
}
|
|
15
|
-
]`;function aC({isOpen:a,onClose:b,onSuccess:c}){let[f,g]=(0,e.useState)(""),[h,i]=(0,e.useState)(!1),[k,l]=(0,e.useState)(null),m=()=>{h||(l(null),b())},n=async()=>{let a;try{a=JSON.parse(f)}catch{l({error:"Paste a JSON account or an array of accounts"});return}i(!0),l(null);try{let b=await fetch("/api/oauth/grok-cli/json-import",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)}),d=await b.json();l(d.error?{error:d.error}:d),!d.error&&d.success>0&&c?.()}catch(a){l({error:a.message})}finally{i(!1)}},o=k&&!k.error?`Imported ${k.success}. Failed ${k.failed}.`:null;return(0,d.jsxs)(j.aF,{isOpen:a,onClose:m,title:"Import Grok CLI accounts",size:"lg",footer:(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(j.$n,{variant:"secondary",onClick:m,disabled:h,children:"Close"}),(0,d.jsx)(j.$n,{onClick:n,disabled:h||!f.trim(),children:h?"Importing...":"Import"})]}),children:[(0,d.jsx)("p",{className:"mb-3 text-xs text-text-muted",children:"Paste one account or an array. Snake_case and camelCase are both accepted. A refresh token is refreshed before it is stored. The response never returns the tokens. Line import stays on the automation page."}),(0,d.jsx)("textarea",{className:"w-full rounded-lg border border-border bg-background p-3 font-mono text-xs text-text-main placeholder:text-text-muted focus:border-primary focus:outline-none",rows:8,placeholder:aB,value:f,onChange:a=>g(a.target.value),disabled:h}),k?(0,d.jsx)("div",{className:`mt-3 rounded-lg p-3 text-xs ${k.error?"bg-red-500/10 text-red-400":"bg-green-500/10 text-green-400"}`,children:k.error||o}):null]})}aC.propTypes={isOpen:B().bool.isRequired,onClose:B().func.isRequired,onSuccess:B().func};let aD=["host","content-length","content-type","connection","transfer-encoding","authorization","cookie"],aE=/^[A-Za-z0-9-]+$/;function aF({providerId:a}){let b=(0,y.i)(),[c,f]=(0,e.useState)(!1),[g,h]=(0,e.useState)([{name:"",value:""}]),[i,k]=(0,e.useState)({}),[l,m]=(0,e.useState)(!1),[n,o]=(0,e.useState)(!1),p=(a,b,c)=>{h(d=>d.map((d,e)=>e===a?{...d,[b]:c}:d))},q=(0,e.useCallback)(async()=>{let c={};for(let a of g.filter(a=>a.name.trim())){let d=a.name.trim();if(!aE.test(d))return void b.error(`Invalid header name: ${d}`);if(aD.includes(d.toLowerCase()))return void b.error(`Header ${d} cannot be overridden`);if(d in c)return void b.error(`Duplicate header name: ${d}`);a.value!==i[d]&&(c[d]=a.value)}o(!0);try{let d=await fetch(`/api/providers/${a}/overrides`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({headers:c})});if(!d.ok){let a=await d.json().catch(()=>({}));b.error(a.error||"Failed to save");return}m(Object.keys(c).length>0),b.success("Custom headers saved")}finally{o(!1)}},[g,i,a,b]);return(0,d.jsxs)(j.Zp,{padding:"xs",children:[(0,d.jsxs)("button",{type:"button",onClick:()=>f(a=>!a),className:"flex w-full items-center justify-between text-left",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-primary text-[20px]",children:"tune"}),(0,d.jsx)("span",{className:"text-sm font-semibold",children:"Custom Headers"}),l&&(0,d.jsx)(j.Ex,{variant:"success",size:"sm",children:"Active"})]}),(0,d.jsx)("span",{className:"material-symbols-outlined text-text-muted",children:c?"expand_less":"expand_more"})]}),c&&(0,d.jsxs)("div",{className:"mt-3 border-t border-border pt-3",children:[(0,d.jsx)("div",{className:"flex flex-col gap-2",children:g.map((a,b)=>{let c=a.name.trim()in i&&a.value!==i[a.name.trim()];return(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)("input",{value:a.name,onChange:a=>p(b,"name",a.target.value),placeholder:"Header-Name",spellCheck:!1,className:"w-44 rounded-md border border-border bg-background px-2 py-1.5 text-sm focus:border-primary focus:outline-none"}),(0,d.jsx)("input",{value:a.value,onChange:a=>p(b,"value",a.target.value),placeholder:"Value",spellCheck:!1,title:c?"Overridden":a.name.trim()in i?"Registry default":"",className:`min-w-0 flex-1 rounded-md border bg-background px-2 py-1.5 text-sm focus:border-primary focus:outline-none ${c?"border-amber-400/60":"border-border"}`}),(0,d.jsx)("button",{type:"button",title:"Remove header",onClick:()=>h(a=>a.length>1?a.filter((a,c)=>c!==b):[{name:"",value:""}]),className:"shrink-0 text-text-muted hover:text-red-500",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"delete"})})]},b)})}),(0,d.jsxs)("div",{className:"mt-3 flex items-center justify-between gap-2",children:[(0,d.jsxs)("button",{type:"button",onClick:()=>h(a=>[...a,{name:"",value:""}]),className:"flex items-center gap-1 text-xs text-primary hover:underline",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"add"}),"Add header"]}),(0,d.jsxs)("div",{className:"flex gap-2",children:[(0,d.jsx)("button",{type:"button",disabled:n,onClick:()=>{h(Object.entries(i).map(([a,b])=>({name:a,value:b})))},className:"rounded-md border border-border px-3 py-1.5 text-xs hover:bg-black/[0.03] dark:hover:bg-white/[0.03] disabled:opacity-50",children:"Reset"}),(0,d.jsx)("button",{type:"button",disabled:n,onClick:q,className:"rounded-md bg-primary px-3 py-1.5 text-xs font-medium text-white hover:opacity-90 disabled:opacity-50",children:n?"Saving...":"Save"})]})]})]})]})}aF.propTypes={providerId:B().string.isRequired};var aG=c(41365);let aH="$HOME/.zevai/bin/zevai-aistudio-waa",aI=`OUT="${aH}" bash "$(npm root -g)/zevairouter/vendor/aistudio-waa/build.sh"`,aJ=`OUT="${aH}" bash vendor/aistudio-waa/build.sh`;function aK({value:a,copied:b,onCopy:c,id:e}){return(0,d.jsxs)("div",{className:"flex items-start gap-2 rounded-lg bg-sidebar px-3 py-2",children:[(0,d.jsx)("code",{className:"min-w-0 flex-1 whitespace-pre-wrap break-all text-xs font-mono text-text-main",children:a}),(0,d.jsxs)("button",{type:"button",onClick:()=>c(a,e),className:"inline-flex shrink-0 items-center gap-1 rounded-md bg-primary px-2 py-1 text-[11px] font-medium text-white hover:bg-primary/90","aria-label":`Copy: ${a}`,children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[13px]",children:b===e?"check":"content_copy"}),b===e?"Copied":"Copy"]})]})}function aL({n:a,title:b,children:c,variant:e="missing"}){return(0,d.jsxs)("li",{className:"flex gap-3",children:[(0,d.jsx)("span",{className:`flex size-6 shrink-0 items-center justify-center rounded-full text-xs font-semibold ${"ready"===e?"bg-emerald-500/15 text-emerald-800 dark:text-emerald-300":"bg-amber-500/15 text-amber-800 dark:text-amber-300"}`,children:a}),(0,d.jsxs)("div",{className:"min-w-0 flex-1 space-y-2",children:[(0,d.jsx)("p",{className:"ready"===e?"text-sm font-medium text-emerald-900 dark:text-emerald-200":"text-sm font-medium text-amber-900 dark:text-amber-200",children:b}),c]})]})}function aM({status:a,copied:b,copy:c,variant:e}){let f=a?.buildCommand||aI,g=a?.npmCommand||aI,h=a?.checkoutCommand||aJ,i="ready"===e?"text-xs text-emerald-800/80 dark:text-emerald-300/80":"text-xs text-amber-800 dark:text-amber-300";return(0,d.jsxs)("ol",{className:"space-y-4",children:[(0,d.jsxs)(aL,{n:1,variant:e,title:"Install prerequisites",children:[(0,d.jsx)("p",{className:i,children:"You need Go, git, curl, and a C/C++ compiler, plus about 1 GB of disk. The first build takes several minutes; later builds are much faster."}),(0,d.jsx)("p",{className:i,children:"macOS (git and curl come with the Command Line Tools):"}),(0,d.jsx)(aK,{id:"prereq-mac-clt",copied:b,onCopy:c,value:"xcode-select --install"}),(0,d.jsx)(aK,{id:"prereq-mac-go",copied:b,onCopy:c,value:"brew install go"}),(0,d.jsx)("p",{className:i,children:"Debian / Ubuntu:"}),(0,d.jsx)(aK,{id:"prereq-deb",copied:b,onCopy:c,value:"sudo apt install golang git curl build-essential"})]}),(0,d.jsxs)(aL,{n:2,variant:e,title:"Build the helper",children:[(0,d.jsxs)("p",{className:i,children:["Run this command. It writes the binary to the exact path this router looks for",a?.binPath?(0,d.jsxs)(d.Fragment,{children:[" (",(0,d.jsx)("code",{className:"font-mono",children:a.binPath}),")"]}):null,"."]}),(0,d.jsx)(aK,{id:"build-cmd",copied:b,onCopy:c,value:f}),g!==f&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("p",{className:i,children:"From an npm global install you can also run:"}),(0,d.jsx)(aK,{id:"build-npm",copied:b,onCopy:c,value:g})]}),h!==f&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("p",{className:i,children:"From a git checkout of the repo:"}),(0,d.jsx)(aK,{id:"build-checkout",copied:b,onCopy:c,value:h})]}),!a?.binPath&&(0,d.jsxs)("p",{className:i,children:["If this router uses a custom ",(0,d.jsx)("code",{className:"font-mono",children:"DATA_DIR"}),", set"," ",(0,d.jsx)("code",{className:"font-mono",children:"OUT=$DATA_DIR/bin/zevai-aistudio-waa"}),"."]})]}),(0,d.jsx)(aL,{n:3,variant:e,title:"No router restart needed",children:(0,d.jsx)("p",{className:i,children:"The helper starts on the next AI Studio request. Stay on this page and click Check again after the build finishes."})}),(0,d.jsx)(aL,{n:4,variant:e,title:"Add a connection",children:(0,d.jsxs)("p",{className:i,children:["Use ",(0,d.jsx)("strong",{children:"Login via Browser"}),", or paste the storage-state JSON of a signed-in aistudio.google.com session."]})})]})}function aN(){let[a,b]=(0,e.useState)(null),[c,f]=(0,e.useState)(!1),[g,h]=(0,e.useState)(!0),[i,j]=(0,e.useState)(!1),[k,l]=(0,e.useState)(0),{copied:m,copy:n}=(0,p.C)(2e3);if(g&&!a&&!c)return null;let o=c||!a?.present;return(0,d.jsx)("div",{className:"space-y-2",children:o?(0,d.jsxs)("div",{className:"flex flex-col gap-3 rounded-lg border border-amber-500/30 bg-amber-500/10 px-3 py-3",role:"status",children:[(0,d.jsxs)("div",{className:"flex items-start gap-2",children:[(0,d.jsx)("span",{className:"material-symbols-outlined mt-0.5 shrink-0 text-[16px] text-amber-500",children:"warning"}),(0,d.jsxs)("div",{className:"min-w-0 flex-1 space-y-1",children:[(0,d.jsx)("p",{className:"text-xs font-semibold text-amber-900 dark:text-amber-200",children:c?"Could not check the AI Studio helper":"AI Studio helper is not built yet"}),(0,d.jsx)("p",{className:"text-xs leading-relaxed text-amber-800 dark:text-amber-300",children:"The npm package ships the helper source only; the binary is not included. Build it once on this machine before adding a connection."})]}),(0,d.jsxs)("button",{type:"button",onClick:()=>l(a=>a+1),className:"inline-flex shrink-0 items-center gap-1 rounded-md border border-amber-500/40 px-2 py-1 text-[11px] font-medium text-amber-900 hover:bg-amber-500/10 dark:text-amber-200",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"refresh"}),"Check again"]})]}),(0,d.jsx)(aM,{status:a,copied:m,copy:n,variant:"missing"})]}):(0,d.jsxs)("div",{className:"flex flex-col gap-2 rounded-lg border border-emerald-500/30 bg-emerald-500/10 px-3 py-2",role:"status",children:[(0,d.jsxs)("div",{className:"flex items-start gap-2",children:[(0,d.jsx)("span",{className:"material-symbols-outlined mt-0.5 shrink-0 text-[16px] text-emerald-500",children:"check_circle"}),(0,d.jsxs)("p",{className:"min-w-0 flex-1 text-xs leading-relaxed text-emerald-800 dark:text-emerald-300",children:["Helper ready at ",(0,d.jsx)("code",{className:"font-mono",children:a.binPath}),". No rebuild needed unless you update the router."]}),(0,d.jsx)("button",{type:"button",onClick:()=>j(a=>!a),className:"inline-flex shrink-0 items-center gap-1 rounded-md border border-emerald-500/40 px-2 py-1 text-[11px] font-medium text-emerald-800 hover:bg-emerald-500/10 dark:text-emerald-200","aria-expanded":i,children:i?"Hide setup":"Setup steps"}),(0,d.jsxs)("button",{type:"button",onClick:()=>l(a=>a+1),className:"inline-flex shrink-0 items-center gap-1 rounded-md border border-emerald-500/40 px-2 py-1 text-[11px] font-medium text-emerald-800 hover:bg-emerald-500/10 dark:text-emerald-200",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"refresh"}),"Check again"]})]}),i&&(0,d.jsx)(aM,{status:a,copied:m,copy:n,variant:"ready"})]})})}aK.propTypes={value:B().string.isRequired,copied:B().string,onCopy:B().func.isRequired,id:B().string.isRequired},aL.propTypes={n:B().number.isRequired,title:B().string.isRequired,children:B().node,variant:B().oneOf(["missing","ready"])},aM.propTypes={status:B().shape({binPath:B().string,buildCommand:B().string,npmCommand:B().string,checkoutCommand:B().string}),copied:B().string,copy:B().func.isRequired,variant:B().oneOf(["missing","ready"])};let aO={claude:"claudeAutoPing",codex:"codexAutoPing"};function aP(a){return aG.w.has(a)||"codex"===a||"grok-cli"===a}function aQ({providerId:a,onWebLoginConnected:b,onBulkImport:c}){let e=[];return(aG.w.has(a)&&e.push((0,d.jsx)(aG.A,{providerId:a,onConnected:b},"web-login")),("codex"===a||"grok-cli"===a)&&e.push((0,d.jsx)(j.$n,{size:"sm",icon:"playlist_add",variant:"secondary",onClick:c,className:"w-full sm:w-auto",children:"Bulk Add"},"bulk-add")),e.length)?(0,d.jsx)(d.Fragment,{children:e}):null}function aR(a){return["completed","cancelled","failed"].includes(a)}async function aS(a){let b=new AbortController,c=window.setTimeout(()=>b.abort(),8e3);try{let c=await fetch(a,{cache:"no-store",signal:b.signal}),d=null;try{d=await c.json()}catch{d=null}return{response:c,data:d}}finally{window.clearTimeout(c)}}function aT(){let a,b=(0,f.useParams)(),c=(0,f.useRouter)(),g=b.id,[l,A]=(0,e.useState)([]),[B,D]=(0,e.useState)(!0),[E,G]=(0,e.useState)(""),[H,I]=(0,e.useState)(null),[J,L]=(0,e.useState)([]),[M,N]=(0,e.useState)(!1),[O,P]=(0,e.useState)(!1),[Q,R]=(0,e.useState)(!1),[T,U]=(0,e.useState)(!1),[V,Z]=(0,e.useState)(!1),[$,_]=(0,e.useState)(!1),[aa,ac]=(0,e.useState)(!1),[ad,ae]=(0,e.useState)(""),[ag,ah]=(0,e.useState)(!1),[ai,aj]=(0,e.useState)(!1),[am,an]=(0,e.useState)(!1),[ao,ap]=(0,e.useState)(null),[aq,as]=(0,e.useState)({}),[at,au]=(0,e.useState)([]),[av,aw]=(0,e.useState)(!1),[az,aB]=(0,e.useState)({}),[aD,aE]=(0,e.useState)({}),[aG,aH]=(0,e.useState)(()=>new Set),[aI,aJ]=(0,e.useState)(!1),[aK,aL]=(0,e.useState)(!1),[aM,aT]=(0,e.useState)(!1),[aU,aV]=(0,e.useState)(!1),[aW,aX]=(0,e.useState)(!1),[aY,aZ]=(0,e.useState)(!1),[a$,a_]=(0,e.useState)(!1),[a0,a1]=(0,e.useState)([]),[a2,a3]=(0,e.useState)("__none__"),[a4,a5]=(0,e.useState)(!1),[a6,a7]=(0,e.useState)(!1),[a8,a9]=(0,e.useState)(null),[ba,bb]=(0,e.useState)(""),[bc,bd]=(0,e.useState)("auto"),[be,bf]=(0,e.useState)({}),[bg,bh]=(0,e.useState)({}),[bi,bj]=(0,e.useState)(null),[bk,bl]=(0,e.useState)([]),[bm,bn]=(0,e.useState)([]),[bo,bp]=(0,e.useState)([]),[bq,br]=(0,e.useState)(null),[bs,bt]=(0,e.useState)(!1),[bu,bv]=(0,e.useState)(null),[bw,bx]=(0,e.useState)(!1),[by,bz]=(0,e.useState)(!1),[bA,bB]=(0,e.useState)(null),[bC,bD]=(0,e.useState)({}),[bE,bF]=(0,e.useState)(null),bG=(0,e.useRef)(!1),bH=(0,e.useRef)(null),bI=(0,e.useRef)("1"),[bJ,bK]=(0,e.useState)(!1),[bL,bM]=(0,e.useState)(null),[bN,bO]=(0,e.useState)(""),[bP,bQ]=(0,e.useState)(1),[bR,bS]=(0,e.useState)(20),[bT,bU]=(0,e.useState)("all"),[bV,bW]=(0,e.useState)(""),[bX,bY]=(0,e.useState)(1),[bZ,b$]=(0,e.useState)(20),{copied:b_,copy:b0}=(0,p.C)(),b1=(0,e.useRef)(0),b2=(0,e.useRef)([]),b3=(0,e.useRef)(!0),b4=(0,e.useRef)(null),b5=(0,y.i)(a=>a.error),b6=(0,e.useCallback)(()=>{bM(null),bO(""),b1.current=0},[]),b7=()=>{N(!0)},b8=()=>{"kiro"===g&&bL?.jobId&&aR(bL.status)&&b6(),c.push(n(g))},b9=H?{id:H.id,name:H.name||("anthropic-compatible"===H.type?"Anthropic Compatible":"OpenAI Compatible"),color:"anthropic-compatible"===H.type?"#D97757":"#10A37F",textIcon:"anthropic-compatible"===H.type?"AC":"OC",apiType:H.apiType,baseUrl:H.baseUrl,type:H.type}:k.zN[g]||k.fg[g]||k.IS[g]||k.nJ[g]||k.br[g],ca=b9?.authModes||[],cb=!!k.zN[g]||!!k.IS[g]||ca.includes("oauth"),cc=!!k.fg[g]||ca.includes("apikey"),cd=!!k.IS[g]?.noAuth,ce=(0,r.F)("kiro"===g),cf="aistudio"===g?l.filter(a=>!1!==a.isActive).map(a=>`${a.id}:${a.updatedAt||""}`).join(","):"",cg=(0,s.M)("aistudio"===g,cf),ch=(0,s.Q)(g,cg,(0,o.KC)(g)),ci="kiro"===g?ce:ch,cj=(0,k.wG)(g),ck=(0,k.mq)(g),cl=(0,k.gb)(g),cm=ck||cl,cn=m(g),co=function({providerId:a,providerInfo:b,isOAuth:c,supportsApiKeyAuth:d,isCompatible:e}){if(!b||b.noAuth||b.authModes?.includes("none"))return[];let f=[];for(let g of(c&&x(f,"oauth"),(d||e||"cookie"===b.authType||!c)&&x(f,"apikey"),v[a]||[]))x(f,g);return f.map(b=>{let c=u[b];return c?{...c,...w[a]?.[b]}:null}).filter(Boolean)}({providerId:g,providerInfo:b9,isOAuth:cb,supportsApiKeyAuth:cc,isCompatible:ck||cl}),cp=function(a,{specializedChooser:b=!1}={}){return a.length?b?{type:"specialized"}:1===a.length?{type:"method",methodId:a[0].id}:{type:"chooser"}:{type:"none"}}(co,{specializedChooser:"kiro"===g}),cq=co.map(a=>"quota-cookie"===a.id&&0===l.length?{...a,disabled:!0,description:"Add a CodeBuddy connection before attaching its quota cookie."}:a),cr=a=>{if(!bc||"auto"===bc)return null;let b=(0,z.kl)(g,a);return b&&b.includes(bc)?bc:null},cs=cm?g:cj,ct=(()=>{let a=new Set,b=new Set,c=c=>{if(!c||b.has(c))return;b.add(c);let d=(0,z.kl)(g,c);d&&d.forEach(b=>{"none"!==b&&a.add(b)})};for(let a of ci)c(a.id);for(let a of bm)c(a.id);for(let a of at)a.providerAlias===cs&&"llm"===(a.kind||a.type||"llm")&&c(a.id);return a.size?["auto",...a]:null})(),cu=cm?H?.prefix||g:cj,cv=(0,e.useCallback)(async()=>{try{let a=await fetch(`/api/models/disabled?providerAlias=${encodeURIComponent(cs)}`,{cache:"no-store"}),b=await a.json();a.ok&&bp(b.ids||[])}catch(a){console.log("Error fetching disabled models:",a)}},[cs]),cw=async a=>{try{(await fetch("/api/models/disabled",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({providerAlias:cs,ids:[a]})})).ok&&await cv()}catch(a){console.log("Error disabling model:",a)}},cx=async a=>{try{(await fetch(`/api/models/disabled?providerAlias=${encodeURIComponent(cs)}&id=${encodeURIComponent(a)}`,{method:"DELETE"})).ok&&await cv()}catch(a){console.log("Error enabling model:",a)}},cy=async a=>{a.length&&br({title:"Disable All Models",message:`Disable all ${a.length} model(s)?`,onConfirm:async()=>{br(null);try{(await fetch("/api/models/disabled",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({providerAlias:cs,ids:a})})).ok&&await cv()}catch(a){console.log("Error disabling all models:",a)}}})},cz=async()=>{try{(await fetch(`/api/models/disabled?providerAlias=${encodeURIComponent(cs)}`,{method:"DELETE"})).ok&&await cv()}catch(a){console.log("Error enabling all models:",a)}},cA=(0,e.useCallback)(async()=>{try{let a=await fetch("/api/models/custom",{cache:"no-store"}),b=await a.json();a.ok&&au(b.models||[])}catch(a){console.log("Error fetching custom models:",a)}},[]),cB=(0,e.useCallback)(async()=>{try{let a=await fetch("/api/models/alias"),b=await a.json();a.ok&&as(b.aliases||{})}catch(a){console.log("Error fetching aliases:",a)}},[]),cC=(0,e.useCallback)(async()=>{try{G("");let[a,b,c,d]=await Promise.allSettled([aS("/api/providers"),aS("/api/provider-nodes"),aS("/api/proxy-pools?isActive=true"),aS("/api/settings")]),e="fulfilled"===a.status?a.value.response:null,f="fulfilled"===a.status?a.value.data:{},h="fulfilled"===b.status?b.value.response:null,i="fulfilled"===b.status?b.value.data:{},j="fulfilled"===c.status?c.value.response:null,l="fulfilled"===c.status?c.value.data:{},m="fulfilled"===d.status?d.value.response:null,n=m?.ok&&d.value.data||{};if(e?.ok){let a=(f.connections||[]).filter(a=>a.provider===g);b2.current=a,A(a)}else G("Connections could not be loaded.");j?.ok&&L(l.proxyPools||[]);let o=(n.providerStrategies||{})[g]||{};a9(o.fallbackStrategy||null),bb(null!=o.stickyRoundRobinLimit?String(o.stickyRoundRobinLimit):"1"),bI.current=null!=o.stickyRoundRobinLimit?String(o.stickyRoundRobinLimit):"1";let p=(n.providerThinking||{})[g]||{};bd(p.mode||"auto");let q=aO[g];if(bf(q&&n?.[q]?.connections||{}),bh(q&&n?.[q]?.schedules||{}),h?.ok){let a=(i.nodes||[]).find(a=>a.id===g)||null;if(!a&&((0,k.mq)(g)||(0,k.gb)(g)))for(let b=0;b<3;b+=1){if(await new Promise(a=>setTimeout(a,150)),!b3.current)return;let{response:b,data:c}=await aS("/api/provider-nodes");if(!b3.current)return;if(b.ok&&(a=(c.nodes||[]).find(a=>a.id===g)||null))break}I(a)}}catch(a){console.log("Error fetching connections:",a),b3.current&&G("Connections could not be loaded.")}finally{b3.current&&D(!1)}},[g]),cD=async a=>{try{let b=await fetch(`/api/provider-nodes/${g}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)}),c=await b.json();b.ok&&(I(c.node),await cC(),aj(!1))}catch(a){console.log("Error updating provider node:",a)}},cE=async(a,b)=>{try{let c=await fetch("/api/settings",{cache:"no-store"}),d=(c.ok?await c.json():{}).providerStrategies||{},e={};a&&(e.fallbackStrategy=a),"round-robin"===a&&""!==b&&(e.stickyRoundRobinLimit=Number(b)||3);let f={...d};0===Object.keys(e).length?delete f[g]:f[g]=e,await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({providerStrategies:f})})}catch(a){console.log("Error saving provider strategy:",a)}},cF=async a=>{try{let b=await fetch("/api/settings",{cache:"no-store"}),c={...(b.ok?await b.json():{}).providerThinking||{}};a&&"auto"!==a?c[g]={mode:a}:delete c[g],await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({providerThinking:c})})}catch(a){console.log("Error saving thinking config:",a)}},cG=async(a,b)=>{try{(await fetch(`/api/providers/${a}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({providerSpecificData:{paidSubscription:b}})})).ok&&A(c=>c.map(c=>c.id===a?{...c,providerSpecificData:{...c.providerSpecificData,paidSubscription:b}}:c))}catch(a){console.log("Error updating paid flag:",a)}},cH=async(a,b)=>{let c=aO[g];if(!c)return;let d={...be,[a]:b};bf(d);try{let a=await fetch("/api/settings",{cache:"no-store"}),b={...(a.ok?await a.json():{})[c]||{},connections:d};if(!(await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({[c]:b})})).ok)throw Error("Failed to save auto-ping setting")}catch(a){bf(be),console.log("Error saving auto-ping config:",a)}},cI=async({reactive:a,schedule:b})=>{let c=aO[g];if(!bi||!c)return;let d={...be,[bi.id]:a},e={...bg,[bi.id]:b};bf(d),bh(e);try{let a=await fetch("/api/settings",{cache:"no-store"}),b=a.ok?await a.json():{};if(!(await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({[c]:{...b[c]||{},connections:d,schedules:e}})})).ok)throw Error("Failed to save auto-ping schedule")}catch(a){bf(be),bh(bg),console.log("Error saving auto-ping schedule:",a)}},cJ=async(a,b,c=cj)=>{let d=`${c}/${a}`;try{let a=await fetch("/api/models/alias",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({model:d,alias:b})});if(a.ok)await cB();else{let b=await a.json();alert(b.error||"Failed to set alias")}}catch(a){console.log("Error setting alias:",a)}},cK=async(a,b="llm")=>{try{let c=new URLSearchParams({providerAlias:cs,id:a,type:b});(await fetch(`/api/models/custom?${c}`,{method:"DELETE"})).ok&&(await cA(),window.dispatchEvent(new CustomEvent("customModelChanged")))}catch(a){console.log("Error deleting custom model:",a)}},cL=async a=>{try{(await fetch(`/api/models/alias?alias=${encodeURIComponent(a)}`,{method:"DELETE"})).ok&&await cB()}catch(a){console.log("Error deleting alias:",a)}},cM=async()=>{if(bJ)return;let a=l.find(a=>!1!==a.isActive);if(!a)return void alert((0,q.Tl)("Please add an active Qoder connection first"));bK(!0);try{let b=await fetch(`/api/providers/${a.id}/models`),c=await b.json();if(!b.ok)return void alert(c.error||(0,q.Tl)("Failed to fetch models"));let d=c.models||[];if(0===d.length)return void alert((0,q.Tl)("No models returned"));let e={...aq},f=0;for(let a of d){let b=a.id||a.name;if(!b)continue;let c=b.replace(/^qoder\//,""),d=`${cs}/${c}`;!Object.values(e).includes(d)&&(e[c]||(await cJ(c,c,cs),e[c]=d,f+=1))}0===f?alert((0,q.Tl)("All models already exist, no new models added")):alert((0,q.Tl)("Successfully added")+` ${f} `+(0,q.Tl)("models"))}catch(a){console.log("Error importing Qoder models:",a),alert((0,q.Tl)("Error fetching models")+": "+a.message)}finally{bK(!1)}},cN=async()=>{let a=[...l];if(bw||0===a.length)return;let b=Object.fromEntries(a.map(a=>[a.id,{state:"queued",error:null}]));bG.current=!1,bx(!0),bz(!1),bB(null),bD(b),bF({total:a.length,completed:0,passed:0,failed:0,stopped:!1});let c=0,d=0;try{for(let b=0;b<a.length;b+=1){if(bG.current){bF({total:a.length,completed:b,passed:c,failed:d,stopped:!0});break}let e=a[b];if(!b2.current.some(a=>a.id===e.id)){bD(a=>({...a,[e.id]:{state:"skipped",error:null}})),bF({total:a.length,completed:b+1,passed:c,failed:d,stopped:!1});continue}bB(e.id),bD(a=>({...a,[e.id]:{state:"testing",error:null}}));try{let a=await fetch(`/api/providers/${e.id}/test`,{method:"POST"}),b=await a.json(),f=!!b.valid;f?c+=1:d+=1,bD(a=>({...a,[e.id]:{state:f?"success":"failed",error:f?b.warning||null:b.error||null}}))}catch(a){d+=1,bD(b=>({...b,[e.id]:{state:"failed",error:a.message||"Test failed"}}))}bF({total:a.length,completed:b+1,passed:c,failed:d,stopped:!1}),b<a.length-1&&await new Promise(a=>setTimeout(a,250))}}finally{bB(null),bx(!1),bz(!1),bG.current=!1}},cO=async a=>{br({title:"Delete Connection",message:"Delete this connection?",onConfirm:async()=>{br(null);try{(await fetch(`/api/providers/${a}`,{method:"DELETE"})).ok&&A(l.filter(b=>b.id!==a))}catch(a){console.log("Error deleting connection:",a)}}})},cP=()=>{cC(),N(!1)},cQ=(0,e.useCallback)(a=>{bM(a),bO("")},[b6]),cR=async a=>{ae("");try{let b=await fetch("/api/providers",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:g,...a})}),c=null;try{c=await b.json()}catch{c=null}if(b.ok){await cC(),ac(!1);return}ae(c?.error||"Failed to save connection")}catch(a){console.log("Error saving connection:",a),ae("Failed to save connection")}},cS=async a=>{try{(await fetch(`/api/providers/${ao.id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)})).ok&&(await cC(),ah(!1))}catch(a){console.log("Error updating connection:",a)}},cT=async(a,b)=>{try{let c=await fetch(`/api/providers/${a}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({isActive:b})});if(c.ok){let d=await c.json().catch(()=>null);A(c=>c.map(c=>c.id===a?{...c,isActive:b,...d?.connection||{}}:c))}}catch(a){console.log("Error updating connection status:",a)}},cU=async(a,b)=>{let c=[...l];[c[a],c[b]]=[c[b],c[a]],A(c);try{let[d,e]=await Promise.all([fetch(`/api/providers/${c[a].id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({priority:a+1})}),fetch(`/api/providers/${c[b].id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({priority:b+1})})]);d.ok&&e.ok||(console.log("Priority swap rejected:",d.status,e.status),await cC())}catch(a){console.log("Error swapping priority:",a),await cC()}},cV=(0,e.useMemo)(()=>{let a=bV.trim().toLowerCase();return l.filter(b=>!!(0,t.i2)(b,bT)&&(!a||[b.name,b.email,b.id,b.account,b.username,b.label,b.authType,b.notes,b.proxyPoolId].filter(Boolean).join(" ").toLowerCase().includes(a)))},[l,bT,bV]),cW=(0,e.useMemo)(()=>t.gJ.reduce((a,b)=>(a[b.id]="all"===b.id?l.length:l.filter(a=>(0,t.i2)(a,b.id)).length,a),{}),[l]),cX=a0.filter(a=>l.some(b=>b.id===a)),cY=l.filter(a=>cX.includes(a.id)),cZ="codebuddy"===g||"codebuddy-cn"===g?(cY.length>0?cY:l).map(a=>a.id):[],c$=cV.length>0&&cV.every(a=>cX.includes(a.id)),c_=a=>{switch(a){case"oauth":b7();return;case"apikey":ae(""),ac(!0);return;case"cookie":U(!0);return;case"quota-cookie":l.length>1&&0===cY.length?alert("Select the CodeBuddy connection(s) that should use this quota cookie first."):Z(!0);return;default:b5(`Unsupported connection method: ${a}`,"Add Connection")}},c0=a=>{null!==b4.current&&window.cancelAnimationFrame(b4.current),b4.current=window.requestAnimationFrame(()=>{b4.current=null,c_(a)})},c1=()=>{"specialized"===cp.type?b7():"method"===cp.type?c_(cp.methodId):"chooser"===cp.type&&_(!0)},c2=a=>{_(!1),c0(a)},c3=(()=>{if(0===cY.length)return"";let a=new Set(cY.map(a=>a.providerSpecificData?.proxyPoolId||"__none__"));if(1===a.size){let b=[...a][0];if("__none__"===b)return"All selected currently unbound";let c=J.find(a=>a.id===b);return`All selected currently bound to ${c?.name||b}`}return"Selected connections have mixed proxy bindings"})(),c4=()=>{a4||an(!1)},c5=async a=>{a5(!0);try{let b=0,c=0,d=Array.from({length:Math.min(8,a.length)},async()=>{for(;c<a.length;){let d=c;c+=1;let{connectionId:e,proxyPoolId:f}=a[d];try{(await fetch(`/api/providers/${e}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({proxyPoolId:f})})).ok||(b+=1)}catch(a){console.log("Error applying proxy for",e,a),b+=1}}});await Promise.all(d),b>0&&alert(`Updated with ${b} failed request(s).`),await cC(),an(!1)}finally{a5(!1)}},c6=a=>c5(cY.map(b=>({connectionId:b.id,proxyPoolId:a}))),c7=a=>{let b="gsuite"===a?"GSuite (non-Gmail)":"Gmail (@gmail.com)";br({title:`Delete ${b}`,message:`Delete ALL ${b} accounts for this provider? This cannot be undone.`,onConfirm:async()=>{br(null);try{(await fetch("/api/providers/bulk-delete",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:b9?.id||g,emailFilter:a})})).ok&&(a1([]),await cC())}catch(a){console.error("bulk delete error:",a)}}})},c8=Math.max(1,Math.ceil(cV.length/bR)),c9=Math.min(bP,c8),da=cV.slice((c9-1)*bR,c9*bR),db=(0,d.jsx)("div",{className:"flex min-w-0 flex-col divide-y divide-black/[0.03] dark:divide-white/[0.03]",children:da.map((a,b)=>{let c,e=l.findIndex(b=>b.id===a.id);return(0,d.jsxs)("div",{className:"flex min-w-0 items-stretch",children:[(0,d.jsx)("label",{className:"flex w-8 shrink-0 items-center justify-center",children:(0,d.jsx)("input",{type:"checkbox",checked:(c=a.id,cX.includes(c)),onChange:()=>{var b;return b=a.id,void a1(a=>a.includes(b)?a.filter(a=>a!==b):[...a,b])},className:"size-4 rounded border-black/20 dark:border-white/20","aria-label":`Select ${a.name||a.email||a.id}`})}),(0,d.jsx)("div",{className:"flex-1 min-w-0",children:(0,d.jsx)(K,{connection:a,proxyPools:J,isOAuth:cb,isFirst:0===e,isLast:e===l.length-1,onMoveUp:()=>cU(e,e-1),onMoveDown:()=>cU(e,e+1),onToggleActive:b=>cT(a.id,b),autoPingEnabled:!0===be[a.id],onToggleAutoPing:aO[g]&&"oauth"===a.authType?b=>cH(a.id,b):void 0,autoPingScheduled:bg[a.id]?.enabled===!0,onOpenAutoPingSchedule:aO[g]&&"oauth"===a.authType?()=>bj(a):void 0,onTogglePaid:"antigravity"===g?b=>cG(a.id,b):void 0,onUpdateProxy:async b=>{try{(await fetch(`/api/providers/${a.id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({proxyPoolId:b||null})})).ok&&A(c=>c.map(c=>c.id===a.id?{...c,providerSpecificData:{...c.providerSpecificData,proxyPoolId:b||null}}:c))}catch(a){console.log("Error updating proxy:",a)}},onEdit:()=>{ap(a),ah(!0)},onDelete:()=>cO(a.id),oneByOneStatus:bC[a.id]||null})})]},a.id)})}),dc=J.filter(a=>!0===a.isActive),dd=(0,d.jsx)(j.aF,{isOpen:am,onClose:c4,title:`Apply Proxy (${cY.length} selected)`,children:(0,d.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,d.jsxs)("div",{className:"flex flex-col",children:[(0,d.jsxs)("button",{onClick:()=>{let a=J.filter(a=>!0===a.isActive);return 0===a.length?void alert("No active proxy pools available."):c5(cY.map((b,c)=>({connectionId:b.id,proxyPoolId:a[c%a.length].id})))},disabled:a4||0===dc.length,className:"flex items-center gap-2 rounded-lg px-3 py-2 text-left transition-colors hover:bg-black/[0.04] dark:hover:bg-white/[0.04] disabled:cursor-not-allowed disabled:opacity-50",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[18px]",children:"sync_alt"}),(0,d.jsx)("span",{className:"text-sm text-text-main",children:"One-to-one (rotate)"})]}),(0,d.jsxs)("button",{onClick:()=>c6(null),disabled:a4,className:"flex items-center gap-2 rounded-lg px-3 py-2 text-left transition-colors hover:bg-black/[0.04] dark:hover:bg-white/[0.04] disabled:cursor-not-allowed disabled:opacity-50",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[18px]",children:"link_off"}),(0,d.jsx)("span",{className:"text-sm text-text-main",children:"None (unbind all)"})]}),J.map(a=>(0,d.jsxs)("button",{onClick:()=>c6(a.id),disabled:a4||!0!==a.isActive,className:"flex items-center gap-2 rounded-lg px-3 py-2 text-left transition-colors hover:bg-black/[0.04] dark:hover:bg-white/[0.04] disabled:cursor-not-allowed disabled:opacity-50",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[18px]",children:"lan"}),(0,d.jsx)("span",{className:"truncate text-sm text-text-main",children:a.name}),!0!==a.isActive&&(0,d.jsx)("span",{className:"text-[10px] text-text-muted",children:"(inactive)"})]},a.id))]}),a4&&(0,d.jsx)("p",{className:"text-xs text-text-muted",children:"Applying..."}),(0,d.jsx)(j.$n,{onClick:c4,variant:"ghost",fullWidth:!0,disabled:a4,children:"Cancel"})]})}),de=async a=>{aH(b=>new Set(b).add(a));try{let b=await fetch("/api/models/test",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({model:`${cs}/${a}`})}),c=await b.json();aB(b=>({...b,[a]:c.ok?"ok":"error"})),aE(b=>({...b,[a]:c.ok?"":c.error||"Model not reachable"}))}catch{aB(b=>({...b,[a]:"error"})),aE(b=>({...b,[a]:"Network error"}))}finally{aH(b=>{let c=new Set(b);return c.delete(a),c})}};return B?(0,d.jsxs)("div",{className:"flex flex-col gap-8",children:[(0,d.jsx)(j.Qv,{}),(0,d.jsx)(j.Qv,{})]}):b9?(0,d.jsxs)("div",{className:"flex min-w-0 flex-col gap-6 px-1 sm:gap-8 sm:px-0",children:[(0,d.jsxs)("div",{className:"min-w-0",children:[(0,d.jsxs)(h(),{href:"/dashboard/providers",className:"inline-flex items-center gap-1 text-sm text-text-muted hover:text-primary transition-colors mb-4",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-lg",children:"arrow_back"}),"Back to Providers"]}),(0,d.jsxs)("div",{className:"flex min-w-0 items-center gap-3 sm:gap-4",children:[(0,d.jsx)("div",{className:"flex size-12 shrink-0 items-center justify-center rounded-lg",style:{backgroundColor:`${b9.color}15`},children:av?(0,d.jsx)("span",{className:"text-sm font-bold",style:{color:b9.color},children:b9.textIcon||b9.id.slice(0,2).toUpperCase()}):(0,d.jsx)(i.A,{src:ck&&b9.apiType?"responses"===b9.apiType?"/providers/oai-r.png":"/providers/oai-cc.png":cl?"/providers/anthropic-m.png":`/providers/${b9.id}.png`,alt:b9.name,width:48,height:48,className:"max-h-12 max-w-12 rounded-lg object-contain",sizes:"48px",onError:()=>aw(!0)})}),(0,d.jsxs)("div",{className:"min-w-0",children:[(0,d.jsxs)("div",{className:"flex items-center gap-3 flex-wrap",children:[(0,d.jsx)("h1",{className:"truncate text-2xl font-semibold tracking-tight sm:text-3xl",children:b9.name}),(b9.notice?.apiKeyUrl||b9.notice?.signupUrl||b9.website)&&(0,d.jsxs)("a",{href:b9.notice?.apiKeyUrl||b9.notice?.signupUrl||b9.website,target:"_blank",rel:"noopener noreferrer",className:"text-xs text-primary hover:underline inline-flex items-center gap-1",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-sm",children:"open_in_new"}),b9.notice?.apiKeyUrl?"Get API Key":"Sign up / Learn more"]})]}),(0,d.jsxs)("p",{className:"text-text-muted",children:[l.length," connection",1===l.length?"":"s"]})]})]})]}),b9.deprecated&&(0,d.jsxs)("div",{className:"flex items-center gap-2 px-3 py-2 rounded-lg bg-yellow-500/10 border border-yellow-500/30",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[16px] text-yellow-500 mt-0.5 shrink-0",children:"warning"}),(0,d.jsx)("p",{className:"text-xs text-red-600 dark:text-yellow-400 leading-relaxed",children:b9.deprecationNotice})]}),b9.notice?.text&&!b9.deprecated&&(0,d.jsxs)("div",{className:"flex flex-col gap-2 rounded-lg border border-blue-500/30 bg-blue-500/10 px-3 py-2 sm:flex-row sm:items-center",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[16px] text-blue-500 shrink-0",children:"info"}),(0,d.jsx)("p",{className:"min-w-0 flex-1 text-xs leading-relaxed text-blue-600 dark:text-blue-400",children:b9.notice.text}),b9.notice.apiKeyUrl&&(0,d.jsx)("a",{href:b9.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 →"})]}),"aistudio"===g&&(0,d.jsx)(aN,{}),cm&&H&&(0,d.jsx)(j.Zp,{children:(0,d.jsxs)("div",{className:"mb-4 flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between",children:[(0,d.jsxs)("div",{className:"min-w-0",children:[(0,d.jsx)("h2",{className:"text-lg font-semibold",children:cl?"Anthropic Compatible Details":"OpenAI Compatible Details"}),(0,d.jsxs)("p",{className:"break-all text-sm text-text-muted",children:[cl?"Messages API":"responses"===H.apiType?"Responses API":"Chat Completions"," \xb7 ",(H.baseUrl||"").replace(/\/$/,""),"/",cl?"messages":"responses"===H.apiType?"responses":"chat/completions"]})]}),(0,d.jsxs)("div",{className:"grid grid-cols-1 gap-2 sm:flex sm:items-center",children:[(0,d.jsx)(j.$n,{size:"sm",icon:"add",onClick:()=>{ae(""),ac(!0)},className:"w-full sm:w-auto",children:"Add API Key"}),(0,d.jsx)(j.$n,{size:"sm",variant:"secondary",icon:"edit",onClick:()=>aj(!0),className:"w-full sm:w-auto",children:"Edit"}),(0,d.jsx)(j.$n,{size:"sm",variant:"secondary",icon:"delete",onClick:async()=>{br({title:"Delete Compatible Node",message:`Delete this ${cl?"Anthropic":"OpenAI"} Compatible node?`,onConfirm:async()=>{br(null);try{(await fetch(`/api/provider-nodes/${g}`,{method:"DELETE"})).ok&&c.push("/dashboard/providers")}catch(a){console.log("Error deleting provider node:",a)}}})},className:"w-full sm:w-auto",children:"Delete"})]})]})}),cd?(0,d.jsx)(j.gw,{providerId:g}):(0,d.jsxs)(j.Zp,{children:[(0,d.jsxs)("div",{className:"mb-4 flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[(0,d.jsx)("h2",{className:"text-lg font-semibold",children:"Connections"}),(0,d.jsxs)("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:gap-4",children:[l.length>0&&J.length>0&&(0,d.jsx)(j.$n,{size:"sm",variant:"secondary",icon:"lan",onClick:()=>{if(0===cY.length)return;let a=[...new Set(cY.map(a=>a.providerSpecificData?.proxyPoolId||"__none__"))];a3(1===a.length?a[0]:"__none__"),an(!0)},disabled:0===cY.length,children:"Apply Proxy"}),l.length>0&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(j.$n,{size:"sm",variant:"secondary",icon:"sync",onClick:cN,disabled:bw,children:bw?"Testing Connection One-by-One...":"Test Connection One-by-One"}),bw&&(0,d.jsx)(j.$n,{size:"sm",variant:"ghost",icon:"stop",onClick:()=>{bw&&(bG.current=!0,bz(!0))},disabled:by,children:by?"Stopping...":"Stop"})]}),(0,d.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,d.jsx)("span",{className:"text-xs text-text-muted font-medium",children:"Round Robin"}),(0,d.jsx)(j.lM,{checked:"round-robin"===a8,onChange:a=>{let b=a?"round-robin":null,c=a?ba||"1":ba;a&&!ba&&bb("1"),bI.current=c,bH.current&&(clearTimeout(bH.current),bH.current=null),a9(b),cE(b,c)}}),"round-robin"===a8&&(0,d.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,d.jsx)("span",{className:"text-xs text-text-muted",children:"Sticky:"}),(0,d.jsx)("input",{type:"number",min:1,value:ba,onChange:a=>{var b;bb(b=a.target.value),bI.current=b,bH.current&&clearTimeout(bH.current),bH.current=setTimeout(()=>{cE("round-robin",bI.current)},500)},placeholder:"1",className:"w-14 px-2 py-1 text-xs border border-border rounded-md bg-background focus:outline-none focus:border-primary"})]})]})]})]}),l.length>0&&(0,d.jsxs)("div",{className:"mb-4 flex flex-col gap-3 rounded-lg border border-black/5 bg-black/[0.02] p-3 dark:border-white/5 dark:bg-white/[0.02]",children:[(0,d.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,d.jsxs)("label",{className:"flex items-center gap-1.5 text-xs text-text-muted",children:[(0,d.jsx)("input",{type:"checkbox",checked:c$,onChange:()=>{c$?a1(a=>a.filter(a=>!cV.some(b=>b.id===a))):a1(a=>Array.from(new Set([...a,...cV.map(a=>a.id)])))},className:"size-4 rounded border-black/20 dark:border-white/20"}),c$?"Unselect visible":"Select visible"]}),(0,d.jsxs)(j.Ex,{variant:"default",children:[cV.length," visible"]}),cY.length>0&&(0,d.jsxs)(j.Ex,{variant:"default",children:[cY.length," selected"]}),c3&&(0,d.jsx)("span",{className:"text-xs text-text-muted",children:c3}),cY.length>0&&(0,d.jsx)(j.$n,{size:"sm",variant:"ghost",onClick:()=>{a1([]),a3("__none__")},children:"Clear"}),cY.length>0&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)(j.$n,{size:"sm",variant:"secondary",icon:"delete",onClick:()=>{0!==cY.length&&br({title:"Delete Selected Connections",message:`Delete ${cY.length} selected connection(s)? This permanently removes the selected accounts.`,onConfirm:async()=>{br(null);let a=[],b=0;for(let c of cY)try{(await fetch(`/api/providers/${c.id}`,{method:"DELETE"})).ok?a.push(c.id):b+=1}catch(a){console.log("Error deleting selected connection:",a),b+=1}a1(b=>b.filter(b=>!a.includes(b))),b>0&&alert(`Deleted ${a.length} connection(s); ${b} failed.`),await cC()}})},children:["Delete Selected (",cY.length,")"]}),(0,d.jsx)(j.$n,{size:"sm",variant:"secondary",icon:"domain",onClick:()=>c7("gsuite"),children:"Delete GSuite"}),(0,d.jsx)(j.$n,{size:"sm",variant:"secondary",icon:"mail",onClick:()=>c7("gmail"),children:"Delete Gmail"})]})]}),(0,d.jsx)("div",{className:"flex flex-wrap gap-1.5",children:t.gJ.map(a=>(0,d.jsxs)("button",{type:"button",onClick:()=>bU(a.id),className:`rounded-full border px-2.5 py-1 text-xs transition-colors ${bT===a.id?"border-primary/50 bg-primary/10 text-primary":"border-border text-text-muted hover:border-primary/30 hover:text-text-main"}`,children:[a.label,(0,d.jsx)("span",{className:"ml-1 text-[10px] opacity-70",children:cW[a.id]||0})]},a.id))}),l.length>=20&&(0,d.jsxs)("div",{className:"relative",children:[(0,d.jsx)("span",{className:"material-symbols-outlined pointer-events-none absolute left-2.5 top-1/2 -translate-y-1/2 text-[16px] text-text-subtle",children:"search"}),(0,d.jsx)("input",{type:"search",value:bV,onChange:a=>bW(a.target.value),placeholder:`Search ${l.length} connections (email, name, id)…`,className:"w-full rounded-lg border border-border bg-background py-2 pl-8 pr-3 text-xs text-text-main outline-none placeholder:text-text-subtle focus:border-primary/40"})]})]}),E?(0,d.jsxs)("div",{className:"flex items-center justify-between gap-3 rounded-lg border border-red-500/30 bg-red-500/10 px-4 py-3",children:[(0,d.jsxs)("div",{className:"flex items-center gap-3",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[18px] text-red-500",children:"error"}),(0,d.jsx)("p",{className:"text-sm text-red-600 dark:text-red-400",children:E})]}),(0,d.jsx)(j.$n,{size:"sm",variant:"secondary",icon:"refresh",onClick:()=>{D(!0),cC()},children:"Retry"})]}):0===l.length?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[(0,d.jsxs)("div",{className:"flex items-center gap-3",children:[(0,d.jsx)("div",{className:"inline-flex items-center justify-center w-9 h-9 rounded-full bg-primary/10 text-primary shrink-0",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:cb?"lock":"key"})}),(0,d.jsxs)("div",{className:"min-w-0",children:[(0,d.jsx)("p",{className:"text-sm text-text-muted",children:"No connections yet"}),"kiro"!==g&&co.some(a=>"oauth"===a.id)&&co.some(a=>"apikey"===a.id)?(0,d.jsxs)("p",{className:"text-xs text-text-muted",children:["Choose ",co.find(a=>"oauth"===a.id)?.label||"OAuth"," or ",co.find(a=>"apikey"===a.id)?.label||"API Key","."]}):co.length>1?(0,d.jsx)("p",{className:"text-xs text-text-muted",children:"Add Connection lists every available authentication method."}):null]})]}),(0,d.jsx)(ay,{showAutomation:cn,showAddConnection:"none"!==cp.type,onOpenAutomation:b8,onAddConnection:c1,methods:"kiro"===g?null:cq,onSelectMethod:"kiro"===g?null:c2,extra:aP(g)?(0,d.jsx)(aQ,{providerId:g,onWebLoginConnected:cC,onBulkImport:()=>"codex"===g?P(!0):R(!0)}):null})]}),"kiro"===g&&bL?.jobId&&(0,d.jsxs)("div",{className:"mt-4 flex flex-col gap-3 rounded-lg border border-primary/20 bg-primary/[0.06] px-4 py-3 sm:flex-row sm:items-center sm:justify-between",children:[(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:"text-sm font-semibold text-text-main",children:"Bulk import progress is still available"}),(0,d.jsxs)("p",{className:"text-xs text-text-muted",children:["Status: ",bL.status," | Success: ",bL.summary?.success||0," | Running: ",bL.summary?.running||0," | Queued: ",bL.summary?.queued||0]})]}),(0,d.jsxs)("div",{className:"flex gap-2",children:[(0,d.jsx)(j.$n,{size:"sm",icon:"monitoring",variant:"secondary",onClick:()=>c.push(n("kiro")),children:"Resume Bulk Progress"}),aR(bL.status)&&(0,d.jsx)(j.$n,{size:"sm",variant:"ghost",icon:"close",onClick:b6,children:"Clear"})]})]}),"kiro"===g&&!bL?.jobId&&bN&&(0,d.jsx)("div",{className:"mt-4 rounded-lg border border-amber-200 bg-amber-50 px-4 py-3 text-sm text-amber-700 dark:border-amber-800 dark:bg-amber-900/20 dark:text-amber-300",children:bN})]}):(0,d.jsxs)(d.Fragment,{children:[bE&&(0,d.jsx)("div",{className:"mb-4 rounded-lg border border-black/10 bg-black/[0.02] px-3 py-2 text-xs text-text-muted dark:border-white/10 dark:bg-white/[0.03]",children:(0,d.jsxs)("div",{className:"flex flex-wrap items-center gap-3",children:[(0,d.jsxs)("span",{children:["Total: ",bE.total]}),(0,d.jsxs)("span",{children:["Completed: ",bE.completed]}),(0,d.jsxs)("span",{children:["Passed: ",bE.passed]}),(0,d.jsxs)("span",{children:["Failed: ",bE.failed]}),bE.stopped&&(0,d.jsx)("span",{className:"text-amber-600 dark:text-amber-400",children:"Stopped"}),bw&&bA&&(0,d.jsxs)("span",{children:["Running: ",l.find(a=>a.id===bA)?.name||bA]})]})}),"kiro"===g&&bL?.jobId&&(0,d.jsxs)("div",{className:"mb-4 flex flex-col gap-3 rounded-lg border border-primary/20 bg-primary/[0.06] px-4 py-3 sm:flex-row sm:items-center sm:justify-between",children:[(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:"text-sm font-semibold text-text-main",children:"Bulk import progress is still available"}),(0,d.jsxs)("p",{className:"text-xs text-text-muted",children:["Status: ",bL.status," | Success: ",bL.summary?.success||0," | Running: ",bL.summary?.running||0," | Queued: ",bL.summary?.queued||0]})]}),(0,d.jsxs)("div",{className:"flex gap-2",children:[(0,d.jsx)(j.$n,{size:"sm",icon:"monitoring",variant:"secondary",onClick:()=>c.push(n("kiro")),children:"Resume Bulk Progress"}),aR(bL.status)&&(0,d.jsx)(j.$n,{size:"sm",variant:"ghost",icon:"close",onClick:b6,children:"Clear"})]})]}),"kiro"===g&&!bL?.jobId&&bN&&(0,d.jsx)("div",{className:"mb-4 rounded-lg border border-amber-200 bg-amber-50 px-4 py-3 text-sm text-amber-700 dark:border-amber-800 dark:bg-amber-900/20 dark:text-amber-300",children:bN}),db,"kiro"===g&&c8>1&&(0,d.jsxs)("div",{className:"mt-4 flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[(0,d.jsxs)("p",{className:"text-sm text-text-muted",children:["Page ",c9," of ",c8," • Showing ",(c9-1)*bR+1,"-",Math.min(c9*bR,cV.length)," of ",cV.length," connections"]}),(0,d.jsxs)("div",{className:"flex gap-2",children:[(0,d.jsx)(j.$n,{size:"sm",variant:"secondary",disabled:c9<=1,onClick:()=>bQ(a=>Math.max(1,a-1)),children:"Previous"}),(0,d.jsx)(j.$n,{size:"sm",variant:"secondary",disabled:c9>=c8,onClick:()=>bQ(a=>Math.min(c8,a+1)),children:"Next"})]})]}),"kiro"!==g&&cV.length>0&&(0,d.jsx)(j.dK,{currentPage:c9,pageSize:bR,totalItems:cV.length,onPageChange:bQ,onPageSizeChange:a=>{bS(a),bQ(1)},className:"mt-2"}),l.length>0&&0===cV.length&&(0,d.jsx)("div",{className:"py-8 text-center text-sm text-text-muted",children:"No connections match this status filter."}),(0,d.jsx)("div",{className:"mt-4",children:(0,d.jsx)(ay,{showAutomation:cn,showAddConnection:"none"!==cp.type,onOpenAutomation:b8,onAddConnection:c1,methods:"kiro"===g?null:cq,onSelectMethod:"kiro"===g?null:c2,extra:aP(g)?(0,d.jsx)(aQ,{providerId:g,onWebLoginConnected:cC,onBulkImport:()=>"codex"===g?P(!0):R(!0)}):null})})]})]}),(0,d.jsx)(aF,{providerId:g}),(0,d.jsxs)(j.Zp,{children:[(0,d.jsxs)("div",{className:"mb-4 flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between",children:[(0,d.jsxs)("div",{className:"flex items-center gap-3",children:[(0,d.jsx)("h2",{className:"text-lg font-semibold",children:"Available Models"}),ct&&(0,d.jsx)("select",{value:bc,onChange:a=>{var b;bd(b=a.target.value),cF(b)},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:ct.map(a=>(0,d.jsx)("option",{value:a,children:`Thinking: ${a.charAt(0).toUpperCase()+a.slice(1)}`},a))})]}),!cm&&(a=[...ci,...bm.filter(a=>!ci.some(b=>b.id===a.id))].filter(a=>!a.type||"llm"===a.type).map(a=>a.id).filter(a=>!bo.includes(a)),(0,d.jsxs)("div",{className:"flex gap-2",children:[bo.length>0&&(0,d.jsx)(j.$n,{size:"sm",variant:"secondary",icon:"restart_alt",onClick:cz,children:"Active All"}),a.length>0&&(0,d.jsx)(j.$n,{size:"sm",variant:"secondary",icon:"block",onClick:()=>cy(a),children:"Disable All"})]}))]}),Object.values(aD).some(Boolean)&&(0,d.jsx)("div",{className:"mb-3 flex flex-col gap-1",children:Object.entries(aD).filter(([,a])=>!!a).map(([a,b])=>(0,d.jsxs)("p",{className:"text-xs text-red-500 break-words",children:[a,": ",b]},a))}),(()=>{let a,b,c;if(cm)return(0,d.jsx)(F,{providerStorageAlias:cs,providerDisplayAlias:cu,modelAliases:aq,copied:b_,onCopy:b0,onSetAlias:cJ,onDeleteAlias:cL,onAliasesChanged:cB,connections:l,isAnthropic:cl});let e=[...ci,...bm.filter(a=>!ci.some(b=>b.id===a.id))].filter(a=>!a.type||"llm"===a.type),f=new Set(bo),h=e.filter(a=>!f.has(a.id)),i=e.filter(a=>f.has(a.id)),k=function({customModels:a=[],modelAliases:b={},providerAlias:c,builtInModels:d=[],type:e="llm",includeLegacyAliases:f=!0}){let g=new Set(d.map(a=>a.id)),h=new Set,i=[];for(let b of a){if(!b?.id||b.providerAlias!==c)continue;let a=b?.kind||b?.type||"llm";if(e&&a!==e||g.has(b.id))continue;let d=`${c}/${b.id}`;h.has(d)||(h.add(d),i.push({id:b.id,name:b.name||b.id,fullModel:d,source:"custom",type:a}))}if(!f)return i;let j=`${c}/`;for(let[a,c]of Object.entries(b||{})){if("string"!=typeof c||!c.startsWith(j))continue;let b=c.slice(j.length);!b||g.has(b)||h.has(c)||(h.add(c),i.push({id:b,alias:a,fullModel:c,source:"legacyAlias",type:e||"llm"}))}return i}({customModels:at,modelAliases:aq,providerAlias:cs,builtInModels:ci,type:"llm"}),m=Math.min(bX,Math.max(1,Math.ceil(h.length/bZ))),n=h.slice((m-1)*bZ,m*bZ);return(0,d.jsxs)("div",{className:"flex flex-wrap gap-3",children:[k.map(a=>(0,d.jsx)(C,{model:{id:a.id,name:a.name},fullModel:`${cu}/${a.id}`,alias:a.alias,copied:b_,onCopy:b0,onSetAlias:()=>{},onDeleteAlias:()=>{"custom"===a.source?cK(a.id,a.type||"llm"):cL(a.alias)},testStatus:az[a.id],onTest:l.length>0||cd?()=>de(a.id):void 0,isTesting:aG.has(a.id),isCustom:!0,isFree:!1,thinkingSuffix:cr(a.id)},`${a.source}-${a.fullModel}`)),n.map(a=>{let b=`${cs}/${a.id}`,c=`${g}/${a.id}`,e=Object.entries(aq).find(([,a])=>a===b||a===c)?.[0];return(0,d.jsx)(C,{model:a,fullModel:`${cu}/${a.id}`,alias:e,copied:b_,onCopy:b0,onSetAlias:b=>cJ(a.id,b,cs),onDeleteAlias:()=>cL(e),testStatus:az[a.id],onTest:l.length>0||cd?()=>de(a.id):void 0,isTesting:aG.has(a.id),isFree:a.isFree,onDisable:()=>cw(a.id),thinkingSuffix:cr(a.id)},a.id)}),h.length>bZ&&(0,d.jsx)("div",{className:"w-full",children:(0,d.jsx)(j.dK,{currentPage:m,pageSize:bZ,totalItems:h.length,onPageChange:bY,onPageSizeChange:a=>{b$(a),bY(1)}})}),(0,d.jsxs)("button",{onClick:()=>aJ(!0),className:"flex w-full items-center justify-center gap-1.5 rounded-lg border border-dashed border-primary/40 px-3 py-2 text-xs text-primary transition-colors hover:border-primary hover:bg-primary/5 sm:w-auto",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-sm",children:"add"}),"Add Model"]}),"codebuddy"===g&&(0,d.jsxs)("button",{onClick:()=>aL(!0),className:"flex w-full items-center justify-center gap-1.5 rounded-lg border border-dashed border-cyan-500/50 px-3 py-2 text-xs text-cyan-700 transition-colors hover:border-cyan-500 hover:bg-cyan-500/[0.07] dark:text-cyan-300 sm:w-auto",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-sm",children:"radar"}),"Discover Models"]}),("codebuddy-intl"===g||"codebuddy-cn"===g)&&(0,d.jsxs)("button",{onClick:()=>aT(!0),className:"live-probe-button",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-sm",children:"radar"}),"Live Probe Models"]}),"openrouter"===g&&(0,d.jsxs)("button",{type:"button",onClick:()=>aX(!0),className:"live-probe-button",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-sm",children:"radar"}),"Live Probe Models"]}),"opencode"===g&&(0,d.jsxs)("button",{onClick:()=>aV(!0),className:"live-probe-button",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-sm",children:"radar"}),"Live Probe Models"]}),"kiro"===g&&(0,d.jsxs)("button",{onClick:()=>aZ(!0),className:"live-probe-button",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-sm",children:"radar"}),"Live Probe Models"]}),"cloudflare-ai"===g&&(0,d.jsxs)("button",{onClick:()=>a_(!0),className:"live-probe-button",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-sm",children:"radar"}),"Live Probe Models"]}),"qoder"===g&&l.some(a=>!1!==a.isActive)&&(0,d.jsxs)("button",{onClick:cM,disabled:bJ,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,d.jsx)("span",{className:"material-symbols-outlined text-sm",style:bJ?{animation:"spin 1s linear infinite"}:void 0,children:bJ?"progress_activity":"download"}),bJ?(0,q.Tl)("Fetching..."):(0,q.Tl)("Fetch Qoder Models")]}),bk.length>0&&(a=new Set(Object.values(aq)),b=new Set(ci.map(a=>a.id)),0===(c=bk.filter(c=>!a.has(`${cs}/${c.id}`)&&!b.has(c.id))).length?null:(0,d.jsxs)("div",{className:"w-full mt-2",children:[(0,d.jsx)("p",{className:"text-xs text-text-muted mb-2",children:"Suggested free models (≥200k context):"}),(0,d.jsx)("div",{className:"flex flex-wrap gap-2",children:c.map(a=>(0,d.jsxs)("button",{onClick:async()=>{let b=a.id.split("/").pop();await cJ(a.id,b,cs)},className:"flex items-center gap-1 px-2.5 py-1.5 rounded-lg border border-black/10 dark:border-white/10 text-xs text-text-muted hover:text-primary hover:border-primary/40 hover:bg-primary/5 transition-colors",title:`${a.name} \xb7 ${(a.contextLength/1e3).toFixed(0)}k ctx`,children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[13px]",children:"add"}),a.id.split("/").pop()]},a.id))})]})),i.length>0&&(0,d.jsxs)("div",{className:"w-full mt-2",children:[(0,d.jsxs)("p",{className:"text-xs text-text-muted mb-2",children:["Disabled models (",i.length,"):"]}),(0,d.jsx)("div",{className:"flex flex-wrap gap-2",children:i.map(a=>(0,d.jsxs)("button",{onClick:()=>cx(a.id),className:"flex items-center gap-1 px-2.5 py-1.5 rounded-lg border border-dashed border-black/10 dark:border-white/10 text-xs text-text-muted hover:text-primary hover:border-primary/40 hover:bg-primary/5 transition-colors",title:"Restore model",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[13px]",children:"add"}),a.id]},a.id))})]})]})})()]}),am&&dd,$&&(0,d.jsx)(j.mz,{isOpen:!0,providerName:b9.name,methods:cq,onSelect:c2,onClose:()=>_(!1)}),"codex"===g&&(0,d.jsx)(aA,{isOpen:O,onClose:()=>P(!1),onSuccess:cC}),"grok-cli"===g&&(0,d.jsx)(aC,{isOpen:Q,onClose:()=>R(!1),onSuccess:cC}),M&&("kiro"===g?(0,d.jsx)(j.Mh,{isOpen:!0,providerInfo:b9,onSuccess:cP,onRefresh:cC,initialBulkJobId:bL?.jobId||null,onBulkJobChange:cQ,onClose:()=>N(!1)}):"cursor"===g?(0,d.jsx)(j.G9,{isOpen:!0,onSuccess:cP,onClose:()=>N(!1)}):"gitlab"===g?(0,d.jsx)(j.vj,{isOpen:!0,providerInfo:b9,onSuccess:cP,onClose:()=>N(!1)}):"xiaomi-mimo"===g?(0,d.jsx)(j.LH,{isOpen:!0,onSuccess:cP,onClose:()=>N(!1)}):(0,d.jsx)(j.LF,{isOpen:!0,provider:g,providerInfo:b9,onSuccess:cP,onClose:()=>N(!1)})),"iflow"===g&&T&&(0,d.jsx)(j.vE,{isOpen:!0,onSuccess:()=>{cC(),U(!1)},onClose:()=>U(!1)}),("codebuddy"===g||"codebuddy-cn"===g)&&V&&(0,d.jsx)(j.xl,{isOpen:!0,connectionIds:cZ,endpoint:"codebuddy-cn"===g?"/api/oauth/codebuddy-cn/quota-cookie":"/api/oauth/codebuddy/quota-cookie",onSuccess:()=>{cC(),Z(!1)},onClose:()=>Z(!1)}),aa&&(0,d.jsx)(W,{isOpen:!0,provider:g,providerName:b9.name,isCompatible:cm,isAnthropic:cl,authType:b9?.authType,authHint:b9?.authHint,website:b9?.website,proxyPools:J,existingNames:l.map(a=>a.name).filter(Boolean),error:ad,onSave:cR,onBulkDone:cC,onClose:()=>{ae(""),ac(!1)}}),ag&&ao&&(0,d.jsx)(j.wI,{isOpen:!0,connection:ao,proxyPools:J,onSave:cS,onClose:()=>ah(!1)}),cm&&ai&&(0,d.jsx)(X,{isOpen:!0,node:H,onSave:cD,onClose:()=>aj(!1),isAnthropic:cl}),!cm&&aI&&(0,d.jsx)(Y,{isOpen:!0,providerAlias:cs,providerDisplayAlias:cu,onSave:async a=>{let b=b9?.passthroughModels?a.split("/").pop():a;await cJ(a,b,cs),aJ(!1)},onClose:()=>aJ(!1)}),"codebuddy"===g&&aK&&(0,d.jsx)(ab,{isOpen:!0,connections:l,onModelsAdded:async a=>{for(let b of a)await cJ(b.id,b.id,"cb");await cB(),await cA()},onClose:()=>aL(!1)}),("codebuddy-intl"===g||"codebuddy-cn"===g)&&aM&&(0,d.jsx)(af,{isOpen:!0,providerId:g,connections:l,onModelsAdded:async a=>{let b="codebuddy-cn"===g?"cb-cn":"cbai";for(let c of a)await cJ(c.id,c.id,b);await cB(),await cA()},onClose:()=>aT(!1)}),"openrouter"===g&&aW&&(0,d.jsx)(al.A,{isOpen:!0,kind:"llm",connections:l,onModelsAdded:async a=>{for(let b of a)await cJ(b.id,b.id.split("/").pop(),"openrouter");await cB(),await cA()},onClose:()=>aX(!1)}),"opencode"===g&&aU&&(0,d.jsx)(ak,{isOpen:!0,onModelsAdded:async a=>{for(let b of a)await cJ(b.id,b.id,"oc");await cB(),await cA()},onClose:()=>aV(!1)}),"kiro"===g&&aY&&(0,d.jsx)(ar,{isOpen:!0,connections:l,onClose:()=>aZ(!1)}),"cloudflare-ai"===g&&a$&&(0,d.jsx)(ax,{isOpen:!0,connections:l,onModelsAdded:async a=>{for(let b of a)await cJ(b.id,b.id,cj);await cB()},onClose:()=>a_(!1)}),bi&&(0,d.jsx)(S,{isOpen:!0,connection:bi,reactive:!0===be[bi.id],schedule:bg[bi.id]||null,onClose:()=>bj(null),onSave:cI}),bs&&(0,d.jsx)(j.uo,{isOpen:!0,onClose:()=>bt(!1),onConfirm:()=>{bt(!1),bv(null),c0(bu||"oauth")},title:"Risk Notice",message:b9?.deprecationNotice,confirmText:"I Understand, Continue",cancelText:"Cancel",variant:"danger"}),bq&&(0,d.jsx)(j.uo,{isOpen:!0,onClose:()=>{a6||br(null)},onConfirm:async()=>{if(a6)return;let a=bq?.onConfirm;if(a){a7(!0);try{await a()}finally{a7(!1)}}},title:bq?.title||"Confirm",message:bq?.message,variant:"danger",loading:a6})]}):(0,d.jsxs)("div",{className:"text-center py-20",children:[(0,d.jsx)("p",{className:"text-text-muted",children:"Provider not found"}),(0,d.jsx)(h(),{href:"/dashboard/providers",className:"text-primary mt-4 inline-block",children:"Back to Providers"})]})}},46060:a=>{"use strict";a.exports=require("next/dist/shared/lib/no-fallback-error.external.js")},46293:a=>{"use strict";a.exports=require("sql.js")},48161:a=>{"use strict";a.exports=require("node:os")},49858:(a,b,c)=>{"use strict";c.r(b),c.d(b,{__next_app__:()=>x,handler:()=>z,routeModule:()=>y});var d=c(21635),e=c(86315),f=c(1020),g=c(61287),h={};for(let a in g)0>["default","__next_app__","routeModule","handler"].indexOf(a)&&(h[a]=()=>g[a]);c.d(b,h);let i=(0,d.p)(()=>Promise.resolve().then(c.bind(c,32059))),j=(0,d.p)(()=>Promise.resolve().then(c.t.bind(c,95547,23))),k=(0,d.p)(()=>Promise.resolve().then(c.t.bind(c,55091,23))),l=(0,d.p)(()=>Promise.resolve().then(c.t.bind(c,45270,23))),m=(0,d.p)(()=>Promise.resolve().then(c.t.bind(c,28193,23))),n=(0,d.p)(()=>Promise.resolve().then(c.bind(c,30508))),o=(0,d.p)(()=>Promise.resolve().then(c.t.bind(c,95547,23))),p=(0,d.p)(()=>Promise.resolve().then(c.t.bind(c,55091,23))),q=(0,d.p)(()=>Promise.resolve().then(c.t.bind(c,45270,23))),r=(0,d.p)(()=>Promise.resolve().then(c.t.bind(c,28193,23))),s=(0,d.p)(()=>Promise.resolve().then(c.t.bind(c,95547,23))),t=(0,d.p)(()=>Promise.resolve().then(c.t.bind(c,95547,23))),u=(0,d.p)(()=>Promise.resolve().then(c.t.bind(c,95547,23))),v={children:["",{children:["(dashboard)",{children:["dashboard",{children:["providers",{children:["[id]",{children:["__PAGE__",{},{page:[(0,d.p)(()=>Promise.resolve().then(c.bind(c,93110))),"/zevairouter-build/src/app/(dashboard)/dashboard/providers/[id]/page.js"]}]},{"global-error":[u,"next/dist/client/components/builtin/global-error.js"]},["new"]]},{"global-error":[t,"next/dist/client/components/builtin/global-error.js"]},[]]},{"global-error":[s,"next/dist/client/components/builtin/global-error.js"]},[]]},{layout:[n,"/zevairouter-build/src/app/(dashboard)/layout.js"],"global-error":[o,"next/dist/client/components/builtin/global-error.js"],"not-found":[p,"next/dist/client/components/builtin/not-found.js"],forbidden:[q,"next/dist/client/components/builtin/forbidden.js"],unauthorized:[r,"next/dist/client/components/builtin/unauthorized.js"],metadata:{icon:[],apple:[],openGraph:[],twitter:[],manifest:"/manifest.webmanifest"}},[]]},{layout:[i,"/zevairouter-build/src/app/layout.js"],"global-error":[j,"next/dist/client/components/builtin/global-error.js"],"not-found":[k,"next/dist/client/components/builtin/not-found.js"],forbidden:[l,"next/dist/client/components/builtin/forbidden.js"],unauthorized:[m,"next/dist/client/components/builtin/unauthorized.js"],metadata:{icon:[],apple:[],openGraph:[],twitter:[],manifest:"/manifest.webmanifest"}},[]]}.children,w=(0,e.H)({tree:v,page:"/(dashboard)/dashboard/providers/[id]/page",pathname:"/dashboard/providers/[id]",require:c,loadChunk:()=>Promise.resolve(),interopDefault:f.T}),x=w.__next_app__,y=w.routeModule,z=w.handler},51455:a=>{"use strict";a.exports=require("node:fs/promises")},53053:a=>{"use strict";a.exports=require("node:diagnostics_channel")},55511:a=>{"use strict";a.exports=require("crypto")},57075:a=>{"use strict";a.exports=require("node:stream")},57975:a=>{"use strict";a.exports=require("node:util")},58962:(a,b,c)=>{"use strict";c.d(b,{x6:()=>d.fetchJson,E2:()=>e,gs:()=>f});var d=c(86819);function e(a){if(!a)return null;let b=a.match(/\b([45]\d{2})\b/);return b?b[1]:"ERR"}function f(a){if(!a)return"";let b=Math.floor((Date.now()-new Date(a).getTime())/6e4);if(b<1)return"just now";if(b<60)return`${b}m ago`;let c=Math.floor(b/60);if(c<24)return`${c}h ago`;let d=Math.floor(c/24);return`${d}d ago`}},63033:a=>{"use strict";a.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},71553:a=>{"use strict";a.exports=require("node:dns/promises")},73024:a=>{"use strict";a.exports=require("node:fs")},73136:a=>{"use strict";a.exports=require("node:url")},73429:a=>{"use strict";a.exports=require("node:util/types")},75901:(a,b,c)=>{Promise.resolve().then(c.bind(c,44062))},75919:a=>{"use strict";a.exports=require("node:worker_threads")},76760:a=>{"use strict";a.exports=require("node:path")},77030:a=>{"use strict";a.exports=require("node:net")},77598:a=>{"use strict";a.exports=require("node:crypto")},78474:a=>{"use strict";a.exports=require("node:events")},79868:a=>{"use strict";a.exports=require("node:sqlite")},81787:a=>{"use strict";a.exports=require("bun:sqlite")},86819:(a,b,c)=>{"use strict";c.d(b,{fetchJson:()=>e});let d={"Content-Type":"application/json"};async function e(a,b={}){let{body:c,headers:f,...g}=b,h={...g,headers:{...d,...f}};void 0!==c&&"string"!=typeof c?h.body=JSON.stringify(c):void 0!==c&&(h.body=c);let i=await fetch(a,h),j=await i.text(),k=null;if(j)try{k=JSON.parse(j)}catch{let b=Error(`Non-JSON response from ${a} (HTTP ${i.status})`);throw b.status=i.status,b.rawBody=j.slice(0,300),b}if(!i.ok){let a=k&&(k.error?.message||k.error||k.message)||`Request failed (HTTP ${i.status})`,b=Error("string"==typeof a?a:`HTTP ${i.status}`);throw b.status=i.status,b.data=k,b}return k}e.get=(a,b)=>e(a,{...b,method:"GET"}),e.post=(a,b,c)=>e(a,{...c,method:"POST",body:b}),e.put=(a,b,c)=>e(a,{...c,method:"PUT",body:b}),e.patch=(a,b,c)=>e(a,{...c,method:"PATCH",body:b}),e.del=(a,b)=>e(a,{...b,method:"DELETE"})},87550:a=>{"use strict";a.exports=require("better-sqlite3")},87997:a=>{"use strict";a.exports=require("node:timers")},93110:(a,b,c)=>{"use strict";c.r(b),c.d(b,{default:()=>d});let d=(0,c(77943).registerClientReference)(function(){throw Error("Attempted to call the default export of \"/zevairouter-build/src/app/(dashboard)/dashboard/providers/[id]/page.js\" from the server, but it's on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"/zevairouter-build/src/app/(dashboard)/dashboard/providers/[id]/page.js","default")},94735:a=>{"use strict";a.exports=require("events")}};var b=require("../../../../../webpack-runtime.js");b.C(a);var c=b.X(0,[2970,7774,2430,940,2760,5905,4452,4686,4549,7973,24,5024,9548,7404,9188,267,412,2228,4073],()=>b(b.s=49858));module.exports=c})();
|
|
15
|
+
]`;function aC({isOpen:a,onClose:b,onSuccess:c}){let[f,g]=(0,e.useState)(""),[h,i]=(0,e.useState)(!1),[k,l]=(0,e.useState)(null),m=()=>{h||(l(null),b())},n=async()=>{let a;try{a=JSON.parse(f)}catch{l({error:"Paste a JSON account or an array of accounts"});return}i(!0),l(null);try{let b=await fetch("/api/oauth/grok-cli/json-import",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)}),d=await b.json();l(d.error?{error:d.error}:d),!d.error&&d.success>0&&c?.()}catch(a){l({error:a.message})}finally{i(!1)}},o=k&&!k.error?`Imported ${k.success}. Failed ${k.failed}.`:null;return(0,d.jsxs)(j.aF,{isOpen:a,onClose:m,title:"Import Grok CLI accounts",size:"lg",footer:(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(j.$n,{variant:"secondary",onClick:m,disabled:h,children:"Close"}),(0,d.jsx)(j.$n,{onClick:n,disabled:h||!f.trim(),children:h?"Importing...":"Import"})]}),children:[(0,d.jsx)("p",{className:"mb-3 text-xs text-text-muted",children:"Paste one account or an array. Snake_case and camelCase are both accepted. A refresh token is refreshed before it is stored. The response never returns the tokens. Line import stays on the automation page."}),(0,d.jsx)("textarea",{className:"w-full rounded-lg border border-border bg-background p-3 font-mono text-xs text-text-main placeholder:text-text-muted focus:border-primary focus:outline-none",rows:8,placeholder:aB,value:f,onChange:a=>g(a.target.value),disabled:h}),k?(0,d.jsx)("div",{className:`mt-3 rounded-lg p-3 text-xs ${k.error?"bg-red-500/10 text-red-400":"bg-green-500/10 text-green-400"}`,children:k.error||o}):null]})}aC.propTypes={isOpen:B().bool.isRequired,onClose:B().func.isRequired,onSuccess:B().func};let aD=["host","content-length","content-type","connection","transfer-encoding","authorization","cookie"],aE=/^[A-Za-z0-9-]+$/;function aF({providerId:a}){let b=(0,y.i)(),[c,f]=(0,e.useState)(!1),[g,h]=(0,e.useState)([{name:"",value:""}]),[i,k]=(0,e.useState)({}),[l,m]=(0,e.useState)(!1),[n,o]=(0,e.useState)(!1),p=(a,b,c)=>{h(d=>d.map((d,e)=>e===a?{...d,[b]:c}:d))},q=(0,e.useCallback)(async()=>{let c={};for(let a of g.filter(a=>a.name.trim())){let d=a.name.trim();if(!aE.test(d))return void b.error(`Invalid header name: ${d}`);if(aD.includes(d.toLowerCase()))return void b.error(`Header ${d} cannot be overridden`);if(d in c)return void b.error(`Duplicate header name: ${d}`);a.value!==i[d]&&(c[d]=a.value)}o(!0);try{let d=await fetch(`/api/providers/${a}/overrides`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({headers:c})});if(!d.ok){let a=await d.json().catch(()=>({}));b.error(a.error||"Failed to save");return}m(Object.keys(c).length>0),b.success("Custom headers saved")}finally{o(!1)}},[g,i,a,b]);return(0,d.jsxs)(j.Zp,{padding:"xs",children:[(0,d.jsxs)("button",{type:"button",onClick:()=>f(a=>!a),className:"flex w-full items-center justify-between text-left",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-primary text-[20px]",children:"tune"}),(0,d.jsx)("span",{className:"text-sm font-semibold",children:"Custom Headers"}),l&&(0,d.jsx)(j.Ex,{variant:"success",size:"sm",children:"Active"})]}),(0,d.jsx)("span",{className:"material-symbols-outlined text-text-muted",children:c?"expand_less":"expand_more"})]}),c&&(0,d.jsxs)("div",{className:"mt-3 border-t border-border pt-3",children:[(0,d.jsx)("div",{className:"flex flex-col gap-2",children:g.map((a,b)=>{let c=a.name.trim()in i&&a.value!==i[a.name.trim()];return(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)("input",{value:a.name,onChange:a=>p(b,"name",a.target.value),placeholder:"Header-Name",spellCheck:!1,className:"w-44 rounded-md border border-border bg-background px-2 py-1.5 text-sm focus:border-primary focus:outline-none"}),(0,d.jsx)("input",{value:a.value,onChange:a=>p(b,"value",a.target.value),placeholder:"Value",spellCheck:!1,title:c?"Overridden":a.name.trim()in i?"Registry default":"",className:`min-w-0 flex-1 rounded-md border bg-background px-2 py-1.5 text-sm focus:border-primary focus:outline-none ${c?"border-amber-400/60":"border-border"}`}),(0,d.jsx)("button",{type:"button",title:"Remove header",onClick:()=>h(a=>a.length>1?a.filter((a,c)=>c!==b):[{name:"",value:""}]),className:"shrink-0 text-text-muted hover:text-red-500",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"delete"})})]},b)})}),(0,d.jsxs)("div",{className:"mt-3 flex items-center justify-between gap-2",children:[(0,d.jsxs)("button",{type:"button",onClick:()=>h(a=>[...a,{name:"",value:""}]),className:"flex items-center gap-1 text-xs text-primary hover:underline",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"add"}),"Add header"]}),(0,d.jsxs)("div",{className:"flex gap-2",children:[(0,d.jsx)("button",{type:"button",disabled:n,onClick:()=>{h(Object.entries(i).map(([a,b])=>({name:a,value:b})))},className:"rounded-md border border-border px-3 py-1.5 text-xs hover:bg-black/[0.03] dark:hover:bg-white/[0.03] disabled:opacity-50",children:"Reset"}),(0,d.jsx)("button",{type:"button",disabled:n,onClick:q,className:"rounded-md bg-primary px-3 py-1.5 text-xs font-medium text-white hover:opacity-90 disabled:opacity-50",children:n?"Saving...":"Save"})]})]})]})]})}aF.propTypes={providerId:B().string.isRequired};var aG=c(41365);let aH="$HOME/.zevai/bin/zevai-aistudio-waa",aI=`OUT="${aH}" bash "$(npm root -g)/zevairouter/vendor/aistudio-waa/build.sh"`,aJ=`OUT="${aH}" bash vendor/aistudio-waa/build.sh`;function aK({value:a,copied:b,onCopy:c,id:e}){return(0,d.jsxs)("div",{className:"flex items-start gap-2 rounded-lg bg-sidebar px-3 py-2",children:[(0,d.jsx)("code",{className:"min-w-0 flex-1 whitespace-pre-wrap break-all text-xs font-mono text-text-main",children:a}),(0,d.jsxs)("button",{type:"button",onClick:()=>c(a,e),className:"inline-flex shrink-0 items-center gap-1 rounded-md bg-primary px-2 py-1 text-[11px] font-medium text-white hover:bg-primary/90","aria-label":`Copy: ${a}`,children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[13px]",children:b===e?"check":"content_copy"}),b===e?"Copied":"Copy"]})]})}function aL({n:a,title:b,children:c,variant:e="missing"}){return(0,d.jsxs)("li",{className:"flex gap-3",children:[(0,d.jsx)("span",{className:`flex size-6 shrink-0 items-center justify-center rounded-full text-xs font-semibold ${"ready"===e?"bg-emerald-500/15 text-emerald-800 dark:text-emerald-300":"bg-amber-500/15 text-amber-800 dark:text-amber-300"}`,children:a}),(0,d.jsxs)("div",{className:"min-w-0 flex-1 space-y-2",children:[(0,d.jsx)("p",{className:"ready"===e?"text-sm font-medium text-emerald-900 dark:text-emerald-200":"text-sm font-medium text-amber-900 dark:text-amber-200",children:b}),c]})]})}function aM({status:a,copied:b,copy:c,variant:e}){let f=a?.buildCommand||aI,g=a?.npmCommand||aI,h=a?.checkoutCommand||aJ,i="ready"===e?"text-xs text-emerald-800/80 dark:text-emerald-300/80":"text-xs text-amber-800 dark:text-amber-300";return(0,d.jsxs)("ol",{className:"space-y-4",children:[(0,d.jsxs)(aL,{n:1,variant:e,title:"Install prerequisites",children:[(0,d.jsx)("p",{className:i,children:"You need Go, git, curl, and a C/C++ compiler, plus about 1 GB of disk. The first build takes several minutes; later builds are much faster."}),(0,d.jsx)("p",{className:i,children:"macOS (git and curl come with the Command Line Tools):"}),(0,d.jsx)(aK,{id:"prereq-mac-clt",copied:b,onCopy:c,value:"xcode-select --install"}),(0,d.jsx)(aK,{id:"prereq-mac-go",copied:b,onCopy:c,value:"brew install go"}),(0,d.jsx)("p",{className:i,children:"Debian / Ubuntu:"}),(0,d.jsx)(aK,{id:"prereq-deb",copied:b,onCopy:c,value:"sudo apt install golang git curl build-essential"})]}),(0,d.jsxs)(aL,{n:2,variant:e,title:"Build the helper",children:[(0,d.jsxs)("p",{className:i,children:["Run this command. It writes the binary to the exact path this router looks for",a?.binPath?(0,d.jsxs)(d.Fragment,{children:[" (",(0,d.jsx)("code",{className:"font-mono",children:a.binPath}),")"]}):null,"."]}),(0,d.jsx)(aK,{id:"build-cmd",copied:b,onCopy:c,value:f}),g!==f&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("p",{className:i,children:"From an npm global install you can also run:"}),(0,d.jsx)(aK,{id:"build-npm",copied:b,onCopy:c,value:g})]}),h!==f&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("p",{className:i,children:"From a git checkout of the repo:"}),(0,d.jsx)(aK,{id:"build-checkout",copied:b,onCopy:c,value:h})]}),!a?.binPath&&(0,d.jsxs)("p",{className:i,children:["If this router uses a custom ",(0,d.jsx)("code",{className:"font-mono",children:"DATA_DIR"}),", set"," ",(0,d.jsx)("code",{className:"font-mono",children:"OUT=$DATA_DIR/bin/zevai-aistudio-waa"}),"."]})]}),(0,d.jsx)(aL,{n:3,variant:e,title:"No router restart needed",children:(0,d.jsx)("p",{className:i,children:"The helper starts on the next AI Studio request. Stay on this page and click Check again after the build finishes."})}),(0,d.jsx)(aL,{n:4,variant:e,title:"Add a connection",children:(0,d.jsxs)("p",{className:i,children:["Use ",(0,d.jsx)("strong",{children:"Login via Browser"}),", or paste the storage-state JSON of a signed-in aistudio.google.com session."]})})]})}function aN(){let[a,b]=(0,e.useState)(null),[c,f]=(0,e.useState)(!1),[g,h]=(0,e.useState)(!0),[i,j]=(0,e.useState)(!1),[k,l]=(0,e.useState)(0),{copied:m,copy:n}=(0,p.C)(2e3);if(g&&!a&&!c)return null;let o=c||!a?.present;return(0,d.jsx)("div",{className:"space-y-2",children:o?(0,d.jsxs)("div",{className:"flex flex-col gap-3 rounded-lg border border-amber-500/30 bg-amber-500/10 px-3 py-3",role:"status",children:[(0,d.jsxs)("div",{className:"flex items-start gap-2",children:[(0,d.jsx)("span",{className:"material-symbols-outlined mt-0.5 shrink-0 text-[16px] text-amber-500",children:"warning"}),(0,d.jsxs)("div",{className:"min-w-0 flex-1 space-y-1",children:[(0,d.jsx)("p",{className:"text-xs font-semibold text-amber-900 dark:text-amber-200",children:c?"Could not check the AI Studio helper":"AI Studio helper is not built yet"}),(0,d.jsx)("p",{className:"text-xs leading-relaxed text-amber-800 dark:text-amber-300",children:"The npm package ships the helper source only; the binary is not included. Build it once on this machine before adding a connection."})]}),(0,d.jsxs)("button",{type:"button",onClick:()=>l(a=>a+1),className:"inline-flex shrink-0 items-center gap-1 rounded-md border border-amber-500/40 px-2 py-1 text-[11px] font-medium text-amber-900 hover:bg-amber-500/10 dark:text-amber-200",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"refresh"}),"Check again"]})]}),(0,d.jsx)(aM,{status:a,copied:m,copy:n,variant:"missing"})]}):(0,d.jsxs)("div",{className:"flex flex-col gap-2 rounded-lg border border-emerald-500/30 bg-emerald-500/10 px-3 py-2",role:"status",children:[(0,d.jsxs)("div",{className:"flex items-start gap-2",children:[(0,d.jsx)("span",{className:"material-symbols-outlined mt-0.5 shrink-0 text-[16px] text-emerald-500",children:"check_circle"}),(0,d.jsxs)("p",{className:"min-w-0 flex-1 text-xs leading-relaxed text-emerald-800 dark:text-emerald-300",children:["Helper ready at ",(0,d.jsx)("code",{className:"font-mono",children:a.binPath}),". No rebuild needed unless you update the router."]}),(0,d.jsx)("button",{type:"button",onClick:()=>j(a=>!a),className:"inline-flex shrink-0 items-center gap-1 rounded-md border border-emerald-500/40 px-2 py-1 text-[11px] font-medium text-emerald-800 hover:bg-emerald-500/10 dark:text-emerald-200","aria-expanded":i,children:i?"Hide setup":"Setup steps"}),(0,d.jsxs)("button",{type:"button",onClick:()=>l(a=>a+1),className:"inline-flex shrink-0 items-center gap-1 rounded-md border border-emerald-500/40 px-2 py-1 text-[11px] font-medium text-emerald-800 hover:bg-emerald-500/10 dark:text-emerald-200",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"refresh"}),"Check again"]})]}),i&&(0,d.jsx)(aM,{status:a,copied:m,copy:n,variant:"ready"})]})})}aK.propTypes={value:B().string.isRequired,copied:B().string,onCopy:B().func.isRequired,id:B().string.isRequired},aL.propTypes={n:B().number.isRequired,title:B().string.isRequired,children:B().node,variant:B().oneOf(["missing","ready"])},aM.propTypes={status:B().shape({binPath:B().string,buildCommand:B().string,npmCommand:B().string,checkoutCommand:B().string}),copied:B().string,copy:B().func.isRequired,variant:B().oneOf(["missing","ready"])};let aO={claude:"claudeAutoPing",codex:"codexAutoPing"};function aP(a){return aG.w.has(a)||"codex"===a||"grok-cli"===a}function aQ({providerId:a,onWebLoginConnected:b,onBulkImport:c}){let e=[];return(aG.w.has(a)&&e.push((0,d.jsx)(aG.A,{providerId:a,onConnected:b},"web-login")),("codex"===a||"grok-cli"===a)&&e.push((0,d.jsx)(j.$n,{size:"sm",icon:"playlist_add",variant:"secondary",onClick:c,className:"w-full sm:w-auto",children:"Bulk Add"},"bulk-add")),e.length)?(0,d.jsx)(d.Fragment,{children:e}):null}function aR(a){return["completed","cancelled","failed"].includes(a)}async function aS(a){let b=new AbortController,c=window.setTimeout(()=>b.abort(),8e3);try{let c=await fetch(a,{cache:"no-store",signal:b.signal}),d=null;try{d=await c.json()}catch{d=null}return{response:c,data:d}}finally{window.clearTimeout(c)}}function aT(){let a,b=(0,f.useParams)(),c=(0,f.useRouter)(),g=b.id,[l,A]=(0,e.useState)([]),[B,D]=(0,e.useState)(!0),[E,G]=(0,e.useState)(""),[H,I]=(0,e.useState)(null),[J,L]=(0,e.useState)([]),[M,N]=(0,e.useState)(!1),[O,P]=(0,e.useState)(!1),[Q,R]=(0,e.useState)(!1),[T,U]=(0,e.useState)(!1),[V,Z]=(0,e.useState)(!1),[$,_]=(0,e.useState)(!1),[aa,ac]=(0,e.useState)(!1),[ad,ae]=(0,e.useState)(""),[ag,ah]=(0,e.useState)(!1),[ai,aj]=(0,e.useState)(!1),[am,an]=(0,e.useState)(!1),[ao,ap]=(0,e.useState)(null),[aq,as]=(0,e.useState)({}),[at,au]=(0,e.useState)([]),[av,aw]=(0,e.useState)(!1),[az,aB]=(0,e.useState)({}),[aD,aE]=(0,e.useState)({}),[aG,aH]=(0,e.useState)(()=>new Set),[aI,aJ]=(0,e.useState)(!1),[aK,aL]=(0,e.useState)(!1),[aM,aT]=(0,e.useState)(!1),[aU,aV]=(0,e.useState)(!1),[aW,aX]=(0,e.useState)(!1),[aY,aZ]=(0,e.useState)(!1),[a$,a_]=(0,e.useState)(!1),[a0,a1]=(0,e.useState)([]),[a2,a3]=(0,e.useState)("__none__"),[a4,a5]=(0,e.useState)(!1),[a6,a7]=(0,e.useState)(!1),[a8,a9]=(0,e.useState)(null),[ba,bb]=(0,e.useState)(""),[bc,bd]=(0,e.useState)("auto"),[be,bf]=(0,e.useState)({}),[bg,bh]=(0,e.useState)({}),[bi,bj]=(0,e.useState)(null),[bk,bl]=(0,e.useState)([]),[bm,bn]=(0,e.useState)([]),[bo,bp]=(0,e.useState)([]),[bq,br]=(0,e.useState)(null),[bs,bt]=(0,e.useState)(!1),[bu,bv]=(0,e.useState)(null),[bw,bx]=(0,e.useState)(!1),[by,bz]=(0,e.useState)(!1),[bA,bB]=(0,e.useState)(null),[bC,bD]=(0,e.useState)({}),[bE,bF]=(0,e.useState)(null),bG=(0,e.useRef)(!1),bH=(0,e.useRef)(null),bI=(0,e.useRef)("1"),[bJ,bK]=(0,e.useState)(!1),[bL,bM]=(0,e.useState)(null),[bN,bO]=(0,e.useState)(""),[bP,bQ]=(0,e.useState)(1),[bR,bS]=(0,e.useState)(20),[bT,bU]=(0,e.useState)("all"),[bV,bW]=(0,e.useState)(""),[bX,bY]=(0,e.useState)(1),[bZ,b$]=(0,e.useState)(20),{copied:b_,copy:b0}=(0,p.C)(),b1=(0,e.useRef)(0),b2=(0,e.useRef)([]),b3=(0,e.useRef)(!0),b4=(0,e.useRef)(null),b5=(0,y.i)(a=>a.error),b6=(0,e.useCallback)(()=>{bM(null),bO(""),b1.current=0},[]),b7=()=>{N(!0)},b8=()=>{"kiro"===g&&bL?.jobId&&aR(bL.status)&&b6(),c.push(n(g))},b9=H?{id:H.id,name:H.name||("anthropic-compatible"===H.type?"Anthropic Compatible":"OpenAI Compatible"),color:"anthropic-compatible"===H.type?"#D97757":"#10A37F",textIcon:"anthropic-compatible"===H.type?"AC":"OC",apiType:H.apiType,baseUrl:H.baseUrl,type:H.type}:k.zN[g]||k.fg[g]||k.IS[g]||k.nJ[g]||k.br[g],ca=!b9||H||(b9.serviceKinds??["llm"]).includes("llm")?b9:null,cb=ca?.authModes||[],cc=!!k.zN[g]||!!k.IS[g]||cb.includes("oauth"),cd=!!k.fg[g]||cb.includes("apikey"),ce=!!k.IS[g]?.noAuth,cf=(0,r.F)("kiro"===g),cg="aistudio"===g?l.filter(a=>!1!==a.isActive).map(a=>`${a.id}:${a.updatedAt||""}`).join(","):"",ch=(0,s.M)("aistudio"===g,cg),ci=(0,s.Q)(g,ch,(0,o.KC)(g)),cj="kiro"===g?cf:ci,ck=(0,k.wG)(g),cl=(0,k.mq)(g),cm=(0,k.gb)(g),cn=cl||cm,co=m(g),cp=function({providerId:a,providerInfo:b,isOAuth:c,supportsApiKeyAuth:d,isCompatible:e}){if(!b||b.noAuth||b.authModes?.includes("none"))return[];let f=[];for(let g of(c&&x(f,"oauth"),(d||e||"cookie"===b.authType||!c)&&x(f,"apikey"),v[a]||[]))x(f,g);return f.map(b=>{let c=u[b];return c?{...c,...w[a]?.[b]}:null}).filter(Boolean)}({providerId:g,providerInfo:ca,isOAuth:cc,supportsApiKeyAuth:cd,isCompatible:cl||cm}),cq=function(a,{specializedChooser:b=!1}={}){return a.length?b?{type:"specialized"}:1===a.length?{type:"method",methodId:a[0].id}:{type:"chooser"}:{type:"none"}}(cp,{specializedChooser:"kiro"===g}),cr=cp.map(a=>"quota-cookie"===a.id&&0===l.length?{...a,disabled:!0,description:"Add a CodeBuddy connection before attaching its quota cookie."}:a),cs=a=>{if(!bc||"auto"===bc)return null;let b=(0,z.kl)(g,a);return b&&b.includes(bc)?bc:null},ct=cn?g:ck,cu=(()=>{let a=new Set,b=new Set,c=c=>{if(!c||b.has(c))return;b.add(c);let d=(0,z.kl)(g,c);d&&d.forEach(b=>{"none"!==b&&a.add(b)})};for(let a of cj)c(a.id);for(let a of bm)c(a.id);for(let a of at)a.providerAlias===ct&&"llm"===(a.kind||a.type||"llm")&&c(a.id);return a.size?["auto",...a]:null})(),cv=cn?H?.prefix||g:ck,cw=(0,e.useCallback)(async()=>{try{let a=await fetch(`/api/models/disabled?providerAlias=${encodeURIComponent(ct)}`,{cache:"no-store"}),b=await a.json();a.ok&&bp(b.ids||[])}catch(a){console.log("Error fetching disabled models:",a)}},[ct]),cx=async a=>{try{(await fetch("/api/models/disabled",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({providerAlias:ct,ids:[a]})})).ok&&await cw()}catch(a){console.log("Error disabling model:",a)}},cy=async a=>{try{(await fetch(`/api/models/disabled?providerAlias=${encodeURIComponent(ct)}&id=${encodeURIComponent(a)}`,{method:"DELETE"})).ok&&await cw()}catch(a){console.log("Error enabling model:",a)}},cz=async a=>{a.length&&br({title:"Disable All Models",message:`Disable all ${a.length} model(s)?`,onConfirm:async()=>{br(null);try{(await fetch("/api/models/disabled",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({providerAlias:ct,ids:a})})).ok&&await cw()}catch(a){console.log("Error disabling all models:",a)}}})},cA=async()=>{try{(await fetch(`/api/models/disabled?providerAlias=${encodeURIComponent(ct)}`,{method:"DELETE"})).ok&&await cw()}catch(a){console.log("Error enabling all models:",a)}},cB=(0,e.useCallback)(async()=>{try{let a=await fetch("/api/models/custom",{cache:"no-store"}),b=await a.json();a.ok&&au(b.models||[])}catch(a){console.log("Error fetching custom models:",a)}},[]),cC=(0,e.useCallback)(async()=>{try{let a=await fetch("/api/models/alias"),b=await a.json();a.ok&&as(b.aliases||{})}catch(a){console.log("Error fetching aliases:",a)}},[]),cD=(0,e.useCallback)(async()=>{try{G("");let[a,b,c,d]=await Promise.allSettled([aS("/api/providers"),aS("/api/provider-nodes"),aS("/api/proxy-pools?isActive=true"),aS("/api/settings")]),e="fulfilled"===a.status?a.value.response:null,f="fulfilled"===a.status?a.value.data:{},h="fulfilled"===b.status?b.value.response:null,i="fulfilled"===b.status?b.value.data:{},j="fulfilled"===c.status?c.value.response:null,l="fulfilled"===c.status?c.value.data:{},m="fulfilled"===d.status?d.value.response:null,n=m?.ok&&d.value.data||{};if(e?.ok){let a=(f.connections||[]).filter(a=>a.provider===g);b2.current=a,A(a)}else G("Connections could not be loaded.");j?.ok&&L(l.proxyPools||[]);let o=(n.providerStrategies||{})[g]||{};a9(o.fallbackStrategy||null),bb(null!=o.stickyRoundRobinLimit?String(o.stickyRoundRobinLimit):"1"),bI.current=null!=o.stickyRoundRobinLimit?String(o.stickyRoundRobinLimit):"1";let p=(n.providerThinking||{})[g]||{};bd(p.mode||"auto");let q=aO[g];if(bf(q&&n?.[q]?.connections||{}),bh(q&&n?.[q]?.schedules||{}),h?.ok){let a=(i.nodes||[]).find(a=>a.id===g)||null;if(!a&&((0,k.mq)(g)||(0,k.gb)(g)))for(let b=0;b<3;b+=1){if(await new Promise(a=>setTimeout(a,150)),!b3.current)return;let{response:b,data:c}=await aS("/api/provider-nodes");if(!b3.current)return;if(b.ok&&(a=(c.nodes||[]).find(a=>a.id===g)||null))break}I(a)}}catch(a){console.log("Error fetching connections:",a),b3.current&&G("Connections could not be loaded.")}finally{b3.current&&D(!1)}},[g]),cE=async a=>{try{let b=await fetch(`/api/provider-nodes/${g}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)}),c=await b.json();b.ok&&(I(c.node),await cD(),aj(!1))}catch(a){console.log("Error updating provider node:",a)}},cF=async(a,b)=>{try{let c=await fetch("/api/settings",{cache:"no-store"}),d=(c.ok?await c.json():{}).providerStrategies||{},e={};a&&(e.fallbackStrategy=a),"round-robin"===a&&""!==b&&(e.stickyRoundRobinLimit=Number(b)||3);let f={...d};0===Object.keys(e).length?delete f[g]:f[g]=e,await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({providerStrategies:f})})}catch(a){console.log("Error saving provider strategy:",a)}},cG=async a=>{try{let b=await fetch("/api/settings",{cache:"no-store"}),c={...(b.ok?await b.json():{}).providerThinking||{}};a&&"auto"!==a?c[g]={mode:a}:delete c[g],await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({providerThinking:c})})}catch(a){console.log("Error saving thinking config:",a)}},cH=async(a,b)=>{try{(await fetch(`/api/providers/${a}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({providerSpecificData:{paidSubscription:b}})})).ok&&A(c=>c.map(c=>c.id===a?{...c,providerSpecificData:{...c.providerSpecificData,paidSubscription:b}}:c))}catch(a){console.log("Error updating paid flag:",a)}},cI=async(a,b)=>{let c=aO[g];if(!c)return;let d={...be,[a]:b};bf(d);try{let a=await fetch("/api/settings",{cache:"no-store"}),b={...(a.ok?await a.json():{})[c]||{},connections:d};if(!(await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({[c]:b})})).ok)throw Error("Failed to save auto-ping setting")}catch(a){bf(be),console.log("Error saving auto-ping config:",a)}},cJ=async({reactive:a,schedule:b})=>{let c=aO[g];if(!bi||!c)return;let d={...be,[bi.id]:a},e={...bg,[bi.id]:b};bf(d),bh(e);try{let a=await fetch("/api/settings",{cache:"no-store"}),b=a.ok?await a.json():{};if(!(await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({[c]:{...b[c]||{},connections:d,schedules:e}})})).ok)throw Error("Failed to save auto-ping schedule")}catch(a){bf(be),bh(bg),console.log("Error saving auto-ping schedule:",a)}},cK=async(a,b,c=ck)=>{let d=`${c}/${a}`;try{let a=await fetch("/api/models/alias",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({model:d,alias:b})});if(a.ok)await cC();else{let b=await a.json();alert(b.error||"Failed to set alias")}}catch(a){console.log("Error setting alias:",a)}},cL=async(a,b="llm")=>{try{let c=new URLSearchParams({providerAlias:ct,id:a,type:b});(await fetch(`/api/models/custom?${c}`,{method:"DELETE"})).ok&&(await cB(),window.dispatchEvent(new CustomEvent("customModelChanged")))}catch(a){console.log("Error deleting custom model:",a)}},cM=async a=>{try{(await fetch(`/api/models/alias?alias=${encodeURIComponent(a)}`,{method:"DELETE"})).ok&&await cC()}catch(a){console.log("Error deleting alias:",a)}},cN=async()=>{if(bJ)return;let a=l.find(a=>!1!==a.isActive);if(!a)return void alert((0,q.Tl)("Please add an active Qoder connection first"));bK(!0);try{let b=await fetch(`/api/providers/${a.id}/models`),c=await b.json();if(!b.ok)return void alert(c.error||(0,q.Tl)("Failed to fetch models"));let d=c.models||[];if(0===d.length)return void alert((0,q.Tl)("No models returned"));let e={...aq},f=0;for(let a of d){let b=a.id||a.name;if(!b)continue;let c=b.replace(/^qoder\//,""),d=`${ct}/${c}`;!Object.values(e).includes(d)&&(e[c]||(await cK(c,c,ct),e[c]=d,f+=1))}0===f?alert((0,q.Tl)("All models already exist, no new models added")):alert((0,q.Tl)("Successfully added")+` ${f} `+(0,q.Tl)("models"))}catch(a){console.log("Error importing Qoder models:",a),alert((0,q.Tl)("Error fetching models")+": "+a.message)}finally{bK(!1)}},cO=async()=>{let a=[...l];if(bw||0===a.length)return;let b=Object.fromEntries(a.map(a=>[a.id,{state:"queued",error:null}]));bG.current=!1,bx(!0),bz(!1),bB(null),bD(b),bF({total:a.length,completed:0,passed:0,failed:0,stopped:!1});let c=0,d=0;try{for(let b=0;b<a.length;b+=1){if(bG.current){bF({total:a.length,completed:b,passed:c,failed:d,stopped:!0});break}let e=a[b];if(!b2.current.some(a=>a.id===e.id)){bD(a=>({...a,[e.id]:{state:"skipped",error:null}})),bF({total:a.length,completed:b+1,passed:c,failed:d,stopped:!1});continue}bB(e.id),bD(a=>({...a,[e.id]:{state:"testing",error:null}}));try{let a=await fetch(`/api/providers/${e.id}/test`,{method:"POST"}),b=await a.json(),f=!!b.valid;f?c+=1:d+=1,bD(a=>({...a,[e.id]:{state:f?"success":"failed",error:f?b.warning||null:b.error||null}}))}catch(a){d+=1,bD(b=>({...b,[e.id]:{state:"failed",error:a.message||"Test failed"}}))}bF({total:a.length,completed:b+1,passed:c,failed:d,stopped:!1}),b<a.length-1&&await new Promise(a=>setTimeout(a,250))}}finally{bB(null),bx(!1),bz(!1),bG.current=!1}},cP=async a=>{br({title:"Delete Connection",message:"Delete this connection?",onConfirm:async()=>{br(null);try{(await fetch(`/api/providers/${a}`,{method:"DELETE"})).ok&&A(l.filter(b=>b.id!==a))}catch(a){console.log("Error deleting connection:",a)}}})},cQ=()=>{cD(),N(!1)},cR=(0,e.useCallback)(a=>{bM(a),bO("")},[b6]),cS=async a=>{ae("");try{let b=await fetch("/api/providers",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:g,...a})}),c=null;try{c=await b.json()}catch{c=null}if(b.ok){await cD(),ac(!1);return}ae(c?.error||"Failed to save connection")}catch(a){console.log("Error saving connection:",a),ae("Failed to save connection")}},cT=async a=>{try{(await fetch(`/api/providers/${ao.id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)})).ok&&(await cD(),ah(!1))}catch(a){console.log("Error updating connection:",a)}},cU=async(a,b)=>{try{let c=await fetch(`/api/providers/${a}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({isActive:b})});if(c.ok){let d=await c.json().catch(()=>null);A(c=>c.map(c=>c.id===a?{...c,isActive:b,...d?.connection||{}}:c))}}catch(a){console.log("Error updating connection status:",a)}},cV=async(a,b)=>{let c=[...l];[c[a],c[b]]=[c[b],c[a]],A(c);try{let[d,e]=await Promise.all([fetch(`/api/providers/${c[a].id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({priority:a+1})}),fetch(`/api/providers/${c[b].id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({priority:b+1})})]);d.ok&&e.ok||(console.log("Priority swap rejected:",d.status,e.status),await cD())}catch(a){console.log("Error swapping priority:",a),await cD()}},cW=(0,e.useMemo)(()=>{let a=bV.trim().toLowerCase();return l.filter(b=>!!(0,t.i2)(b,bT)&&(!a||[b.name,b.email,b.id,b.account,b.username,b.label,b.authType,b.notes,b.proxyPoolId].filter(Boolean).join(" ").toLowerCase().includes(a)))},[l,bT,bV]),cX=(0,e.useMemo)(()=>t.gJ.reduce((a,b)=>(a[b.id]="all"===b.id?l.length:l.filter(a=>(0,t.i2)(a,b.id)).length,a),{}),[l]),cY=a0.filter(a=>l.some(b=>b.id===a)),cZ=l.filter(a=>cY.includes(a.id)),c$="codebuddy"===g||"codebuddy-cn"===g?(cZ.length>0?cZ:l).map(a=>a.id):[],c_=cW.length>0&&cW.every(a=>cY.includes(a.id)),c0=a=>{switch(a){case"oauth":b7();return;case"apikey":ae(""),ac(!0);return;case"cookie":U(!0);return;case"quota-cookie":l.length>1&&0===cZ.length?alert("Select the CodeBuddy connection(s) that should use this quota cookie first."):Z(!0);return;default:b5(`Unsupported connection method: ${a}`,"Add Connection")}},c1=a=>{null!==b4.current&&window.cancelAnimationFrame(b4.current),b4.current=window.requestAnimationFrame(()=>{b4.current=null,c0(a)})},c2=()=>{"specialized"===cq.type?b7():"method"===cq.type?c0(cq.methodId):"chooser"===cq.type&&_(!0)},c3=a=>{_(!1),c1(a)},c4=(()=>{if(0===cZ.length)return"";let a=new Set(cZ.map(a=>a.providerSpecificData?.proxyPoolId||"__none__"));if(1===a.size){let b=[...a][0];if("__none__"===b)return"All selected currently unbound";let c=J.find(a=>a.id===b);return`All selected currently bound to ${c?.name||b}`}return"Selected connections have mixed proxy bindings"})(),c5=()=>{a4||an(!1)},c6=async a=>{a5(!0);try{let b=0,c=0,d=Array.from({length:Math.min(8,a.length)},async()=>{for(;c<a.length;){let d=c;c+=1;let{connectionId:e,proxyPoolId:f}=a[d];try{(await fetch(`/api/providers/${e}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({proxyPoolId:f})})).ok||(b+=1)}catch(a){console.log("Error applying proxy for",e,a),b+=1}}});await Promise.all(d),b>0&&alert(`Updated with ${b} failed request(s).`),await cD(),an(!1)}finally{a5(!1)}},c7=a=>c6(cZ.map(b=>({connectionId:b.id,proxyPoolId:a}))),c8=a=>{let b="gsuite"===a?"GSuite (non-Gmail)":"Gmail (@gmail.com)";br({title:`Delete ${b}`,message:`Delete ALL ${b} accounts for this provider? This cannot be undone.`,onConfirm:async()=>{br(null);try{(await fetch("/api/providers/bulk-delete",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:ca?.id||g,emailFilter:a})})).ok&&(a1([]),await cD())}catch(a){console.error("bulk delete error:",a)}}})},c9=Math.max(1,Math.ceil(cW.length/bR)),da=Math.min(bP,c9),db=cW.slice((da-1)*bR,da*bR),dc=(0,d.jsx)("div",{className:"flex min-w-0 flex-col divide-y divide-black/[0.03] dark:divide-white/[0.03]",children:db.map((a,b)=>{let c,e=l.findIndex(b=>b.id===a.id);return(0,d.jsxs)("div",{className:"flex min-w-0 items-stretch",children:[(0,d.jsx)("label",{className:"flex w-8 shrink-0 items-center justify-center",children:(0,d.jsx)("input",{type:"checkbox",checked:(c=a.id,cY.includes(c)),onChange:()=>{var b;return b=a.id,void a1(a=>a.includes(b)?a.filter(a=>a!==b):[...a,b])},className:"size-4 rounded border-black/20 dark:border-white/20","aria-label":`Select ${a.name||a.email||a.id}`})}),(0,d.jsx)("div",{className:"flex-1 min-w-0",children:(0,d.jsx)(K,{connection:a,proxyPools:J,isOAuth:cc,isFirst:0===e,isLast:e===l.length-1,onMoveUp:()=>cV(e,e-1),onMoveDown:()=>cV(e,e+1),onToggleActive:b=>cU(a.id,b),autoPingEnabled:!0===be[a.id],onToggleAutoPing:aO[g]&&"oauth"===a.authType?b=>cI(a.id,b):void 0,autoPingScheduled:bg[a.id]?.enabled===!0,onOpenAutoPingSchedule:aO[g]&&"oauth"===a.authType?()=>bj(a):void 0,onTogglePaid:"antigravity"===g?b=>cH(a.id,b):void 0,onUpdateProxy:async b=>{try{(await fetch(`/api/providers/${a.id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({proxyPoolId:b||null})})).ok&&A(c=>c.map(c=>c.id===a.id?{...c,providerSpecificData:{...c.providerSpecificData,proxyPoolId:b||null}}:c))}catch(a){console.log("Error updating proxy:",a)}},onEdit:()=>{ap(a),ah(!0)},onDelete:()=>cP(a.id),oneByOneStatus:bC[a.id]||null})})]},a.id)})}),dd=J.filter(a=>!0===a.isActive),de=(0,d.jsx)(j.aF,{isOpen:am,onClose:c5,title:`Apply Proxy (${cZ.length} selected)`,children:(0,d.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,d.jsxs)("div",{className:"flex flex-col",children:[(0,d.jsxs)("button",{onClick:()=>{let a=J.filter(a=>!0===a.isActive);return 0===a.length?void alert("No active proxy pools available."):c6(cZ.map((b,c)=>({connectionId:b.id,proxyPoolId:a[c%a.length].id})))},disabled:a4||0===dd.length,className:"flex items-center gap-2 rounded-lg px-3 py-2 text-left transition-colors hover:bg-black/[0.04] dark:hover:bg-white/[0.04] disabled:cursor-not-allowed disabled:opacity-50",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[18px]",children:"sync_alt"}),(0,d.jsx)("span",{className:"text-sm text-text-main",children:"One-to-one (rotate)"})]}),(0,d.jsxs)("button",{onClick:()=>c7(null),disabled:a4,className:"flex items-center gap-2 rounded-lg px-3 py-2 text-left transition-colors hover:bg-black/[0.04] dark:hover:bg-white/[0.04] disabled:cursor-not-allowed disabled:opacity-50",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[18px]",children:"link_off"}),(0,d.jsx)("span",{className:"text-sm text-text-main",children:"None (unbind all)"})]}),J.map(a=>(0,d.jsxs)("button",{onClick:()=>c7(a.id),disabled:a4||!0!==a.isActive,className:"flex items-center gap-2 rounded-lg px-3 py-2 text-left transition-colors hover:bg-black/[0.04] dark:hover:bg-white/[0.04] disabled:cursor-not-allowed disabled:opacity-50",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[18px]",children:"lan"}),(0,d.jsx)("span",{className:"truncate text-sm text-text-main",children:a.name}),!0!==a.isActive&&(0,d.jsx)("span",{className:"text-[10px] text-text-muted",children:"(inactive)"})]},a.id))]}),a4&&(0,d.jsx)("p",{className:"text-xs text-text-muted",children:"Applying..."}),(0,d.jsx)(j.$n,{onClick:c5,variant:"ghost",fullWidth:!0,disabled:a4,children:"Cancel"})]})}),df=async a=>{aH(b=>new Set(b).add(a));try{let b=await fetch("/api/models/test",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({model:`${ct}/${a}`})}),c=await b.json();aB(b=>({...b,[a]:c.ok?"ok":"error"})),aE(b=>({...b,[a]:c.ok?"":c.error||"Model not reachable"}))}catch{aB(b=>({...b,[a]:"error"})),aE(b=>({...b,[a]:"Network error"}))}finally{aH(b=>{let c=new Set(b);return c.delete(a),c})}};return B?(0,d.jsxs)("div",{className:"flex flex-col gap-8",children:[(0,d.jsx)(j.Qv,{}),(0,d.jsx)(j.Qv,{})]}):ca?(0,d.jsxs)("div",{className:"flex min-w-0 flex-col gap-6 px-1 sm:gap-8 sm:px-0",children:[(0,d.jsxs)("div",{className:"min-w-0",children:[(0,d.jsxs)(h(),{href:"/dashboard/providers",className:"inline-flex items-center gap-1 text-sm text-text-muted hover:text-primary transition-colors mb-4",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-lg",children:"arrow_back"}),"Back to Providers"]}),(0,d.jsxs)("div",{className:"flex min-w-0 items-center gap-3 sm:gap-4",children:[(0,d.jsx)("div",{className:"flex size-12 shrink-0 items-center justify-center rounded-lg",style:{backgroundColor:`${ca.color}15`},children:av?(0,d.jsx)("span",{className:"text-sm font-bold",style:{color:ca.color},children:ca.textIcon||ca.id.slice(0,2).toUpperCase()}):(0,d.jsx)(i.A,{src:cl&&ca.apiType?"responses"===ca.apiType?"/providers/oai-r.png":"/providers/oai-cc.png":cm?"/providers/anthropic-m.png":`/providers/${ca.id}.png`,alt:ca.name,width:48,height:48,className:"max-h-12 max-w-12 rounded-lg object-contain",sizes:"48px",onError:()=>aw(!0)})}),(0,d.jsxs)("div",{className:"min-w-0",children:[(0,d.jsxs)("div",{className:"flex items-center gap-3 flex-wrap",children:[(0,d.jsx)("h1",{className:"truncate text-2xl font-semibold tracking-tight sm:text-3xl",children:ca.name}),(ca.notice?.apiKeyUrl||ca.notice?.signupUrl||ca.website)&&(0,d.jsxs)("a",{href:ca.notice?.apiKeyUrl||ca.notice?.signupUrl||ca.website,target:"_blank",rel:"noopener noreferrer",className:"text-xs text-primary hover:underline inline-flex items-center gap-1",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-sm",children:"open_in_new"}),ca.notice?.apiKeyUrl?"Get API Key":"Sign up / Learn more"]})]}),(0,d.jsxs)("p",{className:"text-text-muted",children:[l.length," connection",1===l.length?"":"s"]})]})]})]}),ca.deprecated&&(0,d.jsxs)("div",{className:"flex items-center gap-2 px-3 py-2 rounded-lg bg-yellow-500/10 border border-yellow-500/30",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[16px] text-yellow-500 mt-0.5 shrink-0",children:"warning"}),(0,d.jsx)("p",{className:"text-xs text-red-600 dark:text-yellow-400 leading-relaxed",children:ca.deprecationNotice})]}),ca.notice?.text&&!ca.deprecated&&(0,d.jsxs)("div",{className:"flex flex-col gap-2 rounded-lg border border-blue-500/30 bg-blue-500/10 px-3 py-2 sm:flex-row sm:items-center",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[16px] text-blue-500 shrink-0",children:"info"}),(0,d.jsx)("p",{className:"min-w-0 flex-1 text-xs leading-relaxed text-blue-600 dark:text-blue-400",children:ca.notice.text}),ca.notice.apiKeyUrl&&(0,d.jsx)("a",{href:ca.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 →"})]}),"aistudio"===g&&(0,d.jsx)(aN,{}),cn&&H&&(0,d.jsx)(j.Zp,{children:(0,d.jsxs)("div",{className:"mb-4 flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between",children:[(0,d.jsxs)("div",{className:"min-w-0",children:[(0,d.jsx)("h2",{className:"text-lg font-semibold",children:cm?"Anthropic Compatible Details":"OpenAI Compatible Details"}),(0,d.jsxs)("p",{className:"break-all text-sm text-text-muted",children:[cm?"Messages API":"responses"===H.apiType?"Responses API":"Chat Completions"," \xb7 ",(H.baseUrl||"").replace(/\/$/,""),"/",cm?"messages":"responses"===H.apiType?"responses":"chat/completions"]})]}),(0,d.jsxs)("div",{className:"grid grid-cols-1 gap-2 sm:flex sm:items-center",children:[(0,d.jsx)(j.$n,{size:"sm",icon:"add",onClick:()=>{ae(""),ac(!0)},className:"w-full sm:w-auto",children:"Add API Key"}),(0,d.jsx)(j.$n,{size:"sm",variant:"secondary",icon:"edit",onClick:()=>aj(!0),className:"w-full sm:w-auto",children:"Edit"}),(0,d.jsx)(j.$n,{size:"sm",variant:"secondary",icon:"delete",onClick:async()=>{br({title:"Delete Compatible Node",message:`Delete this ${cm?"Anthropic":"OpenAI"} Compatible node?`,onConfirm:async()=>{br(null);try{(await fetch(`/api/provider-nodes/${g}`,{method:"DELETE"})).ok&&c.push("/dashboard/providers")}catch(a){console.log("Error deleting provider node:",a)}}})},className:"w-full sm:w-auto",children:"Delete"})]})]})}),ce?(0,d.jsx)(j.gw,{providerId:g}):(0,d.jsxs)(j.Zp,{children:[(0,d.jsxs)("div",{className:"mb-4 flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[(0,d.jsx)("h2",{className:"text-lg font-semibold",children:"Connections"}),(0,d.jsxs)("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:gap-4",children:[l.length>0&&J.length>0&&(0,d.jsx)(j.$n,{size:"sm",variant:"secondary",icon:"lan",onClick:()=>{if(0===cZ.length)return;let a=[...new Set(cZ.map(a=>a.providerSpecificData?.proxyPoolId||"__none__"))];a3(1===a.length?a[0]:"__none__"),an(!0)},disabled:0===cZ.length,children:"Apply Proxy"}),l.length>0&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(j.$n,{size:"sm",variant:"secondary",icon:"sync",onClick:cO,disabled:bw,children:bw?"Testing Connection One-by-One...":"Test Connection One-by-One"}),bw&&(0,d.jsx)(j.$n,{size:"sm",variant:"ghost",icon:"stop",onClick:()=>{bw&&(bG.current=!0,bz(!0))},disabled:by,children:by?"Stopping...":"Stop"})]}),(0,d.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,d.jsx)("span",{className:"text-xs text-text-muted font-medium",children:"Round Robin"}),(0,d.jsx)(j.lM,{checked:"round-robin"===a8,onChange:a=>{let b=a?"round-robin":null,c=a?ba||"1":ba;a&&!ba&&bb("1"),bI.current=c,bH.current&&(clearTimeout(bH.current),bH.current=null),a9(b),cF(b,c)}}),"round-robin"===a8&&(0,d.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,d.jsx)("span",{className:"text-xs text-text-muted",children:"Sticky:"}),(0,d.jsx)("input",{type:"number",min:1,value:ba,onChange:a=>{var b;bb(b=a.target.value),bI.current=b,bH.current&&clearTimeout(bH.current),bH.current=setTimeout(()=>{cF("round-robin",bI.current)},500)},placeholder:"1",className:"w-14 px-2 py-1 text-xs border border-border rounded-md bg-background focus:outline-none focus:border-primary"})]})]})]})]}),l.length>0&&(0,d.jsxs)("div",{className:"mb-4 flex flex-col gap-3 rounded-lg border border-black/5 bg-black/[0.02] p-3 dark:border-white/5 dark:bg-white/[0.02]",children:[(0,d.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,d.jsxs)("label",{className:"flex items-center gap-1.5 text-xs text-text-muted",children:[(0,d.jsx)("input",{type:"checkbox",checked:c_,onChange:()=>{c_?a1(a=>a.filter(a=>!cW.some(b=>b.id===a))):a1(a=>Array.from(new Set([...a,...cW.map(a=>a.id)])))},className:"size-4 rounded border-black/20 dark:border-white/20"}),c_?"Unselect visible":"Select visible"]}),(0,d.jsxs)(j.Ex,{variant:"default",children:[cW.length," visible"]}),cZ.length>0&&(0,d.jsxs)(j.Ex,{variant:"default",children:[cZ.length," selected"]}),c4&&(0,d.jsx)("span",{className:"text-xs text-text-muted",children:c4}),cZ.length>0&&(0,d.jsx)(j.$n,{size:"sm",variant:"ghost",onClick:()=>{a1([]),a3("__none__")},children:"Clear"}),cZ.length>0&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)(j.$n,{size:"sm",variant:"secondary",icon:"delete",onClick:()=>{0!==cZ.length&&br({title:"Delete Selected Connections",message:`Delete ${cZ.length} selected connection(s)? This permanently removes the selected accounts.`,onConfirm:async()=>{br(null);let a=[],b=0;for(let c of cZ)try{(await fetch(`/api/providers/${c.id}`,{method:"DELETE"})).ok?a.push(c.id):b+=1}catch(a){console.log("Error deleting selected connection:",a),b+=1}a1(b=>b.filter(b=>!a.includes(b))),b>0&&alert(`Deleted ${a.length} connection(s); ${b} failed.`),await cD()}})},children:["Delete Selected (",cZ.length,")"]}),(0,d.jsx)(j.$n,{size:"sm",variant:"secondary",icon:"domain",onClick:()=>c8("gsuite"),children:"Delete GSuite"}),(0,d.jsx)(j.$n,{size:"sm",variant:"secondary",icon:"mail",onClick:()=>c8("gmail"),children:"Delete Gmail"})]})]}),(0,d.jsx)("div",{className:"flex flex-wrap gap-1.5",children:t.gJ.map(a=>(0,d.jsxs)("button",{type:"button",onClick:()=>bU(a.id),className:`rounded-full border px-2.5 py-1 text-xs transition-colors ${bT===a.id?"border-primary/50 bg-primary/10 text-primary":"border-border text-text-muted hover:border-primary/30 hover:text-text-main"}`,children:[a.label,(0,d.jsx)("span",{className:"ml-1 text-[10px] opacity-70",children:cX[a.id]||0})]},a.id))}),l.length>=20&&(0,d.jsxs)("div",{className:"relative",children:[(0,d.jsx)("span",{className:"material-symbols-outlined pointer-events-none absolute left-2.5 top-1/2 -translate-y-1/2 text-[16px] text-text-subtle",children:"search"}),(0,d.jsx)("input",{type:"search",value:bV,onChange:a=>bW(a.target.value),placeholder:`Search ${l.length} connections (email, name, id)…`,className:"w-full rounded-lg border border-border bg-background py-2 pl-8 pr-3 text-xs text-text-main outline-none placeholder:text-text-subtle focus:border-primary/40"})]})]}),E?(0,d.jsxs)("div",{className:"flex items-center justify-between gap-3 rounded-lg border border-red-500/30 bg-red-500/10 px-4 py-3",children:[(0,d.jsxs)("div",{className:"flex items-center gap-3",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[18px] text-red-500",children:"error"}),(0,d.jsx)("p",{className:"text-sm text-red-600 dark:text-red-400",children:E})]}),(0,d.jsx)(j.$n,{size:"sm",variant:"secondary",icon:"refresh",onClick:()=>{D(!0),cD()},children:"Retry"})]}):0===l.length?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[(0,d.jsxs)("div",{className:"flex items-center gap-3",children:[(0,d.jsx)("div",{className:"inline-flex items-center justify-center w-9 h-9 rounded-full bg-primary/10 text-primary shrink-0",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:cc?"lock":"key"})}),(0,d.jsxs)("div",{className:"min-w-0",children:[(0,d.jsx)("p",{className:"text-sm text-text-muted",children:"No connections yet"}),"kiro"!==g&&cp.some(a=>"oauth"===a.id)&&cp.some(a=>"apikey"===a.id)?(0,d.jsxs)("p",{className:"text-xs text-text-muted",children:["Choose ",cp.find(a=>"oauth"===a.id)?.label||"OAuth"," or ",cp.find(a=>"apikey"===a.id)?.label||"API Key","."]}):cp.length>1?(0,d.jsx)("p",{className:"text-xs text-text-muted",children:"Add Connection lists every available authentication method."}):null]})]}),(0,d.jsx)(ay,{showAutomation:co,showAddConnection:"none"!==cq.type,onOpenAutomation:b8,onAddConnection:c2,methods:"kiro"===g?null:cr,onSelectMethod:"kiro"===g?null:c3,extra:aP(g)?(0,d.jsx)(aQ,{providerId:g,onWebLoginConnected:cD,onBulkImport:()=>"codex"===g?P(!0):R(!0)}):null})]}),"kiro"===g&&bL?.jobId&&(0,d.jsxs)("div",{className:"mt-4 flex flex-col gap-3 rounded-lg border border-primary/20 bg-primary/[0.06] px-4 py-3 sm:flex-row sm:items-center sm:justify-between",children:[(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:"text-sm font-semibold text-text-main",children:"Bulk import progress is still available"}),(0,d.jsxs)("p",{className:"text-xs text-text-muted",children:["Status: ",bL.status," | Success: ",bL.summary?.success||0," | Running: ",bL.summary?.running||0," | Queued: ",bL.summary?.queued||0]})]}),(0,d.jsxs)("div",{className:"flex gap-2",children:[(0,d.jsx)(j.$n,{size:"sm",icon:"monitoring",variant:"secondary",onClick:()=>c.push(n("kiro")),children:"Resume Bulk Progress"}),aR(bL.status)&&(0,d.jsx)(j.$n,{size:"sm",variant:"ghost",icon:"close",onClick:b6,children:"Clear"})]})]}),"kiro"===g&&!bL?.jobId&&bN&&(0,d.jsx)("div",{className:"mt-4 rounded-lg border border-amber-200 bg-amber-50 px-4 py-3 text-sm text-amber-700 dark:border-amber-800 dark:bg-amber-900/20 dark:text-amber-300",children:bN})]}):(0,d.jsxs)(d.Fragment,{children:[bE&&(0,d.jsx)("div",{className:"mb-4 rounded-lg border border-black/10 bg-black/[0.02] px-3 py-2 text-xs text-text-muted dark:border-white/10 dark:bg-white/[0.03]",children:(0,d.jsxs)("div",{className:"flex flex-wrap items-center gap-3",children:[(0,d.jsxs)("span",{children:["Total: ",bE.total]}),(0,d.jsxs)("span",{children:["Completed: ",bE.completed]}),(0,d.jsxs)("span",{children:["Passed: ",bE.passed]}),(0,d.jsxs)("span",{children:["Failed: ",bE.failed]}),bE.stopped&&(0,d.jsx)("span",{className:"text-amber-600 dark:text-amber-400",children:"Stopped"}),bw&&bA&&(0,d.jsxs)("span",{children:["Running: ",l.find(a=>a.id===bA)?.name||bA]})]})}),"kiro"===g&&bL?.jobId&&(0,d.jsxs)("div",{className:"mb-4 flex flex-col gap-3 rounded-lg border border-primary/20 bg-primary/[0.06] px-4 py-3 sm:flex-row sm:items-center sm:justify-between",children:[(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:"text-sm font-semibold text-text-main",children:"Bulk import progress is still available"}),(0,d.jsxs)("p",{className:"text-xs text-text-muted",children:["Status: ",bL.status," | Success: ",bL.summary?.success||0," | Running: ",bL.summary?.running||0," | Queued: ",bL.summary?.queued||0]})]}),(0,d.jsxs)("div",{className:"flex gap-2",children:[(0,d.jsx)(j.$n,{size:"sm",icon:"monitoring",variant:"secondary",onClick:()=>c.push(n("kiro")),children:"Resume Bulk Progress"}),aR(bL.status)&&(0,d.jsx)(j.$n,{size:"sm",variant:"ghost",icon:"close",onClick:b6,children:"Clear"})]})]}),"kiro"===g&&!bL?.jobId&&bN&&(0,d.jsx)("div",{className:"mb-4 rounded-lg border border-amber-200 bg-amber-50 px-4 py-3 text-sm text-amber-700 dark:border-amber-800 dark:bg-amber-900/20 dark:text-amber-300",children:bN}),dc,"kiro"===g&&c9>1&&(0,d.jsxs)("div",{className:"mt-4 flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[(0,d.jsxs)("p",{className:"text-sm text-text-muted",children:["Page ",da," of ",c9," • Showing ",(da-1)*bR+1,"-",Math.min(da*bR,cW.length)," of ",cW.length," connections"]}),(0,d.jsxs)("div",{className:"flex gap-2",children:[(0,d.jsx)(j.$n,{size:"sm",variant:"secondary",disabled:da<=1,onClick:()=>bQ(a=>Math.max(1,a-1)),children:"Previous"}),(0,d.jsx)(j.$n,{size:"sm",variant:"secondary",disabled:da>=c9,onClick:()=>bQ(a=>Math.min(c9,a+1)),children:"Next"})]})]}),"kiro"!==g&&cW.length>0&&(0,d.jsx)(j.dK,{currentPage:da,pageSize:bR,totalItems:cW.length,onPageChange:bQ,onPageSizeChange:a=>{bS(a),bQ(1)},className:"mt-2"}),l.length>0&&0===cW.length&&(0,d.jsx)("div",{className:"py-8 text-center text-sm text-text-muted",children:"No connections match this status filter."}),(0,d.jsx)("div",{className:"mt-4",children:(0,d.jsx)(ay,{showAutomation:co,showAddConnection:"none"!==cq.type,onOpenAutomation:b8,onAddConnection:c2,methods:"kiro"===g?null:cr,onSelectMethod:"kiro"===g?null:c3,extra:aP(g)?(0,d.jsx)(aQ,{providerId:g,onWebLoginConnected:cD,onBulkImport:()=>"codex"===g?P(!0):R(!0)}):null})})]})]}),(0,d.jsx)(aF,{providerId:g}),(0,d.jsxs)(j.Zp,{children:[(0,d.jsxs)("div",{className:"mb-4 flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between",children:[(0,d.jsxs)("div",{className:"flex items-center gap-3",children:[(0,d.jsx)("h2",{className:"text-lg font-semibold",children:"Available Models"}),cu&&(0,d.jsx)("select",{value:bc,onChange:a=>{var b;bd(b=a.target.value),cG(b)},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:cu.map(a=>(0,d.jsx)("option",{value:a,children:`Thinking: ${a.charAt(0).toUpperCase()+a.slice(1)}`},a))})]}),!cn&&(a=[...cj,...bm.filter(a=>!cj.some(b=>b.id===a.id))].filter(a=>"llm"===(a.kind||a.type||"llm")).map(a=>a.id).filter(a=>!bo.includes(a)),(0,d.jsxs)("div",{className:"flex gap-2",children:[bo.length>0&&(0,d.jsx)(j.$n,{size:"sm",variant:"secondary",icon:"restart_alt",onClick:cA,children:"Active All"}),a.length>0&&(0,d.jsx)(j.$n,{size:"sm",variant:"secondary",icon:"block",onClick:()=>cz(a),children:"Disable All"})]}))]}),Object.values(aD).some(Boolean)&&(0,d.jsx)("div",{className:"mb-3 flex flex-col gap-1",children:Object.entries(aD).filter(([,a])=>!!a).map(([a,b])=>(0,d.jsxs)("p",{className:"text-xs text-red-500 break-words",children:[a,": ",b]},a))}),(()=>{let a,b,c;if(cn)return(0,d.jsx)(F,{providerStorageAlias:ct,providerDisplayAlias:cv,modelAliases:aq,copied:b_,onCopy:b0,onSetAlias:cK,onDeleteAlias:cM,onAliasesChanged:cC,connections:l,isAnthropic:cm});let e=[...cj,...bm.filter(a=>!cj.some(b=>b.id===a.id))].filter(a=>"llm"===(a.kind||a.type||"llm")),f=new Set(bo),h=e.filter(a=>!f.has(a.id)),i=e.filter(a=>f.has(a.id)),k=function({customModels:a=[],modelAliases:b={},providerAlias:c,builtInModels:d=[],type:e="llm",includeLegacyAliases:f=!0}){let g=new Set(d.map(a=>a.id)),h=new Set,i=[];for(let b of a){if(!b?.id||b.providerAlias!==c)continue;let a=b?.kind||b?.type||"llm";if(e&&a!==e||g.has(b.id))continue;let d=`${c}/${b.id}`;h.has(d)||(h.add(d),i.push({id:b.id,name:b.name||b.id,fullModel:d,source:"custom",type:a}))}if(!f)return i;let j=`${c}/`;for(let[a,c]of Object.entries(b||{})){if("string"!=typeof c||!c.startsWith(j))continue;let b=c.slice(j.length);!b||g.has(b)||h.has(c)||(h.add(c),i.push({id:b,alias:a,fullModel:c,source:"legacyAlias",type:e||"llm"}))}return i}({customModels:at,modelAliases:aq,providerAlias:ct,builtInModels:cj,type:"llm"}),m=Math.min(bX,Math.max(1,Math.ceil(h.length/bZ))),n=h.slice((m-1)*bZ,m*bZ);return(0,d.jsxs)("div",{className:"flex flex-wrap gap-3",children:[k.map(a=>(0,d.jsx)(C,{model:{id:a.id,name:a.name},fullModel:`${cv}/${a.id}`,alias:a.alias,copied:b_,onCopy:b0,onSetAlias:()=>{},onDeleteAlias:()=>{"custom"===a.source?cL(a.id,a.type||"llm"):cM(a.alias)},testStatus:az[a.id],onTest:l.length>0||ce?()=>df(a.id):void 0,isTesting:aG.has(a.id),isCustom:!0,isFree:!1,thinkingSuffix:cs(a.id)},`${a.source}-${a.fullModel}`)),n.map(a=>{let b=`${ct}/${a.id}`,c=`${g}/${a.id}`,e=Object.entries(aq).find(([,a])=>a===b||a===c)?.[0];return(0,d.jsx)(C,{model:a,fullModel:`${cv}/${a.id}`,alias:e,copied:b_,onCopy:b0,onSetAlias:b=>cK(a.id,b,ct),onDeleteAlias:()=>cM(e),testStatus:az[a.id],onTest:l.length>0||ce?()=>df(a.id):void 0,isTesting:aG.has(a.id),isFree:a.isFree,onDisable:()=>cx(a.id),thinkingSuffix:cs(a.id)},a.id)}),h.length>bZ&&(0,d.jsx)("div",{className:"w-full",children:(0,d.jsx)(j.dK,{currentPage:m,pageSize:bZ,totalItems:h.length,onPageChange:bY,onPageSizeChange:a=>{b$(a),bY(1)}})}),(0,d.jsxs)("button",{onClick:()=>aJ(!0),className:"flex w-full items-center justify-center gap-1.5 rounded-lg border border-dashed border-primary/40 px-3 py-2 text-xs text-primary transition-colors hover:border-primary hover:bg-primary/5 sm:w-auto",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-sm",children:"add"}),"Add Model"]}),"codebuddy"===g&&(0,d.jsxs)("button",{onClick:()=>aL(!0),className:"flex w-full items-center justify-center gap-1.5 rounded-lg border border-dashed border-cyan-500/50 px-3 py-2 text-xs text-cyan-700 transition-colors hover:border-cyan-500 hover:bg-cyan-500/[0.07] dark:text-cyan-300 sm:w-auto",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-sm",children:"radar"}),"Discover Models"]}),("codebuddy-intl"===g||"codebuddy-cn"===g)&&(0,d.jsxs)("button",{onClick:()=>aT(!0),className:"live-probe-button",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-sm",children:"radar"}),"Live Probe Models"]}),"openrouter"===g&&(0,d.jsxs)("button",{type:"button",onClick:()=>aX(!0),className:"live-probe-button",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-sm",children:"radar"}),"Live Probe Models"]}),"opencode"===g&&(0,d.jsxs)("button",{onClick:()=>aV(!0),className:"live-probe-button",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-sm",children:"radar"}),"Live Probe Models"]}),"kiro"===g&&(0,d.jsxs)("button",{onClick:()=>aZ(!0),className:"live-probe-button",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-sm",children:"radar"}),"Live Probe Models"]}),"cloudflare-ai"===g&&(0,d.jsxs)("button",{onClick:()=>a_(!0),className:"live-probe-button",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-sm",children:"radar"}),"Live Probe Models"]}),"qoder"===g&&l.some(a=>!1!==a.isActive)&&(0,d.jsxs)("button",{onClick:cN,disabled:bJ,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,d.jsx)("span",{className:"material-symbols-outlined text-sm",style:bJ?{animation:"spin 1s linear infinite"}:void 0,children:bJ?"progress_activity":"download"}),bJ?(0,q.Tl)("Fetching..."):(0,q.Tl)("Fetch Qoder Models")]}),bk.length>0&&(a=new Set(Object.values(aq)),b=new Set(cj.map(a=>a.id)),0===(c=bk.filter(c=>!a.has(`${ct}/${c.id}`)&&!b.has(c.id))).length?null:(0,d.jsxs)("div",{className:"w-full mt-2",children:[(0,d.jsx)("p",{className:"text-xs text-text-muted mb-2",children:"Suggested free models (≥200k context):"}),(0,d.jsx)("div",{className:"flex flex-wrap gap-2",children:c.map(a=>(0,d.jsxs)("button",{onClick:async()=>{let b=a.id.split("/").pop();await cK(a.id,b,ct)},className:"flex items-center gap-1 px-2.5 py-1.5 rounded-lg border border-black/10 dark:border-white/10 text-xs text-text-muted hover:text-primary hover:border-primary/40 hover:bg-primary/5 transition-colors",title:`${a.name} \xb7 ${(a.contextLength/1e3).toFixed(0)}k ctx`,children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[13px]",children:"add"}),a.id.split("/").pop()]},a.id))})]})),i.length>0&&(0,d.jsxs)("div",{className:"w-full mt-2",children:[(0,d.jsxs)("p",{className:"text-xs text-text-muted mb-2",children:["Disabled models (",i.length,"):"]}),(0,d.jsx)("div",{className:"flex flex-wrap gap-2",children:i.map(a=>(0,d.jsxs)("button",{onClick:()=>cy(a.id),className:"flex items-center gap-1 px-2.5 py-1.5 rounded-lg border border-dashed border-black/10 dark:border-white/10 text-xs text-text-muted hover:text-primary hover:border-primary/40 hover:bg-primary/5 transition-colors",title:"Restore model",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[13px]",children:"add"}),a.id]},a.id))})]})]})})()]}),am&&de,$&&(0,d.jsx)(j.mz,{isOpen:!0,providerName:ca.name,methods:cr,onSelect:c3,onClose:()=>_(!1)}),"codex"===g&&(0,d.jsx)(aA,{isOpen:O,onClose:()=>P(!1),onSuccess:cD}),"grok-cli"===g&&(0,d.jsx)(aC,{isOpen:Q,onClose:()=>R(!1),onSuccess:cD}),M&&("kiro"===g?(0,d.jsx)(j.Mh,{isOpen:!0,providerInfo:ca,onSuccess:cQ,onRefresh:cD,initialBulkJobId:bL?.jobId||null,onBulkJobChange:cR,onClose:()=>N(!1)}):"cursor"===g?(0,d.jsx)(j.G9,{isOpen:!0,onSuccess:cQ,onClose:()=>N(!1)}):"gitlab"===g?(0,d.jsx)(j.vj,{isOpen:!0,providerInfo:ca,onSuccess:cQ,onClose:()=>N(!1)}):"xiaomi-mimo"===g?(0,d.jsx)(j.LH,{isOpen:!0,onSuccess:cQ,onClose:()=>N(!1)}):(0,d.jsx)(j.LF,{isOpen:!0,provider:g,providerInfo:ca,onSuccess:cQ,onClose:()=>N(!1)})),"iflow"===g&&T&&(0,d.jsx)(j.vE,{isOpen:!0,onSuccess:()=>{cD(),U(!1)},onClose:()=>U(!1)}),("codebuddy"===g||"codebuddy-cn"===g)&&V&&(0,d.jsx)(j.xl,{isOpen:!0,connectionIds:c$,endpoint:"codebuddy-cn"===g?"/api/oauth/codebuddy-cn/quota-cookie":"/api/oauth/codebuddy/quota-cookie",onSuccess:()=>{cD(),Z(!1)},onClose:()=>Z(!1)}),aa&&(0,d.jsx)(W,{isOpen:!0,provider:g,providerName:ca.name,isCompatible:cn,isAnthropic:cm,authType:ca?.authType,authHint:ca?.authHint,website:ca?.website,proxyPools:J,existingNames:l.map(a=>a.name).filter(Boolean),error:ad,onSave:cS,onBulkDone:cD,onClose:()=>{ae(""),ac(!1)}}),ag&&ao&&(0,d.jsx)(j.wI,{isOpen:!0,connection:ao,proxyPools:J,onSave:cT,onClose:()=>ah(!1)}),cn&&ai&&(0,d.jsx)(X,{isOpen:!0,node:H,onSave:cE,onClose:()=>aj(!1),isAnthropic:cm}),!cn&&aI&&(0,d.jsx)(Y,{isOpen:!0,providerAlias:ct,providerDisplayAlias:cv,onSave:async a=>{let b=ca?.passthroughModels?a.split("/").pop():a;await cK(a,b,ct),aJ(!1)},onClose:()=>aJ(!1)}),"codebuddy"===g&&aK&&(0,d.jsx)(ab,{isOpen:!0,connections:l,onModelsAdded:async a=>{for(let b of a)await cK(b.id,b.id,"cb");await cC(),await cB()},onClose:()=>aL(!1)}),("codebuddy-intl"===g||"codebuddy-cn"===g)&&aM&&(0,d.jsx)(af,{isOpen:!0,providerId:g,connections:l,onModelsAdded:async a=>{let b="codebuddy-cn"===g?"cb-cn":"cbai";for(let c of a)await cK(c.id,c.id,b);await cC(),await cB()},onClose:()=>aT(!1)}),"openrouter"===g&&aW&&(0,d.jsx)(al.A,{isOpen:!0,kind:"llm",connections:l,onModelsAdded:async a=>{for(let b of a)await cK(b.id,b.id.split("/").pop(),"openrouter");await cC(),await cB()},onClose:()=>aX(!1)}),"opencode"===g&&aU&&(0,d.jsx)(ak,{isOpen:!0,onModelsAdded:async a=>{for(let b of a)await cK(b.id,b.id,"oc");await cC(),await cB()},onClose:()=>aV(!1)}),"kiro"===g&&aY&&(0,d.jsx)(ar,{isOpen:!0,connections:l,onClose:()=>aZ(!1)}),"cloudflare-ai"===g&&a$&&(0,d.jsx)(ax,{isOpen:!0,connections:l,onModelsAdded:async a=>{for(let b of a)await cK(b.id,b.id,ck);await cC()},onClose:()=>a_(!1)}),bi&&(0,d.jsx)(S,{isOpen:!0,connection:bi,reactive:!0===be[bi.id],schedule:bg[bi.id]||null,onClose:()=>bj(null),onSave:cJ}),bs&&(0,d.jsx)(j.uo,{isOpen:!0,onClose:()=>bt(!1),onConfirm:()=>{bt(!1),bv(null),c1(bu||"oauth")},title:"Risk Notice",message:ca?.deprecationNotice,confirmText:"I Understand, Continue",cancelText:"Cancel",variant:"danger"}),bq&&(0,d.jsx)(j.uo,{isOpen:!0,onClose:()=>{a6||br(null)},onConfirm:async()=>{if(a6)return;let a=bq?.onConfirm;if(a){a7(!0);try{await a()}finally{a7(!1)}}},title:bq?.title||"Confirm",message:bq?.message,variant:"danger",loading:a6})]}):(0,d.jsxs)("div",{className:"text-center py-20",children:[(0,d.jsx)("p",{className:"text-text-muted",children:"Provider not found"}),(0,d.jsx)(h(),{href:"/dashboard/providers",className:"text-primary mt-4 inline-block",children:"Back to Providers"})]})}},46060:a=>{"use strict";a.exports=require("next/dist/shared/lib/no-fallback-error.external.js")},46293:a=>{"use strict";a.exports=require("sql.js")},48161:a=>{"use strict";a.exports=require("node:os")},49858:(a,b,c)=>{"use strict";c.r(b),c.d(b,{__next_app__:()=>x,handler:()=>z,routeModule:()=>y});var d=c(21635),e=c(86315),f=c(1020),g=c(61287),h={};for(let a in g)0>["default","__next_app__","routeModule","handler"].indexOf(a)&&(h[a]=()=>g[a]);c.d(b,h);let i=(0,d.p)(()=>Promise.resolve().then(c.bind(c,32059))),j=(0,d.p)(()=>Promise.resolve().then(c.t.bind(c,95547,23))),k=(0,d.p)(()=>Promise.resolve().then(c.t.bind(c,55091,23))),l=(0,d.p)(()=>Promise.resolve().then(c.t.bind(c,45270,23))),m=(0,d.p)(()=>Promise.resolve().then(c.t.bind(c,28193,23))),n=(0,d.p)(()=>Promise.resolve().then(c.bind(c,30508))),o=(0,d.p)(()=>Promise.resolve().then(c.t.bind(c,95547,23))),p=(0,d.p)(()=>Promise.resolve().then(c.t.bind(c,55091,23))),q=(0,d.p)(()=>Promise.resolve().then(c.t.bind(c,45270,23))),r=(0,d.p)(()=>Promise.resolve().then(c.t.bind(c,28193,23))),s=(0,d.p)(()=>Promise.resolve().then(c.t.bind(c,95547,23))),t=(0,d.p)(()=>Promise.resolve().then(c.t.bind(c,95547,23))),u=(0,d.p)(()=>Promise.resolve().then(c.t.bind(c,95547,23))),v={children:["",{children:["(dashboard)",{children:["dashboard",{children:["providers",{children:["[id]",{children:["__PAGE__",{},{page:[(0,d.p)(()=>Promise.resolve().then(c.bind(c,93110))),"/zevairouter-build/src/app/(dashboard)/dashboard/providers/[id]/page.js"]}]},{"global-error":[u,"next/dist/client/components/builtin/global-error.js"]},["new"]]},{"global-error":[t,"next/dist/client/components/builtin/global-error.js"]},[]]},{"global-error":[s,"next/dist/client/components/builtin/global-error.js"]},[]]},{layout:[n,"/zevairouter-build/src/app/(dashboard)/layout.js"],"global-error":[o,"next/dist/client/components/builtin/global-error.js"],"not-found":[p,"next/dist/client/components/builtin/not-found.js"],forbidden:[q,"next/dist/client/components/builtin/forbidden.js"],unauthorized:[r,"next/dist/client/components/builtin/unauthorized.js"],metadata:{icon:[],apple:[],openGraph:[],twitter:[],manifest:"/manifest.webmanifest"}},[]]},{layout:[i,"/zevairouter-build/src/app/layout.js"],"global-error":[j,"next/dist/client/components/builtin/global-error.js"],"not-found":[k,"next/dist/client/components/builtin/not-found.js"],forbidden:[l,"next/dist/client/components/builtin/forbidden.js"],unauthorized:[m,"next/dist/client/components/builtin/unauthorized.js"],metadata:{icon:[],apple:[],openGraph:[],twitter:[],manifest:"/manifest.webmanifest"}},[]]}.children,w=(0,e.H)({tree:v,page:"/(dashboard)/dashboard/providers/[id]/page",pathname:"/dashboard/providers/[id]",require:c,loadChunk:()=>Promise.resolve(),interopDefault:f.T}),x=w.__next_app__,y=w.routeModule,z=w.handler},51455:a=>{"use strict";a.exports=require("node:fs/promises")},53053:a=>{"use strict";a.exports=require("node:diagnostics_channel")},55511:a=>{"use strict";a.exports=require("crypto")},57075:a=>{"use strict";a.exports=require("node:stream")},57975:a=>{"use strict";a.exports=require("node:util")},58962:(a,b,c)=>{"use strict";c.d(b,{x6:()=>d.fetchJson,E2:()=>e,gs:()=>f});var d=c(86819);function e(a){if(!a)return null;let b=a.match(/\b([45]\d{2})\b/);return b?b[1]:"ERR"}function f(a){if(!a)return"";let b=Math.floor((Date.now()-new Date(a).getTime())/6e4);if(b<1)return"just now";if(b<60)return`${b}m ago`;let c=Math.floor(b/60);if(c<24)return`${c}h ago`;let d=Math.floor(c/24);return`${d}d ago`}},63033:a=>{"use strict";a.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},71553:a=>{"use strict";a.exports=require("node:dns/promises")},73024:a=>{"use strict";a.exports=require("node:fs")},73136:a=>{"use strict";a.exports=require("node:url")},73429:a=>{"use strict";a.exports=require("node:util/types")},75901:(a,b,c)=>{Promise.resolve().then(c.bind(c,44062))},75919:a=>{"use strict";a.exports=require("node:worker_threads")},76760:a=>{"use strict";a.exports=require("node:path")},77030:a=>{"use strict";a.exports=require("node:net")},77598:a=>{"use strict";a.exports=require("node:crypto")},78474:a=>{"use strict";a.exports=require("node:events")},79868:a=>{"use strict";a.exports=require("node:sqlite")},81787:a=>{"use strict";a.exports=require("bun:sqlite")},86819:(a,b,c)=>{"use strict";c.d(b,{fetchJson:()=>e});let d={"Content-Type":"application/json"};async function e(a,b={}){let{body:c,headers:f,...g}=b,h={...g,headers:{...d,...f}};void 0!==c&&"string"!=typeof c?h.body=JSON.stringify(c):void 0!==c&&(h.body=c);let i=await fetch(a,h),j=await i.text(),k=null;if(j)try{k=JSON.parse(j)}catch{let b=Error(`Non-JSON response from ${a} (HTTP ${i.status})`);throw b.status=i.status,b.rawBody=j.slice(0,300),b}if(!i.ok){let a=k&&(k.error?.message||k.error||k.message)||`Request failed (HTTP ${i.status})`,b=Error("string"==typeof a?a:`HTTP ${i.status}`);throw b.status=i.status,b.data=k,b}return k}e.get=(a,b)=>e(a,{...b,method:"GET"}),e.post=(a,b,c)=>e(a,{...c,method:"POST",body:b}),e.put=(a,b,c)=>e(a,{...c,method:"PUT",body:b}),e.patch=(a,b,c)=>e(a,{...c,method:"PATCH",body:b}),e.del=(a,b)=>e(a,{...b,method:"DELETE"})},87550:a=>{"use strict";a.exports=require("better-sqlite3")},87997:a=>{"use strict";a.exports=require("node:timers")},93110:(a,b,c)=>{"use strict";c.r(b),c.d(b,{default:()=>d});let d=(0,c(77943).registerClientReference)(function(){throw Error("Attempted to call the default export of \"/zevairouter-build/src/app/(dashboard)/dashboard/providers/[id]/page.js\" from the server, but it's on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"/zevairouter-build/src/app/(dashboard)/dashboard/providers/[id]/page.js","default")},94735:a=>{"use strict";a.exports=require("events")}};var b=require("../../../../../webpack-runtime.js");b.C(a);var c=b.X(0,[2970,7774,2430,940,2760,5905,4452,4686,4549,7973,24,5024,9548,7404,9188,267,412,2228,4073],()=>b(b.s=49858));module.exports=c})();
|