9router 0.4.12 → 0.4.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/app/.next/BUILD_ID +1 -1
- package/app/.next/app-path-routes-manifest.json +4 -4
- package/app/.next/build-manifest.json +2 -2
- package/app/.next/server/app/(dashboard)/dashboard/basic-chat/page.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/basic-chat/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/cli-tools/page.js +2 -2
- package/app/.next/server/app/(dashboard)/dashboard/cli-tools/page.js.nft.json +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/cli-tools/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/combos/page.js +2 -2
- package/app/.next/server/app/(dashboard)/dashboard/combos/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/console-log/page.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/console-log/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/endpoint/page.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/endpoint/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/media-providers/[kind]/[id]/page.js +4 -4
- package/app/.next/server/app/(dashboard)/dashboard/media-providers/[kind]/[id]/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/media-providers/[kind]/page.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/media-providers/[kind]/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/media-providers/web/combo/[id]/page.js +2 -2
- package/app/.next/server/app/(dashboard)/dashboard/media-providers/web/combo/[id]/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/media-providers/web/page.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/media-providers/web/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/mitm/page.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/mitm/page.js.nft.json +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/mitm/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/page.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/profile/page.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/profile/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/providers/[id]/page.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/providers/[id]/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/providers/new/page.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/providers/new/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/providers/page.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/providers/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/proxy-pools/page.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/proxy-pools/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/quota/page.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/quota/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/translator/page.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/translator/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/usage/page.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/usage/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/_global-error/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/_global-error.html +1 -1
- package/app/.next/server/app/_global-error.rsc +1 -1
- package/app/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/app/.next/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
- package/app/.next/server/app/_global-error.segments/_global-error.segment.rsc +1 -1
- package/app/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
- package/app/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
- package/app/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/app/.next/server/app/_not-found/page.js +1 -1
- package/app/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/_not-found.html +1 -1
- package/app/.next/server/app/_not-found.rsc +4 -4
- package/app/.next/server/app/_not-found.segments/_full.segment.rsc +4 -4
- package/app/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
- package/app/.next/server/app/_not-found.segments/_index.segment.rsc +4 -4
- package/app/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
- package/app/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
- package/app/.next/server/app/_not-found.segments/_tree.segment.rsc +2 -2
- package/app/.next/server/app/api/cli-tools/antigravity-mitm/route.js +1 -1
- package/app/.next/server/app/api/init/route.js +1 -1
- package/app/.next/server/app/api/models/route.js +1 -1
- package/app/.next/server/app/api/oauth/cursor/import/route.js +1 -1
- package/app/.next/server/app/api/providers/[id]/models/route.js +1 -1
- package/app/.next/server/app/api/providers/route.js +1 -1
- package/app/.next/server/app/api/providers/validate/route.js +1 -1
- package/app/.next/server/app/api/translator/console-logs/route.js +1 -1
- package/app/.next/server/app/api/translator/console-logs/stream/route.js +4 -4
- package/app/.next/server/app/api/translator/translate/route.js +1 -1
- package/app/.next/server/app/api/translator/translate/route.js.nft.json +1 -1
- package/app/.next/server/app/api/tunnel/disable/route.js +1 -1
- package/app/.next/server/app/api/tunnel/enable/route.js +1 -1
- package/app/.next/server/app/api/tunnel/status/route.js +1 -1
- package/app/.next/server/app/api/tunnel/tailscale-check/route.js +11 -13
- package/app/.next/server/app/api/tunnel/tailscale-disable/route.js +1 -1
- package/app/.next/server/app/api/tunnel/tailscale-enable/route.js +1 -1
- package/app/.next/server/app/api/tunnel/tailscale-login/route.js +11 -13
- package/app/.next/server/app/api/usage/[connectionId]/route.js +1 -1
- package/app/.next/server/app/api/v1/audio/speech/route.js +1 -1
- package/app/.next/server/app/api/v1/images/generations/route.js +2 -2
- package/app/.next/server/app/api/v1/images/generations/route.js.nft.json +1 -1
- package/app/.next/server/app/api/v1/models/route.js +1 -1
- package/app/.next/server/app/api/v1/models/route.js.nft.json +1 -1
- package/app/.next/server/app/api/v1/route.js +1 -1
- package/app/.next/server/app/api/v1/route.js.nft.json +1 -1
- package/app/.next/server/app/api/version/route.js +1 -1
- package/app/.next/server/app/api/version/update/route.js +1 -1
- package/app/.next/server/app/callback/page.js +1 -1
- package/app/.next/server/app/callback/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/callback.html +1 -1
- package/app/.next/server/app/callback.rsc +4 -4
- package/app/.next/server/app/callback.segments/_full.segment.rsc +4 -4
- package/app/.next/server/app/callback.segments/_head.segment.rsc +1 -1
- package/app/.next/server/app/callback.segments/_index.segment.rsc +4 -4
- package/app/.next/server/app/callback.segments/_tree.segment.rsc +2 -2
- package/app/.next/server/app/callback.segments/callback/__PAGE__.segment.rsc +1 -1
- package/app/.next/server/app/callback.segments/callback.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/basic-chat.html +1 -1
- package/app/.next/server/app/dashboard/basic-chat.rsc +6 -6
- package/app/.next/server/app/dashboard/basic-chat.segments/!KGRhc2hib2FyZCk/dashboard/basic-chat/__PAGE__.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/basic-chat.segments/!KGRhc2hib2FyZCk/dashboard/basic-chat.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/basic-chat.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/basic-chat.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/basic-chat.segments/_full.segment.rsc +6 -6
- package/app/.next/server/app/dashboard/basic-chat.segments/_head.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/basic-chat.segments/_index.segment.rsc +4 -4
- package/app/.next/server/app/dashboard/basic-chat.segments/_tree.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/cli-tools.html +1 -1
- package/app/.next/server/app/dashboard/cli-tools.rsc +6 -6
- package/app/.next/server/app/dashboard/cli-tools.segments/!KGRhc2hib2FyZCk/dashboard/cli-tools/__PAGE__.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/cli-tools.segments/!KGRhc2hib2FyZCk/dashboard/cli-tools.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/cli-tools.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/cli-tools.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/cli-tools.segments/_full.segment.rsc +6 -6
- package/app/.next/server/app/dashboard/cli-tools.segments/_head.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/cli-tools.segments/_index.segment.rsc +4 -4
- package/app/.next/server/app/dashboard/cli-tools.segments/_tree.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/combos.html +1 -1
- package/app/.next/server/app/dashboard/combos.rsc +6 -6
- package/app/.next/server/app/dashboard/combos.segments/!KGRhc2hib2FyZCk/dashboard/combos/__PAGE__.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/combos.segments/!KGRhc2hib2FyZCk/dashboard/combos.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/combos.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/combos.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/combos.segments/_full.segment.rsc +6 -6
- package/app/.next/server/app/dashboard/combos.segments/_head.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/combos.segments/_index.segment.rsc +4 -4
- package/app/.next/server/app/dashboard/combos.segments/_tree.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/endpoint.html +1 -1
- package/app/.next/server/app/dashboard/endpoint.rsc +6 -6
- package/app/.next/server/app/dashboard/endpoint.segments/!KGRhc2hib2FyZCk/dashboard/endpoint/__PAGE__.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/endpoint.segments/!KGRhc2hib2FyZCk/dashboard/endpoint.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/endpoint.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/endpoint.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/endpoint.segments/_full.segment.rsc +6 -6
- package/app/.next/server/app/dashboard/endpoint.segments/_head.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/endpoint.segments/_index.segment.rsc +4 -4
- package/app/.next/server/app/dashboard/endpoint.segments/_tree.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/media-providers/web.html +1 -1
- package/app/.next/server/app/dashboard/media-providers/web.rsc +6 -6
- package/app/.next/server/app/dashboard/media-providers/web.segments/!KGRhc2hib2FyZCk/dashboard/media-providers/web/__PAGE__.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/media-providers/web.segments/!KGRhc2hib2FyZCk/dashboard/media-providers/web.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/media-providers/web.segments/!KGRhc2hib2FyZCk/dashboard/media-providers.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/media-providers/web.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/media-providers/web.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/media-providers/web.segments/_full.segment.rsc +6 -6
- package/app/.next/server/app/dashboard/media-providers/web.segments/_head.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/media-providers/web.segments/_index.segment.rsc +4 -4
- package/app/.next/server/app/dashboard/media-providers/web.segments/_tree.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/mitm.html +1 -1
- package/app/.next/server/app/dashboard/mitm.rsc +6 -6
- package/app/.next/server/app/dashboard/mitm.segments/!KGRhc2hib2FyZCk/dashboard/mitm/__PAGE__.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/mitm.segments/!KGRhc2hib2FyZCk/dashboard/mitm.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/mitm.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/mitm.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/mitm.segments/_full.segment.rsc +6 -6
- package/app/.next/server/app/dashboard/mitm.segments/_head.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/mitm.segments/_index.segment.rsc +4 -4
- package/app/.next/server/app/dashboard/mitm.segments/_tree.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/profile.html +1 -1
- package/app/.next/server/app/dashboard/profile.rsc +6 -6
- package/app/.next/server/app/dashboard/profile.segments/!KGRhc2hib2FyZCk/dashboard/profile/__PAGE__.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/profile.segments/!KGRhc2hib2FyZCk/dashboard/profile.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/profile.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/profile.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/profile.segments/_full.segment.rsc +6 -6
- package/app/.next/server/app/dashboard/profile.segments/_head.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/profile.segments/_index.segment.rsc +4 -4
- package/app/.next/server/app/dashboard/profile.segments/_tree.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/providers/new.html +1 -1
- package/app/.next/server/app/dashboard/providers/new.rsc +6 -6
- package/app/.next/server/app/dashboard/providers/new.segments/!KGRhc2hib2FyZCk/dashboard/providers/new/__PAGE__.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/providers/new.segments/!KGRhc2hib2FyZCk/dashboard/providers/new.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/providers/new.segments/!KGRhc2hib2FyZCk/dashboard/providers.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/providers/new.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/providers/new.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/providers/new.segments/_full.segment.rsc +6 -6
- package/app/.next/server/app/dashboard/providers/new.segments/_head.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/providers/new.segments/_index.segment.rsc +4 -4
- package/app/.next/server/app/dashboard/providers/new.segments/_tree.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/providers.html +1 -1
- package/app/.next/server/app/dashboard/providers.rsc +6 -6
- package/app/.next/server/app/dashboard/providers.segments/!KGRhc2hib2FyZCk/dashboard/providers/__PAGE__.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/providers.segments/!KGRhc2hib2FyZCk/dashboard/providers.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/providers.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/providers.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/providers.segments/_full.segment.rsc +6 -6
- package/app/.next/server/app/dashboard/providers.segments/_head.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/providers.segments/_index.segment.rsc +4 -4
- package/app/.next/server/app/dashboard/providers.segments/_tree.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/proxy-pools.html +1 -1
- package/app/.next/server/app/dashboard/proxy-pools.rsc +6 -6
- package/app/.next/server/app/dashboard/proxy-pools.segments/!KGRhc2hib2FyZCk/dashboard/proxy-pools/__PAGE__.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/proxy-pools.segments/!KGRhc2hib2FyZCk/dashboard/proxy-pools.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/proxy-pools.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/proxy-pools.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/proxy-pools.segments/_full.segment.rsc +6 -6
- package/app/.next/server/app/dashboard/proxy-pools.segments/_head.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/proxy-pools.segments/_index.segment.rsc +4 -4
- package/app/.next/server/app/dashboard/proxy-pools.segments/_tree.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/quota.html +2 -2
- package/app/.next/server/app/dashboard/quota.rsc +7 -7
- package/app/.next/server/app/dashboard/quota.segments/!KGRhc2hib2FyZCk/dashboard/quota/__PAGE__.segment.rsc +3 -3
- package/app/.next/server/app/dashboard/quota.segments/!KGRhc2hib2FyZCk/dashboard/quota.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/quota.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/quota.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/quota.segments/_full.segment.rsc +7 -7
- package/app/.next/server/app/dashboard/quota.segments/_head.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/quota.segments/_index.segment.rsc +4 -4
- package/app/.next/server/app/dashboard/quota.segments/_tree.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/settings/pricing/page.js +1 -1
- package/app/.next/server/app/dashboard/settings/pricing/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/dashboard/settings/pricing.html +1 -1
- package/app/.next/server/app/dashboard/settings/pricing.rsc +5 -5
- package/app/.next/server/app/dashboard/settings/pricing.segments/_full.segment.rsc +5 -5
- package/app/.next/server/app/dashboard/settings/pricing.segments/_head.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/settings/pricing.segments/_index.segment.rsc +4 -4
- package/app/.next/server/app/dashboard/settings/pricing.segments/_tree.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/settings/pricing.segments/dashboard/settings/pricing/__PAGE__.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/settings/pricing.segments/dashboard/settings/pricing.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/settings/pricing.segments/dashboard/settings.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/settings/pricing.segments/dashboard.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/translator.html +1 -1
- package/app/.next/server/app/dashboard/translator.rsc +6 -6
- package/app/.next/server/app/dashboard/translator.segments/!KGRhc2hib2FyZCk/dashboard/translator/__PAGE__.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/translator.segments/!KGRhc2hib2FyZCk/dashboard/translator.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/translator.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/translator.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/translator.segments/_full.segment.rsc +6 -6
- package/app/.next/server/app/dashboard/translator.segments/_head.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/translator.segments/_index.segment.rsc +4 -4
- package/app/.next/server/app/dashboard/translator.segments/_tree.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/usage.html +1 -1
- package/app/.next/server/app/dashboard/usage.rsc +6 -6
- package/app/.next/server/app/dashboard/usage.segments/!KGRhc2hib2FyZCk/dashboard/usage/__PAGE__.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/usage.segments/!KGRhc2hib2FyZCk/dashboard/usage.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/usage.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/usage.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/usage.segments/_full.segment.rsc +6 -6
- package/app/.next/server/app/dashboard/usage.segments/_head.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/usage.segments/_index.segment.rsc +4 -4
- package/app/.next/server/app/dashboard/usage.segments/_tree.segment.rsc +2 -2
- package/app/.next/server/app/dashboard.html +1 -1
- package/app/.next/server/app/dashboard.rsc +6 -6
- package/app/.next/server/app/dashboard.segments/!KGRhc2hib2FyZCk/dashboard/__PAGE__.segment.rsc +2 -2
- package/app/.next/server/app/dashboard.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/app/.next/server/app/dashboard.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/app/.next/server/app/dashboard.segments/_full.segment.rsc +6 -6
- package/app/.next/server/app/dashboard.segments/_head.segment.rsc +1 -1
- package/app/.next/server/app/dashboard.segments/_index.segment.rsc +4 -4
- package/app/.next/server/app/dashboard.segments/_tree.segment.rsc +2 -2
- package/app/.next/server/app/index.html +1 -1
- package/app/.next/server/app/index.rsc +4 -4
- package/app/.next/server/app/index.segments/__PAGE__.segment.rsc +1 -1
- package/app/.next/server/app/index.segments/_full.segment.rsc +4 -4
- package/app/.next/server/app/index.segments/_head.segment.rsc +1 -1
- package/app/.next/server/app/index.segments/_index.segment.rsc +4 -4
- package/app/.next/server/app/index.segments/_tree.segment.rsc +2 -2
- package/app/.next/server/app/landing/page.js +1 -1
- package/app/.next/server/app/landing/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/landing.html +1 -1
- package/app/.next/server/app/landing.rsc +4 -4
- package/app/.next/server/app/landing.segments/_full.segment.rsc +4 -4
- package/app/.next/server/app/landing.segments/_head.segment.rsc +1 -1
- package/app/.next/server/app/landing.segments/_index.segment.rsc +4 -4
- package/app/.next/server/app/landing.segments/_tree.segment.rsc +2 -2
- package/app/.next/server/app/landing.segments/landing/__PAGE__.segment.rsc +1 -1
- package/app/.next/server/app/landing.segments/landing.segment.rsc +1 -1
- package/app/.next/server/app/login/page.js +2 -2
- package/app/.next/server/app/login/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/login.html +1 -1
- package/app/.next/server/app/login.rsc +5 -5
- package/app/.next/server/app/login.segments/_full.segment.rsc +5 -5
- package/app/.next/server/app/login.segments/_head.segment.rsc +1 -1
- package/app/.next/server/app/login.segments/_index.segment.rsc +4 -4
- package/app/.next/server/app/login.segments/_tree.segment.rsc +2 -2
- package/app/.next/server/app/login.segments/login/__PAGE__.segment.rsc +2 -2
- package/app/.next/server/app/login.segments/login.segment.rsc +1 -1
- package/app/.next/server/app/page.js +1 -1
- package/app/.next/server/app/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app-paths-manifest.json +4 -4
- package/app/.next/server/chunks/1574.js +2 -2
- package/app/.next/server/chunks/1578.js +1 -1
- package/app/.next/server/chunks/2049.js +1 -1
- package/app/.next/server/chunks/21.js +1 -1
- package/app/.next/server/chunks/2141.js +1 -1
- package/app/.next/server/chunks/253.js +1 -1
- package/app/.next/server/chunks/2692.js +23 -0
- package/app/.next/server/chunks/450.js +2 -2
- package/app/.next/server/chunks/5339.js +1 -1
- package/app/.next/server/chunks/7770.js +1 -1
- package/app/.next/server/chunks/8035.js +1 -1
- package/app/.next/server/chunks/8193.js +1 -1
- package/app/.next/server/chunks/8202.js +5 -5
- package/app/.next/server/chunks/8513.js +13 -15
- package/app/.next/server/chunks/8565.js +1 -0
- package/app/.next/server/middleware-build-manifest.js +1 -1
- package/app/.next/server/middleware.js +1 -1
- package/app/.next/server/pages/404.html +1 -1
- package/app/.next/server/pages/500.html +1 -1
- package/app/.next/static/chunks/3116-cec85bb5f212583f.js +23 -0
- package/app/.next/static/chunks/4156-cb6c83e3583f0406.js +7 -0
- package/app/.next/static/chunks/505-18fef307aacf3205.js +1 -0
- package/app/.next/static/chunks/8035-51e868622e22263b.js +3 -0
- package/app/.next/static/chunks/app/(dashboard)/dashboard/cli-tools/page-2709902f127ecc7a.js +1 -0
- package/app/.next/static/chunks/app/(dashboard)/dashboard/combos/page-24f203d25ad3f861.js +1 -0
- package/app/.next/static/chunks/app/(dashboard)/dashboard/media-providers/[kind]/[id]/page-99e1297a29f0994e.js +53 -0
- package/app/.next/static/chunks/app/(dashboard)/dashboard/media-providers/[kind]/page-e95c413c30b592eb.js +1 -0
- package/app/.next/static/chunks/app/(dashboard)/dashboard/media-providers/web/combo/[id]/page-8b1737ee82d2cbfa.js +4 -0
- package/app/.next/static/chunks/app/(dashboard)/dashboard/media-providers/web/page-c32e5ceca2e291dd.js +1 -0
- package/app/.next/static/chunks/app/(dashboard)/dashboard/mitm/page-dc8502d8e3b95e92.js +1 -0
- package/app/.next/static/chunks/app/(dashboard)/dashboard/providers/[id]/{page-22e6b2c60c4849ad.js → page-20eb7b59c080e8f7.js} +1 -1
- package/app/.next/static/chunks/app/(dashboard)/dashboard/usage/page-92b9dd8c50ab5e50.js +1 -0
- package/app/.next/static/chunks/app/dashboard/settings/pricing/page-77a73529baba955b.js +1 -0
- package/app/.next/static/chunks/app/login/page-2f45309b2d2ca209.js +1 -0
- package/app/.next/static/css/c5a3b7a7aed78240.css +1 -0
- package/app/package.json +1 -1
- package/app/public/i18n/literals/zh-CN.json +404 -127
- package/app/public/providers/cloudflare-ai.png +0 -0
- package/app/public/providers/nebius.png +0 -0
- package/app/src/mitm/server.js +34 -31
- package/cli.js +6 -0
- package/package.json +1 -1
- package/app/.next/server/chunks/6762.js +0 -23
- package/app/.next/static/chunks/4156-3dd571c503014372.js +0 -7
- package/app/.next/static/chunks/4380-7f3ec9a5adb060e2.js +0 -23
- package/app/.next/static/chunks/505-61eefa51ae7fae57.js +0 -1
- package/app/.next/static/chunks/8035-be13431b81f6e555.js +0 -3
- package/app/.next/static/chunks/app/(dashboard)/dashboard/cli-tools/page-3d80412b21111041.js +0 -1
- package/app/.next/static/chunks/app/(dashboard)/dashboard/combos/page-3390652c042161bf.js +0 -1
- package/app/.next/static/chunks/app/(dashboard)/dashboard/media-providers/[kind]/[id]/page-51ab2246cec930f0.js +0 -53
- package/app/.next/static/chunks/app/(dashboard)/dashboard/media-providers/[kind]/page-1cd57da85dc9a5a0.js +0 -1
- package/app/.next/static/chunks/app/(dashboard)/dashboard/media-providers/web/combo/[id]/page-55f152f000244dfd.js +0 -4
- package/app/.next/static/chunks/app/(dashboard)/dashboard/media-providers/web/page-c02c96576b763028.js +0 -1
- package/app/.next/static/chunks/app/(dashboard)/dashboard/mitm/page-ef2689a6b468da49.js +0 -1
- package/app/.next/static/chunks/app/(dashboard)/dashboard/usage/page-17d9ef16d4d56317.js +0 -1
- package/app/.next/static/chunks/app/dashboard/settings/pricing/page-d9a2df5b3f666b3b.js +0 -1
- package/app/.next/static/chunks/app/login/page-2424ce8673ecf5cb.js +0 -1
- package/app/.next/static/css/06f471e66daf399e.css +0 -1
- /package/app/.next/static/{twJQz13yvhkiPdQu-x4vH → 7D6ZXM7R9e5iCcGAVJvY1}/_buildManifest.js +0 -0
- /package/app/.next/static/{twJQz13yvhkiPdQu-x4vH → 7D6ZXM7R9e5iCcGAVJvY1}/_ssgManifest.js +0 -0
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[4156],{292:(e,t,s)=>{s.d(t,{default:()=>l});var a=s(73365),r=s(87706);function l({children:e,title:t,subtitle:s,icon:n,action:i,padding:o="md",hover:d=!1,elev:c=!1,className:m,...x}){return(0,a.jsxs)("div",{className:(0,r.cn)("bg-surface border border-border-subtle",c?"rounded-[14px] shadow-[var(--shadow-elev)]":"rounded-[14px] shadow-[var(--shadow-soft)]",d&&"hover:shadow-[var(--shadow-warm)] hover:border-brand-500/30 transition-all cursor-pointer",{none:"",xs:"p-3",sm:"p-4",md:"p-6",lg:"p-8"}[o],m),...x,children:[(t||i)&&(0,a.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[n&&(0,a.jsx)("div",{className:"p-2 rounded-[10px] bg-bg text-text-muted",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[20px]",children:n})}),(0,a.jsxs)("div",{children:[t&&(0,a.jsx)("h3",{className:"text-text-main font-semibold",children:t}),s&&(0,a.jsx)("p",{className:"text-sm text-text-muted",children:s})]})]}),i]}),e]})}l.Section=function({children:e,className:t,...s}){return(0,a.jsx)("div",{className:(0,r.cn)("p-4 rounded-[10px]","bg-bg border border-border-subtle",t),...s,children:e})},l.Row=function({children:e,className:t,...s}){return(0,a.jsx)("div",{className:(0,r.cn)("p-3 -mx-3 px-3 transition-colors","border-b border-border-subtle last:border-b-0","hover:bg-surface-2/50",t),...s,children:e})},l.ListItem=function({children:e,actions:t,className:s,...l}){return(0,a.jsxs)("div",{className:(0,r.cn)("group flex items-center justify-between p-3 -mx-3 px-3","border-b border-border-subtle last:border-b-0","hover:bg-surface-2/50 transition-colors",s),...l,children:[(0,a.jsx)("div",{className:"flex-1 min-w-0",children:e}),t&&(0,a.jsx)("div",{className:"flex items-center gap-1 opacity-0 group-hover:opacity-100 transition-opacity",children:t})]})}},1755:(e,t,s)=>{s.d(t,{default:()=>l});var a=s(73365),r=s(87706);function l({options:e=[],value:t,onChange:s,size:n="md",className:i}){let o={sm:"h-7 text-xs",md:"h-9 text-sm",lg:"h-11 text-base"};return(0,a.jsx)("div",{className:(0,r.cn)("inline-flex items-center p-1 rounded-[10px] overflow-x-auto","bg-surface-2",i),children:e.map(e=>(0,a.jsxs)("button",{onClick:()=>s(e.value),className:(0,r.cn)("shrink-0 px-4 rounded-[8px] font-medium transition-all",o[n],t===e.value?"bg-surface text-text-main shadow-sm":"text-text-muted hover:text-text-main"),children:[e.icon&&(0,a.jsx)("span",{className:"material-symbols-outlined text-[16px] mr-1.5",children:e.icon}),e.label]},e.value))})}},3242:(e,t,s)=>{s.d(t,{default:()=>d});var a=s(73365),r=s(1521),l=s(86447),n=s.n(l),i=s(74156),o=s(96459);function d({isOpen:e,provider:t,providerInfo:s,onSuccess:l,onClose:n,oauthMeta:c,idcConfig:m}){let[x,u]=(0,r.useState)("waiting"),[p,h]=(0,r.useState)(null),[f,b]=(0,r.useState)(""),[g,j]=(0,r.useState)(null),[y,v]=(0,r.useState)(!1),[N,w]=(0,r.useState)(null),[k,C]=(0,r.useState)(!1),S=(0,r.useRef)(null),T=(0,r.useRef)(!1),{copied:$,copy:R}=(0,o.C)(),[I,P]=(0,r.useState)(!1),[O,E]=(0,r.useState)("/callback?code=..."),M=(0,r.useRef)(!1);(0,r.useEffect)(()=>{P("localhost"===window.location.hostname||"127.0.0.1"===window.location.hostname),E(`${window.location.origin}/callback?code=...`)},[]);let L=(0,r.useCallback)(async(e,s)=>{if(p)try{let a=await fetch(`/api/oauth/${t}/exchange`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({code:e,redirectUri:p.redirectUri,codeVerifier:p.codeVerifier,state:s,...c?{meta:c}:{}})}),r=await a.json();if(!a.ok)throw Error(r.error);u("success"),l?.()}catch(e){j(e.message),u("error")}},[p,t,l]),_=(0,r.useCallback)(async(e,s,a,r)=>{T.current=!1,C(!0);for(let n=0;n<60;n++){if(T.current){console.log("[OAuthModal] Polling aborted"),C(!1);return}if(await new Promise(e=>setTimeout(e,1e3*a)),T.current){console.log("[OAuthModal] Polling aborted after sleep"),C(!1);return}try{let n=await fetch(`/api/oauth/${t}/poll`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({deviceCode:e,codeVerifier:s,extraData:r})}),i=await n.json();if(i.success){T.current=!0,u("success"),C(!1),l?.();return}if("expired_token"===i.error||"access_denied"===i.error)throw Error(i.errorDescription||i.error);"slow_down"===i.error&&(a=Math.min(a+5,30))}catch(e){j(e.message),u("error"),C(!1);return}}j("Authorization timeout"),u("error"),C(!1)},[t,l]),z=(0,r.useCallback)(async()=>{if(t)try{let e;if(j(null),["github","qwen","kiro","kimi-coding","kilocode","codebuddy"].includes(t)){v(!0),u("waiting");let e=new URL(`/api/oauth/${t}/device-code`,window.location.origin);"kiro"===t&&m?.startUrl&&(e.searchParams.set("start_url",m.startUrl),m.region&&e.searchParams.set("region",m.region),e.searchParams.set("auth_method","idc"));let s=await fetch(e.toString()),a=await s.json();if(!s.ok)throw Error(a.error);w(a);let r=a.verification_uri_complete||a.verification_uri;r&&window.open(r,"_blank","noopener,noreferrer");let l="kiro"===t?{_clientId:a._clientId,_clientSecret:a._clientSecret,_region:a._region,_authMethod:a._authMethod,_startUrl:a._startUrl}:null;_(a.device_code,a.codeVerifier,a.interval||5,l);return}let s=window.location.port||("https:"===window.location.protocol?"443":"80"),a=!1;if("codex"===t){try{let e=await fetch(`/api/oauth/codex/start-proxy?app_port=${s}`);a=(await e.json()).success}catch{a=!1}e="http://localhost:1455/auth/callback"}else e=`http://localhost:${s}/callback`;let r=new URL(`/api/oauth/${t}/authorize`,window.location.origin);r.searchParams.set("redirect_uri",e),c&&Object.entries(c).forEach(([e,t])=>{t&&r.searchParams.set(e,t)});let l=await fetch(r.toString()),n=await l.json();if(!l.ok)throw Error(n.error);h({...n,redirectUri:e}),"codex"===t&&a||I&&"codex"!==t?(u("waiting"),S.current=window.open(n.authUrl,"oauth_popup","width=600,height=700"),S.current||u("input")):(u("input"),window.open(n.authUrl,"_blank"))}catch(e){j(e.message),u("error")}},[t,I,_,c,m]);(0,r.useEffect)(()=>{e&&t?(h(null),b(""),j(null),v(!1),w(null),C(!1),T.current=!1,z()):e||(T.current=!0,"codex"===t&&fetch("/api/oauth/codex/stop-proxy").catch(()=>{}))},[e,t,z]),(0,r.useEffect)(()=>{let e;if(!p)return;M.current=!1;let t=async e=>{if(M.current)return;let{code:t,state:s,error:a,errorDescription:r}=e;if(a){M.current=!0,j(r||a),u("error");return}t&&(M.current=!0,await L(t,s))},s=e=>{let s=e.origin.includes("localhost")||e.origin.includes("127.0.0.1"),a=e.origin===window.location.origin;(s||a)&&e.data?.type==="oauth_callback"&&t(e.data.data)};window.addEventListener("message",s);try{(e=new BroadcastChannel("oauth_callback")).onmessage=e=>t(e.data)}catch(e){console.log("BroadcastChannel not supported")}let a=e=>{if("oauth_callback"===e.key&&e.newValue)try{let s=JSON.parse(e.newValue);t(s),localStorage.removeItem("oauth_callback")}catch(e){console.log("Failed to parse localStorage data")}};window.addEventListener("storage",a);try{let e=localStorage.getItem("oauth_callback");if(e){let s=JSON.parse(e);s.timestamp&&Date.now()-s.timestamp<3e4&&t(s),localStorage.removeItem("oauth_callback")}}catch{}return()=>{window.removeEventListener("message",s),window.removeEventListener("storage",a),e&&e.close()}},[p,L]);let A=async()=>{try{j(null);let e=new URL(f),t=e.searchParams.get("code"),s=e.searchParams.get("state"),a=e.searchParams.get("error");if(a)throw Error(e.searchParams.get("error_description")||a);if(!t)throw Error("No authorization code found in URL");await L(t,s)}catch(e){j(e.message),u("error")}},U=(0,r.useCallback)(()=>{"codex"===t&&fetch("/api/oauth/codex/stop-proxy").catch(()=>{}),n()},[n,t]);if(!t||!s)return null;let q=N?.verification_uri_complete||N?.verification_uri||"";return(0,a.jsx)(i.aF,{isOpen:e,title:`Connect ${s.name}`,onClose:U,size:"lg",children:(0,a.jsxs)("div",{className:"flex flex-col gap-4",children:[("waiting"===x||"input"===x)&&!y&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("div",{className:"flex items-center gap-2 px-3 py-2 border border-border rounded-lg bg-sidebar/50",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-base text-primary animate-spin",children:"progress_activity"}),(0,a.jsx)("span",{className:"text-sm",children:"Waiting for popup authorization…"})]}),(0,a.jsxs)("div",{className:"flex items-center gap-3 my-1",children:[(0,a.jsx)("div",{className:"flex-1 h-px bg-border"}),(0,a.jsx)("span",{className:"text-xs text-text-muted uppercase tracking-wider",children:"Or paste callback URL manually"}),(0,a.jsx)("div",{className:"flex-1 h-px bg-border"})]}),(0,a.jsxs)("div",{className:"space-y-4",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"text-sm font-medium mb-2",children:"Step 1: Open this URL in your browser"}),(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsx)(i.pd,{value:p?.authUrl||"",readOnly:!0,className:"flex-1 font-mono text-xs"}),(0,a.jsx)(i.$n,{variant:"secondary",icon:"auth_url"===$?"check":"content_copy",onClick:()=>R(p?.authUrl,"auth_url"),disabled:!p?.authUrl,children:"Copy"})]})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"text-sm font-medium mb-2",children:"Step 2: Paste the callback URL here"}),(0,a.jsx)("p",{className:"text-xs text-text-muted mb-2",children:"After authorization, copy the full URL from your browser."}),(0,a.jsx)(i.pd,{value:f,onChange:e=>b(e.target.value),placeholder:O,className:"font-mono text-xs"})]})]}),(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsx)(i.$n,{onClick:A,fullWidth:!0,disabled:!f,children:"Connect"}),(0,a.jsx)(i.$n,{onClick:U,variant:"ghost",fullWidth:!0,children:"Cancel"})]})]}),"waiting"===x&&y&&N&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("div",{className:"text-center py-4",children:[(0,a.jsx)("p",{className:"text-sm text-text-muted mb-4",children:"Visit the login URL below and authorize:"}),(0,a.jsxs)("div",{className:"bg-sidebar p-4 rounded-lg mb-4",children:[(0,a.jsx)("p",{className:"text-xs text-text-muted mb-1",children:"Login URL"}),(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("code",{className:"flex-1 text-sm break-all",children:q}),(0,a.jsx)(i.$n,{size:"sm",variant:"ghost",icon:"login_url"===$?"check":"content_copy",onClick:()=>R(q,"login_url"),disabled:!q}),(0,a.jsx)(i.$n,{size:"sm",variant:"ghost",icon:"open_in_new",onClick:()=>window.open(q,"_blank","noopener,noreferrer"),disabled:!q,children:"Open"})]})]}),(0,a.jsxs)("div",{className:"bg-primary/10 p-4 rounded-lg",children:[(0,a.jsx)("p",{className:"text-xs text-text-muted mb-1",children:"Your Code"}),(0,a.jsxs)("div",{className:"flex items-center justify-center gap-2",children:[(0,a.jsx)("p",{className:"text-2xl font-mono font-bold text-primary",children:N.user_code}),(0,a.jsx)(i.$n,{size:"sm",variant:"ghost",icon:"user_code"===$?"check":"content_copy",onClick:()=>R(N.user_code,"user_code")})]})]})]}),k&&(0,a.jsxs)("div",{className:"flex items-center justify-center gap-2 text-sm text-text-muted",children:[(0,a.jsx)("span",{className:"material-symbols-outlined animate-spin",children:"progress_activity"}),"Waiting for authorization..."]})]}),"success"===x&&(0,a.jsxs)("div",{className:"text-center py-6",children:[(0,a.jsx)("div",{className:"size-16 mx-auto mb-4 rounded-full bg-green-100 dark:bg-green-900/30 flex items-center justify-center",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-3xl text-green-600",children:"check_circle"})}),(0,a.jsx)("h3",{className:"text-lg font-semibold mb-2",children:"Connected Successfully!"}),(0,a.jsxs)("p",{className:"text-sm text-text-muted mb-4",children:["Your ",s.name," account has been connected."]}),(0,a.jsx)(i.$n,{onClick:U,fullWidth:!0,children:"Done"})]}),"error"===x&&(0,a.jsxs)("div",{className:"text-center py-6",children:[(0,a.jsx)("div",{className:"size-16 mx-auto mb-4 rounded-full bg-red-100 dark:bg-red-900/30 flex items-center justify-center",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-3xl text-red-600",children:"error"})}),(0,a.jsx)("h3",{className:"text-lg font-semibold mb-2",children:"Connection Failed"}),(0,a.jsx)("p",{className:"text-sm text-red-600 mb-4",children:g}),(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsx)(i.$n,{onClick:z,variant:"secondary",fullWidth:!0,children:"Try Again"}),(0,a.jsx)(i.$n,{onClick:U,variant:"ghost",fullWidth:!0,children:"Cancel"})]})]})]})})}d.propTypes={isOpen:n().bool.isRequired,provider:n().string,providerInfo:n().shape({name:n().string}),onSuccess:n().func,onClose:n().func.isRequired,oauthMeta:n().object,idcConfig:n().shape({startUrl:n().string,region:n().string})}},3412:(e,t,s)=>{s.d(t,{default:()=>B});var a=s(73365),r=s(1521),l=s(29717),n=s(82495),i=s(35045),o=s(292),d=s(86447),c=s.n(d);let m=e=>new Intl.NumberFormat().format(e||0);function x({stats:e}){let t;return(0,a.jsxs)("div",{className:"grid min-w-0 grid-cols-1 gap-3 sm:grid-cols-2 md:grid-cols-4 sm:gap-4",children:[(0,a.jsxs)(o.default,{className:"flex min-w-0 flex-col gap-1 px-4 py-3",children:[(0,a.jsx)("span",{className:"text-text-muted text-sm uppercase font-semibold",children:"Total Requests"}),(0,a.jsx)("span",{className:"truncate text-2xl font-bold",children:m(e.totalRequests)})]}),(0,a.jsxs)(o.default,{className:"flex min-w-0 flex-col gap-1 px-4 py-3",children:[(0,a.jsx)("span",{className:"text-text-muted text-sm uppercase font-semibold",children:"Total Input Tokens"}),(0,a.jsx)("span",{className:"truncate text-2xl font-bold text-primary",children:m(e.totalPromptTokens)})]}),(0,a.jsxs)(o.default,{className:"flex min-w-0 flex-col gap-1 px-4 py-3",children:[(0,a.jsx)("span",{className:"text-text-muted text-sm uppercase font-semibold",children:"Output Tokens"}),(0,a.jsx)("span",{className:"truncate text-2xl font-bold text-success",children:m(e.totalCompletionTokens)})]}),(0,a.jsxs)(o.default,{className:"flex min-w-0 flex-col gap-1 px-4 py-3",children:[(0,a.jsx)("span",{className:"text-text-muted text-sm uppercase font-semibold",children:"Est. Cost"}),(0,a.jsxs)("span",{className:"truncate text-2xl font-bold text-warning",children:["~",(t=e.totalCost,`$${(t||0).toFixed(2)}`)]}),(0,a.jsx)("span",{className:"text-[10px] text-text-muted",children:"Estimated, not actual billing"})]})]})}x.propTypes={stats:c().object.isRequired};let u=e=>new Intl.NumberFormat().format(e||0),p=e=>`$${(e||0).toFixed(2)}`;function h(e){if(!e)return"Never";let t=Math.floor((Date.now()-new Date(e))/6e4);return t<1?"Just now":t<60?`${t}m ago`:t<1440?`${Math.floor(t/60)}h ago`:new Date(e).toLocaleDateString()}function f({field:e,currentSort:t,currentOrder:s}){return t!==e?(0,a.jsx)("span",{className:"ml-1 opacity-20",children:"↕"}):(0,a.jsx)("span",{className:"ml-1",children:"asc"===s?"↑":"↓"})}function b({item:e,viewMode:t,isSummary:s=!1}){return"tokens"===t?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("td",{className:"px-6 py-3 text-right text-text-muted",children:s&&void 0===e.promptTokens?"—":u(e.promptTokens)}),(0,a.jsx)("td",{className:"px-6 py-3 text-right text-text-muted",children:s&&void 0===e.completionTokens?"—":u(e.completionTokens)}),(0,a.jsx)("td",{className:"px-6 py-3 text-right font-medium",children:u(e.totalTokens)})]}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("td",{className:"px-6 py-3 text-right text-text-muted",children:s&&void 0===e.inputCost?"—":p(e.inputCost)}),(0,a.jsx)("td",{className:"px-6 py-3 text-right text-text-muted",children:s&&void 0===e.outputCost?"—":p(e.outputCost)}),(0,a.jsx)("td",{className:"px-6 py-3 text-right font-medium text-warning",children:p(e.totalCost||e.cost)})]})}function g({title:e,columns:t,groupedData:s,tableType:l,sortBy:n,sortOrder:i,onToggleSort:d,viewMode:c,storageKey:m,renderDetailCells:x,renderSummaryCells:u,emptyMessage:p}){let[h,j]=(0,r.useState)(new Set);(0,r.useEffect)(()=>{try{let e=localStorage.getItem(m);e&&j(new Set(JSON.parse(e)))}catch(e){console.error(`Failed to load ${m}:`,e)}},[m]),(0,r.useEffect)(()=>{try{localStorage.setItem(m,JSON.stringify([...h]))}catch(e){console.error(`Failed to save ${m}:`,e)}},[h,m]);let y=(0,r.useCallback)(e=>{j(t=>{let s=new Set(t);return s.has(e)?s.delete(e):s.add(e),s})},[]),v=(0,r.useMemo)(()=>"tokens"===c?[{field:"promptTokens",label:"Input Tokens"},{field:"completionTokens",label:"Output Tokens"},{field:"totalTokens",label:"Total Tokens"}]:[{field:"promptTokens",label:"Input Cost"},{field:"completionTokens",label:"Output Cost"},{field:"cost",label:"Total Cost"}],[c]),N=t.length+v.length;return(0,a.jsxs)(o.default,{className:"overflow-hidden",children:[(0,a.jsx)("div",{className:"p-4 border-b border-border bg-bg-subtle/50",children:(0,a.jsx)("h3",{className:"font-semibold",children:e})}),(0,a.jsx)("div",{className:"overflow-x-auto",children:(0,a.jsxs)("table",{className:"w-full text-sm text-left",children:[(0,a.jsx)("thead",{className:"bg-bg-subtle/30 text-text-muted uppercase text-xs",children:(0,a.jsxs)("tr",{children:[t.map(e=>(0,a.jsxs)("th",{className:`px-6 py-3 cursor-pointer hover:bg-bg-subtle/50 ${"right"===e.align?"text-right":""}`,onClick:()=>d(l,e.field),children:[e.label," ",(0,a.jsx)(f,{field:e.field,currentSort:n,currentOrder:i})]},e.field)),v.map(e=>(0,a.jsxs)("th",{className:"px-6 py-3 text-right cursor-pointer hover:bg-bg-subtle/50",onClick:()=>d(l,e.field),children:[e.label," ",(0,a.jsx)(f,{field:e.field,currentSort:n,currentOrder:i})]},e.field))]})}),(0,a.jsxs)("tbody",{className:"divide-y divide-border",children:[s.map(e=>(0,a.jsxs)(r.Fragment,{children:[(0,a.jsxs)("tr",{className:"group-summary cursor-pointer hover:bg-bg-subtle/50 transition-colors",onClick:()=>y(e.groupKey),children:[(0,a.jsx)("td",{className:"px-6 py-3",children:(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:`material-symbols-outlined text-[18px] text-text-muted transition-transform ${h.has(e.groupKey)?"rotate-90":""}`,children:"chevron_right"}),(0,a.jsx)("span",{className:`font-medium transition-colors ${e.summary.pending>0?"text-primary":""}`,children:e.groupKey})]})}),u(e),(0,a.jsx)(b,{item:e.summary,viewMode:c,isSummary:!0})]}),h.has(e.groupKey)&&e.items.map(e=>(0,a.jsxs)("tr",{className:"group-detail hover:bg-bg-subtle/20 transition-colors",children:[x(e),(0,a.jsx)(b,{item:e,viewMode:c})]},`detail-${e.key}`))]},e.groupKey)),0===s.length&&(0,a.jsx)("tr",{children:(0,a.jsx)("td",{colSpan:N,className:"px-6 py-8 text-center text-text-muted",children:p})})]})]})})]})}f.propTypes={field:c().string.isRequired,currentSort:c().string.isRequired,currentOrder:c().string.isRequired},b.propTypes={item:c().object.isRequired,viewMode:c().string.isRequired,isSummary:c().bool},g.propTypes={title:c().string.isRequired,columns:c().arrayOf(c().shape({field:c().string.isRequired,label:c().string.isRequired,align:c().string})).isRequired,groupedData:c().array.isRequired,tableType:c().string.isRequired,sortBy:c().string.isRequired,sortOrder:c().string.isRequired,onToggleSort:c().func.isRequired,viewMode:c().string.isRequired,storageKey:c().string.isRequired,renderDetailCells:c().func.isRequired,renderSummaryCells:c().func.isRequired,emptyMessage:c().string.isRequired};var j=s(70842),y=s(36629);function v({data:e}){let{label:t,color:s,imageUrl:l,textIcon:n,active:i}=e,[o,d]=(0,r.useState)(!1);return(0,a.jsxs)("div",{className:"flex items-center gap-2.5 px-4 py-2.5 rounded-lg border-2 transition-all duration-300 bg-bg",style:{borderColor:i?s:"var(--color-border)",boxShadow:i?`0 0 16px ${s}40`:"none",minWidth:"150px"},children:[(0,a.jsx)(j.h7,{type:"target",position:y.yX.Top,id:"top",className:"!bg-transparent !border-0 !w-0 !h-0"}),(0,a.jsx)(j.h7,{type:"target",position:y.yX.Bottom,id:"bottom",className:"!bg-transparent !border-0 !w-0 !h-0"}),(0,a.jsx)(j.h7,{type:"target",position:y.yX.Left,id:"left",className:"!bg-transparent !border-0 !w-0 !h-0"}),(0,a.jsx)(j.h7,{type:"target",position:y.yX.Right,id:"right",className:"!bg-transparent !border-0 !w-0 !h-0"}),(0,a.jsx)("div",{className:"w-8 h-8 rounded-md flex items-center justify-center shrink-0",style:{backgroundColor:`${s}15`},children:o?(0,a.jsx)("span",{className:"text-sm font-bold",style:{color:s},children:n}):(0,a.jsx)("img",{src:l,alt:t,className:"w-6 h-6 rounded-sm object-contain",onError:()=>d(!0)})}),(0,a.jsx)("span",{className:"text-base font-medium truncate",style:{color:i?s:"var(--color-text)"},children:t}),i&&(0,a.jsxs)("span",{className:"relative flex h-2 w-2 shrink-0",children:[(0,a.jsx)("span",{className:"animate-ping absolute inline-flex h-full w-full rounded-full opacity-75",style:{backgroundColor:s}}),(0,a.jsx)("span",{className:"relative inline-flex rounded-full h-2 w-2",style:{backgroundColor:s}})]})]})}function N({data:e}){return(0,a.jsxs)("div",{className:"flex items-center justify-center px-5 py-3 rounded-xl border-2 border-primary bg-primary/5 shadow-md min-w-[130px]",children:[(0,a.jsx)(j.h7,{type:"source",position:y.yX.Top,id:"top",className:"!bg-transparent !border-0 !w-0 !h-0"}),(0,a.jsx)(j.h7,{type:"source",position:y.yX.Bottom,id:"bottom",className:"!bg-transparent !border-0 !w-0 !h-0"}),(0,a.jsx)(j.h7,{type:"source",position:y.yX.Left,id:"left",className:"!bg-transparent !border-0 !w-0 !h-0"}),(0,a.jsx)(j.h7,{type:"source",position:y.yX.Right,id:"right",className:"!bg-transparent !border-0 !w-0 !h-0"}),(0,a.jsx)("img",{src:"/favicon.svg",alt:"9Router",className:"w-6 h-6 mr-2"}),(0,a.jsx)("span",{className:"text-sm font-bold text-primary",children:"9Router"}),e.activeCount>0&&(0,a.jsx)("span",{className:"ml-2 px-1.5 py-0.5 rounded-full bg-primary text-white text-xs font-bold",children:e.activeCount})]})}s(97621),v.propTypes={data:c().object.isRequired},N.propTypes={data:c().object.isRequired};let w={provider:v,router:N};function k({providers:e=[],activeRequests:t=[],lastProvider:s="",errorProvider:l=""}){let i=(0,r.useMemo)(()=>t.map(e=>e.provider?.toLowerCase()).filter(Boolean).sort().join(","),[t]),o=s?.toLowerCase()||"",d=l?.toLowerCase()||"",c=(0,r.useMemo)(()=>new Set(i?i.split(","):[]),[i]),m=(0,r.useMemo)(()=>new Set(o?[o]:[]),[o]),x=(0,r.useMemo)(()=>new Set(d?[d]:[]),[d]),{nodes:u,edges:p}=(0,r.useMemo)(()=>(function(e,t,s,a){let r=e.length,l=Math.max(320,204*r/(2*Math.PI)),i=Math.max(200,.55*l);if(0===r)return{nodes:[{id:"router",type:"router",position:{x:0,y:0},data:{activeCount:0},draggable:!1}],edges:[]};let o=[],d=[];return o.push({id:"router",type:"router",position:{x:-60,y:-22},data:{activeCount:t.size},draggable:!1}),e.forEach((e,c)=>{var m,x;let u,p,h=(m=e.provider,n.Q2[m]||{color:"#6b7280",name:m}),f=t.has(e.provider?.toLowerCase()),b=!f&&s.has(e.provider?.toLowerCase()),g=!f&&a.has(e.provider?.toLowerCase()),j=`provider-${e.provider}`,y={label:(h.name!==e.provider?h.name:null)||e.name||e.provider,color:h.color||"#6b7280",imageUrl:(x=e.provider,`/providers/${x}.png`),textIcon:h.textIcon||(e.provider||"?").slice(0,2).toUpperCase(),active:f},v=-Math.PI/2+2*Math.PI*c/r,N=l*Math.cos(v),w=i*Math.sin(v);Math.abs(v+Math.PI/2)<Math.PI/4||Math.abs(v-3*Math.PI/2)<Math.PI/4?(u="top",p="bottom"):Math.abs(v-Math.PI/2)<Math.PI/4?(u="bottom",p="top"):N>0?(u="right",p="left"):(u="left",p="right"),o.push({id:j,type:"provider",position:{x:N-90,y:w-15},data:y,draggable:!1}),d.push({id:`e-${j}`,source:"router",sourceHandle:u,target:j,targetHandle:p,animated:f,style:(h.color,g?{stroke:"#ef4444",strokeWidth:2.5,opacity:.9}:f?{stroke:"#22c55e",strokeWidth:2.5,opacity:.9}:b?{stroke:"#f59e0b",strokeWidth:2,opacity:.7}:{stroke:"var(--color-border)",strokeWidth:1,opacity:.3})})}),{nodes:o,edges:d}})(e,c,m,x),[e,i,o,d]),h=(0,r.useMemo)(()=>e.map(e=>e.provider).sort().join(","),[e]),f=(0,r.useRef)(null),b=(0,r.useCallback)(e=>{f.current=e,setTimeout(()=>e.fitView({padding:.3}),50)},[]);return(0,a.jsx)("div",{className:"h-[320px] w-full min-w-0 rounded-lg border border-border bg-bg-subtle/30 sm:h-[480px]",children:0===e.length?(0,a.jsx)("div",{className:"h-full flex items-center justify-center text-text-muted text-sm",children:"No providers connected"}):(0,a.jsx)(j.Gc,{nodes:u,edges:p,nodeTypes:w,fitView:!0,fitViewOptions:{padding:.3},onInit:b,proOptions:{hideAttribution:!0},panOnDrag:!1,zoomOnScroll:!1,zoomOnPinch:!1,zoomOnDoubleClick:!1,preventScrolling:!1,nodesDraggable:!1,nodesConnectable:!1,elementsSelectable:!1},h)})}k.propTypes={providers:c().arrayOf(c().shape({id:c().string,provider:c().string,name:c().string})),activeRequests:c().arrayOf(c().shape({provider:c().string,model:c().string,account:c().string})),lastProvider:c().string,errorProvider:c().string};var C=s(71220),S=s(51142),T=s(35692),$=s(39719),R=s(94580),I=s(38147),P=s(80900);let O=e=>e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}K`:String(e||0),E=e=>`$${(e||0).toFixed(4)}`;function M({period:e="7d"}){let[t,s]=(0,r.useState)([]),[l,n]=(0,r.useState)(!0),[i,d]=(0,r.useState)("tokens"),c=(0,r.useCallback)(async()=>{n(!0);try{let t=await fetch(`/api/usage/chart?period=${e}`);if(t.ok){let e=await t.json();s(e)}}catch(e){console.error("Failed to fetch chart data:",e)}finally{n(!1)}},[e]);(0,r.useEffect)(()=>{c()},[c]);let m=t.some(e=>e.tokens>0||e.cost>0);return(0,a.jsxs)(o.default,{className:"flex min-w-0 flex-col gap-3 p-3 sm:p-4",children:[(0,a.jsxs)("div",{className:"grid w-full grid-cols-2 items-center gap-1 rounded-lg border border-border bg-bg-subtle p-1 sm:w-auto sm:self-start",children:[(0,a.jsx)("button",{onClick:()=>d("tokens"),className:`px-3 py-1 rounded-md text-sm font-medium transition-colors ${"tokens"===i?"bg-primary text-white shadow-sm":"text-text-muted hover:text-text hover:bg-bg-hover"}`,children:"Tokens"}),(0,a.jsx)("button",{onClick:()=>d("cost"),className:`px-3 py-1 rounded-md text-sm font-medium transition-colors ${"cost"===i?"bg-primary text-white shadow-sm":"text-text-muted hover:text-text hover:bg-bg-hover"}`,children:"Cost"})]}),l?(0,a.jsx)("div",{className:"h-48 flex items-center justify-center text-text-muted text-sm",children:"Loading..."}):m?(0,a.jsx)(C.u,{width:"100%",height:220,children:(0,a.jsxs)(S.Q,{data:t,margin:{top:4,right:8,left:0,bottom:0},children:[(0,a.jsxs)("defs",{children:[(0,a.jsxs)("linearGradient",{id:"gradTokens",x1:"0",y1:"0",x2:"0",y2:"1",children:[(0,a.jsx)("stop",{offset:"5%",stopColor:"#6366f1",stopOpacity:.25}),(0,a.jsx)("stop",{offset:"95%",stopColor:"#6366f1",stopOpacity:0})]}),(0,a.jsxs)("linearGradient",{id:"gradCost",x1:"0",y1:"0",x2:"0",y2:"1",children:[(0,a.jsx)("stop",{offset:"5%",stopColor:"#f59e0b",stopOpacity:.25}),(0,a.jsx)("stop",{offset:"95%",stopColor:"#f59e0b",stopOpacity:0})]})]}),(0,a.jsx)(T.d,{strokeDasharray:"3 3",strokeOpacity:.1}),(0,a.jsx)($.W,{dataKey:"label",tick:{fontSize:10,fill:"currentColor",fillOpacity:.5},tickLine:!1,axisLine:!1,interval:"preserveStartEnd"}),(0,a.jsx)(R.h,{tick:{fontSize:10,fill:"currentColor",fillOpacity:.5},tickLine:!1,axisLine:!1,tickFormatter:"tokens"===i?O:E,width:50}),(0,a.jsx)(I.m,{contentStyle:{backgroundColor:"var(--color-bg)",border:"1px solid var(--color-border)",borderRadius:"8px",fontSize:"12px"},formatter:(e,t)=>"tokens"===t?[O(e),"Tokens"]:[E(e),"Cost"]}),"tokens"===i?(0,a.jsx)(P.Gk,{type:"monotone",dataKey:"tokens",stroke:"#6366f1",strokeWidth:2,fill:"url(#gradTokens)",dot:!1,activeDot:{r:4}}):(0,a.jsx)(P.Gk,{type:"monotone",dataKey:"cost",stroke:"#f59e0b",strokeWidth:2,fill:"url(#gradCost)",dot:!1,activeDot:{r:4}})]})}):(0,a.jsx)("div",{className:"h-48 flex items-center justify-center text-text-muted text-sm",children:"No data for this period"})]})}function L({timestamp:e}){let t,[,s]=(0,r.useState)(0);return(0,r.useEffect)(()=>{let e=setInterval(()=>s(e=>e+1),1e3);return()=>clearInterval(e)},[]),(0,a.jsx)(a.Fragment,{children:(t=Math.floor((Date.now()-new Date(e))/1e3))<60?`${t}s ago`:t<3600?`${Math.floor(t/60)}m ago`:t<86400?`${Math.floor(t/3600)}h ago`:`${Math.floor(t/86400)}d ago`})}function _({requests:e=[]}){return(0,a.jsxs)(o.default,{className:"flex min-w-0 flex-col overflow-hidden",padding:"sm",style:{height:480},children:[(0,a.jsx)("div",{className:"px-1 py-2 border-b border-border shrink-0",children:(0,a.jsx)("span",{className:"text-xs font-semibold text-text-muted uppercase tracking-wide",children:"Recent Requests"})}),e.length?(0,a.jsx)("div",{className:"flex-1 overflow-y-auto",children:(0,a.jsxs)("table",{className:"w-full min-w-[300px] border-collapse text-xs",children:[(0,a.jsx)("thead",{className:"sticky top-0 bg-bg z-10",children:(0,a.jsxs)("tr",{className:"border-b border-border",children:[(0,a.jsx)("th",{className:"py-1.5 text-left font-semibold text-text-muted w-2"}),(0,a.jsx)("th",{className:"py-1.5 text-left font-semibold text-text-muted",children:"Model"}),(0,a.jsx)("th",{className:"py-1.5 text-right font-semibold text-text-muted whitespace-nowrap",children:"In / Out"}),(0,a.jsx)("th",{className:"py-1.5 text-right font-semibold text-text-muted",children:"When"})]})}),(0,a.jsx)("tbody",{className:"divide-y divide-border/50",children:e.map((e,t)=>{let s=!e.status||"ok"===e.status||"success"===e.status;return(0,a.jsxs)("tr",{className:"hover:bg-bg-subtle transition-colors",children:[(0,a.jsx)("td",{className:"py-1.5",children:(0,a.jsx)("span",{className:`block w-1.5 h-1.5 rounded-full ${s?"bg-success":"bg-error"}`})}),(0,a.jsx)("td",{className:"py-1.5 font-mono truncate max-w-[120px]",title:e.model,children:e.model}),(0,a.jsxs)("td",{className:"py-1.5 text-right whitespace-nowrap",children:[(0,a.jsxs)("span",{className:"text-primary",children:[u(e.promptTokens),"↑"]})," ",(0,a.jsxs)("span",{className:"text-success",children:[u(e.completionTokens),"↓"]})]}),(0,a.jsx)("td",{className:"py-1.5 text-right text-text-muted whitespace-nowrap",children:(0,a.jsx)(L,{timestamp:e.timestamp})})]},t)})})]})}):(0,a.jsx)("div",{className:"flex-1 flex items-center justify-center text-text-muted text-sm",children:"No requests yet."})]})}function z(e,t={},s,a){return Object.entries(e||{}).map(([e,s])=>{let a=(s.promptTokens||0)+(s.completionTokens||0),r=s.cost||0,l=a>0?(s.promptTokens||0)*(r/a):0,n=a>0?(s.completionTokens||0)*(r/a):0;return{...s,key:e,totalTokens:a,totalCost:r,inputCost:l,outputCost:n,pending:t[e]||0}}).sort((e,t)=>{let r=e[s],l=t[s];return("string"==typeof r&&(r=r.toLowerCase()),"string"==typeof l&&(l=l.toLowerCase()),r<l)?"asc"===a?-1:1:r>l?"asc"===a?1:-1:0})}function A(e,t){if(!Array.isArray(e))return[];let s={};return e.forEach(e=>{let a=function(e,t){switch(t){case"rawModel":return e.rawModel||"Unknown Model";case"accountName":return e.accountName||`Account ${e.connectionId?.slice(0,8)}...`||"Unknown Account";case"keyName":return e.keyName||"Unknown Key";case"endpoint":return e.endpoint||"Unknown Endpoint";default:return e[t]||"Unknown"}}(e,t);s[a]||(s[a]={groupKey:a,summary:{requests:0,promptTokens:0,completionTokens:0,totalTokens:0,cost:0,inputCost:0,outputCost:0,lastUsed:null,pending:0},items:[]});let r=s[a].summary;r.requests+=e.requests||0,r.promptTokens+=e.promptTokens||0,r.completionTokens+=e.completionTokens||0,r.totalTokens+=e.totalTokens||0,r.cost+=e.cost||0,r.inputCost+=e.inputCost||0,r.outputCost+=e.outputCost||0,r.pending+=e.pending||0,e.lastUsed&&(!r.lastUsed||new Date(e.lastUsed)>new Date(r.lastUsed))&&(r.lastUsed=e.lastUsed),s[a].items.push(e)}),Object.values(s)}M.propTypes={period:c().string};let U=[{field:"rawModel",label:"Model"},{field:"provider",label:"Provider"},{field:"requests",label:"Requests",align:"right"},{field:"lastUsed",label:"Last Used",align:"right"}],q=[{field:"rawModel",label:"Model"},{field:"provider",label:"Provider"},{field:"accountName",label:"Account"},{field:"requests",label:"Requests",align:"right"},{field:"lastUsed",label:"Last Used",align:"right"}],F=[{field:"keyName",label:"API Key Name"},{field:"rawModel",label:"Model"},{field:"provider",label:"Provider"},{field:"requests",label:"Requests",align:"right"},{field:"lastUsed",label:"Last Used",align:"right"}],D=[{field:"endpoint",label:"Endpoint"},{field:"rawModel",label:"Model"},{field:"provider",label:"Provider"},{field:"requests",label:"Requests",align:"right"},{field:"lastUsed",label:"Last Used",align:"right"}],W=[{value:"model",label:"Usage by Model"},{value:"account",label:"Usage by Account"},{value:"apiKey",label:"Usage by API Key"},{value:"endpoint",label:"Usage by Endpoint"}],K=[{value:"24h",label:"24h"},{value:"7d",label:"7D"},{value:"30d",label:"30D"},{value:"60d",label:"60D"}];function B({period:e,setPeriod:t,hidePeriodSelector:s=!1}={}){let o=(0,l.useRouter)(),d=(0,l.useSearchParams)(),c=d.get("sortBy")||"rawModel",m=d.get("sortOrder")||"asc",[p,f]=(0,r.useState)(null),[b,j]=(0,r.useState)(!0),[y,v]=(0,r.useState)(!1),[N,w]=(0,r.useState)("model"),[C,S]=(0,r.useState)("costs"),[T,$]=(0,r.useState)([]),[R,I]=(0,r.useState)("7d"),P=e??R,O=t??I;(0,r.useEffect)(()=>{fetch("/api/providers").then(e=>e.ok?e.json():null).then(e=>{let t=new Set;$([...(e?.connections||[]).filter(e=>!t.has(e.provider)&&(t.add(e.provider),!0)),...Object.values(n.IS).filter(e=>e.noAuth&&!t.has(e.id)).map(e=>({provider:e.id,name:e.name}))])}).catch(()=>{})},[]),(0,r.useEffect)(()=>{p?v(!0):j(!0),fetch(`/api/usage/stats?period=${P}`).then(e=>e.ok?e.json():null).then(e=>{e&&f(t=>({...t,...e}))}).catch(()=>{}).finally(()=>{j(!1),v(!1)})},[P]),(0,r.useEffect)(()=>{let e=new EventSource("/api/usage/stream");return e.onmessage=e=>{try{let t=JSON.parse(e.data);f(e=>({...e||{},activeRequests:t.activeRequests,recentRequests:t.recentRequests,errorProvider:t.errorProvider,pending:t.pending})),j(!1)}catch(e){console.error("[SSE CLIENT] parse error:",e)}},e.onerror=()=>j(!1),()=>e.close()},[]);let E=(0,r.useCallback)((e,t)=>{let s=new URLSearchParams(d.toString());s.get("sortBy")===t?s.set("sortOrder","asc"===s.get("sortOrder")?"desc":"asc"):(s.set("sortBy",t),s.set("sortOrder","asc")),o.replace(`?${s.toString()}`,{scroll:!1})},[d,o]),L=(0,r.useMemo)(()=>{if(!p)return null;switch(N){case"model":{let e=p.pending?.byModel||{};return{columns:U,groupedData:A(z(p.byModel,e,c,m),"rawModel"),storageKey:"usage-stats:expanded-models",emptyMessage:"No usage recorded yet.",renderSummaryCells:e=>(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("td",{className:"px-6 py-3 text-text-muted",children:"—"}),(0,a.jsx)("td",{className:"px-6 py-3 text-right",children:u(e.summary.requests)}),(0,a.jsx)("td",{className:"px-6 py-3 text-right text-text-muted whitespace-nowrap",children:h(e.summary.lastUsed)})]}),renderDetailCells:e=>(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("td",{className:`px-6 py-3 font-medium transition-colors ${e.pending>0?"text-primary":""}`,children:e.rawModel}),(0,a.jsx)("td",{className:"px-6 py-3",children:(0,a.jsx)(i.default,{variant:e.pending>0?"primary":"neutral",size:"sm",children:e.provider})}),(0,a.jsx)("td",{className:"px-6 py-3 text-right",children:u(e.requests)}),(0,a.jsx)("td",{className:"px-6 py-3 text-right text-text-muted whitespace-nowrap",children:h(e.lastUsed)})]})}}case"account":{let e={};return p?.pending?.byAccount&&Object.entries(p.byAccount||{}).forEach(([t,s])=>{let a=p.pending.byAccount[s.connectionId];if(a){let r=s.provider?`${s.rawModel} (${s.provider})`:s.rawModel;e[t]=a[r]||0}}),{columns:q,groupedData:A(z(p.byAccount,e,c,m),"accountName"),storageKey:"usage-stats:expanded-accounts",emptyMessage:"No account-specific usage recorded yet.",renderSummaryCells:e=>(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("td",{className:"px-6 py-3 text-text-muted",children:"—"}),(0,a.jsx)("td",{className:"px-6 py-3 text-text-muted",children:"—"}),(0,a.jsx)("td",{className:"px-6 py-3 text-right",children:u(e.summary.requests)}),(0,a.jsx)("td",{className:"px-6 py-3 text-right text-text-muted whitespace-nowrap",children:h(e.summary.lastUsed)})]}),renderDetailCells:e=>(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("td",{className:`px-6 py-3 font-medium transition-colors ${e.pending>0?"text-primary":""}`,children:e.accountName||`Account ${e.connectionId?.slice(0,8)}...`}),(0,a.jsx)("td",{className:`px-6 py-3 font-medium transition-colors ${e.pending>0?"text-primary":""}`,children:e.rawModel}),(0,a.jsx)("td",{className:"px-6 py-3",children:(0,a.jsx)(i.default,{variant:e.pending>0?"primary":"neutral",size:"sm",children:e.provider})}),(0,a.jsx)("td",{className:"px-6 py-3 text-right",children:u(e.requests)}),(0,a.jsx)("td",{className:"px-6 py-3 text-right text-text-muted whitespace-nowrap",children:h(e.lastUsed)})]})}}case"apiKey":return{columns:F,groupedData:A(z(p.byApiKey,{},c,m),"keyName"),storageKey:"usage-stats:expanded-apikeys",emptyMessage:"No API key usage recorded yet.",renderSummaryCells:e=>(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("td",{className:"px-6 py-3 text-text-muted",children:"—"}),(0,a.jsx)("td",{className:"px-6 py-3 text-text-muted",children:"—"}),(0,a.jsx)("td",{className:"px-6 py-3 text-right",children:u(e.summary.requests)}),(0,a.jsx)("td",{className:"px-6 py-3 text-right text-text-muted whitespace-nowrap",children:h(e.summary.lastUsed)})]}),renderDetailCells:e=>(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("td",{className:"px-6 py-3 font-medium",children:e.keyName}),(0,a.jsx)("td",{className:"px-6 py-3",children:e.rawModel}),(0,a.jsx)("td",{className:"px-6 py-3",children:(0,a.jsx)(i.default,{variant:"neutral",size:"sm",children:e.provider})}),(0,a.jsx)("td",{className:"px-6 py-3 text-right",children:u(e.requests)}),(0,a.jsx)("td",{className:"px-6 py-3 text-right text-text-muted whitespace-nowrap",children:h(e.lastUsed)})]})};default:return{columns:D,groupedData:A(z(p.byEndpoint,{},c,m),"endpoint"),storageKey:"usage-stats:expanded-endpoints",emptyMessage:"No endpoint usage recorded yet.",renderSummaryCells:e=>(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("td",{className:"px-6 py-3 text-text-muted",children:"—"}),(0,a.jsx)("td",{className:"px-6 py-3 text-text-muted",children:"—"}),(0,a.jsx)("td",{className:"px-6 py-3 text-right",children:u(e.summary.requests)}),(0,a.jsx)("td",{className:"px-6 py-3 text-right text-text-muted whitespace-nowrap",children:h(e.summary.lastUsed)})]}),renderDetailCells:e=>(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("td",{className:"px-6 py-3 font-medium font-mono text-sm",children:e.endpoint}),(0,a.jsx)("td",{className:"px-6 py-3",children:e.rawModel}),(0,a.jsx)("td",{className:"px-6 py-3",children:(0,a.jsx)(i.default,{variant:"neutral",size:"sm",children:e.provider})}),(0,a.jsx)("td",{className:"px-6 py-3 text-right",children:u(e.requests)}),(0,a.jsx)("td",{className:"px-6 py-3 text-right text-text-muted whitespace-nowrap",children:h(e.lastUsed)})]})}}},[p,N,c,m]);if(!p&&!b)return(0,a.jsx)("div",{className:"text-text-muted",children:"Failed to load usage statistics."});let V=(0,a.jsx)("div",{className:"flex items-center justify-center py-12 text-text-muted",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[32px] animate-spin",children:"progress_activity"})});return(0,a.jsxs)("div",{className:"flex min-w-0 flex-col gap-6",children:[!s&&(0,a.jsxs)("div",{className:"flex w-full items-center gap-2 sm:w-auto sm:self-end",children:[(0,a.jsx)("div",{className:"grid flex-1 grid-cols-4 items-center gap-1 rounded-lg border border-border bg-bg-subtle p-1 sm:flex sm:flex-none",children:K.map(e=>(0,a.jsx)("button",{onClick:()=>O(e.value),disabled:y,className:`rounded-md px-3 py-1 text-sm font-medium transition-colors ${P===e.value?"bg-primary text-white shadow-sm":"text-text-muted hover:bg-bg-hover hover:text-text"}`,children:e.label},e.value))}),y&&(0,a.jsx)("span",{className:"material-symbols-outlined text-[16px] text-text-muted animate-spin",children:"progress_activity"})]}),b?V:(0,a.jsx)(x,{stats:p}),b?V:(0,a.jsxs)("div",{className:"grid min-w-0 grid-cols-1 items-stretch gap-2 lg:grid-cols-[minmax(0,2fr)_minmax(280px,1fr)]",children:[(0,a.jsx)(k,{providers:T,activeRequests:p.activeRequests||[],lastProvider:p.recentRequests?.[0]?.provider||"",errorProvider:p.errorProvider||""}),(0,a.jsx)(_,{requests:p.recentRequests||[]})]}),b?V:(0,a.jsx)(M,{period:P}),(0,a.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,a.jsxs)("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between",children:[(0,a.jsx)("select",{value:N,onChange:e=>w(e.target.value),className:"w-full rounded-lg border border-border bg-bg-subtle px-3 py-1.5 text-sm font-medium text-text focus:outline-none focus:ring-2 focus:ring-primary/50 sm:w-auto",children:W.map(e=>(0,a.jsx)("option",{value:e.value,children:e.label},e.value))}),(0,a.jsxs)("div",{className:"grid grid-cols-2 items-center gap-1 rounded-lg border border-border bg-bg-subtle p-1 sm:flex",children:[(0,a.jsx)("button",{onClick:()=>S("costs"),className:`px-3 py-1 rounded-md text-sm font-medium transition-colors ${"costs"===C?"bg-primary text-white shadow-sm":"text-text-muted hover:text-text hover:bg-bg-hover"}`,children:"Costs"}),(0,a.jsx)("button",{onClick:()=>S("tokens"),className:`px-3 py-1 rounded-md text-sm font-medium transition-colors ${"tokens"===C?"bg-primary text-white shadow-sm":"text-text-muted hover:text-text hover:bg-bg-hover"}`,children:"Tokens"})]})]}),b?V:L&&(0,a.jsx)(g,{title:"",columns:L.columns,groupedData:L.groupedData,tableType:N,sortBy:c,sortOrder:m,onToggleSort:E,viewMode:C,storageKey:L.storageKey,renderSummaryCells:L.renderSummaryCells,renderDetailCells:L.renderDetailCells,emptyMessage:L.emptyMessage})]})]})}},5671:(e,t,s)=>{s.d(t,{default:()=>o});var a=s(73365),r=s(1521),l=s(66911),n=s(38230),i=s(96459);function o({isOpen:e,onClose:t,title:s="Manual Configuration",configs:d=[]}){let{copy:c}=(0,i.C)(),[m,x]=(0,r.useState)(null);return(0,a.jsx)(l.default,{isOpen:e,onClose:t,title:s,size:"xl",children:(0,a.jsx)("div",{className:"flex flex-col gap-4",children:d.map((e,t)=>(0,a.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsx)("span",{className:"text-sm font-medium text-text-main",children:e.filename}),(0,a.jsxs)(n.default,{variant:"ghost",size:"sm",onClick:()=>{var s;return s=e.content,void(c(s,`manualconfig-${t}`),x(t),setTimeout(()=>x(null),2e3))},children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:m===t?"check":"content_copy"}),m===t?"Copied!":"Copy"]})]}),(0,a.jsx)("pre",{className:"px-3 py-2 bg-black/5 dark:bg-white/5 rounded font-mono text-xs overflow-x-auto whitespace-pre-wrap break-all max-h-60 overflow-y-auto border border-border",children:e.content})]},t))})})}},8569:(e,t,s)=>{s.d(t,{default:()=>n});var a=s(73365),r=s(292);let l={mode:{label:"Mode",format:e=>e},defaultModel:{label:"Model",format:e=>e,mono:!0},baseUrl:{label:"Endpoint",format:e=>e,isLink:!0,mono:!0},costPerQuery:{label:"Cost / call",format:e=>0===e?"Free":`$${e.toFixed(4)}`},pricingUrl:{label:"Pricing",format:()=>"View pricing",isLink:!0},freeTier:{label:"Free tier",format:e=>e},freeMonthlyQuota:{label:"Free quota",format:e=>0===e?"—":e>=999999?"Unlimited":`${e.toLocaleString()} / mo`},searchTypes:{label:"Types",format:e=>e.join(", ")},formats:{label:"Formats",format:e=>e.join(", ")},maxMaxResults:{label:"Max results",format:e=>e},maxCharacters:{label:"Max chars",format:e=>e.toLocaleString()}};function n({config:e,provider:t,title:s="Provider Info"}){if(!e)return null;let i=Object.entries(l).filter(([t])=>void 0!==e[t]&&null!==e[t]&&""!==e[t]).map(([t,s])=>({key:t,label:s.label,value:s.format(e[t]),isLink:s.isLink,mono:s.mono,raw:e[t]})),o=t?.notice?.apiKeyUrl||t?.website,d=t?.notice?.text;return(0,a.jsxs)(r.default,{children:[(0,a.jsxs)("div",{className:"flex items-center justify-between mb-3",children:[(0,a.jsx)("h2",{className:"text-lg font-semibold",children:s}),o&&(0,a.jsxs)("a",{href:o,target:"_blank",rel:"noopener noreferrer",className:"text-xs text-primary hover:underline inline-flex items-center gap-1",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-sm",children:"open_in_new"}),"Get API Key"]})]}),(0,a.jsxs)("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-x-6 gap-y-2",children:[i.map(e=>(0,a.jsxs)("div",{className:"flex items-center gap-3 min-w-0",children:[(0,a.jsx)("span",{className:"text-xs text-text-muted w-28 shrink-0",children:e.label}),e.isLink?(0,a.jsx)("a",{href:e.raw,target:"_blank",rel:"noopener noreferrer",className:`text-sm text-primary hover:underline truncate ${e.mono?"font-mono":""}`,children:e.value}):(0,a.jsx)("span",{className:`text-sm text-text-main truncate ${e.mono?"font-mono":""}`,children:e.value})]},e.key)),d&&(0,a.jsxs)("div",{className:"flex items-start gap-3 min-w-0 sm:col-span-2",children:[(0,a.jsx)("span",{className:"text-xs text-text-muted w-28 shrink-0 mt-0.5",children:"Notice"}),(0,a.jsx)("span",{className:"text-sm text-text-main leading-relaxed",children:d})]})]})]})}},12003:(e,t,s)=>{s.d(t,{default:()=>d});var a=s(73365),r=s(1521),l=s(98196),n=s(55348),i=s(84502);let o=e=>({en:{name:"English",flag:"\uD83C\uDDFA\uD83C\uDDF8"},vi:{name:"Tiếng Việt",flag:"\uD83C\uDDFB\uD83C\uDDF3"},"zh-CN":{name:"简体中文",flag:"\uD83C\uDDE8\uD83C\uDDF3"},"zh-TW":{name:"繁體中文",flag:"\uD83C\uDDF9\uD83C\uDDFC"},ja:{name:"日本語",flag:"\uD83C\uDDEF\uD83C\uDDF5"},"pt-BR":{name:"Portugu\xeas (Brasil)",flag:"\uD83C\uDDE7\uD83C\uDDF7"},"pt-PT":{name:"Portugu\xeas (Portugal)",flag:"\uD83C\uDDF5\uD83C\uDDF9"},ko:{name:"한국어",flag:"\uD83C\uDDF0\uD83C\uDDF7"},es:{name:"Espa\xf1ol",flag:"\uD83C\uDDEA\uD83C\uDDF8"},de:{name:"Deutsch",flag:"\uD83C\uDDE9\uD83C\uDDEA"},fr:{name:"Fran\xe7ais",flag:"\uD83C\uDDEB\uD83C\uDDF7"},he:{name:"עברית",flag:"\uD83C\uDDEE\uD83C\uDDF1"},ar:{name:"العربية",flag:"\uD83C\uDDF8\uD83C\uDDE6"},ru:{name:"Русский",flag:"\uD83C\uDDF7\uD83C\uDDFA"},pl:{name:"Polski",flag:"\uD83C\uDDF5\uD83C\uDDF1"},cs:{name:"Čeština",flag:"\uD83C\uDDE8\uD83C\uDDFF"},nl:{name:"Nederlands",flag:"\uD83C\uDDF3\uD83C\uDDF1"},tr:{name:"T\xfcrk\xe7e",flag:"\uD83C\uDDF9\uD83C\uDDF7"},uk:{name:"Українська",flag:"\uD83C\uDDFA\uD83C\uDDE6"},tl:{name:"Tagalog",flag:"\uD83C\uDDF5\uD83C\uDDED"},id:{name:"Indonesia",flag:"\uD83C\uDDEE\uD83C\uDDE9"},th:{name:"ไทย",flag:"\uD83C\uDDF9\uD83C\uDDED"},hi:{name:"हिन्दी",flag:"\uD83C\uDDEE\uD83C\uDDF3"},bn:{name:"বাংলা",flag:"\uD83C\uDDE7\uD83C\uDDE9"},ur:{name:"اردو",flag:"\uD83C\uDDF5\uD83C\uDDF0"},ro:{name:"Rom\xe2nă",flag:"\uD83C\uDDF7\uD83C\uDDF4"},sv:{name:"Svenska",flag:"\uD83C\uDDF8\uD83C\uDDEA"},it:{name:"Italiano",flag:"\uD83C\uDDEE\uD83C\uDDF9"},el:{name:"Ελληνικά",flag:"\uD83C\uDDEC\uD83C\uDDF7"},hu:{name:"Magyar",flag:"\uD83C\uDDED\uD83C\uDDFA"},fi:{name:"Suomi",flag:"\uD83C\uDDEB\uD83C\uDDEE"},da:{name:"Dansk",flag:"\uD83C\uDDE9\uD83C\uDDF0"},no:{name:"Norsk",flag:"\uD83C\uDDF3\uD83C\uDDF4"}})[e]||{name:e,flag:"\uD83C\uDF10"};function d({className:e="",isOpen:t,onClose:s,hideTrigger:c=!1}){let[m,x]=(0,r.useState)("en"),[u,p]=(0,r.useState)(!1),[h,f]=(0,r.useState)(!1),b=(0,r.useRef)(null),g="boolean"==typeof t,j=g?t:h,y=e=>{g?!e&&s&&s():f(e)};(0,r.useEffect)(()=>{x(function(){if("u"<typeof document)return"en";let e=document.cookie.split(";").find(e=>e.trim().startsWith(`${n.CL}=`)),t=e?decodeURIComponent(e.split("=")[1]):"en";return(0,n.QC)(t)}())},[]),(0,r.useEffect)(()=>{function e(e){b.current&&!b.current.contains(e.target)&&y(!1)}if(j)return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[j]);let v=async e=>{if(e!==m&&!u){p(!0),y(!1);try{await fetch("/api/locale",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({locale:e})}),await (0,i.wn)(),x(e)}catch(e){console.error("Failed to set locale:",e)}finally{p(!1)}}};return(0,a.jsxs)("div",{className:e,children:[!c&&(0,a.jsxs)("button",{onClick:()=>y(!j),disabled:u,className:"flex items-center gap-2 px-3 py-2 rounded-lg text-text-muted hover:text-text-main hover:bg-surface/60 transition-colors",title:"Language","data-i18n-skip":"true",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[20px]",children:"language"}),(0,a.jsx)("span",{className:"text-sm font-medium",children:o(m).name}),(0,a.jsx)("span",{className:"text-lg",children:o(m).flag})]}),j&&(0,l.createPortal)((0,a.jsxs)("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4","data-i18n-skip":"true",children:[(0,a.jsx)("div",{className:"absolute inset-0 bg-black/30 backdrop-blur-sm",onClick:()=>y(!1)}),(0,a.jsxs)("div",{ref:b,className:"relative w-full bg-surface border border-black/10 dark:border-white/10 rounded-xl shadow-2xl animate-in fade-in zoom-in-95 duration-200 max-w-2xl flex flex-col max-h-[80vh]",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between p-3 border-b border-black/5 dark:border-white/5",children:[(0,a.jsx)("h2",{className:"text-lg font-semibold text-text-main",children:"Select Language"}),(0,a.jsx)("button",{onClick:()=>y(!1),className:"p-1.5 rounded-lg text-text-muted hover:bg-black/5 dark:hover:bg-white/5 transition-colors","aria-label":"Close",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[20px]",children:"close"})})]}),(0,a.jsx)("div",{className:"p-6 overflow-y-auto flex-1",children:(0,a.jsx)("div",{className:"grid grid-cols-[repeat(auto-fill,minmax(100px,1fr))] gap-2",children:n.YZ.map(e=>{let t=m===e,s=o(e);return(0,a.jsxs)("button",{onClick:()=>v(e),disabled:u,className:`flex flex-col items-center justify-start gap-1 px-2 py-3 rounded-lg text-xs font-medium transition-colors w-full ${t?"bg-primary/15 text-primary ring-2 ring-primary":"text-text-main hover:bg-black/5 dark:hover:bg-white/5"} ${u?"opacity-70 cursor-wait":""}`,title:s.name,children:[(0,a.jsx)("span",{className:"text-2xl",children:s.flag}),(0,a.jsx)("span",{className:"text-center leading-tight line-clamp-2 h-8 flex items-center",children:s.name}),t&&(0,a.jsx)("span",{className:"material-symbols-outlined text-sm",children:"check"})]},e)})})})]})]}),document.body)]})}},12820:(e,t,s)=>{s.d(t,{default:()=>d});var a=s(73365),r=s(1521),l=s(86447),n=s.n(l),i=s(74156);let o="https://api.openai.com/v1";function d({isOpen:e,onClose:t,onCreated:s,onSaved:l,node:n}){let c=!!n,[m,x]=(0,r.useState)({name:"",prefix:"",baseUrl:o}),[u,p]=(0,r.useState)(!1),[h,f]=(0,r.useState)(""),[b,g]=(0,r.useState)(""),[j,y]=(0,r.useState)(!1),[v,N]=(0,r.useState)(null);(0,r.useEffect)(()=>{e&&(N(null),f(""),g(""),c?x({name:n.name||"",prefix:n.prefix||"",baseUrl:n.baseUrl||o}):x({name:"",prefix:"",baseUrl:o}))},[e,c,n]);let w=async()=>{if(m.name.trim()&&m.prefix.trim()&&m.baseUrl.trim()){p(!0);try{let e=c?`/api/provider-nodes/${n.id}`:"/api/provider-nodes",t=c?"PUT":"POST",a={name:m.name,prefix:m.prefix,baseUrl:m.baseUrl};c||(a.type="custom-embedding");let r=await fetch(e,{method:t,headers:{"Content-Type":"application/json"},body:JSON.stringify(a)}),i=await r.json();r.ok&&(c?l?.(i.node):s?.(i.node))}catch(e){console.log("Error saving custom embedding node:",e)}finally{p(!1)}}},k=async()=>{y(!0);try{let e=await fetch("/api/provider-nodes/validate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({baseUrl:m.baseUrl,apiKey:h,type:"custom-embedding",modelId:b.trim()||void 0})}),t=await e.json();N(t)}catch{N({valid:!1,error:"Network error"})}finally{y(!1)}};return(0,a.jsx)(i.aF,{isOpen:e,title:c?"Edit Custom Embedding":"Add Custom Embedding",onClose:t,children:(0,a.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,a.jsx)(i.pd,{label:"Name",value:m.name,onChange:e=>x({...m,name:e.target.value}),placeholder:"Voyage AI",hint:"Required. A friendly label for this embedding provider."}),(0,a.jsx)(i.pd,{label:"Prefix",value:m.prefix,onChange:e=>x({...m,prefix:e.target.value}),placeholder:"voyage",hint:"Required. Used as the provider prefix for model IDs (e.g. voyage/voyage-3)."}),(0,a.jsx)(i.pd,{label:"Base URL",value:m.baseUrl,onChange:e=>x({...m,baseUrl:e.target.value}),placeholder:"https://api.voyageai.com/v1",hint:"Most embedding APIs are OpenAI-compatible: Voyage, Cohere, Jina, Mistral, Together..."}),(0,a.jsx)(i.pd,{label:"API Key (for Check)",type:"password",value:h,onChange:e=>f(e.target.value)}),(0,a.jsx)(i.pd,{label:"Model ID (for Check)",value:b,onChange:e=>g(e.target.value),placeholder:"e.g. voyage-3, embed-english-v3.0, text-embedding-3-small",hint:"Required for validation. Will send a test embeddings request."}),(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[(0,a.jsx)(i.$n,{onClick:k,disabled:!h||!b.trim()||j||!m.baseUrl.trim(),variant:"secondary",children:j?"Checking...":"Check"}),(()=>{if(!v)return null;let{valid:e,error:t,dimensions:s}=v;return e?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(i.Ex,{variant:"success",children:"Valid"}),s&&(0,a.jsxs)("span",{className:"text-sm text-text-muted",children:[s," dims"]})]}):(0,a.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,a.jsx)(i.Ex,{variant:"error",children:"Invalid"}),t&&(0,a.jsx)("span",{className:"text-sm text-red-500",children:t})]})})()]}),(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsx)(i.$n,{onClick:w,fullWidth:!0,disabled:!m.name.trim()||!m.prefix.trim()||!m.baseUrl.trim()||u,children:u?c?"Saving...":"Creating...":c?"Save":"Create"}),(0,a.jsx)(i.$n,{onClick:t,variant:"ghost",fullWidth:!0,children:"Cancel"})]})]})})}d.propTypes={isOpen:n().bool.isRequired,onClose:n().func.isRequired,onCreated:n().func,onSaved:n().func,node:n().shape({id:n().string,name:n().string,prefix:n().string,baseUrl:n().string})}},13048:(e,t,s)=>{s.d(t,{default:()=>d});var a=s(73365),r=s(1521),l=s(29717),n=s(14793),i=s(56550),o=s(51123);function d({children:e}){let[t,s]=(0,r.useState)(!1),c=(0,l.usePathname)(),m=(0,n.i)(e=>e.notifications),x=(0,n.i)(e=>e.removeNotification);return(0,a.jsxs)("div",{className:"flex h-screen w-full overflow-hidden bg-bg",children:[(0,a.jsx)("div",{className:"fixed top-4 right-4 z-[80] flex w-[min(92vw,380px)] flex-col gap-2",children:m.map(e=>{var t;let s="success"===(t=e.type)?{wrapper:"border-green-500/30 bg-green-500/10 text-green-600 dark:text-green-400",icon:"check_circle"}:"error"===t?{wrapper:"border-red-500/30 bg-red-500/10 text-red-600 dark:text-red-400",icon:"error"}:"warning"===t?{wrapper:"border-amber-500/30 bg-amber-500/10 text-amber-600 dark:text-amber-400",icon:"warning"}:{wrapper:"border-blue-500/30 bg-blue-500/10 text-blue-600 dark:text-blue-400",icon:"info"};return(0,a.jsx)("div",{className:`rounded-lg border px-3 py-2 shadow-lg backdrop-blur-sm ${s.wrapper}`,children:(0,a.jsxs)("div",{className:"flex items-start gap-2",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[18px] leading-5",children:s.icon}),(0,a.jsxs)("div",{className:"min-w-0 flex-1",children:[e.title?(0,a.jsx)("p",{className:"text-xs font-semibold mb-0.5",children:e.title}):null,(0,a.jsx)("p",{className:"text-xs whitespace-pre-wrap break-words",children:e.message})]}),e.dismissible?(0,a.jsx)("button",{type:"button",onClick:()=>x(e.id),className:"text-current/70 hover:text-current","aria-label":"Dismiss notification",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"close"})}):null]})},e.id)})}),t&&(0,a.jsx)("div",{className:"fixed inset-0 z-40 bg-black/20 lg:hidden",onClick:()=>s(!1)}),(0,a.jsx)("div",{className:"hidden lg:flex",children:(0,a.jsx)(i.default,{})}),(0,a.jsx)("div",{className:`fixed inset-y-0 left-0 z-50 transform lg:hidden transition-transform duration-300 ease-in-out ${t?"translate-x-0":"-translate-x-full"}`,children:(0,a.jsx)(i.default,{onClose:()=>s(!1)})}),(0,a.jsxs)("main",{className:"flex flex-col flex-1 h-full min-w-0 relative transition-colors duration-300 isolate",children:[(0,a.jsx)("div",{className:"landing-grid absolute inset-0 pointer-events-none -z-10","aria-hidden":"true"}),(0,a.jsx)(o.default,{onMenuClick:()=>s(!0)},c),(0,a.jsx)("div",{className:`flex-1 overflow-y-auto custom-scrollbar ${"/dashboard/basic-chat"===c?"":"p-6 lg:p-10"} ${"/dashboard/basic-chat"===c?"flex flex-col overflow-hidden":""}`,children:(0,a.jsx)("div",{className:`${"/dashboard/basic-chat"===c?"flex-1 w-full h-full flex flex-col":"max-w-7xl mx-auto"}`,children:e})})]})]})}},13333:(e,t,s)=>{s.d(t,{default:()=>r});var a=s(73365);function r({text:e,children:t,position:s="top"}){return(0,a.jsxs)("div",{className:"relative inline-flex group",children:[t,(0,a.jsx)("div",{className:`pointer-events-none absolute ${{top:"bottom-full left-1/2 -translate-x-1/2 mb-1.5",bottom:"top-full left-1/2 -translate-x-1/2 mt-1.5",left:"right-full top-1/2 -translate-y-1/2 mr-1.5",right:"left-full top-1/2 -translate-y-1/2 ml-1.5"}[s]} z-50 w-max max-w-56 rounded px-2 py-1 text-[11px] leading-snug bg-gray-900 text-white opacity-0 group-hover:opacity-100 transition-opacity duration-150 whitespace-normal`,children:e})]})}},14406:(e,t,s)=>{s.d(t,{default:()=>l});var a=s(73365),r=s(87706);function l({checked:e=!1,onChange:t,label:s,description:n,disabled:i=!1,size:o="md",className:d}){let c={sm:{track:"w-8 h-4",thumb:"size-3",translate:"translate-x-4"},md:{track:"w-11 h-6",thumb:"size-5",translate:"translate-x-5"},lg:{track:"w-14 h-7",thumb:"size-6",translate:"translate-x-7"}};return(0,a.jsxs)("div",{className:(0,r.cn)("flex items-center gap-3",i&&"opacity-50 cursor-not-allowed",d),children:[(0,a.jsx)("button",{type:"button",role:"switch","aria-checked":e,disabled:i,onClick:()=>{!i&&t&&t(!e)},className:(0,r.cn)("relative inline-flex shrink-0 cursor-pointer rounded-full","transition-colors duration-200 ease-in-out","focus:outline-none focus:ring-2 focus:ring-brand-500/30",e?"bg-brand-500":"bg-surface-3",c[o].track,i&&"cursor-not-allowed"),children:(0,a.jsx)("span",{className:(0,r.cn)("pointer-events-none inline-block rounded-full bg-white shadow-sm","transform transition duration-200 ease-in-out",e?c[o].translate:"translate-x-0.5",c[o].thumb,"mt-0.5")})}),(s||n)&&(0,a.jsxs)("div",{className:"flex flex-col",children:[s&&(0,a.jsx)("span",{className:"text-sm font-medium text-text-main",children:s}),n&&(0,a.jsx)("span",{className:"text-xs text-text-muted",children:n})]})]})}},14793:(e,t,s)=>{s.d(t,{i:()=>l});var a=s(2074);let r=0,l=(0,a.v)((e,t)=>({notifications:[],addNotification:s=>{let a=++r,l={id:a,type:s.type||"info",message:s.message,title:s.title||null,duration:s.duration??5e3,dismissible:s.dismissible??!0,createdAt:Date.now()};return e(e=>({notifications:[...e.notifications,l]})),l.duration>0&&setTimeout(()=>t().removeNotification(a),l.duration),a},removeNotification:t=>{e(e=>({notifications:e.notifications.filter(e=>e.id!==t)}))},clearAll:()=>e({notifications:[]}),success:(e,s)=>t().addNotification({type:"success",message:e,title:s}),error:(e,s)=>t().addNotification({type:"error",message:e,title:s,duration:8e3}),warning:(e,s)=>t().addNotification({type:"warning",message:e,title:s}),info:(e,s)=>t().addNotification({type:"info",message:e,title:s})}))},24372:(e,t,s)=>{s.d(t,{default:()=>x});var a=s(73365),r=s(1521),l=s(86447),n=s.n(l),i=s(66911),o=s(69633),d=s(82495);let c=[...Object.keys(d.zN),...Object.keys(d.IS),...Object.keys(d.nJ),...Object.keys(d.fg)],m=Object.keys(d.IS).filter(e=>d.IS[e].noAuth);function x({isOpen:e,onClose:t,onSelect:s,selectedModel:l,activeProviders:n=[],title:u="Select Model",modelAliases:p={},kindFilter:h=null}){let f=(0,r.useMemo)(()=>h?n.filter(e=>{let t=d.Q2[e.provider];return(t?.serviceKinds||["llm"]).includes(h)}):n,[n,h]),[b,g]=(0,r.useState)(""),[j,y]=(0,r.useState)([]),[v,N]=(0,r.useState)([]),[w,k]=(0,r.useState)([]),C=async()=>{try{let e=await fetch("/api/combos");if(!e.ok)throw Error(`Failed to fetch combos: ${e.status}`);let t=await e.json();y(t.combos||[])}catch(e){console.error("Error fetching combos:",e),y([])}};(0,r.useEffect)(()=>{e&&C()},[e]);let S=async()=>{try{let e=await fetch("/api/provider-nodes");if(!e.ok)throw Error(`Failed to fetch provider nodes: ${e.status}`);let t=await e.json();N(t.nodes||[])}catch(e){console.error("Error fetching provider nodes:",e),N([])}};(0,r.useEffect)(()=>{e&&S()},[e]);let T=async()=>{try{let e=await fetch("/api/models/custom");if(!e.ok)throw Error(`Failed to fetch custom models: ${e.status}`);let t=await e.json();k(t.models||[])}catch(e){console.error("Error fetching custom models:",e),k([])}};(0,r.useEffect)(()=>{e&&T()},[e]);let $=(0,r.useMemo)(()=>({...d.zN,...d.IS,...d.nJ,...d.fg}),[]),R=(0,r.useMemo)(()=>{let e={};return[...new Set([...f.map(e=>e.provider),...h?m.filter(e=>(d.Q2[e]?.serviceKinds||["llm"]).includes(h)):m])].sort((e,t)=>{let s=c.indexOf(e),a=c.indexOf(t);return(-1===s?999:s)-(-1===a?999:a)}).forEach(t=>{let s=(0,d.wG)(t),a=$[t]||{name:t,color:"#666"},r=(0,d.mq)(t)||(0,d.gb)(t);if(a.passthroughModels){let r=Object.entries(p).filter(([,e])=>e.startsWith(`${s}/`)).map(([e,t])=>({id:t.replace(`${s}/`,""),name:e,value:t}));if(r.length>0){let l=v.find(e=>e.id===t),n=l?.name||a.name;e[t]={name:n,alias:s,color:a.color,models:r}}}else if(r){let s=n.find(e=>e.provider===t),r=v.find(e=>e.id===t),l=s?.name||r?.name||a.name,i=s?.providerSpecificData?.prefix||r?.prefix||t,o=Object.entries(p).filter(([,e])=>e.startsWith(`${t}/`)).map(([e,s])=>({id:s.replace(`${t}/`,""),name:e,value:`${i}/${s.replace(`${t}/`,"")}`})),d=o.length>0?o:[{id:`__placeholder__${t}`,name:`${i}/model-id`,value:`${i}/model-id`,isPlaceholder:!0}];e[t]={name:l,alias:i,color:a.color,models:d,isCustom:!0,hasModels:o.length>0}}else{let r=(0,o.KC)(t),l=new Set(r.map(e=>e.id)),n=r.length>0,i=Object.entries(p).filter(([e,t])=>t.startsWith(`${s}/`)&&(!n||e===t.replace(`${s}/`,""))&&!l.has(t.replace(`${s}/`,""))).map(([e,t])=>({id:t.replace(`${s}/`,""),name:e,value:t,isCustom:!0})),d=new Set(i.map(e=>e.id)),c=w.filter(e=>e.providerAlias===s&&!l.has(e.id)&&!d.has(e.id)).map(e=>({id:e.id,name:e.name||e.id,value:`${s}/${e.id}`,isCustom:!0})),m=[...r.map(e=>({id:e.id,name:e.name,value:`${s}/${e.id}`})),...i,...c];m.length>0&&(e[t]={name:a.name,alias:s,color:a.color,models:m})}}),e},[f,p,$,v,w,h]),I=(0,r.useMemo)(()=>{if(h)return[];if(!b.trim())return j;let e=b.toLowerCase();return j.filter(t=>t.name.toLowerCase().includes(e))},[j,b,h]),P=(0,r.useMemo)(()=>{if(!b.trim())return R;let e=b.toLowerCase(),t={};return Object.entries(R).forEach(([s,a])=>{let r=a.models.filter(t=>t.name.toLowerCase().includes(e)||t.id.toLowerCase().includes(e)),l=a.name.toLowerCase().includes(e);(r.length>0||l)&&(t[s]={...a,models:r})}),t},[R,b]),O=e=>{s(e),t(),g("")};return(0,a.jsxs)(i.default,{isOpen:e,onClose:()=>{t(),g("")},title:u,size:"md",className:"p-4!",children:[(0,a.jsx)("div",{className:"mb-3",children:(0,a.jsxs)("div",{className:"relative",children:[(0,a.jsx)("span",{className:"material-symbols-outlined absolute left-2.5 top-1/2 -translate-y-1/2 text-text-muted text-[16px]",children:"search"}),(0,a.jsx)("input",{type:"text",placeholder:"Search...",value:b,onChange:e=>g(e.target.value),className:"w-full pl-8 pr-3 py-1.5 bg-surface border border-border rounded text-xs focus:outline-none focus:ring-1 focus:ring-primary/50"})]})}),(0,a.jsxs)("div",{className:"max-h-[400px] overflow-y-auto space-y-3",children:[I.length>0&&(0,a.jsxs)("div",{children:[(0,a.jsxs)("div",{className:"flex items-center gap-1.5 mb-1.5 sticky top-0 bg-surface py-0.5",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-primary text-[14px]",children:"layers"}),(0,a.jsx)("span",{className:"text-xs font-medium text-primary",children:"Combos"}),(0,a.jsxs)("span",{className:"text-[10px] text-text-muted",children:["(",I.length,")"]})]}),(0,a.jsx)("div",{className:"flex flex-wrap gap-1.5",children:I.map(e=>{let t=l===e.name;return(0,a.jsx)("button",{onClick:()=>O({id:e.name,name:e.name,value:e.name}),className:`
|
|
2
|
+
px-2 py-1 rounded-xl text-xs font-medium transition-all border hover:cursor-pointer
|
|
3
|
+
${t?"bg-primary text-white border-primary":"bg-surface border-border text-text-main hover:border-primary/50 hover:bg-primary/5"}
|
|
4
|
+
`,children:e.name},e.id)})})]}),Object.entries(P).map(([e,t])=>(0,a.jsxs)("div",{children:[(0,a.jsxs)("div",{className:"flex items-center gap-1.5 mb-1.5 sticky top-0 bg-surface py-0.5",children:[(0,a.jsx)("div",{className:"w-2 h-2 rounded-full",style:{backgroundColor:t.color}}),(0,a.jsx)("span",{className:"text-xs font-medium text-primary",children:t.name}),(0,a.jsxs)("span",{className:"text-[10px] text-text-muted",children:["(",t.models.length,")"]})]}),(0,a.jsx)("div",{className:"flex flex-wrap gap-1.5",children:t.models.map(e=>{let t=l===e.value,s=e.isPlaceholder;return(0,a.jsx)("button",{onClick:()=>O(e),title:s?"Select to pre-fill, then edit model ID in the input":void 0,className:`
|
|
5
|
+
px-2 py-1 rounded-xl text-xs font-medium transition-all border hover:cursor-pointer
|
|
6
|
+
${s?"border-dashed border-border text-text-muted hover:border-primary/50 hover:text-primary bg-surface italic":t?"bg-primary text-white border-primary":"bg-surface border-border text-text-main hover:border-primary/50 hover:bg-primary/5"}
|
|
7
|
+
`,children:s?(0,a.jsxs)("span",{className:"flex items-center gap-1",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[11px]",children:"edit"}),e.name]}):e.isCustom?(0,a.jsxs)("span",{className:"flex items-center gap-1",children:[e.name,(0,a.jsx)("span",{className:"text-[9px] opacity-60 font-normal",children:"custom"})]}):e.name},e.value)})})]},e)),0===Object.keys(P).length&&0===I.length&&(0,a.jsxs)("div",{className:"text-center py-4 text-text-muted",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-2xl mb-1 block",children:"search_off"}),(0,a.jsx)("p",{className:"text-xs",children:"No models found"})]})]})]})}x.propTypes={isOpen:n().bool.isRequired,onClose:n().func.isRequired,onSelect:n().func.isRequired,selectedModel:n().string,activeProviders:n().arrayOf(n().shape({provider:n().string.isRequired})),title:n().string,modelAliases:n().object,kindFilter:n().string}},26125:(e,t,s)=>{s.d(t,{default:()=>c});var a=s(73365),r=s(1521),l=s(98196),n=s(86447),i=s.n(n),o=s(30721),d=s(43202);function c({isOpen:e,onClose:t}){let[s,n]=(0,r.useState)(""),[i,m]=(0,r.useState)(!1),[x,u]=(0,r.useState)(""),p=(0,r.useRef)(null);return((0,r.useEffect)(()=>{e&&!s&&(m(!0),u(""),fetch(d.Nu.changelogUrl).then(e=>{if(!e.ok)throw Error(`HTTP ${e.status}`);return e.text()}).then(e=>n(o.xI.parse(e))).catch(e=>u(e.message||"Failed to load")).finally(()=>m(!1)))},[e,s]),(0,r.useEffect)(()=>{let s=e=>{p.current&&!p.current.contains(e.target)&&t()};if(e)return document.addEventListener("mousedown",s),()=>document.removeEventListener("mousedown",s)},[e,t]),!e||"u"<typeof document)?null:(0,l.createPortal)((0,a.jsxs)("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4",children:[(0,a.jsx)("div",{className:"absolute inset-0 bg-black/30 backdrop-blur-sm",onClick:t}),(0,a.jsxs)("div",{ref:p,className:"relative w-full bg-surface border border-black/10 dark:border-white/10 rounded-xl shadow-2xl animate-in fade-in zoom-in-95 duration-200 max-w-3xl flex flex-col max-h-[85vh]",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between p-3 border-b border-black/5 dark:border-white/5",children:[(0,a.jsx)("h2",{className:"text-lg font-semibold text-text-main",children:"Change Log"}),(0,a.jsx)("button",{onClick:t,className:"p-1.5 rounded-lg text-text-muted hover:bg-black/5 dark:hover:bg-white/5 transition-colors","aria-label":"Close",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[20px]",children:"close"})})]}),(0,a.jsxs)("div",{className:"p-6 overflow-y-auto flex-1",children:[i&&(0,a.jsxs)("div",{className:"flex items-center justify-center py-10 text-text-muted",children:[(0,a.jsx)("span",{className:"material-symbols-outlined animate-spin mr-2",children:"progress_activity"}),"Loading..."]}),x&&(0,a.jsxs)("div",{className:"text-red-500 py-4",children:["Failed to load changelog: ",x]}),!i&&!x&&s&&(0,a.jsx)("div",{className:"changelog-body text-text-main",dangerouslySetInnerHTML:{__html:s}})]})]})]}),document.body)}o.xI.setOptions({gfm:!0,breaks:!0}),c.propTypes={isOpen:i().bool.isRequired,onClose:i().func.isRequired}},32135:(e,t,s)=>{s.d(t,{default:()=>n});var a=s(73365),r=s(1521),l=s(292);function n(){let[e,t]=(0,r.useState)([]),[s,n]=(0,r.useState)(!0),[i,o]=(0,r.useState)(!0);(0,r.useEffect)(()=>{d()},[]),(0,r.useEffect)(()=>{let e;return i&&(e=setInterval(()=>{d(!1)},3e3)),()=>clearInterval(e)},[i]);let d=async(e=!0)=>{e&&n(!0);try{let e=await fetch("/api/usage/request-logs");if(e.ok){let s=await e.json();t(s)}}catch(e){console.error("Failed to fetch logs:",e)}finally{e&&n(!1)}};return(0,a.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsx)("h2",{className:"text-xl font-semibold",children:"Request Logs"}),(0,a.jsx)("div",{className:"flex items-center gap-2",children:(0,a.jsxs)("label",{className:"text-sm font-medium text-text-muted flex items-center gap-2 cursor-pointer",children:[(0,a.jsx)("span",{children:"Auto Refresh (3s)"}),(0,a.jsx)("div",{onClick:()=>o(!i),className:`relative inline-flex h-5 w-9 items-center rounded-full transition-colors focus:outline-none ${i?"bg-primary":"bg-bg-subtle border border-border"}`,children:(0,a.jsx)("span",{className:`inline-block h-3 w-3 transform rounded-full bg-white transition-transform ${i?"translate-x-5":"translate-x-1"}`})})]})})]}),(0,a.jsx)(l.default,{className:"overflow-hidden bg-black/5 dark:bg-black/20",children:(0,a.jsx)("div",{className:"p-0 overflow-x-auto max-h-[600px] overflow-y-auto font-mono text-xs",children:s&&0===e.length?(0,a.jsx)("div",{className:"p-8 text-center text-text-muted",children:"Loading logs..."}):0===e.length?(0,a.jsx)("div",{className:"p-8 text-center text-text-muted",children:"No logs recorded yet."}):(0,a.jsxs)("table",{className:"w-full text-left border-collapse whitespace-nowrap",children:[(0,a.jsx)("thead",{className:"sticky top-0 bg-bg-subtle border-b border-border z-10",children:(0,a.jsxs)("tr",{children:[(0,a.jsx)("th",{className:"px-3 py-2 border-r border-border",children:"DateTime"}),(0,a.jsx)("th",{className:"px-3 py-2 border-r border-border",children:"Model"}),(0,a.jsx)("th",{className:"px-3 py-2 border-r border-border",children:"Provider"}),(0,a.jsx)("th",{className:"px-3 py-2 border-r border-border",children:"Account"}),(0,a.jsx)("th",{className:"px-3 py-2 border-r border-border",children:"In"}),(0,a.jsx)("th",{className:"px-3 py-2 border-r border-border",children:"Out"}),(0,a.jsx)("th",{className:"px-3 py-2",children:"Status"})]})}),(0,a.jsx)("tbody",{className:"divide-y divide-border/50",children:e.map((e,t)=>{let s=e.split(" | ");if(s.length<7)return null;let r=s[6],l=r.includes("PENDING"),n=r.includes("FAILED"),i=r.includes("OK");return(0,a.jsxs)("tr",{className:`hover:bg-primary/5 transition-colors ${l?"bg-primary/5":""}`,children:[(0,a.jsx)("td",{className:"px-3 py-1.5 border-r border-border text-text-muted",children:s[0]}),(0,a.jsx)("td",{className:"px-3 py-1.5 border-r border-border font-medium",children:s[1]}),(0,a.jsx)("td",{className:"px-3 py-1.5 border-r border-border",children:(0,a.jsx)("span",{className:"px-1.5 py-0.5 rounded bg-bg-subtle border border-border text-[10px] uppercase font-bold",children:s[2]})}),(0,a.jsx)("td",{className:"px-3 py-1.5 border-r border-border truncate max-w-[150px]",title:s[3],children:s[3]}),(0,a.jsx)("td",{className:"px-3 py-1.5 border-r border-border text-right text-primary",children:s[4]}),(0,a.jsx)("td",{className:"px-3 py-1.5 border-r border-border text-right text-success",children:s[5]}),(0,a.jsx)("td",{className:`px-3 py-1.5 font-bold ${i?"text-success":n?"text-error":"text-primary animate-pulse"}`,children:r})]},t)})})]})})}),(0,a.jsx)("div",{className:"text-[10px] text-text-muted italic",children:"Logs are saved to log.txt in the application data directory."})]})}},35045:(e,t,s)=>{s.d(t,{default:()=>i});var a=s(73365),r=s(87706);let l={default:"bg-surface-2 text-text-muted",primary:"bg-brand-500/10 text-brand-600 dark:text-brand-300",success:"bg-green-500/10 text-green-600 dark:text-green-400",warning:"bg-yellow-500/10 text-yellow-600 dark:text-yellow-400",error:"bg-red-500/10 text-red-600 dark:text-red-400",info:"bg-blue-500/10 text-blue-600 dark:text-blue-400"},n={sm:"px-2 py-0.5 text-[10px]",md:"px-2.5 py-1 text-xs",lg:"px-3 py-1.5 text-sm"};function i({children:e,variant:t="default",size:s="md",dot:o=!1,icon:d,className:c}){return(0,a.jsxs)("span",{className:(0,r.cn)("inline-flex items-center gap-1.5 rounded-full font-semibold",l[t],n[s],c),children:[o&&(0,a.jsx)("span",{className:(0,r.cn)("size-1.5 rounded-full","success"===t&&"bg-green-500","warning"===t&&"bg-yellow-500","error"===t&&"bg-red-500","info"===t&&"bg-blue-500","primary"===t&&"bg-brand-500","default"===t&&"bg-gray-500")}),d&&(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:d}),e]})}},37066:(e,t,s)=>{s.d(t,{default:()=>l});var a=s(73365),r=s(87706);function l({label:e,options:t=[],value:s,onChange:n,placeholder:i="Select an option",error:o,hint:d,disabled:c=!1,required:m=!1,className:x,selectClassName:u,...p}){return(0,a.jsxs)("div",{className:(0,r.cn)("flex flex-col gap-1.5",x),children:[e&&(0,a.jsxs)("label",{className:"text-sm font-medium text-text-main",children:[e,m&&(0,a.jsx)("span",{className:"text-red-500 ml-1",children:"*"})]}),(0,a.jsxs)("div",{className:"relative",children:[(0,a.jsxs)("select",{value:s,onChange:n,disabled:c,className:(0,r.cn)("w-full py-2.5 px-3 pr-10 text-sm text-text-main","bg-surface-2 border border-transparent rounded-[10px] appearance-none","focus:outline-none focus:ring-2 focus:ring-brand-500/30 focus:border-brand-500/40","transition-all duration-150 disabled:opacity-50 disabled:cursor-not-allowed","text-[16px] sm:text-sm",o&&"ring-1 ring-red-500 focus:ring-2 focus:ring-red-500/40 border-red-500/40",u),...p,children:[(0,a.jsx)("option",{value:"",disabled:!0,children:i}),t.map(e=>(0,a.jsx)("option",{value:e.value,children:e.label},e.value))]}),(0,a.jsx)("div",{className:"absolute inset-y-0 right-0 flex items-center pr-3 pointer-events-none text-text-muted",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[20px]",children:"expand_more"})})]}),o&&(0,a.jsxs)("p",{className:"text-xs text-red-500 flex items-center gap-1",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"error"}),o]}),d&&!o&&(0,a.jsx)("p",{className:"text-xs text-text-muted",children:d})]})}},38230:(e,t,s)=>{s.d(t,{default:()=>i});var a=s(73365),r=s(87706);let l={primary:"bg-brand-500 hover:bg-brand-600 text-white shadow-sm disabled:bg-surface-3 disabled:text-text-muted",secondary:"bg-surface-2 hover:bg-surface-3 text-text-main border border-border disabled:opacity-50",outline:"border border-border text-text-main hover:bg-surface-2 hover:border-brand-500/40",ghost:"text-text-muted hover:bg-surface-2 hover:text-text-main",danger:"bg-red-500 hover:bg-red-600 text-white shadow-sm disabled:bg-surface-3 disabled:text-text-muted",success:"bg-green-600 hover:bg-green-700 text-white shadow-sm disabled:bg-surface-3 disabled:text-text-muted"},n={sm:"h-7 px-3 text-xs rounded-[8px]",md:"h-9 px-4 text-sm rounded-[10px]",lg:"h-11 px-6 text-sm rounded-[10px]"};function i({children:e,variant:t="primary",size:s="md",icon:o,iconRight:d,disabled:c=!1,loading:m=!1,fullWidth:x=!1,className:u,...p}){return(0,a.jsxs)("button",{className:(0,r.cn)("inline-flex items-center justify-center gap-2 font-semibold transition-all duration-150 ease-out cursor-pointer","active:scale-[0.97] disabled:opacity-50 disabled:cursor-not-allowed disabled:active:scale-100",l[t],n[s],x&&"w-full",u),disabled:c||m,...p,children:[m?(0,a.jsx)("span",{className:"material-symbols-outlined animate-spin text-[18px]",children:"progress_activity"}):o?(0,a.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:o}):null,e,d&&!m&&(0,a.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:d})]})}},44156:(e,t,s)=>{s.d(t,{A:()=>o});var a=s(73365),r=s(1521),l=s(98196);let n=[{icon:"terminal",label:"Terminal",desc:"Full shell access"},{icon:"cast",label:"Desktop",desc:"Screen sharing"},{icon:"folder_open",label:"Files",desc:"Browse & edit files"}],i=[{icon:"qr_code_scanner",text:"Scan QR to connect instantly"},{icon:"wifi_off",text:"No port forwarding needed"},{icon:"devices",text:"Works on any device"}];function o({isOpen:e,onClose:t}){return((0,r.useEffect)(()=>{if(!e)return;document.body.style.overflow="hidden";let s=e=>{"Escape"===e.key&&t()};return document.addEventListener("keydown",s),()=>{document.body.style.overflow="",document.removeEventListener("keydown",s)}},[e,t]),e)?(0,l.createPortal)((0,a.jsxs)("div",{className:"fixed inset-0 z-[9999] flex items-center justify-center p-4",children:[(0,a.jsx)("div",{className:"absolute inset-0 bg-black/50 backdrop-blur-[2px] fade-in",onClick:t}),(0,a.jsxs)("div",{className:"relative w-full max-w-sm rounded-[14px] overflow-hidden shadow-[var(--shadow-elev)] fade-in flex flex-col bg-surface border border-border-subtle",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between px-5 py-3 border-b border-border-subtle",children:[(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[(0,a.jsx)("div",{className:"w-7 h-7 rounded-[8px] flex items-center justify-center bg-primary",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-white text-base",children:"terminal"})}),(0,a.jsx)("span",{className:"text-xs font-bold uppercase tracking-wider text-primary font-mono",children:"9Remote"})]}),(0,a.jsx)("button",{onClick:t,className:"p-1.5 rounded-[10px] text-text-muted hover:bg-surface-2 hover:text-text-main transition-colors",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-base",children:"close"})})]}),(0,a.jsxs)("div",{className:"px-7 py-7 pb-9 flex flex-col gap-6",children:[(0,a.jsxs)("div",{className:"flex flex-col items-center gap-2 text-center mt-2",children:[(0,a.jsx)("div",{className:"w-14 h-14 rounded-[14px] flex items-center justify-center mb-1 bg-primary shadow-[var(--shadow-warm)]",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-white text-[30px]",children:"terminal"})}),(0,a.jsx)("h1",{className:"text-lg font-bold text-text-main tracking-tight",children:"9Remote"}),(0,a.jsx)("p",{className:"text-xs text-text-muted leading-5 max-w-[220px]",children:"Access your terminal, desktop & files from anywhere"})]}),(0,a.jsx)("div",{className:"flex gap-2 w-full",children:n.map(({icon:e,label:t,desc:s})=>(0,a.jsxs)("div",{className:"flex-1 flex flex-col items-center gap-1.5 py-4 px-1 rounded-[10px] border border-border-subtle bg-surface-2",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-primary text-[22px]",children:e}),(0,a.jsx)("p",{className:"text-xs font-semibold text-text-main",children:t}),(0,a.jsx)("p",{className:"text-[10px] text-text-muted text-center leading-4",children:s})]},t))}),(0,a.jsx)("div",{className:"flex flex-col gap-3 w-full",children:i.map(({icon:e,text:t})=>(0,a.jsxs)("div",{className:"flex items-center gap-2.5",children:[(0,a.jsx)("span",{className:"material-symbols-outlined flex-shrink-0 text-primary text-[16px]",children:e}),(0,a.jsx)("span",{className:"text-xs text-text-muted",children:t})]},e))}),(0,a.jsxs)("button",{onClick:()=>window.open("https://9remote.cc","_blank"),className:"w-full py-3 flex items-center justify-center gap-2 text-sm font-semibold text-white rounded-[10px] bg-primary hover:bg-primary-hover shadow-[var(--shadow-warm)] active:scale-[0.98] transition-all",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-base",children:"open_in_new"}),"Get 9Remote"]})]})]})]}),document.body):null}},50136:(e,t,s)=>{s.d(t,{default:()=>d});var a=s(73365),r=s(1521),l=s(86447),n=s.n(l),i=s(74156);let o="https://gitlab.com";function d({isOpen:e,providerInfo:t,onSuccess:s,onClose:l}){let n,[c,m]=(0,r.useState)(null),[x,u]=(0,r.useState)(o),[p,h]=(0,r.useState)(""),[f,b]=(0,r.useState)(""),[g,j]=(0,r.useState)(""),[y,v]=(0,r.useState)(!1),[N,w]=(0,r.useState)(null),[k,C]=(0,r.useState)(!1),[S,T]=(0,r.useState)(null),$=()=>{m(null),u(o),h(""),b(""),j(""),w(null),v(!1),C(!1),T(null),l()},R=async()=>{if(!g.trim())return void w("Personal Access Token is required");v(!0),w(null);try{let e=await fetch("/api/oauth/gitlab/pat",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({token:g.trim(),baseUrl:x.trim()||o})}),t=await e.json();if(!e.ok)throw Error(t.error||"Authentication failed");s?.(),$()}catch(e){w(e.message)}finally{v(!1)}};return e?k&&S?(0,a.jsx)(i.LF,{isOpen:!0,provider:"gitlab",providerInfo:t,oauthMeta:S,onSuccess:()=>{s?.(),$()},onClose:()=>{C(!1),T(null)}}):(0,a.jsx)(i.aF,{isOpen:e,title:"Connect GitLab Duo",onClose:$,size:"lg",children:(0,a.jsxs)("div",{className:"flex flex-col gap-4",children:[!c&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("p",{className:"text-sm text-text-muted",children:"Choose how to authenticate with GitLab Duo:"}),(0,a.jsxs)("div",{className:"grid grid-cols-2 gap-3",children:[(0,a.jsxs)("button",{onClick:()=>m("oauth"),className:"flex flex-col items-center gap-2 p-4 rounded-lg border border-border hover:border-primary hover:bg-primary/5 transition-colors text-left",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-2xl text-primary",children:"lock_open"}),(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"text-sm font-medium",children:"OAuth App"}),(0,a.jsx)("p",{className:"text-xs text-text-muted",children:"Use a GitLab OAuth application"})]})]}),(0,a.jsxs)("button",{onClick:()=>m("pat"),className:"flex flex-col items-center gap-2 p-4 rounded-lg border border-border hover:border-primary hover:bg-primary/5 transition-colors text-left",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-2xl text-primary",children:"key"}),(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"text-sm font-medium",children:"Personal Access Token"}),(0,a.jsx)("p",{className:"text-xs text-text-muted",children:"Use a GitLab PAT with api scope"})]})]})]})]}),"oauth"===c&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("p",{className:"text-xs text-text-muted",children:["Create an OAuth app at"," ",(0,a.jsx)("a",{href:`${x.trim()||o}/-/profile/applications`,target:"_blank",rel:"noreferrer",className:"text-primary underline",children:"GitLab Applications"})," ","with redirect URI"," ",(0,a.jsx)("code",{className:"bg-sidebar px-1 rounded text-xs",children:(n=window.location.port||("https:"===window.location.protocol?"443":"80"),`http://localhost:${n}/callback`)})]}),(0,a.jsx)(i.pd,{label:"GitLab Base URL",value:x,onChange:e=>u(e.target.value),placeholder:o}),(0,a.jsx)(i.pd,{label:"Client ID",value:p,onChange:e=>h(e.target.value),placeholder:"Your OAuth application client ID"}),(0,a.jsx)(i.pd,{label:"Client Secret (optional for PKCE)",value:f,onChange:e=>b(e.target.value),placeholder:"Leave empty for public PKCE app"}),N&&(0,a.jsx)("p",{className:"text-sm text-red-500",children:N}),(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsx)(i.$n,{onClick:()=>{p.trim()?(w(null),T({baseUrl:x.trim()||o,clientId:p.trim(),clientSecret:f.trim()}),C(!0)):w("Client ID is required")},fullWidth:!0,disabled:!p.trim(),children:"Authorize"}),(0,a.jsx)(i.$n,{onClick:()=>{m(null),w(null)},variant:"ghost",fullWidth:!0,children:"Back"})]})]}),"pat"===c&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("p",{className:"text-xs text-text-muted",children:["Create a PAT at"," ",(0,a.jsx)("a",{href:`${x.trim()||o}/-/user_settings/personal_access_tokens`,target:"_blank",rel:"noreferrer",className:"text-primary underline",children:"GitLab Access Tokens"})," ","with scopes: ",(0,a.jsx)("code",{className:"bg-sidebar px-1 rounded text-xs",children:"api"}),","," ",(0,a.jsx)("code",{className:"bg-sidebar px-1 rounded text-xs",children:"read_user"}),", and"," ",(0,a.jsx)("code",{className:"bg-sidebar px-1 rounded text-xs",children:"ai_features"}),"."]}),(0,a.jsx)(i.pd,{label:"GitLab Base URL",value:x,onChange:e=>u(e.target.value),placeholder:o}),(0,a.jsx)(i.pd,{label:"Personal Access Token",value:g,onChange:e=>j(e.target.value),placeholder:"glpat-xxxxxxxxxxxxxxxxxxxx",type:"password"}),N&&(0,a.jsx)("p",{className:"text-sm text-red-500",children:N}),(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsx)(i.$n,{onClick:R,fullWidth:!0,disabled:!g.trim()||y,loading:y,children:"Connect"}),(0,a.jsx)(i.$n,{onClick:()=>{m(null),w(null)},variant:"ghost",fullWidth:!0,children:"Back"})]})]})]})}):null}d.propTypes={isOpen:n().bool.isRequired,providerInfo:n().shape({name:n().string}),onSuccess:n().func,onClose:n().func.isRequired}},51123:(e,t,s)=>{s.d(t,{default:()=>f});var a=s(73365),r=s(29717),l=s(1521),n=s(99568),i=s.n(n),o=s(86447),d=s.n(o),c=s(68266),m=s(80600),x=s(84675),u=s(43202),p=s(82495),h=s(84502);function f({onMenuClick:e,showMenuButton:t=!0}){let s=(0,r.usePathname)(),n=(0,r.useRouter)(),{title:o,description:d,icon:b,breadcrumbs:g}=(0,l.useMemo)(()=>(e=>{if(!e)return{title:"",description:"",breadcrumbs:[]};let t=e.match(/\/media-providers\/([^/]+)\/([^/]+)$/);if(t){let e=t[1],s=t[2],a=p.rj.find(t=>t.id===e),r=p.Q2[s];return{title:r?.name||s,description:"",breadcrumbs:[{label:"Media Providers",href:`/dashboard/media-providers/${e}`},{label:a?.label||e,href:`/dashboard/media-providers/${e}`},{label:r?.name||s,image:`/providers/${s}.png`}]}}let s=e.match(/\/media-providers\/([^/]+)$/);if(s){let e=s[1],t=p.rj.find(t=>t.id===e);return{title:t?.label||e,description:`Manage your ${t?.label||e} providers`,icon:t?.icon||"perm_media",breadcrumbs:[]}}let a=e.match(/\/providers\/([^/]+)$/);if(a){let e=a[1],t=u.zN[e]||u.fg[e];if(t)return{title:t.name,description:"",breadcrumbs:[{label:"Providers",href:"/dashboard/providers"},{label:t.name,image:`/providers/${t.id}.png`}]}}return e.includes("/providers")&&!e.includes("/media-providers")?{title:"Providers",description:"Manage your AI provider connections",icon:"dns",breadcrumbs:[]}:e.includes("/combos")?{title:"Combos",description:"Model combos with fallback",icon:"layers",breadcrumbs:[]}:e.includes("/usage")?{title:"Usage & Analytics",description:"Monitor your API usage, token consumption, and request logs",icon:"bar_chart",breadcrumbs:[]}:e.includes("/auth-files")?{title:"Auth Files",description:"Map provider credentials stored in the local database",icon:"vpn_key",breadcrumbs:[]}:e.includes("/quota")?{title:"Quota Tracker",description:"Track and manage your API quota limits",icon:"data_usage",breadcrumbs:[]}:e.includes("/mitm")?{title:"MITM Proxy",description:"Intercept CLI tool traffic and route through 9Router",icon:"security",breadcrumbs:[]}:e.includes("/cli-tools")?{title:"CLI Tools",description:"Configure CLI tools",icon:"terminal",breadcrumbs:[]}:e.includes("/proxy-pools")?{title:"Proxy Pools",description:"Manage your proxy pool configurations",icon:"lan",breadcrumbs:[]}:e.includes("/endpoint")?{title:"Endpoint",description:"API endpoint configuration",icon:"api",breadcrumbs:[]}:e.includes("/profile")?{title:"Settings",description:"Manage your preferences",icon:"settings",breadcrumbs:[]}:e.includes("/translator")?{title:"Translator",description:"Debug translation flow between formats",icon:"translate",breadcrumbs:[]}:e.includes("/console-log")?{title:"Console Log",description:"Live server console output",icon:"monitor",breadcrumbs:[]}:"/dashboard"===e?{title:"Endpoint",description:"API endpoint configuration",icon:"api",breadcrumbs:[]}:{title:"",description:"",breadcrumbs:[]}})(s),[s]),j=async()=>{try{(await fetch("/api/auth/logout",{method:"POST"})).ok&&(n.push("/login"),n.refresh())}catch(e){console.error("Failed to logout:",e)}};return(0,a.jsxs)("header",{className:"shrink-0 flex items-center justify-between gap-3 px-4 lg:px-8 pt-3 pb-2 border-b border-border-subtle bg-surface/60 backdrop-blur-xl lg:bg-transparent lg:backdrop-blur-none z-20",children:[(0,a.jsx)("div",{className:"flex items-center gap-3 lg:hidden shrink-0",children:t&&(0,a.jsx)("button",{onClick:e,className:"text-text-main hover:text-primary transition-colors",children:(0,a.jsx)("span",{className:"material-symbols-outlined",children:"menu"})})}),(0,a.jsx)("div",{className:"flex flex-col min-w-0 flex-1",children:g.length>0?(0,a.jsx)("div",{className:"flex items-center gap-2",children:g.map((e,t)=>(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[t>0&&(0,a.jsx)("span",{className:"material-symbols-outlined text-text-muted text-base",children:"chevron_right"}),e.href?(0,a.jsx)(i(),{href:e.href,className:"text-text-muted hover:text-primary transition-colors",children:e.label}):(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[e.image&&(0,a.jsx)(c.A,{src:e.image,alt:e.label,size:28,className:"object-contain rounded max-w-[28px] max-h-[28px]",fallbackText:e.label.slice(0,2).toUpperCase()}),(0,a.jsx)("h1",{className:"text-base lg:text-2xl font-semibold text-text-main tracking-tight truncate",children:(0,h.Tl)(e.label)})]})]},`${e.label}-${e.href||"current"}`))}):o?(0,a.jsxs)("div",{children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[b&&(0,a.jsx)("span",{className:"material-symbols-outlined text-primary text-xl lg:text-2xl",children:b}),(0,a.jsx)("h1",{className:"text-base lg:text-2xl font-semibold tracking-tight truncate",children:(0,h.Tl)(o)})]}),d&&(0,a.jsx)("p",{className:"hidden lg:block text-sm text-text-muted truncate",children:(0,h.Tl)(d)})]}):null}),(0,a.jsxs)("div",{className:"flex items-center gap-1 shrink-0",children:[(0,a.jsx)(x.default,{}),(0,a.jsx)(m.default,{onLogout:j})]})]})}f.propTypes={onMenuClick:d().func,showMenuButton:d().bool}},51454:(e,t,s)=>{s.d(t,{default:()=>d});var a=s(73365),r=s(1521),l=s(86447),n=s.n(l),i=s(74156),o=s(96459);function d({isOpen:e,provider:t,onSuccess:s,onClose:l}){let[n,c]=(0,r.useState)("loading"),[m,x]=(0,r.useState)(""),[u,p]=(0,r.useState)(null),[h,f]=(0,r.useState)(""),[b,g]=(0,r.useState)(null),{copied:j,copy:y}=(0,o.C)();(0,r.useEffect)(()=>{e&&t&&(async()=>{try{g(null),c("loading");let e=await fetch(`/api/oauth/kiro/social-authorize?provider=${t}`),s=await e.json();if(!e.ok)throw Error(s.error);p(s),x(s.authUrl),c("input"),window.open(s.authUrl,"_blank")}catch(e){g(e.message),c("error")}})()},[e,t]);let v=async()=>{try{let e;g(null);try{e=new URL(h)}catch(e){throw Error("Invalid callback URL format")}let a=e.searchParams.get("code");e.searchParams.get("state");let r=e.searchParams.get("error");if(r)throw Error(e.searchParams.get("error_description")||r);if(!a)throw Error("No authorization code found in URL");let l=await fetch("/api/oauth/kiro/social-exchange",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({code:a,codeVerifier:u.codeVerifier,provider:t})}),n=await l.json();if(!l.ok)throw Error(n.error);c("success"),s?.()}catch(e){g(e.message),c("error")}},N="google"===t?"Google":"GitHub";return(0,a.jsx)(i.aF,{isOpen:e,title:`Connect Kiro via ${N}`,onClose:l,size:"lg",children:(0,a.jsxs)("div",{className:"flex flex-col gap-4",children:["loading"===n&&(0,a.jsxs)("div",{className:"text-center py-6",children:[(0,a.jsx)("div",{className:"size-16 mx-auto mb-4 rounded-full bg-primary/10 flex items-center justify-center",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-3xl text-primary animate-spin",children:"progress_activity"})}),(0,a.jsx)("h3",{className:"text-lg font-semibold mb-2",children:"Initializing..."}),(0,a.jsxs)("p",{className:"text-sm text-text-muted",children:["Setting up ",N," authentication"]})]}),"input"===n&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("div",{className:"space-y-4",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"text-sm font-medium mb-2",children:"Step 1: Open this URL in your browser"}),(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsx)(i.pd,{value:m,readOnly:!0,className:"flex-1 font-mono text-xs"}),(0,a.jsx)(i.$n,{variant:"secondary",icon:"auth_url"===j?"check":"content_copy",onClick:()=>y(m,"auth_url"),children:"Copy"})]})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"text-sm font-medium mb-2",children:"Step 2: Paste the callback URL here"}),(0,a.jsx)("p",{className:"text-xs text-text-muted mb-2",children:"After authorization, copy the full URL from your browser address bar."}),(0,a.jsx)(i.pd,{value:h,onChange:e=>f(e.target.value),placeholder:"kiro://kiro.kiroAgent/authenticate-success?code=...",className:"font-mono text-xs"})]})]}),(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsx)(i.$n,{onClick:v,fullWidth:!0,disabled:!h,children:"Connect"}),(0,a.jsx)(i.$n,{onClick:l,variant:"ghost",fullWidth:!0,children:"Cancel"})]})]}),"success"===n&&(0,a.jsxs)("div",{className:"text-center py-6",children:[(0,a.jsx)("div",{className:"size-16 mx-auto mb-4 rounded-full bg-green-100 dark:bg-green-900/30 flex items-center justify-center",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-3xl text-green-600",children:"check_circle"})}),(0,a.jsx)("h3",{className:"text-lg font-semibold mb-2",children:"Connected Successfully!"}),(0,a.jsxs)("p",{className:"text-sm text-text-muted mb-4",children:["Your Kiro account via ",N," has been connected."]}),(0,a.jsx)(i.$n,{onClick:l,fullWidth:!0,children:"Done"})]}),"error"===n&&(0,a.jsxs)("div",{className:"text-center py-6",children:[(0,a.jsx)("div",{className:"size-16 mx-auto mb-4 rounded-full bg-red-100 dark:bg-red-900/30 flex items-center justify-center",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-3xl text-red-600",children:"error"})}),(0,a.jsx)("h3",{className:"text-lg font-semibold mb-2",children:"Connection Failed"}),(0,a.jsx)("p",{className:"text-sm text-red-600 mb-4",children:b}),(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsx)(i.$n,{onClick:()=>c("input"),variant:"secondary",fullWidth:!0,children:"Try Again"}),(0,a.jsx)(i.$n,{onClick:l,variant:"ghost",fullWidth:!0,children:"Cancel"})]})]})]})})}d.propTypes={isOpen:n().bool.isRequired,provider:n().oneOf(["google","github"]).isRequired,onSuccess:n().func,onClose:n().func.isRequired}},53038:(e,t,s)=>{s.d(t,{default:()=>l});var a=s(73365),r=s(87706);function l({label:e,type:t="text",placeholder:s,value:n,onChange:i,error:o,hint:d,icon:c,disabled:m=!1,required:x=!1,className:u,inputClassName:p,...h}){return(0,a.jsxs)("div",{className:(0,r.cn)("flex flex-col gap-1.5",u),children:[e&&(0,a.jsxs)("label",{className:"text-sm font-medium text-text-main",children:[e,x&&(0,a.jsx)("span",{className:"text-red-500 ml-1",children:"*"})]}),(0,a.jsxs)("div",{className:"relative",children:[c&&(0,a.jsx)("div",{className:"absolute inset-y-0 left-0 flex items-center pl-3 pointer-events-none text-text-muted",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[20px]",children:c})}),(0,a.jsx)("input",{type:t,placeholder:s,value:n,onChange:i,disabled:m,className:(0,r.cn)("w-full py-2.5 px-3 text-sm text-text-main bg-surface-2 rounded-[10px]","border border-transparent placeholder-text-muted/70","focus:outline-none focus:ring-2 focus:ring-brand-500/30 focus:border-brand-500/40","transition-all duration-150 ease-out disabled:opacity-50 disabled:cursor-not-allowed","text-[16px] sm:text-sm",c&&"pl-10",o&&"ring-1 ring-red-500 focus:ring-2 focus:ring-red-500/40 border-red-500/40",p),...h})]}),o&&(0,a.jsxs)("p",{className:"text-xs text-red-500 flex items-center gap-1",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"error"}),o]}),d&&!o&&(0,a.jsx)("p",{className:"text-xs text-text-muted",children:d})]})}},54546:(e,t,s)=>{s.d(t,{default:()=>i});var a=s(73365),r=s(86447),l=s.n(r),n=s(84675);function i({children:e}){return(0,a.jsxs)("div",{className:"min-h-screen flex flex-col relative bg-bg transition-colors duration-500 overflow-x-hidden selection:bg-primary/20 selection:text-primary",children:[(0,a.jsx)("div",{className:"fixed top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 w-[800px] h-[800px] bg-primary/5 dark:bg-primary/5 rounded-full blur-[100px] pointer-events-none z-0"}),(0,a.jsx)("div",{className:"fixed bottom-0 right-0 w-[600px] h-[600px] bg-orange-200/20 dark:bg-orange-900/10 rounded-full blur-[120px] pointer-events-none z-0 translate-y-1/3 translate-x-1/3"}),(0,a.jsx)("div",{className:"absolute top-6 right-6 z-20",children:(0,a.jsx)(n.default,{variant:"card"})}),(0,a.jsx)("main",{className:"flex-1 flex flex-col items-center justify-center p-4 sm:p-6 z-10 w-full h-full",children:e})]})}i.propTypes={children:l().node.isRequired}},56550:(e,t,s)=>{s.d(t,{default:()=>v});var a=s(73365),r=s(1521),l=s(86447),n=s.n(l),i=s(99568),o=s.n(i),d=s(29717),c=s(87706),m=s(43202),x=s(82495),u=s(96459),p=s(38230),h=s(66911);let f=["embedding","image","tts"],b="/dashboard/media-providers/web",g=[{href:"/dashboard/endpoint",label:"Endpoint",icon:"api"},{href:"/dashboard/providers",label:"Providers",icon:"dns"},{href:"/dashboard/combos",label:"Combos",icon:"layers"},{href:"/dashboard/usage",label:"Usage",icon:"bar_chart"},{href:"/dashboard/quota",label:"Quota Tracker",icon:"data_usage"},{href:"/dashboard/mitm",label:"MITM",icon:"security"},{href:"/dashboard/cli-tools",label:"CLI Tools",icon:"terminal"}],j=[{href:"/dashboard/console-log",label:"Console Log",icon:"terminal"},{href:"/dashboard/translator",label:"Translator",icon:"translate"}],y=[{href:"/dashboard/proxy-pools",label:"Proxy Pools",icon:"lan"}];function v({onClose:e}){let t=(0,d.usePathname)(),[s,l]=(0,r.useState)(!1),[n,i]=(0,r.useState)(!1),[w,k]=(0,r.useState)(!1),[C,S]=(0,r.useState)(!1),[T,$]=(0,r.useState)(null),[R,I]=(0,r.useState)(!1),[P,O]=(0,r.useState)(!1),[E,M]=(0,r.useState)(null),[L,_]=(0,r.useState)(!1),{copied:z,copy:A}=(0,u.C)(2e3),U=m.h0.installCmd,q=`http://localhost:${m.h0.statusPort}/update/status`;(0,r.useEffect)(()=>{fetch("/api/settings").then(e=>e.json()).then(e=>{e.enableTranslator&&_(!0)}).catch(()=>{})},[]),(0,r.useEffect)(()=>{fetch("/api/version").then(e=>e.json()).then(e=>{e.hasUpdate&&$(e)}).catch(()=>{})},[]);let F=e=>"/dashboard/endpoint"===e?"/dashboard"===t||t.startsWith("/dashboard/endpoint"):t.startsWith(e),D=async()=>{O(!0),I(!1);try{let e=await fetch("/api/version/update",{method:"POST"});if(!e.ok){let t=await e.json().catch(()=>({}));alert(t.message||"Update failed. Please run the install command manually."),O(!1);return}S(!0)}catch(e){S(!0)}};(0,r.useEffect)(()=>{if(!P||!C)return;let e=!1,t=async()=>{try{let t=await fetch(q,{cache:"no-store"});if(t.ok){let s=await t.json();e||M(s)}}catch{}};t();let s=setInterval(t,m.h0.statusPollIntervalMs);return()=>{e=!0,clearInterval(s)}},[P,C,q]);let W=async()=>{k(!0);try{await fetch("/api/shutdown",{method:"POST"})}catch(e){}k(!1),i(!1),S(!0)};return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("aside",{className:"flex w-72 flex-col border-r border-border-subtle bg-vibrancy backdrop-blur-xl transition-colors duration-300 min-h-full",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2 px-6 pt-5 pb-2",children:[(0,a.jsx)("div",{className:"w-3 h-3 rounded-full bg-[#FF5F56]"}),(0,a.jsx)("div",{className:"w-3 h-3 rounded-full bg-[#FFBD2E]"}),(0,a.jsx)("div",{className:"w-3 h-3 rounded-full bg-[#27C93F]"})]}),(0,a.jsxs)("div",{className:"px-6 py-4 flex flex-col gap-2",children:[(0,a.jsxs)(o(),{href:"/dashboard",className:"flex items-center gap-3",children:[(0,a.jsx)("div",{className:"flex items-center justify-center size-9 rounded-[10px] bg-gradient-to-br from-brand-500 to-brand-700 shadow-[var(--shadow-warm)]",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-white text-[20px]",children:"hub"})}),(0,a.jsxs)("div",{className:"flex flex-col",children:[(0,a.jsx)("h1",{className:"text-lg font-semibold tracking-tight text-text-main",children:m.vQ.name}),(0,a.jsxs)("span",{className:"text-xs text-text-muted",children:["v",m.vQ.version]})]})]}),T&&(0,a.jsxs)("div",{className:"flex flex-col gap-1.5 rounded p-1 -m-1",children:[(0,a.jsxs)("span",{className:"text-xs font-semibold text-green-600 dark:text-amber-500",children:["↑ New version available: v",T.latestVersion]}),(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("button",{onClick:()=>I(!0),className:"px-2 py-1 rounded bg-green-600 hover:bg-green-700 dark:bg-amber-500 dark:hover:bg-amber-600 text-white text-[11px] font-semibold transition-colors cursor-pointer",children:"Update now"}),(0,a.jsx)("button",{onClick:()=>A(U),title:"Copy install command",className:"flex-1 text-left hover:opacity-80 transition-opacity cursor-pointer min-w-0",children:(0,a.jsx)("code",{className:"block text-[10px] text-green-600/80 dark:text-amber-400/70 font-mono truncate",children:z?"✓ copied!":U})})]})]})]}),(0,a.jsxs)("nav",{className:"flex-1 px-4 py-2 space-y-1 overflow-y-auto custom-scrollbar",children:[g.map(t=>(0,a.jsxs)(o(),{href:t.href,onClick:e,className:(0,c.cn)("flex items-center gap-3 px-3 py-1.5 rounded-lg transition-all group",F(t.href)?"bg-primary/10 text-primary":"text-text-muted hover:bg-surface-2 hover:text-text-main"),children:[(0,a.jsx)("span",{className:(0,c.cn)("material-symbols-outlined text-[18px]",F(t.href)?"fill-1":"group-hover:text-primary transition-colors"),children:t.icon}),(0,a.jsx)("span",{className:"text-[13px] font-medium",children:t.label})]},t.href)),(0,a.jsxs)("div",{className:"pt-4 mt-2 space-y-1",children:[(0,a.jsx)("p",{className:"px-4 text-xs font-semibold text-text-muted/60 uppercase tracking-wider mb-2",children:"System"}),(0,a.jsxs)("button",{onClick:()=>l(e=>!e),className:(0,c.cn)("w-full flex items-center gap-3 px-3 py-1.5 rounded-lg transition-all group",t.startsWith("/dashboard/media-providers")?"bg-primary/10 text-primary":"text-text-muted hover:bg-surface-2 hover:text-text-main"),children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"perm_media"}),(0,a.jsx)("span",{className:"text-[13px] font-medium flex-1 text-left",children:"Media Providers"}),(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px] transition-transform",style:{transform:s?"rotate(180deg)":"rotate(0deg)"},children:"expand_more"})]}),s&&(0,a.jsxs)("div",{className:"pl-4",children:[x.rj.filter(e=>f.includes(e.id)).map(s=>(0,a.jsxs)(o(),{href:`/dashboard/media-providers/${s.id}`,onClick:e,className:(0,c.cn)("flex items-center gap-3 px-4 py-1.5 rounded-lg transition-all group",t.startsWith(`/dashboard/media-providers/${s.id}`)?"bg-primary/10 text-primary":"text-text-muted hover:bg-surface-2 hover:text-text-main"),children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:s.icon}),(0,a.jsx)("span",{className:"text-sm",children:s.label})]},s.id)),(0,a.jsxs)(o(),{href:b,onClick:e,className:(0,c.cn)("flex items-center gap-3 px-4 py-1.5 rounded-lg transition-all group",t.startsWith(b)?"bg-primary/10 text-primary":"text-text-muted hover:bg-surface-2 hover:text-text-main"),children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"travel_explore"}),(0,a.jsx)("span",{className:"text-sm",children:"Web Fetch & Search"})]},"web")]}),y.map(t=>(0,a.jsxs)(o(),{href:t.href,onClick:e,className:(0,c.cn)("flex items-center gap-3 px-3 py-1.5 rounded-lg transition-all group",F(t.href)?"bg-primary/10 text-primary":"text-text-muted hover:bg-surface-2 hover:text-text-main"),children:[(0,a.jsx)("span",{className:(0,c.cn)("material-symbols-outlined text-[18px]",F(t.href)?"fill-1":"group-hover:text-primary transition-colors"),children:t.icon}),(0,a.jsx)("span",{className:"text-[13px] font-medium",children:t.label})]},t.href)),j.map(t=>"/dashboard/translator"!==t.href||L?(0,a.jsxs)(o(),{href:t.href,onClick:e,className:(0,c.cn)("flex items-center gap-3 px-3 py-1.5 rounded-lg transition-all group",F(t.href)?"bg-primary/10 text-primary":"text-text-muted hover:bg-surface-2 hover:text-text-main"),children:[(0,a.jsx)("span",{className:(0,c.cn)("material-symbols-outlined text-[18px]",F(t.href)?"fill-1":"group-hover:text-primary transition-colors"),children:t.icon}),(0,a.jsx)("span",{className:"text-[13px] font-medium",children:t.label})]},t.href):null),(0,a.jsxs)(o(),{href:"/dashboard/profile",onClick:e,className:(0,c.cn)("flex items-center gap-3 px-3 py-1.5 rounded-lg transition-all group",F("/dashboard/profile")?"bg-primary/10 text-primary":"text-text-muted hover:bg-surface-2 hover:text-text-main"),children:[(0,a.jsx)("span",{className:(0,c.cn)("material-symbols-outlined text-[18px]",F("/dashboard/profile")?"fill-1":"group-hover:text-primary transition-colors"),children:"settings"}),(0,a.jsx)("span",{className:"text-[13px] font-medium",children:"Settings"})]})]})]}),(0,a.jsx)("div",{className:"p-3 border-t border-border-subtle",children:(0,a.jsx)(p.default,{variant:"outline",fullWidth:!0,icon:"power_settings_new",onClick:()=>i(!0),className:"text-red-500 border-red-200 hover:bg-red-50 hover:border-red-300",children:"Shutdown"})})]}),(0,a.jsx)(h.ConfirmModal,{isOpen:n,onClose:()=>i(!1),onConfirm:W,title:"Close Proxy",message:"Are you sure you want to close the proxy server?",confirmText:"Close",cancelText:"Cancel",variant:"danger",loading:w}),(0,a.jsx)(h.ConfirmModal,{isOpen:R,onClose:()=>I(!1),onConfirm:D,title:"Update 9Router",message:`This will close 9Router and install v${T?.latestVersion||""} in a separate window. Continue?`,confirmText:"Update",cancelText:"Cancel",variant:"primary",loading:P}),C&&(0,a.jsx)("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/80 backdrop-blur-sm p-6",children:P?(0,a.jsx)(N,{status:E,latestVersion:T?.latestVersion,installCmd:U,copied:z,onCopy:()=>A(U)}):(0,a.jsxs)("div",{className:"text-center p-8",children:[(0,a.jsx)("div",{className:"flex items-center justify-center size-16 rounded-full bg-red-500/20 text-red-500 mx-auto mb-4",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[32px]",children:"power_off"})}),(0,a.jsx)("h2",{className:"text-xl font-semibold text-white mb-2",children:"Server Disconnected"}),(0,a.jsx)("p",{className:"text-text-muted mb-6",children:"The proxy server has been stopped."}),(0,a.jsx)(p.default,{variant:"secondary",onClick:()=>globalThis.location.reload(),children:"Reload Page"})]})})]})}function N({status:e,latestVersion:t,installCmd:s,copied:r,onCopy:l}){let n=e?.phase||"connecting",i=e?.done===!0,o=e?.success===!0,d=e?.attempt||0,m=e?.maxRetries||0,x=e?.logTail||[],u=e?.error,h=[{key:"stopped",label:"Stopped 9Router server",state:"done"},{key:"launched",label:"Launched background installer",state:e?"done":"active"},{key:"waiting",label:"Waiting for app processes to exit",state:"waitingForExit"===n?"active":e&&"starting"!==n?"done":"pending"},{key:"installing",label:d>1?`Installing v${t||"latest"} (attempt ${d}/${m})`:`Installing v${t||"latest"}`,state:i?o?"done":"error":"installing"===n?"active":"pending"},{key:"finished",label:i&&o?"Installed — ready to restart":"Waiting to finish",state:i&&o?"done":i&&!o?"error":"pending"}];return(0,a.jsxs)("div",{className:"w-full max-w-lg rounded-xl bg-neutral-900/95 border border-white/10 p-6 text-white",children:[(0,a.jsxs)("div",{className:"flex items-center gap-3 mb-4",children:[(0,a.jsx)("div",{className:(0,c.cn)("flex items-center justify-center size-11 rounded-full",i&&o?"bg-green-500/20 text-green-400":i&&!o?"bg-red-500/20 text-red-400":"bg-blue-500/20 text-blue-400"),children:(0,a.jsx)("span",{className:(0,c.cn)("material-symbols-outlined text-[24px]",!i&&"animate-spin"),children:i&&o?"check_circle":i&&!o?"error":"progress_activity"})}),(0,a.jsxs)("div",{children:[(0,a.jsx)("h2",{className:"text-lg font-semibold",children:i&&o?"Update Completed":i&&!o?"Update Failed":"Updating 9Router"}),(0,a.jsx)("p",{className:"text-xs text-white/60",children:i&&o?`Installed v${t||"latest"} successfully`:i&&!o?u||"Installation failed":`Installing v${t||"latest"} from npm...`})]})]}),(0,a.jsx)("ul",{className:"space-y-2 mb-4",children:h.map(e=>(0,a.jsxs)("li",{className:"flex items-center gap-3 text-sm",children:[(0,a.jsx)("span",{className:(0,c.cn)("material-symbols-outlined text-[18px] shrink-0","done"===e.state&&"text-green-400","active"===e.state&&"text-blue-400 animate-pulse","error"===e.state&&"text-red-400","pending"===e.state&&"text-white/30"),children:"done"===e.state?"check_circle":"error"===e.state?"cancel":"active"===e.state?"radio_button_checked":"radio_button_unchecked"}),(0,a.jsx)("span",{className:(0,c.cn)("pending"===e.state?"text-white/40":"text-white/90"),children:e.label})]},e.key))}),x.length>0&&(0,a.jsx)("div",{className:"rounded-md bg-black/50 border border-white/5 p-3 mb-4 max-h-40 overflow-auto",children:(0,a.jsx)("pre",{className:"text-[11px] font-mono text-white/70 whitespace-pre-wrap break-all",children:x.join("\n")})}),i&&o?(0,a.jsxs)("div",{className:"space-y-2",children:[(0,a.jsxs)("p",{className:"text-sm text-white/80",children:["Run ",(0,a.jsx)("code",{className:"px-1.5 py-0.5 rounded bg-white/10 text-green-400",children:"9router"})," in your terminal to start the new version."]}),(0,a.jsx)(p.default,{variant:"secondary",fullWidth:!0,onClick:()=>globalThis.location.reload(),children:"Reload Page"})]}):i&&!o?(0,a.jsxs)("div",{className:"space-y-2",children:[(0,a.jsx)("p",{className:"text-sm text-white/80",children:"Run the install command manually:"}),(0,a.jsx)("button",{onClick:l,className:"w-full text-left px-3 py-2 rounded bg-white/5 hover:bg-white/10 transition-colors",children:(0,a.jsx)("code",{className:"text-xs font-mono text-amber-400",children:r?"✓ copied!":s})})]}):(0,a.jsx)("p",{className:"text-xs text-white/50 text-center",children:"This may take 30-60 seconds. Please don't close this window."})]})}v.propTypes={onClose:n().func},N.propTypes={status:n().object,latestVersion:n().string,installCmd:n().string.isRequired,copied:n().bool,onCopy:n().func.isRequired}},63380:(e,t,s)=>{s.d(t,{default:()=>o});var a=s(73365),r=s(1521),l=s(86447),n=s.n(l),i=s(74156);function o({isOpen:e,onMethodSelect:t,onClose:s}){let[l,n]=(0,r.useState)(null),[d,c]=(0,r.useState)(""),[m,x]=(0,r.useState)("us-east-1"),[u,p]=(0,r.useState)(""),[h,f]=(0,r.useState)(null),[b,g]=(0,r.useState)(!1),[j,y]=(0,r.useState)(!1),[v,N]=(0,r.useState)(!1);(0,r.useEffect)(()=>{"import"===l&&e&&(async()=>{y(!0),f(null),N(!1);try{let e=await fetch("/api/oauth/kiro/auto-import"),t=await e.json();t.found?(p(t.refreshToken),N(!0)):f(t.error||"Could not auto-detect token")}catch(e){f("Failed to auto-detect token")}finally{y(!1)}})()},[l,e]);let w=e=>{n(e),f(null)},k=()=>{n(null),f(null)},C=async()=>{if(!u.trim())return void f("Please enter a refresh token");g(!0),f(null);try{let e=await fetch("/api/oauth/kiro/import",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({refreshToken:u.trim()})}),s=await e.json();if(!e.ok)throw Error(s.error||"Import failed");t("import")}catch(e){f(e.message)}finally{g(!1)}},S=e=>{t("social",{provider:e})};return(0,a.jsx)(i.aF,{isOpen:e,title:"Connect Kiro",onClose:s,size:"lg",children:(0,a.jsxs)("div",{className:"flex flex-col gap-4",children:[!l&&(0,a.jsxs)("div",{className:"space-y-3",children:[(0,a.jsx)("p",{className:"text-sm text-text-muted mb-4",children:"Choose your authentication method:"}),(0,a.jsx)("button",{onClick:()=>t("builder-id"),className:"w-full p-4 text-left border border-border rounded-lg hover:bg-sidebar transition-colors",children:(0,a.jsxs)("div",{className:"flex items-start gap-3",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-primary mt-0.5",children:"shield"}),(0,a.jsxs)("div",{className:"flex-1",children:[(0,a.jsx)("h3",{className:"font-semibold mb-1",children:"AWS Builder ID"}),(0,a.jsx)("p",{className:"text-sm text-text-muted",children:"Recommended for most users. Free AWS account required."})]})]})}),(0,a.jsx)("button",{onClick:()=>w("idc"),className:"w-full p-4 text-left border border-border rounded-lg hover:bg-sidebar transition-colors",children:(0,a.jsxs)("div",{className:"flex items-start gap-3",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-primary mt-0.5",children:"business"}),(0,a.jsxs)("div",{className:"flex-1",children:[(0,a.jsx)("h3",{className:"font-semibold mb-1",children:"AWS IAM Identity Center"}),(0,a.jsx)("p",{className:"text-sm text-text-muted",children:"For enterprise users with custom AWS IAM Identity Center."})]})]})}),(0,a.jsx)("button",{onClick:()=>w("social-google"),className:"hidden w-full p-4 text-left border border-border rounded-lg hover:bg-sidebar transition-colors",children:(0,a.jsxs)("div",{className:"flex items-start gap-3",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-primary mt-0.5",children:"account_circle"}),(0,a.jsxs)("div",{className:"flex-1",children:[(0,a.jsx)("h3",{className:"font-semibold mb-1",children:"Google Account"}),(0,a.jsx)("p",{className:"text-sm text-text-muted",children:"Login with your Google account (manual callback)."})]})]})}),(0,a.jsx)("button",{onClick:()=>w("social-github"),className:"hidden w-full p-4 text-left border border-border rounded-lg hover:bg-sidebar transition-colors",children:(0,a.jsxs)("div",{className:"flex items-start gap-3",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-primary mt-0.5",children:"code"}),(0,a.jsxs)("div",{className:"flex-1",children:[(0,a.jsx)("h3",{className:"font-semibold mb-1",children:"GitHub Account"}),(0,a.jsx)("p",{className:"text-sm text-text-muted",children:"Login with your GitHub account (manual callback)."})]})]})}),(0,a.jsx)("button",{onClick:()=>w("import"),className:"w-full p-4 text-left border border-border rounded-lg hover:bg-sidebar transition-colors",children:(0,a.jsxs)("div",{className:"flex items-start gap-3",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-primary mt-0.5",children:"file_upload"}),(0,a.jsxs)("div",{className:"flex-1",children:[(0,a.jsx)("h3",{className:"font-semibold mb-1",children:"Import Token"}),(0,a.jsx)("p",{className:"text-sm text-text-muted",children:"Paste refresh token from Kiro IDE."})]})]})})]}),"idc"===l&&(0,a.jsxs)("div",{className:"space-y-4",children:[(0,a.jsxs)("div",{children:[(0,a.jsxs)("label",{className:"block text-sm font-medium mb-2",children:["IDC Start URL ",(0,a.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,a.jsx)(i.pd,{value:d,onChange:e=>c(e.target.value),placeholder:"https://your-org.awsapps.com/start",className:"font-mono text-sm"}),(0,a.jsx)("p",{className:"text-xs text-text-muted mt-1",children:"Your organization's AWS IAM Identity Center URL"})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"block text-sm font-medium mb-2",children:"AWS Region"}),(0,a.jsx)(i.pd,{value:m,onChange:e=>x(e.target.value),placeholder:"us-east-1",className:"font-mono text-sm"}),(0,a.jsx)("p",{className:"text-xs text-text-muted mt-1",children:"AWS region for your Identity Center (default: us-east-1)"})]}),h&&(0,a.jsx)("p",{className:"text-sm text-red-600",children:h}),(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsx)(i.$n,{onClick:()=>{d.trim()?t("idc",{startUrl:d.trim(),region:m}):f("Please enter your IDC start URL")},fullWidth:!0,children:"Continue"}),(0,a.jsx)(i.$n,{onClick:k,variant:"ghost",fullWidth:!0,children:"Back"})]})]}),"social-google"===l&&(0,a.jsxs)("div",{className:"space-y-4",children:[(0,a.jsx)("div",{className:"bg-amber-50 dark:bg-amber-900/20 p-4 rounded-lg border border-amber-200 dark:border-amber-800",children:(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-amber-600 dark:text-amber-400",children:"info"}),(0,a.jsxs)("div",{className:"flex-1 text-sm",children:[(0,a.jsx)("p",{className:"font-medium text-amber-900 dark:text-amber-100 mb-1",children:"Manual Callback Required"}),(0,a.jsx)("p",{className:"text-amber-800 dark:text-amber-200",children:"After login, you'll need to copy the callback URL from your browser and paste it back here."})]})]})}),(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsx)(i.$n,{onClick:()=>S("google"),fullWidth:!0,children:"Continue with Google"}),(0,a.jsx)(i.$n,{onClick:k,variant:"ghost",fullWidth:!0,children:"Back"})]})]}),"social-github"===l&&(0,a.jsxs)("div",{className:"space-y-4",children:[(0,a.jsx)("div",{className:"bg-amber-50 dark:bg-amber-900/20 p-4 rounded-lg border border-amber-200 dark:border-amber-800",children:(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-amber-600 dark:text-amber-400",children:"info"}),(0,a.jsxs)("div",{className:"flex-1 text-sm",children:[(0,a.jsx)("p",{className:"font-medium text-amber-900 dark:text-amber-100 mb-1",children:"Manual Callback Required"}),(0,a.jsx)("p",{className:"text-amber-800 dark:text-amber-200",children:"After login, you'll need to copy the callback URL from your browser and paste it back here."})]})]})}),(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsx)(i.$n,{onClick:()=>S("github"),fullWidth:!0,children:"Continue with GitHub"}),(0,a.jsx)(i.$n,{onClick:k,variant:"ghost",fullWidth:!0,children:"Back"})]})]}),"import"===l&&(0,a.jsxs)("div",{className:"space-y-4",children:[j&&(0,a.jsxs)("div",{className:"text-center py-6",children:[(0,a.jsx)("div",{className:"size-16 mx-auto mb-4 rounded-full bg-primary/10 flex items-center justify-center",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-3xl text-primary animate-spin",children:"progress_activity"})}),(0,a.jsx)("h3",{className:"text-lg font-semibold mb-2",children:"Auto-detecting token..."}),(0,a.jsx)("p",{className:"text-sm text-text-muted",children:"Reading from AWS SSO cache"})]}),!j&&(0,a.jsxs)(a.Fragment,{children:[v&&(0,a.jsx)("div",{className:"bg-green-50 dark:bg-green-900/20 p-3 rounded-lg border border-green-200 dark:border-green-800",children:(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-green-600 dark:text-green-400",children:"check_circle"}),(0,a.jsx)("p",{className:"text-sm text-green-800 dark:text-green-200",children:"Token auto-detected from Kiro IDE successfully!"})]})}),!v&&!h&&(0,a.jsx)("div",{className:"bg-blue-50 dark:bg-blue-900/20 p-3 rounded-lg border border-blue-200 dark:border-blue-800",children:(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-blue-600 dark:text-blue-400",children:"info"}),(0,a.jsx)("p",{className:"text-sm text-blue-800 dark:text-blue-200",children:"Kiro IDE not detected. Please paste your refresh token manually."})]})}),(0,a.jsxs)("div",{children:[(0,a.jsxs)("label",{className:"block text-sm font-medium mb-2",children:["Refresh Token ",(0,a.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,a.jsx)(i.pd,{value:u,onChange:e=>p(e.target.value),placeholder:"Token will be auto-filled...",className:"font-mono text-sm"})]}),h&&(0,a.jsx)("div",{className:"bg-red-50 dark:bg-red-900/20 p-3 rounded-lg border border-red-200 dark:border-red-800",children:(0,a.jsx)("p",{className:"text-sm text-red-600 dark:text-red-400",children:h})}),(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsx)(i.$n,{onClick:C,fullWidth:!0,disabled:b||!u.trim(),children:b?"Importing...":"Import Token"}),(0,a.jsx)(i.$n,{onClick:k,variant:"ghost",fullWidth:!0,children:"Back"})]})]})]})]})})}o.propTypes={isOpen:n().bool.isRequired,onMethodSelect:n().func.isRequired,onClose:n().func.isRequired}},66911:(e,t,s)=>{s.d(t,{ConfirmModal:()=>o,default:()=>i});var a=s(73365),r=s(1521),l=s(87706),n=s(38230);function i({isOpen:e,onClose:t,title:s,children:n,footer:o,size:d="md",closeOnOverlay:c=!0,showCloseButton:m=!0,showTrafficLights:x=!0,className:u}){return((0,r.useEffect)(()=>(e?document.body.style.overflow="hidden":document.body.style.overflow="",()=>{document.body.style.overflow=""}),[e]),(0,r.useEffect)(()=>{let s=s=>{"Escape"===s.key&&e&&t()};return document.addEventListener("keydown",s),()=>document.removeEventListener("keydown",s)},[e,t]),e)?(0,a.jsxs)("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4",children:[(0,a.jsx)("div",{className:"absolute inset-0 bg-black/50 backdrop-blur-[2px] fade-in",onClick:c?t:void 0}),(0,a.jsxs)("div",{className:(0,l.cn)("relative w-full bg-surface","border border-border-subtle","rounded-[14px] shadow-[var(--shadow-elev)]","fade-in",{sm:"max-w-sm",md:"max-w-md",lg:"max-w-lg",xl:"max-w-xl",full:"max-w-4xl"}[d],u),children:[(s||m)&&(0,a.jsxs)("div",{className:"flex items-center justify-between p-2 border-b border-border-subtle",children:[(0,a.jsxs)("div",{className:"flex items-center",children:[x&&(0,a.jsxs)("div",{className:"flex items-center gap-2 mr-4 ml-2",children:[(0,a.jsx)("div",{className:"w-3 h-3 rounded-full bg-[#FF5F56]"}),(0,a.jsx)("div",{className:"w-3 h-3 rounded-full bg-[#FFBD2E]"}),(0,a.jsx)("div",{className:"w-3 h-3 rounded-full bg-[#27C93F]"})]}),s&&(0,a.jsx)("h2",{className:"text-lg font-semibold text-text-main",children:s})]}),m&&(0,a.jsx)("button",{onClick:t,className:"p-1.5 rounded-[10px] text-text-muted hover:bg-surface-2 hover:text-text-main transition-colors",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[20px]",children:"close"})})]}),(0,a.jsx)("div",{className:"p-6 max-h-[calc(85vh-100px)] overflow-y-auto custom-scrollbar",children:n}),o&&(0,a.jsx)("div",{className:"flex items-center justify-end gap-3 p-6 border-t border-border-subtle",children:o})]})]}):null}function o({isOpen:e,onClose:t,onConfirm:s,title:r="Confirm",message:l,confirmText:d="Confirm",cancelText:c="Cancel",variant:m="danger",loading:x=!1}){return(0,a.jsx)(i,{isOpen:e,onClose:t,title:r,size:"sm",footer:(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(n.default,{variant:"ghost",onClick:t,disabled:x,children:c}),(0,a.jsx)(n.default,{variant:m,onClick:s,loading:x,children:d})]}),children:(0,a.jsx)("p",{className:"text-text-muted",children:l})})}},67692:(e,t,s)=>{s.d(t,{default:()=>n});var a=s(73365),r=s(1521),l=s(44156);function n(){let[e,t]=(0,r.useState)(!1);return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("button",{onClick:()=>t(!0),className:"relative flex items-center gap-1.5 px-2.5 py-1.5 rounded-lg transition-all text-text-muted hover:text-text-main hover:bg-black/5 dark:hover:bg-white/5",title:"9Remote",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"computer"}),(0,a.jsx)("span",{className:"text-xs font-medium",children:"Remote"})]}),(0,a.jsx)(l.A,{isOpen:e,onClose:()=>t(!1)})]})}},68266:(e,t,s)=>{s.d(t,{A:()=>i});var a=s(73365),r=s(1521),l=s(86447),n=s.n(l);function i({src:e,alt:t,size:s=32,className:l="",fallbackText:n="?",fallbackColor:o}){let[d,c]=(0,r.useState)(!1);return!e||d?(0,a.jsx)("span",{className:`inline-flex items-center justify-center font-bold rounded-lg ${l}`.trim(),style:{width:s,height:s,color:o,fontSize:Math.max(10,Math.floor(.38*s))},children:n}):(0,a.jsx)("img",{src:e,alt:t,width:s,height:s,className:l,onError:()=>c(!0)})}i.propTypes={src:n().string,alt:n().string,size:n().number,className:n().string,fallbackText:n().string,fallbackColor:n().string}},68600:(e,t,s)=>{s.d(t,{default:()=>o});var a=s(73365),r=s(1521),l=s(86447),n=s.n(l),i=s(74156);function o({isOpen:e,onSuccess:t,onClose:s}){let[l,n]=(0,r.useState)(""),[d,c]=(0,r.useState)(!1),[m,x]=(0,r.useState)(null),[u,p]=(0,r.useState)(!1),h=async()=>{if(!l.trim())return void x("Please paste your cookie");c(!0),x(null);try{let e=await fetch("/api/oauth/iflow/cookie",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({cookie:l.trim()})}),s=await e.json();if(!e.ok)throw Error(s.error||"Authentication failed");p(!0),setTimeout(()=>{t?.(),f()},1500)}catch(e){x(e.message)}finally{c(!1)}},f=()=>{n(""),x(null),p(!1),s?.()};return(0,a.jsx)(i.aF,{isOpen:e,onClose:f,title:"iFlow Cookie Authentication",children:(0,a.jsx)("div",{className:"space-y-4",children:u?(0,a.jsxs)("div",{className:"text-center py-8",children:[(0,a.jsx)("div",{className:"text-6xl mb-4",children:"✅"}),(0,a.jsx)("p",{className:"text-lg font-medium text-text-primary",children:"Authentication Successful!"}),(0,a.jsx)("p",{className:"text-sm text-text-muted mt-2",children:"Fresh API key obtained"})]}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("div",{className:"space-y-2",children:[(0,a.jsxs)("p",{className:"text-sm text-text-muted",children:["To get a fresh API key, paste your browser cookie from"," ",(0,a.jsx)("a",{href:"https://platform.iflow.cn",target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline",children:"platform.iflow.cn"})]}),(0,a.jsxs)("div",{className:"bg-surface-secondary p-3 rounded-lg text-xs space-y-2",children:[(0,a.jsx)("p",{className:"font-medium text-text-primary",children:"How to get cookie:"}),(0,a.jsxs)("ol",{className:"list-decimal list-inside space-y-1 text-text-muted",children:[(0,a.jsx)("li",{children:"Open platform.iflow.cn in your browser"}),(0,a.jsx)("li",{children:"Login to your account"}),(0,a.jsx)("li",{children:"Open DevTools (F12) → Application/Storage → Cookies"}),(0,a.jsx)("li",{children:"Copy the entire cookie string (must include BXAuth)"}),(0,a.jsx)("li",{children:"Paste it below"})]})]})]}),(0,a.jsxs)("div",{className:"space-y-2",children:[(0,a.jsx)("label",{className:"block text-sm font-medium text-text-primary",children:"Cookie String"}),(0,a.jsx)("textarea",{value:l,onChange:e=>n(e.target.value),placeholder:"BXAuth=xxx; ...",className:"w-full px-3 py-2 bg-surface-secondary border border-border rounded-lg text-sm text-text-primary placeholder-text-muted focus:outline-none focus:ring-2 focus:ring-primary resize-none",rows:4,disabled:d})]}),m&&(0,a.jsx)("div",{className:"p-3 bg-error/10 border border-error/20 rounded-lg",children:(0,a.jsx)("p",{className:"text-sm text-error",children:m})}),(0,a.jsxs)("div",{className:"flex gap-3 pt-2",children:[(0,a.jsx)(i.$n,{variant:"secondary",onClick:f,disabled:d,fullWidth:!0,children:"Cancel"}),(0,a.jsx)(i.$n,{onClick:h,loading:d,fullWidth:!0,children:"Authenticate"})]})]})})})}o.propTypes={isOpen:n().bool.isRequired,onSuccess:n().func,onClose:n().func}},70391:(e,t,s)=>{s.d(t,{default:()=>o});var a=s(73365),r=s(1521),l=s(86447),n=s.n(l),i=s(74156);function o({isOpen:e,onSuccess:t,onClose:s}){let[l,n]=(0,r.useState)(""),[d,c]=(0,r.useState)(""),[m,x]=(0,r.useState)(null),[u,p]=(0,r.useState)(!1),[h,f]=(0,r.useState)(!1),[b,g]=(0,r.useState)(!1),[j,y]=(0,r.useState)(!1),v=async()=>{f(!0),x(null),g(!1),y(!1);try{let e=await fetch("/api/oauth/cursor/auto-import"),t=await e.json();t.found?(n(t.accessToken),c(t.machineId),g(!0)):t.windowsManual?y(!0):x(t.error||"Could not auto-detect tokens")}catch(e){x("Failed to auto-detect tokens")}finally{f(!1)}};(0,r.useEffect)(()=>{e&&v()},[e]);let N=async()=>{if(!l.trim())return void x("Please enter an access token");if(!d.trim())return void x("Please enter a machine ID");p(!0),x(null);try{let e=await fetch("/api/oauth/cursor/import",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({accessToken:l.trim(),machineId:d.trim()})}),a=await e.json();if(!e.ok)throw Error(a.error||"Import failed");t?.(),s()}catch(e){x(e.message)}finally{p(!1)}};return(0,a.jsx)(i.aF,{isOpen:e,title:"Connect Cursor IDE",onClose:s,children:(0,a.jsxs)("div",{className:"flex flex-col gap-4",children:[h&&(0,a.jsxs)("div",{className:"text-center py-6",children:[(0,a.jsx)("div",{className:"size-16 mx-auto mb-4 rounded-full bg-primary/10 flex items-center justify-center",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-3xl text-primary animate-spin",children:"progress_activity"})}),(0,a.jsx)("h3",{className:"text-lg font-semibold mb-2",children:"Auto-detecting tokens..."}),(0,a.jsx)("p",{className:"text-sm text-text-muted",children:"Reading from Cursor IDE database"})]}),!h&&(0,a.jsxs)(a.Fragment,{children:[b&&(0,a.jsx)("div",{className:"bg-green-50 dark:bg-green-900/20 p-3 rounded-lg border border-green-200 dark:border-green-800",children:(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-green-600 dark:text-green-400",children:"check_circle"}),(0,a.jsx)("p",{className:"text-sm text-green-800 dark:text-green-200",children:"Tokens auto-detected from Cursor IDE successfully!"})]})}),j&&(0,a.jsxs)("div",{className:"bg-amber-50 dark:bg-amber-900/20 p-3 rounded-lg border border-amber-200 dark:border-amber-800 flex flex-col gap-2",children:[(0,a.jsxs)("div",{className:"flex gap-2 items-center",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-amber-600 dark:text-amber-400",children:"info"}),(0,a.jsx)("p",{className:"text-sm font-medium text-amber-800 dark:text-amber-200",children:"Could not read Cursor database automatically."})]}),(0,a.jsxs)("p",{className:"text-xs text-amber-700 dark:text-amber-300",children:["Make sure Cursor IDE has been opened at least once, then click ",(0,a.jsx)("strong",{children:"Retry"}),". If the problem persists, paste your tokens manually below."]}),(0,a.jsx)(i.$n,{onClick:v,variant:"outline",fullWidth:!0,children:"Retry"})]}),!b&&!j&&!m&&(0,a.jsx)("div",{className:"bg-blue-50 dark:bg-blue-900/20 p-3 rounded-lg border border-blue-200 dark:border-blue-800",children:(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-blue-600 dark:text-blue-400",children:"info"}),(0,a.jsx)("p",{className:"text-sm text-blue-800 dark:text-blue-200",children:"Cursor IDE not detected. Please paste your tokens manually."})]})}),(0,a.jsxs)("div",{children:[(0,a.jsxs)("label",{className:"block text-sm font-medium mb-2",children:["Access Token ",(0,a.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,a.jsx)("textarea",{value:l,onChange:e=>n(e.target.value),placeholder:"Access token will be auto-filled...",rows:3,className:"w-full px-3 py-2 text-sm font-mono border border-border rounded-lg bg-background focus:outline-none focus:border-primary resize-none"})]}),(0,a.jsxs)("div",{children:[(0,a.jsxs)("label",{className:"block text-sm font-medium mb-2",children:["Machine ID ",(0,a.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,a.jsx)(i.pd,{value:d,onChange:e=>c(e.target.value),placeholder:"Machine ID will be auto-filled...",className:"font-mono text-sm"})]}),m&&(0,a.jsx)("div",{className:"bg-red-50 dark:bg-red-900/20 p-3 rounded-lg border border-red-200 dark:border-red-800",children:(0,a.jsx)("p",{className:"text-sm text-red-600 dark:text-red-400",children:m})}),(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsx)(i.$n,{onClick:N,fullWidth:!0,disabled:u||!l.trim()||!d.trim(),children:u?"Importing...":"Import Token"}),(0,a.jsx)(i.$n,{onClick:s,variant:"ghost",fullWidth:!0,children:"Cancel"})]})]})]})})}o.propTypes={isOpen:n().bool.isRequired,onSuccess:n().func,onClose:n().func.isRequired}},70789:(e,t,s)=>{s.d(t,{default:()=>c});var a=s(73365),r=s(99568),l=s.n(r),n=s(43202);let i=[{label:"Features",href:"#features"},{label:"Pricing",href:"#pricing"},{label:"Changelog",href:"#"}],o=[{label:"Documentation",href:"#"},{label:"API Reference",href:"#"},{label:"Help Center",href:"#"}],d=[{label:"About",href:"#"},{label:"Blog",href:"#"},{label:"Contact",href:"#"}];function c(){return(0,a.jsx)("footer",{className:"bg-bg border-t border-border pt-16 pb-12",children:(0,a.jsxs)("div",{className:"container mx-auto px-4 sm:px-6 lg:px-8",children:[(0,a.jsxs)("div",{className:"grid grid-cols-2 md:grid-cols-4 lg:grid-cols-5 gap-10 mb-12",children:[(0,a.jsxs)("div",{className:"col-span-2 lg:col-span-2",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2 mb-6",children:[(0,a.jsx)("div",{className:"size-6 text-primary",children:(0,a.jsx)("svg",{className:"w-full h-full",fill:"currentColor",viewBox:"0 0 48 48",children:(0,a.jsx)("path",{clipRule:"evenodd",d:"M12.0799 24L4 19.2479L9.95537 8.75216L18.04 13.4961L18.0446 4H29.9554L29.96 13.4961L38.0446 8.75216L44 19.2479L35.92 24L44 28.7521L38.0446 39.2479L29.96 34.5039L29.9554 44H18.0446L18.04 34.5039L9.95537 39.2479L4 28.7521L12.0799 24Z",fillRule:"evenodd"})})}),(0,a.jsx)("span",{className:"text-xl font-bold text-text-main",children:n.vQ.name})]}),(0,a.jsx)("p",{className:"text-text-muted mb-6 max-w-sm font-light",children:"The unified interface for modern AI infrastructure. Secure, observable, and scalable."}),(0,a.jsxs)("div",{className:"flex gap-4",children:[(0,a.jsx)("a",{href:"#",className:"text-gray-400 hover:text-primary transition-colors","aria-label":"Twitter",children:(0,a.jsx)("svg",{className:"w-5 h-5",fill:"currentColor",viewBox:"0 0 24 24",children:(0,a.jsx)("path",{d:"M22.46 6c-.77.35-1.6.58-2.46.69.88-.53 1.56-1.37 1.88-2.38-.83.5-1.75.85-2.72 1.05C18.37 4.5 17.26 4 16 4c-2.35 0-4.27 1.92-4.27 4.29 0 .34.04.67.11.98C8.28 9.09 5.11 7.38 3 4.79c-.37.63-.58 1.37-.58 2.15 0 1.49.75 2.81 1.91 3.56-.71 0-1.37-.2-1.95-.5v.03c0 2.08 1.48 3.82 3.44 4.21a4.22 4.22 0 0 1-1.93.07 4.28 4.28 0 0 0 4 2.98 8.521 8.521 0 0 1-5.33 1.84c-.34 0-.68-.02-1.02-.06C3.44 20.29 5.7 21 8.12 21 16 21 20.33 14.46 20.33 8.79c0-.19 0-.37-.01-.56.84-.6 1.56-1.36 2.14-2.23z"})})}),(0,a.jsx)("a",{href:"#",className:"text-gray-400 hover:text-primary transition-colors","aria-label":"GitHub",children:(0,a.jsx)("svg",{className:"w-5 h-5",fill:"currentColor",viewBox:"0 0 24 24",children:(0,a.jsx)("path",{d:"M12 2C6.477 2 2 6.484 2 12.017c0 4.425 2.865 8.18 6.839 9.504.5.092.682-.217.682-.483 0-.237-.008-.868-.013-1.703-2.782.605-3.369-1.343-3.369-1.343-.454-1.158-1.11-1.466-1.11-1.466-.908-.62.069-.608.069-.608 1.003.07 1.531 1.032 1.531 1.032.892 1.53 2.341 1.088 2.91.832.092-.647.35-1.088.636-1.338-2.22-.253-4.555-1.113-4.555-4.951 0-1.093.39-1.988 1.029-2.688-.103-.253-.446-1.272.098-2.65 0 0 .84-.27 2.75 1.026A9.564 9.564 0 0 1 12 6.844c.85.004 1.705.115 2.504.337 1.909-1.296 2.747-1.027 2.747-1.027.546 1.379.202 2.398.1 2.651.64.7 1.028 1.595 1.028 2.688 0 3.848-2.339 4.695-4.566 4.943.359.309.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.019 10.019 0 0 0 22 12.017C22 6.484 17.522 2 12 2z"})})})]})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("h4",{className:"font-semibold text-text-main mb-4",children:"Product"}),(0,a.jsx)("ul",{className:"flex flex-col gap-3 text-sm text-text-muted font-light",children:i.map(e=>(0,a.jsx)("li",{children:(0,a.jsx)(l(),{href:e.href,className:"hover:text-primary transition-colors",children:e.label})},e.label))})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("h4",{className:"font-semibold text-text-main mb-4",children:"Resources"}),(0,a.jsx)("ul",{className:"flex flex-col gap-3 text-sm text-text-muted font-light",children:o.map(e=>(0,a.jsx)("li",{children:(0,a.jsx)(l(),{href:e.href,className:"hover:text-primary transition-colors",children:e.label})},e.label))})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("h4",{className:"font-semibold text-text-main mb-4",children:"Company"}),(0,a.jsx)("ul",{className:"flex flex-col gap-3 text-sm text-text-muted font-light",children:d.map(e=>(0,a.jsx)("li",{children:(0,a.jsx)(l(),{href:e.href,className:"hover:text-primary transition-colors",children:e.label})},e.label))})]})]}),(0,a.jsxs)("div",{className:"border-t border-border pt-8 flex flex-col md:flex-row justify-between items-center gap-4",children:[(0,a.jsxs)("p",{className:"text-sm text-text-muted",children:["\xa9 ",new Date().getFullYear()," ",n.vQ.name," Inc. All rights reserved."]}),(0,a.jsxs)("div",{className:"flex gap-6 text-sm text-text-muted",children:[(0,a.jsx)(l(),{href:"#",className:"hover:text-primary transition-colors",children:"Privacy Policy"}),(0,a.jsx)(l(),{href:"#",className:"hover:text-primary transition-colors",children:"Terms of Service"})]})]})]})})}},73531:(e,t,s)=>{s.d(t,{default:()=>c});var a=s(73365),r=s(1521),l=s(86447),n=s.n(l),i=s(3242),o=s(63380),d=s(51454);function c({isOpen:e,providerInfo:t,onSuccess:s,onClose:l}){let[n,m]=(0,r.useState)(null),[x,u]=(0,r.useState)(null),[p,h]=(0,r.useState)(null),f=(0,r.useCallback)((e,t)=>{"builder-id"===e?m("builder-id"):"idc"===e?(m("idc"),h(t)):"social"===e?(m("social"),u(t.provider)):"import"===e&&s?.()},[s]),b=()=>{m(null),u(null),h(null)};return n?"builder-id"===n||"idc"===n?(0,a.jsx)(i.default,{isOpen:e,provider:"kiro",providerInfo:t,onSuccess:()=>{m(null),h(null),s?.(),l?.()},onClose:b,idcConfig:p}):"social"===n&&x?(0,a.jsx)(d.default,{isOpen:e,provider:x,onSuccess:()=>{m(null),u(null),s?.(),l?.()},onClose:b}):null:(0,a.jsx)(o.default,{isOpen:e,onMethodSelect:f,onClose:l})}c.propTypes={isOpen:n().bool.isRequired,providerInfo:n().shape({name:n().string}),onSuccess:n().func,onClose:n().func.isRequired}},74156:(e,t,s)=>{s.d(t,{x0:()=>v.default,Ex:()=>d.default,$n:()=>a.default,Zp:()=>n.default,Qv:()=>o.CardSkeleton,G9:()=>b.default,wI:()=>y.default,vj:()=>j.default,vE:()=>g.default,pd:()=>r.default,Mh:()=>f.default,uR:()=>u.default,aF:()=>i.default,rq:()=>x.default,gw:()=>N.default,LF:()=>m.default,Wx:()=>C.default,gM:()=>h.default,Iz:()=>w.default,l6:()=>l.default,lM:()=>c.default,m_:()=>k.default,jK:()=>p.default});var a=s(38230),r=s(53038),l=s(37066),n=s(292),i=s(66911),o=s(91494);s(82455);var d=s(35045),c=s(14406);s(84675),s(98814),s(56550),s(51123),s(70789);var m=s(3242),x=s(24372),u=s(5671),p=s(3412);s(12003),s(67692),s(80600),s(26125);var h=s(32135);s(63380);var f=s(73531);s(51454);var b=s(70391),g=s(68600),j=s(50136),y=s(90163),v=s(12820),N=s(99775),w=s(1755),k=s(13333),C=s(8569);s(13048),s(54546)},80600:(e,t,s)=>{s.d(t,{default:()=>p});var a=s(73365),r=s(1521),l=s(86447),n=s.n(l),i=s(55348),o=s(89036),d=s(26125),c=s(44156),m=s(12003);let x={en:{name:"English",flag:"\uD83C\uDDFA\uD83C\uDDF8"},vi:{name:"Tiếng Việt",flag:"\uD83C\uDDFB\uD83C\uDDF3"},"zh-CN":{name:"简体中文",flag:"\uD83C\uDDE8\uD83C\uDDF3"},"zh-TW":{name:"繁體中文",flag:"\uD83C\uDDF9\uD83C\uDDFC"},ja:{name:"日本語",flag:"\uD83C\uDDEF\uD83C\uDDF5"},"pt-BR":{name:"Portugu\xeas (BR)",flag:"\uD83C\uDDE7\uD83C\uDDF7"},"pt-PT":{name:"Portugu\xeas (PT)",flag:"\uD83C\uDDF5\uD83C\uDDF9"},ko:{name:"한국어",flag:"\uD83C\uDDF0\uD83C\uDDF7"},es:{name:"Espa\xf1ol",flag:"\uD83C\uDDEA\uD83C\uDDF8"},de:{name:"Deutsch",flag:"\uD83C\uDDE9\uD83C\uDDEA"},fr:{name:"Fran\xe7ais",flag:"\uD83C\uDDEB\uD83C\uDDF7"},he:{name:"עברית",flag:"\uD83C\uDDEE\uD83C\uDDF1"},ar:{name:"العربية",flag:"\uD83C\uDDF8\uD83C\uDDE6"},ru:{name:"Русский",flag:"\uD83C\uDDF7\uD83C\uDDFA"},pl:{name:"Polski",flag:"\uD83C\uDDF5\uD83C\uDDF1"},cs:{name:"Čeština",flag:"\uD83C\uDDE8\uD83C\uDDFF"},nl:{name:"Nederlands",flag:"\uD83C\uDDF3\uD83C\uDDF1"},tr:{name:"T\xfcrk\xe7e",flag:"\uD83C\uDDF9\uD83C\uDDF7"},uk:{name:"Українська",flag:"\uD83C\uDDFA\uD83C\uDDE6"},tl:{name:"Tagalog",flag:"\uD83C\uDDF5\uD83C\uDDED"},id:{name:"Indonesia",flag:"\uD83C\uDDEE\uD83C\uDDE9"},th:{name:"ไทย",flag:"\uD83C\uDDF9\uD83C\uDDED"},hi:{name:"हिन्दी",flag:"\uD83C\uDDEE\uD83C\uDDF3"},bn:{name:"বাংলা",flag:"\uD83C\uDDE7\uD83C\uDDE9"},ur:{name:"اردو",flag:"\uD83C\uDDF5\uD83C\uDDF0"},ro:{name:"Rom\xe2nă",flag:"\uD83C\uDDF7\uD83C\uDDF4"},sv:{name:"Svenska",flag:"\uD83C\uDDF8\uD83C\uDDEA"},it:{name:"Italiano",flag:"\uD83C\uDDEE\uD83C\uDDF9"},el:{name:"Ελληνικά",flag:"\uD83C\uDDEC\uD83C\uDDF7"},hu:{name:"Magyar",flag:"\uD83C\uDDED\uD83C\uDDFA"},fi:{name:"Suomi",flag:"\uD83C\uDDEB\uD83C\uDDEE"},da:{name:"Dansk",flag:"\uD83C\uDDE9\uD83C\uDDF0"},no:{name:"Norsk",flag:"\uD83C\uDDF3\uD83C\uDDF4"}};function u({icon:e,label:t,onClick:s,trailing:r,danger:l}){return(0,a.jsxs)("button",{onClick:s,className:`flex items-center gap-3 w-full px-4 py-2.5 text-sm transition-colors ${l?"text-red-500 hover:bg-red-500/10":"text-text-main hover:bg-black/5 dark:hover:bg-white/5"}`,children:[(0,a.jsx)("span",{className:`material-symbols-outlined text-[20px] ${l?"":"text-text-muted"}`,children:e}),(0,a.jsx)("span",{className:"flex-1 text-left",children:t}),r&&(0,a.jsx)("span",{className:"text-base",children:r})]})}function p({onLogout:e}){let[t,s]=(0,r.useState)(!1),[l,n]=(0,r.useState)(!1),[h,f]=(0,r.useState)(!1),[b,g]=(0,r.useState)(!1),[j,y]=(0,r.useState)("en"),{toggleTheme:v,isDark:N}=(0,o.D)(),w=(0,r.useRef)(null);return(0,r.useEffect)(()=>{y(function(){if("u"<typeof document)return"en";let e=document.cookie.split(";").find(e=>e.trim().startsWith(`${i.CL}=`)),t=e?decodeURIComponent(e.split("=")[1]):"en";return(0,i.QC)(t)}())},[b]),(0,r.useEffect)(()=>{let e=e=>{w.current&&!w.current.contains(e.target)&&s(!1)};if(t)return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[t]),(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("div",{className:"relative",ref:w,children:[(0,a.jsx)("button",{onClick:()=>s(e=>!e),className:"flex items-center justify-center p-2 rounded-lg text-text-muted hover:text-text-main hover:bg-black/5 dark:hover:bg-white/5 transition-all",title:"Menu",children:(0,a.jsx)("span",{className:"material-symbols-outlined",children:"grid_view"})}),t&&(0,a.jsxs)("div",{className:"absolute right-0 top-full mt-2 w-60 bg-surface border border-black/10 dark:border-white/10 rounded-xl shadow-2xl z-50 animate-in fade-in zoom-in-95 duration-150 overflow-hidden py-1",children:[(0,a.jsx)(u,{icon:"history",label:"Change Log",onClick:()=>{s(!1),n(!0)}}),(0,a.jsx)(u,{icon:"language",label:x[j]?.name||j,trailing:x[j]?.flag||"\uD83C\uDF10",onClick:()=>{s(!1),g(!0)}}),(0,a.jsx)(u,{icon:N?"light_mode":"dark_mode",label:"Theme",onClick:()=>{v(),s(!1)}}),(0,a.jsx)(u,{icon:"computer",label:"Remote",onClick:()=>{s(!1),f(!0)}}),(0,a.jsx)(u,{icon:"logout",label:"Logout",danger:!0,onClick:()=>{s(!1),e()}})]})]}),(0,a.jsx)(d.default,{isOpen:l,onClose:()=>n(!1)}),(0,a.jsx)(c.A,{isOpen:h,onClose:()=>f(!1)}),(0,a.jsx)(m.default,{hideTrigger:!0,isOpen:b,onClose:()=>g(!1)})]})}u.propTypes={icon:n().string.isRequired,label:n().string.isRequired,onClick:n().func.isRequired,trailing:n().node,danger:n().bool},p.propTypes={onLogout:n().func.isRequired}},82455:(e,t,s)=>{s.d(t,{default:()=>l});var a=s(73365),r=s(87706);function l({src:e,alt:t="Avatar",name:s,size:n="md",className:i}){let o={xs:"size-6 text-xs",sm:"size-8 text-sm",md:"size-10 text-base",lg:"size-12 text-lg",xl:"size-16 text-xl"};return e?(0,a.jsx)("div",{className:(0,r.cn)("rounded-full bg-cover bg-center bg-no-repeat","ring-2 ring-white dark:ring-surface-dark shadow-sm",o[n],i),style:{backgroundImage:`url(${e})`},role:"img","aria-label":t}):(0,a.jsx)("div",{className:(0,r.cn)("rounded-full flex items-center justify-center font-semibold text-white","ring-2 ring-white dark:ring-surface-dark shadow-sm",o[n],(e=>{if(!e)return"bg-primary";let t=["bg-red-500","bg-orange-500","bg-amber-500","bg-yellow-500","bg-lime-500","bg-green-500","bg-emerald-500","bg-teal-500","bg-cyan-500","bg-sky-500","bg-blue-500","bg-indigo-500","bg-violet-500","bg-purple-500","bg-fuchsia-500","bg-pink-500","bg-rose-500"],s=e.charCodeAt(0)%t.length;return t[s]})(s),i),role:"img","aria-label":t,children:(e=>{if(!e)return"?";let t=e.split(" ");return t.length>=2?`${t[0][0]}${t[1][0]}`.toUpperCase():e.substring(0,2).toUpperCase()})(s)})}},84675:(e,t,s)=>{s.d(t,{default:()=>n});var a=s(73365),r=s(89036),l=s(87706);function n({className:e,variant:t="default"}){let{isDark:s,toggleTheme:i}=(0,r.D)(),o={default:(0,l.cn)("flex items-center justify-center size-10 rounded-full","text-text-muted hover:text-text-main","hover:bg-surface-2 transition-colors"),card:(0,l.cn)("flex items-center justify-center size-11 rounded-full","bg-surface/60 hover:bg-surface","border border-border","backdrop-blur-md shadow-sm hover:shadow-[var(--shadow-warm)]","text-text-muted hover:text-brand-500","transition-all group")};return(0,a.jsx)("button",{onClick:i,className:(0,l.cn)(o[t],e),"aria-label":`Switch to ${s?"light":"dark"} mode`,title:`Switch to ${s?"light":"dark"} mode`,children:(0,a.jsx)("span",{className:(0,l.cn)("material-symbols-outlined text-[22px]","card"===t&&"transition-transform duration-300 group-hover:rotate-12"),children:s?"light_mode":"dark_mode"})})}},87706:(e,t,s)=>{s.d(t,{cn:()=>a});function a(...e){return e.filter(Boolean).join(" ").replace(/\s+/g," ").trim()}},89036:(e,t,s)=>{s.d(t,{D:()=>o});var a=s(1521),r=s(83789);function l(e){let t=window.matchMedia("(prefers-color-scheme: dark)");return t.addEventListener("change",e),()=>t.removeEventListener("change",e)}function n(){return window.matchMedia("(prefers-color-scheme: dark)").matches}function i(){return!1}function o(){let{theme:e,setTheme:t,toggleTheme:s,initTheme:o}=(0,r.A)(),d=(0,a.useSyncExternalStore)(l,n,i);(0,a.useEffect)(()=>{o()},[o]),(0,a.useEffect)(()=>{if("system"!==e)return;let t=window.matchMedia("(prefers-color-scheme: dark)"),s=()=>o();return t.addEventListener("change",s),()=>t.removeEventListener("change",s)},[e,o]);let c="dark"===e||"system"===e&&d;return{theme:e,setTheme:t,toggleTheme:s,isDark:c}}},90163:(e,t,s)=>{s.d(t,{default:()=>x});var a=s(73365),r=s(1521),l=s(86447),n=s.n(l),i=s(66911),o=s(53038),d=s(38230),c=s(35045),m=s(82495);function x({isOpen:e,connection:t,proxyPools:s,onSave:l,onClose:n}){let[u,p]=(0,r.useState)({name:"",priority:1,apiKey:""}),[h,f]=(0,r.useState)({azureEndpoint:"",apiVersion:"2024-10-01-preview",deployment:"",organization:""}),[b,g]=(0,r.useState)({accountId:""}),[j,y]=(0,r.useState)(!1),[v,N]=(0,r.useState)(null),[w,k]=(0,r.useState)(!1),[C,S]=(0,r.useState)(null),[T,$]=(0,r.useState)(!1);(0,r.useEffect)(()=>{t&&(p({name:t.name||"",priority:t.priority||1,apiKey:""}),"azure"===t.provider&&t.providerSpecificData&&f({azureEndpoint:t.providerSpecificData.azureEndpoint||"",apiVersion:t.providerSpecificData.apiVersion||"2024-10-01-preview",deployment:t.providerSpecificData.deployment||"",organization:t.providerSpecificData.organization||""}),"cloudflare-ai"===t.provider&&t.providerSpecificData&&g({accountId:t.providerSpecificData.accountId||""}),N(null),S(null))},[t]);let R=t?.authType==="oauth",I=t?.provider==="azure",P=t?.provider==="cloudflare-ai",O=!!t&&((0,m.mq)(t.provider)||(0,m.gb)(t.provider)),E=async()=>{if(t?.provider){y(!0),N(null);try{let e=await fetch(`/api/providers/${t.id}/test`,{method:"POST"}),s=await e.json();N(s.valid?"success":"failed")}catch{N("failed")}finally{y(!1)}}},M=async()=>{if(t?.provider&&u.apiKey){k(!0),S(null);try{let e=await fetch("/api/providers/validate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:t.provider,apiKey:u.apiKey,...I?{providerSpecificData:h}:{},...P?{providerSpecificData:b}:{}})}),s=await e.json();S(s.valid?"success":"failed")}catch{S("failed")}finally{k(!1)}}},L=async()=>{if(t){$(!0);try{let e={name:u.name,priority:u.priority};if(!R&&u.apiKey){e.apiKey=u.apiKey;let s="success"===C;if(!s)try{k(!0),S(null);let e=await fetch("/api/providers/validate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:t.provider,apiKey:u.apiKey,...I?{providerSpecificData:h}:{},...P?{providerSpecificData:b}:{}})});s=!!(await e.json()).valid,S(s?"success":"failed")}catch{S("failed")}finally{k(!1)}s&&(e.testStatus="active",e.lastError=null,e.lastErrorAt=null)}I&&(e.providerSpecificData={azureEndpoint:h.azureEndpoint,apiVersion:h.apiVersion,deployment:h.deployment,organization:h.organization}),P&&(e.providerSpecificData={accountId:b.accountId}),await l(e)}finally{$(!1)}}};return t?(0,a.jsx)(i.default,{isOpen:e,title:"Edit Connection",onClose:n,children:(0,a.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,a.jsx)(o.default,{label:"Name",value:u.name,onChange:e=>p({...u,name:e.target.value}),placeholder:R?"Account name":"Production Key"}),R&&t.email&&(0,a.jsxs)("div",{className:"bg-sidebar/50 p-3 rounded-lg",children:[(0,a.jsx)("p",{className:"text-sm text-text-muted mb-1",children:"Email"}),(0,a.jsx)("p",{className:"font-medium",children:t.email})]}),(0,a.jsx)(o.default,{label:"Priority",type:"number",value:u.priority,onChange:e=>p({...u,priority:Number.parseInt(e.target.value,10)||1})}),!R&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsx)(o.default,{label:"API Key",type:"password",value:u.apiKey,onChange:e=>p({...u,apiKey:e.target.value}),placeholder:"Enter new API key",hint:"Leave blank to keep the current API key.",className:"flex-1"}),(0,a.jsx)("div",{className:"pt-6",children:(0,a.jsx)(d.default,{onClick:M,disabled:!u.apiKey||w||T,variant:"secondary",children:w?"Checking...":"Check"})})]}),C&&(0,a.jsx)(c.default,{variant:"success"===C?"success":"error",children:"success"===C?"Valid":"Invalid"})]}),I&&(0,a.jsxs)("div",{className:"bg-sidebar/50 p-4 rounded-lg border border-accent/20",children:[(0,a.jsx)("h3",{className:"font-semibold mb-3 text-sm",children:"Azure OpenAI Configuration"}),(0,a.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,a.jsx)(o.default,{label:"Azure Endpoint",value:h.azureEndpoint,onChange:e=>f({...h,azureEndpoint:e.target.value}),placeholder:"https://your-resource.openai.azure.com",hint:"Your Azure OpenAI resource endpoint URL"}),(0,a.jsx)(o.default,{label:"Deployment Name",value:h.deployment,onChange:e=>f({...h,deployment:e.target.value}),placeholder:"gpt-4",hint:"The deployment name in your Azure resource"}),(0,a.jsx)(o.default,{label:"API Version",value:h.apiVersion,onChange:e=>f({...h,apiVersion:e.target.value}),placeholder:"2024-10-01-preview",hint:"Azure OpenAI API version to use"}),(0,a.jsx)(o.default,{label:"Organization",value:h.organization,onChange:e=>f({...h,organization:e.target.value}),placeholder:"Organization ID",hint:"Required for billing"})]})]}),!O&&!I&&!P&&(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[(0,a.jsx)(d.default,{onClick:E,variant:"secondary",disabled:j,children:j?"Testing...":"Test Connection"}),v&&(0,a.jsx)(c.default,{variant:"success"===v?"success":"error",children:"success"===v?"Valid":"Failed"})]}),(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsx)(d.default,{onClick:L,fullWidth:!0,disabled:T,children:T?"Saving...":"Save"}),(0,a.jsx)(d.default,{onClick:n,variant:"ghost",fullWidth:!0,children:"Cancel"})]})]})}):null}x.propTypes={isOpen:n().bool.isRequired,connection:n().shape({id:n().string,name:n().string,email:n().string,priority:n().number,authType:n().string,provider:n().string,providerSpecificData:n().object}),proxyPools:n().arrayOf(n().shape({id:n().string,name:n().string})),onSave:n().func.isRequired,onClose:n().func.isRequired}},91494:(e,t,s)=>{s.d(t,{CardSkeleton:()=>o,PageLoading:()=>n,Skeleton:()=>i,Spinner:()=>l,default:()=>d});var a=s(73365),r=s(87706);function l({size:e="md",className:t}){return(0,a.jsx)("span",{className:(0,r.cn)("material-symbols-outlined animate-spin text-brand-500",{sm:"size-4",md:"size-6",lg:"size-8",xl:"size-12"}[e],t),children:"progress_activity"})}function n({message:e="Loading..."}){return(0,a.jsxs)("div",{className:"fixed inset-0 z-50 flex flex-col items-center justify-center bg-bg",children:[(0,a.jsx)(l,{size:"xl"}),(0,a.jsx)("p",{className:"mt-4 text-text-muted",children:e})]})}function i({className:e,...t}){return(0,a.jsx)("div",{className:(0,r.cn)("animate-pulse rounded-[10px] bg-surface-2",e),...t})}function o(){return(0,a.jsxs)("div",{className:"p-6 rounded-[14px] border border-border-subtle bg-surface shadow-[var(--shadow-soft)]",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,a.jsx)(i,{className:"h-4 w-24"}),(0,a.jsx)(i,{className:"size-10 rounded-[10px]"})]}),(0,a.jsx)(i,{className:"h-8 w-16 mb-2"}),(0,a.jsx)(i,{className:"h-3 w-20"})]})}function d({type:e="spinner",...t}){switch(e){case"page":return(0,a.jsx)(n,{...t});case"skeleton":return(0,a.jsx)(i,{...t});case"card":return(0,a.jsx)(o,{...t});default:return(0,a.jsx)(l,{...t})}}},96459:(e,t,s)=>{s.d(t,{C:()=>r});var a=s(1521);function r(e=2e3){let[t,s]=(0,a.useState)(null),l=(0,a.useRef)(null);return{copied:t,copy:(0,a.useCallback)((t,a="default")=>{(async()=>{if(navigator?.clipboard?.writeText)await navigator.clipboard.writeText(t);else{let e=document.createElement("textarea");e.value=t,e.style.position="fixed",e.style.opacity="0",document.body.appendChild(e),e.select(),document.execCommand("copy"),document.body.removeChild(e)}})(),s(a),l.current&&clearTimeout(l.current),l.current=setTimeout(()=>{s(null)},e)},[e])}}},99775:(e,t,s)=>{s.d(t,{default:()=>m});var a=s(73365),r=s(1521),l=s(86447),n=s.n(l),i=s(292),o=s(37066),d=s(35045);let c="__none__";function m({providerId:e}){let[t,s]=(0,r.useState)([]),[l,n]=(0,r.useState)(c),[x,u]=(0,r.useState)(!1),[p,h]=(0,r.useState)(!1);(0,r.useEffect)(()=>{let t=!1;return Promise.all([fetch("/api/proxy-pools?isActive=true",{cache:"no-store"}).then(e=>e.ok?e.json():{proxyPools:[]}),fetch("/api/settings",{cache:"no-store"}).then(e=>e.ok?e.json():{})]).then(([a,r])=>{t||(s(a.proxyPools||[]),n(((r.providerStrategies||{})[e]||{}).proxyPoolId||c))}).catch(()=>{}),()=>{t=!0}},[e]);let f=async t=>{n(t),u(!0);try{let s=await fetch("/api/settings",{cache:"no-store"}),a=(s.ok?await s.json():{}).providerStrategies||{},r={...a[e]||{}};t===c?delete r.proxyPoolId:r.proxyPoolId=t;let l={...a};0===Object.keys(r).length?delete l[e]:l[e]=r,await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({providerStrategies:l})}),h(!0),setTimeout(()=>h(!1),1500)}catch(e){console.log("Save proxyPoolId error:",e)}finally{u(!1)}};return(0,a.jsxs)(i.default,{children:[(0,a.jsxs)("div",{className:"flex items-center gap-3 mb-4",children:[(0,a.jsx)("div",{className:"inline-flex items-center justify-center w-10 h-10 rounded-full bg-green-500/10 text-green-500",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[20px]",children:"lock_open"})}),(0,a.jsxs)("div",{className:"flex-1",children:[(0,a.jsx)("p",{className:"text-sm font-medium",children:"No authentication required"}),(0,a.jsx)("p",{className:"text-xs text-text-muted",children:"This provider is ready to use. Optionally route requests through a proxy pool to bypass IP-based limits."})]}),p&&(0,a.jsx)(d.default,{variant:"success",size:"sm",children:"Saved"})]}),(0,a.jsx)(o.default,{label:"Proxy Pool",value:l,onChange:e=>f(e.target.value),disabled:x,options:[{value:c,label:"None (direct)"},...t.map(e=>({value:e.id,label:e.name}))]})]})}m.propTypes={providerId:n().string.isRequired}}}]);
|