@amir83nasr/10router 0.1.8 → 0.1.9
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/.next/BUILD_ID +1 -1
- package/.next/app-path-routes-manifest.json +6 -6
- package/.next/build-manifest.json +3 -3
- package/.next/prerender-manifest.json +23 -23
- package/.next/react-loadable-manifest.json +9 -0
- package/.next/server/app/(dashboard)/dashboard/basic-chat/page.js +1 -1
- package/.next/server/app/(dashboard)/dashboard/basic-chat/page.js.nft.json +1 -1
- package/.next/server/app/(dashboard)/dashboard/basic-chat/page_client-reference-manifest.js +1 -1
- package/.next/server/app/(dashboard)/dashboard/cli-tools/[toolId]/page.js +2 -2
- package/.next/server/app/(dashboard)/dashboard/cli-tools/[toolId]/page.js.nft.json +1 -1
- package/.next/server/app/(dashboard)/dashboard/cli-tools/[toolId]/page_client-reference-manifest.js +1 -1
- package/.next/server/app/(dashboard)/dashboard/cli-tools/page.js +1 -1
- package/.next/server/app/(dashboard)/dashboard/cli-tools/page.js.nft.json +1 -1
- package/.next/server/app/(dashboard)/dashboard/cli-tools/page_client-reference-manifest.js +1 -1
- package/.next/server/app/(dashboard)/dashboard/combos/page.js +1 -1
- package/.next/server/app/(dashboard)/dashboard/combos/page.js.nft.json +1 -1
- package/.next/server/app/(dashboard)/dashboard/combos/page_client-reference-manifest.js +1 -1
- package/.next/server/app/(dashboard)/dashboard/console-log/page.js +1 -1
- package/.next/server/app/(dashboard)/dashboard/console-log/page.js.nft.json +1 -1
- package/.next/server/app/(dashboard)/dashboard/console-log/page_client-reference-manifest.js +1 -1
- package/.next/server/app/(dashboard)/dashboard/endpoint/page.js +1 -1
- package/.next/server/app/(dashboard)/dashboard/endpoint/page.js.nft.json +1 -1
- package/.next/server/app/(dashboard)/dashboard/endpoint/page_client-reference-manifest.js +1 -1
- package/.next/server/app/(dashboard)/dashboard/media-providers/systemone/[id]/page.js +1 -1
- package/.next/server/app/(dashboard)/dashboard/media-providers/systemone/[id]/page.js.nft.json +1 -1
- package/.next/server/app/(dashboard)/dashboard/media-providers/systemone/[id]/page_client-reference-manifest.js +1 -1
- package/.next/server/app/(dashboard)/dashboard/media-providers/systemone/page.js +1 -1
- package/.next/server/app/(dashboard)/dashboard/media-providers/systemone/page.js.nft.json +1 -1
- package/.next/server/app/(dashboard)/dashboard/media-providers/systemone/page_client-reference-manifest.js +1 -1
- package/.next/server/app/(dashboard)/dashboard/page.js +1 -1
- package/.next/server/app/(dashboard)/dashboard/page.js.nft.json +1 -1
- package/.next/server/app/(dashboard)/dashboard/page_client-reference-manifest.js +1 -1
- package/.next/server/app/(dashboard)/dashboard/profile/page.js +1 -1
- package/.next/server/app/(dashboard)/dashboard/profile/page.js.nft.json +1 -1
- package/.next/server/app/(dashboard)/dashboard/profile/page_client-reference-manifest.js +1 -1
- package/.next/server/app/(dashboard)/dashboard/providers/[id]/page.js +1 -1
- package/.next/server/app/(dashboard)/dashboard/providers/[id]/page.js.nft.json +1 -1
- package/.next/server/app/(dashboard)/dashboard/providers/[id]/page_client-reference-manifest.js +1 -1
- package/.next/server/app/(dashboard)/dashboard/providers/new/page.js +1 -1
- package/.next/server/app/(dashboard)/dashboard/providers/new/page.js.nft.json +1 -1
- package/.next/server/app/(dashboard)/dashboard/providers/new/page_client-reference-manifest.js +1 -1
- package/.next/server/app/(dashboard)/dashboard/providers/page.js +1 -1
- package/.next/server/app/(dashboard)/dashboard/providers/page.js.nft.json +1 -1
- package/.next/server/app/(dashboard)/dashboard/providers/page_client-reference-manifest.js +1 -1
- package/.next/server/app/(dashboard)/dashboard/proxy-pools/page.js +2 -2
- package/.next/server/app/(dashboard)/dashboard/proxy-pools/page.js.nft.json +1 -1
- package/.next/server/app/(dashboard)/dashboard/proxy-pools/page_client-reference-manifest.js +1 -1
- package/.next/server/app/(dashboard)/dashboard/pxpipe/page.js +1 -1
- package/.next/server/app/(dashboard)/dashboard/pxpipe/page.js.nft.json +1 -1
- package/.next/server/app/(dashboard)/dashboard/pxpipe/page_client-reference-manifest.js +1 -1
- package/.next/server/app/(dashboard)/dashboard/quota/page.js +1 -1
- package/.next/server/app/(dashboard)/dashboard/quota/page.js.nft.json +1 -1
- package/.next/server/app/(dashboard)/dashboard/quota/page_client-reference-manifest.js +1 -1
- package/.next/server/app/(dashboard)/dashboard/token-saver/page.js +1 -1
- package/.next/server/app/(dashboard)/dashboard/token-saver/page.js.nft.json +1 -1
- package/.next/server/app/(dashboard)/dashboard/token-saver/page_client-reference-manifest.js +1 -1
- package/.next/server/app/(dashboard)/dashboard/usage/page.js +1 -1
- package/.next/server/app/(dashboard)/dashboard/usage/page.js.nft.json +1 -1
- package/.next/server/app/(dashboard)/dashboard/usage/page_client-reference-manifest.js +1 -1
- package/.next/server/app/_global-error/page_client-reference-manifest.js +1 -1
- package/.next/server/app/_global-error.html +1 -1
- package/.next/server/app/_global-error.rsc +1 -1
- package/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/.next/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
- package/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/.next/server/app/_not-found.html +1 -1
- package/.next/server/app/_not-found.rsc +5 -5
- package/.next/server/app/_not-found.segments/_full.segment.rsc +5 -5
- package/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +5 -5
- package/.next/server/app/_not-found.segments/_tree.segment.rsc +1 -1
- package/.next/server/app/api/cli-tools/all-statuses/route.js +1 -1
- package/.next/server/app/api/cli-tools/claude-settings/route.js +1 -1
- package/.next/server/app/api/cli-tools/codex-settings/route.js +1 -1
- package/.next/server/app/api/cli-tools/cowork-mcp-registry/route.js +1 -1
- package/.next/server/app/api/cli-tools/cowork-mcp-tools/route.js +1 -1
- package/.next/server/app/api/cli-tools/cowork-settings/route.js +1 -1
- package/.next/server/app/api/cli-tools/dsh-settings/route.js +1 -1
- package/.next/server/app/api/cli-tools/opencode-settings/route.js +1 -1
- package/.next/server/app/api/combos/[id]/route.js +1 -1
- package/.next/server/app/api/combos/route.js +1 -1
- package/.next/server/app/api/oauth/[provider]/[action]/route.js +1 -1
- package/.next/server/app/api/oauth/codex/bulk-import/route.js +1 -1
- package/.next/server/app/api/oauth/codex/import-token/route.js +1 -1
- package/.next/server/app/api/providers/[id]/models/route.js +1 -1
- package/.next/server/app/api/providers/client/route.js +1 -1
- package/.next/server/app/api/providers/route.js +1 -1
- package/.next/server/app/api/translator/send/route.js +1 -1
- package/.next/server/app/api/translator/translate/route.js +1 -1
- package/.next/server/app/api/tunnel/tailscale-install/route.js +2 -2
- package/.next/server/app/api/usage/[connectionId]/codex-reset-credits/route.js +1 -1
- package/.next/server/app/api/usage/[connectionId]/route.js +1 -1
- package/.next/server/app/api/usage/stream/route.js +2 -6
- package/.next/server/app/api/v1/audio/speech/route.js +1 -1
- package/.next/server/app/api/v1/audio/transcriptions/route.js +1 -1
- package/.next/server/app/api/v1/embeddings/route.js +1 -1
- package/.next/server/app/api/v1/images/generations/route.js +1 -1
- package/.next/server/app/api/v1/systemone/route.js +1 -1
- package/.next/server/app/api/version/route.js +1 -1
- package/.next/server/app/callback/page_client-reference-manifest.js +1 -1
- package/.next/server/app/callback.html +1 -1
- package/.next/server/app/callback.rsc +6 -6
- package/.next/server/app/callback.segments/_full.segment.rsc +6 -6
- package/.next/server/app/callback.segments/_tree.segment.rsc +1 -1
- package/.next/server/app/callback.segments/callback/__PAGE__.segment.rsc +6 -6
- package/.next/server/app/dashboard/basic-chat.html +1 -1
- package/.next/server/app/dashboard/basic-chat.rsc +7 -7
- package/.next/server/app/dashboard/basic-chat.segments/!KGRhc2hib2FyZCk/dashboard/basic-chat/__PAGE__.segment.rsc +7 -7
- package/.next/server/app/dashboard/basic-chat.segments/_full.segment.rsc +7 -7
- package/.next/server/app/dashboard/basic-chat.segments/_tree.segment.rsc +1 -1
- package/.next/server/app/dashboard/cli-tools.html +1 -1
- package/.next/server/app/dashboard/cli-tools.rsc +7 -7
- package/.next/server/app/dashboard/cli-tools.segments/!KGRhc2hib2FyZCk/dashboard/cli-tools/__PAGE__.segment.rsc +7 -7
- package/.next/server/app/dashboard/cli-tools.segments/_full.segment.rsc +7 -7
- package/.next/server/app/dashboard/cli-tools.segments/_tree.segment.rsc +1 -1
- package/.next/server/app/dashboard/combos.html +1 -1
- package/.next/server/app/dashboard/combos.rsc +7 -7
- package/.next/server/app/dashboard/combos.segments/!KGRhc2hib2FyZCk/dashboard/combos/__PAGE__.segment.rsc +7 -7
- package/.next/server/app/dashboard/combos.segments/_full.segment.rsc +7 -7
- package/.next/server/app/dashboard/combos.segments/_tree.segment.rsc +1 -1
- package/.next/server/app/dashboard/endpoint.html +1 -1
- package/.next/server/app/dashboard/endpoint.rsc +7 -7
- package/.next/server/app/dashboard/endpoint.segments/!KGRhc2hib2FyZCk/dashboard/endpoint/__PAGE__.segment.rsc +7 -7
- package/.next/server/app/dashboard/endpoint.segments/_full.segment.rsc +7 -7
- package/.next/server/app/dashboard/endpoint.segments/_tree.segment.rsc +1 -1
- package/.next/server/app/dashboard/media-providers/systemone.html +1 -1
- package/.next/server/app/dashboard/media-providers/systemone.rsc +7 -7
- package/.next/server/app/dashboard/media-providers/systemone.segments/!KGRhc2hib2FyZCk/dashboard/media-providers/systemone/__PAGE__.segment.rsc +7 -7
- package/.next/server/app/dashboard/media-providers/systemone.segments/_full.segment.rsc +7 -7
- package/.next/server/app/dashboard/media-providers/systemone.segments/_tree.segment.rsc +1 -1
- package/.next/server/app/dashboard/profile.html +1 -1
- package/.next/server/app/dashboard/profile.rsc +7 -7
- package/.next/server/app/dashboard/profile.segments/!KGRhc2hib2FyZCk/dashboard/profile/__PAGE__.segment.rsc +7 -7
- package/.next/server/app/dashboard/profile.segments/_full.segment.rsc +7 -7
- package/.next/server/app/dashboard/profile.segments/_tree.segment.rsc +1 -1
- package/.next/server/app/dashboard/providers/new.html +1 -1
- package/.next/server/app/dashboard/providers/new.rsc +7 -7
- package/.next/server/app/dashboard/providers/new.segments/!KGRhc2hib2FyZCk/dashboard/providers/new/__PAGE__.segment.rsc +7 -7
- package/.next/server/app/dashboard/providers/new.segments/_full.segment.rsc +7 -7
- package/.next/server/app/dashboard/providers/new.segments/_tree.segment.rsc +1 -1
- package/.next/server/app/dashboard/providers.html +1 -1
- package/.next/server/app/dashboard/providers.rsc +7 -7
- package/.next/server/app/dashboard/providers.segments/!KGRhc2hib2FyZCk/dashboard/providers/__PAGE__.segment.rsc +7 -7
- package/.next/server/app/dashboard/providers.segments/_full.segment.rsc +7 -7
- package/.next/server/app/dashboard/providers.segments/_tree.segment.rsc +1 -1
- package/.next/server/app/dashboard/proxy-pools.html +1 -1
- package/.next/server/app/dashboard/proxy-pools.rsc +7 -7
- package/.next/server/app/dashboard/proxy-pools.segments/!KGRhc2hib2FyZCk/dashboard/proxy-pools/__PAGE__.segment.rsc +7 -7
- package/.next/server/app/dashboard/proxy-pools.segments/_full.segment.rsc +7 -7
- package/.next/server/app/dashboard/proxy-pools.segments/_tree.segment.rsc +1 -1
- package/.next/server/app/dashboard/pxpipe.html +1 -1
- package/.next/server/app/dashboard/pxpipe.rsc +7 -7
- package/.next/server/app/dashboard/pxpipe.segments/!KGRhc2hib2FyZCk/dashboard/pxpipe/__PAGE__.segment.rsc +7 -7
- package/.next/server/app/dashboard/pxpipe.segments/_full.segment.rsc +7 -7
- package/.next/server/app/dashboard/pxpipe.segments/_tree.segment.rsc +1 -1
- package/.next/server/app/dashboard/quota.html +2 -2
- package/.next/server/app/dashboard/quota.rsc +8 -8
- package/.next/server/app/dashboard/quota.segments/!KGRhc2hib2FyZCk/dashboard/quota/__PAGE__.segment.rsc +8 -8
- package/.next/server/app/dashboard/quota.segments/_full.segment.rsc +8 -8
- package/.next/server/app/dashboard/quota.segments/_tree.segment.rsc +1 -1
- package/.next/server/app/dashboard/settings/pricing/page_client-reference-manifest.js +1 -1
- package/.next/server/app/dashboard/settings/pricing.html +1 -1
- package/.next/server/app/dashboard/settings/pricing.rsc +6 -6
- package/.next/server/app/dashboard/settings/pricing.segments/_full.segment.rsc +6 -6
- package/.next/server/app/dashboard/settings/pricing.segments/_tree.segment.rsc +1 -1
- package/.next/server/app/dashboard/settings/pricing.segments/dashboard/settings/pricing/__PAGE__.segment.rsc +6 -6
- package/.next/server/app/dashboard/token-saver.html +1 -1
- package/.next/server/app/dashboard/token-saver.rsc +6 -6
- package/.next/server/app/dashboard/token-saver.segments/!KGRhc2hib2FyZCk/dashboard/token-saver/__PAGE__.segment.rsc +6 -6
- package/.next/server/app/dashboard/token-saver.segments/_full.segment.rsc +6 -6
- package/.next/server/app/dashboard/token-saver.segments/_tree.segment.rsc +1 -1
- package/.next/server/app/dashboard/usage.html +2 -2
- package/.next/server/app/dashboard/usage.rsc +7 -7
- package/.next/server/app/dashboard/usage.segments/!KGRhc2hib2FyZCk/dashboard/usage/__PAGE__.segment.rsc +7 -7
- package/.next/server/app/dashboard/usage.segments/_full.segment.rsc +7 -7
- package/.next/server/app/dashboard/usage.segments/_tree.segment.rsc +1 -1
- package/.next/server/app/dashboard.html +1 -1
- package/.next/server/app/dashboard.rsc +7 -7
- package/.next/server/app/dashboard.segments/!KGRhc2hib2FyZCk/dashboard/__PAGE__.segment.rsc +7 -7
- package/.next/server/app/dashboard.segments/_full.segment.rsc +7 -7
- package/.next/server/app/dashboard.segments/_tree.segment.rsc +1 -1
- package/.next/server/app/index.html +1 -1
- package/.next/server/app/index.rsc +5 -5
- package/.next/server/app/index.segments/__PAGE__.segment.rsc +5 -5
- package/.next/server/app/index.segments/_full.segment.rsc +5 -5
- package/.next/server/app/index.segments/_tree.segment.rsc +1 -1
- package/.next/server/app/landing/page_client-reference-manifest.js +1 -1
- package/.next/server/app/landing.html +1 -1
- package/.next/server/app/landing.rsc +6 -6
- package/.next/server/app/landing.segments/_full.segment.rsc +6 -6
- package/.next/server/app/landing.segments/_tree.segment.rsc +1 -1
- package/.next/server/app/landing.segments/landing/__PAGE__.segment.rsc +6 -6
- package/.next/server/app/login/page_client-reference-manifest.js +1 -1
- package/.next/server/app/login.html +1 -1
- package/.next/server/app/login.rsc +5 -5
- package/.next/server/app/login.segments/_full.segment.rsc +5 -5
- package/.next/server/app/login.segments/_tree.segment.rsc +1 -1
- package/.next/server/app/login.segments/login/__PAGE__.segment.rsc +5 -5
- package/.next/server/app/page_client-reference-manifest.js +1 -1
- package/.next/server/app-paths-manifest.json +6 -6
- package/.next/server/chunks/1003.js +1 -1
- package/.next/server/chunks/1011.js +1 -1
- package/.next/server/chunks/1194.js +1 -1
- package/.next/server/chunks/1289.js +1 -1
- package/.next/server/chunks/1412.js +1 -1
- package/.next/server/chunks/1633.js +1 -1
- package/.next/server/chunks/1985.js +1 -1
- package/.next/server/chunks/2282.js +8 -4
- package/.next/server/chunks/2339.js +1 -1
- package/.next/server/chunks/2801.js +1 -1
- package/.next/server/chunks/3425.js +1 -1
- package/.next/server/chunks/4364.js +1 -1
- package/.next/server/chunks/460.js +1 -1
- package/.next/server/chunks/5761.js +1 -1
- package/.next/server/chunks/6056.js +1 -1
- package/.next/server/chunks/6343.js +3 -3
- package/.next/server/chunks/6823.js +1 -1
- package/.next/server/chunks/7019.js +2 -2
- package/.next/server/chunks/7348.js +1 -1
- package/.next/server/chunks/7504.js +1 -1
- package/.next/server/chunks/7535.js +2 -2
- package/.next/server/chunks/8923.js +1 -1
- package/.next/server/chunks/9018.js +1 -1
- package/.next/server/chunks/9250.js +1 -1
- package/.next/server/chunks/9429.js +1 -1
- package/.next/server/chunks/9646.js +1 -1
- package/.next/server/chunks/9817.js +67 -0
- package/.next/server/middleware-build-manifest.js +1 -1
- package/.next/server/middleware-react-loadable-manifest.js +1 -1
- package/.next/server/middleware.js +1 -1
- package/.next/server/pages/404.html +1 -1
- package/.next/server/pages/500.html +1 -1
- package/.next/server/server-reference-manifest.js +1 -1
- package/.next/server/server-reference-manifest.json +1 -1
- package/.next/static/chunks/{1278-605cc36f762c2ea7.js → 1278-efb46cc82262aa4e.js} +1 -1
- package/.next/static/chunks/{1471-69a7c30abf98c656.js → 1471-10f225f62f7469cc.js} +1 -1
- package/.next/static/chunks/{1699-49be310981e2759e.js → 1699-13ee6864a8a31a96.js} +2 -2
- package/.next/static/chunks/{1830-901fe48c3c62604f.js → 1830-d26d77c95932d7ce.js} +1 -1
- package/.next/static/chunks/1940.1f30124180f22498.js +1 -0
- package/.next/static/chunks/{2836-8e7f4c382297ac97.js → 2836-d97f0aa2718945d5.js} +1 -1
- package/.next/static/chunks/3445-99e12528f235cedb.js +1 -0
- package/.next/static/chunks/{3577-1f02993330d7fba7.js → 3577-cd98d40e3099e1b0.js} +1 -1
- package/.next/static/chunks/{5862-6f3a3a6d4c00100d.js → 5862-f98c2f3d480b80d2.js} +1 -1
- package/.next/static/chunks/6770-e2921b2ce695ed57.js +1 -0
- package/.next/static/chunks/7276-a15e4d56ec28aba8.js +1 -0
- package/.next/static/chunks/{9369-7ef21480b9132957.js → 9369-0d43b295968c2168.js} +1 -1
- package/.next/static/chunks/{9ce8c186-6cd204e9c27ecee1.js → 9ce8c186-3c7d7dbc5d428052.js} +1 -1
- package/.next/static/chunks/app/(dashboard)/dashboard/cli-tools/[toolId]/{page-9efe55fed2f7c81f.js → page-e8bceccb95695755.js} +2 -2
- package/.next/static/chunks/app/(dashboard)/dashboard/cli-tools/{page-9dcb29085167b384.js → page-adee408d9de02423.js} +1 -1
- package/.next/static/chunks/app/(dashboard)/dashboard/combos/{page-f5db9f681c6bface.js → page-d4c1e29e8d038f09.js} +1 -1
- package/.next/static/chunks/app/(dashboard)/dashboard/console-log/{page-d134cc313c9fa0b8.js → page-139200833f7a4ecc.js} +1 -1
- package/.next/static/chunks/app/(dashboard)/dashboard/endpoint/{page-f2d1a733e7f841cb.js → page-67516b120adbc4d7.js} +1 -1
- package/.next/static/chunks/app/(dashboard)/dashboard/media-providers/systemone/[id]/{page-0d6e623de6134598.js → page-b751d9603cb82e62.js} +1 -1
- package/.next/static/chunks/app/(dashboard)/dashboard/{page-e8f1d8be5e294fb0.js → page-315c9f52c472a700.js} +1 -1
- package/.next/static/chunks/app/(dashboard)/dashboard/providers/[id]/{page-c96cbcc4f5736e36.js → page-d5d480e209fdc55a.js} +1 -1
- package/.next/static/chunks/app/(dashboard)/dashboard/providers/new/{page-cc51346e464158b1.js → page-61b87a31ba21a055.js} +1 -1
- package/.next/static/chunks/app/(dashboard)/dashboard/providers/{page-1ee147fbe0693dc1.js → page-2396571281d02804.js} +1 -1
- package/.next/static/chunks/app/(dashboard)/dashboard/proxy-pools/{page-2287b1915fa887fc.js → page-cfd6bcb7e55d7d18.js} +2 -2
- package/.next/static/chunks/app/(dashboard)/dashboard/pxpipe/{page-696cb5c2703ca1ec.js → page-4d758f53c8cfc308.js} +1 -1
- package/.next/static/chunks/app/(dashboard)/dashboard/quota/{page-54a329d725734a1f.js → page-fef6edb7aafd8bd0.js} +1 -1
- package/.next/static/chunks/app/(dashboard)/dashboard/usage/{page-a81f78bb43042c30.js → page-697f46461825d7fc.js} +1 -1
- package/.next/static/chunks/app/(dashboard)/{layout-c199eb2ad56ae96a.js → layout-5039502fc12707c9.js} +1 -1
- package/.next/static/chunks/app/{layout-9bd5877ae6198856.js → layout-8810d4df3081b5df.js} +1 -1
- package/.next/static/chunks/webpack-cb89101193742e2b.js +1 -0
- package/CHANGELOG.md +19 -0
- package/open-sse/executors/zed.js +98 -5
- package/open-sse/handlers/chatCore/sseToJsonHandler.js +11 -4
- package/open-sse/providers/pricing.js +24 -10
- package/open-sse/services/usage/antigravity-weekly.js +10 -0
- package/open-sse/services/usage/claude.js +15 -0
- package/open-sse/shared/zedAuth.js +43 -2
- package/open-sse/translator/concerns/prefetch.js +12 -4
- package/open-sse/translator/response/claude-to-openai.js +2 -2
- package/open-sse/utils/streamHandler.js +1 -5
- package/package.json +1 -1
- package/src/app/(dashboard)/dashboard/providers/[id]/BulkImportGrokCliModal.tsx +1 -1
- package/src/app/(dashboard)/dashboard/providers/[id]/page.tsx +1 -1
- package/src/app/(dashboard)/dashboard/usage/components/ProviderTopology.tsx +5 -2
- package/src/app/api/combos/[id]/route.js +38 -1
- package/src/app/api/combos/route.js +27 -2
- package/src/app/api/providers/[id]/models/route.js +12 -1
- package/src/app/api/providers/route.js +4 -1
- package/src/app/api/usage/stream/route.js +74 -68
- package/src/app/api/v1/models/route.js +20 -6
- package/src/lib/db/index.js +3 -0
- package/src/lib/db/repos/settingsRepo.js +22 -1
- package/src/lib/oauth/services/xai.js +4 -4
- package/src/lib/validateComboModels.ts +48 -0
- package/src/shared/components/UsageStats.tsx +7 -1
- package/src/shared/hooks/useShutdown.ts +2 -4
- package/src/sse/handlers/chat.js +5 -1
- package/src/sse/services/antigravityQuota.ts +7 -3
- package/src/sse/services/model.ts +9 -20
- package/.next/server/chunks/5351.js +0 -67
- package/.next/static/chunks/3973-424848b943e2ecab.js +0 -1
- package/.next/static/chunks/7276-16ef14f7b2cd478d.js +0 -1
- package/.next/static/chunks/webpack-452a2f4aec1a53ee.js +0 -1
- /package/.next/static/{iz7psrsEuHZGPvj7rbSWc → awjDWqWCZbU3VVSuN7-oA}/_buildManifest.js +0 -0
- /package/.next/static/{iz7psrsEuHZGPvj7rbSWc → awjDWqWCZbU3VVSuN7-oA}/_ssgManifest.js +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[6812],{9618:(e,r,s)=>{Promise.resolve().then(s.bind(s,87852))},15764:(e,r,s)=>{"use strict";s.d(r,{CK:()=>i.default,G9:()=>x.default,Iz:()=>y.default,KX:()=>j.PanelSkeleton,LF:()=>o.default,LH:()=>m.default,Mu:()=>j.StatCardSkeleton,Nf:()=>d.default,Qv:()=>l.CardSkeleton,YW:()=>v.YW,gw:()=>f.default,jK:()=>c.default,nh:()=>g.default,pV:()=>v.pV,rq:()=>a.default,uR:()=>n.default,uo:()=>t.ConfirmModal,vE:()=>p.default,vj:()=>h.default,wI:()=>u.default,wn:()=>v.wn,zY:()=>v.zY}),s(58913);var t=s(3537),l=s(58350);s(30872),s(33526),s(42535),s(1279);var o=s(92802),a=s(25908),n=s(58729),i=s(24873),d=s(5258),c=s(
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[6812],{9618:(e,r,s)=>{Promise.resolve().then(s.bind(s,87852))},15764:(e,r,s)=>{"use strict";s.d(r,{CK:()=>i.default,G9:()=>x.default,Iz:()=>y.default,KX:()=>j.PanelSkeleton,LF:()=>o.default,LH:()=>m.default,Mu:()=>j.StatCardSkeleton,Nf:()=>d.default,Qv:()=>l.CardSkeleton,YW:()=>v.YW,gw:()=>f.default,jK:()=>c.default,nh:()=>g.default,pV:()=>v.pV,rq:()=>a.default,uR:()=>n.default,uo:()=>t.ConfirmModal,vE:()=>p.default,vj:()=>h.default,wI:()=>u.default,wn:()=>v.wn,zY:()=>v.zY}),s(58913);var t=s(3537),l=s(58350);s(30872),s(33526),s(42535),s(1279);var o=s(92802),a=s(25908),n=s(58729),i=s(24873),d=s(5258),c=s(80599);s(949),s(56776),s(53599),s(88336),s(69561);var x=s(37753),m=s(23444),p=s(93624),h=s(86920),u=s(65461);s(14580);var f=s(14670),y=s(70296);s(57779),s(22205);var j=s(43276),g=s(75862),v=s(92412)},87852:(e,r,s)=>{"use strict";s.r(r),s.d(r,{default:()=>E});var t=s(29798),l=s(15814),o=s(7387),a=s(28830),n=s(58765),i=s(47808),d=s(75116),c=s(23875),x=s(57008),m=s(36395),p=s(69865),h=s(69221),u=s(50343),f=s(52942),y=s(83829),j=s(75877),g=s(3194),v=s(3308),b=s(53784),k=s(18055),N=s(75669),C=s(77345),w=s(14231),P=s(7896),$=s(49787),A=s(1352),S=s(76120),D=s(15764),T=s(41671);function I(e={}){return{name:e.name||"",proxyUrl:e.proxyUrl||"",noProxy:e.noProxy||"",isActive:!1!==e.isActive,strictProxy:!0===e.strictProxy}}function E(){let[e,r]=(0,l.useState)([]),[s,E]=(0,l.useState)(!0),[U,z]=(0,l.useState)(!1),[O,R]=(0,l.useState)(!1),[F,L]=(0,l.useState)(!1),[W,_]=(0,l.useState)(!1),[G,V]=(0,l.useState)(!1),[q,Y]=(0,l.useState)(!1),[J,B]=(0,l.useState)(null),[H,K]=(0,l.useState)(I()),[M,Z]=(0,l.useState)(""),[X,Q]=(0,l.useState)({vercelToken:"",projectName:"vercel-relay"}),[ee,er]=(0,l.useState)({accountId:"",apiToken:"",projectName:"cloudflare-relay"}),[es,et]=(0,l.useState)({denoToken:"",orgDomain:"",projectName:""}),[el,eo]=(0,l.useState)(!1),[ea,en]=(0,l.useState)(!1),[ei,ed]=(0,l.useState)(!1),[ec,ex]=(0,l.useState)(null),[em,ep]=(0,l.useState)([]),[eh,eu]=(0,l.useState)(!1),[ef,ey]=(0,l.useState)({current:0,total:0}),[ej,eg]=(0,l.useState)(!1),[ev,eb]=(0,l.useState)(null),ek=(0,T.i)(),eN=(0,l.useCallback)(async()=>{try{let e=await fetch("/api/proxy-pools?includeUsage=true",{cache:"no-store"}),s=await e.json();e.ok&&r(s.proxyPools||[])}catch(e){console.log("Error fetching proxy pools:",e)}finally{E(!1)}},[]);(0,l.useEffect)(()=>{eN()},[eN]),(0,l.useEffect)(()=>{ep(r=>r.filter(r=>e.some(e=>e.id===r)))},[e]);let eC=()=>{B(null),K(I())},ew=()=>{eC(),z(!0)},eP=()=>{z(!1),eC()},e$=async()=>{let e={name:H.name.trim(),proxyUrl:H.proxyUrl.trim(),noProxy:H.noProxy.trim(),isActive:!0===H.isActive,strictProxy:!0===H.strictProxy};if(e.name&&e.proxyUrl){eo(!0);try{let r=!!J,s=await fetch(r?`/api/proxy-pools/${J.id}`:"/api/proxy-pools",{method:r?"PUT":"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(s.ok)await eN(),eP(),ek.success(J?"Proxy pool updated":"Proxy pool created");else{let e=await s.json();ek.error(e.error||"Failed to save proxy pool")}}catch(e){console.log("Error saving proxy pool:",e)}finally{eo(!1)}}},eA=async e=>{eb({title:"Delete Proxy Pool",message:`Delete proxy pool "${e.name}"?`,onConfirm:async()=>{eb(null);try{let s=await fetch(`/api/proxy-pools/${e.id}`,{method:"DELETE"});if(s.ok){r(r=>r.filter(r=>r.id!==e.id)),ek.success("Proxy pool deleted");return}let t=await s.json();409===s.status?ek.warning(`Cannot delete: ${t.boundConnectionCount||0} connection(s) are still using this pool.`):ek.error(t.error||"Failed to delete proxy pool")}catch(e){console.log("Error deleting proxy pool:",e),ek.error("Failed to delete proxy pool")}}})},eS=async e=>{ex(e);try{let r=await fetch(`/api/proxy-pools/${e}/test`,{method:"POST"}),s=await r.json();if(!r.ok)return void ek.error(s.error||"Failed to test proxy");await eN(),ek.success(s.ok?"Proxy test passed":"Proxy test failed")}catch(e){console.log("Error testing proxy pool:",e),ek.error("Failed to test proxy")}finally{ex(null)}},eD=async e=>{let s=!e.isActive;r(r=>r.map(r=>r.id===e.id?{...r,isActive:s}:r));try{(await fetch(`/api/proxy-pools/${e.id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({isActive:s})})).ok||(r(r=>r.map(r=>r.id===e.id?{...r,isActive:e.isActive}:r)),ek.error("Failed to update active state"))}catch(s){console.log("Error toggling active:",s),r(r=>r.map(r=>r.id===e.id?{...r,isActive:e.isActive}:r))}},eT=e.length>0&&em.length===e.length,eI=()=>ep([]),eE=async r=>{let s=em.length>0?em:e.map(e=>e.id);if(0!==s.length){eg(!0);try{let e=0,t=0;for(let l of s)try{(await fetch(`/api/proxy-pools/${l}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({isActive:r})})).ok?e+=1:t+=1}catch{t+=1}await eN(),ek.success(`${r?"Activated":"Deactivated"} ${e}${t?`, failed ${t}`:""}`)}finally{eg(!1)}}},eU=async()=>{0!==em.length&&eb({title:"Delete Proxy Pools",message:`Delete ${em.length} proxy pool(s)?`,onConfirm:async()=>{eb(null),eg(!0);try{let e=0,r=0,s=0;for(let t of em)try{let l=await fetch(`/api/proxy-pools/${t}`,{method:"DELETE"});l.ok?e+=1:409===l.status?r+=1:s+=1}catch{s+=1}await eN(),eI(),ek.success(`Deleted ${e}${r?`, ${r} bound`:""}${s?`, ${s} failed`:""}`)}finally{eg(!1)}}})},ez=async()=>{let r=em.length>0?e.filter(e=>em.includes(e.id)):e;if(0===r.length)return;eu(!0),ey({current:0,total:r.length});let s=0,t=[],l=0,o=[...r],a=async()=>{for(;o.length>0;){let e=o.shift();if(!e)break;try{let r=await fetch(`/api/proxy-pools/${e.id}/test`,{method:"POST"}),l=await r.json();r.ok&&l.ok?s+=1:t.push(e.id)}catch{t.push(e.id)}finally{ey({current:l+=1,total:r.length})}}};await Promise.all(Array.from({length:Math.min(10,r.length)},a)),await eN(),eu(!1),ey({current:0,total:0}),t.length>0?eb({title:"Disable Dead Proxies",message:`Alive: ${s}, Dead: ${t.length}.
|
|
2
2
|
|
|
3
3
|
Disable ${t.length} dead proxies?`,onConfirm:async()=>{eb(null),eg(!0);try{for(let e of t)try{await fetch(`/api/proxy-pools/${e}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({isActive:!1})})}catch{}await eN(),ek.success(`Disabled ${t.length} dead proxies`)}finally{eg(!1)}}}):ek.success(`Health check done. Alive: ${s}, Dead: ${t.length}`)},eO=()=>{ei||L(!1)},eR=()=>{ei||_(!1)},eF=()=>{ei||V(!1)},eL=async()=>{if(X.vercelToken.trim()){ed(!0);try{let e=await fetch("/api/proxy-pools/vercel-deploy",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(X)}),r=await e.json();e.ok?(await eN(),eO(),ek.success(`Deployed: ${r.deployUrl}`)):ek.error(r.error||"Deploy failed")}catch(e){console.log("Error deploying Vercel relay:",e),ek.error("Deploy failed")}finally{ed(!1)}}},eW=async()=>{if(ee.accountId.trim()&&ee.apiToken.trim()){ed(!0);try{let e=await fetch("/api/proxy-pools/cloudflare-deploy",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(ee)}),r=await e.json();e.ok?(await eN(),eR(),ek.success(`Deployed: ${r.deployUrl}`)):ek.error(r.error||"Deploy failed")}catch(e){console.log("Error deploying Cloudflare relay:",e),ek.error("Deploy failed")}finally{ed(!1)}}},e_=async()=>{if(es.denoToken.trim()){ed(!0);try{let e=await fetch("/api/proxy-pools/deno-deploy",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(es)}),r=await e.json();e.ok?(await eN(),eF(),ek.success(`Deployed: ${r.deployUrl}`)):ek.error(r.error||"Deploy failed")}catch(e){console.log("Error deploying Deno relay:",e),ek.error("Deploy failed")}finally{ed(!1)}}},eG=async()=>{let r=M.split(/\r?\n/).map(e=>e.trim()).filter(Boolean);if(0===r.length)return void ek.warning("Please paste at least one proxy line.");let s=[],t=[];if(r.forEach((e,r)=>{try{let t=(e=>{let r=e.trim();if(!r)return null;if(r.includes("://")){let e=new URL(r),s=e.port?`${e.hostname}:${e.port}`:e.hostname;return{proxyUrl:e.toString(),name:`Imported ${s}`}}let s=r.split(":");if(4===s.length){let[e,r,t,l]=s;if(!e||!r||!t||!l)throw Error("Invalid host:port:user:pass format");return{proxyUrl:new URL(`http://${encodeURIComponent(t)}:${encodeURIComponent(l)}@${e}:${r}`).toString(),name:`Imported ${e}:${r}`}}throw Error("Unsupported format")})(e);t&&s.push({...t,lineNumber:r+1})}catch(e){t.push(`Line ${r+1}: ${e.message}`)}}),t.length>0)return void ek.error(`Invalid proxy format:
|
|
4
|
-
${t.join("\n")}`);en(!0);try{let r=new Set(e.map(e=>`${(e.proxyUrl||"").trim()}|||${(e.noProxy||"").trim()}`)),t=0,l=0,o=0;for(let e of s){let s=`${e.proxyUrl}|||`;if(r.has(s)){l+=1;continue}(await fetch("/api/proxy-pools",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:e.name,proxyUrl:e.proxyUrl,noProxy:"",isActive:!0})})).ok?(t+=1,r.add(s)):o+=1}await eN(),R(!1),ek.success(`Batch import completed: Created ${t}, Skipped ${l}, Failed ${o}`)}catch(e){console.log("Error batch importing proxies:",e),ek.error("Batch import failed")}finally{en(!1)}},eV=(0,l.useMemo)(()=>e.filter(e=>!0===e.isActive).length,[e]);return s?(0,t.jsxs)(D.YW,{width:"wide",children:[(0,t.jsx)(D.KX,{}),(0,t.jsx)(D.KX,{})]}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(D.YW,{width:"wide",children:[(0,t.jsx)(D.zY,{title:"Proxy Pools",actions:(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(S.rI,{open:q,onOpenChange:Y,children:[(0,t.jsx)(S.ty,{asChild:!0,children:(0,t.jsxs)(k.$,{size:"sm",variant:"secondary",children:[(0,t.jsx)(o.A,{}),"Deploy Relay",q?(0,t.jsx)(a.A,{className:"ml-1 size-4"}):(0,t.jsx)(n.A,{className:"ml-1 size-4"})]})}),(0,t.jsxs)(S.SQ,{align:"end",className:"w-48",children:[(0,t.jsxs)(S._2,{onClick:()=>{er({accountId:"",apiToken:"",projectName:"cloudflare-relay"}),_(!0),Y(!1)},children:[(0,t.jsx)(i.A,{className:"size-5 text-orange-500"}),"Cloudflare Relay"]}),(0,t.jsxs)(S._2,{onClick:()=>{Q({vercelToken:"",projectName:"vercel-relay"}),L(!0),Y(!1)},children:[(0,t.jsx)(d.A,{className:"size-5 text-blue-500"}),"Vercel Relay"]}),(0,t.jsxs)(S._2,{onClick:()=>{et({denoToken:"",orgDomain:"",projectName:""}),V(!0),Y(!1)},children:[(0,t.jsx)(c.A,{className:"size-5 text-green-500"}),"Deno Relay"]})]})]}),(0,t.jsxs)(k.$,{size:"sm",variant:"secondary",onClick:()=>{Z(""),R(!0)},children:[(0,t.jsx)(x.A,{}),"Batch Import"]}),(0,t.jsxs)(k.$,{size:"sm",onClick:ew,children:[(0,t.jsx)(m.A,{}),"Add Proxy Pool"]})]})}),(0,t.jsx)(N.Zp,{size:"sm",children:(0,t.jsxs)(N.Wu,{children:[(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-2",children:[e.length>0&&(0,t.jsxs)("label",{className:"flex items-center gap-1.5 text-xs text-muted-foreground cursor-pointer",children:[(0,t.jsx)(P.S,{checked:eT,onCheckedChange:()=>ep(eT?[]:e.map(e=>e.id))}),eT?"Unselect all":"Select all"]}),(0,t.jsxs)(b.E,{variant:"secondary",children:["Total: ",e.length]}),(0,t.jsxs)(b.E,{variant:"default",children:["Active: ",eV]})]}),(em.length>0||eh)&&(0,t.jsxs)("div",{className:"mt-3 flex flex-wrap items-center gap-2 rounded-lg border border-primary/30 bg-primary/5 px-3 py-2",children:[(0,t.jsx)(p.A,{className:"size-4 text-primary"}),(0,t.jsx)("span",{className:"text-xs font-medium text-primary",children:em.length>0?`${em.length} selected`:"All pools"}),(0,t.jsxs)("div",{className:"ml-auto flex flex-wrap items-center gap-2",children:[(0,t.jsx)(k.$,{size:"sm",onClick:ez,disabled:eh||ej||0===e.length,children:eh?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(h.A,{className:"animate-spin"}),"Checking ",ef.current,"/",ef.total]}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(u.A,{}),"Health Check"]})}),em.length>0&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(k.$,{size:"sm",variant:"secondary",onClick:()=>eE(!0),disabled:ej||eh,children:[(0,t.jsx)(f.A,{}),"Activate"]}),(0,t.jsxs)(k.$,{size:"sm",variant:"secondary",onClick:()=>eE(!1),disabled:ej||eh,children:[(0,t.jsx)(y.A,{}),"Deactivate"]}),(0,t.jsxs)(k.$,{size:"sm",variant:"secondary",onClick:eU,disabled:ej||eh,children:[(0,t.jsx)(j.A,{}),"Delete"]}),(0,t.jsx)(k.$,{size:"sm",variant:"ghost",onClick:eI,disabled:ej||eh,children:"Clear"})]})]})]}),0===e.length?(0,t.jsxs)("div",{className:"text-center py-10",children:[(0,t.jsx)("p",{className:"text-foreground font-medium mb-1",children:"No proxy pool entries yet"}),(0,t.jsx)("p",{className:"text-sm text-muted-foreground mb-4",children:"Create a proxy pool entry, then assign it to connections."}),(0,t.jsxs)(k.$,{onClick:ew,children:[(0,t.jsx)(m.A,{}),"Add Proxy Pool"]})]}):null]})}),e.length>0&&(0,t.jsx)("div",{className:"flex flex-col gap-4",children:e.map(e=>{var r;return(0,t.jsx)(N.Zp,{size:"sm",children:(0,t.jsx)(N.Wu,{children:(0,t.jsxs)("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[(0,t.jsxs)("div",{className:"flex items-start gap-3 min-w-0 flex-1",children:[(0,t.jsx)(P.S,{checked:em.includes(e.id),onCheckedChange:()=>{let r;return r=e.id,ep(e=>e.includes(r)?e.filter(e=>e!==r):[...e,r])},className:"mt-0.5"}),(0,t.jsxs)("div",{className:"min-w-0 flex-1 space-y-1.5",children:[(0,t.jsxs)("div",{className:"flex items-center gap-1.5 flex-wrap",children:[(0,t.jsx)("p",{className:"min-w-0 max-w-full truncate text-sm font-medium sm:max-w-[18rem]",children:e.name}),(0,t.jsx)(b.E,{variant:"active"===(r=e.testStatus)?"default":"error"===r?"destructive":"secondary",children:e.testStatus||"unknown"}),(0,t.jsx)(b.E,{variant:e.isActive?"default":"secondary",children:e.isActive?"active":"inactive"}),"vercel"===e.type&&(0,t.jsx)(b.E,{variant:"secondary",children:"vercel relay"}),"cloudflare"===e.type&&(0,t.jsx)(b.E,{variant:"secondary",children:"cloudflare relay"}),(0,t.jsxs)(b.E,{variant:"secondary",children:[e.boundConnectionCount||0," bound"]})]}),(0,t.jsxs)("p",{className:"text-xs text-muted-foreground truncate",children:[e.proxyUrl,e.noProxy?` \xb7 No proxy: ${e.noProxy}`:"",e.lastError?` \xb7 ${e.lastError}`:""]})]})]}),(0,t.jsxs)("div",{className:"flex items-center justify-end gap-1",children:[(0,t.jsx)(w.d,{checked:!0===e.isActive,onCheckedChange:()=>eD(e),"aria-label":e.isActive?"Disable":"Enable"}),(0,t.jsxs)(A.m_,{children:[(0,t.jsx)(A.k$,{asChild:!0,children:(0,t.jsx)(k.$,{variant:"ghost",size:"icon-xs",onClick:()=>eS(e.id),disabled:ec===e.id,children:ec===e.id?(0,t.jsx)(h.A,{className:"size-4 animate-spin"}):(0,t.jsx)(g.A,{className:"size-4"})})}),(0,t.jsx)(A.ZI,{children:"Test proxy"})]}),(0,t.jsxs)(A.m_,{children:[(0,t.jsx)(A.k$,{asChild:!0,children:(0,t.jsx)(k.$,{variant:"ghost",size:"icon-xs",onClick:()=>{B(e),K(I(e)),z(!0)},children:(0,t.jsx)(v.A,{className:"size-4"})})}),(0,t.jsx)(A.ZI,{children:"Edit"})]}),(0,t.jsxs)(A.m_,{children:[(0,t.jsx)(A.k$,{asChild:!0,children:(0,t.jsx)(k.$,{variant:"ghost",size:"icon-xs",onClick:()=>eA(e),className:"text-red-500 hover:bg-red-500/10 hover:text-red-500",children:(0,t.jsx)(j.A,{className:"size-4"})})}),(0,t.jsx)(A.ZI,{children:"Delete"})]})]})]})})},e.id)})})]}),(0,t.jsx)($.lG,{open:O,onOpenChange:()=>{ea||R(!1)},children:(0,t.jsxs)($.Cf,{className:"max-w-md",children:[(0,t.jsx)($.c7,{children:(0,t.jsx)($.L3,{children:"Batch Import Proxies"})}),(0,t.jsxs)("div",{className:"flex flex-col gap-4 p-4",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"text-sm font-medium text-foreground mb-1 block",children:"Paste Proxy List (One per line)"}),(0,t.jsx)("textarea",{value:M,onChange:e=>Z(e.target.value),placeholder:"http://user:pass@127.0.0.1:7897\n127.0.0.1:7897:user:pass",className:"w-full min-h-[180px] py-2 px-3 text-sm text-foreground bg-white dark:bg-white/5 border border-border rounded-md focus:ring-1 focus:ring-primary/30 focus:border-primary/50 focus:outline-none transition-all"}),(0,t.jsx)("p",{className:"text-xs text-muted-foreground mt-1",children:"Supported formats: protocol://user:pass@host:port, host:port:user:pass"})]}),(0,t.jsx)(k.$,{onClick:eG,disabled:!M.trim()||ea,className:"w-full",children:ea?"Importing...":"Import"})]})]})}),(0,t.jsx)($.lG,{open:F,onOpenChange:eO,children:(0,t.jsxs)($.Cf,{className:"max-w-md",children:[(0,t.jsx)($.c7,{children:(0,t.jsx)($.L3,{children:"Deploy Vercel Relay"})}),(0,t.jsxs)("div",{className:"flex flex-col gap-4 p-4",children:[(0,t.jsxs)("div",{className:"rounded-lg bg-blue-500/5 border border-blue-500/10 p-3 flex flex-col gap-1.5",children:[(0,t.jsx)("p",{className:"text-sm text-foreground font-medium",children:"What is Vercel Relay?"}),(0,t.jsx)("p",{className:"text-xs text-muted-foreground",children:"Deploys an edge relay function to Vercel. All AI provider requests will be forwarded through Vercel's edge network, masking your real IP from providers."}),(0,t.jsxs)("ul",{className:"text-xs text-muted-foreground list-disc pl-4 space-y-0.5",children:[(0,t.jsx)("li",{children:"Your IP is replaced by Vercel's dynamic edge IPs (hundreds of IPs across 20+ global regions)"}),(0,t.jsx)("li",{children:"Vercel serves millions of apps — providers can't block Vercel IPs without affecting legitimate traffic"}),(0,t.jsx)("li",{children:"Free tier: 100GB bandwidth/month, 500K edge invocations"}),(0,t.jsx)("li",{children:"Deploy multiple relays on different accounts for more IP diversity"})]})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"text-sm font-medium text-foreground mb-1.5 block",children:"Vercel API Token"}),(0,t.jsx)(C.p,{value:X.vercelToken,onChange:e=>Q(r=>({...r,vercelToken:e.target.value})),placeholder:"your-vercel-api-token",type:"password"}),(0,t.jsxs)("p",{className:"text-xs text-muted-foreground mt-1",children:["Token is used once for deployment and not stored."," ",(0,t.jsx)("a",{href:"https://vercel.com/account/tokens",target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline",children:"Get token →"})]})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"text-sm font-medium text-foreground mb-1.5 block",children:"Project Name"}),(0,t.jsx)(C.p,{value:X.projectName,onChange:e=>Q(r=>({...r,projectName:e.target.value})),placeholder:"my-relay"}),(0,t.jsx)("p",{className:"text-xs text-muted-foreground mt-1",children:"Unique name for your Vercel project. Leave empty for auto-generated name."})]}),(0,t.jsx)(k.$,{onClick:eL,disabled:!X.vercelToken.trim()||ei,className:"w-full",children:ei?"Deploying... (may take ~1 min)":"Deploy"})]})]})}),(0,t.jsx)($.lG,{open:W,onOpenChange:eR,children:(0,t.jsxs)($.Cf,{className:"max-w-md",children:[(0,t.jsx)($.c7,{children:(0,t.jsx)($.L3,{children:"Deploy Cloudflare Relay"})}),(0,t.jsxs)("div",{className:"flex flex-col gap-4 p-4",children:[(0,t.jsxs)("div",{className:"rounded-lg bg-orange-500/5 border border-orange-500/10 p-3 flex flex-col gap-1.5",children:[(0,t.jsx)("p",{className:"text-sm text-foreground font-medium",children:"What is Cloudflare Relay?"}),(0,t.jsx)("p",{className:"text-xs text-muted-foreground",children:"Deploys a Cloudflare Worker as a proxy relay. All AI provider requests will be forwarded through Cloudflare's global edge network."}),(0,t.jsxs)("ul",{className:"text-xs text-muted-foreground list-disc pl-4 space-y-0.5",children:[(0,t.jsx)("li",{children:"High performance global routing and IP masking via Cloudflare Workers"}),(0,t.jsx)("li",{children:"Free tier: 100,000 requests per day"}),(0,t.jsx)("li",{children:"Requires Cloudflare Account ID and a Workers API Token (Edit Workers permission)"})]}),(0,t.jsxs)("div",{className:"mt-2 pt-2 border-t border-orange-500/10 text-xs text-muted-foreground",children:[(0,t.jsx)("p",{className:"font-medium text-foreground mb-1",children:"How to generate your API Token:"}),(0,t.jsxs)("ol",{className:"list-decimal pl-4 space-y-0.5",children:[(0,t.jsxs)("li",{children:["Go to ",(0,t.jsx)("b",{children:"My Profile"})," → ",(0,t.jsx)("b",{children:"API Tokens"})," → ",(0,t.jsx)("b",{children:"Create Token"})]}),(0,t.jsxs)("li",{children:["Scroll down to ",(0,t.jsx)("b",{children:"Custom Token"})," and click ",(0,t.jsx)("b",{children:"Get started"})]}),(0,t.jsxs)("li",{children:["Under ",(0,t.jsx)("b",{children:"Permissions"}),": Account | Workers Scripts | Edit"]}),(0,t.jsxs)("li",{children:["Under ",(0,t.jsx)("b",{children:"Account Resources"}),": Include | Account | ",(0,t.jsx)("i",{children:"Your Account Name"})]}),(0,t.jsxs)("li",{children:["Click ",(0,t.jsx)("b",{children:"Continue to summary"})," → ",(0,t.jsx)("b",{children:"Create Token"})]})]})]})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"text-sm font-medium text-foreground mb-1.5 block",children:"Account ID"}),(0,t.jsx)(C.p,{value:ee.accountId,onChange:e=>er(r=>({...r,accountId:e.target.value})),placeholder:"your-cloudflare-account-id"}),(0,t.jsx)("p",{className:"text-xs text-muted-foreground mt-1",children:"Found on the right side of the Cloudflare dashboard overview page."})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"text-sm font-medium text-foreground mb-1.5 block",children:"API Token"}),(0,t.jsx)(C.p,{value:ee.apiToken,onChange:e=>er(r=>({...r,apiToken:e.target.value})),placeholder:"your-cloudflare-api-token",type:"password"}),(0,t.jsxs)("p",{className:"text-xs text-muted-foreground mt-1",children:['Requires "Workers Scripts: Edit" permission.'," ",(0,t.jsx)("a",{href:"https://dash.cloudflare.com/profile/api-tokens",target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline",children:"Get token →"})]})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"text-sm font-medium text-foreground mb-1.5 block",children:"Worker Name"}),(0,t.jsx)(C.p,{value:ee.projectName,onChange:e=>er(r=>({...r,projectName:e.target.value})),placeholder:"my-relay"}),(0,t.jsx)("p",{className:"text-xs text-muted-foreground mt-1",children:"Unique name for your Cloudflare Worker. Leave empty for auto-generated name."})]}),(0,t.jsx)(k.$,{onClick:eW,disabled:!ee.accountId.trim()||!ee.apiToken.trim()||ei,className:"w-full",children:ei?"Deploying...":"Deploy Worker"})]})]})}),(0,t.jsx)($.lG,{open:G,onOpenChange:eF,children:(0,t.jsxs)($.Cf,{className:"max-w-md",children:[(0,t.jsx)($.c7,{children:(0,t.jsx)($.L3,{children:"Deploy Deno Relay"})}),(0,t.jsxs)("div",{className:"flex flex-col gap-4 p-4",children:[(0,t.jsxs)("div",{className:"rounded-lg bg-black/5 dark:bg-white/5 border border-border p-3 flex flex-col gap-1.5",children:[(0,t.jsx)("p",{className:"text-sm text-foreground font-medium",children:"What is Deno Relay?"}),(0,t.jsx)("p",{className:"text-xs text-muted-foreground",children:"Deploys a relay worker to Deno Deploy's global edge network. All AI provider requests are forwarded through Deno's edge, masking your real IP."}),(0,t.jsxs)("ul",{className:"text-xs text-muted-foreground list-disc pl-4 space-y-0.5",children:[(0,t.jsx)("li",{children:"Deno Deploy v2 runs on a high-performance global edge network"}),(0,t.jsx)("li",{children:"Free tier: 1M requests & 100GiB outbound traffic per month"}),(0,t.jsx)("li",{children:"No per-request CPU time limits (unlike Vercel/Cloudflare)"}),(0,t.jsx)("li",{children:"Support up to 20 active apps & 50 custom domains"}),(0,t.jsx)("li",{children:"Deploy multiple relays for maximum IP diversity"})]}),(0,t.jsxs)("div",{className:"mt-2 pt-2 border-t border-border text-xs text-muted-foreground",children:[(0,t.jsx)("p",{className:"font-medium text-foreground mb-1",children:"How to generate API token:"}),(0,t.jsxs)("ol",{className:"list-decimal pl-4 space-y-0.5",children:[(0,t.jsxs)("li",{children:["Go to ",(0,t.jsx)("b",{children:"console.deno.com"})]}),(0,t.jsxs)("li",{children:["Select your ",(0,t.jsx)("b",{children:"Organization"})," → ",(0,t.jsx)("b",{children:"Settings"})," → ",(0,t.jsx)("b",{children:"Organization Tokens"})]}),(0,t.jsxs)("li",{children:["Create a ",(0,t.jsx)("b",{children:"Organization Token"})," (prefix ",(0,t.jsx)("b",{children:"ddo_"}),")"]})]})]})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"text-sm font-medium text-foreground mb-1.5 block",children:"Deno Deploy API Token"}),(0,t.jsx)(C.p,{value:es.denoToken,onChange:e=>et(r=>({...r,denoToken:e.target.value})),placeholder:"ddo_xxxxxxxxxxxxxxxx",type:"password"}),(0,t.jsx)("p",{className:"text-xs text-muted-foreground mt-1",children:"Token is used once for deployment, not stored. Found in Organization Settings."})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"text-sm font-medium text-foreground mb-1.5 block",children:"Organization Domain"}),(0,t.jsx)(C.p,{value:es.orgDomain,onChange:e=>et(r=>({...r,orgDomain:e.target.value})),placeholder:"your-org.deno.net"}),(0,t.jsx)("p",{className:"text-xs text-muted-foreground mt-1",children:"Organization's default domain. Your relay URL will be in the format: https://my-relay.your-org.deno.net"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"text-sm font-medium text-foreground mb-1.5 block",children:"App Name"}),(0,t.jsx)(C.p,{value:es.projectName,onChange:e=>et(r=>({...r,projectName:e.target.value})),placeholder:"deno-relay"}),(0,t.jsx)("p",{className:"text-xs text-muted-foreground mt-1",children:"Unique app name. Leave empty for auto-generated name."})]}),(0,t.jsx)(k.$,{onClick:e_,disabled:!es.denoToken.trim()||!es.orgDomain.trim()||ei,className:"w-full",children:ei?"Deploying...":"Deploy Relay"})]})]})}),(0,t.jsx)($.lG,{open:U,onOpenChange:eP,children:(0,t.jsxs)($.Cf,{className:"max-w-md",children:[(0,t.jsx)($.c7,{children:(0,t.jsx)($.L3,{children:J?"Edit Proxy Pool":"Add Proxy Pool"})}),(0,t.jsxs)("div",{className:"flex flex-col gap-4 p-4",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"text-sm font-medium text-foreground mb-1.5 block",children:"Name"}),(0,t.jsx)(C.p,{value:H.name,onChange:e=>K(r=>({...r,name:e.target.value})),placeholder:"Office Proxy"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"text-sm font-medium text-foreground mb-1.5 block",children:"Proxy URL"}),(0,t.jsx)(C.p,{value:H.proxyUrl,onChange:e=>K(r=>({...r,proxyUrl:e.target.value})),placeholder:"http://127.0.0.1:7897"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"text-sm font-medium text-foreground mb-1.5 block",children:"No Proxy"}),(0,t.jsx)(C.p,{value:H.noProxy,onChange:e=>K(r=>({...r,noProxy:e.target.value})),placeholder:"localhost,127.0.0.1,.internal"}),(0,t.jsx)("p",{className:"text-xs text-muted-foreground mt-1",children:"Comma-separated hosts/domains to bypass proxy"})]}),(0,t.jsxs)("div",{className:"flex flex-col gap-3 rounded-lg border border-border/50 p-3 sm:flex-row sm:items-center sm:justify-between",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("p",{className:"font-medium text-sm",children:"Active"}),(0,t.jsx)("p",{className:"text-xs text-muted-foreground",children:"Inactive pools are ignored by runtime resolution."})]}),(0,t.jsx)(w.d,{checked:!0===H.isActive,onCheckedChange:()=>K(e=>({...e,isActive:!e.isActive})),disabled:el})]}),(0,t.jsxs)("div",{className:"flex flex-col gap-3 rounded-lg border border-border/50 p-3 sm:flex-row sm:items-center sm:justify-between",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("p",{className:"font-medium text-sm",children:"Strict Proxy"}),(0,t.jsx)("p",{className:"text-xs text-muted-foreground",children:"Fail request if proxy is unreachable instead of falling back to direct."})]}),(0,t.jsx)(w.d,{checked:!0===H.strictProxy,onCheckedChange:()=>K(e=>({...e,strictProxy:!e.strictProxy})),disabled:el})]}),(0,t.jsx)(k.$,{onClick:e$,disabled:!H.name.trim()||!H.proxyUrl.trim()||el,className:"w-full",children:el?"Saving...":"Save"})]})]})}),ev&&(0,t.jsx)($.lG,{open:!0,onOpenChange:e=>{e||eb(null)},children:(0,t.jsxs)($.Cf,{className:"max-w-sm",children:[(0,t.jsx)($.c7,{children:(0,t.jsx)($.L3,{children:ev.title})}),(0,t.jsx)("p",{className:"p-4 text-sm text-muted-foreground",children:ev.message}),(0,t.jsxs)($.Es,{children:[(0,t.jsx)(k.$,{variant:"ghost",onClick:()=>eb(null),children:"Cancel"}),(0,t.jsx)(k.$,{variant:"destructive",onClick:ev.onConfirm,children:"Confirm"})]})]})})]})}},92412:(e,r,s)=>{"use strict";s.d(r,{YW:()=>t.Page,pV:()=>t.CardGrid,wn:()=>t.Section,zY:()=>t.PageHeader}),s(16675),s(72778);var t=s(29575)}},e=>{e.O(0,[6766,5166,7552,9980,1471,5778,4484,3577,5862,5113,1699,7276,1722,159,4489,1278,1830,3973,427,9966,7358],()=>e(e.s=9618)),_N_E=e.O()}]);
|
|
4
|
+
${t.join("\n")}`);en(!0);try{let r=new Set(e.map(e=>`${(e.proxyUrl||"").trim()}|||${(e.noProxy||"").trim()}`)),t=0,l=0,o=0;for(let e of s){let s=`${e.proxyUrl}|||`;if(r.has(s)){l+=1;continue}(await fetch("/api/proxy-pools",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:e.name,proxyUrl:e.proxyUrl,noProxy:"",isActive:!0})})).ok?(t+=1,r.add(s)):o+=1}await eN(),R(!1),ek.success(`Batch import completed: Created ${t}, Skipped ${l}, Failed ${o}`)}catch(e){console.log("Error batch importing proxies:",e),ek.error("Batch import failed")}finally{en(!1)}},eV=(0,l.useMemo)(()=>e.filter(e=>!0===e.isActive).length,[e]);return s?(0,t.jsxs)(D.YW,{width:"wide",children:[(0,t.jsx)(D.KX,{}),(0,t.jsx)(D.KX,{})]}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(D.YW,{width:"wide",children:[(0,t.jsx)(D.zY,{title:"Proxy Pools",actions:(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(S.rI,{open:q,onOpenChange:Y,children:[(0,t.jsx)(S.ty,{asChild:!0,children:(0,t.jsxs)(k.$,{size:"sm",variant:"secondary",children:[(0,t.jsx)(o.A,{}),"Deploy Relay",q?(0,t.jsx)(a.A,{className:"ml-1 size-4"}):(0,t.jsx)(n.A,{className:"ml-1 size-4"})]})}),(0,t.jsxs)(S.SQ,{align:"end",className:"w-48",children:[(0,t.jsxs)(S._2,{onClick:()=>{er({accountId:"",apiToken:"",projectName:"cloudflare-relay"}),_(!0),Y(!1)},children:[(0,t.jsx)(i.A,{className:"size-5 text-orange-500"}),"Cloudflare Relay"]}),(0,t.jsxs)(S._2,{onClick:()=>{Q({vercelToken:"",projectName:"vercel-relay"}),L(!0),Y(!1)},children:[(0,t.jsx)(d.A,{className:"size-5 text-blue-500"}),"Vercel Relay"]}),(0,t.jsxs)(S._2,{onClick:()=>{et({denoToken:"",orgDomain:"",projectName:""}),V(!0),Y(!1)},children:[(0,t.jsx)(c.A,{className:"size-5 text-green-500"}),"Deno Relay"]})]})]}),(0,t.jsxs)(k.$,{size:"sm",variant:"secondary",onClick:()=>{Z(""),R(!0)},children:[(0,t.jsx)(x.A,{}),"Batch Import"]}),(0,t.jsxs)(k.$,{size:"sm",onClick:ew,children:[(0,t.jsx)(m.A,{}),"Add Proxy Pool"]})]})}),(0,t.jsx)(N.Zp,{size:"sm",children:(0,t.jsxs)(N.Wu,{children:[(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-2",children:[e.length>0&&(0,t.jsxs)("label",{className:"flex items-center gap-1.5 text-xs text-muted-foreground cursor-pointer",children:[(0,t.jsx)(P.S,{checked:eT,onCheckedChange:()=>ep(eT?[]:e.map(e=>e.id))}),eT?"Unselect all":"Select all"]}),(0,t.jsxs)(b.E,{variant:"secondary",children:["Total: ",e.length]}),(0,t.jsxs)(b.E,{variant:"default",children:["Active: ",eV]})]}),(em.length>0||eh)&&(0,t.jsxs)("div",{className:"mt-3 flex flex-wrap items-center gap-2 rounded-lg border border-primary/30 bg-primary/5 px-3 py-2",children:[(0,t.jsx)(p.A,{className:"size-4 text-primary"}),(0,t.jsx)("span",{className:"text-xs font-medium text-primary",children:em.length>0?`${em.length} selected`:"All pools"}),(0,t.jsxs)("div",{className:"ml-auto flex flex-wrap items-center gap-2",children:[(0,t.jsx)(k.$,{size:"sm",onClick:ez,disabled:eh||ej||0===e.length,children:eh?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(h.A,{className:"animate-spin"}),"Checking ",ef.current,"/",ef.total]}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(u.A,{}),"Health Check"]})}),em.length>0&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(k.$,{size:"sm",variant:"secondary",onClick:()=>eE(!0),disabled:ej||eh,children:[(0,t.jsx)(f.A,{}),"Activate"]}),(0,t.jsxs)(k.$,{size:"sm",variant:"secondary",onClick:()=>eE(!1),disabled:ej||eh,children:[(0,t.jsx)(y.A,{}),"Deactivate"]}),(0,t.jsxs)(k.$,{size:"sm",variant:"secondary",onClick:eU,disabled:ej||eh,children:[(0,t.jsx)(j.A,{}),"Delete"]}),(0,t.jsx)(k.$,{size:"sm",variant:"ghost",onClick:eI,disabled:ej||eh,children:"Clear"})]})]})]}),0===e.length?(0,t.jsxs)("div",{className:"text-center py-10",children:[(0,t.jsx)("p",{className:"text-foreground font-medium mb-1",children:"No proxy pool entries yet"}),(0,t.jsx)("p",{className:"text-sm text-muted-foreground mb-4",children:"Create a proxy pool entry, then assign it to connections."}),(0,t.jsxs)(k.$,{onClick:ew,children:[(0,t.jsx)(m.A,{}),"Add Proxy Pool"]})]}):null]})}),e.length>0&&(0,t.jsx)("div",{className:"flex flex-col gap-4",children:e.map(e=>{var r;return(0,t.jsx)(N.Zp,{size:"sm",children:(0,t.jsx)(N.Wu,{children:(0,t.jsxs)("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[(0,t.jsxs)("div",{className:"flex items-start gap-3 min-w-0 flex-1",children:[(0,t.jsx)(P.S,{checked:em.includes(e.id),onCheckedChange:()=>{let r;return r=e.id,ep(e=>e.includes(r)?e.filter(e=>e!==r):[...e,r])},className:"mt-0.5"}),(0,t.jsxs)("div",{className:"min-w-0 flex-1 space-y-1.5",children:[(0,t.jsxs)("div",{className:"flex items-center gap-1.5 flex-wrap",children:[(0,t.jsx)("p",{className:"min-w-0 max-w-full truncate text-sm font-medium sm:max-w-[18rem]",children:e.name}),(0,t.jsx)(b.E,{variant:"active"===(r=e.testStatus)?"default":"error"===r?"destructive":"secondary",children:e.testStatus||"unknown"}),(0,t.jsx)(b.E,{variant:e.isActive?"default":"secondary",children:e.isActive?"active":"inactive"}),"vercel"===e.type&&(0,t.jsx)(b.E,{variant:"secondary",children:"vercel relay"}),"cloudflare"===e.type&&(0,t.jsx)(b.E,{variant:"secondary",children:"cloudflare relay"}),(0,t.jsxs)(b.E,{variant:"secondary",children:[e.boundConnectionCount||0," bound"]})]}),(0,t.jsxs)("p",{className:"text-xs text-muted-foreground truncate",children:[e.proxyUrl,e.noProxy?` \xb7 No proxy: ${e.noProxy}`:"",e.lastError?` \xb7 ${e.lastError}`:""]})]})]}),(0,t.jsxs)("div",{className:"flex items-center justify-end gap-1",children:[(0,t.jsx)(w.d,{checked:!0===e.isActive,onCheckedChange:()=>eD(e),"aria-label":e.isActive?"Disable":"Enable"}),(0,t.jsxs)(A.m_,{children:[(0,t.jsx)(A.k$,{asChild:!0,children:(0,t.jsx)(k.$,{variant:"ghost",size:"icon-xs",onClick:()=>eS(e.id),disabled:ec===e.id,children:ec===e.id?(0,t.jsx)(h.A,{className:"size-4 animate-spin"}):(0,t.jsx)(g.A,{className:"size-4"})})}),(0,t.jsx)(A.ZI,{children:"Test proxy"})]}),(0,t.jsxs)(A.m_,{children:[(0,t.jsx)(A.k$,{asChild:!0,children:(0,t.jsx)(k.$,{variant:"ghost",size:"icon-xs",onClick:()=>{B(e),K(I(e)),z(!0)},children:(0,t.jsx)(v.A,{className:"size-4"})})}),(0,t.jsx)(A.ZI,{children:"Edit"})]}),(0,t.jsxs)(A.m_,{children:[(0,t.jsx)(A.k$,{asChild:!0,children:(0,t.jsx)(k.$,{variant:"ghost",size:"icon-xs",onClick:()=>eA(e),className:"text-red-500 hover:bg-red-500/10 hover:text-red-500",children:(0,t.jsx)(j.A,{className:"size-4"})})}),(0,t.jsx)(A.ZI,{children:"Delete"})]})]})]})})},e.id)})})]}),(0,t.jsx)($.lG,{open:O,onOpenChange:()=>{ea||R(!1)},children:(0,t.jsxs)($.Cf,{className:"max-w-md",children:[(0,t.jsx)($.c7,{children:(0,t.jsx)($.L3,{children:"Batch Import Proxies"})}),(0,t.jsxs)("div",{className:"flex flex-col gap-4 p-4",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"text-sm font-medium text-foreground mb-1 block",children:"Paste Proxy List (One per line)"}),(0,t.jsx)("textarea",{value:M,onChange:e=>Z(e.target.value),placeholder:"http://user:pass@127.0.0.1:7897\n127.0.0.1:7897:user:pass",className:"w-full min-h-[180px] py-2 px-3 text-sm text-foreground bg-white dark:bg-white/5 border border-border rounded-md focus:ring-1 focus:ring-primary/30 focus:border-primary/50 focus:outline-none transition-all"}),(0,t.jsx)("p",{className:"text-xs text-muted-foreground mt-1",children:"Supported formats: protocol://user:pass@host:port, host:port:user:pass"})]}),(0,t.jsx)(k.$,{onClick:eG,disabled:!M.trim()||ea,className:"w-full",children:ea?"Importing...":"Import"})]})]})}),(0,t.jsx)($.lG,{open:F,onOpenChange:eO,children:(0,t.jsxs)($.Cf,{className:"max-w-md",children:[(0,t.jsx)($.c7,{children:(0,t.jsx)($.L3,{children:"Deploy Vercel Relay"})}),(0,t.jsxs)("div",{className:"flex flex-col gap-4 p-4",children:[(0,t.jsxs)("div",{className:"rounded-lg bg-blue-500/5 border border-blue-500/10 p-3 flex flex-col gap-1.5",children:[(0,t.jsx)("p",{className:"text-sm text-foreground font-medium",children:"What is Vercel Relay?"}),(0,t.jsx)("p",{className:"text-xs text-muted-foreground",children:"Deploys an edge relay function to Vercel. All AI provider requests will be forwarded through Vercel's edge network, masking your real IP from providers."}),(0,t.jsxs)("ul",{className:"text-xs text-muted-foreground list-disc pl-4 space-y-0.5",children:[(0,t.jsx)("li",{children:"Your IP is replaced by Vercel's dynamic edge IPs (hundreds of IPs across 20+ global regions)"}),(0,t.jsx)("li",{children:"Vercel serves millions of apps — providers can't block Vercel IPs without affecting legitimate traffic"}),(0,t.jsx)("li",{children:"Free tier: 100GB bandwidth/month, 500K edge invocations"}),(0,t.jsx)("li",{children:"Deploy multiple relays on different accounts for more IP diversity"})]})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"text-sm font-medium text-foreground mb-1.5 block",children:"Vercel API Token"}),(0,t.jsx)(C.p,{value:X.vercelToken,onChange:e=>Q(r=>({...r,vercelToken:e.target.value})),placeholder:"your-vercel-api-token",type:"password"}),(0,t.jsxs)("p",{className:"text-xs text-muted-foreground mt-1",children:["Token is used once for deployment and not stored."," ",(0,t.jsx)("a",{href:"https://vercel.com/account/tokens",target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline",children:"Get token →"})]})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"text-sm font-medium text-foreground mb-1.5 block",children:"Project Name"}),(0,t.jsx)(C.p,{value:X.projectName,onChange:e=>Q(r=>({...r,projectName:e.target.value})),placeholder:"my-relay"}),(0,t.jsx)("p",{className:"text-xs text-muted-foreground mt-1",children:"Unique name for your Vercel project. Leave empty for auto-generated name."})]}),(0,t.jsx)(k.$,{onClick:eL,disabled:!X.vercelToken.trim()||ei,className:"w-full",children:ei?"Deploying... (may take ~1 min)":"Deploy"})]})]})}),(0,t.jsx)($.lG,{open:W,onOpenChange:eR,children:(0,t.jsxs)($.Cf,{className:"max-w-md",children:[(0,t.jsx)($.c7,{children:(0,t.jsx)($.L3,{children:"Deploy Cloudflare Relay"})}),(0,t.jsxs)("div",{className:"flex flex-col gap-4 p-4",children:[(0,t.jsxs)("div",{className:"rounded-lg bg-orange-500/5 border border-orange-500/10 p-3 flex flex-col gap-1.5",children:[(0,t.jsx)("p",{className:"text-sm text-foreground font-medium",children:"What is Cloudflare Relay?"}),(0,t.jsx)("p",{className:"text-xs text-muted-foreground",children:"Deploys a Cloudflare Worker as a proxy relay. All AI provider requests will be forwarded through Cloudflare's global edge network."}),(0,t.jsxs)("ul",{className:"text-xs text-muted-foreground list-disc pl-4 space-y-0.5",children:[(0,t.jsx)("li",{children:"High performance global routing and IP masking via Cloudflare Workers"}),(0,t.jsx)("li",{children:"Free tier: 100,000 requests per day"}),(0,t.jsx)("li",{children:"Requires Cloudflare Account ID and a Workers API Token (Edit Workers permission)"})]}),(0,t.jsxs)("div",{className:"mt-2 pt-2 border-t border-orange-500/10 text-xs text-muted-foreground",children:[(0,t.jsx)("p",{className:"font-medium text-foreground mb-1",children:"How to generate your API Token:"}),(0,t.jsxs)("ol",{className:"list-decimal pl-4 space-y-0.5",children:[(0,t.jsxs)("li",{children:["Go to ",(0,t.jsx)("b",{children:"My Profile"})," → ",(0,t.jsx)("b",{children:"API Tokens"})," → ",(0,t.jsx)("b",{children:"Create Token"})]}),(0,t.jsxs)("li",{children:["Scroll down to ",(0,t.jsx)("b",{children:"Custom Token"})," and click ",(0,t.jsx)("b",{children:"Get started"})]}),(0,t.jsxs)("li",{children:["Under ",(0,t.jsx)("b",{children:"Permissions"}),": Account | Workers Scripts | Edit"]}),(0,t.jsxs)("li",{children:["Under ",(0,t.jsx)("b",{children:"Account Resources"}),": Include | Account | ",(0,t.jsx)("i",{children:"Your Account Name"})]}),(0,t.jsxs)("li",{children:["Click ",(0,t.jsx)("b",{children:"Continue to summary"})," → ",(0,t.jsx)("b",{children:"Create Token"})]})]})]})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"text-sm font-medium text-foreground mb-1.5 block",children:"Account ID"}),(0,t.jsx)(C.p,{value:ee.accountId,onChange:e=>er(r=>({...r,accountId:e.target.value})),placeholder:"your-cloudflare-account-id"}),(0,t.jsx)("p",{className:"text-xs text-muted-foreground mt-1",children:"Found on the right side of the Cloudflare dashboard overview page."})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"text-sm font-medium text-foreground mb-1.5 block",children:"API Token"}),(0,t.jsx)(C.p,{value:ee.apiToken,onChange:e=>er(r=>({...r,apiToken:e.target.value})),placeholder:"your-cloudflare-api-token",type:"password"}),(0,t.jsxs)("p",{className:"text-xs text-muted-foreground mt-1",children:['Requires "Workers Scripts: Edit" permission.'," ",(0,t.jsx)("a",{href:"https://dash.cloudflare.com/profile/api-tokens",target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline",children:"Get token →"})]})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"text-sm font-medium text-foreground mb-1.5 block",children:"Worker Name"}),(0,t.jsx)(C.p,{value:ee.projectName,onChange:e=>er(r=>({...r,projectName:e.target.value})),placeholder:"my-relay"}),(0,t.jsx)("p",{className:"text-xs text-muted-foreground mt-1",children:"Unique name for your Cloudflare Worker. Leave empty for auto-generated name."})]}),(0,t.jsx)(k.$,{onClick:eW,disabled:!ee.accountId.trim()||!ee.apiToken.trim()||ei,className:"w-full",children:ei?"Deploying...":"Deploy Worker"})]})]})}),(0,t.jsx)($.lG,{open:G,onOpenChange:eF,children:(0,t.jsxs)($.Cf,{className:"max-w-md",children:[(0,t.jsx)($.c7,{children:(0,t.jsx)($.L3,{children:"Deploy Deno Relay"})}),(0,t.jsxs)("div",{className:"flex flex-col gap-4 p-4",children:[(0,t.jsxs)("div",{className:"rounded-lg bg-black/5 dark:bg-white/5 border border-border p-3 flex flex-col gap-1.5",children:[(0,t.jsx)("p",{className:"text-sm text-foreground font-medium",children:"What is Deno Relay?"}),(0,t.jsx)("p",{className:"text-xs text-muted-foreground",children:"Deploys a relay worker to Deno Deploy's global edge network. All AI provider requests are forwarded through Deno's edge, masking your real IP."}),(0,t.jsxs)("ul",{className:"text-xs text-muted-foreground list-disc pl-4 space-y-0.5",children:[(0,t.jsx)("li",{children:"Deno Deploy v2 runs on a high-performance global edge network"}),(0,t.jsx)("li",{children:"Free tier: 1M requests & 100GiB outbound traffic per month"}),(0,t.jsx)("li",{children:"No per-request CPU time limits (unlike Vercel/Cloudflare)"}),(0,t.jsx)("li",{children:"Support up to 20 active apps & 50 custom domains"}),(0,t.jsx)("li",{children:"Deploy multiple relays for maximum IP diversity"})]}),(0,t.jsxs)("div",{className:"mt-2 pt-2 border-t border-border text-xs text-muted-foreground",children:[(0,t.jsx)("p",{className:"font-medium text-foreground mb-1",children:"How to generate API token:"}),(0,t.jsxs)("ol",{className:"list-decimal pl-4 space-y-0.5",children:[(0,t.jsxs)("li",{children:["Go to ",(0,t.jsx)("b",{children:"console.deno.com"})]}),(0,t.jsxs)("li",{children:["Select your ",(0,t.jsx)("b",{children:"Organization"})," → ",(0,t.jsx)("b",{children:"Settings"})," → ",(0,t.jsx)("b",{children:"Organization Tokens"})]}),(0,t.jsxs)("li",{children:["Create a ",(0,t.jsx)("b",{children:"Organization Token"})," (prefix ",(0,t.jsx)("b",{children:"ddo_"}),")"]})]})]})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"text-sm font-medium text-foreground mb-1.5 block",children:"Deno Deploy API Token"}),(0,t.jsx)(C.p,{value:es.denoToken,onChange:e=>et(r=>({...r,denoToken:e.target.value})),placeholder:"ddo_xxxxxxxxxxxxxxxx",type:"password"}),(0,t.jsx)("p",{className:"text-xs text-muted-foreground mt-1",children:"Token is used once for deployment, not stored. Found in Organization Settings."})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"text-sm font-medium text-foreground mb-1.5 block",children:"Organization Domain"}),(0,t.jsx)(C.p,{value:es.orgDomain,onChange:e=>et(r=>({...r,orgDomain:e.target.value})),placeholder:"your-org.deno.net"}),(0,t.jsx)("p",{className:"text-xs text-muted-foreground mt-1",children:"Organization's default domain. Your relay URL will be in the format: https://my-relay.your-org.deno.net"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"text-sm font-medium text-foreground mb-1.5 block",children:"App Name"}),(0,t.jsx)(C.p,{value:es.projectName,onChange:e=>et(r=>({...r,projectName:e.target.value})),placeholder:"deno-relay"}),(0,t.jsx)("p",{className:"text-xs text-muted-foreground mt-1",children:"Unique app name. Leave empty for auto-generated name."})]}),(0,t.jsx)(k.$,{onClick:e_,disabled:!es.denoToken.trim()||!es.orgDomain.trim()||ei,className:"w-full",children:ei?"Deploying...":"Deploy Relay"})]})]})}),(0,t.jsx)($.lG,{open:U,onOpenChange:eP,children:(0,t.jsxs)($.Cf,{className:"max-w-md",children:[(0,t.jsx)($.c7,{children:(0,t.jsx)($.L3,{children:J?"Edit Proxy Pool":"Add Proxy Pool"})}),(0,t.jsxs)("div",{className:"flex flex-col gap-4 p-4",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"text-sm font-medium text-foreground mb-1.5 block",children:"Name"}),(0,t.jsx)(C.p,{value:H.name,onChange:e=>K(r=>({...r,name:e.target.value})),placeholder:"Office Proxy"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"text-sm font-medium text-foreground mb-1.5 block",children:"Proxy URL"}),(0,t.jsx)(C.p,{value:H.proxyUrl,onChange:e=>K(r=>({...r,proxyUrl:e.target.value})),placeholder:"http://127.0.0.1:7897"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"text-sm font-medium text-foreground mb-1.5 block",children:"No Proxy"}),(0,t.jsx)(C.p,{value:H.noProxy,onChange:e=>K(r=>({...r,noProxy:e.target.value})),placeholder:"localhost,127.0.0.1,.internal"}),(0,t.jsx)("p",{className:"text-xs text-muted-foreground mt-1",children:"Comma-separated hosts/domains to bypass proxy"})]}),(0,t.jsxs)("div",{className:"flex flex-col gap-3 rounded-lg border border-border/50 p-3 sm:flex-row sm:items-center sm:justify-between",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("p",{className:"font-medium text-sm",children:"Active"}),(0,t.jsx)("p",{className:"text-xs text-muted-foreground",children:"Inactive pools are ignored by runtime resolution."})]}),(0,t.jsx)(w.d,{checked:!0===H.isActive,onCheckedChange:()=>K(e=>({...e,isActive:!e.isActive})),disabled:el})]}),(0,t.jsxs)("div",{className:"flex flex-col gap-3 rounded-lg border border-border/50 p-3 sm:flex-row sm:items-center sm:justify-between",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("p",{className:"font-medium text-sm",children:"Strict Proxy"}),(0,t.jsx)("p",{className:"text-xs text-muted-foreground",children:"Fail request if proxy is unreachable instead of falling back to direct."})]}),(0,t.jsx)(w.d,{checked:!0===H.strictProxy,onCheckedChange:()=>K(e=>({...e,strictProxy:!e.strictProxy})),disabled:el})]}),(0,t.jsx)(k.$,{onClick:e$,disabled:!H.name.trim()||!H.proxyUrl.trim()||el,className:"w-full",children:el?"Saving...":"Save"})]})]})}),ev&&(0,t.jsx)($.lG,{open:!0,onOpenChange:e=>{e||eb(null)},children:(0,t.jsxs)($.Cf,{className:"max-w-sm",children:[(0,t.jsx)($.c7,{children:(0,t.jsx)($.L3,{children:ev.title})}),(0,t.jsx)("p",{className:"p-4 text-sm text-muted-foreground",children:ev.message}),(0,t.jsxs)($.Es,{children:[(0,t.jsx)(k.$,{variant:"ghost",onClick:()=>eb(null),children:"Cancel"}),(0,t.jsx)(k.$,{variant:"destructive",onClick:ev.onConfirm,children:"Confirm"})]})]})})]})}},92412:(e,r,s)=>{"use strict";s.d(r,{YW:()=>t.Page,pV:()=>t.CardGrid,wn:()=>t.Section,zY:()=>t.PageHeader}),s(16675),s(72778);var t=s(29575)}},e=>{e.O(0,[6766,5166,7552,9980,1471,5778,4484,3577,5862,5113,1699,1722,159,4489,1278,1830,6770,427,9966,7358],()=>e(e.s=9618)),_N_E=e.O()}]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[7414],{1352:(e,t,r)=>{"use strict";r.d(t,{Bc:()=>n,ZI:()=>l,k$:()=>d,m_:()=>o});var a=r(29798);r(15814);var s=r(5471),i=r(44484);function n({delayDuration:e=0,...t}){return(0,a.jsx)(i.Kq,{"data-slot":"tooltip-provider",delayDuration:e,...t})}function o({...e}){return(0,a.jsx)(i.bL,{"data-slot":"tooltip",...e})}function d({...e}){return(0,a.jsx)(i.l9,{"data-slot":"tooltip-trigger",...e})}function l({className:e,sideOffset:t=0,children:r,...n}){return(0,a.jsx)(i.ZL,{children:(0,a.jsxs)(i.UC,{"data-slot":"tooltip-content",sideOffset:t,className:(0,s.cn)("z-50 inline-flex w-fit max-w-xs origin-(--radix-tooltip-content-transform-origin) items-center gap-1.5 rounded-md bg-foreground px-3 py-1.5 text-xs text-background has-data-[slot=kbd]:pr-1.5 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 **:data-[slot=kbd]:relative **:data-[slot=kbd]:isolate **:data-[slot=kbd]:z-50 **:data-[slot=kbd]:rounded-sm data-[state=delayed-open]:animate-in data-[state=delayed-open]:fade-in-0 data-[state=delayed-open]:zoom-in-95 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",e),...n,children:[r,(0,a.jsx)(i.i3,{className:"z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px] bg-foreground fill-foreground"})]})})}},4836:(e,t,r)=>{"use strict";r.d(t,{A:()=>o});var a=r(15814);let s=(...e)=>e.filter((e,t,r)=>!!e&&""!==e.trim()&&r.indexOf(e)===t).join(" ").trim(),i={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":2,"stroke-linecap":"round","stroke-linejoin":"round"};var n=r(28145);let o=(0,a.forwardRef)(({color:e,size:t,width:r,height:o,strokeWidth:d,absoluteStrokeWidth:l,nonScalingStroke:c,className:u="",children:m,iconNode:x=[],icon:h={node:x,aliases:[],size:24},...p},g)=>{let{size:f=24,strokeWidth:b=2,absoluteStrokeWidth:v=!1,nonScalingStroke:j=!1,color:y="currentColor",className:k=""}=(0,n.T)()??{},N=!!m||(e=>{for(let t in e)if(t.startsWith("aria-")||"role"===t||"title"===t)return!0;return!1})(p),[w,z,S=[]]=function(e,t={}){return function(e,t={}){let r=t.attributeNames??{},a=e=>r[e]??e,n=e.size??e.width??i.width,o=e.size??e.height??i.height,d=e.aliases?.filter(e=>"string"==typeof e&&""!==e.trim()).map(e=>`lucide-${e}`)??[],l=[...e.name?[`lucide-${e.name}`]:[],...d],c=t.className?.split(" ").filter(Boolean)??[],u=!1===t.includeDefaultClasses?s(...c):s("lucide",...l,...c),m=t.absoluteStrokeWidth?Number(t.strokeWidth??i["stroke-width"])*Number(e.size??e.width??i.width)/Number(t.size??t.width??i.width):t.strokeWidth??i["stroke-width"];return["svg",{...Object.entries(i).reduce((e,[t,r])=>(e[a(t)]=r,e),{}),..."color"in t&&t.color&&{[a("stroke")]:t.color},..."size"in t&&null!=t.size&&{[a("width")]:t.size,[a("height")]:t.size},..."width"in t&&null!=t.width&&{[a("width")]:t.width},..."height"in t&&null!=t.height&&{[a("height")]:t.height},[a("stroke-width")]:m,...u&&{[a("class")]:u},[a("viewBox")]:`0 0 ${n} ${o}`,...!1===t.hasA11yProp?{[a("aria-hidden")]:"true"}:{},..."attributes"in t&&t.attributes},e.node.map(e=>{let[r,s,i]=e,n=t.nonScalingStroke?{[a("vector-effect")]:"non-scaling-stroke",...s}:s;return i?[r,n,i]:[r,n]})]}(e,{...t,attributeNames:{...t.attributeNames,class:"className","stroke-width":"strokeWidth","stroke-linecap":"strokeLinecap","stroke-linejoin":"strokeLinejoin","vector-effect":"vectorEffect"}})}(h,{color:e??y,width:r??t??f,height:o??t??f,strokeWidth:d??b,absoluteStrokeWidth:l??v,nonScalingStroke:c??j,className:s(k,u),hasA11yProp:N,attributes:p});return(0,a.createElement)(w,{ref:g,...z},[...S.map(([e,t])=>(0,a.createElement)(e,t)),...Array.isArray(m)?m:[m]])})},14748:(e,t,r)=>{"use strict";function a(){for(var e,t,r=0,a="",s=arguments.length;r<s;r++)(e=arguments[r])&&(t=function e(t){var r,a,s="";if("string"==typeof t||"number"==typeof t)s+=t;else if("object"==typeof t)if(Array.isArray(t)){var i=t.length;for(r=0;r<i;r++)t[r]&&(a=e(t[r]))&&(s&&(s+=" "),s+=a)}else for(a in t)t[a]&&(s&&(s+=" "),s+=a);return s}(e))&&(a&&(a+=" "),a+=t);return a}r.d(t,{$:()=>a})},18055:(e,t,r)=>{"use strict";r.d(t,{$:()=>d});var a=r(29798);r(15814);var s=r(54366),i=r(5471),n=r(80954);let o=(0,s.F)("group/button inline-flex shrink-0 items-center justify-center rounded-md border border-transparent bg-clip-padding text-sm font-medium whitespace-nowrap transition-all outline-none select-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 active:not-aria-[haspopup]:translate-y-px disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/80",outline:"border-border bg-background shadow-xs hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:border-input dark:bg-input/30 dark:hover:bg-input/50",secondary:"bg-secondary text-secondary-foreground hover:bg-[color-mix(in_oklch,var(--secondary),var(--foreground)_5%)] aria-expanded:bg-secondary aria-expanded:text-secondary-foreground",ghost:"hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:hover:bg-muted/50",destructive:"bg-destructive/10 text-destructive hover:bg-destructive/20 focus-visible:border-destructive/40 focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:hover:bg-destructive/30 dark:focus-visible:ring-destructive/40",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 gap-1.5 px-2.5 in-data-[slot=button-group]:rounded-md has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",xs:"h-6 gap-1 rounded-[min(var(--radius-md),8px)] px-2 text-xs in-data-[slot=button-group]:rounded-md has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3",sm:"h-8 gap-1 rounded-[min(var(--radius-md),10px)] px-2.5 in-data-[slot=button-group]:rounded-md has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5",lg:"h-10 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",icon:"size-9","icon-xs":"size-6 rounded-[min(var(--radius-md),8px)] in-data-[slot=button-group]:rounded-md [&_svg:not([class*='size-'])]:size-3","icon-sm":"size-8 rounded-[min(var(--radius-md),10px)] in-data-[slot=button-group]:rounded-md","icon-lg":"size-10"}},defaultVariants:{variant:"default",size:"default"}});function d({className:e,variant:t="default",size:r="default",asChild:s=!1,...l}){let c=s?n.bL:"button";return(0,a.jsx)(c,{"data-slot":"button","data-variant":t,"data-size":r,className:(0,i.cn)(o({variant:t,size:r,className:e})),...l})}},28145:(e,t,r)=>{"use strict";r.d(t,{T:()=>n,a:()=>i});var a=r(15814);let s=(0,a.createContext)({});function i({children:e,size:t,color:r,strokeWidth:n,absoluteStrokeWidth:o,nonScalingStroke:d,className:l}){let c=(0,a.useMemo)(()=>({size:t,color:r,strokeWidth:n,absoluteStrokeWidth:o,nonScalingStroke:d,className:l}),[t,r,n,o,d,l]);return(0,a.createElement)(s.Provider,{value:c},e)}let n=()=>(0,a.useContext)(s)},34327:(e,t,r)=>{"use strict";r.d(t,{default:()=>$});var a=r(29798),s=r(15814),i=r(83604),n=r(75669),o=r(18055),d=r(53784),l=r(1352),c=r(5471);function u({className:e,...t}){return(0,a.jsx)("div",{"data-slot":"table-container",className:"relative w-full overflow-x-auto",children:(0,a.jsx)("table",{"data-slot":"table",className:(0,c.cn)("w-full caption-bottom text-sm",e),...t})})}function m({className:e,...t}){return(0,a.jsx)("thead",{"data-slot":"table-header",className:(0,c.cn)("[&_tr]:border-b",e),...t})}function x({className:e,...t}){return(0,a.jsx)("tbody",{"data-slot":"table-body",className:(0,c.cn)("[&_tr:last-child]:border-0",e),...t})}function h({className:e,...t}){return(0,a.jsx)("tr",{"data-slot":"table-row",className:(0,c.cn)("border-b transition-colors hover:bg-muted/50 has-aria-expanded:bg-muted/50 data-[state=selected]:bg-muted",e),...t})}function p({className:e,...t}){return(0,a.jsx)("th",{"data-slot":"table-head",className:(0,c.cn)("h-10 px-2 text-left align-middle font-medium whitespace-nowrap text-foreground [&:has([role=checkbox])]:pr-0",e),...t})}function g({className:e,...t}){return(0,a.jsx)("td",{"data-slot":"table-cell",className:(0,c.cn)("p-2 align-middle whitespace-nowrap [&:has([role=checkbox])]:pr-0",e),...t})}var f=r(92348),b=r(20884),v=r(31009),j=r(2401),y=r(726),k=r(94829),N=r(43665);let w=[{id:"today",label:"Today"},{id:"yesterday",label:"Yesterday"},{id:"last7d",label:"7 days"},{id:"last30d",label:"30 days"},{id:"all",label:"All time"}],z=e=>e?e>=1e6?`${(e/1e6).toFixed(2)}M`:e>=1e3?`${(e/1e3).toFixed(1)}K`:String(e):0===e?"0":"—",S={applied:"Prompt exceeded threshold",below_threshold:"Below size threshold",not_profitable:"Compression not profitable",below_min_chars:"Below minimum chars",below_min_tokens:"Below minimum tokens",unsupported_model:"Model not in allowlist",unsupported_format:"Non-Claude request format",timeout:"Compression timed out",transform_error:"Transform error",passthrough:"Passthrough",disabled:"Disabled",not_installed:"Not installed"};function _({label:e,value:t,sub:r,tone:s}){return(0,a.jsx)(n.Zp,{children:(0,a.jsxs)(n.Wu,{className:"p-4",children:[(0,a.jsx)("p",{className:"text-xs tracking-wide text-muted-foreground uppercase",children:e}),(0,a.jsx)("p",{className:`mt-1 text-xl font-semibold ${s||""}`,children:t}),r&&(0,a.jsx)("p",{className:"mt-0.5 text-xs text-muted-foreground",children:r})]})})}function $(){let[e,t]=(0,s.useState)(null),[r,c]=(0,s.useState)(null),[$,C]=(0,s.useState)(null),[E,P]=(0,s.useState)(null),[A,L]=(0,s.useState)("last7d"),[W,O]=(0,s.useState)(!0),B=(0,s.useCallback)(async()=>{O(!0);try{let[e,r,a]=await Promise.all([fetch("/api/pxpipe/status",{headers:{"Cache-Control":"no-store"}}),fetch("/api/pxpipe/stats"),fetch("/api/pxpipe/logs?limit=50")]);t(await e.json()),C(await r.json()),P(await a.json());let s=await fetch("/api/pxpipe/health",{method:"POST"});c(await s.json())}catch{}finally{O(!1)}},[]);(0,s.useEffect)(()=>{B()},[B]);let T=$?.windows?.[A],Z=e?e.installed?r?.healthy?"Healthy":e.running?"Running":"Stopped":"Not installed":"—";return(0,a.jsxs)("div",{className:"space-y-6 p-6",children:[(0,a.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[(0,a.jsxs)("h2",{className:"flex items-center gap-2 text-lg font-semibold",children:[(0,a.jsx)(i.A,{className:"text-primary"}),"PXPIPE Dashboard"]}),(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("a",{href:"/dashboard/token-saver",className:"text-xs text-primary underline hover:opacity-80",children:"Token Saver settings"}),(0,a.jsx)(o.$,{size:"sm",variant:"ghost",onClick:B,disabled:W,children:W?"Refreshing…":"Refresh"})]})]}),(0,a.jsxs)("div",{className:"grid grid-cols-2 gap-3 md:grid-cols-3 lg:grid-cols-6",children:[(0,a.jsx)(_,{label:"Status",value:Z,tone:r?.healthy?"text-emerald-600":e?.installed?"text-amber-600":"text-muted-foreground",sub:e?.enabled?"Enabled in pipeline":"Disabled in pipeline"}),(0,a.jsx)(_,{label:"Version",value:e?.version?`v${e.version}`:"—",sub:"pxpipe-proxy"}),(0,a.jsx)(_,{label:"Uptime",value:(e=>{if(!e||e<=0)return"—";let t=Math.floor(e/6e4),r=Math.floor(t/60);return r>0?`${r}h${String(t%60).padStart(2,"0")}m`:`${t}m`})(e?.uptimeMs),sub:"module loaded"}),(0,a.jsx)(_,{label:"Requests",value:T?T.requests.toLocaleString():"—"}),(0,a.jsx)(_,{label:"Compressed",value:T?T.compressed.toLocaleString():"—",tone:"text-emerald-600"}),(0,a.jsx)(_,{label:"Bypassed",value:T?T.bypassed.toLocaleString():"—"})]}),(0,a.jsx)(n.Zp,{children:(0,a.jsxs)(n.Wu,{className:"p-4",children:[(0,a.jsxs)("div",{className:"mb-4 flex flex-wrap items-center justify-between gap-3",children:[(0,a.jsx)("h3",{className:"font-medium",children:"Token savings (estimated)"}),(0,a.jsx)("div",{className:"flex items-center gap-1 rounded-lg border border-border bg-muted p-1",children:w.map(e=>(0,a.jsx)("button",{onClick:()=>L(e.id),className:`rounded-md px-3 py-1 text-xs font-medium transition-colors ${A===e.id?"bg-primary text-primary-foreground shadow-sm":"text-muted-foreground hover:text-foreground hover:bg-muted"}`,children:e.label},e.id))})]}),(0,a.jsxs)("div",{className:"grid grid-cols-2 gap-4 text-center md:grid-cols-4",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"text-xs text-muted-foreground",children:"Original tokens"}),(0,a.jsx)("p",{className:"text-lg font-semibold",children:T?z(T.tokensBeforeEst):"—"})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"text-xs text-muted-foreground",children:"After PXPIPE"}),(0,a.jsx)("p",{className:"text-lg font-semibold",children:T?z(T.tokensAfterEst):"—"})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"text-xs text-muted-foreground",children:"Saved"}),(0,a.jsx)("p",{className:"text-lg font-semibold text-emerald-600",children:T?z(T.tokensSavedEst):"—"})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"text-xs text-muted-foreground",children:"Reduction"}),(0,a.jsx)("p",{className:"text-lg font-semibold text-emerald-600",children:T?`${T.savedPct}%`:"—"})]})]}),(0,a.jsxs)("p",{className:"mt-3 text-xs text-muted-foreground",children:["Estimates from body size before/after imaging; billed usage per request (recorded on the Usage page) remains the ground truth. Images generated:"," ",T?T.imagesGenerated.toLocaleString():"—"," \xb7 avg compression time:"," ",T?`${T.avgCompressionMs}ms`:"—"," \xb7 errors: ",T?T.errors:"—"]})]})}),(0,a.jsx)(n.Zp,{children:(0,a.jsxs)(n.Wu,{className:"p-4",children:[(0,a.jsx)("h3",{className:"mb-3 font-medium",children:"Tokens saved — last 30 days"}),$?.timeline?.some(e=>e.tokensSavedEst>0)?(0,a.jsx)(f.u,{width:"100%",height:220,children:(0,a.jsxs)(b.Q,{data:$.timeline,margin:{top:4,right:8,left:0,bottom:0},children:[(0,a.jsx)("defs",{children:(0,a.jsxs)("linearGradient",{id:"gradPxpipe",x1:"0",y1:"0",x2:"0",y2:"1",children:[(0,a.jsx)("stop",{offset:"5%",stopColor:"#10b981",stopOpacity:.25}),(0,a.jsx)("stop",{offset:"95%",stopColor:"#10b981",stopOpacity:0})]})}),(0,a.jsx)(v.d,{strokeDasharray:"3 3",strokeOpacity:.2}),(0,a.jsx)(j.W,{dataKey:"date",tick:{fontSize:11},tickFormatter:e=>e.slice(5)}),(0,a.jsx)(y.h,{tick:{fontSize:11},tickFormatter:z,width:48}),(0,a.jsx)(k.m,{formatter:e=>[z(e),"Tokens saved"],labelFormatter:e=>e}),(0,a.jsx)(N.Gk,{type:"monotone",dataKey:"tokensSavedEst",stroke:"#10b981",fill:"url(#gradPxpipe)",strokeWidth:2})]})}):(0,a.jsx)("div",{className:"flex h-32 items-center justify-center text-sm text-muted-foreground",children:"No savings recorded yet — enable PXPIPE in the Token Saver and route a large Claude-format request."})]})}),(0,a.jsx)(n.Zp,{children:(0,a.jsxs)(n.Wu,{className:"p-4",children:[(0,a.jsx)("h3",{className:"mb-3 font-medium",children:"History"}),(0,a.jsx)("div",{className:"overflow-x-auto",children:(0,a.jsxs)(u,{children:[(0,a.jsx)(m,{children:(0,a.jsxs)(h,{children:[(0,a.jsx)(p,{children:"Time"}),(0,a.jsx)(p,{children:"Model"}),(0,a.jsx)(p,{className:"text-right",children:"Original"}),(0,a.jsx)(p,{className:"text-right",children:"Compressed"}),(0,a.jsx)(p,{className:"text-right",children:"Saved"}),(0,a.jsx)(p,{className:"text-right",children:"%"}),(0,a.jsx)(p,{className:"text-right",children:"Duration"}),(0,a.jsx)(p,{children:"Status"})]})}),(0,a.jsxs)(x,{children:[($?.recent||[]).slice(0,50).map((e,t)=>(0,a.jsxs)(h,{children:[(0,a.jsx)(g,{className:"whitespace-nowrap text-muted-foreground",children:new Date(e.ts).toLocaleString()}),(0,a.jsx)(g,{className:"font-mono text-xs",children:e.provider?`${e.provider}/${e.model}`:e.model||"—"}),(0,a.jsx)(g,{className:"text-right font-mono text-xs",children:e.applied?z(e.tokensBeforeEst):"—"}),(0,a.jsx)(g,{className:"text-right font-mono text-xs",children:e.applied?z(e.tokensAfterEst):"—"}),(0,a.jsx)(g,{className:"text-right font-mono text-xs text-emerald-600",children:e.applied?z(e.tokensSavedEst):"—"}),(0,a.jsx)(g,{className:"text-right font-mono text-xs",children:e.applied?`${e.savedPct}%`:"—"}),(0,a.jsx)(g,{className:"text-right font-mono text-xs",children:null!=e.durationMs?`${e.durationMs}ms`:"—"}),(0,a.jsx)(g,{children:(0,a.jsxs)(l.m_,{children:[(0,a.jsx)(l.k$,{asChild:!0,children:(0,a.jsx)(d.E,{variant:"default",className:e.applied?"bg-emerald-500/15 text-emerald-600":"transform_error"===e.reason||"timeout"===e.reason?"bg-destructive/15 text-destructive":"bg-amber-500/15 text-amber-600",children:e.applied?"Compressed":S[e.reason??""]||e.reason})}),e.detail?(0,a.jsx)(l.ZI,{children:e.detail}):null]})})]},`${e.ts}-${t}`)),(!$?.recent||0===$.recent.length)&&(0,a.jsx)(h,{children:(0,a.jsx)(g,{colSpan:8,className:"py-6 text-center text-sm text-muted-foreground",children:"No PXPIPE activity yet"})})]})]})})]})}),(0,a.jsx)(n.Zp,{children:(0,a.jsxs)(n.Wu,{className:"p-4",id:"logs",children:[(0,a.jsx)("h3",{className:"mb-3 font-medium",children:"PXPIPE Logs"}),E?.installLog?(0,a.jsx)("pre",{className:"max-h-64 overflow-x-auto overflow-y-auto rounded bg-black/5 p-3 font-mono text-xs whitespace-pre-wrap dark:bg-white/5",children:E.installLog}):(0,a.jsx)("p",{className:"text-sm text-muted-foreground",children:"No install log yet."})]})})]})}},50009:(e,t,r)=>{"use strict";r.d(t,{A:()=>i});var a=r(15814),s=r(4836);function i(e,t=[],r=[]){let n,o="string"==typeof e?function(e,t,r=[]){if(null==t)throw Error("[lucide]: iconNode is required when icon name is used");return{name:e?.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),size:24,node:t,...r.length>0?{aliases:r}:{}}}(e,t,r):e,d=(0,a.forwardRef)(({className:e,...t},r)=>(0,a.createElement)(s.A,{ref:r,icon:o,className:e,...t}));return o.name&&(d.displayName=(n=(e=>{let t="",r=!1;for(let a of e){if("-"===a||"_"===a||a<=" "){r=t.length>0;continue}0===t.length?t+=a.toLowerCase():t+=r?a.toUpperCase():a,r=!1}return t})(o.name)).charAt(0).toUpperCase()+n.slice(1)),d}},53784:(e,t,r)=>{"use strict";r.d(t,{E:()=>d});var a=r(29798);r(15814);var s=r(54366),i=r(5471),n=r(80954);let o=(0,s.F)("group/badge inline-flex h-5 w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-4xl border border-transparent px-2 py-0.5 text-xs font-medium whitespace-nowrap transition-all focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&>svg]:pointer-events-none [&>svg]:size-3!",{variants:{variant:{default:"bg-primary text-primary-foreground [a]:hover:bg-primary/80",secondary:"bg-secondary text-secondary-foreground [a]:hover:bg-secondary/80",destructive:"bg-destructive/10 text-destructive focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:focus-visible:ring-destructive/40 [a]:hover:bg-destructive/20",outline:"border-border text-foreground [a]:hover:bg-muted [a]:hover:text-muted-foreground",ghost:"hover:bg-muted hover:text-muted-foreground dark:hover:bg-muted/50",link:"text-primary underline-offset-4 hover:underline"}},defaultVariants:{variant:"default"}});function d({className:e,variant:t="default",asChild:r=!1,...s}){let l=r?n.bL:"span";return(0,a.jsx)(l,{"data-slot":"badge","data-variant":t,className:(0,i.cn)(o({variant:t}),e),...s})}},54366:(e,t,r)=>{"use strict";r.d(t,{F:()=>n});var a=r(14748);let s=e=>"boolean"==typeof e?`${e}`:0===e?"0":e,i=a.$,n=(e,t)=>r=>{var a;if((null==t?void 0:t.variants)==null)return i(e,null==r?void 0:r.class,null==r?void 0:r.className);let{variants:n,defaultVariants:o}=t,d=Object.keys(n).map(e=>{let t=null==r?void 0:r[e],a=null==o?void 0:o[e];if(null===t)return null;let i=s(t)||s(a);return n[e][i]}),l=r&&Object.entries(r).reduce((e,t)=>{let[r,a]=t;return void 0===a||(e[r]=a),e},{});return i(e,d,null==t||null==(a=t.compoundVariants)?void 0:a.reduce((e,t)=>{let{class:r,className:a,...s}=t;return Object.entries(s).every(e=>{let[t,r]=e;return Array.isArray(r)?r.includes({...o,...l}[t]):({...o,...l})[t]===r})?[...e,r,a]:e},[]),null==r?void 0:r.class,null==r?void 0:r.className)}},75669:(e,t,r)=>{"use strict";r.d(t,{BT:()=>d,Wu:()=>c,X9:()=>l,ZB:()=>o,Zp:()=>i,aR:()=>n});var a=r(29798);r(15814);var s=r(5471);function i({className:e,size:t="default",...r}){return(0,a.jsx)("div",{"data-slot":"card","data-size":t,className:(0,s.cn)("group/card flex flex-col gap-(--card-spacing) overflow-hidden rounded-xl bg-card py-(--card-spacing) text-sm text-card-foreground shadow-xs ring-1 ring-foreground/10 [--card-spacing:--spacing(6)] has-[>img:first-child]:pt-0 data-[size=sm]:[--card-spacing:--spacing(4)] *:[img:first-child]:rounded-t-xl *:[img:last-child]:rounded-b-xl",e),...r})}function n({className:e,...t}){return(0,a.jsx)("div",{"data-slot":"card-header",className:(0,s.cn)("group/card-header @container/card-header grid auto-rows-min items-start gap-1 rounded-t-xl px-(--card-spacing) has-data-[slot=card-action]:grid-cols-[1fr_auto] has-data-[slot=card-description]:grid-rows-[auto_auto] [.border-b]:pb-(--card-spacing)",e),...t})}function o({className:e,...t}){return(0,a.jsx)("div",{"data-slot":"card-title",className:(0,s.cn)("font-heading text-base leading-normal font-medium group-data-[size=sm]/card:text-sm",e),...t})}function d({className:e,...t}){return(0,a.jsx)("div",{"data-slot":"card-description",className:(0,s.cn)("text-sm text-muted-foreground",e),...t})}function l({className:e,...t}){return(0,a.jsx)("div",{"data-slot":"card-action",className:(0,s.cn)("col-start-2 row-span-2 row-start-1 self-start justify-self-end",e),...t})}function c({className:e,...t}){return(0,a.jsx)("div",{"data-slot":"card-content",className:(0,s.cn)("flex flex-col gap-3 px-(--card-spacing)",e),...t})}},80327:(e,t,r)=>{Promise.resolve().then(r.bind(r,34327))},83604:(e,t,r)=>{"use strict";r.d(t,{A:()=>i});var a=r(50009);let s={name:"image",size:24,node:[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]]};s.node;let i=(0,a.A)(s)}},e=>{e.O(0,[5166,7552,9980,4484,7276,427,9966,7358],()=>e(e.s=80327)),_N_E=e.O()}]);
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[7414],{1352:(e,t,r)=>{"use strict";r.d(t,{Bc:()=>n,ZI:()=>l,k$:()=>d,m_:()=>o});var a=r(29798);r(15814);var s=r(5471),i=r(44484);function n({delayDuration:e=0,...t}){return(0,a.jsx)(i.Kq,{"data-slot":"tooltip-provider",delayDuration:e,...t})}function o({...e}){return(0,a.jsx)(i.bL,{"data-slot":"tooltip",...e})}function d({...e}){return(0,a.jsx)(i.l9,{"data-slot":"tooltip-trigger",...e})}function l({className:e,sideOffset:t=0,children:r,...n}){return(0,a.jsx)(i.ZL,{children:(0,a.jsxs)(i.UC,{"data-slot":"tooltip-content",sideOffset:t,className:(0,s.cn)("z-50 inline-flex w-fit max-w-xs origin-(--radix-tooltip-content-transform-origin) items-center gap-1.5 rounded-md bg-foreground px-3 py-1.5 text-xs text-background has-data-[slot=kbd]:pr-1.5 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 **:data-[slot=kbd]:relative **:data-[slot=kbd]:isolate **:data-[slot=kbd]:z-50 **:data-[slot=kbd]:rounded-sm data-[state=delayed-open]:animate-in data-[state=delayed-open]:fade-in-0 data-[state=delayed-open]:zoom-in-95 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",e),...n,children:[r,(0,a.jsx)(i.i3,{className:"z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px] bg-foreground fill-foreground"})]})})}},4836:(e,t,r)=>{"use strict";r.d(t,{A:()=>o});var a=r(15814);let s=(...e)=>e.filter((e,t,r)=>!!e&&""!==e.trim()&&r.indexOf(e)===t).join(" ").trim(),i={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":2,"stroke-linecap":"round","stroke-linejoin":"round"};var n=r(28145);let o=(0,a.forwardRef)(({color:e,size:t,width:r,height:o,strokeWidth:d,absoluteStrokeWidth:l,nonScalingStroke:c,className:u="",children:m,iconNode:x=[],icon:h={node:x,aliases:[],size:24},...p},g)=>{let{size:f=24,strokeWidth:b=2,absoluteStrokeWidth:v=!1,nonScalingStroke:j=!1,color:y="currentColor",className:k=""}=(0,n.T)()??{},N=!!m||(e=>{for(let t in e)if(t.startsWith("aria-")||"role"===t||"title"===t)return!0;return!1})(p),[w,z,S=[]]=function(e,t={}){return function(e,t={}){let r=t.attributeNames??{},a=e=>r[e]??e,n=e.size??e.width??i.width,o=e.size??e.height??i.height,d=e.aliases?.filter(e=>"string"==typeof e&&""!==e.trim()).map(e=>`lucide-${e}`)??[],l=[...e.name?[`lucide-${e.name}`]:[],...d],c=t.className?.split(" ").filter(Boolean)??[],u=!1===t.includeDefaultClasses?s(...c):s("lucide",...l,...c),m=t.absoluteStrokeWidth?Number(t.strokeWidth??i["stroke-width"])*Number(e.size??e.width??i.width)/Number(t.size??t.width??i.width):t.strokeWidth??i["stroke-width"];return["svg",{...Object.entries(i).reduce((e,[t,r])=>(e[a(t)]=r,e),{}),..."color"in t&&t.color&&{[a("stroke")]:t.color},..."size"in t&&null!=t.size&&{[a("width")]:t.size,[a("height")]:t.size},..."width"in t&&null!=t.width&&{[a("width")]:t.width},..."height"in t&&null!=t.height&&{[a("height")]:t.height},[a("stroke-width")]:m,...u&&{[a("class")]:u},[a("viewBox")]:`0 0 ${n} ${o}`,...!1===t.hasA11yProp?{[a("aria-hidden")]:"true"}:{},..."attributes"in t&&t.attributes},e.node.map(e=>{let[r,s,i]=e,n=t.nonScalingStroke?{[a("vector-effect")]:"non-scaling-stroke",...s}:s;return i?[r,n,i]:[r,n]})]}(e,{...t,attributeNames:{...t.attributeNames,class:"className","stroke-width":"strokeWidth","stroke-linecap":"strokeLinecap","stroke-linejoin":"strokeLinejoin","vector-effect":"vectorEffect"}})}(h,{color:e??y,width:r??t??f,height:o??t??f,strokeWidth:d??b,absoluteStrokeWidth:l??v,nonScalingStroke:c??j,className:s(k,u),hasA11yProp:N,attributes:p});return(0,a.createElement)(w,{ref:g,...z},[...S.map(([e,t])=>(0,a.createElement)(e,t)),...Array.isArray(m)?m:[m]])})},14748:(e,t,r)=>{"use strict";function a(){for(var e,t,r=0,a="",s=arguments.length;r<s;r++)(e=arguments[r])&&(t=function e(t){var r,a,s="";if("string"==typeof t||"number"==typeof t)s+=t;else if("object"==typeof t)if(Array.isArray(t)){var i=t.length;for(r=0;r<i;r++)t[r]&&(a=e(t[r]))&&(s&&(s+=" "),s+=a)}else for(a in t)t[a]&&(s&&(s+=" "),s+=a);return s}(e))&&(a&&(a+=" "),a+=t);return a}r.d(t,{$:()=>a})},18055:(e,t,r)=>{"use strict";r.d(t,{$:()=>d});var a=r(29798);r(15814);var s=r(54366),i=r(5471),n=r(80954);let o=(0,s.F)("group/button inline-flex shrink-0 items-center justify-center rounded-md border border-transparent bg-clip-padding text-sm font-medium whitespace-nowrap transition-all outline-none select-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 active:not-aria-[haspopup]:translate-y-px disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/80",outline:"border-border bg-background shadow-xs hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:border-input dark:bg-input/30 dark:hover:bg-input/50",secondary:"bg-secondary text-secondary-foreground hover:bg-[color-mix(in_oklch,var(--secondary),var(--foreground)_5%)] aria-expanded:bg-secondary aria-expanded:text-secondary-foreground",ghost:"hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:hover:bg-muted/50",destructive:"bg-destructive/10 text-destructive hover:bg-destructive/20 focus-visible:border-destructive/40 focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:hover:bg-destructive/30 dark:focus-visible:ring-destructive/40",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 gap-1.5 px-2.5 in-data-[slot=button-group]:rounded-md has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",xs:"h-6 gap-1 rounded-[min(var(--radius-md),8px)] px-2 text-xs in-data-[slot=button-group]:rounded-md has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3",sm:"h-8 gap-1 rounded-[min(var(--radius-md),10px)] px-2.5 in-data-[slot=button-group]:rounded-md has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5",lg:"h-10 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",icon:"size-9","icon-xs":"size-6 rounded-[min(var(--radius-md),8px)] in-data-[slot=button-group]:rounded-md [&_svg:not([class*='size-'])]:size-3","icon-sm":"size-8 rounded-[min(var(--radius-md),10px)] in-data-[slot=button-group]:rounded-md","icon-lg":"size-10"}},defaultVariants:{variant:"default",size:"default"}});function d({className:e,variant:t="default",size:r="default",asChild:s=!1,...l}){let c=s?n.bL:"button";return(0,a.jsx)(c,{"data-slot":"button","data-variant":t,"data-size":r,className:(0,i.cn)(o({variant:t,size:r,className:e})),...l})}},28145:(e,t,r)=>{"use strict";r.d(t,{T:()=>n,a:()=>i});var a=r(15814);let s=(0,a.createContext)({});function i({children:e,size:t,color:r,strokeWidth:n,absoluteStrokeWidth:o,nonScalingStroke:d,className:l}){let c=(0,a.useMemo)(()=>({size:t,color:r,strokeWidth:n,absoluteStrokeWidth:o,nonScalingStroke:d,className:l}),[t,r,n,o,d,l]);return(0,a.createElement)(s.Provider,{value:c},e)}let n=()=>(0,a.useContext)(s)},34327:(e,t,r)=>{"use strict";r.d(t,{default:()=>$});var a=r(29798),s=r(15814),i=r(83604),n=r(75669),o=r(18055),d=r(53784),l=r(1352),c=r(5471);function u({className:e,...t}){return(0,a.jsx)("div",{"data-slot":"table-container",className:"relative w-full overflow-x-auto",children:(0,a.jsx)("table",{"data-slot":"table",className:(0,c.cn)("w-full caption-bottom text-sm",e),...t})})}function m({className:e,...t}){return(0,a.jsx)("thead",{"data-slot":"table-header",className:(0,c.cn)("[&_tr]:border-b",e),...t})}function x({className:e,...t}){return(0,a.jsx)("tbody",{"data-slot":"table-body",className:(0,c.cn)("[&_tr:last-child]:border-0",e),...t})}function h({className:e,...t}){return(0,a.jsx)("tr",{"data-slot":"table-row",className:(0,c.cn)("border-b transition-colors hover:bg-muted/50 has-aria-expanded:bg-muted/50 data-[state=selected]:bg-muted",e),...t})}function p({className:e,...t}){return(0,a.jsx)("th",{"data-slot":"table-head",className:(0,c.cn)("h-10 px-2 text-left align-middle font-medium whitespace-nowrap text-foreground [&:has([role=checkbox])]:pr-0",e),...t})}function g({className:e,...t}){return(0,a.jsx)("td",{"data-slot":"table-cell",className:(0,c.cn)("p-2 align-middle whitespace-nowrap [&:has([role=checkbox])]:pr-0",e),...t})}var f=r(92348),b=r(20884),v=r(31009),j=r(2401),y=r(726),k=r(94829),N=r(43665);let w=[{id:"today",label:"Today"},{id:"yesterday",label:"Yesterday"},{id:"last7d",label:"7 days"},{id:"last30d",label:"30 days"},{id:"all",label:"All time"}],z=e=>e?e>=1e6?`${(e/1e6).toFixed(2)}M`:e>=1e3?`${(e/1e3).toFixed(1)}K`:String(e):0===e?"0":"—",S={applied:"Prompt exceeded threshold",below_threshold:"Below size threshold",not_profitable:"Compression not profitable",below_min_chars:"Below minimum chars",below_min_tokens:"Below minimum tokens",unsupported_model:"Model not in allowlist",unsupported_format:"Non-Claude request format",timeout:"Compression timed out",transform_error:"Transform error",passthrough:"Passthrough",disabled:"Disabled",not_installed:"Not installed"};function _({label:e,value:t,sub:r,tone:s}){return(0,a.jsx)(n.Zp,{children:(0,a.jsxs)(n.Wu,{className:"p-4",children:[(0,a.jsx)("p",{className:"text-xs tracking-wide text-muted-foreground uppercase",children:e}),(0,a.jsx)("p",{className:`mt-1 text-xl font-semibold ${s||""}`,children:t}),r&&(0,a.jsx)("p",{className:"mt-0.5 text-xs text-muted-foreground",children:r})]})})}function $(){let[e,t]=(0,s.useState)(null),[r,c]=(0,s.useState)(null),[$,C]=(0,s.useState)(null),[E,P]=(0,s.useState)(null),[A,L]=(0,s.useState)("last7d"),[W,O]=(0,s.useState)(!0),B=(0,s.useCallback)(async()=>{O(!0);try{let[e,r,a]=await Promise.all([fetch("/api/pxpipe/status",{headers:{"Cache-Control":"no-store"}}),fetch("/api/pxpipe/stats"),fetch("/api/pxpipe/logs?limit=50")]);t(await e.json()),C(await r.json()),P(await a.json());let s=await fetch("/api/pxpipe/health",{method:"POST"});c(await s.json())}catch{}finally{O(!1)}},[]);(0,s.useEffect)(()=>{B()},[B]);let T=$?.windows?.[A],Z=e?e.installed?r?.healthy?"Healthy":e.running?"Running":"Stopped":"Not installed":"—";return(0,a.jsxs)("div",{className:"space-y-6 p-6",children:[(0,a.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[(0,a.jsxs)("h2",{className:"flex items-center gap-2 text-lg font-semibold",children:[(0,a.jsx)(i.A,{className:"text-primary"}),"PXPIPE Dashboard"]}),(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("a",{href:"/dashboard/token-saver",className:"text-xs text-primary underline hover:opacity-80",children:"Token Saver settings"}),(0,a.jsx)(o.$,{size:"sm",variant:"ghost",onClick:B,disabled:W,children:W?"Refreshing…":"Refresh"})]})]}),(0,a.jsxs)("div",{className:"grid grid-cols-2 gap-3 md:grid-cols-3 lg:grid-cols-6",children:[(0,a.jsx)(_,{label:"Status",value:Z,tone:r?.healthy?"text-emerald-600":e?.installed?"text-amber-600":"text-muted-foreground",sub:e?.enabled?"Enabled in pipeline":"Disabled in pipeline"}),(0,a.jsx)(_,{label:"Version",value:e?.version?`v${e.version}`:"—",sub:"pxpipe-proxy"}),(0,a.jsx)(_,{label:"Uptime",value:(e=>{if(!e||e<=0)return"—";let t=Math.floor(e/6e4),r=Math.floor(t/60);return r>0?`${r}h${String(t%60).padStart(2,"0")}m`:`${t}m`})(e?.uptimeMs),sub:"module loaded"}),(0,a.jsx)(_,{label:"Requests",value:T?T.requests.toLocaleString():"—"}),(0,a.jsx)(_,{label:"Compressed",value:T?T.compressed.toLocaleString():"—",tone:"text-emerald-600"}),(0,a.jsx)(_,{label:"Bypassed",value:T?T.bypassed.toLocaleString():"—"})]}),(0,a.jsx)(n.Zp,{children:(0,a.jsxs)(n.Wu,{className:"p-4",children:[(0,a.jsxs)("div",{className:"mb-4 flex flex-wrap items-center justify-between gap-3",children:[(0,a.jsx)("h3",{className:"font-medium",children:"Token savings (estimated)"}),(0,a.jsx)("div",{className:"flex items-center gap-1 rounded-lg border border-border bg-muted p-1",children:w.map(e=>(0,a.jsx)("button",{onClick:()=>L(e.id),className:`rounded-md px-3 py-1 text-xs font-medium transition-colors ${A===e.id?"bg-primary text-primary-foreground shadow-sm":"text-muted-foreground hover:text-foreground hover:bg-muted"}`,children:e.label},e.id))})]}),(0,a.jsxs)("div",{className:"grid grid-cols-2 gap-4 text-center md:grid-cols-4",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"text-xs text-muted-foreground",children:"Original tokens"}),(0,a.jsx)("p",{className:"text-lg font-semibold",children:T?z(T.tokensBeforeEst):"—"})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"text-xs text-muted-foreground",children:"After PXPIPE"}),(0,a.jsx)("p",{className:"text-lg font-semibold",children:T?z(T.tokensAfterEst):"—"})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"text-xs text-muted-foreground",children:"Saved"}),(0,a.jsx)("p",{className:"text-lg font-semibold text-emerald-600",children:T?z(T.tokensSavedEst):"—"})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"text-xs text-muted-foreground",children:"Reduction"}),(0,a.jsx)("p",{className:"text-lg font-semibold text-emerald-600",children:T?`${T.savedPct}%`:"—"})]})]}),(0,a.jsxs)("p",{className:"mt-3 text-xs text-muted-foreground",children:["Estimates from body size before/after imaging; billed usage per request (recorded on the Usage page) remains the ground truth. Images generated:"," ",T?T.imagesGenerated.toLocaleString():"—"," \xb7 avg compression time:"," ",T?`${T.avgCompressionMs}ms`:"—"," \xb7 errors: ",T?T.errors:"—"]})]})}),(0,a.jsx)(n.Zp,{children:(0,a.jsxs)(n.Wu,{className:"p-4",children:[(0,a.jsx)("h3",{className:"mb-3 font-medium",children:"Tokens saved — last 30 days"}),$?.timeline?.some(e=>e.tokensSavedEst>0)?(0,a.jsx)(f.u,{width:"100%",height:220,children:(0,a.jsxs)(b.Q,{data:$.timeline,margin:{top:4,right:8,left:0,bottom:0},children:[(0,a.jsx)("defs",{children:(0,a.jsxs)("linearGradient",{id:"gradPxpipe",x1:"0",y1:"0",x2:"0",y2:"1",children:[(0,a.jsx)("stop",{offset:"5%",stopColor:"#10b981",stopOpacity:.25}),(0,a.jsx)("stop",{offset:"95%",stopColor:"#10b981",stopOpacity:0})]})}),(0,a.jsx)(v.d,{strokeDasharray:"3 3",strokeOpacity:.2}),(0,a.jsx)(j.W,{dataKey:"date",tick:{fontSize:11},tickFormatter:e=>e.slice(5)}),(0,a.jsx)(y.h,{tick:{fontSize:11},tickFormatter:z,width:48}),(0,a.jsx)(k.m,{formatter:e=>[z(e),"Tokens saved"],labelFormatter:e=>e}),(0,a.jsx)(N.Gk,{type:"monotone",dataKey:"tokensSavedEst",stroke:"#10b981",fill:"url(#gradPxpipe)",strokeWidth:2})]})}):(0,a.jsx)("div",{className:"flex h-32 items-center justify-center text-sm text-muted-foreground",children:"No savings recorded yet — enable PXPIPE in the Token Saver and route a large Claude-format request."})]})}),(0,a.jsx)(n.Zp,{children:(0,a.jsxs)(n.Wu,{className:"p-4",children:[(0,a.jsx)("h3",{className:"mb-3 font-medium",children:"History"}),(0,a.jsx)("div",{className:"overflow-x-auto",children:(0,a.jsxs)(u,{children:[(0,a.jsx)(m,{children:(0,a.jsxs)(h,{children:[(0,a.jsx)(p,{children:"Time"}),(0,a.jsx)(p,{children:"Model"}),(0,a.jsx)(p,{className:"text-right",children:"Original"}),(0,a.jsx)(p,{className:"text-right",children:"Compressed"}),(0,a.jsx)(p,{className:"text-right",children:"Saved"}),(0,a.jsx)(p,{className:"text-right",children:"%"}),(0,a.jsx)(p,{className:"text-right",children:"Duration"}),(0,a.jsx)(p,{children:"Status"})]})}),(0,a.jsxs)(x,{children:[($?.recent||[]).slice(0,50).map((e,t)=>(0,a.jsxs)(h,{children:[(0,a.jsx)(g,{className:"whitespace-nowrap text-muted-foreground",children:new Date(e.ts).toLocaleString()}),(0,a.jsx)(g,{className:"font-mono text-xs",children:e.provider?`${e.provider}/${e.model}`:e.model||"—"}),(0,a.jsx)(g,{className:"text-right font-mono text-xs",children:e.applied?z(e.tokensBeforeEst):"—"}),(0,a.jsx)(g,{className:"text-right font-mono text-xs",children:e.applied?z(e.tokensAfterEst):"—"}),(0,a.jsx)(g,{className:"text-right font-mono text-xs text-emerald-600",children:e.applied?z(e.tokensSavedEst):"—"}),(0,a.jsx)(g,{className:"text-right font-mono text-xs",children:e.applied?`${e.savedPct}%`:"—"}),(0,a.jsx)(g,{className:"text-right font-mono text-xs",children:null!=e.durationMs?`${e.durationMs}ms`:"—"}),(0,a.jsx)(g,{children:(0,a.jsxs)(l.m_,{children:[(0,a.jsx)(l.k$,{asChild:!0,children:(0,a.jsx)(d.E,{variant:"default",className:e.applied?"bg-emerald-500/15 text-emerald-600":"transform_error"===e.reason||"timeout"===e.reason?"bg-destructive/15 text-destructive":"bg-amber-500/15 text-amber-600",children:e.applied?"Compressed":S[e.reason??""]||e.reason})}),e.detail?(0,a.jsx)(l.ZI,{children:e.detail}):null]})})]},`${e.ts}-${t}`)),(!$?.recent||0===$.recent.length)&&(0,a.jsx)(h,{children:(0,a.jsx)(g,{colSpan:8,className:"py-6 text-center text-sm text-muted-foreground",children:"No PXPIPE activity yet"})})]})]})})]})}),(0,a.jsx)(n.Zp,{children:(0,a.jsxs)(n.Wu,{className:"p-4",id:"logs",children:[(0,a.jsx)("h3",{className:"mb-3 font-medium",children:"PXPIPE Logs"}),E?.installLog?(0,a.jsx)("pre",{className:"max-h-64 overflow-x-auto overflow-y-auto rounded bg-black/5 p-3 font-mono text-xs whitespace-pre-wrap dark:bg-white/5",children:E.installLog}):(0,a.jsx)("p",{className:"text-sm text-muted-foreground",children:"No install log yet."})]})})]})}},50009:(e,t,r)=>{"use strict";r.d(t,{A:()=>i});var a=r(15814),s=r(4836);function i(e,t=[],r=[]){let n,o="string"==typeof e?function(e,t,r=[]){if(null==t)throw Error("[lucide]: iconNode is required when icon name is used");return{name:e?.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),size:24,node:t,...r.length>0?{aliases:r}:{}}}(e,t,r):e,d=(0,a.forwardRef)(({className:e,...t},r)=>(0,a.createElement)(s.A,{ref:r,icon:o,className:e,...t}));return o.name&&(d.displayName=(n=(e=>{let t="",r=!1;for(let a of e){if("-"===a||"_"===a||a<=" "){r=t.length>0;continue}0===t.length?t+=a.toLowerCase():t+=r?a.toUpperCase():a,r=!1}return t})(o.name)).charAt(0).toUpperCase()+n.slice(1)),d}},53784:(e,t,r)=>{"use strict";r.d(t,{E:()=>d});var a=r(29798);r(15814);var s=r(54366),i=r(5471),n=r(80954);let o=(0,s.F)("group/badge inline-flex h-5 w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-4xl border border-transparent px-2 py-0.5 text-xs font-medium whitespace-nowrap transition-all focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&>svg]:pointer-events-none [&>svg]:size-3!",{variants:{variant:{default:"bg-primary text-primary-foreground [a]:hover:bg-primary/80",secondary:"bg-secondary text-secondary-foreground [a]:hover:bg-secondary/80",destructive:"bg-destructive/10 text-destructive focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:focus-visible:ring-destructive/40 [a]:hover:bg-destructive/20",outline:"border-border text-foreground [a]:hover:bg-muted [a]:hover:text-muted-foreground",ghost:"hover:bg-muted hover:text-muted-foreground dark:hover:bg-muted/50",link:"text-primary underline-offset-4 hover:underline"}},defaultVariants:{variant:"default"}});function d({className:e,variant:t="default",asChild:r=!1,...s}){let l=r?n.bL:"span";return(0,a.jsx)(l,{"data-slot":"badge","data-variant":t,className:(0,i.cn)(o({variant:t}),e),...s})}},54366:(e,t,r)=>{"use strict";r.d(t,{F:()=>n});var a=r(14748);let s=e=>"boolean"==typeof e?`${e}`:0===e?"0":e,i=a.$,n=(e,t)=>r=>{var a;if((null==t?void 0:t.variants)==null)return i(e,null==r?void 0:r.class,null==r?void 0:r.className);let{variants:n,defaultVariants:o}=t,d=Object.keys(n).map(e=>{let t=null==r?void 0:r[e],a=null==o?void 0:o[e];if(null===t)return null;let i=s(t)||s(a);return n[e][i]}),l=r&&Object.entries(r).reduce((e,t)=>{let[r,a]=t;return void 0===a||(e[r]=a),e},{});return i(e,d,null==t||null==(a=t.compoundVariants)?void 0:a.reduce((e,t)=>{let{class:r,className:a,...s}=t;return Object.entries(s).every(e=>{let[t,r]=e;return Array.isArray(r)?r.includes({...o,...l}[t]):({...o,...l})[t]===r})?[...e,r,a]:e},[]),null==r?void 0:r.class,null==r?void 0:r.className)}},75669:(e,t,r)=>{"use strict";r.d(t,{BT:()=>d,Wu:()=>c,X9:()=>l,ZB:()=>o,Zp:()=>i,aR:()=>n});var a=r(29798);r(15814);var s=r(5471);function i({className:e,size:t="default",...r}){return(0,a.jsx)("div",{"data-slot":"card","data-size":t,className:(0,s.cn)("group/card flex flex-col gap-(--card-spacing) overflow-hidden rounded-xl bg-card py-(--card-spacing) text-sm text-card-foreground shadow-xs ring-1 ring-foreground/10 [--card-spacing:--spacing(6)] has-[>img:first-child]:pt-0 data-[size=sm]:[--card-spacing:--spacing(4)] *:[img:first-child]:rounded-t-xl *:[img:last-child]:rounded-b-xl",e),...r})}function n({className:e,...t}){return(0,a.jsx)("div",{"data-slot":"card-header",className:(0,s.cn)("group/card-header @container/card-header grid auto-rows-min items-start gap-1 rounded-t-xl px-(--card-spacing) has-data-[slot=card-action]:grid-cols-[1fr_auto] has-data-[slot=card-description]:grid-rows-[auto_auto] [.border-b]:pb-(--card-spacing)",e),...t})}function o({className:e,...t}){return(0,a.jsx)("div",{"data-slot":"card-title",className:(0,s.cn)("font-heading text-base leading-normal font-medium group-data-[size=sm]/card:text-sm",e),...t})}function d({className:e,...t}){return(0,a.jsx)("div",{"data-slot":"card-description",className:(0,s.cn)("text-sm text-muted-foreground",e),...t})}function l({className:e,...t}){return(0,a.jsx)("div",{"data-slot":"card-action",className:(0,s.cn)("col-start-2 row-span-2 row-start-1 self-start justify-self-end",e),...t})}function c({className:e,...t}){return(0,a.jsx)("div",{"data-slot":"card-content",className:(0,s.cn)("flex flex-col gap-3 px-(--card-spacing)",e),...t})}},80327:(e,t,r)=>{Promise.resolve().then(r.bind(r,34327))},83604:(e,t,r)=>{"use strict";r.d(t,{A:()=>i});var a=r(50009);let s={name:"image",size:24,node:[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]]};s.node;let i=(0,a.A)(s)}},e=>{e.O(0,[5166,7552,9980,4484,3445,7276,427,9966,7358],()=>e(e.s=80327)),_N_E=e.O()}]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3826],{15764:(e,t,r)=>{"use strict";r.d(t,{CK:()=>o.default,G9:()=>u.default,Iz:()=>p.default,KX:()=>f.PanelSkeleton,LF:()=>s.default,LH:()=>m.default,Mu:()=>f.StatCardSkeleton,Nf:()=>d.default,Qv:()=>n.CardSkeleton,YW:()=>j.YW,gw:()=>b.default,jK:()=>c.default,nh:()=>v.default,pV:()=>j.pV,rq:()=>i.default,uR:()=>l.default,uo:()=>a.ConfirmModal,vE:()=>h.default,vj:()=>x.default,wI:()=>g.default,wn:()=>j.wn,zY:()=>j.zY}),r(58913);var a=r(3537),n=r(58350);r(30872),r(33526),r(42535),r(1279);var s=r(92802),i=r(25908),l=r(58729),o=r(24873),d=r(5258),c=r(59553);r(949),r(56776),r(53599),r(88336),r(69561);var u=r(37753),m=r(23444),h=r(93624),x=r(86920),g=r(65461);r(14580);var b=r(14670),p=r(70296);r(57779),r(22205);var f=r(43276),v=r(75862),j=r(92412)},74277:(e,t,r)=>{Promise.resolve().then(r.bind(r,90411)),Promise.resolve().then(r.bind(r,14580)),Promise.resolve().then(r.bind(r,75862)),Promise.resolve().then(r.bind(r,88336)),Promise.resolve().then(r.bind(r,24873)),Promise.resolve().then(r.bind(r,37753)),Promise.resolve().then(r.bind(r,65461)),Promise.resolve().then(r.bind(r,22205)),Promise.resolve().then(r.bind(r,43276)),Promise.resolve().then(r.bind(r,1279)),Promise.resolve().then(r.bind(r,86920)),Promise.resolve().then(r.bind(r,42535)),Promise.resolve().then(r.bind(r,56776)),Promise.resolve().then(r.bind(r,58913)),Promise.resolve().then(r.bind(r,93624)),Promise.resolve().then(r.bind(r,949)),Promise.resolve().then(r.bind(r,72778)),Promise.resolve().then(r.bind(r,16675)),Promise.resolve().then(r.bind(r,29575)),Promise.resolve().then(r.bind(r,58350)),Promise.resolve().then(r.bind(r,58729)),Promise.resolve().then(r.bind(r,5258)),Promise.resolve().then(r.bind(r,3537)),Promise.resolve().then(r.bind(r,25908)),Promise.resolve().then(r.bind(r,14670)),Promise.resolve().then(r.bind(r,92802)),Promise.resolve().then(r.bind(r,57779)),Promise.resolve().then(r.bind(r,69561)),Promise.resolve().then(r.bind(r,70296)),Promise.resolve().then(r.bind(r,53599)),Promise.resolve().then(r.bind(r,33526)),Promise.resolve().then(r.bind(r,30872)),Promise.resolve().then(r.bind(r,59553)),Promise.resolve().then(r.bind(r,23444))},90411:(e,t,r)=>{"use strict";r.d(t,{default:()=>O});var a=r(29798),n=r(58913),s=r(15814),i=r(738),l=r(1352),o=r(58014);let d="quotaCacheData",c="quotaAutoRefresh",u=[10,20,50,100],m=[{value:"all",label:"All accounts"},{value:"active",label:"Active"},{value:"inactive",label:"Turned off"}],h=[{value:"default",label:"Default quota order"},{value:"remaining-asc",label:"% quota: low to high"},{value:"remaining-desc",label:"% quota: high to low"}];function x(e){return e.name?.trim()||e.email?.trim()||e.displayName?.trim()||null}function g(e,t){let r=t[e.id]?.quotas?.[0];return r&&"number"==typeof r.remaining?r.remaining:1/0}function b(e){let t={};return e.forEach(e=>{t[e.id]=!0}),t}function p(e,t){let r=new Set(t.map(e=>e.id));return Object.fromEntries(Object.entries(e).filter(([e])=>r.has(e)))}async function f(e,t){return await e(t)}function v(){try{let e=window.localStorage.getItem(d);return e?JSON.parse(e):{}}catch(e){return console.error("Error reading quota cache:",e),{}}}function j(e,t){try{let r=v();r[e]={...t,cachedAt:new Date().toISOString()},window.localStorage.setItem(d,JSON.stringify(r))}catch(e){console.error("Error writing quota cache:",e)}}function k(e,t){return t&&0!==t?!e||e<0?100:e>=t?0:Math.round((t-e)/t*100):0}function y(e){return e&&"object"==typeof e?String(e.modelKey||e.name||"").trim():""}function w(e,t,r=[]){let a=t?.[e]?.hidden;return Array.isArray(a)&&0!==a.length?new Set((r.length>0?function(e=[],t=[]){if(!Array.isArray(e)||0===e.length)return[];let r=new Set(t.map(y).filter(Boolean));return[...new Set(e.map(e=>String(e).trim()).filter(e=>r.has(e)))]}(a,r):a).map(String)):new Set}function N({quotas:e=[],compact:t=!1,sortMode:r="default",showSortLabel:i=!1,onHideQuota:o=null}){let[d,c]=(0,s.useState)(1),u=(0,s.useMemo)(()=>e.map((e,t)=>({...e,index:t,remaining:e?.remaining!==void 0?Math.max(0,Math.round(e.remaining)):e?.remainingPercentage!==void 0?Math.round(e.remainingPercentage):k(e?.used,e?.total)})),[e]),m=(0,s.useMemo)(()=>"remaining-asc"===r?[...u].sort((e,t)=>e.remaining-t.remaining||e.name.localeCompare(t.name)):"remaining-desc"===r?[...u].sort((e,t)=>t.remaining-e.remaining||e.name.localeCompare(t.name)):u,[u,r]),h=Math.max(1,Math.ceil(m.length/10));if((0,s.useEffect)(()=>{c(1)},[r,e]),(0,s.useEffect)(()=>{c(e=>Math.min(e,h))},[h]),!e||0===e.length)return null;let x=m.slice((d-1)*10,10*d),g=0===m.length?0:(d-1)*10+1,b=Math.min(10*d,m.length),p=t?"py-1 px-1.5":"py-2 px-3",f=t?"text-[11px]":"text-sm",v=t?"text-[11px]":"text-sm",j=t?"text-[10px] leading-tight":"text-xs",y="function"==typeof o;return(0,a.jsxs)("div",{className:"space-y-2",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,a.jsxs)("div",{className:"text-[10px] text-muted-foreground",children:[m.length," quota",m.length>1?"s":""]}),i&&(0,a.jsx)("div",{className:"rounded-md border border-black/10 bg-black/[0.02] px-2 py-1 text-[10px] text-muted-foreground dark:border-white/10 dark:bg-white/[0.03]",children:"Sorted by account remaining"})]}),(0,a.jsx)("div",{className:"space-y-px",children:x.map(e=>{var r;let s=!0===e.unlimited,i=!0===e.isCreditBalance,d=i?{text:"text-blue-600 dark:text-blue-400",bg:"bg-blue-500",bgLight:"bg-blue-500/10",emoji:"\uD83D\uDCB0"}:(r=e.remaining)>70?{text:"text-green-600 dark:text-green-400",bg:"bg-green-500",bgLight:"bg-green-500/10",emoji:"\uD83D\uDFE2"}:r>=30?{text:"text-yellow-600 dark:text-yellow-400",bg:"bg-yellow-500",bgLight:"bg-yellow-500/10",emoji:"\uD83D\uDFE1"}:{text:"text-red-600 dark:text-red-400",bg:"bg-red-500",bgLight:"bg-red-500/10",emoji:"\uD83D\uDD34"},c=function(e){if(!e)return"-";try{let t="string"==typeof e?new Date(e):e,r=new Date,a=t-r;if(a<=0)return"-";let n=Math.ceil(a/6e4);if(n<60)return`${n}m`;let s=Math.floor(n/60),i=n%60;if(s<24)return`${s}h ${i}m`;let l=Math.floor(s/24);return`${l}d ${s%24}h ${i}m`}catch(e){return"-"}}(e.resetAt),u=function(e){if(!e)return null;try{let t=new Date(e),r=new Date,a=new Date(r.getFullYear(),r.getMonth(),r.getDate()),n=new Date(a);n.setDate(n.getDate()+1);let s="";s=t>=a&&t<n?"Today":t>=n&&t<new Date(n.getTime()+864e5)?"Tomorrow":t.toLocaleDateString("en-US",{month:"short",day:"numeric"});let i=t.toLocaleTimeString("en-US",{hour:"numeric",minute:"2-digit",hour12:!0});return`${s}, ${i}`}catch{return null}}(e.resetAt),m=!1!==e.recurring?`in ${c}`:`expires in ${c}`;return(0,a.jsxs)("div",{className:`flex items-center gap-2 border-b border-black/5 dark:border-white/5 hover:bg-black/[0.02] dark:hover:bg-white/[0.02] transition-colors ${p}`,children:[(0,a.jsxs)("div",{className:"flex w-36 min-w-0 items-center gap-1.5",children:[(0,a.jsx)("span",{className:"text-[10px] shrink-0",children:d.emoji}),(0,a.jsx)("span",{className:`${f} font-medium text-foreground truncate`,children:e.name})]}),(0,a.jsxs)("div",{className:`min-w-0 flex-1 ${t?"space-y-1":"space-y-1.5"}`,children:[!s&&!i&&(0,a.jsx)("div",{className:`${t?"h-1":"h-1.5"} rounded-full overflow-hidden border ${d.bgLight} ${0===e.remaining?"border-black/10 dark:border-white/10":"border-transparent"}`,children:(0,a.jsx)("div",{className:`h-full transition-all duration-300 ${d.bg}`,style:{width:`${Math.min(e.remaining,100)}%`}})}),(0,a.jsxs)("div",{className:`flex items-center justify-between gap-1 min-w-0 ${t?"text-[10px]":"text-xs"}`,children:[(0,a.jsxs)(l.m_,{children:[(0,a.jsx)(l.k$,{asChild:!0,children:(0,a.jsx)("span",{className:"text-muted-foreground truncate",children:s?`${e.used.toLocaleString()} used \xb7 Unlimited`:i?`Credit: ${e.total.toFixed(2)} ${e.currency||""}`:`${e.used.toLocaleString()} / ${e.total>0?e.total.toLocaleString():"∞"}`})}),(0,a.jsx)(l.ZI,{children:s?`${e.used.toLocaleString()} used \xb7 Unlimited`:i?`Credit balance: ${e.total.toFixed(2)} ${e.currency||""}`:`${e.used.toLocaleString()} / ${e.total>0?e.total.toLocaleString():"∞"}`})]}),(0,a.jsx)("span",{className:`font-medium ${s?"text-green-600 dark:text-green-400":i?"text-blue-600 dark:text-blue-400":d.text} shrink-0`,children:s?"Unlimited":i?"":`${e.remaining}%`})]})]}),(0,a.jsx)("div",{className:"min-w-0 shrink",children:"-"!==c||u?t?(0,a.jsxs)(l.m_,{children:[(0,a.jsx)(l.k$,{asChild:!0,children:(0,a.jsx)("div",{className:`${v} text-foreground font-medium truncate`,children:"-"!==c?m:u})}),(0,a.jsx)(l.ZI,{children:u||""})]}):(0,a.jsxs)("div",{className:"min-w-0 space-y-0.5",children:["-"!==c&&(0,a.jsx)("div",{className:`${v} text-foreground font-medium truncate`,children:m}),u&&(0,a.jsx)("div",{className:`${j} text-muted-foreground truncate`,children:u})]}):(0,a.jsx)("div",{className:`${v} text-muted-foreground italic`,children:"N/A"})}),y&&(0,a.jsxs)(l.m_,{children:[(0,a.jsx)(l.k$,{asChild:!0,children:(0,a.jsx)("button",{type:"button",onClick:()=>o(e),className:"inline-flex h-6 w-6 shrink-0 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-black/5 hover:text-foreground dark:hover:bg-white/5","aria-label":`Hide quota ${e.name}`,children:(0,a.jsx)(n.default,{name:"visibility_off",className:"text-[15px]"})})}),(0,a.jsx)(l.ZI,{children:"Hide this quota row"})]})]},`${e.name}-${e.index}`)})}),h>1&&(0,a.jsxs)("div",{className:"rounded-md border border-black/10 bg-black/[0.02] px-2 py-1.5 dark:border-white/10 dark:bg-white/[0.03]",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between gap-2 text-[10px] text-muted-foreground",children:[(0,a.jsxs)("span",{children:["Showing ",g,"-",b," of ",m.length]}),(0,a.jsxs)("span",{children:["Page ",d," / ",h]})]}),(0,a.jsxs)("div",{className:"mt-1.5 flex items-center justify-end gap-1",children:[(0,a.jsx)("button",{type:"button",onClick:()=>c(e=>Math.max(1,e-1)),disabled:1===d,className:"flex h-6 items-center rounded-md border border-black/10 px-2 text-[10px] text-foreground transition-colors hover:bg-black/5 disabled:cursor-not-allowed disabled:opacity-40 dark:border-white/10 dark:hover:bg-white/5",children:"Prev"}),(0,a.jsx)("button",{type:"button",onClick:()=>c(e=>Math.min(h,e+1)),disabled:d===h,className:"flex h-6 items-center rounded-md border border-black/10 px-2 text-[10px] text-foreground transition-colors hover:bg-black/5 disabled:cursor-not-allowed disabled:opacity-40 dark:border-white/10 dark:hover:bg-white/5",children:"Next"})]})]})]})}var C=r(14231),P=r(75669),S=r(15764),$=r(49787),A=r(13794),q=r(63523);let E={claude:"claudeAutoPing",codex:"codexAutoPing"},_={claude:"When your 5h quota runs out, auto-sends a request the moment it resets so a new window starts right away.",codex:"Auto-starts the next 5h Codex window after reset by sending a tiny gpt-5.5 request. Consumes a small amount of quota."};function I(e){return e.name?.trim()&&e.email?.trim()&&e.name.trim()!==e.email.trim()?e.email.trim():e.name?.trim()&&e.displayName?.trim()&&e.name.trim()!==e.displayName.trim()?e.displayName.trim():null}function M(e){return A.Q2[e]?.name||e}function T(e){if(!e)return"N/A";let t=new Date(e);return Number.isFinite(t.getTime())?t.toLocaleString(void 0,{month:"short",day:"numeric",year:"numeric",hour:"numeric",minute:"2-digit"}):"N/A"}function O(){let{copied:e,copy:t}=(0,q.C)(),[r,O]=(0,s.useState)([]),[D,L]=(0,s.useState)({}),[F,z]=(0,s.useState)({}),[Z,W]=(0,s.useState)({}),[R,U]=(0,s.useState)(!0),[K,H]=(0,s.useState)({claude:{},codex:{}}),[J,V]=(0,s.useState)(null),[Y,G]=(0,s.useState)(!1),[B,Q]=(0,s.useState)(!1),[X,ee]=(0,s.useState)(60),[et,er]=(0,s.useState)(!0),[ea,en]=(0,s.useState)(null),[es,ei]=(0,s.useState)(null),[el,eo]=(0,s.useState)(null),[ed,ec]=(0,s.useState)(null),[eu,em]=(0,s.useState)(null),[eh,ex]=(0,s.useState)(!1),[eg,eb]=(0,s.useState)(null),[ep,ef]=(0,s.useState)([]),[ev,ej]=(0,s.useState)("all"),[ek,ey]=(0,s.useState)([]),[ew,eN]=(0,s.useState)("all"),[eC,eP]=(0,s.useState)("default"),[eS,e$]=(0,s.useState)({}),[eA,eq]=(0,s.useState)(!1),[eE,e_]=(0,s.useState)(!1),[eI,eM]=(0,s.useState)(!1),[eT,eO]=(0,s.useState)(1),[eD,eL]=(0,s.useState)(20),[eF,ez]=(0,s.useState)(String(20)),[eZ,eW]=(0,s.useState)({page:1,pageSize:20,total:0,totalPages:1}),[eR,eU]=(0,s.useState)({eligibleConnections:0,providerFilteredConnections:0}),eK=(0,s.useRef)(null),eH=(0,s.useRef)(null),eJ=(0,s.useRef)(0),eV=(0,s.useCallback)(async(e=eT)=>{try{var t,r;let a=new URLSearchParams({page:String(e),pageSize:String(eD),accountStatus:ew,sort:"priority"});"all"!==ev&&a.set("provider",ev);let n=await fetch(`/api/providers/client?${a.toString()}`);if(!n.ok)throw Error("Failed to fetch connections");let s=await n.json(),i=s.connections||[],l=(t=s.pagination,t||{page:1,pageSize:eD,total:0,totalPages:1}),o=function(e,t=0){return e||{eligibleConnections:t,providerFilteredConnections:t}}(s.totals,i.length);return O(i),ey(s.providerOptions||[]),eW(l),eU(o),eO((r=s.pagination,r?.page||e)),i}catch(e){return console.error("Error fetching connections:",e),O([]),ey([]),eW({page:1,pageSize:eD,total:0,totalPages:1}),eU({eligibleConnections:0,providerFilteredConnections:0}),[]}},[ew,eA,eT,eD,ev]),eY=(0,s.useCallback)(async(e,t,{force:r=!1}={})=>{z(t=>({...t,[e]:!0})),W(t=>({...t,[e]:null}));try{console.log(`[ProviderLimits] Fetching quota for ${t} (${e})`);let a=`/api/usage/${e}${r?"?force=1":""}`,n=await fetch(a);if(!n.ok){let r=(await n.json().catch(()=>({}))).error||n.statusText;if(404===n.status)return void console.warn(`[ProviderLimits] Connection not found for ${t}, skipping`);if(401===n.status){console.warn(`[ProviderLimits] Auth error for ${t}:`,r);let a={quotas:[],message:r};L(t=>({...t,[e]:a})),j(e,a);return}throw Error(`HTTP ${n.status}: ${r}`)}let s=await n.json();console.log(`[ProviderLimits] Got quota for ${t}:`,s);let i={quotas:function(e,t){if(!t||"object"!=typeof t)return[];let r=[];try{switch(e.toLowerCase()){case"github":default:t.quotas&&Object.entries(t.quotas).forEach(([e,t])=>{r.push({name:e,used:t.used||0,total:t.total||0,resetAt:t.resetAt||null})});break;case"antigravity":if(t.quotas){let e=Object.entries(t.quotas),a=new Set(["gemini_weekly","claude_gpt_weekly"]),n=e.filter(([e])=>e.startsWith("gemini-")&&!e.includes("image")),s=e.filter(([e])=>e.startsWith("claude-")),i=e.filter(([e])=>e.includes("image")),l=e.filter(([e])=>a.has(e)),o=e.filter(([e])=>!e.startsWith("gemini-")&&!e.startsWith("claude-")&&!e.includes("image")&&!a.has(e));if(n.length>0){let e=n.reduce((e,t)=>(t[1].remainingPercentage??100)<(e[1].remainingPercentage??100)?t:e)[1];r.push({name:"Gemini (Flash / Pro)",modelKey:"gemini",used:e.used||0,total:e.total||0,resetAt:e.resetAt||null,remainingPercentage:e.remainingPercentage})}if(s.length>0){let e=s.reduce((e,t)=>(t[1].remainingPercentage??100)<(e[1].remainingPercentage??100)?t:e)[1];r.push({name:"Claude (Sonnet / Opus)",modelKey:"claude",used:e.used||0,total:e.total||0,resetAt:e.resetAt||null,remainingPercentage:e.remainingPercentage})}l.forEach(([e,t])=>{r.push({name:t.displayName||e,modelKey:e,used:t.used||0,total:t.total||0,resetAt:t.resetAt||null,remainingPercentage:t.remainingPercentage})}),i.forEach(([e,t])=>{r.push({name:t.displayName||e,modelKey:e,used:t.used||0,total:t.total||0,resetAt:t.resetAt||null,remainingPercentage:t.remainingPercentage})}),o.forEach(([e,t])=>{r.push({name:t.displayName||e,modelKey:e,used:t.used||0,total:t.total||0,resetAt:t.resetAt||null,remainingPercentage:t.remainingPercentage})})}break;case"codex":t.quotas&&Object.entries(t.quotas).forEach(([e,t])=>{let a=e;"spark_session"===e?a="Spark (5h)":"spark_weekly"===e?a="Spark (Weekly)":"session"===e?a="5h":"weekly"===e?a="Weekly":"review_session"===e?a="Review (5h)":"review_weekly"===e&&(a="Review (Weekly)"),r.push({name:a,quotaType:e,used:t.used||0,total:t.total||0,remaining:t.remaining,resetAt:t.resetAt||null})});break;case"qoder":t.quotas&&Object.entries(t.quotas).forEach(([e,t])=>{("organization"!==e||t&&0!==(Number(t.total)||0))&&r.push({name:"user"===e?"Personal":"organization"===e?"Organization":e,used:t.used||0,total:t.total||0,unit:t.unit,resetAt:t.resetAt||null})});break;case"claude":t.message?r.push({name:"error",used:0,total:0,resetAt:null,message:t.message}):t.quotas&&Object.entries(t.quotas).forEach(([e,t])=>{r.push({name:e,used:t.used||0,total:t.total||0,remaining:void 0!==t.remaining?t.remaining:Math.max(0,(t.total||100)-(t.used||0)),remainingPercentage:void 0!==t.remainingPercentage?t.remainingPercentage:k(t.used,t.total),resetAt:t.resetAt||null})});break;case"vercel-ai-gateway":t.quotas&&Object.entries(t.quotas).forEach(([e,t])=>{r.push({name:e,used:t.used||0,total:t.total||0,resetAt:t.resetAt||null,remainingPercentage:t.remainingPercentage})});break;case"codebuddy-cn":t.quotas&&Object.entries(t.quotas).forEach(([e,t])=>{r.push({name:e,used:t.used||0,total:t.total||0,resetAt:t.resetAt||null,recurring:!1!==t.recurring})});break;case"grok-cli":t.quotas&&Object.entries(t.quotas).forEach(([e,t])=>{r.push({name:e,used:t.used||0,total:t.total||0,resetAt:t.resetAt||null,remainingPercentage:t.remainingPercentage})});break;case"deepseek":t.quotas&&Object.entries(t.quotas).forEach(([e,t])=>{r.push({name:e,used:t.used||0,total:t.total||0,resetAt:t.resetAt||null,remainingPercentage:t.remainingPercentage,isCreditBalance:t.isCreditBalance??!0,currency:t.currency||(e.includes("(")?e.slice(e.indexOf("(")+1,e.indexOf(")")):"USD")})});break;case"groq":t.quotas&&Object.entries(t.quotas).forEach(([e,t])=>{r.push({name:e,used:t.used||0,total:t.total||0,resetAt:t.resetAt||null})});break;case"ollama":t.quotas&&Object.entries(t.quotas).forEach(([e,t])=>{r.push({name:e,used:t.used||0,total:t.total||0,resetAt:t.resetAt||null,remainingPercentage:t.remainingPercentage})});break;case"zed":t.quotas&&Object.entries(t.quotas).forEach(([e,t])=>{r.push({name:e,used:t.used||0,total:t.total||0,resetAt:t.resetAt||null,remainingPercentage:t.remainingPercentage,unlimited:t.unlimited})})}}catch(t){return console.error(`Error parsing quota data for ${e}:`,t),[]}if(e?.toLowerCase()==="claude"){let e={"session (5h)":0,"weekly (7d)":1,"weekly fable (7d)":2,"weekly opus (7d)":3,"weekly sonnet (7d)":4};return r.sort((t,r)=>(e[t.name]??99)-(e[r.name]??99)),r}let a=(0,o.KC)(e);if(a.length>0){let e=new Map(a.map((e,t)=>[e.id,t]));r.sort((t,r)=>{let a=t.modelKey||t.name,n=r.modelKey||r.name;return"gemini"===a&&(a="gemini-3.8-flash-high"),"claude"===a&&(a="claude-sonnet-4-6"),"gemini"===n&&(n="gemini-3.8-flash-high"),"claude"===n&&(n="claude-sonnet-4-6"),(e.get(a)??999)-(e.get(n)??999)})}return r}(t,s),plan:s.plan||null,message:s.message||null,raw:s};L(t=>({...t,[e]:i})),j(e,i)}catch(r){console.error(`[ProviderLimits] Error fetching quota for ${t} (${e}):`,r),W(t=>({...t,[e]:r.message||"Failed to fetch quota"}))}finally{z(t=>({...t,[e]:!1}))}},[]),eG=(0,s.useCallback)(async(e,t)=>{await eY(e,t,{force:!0}),V(new Date)},[eY]),eB=(0,s.useCallback)(async(e,t)=>{if("codex"===t&&!el){eo(e),W(t=>({...t,[e]:null}));try{let r=await fetch(`/api/usage/${e}/codex-reset-credits`,{method:"POST"}),a=await r.json().catch(()=>({}));if(!r.ok)throw Error(a.message||a.error||a.code||"Failed to reset Codex limit");await eY(e,t),V(new Date)}catch(t){W(r=>({...r,[e]:t.message||"Failed to reset Codex limit"}))}finally{eo(null)}}},[eY,el]),eQ=(0,s.useCallback)(async e=>{em({connection:e,loading:!0,error:null,data:null});try{let t=await fetch(`/api/usage/${e.id}/codex-reset-credits`,{cache:"no-store"}),r=await t.json().catch(()=>({}));if(!t.ok)throw Error(r.error||r.message||"Failed to load Codex reset credits");let a=Array.isArray(r.credits)?[...r.credits]:[];a.sort((e,t)=>{let r=e.expiresAt?new Date(e.expiresAt).getTime():1/0,a=t.expiresAt?new Date(t.expiresAt).getTime():1/0;return r-a}),em({connection:e,loading:!1,error:null,data:{...r,credits:a}})}catch(t){em({connection:e,loading:!1,error:t.message||"Failed to load Codex reset credits",data:null})}},[]),eX=(0,s.useCallback)(async e=>{if(confirm("Delete this connection?")){en(e);try{if((await fetch(`/api/providers/${e}`,{method:"DELETE"})).ok){L(t=>{let r={...t};return delete r[e],r}),z(t=>{let r={...t};return delete r[e],r}),W(t=>{let r={...t};return delete r[e],r});try{let t=v();t[e]&&(delete t[e],window.localStorage.setItem(d,JSON.stringify(t)))}catch(e){console.error("Error deleting cache entry:",e)}await f(eV,eT)}}catch(e){console.error("Error deleting connection:",e)}finally{en(null)}}},[eV,eT]),e0=(0,s.useCallback)(async(e,t)=>{ei(e);try{(await fetch(`/api/providers/${e}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({isActive:t})})).ok&&(L(e=>({...e})),await f(eV,eT))}catch(e){console.error("Error updating connection status:",e)}finally{ei(null)}},[eV,eT]),e1=(0,s.useCallback)(async e=>{if(!eg?.id)return;let t=eg.id,r=eg.provider;try{(await fetch(`/api/providers/${t}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})).ok&&(await eV(),ex(!1),eb(null),A.wb.includes(r)&&await eY(t,r))}catch(e){console.error("Error saving connection:",e)}},[eg,eV,eY]);(0,s.useEffect)(()=>{let e=!1;return fetch("/api/proxy-pools?isActive=true",{cache:"no-store"}).then(e=>e.json()).then(t=>{!e&&t?.proxyPools&&ef(t.proxyPools)}).catch(()=>{}),()=>{e=!0}},[]);let e5=(0,s.useCallback)(async(e=!1)=>{if(B)return;Q(!0),ee(60);let t=eJ.current+=1,r=Math.round(10);try{let a=await eV(eT);z(b(a)),W(e=>p(e,a)),L(e=>p(e,a)),await Promise.all(a.filter(a=>e||"claude"!==a.provider||t%r==0).map(e=>eY(e.id,e.provider))),V(new Date)}catch(e){console.error("Error refreshing all providers:",e)}finally{Q(!1)}},[B,eV,eY,eT]);(0,s.useEffect)(()=>{(async()=>{er(!0);let e=await eV(eT);er(!1),z(b(e)),W(t=>p(t,e)),L(t=>p(t,e)),await Promise.all(e.map(e=>eY(e.id,e.provider))),V(new Date)})()},[eV,eY,eT]),(0,s.useEffect)(()=>{let e=window.localStorage.getItem(c);U(null===e||"true"===e),G(!0)},[]),(0,s.useEffect)(()=>{Y&&window.localStorage.setItem(c,String(R))},[R,Y]),(0,s.useEffect)(()=>{fetch("/api/settings",{cache:"no-store"}).then(e=>e.ok?e.json():{}).then(e=>{H({claude:e?.claudeAutoPing?.connections||{},codex:e?.codexAutoPing?.connections||{}}),e$(e?.quotaVisibility||{})}).catch(()=>{})},[]);let e2=(0,s.useCallback)(async(e,t,r)=>{let a=E[t];if(!a)return;let n={...K[t]||{},[e]:r};H({...K,[t]:n});try{let e=await fetch("/api/settings",{cache:"no-store"}),t={...(e.ok?await e.json():{})[a]||{},connections:n};await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({[a]:t})})}catch{H(K)}},[K]),e3=(0,s.useCallback)(async(e,t)=>{e$(e);try{if(!(await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({quotaVisibility:e})})).ok)throw Error("Failed to update quota visibility")}catch(e){console.error("Error updating quota visibility:",e),e$(t)}},[]),e4=(0,s.useCallback)((e,t)=>{let r=y(t);if(!e||!r)return;let a=eS[e]||{},n=new Set(a.hidden||[]);if(n.add(r),"antigravity"===e){if("gemini"===r)for(let e of n)e.startsWith("gemini-")&&!e.includes("image")&&n.delete(e);else if("claude"===r)for(let e of n)e.startsWith("claude-")&&n.delete(e)}e3({...eS,[e]:{...a,hidden:[...n]}},eS)},[eS,e3]),e8=(0,s.useCallback)((e,t)=>{let r=y(t);if(!e||!r)return;let a=eS[e]||{},n=new Set(a.hidden||[]);if(n.delete(r),"antigravity"===e){if("gemini"===r)for(let e of n)e.startsWith("gemini-")&&!e.includes("image")&&n.delete(e);else if("claude"===r)for(let e of n)e.startsWith("claude-")&&n.delete(e)}e3({...eS,[e]:{...a,hidden:[...n]}},eS)},[eS,e3]);(0,s.useEffect)(()=>{if(!Y||!R){eK.current&&(clearInterval(eK.current),eK.current=null),eH.current&&(clearInterval(eH.current),eH.current=null);return}return eK.current=setInterval(()=>{e5()},6e4),eH.current=setInterval(()=>{ee(e=>e<=1?60:e-1)},1e3),()=>{eK.current&&clearInterval(eK.current),eH.current&&clearInterval(eH.current)}},[R,e5,Y]),(0,s.useEffect)(()=>{let e=()=>{document.hidden?(eK.current&&(clearInterval(eK.current),eK.current=null),eH.current&&(clearInterval(eH.current),eH.current=null)):R&&Y&&(eK.current=setInterval(()=>e5(),6e4),eH.current=setInterval(()=>{ee(e=>e<=1?60:e-1)},1e3))};return document.addEventListener("visibilitychange",e),()=>{document.removeEventListener("visibilitychange",e)}},[R,e5,Y]);let e6=(0,s.useMemo)(()=>(function(e,t,r,a,n){if("codex"===a&&"default"!==n)return[...e].sort((e,r)=>{let a=g(e,t),s=g(r,t),i="remaining-asc"===n?a-s:s-a;return 0!==i?i:(x(e)||"").localeCompare(x(r)||"")});if(!r){let t=new Map;for(let r of e){let e=r.provider||"";t.has(e)||t.set(e,[]),t.get(e).push(r)}return Array.from(t.values()).flat()}let s=e=>{let r=(t[e.id]?.quotas||[]).map(e=>e.resetAt?new Date(e.resetAt).getTime():1/0).filter(e=>Number.isFinite(e));return r.length>0?Math.min(...r):1/0};return[...e].sort((e,t)=>{let r=s(e)-s(t);return 0!==r?r:(e.provider||"").localeCompare(t.provider||"")||(x(e)||"").localeCompare(x(t)||"")})})(r,D,eA,ev,eC),[r,D,eA,ev,eC]),e7=e=>{let t=D[e.id]?.quotas;return!!t?.length&&t.some(e=>!!e.total&&!(e.total<=0)&&5>=k(e.used,e.total))},e9=(0,s.useCallback)(async(e,t)=>{if(e.length&&!eI){eM(!0);try{await Promise.all(e.map(e=>fetch(`/api/providers/${e}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({isActive:t})}))),await f(eV,eT)}catch(e){console.error("Error bulk toggling connections:",e)}finally{eM(!1)}}},[eI,eV,eT]),te="all"===ev?"All providers":M(ev),tt=eR.eligibleConnections>0,tr=e6.length>0,ta=eR.eligibleConnections?eR.providerFilteredConnections?{icon:"filter_alt_off",title:"No Accounts On This Page",description:"Try moving to another page or refreshing the current filters."}:{icon:"filter_alt_off",title:"No Accounts Match Current Filters",description:"all"===ev?"Try changing the account status filter to see more quota trackers.":`No ${"inactive"===ew?"turned off":"active"===ew?"active":"matching"} accounts found for ${ev}.`}:{icon:"cloud_off",title:"No Providers Connected",description:"Connect to providers with OAuth to track your API quota limits and usage."},tn=function(e){var t;let{start:r,end:a}=(t=e).total?{start:(t.page-1)*t.pageSize+1,end:Math.min(t.page*t.pageSize,t.total)}:{start:0,end:0};return`Showing ${r}-${a} of ${e.total}`}(eZ),ts=!u.includes(eD);return et||tt?et||tr?(0,a.jsxs)("div",{className:"space-y-6",children:[(0,a.jsx)("div",{className:"flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-end",children:(0,a.jsxs)("div",{className:"flex flex-wrap items-center gap-1.5",children:[(0,a.jsxs)("div",{className:"relative",children:[(0,a.jsxs)(l.m_,{children:[(0,a.jsx)(l.k$,{asChild:!0,children:(0,a.jsxs)("button",{type:"button",onClick:()=>e_(e=>!e),className:"flex h-8 items-center justify-between gap-1 rounded-lg border border-black/10 bg-black/[0.02] px-2 text-xs text-foreground transition-colors hover:bg-black/5 dark:border-white/10 dark:bg-white/[0.03] dark:hover:bg-white/10","aria-haspopup":"menu","aria-expanded":eE,children:[(0,a.jsxs)("span",{className:"flex min-w-0 items-center gap-1.5",children:["all"===ev?(0,a.jsx)(n.default,{name:"apps",className:"text-[14px] text-muted-foreground"}):(0,a.jsx)(i.A,{src:`/providers/${ev}.png`,alt:ev,size:18,className:"size-[18px] rounded object-contain",fallbackText:ev.slice(0,2).toUpperCase()}),(0,a.jsx)("span",{className:"truncate hidden lg:inline",children:te})]}),(0,a.jsx)(n.default,{name:"expand_more",className:"text-[14px] text-muted-foreground"})]})}),(0,a.jsx)(l.ZI,{children:"Filter quota providers"})]}),eE&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("button",{type:"button",className:"fixed inset-0 z-30 bg-transparent","aria-label":"Close provider filter",onClick:()=>e_(!1)}),(0,a.jsxs)("div",{className:"absolute left-0 z-40 mt-2 w-64 overflow-hidden rounded-2xl border border-black/10 bg-card/95 p-1.5 shadow-xl shadow-black/10 backdrop-blur dark:border-white/10 dark:bg-card/95 sm:w-72",children:[(0,a.jsxs)("button",{type:"button",onClick:()=>{"all"!==ev&&eO(1),ej("all"),e_(!1)},className:`flex w-full items-center gap-3 rounded-xl px-3 py-2.5 text-left text-sm transition-colors ${"all"===ev?"bg-primary/10 text-primary":"text-foreground hover:bg-black/5 dark:hover:bg-white/10"}`,children:[(0,a.jsx)(n.default,{name:"apps",className:"text-[22px]"}),(0,a.jsx)("span",{className:"font-medium",children:"All providers"}),"all"===ev&&(0,a.jsx)(n.default,{name:"check",className:"ml-auto text-[20px]"})]}),(0,a.jsx)("div",{className:"my-1 h-px bg-black/10 dark:bg-white/10"}),(0,a.jsx)("div",{className:"max-h-72 overflow-y-auto pr-1",children:ek.map(e=>(0,a.jsxs)("button",{type:"button",onClick:()=>{ev!==e&&eO(1),ej(e),e_(!1)},className:`flex w-full items-center gap-3 rounded-xl px-3 py-2.5 text-left text-sm transition-colors ${ev===e?"bg-primary/10 text-primary":"text-foreground hover:bg-black/5 dark:hover:bg-white/10"}`,children:[(0,a.jsx)(i.A,{src:`/providers/${e}.png`,alt:e,size:24,className:"size-6 rounded-md object-contain",fallbackText:e.slice(0,2).toUpperCase()}),(0,a.jsx)("span",{className:"font-medium",children:M(e)}),ev===e&&(0,a.jsx)(n.default,{name:"check",className:"ml-auto text-[20px]"})]},e))})]})]})]}),(0,a.jsx)("select",{value:ew,onChange:e=>{let t=e.target.value;ew!==t&&eO(1),eN(t)},className:"h-8 rounded-lg border border-black/10 bg-black/[0.02] px-2 text-xs text-foreground outline-none transition-colors hover:bg-black/5 dark:border-white/10 dark:bg-white/[0.03] dark:hover:bg-white/10","aria-label":"Filter accounts by status",children:m.map(e=>(0,a.jsx)("option",{value:e.value,children:e.label},e.value))}),"codex"===ev&&(0,a.jsx)("select",{value:eC,onChange:e=>eP(e.target.value),className:"h-8 rounded-lg border border-black/10 bg-black/[0.02] px-2 text-xs text-foreground outline-none transition-colors hover:bg-black/5 dark:border-white/10 dark:bg-white/[0.03] dark:hover:bg-white/10","aria-label":"Sort Codex quotas by remaining",children:h.map(e=>(0,a.jsx)("option",{value:e.value,children:e.label},e.value))}),(0,a.jsxs)(l.m_,{children:[(0,a.jsx)(l.k$,{asChild:!0,children:(0,a.jsxs)("button",{type:"button",onClick:()=>eq(e=>!e),"aria-pressed":eA,className:`flex h-8 shrink-0 items-center gap-1 rounded-lg border px-2 text-xs transition-colors ${eA?"border-amber-500/40 bg-amber-500/10 text-amber-500":"border-black/10 text-foreground hover:bg-black/5 dark:border-white/10 dark:hover:bg-white/5"}`,children:[(0,a.jsx)(n.default,{name:"hourglass_top",className:"text-[14px]"}),(0,a.jsx)("span",{className:"hidden sm:inline",children:"Expiring first"})]})}),(0,a.jsx)(l.ZI,{children:"Sort accounts by earliest quota reset time"})]}),(0,a.jsxs)(l.m_,{children:[(0,a.jsx)(l.k$,{asChild:!0,children:(0,a.jsxs)("button",{type:"button",onClick:()=>{e9(e6.filter(e=>(e.isActive??!0)&&e7(e)).map(e=>e.id),!1)},disabled:eI,className:"flex h-8 shrink-0 items-center gap-1 rounded-lg border border-red-500/30 px-2 text-xs text-red-500 transition-colors hover:bg-red-500/10 disabled:opacity-50",children:[(0,a.jsx)(n.default,{name:"block",className:"text-[14px]"}),(0,a.jsx)("span",{className:"hidden sm:inline",children:"Turn off Empty"})]})}),(0,a.jsx)(l.ZI,{children:"Disable connections with depleted quota on the current page"})]}),(0,a.jsxs)(l.m_,{children:[(0,a.jsx)(l.k$,{asChild:!0,children:(0,a.jsxs)("button",{type:"button",onClick:()=>{e9(e6.filter(e=>!(e.isActive??!0)&&!e7(e)).map(e=>e.id),!0)},disabled:eI,className:"flex h-8 shrink-0 items-center gap-1 rounded-lg border border-emerald-500/30 px-2 text-xs text-emerald-500 transition-colors hover:bg-emerald-500/10 disabled:opacity-50",children:[(0,a.jsx)(n.default,{name:"check_circle",className:"text-[14px]"}),(0,a.jsx)("span",{className:"hidden sm:inline",children:"Turn on Available"})]})}),(0,a.jsx)(l.ZI,{children:"Enable connections that still have quota on the current page"})]}),(0,a.jsxs)("label",{className:"flex h-8 shrink-0 cursor-pointer items-center gap-1.5 rounded-lg border border-black/10 px-2 text-xs transition-colors hover:bg-black/5 dark:border-white/10 dark:hover:bg-white/5",children:[(0,a.jsx)(C.d,{checked:R,onCheckedChange:()=>U(e=>!e),size:"sm","aria-label":R?"Disable auto-refresh":"Enable auto-refresh"}),(0,a.jsx)("span",{className:"hidden text-foreground sm:inline",children:"Auto-refresh"}),R&&(0,a.jsxs)("span",{className:"text-[10px] text-muted-foreground tabular-nums",children:["(",X,"s)"]})]}),(0,a.jsxs)(l.m_,{children:[(0,a.jsx)(l.k$,{asChild:!0,children:(0,a.jsx)("button",{type:"button",onClick:()=>e5(!0),disabled:B,className:"flex h-8 shrink-0 items-center gap-1 rounded-lg border border-black/10 px-2 text-xs text-foreground transition-colors hover:bg-black/5 dark:border-white/10 dark:hover:bg-white/5 disabled:opacity-50",children:(0,a.jsx)(n.default,{name:"refresh",className:`text-[14px] ${B?"animate-spin":""}`})})}),(0,a.jsx)(l.ZI,{children:"Refresh all"})]})]})}),eA&&(0,a.jsx)("div",{className:"rounded-xl border border-amber-500/20 bg-amber-500/10 px-3 py-2 text-xs text-amber-700 dark:text-amber-300",children:"Expiring-first currently reorders accounts inside the current page. Cross-page ordering still follows backend pagination."}),(0,a.jsx)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:e6.map(e=>{let t,r,s=D[e.id],o=F[e.id],d=Z[e.id],c=!1===e.isActive,u="codex"===e.provider,m=Number.isFinite(r="number"==typeof(t=s?.raw?.resetCredits?.availableCount)?t:Number(t))?Math.max(0,r):0,h=el===e.id,g=ea===e.id||es===e.id||h,b=s?.quotas||[],p=function(e,t=[],r={}){if(!Array.isArray(t)||0===t.length)return[];let a=w(e,r,t);return 0===a.size?t:t.filter(e=>!a.has(y(e)))}(e.provider,b,eS),f=function(e,t=[],r={}){if(!Array.isArray(t)||0===t.length)return[];let a=w(e,r,t);return 0===a.size?[]:t.filter(e=>a.has(y(e)))}(e.provider,b,eS);return(0,a.jsx)(P.Zp,{className:`min-w-0 [--card-spacing:0] ${c?"opacity-60":""}`,children:(0,a.jsxs)(P.Wu,{className:"px-0 gap-0",children:[(0,a.jsx)("div",{className:"px-3 py-2 border-b border-black/10 dark:border-white/10",children:(0,a.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2 min-w-0",children:[(0,a.jsx)("div",{className:"w-8 h-8 shrink-0 rounded-md flex items-center justify-center overflow-hidden",children:(0,a.jsx)(i.A,{src:`/providers/${e.provider}.png`,alt:e.provider,size:32,className:"object-contain",fallbackText:e.provider?.slice(0,2).toUpperCase()||"PR"})}),(0,a.jsxs)("div",{className:"min-w-0",children:[(0,a.jsx)("h3",{className:"text-sm font-semibold text-foreground truncate",children:M(e.provider)}),x(e)?(0,a.jsx)("p",{className:"text-xs text-muted-foreground truncate",children:x(e)}):null,I(e)?(0,a.jsx)("p",{className:"text-[11px] text-muted-foreground/80 truncate",children:I(e)}):null]})]}),(0,a.jsxs)("div",{className:"flex items-center gap-1 shrink-0",children:[u&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)(l.m_,{children:[(0,a.jsx)(l.k$,{asChild:!0,children:(0,a.jsx)("span",{className:"relative inline-flex",children:(0,a.jsxs)("button",{type:"button",onClick:()=>ec({connection:e,resetCreditCount:m}),disabled:m<=0||o||g,"aria-label":m>0?`Use one Codex reset credit. ${m} available.`:"No Codex reset credits available",className:`flex h-8 min-w-10 items-center justify-center gap-1 rounded-lg border px-2 text-[11px] font-medium tabular-nums transition-colors focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary/60 disabled:cursor-not-allowed disabled:opacity-60 ${m>0?"border-primary/30 bg-primary/5 text-primary hover:bg-primary/10":"border-black/10 bg-black/[0.02] text-muted-foreground dark:border-white/10 dark:bg-white/[0.03]"}`,children:[(0,a.jsx)(n.default,{name:h?"progress_activity":"restart_alt",className:`text-[15px] ${h?"animate-spin":""}`}),(0,a.jsx)("span",{children:m})]})})}),(0,a.jsx)(l.ZI,{side:"top",children:m>0?`Use one Codex reset credit. Available: ${m}`:"No Codex reset credits available"})]}),(0,a.jsxs)(l.m_,{children:[(0,a.jsx)(l.k$,{asChild:!0,children:(0,a.jsx)("span",{className:"relative inline-flex",children:(0,a.jsx)("button",{type:"button",onClick:()=>eQ(e),disabled:o||g,"aria-label":"View Codex reset credit expiry",className:"flex h-8 w-8 items-center justify-center rounded-lg border border-black/10 text-muted-foreground transition-colors hover:bg-black/5 hover:text-primary disabled:cursor-not-allowed disabled:opacity-50 dark:border-white/10 dark:hover:bg-white/5",children:(0,a.jsx)(n.default,{name:"schedule",className:"text-[17px]"})})})}),(0,a.jsx)(l.ZI,{side:"top",children:"View Codex reset credit expiry"})]})]}),E[e.provider]&&"oauth"===e.authType&&(0,a.jsxs)(l.m_,{children:[(0,a.jsx)(l.k$,{asChild:!0,children:(0,a.jsx)("span",{className:"relative inline-flex",children:(0,a.jsx)("button",{type:"button",onClick:()=>e2(e.id,e.provider,K[e.provider]?.[e.id]!==!0),"aria-label":"Toggle auto-ping",className:`flex h-8 w-8 items-center justify-center rounded-lg transition-colors hover:bg-black/5 dark:hover:bg-white/5 ${K[e.provider]?.[e.id]===!0?"text-primary":"text-muted-foreground"}`,children:(0,a.jsx)(n.default,{name:"bolt",className:"text-[18px]"})})})}),(0,a.jsx)(l.ZI,{side:"top",children:_[e.provider]})]}),(0,a.jsxs)(l.m_,{children:[(0,a.jsx)(l.k$,{asChild:!0,children:(0,a.jsx)("span",{className:"relative inline-flex",children:(0,a.jsx)("button",{type:"button",onClick:()=>eG(e.id,e.provider),disabled:o||g,"aria-label":"Refresh quota",className:"flex h-8 w-8 items-center justify-center rounded-lg hover:bg-black/5 dark:hover:bg-white/5 transition-colors disabled:opacity-50",children:(0,a.jsx)(n.default,{name:"refresh",className:`text-[18px] text-muted-foreground ${o?"animate-spin":""}`})})})}),(0,a.jsx)(l.ZI,{side:"top",children:"Refresh quota"})]}),(0,a.jsxs)(l.m_,{children:[(0,a.jsx)(l.k$,{asChild:!0,children:(0,a.jsx)("span",{className:"relative inline-flex",children:(0,a.jsx)("button",{type:"button",onClick:()=>{eb(e),ex(!0)},disabled:g,"aria-label":"Edit connection",className:"flex h-8 w-8 items-center justify-center rounded-lg hover:bg-black/5 dark:hover:bg-white/5 text-muted-foreground hover:text-primary transition-colors disabled:opacity-50",children:(0,a.jsx)(n.default,{name:"edit",className:"text-[18px]"})})})}),(0,a.jsx)(l.ZI,{side:"top",children:"Edit connection"})]}),(0,a.jsxs)(l.m_,{children:[(0,a.jsx)(l.k$,{asChild:!0,children:(0,a.jsx)("span",{className:"relative inline-flex",children:(0,a.jsx)("button",{type:"button",onClick:()=>eX(e.id),disabled:g,"aria-label":"Delete connection",className:"flex h-8 w-8 items-center justify-center rounded-lg hover:bg-red-500/10 text-red-500 transition-colors disabled:opacity-50",children:(0,a.jsx)(n.default,{name:"delete",className:`text-[18px] ${ea===e.id?"animate-pulse":""}`})})})}),(0,a.jsx)(l.ZI,{side:"top",children:"Delete connection"})]}),(0,a.jsx)("div",{className:"inline-flex items-center pl-0.5",children:(0,a.jsxs)(l.m_,{children:[(0,a.jsx)(l.k$,{asChild:!0,children:(0,a.jsx)(C.d,{size:"sm",checked:e.isActive??!0,disabled:g,onCheckedChange:t=>e0(e.id,t),"aria-label":e.isActive??!0?"Disable connection":"Enable connection"})}),(0,a.jsx)(l.ZI,{side:"top",children:e.isActive??!0?"Disable connection":"Enable connection"})]})})]})]})}),(0,a.jsxs)("div",{className:"px-2 py-1.5",children:[o?(0,a.jsx)("div",{className:"text-center py-5 text-muted-foreground",children:(0,a.jsx)(n.default,{name:"progress_activity",className:"text-[28px] animate-spin"})}):d?(0,a.jsxs)("div",{className:"text-center py-5",children:[(0,a.jsx)(n.default,{name:"error",className:"text-[28px] text-red-500"}),(0,a.jsx)("p",{className:"mt-1.5 text-xs text-muted-foreground",children:d})]}):s?.message?(0,a.jsx)("div",{className:"text-center py-5",children:(0,a.jsx)("p",{className:"text-xs text-muted-foreground",children:s.message})}):(0,a.jsx)(N,{quotas:p,compact:!0,sortMode:"default",showSortLabel:"codex"===e.provider&&"default"!==eC,onHideQuota:t=>e4(e.provider,t)}),s?.message&&!d&&!o&&(0,a.jsx)("p",{className:"mt-2 px-1 text-[10px] leading-relaxed text-muted-foreground",children:s.message}),f.length>0&&(0,a.jsxs)("div",{className:"mt-2 flex min-w-0 items-center gap-1 border-t border-black/5 pt-2 text-[10px] text-muted-foreground dark:border-white/5",children:[(0,a.jsx)(n.default,{name:"visibility_off",className:"shrink-0 text-[14px]"}),(0,a.jsx)("span",{className:"shrink-0",children:"Hidden:"}),(0,a.jsx)("div",{className:"flex min-w-0 flex-1 items-center gap-1 overflow-x-auto whitespace-nowrap pb-2",children:f.map(t=>(0,a.jsxs)(l.m_,{children:[(0,a.jsx)(l.k$,{asChild:!0,children:(0,a.jsx)("button",{type:"button",onClick:()=>e8(e.provider,t),className:"shrink-0 rounded-md border border-black/10 px-1.5 py-0.5 transition-colors hover:bg-black/5 hover:text-foreground dark:border-white/10 dark:hover:bg-white/5",children:t.name})}),(0,a.jsx)(l.ZI,{children:"Show this quota row"})]},y(t)))})]})]})]})},e.id)})}),(0,a.jsx)("div",{className:"rounded-xl border border-black/10 bg-black/[0.02] px-3 py-2 dark:border-white/10 dark:bg-white/[0.03]",children:(0,a.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[(0,a.jsx)("span",{className:"text-xs text-muted-foreground",children:tn}),(0,a.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,a.jsxs)("select",{value:ts?"custom":String(eD),onChange:e=>{let t=e.target.value;if("custom"===t)return;let r=Number.parseInt(t,10);Number.isFinite(r)&&(eO(1),eL(r),ez(String(r)))},className:"h-8 rounded-lg border border-black/10 bg-black/[0.02] px-2 text-xs text-foreground outline-none transition-colors hover:bg-black/5 dark:border-white/10 dark:bg-white/[0.03] dark:hover:bg-white/10","aria-label":"Accounts per page",children:[u.map(e=>(0,a.jsxs)("option",{value:String(e),children:[e," / page"]},e)),(0,a.jsx)("option",{value:"custom",children:"Custom"})]}),(0,a.jsx)("input",{type:"number",min:"1",max:String(500),inputMode:"numeric",value:eF,onChange:e=>ez(e.target.value),onBlur:()=>{let e=Number.parseInt(eF,10);if(!Number.isFinite(e))return void ez(String(eD));let t=Math.min(500,Math.max(1,e));eO(1),eL(t),ez(String(t))},onKeyDown:e=>{if("Enter"!==e.key)return;let t=Number.parseInt(eF,10);if(!Number.isFinite(t))return void ez(String(eD));let r=Math.min(500,Math.max(1,t));eO(1),eL(r),ez(String(r))},className:"h-8 w-20 rounded-lg border border-black/10 bg-black/[0.02] px-2 text-xs text-foreground outline-none transition-colors hover:bg-black/5 dark:border-white/10 dark:bg-white/[0.03] dark:hover:bg-white/10","aria-label":"Custom accounts per page",placeholder:"Custom"}),(0,a.jsxs)("span",{className:"text-xs text-muted-foreground",children:["Page ",eZ.page," / ",eZ.totalPages]})]}),(0,a.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,a.jsx)("button",{type:"button",onClick:()=>eO(1),disabled:eZ.page<=1||et||B,className:"flex h-8 items-center rounded-lg border border-black/10 px-3 text-xs text-foreground transition-colors hover:bg-black/5 disabled:cursor-not-allowed disabled:opacity-40 dark:border-white/10 dark:hover:bg-white/5",children:"First Page"}),(0,a.jsx)("button",{type:"button",onClick:()=>eO(e=>Math.max(1,e-1)),disabled:eZ.page<=1||et||B,className:"flex h-8 w-8 items-center justify-center rounded-lg border border-black/10 text-foreground transition-colors hover:bg-black/5 disabled:cursor-not-allowed disabled:opacity-40 dark:border-white/10 dark:hover:bg-white/5","aria-label":"Previous accounts page",children:(0,a.jsx)(n.default,{name:"chevron_left",className:"text-[16px]"})}),(0,a.jsx)("button",{type:"button",onClick:()=>eO(e=>Math.min(eZ.totalPages,e+1)),disabled:eZ.page>=eZ.totalPages||et||B,className:"flex h-8 w-8 items-center justify-center rounded-lg border border-black/10 text-foreground transition-colors hover:bg-black/5 disabled:cursor-not-allowed disabled:opacity-40 dark:border-white/10 dark:hover:bg-white/5","aria-label":"Next accounts page",children:(0,a.jsx)(n.default,{name:"chevron_right",className:"text-[16px]"})}),(0,a.jsx)("button",{type:"button",onClick:()=>eO(eZ.totalPages),disabled:eZ.page>=eZ.totalPages||et||B,className:"flex h-8 items-center rounded-lg border border-black/10 px-3 text-xs text-foreground transition-colors hover:bg-black/5 disabled:cursor-not-allowed disabled:opacity-40 dark:border-white/10 dark:hover:bg-white/5",children:"Last Page"})]})]})}),(0,a.jsx)(S.uo,{isOpen:!!ed,onClose:()=>{el||ec(null)},onConfirm:async()=>{let e=ed?.connection;e&&(await eB(e.id,e.provider),ec(null))},title:"Reset Codex limit?",message:`Use 1 Codex reset credit for ${x(ed?.connection||{})||"this account"}. This cannot be undone. Remaining credits: ${ed?.resetCreditCount??0}.`,confirmText:"Reset limit",cancelText:"Cancel",variant:"danger",loading:!!el}),eu&&(0,a.jsx)($.lG,{open:!0,onOpenChange:e=>{e||em(null)},children:(0,a.jsxs)($.Cf,{className:"sm:max-w-2xl",children:[(0,a.jsxs)($.c7,{children:[(0,a.jsx)($.L3,{children:"Codex Reset Credit Expiry"}),(0,a.jsx)("p",{className:"truncate text-xs text-muted-foreground",children:x(eu.connection)||"Codex account"})]}),(0,a.jsx)("div",{className:"max-h-[70vh] overflow-auto p-4",children:eu.loading?(0,a.jsxs)("div",{className:"flex items-center justify-center gap-2 py-10 text-sm text-muted-foreground",children:[(0,a.jsx)(n.default,{name:"progress_activity",className:"animate-spin text-[20px]"}),"Loading reset credits..."]}):eu.error?(0,a.jsx)("div",{className:"rounded-xl border border-red-500/20 bg-red-500/10 px-3 py-2 text-sm text-red-600 dark:text-red-300",children:eu.error}):eu.data?.credits?.length?(0,a.jsxs)("div",{className:"space-y-3",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between rounded-xl border border-black/10 bg-black/[0.02] px-3 py-2 text-xs text-muted-foreground dark:border-white/10 dark:bg-white/[0.03]",children:[(0,a.jsxs)("span",{children:[eu.data.credits.length," reset credit",1===eu.data.credits.length?"":"s"]}),(0,a.jsxs)("span",{children:[eu.data.availableCount??0," available"]})]}),(0,a.jsx)("div",{className:"overflow-x-auto rounded-xl border border-black/10 dark:border-white/10",children:(0,a.jsxs)("table",{className:"w-full min-w-[560px] text-left text-sm",children:[(0,a.jsx)("thead",{className:"bg-black/[0.03] text-xs uppercase tracking-wide text-muted-foreground dark:bg-white/[0.04]",children:(0,a.jsxs)("tr",{children:[(0,a.jsx)("th",{className:"px-3 py-2 font-medium",children:"Status"}),(0,a.jsx)("th",{className:"px-3 py-2 font-medium",children:"Granted At"}),(0,a.jsx)("th",{className:"px-3 py-2 font-medium",children:"Expires At"}),(0,a.jsx)("th",{className:"px-3 py-2 font-medium",children:"Remaining"})]})}),(0,a.jsx)("tbody",{children:eu.data.credits.map((e,t)=>(0,a.jsxs)("tr",{className:"border-t border-black/5 dark:border-white/5",children:[(0,a.jsx)("td",{className:"px-3 py-2",children:(0,a.jsx)("span",{className:"rounded-full bg-primary/10 px-2 py-0.5 text-xs font-medium text-primary",children:e.status||"unknown"})}),(0,a.jsx)("td",{className:"px-3 py-2 text-muted-foreground",children:T(e.grantedAt)}),(0,a.jsx)("td",{className:"px-3 py-2 text-foreground",children:T(e.expiresAt)}),(0,a.jsx)("td",{className:"px-3 py-2 font-medium text-foreground",children:function(e){if(!e)return"N/A";let t=new Date(e).getTime()-Date.now();if(!Number.isFinite(t))return"N/A";if(t<=0)return"Expired";let r=Math.ceil(t/36e5),a=Math.floor(r/24),n=r%24;return a>0?`${a}d ${n}h`:`${n}h`}(e.expiresAt)})]},`${e.status}-${e.expiresAt||t}`))})]})})]}):(0,a.jsx)("div",{className:"rounded-xl border border-black/10 bg-black/[0.02] px-3 py-8 text-center text-sm text-muted-foreground dark:border-white/10 dark:bg-white/[0.03]",children:"No reset credit details returned for this account."})})]})}),(0,a.jsx)(S.wI,{isOpen:eh,connection:eg,proxyPools:ep,onSave:e1,onClose:()=>{ex(!1),eb(null)}})]}):(0,a.jsx)(P.Zp,{className:"p-8",children:(0,a.jsx)(P.Wu,{className:"px-0 py-0",children:(0,a.jsxs)("div",{className:"text-center py-12",children:[(0,a.jsx)(n.default,{name:ta.icon,className:"text-[64px] text-muted-foreground opacity-20"}),(0,a.jsx)("h3",{className:"mt-4 text-lg font-semibold text-foreground",children:ta.title}),(0,a.jsx)("p",{className:"mt-2 text-sm text-muted-foreground max-w-md mx-auto",children:ta.description})]})})}):(0,a.jsx)(P.Zp,{className:"p-8",children:(0,a.jsx)(P.Wu,{className:"px-0 py-0",children:(0,a.jsxs)("div",{className:"text-center py-12",children:[(0,a.jsx)(n.default,{name:"cloud_off",className:"text-[64px] text-muted-foreground opacity-20"}),(0,a.jsx)("h3",{className:"mt-4 text-lg font-semibold text-foreground",children:"No Providers Connected"}),(0,a.jsx)("p",{className:"mt-2 text-sm text-muted-foreground max-w-md mx-auto",children:"Connect to providers with OAuth to track your API quota limits and usage."})]})})})}},92412:(e,t,r)=>{"use strict";r.d(t,{YW:()=>a.Page,pV:()=>a.CardGrid,wn:()=>a.Section,zY:()=>a.PageHeader}),r(16675),r(72778);var a=r(29575)}},e=>{e.O(0,[6766,5166,7552,9980,1471,5778,4484,3577,5862,5113,1699,7276,1722,159,4489,1278,1830,3973,427,9966,7358],()=>e(e.s=74277)),_N_E=e.O()}]);
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3826],{15764:(e,t,r)=>{"use strict";r.d(t,{CK:()=>o.default,G9:()=>u.default,Iz:()=>p.default,KX:()=>f.PanelSkeleton,LF:()=>s.default,LH:()=>m.default,Mu:()=>f.StatCardSkeleton,Nf:()=>d.default,Qv:()=>n.CardSkeleton,YW:()=>j.YW,gw:()=>b.default,jK:()=>c.default,nh:()=>v.default,pV:()=>j.pV,rq:()=>i.default,uR:()=>l.default,uo:()=>a.ConfirmModal,vE:()=>h.default,vj:()=>x.default,wI:()=>g.default,wn:()=>j.wn,zY:()=>j.zY}),r(58913);var a=r(3537),n=r(58350);r(30872),r(33526),r(42535),r(1279);var s=r(92802),i=r(25908),l=r(58729),o=r(24873),d=r(5258),c=r(80599);r(949),r(56776),r(53599),r(88336),r(69561);var u=r(37753),m=r(23444),h=r(93624),x=r(86920),g=r(65461);r(14580);var b=r(14670),p=r(70296);r(57779),r(22205);var f=r(43276),v=r(75862),j=r(92412)},74277:(e,t,r)=>{Promise.resolve().then(r.bind(r,90411)),Promise.resolve().then(r.bind(r,14580)),Promise.resolve().then(r.bind(r,75862)),Promise.resolve().then(r.bind(r,88336)),Promise.resolve().then(r.bind(r,24873)),Promise.resolve().then(r.bind(r,37753)),Promise.resolve().then(r.bind(r,65461)),Promise.resolve().then(r.bind(r,22205)),Promise.resolve().then(r.bind(r,43276)),Promise.resolve().then(r.bind(r,1279)),Promise.resolve().then(r.bind(r,86920)),Promise.resolve().then(r.bind(r,42535)),Promise.resolve().then(r.bind(r,56776)),Promise.resolve().then(r.bind(r,58913)),Promise.resolve().then(r.bind(r,93624)),Promise.resolve().then(r.bind(r,949)),Promise.resolve().then(r.bind(r,72778)),Promise.resolve().then(r.bind(r,16675)),Promise.resolve().then(r.bind(r,29575)),Promise.resolve().then(r.bind(r,58350)),Promise.resolve().then(r.bind(r,58729)),Promise.resolve().then(r.bind(r,5258)),Promise.resolve().then(r.bind(r,3537)),Promise.resolve().then(r.bind(r,25908)),Promise.resolve().then(r.bind(r,14670)),Promise.resolve().then(r.bind(r,92802)),Promise.resolve().then(r.bind(r,57779)),Promise.resolve().then(r.bind(r,69561)),Promise.resolve().then(r.bind(r,70296)),Promise.resolve().then(r.bind(r,53599)),Promise.resolve().then(r.bind(r,33526)),Promise.resolve().then(r.bind(r,30872)),Promise.resolve().then(r.bind(r,80599)),Promise.resolve().then(r.bind(r,23444))},90411:(e,t,r)=>{"use strict";r.d(t,{default:()=>O});var a=r(29798),n=r(58913),s=r(15814),i=r(738),l=r(1352),o=r(58014);let d="quotaCacheData",c="quotaAutoRefresh",u=[10,20,50,100],m=[{value:"all",label:"All accounts"},{value:"active",label:"Active"},{value:"inactive",label:"Turned off"}],h=[{value:"default",label:"Default quota order"},{value:"remaining-asc",label:"% quota: low to high"},{value:"remaining-desc",label:"% quota: high to low"}];function x(e){return e.name?.trim()||e.email?.trim()||e.displayName?.trim()||null}function g(e,t){let r=t[e.id]?.quotas?.[0];return r&&"number"==typeof r.remaining?r.remaining:1/0}function b(e){let t={};return e.forEach(e=>{t[e.id]=!0}),t}function p(e,t){let r=new Set(t.map(e=>e.id));return Object.fromEntries(Object.entries(e).filter(([e])=>r.has(e)))}async function f(e,t){return await e(t)}function v(){try{let e=window.localStorage.getItem(d);return e?JSON.parse(e):{}}catch(e){return console.error("Error reading quota cache:",e),{}}}function j(e,t){try{let r=v();r[e]={...t,cachedAt:new Date().toISOString()},window.localStorage.setItem(d,JSON.stringify(r))}catch(e){console.error("Error writing quota cache:",e)}}function k(e,t){return t&&0!==t?!e||e<0?100:e>=t?0:Math.round((t-e)/t*100):0}function y(e){return e&&"object"==typeof e?String(e.modelKey||e.name||"").trim():""}function w(e,t,r=[]){let a=t?.[e]?.hidden;return Array.isArray(a)&&0!==a.length?new Set((r.length>0?function(e=[],t=[]){if(!Array.isArray(e)||0===e.length)return[];let r=new Set(t.map(y).filter(Boolean));return[...new Set(e.map(e=>String(e).trim()).filter(e=>r.has(e)))]}(a,r):a).map(String)):new Set}function N({quotas:e=[],compact:t=!1,sortMode:r="default",showSortLabel:i=!1,onHideQuota:o=null}){let[d,c]=(0,s.useState)(1),u=(0,s.useMemo)(()=>e.map((e,t)=>({...e,index:t,remaining:e?.remaining!==void 0?Math.max(0,Math.round(e.remaining)):e?.remainingPercentage!==void 0?Math.round(e.remainingPercentage):k(e?.used,e?.total)})),[e]),m=(0,s.useMemo)(()=>"remaining-asc"===r?[...u].sort((e,t)=>e.remaining-t.remaining||e.name.localeCompare(t.name)):"remaining-desc"===r?[...u].sort((e,t)=>t.remaining-e.remaining||e.name.localeCompare(t.name)):u,[u,r]),h=Math.max(1,Math.ceil(m.length/10));if((0,s.useEffect)(()=>{c(1)},[r,e]),(0,s.useEffect)(()=>{c(e=>Math.min(e,h))},[h]),!e||0===e.length)return null;let x=m.slice((d-1)*10,10*d),g=0===m.length?0:(d-1)*10+1,b=Math.min(10*d,m.length),p=t?"py-1 px-1.5":"py-2 px-3",f=t?"text-[11px]":"text-sm",v=t?"text-[11px]":"text-sm",j=t?"text-[10px] leading-tight":"text-xs",y="function"==typeof o;return(0,a.jsxs)("div",{className:"space-y-2",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,a.jsxs)("div",{className:"text-[10px] text-muted-foreground",children:[m.length," quota",m.length>1?"s":""]}),i&&(0,a.jsx)("div",{className:"rounded-md border border-black/10 bg-black/[0.02] px-2 py-1 text-[10px] text-muted-foreground dark:border-white/10 dark:bg-white/[0.03]",children:"Sorted by account remaining"})]}),(0,a.jsx)("div",{className:"space-y-px",children:x.map(e=>{var r;let s=!0===e.unlimited,i=!0===e.isCreditBalance,d=i?{text:"text-blue-600 dark:text-blue-400",bg:"bg-blue-500",bgLight:"bg-blue-500/10",emoji:"\uD83D\uDCB0"}:(r=e.remaining)>70?{text:"text-green-600 dark:text-green-400",bg:"bg-green-500",bgLight:"bg-green-500/10",emoji:"\uD83D\uDFE2"}:r>=30?{text:"text-yellow-600 dark:text-yellow-400",bg:"bg-yellow-500",bgLight:"bg-yellow-500/10",emoji:"\uD83D\uDFE1"}:{text:"text-red-600 dark:text-red-400",bg:"bg-red-500",bgLight:"bg-red-500/10",emoji:"\uD83D\uDD34"},c=function(e){if(!e)return"-";try{let t="string"==typeof e?new Date(e):e,r=new Date,a=t-r;if(a<=0)return"-";let n=Math.ceil(a/6e4);if(n<60)return`${n}m`;let s=Math.floor(n/60),i=n%60;if(s<24)return`${s}h ${i}m`;let l=Math.floor(s/24);return`${l}d ${s%24}h ${i}m`}catch(e){return"-"}}(e.resetAt),u=function(e){if(!e)return null;try{let t=new Date(e),r=new Date,a=new Date(r.getFullYear(),r.getMonth(),r.getDate()),n=new Date(a);n.setDate(n.getDate()+1);let s="";s=t>=a&&t<n?"Today":t>=n&&t<new Date(n.getTime()+864e5)?"Tomorrow":t.toLocaleDateString("en-US",{month:"short",day:"numeric"});let i=t.toLocaleTimeString("en-US",{hour:"numeric",minute:"2-digit",hour12:!0});return`${s}, ${i}`}catch{return null}}(e.resetAt),m=!1!==e.recurring?`in ${c}`:`expires in ${c}`;return(0,a.jsxs)("div",{className:`flex items-center gap-2 border-b border-black/5 dark:border-white/5 hover:bg-black/[0.02] dark:hover:bg-white/[0.02] transition-colors ${p}`,children:[(0,a.jsxs)("div",{className:"flex w-36 min-w-0 items-center gap-1.5",children:[(0,a.jsx)("span",{className:"text-[10px] shrink-0",children:d.emoji}),(0,a.jsx)("span",{className:`${f} font-medium text-foreground truncate`,children:e.name})]}),(0,a.jsxs)("div",{className:`min-w-0 flex-1 ${t?"space-y-1":"space-y-1.5"}`,children:[!s&&!i&&(0,a.jsx)("div",{className:`${t?"h-1":"h-1.5"} rounded-full overflow-hidden border ${d.bgLight} ${0===e.remaining?"border-black/10 dark:border-white/10":"border-transparent"}`,children:(0,a.jsx)("div",{className:`h-full transition-all duration-300 ${d.bg}`,style:{width:`${Math.min(e.remaining,100)}%`}})}),(0,a.jsxs)("div",{className:`flex items-center justify-between gap-1 min-w-0 ${t?"text-[10px]":"text-xs"}`,children:[(0,a.jsxs)(l.m_,{children:[(0,a.jsx)(l.k$,{asChild:!0,children:(0,a.jsx)("span",{className:"text-muted-foreground truncate",children:s?`${e.used.toLocaleString()} used \xb7 Unlimited`:i?`Credit: ${e.total.toFixed(2)} ${e.currency||""}`:`${e.used.toLocaleString()} / ${e.total>0?e.total.toLocaleString():"∞"}`})}),(0,a.jsx)(l.ZI,{children:s?`${e.used.toLocaleString()} used \xb7 Unlimited`:i?`Credit balance: ${e.total.toFixed(2)} ${e.currency||""}`:`${e.used.toLocaleString()} / ${e.total>0?e.total.toLocaleString():"∞"}`})]}),(0,a.jsx)("span",{className:`font-medium ${s?"text-green-600 dark:text-green-400":i?"text-blue-600 dark:text-blue-400":d.text} shrink-0`,children:s?"Unlimited":i?"":`${e.remaining}%`})]})]}),(0,a.jsx)("div",{className:"min-w-0 shrink",children:"-"!==c||u?t?(0,a.jsxs)(l.m_,{children:[(0,a.jsx)(l.k$,{asChild:!0,children:(0,a.jsx)("div",{className:`${v} text-foreground font-medium truncate`,children:"-"!==c?m:u})}),(0,a.jsx)(l.ZI,{children:u||""})]}):(0,a.jsxs)("div",{className:"min-w-0 space-y-0.5",children:["-"!==c&&(0,a.jsx)("div",{className:`${v} text-foreground font-medium truncate`,children:m}),u&&(0,a.jsx)("div",{className:`${j} text-muted-foreground truncate`,children:u})]}):(0,a.jsx)("div",{className:`${v} text-muted-foreground italic`,children:"N/A"})}),y&&(0,a.jsxs)(l.m_,{children:[(0,a.jsx)(l.k$,{asChild:!0,children:(0,a.jsx)("button",{type:"button",onClick:()=>o(e),className:"inline-flex h-6 w-6 shrink-0 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-black/5 hover:text-foreground dark:hover:bg-white/5","aria-label":`Hide quota ${e.name}`,children:(0,a.jsx)(n.default,{name:"visibility_off",className:"text-[15px]"})})}),(0,a.jsx)(l.ZI,{children:"Hide this quota row"})]})]},`${e.name}-${e.index}`)})}),h>1&&(0,a.jsxs)("div",{className:"rounded-md border border-black/10 bg-black/[0.02] px-2 py-1.5 dark:border-white/10 dark:bg-white/[0.03]",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between gap-2 text-[10px] text-muted-foreground",children:[(0,a.jsxs)("span",{children:["Showing ",g,"-",b," of ",m.length]}),(0,a.jsxs)("span",{children:["Page ",d," / ",h]})]}),(0,a.jsxs)("div",{className:"mt-1.5 flex items-center justify-end gap-1",children:[(0,a.jsx)("button",{type:"button",onClick:()=>c(e=>Math.max(1,e-1)),disabled:1===d,className:"flex h-6 items-center rounded-md border border-black/10 px-2 text-[10px] text-foreground transition-colors hover:bg-black/5 disabled:cursor-not-allowed disabled:opacity-40 dark:border-white/10 dark:hover:bg-white/5",children:"Prev"}),(0,a.jsx)("button",{type:"button",onClick:()=>c(e=>Math.min(h,e+1)),disabled:d===h,className:"flex h-6 items-center rounded-md border border-black/10 px-2 text-[10px] text-foreground transition-colors hover:bg-black/5 disabled:cursor-not-allowed disabled:opacity-40 dark:border-white/10 dark:hover:bg-white/5",children:"Next"})]})]})]})}var C=r(14231),P=r(75669),S=r(15764),$=r(49787),A=r(13794),q=r(63523);let E={claude:"claudeAutoPing",codex:"codexAutoPing"},_={claude:"When your 5h quota runs out, auto-sends a request the moment it resets so a new window starts right away.",codex:"Auto-starts the next 5h Codex window after reset by sending a tiny gpt-5.5 request. Consumes a small amount of quota."};function I(e){return e.name?.trim()&&e.email?.trim()&&e.name.trim()!==e.email.trim()?e.email.trim():e.name?.trim()&&e.displayName?.trim()&&e.name.trim()!==e.displayName.trim()?e.displayName.trim():null}function M(e){return A.Q2[e]?.name||e}function T(e){if(!e)return"N/A";let t=new Date(e);return Number.isFinite(t.getTime())?t.toLocaleString(void 0,{month:"short",day:"numeric",year:"numeric",hour:"numeric",minute:"2-digit"}):"N/A"}function O(){let{copied:e,copy:t}=(0,q.C)(),[r,O]=(0,s.useState)([]),[D,L]=(0,s.useState)({}),[F,z]=(0,s.useState)({}),[Z,W]=(0,s.useState)({}),[R,U]=(0,s.useState)(!0),[K,H]=(0,s.useState)({claude:{},codex:{}}),[J,V]=(0,s.useState)(null),[Y,G]=(0,s.useState)(!1),[B,Q]=(0,s.useState)(!1),[X,ee]=(0,s.useState)(60),[et,er]=(0,s.useState)(!0),[ea,en]=(0,s.useState)(null),[es,ei]=(0,s.useState)(null),[el,eo]=(0,s.useState)(null),[ed,ec]=(0,s.useState)(null),[eu,em]=(0,s.useState)(null),[eh,ex]=(0,s.useState)(!1),[eg,eb]=(0,s.useState)(null),[ep,ef]=(0,s.useState)([]),[ev,ej]=(0,s.useState)("all"),[ek,ey]=(0,s.useState)([]),[ew,eN]=(0,s.useState)("all"),[eC,eP]=(0,s.useState)("default"),[eS,e$]=(0,s.useState)({}),[eA,eq]=(0,s.useState)(!1),[eE,e_]=(0,s.useState)(!1),[eI,eM]=(0,s.useState)(!1),[eT,eO]=(0,s.useState)(1),[eD,eL]=(0,s.useState)(20),[eF,ez]=(0,s.useState)(String(20)),[eZ,eW]=(0,s.useState)({page:1,pageSize:20,total:0,totalPages:1}),[eR,eU]=(0,s.useState)({eligibleConnections:0,providerFilteredConnections:0}),eK=(0,s.useRef)(null),eH=(0,s.useRef)(null),eJ=(0,s.useRef)(0),eV=(0,s.useCallback)(async(e=eT)=>{try{var t,r;let a=new URLSearchParams({page:String(e),pageSize:String(eD),accountStatus:ew,sort:"priority"});"all"!==ev&&a.set("provider",ev);let n=await fetch(`/api/providers/client?${a.toString()}`);if(!n.ok)throw Error("Failed to fetch connections");let s=await n.json(),i=s.connections||[],l=(t=s.pagination,t||{page:1,pageSize:eD,total:0,totalPages:1}),o=function(e,t=0){return e||{eligibleConnections:t,providerFilteredConnections:t}}(s.totals,i.length);return O(i),ey(s.providerOptions||[]),eW(l),eU(o),eO((r=s.pagination,r?.page||e)),i}catch(e){return console.error("Error fetching connections:",e),O([]),ey([]),eW({page:1,pageSize:eD,total:0,totalPages:1}),eU({eligibleConnections:0,providerFilteredConnections:0}),[]}},[ew,eA,eT,eD,ev]),eY=(0,s.useCallback)(async(e,t,{force:r=!1}={})=>{z(t=>({...t,[e]:!0})),W(t=>({...t,[e]:null}));try{console.log(`[ProviderLimits] Fetching quota for ${t} (${e})`);let a=`/api/usage/${e}${r?"?force=1":""}`,n=await fetch(a);if(!n.ok){let r=(await n.json().catch(()=>({}))).error||n.statusText;if(404===n.status)return void console.warn(`[ProviderLimits] Connection not found for ${t}, skipping`);if(401===n.status){console.warn(`[ProviderLimits] Auth error for ${t}:`,r);let a={quotas:[],message:r};L(t=>({...t,[e]:a})),j(e,a);return}throw Error(`HTTP ${n.status}: ${r}`)}let s=await n.json();console.log(`[ProviderLimits] Got quota for ${t}:`,s);let i={quotas:function(e,t){if(!t||"object"!=typeof t)return[];let r=[];try{switch(e.toLowerCase()){case"github":default:t.quotas&&Object.entries(t.quotas).forEach(([e,t])=>{r.push({name:e,used:t.used||0,total:t.total||0,resetAt:t.resetAt||null})});break;case"antigravity":if(t.quotas){let e=Object.entries(t.quotas),a=new Set(["gemini_weekly","claude_gpt_weekly"]),n=e.filter(([e])=>e.startsWith("gemini-")&&!e.includes("image")),s=e.filter(([e])=>e.startsWith("claude-")),i=e.filter(([e])=>e.includes("image")),l=e.filter(([e])=>a.has(e)),o=e.filter(([e])=>!e.startsWith("gemini-")&&!e.startsWith("claude-")&&!e.includes("image")&&!a.has(e));if(n.length>0){let e=n.reduce((e,t)=>(t[1].remainingPercentage??100)<(e[1].remainingPercentage??100)?t:e)[1];r.push({name:"Gemini (Flash / Pro)",modelKey:"gemini",used:e.used||0,total:e.total||0,resetAt:e.resetAt||null,remainingPercentage:e.remainingPercentage})}if(s.length>0){let e=s.reduce((e,t)=>(t[1].remainingPercentage??100)<(e[1].remainingPercentage??100)?t:e)[1];r.push({name:"Claude (Sonnet / Opus)",modelKey:"claude",used:e.used||0,total:e.total||0,resetAt:e.resetAt||null,remainingPercentage:e.remainingPercentage})}l.forEach(([e,t])=>{r.push({name:t.displayName||e,modelKey:e,used:t.used||0,total:t.total||0,resetAt:t.resetAt||null,remainingPercentage:t.remainingPercentage})}),i.forEach(([e,t])=>{r.push({name:t.displayName||e,modelKey:e,used:t.used||0,total:t.total||0,resetAt:t.resetAt||null,remainingPercentage:t.remainingPercentage})}),o.forEach(([e,t])=>{r.push({name:t.displayName||e,modelKey:e,used:t.used||0,total:t.total||0,resetAt:t.resetAt||null,remainingPercentage:t.remainingPercentage})})}break;case"codex":t.quotas&&Object.entries(t.quotas).forEach(([e,t])=>{let a=e;"spark_session"===e?a="Spark (5h)":"spark_weekly"===e?a="Spark (Weekly)":"session"===e?a="5h":"weekly"===e?a="Weekly":"review_session"===e?a="Review (5h)":"review_weekly"===e&&(a="Review (Weekly)"),r.push({name:a,quotaType:e,used:t.used||0,total:t.total||0,remaining:t.remaining,resetAt:t.resetAt||null})});break;case"qoder":t.quotas&&Object.entries(t.quotas).forEach(([e,t])=>{("organization"!==e||t&&0!==(Number(t.total)||0))&&r.push({name:"user"===e?"Personal":"organization"===e?"Organization":e,used:t.used||0,total:t.total||0,unit:t.unit,resetAt:t.resetAt||null})});break;case"claude":t.message?r.push({name:"error",used:0,total:0,resetAt:null,message:t.message}):t.quotas&&Object.entries(t.quotas).forEach(([e,t])=>{r.push({name:e,used:t.used||0,total:t.total||0,remaining:void 0!==t.remaining?t.remaining:Math.max(0,(t.total||100)-(t.used||0)),remainingPercentage:void 0!==t.remainingPercentage?t.remainingPercentage:k(t.used,t.total),resetAt:t.resetAt||null})});break;case"vercel-ai-gateway":t.quotas&&Object.entries(t.quotas).forEach(([e,t])=>{r.push({name:e,used:t.used||0,total:t.total||0,resetAt:t.resetAt||null,remainingPercentage:t.remainingPercentage})});break;case"codebuddy-cn":t.quotas&&Object.entries(t.quotas).forEach(([e,t])=>{r.push({name:e,used:t.used||0,total:t.total||0,resetAt:t.resetAt||null,recurring:!1!==t.recurring})});break;case"grok-cli":t.quotas&&Object.entries(t.quotas).forEach(([e,t])=>{r.push({name:e,used:t.used||0,total:t.total||0,resetAt:t.resetAt||null,remainingPercentage:t.remainingPercentage})});break;case"deepseek":t.quotas&&Object.entries(t.quotas).forEach(([e,t])=>{r.push({name:e,used:t.used||0,total:t.total||0,resetAt:t.resetAt||null,remainingPercentage:t.remainingPercentage,isCreditBalance:t.isCreditBalance??!0,currency:t.currency||(e.includes("(")?e.slice(e.indexOf("(")+1,e.indexOf(")")):"USD")})});break;case"groq":t.quotas&&Object.entries(t.quotas).forEach(([e,t])=>{r.push({name:e,used:t.used||0,total:t.total||0,resetAt:t.resetAt||null})});break;case"ollama":t.quotas&&Object.entries(t.quotas).forEach(([e,t])=>{r.push({name:e,used:t.used||0,total:t.total||0,resetAt:t.resetAt||null,remainingPercentage:t.remainingPercentage})});break;case"zed":t.quotas&&Object.entries(t.quotas).forEach(([e,t])=>{r.push({name:e,used:t.used||0,total:t.total||0,resetAt:t.resetAt||null,remainingPercentage:t.remainingPercentage,unlimited:t.unlimited})})}}catch(t){return console.error(`Error parsing quota data for ${e}:`,t),[]}if(e?.toLowerCase()==="claude"){let e={"session (5h)":0,"weekly (7d)":1,"weekly fable (7d)":2,"weekly opus (7d)":3,"weekly sonnet (7d)":4};return r.sort((t,r)=>(e[t.name]??99)-(e[r.name]??99)),r}let a=(0,o.KC)(e);if(a.length>0){let e=new Map(a.map((e,t)=>[e.id,t]));r.sort((t,r)=>{let a=t.modelKey||t.name,n=r.modelKey||r.name;return"gemini"===a&&(a="gemini-3.8-flash-high"),"claude"===a&&(a="claude-sonnet-4-6"),"gemini"===n&&(n="gemini-3.8-flash-high"),"claude"===n&&(n="claude-sonnet-4-6"),(e.get(a)??999)-(e.get(n)??999)})}return r}(t,s),plan:s.plan||null,message:s.message||null,raw:s};L(t=>({...t,[e]:i})),j(e,i)}catch(r){console.error(`[ProviderLimits] Error fetching quota for ${t} (${e}):`,r),W(t=>({...t,[e]:r.message||"Failed to fetch quota"}))}finally{z(t=>({...t,[e]:!1}))}},[]),eG=(0,s.useCallback)(async(e,t)=>{await eY(e,t,{force:!0}),V(new Date)},[eY]),eB=(0,s.useCallback)(async(e,t)=>{if("codex"===t&&!el){eo(e),W(t=>({...t,[e]:null}));try{let r=await fetch(`/api/usage/${e}/codex-reset-credits`,{method:"POST"}),a=await r.json().catch(()=>({}));if(!r.ok)throw Error(a.message||a.error||a.code||"Failed to reset Codex limit");await eY(e,t),V(new Date)}catch(t){W(r=>({...r,[e]:t.message||"Failed to reset Codex limit"}))}finally{eo(null)}}},[eY,el]),eQ=(0,s.useCallback)(async e=>{em({connection:e,loading:!0,error:null,data:null});try{let t=await fetch(`/api/usage/${e.id}/codex-reset-credits`,{cache:"no-store"}),r=await t.json().catch(()=>({}));if(!t.ok)throw Error(r.error||r.message||"Failed to load Codex reset credits");let a=Array.isArray(r.credits)?[...r.credits]:[];a.sort((e,t)=>{let r=e.expiresAt?new Date(e.expiresAt).getTime():1/0,a=t.expiresAt?new Date(t.expiresAt).getTime():1/0;return r-a}),em({connection:e,loading:!1,error:null,data:{...r,credits:a}})}catch(t){em({connection:e,loading:!1,error:t.message||"Failed to load Codex reset credits",data:null})}},[]),eX=(0,s.useCallback)(async e=>{if(confirm("Delete this connection?")){en(e);try{if((await fetch(`/api/providers/${e}`,{method:"DELETE"})).ok){L(t=>{let r={...t};return delete r[e],r}),z(t=>{let r={...t};return delete r[e],r}),W(t=>{let r={...t};return delete r[e],r});try{let t=v();t[e]&&(delete t[e],window.localStorage.setItem(d,JSON.stringify(t)))}catch(e){console.error("Error deleting cache entry:",e)}await f(eV,eT)}}catch(e){console.error("Error deleting connection:",e)}finally{en(null)}}},[eV,eT]),e0=(0,s.useCallback)(async(e,t)=>{ei(e);try{(await fetch(`/api/providers/${e}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({isActive:t})})).ok&&(L(e=>({...e})),await f(eV,eT))}catch(e){console.error("Error updating connection status:",e)}finally{ei(null)}},[eV,eT]),e1=(0,s.useCallback)(async e=>{if(!eg?.id)return;let t=eg.id,r=eg.provider;try{(await fetch(`/api/providers/${t}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})).ok&&(await eV(),ex(!1),eb(null),A.wb.includes(r)&&await eY(t,r))}catch(e){console.error("Error saving connection:",e)}},[eg,eV,eY]);(0,s.useEffect)(()=>{let e=!1;return fetch("/api/proxy-pools?isActive=true",{cache:"no-store"}).then(e=>e.json()).then(t=>{!e&&t?.proxyPools&&ef(t.proxyPools)}).catch(()=>{}),()=>{e=!0}},[]);let e5=(0,s.useCallback)(async(e=!1)=>{if(B)return;Q(!0),ee(60);let t=eJ.current+=1,r=Math.round(10);try{let a=await eV(eT);z(b(a)),W(e=>p(e,a)),L(e=>p(e,a)),await Promise.all(a.filter(a=>e||"claude"!==a.provider||t%r==0).map(e=>eY(e.id,e.provider))),V(new Date)}catch(e){console.error("Error refreshing all providers:",e)}finally{Q(!1)}},[B,eV,eY,eT]);(0,s.useEffect)(()=>{(async()=>{er(!0);let e=await eV(eT);er(!1),z(b(e)),W(t=>p(t,e)),L(t=>p(t,e)),await Promise.all(e.map(e=>eY(e.id,e.provider))),V(new Date)})()},[eV,eY,eT]),(0,s.useEffect)(()=>{let e=window.localStorage.getItem(c);U(null===e||"true"===e),G(!0)},[]),(0,s.useEffect)(()=>{Y&&window.localStorage.setItem(c,String(R))},[R,Y]),(0,s.useEffect)(()=>{fetch("/api/settings",{cache:"no-store"}).then(e=>e.ok?e.json():{}).then(e=>{H({claude:e?.claudeAutoPing?.connections||{},codex:e?.codexAutoPing?.connections||{}}),e$(e?.quotaVisibility||{})}).catch(()=>{})},[]);let e2=(0,s.useCallback)(async(e,t,r)=>{let a=E[t];if(!a)return;let n={...K[t]||{},[e]:r};H({...K,[t]:n});try{let e=await fetch("/api/settings",{cache:"no-store"}),t={...(e.ok?await e.json():{})[a]||{},connections:n};await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({[a]:t})})}catch{H(K)}},[K]),e3=(0,s.useCallback)(async(e,t)=>{e$(e);try{if(!(await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({quotaVisibility:e})})).ok)throw Error("Failed to update quota visibility")}catch(e){console.error("Error updating quota visibility:",e),e$(t)}},[]),e8=(0,s.useCallback)((e,t)=>{let r=y(t);if(!e||!r)return;let a=eS[e]||{},n=new Set(a.hidden||[]);if(n.add(r),"antigravity"===e){if("gemini"===r)for(let e of n)e.startsWith("gemini-")&&!e.includes("image")&&n.delete(e);else if("claude"===r)for(let e of n)e.startsWith("claude-")&&n.delete(e)}e3({...eS,[e]:{...a,hidden:[...n]}},eS)},[eS,e3]),e4=(0,s.useCallback)((e,t)=>{let r=y(t);if(!e||!r)return;let a=eS[e]||{},n=new Set(a.hidden||[]);if(n.delete(r),"antigravity"===e){if("gemini"===r)for(let e of n)e.startsWith("gemini-")&&!e.includes("image")&&n.delete(e);else if("claude"===r)for(let e of n)e.startsWith("claude-")&&n.delete(e)}e3({...eS,[e]:{...a,hidden:[...n]}},eS)},[eS,e3]);(0,s.useEffect)(()=>{if(!Y||!R){eK.current&&(clearInterval(eK.current),eK.current=null),eH.current&&(clearInterval(eH.current),eH.current=null);return}return eK.current=setInterval(()=>{e5()},6e4),eH.current=setInterval(()=>{ee(e=>e<=1?60:e-1)},1e3),()=>{eK.current&&clearInterval(eK.current),eH.current&&clearInterval(eH.current)}},[R,e5,Y]),(0,s.useEffect)(()=>{let e=()=>{document.hidden?(eK.current&&(clearInterval(eK.current),eK.current=null),eH.current&&(clearInterval(eH.current),eH.current=null)):R&&Y&&(eK.current=setInterval(()=>e5(),6e4),eH.current=setInterval(()=>{ee(e=>e<=1?60:e-1)},1e3))};return document.addEventListener("visibilitychange",e),()=>{document.removeEventListener("visibilitychange",e)}},[R,e5,Y]);let e6=(0,s.useMemo)(()=>(function(e,t,r,a,n){if("codex"===a&&"default"!==n)return[...e].sort((e,r)=>{let a=g(e,t),s=g(r,t),i="remaining-asc"===n?a-s:s-a;return 0!==i?i:(x(e)||"").localeCompare(x(r)||"")});if(!r){let t=new Map;for(let r of e){let e=r.provider||"";t.has(e)||t.set(e,[]),t.get(e).push(r)}return Array.from(t.values()).flat()}let s=e=>{let r=(t[e.id]?.quotas||[]).map(e=>e.resetAt?new Date(e.resetAt).getTime():1/0).filter(e=>Number.isFinite(e));return r.length>0?Math.min(...r):1/0};return[...e].sort((e,t)=>{let r=s(e)-s(t);return 0!==r?r:(e.provider||"").localeCompare(t.provider||"")||(x(e)||"").localeCompare(x(t)||"")})})(r,D,eA,ev,eC),[r,D,eA,ev,eC]),e7=e=>{let t=D[e.id]?.quotas;return!!t?.length&&t.some(e=>!!e.total&&!(e.total<=0)&&5>=k(e.used,e.total))},e9=(0,s.useCallback)(async(e,t)=>{if(e.length&&!eI){eM(!0);try{await Promise.all(e.map(e=>fetch(`/api/providers/${e}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({isActive:t})}))),await f(eV,eT)}catch(e){console.error("Error bulk toggling connections:",e)}finally{eM(!1)}}},[eI,eV,eT]),te="all"===ev?"All providers":M(ev),tt=eR.eligibleConnections>0,tr=e6.length>0,ta=eR.eligibleConnections?eR.providerFilteredConnections?{icon:"filter_alt_off",title:"No Accounts On This Page",description:"Try moving to another page or refreshing the current filters."}:{icon:"filter_alt_off",title:"No Accounts Match Current Filters",description:"all"===ev?"Try changing the account status filter to see more quota trackers.":`No ${"inactive"===ew?"turned off":"active"===ew?"active":"matching"} accounts found for ${ev}.`}:{icon:"cloud_off",title:"No Providers Connected",description:"Connect to providers with OAuth to track your API quota limits and usage."},tn=function(e){var t;let{start:r,end:a}=(t=e).total?{start:(t.page-1)*t.pageSize+1,end:Math.min(t.page*t.pageSize,t.total)}:{start:0,end:0};return`Showing ${r}-${a} of ${e.total}`}(eZ),ts=!u.includes(eD);return et||tt?et||tr?(0,a.jsxs)("div",{className:"space-y-6",children:[(0,a.jsx)("div",{className:"flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-end",children:(0,a.jsxs)("div",{className:"flex flex-wrap items-center gap-1.5",children:[(0,a.jsxs)("div",{className:"relative",children:[(0,a.jsxs)(l.m_,{children:[(0,a.jsx)(l.k$,{asChild:!0,children:(0,a.jsxs)("button",{type:"button",onClick:()=>e_(e=>!e),className:"flex h-8 items-center justify-between gap-1 rounded-lg border border-black/10 bg-black/[0.02] px-2 text-xs text-foreground transition-colors hover:bg-black/5 dark:border-white/10 dark:bg-white/[0.03] dark:hover:bg-white/10","aria-haspopup":"menu","aria-expanded":eE,children:[(0,a.jsxs)("span",{className:"flex min-w-0 items-center gap-1.5",children:["all"===ev?(0,a.jsx)(n.default,{name:"apps",className:"text-[14px] text-muted-foreground"}):(0,a.jsx)(i.A,{src:`/providers/${ev}.png`,alt:ev,size:18,className:"size-[18px] rounded object-contain",fallbackText:ev.slice(0,2).toUpperCase()}),(0,a.jsx)("span",{className:"truncate hidden lg:inline",children:te})]}),(0,a.jsx)(n.default,{name:"expand_more",className:"text-[14px] text-muted-foreground"})]})}),(0,a.jsx)(l.ZI,{children:"Filter quota providers"})]}),eE&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("button",{type:"button",className:"fixed inset-0 z-30 bg-transparent","aria-label":"Close provider filter",onClick:()=>e_(!1)}),(0,a.jsxs)("div",{className:"absolute left-0 z-40 mt-2 w-64 overflow-hidden rounded-2xl border border-black/10 bg-card/95 p-1.5 shadow-xl shadow-black/10 backdrop-blur dark:border-white/10 dark:bg-card/95 sm:w-72",children:[(0,a.jsxs)("button",{type:"button",onClick:()=>{"all"!==ev&&eO(1),ej("all"),e_(!1)},className:`flex w-full items-center gap-3 rounded-xl px-3 py-2.5 text-left text-sm transition-colors ${"all"===ev?"bg-primary/10 text-primary":"text-foreground hover:bg-black/5 dark:hover:bg-white/10"}`,children:[(0,a.jsx)(n.default,{name:"apps",className:"text-[22px]"}),(0,a.jsx)("span",{className:"font-medium",children:"All providers"}),"all"===ev&&(0,a.jsx)(n.default,{name:"check",className:"ml-auto text-[20px]"})]}),(0,a.jsx)("div",{className:"my-1 h-px bg-black/10 dark:bg-white/10"}),(0,a.jsx)("div",{className:"max-h-72 overflow-y-auto pr-1",children:ek.map(e=>(0,a.jsxs)("button",{type:"button",onClick:()=>{ev!==e&&eO(1),ej(e),e_(!1)},className:`flex w-full items-center gap-3 rounded-xl px-3 py-2.5 text-left text-sm transition-colors ${ev===e?"bg-primary/10 text-primary":"text-foreground hover:bg-black/5 dark:hover:bg-white/10"}`,children:[(0,a.jsx)(i.A,{src:`/providers/${e}.png`,alt:e,size:24,className:"size-6 rounded-md object-contain",fallbackText:e.slice(0,2).toUpperCase()}),(0,a.jsx)("span",{className:"font-medium",children:M(e)}),ev===e&&(0,a.jsx)(n.default,{name:"check",className:"ml-auto text-[20px]"})]},e))})]})]})]}),(0,a.jsx)("select",{value:ew,onChange:e=>{let t=e.target.value;ew!==t&&eO(1),eN(t)},className:"h-8 rounded-lg border border-black/10 bg-black/[0.02] px-2 text-xs text-foreground outline-none transition-colors hover:bg-black/5 dark:border-white/10 dark:bg-white/[0.03] dark:hover:bg-white/10","aria-label":"Filter accounts by status",children:m.map(e=>(0,a.jsx)("option",{value:e.value,children:e.label},e.value))}),"codex"===ev&&(0,a.jsx)("select",{value:eC,onChange:e=>eP(e.target.value),className:"h-8 rounded-lg border border-black/10 bg-black/[0.02] px-2 text-xs text-foreground outline-none transition-colors hover:bg-black/5 dark:border-white/10 dark:bg-white/[0.03] dark:hover:bg-white/10","aria-label":"Sort Codex quotas by remaining",children:h.map(e=>(0,a.jsx)("option",{value:e.value,children:e.label},e.value))}),(0,a.jsxs)(l.m_,{children:[(0,a.jsx)(l.k$,{asChild:!0,children:(0,a.jsxs)("button",{type:"button",onClick:()=>eq(e=>!e),"aria-pressed":eA,className:`flex h-8 shrink-0 items-center gap-1 rounded-lg border px-2 text-xs transition-colors ${eA?"border-amber-500/40 bg-amber-500/10 text-amber-500":"border-black/10 text-foreground hover:bg-black/5 dark:border-white/10 dark:hover:bg-white/5"}`,children:[(0,a.jsx)(n.default,{name:"hourglass_top",className:"text-[14px]"}),(0,a.jsx)("span",{className:"hidden sm:inline",children:"Expiring first"})]})}),(0,a.jsx)(l.ZI,{children:"Sort accounts by earliest quota reset time"})]}),(0,a.jsxs)(l.m_,{children:[(0,a.jsx)(l.k$,{asChild:!0,children:(0,a.jsxs)("button",{type:"button",onClick:()=>{e9(e6.filter(e=>(e.isActive??!0)&&e7(e)).map(e=>e.id),!1)},disabled:eI,className:"flex h-8 shrink-0 items-center gap-1 rounded-lg border border-red-500/30 px-2 text-xs text-red-500 transition-colors hover:bg-red-500/10 disabled:opacity-50",children:[(0,a.jsx)(n.default,{name:"block",className:"text-[14px]"}),(0,a.jsx)("span",{className:"hidden sm:inline",children:"Turn off Empty"})]})}),(0,a.jsx)(l.ZI,{children:"Disable connections with depleted quota on the current page"})]}),(0,a.jsxs)(l.m_,{children:[(0,a.jsx)(l.k$,{asChild:!0,children:(0,a.jsxs)("button",{type:"button",onClick:()=>{e9(e6.filter(e=>!(e.isActive??!0)&&!e7(e)).map(e=>e.id),!0)},disabled:eI,className:"flex h-8 shrink-0 items-center gap-1 rounded-lg border border-emerald-500/30 px-2 text-xs text-emerald-500 transition-colors hover:bg-emerald-500/10 disabled:opacity-50",children:[(0,a.jsx)(n.default,{name:"check_circle",className:"text-[14px]"}),(0,a.jsx)("span",{className:"hidden sm:inline",children:"Turn on Available"})]})}),(0,a.jsx)(l.ZI,{children:"Enable connections that still have quota on the current page"})]}),(0,a.jsxs)("label",{className:"flex h-8 shrink-0 cursor-pointer items-center gap-1.5 rounded-lg border border-black/10 px-2 text-xs transition-colors hover:bg-black/5 dark:border-white/10 dark:hover:bg-white/5",children:[(0,a.jsx)(C.d,{checked:R,onCheckedChange:()=>U(e=>!e),size:"sm","aria-label":R?"Disable auto-refresh":"Enable auto-refresh"}),(0,a.jsx)("span",{className:"hidden text-foreground sm:inline",children:"Auto-refresh"}),R&&(0,a.jsxs)("span",{className:"text-[10px] text-muted-foreground tabular-nums",children:["(",X,"s)"]})]}),(0,a.jsxs)(l.m_,{children:[(0,a.jsx)(l.k$,{asChild:!0,children:(0,a.jsx)("button",{type:"button",onClick:()=>e5(!0),disabled:B,className:"flex h-8 shrink-0 items-center gap-1 rounded-lg border border-black/10 px-2 text-xs text-foreground transition-colors hover:bg-black/5 dark:border-white/10 dark:hover:bg-white/5 disabled:opacity-50",children:(0,a.jsx)(n.default,{name:"refresh",className:`text-[14px] ${B?"animate-spin":""}`})})}),(0,a.jsx)(l.ZI,{children:"Refresh all"})]})]})}),eA&&(0,a.jsx)("div",{className:"rounded-xl border border-amber-500/20 bg-amber-500/10 px-3 py-2 text-xs text-amber-700 dark:text-amber-300",children:"Expiring-first currently reorders accounts inside the current page. Cross-page ordering still follows backend pagination."}),(0,a.jsx)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:e6.map(e=>{let t,r,s=D[e.id],o=F[e.id],d=Z[e.id],c=!1===e.isActive,u="codex"===e.provider,m=Number.isFinite(r="number"==typeof(t=s?.raw?.resetCredits?.availableCount)?t:Number(t))?Math.max(0,r):0,h=el===e.id,g=ea===e.id||es===e.id||h,b=s?.quotas||[],p=function(e,t=[],r={}){if(!Array.isArray(t)||0===t.length)return[];let a=w(e,r,t);return 0===a.size?t:t.filter(e=>!a.has(y(e)))}(e.provider,b,eS),f=function(e,t=[],r={}){if(!Array.isArray(t)||0===t.length)return[];let a=w(e,r,t);return 0===a.size?[]:t.filter(e=>a.has(y(e)))}(e.provider,b,eS);return(0,a.jsx)(P.Zp,{className:`min-w-0 [--card-spacing:0] ${c?"opacity-60":""}`,children:(0,a.jsxs)(P.Wu,{className:"px-0 gap-0",children:[(0,a.jsx)("div",{className:"px-3 py-2 border-b border-black/10 dark:border-white/10",children:(0,a.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2 min-w-0",children:[(0,a.jsx)("div",{className:"w-8 h-8 shrink-0 rounded-md flex items-center justify-center overflow-hidden",children:(0,a.jsx)(i.A,{src:`/providers/${e.provider}.png`,alt:e.provider,size:32,className:"object-contain",fallbackText:e.provider?.slice(0,2).toUpperCase()||"PR"})}),(0,a.jsxs)("div",{className:"min-w-0",children:[(0,a.jsx)("h3",{className:"text-sm font-semibold text-foreground truncate",children:M(e.provider)}),x(e)?(0,a.jsx)("p",{className:"text-xs text-muted-foreground truncate",children:x(e)}):null,I(e)?(0,a.jsx)("p",{className:"text-[11px] text-muted-foreground/80 truncate",children:I(e)}):null]})]}),(0,a.jsxs)("div",{className:"flex items-center gap-1 shrink-0",children:[u&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)(l.m_,{children:[(0,a.jsx)(l.k$,{asChild:!0,children:(0,a.jsx)("span",{className:"relative inline-flex",children:(0,a.jsxs)("button",{type:"button",onClick:()=>ec({connection:e,resetCreditCount:m}),disabled:m<=0||o||g,"aria-label":m>0?`Use one Codex reset credit. ${m} available.`:"No Codex reset credits available",className:`flex h-8 min-w-10 items-center justify-center gap-1 rounded-lg border px-2 text-[11px] font-medium tabular-nums transition-colors focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary/60 disabled:cursor-not-allowed disabled:opacity-60 ${m>0?"border-primary/30 bg-primary/5 text-primary hover:bg-primary/10":"border-black/10 bg-black/[0.02] text-muted-foreground dark:border-white/10 dark:bg-white/[0.03]"}`,children:[(0,a.jsx)(n.default,{name:h?"progress_activity":"restart_alt",className:`text-[15px] ${h?"animate-spin":""}`}),(0,a.jsx)("span",{children:m})]})})}),(0,a.jsx)(l.ZI,{side:"top",children:m>0?`Use one Codex reset credit. Available: ${m}`:"No Codex reset credits available"})]}),(0,a.jsxs)(l.m_,{children:[(0,a.jsx)(l.k$,{asChild:!0,children:(0,a.jsx)("span",{className:"relative inline-flex",children:(0,a.jsx)("button",{type:"button",onClick:()=>eQ(e),disabled:o||g,"aria-label":"View Codex reset credit expiry",className:"flex h-8 w-8 items-center justify-center rounded-lg border border-black/10 text-muted-foreground transition-colors hover:bg-black/5 hover:text-primary disabled:cursor-not-allowed disabled:opacity-50 dark:border-white/10 dark:hover:bg-white/5",children:(0,a.jsx)(n.default,{name:"schedule",className:"text-[17px]"})})})}),(0,a.jsx)(l.ZI,{side:"top",children:"View Codex reset credit expiry"})]})]}),E[e.provider]&&"oauth"===e.authType&&(0,a.jsxs)(l.m_,{children:[(0,a.jsx)(l.k$,{asChild:!0,children:(0,a.jsx)("span",{className:"relative inline-flex",children:(0,a.jsx)("button",{type:"button",onClick:()=>e2(e.id,e.provider,K[e.provider]?.[e.id]!==!0),"aria-label":"Toggle auto-ping",className:`flex h-8 w-8 items-center justify-center rounded-lg transition-colors hover:bg-black/5 dark:hover:bg-white/5 ${K[e.provider]?.[e.id]===!0?"text-primary":"text-muted-foreground"}`,children:(0,a.jsx)(n.default,{name:"bolt",className:"text-[18px]"})})})}),(0,a.jsx)(l.ZI,{side:"top",children:_[e.provider]})]}),(0,a.jsxs)(l.m_,{children:[(0,a.jsx)(l.k$,{asChild:!0,children:(0,a.jsx)("span",{className:"relative inline-flex",children:(0,a.jsx)("button",{type:"button",onClick:()=>eG(e.id,e.provider),disabled:o||g,"aria-label":"Refresh quota",className:"flex h-8 w-8 items-center justify-center rounded-lg hover:bg-black/5 dark:hover:bg-white/5 transition-colors disabled:opacity-50",children:(0,a.jsx)(n.default,{name:"refresh",className:`text-[18px] text-muted-foreground ${o?"animate-spin":""}`})})})}),(0,a.jsx)(l.ZI,{side:"top",children:"Refresh quota"})]}),(0,a.jsxs)(l.m_,{children:[(0,a.jsx)(l.k$,{asChild:!0,children:(0,a.jsx)("span",{className:"relative inline-flex",children:(0,a.jsx)("button",{type:"button",onClick:()=>{eb(e),ex(!0)},disabled:g,"aria-label":"Edit connection",className:"flex h-8 w-8 items-center justify-center rounded-lg hover:bg-black/5 dark:hover:bg-white/5 text-muted-foreground hover:text-primary transition-colors disabled:opacity-50",children:(0,a.jsx)(n.default,{name:"edit",className:"text-[18px]"})})})}),(0,a.jsx)(l.ZI,{side:"top",children:"Edit connection"})]}),(0,a.jsxs)(l.m_,{children:[(0,a.jsx)(l.k$,{asChild:!0,children:(0,a.jsx)("span",{className:"relative inline-flex",children:(0,a.jsx)("button",{type:"button",onClick:()=>eX(e.id),disabled:g,"aria-label":"Delete connection",className:"flex h-8 w-8 items-center justify-center rounded-lg hover:bg-red-500/10 text-red-500 transition-colors disabled:opacity-50",children:(0,a.jsx)(n.default,{name:"delete",className:`text-[18px] ${ea===e.id?"animate-pulse":""}`})})})}),(0,a.jsx)(l.ZI,{side:"top",children:"Delete connection"})]}),(0,a.jsx)("div",{className:"inline-flex items-center pl-0.5",children:(0,a.jsxs)(l.m_,{children:[(0,a.jsx)(l.k$,{asChild:!0,children:(0,a.jsx)(C.d,{size:"sm",checked:e.isActive??!0,disabled:g,onCheckedChange:t=>e0(e.id,t),"aria-label":e.isActive??!0?"Disable connection":"Enable connection"})}),(0,a.jsx)(l.ZI,{side:"top",children:e.isActive??!0?"Disable connection":"Enable connection"})]})})]})]})}),(0,a.jsxs)("div",{className:"px-2 py-1.5",children:[o?(0,a.jsx)("div",{className:"text-center py-5 text-muted-foreground",children:(0,a.jsx)(n.default,{name:"progress_activity",className:"text-[28px] animate-spin"})}):d?(0,a.jsxs)("div",{className:"text-center py-5",children:[(0,a.jsx)(n.default,{name:"error",className:"text-[28px] text-red-500"}),(0,a.jsx)("p",{className:"mt-1.5 text-xs text-muted-foreground",children:d})]}):s?.message?(0,a.jsx)("div",{className:"text-center py-5",children:(0,a.jsx)("p",{className:"text-xs text-muted-foreground",children:s.message})}):(0,a.jsx)(N,{quotas:p,compact:!0,sortMode:"default",showSortLabel:"codex"===e.provider&&"default"!==eC,onHideQuota:t=>e8(e.provider,t)}),s?.message&&!d&&!o&&(0,a.jsx)("p",{className:"mt-2 px-1 text-[10px] leading-relaxed text-muted-foreground",children:s.message}),f.length>0&&(0,a.jsxs)("div",{className:"mt-2 flex min-w-0 items-center gap-1 border-t border-black/5 pt-2 text-[10px] text-muted-foreground dark:border-white/5",children:[(0,a.jsx)(n.default,{name:"visibility_off",className:"shrink-0 text-[14px]"}),(0,a.jsx)("span",{className:"shrink-0",children:"Hidden:"}),(0,a.jsx)("div",{className:"flex min-w-0 flex-1 items-center gap-1 overflow-x-auto whitespace-nowrap pb-2",children:f.map(t=>(0,a.jsxs)(l.m_,{children:[(0,a.jsx)(l.k$,{asChild:!0,children:(0,a.jsx)("button",{type:"button",onClick:()=>e4(e.provider,t),className:"shrink-0 rounded-md border border-black/10 px-1.5 py-0.5 transition-colors hover:bg-black/5 hover:text-foreground dark:border-white/10 dark:hover:bg-white/5",children:t.name})}),(0,a.jsx)(l.ZI,{children:"Show this quota row"})]},y(t)))})]})]})]})},e.id)})}),(0,a.jsx)("div",{className:"rounded-xl border border-black/10 bg-black/[0.02] px-3 py-2 dark:border-white/10 dark:bg-white/[0.03]",children:(0,a.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[(0,a.jsx)("span",{className:"text-xs text-muted-foreground",children:tn}),(0,a.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,a.jsxs)("select",{value:ts?"custom":String(eD),onChange:e=>{let t=e.target.value;if("custom"===t)return;let r=Number.parseInt(t,10);Number.isFinite(r)&&(eO(1),eL(r),ez(String(r)))},className:"h-8 rounded-lg border border-black/10 bg-black/[0.02] px-2 text-xs text-foreground outline-none transition-colors hover:bg-black/5 dark:border-white/10 dark:bg-white/[0.03] dark:hover:bg-white/10","aria-label":"Accounts per page",children:[u.map(e=>(0,a.jsxs)("option",{value:String(e),children:[e," / page"]},e)),(0,a.jsx)("option",{value:"custom",children:"Custom"})]}),(0,a.jsx)("input",{type:"number",min:"1",max:String(500),inputMode:"numeric",value:eF,onChange:e=>ez(e.target.value),onBlur:()=>{let e=Number.parseInt(eF,10);if(!Number.isFinite(e))return void ez(String(eD));let t=Math.min(500,Math.max(1,e));eO(1),eL(t),ez(String(t))},onKeyDown:e=>{if("Enter"!==e.key)return;let t=Number.parseInt(eF,10);if(!Number.isFinite(t))return void ez(String(eD));let r=Math.min(500,Math.max(1,t));eO(1),eL(r),ez(String(r))},className:"h-8 w-20 rounded-lg border border-black/10 bg-black/[0.02] px-2 text-xs text-foreground outline-none transition-colors hover:bg-black/5 dark:border-white/10 dark:bg-white/[0.03] dark:hover:bg-white/10","aria-label":"Custom accounts per page",placeholder:"Custom"}),(0,a.jsxs)("span",{className:"text-xs text-muted-foreground",children:["Page ",eZ.page," / ",eZ.totalPages]})]}),(0,a.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,a.jsx)("button",{type:"button",onClick:()=>eO(1),disabled:eZ.page<=1||et||B,className:"flex h-8 items-center rounded-lg border border-black/10 px-3 text-xs text-foreground transition-colors hover:bg-black/5 disabled:cursor-not-allowed disabled:opacity-40 dark:border-white/10 dark:hover:bg-white/5",children:"First Page"}),(0,a.jsx)("button",{type:"button",onClick:()=>eO(e=>Math.max(1,e-1)),disabled:eZ.page<=1||et||B,className:"flex h-8 w-8 items-center justify-center rounded-lg border border-black/10 text-foreground transition-colors hover:bg-black/5 disabled:cursor-not-allowed disabled:opacity-40 dark:border-white/10 dark:hover:bg-white/5","aria-label":"Previous accounts page",children:(0,a.jsx)(n.default,{name:"chevron_left",className:"text-[16px]"})}),(0,a.jsx)("button",{type:"button",onClick:()=>eO(e=>Math.min(eZ.totalPages,e+1)),disabled:eZ.page>=eZ.totalPages||et||B,className:"flex h-8 w-8 items-center justify-center rounded-lg border border-black/10 text-foreground transition-colors hover:bg-black/5 disabled:cursor-not-allowed disabled:opacity-40 dark:border-white/10 dark:hover:bg-white/5","aria-label":"Next accounts page",children:(0,a.jsx)(n.default,{name:"chevron_right",className:"text-[16px]"})}),(0,a.jsx)("button",{type:"button",onClick:()=>eO(eZ.totalPages),disabled:eZ.page>=eZ.totalPages||et||B,className:"flex h-8 items-center rounded-lg border border-black/10 px-3 text-xs text-foreground transition-colors hover:bg-black/5 disabled:cursor-not-allowed disabled:opacity-40 dark:border-white/10 dark:hover:bg-white/5",children:"Last Page"})]})]})}),(0,a.jsx)(S.uo,{isOpen:!!ed,onClose:()=>{el||ec(null)},onConfirm:async()=>{let e=ed?.connection;e&&(await eB(e.id,e.provider),ec(null))},title:"Reset Codex limit?",message:`Use 1 Codex reset credit for ${x(ed?.connection||{})||"this account"}. This cannot be undone. Remaining credits: ${ed?.resetCreditCount??0}.`,confirmText:"Reset limit",cancelText:"Cancel",variant:"danger",loading:!!el}),eu&&(0,a.jsx)($.lG,{open:!0,onOpenChange:e=>{e||em(null)},children:(0,a.jsxs)($.Cf,{className:"sm:max-w-2xl",children:[(0,a.jsxs)($.c7,{children:[(0,a.jsx)($.L3,{children:"Codex Reset Credit Expiry"}),(0,a.jsx)("p",{className:"truncate text-xs text-muted-foreground",children:x(eu.connection)||"Codex account"})]}),(0,a.jsx)("div",{className:"max-h-[70vh] overflow-auto p-4",children:eu.loading?(0,a.jsxs)("div",{className:"flex items-center justify-center gap-2 py-10 text-sm text-muted-foreground",children:[(0,a.jsx)(n.default,{name:"progress_activity",className:"animate-spin text-[20px]"}),"Loading reset credits..."]}):eu.error?(0,a.jsx)("div",{className:"rounded-xl border border-red-500/20 bg-red-500/10 px-3 py-2 text-sm text-red-600 dark:text-red-300",children:eu.error}):eu.data?.credits?.length?(0,a.jsxs)("div",{className:"space-y-3",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between rounded-xl border border-black/10 bg-black/[0.02] px-3 py-2 text-xs text-muted-foreground dark:border-white/10 dark:bg-white/[0.03]",children:[(0,a.jsxs)("span",{children:[eu.data.credits.length," reset credit",1===eu.data.credits.length?"":"s"]}),(0,a.jsxs)("span",{children:[eu.data.availableCount??0," available"]})]}),(0,a.jsx)("div",{className:"overflow-x-auto rounded-xl border border-black/10 dark:border-white/10",children:(0,a.jsxs)("table",{className:"w-full min-w-[560px] text-left text-sm",children:[(0,a.jsx)("thead",{className:"bg-black/[0.03] text-xs uppercase tracking-wide text-muted-foreground dark:bg-white/[0.04]",children:(0,a.jsxs)("tr",{children:[(0,a.jsx)("th",{className:"px-3 py-2 font-medium",children:"Status"}),(0,a.jsx)("th",{className:"px-3 py-2 font-medium",children:"Granted At"}),(0,a.jsx)("th",{className:"px-3 py-2 font-medium",children:"Expires At"}),(0,a.jsx)("th",{className:"px-3 py-2 font-medium",children:"Remaining"})]})}),(0,a.jsx)("tbody",{children:eu.data.credits.map((e,t)=>(0,a.jsxs)("tr",{className:"border-t border-black/5 dark:border-white/5",children:[(0,a.jsx)("td",{className:"px-3 py-2",children:(0,a.jsx)("span",{className:"rounded-full bg-primary/10 px-2 py-0.5 text-xs font-medium text-primary",children:e.status||"unknown"})}),(0,a.jsx)("td",{className:"px-3 py-2 text-muted-foreground",children:T(e.grantedAt)}),(0,a.jsx)("td",{className:"px-3 py-2 text-foreground",children:T(e.expiresAt)}),(0,a.jsx)("td",{className:"px-3 py-2 font-medium text-foreground",children:function(e){if(!e)return"N/A";let t=new Date(e).getTime()-Date.now();if(!Number.isFinite(t))return"N/A";if(t<=0)return"Expired";let r=Math.ceil(t/36e5),a=Math.floor(r/24),n=r%24;return a>0?`${a}d ${n}h`:`${n}h`}(e.expiresAt)})]},`${e.status}-${e.expiresAt||t}`))})]})})]}):(0,a.jsx)("div",{className:"rounded-xl border border-black/10 bg-black/[0.02] px-3 py-8 text-center text-sm text-muted-foreground dark:border-white/10 dark:bg-white/[0.03]",children:"No reset credit details returned for this account."})})]})}),(0,a.jsx)(S.wI,{isOpen:eh,connection:eg,proxyPools:ep,onSave:e1,onClose:()=>{ex(!1),eb(null)}})]}):(0,a.jsx)(P.Zp,{className:"p-8",children:(0,a.jsx)(P.Wu,{className:"px-0 py-0",children:(0,a.jsxs)("div",{className:"text-center py-12",children:[(0,a.jsx)(n.default,{name:ta.icon,className:"text-[64px] text-muted-foreground opacity-20"}),(0,a.jsx)("h3",{className:"mt-4 text-lg font-semibold text-foreground",children:ta.title}),(0,a.jsx)("p",{className:"mt-2 text-sm text-muted-foreground max-w-md mx-auto",children:ta.description})]})})}):(0,a.jsx)(P.Zp,{className:"p-8",children:(0,a.jsx)(P.Wu,{className:"px-0 py-0",children:(0,a.jsxs)("div",{className:"text-center py-12",children:[(0,a.jsx)(n.default,{name:"cloud_off",className:"text-[64px] text-muted-foreground opacity-20"}),(0,a.jsx)("h3",{className:"mt-4 text-lg font-semibold text-foreground",children:"No Providers Connected"}),(0,a.jsx)("p",{className:"mt-2 text-sm text-muted-foreground max-w-md mx-auto",children:"Connect to providers with OAuth to track your API quota limits and usage."})]})})})}},92412:(e,t,r)=>{"use strict";r.d(t,{YW:()=>a.Page,pV:()=>a.CardGrid,wn:()=>a.Section,zY:()=>a.PageHeader}),r(16675),r(72778);var a=r(29575)}},e=>{e.O(0,[6766,5166,7552,9980,1471,5778,4484,3577,5862,5113,1699,1722,159,4489,1278,1830,6770,427,9966,7358],()=>e(e.s=74277)),_N_E=e.O()}]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2825],{15764:(e,a,l)=>{"use strict";l.d(a,{CK:()=>n.default,G9:()=>j.default,Iz:()=>p.default,KX:()=>M.PanelSkeleton,LF:()=>u.default,LH:()=>o.default,Mu:()=>M.StatCardSkeleton,Nf:()=>i.default,Qv:()=>t.CardSkeleton,YW:()=>k.YW,gw:()=>h.default,jK:()=>f.default,nh:()=>b.default,pV:()=>k.pV,rq:()=>d.default,uR:()=>r.default,uo:()=>s.ConfirmModal,vE:()=>x.default,vj:()=>c.default,wI:()=>v.default,wn:()=>k.wn,zY:()=>k.zY}),l(58913);var s=l(3537),t=l(58350);l(30872),l(33526),l(42535),l(1279);var u=l(92802),d=l(25908),r=l(58729),n=l(24873),i=l(5258),f=l(
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2825],{15764:(e,a,l)=>{"use strict";l.d(a,{CK:()=>n.default,G9:()=>j.default,Iz:()=>p.default,KX:()=>M.PanelSkeleton,LF:()=>u.default,LH:()=>o.default,Mu:()=>M.StatCardSkeleton,Nf:()=>i.default,Qv:()=>t.CardSkeleton,YW:()=>k.YW,gw:()=>h.default,jK:()=>f.default,nh:()=>b.default,pV:()=>k.pV,rq:()=>d.default,uR:()=>r.default,uo:()=>s.ConfirmModal,vE:()=>x.default,vj:()=>c.default,wI:()=>v.default,wn:()=>k.wn,zY:()=>k.zY}),l(58913);var s=l(3537),t=l(58350);l(30872),l(33526),l(42535),l(1279);var u=l(92802),d=l(25908),r=l(58729),n=l(24873),i=l(5258),f=l(80599);l(949),l(56776),l(53599),l(88336),l(69561);var j=l(37753),o=l(23444),x=l(93624),c=l(86920),v=l(65461);l(14580);var h=l(14670),p=l(70296);l(57779),l(22205);var M=l(43276),b=l(75862),k=l(92412)},32665:(e,a,l)=>{"use strict";l.r(a),l.d(a,{default:()=>r});var s=l(29798),t=l(15814),u=l(15764);let d=[{value:"today",label:"Today"},{value:"24h",label:"24h"},{value:"7d",label:"7D"},{value:"30d",label:"30D"},{value:"60d",label:"60D"}];function r(){return(0,s.jsx)(t.Suspense,{fallback:(0,s.jsx)(u.YW,{children:(0,s.jsxs)(u.pV,{variant:"stat",children:[(0,s.jsx)(u.Mu,{}),(0,s.jsx)(u.Mu,{}),(0,s.jsx)(u.Mu,{}),(0,s.jsx)(u.Mu,{}),(0,s.jsx)(u.Mu,{})]})}),children:(0,s.jsx)(n,{})})}function n(){let[e,a]=(0,t.useState)("today");return(0,s.jsxs)(u.YW,{children:[(0,s.jsx)("div",{className:"flex justify-start",children:(0,s.jsx)(u.Iz,{options:d,value:e,onChange:a,size:"sm",className:"w-full sm:w-auto"})}),(0,s.jsx)(t.Suspense,{fallback:(0,s.jsxs)(u.pV,{variant:"stat",children:[(0,s.jsx)(u.Mu,{}),(0,s.jsx)(u.Mu,{}),(0,s.jsx)(u.Mu,{}),(0,s.jsx)(u.Mu,{}),(0,s.jsx)(u.Mu,{})]}),children:(0,s.jsx)(u.jK,{period:e,setPeriod:a,hidePeriodSelector:!0})})]})}},42245:(e,a,l)=>{Promise.resolve().then(l.bind(l,32665))},92412:(e,a,l)=>{"use strict";l.d(a,{YW:()=>s.Page,pV:()=>s.CardGrid,wn:()=>s.Section,zY:()=>s.PageHeader}),l(16675),l(72778);var s=l(29575)}},e=>{e.O(0,[6766,5166,7552,9980,1471,5778,4484,3577,5862,5113,1699,1722,159,4489,1278,1830,6770,427,9966,7358],()=>e(e.s=42245)),_N_E=e.O()}]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9305],{60567:(e,s,n)=>{Promise.resolve().then(n.bind(n,14580)),Promise.resolve().then(n.bind(n,75862)),Promise.resolve().then(n.bind(n,88336)),Promise.resolve().then(n.bind(n,24873)),Promise.resolve().then(n.bind(n,37753)),Promise.resolve().then(n.bind(n,65461)),Promise.resolve().then(n.bind(n,22205)),Promise.resolve().then(n.bind(n,43276)),Promise.resolve().then(n.bind(n,1279)),Promise.resolve().then(n.bind(n,86920)),Promise.resolve().then(n.bind(n,42535)),Promise.resolve().then(n.bind(n,56776)),Promise.resolve().then(n.bind(n,58913)),Promise.resolve().then(n.bind(n,93624)),Promise.resolve().then(n.bind(n,949)),Promise.resolve().then(n.bind(n,72778)),Promise.resolve().then(n.bind(n,16675)),Promise.resolve().then(n.bind(n,29575)),Promise.resolve().then(n.bind(n,58350)),Promise.resolve().then(n.bind(n,58729)),Promise.resolve().then(n.bind(n,5258)),Promise.resolve().then(n.bind(n,3537)),Promise.resolve().then(n.bind(n,25908)),Promise.resolve().then(n.bind(n,14670)),Promise.resolve().then(n.bind(n,92802)),Promise.resolve().then(n.bind(n,57779)),Promise.resolve().then(n.bind(n,69561)),Promise.resolve().then(n.bind(n,70296)),Promise.resolve().then(n.bind(n,53599)),Promise.resolve().then(n.bind(n,33526)),Promise.resolve().then(n.bind(n,30872)),Promise.resolve().then(n.bind(n,
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9305],{60567:(e,s,n)=>{Promise.resolve().then(n.bind(n,14580)),Promise.resolve().then(n.bind(n,75862)),Promise.resolve().then(n.bind(n,88336)),Promise.resolve().then(n.bind(n,24873)),Promise.resolve().then(n.bind(n,37753)),Promise.resolve().then(n.bind(n,65461)),Promise.resolve().then(n.bind(n,22205)),Promise.resolve().then(n.bind(n,43276)),Promise.resolve().then(n.bind(n,1279)),Promise.resolve().then(n.bind(n,86920)),Promise.resolve().then(n.bind(n,42535)),Promise.resolve().then(n.bind(n,56776)),Promise.resolve().then(n.bind(n,58913)),Promise.resolve().then(n.bind(n,93624)),Promise.resolve().then(n.bind(n,949)),Promise.resolve().then(n.bind(n,72778)),Promise.resolve().then(n.bind(n,16675)),Promise.resolve().then(n.bind(n,29575)),Promise.resolve().then(n.bind(n,58350)),Promise.resolve().then(n.bind(n,58729)),Promise.resolve().then(n.bind(n,5258)),Promise.resolve().then(n.bind(n,3537)),Promise.resolve().then(n.bind(n,25908)),Promise.resolve().then(n.bind(n,14670)),Promise.resolve().then(n.bind(n,92802)),Promise.resolve().then(n.bind(n,57779)),Promise.resolve().then(n.bind(n,69561)),Promise.resolve().then(n.bind(n,70296)),Promise.resolve().then(n.bind(n,53599)),Promise.resolve().then(n.bind(n,33526)),Promise.resolve().then(n.bind(n,30872)),Promise.resolve().then(n.bind(n,80599)),Promise.resolve().then(n.bind(n,23444))}},e=>{e.O(0,[6766,5166,7552,9980,1471,5778,4484,3577,5862,5113,1699,1722,159,4489,1278,1830,6770,427,9966,7358],()=>e(e.s=60567)),_N_E=e.O()}]);
|