9router-imagefix 0.5.136 → 0.5.138
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/app/.next-cli-build/BUILD_ID +1 -1
- package/app/.next-cli-build/app-path-routes-manifest.json +9 -9
- package/app/.next-cli-build/build-manifest.json +2 -2
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/automation/page.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/automation/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/automation/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/basic-chat/page.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/basic-chat/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/basic-chat/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/[toolId]/page.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/[toolId]/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/[toolId]/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/page.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/combos/page.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/combos/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/combos/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/console-log/page.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/console-log/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/console-log/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/endpoint/page.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/endpoint/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/endpoint/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/[kind]/[id]/page.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/[kind]/[id]/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/[kind]/[id]/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/[kind]/page.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/[kind]/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/[kind]/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/combo/[id]/page.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/combo/[id]/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/combo/[id]/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/web/page.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/web/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/web/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/mitm/page.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/mitm/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/mitm/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/page.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/profile/page.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/profile/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/profile/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/[id]/page.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/[id]/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/[id]/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/new/page.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/new/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/new/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/page.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/proxy-pools/page.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/proxy-pools/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/proxy-pools/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/pxpipe/page.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/pxpipe/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/pxpipe/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/quota/page.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/quota/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/quota/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/skills/page.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/skills/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/skills/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/token-saver/page.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/token-saver/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/token-saver/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/translator/page.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/translator/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/translator/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/usage/page.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/usage/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/usage/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/_global-error/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/_global-error/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/_global-error.html +1 -1
- package/app/.next-cli-build/server/app/_global-error.rsc +1 -1
- package/app/.next-cli-build/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/_not-found/page.js +1 -1
- package/app/.next-cli-build/server/app/_not-found/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/_not-found.html +1 -1
- package/app/.next-cli-build/server/app/_not-found.rsc +4 -4
- package/app/.next-cli-build/server/app/_not-found.segments/_full.segment.rsc +4 -4
- package/app/.next-cli-build/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +4 -4
- package/app/.next-cli-build/server/app/_not-found.segments/_tree.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/api/auth/login/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/auth/logout/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/auth/oidc/callback/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/auth/oidc/start/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/auth/oidc/test/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/auth/reset-password/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/auth/saml/acs/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/auth/saml/metadata/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/auth/saml/start/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/auth/saml/test/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/auth/status/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/automation/connections/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/automation/device/poll/route.js +1 -1
- package/app/.next-cli-build/server/app/api/automation/device/poll/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/automation/device/start/route.js +1 -1
- package/app/.next-cli-build/server/app/api/automation/device/start/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/automation/export/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/automation/gate/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/automation/generate-txt/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/automation/import-lines/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/automation/jobs/[id]/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/automation/jobs/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/automation/overview/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/automation/providers/route.js +1 -1
- package/app/.next-cli-build/server/app/api/automation/providers/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/automation/run/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/automation/test-prompt/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/all-statuses/route.js +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/all-statuses/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/antigravity-mitm/alias/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/antigravity-mitm/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/claude-settings/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/cline-settings/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/codewhale-settings/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/codex-profiles/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/codex-settings/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/copilot-settings/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/cowork-mcp-registry/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/cowork-mcp-tools/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/cowork-settings/route.js +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/cowork-settings/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/crush-settings/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/deepseek-tui-settings/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/devin-settings/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/droid-settings/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/forge-settings/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/grok-build-settings/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/hermes-settings/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/jcode-settings/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/kilo-settings/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/omp-settings/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/openclaw-settings/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/opencode-settings/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/pi-settings/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/smelt-settings/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/combos/[id]/route.js +1 -1
- package/app/.next-cli-build/server/app/api/combos/[id]/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/combos/presets/route.js +1 -1
- package/app/.next-cli-build/server/app/api/combos/presets/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/combos/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/headroom/extras/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/headroom/proxy/[...path]/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/headroom/restart/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/headroom/start/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/headroom/status/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/headroom/stop/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/health/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/init/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/keys/[id]/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/keys/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/locale/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/mcp/[plugin]/message/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/mcp/[plugin]/sse/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/media-providers/tts/deepgram/voices/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/media-providers/tts/elevenlabs/voices/route.js +1 -1
- package/app/.next-cli-build/server/app/api/media-providers/tts/elevenlabs/voices/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/media-providers/tts/inworld/voices/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/media-providers/tts/minimax/voices/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/media-providers/tts/voices/route.js +1 -1
- package/app/.next-cli-build/server/app/api/media-providers/tts/voices/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/models/alias/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/models/availability/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/models/catalog-sync/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/models/custom/route.js +1 -1
- package/app/.next-cli-build/server/app/api/models/custom/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/models/disabled/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/models/route.js +1 -1
- package/app/.next-cli-build/server/app/api/models/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/models/test/route.js +1 -1
- package/app/.next-cli-build/server/app/api/models/test/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/oauth/[provider]/[action]/route.js +1 -1
- package/app/.next-cli-build/server/app/api/oauth/[provider]/[action]/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/oauth/codex/bulk-import/route.js +1 -1
- package/app/.next-cli-build/server/app/api/oauth/codex/bulk-import/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/oauth/codex/import-token/route.js +1 -1
- package/app/.next-cli-build/server/app/api/oauth/codex/import-token/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/oauth/cursor/auto-import/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/oauth/cursor/import/route.js +1 -1
- package/app/.next-cli-build/server/app/api/oauth/cursor/import/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/oauth/gitlab/pat/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/oauth/grok-cli/bulk-import/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/oauth/iflow/cookie/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/oauth/kiro/api-key/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/oauth/kiro/auto-import/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/oauth/kiro/import/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/oauth/kiro/import-cli-proxy/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/oauth/kiro/social-authorize/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/oauth/kiro/social-exchange/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/oauth/xiaomi-mimo/api-key/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/oauth/xiaomi-mimo/auto-import/route.js +1 -1
- package/app/.next-cli-build/server/app/api/oauth/xiaomi-mimo/auto-import/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/oauth/xiaomi-mimo/login/start/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/oauth/xiaomi-mimo/login/status/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/oauth/zed/auto-import/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/oauth/zed/import/route.js +1 -1
- package/app/.next-cli-build/server/app/api/oauth/zed/import/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/pricing/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/provider-nodes/[id]/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/provider-nodes/route.js +1 -1
- package/app/.next-cli-build/server/app/api/provider-nodes/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/provider-nodes/validate/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/providers/[id]/models/route.js +1 -1
- package/app/.next-cli-build/server/app/api/providers/[id]/models/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/providers/[id]/overrides/route.js +1 -1
- package/app/.next-cli-build/server/app/api/providers/[id]/overrides/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/providers/[id]/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/providers/[id]/test/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/providers/[id]/test-models/route.js +1 -1
- package/app/.next-cli-build/server/app/api/providers/[id]/test-models/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/providers/client/route.js +1 -1
- package/app/.next-cli-build/server/app/api/providers/client/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/providers/kilo/free-models/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/providers/route.js +1 -1
- package/app/.next-cli-build/server/app/api/providers/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/providers/suggested-models/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/providers/test-batch/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/providers/validate/route.js +1 -1
- package/app/.next-cli-build/server/app/api/providers/validate/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/proxy-pools/[id]/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/proxy-pools/[id]/test/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/proxy-pools/cloudflare-deploy/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/proxy-pools/deno-deploy/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/proxy-pools/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/proxy-pools/vercel-deploy/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/pxpipe/health/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/pxpipe/install/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/pxpipe/logs/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/pxpipe/restart/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/pxpipe/start/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/pxpipe/stats/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/pxpipe/status/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/pxpipe/stop/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/settings/database/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/settings/proxy-test/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/settings/require-login/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/settings/route.js +1 -1
- package/app/.next-cli-build/server/app/api/settings/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/shutdown/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/tags/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/translator/console-logs/route.js +1 -1
- package/app/.next-cli-build/server/app/api/translator/console-logs/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/translator/console-logs/stream/route.js +1 -1
- package/app/.next-cli-build/server/app/api/translator/console-logs/stream/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/translator/load/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/translator/save/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/translator/send/route.js +1 -1
- package/app/.next-cli-build/server/app/api/translator/send/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/translator/translate/route.js +1 -1
- package/app/.next-cli-build/server/app/api/translator/translate/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/tunnel/disable/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/tunnel/enable/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/tunnel/status/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/tunnel/tailscale-check/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/tunnel/tailscale-disable/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/tunnel/tailscale-enable/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/tunnel/tailscale-install/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/usage/[connectionId]/claude-reset/route.js +1 -1
- package/app/.next-cli-build/server/app/api/usage/[connectionId]/claude-reset/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/usage/[connectionId]/codex-reset-credits/route.js +1 -1
- package/app/.next-cli-build/server/app/api/usage/[connectionId]/codex-reset-credits/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/usage/[connectionId]/route.js +1 -1
- package/app/.next-cli-build/server/app/api/usage/[connectionId]/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/usage/backup/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/usage/chart/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/usage/history/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/usage/logs/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/usage/providers/route.js +1 -1
- package/app/.next-cli-build/server/app/api/usage/providers/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/usage/request-details/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/usage/request-logs/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/usage/stats/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/usage/stream/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/v1/api/chat/route.js +1 -1
- package/app/.next-cli-build/server/app/api/v1/api/chat/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/v1/audio/speech/route.js +1 -1
- package/app/.next-cli-build/server/app/api/v1/audio/speech/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/v1/audio/transcriptions/route.js +1 -1
- package/app/.next-cli-build/server/app/api/v1/audio/transcriptions/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/v1/audio/voices/route.js +1 -1
- package/app/.next-cli-build/server/app/api/v1/audio/voices/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/v1/chat/completions/route.js +1 -1
- package/app/.next-cli-build/server/app/api/v1/chat/completions/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/v1/embeddings/route.js +1 -1
- package/app/.next-cli-build/server/app/api/v1/embeddings/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/v1/images/generations/route.js +1 -1
- package/app/.next-cli-build/server/app/api/v1/images/generations/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/v1/messages/count_tokens/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/v1/messages/route.js +1 -1
- package/app/.next-cli-build/server/app/api/v1/messages/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/v1/models/[...model]/route.js +1 -1
- package/app/.next-cli-build/server/app/api/v1/models/[...model]/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/v1/models/info/route.js +1 -1
- package/app/.next-cli-build/server/app/api/v1/models/info/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/v1/models/route.js +1 -1
- package/app/.next-cli-build/server/app/api/v1/models/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/v1/responses/compact/route.js +1 -1
- package/app/.next-cli-build/server/app/api/v1/responses/compact/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/v1/responses/route.js +1 -1
- package/app/.next-cli-build/server/app/api/v1/responses/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/v1/route.js +1 -1
- package/app/.next-cli-build/server/app/api/v1/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/v1/search/route.js +1 -1
- package/app/.next-cli-build/server/app/api/v1/search/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/v1/systemone/route.js +1 -1
- package/app/.next-cli-build/server/app/api/v1/systemone/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/v1/videos/[id]/route.js +1 -1
- package/app/.next-cli-build/server/app/api/v1/videos/[id]/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/v1/videos/edits/route.js +1 -1
- package/app/.next-cli-build/server/app/api/v1/videos/edits/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/v1/videos/extensions/route.js +1 -1
- package/app/.next-cli-build/server/app/api/v1/videos/extensions/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/v1/videos/generations/route.js +1 -1
- package/app/.next-cli-build/server/app/api/v1/videos/generations/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/v1/web/fetch/route.js +1 -1
- package/app/.next-cli-build/server/app/api/v1/web/fetch/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/v1beta/models/[...path]/route.js +1 -1
- package/app/.next-cli-build/server/app/api/v1beta/models/[...path]/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/v1beta/models/route.js +1 -1
- package/app/.next-cli-build/server/app/api/v1beta/models/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/version/route.js +1 -1
- package/app/.next-cli-build/server/app/api/version/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/version/shutdown/route.js +1 -1
- package/app/.next-cli-build/server/app/api/version/shutdown/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/version/update/route.js +1 -1
- package/app/.next-cli-build/server/app/api/version/update/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/callback/page.js +1 -1
- package/app/.next-cli-build/server/app/callback/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/callback/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/callback.html +1 -1
- package/app/.next-cli-build/server/app/callback.rsc +4 -4
- package/app/.next-cli-build/server/app/callback.segments/_full.segment.rsc +4 -4
- package/app/.next-cli-build/server/app/callback.segments/_tree.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/callback.segments/callback/__PAGE__.segment.rsc +4 -4
- package/app/.next-cli-build/server/app/dashboard/automation.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/automation.rsc +6 -6
- package/app/.next-cli-build/server/app/dashboard/automation.segments/!KGRhc2hib2FyZCk/dashboard/automation/__PAGE__.segment.rsc +6 -6
- package/app/.next-cli-build/server/app/dashboard/automation.segments/_full.segment.rsc +6 -6
- package/app/.next-cli-build/server/app/dashboard/automation.segments/_tree.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/basic-chat.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/basic-chat.rsc +6 -6
- package/app/.next-cli-build/server/app/dashboard/basic-chat.segments/!KGRhc2hib2FyZCk/dashboard/basic-chat/__PAGE__.segment.rsc +6 -6
- package/app/.next-cli-build/server/app/dashboard/basic-chat.segments/_full.segment.rsc +6 -6
- package/app/.next-cli-build/server/app/dashboard/basic-chat.segments/_tree.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/cli-tools.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/cli-tools.rsc +6 -6
- package/app/.next-cli-build/server/app/dashboard/cli-tools.segments/!KGRhc2hib2FyZCk/dashboard/cli-tools/__PAGE__.segment.rsc +6 -6
- package/app/.next-cli-build/server/app/dashboard/cli-tools.segments/_full.segment.rsc +6 -6
- package/app/.next-cli-build/server/app/dashboard/cli-tools.segments/_tree.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/combos.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/combos.rsc +6 -6
- package/app/.next-cli-build/server/app/dashboard/combos.segments/!KGRhc2hib2FyZCk/dashboard/combos/__PAGE__.segment.rsc +6 -6
- package/app/.next-cli-build/server/app/dashboard/combos.segments/_full.segment.rsc +6 -6
- package/app/.next-cli-build/server/app/dashboard/combos.segments/_tree.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/endpoint.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/endpoint.rsc +6 -6
- package/app/.next-cli-build/server/app/dashboard/endpoint.segments/!KGRhc2hib2FyZCk/dashboard/endpoint/__PAGE__.segment.rsc +6 -6
- package/app/.next-cli-build/server/app/dashboard/endpoint.segments/_full.segment.rsc +6 -6
- package/app/.next-cli-build/server/app/dashboard/endpoint.segments/_tree.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/media-providers/web.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/media-providers/web.rsc +6 -6
- package/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/!KGRhc2hib2FyZCk/dashboard/media-providers/web/__PAGE__.segment.rsc +6 -6
- package/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/_full.segment.rsc +6 -6
- package/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/_tree.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/mitm.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/mitm.rsc +6 -6
- package/app/.next-cli-build/server/app/dashboard/mitm.segments/!KGRhc2hib2FyZCk/dashboard/mitm/__PAGE__.segment.rsc +6 -6
- package/app/.next-cli-build/server/app/dashboard/mitm.segments/_full.segment.rsc +6 -6
- package/app/.next-cli-build/server/app/dashboard/mitm.segments/_tree.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/profile.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/profile.rsc +6 -6
- package/app/.next-cli-build/server/app/dashboard/profile.segments/!KGRhc2hib2FyZCk/dashboard/profile/__PAGE__.segment.rsc +6 -6
- package/app/.next-cli-build/server/app/dashboard/profile.segments/_full.segment.rsc +6 -6
- package/app/.next-cli-build/server/app/dashboard/profile.segments/_tree.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/providers/new.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/providers/new.rsc +6 -6
- package/app/.next-cli-build/server/app/dashboard/providers/new.segments/!KGRhc2hib2FyZCk/dashboard/providers/new/__PAGE__.segment.rsc +6 -6
- package/app/.next-cli-build/server/app/dashboard/providers/new.segments/_full.segment.rsc +6 -6
- package/app/.next-cli-build/server/app/dashboard/providers/new.segments/_tree.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/providers.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/providers.rsc +6 -6
- package/app/.next-cli-build/server/app/dashboard/providers.segments/!KGRhc2hib2FyZCk/dashboard/providers/__PAGE__.segment.rsc +6 -6
- package/app/.next-cli-build/server/app/dashboard/providers.segments/_full.segment.rsc +6 -6
- package/app/.next-cli-build/server/app/dashboard/providers.segments/_tree.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/proxy-pools.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/proxy-pools.rsc +6 -6
- package/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/!KGRhc2hib2FyZCk/dashboard/proxy-pools/__PAGE__.segment.rsc +6 -6
- package/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/_full.segment.rsc +6 -6
- package/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/_tree.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/pxpipe.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/pxpipe.rsc +6 -6
- package/app/.next-cli-build/server/app/dashboard/pxpipe.segments/!KGRhc2hib2FyZCk/dashboard/pxpipe/__PAGE__.segment.rsc +6 -6
- package/app/.next-cli-build/server/app/dashboard/pxpipe.segments/_full.segment.rsc +6 -6
- package/app/.next-cli-build/server/app/dashboard/pxpipe.segments/_tree.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/quota.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/quota.rsc +7 -7
- package/app/.next-cli-build/server/app/dashboard/quota.segments/!KGRhc2hib2FyZCk/dashboard/quota/__PAGE__.segment.rsc +7 -7
- package/app/.next-cli-build/server/app/dashboard/quota.segments/_full.segment.rsc +7 -7
- package/app/.next-cli-build/server/app/dashboard/quota.segments/_tree.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/settings/pricing/page.js +1 -1
- package/app/.next-cli-build/server/app/dashboard/settings/pricing/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/dashboard/settings/pricing/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/dashboard/settings/pricing.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/settings/pricing.rsc +4 -4
- package/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/_full.segment.rsc +4 -4
- package/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/_tree.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/dashboard/settings/pricing/__PAGE__.segment.rsc +4 -4
- package/app/.next-cli-build/server/app/dashboard/skills.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/skills.rsc +6 -6
- package/app/.next-cli-build/server/app/dashboard/skills.segments/!KGRhc2hib2FyZCk/dashboard/skills/__PAGE__.segment.rsc +6 -6
- package/app/.next-cli-build/server/app/dashboard/skills.segments/_full.segment.rsc +6 -6
- package/app/.next-cli-build/server/app/dashboard/skills.segments/_tree.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/token-saver.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/token-saver.rsc +6 -6
- package/app/.next-cli-build/server/app/dashboard/token-saver.segments/!KGRhc2hib2FyZCk/dashboard/token-saver/__PAGE__.segment.rsc +6 -6
- package/app/.next-cli-build/server/app/dashboard/token-saver.segments/_full.segment.rsc +6 -6
- package/app/.next-cli-build/server/app/dashboard/token-saver.segments/_tree.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/translator.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/translator.rsc +6 -6
- package/app/.next-cli-build/server/app/dashboard/translator.segments/!KGRhc2hib2FyZCk/dashboard/translator/__PAGE__.segment.rsc +6 -6
- package/app/.next-cli-build/server/app/dashboard/translator.segments/_full.segment.rsc +6 -6
- package/app/.next-cli-build/server/app/dashboard/translator.segments/_tree.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/usage.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/usage.rsc +6 -6
- package/app/.next-cli-build/server/app/dashboard/usage.segments/!KGRhc2hib2FyZCk/dashboard/usage/__PAGE__.segment.rsc +6 -6
- package/app/.next-cli-build/server/app/dashboard/usage.segments/_full.segment.rsc +6 -6
- package/app/.next-cli-build/server/app/dashboard/usage.segments/_tree.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard.html +1 -1
- package/app/.next-cli-build/server/app/dashboard.rsc +6 -6
- package/app/.next-cli-build/server/app/dashboard.segments/!KGRhc2hib2FyZCk/dashboard/__PAGE__.segment.rsc +6 -6
- package/app/.next-cli-build/server/app/dashboard.segments/_full.segment.rsc +6 -6
- package/app/.next-cli-build/server/app/dashboard.segments/_tree.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/favicon.ico/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/index.html +1 -1
- package/app/.next-cli-build/server/app/index.rsc +4 -4
- package/app/.next-cli-build/server/app/index.segments/__PAGE__.segment.rsc +4 -4
- package/app/.next-cli-build/server/app/index.segments/_full.segment.rsc +4 -4
- package/app/.next-cli-build/server/app/index.segments/_tree.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/landing/page.js +1 -1
- package/app/.next-cli-build/server/app/landing/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/landing/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/landing.html +1 -1
- package/app/.next-cli-build/server/app/landing.rsc +4 -4
- package/app/.next-cli-build/server/app/landing.segments/_full.segment.rsc +4 -4
- package/app/.next-cli-build/server/app/landing.segments/_tree.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/landing.segments/landing/__PAGE__.segment.rsc +4 -4
- package/app/.next-cli-build/server/app/login/page.js +1 -1
- package/app/.next-cli-build/server/app/login/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/login/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/login.html +1 -1
- package/app/.next-cli-build/server/app/login.rsc +5 -5
- package/app/.next-cli-build/server/app/login.segments/_full.segment.rsc +5 -5
- package/app/.next-cli-build/server/app/login.segments/_tree.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/login.segments/login/__PAGE__.segment.rsc +5 -5
- package/app/.next-cli-build/server/app/manifest.webmanifest/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/page.js +1 -1
- package/app/.next-cli-build/server/app/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app-paths-manifest.json +9 -9
- package/app/.next-cli-build/server/chunks/1281.js +1 -0
- package/app/.next-cli-build/server/chunks/2132.js +1 -1
- package/app/.next-cli-build/server/chunks/2147.js +1 -1
- package/app/.next-cli-build/server/chunks/238.js +1 -0
- package/app/.next-cli-build/server/chunks/3558.js +1 -1
- package/app/.next-cli-build/server/chunks/3662.js +1 -1
- package/app/.next-cli-build/server/chunks/{5524.js → 3683.js} +1 -1
- package/app/.next-cli-build/server/chunks/3943.js +1 -1
- package/app/.next-cli-build/server/chunks/4123.js +1 -1
- package/app/.next-cli-build/server/chunks/5260.js +1 -0
- package/app/.next-cli-build/server/chunks/5330.js +3 -11
- package/app/.next-cli-build/server/chunks/5335.js +1 -0
- package/app/.next-cli-build/server/chunks/5615.js +1 -1
- package/app/.next-cli-build/server/chunks/5670.js +1 -1
- package/app/.next-cli-build/server/chunks/6155.js +1 -0
- package/app/.next-cli-build/server/chunks/6795.js +1 -0
- package/app/.next-cli-build/server/chunks/6818.js +1 -1
- package/app/.next-cli-build/server/chunks/7616.js +1 -1
- package/app/.next-cli-build/server/chunks/7716.js +9 -1
- package/app/.next-cli-build/server/chunks/8005.js +1 -1
- package/app/.next-cli-build/server/chunks/8157.js +1 -0
- package/app/.next-cli-build/server/chunks/827.js +1 -1
- package/app/.next-cli-build/server/chunks/869.js +1 -1
- package/app/.next-cli-build/server/chunks/8895.js +3 -8
- package/app/.next-cli-build/server/chunks/8907.js +1 -0
- package/app/.next-cli-build/server/chunks/8967.js +1 -1
- package/app/.next-cli-build/server/chunks/9229.js +6 -0
- package/app/.next-cli-build/server/chunks/9609.js +1 -1
- package/app/.next-cli-build/server/instrumentation.js +1 -1
- package/app/.next-cli-build/server/instrumentation.js.nft.json +1 -1
- package/app/.next-cli-build/server/middleware-build-manifest.js +1 -1
- package/app/.next-cli-build/server/middleware.js.nft.json +1 -1
- package/app/.next-cli-build/server/pages/404.html +1 -1
- package/app/.next-cli-build/server/pages/500.html +1 -1
- package/app/.next-cli-build/static/chunks/{1321-1c530e5975955126.js → 1321-27b1fa843de72660.js} +1 -1
- package/app/package.json +1 -1
- package/package.json +1 -1
- package/app/.next-cli-build/server/chunks/4037.js +0 -1
- package/app/.next-cli-build/server/chunks/4663.js +0 -1
- package/app/.next-cli-build/server/chunks/5245.js +0 -1
- package/app/.next-cli-build/server/chunks/576.js +0 -1
- package/app/.next-cli-build/server/chunks/8283.js +0 -1
- package/app/.next-cli-build/server/chunks/8908.js +0 -1
- package/app/.next-cli-build/server/chunks/929.js +0 -1
- /package/app/.next-cli-build/static/{KShBS6I4_7-mtcIrc3qd2 → I6qdfW3CKcF_LGnm4gr0x}/_buildManifest.js +0 -0
- /package/app/.next-cli-build/static/{KShBS6I4_7-mtcIrc3qd2 → I6qdfW3CKcF_LGnm4gr0x}/_ssgManifest.js +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
(()=>{var a={};a.id=2825,a.ids=[2825],a.modules={643:a=>{"use strict";a.exports=require("node:perf_hooks")},1027:(a,b,c)=>{Promise.resolve().then(c.bind(c,53478))},1707:(a,b,c)=>{Promise.resolve().then(c.bind(c,87149))},1708:a=>{"use strict";a.exports=require("node:process")},1932:a=>{"use strict";a.exports=require("url")},3295:a=>{"use strict";a.exports=require("next/dist/server/app-render/after-task-async-storage.external.js")},4573:a=>{"use strict";a.exports=require("node:buffer")},7066:a=>{"use strict";a.exports=require("node:tty")},8128:a=>{"use strict";a.exports=require("next/dist/server/runtime-reacts.external.js")},10846:a=>{"use strict";a.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},14985:a=>{"use strict";a.exports=require("dns")},16698:a=>{"use strict";a.exports=require("node:async_hooks")},19121:a=>{"use strict";a.exports=require("next/dist/server/app-render/action-async-storage.external.js")},21820:a=>{"use strict";a.exports=require("os")},27910:a=>{"use strict";a.exports=require("stream")},28354:a=>{"use strict";a.exports=require("util")},29021:a=>{"use strict";a.exports=require("fs")},29294:a=>{"use strict";a.exports=require("next/dist/server/app-render/work-async-storage.external.js")},31421:a=>{"use strict";a.exports=require("node:child_process")},32467:a=>{"use strict";a.exports=require("node:http2")},33873:a=>{"use strict";a.exports=require("path")},34589:a=>{"use strict";a.exports=require("node:assert")},37067:a=>{"use strict";a.exports=require("node:http")},37540:a=>{"use strict";a.exports=require("node:console")},38522:a=>{"use strict";a.exports=require("node:zlib")},40610:a=>{"use strict";a.exports=require("node:dns")},41025:a=>{"use strict";a.exports=require("next/dist/server/app-render/dynamic-access-async-storage.external.js")},41692:a=>{"use strict";a.exports=require("node:tls")},41792:a=>{"use strict";a.exports=require("node:querystring")},43381:(a,b,c)=>{"use strict";c.r(b),c.d(b,{__next_app__:()=>w,handler:()=>y,routeModule:()=>x});var d=c(21635),e=c(86315),f=c(1020),g=c(61287),h={};for(let a in g)0>["default","__next_app__","routeModule","handler"].indexOf(a)&&(h[a]=()=>g[a]);c.d(b,h);let i=(0,d.p)(()=>Promise.resolve().then(c.bind(c,57529))),j=(0,d.p)(()=>Promise.resolve().then(c.t.bind(c,95547,23))),k=(0,d.p)(()=>Promise.resolve().then(c.t.bind(c,55091,23))),l=(0,d.p)(()=>Promise.resolve().then(c.t.bind(c,45270,23))),m=(0,d.p)(()=>Promise.resolve().then(c.t.bind(c,28193,23))),n=(0,d.p)(()=>Promise.resolve().then(c.bind(c,30508))),o=(0,d.p)(()=>Promise.resolve().then(c.t.bind(c,95547,23))),p=(0,d.p)(()=>Promise.resolve().then(c.t.bind(c,55091,23))),q=(0,d.p)(()=>Promise.resolve().then(c.t.bind(c,45270,23))),r=(0,d.p)(()=>Promise.resolve().then(c.t.bind(c,28193,23))),s=(0,d.p)(()=>Promise.resolve().then(c.t.bind(c,95547,23))),t=(0,d.p)(()=>Promise.resolve().then(c.t.bind(c,95547,23))),u={children:["",{children:["(dashboard)",{children:["dashboard",{children:["usage",{children:["__PAGE__",{},{page:[(0,d.p)(()=>Promise.resolve().then(c.bind(c,87149))),"C:\\Users\\Developer\\9router-fix\\src\\app\\(dashboard)\\dashboard\\usage\\page.js"]}]},{"global-error":[t,"next/dist/client/components/builtin/global-error.js"]},[]]},{"global-error":[s,"next/dist/client/components/builtin/global-error.js"]},[]]},{layout:[n,"C:\\Users\\Developer\\9router-fix\\src\\app\\(dashboard)\\layout.js"],"global-error":[o,"next/dist/client/components/builtin/global-error.js"],"not-found":[p,"next/dist/client/components/builtin/not-found.js"],forbidden:[q,"next/dist/client/components/builtin/forbidden.js"],unauthorized:[r,"next/dist/client/components/builtin/unauthorized.js"],metadata:{icon:[async a=>(await (0,d.p)(()=>Promise.resolve().then(c.bind(c,70440)))()).default(a)],apple:[],openGraph:[],twitter:[],manifest:"/manifest.webmanifest"}},[]]},{layout:[i,"C:\\Users\\Developer\\9router-fix\\src\\app\\layout.js"],"global-error":[j,"next/dist/client/components/builtin/global-error.js"],"not-found":[k,"next/dist/client/components/builtin/not-found.js"],forbidden:[l,"next/dist/client/components/builtin/forbidden.js"],unauthorized:[m,"next/dist/client/components/builtin/unauthorized.js"],metadata:{icon:[async a=>(await (0,d.p)(()=>Promise.resolve().then(c.bind(c,70440)))()).default(a)],apple:[],openGraph:[],twitter:[],manifest:"/manifest.webmanifest"}},[]]}.children,v=(0,e.H)({tree:u,page:"/(dashboard)/dashboard/usage/page",pathname:"/dashboard/usage",require:c,loadChunk:()=>Promise.resolve(),interopDefault:f.T}),w=v.__next_app__,x=v.routeModule,y=v.handler},46060:a=>{"use strict";a.exports=require("next/dist/shared/lib/no-fallback-error.external.js")},46293:a=>{"use strict";a.exports=require("sql.js")},48161:a=>{"use strict";a.exports=require("node:os")},51455:a=>{"use strict";a.exports=require("node:fs/promises")},53053:a=>{"use strict";a.exports=require("node:diagnostics_channel")},53478:(a,b,c)=>{"use strict";c.r(b),c.d(b,{default:()=>aX});var d=c(48249),e=c(67484),f=c(19099),g=c(50412),h=c(17660),i=c(99070),j=c(71404);function k({isOpen:a,onClose:b,title:c,children:e,width:f="md",className:g}){let h={sm:"w-[400px]",md:"w-[500px]",lg:"w-[600px]",xl:"w-[800px]",full:"w-full"};return a?(0,d.jsxs)("div",{className:"fixed inset-0 z-50",children:[(0,d.jsx)("div",{className:"absolute inset-0 bg-black/50 backdrop-blur-[2px] fade-in cursor-pointer",onClick:b,"aria-hidden":"true"}),(0,d.jsxs)("div",{className:(0,j.cn)("absolute right-0 top-0 h-full bg-surface flex flex-col","shadow-[var(--shadow-elev)]","slide-in-right","border-l border-border-subtle",h[f]||h.md,g),children:[(0,d.jsxs)("div",{className:"flex items-center justify-between p-6 border-b border-border-subtle flex-shrink-0",children:[(0,d.jsx)("div",{className:"flex items-center gap-3",children:c&&(0,d.jsx)("h2",{className:"text-lg font-semibold text-text-main",children:c})}),(0,d.jsx)("button",{type:"button",onClick:b,className:"p-1.5 rounded-[10px] text-text-muted hover:bg-surface-2 hover:text-text-main transition-colors",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-[20px]",children:"close"})})]}),(0,d.jsx)("div",{className:"flex-1 overflow-y-auto p-6 custom-scrollbar",children:e})]})]}):null}function l({currentPage:a,pageSize:b,totalItems:c,onPageChange:e,onPageSizeChange:f,className:g}){let h=Math.ceil(c/b),k=c>0?(a-1)*b+1:0,m=Math.min(a*b,c),n=(()=>{let b=[],c=Math.max(1,a-2),d=Math.min(h,c+5-1);d-c+1<5&&(c=Math.max(1,d-5+1));for(let a=c;a<=d;a++)b.push(a);return b})();return(0,d.jsxs)("div",{className:(0,j.cn)("flex flex-col sm:flex-row items-center justify-between gap-4 py-4 px-2",g),children:[c>0&&(0,d.jsxs)("div",{className:"text-sm text-text-muted",children:["Showing ",(0,d.jsx)("span",{className:"font-medium text-text-main",children:k})," to"," ",(0,d.jsx)("span",{className:"font-medium text-text-main",children:m})," of"," ",(0,d.jsx)("span",{className:"font-medium text-text-main",children:c})," results"]}),(0,d.jsxs)("div",{className:"flex flex-wrap items-center justify-center gap-2 sm:gap-4",children:[f&&(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)("span",{className:"text-sm text-text-muted",children:"Rows:"}),(0,d.jsx)("select",{value:b,onChange:a=>f(Number(a.target.value)),className:(0,j.cn)("h-9 rounded-lg border border-black/10 dark:border-white/10 bg-surface","text-sm text-text-main focus:outline-none focus:ring-2 focus:ring-primary/20","cursor-pointer"),style:{colorScheme:"auto"},children:[10,20,50].map(a=>(0,d.jsx)("option",{value:a,children:a},a))})]}),h>1&&(0,d.jsxs)("div",{className:"flex items-center gap-1",children:[(0,d.jsx)(i.default,{variant:"outline",size:"sm",onClick:()=>e(a-1),disabled:1===a,className:"w-9 px-0",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"chevron_left"})}),n[0]>1&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(i.default,{variant:"ghost",size:"sm",onClick:()=>e(1),className:"w-9 px-0 hidden sm:inline-flex",children:"1"}),n[0]>2&&(0,d.jsx)("span",{className:"text-text-muted px-1 hidden sm:inline",children:"..."})]}),n.map(b=>(0,d.jsx)(i.default,{variant:a===b?"primary":"ghost",size:"sm",onClick:()=>e(b),className:(0,j.cn)("w-9 px-0",a===b?"inline-flex":"hidden sm:inline-flex"),children:b},b)),n[n.length-1]<h&&(0,d.jsxs)(d.Fragment,{children:[n[n.length-1]<h-1&&(0,d.jsx)("span",{className:"text-text-muted px-1 hidden sm:inline",children:"..."}),(0,d.jsx)(i.default,{variant:"ghost",size:"sm",onClick:()=>e(h),className:"w-9 px-0 hidden sm:inline-flex",children:h})]}),(0,d.jsx)(i.default,{variant:"outline",size:"sm",onClick:()=>e(a+1),disabled:a===h,className:"w-9 px-0",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"chevron_right"})})]})]})]})}var m=c(92592);let n=null,o=null;async function p(){if(n&&o)return{providerNameCache:n,providerNodesCache:o};let a=await fetch("/api/provider-nodes"),b=(await a.json()).nodes||[];for(let a of(o={},b))o[a.id]=a.name;return{providerNameCache:n={...m.Q2,...o},providerNodesCache:o}}function q(a,b){if(!a||!b)return a;let c=b[a];if("string"==typeof c)return c;if(c?.name)return c.name;let d=(0,m.zt)(a)||m.Q2[a];return d?.name||a}function r({title:a,children:b,defaultOpen:c=!1,icon:f=null}){let[g,h]=(0,e.useState)(c);return(0,d.jsxs)("div",{className:"border border-black/5 dark:border-white/5 rounded-lg overflow-hidden",children:[(0,d.jsxs)("button",{type:"button",onClick:()=>h(!g),className:"w-full flex items-center justify-between p-3 bg-black/[0.02] dark:bg-white/[0.02] hover:bg-black/[0.04] dark:hover:bg-white/[0.04] transition-colors",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[f&&(0,d.jsx)("span",{className:"material-symbols-outlined text-[18px] text-text-muted",children:f}),(0,d.jsx)("span",{className:"font-semibold text-sm text-text-main",children:a})]}),(0,d.jsx)("span",{className:(0,j.cn)("material-symbols-outlined text-[20px] text-text-muted transition-transform duration-200",g?"rotate-90":""),children:"chevron_right"})]}),g&&(0,d.jsx)("div",{className:"p-4 border-t border-black/5 dark:border-white/5",children:b})]})}function s(a){return a?.cached_tokens||a?.cache_read_input_tokens||0}function t(a){return a?.cache_creation_input_tokens||0}function u(a){let b=a?.prompt_tokens||a?.input_tokens||0,c=s(a);return b<c?c:b}function v(){let[a,b]=(0,e.useState)([]),[c,f]=(0,e.useState)({page:1,pageSize:20,totalItems:0,totalPages:0}),[g,m]=(0,e.useState)(!1),[n,o]=(0,e.useState)(null),[v,w]=(0,e.useState)(!1),[x,y]=(0,e.useState)([]),[z,A]=(0,e.useState)(null),[B,C]=(0,e.useState)({provider:"",startDate:"",endDate:""});return(0,e.useCallback)(async()=>{try{let a=await fetch("/api/usage/providers"),b=await a.json();y(b.providers||[]);let c=await p();A(c.providerNameCache)}catch(a){console.error("Failed to fetch providers:",a)}},[]),(0,e.useCallback)(async()=>{m(!0);try{let a=new URLSearchParams({page:c.page.toString(),pageSize:c.pageSize.toString()});B.provider&&a.append("provider",B.provider),B.startDate&&a.append("startDate",B.startDate),B.endDate&&a.append("endDate",B.endDate);let d=await fetch(`/api/usage/request-details?${a}`),e=await d.json();b(e.details||[]),f(a=>({...a,...e.pagination}))}catch(a){console.error("Failed to fetch request details:",a)}finally{m(!1)}},[c.page,c.pageSize,B]),(0,d.jsxs)("div",{className:"flex min-w-0 flex-col gap-6",children:[(0,d.jsx)(h.default,{padding:"md",children:(0,d.jsxs)("div",{className:"grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-4",children:[(0,d.jsxs)("div",{className:"flex min-w-0 flex-col gap-2",children:[(0,d.jsx)("label",{htmlFor:"provider-filter",className:"text-sm font-medium text-text-main",children:"Provider"}),(0,d.jsxs)("select",{id:"provider-filter",value:B.provider,onChange:a=>C({...B,provider:a.target.value}),className:(0,j.cn)("h-9 px-3 rounded-lg border border-black/10 dark:border-white/10 bg-surface","text-sm text-text-main focus:outline-none focus:ring-2 focus:ring-primary/20","w-full min-w-0 cursor-pointer"),style:{colorScheme:"auto"},children:[(0,d.jsx)("option",{value:"",children:"All Providers"}),x.map(a=>(0,d.jsx)("option",{value:a.id,children:a.name},a.id))]})]}),(0,d.jsxs)("div",{className:"flex min-w-0 flex-col gap-2",children:[(0,d.jsx)("label",{htmlFor:"start-date-filter",className:"text-sm font-medium text-text-main",children:"Start Date"}),(0,d.jsx)("input",{id:"start-date-filter",type:"datetime-local",value:B.startDate,onChange:a=>C({...B,startDate:a.target.value}),className:(0,j.cn)("h-9 px-3 rounded-lg border border-black/10 dark:border-white/10 bg-surface","w-full min-w-0 text-sm text-text-main focus:outline-none focus:ring-2 focus:ring-primary/20")})]}),(0,d.jsxs)("div",{className:"flex min-w-0 flex-col gap-2",children:[(0,d.jsx)("label",{htmlFor:"end-date-filter",className:"text-sm font-medium text-text-main",children:"End Date"}),(0,d.jsx)("input",{id:"end-date-filter",type:"datetime-local",value:B.endDate,onChange:a=>C({...B,endDate:a.target.value}),className:(0,j.cn)("h-9 px-3 rounded-lg border border-black/10 dark:border-white/10 bg-surface","w-full min-w-0 text-sm text-text-main focus:outline-none focus:ring-2 focus:ring-primary/20")})]}),(0,d.jsxs)("div",{className:"flex min-w-0 flex-col gap-2 sm:col-span-2 lg:col-span-1",children:[(0,d.jsx)("span",{className:"hidden text-sm font-medium text-text-main opacity-0 lg:block","aria-hidden":"true",children:"Clear"}),(0,d.jsx)(i.default,{variant:"ghost",onClick:()=>{C({provider:"",startDate:"",endDate:""})},disabled:!B.provider&&!B.startDate&&!B.endDate,className:"w-full",children:"Clear Filters"})]})]})}),(0,d.jsxs)(h.default,{padding:"none",children:[(0,d.jsx)("div",{className:"overflow-x-auto",children:(0,d.jsxs)("table",{className:"w-full min-w-[880px]",children:[(0,d.jsx)("thead",{children:(0,d.jsxs)("tr",{className:"border-b border-black/5 dark:border-white/5",children:[(0,d.jsx)("th",{className:"text-left p-4 text-sm font-semibold text-text-main",children:"Timestamp"}),(0,d.jsx)("th",{className:"text-left p-4 text-sm font-semibold text-text-main",children:"Model"}),(0,d.jsx)("th",{className:"text-left p-4 text-sm font-semibold text-text-main",children:"Provider"}),(0,d.jsx)("th",{className:"text-right p-4 text-sm font-semibold text-text-main",children:"Input Tokens"}),(0,d.jsx)("th",{className:"text-right p-4 text-sm font-semibold text-text-main",children:"Cached"}),(0,d.jsx)("th",{className:"text-right p-4 text-sm font-semibold text-text-main",children:"Cache Creation"}),(0,d.jsx)("th",{className:"text-right p-4 text-sm font-semibold text-text-main",children:"Output Tokens"}),(0,d.jsx)("th",{className:"text-left p-4 text-sm font-semibold text-text-main",children:"Latency"}),(0,d.jsx)("th",{className:"text-center p-4 text-sm font-semibold text-text-main",children:"Action"})]})}),(0,d.jsx)("tbody",{children:g?(0,d.jsx)("tr",{children:(0,d.jsx)("td",{colSpan:"7",className:"p-8 text-center text-text-muted",children:(0,d.jsxs)("div",{className:"flex items-center justify-center gap-2",children:[(0,d.jsx)("span",{className:"material-symbols-outlined animate-spin text-[20px]",children:"progress_activity"}),"Loading..."]})})}):0===a.length?(0,d.jsx)("tr",{children:(0,d.jsx)("td",{colSpan:"7",className:"p-8 text-center text-text-muted",children:"No request details found"})}):a.map((a,b)=>(0,d.jsxs)("tr",{className:"border-b border-black/5 dark:border-white/5 last:border-b-0 hover:bg-black/[0.02] dark:hover:bg-white/[0.02] transition-colors",children:[(0,d.jsx)("td",{className:"whitespace-nowrap p-4 text-sm text-text-main",children:new Date(a.timestamp).toLocaleString()}),(0,d.jsx)("td",{className:"max-w-[260px] truncate p-4 font-mono text-sm text-text-main",children:a.model}),(0,d.jsx)("td",{className:"max-w-[180px] truncate p-4 text-sm text-text-main",children:(0,d.jsx)("span",{className:"font-medium",children:q(a.provider,z)})}),(0,d.jsx)("td",{className:"p-4 text-sm text-text-main text-right font-mono",children:u(a.tokens).toLocaleString()}),(0,d.jsx)("td",{className:"p-4 text-sm text-text-main text-right font-mono",children:s(a.tokens)>0?s(a.tokens).toLocaleString():"—"}),(0,d.jsx)("td",{className:"p-4 text-sm text-text-main text-right font-mono",children:t(a.tokens)>0?t(a.tokens).toLocaleString():"—"}),(0,d.jsx)("td",{className:"p-4 text-sm text-text-main text-right font-mono",children:a.tokens?.completion_tokens?.toLocaleString()||0}),(0,d.jsx)("td",{className:"p-4 text-sm text-text-muted",children:(0,d.jsxs)("div",{className:"flex flex-col gap-0.5",children:[(0,d.jsxs)("div",{children:["TTFT: ",(0,d.jsxs)("span",{className:"font-mono",children:[a.latency?.ttft||0,"ms"]})]}),(0,d.jsxs)("div",{children:["Total: ",(0,d.jsxs)("span",{className:"font-mono",children:[a.latency?.total||0,"ms"]})]})]})}),(0,d.jsx)("td",{className:"p-4 text-center",children:(0,d.jsx)(i.default,{variant:"outline",size:"sm",onClick:()=>{o(a),w(!0)},children:"Detail"})})]},`${a.id}-${b}`))})]})}),!g&&a.length>0&&(0,d.jsx)("div",{className:"border-t border-black/5 dark:border-white/5",children:(0,d.jsx)(l,{currentPage:c.page,pageSize:c.pageSize,totalItems:c.totalItems,onPageChange:a=>{f(b=>({...b,page:a}))},onPageSizeChange:a=>{f(b=>({...b,pageSize:a,page:1}))}})})]}),(0,d.jsx)(k,{isOpen:v,onClose:()=>w(!1),title:"Request Details",width:"lg",children:n&&(0,d.jsxs)("div",{className:"space-y-6",children:[(0,d.jsxs)("div",{className:"grid min-w-0 grid-cols-1 gap-4 text-sm sm:grid-cols-2",children:[(0,d.jsxs)("div",{children:[(0,d.jsx)("span",{className:"text-text-muted",children:"ID:"})," ",(0,d.jsx)("span",{className:"break-all font-mono text-text-main",children:n.id})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("span",{className:"text-text-muted",children:"Timestamp:"})," ",(0,d.jsx)("span",{className:"text-text-main",children:new Date(n.timestamp).toLocaleString()})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("span",{className:"text-text-muted",children:"Provider:"})," ",(0,d.jsx)("span",{className:"text-text-main font-medium",children:q(n.provider,z)})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("span",{className:"text-text-muted",children:"Model:"})," ",(0,d.jsx)("span",{className:"text-text-main font-mono",children:n.model})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("span",{className:"text-text-muted",children:"Status:"})," ",(0,d.jsx)("span",{className:(0,j.cn)("font-medium","success"===n.status?"text-green-600":"text-red-600"),children:n.status})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("span",{className:"text-text-muted",children:"Latency:"})," ",(0,d.jsxs)("span",{className:"text-text-main font-mono",children:["TTFT ",n.latency?.ttft||0,"ms / Total ",n.latency?.total||0,"ms"]})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("span",{className:"text-text-muted",children:"Input Tokens:"})," ",(0,d.jsx)("span",{className:"text-text-main font-mono",children:u(n.tokens).toLocaleString()})]}),s(n.tokens)>0&&(0,d.jsxs)("div",{children:[(0,d.jsx)("span",{className:"text-text-muted",children:"Cached Tokens:"})," ",(0,d.jsx)("span",{className:"text-text-main font-mono",children:s(n.tokens).toLocaleString()})]}),t(n.tokens)>0&&(0,d.jsxs)("div",{children:[(0,d.jsx)("span",{className:"text-text-muted",children:"Cache Creation:"})," ",(0,d.jsx)("span",{className:"text-text-main font-mono",children:t(n.tokens).toLocaleString()})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("span",{className:"text-text-muted",children:"Output Tokens:"})," ",(0,d.jsx)("span",{className:"text-text-main font-mono",children:n.tokens?.completion_tokens?.toLocaleString()||0})]})]}),n.pxpipe&&(0,d.jsxs)("div",{className:"rounded-lg border border-black/5 dark:border-white/5 p-4",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2 mb-2",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[18px] text-text-muted",children:"image"}),(0,d.jsx)("span",{className:"font-semibold text-sm text-text-main",children:"PXPIPE"}),(0,d.jsx)("span",{className:(0,j.cn)("text-xs px-2 py-0.5 rounded",n.pxpipe.applied?"bg-green-500/15 text-green-600":"bg-amber-500/15 text-amber-600"),children:n.pxpipe.applied?"Activated":"Skipped"})]}),n.pxpipe.applied?(0,d.jsxs)("div",{className:"grid grid-cols-2 gap-2 text-sm sm:grid-cols-4",children:[(0,d.jsxs)("div",{children:[(0,d.jsx)("span",{className:"text-text-muted block text-xs",children:"Original (est.)"}),(0,d.jsxs)("span",{className:"font-mono",children:[(n.pxpipe.tokensBeforeEst||0).toLocaleString()," tokens"]})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("span",{className:"text-text-muted block text-xs",children:"Compressed (est.)"}),(0,d.jsxs)("span",{className:"font-mono",children:[(n.pxpipe.tokensAfterEst||0).toLocaleString()," tokens"]})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("span",{className:"text-text-muted block text-xs",children:"Saved"}),(0,d.jsxs)("span",{className:"font-mono text-green-600",children:[n.pxpipe.savedPct||0,"%"]})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("span",{className:"text-text-muted block text-xs",children:"Images"}),(0,d.jsxs)("span",{className:"font-mono",children:[n.pxpipe.imageCount||0," (",n.pxpipe.durationMs||0,"ms)"]})]})]}):(0,d.jsxs)("p",{className:"text-sm text-text-muted",children:["Reason: ",(0,d.jsx)("span",{className:"font-mono",children:n.pxpipe.reason}),n.pxpipe.detail?` — ${n.pxpipe.detail}`:""]})]}),(0,d.jsxs)("div",{className:"space-y-4",children:[(0,d.jsx)(r,{title:"1. Client Request (Input)",defaultOpen:!0,icon:"input",children:(0,d.jsx)("pre",{className:"max-h-[300px] max-w-full overflow-auto rounded-lg border border-black/5 bg-black/5 p-3 font-mono text-xs text-text-main dark:border-white/5 dark:bg-white/5 sm:p-4",children:JSON.stringify(n.request,null,2)})}),n.providerRequest&&(0,d.jsx)(r,{title:"2. Provider Request (Translated)",icon:"translate",children:(0,d.jsx)("pre",{className:"max-h-[300px] max-w-full overflow-auto rounded-lg border border-black/5 bg-black/5 p-3 font-mono text-xs text-text-main dark:border-white/5 dark:bg-white/5 sm:p-4",children:JSON.stringify(n.providerRequest,null,2)})}),n.providerResponse&&(0,d.jsx)(r,{title:"3. Provider Response (Raw)",icon:"data_object",children:(0,d.jsx)("pre",{className:"max-h-[300px] max-w-full overflow-auto rounded-lg border border-black/5 bg-black/5 p-3 font-mono text-xs text-text-main dark:border-white/5 dark:bg-white/5 sm:p-4",children:"object"==typeof n.providerResponse?JSON.stringify(n.providerResponse,null,2):n.providerResponse})}),(0,d.jsxs)(r,{title:"4. Client Response (Final)",defaultOpen:!0,icon:"output",children:[n.response?.thinking&&(0,d.jsxs)("div",{className:"mb-4",children:[(0,d.jsxs)("h4",{className:"font-semibold text-text-main mb-2 flex items-center gap-2 text-xs uppercase tracking-wide opacity-70",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"psychology"}),"Thinking Process"]}),(0,d.jsx)("pre",{className:"max-h-[200px] max-w-full overflow-auto rounded-lg border border-amber-200 bg-amber-50 p-3 font-mono text-xs text-amber-900 dark:border-amber-800 dark:bg-amber-950/30 dark:text-amber-100 sm:p-4",children:n.response.thinking})]}),(0,d.jsx)("h4",{className:"font-semibold text-text-main mb-2 text-xs uppercase tracking-wide opacity-70",children:"Content"}),(0,d.jsx)("pre",{className:"max-h-[300px] max-w-full overflow-auto rounded-lg border border-black/5 bg-black/5 p-3 font-mono text-xs text-text-main dark:border-white/5 dark:bg-white/5 sm:p-4",children:n.response?.content||"[No content]"})]})]})]})})]})}function w(a){let b=Number(a)||0;return b<1e3?String(b):b<1e6?`${(b/1e3).toFixed(+(b<1e4))}K`:b<1e9?`${(b/1e6).toFixed(1)}M`:`${(b/1e9).toFixed(1)}B`}function x(a){let b=Number(a)||0;return 0===b?"$0":b<.01?`$${b.toFixed(4)}`:`$${b.toFixed(2)}`}function y(a){return(Number(a)||0).toLocaleString("en-US")}function z(a){let b=Number(a);return(Number.isFinite(b)?Math.round(b):0).toLocaleString("en-US")}function A(a){return y(a)}function B(a,b){return"tokens"===b?a.tokens:a.cost}let C=[{id:"costs",label:"Cost",ranksBy:"cost"},{id:"tokens",label:"Tokens",ranksBy:"tokens"},{id:"both",label:"Cost + Tokens",ranksBy:"cost"}];function D(a){if(!a)return"";let b="number"==typeof a?a:Date.parse(a);if(!Number.isFinite(b))return"";let c=Math.floor((Date.now()-b)/6e4);if(c<1)return"less than a minute ago";if(c<60)return`${c} minute${1===c?"":"s"} ago`;let d=Math.floor(c/60);if(d<24)return`${d} hour${1===d?"":"s"} ago`;let e=Math.floor(d/24);return`${e} day${1===e?"":"s"} ago`}function E(a){if(!a)return"";let b="number"==typeof a?a:Date.parse(a);return Number.isFinite(b)?new Date(b).toLocaleString("en-US",{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"}):""}function F(a,b){let c=Number(a)||0,d=Number(b)||0;return d<=0?null:c/d*100}function G(a){return null!=a&&Number.isFinite(a)?a>0&&a<.1?"<0.1%":`${a.toFixed(a>=10?0:1)}%`:"—"}function H({input:a=0,output:b=0,cached:c=0,total:d=0}){let e=[`${y(a)} input`];return c>0&&e.push(`of which ${y(c)} cached`),e.push(`${y(b)} output`),`${y(d)} tokens — ${e.join(", ")}`}let I={today:"today","24h":"last 24 hours","7d":"last 7 days","30d":"last 30 days","60d":"last 60 days",all:"all time"};function J({rows:a,mode:b="costs",colorOf:c,onPick:f=null,top:g=8}){let[h,i]=(0,e.useState)(null),[j,k]=(0,e.useState)(!1),l=(0,e.useId)(),m=a=>"tokens"===b?a.tokens:a.cost,n=(0,e.useMemo)(()=>{let b=[...a||[]].sort((a,b)=>m(b)-m(a)),c=j?b.length:g,d=b.slice(0,c),e=b.slice(c),f=b.reduce((a,b)=>a+(m(b)||0),0),h=d.reduce((a,b)=>a+(m(b)||0),0);return{total:f,shown:d,restCount:e.length,restValue:f-h,restPct:F(f-h,f)}},[a,b,g,j]);if(!n.total)return(0,d.jsxs)("div",{className:"flex min-w-0 flex-col gap-2",children:[(0,d.jsx)("p",{className:"text-xs font-medium text-text-main",children:"Provider"}),(0,d.jsx)("p",{className:"text-xs text-text-muted",children:"Belum ada pemakaian pada periode ini, jadi tidak ada yang bisa dibandingkan."})]});let o=[],p=-90;for(let a of n.shown){let b=(m(a)||0)/n.total*360;b<=0||(o.push({id:a.id,row:a,from:p,to:p+b,pct:b/3.6}),p+=b)}if(n.restValue>0){let a=n.restValue/n.total*360;o.push({id:"__rest",rest:!0,from:p,to:p+a,pct:a/3.6})}let q=(a,b)=>{let c=a*Math.PI/180;return[84+b*Math.cos(c),84+b*Math.sin(c)]},r="tokens"===b?A:x,s=h?o.find(a=>a.id===h):null;return(0,d.jsxs)("div",{className:"flex min-w-0 flex-col gap-3",children:[(0,d.jsxs)("div",{className:"flex items-baseline justify-between gap-2",children:[(0,d.jsx)("h3",{className:"text-xs font-medium uppercase tracking-wide text-text-muted",children:"Provider"}),(0,d.jsxs)("span",{className:"text-[10px] text-text-subtle",children:[n.shown.length,n.restCount?` + ${n.restCount}`:""," provider"]})]}),(0,d.jsxs)("div",{className:"flex flex-col items-center gap-3 sm:flex-row sm:items-center sm:gap-5",children:[(0,d.jsxs)("svg",{viewBox:"0 0 168 168",width:168,height:168,className:"shrink-0",role:"img","aria-labelledby":l,children:[(0,d.jsxs)("title",{id:l,children:["Komposisi ","tokens"===b?"token":"biaya"," per provider."," ",n.shown.map(a=>`${a.id} ${G(F(m(a),n.total))}`).join(", "),"."]}),o.map(a=>{let b=((a,b)=>{let c=Math.min(1.2,(b-a)/6),d=a+c,e=b-c;if(e<=d)return null;let f=+(e-d>180),[g,h]=q(d,74),[i,j]=q(e,74),[k,l]=q(e,50),[m,n]=q(d,50);return`M ${g.toFixed(2)} ${h.toFixed(2)} A 74 74 0 ${f} 1 ${i.toFixed(2)} ${j.toFixed(2)} L ${k.toFixed(2)} ${l.toFixed(2)} A 50 50 0 ${f} 0 ${m.toFixed(2)} ${n.toFixed(2)} Z`})(a.from,a.to);if(!b)return null;let e=h===a.id;return(0,d.jsx)("path",{d:b,fill:a.rest?"var(--color-border)":c(a.id,"solid"),opacity:h&&!e?.35:1,className:"cursor-pointer transition-opacity duration-150",onMouseEnter:()=>i(a.id),onMouseLeave:()=>i(null),onClick:f&&!a.rest?()=>f(a.row):void 0},a.id)}),(0,d.jsx)("text",{x:84,y:80,textAnchor:"middle",className:"fill-text-main text-[15px] font-semibold tabular-nums",style:{fontVariantNumeric:"tabular-nums"},children:s?G(s.pct):r(n.total).replace(/^\$/,"$")}),(0,d.jsx)("text",{x:84,y:97,textAnchor:"middle",className:"fill-text-muted text-[9px]",children:s?s.rest?`${n.restCount} lainnya`:String(s.id).slice(0,16):"tokens"===b?"total token":"total biaya"})]}),(0,d.jsxs)("ul",{className:"flex min-w-0 flex-1 flex-col gap-1",children:[n.shown.map(a=>{let b=F(m(a),n.total);return(0,d.jsx)("li",{children:(0,d.jsxs)("button",{type:"button",onMouseEnter:()=>i(a.id),onMouseLeave:()=>i(null),onFocus:()=>i(a.id),onBlur:()=>i(null),onClick:f?()=>f(a):void 0,className:`flex w-full items-center gap-2 rounded-md px-1.5 py-1 text-left transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/45 ${h===a.id?"bg-bg-hover":""}`,children:[(0,d.jsx)("span",{className:"size-2 shrink-0 rounded-sm",style:{backgroundColor:c(a.id,"solid")},"aria-hidden":"true"}),(0,d.jsx)("span",{className:"min-w-0 flex-1 truncate text-xs text-text-main",children:a.id}),(0,d.jsx)("span",{className:"shrink-0 tabular-nums text-xs text-text-muted",children:G(b)}),(0,d.jsx)("span",{className:"w-20 shrink-0 text-right tabular-nums text-xs text-text-main",children:r(m(a))})]})},a.id)}),n.restValue>0?(0,d.jsxs)("li",{className:"flex items-center gap-2 px-1.5 py-1",children:[(0,d.jsx)("span",{className:"size-2 shrink-0 rounded-sm",style:{backgroundColor:"var(--color-border)"},"aria-hidden":"true"}),(0,d.jsxs)("span",{className:"min-w-0 flex-1 truncate text-xs text-text-muted",children:[n.restCount," provider lainnya"]}),(0,d.jsx)("span",{className:"shrink-0 tabular-nums text-xs text-text-muted",children:G(n.restPct)}),(0,d.jsx)("span",{className:"w-20 shrink-0 text-right tabular-nums text-xs text-text-muted",children:r(n.restValue)})]}):null]})]}),n.restCount>0?(0,d.jsx)("button",{type:"button",onClick:()=>k(a=>!a),className:"self-start rounded-md px-2 py-1 text-[11px] font-medium text-primary transition-colors hover:bg-primary/8 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/45",children:j?"Ringkas jadi 8 teratas":`Tampilkan semua ${n.shown.length+n.restCount} provider`}):null]})}function K({value:a,format:b,duration:c=520,className:f=""}){let g=function(a,{duration:b=420}={}){let c;!function(){let[a,b]=(0,e.useState)(!1)}();let d=Number.isFinite(c=Number(a))?c:0,f=Number.isFinite(Number(a)),[g,h]=(0,e.useState)(f?d:0);return(0,e.useRef)(f?d:0),(0,e.useRef)(f?d:0),(0,e.useRef)(null),f?g:0}(a,{duration:c});return(0,d.jsx)("span",{className:f,"data-animated-number":"",children:b?b(g):String(Math.round(g))})}function L({stats:a,mode:b,period:c,onModeChange:f,onSelectProvider:g,selectedProvider:h,nodeNames:i={},colorOf:j,donutRows:k=null,onPickProvider:l}){let m="tokens"===b,{providers:n,total:o,headCost:p,headTokens:q,headIn:r,headOut:s,headCached:t,requests:u,activeCount:v,errorProvider:A}=(0,e.useMemo)(()=>{let b=Object.entries(a?.byProvider||{}).map(([a,b])=>({id:a,requests:b?.requests||0,promptTokens:b?.promptTokens||0,completionTokens:b?.completionTokens||0,cachedTokens:b?.cachedTokens||0,tokens:(b?.promptTokens||0)+(b?.completionTokens||0),cost:b?.cost||0})).sort((a,b)=>m?b.tokens-a.tokens:b.cost-a.cost),c=a=>b.reduce((b,c)=>b+a(c),0);return{providers:b,total:c(a=>m?a.tokens:a.cost),headCost:c(a=>a.cost),headTokens:c(a=>a.tokens),headIn:c(a=>a.promptTokens),headOut:c(a=>a.completionTokens),headCached:c(a=>a.cachedTokens),requests:a?.totalRequests||0,activeCount:(a?.activeRequests||[]).reduce((a,b)=>a+(b.count||0),0),errorProvider:a?.errorProvider||null}},[a,m]),B=(0,e.useMemo)(()=>{let a=a=>m?a.tokens:a.cost;return n.filter(b=>a(b)>0||b.requests>0).map(b=>{var c;return{id:b.id,label:(c=b.id,i?.[c]?i[c]:c.length<=22?c:`${c.slice(0,14)}…`),value:a(b),pct:F(a(b),o),requests:b.requests,full:m?`${y(b.tokens)} tokens`:x(b.cost)}})},[n,m,o,i]),D=o<=0&&n.some(a=>a.requests>0),E=o>0||u>0,N=n.filter(a=>a.requests>0).length,O="tokens"===b,P=O?q:p,Q=O?z:x,R=O?p:q,S=O?x:z,T=H({input:r,output:s,cached:t,total:q}),U=F(t,r),V=F(s,q);return(0,d.jsxs)("header",{className:"min-w-0",children:[(0,d.jsxs)("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-2",children:[(0,d.jsxs)("span",{className:"text-xs font-medium text-text-muted",children:["Usage \xb7 ",I[c]||c]}),(0,d.jsx)("div",{className:"ml-auto flex items-center gap-1 rounded-lg border border-border bg-bg-subtle p-0.5",role:"group","aria-label":"What to show",children:C.map(a=>(0,d.jsx)("button",{type:"button",onClick:()=>f(a.id),"aria-pressed":b===a.id,className:["rounded-md px-2.5 py-1 text-xs font-medium transition-colors duration-150 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/45",b===a.id?"bg-primary-strong text-white shadow-sm":"text-text-muted hover:bg-bg-hover hover:text-text-main"].join(" "),children:a.label},a.id))})]}),(0,d.jsx)("p",{className:"mt-1.5 text-[0.6875rem] text-text-subtle",children:"No period-over-period comparison — the usage API returns a single aggregate series, so there is no prior period to diff against."}),k&&k.length>0?(0,d.jsx)("div",{className:"mt-5 border-t border-border-subtle pt-4",children:(0,d.jsx)(J,{rows:k,mode:b,colorOf:j,onPick:l})}):null,(0,d.jsxs)("div",{className:"mt-3 flex flex-col items-start gap-1.5",children:[(0,d.jsxs)("span",{className:"flex items-baseline gap-2",children:[E?(0,d.jsx)(K,{value:P,format:Q,className:"text-[2.75rem] font-semibold leading-none tracking-[-0.03em] tabular-nums text-text-main sm:text-[3.25rem]"}):(0,d.jsx)("span",{className:"text-[2.75rem] font-semibold leading-none tracking-[-0.03em] tabular-nums text-text-main sm:text-[3.25rem]",children:"—"}),"both"===b?(0,d.jsx)("span",{className:"text-xs font-medium uppercase tracking-wide text-text-subtle",children:O?"tokens":"cost"}):null]}),"both"===b?(0,d.jsxs)("span",{className:"flex items-baseline gap-2",children:[E?(0,d.jsx)(K,{value:R,format:S,className:"text-[1.75rem] font-semibold leading-none tracking-[-0.02em] tabular-nums text-text-main sm:text-[2rem]"}):(0,d.jsx)("span",{className:"text-[1.75rem] font-semibold leading-none tracking-[-0.02em] tabular-nums text-text-main sm:text-[2rem]",children:"—"}),(0,d.jsx)("span",{className:"text-xs font-medium uppercase tracking-wide text-text-subtle",children:O?"cost":"tokens"})]}):null,(0,d.jsxs)("span",{className:"text-sm text-text-muted",children:["costs"===b?"spent":"tokens"===b?"tokens":null,"both"!==b?(0,d.jsx)("span",{className:"mx-2 text-text-subtle",children:"\xb7"}):null,(0,d.jsx)(K,{value:u,format:z,className:"tabular-nums"})," requests",v>0?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("span",{className:"mx-2 text-text-subtle",children:"\xb7"}),(0,d.jsxs)("span",{className:"inline-flex items-center gap-1 text-primary",children:[(0,d.jsx)("span",{className:"size-1.5 animate-pulse rounded-full bg-primary","aria-hidden":"true"}),(0,d.jsx)("span",{className:"tabular-nums",children:v})," live"]})]}):null]})]}),E&&"costs"!==b&&q>0?(0,d.jsxs)("div",{className:"mt-3 max-w-2xl",children:[(0,d.jsxs)("div",{className:"flex h-1.5 w-full overflow-hidden rounded-full bg-border-subtle",children:[(0,d.jsx)("span",{className:"h-full transition-[width] duration-500",style:{flexGrow:Math.max(r-t,0),flexBasis:0,backgroundColor:"color-mix(in oklab, var(--color-primary) 30%, var(--color-surface))"}}),(0,d.jsx)("span",{className:"h-full transition-[width] duration-500",style:{flexGrow:t,flexBasis:0,minWidth:t>0?"2px":0,backgroundColor:"var(--color-primary)"}}),(0,d.jsx)("span",{className:"h-full transition-[width] duration-500",style:{flexGrow:Math.max(s,0),flexBasis:0,minWidth:s>0?"2px":0,backgroundColor:"var(--color-border)"}})]}),(0,d.jsxs)("div",{className:"mt-1.5 flex flex-wrap items-center gap-x-4 gap-y-1 text-[0.6875rem] text-text-muted",title:T,children:[(0,d.jsxs)("span",{className:"flex items-center gap-1.5",children:[(0,d.jsx)("span",{className:"size-2 shrink-0 rounded-[2px]",style:{backgroundColor:"color-mix(in oklab, var(--color-primary) 30%, var(--color-surface))"},"aria-hidden":"true"}),(0,d.jsx)(K,{value:r-t,format:z,className:"tabular-nums text-text-main"}),"uncached input"]}),t>0?(0,d.jsxs)("span",{className:"flex items-center gap-1.5",children:[(0,d.jsx)("span",{className:"size-2 shrink-0 rounded-[2px]",style:{backgroundColor:"var(--color-primary)"},"aria-hidden":"true"}),(0,d.jsx)(K,{value:t,format:z,className:"tabular-nums text-text-main"}),"cached",(0,d.jsxs)("span",{className:"text-text-subtle",children:["(",G(U)," of input)"]})]}):null,(0,d.jsxs)("span",{className:"flex items-center gap-1.5",children:[(0,d.jsx)("span",{className:"size-2 shrink-0 rounded-[2px]",style:{backgroundColor:"var(--color-border)"},"aria-hidden":"true"}),(0,d.jsx)(K,{value:s,format:z,className:"tabular-nums text-text-main"}),"output",(0,d.jsxs)("span",{className:"text-text-subtle",children:["(",G(V)," of total)"]})]})]})]}):null,D?(0,d.jsxs)("p",{className:"mt-4 text-xs text-text-muted",children:[(0,d.jsx)("span",{className:"tabular-nums",children:y(u)})," requests served by"," ",N," provider",1===N?"":"s"," at no recorded cost — switch to ",(0,d.jsx)("span",{className:"font-medium text-text-main",children:"Tokens"})," to compare their share."]}):null,!D&&E&&B.length>0?(0,d.jsxs)("div",{className:"mt-4",children:[(0,d.jsx)("div",{className:"flex h-2.5 w-full overflow-hidden rounded-full bg-border-subtle",role:"group","aria-label":"Proporsi pemakaian per provider",children:B.map(a=>{let b=h===a.id;return(0,d.jsx)("button",{type:"button",onClick:()=>g?.(b?null:a.id),title:`${a.label} — ${G(a.pct)} \xb7 ${a.full}`,"aria-label":`${a.label}, ${G(a.pct)} of total, ${a.full}`,className:["h-full min-w-0 border-0 p-0 transition-opacity duration-200 cursor-pointer hover:opacity-80 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-white/70",h&&!b?"opacity-25":"opacity-100"].join(" "),style:{flexGrow:a.pct,flexBasis:0,minWidth:"4px",backgroundColor:j(a.id,"solid")}},a.id)})}),(0,d.jsx)("div",{className:"mt-2 flex flex-wrap items-center gap-x-4 gap-y-1",children:B.map(a=>{let b=h===a.id;return(0,d.jsxs)("button",{type:"button",onClick:()=>g?.(b?null:a.id),className:["flex items-center gap-1.5 text-xs transition-colors duration-150 cursor-pointer focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/45 rounded",b?"text-text-main font-medium":"text-text-muted hover:text-text-main"].join(" "),children:[(0,d.jsx)("span",{className:"size-2 shrink-0 rounded-full",style:{backgroundColor:j(a.id,"solid")},"aria-hidden":"true"}),(0,d.jsx)("span",{className:"max-w-[9rem] truncate",children:a.label}),(0,d.jsx)("span",{className:"tabular-nums text-text-subtle",children:0===a.pct&&a.requests>0?`${w(a.requests)} req`:G(a.pct)})]},a.id)})})]}):null,A?(0,d.jsxs)("div",{className:"mt-3 flex items-center gap-2 rounded-lg border border-danger/25 bg-danger/8 px-3 py-2",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[16px] text-danger","aria-hidden":"true",children:"error"}),(0,d.jsxs)("span",{className:"text-xs text-text-main",children:[(0,d.jsx)("span",{className:"font-medium",children:A})," failed a request just now"]})]}):null,(0,d.jsx)(M,{stats:a})]})}function M({stats:a}){let b=a?.last10Minutes||[],c=Math.max(1,...b.map(a=>a?.requests||0)),e=b.reduce((a,b)=>a+(b?.requests||0),0);return(0,d.jsxs)("div",{className:"mt-4 flex items-center gap-3",children:[(0,d.jsx)("span",{className:"shrink-0 text-[0.6875rem] font-medium uppercase tracking-wide text-text-subtle",children:"Live flow"}),(0,d.jsx)("div",{className:"flex h-5 min-w-0 flex-1 items-end gap-[3px]","aria-hidden":"true",children:b.length>0?b.map((a,b)=>{let e=a?.requests||0,f=e>0?Math.max(12,e/c*100):6;return(0,d.jsx)("span",{className:"min-w-0 flex-1 rounded-[2px] transition-[height] duration-500",style:{height:`${f}%`,backgroundColor:e>0?"var(--color-primary)":"var(--color-border)",opacity:e>0?.35+e/c*.65:1,transitionTimingFunction:"cubic-bezier(.2,.8,.2,1)"}},b)}):(0,d.jsx)("span",{className:"h-full w-full rounded-[2px] bg-border-subtle"})}),(0,d.jsx)("span",{className:"shrink-0 text-[0.6875rem] tabular-nums text-text-subtle",children:e>0?`${w(e)} req / 10m`:"idle"})]})}function N(a,b){if(!a)return"—";let c=b?.[a];return c||(a.length<=22?a:`${a.slice(0,14)}…`)}function O({stats:a,nodeNames:b={}}){let c=a?.activeRequests||[],f=(a?.recentRequests||[]).slice(0,8),g=c.reduce((a,b)=>a+(b.count||0),0),[h,i]=(0,e.useState)(()=>Date.now());return(0,d.jsxs)("section",{"aria-label":"Live requests",className:"min-w-0 rounded-[14px] border border-border bg-surface px-4 py-3",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)("span",{className:"relative flex size-2","aria-hidden":"true",children:g>0?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("span",{className:"absolute inline-flex h-full w-full animate-ping rounded-full bg-primary opacity-60"}),(0,d.jsx)("span",{className:"relative inline-flex size-2 rounded-full bg-primary"})]}):(0,d.jsx)("span",{className:"relative inline-flex size-2 rounded-full bg-border"})}),(0,d.jsx)("h3",{className:"text-xs font-semibold text-text-main",children:"Live"}),(0,d.jsx)("span",{className:"text-[0.6875rem] tabular-nums text-text-muted",children:g>0?`${g} running`:"idle"})]}),g>0?(0,d.jsx)("ul",{className:"mt-2 flex min-w-0 flex-col divide-y divide-border-subtle",children:c.map((a,c)=>{let e=a.inputEstimated?"~":"";return(0,d.jsxs)("li",{className:"flex min-w-0 items-baseline gap-3 py-1.5",children:[(0,d.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,d.jsx)("p",{className:"truncate text-xs font-medium text-text-main",title:a.model,children:a.model||"—"}),(0,d.jsxs)("p",{className:"truncate text-[0.6875rem] text-text-muted",children:[N(a.provider,b),a.account?` \xb7 ${a.account}`:""]})]}),(0,d.jsxs)("div",{className:"shrink-0 text-right",children:[(0,d.jsxs)("p",{className:"text-xs tabular-nums text-text-main",title:a.inputEstimated?"Estimated from request size — real count arrives with the first usage chunk":D(a.startedAt),children:[(0,d.jsx)("span",{className:"text-text-muted",children:"↓"})," ",e,(0,d.jsx)(K,{value:a.inputTokens,format:z})," ",(0,d.jsx)("span",{className:"text-text-muted",children:"↑"})," ",(0,d.jsx)(K,{value:a.outputTokens,format:z})]}),(0,d.jsx)("p",{className:"text-[0.6875rem] tabular-nums text-text-subtle",children:a.startedAt?(0,d.jsx)("time",{dateTime:a.startedAt,title:E(a.startedAt),children:function(a,b,c){let d=a?Date.parse(a):NaN,e=Number.isFinite(d)?Math.max(0,c-d):b;if(null==e||!Number.isFinite(e)||e<0)return"—";let f=Math.floor(e/1e3);if(f<60)return`${f}s`;let g=Math.floor(f/60);if(g<60)return`${g}m ${String(f%60).padStart(2,"0")}s`;let h=Math.floor(g/60);return h<24?`${h}h ${String(g%60).padStart(2,"0")}m`:`${Math.floor(h/24)}d ${h%24}h`}(a.startedAt,a.elapsedMs,h)}):"—"})]})]},`${a.model}|${a.provider}|${a.account}|${a.startedAt||"?"}|${c}`)})}):(0,d.jsx)("p",{className:"mt-1.5 text-xs text-text-muted",children:"No running requests — new ones appear here the moment they start."}),(0,d.jsxs)("div",{className:"mt-3 flex items-center gap-2 border-t border-border-subtle pt-3",children:[(0,d.jsx)("h3",{className:"text-xs font-semibold text-text-main",children:"Recent"}),(0,d.jsx)("span",{className:"text-[0.6875rem] text-text-muted",children:"latest finished requests"})]}),f.length>0?(0,d.jsx)("ul",{className:"mt-1.5 flex min-w-0 flex-col divide-y divide-border-subtle",children:f.map((a,c)=>(0,d.jsxs)("li",{className:"flex min-w-0 items-baseline gap-3 py-1.5",children:[(0,d.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,d.jsxs)("p",{className:"truncate text-xs text-text-main",title:a.model,children:[a.model||"—",(0,d.jsx)("span",{className:"ml-1.5 font-normal text-text-muted",children:N(a.provider,b)})]}),a.account?(0,d.jsx)("p",{className:"truncate text-[0.6875rem] text-text-subtle",children:a.account}):null]}),(0,d.jsxs)("p",{className:"shrink-0 text-xs tabular-nums text-text-muted",title:y(a.totalTokens),children:[(0,d.jsx)(K,{value:a.totalTokens,format:z})," tok"]}),(0,d.jsx)("p",{className:"w-16 shrink-0 text-right text-[0.6875rem] tabular-nums text-text-subtle",children:(0,d.jsx)("time",{dateTime:a.timestamp,title:`${E(a.timestamp)} — ${D(a.timestamp)}`,children:function(a,b){let c="number"==typeof a?a:Date.parse(a);if(!Number.isFinite(c))return"—";let d=Math.max(0,Math.floor((b-c)/1e3));if(d<60)return`${d}s ago`;let e=Math.floor(d/60);if(e<60)return`${e}m ago`;let f=Math.floor(e/60);return f<24?`${f}h ago`:`${Math.floor(f/24)}d ago`}(a.timestamp,h)})})]},`${a.timestamp}|${a.model}|${a.provider}|${a.totalTokens}|${c}`))}):(0,d.jsx)("p",{className:"mt-1.5 text-xs text-text-muted",children:"No finished requests recorded yet."})]})}function P({points:a,mode:b="costs",onPickDay:c=null}){let[f,g]=(0,e.useState)(null),h=a=>"tokens"===b?a.tokens:a.cost,{days:i,max:j,total:k,activeDays:l}=(0,e.useMemo)(()=>{let b=Array.isArray(a)?a:[],c=b.map(h);return{days:b,max:Math.max(0,...c),total:c.reduce((a,b)=>a+b,0),activeDays:c.filter(a=>a>0).length}},[a,b]);if(!i.length)return(0,d.jsxs)("div",{className:"flex min-w-0 flex-col gap-2",children:[(0,d.jsx)("p",{className:"text-xs font-medium uppercase tracking-wide text-text-muted",children:"Aktivitas"}),(0,d.jsx)("p",{className:"text-xs text-text-muted",children:"Belum ada data harian pada periode ini."})]});let m={kosong:{bg:"var(--color-border-subtle)"},rendah:{bg:"oklch(0.62 0.17 262 / 0.22)"},sedang:{bg:"oklch(0.62 0.17 262 / 0.45)"},tinggi:{bg:"oklch(0.62 0.17 262 / 0.70)"},puncak:{bg:"oklch(0.62 0.17 262 / 1)"}},n=a=>"tokens"===b?a.toLocaleString("en-US"):`$${Number(a).toFixed(2)}`,o=f?i[f]:null;return(0,d.jsxs)("div",{className:"flex min-w-0 flex-col gap-2",children:[(0,d.jsxs)("div",{className:"flex flex-wrap items-baseline justify-between gap-2",children:[(0,d.jsx)("h3",{className:"text-xs font-medium uppercase tracking-wide text-text-muted",children:"Aktivitas"}),(0,d.jsxs)("span",{className:"text-[10px] text-text-subtle",children:[l," dari ",i.length," hari terpakai"]})]}),(0,d.jsx)("div",{className:"flex flex-wrap gap-[3px]",onMouseLeave:()=>g(null),role:"img","aria-label":`Aktivitas harian selama ${i.length} hari. Hari terberat: ${n(j)}.`,children:i.map((a,b)=>{let e=(a=>{if(!a||a<=0)return"kosong";let b=j>0?a/j:0;return b>.75?"puncak":b>.5?"tinggi":b>.25?"sedang":"rendah"})(h(a));return(0,d.jsx)("button",{type:"button",onMouseEnter:()=>g(b),onFocus:()=>g(b),onBlur:()=>g(null),onClick:c?()=>c(a):void 0,className:"size-3 rounded-[3px] transition-transform hover:scale-125 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/45",style:{backgroundColor:m[e].bg},"aria-label":`${a.label}: ${n(h(a))}`},`${a.label}-${b}`)})}),(0,d.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,d.jsx)("p",{className:"min-w-0 flex-1 truncate text-[11px] text-text-muted",children:o?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("span",{className:"text-text-main",children:o.label})," \xb7 ",(0,d.jsx)("span",{className:"text-text-main",children:n(h(o))}),"tokens"!==b&&o.tokens?` \xb7 ${o.tokens.toLocaleString("en-US")} token`:null]}):(0,d.jsx)(d.Fragment,{children:"Pekatnya warna = besarnya pemakaian hari itu"})}),(0,d.jsxs)("div",{className:"flex shrink-0 items-center gap-1","aria-hidden":"true",children:[(0,d.jsx)("span",{className:"text-[10px] text-text-subtle",children:"ringan"}),["rendah","sedang","tinggi","puncak"].map(a=>(0,d.jsx)("span",{className:"size-2.5 rounded-[2px]",style:{backgroundColor:m[a].bg}},a)),(0,d.jsx)("span",{className:"text-[10px] text-text-subtle",children:"berat"})]})]})]})}function Q(a,b){let c=360;for(let d of b){let b=Math.abs(d-a);c=Math.min(c,Math.min(b,360-b))}return c}let R="cubic-bezier(.2,.8,.2,1)";function S({title:a,meta:b,count:c,countValue:f,countFormat:g,countSecondary:h,countSecondaryValue:i,countSecondaryFormat:j,accent:k=!1,depth:l=0,folded:m=!1,defaultOpen:n=!1,open:o,onOpenChange:p,children:q,actions:r}){let[s,t]=(0,e.useState)(n),u=void 0!==o,v=u?o:s,w=(0,e.useId)();return(0,d.jsxs)("section",{className:"min-w-0",style:{marginLeft:l>0?`${14*l}px`:void 0},children:[m?(0,d.jsx)("div",{className:"mb-1 ml-3 border-t border-border-subtle","aria-hidden":"true"}):null,(0,d.jsx)("h3",{className:"m-0",children:(0,d.jsxs)("button",{type:"button",onClick:()=>{let a=!v;u||t(a),p?.(a)},"aria-expanded":v,"aria-controls":w,className:["group flex w-full items-center gap-3 rounded-[10px] px-3 py-2.5 text-left transition-colors duration-150 hover:bg-bg-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/45",v?"bg-bg-subtle":"bg-transparent"].join(" "),children:[(0,d.jsx)("span",{className:"material-symbols-outlined shrink-0 text-[18px] text-text-subtle transition-transform",style:{transform:v?"rotate(90deg)":"rotate(0deg)",transitionDuration:"240ms",transitionTimingFunction:R},"aria-hidden":"true",children:"chevron_right"}),(0,d.jsx)("span",{className:["shrink-0 text-sm font-semibold tracking-tight",k?"text-primary":"text-text-main"].join(" "),children:a}),b?(0,d.jsx)("span",{className:"min-w-0 truncate text-xs text-text-muted",children:b}):null,(0,d.jsxs)("span",{className:"ml-auto flex shrink-0 items-center gap-2",children:[r?(0,d.jsx)("span",{onClick:a=>a.stopPropagation(),onKeyDown:a=>a.stopPropagation(),className:"flex items-center gap-1",children:r}):null,null!=c?(0,d.jsxs)("span",{className:"flex shrink-0 items-baseline gap-2 text-right",children:[h?null!=i&&j?(0,d.jsx)(K,{value:i,format:j,className:"text-xs tabular-nums text-text-subtle"}):(0,d.jsx)("span",{className:"text-xs tabular-nums text-text-subtle",children:h}):null,null!=f&&g?(0,d.jsx)(K,{value:f,format:g,className:"min-w-[4.5rem] text-right text-sm font-medium tabular-nums text-text-main"}):(0,d.jsx)("span",{className:"min-w-[4.5rem] text-right text-sm font-medium tabular-nums text-text-main",children:c})]}):null]})]})}),(0,d.jsx)("div",{id:w,className:"grid min-w-0",style:{gridTemplateRows:v?"1fr":"0fr",transition:`grid-template-rows 240ms ${R}`},children:(0,d.jsx)("div",{className:"min-w-0 overflow-hidden",children:(0,d.jsx)("div",{className:"pb-2 pl-[42px] pr-1 pt-1",children:q})})})]})}function T({label:a,sublabel:b,value:c,valueRaw:f,valueFormat:g,valueSecondary:h,valueSecondaryRaw:i,valueSecondaryFormat:j,detail:k,barValue:l,onSelect:m,selected:n=!1,status:o,trailing:p}){let q=(0,e.useId)(),r="error"===o?"var(--color-danger)":"active"===o?"var(--color-success)":null,s="function"==typeof m,t=(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("span",{className:"flex min-w-0 items-baseline gap-2",children:[r?(0,d.jsx)("span",{className:"size-1.5 shrink-0 translate-y-[-2px] rounded-full",style:{backgroundColor:r},"aria-hidden":"true"}):null,(0,d.jsx)("span",{className:"min-w-0 truncate text-sm text-text-main",children:a}),b?(0,d.jsx)("span",{className:"min-w-0 shrink truncate text-xs text-text-subtle",children:b}):null]}),(0,d.jsx)("span",{className:"relative mt-1.5 block h-[3px] w-full overflow-hidden rounded-full bg-border-subtle",children:null!=l?(0,d.jsx)("span",{className:"absolute inset-y-0 left-0 rounded-full transition-[width] duration-500",style:{width:`${Math.max(l,1.5*(l>0))}%`,backgroundColor:"error"===o?"var(--color-danger)":"var(--color-primary)",transitionTimingFunction:R}}):null}),(0,d.jsxs)("span",{className:"ml-auto flex shrink-0 items-baseline gap-2 pl-3",children:[p,(0,d.jsxs)("span",{className:"flex min-w-[4.5rem] items-baseline justify-end gap-2 text-right",children:[h?null!=i&&j?(0,d.jsx)(K,{value:i,format:j,className:"text-xs tabular-nums text-text-subtle"}):(0,d.jsx)("span",{className:"text-xs tabular-nums text-text-subtle",children:h}):null,(0,d.jsx)("span",{className:["rounded-sm focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/45",k?"cursor-help underline decoration-dotted decoration-text-subtle/60 underline-offset-4":""].join(" "),tabIndex:k?0:void 0,title:k||void 0,"aria-describedby":k?q:void 0,children:null!=f&&g?(0,d.jsx)(K,{value:f,format:g,className:"text-sm font-medium tabular-nums text-text-main"}):(0,d.jsx)("span",{className:"value-fade text-sm font-medium tabular-nums text-text-main",children:c},String(c))}),k?(0,d.jsx)("span",{id:q,className:"sr-only",children:k}):null]})]})]});return s?(0,d.jsx)("button",{type:"button",onClick:m,"aria-pressed":n,className:["flex w-full min-w-0 items-start gap-2 rounded-lg px-2 py-2 text-left transition-colors duration-150 hover:bg-bg-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/45",n?"bg-primary/8 ring-1 ring-inset ring-primary/25":""].join(" "),children:t}):(0,d.jsx)("div",{className:"flex min-w-0 items-start gap-2 rounded-lg px-2 py-2",children:t})}function U({query:a,onQueryChange:b,activeFilter:c,onClearFilter:f,resultCount:g,totalCount:h}){let i=(0,e.useRef)(null),j=a.trim().length>0;return(0,d.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,d.jsxs)("div",{className:"relative min-w-0 flex-1 sm:max-w-xs",children:[(0,d.jsx)("span",{className:"material-symbols-outlined pointer-events-none absolute left-2.5 top-1/2 -translate-y-1/2 text-[16px] text-text-subtle","aria-hidden":"true",children:"search"}),(0,d.jsx)("input",{ref:i,type:"search",value:a,onChange:a=>b(a.target.value),placeholder:"Search provider, model, account…","aria-label":"Search usage across all dimensions",className:"w-full rounded-lg border border-border bg-surface py-1.5 pl-8 pr-8 text-sm text-text-main placeholder:text-text-subtle transition-colors duration-150 hover:border-text-subtle/40 focus:border-primary/60 focus:outline-none focus:ring-2 focus:ring-primary/25"}),j?(0,d.jsx)("button",{type:"button",onClick:()=>{b(""),i.current?.focus()},"aria-label":"Clear search",className:"absolute right-2 top-1/2 flex -translate-y-1/2 items-center rounded p-0.5 text-text-subtle transition-colors hover:text-text-main focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/45",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-[16px]","aria-hidden":"true",children:"close"})}):(0,d.jsx)("kbd",{className:"pointer-events-none absolute right-2.5 top-1/2 hidden -translate-y-1/2 rounded border border-border px-1.5 text-[10px] font-medium text-text-subtle sm:block","aria-hidden":"true",children:"/"})]}),c?(0,d.jsxs)("button",{type:"button",onClick:f,className:"flex items-center gap-1.5 rounded-lg border border-primary/30 bg-primary/8 px-2.5 py-1.5 text-xs font-medium text-primary transition-colors hover:bg-primary/15 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/45",title:"Remove provider filter",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px]","aria-hidden":"true",children:"filter_alt"}),(0,d.jsx)("span",{className:"max-w-[10rem] truncate",children:c}),(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px]","aria-hidden":"true",children:"close"})]}):null,j||c?(0,d.jsxs)("span",{className:"text-xs tabular-nums text-text-muted",role:"status","aria-live":"polite",children:[g," of ",h]}):null]})}var V=c(48679),W=c(85165),X=c(5277),Y=c(22393),Z=c(54206),$=c(96317),_=c(66355),aa=c(99314),ab=c(91184),ac=c(76316),ad=c(40948),ae=c(56280),af=c(16216),ag=c(1791);function ah(a,b){var c=Object.keys(a);if(Object.getOwnPropertySymbols){var d=Object.getOwnPropertySymbols(a);b&&(d=d.filter(function(b){return Object.getOwnPropertyDescriptor(a,b).enumerable})),c.push.apply(c,d)}return c}function ai(a){for(var b=1;b<arguments.length;b++){var c=null!=arguments[b]?arguments[b]:{};b%2?ah(Object(c),!0).forEach(function(b){var d,e,f;d=a,e=b,f=c[b],(e=function(a){var b=function(a,b){if("object"!=typeof a||!a)return a;var c=a[Symbol.toPrimitive];if(void 0!==c){var d=c.call(a,b||"default");if("object"!=typeof d)return d;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===b?String:Number)(a)}(a,"string");return"symbol"==typeof b?b:b+""}(e))in d?Object.defineProperty(d,e,{value:f,enumerable:!0,configurable:!0,writable:!0}):d[e]=f}):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(c)):ah(Object(c)).forEach(function(b){Object.defineProperty(a,b,Object.getOwnPropertyDescriptor(c,b))})}return a}var aj=["Webkit","Moz","O","ms"],ak=c(62554),al=(0,e.createContext)(()=>{}),am=c(32671),an=c(41125);c(14277);var ao=c(70383),ap=c(90170),aq=c(96129),ar=c(69599),as=c(70719);function at(){return(at=Object.assign?Object.assign.bind():function(a){for(var b=1;b<arguments.length;b++){var c=arguments[b];for(var d in c)({}).hasOwnProperty.call(c,d)&&(a[d]=c[d])}return a}).apply(null,arguments)}function au(a,b){var c=Object.keys(a);if(Object.getOwnPropertySymbols){var d=Object.getOwnPropertySymbols(a);b&&(d=d.filter(function(b){return Object.getOwnPropertyDescriptor(a,b).enumerable})),c.push.apply(c,d)}return c}function av(a){for(var b=1;b<arguments.length;b++){var c=null!=arguments[b]?arguments[b]:{};b%2?au(Object(c),!0).forEach(function(b){aw(a,b,c[b])}):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(c)):au(Object(c)).forEach(function(b){Object.defineProperty(a,b,Object.getOwnPropertyDescriptor(c,b))})}return a}function aw(a,b,c){var d;return(b="symbol"==typeof(d=function(a,b){if("object"!=typeof a||!a)return a;var c=a[Symbol.toPrimitive];if(void 0!==c){var d=c.call(a,b||"default");if("object"!=typeof d)return d;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===b?String:Number)(a)}(b,"string"))?d:d+"")in a?Object.defineProperty(a,b,{value:c,enumerable:!0,configurable:!0,writable:!0}):a[b]=c,a}function ax(a){var b=a.x,c=a.y,d=a.width,f=a.height,g=a.stroke,h=Math.floor(c+f/2)-1;return e.createElement(e.Fragment,null,e.createElement("rect",{x:b,y:c,width:d,height:f,fill:g,stroke:"none"}),e.createElement("line",{x1:b+1,y1:h,x2:b+d-1,y2:h,fill:"none",stroke:"#fff"}),e.createElement("line",{x1:b+1,y1:h+2,x2:b+d-1,y2:h+2,fill:"none",stroke:"#fff"}))}function ay(a){var b=a.travellerProps,c=a.travellerType;return e.isValidElement(c)?e.cloneElement(c,b):"function"==typeof c?c(b):e.createElement(ax,b)}function az(a){if((0,ag.n9)(a)&&"object"==typeof a&&"name"in a&&"string"==typeof a.name)return a.name}function aA(a){var b,c,d=a.otherProps,f=a.travellerX,g=a.id,h=a.onMouseEnter,i=a.onMouseLeave,j=a.onMouseDown,k=a.onTouchStart,l=a.onTravellerMoveKeyboard,m=a.onFocus,n=a.onBlur,o=d.y,p=d.x,q=d.travellerWidth,r=d.height,s=d.traveller,t=d.ariaLabel,u=d.data,v=d.startIndex,w=d.endIndex,x=Math.max(f,p),y=av(av({},(0,as.uZ)(d)),{},{x,y:o,width:q,height:r}),z=t||(b=az(u[v]),c=az(u[w]),"Min value: ".concat(b,", Max value: ").concat(c));return e.createElement(ad.W,{tabIndex:0,role:"slider","aria-label":z,"aria-valuenow":f,className:"recharts-brush-traveller",onMouseEnter:h,onMouseLeave:i,onMouseDown:j,onTouchStart:k,onKeyDown:a=>{["ArrowLeft","ArrowRight"].includes(a.key)&&(a.preventDefault(),a.stopPropagation(),l("ArrowRight"===a.key?1:-1,g))},onFocus:m,onBlur:n,style:{cursor:"col-resize"}},e.createElement(ay,{travellerType:s,travellerProps:y}))}function aB(a){var b=a.index,c=a.data,d=a.tickFormatter,e=a.dataKey,f=(0,af.kr)(c[b],e,b);return"function"==typeof d?d(f,b):f}function aC(a,b){for(var c=a.length,d=0,e=c-1;e-d>1;){var f=Math.floor((d+e)/2),g=a[f];null!=g&&g>b?e=f:d=f}var h=a[e];return null!=h&&b>=h?e:d}function aD(a){var b=a.startX,c=a.endX,d=a.scaleValues,e=a.gap,f=a.data.length-1,g=Math.min(b,c),h=Math.max(b,c),i=aC(d,g),j=aC(d,h);return{startIndex:i-i%e,endIndex:j===f?f:j-j%e}}function aE(a){var b=a.x,c=a.y,d=a.width,f=a.height,g=a.fill,h=a.stroke;return e.createElement("rect",{stroke:h,fill:g,x:b,y:c,width:d,height:f})}function aF(a){var b=a.startIndex,c=a.endIndex,d=a.y,f=a.height,g=a.travellerWidth,h=a.stroke,i=a.tickFormatter,j=a.dataKey,k=a.data,l=a.startX,m=a.endX,n={pointerEvents:"none",fill:h};return e.createElement(ad.W,{className:"recharts-brush-texts"},e.createElement(ae.EY,at({textAnchor:"end",verticalAnchor:"middle",x:Math.min(l,m)-5,y:d+f/2},n),aB({index:b,tickFormatter:i,dataKey:j,data:k})),e.createElement(ae.EY,at({textAnchor:"start",verticalAnchor:"middle",x:Math.max(l,m)+g+5,y:d+f/2},n),aB({index:c,tickFormatter:i,dataKey:j,data:k})))}function aG(a){var b=a.y,c=a.height,d=a.stroke,f=a.travellerWidth,g=a.startX,h=a.endX,i=a.onMouseEnter,j=a.onMouseLeave,k=a.onMouseDown,l=a.onTouchStart,m=Math.min(g,h)+f,n=Math.max(Math.abs(h-g)-f,0);return e.createElement("rect",{className:"recharts-brush-slide",onMouseEnter:i,onMouseLeave:j,onMouseDown:k,onTouchStart:l,style:{cursor:"move"},stroke:"none",fill:d,fillOpacity:.2,x:m,y:b,width:n,height:c})}function aH(a){var b=a.x,c=a.y,d=a.width,f=a.height,g=a.data,h=a.children,i=a.padding;if(1!==e.Children.count(h))return null;var j=e.Children.only(h);return j?e.cloneElement(j,{x:b,y:c,width:d,height:f,margin:i,compact:!0,data:g}):null}var aI=a=>a.changedTouches&&!!a.changedTouches.length;class aJ extends e.PureComponent{constructor(a){super(a),aw(this,"handleDrag",a=>{this.leaveTimer&&(clearTimeout(this.leaveTimer),this.leaveTimer=null),this.state.isTravellerMoving?this.handleTravellerMove(a):this.state.isSlideMoving&&this.handleSlideDrag(a)}),aw(this,"handleTouchMove",a=>{var b,c=null==(b=a.changedTouches)?void 0:b[0];null!=c&&this.handleDrag(c)}),aw(this,"handleDragEnd",()=>{this.setState({isTravellerMoving:!1,isSlideMoving:!1},()=>{var a=this.props,b=a.endIndex,c=a.onDragEnd,d=a.startIndex;null==c||c({endIndex:b,startIndex:d})}),this.detachDragEndListener()}),aw(this,"handleLeaveWrapper",()=>{(this.state.isTravellerMoving||this.state.isSlideMoving)&&(this.leaveTimer=window.setTimeout(this.handleDragEnd,this.props.leaveTimeOut))}),aw(this,"handleEnterSlideOrTraveller",()=>{this.setState({isTextActive:!0})}),aw(this,"handleLeaveSlideOrTraveller",()=>{this.setState({isTextActive:!1})}),aw(this,"handleSlideDragStart",a=>{var b=aI(a)?a.changedTouches[0]:a;null!=b&&(this.setState({isTravellerMoving:!1,isSlideMoving:!0,slideMoveStartX:b.pageX}),this.attachDragEndListener())}),aw(this,"handleTravellerMoveKeyboard",(a,b)=>{var c=this.props,d=c.data,e=c.gap,f=c.startIndex,g=c.endIndex,h=this.state,i=h.scaleValues,j=h.startX,k=h.endX;if(null==i)return;var l=-1;if("startX"===b?l=f:"endX"===b&&(l=g),!(l<0)&&!(l>=d.length)){var m=l+a;if(-1!==m&&!(m>=i.length)){var n=i[m];null==n||"startX"===b&&n>=k||"endX"===b&&n<=j||this.setState({[b]:n},()=>{this.props.onChange(aD({startX:this.state.startX,endX:this.state.endX,data:d,gap:e,scaleValues:i}))})}}}),this.travellerDragStartHandlers={startX:this.handleTravellerDragStart.bind(this,"startX"),endX:this.handleTravellerDragStart.bind(this,"endX")},this.state={brushMoveStartX:0,movingTravellerId:void 0,endX:0,startX:0,slideMoveStartX:0}}static getDerivedStateFromProps(a,b){var c=a.data,d=a.width,e=a.x,f=a.travellerWidth,g=a.startIndex,h=a.endIndex,i=a.startIndexControlledFromProps,j=a.endIndexControlledFromProps;if(c!==b.prevData)return av({prevData:c,prevTravellerWidth:f,prevX:e,prevWidth:d,prevStartIndexControlledFromProps:i,prevEndIndexControlledFromProps:j},c&&c.length?(a=>{var b=a.data,c=a.startIndex,d=a.endIndex,e=a.x,f=a.width,g=a.travellerWidth;if(!b||!b.length)return{};var h=b.length,i=(0,ab.z)().domain((0,ac.y)(0,h)).range([e,e+f-g]),j=i.domain().map(a=>i(a)).filter(ag.n9);return{isTextActive:!1,isSlideMoving:!1,isTravellerMoving:!1,isTravellerFocused:!1,startX:i(c),endX:i(d),scale:i,scaleValues:j}})({data:c,width:d,x:e,travellerWidth:f,startIndex:g,endIndex:h}):{scale:void 0,scaleValues:void 0});var k=b.scale;if(k&&(d!==b.prevWidth||e!==b.prevX||f!==b.prevTravellerWidth)){k.range([e,e+d-f]);var l=k.domain().map(a=>k(a)).filter(a=>null!=a);return{prevData:c,prevTravellerWidth:f,prevX:e,prevWidth:d,startX:k(a.startIndex),endX:k(a.endIndex),scaleValues:l}}if(b.scale&&!b.isSlideMoving&&!b.isTravellerMoving&&!b.isTravellerFocused&&!b.isTextActive){if(null!=i&&b.prevStartIndexControlledFromProps!==i)return{startX:b.scale(i),prevStartIndexControlledFromProps:i};if(null!=j&&b.prevEndIndexControlledFromProps!==j)return{endX:b.scale(j),prevEndIndexControlledFromProps:j}}return null}componentWillUnmount(){this.leaveTimer&&(clearTimeout(this.leaveTimer),this.leaveTimer=null),this.detachDragEndListener()}attachDragEndListener(){window.addEventListener("mouseup",this.handleDragEnd,!0),window.addEventListener("touchend",this.handleDragEnd,!0),window.addEventListener("mousemove",this.handleDrag,!0)}detachDragEndListener(){window.removeEventListener("mouseup",this.handleDragEnd,!0),window.removeEventListener("touchend",this.handleDragEnd,!0),window.removeEventListener("mousemove",this.handleDrag,!0)}handleSlideDrag(a){var b=this.state,c=b.slideMoveStartX,d=b.startX,e=b.endX,f=b.scaleValues;if(null!=f){var g=this.props,h=g.x,i=g.width,j=g.travellerWidth,k=g.startIndex,l=g.endIndex,m=g.onChange,n=g.data,o=g.gap,p=a.pageX-c;p>0?p=Math.min(p,h+i-j-e,h+i-j-d):p<0&&(p=Math.max(p,h-d,h-e));var q=aD({startX:d+p,endX:e+p,data:n,gap:o,scaleValues:f});(q.startIndex!==k||q.endIndex!==l)&&m&&m(q),this.setState({startX:d+p,endX:e+p,slideMoveStartX:a.pageX})}}handleTravellerDragStart(a,b){var c=aI(b)?b.changedTouches[0]:b;null!=c&&(this.setState({isSlideMoving:!1,isTravellerMoving:!0,movingTravellerId:a,brushMoveStartX:c.pageX}),this.attachDragEndListener())}handleTravellerMove(a){var b=this.state,c=b.brushMoveStartX,d=b.movingTravellerId,e=b.endX,f=b.startX,g=b.scaleValues;if(null!=d&&null!=g){var h=this.state[d],i=this.props,j=i.x,k=i.width,l=i.travellerWidth,m=i.onChange,n=i.gap,o=i.data,p={startX:this.state.startX,endX:this.state.endX,data:o,gap:n,scaleValues:g},q=a.pageX-c;q>0?q=Math.min(q,j+k-l-h):q<0&&(q=Math.max(q,j-h)),p[d]=h+q;var r=aD(p),s=r.startIndex,t=r.endIndex;this.setState({[d]:h+q,brushMoveStartX:a.pageX},()=>{var a;m&&(a=o.length-1,"startX"===d&&(e>f?s%n==0:t%n==0)||e<f&&t===a||"endX"===d&&(e>f?t%n==0:s%n==0)||e>f&&t===a||0)&&m(r)})}}render(){var a=this.props,b=a.data,c=a.className,d=a.children,f=a.x,g=a.y,h=a.dy,i=a.width,j=a.height,k=a.alwaysShowText,l=a.fill,m=a.stroke,n=a.startIndex,o=a.endIndex,p=a.travellerWidth,q=a.tickFormatter,r=a.dataKey,s=a.padding,t=this.state,u=t.startX,v=t.endX,w=t.isTextActive,x=t.isSlideMoving,y=t.isTravellerMoving,z=t.isTravellerFocused;if(!b||!b.length||!(0,ag.Et)(f)||!(0,ag.Et)(g)||!(0,ag.Et)(i)||!(0,ag.Et)(j)||i<=0||j<=0)return null;var A=(0,aa.$)("recharts-brush",c),B=((a,b)=>{if(a){var c=a.replace(/(\w)/,a=>a.toUpperCase()),d=aj.reduce((a,d)=>ai(ai({},a),{},{[d+c]:b}),{});return d[a]=b,d}})("userSelect","none"),C=g+(null!=h?h:0);return e.createElement(ad.W,{className:A,onMouseLeave:this.handleLeaveWrapper,onTouchMove:this.handleTouchMove,style:B},e.createElement(aE,{x:f,y:C,width:i,height:j,fill:l,stroke:m}),e.createElement(ao.U,null,e.createElement(aH,{x:f,y:C,width:i,height:j,data:b,padding:s},d)),e.createElement(aG,{y:C,height:j,stroke:m,travellerWidth:p,startX:u,endX:v,onMouseEnter:this.handleEnterSlideOrTraveller,onMouseLeave:this.handleLeaveSlideOrTraveller,onMouseDown:this.handleSlideDragStart,onTouchStart:this.handleSlideDragStart}),e.createElement(aA,{travellerX:u,id:"startX",otherProps:av(av({},this.props),{},{y:C}),onMouseEnter:this.handleEnterSlideOrTraveller,onMouseLeave:this.handleLeaveSlideOrTraveller,onMouseDown:this.travellerDragStartHandlers.startX,onTouchStart:this.travellerDragStartHandlers.startX,onTravellerMoveKeyboard:this.handleTravellerMoveKeyboard,onFocus:()=>{this.setState({isTravellerFocused:!0})},onBlur:()=>{this.setState({isTravellerFocused:!1})}}),e.createElement(aA,{travellerX:v,id:"endX",otherProps:av(av({},this.props),{},{y:C}),onMouseEnter:this.handleEnterSlideOrTraveller,onMouseLeave:this.handleLeaveSlideOrTraveller,onMouseDown:this.travellerDragStartHandlers.endX,onTouchStart:this.travellerDragStartHandlers.endX,onTravellerMoveKeyboard:this.handleTravellerMoveKeyboard,onFocus:()=>{this.setState({isTravellerFocused:!0})},onBlur:()=>{this.setState({isTravellerFocused:!1})}}),(w||x||y||z||k)&&e.createElement(aF,{startIndex:n,endIndex:o,y:C,height:j,travellerWidth:p,stroke:m,tickFormatter:q,dataKey:r,data:b,startX:u,endX:v}))}}function aK(a){var b=(0,am.j)(),c=(0,ak.Oo)(),d=(0,ak.eE)(),f=(0,e.useContext)(al),g=a.onChange,h=a.startIndex,i=a.endIndex;(0,aq.fx)();var j=(0,e.useCallback)(a=>{if(null!=d){var c=d.startIndex,e=d.endIndex;(a.startIndex!==c||a.endIndex!==e)&&(null==f||f(a),null==g||g(a),b((0,an.M)(a)))}},[g,f,b,d]),k=(0,am.G)(ap.U);if(null==k||null==d||null==c||!c.length)return null;var l=d.startIndex,m=d.endIndex,n=k.x,o=k.y,p=k.width;return e.createElement(aJ,at({},a,{data:c,x:n,y:o,width:p,startIndex:l,endIndex:m,onChange:j},{startIndexControlledFromProps:null!=h?h:void 0,endIndexControlledFromProps:null!=i?i:void 0}))}function aL(a){return(0,am.j)(),null}var aM={height:40,travellerWidth:5,gap:1,fill:"#fff",stroke:"#666",padding:{top:1,right:1,bottom:1,left:1},leaveTimeOut:1e3,alwaysShowText:!1};function aN(a){var b=(0,ar.e)(a,aM);return e.createElement(e.Fragment,null,e.createElement(aL,{height:b.height,x:b.x,y:b.y,width:b.width,padding:b.padding}),e.createElement(aK,b))}function aO({period:a,mode:b}){let[c,f]=(0,e.useState)([]),[g,h]=(0,e.useState)(null),[i,j]=(0,e.useState)(null),k=g!==a,l=i?.period===a?i:null,m="tokens"===b?"tokens":"cost",n="tokens"===b?w:x,o="tokens"===b?A:x,p=c.some(a=>(a?.[m]||0)>0),q=(0,e.useMemo)(()=>l?c.slice(l.startIndex,l.endIndex+1):c,[c,l]),r=(0,e.useMemo)(()=>{if(0===q.length)return null;let a=0,b={value:0,label:null};for(let c of q){let d=c?.[m]||0;a+=d,d>b.value&&(b={value:d,label:c.label})}return{sum:a,peak:b,count:q.length}},[q,m]),s=(0,e.useMemo)(()=>{let a=-1,b=0;return c.forEach((c,d)=>{let e=c?.[m]||0;e>b&&(b=e,a=d)}),b>0?a:-1},[c,m]),t="var(--color-primary)";return(0,d.jsxs)("section",{className:"min-w-0","aria-label":"Usage over time",children:[(0,d.jsxs)("div",{className:"flex flex-wrap items-center gap-3",children:[(0,d.jsx)("h3",{className:"text-sm font-semibold tracking-tight text-text-main",children:"Flow"}),r?(0,d.jsxs)("span",{className:"text-xs text-text-muted",children:[(0,d.jsx)("span",{className:"tabular-nums text-text-main",children:o(r.sum)})," ","tokens"===b?"tokens":"spent",l?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("span",{className:"mx-1.5 text-text-subtle",children:"\xb7"}),(0,d.jsxs)("span",{children:[q[0]?.label,"–",q[q.length-1]?.label]})]}):null,r.peak.value>0?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("span",{className:"mx-1.5 text-text-subtle",children:"\xb7"}),(0,d.jsxs)("span",{children:["peak ",(0,d.jsx)("span",{className:"tabular-nums text-text-main",children:r.peak.label})]})]}):null]}):null,(0,d.jsxs)("div",{className:"ml-auto flex items-center gap-2",children:[l?(0,d.jsx)("button",{type:"button",onClick:()=>j(null),className:"rounded-md px-2 py-0.5 text-xs text-text-muted transition-colors hover:bg-bg-hover hover:text-text-main focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/45",children:"Reset range"}):null,s>=0?(0,d.jsxs)("button",{type:"button",onClick:()=>j({period:a,startIndex:Math.max(0,s-1),endIndex:Math.min(c.length-1,s+1)}),className:"flex items-center gap-1 rounded-md px-2 py-0.5 text-xs text-text-muted transition-colors hover:bg-bg-hover hover:text-text-main focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/45",title:`Zoom to peak (${c[s]?.label})`,children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px]","aria-hidden":"true",children:"zoom_in"}),"Peak"]}):null]})]}),(0,d.jsx)("div",{className:"mt-3",style:{height:200},children:k?(0,d.jsx)("div",{className:"flex h-full items-center justify-center text-text-subtle",children:(0,d.jsx)("span",{className:"material-symbols-outlined animate-spin text-[24px]","aria-hidden":"true",children:"progress_activity"})}):p?(0,d.jsx)(V.u,{width:"100%",height:"100%",children:(0,d.jsxs)(W.Q,{data:c,margin:{top:4,right:4,bottom:0,left:-12},children:[(0,d.jsx)("defs",{children:(0,d.jsxs)("linearGradient",{id:"flowFill",x1:"0",y1:"0",x2:"0",y2:"1",children:[(0,d.jsx)("stop",{offset:"0%",stopColor:t,stopOpacity:.18}),(0,d.jsx)("stop",{offset:"100%",stopColor:t,stopOpacity:.02})]})}),(0,d.jsx)(X.d,{strokeDasharray:"2 4",strokeOpacity:.12,vertical:!1}),(0,d.jsx)(Y.W,{dataKey:"label",tick:{fontSize:11,fill:"var(--color-text-subtle)"},tickLine:!1,axisLine:!1,minTickGap:24}),(0,d.jsx)(Z.h,{tick:{fontSize:11,fill:"var(--color-text-subtle)"},tickLine:!1,axisLine:!1,width:52,tickFormatter:a=>n(a)}),(0,d.jsx)($.m,{isAnimationActive:!0,animationDuration:120,animationEasing:"ease-out",cursor:{stroke:"var(--color-border)",strokeWidth:1,style:{transition:"transform 120ms cubic-bezier(.2,.8,.2,1)"}},content:({active:a,payload:c,label:e})=>{if(!a||!c?.length)return null;let f=c[0]?.value||0;return(0,d.jsxs)("div",{className:"rounded-lg border border-border bg-surface px-2.5 py-1.5 shadow-[var(--shadow-elevated)]",children:[(0,d.jsx)("div",{className:"text-[11px] text-text-subtle",children:e}),(0,d.jsxs)("div",{className:"text-sm font-medium tabular-nums text-text-main",children:[o(f)," ","tokens"===b?"tokens":""]})]})}}),(0,d.jsx)(_.Gk,{type:"monotone",dataKey:m,stroke:t,strokeWidth:2,fill:"url(#flowFill)",dot:!1,activeDot:{r:4,strokeWidth:0,style:{transition:"r 120ms cubic-bezier(.2,.8,.2,1)"}},isAnimationActive:!0,animationDuration:400,animationEasing:"ease-out"}),c.length>=8?(0,d.jsx)(aN,{dataKey:"label",height:22,travellerWidth:8,stroke:"var(--color-border)",fill:"var(--color-bg-subtle)",onChange:b=>{"number"==typeof b?.startIndex&&"number"==typeof b?.endIndex&&j({period:a,startIndex:b.startIndex,endIndex:b.endIndex})}}):null]})}):(0,d.jsxs)("div",{className:"flex h-full flex-col items-center justify-center gap-1 text-text-muted",children:[(0,d.jsx)("span",{className:"text-sm",children:"No activity in this period."}),(0,d.jsx)("span",{className:"text-xs text-text-subtle",children:"The chart fills as requests flow through the gateway."})]})})]})}function aP({provider:a,model:b,period:c}){let f=`${a||""}::${b||""}::${c||""}`,[g,h]=(0,e.useState)({key:f,page:1}),i=g.key===f?g.page:1,j=a=>h(b=>{let c=b.key===f?b.page:1;return{key:f,page:"function"==typeof a?a(c):a}}),[k,l]=(0,e.useState)({status:"loading",details:[],pagination:null});if("loading"===k.status)return(0,d.jsx)("div",{className:"flex flex-col gap-1.5 py-2","aria-busy":"true",children:[0,1,2].map(a=>(0,d.jsx)("div",{className:"h-9 animate-pulse rounded-lg bg-border-subtle/60"},a))});if("error"===k.status)return(0,d.jsx)("p",{className:"px-2 py-3 text-xs text-text-muted",children:"Could not load requests for this row."});if(0===k.details.length)return(0,d.jsx)("p",{className:"px-2 py-3 text-xs text-text-muted",children:"No individual requests recorded for this row in the selected period."});let{pagination:m}=k,n=m?.totalPages||1;return(0,d.jsxs)("div",{className:"flex min-w-0 flex-col",children:[(0,d.jsx)("div",{className:"max-h-80 min-w-0 overflow-y-auto rounded-lg border border-border-subtle",children:(0,d.jsxs)("table",{className:"w-full text-left text-xs",children:[(0,d.jsxs)("caption",{className:"sr-only",children:["Individual requests ",a?`for ${a}`:""," ",b?`on ${b}`:""]}),(0,d.jsx)("thead",{className:"sticky top-0 z-10 bg-bg-subtle text-[10px] uppercase tracking-wide text-text-muted",children:(0,d.jsxs)("tr",{children:[(0,d.jsx)("th",{scope:"col",className:"px-3 py-2 font-medium",children:"When"}),(0,d.jsx)("th",{scope:"col",className:"px-3 py-2 font-medium",children:"Status"}),(0,d.jsx)("th",{scope:"col",className:"px-3 py-2 text-right font-medium",children:"Tokens"}),(0,d.jsx)("th",{scope:"col",className:"px-3 py-2 text-right font-medium",children:"Latency"})]})}),(0,d.jsx)("tbody",{className:"divide-y divide-border-subtle",children:k.details.map((a,b)=>{let c,e,f,g=!a.status||"success"===a.status||200===a.status,h=(e=(c=a?.tokens||{}).prompt_tokens||c.input_tokens||0,(e<(f=c.cached_tokens||c.cache_read_input_tokens||0)?f:e)+(c.completion_tokens||c.output_tokens||0)),i=a.latency?.total||0;return(0,d.jsxs)("tr",{className:"transition-colors hover:bg-bg-hover",children:[(0,d.jsx)("td",{className:"whitespace-nowrap px-3 py-2 text-text-muted",children:(0,d.jsx)("time",{dateTime:a.timestamp,title:`${E(a.timestamp)} — ${D(a.timestamp)}`,children:function(a){if(!a)return"—";let b="number"==typeof a?a:Date.parse(a);if(!Number.isFinite(b))return"—";let c=Date.now()-b;return c<0?"—":c<45e3?"now":c<36e5?`${Math.floor(c/6e4)}m`:c<864e5?`${Math.floor(c/36e5)}h`:`${Math.floor(c/864e5)}d`}(a.timestamp)})}),(0,d.jsx)("td",{className:"px-3 py-2",children:(0,d.jsxs)("span",{className:"inline-flex items-center gap-1.5",title:a.errorMessage||a.error||void 0,children:[(0,d.jsx)("span",{className:"size-1.5 shrink-0 rounded-full",style:{backgroundColor:g?"var(--color-success)":"var(--color-danger)"},"aria-hidden":"true"}),(0,d.jsx)("span",{className:g?"text-text-muted":"text-danger",children:g?"ok":a.status||"error"})]})}),(0,d.jsx)("td",{className:"whitespace-nowrap px-3 py-2 text-right tabular-nums text-text-muted",children:h?y(h):"—"}),(0,d.jsx)("td",{className:"px-3 py-2 text-right tabular-nums text-text-muted",children:i?`${y(i)} ms`:"—"})]},a.id??`${a.timestamp}-${b}`)})})]})}),n>1?(0,d.jsxs)("div",{className:"mt-2 flex items-center justify-between text-xs text-text-muted",children:[(0,d.jsxs)("span",{className:"tabular-nums",children:["Page ",i," of ",n]}),(0,d.jsxs)("div",{className:"flex items-center gap-1",children:[(0,d.jsx)("button",{type:"button",onClick:()=>j(a=>Math.max(1,a-1)),disabled:i<=1,className:"rounded-md px-2 py-1 font-medium transition-colors hover:bg-bg-hover hover:text-text-main disabled:cursor-not-allowed disabled:opacity-40 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/45",children:"Previous"}),(0,d.jsx)("button",{type:"button",onClick:()=>j(a=>Math.min(n,a+1)),disabled:i>=n,className:"rounded-md px-2 py-1 font-medium transition-colors hover:bg-bg-hover hover:text-text-main disabled:cursor-not-allowed disabled:opacity-40 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/45",children:"Next"})]})]}):null]})}aN.displayName="Brush";let aQ=[{id:"provider",title:"Providers",key:"byProvider",groupBy:null},{id:"model",title:"Models",key:"byModel",groupBy:"rawModel"},{id:"account",title:"Accounts",key:"byAccount",groupBy:"accountName"},{id:"endpoint",title:"Endpoints",key:"byEndpoint",groupBy:"endpoint"}];function aR({period:a,stats:b,live:c=null,loading:g,onRetry:i,nodeNames:j={}}){let k=(0,f.useRouter)(),l=(0,f.useSearchParams)(),[m,n]=(0,e.useState)("costs"),[o,p]=(0,e.useState)(""),[q,r]=(0,e.useState)(()=>new Set(["provider"])),s=(0,e.useCallback)(a=>{r(b=>{let c=new Set(b);return c.has(a)?c.delete(a):c.add(a),c})},[]),t=o.trim().length>0,u=l.get("provider")||null,v=(0,e.useCallback)(a=>{let b=new URLSearchParams(l.toString());a?b.set("provider",a):b.delete("provider"),k.replace(`?${b.toString()}`,{scroll:!1})},[k,l]),w=(0,e.useCallback)(a=>B(a,m),[m]),z=(0,e.useMemo)(()=>(function(a){let b=[...new Set(a.filter(Boolean))].sort(),c=Math.max(14,Math.min(48,360/Math.max(1,b.length))),d=[],e=new Map;for(let a of b){let b=function(a){let b=0x811c9dc5;for(let c=0;c<a.length;c++)b^=a.charCodeAt(c),b=Math.imul(b,0x1000193);return b>>>0}(a)%3600/10,f=b,g=Q(b,d),h=b;for(let a=1;a<=40;a++){let a=Q(h=(h+137.508)%360,d);if(a>g&&(g=a,f=h),g>=c)break}d.push(f),e.set(a,{hue:Math.round(10*f)/10,saturation:1})}return e})(Object.keys(b?.byProvider||{}).map(a=>j?.[a]||a)),[b,j]),A=(0,e.useMemo)(()=>b?Object.entries(b.byProvider||{}).map(([a,b])=>({id:j?.[a]||a,rawId:a,cost:b?.cost||0,tokens:(b?.promptTokens||0)+(b?.completionTokens||0),requests:b?.requests||0})):null,[b,j]),C=(0,e.useCallback)((a,b="solid")=>{let c=j?.[a]||a;return function(a,{tone:b="solid",dark:c=!1}={}){if(null==a)return"var(--color-border)";let d=c?.74:.62,e="soft"===b?.13:.17,f="soft"===b?.22:1;return 1===f?`oklch(${d} ${e} ${a})`:`oklch(${d} ${e} ${a} / ${f})`}(z.get(c)?.hue??null,{tone:b})},[z,j]),[D,E]=(0,e.useState)([]),[F,G]=(0,e.useState)(null),H=(0,e.useMemo)(()=>{if(!b)return null;let a=o.trim().toLowerCase(),c=b=>(!u||b.provider===u||b.id===u||b.id===u&&null===b.provider)&&(!a||b.id.toLowerCase().includes(a)||(b.rawModel||"").toLowerCase().includes(a)||(b.provider||"").toLowerCase().includes(a)||(b.accountName||"").toLowerCase().includes(a)||(b.endpoint||"").toLowerCase().includes(a)||(b.keyName||"").toLowerCase().includes(a)),d=a=>{let c=Object.entries(b[a.key]||{}).map(([a,b])=>{let c,d,e;return c=b?.promptTokens||0,d=b?.completionTokens||0,e=b?.cachedTokens||0,{id:a,rawModel:b?.rawModel||a,provider:b?.provider||null,connectionId:b?.connectionId||null,accountName:b?.accountName||null,endpoint:b?.endpoint||null,keyName:b?.keyName||null,requests:b?.requests||0,promptTokens:c,completionTokens:d,cachedTokens:e,tokens:c+d,cost:b?.cost||0,lastUsed:b?.lastUsed||null}});return{...a,rows:c}},e=d(aQ[0]),f=d(aQ[1]),g=d(aQ[2]),h=d(aQ[3]),i=a=>{let b=a.rows.filter(c),d=b.reduce((a,b)=>a+w(b),0),e=b.slice().sort((a,b)=>w(b)-w(a));return{...a,rows:e,total:d,totalCost:b.reduce((a,b)=>a+b.cost,0),totalTokens:b.reduce((a,b)=>a+b.tokens,0),allCount:a.rows.length}};return{provider:i(e),model:i(f),account:i(g),endpoint:i(h),grandTotal:e.rows.reduce((a,b)=>a+w(b),0),grandCount:e.rows.length}},[b,o,u,w]),J=(0,e.useCallback)(a=>{if(!t)return q.has(a);let b=H?.[a];return b&&b.rows.length>0||q.has(a)},[t,q,H]),K={activeRequests:c?.activeRequests??b?.activeRequests??[],recentRequests:c?.recentRequests??b?.recentRequests??[]};if(!b&&g)return(0,d.jsxs)("div",{className:"flex min-w-0 flex-col gap-6",children:[(0,d.jsx)(O,{stats:K,nodeNames:j}),(0,d.jsxs)("div",{className:"flex min-w-0 flex-col gap-5",children:[(0,d.jsx)("div",{className:"h-24 animate-pulse rounded-[14px] bg-border-subtle"}),(0,d.jsx)("div",{className:"h-40 animate-pulse rounded-[14px] bg-border-subtle"})]})]});if(!b)return(0,d.jsx)(h.default,{padding:"md",children:(0,d.jsxs)("div",{className:"flex flex-col items-center gap-2 py-8 text-center",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[28px] text-text-subtle","aria-hidden":"true",children:"cloud_off"}),(0,d.jsxs)("p",{className:"text-sm text-text-muted",children:["Could not load usage for ",I[a]||a,"."]}),(0,d.jsx)("p",{className:"text-xs text-text-subtle",children:"Nothing is shown rather than numbers from another time range."}),(0,d.jsx)("button",{type:"button",onClick:i,className:"mt-1 rounded-lg border border-border px-3 py-1.5 text-xs font-medium text-text-main transition-colors hover:bg-bg-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/45",children:"Retry"})]})});let M=(H?.provider.rows.length||0)+(H?.model.rows.length||0)+(H?.account.rows.length||0)+(H?.endpoint.rows.length||0),N=(H?.provider.allCount||0)+(H?.model.allCount||0)+(H?.account.allCount||0)+(H?.endpoint.allCount||0),R=a=>"tokens"===m?y(a.tokens):x(a.cost),T=a=>"both"===m?`${y(a.tokens)} tok`:null;return(0,d.jsxs)("div",{className:"flex min-w-0 flex-col gap-6",children:[(0,d.jsx)(L,{stats:b,mode:m,period:a,onModeChange:n,onSelectProvider:v,selectedProvider:u,nodeNames:j,colorOf:C,donutRows:A,onPickProvider:a=>v(a.rawId)}),(0,d.jsx)(O,{stats:K,nodeNames:j}),b?(0,d.jsx)(P,{points:F===a?D:[],mode:m}):null,(0,d.jsx)(aO,{period:a,mode:m}),(0,d.jsx)("div",{className:"border-t border-border-subtle"}),(0,d.jsx)(U,{query:o,onQueryChange:p,activeFilter:u,onClearFilter:()=>v(null),resultCount:M,totalCount:N}),(0,d.jsx)("div",{className:"flex min-w-0 flex-col gap-1",children:aQ.map((c,e)=>{let f=H?.[c.id];if(!f)return null;let g=J(c.id),h="provider"===c.id;return(0,d.jsx)(S,{title:c.title,depth:e,folded:e>0,count:"tokens"===m?y(f.totalTokens):x(f.totalCost),countValue:"tokens"===m?f.totalTokens:f.totalCost,countFormat:aS(m),countSecondary:"both"===m?`${y(f.totalTokens)} tok`:null,countSecondaryValue:"both"===m?f.totalTokens:void 0,countSecondaryFormat:"both"===m?aT:void 0,meta:0===f.rows.length?"no match":`${f.rows.length}${f.rows.length!==f.allCount?` of ${f.allCount}`:""}`,accent:h&&!!b.errorProvider,open:g,onOpenChange:()=>s(c.id),children:(0,d.jsx)(aU,{layer:f,dimension:c.id,mode:m,grandTotal:H?.grandTotal||0,valueFor:R,secondaryFor:T,onSelectProvider:h?v:void 0,selectedProvider:u,open:g,hasQuery:o.trim().length>0,period:a,nodeNames:j})},c.id)})})]})}let aS=a=>"tokens"===a?z:x,aT=a=>`${z(a)} tok`;function aU({layer:a,dimension:b,mode:c,grandTotal:f,valueFor:g,secondaryFor:h,onSelectProvider:i,selectedProvider:j,open:k,hasQuery:l,period:m,nodeNames:n}){let[o,p]=(0,e.useState)(!1),[q,r]=(0,e.useState)(null),s=o?a.rows:a.rows.slice(0,l?40:8),t=a.rows.length-s.length,u=aS(c);return 0===a.rows.length?(0,d.jsx)("p",{className:"px-2 py-3 text-xs text-text-muted",children:l?"Nothing matches the current search.":"Nothing recorded in this period yet."}):(0,d.jsxs)("div",{className:"flex min-w-0 flex-col",children:[s.map((a,e)=>{let k="provider"===b?function(a,b){if(!a)return"—";let c=b?.[a];return c||(a.length<=22?a:`${a.slice(0,14)}…`)}(a.id,n):"account"===b?a.accountName||a.id:"endpoint"===b?a.endpoint||a.id:a.rawModel||a.id,l=B(a,c),o=F(l,f),p="function"==typeof i,s=q===a.id;return(0,d.jsxs)("div",{className:"min-w-0",children:[(0,d.jsxs)("div",{className:"flex min-w-0 items-start gap-1",children:[(0,d.jsx)("div",{className:"min-w-0 flex-1",children:(0,d.jsx)(T,{label:k,sublabel:"provider"===b?null:"account"===b?[a.rawModel,a.provider].filter(Boolean).join(" \xb7 ")||null:a.provider||null,value:g(a),valueRaw:e<24?l:void 0,valueFormat:u,valueSecondary:h(a),valueSecondaryRaw:e<24?a.tokens:void 0,valueSecondaryFormat:"both"===c?aT:void 0,detail:H({input:a.promptTokens,output:a.completionTokens,cached:a.cachedTokens,total:a.tokens}),barValue:o,status:a.id===j&&"provider"===b?"active":void 0,selected:!!p&&j===a.id,onSelect:p?()=>i(a.id):void 0,trailing:(0,d.jsxs)("span",{className:"hidden text-xs tabular-nums text-text-subtle sm:inline",title:`${w(a.requests)} requests`,children:[w(a.requests)," req"]})})}),a.requests>0?(0,d.jsx)("button",{type:"button",onClick:()=>r(s?null:a.id),"aria-expanded":s,"aria-label":s?`Hide requests for ${k}`:`Show ${a.requests} requests for ${k}`,className:["mt-1.5 shrink-0 rounded-md p-1.5 transition-colors duration-150 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/45",s?"bg-primary/8 text-primary":"text-text-subtle hover:bg-bg-hover hover:text-text-main"].join(" "),children:(0,d.jsx)("span",{className:"material-symbols-outlined text-[15px]","aria-hidden":"true",children:s?"expand_less":"receipt_long"})}):null]}),s?(0,d.jsx)("div",{className:"mb-1 ml-2 min-w-0",children:(0,d.jsx)(aP,{provider:"provider"===b?a.id:a.provider,model:"model"===b?a.rawModel:null,period:m})}):null]},a.id)}),t>0?(0,d.jsxs)("button",{type:"button",onClick:()=>p(!0),className:"mt-1 self-start rounded-lg px-2 py-1.5 text-xs font-medium text-primary transition-colors hover:bg-primary/8 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/45",children:["Show ",t," more"]}):null,o&&a.rows.length>8?(0,d.jsxs)("button",{type:"button",onClick:()=>p(!1),className:"mt-1 self-start rounded-lg px-2 py-1.5 text-xs font-medium text-text-muted transition-colors hover:bg-bg-hover hover:text-text-main focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/45",children:["Show top ",8]}):null]})}function aV({period:a}){let[b,c]=(0,e.useState)(null),[f,g]=(0,e.useState)(null),[h,i]=(0,e.useState)({activeRequests:[],recentRequests:[]}),[j,k]=(0,e.useState)(null),[l,m]=(0,e.useState)({}),[n,o]=(0,e.useState)(0);(0,e.useRef)(a);let p=f===a,q=j===a;return(0,d.jsx)(aR,{period:a,stats:p?b:null,live:h,loading:!p&&!q,fetching:!1,onRetry:()=>{k(null),o(a=>a+1)},nodeNames:l})}let aW=[{value:"today",label:"Today"},{value:"24h",label:"24h"},{value:"7d",label:"7D"},{value:"30d",label:"30D"},{value:"60d",label:"60D"},{value:"all",label:"All"}];function aX(){return(0,d.jsx)(e.Suspense,{fallback:(0,d.jsx)(g.Qv,{}),children:(0,d.jsx)(aY,{})})}function aY(){let a=(0,f.useSearchParams)(),b=(0,f.useRouter)(),[c,h]=(0,e.useState)("today"),[i,j]=(0,e.useState)(!1),[k,l]=(0,e.useState)({type:"",message:""}),m=(0,e.useRef)(null),n=a.get("tab"),o=n&&["overview","logs","details"].includes(n)?n:"overview",p=async()=>{j(!0),l({type:"",message:""});try{let a=await fetch("/api/usage/backup");if(!a.ok){let b=await a.json().catch(()=>({}));throw Error(b.error||"Failed to export usage data")}let b=await a.json(),c=new Blob([JSON.stringify(b,null,2)],{type:"application/json"}),d=URL.createObjectURL(c),e=document.createElement("a"),f=new Date().toISOString().slice(0,10);e.href=d,e.download=`9router-usage-backup-${f}.json`,document.body.appendChild(e),e.click(),document.body.removeChild(e),URL.revokeObjectURL(d),l({type:"success",message:"Usage backup downloaded successfully!"})}catch(a){l({type:"error",message:a.message||"Export failed"})}finally{j(!1)}},q=async a=>{let b=a.target.files?.[0];if(b){m.current&&(m.current.value=""),j(!0),l({type:"",message:""});try{let a=await b.text(),c=JSON.parse(a),d=await fetch("/api/usage/backup",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...c,mode:"merge"})}),e=await d.json().catch(()=>({}));if(!d.ok)throw Error(e.error||"Failed to import usage data");l({type:"success",message:"Usage backup merged successfully!"})}catch(a){l({type:"error",message:a.message||"Import failed"})}finally{j(!1)}}};return(0,d.jsxs)("div",{className:"flex min-w-0 flex-col gap-6 px-1 sm:px-0",children:[(0,d.jsxs)("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[(0,d.jsx)(g.Iz,{options:[{value:"overview",label:"Overview"},{value:"logs",label:"Logs"},{value:"details",label:"Details"}],value:o,onChange:c=>{if(c===o)return;let d=new URLSearchParams(a);d.set("tab",c),b.push(`/dashboard/usage?${d.toString()}`,{scroll:!1})},className:"w-full sm:w-auto"}),"overview"===o&&(0,d.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,d.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,d.jsxs)("button",{type:"button",onClick:p,disabled:i,className:"flex items-center gap-1 rounded-lg border border-border bg-bg-subtle px-2.5 py-1.5 text-xs font-medium text-text-muted transition-colors hover:bg-bg-hover hover:text-text disabled:opacity-50",title:"Export all usage history & tokens to JSON file",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[15px]","aria-hidden":"true",children:"download"}),(0,d.jsx)("span",{children:"Export"})]}),(0,d.jsxs)("button",{type:"button",onClick:()=>m.current?.click(),disabled:i,className:"flex items-center gap-1 rounded-lg border border-border bg-bg-subtle px-2.5 py-1.5 text-xs font-medium text-text-muted transition-colors hover:bg-bg-hover hover:text-text disabled:opacity-50",title:"Import usage backup JSON file (merge tokens)",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[15px]","aria-hidden":"true",children:"upload"}),(0,d.jsx)("span",{children:"Import"})]}),(0,d.jsx)("input",{ref:m,type:"file",accept:".json",onChange:q,className:"hidden"})]}),(0,d.jsx)(g.Iz,{options:aW,value:c,onChange:h,size:"sm",className:"w-full sm:w-auto"})]})]}),k.message&&(0,d.jsxs)("div",{className:`flex items-center justify-between rounded-lg px-3 py-2 text-xs font-medium ${"success"===k.type?"border border-success/20 bg-success/10 text-success":"border border-error/20 bg-error/10 text-error"}`,children:[(0,d.jsx)("span",{children:k.message}),(0,d.jsx)("button",{type:"button",onClick:()=>l({type:"",message:""}),"aria-label":"Dismiss",className:"shrink-0 rounded p-0.5 text-text-muted transition-colors hover:text-text focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/45",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-[16px]","aria-hidden":"true",children:"close"})})]}),"overview"===o&&(0,d.jsx)(e.Suspense,{fallback:(0,d.jsx)(g.Qv,{}),children:(0,d.jsx)(aV,{period:c})}),"logs"===o&&(0,d.jsx)(g.gM,{}),"details"===o&&(0,d.jsx)(v,{})]})}},55511:a=>{"use strict";a.exports=require("crypto")},55591:a=>{"use strict";a.exports=require("https")},57075:a=>{"use strict";a.exports=require("node:stream")},57975:a=>{"use strict";a.exports=require("node:util")},63033:a=>{"use strict";a.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},71553:a=>{"use strict";a.exports=require("node:dns/promises")},71622:a=>{"use strict";a.exports=import("open")},73024:a=>{"use strict";a.exports=require("node:fs")},73136:a=>{"use strict";a.exports=require("node:url")},73429:a=>{"use strict";a.exports=require("node:util/types")},73496:a=>{"use strict";a.exports=require("http2")},74075:a=>{"use strict";a.exports=require("zlib")},75919:a=>{"use strict";a.exports=require("node:worker_threads")},76760:a=>{"use strict";a.exports=require("node:path")},77030:a=>{"use strict";a.exports=require("node:net")},77598:a=>{"use strict";a.exports=require("node:crypto")},78474:a=>{"use strict";a.exports=require("node:events")},79646:a=>{"use strict";a.exports=require("child_process")},79868:a=>{"use strict";a.exports=require("node:sqlite")},81630:a=>{"use strict";a.exports=require("http")},81787:a=>{"use strict";a.exports=require("bun:sqlite")},87149:(a,b,c)=>{"use strict";c.r(b),c.d(b,{default:()=>d});let d=(0,c(77943).registerClientReference)(function(){throw Error("Attempted to call the default export of \"C:\\\\Users\\\\Developer\\\\9router-fix\\\\src\\\\app\\\\(dashboard)\\\\dashboard\\\\usage\\\\page.js\" from the server, but it's on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"C:\\Users\\Developer\\9router-fix\\src\\app\\(dashboard)\\dashboard\\usage\\page.js","default")},87550:a=>{"use strict";a.exports=require("better-sqlite3")},87997:a=>{"use strict";a.exports=require("node:timers")},91645:a=>{"use strict";a.exports=require("net")},94735:a=>{"use strict";a.exports=require("events")}};var b=require("../../../../webpack-runtime.js");b.C(a);var c=b.X(0,[4741,1260,2430,4613,4485,9555,2636,4884,8967,6070,869,915,6457,4123,929,6777,412,2668],()=>b(b.s=43381));module.exports=c})();
|
|
1
|
+
(()=>{var a={};a.id=2825,a.ids=[2825],a.modules={643:a=>{"use strict";a.exports=require("node:perf_hooks")},1027:(a,b,c)=>{Promise.resolve().then(c.bind(c,53478))},1707:(a,b,c)=>{Promise.resolve().then(c.bind(c,87149))},1708:a=>{"use strict";a.exports=require("node:process")},1932:a=>{"use strict";a.exports=require("url")},3295:a=>{"use strict";a.exports=require("next/dist/server/app-render/after-task-async-storage.external.js")},4573:a=>{"use strict";a.exports=require("node:buffer")},7066:a=>{"use strict";a.exports=require("node:tty")},8128:a=>{"use strict";a.exports=require("next/dist/server/runtime-reacts.external.js")},10846:a=>{"use strict";a.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},14985:a=>{"use strict";a.exports=require("dns")},16698:a=>{"use strict";a.exports=require("node:async_hooks")},19121:a=>{"use strict";a.exports=require("next/dist/server/app-render/action-async-storage.external.js")},21820:a=>{"use strict";a.exports=require("os")},27910:a=>{"use strict";a.exports=require("stream")},28354:a=>{"use strict";a.exports=require("util")},29021:a=>{"use strict";a.exports=require("fs")},29294:a=>{"use strict";a.exports=require("next/dist/server/app-render/work-async-storage.external.js")},31421:a=>{"use strict";a.exports=require("node:child_process")},32467:a=>{"use strict";a.exports=require("node:http2")},33873:a=>{"use strict";a.exports=require("path")},34589:a=>{"use strict";a.exports=require("node:assert")},37067:a=>{"use strict";a.exports=require("node:http")},37540:a=>{"use strict";a.exports=require("node:console")},38522:a=>{"use strict";a.exports=require("node:zlib")},40610:a=>{"use strict";a.exports=require("node:dns")},41025:a=>{"use strict";a.exports=require("next/dist/server/app-render/dynamic-access-async-storage.external.js")},41692:a=>{"use strict";a.exports=require("node:tls")},41792:a=>{"use strict";a.exports=require("node:querystring")},43381:(a,b,c)=>{"use strict";c.r(b),c.d(b,{__next_app__:()=>w,handler:()=>y,routeModule:()=>x});var d=c(21635),e=c(86315),f=c(1020),g=c(61287),h={};for(let a in g)0>["default","__next_app__","routeModule","handler"].indexOf(a)&&(h[a]=()=>g[a]);c.d(b,h);let i=(0,d.p)(()=>Promise.resolve().then(c.bind(c,57529))),j=(0,d.p)(()=>Promise.resolve().then(c.t.bind(c,95547,23))),k=(0,d.p)(()=>Promise.resolve().then(c.t.bind(c,55091,23))),l=(0,d.p)(()=>Promise.resolve().then(c.t.bind(c,45270,23))),m=(0,d.p)(()=>Promise.resolve().then(c.t.bind(c,28193,23))),n=(0,d.p)(()=>Promise.resolve().then(c.bind(c,30508))),o=(0,d.p)(()=>Promise.resolve().then(c.t.bind(c,95547,23))),p=(0,d.p)(()=>Promise.resolve().then(c.t.bind(c,55091,23))),q=(0,d.p)(()=>Promise.resolve().then(c.t.bind(c,45270,23))),r=(0,d.p)(()=>Promise.resolve().then(c.t.bind(c,28193,23))),s=(0,d.p)(()=>Promise.resolve().then(c.t.bind(c,95547,23))),t=(0,d.p)(()=>Promise.resolve().then(c.t.bind(c,95547,23))),u={children:["",{children:["(dashboard)",{children:["dashboard",{children:["usage",{children:["__PAGE__",{},{page:[(0,d.p)(()=>Promise.resolve().then(c.bind(c,87149))),"C:\\Users\\Developer\\9router-fix\\src\\app\\(dashboard)\\dashboard\\usage\\page.js"]}]},{"global-error":[t,"next/dist/client/components/builtin/global-error.js"]},[]]},{"global-error":[s,"next/dist/client/components/builtin/global-error.js"]},[]]},{layout:[n,"C:\\Users\\Developer\\9router-fix\\src\\app\\(dashboard)\\layout.js"],"global-error":[o,"next/dist/client/components/builtin/global-error.js"],"not-found":[p,"next/dist/client/components/builtin/not-found.js"],forbidden:[q,"next/dist/client/components/builtin/forbidden.js"],unauthorized:[r,"next/dist/client/components/builtin/unauthorized.js"],metadata:{icon:[async a=>(await (0,d.p)(()=>Promise.resolve().then(c.bind(c,70440)))()).default(a)],apple:[],openGraph:[],twitter:[],manifest:"/manifest.webmanifest"}},[]]},{layout:[i,"C:\\Users\\Developer\\9router-fix\\src\\app\\layout.js"],"global-error":[j,"next/dist/client/components/builtin/global-error.js"],"not-found":[k,"next/dist/client/components/builtin/not-found.js"],forbidden:[l,"next/dist/client/components/builtin/forbidden.js"],unauthorized:[m,"next/dist/client/components/builtin/unauthorized.js"],metadata:{icon:[async a=>(await (0,d.p)(()=>Promise.resolve().then(c.bind(c,70440)))()).default(a)],apple:[],openGraph:[],twitter:[],manifest:"/manifest.webmanifest"}},[]]}.children,v=(0,e.H)({tree:u,page:"/(dashboard)/dashboard/usage/page",pathname:"/dashboard/usage",require:c,loadChunk:()=>Promise.resolve(),interopDefault:f.T}),w=v.__next_app__,x=v.routeModule,y=v.handler},46060:a=>{"use strict";a.exports=require("next/dist/shared/lib/no-fallback-error.external.js")},46293:a=>{"use strict";a.exports=require("sql.js")},48161:a=>{"use strict";a.exports=require("node:os")},51455:a=>{"use strict";a.exports=require("node:fs/promises")},53053:a=>{"use strict";a.exports=require("node:diagnostics_channel")},53478:(a,b,c)=>{"use strict";c.r(b),c.d(b,{default:()=>aX});var d=c(48249),e=c(67484),f=c(19099),g=c(50412),h=c(17660),i=c(99070),j=c(71404);function k({isOpen:a,onClose:b,title:c,children:e,width:f="md",className:g}){let h={sm:"w-[400px]",md:"w-[500px]",lg:"w-[600px]",xl:"w-[800px]",full:"w-full"};return a?(0,d.jsxs)("div",{className:"fixed inset-0 z-50",children:[(0,d.jsx)("div",{className:"absolute inset-0 bg-black/50 backdrop-blur-[2px] fade-in cursor-pointer",onClick:b,"aria-hidden":"true"}),(0,d.jsxs)("div",{className:(0,j.cn)("absolute right-0 top-0 h-full bg-surface flex flex-col","shadow-[var(--shadow-elev)]","slide-in-right","border-l border-border-subtle",h[f]||h.md,g),children:[(0,d.jsxs)("div",{className:"flex items-center justify-between p-6 border-b border-border-subtle flex-shrink-0",children:[(0,d.jsx)("div",{className:"flex items-center gap-3",children:c&&(0,d.jsx)("h2",{className:"text-lg font-semibold text-text-main",children:c})}),(0,d.jsx)("button",{type:"button",onClick:b,className:"p-1.5 rounded-[10px] text-text-muted hover:bg-surface-2 hover:text-text-main transition-colors",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-[20px]",children:"close"})})]}),(0,d.jsx)("div",{className:"flex-1 overflow-y-auto p-6 custom-scrollbar",children:e})]})]}):null}function l({currentPage:a,pageSize:b,totalItems:c,onPageChange:e,onPageSizeChange:f,className:g}){let h=Math.ceil(c/b),k=c>0?(a-1)*b+1:0,m=Math.min(a*b,c),n=(()=>{let b=[],c=Math.max(1,a-2),d=Math.min(h,c+5-1);d-c+1<5&&(c=Math.max(1,d-5+1));for(let a=c;a<=d;a++)b.push(a);return b})();return(0,d.jsxs)("div",{className:(0,j.cn)("flex flex-col sm:flex-row items-center justify-between gap-4 py-4 px-2",g),children:[c>0&&(0,d.jsxs)("div",{className:"text-sm text-text-muted",children:["Showing ",(0,d.jsx)("span",{className:"font-medium text-text-main",children:k})," to"," ",(0,d.jsx)("span",{className:"font-medium text-text-main",children:m})," of"," ",(0,d.jsx)("span",{className:"font-medium text-text-main",children:c})," results"]}),(0,d.jsxs)("div",{className:"flex flex-wrap items-center justify-center gap-2 sm:gap-4",children:[f&&(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)("span",{className:"text-sm text-text-muted",children:"Rows:"}),(0,d.jsx)("select",{value:b,onChange:a=>f(Number(a.target.value)),className:(0,j.cn)("h-9 rounded-lg border border-black/10 dark:border-white/10 bg-surface","text-sm text-text-main focus:outline-none focus:ring-2 focus:ring-primary/20","cursor-pointer"),style:{colorScheme:"auto"},children:[10,20,50].map(a=>(0,d.jsx)("option",{value:a,children:a},a))})]}),h>1&&(0,d.jsxs)("div",{className:"flex items-center gap-1",children:[(0,d.jsx)(i.default,{variant:"outline",size:"sm",onClick:()=>e(a-1),disabled:1===a,className:"w-9 px-0",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"chevron_left"})}),n[0]>1&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(i.default,{variant:"ghost",size:"sm",onClick:()=>e(1),className:"w-9 px-0 hidden sm:inline-flex",children:"1"}),n[0]>2&&(0,d.jsx)("span",{className:"text-text-muted px-1 hidden sm:inline",children:"..."})]}),n.map(b=>(0,d.jsx)(i.default,{variant:a===b?"primary":"ghost",size:"sm",onClick:()=>e(b),className:(0,j.cn)("w-9 px-0",a===b?"inline-flex":"hidden sm:inline-flex"),children:b},b)),n[n.length-1]<h&&(0,d.jsxs)(d.Fragment,{children:[n[n.length-1]<h-1&&(0,d.jsx)("span",{className:"text-text-muted px-1 hidden sm:inline",children:"..."}),(0,d.jsx)(i.default,{variant:"ghost",size:"sm",onClick:()=>e(h),className:"w-9 px-0 hidden sm:inline-flex",children:h})]}),(0,d.jsx)(i.default,{variant:"outline",size:"sm",onClick:()=>e(a+1),disabled:a===h,className:"w-9 px-0",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"chevron_right"})})]})]})]})}var m=c(92592);let n=null,o=null;async function p(){if(n&&o)return{providerNameCache:n,providerNodesCache:o};let a=await fetch("/api/provider-nodes"),b=(await a.json()).nodes||[];for(let a of(o={},b))o[a.id]=a.name;return{providerNameCache:n={...m.Q2,...o},providerNodesCache:o}}function q(a,b){if(!a||!b)return a;let c=b[a];if("string"==typeof c)return c;if(c?.name)return c.name;let d=(0,m.zt)(a)||m.Q2[a];return d?.name||a}function r({title:a,children:b,defaultOpen:c=!1,icon:f=null}){let[g,h]=(0,e.useState)(c);return(0,d.jsxs)("div",{className:"border border-black/5 dark:border-white/5 rounded-lg overflow-hidden",children:[(0,d.jsxs)("button",{type:"button",onClick:()=>h(!g),className:"w-full flex items-center justify-between p-3 bg-black/[0.02] dark:bg-white/[0.02] hover:bg-black/[0.04] dark:hover:bg-white/[0.04] transition-colors",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[f&&(0,d.jsx)("span",{className:"material-symbols-outlined text-[18px] text-text-muted",children:f}),(0,d.jsx)("span",{className:"font-semibold text-sm text-text-main",children:a})]}),(0,d.jsx)("span",{className:(0,j.cn)("material-symbols-outlined text-[20px] text-text-muted transition-transform duration-200",g?"rotate-90":""),children:"chevron_right"})]}),g&&(0,d.jsx)("div",{className:"p-4 border-t border-black/5 dark:border-white/5",children:b})]})}function s(a){return a?.cached_tokens||a?.cache_read_input_tokens||0}function t(a){return a?.cache_creation_input_tokens||0}function u(a){let b=a?.prompt_tokens||a?.input_tokens||0,c=s(a);return b<c?c:b}function v(){let[a,b]=(0,e.useState)([]),[c,f]=(0,e.useState)({page:1,pageSize:20,totalItems:0,totalPages:0}),[g,m]=(0,e.useState)(!1),[n,o]=(0,e.useState)(null),[v,w]=(0,e.useState)(!1),[x,y]=(0,e.useState)([]),[z,A]=(0,e.useState)(null),[B,C]=(0,e.useState)({provider:"",startDate:"",endDate:""});return(0,e.useCallback)(async()=>{try{let a=await fetch("/api/usage/providers"),b=await a.json();y(b.providers||[]);let c=await p();A(c.providerNameCache)}catch(a){console.error("Failed to fetch providers:",a)}},[]),(0,e.useCallback)(async()=>{m(!0);try{let a=new URLSearchParams({page:c.page.toString(),pageSize:c.pageSize.toString()});B.provider&&a.append("provider",B.provider),B.startDate&&a.append("startDate",B.startDate),B.endDate&&a.append("endDate",B.endDate);let d=await fetch(`/api/usage/request-details?${a}`),e=await d.json();b(e.details||[]),f(a=>({...a,...e.pagination}))}catch(a){console.error("Failed to fetch request details:",a)}finally{m(!1)}},[c.page,c.pageSize,B]),(0,d.jsxs)("div",{className:"flex min-w-0 flex-col gap-6",children:[(0,d.jsx)(h.default,{padding:"md",children:(0,d.jsxs)("div",{className:"grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-4",children:[(0,d.jsxs)("div",{className:"flex min-w-0 flex-col gap-2",children:[(0,d.jsx)("label",{htmlFor:"provider-filter",className:"text-sm font-medium text-text-main",children:"Provider"}),(0,d.jsxs)("select",{id:"provider-filter",value:B.provider,onChange:a=>C({...B,provider:a.target.value}),className:(0,j.cn)("h-9 px-3 rounded-lg border border-black/10 dark:border-white/10 bg-surface","text-sm text-text-main focus:outline-none focus:ring-2 focus:ring-primary/20","w-full min-w-0 cursor-pointer"),style:{colorScheme:"auto"},children:[(0,d.jsx)("option",{value:"",children:"All Providers"}),x.map(a=>(0,d.jsx)("option",{value:a.id,children:a.name},a.id))]})]}),(0,d.jsxs)("div",{className:"flex min-w-0 flex-col gap-2",children:[(0,d.jsx)("label",{htmlFor:"start-date-filter",className:"text-sm font-medium text-text-main",children:"Start Date"}),(0,d.jsx)("input",{id:"start-date-filter",type:"datetime-local",value:B.startDate,onChange:a=>C({...B,startDate:a.target.value}),className:(0,j.cn)("h-9 px-3 rounded-lg border border-black/10 dark:border-white/10 bg-surface","w-full min-w-0 text-sm text-text-main focus:outline-none focus:ring-2 focus:ring-primary/20")})]}),(0,d.jsxs)("div",{className:"flex min-w-0 flex-col gap-2",children:[(0,d.jsx)("label",{htmlFor:"end-date-filter",className:"text-sm font-medium text-text-main",children:"End Date"}),(0,d.jsx)("input",{id:"end-date-filter",type:"datetime-local",value:B.endDate,onChange:a=>C({...B,endDate:a.target.value}),className:(0,j.cn)("h-9 px-3 rounded-lg border border-black/10 dark:border-white/10 bg-surface","w-full min-w-0 text-sm text-text-main focus:outline-none focus:ring-2 focus:ring-primary/20")})]}),(0,d.jsxs)("div",{className:"flex min-w-0 flex-col gap-2 sm:col-span-2 lg:col-span-1",children:[(0,d.jsx)("span",{className:"hidden text-sm font-medium text-text-main opacity-0 lg:block","aria-hidden":"true",children:"Clear"}),(0,d.jsx)(i.default,{variant:"ghost",onClick:()=>{C({provider:"",startDate:"",endDate:""})},disabled:!B.provider&&!B.startDate&&!B.endDate,className:"w-full",children:"Clear Filters"})]})]})}),(0,d.jsxs)(h.default,{padding:"none",children:[(0,d.jsx)("div",{className:"overflow-x-auto",children:(0,d.jsxs)("table",{className:"w-full min-w-[880px]",children:[(0,d.jsx)("thead",{children:(0,d.jsxs)("tr",{className:"border-b border-black/5 dark:border-white/5",children:[(0,d.jsx)("th",{className:"text-left p-4 text-sm font-semibold text-text-main",children:"Timestamp"}),(0,d.jsx)("th",{className:"text-left p-4 text-sm font-semibold text-text-main",children:"Model"}),(0,d.jsx)("th",{className:"text-left p-4 text-sm font-semibold text-text-main",children:"Provider"}),(0,d.jsx)("th",{className:"text-right p-4 text-sm font-semibold text-text-main",children:"Input Tokens"}),(0,d.jsx)("th",{className:"text-right p-4 text-sm font-semibold text-text-main",children:"Cached"}),(0,d.jsx)("th",{className:"text-right p-4 text-sm font-semibold text-text-main",children:"Cache Creation"}),(0,d.jsx)("th",{className:"text-right p-4 text-sm font-semibold text-text-main",children:"Output Tokens"}),(0,d.jsx)("th",{className:"text-left p-4 text-sm font-semibold text-text-main",children:"Latency"}),(0,d.jsx)("th",{className:"text-center p-4 text-sm font-semibold text-text-main",children:"Action"})]})}),(0,d.jsx)("tbody",{children:g?(0,d.jsx)("tr",{children:(0,d.jsx)("td",{colSpan:"7",className:"p-8 text-center text-text-muted",children:(0,d.jsxs)("div",{className:"flex items-center justify-center gap-2",children:[(0,d.jsx)("span",{className:"material-symbols-outlined animate-spin text-[20px]",children:"progress_activity"}),"Loading..."]})})}):0===a.length?(0,d.jsx)("tr",{children:(0,d.jsx)("td",{colSpan:"7",className:"p-8 text-center text-text-muted",children:"No request details found"})}):a.map((a,b)=>(0,d.jsxs)("tr",{className:"border-b border-black/5 dark:border-white/5 last:border-b-0 hover:bg-black/[0.02] dark:hover:bg-white/[0.02] transition-colors",children:[(0,d.jsx)("td",{className:"whitespace-nowrap p-4 text-sm text-text-main",children:new Date(a.timestamp).toLocaleString()}),(0,d.jsx)("td",{className:"max-w-[260px] truncate p-4 font-mono text-sm text-text-main",children:a.model}),(0,d.jsx)("td",{className:"max-w-[180px] truncate p-4 text-sm text-text-main",children:(0,d.jsx)("span",{className:"font-medium",children:q(a.provider,z)})}),(0,d.jsx)("td",{className:"p-4 text-sm text-text-main text-right font-mono",children:u(a.tokens).toLocaleString()}),(0,d.jsx)("td",{className:"p-4 text-sm text-text-main text-right font-mono",children:s(a.tokens)>0?s(a.tokens).toLocaleString():"—"}),(0,d.jsx)("td",{className:"p-4 text-sm text-text-main text-right font-mono",children:t(a.tokens)>0?t(a.tokens).toLocaleString():"—"}),(0,d.jsx)("td",{className:"p-4 text-sm text-text-main text-right font-mono",children:a.tokens?.completion_tokens?.toLocaleString()||0}),(0,d.jsx)("td",{className:"p-4 text-sm text-text-muted",children:(0,d.jsxs)("div",{className:"flex flex-col gap-0.5",children:[(0,d.jsxs)("div",{children:["TTFT: ",(0,d.jsxs)("span",{className:"font-mono",children:[a.latency?.ttft||0,"ms"]})]}),(0,d.jsxs)("div",{children:["Total: ",(0,d.jsxs)("span",{className:"font-mono",children:[a.latency?.total||0,"ms"]})]})]})}),(0,d.jsx)("td",{className:"p-4 text-center",children:(0,d.jsx)(i.default,{variant:"outline",size:"sm",onClick:()=>{o(a),w(!0)},children:"Detail"})})]},`${a.id}-${b}`))})]})}),!g&&a.length>0&&(0,d.jsx)("div",{className:"border-t border-black/5 dark:border-white/5",children:(0,d.jsx)(l,{currentPage:c.page,pageSize:c.pageSize,totalItems:c.totalItems,onPageChange:a=>{f(b=>({...b,page:a}))},onPageSizeChange:a=>{f(b=>({...b,pageSize:a,page:1}))}})})]}),(0,d.jsx)(k,{isOpen:v,onClose:()=>w(!1),title:"Request Details",width:"lg",children:n&&(0,d.jsxs)("div",{className:"space-y-6",children:[(0,d.jsxs)("div",{className:"grid min-w-0 grid-cols-1 gap-4 text-sm sm:grid-cols-2",children:[(0,d.jsxs)("div",{children:[(0,d.jsx)("span",{className:"text-text-muted",children:"ID:"})," ",(0,d.jsx)("span",{className:"break-all font-mono text-text-main",children:n.id})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("span",{className:"text-text-muted",children:"Timestamp:"})," ",(0,d.jsx)("span",{className:"text-text-main",children:new Date(n.timestamp).toLocaleString()})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("span",{className:"text-text-muted",children:"Provider:"})," ",(0,d.jsx)("span",{className:"text-text-main font-medium",children:q(n.provider,z)})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("span",{className:"text-text-muted",children:"Model:"})," ",(0,d.jsx)("span",{className:"text-text-main font-mono",children:n.model})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("span",{className:"text-text-muted",children:"Status:"})," ",(0,d.jsx)("span",{className:(0,j.cn)("font-medium","success"===n.status?"text-green-600":"text-red-600"),children:n.status})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("span",{className:"text-text-muted",children:"Latency:"})," ",(0,d.jsxs)("span",{className:"text-text-main font-mono",children:["TTFT ",n.latency?.ttft||0,"ms / Total ",n.latency?.total||0,"ms"]})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("span",{className:"text-text-muted",children:"Input Tokens:"})," ",(0,d.jsx)("span",{className:"text-text-main font-mono",children:u(n.tokens).toLocaleString()})]}),s(n.tokens)>0&&(0,d.jsxs)("div",{children:[(0,d.jsx)("span",{className:"text-text-muted",children:"Cached Tokens:"})," ",(0,d.jsx)("span",{className:"text-text-main font-mono",children:s(n.tokens).toLocaleString()})]}),t(n.tokens)>0&&(0,d.jsxs)("div",{children:[(0,d.jsx)("span",{className:"text-text-muted",children:"Cache Creation:"})," ",(0,d.jsx)("span",{className:"text-text-main font-mono",children:t(n.tokens).toLocaleString()})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("span",{className:"text-text-muted",children:"Output Tokens:"})," ",(0,d.jsx)("span",{className:"text-text-main font-mono",children:n.tokens?.completion_tokens?.toLocaleString()||0})]})]}),n.pxpipe&&(0,d.jsxs)("div",{className:"rounded-lg border border-black/5 dark:border-white/5 p-4",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2 mb-2",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[18px] text-text-muted",children:"image"}),(0,d.jsx)("span",{className:"font-semibold text-sm text-text-main",children:"PXPIPE"}),(0,d.jsx)("span",{className:(0,j.cn)("text-xs px-2 py-0.5 rounded",n.pxpipe.applied?"bg-green-500/15 text-green-600":"bg-amber-500/15 text-amber-600"),children:n.pxpipe.applied?"Activated":"Skipped"})]}),n.pxpipe.applied?(0,d.jsxs)("div",{className:"grid grid-cols-2 gap-2 text-sm sm:grid-cols-4",children:[(0,d.jsxs)("div",{children:[(0,d.jsx)("span",{className:"text-text-muted block text-xs",children:"Original (est.)"}),(0,d.jsxs)("span",{className:"font-mono",children:[(n.pxpipe.tokensBeforeEst||0).toLocaleString()," tokens"]})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("span",{className:"text-text-muted block text-xs",children:"Compressed (est.)"}),(0,d.jsxs)("span",{className:"font-mono",children:[(n.pxpipe.tokensAfterEst||0).toLocaleString()," tokens"]})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("span",{className:"text-text-muted block text-xs",children:"Saved"}),(0,d.jsxs)("span",{className:"font-mono text-green-600",children:[n.pxpipe.savedPct||0,"%"]})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("span",{className:"text-text-muted block text-xs",children:"Images"}),(0,d.jsxs)("span",{className:"font-mono",children:[n.pxpipe.imageCount||0," (",n.pxpipe.durationMs||0,"ms)"]})]})]}):(0,d.jsxs)("p",{className:"text-sm text-text-muted",children:["Reason: ",(0,d.jsx)("span",{className:"font-mono",children:n.pxpipe.reason}),n.pxpipe.detail?` — ${n.pxpipe.detail}`:""]})]}),(0,d.jsxs)("div",{className:"space-y-4",children:[(0,d.jsx)(r,{title:"1. Client Request (Input)",defaultOpen:!0,icon:"input",children:(0,d.jsx)("pre",{className:"max-h-[300px] max-w-full overflow-auto rounded-lg border border-black/5 bg-black/5 p-3 font-mono text-xs text-text-main dark:border-white/5 dark:bg-white/5 sm:p-4",children:JSON.stringify(n.request,null,2)})}),n.providerRequest&&(0,d.jsx)(r,{title:"2. Provider Request (Translated)",icon:"translate",children:(0,d.jsx)("pre",{className:"max-h-[300px] max-w-full overflow-auto rounded-lg border border-black/5 bg-black/5 p-3 font-mono text-xs text-text-main dark:border-white/5 dark:bg-white/5 sm:p-4",children:JSON.stringify(n.providerRequest,null,2)})}),n.providerResponse&&(0,d.jsx)(r,{title:"3. Provider Response (Raw)",icon:"data_object",children:(0,d.jsx)("pre",{className:"max-h-[300px] max-w-full overflow-auto rounded-lg border border-black/5 bg-black/5 p-3 font-mono text-xs text-text-main dark:border-white/5 dark:bg-white/5 sm:p-4",children:"object"==typeof n.providerResponse?JSON.stringify(n.providerResponse,null,2):n.providerResponse})}),(0,d.jsxs)(r,{title:"4. Client Response (Final)",defaultOpen:!0,icon:"output",children:[n.response?.thinking&&(0,d.jsxs)("div",{className:"mb-4",children:[(0,d.jsxs)("h4",{className:"font-semibold text-text-main mb-2 flex items-center gap-2 text-xs uppercase tracking-wide opacity-70",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"psychology"}),"Thinking Process"]}),(0,d.jsx)("pre",{className:"max-h-[200px] max-w-full overflow-auto rounded-lg border border-amber-200 bg-amber-50 p-3 font-mono text-xs text-amber-900 dark:border-amber-800 dark:bg-amber-950/30 dark:text-amber-100 sm:p-4",children:n.response.thinking})]}),(0,d.jsx)("h4",{className:"font-semibold text-text-main mb-2 text-xs uppercase tracking-wide opacity-70",children:"Content"}),(0,d.jsx)("pre",{className:"max-h-[300px] max-w-full overflow-auto rounded-lg border border-black/5 bg-black/5 p-3 font-mono text-xs text-text-main dark:border-white/5 dark:bg-white/5 sm:p-4",children:n.response?.content||"[No content]"})]})]})]})})]})}function w(a){let b=Number(a)||0;return b<1e3?String(b):b<1e6?`${(b/1e3).toFixed(+(b<1e4))}K`:b<1e9?`${(b/1e6).toFixed(1)}M`:`${(b/1e9).toFixed(1)}B`}function x(a){let b=Number(a)||0;return 0===b?"$0":b<.01?`$${b.toFixed(4)}`:`$${b.toFixed(2)}`}function y(a){return(Number(a)||0).toLocaleString("en-US")}function z(a){let b=Number(a);return(Number.isFinite(b)?Math.round(b):0).toLocaleString("en-US")}function A(a){return y(a)}function B(a,b){return"tokens"===b?a.tokens:a.cost}let C=[{id:"costs",label:"Cost",ranksBy:"cost"},{id:"tokens",label:"Tokens",ranksBy:"tokens"},{id:"both",label:"Cost + Tokens",ranksBy:"cost"}];function D(a){if(!a)return"";let b="number"==typeof a?a:Date.parse(a);if(!Number.isFinite(b))return"";let c=Math.floor((Date.now()-b)/6e4);if(c<1)return"less than a minute ago";if(c<60)return`${c} minute${1===c?"":"s"} ago`;let d=Math.floor(c/60);if(d<24)return`${d} hour${1===d?"":"s"} ago`;let e=Math.floor(d/24);return`${e} day${1===e?"":"s"} ago`}function E(a){if(!a)return"";let b="number"==typeof a?a:Date.parse(a);return Number.isFinite(b)?new Date(b).toLocaleString("en-US",{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"}):""}function F(a,b){let c=Number(a)||0,d=Number(b)||0;return d<=0?null:c/d*100}function G(a){return null!=a&&Number.isFinite(a)?a>0&&a<.1?"<0.1%":`${a.toFixed(a>=10?0:1)}%`:"—"}function H({input:a=0,output:b=0,cached:c=0,total:d=0}){let e=[`${y(a)} input`];return c>0&&e.push(`of which ${y(c)} cached`),e.push(`${y(b)} output`),`${y(d)} tokens — ${e.join(", ")}`}let I={today:"today","24h":"last 24 hours","7d":"last 7 days","30d":"last 30 days","60d":"last 60 days",all:"all time"};function J({rows:a,mode:b="costs",colorOf:c,onPick:f=null,top:g=8}){let[h,i]=(0,e.useState)(null),[j,k]=(0,e.useState)(!1),l=(0,e.useId)(),m=a=>"tokens"===b?a.tokens:a.cost,n=(0,e.useMemo)(()=>{let b=[...a||[]].sort((a,b)=>m(b)-m(a)),c=j?b.length:g,d=b.slice(0,c),e=b.slice(c),f=b.reduce((a,b)=>a+(m(b)||0),0),h=d.reduce((a,b)=>a+(m(b)||0),0);return{total:f,shown:d,restCount:e.length,restValue:f-h,restPct:F(f-h,f)}},[a,b,g,j]);if(!n.total)return(0,d.jsxs)("div",{className:"flex min-w-0 flex-col gap-2",children:[(0,d.jsx)("p",{className:"text-xs font-medium text-text-main",children:"Provider"}),(0,d.jsx)("p",{className:"text-xs text-text-muted",children:"Belum ada pemakaian pada periode ini, jadi tidak ada yang bisa dibandingkan."})]});let o=[],p=-90;for(let a of n.shown){let b=(m(a)||0)/n.total*360;b<=0||(o.push({id:a.id,row:a,from:p,to:p+b,pct:b/3.6}),p+=b)}if(n.restValue>0){let a=n.restValue/n.total*360;o.push({id:"__rest",rest:!0,from:p,to:p+a,pct:a/3.6})}let q=(a,b)=>{let c=a*Math.PI/180;return[84+b*Math.cos(c),84+b*Math.sin(c)]},r="tokens"===b?A:x,s=h?o.find(a=>a.id===h):null;return(0,d.jsxs)("div",{className:"flex min-w-0 flex-col gap-3",children:[(0,d.jsxs)("div",{className:"flex items-baseline justify-between gap-2",children:[(0,d.jsx)("h3",{className:"text-xs font-medium uppercase tracking-wide text-text-muted",children:"Provider"}),(0,d.jsxs)("span",{className:"text-[10px] text-text-subtle",children:[n.shown.length,n.restCount?` + ${n.restCount}`:""," provider"]})]}),(0,d.jsxs)("div",{className:"flex flex-col items-center gap-3 sm:flex-row sm:items-center sm:gap-5",children:[(0,d.jsxs)("svg",{viewBox:"0 0 168 168",width:168,height:168,className:"shrink-0",role:"img","aria-labelledby":l,children:[(0,d.jsxs)("title",{id:l,children:["Komposisi ","tokens"===b?"token":"biaya"," per provider."," ",n.shown.map(a=>`${a.id} ${G(F(m(a),n.total))}`).join(", "),"."]}),o.map(a=>{let b=((a,b)=>{let c=Math.min(1.2,(b-a)/6),d=a+c,e=b-c;if(e<=d)return null;let f=+(e-d>180),[g,h]=q(d,74),[i,j]=q(e,74),[k,l]=q(e,50),[m,n]=q(d,50);return`M ${g.toFixed(2)} ${h.toFixed(2)} A 74 74 0 ${f} 1 ${i.toFixed(2)} ${j.toFixed(2)} L ${k.toFixed(2)} ${l.toFixed(2)} A 50 50 0 ${f} 0 ${m.toFixed(2)} ${n.toFixed(2)} Z`})(a.from,a.to);if(!b)return null;let e=h===a.id;return(0,d.jsx)("path",{d:b,fill:a.rest?"var(--color-border)":c(a.id,"solid"),opacity:h&&!e?.35:1,className:"cursor-pointer transition-opacity duration-150",onMouseEnter:()=>i(a.id),onMouseLeave:()=>i(null),onClick:f&&!a.rest?()=>f(a.row):void 0},a.id)}),(0,d.jsx)("text",{x:84,y:80,textAnchor:"middle",className:"fill-text-main text-[15px] font-semibold tabular-nums",style:{fontVariantNumeric:"tabular-nums"},children:s?G(s.pct):r(n.total).replace(/^\$/,"$")}),(0,d.jsx)("text",{x:84,y:97,textAnchor:"middle",className:"fill-text-muted text-[9px]",children:s?s.rest?`${n.restCount} lainnya`:String(s.id).slice(0,16):"tokens"===b?"total token":"total biaya"})]}),(0,d.jsxs)("ul",{className:"flex min-w-0 flex-1 flex-col gap-1",children:[n.shown.map(a=>{let b=F(m(a),n.total);return(0,d.jsx)("li",{children:(0,d.jsxs)("button",{type:"button",onMouseEnter:()=>i(a.id),onMouseLeave:()=>i(null),onFocus:()=>i(a.id),onBlur:()=>i(null),onClick:f?()=>f(a):void 0,className:`flex w-full items-center gap-2 rounded-md px-1.5 py-1 text-left transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/45 ${h===a.id?"bg-bg-hover":""}`,children:[(0,d.jsx)("span",{className:"size-2 shrink-0 rounded-sm",style:{backgroundColor:c(a.id,"solid")},"aria-hidden":"true"}),(0,d.jsx)("span",{className:"min-w-0 flex-1 truncate text-xs text-text-main",children:a.id}),(0,d.jsx)("span",{className:"shrink-0 tabular-nums text-xs text-text-muted",children:G(b)}),(0,d.jsx)("span",{className:"w-20 shrink-0 text-right tabular-nums text-xs text-text-main",children:r(m(a))})]})},a.id)}),n.restValue>0?(0,d.jsxs)("li",{className:"flex items-center gap-2 px-1.5 py-1",children:[(0,d.jsx)("span",{className:"size-2 shrink-0 rounded-sm",style:{backgroundColor:"var(--color-border)"},"aria-hidden":"true"}),(0,d.jsxs)("span",{className:"min-w-0 flex-1 truncate text-xs text-text-muted",children:[n.restCount," provider lainnya"]}),(0,d.jsx)("span",{className:"shrink-0 tabular-nums text-xs text-text-muted",children:G(n.restPct)}),(0,d.jsx)("span",{className:"w-20 shrink-0 text-right tabular-nums text-xs text-text-muted",children:r(n.restValue)})]}):null]})]}),n.restCount>0?(0,d.jsx)("button",{type:"button",onClick:()=>k(a=>!a),className:"self-start rounded-md px-2 py-1 text-[11px] font-medium text-primary transition-colors hover:bg-primary/8 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/45",children:j?"Ringkas jadi 8 teratas":`Tampilkan semua ${n.shown.length+n.restCount} provider`}):null]})}function K({value:a,format:b,duration:c=520,className:f=""}){let g=function(a,{duration:b=420}={}){let c;!function(){let[a,b]=(0,e.useState)(!1)}();let d=Number.isFinite(c=Number(a))?c:0,f=Number.isFinite(Number(a)),[g,h]=(0,e.useState)(f?d:0);return(0,e.useRef)(f?d:0),(0,e.useRef)(f?d:0),(0,e.useRef)(null),f?g:0}(a,{duration:c});return(0,d.jsx)("span",{className:f,"data-animated-number":"",children:b?b(g):String(Math.round(g))})}function L({stats:a,mode:b,period:c,onModeChange:f,onSelectProvider:g,selectedProvider:h,nodeNames:i={},colorOf:j,donutRows:k=null,onPickProvider:l}){let m="tokens"===b,{providers:n,total:o,headCost:p,headTokens:q,headIn:r,headOut:s,headCached:t,requests:u,activeCount:v,errorProvider:A}=(0,e.useMemo)(()=>{let b=Object.entries(a?.byProvider||{}).map(([a,b])=>({id:a,requests:b?.requests||0,promptTokens:b?.promptTokens||0,completionTokens:b?.completionTokens||0,cachedTokens:b?.cachedTokens||0,tokens:(b?.promptTokens||0)+(b?.completionTokens||0),cost:b?.cost||0})).sort((a,b)=>m?b.tokens-a.tokens:b.cost-a.cost),c=a=>b.reduce((b,c)=>b+a(c),0);return{providers:b,total:c(a=>m?a.tokens:a.cost),headCost:c(a=>a.cost),headTokens:c(a=>a.tokens),headIn:c(a=>a.promptTokens),headOut:c(a=>a.completionTokens),headCached:c(a=>a.cachedTokens),requests:a?.totalRequests||0,activeCount:(a?.activeRequests||[]).reduce((a,b)=>a+(b.count||0),0),errorProvider:a?.errorProvider||null}},[a,m]),B=(0,e.useMemo)(()=>{let a=a=>m?a.tokens:a.cost;return n.filter(b=>a(b)>0||b.requests>0).map(b=>{var c;return{id:b.id,label:(c=b.id,i?.[c]?i[c]:c.length<=22?c:`${c.slice(0,14)}…`),value:a(b),pct:F(a(b),o),requests:b.requests,full:m?`${y(b.tokens)} tokens`:x(b.cost)}})},[n,m,o,i]),D=o<=0&&n.some(a=>a.requests>0),E=o>0||u>0,N=n.filter(a=>a.requests>0).length,O="tokens"===b,P=O?q:p,Q=O?z:x,R=O?p:q,S=O?x:z,T=H({input:r,output:s,cached:t,total:q}),U=F(t,r),V=F(s,q);return(0,d.jsxs)("header",{className:"min-w-0",children:[(0,d.jsxs)("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-2",children:[(0,d.jsxs)("span",{className:"text-xs font-medium text-text-muted",children:["Usage \xb7 ",I[c]||c]}),(0,d.jsx)("div",{className:"ml-auto flex items-center gap-1 rounded-lg border border-border bg-bg-subtle p-0.5",role:"group","aria-label":"What to show",children:C.map(a=>(0,d.jsx)("button",{type:"button",onClick:()=>f(a.id),"aria-pressed":b===a.id,className:["rounded-md px-2.5 py-1 text-xs font-medium transition-colors duration-150 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/45",b===a.id?"bg-primary-strong text-white shadow-sm":"text-text-muted hover:bg-bg-hover hover:text-text-main"].join(" "),children:a.label},a.id))})]}),(0,d.jsx)("p",{className:"mt-1.5 text-[0.6875rem] text-text-subtle",children:"No period-over-period comparison — the usage API returns a single aggregate series, so there is no prior period to diff against."}),k&&k.length>0?(0,d.jsx)("div",{className:"mt-5 border-t border-border-subtle pt-4",children:(0,d.jsx)(J,{rows:k,mode:b,colorOf:j,onPick:l})}):null,(0,d.jsxs)("div",{className:"mt-3 flex flex-col items-start gap-1.5",children:[(0,d.jsxs)("span",{className:"flex items-baseline gap-2",children:[E?(0,d.jsx)(K,{value:P,format:Q,className:"text-[2.75rem] font-semibold leading-none tracking-[-0.03em] tabular-nums text-text-main sm:text-[3.25rem]"}):(0,d.jsx)("span",{className:"text-[2.75rem] font-semibold leading-none tracking-[-0.03em] tabular-nums text-text-main sm:text-[3.25rem]",children:"—"}),"both"===b?(0,d.jsx)("span",{className:"text-xs font-medium uppercase tracking-wide text-text-subtle",children:O?"tokens":"cost"}):null]}),"both"===b?(0,d.jsxs)("span",{className:"flex items-baseline gap-2",children:[E?(0,d.jsx)(K,{value:R,format:S,className:"text-[1.75rem] font-semibold leading-none tracking-[-0.02em] tabular-nums text-text-main sm:text-[2rem]"}):(0,d.jsx)("span",{className:"text-[1.75rem] font-semibold leading-none tracking-[-0.02em] tabular-nums text-text-main sm:text-[2rem]",children:"—"}),(0,d.jsx)("span",{className:"text-xs font-medium uppercase tracking-wide text-text-subtle",children:O?"cost":"tokens"})]}):null,(0,d.jsxs)("span",{className:"text-sm text-text-muted",children:["costs"===b?"spent":"tokens"===b?"tokens":null,"both"!==b?(0,d.jsx)("span",{className:"mx-2 text-text-subtle",children:"\xb7"}):null,(0,d.jsx)(K,{value:u,format:z,className:"tabular-nums"})," requests",v>0?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("span",{className:"mx-2 text-text-subtle",children:"\xb7"}),(0,d.jsxs)("span",{className:"inline-flex items-center gap-1 text-primary",children:[(0,d.jsx)("span",{className:"size-1.5 animate-pulse rounded-full bg-primary","aria-hidden":"true"}),(0,d.jsx)("span",{className:"tabular-nums",children:v})," live"]})]}):null]})]}),E&&"costs"!==b&&q>0?(0,d.jsxs)("div",{className:"mt-3 max-w-2xl",children:[(0,d.jsxs)("div",{className:"flex h-1.5 w-full overflow-hidden rounded-full bg-border-subtle",children:[(0,d.jsx)("span",{className:"h-full transition-[width] duration-500",style:{flexGrow:Math.max(r-t,0),flexBasis:0,backgroundColor:"color-mix(in oklab, var(--color-primary) 30%, var(--color-surface))"}}),(0,d.jsx)("span",{className:"h-full transition-[width] duration-500",style:{flexGrow:t,flexBasis:0,minWidth:t>0?"2px":0,backgroundColor:"var(--color-primary)"}}),(0,d.jsx)("span",{className:"h-full transition-[width] duration-500",style:{flexGrow:Math.max(s,0),flexBasis:0,minWidth:s>0?"2px":0,backgroundColor:"var(--color-border)"}})]}),(0,d.jsxs)("div",{className:"mt-1.5 flex flex-wrap items-center gap-x-4 gap-y-1 text-[0.6875rem] text-text-muted",title:T,children:[(0,d.jsxs)("span",{className:"flex items-center gap-1.5",children:[(0,d.jsx)("span",{className:"size-2 shrink-0 rounded-[2px]",style:{backgroundColor:"color-mix(in oklab, var(--color-primary) 30%, var(--color-surface))"},"aria-hidden":"true"}),(0,d.jsx)(K,{value:r-t,format:z,className:"tabular-nums text-text-main"}),"uncached input"]}),t>0?(0,d.jsxs)("span",{className:"flex items-center gap-1.5",children:[(0,d.jsx)("span",{className:"size-2 shrink-0 rounded-[2px]",style:{backgroundColor:"var(--color-primary)"},"aria-hidden":"true"}),(0,d.jsx)(K,{value:t,format:z,className:"tabular-nums text-text-main"}),"cached",(0,d.jsxs)("span",{className:"text-text-subtle",children:["(",G(U)," of input)"]})]}):null,(0,d.jsxs)("span",{className:"flex items-center gap-1.5",children:[(0,d.jsx)("span",{className:"size-2 shrink-0 rounded-[2px]",style:{backgroundColor:"var(--color-border)"},"aria-hidden":"true"}),(0,d.jsx)(K,{value:s,format:z,className:"tabular-nums text-text-main"}),"output",(0,d.jsxs)("span",{className:"text-text-subtle",children:["(",G(V)," of total)"]})]})]})]}):null,D?(0,d.jsxs)("p",{className:"mt-4 text-xs text-text-muted",children:[(0,d.jsx)("span",{className:"tabular-nums",children:y(u)})," requests served by"," ",N," provider",1===N?"":"s"," at no recorded cost — switch to ",(0,d.jsx)("span",{className:"font-medium text-text-main",children:"Tokens"})," to compare their share."]}):null,!D&&E&&B.length>0?(0,d.jsxs)("div",{className:"mt-4",children:[(0,d.jsx)("div",{className:"flex h-2.5 w-full overflow-hidden rounded-full bg-border-subtle",role:"group","aria-label":"Proporsi pemakaian per provider",children:B.map(a=>{let b=h===a.id;return(0,d.jsx)("button",{type:"button",onClick:()=>g?.(b?null:a.id),title:`${a.label} — ${G(a.pct)} \xb7 ${a.full}`,"aria-label":`${a.label}, ${G(a.pct)} of total, ${a.full}`,className:["h-full min-w-0 border-0 p-0 transition-opacity duration-200 cursor-pointer hover:opacity-80 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-white/70",h&&!b?"opacity-25":"opacity-100"].join(" "),style:{flexGrow:a.pct,flexBasis:0,minWidth:"4px",backgroundColor:j(a.id,"solid")}},a.id)})}),(0,d.jsx)("div",{className:"mt-2 flex flex-wrap items-center gap-x-4 gap-y-1",children:B.map(a=>{let b=h===a.id;return(0,d.jsxs)("button",{type:"button",onClick:()=>g?.(b?null:a.id),className:["flex items-center gap-1.5 text-xs transition-colors duration-150 cursor-pointer focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/45 rounded",b?"text-text-main font-medium":"text-text-muted hover:text-text-main"].join(" "),children:[(0,d.jsx)("span",{className:"size-2 shrink-0 rounded-full",style:{backgroundColor:j(a.id,"solid")},"aria-hidden":"true"}),(0,d.jsx)("span",{className:"max-w-[9rem] truncate",children:a.label}),(0,d.jsx)("span",{className:"tabular-nums text-text-subtle",children:0===a.pct&&a.requests>0?`${w(a.requests)} req`:G(a.pct)})]},a.id)})})]}):null,A?(0,d.jsxs)("div",{className:"mt-3 flex items-center gap-2 rounded-lg border border-danger/25 bg-danger/8 px-3 py-2",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[16px] text-danger","aria-hidden":"true",children:"error"}),(0,d.jsxs)("span",{className:"text-xs text-text-main",children:[(0,d.jsx)("span",{className:"font-medium",children:A})," failed a request just now"]})]}):null,(0,d.jsx)(M,{stats:a})]})}function M({stats:a}){let b=a?.last10Minutes||[],c=Math.max(1,...b.map(a=>a?.requests||0)),e=b.reduce((a,b)=>a+(b?.requests||0),0);return(0,d.jsxs)("div",{className:"mt-4 flex items-center gap-3",children:[(0,d.jsx)("span",{className:"shrink-0 text-[0.6875rem] font-medium uppercase tracking-wide text-text-subtle",children:"Live flow"}),(0,d.jsx)("div",{className:"flex h-5 min-w-0 flex-1 items-end gap-[3px]","aria-hidden":"true",children:b.length>0?b.map((a,b)=>{let e=a?.requests||0,f=e>0?Math.max(12,e/c*100):6;return(0,d.jsx)("span",{className:"min-w-0 flex-1 rounded-[2px] transition-[height] duration-500",style:{height:`${f}%`,backgroundColor:e>0?"var(--color-primary)":"var(--color-border)",opacity:e>0?.35+e/c*.65:1,transitionTimingFunction:"cubic-bezier(.2,.8,.2,1)"}},b)}):(0,d.jsx)("span",{className:"h-full w-full rounded-[2px] bg-border-subtle"})}),(0,d.jsx)("span",{className:"shrink-0 text-[0.6875rem] tabular-nums text-text-subtle",children:e>0?`${w(e)} req / 10m`:"idle"})]})}function N(a,b){if(!a)return"—";let c=b?.[a];return c||(a.length<=22?a:`${a.slice(0,14)}…`)}function O({stats:a,nodeNames:b={}}){let c=a?.activeRequests||[],f=(a?.recentRequests||[]).slice(0,8),g=c.reduce((a,b)=>a+(b.count||0),0),[h,i]=(0,e.useState)(()=>Date.now());return(0,d.jsxs)("section",{"aria-label":"Live requests",className:"min-w-0 rounded-[14px] border border-border bg-surface px-4 py-3",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)("span",{className:"relative flex size-2","aria-hidden":"true",children:g>0?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("span",{className:"absolute inline-flex h-full w-full animate-ping rounded-full bg-primary opacity-60"}),(0,d.jsx)("span",{className:"relative inline-flex size-2 rounded-full bg-primary"})]}):(0,d.jsx)("span",{className:"relative inline-flex size-2 rounded-full bg-border"})}),(0,d.jsx)("h3",{className:"text-xs font-semibold text-text-main",children:"Live"}),(0,d.jsx)("span",{className:"text-[0.6875rem] tabular-nums text-text-muted",children:g>0?`${g} running`:"idle"})]}),g>0?(0,d.jsx)("ul",{className:"mt-2 flex min-w-0 flex-col divide-y divide-border-subtle",children:c.map((a,c)=>{let e=a.inputEstimated?"~":"";return(0,d.jsxs)("li",{className:"flex min-w-0 items-baseline gap-3 py-1.5",children:[(0,d.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,d.jsx)("p",{className:"truncate text-xs font-medium text-text-main",title:a.model,children:a.model||"—"}),(0,d.jsxs)("p",{className:"truncate text-[0.6875rem] text-text-muted",children:[N(a.provider,b),a.account?` \xb7 ${a.account}`:""]})]}),(0,d.jsxs)("div",{className:"shrink-0 text-right",children:[(0,d.jsxs)("p",{className:"text-xs tabular-nums text-text-main",title:a.inputEstimated?"Estimated from request size — real count arrives with the first usage chunk":D(a.startedAt),children:[(0,d.jsx)("span",{className:"text-text-muted",children:"↓"})," ",e,(0,d.jsx)(K,{value:a.inputTokens,format:z})," ",(0,d.jsx)("span",{className:"text-text-muted",children:"↑"})," ",(0,d.jsx)(K,{value:a.outputTokens,format:z})]}),(0,d.jsx)("p",{className:"text-[0.6875rem] tabular-nums text-text-subtle",children:a.startedAt?(0,d.jsx)("time",{dateTime:a.startedAt,title:E(a.startedAt),children:function(a,b,c){let d=a?Date.parse(a):NaN,e=Number.isFinite(d)?Math.max(0,c-d):b;if(null==e||!Number.isFinite(e)||e<0)return"—";let f=Math.floor(e/1e3);if(f<60)return`${f}s`;let g=Math.floor(f/60);if(g<60)return`${g}m ${String(f%60).padStart(2,"0")}s`;let h=Math.floor(g/60);return h<24?`${h}h ${String(g%60).padStart(2,"0")}m`:`${Math.floor(h/24)}d ${h%24}h`}(a.startedAt,a.elapsedMs,h)}):"—"})]})]},`${a.model}|${a.provider}|${a.account}|${a.startedAt||"?"}|${c}`)})}):(0,d.jsx)("p",{className:"mt-1.5 text-xs text-text-muted",children:"No running requests — new ones appear here the moment they start."}),(0,d.jsxs)("div",{className:"mt-3 flex items-center gap-2 border-t border-border-subtle pt-3",children:[(0,d.jsx)("h3",{className:"text-xs font-semibold text-text-main",children:"Recent"}),(0,d.jsx)("span",{className:"text-[0.6875rem] text-text-muted",children:"latest finished requests"})]}),f.length>0?(0,d.jsx)("ul",{className:"mt-1.5 flex min-w-0 flex-col divide-y divide-border-subtle",children:f.map((a,c)=>(0,d.jsxs)("li",{className:"flex min-w-0 items-baseline gap-3 py-1.5",children:[(0,d.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,d.jsxs)("p",{className:"truncate text-xs text-text-main",title:a.model,children:[a.model||"—",(0,d.jsx)("span",{className:"ml-1.5 font-normal text-text-muted",children:N(a.provider,b)})]}),a.account?(0,d.jsx)("p",{className:"truncate text-[0.6875rem] text-text-subtle",children:a.account}):null]}),(0,d.jsxs)("p",{className:"shrink-0 text-xs tabular-nums text-text-muted",title:y(a.totalTokens),children:[(0,d.jsx)(K,{value:a.totalTokens,format:z})," tok"]}),(0,d.jsx)("p",{className:"w-16 shrink-0 text-right text-[0.6875rem] tabular-nums text-text-subtle",children:(0,d.jsx)("time",{dateTime:a.timestamp,title:`${E(a.timestamp)} — ${D(a.timestamp)}`,children:function(a,b){let c="number"==typeof a?a:Date.parse(a);if(!Number.isFinite(c))return"—";let d=Math.max(0,Math.floor((b-c)/1e3));if(d<60)return`${d}s ago`;let e=Math.floor(d/60);if(e<60)return`${e}m ago`;let f=Math.floor(e/60);return f<24?`${f}h ago`:`${Math.floor(f/24)}d ago`}(a.timestamp,h)})})]},`${a.timestamp}|${a.model}|${a.provider}|${a.totalTokens}|${c}`))}):(0,d.jsx)("p",{className:"mt-1.5 text-xs text-text-muted",children:"No finished requests recorded yet."})]})}function P({points:a,mode:b="costs",onPickDay:c=null}){let[f,g]=(0,e.useState)(null),h=a=>"tokens"===b?a.tokens:a.cost,{days:i,max:j,total:k,activeDays:l}=(0,e.useMemo)(()=>{let b=Array.isArray(a)?a:[],c=b.map(h);return{days:b,max:Math.max(0,...c),total:c.reduce((a,b)=>a+b,0),activeDays:c.filter(a=>a>0).length}},[a,b]);if(!i.length)return(0,d.jsxs)("div",{className:"flex min-w-0 flex-col gap-2",children:[(0,d.jsx)("p",{className:"text-xs font-medium uppercase tracking-wide text-text-muted",children:"Aktivitas"}),(0,d.jsx)("p",{className:"text-xs text-text-muted",children:"Belum ada data harian pada periode ini."})]});let m={kosong:{bg:"var(--color-border-subtle)"},rendah:{bg:"oklch(0.62 0.17 262 / 0.22)"},sedang:{bg:"oklch(0.62 0.17 262 / 0.45)"},tinggi:{bg:"oklch(0.62 0.17 262 / 0.70)"},puncak:{bg:"oklch(0.62 0.17 262 / 1)"}},n=a=>"tokens"===b?a.toLocaleString("en-US"):`$${Number(a).toFixed(2)}`,o=f?i[f]:null;return(0,d.jsxs)("div",{className:"flex min-w-0 flex-col gap-2",children:[(0,d.jsxs)("div",{className:"flex flex-wrap items-baseline justify-between gap-2",children:[(0,d.jsx)("h3",{className:"text-xs font-medium uppercase tracking-wide text-text-muted",children:"Aktivitas"}),(0,d.jsxs)("span",{className:"text-[10px] text-text-subtle",children:[l," dari ",i.length," hari terpakai"]})]}),(0,d.jsx)("div",{className:"flex flex-wrap gap-[3px]",onMouseLeave:()=>g(null),role:"img","aria-label":`Aktivitas harian selama ${i.length} hari. Hari terberat: ${n(j)}.`,children:i.map((a,b)=>{let e=(a=>{if(!a||a<=0)return"kosong";let b=j>0?a/j:0;return b>.75?"puncak":b>.5?"tinggi":b>.25?"sedang":"rendah"})(h(a));return(0,d.jsx)("button",{type:"button",onMouseEnter:()=>g(b),onFocus:()=>g(b),onBlur:()=>g(null),onClick:c?()=>c(a):void 0,className:"size-3 rounded-[3px] transition-transform hover:scale-125 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/45",style:{backgroundColor:m[e].bg},"aria-label":`${a.label}: ${n(h(a))}`},`${a.label}-${b}`)})}),(0,d.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,d.jsx)("p",{className:"min-w-0 flex-1 truncate text-[11px] text-text-muted",children:o?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("span",{className:"text-text-main",children:o.label})," \xb7 ",(0,d.jsx)("span",{className:"text-text-main",children:n(h(o))}),"tokens"!==b&&o.tokens?` \xb7 ${o.tokens.toLocaleString("en-US")} token`:null]}):(0,d.jsx)(d.Fragment,{children:"Pekatnya warna = besarnya pemakaian hari itu"})}),(0,d.jsxs)("div",{className:"flex shrink-0 items-center gap-1","aria-hidden":"true",children:[(0,d.jsx)("span",{className:"text-[10px] text-text-subtle",children:"ringan"}),["rendah","sedang","tinggi","puncak"].map(a=>(0,d.jsx)("span",{className:"size-2.5 rounded-[2px]",style:{backgroundColor:m[a].bg}},a)),(0,d.jsx)("span",{className:"text-[10px] text-text-subtle",children:"berat"})]})]})]})}function Q(a,b){let c=360;for(let d of b){let b=Math.abs(d-a);c=Math.min(c,Math.min(b,360-b))}return c}let R="cubic-bezier(.2,.8,.2,1)";function S({title:a,meta:b,count:c,countValue:f,countFormat:g,countSecondary:h,countSecondaryValue:i,countSecondaryFormat:j,accent:k=!1,depth:l=0,folded:m=!1,defaultOpen:n=!1,open:o,onOpenChange:p,children:q,actions:r}){let[s,t]=(0,e.useState)(n),u=void 0!==o,v=u?o:s,w=(0,e.useId)();return(0,d.jsxs)("section",{className:"min-w-0",style:{marginLeft:l>0?`${14*l}px`:void 0},children:[m?(0,d.jsx)("div",{className:"mb-1 ml-3 border-t border-border-subtle","aria-hidden":"true"}):null,(0,d.jsx)("h3",{className:"m-0",children:(0,d.jsxs)("button",{type:"button",onClick:()=>{let a=!v;u||t(a),p?.(a)},"aria-expanded":v,"aria-controls":w,className:["group flex w-full items-center gap-3 rounded-[10px] px-3 py-2.5 text-left transition-colors duration-150 hover:bg-bg-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/45",v?"bg-bg-subtle":"bg-transparent"].join(" "),children:[(0,d.jsx)("span",{className:"material-symbols-outlined shrink-0 text-[18px] text-text-subtle transition-transform",style:{transform:v?"rotate(90deg)":"rotate(0deg)",transitionDuration:"240ms",transitionTimingFunction:R},"aria-hidden":"true",children:"chevron_right"}),(0,d.jsx)("span",{className:["shrink-0 text-sm font-semibold tracking-tight",k?"text-primary":"text-text-main"].join(" "),children:a}),b?(0,d.jsx)("span",{className:"min-w-0 truncate text-xs text-text-muted",children:b}):null,(0,d.jsxs)("span",{className:"ml-auto flex shrink-0 items-center gap-2",children:[r?(0,d.jsx)("span",{onClick:a=>a.stopPropagation(),onKeyDown:a=>a.stopPropagation(),className:"flex items-center gap-1",children:r}):null,null!=c?(0,d.jsxs)("span",{className:"flex shrink-0 items-baseline gap-2 text-right",children:[h?null!=i&&j?(0,d.jsx)(K,{value:i,format:j,className:"text-xs tabular-nums text-text-subtle"}):(0,d.jsx)("span",{className:"text-xs tabular-nums text-text-subtle",children:h}):null,null!=f&&g?(0,d.jsx)(K,{value:f,format:g,className:"min-w-[4.5rem] text-right text-sm font-medium tabular-nums text-text-main"}):(0,d.jsx)("span",{className:"min-w-[4.5rem] text-right text-sm font-medium tabular-nums text-text-main",children:c})]}):null]})]})}),(0,d.jsx)("div",{id:w,className:"grid min-w-0",style:{gridTemplateRows:v?"1fr":"0fr",transition:`grid-template-rows 240ms ${R}`},children:(0,d.jsx)("div",{className:"min-w-0 overflow-hidden",children:(0,d.jsx)("div",{className:"pb-2 pl-[42px] pr-1 pt-1",children:q})})})]})}function T({label:a,sublabel:b,value:c,valueRaw:f,valueFormat:g,valueSecondary:h,valueSecondaryRaw:i,valueSecondaryFormat:j,detail:k,barValue:l,onSelect:m,selected:n=!1,status:o,trailing:p}){let q=(0,e.useId)(),r="error"===o?"var(--color-danger)":"active"===o?"var(--color-success)":null,s="function"==typeof m,t=(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("span",{className:"flex min-w-0 items-baseline gap-2",children:[r?(0,d.jsx)("span",{className:"size-1.5 shrink-0 translate-y-[-2px] rounded-full",style:{backgroundColor:r},"aria-hidden":"true"}):null,(0,d.jsx)("span",{className:"min-w-0 truncate text-sm text-text-main",children:a}),b?(0,d.jsx)("span",{className:"min-w-0 shrink truncate text-xs text-text-subtle",children:b}):null]}),(0,d.jsx)("span",{className:"relative mt-1.5 block h-[3px] w-full overflow-hidden rounded-full bg-border-subtle",children:null!=l?(0,d.jsx)("span",{className:"absolute inset-y-0 left-0 rounded-full transition-[width] duration-500",style:{width:`${Math.max(l,1.5*(l>0))}%`,backgroundColor:"error"===o?"var(--color-danger)":"var(--color-primary)",transitionTimingFunction:R}}):null}),(0,d.jsxs)("span",{className:"ml-auto flex shrink-0 items-baseline gap-2 pl-3",children:[p,(0,d.jsxs)("span",{className:"flex min-w-[4.5rem] items-baseline justify-end gap-2 text-right",children:[h?null!=i&&j?(0,d.jsx)(K,{value:i,format:j,className:"text-xs tabular-nums text-text-subtle"}):(0,d.jsx)("span",{className:"text-xs tabular-nums text-text-subtle",children:h}):null,(0,d.jsx)("span",{className:["rounded-sm focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/45",k?"cursor-help underline decoration-dotted decoration-text-subtle/60 underline-offset-4":""].join(" "),tabIndex:k?0:void 0,title:k||void 0,"aria-describedby":k?q:void 0,children:null!=f&&g?(0,d.jsx)(K,{value:f,format:g,className:"text-sm font-medium tabular-nums text-text-main"}):(0,d.jsx)("span",{className:"value-fade text-sm font-medium tabular-nums text-text-main",children:c},String(c))}),k?(0,d.jsx)("span",{id:q,className:"sr-only",children:k}):null]})]})]});return s?(0,d.jsx)("button",{type:"button",onClick:m,"aria-pressed":n,className:["flex w-full min-w-0 items-start gap-2 rounded-lg px-2 py-2 text-left transition-colors duration-150 hover:bg-bg-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/45",n?"bg-primary/8 ring-1 ring-inset ring-primary/25":""].join(" "),children:t}):(0,d.jsx)("div",{className:"flex min-w-0 items-start gap-2 rounded-lg px-2 py-2",children:t})}function U({query:a,onQueryChange:b,activeFilter:c,onClearFilter:f,resultCount:g,totalCount:h}){let i=(0,e.useRef)(null),j=a.trim().length>0;return(0,d.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,d.jsxs)("div",{className:"relative min-w-0 flex-1 sm:max-w-xs",children:[(0,d.jsx)("span",{className:"material-symbols-outlined pointer-events-none absolute left-2.5 top-1/2 -translate-y-1/2 text-[16px] text-text-subtle","aria-hidden":"true",children:"search"}),(0,d.jsx)("input",{ref:i,type:"search",value:a,onChange:a=>b(a.target.value),placeholder:"Search provider, model, account…","aria-label":"Search usage across all dimensions",className:"w-full rounded-lg border border-border bg-surface py-1.5 pl-8 pr-8 text-sm text-text-main placeholder:text-text-subtle transition-colors duration-150 hover:border-text-subtle/40 focus:border-primary/60 focus:outline-none focus:ring-2 focus:ring-primary/25"}),j?(0,d.jsx)("button",{type:"button",onClick:()=>{b(""),i.current?.focus()},"aria-label":"Clear search",className:"absolute right-2 top-1/2 flex -translate-y-1/2 items-center rounded p-0.5 text-text-subtle transition-colors hover:text-text-main focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/45",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-[16px]","aria-hidden":"true",children:"close"})}):(0,d.jsx)("kbd",{className:"pointer-events-none absolute right-2.5 top-1/2 hidden -translate-y-1/2 rounded border border-border px-1.5 text-[10px] font-medium text-text-subtle sm:block","aria-hidden":"true",children:"/"})]}),c?(0,d.jsxs)("button",{type:"button",onClick:f,className:"flex items-center gap-1.5 rounded-lg border border-primary/30 bg-primary/8 px-2.5 py-1.5 text-xs font-medium text-primary transition-colors hover:bg-primary/15 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/45",title:"Remove provider filter",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px]","aria-hidden":"true",children:"filter_alt"}),(0,d.jsx)("span",{className:"max-w-[10rem] truncate",children:c}),(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px]","aria-hidden":"true",children:"close"})]}):null,j||c?(0,d.jsxs)("span",{className:"text-xs tabular-nums text-text-muted",role:"status","aria-live":"polite",children:[g," of ",h]}):null]})}var V=c(48679),W=c(85165),X=c(5277),Y=c(22393),Z=c(54206),$=c(96317),_=c(66355),aa=c(99314),ab=c(91184),ac=c(76316),ad=c(40948),ae=c(56280),af=c(16216),ag=c(1791);function ah(a,b){var c=Object.keys(a);if(Object.getOwnPropertySymbols){var d=Object.getOwnPropertySymbols(a);b&&(d=d.filter(function(b){return Object.getOwnPropertyDescriptor(a,b).enumerable})),c.push.apply(c,d)}return c}function ai(a){for(var b=1;b<arguments.length;b++){var c=null!=arguments[b]?arguments[b]:{};b%2?ah(Object(c),!0).forEach(function(b){var d,e,f;d=a,e=b,f=c[b],(e=function(a){var b=function(a,b){if("object"!=typeof a||!a)return a;var c=a[Symbol.toPrimitive];if(void 0!==c){var d=c.call(a,b||"default");if("object"!=typeof d)return d;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===b?String:Number)(a)}(a,"string");return"symbol"==typeof b?b:b+""}(e))in d?Object.defineProperty(d,e,{value:f,enumerable:!0,configurable:!0,writable:!0}):d[e]=f}):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(c)):ah(Object(c)).forEach(function(b){Object.defineProperty(a,b,Object.getOwnPropertyDescriptor(c,b))})}return a}var aj=["Webkit","Moz","O","ms"],ak=c(62554),al=(0,e.createContext)(()=>{}),am=c(32671),an=c(41125);c(14277);var ao=c(70383),ap=c(90170),aq=c(96129),ar=c(69599),as=c(70719);function at(){return(at=Object.assign?Object.assign.bind():function(a){for(var b=1;b<arguments.length;b++){var c=arguments[b];for(var d in c)({}).hasOwnProperty.call(c,d)&&(a[d]=c[d])}return a}).apply(null,arguments)}function au(a,b){var c=Object.keys(a);if(Object.getOwnPropertySymbols){var d=Object.getOwnPropertySymbols(a);b&&(d=d.filter(function(b){return Object.getOwnPropertyDescriptor(a,b).enumerable})),c.push.apply(c,d)}return c}function av(a){for(var b=1;b<arguments.length;b++){var c=null!=arguments[b]?arguments[b]:{};b%2?au(Object(c),!0).forEach(function(b){aw(a,b,c[b])}):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(c)):au(Object(c)).forEach(function(b){Object.defineProperty(a,b,Object.getOwnPropertyDescriptor(c,b))})}return a}function aw(a,b,c){var d;return(b="symbol"==typeof(d=function(a,b){if("object"!=typeof a||!a)return a;var c=a[Symbol.toPrimitive];if(void 0!==c){var d=c.call(a,b||"default");if("object"!=typeof d)return d;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===b?String:Number)(a)}(b,"string"))?d:d+"")in a?Object.defineProperty(a,b,{value:c,enumerable:!0,configurable:!0,writable:!0}):a[b]=c,a}function ax(a){var b=a.x,c=a.y,d=a.width,f=a.height,g=a.stroke,h=Math.floor(c+f/2)-1;return e.createElement(e.Fragment,null,e.createElement("rect",{x:b,y:c,width:d,height:f,fill:g,stroke:"none"}),e.createElement("line",{x1:b+1,y1:h,x2:b+d-1,y2:h,fill:"none",stroke:"#fff"}),e.createElement("line",{x1:b+1,y1:h+2,x2:b+d-1,y2:h+2,fill:"none",stroke:"#fff"}))}function ay(a){var b=a.travellerProps,c=a.travellerType;return e.isValidElement(c)?e.cloneElement(c,b):"function"==typeof c?c(b):e.createElement(ax,b)}function az(a){if((0,ag.n9)(a)&&"object"==typeof a&&"name"in a&&"string"==typeof a.name)return a.name}function aA(a){var b,c,d=a.otherProps,f=a.travellerX,g=a.id,h=a.onMouseEnter,i=a.onMouseLeave,j=a.onMouseDown,k=a.onTouchStart,l=a.onTravellerMoveKeyboard,m=a.onFocus,n=a.onBlur,o=d.y,p=d.x,q=d.travellerWidth,r=d.height,s=d.traveller,t=d.ariaLabel,u=d.data,v=d.startIndex,w=d.endIndex,x=Math.max(f,p),y=av(av({},(0,as.uZ)(d)),{},{x,y:o,width:q,height:r}),z=t||(b=az(u[v]),c=az(u[w]),"Min value: ".concat(b,", Max value: ").concat(c));return e.createElement(ad.W,{tabIndex:0,role:"slider","aria-label":z,"aria-valuenow":f,className:"recharts-brush-traveller",onMouseEnter:h,onMouseLeave:i,onMouseDown:j,onTouchStart:k,onKeyDown:a=>{["ArrowLeft","ArrowRight"].includes(a.key)&&(a.preventDefault(),a.stopPropagation(),l("ArrowRight"===a.key?1:-1,g))},onFocus:m,onBlur:n,style:{cursor:"col-resize"}},e.createElement(ay,{travellerType:s,travellerProps:y}))}function aB(a){var b=a.index,c=a.data,d=a.tickFormatter,e=a.dataKey,f=(0,af.kr)(c[b],e,b);return"function"==typeof d?d(f,b):f}function aC(a,b){for(var c=a.length,d=0,e=c-1;e-d>1;){var f=Math.floor((d+e)/2),g=a[f];null!=g&&g>b?e=f:d=f}var h=a[e];return null!=h&&b>=h?e:d}function aD(a){var b=a.startX,c=a.endX,d=a.scaleValues,e=a.gap,f=a.data.length-1,g=Math.min(b,c),h=Math.max(b,c),i=aC(d,g),j=aC(d,h);return{startIndex:i-i%e,endIndex:j===f?f:j-j%e}}function aE(a){var b=a.x,c=a.y,d=a.width,f=a.height,g=a.fill,h=a.stroke;return e.createElement("rect",{stroke:h,fill:g,x:b,y:c,width:d,height:f})}function aF(a){var b=a.startIndex,c=a.endIndex,d=a.y,f=a.height,g=a.travellerWidth,h=a.stroke,i=a.tickFormatter,j=a.dataKey,k=a.data,l=a.startX,m=a.endX,n={pointerEvents:"none",fill:h};return e.createElement(ad.W,{className:"recharts-brush-texts"},e.createElement(ae.EY,at({textAnchor:"end",verticalAnchor:"middle",x:Math.min(l,m)-5,y:d+f/2},n),aB({index:b,tickFormatter:i,dataKey:j,data:k})),e.createElement(ae.EY,at({textAnchor:"start",verticalAnchor:"middle",x:Math.max(l,m)+g+5,y:d+f/2},n),aB({index:c,tickFormatter:i,dataKey:j,data:k})))}function aG(a){var b=a.y,c=a.height,d=a.stroke,f=a.travellerWidth,g=a.startX,h=a.endX,i=a.onMouseEnter,j=a.onMouseLeave,k=a.onMouseDown,l=a.onTouchStart,m=Math.min(g,h)+f,n=Math.max(Math.abs(h-g)-f,0);return e.createElement("rect",{className:"recharts-brush-slide",onMouseEnter:i,onMouseLeave:j,onMouseDown:k,onTouchStart:l,style:{cursor:"move"},stroke:"none",fill:d,fillOpacity:.2,x:m,y:b,width:n,height:c})}function aH(a){var b=a.x,c=a.y,d=a.width,f=a.height,g=a.data,h=a.children,i=a.padding;if(1!==e.Children.count(h))return null;var j=e.Children.only(h);return j?e.cloneElement(j,{x:b,y:c,width:d,height:f,margin:i,compact:!0,data:g}):null}var aI=a=>a.changedTouches&&!!a.changedTouches.length;class aJ extends e.PureComponent{constructor(a){super(a),aw(this,"handleDrag",a=>{this.leaveTimer&&(clearTimeout(this.leaveTimer),this.leaveTimer=null),this.state.isTravellerMoving?this.handleTravellerMove(a):this.state.isSlideMoving&&this.handleSlideDrag(a)}),aw(this,"handleTouchMove",a=>{var b,c=null==(b=a.changedTouches)?void 0:b[0];null!=c&&this.handleDrag(c)}),aw(this,"handleDragEnd",()=>{this.setState({isTravellerMoving:!1,isSlideMoving:!1},()=>{var a=this.props,b=a.endIndex,c=a.onDragEnd,d=a.startIndex;null==c||c({endIndex:b,startIndex:d})}),this.detachDragEndListener()}),aw(this,"handleLeaveWrapper",()=>{(this.state.isTravellerMoving||this.state.isSlideMoving)&&(this.leaveTimer=window.setTimeout(this.handleDragEnd,this.props.leaveTimeOut))}),aw(this,"handleEnterSlideOrTraveller",()=>{this.setState({isTextActive:!0})}),aw(this,"handleLeaveSlideOrTraveller",()=>{this.setState({isTextActive:!1})}),aw(this,"handleSlideDragStart",a=>{var b=aI(a)?a.changedTouches[0]:a;null!=b&&(this.setState({isTravellerMoving:!1,isSlideMoving:!0,slideMoveStartX:b.pageX}),this.attachDragEndListener())}),aw(this,"handleTravellerMoveKeyboard",(a,b)=>{var c=this.props,d=c.data,e=c.gap,f=c.startIndex,g=c.endIndex,h=this.state,i=h.scaleValues,j=h.startX,k=h.endX;if(null==i)return;var l=-1;if("startX"===b?l=f:"endX"===b&&(l=g),!(l<0)&&!(l>=d.length)){var m=l+a;if(-1!==m&&!(m>=i.length)){var n=i[m];null==n||"startX"===b&&n>=k||"endX"===b&&n<=j||this.setState({[b]:n},()=>{this.props.onChange(aD({startX:this.state.startX,endX:this.state.endX,data:d,gap:e,scaleValues:i}))})}}}),this.travellerDragStartHandlers={startX:this.handleTravellerDragStart.bind(this,"startX"),endX:this.handleTravellerDragStart.bind(this,"endX")},this.state={brushMoveStartX:0,movingTravellerId:void 0,endX:0,startX:0,slideMoveStartX:0}}static getDerivedStateFromProps(a,b){var c=a.data,d=a.width,e=a.x,f=a.travellerWidth,g=a.startIndex,h=a.endIndex,i=a.startIndexControlledFromProps,j=a.endIndexControlledFromProps;if(c!==b.prevData)return av({prevData:c,prevTravellerWidth:f,prevX:e,prevWidth:d,prevStartIndexControlledFromProps:i,prevEndIndexControlledFromProps:j},c&&c.length?(a=>{var b=a.data,c=a.startIndex,d=a.endIndex,e=a.x,f=a.width,g=a.travellerWidth;if(!b||!b.length)return{};var h=b.length,i=(0,ab.z)().domain((0,ac.y)(0,h)).range([e,e+f-g]),j=i.domain().map(a=>i(a)).filter(ag.n9);return{isTextActive:!1,isSlideMoving:!1,isTravellerMoving:!1,isTravellerFocused:!1,startX:i(c),endX:i(d),scale:i,scaleValues:j}})({data:c,width:d,x:e,travellerWidth:f,startIndex:g,endIndex:h}):{scale:void 0,scaleValues:void 0});var k=b.scale;if(k&&(d!==b.prevWidth||e!==b.prevX||f!==b.prevTravellerWidth)){k.range([e,e+d-f]);var l=k.domain().map(a=>k(a)).filter(a=>null!=a);return{prevData:c,prevTravellerWidth:f,prevX:e,prevWidth:d,startX:k(a.startIndex),endX:k(a.endIndex),scaleValues:l}}if(b.scale&&!b.isSlideMoving&&!b.isTravellerMoving&&!b.isTravellerFocused&&!b.isTextActive){if(null!=i&&b.prevStartIndexControlledFromProps!==i)return{startX:b.scale(i),prevStartIndexControlledFromProps:i};if(null!=j&&b.prevEndIndexControlledFromProps!==j)return{endX:b.scale(j),prevEndIndexControlledFromProps:j}}return null}componentWillUnmount(){this.leaveTimer&&(clearTimeout(this.leaveTimer),this.leaveTimer=null),this.detachDragEndListener()}attachDragEndListener(){window.addEventListener("mouseup",this.handleDragEnd,!0),window.addEventListener("touchend",this.handleDragEnd,!0),window.addEventListener("mousemove",this.handleDrag,!0)}detachDragEndListener(){window.removeEventListener("mouseup",this.handleDragEnd,!0),window.removeEventListener("touchend",this.handleDragEnd,!0),window.removeEventListener("mousemove",this.handleDrag,!0)}handleSlideDrag(a){var b=this.state,c=b.slideMoveStartX,d=b.startX,e=b.endX,f=b.scaleValues;if(null!=f){var g=this.props,h=g.x,i=g.width,j=g.travellerWidth,k=g.startIndex,l=g.endIndex,m=g.onChange,n=g.data,o=g.gap,p=a.pageX-c;p>0?p=Math.min(p,h+i-j-e,h+i-j-d):p<0&&(p=Math.max(p,h-d,h-e));var q=aD({startX:d+p,endX:e+p,data:n,gap:o,scaleValues:f});(q.startIndex!==k||q.endIndex!==l)&&m&&m(q),this.setState({startX:d+p,endX:e+p,slideMoveStartX:a.pageX})}}handleTravellerDragStart(a,b){var c=aI(b)?b.changedTouches[0]:b;null!=c&&(this.setState({isSlideMoving:!1,isTravellerMoving:!0,movingTravellerId:a,brushMoveStartX:c.pageX}),this.attachDragEndListener())}handleTravellerMove(a){var b=this.state,c=b.brushMoveStartX,d=b.movingTravellerId,e=b.endX,f=b.startX,g=b.scaleValues;if(null!=d&&null!=g){var h=this.state[d],i=this.props,j=i.x,k=i.width,l=i.travellerWidth,m=i.onChange,n=i.gap,o=i.data,p={startX:this.state.startX,endX:this.state.endX,data:o,gap:n,scaleValues:g},q=a.pageX-c;q>0?q=Math.min(q,j+k-l-h):q<0&&(q=Math.max(q,j-h)),p[d]=h+q;var r=aD(p),s=r.startIndex,t=r.endIndex;this.setState({[d]:h+q,brushMoveStartX:a.pageX},()=>{var a;m&&(a=o.length-1,"startX"===d&&(e>f?s%n==0:t%n==0)||e<f&&t===a||"endX"===d&&(e>f?t%n==0:s%n==0)||e>f&&t===a||0)&&m(r)})}}render(){var a=this.props,b=a.data,c=a.className,d=a.children,f=a.x,g=a.y,h=a.dy,i=a.width,j=a.height,k=a.alwaysShowText,l=a.fill,m=a.stroke,n=a.startIndex,o=a.endIndex,p=a.travellerWidth,q=a.tickFormatter,r=a.dataKey,s=a.padding,t=this.state,u=t.startX,v=t.endX,w=t.isTextActive,x=t.isSlideMoving,y=t.isTravellerMoving,z=t.isTravellerFocused;if(!b||!b.length||!(0,ag.Et)(f)||!(0,ag.Et)(g)||!(0,ag.Et)(i)||!(0,ag.Et)(j)||i<=0||j<=0)return null;var A=(0,aa.$)("recharts-brush",c),B=((a,b)=>{if(a){var c=a.replace(/(\w)/,a=>a.toUpperCase()),d=aj.reduce((a,d)=>ai(ai({},a),{},{[d+c]:b}),{});return d[a]=b,d}})("userSelect","none"),C=g+(null!=h?h:0);return e.createElement(ad.W,{className:A,onMouseLeave:this.handleLeaveWrapper,onTouchMove:this.handleTouchMove,style:B},e.createElement(aE,{x:f,y:C,width:i,height:j,fill:l,stroke:m}),e.createElement(ao.U,null,e.createElement(aH,{x:f,y:C,width:i,height:j,data:b,padding:s},d)),e.createElement(aG,{y:C,height:j,stroke:m,travellerWidth:p,startX:u,endX:v,onMouseEnter:this.handleEnterSlideOrTraveller,onMouseLeave:this.handleLeaveSlideOrTraveller,onMouseDown:this.handleSlideDragStart,onTouchStart:this.handleSlideDragStart}),e.createElement(aA,{travellerX:u,id:"startX",otherProps:av(av({},this.props),{},{y:C}),onMouseEnter:this.handleEnterSlideOrTraveller,onMouseLeave:this.handleLeaveSlideOrTraveller,onMouseDown:this.travellerDragStartHandlers.startX,onTouchStart:this.travellerDragStartHandlers.startX,onTravellerMoveKeyboard:this.handleTravellerMoveKeyboard,onFocus:()=>{this.setState({isTravellerFocused:!0})},onBlur:()=>{this.setState({isTravellerFocused:!1})}}),e.createElement(aA,{travellerX:v,id:"endX",otherProps:av(av({},this.props),{},{y:C}),onMouseEnter:this.handleEnterSlideOrTraveller,onMouseLeave:this.handleLeaveSlideOrTraveller,onMouseDown:this.travellerDragStartHandlers.endX,onTouchStart:this.travellerDragStartHandlers.endX,onTravellerMoveKeyboard:this.handleTravellerMoveKeyboard,onFocus:()=>{this.setState({isTravellerFocused:!0})},onBlur:()=>{this.setState({isTravellerFocused:!1})}}),(w||x||y||z||k)&&e.createElement(aF,{startIndex:n,endIndex:o,y:C,height:j,travellerWidth:p,stroke:m,tickFormatter:q,dataKey:r,data:b,startX:u,endX:v}))}}function aK(a){var b=(0,am.j)(),c=(0,ak.Oo)(),d=(0,ak.eE)(),f=(0,e.useContext)(al),g=a.onChange,h=a.startIndex,i=a.endIndex;(0,aq.fx)();var j=(0,e.useCallback)(a=>{if(null!=d){var c=d.startIndex,e=d.endIndex;(a.startIndex!==c||a.endIndex!==e)&&(null==f||f(a),null==g||g(a),b((0,an.M)(a)))}},[g,f,b,d]),k=(0,am.G)(ap.U);if(null==k||null==d||null==c||!c.length)return null;var l=d.startIndex,m=d.endIndex,n=k.x,o=k.y,p=k.width;return e.createElement(aJ,at({},a,{data:c,x:n,y:o,width:p,startIndex:l,endIndex:m,onChange:j},{startIndexControlledFromProps:null!=h?h:void 0,endIndexControlledFromProps:null!=i?i:void 0}))}function aL(a){return(0,am.j)(),null}var aM={height:40,travellerWidth:5,gap:1,fill:"#fff",stroke:"#666",padding:{top:1,right:1,bottom:1,left:1},leaveTimeOut:1e3,alwaysShowText:!1};function aN(a){var b=(0,ar.e)(a,aM);return e.createElement(e.Fragment,null,e.createElement(aL,{height:b.height,x:b.x,y:b.y,width:b.width,padding:b.padding}),e.createElement(aK,b))}function aO({period:a,mode:b}){let[c,f]=(0,e.useState)([]),[g,h]=(0,e.useState)(null),[i,j]=(0,e.useState)(null),k=g!==a,l=i?.period===a?i:null,m="tokens"===b?"tokens":"cost",n="tokens"===b?w:x,o="tokens"===b?A:x,p=c.some(a=>(a?.[m]||0)>0),q=(0,e.useMemo)(()=>l?c.slice(l.startIndex,l.endIndex+1):c,[c,l]),r=(0,e.useMemo)(()=>{if(0===q.length)return null;let a=0,b={value:0,label:null};for(let c of q){let d=c?.[m]||0;a+=d,d>b.value&&(b={value:d,label:c.label})}return{sum:a,peak:b,count:q.length}},[q,m]),s=(0,e.useMemo)(()=>{let a=-1,b=0;return c.forEach((c,d)=>{let e=c?.[m]||0;e>b&&(b=e,a=d)}),b>0?a:-1},[c,m]),t="var(--color-primary)";return(0,d.jsxs)("section",{className:"min-w-0","aria-label":"Usage over time",children:[(0,d.jsxs)("div",{className:"flex flex-wrap items-center gap-3",children:[(0,d.jsx)("h3",{className:"text-sm font-semibold tracking-tight text-text-main",children:"Flow"}),r?(0,d.jsxs)("span",{className:"text-xs text-text-muted",children:[(0,d.jsx)("span",{className:"tabular-nums text-text-main",children:o(r.sum)})," ","tokens"===b?"tokens":"spent",l?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("span",{className:"mx-1.5 text-text-subtle",children:"\xb7"}),(0,d.jsxs)("span",{children:[q[0]?.label,"–",q[q.length-1]?.label]})]}):null,r.peak.value>0?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("span",{className:"mx-1.5 text-text-subtle",children:"\xb7"}),(0,d.jsxs)("span",{children:["peak ",(0,d.jsx)("span",{className:"tabular-nums text-text-main",children:r.peak.label})]})]}):null]}):null,(0,d.jsxs)("div",{className:"ml-auto flex items-center gap-2",children:[l?(0,d.jsx)("button",{type:"button",onClick:()=>j(null),className:"rounded-md px-2 py-0.5 text-xs text-text-muted transition-colors hover:bg-bg-hover hover:text-text-main focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/45",children:"Reset range"}):null,s>=0?(0,d.jsxs)("button",{type:"button",onClick:()=>j({period:a,startIndex:Math.max(0,s-1),endIndex:Math.min(c.length-1,s+1)}),className:"flex items-center gap-1 rounded-md px-2 py-0.5 text-xs text-text-muted transition-colors hover:bg-bg-hover hover:text-text-main focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/45",title:`Zoom to peak (${c[s]?.label})`,children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px]","aria-hidden":"true",children:"zoom_in"}),"Peak"]}):null]})]}),(0,d.jsx)("div",{className:"mt-3",style:{height:200},children:k?(0,d.jsx)("div",{className:"flex h-full items-center justify-center text-text-subtle",children:(0,d.jsx)("span",{className:"material-symbols-outlined animate-spin text-[24px]","aria-hidden":"true",children:"progress_activity"})}):p?(0,d.jsx)(V.u,{width:"100%",height:"100%",children:(0,d.jsxs)(W.Q,{data:c,margin:{top:4,right:4,bottom:0,left:-12},children:[(0,d.jsx)("defs",{children:(0,d.jsxs)("linearGradient",{id:"flowFill",x1:"0",y1:"0",x2:"0",y2:"1",children:[(0,d.jsx)("stop",{offset:"0%",stopColor:t,stopOpacity:.18}),(0,d.jsx)("stop",{offset:"100%",stopColor:t,stopOpacity:.02})]})}),(0,d.jsx)(X.d,{strokeDasharray:"2 4",strokeOpacity:.12,vertical:!1}),(0,d.jsx)(Y.W,{dataKey:"label",tick:{fontSize:11,fill:"var(--color-text-subtle)"},tickLine:!1,axisLine:!1,minTickGap:24}),(0,d.jsx)(Z.h,{tick:{fontSize:11,fill:"var(--color-text-subtle)"},tickLine:!1,axisLine:!1,width:52,tickFormatter:a=>n(a)}),(0,d.jsx)($.m,{isAnimationActive:!0,animationDuration:120,animationEasing:"ease-out",cursor:{stroke:"var(--color-border)",strokeWidth:1,style:{transition:"transform 120ms cubic-bezier(.2,.8,.2,1)"}},content:({active:a,payload:c,label:e})=>{if(!a||!c?.length)return null;let f=c[0]?.value||0;return(0,d.jsxs)("div",{className:"rounded-lg border border-border bg-surface px-2.5 py-1.5 shadow-[var(--shadow-elevated)]",children:[(0,d.jsx)("div",{className:"text-[11px] text-text-subtle",children:e}),(0,d.jsxs)("div",{className:"text-sm font-medium tabular-nums text-text-main",children:[o(f)," ","tokens"===b?"tokens":""]})]})}}),(0,d.jsx)(_.Gk,{type:"monotone",dataKey:m,stroke:t,strokeWidth:2,fill:"url(#flowFill)",dot:!1,activeDot:{r:4,strokeWidth:0,style:{transition:"r 120ms cubic-bezier(.2,.8,.2,1)"}},isAnimationActive:!0,animationDuration:400,animationEasing:"ease-out"}),c.length>=8?(0,d.jsx)(aN,{dataKey:"label",height:22,travellerWidth:8,stroke:"var(--color-border)",fill:"var(--color-bg-subtle)",onChange:b=>{"number"==typeof b?.startIndex&&"number"==typeof b?.endIndex&&j({period:a,startIndex:b.startIndex,endIndex:b.endIndex})}}):null]})}):(0,d.jsxs)("div",{className:"flex h-full flex-col items-center justify-center gap-1 text-text-muted",children:[(0,d.jsx)("span",{className:"text-sm",children:"No activity in this period."}),(0,d.jsx)("span",{className:"text-xs text-text-subtle",children:"The chart fills as requests flow through the gateway."})]})})]})}function aP({provider:a,model:b,period:c}){let f=`${a||""}::${b||""}::${c||""}`,[g,h]=(0,e.useState)({key:f,page:1}),i=g.key===f?g.page:1,j=a=>h(b=>{let c=b.key===f?b.page:1;return{key:f,page:"function"==typeof a?a(c):a}}),[k,l]=(0,e.useState)({status:"loading",details:[],pagination:null});if("loading"===k.status)return(0,d.jsx)("div",{className:"flex flex-col gap-1.5 py-2","aria-busy":"true",children:[0,1,2].map(a=>(0,d.jsx)("div",{className:"h-9 animate-pulse rounded-lg bg-border-subtle/60"},a))});if("error"===k.status)return(0,d.jsx)("p",{className:"px-2 py-3 text-xs text-text-muted",children:"Could not load requests for this row."});if(0===k.details.length)return(0,d.jsx)("p",{className:"px-2 py-3 text-xs text-text-muted",children:"No individual requests recorded for this row in the selected period."});let{pagination:m}=k,n=m?.totalPages||1;return(0,d.jsxs)("div",{className:"flex min-w-0 flex-col",children:[(0,d.jsx)("div",{className:"max-h-80 min-w-0 overflow-y-auto rounded-lg border border-border-subtle",children:(0,d.jsxs)("table",{className:"w-full text-left text-xs",children:[(0,d.jsxs)("caption",{className:"sr-only",children:["Individual requests ",a?`for ${a}`:""," ",b?`on ${b}`:""]}),(0,d.jsx)("thead",{className:"sticky top-0 z-10 bg-bg-subtle text-[10px] uppercase tracking-wide text-text-muted",children:(0,d.jsxs)("tr",{children:[(0,d.jsx)("th",{scope:"col",className:"px-3 py-2 font-medium",children:"When"}),(0,d.jsx)("th",{scope:"col",className:"px-3 py-2 font-medium",children:"Status"}),(0,d.jsx)("th",{scope:"col",className:"px-3 py-2 text-right font-medium",children:"Tokens"}),(0,d.jsx)("th",{scope:"col",className:"px-3 py-2 text-right font-medium",children:"Latency"})]})}),(0,d.jsx)("tbody",{className:"divide-y divide-border-subtle",children:k.details.map((a,b)=>{let c,e,f,g=!a.status||"success"===a.status||200===a.status,h=(e=(c=a?.tokens||{}).prompt_tokens||c.input_tokens||0,(e<(f=c.cached_tokens||c.cache_read_input_tokens||0)?f:e)+(c.completion_tokens||c.output_tokens||0)),i=a.latency?.total||0;return(0,d.jsxs)("tr",{className:"transition-colors hover:bg-bg-hover",children:[(0,d.jsx)("td",{className:"whitespace-nowrap px-3 py-2 text-text-muted",children:(0,d.jsx)("time",{dateTime:a.timestamp,title:`${E(a.timestamp)} — ${D(a.timestamp)}`,children:function(a){if(!a)return"—";let b="number"==typeof a?a:Date.parse(a);if(!Number.isFinite(b))return"—";let c=Date.now()-b;return c<0?"—":c<45e3?"now":c<36e5?`${Math.floor(c/6e4)}m`:c<864e5?`${Math.floor(c/36e5)}h`:`${Math.floor(c/864e5)}d`}(a.timestamp)})}),(0,d.jsx)("td",{className:"px-3 py-2",children:(0,d.jsxs)("span",{className:"inline-flex items-center gap-1.5",title:a.errorMessage||a.error||void 0,children:[(0,d.jsx)("span",{className:"size-1.5 shrink-0 rounded-full",style:{backgroundColor:g?"var(--color-success)":"var(--color-danger)"},"aria-hidden":"true"}),(0,d.jsx)("span",{className:g?"text-text-muted":"text-danger",children:g?"ok":a.status||"error"})]})}),(0,d.jsx)("td",{className:"whitespace-nowrap px-3 py-2 text-right tabular-nums text-text-muted",children:h?y(h):"—"}),(0,d.jsx)("td",{className:"px-3 py-2 text-right tabular-nums text-text-muted",children:i?`${y(i)} ms`:"—"})]},a.id??`${a.timestamp}-${b}`)})})]})}),n>1?(0,d.jsxs)("div",{className:"mt-2 flex items-center justify-between text-xs text-text-muted",children:[(0,d.jsxs)("span",{className:"tabular-nums",children:["Page ",i," of ",n]}),(0,d.jsxs)("div",{className:"flex items-center gap-1",children:[(0,d.jsx)("button",{type:"button",onClick:()=>j(a=>Math.max(1,a-1)),disabled:i<=1,className:"rounded-md px-2 py-1 font-medium transition-colors hover:bg-bg-hover hover:text-text-main disabled:cursor-not-allowed disabled:opacity-40 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/45",children:"Previous"}),(0,d.jsx)("button",{type:"button",onClick:()=>j(a=>Math.min(n,a+1)),disabled:i>=n,className:"rounded-md px-2 py-1 font-medium transition-colors hover:bg-bg-hover hover:text-text-main disabled:cursor-not-allowed disabled:opacity-40 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/45",children:"Next"})]})]}):null]})}aN.displayName="Brush";let aQ=[{id:"provider",title:"Providers",key:"byProvider",groupBy:null},{id:"model",title:"Models",key:"byModel",groupBy:"rawModel"},{id:"account",title:"Accounts",key:"byAccount",groupBy:"accountName"},{id:"endpoint",title:"Endpoints",key:"byEndpoint",groupBy:"endpoint"}];function aR({period:a,stats:b,live:c=null,loading:g,onRetry:i,nodeNames:j={}}){let k=(0,f.useRouter)(),l=(0,f.useSearchParams)(),[m,n]=(0,e.useState)("costs"),[o,p]=(0,e.useState)(""),[q,r]=(0,e.useState)(()=>new Set(["provider"])),s=(0,e.useCallback)(a=>{r(b=>{let c=new Set(b);return c.has(a)?c.delete(a):c.add(a),c})},[]),t=o.trim().length>0,u=l.get("provider")||null,v=(0,e.useCallback)(a=>{let b=new URLSearchParams(l.toString());a?b.set("provider",a):b.delete("provider"),k.replace(`?${b.toString()}`,{scroll:!1})},[k,l]),w=(0,e.useCallback)(a=>B(a,m),[m]),z=(0,e.useMemo)(()=>(function(a){let b=[...new Set(a.filter(Boolean))].sort(),c=Math.max(14,Math.min(48,360/Math.max(1,b.length))),d=[],e=new Map;for(let a of b){let b=function(a){let b=0x811c9dc5;for(let c=0;c<a.length;c++)b^=a.charCodeAt(c),b=Math.imul(b,0x1000193);return b>>>0}(a)%3600/10,f=b,g=Q(b,d),h=b;for(let a=1;a<=40;a++){let a=Q(h=(h+137.508)%360,d);if(a>g&&(g=a,f=h),g>=c)break}d.push(f),e.set(a,{hue:Math.round(10*f)/10,saturation:1})}return e})(Object.keys(b?.byProvider||{}).map(a=>j?.[a]||a)),[b,j]),A=(0,e.useMemo)(()=>b?Object.entries(b.byProvider||{}).map(([a,b])=>({id:j?.[a]||a,rawId:a,cost:b?.cost||0,tokens:(b?.promptTokens||0)+(b?.completionTokens||0),requests:b?.requests||0})):null,[b,j]),C=(0,e.useCallback)((a,b="solid")=>{let c=j?.[a]||a;return function(a,{tone:b="solid",dark:c=!1}={}){if(null==a)return"var(--color-border)";let d=c?.74:.62,e="soft"===b?.13:.17,f="soft"===b?.22:1;return 1===f?`oklch(${d} ${e} ${a})`:`oklch(${d} ${e} ${a} / ${f})`}(z.get(c)?.hue??null,{tone:b})},[z,j]),[D,E]=(0,e.useState)([]),[F,G]=(0,e.useState)(null),H=(0,e.useMemo)(()=>{if(!b)return null;let a=o.trim().toLowerCase(),c=b=>(!u||b.provider===u||b.id===u||b.id===u&&null===b.provider)&&(!a||b.id.toLowerCase().includes(a)||(b.rawModel||"").toLowerCase().includes(a)||(b.provider||"").toLowerCase().includes(a)||(b.accountName||"").toLowerCase().includes(a)||(b.endpoint||"").toLowerCase().includes(a)||(b.keyName||"").toLowerCase().includes(a)),d=a=>{let c=Object.entries(b[a.key]||{}).map(([a,b])=>{let c,d,e;return c=b?.promptTokens||0,d=b?.completionTokens||0,e=b?.cachedTokens||0,{id:a,rawModel:b?.rawModel||a,provider:b?.provider||null,connectionId:b?.connectionId||null,accountName:b?.accountName||null,endpoint:b?.endpoint||null,keyName:b?.keyName||null,requests:b?.requests||0,promptTokens:c,completionTokens:d,cachedTokens:e,tokens:c+d,cost:b?.cost||0,lastUsed:b?.lastUsed||null}});return{...a,rows:c}},e=d(aQ[0]),f=d(aQ[1]),g=d(aQ[2]),h=d(aQ[3]),i=a=>{let b=a.rows.filter(c),d=b.reduce((a,b)=>a+w(b),0),e=b.slice().sort((a,b)=>w(b)-w(a));return{...a,rows:e,total:d,totalCost:b.reduce((a,b)=>a+b.cost,0),totalTokens:b.reduce((a,b)=>a+b.tokens,0),allCount:a.rows.length}};return{provider:i(e),model:i(f),account:i(g),endpoint:i(h),grandTotal:e.rows.reduce((a,b)=>a+w(b),0),grandCount:e.rows.length}},[b,o,u,w]),J=(0,e.useCallback)(a=>{if(!t)return q.has(a);let b=H?.[a];return b&&b.rows.length>0||q.has(a)},[t,q,H]),K={activeRequests:c?.activeRequests??b?.activeRequests??[],recentRequests:c?.recentRequests??b?.recentRequests??[]};if(!b&&g)return(0,d.jsxs)("div",{className:"flex min-w-0 flex-col gap-6",children:[(0,d.jsx)(O,{stats:K,nodeNames:j}),(0,d.jsxs)("div",{className:"flex min-w-0 flex-col gap-5",children:[(0,d.jsx)("div",{className:"h-24 animate-pulse rounded-[14px] bg-border-subtle"}),(0,d.jsx)("div",{className:"h-40 animate-pulse rounded-[14px] bg-border-subtle"})]})]});if(!b)return(0,d.jsx)(h.default,{padding:"md",children:(0,d.jsxs)("div",{className:"flex flex-col items-center gap-2 py-8 text-center",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[28px] text-text-subtle","aria-hidden":"true",children:"cloud_off"}),(0,d.jsxs)("p",{className:"text-sm text-text-muted",children:["Could not load usage for ",I[a]||a,"."]}),(0,d.jsx)("p",{className:"text-xs text-text-subtle",children:"Nothing is shown rather than numbers from another time range."}),(0,d.jsx)("button",{type:"button",onClick:i,className:"mt-1 rounded-lg border border-border px-3 py-1.5 text-xs font-medium text-text-main transition-colors hover:bg-bg-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/45",children:"Retry"})]})});let M=(H?.provider.rows.length||0)+(H?.model.rows.length||0)+(H?.account.rows.length||0)+(H?.endpoint.rows.length||0),N=(H?.provider.allCount||0)+(H?.model.allCount||0)+(H?.account.allCount||0)+(H?.endpoint.allCount||0),R=a=>"tokens"===m?y(a.tokens):x(a.cost),T=a=>"both"===m?`${y(a.tokens)} tok`:null;return(0,d.jsxs)("div",{className:"flex min-w-0 flex-col gap-6",children:[(0,d.jsx)(L,{stats:b,mode:m,period:a,onModeChange:n,onSelectProvider:v,selectedProvider:u,nodeNames:j,colorOf:C,donutRows:A,onPickProvider:a=>v(a.rawId)}),(0,d.jsx)(O,{stats:K,nodeNames:j}),b?(0,d.jsx)(P,{points:F===a?D:[],mode:m}):null,(0,d.jsx)(aO,{period:a,mode:m}),(0,d.jsx)("div",{className:"border-t border-border-subtle"}),(0,d.jsx)(U,{query:o,onQueryChange:p,activeFilter:u,onClearFilter:()=>v(null),resultCount:M,totalCount:N}),(0,d.jsx)("div",{className:"flex min-w-0 flex-col gap-1",children:aQ.map((c,e)=>{let f=H?.[c.id];if(!f)return null;let g=J(c.id),h="provider"===c.id;return(0,d.jsx)(S,{title:c.title,depth:e,folded:e>0,count:"tokens"===m?y(f.totalTokens):x(f.totalCost),countValue:"tokens"===m?f.totalTokens:f.totalCost,countFormat:aS(m),countSecondary:"both"===m?`${y(f.totalTokens)} tok`:null,countSecondaryValue:"both"===m?f.totalTokens:void 0,countSecondaryFormat:"both"===m?aT:void 0,meta:0===f.rows.length?"no match":`${f.rows.length}${f.rows.length!==f.allCount?` of ${f.allCount}`:""}`,accent:h&&!!b.errorProvider,open:g,onOpenChange:()=>s(c.id),children:(0,d.jsx)(aU,{layer:f,dimension:c.id,mode:m,grandTotal:H?.grandTotal||0,valueFor:R,secondaryFor:T,onSelectProvider:h?v:void 0,selectedProvider:u,open:g,hasQuery:o.trim().length>0,period:a,nodeNames:j})},c.id)})})]})}let aS=a=>"tokens"===a?z:x,aT=a=>`${z(a)} tok`;function aU({layer:a,dimension:b,mode:c,grandTotal:f,valueFor:g,secondaryFor:h,onSelectProvider:i,selectedProvider:j,open:k,hasQuery:l,period:m,nodeNames:n}){let[o,p]=(0,e.useState)(!1),[q,r]=(0,e.useState)(null),s=o?a.rows:a.rows.slice(0,l?40:8),t=a.rows.length-s.length,u=aS(c);return 0===a.rows.length?(0,d.jsx)("p",{className:"px-2 py-3 text-xs text-text-muted",children:l?"Nothing matches the current search.":"Nothing recorded in this period yet."}):(0,d.jsxs)("div",{className:"flex min-w-0 flex-col",children:[s.map((a,e)=>{let k="provider"===b?function(a,b){if(!a)return"—";let c=b?.[a];return c||(a.length<=22?a:`${a.slice(0,14)}…`)}(a.id,n):"account"===b?a.accountName||a.id:"endpoint"===b?a.endpoint||a.id:a.rawModel||a.id,l=B(a,c),o=F(l,f),p="function"==typeof i,s=q===a.id;return(0,d.jsxs)("div",{className:"min-w-0",children:[(0,d.jsxs)("div",{className:"flex min-w-0 items-start gap-1",children:[(0,d.jsx)("div",{className:"min-w-0 flex-1",children:(0,d.jsx)(T,{label:k,sublabel:"provider"===b?null:"account"===b?[a.rawModel,a.provider].filter(Boolean).join(" \xb7 ")||null:a.provider||null,value:g(a),valueRaw:e<24?l:void 0,valueFormat:u,valueSecondary:h(a),valueSecondaryRaw:e<24?a.tokens:void 0,valueSecondaryFormat:"both"===c?aT:void 0,detail:H({input:a.promptTokens,output:a.completionTokens,cached:a.cachedTokens,total:a.tokens}),barValue:o,status:a.id===j&&"provider"===b?"active":void 0,selected:!!p&&j===a.id,onSelect:p?()=>i(a.id):void 0,trailing:(0,d.jsxs)("span",{className:"hidden text-xs tabular-nums text-text-subtle sm:inline",title:`${w(a.requests)} requests`,children:[w(a.requests)," req"]})})}),a.requests>0?(0,d.jsx)("button",{type:"button",onClick:()=>r(s?null:a.id),"aria-expanded":s,"aria-label":s?`Hide requests for ${k}`:`Show ${a.requests} requests for ${k}`,className:["mt-1.5 shrink-0 rounded-md p-1.5 transition-colors duration-150 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/45",s?"bg-primary/8 text-primary":"text-text-subtle hover:bg-bg-hover hover:text-text-main"].join(" "),children:(0,d.jsx)("span",{className:"material-symbols-outlined text-[15px]","aria-hidden":"true",children:s?"expand_less":"receipt_long"})}):null]}),s?(0,d.jsx)("div",{className:"mb-1 ml-2 min-w-0",children:(0,d.jsx)(aP,{provider:"provider"===b?a.id:a.provider,model:"model"===b?a.rawModel:null,period:m})}):null]},a.id)}),t>0?(0,d.jsxs)("button",{type:"button",onClick:()=>p(!0),className:"mt-1 self-start rounded-lg px-2 py-1.5 text-xs font-medium text-primary transition-colors hover:bg-primary/8 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/45",children:["Show ",t," more"]}):null,o&&a.rows.length>8?(0,d.jsxs)("button",{type:"button",onClick:()=>p(!1),className:"mt-1 self-start rounded-lg px-2 py-1.5 text-xs font-medium text-text-muted transition-colors hover:bg-bg-hover hover:text-text-main focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/45",children:["Show top ",8]}):null]})}function aV({period:a}){let[b,c]=(0,e.useState)(null),[f,g]=(0,e.useState)(null),[h,i]=(0,e.useState)({activeRequests:[],recentRequests:[]}),[j,k]=(0,e.useState)(null),[l,m]=(0,e.useState)({}),[n,o]=(0,e.useState)(0);(0,e.useRef)(a);let p=f===a,q=j===a;return(0,d.jsx)(aR,{period:a,stats:p?b:null,live:h,loading:!p&&!q,fetching:!1,onRetry:()=>{k(null),o(a=>a+1)},nodeNames:l})}let aW=[{value:"today",label:"Today"},{value:"24h",label:"24h"},{value:"7d",label:"7D"},{value:"30d",label:"30D"},{value:"60d",label:"60D"},{value:"all",label:"All"}];function aX(){return(0,d.jsx)(e.Suspense,{fallback:(0,d.jsx)(g.Qv,{}),children:(0,d.jsx)(aY,{})})}function aY(){let a=(0,f.useSearchParams)(),b=(0,f.useRouter)(),[c,h]=(0,e.useState)("today"),[i,j]=(0,e.useState)(!1),[k,l]=(0,e.useState)({type:"",message:""}),m=(0,e.useRef)(null),n=a.get("tab"),o=n&&["overview","logs","details"].includes(n)?n:"overview",p=async()=>{j(!0),l({type:"",message:""});try{let a=await fetch("/api/usage/backup");if(!a.ok){let b=await a.json().catch(()=>({}));throw Error(b.error||"Failed to export usage data")}let b=await a.json(),c=new Blob([JSON.stringify(b,null,2)],{type:"application/json"}),d=URL.createObjectURL(c),e=document.createElement("a"),f=new Date().toISOString().slice(0,10);e.href=d,e.download=`9router-usage-backup-${f}.json`,document.body.appendChild(e),e.click(),document.body.removeChild(e),URL.revokeObjectURL(d),l({type:"success",message:"Usage backup downloaded successfully!"})}catch(a){l({type:"error",message:a.message||"Export failed"})}finally{j(!1)}},q=async a=>{let b=a.target.files?.[0];if(b){m.current&&(m.current.value=""),j(!0),l({type:"",message:""});try{let a=await b.text(),c=JSON.parse(a),d=await fetch("/api/usage/backup",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...c,mode:"merge"})}),e=await d.json().catch(()=>({}));if(!d.ok)throw Error(e.error||"Failed to import usage data");l({type:"success",message:"Usage backup merged successfully!"})}catch(a){l({type:"error",message:a.message||"Import failed"})}finally{j(!1)}}};return(0,d.jsxs)("div",{className:"flex min-w-0 flex-col gap-6 px-1 sm:px-0",children:[(0,d.jsxs)("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[(0,d.jsx)(g.Iz,{options:[{value:"overview",label:"Overview"},{value:"logs",label:"Logs"},{value:"details",label:"Details"}],value:o,onChange:c=>{if(c===o)return;let d=new URLSearchParams(a);d.set("tab",c),b.push(`/dashboard/usage?${d.toString()}`,{scroll:!1})},className:"w-full sm:w-auto"}),"overview"===o&&(0,d.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,d.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,d.jsxs)("button",{type:"button",onClick:p,disabled:i,className:"flex items-center gap-1 rounded-lg border border-border bg-bg-subtle px-2.5 py-1.5 text-xs font-medium text-text-muted transition-colors hover:bg-bg-hover hover:text-text disabled:opacity-50",title:"Export all usage history & tokens to JSON file",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[15px]","aria-hidden":"true",children:"download"}),(0,d.jsx)("span",{children:"Export"})]}),(0,d.jsxs)("button",{type:"button",onClick:()=>m.current?.click(),disabled:i,className:"flex items-center gap-1 rounded-lg border border-border bg-bg-subtle px-2.5 py-1.5 text-xs font-medium text-text-muted transition-colors hover:bg-bg-hover hover:text-text disabled:opacity-50",title:"Import usage backup JSON file (merge tokens)",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[15px]","aria-hidden":"true",children:"upload"}),(0,d.jsx)("span",{children:"Import"})]}),(0,d.jsx)("input",{ref:m,type:"file",accept:".json",onChange:q,className:"hidden"})]}),(0,d.jsx)(g.Iz,{options:aW,value:c,onChange:h,size:"sm",className:"w-full sm:w-auto"})]})]}),k.message&&(0,d.jsxs)("div",{className:`flex items-center justify-between rounded-lg px-3 py-2 text-xs font-medium ${"success"===k.type?"border border-success/20 bg-success/10 text-success":"border border-error/20 bg-error/10 text-error"}`,children:[(0,d.jsx)("span",{children:k.message}),(0,d.jsx)("button",{type:"button",onClick:()=>l({type:"",message:""}),"aria-label":"Dismiss",className:"shrink-0 rounded p-0.5 text-text-muted transition-colors hover:text-text focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/45",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-[16px]","aria-hidden":"true",children:"close"})})]}),"overview"===o&&(0,d.jsx)(e.Suspense,{fallback:(0,d.jsx)(g.Qv,{}),children:(0,d.jsx)(aV,{period:c})}),"logs"===o&&(0,d.jsx)(g.gM,{}),"details"===o&&(0,d.jsx)(v,{})]})}},55511:a=>{"use strict";a.exports=require("crypto")},55591:a=>{"use strict";a.exports=require("https")},57075:a=>{"use strict";a.exports=require("node:stream")},57975:a=>{"use strict";a.exports=require("node:util")},63033:a=>{"use strict";a.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},71553:a=>{"use strict";a.exports=require("node:dns/promises")},71622:a=>{"use strict";a.exports=import("open")},73024:a=>{"use strict";a.exports=require("node:fs")},73136:a=>{"use strict";a.exports=require("node:url")},73429:a=>{"use strict";a.exports=require("node:util/types")},73496:a=>{"use strict";a.exports=require("http2")},74075:a=>{"use strict";a.exports=require("zlib")},75919:a=>{"use strict";a.exports=require("node:worker_threads")},76760:a=>{"use strict";a.exports=require("node:path")},77030:a=>{"use strict";a.exports=require("node:net")},77598:a=>{"use strict";a.exports=require("node:crypto")},78474:a=>{"use strict";a.exports=require("node:events")},79646:a=>{"use strict";a.exports=require("child_process")},79868:a=>{"use strict";a.exports=require("node:sqlite")},81630:a=>{"use strict";a.exports=require("http")},81787:a=>{"use strict";a.exports=require("bun:sqlite")},87149:(a,b,c)=>{"use strict";c.r(b),c.d(b,{default:()=>d});let d=(0,c(77943).registerClientReference)(function(){throw Error("Attempted to call the default export of \"C:\\\\Users\\\\Developer\\\\9router-fix\\\\src\\\\app\\\\(dashboard)\\\\dashboard\\\\usage\\\\page.js\" from the server, but it's on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"C:\\Users\\Developer\\9router-fix\\src\\app\\(dashboard)\\dashboard\\usage\\page.js","default")},87550:a=>{"use strict";a.exports=require("better-sqlite3")},87997:a=>{"use strict";a.exports=require("node:timers")},91645:a=>{"use strict";a.exports=require("net")},94735:a=>{"use strict";a.exports=require("events")}};var b=require("../../../../webpack-runtime.js");b.C(a);var c=b.X(0,[4741,1260,2430,4613,4485,9555,2636,4884,8967,6070,869,915,6457,4123,8157,6777,412,2668],()=>b(b.s=43381));module.exports=c})();
|