zevairouter 1.0.105 → 1.0.107
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +16 -0
- package/cli/app/.next-cli-build/BUILD_ID +1 -1
- package/cli/app/.next-cli-build/app-path-routes-manifest.json +6 -6
- package/cli/app/.next-cli-build/build-manifest.json +2 -2
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/automation/page_client-reference-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/basic-chat/page_client-reference-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/[toolId]/page_client-reference-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/page_client-reference-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/combos/page_client-reference-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/console-log/page_client-reference-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/context/page_client-reference-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/endpoint/page_client-reference-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/[kind]/[id]/page_client-reference-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/[kind]/page_client-reference-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/combo/[id]/page_client-reference-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/web/page_client-reference-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/mitm/page_client-reference-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/page_client-reference-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/playground/page_client-reference-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/profile/page_client-reference-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/[id]/page_client-reference-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/new/page_client-reference-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/page_client-reference-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/proxy-pools/page_client-reference-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/pxpipe/page_client-reference-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/quota/page_client-reference-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/terminal/page_client-reference-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/token-saver/page_client-reference-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/translator/page_client-reference-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/usage/page_client-reference-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/app/_global-error/page_client-reference-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/app/_global-error.html +1 -1
- package/cli/app/.next-cli-build/server/app/_global-error.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/_global-error.segments/_global-error.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/_global-error.segments/_head.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/_global-error.segments/_index.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/app/_not-found.html +1 -1
- package/cli/app/.next-cli-build/server/app/_not-found.rsc +3 -3
- package/cli/app/.next-cli-build/server/app/_not-found.segments/_full.segment.rsc +3 -3
- package/cli/app/.next-cli-build/server/app/_not-found.segments/_head.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/_not-found.segments/_index.segment.rsc +3 -3
- package/cli/app/.next-cli-build/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/_not-found.segments/_tree.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/api/cli-tools/all-statuses/route.js +1 -1
- package/cli/app/.next-cli-build/server/app/api/cli-tools/opencode-settings/route.js +1 -1
- package/cli/app/.next-cli-build/server/app/api/models/route.js +1 -1
- package/cli/app/.next-cli-build/server/app/api/models/test/route.js +1 -1
- package/cli/app/.next-cli-build/server/app/api/providers/[id]/test-models/route.js +1 -1
- package/cli/app/.next-cli-build/server/app/api/providers/route.js +1 -1
- package/cli/app/.next-cli-build/server/app/api/providers/validate/route.js +1 -1
- package/cli/app/.next-cli-build/server/app/api/translator/console-logs/route.js +1 -1
- package/cli/app/.next-cli-build/server/app/api/translator/console-logs/stream/route.js +1 -1
- package/cli/app/.next-cli-build/server/app/api/version/route.js +1 -1
- package/cli/app/.next-cli-build/server/app/api/version/shutdown/route.js +1 -1
- package/cli/app/.next-cli-build/server/app/api/version/update/route.js +1 -1
- package/cli/app/.next-cli-build/server/app/callback/page_client-reference-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/app/callback.html +1 -1
- package/cli/app/.next-cli-build/server/app/callback.rsc +3 -3
- package/cli/app/.next-cli-build/server/app/callback.segments/_full.segment.rsc +3 -3
- package/cli/app/.next-cli-build/server/app/callback.segments/_head.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/callback.segments/_index.segment.rsc +3 -3
- package/cli/app/.next-cli-build/server/app/callback.segments/_tree.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/callback.segments/callback/__PAGE__.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/callback.segments/callback.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/automation.html +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/automation.rsc +5 -5
- package/cli/app/.next-cli-build/server/app/dashboard/automation.segments/!KGRhc2hib2FyZCk/dashboard/automation/__PAGE__.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/automation.segments/!KGRhc2hib2FyZCk/dashboard/automation.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/automation.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/automation.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/automation.segments/_full.segment.rsc +5 -5
- package/cli/app/.next-cli-build/server/app/dashboard/automation.segments/_head.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/automation.segments/_index.segment.rsc +3 -3
- package/cli/app/.next-cli-build/server/app/dashboard/automation.segments/_tree.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/basic-chat.html +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/basic-chat.rsc +5 -5
- package/cli/app/.next-cli-build/server/app/dashboard/basic-chat.segments/!KGRhc2hib2FyZCk/dashboard/basic-chat/__PAGE__.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/basic-chat.segments/!KGRhc2hib2FyZCk/dashboard/basic-chat.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/basic-chat.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/basic-chat.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/basic-chat.segments/_full.segment.rsc +5 -5
- package/cli/app/.next-cli-build/server/app/dashboard/basic-chat.segments/_head.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/basic-chat.segments/_index.segment.rsc +3 -3
- package/cli/app/.next-cli-build/server/app/dashboard/basic-chat.segments/_tree.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/cli-tools.html +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/cli-tools.rsc +5 -5
- package/cli/app/.next-cli-build/server/app/dashboard/cli-tools.segments/!KGRhc2hib2FyZCk/dashboard/cli-tools/__PAGE__.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/cli-tools.segments/!KGRhc2hib2FyZCk/dashboard/cli-tools.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/cli-tools.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/cli-tools.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/cli-tools.segments/_full.segment.rsc +5 -5
- package/cli/app/.next-cli-build/server/app/dashboard/cli-tools.segments/_head.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/cli-tools.segments/_index.segment.rsc +3 -3
- package/cli/app/.next-cli-build/server/app/dashboard/cli-tools.segments/_tree.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/combos.html +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/combos.rsc +5 -5
- package/cli/app/.next-cli-build/server/app/dashboard/combos.segments/!KGRhc2hib2FyZCk/dashboard/combos/__PAGE__.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/combos.segments/!KGRhc2hib2FyZCk/dashboard/combos.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/combos.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/combos.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/combos.segments/_full.segment.rsc +5 -5
- package/cli/app/.next-cli-build/server/app/dashboard/combos.segments/_head.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/combos.segments/_index.segment.rsc +3 -3
- package/cli/app/.next-cli-build/server/app/dashboard/combos.segments/_tree.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/context.html +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/context.rsc +5 -5
- package/cli/app/.next-cli-build/server/app/dashboard/context.segments/!KGRhc2hib2FyZCk/dashboard/context/__PAGE__.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/context.segments/!KGRhc2hib2FyZCk/dashboard/context.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/context.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/context.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/context.segments/_full.segment.rsc +5 -5
- package/cli/app/.next-cli-build/server/app/dashboard/context.segments/_head.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/context.segments/_index.segment.rsc +3 -3
- package/cli/app/.next-cli-build/server/app/dashboard/context.segments/_tree.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/endpoint.html +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/endpoint.rsc +5 -5
- package/cli/app/.next-cli-build/server/app/dashboard/endpoint.segments/!KGRhc2hib2FyZCk/dashboard/endpoint/__PAGE__.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/endpoint.segments/!KGRhc2hib2FyZCk/dashboard/endpoint.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/endpoint.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/endpoint.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/endpoint.segments/_full.segment.rsc +5 -5
- package/cli/app/.next-cli-build/server/app/dashboard/endpoint.segments/_head.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/endpoint.segments/_index.segment.rsc +3 -3
- package/cli/app/.next-cli-build/server/app/dashboard/endpoint.segments/_tree.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/media-providers/web.html +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/media-providers/web.rsc +5 -5
- package/cli/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/!KGRhc2hib2FyZCk/dashboard/media-providers/web/__PAGE__.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/!KGRhc2hib2FyZCk/dashboard/media-providers/web.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/!KGRhc2hib2FyZCk/dashboard/media-providers.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/_full.segment.rsc +5 -5
- package/cli/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/_head.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/_index.segment.rsc +3 -3
- package/cli/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/_tree.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/mitm.html +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/mitm.rsc +5 -5
- package/cli/app/.next-cli-build/server/app/dashboard/mitm.segments/!KGRhc2hib2FyZCk/dashboard/mitm/__PAGE__.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/mitm.segments/!KGRhc2hib2FyZCk/dashboard/mitm.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/mitm.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/mitm.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/mitm.segments/_full.segment.rsc +5 -5
- package/cli/app/.next-cli-build/server/app/dashboard/mitm.segments/_head.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/mitm.segments/_index.segment.rsc +3 -3
- package/cli/app/.next-cli-build/server/app/dashboard/mitm.segments/_tree.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/playground.html +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/playground.rsc +5 -5
- package/cli/app/.next-cli-build/server/app/dashboard/playground.segments/!KGRhc2hib2FyZCk/dashboard/playground/__PAGE__.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/playground.segments/!KGRhc2hib2FyZCk/dashboard/playground.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/playground.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/playground.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/playground.segments/_full.segment.rsc +5 -5
- package/cli/app/.next-cli-build/server/app/dashboard/playground.segments/_head.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/playground.segments/_index.segment.rsc +3 -3
- package/cli/app/.next-cli-build/server/app/dashboard/playground.segments/_tree.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/profile.html +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/profile.rsc +5 -5
- package/cli/app/.next-cli-build/server/app/dashboard/profile.segments/!KGRhc2hib2FyZCk/dashboard/profile/__PAGE__.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/profile.segments/!KGRhc2hib2FyZCk/dashboard/profile.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/profile.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/profile.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/profile.segments/_full.segment.rsc +5 -5
- package/cli/app/.next-cli-build/server/app/dashboard/profile.segments/_head.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/profile.segments/_index.segment.rsc +3 -3
- package/cli/app/.next-cli-build/server/app/dashboard/profile.segments/_tree.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/providers/new.html +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/providers/new.rsc +5 -5
- package/cli/app/.next-cli-build/server/app/dashboard/providers/new.segments/!KGRhc2hib2FyZCk/dashboard/providers/new/__PAGE__.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/providers/new.segments/!KGRhc2hib2FyZCk/dashboard/providers/new.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/providers/new.segments/!KGRhc2hib2FyZCk/dashboard/providers.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/providers/new.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/providers/new.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/providers/new.segments/_full.segment.rsc +5 -5
- package/cli/app/.next-cli-build/server/app/dashboard/providers/new.segments/_head.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/providers/new.segments/_index.segment.rsc +3 -3
- package/cli/app/.next-cli-build/server/app/dashboard/providers/new.segments/_tree.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/providers.html +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/providers.rsc +5 -5
- package/cli/app/.next-cli-build/server/app/dashboard/providers.segments/!KGRhc2hib2FyZCk/dashboard/providers/__PAGE__.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/providers.segments/!KGRhc2hib2FyZCk/dashboard/providers.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/providers.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/providers.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/providers.segments/_full.segment.rsc +5 -5
- package/cli/app/.next-cli-build/server/app/dashboard/providers.segments/_head.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/providers.segments/_index.segment.rsc +3 -3
- package/cli/app/.next-cli-build/server/app/dashboard/providers.segments/_tree.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/proxy-pools.html +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/proxy-pools.rsc +5 -5
- package/cli/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/!KGRhc2hib2FyZCk/dashboard/proxy-pools/__PAGE__.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/!KGRhc2hib2FyZCk/dashboard/proxy-pools.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/_full.segment.rsc +5 -5
- package/cli/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/_head.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/_index.segment.rsc +3 -3
- package/cli/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/_tree.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/pxpipe.html +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/pxpipe.rsc +5 -5
- package/cli/app/.next-cli-build/server/app/dashboard/pxpipe.segments/!KGRhc2hib2FyZCk/dashboard/pxpipe/__PAGE__.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/pxpipe.segments/!KGRhc2hib2FyZCk/dashboard/pxpipe.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/pxpipe.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/pxpipe.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/pxpipe.segments/_full.segment.rsc +5 -5
- package/cli/app/.next-cli-build/server/app/dashboard/pxpipe.segments/_head.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/pxpipe.segments/_index.segment.rsc +3 -3
- package/cli/app/.next-cli-build/server/app/dashboard/pxpipe.segments/_tree.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/quota.html +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/quota.rsc +6 -6
- package/cli/app/.next-cli-build/server/app/dashboard/quota.segments/!KGRhc2hib2FyZCk/dashboard/quota/__PAGE__.segment.rsc +3 -3
- package/cli/app/.next-cli-build/server/app/dashboard/quota.segments/!KGRhc2hib2FyZCk/dashboard/quota.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/quota.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/quota.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/quota.segments/_full.segment.rsc +6 -6
- package/cli/app/.next-cli-build/server/app/dashboard/quota.segments/_head.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/quota.segments/_index.segment.rsc +3 -3
- package/cli/app/.next-cli-build/server/app/dashboard/quota.segments/_tree.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/settings/pricing/page_client-reference-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/settings/pricing.html +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/settings/pricing.rsc +3 -3
- package/cli/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/_full.segment.rsc +3 -3
- package/cli/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/_head.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/_index.segment.rsc +3 -3
- package/cli/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/_tree.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/dashboard/settings/pricing/__PAGE__.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/dashboard/settings/pricing.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/dashboard/settings.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/dashboard.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/token-saver.html +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/token-saver.rsc +5 -5
- package/cli/app/.next-cli-build/server/app/dashboard/token-saver.segments/!KGRhc2hib2FyZCk/dashboard/token-saver/__PAGE__.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/token-saver.segments/!KGRhc2hib2FyZCk/dashboard/token-saver.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/token-saver.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/token-saver.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/token-saver.segments/_full.segment.rsc +5 -5
- package/cli/app/.next-cli-build/server/app/dashboard/token-saver.segments/_head.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/token-saver.segments/_index.segment.rsc +3 -3
- package/cli/app/.next-cli-build/server/app/dashboard/token-saver.segments/_tree.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/translator.html +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/translator.rsc +5 -5
- package/cli/app/.next-cli-build/server/app/dashboard/translator.segments/!KGRhc2hib2FyZCk/dashboard/translator/__PAGE__.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/translator.segments/!KGRhc2hib2FyZCk/dashboard/translator.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/translator.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/translator.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/translator.segments/_full.segment.rsc +5 -5
- package/cli/app/.next-cli-build/server/app/dashboard/translator.segments/_head.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/translator.segments/_index.segment.rsc +3 -3
- package/cli/app/.next-cli-build/server/app/dashboard/translator.segments/_tree.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/usage.html +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/usage.rsc +5 -5
- package/cli/app/.next-cli-build/server/app/dashboard/usage.segments/!KGRhc2hib2FyZCk/dashboard/usage/__PAGE__.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/usage.segments/!KGRhc2hib2FyZCk/dashboard/usage.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/usage.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/usage.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/usage.segments/_full.segment.rsc +5 -5
- package/cli/app/.next-cli-build/server/app/dashboard/usage.segments/_head.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/usage.segments/_index.segment.rsc +3 -3
- package/cli/app/.next-cli-build/server/app/dashboard/usage.segments/_tree.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard.html +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard.rsc +5 -5
- package/cli/app/.next-cli-build/server/app/dashboard.segments/!KGRhc2hib2FyZCk/dashboard/__PAGE__.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard.segments/_full.segment.rsc +5 -5
- package/cli/app/.next-cli-build/server/app/dashboard.segments/_head.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard.segments/_index.segment.rsc +3 -3
- package/cli/app/.next-cli-build/server/app/dashboard.segments/_tree.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/index.html +1 -1
- package/cli/app/.next-cli-build/server/app/index.rsc +3 -3
- package/cli/app/.next-cli-build/server/app/index.segments/__PAGE__.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/index.segments/_full.segment.rsc +3 -3
- package/cli/app/.next-cli-build/server/app/index.segments/_head.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/index.segments/_index.segment.rsc +3 -3
- package/cli/app/.next-cli-build/server/app/index.segments/_tree.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/landing/page_client-reference-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/app/landing.html +1 -1
- package/cli/app/.next-cli-build/server/app/landing.rsc +3 -3
- package/cli/app/.next-cli-build/server/app/landing.segments/_full.segment.rsc +3 -3
- package/cli/app/.next-cli-build/server/app/landing.segments/_head.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/landing.segments/_index.segment.rsc +3 -3
- package/cli/app/.next-cli-build/server/app/landing.segments/_tree.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/landing.segments/landing/__PAGE__.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/landing.segments/landing.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/login/page_client-reference-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/app/login.html +1 -1
- package/cli/app/.next-cli-build/server/app/login.rsc +4 -4
- package/cli/app/.next-cli-build/server/app/login.segments/_full.segment.rsc +4 -4
- package/cli/app/.next-cli-build/server/app/login.segments/_head.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/login.segments/_index.segment.rsc +3 -3
- package/cli/app/.next-cli-build/server/app/login.segments/_tree.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/login.segments/login/__PAGE__.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/login.segments/login.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/page_client-reference-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/app-paths-manifest.json +6 -6
- package/cli/app/.next-cli-build/server/chunks/1939.js +1 -1
- package/cli/app/.next-cli-build/server/chunks/3155.js +1 -1
- package/cli/app/.next-cli-build/server/chunks/3407.js +1 -1
- package/cli/app/.next-cli-build/server/chunks/412.js +1 -1
- package/cli/app/.next-cli-build/server/chunks/4746.js +1 -1
- package/cli/app/.next-cli-build/server/chunks/6457.js +1 -1
- package/cli/app/.next-cli-build/server/chunks/6896.js +1 -1
- package/cli/app/.next-cli-build/server/chunks/915.js +1 -1
- package/cli/app/.next-cli-build/server/middleware-build-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/pages/404.html +1 -1
- package/cli/app/.next-cli-build/server/pages/500.html +1 -1
- package/cli/app/.next-cli-build/static/chunks/{3702-962a084bda90238f.js → 3702-dca59cfcf6b6a6f0.js} +1 -1
- package/cli/app/.next-cli-build/static/chunks/5497-cd29d71de5a0d443.js +7 -0
- package/cli/app/CHANGELOG.md +16 -0
- package/cli/app/package.json +1 -1
- package/cli/app/src/mitm/server.js +3 -1
- package/cli/package.json +1 -1
- package/package.json +1 -1
- package/src/app/(dashboard)/dashboard/usage/components/ProviderTopology.js +1 -1
- package/src/app/api/cli-tools/opencode-settings/route.js +1 -1
- package/src/app/api/models/route.js +9 -5
- package/src/lib/db/repos/usageRepo.js +1 -1
- package/src/lib/tunnel/cloudflare/cloudflared.js +12 -1
- package/src/mitm/handlers/kiro.js +8 -1
- package/src/mitm/manager.js +7 -1
- package/cli/app/.next-cli-build/static/chunks/5497-eb7497d94439c4c1.js +0 -7
- /package/cli/app/.next-cli-build/static/{vT4VEIlvTRBiBLb9aTism → hGbEcU9gp0vik5yxr3nd8}/_buildManifest.js +0 -0
- /package/cli/app/.next-cli-build/static/{vT4VEIlvTRBiBLb9aTism → hGbEcU9gp0vik5yxr3nd8}/_ssgManifest.js +0 -0
|
@@ -4,4 +4,4 @@
|
|
|
4
4
|
`,children:[s.includes(a.name)&&(0,d.jsx)("span",{className:"material-symbols-outlined leading-none",style:{fontSize:"10px"},children:"check"}),a.name]},a.id)})})]}),Object.entries(I).map(([a,b])=>(0,d.jsxs)("div",{children:[(0,d.jsxs)("div",{className:"flex items-center gap-1.5 mb-1.5 sticky top-0 bg-surface py-0.5",children:[(0,d.jsx)(i.A,{src:`/providers/${a}.png`,alt:b.name,size:14,fallbackText:(b.name||a).slice(0,2).toUpperCase(),fallbackColor:b.color}),(0,d.jsx)("span",{className:"text-xs font-medium text-primary",children:b.name}),(0,d.jsxs)("span",{className:"text-[10px] text-text-muted",children:["(",b.models.length,")"]})]}),(0,d.jsx)("div",{className:"flex flex-wrap gap-1.5",children:b.models.map(a=>{let b=g===a.value,c=a.isPlaceholder;return(0,d.jsx)("button",{onClick:()=>J(a),title:c?"Select to pre-fill, then edit model ID in the input":void 0,className:`
|
|
5
5
|
px-2 py-1 rounded-xl text-xs font-medium transition-all border hover:cursor-pointer
|
|
6
6
|
${c?"border-dashed border-border text-text-muted hover:border-primary/50 hover:text-primary bg-surface italic":b?"bg-primary text-white border-primary":s.includes(a.value)?"bg-primary border-primary text-white hover:bg-primary-hover":"bg-surface border-border text-text-main hover:border-primary/50 hover:bg-primary/5"}
|
|
7
|
-
`,children:(0,d.jsxs)("span",{className:"flex items-center gap-1",children:[s.includes(a.value)&&!c&&(0,d.jsx)("span",{className:"material-symbols-outlined leading-none",style:{fontSize:"10px"},children:"check"}),c?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[11px]",children:"edit"}),a.name]}):a.isCustom?(0,d.jsxs)(d.Fragment,{children:[a.name,(0,d.jsx)("span",{className:"text-[9px] opacity-60 font-normal",children:"custom"})]}):a.name]})},a.value)})})]},a)),0===Object.keys(I).length&&0===H.length&&(0,d.jsxs)("div",{className:"text-center py-4 text-text-muted",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-2xl mb-1 block",children:"search_off"}),(0,d.jsx)("p",{className:"text-xs",children:"No models found"})]})]})]})}n.propTypes={isOpen:g().bool.isRequired,onClose:g().func.isRequired,onSelect:g().func.isRequired,onDeselect:g().func,selectedModel:g().string,activeProviders:g().arrayOf(g().shape({provider:g().string.isRequired})),title:g().string,modelAliases:g().object,kindFilter:g().string,addedModelValues:g().arrayOf(g().string),closeOnSelect:g().bool}},83552:(a,b,c)=>{c.d(b,{default:()=>f});var d=c(48249),e=c(71404);function f({label:a,type:b="text",placeholder:c,value:g,onChange:h,error:i,hint:j,icon:k,disabled:l=!1,required:m=!1,className:n,inputClassName:o,...p}){return(0,d.jsxs)("div",{className:(0,e.cn)("flex flex-col gap-1.5",n),children:[a&&(0,d.jsxs)("label",{className:"text-sm font-medium text-text-main",children:[a,m&&(0,d.jsx)("span",{className:"text-red-500 ml-1",children:"*"})]}),(0,d.jsxs)("div",{className:"relative",children:[k&&(0,d.jsx)("div",{className:"absolute inset-y-0 left-0 flex items-center pl-3 pointer-events-none text-text-muted",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-[20px]",children:k})}),(0,d.jsx)("input",{type:b,placeholder:c,value:g,onChange:h,disabled:l,className:(0,e.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",k&&"pl-10",i&&"ring-1 ring-red-500 focus:ring-2 focus:ring-red-500/40 border-red-500/40",o),...p})]}),i&&(0,d.jsxs)("p",{className:"text-xs text-red-500 flex items-center gap-1",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"error"}),i]}),j&&!i&&(0,d.jsx)("p",{className:"text-xs text-text-muted",children:j})]})}},85158:(a,b,c)=>{c.d(b,{default:()=>g});var d=c(48249),e=c(71404),f=c(99070);function g({currentPage:a,pageSize:b,totalItems:c,onPageChange:h,onPageSizeChange:i,className:j}){let k=Math.ceil(c/b),l=c>0?(a-1)*b+1:0,m=Math.min(a*b,c),n=(()=>{let b=[],c=Math.max(1,a-2),d=Math.min(k,c+5-1);d-c+1<5&&(c=Math.max(1,d-5+1));for(let a=c;a<=d;a++)b.push(a);return b})();return(0,d.jsxs)("div",{className:(0,e.cn)("flex flex-col sm:flex-row items-center justify-between gap-4 py-4 px-2",j),children:[c>0&&(0,d.jsxs)("div",{className:"text-sm text-text-muted",children:["Showing ",(0,d.jsx)("span",{className:"font-medium text-text-main",children:l})," to"," ",(0,d.jsx)("span",{className:"font-medium text-text-main",children:m})," of"," ",(0,d.jsx)("span",{className:"font-medium text-text-main",children:c})," results"]}),(0,d.jsxs)("div",{className:"flex flex-wrap items-center justify-center gap-2 sm:gap-4",children:[i&&(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)("span",{className:"text-sm text-text-muted",children:"Rows:"}),(0,d.jsx)("select",{value:b,onChange:a=>i(Number(a.target.value)),className:(0,e.cn)("h-9 rounded-lg border border-black/10 dark:border-white/10 bg-surface","text-sm text-text-main focus:outline-none focus:ring-2 focus:ring-primary/20","cursor-pointer"),style:{colorScheme:"auto"},children:[10,20,50].map(a=>(0,d.jsx)("option",{value:a,children:a},a))})]}),k>1&&(0,d.jsxs)("div",{className:"flex items-center gap-1",children:[(0,d.jsx)(f.default,{variant:"outline",size:"sm",onClick:()=>h(a-1),disabled:1===a,className:"w-9 px-0",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"chevron_left"})}),n[0]>1&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(f.default,{variant:"ghost",size:"sm",onClick:()=>h(1),className:"w-9 px-0 hidden sm:inline-flex",children:"1"}),n[0]>2&&(0,d.jsx)("span",{className:"text-text-muted px-1 hidden sm:inline",children:"..."})]}),n.map(b=>(0,d.jsx)(f.default,{variant:a===b?"primary":"ghost",size:"sm",onClick:()=>h(b),className:(0,e.cn)("w-9 px-0",a===b?"inline-flex":"hidden sm:inline-flex"),children:b},b)),n[n.length-1]<k&&(0,d.jsxs)(d.Fragment,{children:[n[n.length-1]<k-1&&(0,d.jsx)("span",{className:"text-text-muted px-1 hidden sm:inline",children:"..."}),(0,d.jsx)(f.default,{variant:"ghost",size:"sm",onClick:()=>h(k),className:"w-9 px-0 hidden sm:inline-flex",children:k})]}),(0,d.jsx)(f.default,{variant:"outline",size:"sm",onClick:()=>h(a+1),disabled:a===k,className:"w-9 px-0",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"chevron_right"})})]})]})]})}},85306:(a,b,c)=>{c.d(b,{default:()=>j});var d=c(48249),e=c(67484),f=c(19099),g=c(41371),h=c(42196),i=c(32456);function j({children:a}){let[b,c]=(0,e.useState)(!1),k=(0,f.usePathname)(),l=(0,g.i)(a=>a.notifications),m=(0,g.i)(a=>a.removeNotification),n="/dashboard/playground"===k||"/dashboard/basic-chat"===k,o="/dashboard/terminal"===k,p=n||o;return(0,d.jsxs)("div",{className:"flex h-screen w-full overflow-hidden bg-bg",children:[(0,d.jsx)("div",{className:"fixed top-4 right-4 z-[80] flex w-[min(92vw,380px)] flex-col gap-2",children:l.map(a=>{var b;let c="success"===(b=a.type)?{wrapper:"border-green-500/30 bg-green-500/10 text-green-600 dark:text-green-400",icon:"check_circle"}:"error"===b?{wrapper:"border-red-500/30 bg-red-500/10 text-red-600 dark:text-red-400",icon:"error"}:"warning"===b?{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,d.jsx)("div",{className:`rounded-lg border px-3 py-2 shadow-lg backdrop-blur-sm ${c.wrapper}`,children:(0,d.jsxs)("div",{className:"flex items-start gap-2",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[18px] leading-5",children:c.icon}),(0,d.jsxs)("div",{className:"min-w-0 flex-1",children:[a.title?(0,d.jsx)("p",{className:"text-xs font-semibold mb-0.5",children:a.title}):null,(0,d.jsx)("p",{className:"text-xs whitespace-pre-wrap break-words",children:a.message})]}),a.dismissible?(0,d.jsx)("button",{type:"button",onClick:()=>m(a.id),className:"text-current/70 hover:text-current","aria-label":"Dismiss notification",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"close"})}):null]})},a.id)})}),b&&(0,d.jsx)("div",{className:"fixed inset-0 z-40 bg-black/20 lg:hidden",onClick:()=>c(!1)}),(0,d.jsx)("div",{className:"hidden lg:flex",children:(0,d.jsx)(h.default,{})}),(0,d.jsx)("div",{className:`fixed inset-y-0 left-0 z-50 transform lg:hidden transition-transform duration-300 ease-in-out ${b?"translate-x-0":"-translate-x-full"}`,children:(0,d.jsx)(h.default,{onClose:()=>c(!1)})}),(0,d.jsxs)("main",{className:"flex flex-col flex-1 h-full min-w-0 relative transition-colors duration-300 isolate",children:[(0,d.jsx)("div",{className:"landing-grid absolute inset-0 pointer-events-none -z-10","aria-hidden":"true"}),p?(0,d.jsxs)("div",{className:"lg:hidden shrink-0 flex items-center gap-2 px-3 py-2 border-b border-border-subtle bg-surface/60",children:[(0,d.jsx)("button",{type:"button",onClick:()=>c(!0),className:"text-text-main","aria-label":"Open menu",children:(0,d.jsx)("span",{className:"material-symbols-outlined",children:"menu"})}),(0,d.jsx)("span",{className:"text-sm font-semibold",children:o?"Terminal":"Playground"})]}):(0,d.jsx)(i.default,{onMenuClick:()=>c(!0)},k),(0,d.jsx)("div",{className:`flex-1 overflow-y-auto custom-scrollbar ${p?"":"p-6 lg:p-10"} ${p?"flex flex-col overflow-hidden":""}`,children:(0,d.jsx)("div",{className:`${p?"flex-1 w-full h-full flex flex-col min-h-0":"max-w-7xl mx-auto"}`,children:a})})]})]})}},86209:(a,b,c)=>{c.d(b,{default:()=>n});var d=c(48249),e=c(67484),f=c(81220),g=c(49885),h=c.n(g),i=c(50412);function j(a){return["completed","cancelled","failed"].includes(a)}function k(a){return a?a.replaceAll("_"," "):"waiting"}function l(a){if(!a)return"--:--:--";try{return new Date(a).toLocaleTimeString("id-ID",{hour:"2-digit",minute:"2-digit",second:"2-digit"})}catch{return a}}function m({status:a}){let b={queued:"bg-slate-100 text-slate-700 dark:bg-slate-800 dark:text-slate-200",running:"bg-blue-100 text-blue-700 dark:bg-blue-900/40 dark:text-blue-300",success:"bg-green-100 text-green-700 dark:bg-green-900/40 dark:text-green-300",failed:"bg-red-100 text-red-700 dark:bg-red-900/40 dark:text-red-300",failed_invalid_credentials:"bg-red-100 text-red-700 dark:bg-red-900/40 dark:text-red-300",failed_exchange:"bg-red-100 text-red-700 dark:bg-red-900/40 dark:text-red-300",failed_timeout:"bg-red-100 text-red-700 dark:bg-red-900/40 dark:text-red-300",needs_manual:"bg-amber-100 text-amber-700 dark:bg-amber-900/40 dark:text-amber-300",cancelled:"bg-slate-100 text-slate-700 dark:bg-slate-800 dark:text-slate-200"};return(0,d.jsx)("span",{className:`rounded-full px-2 py-1 text-[11px] font-medium ${b[a]||b.queued}`,children:a.replaceAll("_"," ")})}function n({isOpen:a,onMethodSelect:b,onImportSuccess:c,onClose:g,initialJobId:h,initialSelectedMethod:o,initialImportMode:p,initialFlowKey:q,onBulkJobChange:r}){let[s,t]=(0,e.useState)(null),[u,v]=(0,e.useState)(""),[w,x]=(0,e.useState)("us-east-1"),[y,z]=(0,e.useState)(""),[A,B]=(0,e.useState)("single-token"),[C,D]=(0,e.useState)(""),[E,F]=(0,e.useState)(String(4)),[G,H]=(0,e.useState)(null),[I,J]=(0,e.useState)(null),[K,L]=(0,e.useState)(null),[M,N]=(0,e.useState)(null),[O,P]=(0,e.useState)(!1),[Q,R]=(0,e.useState)(!1),[S,T]=(0,e.useState)(!1),U=(0,e.useRef)(new Set),V=(0,e.useRef)(0),W=a&&h||null,X=s||(W?"import":null),Y="import"===X&&W&&!s?"bulk-account":A,Z="bulk-account"===Y&&I&&!j(I.status),$="bulk-account"===Y&&I&&j(I.status),_=(0,e.useMemo)(()=>I?.summary?[["Total",I.summary.total],["Queued",I.summary.queued],["Running",I.summary.running],["Success",I.summary.success],["Failed",I.summary.failed],["Manual",I.summary.needs_manual]]:[],[I]),aa=(0,e.useMemo)(()=>Array.isArray(I?.activity)?[...I.activity].reverse():[],[I]),ab=(0,e.useMemo)(()=>(function(a=[]){let b=new Map;return a.forEach(a=>{let c=a.status||"queued";b.has(c)||b.set(c,[]),b.get(c).push(a)}),["running","queued","needs_manual","success","failed","failed_invalid_credentials","failed_exchange","failed_timeout","cancelled"].filter(a=>b.has(a)).map(a=>({status:a,accounts:b.get(a)}))})(I?.accounts||[]),[I]),ac=(0,e.useMemo)(()=>I?.accounts?.length?I.accounts.find(a=>"running"===a.status)||I.accounts.find(a=>"needs_manual"===a.status)||I.accounts.find(a=>"success"===a.status)||I.accounts[0]:null,[I]),ad=a=>{t(a),L(null)},ae=()=>{z(""),D(""),H(null),F(String(4)),L(null),N(null),T(!1),J(null),V.current=0,r?.(null)},af=()=>{Z?g?.():(t(null),B("single-token"),ae())},ag=async()=>{if(!y.trim())return void L("Please enter a refresh token");P(!0),L(null);try{let a=await fetch("/api/oauth/kiro/import",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({mode:"token",refreshToken:y.trim()})}),b=await a.json();if(!a.ok)throw Error(b.error||"Import failed");c?.()}catch(a){L(a.message)}finally{P(!1)}},ah=async a=>{let b=await fetch("/api/oauth/kiro/import",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({mode:"token",refreshTokens:a})}),d=await b.json();if(!b.ok)throw Error(d.error||"Bulk import failed");H({success:d.imported||0,failed:d.failed||0}),c?.()},ai=async a=>{let b=await fetch("/api/oauth/kiro/bulk-import",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({accounts:a,concurrency:Number.parseInt(E,10)||4})}),c=await b.json();if(!b.ok){let a=Array.isArray(c.invalidLines)&&c.invalidLines.length>0?` Invalid lines: ${c.invalidLines.join(", ")}`:"";throw Error((c.error||"Bulk account import failed")+a)}J(c.job||null),N(null),c.job?.jobId&&U.current.delete(c.job.jobId),H(null)},aj=async()=>{let a=C.split("\n").map(a=>a.trim()).filter(Boolean);if(!a.length)return void L("bulk-account"===Y?"Please enter at least one gmail|password line":"Please enter at least one refresh token line");P(!0),L(null),H(null);try{"bulk-account"===Y?await ai(a):await ah(a)}catch(a){L(a.message)}finally{P(!1)}},ak=async()=>{if(I?.jobId)try{let a=await fetch(`/api/oauth/kiro/bulk-import/${I.jobId}/cancel`,{method:"POST"}),b=await a.json();if(!a.ok)throw Error(b.error||"Failed to cancel job");b.job&&J(b.job)}catch(a){L(a.message)}},al=()=>{ae(),c?.()},am=async a=>{if(I?.jobId&&a)try{let b=await fetch(`/api/oauth/kiro/bulk-import/${I.jobId}/manual/${a}`,{method:"POST"}),c=await b.json();if(!b.ok)throw Error(c.error||"Failed to open manual session");c.job&&J(c.job)}catch(a){L(a.message)}},an=a=>{b("social",{provider:a})};return(0,d.jsx)(i.aF,{isOpen:a,title:"Connect Kiro",onClose:g,size:"full",className:"max-w-[min(96vw,1540px)]",children:(0,d.jsxs)("div",{className:"flex flex-col gap-4",children:[!X&&(0,d.jsxs)("div",{className:"space-y-3",children:[(0,d.jsx)("p",{className:"mb-4 text-sm text-text-muted",children:"Choose your authentication method:"}),(0,d.jsx)("button",{onClick:()=>b("builder-id"),className:"w-full rounded-lg border border-border p-4 text-left transition-colors hover:bg-sidebar",children:(0,d.jsxs)("div",{className:"flex items-start gap-3",children:[(0,d.jsx)("span",{className:"material-symbols-outlined mt-0.5 text-primary",children:"shield"}),(0,d.jsxs)("div",{className:"flex-1",children:[(0,d.jsx)("h3",{className:"mb-1 font-semibold",children:"AWS Builder ID"}),(0,d.jsx)("p",{className:"text-sm text-text-muted",children:"Recommended for most users. Free AWS account required."})]})]})}),(0,d.jsx)("button",{onClick:()=>ad("idc"),className:"w-full rounded-lg border border-border p-4 text-left transition-colors hover:bg-sidebar",children:(0,d.jsxs)("div",{className:"flex items-start gap-3",children:[(0,d.jsx)("span",{className:"material-symbols-outlined mt-0.5 text-primary",children:"business"}),(0,d.jsxs)("div",{className:"flex-1",children:[(0,d.jsx)("h3",{className:"mb-1 font-semibold",children:"AWS IAM Identity Center"}),(0,d.jsx)("p",{className:"text-sm text-text-muted",children:"For enterprise users with custom AWS IAM Identity Center."})]})]})}),(0,d.jsx)("button",{onClick:()=>ad("social-google"),className:"hidden w-full rounded-lg border border-border p-4 text-left transition-colors hover:bg-sidebar",children:(0,d.jsxs)("div",{className:"flex items-start gap-3",children:[(0,d.jsx)("span",{className:"material-symbols-outlined mt-0.5 text-primary",children:"account_circle"}),(0,d.jsxs)("div",{className:"flex-1",children:[(0,d.jsx)("h3",{className:"mb-1 font-semibold",children:"Google Account"}),(0,d.jsx)("p",{className:"text-sm text-text-muted",children:"Login with your Google account (manual callback)."})]})]})}),(0,d.jsx)("button",{onClick:()=>ad("social-github"),className:"hidden w-full rounded-lg border border-border p-4 text-left transition-colors hover:bg-sidebar",children:(0,d.jsxs)("div",{className:"flex items-start gap-3",children:[(0,d.jsx)("span",{className:"material-symbols-outlined mt-0.5 text-primary",children:"code"}),(0,d.jsxs)("div",{className:"flex-1",children:[(0,d.jsx)("h3",{className:"mb-1 font-semibold",children:"GitHub Account"}),(0,d.jsx)("p",{className:"text-sm text-text-muted",children:"Login with your GitHub account (manual callback)."})]})]})}),(0,d.jsx)("button",{onClick:()=>ad("import"),className:"w-full rounded-lg border border-border p-4 text-left transition-colors hover:bg-sidebar",children:(0,d.jsxs)("div",{className:"flex items-start gap-3",children:[(0,d.jsx)("span",{className:"material-symbols-outlined mt-0.5 text-primary",children:"file_upload"}),(0,d.jsxs)("div",{className:"flex-1",children:[(0,d.jsx)("h3",{className:"mb-1 font-semibold",children:"Bulk Option"}),(0,d.jsx)("p",{className:"text-sm text-text-muted",children:"Import a single token, bulk tokens, or bulk Google accounts."})]})]})})]}),"idc"===X&&(0,d.jsxs)("div",{className:"space-y-4",children:[(0,d.jsxs)("div",{children:[(0,d.jsxs)("label",{className:"mb-2 block text-sm font-medium",children:["IDC Start URL ",(0,d.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,d.jsx)(i.pd,{value:u,onChange:a=>v(a.target.value),placeholder:"https://your-org.awsapps.com/start",className:"font-mono text-sm"}),(0,d.jsx)("p",{className:"mt-1 text-xs text-text-muted",children:"Your organization's AWS IAM Identity Center URL"})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("label",{className:"mb-2 block text-sm font-medium",children:"AWS Region"}),(0,d.jsx)(i.pd,{value:w,onChange:a=>x(a.target.value),placeholder:"us-east-1",className:"font-mono text-sm"}),(0,d.jsx)("p",{className:"mt-1 text-xs text-text-muted",children:"AWS region for your Identity Center (default: us-east-1)"})]}),K&&(0,d.jsx)("p",{className:"text-sm text-red-600",children:K}),(0,d.jsxs)("div",{className:"flex gap-2",children:[(0,d.jsx)(i.$n,{onClick:()=>{u.trim()?b("idc",{startUrl:u.trim(),region:w}):L("Please enter your IDC start URL")},fullWidth:!0,children:"Continue"}),(0,d.jsx)(i.$n,{onClick:af,variant:"ghost",fullWidth:!0,children:"Back"})]})]}),"social-google"===X&&(0,d.jsxs)("div",{className:"space-y-4",children:[(0,d.jsx)("div",{className:"rounded-lg border border-amber-200 bg-amber-50 p-4 dark:border-amber-800 dark:bg-amber-900/20",children:(0,d.jsxs)("div",{className:"flex gap-2",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-amber-600 dark:text-amber-400",children:"info"}),(0,d.jsxs)("div",{className:"flex-1 text-sm",children:[(0,d.jsx)("p",{className:"mb-1 font-medium text-amber-900 dark:text-amber-100",children:"Manual Callback Required"}),(0,d.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,d.jsxs)("div",{className:"flex gap-2",children:[(0,d.jsx)(i.$n,{onClick:()=>an("google"),fullWidth:!0,children:"Continue with Google"}),(0,d.jsx)(i.$n,{onClick:af,variant:"ghost",fullWidth:!0,children:"Back"})]})]}),"social-github"===X&&(0,d.jsxs)("div",{className:"space-y-4",children:[(0,d.jsx)("div",{className:"rounded-lg border border-amber-200 bg-amber-50 p-4 dark:border-amber-800 dark:bg-amber-900/20",children:(0,d.jsxs)("div",{className:"flex gap-2",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-amber-600 dark:text-amber-400",children:"info"}),(0,d.jsxs)("div",{className:"flex-1 text-sm",children:[(0,d.jsx)("p",{className:"mb-1 font-medium text-amber-900 dark:text-amber-100",children:"Manual Callback Required"}),(0,d.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,d.jsxs)("div",{className:"flex gap-2",children:[(0,d.jsx)(i.$n,{onClick:()=>an("github"),fullWidth:!0,children:"Continue with GitHub"}),(0,d.jsx)(i.$n,{onClick:af,variant:"ghost",fullWidth:!0,children:"Back"})]})]}),"import"===X&&(0,d.jsxs)("div",{className:"space-y-4",children:[(0,d.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,d.jsx)(i.$n,{size:"sm",variant:"single-token"===Y?"primary":"ghost",onClick:()=>{B("single-token"),H(null),L(null)},disabled:Z,children:"Single Token"}),(0,d.jsx)(i.$n,{size:"sm",variant:"bulk-token"===Y?"primary":"ghost",onClick:()=>{B("bulk-token"),H(null),L(null)},disabled:Z,children:"Bulk Token"}),(0,d.jsx)(i.$n,{size:"sm",variant:"bulk-account"===Y?"primary":"ghost",onClick:()=>{B("bulk-account"),H(null),L(null)},children:"Bulk Account"})]}),"single-token"===Y&&(0,d.jsxs)(d.Fragment,{children:[Q&&(0,d.jsxs)("div",{className:"py-6 text-center",children:[(0,d.jsx)("div",{className:"mx-auto mb-4 flex size-16 items-center justify-center rounded-full bg-primary/10",children:(0,d.jsx)("span",{className:"material-symbols-outlined animate-spin text-3xl text-primary",children:"progress_activity"})}),(0,d.jsx)("h3",{className:"mb-2 text-lg font-semibold",children:"Auto-detecting token..."}),(0,d.jsx)("p",{className:"text-sm text-text-muted",children:"Reading from AWS SSO cache"})]}),!Q&&(0,d.jsxs)(d.Fragment,{children:[S&&(0,d.jsx)("div",{className:"rounded-lg border border-green-200 bg-green-50 p-3 dark:border-green-800 dark:bg-green-900/20",children:(0,d.jsxs)("div",{className:"flex gap-2",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-green-600 dark:text-green-400",children:"check_circle"}),(0,d.jsx)("p",{className:"text-sm text-green-800 dark:text-green-200",children:"Token auto-detected from Kiro IDE successfully!"})]})}),!S&&!K&&(0,d.jsx)("div",{className:"rounded-lg border border-blue-200 bg-blue-50 p-3 dark:border-blue-800 dark:bg-blue-900/20",children:(0,d.jsxs)("div",{className:"flex gap-2",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-blue-600 dark:text-blue-400",children:"info"}),(0,d.jsx)("p",{className:"text-sm text-blue-800 dark:text-blue-200",children:"Kiro IDE not detected. Please paste your refresh token manually."})]})}),(0,d.jsxs)("div",{children:[(0,d.jsxs)("label",{className:"mb-2 block text-sm font-medium",children:["Refresh Token ",(0,d.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,d.jsx)(i.pd,{value:y,onChange:a=>z(a.target.value),placeholder:"Token will be auto-filled...",className:"font-mono text-sm"})]}),K&&(0,d.jsx)("div",{className:"rounded-lg border border-red-200 bg-red-50 p-3 dark:border-red-800 dark:bg-red-900/20",children:(0,d.jsx)("p",{className:"text-sm text-red-600 dark:text-red-400",children:K})}),(0,d.jsxs)("div",{className:"flex gap-2",children:[(0,d.jsx)(i.$n,{onClick:ag,fullWidth:!0,disabled:O||!y.trim(),children:O?"Importing...":"Import Token"}),(0,d.jsx)(i.$n,{onClick:af,variant:"ghost",fullWidth:!0,children:"Back"})]})]})]}),"bulk-token"===Y&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("div",{className:"rounded-lg border border-blue-200 bg-blue-50 p-3 dark:border-blue-800 dark:bg-blue-900/20",children:(0,d.jsxs)("div",{className:"flex gap-2",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-blue-600 dark:text-blue-400",children:"info"}),(0,d.jsx)("p",{className:"text-sm text-blue-800 dark:text-blue-200",children:"Bulk token import accepts one refresh token per line."})]})}),(0,d.jsxs)("div",{children:[(0,d.jsxs)("label",{className:"mb-2 block text-sm font-medium",children:["Bulk Refresh Tokens ",(0,d.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,d.jsx)("textarea",{value:C,onChange:a=>D(a.target.value),placeholder:"aorAAAAAG...\naorAAAAAG...",className:"min-h-[160px] w-full resize-y rounded-lg border border-border bg-background px-3 py-2 font-mono text-sm focus:outline-none focus:ring-1 focus:ring-primary"}),(0,d.jsx)("p",{className:"mt-1 text-xs text-text-muted",children:"One refresh token per line."})]}),G&&(0,d.jsx)("div",{className:`text-sm font-medium ${G.failed>0?"text-yellow-600 dark:text-yellow-400":"text-green-600 dark:text-green-400"}`,children:`Success: ${G.success} imported${G.failed>0?`, ${G.failed} failed`:""}`}),K&&(0,d.jsx)("div",{className:"rounded-lg border border-red-200 bg-red-50 p-3 dark:border-red-800 dark:bg-red-900/20",children:(0,d.jsx)("p",{className:"text-sm text-red-600 dark:text-red-400",children:K})}),M&&(0,d.jsx)("div",{className:"rounded-lg border border-amber-200 bg-amber-50 p-3 dark:border-amber-800 dark:bg-amber-900/20",children:(0,d.jsx)("p",{className:"text-sm text-amber-700 dark:text-amber-300",children:M})}),(0,d.jsxs)("div",{className:"flex gap-2",children:[(0,d.jsx)(i.$n,{onClick:aj,fullWidth:!0,disabled:O||!C.trim(),children:O?"Importing...":"Import Tokens"}),(0,d.jsx)(i.$n,{onClick:af,variant:"ghost",fullWidth:!0,children:"Back"})]})]}),"bulk-account"===Y&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("div",{className:"rounded-lg border border-blue-200 bg-blue-50 p-3 dark:border-blue-800 dark:bg-blue-900/20",children:(0,d.jsxs)("div",{className:"flex gap-2",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-blue-600 dark:text-blue-400",children:"info"}),(0,d.jsx)("p",{className:"text-sm text-blue-800 dark:text-blue-200",children:"Bulk account import runs Playwright in the background, keeps passwords in memory only, and only needs manual action when Google or Kiro blocks a worker. Recommended worker count for a 24 GB machine: 4."})]})}),!I&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("div",{children:[(0,d.jsxs)("label",{className:"mb-2 block text-sm font-medium",children:["Bulk Accounts ",(0,d.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,d.jsx)("textarea",{value:C,onChange:a=>D(a.target.value),placeholder:"gmail1@example.com|password1\ngmail2@example.com|password2",className:"min-h-[180px] w-full resize-y rounded-lg border border-border bg-background px-3 py-2 font-mono text-sm focus:outline-none focus:ring-1 focus:ring-primary"}),(0,d.jsx)("p",{className:"mt-1 text-xs text-text-muted",children:"One account per line in the format gmail|password."})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("label",{className:"mb-2 block text-sm font-medium",children:"Concurrent Workers"}),(0,d.jsx)(i.pd,{type:"number",min:"1",max:"8",value:E,onChange:a=>F(a.target.value),placeholder:"4"}),(0,d.jsx)("p",{className:"mt-1 text-xs text-text-muted",children:"Default 4. Allowed range: 1 to 8 workers."})]})]}),I&&(0,d.jsxs)("div",{className:"space-y-4 rounded-xl border border-border p-4",children:[(0,d.jsxs)("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[(0,d.jsxs)("div",{children:[(0,d.jsx)("h3",{className:"font-semibold",children:"Bulk Import Job"}),(0,d.jsxs)("p",{className:"text-xs text-text-muted",children:["Job ID: ",(0,d.jsx)("span",{className:"font-mono",children:I.jobId})]}),(0,d.jsxs)("p",{className:"text-xs text-text-muted",children:["Status: ",(0,d.jsx)("span",{className:"font-medium",children:I.status})," | Workers: ",I.concurrency]}),(0,d.jsx)("p",{className:"text-xs text-text-muted",children:"Browser workers run in the background. Close this modal if needed and reopen it later from the provider page with Resume Bulk Progress."})]}),(0,d.jsxs)("div",{className:"flex gap-2",children:[Z&&(0,d.jsx)(i.$n,{size:"sm",variant:"secondary",onClick:ak,children:"Cancel Job"}),$&&(0,d.jsx)(i.$n,{size:"sm",onClick:al,children:"Done & Refresh"})]})]}),(0,d.jsx)("div",{className:"grid grid-cols-2 gap-2 sm:grid-cols-3",children:_.map(([a,b])=>(0,d.jsxs)("div",{className:"rounded-lg bg-sidebar px-3 py-2",children:[(0,d.jsx)("p",{className:"text-[11px] uppercase tracking-wide text-text-muted",children:a}),(0,d.jsx)("p",{className:"text-lg font-semibold",children:b})]},a))}),I.error&&(0,d.jsx)("div",{className:"rounded-lg border border-red-200 bg-red-50 p-3 text-sm text-red-700 dark:border-red-800 dark:bg-red-900/20 dark:text-red-300",children:I.error}),I.summary?.needs_manual>0&&(0,d.jsx)("div",{className:"rounded-lg border border-amber-200 bg-amber-50 p-3 text-sm text-amber-800 dark:border-amber-800 dark:bg-amber-900/20 dark:text-amber-200",children:"Some accounts need manual assist. Open the blocked worker session below, finish the Google or Kiro prompts, and the job will continue updating automatically."}),(0,d.jsxs)("div",{className:"grid gap-4 lg:grid-cols-[minmax(0,7fr)_minmax(320px,3fr)]",children:[(0,d.jsxs)("div",{className:"space-y-4",children:[(0,d.jsxs)("div",{className:"overflow-hidden rounded-xl border border-border bg-sidebar",children:[(0,d.jsxs)("div",{className:"flex flex-col gap-2 border-b border-border px-4 py-3 sm:flex-row sm:items-center sm:justify-between",children:[(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:"text-sm font-semibold",children:"Live Browser Preview"}),(0,d.jsxs)("p",{className:"text-xs text-text-muted",children:[I.preview?.email||ac?.email||"Waiting for worker",I.preview?.workerId?` | Worker ${I.preview.workerId}`:""]})]}),(0,d.jsxs)("div",{className:"text-right text-xs text-text-muted",children:[(0,d.jsx)("p",{children:k(I.preview?.step||ac?.currentStep)}),(0,d.jsxs)("p",{children:["Updated ",l(I.preview?.updatedAt||ac?.updatedAt)]})]})]}),(0,d.jsx)("div",{className:"relative bg-black/90",children:I.preview?.imageData?(0,d.jsx)(f.default,{src:I.preview.imageData,alt:`Live worker preview for ${I.preview.email||"Kiro import"}`,width:1440,height:900,unoptimized:!0,className:"h-[420px] w-full object-contain"}):(0,d.jsxs)("div",{className:"flex h-[420px] flex-col items-center justify-center gap-3 px-6 text-center text-slate-200",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-5xl text-primary/80",children:"browser_updated"}),(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:"text-base font-medium",children:"Preview will appear when a worker opens Google or Kiro"}),(0,d.jsx)("p",{className:"mt-1 text-sm text-slate-400",children:"The import keeps running in the background even if the screenshot is not available yet."})]})]})})]}),(0,d.jsx)("div",{className:"space-y-4",children:ab.map(a=>{var b;let c;return(0,d.jsxs)("div",{className:`rounded-xl border p-4 ${(b=a.status,(c={queued:"border-slate-200 bg-slate-50/80 dark:border-slate-800 dark:bg-slate-900/20",running:"border-blue-200 bg-blue-50/80 dark:border-blue-900/50 dark:bg-blue-950/20",success:"border-green-200 bg-green-50/80 dark:border-green-900/50 dark:bg-green-950/20",failed:"border-red-200 bg-red-50/80 dark:border-red-900/50 dark:bg-red-950/20",failed_invalid_credentials:"border-red-200 bg-red-50/80 dark:border-red-900/50 dark:bg-red-950/20",failed_exchange:"border-red-200 bg-red-50/80 dark:border-red-900/50 dark:bg-red-950/20",failed_timeout:"border-red-200 bg-red-50/80 dark:border-red-900/50 dark:bg-red-950/20",needs_manual:"border-amber-200 bg-amber-50/80 dark:border-amber-900/50 dark:bg-amber-950/20",cancelled:"border-slate-200 bg-slate-50/80 dark:border-slate-800 dark:bg-slate-900/20"})[b]||c.queued)}`,children:[(0,d.jsxs)("div",{className:"mb-3 flex items-center justify-between gap-3",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)(m,{status:a.status}),(0,d.jsx)("p",{className:"text-sm font-semibold capitalize",children:k(a.status)})]}),(0,d.jsxs)("p",{className:"text-xs text-text-muted",children:[a.accounts.length," account",a.accounts.length>1?"s":""]})]}),(0,d.jsx)("div",{className:"grid gap-3 xl:grid-cols-2",children:a.accounts.map(a=>(0,d.jsxs)("div",{className:"rounded-xl border border-border bg-background/80 p-4",children:[(0,d.jsxs)("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-start sm:justify-between",children:[(0,d.jsxs)("div",{className:"min-w-0",children:[(0,d.jsx)("p",{className:"truncate text-sm font-semibold",children:a.email}),(0,d.jsxs)("p",{className:"text-[11px] text-text-muted",children:["Line ",a.line,a.workerId?` | Worker ${a.workerId}`:""," | ",l(a.updatedAt)]})]}),(0,d.jsx)(m,{status:a.status})]}),(0,d.jsxs)("div",{className:"mt-3 rounded-lg border border-border/70 bg-sidebar/70 px-3 py-2",children:[(0,d.jsx)("p",{className:"text-[11px] uppercase tracking-wide text-text-muted",children:"Current Step"}),(0,d.jsx)("p",{className:"mt-1 text-sm font-medium capitalize",children:k(a.currentStep)})]}),a.logs?.length>0&&(0,d.jsx)("div",{className:"mt-3 space-y-2",children:a.logs.slice(-3).reverse().map(a=>(0,d.jsxs)("div",{className:"rounded-lg bg-sidebar/60 px-3 py-2",children:[(0,d.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,d.jsx)("p",{className:"text-xs font-medium capitalize",children:k(a.step)}),(0,d.jsx)("span",{className:"text-[11px] text-text-muted",children:l(a.at)})]}),(0,d.jsx)("p",{className:"mt-1 text-xs text-text-muted",children:a.message})]},a.id))}),a.error&&(0,d.jsx)("p",{className:"mt-3 text-xs text-red-500",children:a.error}),a.manualSessionAvailable&&a.workerId?(0,d.jsxs)("div",{className:"mt-3 flex items-center gap-2",children:[(0,d.jsx)(i.$n,{size:"sm",variant:a.manualSessionOpened?"secondary":"primary",onClick:()=>am(a.workerId),children:a.manualSessionOpened?"Re-open Manual Session":"Open Manual Session"}),(0,d.jsx)("p",{className:"text-[11px] text-text-muted",children:"Open only if this worker is blocked by CAPTCHA, 2FA, or recovery prompts."})]}):null]},`${a.email}-${a.line}`))})]},a.status)})})]}),(0,d.jsxs)("div",{className:"rounded-xl border border-border bg-sidebar/70",children:[(0,d.jsxs)("div",{className:"border-b border-border px-4 py-3",children:[(0,d.jsx)("p",{className:"text-sm font-semibold",children:"Live Activity Log"}),(0,d.jsx)("p",{className:"text-xs text-text-muted",children:"Every worker step is recorded here in near real time."})]}),(0,d.jsxs)("div",{className:"max-h-[720px] space-y-3 overflow-y-auto p-4",children:[0===aa.length&&(0,d.jsx)("div",{className:"rounded-lg bg-background/70 px-3 py-4 text-sm text-text-muted",children:"Waiting for the first worker event..."}),aa.map(a=>(0,d.jsxs)("div",{className:"rounded-lg border border-border/70 bg-background/80 px-3 py-3",children:[(0,d.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,d.jsxs)("div",{className:"min-w-0",children:[(0,d.jsx)("p",{className:"truncate text-sm font-semibold",children:a.email}),(0,d.jsxs)("p",{className:"text-[11px] text-text-muted",children:[a.workerId?`Worker ${a.workerId}`:"Waiting"," | ",k(a.step)]})]}),(0,d.jsx)("span",{className:"shrink-0 text-[11px] text-text-muted",children:l(a.at)})]}),(0,d.jsx)("p",{className:"mt-2 text-xs text-text-muted",children:a.message})]},a.id))]})]})]})]}),K&&(0,d.jsx)("div",{className:"rounded-lg border border-red-200 bg-red-50 p-3 dark:border-red-800 dark:bg-red-900/20",children:(0,d.jsx)("p",{className:"text-sm text-red-600 dark:text-red-400",children:K})}),(0,d.jsxs)("div",{className:"flex gap-2",children:[!I&&(0,d.jsx)(i.$n,{onClick:aj,fullWidth:!0,disabled:O||!C.trim(),children:O?"Starting...":"Start Bulk Import"}),I&&!$&&(0,d.jsx)(i.$n,{onClick:ak,fullWidth:!0,variant:"secondary",disabled:!Z,children:Z?"Cancel Running Job":"Job Stopped"}),$&&(0,d.jsx)(i.$n,{onClick:al,fullWidth:!0,children:"Done & Refresh Connections"}),(0,d.jsx)(i.$n,{onClick:af,variant:"ghost",fullWidth:!0,children:I?"Back":"Cancel"})]})]})]})]})})}m.propTypes={status:h().string.isRequired},n.propTypes={isOpen:h().bool.isRequired,onMethodSelect:h().func.isRequired,onImportSuccess:h().func,initialJobId:h().string,initialSelectedMethod:h().string,initialImportMode:h().string,initialFlowKey:h().oneOfType([h().string,h().number]),onBulkJobChange:h().func,onClose:h().func.isRequired}},87226:(a,b,c)=>{c.d(b,{default:()=>U});var d=c(48249),e=c(67484),f=c(19099),g=c(96919),h=c(75171),i=c(17660),j=c(49885),k=c.n(j);let l=a=>new Intl.NumberFormat().format(a||0);function m({stats:a}){let b,c=a.totalCachedTokens||0,e=a.totalPromptTokens>0?Math.min(100,c/a.totalPromptTokens*100):0;return(0,d.jsxs)("div",{className:"grid min-w-0 grid-cols-1 gap-3 sm:grid-cols-2 md:grid-cols-3 xl:grid-cols-5 sm:gap-4",children:[(0,d.jsxs)(i.default,{className:"flex min-w-0 flex-col gap-1 px-4 py-3",children:[(0,d.jsx)("span",{className:"text-text-muted text-sm uppercase font-semibold",children:"Total Requests"}),(0,d.jsx)("span",{className:"truncate text-2xl font-bold",children:l(a.totalRequests)})]}),(0,d.jsxs)(i.default,{className:"flex min-w-0 flex-col gap-1 px-4 py-3",children:[(0,d.jsx)("span",{className:"text-text-muted text-sm uppercase font-semibold",children:"Total Input Tokens"}),(0,d.jsx)("span",{className:"truncate text-2xl font-bold text-primary",children:l(a.totalPromptTokens)})]}),(0,d.jsxs)(i.default,{className:"flex min-w-0 flex-col gap-1 px-4 py-3",children:[(0,d.jsx)("span",{className:"text-text-muted text-sm uppercase font-semibold",children:"Cached Tokens"}),(0,d.jsx)("span",{className:"truncate text-2xl font-bold text-info",children:l(c)}),(0,d.jsx)("span",{className:"text-[10px] text-text-muted",children:c>0?`${e.toFixed(1)}% of input \xb7 billed at cache rate`:"No cache hits yet"})]}),(0,d.jsxs)(i.default,{className:"flex min-w-0 flex-col gap-1 px-4 py-3",children:[(0,d.jsx)("span",{className:"text-text-muted text-sm uppercase font-semibold",children:"Output Tokens"}),(0,d.jsx)("span",{className:"truncate text-2xl font-bold text-success",children:l(a.totalCompletionTokens)})]}),(0,d.jsxs)(i.default,{className:"flex min-w-0 flex-col gap-1 px-4 py-3",children:[(0,d.jsx)("span",{className:"text-text-muted text-sm uppercase font-semibold",children:"Est. Cost"}),(0,d.jsxs)("span",{className:"truncate text-2xl font-bold text-warning",children:["~",(b=a.totalCost,`$${(b||0).toFixed(2)}`)]}),(0,d.jsx)("span",{className:"text-[10px] text-text-muted",children:"Estimated, not actual billing"})]})]})}m.propTypes={stats:k().object.isRequired};let n=a=>new Intl.NumberFormat().format(a||0),o=a=>`$${(a||0).toFixed(2)}`;function p(a){if(!a)return"Never";let b=Math.floor((Date.now()-new Date(a))/6e4);return b<1?"Just now":b<60?`${b}m ago`:b<1440?`${Math.floor(b/60)}h ago`:new Date(a).toLocaleDateString()}function q({field:a,currentSort:b,currentOrder:c}){return b!==a?(0,d.jsx)("span",{className:"ml-1 opacity-20",children:"↕"}):(0,d.jsx)("span",{className:"ml-1",children:"asc"===c?"↑":"↓"})}function r({item:a,viewMode:b,isSummary:c=!1}){if("tokens"===b){let b=a.cachedTokens;return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("td",{className:"px-6 py-3 text-right text-text-muted",children:c&&void 0===a.promptTokens?"—":n(a.promptTokens)}),(0,d.jsx)("td",{className:"px-6 py-3 text-right text-info",children:null==b?"—":n(b)}),(0,d.jsx)("td",{className:"px-6 py-3 text-right text-text-muted",children:c&&void 0===a.completionTokens?"—":n(a.completionTokens)}),(0,d.jsx)("td",{className:"px-6 py-3 text-right font-medium",children:n(a.totalTokens)})]})}return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("td",{className:"px-6 py-3 text-right text-text-muted",children:c&&void 0===a.inputCost?"—":o(a.inputCost)}),(0,d.jsx)("td",{className:"px-6 py-3 text-right text-text-muted",children:c&&void 0===a.outputCost?"—":o(a.outputCost)}),(0,d.jsx)("td",{className:"px-6 py-3 text-right font-medium text-warning",children:o(a.totalCost||a.cost)})]})}function s({title:a,columns:b,groupedData:c,tableType:f,sortBy:g,sortOrder:h,onToggleSort:j,viewMode:k,storageKey:l,renderDetailCells:m,renderSummaryCells:n,emptyMessage:o}){let[p,t]=(0,e.useState)(new Set),u=(0,e.useCallback)(a=>{t(b=>{let c=new Set(b);return c.has(a)?c.delete(a):c.add(a),c})},[]),v=(0,e.useMemo)(()=>"tokens"===k?[{field:"promptTokens",label:"Input Tokens"},{field:"cachedTokens",label:"Cached"},{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"}],[k]),w=b.length+v.length;return(0,d.jsxs)(i.default,{className:"overflow-hidden",children:[(0,d.jsx)("div",{className:"p-4 border-b border-border bg-bg-subtle/50",children:(0,d.jsx)("h3",{className:"font-semibold",children:a})}),(0,d.jsx)("div",{className:"overflow-x-auto",children:(0,d.jsxs)("table",{className:"w-full text-sm text-left",children:[(0,d.jsx)("thead",{className:"bg-bg-subtle/30 text-text-muted uppercase text-xs",children:(0,d.jsxs)("tr",{children:[b.map(a=>(0,d.jsxs)("th",{className:`px-6 py-3 cursor-pointer hover:bg-bg-subtle/50 ${"right"===a.align?"text-right":""}`,onClick:()=>j(f,a.field),children:[a.label," ",(0,d.jsx)(q,{field:a.field,currentSort:g,currentOrder:h})]},a.field)),v.map(a=>(0,d.jsxs)("th",{className:"px-6 py-3 text-right cursor-pointer hover:bg-bg-subtle/50",onClick:()=>j(f,a.field),children:[a.label," ",(0,d.jsx)(q,{field:a.field,currentSort:g,currentOrder:h})]},a.field))]})}),(0,d.jsxs)("tbody",{className:"divide-y divide-border",children:[c.map(a=>(0,d.jsxs)(e.Fragment,{children:[(0,d.jsxs)("tr",{className:"group-summary cursor-pointer hover:bg-bg-subtle/50 transition-colors",onClick:()=>u(a.groupKey),children:[(0,d.jsx)("td",{className:"px-6 py-3",children:(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)("span",{className:`material-symbols-outlined text-[18px] text-text-muted transition-transform ${p.has(a.groupKey)?"rotate-90":""}`,children:"chevron_right"}),(0,d.jsx)("span",{className:`font-medium transition-colors ${a.summary.pending>0?"text-primary":""}`,children:a.groupKey})]})}),n(a),(0,d.jsx)(r,{item:a.summary,viewMode:k,isSummary:!0})]}),p.has(a.groupKey)&&a.items.map(a=>(0,d.jsxs)("tr",{className:"group-detail hover:bg-bg-subtle/20 transition-colors",children:[m(a),(0,d.jsx)(r,{item:a,viewMode:k})]},`detail-${a.key}`))]},a.groupKey)),0===c.length&&(0,d.jsx)("tr",{children:(0,d.jsx)("td",{colSpan:w,className:"px-6 py-8 text-center text-text-muted",children:o})})]})]})})]})}q.propTypes={field:k().string.isRequired,currentSort:k().string.isRequired,currentOrder:k().string.isRequired},r.propTypes={item:k().object.isRequired,viewMode:k().string.isRequired,isSummary:k().bool},s.propTypes={title:k().string.isRequired,columns:k().arrayOf(k().shape({field:k().string.isRequired,label:k().string.isRequired,align:k().string})).isRequired,groupedData:k().array.isRequired,tableType:k().string.isRequired,sortBy:k().string.isRequired,sortOrder:k().string.isRequired,onToggleSort:k().func.isRequired,viewMode:k().string.isRequired,storageKey:k().string.isRequired,renderDetailCells:k().func.isRequired,renderSummaryCells:k().func.isRequired,emptyMessage:k().string.isRequired};var t=c(96103),u=c(22805);c(71763);let v={padding:.2,duration:200};function w({data:a}){let{label:b,color:c,imageUrl:f,textIcon:g,active:h}=a,[i,j]=(0,e.useState)(!1);return(0,d.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:h?c:"var(--color-border)",boxShadow:h?`0 0 16px ${c}40`:"none",minWidth:"150px"},children:[(0,d.jsx)(t.h7,{type:"target",position:u.yX.Top,id:"top",className:"!bg-transparent !border-0 !w-0 !h-0"}),(0,d.jsx)(t.h7,{type:"target",position:u.yX.Bottom,id:"bottom",className:"!bg-transparent !border-0 !w-0 !h-0"}),(0,d.jsx)(t.h7,{type:"target",position:u.yX.Left,id:"left",className:"!bg-transparent !border-0 !w-0 !h-0"}),(0,d.jsx)(t.h7,{type:"target",position:u.yX.Right,id:"right",className:"!bg-transparent !border-0 !w-0 !h-0"}),(0,d.jsx)("div",{className:"w-8 h-8 rounded-md flex items-center justify-center shrink-0",style:{backgroundColor:`${c}15`},children:i?(0,d.jsx)("span",{className:"text-sm font-bold",style:{color:c},children:g}):(0,d.jsx)("img",{src:f,alt:b,className:"w-6 h-6 rounded-sm object-contain",onError:()=>j(!0)})}),(0,d.jsx)("span",{className:"text-base font-medium truncate",style:{color:h?c:"var(--color-text)"},children:b}),h&&(0,d.jsxs)("span",{className:"relative flex h-2 w-2 shrink-0",children:[(0,d.jsx)("span",{className:"animate-ping absolute inline-flex h-full w-full rounded-full opacity-75",style:{backgroundColor:c}}),(0,d.jsx)("span",{className:"relative inline-flex rounded-full h-2 w-2",style:{backgroundColor:c}})]})]})}function x({data:a}){return(0,d.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,d.jsx)(t.h7,{type:"source",position:u.yX.Top,id:"top",className:"!bg-transparent !border-0 !w-0 !h-0"}),(0,d.jsx)(t.h7,{type:"source",position:u.yX.Bottom,id:"bottom",className:"!bg-transparent !border-0 !w-0 !h-0"}),(0,d.jsx)(t.h7,{type:"source",position:u.yX.Left,id:"left",className:"!bg-transparent !border-0 !w-0 !h-0"}),(0,d.jsx)(t.h7,{type:"source",position:u.yX.Right,id:"right",className:"!bg-transparent !border-0 !w-0 !h-0"}),(0,d.jsx)("img",{src:"/favicon.svg",alt:"ZevaiRouter",className:"w-6 h-6 mr-2"}),(0,d.jsx)("span",{className:"text-sm font-bold text-primary",children:"ZevaiRouter"}),a.activeCount>0&&(0,d.jsx)("span",{className:"ml-2 px-1.5 py-0.5 rounded-full bg-primary text-white text-xs font-bold",children:a.activeCount})]})}w.propTypes={data:k().object.isRequired},x.propTypes={data:k().object.isRequired};let y={provider:w,router:x};function z({providers:a=[],activeRequests:b=[],lastProvider:c="",errorProvider:f=""}){let h=(0,e.useMemo)(()=>b.map(a=>a.provider?.toLowerCase()).filter(Boolean).sort().join(","),[b]),i=c?.toLowerCase()||"",j=f?.toLowerCase()||"",k=(0,e.useMemo)(()=>new Set(h?h.split(","):[]),[h]),l=(0,e.useMemo)(()=>new Set(i?[i]:[]),[i]),m=(0,e.useMemo)(()=>new Set(j?[j]:[]),[j]),n=(0,e.useRef)({}),[o,p]=(0,e.useState)(0),q=(0,e.useMemo)(()=>{let a=Date.now(),b=new Set;for(let c of k){let d=n.current[c];(!d||a-d<6e4)&&b.add(c)}return b},[k,o]),{nodes:r,edges:s}=(0,e.useMemo)(()=>(function(a,b,c,d){let e=a.length,f=Math.max(320,204*e/(2*Math.PI)),h=Math.max(200,.55*f);if(0===e)return{nodes:[{id:"router",type:"router",position:{x:0,y:0},data:{activeCount:0},draggable:!1}],edges:[]};let i=[],j=[];return i.push({id:"router",type:"router",position:{x:-60,y:-22},data:{activeCount:b.size},draggable:!1}),a.forEach((a,k)=>{var l,m;let n,o,p=(l=a.provider,g.Q2[l]||{color:"#6b7280",name:l}),q=b.has(a.provider?.toLowerCase()),r=!q&&c.has(a.provider?.toLowerCase()),s=!q&&d.has(a.provider?.toLowerCase()),t=`provider-${a.provider}`,u={label:(p.name!==a.provider?p.name:null)||a.name||a.provider,color:p.color||"#6b7280",imageUrl:(m=a.provider,`/providers/${m}.png`),textIcon:p.textIcon||(a.provider||"?").slice(0,2).toUpperCase(),active:q},v=-Math.PI/2+2*Math.PI*k/e,w=f*Math.cos(v),x=h*Math.sin(v);Math.abs(v+Math.PI/2)<Math.PI/4||Math.abs(v-3*Math.PI/2)<Math.PI/4?(n="top",o="bottom"):Math.abs(v-Math.PI/2)<Math.PI/4?(n="bottom",o="top"):w>0?(n="right",o="left"):(n="left",o="right"),i.push({id:t,type:"provider",position:{x:w-90,y:x-15},data:u,draggable:!1}),j.push({id:`e-${t}`,source:"router",sourceHandle:n,target:t,targetHandle:o,animated:q,style:(p.color,s?{stroke:"#ef4444",strokeWidth:2.5,opacity:.9}:q?{stroke:"#22c55e",strokeWidth:2.5,opacity:.9}:r?{stroke:"#f59e0b",strokeWidth:2,opacity:.7}:{stroke:"var(--color-border)",strokeWidth:1,opacity:.3})})}),{nodes:i,edges:j}})(a,q,l,m),[a,q,l,m]),u=(0,e.useMemo)(()=>a.map(a=>a.provider).sort().join(","),[a]),w=(0,e.useRef)(null),x=(0,e.useRef)(null),A=(0,e.useCallback)(a=>{w.current=a,setTimeout(()=>a.fitView(v),50)},[]);return(0,d.jsx)("div",{ref:x,className:"h-[320px] w-full min-w-0 rounded-lg border border-border bg-bg-subtle/30 sm:h-[480px]",children:0===a.length?(0,d.jsx)("div",{className:"h-full flex items-center justify-center text-text-muted text-sm",children:"No providers connected"}):(0,d.jsx)(t.Gc,{nodes:r,edges:s,nodeTypes:y,fitView:!0,fitViewOptions:fitOpts,minZoom:.1,maxZoom:2,onInit:A,proOptions:{hideAttribution:!0},panOnDrag:!0,zoomOnScroll:!0,zoomOnPinch:!0,zoomOnDoubleClick:!0,preventScrolling:!1,nodesDraggable:!1,nodesConnectable:!1,elementsSelectable:!1,children:(0,d.jsx)(t.H2,{showInteractive:!1,className:"react-flow-controls-custom"})},u)})}z.propTypes={providers:k().arrayOf(k().shape({id:k().string,provider:k().string,name:k().string})),activeRequests:k().arrayOf(k().shape({provider:k().string,model:k().string,account:k().string})),lastProvider:k().string,errorProvider:k().string};var A=c(48679),B=c(70452),C=c(28946),D=c(22393),E=c(54206),F=c(57570),G=c(44780);let H=a=>a>=1e6?`${(a/1e6).toFixed(1)}M`:a>=1e3?`${(a/1e3).toFixed(1)}K`:String(a||0),I=a=>`$${(a||0).toFixed(4)}`;function J({period:a="7d"}){let[b,c]=(0,e.useState)([]),[f,g]=(0,e.useState)(!0),[h,j]=(0,e.useState)("tokens");(0,e.useCallback)(async()=>{g(!0);try{let b=await fetch(`/api/usage/chart?period=${a}`);if(b.ok){let a=await b.json();c(a)}}catch(a){console.error("Failed to fetch chart data:",a)}finally{g(!1)}},[a]);let k=b.some(a=>a.tokens>0||a.cost>0);return(0,d.jsxs)(i.default,{className:"flex min-w-0 flex-col gap-3 p-3 sm:p-4",children:[(0,d.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,d.jsx)("button",{onClick:()=>j("tokens"),className:`px-3 py-1 rounded-md text-sm font-medium transition-colors ${"tokens"===h?"bg-primary text-white shadow-sm":"text-text-muted hover:text-text hover:bg-bg-hover"}`,children:"Tokens"}),(0,d.jsx)("button",{onClick:()=>j("cost"),className:`px-3 py-1 rounded-md text-sm font-medium transition-colors ${"cost"===h?"bg-primary text-white shadow-sm":"text-text-muted hover:text-text hover:bg-bg-hover"}`,children:"Cost"})]}),f?(0,d.jsx)("div",{className:"h-48 flex items-center justify-center text-text-muted text-sm",children:"Loading..."}):k?(0,d.jsx)(A.u,{width:"100%",height:220,children:(0,d.jsxs)(B.Q,{data:b,margin:{top:4,right:8,left:0,bottom:0},children:[(0,d.jsxs)("defs",{children:[(0,d.jsxs)("linearGradient",{id:"gradTokens",x1:"0",y1:"0",x2:"0",y2:"1",children:[(0,d.jsx)("stop",{offset:"5%",stopColor:"#6366f1",stopOpacity:.25}),(0,d.jsx)("stop",{offset:"95%",stopColor:"#6366f1",stopOpacity:0})]}),(0,d.jsxs)("linearGradient",{id:"gradCost",x1:"0",y1:"0",x2:"0",y2:"1",children:[(0,d.jsx)("stop",{offset:"5%",stopColor:"#f59e0b",stopOpacity:.25}),(0,d.jsx)("stop",{offset:"95%",stopColor:"#f59e0b",stopOpacity:0})]})]}),(0,d.jsx)(C.d,{strokeDasharray:"3 3",strokeOpacity:.1}),(0,d.jsx)(D.W,{dataKey:"label",tick:{fontSize:10,fill:"currentColor",fillOpacity:.5},tickLine:!1,axisLine:!1,interval:"preserveStartEnd"}),(0,d.jsx)(E.h,{tick:{fontSize:10,fill:"currentColor",fillOpacity:.5},tickLine:!1,axisLine:!1,tickFormatter:"tokens"===h?H:I,width:50}),(0,d.jsx)(F.m,{contentStyle:{backgroundColor:"var(--color-bg)",border:"1px solid var(--color-border)",borderRadius:"8px",fontSize:"12px"},formatter:(a,b)=>"tokens"===b?[H(a),"Tokens"]:[I(a),"Cost"]}),"tokens"===h?(0,d.jsx)(G.Gk,{type:"monotone",dataKey:"tokens",stroke:"#6366f1",strokeWidth:2,fill:"url(#gradTokens)",dot:!1,activeDot:{r:4}}):(0,d.jsx)(G.Gk,{type:"monotone",dataKey:"cost",stroke:"#f59e0b",strokeWidth:2,fill:"url(#gradCost)",dot:!1,activeDot:{r:4}})]})}):(0,d.jsx)("div",{className:"h-48 flex items-center justify-center text-text-muted text-sm",children:"No data for this period"})]})}function K({timestamp:a}){let b,[,c]=(0,e.useState)(0);return(0,d.jsx)(d.Fragment,{children:(b=Math.floor((Date.now()-new Date(a))/1e3))<60?`${b}s ago`:b<3600?`${Math.floor(b/60)}m ago`:b<86400?`${Math.floor(b/3600)}h ago`:`${Math.floor(b/86400)}d ago`})}function L({requests:a=[]}){return(0,d.jsxs)(i.default,{className:"flex min-w-0 flex-col overflow-hidden",padding:"sm",style:{height:480},children:[(0,d.jsx)("div",{className:"px-1 py-2 border-b border-border shrink-0",children:(0,d.jsx)("span",{className:"text-xs font-semibold text-text-muted uppercase tracking-wide",children:"Recent Requests"})}),a.length?(0,d.jsx)("div",{className:"flex-1 overflow-y-auto",children:(0,d.jsxs)("table",{className:"w-full min-w-[300px] border-collapse text-xs",children:[(0,d.jsx)("thead",{className:"sticky top-0 bg-bg z-10",children:(0,d.jsxs)("tr",{className:"border-b border-border",children:[(0,d.jsx)("th",{className:"py-1.5 text-left font-semibold text-text-muted w-2"}),(0,d.jsx)("th",{className:"py-1.5 text-left font-semibold text-text-muted",children:"Model"}),(0,d.jsx)("th",{className:"py-1.5 text-right font-semibold text-text-muted whitespace-nowrap",children:"In / Out"}),(0,d.jsx)("th",{className:"py-1.5 text-right font-semibold text-text-muted",children:"When"})]})}),(0,d.jsx)("tbody",{className:"divide-y divide-border/50",children:a.map((a,b)=>{let c=!a.status||"ok"===a.status||"success"===a.status;return(0,d.jsxs)("tr",{className:"hover:bg-bg-subtle transition-colors",children:[(0,d.jsx)("td",{className:"py-1.5",children:(0,d.jsx)("span",{className:`block w-1.5 h-1.5 rounded-full ${c?"bg-success":"bg-error"}`})}),(0,d.jsx)("td",{className:"py-1.5 font-mono truncate max-w-[120px]",title:a.model,children:a.model}),(0,d.jsxs)("td",{className:"py-1.5 text-right whitespace-nowrap",children:[(0,d.jsxs)("span",{className:"text-primary",children:[n(a.promptTokens),"↑"]})," ",(0,d.jsxs)("span",{className:"text-success",children:[n(a.completionTokens),"↓"]})]}),(0,d.jsx)("td",{className:"py-1.5 text-right text-text-muted whitespace-nowrap",children:(0,d.jsx)(K,{timestamp:a.timestamp})})]},b)})})]})}):(0,d.jsx)("div",{className:"flex-1 flex items-center justify-center text-text-muted text-sm",children:"No requests yet."})]})}function M(a,b={},c,d){return Object.entries(a||{}).map(([a,c])=>{let d=(c.promptTokens||0)+(c.completionTokens||0),e=c.cost||0,f=d>0?(c.promptTokens||0)*(e/d):0,g=d>0?(c.completionTokens||0)*(e/d):0;return{...c,key:a,totalTokens:d,totalCost:e,inputCost:f,outputCost:g,pending:b[a]||0}}).sort((a,b)=>{let e=a[c],f=b[c];return("string"==typeof e&&(e=e.toLowerCase()),"string"==typeof f&&(f=f.toLowerCase()),e<f)?"asc"===d?-1:1:e>f?"asc"===d?1:-1:0})}function N(a,b){if(!Array.isArray(a))return[];let c={};return a.forEach(a=>{let d=function(a,b){switch(b){case"rawModel":return a.rawModel||"Unknown Model";case"accountName":return a.accountName||`Account ${a.connectionId?.slice(0,8)}...`||"Unknown Account";case"keyName":return a.keyName||"Unknown Key";case"endpoint":return a.endpoint||"Unknown Endpoint";default:return a[b]||"Unknown"}}(a,b);c[d]||(c[d]={groupKey:d,summary:{requests:0,promptTokens:0,completionTokens:0,cachedTokens:0,totalTokens:0,cost:0,inputCost:0,outputCost:0,lastUsed:null,pending:0},items:[]});let e=c[d].summary;e.requests+=a.requests||0,e.promptTokens+=a.promptTokens||0,e.completionTokens+=a.completionTokens||0,e.cachedTokens+=a.cachedTokens||0,e.totalTokens+=a.totalTokens||0,e.cost+=a.cost||0,e.inputCost+=a.inputCost||0,e.outputCost+=a.outputCost||0,e.pending+=a.pending||0,a.lastUsed&&(!e.lastUsed||new Date(a.lastUsed)>new Date(e.lastUsed))&&(e.lastUsed=a.lastUsed),c[d].items.push(a)}),Object.values(c)}J.propTypes={period:k().string};let O=[{field:"rawModel",label:"Model"},{field:"provider",label:"Provider"},{field:"requests",label:"Requests",align:"right"},{field:"lastUsed",label:"Last Used",align:"right"}],P=[{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"}],Q=[{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"}],R=[{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"}],S=[{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"}],T=[{value:"today",label:"Today"},{value:"24h",label:"24h"},{value:"7d",label:"7D"},{value:"30d",label:"30D"},{value:"60d",label:"60D"}];function U({period:a,setPeriod:b,hidePeriodSelector:c=!1}={}){let g=(0,f.useRouter)(),i=(0,f.useSearchParams)(),j=i.get("sortBy")||"rawModel",k=i.get("sortOrder")||"asc",[l,o]=(0,e.useState)(null),[q,r]=(0,e.useState)(!0),[t,u]=(0,e.useState)(!1),[v,w]=(0,e.useState)("model"),[x,y]=(0,e.useState)("costs"),[A,B]=(0,e.useState)([]),[C,D]=(0,e.useState)("today");(0,e.useRef)(!0);let E=a??C,F=b??D,G=(0,e.useCallback)((a,b)=>{let c=new URLSearchParams(i.toString());c.get("sortBy")===b?c.set("sortOrder","asc"===c.get("sortOrder")?"desc":"asc"):(c.set("sortBy",b),c.set("sortOrder","asc")),g.replace(`?${c.toString()}`,{scroll:!1})},[i,g]),H=(0,e.useMemo)(()=>{if(!l)return null;switch(v){case"model":{let a=l.pending?.byModel||{};return{columns:O,groupedData:N(M(l.byModel,a,j,k),"rawModel"),storageKey:"usage-stats:expanded-models",emptyMessage:"No usage recorded yet.",renderSummaryCells:a=>(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("td",{className:"px-6 py-3 text-text-muted",children:"—"}),(0,d.jsx)("td",{className:"px-6 py-3 text-right",children:n(a.summary.requests)}),(0,d.jsx)("td",{className:"px-6 py-3 text-right text-text-muted whitespace-nowrap",children:p(a.summary.lastUsed)})]}),renderDetailCells:a=>(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("td",{className:`px-6 py-3 font-medium transition-colors ${a.pending>0?"text-primary":""}`,children:a.rawModel}),(0,d.jsx)("td",{className:"px-6 py-3",children:(0,d.jsx)(h.default,{variant:a.pending>0?"primary":"neutral",size:"sm",children:a.provider})}),(0,d.jsx)("td",{className:"px-6 py-3 text-right",children:n(a.requests)}),(0,d.jsx)("td",{className:"px-6 py-3 text-right text-text-muted whitespace-nowrap",children:p(a.lastUsed)})]})}}case"account":{let a={};return l?.pending?.byAccount&&Object.entries(l.byAccount||{}).forEach(([b,c])=>{let d=l.pending.byAccount[c.connectionId];if(d){let e=c.provider?`${c.rawModel} (${c.provider})`:c.rawModel;a[b]=d[e]||0}}),{columns:P,groupedData:N(M(l.byAccount,a,j,k),"accountName"),storageKey:"usage-stats:expanded-accounts",emptyMessage:"No account-specific usage recorded yet.",renderSummaryCells:a=>(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("td",{className:"px-6 py-3 text-text-muted",children:"—"}),(0,d.jsx)("td",{className:"px-6 py-3 text-text-muted",children:"—"}),(0,d.jsx)("td",{className:"px-6 py-3 text-right",children:n(a.summary.requests)}),(0,d.jsx)("td",{className:"px-6 py-3 text-right text-text-muted whitespace-nowrap",children:p(a.summary.lastUsed)})]}),renderDetailCells:a=>(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("td",{className:`px-6 py-3 font-medium transition-colors ${a.pending>0?"text-primary":""}`,children:a.accountName||`Account ${a.connectionId?.slice(0,8)}...`}),(0,d.jsx)("td",{className:`px-6 py-3 font-medium transition-colors ${a.pending>0?"text-primary":""}`,children:a.rawModel}),(0,d.jsx)("td",{className:"px-6 py-3",children:(0,d.jsx)(h.default,{variant:a.pending>0?"primary":"neutral",size:"sm",children:a.provider})}),(0,d.jsx)("td",{className:"px-6 py-3 text-right",children:n(a.requests)}),(0,d.jsx)("td",{className:"px-6 py-3 text-right text-text-muted whitespace-nowrap",children:p(a.lastUsed)})]})}}case"apiKey":return{columns:Q,groupedData:N(M(l.byApiKey,{},j,k),"keyName"),storageKey:"usage-stats:expanded-apikeys",emptyMessage:"No API key usage recorded yet.",renderSummaryCells:a=>(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("td",{className:"px-6 py-3 text-text-muted",children:"—"}),(0,d.jsx)("td",{className:"px-6 py-3 text-text-muted",children:"—"}),(0,d.jsx)("td",{className:"px-6 py-3 text-right",children:n(a.summary.requests)}),(0,d.jsx)("td",{className:"px-6 py-3 text-right text-text-muted whitespace-nowrap",children:p(a.summary.lastUsed)})]}),renderDetailCells:a=>(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("td",{className:"px-6 py-3 font-medium",children:a.keyName}),(0,d.jsx)("td",{className:"px-6 py-3",children:a.rawModel}),(0,d.jsx)("td",{className:"px-6 py-3",children:(0,d.jsx)(h.default,{variant:"neutral",size:"sm",children:a.provider})}),(0,d.jsx)("td",{className:"px-6 py-3 text-right",children:n(a.requests)}),(0,d.jsx)("td",{className:"px-6 py-3 text-right text-text-muted whitespace-nowrap",children:p(a.lastUsed)})]})};default:return{columns:R,groupedData:N(M(l.byEndpoint,{},j,k),"endpoint"),storageKey:"usage-stats:expanded-endpoints",emptyMessage:"No endpoint usage recorded yet.",renderSummaryCells:a=>(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("td",{className:"px-6 py-3 text-text-muted",children:"—"}),(0,d.jsx)("td",{className:"px-6 py-3 text-text-muted",children:"—"}),(0,d.jsx)("td",{className:"px-6 py-3 text-right",children:n(a.summary.requests)}),(0,d.jsx)("td",{className:"px-6 py-3 text-right text-text-muted whitespace-nowrap",children:p(a.summary.lastUsed)})]}),renderDetailCells:a=>(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("td",{className:"px-6 py-3 font-medium font-mono text-sm",children:a.endpoint}),(0,d.jsx)("td",{className:"px-6 py-3",children:a.rawModel}),(0,d.jsx)("td",{className:"px-6 py-3",children:(0,d.jsx)(h.default,{variant:"neutral",size:"sm",children:a.provider})}),(0,d.jsx)("td",{className:"px-6 py-3 text-right",children:n(a.requests)}),(0,d.jsx)("td",{className:"px-6 py-3 text-right text-text-muted whitespace-nowrap",children:p(a.lastUsed)})]})}}},[l,v,j,k]);if(!l&&!q)return(0,d.jsx)("div",{className:"text-text-muted",children:"Failed to load usage statistics."});let I=(0,d.jsx)("div",{className:"flex items-center justify-center py-12 text-text-muted",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-[32px] animate-spin",children:"progress_activity"})});return(0,d.jsxs)("div",{className:"flex min-w-0 flex-col gap-6",children:[!c&&(0,d.jsxs)("div",{className:"flex w-full items-center gap-2 sm:w-auto sm:self-end",children:[(0,d.jsx)("div",{className:"grid flex-1 grid-cols-5 items-center gap-1 rounded-lg border border-border bg-bg-subtle p-1 sm:flex sm:flex-none",children:T.map(a=>(0,d.jsx)("button",{onClick:()=>F(a.value),disabled:t,className:`rounded-md px-3 py-1 text-sm font-medium transition-colors ${E===a.value?"bg-primary text-white shadow-sm":"text-text-muted hover:bg-bg-hover hover:text-text"}`,children:a.label},a.value))}),t&&(0,d.jsx)("span",{className:"material-symbols-outlined text-[16px] text-text-muted animate-spin",children:"progress_activity"})]}),q?I:(0,d.jsx)(m,{stats:l}),q?I:(0,d.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,d.jsx)(z,{providers:A,activeRequests:l.activeRequests||[],lastProvider:l.recentRequests?.[0]?.provider||"",errorProvider:l.errorProvider||""}),(0,d.jsx)(L,{requests:l.recentRequests||[]})]}),q?I:(0,d.jsx)(J,{period:E}),(0,d.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,d.jsxs)("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between",children:[(0,d.jsx)("select",{value:v,onChange:a=>w(a.target.value),className:"w-full rounded-lg border border-border bg-surface px-3 py-1.5 text-sm font-medium text-text-main focus:outline-none focus:ring-2 focus:ring-primary/50 sm:w-auto",style:{colorScheme:"auto"},children:S.map(a=>(0,d.jsx)("option",{value:a.value,children:a.label},a.value))}),(0,d.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,d.jsx)("button",{onClick:()=>y("costs"),className:`px-3 py-1 rounded-md text-sm font-medium transition-colors ${"costs"===x?"bg-primary text-white shadow-sm":"text-text-muted hover:text-text hover:bg-bg-hover"}`,children:"Costs"}),(0,d.jsx)("button",{onClick:()=>y("tokens"),className:`px-3 py-1 rounded-md text-sm font-medium transition-colors ${"tokens"===x?"bg-primary text-white shadow-sm":"text-text-muted hover:text-text hover:bg-bg-hover"}`,children:"Tokens"})]})]}),q?I:H&&(0,d.jsx)(s,{title:"",columns:H.columns,groupedData:H.groupedData,tableType:v,sortBy:j,sortOrder:k,onToggleSort:G,viewMode:x,storageKey:H.storageKey,renderSummaryCells:H.renderSummaryCells,renderDetailCells:H.renderDetailCells,emptyMessage:H.emptyMessage})]})]})}},91099:(a,b,c)=>{c.d(b,{default:()=>f});var d=c(48249),e=c(71404);function f({options:a=[],value:b,onChange:c,size:g="md",className:h}){let i={sm:"h-7 text-xs",md:"h-9 text-sm",lg:"h-11 text-base"};return(0,d.jsx)("div",{className:(0,e.cn)("inline-flex items-center p-1 rounded-[10px] overflow-x-auto","bg-surface-2",h),children:a.map(a=>(0,d.jsxs)("button",{onClick:()=>c(a.value),className:(0,e.cn)("shrink-0 px-4 rounded-[8px] font-medium transition-all",i[g],b===a.value?"bg-surface text-text-main shadow-sm":"text-text-muted hover:text-text-main"),children:[a.icon&&(0,d.jsx)("span",{className:"material-symbols-outlined text-[16px] mr-1.5",children:a.icon}),a.label]},a.value))})}},91809:(a,b,c)=>{c.d(b,{default:()=>g});var d=c(48249),e=c(67484),f=c(17660);function g(){let[a,b]=(0,e.useState)([]),[c,g]=(0,e.useState)(!0),[h,i]=(0,e.useState)(!0);return(0,d.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,d.jsxs)("div",{className:"flex items-center justify-between",children:[(0,d.jsx)("h2",{className:"text-xl font-semibold",children:"Request Logs"}),(0,d.jsx)("div",{className:"flex items-center gap-2",children:(0,d.jsxs)("label",{className:"text-sm font-medium text-text-muted flex items-center gap-2 cursor-pointer",children:[(0,d.jsx)("span",{children:"Auto Refresh (3s)"}),(0,d.jsx)("div",{onClick:()=>i(!h),className:`relative inline-flex h-5 w-9 items-center rounded-full transition-colors focus:outline-none ${h?"bg-primary":"bg-bg-subtle border border-border"}`,children:(0,d.jsx)("span",{className:`inline-block h-3 w-3 transform rounded-full bg-white transition-transform ${h?"translate-x-5":"translate-x-1"}`})})]})})]}),(0,d.jsx)(f.default,{className:"overflow-hidden bg-black/5 dark:bg-black/20",children:(0,d.jsx)("div",{className:"p-0 overflow-x-auto max-h-[600px] overflow-y-auto font-mono text-xs",children:c&&0===a.length?(0,d.jsx)("div",{className:"p-8 text-center text-text-muted",children:"Loading logs..."}):0===a.length?(0,d.jsx)("div",{className:"p-8 text-center text-text-muted",children:"No logs recorded yet."}):(0,d.jsxs)("table",{className:"w-full text-left border-collapse whitespace-nowrap",children:[(0,d.jsx)("thead",{className:"sticky top-0 bg-bg-subtle border-b border-border z-10",children:(0,d.jsxs)("tr",{children:[(0,d.jsx)("th",{className:"px-3 py-2 border-r border-border",children:"DateTime"}),(0,d.jsx)("th",{className:"px-3 py-2 border-r border-border",children:"Model"}),(0,d.jsx)("th",{className:"px-3 py-2 border-r border-border",children:"Provider"}),(0,d.jsx)("th",{className:"px-3 py-2 border-r border-border",children:"Account"}),(0,d.jsx)("th",{className:"px-3 py-2 border-r border-border",children:"In"}),(0,d.jsx)("th",{className:"px-3 py-2 border-r border-border",children:"Out"}),(0,d.jsx)("th",{className:"px-3 py-2",children:"Status"})]})}),(0,d.jsx)("tbody",{className:"divide-y divide-border/50",children:a.map((a,b)=>{let c=a.split(" | ");if(c.length<7)return null;let e=c[6],f=e.includes("PENDING"),g=e.includes("FAILED"),h=e.includes("OK");return(0,d.jsxs)("tr",{className:`hover:bg-primary/5 transition-colors ${f?"bg-primary/5":""}`,children:[(0,d.jsx)("td",{className:"px-3 py-1.5 border-r border-border text-text-muted",children:c[0]}),(0,d.jsx)("td",{className:"px-3 py-1.5 border-r border-border font-medium",children:c[1]}),(0,d.jsx)("td",{className:"px-3 py-1.5 border-r border-border",children:(0,d.jsx)("span",{className:"px-1.5 py-0.5 rounded bg-bg-subtle border border-border text-[10px] uppercase font-bold",children:c[2]})}),(0,d.jsx)("td",{className:"px-3 py-1.5 border-r border-border truncate max-w-[150px]",title:c[3],children:c[3]}),(0,d.jsx)("td",{className:"px-3 py-1.5 border-r border-border text-right text-primary",children:c[4]}),(0,d.jsx)("td",{className:"px-3 py-1.5 border-r border-border text-right text-success",children:c[5]}),(0,d.jsx)("td",{className:`px-3 py-1.5 font-bold ${h?"text-success":g?"text-error":"text-primary animate-pulse"}`,children:e})]},b)})})]})})}),(0,d.jsx)("div",{className:"text-[10px] text-text-muted italic",children:"Logs are loaded from the request history database."})]})}},95145:(a,b,c)=>{c.d(b,{ConfirmModal:()=>i,default:()=>h});var d=c(48249);c(67484);var e=c(71404),f=c(99070),g=c(32971);function h({isOpen:a,onClose:b,title:c,children:f,footer:i,size:j="md",closeOnOverlay:k=!0,showTrafficLights:l=!0,className:m}){return a?(0,d.jsxs)("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4",children:[(0,d.jsx)("div",{className:"absolute inset-0 bg-black/50 backdrop-blur-[2px] fade-in",onClick:k?b:void 0}),(0,d.jsxs)("div",{className:(0,e.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"}[j],m),children:[(c||l)&&(0,d.jsxs)("div",{className:"flex items-center justify-between p-2 border-b border-border-subtle",children:[(0,d.jsxs)("div",{className:"flex items-center",children:[l&&(0,d.jsxs)("div",{className:"hidden md:flex items-center gap-2 mr-4 ml-2",children:[(0,d.jsx)(g.default,{text:"Close",position:"top",color:"#FF5F56",children:(0,d.jsx)("button",{onClick:b,"aria-label":"Close",title:"Close",className:"w-4 h-4 rounded-full bg-[#FF5F56] hover:brightness-90 transition-all cursor-pointer flex items-center justify-center group/dot",children:(0,d.jsx)("span",{className:"text-[9px] font-bold text-white opacity-0 group-hover/dot:opacity-100 transition-opacity leading-none",children:"✕"})})}),(0,d.jsx)("div",{className:"w-4 h-4 rounded-full bg-[#3a3a3a]/20 dark:bg-white/15 cursor-not-allowed"}),(0,d.jsx)("div",{className:"w-4 h-4 rounded-full bg-[#3a3a3a]/20 dark:bg-white/15 cursor-not-allowed"})]}),c&&(0,d.jsx)("h2",{className:"text-lg font-semibold text-text-main",children:c})]}),(0,d.jsx)("button",{onClick:b,"aria-label":"Close",className:"md:hidden p-1.5 rounded-[10px] text-text-muted hover:bg-surface-2 hover:text-text-main transition-colors",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-[20px]",children:"close"})})]}),(0,d.jsx)("div",{className:"p-6 max-h-[calc(85vh-100px)] overflow-y-auto custom-scrollbar",children:f}),i&&(0,d.jsx)("div",{className:"flex items-center justify-end gap-3 p-6 border-t border-border-subtle",children:i})]})]}):null}function i({isOpen:a,onClose:b,onConfirm:c,title:e="Confirm",message:g,confirmText:j="Confirm",cancelText:k="Cancel",variant:l="danger",loading:m=!1}){return(0,d.jsx)(h,{isOpen:a,onClose:b,title:e,size:"sm",footer:(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(f.default,{variant:"ghost",onClick:b,disabled:m,children:k}),(0,d.jsx)(f.default,{variant:l,onClick:c,loading:m,children:j})]}),children:(0,d.jsx)("p",{className:"text-text-muted",children:g})})}},95514:(a,b,c)=>{c.d(b,{default:()=>f});var d=c(48249),e=c(71404);function f({checked:a=!1,onChange:b,label:c,description:g,disabled:h=!1,size:i="md",className:j}){let k={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,d.jsxs)("div",{className:(0,e.cn)("flex items-center gap-3",h&&"opacity-50 cursor-not-allowed",j),children:[(0,d.jsx)("button",{type:"button",role:"switch","aria-checked":a,disabled:h,onClick:()=>{!h&&b&&b(!a)},className:(0,e.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",a?"bg-brand-500":"bg-surface-3",k[i].track,h&&"cursor-not-allowed"),children:(0,d.jsx)("span",{className:(0,e.cn)("pointer-events-none inline-block rounded-full bg-white shadow-sm","transform transition duration-200 ease-in-out",a?k[i].translate:"translate-x-0.5",k[i].thumb,"mt-0.5")})}),(c||g)&&(0,d.jsxs)("div",{className:"flex flex-col",children:[c&&(0,d.jsx)("span",{className:"text-sm font-medium text-text-main",children:c}),g&&(0,d.jsx)("span",{className:"text-xs text-text-muted",children:g})]})]})}},99070:(a,b,c)=>{c.d(b,{default:()=>h});var d=c(48249),e=c(71404);let f={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"},g={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 h({children:a,variant:b="primary",size:c="md",icon:i,iconRight:j,disabled:k=!1,loading:l=!1,fullWidth:m=!1,className:n,...o}){return(0,d.jsxs)("button",{className:(0,e.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",f[b],g[c],m&&"w-full",n),disabled:k||l,...o,children:[l?(0,d.jsx)("span",{className:"material-symbols-outlined animate-spin text-[18px]",children:"progress_activity"}):i?(0,d.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:i}):null,a,j&&!l&&(0,d.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:j})]})}}};
|
|
7
|
+
`,children:(0,d.jsxs)("span",{className:"flex items-center gap-1",children:[s.includes(a.value)&&!c&&(0,d.jsx)("span",{className:"material-symbols-outlined leading-none",style:{fontSize:"10px"},children:"check"}),c?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[11px]",children:"edit"}),a.name]}):a.isCustom?(0,d.jsxs)(d.Fragment,{children:[a.name,(0,d.jsx)("span",{className:"text-[9px] opacity-60 font-normal",children:"custom"})]}):a.name]})},a.value)})})]},a)),0===Object.keys(I).length&&0===H.length&&(0,d.jsxs)("div",{className:"text-center py-4 text-text-muted",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-2xl mb-1 block",children:"search_off"}),(0,d.jsx)("p",{className:"text-xs",children:"No models found"})]})]})]})}n.propTypes={isOpen:g().bool.isRequired,onClose:g().func.isRequired,onSelect:g().func.isRequired,onDeselect:g().func,selectedModel:g().string,activeProviders:g().arrayOf(g().shape({provider:g().string.isRequired})),title:g().string,modelAliases:g().object,kindFilter:g().string,addedModelValues:g().arrayOf(g().string),closeOnSelect:g().bool}},83552:(a,b,c)=>{c.d(b,{default:()=>f});var d=c(48249),e=c(71404);function f({label:a,type:b="text",placeholder:c,value:g,onChange:h,error:i,hint:j,icon:k,disabled:l=!1,required:m=!1,className:n,inputClassName:o,...p}){return(0,d.jsxs)("div",{className:(0,e.cn)("flex flex-col gap-1.5",n),children:[a&&(0,d.jsxs)("label",{className:"text-sm font-medium text-text-main",children:[a,m&&(0,d.jsx)("span",{className:"text-red-500 ml-1",children:"*"})]}),(0,d.jsxs)("div",{className:"relative",children:[k&&(0,d.jsx)("div",{className:"absolute inset-y-0 left-0 flex items-center pl-3 pointer-events-none text-text-muted",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-[20px]",children:k})}),(0,d.jsx)("input",{type:b,placeholder:c,value:g,onChange:h,disabled:l,className:(0,e.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",k&&"pl-10",i&&"ring-1 ring-red-500 focus:ring-2 focus:ring-red-500/40 border-red-500/40",o),...p})]}),i&&(0,d.jsxs)("p",{className:"text-xs text-red-500 flex items-center gap-1",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"error"}),i]}),j&&!i&&(0,d.jsx)("p",{className:"text-xs text-text-muted",children:j})]})}},85158:(a,b,c)=>{c.d(b,{default:()=>g});var d=c(48249),e=c(71404),f=c(99070);function g({currentPage:a,pageSize:b,totalItems:c,onPageChange:h,onPageSizeChange:i,className:j}){let k=Math.ceil(c/b),l=c>0?(a-1)*b+1:0,m=Math.min(a*b,c),n=(()=>{let b=[],c=Math.max(1,a-2),d=Math.min(k,c+5-1);d-c+1<5&&(c=Math.max(1,d-5+1));for(let a=c;a<=d;a++)b.push(a);return b})();return(0,d.jsxs)("div",{className:(0,e.cn)("flex flex-col sm:flex-row items-center justify-between gap-4 py-4 px-2",j),children:[c>0&&(0,d.jsxs)("div",{className:"text-sm text-text-muted",children:["Showing ",(0,d.jsx)("span",{className:"font-medium text-text-main",children:l})," to"," ",(0,d.jsx)("span",{className:"font-medium text-text-main",children:m})," of"," ",(0,d.jsx)("span",{className:"font-medium text-text-main",children:c})," results"]}),(0,d.jsxs)("div",{className:"flex flex-wrap items-center justify-center gap-2 sm:gap-4",children:[i&&(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)("span",{className:"text-sm text-text-muted",children:"Rows:"}),(0,d.jsx)("select",{value:b,onChange:a=>i(Number(a.target.value)),className:(0,e.cn)("h-9 rounded-lg border border-black/10 dark:border-white/10 bg-surface","text-sm text-text-main focus:outline-none focus:ring-2 focus:ring-primary/20","cursor-pointer"),style:{colorScheme:"auto"},children:[10,20,50].map(a=>(0,d.jsx)("option",{value:a,children:a},a))})]}),k>1&&(0,d.jsxs)("div",{className:"flex items-center gap-1",children:[(0,d.jsx)(f.default,{variant:"outline",size:"sm",onClick:()=>h(a-1),disabled:1===a,className:"w-9 px-0",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"chevron_left"})}),n[0]>1&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(f.default,{variant:"ghost",size:"sm",onClick:()=>h(1),className:"w-9 px-0 hidden sm:inline-flex",children:"1"}),n[0]>2&&(0,d.jsx)("span",{className:"text-text-muted px-1 hidden sm:inline",children:"..."})]}),n.map(b=>(0,d.jsx)(f.default,{variant:a===b?"primary":"ghost",size:"sm",onClick:()=>h(b),className:(0,e.cn)("w-9 px-0",a===b?"inline-flex":"hidden sm:inline-flex"),children:b},b)),n[n.length-1]<k&&(0,d.jsxs)(d.Fragment,{children:[n[n.length-1]<k-1&&(0,d.jsx)("span",{className:"text-text-muted px-1 hidden sm:inline",children:"..."}),(0,d.jsx)(f.default,{variant:"ghost",size:"sm",onClick:()=>h(k),className:"w-9 px-0 hidden sm:inline-flex",children:k})]}),(0,d.jsx)(f.default,{variant:"outline",size:"sm",onClick:()=>h(a+1),disabled:a===k,className:"w-9 px-0",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"chevron_right"})})]})]})]})}},85306:(a,b,c)=>{c.d(b,{default:()=>j});var d=c(48249),e=c(67484),f=c(19099),g=c(41371),h=c(42196),i=c(32456);function j({children:a}){let[b,c]=(0,e.useState)(!1),k=(0,f.usePathname)(),l=(0,g.i)(a=>a.notifications),m=(0,g.i)(a=>a.removeNotification),n="/dashboard/playground"===k||"/dashboard/basic-chat"===k,o="/dashboard/terminal"===k,p=n||o;return(0,d.jsxs)("div",{className:"flex h-screen w-full overflow-hidden bg-bg",children:[(0,d.jsx)("div",{className:"fixed top-4 right-4 z-[80] flex w-[min(92vw,380px)] flex-col gap-2",children:l.map(a=>{var b;let c="success"===(b=a.type)?{wrapper:"border-green-500/30 bg-green-500/10 text-green-600 dark:text-green-400",icon:"check_circle"}:"error"===b?{wrapper:"border-red-500/30 bg-red-500/10 text-red-600 dark:text-red-400",icon:"error"}:"warning"===b?{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,d.jsx)("div",{className:`rounded-lg border px-3 py-2 shadow-lg backdrop-blur-sm ${c.wrapper}`,children:(0,d.jsxs)("div",{className:"flex items-start gap-2",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[18px] leading-5",children:c.icon}),(0,d.jsxs)("div",{className:"min-w-0 flex-1",children:[a.title?(0,d.jsx)("p",{className:"text-xs font-semibold mb-0.5",children:a.title}):null,(0,d.jsx)("p",{className:"text-xs whitespace-pre-wrap break-words",children:a.message})]}),a.dismissible?(0,d.jsx)("button",{type:"button",onClick:()=>m(a.id),className:"text-current/70 hover:text-current","aria-label":"Dismiss notification",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"close"})}):null]})},a.id)})}),b&&(0,d.jsx)("div",{className:"fixed inset-0 z-40 bg-black/20 lg:hidden",onClick:()=>c(!1)}),(0,d.jsx)("div",{className:"hidden lg:flex",children:(0,d.jsx)(h.default,{})}),(0,d.jsx)("div",{className:`fixed inset-y-0 left-0 z-50 transform lg:hidden transition-transform duration-300 ease-in-out ${b?"translate-x-0":"-translate-x-full"}`,children:(0,d.jsx)(h.default,{onClose:()=>c(!1)})}),(0,d.jsxs)("main",{className:"flex flex-col flex-1 h-full min-w-0 relative transition-colors duration-300 isolate",children:[(0,d.jsx)("div",{className:"landing-grid absolute inset-0 pointer-events-none -z-10","aria-hidden":"true"}),p?(0,d.jsxs)("div",{className:"lg:hidden shrink-0 flex items-center gap-2 px-3 py-2 border-b border-border-subtle bg-surface/60",children:[(0,d.jsx)("button",{type:"button",onClick:()=>c(!0),className:"text-text-main","aria-label":"Open menu",children:(0,d.jsx)("span",{className:"material-symbols-outlined",children:"menu"})}),(0,d.jsx)("span",{className:"text-sm font-semibold",children:o?"Terminal":"Playground"})]}):(0,d.jsx)(i.default,{onMenuClick:()=>c(!0)},k),(0,d.jsx)("div",{className:`flex-1 overflow-y-auto custom-scrollbar ${p?"":"p-6 lg:p-10"} ${p?"flex flex-col overflow-hidden":""}`,children:(0,d.jsx)("div",{className:`${p?"flex-1 w-full h-full flex flex-col min-h-0":"max-w-7xl mx-auto"}`,children:a})})]})]})}},86209:(a,b,c)=>{c.d(b,{default:()=>n});var d=c(48249),e=c(67484),f=c(81220),g=c(49885),h=c.n(g),i=c(50412);function j(a){return["completed","cancelled","failed"].includes(a)}function k(a){return a?a.replaceAll("_"," "):"waiting"}function l(a){if(!a)return"--:--:--";try{return new Date(a).toLocaleTimeString("id-ID",{hour:"2-digit",minute:"2-digit",second:"2-digit"})}catch{return a}}function m({status:a}){let b={queued:"bg-slate-100 text-slate-700 dark:bg-slate-800 dark:text-slate-200",running:"bg-blue-100 text-blue-700 dark:bg-blue-900/40 dark:text-blue-300",success:"bg-green-100 text-green-700 dark:bg-green-900/40 dark:text-green-300",failed:"bg-red-100 text-red-700 dark:bg-red-900/40 dark:text-red-300",failed_invalid_credentials:"bg-red-100 text-red-700 dark:bg-red-900/40 dark:text-red-300",failed_exchange:"bg-red-100 text-red-700 dark:bg-red-900/40 dark:text-red-300",failed_timeout:"bg-red-100 text-red-700 dark:bg-red-900/40 dark:text-red-300",needs_manual:"bg-amber-100 text-amber-700 dark:bg-amber-900/40 dark:text-amber-300",cancelled:"bg-slate-100 text-slate-700 dark:bg-slate-800 dark:text-slate-200"};return(0,d.jsx)("span",{className:`rounded-full px-2 py-1 text-[11px] font-medium ${b[a]||b.queued}`,children:a.replaceAll("_"," ")})}function n({isOpen:a,onMethodSelect:b,onImportSuccess:c,onClose:g,initialJobId:h,initialSelectedMethod:o,initialImportMode:p,initialFlowKey:q,onBulkJobChange:r}){let[s,t]=(0,e.useState)(null),[u,v]=(0,e.useState)(""),[w,x]=(0,e.useState)("us-east-1"),[y,z]=(0,e.useState)(""),[A,B]=(0,e.useState)("single-token"),[C,D]=(0,e.useState)(""),[E,F]=(0,e.useState)(String(4)),[G,H]=(0,e.useState)(null),[I,J]=(0,e.useState)(null),[K,L]=(0,e.useState)(null),[M,N]=(0,e.useState)(null),[O,P]=(0,e.useState)(!1),[Q,R]=(0,e.useState)(!1),[S,T]=(0,e.useState)(!1),U=(0,e.useRef)(new Set),V=(0,e.useRef)(0),W=a&&h||null,X=s||(W?"import":null),Y="import"===X&&W&&!s?"bulk-account":A,Z="bulk-account"===Y&&I&&!j(I.status),$="bulk-account"===Y&&I&&j(I.status),_=(0,e.useMemo)(()=>I?.summary?[["Total",I.summary.total],["Queued",I.summary.queued],["Running",I.summary.running],["Success",I.summary.success],["Failed",I.summary.failed],["Manual",I.summary.needs_manual]]:[],[I]),aa=(0,e.useMemo)(()=>Array.isArray(I?.activity)?[...I.activity].reverse():[],[I]),ab=(0,e.useMemo)(()=>(function(a=[]){let b=new Map;return a.forEach(a=>{let c=a.status||"queued";b.has(c)||b.set(c,[]),b.get(c).push(a)}),["running","queued","needs_manual","success","failed","failed_invalid_credentials","failed_exchange","failed_timeout","cancelled"].filter(a=>b.has(a)).map(a=>({status:a,accounts:b.get(a)}))})(I?.accounts||[]),[I]),ac=(0,e.useMemo)(()=>I?.accounts?.length?I.accounts.find(a=>"running"===a.status)||I.accounts.find(a=>"needs_manual"===a.status)||I.accounts.find(a=>"success"===a.status)||I.accounts[0]:null,[I]),ad=a=>{t(a),L(null)},ae=()=>{z(""),D(""),H(null),F(String(4)),L(null),N(null),T(!1),J(null),V.current=0,r?.(null)},af=()=>{Z?g?.():(t(null),B("single-token"),ae())},ag=async()=>{if(!y.trim())return void L("Please enter a refresh token");P(!0),L(null);try{let a=await fetch("/api/oauth/kiro/import",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({mode:"token",refreshToken:y.trim()})}),b=await a.json();if(!a.ok)throw Error(b.error||"Import failed");c?.()}catch(a){L(a.message)}finally{P(!1)}},ah=async a=>{let b=await fetch("/api/oauth/kiro/import",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({mode:"token",refreshTokens:a})}),d=await b.json();if(!b.ok)throw Error(d.error||"Bulk import failed");H({success:d.imported||0,failed:d.failed||0}),c?.()},ai=async a=>{let b=await fetch("/api/oauth/kiro/bulk-import",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({accounts:a,concurrency:Number.parseInt(E,10)||4})}),c=await b.json();if(!b.ok){let a=Array.isArray(c.invalidLines)&&c.invalidLines.length>0?` Invalid lines: ${c.invalidLines.join(", ")}`:"";throw Error((c.error||"Bulk account import failed")+a)}J(c.job||null),N(null),c.job?.jobId&&U.current.delete(c.job.jobId),H(null)},aj=async()=>{let a=C.split("\n").map(a=>a.trim()).filter(Boolean);if(!a.length)return void L("bulk-account"===Y?"Please enter at least one gmail|password line":"Please enter at least one refresh token line");P(!0),L(null),H(null);try{"bulk-account"===Y?await ai(a):await ah(a)}catch(a){L(a.message)}finally{P(!1)}},ak=async()=>{if(I?.jobId)try{let a=await fetch(`/api/oauth/kiro/bulk-import/${I.jobId}/cancel`,{method:"POST"}),b=await a.json();if(!a.ok)throw Error(b.error||"Failed to cancel job");b.job&&J(b.job)}catch(a){L(a.message)}},al=()=>{ae(),c?.()},am=async a=>{if(I?.jobId&&a)try{let b=await fetch(`/api/oauth/kiro/bulk-import/${I.jobId}/manual/${a}`,{method:"POST"}),c=await b.json();if(!b.ok)throw Error(c.error||"Failed to open manual session");c.job&&J(c.job)}catch(a){L(a.message)}},an=a=>{b("social",{provider:a})};return(0,d.jsx)(i.aF,{isOpen:a,title:"Connect Kiro",onClose:g,size:"full",className:"max-w-[min(96vw,1540px)]",children:(0,d.jsxs)("div",{className:"flex flex-col gap-4",children:[!X&&(0,d.jsxs)("div",{className:"space-y-3",children:[(0,d.jsx)("p",{className:"mb-4 text-sm text-text-muted",children:"Choose your authentication method:"}),(0,d.jsx)("button",{onClick:()=>b("builder-id"),className:"w-full rounded-lg border border-border p-4 text-left transition-colors hover:bg-sidebar",children:(0,d.jsxs)("div",{className:"flex items-start gap-3",children:[(0,d.jsx)("span",{className:"material-symbols-outlined mt-0.5 text-primary",children:"shield"}),(0,d.jsxs)("div",{className:"flex-1",children:[(0,d.jsx)("h3",{className:"mb-1 font-semibold",children:"AWS Builder ID"}),(0,d.jsx)("p",{className:"text-sm text-text-muted",children:"Recommended for most users. Free AWS account required."})]})]})}),(0,d.jsx)("button",{onClick:()=>ad("idc"),className:"w-full rounded-lg border border-border p-4 text-left transition-colors hover:bg-sidebar",children:(0,d.jsxs)("div",{className:"flex items-start gap-3",children:[(0,d.jsx)("span",{className:"material-symbols-outlined mt-0.5 text-primary",children:"business"}),(0,d.jsxs)("div",{className:"flex-1",children:[(0,d.jsx)("h3",{className:"mb-1 font-semibold",children:"AWS IAM Identity Center"}),(0,d.jsx)("p",{className:"text-sm text-text-muted",children:"For enterprise users with custom AWS IAM Identity Center."})]})]})}),(0,d.jsx)("button",{onClick:()=>ad("social-google"),className:"hidden w-full rounded-lg border border-border p-4 text-left transition-colors hover:bg-sidebar",children:(0,d.jsxs)("div",{className:"flex items-start gap-3",children:[(0,d.jsx)("span",{className:"material-symbols-outlined mt-0.5 text-primary",children:"account_circle"}),(0,d.jsxs)("div",{className:"flex-1",children:[(0,d.jsx)("h3",{className:"mb-1 font-semibold",children:"Google Account"}),(0,d.jsx)("p",{className:"text-sm text-text-muted",children:"Login with your Google account (manual callback)."})]})]})}),(0,d.jsx)("button",{onClick:()=>ad("social-github"),className:"hidden w-full rounded-lg border border-border p-4 text-left transition-colors hover:bg-sidebar",children:(0,d.jsxs)("div",{className:"flex items-start gap-3",children:[(0,d.jsx)("span",{className:"material-symbols-outlined mt-0.5 text-primary",children:"code"}),(0,d.jsxs)("div",{className:"flex-1",children:[(0,d.jsx)("h3",{className:"mb-1 font-semibold",children:"GitHub Account"}),(0,d.jsx)("p",{className:"text-sm text-text-muted",children:"Login with your GitHub account (manual callback)."})]})]})}),(0,d.jsx)("button",{onClick:()=>ad("import"),className:"w-full rounded-lg border border-border p-4 text-left transition-colors hover:bg-sidebar",children:(0,d.jsxs)("div",{className:"flex items-start gap-3",children:[(0,d.jsx)("span",{className:"material-symbols-outlined mt-0.5 text-primary",children:"file_upload"}),(0,d.jsxs)("div",{className:"flex-1",children:[(0,d.jsx)("h3",{className:"mb-1 font-semibold",children:"Bulk Option"}),(0,d.jsx)("p",{className:"text-sm text-text-muted",children:"Import a single token, bulk tokens, or bulk Google accounts."})]})]})})]}),"idc"===X&&(0,d.jsxs)("div",{className:"space-y-4",children:[(0,d.jsxs)("div",{children:[(0,d.jsxs)("label",{className:"mb-2 block text-sm font-medium",children:["IDC Start URL ",(0,d.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,d.jsx)(i.pd,{value:u,onChange:a=>v(a.target.value),placeholder:"https://your-org.awsapps.com/start",className:"font-mono text-sm"}),(0,d.jsx)("p",{className:"mt-1 text-xs text-text-muted",children:"Your organization's AWS IAM Identity Center URL"})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("label",{className:"mb-2 block text-sm font-medium",children:"AWS Region"}),(0,d.jsx)(i.pd,{value:w,onChange:a=>x(a.target.value),placeholder:"us-east-1",className:"font-mono text-sm"}),(0,d.jsx)("p",{className:"mt-1 text-xs text-text-muted",children:"AWS region for your Identity Center (default: us-east-1)"})]}),K&&(0,d.jsx)("p",{className:"text-sm text-red-600",children:K}),(0,d.jsxs)("div",{className:"flex gap-2",children:[(0,d.jsx)(i.$n,{onClick:()=>{u.trim()?b("idc",{startUrl:u.trim(),region:w}):L("Please enter your IDC start URL")},fullWidth:!0,children:"Continue"}),(0,d.jsx)(i.$n,{onClick:af,variant:"ghost",fullWidth:!0,children:"Back"})]})]}),"social-google"===X&&(0,d.jsxs)("div",{className:"space-y-4",children:[(0,d.jsx)("div",{className:"rounded-lg border border-amber-200 bg-amber-50 p-4 dark:border-amber-800 dark:bg-amber-900/20",children:(0,d.jsxs)("div",{className:"flex gap-2",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-amber-600 dark:text-amber-400",children:"info"}),(0,d.jsxs)("div",{className:"flex-1 text-sm",children:[(0,d.jsx)("p",{className:"mb-1 font-medium text-amber-900 dark:text-amber-100",children:"Manual Callback Required"}),(0,d.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,d.jsxs)("div",{className:"flex gap-2",children:[(0,d.jsx)(i.$n,{onClick:()=>an("google"),fullWidth:!0,children:"Continue with Google"}),(0,d.jsx)(i.$n,{onClick:af,variant:"ghost",fullWidth:!0,children:"Back"})]})]}),"social-github"===X&&(0,d.jsxs)("div",{className:"space-y-4",children:[(0,d.jsx)("div",{className:"rounded-lg border border-amber-200 bg-amber-50 p-4 dark:border-amber-800 dark:bg-amber-900/20",children:(0,d.jsxs)("div",{className:"flex gap-2",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-amber-600 dark:text-amber-400",children:"info"}),(0,d.jsxs)("div",{className:"flex-1 text-sm",children:[(0,d.jsx)("p",{className:"mb-1 font-medium text-amber-900 dark:text-amber-100",children:"Manual Callback Required"}),(0,d.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,d.jsxs)("div",{className:"flex gap-2",children:[(0,d.jsx)(i.$n,{onClick:()=>an("github"),fullWidth:!0,children:"Continue with GitHub"}),(0,d.jsx)(i.$n,{onClick:af,variant:"ghost",fullWidth:!0,children:"Back"})]})]}),"import"===X&&(0,d.jsxs)("div",{className:"space-y-4",children:[(0,d.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,d.jsx)(i.$n,{size:"sm",variant:"single-token"===Y?"primary":"ghost",onClick:()=>{B("single-token"),H(null),L(null)},disabled:Z,children:"Single Token"}),(0,d.jsx)(i.$n,{size:"sm",variant:"bulk-token"===Y?"primary":"ghost",onClick:()=>{B("bulk-token"),H(null),L(null)},disabled:Z,children:"Bulk Token"}),(0,d.jsx)(i.$n,{size:"sm",variant:"bulk-account"===Y?"primary":"ghost",onClick:()=>{B("bulk-account"),H(null),L(null)},children:"Bulk Account"})]}),"single-token"===Y&&(0,d.jsxs)(d.Fragment,{children:[Q&&(0,d.jsxs)("div",{className:"py-6 text-center",children:[(0,d.jsx)("div",{className:"mx-auto mb-4 flex size-16 items-center justify-center rounded-full bg-primary/10",children:(0,d.jsx)("span",{className:"material-symbols-outlined animate-spin text-3xl text-primary",children:"progress_activity"})}),(0,d.jsx)("h3",{className:"mb-2 text-lg font-semibold",children:"Auto-detecting token..."}),(0,d.jsx)("p",{className:"text-sm text-text-muted",children:"Reading from AWS SSO cache"})]}),!Q&&(0,d.jsxs)(d.Fragment,{children:[S&&(0,d.jsx)("div",{className:"rounded-lg border border-green-200 bg-green-50 p-3 dark:border-green-800 dark:bg-green-900/20",children:(0,d.jsxs)("div",{className:"flex gap-2",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-green-600 dark:text-green-400",children:"check_circle"}),(0,d.jsx)("p",{className:"text-sm text-green-800 dark:text-green-200",children:"Token auto-detected from Kiro IDE successfully!"})]})}),!S&&!K&&(0,d.jsx)("div",{className:"rounded-lg border border-blue-200 bg-blue-50 p-3 dark:border-blue-800 dark:bg-blue-900/20",children:(0,d.jsxs)("div",{className:"flex gap-2",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-blue-600 dark:text-blue-400",children:"info"}),(0,d.jsx)("p",{className:"text-sm text-blue-800 dark:text-blue-200",children:"Kiro IDE not detected. Please paste your refresh token manually."})]})}),(0,d.jsxs)("div",{children:[(0,d.jsxs)("label",{className:"mb-2 block text-sm font-medium",children:["Refresh Token ",(0,d.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,d.jsx)(i.pd,{value:y,onChange:a=>z(a.target.value),placeholder:"Token will be auto-filled...",className:"font-mono text-sm"})]}),K&&(0,d.jsx)("div",{className:"rounded-lg border border-red-200 bg-red-50 p-3 dark:border-red-800 dark:bg-red-900/20",children:(0,d.jsx)("p",{className:"text-sm text-red-600 dark:text-red-400",children:K})}),(0,d.jsxs)("div",{className:"flex gap-2",children:[(0,d.jsx)(i.$n,{onClick:ag,fullWidth:!0,disabled:O||!y.trim(),children:O?"Importing...":"Import Token"}),(0,d.jsx)(i.$n,{onClick:af,variant:"ghost",fullWidth:!0,children:"Back"})]})]})]}),"bulk-token"===Y&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("div",{className:"rounded-lg border border-blue-200 bg-blue-50 p-3 dark:border-blue-800 dark:bg-blue-900/20",children:(0,d.jsxs)("div",{className:"flex gap-2",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-blue-600 dark:text-blue-400",children:"info"}),(0,d.jsx)("p",{className:"text-sm text-blue-800 dark:text-blue-200",children:"Bulk token import accepts one refresh token per line."})]})}),(0,d.jsxs)("div",{children:[(0,d.jsxs)("label",{className:"mb-2 block text-sm font-medium",children:["Bulk Refresh Tokens ",(0,d.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,d.jsx)("textarea",{value:C,onChange:a=>D(a.target.value),placeholder:"aorAAAAAG...\naorAAAAAG...",className:"min-h-[160px] w-full resize-y rounded-lg border border-border bg-background px-3 py-2 font-mono text-sm focus:outline-none focus:ring-1 focus:ring-primary"}),(0,d.jsx)("p",{className:"mt-1 text-xs text-text-muted",children:"One refresh token per line."})]}),G&&(0,d.jsx)("div",{className:`text-sm font-medium ${G.failed>0?"text-yellow-600 dark:text-yellow-400":"text-green-600 dark:text-green-400"}`,children:`Success: ${G.success} imported${G.failed>0?`, ${G.failed} failed`:""}`}),K&&(0,d.jsx)("div",{className:"rounded-lg border border-red-200 bg-red-50 p-3 dark:border-red-800 dark:bg-red-900/20",children:(0,d.jsx)("p",{className:"text-sm text-red-600 dark:text-red-400",children:K})}),M&&(0,d.jsx)("div",{className:"rounded-lg border border-amber-200 bg-amber-50 p-3 dark:border-amber-800 dark:bg-amber-900/20",children:(0,d.jsx)("p",{className:"text-sm text-amber-700 dark:text-amber-300",children:M})}),(0,d.jsxs)("div",{className:"flex gap-2",children:[(0,d.jsx)(i.$n,{onClick:aj,fullWidth:!0,disabled:O||!C.trim(),children:O?"Importing...":"Import Tokens"}),(0,d.jsx)(i.$n,{onClick:af,variant:"ghost",fullWidth:!0,children:"Back"})]})]}),"bulk-account"===Y&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("div",{className:"rounded-lg border border-blue-200 bg-blue-50 p-3 dark:border-blue-800 dark:bg-blue-900/20",children:(0,d.jsxs)("div",{className:"flex gap-2",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-blue-600 dark:text-blue-400",children:"info"}),(0,d.jsx)("p",{className:"text-sm text-blue-800 dark:text-blue-200",children:"Bulk account import runs Playwright in the background, keeps passwords in memory only, and only needs manual action when Google or Kiro blocks a worker. Recommended worker count for a 24 GB machine: 4."})]})}),!I&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("div",{children:[(0,d.jsxs)("label",{className:"mb-2 block text-sm font-medium",children:["Bulk Accounts ",(0,d.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,d.jsx)("textarea",{value:C,onChange:a=>D(a.target.value),placeholder:"gmail1@example.com|password1\ngmail2@example.com|password2",className:"min-h-[180px] w-full resize-y rounded-lg border border-border bg-background px-3 py-2 font-mono text-sm focus:outline-none focus:ring-1 focus:ring-primary"}),(0,d.jsx)("p",{className:"mt-1 text-xs text-text-muted",children:"One account per line in the format gmail|password."})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("label",{className:"mb-2 block text-sm font-medium",children:"Concurrent Workers"}),(0,d.jsx)(i.pd,{type:"number",min:"1",max:"8",value:E,onChange:a=>F(a.target.value),placeholder:"4"}),(0,d.jsx)("p",{className:"mt-1 text-xs text-text-muted",children:"Default 4. Allowed range: 1 to 8 workers."})]})]}),I&&(0,d.jsxs)("div",{className:"space-y-4 rounded-xl border border-border p-4",children:[(0,d.jsxs)("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[(0,d.jsxs)("div",{children:[(0,d.jsx)("h3",{className:"font-semibold",children:"Bulk Import Job"}),(0,d.jsxs)("p",{className:"text-xs text-text-muted",children:["Job ID: ",(0,d.jsx)("span",{className:"font-mono",children:I.jobId})]}),(0,d.jsxs)("p",{className:"text-xs text-text-muted",children:["Status: ",(0,d.jsx)("span",{className:"font-medium",children:I.status})," | Workers: ",I.concurrency]}),(0,d.jsx)("p",{className:"text-xs text-text-muted",children:"Browser workers run in the background. Close this modal if needed and reopen it later from the provider page with Resume Bulk Progress."})]}),(0,d.jsxs)("div",{className:"flex gap-2",children:[Z&&(0,d.jsx)(i.$n,{size:"sm",variant:"secondary",onClick:ak,children:"Cancel Job"}),$&&(0,d.jsx)(i.$n,{size:"sm",onClick:al,children:"Done & Refresh"})]})]}),(0,d.jsx)("div",{className:"grid grid-cols-2 gap-2 sm:grid-cols-3",children:_.map(([a,b])=>(0,d.jsxs)("div",{className:"rounded-lg bg-sidebar px-3 py-2",children:[(0,d.jsx)("p",{className:"text-[11px] uppercase tracking-wide text-text-muted",children:a}),(0,d.jsx)("p",{className:"text-lg font-semibold",children:b})]},a))}),I.error&&(0,d.jsx)("div",{className:"rounded-lg border border-red-200 bg-red-50 p-3 text-sm text-red-700 dark:border-red-800 dark:bg-red-900/20 dark:text-red-300",children:I.error}),I.summary?.needs_manual>0&&(0,d.jsx)("div",{className:"rounded-lg border border-amber-200 bg-amber-50 p-3 text-sm text-amber-800 dark:border-amber-800 dark:bg-amber-900/20 dark:text-amber-200",children:"Some accounts need manual assist. Open the blocked worker session below, finish the Google or Kiro prompts, and the job will continue updating automatically."}),(0,d.jsxs)("div",{className:"grid gap-4 lg:grid-cols-[minmax(0,7fr)_minmax(320px,3fr)]",children:[(0,d.jsxs)("div",{className:"space-y-4",children:[(0,d.jsxs)("div",{className:"overflow-hidden rounded-xl border border-border bg-sidebar",children:[(0,d.jsxs)("div",{className:"flex flex-col gap-2 border-b border-border px-4 py-3 sm:flex-row sm:items-center sm:justify-between",children:[(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:"text-sm font-semibold",children:"Live Browser Preview"}),(0,d.jsxs)("p",{className:"text-xs text-text-muted",children:[I.preview?.email||ac?.email||"Waiting for worker",I.preview?.workerId?` | Worker ${I.preview.workerId}`:""]})]}),(0,d.jsxs)("div",{className:"text-right text-xs text-text-muted",children:[(0,d.jsx)("p",{children:k(I.preview?.step||ac?.currentStep)}),(0,d.jsxs)("p",{children:["Updated ",l(I.preview?.updatedAt||ac?.updatedAt)]})]})]}),(0,d.jsx)("div",{className:"relative bg-black/90",children:I.preview?.imageData?(0,d.jsx)(f.default,{src:I.preview.imageData,alt:`Live worker preview for ${I.preview.email||"Kiro import"}`,width:1440,height:900,unoptimized:!0,className:"h-[420px] w-full object-contain"}):(0,d.jsxs)("div",{className:"flex h-[420px] flex-col items-center justify-center gap-3 px-6 text-center text-slate-200",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-5xl text-primary/80",children:"browser_updated"}),(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:"text-base font-medium",children:"Preview will appear when a worker opens Google or Kiro"}),(0,d.jsx)("p",{className:"mt-1 text-sm text-slate-400",children:"The import keeps running in the background even if the screenshot is not available yet."})]})]})})]}),(0,d.jsx)("div",{className:"space-y-4",children:ab.map(a=>{var b;let c;return(0,d.jsxs)("div",{className:`rounded-xl border p-4 ${(b=a.status,(c={queued:"border-slate-200 bg-slate-50/80 dark:border-slate-800 dark:bg-slate-900/20",running:"border-blue-200 bg-blue-50/80 dark:border-blue-900/50 dark:bg-blue-950/20",success:"border-green-200 bg-green-50/80 dark:border-green-900/50 dark:bg-green-950/20",failed:"border-red-200 bg-red-50/80 dark:border-red-900/50 dark:bg-red-950/20",failed_invalid_credentials:"border-red-200 bg-red-50/80 dark:border-red-900/50 dark:bg-red-950/20",failed_exchange:"border-red-200 bg-red-50/80 dark:border-red-900/50 dark:bg-red-950/20",failed_timeout:"border-red-200 bg-red-50/80 dark:border-red-900/50 dark:bg-red-950/20",needs_manual:"border-amber-200 bg-amber-50/80 dark:border-amber-900/50 dark:bg-amber-950/20",cancelled:"border-slate-200 bg-slate-50/80 dark:border-slate-800 dark:bg-slate-900/20"})[b]||c.queued)}`,children:[(0,d.jsxs)("div",{className:"mb-3 flex items-center justify-between gap-3",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)(m,{status:a.status}),(0,d.jsx)("p",{className:"text-sm font-semibold capitalize",children:k(a.status)})]}),(0,d.jsxs)("p",{className:"text-xs text-text-muted",children:[a.accounts.length," account",a.accounts.length>1?"s":""]})]}),(0,d.jsx)("div",{className:"grid gap-3 xl:grid-cols-2",children:a.accounts.map(a=>(0,d.jsxs)("div",{className:"rounded-xl border border-border bg-background/80 p-4",children:[(0,d.jsxs)("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-start sm:justify-between",children:[(0,d.jsxs)("div",{className:"min-w-0",children:[(0,d.jsx)("p",{className:"truncate text-sm font-semibold",children:a.email}),(0,d.jsxs)("p",{className:"text-[11px] text-text-muted",children:["Line ",a.line,a.workerId?` | Worker ${a.workerId}`:""," | ",l(a.updatedAt)]})]}),(0,d.jsx)(m,{status:a.status})]}),(0,d.jsxs)("div",{className:"mt-3 rounded-lg border border-border/70 bg-sidebar/70 px-3 py-2",children:[(0,d.jsx)("p",{className:"text-[11px] uppercase tracking-wide text-text-muted",children:"Current Step"}),(0,d.jsx)("p",{className:"mt-1 text-sm font-medium capitalize",children:k(a.currentStep)})]}),a.logs?.length>0&&(0,d.jsx)("div",{className:"mt-3 space-y-2",children:a.logs.slice(-3).reverse().map(a=>(0,d.jsxs)("div",{className:"rounded-lg bg-sidebar/60 px-3 py-2",children:[(0,d.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,d.jsx)("p",{className:"text-xs font-medium capitalize",children:k(a.step)}),(0,d.jsx)("span",{className:"text-[11px] text-text-muted",children:l(a.at)})]}),(0,d.jsx)("p",{className:"mt-1 text-xs text-text-muted",children:a.message})]},a.id))}),a.error&&(0,d.jsx)("p",{className:"mt-3 text-xs text-red-500",children:a.error}),a.manualSessionAvailable&&a.workerId?(0,d.jsxs)("div",{className:"mt-3 flex items-center gap-2",children:[(0,d.jsx)(i.$n,{size:"sm",variant:a.manualSessionOpened?"secondary":"primary",onClick:()=>am(a.workerId),children:a.manualSessionOpened?"Re-open Manual Session":"Open Manual Session"}),(0,d.jsx)("p",{className:"text-[11px] text-text-muted",children:"Open only if this worker is blocked by CAPTCHA, 2FA, or recovery prompts."})]}):null]},`${a.email}-${a.line}`))})]},a.status)})})]}),(0,d.jsxs)("div",{className:"rounded-xl border border-border bg-sidebar/70",children:[(0,d.jsxs)("div",{className:"border-b border-border px-4 py-3",children:[(0,d.jsx)("p",{className:"text-sm font-semibold",children:"Live Activity Log"}),(0,d.jsx)("p",{className:"text-xs text-text-muted",children:"Every worker step is recorded here in near real time."})]}),(0,d.jsxs)("div",{className:"max-h-[720px] space-y-3 overflow-y-auto p-4",children:[0===aa.length&&(0,d.jsx)("div",{className:"rounded-lg bg-background/70 px-3 py-4 text-sm text-text-muted",children:"Waiting for the first worker event..."}),aa.map(a=>(0,d.jsxs)("div",{className:"rounded-lg border border-border/70 bg-background/80 px-3 py-3",children:[(0,d.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,d.jsxs)("div",{className:"min-w-0",children:[(0,d.jsx)("p",{className:"truncate text-sm font-semibold",children:a.email}),(0,d.jsxs)("p",{className:"text-[11px] text-text-muted",children:[a.workerId?`Worker ${a.workerId}`:"Waiting"," | ",k(a.step)]})]}),(0,d.jsx)("span",{className:"shrink-0 text-[11px] text-text-muted",children:l(a.at)})]}),(0,d.jsx)("p",{className:"mt-2 text-xs text-text-muted",children:a.message})]},a.id))]})]})]})]}),K&&(0,d.jsx)("div",{className:"rounded-lg border border-red-200 bg-red-50 p-3 dark:border-red-800 dark:bg-red-900/20",children:(0,d.jsx)("p",{className:"text-sm text-red-600 dark:text-red-400",children:K})}),(0,d.jsxs)("div",{className:"flex gap-2",children:[!I&&(0,d.jsx)(i.$n,{onClick:aj,fullWidth:!0,disabled:O||!C.trim(),children:O?"Starting...":"Start Bulk Import"}),I&&!$&&(0,d.jsx)(i.$n,{onClick:ak,fullWidth:!0,variant:"secondary",disabled:!Z,children:Z?"Cancel Running Job":"Job Stopped"}),$&&(0,d.jsx)(i.$n,{onClick:al,fullWidth:!0,children:"Done & Refresh Connections"}),(0,d.jsx)(i.$n,{onClick:af,variant:"ghost",fullWidth:!0,children:I?"Back":"Cancel"})]})]})]})]})})}m.propTypes={status:h().string.isRequired},n.propTypes={isOpen:h().bool.isRequired,onMethodSelect:h().func.isRequired,onImportSuccess:h().func,initialJobId:h().string,initialSelectedMethod:h().string,initialImportMode:h().string,initialFlowKey:h().oneOfType([h().string,h().number]),onBulkJobChange:h().func,onClose:h().func.isRequired}},87226:(a,b,c)=>{c.d(b,{default:()=>U});var d=c(48249),e=c(67484),f=c(19099),g=c(96919),h=c(75171),i=c(17660),j=c(49885),k=c.n(j);let l=a=>new Intl.NumberFormat().format(a||0);function m({stats:a}){let b,c=a.totalCachedTokens||0,e=a.totalPromptTokens>0?Math.min(100,c/a.totalPromptTokens*100):0;return(0,d.jsxs)("div",{className:"grid min-w-0 grid-cols-1 gap-3 sm:grid-cols-2 md:grid-cols-3 xl:grid-cols-5 sm:gap-4",children:[(0,d.jsxs)(i.default,{className:"flex min-w-0 flex-col gap-1 px-4 py-3",children:[(0,d.jsx)("span",{className:"text-text-muted text-sm uppercase font-semibold",children:"Total Requests"}),(0,d.jsx)("span",{className:"truncate text-2xl font-bold",children:l(a.totalRequests)})]}),(0,d.jsxs)(i.default,{className:"flex min-w-0 flex-col gap-1 px-4 py-3",children:[(0,d.jsx)("span",{className:"text-text-muted text-sm uppercase font-semibold",children:"Total Input Tokens"}),(0,d.jsx)("span",{className:"truncate text-2xl font-bold text-primary",children:l(a.totalPromptTokens)})]}),(0,d.jsxs)(i.default,{className:"flex min-w-0 flex-col gap-1 px-4 py-3",children:[(0,d.jsx)("span",{className:"text-text-muted text-sm uppercase font-semibold",children:"Cached Tokens"}),(0,d.jsx)("span",{className:"truncate text-2xl font-bold text-info",children:l(c)}),(0,d.jsx)("span",{className:"text-[10px] text-text-muted",children:c>0?`${e.toFixed(1)}% of input \xb7 billed at cache rate`:"No cache hits yet"})]}),(0,d.jsxs)(i.default,{className:"flex min-w-0 flex-col gap-1 px-4 py-3",children:[(0,d.jsx)("span",{className:"text-text-muted text-sm uppercase font-semibold",children:"Output Tokens"}),(0,d.jsx)("span",{className:"truncate text-2xl font-bold text-success",children:l(a.totalCompletionTokens)})]}),(0,d.jsxs)(i.default,{className:"flex min-w-0 flex-col gap-1 px-4 py-3",children:[(0,d.jsx)("span",{className:"text-text-muted text-sm uppercase font-semibold",children:"Est. Cost"}),(0,d.jsxs)("span",{className:"truncate text-2xl font-bold text-warning",children:["~",(b=a.totalCost,`$${(b||0).toFixed(2)}`)]}),(0,d.jsx)("span",{className:"text-[10px] text-text-muted",children:"Estimated, not actual billing"})]})]})}m.propTypes={stats:k().object.isRequired};let n=a=>new Intl.NumberFormat().format(a||0),o=a=>`$${(a||0).toFixed(2)}`;function p(a){if(!a)return"Never";let b=Math.floor((Date.now()-new Date(a))/6e4);return b<1?"Just now":b<60?`${b}m ago`:b<1440?`${Math.floor(b/60)}h ago`:new Date(a).toLocaleDateString()}function q({field:a,currentSort:b,currentOrder:c}){return b!==a?(0,d.jsx)("span",{className:"ml-1 opacity-20",children:"↕"}):(0,d.jsx)("span",{className:"ml-1",children:"asc"===c?"↑":"↓"})}function r({item:a,viewMode:b,isSummary:c=!1}){if("tokens"===b){let b=a.cachedTokens;return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("td",{className:"px-6 py-3 text-right text-text-muted",children:c&&void 0===a.promptTokens?"—":n(a.promptTokens)}),(0,d.jsx)("td",{className:"px-6 py-3 text-right text-info",children:null==b?"—":n(b)}),(0,d.jsx)("td",{className:"px-6 py-3 text-right text-text-muted",children:c&&void 0===a.completionTokens?"—":n(a.completionTokens)}),(0,d.jsx)("td",{className:"px-6 py-3 text-right font-medium",children:n(a.totalTokens)})]})}return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("td",{className:"px-6 py-3 text-right text-text-muted",children:c&&void 0===a.inputCost?"—":o(a.inputCost)}),(0,d.jsx)("td",{className:"px-6 py-3 text-right text-text-muted",children:c&&void 0===a.outputCost?"—":o(a.outputCost)}),(0,d.jsx)("td",{className:"px-6 py-3 text-right font-medium text-warning",children:o(a.totalCost||a.cost)})]})}function s({title:a,columns:b,groupedData:c,tableType:f,sortBy:g,sortOrder:h,onToggleSort:j,viewMode:k,storageKey:l,renderDetailCells:m,renderSummaryCells:n,emptyMessage:o}){let[p,t]=(0,e.useState)(new Set),u=(0,e.useCallback)(a=>{t(b=>{let c=new Set(b);return c.has(a)?c.delete(a):c.add(a),c})},[]),v=(0,e.useMemo)(()=>"tokens"===k?[{field:"promptTokens",label:"Input Tokens"},{field:"cachedTokens",label:"Cached"},{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"}],[k]),w=b.length+v.length;return(0,d.jsxs)(i.default,{className:"overflow-hidden",children:[(0,d.jsx)("div",{className:"p-4 border-b border-border bg-bg-subtle/50",children:(0,d.jsx)("h3",{className:"font-semibold",children:a})}),(0,d.jsx)("div",{className:"overflow-x-auto",children:(0,d.jsxs)("table",{className:"w-full text-sm text-left",children:[(0,d.jsx)("thead",{className:"bg-bg-subtle/30 text-text-muted uppercase text-xs",children:(0,d.jsxs)("tr",{children:[b.map(a=>(0,d.jsxs)("th",{className:`px-6 py-3 cursor-pointer hover:bg-bg-subtle/50 ${"right"===a.align?"text-right":""}`,onClick:()=>j(f,a.field),children:[a.label," ",(0,d.jsx)(q,{field:a.field,currentSort:g,currentOrder:h})]},a.field)),v.map(a=>(0,d.jsxs)("th",{className:"px-6 py-3 text-right cursor-pointer hover:bg-bg-subtle/50",onClick:()=>j(f,a.field),children:[a.label," ",(0,d.jsx)(q,{field:a.field,currentSort:g,currentOrder:h})]},a.field))]})}),(0,d.jsxs)("tbody",{className:"divide-y divide-border",children:[c.map(a=>(0,d.jsxs)(e.Fragment,{children:[(0,d.jsxs)("tr",{className:"group-summary cursor-pointer hover:bg-bg-subtle/50 transition-colors",onClick:()=>u(a.groupKey),children:[(0,d.jsx)("td",{className:"px-6 py-3",children:(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)("span",{className:`material-symbols-outlined text-[18px] text-text-muted transition-transform ${p.has(a.groupKey)?"rotate-90":""}`,children:"chevron_right"}),(0,d.jsx)("span",{className:`font-medium transition-colors ${a.summary.pending>0?"text-primary":""}`,children:a.groupKey})]})}),n(a),(0,d.jsx)(r,{item:a.summary,viewMode:k,isSummary:!0})]}),p.has(a.groupKey)&&a.items.map(a=>(0,d.jsxs)("tr",{className:"group-detail hover:bg-bg-subtle/20 transition-colors",children:[m(a),(0,d.jsx)(r,{item:a,viewMode:k})]},`detail-${a.key}`))]},a.groupKey)),0===c.length&&(0,d.jsx)("tr",{children:(0,d.jsx)("td",{colSpan:w,className:"px-6 py-8 text-center text-text-muted",children:o})})]})]})})]})}q.propTypes={field:k().string.isRequired,currentSort:k().string.isRequired,currentOrder:k().string.isRequired},r.propTypes={item:k().object.isRequired,viewMode:k().string.isRequired,isSummary:k().bool},s.propTypes={title:k().string.isRequired,columns:k().arrayOf(k().shape({field:k().string.isRequired,label:k().string.isRequired,align:k().string})).isRequired,groupedData:k().array.isRequired,tableType:k().string.isRequired,sortBy:k().string.isRequired,sortOrder:k().string.isRequired,onToggleSort:k().func.isRequired,viewMode:k().string.isRequired,storageKey:k().string.isRequired,renderDetailCells:k().func.isRequired,renderSummaryCells:k().func.isRequired,emptyMessage:k().string.isRequired};var t=c(96103),u=c(22805);c(71763);let v={padding:.2,duration:200};function w({data:a}){let{label:b,color:c,imageUrl:f,textIcon:g,active:h}=a,[i,j]=(0,e.useState)(!1);return(0,d.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:h?c:"var(--color-border)",boxShadow:h?`0 0 16px ${c}40`:"none",minWidth:"150px"},children:[(0,d.jsx)(t.h7,{type:"target",position:u.yX.Top,id:"top",className:"!bg-transparent !border-0 !w-0 !h-0"}),(0,d.jsx)(t.h7,{type:"target",position:u.yX.Bottom,id:"bottom",className:"!bg-transparent !border-0 !w-0 !h-0"}),(0,d.jsx)(t.h7,{type:"target",position:u.yX.Left,id:"left",className:"!bg-transparent !border-0 !w-0 !h-0"}),(0,d.jsx)(t.h7,{type:"target",position:u.yX.Right,id:"right",className:"!bg-transparent !border-0 !w-0 !h-0"}),(0,d.jsx)("div",{className:"w-8 h-8 rounded-md flex items-center justify-center shrink-0",style:{backgroundColor:`${c}15`},children:i?(0,d.jsx)("span",{className:"text-sm font-bold",style:{color:c},children:g}):(0,d.jsx)("img",{src:f,alt:b,className:"w-6 h-6 rounded-sm object-contain",onError:()=>j(!0)})}),(0,d.jsx)("span",{className:"text-base font-medium truncate",style:{color:h?c:"var(--color-text)"},children:b}),h&&(0,d.jsxs)("span",{className:"relative flex h-2 w-2 shrink-0",children:[(0,d.jsx)("span",{className:"animate-ping absolute inline-flex h-full w-full rounded-full opacity-75",style:{backgroundColor:c}}),(0,d.jsx)("span",{className:"relative inline-flex rounded-full h-2 w-2",style:{backgroundColor:c}})]})]})}function x({data:a}){return(0,d.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,d.jsx)(t.h7,{type:"source",position:u.yX.Top,id:"top",className:"!bg-transparent !border-0 !w-0 !h-0"}),(0,d.jsx)(t.h7,{type:"source",position:u.yX.Bottom,id:"bottom",className:"!bg-transparent !border-0 !w-0 !h-0"}),(0,d.jsx)(t.h7,{type:"source",position:u.yX.Left,id:"left",className:"!bg-transparent !border-0 !w-0 !h-0"}),(0,d.jsx)(t.h7,{type:"source",position:u.yX.Right,id:"right",className:"!bg-transparent !border-0 !w-0 !h-0"}),(0,d.jsx)("img",{src:"/favicon.svg",alt:"ZevaiRouter",className:"w-6 h-6 mr-2"}),(0,d.jsx)("span",{className:"text-sm font-bold text-primary",children:"ZevaiRouter"}),a.activeCount>0&&(0,d.jsx)("span",{className:"ml-2 px-1.5 py-0.5 rounded-full bg-primary text-white text-xs font-bold",children:a.activeCount})]})}w.propTypes={data:k().object.isRequired},x.propTypes={data:k().object.isRequired};let y={provider:w,router:x};function z({providers:a=[],activeRequests:b=[],lastProvider:c="",errorProvider:f=""}){let h=(0,e.useMemo)(()=>b.map(a=>a.provider?.toLowerCase()).filter(Boolean).sort().join(","),[b]),i=c?.toLowerCase()||"",j=f?.toLowerCase()||"",k=(0,e.useMemo)(()=>new Set(h?h.split(","):[]),[h]),l=(0,e.useMemo)(()=>new Set(i?[i]:[]),[i]),m=(0,e.useMemo)(()=>new Set(j?[j]:[]),[j]),n=(0,e.useRef)({}),[o,p]=(0,e.useState)(0),q=(0,e.useMemo)(()=>{let a=Date.now(),b=new Set;for(let c of k){let d=n.current[c];(!d||a-d<6e4)&&b.add(c)}return b},[k,o]),{nodes:r,edges:s}=(0,e.useMemo)(()=>(function(a,b,c,d){let e=a.length,f=Math.max(320,204*e/(2*Math.PI)),h=Math.max(200,.55*f);if(0===e)return{nodes:[{id:"router",type:"router",position:{x:0,y:0},data:{activeCount:0},draggable:!1}],edges:[]};let i=[],j=[];return i.push({id:"router",type:"router",position:{x:-60,y:-22},data:{activeCount:b.size},draggable:!1}),a.forEach((a,k)=>{var l,m;let n,o,p=(l=a.provider,g.Q2[l]||{color:"#6b7280",name:l}),q=b.has(a.provider?.toLowerCase()),r=!q&&c.has(a.provider?.toLowerCase()),s=!q&&d.has(a.provider?.toLowerCase()),t=`provider-${a.provider}`,u={label:(p.name!==a.provider?p.name:null)||a.name||a.provider,color:p.color||"#6b7280",imageUrl:(m=a.provider,`/providers/${m}.png`),textIcon:p.textIcon||(a.provider||"?").slice(0,2).toUpperCase(),active:q},v=-Math.PI/2+2*Math.PI*k/e,w=f*Math.cos(v),x=h*Math.sin(v);Math.abs(v+Math.PI/2)<Math.PI/4||Math.abs(v-3*Math.PI/2)<Math.PI/4?(n="top",o="bottom"):Math.abs(v-Math.PI/2)<Math.PI/4?(n="bottom",o="top"):w>0?(n="right",o="left"):(n="left",o="right"),i.push({id:t,type:"provider",position:{x:w-90,y:x-15},data:u,draggable:!1}),j.push({id:`e-${t}`,source:"router",sourceHandle:n,target:t,targetHandle:o,animated:q,style:(p.color,s?{stroke:"#ef4444",strokeWidth:2.5,opacity:.9}:q?{stroke:"#22c55e",strokeWidth:2.5,opacity:.9}:r?{stroke:"#f59e0b",strokeWidth:2,opacity:.7}:{stroke:"var(--color-border)",strokeWidth:1,opacity:.3})})}),{nodes:i,edges:j}})(a,q,l,m),[a,q,l,m]),u=(0,e.useMemo)(()=>a.map(a=>a.provider).sort().join(","),[a]),w=(0,e.useRef)(null),x=(0,e.useRef)(null),A=(0,e.useCallback)(a=>{w.current=a,setTimeout(()=>a.fitView(v),50)},[]);return(0,d.jsx)("div",{ref:x,className:"h-[320px] w-full min-w-0 rounded-lg border border-border bg-bg-subtle/30 sm:h-[480px]",children:0===a.length?(0,d.jsx)("div",{className:"h-full flex items-center justify-center text-text-muted text-sm",children:"No providers connected"}):(0,d.jsx)(t.Gc,{nodes:r,edges:s,nodeTypes:y,fitView:!0,fitViewOptions:v,minZoom:.1,maxZoom:2,onInit:A,proOptions:{hideAttribution:!0},panOnDrag:!0,zoomOnScroll:!0,zoomOnPinch:!0,zoomOnDoubleClick:!0,preventScrolling:!1,nodesDraggable:!1,nodesConnectable:!1,elementsSelectable:!1,children:(0,d.jsx)(t.H2,{showInteractive:!1,className:"react-flow-controls-custom"})},u)})}z.propTypes={providers:k().arrayOf(k().shape({id:k().string,provider:k().string,name:k().string})),activeRequests:k().arrayOf(k().shape({provider:k().string,model:k().string,account:k().string})),lastProvider:k().string,errorProvider:k().string};var A=c(48679),B=c(70452),C=c(28946),D=c(22393),E=c(54206),F=c(57570),G=c(44780);let H=a=>a>=1e6?`${(a/1e6).toFixed(1)}M`:a>=1e3?`${(a/1e3).toFixed(1)}K`:String(a||0),I=a=>`$${(a||0).toFixed(4)}`;function J({period:a="7d"}){let[b,c]=(0,e.useState)([]),[f,g]=(0,e.useState)(!0),[h,j]=(0,e.useState)("tokens");(0,e.useCallback)(async()=>{g(!0);try{let b=await fetch(`/api/usage/chart?period=${a}`);if(b.ok){let a=await b.json();c(a)}}catch(a){console.error("Failed to fetch chart data:",a)}finally{g(!1)}},[a]);let k=b.some(a=>a.tokens>0||a.cost>0);return(0,d.jsxs)(i.default,{className:"flex min-w-0 flex-col gap-3 p-3 sm:p-4",children:[(0,d.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,d.jsx)("button",{onClick:()=>j("tokens"),className:`px-3 py-1 rounded-md text-sm font-medium transition-colors ${"tokens"===h?"bg-primary text-white shadow-sm":"text-text-muted hover:text-text hover:bg-bg-hover"}`,children:"Tokens"}),(0,d.jsx)("button",{onClick:()=>j("cost"),className:`px-3 py-1 rounded-md text-sm font-medium transition-colors ${"cost"===h?"bg-primary text-white shadow-sm":"text-text-muted hover:text-text hover:bg-bg-hover"}`,children:"Cost"})]}),f?(0,d.jsx)("div",{className:"h-48 flex items-center justify-center text-text-muted text-sm",children:"Loading..."}):k?(0,d.jsx)(A.u,{width:"100%",height:220,children:(0,d.jsxs)(B.Q,{data:b,margin:{top:4,right:8,left:0,bottom:0},children:[(0,d.jsxs)("defs",{children:[(0,d.jsxs)("linearGradient",{id:"gradTokens",x1:"0",y1:"0",x2:"0",y2:"1",children:[(0,d.jsx)("stop",{offset:"5%",stopColor:"#6366f1",stopOpacity:.25}),(0,d.jsx)("stop",{offset:"95%",stopColor:"#6366f1",stopOpacity:0})]}),(0,d.jsxs)("linearGradient",{id:"gradCost",x1:"0",y1:"0",x2:"0",y2:"1",children:[(0,d.jsx)("stop",{offset:"5%",stopColor:"#f59e0b",stopOpacity:.25}),(0,d.jsx)("stop",{offset:"95%",stopColor:"#f59e0b",stopOpacity:0})]})]}),(0,d.jsx)(C.d,{strokeDasharray:"3 3",strokeOpacity:.1}),(0,d.jsx)(D.W,{dataKey:"label",tick:{fontSize:10,fill:"currentColor",fillOpacity:.5},tickLine:!1,axisLine:!1,interval:"preserveStartEnd"}),(0,d.jsx)(E.h,{tick:{fontSize:10,fill:"currentColor",fillOpacity:.5},tickLine:!1,axisLine:!1,tickFormatter:"tokens"===h?H:I,width:50}),(0,d.jsx)(F.m,{contentStyle:{backgroundColor:"var(--color-bg)",border:"1px solid var(--color-border)",borderRadius:"8px",fontSize:"12px"},formatter:(a,b)=>"tokens"===b?[H(a),"Tokens"]:[I(a),"Cost"]}),"tokens"===h?(0,d.jsx)(G.Gk,{type:"monotone",dataKey:"tokens",stroke:"#6366f1",strokeWidth:2,fill:"url(#gradTokens)",dot:!1,activeDot:{r:4}}):(0,d.jsx)(G.Gk,{type:"monotone",dataKey:"cost",stroke:"#f59e0b",strokeWidth:2,fill:"url(#gradCost)",dot:!1,activeDot:{r:4}})]})}):(0,d.jsx)("div",{className:"h-48 flex items-center justify-center text-text-muted text-sm",children:"No data for this period"})]})}function K({timestamp:a}){let b,[,c]=(0,e.useState)(0);return(0,d.jsx)(d.Fragment,{children:(b=Math.floor((Date.now()-new Date(a))/1e3))<60?`${b}s ago`:b<3600?`${Math.floor(b/60)}m ago`:b<86400?`${Math.floor(b/3600)}h ago`:`${Math.floor(b/86400)}d ago`})}function L({requests:a=[]}){return(0,d.jsxs)(i.default,{className:"flex min-w-0 flex-col overflow-hidden",padding:"sm",style:{height:480},children:[(0,d.jsx)("div",{className:"px-1 py-2 border-b border-border shrink-0",children:(0,d.jsx)("span",{className:"text-xs font-semibold text-text-muted uppercase tracking-wide",children:"Recent Requests"})}),a.length?(0,d.jsx)("div",{className:"flex-1 overflow-y-auto",children:(0,d.jsxs)("table",{className:"w-full min-w-[300px] border-collapse text-xs",children:[(0,d.jsx)("thead",{className:"sticky top-0 bg-bg z-10",children:(0,d.jsxs)("tr",{className:"border-b border-border",children:[(0,d.jsx)("th",{className:"py-1.5 text-left font-semibold text-text-muted w-2"}),(0,d.jsx)("th",{className:"py-1.5 text-left font-semibold text-text-muted",children:"Model"}),(0,d.jsx)("th",{className:"py-1.5 text-right font-semibold text-text-muted whitespace-nowrap",children:"In / Out"}),(0,d.jsx)("th",{className:"py-1.5 text-right font-semibold text-text-muted",children:"When"})]})}),(0,d.jsx)("tbody",{className:"divide-y divide-border/50",children:a.map((a,b)=>{let c=!a.status||"ok"===a.status||"success"===a.status;return(0,d.jsxs)("tr",{className:"hover:bg-bg-subtle transition-colors",children:[(0,d.jsx)("td",{className:"py-1.5",children:(0,d.jsx)("span",{className:`block w-1.5 h-1.5 rounded-full ${c?"bg-success":"bg-error"}`})}),(0,d.jsx)("td",{className:"py-1.5 font-mono truncate max-w-[120px]",title:a.model,children:a.model}),(0,d.jsxs)("td",{className:"py-1.5 text-right whitespace-nowrap",children:[(0,d.jsxs)("span",{className:"text-primary",children:[n(a.promptTokens),"↑"]})," ",(0,d.jsxs)("span",{className:"text-success",children:[n(a.completionTokens),"↓"]})]}),(0,d.jsx)("td",{className:"py-1.5 text-right text-text-muted whitespace-nowrap",children:(0,d.jsx)(K,{timestamp:a.timestamp})})]},b)})})]})}):(0,d.jsx)("div",{className:"flex-1 flex items-center justify-center text-text-muted text-sm",children:"No requests yet."})]})}function M(a,b={},c,d){return Object.entries(a||{}).map(([a,c])=>{let d=(c.promptTokens||0)+(c.completionTokens||0),e=c.cost||0,f=d>0?(c.promptTokens||0)*(e/d):0,g=d>0?(c.completionTokens||0)*(e/d):0;return{...c,key:a,totalTokens:d,totalCost:e,inputCost:f,outputCost:g,pending:b[a]||0}}).sort((a,b)=>{let e=a[c],f=b[c];return("string"==typeof e&&(e=e.toLowerCase()),"string"==typeof f&&(f=f.toLowerCase()),e<f)?"asc"===d?-1:1:e>f?"asc"===d?1:-1:0})}function N(a,b){if(!Array.isArray(a))return[];let c={};return a.forEach(a=>{let d=function(a,b){switch(b){case"rawModel":return a.rawModel||"Unknown Model";case"accountName":return a.accountName||`Account ${a.connectionId?.slice(0,8)}...`||"Unknown Account";case"keyName":return a.keyName||"Unknown Key";case"endpoint":return a.endpoint||"Unknown Endpoint";default:return a[b]||"Unknown"}}(a,b);c[d]||(c[d]={groupKey:d,summary:{requests:0,promptTokens:0,completionTokens:0,cachedTokens:0,totalTokens:0,cost:0,inputCost:0,outputCost:0,lastUsed:null,pending:0},items:[]});let e=c[d].summary;e.requests+=a.requests||0,e.promptTokens+=a.promptTokens||0,e.completionTokens+=a.completionTokens||0,e.cachedTokens+=a.cachedTokens||0,e.totalTokens+=a.totalTokens||0,e.cost+=a.cost||0,e.inputCost+=a.inputCost||0,e.outputCost+=a.outputCost||0,e.pending+=a.pending||0,a.lastUsed&&(!e.lastUsed||new Date(a.lastUsed)>new Date(e.lastUsed))&&(e.lastUsed=a.lastUsed),c[d].items.push(a)}),Object.values(c)}J.propTypes={period:k().string};let O=[{field:"rawModel",label:"Model"},{field:"provider",label:"Provider"},{field:"requests",label:"Requests",align:"right"},{field:"lastUsed",label:"Last Used",align:"right"}],P=[{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"}],Q=[{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"}],R=[{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"}],S=[{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"}],T=[{value:"today",label:"Today"},{value:"24h",label:"24h"},{value:"7d",label:"7D"},{value:"30d",label:"30D"},{value:"60d",label:"60D"}];function U({period:a,setPeriod:b,hidePeriodSelector:c=!1}={}){let g=(0,f.useRouter)(),i=(0,f.useSearchParams)(),j=i.get("sortBy")||"rawModel",k=i.get("sortOrder")||"asc",[l,o]=(0,e.useState)(null),[q,r]=(0,e.useState)(!0),[t,u]=(0,e.useState)(!1),[v,w]=(0,e.useState)("model"),[x,y]=(0,e.useState)("costs"),[A,B]=(0,e.useState)([]),[C,D]=(0,e.useState)("today");(0,e.useRef)(!0);let E=a??C,F=b??D,G=(0,e.useCallback)((a,b)=>{let c=new URLSearchParams(i.toString());c.get("sortBy")===b?c.set("sortOrder","asc"===c.get("sortOrder")?"desc":"asc"):(c.set("sortBy",b),c.set("sortOrder","asc")),g.replace(`?${c.toString()}`,{scroll:!1})},[i,g]),H=(0,e.useMemo)(()=>{if(!l)return null;switch(v){case"model":{let a=l.pending?.byModel||{};return{columns:O,groupedData:N(M(l.byModel,a,j,k),"rawModel"),storageKey:"usage-stats:expanded-models",emptyMessage:"No usage recorded yet.",renderSummaryCells:a=>(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("td",{className:"px-6 py-3 text-text-muted",children:"—"}),(0,d.jsx)("td",{className:"px-6 py-3 text-right",children:n(a.summary.requests)}),(0,d.jsx)("td",{className:"px-6 py-3 text-right text-text-muted whitespace-nowrap",children:p(a.summary.lastUsed)})]}),renderDetailCells:a=>(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("td",{className:`px-6 py-3 font-medium transition-colors ${a.pending>0?"text-primary":""}`,children:a.rawModel}),(0,d.jsx)("td",{className:"px-6 py-3",children:(0,d.jsx)(h.default,{variant:a.pending>0?"primary":"neutral",size:"sm",children:a.provider})}),(0,d.jsx)("td",{className:"px-6 py-3 text-right",children:n(a.requests)}),(0,d.jsx)("td",{className:"px-6 py-3 text-right text-text-muted whitespace-nowrap",children:p(a.lastUsed)})]})}}case"account":{let a={};return l?.pending?.byAccount&&Object.entries(l.byAccount||{}).forEach(([b,c])=>{let d=l.pending.byAccount[c.connectionId];if(d){let e=c.provider?`${c.rawModel} (${c.provider})`:c.rawModel;a[b]=d[e]||0}}),{columns:P,groupedData:N(M(l.byAccount,a,j,k),"accountName"),storageKey:"usage-stats:expanded-accounts",emptyMessage:"No account-specific usage recorded yet.",renderSummaryCells:a=>(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("td",{className:"px-6 py-3 text-text-muted",children:"—"}),(0,d.jsx)("td",{className:"px-6 py-3 text-text-muted",children:"—"}),(0,d.jsx)("td",{className:"px-6 py-3 text-right",children:n(a.summary.requests)}),(0,d.jsx)("td",{className:"px-6 py-3 text-right text-text-muted whitespace-nowrap",children:p(a.summary.lastUsed)})]}),renderDetailCells:a=>(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("td",{className:`px-6 py-3 font-medium transition-colors ${a.pending>0?"text-primary":""}`,children:a.accountName||`Account ${a.connectionId?.slice(0,8)}...`}),(0,d.jsx)("td",{className:`px-6 py-3 font-medium transition-colors ${a.pending>0?"text-primary":""}`,children:a.rawModel}),(0,d.jsx)("td",{className:"px-6 py-3",children:(0,d.jsx)(h.default,{variant:a.pending>0?"primary":"neutral",size:"sm",children:a.provider})}),(0,d.jsx)("td",{className:"px-6 py-3 text-right",children:n(a.requests)}),(0,d.jsx)("td",{className:"px-6 py-3 text-right text-text-muted whitespace-nowrap",children:p(a.lastUsed)})]})}}case"apiKey":return{columns:Q,groupedData:N(M(l.byApiKey,{},j,k),"keyName"),storageKey:"usage-stats:expanded-apikeys",emptyMessage:"No API key usage recorded yet.",renderSummaryCells:a=>(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("td",{className:"px-6 py-3 text-text-muted",children:"—"}),(0,d.jsx)("td",{className:"px-6 py-3 text-text-muted",children:"—"}),(0,d.jsx)("td",{className:"px-6 py-3 text-right",children:n(a.summary.requests)}),(0,d.jsx)("td",{className:"px-6 py-3 text-right text-text-muted whitespace-nowrap",children:p(a.summary.lastUsed)})]}),renderDetailCells:a=>(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("td",{className:"px-6 py-3 font-medium",children:a.keyName}),(0,d.jsx)("td",{className:"px-6 py-3",children:a.rawModel}),(0,d.jsx)("td",{className:"px-6 py-3",children:(0,d.jsx)(h.default,{variant:"neutral",size:"sm",children:a.provider})}),(0,d.jsx)("td",{className:"px-6 py-3 text-right",children:n(a.requests)}),(0,d.jsx)("td",{className:"px-6 py-3 text-right text-text-muted whitespace-nowrap",children:p(a.lastUsed)})]})};default:return{columns:R,groupedData:N(M(l.byEndpoint,{},j,k),"endpoint"),storageKey:"usage-stats:expanded-endpoints",emptyMessage:"No endpoint usage recorded yet.",renderSummaryCells:a=>(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("td",{className:"px-6 py-3 text-text-muted",children:"—"}),(0,d.jsx)("td",{className:"px-6 py-3 text-text-muted",children:"—"}),(0,d.jsx)("td",{className:"px-6 py-3 text-right",children:n(a.summary.requests)}),(0,d.jsx)("td",{className:"px-6 py-3 text-right text-text-muted whitespace-nowrap",children:p(a.summary.lastUsed)})]}),renderDetailCells:a=>(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("td",{className:"px-6 py-3 font-medium font-mono text-sm",children:a.endpoint}),(0,d.jsx)("td",{className:"px-6 py-3",children:a.rawModel}),(0,d.jsx)("td",{className:"px-6 py-3",children:(0,d.jsx)(h.default,{variant:"neutral",size:"sm",children:a.provider})}),(0,d.jsx)("td",{className:"px-6 py-3 text-right",children:n(a.requests)}),(0,d.jsx)("td",{className:"px-6 py-3 text-right text-text-muted whitespace-nowrap",children:p(a.lastUsed)})]})}}},[l,v,j,k]);if(!l&&!q)return(0,d.jsx)("div",{className:"text-text-muted",children:"Failed to load usage statistics."});let I=(0,d.jsx)("div",{className:"flex items-center justify-center py-12 text-text-muted",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-[32px] animate-spin",children:"progress_activity"})});return(0,d.jsxs)("div",{className:"flex min-w-0 flex-col gap-6",children:[!c&&(0,d.jsxs)("div",{className:"flex w-full items-center gap-2 sm:w-auto sm:self-end",children:[(0,d.jsx)("div",{className:"grid flex-1 grid-cols-5 items-center gap-1 rounded-lg border border-border bg-bg-subtle p-1 sm:flex sm:flex-none",children:T.map(a=>(0,d.jsx)("button",{onClick:()=>F(a.value),disabled:t,className:`rounded-md px-3 py-1 text-sm font-medium transition-colors ${E===a.value?"bg-primary text-white shadow-sm":"text-text-muted hover:bg-bg-hover hover:text-text"}`,children:a.label},a.value))}),t&&(0,d.jsx)("span",{className:"material-symbols-outlined text-[16px] text-text-muted animate-spin",children:"progress_activity"})]}),q?I:(0,d.jsx)(m,{stats:l}),q?I:(0,d.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,d.jsx)(z,{providers:A,activeRequests:l.activeRequests||[],lastProvider:l.recentRequests?.[0]?.provider||"",errorProvider:l.errorProvider||""}),(0,d.jsx)(L,{requests:l.recentRequests||[]})]}),q?I:(0,d.jsx)(J,{period:E}),(0,d.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,d.jsxs)("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between",children:[(0,d.jsx)("select",{value:v,onChange:a=>w(a.target.value),className:"w-full rounded-lg border border-border bg-surface px-3 py-1.5 text-sm font-medium text-text-main focus:outline-none focus:ring-2 focus:ring-primary/50 sm:w-auto",style:{colorScheme:"auto"},children:S.map(a=>(0,d.jsx)("option",{value:a.value,children:a.label},a.value))}),(0,d.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,d.jsx)("button",{onClick:()=>y("costs"),className:`px-3 py-1 rounded-md text-sm font-medium transition-colors ${"costs"===x?"bg-primary text-white shadow-sm":"text-text-muted hover:text-text hover:bg-bg-hover"}`,children:"Costs"}),(0,d.jsx)("button",{onClick:()=>y("tokens"),className:`px-3 py-1 rounded-md text-sm font-medium transition-colors ${"tokens"===x?"bg-primary text-white shadow-sm":"text-text-muted hover:text-text hover:bg-bg-hover"}`,children:"Tokens"})]})]}),q?I:H&&(0,d.jsx)(s,{title:"",columns:H.columns,groupedData:H.groupedData,tableType:v,sortBy:j,sortOrder:k,onToggleSort:G,viewMode:x,storageKey:H.storageKey,renderSummaryCells:H.renderSummaryCells,renderDetailCells:H.renderDetailCells,emptyMessage:H.emptyMessage})]})]})}},91099:(a,b,c)=>{c.d(b,{default:()=>f});var d=c(48249),e=c(71404);function f({options:a=[],value:b,onChange:c,size:g="md",className:h}){let i={sm:"h-7 text-xs",md:"h-9 text-sm",lg:"h-11 text-base"};return(0,d.jsx)("div",{className:(0,e.cn)("inline-flex items-center p-1 rounded-[10px] overflow-x-auto","bg-surface-2",h),children:a.map(a=>(0,d.jsxs)("button",{onClick:()=>c(a.value),className:(0,e.cn)("shrink-0 px-4 rounded-[8px] font-medium transition-all",i[g],b===a.value?"bg-surface text-text-main shadow-sm":"text-text-muted hover:text-text-main"),children:[a.icon&&(0,d.jsx)("span",{className:"material-symbols-outlined text-[16px] mr-1.5",children:a.icon}),a.label]},a.value))})}},91809:(a,b,c)=>{c.d(b,{default:()=>g});var d=c(48249),e=c(67484),f=c(17660);function g(){let[a,b]=(0,e.useState)([]),[c,g]=(0,e.useState)(!0),[h,i]=(0,e.useState)(!0);return(0,d.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,d.jsxs)("div",{className:"flex items-center justify-between",children:[(0,d.jsx)("h2",{className:"text-xl font-semibold",children:"Request Logs"}),(0,d.jsx)("div",{className:"flex items-center gap-2",children:(0,d.jsxs)("label",{className:"text-sm font-medium text-text-muted flex items-center gap-2 cursor-pointer",children:[(0,d.jsx)("span",{children:"Auto Refresh (3s)"}),(0,d.jsx)("div",{onClick:()=>i(!h),className:`relative inline-flex h-5 w-9 items-center rounded-full transition-colors focus:outline-none ${h?"bg-primary":"bg-bg-subtle border border-border"}`,children:(0,d.jsx)("span",{className:`inline-block h-3 w-3 transform rounded-full bg-white transition-transform ${h?"translate-x-5":"translate-x-1"}`})})]})})]}),(0,d.jsx)(f.default,{className:"overflow-hidden bg-black/5 dark:bg-black/20",children:(0,d.jsx)("div",{className:"p-0 overflow-x-auto max-h-[600px] overflow-y-auto font-mono text-xs",children:c&&0===a.length?(0,d.jsx)("div",{className:"p-8 text-center text-text-muted",children:"Loading logs..."}):0===a.length?(0,d.jsx)("div",{className:"p-8 text-center text-text-muted",children:"No logs recorded yet."}):(0,d.jsxs)("table",{className:"w-full text-left border-collapse whitespace-nowrap",children:[(0,d.jsx)("thead",{className:"sticky top-0 bg-bg-subtle border-b border-border z-10",children:(0,d.jsxs)("tr",{children:[(0,d.jsx)("th",{className:"px-3 py-2 border-r border-border",children:"DateTime"}),(0,d.jsx)("th",{className:"px-3 py-2 border-r border-border",children:"Model"}),(0,d.jsx)("th",{className:"px-3 py-2 border-r border-border",children:"Provider"}),(0,d.jsx)("th",{className:"px-3 py-2 border-r border-border",children:"Account"}),(0,d.jsx)("th",{className:"px-3 py-2 border-r border-border",children:"In"}),(0,d.jsx)("th",{className:"px-3 py-2 border-r border-border",children:"Out"}),(0,d.jsx)("th",{className:"px-3 py-2",children:"Status"})]})}),(0,d.jsx)("tbody",{className:"divide-y divide-border/50",children:a.map((a,b)=>{let c=a.split(" | ");if(c.length<7)return null;let e=c[6],f=e.includes("PENDING"),g=e.includes("FAILED"),h=e.includes("OK");return(0,d.jsxs)("tr",{className:`hover:bg-primary/5 transition-colors ${f?"bg-primary/5":""}`,children:[(0,d.jsx)("td",{className:"px-3 py-1.5 border-r border-border text-text-muted",children:c[0]}),(0,d.jsx)("td",{className:"px-3 py-1.5 border-r border-border font-medium",children:c[1]}),(0,d.jsx)("td",{className:"px-3 py-1.5 border-r border-border",children:(0,d.jsx)("span",{className:"px-1.5 py-0.5 rounded bg-bg-subtle border border-border text-[10px] uppercase font-bold",children:c[2]})}),(0,d.jsx)("td",{className:"px-3 py-1.5 border-r border-border truncate max-w-[150px]",title:c[3],children:c[3]}),(0,d.jsx)("td",{className:"px-3 py-1.5 border-r border-border text-right text-primary",children:c[4]}),(0,d.jsx)("td",{className:"px-3 py-1.5 border-r border-border text-right text-success",children:c[5]}),(0,d.jsx)("td",{className:`px-3 py-1.5 font-bold ${h?"text-success":g?"text-error":"text-primary animate-pulse"}`,children:e})]},b)})})]})})}),(0,d.jsx)("div",{className:"text-[10px] text-text-muted italic",children:"Logs are loaded from the request history database."})]})}},95145:(a,b,c)=>{c.d(b,{ConfirmModal:()=>i,default:()=>h});var d=c(48249);c(67484);var e=c(71404),f=c(99070),g=c(32971);function h({isOpen:a,onClose:b,title:c,children:f,footer:i,size:j="md",closeOnOverlay:k=!0,showTrafficLights:l=!0,className:m}){return a?(0,d.jsxs)("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4",children:[(0,d.jsx)("div",{className:"absolute inset-0 bg-black/50 backdrop-blur-[2px] fade-in",onClick:k?b:void 0}),(0,d.jsxs)("div",{className:(0,e.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"}[j],m),children:[(c||l)&&(0,d.jsxs)("div",{className:"flex items-center justify-between p-2 border-b border-border-subtle",children:[(0,d.jsxs)("div",{className:"flex items-center",children:[l&&(0,d.jsxs)("div",{className:"hidden md:flex items-center gap-2 mr-4 ml-2",children:[(0,d.jsx)(g.default,{text:"Close",position:"top",color:"#FF5F56",children:(0,d.jsx)("button",{onClick:b,"aria-label":"Close",title:"Close",className:"w-4 h-4 rounded-full bg-[#FF5F56] hover:brightness-90 transition-all cursor-pointer flex items-center justify-center group/dot",children:(0,d.jsx)("span",{className:"text-[9px] font-bold text-white opacity-0 group-hover/dot:opacity-100 transition-opacity leading-none",children:"✕"})})}),(0,d.jsx)("div",{className:"w-4 h-4 rounded-full bg-[#3a3a3a]/20 dark:bg-white/15 cursor-not-allowed"}),(0,d.jsx)("div",{className:"w-4 h-4 rounded-full bg-[#3a3a3a]/20 dark:bg-white/15 cursor-not-allowed"})]}),c&&(0,d.jsx)("h2",{className:"text-lg font-semibold text-text-main",children:c})]}),(0,d.jsx)("button",{onClick:b,"aria-label":"Close",className:"md:hidden p-1.5 rounded-[10px] text-text-muted hover:bg-surface-2 hover:text-text-main transition-colors",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-[20px]",children:"close"})})]}),(0,d.jsx)("div",{className:"p-6 max-h-[calc(85vh-100px)] overflow-y-auto custom-scrollbar",children:f}),i&&(0,d.jsx)("div",{className:"flex items-center justify-end gap-3 p-6 border-t border-border-subtle",children:i})]})]}):null}function i({isOpen:a,onClose:b,onConfirm:c,title:e="Confirm",message:g,confirmText:j="Confirm",cancelText:k="Cancel",variant:l="danger",loading:m=!1}){return(0,d.jsx)(h,{isOpen:a,onClose:b,title:e,size:"sm",footer:(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(f.default,{variant:"ghost",onClick:b,disabled:m,children:k}),(0,d.jsx)(f.default,{variant:l,onClick:c,loading:m,children:j})]}),children:(0,d.jsx)("p",{className:"text-text-muted",children:g})})}},95514:(a,b,c)=>{c.d(b,{default:()=>f});var d=c(48249),e=c(71404);function f({checked:a=!1,onChange:b,label:c,description:g,disabled:h=!1,size:i="md",className:j}){let k={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,d.jsxs)("div",{className:(0,e.cn)("flex items-center gap-3",h&&"opacity-50 cursor-not-allowed",j),children:[(0,d.jsx)("button",{type:"button",role:"switch","aria-checked":a,disabled:h,onClick:()=>{!h&&b&&b(!a)},className:(0,e.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",a?"bg-brand-500":"bg-surface-3",k[i].track,h&&"cursor-not-allowed"),children:(0,d.jsx)("span",{className:(0,e.cn)("pointer-events-none inline-block rounded-full bg-white shadow-sm","transform transition duration-200 ease-in-out",a?k[i].translate:"translate-x-0.5",k[i].thumb,"mt-0.5")})}),(c||g)&&(0,d.jsxs)("div",{className:"flex flex-col",children:[c&&(0,d.jsx)("span",{className:"text-sm font-medium text-text-main",children:c}),g&&(0,d.jsx)("span",{className:"text-xs text-text-muted",children:g})]})]})}},99070:(a,b,c)=>{c.d(b,{default:()=>h});var d=c(48249),e=c(71404);let f={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"},g={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 h({children:a,variant:b="primary",size:c="md",icon:i,iconRight:j,disabled:k=!1,loading:l=!1,fullWidth:m=!1,className:n,...o}){return(0,d.jsxs)("button",{className:(0,e.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",f[b],g[c],m&&"w-full",n),disabled:k||l,...o,children:[l?(0,d.jsx)("span",{className:"material-symbols-outlined animate-spin text-[18px]",children:"progress_activity"}):i?(0,d.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:i}):null,a,j&&!l&&(0,d.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:j})]})}}};
|