From 18caee3ef4f2f6db53242352a229823ec5a6fe58 Mon Sep 17 00:00:00 2001 From: Yuneng Jiang Date: Sat, 11 Apr 2026 13:19:41 -0700 Subject: [PATCH] chore: update Next.js build artifacts (2026-04-11 20:19 UTC, node v22.16.0) --- litellm/proxy/_experimental/out/404.html | 2 +- .../_experimental/out/__next.__PAGE__.txt | 22 +- .../proxy/_experimental/out/__next._full.txt | 34 +- .../proxy/_experimental/out/__next._head.txt | 2 +- .../proxy/_experimental/out/__next._index.txt | 2 +- .../proxy/_experimental/out/__next._tree.txt | 2 +- .../_buildManifest.js | 0 .../_clientMiddlewareManifest.json | 0 .../_ssgManifest.js | 0 .../_next/static/chunks/086f1dd580fe748e.js | 1 + ...e768c2b1dfc8cd5.js => 0c6c65a34bcde140.js} | 2 +- .../_next/static/chunks/0d219667baa010f5.js | 91 ---- .../_next/static/chunks/11c5483d145114d0.js | 1 + ...61a2ab7f4e973ca.js => 130cfc006c4f7d77.js} | 2 +- .../_next/static/chunks/13670846207c3e16.js | 1 - .../_next/static/chunks/1379bf26a33536ad.js | 1 + ...3b05b76472ce110.js => 1501e804b4d0f510.js} | 2 +- .../_next/static/chunks/1973a4cee645cb66.js | 1 + ...e31df62c48a7fb3.js => 27289c624996260b.js} | 8 +- .../_next/static/chunks/316d3919d0bb4207.js | 1 + .../_next/static/chunks/354ca537c6c0601c.js | 8 - .../_next/static/chunks/360f35fe2e0a4945.js | 1 - .../_next/static/chunks/3e3213d578d771d6.js | 420 ++++++++++++++++++ .../_next/static/chunks/44b9dfbbfb0955a2.js | 1 - .../_next/static/chunks/4da28073ebe41531.js | 1 + .../_next/static/chunks/4e5da3c236abd875.js | 8 - .../_next/static/chunks/60b0cadba57cd7f7.js | 1 + ...59aefcfdd5715be.js => 61d8ae4ec4f309fe.js} | 2 +- ...ba30115a5664a84.js => 6392214b899e5c07.js} | 2 +- .../_next/static/chunks/6af2d8fb8cb64938.js | 2 - .../_next/static/chunks/7524a4c1b1d4ad79.js | 1 - .../_next/static/chunks/75761fc3c2814916.js | 420 ++++++++++++++++++ .../_next/static/chunks/7dd16a650b98a4c5.js | 91 ++++ ...89dbe4d6a5a8128.js => 7e46b6e6e9d69068.js} | 2 +- .../_next/static/chunks/813d581ad8ef856a.js | 2 + .../_next/static/chunks/84c717b1ad096487.js | 420 ------------------ .../_next/static/chunks/8c6d915f992d48df.js | 1 - .../_next/static/chunks/94f7251fb8b74702.js | 1 + .../_next/static/chunks/974eb6f77e6d258b.js | 1 - ...d4250986e22b9e4.js => 99997b92ae046b23.js} | 2 +- .../_next/static/chunks/9a17d35f872a6c38.js | 1 - .../_next/static/chunks/9c8f0f460dea2bbd.js | 1 - ...fc2d71e511309ab.js => a02f90f97248b9aa.js} | 2 +- ...c74114b00de04c5.js => a230559fcabaea23.js} | 6 +- .../_next/static/chunks/b032bb46393a6abb.js | 1 - .../_next/static/chunks/b6c1a99750c8786e.js | 1 + ...97cf6318d9db90c.js => b88f74d6b19daf48.js} | 2 +- ...1bb41d04b7a8f8d.js => be379dba69f5f250.js} | 2 +- .../_next/static/chunks/c563dc5d6cf8678b.js | 1 + ...9e9dce7df902771.js => d3108ee6d0129019.js} | 8 +- .../_next/static/chunks/d3fe6e52dd701fba.js | 420 ------------------ ...3a77189dc2b5775.js => d93c51cc643f3390.js} | 2 +- .../_next/static/chunks/df37a0019220a941.js | 1 + ...f01d87225e5be70.js => eaa9f9b9bb3e054b.js} | 6 +- .../_next/static/chunks/ec7bc708a7afa043.js | 1 - .../_next/static/chunks/ee9e514b2c2694f7.js | 1 - .../_next/static/chunks/f0171e7fee2034ce.js | 8 + .../_next/static/chunks/f9b068e88ed2d7e3.js | 8 + ...de75ace22fd0a0f.js => ffeecf52efe5b98f.js} | 2 +- .../proxy/_experimental/out/_not-found.html | 2 +- .../proxy/_experimental/out/_not-found.txt | 2 +- .../out/_not-found/__next._full.txt | 2 +- .../out/_not-found/__next._head.txt | 2 +- .../out/_not-found/__next._index.txt | 2 +- .../_not-found/__next._not-found.__PAGE__.txt | 2 +- .../out/_not-found/__next._not-found.txt | 2 +- .../out/_not-found/__next._tree.txt | 2 +- .../_experimental/out/api-reference.html | 2 +- .../proxy/_experimental/out/api-reference.txt | 2 +- ...KGRhc2hib2FyZCk.api-reference.__PAGE__.txt | 2 +- .../__next.!KGRhc2hib2FyZCk.api-reference.txt | 2 +- .../api-reference/__next.!KGRhc2hib2FyZCk.txt | 2 +- .../out/api-reference/__next._full.txt | 2 +- .../out/api-reference/__next._head.txt | 2 +- .../out/api-reference/__next._index.txt | 2 +- .../out/api-reference/__next._tree.txt | 2 +- litellm/proxy/_experimental/out/chat.html | 2 +- litellm/proxy/_experimental/out/chat.txt | 4 +- .../_experimental/out/chat/__next._full.txt | 4 +- .../_experimental/out/chat/__next._head.txt | 2 +- .../_experimental/out/chat/__next._index.txt | 2 +- .../_experimental/out/chat/__next._tree.txt | 2 +- .../out/chat/__next.chat.__PAGE__.txt | 4 +- .../_experimental/out/chat/__next.chat.txt | 2 +- .../out/experimental/api-playground.html | 2 +- .../out/experimental/api-playground.txt | 2 +- ...k.experimental.api-playground.__PAGE__.txt | 2 +- ...2hib2FyZCk.experimental.api-playground.txt | 2 +- .../__next.!KGRhc2hib2FyZCk.experimental.txt | 2 +- .../__next.!KGRhc2hib2FyZCk.txt | 2 +- .../api-playground/__next._full.txt | 2 +- .../api-playground/__next._head.txt | 2 +- .../api-playground/__next._index.txt | 2 +- .../api-playground/__next._tree.txt | 2 +- .../out/experimental/budgets.html | 2 +- .../out/experimental/budgets.txt | 2 +- ...ib2FyZCk.experimental.budgets.__PAGE__.txt | 2 +- ....!KGRhc2hib2FyZCk.experimental.budgets.txt | 2 +- .../__next.!KGRhc2hib2FyZCk.experimental.txt | 2 +- .../budgets/__next.!KGRhc2hib2FyZCk.txt | 2 +- .../out/experimental/budgets/__next._full.txt | 2 +- .../out/experimental/budgets/__next._head.txt | 2 +- .../experimental/budgets/__next._index.txt | 2 +- .../out/experimental/budgets/__next._tree.txt | 2 +- .../out/experimental/caching.html | 2 +- .../out/experimental/caching.txt | 2 +- ...ib2FyZCk.experimental.caching.__PAGE__.txt | 2 +- ....!KGRhc2hib2FyZCk.experimental.caching.txt | 2 +- .../__next.!KGRhc2hib2FyZCk.experimental.txt | 2 +- .../caching/__next.!KGRhc2hib2FyZCk.txt | 2 +- .../out/experimental/caching/__next._full.txt | 2 +- .../out/experimental/caching/__next._head.txt | 2 +- .../experimental/caching/__next._index.txt | 2 +- .../out/experimental/caching/__next._tree.txt | 2 +- .../out/experimental/claude-code-plugins.html | 2 +- .../out/experimental/claude-code-plugins.txt | 2 +- ...erimental.claude-code-plugins.__PAGE__.txt | 2 +- ...FyZCk.experimental.claude-code-plugins.txt | 2 +- .../__next.!KGRhc2hib2FyZCk.experimental.txt | 2 +- .../__next.!KGRhc2hib2FyZCk.txt | 2 +- .../claude-code-plugins/__next._full.txt | 2 +- .../claude-code-plugins/__next._head.txt | 2 +- .../claude-code-plugins/__next._index.txt | 2 +- .../claude-code-plugins/__next._tree.txt | 2 +- .../out/experimental/old-usage.html | 2 +- .../out/experimental/old-usage.txt | 6 +- ...2FyZCk.experimental.old-usage.__PAGE__.txt | 4 +- ...KGRhc2hib2FyZCk.experimental.old-usage.txt | 2 +- .../__next.!KGRhc2hib2FyZCk.experimental.txt | 2 +- .../old-usage/__next.!KGRhc2hib2FyZCk.txt | 2 +- .../experimental/old-usage/__next._full.txt | 6 +- .../experimental/old-usage/__next._head.txt | 2 +- .../experimental/old-usage/__next._index.txt | 2 +- .../experimental/old-usage/__next._tree.txt | 2 +- .../out/experimental/prompts.html | 2 +- .../out/experimental/prompts.txt | 2 +- ...ib2FyZCk.experimental.prompts.__PAGE__.txt | 2 +- ....!KGRhc2hib2FyZCk.experimental.prompts.txt | 2 +- .../__next.!KGRhc2hib2FyZCk.experimental.txt | 2 +- .../prompts/__next.!KGRhc2hib2FyZCk.txt | 2 +- .../out/experimental/prompts/__next._full.txt | 2 +- .../out/experimental/prompts/__next._head.txt | 2 +- .../experimental/prompts/__next._index.txt | 2 +- .../out/experimental/prompts/__next._tree.txt | 2 +- .../out/experimental/tag-management.html | 2 +- .../out/experimental/tag-management.txt | 6 +- ...k.experimental.tag-management.__PAGE__.txt | 4 +- ...2hib2FyZCk.experimental.tag-management.txt | 2 +- .../__next.!KGRhc2hib2FyZCk.experimental.txt | 2 +- .../__next.!KGRhc2hib2FyZCk.txt | 2 +- .../tag-management/__next._full.txt | 6 +- .../tag-management/__next._head.txt | 2 +- .../tag-management/__next._index.txt | 2 +- .../tag-management/__next._tree.txt | 2 +- .../proxy/_experimental/out/guardrails.html | 2 +- .../proxy/_experimental/out/guardrails.txt | 6 +- ...t.!KGRhc2hib2FyZCk.guardrails.__PAGE__.txt | 4 +- .../__next.!KGRhc2hib2FyZCk.guardrails.txt | 2 +- .../guardrails/__next.!KGRhc2hib2FyZCk.txt | 2 +- .../out/guardrails/__next._full.txt | 6 +- .../out/guardrails/__next._head.txt | 2 +- .../out/guardrails/__next._index.txt | 2 +- .../out/guardrails/__next._tree.txt | 2 +- litellm/proxy/_experimental/out/index.html | 2 +- litellm/proxy/_experimental/out/index.txt | 34 +- litellm/proxy/_experimental/out/login.html | 2 +- litellm/proxy/_experimental/out/login.txt | 4 +- .../_experimental/out/login/__next._full.txt | 4 +- .../_experimental/out/login/__next._head.txt | 2 +- .../_experimental/out/login/__next._index.txt | 2 +- .../_experimental/out/login/__next._tree.txt | 2 +- .../out/login/__next.login.__PAGE__.txt | 4 +- .../_experimental/out/login/__next.login.txt | 2 +- litellm/proxy/_experimental/out/logs.html | 2 +- litellm/proxy/_experimental/out/logs.txt | 6 +- .../__next.!KGRhc2hib2FyZCk.logs.__PAGE__.txt | 4 +- .../out/logs/__next.!KGRhc2hib2FyZCk.logs.txt | 2 +- .../out/logs/__next.!KGRhc2hib2FyZCk.txt | 2 +- .../_experimental/out/logs/__next._full.txt | 6 +- .../_experimental/out/logs/__next._head.txt | 2 +- .../_experimental/out/logs/__next._index.txt | 2 +- .../_experimental/out/logs/__next._tree.txt | 2 +- .../_experimental/out/mcp/oauth/callback.html | 2 +- .../_experimental/out/mcp/oauth/callback.txt | 4 +- .../out/mcp/oauth/callback/__next._full.txt | 4 +- .../out/mcp/oauth/callback/__next._head.txt | 2 +- .../out/mcp/oauth/callback/__next._index.txt | 2 +- .../out/mcp/oauth/callback/__next._tree.txt | 2 +- .../__next.mcp.oauth.callback.__PAGE__.txt | 4 +- .../callback/__next.mcp.oauth.callback.txt | 2 +- .../mcp/oauth/callback/__next.mcp.oauth.txt | 2 +- .../out/mcp/oauth/callback/__next.mcp.txt | 2 +- .../proxy/_experimental/out/model-hub.html | 2 +- litellm/proxy/_experimental/out/model-hub.txt | 2 +- ...xt.!KGRhc2hib2FyZCk.model-hub.__PAGE__.txt | 2 +- .../__next.!KGRhc2hib2FyZCk.model-hub.txt | 2 +- .../out/model-hub/__next.!KGRhc2hib2FyZCk.txt | 2 +- .../out/model-hub/__next._full.txt | 2 +- .../out/model-hub/__next._head.txt | 2 +- .../out/model-hub/__next._index.txt | 2 +- .../out/model-hub/__next._tree.txt | 2 +- .../proxy/_experimental/out/model_hub.html | 2 +- litellm/proxy/_experimental/out/model_hub.txt | 2 +- .../out/model_hub/__next._full.txt | 2 +- .../out/model_hub/__next._head.txt | 2 +- .../out/model_hub/__next._index.txt | 2 +- .../out/model_hub/__next._tree.txt | 2 +- .../model_hub/__next.model_hub.__PAGE__.txt | 2 +- .../out/model_hub/__next.model_hub.txt | 2 +- .../_experimental/out/model_hub_table.html | 2 +- .../_experimental/out/model_hub_table.txt | 2 +- .../out/model_hub_table/__next._full.txt | 2 +- .../out/model_hub_table/__next._head.txt | 2 +- .../out/model_hub_table/__next._index.txt | 2 +- .../out/model_hub_table/__next._tree.txt | 2 +- .../__next.model_hub_table.__PAGE__.txt | 2 +- .../__next.model_hub_table.txt | 2 +- .../out/models-and-endpoints.html | 2 +- .../out/models-and-endpoints.txt | 6 +- ...ib2FyZCk.models-and-endpoints.__PAGE__.txt | 4 +- ....!KGRhc2hib2FyZCk.models-and-endpoints.txt | 2 +- .../__next.!KGRhc2hib2FyZCk.txt | 2 +- .../out/models-and-endpoints/__next._full.txt | 6 +- .../out/models-and-endpoints/__next._head.txt | 2 +- .../models-and-endpoints/__next._index.txt | 2 +- .../out/models-and-endpoints/__next._tree.txt | 2 +- .../proxy/_experimental/out/onboarding.html | 2 +- .../proxy/_experimental/out/onboarding.txt | 2 +- .../out/onboarding/__next._full.txt | 2 +- .../out/onboarding/__next._head.txt | 2 +- .../out/onboarding/__next._index.txt | 2 +- .../out/onboarding/__next._tree.txt | 2 +- .../onboarding/__next.onboarding.__PAGE__.txt | 2 +- .../out/onboarding/__next.onboarding.txt | 2 +- .../_experimental/out/organizations.html | 2 +- .../proxy/_experimental/out/organizations.txt | 6 +- ...KGRhc2hib2FyZCk.organizations.__PAGE__.txt | 4 +- .../__next.!KGRhc2hib2FyZCk.organizations.txt | 2 +- .../organizations/__next.!KGRhc2hib2FyZCk.txt | 2 +- .../out/organizations/__next._full.txt | 6 +- .../out/organizations/__next._head.txt | 2 +- .../out/organizations/__next._index.txt | 2 +- .../out/organizations/__next._tree.txt | 2 +- .../proxy/_experimental/out/playground.html | 2 +- .../proxy/_experimental/out/playground.txt | 6 +- ...t.!KGRhc2hib2FyZCk.playground.__PAGE__.txt | 4 +- .../__next.!KGRhc2hib2FyZCk.playground.txt | 2 +- .../playground/__next.!KGRhc2hib2FyZCk.txt | 2 +- .../out/playground/__next._full.txt | 6 +- .../out/playground/__next._head.txt | 2 +- .../out/playground/__next._index.txt | 2 +- .../out/playground/__next._tree.txt | 2 +- litellm/proxy/_experimental/out/policies.html | 2 +- litellm/proxy/_experimental/out/policies.txt | 2 +- ...ext.!KGRhc2hib2FyZCk.policies.__PAGE__.txt | 2 +- .../__next.!KGRhc2hib2FyZCk.policies.txt | 2 +- .../out/policies/__next.!KGRhc2hib2FyZCk.txt | 2 +- .../out/policies/__next._full.txt | 2 +- .../out/policies/__next._head.txt | 2 +- .../out/policies/__next._index.txt | 2 +- .../out/policies/__next._tree.txt | 2 +- .../out/settings/admin-settings.html | 2 +- .../out/settings/admin-settings.txt | 2 +- ...FyZCk.settings.admin-settings.__PAGE__.txt | 2 +- ...GRhc2hib2FyZCk.settings.admin-settings.txt | 2 +- .../__next.!KGRhc2hib2FyZCk.settings.txt | 2 +- .../__next.!KGRhc2hib2FyZCk.txt | 2 +- .../settings/admin-settings/__next._full.txt | 2 +- .../settings/admin-settings/__next._head.txt | 2 +- .../settings/admin-settings/__next._index.txt | 2 +- .../settings/admin-settings/__next._tree.txt | 2 +- .../out/settings/logging-and-alerts.html | 2 +- .../out/settings/logging-and-alerts.txt | 2 +- ...k.settings.logging-and-alerts.__PAGE__.txt | 2 +- ...2hib2FyZCk.settings.logging-and-alerts.txt | 2 +- .../__next.!KGRhc2hib2FyZCk.settings.txt | 2 +- .../__next.!KGRhc2hib2FyZCk.txt | 2 +- .../logging-and-alerts/__next._full.txt | 2 +- .../logging-and-alerts/__next._head.txt | 2 +- .../logging-and-alerts/__next._index.txt | 2 +- .../logging-and-alerts/__next._tree.txt | 2 +- .../out/settings/router-settings.html | 2 +- .../out/settings/router-settings.txt | 2 +- ...yZCk.settings.router-settings.__PAGE__.txt | 2 +- ...Rhc2hib2FyZCk.settings.router-settings.txt | 2 +- .../__next.!KGRhc2hib2FyZCk.settings.txt | 2 +- .../__next.!KGRhc2hib2FyZCk.txt | 2 +- .../settings/router-settings/__next._full.txt | 2 +- .../settings/router-settings/__next._head.txt | 2 +- .../router-settings/__next._index.txt | 2 +- .../settings/router-settings/__next._tree.txt | 2 +- .../_experimental/out/settings/ui-theme.html | 2 +- .../_experimental/out/settings/ui-theme.txt | 2 +- .../__next.!KGRhc2hib2FyZCk.settings.txt | 2 +- ...c2hib2FyZCk.settings.ui-theme.__PAGE__.txt | 2 +- ...ext.!KGRhc2hib2FyZCk.settings.ui-theme.txt | 2 +- .../ui-theme/__next.!KGRhc2hib2FyZCk.txt | 2 +- .../out/settings/ui-theme/__next._full.txt | 2 +- .../out/settings/ui-theme/__next._head.txt | 2 +- .../out/settings/ui-theme/__next._index.txt | 2 +- .../out/settings/ui-theme/__next._tree.txt | 2 +- litellm/proxy/_experimental/out/teams.html | 2 +- litellm/proxy/_experimental/out/teams.txt | 6 +- ...__next.!KGRhc2hib2FyZCk.teams.__PAGE__.txt | 4 +- .../teams/__next.!KGRhc2hib2FyZCk.teams.txt | 2 +- .../out/teams/__next.!KGRhc2hib2FyZCk.txt | 2 +- .../_experimental/out/teams/__next._full.txt | 6 +- .../_experimental/out/teams/__next._head.txt | 2 +- .../_experimental/out/teams/__next._index.txt | 2 +- .../_experimental/out/teams/__next._tree.txt | 2 +- litellm/proxy/_experimental/out/test-key.html | 2 +- litellm/proxy/_experimental/out/test-key.txt | 6 +- ...ext.!KGRhc2hib2FyZCk.test-key.__PAGE__.txt | 4 +- .../__next.!KGRhc2hib2FyZCk.test-key.txt | 2 +- .../out/test-key/__next.!KGRhc2hib2FyZCk.txt | 2 +- .../out/test-key/__next._full.txt | 6 +- .../out/test-key/__next._head.txt | 2 +- .../out/test-key/__next._index.txt | 2 +- .../out/test-key/__next._tree.txt | 2 +- .../_experimental/out/tools/mcp-servers.html | 2 +- .../_experimental/out/tools/mcp-servers.txt | 6 +- ...c2hib2FyZCk.tools.mcp-servers.__PAGE__.txt | 4 +- ...ext.!KGRhc2hib2FyZCk.tools.mcp-servers.txt | 2 +- .../__next.!KGRhc2hib2FyZCk.tools.txt | 2 +- .../mcp-servers/__next.!KGRhc2hib2FyZCk.txt | 2 +- .../out/tools/mcp-servers/__next._full.txt | 6 +- .../out/tools/mcp-servers/__next._head.txt | 2 +- .../out/tools/mcp-servers/__next._index.txt | 2 +- .../out/tools/mcp-servers/__next._tree.txt | 2 +- .../out/tools/vector-stores.html | 2 +- .../_experimental/out/tools/vector-stores.txt | 2 +- .../__next.!KGRhc2hib2FyZCk.tools.txt | 2 +- ...hib2FyZCk.tools.vector-stores.__PAGE__.txt | 2 +- ...t.!KGRhc2hib2FyZCk.tools.vector-stores.txt | 2 +- .../vector-stores/__next.!KGRhc2hib2FyZCk.txt | 2 +- .../out/tools/vector-stores/__next._full.txt | 2 +- .../out/tools/vector-stores/__next._head.txt | 2 +- .../out/tools/vector-stores/__next._index.txt | 2 +- .../out/tools/vector-stores/__next._tree.txt | 2 +- litellm/proxy/_experimental/out/usage.html | 2 +- litellm/proxy/_experimental/out/usage.txt | 6 +- .../out/usage/__next.!KGRhc2hib2FyZCk.txt | 2 +- ...__next.!KGRhc2hib2FyZCk.usage.__PAGE__.txt | 4 +- .../usage/__next.!KGRhc2hib2FyZCk.usage.txt | 2 +- .../_experimental/out/usage/__next._full.txt | 6 +- .../_experimental/out/usage/__next._head.txt | 2 +- .../_experimental/out/usage/__next._index.txt | 2 +- .../_experimental/out/usage/__next._tree.txt | 2 +- litellm/proxy/_experimental/out/users.html | 2 +- litellm/proxy/_experimental/out/users.txt | 6 +- .../out/users/__next.!KGRhc2hib2FyZCk.txt | 2 +- ...__next.!KGRhc2hib2FyZCk.users.__PAGE__.txt | 4 +- .../users/__next.!KGRhc2hib2FyZCk.users.txt | 2 +- .../_experimental/out/users/__next._full.txt | 6 +- .../_experimental/out/users/__next._head.txt | 2 +- .../_experimental/out/users/__next._index.txt | 2 +- .../_experimental/out/users/__next._tree.txt | 2 +- .../proxy/_experimental/out/virtual-keys.html | 2 +- .../proxy/_experimental/out/virtual-keys.txt | 6 +- .../virtual-keys/__next.!KGRhc2hib2FyZCk.txt | 2 +- ...!KGRhc2hib2FyZCk.virtual-keys.__PAGE__.txt | 4 +- .../__next.!KGRhc2hib2FyZCk.virtual-keys.txt | 2 +- .../out/virtual-keys/__next._full.txt | 6 +- .../out/virtual-keys/__next._head.txt | 2 +- .../out/virtual-keys/__next._index.txt | 2 +- .../out/virtual-keys/__next._tree.txt | 2 +- 366 files changed, 1415 insertions(+), 1415 deletions(-) rename litellm/proxy/_experimental/out/_next/static/{-9iBbUN_ohnDf0d-Ux3Ju => TJoC-1vfaZhT4qVEjYiL1}/_buildManifest.js (100%) rename litellm/proxy/_experimental/out/_next/static/{-9iBbUN_ohnDf0d-Ux3Ju => TJoC-1vfaZhT4qVEjYiL1}/_clientMiddlewareManifest.json (100%) rename litellm/proxy/_experimental/out/_next/static/{-9iBbUN_ohnDf0d-Ux3Ju => TJoC-1vfaZhT4qVEjYiL1}/_ssgManifest.js (100%) create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/086f1dd580fe748e.js rename litellm/proxy/_experimental/out/_next/static/chunks/{2e768c2b1dfc8cd5.js => 0c6c65a34bcde140.js} (68%) delete mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/0d219667baa010f5.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/11c5483d145114d0.js rename litellm/proxy/_experimental/out/_next/static/chunks/{161a2ab7f4e973ca.js => 130cfc006c4f7d77.js} (71%) delete mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/13670846207c3e16.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/1379bf26a33536ad.js rename litellm/proxy/_experimental/out/_next/static/chunks/{b3b05b76472ce110.js => 1501e804b4d0f510.js} (85%) create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/1973a4cee645cb66.js rename litellm/proxy/_experimental/out/_next/static/chunks/{ae31df62c48a7fb3.js => 27289c624996260b.js} (76%) create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/316d3919d0bb4207.js delete mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/354ca537c6c0601c.js delete mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/360f35fe2e0a4945.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/3e3213d578d771d6.js delete mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/44b9dfbbfb0955a2.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/4da28073ebe41531.js delete mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/4e5da3c236abd875.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/60b0cadba57cd7f7.js rename litellm/proxy/_experimental/out/_next/static/chunks/{b59aefcfdd5715be.js => 61d8ae4ec4f309fe.js} (64%) rename litellm/proxy/_experimental/out/_next/static/chunks/{7ba30115a5664a84.js => 6392214b899e5c07.js} (60%) delete mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/6af2d8fb8cb64938.js delete mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/7524a4c1b1d4ad79.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/75761fc3c2814916.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/7dd16a650b98a4c5.js rename litellm/proxy/_experimental/out/_next/static/chunks/{589dbe4d6a5a8128.js => 7e46b6e6e9d69068.js} (71%) create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/813d581ad8ef856a.js delete mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/84c717b1ad096487.js delete mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/8c6d915f992d48df.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/94f7251fb8b74702.js delete mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/974eb6f77e6d258b.js rename litellm/proxy/_experimental/out/_next/static/chunks/{9d4250986e22b9e4.js => 99997b92ae046b23.js} (71%) delete mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/9a17d35f872a6c38.js delete mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/9c8f0f460dea2bbd.js rename litellm/proxy/_experimental/out/_next/static/chunks/{4fc2d71e511309ab.js => a02f90f97248b9aa.js} (52%) rename litellm/proxy/_experimental/out/_next/static/chunks/{7c74114b00de04c5.js => a230559fcabaea23.js} (82%) delete mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/b032bb46393a6abb.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/b6c1a99750c8786e.js rename litellm/proxy/_experimental/out/_next/static/chunks/{197cf6318d9db90c.js => b88f74d6b19daf48.js} (98%) rename litellm/proxy/_experimental/out/_next/static/chunks/{f1bb41d04b7a8f8d.js => be379dba69f5f250.js} (71%) create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/c563dc5d6cf8678b.js rename litellm/proxy/_experimental/out/_next/static/chunks/{49e9dce7df902771.js => d3108ee6d0129019.js} (77%) delete mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/d3fe6e52dd701fba.js rename litellm/proxy/_experimental/out/_next/static/chunks/{e3a77189dc2b5775.js => d93c51cc643f3390.js} (71%) create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/df37a0019220a941.js rename litellm/proxy/_experimental/out/_next/static/chunks/{bf01d87225e5be70.js => eaa9f9b9bb3e054b.js} (82%) delete mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/ec7bc708a7afa043.js delete mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/ee9e514b2c2694f7.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/f0171e7fee2034ce.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/f9b068e88ed2d7e3.js rename litellm/proxy/_experimental/out/_next/static/chunks/{6de75ace22fd0a0f.js => ffeecf52efe5b98f.js} (71%) diff --git a/litellm/proxy/_experimental/out/404.html b/litellm/proxy/_experimental/out/404.html index 344481d3ae..d7529a0919 100644 --- a/litellm/proxy/_experimental/out/404.html +++ b/litellm/proxy/_experimental/out/404.html @@ -1 +1 @@ -404: This page could not be found.LiteLLM Dashboard

404

This page could not be found.

\ No newline at end of file +404: This page could not be found.LiteLLM Dashboard

404

This page could not be found.

\ No newline at end of file diff --git a/litellm/proxy/_experimental/out/__next.__PAGE__.txt b/litellm/proxy/_experimental/out/__next.__PAGE__.txt index 983a085c74..4735492bce 100644 --- a/litellm/proxy/_experimental/out/__next.__PAGE__.txt +++ b/litellm/proxy/_experimental/out/__next.__PAGE__.txt @@ -1,28 +1,28 @@ 1:"$Sreact.fragment" 2:I[347257,["/litellm-asset-prefix/_next/static/chunks/d96012bcfc98706a.js","/litellm-asset-prefix/_next/static/chunks/dbca964212122d58.js"],"ClientPageRoot"] -3:I[952683,["/litellm-asset-prefix/_next/static/chunks/9e09de50158b3159.js","/litellm-asset-prefix/_next/static/chunks/7e5fe5584502da06.js","/litellm-asset-prefix/_next/static/chunks/9a17d35f872a6c38.js","/litellm-asset-prefix/_next/static/chunks/142704439974f6b3.js","/litellm-asset-prefix/_next/static/chunks/30539b80ac15aad2.js","/litellm-asset-prefix/_next/static/chunks/99d715502d5069f4.js","/litellm-asset-prefix/_next/static/chunks/7834a5efb7b5f959.js","/litellm-asset-prefix/_next/static/chunks/1fe0596a309ad6cf.js","/litellm-asset-prefix/_next/static/chunks/7b788dd93ad868b3.js","/litellm-asset-prefix/_next/static/chunks/c847ecdf8c790b0b.js","/litellm-asset-prefix/_next/static/chunks/403c4d96324c23a6.js","/litellm-asset-prefix/_next/static/chunks/a7113797b37526f0.js","/litellm-asset-prefix/_next/static/chunks/ee5f9a39a526e423.js","/litellm-asset-prefix/_next/static/chunks/db0ac43a898048e2.js","/litellm-asset-prefix/_next/static/chunks/3b30ab8eaa03bc21.js","/litellm-asset-prefix/_next/static/chunks/c53c9c7afec96700.js","/litellm-asset-prefix/_next/static/chunks/ee9e514b2c2694f7.js","/litellm-asset-prefix/_next/static/chunks/bb71734679762761.js","/litellm-asset-prefix/_next/static/chunks/1fd9dbe73d002173.js","/litellm-asset-prefix/_next/static/chunks/ed901fab61dc16dc.js","/litellm-asset-prefix/_next/static/chunks/ed90bf177ad61e18.js","/litellm-asset-prefix/_next/static/chunks/e1f23fd814ac3500.js","/litellm-asset-prefix/_next/static/chunks/2971c4658f1bcd7d.js","/litellm-asset-prefix/_next/static/chunks/88c74f8b4b20d25a.js","/litellm-asset-prefix/_next/static/chunks/134f728fa7099e3e.js","/litellm-asset-prefix/_next/static/chunks/ed4f62880278d987.js","/litellm-asset-prefix/_next/static/chunks/60d899dd52430ef8.js","/litellm-asset-prefix/_next/static/chunks/a5774cdb9f28daa1.js","/litellm-asset-prefix/_next/static/chunks/f04f887c803d9e60.js","/litellm-asset-prefix/_next/static/chunks/7e417dd24c8becd0.js","/litellm-asset-prefix/_next/static/chunks/a7dc5e0c9d37afe3.js","/litellm-asset-prefix/_next/static/chunks/86819b3a4f820602.js","/litellm-asset-prefix/_next/static/chunks/b6cdb9a433f054f3.js","/litellm-asset-prefix/_next/static/chunks/bf01d87225e5be70.js","/litellm-asset-prefix/_next/static/chunks/b3b05b76472ce110.js","/litellm-asset-prefix/_next/static/chunks/fcdf7322b0aa3e2e.js","/litellm-asset-prefix/_next/static/chunks/47a838c67cdd745e.js","/litellm-asset-prefix/_next/static/chunks/4fc2d71e511309ab.js","/litellm-asset-prefix/_next/static/chunks/0a65da2cd24e2ab6.js","/litellm-asset-prefix/_next/static/chunks/4980372eaa37b78b.js","/litellm-asset-prefix/_next/static/chunks/d3ac82723ec9e30d.js","/litellm-asset-prefix/_next/static/chunks/496b84010c33cf69.js","/litellm-asset-prefix/_next/static/chunks/360f35fe2e0a4945.js","/litellm-asset-prefix/_next/static/chunks/0d219667baa010f5.js","/litellm-asset-prefix/_next/static/chunks/7a2dc852f68481ea.js","/litellm-asset-prefix/_next/static/chunks/99cf9cf99df5ccfc.js","/litellm-asset-prefix/_next/static/chunks/d0d828f9a0668699.js","/litellm-asset-prefix/_next/static/chunks/f9c24d6e7ec43046.js","/litellm-asset-prefix/_next/static/chunks/7c797521435cb59c.js","/litellm-asset-prefix/_next/static/chunks/908828a91f602d8b.js","/litellm-asset-prefix/_next/static/chunks/53ac95bfa383e1b4.js","/litellm-asset-prefix/_next/static/chunks/169b34fe8aeee0c7.js","/litellm-asset-prefix/_next/static/chunks/2e768c2b1dfc8cd5.js"],"default"] +3:I[952683,["/litellm-asset-prefix/_next/static/chunks/9e09de50158b3159.js","/litellm-asset-prefix/_next/static/chunks/7e5fe5584502da06.js","/litellm-asset-prefix/_next/static/chunks/142704439974f6b3.js","/litellm-asset-prefix/_next/static/chunks/df37a0019220a941.js","/litellm-asset-prefix/_next/static/chunks/30539b80ac15aad2.js","/litellm-asset-prefix/_next/static/chunks/99d715502d5069f4.js","/litellm-asset-prefix/_next/static/chunks/7834a5efb7b5f959.js","/litellm-asset-prefix/_next/static/chunks/1fe0596a309ad6cf.js","/litellm-asset-prefix/_next/static/chunks/7b788dd93ad868b3.js","/litellm-asset-prefix/_next/static/chunks/c847ecdf8c790b0b.js","/litellm-asset-prefix/_next/static/chunks/403c4d96324c23a6.js","/litellm-asset-prefix/_next/static/chunks/a7113797b37526f0.js","/litellm-asset-prefix/_next/static/chunks/ee5f9a39a526e423.js","/litellm-asset-prefix/_next/static/chunks/db0ac43a898048e2.js","/litellm-asset-prefix/_next/static/chunks/3b30ab8eaa03bc21.js","/litellm-asset-prefix/_next/static/chunks/c53c9c7afec96700.js","/litellm-asset-prefix/_next/static/chunks/60b0cadba57cd7f7.js","/litellm-asset-prefix/_next/static/chunks/bb71734679762761.js","/litellm-asset-prefix/_next/static/chunks/1fd9dbe73d002173.js","/litellm-asset-prefix/_next/static/chunks/ed901fab61dc16dc.js","/litellm-asset-prefix/_next/static/chunks/ed90bf177ad61e18.js","/litellm-asset-prefix/_next/static/chunks/e1f23fd814ac3500.js","/litellm-asset-prefix/_next/static/chunks/2971c4658f1bcd7d.js","/litellm-asset-prefix/_next/static/chunks/88c74f8b4b20d25a.js","/litellm-asset-prefix/_next/static/chunks/134f728fa7099e3e.js","/litellm-asset-prefix/_next/static/chunks/ed4f62880278d987.js","/litellm-asset-prefix/_next/static/chunks/60d899dd52430ef8.js","/litellm-asset-prefix/_next/static/chunks/eaa9f9b9bb3e054b.js","/litellm-asset-prefix/_next/static/chunks/f04f887c803d9e60.js","/litellm-asset-prefix/_next/static/chunks/7e417dd24c8becd0.js","/litellm-asset-prefix/_next/static/chunks/99cf9cf99df5ccfc.js","/litellm-asset-prefix/_next/static/chunks/a02f90f97248b9aa.js","/litellm-asset-prefix/_next/static/chunks/b6cdb9a433f054f3.js","/litellm-asset-prefix/_next/static/chunks/a5774cdb9f28daa1.js","/litellm-asset-prefix/_next/static/chunks/1501e804b4d0f510.js","/litellm-asset-prefix/_next/static/chunks/86819b3a4f820602.js","/litellm-asset-prefix/_next/static/chunks/47a838c67cdd745e.js","/litellm-asset-prefix/_next/static/chunks/a7dc5e0c9d37afe3.js","/litellm-asset-prefix/_next/static/chunks/0a65da2cd24e2ab6.js","/litellm-asset-prefix/_next/static/chunks/4980372eaa37b78b.js","/litellm-asset-prefix/_next/static/chunks/d3ac82723ec9e30d.js","/litellm-asset-prefix/_next/static/chunks/7dd16a650b98a4c5.js","/litellm-asset-prefix/_next/static/chunks/94f7251fb8b74702.js","/litellm-asset-prefix/_next/static/chunks/169b34fe8aeee0c7.js","/litellm-asset-prefix/_next/static/chunks/7a2dc852f68481ea.js","/litellm-asset-prefix/_next/static/chunks/908828a91f602d8b.js","/litellm-asset-prefix/_next/static/chunks/d0d828f9a0668699.js","/litellm-asset-prefix/_next/static/chunks/f9c24d6e7ec43046.js","/litellm-asset-prefix/_next/static/chunks/7c797521435cb59c.js","/litellm-asset-prefix/_next/static/chunks/496b84010c33cf69.js","/litellm-asset-prefix/_next/static/chunks/fcdf7322b0aa3e2e.js","/litellm-asset-prefix/_next/static/chunks/53ac95bfa383e1b4.js","/litellm-asset-prefix/_next/static/chunks/0c6c65a34bcde140.js"],"default"] 18:I[897367,["/litellm-asset-prefix/_next/static/chunks/d96012bcfc98706a.js","/litellm-asset-prefix/_next/static/chunks/dbca964212122d58.js"],"OutletBoundary"] 19:"$Sreact.suspense" :HL["/litellm-asset-prefix/_next/static/chunks/3f3fa56b5786d58c.css","style"] -0:{"buildId":"-9iBbUN_ohnDf0d-Ux3Ju","rsc":["$","$1","c",{"children":[["$","$L2",null,{"Component":"$3","serverProvidedParams":{"searchParams":{},"params":{},"promises":["$@4","$@5"]}}],[["$","link","0",{"rel":"stylesheet","href":"/litellm-asset-prefix/_next/static/chunks/3f3fa56b5786d58c.css","precedence":"next"}],["$","script","script-0",{"src":"/litellm-asset-prefix/_next/static/chunks/9a17d35f872a6c38.js","async":true}],["$","script","script-1",{"src":"/litellm-asset-prefix/_next/static/chunks/142704439974f6b3.js","async":true}],["$","script","script-2",{"src":"/litellm-asset-prefix/_next/static/chunks/30539b80ac15aad2.js","async":true}],["$","script","script-3",{"src":"/litellm-asset-prefix/_next/static/chunks/99d715502d5069f4.js","async":true}],["$","script","script-4",{"src":"/litellm-asset-prefix/_next/static/chunks/7834a5efb7b5f959.js","async":true}],["$","script","script-5",{"src":"/litellm-asset-prefix/_next/static/chunks/1fe0596a309ad6cf.js","async":true}],["$","script","script-6",{"src":"/litellm-asset-prefix/_next/static/chunks/7b788dd93ad868b3.js","async":true}],["$","script","script-7",{"src":"/litellm-asset-prefix/_next/static/chunks/c847ecdf8c790b0b.js","async":true}],["$","script","script-8",{"src":"/litellm-asset-prefix/_next/static/chunks/403c4d96324c23a6.js","async":true}],["$","script","script-9",{"src":"/litellm-asset-prefix/_next/static/chunks/a7113797b37526f0.js","async":true}],["$","script","script-10",{"src":"/litellm-asset-prefix/_next/static/chunks/ee5f9a39a526e423.js","async":true}],["$","script","script-11",{"src":"/litellm-asset-prefix/_next/static/chunks/db0ac43a898048e2.js","async":true}],["$","script","script-12",{"src":"/litellm-asset-prefix/_next/static/chunks/3b30ab8eaa03bc21.js","async":true}],["$","script","script-13",{"src":"/litellm-asset-prefix/_next/static/chunks/c53c9c7afec96700.js","async":true}],["$","script","script-14",{"src":"/litellm-asset-prefix/_next/static/chunks/ee9e514b2c2694f7.js","async":true}],["$","script","script-15",{"src":"/litellm-asset-prefix/_next/static/chunks/bb71734679762761.js","async":true}],["$","script","script-16",{"src":"/litellm-asset-prefix/_next/static/chunks/1fd9dbe73d002173.js","async":true}],["$","script","script-17",{"src":"/litellm-asset-prefix/_next/static/chunks/ed901fab61dc16dc.js","async":true}],["$","script","script-18",{"src":"/litellm-asset-prefix/_next/static/chunks/ed90bf177ad61e18.js","async":true}],["$","script","script-19",{"src":"/litellm-asset-prefix/_next/static/chunks/e1f23fd814ac3500.js","async":true}],["$","script","script-20",{"src":"/litellm-asset-prefix/_next/static/chunks/2971c4658f1bcd7d.js","async":true}],["$","script","script-21",{"src":"/litellm-asset-prefix/_next/static/chunks/88c74f8b4b20d25a.js","async":true}],["$","script","script-22",{"src":"/litellm-asset-prefix/_next/static/chunks/134f728fa7099e3e.js","async":true}],["$","script","script-23",{"src":"/litellm-asset-prefix/_next/static/chunks/ed4f62880278d987.js","async":true}],["$","script","script-24",{"src":"/litellm-asset-prefix/_next/static/chunks/60d899dd52430ef8.js","async":true}],["$","script","script-25",{"src":"/litellm-asset-prefix/_next/static/chunks/a5774cdb9f28daa1.js","async":true}],["$","script","script-26",{"src":"/litellm-asset-prefix/_next/static/chunks/f04f887c803d9e60.js","async":true}],["$","script","script-27",{"src":"/litellm-asset-prefix/_next/static/chunks/7e417dd24c8becd0.js","async":true}],["$","script","script-28",{"src":"/litellm-asset-prefix/_next/static/chunks/a7dc5e0c9d37afe3.js","async":true}],["$","script","script-29",{"src":"/litellm-asset-prefix/_next/static/chunks/86819b3a4f820602.js","async":true}],["$","script","script-30",{"src":"/litellm-asset-prefix/_next/static/chunks/b6cdb9a433f054f3.js","async":true}],["$","script","script-31",{"src":"/litellm-asset-prefix/_next/static/chunks/bf01d87225e5be70.js","async":true}],["$","script","script-32",{"src":"/litellm-asset-prefix/_next/static/chunks/b3b05b76472ce110.js","async":true}],["$","script","script-33",{"src":"/litellm-asset-prefix/_next/static/chunks/fcdf7322b0aa3e2e.js","async":true}],"$L6","$L7","$L8","$L9","$La","$Lb","$Lc","$Ld","$Le","$Lf","$L10","$L11","$L12","$L13","$L14","$L15","$L16"],"$L17"]}],"loading":null,"isPartial":false} +0:{"buildId":"TJoC-1vfaZhT4qVEjYiL1","rsc":["$","$1","c",{"children":[["$","$L2",null,{"Component":"$3","serverProvidedParams":{"searchParams":{},"params":{},"promises":["$@4","$@5"]}}],[["$","link","0",{"rel":"stylesheet","href":"/litellm-asset-prefix/_next/static/chunks/3f3fa56b5786d58c.css","precedence":"next"}],["$","script","script-0",{"src":"/litellm-asset-prefix/_next/static/chunks/142704439974f6b3.js","async":true}],["$","script","script-1",{"src":"/litellm-asset-prefix/_next/static/chunks/df37a0019220a941.js","async":true}],["$","script","script-2",{"src":"/litellm-asset-prefix/_next/static/chunks/30539b80ac15aad2.js","async":true}],["$","script","script-3",{"src":"/litellm-asset-prefix/_next/static/chunks/99d715502d5069f4.js","async":true}],["$","script","script-4",{"src":"/litellm-asset-prefix/_next/static/chunks/7834a5efb7b5f959.js","async":true}],["$","script","script-5",{"src":"/litellm-asset-prefix/_next/static/chunks/1fe0596a309ad6cf.js","async":true}],["$","script","script-6",{"src":"/litellm-asset-prefix/_next/static/chunks/7b788dd93ad868b3.js","async":true}],["$","script","script-7",{"src":"/litellm-asset-prefix/_next/static/chunks/c847ecdf8c790b0b.js","async":true}],["$","script","script-8",{"src":"/litellm-asset-prefix/_next/static/chunks/403c4d96324c23a6.js","async":true}],["$","script","script-9",{"src":"/litellm-asset-prefix/_next/static/chunks/a7113797b37526f0.js","async":true}],["$","script","script-10",{"src":"/litellm-asset-prefix/_next/static/chunks/ee5f9a39a526e423.js","async":true}],["$","script","script-11",{"src":"/litellm-asset-prefix/_next/static/chunks/db0ac43a898048e2.js","async":true}],["$","script","script-12",{"src":"/litellm-asset-prefix/_next/static/chunks/3b30ab8eaa03bc21.js","async":true}],["$","script","script-13",{"src":"/litellm-asset-prefix/_next/static/chunks/c53c9c7afec96700.js","async":true}],["$","script","script-14",{"src":"/litellm-asset-prefix/_next/static/chunks/60b0cadba57cd7f7.js","async":true}],["$","script","script-15",{"src":"/litellm-asset-prefix/_next/static/chunks/bb71734679762761.js","async":true}],["$","script","script-16",{"src":"/litellm-asset-prefix/_next/static/chunks/1fd9dbe73d002173.js","async":true}],["$","script","script-17",{"src":"/litellm-asset-prefix/_next/static/chunks/ed901fab61dc16dc.js","async":true}],["$","script","script-18",{"src":"/litellm-asset-prefix/_next/static/chunks/ed90bf177ad61e18.js","async":true}],["$","script","script-19",{"src":"/litellm-asset-prefix/_next/static/chunks/e1f23fd814ac3500.js","async":true}],["$","script","script-20",{"src":"/litellm-asset-prefix/_next/static/chunks/2971c4658f1bcd7d.js","async":true}],["$","script","script-21",{"src":"/litellm-asset-prefix/_next/static/chunks/88c74f8b4b20d25a.js","async":true}],["$","script","script-22",{"src":"/litellm-asset-prefix/_next/static/chunks/134f728fa7099e3e.js","async":true}],["$","script","script-23",{"src":"/litellm-asset-prefix/_next/static/chunks/ed4f62880278d987.js","async":true}],["$","script","script-24",{"src":"/litellm-asset-prefix/_next/static/chunks/60d899dd52430ef8.js","async":true}],["$","script","script-25",{"src":"/litellm-asset-prefix/_next/static/chunks/eaa9f9b9bb3e054b.js","async":true}],["$","script","script-26",{"src":"/litellm-asset-prefix/_next/static/chunks/f04f887c803d9e60.js","async":true}],["$","script","script-27",{"src":"/litellm-asset-prefix/_next/static/chunks/7e417dd24c8becd0.js","async":true}],["$","script","script-28",{"src":"/litellm-asset-prefix/_next/static/chunks/99cf9cf99df5ccfc.js","async":true}],["$","script","script-29",{"src":"/litellm-asset-prefix/_next/static/chunks/a02f90f97248b9aa.js","async":true}],["$","script","script-30",{"src":"/litellm-asset-prefix/_next/static/chunks/b6cdb9a433f054f3.js","async":true}],["$","script","script-31",{"src":"/litellm-asset-prefix/_next/static/chunks/a5774cdb9f28daa1.js","async":true}],["$","script","script-32",{"src":"/litellm-asset-prefix/_next/static/chunks/1501e804b4d0f510.js","async":true}],["$","script","script-33",{"src":"/litellm-asset-prefix/_next/static/chunks/86819b3a4f820602.js","async":true}],"$L6","$L7","$L8","$L9","$La","$Lb","$Lc","$Ld","$Le","$Lf","$L10","$L11","$L12","$L13","$L14","$L15","$L16"],"$L17"]}],"loading":null,"isPartial":false} 4:{} 5:"$0:rsc:props:children:0:props:serverProvidedParams:params" 6:["$","script","script-34",{"src":"/litellm-asset-prefix/_next/static/chunks/47a838c67cdd745e.js","async":true}] -7:["$","script","script-35",{"src":"/litellm-asset-prefix/_next/static/chunks/4fc2d71e511309ab.js","async":true}] +7:["$","script","script-35",{"src":"/litellm-asset-prefix/_next/static/chunks/a7dc5e0c9d37afe3.js","async":true}] 8:["$","script","script-36",{"src":"/litellm-asset-prefix/_next/static/chunks/0a65da2cd24e2ab6.js","async":true}] 9:["$","script","script-37",{"src":"/litellm-asset-prefix/_next/static/chunks/4980372eaa37b78b.js","async":true}] a:["$","script","script-38",{"src":"/litellm-asset-prefix/_next/static/chunks/d3ac82723ec9e30d.js","async":true}] -b:["$","script","script-39",{"src":"/litellm-asset-prefix/_next/static/chunks/496b84010c33cf69.js","async":true}] -c:["$","script","script-40",{"src":"/litellm-asset-prefix/_next/static/chunks/360f35fe2e0a4945.js","async":true}] -d:["$","script","script-41",{"src":"/litellm-asset-prefix/_next/static/chunks/0d219667baa010f5.js","async":true}] +b:["$","script","script-39",{"src":"/litellm-asset-prefix/_next/static/chunks/7dd16a650b98a4c5.js","async":true}] +c:["$","script","script-40",{"src":"/litellm-asset-prefix/_next/static/chunks/94f7251fb8b74702.js","async":true}] +d:["$","script","script-41",{"src":"/litellm-asset-prefix/_next/static/chunks/169b34fe8aeee0c7.js","async":true}] e:["$","script","script-42",{"src":"/litellm-asset-prefix/_next/static/chunks/7a2dc852f68481ea.js","async":true}] -f:["$","script","script-43",{"src":"/litellm-asset-prefix/_next/static/chunks/99cf9cf99df5ccfc.js","async":true}] +f:["$","script","script-43",{"src":"/litellm-asset-prefix/_next/static/chunks/908828a91f602d8b.js","async":true}] 10:["$","script","script-44",{"src":"/litellm-asset-prefix/_next/static/chunks/d0d828f9a0668699.js","async":true}] 11:["$","script","script-45",{"src":"/litellm-asset-prefix/_next/static/chunks/f9c24d6e7ec43046.js","async":true}] 12:["$","script","script-46",{"src":"/litellm-asset-prefix/_next/static/chunks/7c797521435cb59c.js","async":true}] -13:["$","script","script-47",{"src":"/litellm-asset-prefix/_next/static/chunks/908828a91f602d8b.js","async":true}] -14:["$","script","script-48",{"src":"/litellm-asset-prefix/_next/static/chunks/53ac95bfa383e1b4.js","async":true}] -15:["$","script","script-49",{"src":"/litellm-asset-prefix/_next/static/chunks/169b34fe8aeee0c7.js","async":true}] -16:["$","script","script-50",{"src":"/litellm-asset-prefix/_next/static/chunks/2e768c2b1dfc8cd5.js","async":true}] +13:["$","script","script-47",{"src":"/litellm-asset-prefix/_next/static/chunks/496b84010c33cf69.js","async":true}] +14:["$","script","script-48",{"src":"/litellm-asset-prefix/_next/static/chunks/fcdf7322b0aa3e2e.js","async":true}] +15:["$","script","script-49",{"src":"/litellm-asset-prefix/_next/static/chunks/53ac95bfa383e1b4.js","async":true}] +16:["$","script","script-50",{"src":"/litellm-asset-prefix/_next/static/chunks/0c6c65a34bcde140.js","async":true}] 17:["$","$L18",null,{"children":["$","$19",null,{"name":"Next.MetadataOutlet","children":"$@1a"}]}] 1a:null diff --git a/litellm/proxy/_experimental/out/__next._full.txt b/litellm/proxy/_experimental/out/__next._full.txt index 74b729f746..d202d55bf7 100644 --- a/litellm/proxy/_experimental/out/__next._full.txt +++ b/litellm/proxy/_experimental/out/__next._full.txt @@ -4,13 +4,13 @@ 4:I[339756,["/litellm-asset-prefix/_next/static/chunks/d96012bcfc98706a.js","/litellm-asset-prefix/_next/static/chunks/dbca964212122d58.js"],"default"] 5:I[837457,["/litellm-asset-prefix/_next/static/chunks/d96012bcfc98706a.js","/litellm-asset-prefix/_next/static/chunks/dbca964212122d58.js"],"default"] 6:I[347257,["/litellm-asset-prefix/_next/static/chunks/d96012bcfc98706a.js","/litellm-asset-prefix/_next/static/chunks/dbca964212122d58.js"],"ClientPageRoot"] -7:I[952683,["/litellm-asset-prefix/_next/static/chunks/9e09de50158b3159.js","/litellm-asset-prefix/_next/static/chunks/7e5fe5584502da06.js","/litellm-asset-prefix/_next/static/chunks/9a17d35f872a6c38.js","/litellm-asset-prefix/_next/static/chunks/142704439974f6b3.js","/litellm-asset-prefix/_next/static/chunks/30539b80ac15aad2.js","/litellm-asset-prefix/_next/static/chunks/99d715502d5069f4.js","/litellm-asset-prefix/_next/static/chunks/7834a5efb7b5f959.js","/litellm-asset-prefix/_next/static/chunks/1fe0596a309ad6cf.js","/litellm-asset-prefix/_next/static/chunks/7b788dd93ad868b3.js","/litellm-asset-prefix/_next/static/chunks/c847ecdf8c790b0b.js","/litellm-asset-prefix/_next/static/chunks/403c4d96324c23a6.js","/litellm-asset-prefix/_next/static/chunks/a7113797b37526f0.js","/litellm-asset-prefix/_next/static/chunks/ee5f9a39a526e423.js","/litellm-asset-prefix/_next/static/chunks/db0ac43a898048e2.js","/litellm-asset-prefix/_next/static/chunks/3b30ab8eaa03bc21.js","/litellm-asset-prefix/_next/static/chunks/c53c9c7afec96700.js","/litellm-asset-prefix/_next/static/chunks/ee9e514b2c2694f7.js","/litellm-asset-prefix/_next/static/chunks/bb71734679762761.js","/litellm-asset-prefix/_next/static/chunks/1fd9dbe73d002173.js","/litellm-asset-prefix/_next/static/chunks/ed901fab61dc16dc.js","/litellm-asset-prefix/_next/static/chunks/ed90bf177ad61e18.js","/litellm-asset-prefix/_next/static/chunks/e1f23fd814ac3500.js","/litellm-asset-prefix/_next/static/chunks/2971c4658f1bcd7d.js","/litellm-asset-prefix/_next/static/chunks/88c74f8b4b20d25a.js","/litellm-asset-prefix/_next/static/chunks/134f728fa7099e3e.js","/litellm-asset-prefix/_next/static/chunks/ed4f62880278d987.js","/litellm-asset-prefix/_next/static/chunks/60d899dd52430ef8.js","/litellm-asset-prefix/_next/static/chunks/a5774cdb9f28daa1.js","/litellm-asset-prefix/_next/static/chunks/f04f887c803d9e60.js","/litellm-asset-prefix/_next/static/chunks/7e417dd24c8becd0.js","/litellm-asset-prefix/_next/static/chunks/a7dc5e0c9d37afe3.js","/litellm-asset-prefix/_next/static/chunks/86819b3a4f820602.js","/litellm-asset-prefix/_next/static/chunks/b6cdb9a433f054f3.js","/litellm-asset-prefix/_next/static/chunks/bf01d87225e5be70.js","/litellm-asset-prefix/_next/static/chunks/b3b05b76472ce110.js","/litellm-asset-prefix/_next/static/chunks/fcdf7322b0aa3e2e.js","/litellm-asset-prefix/_next/static/chunks/47a838c67cdd745e.js","/litellm-asset-prefix/_next/static/chunks/4fc2d71e511309ab.js","/litellm-asset-prefix/_next/static/chunks/0a65da2cd24e2ab6.js","/litellm-asset-prefix/_next/static/chunks/4980372eaa37b78b.js","/litellm-asset-prefix/_next/static/chunks/d3ac82723ec9e30d.js","/litellm-asset-prefix/_next/static/chunks/496b84010c33cf69.js","/litellm-asset-prefix/_next/static/chunks/360f35fe2e0a4945.js","/litellm-asset-prefix/_next/static/chunks/0d219667baa010f5.js","/litellm-asset-prefix/_next/static/chunks/7a2dc852f68481ea.js","/litellm-asset-prefix/_next/static/chunks/99cf9cf99df5ccfc.js","/litellm-asset-prefix/_next/static/chunks/d0d828f9a0668699.js","/litellm-asset-prefix/_next/static/chunks/f9c24d6e7ec43046.js","/litellm-asset-prefix/_next/static/chunks/7c797521435cb59c.js","/litellm-asset-prefix/_next/static/chunks/908828a91f602d8b.js","/litellm-asset-prefix/_next/static/chunks/53ac95bfa383e1b4.js","/litellm-asset-prefix/_next/static/chunks/169b34fe8aeee0c7.js","/litellm-asset-prefix/_next/static/chunks/2e768c2b1dfc8cd5.js"],"default"] +7:I[952683,["/litellm-asset-prefix/_next/static/chunks/9e09de50158b3159.js","/litellm-asset-prefix/_next/static/chunks/7e5fe5584502da06.js","/litellm-asset-prefix/_next/static/chunks/142704439974f6b3.js","/litellm-asset-prefix/_next/static/chunks/df37a0019220a941.js","/litellm-asset-prefix/_next/static/chunks/30539b80ac15aad2.js","/litellm-asset-prefix/_next/static/chunks/99d715502d5069f4.js","/litellm-asset-prefix/_next/static/chunks/7834a5efb7b5f959.js","/litellm-asset-prefix/_next/static/chunks/1fe0596a309ad6cf.js","/litellm-asset-prefix/_next/static/chunks/7b788dd93ad868b3.js","/litellm-asset-prefix/_next/static/chunks/c847ecdf8c790b0b.js","/litellm-asset-prefix/_next/static/chunks/403c4d96324c23a6.js","/litellm-asset-prefix/_next/static/chunks/a7113797b37526f0.js","/litellm-asset-prefix/_next/static/chunks/ee5f9a39a526e423.js","/litellm-asset-prefix/_next/static/chunks/db0ac43a898048e2.js","/litellm-asset-prefix/_next/static/chunks/3b30ab8eaa03bc21.js","/litellm-asset-prefix/_next/static/chunks/c53c9c7afec96700.js","/litellm-asset-prefix/_next/static/chunks/60b0cadba57cd7f7.js","/litellm-asset-prefix/_next/static/chunks/bb71734679762761.js","/litellm-asset-prefix/_next/static/chunks/1fd9dbe73d002173.js","/litellm-asset-prefix/_next/static/chunks/ed901fab61dc16dc.js","/litellm-asset-prefix/_next/static/chunks/ed90bf177ad61e18.js","/litellm-asset-prefix/_next/static/chunks/e1f23fd814ac3500.js","/litellm-asset-prefix/_next/static/chunks/2971c4658f1bcd7d.js","/litellm-asset-prefix/_next/static/chunks/88c74f8b4b20d25a.js","/litellm-asset-prefix/_next/static/chunks/134f728fa7099e3e.js","/litellm-asset-prefix/_next/static/chunks/ed4f62880278d987.js","/litellm-asset-prefix/_next/static/chunks/60d899dd52430ef8.js","/litellm-asset-prefix/_next/static/chunks/eaa9f9b9bb3e054b.js","/litellm-asset-prefix/_next/static/chunks/f04f887c803d9e60.js","/litellm-asset-prefix/_next/static/chunks/7e417dd24c8becd0.js","/litellm-asset-prefix/_next/static/chunks/99cf9cf99df5ccfc.js","/litellm-asset-prefix/_next/static/chunks/a02f90f97248b9aa.js","/litellm-asset-prefix/_next/static/chunks/b6cdb9a433f054f3.js","/litellm-asset-prefix/_next/static/chunks/a5774cdb9f28daa1.js","/litellm-asset-prefix/_next/static/chunks/1501e804b4d0f510.js","/litellm-asset-prefix/_next/static/chunks/86819b3a4f820602.js","/litellm-asset-prefix/_next/static/chunks/47a838c67cdd745e.js","/litellm-asset-prefix/_next/static/chunks/a7dc5e0c9d37afe3.js","/litellm-asset-prefix/_next/static/chunks/0a65da2cd24e2ab6.js","/litellm-asset-prefix/_next/static/chunks/4980372eaa37b78b.js","/litellm-asset-prefix/_next/static/chunks/d3ac82723ec9e30d.js","/litellm-asset-prefix/_next/static/chunks/7dd16a650b98a4c5.js","/litellm-asset-prefix/_next/static/chunks/94f7251fb8b74702.js","/litellm-asset-prefix/_next/static/chunks/169b34fe8aeee0c7.js","/litellm-asset-prefix/_next/static/chunks/7a2dc852f68481ea.js","/litellm-asset-prefix/_next/static/chunks/908828a91f602d8b.js","/litellm-asset-prefix/_next/static/chunks/d0d828f9a0668699.js","/litellm-asset-prefix/_next/static/chunks/f9c24d6e7ec43046.js","/litellm-asset-prefix/_next/static/chunks/7c797521435cb59c.js","/litellm-asset-prefix/_next/static/chunks/496b84010c33cf69.js","/litellm-asset-prefix/_next/static/chunks/fcdf7322b0aa3e2e.js","/litellm-asset-prefix/_next/static/chunks/53ac95bfa383e1b4.js","/litellm-asset-prefix/_next/static/chunks/0c6c65a34bcde140.js"],"default"] 2f:I[168027,[],"default"] :HL["/litellm-asset-prefix/_next/static/chunks/4e20891f2fd03463.css","style"] :HL["/litellm-asset-prefix/_next/static/chunks/c3f387b3358b56db.css","style"] :HL["/litellm-asset-prefix/_next/static/media/83afe278b6a6bb3c-s.p.3a6ba036.woff2","font",{"crossOrigin":"","type":"font/woff2"}] :HL["/litellm-asset-prefix/_next/static/chunks/3f3fa56b5786d58c.css","style"] -0:{"P":null,"b":"-9iBbUN_ohnDf0d-Ux3Ju","c":["",""],"q":"","i":false,"f":[[["",{"children":["__PAGE__",{}]},"$undefined","$undefined",true],[["$","$1","c",{"children":[[["$","link","0",{"rel":"stylesheet","href":"/litellm-asset-prefix/_next/static/chunks/4e20891f2fd03463.css","precedence":"next","crossOrigin":"$undefined","nonce":"$undefined"}],["$","link","1",{"rel":"stylesheet","href":"/litellm-asset-prefix/_next/static/chunks/c3f387b3358b56db.css","precedence":"next","crossOrigin":"$undefined","nonce":"$undefined"}],["$","script","script-0",{"src":"/litellm-asset-prefix/_next/static/chunks/9e09de50158b3159.js","async":true,"nonce":"$undefined"}],["$","script","script-1",{"src":"/litellm-asset-prefix/_next/static/chunks/7e5fe5584502da06.js","async":true,"nonce":"$undefined"}]],["$","html",null,{"lang":"en","children":["$","body",null,{"className":"inter_5972bc34-module__OU16Qa__className","children":["$","$L2",null,{"children":["$","$L3",null,{"children":["$","$L4",null,{"parallelRouterKey":"children","error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":[[["$","title",null,{"children":"404: This page could not be found."}],["$","div",null,{"style":{"fontFamily":"system-ui,\"Segoe UI\",Roboto,Helvetica,Arial,sans-serif,\"Apple Color Emoji\",\"Segoe UI Emoji\"","height":"100vh","textAlign":"center","display":"flex","flexDirection":"column","alignItems":"center","justifyContent":"center"},"children":["$","div",null,{"children":[["$","style",null,{"dangerouslySetInnerHTML":{"__html":"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}"}}],["$","h1",null,{"className":"next-error-h1","style":{"display":"inline-block","margin":"0 20px 0 0","padding":"0 23px 0 0","fontSize":24,"fontWeight":500,"verticalAlign":"top","lineHeight":"49px"},"children":404}],["$","div",null,{"style":{"display":"inline-block"},"children":["$","h2",null,{"style":{"fontSize":14,"fontWeight":400,"lineHeight":"49px","margin":0},"children":"This page could not be found."}]}]]}]}]],[]],"forbidden":"$undefined","unauthorized":"$undefined"}]}]}]}]}]]}],{"children":[["$","$1","c",{"children":[["$","$L6",null,{"Component":"$7","serverProvidedParams":{"searchParams":{},"params":{},"promises":["$@8","$@9"]}}],[["$","link","0",{"rel":"stylesheet","href":"/litellm-asset-prefix/_next/static/chunks/3f3fa56b5786d58c.css","precedence":"next","crossOrigin":"$undefined","nonce":"$undefined"}],["$","script","script-0",{"src":"/litellm-asset-prefix/_next/static/chunks/9a17d35f872a6c38.js","async":true,"nonce":"$undefined"}],["$","script","script-1",{"src":"/litellm-asset-prefix/_next/static/chunks/142704439974f6b3.js","async":true,"nonce":"$undefined"}],["$","script","script-2",{"src":"/litellm-asset-prefix/_next/static/chunks/30539b80ac15aad2.js","async":true,"nonce":"$undefined"}],["$","script","script-3",{"src":"/litellm-asset-prefix/_next/static/chunks/99d715502d5069f4.js","async":true,"nonce":"$undefined"}],["$","script","script-4",{"src":"/litellm-asset-prefix/_next/static/chunks/7834a5efb7b5f959.js","async":true,"nonce":"$undefined"}],["$","script","script-5",{"src":"/litellm-asset-prefix/_next/static/chunks/1fe0596a309ad6cf.js","async":true,"nonce":"$undefined"}],["$","script","script-6",{"src":"/litellm-asset-prefix/_next/static/chunks/7b788dd93ad868b3.js","async":true,"nonce":"$undefined"}],["$","script","script-7",{"src":"/litellm-asset-prefix/_next/static/chunks/c847ecdf8c790b0b.js","async":true,"nonce":"$undefined"}],["$","script","script-8",{"src":"/litellm-asset-prefix/_next/static/chunks/403c4d96324c23a6.js","async":true,"nonce":"$undefined"}],["$","script","script-9",{"src":"/litellm-asset-prefix/_next/static/chunks/a7113797b37526f0.js","async":true,"nonce":"$undefined"}],["$","script","script-10",{"src":"/litellm-asset-prefix/_next/static/chunks/ee5f9a39a526e423.js","async":true,"nonce":"$undefined"}],["$","script","script-11",{"src":"/litellm-asset-prefix/_next/static/chunks/db0ac43a898048e2.js","async":true,"nonce":"$undefined"}],["$","script","script-12",{"src":"/litellm-asset-prefix/_next/static/chunks/3b30ab8eaa03bc21.js","async":true,"nonce":"$undefined"}],["$","script","script-13",{"src":"/litellm-asset-prefix/_next/static/chunks/c53c9c7afec96700.js","async":true,"nonce":"$undefined"}],["$","script","script-14",{"src":"/litellm-asset-prefix/_next/static/chunks/ee9e514b2c2694f7.js","async":true,"nonce":"$undefined"}],["$","script","script-15",{"src":"/litellm-asset-prefix/_next/static/chunks/bb71734679762761.js","async":true,"nonce":"$undefined"}],"$La","$Lb","$Lc","$Ld","$Le","$Lf","$L10","$L11","$L12","$L13","$L14","$L15","$L16","$L17","$L18","$L19","$L1a","$L1b","$L1c","$L1d","$L1e","$L1f","$L20","$L21","$L22","$L23","$L24","$L25","$L26","$L27","$L28","$L29","$L2a","$L2b","$L2c"],"$L2d"]}],{},null,false,false]},null,false,false],"$L2e",false]],"m":"$undefined","G":["$2f",[]],"S":true} +0:{"P":null,"b":"TJoC-1vfaZhT4qVEjYiL1","c":["",""],"q":"","i":false,"f":[[["",{"children":["__PAGE__",{}]},"$undefined","$undefined",true],[["$","$1","c",{"children":[[["$","link","0",{"rel":"stylesheet","href":"/litellm-asset-prefix/_next/static/chunks/4e20891f2fd03463.css","precedence":"next","crossOrigin":"$undefined","nonce":"$undefined"}],["$","link","1",{"rel":"stylesheet","href":"/litellm-asset-prefix/_next/static/chunks/c3f387b3358b56db.css","precedence":"next","crossOrigin":"$undefined","nonce":"$undefined"}],["$","script","script-0",{"src":"/litellm-asset-prefix/_next/static/chunks/9e09de50158b3159.js","async":true,"nonce":"$undefined"}],["$","script","script-1",{"src":"/litellm-asset-prefix/_next/static/chunks/7e5fe5584502da06.js","async":true,"nonce":"$undefined"}]],["$","html",null,{"lang":"en","children":["$","body",null,{"className":"inter_5972bc34-module__OU16Qa__className","children":["$","$L2",null,{"children":["$","$L3",null,{"children":["$","$L4",null,{"parallelRouterKey":"children","error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":[[["$","title",null,{"children":"404: This page could not be found."}],["$","div",null,{"style":{"fontFamily":"system-ui,\"Segoe UI\",Roboto,Helvetica,Arial,sans-serif,\"Apple Color Emoji\",\"Segoe UI Emoji\"","height":"100vh","textAlign":"center","display":"flex","flexDirection":"column","alignItems":"center","justifyContent":"center"},"children":["$","div",null,{"children":[["$","style",null,{"dangerouslySetInnerHTML":{"__html":"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}"}}],["$","h1",null,{"className":"next-error-h1","style":{"display":"inline-block","margin":"0 20px 0 0","padding":"0 23px 0 0","fontSize":24,"fontWeight":500,"verticalAlign":"top","lineHeight":"49px"},"children":404}],["$","div",null,{"style":{"display":"inline-block"},"children":["$","h2",null,{"style":{"fontSize":14,"fontWeight":400,"lineHeight":"49px","margin":0},"children":"This page could not be found."}]}]]}]}]],[]],"forbidden":"$undefined","unauthorized":"$undefined"}]}]}]}]}]]}],{"children":[["$","$1","c",{"children":[["$","$L6",null,{"Component":"$7","serverProvidedParams":{"searchParams":{},"params":{},"promises":["$@8","$@9"]}}],[["$","link","0",{"rel":"stylesheet","href":"/litellm-asset-prefix/_next/static/chunks/3f3fa56b5786d58c.css","precedence":"next","crossOrigin":"$undefined","nonce":"$undefined"}],["$","script","script-0",{"src":"/litellm-asset-prefix/_next/static/chunks/142704439974f6b3.js","async":true,"nonce":"$undefined"}],["$","script","script-1",{"src":"/litellm-asset-prefix/_next/static/chunks/df37a0019220a941.js","async":true,"nonce":"$undefined"}],["$","script","script-2",{"src":"/litellm-asset-prefix/_next/static/chunks/30539b80ac15aad2.js","async":true,"nonce":"$undefined"}],["$","script","script-3",{"src":"/litellm-asset-prefix/_next/static/chunks/99d715502d5069f4.js","async":true,"nonce":"$undefined"}],["$","script","script-4",{"src":"/litellm-asset-prefix/_next/static/chunks/7834a5efb7b5f959.js","async":true,"nonce":"$undefined"}],["$","script","script-5",{"src":"/litellm-asset-prefix/_next/static/chunks/1fe0596a309ad6cf.js","async":true,"nonce":"$undefined"}],["$","script","script-6",{"src":"/litellm-asset-prefix/_next/static/chunks/7b788dd93ad868b3.js","async":true,"nonce":"$undefined"}],["$","script","script-7",{"src":"/litellm-asset-prefix/_next/static/chunks/c847ecdf8c790b0b.js","async":true,"nonce":"$undefined"}],["$","script","script-8",{"src":"/litellm-asset-prefix/_next/static/chunks/403c4d96324c23a6.js","async":true,"nonce":"$undefined"}],["$","script","script-9",{"src":"/litellm-asset-prefix/_next/static/chunks/a7113797b37526f0.js","async":true,"nonce":"$undefined"}],["$","script","script-10",{"src":"/litellm-asset-prefix/_next/static/chunks/ee5f9a39a526e423.js","async":true,"nonce":"$undefined"}],["$","script","script-11",{"src":"/litellm-asset-prefix/_next/static/chunks/db0ac43a898048e2.js","async":true,"nonce":"$undefined"}],["$","script","script-12",{"src":"/litellm-asset-prefix/_next/static/chunks/3b30ab8eaa03bc21.js","async":true,"nonce":"$undefined"}],["$","script","script-13",{"src":"/litellm-asset-prefix/_next/static/chunks/c53c9c7afec96700.js","async":true,"nonce":"$undefined"}],["$","script","script-14",{"src":"/litellm-asset-prefix/_next/static/chunks/60b0cadba57cd7f7.js","async":true,"nonce":"$undefined"}],["$","script","script-15",{"src":"/litellm-asset-prefix/_next/static/chunks/bb71734679762761.js","async":true,"nonce":"$undefined"}],"$La","$Lb","$Lc","$Ld","$Le","$Lf","$L10","$L11","$L12","$L13","$L14","$L15","$L16","$L17","$L18","$L19","$L1a","$L1b","$L1c","$L1d","$L1e","$L1f","$L20","$L21","$L22","$L23","$L24","$L25","$L26","$L27","$L28","$L29","$L2a","$L2b","$L2c"],"$L2d"]}],{},null,false,false]},null,false,false],"$L2e",false]],"m":"$undefined","G":["$2f",[]],"S":true} 30:I[897367,["/litellm-asset-prefix/_next/static/chunks/d96012bcfc98706a.js","/litellm-asset-prefix/_next/static/chunks/dbca964212122d58.js"],"OutletBoundary"] 31:"$Sreact.suspense" 33:I[897367,["/litellm-asset-prefix/_next/static/chunks/d96012bcfc98706a.js","/litellm-asset-prefix/_next/static/chunks/dbca964212122d58.js"],"ViewportBoundary"] @@ -24,32 +24,32 @@ f:["$","script","script-21",{"src":"/litellm-asset-prefix/_next/static/chunks/88 10:["$","script","script-22",{"src":"/litellm-asset-prefix/_next/static/chunks/134f728fa7099e3e.js","async":true,"nonce":"$undefined"}] 11:["$","script","script-23",{"src":"/litellm-asset-prefix/_next/static/chunks/ed4f62880278d987.js","async":true,"nonce":"$undefined"}] 12:["$","script","script-24",{"src":"/litellm-asset-prefix/_next/static/chunks/60d899dd52430ef8.js","async":true,"nonce":"$undefined"}] -13:["$","script","script-25",{"src":"/litellm-asset-prefix/_next/static/chunks/a5774cdb9f28daa1.js","async":true,"nonce":"$undefined"}] +13:["$","script","script-25",{"src":"/litellm-asset-prefix/_next/static/chunks/eaa9f9b9bb3e054b.js","async":true,"nonce":"$undefined"}] 14:["$","script","script-26",{"src":"/litellm-asset-prefix/_next/static/chunks/f04f887c803d9e60.js","async":true,"nonce":"$undefined"}] 15:["$","script","script-27",{"src":"/litellm-asset-prefix/_next/static/chunks/7e417dd24c8becd0.js","async":true,"nonce":"$undefined"}] -16:["$","script","script-28",{"src":"/litellm-asset-prefix/_next/static/chunks/a7dc5e0c9d37afe3.js","async":true,"nonce":"$undefined"}] -17:["$","script","script-29",{"src":"/litellm-asset-prefix/_next/static/chunks/86819b3a4f820602.js","async":true,"nonce":"$undefined"}] +16:["$","script","script-28",{"src":"/litellm-asset-prefix/_next/static/chunks/99cf9cf99df5ccfc.js","async":true,"nonce":"$undefined"}] +17:["$","script","script-29",{"src":"/litellm-asset-prefix/_next/static/chunks/a02f90f97248b9aa.js","async":true,"nonce":"$undefined"}] 18:["$","script","script-30",{"src":"/litellm-asset-prefix/_next/static/chunks/b6cdb9a433f054f3.js","async":true,"nonce":"$undefined"}] -19:["$","script","script-31",{"src":"/litellm-asset-prefix/_next/static/chunks/bf01d87225e5be70.js","async":true,"nonce":"$undefined"}] -1a:["$","script","script-32",{"src":"/litellm-asset-prefix/_next/static/chunks/b3b05b76472ce110.js","async":true,"nonce":"$undefined"}] -1b:["$","script","script-33",{"src":"/litellm-asset-prefix/_next/static/chunks/fcdf7322b0aa3e2e.js","async":true,"nonce":"$undefined"}] +19:["$","script","script-31",{"src":"/litellm-asset-prefix/_next/static/chunks/a5774cdb9f28daa1.js","async":true,"nonce":"$undefined"}] +1a:["$","script","script-32",{"src":"/litellm-asset-prefix/_next/static/chunks/1501e804b4d0f510.js","async":true,"nonce":"$undefined"}] +1b:["$","script","script-33",{"src":"/litellm-asset-prefix/_next/static/chunks/86819b3a4f820602.js","async":true,"nonce":"$undefined"}] 1c:["$","script","script-34",{"src":"/litellm-asset-prefix/_next/static/chunks/47a838c67cdd745e.js","async":true,"nonce":"$undefined"}] -1d:["$","script","script-35",{"src":"/litellm-asset-prefix/_next/static/chunks/4fc2d71e511309ab.js","async":true,"nonce":"$undefined"}] +1d:["$","script","script-35",{"src":"/litellm-asset-prefix/_next/static/chunks/a7dc5e0c9d37afe3.js","async":true,"nonce":"$undefined"}] 1e:["$","script","script-36",{"src":"/litellm-asset-prefix/_next/static/chunks/0a65da2cd24e2ab6.js","async":true,"nonce":"$undefined"}] 1f:["$","script","script-37",{"src":"/litellm-asset-prefix/_next/static/chunks/4980372eaa37b78b.js","async":true,"nonce":"$undefined"}] 20:["$","script","script-38",{"src":"/litellm-asset-prefix/_next/static/chunks/d3ac82723ec9e30d.js","async":true,"nonce":"$undefined"}] -21:["$","script","script-39",{"src":"/litellm-asset-prefix/_next/static/chunks/496b84010c33cf69.js","async":true,"nonce":"$undefined"}] -22:["$","script","script-40",{"src":"/litellm-asset-prefix/_next/static/chunks/360f35fe2e0a4945.js","async":true,"nonce":"$undefined"}] -23:["$","script","script-41",{"src":"/litellm-asset-prefix/_next/static/chunks/0d219667baa010f5.js","async":true,"nonce":"$undefined"}] +21:["$","script","script-39",{"src":"/litellm-asset-prefix/_next/static/chunks/7dd16a650b98a4c5.js","async":true,"nonce":"$undefined"}] +22:["$","script","script-40",{"src":"/litellm-asset-prefix/_next/static/chunks/94f7251fb8b74702.js","async":true,"nonce":"$undefined"}] +23:["$","script","script-41",{"src":"/litellm-asset-prefix/_next/static/chunks/169b34fe8aeee0c7.js","async":true,"nonce":"$undefined"}] 24:["$","script","script-42",{"src":"/litellm-asset-prefix/_next/static/chunks/7a2dc852f68481ea.js","async":true,"nonce":"$undefined"}] -25:["$","script","script-43",{"src":"/litellm-asset-prefix/_next/static/chunks/99cf9cf99df5ccfc.js","async":true,"nonce":"$undefined"}] +25:["$","script","script-43",{"src":"/litellm-asset-prefix/_next/static/chunks/908828a91f602d8b.js","async":true,"nonce":"$undefined"}] 26:["$","script","script-44",{"src":"/litellm-asset-prefix/_next/static/chunks/d0d828f9a0668699.js","async":true,"nonce":"$undefined"}] 27:["$","script","script-45",{"src":"/litellm-asset-prefix/_next/static/chunks/f9c24d6e7ec43046.js","async":true,"nonce":"$undefined"}] 28:["$","script","script-46",{"src":"/litellm-asset-prefix/_next/static/chunks/7c797521435cb59c.js","async":true,"nonce":"$undefined"}] -29:["$","script","script-47",{"src":"/litellm-asset-prefix/_next/static/chunks/908828a91f602d8b.js","async":true,"nonce":"$undefined"}] -2a:["$","script","script-48",{"src":"/litellm-asset-prefix/_next/static/chunks/53ac95bfa383e1b4.js","async":true,"nonce":"$undefined"}] -2b:["$","script","script-49",{"src":"/litellm-asset-prefix/_next/static/chunks/169b34fe8aeee0c7.js","async":true,"nonce":"$undefined"}] -2c:["$","script","script-50",{"src":"/litellm-asset-prefix/_next/static/chunks/2e768c2b1dfc8cd5.js","async":true,"nonce":"$undefined"}] +29:["$","script","script-47",{"src":"/litellm-asset-prefix/_next/static/chunks/496b84010c33cf69.js","async":true,"nonce":"$undefined"}] +2a:["$","script","script-48",{"src":"/litellm-asset-prefix/_next/static/chunks/fcdf7322b0aa3e2e.js","async":true,"nonce":"$undefined"}] +2b:["$","script","script-49",{"src":"/litellm-asset-prefix/_next/static/chunks/53ac95bfa383e1b4.js","async":true,"nonce":"$undefined"}] +2c:["$","script","script-50",{"src":"/litellm-asset-prefix/_next/static/chunks/0c6c65a34bcde140.js","async":true,"nonce":"$undefined"}] 2d:["$","$L30",null,{"children":["$","$31",null,{"name":"Next.MetadataOutlet","children":"$@32"}]}] 2e:["$","$1","h",{"children":[null,["$","$L33",null,{"children":"$L34"}],["$","div",null,{"hidden":true,"children":["$","$L35",null,{"children":["$","$31",null,{"name":"Next.Metadata","children":"$L36"}]}]}],["$","meta",null,{"name":"next-size-adjust","content":""}]]}] 8:{} diff --git a/litellm/proxy/_experimental/out/__next._head.txt b/litellm/proxy/_experimental/out/__next._head.txt index fb2e2e6366..9fbed343f0 100644 --- a/litellm/proxy/_experimental/out/__next._head.txt +++ b/litellm/proxy/_experimental/out/__next._head.txt @@ -3,4 +3,4 @@ 3:I[897367,["/litellm-asset-prefix/_next/static/chunks/d96012bcfc98706a.js","/litellm-asset-prefix/_next/static/chunks/dbca964212122d58.js"],"MetadataBoundary"] 4:"$Sreact.suspense" 5:I[27201,["/litellm-asset-prefix/_next/static/chunks/d96012bcfc98706a.js","/litellm-asset-prefix/_next/static/chunks/dbca964212122d58.js"],"IconMark"] -0:{"buildId":"-9iBbUN_ohnDf0d-Ux3Ju","rsc":["$","$1","h",{"children":[null,["$","$L2",null,{"children":[["$","meta","0",{"charSet":"utf-8"}],["$","meta","1",{"name":"viewport","content":"width=device-width, initial-scale=1"}]]}],["$","div",null,{"hidden":true,"children":["$","$L3",null,{"children":["$","$4",null,{"name":"Next.Metadata","children":[["$","title","0",{"children":"LiteLLM Dashboard"}],["$","meta","1",{"name":"description","content":"LiteLLM Proxy Admin UI"}],["$","link","2",{"rel":"icon","href":"/favicon.ico?favicon.1d32c690.ico","sizes":"48x48","type":"image/x-icon"}],["$","link","3",{"rel":"icon","href":"./favicon.ico"}],["$","$L5","4",{}]]}]}]}],["$","meta",null,{"name":"next-size-adjust","content":""}]]}],"loading":null,"isPartial":false} +0:{"buildId":"TJoC-1vfaZhT4qVEjYiL1","rsc":["$","$1","h",{"children":[null,["$","$L2",null,{"children":[["$","meta","0",{"charSet":"utf-8"}],["$","meta","1",{"name":"viewport","content":"width=device-width, initial-scale=1"}]]}],["$","div",null,{"hidden":true,"children":["$","$L3",null,{"children":["$","$4",null,{"name":"Next.Metadata","children":[["$","title","0",{"children":"LiteLLM Dashboard"}],["$","meta","1",{"name":"description","content":"LiteLLM Proxy Admin UI"}],["$","link","2",{"rel":"icon","href":"/favicon.ico?favicon.1d32c690.ico","sizes":"48x48","type":"image/x-icon"}],["$","link","3",{"rel":"icon","href":"./favicon.ico"}],["$","$L5","4",{}]]}]}]}],["$","meta",null,{"name":"next-size-adjust","content":""}]]}],"loading":null,"isPartial":false} diff --git a/litellm/proxy/_experimental/out/__next._index.txt b/litellm/proxy/_experimental/out/__next._index.txt index d8ccccda14..d4077bbc55 100644 --- a/litellm/proxy/_experimental/out/__next._index.txt +++ b/litellm/proxy/_experimental/out/__next._index.txt @@ -5,4 +5,4 @@ 5:I[837457,["/litellm-asset-prefix/_next/static/chunks/d96012bcfc98706a.js","/litellm-asset-prefix/_next/static/chunks/dbca964212122d58.js"],"default"] :HL["/litellm-asset-prefix/_next/static/chunks/4e20891f2fd03463.css","style"] :HL["/litellm-asset-prefix/_next/static/chunks/c3f387b3358b56db.css","style"] -0:{"buildId":"-9iBbUN_ohnDf0d-Ux3Ju","rsc":["$","$1","c",{"children":[[["$","link","0",{"rel":"stylesheet","href":"/litellm-asset-prefix/_next/static/chunks/4e20891f2fd03463.css","precedence":"next"}],["$","link","1",{"rel":"stylesheet","href":"/litellm-asset-prefix/_next/static/chunks/c3f387b3358b56db.css","precedence":"next"}],["$","script","script-0",{"src":"/litellm-asset-prefix/_next/static/chunks/9e09de50158b3159.js","async":true}],["$","script","script-1",{"src":"/litellm-asset-prefix/_next/static/chunks/7e5fe5584502da06.js","async":true}]],["$","html",null,{"lang":"en","children":["$","body",null,{"className":"inter_5972bc34-module__OU16Qa__className","children":["$","$L2",null,{"children":["$","$L3",null,{"children":["$","$L4",null,{"parallelRouterKey":"children","template":["$","$L5",null,{}],"notFound":[[["$","title",null,{"children":"404: This page could not be found."}],["$","div",null,{"style":{"fontFamily":"system-ui,\"Segoe UI\",Roboto,Helvetica,Arial,sans-serif,\"Apple Color Emoji\",\"Segoe UI Emoji\"","height":"100vh","textAlign":"center","display":"flex","flexDirection":"column","alignItems":"center","justifyContent":"center"},"children":["$","div",null,{"children":[["$","style",null,{"dangerouslySetInnerHTML":{"__html":"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}"}}],["$","h1",null,{"className":"next-error-h1","style":{"display":"inline-block","margin":"0 20px 0 0","padding":"0 23px 0 0","fontSize":24,"fontWeight":500,"verticalAlign":"top","lineHeight":"49px"},"children":404}],["$","div",null,{"style":{"display":"inline-block"},"children":["$","h2",null,{"style":{"fontSize":14,"fontWeight":400,"lineHeight":"49px","margin":0},"children":"This page could not be found."}]}]]}]}]],[]]}]}]}]}]}]]}],"loading":null,"isPartial":false} +0:{"buildId":"TJoC-1vfaZhT4qVEjYiL1","rsc":["$","$1","c",{"children":[[["$","link","0",{"rel":"stylesheet","href":"/litellm-asset-prefix/_next/static/chunks/4e20891f2fd03463.css","precedence":"next"}],["$","link","1",{"rel":"stylesheet","href":"/litellm-asset-prefix/_next/static/chunks/c3f387b3358b56db.css","precedence":"next"}],["$","script","script-0",{"src":"/litellm-asset-prefix/_next/static/chunks/9e09de50158b3159.js","async":true}],["$","script","script-1",{"src":"/litellm-asset-prefix/_next/static/chunks/7e5fe5584502da06.js","async":true}]],["$","html",null,{"lang":"en","children":["$","body",null,{"className":"inter_5972bc34-module__OU16Qa__className","children":["$","$L2",null,{"children":["$","$L3",null,{"children":["$","$L4",null,{"parallelRouterKey":"children","template":["$","$L5",null,{}],"notFound":[[["$","title",null,{"children":"404: This page could not be found."}],["$","div",null,{"style":{"fontFamily":"system-ui,\"Segoe UI\",Roboto,Helvetica,Arial,sans-serif,\"Apple Color Emoji\",\"Segoe UI Emoji\"","height":"100vh","textAlign":"center","display":"flex","flexDirection":"column","alignItems":"center","justifyContent":"center"},"children":["$","div",null,{"children":[["$","style",null,{"dangerouslySetInnerHTML":{"__html":"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}"}}],["$","h1",null,{"className":"next-error-h1","style":{"display":"inline-block","margin":"0 20px 0 0","padding":"0 23px 0 0","fontSize":24,"fontWeight":500,"verticalAlign":"top","lineHeight":"49px"},"children":404}],["$","div",null,{"style":{"display":"inline-block"},"children":["$","h2",null,{"style":{"fontSize":14,"fontWeight":400,"lineHeight":"49px","margin":0},"children":"This page could not be found."}]}]]}]}]],[]]}]}]}]}]}]]}],"loading":null,"isPartial":false} diff --git a/litellm/proxy/_experimental/out/__next._tree.txt b/litellm/proxy/_experimental/out/__next._tree.txt index b51ad45da2..743d0a0f62 100644 --- a/litellm/proxy/_experimental/out/__next._tree.txt +++ b/litellm/proxy/_experimental/out/__next._tree.txt @@ -2,4 +2,4 @@ :HL["/litellm-asset-prefix/_next/static/chunks/c3f387b3358b56db.css","style"] :HL["/litellm-asset-prefix/_next/static/media/83afe278b6a6bb3c-s.p.3a6ba036.woff2","font",{"crossOrigin":"","type":"font/woff2"}] :HL["/litellm-asset-prefix/_next/static/chunks/3f3fa56b5786d58c.css","style"] -0:{"buildId":"-9iBbUN_ohnDf0d-Ux3Ju","tree":{"name":"","paramType":null,"paramKey":"","hasRuntimePrefetch":false,"slots":{"children":{"name":"__PAGE__","paramType":null,"paramKey":"__PAGE__","hasRuntimePrefetch":false,"slots":null,"isRootLayout":false}},"isRootLayout":true},"staleTime":300} +0:{"buildId":"TJoC-1vfaZhT4qVEjYiL1","tree":{"name":"","paramType":null,"paramKey":"","hasRuntimePrefetch":false,"slots":{"children":{"name":"__PAGE__","paramType":null,"paramKey":"__PAGE__","hasRuntimePrefetch":false,"slots":null,"isRootLayout":false}},"isRootLayout":true},"staleTime":300} diff --git a/litellm/proxy/_experimental/out/_next/static/-9iBbUN_ohnDf0d-Ux3Ju/_buildManifest.js b/litellm/proxy/_experimental/out/_next/static/TJoC-1vfaZhT4qVEjYiL1/_buildManifest.js similarity index 100% rename from litellm/proxy/_experimental/out/_next/static/-9iBbUN_ohnDf0d-Ux3Ju/_buildManifest.js rename to litellm/proxy/_experimental/out/_next/static/TJoC-1vfaZhT4qVEjYiL1/_buildManifest.js diff --git a/litellm/proxy/_experimental/out/_next/static/-9iBbUN_ohnDf0d-Ux3Ju/_clientMiddlewareManifest.json b/litellm/proxy/_experimental/out/_next/static/TJoC-1vfaZhT4qVEjYiL1/_clientMiddlewareManifest.json similarity index 100% rename from litellm/proxy/_experimental/out/_next/static/-9iBbUN_ohnDf0d-Ux3Ju/_clientMiddlewareManifest.json rename to litellm/proxy/_experimental/out/_next/static/TJoC-1vfaZhT4qVEjYiL1/_clientMiddlewareManifest.json diff --git a/litellm/proxy/_experimental/out/_next/static/-9iBbUN_ohnDf0d-Ux3Ju/_ssgManifest.js b/litellm/proxy/_experimental/out/_next/static/TJoC-1vfaZhT4qVEjYiL1/_ssgManifest.js similarity index 100% rename from litellm/proxy/_experimental/out/_next/static/-9iBbUN_ohnDf0d-Ux3Ju/_ssgManifest.js rename to litellm/proxy/_experimental/out/_next/static/TJoC-1vfaZhT4qVEjYiL1/_ssgManifest.js diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/086f1dd580fe748e.js b/litellm/proxy/_experimental/out/_next/static/chunks/086f1dd580fe748e.js new file mode 100644 index 0000000000..619d0967e9 --- /dev/null +++ b/litellm/proxy/_experimental/out/_next/static/chunks/086f1dd580fe748e.js @@ -0,0 +1 @@ +(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,596115,e=>{"use strict";var s=e.i(843476),l=e.i(271645),a=e.i(764205),t=e.i(584578),r=e.i(808613),i=e.i(56567),o=e.i(468133),n=e.i(708347),d=e.i(304967),c=e.i(994388),m=e.i(309426),u=e.i(599724),h=e.i(350967),x=e.i(404206),p=e.i(747871),g=e.i(500330),_=e.i(752978),j=e.i(197647),f=e.i(653824),b=e.i(881073),v=e.i(723731),y=e.i(278587);let w=({lastRefreshed:e,onRefresh:l,userRole:a,children:t})=>(0,s.jsxs)(f.TabGroup,{className:"gap-2 h-[75vh] w-full",children:[(0,s.jsxs)(b.TabList,{className:"flex justify-between mt-2 w-full items-center",children:[(0,s.jsxs)("div",{className:"flex",children:[(0,s.jsx)(j.Tab,{children:"Your Teams"}),(0,s.jsx)(j.Tab,{children:"Available Teams"}),(0,n.isAdminRole)(a||"")&&(0,s.jsx)(j.Tab,{children:"Default Team Settings"})]}),(0,s.jsxs)("div",{className:"flex items-center space-x-2",children:[e&&(0,s.jsxs)(u.Text,{children:["Last Refreshed: ",e]}),(0,s.jsx)(_.Icon,{icon:y.RefreshIcon,variant:"shadow",size:"xs",className:"self-center",onClick:l})]})]}),(0,s.jsx)(v.TabPanels,{children:t})]});var T=e.i(206929),C=e.i(35983);let N=({filters:e,organizations:l,showFilters:a,onToggleFilters:t,onChange:r,onReset:i})=>(0,s.jsxs)("div",{className:"flex flex-col space-y-4",children:[(0,s.jsxs)("div",{className:"flex flex-wrap items-center gap-3",children:[(0,s.jsxs)("div",{className:"relative w-64",children:[(0,s.jsx)("input",{type:"text",placeholder:"Search by Team Name...",className:"w-full px-3 py-2 pl-8 border rounded-md text-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500",value:e.team_alias,onChange:e=>r("team_alias",e.target.value)}),(0,s.jsx)("svg",{className:"absolute left-2.5 top-2.5 h-4 w-4 text-gray-500",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,s.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"})})]}),(0,s.jsxs)("button",{className:`px-3 py-2 text-sm border rounded-md hover:bg-gray-50 flex items-center gap-2 ${a?"bg-gray-100":""}`,onClick:()=>t(!a),children:[(0,s.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,s.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M3 4a1 1 0 011-1h16a1 1 0 011 1v2.586a1 1 0 01-.293.707l-6.414 6.414a1 1 0 00-.293.707V17l-4 4v-6.586a1 1 0 00-.293-.707L3.293 7.293A1 1 0 013 6.586V4z"})}),"Filters",(e.team_id||e.team_alias||e.organization_id)&&(0,s.jsx)("span",{"data-testid":"active-filter-indicator",className:"w-2 h-2 rounded-full bg-blue-500"})]}),(0,s.jsxs)("button",{className:"px-3 py-2 text-sm border rounded-md hover:bg-gray-50 flex items-center gap-2",onClick:i,children:[(0,s.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,s.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})}),"Reset Filters"]})]}),a&&(0,s.jsxs)("div",{className:"flex flex-wrap items-center gap-3 mt-3",children:[(0,s.jsxs)("div",{className:"relative w-64",children:[(0,s.jsx)("input",{type:"text",placeholder:"Enter Team ID",className:"w-full px-3 py-2 pl-8 border rounded-md text-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500",value:e.team_id,onChange:e=>r("team_id",e.target.value)}),(0,s.jsx)("svg",{className:"absolute left-2.5 top-2.5 h-4 w-4 text-gray-500",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,s.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5.121 17.804A13.937 13.937 0 0112 16c2.5 0 4.847.655 6.879 1.804M15 10a3 3 0 11-6 0 3 3 0 016 0zm6 2a9 9 0 11-18 0 9 9 0 0118 0z"})})]}),(0,s.jsx)("div",{className:"w-64",children:(0,s.jsx)(T.Select,{value:e.organization_id||"",onValueChange:e=>r("organization_id",e),placeholder:"Select Organization",children:l?.map(e=>(0,s.jsx)(C.SelectItem,{value:e.organization_id||"",children:e.organization_alias||e.organization_id},e.organization_id))})})]})]});var S=e.i(135214),k=e.i(269200),I=e.i(942232),F=e.i(977572),A=e.i(427612),z=e.i(64848),M=e.i(496020),O=e.i(592968),P=e.i(591935),L=e.i(68155),D=e.i(389083),E=e.i(871943),B=e.i(502547),R=e.i(355619);let V=({team:e})=>{let[a,t]=(0,l.useState)(!1),r=!e.models||0===e.models.length||e.models.includes("all-proxy-models"),i=(0,l.useMemo)(()=>{if(r)return[];let s=e.models.map(e=>({name:e,source:"direct"}));for(let l of e.access_group_models||[])s.push({name:l,source:"access_group"});return s},[e.models,e.access_group_models,r]),o=(e,l)=>{if("all-proxy-models"===e.name)return(0,s.jsx)(D.Badge,{size:"xs",color:"red",children:(0,s.jsx)(u.Text,{children:"All Proxy Models"})},l);let a=(0,R.getModelDisplayName)(e.name),t=a.length>30?`${a.slice(0,30)}...`:a;return(0,s.jsx)(D.Badge,{size:"xs",color:"access_group"===e.source?"green":"blue",title:"access_group"===e.source?"From access group":"Direct assignment",children:(0,s.jsx)(u.Text,{children:t})},l)};return(0,s.jsx)(F.TableCell,{style:{maxWidth:"8-x",whiteSpace:"pre-wrap",overflow:"hidden"},className:i.length>3?"px-0":"",children:(0,s.jsx)("div",{className:"flex flex-col",children:0===i.length?(0,s.jsx)(D.Badge,{size:"xs",className:"mb-1",color:"red",children:(0,s.jsx)(u.Text,{children:"All Proxy Models"})}):(0,s.jsx)("div",{className:"flex flex-col",children:(0,s.jsxs)("div",{className:"flex items-start",children:[i.length>3&&(0,s.jsx)("div",{children:(0,s.jsx)(_.Icon,{icon:a?E.ChevronDownIcon:B.ChevronRightIcon,className:"cursor-pointer",size:"xs",onClick:()=>{t(e=>!e)}})}),(0,s.jsxs)("div",{className:"flex flex-wrap gap-1",children:[i.slice(0,3).map((e,s)=>o(e,s)),i.length>3&&!a&&(0,s.jsx)(D.Badge,{size:"xs",color:"gray",className:"cursor-pointer",children:(0,s.jsxs)(u.Text,{children:["+",i.length-3," ",i.length-3==1?"more model":"more models"]})}),a&&(0,s.jsx)("div",{className:"flex flex-wrap gap-1",children:i.slice(3).map((e,s)=>o(e,s+3))})]})]})})})})};var H=e.i(918549),H=H,W=e.i(846753),W=W;let U=({team:e,userId:l})=>{var a;let t,r=(a=((e,s)=>{if(!s)return null;let l=e.members_with_roles?.find(e=>e.user_id===s);return l?.role??null})(e,l),t="inline-flex items-center px-2.5 py-0.5 rounded-md text-xs font-medium border","admin"===a?(0,s.jsxs)("span",{className:t,style:{backgroundColor:"#EEF2FF",color:"#3730A3",borderColor:"#C7D2FE"},children:[(0,s.jsx)(H.default,{className:"h-3 w-3 mr-1"}),"Admin"]}):(0,s.jsxs)("span",{className:t,style:{backgroundColor:"#F3F4F6",color:"#4B5563",borderColor:"#E5E7EB"},children:[(0,s.jsx)(W.default,{className:"h-3 w-3 mr-1"}),"Member"]}));return(0,s.jsx)(F.TableCell,{children:r})},G=({teams:e,currentOrg:l,setSelectedTeamId:a,perTeamInfo:t,userRole:r,userId:i,setEditTeam:o,onDeleteTeam:n})=>(0,s.jsxs)(k.Table,{children:[(0,s.jsx)(A.TableHead,{children:(0,s.jsxs)(M.TableRow,{children:[(0,s.jsx)(z.TableHeaderCell,{children:"Team Name"}),(0,s.jsx)(z.TableHeaderCell,{children:"Team ID"}),(0,s.jsx)(z.TableHeaderCell,{children:"Created"}),(0,s.jsx)(z.TableHeaderCell,{children:"Spend (USD)"}),(0,s.jsx)(z.TableHeaderCell,{children:"Budget (USD)"}),(0,s.jsx)(z.TableHeaderCell,{children:"Models"}),(0,s.jsx)(z.TableHeaderCell,{children:"Organization"}),(0,s.jsx)(z.TableHeaderCell,{children:"Your Role"}),(0,s.jsx)(z.TableHeaderCell,{children:"Info"})]})}),(0,s.jsx)(I.TableBody,{children:e&&e.length>0?e.filter(e=>!l||e.organization_id===l.organization_id).sort((e,s)=>new Date(s.created_at).getTime()-new Date(e.created_at).getTime()).map(e=>(0,s.jsxs)(M.TableRow,{children:[(0,s.jsx)(F.TableCell,{style:{maxWidth:"4px",whiteSpace:"pre-wrap",overflow:"hidden"},children:e.team_alias}),(0,s.jsx)(F.TableCell,{children:(0,s.jsx)("div",{className:"overflow-hidden",children:(0,s.jsx)(O.Tooltip,{title:e.team_id,children:(0,s.jsxs)(c.Button,{size:"xs",variant:"light",className:"font-mono text-blue-500 bg-blue-50 hover:bg-blue-100 text-xs font-normal px-2 py-0.5 text-left overflow-hidden truncate max-w-[200px]","data-testid":"team-id-cell",onClick:()=>{a(e.team_id)},children:[e.team_id.slice(0,7),"..."]})})})}),(0,s.jsx)(F.TableCell,{style:{maxWidth:"4px",whiteSpace:"pre-wrap",overflow:"hidden"},children:e.created_at?new Date(e.created_at).toLocaleDateString():"N/A"}),(0,s.jsx)(F.TableCell,{style:{maxWidth:"4px",whiteSpace:"pre-wrap",overflow:"hidden"},children:(0,g.formatNumberWithCommas)(e.spend,4)}),(0,s.jsx)(F.TableCell,{style:{maxWidth:"4px",whiteSpace:"pre-wrap",overflow:"hidden"},children:null!==e.max_budget&&void 0!==e.max_budget?e.max_budget:"No limit"}),(0,s.jsx)(V,{team:e}),(0,s.jsx)(F.TableCell,{children:e.organization_id}),(0,s.jsx)(U,{team:e,userId:i}),(0,s.jsxs)(F.TableCell,{children:[(0,s.jsxs)(u.Text,{children:[t&&e.team_id&&t[e.team_id]&&t[e.team_id].keys&&t[e.team_id].keys.length," ","Keys"]}),(0,s.jsxs)(u.Text,{children:[t&&e.team_id&&t[e.team_id]&&t[e.team_id].team_info&&t[e.team_id].team_info.members_with_roles&&t[e.team_id].team_info.members_with_roles.length," ","Members"]})]}),(0,s.jsx)(F.TableCell,{children:"Admin"==r?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(_.Icon,{icon:P.PencilAltIcon,size:"sm",onClick:()=>{a(e.team_id),o(!0)}}),(0,s.jsx)(_.Icon,{onClick:()=>n(e.team_id),icon:L.TrashIcon,size:"sm"})]}):null})]},e.team_id)):null})]});var J=e.i(582458),J=J,$=e.i(995926);let K=({teams:e,teamToDelete:a,onCancel:t,onConfirm:r})=>{let[i,o]=(0,l.useState)(""),n=e?.find(e=>e.team_id===a),d=n?.team_alias||"",c=n?.keys?.length||0,m=i===d;return(0,s.jsx)("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50",children:(0,s.jsxs)("div",{className:"bg-white rounded-lg shadow-xl w-full max-w-2xl min-h-[380px] py-6 overflow-hidden transform transition-all flex flex-col justify-between",children:[(0,s.jsxs)("div",{children:[(0,s.jsxs)("div",{className:"flex items-center justify-between px-6 py-4 border-b border-gray-200",children:[(0,s.jsx)("h3",{className:"text-lg font-semibold text-gray-900",children:"Delete Team"}),(0,s.jsx)("button",{"aria-label":"Close",onClick:()=>{t(),o("")},className:"text-gray-400 hover:text-gray-500 focus:outline-none",children:(0,s.jsx)($.XIcon,{size:20})})]}),(0,s.jsxs)("div",{className:"px-6 py-4",children:[c>0&&(0,s.jsxs)("div",{className:"flex items-start gap-3 p-4 bg-red-50 border border-red-100 rounded-md mb-5",children:[(0,s.jsx)("div",{className:"text-red-500 mt-0.5",children:(0,s.jsx)(J.default,{size:20})}),(0,s.jsxs)("div",{children:[(0,s.jsxs)("p",{className:"text-base font-medium text-red-600",children:["Warning: This team has ",c," associated key",c>1?"s":"","."]}),(0,s.jsx)("p",{className:"text-base text-red-600 mt-2",children:"Deleting the team will also delete all associated keys. This action is irreversible."})]})]}),(0,s.jsx)("p",{className:"text-base text-gray-600 mb-5",children:"Are you sure you want to force delete this team and all its keys?"}),(0,s.jsxs)("div",{className:"mb-5",children:[(0,s.jsxs)("label",{className:"block text-base font-medium text-gray-700 mb-2",children:["Type ",(0,s.jsx)("span",{className:"underline",children:d})," to confirm deletion:"]}),(0,s.jsx)("input",{type:"text",value:i,onChange:e=>o(e.target.value),placeholder:"Enter team name exactly",className:"w-full px-4 py-3 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500 text-base",autoFocus:!0})]})]})]}),(0,s.jsxs)("div",{className:"px-6 py-4 bg-gray-50 flex justify-end gap-4",children:[(0,s.jsx)("button",{onClick:()=>{t(),o("")},className:"px-5 py-3 bg-white border border-gray-300 rounded-md text-base font-medium text-gray-700 hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500",children:"Cancel"}),(0,s.jsx)("button",{onClick:r,disabled:!m,className:`px-5 py-3 rounded-md text-base font-medium text-white focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-red-500 ${m?"bg-red-600 hover:bg-red-700":"bg-red-300 cursor-not-allowed"}`,children:"Force Delete"})]})]})})};var q=e.i(464571),Y=e.i(311451),X=e.i(212931),Q=e.i(199133),Z=e.i(790848),ee=e.i(677667),es=e.i(130643),el=e.i(898667),ea=e.i(779241),et=e.i(827252),er=e.i(435451),ei=e.i(916940),eo=e.i(75921),en=e.i(552130),ed=e.i(651904),ec=e.i(533882),em=e.i(727749),eu=e.i(390605);let eh=({isTeamModalVisible:e,handleOk:t,handleCancel:i,currentOrg:o,organizations:n,teams:d,setTeams:c,modelAliases:m,setModelAliases:h,loggingSettings:x,setLoggingSettings:p,setIsTeamModalVisible:g})=>{let{userId:_,userRole:j,accessToken:f,premiumUser:b}=(0,S.default)(),[v]=r.Form.useForm(),[y,w]=(0,l.useState)([]),[T,C]=(0,l.useState)(null),[N,k]=(0,l.useState)([]),[I,F]=(0,l.useState)([]),[A,z]=(0,l.useState)([]),[M,P]=(0,l.useState)([]),[L,D]=(0,l.useState)(!1);(0,l.useEffect)(()=>{(async()=>{try{if(null===_||null===j||null===f)return;let e=await (0,R.fetchAvailableModelsForTeamOrKey)(_,j,f);e&&w(e)}catch(e){console.error("Error fetching user models:",e)}})()},[f,_,j,d]),(0,l.useEffect)(()=>{let e;console.log(`currentOrgForCreateTeam: ${T}`);let s=(e=[],T&&T.models.length>0?(console.log(`organization.models: ${T.models}`),e=T.models):e=y,(0,R.unfurlWildcardModelsInList)(e,y));console.log(`models: ${s}`),k(s),v.setFieldValue("models",[])},[T,y,v]);let E=async()=>{try{if(null==f)return;let e=await (0,a.fetchMCPAccessGroups)(f);P(e)}catch(e){console.error("Failed to fetch MCP access groups:",e)}};(0,l.useEffect)(()=>{E()},[f,E]),(0,l.useEffect)(()=>{let e=async()=>{try{if(null==f)return;let e=(await (0,a.getPoliciesList)(f)).policies.map(e=>e.policy_name);z(e)}catch(e){console.error("Failed to fetch policies:",e)}};(async()=>{try{if(null==f)return;let e=(await (0,a.getGuardrailsList)(f)).guardrails.map(e=>e.guardrail_name);F(e)}catch(e){console.error("Failed to fetch guardrails:",e)}})(),e()},[f]);let B=async e=>{try{if(console.log(`formValues: ${JSON.stringify(e)}`),null!=f){let s=e?.team_alias,l=d?.map(e=>e.team_alias)??[],t=e?.organization_id||o?.organization_id;if(""===t||"string"!=typeof t?e.organization_id=null:e.organization_id=t.trim(),l.includes(s))throw Error(`Team alias ${s} already exists, please pick another alias`);if(em.default.info("Creating Team"),x.length>0){let s={};if(e.metadata)try{s=JSON.parse(e.metadata)}catch(e){console.warn("Invalid JSON in metadata field, starting with empty object")}s={...s,logging:x.filter(e=>e.callback_name)},e.metadata=JSON.stringify(s)}if(e.secret_manager_settings&&"string"==typeof e.secret_manager_settings)if(""===e.secret_manager_settings.trim())delete e.secret_manager_settings;else try{e.secret_manager_settings=JSON.parse(e.secret_manager_settings)}catch(e){throw Error("Failed to parse secret manager settings: "+e)}if(e.allowed_vector_store_ids&&e.allowed_vector_store_ids.length>0||e.allowed_mcp_servers_and_groups&&(e.allowed_mcp_servers_and_groups.servers?.length>0||e.allowed_mcp_servers_and_groups.accessGroups?.length>0||e.allowed_mcp_servers_and_groups.toolPermissions)){if(e.object_permission={},e.allowed_vector_store_ids&&e.allowed_vector_store_ids.length>0&&(e.object_permission.vector_stores=e.allowed_vector_store_ids,delete e.allowed_vector_store_ids),e.allowed_mcp_servers_and_groups){let{servers:s,accessGroups:l}=e.allowed_mcp_servers_and_groups;s&&s.length>0&&(e.object_permission.mcp_servers=s),l&&l.length>0&&(e.object_permission.mcp_access_groups=l),delete e.allowed_mcp_servers_and_groups}if(e.mcp_tool_permissions&&Object.keys(e.mcp_tool_permissions).length>0&&(e.object_permission||(e.object_permission={}),e.object_permission.mcp_tool_permissions=e.mcp_tool_permissions,delete e.mcp_tool_permissions),e.allowed_agents_and_groups){let{agents:s,accessGroups:l}=e.allowed_agents_and_groups;e.object_permission||(e.object_permission={}),s&&s.length>0&&(e.object_permission.agents=s),l&&l.length>0&&(e.object_permission.agent_access_groups=l),delete e.allowed_agents_and_groups}}e.allowed_mcp_access_groups&&e.allowed_mcp_access_groups.length>0&&(e.object_permission||(e.object_permission={}),e.object_permission.mcp_access_groups=e.allowed_mcp_access_groups,delete e.allowed_mcp_access_groups),Object.keys(m).length>0&&(e.model_aliases=m);let r=await (0,a.teamCreateCall)(f,e);null!==d?c([...d,r]):c([r]),console.log(`response for team create call: ${r}`),em.default.success("Team created"),v.resetFields(),p([]),h({}),g(!1)}}catch(e){console.error("Error creating the team:",e),em.default.fromBackend("Error creating the team: "+e)}};return(0,s.jsx)(X.Modal,{title:"Create Team",open:e,width:1e3,footer:null,onOk:t,onCancel:i,children:(0,s.jsxs)(r.Form,{form:v,onFinish:B,labelCol:{span:8},wrapperCol:{span:16},labelAlign:"left",children:[(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(r.Form.Item,{label:"Team Name",name:"team_alias",rules:[{required:!0,message:"Please input a team name"}],children:(0,s.jsx)(ea.TextInput,{placeholder:"","data-testid":"team-name-input"})}),(0,s.jsx)(r.Form.Item,{label:(0,s.jsxs)("span",{children:["Organization"," ",(0,s.jsx)(O.Tooltip,{title:(0,s.jsxs)("span",{children:["Organizations can have multiple teams. Learn more about"," ",(0,s.jsx)("a",{href:"https://docs.litellm.ai/docs/proxy/user_management_heirarchy",target:"_blank",rel:"noopener noreferrer",style:{color:"#1890ff",textDecoration:"underline"},onClick:e=>e.stopPropagation(),children:"user management hierarchy"})]}),children:(0,s.jsx)(et.InfoCircleOutlined,{style:{marginLeft:"4px"}})})]}),name:"organization_id",initialValue:o?o.organization_id:null,className:"mt-8",children:(0,s.jsx)(Q.Select,{showSearch:!0,allowClear:!0,placeholder:"Search or select an Organization",onChange:e=>{v.setFieldValue("organization_id",e),C(n?.find(s=>s.organization_id===e)||null)},filterOption:(e,s)=>!!s&&(s.children?.toString()||"").toLowerCase().includes(e.toLowerCase()),optionFilterProp:"children",children:n?.map(e=>(0,s.jsxs)(Q.Select.Option,{value:e.organization_id,children:[(0,s.jsx)("span",{className:"font-medium",children:e.organization_alias})," ",(0,s.jsxs)("span",{className:"text-gray-500",children:["(",e.organization_id,")"]})]},e.organization_id))})}),(0,s.jsx)(r.Form.Item,{label:(0,s.jsxs)("span",{children:["Models"," ",(0,s.jsx)(O.Tooltip,{title:"These are the models that your selected team has access to",children:(0,s.jsx)(et.InfoCircleOutlined,{style:{marginLeft:"4px"}})})]}),name:"models",children:(0,s.jsxs)(Q.Select,{mode:"multiple",placeholder:"Select models",style:{width:"100%"},"data-testid":"team-models-select",children:[(0,s.jsx)(Q.Select.Option,{value:"all-proxy-models",children:"All Proxy Models"},"all-proxy-models"),N.map(e=>(0,s.jsx)(Q.Select.Option,{value:e,children:(0,R.getModelDisplayName)(e)},e))]})}),(0,s.jsx)(r.Form.Item,{label:"Max Budget (USD)",name:"max_budget",children:(0,s.jsx)(er.default,{step:.01,precision:2,width:200})}),(0,s.jsx)(r.Form.Item,{className:"mt-8",label:"Reset Budget",name:"budget_duration",children:(0,s.jsxs)(Q.Select,{defaultValue:null,placeholder:"n/a",children:[(0,s.jsx)(Q.Select.Option,{value:"24h",children:"daily"}),(0,s.jsx)(Q.Select.Option,{value:"7d",children:"weekly"}),(0,s.jsx)(Q.Select.Option,{value:"30d",children:"monthly"})]})}),(0,s.jsx)(r.Form.Item,{label:"Tokens per minute Limit (TPM)",name:"tpm_limit",children:(0,s.jsx)(er.default,{step:1,width:400})}),(0,s.jsx)(r.Form.Item,{label:"Requests per minute Limit (RPM)",name:"rpm_limit",children:(0,s.jsx)(er.default,{step:1,width:400})}),(0,s.jsxs)(ee.Accordion,{className:"mt-20 mb-8",onClick:()=>{L||(E(),D(!0))},children:[(0,s.jsx)(el.AccordionHeader,{children:(0,s.jsx)("b",{children:"Additional Settings"})}),(0,s.jsxs)(es.AccordionBody,{children:[(0,s.jsx)(r.Form.Item,{label:"Team ID",name:"team_id",help:"ID of the team you want to create. If not provided, it will be generated automatically.",children:(0,s.jsx)(ea.TextInput,{onChange:e=>{e.target.value=e.target.value.trim()}})}),(0,s.jsx)(r.Form.Item,{label:"Team Member Budget (USD)",name:"team_member_budget",normalize:e=>e?Number(e):void 0,tooltip:"This is the individual budget for a user in the team.",children:(0,s.jsx)(er.default,{step:.01,precision:2,width:200})}),(0,s.jsx)(r.Form.Item,{label:"Team Member Key Duration (eg: 1d, 1mo)",name:"team_member_key_duration",tooltip:"Set a limit to the duration of a team member's key. Format: 30s (seconds), 30m (minutes), 30h (hours), 30d (days), 1mo (month)",children:(0,s.jsx)(ea.TextInput,{placeholder:"e.g., 30d"})}),(0,s.jsx)(r.Form.Item,{label:"Team Member RPM Limit",name:"team_member_rpm_limit",tooltip:"The RPM (Requests Per Minute) limit for individual team members",children:(0,s.jsx)(er.default,{step:1,width:400})}),(0,s.jsx)(r.Form.Item,{label:"Team Member TPM Limit",name:"team_member_tpm_limit",tooltip:"The TPM (Tokens Per Minute) limit for individual team members",children:(0,s.jsx)(er.default,{step:1,width:400})}),(0,s.jsx)(r.Form.Item,{label:"Metadata",name:"metadata",help:"Additional team metadata. Enter metadata as JSON object.",children:(0,s.jsx)(Y.Input.TextArea,{rows:4})}),(0,s.jsx)(r.Form.Item,{label:"Secret Manager Settings",name:"secret_manager_settings",help:b?"Enter secret manager configuration as a JSON object.":"Premium feature - Upgrade to manage secret manager settings.",rules:[{validator:async(e,s)=>{if(!s)return Promise.resolve();try{return JSON.parse(s),Promise.resolve()}catch(e){return Promise.reject(Error("Please enter valid JSON"))}}}],children:(0,s.jsx)(Y.Input.TextArea,{rows:4,placeholder:'{"namespace": "admin", "mount": "secret", "path_prefix": "litellm"}',disabled:!b})}),(0,s.jsx)(r.Form.Item,{label:(0,s.jsxs)("span",{children:["Guardrails"," ",(0,s.jsx)(O.Tooltip,{title:"Setup your first guardrail",children:(0,s.jsx)("a",{href:"https://docs.litellm.ai/docs/proxy/guardrails/quick_start",target:"_blank",rel:"noopener noreferrer",onClick:e=>e.stopPropagation(),children:(0,s.jsx)(et.InfoCircleOutlined,{style:{marginLeft:"4px"}})})})]}),name:"guardrails",className:"mt-8",help:"Select existing guardrails or enter new ones",children:(0,s.jsx)(Q.Select,{mode:"tags",style:{width:"100%"},placeholder:"Select or enter guardrails",options:I.map(e=>({value:e,label:e}))})}),(0,s.jsx)(r.Form.Item,{label:(0,s.jsxs)("span",{children:["Disable Global Guardrails"," ",(0,s.jsx)(O.Tooltip,{title:"When enabled, this team will bypass any guardrails configured to run on every request (global guardrails)",children:(0,s.jsx)(et.InfoCircleOutlined,{style:{marginLeft:"4px"}})})]}),name:"disable_global_guardrails",className:"mt-4",valuePropName:"checked",help:"Bypass global guardrails for this team",children:(0,s.jsx)(Z.Switch,{checkedChildren:"Yes",unCheckedChildren:"No"})}),(0,s.jsx)(r.Form.Item,{label:(0,s.jsxs)("span",{children:["Policies"," ",(0,s.jsx)(O.Tooltip,{title:"Apply policies to this team to control guardrails and other settings",children:(0,s.jsx)("a",{href:"https://docs.litellm.ai/docs/proxy/guardrails/guardrail_policies",target:"_blank",rel:"noopener noreferrer",onClick:e=>e.stopPropagation(),children:(0,s.jsx)(et.InfoCircleOutlined,{style:{marginLeft:"4px"}})})})]}),name:"policies",className:"mt-8",help:"Select existing policies or enter new ones",children:(0,s.jsx)(Q.Select,{mode:"tags",style:{width:"100%"},placeholder:"Select or enter policies",options:A.map(e=>({value:e,label:e}))})}),(0,s.jsx)(r.Form.Item,{label:(0,s.jsxs)("span",{children:["Allowed Vector Stores"," ",(0,s.jsx)(O.Tooltip,{title:"Select which vector stores this team can access by default. Leave empty for access to all vector stores",children:(0,s.jsx)(et.InfoCircleOutlined,{style:{marginLeft:"4px"}})})]}),name:"allowed_vector_store_ids",className:"mt-8",help:"Select vector stores this team can access. Leave empty for access to all vector stores",children:(0,s.jsx)(ei.default,{onChange:e=>v.setFieldValue("allowed_vector_store_ids",e),value:v.getFieldValue("allowed_vector_store_ids"),accessToken:f||"",placeholder:"Select vector stores (optional)"})})]})]}),(0,s.jsxs)(ee.Accordion,{className:"mt-8 mb-8",children:[(0,s.jsx)(el.AccordionHeader,{children:(0,s.jsx)("b",{children:"MCP Settings"})}),(0,s.jsxs)(es.AccordionBody,{children:[(0,s.jsx)(r.Form.Item,{label:(0,s.jsxs)("span",{children:["Allowed MCP Servers"," ",(0,s.jsx)(O.Tooltip,{title:"Select which MCP servers or access groups this team can access",children:(0,s.jsx)(et.InfoCircleOutlined,{style:{marginLeft:"4px"}})})]}),name:"allowed_mcp_servers_and_groups",className:"mt-4",help:"Select MCP servers or access groups this team can access",children:(0,s.jsx)(eo.default,{onChange:e=>v.setFieldValue("allowed_mcp_servers_and_groups",e),value:v.getFieldValue("allowed_mcp_servers_and_groups"),accessToken:f||"",placeholder:"Select MCP servers or access groups (optional)"})}),(0,s.jsx)(r.Form.Item,{name:"mcp_tool_permissions",initialValue:{},hidden:!0,children:(0,s.jsx)(Y.Input,{type:"hidden"})}),(0,s.jsx)(r.Form.Item,{noStyle:!0,shouldUpdate:(e,s)=>e.allowed_mcp_servers_and_groups!==s.allowed_mcp_servers_and_groups||e.mcp_tool_permissions!==s.mcp_tool_permissions,children:()=>(0,s.jsx)("div",{className:"mt-6",children:(0,s.jsx)(eu.default,{accessToken:f||"",selectedServers:v.getFieldValue("allowed_mcp_servers_and_groups")?.servers||[],toolPermissions:v.getFieldValue("mcp_tool_permissions")||{},onChange:e=>v.setFieldsValue({mcp_tool_permissions:e})})})})]})]}),(0,s.jsxs)(ee.Accordion,{className:"mt-8 mb-8",children:[(0,s.jsx)(el.AccordionHeader,{children:(0,s.jsx)("b",{children:"Agent Settings"})}),(0,s.jsx)(es.AccordionBody,{children:(0,s.jsx)(r.Form.Item,{label:(0,s.jsxs)("span",{children:["Allowed Agents"," ",(0,s.jsx)(O.Tooltip,{title:"Select which agents or access groups this team can access",children:(0,s.jsx)(et.InfoCircleOutlined,{style:{marginLeft:"4px"}})})]}),name:"allowed_agents_and_groups",className:"mt-4",help:"Select agents or access groups this team can access",children:(0,s.jsx)(en.default,{onChange:e=>v.setFieldValue("allowed_agents_and_groups",e),value:v.getFieldValue("allowed_agents_and_groups"),accessToken:f||"",placeholder:"Select agents or access groups (optional)"})})})]}),(0,s.jsxs)(ee.Accordion,{className:"mt-8 mb-8",children:[(0,s.jsx)(el.AccordionHeader,{children:(0,s.jsx)("b",{children:"Logging Settings"})}),(0,s.jsx)(es.AccordionBody,{children:(0,s.jsx)("div",{className:"mt-4",children:(0,s.jsx)(ed.default,{value:x,onChange:p,premiumUser:b})})})]}),(0,s.jsxs)(ee.Accordion,{className:"mt-8 mb-8",children:[(0,s.jsx)(el.AccordionHeader,{children:(0,s.jsx)("b",{children:"Model Aliases"})}),(0,s.jsx)(es.AccordionBody,{children:(0,s.jsxs)("div",{className:"mt-4",children:[(0,s.jsx)(u.Text,{className:"text-sm text-gray-600 mb-4",children:"Create custom aliases for models that can be used by team members in API calls. This allows you to create shortcuts for specific models."}),(0,s.jsx)(ec.default,{accessToken:f||"",initialModelAliases:m,onAliasUpdate:h,showExampleConfig:!1})]})})]})]}),(0,s.jsx)("div",{style:{textAlign:"right",marginTop:"10px"},children:(0,s.jsx)(q.Button,{htmlType:"submit","data-testid":"create-team-submit",children:"Create Team"})})]})})},ex=({teams:e,accessToken:_,setTeams:j,userID:f,userRole:b,organizations:v,premiumUser:y=!1})=>{let[T,C]=(0,l.useState)(null),[k,I]=(0,l.useState)(!1),[F,A]=(0,l.useState)({team_id:"",team_alias:"",organization_id:"",sort_by:"created_at",sort_order:"desc"}),[z]=r.Form.useForm(),[M]=r.Form.useForm(),[O,P]=(0,l.useState)(null),[L,D]=(0,l.useState)(!1),[E,B]=(0,l.useState)(!1),[R,V]=(0,l.useState)(!1),[H,W]=(0,l.useState)(!1),[U,J]=(0,l.useState)([]),[$,q]=(0,l.useState)(!1),[Y,X]=(0,l.useState)(null),[Q,Z]=(0,l.useState)({}),[ee,es]=(0,l.useState)([]),[el,ea]=(0,l.useState)({}),{lastRefreshed:et,onRefreshClick:er}=(({currentOrg:e,setTeams:s})=>{let[a,r]=(0,l.useState)(""),{accessToken:i,userId:o,userRole:n}=(0,S.default)(),d=(0,l.useCallback)(()=>{r(new Date().toLocaleString())},[]);return(0,l.useEffect)(()=>{i&&(0,t.fetchTeams)(i,o,n,e,s).then(),d()},[i,e,a,d,s,o,n]),{lastRefreshed:a,setLastRefreshed:r,onRefreshClick:d}})({currentOrg:T,setTeams:j});(0,l.useEffect)(()=>{e&&Z(e.reduce((e,s)=>(e[s.team_id]={keys:s.keys||[],team_info:{members_with_roles:s.members_with_roles||[]}},e),{}))},[e]);let ei=async e=>{X(e),q(!0)},eo=async()=>{if(null!=Y&&null!=e&&null!=_){try{await (0,a.teamDeleteCall)(_,Y),(0,t.fetchTeams)(_,f,b,T,j)}catch(e){console.error("Error deleting the team:",e)}q(!1),X(null)}};return(0,s.jsx)("div",{className:"w-full mx-4 h-[75vh]",children:(0,s.jsx)(h.Grid,{numItems:1,className:"gap-2 p-8 w-full mt-2",children:(0,s.jsxs)(m.Col,{numColSpan:1,className:"flex flex-col gap-2",children:[("Admin"==b||"Org Admin"==b)&&(0,s.jsx)(c.Button,{className:"w-fit",onClick:()=>B(!0),children:"+ Create New Team"}),O?(0,s.jsx)(i.default,{teamId:O,onUpdate:e=>{j(s=>{if(null==s)return s;let l=s.map(s=>e.team_id===s.team_id?(0,g.updateExistingKeys)(s,e):s);return _&&(0,t.fetchTeams)(_,f,b,T,j),l})},onClose:()=>{P(null),D(!1)},accessToken:_,is_team_admin:(e=>{if(null==e||null==e.members_with_roles)return!1;for(let s=0;se.team_id===O)),is_proxy_admin:"Admin"==b,is_org_admin:(()=>{let s=e?.find(e=>e.team_id===O);if(!s?.organization_id||!v||!f)return!1;let l=v.find(e=>e.organization_id===s.organization_id);return l?.members?.some(e=>e.user_id===f&&"org_admin"===e.user_role)??!1})(),userModels:U,editTeam:L,premiumUser:y}):(0,s.jsxs)(w,{lastRefreshed:et,onRefresh:er,userRole:b,children:[(0,s.jsxs)(x.TabPanel,{children:[(0,s.jsxs)(u.Text,{children:["Click on “Team ID” to view team details ",(0,s.jsx)("b",{children:"and"})," manage team members."]}),(0,s.jsx)(h.Grid,{numItems:1,className:"gap-2 pt-2 pb-2 h-[75vh] w-full mt-2",children:(0,s.jsx)(m.Col,{numColSpan:1,children:(0,s.jsxs)(d.Card,{className:"w-full mx-auto flex-auto overflow-hidden overflow-y-auto max-h-[50vh]",children:[(0,s.jsx)("div",{className:"border-b px-6 py-4",children:(0,s.jsx)("div",{className:"flex flex-col space-y-4",children:(0,s.jsx)(N,{filters:F,organizations:v,showFilters:k,onToggleFilters:I,onChange:(e,s)=>{let l={...F,[e]:s};A(l),_&&(0,a.v2TeamListCall)(_,l.organization_id||null,null,l.team_id||null,l.team_alias||null).then(e=>{e&&e.teams&&j(e.teams)}).catch(e=>{console.error("Error fetching teams:",e)})},onReset:()=>{A({team_id:"",team_alias:"",organization_id:"",sort_by:"created_at",sort_order:"desc"}),_&&(0,a.v2TeamListCall)(_,null,f||null,null,null).then(e=>{e&&e.teams&&j(e.teams)}).catch(e=>{console.error("Error fetching teams:",e)})}})})}),(0,s.jsx)(G,{teams:e,currentOrg:T,perTeamInfo:Q,userRole:b,userId:f,setSelectedTeamId:P,setEditTeam:D,onDeleteTeam:ei}),$&&(0,s.jsx)(K,{teams:e,teamToDelete:Y,onCancel:()=>{q(!1),X(null)},onConfirm:eo})]})})})]}),(0,s.jsx)(x.TabPanel,{children:(0,s.jsx)(p.default,{accessToken:_,userID:f})}),(0,n.isAdminRole)(b||"")&&(0,s.jsx)(x.TabPanel,{children:(0,s.jsx)(o.default,{accessToken:_,userID:f||"",userRole:b||""})})]}),("Admin"==b||"Org Admin"==b)&&(0,s.jsx)(eh,{isTeamModalVisible:E,handleOk:()=>{B(!1),z.resetFields(),es([]),ea({})},handleCancel:()=>{B(!1),z.resetFields(),es([]),ea({})},currentOrg:T,organizations:v,teams:e,setTeams:j,modelAliases:el,setModelAliases:ea,loggingSettings:ee,setLoggingSettings:es,setIsTeamModalVisible:B})]})})})};var ep=e.i(214541),eg=e.i(846835);e.s(["default",0,()=>{let{accessToken:e,userId:a,userRole:t}=(0,S.default)(),{teams:r,setTeams:i}=(0,ep.default)(),[o,n]=(0,l.useState)([]);return(0,l.useEffect)(()=>{(0,eg.fetchOrganizations)(e,n).then(()=>{})},[e]),(0,s.jsx)(ex,{teams:r,accessToken:e,setTeams:i,userID:a,userRole:t,organizations:o})}],596115)}]); \ No newline at end of file diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/2e768c2b1dfc8cd5.js b/litellm/proxy/_experimental/out/_next/static/chunks/0c6c65a34bcde140.js similarity index 68% rename from litellm/proxy/_experimental/out/_next/static/chunks/2e768c2b1dfc8cd5.js rename to litellm/proxy/_experimental/out/_next/static/chunks/0c6c65a34bcde140.js index 3291150f31..f004e79d53 100644 --- a/litellm/proxy/_experimental/out/_next/static/chunks/2e768c2b1dfc8cd5.js +++ b/litellm/proxy/_experimental/out/_next/static/chunks/0c6c65a34bcde140.js @@ -69,4 +69,4 @@ completion = client.chat.completions.create( user="my-customer-id" ) -print(completion.choices[0].message)`;e.s(["default",0,({accessToken:e})=>{let[N,T]=(0,p.useState)(!1),[I,E]=(0,p.useState)(!1),[A,P]=(0,p.useState)(null),[D,M]=(0,p.useState)(!1),{data:B=[]}=(()=>{let{accessToken:e}=(0,C.default)();return(0,v.useQuery)({queryKey:S.list({}),queryFn:async()=>(await (0,k.getBudgetList)(e)??[]).filter(e=>null!=e),enabled:!!e})})(),O=(()=>{let{accessToken:e}=(0,C.default)(),t=(0,_.useQueryClient)();return(0,w.useMutation)({mutationFn:async t=>{if(!e)throw Error("Access token is required");return(0,k.budgetDeleteCall)(e,t)},onSuccess:()=>{t.invalidateQueries({queryKey:S.all})}})})(),H=async t=>{null!=e&&(P(t),E(!0))},V=async()=>{if(A&&null!=e)try{await O.mutateAsync(A.budget_id),j.default.success("Budget deleted.")}catch(e){console.error("Error deleting budget:",e),"function"==typeof j.default.fromBackend?j.default.fromBackend("Failed to delete budget"):j.default.info("Failed to delete budget")}finally{M(!1),P(null)}};return(0,t.jsxs)("div",{className:"w-full mx-auto flex-auto overflow-y-auto m-8 p-2",children:[(0,t.jsx)(l.Button,{size:"sm",variant:"primary",className:"mb-2",onClick:()=>T(!0),children:"+ Create Budget"}),(0,t.jsxs)(r.TabGroup,{children:[(0,t.jsxs)(m.TabList,{children:[(0,t.jsx)(s.Tab,{children:"Budgets"}),(0,t.jsx)(s.Tab,{children:"Examples"})]}),(0,t.jsxs)(g.TabPanels,{children:[(0,t.jsx)(h.TabPanel,{children:(0,t.jsxs)("div",{className:"mt-6",children:[(0,t.jsx)(F,{isModalVisible:N,setIsModalVisible:T}),A&&(0,t.jsx)(R,{isModalVisible:I,setIsModalVisible:E,existingBudget:A}),(0,t.jsxs)(a.Card,{children:[(0,t.jsx)(x.Text,{children:"Create a budget to assign to customers."}),(0,t.jsxs)(i.Table,{children:[(0,t.jsx)(c.TableHead,{children:(0,t.jsxs)(u.TableRow,{children:[(0,t.jsx)(d.TableHeaderCell,{children:"Budget ID"}),(0,t.jsx)(d.TableHeaderCell,{children:"Max Budget"}),(0,t.jsx)(d.TableHeaderCell,{children:"TPM"}),(0,t.jsx)(d.TableHeaderCell,{children:"RPM"})]})}),(0,t.jsx)(n.TableBody,{children:B.slice().sort((e,t)=>new Date(t.updated_at).getTime()-new Date(e.updated_at).getTime()).map(e=>(0,t.jsxs)(u.TableRow,{children:[(0,t.jsx)(o.TableCell,{children:e.budget_id}),(0,t.jsx)(o.TableCell,{children:e.max_budget?e.max_budget:"n/a"}),(0,t.jsx)(o.TableCell,{children:e.tpm_limit?e.tpm_limit:"n/a"}),(0,t.jsx)(o.TableCell,{children:e.rpm_limit?e.rpm_limit:"n/a"}),(0,t.jsx)(y.default,{variant:"Edit",tooltipText:"Edit budget",onClick:()=>H(e),dataTestId:"edit-budget-button"}),(0,t.jsx)(y.default,{variant:"Delete",tooltipText:"Delete budget",onClick:()=>{P(e),M(!0)},dataTestId:"delete-budget-button"})]},e.budget_id))})]})]}),(0,t.jsx)(b.default,{isOpen:D,title:"Delete Budget?",message:"Are you sure you want to delete this budget? This action cannot be undone.",resourceInformationTitle:"Budget Information",resourceInformation:[{label:"Budget ID",value:A?.budget_id,code:!0},{label:"Max Budget",value:A?.max_budget},{label:"TPM",value:A?.tpm_limit},{label:"RPM",value:A?.rpm_limit}],onCancel:()=>{M(!1)},onOk:V,confirmLoading:O.isPending})]})}),(0,t.jsx)(h.TabPanel,{children:(0,t.jsxs)("div",{className:"mt-6",children:[(0,t.jsx)(x.Text,{className:"text-base",children:"How to use budget id"}),(0,t.jsxs)(r.TabGroup,{children:[(0,t.jsxs)(m.TabList,{children:[(0,t.jsx)(s.Tab,{children:"Assign Budget to Customer"}),(0,t.jsx)(s.Tab,{children:"Test it (Curl)"}),(0,t.jsx)(s.Tab,{children:"Test it (OpenAI SDK)"})]}),(0,t.jsxs)(g.TabPanels,{children:[(0,t.jsx)(h.TabPanel,{children:(0,t.jsx)(f.Prism,{language:"bash",children:L})}),(0,t.jsx)(h.TabPanel,{children:(0,t.jsx)(f.Prism,{language:"bash",children:z})}),(0,t.jsx)(h.TabPanel,{children:(0,t.jsx)(f.Prism,{language:"python",children:U})})]})]})]})})]})]})]})}],646050)},704308,e=>{"use strict";var t=e.i(843476),l=e.i(271645),a=e.i(994388),s=e.i(212931),r=e.i(764205),i=e.i(808613),n=e.i(311451),o=e.i(199133),c=e.i(888259),d=e.i(209261);let{TextArea:u}=n.Input,{Option:m}=o.Select,h=["Development","Productivity","Learning","Security","Data & Analytics","Integration","Testing","Documentation"],g=({visible:e,onClose:g,accessToken:x,onSuccess:p})=>{let[f]=i.Form.useForm(),[b,y]=(0,l.useState)(!1),[j,v]=(0,l.useState)("github"),w=async e=>{if(!x)return void c.default.error("No access token available");if(!(0,d.validatePluginName)(e.name))return void c.default.error("Plugin name must be kebab-case (lowercase letters, numbers, and hyphens only)");if(e.version&&!(0,d.isValidSemanticVersion)(e.version))return void c.default.error("Version must be in semantic versioning format (e.g., 1.0.0)");if(e.authorEmail&&!(0,d.isValidEmail)(e.authorEmail))return void c.default.error("Invalid email format");if(e.homepage&&!(0,d.isValidUrl)(e.homepage))return void c.default.error("Invalid homepage URL format");if(("url"===j||"git-subdir"===j)&&e.url&&!(0,d.isValidUrl)(e.url))return void c.default.error("Invalid git URL format");y(!0);try{let t={name:e.name.trim(),source:"github"===j?{source:"github",repo:e.repo.trim()}:"git-subdir"===j?{source:"git-subdir",url:e.url.trim(),path:e.path.trim()}:{source:"url",url:e.url.trim()}};e.version&&(t.version=e.version.trim()),e.description&&(t.description=e.description.trim()),(e.authorName||e.authorEmail)&&(t.author={},e.authorName&&(t.author.name=e.authorName.trim()),e.authorEmail&&(t.author.email=e.authorEmail.trim())),e.homepage&&(t.homepage=e.homepage.trim()),e.category&&(t.category=e.category),e.keywords&&(t.keywords=(0,d.parseKeywords)(e.keywords)),await (0,r.registerClaudeCodePlugin)(x,t),c.default.success("Plugin registered successfully"),f.resetFields(),v("github"),p(),g()}catch(e){console.error("Error registering plugin:",e),c.default.error("Failed to register plugin")}finally{y(!1)}},_=()=>{f.resetFields(),v("github"),g()};return(0,t.jsx)(s.Modal,{title:"Add New Claude Code Plugin",open:e,onCancel:_,footer:null,width:700,className:"top-8",children:(0,t.jsxs)(i.Form,{form:f,layout:"vertical",onFinish:w,className:"mt-4",children:[(0,t.jsx)(i.Form.Item,{label:"Plugin Name",name:"name",rules:[{required:!0,message:"Please enter plugin name"},{pattern:/^[a-z0-9-]+$/,message:"Name must be kebab-case (lowercase, numbers, hyphens only)"}],tooltip:"Unique identifier in kebab-case format (e.g., my-awesome-plugin)",children:(0,t.jsx)(n.Input,{placeholder:"my-awesome-plugin",className:"rounded-lg"})}),(0,t.jsx)(i.Form.Item,{label:"Source Type",name:"sourceType",initialValue:"github",rules:[{required:!0,message:"Please select source type"}],children:(0,t.jsxs)(o.Select,{onChange:e=>{v(e),f.setFieldsValue({repo:void 0,url:void 0,path:void 0})},className:"rounded-lg",children:[(0,t.jsx)(m,{value:"github",children:"GitHub"}),(0,t.jsx)(m,{value:"url",children:"Git URL"}),(0,t.jsx)(m,{value:"git-subdir",children:"Git Subdir"})]})}),"github"===j&&(0,t.jsx)(i.Form.Item,{label:"GitHub Repository",name:"repo",rules:[{required:!0,message:"Please enter repository"},{pattern:/^[a-zA-Z0-9_-]+\/[a-zA-Z0-9_-]+$/,message:"Repository must be in format: org/repo"}],tooltip:"Format: organization/repository (e.g., anthropics/claude-code)",children:(0,t.jsx)(n.Input,{placeholder:"anthropics/claude-code",className:"rounded-lg"})}),("url"===j||"git-subdir"===j)&&(0,t.jsx)(i.Form.Item,{label:"Git URL",name:"url",rules:[{required:!0,message:"Please enter git URL"}],tooltip:"Full git URL to the repository",children:(0,t.jsx)(n.Input,{type:"url",placeholder:"https://github.com/org/repo.git",className:"rounded-lg"})}),"git-subdir"===j&&(0,t.jsx)(i.Form.Item,{label:"Subdirectory Path",name:"path",rules:[{required:!0,message:"Please enter subdirectory path"},{pattern:/^[a-zA-Z0-9][a-zA-Z0-9._-]*(\/[a-zA-Z0-9][a-zA-Z0-9._-]*)*$/,message:"Path must be relative segments (alphanumeric, dots, hyphens, underscores), e.g. plugins/plugin-name"}],tooltip:"Path to the plugin directory within the repository (e.g., plugins/plugin-name)",children:(0,t.jsx)(n.Input,{placeholder:"plugins/plugin-name",className:"rounded-lg"})}),(0,t.jsx)(i.Form.Item,{label:"Version (Optional)",name:"version",tooltip:"Semantic version (e.g., 1.0.0)",children:(0,t.jsx)(n.Input,{placeholder:"1.0.0",className:"rounded-lg"})}),(0,t.jsx)(i.Form.Item,{label:"Description (Optional)",name:"description",tooltip:"Brief description of what the plugin does",children:(0,t.jsx)(u,{rows:3,placeholder:"A plugin that helps with...",maxLength:500,className:"rounded-lg"})}),(0,t.jsx)(i.Form.Item,{label:"Category (Optional)",name:"category",tooltip:"Select a category or enter a custom one",children:(0,t.jsx)(o.Select,{placeholder:"Select or type a category",allowClear:!0,showSearch:!0,optionFilterProp:"children",className:"rounded-lg",children:h.map(e=>(0,t.jsx)(m,{value:e,children:e},e))})}),(0,t.jsx)(i.Form.Item,{label:"Keywords (Optional)",name:"keywords",tooltip:"Comma-separated list of keywords for search",children:(0,t.jsx)(n.Input,{placeholder:"search, web, api",className:"rounded-lg"})}),(0,t.jsx)(i.Form.Item,{label:"Author Name (Optional)",name:"authorName",tooltip:"Name of the plugin author or organization",children:(0,t.jsx)(n.Input,{placeholder:"Your Name or Organization",className:"rounded-lg"})}),(0,t.jsx)(i.Form.Item,{label:"Author Email (Optional)",name:"authorEmail",rules:[{type:"email",message:"Please enter a valid email"}],tooltip:"Contact email for the plugin author",children:(0,t.jsx)(n.Input,{type:"email",placeholder:"author@example.com",className:"rounded-lg"})}),(0,t.jsx)(i.Form.Item,{label:"Homepage (Optional)",name:"homepage",rules:[{type:"url",message:"Please enter a valid URL"}],tooltip:"URL to the plugin's homepage or documentation",children:(0,t.jsx)(n.Input,{type:"url",placeholder:"https://example.com",className:"rounded-lg"})}),(0,t.jsx)(i.Form.Item,{className:"mb-0 mt-6",children:(0,t.jsxs)("div",{className:"flex justify-end gap-2",children:[(0,t.jsx)(a.Button,{variant:"secondary",onClick:_,disabled:b,children:"Cancel"}),(0,t.jsx)(a.Button,{type:"submit",loading:b,children:b?"Registering...":"Register Plugin"})]})})]})})};var x=e.i(166406),p=e.i(871943),f=e.i(360820),b=e.i(94629),y=e.i(68155),j=e.i(152990),v=e.i(682830),w=e.i(389083),_=e.i(269200),N=e.i(942232),k=e.i(977572),C=e.i(427612),S=e.i(64848),T=e.i(496020),I=e.i(790848),E=e.i(592968),A=e.i(727749);let P=({pluginsList:e,isLoading:s,onDeleteClick:i,accessToken:n,onPluginUpdated:o,isAdmin:c,onPluginClick:u})=>{let[m,h]=(0,l.useState)([{id:"created_at",desc:!0}]),[g,P]=(0,l.useState)(null),D=async e=>{if(n){P(e.id);try{e.enabled?(await (0,r.disableClaudeCodePlugin)(n,e.name),A.default.success(`Plugin "${e.name}" disabled`)):(await (0,r.enableClaudeCodePlugin)(n,e.name),A.default.success(`Plugin "${e.name}" enabled`)),o()}catch(e){A.default.error("Failed to toggle plugin status")}finally{P(null)}}},M=[{header:"Plugin Name",accessorKey:"name",cell:({row:e})=>{let l=e.original,s=l.name||"";return(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(E.Tooltip,{title:s,children:(0,t.jsx)(a.Button,{size:"xs",variant:"light",className:"font-mono text-blue-500 bg-blue-50 hover:bg-blue-100 text-xs font-normal px-2 py-0.5 text-left overflow-hidden truncate min-w-[150px] justify-start",onClick:()=>u(l.id),children:s})}),(0,t.jsx)(E.Tooltip,{title:"Copy Plugin ID",children:(0,t.jsx)(x.CopyOutlined,{onClick:e=>{var t;e.stopPropagation(),t=l.id,navigator.clipboard.writeText(t),A.default.success("Copied to clipboard!")},className:"cursor-pointer text-gray-500 hover:text-blue-500 text-xs"})})]})}},{header:"Version",accessorKey:"version",cell:({row:e})=>{let l=e.original.version||"N/A";return(0,t.jsx)("span",{className:"text-xs text-gray-600",children:l})}},{header:"Description",accessorKey:"description",cell:({row:e})=>{let l=e.original.description||"No description";return(0,t.jsx)(E.Tooltip,{title:l,children:(0,t.jsx)("span",{className:"text-xs text-gray-600 block max-w-[300px] truncate",children:l})})}},{header:"Category",accessorKey:"category",cell:({row:e})=>{let l=e.original.category;if(!l)return(0,t.jsx)(w.Badge,{color:"gray",className:"text-xs font-normal",size:"xs",children:"Uncategorized"});let a=(0,d.getCategoryBadgeColor)(l);return(0,t.jsx)(w.Badge,{color:a,className:"text-xs font-normal",size:"xs",children:l})}},{header:"Enabled",accessorKey:"enabled",cell:({row:e})=>{let l=e.original;return(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(w.Badge,{color:l.enabled?"green":"gray",className:"text-xs font-normal",size:"xs",children:l.enabled?"Yes":"No"}),c&&(0,t.jsx)(E.Tooltip,{title:l.enabled?"Disable plugin":"Enable plugin",children:(0,t.jsx)(I.Switch,{size:"small",checked:l.enabled,loading:g===l.id,onChange:()=>D(l)})})]})}},{header:"Created At",accessorKey:"created_at",cell:({row:e})=>{var l;let a=e.original;return(0,t.jsx)(E.Tooltip,{title:a.created_at,children:(0,t.jsx)("span",{className:"text-xs",children:(l=a.created_at)?new Date(l).toLocaleString():"-"})})}},...c?[{header:"Actions",id:"actions",enableSorting:!1,cell:({row:e})=>{let l=e.original;return(0,t.jsx)("div",{className:"flex items-center gap-1",children:(0,t.jsx)(E.Tooltip,{title:"Delete plugin",children:(0,t.jsx)(a.Button,{size:"xs",variant:"light",color:"red",onClick:e=>{e.stopPropagation(),i(l.name,l.name)},icon:y.TrashIcon,className:"text-red-500 hover:text-red-700 hover:bg-red-50"})})})}}]:[]],B=(0,j.useReactTable)({data:e,columns:M,state:{sorting:m},onSortingChange:h,getCoreRowModel:(0,v.getCoreRowModel)(),getSortedRowModel:(0,v.getSortedRowModel)(),enableSorting:!0});return(0,t.jsx)("div",{className:"rounded-lg custom-border relative",children:(0,t.jsx)("div",{className:"overflow-x-auto",children:(0,t.jsxs)(_.Table,{className:"[&_td]:py-0.5 [&_th]:py-1",children:[(0,t.jsx)(C.TableHead,{children:B.getHeaderGroups().map(e=>(0,t.jsx)(T.TableRow,{children:e.headers.map(e=>(0,t.jsx)(S.TableHeaderCell,{className:`py-1 h-8 ${"actions"===e.id?"sticky right-0 bg-white shadow-[-4px_0_8px_-6px_rgba(0,0,0,0.1)]":""}`,onClick:e.column.getCanSort()?e.column.getToggleSortingHandler():void 0,children:(0,t.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,t.jsx)("div",{className:"flex items-center",children:e.isPlaceholder?null:(0,j.flexRender)(e.column.columnDef.header,e.getContext())}),e.column.getCanSort()&&(0,t.jsx)("div",{className:"w-4",children:e.column.getIsSorted()?({asc:(0,t.jsx)(f.ChevronUpIcon,{className:"h-4 w-4 text-blue-500"}),desc:(0,t.jsx)(p.ChevronDownIcon,{className:"h-4 w-4 text-blue-500"})})[e.column.getIsSorted()]:(0,t.jsx)(b.SwitchVerticalIcon,{className:"h-4 w-4 text-gray-400"})})]})},e.id))},e.id))}),(0,t.jsx)(N.TableBody,{children:s?(0,t.jsx)(T.TableRow,{children:(0,t.jsx)(k.TableCell,{colSpan:M.length,className:"h-8 text-center",children:(0,t.jsx)("div",{className:"text-center text-gray-500",children:(0,t.jsx)("p",{children:"Loading..."})})})}):e&&e.length>0?B.getRowModel().rows.map(e=>(0,t.jsx)(T.TableRow,{className:"h-8",children:e.getVisibleCells().map(e=>(0,t.jsx)(k.TableCell,{className:`py-0.5 max-h-8 overflow-hidden text-ellipsis whitespace-nowrap ${"actions"===e.column.id?"sticky right-0 bg-white shadow-[-4px_0_8px_-6px_rgba(0,0,0,0.1)]":""}`,children:(0,j.flexRender)(e.column.columnDef.cell,e.getContext())},e.id))},e.id)):(0,t.jsx)(T.TableRow,{children:(0,t.jsx)(k.TableCell,{colSpan:M.length,className:"h-8 text-center",children:(0,t.jsx)("div",{className:"text-center text-gray-500",children:(0,t.jsx)("p",{children:"No plugins found. Add one to get started."})})})})})]})})})};var D=e.i(708347),M=e.i(530212),B=e.i(434626),O=e.i(304967),F=e.i(350967),R=e.i(599724),L=e.i(629569),z=e.i(482725);let U=({pluginId:e,onClose:s,accessToken:i,isAdmin:n,onPluginUpdated:o})=>{let[c,u]=(0,l.useState)(null),[m,h]=(0,l.useState)(!0),[g,p]=(0,l.useState)(!1);(0,l.useEffect)(()=>{f()},[e,i]);let f=async()=>{if(i){h(!0);try{let t=await (0,r.getClaudeCodePluginDetails)(i,e);u(t.plugin)}catch(e){console.error("Error fetching plugin info:",e),A.default.error("Failed to load plugin information")}finally{h(!1)}}},b=async()=>{if(i&&c){p(!0);try{c.enabled?(await (0,r.disableClaudeCodePlugin)(i,c.name),A.default.success(`Plugin "${c.name}" disabled`)):(await (0,r.enableClaudeCodePlugin)(i,c.name),A.default.success(`Plugin "${c.name}" enabled`)),o(),f()}catch(e){A.default.error("Failed to toggle plugin status")}finally{p(!1)}}},y=e=>{navigator.clipboard.writeText(e),A.default.success("Copied to clipboard!")};if(m)return(0,t.jsx)("div",{className:"flex items-center justify-center p-8",children:(0,t.jsx)(z.Spin,{size:"large"})});if(!c)return(0,t.jsxs)("div",{className:"p-8 text-center text-gray-500",children:[(0,t.jsx)("p",{children:"Plugin not found"}),(0,t.jsx)(a.Button,{className:"mt-4",onClick:s,children:"Go Back"})]});let j=(0,d.formatInstallCommand)(c),v=(0,d.getSourceLink)(c.source),_=(0,d.getCategoryBadgeColor)(c.category);return(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsxs)("div",{className:"flex items-center gap-3 mb-6",children:[(0,t.jsx)(M.ArrowLeftIcon,{className:"h-5 w-5 cursor-pointer text-gray-500 hover:text-gray-700",onClick:s}),(0,t.jsx)("h2",{className:"text-2xl font-bold",children:c.name}),c.version&&(0,t.jsxs)(w.Badge,{color:"blue",size:"xs",children:["v",c.version]}),c.category&&(0,t.jsx)(w.Badge,{color:_,size:"xs",children:c.category}),(0,t.jsx)(w.Badge,{color:c.enabled?"green":"gray",size:"xs",children:c.enabled?"Enabled":"Disabled"})]}),(0,t.jsx)(O.Card,{children:(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[(0,t.jsxs)("div",{className:"flex-1",children:[(0,t.jsx)(R.Text,{className:"text-gray-600 text-xs mb-2",children:"Install Command"}),(0,t.jsx)("div",{className:"font-mono bg-gray-100 px-3 py-2 rounded text-sm",children:j})]}),(0,t.jsx)(E.Tooltip,{title:"Copy install command",children:(0,t.jsx)(a.Button,{size:"xs",variant:"secondary",icon:x.CopyOutlined,onClick:()=>y(j),className:"ml-4",children:"Copy"})})]})}),(0,t.jsxs)(O.Card,{children:[(0,t.jsx)(L.Title,{children:"Plugin Details"}),(0,t.jsxs)(F.Grid,{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-6 mt-4",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)(R.Text,{className:"text-gray-600 text-xs",children:"Plugin ID"}),(0,t.jsxs)("div",{className:"flex items-center gap-2 mt-1",children:[(0,t.jsx)(R.Text,{className:"font-mono text-xs",children:c.id}),(0,t.jsx)(x.CopyOutlined,{className:"cursor-pointer text-gray-500 hover:text-blue-500 text-xs",onClick:()=>y(c.id)})]})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(R.Text,{className:"text-gray-600 text-xs",children:"Name"}),(0,t.jsx)(R.Text,{className:"font-semibold mt-1",children:c.name})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(R.Text,{className:"text-gray-600 text-xs",children:"Version"}),(0,t.jsx)(R.Text,{className:"font-semibold mt-1",children:c.version||"N/A"})]}),(0,t.jsxs)("div",{className:"col-span-2",children:[(0,t.jsx)(R.Text,{className:"text-gray-600 text-xs",children:"Source"}),(0,t.jsxs)("div",{className:"flex items-center gap-2 mt-1",children:[(0,t.jsx)(R.Text,{className:"font-semibold",children:(0,d.getSourceDisplayText)(c.source)}),v&&(0,t.jsx)("a",{href:v,target:"_blank",rel:"noopener noreferrer",className:"text-blue-500 hover:text-blue-700",children:(0,t.jsx)(B.ExternalLinkIcon,{className:"h-4 w-4"})})]})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(R.Text,{className:"text-gray-600 text-xs",children:"Category"}),(0,t.jsx)("div",{className:"mt-1",children:c.category?(0,t.jsx)(w.Badge,{color:_,size:"xs",children:c.category}):(0,t.jsx)(R.Text,{className:"text-gray-400",children:"Uncategorized"})})]}),n&&(0,t.jsxs)("div",{className:"col-span-3",children:[(0,t.jsx)(R.Text,{className:"text-gray-600 text-xs",children:"Status"}),(0,t.jsxs)("div",{className:"flex items-center gap-3 mt-2",children:[(0,t.jsx)(I.Switch,{checked:c.enabled,loading:g,onChange:b}),(0,t.jsx)(R.Text,{className:"text-sm",children:c.enabled?"Plugin is enabled and visible in marketplace":"Plugin is disabled and hidden from marketplace"})]})]})]})]}),c.description&&(0,t.jsxs)(O.Card,{children:[(0,t.jsx)(L.Title,{children:"Description"}),(0,t.jsx)(R.Text,{className:"mt-2",children:c.description})]}),c.keywords&&c.keywords.length>0&&(0,t.jsxs)(O.Card,{children:[(0,t.jsx)(L.Title,{children:"Keywords"}),(0,t.jsx)("div",{className:"flex flex-wrap gap-2 mt-2",children:c.keywords.map((e,l)=>(0,t.jsx)(w.Badge,{color:"gray",size:"xs",children:e},l))})]}),c.author&&(0,t.jsxs)(O.Card,{children:[(0,t.jsx)(L.Title,{children:"Author Information"}),(0,t.jsxs)(F.Grid,{className:"grid grid-cols-1 sm:grid-cols-2 gap-4 mt-4",children:[c.author.name&&(0,t.jsxs)("div",{children:[(0,t.jsx)(R.Text,{className:"text-gray-600 text-xs",children:"Name"}),(0,t.jsx)(R.Text,{className:"font-semibold mt-1",children:c.author.name})]}),c.author.email&&(0,t.jsxs)("div",{children:[(0,t.jsx)(R.Text,{className:"text-gray-600 text-xs",children:"Email"}),(0,t.jsx)(R.Text,{className:"font-semibold mt-1",children:(0,t.jsx)("a",{href:`mailto:${c.author.email}`,className:"text-blue-500 hover:text-blue-700",children:c.author.email})})]})]})]}),c.homepage&&(0,t.jsxs)(O.Card,{children:[(0,t.jsx)(L.Title,{children:"Homepage"}),(0,t.jsxs)("a",{href:c.homepage,target:"_blank",rel:"noopener noreferrer",className:"text-blue-500 hover:text-blue-700 flex items-center gap-2 mt-2",children:[c.homepage,(0,t.jsx)(B.ExternalLinkIcon,{className:"h-4 w-4"})]})]}),(0,t.jsxs)(O.Card,{children:[(0,t.jsx)(L.Title,{children:"Metadata"}),(0,t.jsxs)(F.Grid,{className:"grid grid-cols-1 sm:grid-cols-2 gap-4 mt-4",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)(R.Text,{className:"text-gray-600 text-xs",children:"Created At"}),(0,t.jsx)(R.Text,{className:"font-semibold mt-1",children:(0,d.formatDateString)(c.created_at)})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(R.Text,{className:"text-gray-600 text-xs",children:"Updated At"}),(0,t.jsx)(R.Text,{className:"font-semibold mt-1",children:(0,d.formatDateString)(c.updated_at)})]}),c.created_by&&(0,t.jsxs)("div",{className:"col-span-2",children:[(0,t.jsx)(R.Text,{className:"text-gray-600 text-xs",children:"Created By"}),(0,t.jsx)(R.Text,{className:"font-semibold mt-1",children:c.created_by})]})]})]})]})};e.s(["default",0,({accessToken:e,userRole:i})=>{let[n,o]=(0,l.useState)([]),[c,d]=(0,l.useState)(!1),[u,m]=(0,l.useState)(!1),[h,x]=(0,l.useState)(!1),[p,f]=(0,l.useState)(null),[b,y]=(0,l.useState)(null),j=!!i&&(0,D.isAdminRole)(i),v=async()=>{if(e){m(!0);try{let t=await (0,r.getClaudeCodePluginsList)(e,!1);console.log(`Claude Code plugins: ${JSON.stringify(t)}`),o(t.plugins)}catch(e){console.error("Error fetching Claude Code plugins:",e)}finally{m(!1)}}};(0,l.useEffect)(()=>{v()},[e]);let w=async()=>{if(p&&e){x(!0);try{await (0,r.deleteClaudeCodePlugin)(e,p.name),A.default.success(`Plugin "${p.displayName}" deleted successfully`),v()}catch(e){console.error("Error deleting plugin:",e),A.default.error("Failed to delete plugin")}finally{x(!1),f(null)}}};return(0,t.jsxs)("div",{className:"w-full mx-auto flex-auto overflow-y-auto m-8 p-2",children:[(0,t.jsxs)("div",{className:"flex flex-col gap-2 mb-4",children:[(0,t.jsx)("h1",{className:"text-2xl font-bold",children:"Claude Code Plugins"}),(0,t.jsxs)("p",{className:"text-sm text-gray-600",children:["Manage Claude Code marketplace plugins. Add, enable, disable, or delete plugins that will be available in your marketplace catalog. Enabled plugins will appear in the public marketplace at"," ",(0,t.jsx)("code",{className:"bg-gray-100 px-1 rounded",children:"/claude-code/marketplace.json"}),"."]}),(0,t.jsx)("div",{className:"mt-2",children:(0,t.jsx)(a.Button,{onClick:()=>{b&&y(null),d(!0)},disabled:!e||!j,children:"+ Add New Plugin"})})]}),b?(0,t.jsx)(U,{pluginId:b,onClose:()=>y(null),accessToken:e,isAdmin:j,onPluginUpdated:v}):(0,t.jsx)(P,{pluginsList:n,isLoading:u,onDeleteClick:(e,t)=>{f({name:e,displayName:t})},accessToken:e,onPluginUpdated:v,isAdmin:j,onPluginClick:e=>y(e)}),(0,t.jsx)(g,{visible:c,onClose:()=>{d(!1)},accessToken:e,onSuccess:()=>{v()}}),p&&(0,t.jsxs)(s.Modal,{title:"Delete Plugin",open:null!==p,onOk:w,onCancel:()=>{f(null)},confirmLoading:h,okText:"Delete",okButtonProps:{danger:!0},children:[(0,t.jsxs)("p",{children:["Are you sure you want to delete plugin:"," ",(0,t.jsx)("strong",{children:p.displayName}),"?"]}),(0,t.jsx)("p",{children:"This action cannot be undone."})]})]})}],704308)},735042,e=>{"use strict";e.i(247167);var t=e.i(843476),l=e.i(584935),a=e.i(290571),s=e.i(271645),r=e.i(95779),i=e.i(444755),n=e.i(673706);let o=(0,n.makeClassName)("BarList");function c(e,t){let{data:l=[],color:c,valueFormatter:d=n.defaultValueFormatter,showAnimation:u=!1,onValueChange:m,sortOrder:h="descending",className:g}=e,x=(0,a.__rest)(e,["data","color","valueFormatter","showAnimation","onValueChange","sortOrder","className"]),p=m?"button":"div",f=s.default.useMemo(()=>"none"===h?l:[...l].sort((e,t)=>"ascending"===h?e.value-t.value:t.value-e.value),[l,h]),b=s.default.useMemo(()=>{let e=Math.max(...f.map(e=>e.value),0);return f.map(t=>0===t.value?0:Math.max(t.value/e*100,2))},[f]);return s.default.createElement("div",Object.assign({ref:t,className:(0,i.tremorTwMerge)(o("root"),"flex justify-between space-x-6",g),"aria-sort":h},x),s.default.createElement("div",{className:(0,i.tremorTwMerge)(o("bars"),"relative w-full space-y-1.5")},f.map((e,t)=>{var l,a,d;let h=e.icon;return s.default.createElement(p,{key:null!=(l=e.key)?l:t,onClick:()=>{null==m||m(e)},className:(0,i.tremorTwMerge)(o("bar"),"group w-full flex items-center rounded-tremor-small",m?["cursor-pointer","hover:bg-tremor-background-muted dark:hover:bg-dark-tremor-background-subtle/40"]:"")},s.default.createElement("div",{className:(0,i.tremorTwMerge)("flex items-center rounded transition-all bg-opacity-40","h-8",e.color||c?[(0,n.getColorClassNames)(null!=(a=e.color)?a:c,r.colorPalette.background).bgColor,m?"group-hover:bg-opacity-30":""]:"bg-tremor-brand-subtle dark:bg-dark-tremor-brand-subtle/60",!m||e.color||c?"":"group-hover:bg-tremor-brand-subtle/30 group-hover:dark:bg-dark-tremor-brand-subtle/70",t===f.length-1?"mb-0":"",u?"duration-500":""),style:{width:`${b[t]}%`,transition:u?"all 1s":""}},s.default.createElement("div",{className:(0,i.tremorTwMerge)("absolute left-2 pr-4 flex max-w-full")},h?s.default.createElement(h,{className:(0,i.tremorTwMerge)(o("barIcon"),"flex-none h-5 w-5 mr-2","text-tremor-content","dark:text-dark-tremor-content")}):null,e.href?s.default.createElement("a",{href:e.href,target:null!=(d=e.target)?d:"_blank",rel:"noreferrer",className:(0,i.tremorTwMerge)(o("barLink"),"whitespace-nowrap hover:underline truncate text-tremor-default",m?"cursor-pointer":"","text-tremor-content-emphasis","dark:text-dark-tremor-content-emphasis"),onClick:e=>e.stopPropagation()},e.name):s.default.createElement("p",{className:(0,i.tremorTwMerge)(o("barText"),"whitespace-nowrap truncate text-tremor-default","text-tremor-content-emphasis","dark:text-dark-tremor-content-emphasis")},e.name))))})),s.default.createElement("div",{className:o("labels")},f.map((e,t)=>{var l;return s.default.createElement("div",{key:null!=(l=e.key)?l:t,className:(0,i.tremorTwMerge)(o("labelWrapper"),"flex justify-end items-center","h-8",t===f.length-1?"mb-0":"mb-1.5")},s.default.createElement("p",{className:(0,i.tremorTwMerge)(o("labelText"),"whitespace-nowrap leading-none truncate text-tremor-default","text-tremor-content-emphasis","dark:text-dark-tremor-content-emphasis")},d(e.value)))})))}c.displayName="BarList";let d=s.default.forwardRef(c);var u=e.i(304967),m=e.i(629569),h=e.i(269200),g=e.i(427612),x=e.i(64848),p=e.i(496020),f=e.i(977572),b=e.i(942232),y=e.i(37091),j=e.i(617802),v=e.i(144267),w=e.i(350967),_=e.i(309426),N=e.i(599724),k=e.i(404206),C=e.i(723731),S=e.i(653824),T=e.i(881073),I=e.i(197647),E=e.i(206929),A=e.i(35983),P=e.i(413990),D=e.i(476961),M=e.i(994388),B=e.i(621642),O=e.i(25080),F=e.i(764205),R=e.i(1023),L=e.i(500330);console.log("process.env.NODE_ENV","production");let z=e=>null!==e&&("Admin"===e||"Admin Viewer"===e);e.s(["default",0,({accessToken:e,token:a,userRole:r,userID:i,keys:n,premiumUser:o})=>{let c=new Date,[U,H]=(0,s.useState)([]),[V,$]=(0,s.useState)([]),[q,K]=(0,s.useState)([]),[G,W]=(0,s.useState)([]),[J,Y]=(0,s.useState)([]),[Q,X]=(0,s.useState)([]),[Z,ee]=(0,s.useState)([]),[et,el]=(0,s.useState)([]),[ea,es]=(0,s.useState)([]),[er,ei]=(0,s.useState)([]),[en,eo]=(0,s.useState)({}),[ec,ed]=(0,s.useState)([]),[eu,em]=(0,s.useState)(""),[eh,eg]=(0,s.useState)(["all-tags"]),[ex,ep]=(0,s.useState)({from:new Date(Date.now()-6048e5),to:new Date}),[ef,eb]=(0,s.useState)(null),[ey,ej]=(0,s.useState)(0),ev=new Date(c.getFullYear(),c.getMonth(),1),ew=new Date(c.getFullYear(),c.getMonth()+1,0),e_=eI(ev),eN=eI(ew);function ek(e){return new Intl.NumberFormat("en-US",{maximumFractionDigits:0,notation:"compact",compactDisplay:"short"}).format(e)}console.log("keys in usage",n),console.log("premium user in usage",o);let eC=async()=>{if(e)try{let t=await (0,F.getProxyUISettings)(e);return console.log("usage tab: proxy_settings",t),t}catch(e){console.error("Error fetching proxy settings:",e)}};(0,s.useEffect)(()=>{eT(ex.from,ex.to)},[ex,eh]);let eS=async(t,l,a)=>{if(!t||!l||!e)return;console.log("uiSelectedKey",a);let s=await (0,F.adminTopEndUsersCall)(e,a,t.toISOString(),l.toISOString());console.log("End user data updated successfully",s),W(s)},eT=async(t,l)=>{if(!t||!l||!e)return;let a=await eC();a?.DISABLE_EXPENSIVE_DB_QUERIES||(X((await (0,F.tagsSpendLogsCall)(e,t.toISOString(),l.toISOString(),0===eh.length?void 0:eh)).spend_per_tag),console.log("Tag spend data updated successfully"))};function eI(e){let t=e.getFullYear(),l=e.getMonth()+1,a=e.getDate();return`${t}-${l<10?"0"+l:l}-${a<10?"0"+a:a}`}console.log(`Start date is ${e_}`),console.log(`End date is ${eN}`);let eE=async(e,t,l)=>{try{let l=await e();t(l)}catch(e){console.error(l,e)}},eA=(e,t,l,a)=>{let s=[],r=new Date(t),i=new Map(e.map(e=>{let t=(e=>{if(e.includes("-"))return e;{let[t,l]=e.split(" ");return new Date(new Date().getFullYear(),new Date(`${t} 01 2024`).getMonth(),parseInt(l)).toISOString().split("T")[0]}})(e.date);return[t,{...e,date:t}]}));for(;r<=l;){let e=r.toISOString().split("T")[0];if(i.has(e))s.push(i.get(e));else{let t={date:e,api_requests:0,total_tokens:0};a.forEach(e=>{t[e]||(t[e]=0)}),s.push(t)}r.setDate(r.getDate()+1)}return s},eP=async()=>{if(e)try{let t=await (0,F.adminSpendLogsCall)(e),l=new Date,a=new Date(l.getFullYear(),l.getMonth(),1),s=new Date(l.getFullYear(),l.getMonth()+1,0),r=eA(t,a,s,[]),i=Number(r.reduce((e,t)=>e+(t.spend||0),0).toFixed(2));ej(i),H(r)}catch(e){console.error("Error fetching overall spend:",e)}},eD=async()=>{e&&await eE(async()=>(await (0,F.adminTopKeysCall)(e)).map(e=>({key:e.api_key.substring(0,10),api_key:e.api_key,key_alias:e.key_alias,spend:Number(e.total_spend.toFixed(2))})),$,"Error fetching top keys")},eM=async()=>{e&&await eE(async()=>(await (0,F.adminTopModelsCall)(e)).map(e=>({key:e.model,spend:(0,L.formatNumberWithCommas)(e.total_spend,2)})),K,"Error fetching top models")},eB=async()=>{e&&await eE(async()=>{let t=await (0,F.teamSpendLogsCall)(e),l=new Date,a=new Date(l.getFullYear(),l.getMonth(),1),s=new Date(l.getFullYear(),l.getMonth()+1,0);return Y(eA(t.daily_spend,a,s,t.teams)),el(t.teams),t.total_spend_per_team.map(e=>({name:e.team_id||"",value:(0,L.formatNumberWithCommas)(e.total_spend||0,2)}))},es,"Error fetching team spend")},eO=async()=>{if(e)try{let t=await (0,F.adminGlobalActivity)(e,e_,eN),l=new Date,a=new Date(l.getFullYear(),l.getMonth(),1),s=new Date(l.getFullYear(),l.getMonth()+1,0),r=eA(t.daily_data||[],a,s,["api_requests","total_tokens"]);eo({...t,daily_data:r})}catch(e){console.error("Error fetching global activity:",e)}},eF=async()=>{if(e)try{let t=await (0,F.adminGlobalActivityPerModel)(e,e_,eN),l=new Date,a=new Date(l.getFullYear(),l.getMonth(),1),s=new Date(l.getFullYear(),l.getMonth()+1,0),r=t.map(e=>({...e,daily_data:eA(e.daily_data||[],a,s,["api_requests","total_tokens"])}));ed(r)}catch(e){console.error("Error fetching global activity per model:",e)}};return((0,s.useEffect)(()=>{(async()=>{if(e&&a&&r&&i){let t=await eC();!(t&&(eb(t),t?.DISABLE_EXPENSIVE_DB_QUERIES))&&(console.log("fetching data - valiue of proxySettings",ef),eP(),eE(()=>e&&a?(0,F.adminspendByProvider)(e,a,e_,eN):Promise.reject("No access token or token"),ei,"Error fetching provider spend"),eD(),eM(),eO(),eF(),z(r)&&(eB(),e&&eE(async()=>(await (0,F.allTagNamesCall)(e)).tag_names,ee,"Error fetching tag names"),e&&eE(()=>(0,F.tagsSpendLogsCall)(e,ex.from?.toISOString(),ex.to?.toISOString(),void 0),e=>X(e.spend_per_tag),"Error fetching top tags"),e&&eE(()=>(0,F.adminTopEndUsersCall)(e,null,void 0,void 0),W,"Error fetching top end users")))}})()},[e,a,r,i,e_,eN]),ef?.DISABLE_EXPENSIVE_DB_QUERIES)?(0,t.jsx)("div",{style:{width:"100%"},className:"p-8",children:(0,t.jsxs)(u.Card,{children:[(0,t.jsx)(m.Title,{children:"Database Query Limit Reached"}),(0,t.jsxs)(N.Text,{className:"mt-4",children:["SpendLogs in DB has ",ef.NUM_SPEND_LOGS_ROWS," rows.",(0,t.jsx)("br",{}),"Please follow our guide to view usage when SpendLogs has more than 1M rows."]}),(0,t.jsx)(M.Button,{className:"mt-4",children:(0,t.jsx)("a",{href:"https://docs.litellm.ai/docs/proxy/spending_monitoring",target:"_blank",children:"View Usage Guide"})})]})}):(0,t.jsx)("div",{style:{width:"100%"},className:"p-8",children:(0,t.jsxs)(S.TabGroup,{children:[(0,t.jsxs)(T.TabList,{className:"mt-2",children:[(0,t.jsx)(I.Tab,{children:"All Up"}),z(r)?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(I.Tab,{children:"Team Based Usage"}),(0,t.jsx)(I.Tab,{children:"Customer Usage"}),(0,t.jsx)(I.Tab,{children:"Tag Based Usage"})]}):(0,t.jsx)(t.Fragment,{children:(0,t.jsx)("div",{})})]}),(0,t.jsxs)(C.TabPanels,{children:[(0,t.jsx)(k.TabPanel,{children:(0,t.jsxs)(S.TabGroup,{children:[(0,t.jsxs)(T.TabList,{variant:"solid",className:"mt-1",children:[(0,t.jsx)(I.Tab,{children:"Cost"}),(0,t.jsx)(I.Tab,{children:"Activity"})]}),(0,t.jsxs)(C.TabPanels,{children:[(0,t.jsx)(k.TabPanel,{children:(0,t.jsxs)(w.Grid,{numItems:2,className:"gap-2 h-[100vh] w-full",children:[(0,t.jsxs)(_.Col,{numColSpan:2,children:[(0,t.jsxs)(N.Text,{className:"text-tremor-default text-tremor-content dark:text-dark-tremor-content mb-2 mt-2 text-lg",children:["Project Spend ",new Date().toLocaleString("default",{month:"long"})," 1 -"," ",new Date(new Date().getFullYear(),new Date().getMonth()+1,0).getDate()]}),(0,t.jsx)(j.default,{userSpend:ey,selectedTeam:null,userMaxBudget:null})]}),(0,t.jsx)(_.Col,{numColSpan:2,children:(0,t.jsxs)(u.Card,{children:[(0,t.jsx)(m.Title,{children:"Monthly Spend"}),(0,t.jsx)(l.BarChart,{data:U,index:"date",categories:["spend"],colors:["cyan"],valueFormatter:e=>`$ ${(0,L.formatNumberWithCommas)(e,2)}`,yAxisWidth:100,tickGap:5})]})}),(0,t.jsx)(_.Col,{numColSpan:1,children:(0,t.jsxs)(u.Card,{className:"h-full",children:[(0,t.jsx)(m.Title,{children:"Top Virtual Keys"}),(0,t.jsx)(R.default,{topKeys:V,teams:null,topKeysLimit:5,setTopKeysLimit:()=>{}})]})}),(0,t.jsx)(_.Col,{numColSpan:1,children:(0,t.jsxs)(u.Card,{className:"h-full",children:[(0,t.jsx)(m.Title,{children:"Top Models"}),(0,t.jsx)(l.BarChart,{className:"mt-4 h-40",data:q,index:"key",categories:["spend"],colors:["cyan"],yAxisWidth:200,layout:"vertical",showXAxis:!1,showLegend:!1,valueFormatter:e=>`$${(0,L.formatNumberWithCommas)(e,2)}`})]})}),(0,t.jsx)(_.Col,{numColSpan:1}),(0,t.jsx)(_.Col,{numColSpan:2,children:(0,t.jsxs)(u.Card,{className:"mb-2",children:[(0,t.jsx)(m.Title,{children:"Spend by Provider"}),(0,t.jsx)(t.Fragment,{children:(0,t.jsxs)(w.Grid,{numItems:2,children:[(0,t.jsx)(_.Col,{numColSpan:1,children:(0,t.jsx)(P.DonutChart,{className:"mt-4 h-40",variant:"pie",data:er,index:"provider",category:"spend",colors:["cyan"],valueFormatter:e=>`$${(0,L.formatNumberWithCommas)(e,2)}`})}),(0,t.jsx)(_.Col,{numColSpan:1,children:(0,t.jsxs)(h.Table,{children:[(0,t.jsx)(g.TableHead,{children:(0,t.jsxs)(p.TableRow,{children:[(0,t.jsx)(x.TableHeaderCell,{children:"Provider"}),(0,t.jsx)(x.TableHeaderCell,{children:"Spend"})]})}),(0,t.jsx)(b.TableBody,{children:er.map(e=>(0,t.jsxs)(p.TableRow,{children:[(0,t.jsx)(f.TableCell,{children:e.provider}),(0,t.jsx)(f.TableCell,{children:1e-5>parseFloat(e.spend.toFixed(2))?"less than 0.00":(0,L.formatNumberWithCommas)(e.spend,2)})]},e.provider))})]})})]})})]})})]})}),(0,t.jsx)(k.TabPanel,{children:(0,t.jsxs)(w.Grid,{numItems:1,className:"gap-2 h-[75vh] w-full",children:[(0,t.jsxs)(u.Card,{children:[(0,t.jsx)(m.Title,{children:"All Up"}),(0,t.jsxs)(w.Grid,{numItems:2,children:[(0,t.jsxs)(_.Col,{children:[(0,t.jsxs)(y.Subtitle,{style:{fontSize:"15px",fontWeight:"normal",color:"#535452"},children:["API Requests ",ek(en.sum_api_requests)]}),(0,t.jsx)(D.AreaChart,{className:"h-40",data:en.daily_data,valueFormatter:ek,index:"date",colors:["cyan"],categories:["api_requests"],onValueChange:e=>console.log(e)})]}),(0,t.jsxs)(_.Col,{children:[(0,t.jsxs)(y.Subtitle,{style:{fontSize:"15px",fontWeight:"normal",color:"#535452"},children:["Tokens ",ek(en.sum_total_tokens)]}),(0,t.jsx)(l.BarChart,{className:"h-40",data:en.daily_data,valueFormatter:ek,index:"date",colors:["cyan"],categories:["total_tokens"],onValueChange:e=>console.log(e)})]})]})]}),(0,t.jsx)(t.Fragment,{children:ec.map((e,a)=>(0,t.jsxs)(u.Card,{children:[(0,t.jsx)(m.Title,{children:e.model}),(0,t.jsxs)(w.Grid,{numItems:2,children:[(0,t.jsxs)(_.Col,{children:[(0,t.jsxs)(y.Subtitle,{style:{fontSize:"15px",fontWeight:"normal",color:"#535452"},children:["API Requests ",ek(e.sum_api_requests)]}),(0,t.jsx)(D.AreaChart,{className:"h-40",data:e.daily_data,index:"date",colors:["cyan"],categories:["api_requests"],valueFormatter:ek,onValueChange:e=>console.log(e)})]}),(0,t.jsxs)(_.Col,{children:[(0,t.jsxs)(y.Subtitle,{style:{fontSize:"15px",fontWeight:"normal",color:"#535452"},children:["Tokens ",ek(e.sum_total_tokens)]}),(0,t.jsx)(l.BarChart,{className:"h-40",data:e.daily_data,index:"date",colors:["cyan"],categories:["total_tokens"],valueFormatter:ek,onValueChange:e=>console.log(e)})]})]})]},a))})]})})]})]})}),(0,t.jsx)(k.TabPanel,{children:(0,t.jsxs)(w.Grid,{numItems:2,className:"gap-2 h-[75vh] w-full",children:[(0,t.jsxs)(_.Col,{numColSpan:2,children:[(0,t.jsxs)(u.Card,{className:"mb-2",children:[(0,t.jsx)(m.Title,{children:"Total Spend Per Team"}),(0,t.jsx)(d,{data:ea})]}),(0,t.jsxs)(u.Card,{children:[(0,t.jsx)(m.Title,{children:"Daily Spend Per Team"}),(0,t.jsx)(l.BarChart,{className:"h-72",data:J,showLegend:!0,index:"date",categories:et,yAxisWidth:80,stack:!0})]})]}),(0,t.jsx)(_.Col,{numColSpan:2})]})}),(0,t.jsxs)(k.TabPanel,{children:[(0,t.jsxs)("p",{className:"mb-2 text-gray-500 italic text-[12px]",children:["Customers of your LLM API calls. Tracked when a `user` param is passed in your LLM calls"," ",(0,t.jsx)("a",{className:"text-blue-500",href:"https://docs.litellm.ai/docs/proxy/users",target:"_blank",children:"docs here"})]}),(0,t.jsxs)(w.Grid,{numItems:2,children:[(0,t.jsx)(_.Col,{children:(0,t.jsx)(v.default,{value:ex,onValueChange:e=>{ep(e),eS(e.from,e.to,null)}})}),(0,t.jsxs)(_.Col,{children:[(0,t.jsx)(N.Text,{children:"Select Key"}),(0,t.jsxs)(E.Select,{defaultValue:"all-keys",children:[(0,t.jsx)(A.SelectItem,{value:"all-keys",onClick:()=>{eS(ex.from,ex.to,null)},children:"All Keys"},"all-keys"),n?.map((e,l)=>e&&null!==e.key_alias&&e.key_alias.length>0?(0,t.jsx)(A.SelectItem,{value:String(l),onClick:()=>{eS(ex.from,ex.to,e.token)},children:e.key_alias},l):null)]})]})]}),(0,t.jsx)(u.Card,{className:"mt-4",children:(0,t.jsxs)(h.Table,{className:"max-h-[70vh] min-h-[500px]",children:[(0,t.jsx)(g.TableHead,{children:(0,t.jsxs)(p.TableRow,{children:[(0,t.jsx)(x.TableHeaderCell,{children:"Customer"}),(0,t.jsx)(x.TableHeaderCell,{children:"Spend"}),(0,t.jsx)(x.TableHeaderCell,{children:"Total Events"})]})}),(0,t.jsx)(b.TableBody,{children:G?.map((e,l)=>(0,t.jsxs)(p.TableRow,{children:[(0,t.jsx)(f.TableCell,{children:e.end_user}),(0,t.jsx)(f.TableCell,{children:(0,L.formatNumberWithCommas)(e.total_spend,2)}),(0,t.jsx)(f.TableCell,{children:e.total_count})]},l))})]})})]}),(0,t.jsxs)(k.TabPanel,{children:[(0,t.jsxs)(w.Grid,{numItems:2,children:[(0,t.jsx)(_.Col,{numColSpan:1,children:(0,t.jsx)(v.default,{className:"mb-4",value:ex,onValueChange:e=>{ep(e),eT(e.from,e.to)}})}),(0,t.jsx)(_.Col,{children:o?(0,t.jsx)("div",{children:(0,t.jsxs)(B.MultiSelect,{value:eh,onValueChange:e=>eg(e),children:[(0,t.jsx)(O.MultiSelectItem,{value:"all-tags",onClick:()=>eg(["all-tags"]),children:"All Tags"},"all-tags"),Z&&Z.filter(e=>"all-tags"!==e).map((e,l)=>(0,t.jsx)(O.MultiSelectItem,{value:String(e),children:e},e))]})}):(0,t.jsx)("div",{children:(0,t.jsxs)(B.MultiSelect,{value:eh,onValueChange:e=>eg(e),children:[(0,t.jsx)(O.MultiSelectItem,{value:"all-tags",onClick:()=>eg(["all-tags"]),children:"All Tags"},"all-tags"),Z&&Z.filter(e=>"all-tags"!==e).map((e,l)=>(0,t.jsxs)(A.SelectItem,{value:String(e),disabled:!0,children:["✨ ",e," (Enterprise only Feature)"]},e))]})})})]}),(0,t.jsxs)(w.Grid,{numItems:2,className:"gap-2 h-[75vh] w-full mb-4",children:[(0,t.jsx)(_.Col,{numColSpan:2,children:(0,t.jsxs)(u.Card,{children:[(0,t.jsx)(m.Title,{children:"Spend Per Tag"}),(0,t.jsxs)(N.Text,{children:["Get Started by Tracking cost per tag"," ",(0,t.jsx)("a",{className:"text-blue-500",href:"https://docs.litellm.ai/docs/proxy/cost_tracking",target:"_blank",children:"here"})]}),(0,t.jsx)(l.BarChart,{className:"h-72",data:Q,index:"name",categories:["spend"],colors:["cyan"]})]})}),(0,t.jsx)(_.Col,{numColSpan:2})]})]})]})]})})}],735042)},345244,e=>{"use strict";var t=e.i(843476),l=e.i(271645),a=e.i(752978),s=e.i(994388),r=e.i(309426),i=e.i(599724),n=e.i(350967),o=e.i(278587),c=e.i(304967),d=e.i(629569),u=e.i(389083),m=e.i(677667),h=e.i(898667),g=e.i(130643),x=e.i(808613),p=e.i(311451),f=e.i(199133),b=e.i(592968),y=e.i(827252),j=e.i(702597),v=e.i(355619),w=e.i(764205),_=e.i(727749),N=e.i(435451),k=e.i(860585),C=e.i(500330),S=e.i(678784),T=e.i(118366),I=e.i(464571);let E=({tagId:e,onClose:a,accessToken:r,is_admin:n,editTag:o})=>{let[E]=x.Form.useForm(),[A,P]=(0,l.useState)(null),[D,M]=(0,l.useState)(o),[B,O]=(0,l.useState)([]),[F,R]=(0,l.useState)({}),L=async(e,t)=>{await (0,C.copyToClipboard)(e)&&(R(e=>({...e,[t]:!0})),setTimeout(()=>{R(e=>({...e,[t]:!1}))},2e3))},z=async()=>{if(r)try{let t=(await (0,w.tagInfoCall)(r,[e]))[e];t&&(P(t),o&&E.setFieldsValue({name:t.name,description:t.description,models:t.models,max_budget:t.litellm_budget_table?.max_budget,budget_duration:t.litellm_budget_table?.budget_duration}))}catch(e){console.error("Error fetching tag details:",e),_.default.fromBackend("Error fetching tag details: "+e)}};(0,l.useEffect)(()=>{z()},[e,r]),(0,l.useEffect)(()=>{r&&(0,j.fetchUserModels)("dummy-user","Admin",r,O)},[r]);let U=async e=>{if(r)try{await (0,w.tagUpdateCall)(r,{name:e.name,description:e.description,models:e.models,max_budget:e.max_budget,tpm_limit:e.tpm_limit,rpm_limit:e.rpm_limit,budget_duration:e.budget_duration}),_.default.success("Tag updated successfully"),M(!1),z()}catch(e){console.error("Error updating tag:",e),_.default.fromBackend("Error updating tag: "+e)}};return A?(0,t.jsxs)("div",{className:"p-4",children:[(0,t.jsxs)("div",{className:"flex justify-between items-center mb-6",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)(s.Button,{onClick:a,className:"mb-4",children:"← Back to Tags"}),(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(i.Text,{className:"font-medium",children:"Tag Name:"}),(0,t.jsx)("span",{className:"font-mono px-2 py-1 bg-gray-100 rounded text-sm border border-gray-200",children:A.name}),(0,t.jsx)(I.Button,{type:"text",size:"small",icon:F["tag-name"]?(0,t.jsx)(S.CheckIcon,{size:12}):(0,t.jsx)(T.CopyIcon,{size:12}),onClick:()=>L(A.name,"tag-name"),className:`transition-all duration-200 ${F["tag-name"]?"text-green-600 bg-green-50 border-green-200":"text-gray-500 hover:text-gray-700 hover:bg-gray-100"}`})]}),(0,t.jsx)(i.Text,{className:"text-gray-500",children:A.description||"No description"})]}),n&&!D&&(0,t.jsx)(s.Button,{onClick:()=>M(!0),children:"Edit Tag"})]}),D?(0,t.jsx)(c.Card,{children:(0,t.jsxs)(x.Form,{form:E,onFinish:U,layout:"vertical",initialValues:A,children:[(0,t.jsx)(x.Form.Item,{label:"Tag Name",name:"name",rules:[{required:!0,message:"Please input a tag name"}],children:(0,t.jsx)(p.Input,{className:"rounded-md border-gray-300"})}),(0,t.jsx)(x.Form.Item,{label:"Description",name:"description",children:(0,t.jsx)(p.Input.TextArea,{rows:4})}),(0,t.jsx)(x.Form.Item,{label:(0,t.jsxs)("span",{children:["Allowed Models",(0,t.jsx)(b.Tooltip,{title:"Select which models are allowed to process this type of data",children:(0,t.jsx)(y.InfoCircleOutlined,{style:{marginLeft:"4px"}})})]}),name:"models",children:(0,t.jsx)(f.Select,{mode:"multiple",placeholder:"Select Models",children:B.map(e=>(0,t.jsx)(f.Select.Option,{value:e,children:(0,v.getModelDisplayName)(e)},e))})}),(0,t.jsxs)(m.Accordion,{className:"mt-4 mb-4",children:[(0,t.jsx)(h.AccordionHeader,{children:(0,t.jsx)(d.Title,{className:"m-0",children:"Budget & Rate Limits"})}),(0,t.jsxs)(g.AccordionBody,{children:[(0,t.jsx)(x.Form.Item,{label:(0,t.jsxs)("span",{children:["Max Budget (USD)"," ",(0,t.jsx)(b.Tooltip,{title:"Maximum amount in USD this tag can spend",children:(0,t.jsx)(y.InfoCircleOutlined,{style:{marginLeft:"4px"}})})]}),name:"max_budget",children:(0,t.jsx)(N.default,{step:.01,precision:2,width:200})}),(0,t.jsx)(x.Form.Item,{label:(0,t.jsxs)("span",{children:["Reset Budget"," ",(0,t.jsx)(b.Tooltip,{title:"How often the budget should reset",children:(0,t.jsx)(y.InfoCircleOutlined,{style:{marginLeft:"4px"}})})]}),name:"budget_duration",children:(0,t.jsx)(k.default,{onChange:e=>E.setFieldValue("budget_duration",e)})}),(0,t.jsx)("div",{className:"mt-4 p-3 bg-gray-50 rounded-md border border-gray-200",children:(0,t.jsxs)("p",{className:"text-sm text-gray-600",children:["TPM/RPM limits for tags are not currently supported. If you need this feature, please"," ",(0,t.jsx)("a",{href:"https://github.com/BerriAI/litellm/issues/new",target:"_blank",rel:"noopener noreferrer",className:"text-blue-600 hover:text-blue-800 underline",children:"create a GitHub issue"}),"."]})})]})]}),(0,t.jsxs)("div",{className:"flex justify-end space-x-2",children:[(0,t.jsx)(s.Button,{onClick:()=>M(!1),children:"Cancel"}),(0,t.jsx)(s.Button,{type:"submit",children:"Save Changes"})]})]})}):(0,t.jsxs)("div",{className:"space-y-6",children:[(0,t.jsxs)(c.Card,{children:[(0,t.jsx)(d.Title,{children:"Tag Details"}),(0,t.jsxs)("div",{className:"space-y-4 mt-4",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)(i.Text,{className:"font-medium",children:"Name"}),(0,t.jsx)(i.Text,{children:A.name})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(i.Text,{className:"font-medium",children:"Description"}),(0,t.jsx)(i.Text,{children:A.description||"-"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(i.Text,{className:"font-medium",children:"Allowed Models"}),(0,t.jsx)("div",{className:"flex flex-wrap gap-2 mt-2",children:A.models&&0!==A.models.length?A.models.map(e=>(0,t.jsx)(u.Badge,{color:"blue",children:(0,t.jsx)(b.Tooltip,{title:`ID: ${e}`,children:A.model_info?.[e]||e})},e)):(0,t.jsx)(u.Badge,{color:"red",children:"All Models"})})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(i.Text,{className:"font-medium",children:"Created"}),(0,t.jsx)(i.Text,{children:A.created_at?new Date(A.created_at).toLocaleString():"-"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(i.Text,{className:"font-medium",children:"Last Updated"}),(0,t.jsx)(i.Text,{children:A.updated_at?new Date(A.updated_at).toLocaleString():"-"})]})]})]}),A.litellm_budget_table&&(0,t.jsxs)(c.Card,{children:[(0,t.jsx)(d.Title,{children:"Budget & Rate Limits"}),(0,t.jsxs)("div",{className:"space-y-4 mt-4",children:[void 0!==A.litellm_budget_table.max_budget&&null!==A.litellm_budget_table.max_budget&&(0,t.jsxs)("div",{children:[(0,t.jsx)(i.Text,{className:"font-medium",children:"Max Budget"}),(0,t.jsxs)(i.Text,{children:["$",A.litellm_budget_table.max_budget]})]}),A.litellm_budget_table.budget_duration&&(0,t.jsxs)("div",{children:[(0,t.jsx)(i.Text,{className:"font-medium",children:"Budget Duration"}),(0,t.jsx)(i.Text,{children:A.litellm_budget_table.budget_duration})]}),void 0!==A.litellm_budget_table.tpm_limit&&null!==A.litellm_budget_table.tpm_limit&&(0,t.jsxs)("div",{children:[(0,t.jsx)(i.Text,{className:"font-medium",children:"TPM Limit"}),(0,t.jsx)(i.Text,{children:A.litellm_budget_table.tpm_limit.toLocaleString()})]}),void 0!==A.litellm_budget_table.rpm_limit&&null!==A.litellm_budget_table.rpm_limit&&(0,t.jsxs)("div",{children:[(0,t.jsx)(i.Text,{className:"font-medium",children:"RPM Limit"}),(0,t.jsx)(i.Text,{children:A.litellm_budget_table.rpm_limit.toLocaleString()})]})]})]})]})]}):(0,t.jsx)("div",{children:"Loading..."})};var A=e.i(871943),P=e.i(360820),D=e.i(591935),M=e.i(94629),B=e.i(68155),O=e.i(152990),F=e.i(682830),R=e.i(269200),L=e.i(942232),z=e.i(977572),U=e.i(427612),H=e.i(64848),V=e.i(496020);let $="This is just a spend tag that was passed dynamically in a request. It does not control any LLM models.",q=({data:e,onEdit:r,onDelete:n,onSelectTag:o})=>{let[c,d]=l.default.useState([{id:"created_at",desc:!0}]),m=[{header:"Tag Name",accessorKey:"name",cell:({row:e})=>{let l=e.original,a=l.description===$;return(0,t.jsx)("div",{className:"overflow-hidden",children:(0,t.jsx)(b.Tooltip,{title:a?"You cannot view the information of a dynamically generated spend tag":l.name,children:(0,t.jsx)(s.Button,{size:"xs",variant:"light",className:"font-mono text-blue-500 bg-blue-50 hover:bg-blue-100 text-xs font-normal px-2 py-0.5",onClick:()=>o(l.name),disabled:a,children:l.name})})})}},{header:"Description",accessorKey:"description",cell:({row:e})=>{let l=e.original;return(0,t.jsx)(b.Tooltip,{title:l.description,children:(0,t.jsx)("span",{className:"text-xs",children:l.description||"-"})})}},{header:"Allowed Models",accessorKey:"models",cell:({row:e})=>{let l=e.original;return(0,t.jsx)("div",{style:{display:"flex",flexDirection:"column"},children:l?.models?.length===0?(0,t.jsx)(u.Badge,{size:"xs",className:"mb-1",color:"red",children:"All Models"}):l?.models?.map(e=>(0,t.jsx)(u.Badge,{size:"xs",className:"mb-1",color:"blue",children:(0,t.jsx)(b.Tooltip,{title:`ID: ${e}`,children:(0,t.jsx)(i.Text,{children:l.model_info?.[e]||e})})},e))})}},{header:"Created",accessorKey:"created_at",sortingFn:"datetime",cell:({row:e})=>{let l=e.original;return(0,t.jsx)("span",{className:"text-xs",children:new Date(l.created_at).toLocaleDateString()})}},{id:"actions",header:"Actions",cell:({row:e})=>{let l=e.original,s=l.description===$;return(0,t.jsxs)("div",{className:"flex space-x-2",children:[s?(0,t.jsx)(b.Tooltip,{title:"Dynamically generated spend tags cannot be edited",children:(0,t.jsx)(a.Icon,{icon:D.PencilAltIcon,size:"sm",className:"opacity-50 cursor-not-allowed","aria-label":"Edit tag (disabled)"})}):(0,t.jsx)(b.Tooltip,{title:"Edit tag",children:(0,t.jsx)(a.Icon,{icon:D.PencilAltIcon,size:"sm",onClick:()=>r(l),className:"cursor-pointer hover:text-blue-500"})}),s?(0,t.jsx)(b.Tooltip,{title:"Dynamically generated spend tags cannot be deleted",children:(0,t.jsx)(a.Icon,{icon:B.TrashIcon,size:"sm",className:"opacity-50 cursor-not-allowed","aria-label":"Delete tag (disabled)"})}):(0,t.jsx)(b.Tooltip,{title:"Delete tag",children:(0,t.jsx)(a.Icon,{icon:B.TrashIcon,size:"sm",onClick:()=>n(l.name),className:"cursor-pointer hover:text-red-500"})})]})}}],h=(0,O.useReactTable)({data:e,columns:m,state:{sorting:c},onSortingChange:d,getCoreRowModel:(0,F.getCoreRowModel)(),getSortedRowModel:(0,F.getSortedRowModel)(),enableSorting:!0});return(0,t.jsx)("div",{className:"rounded-lg custom-border relative",children:(0,t.jsx)("div",{className:"overflow-x-auto",children:(0,t.jsxs)(R.Table,{className:"[&_td]:py-0.5 [&_th]:py-1",children:[(0,t.jsx)(U.TableHead,{children:h.getHeaderGroups().map(e=>(0,t.jsx)(V.TableRow,{children:e.headers.map(e=>(0,t.jsx)(H.TableHeaderCell,{className:`py-1 h-8 ${"actions"===e.id?"sticky right-0 bg-white shadow-[-4px_0_8px_-6px_rgba(0,0,0,0.1)]":""}`,onClick:e.column.getToggleSortingHandler(),children:(0,t.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,t.jsx)("div",{className:"flex items-center",children:e.isPlaceholder?null:(0,O.flexRender)(e.column.columnDef.header,e.getContext())}),"actions"!==e.id&&(0,t.jsx)("div",{className:"w-4",children:e.column.getIsSorted()?({asc:(0,t.jsx)(P.ChevronUpIcon,{className:"h-4 w-4 text-blue-500"}),desc:(0,t.jsx)(A.ChevronDownIcon,{className:"h-4 w-4 text-blue-500"})})[e.column.getIsSorted()]:(0,t.jsx)(M.SwitchVerticalIcon,{className:"h-4 w-4 text-gray-400"})})]})},e.id))},e.id))}),(0,t.jsx)(L.TableBody,{children:h.getRowModel().rows.length>0?h.getRowModel().rows.map(e=>(0,t.jsx)(V.TableRow,{className:"h-8",children:e.getVisibleCells().map(e=>(0,t.jsx)(z.TableCell,{className:`py-0.5 max-h-8 overflow-hidden text-ellipsis whitespace-nowrap ${"actions"===e.column.id?"sticky right-0 bg-white shadow-[-4px_0_8px_-6px_rgba(0,0,0,0.1)]":""}`,children:(0,O.flexRender)(e.column.columnDef.cell,e.getContext())},e.id))},e.id)):(0,t.jsx)(V.TableRow,{children:(0,t.jsx)(z.TableCell,{colSpan:m.length,className:"h-8 text-center",children:(0,t.jsx)("div",{className:"text-center text-gray-500",children:(0,t.jsx)("p",{children:"No tags found"})})})})})]})})})};var K=e.i(779241),G=e.i(212931);let W=({visible:e,onCancel:l,onSubmit:a,availableModels:r})=>{let[i]=x.Form.useForm();return(0,t.jsx)(G.Modal,{title:"Create New Tag",open:e,width:800,footer:null,onCancel:()=>{i.resetFields(),l()},children:(0,t.jsxs)(x.Form,{form:i,onFinish:e=>{a(e),i.resetFields()},labelCol:{span:8},wrapperCol:{span:16},labelAlign:"left",children:[(0,t.jsx)(x.Form.Item,{label:"Tag Name",name:"tag_name",rules:[{required:!0,message:"Please input a tag name"}],children:(0,t.jsx)(K.TextInput,{})}),(0,t.jsx)(x.Form.Item,{label:"Description",name:"description",children:(0,t.jsx)(p.Input.TextArea,{rows:4})}),(0,t.jsx)(x.Form.Item,{label:(0,t.jsxs)("span",{children:["Allowed Models",(0,t.jsx)(b.Tooltip,{title:"Select which models are allowed to process requests from this tag",children:(0,t.jsx)(y.InfoCircleOutlined,{style:{marginLeft:"4px"}})})]}),name:"allowed_llms",children:(0,t.jsx)(f.Select,{mode:"multiple",placeholder:"Select Models",children:r.map(e=>(0,t.jsx)(f.Select.Option,{value:e.model_info.id,children:(0,t.jsxs)("div",{children:[(0,t.jsx)("span",{children:e.model_name}),(0,t.jsxs)("span",{className:"text-gray-400 ml-2",children:["(",e.model_info.id,")"]})]})},e.model_info.id))})}),(0,t.jsxs)(m.Accordion,{className:"mt-4 mb-4",children:[(0,t.jsx)(h.AccordionHeader,{children:(0,t.jsx)(d.Title,{className:"m-0",children:"Budget & Rate Limits (Optional)"})}),(0,t.jsxs)(g.AccordionBody,{children:[(0,t.jsx)(x.Form.Item,{className:"mt-4",label:(0,t.jsxs)("span",{children:["Max Budget (USD)"," ",(0,t.jsx)(b.Tooltip,{title:"Maximum amount in USD this tag can spend. When reached, requests with this tag will be blocked",children:(0,t.jsx)(y.InfoCircleOutlined,{style:{marginLeft:"4px"}})})]}),name:"max_budget",children:(0,t.jsx)(N.default,{step:.01,precision:2,width:200})}),(0,t.jsx)(x.Form.Item,{className:"mt-4",label:(0,t.jsxs)("span",{children:["Reset Budget"," ",(0,t.jsx)(b.Tooltip,{title:"How often the budget should reset. For example, setting 'daily' will reset the budget every 24 hours",children:(0,t.jsx)(y.InfoCircleOutlined,{style:{marginLeft:"4px"}})})]}),name:"budget_duration",children:(0,t.jsx)(k.default,{onChange:e=>i.setFieldValue("budget_duration",e)})}),(0,t.jsx)("div",{className:"mt-4 p-3 bg-gray-50 rounded-md border border-gray-200",children:(0,t.jsxs)("p",{className:"text-sm text-gray-600",children:["TPM/RPM limits for tags are not currently supported. If you need this feature, please"," ",(0,t.jsx)("a",{href:"https://github.com/BerriAI/litellm/issues/new",target:"_blank",rel:"noopener noreferrer",className:"text-blue-600 hover:text-blue-800 underline",children:"create a GitHub issue"}),"."]})})]})]}),(0,t.jsx)("div",{style:{textAlign:"right",marginTop:"10px"},children:(0,t.jsx)(s.Button,{type:"submit",children:"Create Tag"})})]})})};e.s(["default",0,({accessToken:e,userID:c,userRole:d})=>{let[u,m]=(0,l.useState)([]),[h,g]=(0,l.useState)(!1),[x,p]=(0,l.useState)(null),[f,b]=(0,l.useState)(!1),[y,j]=(0,l.useState)(!1),[v,N]=(0,l.useState)(null),[k,C]=(0,l.useState)(""),[S,T]=(0,l.useState)([]),I=async()=>{if(e)try{let t=await (0,w.tagListCall)(e);console.log("List tags response:",t),m(Object.values(t))}catch(e){console.error("Error fetching tags:",e),_.default.fromBackend("Error fetching tags: "+e)}},A=async t=>{if(e)try{await (0,w.tagCreateCall)(e,{name:t.tag_name,description:t.description,models:t.allowed_llms,max_budget:t.max_budget,soft_budget:t.soft_budget,tpm_limit:t.tpm_limit,rpm_limit:t.rpm_limit,budget_duration:t.budget_duration}),_.default.success("Tag created successfully"),g(!1),I()}catch(e){console.error("Error creating tag:",e),_.default.fromBackend("Error creating tag: "+e)}},P=async e=>{N(e),j(!0)},D=async()=>{if(e&&v){try{await (0,w.tagDeleteCall)(e,v),_.default.success("Tag deleted successfully"),I()}catch(e){console.error("Error deleting tag:",e),_.default.fromBackend("Error deleting tag: "+e)}j(!1),N(null)}};return(0,l.useEffect)(()=>{c&&d&&e&&(async()=>{try{let t=await (0,w.modelInfoCall)(e,c,d);t&&t.data&&T(t.data)}catch(e){console.error("Error fetching models:",e),_.default.fromBackend("Error fetching models: "+e)}})()},[e,c,d]),(0,l.useEffect)(()=>{I()},[e]),(0,t.jsx)("div",{className:"w-full mx-4 h-[75vh]",children:x?(0,t.jsx)(E,{tagId:x,onClose:()=>{p(null),b(!1)},accessToken:e,is_admin:"Admin"===d,editTag:f}):(0,t.jsxs)("div",{className:"gap-2 p-8 h-[75vh] w-full mt-2",children:[(0,t.jsxs)("div",{className:"flex justify-between mt-2 w-full items-center mb-4",children:[(0,t.jsx)("h1",{children:"Tag Management"}),(0,t.jsxs)("div",{className:"flex items-center space-x-2",children:[k&&(0,t.jsxs)(i.Text,{children:["Last Refreshed: ",k]}),(0,t.jsx)(a.Icon,{icon:o.RefreshIcon,variant:"shadow",size:"xs",className:"self-center cursor-pointer",onClick:()=>{I(),C(new Date().toLocaleString())}})]})]}),(0,t.jsxs)(i.Text,{className:"mb-4",children:["Click on a tag name to view and edit its details.",(0,t.jsxs)("p",{children:["You can use tags to restrict the usage of certain LLMs based on tags passed in the request. Read more about tag routing"," ",(0,t.jsx)("a",{href:"https://docs.litellm.ai/docs/proxy/tag_routing",target:"_blank",rel:"noopener noreferrer",children:"here"}),"."]})]}),(0,t.jsx)(s.Button,{className:"mb-4",onClick:()=>g(!0),children:"+ Create New Tag"}),(0,t.jsx)(n.Grid,{numItems:1,className:"gap-2 pt-2 pb-2 h-[75vh] w-full mt-2",children:(0,t.jsx)(r.Col,{numColSpan:1,children:(0,t.jsx)(q,{data:u,onEdit:e=>{p(e.name),b(!0)},onDelete:P,onSelectTag:p})})}),(0,t.jsx)(W,{visible:h,onCancel:()=>g(!1),onSubmit:A,availableModels:S}),y&&(0,t.jsx)("div",{className:"fixed z-10 inset-0 overflow-y-auto",children:(0,t.jsxs)("div",{className:"flex items-end justify-center min-h-screen pt-4 px-4 pb-20 text-center sm:block sm:p-0",children:[(0,t.jsx)("div",{className:"fixed inset-0 transition-opacity","aria-hidden":"true",children:(0,t.jsx)("div",{className:"absolute inset-0 bg-gray-500 opacity-75"})}),(0,t.jsxs)("div",{className:"inline-block align-bottom bg-white rounded-lg text-left overflow-hidden shadow-xl transform transition-all sm:my-8 sm:align-middle sm:max-w-lg sm:w-full",children:[(0,t.jsx)("div",{className:"bg-white px-4 pt-5 pb-4 sm:p-6 sm:pb-4",children:(0,t.jsx)("div",{className:"sm:flex sm:items-start",children:(0,t.jsxs)("div",{className:"mt-3 text-center sm:mt-0 sm:ml-4 sm:text-left",children:[(0,t.jsx)("h3",{className:"text-lg leading-6 font-medium text-gray-900",children:"Delete Tag"}),(0,t.jsx)("div",{className:"mt-2",children:(0,t.jsx)("p",{className:"text-sm text-gray-500",children:"Are you sure you want to delete this tag?"})})]})})}),(0,t.jsxs)("div",{className:"bg-gray-50 px-4 py-3 sm:px-6 sm:flex sm:flex-row-reverse",children:[(0,t.jsx)(s.Button,{onClick:D,color:"red",className:"ml-2",children:"Delete"}),(0,t.jsx)(s.Button,{onClick:()=>{j(!1),N(null)},children:"Cancel"})]})]})]})})]})})}],345244)},368670,e=>{"use strict";var t=e.i(764205),l=e.i(266027);let a=(0,e.i(243652).createQueryKeys)("modelCostMap");e.s(["useModelCostMap",0,()=>(0,l.useQuery)({queryKey:a.list({}),queryFn:async()=>await (0,t.modelCostMap)(),staleTime:6e4,gcTime:6e4})])},226898,972520,e=>{"use strict";var t=e.i(843476),l=e.i(271645),a=e.i(304967),s=e.i(269200),r=e.i(427612),i=e.i(496020),n=e.i(389083),o=e.i(64848),c=e.i(977572),d=e.i(942232),u=e.i(599724),m=e.i(994388),h=e.i(752978),g=e.i(793130),x=e.i(404206),p=e.i(723731),f=e.i(653824),b=e.i(881073),y=e.i(197647),j=e.i(764205),v=e.i(28651),w=e.i(68155),_=e.i(220508),N=e.i(727749),k=e.i(158392);let C=({accessToken:e,userRole:a,userID:s,modelData:r})=>{let[i,n]=(0,l.useState)({routerSettings:{},selectedStrategy:null,enableTagFiltering:!1}),[o,c]=(0,l.useState)([]),[d,u]=(0,l.useState)({}),[h,g]=(0,l.useState)({});return((0,l.useEffect)(()=>{e&&a&&s&&((0,j.getCallbacksCall)(e,s,a).then(e=>{console.log("callbacks",e);let t=e.router_settings;"model_group_retry_policy"in t&&delete t.model_group_retry_policy;let l=t.routing_strategy||null;n(e=>({...e,routerSettings:t,selectedStrategy:l}))}),(0,j.getRouterSettingsCall)(e).then(e=>{if(console.log("router settings from API",e),e.fields){let t={};e.fields.forEach(e=>{t[e.field_name]={ui_field_name:e.ui_field_name,field_description:e.field_description,options:e.options,link:e.link}}),u(t);let l=e.fields.find(e=>"routing_strategy"===e.field_name);l?.options&&c(l.options),e.routing_strategy_descriptions&&g(e.routing_strategy_descriptions);let a=e.fields.find(e=>"enable_tag_filtering"===e.field_name);a?.field_value!==null&&a?.field_value!==void 0&&n(e=>({...e,enableTagFiltering:a.field_value}))}}))},[e,a,s]),e)?(0,t.jsxs)("div",{className:"w-full",children:[(0,t.jsx)(k.default,{value:i,onChange:n,routerFieldsMetadata:d,availableRoutingStrategies:o,routingStrategyDescriptions:h}),(0,t.jsxs)("div",{className:"border-t border-gray-200 pt-6 flex justify-end gap-3",children:[(0,t.jsx)(m.Button,{variant:"secondary",size:"sm",onClick:()=>window.location.reload(),className:"text-sm",children:"Reset"}),(0,t.jsx)(m.Button,{size:"sm",onClick:()=>{if(!e)return;let t=i.routerSettings;console.log("router_settings",t);let l=new Set(["allowed_fails","cooldown_time","num_retries","timeout","retry_after"]),a=new Set(["model_group_alias","retry_policy"]),s=Object.fromEntries(Object.entries({...t,enable_tag_filtering:i.enableTagFiltering}).map(([e,t])=>{if("routing_strategy_args"!==e&&"routing_strategy"!==e&&"enable_tag_filtering"!==e){let s=document.querySelector(`input[name="${e}"]`),r=((e,t,s)=>{if(void 0===t)return s;let r=t.trim();if("null"===r.toLowerCase())return null;if(l.has(e)){let e=Number(r);return Number.isNaN(e)?s:e}if(a.has(e)){if(""===r)return null;try{return JSON.parse(r)}catch{return s}}return"true"===r.toLowerCase()||"false"!==r.toLowerCase()&&r})(e,s?.value,t);return[e,r]}if("routing_strategy"===e)return[e,i.selectedStrategy];if("enable_tag_filtering"===e)return[e,i.enableTagFiltering];if("routing_strategy_args"===e&&"latency-based-routing"===i.selectedStrategy){let e={},t=document.querySelector('input[name="lowest_latency_buffer"]'),l=document.querySelector('input[name="ttl"]');return t?.value&&(e.lowest_latency_buffer=Number(t.value)),l?.value&&(e.ttl=Number(l.value)),console.log(`setRoutingStrategyArgs: ${e}`),["routing_strategy_args",e]}return null}).filter(e=>null!=e));console.log("updatedVariables",s);try{(0,j.setCallbacksCall)(e,{router_settings:s})}catch(e){N.default.fromBackend("Failed to update router settings: "+e)}N.default.success("router settings updated successfully")},className:"text-sm font-medium",children:"Save Changes"})]})]}):null};e.i(247167);var S=e.i(368670);let T=l.forwardRef(function(e,t){return l.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:t},e),l.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M14 5l7 7m0 0l-7 7m7-7H3"}))});var I=e.i(122577),E=e.i(592968),A=e.i(898586),P=e.i(356449),D=e.i(127952),M=e.i(418371),B=e.i(464571),O=e.i(888259),F=e.i(689020),R=e.i(212931);let L=(0,e.i(475254).default)("arrow-right",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]);function z({open:e,onCancel:l,children:a}){return(0,t.jsx)(R.Modal,{title:(0,t.jsx)("div",{className:"pb-4 border-b border-gray-100",children:(0,t.jsxs)("div",{className:"flex items-center gap-2 text-gray-800",children:[(0,t.jsx)("div",{className:"p-2 bg-indigo-50 rounded-lg",children:(0,t.jsx)(L,{className:"w-5 h-5 text-indigo-600"})}),(0,t.jsxs)("div",{children:[(0,t.jsx)("h2",{className:"text-lg font-bold m-0",children:"Configure Model Fallbacks"}),(0,t.jsx)("p",{className:"text-sm text-gray-500 font-normal m-0",children:"Manage multiple fallback chains for different models (up to 5 groups at a time)"})]})]})}),open:e,width:900,footer:null,onCancel:l,maskClosable:!1,className:"top-8",styles:{body:{padding:"24px"},header:{padding:"24px 24px 0 24px",border:"none"}},children:(0,t.jsx)("div",{className:"mt-6",children:a})})}e.s(["ArrowRight",()=>L],972520);var U=e.i(419470);function H({models:e,accessToken:a,value:s=[],onChange:r}){let[i,n]=(0,l.useState)(!1),[o,c]=(0,l.useState)([]),[d,u]=(0,l.useState)(0),[h,g]=(0,l.useState)(!1),[x,p]=(0,l.useState)([{id:"1",primaryModel:null,fallbackModels:[]}]);(0,l.useEffect)(()=>{i&&(p([{id:"1",primaryModel:null,fallbackModels:[]}]),u(e=>e+1))},[i]),(0,l.useEffect)(()=>{let e=async()=>{try{let e=await (0,F.fetchAvailableModels)(a);console.log("Fetched models for fallbacks:",e),c(e)}catch(e){console.error("Error fetching model info for fallbacks:",e)}};i&&e()},[a,i]);let f=Array.from(new Set(o.map(e=>e.model_group))).sort(),b=()=>{n(!1),p([{id:"1",primaryModel:null,fallbackModels:[]}])},y=async()=>{let e=x.filter(e=>!e.primaryModel||0===e.fallbackModels.length);if(e.length>0)return void O.default.error(`Please complete configuration for all groups. ${e.length} group(s) incomplete.`);let t=[...s||[],...x.map(e=>({[e.primaryModel]:e.fallbackModels}))];if(r){g(!0);try{await r(t),N.default.success(`${x.length} fallback configuration(s) added successfully!`),b()}catch(e){console.error("Error saving fallbacks:",e)}finally{g(!1)}}else N.default.fromBackend("onChange callback not provided")};return(0,t.jsxs)("div",{children:[(0,t.jsx)(m.Button,{className:"mx-auto",onClick:()=>n(!0),icon:()=>(0,t.jsx)("span",{className:"mr-1",children:"+"}),children:"Add Fallbacks"}),(0,t.jsxs)(z,{open:i,onCancel:b,children:[(0,t.jsx)(U.FallbackSelectionForm,{groups:x,onGroupsChange:p,availableModels:f,maxFallbacks:10,maxGroups:5},d),x.length>0&&(0,t.jsxs)("div",{className:"flex items-center justify-end space-x-3 pt-6 mt-6 border-t border-gray-100",children:[(0,t.jsx)(B.Button,{type:"default",onClick:b,disabled:h,children:"Cancel"}),(0,t.jsx)(B.Button,{type:"default",onClick:y,disabled:0===x.length||h,loading:h,children:h?"Saving Configuration...":"Save All Configurations"})]})]})]})}let V="inline-flex items-center gap-2 px-2.5 py-1 rounded-md border border-gray-200 bg-gray-50 text-sm font-medium text-gray-800 shrink-0";async function $(e,l){console.log=function(){};let a=window.location.origin,s=new P.default.OpenAI({apiKey:l,baseURL:a,dangerouslyAllowBrowser:!0});try{N.default.info("Testing fallback model response...");let l=await s.chat.completions.create({model:e,messages:[{role:"user",content:"Hi, this is a test message"}],mock_testing_fallbacks:!0});N.default.success((0,t.jsxs)("span",{children:["Test model=",(0,t.jsx)("strong",{children:e}),", received model=",(0,t.jsx)("strong",{children:l.model}),". See"," ",(0,t.jsx)("a",{href:"#",onClick:()=>window.open("https://docs.litellm.ai/docs/proxy/reliability","_blank"),style:{textDecoration:"underline",color:"blue"},children:"curl"})]}))}catch(e){N.default.fromBackend(`Error occurred while generating model response. Please try again. Error: ${e}`)}}let q=({accessToken:e,userRole:a,userID:n,modelData:u})=>{let[m,g]=(0,l.useState)({}),[x,p]=(0,l.useState)(!1),[f,b]=(0,l.useState)(null),[y,v]=(0,l.useState)(!1),{data:_}=(0,S.useModelCostMap)(),k=e=>null!=_&&"object"==typeof _&&e in _?_[e].litellm_provider??"":"";(0,l.useEffect)(()=>{e&&a&&n&&(0,j.getCallbacksCall)(e,n,a).then(e=>{console.log("callbacks",e);let t=e.router_settings;"model_group_retry_policy"in t&&delete t.model_group_retry_policy,g(t)})},[e,a,n]);let C=e=>{b(e),v(!0)},P=async()=>{if(!f||!e)return;let t=Object.keys(f)[0];if(!t)return;p(!0);let l=m.fallbacks.map(e=>{let l={...e};return t in l&&Array.isArray(l[t])&&delete l[t],l}).filter(e=>Object.keys(e).length>0),a={...m,fallbacks:l};try{await (0,j.setCallbacksCall)(e,{router_settings:a}),g(a),N.default.success("Router settings updated successfully")}catch(e){N.default.fromBackend("Failed to update router settings: "+e)}finally{p(!1),v(!1),b(null)}};if(!e)return null;let B=async t=>{if(!e)return;let l={...m,fallbacks:t};try{await (0,j.setCallbacksCall)(e,{router_settings:l}),g(l)}catch(t){throw N.default.fromBackend("Failed to update router settings: "+t),e&&a&&n&&(0,j.getCallbacksCall)(e,n,a).then(e=>{let t=e.router_settings;"model_group_retry_policy"in t&&delete t.model_group_retry_policy,g(t)}),t}},O=Array.isArray(m.fallbacks)&&m.fallbacks.length>0;return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(H,{models:u?.data?u.data.map(e=>e.model_name):[],accessToken:e||"",value:m.fallbacks||[],onChange:B}),O?(0,t.jsxs)(s.Table,{children:[(0,t.jsx)(r.TableHead,{children:(0,t.jsxs)(i.TableRow,{children:[(0,t.jsx)(o.TableHeaderCell,{children:"Model Name"}),(0,t.jsx)(o.TableHeaderCell,{children:"Fallbacks"}),(0,t.jsx)(o.TableHeaderCell,{children:"Actions"})]})}),(0,t.jsx)(d.TableBody,{children:m.fallbacks.map((a,s)=>Object.entries(a).map(([r,n])=>{let o;return(0,t.jsxs)(i.TableRow,{children:[(0,t.jsx)(c.TableCell,{className:"align-top",children:(o=k?.(r)??r,(0,t.jsxs)("span",{className:V,children:[(0,t.jsx)(M.ProviderLogo,{provider:o,className:"w-4 h-4 shrink-0"}),(0,t.jsx)("span",{children:r})]}))}),(0,t.jsx)(c.TableCell,{className:"align-top",children:function(e,a,s){let r=Array.isArray(a)?a:[];if(0===r.length)return null;let i=({modelName:e})=>{let l=s?.(e)??e;return(0,t.jsxs)("span",{className:V,children:[(0,t.jsx)(M.ProviderLogo,{provider:l,className:"w-4 h-4 shrink-0"}),(0,t.jsx)("span",{children:e})]})};return(0,t.jsxs)("span",{className:"grid grid-cols-[auto_1fr] items-start gap-x-2 w-full min-w-0",children:[(0,t.jsx)("span",{className:"inline-flex items-center justify-center w-8 h-8 shrink-0 self-start text-blue-600","aria-hidden":!0,children:(0,t.jsx)(T,{className:"w-5 h-5 stroke-[2.5]"})}),(0,t.jsx)("span",{className:"flex flex-wrap items-start gap-1 min-w-0",children:r.map((e,a)=>(0,t.jsxs)(l.default.Fragment,{children:[a>0&&(0,t.jsx)(h.Icon,{icon:T,size:"xs",className:"shrink-0 text-gray-400"}),(0,t.jsx)(i,{modelName:e})]},e))})]})}(0,Array.isArray(n)?n:[],k)}),(0,t.jsxs)(c.TableCell,{className:"align-top",children:[(0,t.jsx)(E.Tooltip,{title:"Test fallback",children:(0,t.jsx)(h.Icon,{icon:I.PlayIcon,size:"sm",onClick:()=>$(Object.keys(a)[0],e||""),className:"cursor-pointer hover:text-blue-600"})}),(0,t.jsx)(E.Tooltip,{title:"Delete fallback",children:(0,t.jsx)("span",{"data-testid":"delete-fallback-button",role:"button",tabIndex:0,onClick:()=>C(a),onKeyDown:e=>"Enter"===e.key&&C(a),className:"cursor-pointer inline-flex",children:(0,t.jsx)(h.Icon,{icon:w.TrashIcon,size:"sm",className:"hover:text-red-600"})})})]})]},s.toString()+r)}))})]}):(0,t.jsx)("div",{className:"rounded-lg border border-gray-200 bg-gray-50 px-4 py-6 text-center",children:(0,t.jsx)(A.Typography.Text,{type:"secondary",children:"No fallbacks configured. Add fallbacks to automatically try another model when the primary fails."})}),(0,t.jsx)(D.default,{isOpen:y,title:"Delete Fallback?",message:"Are you sure you want to delete this fallback? This action cannot be undone.",resourceInformationTitle:"Fallback Information",resourceInformation:[{label:"Model Name",value:f?Object.keys(f)[0]:"",code:!0}],onCancel:()=>{v(!1),b(null)},onOk:P,confirmLoading:x})]})};e.s(["default",0,({accessToken:e,userRole:N,userID:k,modelData:S})=>{let[T,I]=(0,l.useState)([]);(0,l.useEffect)(()=>{e&&(0,j.getGeneralSettingsCall)(e).then(e=>{I(e)})},[e]);let E=(e,t)=>{I(T.map(l=>l.field_name===e?{...l,field_value:t}:l))};return e?(0,t.jsx)("div",{className:"w-full",children:(0,t.jsxs)(f.TabGroup,{className:"h-[75vh] w-full",children:[(0,t.jsxs)(b.TabList,{variant:"line",defaultValue:"1",className:"px-8 pt-4",children:[(0,t.jsx)(y.Tab,{value:"1",children:"Loadbalancing"}),(0,t.jsx)(y.Tab,{value:"2",children:"Fallbacks"}),(0,t.jsx)(y.Tab,{value:"3",children:"General"})]}),(0,t.jsxs)(p.TabPanels,{className:"px-8 py-6",children:[(0,t.jsx)(x.TabPanel,{children:(0,t.jsx)(C,{accessToken:e,userRole:N,userID:k,modelData:S})}),(0,t.jsx)(x.TabPanel,{children:(0,t.jsx)(q,{accessToken:e,userRole:N,userID:k,modelData:S})}),(0,t.jsx)(x.TabPanel,{children:(0,t.jsx)(a.Card,{children:(0,t.jsxs)(s.Table,{children:[(0,t.jsx)(r.TableHead,{children:(0,t.jsxs)(i.TableRow,{children:[(0,t.jsx)(o.TableHeaderCell,{children:"Setting"}),(0,t.jsx)(o.TableHeaderCell,{children:"Value"}),(0,t.jsx)(o.TableHeaderCell,{children:"Status"}),(0,t.jsx)(o.TableHeaderCell,{children:"Action"})]})}),(0,t.jsx)(d.TableBody,{children:T.filter(e=>"TypedDictionary"!==e.field_type).map((l,a)=>(0,t.jsxs)(i.TableRow,{children:[(0,t.jsxs)(c.TableCell,{children:[(0,t.jsx)(u.Text,{children:l.field_name}),(0,t.jsx)("p",{style:{fontSize:"0.65rem",color:"#808080",fontStyle:"italic"},className:"mt-1",children:l.field_description})]}),(0,t.jsx)(c.TableCell,{children:"Integer"==l.field_type?(0,t.jsx)(v.InputNumber,{step:1,value:l.field_value,onChange:e=>E(l.field_name,e)}):"Boolean"==l.field_type?(0,t.jsx)(g.Switch,{checked:!0===l.field_value||"true"===l.field_value,onChange:e=>E(l.field_name,e)}):null}),(0,t.jsx)(c.TableCell,{children:!0==l.stored_in_db?(0,t.jsx)(n.Badge,{icon:_.CheckCircleIcon,className:"text-white",children:"In DB"}):!1==l.stored_in_db?(0,t.jsx)(n.Badge,{className:"text-gray bg-white outline",children:"In Config"}):(0,t.jsx)(n.Badge,{className:"text-gray bg-white outline",children:"Not Set"})}),(0,t.jsxs)(c.TableCell,{children:[(0,t.jsx)(m.Button,{onClick:()=>((t,l)=>{if(!e)return;let a=T[l].field_value;if(null!=a&&void 0!=a)try{(0,j.updateConfigFieldSetting)(e,t,a);let l=T.map(e=>e.field_name===t?{...e,stored_in_db:!0}:e);I(l)}catch(e){}})(l.field_name,a),children:"Update"}),(0,t.jsx)(h.Icon,{icon:w.TrashIcon,color:"red",onClick:()=>((t,l)=>{if(e)try{(0,j.deleteConfigFieldSetting)(e,t);let l=T.map(e=>e.field_name===t?{...e,stored_in_db:null,field_value:null}:e);I(l)}catch(e){}})(l.field_name,0),children:"Reset"})]})]},a))})]})})})]})]})}):null}],226898)},566606,e=>{"use strict";var t=e.i(843476),l=e.i(271645),a=e.i(618566),s=e.i(947293),r=e.i(764205),i=e.i(954616),n=e.i(266027),o=e.i(612256);let c=(0,e.i(243652).createQueryKeys)("onboarding");var d=e.i(482725),u=e.i(56456);function m(){return(0,t.jsx)("div",{className:"mx-auto w-full max-w-md mt-10 flex justify-center",children:(0,t.jsx)(d.Spin,{indicator:(0,t.jsx)(u.LoadingOutlined,{spin:!0}),size:"large"})})}var h=e.i(560445),g=e.i(464571);function x(){return(0,t.jsxs)("div",{className:"mx-auto w-full max-w-md mt-10",children:[(0,t.jsx)(h.Alert,{type:"error",message:"Failed to load invitation",description:"The invitation link may be invalid or expired.",showIcon:!0}),(0,t.jsx)("div",{className:"mt-4",children:(0,t.jsx)(g.Button,{href:"/ui/login",children:"Back to Login"})})]})}var p=e.i(175712),f=e.i(808613),b=e.i(311451),y=e.i(898586);function j({variant:e,userEmail:a,isPending:s,claimError:r,onSubmit:i}){let[n]=f.Form.useForm();return l.default.useEffect(()=>{a&&n.setFieldValue("user_email",a)},[a,n]),(0,t.jsx)("div",{className:"mx-auto w-full max-w-md mt-10",children:(0,t.jsxs)(p.Card,{children:[(0,t.jsx)(y.Typography.Title,{level:5,className:"text-center mb-5",children:"🚅 LiteLLM"}),(0,t.jsx)(y.Typography.Title,{level:3,children:"reset_password"===e?"Reset Password":"Sign Up"}),(0,t.jsx)(y.Typography.Text,{children:"reset_password"===e?"Reset your password to access Admin UI.":"Claim your user account to login to Admin UI."}),"signup"===e&&(0,t.jsx)(h.Alert,{className:"mt-4",type:"info",message:"SSO",description:(0,t.jsxs)("div",{className:"flex justify-between items-center",children:[(0,t.jsx)("span",{children:"SSO is under the Enterprise Tier."}),(0,t.jsx)(g.Button,{type:"primary",size:"small",href:"https://forms.gle/W3U4PZpJGFHWtHyA9",target:"_blank",children:"Get Free Trial"})]}),showIcon:!0}),(0,t.jsxs)(f.Form,{className:"mt-10 mb-5",layout:"vertical",form:n,onFinish:e=>i({password:e.password}),children:[(0,t.jsx)(f.Form.Item,{label:"Email Address",name:"user_email",children:(0,t.jsx)(b.Input,{type:"email",disabled:!0})}),(0,t.jsx)(f.Form.Item,{label:"Password",name:"password",rules:[{required:!0,message:"password required to sign up"}],help:"reset_password"===e?"Enter your new password":"Create a password for your account",children:(0,t.jsx)(b.Input.Password,{})}),r&&(0,t.jsx)(h.Alert,{type:"error",message:r,showIcon:!0,className:"mb-4"}),(0,t.jsx)("div",{className:"mt-10",children:(0,t.jsx)(g.Button,{htmlType:"submit",loading:s,children:"reset_password"===e?"Reset Password":"Sign Up"})})]})]})})}function v({variant:e}){let d=(0,a.useSearchParams)().get("invitation_id"),[u,h]=l.default.useState(null),{data:g,isLoading:p,isError:f}=(e=>{let{isLoading:t}=(0,o.useUIConfig)();return(0,n.useQuery)({queryKey:c.detail(e??""),queryFn:async()=>{if(!e)throw Error("inviteId is required");return(0,r.getOnboardingCredentials)(e)},enabled:!!e&&!t})})(d),{mutate:b,isPending:y}=(0,i.useMutation)({mutationFn:async({accessToken:e,inviteId:t,userId:l,password:a})=>await (0,r.claimOnboardingToken)(e,t,l,a)}),v=g?.token?(0,s.jwtDecode)(g.token):null,w=v?.user_email??"",_=v?.user_id??null,N=v?.key??null,k=g?.token??null;return p?(0,t.jsx)(m,{}):f?(0,t.jsx)(x,{}):(0,t.jsx)(j,{variant:e,userEmail:w,isPending:y,claimError:u,onSubmit:e=>{N&&k&&_&&d&&(h(null),b({accessToken:N,inviteId:d,userId:_,password:e.password},{onSuccess:()=>{document.cookie=`token=${k}; path=/; SameSite=Lax`;let e=(0,r.getProxyBaseUrl)();window.location.href=e?`${e}/ui/?login=success`:"/ui/?login=success"},onError:e=>{h(e.message||"Failed to submit. Please try again.")}}))}})}function w(){let e=(0,a.useSearchParams)().get("action");return(0,t.jsx)(v,{variant:"reset_password"===e?"reset_password":"signup"})}function _(){return(0,t.jsx)(l.Suspense,{fallback:(0,t.jsx)("div",{className:"flex items-center justify-center min-h-screen",children:"Loading..."}),children:(0,t.jsx)(w,{})})}e.s(["default",()=>_],566606)},700514,e=>{"use strict";var t=e.i(271645);e.s(["defaultPageSize",0,25,"useBaseUrl",0,()=>{let[e,l]=(0,t.useState)("http://localhost:4000");return(0,t.useEffect)(()=>{{let{protocol:e,host:t}=window.location;l(`${e}//${t}`)}},[]),e}])},50882,e=>{"use strict";var t=e.i(843476),l=e.i(621482),a=e.i(243652),s=e.i(764205),r=e.i(135214);let i=(0,a.createQueryKeys)("infiniteKeyAliases");var n=e.i(56456),o=e.i(152473),c=e.i(199133),d=e.i(271645);e.s(["PaginatedKeyAliasSelect",0,({value:e,onChange:a,placeholder:u="Select a key alias",style:m,pageSize:h=50,allowClear:g=!0,disabled:x=!1,allFilters:p})=>{let[f,b]=(0,d.useState)(""),[y,j]=(0,o.useDebouncedState)("",{wait:300}),{data:v,fetchNextPage:w,hasNextPage:_,isFetchingNextPage:N,isLoading:k}=((e=50,t,a)=>{let{accessToken:n}=(0,r.default)();return(0,l.useInfiniteQuery)({queryKey:i.list({filters:{size:e,...t&&{search:t},...a&&{team_id:a}}}),queryFn:async({pageParam:l})=>await (0,s.keyAliasesCall)(n,l,e,t,a),initialPageParam:1,getNextPageParam:e=>{if(e.current_page{if(!v?.pages)return[];let e=new Set,t=[];for(let l of v.pages)for(let a of l.aliases)!a||e.has(a)||(e.add(a),t.push({label:a,value:a}));return t},[v]);return(0,t.jsx)(c.Select,{value:e||void 0,onChange:e=>{a?.(e??"")},placeholder:u,style:{width:"100%",...m},allowClear:g,disabled:x,showSearch:!0,filterOption:!1,onSearch:e=>{b(e),j(e)},searchValue:f,onPopupScroll:e=>{let t=e.currentTarget;(t.scrollTop+t.clientHeight)/t.scrollHeight>=.8&&_&&!N&&w()},loading:k,notFoundContent:k?(0,t.jsx)(n.LoadingOutlined,{spin:!0}):"No key aliases found",options:C,popupRender:e=>(0,t.jsxs)(t.Fragment,{children:[e,N&&(0,t.jsx)("div",{style:{textAlign:"center",padding:8},children:(0,t.jsx)(n.LoadingOutlined,{spin:!0})})]})})}],50882)},693569,e=>{"use strict";var t=e.i(843476),l=e.i(268004),a=e.i(309426),s=e.i(350967),r=e.i(898586),i=e.i(947293),n=e.i(618566),o=e.i(271645),c=e.i(566606),d=e.i(584578),u=e.i(764205),m=e.i(702597),h=e.i(207082),g=e.i(109799),x=e.i(500330),p=e.i(871943),f=e.i(502547),b=e.i(360820),y=e.i(94629),j=e.i(152990),v=e.i(682830),w=e.i(389083),_=e.i(994388),N=e.i(752978),k=e.i(269200),C=e.i(942232),S=e.i(977572),T=e.i(427612),I=e.i(64848),E=e.i(496020),A=e.i(599724),P=e.i(827252),D=e.i(772345),M=e.i(464571),B=e.i(282786),O=e.i(981339),F=e.i(592968),R=e.i(355619),L=e.i(633627),z=e.i(374009),U=e.i(700514),H=e.i(135214),V=e.i(50882),$=e.i(969550),q=e.i(304911),K=e.i(20147);function G({teams:e,organizations:l,onSortChange:a,currentSort:s}){let{data:i}=(0,g.useOrganizations)(),n=i??l??[],[c,d]=(0,o.useState)(null),[m,G]=o.default.useState(()=>s?[{id:s.sortBy,desc:"desc"===s.sortOrder}]:[{id:"created_at",desc:!0}]),[W,J]=o.default.useState({pageIndex:0,pageSize:50}),Y=m.length>0?m[0].id:null,Q=m.length>0?m[0].desc?"desc":"asc":null,{data:X,isPending:Z,isFetching:ee,isError:et,refetch:el}=(0,h.useKeys)(W.pageIndex+1,W.pageSize,{sortBy:Y||void 0,sortOrder:Q||void 0,expand:"user"}),[ea,es]=(0,o.useState)({}),{filters:er,filteredKeys:ei,filteredTotalCount:en,allTeams:eo,allOrganizations:ec,handleFilterChange:ed,handleFilterReset:eu}=function({keys:e,teams:t,organizations:l}){let a={"Team ID":"","Organization ID":"","Key Alias":"","User ID":"","Sort By":"created_at","Sort Order":"desc"},{accessToken:s}=(0,H.default)(),[r,i]=(0,o.useState)(a),[n,c]=(0,o.useState)(t||[]),[d,m]=(0,o.useState)(l||[]),[h,g]=(0,o.useState)(e),[x,p]=(0,o.useState)(null),f=(0,o.useRef)(0),b=(0,o.useCallback)((0,z.default)(async e=>{if(!s)return;let t=Date.now();f.current=t;try{let l=await (0,u.keyListCall)(s,e["Organization ID"]||null,e["Team ID"]||null,e["Key Alias"]||null,e["User ID"]||null,e["Key Hash"]||null,1,U.defaultPageSize,e["Sort By"]||null,e["Sort Order"]||null);t===f.current&&l&&(g(l.keys),p(l.total_count??null),console.log("called from debouncedSearch filters:",JSON.stringify(e)),console.log("called from debouncedSearch data:",JSON.stringify(l)))}catch(e){console.error("Error searching users:",e)}},300),[s]);return(0,o.useEffect)(()=>{if(!e)return void g([]);let t=[...e];r["Team ID"]&&(t=t.filter(e=>e.team_id===r["Team ID"])),r["Organization ID"]&&(t=t.filter(e=>(e.organization_id??e.org_id)===r["Organization ID"])),g(t)},[e,r]),(0,o.useEffect)(()=>{let e=async()=>{let e=await (0,L.fetchAllTeams)(s);e.length>0&&c(e);let t=await (0,L.fetchAllOrganizations)(s);t.length>0&&m(t)};s&&e()},[s]),(0,o.useEffect)(()=>{t&&t.length>0&&c(e=>e.length{l&&l.length>0&&m(e=>e.length{i({"Team ID":e["Team ID"]||"","Organization ID":e["Organization ID"]||"","Key Alias":e["Key Alias"]||"","User ID":e["User ID"]||"","Sort By":e["Sort By"]||"created_at","Sort Order":e["Sort Order"]||"desc"}),t||b({...r,...e})},handleFilterReset:()=>{i(a),p(null),b(a)}}}({keys:X?.keys||[],teams:e,organizations:l}),em=(0,o.useDeferredValue)(ee),eh=(ee||em)&&!et,eg=en??X?.total_count??0;(0,o.useEffect)(()=>{if(el){let e=()=>{el()};return window.addEventListener("storage",e),()=>{window.removeEventListener("storage",e)}}},[el]);let ex=(0,o.useMemo)(()=>[{id:"expander",header:()=>null,size:40,enableSorting:!1,cell:({row:e})=>e.getCanExpand()?(0,t.jsx)("button",{onClick:e.getToggleExpandedHandler(),style:{cursor:"pointer"},children:e.getIsExpanded()?"▼":"▶"}):null},{id:"token",accessorKey:"token",header:"Key ID",size:100,enableSorting:!0,cell:e=>{let l=e.getValue(),a=e.cell.column.getSize();return(0,t.jsx)(F.Tooltip,{title:l,children:(0,t.jsx)(_.Button,{size:"xs",variant:"light",className:"font-mono text-blue-500 bg-blue-50 hover:bg-blue-100 text-xs font-normal px-2 py-0.5 text-left overflow-hidden truncate block",style:{maxWidth:a,overflow:"hidden"},onClick:()=>d(e.row.original),children:l??"-"})})}},{id:"key_alias",accessorKey:"key_alias",header:"Key Alias",size:150,enableSorting:!0,cell:e=>{let l=e.getValue(),a=e.cell.column.getSize();return(0,t.jsx)("span",{className:"font-mono text-xs truncate block",style:{maxWidth:a,overflow:"hidden"},children:l??"-"})}},{id:"key_name",accessorKey:"key_name",header:"Secret Key",size:120,enableSorting:!1,cell:e=>(0,t.jsx)("span",{className:"font-mono text-xs",children:e.getValue()})},{id:"team_alias",accessorKey:"team_id",header:"Team",size:120,enableSorting:!1,cell:l=>{let a=l.getValue();if(!a)return"-";let s=e?.find(e=>e.team_id===a),r=s?.team_alias||a,i=l.cell.column.getSize();return(0,t.jsx)("span",{className:"font-mono text-xs truncate block",style:{maxWidth:i,overflow:"hidden"},children:r})}},{id:"organization_alias",accessorKey:"org_id",header:"Organization",size:140,enableSorting:!1,cell:e=>{let l=e.getValue();if(!l)return"-";let a=n.find(e=>e.organization_id===l),s=a?.organization_alias||l,r=e.cell.column.getSize();return(0,t.jsx)("span",{className:"font-mono text-xs truncate block",style:{maxWidth:r,overflow:"hidden"},children:s})}},{id:"user",accessorKey:"user",header:()=>(0,t.jsxs)("span",{className:"flex items-center gap-1",children:["User",(0,t.jsx)(B.Popover,{content:"Displays the first available value: User Alias, User Email, or User ID.",trigger:"hover",children:(0,t.jsx)(P.InfoCircleOutlined,{className:"text-gray-400 text-xs cursor-help"})})]}),size:160,enableSorting:!1,cell:({row:e})=>{let l=e.original,a=l.user?.user_alias??null,s=l.user?.user_email??l.user_email??null,i=l.user_id??null,n="default_user_id"===i,o=a||s||i,c=(0,t.jsx)("div",{className:"flex flex-col gap-2 text-xs min-w-[200px] max-w-[300px]",children:[{label:"User Alias",value:a},{label:"User Email",value:s},{label:"User ID",value:i}].map(({label:e,value:l})=>(0,t.jsxs)("div",{className:"flex flex-col min-w-0",children:[(0,t.jsx)("span",{className:"text-gray-400",children:e}),l?(0,t.jsx)(r.Typography.Text,{className:"font-mono text-xs",ellipsis:{tooltip:l},copyable:!0,children:l}):(0,t.jsx)("span",{className:"font-mono",children:"-"})]},e))});return!n||a||s?(0,t.jsx)(B.Popover,{content:c,trigger:"hover",placement:"bottomLeft",children:(0,t.jsx)("span",{className:"font-mono text-xs truncate block cursor-default",style:{maxWidth:160,overflow:"hidden"},children:o||"-"})}):(0,t.jsx)(B.Popover,{content:c,trigger:"hover",placement:"bottomLeft",children:(0,t.jsx)("span",{className:"cursor-default",children:(0,t.jsx)(q.default,{userId:i})})})}},{id:"created_at",accessorKey:"created_at",header:"Created At",size:120,enableSorting:!0,cell:e=>{let t=e.getValue();return t?new Date(t).toLocaleDateString():"-"}},{id:"created_by",accessorKey:"created_by",header:"Created By",size:160,enableSorting:!1,cell:e=>{let l=e.getValue();if(!l)return"-";let a=e.row.original.created_by_user,s=a?.user_alias??null,i=a?.user_email??null,n="default_user_id"===l,o=s||i||l,c=(0,t.jsx)("div",{className:"flex flex-col gap-2 text-xs min-w-[200px] max-w-[300px]",children:[{label:"User Alias",value:s},{label:"User Email",value:i},{label:"User ID",value:l}].map(({label:e,value:l})=>(0,t.jsxs)("div",{className:"flex flex-col min-w-0",children:[(0,t.jsx)("span",{className:"text-gray-400",children:e}),l?(0,t.jsx)(r.Typography.Text,{className:"font-mono text-xs",ellipsis:{tooltip:l},copyable:!0,children:l}):(0,t.jsx)("span",{className:"font-mono",children:"-"})]},e))});return!n||s||i?(0,t.jsx)(B.Popover,{content:c,trigger:"hover",placement:"bottomLeft",children:(0,t.jsx)("span",{className:"font-mono text-xs truncate block cursor-default",style:{maxWidth:160,overflow:"hidden"},children:o})}):(0,t.jsx)(B.Popover,{content:c,trigger:"hover",placement:"bottomLeft",children:(0,t.jsx)("span",{className:"cursor-default",children:(0,t.jsx)(q.default,{userId:l})})})}},{id:"updated_at",accessorKey:"updated_at",header:"Updated At",size:120,enableSorting:!0,cell:e=>{let t=e.getValue();return t?new Date(t).toLocaleDateString():"Never"}},{id:"last_active",accessorKey:"last_active",header:()=>(0,t.jsxs)("span",{className:"flex items-center gap-1",children:["Last Active",(0,t.jsx)(B.Popover,{content:"This is a new field and is not backfilled. Only new key usage will update this value.",trigger:"hover",children:(0,t.jsx)(P.InfoCircleOutlined,{className:"text-gray-400 text-xs cursor-help"})})]}),size:130,enableSorting:!1,cell:e=>{let l=e.getValue();if(!l)return"Unknown";let a=new Date(l);return(0,t.jsx)(F.Tooltip,{title:a.toLocaleString(void 0,{dateStyle:"medium",timeStyle:"long"}),children:(0,t.jsx)("span",{children:a.toLocaleDateString()})})}},{id:"expires",accessorKey:"expires",header:"Expires",size:120,enableSorting:!1,cell:e=>{let t=e.getValue();return t?new Date(t).toLocaleDateString():"Never"}},{id:"spend",accessorKey:"spend",header:"Spend (USD)",size:100,enableSorting:!0,cell:e=>(0,x.formatNumberWithCommas)(e.getValue(),4)},{id:"max_budget",accessorKey:"max_budget",header:"Budget (USD)",size:110,enableSorting:!0,cell:e=>{let t=e.getValue();return null===t?"Unlimited":`$${(0,x.formatNumberWithCommas)(t)}`}},{id:"budget_reset_at",accessorKey:"budget_reset_at",header:"Budget Reset",size:130,enableSorting:!1,cell:e=>{let t=e.getValue();return t?new Date(t).toLocaleString():"Never"}},{id:"models",accessorKey:"models",header:"Models",size:200,enableSorting:!1,cell:e=>{let l=e.getValue();return(0,t.jsx)("div",{className:"flex flex-col py-2",children:Array.isArray(l)?(0,t.jsx)("div",{className:"flex flex-col",children:0===l.length?(0,t.jsx)(w.Badge,{size:"xs",className:"mb-1",color:"red",children:(0,t.jsx)(A.Text,{children:"All Proxy Models"})}):(0,t.jsx)(t.Fragment,{children:(0,t.jsxs)("div",{className:"flex items-start",children:[l.length>3&&(0,t.jsx)("div",{children:(0,t.jsx)(N.Icon,{icon:ea[e.row.id]?p.ChevronDownIcon:f.ChevronRightIcon,className:"cursor-pointer",size:"xs",onClick:()=>{es(t=>({...t,[e.row.id]:!t[e.row.id]}))}})}),(0,t.jsxs)("div",{className:"flex flex-wrap gap-1",children:[l.slice(0,3).map((e,l)=>"all-proxy-models"===e?(0,t.jsx)(w.Badge,{size:"xs",color:"red",children:(0,t.jsx)(A.Text,{children:"All Proxy Models"})},l):(0,t.jsx)(w.Badge,{size:"xs",color:"blue",children:(0,t.jsx)(A.Text,{children:e.length>30?`${(0,R.getModelDisplayName)(e).slice(0,30)}...`:(0,R.getModelDisplayName)(e)})},l)),l.length>3&&!ea[e.row.id]&&(0,t.jsx)(w.Badge,{size:"xs",color:"gray",className:"cursor-pointer",children:(0,t.jsxs)(A.Text,{children:["+",l.length-3," ",l.length-3==1?"more model":"more models"]})}),ea[e.row.id]&&(0,t.jsx)("div",{className:"flex flex-wrap gap-1",children:l.slice(3).map((e,l)=>"all-proxy-models"===e?(0,t.jsx)(w.Badge,{size:"xs",color:"red",children:(0,t.jsx)(A.Text,{children:"All Proxy Models"})},l+3):(0,t.jsx)(w.Badge,{size:"xs",color:"blue",children:(0,t.jsx)(A.Text,{children:e.length>30?`${(0,R.getModelDisplayName)(e).slice(0,30)}...`:(0,R.getModelDisplayName)(e)})},l+3))})]})]})})}):null})}},{id:"rate_limits",header:"Rate Limits",size:140,enableSorting:!1,cell:({row:e})=>{let l=e.original;return(0,t.jsxs)("div",{children:[(0,t.jsxs)("div",{children:["TPM: ",null!==l.tpm_limit?l.tpm_limit:"Unlimited"]}),(0,t.jsxs)("div",{children:["RPM: ",null!==l.rpm_limit?l.rpm_limit:"Unlimited"]})]})}}],[e,n]),ep=[{name:"Team ID",label:"Team ID",isSearchable:!0,searchFn:async e=>eo&&0!==eo.length?eo.filter(t=>t.team_id.toLowerCase().includes(e.toLowerCase())||t.team_alias&&t.team_alias.toLowerCase().includes(e.toLowerCase())).map(e=>({label:`${e.team_alias||e.team_id} (${e.team_id})`,value:e.team_id})):[]},{name:"Organization ID",label:"Organization ID",isSearchable:!0,searchFn:async e=>ec&&0!==ec.length?ec.filter(t=>t.organization_id?.toLowerCase().includes(e.toLowerCase())??!1).filter(e=>null!==e.organization_id&&void 0!==e.organization_id).map(e=>({label:`${e.organization_id||"Unknown"} (${e.organization_id})`,value:e.organization_id})):[]},{name:"Key Alias",label:"Key Alias",customComponent:V.PaginatedKeyAliasSelect},{name:"User ID",label:"User ID",isSearchable:!1},{name:"Key Hash",label:"Key Hash",isSearchable:!1}],ef=(0,j.useReactTable)({data:ei,columns:ex.filter(e=>"expander"!==e.id),columnResizeMode:"onChange",columnResizeDirection:"ltr",state:{sorting:m,pagination:W},onSortingChange:e=>{let t="function"==typeof e?e(m):e;if(G(t),t&&t.length>0){let e=t[0],l=e.id,s=e.desc?"desc":"asc";ed({...er,"Sort By":l,"Sort Order":s},!0),a?.(l,s)}},onPaginationChange:J,getCoreRowModel:(0,v.getCoreRowModel)(),getSortedRowModel:(0,v.getSortedRowModel)(),getPaginationRowModel:(0,v.getPaginationRowModel)(),enableSorting:!0,manualSorting:!1,manualPagination:!0,pageCount:Math.ceil(eg/W.pageSize)});o.default.useEffect(()=>{s&&G([{id:s.sortBy,desc:"desc"===s.sortOrder}])},[s]);let{pageIndex:eb,pageSize:ey}=ef.getState().pagination,ej=Math.min((eb+1)*ey,eg),ev=`${eb*ey+1} - ${ej}`;return(0,t.jsx)("div",{className:"w-full h-full overflow-hidden",children:c?(0,t.jsx)(K.default,{keyId:c.token,onClose:()=>d(null),keyData:c,teams:eo,onDelete:el}):(0,t.jsxs)("div",{className:"border-b py-4 flex-1 overflow-hidden",children:[(0,t.jsx)("div",{className:"w-full mb-6",children:(0,t.jsx)($.default,{options:ep,onApplyFilters:ed,initialValues:er,onResetFilters:eu})}),(0,t.jsxs)("div",{className:"flex items-center justify-between w-full mb-4",children:[(0,t.jsxs)("div",{className:"inline-flex items-center gap-2",children:[Z?(0,t.jsx)(O.Skeleton.Node,{active:!0,style:{width:200,height:20}}):(0,t.jsxs)("span",{className:"inline-flex text-sm text-gray-700",children:["Showing ",ev," of ",eg," results"]}),(0,t.jsx)(M.Button,{type:"default",icon:(0,t.jsx)(D.SyncOutlined,{spin:eh}),onClick:()=>{el()},disabled:eh,title:"Fetch data",children:eh?"Fetching":"Fetch"})]}),(0,t.jsxs)("div",{className:"inline-flex items-center gap-2",children:[Z?(0,t.jsx)(O.Skeleton.Node,{active:!0,style:{width:74,height:20}}):(0,t.jsxs)("span",{className:"text-sm text-gray-700",children:["Page ",eb+1," of ",ef.getPageCount()]}),Z?(0,t.jsx)(O.Skeleton.Button,{active:!0,size:"small",style:{width:84,height:30}}):(0,t.jsx)("button",{onClick:()=>ef.previousPage(),disabled:Z||!ef.getCanPreviousPage(),className:"px-3 py-1 text-sm border rounded-md hover:bg-gray-50 disabled:opacity-50 disabled:cursor-not-allowed",children:"Previous"}),Z?(0,t.jsx)(O.Skeleton.Button,{active:!0,size:"small",style:{width:58,height:30}}):(0,t.jsx)("button",{onClick:()=>ef.nextPage(),disabled:Z||!ef.getCanNextPage(),className:"px-3 py-1 text-sm border rounded-md hover:bg-gray-50 disabled:opacity-50 disabled:cursor-not-allowed",children:"Next"})]})]}),(0,t.jsx)("div",{className:"h-[75vh] overflow-auto",children:(0,t.jsx)("div",{className:"rounded-lg custom-border relative",children:(0,t.jsx)("div",{className:"overflow-x-auto",children:(0,t.jsxs)(k.Table,{className:"[&_td]:py-0.5 [&_th]:py-1",style:{width:ef.getCenterTotalSize()},children:[(0,t.jsx)(T.TableHead,{children:ef.getHeaderGroups().map(e=>(0,t.jsx)(E.TableRow,{children:e.headers.map(e=>(0,t.jsx)(I.TableHeaderCell,{"data-header-id":e.id,className:`py-1 h-8 relative hover:bg-gray-50 ${"actions"===e.id?"sticky right-0 bg-white shadow-[-4px_0_8px_-6px_rgba(0,0,0,0.1)]":""}`,style:{width:e.getSize(),position:"relative",cursor:e.column.getCanSort()?"pointer":"default"},onMouseEnter:()=>{let t=document.querySelector(`[data-header-id="${e.id}"] .resizer`);t&&(t.style.opacity="0.5")},onMouseLeave:()=>{let t=document.querySelector(`[data-header-id="${e.id}"] .resizer`);t&&!e.column.getIsResizing()&&(t.style.opacity="0")},onClick:e.column.getCanSort()?e.column.getToggleSortingHandler():void 0,children:(0,t.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,t.jsx)("div",{className:"flex items-center",children:e.isPlaceholder?null:(0,j.flexRender)(e.column.columnDef.header,e.getContext())}),"actions"!==e.id&&e.column.getCanSort()&&(0,t.jsx)("div",{className:"w-4",children:e.column.getIsSorted()?({asc:(0,t.jsx)(b.ChevronUpIcon,{className:"h-4 w-4 text-blue-500"}),desc:(0,t.jsx)(p.ChevronDownIcon,{className:"h-4 w-4 text-blue-500"})})[e.column.getIsSorted()]:(0,t.jsx)(y.SwitchVerticalIcon,{className:"h-4 w-4 text-gray-400"})}),(0,t.jsx)("div",{onDoubleClick:()=>e.column.resetSize(),onMouseDown:e.getResizeHandler(),onTouchStart:e.getResizeHandler(),className:`resizer ${ef.options.columnResizeDirection} ${e.column.getIsResizing()?"isResizing":""}`,style:{position:"absolute",right:0,top:0,height:"100%",width:"5px",background:e.column.getIsResizing()?"#3b82f6":"transparent",cursor:"col-resize",userSelect:"none",touchAction:"none",opacity:+!!e.column.getIsResizing()}})]})},e.id))},e.id))}),(0,t.jsx)(C.TableBody,{children:Z?(0,t.jsx)(E.TableRow,{children:(0,t.jsx)(S.TableCell,{colSpan:ex.length,className:"h-8 text-center",children:(0,t.jsx)("div",{className:"text-center text-gray-500",children:(0,t.jsx)("p",{children:"🚅 Loading keys..."})})})}):ei.length>0?ef.getRowModel().rows.map(e=>(0,t.jsx)(E.TableRow,{className:"h-8",children:e.getVisibleCells().map(e=>(0,t.jsx)(S.TableCell,{style:{width:e.column.getSize(),maxWidth:"8-x",whiteSpace:"pre-wrap",overflow:"hidden"},className:`py-0.5 max-h-8 overflow-hidden text-ellipsis whitespace-nowrap ${"models"===e.column.id&&Array.isArray(e.getValue())&&e.getValue().length>3?"px-0":""}`,children:(0,j.flexRender)(e.column.columnDef.cell,e.getContext())},e.id))},e.id)):(0,t.jsx)(E.TableRow,{children:(0,t.jsx)(S.TableCell,{colSpan:ex.length,className:"h-8 text-center",children:(0,t.jsx)("div",{className:"text-center text-gray-500",children:(0,t.jsx)("p",{children:"No keys found"})})})})})]})})})})]})})}e.s(["default",0,({userID:e,userRole:h,teams:g,keys:x,setUserRole:p,userEmail:f,setUserEmail:b,setTeams:y,setKeys:j,premiumUser:v,organizations:w,addKey:_,createClicked:N,autoOpenCreate:k,prefillData:C})=>{let S,[T,I]=(0,o.useState)(null),[E,A]=(0,o.useState)(null),P=(0,n.useSearchParams)(),D=(console.log("COOKIES",document.cookie),(S=document.cookie.split("; ").find(e=>e.startsWith("token=")))?S.split("=")[1]:null),M=P.get("invitation_id"),[B,O]=(0,o.useState)(null),[F,R]=(0,o.useState)(null),[L,z]=(0,o.useState)([]),[U,H]=(0,o.useState)(null),[V,$]=(0,o.useState)(null);if((0,o.useEffect)(()=>{let e=()=>{sessionStorage.clear()};return window.addEventListener("beforeunload",e),()=>window.removeEventListener("beforeunload",e)},[]),(0,o.useEffect)(()=>{if(D){let e=(0,i.jwtDecode)(D);if(e){if(console.log("Decoded token:",e),console.log("Decoded key:",e.key),O(e.key),e.user_role){let t=function(e){if(!e)return"Undefined Role";switch(console.log(`Received user role: ${e}`),e.toLowerCase()){case"app_owner":case"demo_app_owner":return"App Owner";case"app_admin":case"proxy_admin":return"Admin";case"proxy_admin_viewer":return"Admin Viewer";case"app_user":return"App User";case"internal_user":return"Internal User";case"internal_user_viewer":return"Internal Viewer";default:return"Unknown Role"}}(e.user_role);console.log("Decoded user_role:",t),p(t)}else console.log("User role not defined");e.user_email?b(e.user_email):console.log(`User Email is not set ${e}`)}}if(e&&B&&h&&!T){let t=sessionStorage.getItem("userModels"+e);t?z(JSON.parse(t)):(console.log(`currentOrg: ${JSON.stringify(E)}`),(async()=>{try{let t=await (0,u.getProxyUISettings)(B);H(t);let l=await (0,u.userGetInfoV2)(B,e);I(l),sessionStorage.setItem("userSpendData"+e,JSON.stringify(l));let a=(await (0,u.modelAvailableCall)(B,e,h)).data.map(e=>e.id);console.log("available_model_names:",a),z(a),console.log("userModels:",L),sessionStorage.setItem("userModels"+e,JSON.stringify(a))}catch(e){console.error("There was an error fetching the data",e),e.message.includes("Invalid proxy server token passed")&&q()}})(),(0,d.fetchTeams)(B,e,h,E,y))}},[e,D,B,h]),(0,o.useEffect)(()=>{B&&(async()=>{try{let e=await (0,u.keyInfoCall)(B,[B]);console.log("keyInfo: ",e)}catch(e){e.message.includes("Invalid proxy server token passed")&&q()}})()},[B]),(0,o.useEffect)(()=>{console.log(`currentOrg: ${JSON.stringify(E)}, accessToken: ${B}, userID: ${e}, userRole: ${h}`),B&&(console.log("fetching teams"),(0,d.fetchTeams)(B,e,h,E,y))},[E]),(0,o.useEffect)(()=>{if(null!==x&&null!=V&&null!==V.team_id){let e=0;for(let t of(console.log(`keys: ${JSON.stringify(x)}`),x))V.hasOwnProperty("team_id")&&null!==t.team_id&&t.team_id===V.team_id&&(e+=t.spend);console.log(`sum: ${e}`),R(e)}else if(null!==x){let e=0;for(let t of x)e+=t.spend;R(e)}},[V]),null!=M)return(0,t.jsx)(c.default,{});function q(){(0,l.clearTokenCookies)();let e=(0,u.getProxyBaseUrl)();console.log("proxyBaseUrl:",e);let t=e?`${e}/sso/key/generate`:"/sso/key/generate";return console.log("Full URL:",t),window.location.href=t,null}if(null==D)return console.log("All cookies before redirect:",document.cookie),q(),null;try{let e=(0,i.jwtDecode)(D);console.log("Decoded token:",e);let t=e.exp,l=Math.floor(Date.now()/1e3);if(t&&l>=t)return console.log("Token expired, redirecting to login"),q(),null}catch(e){return console.error("Error decoding token:",e),(0,l.clearTokenCookies)(),q(),null}if(null==B)return null;if(null==e)return(0,t.jsx)("h1",{children:"User ID is not set"});if(null==h&&p("App Owner"),h&&"Admin Viewer"==h){let{Title:e,Paragraph:l}=r.Typography;return(0,t.jsxs)("div",{children:[(0,t.jsx)(e,{level:1,children:"Access Denied"}),(0,t.jsx)(l,{children:"Ask your proxy admin for access to create keys"})]})}return console.log("inside user dashboard, selected team",V),console.log("All cookies after redirect:",document.cookie),(0,t.jsx)("div",{className:"w-full mx-4 h-[75vh]",children:(0,t.jsx)(s.Grid,{numItems:1,className:"gap-2 p-8 w-full mt-2",children:(0,t.jsxs)(a.Col,{numColSpan:1,className:"flex flex-col gap-2",children:[(0,t.jsx)(m.default,{team:V,teams:g,data:x,addKey:_,autoOpenCreate:k,prefillData:C},V?V.team_id:null),(0,t.jsx)(G,{teams:g,organizations:w})]})})})}],693569)},559061,e=>{"use strict";var t=e.i(843476),l=e.i(584935),a=e.i(304967),s=e.i(309426),r=e.i(350967),i=e.i(752978),n=e.i(621642),o=e.i(25080),c=e.i(37091),d=e.i(197647),u=e.i(653824),m=e.i(881073),h=e.i(404206),g=e.i(723731),x=e.i(599724),p=e.i(271645),f=e.i(727749),b=e.i(144267),y=e.i(278587),j=e.i(764205),v=e.i(994388),w=e.i(220508),_=e.i(964306),N=e.i(551332);let k=({responseTimeMs:e})=>null==e?null:(0,t.jsxs)("div",{className:"flex items-center space-x-1 text-xs text-gray-500 font-mono",children:[(0,t.jsx)("svg",{className:"w-4 h-4",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:(0,t.jsx)("path",{d:"M12 6V12L16 14M12 2C6.47715 2 2 6.47715 2 12C2 17.5228 6.47715 22 12 22C17.5228 22 22 17.5228 22 12C22 6.47715 17.5228 2 12 2Z",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}),(0,t.jsxs)("span",{children:[e.toFixed(0),"ms"]})]}),C=e=>{let t=e;if("string"==typeof t)try{t=JSON.parse(t)}catch{}return t},S=({label:e,value:l})=>{let[a,s]=p.default.useState(!1),[r,i]=p.default.useState(!1),n=l?.toString()||"N/A",o=n.length>50?n.substring(0,50)+"...":n;return(0,t.jsx)("tr",{className:"hover:bg-gray-50",children:(0,t.jsx)("td",{className:"px-4 py-2 align-top",colSpan:2,children:(0,t.jsxs)("div",{className:"flex items-center justify-between group",children:[(0,t.jsxs)("div",{className:"flex items-center flex-1",children:[(0,t.jsx)("button",{onClick:()=>s(!a),className:"text-gray-400 hover:text-gray-600 mr-2",children:a?"▼":"▶"}),(0,t.jsxs)("div",{children:[(0,t.jsx)("div",{className:"text-sm text-gray-600",children:e}),(0,t.jsx)("pre",{className:"mt-1 text-sm font-mono text-gray-800 whitespace-pre-wrap",children:a?n:o})]})]}),(0,t.jsx)("button",{onClick:()=>{navigator.clipboard.writeText(n),i(!0),setTimeout(()=>i(!1),2e3)},className:"opacity-0 group-hover:opacity-100 text-gray-400 hover:text-gray-600",children:(0,t.jsx)(N.ClipboardCopyIcon,{className:"h-4 w-4"})})]})})})},T=({response:e})=>{let l=null,a={},s={};try{if(e?.error)try{let t="string"==typeof e.error.message?JSON.parse(e.error.message):e.error.message;l={message:t?.message||"Unknown error",traceback:t?.traceback||"No traceback available",litellm_params:t?.litellm_cache_params||{},health_check_cache_params:t?.health_check_cache_params||{}},a=C(l.litellm_params)||{},s=C(l.health_check_cache_params)||{}}catch(t){console.warn("Error parsing error details:",t),l={message:String(e.error.message||"Unknown error"),traceback:"Error parsing details",litellm_params:{},health_check_cache_params:{}}}else a=C(e?.litellm_cache_params)||{},s=C(e?.health_check_cache_params)||{}}catch(e){console.warn("Error in response parsing:",e),a={},s={}}let r={redis_host:s?.redis_client?.connection_pool?.connection_kwargs?.host||s?.redis_async_client?.connection_pool?.connection_kwargs?.host||s?.connection_kwargs?.host||s?.host||"N/A",redis_port:s?.redis_client?.connection_pool?.connection_kwargs?.port||s?.redis_async_client?.connection_pool?.connection_kwargs?.port||s?.connection_kwargs?.port||s?.port||"N/A",redis_version:s?.redis_version||"N/A",startup_nodes:(()=>{try{if(s?.redis_kwargs?.startup_nodes)return JSON.stringify(s.redis_kwargs.startup_nodes);let e=s?.redis_client?.connection_pool?.connection_kwargs?.host||s?.redis_async_client?.connection_pool?.connection_kwargs?.host,t=s?.redis_client?.connection_pool?.connection_kwargs?.port||s?.redis_async_client?.connection_pool?.connection_kwargs?.port;return e&&t?JSON.stringify([{host:e,port:t}]):"N/A"}catch(e){return"N/A"}})(),namespace:s?.namespace||"N/A"};return(0,t.jsx)("div",{className:"bg-white rounded-lg shadow",children:(0,t.jsxs)(u.TabGroup,{children:[(0,t.jsxs)(m.TabList,{className:"border-b border-gray-200 px-4",children:[(0,t.jsx)(d.Tab,{className:"px-4 py-2 text-sm font-medium text-gray-600 hover:text-gray-800",children:"Summary"}),(0,t.jsx)(d.Tab,{className:"px-4 py-2 text-sm font-medium text-gray-600 hover:text-gray-800",children:"Raw Response"})]}),(0,t.jsxs)(g.TabPanels,{children:[(0,t.jsx)(h.TabPanel,{className:"p-4",children:(0,t.jsxs)("div",{children:[(0,t.jsxs)("div",{className:"flex items-center mb-6",children:[e?.status==="healthy"?(0,t.jsx)(w.CheckCircleIcon,{className:"h-5 w-5 text-green-500 mr-2"}):(0,t.jsx)(_.XCircleIcon,{className:"h-5 w-5 text-red-500 mr-2"}),(0,t.jsxs)(x.Text,{className:`text-sm font-medium ${e?.status==="healthy"?"text-green-500":"text-red-500"}`,children:["Cache Status: ",e?.status||"unhealthy"]})]}),(0,t.jsx)("table",{className:"w-full border-collapse",children:(0,t.jsxs)("tbody",{children:[l&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("tr",{children:(0,t.jsx)("td",{colSpan:2,className:"pt-4 pb-2 font-semibold text-red-600",children:"Error Details"})}),(0,t.jsx)(S,{label:"Error Message",value:l.message}),(0,t.jsx)(S,{label:"Traceback",value:l.traceback})]}),(0,t.jsx)("tr",{children:(0,t.jsx)("td",{colSpan:2,className:"pt-4 pb-2 font-semibold",children:"Cache Details"})}),(0,t.jsx)(S,{label:"Cache Configuration",value:String(a?.type)}),(0,t.jsx)(S,{label:"Ping Response",value:String(e.ping_response)}),(0,t.jsx)(S,{label:"Set Cache Response",value:e.set_cache_response||"N/A"}),(0,t.jsx)(S,{label:"litellm_settings.cache_params",value:JSON.stringify(a,null,2)}),a?.type==="redis"&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("tr",{children:(0,t.jsx)("td",{colSpan:2,className:"pt-4 pb-2 font-semibold",children:"Redis Details"})}),(0,t.jsx)(S,{label:"Redis Host",value:r.redis_host||"N/A"}),(0,t.jsx)(S,{label:"Redis Port",value:r.redis_port||"N/A"}),(0,t.jsx)(S,{label:"Redis Version",value:r.redis_version||"N/A"}),(0,t.jsx)(S,{label:"Startup Nodes",value:r.startup_nodes||"N/A"}),(0,t.jsx)(S,{label:"Namespace",value:r.namespace||"N/A"})]})]})})]})}),(0,t.jsx)(h.TabPanel,{className:"p-4",children:(0,t.jsx)("div",{className:"bg-gray-50 rounded-md p-4 font-mono text-sm",children:(0,t.jsx)("pre",{className:"whitespace-pre-wrap break-words overflow-auto max-h-[500px]",children:(()=>{try{let t={...e,litellm_cache_params:a,health_check_cache_params:s},l=JSON.parse(JSON.stringify(t,(e,t)=>{if("string"==typeof t)try{return JSON.parse(t)}catch{}return t}));return JSON.stringify(l,null,2)}catch(e){return"Error formatting JSON: "+e.message}})()})})})]})]})})},I=({accessToken:e,healthCheckResponse:l,runCachingHealthCheck:a,responseTimeMs:s})=>{let[r,i]=p.default.useState(null),[n,o]=p.default.useState(!1),c=async()=>{o(!0);let e=performance.now();await a(),i(performance.now()-e),o(!1)};return(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[(0,t.jsx)(v.Button,{onClick:c,disabled:n,className:"bg-indigo-600 hover:bg-indigo-700 disabled:bg-indigo-400 text-white text-sm px-4 py-2 rounded-md",children:n?"Running Health Check...":"Run Health Check"}),(0,t.jsx)(k,{responseTimeMs:r})]}),l&&(0,t.jsx)(T,{response:l})]})};var E=e.i(677667),A=e.i(898667),P=e.i(130643),D=e.i(206929),M=e.i(35983);let B=({redisType:e,redisTypeDescriptions:l,onTypeChange:a})=>(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)("label",{className:"text-sm font-medium text-gray-700",children:"Redis Type"}),(0,t.jsxs)(D.Select,{value:e,onValueChange:a,children:[(0,t.jsx)(M.SelectItem,{value:"node",children:"Node (Single Instance)"}),(0,t.jsx)(M.SelectItem,{value:"cluster",children:"Cluster"}),(0,t.jsx)(M.SelectItem,{value:"sentinel",children:"Sentinel"}),(0,t.jsx)(M.SelectItem,{value:"semantic",children:"Semantic"})]}),(0,t.jsx)("p",{className:"text-xs text-gray-500",children:l[e]||"Select the type of Redis deployment you're using"})]});var O=e.i(135214),F=e.i(620250),R=e.i(779241),L=e.i(199133),z=e.i(689020),U=e.i(435451);let H=({field:e,currentValue:l})=>{let[a,s]=(0,p.useState)([]),[r,i]=(0,p.useState)(l||""),{accessToken:n}=(0,O.default)();if((0,p.useEffect)(()=>{n&&(async()=>{try{let e=await (0,z.fetchAvailableModels)(n);console.log("Fetched models for selector:",e),e.length>0&&s(e)}catch(e){console.error("Error fetching model info:",e)}})()},[n]),"Boolean"===e.field_type)return(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)("label",{className:"text-sm font-medium text-gray-700",children:e.ui_field_name}),(0,t.jsxs)("div",{className:"flex items-center",children:[(0,t.jsx)("input",{type:"checkbox",name:e.field_name,defaultChecked:!0===l||"true"===l,className:"h-4 w-4 text-indigo-600 focus:ring-indigo-500 border-gray-300 rounded"}),(0,t.jsx)("span",{className:"ml-2 text-sm text-gray-500",children:e.field_description})]})]});if("Integer"===e.field_type||"Float"===e.field_type)return(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)("label",{className:"text-sm font-medium text-gray-700",children:e.ui_field_name}),(0,t.jsx)(U.default,{name:e.field_name,type:"number",defaultValue:l,placeholder:e.field_description}),(0,t.jsx)("p",{className:"text-xs text-gray-500",children:e.field_description})]});if("List"===e.field_type)return(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)("label",{className:"text-sm font-medium text-gray-700",children:e.ui_field_name}),(0,t.jsx)("textarea",{name:e.field_name,defaultValue:"object"==typeof l?JSON.stringify(l,null,2):l,placeholder:e.field_description,className:"w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-indigo-500 focus:border-indigo-500",rows:4}),(0,t.jsx)("p",{className:"text-xs text-gray-500",children:e.field_description})]});if("Models_Select"===e.field_type){let l=a.filter(e=>"embedding"===e.mode).map(e=>({value:e.model_group,label:e.model_group}));return(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)("label",{className:"text-sm font-medium text-gray-700",children:e.ui_field_name}),(0,t.jsx)(L.Select,{value:r,onChange:i,showSearch:!0,placeholder:"Search and select a model...",options:l,style:{width:"100%"},className:"rounded-md",filterOption:(e,t)=>(t?.label??"").toLowerCase().includes(e.toLowerCase())}),(0,t.jsx)("input",{type:"hidden",name:e.field_name,value:r}),e.field_description&&(0,t.jsx)("p",{className:"text-xs text-gray-500",children:e.field_description})]})}if("Integer"===e.field_type||"Float"===e.field_type)return(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)("label",{className:"text-sm font-medium text-gray-700",children:e.ui_field_name}),(0,t.jsx)(F.NumberInput,{name:e.field_name,defaultValue:l,placeholder:e.field_description,step:"Float"===e.field_type?.01:1}),e.field_description&&(0,t.jsx)("p",{className:"text-xs text-gray-500",children:e.field_description})]});let o="password"===e.field_name||e.field_name.includes("password")?"password":"text";return(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)("label",{className:"text-sm font-medium text-gray-700",children:e.ui_field_name}),(0,t.jsx)(R.TextInput,{name:e.field_name,type:o,defaultValue:l,placeholder:e.field_description}),e.field_description&&(0,t.jsx)("p",{className:"text-xs text-gray-500",children:e.field_description})]})},V=(e,t)=>e.find(e=>e.field_name===t),$=(e,t)=>{let l={type:"redis"};return e.forEach(e=>{if("redis_type"===e.field_name||null!==e.redis_type&&void 0!==e.redis_type&&e.redis_type!==t)return;let a=e.field_name,s=null;if("Boolean"===e.field_type){let e=document.querySelector(`input[name="${a}"]`);e?.checked!==void 0&&(s=e.checked)}else if("List"===e.field_type){let e=document.querySelector(`textarea[name="${a}"]`);if(e?.value)try{s=JSON.parse(e.value)}catch(e){console.error(`Invalid JSON for ${a}:`,e)}}else{let t=document.querySelector(`input[name="${a}"]`);if(t?.value){let l=t.value.trim();if(""!==l)if("Integer"===e.field_type){let e=Number(l);isNaN(e)||(s=e)}else if("Float"===e.field_type){let e=Number(l);isNaN(e)||(s=e)}else s=l}}null!=s&&(l[a]=s)}),l},q=({accessToken:e,userRole:l,userID:a})=>{let s,r,i,n,o,[c,d]=(0,p.useState)({}),[u,m]=(0,p.useState)([]),[h,g]=(0,p.useState)({}),[x,b]=(0,p.useState)("node"),[y,w]=(0,p.useState)(!1),[_,N]=(0,p.useState)(!1),k=(0,p.useCallback)(async()=>{try{let t=await (0,j.getCacheSettingsCall)(e);console.log("cache settings from API",t),t.fields&&m(t.fields),t.current_values&&(d(t.current_values),t.current_values.redis_type&&b(t.current_values.redis_type)),t.redis_type_descriptions&&g(t.redis_type_descriptions)}catch(e){console.error("Failed to load cache settings:",e),f.default.fromBackend("Failed to load cache settings")}},[e]);(0,p.useEffect)(()=>{e&&k()},[e,k]);let C=async()=>{if(e){w(!0);try{let t=$(u,x),l=await (0,j.testCacheConnectionCall)(e,t);"success"===l.status?f.default.success("Cache connection test successful!"):f.default.fromBackend(`Connection test failed: ${l.message||l.error}`)}catch(e){console.error("Test connection error:",e),f.default.fromBackend(`Connection test failed: ${e.message||"Unknown error"}`)}finally{w(!1)}}},S=async()=>{if(e){N(!0);try{let t=$(u,x);"semantic"===x&&(t.type="redis-semantic"),await (0,j.updateCacheSettingsCall)(e,t),f.default.success("Cache settings updated successfully"),await k()}catch(e){console.error("Failed to save cache settings:",e),f.default.fromBackend("Failed to update cache settings")}finally{N(!1)}}};if(!e)return null;let{basicFields:T,sslFields:I,cacheManagementFields:D,gcpFields:M,clusterFields:O,sentinelFields:F,semanticFields:R}=(s=["host","port","password","username"].map(e=>V(u,e)).filter(Boolean),r=["ssl","ssl_cert_reqs","ssl_check_hostname"].map(e=>V(u,e)).filter(Boolean),i=["namespace","ttl","max_connections"].map(e=>V(u,e)).filter(Boolean),n=["gcp_service_account","gcp_ssl_ca_certs"].map(e=>V(u,e)).filter(Boolean),o=u.filter(e=>"cluster"===e.redis_type),{basicFields:s,sslFields:r,cacheManagementFields:i,gcpFields:n,clusterFields:o,sentinelFields:u.filter(e=>"sentinel"===e.redis_type),semanticFields:u.filter(e=>"semantic"===e.redis_type)});return(0,t.jsxs)("div",{className:"w-full space-y-8 py-2",children:[(0,t.jsxs)("div",{className:"space-y-6",children:[(0,t.jsxs)("div",{className:"max-w-3xl",children:[(0,t.jsx)("h3",{className:"text-sm font-medium text-gray-900",children:"Cache Settings"}),(0,t.jsx)("p",{className:"text-xs text-gray-500 mt-1",children:"Configure Redis cache for LiteLLM"})]}),(0,t.jsx)(B,{redisType:x,redisTypeDescriptions:h,onTypeChange:b}),(0,t.jsxs)("div",{className:"space-y-6 pt-4 border-t border-gray-200",children:[(0,t.jsx)("h4",{className:"text-sm font-medium text-gray-900",children:"Connection Settings"}),(0,t.jsx)("div",{className:"grid grid-cols-1 gap-6 sm:grid-cols-2",children:T.map(e=>{if(!e)return null;let l=c[e.field_name]??e.field_default??"";return(0,t.jsx)(H,{field:e,currentValue:l},e.field_name)})})]}),"cluster"===x&&O.length>0&&(0,t.jsxs)("div",{className:"space-y-6 pt-4 border-t border-gray-200",children:[(0,t.jsx)("h4",{className:"text-sm font-medium text-gray-900",children:"Cluster Configuration"}),(0,t.jsx)("div",{className:"grid grid-cols-1 gap-6",children:O.map(e=>{let l=c[e.field_name]??e.field_default??"";return(0,t.jsx)(H,{field:e,currentValue:l},e.field_name)})})]}),"sentinel"===x&&F.length>0&&(0,t.jsxs)("div",{className:"space-y-6 pt-4 border-t border-gray-200",children:[(0,t.jsx)("h4",{className:"text-sm font-medium text-gray-900",children:"Sentinel Configuration"}),(0,t.jsx)("div",{className:"grid grid-cols-1 gap-6 sm:grid-cols-2",children:F.map(e=>{let l=c[e.field_name]??e.field_default??"";return(0,t.jsx)(H,{field:e,currentValue:l},e.field_name)})})]}),"semantic"===x&&R.length>0&&(0,t.jsxs)("div",{className:"space-y-6 pt-4 border-t border-gray-200",children:[(0,t.jsx)("h4",{className:"text-sm font-medium text-gray-900",children:"Semantic Configuration"}),(0,t.jsx)("div",{className:"grid grid-cols-1 gap-6 sm:grid-cols-2",children:R.map(e=>{let l=c[e.field_name]??e.field_default??"";return(0,t.jsx)(H,{field:e,currentValue:l},e.field_name)})})]}),(0,t.jsxs)(E.Accordion,{className:"mt-4",children:[(0,t.jsx)(A.AccordionHeader,{children:(0,t.jsx)("span",{className:"text-sm font-medium text-gray-900",children:"Advanced Settings"})}),(0,t.jsx)(P.AccordionBody,{children:(0,t.jsxs)("div",{className:"space-y-6",children:[I.length>0&&(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsx)("h5",{className:"text-sm font-medium text-gray-700",children:"SSL Settings"}),(0,t.jsx)("div",{className:"grid grid-cols-1 gap-6 sm:grid-cols-2",children:I.map(e=>{if(!e)return null;let l=c[e.field_name]??e.field_default??"";return(0,t.jsx)(H,{field:e,currentValue:l},e.field_name)})})]}),D.length>0&&(0,t.jsxs)("div",{className:"space-y-4 pt-4 border-t border-gray-200",children:[(0,t.jsx)("h5",{className:"text-sm font-medium text-gray-700",children:"Cache Management"}),(0,t.jsx)("div",{className:"grid grid-cols-1 gap-6 sm:grid-cols-2",children:D.map(e=>{if(!e)return null;let l=c[e.field_name]??e.field_default??"";return(0,t.jsx)(H,{field:e,currentValue:l},e.field_name)})})]}),M.length>0&&(0,t.jsxs)("div",{className:"space-y-4 pt-4 border-t border-gray-200",children:[(0,t.jsx)("h5",{className:"text-sm font-medium text-gray-700",children:"GCP Authentication"}),(0,t.jsx)("div",{className:"grid grid-cols-1 gap-6 sm:grid-cols-2",children:M.map(e=>{if(!e)return null;let l=c[e.field_name]??e.field_default??"";return(0,t.jsx)(H,{field:e,currentValue:l},e.field_name)})})]})]})})]})]}),(0,t.jsxs)("div",{className:"border-t border-gray-200 pt-6 flex justify-end gap-3",children:[(0,t.jsx)(v.Button,{variant:"secondary",size:"sm",onClick:C,disabled:y,className:"text-sm",children:y?"Testing...":"Test Connection"}),(0,t.jsx)(v.Button,{size:"sm",onClick:S,disabled:_,className:"text-sm font-medium",children:_?"Saving...":"Save Changes"})]})]})},K=e=>{if(e)return e.toISOString().split("T")[0]};function G(e){return new Intl.NumberFormat("en-US",{maximumFractionDigits:0,notation:"compact",compactDisplay:"short"}).format(e)}e.s(["default",0,({accessToken:e,token:v,userRole:w,userID:_,premiumUser:N})=>{let[k,C]=(0,p.useState)([]),[S,T]=(0,p.useState)([]),[E,A]=(0,p.useState)([]),[P,D]=(0,p.useState)([]),[M,B]=(0,p.useState)("0"),[O,F]=(0,p.useState)("0"),[R,L]=(0,p.useState)("0"),[z,U]=(0,p.useState)({from:new Date(Date.now()-6048e5),to:new Date}),[H,V]=(0,p.useState)(""),[$,W]=(0,p.useState)("");(0,p.useEffect)(()=>{e&&z&&((async()=>{D(await (0,j.adminGlobalCacheActivity)(e,K(z.from),K(z.to)))})(),V(new Date().toLocaleString()))},[e]);let J=Array.from(new Set(P.map(e=>e?.api_key??""))),Y=Array.from(new Set(P.map(e=>e?.model??"")));Array.from(new Set(P.map(e=>e?.call_type??"")));let Q=async(t,l)=>{t&&l&&e&&D(await (0,j.adminGlobalCacheActivity)(e,K(t),K(l)))};(0,p.useEffect)(()=>{console.log("DATA IN CACHE DASHBOARD",P);let e=P;S.length>0&&(e=e.filter(e=>S.includes(e.api_key))),E.length>0&&(e=e.filter(e=>E.includes(e.model))),console.log("before processed data in cache dashboard",e);let t=0,l=0,a=0,s=e.reduce((e,s)=>{console.log("Processing item:",s),s.call_type||(console.log("Item has no call_type:",s),s.call_type="Unknown"),t+=(s.total_rows||0)-(s.cache_hit_true_rows||0),l+=s.cache_hit_true_rows||0,a+=s.cached_completion_tokens||0;let r=e.find(e=>e.name===s.call_type);return r?(r["LLM API requests"]+=(s.total_rows||0)-(s.cache_hit_true_rows||0),r["Cache hit"]+=s.cache_hit_true_rows||0,r["Cached Completion Tokens"]+=s.cached_completion_tokens||0,r["Generated Completion Tokens"]+=s.generated_completion_tokens||0):e.push({name:s.call_type,"LLM API requests":(s.total_rows||0)-(s.cache_hit_true_rows||0),"Cache hit":s.cache_hit_true_rows||0,"Cached Completion Tokens":s.cached_completion_tokens||0,"Generated Completion Tokens":s.generated_completion_tokens||0}),e},[]);B(G(l)),F(G(a));let r=l+t;r>0?L((l/r*100).toFixed(2)):L("0"),C(s),console.log("PROCESSED DATA IN CACHE DASHBOARD",s)},[S,E,z,P]);let X=async()=>{try{f.default.info("Running cache health check..."),W("");let t=await (0,j.cachingHealthCheckCall)(null!==e?e:"");console.log("CACHING HEALTH CHECK RESPONSE",t),W(t)}catch(t){let e;if(console.error("Error running health check:",t),t&&t.message)try{let l=JSON.parse(t.message);l.error&&(l=l.error),e=l}catch(l){e={message:t.message}}else e={message:"Unknown error occurred"};W({error:e})}};return(0,t.jsxs)(u.TabGroup,{className:"gap-2 p-8 h-full w-full mt-2 mb-8",children:[(0,t.jsxs)(m.TabList,{className:"flex justify-between mt-2 w-full items-center",children:[(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)(d.Tab,{children:"Cache Analytics"}),(0,t.jsx)(d.Tab,{children:"Cache Health"}),(0,t.jsx)(d.Tab,{children:"Cache Settings"})]}),(0,t.jsxs)("div",{className:"flex items-center space-x-2",children:[H&&(0,t.jsxs)(x.Text,{children:["Last Refreshed: ",H]}),(0,t.jsx)(i.Icon,{icon:y.RefreshIcon,variant:"shadow",size:"xs",className:"self-center",onClick:()=>{V(new Date().toLocaleString())}})]})]}),(0,t.jsxs)(g.TabPanels,{children:[(0,t.jsx)(h.TabPanel,{children:(0,t.jsxs)(a.Card,{children:[(0,t.jsxs)(r.Grid,{numItems:3,className:"gap-4 mt-4",children:[(0,t.jsx)(s.Col,{children:(0,t.jsx)(n.MultiSelect,{placeholder:"Select Virtual Keys",value:S,onValueChange:T,children:J.map(e=>(0,t.jsx)(o.MultiSelectItem,{value:e,children:e},e))})}),(0,t.jsx)(s.Col,{children:(0,t.jsx)(n.MultiSelect,{placeholder:"Select Models",value:E,onValueChange:A,children:Y.map(e=>(0,t.jsx)(o.MultiSelectItem,{value:e,children:e},e))})}),(0,t.jsx)(s.Col,{children:(0,t.jsx)(b.default,{value:z,onValueChange:e=>{U(e),Q(e.from,e.to)}})})]}),(0,t.jsxs)("div",{className:"grid grid-cols-1 gap-6 sm:grid-cols-2 lg:grid-cols-3 mt-4",children:[(0,t.jsxs)(a.Card,{children:[(0,t.jsx)("p",{className:"text-tremor-default font-medium text-tremor-content dark:text-dark-tremor-content",children:"Cache Hit Ratio"}),(0,t.jsx)("div",{className:"mt-2 flex items-baseline space-x-2.5",children:(0,t.jsxs)("p",{className:"text-tremor-metric font-semibold text-tremor-content-strong dark:text-dark-tremor-content-strong",children:[R,"%"]})})]}),(0,t.jsxs)(a.Card,{children:[(0,t.jsx)("p",{className:"text-tremor-default font-medium text-tremor-content dark:text-dark-tremor-content",children:"Cache Hits"}),(0,t.jsx)("div",{className:"mt-2 flex items-baseline space-x-2.5",children:(0,t.jsx)("p",{className:"text-tremor-metric font-semibold text-tremor-content-strong dark:text-dark-tremor-content-strong",children:M})})]}),(0,t.jsxs)(a.Card,{children:[(0,t.jsx)("p",{className:"text-tremor-default font-medium text-tremor-content dark:text-dark-tremor-content",children:"Cached Tokens"}),(0,t.jsx)("div",{className:"mt-2 flex items-baseline space-x-2.5",children:(0,t.jsx)("p",{className:"text-tremor-metric font-semibold text-tremor-content-strong dark:text-dark-tremor-content-strong",children:O})})]})]}),(0,t.jsx)(c.Subtitle,{className:"mt-4",children:"Cache Hits vs API Requests"}),(0,t.jsx)(l.BarChart,{title:"Cache Hits vs API Requests",data:k,stack:!0,index:"name",valueFormatter:G,categories:["LLM API requests","Cache hit"],colors:["sky","teal"],yAxisWidth:48}),(0,t.jsx)(c.Subtitle,{className:"mt-4",children:"Cached Completion Tokens vs Generated Completion Tokens"}),(0,t.jsx)(l.BarChart,{className:"mt-6",data:k,stack:!0,index:"name",valueFormatter:G,categories:["Generated Completion Tokens","Cached Completion Tokens"],colors:["sky","teal"],yAxisWidth:48})]})}),(0,t.jsx)(h.TabPanel,{children:(0,t.jsx)(I,{accessToken:e,healthCheckResponse:$,runCachingHealthCheck:X})}),(0,t.jsx)(h.TabPanel,{children:(0,t.jsx)(q,{accessToken:e,userRole:w,userID:_})})]})]})}],559061)}]); \ No newline at end of file +print(completion.choices[0].message)`;e.s(["default",0,({accessToken:e})=>{let[N,T]=(0,p.useState)(!1),[I,E]=(0,p.useState)(!1),[A,P]=(0,p.useState)(null),[D,M]=(0,p.useState)(!1),{data:B=[]}=(()=>{let{accessToken:e}=(0,C.default)();return(0,v.useQuery)({queryKey:S.list({}),queryFn:async()=>(await (0,k.getBudgetList)(e)??[]).filter(e=>null!=e),enabled:!!e})})(),O=(()=>{let{accessToken:e}=(0,C.default)(),t=(0,_.useQueryClient)();return(0,w.useMutation)({mutationFn:async t=>{if(!e)throw Error("Access token is required");return(0,k.budgetDeleteCall)(e,t)},onSuccess:()=>{t.invalidateQueries({queryKey:S.all})}})})(),H=async t=>{null!=e&&(P(t),E(!0))},V=async()=>{if(A&&null!=e)try{await O.mutateAsync(A.budget_id),j.default.success("Budget deleted.")}catch(e){console.error("Error deleting budget:",e),"function"==typeof j.default.fromBackend?j.default.fromBackend("Failed to delete budget"):j.default.info("Failed to delete budget")}finally{M(!1),P(null)}};return(0,t.jsxs)("div",{className:"w-full mx-auto flex-auto overflow-y-auto m-8 p-2",children:[(0,t.jsx)(l.Button,{size:"sm",variant:"primary",className:"mb-2",onClick:()=>T(!0),children:"+ Create Budget"}),(0,t.jsxs)(r.TabGroup,{children:[(0,t.jsxs)(m.TabList,{children:[(0,t.jsx)(s.Tab,{children:"Budgets"}),(0,t.jsx)(s.Tab,{children:"Examples"})]}),(0,t.jsxs)(g.TabPanels,{children:[(0,t.jsx)(h.TabPanel,{children:(0,t.jsxs)("div",{className:"mt-6",children:[(0,t.jsx)(F,{isModalVisible:N,setIsModalVisible:T}),A&&(0,t.jsx)(R,{isModalVisible:I,setIsModalVisible:E,existingBudget:A}),(0,t.jsxs)(a.Card,{children:[(0,t.jsx)(x.Text,{children:"Create a budget to assign to customers."}),(0,t.jsxs)(i.Table,{children:[(0,t.jsx)(c.TableHead,{children:(0,t.jsxs)(u.TableRow,{children:[(0,t.jsx)(d.TableHeaderCell,{children:"Budget ID"}),(0,t.jsx)(d.TableHeaderCell,{children:"Max Budget"}),(0,t.jsx)(d.TableHeaderCell,{children:"TPM"}),(0,t.jsx)(d.TableHeaderCell,{children:"RPM"})]})}),(0,t.jsx)(n.TableBody,{children:B.slice().sort((e,t)=>new Date(t.updated_at).getTime()-new Date(e.updated_at).getTime()).map(e=>(0,t.jsxs)(u.TableRow,{children:[(0,t.jsx)(o.TableCell,{children:e.budget_id}),(0,t.jsx)(o.TableCell,{children:e.max_budget?e.max_budget:"n/a"}),(0,t.jsx)(o.TableCell,{children:e.tpm_limit?e.tpm_limit:"n/a"}),(0,t.jsx)(o.TableCell,{children:e.rpm_limit?e.rpm_limit:"n/a"}),(0,t.jsx)(y.default,{variant:"Edit",tooltipText:"Edit budget",onClick:()=>H(e),dataTestId:"edit-budget-button"}),(0,t.jsx)(y.default,{variant:"Delete",tooltipText:"Delete budget",onClick:()=>{P(e),M(!0)},dataTestId:"delete-budget-button"})]},e.budget_id))})]})]}),(0,t.jsx)(b.default,{isOpen:D,title:"Delete Budget?",message:"Are you sure you want to delete this budget? This action cannot be undone.",resourceInformationTitle:"Budget Information",resourceInformation:[{label:"Budget ID",value:A?.budget_id,code:!0},{label:"Max Budget",value:A?.max_budget},{label:"TPM",value:A?.tpm_limit},{label:"RPM",value:A?.rpm_limit}],onCancel:()=>{M(!1)},onOk:V,confirmLoading:O.isPending})]})}),(0,t.jsx)(h.TabPanel,{children:(0,t.jsxs)("div",{className:"mt-6",children:[(0,t.jsx)(x.Text,{className:"text-base",children:"How to use budget id"}),(0,t.jsxs)(r.TabGroup,{children:[(0,t.jsxs)(m.TabList,{children:[(0,t.jsx)(s.Tab,{children:"Assign Budget to Customer"}),(0,t.jsx)(s.Tab,{children:"Test it (Curl)"}),(0,t.jsx)(s.Tab,{children:"Test it (OpenAI SDK)"})]}),(0,t.jsxs)(g.TabPanels,{children:[(0,t.jsx)(h.TabPanel,{children:(0,t.jsx)(f.Prism,{language:"bash",children:L})}),(0,t.jsx)(h.TabPanel,{children:(0,t.jsx)(f.Prism,{language:"bash",children:z})}),(0,t.jsx)(h.TabPanel,{children:(0,t.jsx)(f.Prism,{language:"python",children:U})})]})]})]})})]})]})]})}],646050)},345244,e=>{"use strict";var t=e.i(843476),l=e.i(271645),a=e.i(752978),s=e.i(994388),r=e.i(309426),i=e.i(599724),n=e.i(350967),o=e.i(278587),c=e.i(304967),d=e.i(629569),u=e.i(389083),m=e.i(677667),h=e.i(898667),g=e.i(130643),x=e.i(808613),p=e.i(311451),f=e.i(199133),b=e.i(592968),y=e.i(827252),j=e.i(702597),v=e.i(355619),w=e.i(764205),_=e.i(727749),N=e.i(435451),k=e.i(860585),C=e.i(500330),S=e.i(678784),T=e.i(118366),I=e.i(464571);let E=({tagId:e,onClose:a,accessToken:r,is_admin:n,editTag:o})=>{let[E]=x.Form.useForm(),[A,P]=(0,l.useState)(null),[D,M]=(0,l.useState)(o),[B,O]=(0,l.useState)([]),[F,R]=(0,l.useState)({}),L=async(e,t)=>{await (0,C.copyToClipboard)(e)&&(R(e=>({...e,[t]:!0})),setTimeout(()=>{R(e=>({...e,[t]:!1}))},2e3))},z=async()=>{if(r)try{let t=(await (0,w.tagInfoCall)(r,[e]))[e];t&&(P(t),o&&E.setFieldsValue({name:t.name,description:t.description,models:t.models,max_budget:t.litellm_budget_table?.max_budget,budget_duration:t.litellm_budget_table?.budget_duration}))}catch(e){console.error("Error fetching tag details:",e),_.default.fromBackend("Error fetching tag details: "+e)}};(0,l.useEffect)(()=>{z()},[e,r]),(0,l.useEffect)(()=>{r&&(0,j.fetchUserModels)("dummy-user","Admin",r,O)},[r]);let U=async e=>{if(r)try{await (0,w.tagUpdateCall)(r,{name:e.name,description:e.description,models:e.models,max_budget:e.max_budget,tpm_limit:e.tpm_limit,rpm_limit:e.rpm_limit,budget_duration:e.budget_duration}),_.default.success("Tag updated successfully"),M(!1),z()}catch(e){console.error("Error updating tag:",e),_.default.fromBackend("Error updating tag: "+e)}};return A?(0,t.jsxs)("div",{className:"p-4",children:[(0,t.jsxs)("div",{className:"flex justify-between items-center mb-6",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)(s.Button,{onClick:a,className:"mb-4",children:"← Back to Tags"}),(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(i.Text,{className:"font-medium",children:"Tag Name:"}),(0,t.jsx)("span",{className:"font-mono px-2 py-1 bg-gray-100 rounded text-sm border border-gray-200",children:A.name}),(0,t.jsx)(I.Button,{type:"text",size:"small",icon:F["tag-name"]?(0,t.jsx)(S.CheckIcon,{size:12}):(0,t.jsx)(T.CopyIcon,{size:12}),onClick:()=>L(A.name,"tag-name"),className:`transition-all duration-200 ${F["tag-name"]?"text-green-600 bg-green-50 border-green-200":"text-gray-500 hover:text-gray-700 hover:bg-gray-100"}`})]}),(0,t.jsx)(i.Text,{className:"text-gray-500",children:A.description||"No description"})]}),n&&!D&&(0,t.jsx)(s.Button,{onClick:()=>M(!0),children:"Edit Tag"})]}),D?(0,t.jsx)(c.Card,{children:(0,t.jsxs)(x.Form,{form:E,onFinish:U,layout:"vertical",initialValues:A,children:[(0,t.jsx)(x.Form.Item,{label:"Tag Name",name:"name",rules:[{required:!0,message:"Please input a tag name"}],children:(0,t.jsx)(p.Input,{className:"rounded-md border-gray-300"})}),(0,t.jsx)(x.Form.Item,{label:"Description",name:"description",children:(0,t.jsx)(p.Input.TextArea,{rows:4})}),(0,t.jsx)(x.Form.Item,{label:(0,t.jsxs)("span",{children:["Allowed Models",(0,t.jsx)(b.Tooltip,{title:"Select which models are allowed to process this type of data",children:(0,t.jsx)(y.InfoCircleOutlined,{style:{marginLeft:"4px"}})})]}),name:"models",children:(0,t.jsx)(f.Select,{mode:"multiple",placeholder:"Select Models",children:B.map(e=>(0,t.jsx)(f.Select.Option,{value:e,children:(0,v.getModelDisplayName)(e)},e))})}),(0,t.jsxs)(m.Accordion,{className:"mt-4 mb-4",children:[(0,t.jsx)(h.AccordionHeader,{children:(0,t.jsx)(d.Title,{className:"m-0",children:"Budget & Rate Limits"})}),(0,t.jsxs)(g.AccordionBody,{children:[(0,t.jsx)(x.Form.Item,{label:(0,t.jsxs)("span",{children:["Max Budget (USD)"," ",(0,t.jsx)(b.Tooltip,{title:"Maximum amount in USD this tag can spend",children:(0,t.jsx)(y.InfoCircleOutlined,{style:{marginLeft:"4px"}})})]}),name:"max_budget",children:(0,t.jsx)(N.default,{step:.01,precision:2,width:200})}),(0,t.jsx)(x.Form.Item,{label:(0,t.jsxs)("span",{children:["Reset Budget"," ",(0,t.jsx)(b.Tooltip,{title:"How often the budget should reset",children:(0,t.jsx)(y.InfoCircleOutlined,{style:{marginLeft:"4px"}})})]}),name:"budget_duration",children:(0,t.jsx)(k.default,{onChange:e=>E.setFieldValue("budget_duration",e)})}),(0,t.jsx)("div",{className:"mt-4 p-3 bg-gray-50 rounded-md border border-gray-200",children:(0,t.jsxs)("p",{className:"text-sm text-gray-600",children:["TPM/RPM limits for tags are not currently supported. If you need this feature, please"," ",(0,t.jsx)("a",{href:"https://github.com/BerriAI/litellm/issues/new",target:"_blank",rel:"noopener noreferrer",className:"text-blue-600 hover:text-blue-800 underline",children:"create a GitHub issue"}),"."]})})]})]}),(0,t.jsxs)("div",{className:"flex justify-end space-x-2",children:[(0,t.jsx)(s.Button,{onClick:()=>M(!1),children:"Cancel"}),(0,t.jsx)(s.Button,{type:"submit",children:"Save Changes"})]})]})}):(0,t.jsxs)("div",{className:"space-y-6",children:[(0,t.jsxs)(c.Card,{children:[(0,t.jsx)(d.Title,{children:"Tag Details"}),(0,t.jsxs)("div",{className:"space-y-4 mt-4",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)(i.Text,{className:"font-medium",children:"Name"}),(0,t.jsx)(i.Text,{children:A.name})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(i.Text,{className:"font-medium",children:"Description"}),(0,t.jsx)(i.Text,{children:A.description||"-"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(i.Text,{className:"font-medium",children:"Allowed Models"}),(0,t.jsx)("div",{className:"flex flex-wrap gap-2 mt-2",children:A.models&&0!==A.models.length?A.models.map(e=>(0,t.jsx)(u.Badge,{color:"blue",children:(0,t.jsx)(b.Tooltip,{title:`ID: ${e}`,children:A.model_info?.[e]||e})},e)):(0,t.jsx)(u.Badge,{color:"red",children:"All Models"})})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(i.Text,{className:"font-medium",children:"Created"}),(0,t.jsx)(i.Text,{children:A.created_at?new Date(A.created_at).toLocaleString():"-"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(i.Text,{className:"font-medium",children:"Last Updated"}),(0,t.jsx)(i.Text,{children:A.updated_at?new Date(A.updated_at).toLocaleString():"-"})]})]})]}),A.litellm_budget_table&&(0,t.jsxs)(c.Card,{children:[(0,t.jsx)(d.Title,{children:"Budget & Rate Limits"}),(0,t.jsxs)("div",{className:"space-y-4 mt-4",children:[void 0!==A.litellm_budget_table.max_budget&&null!==A.litellm_budget_table.max_budget&&(0,t.jsxs)("div",{children:[(0,t.jsx)(i.Text,{className:"font-medium",children:"Max Budget"}),(0,t.jsxs)(i.Text,{children:["$",A.litellm_budget_table.max_budget]})]}),A.litellm_budget_table.budget_duration&&(0,t.jsxs)("div",{children:[(0,t.jsx)(i.Text,{className:"font-medium",children:"Budget Duration"}),(0,t.jsx)(i.Text,{children:A.litellm_budget_table.budget_duration})]}),void 0!==A.litellm_budget_table.tpm_limit&&null!==A.litellm_budget_table.tpm_limit&&(0,t.jsxs)("div",{children:[(0,t.jsx)(i.Text,{className:"font-medium",children:"TPM Limit"}),(0,t.jsx)(i.Text,{children:A.litellm_budget_table.tpm_limit.toLocaleString()})]}),void 0!==A.litellm_budget_table.rpm_limit&&null!==A.litellm_budget_table.rpm_limit&&(0,t.jsxs)("div",{children:[(0,t.jsx)(i.Text,{className:"font-medium",children:"RPM Limit"}),(0,t.jsx)(i.Text,{children:A.litellm_budget_table.rpm_limit.toLocaleString()})]})]})]})]})]}):(0,t.jsx)("div",{children:"Loading..."})};var A=e.i(871943),P=e.i(360820),D=e.i(591935),M=e.i(94629),B=e.i(68155),O=e.i(152990),F=e.i(682830),R=e.i(269200),L=e.i(942232),z=e.i(977572),U=e.i(427612),H=e.i(64848),V=e.i(496020);let $="This is just a spend tag that was passed dynamically in a request. It does not control any LLM models.",q=({data:e,onEdit:r,onDelete:n,onSelectTag:o})=>{let[c,d]=l.default.useState([{id:"created_at",desc:!0}]),m=[{header:"Tag Name",accessorKey:"name",cell:({row:e})=>{let l=e.original,a=l.description===$;return(0,t.jsx)("div",{className:"overflow-hidden",children:(0,t.jsx)(b.Tooltip,{title:a?"You cannot view the information of a dynamically generated spend tag":l.name,children:(0,t.jsx)(s.Button,{size:"xs",variant:"light",className:"font-mono text-blue-500 bg-blue-50 hover:bg-blue-100 text-xs font-normal px-2 py-0.5",onClick:()=>o(l.name),disabled:a,children:l.name})})})}},{header:"Description",accessorKey:"description",cell:({row:e})=>{let l=e.original;return(0,t.jsx)(b.Tooltip,{title:l.description,children:(0,t.jsx)("span",{className:"text-xs",children:l.description||"-"})})}},{header:"Allowed Models",accessorKey:"models",cell:({row:e})=>{let l=e.original;return(0,t.jsx)("div",{style:{display:"flex",flexDirection:"column"},children:l?.models?.length===0?(0,t.jsx)(u.Badge,{size:"xs",className:"mb-1",color:"red",children:"All Models"}):l?.models?.map(e=>(0,t.jsx)(u.Badge,{size:"xs",className:"mb-1",color:"blue",children:(0,t.jsx)(b.Tooltip,{title:`ID: ${e}`,children:(0,t.jsx)(i.Text,{children:l.model_info?.[e]||e})})},e))})}},{header:"Created",accessorKey:"created_at",sortingFn:"datetime",cell:({row:e})=>{let l=e.original;return(0,t.jsx)("span",{className:"text-xs",children:new Date(l.created_at).toLocaleDateString()})}},{id:"actions",header:"Actions",cell:({row:e})=>{let l=e.original,s=l.description===$;return(0,t.jsxs)("div",{className:"flex space-x-2",children:[s?(0,t.jsx)(b.Tooltip,{title:"Dynamically generated spend tags cannot be edited",children:(0,t.jsx)(a.Icon,{icon:D.PencilAltIcon,size:"sm",className:"opacity-50 cursor-not-allowed","aria-label":"Edit tag (disabled)"})}):(0,t.jsx)(b.Tooltip,{title:"Edit tag",children:(0,t.jsx)(a.Icon,{icon:D.PencilAltIcon,size:"sm",onClick:()=>r(l),className:"cursor-pointer hover:text-blue-500"})}),s?(0,t.jsx)(b.Tooltip,{title:"Dynamically generated spend tags cannot be deleted",children:(0,t.jsx)(a.Icon,{icon:B.TrashIcon,size:"sm",className:"opacity-50 cursor-not-allowed","aria-label":"Delete tag (disabled)"})}):(0,t.jsx)(b.Tooltip,{title:"Delete tag",children:(0,t.jsx)(a.Icon,{icon:B.TrashIcon,size:"sm",onClick:()=>n(l.name),className:"cursor-pointer hover:text-red-500"})})]})}}],h=(0,O.useReactTable)({data:e,columns:m,state:{sorting:c},onSortingChange:d,getCoreRowModel:(0,F.getCoreRowModel)(),getSortedRowModel:(0,F.getSortedRowModel)(),enableSorting:!0});return(0,t.jsx)("div",{className:"rounded-lg custom-border relative",children:(0,t.jsx)("div",{className:"overflow-x-auto",children:(0,t.jsxs)(R.Table,{className:"[&_td]:py-0.5 [&_th]:py-1",children:[(0,t.jsx)(U.TableHead,{children:h.getHeaderGroups().map(e=>(0,t.jsx)(V.TableRow,{children:e.headers.map(e=>(0,t.jsx)(H.TableHeaderCell,{className:`py-1 h-8 ${"actions"===e.id?"sticky right-0 bg-white shadow-[-4px_0_8px_-6px_rgba(0,0,0,0.1)]":""}`,onClick:e.column.getToggleSortingHandler(),children:(0,t.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,t.jsx)("div",{className:"flex items-center",children:e.isPlaceholder?null:(0,O.flexRender)(e.column.columnDef.header,e.getContext())}),"actions"!==e.id&&(0,t.jsx)("div",{className:"w-4",children:e.column.getIsSorted()?({asc:(0,t.jsx)(P.ChevronUpIcon,{className:"h-4 w-4 text-blue-500"}),desc:(0,t.jsx)(A.ChevronDownIcon,{className:"h-4 w-4 text-blue-500"})})[e.column.getIsSorted()]:(0,t.jsx)(M.SwitchVerticalIcon,{className:"h-4 w-4 text-gray-400"})})]})},e.id))},e.id))}),(0,t.jsx)(L.TableBody,{children:h.getRowModel().rows.length>0?h.getRowModel().rows.map(e=>(0,t.jsx)(V.TableRow,{className:"h-8",children:e.getVisibleCells().map(e=>(0,t.jsx)(z.TableCell,{className:`py-0.5 max-h-8 overflow-hidden text-ellipsis whitespace-nowrap ${"actions"===e.column.id?"sticky right-0 bg-white shadow-[-4px_0_8px_-6px_rgba(0,0,0,0.1)]":""}`,children:(0,O.flexRender)(e.column.columnDef.cell,e.getContext())},e.id))},e.id)):(0,t.jsx)(V.TableRow,{children:(0,t.jsx)(z.TableCell,{colSpan:m.length,className:"h-8 text-center",children:(0,t.jsx)("div",{className:"text-center text-gray-500",children:(0,t.jsx)("p",{children:"No tags found"})})})})})]})})})};var K=e.i(779241),G=e.i(212931);let W=({visible:e,onCancel:l,onSubmit:a,availableModels:r})=>{let[i]=x.Form.useForm();return(0,t.jsx)(G.Modal,{title:"Create New Tag",open:e,width:800,footer:null,onCancel:()=>{i.resetFields(),l()},children:(0,t.jsxs)(x.Form,{form:i,onFinish:e=>{a(e),i.resetFields()},labelCol:{span:8},wrapperCol:{span:16},labelAlign:"left",children:[(0,t.jsx)(x.Form.Item,{label:"Tag Name",name:"tag_name",rules:[{required:!0,message:"Please input a tag name"}],children:(0,t.jsx)(K.TextInput,{})}),(0,t.jsx)(x.Form.Item,{label:"Description",name:"description",children:(0,t.jsx)(p.Input.TextArea,{rows:4})}),(0,t.jsx)(x.Form.Item,{label:(0,t.jsxs)("span",{children:["Allowed Models",(0,t.jsx)(b.Tooltip,{title:"Select which models are allowed to process requests from this tag",children:(0,t.jsx)(y.InfoCircleOutlined,{style:{marginLeft:"4px"}})})]}),name:"allowed_llms",children:(0,t.jsx)(f.Select,{mode:"multiple",placeholder:"Select Models",children:r.map(e=>(0,t.jsx)(f.Select.Option,{value:e.model_info.id,children:(0,t.jsxs)("div",{children:[(0,t.jsx)("span",{children:e.model_name}),(0,t.jsxs)("span",{className:"text-gray-400 ml-2",children:["(",e.model_info.id,")"]})]})},e.model_info.id))})}),(0,t.jsxs)(m.Accordion,{className:"mt-4 mb-4",children:[(0,t.jsx)(h.AccordionHeader,{children:(0,t.jsx)(d.Title,{className:"m-0",children:"Budget & Rate Limits (Optional)"})}),(0,t.jsxs)(g.AccordionBody,{children:[(0,t.jsx)(x.Form.Item,{className:"mt-4",label:(0,t.jsxs)("span",{children:["Max Budget (USD)"," ",(0,t.jsx)(b.Tooltip,{title:"Maximum amount in USD this tag can spend. When reached, requests with this tag will be blocked",children:(0,t.jsx)(y.InfoCircleOutlined,{style:{marginLeft:"4px"}})})]}),name:"max_budget",children:(0,t.jsx)(N.default,{step:.01,precision:2,width:200})}),(0,t.jsx)(x.Form.Item,{className:"mt-4",label:(0,t.jsxs)("span",{children:["Reset Budget"," ",(0,t.jsx)(b.Tooltip,{title:"How often the budget should reset. For example, setting 'daily' will reset the budget every 24 hours",children:(0,t.jsx)(y.InfoCircleOutlined,{style:{marginLeft:"4px"}})})]}),name:"budget_duration",children:(0,t.jsx)(k.default,{onChange:e=>i.setFieldValue("budget_duration",e)})}),(0,t.jsx)("div",{className:"mt-4 p-3 bg-gray-50 rounded-md border border-gray-200",children:(0,t.jsxs)("p",{className:"text-sm text-gray-600",children:["TPM/RPM limits for tags are not currently supported. If you need this feature, please"," ",(0,t.jsx)("a",{href:"https://github.com/BerriAI/litellm/issues/new",target:"_blank",rel:"noopener noreferrer",className:"text-blue-600 hover:text-blue-800 underline",children:"create a GitHub issue"}),"."]})})]})]}),(0,t.jsx)("div",{style:{textAlign:"right",marginTop:"10px"},children:(0,t.jsx)(s.Button,{type:"submit",children:"Create Tag"})})]})})};e.s(["default",0,({accessToken:e,userID:c,userRole:d})=>{let[u,m]=(0,l.useState)([]),[h,g]=(0,l.useState)(!1),[x,p]=(0,l.useState)(null),[f,b]=(0,l.useState)(!1),[y,j]=(0,l.useState)(!1),[v,N]=(0,l.useState)(null),[k,C]=(0,l.useState)(""),[S,T]=(0,l.useState)([]),I=async()=>{if(e)try{let t=await (0,w.tagListCall)(e);console.log("List tags response:",t),m(Object.values(t))}catch(e){console.error("Error fetching tags:",e),_.default.fromBackend("Error fetching tags: "+e)}},A=async t=>{if(e)try{await (0,w.tagCreateCall)(e,{name:t.tag_name,description:t.description,models:t.allowed_llms,max_budget:t.max_budget,soft_budget:t.soft_budget,tpm_limit:t.tpm_limit,rpm_limit:t.rpm_limit,budget_duration:t.budget_duration}),_.default.success("Tag created successfully"),g(!1),I()}catch(e){console.error("Error creating tag:",e),_.default.fromBackend("Error creating tag: "+e)}},P=async e=>{N(e),j(!0)},D=async()=>{if(e&&v){try{await (0,w.tagDeleteCall)(e,v),_.default.success("Tag deleted successfully"),I()}catch(e){console.error("Error deleting tag:",e),_.default.fromBackend("Error deleting tag: "+e)}j(!1),N(null)}};return(0,l.useEffect)(()=>{c&&d&&e&&(async()=>{try{let t=await (0,w.modelInfoCall)(e,c,d);t&&t.data&&T(t.data)}catch(e){console.error("Error fetching models:",e),_.default.fromBackend("Error fetching models: "+e)}})()},[e,c,d]),(0,l.useEffect)(()=>{I()},[e]),(0,t.jsx)("div",{className:"w-full mx-4 h-[75vh]",children:x?(0,t.jsx)(E,{tagId:x,onClose:()=>{p(null),b(!1)},accessToken:e,is_admin:"Admin"===d,editTag:f}):(0,t.jsxs)("div",{className:"gap-2 p-8 h-[75vh] w-full mt-2",children:[(0,t.jsxs)("div",{className:"flex justify-between mt-2 w-full items-center mb-4",children:[(0,t.jsx)("h1",{children:"Tag Management"}),(0,t.jsxs)("div",{className:"flex items-center space-x-2",children:[k&&(0,t.jsxs)(i.Text,{children:["Last Refreshed: ",k]}),(0,t.jsx)(a.Icon,{icon:o.RefreshIcon,variant:"shadow",size:"xs",className:"self-center cursor-pointer",onClick:()=>{I(),C(new Date().toLocaleString())}})]})]}),(0,t.jsxs)(i.Text,{className:"mb-4",children:["Click on a tag name to view and edit its details.",(0,t.jsxs)("p",{children:["You can use tags to restrict the usage of certain LLMs based on tags passed in the request. Read more about tag routing"," ",(0,t.jsx)("a",{href:"https://docs.litellm.ai/docs/proxy/tag_routing",target:"_blank",rel:"noopener noreferrer",children:"here"}),"."]})]}),(0,t.jsx)(s.Button,{className:"mb-4",onClick:()=>g(!0),children:"+ Create New Tag"}),(0,t.jsx)(n.Grid,{numItems:1,className:"gap-2 pt-2 pb-2 h-[75vh] w-full mt-2",children:(0,t.jsx)(r.Col,{numColSpan:1,children:(0,t.jsx)(q,{data:u,onEdit:e=>{p(e.name),b(!0)},onDelete:P,onSelectTag:p})})}),(0,t.jsx)(W,{visible:h,onCancel:()=>g(!1),onSubmit:A,availableModels:S}),y&&(0,t.jsx)("div",{className:"fixed z-10 inset-0 overflow-y-auto",children:(0,t.jsxs)("div",{className:"flex items-end justify-center min-h-screen pt-4 px-4 pb-20 text-center sm:block sm:p-0",children:[(0,t.jsx)("div",{className:"fixed inset-0 transition-opacity","aria-hidden":"true",children:(0,t.jsx)("div",{className:"absolute inset-0 bg-gray-500 opacity-75"})}),(0,t.jsxs)("div",{className:"inline-block align-bottom bg-white rounded-lg text-left overflow-hidden shadow-xl transform transition-all sm:my-8 sm:align-middle sm:max-w-lg sm:w-full",children:[(0,t.jsx)("div",{className:"bg-white px-4 pt-5 pb-4 sm:p-6 sm:pb-4",children:(0,t.jsx)("div",{className:"sm:flex sm:items-start",children:(0,t.jsxs)("div",{className:"mt-3 text-center sm:mt-0 sm:ml-4 sm:text-left",children:[(0,t.jsx)("h3",{className:"text-lg leading-6 font-medium text-gray-900",children:"Delete Tag"}),(0,t.jsx)("div",{className:"mt-2",children:(0,t.jsx)("p",{className:"text-sm text-gray-500",children:"Are you sure you want to delete this tag?"})})]})})}),(0,t.jsxs)("div",{className:"bg-gray-50 px-4 py-3 sm:px-6 sm:flex sm:flex-row-reverse",children:[(0,t.jsx)(s.Button,{onClick:D,color:"red",className:"ml-2",children:"Delete"}),(0,t.jsx)(s.Button,{onClick:()=>{j(!1),N(null)},children:"Cancel"})]})]})]})})]})})}],345244)},735042,e=>{"use strict";e.i(247167);var t=e.i(843476),l=e.i(584935),a=e.i(290571),s=e.i(271645),r=e.i(95779),i=e.i(444755),n=e.i(673706);let o=(0,n.makeClassName)("BarList");function c(e,t){let{data:l=[],color:c,valueFormatter:d=n.defaultValueFormatter,showAnimation:u=!1,onValueChange:m,sortOrder:h="descending",className:g}=e,x=(0,a.__rest)(e,["data","color","valueFormatter","showAnimation","onValueChange","sortOrder","className"]),p=m?"button":"div",f=s.default.useMemo(()=>"none"===h?l:[...l].sort((e,t)=>"ascending"===h?e.value-t.value:t.value-e.value),[l,h]),b=s.default.useMemo(()=>{let e=Math.max(...f.map(e=>e.value),0);return f.map(t=>0===t.value?0:Math.max(t.value/e*100,2))},[f]);return s.default.createElement("div",Object.assign({ref:t,className:(0,i.tremorTwMerge)(o("root"),"flex justify-between space-x-6",g),"aria-sort":h},x),s.default.createElement("div",{className:(0,i.tremorTwMerge)(o("bars"),"relative w-full space-y-1.5")},f.map((e,t)=>{var l,a,d;let h=e.icon;return s.default.createElement(p,{key:null!=(l=e.key)?l:t,onClick:()=>{null==m||m(e)},className:(0,i.tremorTwMerge)(o("bar"),"group w-full flex items-center rounded-tremor-small",m?["cursor-pointer","hover:bg-tremor-background-muted dark:hover:bg-dark-tremor-background-subtle/40"]:"")},s.default.createElement("div",{className:(0,i.tremorTwMerge)("flex items-center rounded transition-all bg-opacity-40","h-8",e.color||c?[(0,n.getColorClassNames)(null!=(a=e.color)?a:c,r.colorPalette.background).bgColor,m?"group-hover:bg-opacity-30":""]:"bg-tremor-brand-subtle dark:bg-dark-tremor-brand-subtle/60",!m||e.color||c?"":"group-hover:bg-tremor-brand-subtle/30 group-hover:dark:bg-dark-tremor-brand-subtle/70",t===f.length-1?"mb-0":"",u?"duration-500":""),style:{width:`${b[t]}%`,transition:u?"all 1s":""}},s.default.createElement("div",{className:(0,i.tremorTwMerge)("absolute left-2 pr-4 flex max-w-full")},h?s.default.createElement(h,{className:(0,i.tremorTwMerge)(o("barIcon"),"flex-none h-5 w-5 mr-2","text-tremor-content","dark:text-dark-tremor-content")}):null,e.href?s.default.createElement("a",{href:e.href,target:null!=(d=e.target)?d:"_blank",rel:"noreferrer",className:(0,i.tremorTwMerge)(o("barLink"),"whitespace-nowrap hover:underline truncate text-tremor-default",m?"cursor-pointer":"","text-tremor-content-emphasis","dark:text-dark-tremor-content-emphasis"),onClick:e=>e.stopPropagation()},e.name):s.default.createElement("p",{className:(0,i.tremorTwMerge)(o("barText"),"whitespace-nowrap truncate text-tremor-default","text-tremor-content-emphasis","dark:text-dark-tremor-content-emphasis")},e.name))))})),s.default.createElement("div",{className:o("labels")},f.map((e,t)=>{var l;return s.default.createElement("div",{key:null!=(l=e.key)?l:t,className:(0,i.tremorTwMerge)(o("labelWrapper"),"flex justify-end items-center","h-8",t===f.length-1?"mb-0":"mb-1.5")},s.default.createElement("p",{className:(0,i.tremorTwMerge)(o("labelText"),"whitespace-nowrap leading-none truncate text-tremor-default","text-tremor-content-emphasis","dark:text-dark-tremor-content-emphasis")},d(e.value)))})))}c.displayName="BarList";let d=s.default.forwardRef(c);var u=e.i(304967),m=e.i(629569),h=e.i(269200),g=e.i(427612),x=e.i(64848),p=e.i(496020),f=e.i(977572),b=e.i(942232),y=e.i(37091),j=e.i(617802),v=e.i(144267),w=e.i(350967),_=e.i(309426),N=e.i(599724),k=e.i(404206),C=e.i(723731),S=e.i(653824),T=e.i(881073),I=e.i(197647),E=e.i(206929),A=e.i(35983),P=e.i(413990),D=e.i(476961),M=e.i(994388),B=e.i(621642),O=e.i(25080),F=e.i(764205),R=e.i(1023),L=e.i(500330);console.log("process.env.NODE_ENV","production");let z=e=>null!==e&&("Admin"===e||"Admin Viewer"===e);e.s(["default",0,({accessToken:e,token:a,userRole:r,userID:i,keys:n,premiumUser:o})=>{let c=new Date,[U,H]=(0,s.useState)([]),[V,$]=(0,s.useState)([]),[q,K]=(0,s.useState)([]),[G,W]=(0,s.useState)([]),[J,Y]=(0,s.useState)([]),[Q,X]=(0,s.useState)([]),[Z,ee]=(0,s.useState)([]),[et,el]=(0,s.useState)([]),[ea,es]=(0,s.useState)([]),[er,ei]=(0,s.useState)([]),[en,eo]=(0,s.useState)({}),[ec,ed]=(0,s.useState)([]),[eu,em]=(0,s.useState)(""),[eh,eg]=(0,s.useState)(["all-tags"]),[ex,ep]=(0,s.useState)({from:new Date(Date.now()-6048e5),to:new Date}),[ef,eb]=(0,s.useState)(null),[ey,ej]=(0,s.useState)(0),ev=new Date(c.getFullYear(),c.getMonth(),1),ew=new Date(c.getFullYear(),c.getMonth()+1,0),e_=eI(ev),eN=eI(ew);function ek(e){return new Intl.NumberFormat("en-US",{maximumFractionDigits:0,notation:"compact",compactDisplay:"short"}).format(e)}console.log("keys in usage",n),console.log("premium user in usage",o);let eC=async()=>{if(e)try{let t=await (0,F.getProxyUISettings)(e);return console.log("usage tab: proxy_settings",t),t}catch(e){console.error("Error fetching proxy settings:",e)}};(0,s.useEffect)(()=>{eT(ex.from,ex.to)},[ex,eh]);let eS=async(t,l,a)=>{if(!t||!l||!e)return;console.log("uiSelectedKey",a);let s=await (0,F.adminTopEndUsersCall)(e,a,t.toISOString(),l.toISOString());console.log("End user data updated successfully",s),W(s)},eT=async(t,l)=>{if(!t||!l||!e)return;let a=await eC();a?.DISABLE_EXPENSIVE_DB_QUERIES||(X((await (0,F.tagsSpendLogsCall)(e,t.toISOString(),l.toISOString(),0===eh.length?void 0:eh)).spend_per_tag),console.log("Tag spend data updated successfully"))};function eI(e){let t=e.getFullYear(),l=e.getMonth()+1,a=e.getDate();return`${t}-${l<10?"0"+l:l}-${a<10?"0"+a:a}`}console.log(`Start date is ${e_}`),console.log(`End date is ${eN}`);let eE=async(e,t,l)=>{try{let l=await e();t(l)}catch(e){console.error(l,e)}},eA=(e,t,l,a)=>{let s=[],r=new Date(t),i=new Map(e.map(e=>{let t=(e=>{if(e.includes("-"))return e;{let[t,l]=e.split(" ");return new Date(new Date().getFullYear(),new Date(`${t} 01 2024`).getMonth(),parseInt(l)).toISOString().split("T")[0]}})(e.date);return[t,{...e,date:t}]}));for(;r<=l;){let e=r.toISOString().split("T")[0];if(i.has(e))s.push(i.get(e));else{let t={date:e,api_requests:0,total_tokens:0};a.forEach(e=>{t[e]||(t[e]=0)}),s.push(t)}r.setDate(r.getDate()+1)}return s},eP=async()=>{if(e)try{let t=await (0,F.adminSpendLogsCall)(e),l=new Date,a=new Date(l.getFullYear(),l.getMonth(),1),s=new Date(l.getFullYear(),l.getMonth()+1,0),r=eA(t,a,s,[]),i=Number(r.reduce((e,t)=>e+(t.spend||0),0).toFixed(2));ej(i),H(r)}catch(e){console.error("Error fetching overall spend:",e)}},eD=async()=>{e&&await eE(async()=>(await (0,F.adminTopKeysCall)(e)).map(e=>({key:e.api_key.substring(0,10),api_key:e.api_key,key_alias:e.key_alias,spend:Number(e.total_spend.toFixed(2))})),$,"Error fetching top keys")},eM=async()=>{e&&await eE(async()=>(await (0,F.adminTopModelsCall)(e)).map(e=>({key:e.model,spend:(0,L.formatNumberWithCommas)(e.total_spend,2)})),K,"Error fetching top models")},eB=async()=>{e&&await eE(async()=>{let t=await (0,F.teamSpendLogsCall)(e),l=new Date,a=new Date(l.getFullYear(),l.getMonth(),1),s=new Date(l.getFullYear(),l.getMonth()+1,0);return Y(eA(t.daily_spend,a,s,t.teams)),el(t.teams),t.total_spend_per_team.map(e=>({name:e.team_id||"",value:(0,L.formatNumberWithCommas)(e.total_spend||0,2)}))},es,"Error fetching team spend")},eO=async()=>{if(e)try{let t=await (0,F.adminGlobalActivity)(e,e_,eN),l=new Date,a=new Date(l.getFullYear(),l.getMonth(),1),s=new Date(l.getFullYear(),l.getMonth()+1,0),r=eA(t.daily_data||[],a,s,["api_requests","total_tokens"]);eo({...t,daily_data:r})}catch(e){console.error("Error fetching global activity:",e)}},eF=async()=>{if(e)try{let t=await (0,F.adminGlobalActivityPerModel)(e,e_,eN),l=new Date,a=new Date(l.getFullYear(),l.getMonth(),1),s=new Date(l.getFullYear(),l.getMonth()+1,0),r=t.map(e=>({...e,daily_data:eA(e.daily_data||[],a,s,["api_requests","total_tokens"])}));ed(r)}catch(e){console.error("Error fetching global activity per model:",e)}};return((0,s.useEffect)(()=>{(async()=>{if(e&&a&&r&&i){let t=await eC();!(t&&(eb(t),t?.DISABLE_EXPENSIVE_DB_QUERIES))&&(console.log("fetching data - valiue of proxySettings",ef),eP(),eE(()=>e&&a?(0,F.adminspendByProvider)(e,a,e_,eN):Promise.reject("No access token or token"),ei,"Error fetching provider spend"),eD(),eM(),eO(),eF(),z(r)&&(eB(),e&&eE(async()=>(await (0,F.allTagNamesCall)(e)).tag_names,ee,"Error fetching tag names"),e&&eE(()=>(0,F.tagsSpendLogsCall)(e,ex.from?.toISOString(),ex.to?.toISOString(),void 0),e=>X(e.spend_per_tag),"Error fetching top tags"),e&&eE(()=>(0,F.adminTopEndUsersCall)(e,null,void 0,void 0),W,"Error fetching top end users")))}})()},[e,a,r,i,e_,eN]),ef?.DISABLE_EXPENSIVE_DB_QUERIES)?(0,t.jsx)("div",{style:{width:"100%"},className:"p-8",children:(0,t.jsxs)(u.Card,{children:[(0,t.jsx)(m.Title,{children:"Database Query Limit Reached"}),(0,t.jsxs)(N.Text,{className:"mt-4",children:["SpendLogs in DB has ",ef.NUM_SPEND_LOGS_ROWS," rows.",(0,t.jsx)("br",{}),"Please follow our guide to view usage when SpendLogs has more than 1M rows."]}),(0,t.jsx)(M.Button,{className:"mt-4",children:(0,t.jsx)("a",{href:"https://docs.litellm.ai/docs/proxy/spending_monitoring",target:"_blank",children:"View Usage Guide"})})]})}):(0,t.jsx)("div",{style:{width:"100%"},className:"p-8",children:(0,t.jsxs)(S.TabGroup,{children:[(0,t.jsxs)(T.TabList,{className:"mt-2",children:[(0,t.jsx)(I.Tab,{children:"All Up"}),z(r)?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(I.Tab,{children:"Team Based Usage"}),(0,t.jsx)(I.Tab,{children:"Customer Usage"}),(0,t.jsx)(I.Tab,{children:"Tag Based Usage"})]}):(0,t.jsx)(t.Fragment,{children:(0,t.jsx)("div",{})})]}),(0,t.jsxs)(C.TabPanels,{children:[(0,t.jsx)(k.TabPanel,{children:(0,t.jsxs)(S.TabGroup,{children:[(0,t.jsxs)(T.TabList,{variant:"solid",className:"mt-1",children:[(0,t.jsx)(I.Tab,{children:"Cost"}),(0,t.jsx)(I.Tab,{children:"Activity"})]}),(0,t.jsxs)(C.TabPanels,{children:[(0,t.jsx)(k.TabPanel,{children:(0,t.jsxs)(w.Grid,{numItems:2,className:"gap-2 h-[100vh] w-full",children:[(0,t.jsxs)(_.Col,{numColSpan:2,children:[(0,t.jsxs)(N.Text,{className:"text-tremor-default text-tremor-content dark:text-dark-tremor-content mb-2 mt-2 text-lg",children:["Project Spend ",new Date().toLocaleString("default",{month:"long"})," 1 -"," ",new Date(new Date().getFullYear(),new Date().getMonth()+1,0).getDate()]}),(0,t.jsx)(j.default,{userSpend:ey,selectedTeam:null,userMaxBudget:null})]}),(0,t.jsx)(_.Col,{numColSpan:2,children:(0,t.jsxs)(u.Card,{children:[(0,t.jsx)(m.Title,{children:"Monthly Spend"}),(0,t.jsx)(l.BarChart,{data:U,index:"date",categories:["spend"],colors:["cyan"],valueFormatter:e=>`$ ${(0,L.formatNumberWithCommas)(e,2)}`,yAxisWidth:100,tickGap:5})]})}),(0,t.jsx)(_.Col,{numColSpan:1,children:(0,t.jsxs)(u.Card,{className:"h-full",children:[(0,t.jsx)(m.Title,{children:"Top Virtual Keys"}),(0,t.jsx)(R.default,{topKeys:V,teams:null,topKeysLimit:5,setTopKeysLimit:()=>{}})]})}),(0,t.jsx)(_.Col,{numColSpan:1,children:(0,t.jsxs)(u.Card,{className:"h-full",children:[(0,t.jsx)(m.Title,{children:"Top Models"}),(0,t.jsx)(l.BarChart,{className:"mt-4 h-40",data:q,index:"key",categories:["spend"],colors:["cyan"],yAxisWidth:200,layout:"vertical",showXAxis:!1,showLegend:!1,valueFormatter:e=>`$${(0,L.formatNumberWithCommas)(e,2)}`})]})}),(0,t.jsx)(_.Col,{numColSpan:1}),(0,t.jsx)(_.Col,{numColSpan:2,children:(0,t.jsxs)(u.Card,{className:"mb-2",children:[(0,t.jsx)(m.Title,{children:"Spend by Provider"}),(0,t.jsx)(t.Fragment,{children:(0,t.jsxs)(w.Grid,{numItems:2,children:[(0,t.jsx)(_.Col,{numColSpan:1,children:(0,t.jsx)(P.DonutChart,{className:"mt-4 h-40",variant:"pie",data:er,index:"provider",category:"spend",colors:["cyan"],valueFormatter:e=>`$${(0,L.formatNumberWithCommas)(e,2)}`})}),(0,t.jsx)(_.Col,{numColSpan:1,children:(0,t.jsxs)(h.Table,{children:[(0,t.jsx)(g.TableHead,{children:(0,t.jsxs)(p.TableRow,{children:[(0,t.jsx)(x.TableHeaderCell,{children:"Provider"}),(0,t.jsx)(x.TableHeaderCell,{children:"Spend"})]})}),(0,t.jsx)(b.TableBody,{children:er.map(e=>(0,t.jsxs)(p.TableRow,{children:[(0,t.jsx)(f.TableCell,{children:e.provider}),(0,t.jsx)(f.TableCell,{children:1e-5>parseFloat(e.spend.toFixed(2))?"less than 0.00":(0,L.formatNumberWithCommas)(e.spend,2)})]},e.provider))})]})})]})})]})})]})}),(0,t.jsx)(k.TabPanel,{children:(0,t.jsxs)(w.Grid,{numItems:1,className:"gap-2 h-[75vh] w-full",children:[(0,t.jsxs)(u.Card,{children:[(0,t.jsx)(m.Title,{children:"All Up"}),(0,t.jsxs)(w.Grid,{numItems:2,children:[(0,t.jsxs)(_.Col,{children:[(0,t.jsxs)(y.Subtitle,{style:{fontSize:"15px",fontWeight:"normal",color:"#535452"},children:["API Requests ",ek(en.sum_api_requests)]}),(0,t.jsx)(D.AreaChart,{className:"h-40",data:en.daily_data,valueFormatter:ek,index:"date",colors:["cyan"],categories:["api_requests"],onValueChange:e=>console.log(e)})]}),(0,t.jsxs)(_.Col,{children:[(0,t.jsxs)(y.Subtitle,{style:{fontSize:"15px",fontWeight:"normal",color:"#535452"},children:["Tokens ",ek(en.sum_total_tokens)]}),(0,t.jsx)(l.BarChart,{className:"h-40",data:en.daily_data,valueFormatter:ek,index:"date",colors:["cyan"],categories:["total_tokens"],onValueChange:e=>console.log(e)})]})]})]}),(0,t.jsx)(t.Fragment,{children:ec.map((e,a)=>(0,t.jsxs)(u.Card,{children:[(0,t.jsx)(m.Title,{children:e.model}),(0,t.jsxs)(w.Grid,{numItems:2,children:[(0,t.jsxs)(_.Col,{children:[(0,t.jsxs)(y.Subtitle,{style:{fontSize:"15px",fontWeight:"normal",color:"#535452"},children:["API Requests ",ek(e.sum_api_requests)]}),(0,t.jsx)(D.AreaChart,{className:"h-40",data:e.daily_data,index:"date",colors:["cyan"],categories:["api_requests"],valueFormatter:ek,onValueChange:e=>console.log(e)})]}),(0,t.jsxs)(_.Col,{children:[(0,t.jsxs)(y.Subtitle,{style:{fontSize:"15px",fontWeight:"normal",color:"#535452"},children:["Tokens ",ek(e.sum_total_tokens)]}),(0,t.jsx)(l.BarChart,{className:"h-40",data:e.daily_data,index:"date",colors:["cyan"],categories:["total_tokens"],valueFormatter:ek,onValueChange:e=>console.log(e)})]})]})]},a))})]})})]})]})}),(0,t.jsx)(k.TabPanel,{children:(0,t.jsxs)(w.Grid,{numItems:2,className:"gap-2 h-[75vh] w-full",children:[(0,t.jsxs)(_.Col,{numColSpan:2,children:[(0,t.jsxs)(u.Card,{className:"mb-2",children:[(0,t.jsx)(m.Title,{children:"Total Spend Per Team"}),(0,t.jsx)(d,{data:ea})]}),(0,t.jsxs)(u.Card,{children:[(0,t.jsx)(m.Title,{children:"Daily Spend Per Team"}),(0,t.jsx)(l.BarChart,{className:"h-72",data:J,showLegend:!0,index:"date",categories:et,yAxisWidth:80,stack:!0})]})]}),(0,t.jsx)(_.Col,{numColSpan:2})]})}),(0,t.jsxs)(k.TabPanel,{children:[(0,t.jsxs)("p",{className:"mb-2 text-gray-500 italic text-[12px]",children:["Customers of your LLM API calls. Tracked when a `user` param is passed in your LLM calls"," ",(0,t.jsx)("a",{className:"text-blue-500",href:"https://docs.litellm.ai/docs/proxy/users",target:"_blank",children:"docs here"})]}),(0,t.jsxs)(w.Grid,{numItems:2,children:[(0,t.jsx)(_.Col,{children:(0,t.jsx)(v.default,{value:ex,onValueChange:e=>{ep(e),eS(e.from,e.to,null)}})}),(0,t.jsxs)(_.Col,{children:[(0,t.jsx)(N.Text,{children:"Select Key"}),(0,t.jsxs)(E.Select,{defaultValue:"all-keys",children:[(0,t.jsx)(A.SelectItem,{value:"all-keys",onClick:()=>{eS(ex.from,ex.to,null)},children:"All Keys"},"all-keys"),n?.map((e,l)=>e&&null!==e.key_alias&&e.key_alias.length>0?(0,t.jsx)(A.SelectItem,{value:String(l),onClick:()=>{eS(ex.from,ex.to,e.token)},children:e.key_alias},l):null)]})]})]}),(0,t.jsx)(u.Card,{className:"mt-4",children:(0,t.jsxs)(h.Table,{className:"max-h-[70vh] min-h-[500px]",children:[(0,t.jsx)(g.TableHead,{children:(0,t.jsxs)(p.TableRow,{children:[(0,t.jsx)(x.TableHeaderCell,{children:"Customer"}),(0,t.jsx)(x.TableHeaderCell,{children:"Spend"}),(0,t.jsx)(x.TableHeaderCell,{children:"Total Events"})]})}),(0,t.jsx)(b.TableBody,{children:G?.map((e,l)=>(0,t.jsxs)(p.TableRow,{children:[(0,t.jsx)(f.TableCell,{children:e.end_user}),(0,t.jsx)(f.TableCell,{children:(0,L.formatNumberWithCommas)(e.total_spend,2)}),(0,t.jsx)(f.TableCell,{children:e.total_count})]},l))})]})})]}),(0,t.jsxs)(k.TabPanel,{children:[(0,t.jsxs)(w.Grid,{numItems:2,children:[(0,t.jsx)(_.Col,{numColSpan:1,children:(0,t.jsx)(v.default,{className:"mb-4",value:ex,onValueChange:e=>{ep(e),eT(e.from,e.to)}})}),(0,t.jsx)(_.Col,{children:o?(0,t.jsx)("div",{children:(0,t.jsxs)(B.MultiSelect,{value:eh,onValueChange:e=>eg(e),children:[(0,t.jsx)(O.MultiSelectItem,{value:"all-tags",onClick:()=>eg(["all-tags"]),children:"All Tags"},"all-tags"),Z&&Z.filter(e=>"all-tags"!==e).map((e,l)=>(0,t.jsx)(O.MultiSelectItem,{value:String(e),children:e},e))]})}):(0,t.jsx)("div",{children:(0,t.jsxs)(B.MultiSelect,{value:eh,onValueChange:e=>eg(e),children:[(0,t.jsx)(O.MultiSelectItem,{value:"all-tags",onClick:()=>eg(["all-tags"]),children:"All Tags"},"all-tags"),Z&&Z.filter(e=>"all-tags"!==e).map((e,l)=>(0,t.jsxs)(A.SelectItem,{value:String(e),disabled:!0,children:["✨ ",e," (Enterprise only Feature)"]},e))]})})})]}),(0,t.jsxs)(w.Grid,{numItems:2,className:"gap-2 h-[75vh] w-full mb-4",children:[(0,t.jsx)(_.Col,{numColSpan:2,children:(0,t.jsxs)(u.Card,{children:[(0,t.jsx)(m.Title,{children:"Spend Per Tag"}),(0,t.jsxs)(N.Text,{children:["Get Started by Tracking cost per tag"," ",(0,t.jsx)("a",{className:"text-blue-500",href:"https://docs.litellm.ai/docs/proxy/cost_tracking",target:"_blank",children:"here"})]}),(0,t.jsx)(l.BarChart,{className:"h-72",data:Q,index:"name",categories:["spend"],colors:["cyan"]})]})}),(0,t.jsx)(_.Col,{numColSpan:2})]})]})]})]})})}],735042)},704308,e=>{"use strict";var t=e.i(843476),l=e.i(271645),a=e.i(994388),s=e.i(212931),r=e.i(764205),i=e.i(808613),n=e.i(311451),o=e.i(199133),c=e.i(888259),d=e.i(209261);let{TextArea:u}=n.Input,{Option:m}=o.Select,h=["Development","Productivity","Learning","Security","Data & Analytics","Integration","Testing","Documentation"],g=({visible:e,onClose:g,accessToken:x,onSuccess:p})=>{let[f]=i.Form.useForm(),[b,y]=(0,l.useState)(!1),[j,v]=(0,l.useState)("github"),w=async e=>{if(!x)return void c.default.error("No access token available");if(!(0,d.validatePluginName)(e.name))return void c.default.error("Plugin name must be kebab-case (lowercase letters, numbers, and hyphens only)");if(e.version&&!(0,d.isValidSemanticVersion)(e.version))return void c.default.error("Version must be in semantic versioning format (e.g., 1.0.0)");if(e.authorEmail&&!(0,d.isValidEmail)(e.authorEmail))return void c.default.error("Invalid email format");if(e.homepage&&!(0,d.isValidUrl)(e.homepage))return void c.default.error("Invalid homepage URL format");if(("url"===j||"git-subdir"===j)&&e.url&&!(0,d.isValidUrl)(e.url))return void c.default.error("Invalid git URL format");y(!0);try{let t={name:e.name.trim(),source:"github"===j?{source:"github",repo:e.repo.trim()}:"git-subdir"===j?{source:"git-subdir",url:e.url.trim(),path:e.path.trim()}:{source:"url",url:e.url.trim()}};e.version&&(t.version=e.version.trim()),e.description&&(t.description=e.description.trim()),(e.authorName||e.authorEmail)&&(t.author={},e.authorName&&(t.author.name=e.authorName.trim()),e.authorEmail&&(t.author.email=e.authorEmail.trim())),e.homepage&&(t.homepage=e.homepage.trim()),e.category&&(t.category=e.category),e.keywords&&(t.keywords=(0,d.parseKeywords)(e.keywords)),await (0,r.registerClaudeCodePlugin)(x,t),c.default.success("Plugin registered successfully"),f.resetFields(),v("github"),p(),g()}catch(e){console.error("Error registering plugin:",e),c.default.error("Failed to register plugin")}finally{y(!1)}},_=()=>{f.resetFields(),v("github"),g()};return(0,t.jsx)(s.Modal,{title:"Add New Claude Code Plugin",open:e,onCancel:_,footer:null,width:700,className:"top-8",children:(0,t.jsxs)(i.Form,{form:f,layout:"vertical",onFinish:w,className:"mt-4",children:[(0,t.jsx)(i.Form.Item,{label:"Plugin Name",name:"name",rules:[{required:!0,message:"Please enter plugin name"},{pattern:/^[a-z0-9-]+$/,message:"Name must be kebab-case (lowercase, numbers, hyphens only)"}],tooltip:"Unique identifier in kebab-case format (e.g., my-awesome-plugin)",children:(0,t.jsx)(n.Input,{placeholder:"my-awesome-plugin",className:"rounded-lg"})}),(0,t.jsx)(i.Form.Item,{label:"Source Type",name:"sourceType",initialValue:"github",rules:[{required:!0,message:"Please select source type"}],children:(0,t.jsxs)(o.Select,{onChange:e=>{v(e),f.setFieldsValue({repo:void 0,url:void 0,path:void 0})},className:"rounded-lg",children:[(0,t.jsx)(m,{value:"github",children:"GitHub"}),(0,t.jsx)(m,{value:"url",children:"Git URL"}),(0,t.jsx)(m,{value:"git-subdir",children:"Git Subdir"})]})}),"github"===j&&(0,t.jsx)(i.Form.Item,{label:"GitHub Repository",name:"repo",rules:[{required:!0,message:"Please enter repository"},{pattern:/^[a-zA-Z0-9_-]+\/[a-zA-Z0-9_-]+$/,message:"Repository must be in format: org/repo"}],tooltip:"Format: organization/repository (e.g., anthropics/claude-code)",children:(0,t.jsx)(n.Input,{placeholder:"anthropics/claude-code",className:"rounded-lg"})}),("url"===j||"git-subdir"===j)&&(0,t.jsx)(i.Form.Item,{label:"Git URL",name:"url",rules:[{required:!0,message:"Please enter git URL"}],tooltip:"Full git URL to the repository",children:(0,t.jsx)(n.Input,{type:"url",placeholder:"https://github.com/org/repo.git",className:"rounded-lg"})}),"git-subdir"===j&&(0,t.jsx)(i.Form.Item,{label:"Subdirectory Path",name:"path",rules:[{required:!0,message:"Please enter subdirectory path"},{pattern:/^[a-zA-Z0-9][a-zA-Z0-9._-]*(\/[a-zA-Z0-9][a-zA-Z0-9._-]*)*$/,message:"Path must be relative segments (alphanumeric, dots, hyphens, underscores), e.g. plugins/plugin-name"}],tooltip:"Path to the plugin directory within the repository (e.g., plugins/plugin-name)",children:(0,t.jsx)(n.Input,{placeholder:"plugins/plugin-name",className:"rounded-lg"})}),(0,t.jsx)(i.Form.Item,{label:"Version (Optional)",name:"version",tooltip:"Semantic version (e.g., 1.0.0)",children:(0,t.jsx)(n.Input,{placeholder:"1.0.0",className:"rounded-lg"})}),(0,t.jsx)(i.Form.Item,{label:"Description (Optional)",name:"description",tooltip:"Brief description of what the plugin does",children:(0,t.jsx)(u,{rows:3,placeholder:"A plugin that helps with...",maxLength:500,className:"rounded-lg"})}),(0,t.jsx)(i.Form.Item,{label:"Category (Optional)",name:"category",tooltip:"Select a category or enter a custom one",children:(0,t.jsx)(o.Select,{placeholder:"Select or type a category",allowClear:!0,showSearch:!0,optionFilterProp:"children",className:"rounded-lg",children:h.map(e=>(0,t.jsx)(m,{value:e,children:e},e))})}),(0,t.jsx)(i.Form.Item,{label:"Keywords (Optional)",name:"keywords",tooltip:"Comma-separated list of keywords for search",children:(0,t.jsx)(n.Input,{placeholder:"search, web, api",className:"rounded-lg"})}),(0,t.jsx)(i.Form.Item,{label:"Author Name (Optional)",name:"authorName",tooltip:"Name of the plugin author or organization",children:(0,t.jsx)(n.Input,{placeholder:"Your Name or Organization",className:"rounded-lg"})}),(0,t.jsx)(i.Form.Item,{label:"Author Email (Optional)",name:"authorEmail",rules:[{type:"email",message:"Please enter a valid email"}],tooltip:"Contact email for the plugin author",children:(0,t.jsx)(n.Input,{type:"email",placeholder:"author@example.com",className:"rounded-lg"})}),(0,t.jsx)(i.Form.Item,{label:"Homepage (Optional)",name:"homepage",rules:[{type:"url",message:"Please enter a valid URL"}],tooltip:"URL to the plugin's homepage or documentation",children:(0,t.jsx)(n.Input,{type:"url",placeholder:"https://example.com",className:"rounded-lg"})}),(0,t.jsx)(i.Form.Item,{className:"mb-0 mt-6",children:(0,t.jsxs)("div",{className:"flex justify-end gap-2",children:[(0,t.jsx)(a.Button,{variant:"secondary",onClick:_,disabled:b,children:"Cancel"}),(0,t.jsx)(a.Button,{type:"submit",loading:b,children:b?"Registering...":"Register Plugin"})]})})]})})};var x=e.i(166406),p=e.i(871943),f=e.i(360820),b=e.i(94629),y=e.i(68155),j=e.i(152990),v=e.i(682830),w=e.i(389083),_=e.i(269200),N=e.i(942232),k=e.i(977572),C=e.i(427612),S=e.i(64848),T=e.i(496020),I=e.i(790848),E=e.i(592968),A=e.i(727749);let P=({pluginsList:e,isLoading:s,onDeleteClick:i,accessToken:n,onPluginUpdated:o,isAdmin:c,onPluginClick:u})=>{let[m,h]=(0,l.useState)([{id:"created_at",desc:!0}]),[g,P]=(0,l.useState)(null),D=async e=>{if(n){P(e.id);try{e.enabled?(await (0,r.disableClaudeCodePlugin)(n,e.name),A.default.success(`Plugin "${e.name}" disabled`)):(await (0,r.enableClaudeCodePlugin)(n,e.name),A.default.success(`Plugin "${e.name}" enabled`)),o()}catch(e){A.default.error("Failed to toggle plugin status")}finally{P(null)}}},M=[{header:"Plugin Name",accessorKey:"name",cell:({row:e})=>{let l=e.original,s=l.name||"";return(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(E.Tooltip,{title:s,children:(0,t.jsx)(a.Button,{size:"xs",variant:"light",className:"font-mono text-blue-500 bg-blue-50 hover:bg-blue-100 text-xs font-normal px-2 py-0.5 text-left overflow-hidden truncate min-w-[150px] justify-start",onClick:()=>u(l.id),children:s})}),(0,t.jsx)(E.Tooltip,{title:"Copy Plugin ID",children:(0,t.jsx)(x.CopyOutlined,{onClick:e=>{var t;e.stopPropagation(),t=l.id,navigator.clipboard.writeText(t),A.default.success("Copied to clipboard!")},className:"cursor-pointer text-gray-500 hover:text-blue-500 text-xs"})})]})}},{header:"Version",accessorKey:"version",cell:({row:e})=>{let l=e.original.version||"N/A";return(0,t.jsx)("span",{className:"text-xs text-gray-600",children:l})}},{header:"Description",accessorKey:"description",cell:({row:e})=>{let l=e.original.description||"No description";return(0,t.jsx)(E.Tooltip,{title:l,children:(0,t.jsx)("span",{className:"text-xs text-gray-600 block max-w-[300px] truncate",children:l})})}},{header:"Category",accessorKey:"category",cell:({row:e})=>{let l=e.original.category;if(!l)return(0,t.jsx)(w.Badge,{color:"gray",className:"text-xs font-normal",size:"xs",children:"Uncategorized"});let a=(0,d.getCategoryBadgeColor)(l);return(0,t.jsx)(w.Badge,{color:a,className:"text-xs font-normal",size:"xs",children:l})}},{header:"Enabled",accessorKey:"enabled",cell:({row:e})=>{let l=e.original;return(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(w.Badge,{color:l.enabled?"green":"gray",className:"text-xs font-normal",size:"xs",children:l.enabled?"Yes":"No"}),c&&(0,t.jsx)(E.Tooltip,{title:l.enabled?"Disable plugin":"Enable plugin",children:(0,t.jsx)(I.Switch,{size:"small",checked:l.enabled,loading:g===l.id,onChange:()=>D(l)})})]})}},{header:"Created At",accessorKey:"created_at",cell:({row:e})=>{var l;let a=e.original;return(0,t.jsx)(E.Tooltip,{title:a.created_at,children:(0,t.jsx)("span",{className:"text-xs",children:(l=a.created_at)?new Date(l).toLocaleString():"-"})})}},...c?[{header:"Actions",id:"actions",enableSorting:!1,cell:({row:e})=>{let l=e.original;return(0,t.jsx)("div",{className:"flex items-center gap-1",children:(0,t.jsx)(E.Tooltip,{title:"Delete plugin",children:(0,t.jsx)(a.Button,{size:"xs",variant:"light",color:"red",onClick:e=>{e.stopPropagation(),i(l.name,l.name)},icon:y.TrashIcon,className:"text-red-500 hover:text-red-700 hover:bg-red-50"})})})}}]:[]],B=(0,j.useReactTable)({data:e,columns:M,state:{sorting:m},onSortingChange:h,getCoreRowModel:(0,v.getCoreRowModel)(),getSortedRowModel:(0,v.getSortedRowModel)(),enableSorting:!0});return(0,t.jsx)("div",{className:"rounded-lg custom-border relative",children:(0,t.jsx)("div",{className:"overflow-x-auto",children:(0,t.jsxs)(_.Table,{className:"[&_td]:py-0.5 [&_th]:py-1",children:[(0,t.jsx)(C.TableHead,{children:B.getHeaderGroups().map(e=>(0,t.jsx)(T.TableRow,{children:e.headers.map(e=>(0,t.jsx)(S.TableHeaderCell,{className:`py-1 h-8 ${"actions"===e.id?"sticky right-0 bg-white shadow-[-4px_0_8px_-6px_rgba(0,0,0,0.1)]":""}`,onClick:e.column.getCanSort()?e.column.getToggleSortingHandler():void 0,children:(0,t.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,t.jsx)("div",{className:"flex items-center",children:e.isPlaceholder?null:(0,j.flexRender)(e.column.columnDef.header,e.getContext())}),e.column.getCanSort()&&(0,t.jsx)("div",{className:"w-4",children:e.column.getIsSorted()?({asc:(0,t.jsx)(f.ChevronUpIcon,{className:"h-4 w-4 text-blue-500"}),desc:(0,t.jsx)(p.ChevronDownIcon,{className:"h-4 w-4 text-blue-500"})})[e.column.getIsSorted()]:(0,t.jsx)(b.SwitchVerticalIcon,{className:"h-4 w-4 text-gray-400"})})]})},e.id))},e.id))}),(0,t.jsx)(N.TableBody,{children:s?(0,t.jsx)(T.TableRow,{children:(0,t.jsx)(k.TableCell,{colSpan:M.length,className:"h-8 text-center",children:(0,t.jsx)("div",{className:"text-center text-gray-500",children:(0,t.jsx)("p",{children:"Loading..."})})})}):e&&e.length>0?B.getRowModel().rows.map(e=>(0,t.jsx)(T.TableRow,{className:"h-8",children:e.getVisibleCells().map(e=>(0,t.jsx)(k.TableCell,{className:`py-0.5 max-h-8 overflow-hidden text-ellipsis whitespace-nowrap ${"actions"===e.column.id?"sticky right-0 bg-white shadow-[-4px_0_8px_-6px_rgba(0,0,0,0.1)]":""}`,children:(0,j.flexRender)(e.column.columnDef.cell,e.getContext())},e.id))},e.id)):(0,t.jsx)(T.TableRow,{children:(0,t.jsx)(k.TableCell,{colSpan:M.length,className:"h-8 text-center",children:(0,t.jsx)("div",{className:"text-center text-gray-500",children:(0,t.jsx)("p",{children:"No plugins found. Add one to get started."})})})})})]})})})};var D=e.i(708347),M=e.i(530212),B=e.i(434626),O=e.i(304967),F=e.i(350967),R=e.i(599724),L=e.i(629569),z=e.i(482725);let U=({pluginId:e,onClose:s,accessToken:i,isAdmin:n,onPluginUpdated:o})=>{let[c,u]=(0,l.useState)(null),[m,h]=(0,l.useState)(!0),[g,p]=(0,l.useState)(!1);(0,l.useEffect)(()=>{f()},[e,i]);let f=async()=>{if(i){h(!0);try{let t=await (0,r.getClaudeCodePluginDetails)(i,e);u(t.plugin)}catch(e){console.error("Error fetching plugin info:",e),A.default.error("Failed to load plugin information")}finally{h(!1)}}},b=async()=>{if(i&&c){p(!0);try{c.enabled?(await (0,r.disableClaudeCodePlugin)(i,c.name),A.default.success(`Plugin "${c.name}" disabled`)):(await (0,r.enableClaudeCodePlugin)(i,c.name),A.default.success(`Plugin "${c.name}" enabled`)),o(),f()}catch(e){A.default.error("Failed to toggle plugin status")}finally{p(!1)}}},y=e=>{navigator.clipboard.writeText(e),A.default.success("Copied to clipboard!")};if(m)return(0,t.jsx)("div",{className:"flex items-center justify-center p-8",children:(0,t.jsx)(z.Spin,{size:"large"})});if(!c)return(0,t.jsxs)("div",{className:"p-8 text-center text-gray-500",children:[(0,t.jsx)("p",{children:"Plugin not found"}),(0,t.jsx)(a.Button,{className:"mt-4",onClick:s,children:"Go Back"})]});let j=(0,d.formatInstallCommand)(c),v=(0,d.getSourceLink)(c.source),_=(0,d.getCategoryBadgeColor)(c.category);return(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsxs)("div",{className:"flex items-center gap-3 mb-6",children:[(0,t.jsx)(M.ArrowLeftIcon,{className:"h-5 w-5 cursor-pointer text-gray-500 hover:text-gray-700",onClick:s}),(0,t.jsx)("h2",{className:"text-2xl font-bold",children:c.name}),c.version&&(0,t.jsxs)(w.Badge,{color:"blue",size:"xs",children:["v",c.version]}),c.category&&(0,t.jsx)(w.Badge,{color:_,size:"xs",children:c.category}),(0,t.jsx)(w.Badge,{color:c.enabled?"green":"gray",size:"xs",children:c.enabled?"Enabled":"Disabled"})]}),(0,t.jsx)(O.Card,{children:(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[(0,t.jsxs)("div",{className:"flex-1",children:[(0,t.jsx)(R.Text,{className:"text-gray-600 text-xs mb-2",children:"Install Command"}),(0,t.jsx)("div",{className:"font-mono bg-gray-100 px-3 py-2 rounded text-sm",children:j})]}),(0,t.jsx)(E.Tooltip,{title:"Copy install command",children:(0,t.jsx)(a.Button,{size:"xs",variant:"secondary",icon:x.CopyOutlined,onClick:()=>y(j),className:"ml-4",children:"Copy"})})]})}),(0,t.jsxs)(O.Card,{children:[(0,t.jsx)(L.Title,{children:"Plugin Details"}),(0,t.jsxs)(F.Grid,{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-6 mt-4",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)(R.Text,{className:"text-gray-600 text-xs",children:"Plugin ID"}),(0,t.jsxs)("div",{className:"flex items-center gap-2 mt-1",children:[(0,t.jsx)(R.Text,{className:"font-mono text-xs",children:c.id}),(0,t.jsx)(x.CopyOutlined,{className:"cursor-pointer text-gray-500 hover:text-blue-500 text-xs",onClick:()=>y(c.id)})]})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(R.Text,{className:"text-gray-600 text-xs",children:"Name"}),(0,t.jsx)(R.Text,{className:"font-semibold mt-1",children:c.name})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(R.Text,{className:"text-gray-600 text-xs",children:"Version"}),(0,t.jsx)(R.Text,{className:"font-semibold mt-1",children:c.version||"N/A"})]}),(0,t.jsxs)("div",{className:"col-span-2",children:[(0,t.jsx)(R.Text,{className:"text-gray-600 text-xs",children:"Source"}),(0,t.jsxs)("div",{className:"flex items-center gap-2 mt-1",children:[(0,t.jsx)(R.Text,{className:"font-semibold",children:(0,d.getSourceDisplayText)(c.source)}),v&&(0,t.jsx)("a",{href:v,target:"_blank",rel:"noopener noreferrer",className:"text-blue-500 hover:text-blue-700",children:(0,t.jsx)(B.ExternalLinkIcon,{className:"h-4 w-4"})})]})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(R.Text,{className:"text-gray-600 text-xs",children:"Category"}),(0,t.jsx)("div",{className:"mt-1",children:c.category?(0,t.jsx)(w.Badge,{color:_,size:"xs",children:c.category}):(0,t.jsx)(R.Text,{className:"text-gray-400",children:"Uncategorized"})})]}),n&&(0,t.jsxs)("div",{className:"col-span-3",children:[(0,t.jsx)(R.Text,{className:"text-gray-600 text-xs",children:"Status"}),(0,t.jsxs)("div",{className:"flex items-center gap-3 mt-2",children:[(0,t.jsx)(I.Switch,{checked:c.enabled,loading:g,onChange:b}),(0,t.jsx)(R.Text,{className:"text-sm",children:c.enabled?"Plugin is enabled and visible in marketplace":"Plugin is disabled and hidden from marketplace"})]})]})]})]}),c.description&&(0,t.jsxs)(O.Card,{children:[(0,t.jsx)(L.Title,{children:"Description"}),(0,t.jsx)(R.Text,{className:"mt-2",children:c.description})]}),c.keywords&&c.keywords.length>0&&(0,t.jsxs)(O.Card,{children:[(0,t.jsx)(L.Title,{children:"Keywords"}),(0,t.jsx)("div",{className:"flex flex-wrap gap-2 mt-2",children:c.keywords.map((e,l)=>(0,t.jsx)(w.Badge,{color:"gray",size:"xs",children:e},l))})]}),c.author&&(0,t.jsxs)(O.Card,{children:[(0,t.jsx)(L.Title,{children:"Author Information"}),(0,t.jsxs)(F.Grid,{className:"grid grid-cols-1 sm:grid-cols-2 gap-4 mt-4",children:[c.author.name&&(0,t.jsxs)("div",{children:[(0,t.jsx)(R.Text,{className:"text-gray-600 text-xs",children:"Name"}),(0,t.jsx)(R.Text,{className:"font-semibold mt-1",children:c.author.name})]}),c.author.email&&(0,t.jsxs)("div",{children:[(0,t.jsx)(R.Text,{className:"text-gray-600 text-xs",children:"Email"}),(0,t.jsx)(R.Text,{className:"font-semibold mt-1",children:(0,t.jsx)("a",{href:`mailto:${c.author.email}`,className:"text-blue-500 hover:text-blue-700",children:c.author.email})})]})]})]}),c.homepage&&(0,t.jsxs)(O.Card,{children:[(0,t.jsx)(L.Title,{children:"Homepage"}),(0,t.jsxs)("a",{href:c.homepage,target:"_blank",rel:"noopener noreferrer",className:"text-blue-500 hover:text-blue-700 flex items-center gap-2 mt-2",children:[c.homepage,(0,t.jsx)(B.ExternalLinkIcon,{className:"h-4 w-4"})]})]}),(0,t.jsxs)(O.Card,{children:[(0,t.jsx)(L.Title,{children:"Metadata"}),(0,t.jsxs)(F.Grid,{className:"grid grid-cols-1 sm:grid-cols-2 gap-4 mt-4",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)(R.Text,{className:"text-gray-600 text-xs",children:"Created At"}),(0,t.jsx)(R.Text,{className:"font-semibold mt-1",children:(0,d.formatDateString)(c.created_at)})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(R.Text,{className:"text-gray-600 text-xs",children:"Updated At"}),(0,t.jsx)(R.Text,{className:"font-semibold mt-1",children:(0,d.formatDateString)(c.updated_at)})]}),c.created_by&&(0,t.jsxs)("div",{className:"col-span-2",children:[(0,t.jsx)(R.Text,{className:"text-gray-600 text-xs",children:"Created By"}),(0,t.jsx)(R.Text,{className:"font-semibold mt-1",children:c.created_by})]})]})]})]})};e.s(["default",0,({accessToken:e,userRole:i})=>{let[n,o]=(0,l.useState)([]),[c,d]=(0,l.useState)(!1),[u,m]=(0,l.useState)(!1),[h,x]=(0,l.useState)(!1),[p,f]=(0,l.useState)(null),[b,y]=(0,l.useState)(null),j=!!i&&(0,D.isAdminRole)(i),v=async()=>{if(e){m(!0);try{let t=await (0,r.getClaudeCodePluginsList)(e,!1);console.log(`Claude Code plugins: ${JSON.stringify(t)}`),o(t.plugins)}catch(e){console.error("Error fetching Claude Code plugins:",e)}finally{m(!1)}}};(0,l.useEffect)(()=>{v()},[e]);let w=async()=>{if(p&&e){x(!0);try{await (0,r.deleteClaudeCodePlugin)(e,p.name),A.default.success(`Plugin "${p.displayName}" deleted successfully`),v()}catch(e){console.error("Error deleting plugin:",e),A.default.error("Failed to delete plugin")}finally{x(!1),f(null)}}};return(0,t.jsxs)("div",{className:"w-full mx-auto flex-auto overflow-y-auto m-8 p-2",children:[(0,t.jsxs)("div",{className:"flex flex-col gap-2 mb-4",children:[(0,t.jsx)("h1",{className:"text-2xl font-bold",children:"Claude Code Plugins"}),(0,t.jsxs)("p",{className:"text-sm text-gray-600",children:["Manage Claude Code marketplace plugins. Add, enable, disable, or delete plugins that will be available in your marketplace catalog. Enabled plugins will appear in the public marketplace at"," ",(0,t.jsx)("code",{className:"bg-gray-100 px-1 rounded",children:"/claude-code/marketplace.json"}),"."]}),(0,t.jsx)("div",{className:"mt-2",children:(0,t.jsx)(a.Button,{onClick:()=>{b&&y(null),d(!0)},disabled:!e||!j,children:"+ Add New Plugin"})})]}),b?(0,t.jsx)(U,{pluginId:b,onClose:()=>y(null),accessToken:e,isAdmin:j,onPluginUpdated:v}):(0,t.jsx)(P,{pluginsList:n,isLoading:u,onDeleteClick:(e,t)=>{f({name:e,displayName:t})},accessToken:e,onPluginUpdated:v,isAdmin:j,onPluginClick:e=>y(e)}),(0,t.jsx)(g,{visible:c,onClose:()=>{d(!1)},accessToken:e,onSuccess:()=>{v()}}),p&&(0,t.jsxs)(s.Modal,{title:"Delete Plugin",open:null!==p,onOk:w,onCancel:()=>{f(null)},confirmLoading:h,okText:"Delete",okButtonProps:{danger:!0},children:[(0,t.jsxs)("p",{children:["Are you sure you want to delete plugin:"," ",(0,t.jsx)("strong",{children:p.displayName}),"?"]}),(0,t.jsx)("p",{children:"This action cannot be undone."})]})]})}],704308)},368670,e=>{"use strict";var t=e.i(764205),l=e.i(266027);let a=(0,e.i(243652).createQueryKeys)("modelCostMap");e.s(["useModelCostMap",0,()=>(0,l.useQuery)({queryKey:a.list({}),queryFn:async()=>await (0,t.modelCostMap)(),staleTime:6e4,gcTime:6e4})])},226898,972520,e=>{"use strict";var t=e.i(843476),l=e.i(271645),a=e.i(304967),s=e.i(269200),r=e.i(427612),i=e.i(496020),n=e.i(389083),o=e.i(64848),c=e.i(977572),d=e.i(942232),u=e.i(599724),m=e.i(994388),h=e.i(752978),g=e.i(793130),x=e.i(404206),p=e.i(723731),f=e.i(653824),b=e.i(881073),y=e.i(197647),j=e.i(764205),v=e.i(28651),w=e.i(68155),_=e.i(220508),N=e.i(727749),k=e.i(158392);let C=({accessToken:e,userRole:a,userID:s,modelData:r})=>{let[i,n]=(0,l.useState)({routerSettings:{},selectedStrategy:null,enableTagFiltering:!1}),[o,c]=(0,l.useState)([]),[d,u]=(0,l.useState)({}),[h,g]=(0,l.useState)({});return((0,l.useEffect)(()=>{e&&a&&s&&((0,j.getCallbacksCall)(e,s,a).then(e=>{console.log("callbacks",e);let t=e.router_settings;"model_group_retry_policy"in t&&delete t.model_group_retry_policy;let l=t.routing_strategy||null;n(e=>({...e,routerSettings:t,selectedStrategy:l}))}),(0,j.getRouterSettingsCall)(e).then(e=>{if(console.log("router settings from API",e),e.fields){let t={};e.fields.forEach(e=>{t[e.field_name]={ui_field_name:e.ui_field_name,field_description:e.field_description,options:e.options,link:e.link}}),u(t);let l=e.fields.find(e=>"routing_strategy"===e.field_name);l?.options&&c(l.options),e.routing_strategy_descriptions&&g(e.routing_strategy_descriptions);let a=e.fields.find(e=>"enable_tag_filtering"===e.field_name);a?.field_value!==null&&a?.field_value!==void 0&&n(e=>({...e,enableTagFiltering:a.field_value}))}}))},[e,a,s]),e)?(0,t.jsxs)("div",{className:"w-full",children:[(0,t.jsx)(k.default,{value:i,onChange:n,routerFieldsMetadata:d,availableRoutingStrategies:o,routingStrategyDescriptions:h}),(0,t.jsxs)("div",{className:"border-t border-gray-200 pt-6 flex justify-end gap-3",children:[(0,t.jsx)(m.Button,{variant:"secondary",size:"sm",onClick:()=>window.location.reload(),className:"text-sm",children:"Reset"}),(0,t.jsx)(m.Button,{size:"sm",onClick:()=>{if(!e)return;let t=i.routerSettings;console.log("router_settings",t);let l=new Set(["allowed_fails","cooldown_time","num_retries","timeout","retry_after"]),a=new Set(["model_group_alias","retry_policy"]),s=Object.fromEntries(Object.entries({...t,enable_tag_filtering:i.enableTagFiltering}).map(([e,t])=>{if("routing_strategy_args"!==e&&"routing_strategy"!==e&&"enable_tag_filtering"!==e){let s=document.querySelector(`input[name="${e}"]`),r=((e,t,s)=>{if(void 0===t)return s;let r=t.trim();if("null"===r.toLowerCase())return null;if(l.has(e)){let e=Number(r);return Number.isNaN(e)?s:e}if(a.has(e)){if(""===r)return null;try{return JSON.parse(r)}catch{return s}}return"true"===r.toLowerCase()||"false"!==r.toLowerCase()&&r})(e,s?.value,t);return[e,r]}if("routing_strategy"===e)return[e,i.selectedStrategy];if("enable_tag_filtering"===e)return[e,i.enableTagFiltering];if("routing_strategy_args"===e&&"latency-based-routing"===i.selectedStrategy){let e={},t=document.querySelector('input[name="lowest_latency_buffer"]'),l=document.querySelector('input[name="ttl"]');return t?.value&&(e.lowest_latency_buffer=Number(t.value)),l?.value&&(e.ttl=Number(l.value)),console.log(`setRoutingStrategyArgs: ${e}`),["routing_strategy_args",e]}return null}).filter(e=>null!=e));console.log("updatedVariables",s);try{(0,j.setCallbacksCall)(e,{router_settings:s})}catch(e){N.default.fromBackend("Failed to update router settings: "+e)}N.default.success("router settings updated successfully")},className:"text-sm font-medium",children:"Save Changes"})]})]}):null};e.i(247167);var S=e.i(368670);let T=l.forwardRef(function(e,t){return l.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:t},e),l.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M14 5l7 7m0 0l-7 7m7-7H3"}))});var I=e.i(122577),E=e.i(592968),A=e.i(898586),P=e.i(356449),D=e.i(127952),M=e.i(418371),B=e.i(464571),O=e.i(888259),F=e.i(689020),R=e.i(212931);let L=(0,e.i(475254).default)("arrow-right",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]);function z({open:e,onCancel:l,children:a}){return(0,t.jsx)(R.Modal,{title:(0,t.jsx)("div",{className:"pb-4 border-b border-gray-100",children:(0,t.jsxs)("div",{className:"flex items-center gap-2 text-gray-800",children:[(0,t.jsx)("div",{className:"p-2 bg-indigo-50 rounded-lg",children:(0,t.jsx)(L,{className:"w-5 h-5 text-indigo-600"})}),(0,t.jsxs)("div",{children:[(0,t.jsx)("h2",{className:"text-lg font-bold m-0",children:"Configure Model Fallbacks"}),(0,t.jsx)("p",{className:"text-sm text-gray-500 font-normal m-0",children:"Manage multiple fallback chains for different models (up to 5 groups at a time)"})]})]})}),open:e,width:900,footer:null,onCancel:l,maskClosable:!1,className:"top-8",styles:{body:{padding:"24px"},header:{padding:"24px 24px 0 24px",border:"none"}},children:(0,t.jsx)("div",{className:"mt-6",children:a})})}e.s(["ArrowRight",()=>L],972520);var U=e.i(419470);function H({models:e,accessToken:a,value:s=[],onChange:r}){let[i,n]=(0,l.useState)(!1),[o,c]=(0,l.useState)([]),[d,u]=(0,l.useState)(0),[h,g]=(0,l.useState)(!1),[x,p]=(0,l.useState)([{id:"1",primaryModel:null,fallbackModels:[]}]);(0,l.useEffect)(()=>{i&&(p([{id:"1",primaryModel:null,fallbackModels:[]}]),u(e=>e+1))},[i]),(0,l.useEffect)(()=>{let e=async()=>{try{let e=await (0,F.fetchAvailableModels)(a);console.log("Fetched models for fallbacks:",e),c(e)}catch(e){console.error("Error fetching model info for fallbacks:",e)}};i&&e()},[a,i]);let f=Array.from(new Set(o.map(e=>e.model_group))).sort(),b=()=>{n(!1),p([{id:"1",primaryModel:null,fallbackModels:[]}])},y=async()=>{let e=x.filter(e=>!e.primaryModel||0===e.fallbackModels.length);if(e.length>0)return void O.default.error(`Please complete configuration for all groups. ${e.length} group(s) incomplete.`);let t=[...s||[],...x.map(e=>({[e.primaryModel]:e.fallbackModels}))];if(r){g(!0);try{await r(t),N.default.success(`${x.length} fallback configuration(s) added successfully!`),b()}catch(e){console.error("Error saving fallbacks:",e)}finally{g(!1)}}else N.default.fromBackend("onChange callback not provided")};return(0,t.jsxs)("div",{children:[(0,t.jsx)(m.Button,{className:"mx-auto",onClick:()=>n(!0),icon:()=>(0,t.jsx)("span",{className:"mr-1",children:"+"}),children:"Add Fallbacks"}),(0,t.jsxs)(z,{open:i,onCancel:b,children:[(0,t.jsx)(U.FallbackSelectionForm,{groups:x,onGroupsChange:p,availableModels:f,maxFallbacks:10,maxGroups:5},d),x.length>0&&(0,t.jsxs)("div",{className:"flex items-center justify-end space-x-3 pt-6 mt-6 border-t border-gray-100",children:[(0,t.jsx)(B.Button,{type:"default",onClick:b,disabled:h,children:"Cancel"}),(0,t.jsx)(B.Button,{type:"default",onClick:y,disabled:0===x.length||h,loading:h,children:h?"Saving Configuration...":"Save All Configurations"})]})]})]})}let V="inline-flex items-center gap-2 px-2.5 py-1 rounded-md border border-gray-200 bg-gray-50 text-sm font-medium text-gray-800 shrink-0";async function $(e,l){console.log=function(){};let a=window.location.origin,s=new P.default.OpenAI({apiKey:l,baseURL:a,dangerouslyAllowBrowser:!0});try{N.default.info("Testing fallback model response...");let l=await s.chat.completions.create({model:e,messages:[{role:"user",content:"Hi, this is a test message"}],mock_testing_fallbacks:!0});N.default.success((0,t.jsxs)("span",{children:["Test model=",(0,t.jsx)("strong",{children:e}),", received model=",(0,t.jsx)("strong",{children:l.model}),". See"," ",(0,t.jsx)("a",{href:"#",onClick:()=>window.open("https://docs.litellm.ai/docs/proxy/reliability","_blank"),style:{textDecoration:"underline",color:"blue"},children:"curl"})]}))}catch(e){N.default.fromBackend(`Error occurred while generating model response. Please try again. Error: ${e}`)}}let q=({accessToken:e,userRole:a,userID:n,modelData:u})=>{let[m,g]=(0,l.useState)({}),[x,p]=(0,l.useState)(!1),[f,b]=(0,l.useState)(null),[y,v]=(0,l.useState)(!1),{data:_}=(0,S.useModelCostMap)(),k=e=>null!=_&&"object"==typeof _&&e in _?_[e].litellm_provider??"":"";(0,l.useEffect)(()=>{e&&a&&n&&(0,j.getCallbacksCall)(e,n,a).then(e=>{console.log("callbacks",e);let t=e.router_settings;"model_group_retry_policy"in t&&delete t.model_group_retry_policy,g(t)})},[e,a,n]);let C=e=>{b(e),v(!0)},P=async()=>{if(!f||!e)return;let t=Object.keys(f)[0];if(!t)return;p(!0);let l=m.fallbacks.map(e=>{let l={...e};return t in l&&Array.isArray(l[t])&&delete l[t],l}).filter(e=>Object.keys(e).length>0),a={...m,fallbacks:l};try{await (0,j.setCallbacksCall)(e,{router_settings:a}),g(a),N.default.success("Router settings updated successfully")}catch(e){N.default.fromBackend("Failed to update router settings: "+e)}finally{p(!1),v(!1),b(null)}};if(!e)return null;let B=async t=>{if(!e)return;let l={...m,fallbacks:t};try{await (0,j.setCallbacksCall)(e,{router_settings:l}),g(l)}catch(t){throw N.default.fromBackend("Failed to update router settings: "+t),e&&a&&n&&(0,j.getCallbacksCall)(e,n,a).then(e=>{let t=e.router_settings;"model_group_retry_policy"in t&&delete t.model_group_retry_policy,g(t)}),t}},O=Array.isArray(m.fallbacks)&&m.fallbacks.length>0;return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(H,{models:u?.data?u.data.map(e=>e.model_name):[],accessToken:e||"",value:m.fallbacks||[],onChange:B}),O?(0,t.jsxs)(s.Table,{children:[(0,t.jsx)(r.TableHead,{children:(0,t.jsxs)(i.TableRow,{children:[(0,t.jsx)(o.TableHeaderCell,{children:"Model Name"}),(0,t.jsx)(o.TableHeaderCell,{children:"Fallbacks"}),(0,t.jsx)(o.TableHeaderCell,{children:"Actions"})]})}),(0,t.jsx)(d.TableBody,{children:m.fallbacks.map((a,s)=>Object.entries(a).map(([r,n])=>{let o;return(0,t.jsxs)(i.TableRow,{children:[(0,t.jsx)(c.TableCell,{className:"align-top",children:(o=k?.(r)??r,(0,t.jsxs)("span",{className:V,children:[(0,t.jsx)(M.ProviderLogo,{provider:o,className:"w-4 h-4 shrink-0"}),(0,t.jsx)("span",{children:r})]}))}),(0,t.jsx)(c.TableCell,{className:"align-top",children:function(e,a,s){let r=Array.isArray(a)?a:[];if(0===r.length)return null;let i=({modelName:e})=>{let l=s?.(e)??e;return(0,t.jsxs)("span",{className:V,children:[(0,t.jsx)(M.ProviderLogo,{provider:l,className:"w-4 h-4 shrink-0"}),(0,t.jsx)("span",{children:e})]})};return(0,t.jsxs)("span",{className:"grid grid-cols-[auto_1fr] items-start gap-x-2 w-full min-w-0",children:[(0,t.jsx)("span",{className:"inline-flex items-center justify-center w-8 h-8 shrink-0 self-start text-blue-600","aria-hidden":!0,children:(0,t.jsx)(T,{className:"w-5 h-5 stroke-[2.5]"})}),(0,t.jsx)("span",{className:"flex flex-wrap items-start gap-1 min-w-0",children:r.map((e,a)=>(0,t.jsxs)(l.default.Fragment,{children:[a>0&&(0,t.jsx)(h.Icon,{icon:T,size:"xs",className:"shrink-0 text-gray-400"}),(0,t.jsx)(i,{modelName:e})]},e))})]})}(0,Array.isArray(n)?n:[],k)}),(0,t.jsxs)(c.TableCell,{className:"align-top",children:[(0,t.jsx)(E.Tooltip,{title:"Test fallback",children:(0,t.jsx)(h.Icon,{icon:I.PlayIcon,size:"sm",onClick:()=>$(Object.keys(a)[0],e||""),className:"cursor-pointer hover:text-blue-600"})}),(0,t.jsx)(E.Tooltip,{title:"Delete fallback",children:(0,t.jsx)("span",{"data-testid":"delete-fallback-button",role:"button",tabIndex:0,onClick:()=>C(a),onKeyDown:e=>"Enter"===e.key&&C(a),className:"cursor-pointer inline-flex",children:(0,t.jsx)(h.Icon,{icon:w.TrashIcon,size:"sm",className:"hover:text-red-600"})})})]})]},s.toString()+r)}))})]}):(0,t.jsx)("div",{className:"rounded-lg border border-gray-200 bg-gray-50 px-4 py-6 text-center",children:(0,t.jsx)(A.Typography.Text,{type:"secondary",children:"No fallbacks configured. Add fallbacks to automatically try another model when the primary fails."})}),(0,t.jsx)(D.default,{isOpen:y,title:"Delete Fallback?",message:"Are you sure you want to delete this fallback? This action cannot be undone.",resourceInformationTitle:"Fallback Information",resourceInformation:[{label:"Model Name",value:f?Object.keys(f)[0]:"",code:!0}],onCancel:()=>{v(!1),b(null)},onOk:P,confirmLoading:x})]})};e.s(["default",0,({accessToken:e,userRole:N,userID:k,modelData:S})=>{let[T,I]=(0,l.useState)([]);(0,l.useEffect)(()=>{e&&(0,j.getGeneralSettingsCall)(e).then(e=>{I(e)})},[e]);let E=(e,t)=>{I(T.map(l=>l.field_name===e?{...l,field_value:t}:l))};return e?(0,t.jsx)("div",{className:"w-full",children:(0,t.jsxs)(f.TabGroup,{className:"h-[75vh] w-full",children:[(0,t.jsxs)(b.TabList,{variant:"line",defaultValue:"1",className:"px-8 pt-4",children:[(0,t.jsx)(y.Tab,{value:"1",children:"Loadbalancing"}),(0,t.jsx)(y.Tab,{value:"2",children:"Fallbacks"}),(0,t.jsx)(y.Tab,{value:"3",children:"General"})]}),(0,t.jsxs)(p.TabPanels,{className:"px-8 py-6",children:[(0,t.jsx)(x.TabPanel,{children:(0,t.jsx)(C,{accessToken:e,userRole:N,userID:k,modelData:S})}),(0,t.jsx)(x.TabPanel,{children:(0,t.jsx)(q,{accessToken:e,userRole:N,userID:k,modelData:S})}),(0,t.jsx)(x.TabPanel,{children:(0,t.jsx)(a.Card,{children:(0,t.jsxs)(s.Table,{children:[(0,t.jsx)(r.TableHead,{children:(0,t.jsxs)(i.TableRow,{children:[(0,t.jsx)(o.TableHeaderCell,{children:"Setting"}),(0,t.jsx)(o.TableHeaderCell,{children:"Value"}),(0,t.jsx)(o.TableHeaderCell,{children:"Status"}),(0,t.jsx)(o.TableHeaderCell,{children:"Action"})]})}),(0,t.jsx)(d.TableBody,{children:T.filter(e=>"TypedDictionary"!==e.field_type).map((l,a)=>(0,t.jsxs)(i.TableRow,{children:[(0,t.jsxs)(c.TableCell,{children:[(0,t.jsx)(u.Text,{children:l.field_name}),(0,t.jsx)("p",{style:{fontSize:"0.65rem",color:"#808080",fontStyle:"italic"},className:"mt-1",children:l.field_description})]}),(0,t.jsx)(c.TableCell,{children:"Integer"==l.field_type?(0,t.jsx)(v.InputNumber,{step:1,value:l.field_value,onChange:e=>E(l.field_name,e)}):"Boolean"==l.field_type?(0,t.jsx)(g.Switch,{checked:!0===l.field_value||"true"===l.field_value,onChange:e=>E(l.field_name,e)}):null}),(0,t.jsx)(c.TableCell,{children:!0==l.stored_in_db?(0,t.jsx)(n.Badge,{icon:_.CheckCircleIcon,className:"text-white",children:"In DB"}):!1==l.stored_in_db?(0,t.jsx)(n.Badge,{className:"text-gray bg-white outline",children:"In Config"}):(0,t.jsx)(n.Badge,{className:"text-gray bg-white outline",children:"Not Set"})}),(0,t.jsxs)(c.TableCell,{children:[(0,t.jsx)(m.Button,{onClick:()=>((t,l)=>{if(!e)return;let a=T[l].field_value;if(null!=a&&void 0!=a)try{(0,j.updateConfigFieldSetting)(e,t,a);let l=T.map(e=>e.field_name===t?{...e,stored_in_db:!0}:e);I(l)}catch(e){}})(l.field_name,a),children:"Update"}),(0,t.jsx)(h.Icon,{icon:w.TrashIcon,color:"red",onClick:()=>((t,l)=>{if(e)try{(0,j.deleteConfigFieldSetting)(e,t);let l=T.map(e=>e.field_name===t?{...e,stored_in_db:null,field_value:null}:e);I(l)}catch(e){}})(l.field_name,0),children:"Reset"})]})]},a))})]})})})]})]})}):null}],226898)},566606,e=>{"use strict";var t=e.i(843476),l=e.i(271645),a=e.i(618566),s=e.i(947293),r=e.i(764205),i=e.i(954616),n=e.i(266027),o=e.i(612256);let c=(0,e.i(243652).createQueryKeys)("onboarding");var d=e.i(482725),u=e.i(56456);function m(){return(0,t.jsx)("div",{className:"mx-auto w-full max-w-md mt-10 flex justify-center",children:(0,t.jsx)(d.Spin,{indicator:(0,t.jsx)(u.LoadingOutlined,{spin:!0}),size:"large"})})}var h=e.i(560445),g=e.i(464571);function x(){return(0,t.jsxs)("div",{className:"mx-auto w-full max-w-md mt-10",children:[(0,t.jsx)(h.Alert,{type:"error",message:"Failed to load invitation",description:"The invitation link may be invalid or expired.",showIcon:!0}),(0,t.jsx)("div",{className:"mt-4",children:(0,t.jsx)(g.Button,{href:"/ui/login",children:"Back to Login"})})]})}var p=e.i(175712),f=e.i(808613),b=e.i(311451),y=e.i(898586);function j({variant:e,userEmail:a,isPending:s,claimError:r,onSubmit:i}){let[n]=f.Form.useForm();return l.default.useEffect(()=>{a&&n.setFieldValue("user_email",a)},[a,n]),(0,t.jsx)("div",{className:"mx-auto w-full max-w-md mt-10",children:(0,t.jsxs)(p.Card,{children:[(0,t.jsx)(y.Typography.Title,{level:5,className:"text-center mb-5",children:"🚅 LiteLLM"}),(0,t.jsx)(y.Typography.Title,{level:3,children:"reset_password"===e?"Reset Password":"Sign Up"}),(0,t.jsx)(y.Typography.Text,{children:"reset_password"===e?"Reset your password to access Admin UI.":"Claim your user account to login to Admin UI."}),"signup"===e&&(0,t.jsx)(h.Alert,{className:"mt-4",type:"info",message:"SSO",description:(0,t.jsxs)("div",{className:"flex justify-between items-center",children:[(0,t.jsx)("span",{children:"SSO is under the Enterprise Tier."}),(0,t.jsx)(g.Button,{type:"primary",size:"small",href:"https://forms.gle/W3U4PZpJGFHWtHyA9",target:"_blank",children:"Get Free Trial"})]}),showIcon:!0}),(0,t.jsxs)(f.Form,{className:"mt-10 mb-5",layout:"vertical",form:n,onFinish:e=>i({password:e.password}),children:[(0,t.jsx)(f.Form.Item,{label:"Email Address",name:"user_email",children:(0,t.jsx)(b.Input,{type:"email",disabled:!0})}),(0,t.jsx)(f.Form.Item,{label:"Password",name:"password",rules:[{required:!0,message:"password required to sign up"}],help:"reset_password"===e?"Enter your new password":"Create a password for your account",children:(0,t.jsx)(b.Input.Password,{})}),r&&(0,t.jsx)(h.Alert,{type:"error",message:r,showIcon:!0,className:"mb-4"}),(0,t.jsx)("div",{className:"mt-10",children:(0,t.jsx)(g.Button,{htmlType:"submit",loading:s,children:"reset_password"===e?"Reset Password":"Sign Up"})})]})]})})}function v({variant:e}){let d=(0,a.useSearchParams)().get("invitation_id"),[u,h]=l.default.useState(null),{data:g,isLoading:p,isError:f}=(e=>{let{isLoading:t}=(0,o.useUIConfig)();return(0,n.useQuery)({queryKey:c.detail(e??""),queryFn:async()=>{if(!e)throw Error("inviteId is required");return(0,r.getOnboardingCredentials)(e)},enabled:!!e&&!t})})(d),{mutate:b,isPending:y}=(0,i.useMutation)({mutationFn:async({accessToken:e,inviteId:t,userId:l,password:a})=>await (0,r.claimOnboardingToken)(e,t,l,a)}),v=g?.token?(0,s.jwtDecode)(g.token):null,w=v?.user_email??"",_=v?.user_id??null,N=v?.key??null,k=g?.token??null;return p?(0,t.jsx)(m,{}):f?(0,t.jsx)(x,{}):(0,t.jsx)(j,{variant:e,userEmail:w,isPending:y,claimError:u,onSubmit:e=>{N&&k&&_&&d&&(h(null),b({accessToken:N,inviteId:d,userId:_,password:e.password},{onSuccess:()=>{document.cookie=`token=${k}; path=/; SameSite=Lax`;let e=(0,r.getProxyBaseUrl)();window.location.href=e?`${e}/ui/?login=success`:"/ui/?login=success"},onError:e=>{h(e.message||"Failed to submit. Please try again.")}}))}})}function w(){let e=(0,a.useSearchParams)().get("action");return(0,t.jsx)(v,{variant:"reset_password"===e?"reset_password":"signup"})}function _(){return(0,t.jsx)(l.Suspense,{fallback:(0,t.jsx)("div",{className:"flex items-center justify-center min-h-screen",children:"Loading..."}),children:(0,t.jsx)(w,{})})}e.s(["default",()=>_],566606)},700514,e=>{"use strict";var t=e.i(271645);e.s(["defaultPageSize",0,25,"useBaseUrl",0,()=>{let[e,l]=(0,t.useState)("http://localhost:4000");return(0,t.useEffect)(()=>{{let{protocol:e,host:t}=window.location;l(`${e}//${t}`)}},[]),e}])},50882,e=>{"use strict";var t=e.i(843476),l=e.i(621482),a=e.i(243652),s=e.i(764205),r=e.i(135214);let i=(0,a.createQueryKeys)("infiniteKeyAliases");var n=e.i(56456),o=e.i(152473),c=e.i(199133),d=e.i(271645);e.s(["PaginatedKeyAliasSelect",0,({value:e,onChange:a,placeholder:u="Select a key alias",style:m,pageSize:h=50,allowClear:g=!0,disabled:x=!1,allFilters:p})=>{let[f,b]=(0,d.useState)(""),[y,j]=(0,o.useDebouncedState)("",{wait:300}),{data:v,fetchNextPage:w,hasNextPage:_,isFetchingNextPage:N,isLoading:k}=((e=50,t,a)=>{let{accessToken:n}=(0,r.default)();return(0,l.useInfiniteQuery)({queryKey:i.list({filters:{size:e,...t&&{search:t},...a&&{team_id:a}}}),queryFn:async({pageParam:l})=>await (0,s.keyAliasesCall)(n,l,e,t,a),initialPageParam:1,getNextPageParam:e=>{if(e.current_page{if(!v?.pages)return[];let e=new Set,t=[];for(let l of v.pages)for(let a of l.aliases)!a||e.has(a)||(e.add(a),t.push({label:a,value:a}));return t},[v]);return(0,t.jsx)(c.Select,{value:e||void 0,onChange:e=>{a?.(e??"")},placeholder:u,style:{width:"100%",...m},allowClear:g,disabled:x,showSearch:!0,filterOption:!1,onSearch:e=>{b(e),j(e)},searchValue:f,onPopupScroll:e=>{let t=e.currentTarget;(t.scrollTop+t.clientHeight)/t.scrollHeight>=.8&&_&&!N&&w()},loading:k,notFoundContent:k?(0,t.jsx)(n.LoadingOutlined,{spin:!0}):"No key aliases found",options:C,popupRender:e=>(0,t.jsxs)(t.Fragment,{children:[e,N&&(0,t.jsx)("div",{style:{textAlign:"center",padding:8},children:(0,t.jsx)(n.LoadingOutlined,{spin:!0})})]})})}],50882)},693569,e=>{"use strict";var t=e.i(843476),l=e.i(268004),a=e.i(309426),s=e.i(350967),r=e.i(898586),i=e.i(947293),n=e.i(618566),o=e.i(271645),c=e.i(566606),d=e.i(584578),u=e.i(764205),m=e.i(702597),h=e.i(207082),g=e.i(109799),x=e.i(500330),p=e.i(871943),f=e.i(502547),b=e.i(360820),y=e.i(94629),j=e.i(152990),v=e.i(682830),w=e.i(389083),_=e.i(994388),N=e.i(752978),k=e.i(269200),C=e.i(942232),S=e.i(977572),T=e.i(427612),I=e.i(64848),E=e.i(496020),A=e.i(599724),P=e.i(827252),D=e.i(772345),M=e.i(464571),B=e.i(282786),O=e.i(981339),F=e.i(592968),R=e.i(355619),L=e.i(633627),z=e.i(374009),U=e.i(700514),H=e.i(135214),V=e.i(50882),$=e.i(969550),q=e.i(304911),K=e.i(20147);function G({teams:e,organizations:l,onSortChange:a,currentSort:s}){let{data:i}=(0,g.useOrganizations)(),n=i??l??[],[c,d]=(0,o.useState)(null),[m,G]=o.default.useState(()=>s?[{id:s.sortBy,desc:"desc"===s.sortOrder}]:[{id:"created_at",desc:!0}]),[W,J]=o.default.useState({pageIndex:0,pageSize:50}),Y=m.length>0?m[0].id:null,Q=m.length>0?m[0].desc?"desc":"asc":null,{data:X,isPending:Z,isFetching:ee,isError:et,refetch:el}=(0,h.useKeys)(W.pageIndex+1,W.pageSize,{sortBy:Y||void 0,sortOrder:Q||void 0,expand:"user"}),[ea,es]=(0,o.useState)({}),{filters:er,filteredKeys:ei,filteredTotalCount:en,allTeams:eo,allOrganizations:ec,handleFilterChange:ed,handleFilterReset:eu}=function({keys:e,teams:t,organizations:l}){let a={"Team ID":"","Organization ID":"","Key Alias":"","User ID":"","Sort By":"created_at","Sort Order":"desc"},{accessToken:s}=(0,H.default)(),[r,i]=(0,o.useState)(a),[n,c]=(0,o.useState)(t||[]),[d,m]=(0,o.useState)(l||[]),[h,g]=(0,o.useState)(e),[x,p]=(0,o.useState)(null),f=(0,o.useRef)(0),b=(0,o.useCallback)((0,z.default)(async e=>{if(!s)return;let t=Date.now();f.current=t;try{let l=await (0,u.keyListCall)(s,e["Organization ID"]||null,e["Team ID"]||null,e["Key Alias"]||null,e["User ID"]||null,e["Key Hash"]||null,1,U.defaultPageSize,e["Sort By"]||null,e["Sort Order"]||null);t===f.current&&l&&(g(l.keys),p(l.total_count??null),console.log("called from debouncedSearch filters:",JSON.stringify(e)),console.log("called from debouncedSearch data:",JSON.stringify(l)))}catch(e){console.error("Error searching users:",e)}},300),[s]);return(0,o.useEffect)(()=>{if(!e)return void g([]);let t=[...e];r["Team ID"]&&(t=t.filter(e=>e.team_id===r["Team ID"])),r["Organization ID"]&&(t=t.filter(e=>(e.organization_id??e.org_id)===r["Organization ID"])),g(t)},[e,r]),(0,o.useEffect)(()=>{let e=async()=>{let e=await (0,L.fetchAllTeams)(s);e.length>0&&c(e);let t=await (0,L.fetchAllOrganizations)(s);t.length>0&&m(t)};s&&e()},[s]),(0,o.useEffect)(()=>{t&&t.length>0&&c(e=>e.length{l&&l.length>0&&m(e=>e.length{i({"Team ID":e["Team ID"]||"","Organization ID":e["Organization ID"]||"","Key Alias":e["Key Alias"]||"","User ID":e["User ID"]||"","Sort By":e["Sort By"]||"created_at","Sort Order":e["Sort Order"]||"desc"}),t||b({...r,...e})},handleFilterReset:()=>{i(a),p(null),b(a)}}}({keys:X?.keys||[],teams:e,organizations:l}),em=(0,o.useDeferredValue)(ee),eh=(ee||em)&&!et,eg=en??X?.total_count??0;(0,o.useEffect)(()=>{if(el){let e=()=>{el()};return window.addEventListener("storage",e),()=>{window.removeEventListener("storage",e)}}},[el]);let ex=(0,o.useMemo)(()=>[{id:"expander",header:()=>null,size:40,enableSorting:!1,cell:({row:e})=>e.getCanExpand()?(0,t.jsx)("button",{onClick:e.getToggleExpandedHandler(),style:{cursor:"pointer"},children:e.getIsExpanded()?"▼":"▶"}):null},{id:"token",accessorKey:"token",header:"Key ID",size:100,enableSorting:!0,cell:e=>{let l=e.getValue(),a=e.cell.column.getSize();return(0,t.jsx)(F.Tooltip,{title:l,children:(0,t.jsx)(_.Button,{size:"xs",variant:"light",className:"font-mono text-blue-500 bg-blue-50 hover:bg-blue-100 text-xs font-normal px-2 py-0.5 text-left overflow-hidden truncate block",style:{maxWidth:a,overflow:"hidden"},onClick:()=>d(e.row.original),children:l??"-"})})}},{id:"key_alias",accessorKey:"key_alias",header:"Key Alias",size:150,enableSorting:!0,cell:e=>{let l=e.getValue(),a=e.cell.column.getSize();return(0,t.jsx)("span",{className:"font-mono text-xs truncate block",style:{maxWidth:a,overflow:"hidden"},children:l??"-"})}},{id:"key_name",accessorKey:"key_name",header:"Secret Key",size:120,enableSorting:!1,cell:e=>(0,t.jsx)("span",{className:"font-mono text-xs",children:e.getValue()})},{id:"team_alias",accessorKey:"team_id",header:"Team",size:120,enableSorting:!1,cell:l=>{let a=l.getValue();if(!a)return"-";let s=e?.find(e=>e.team_id===a),r=s?.team_alias||a,i=l.cell.column.getSize();return(0,t.jsx)("span",{className:"font-mono text-xs truncate block",style:{maxWidth:i,overflow:"hidden"},children:r})}},{id:"organization_alias",accessorKey:"org_id",header:"Organization",size:140,enableSorting:!1,cell:e=>{let l=e.getValue();if(!l)return"-";let a=n.find(e=>e.organization_id===l),s=a?.organization_alias||l,r=e.cell.column.getSize();return(0,t.jsx)("span",{className:"font-mono text-xs truncate block",style:{maxWidth:r,overflow:"hidden"},children:s})}},{id:"user",accessorKey:"user",header:()=>(0,t.jsxs)("span",{className:"flex items-center gap-1",children:["User",(0,t.jsx)(B.Popover,{content:"Displays the first available value: User Alias, User Email, or User ID.",trigger:"hover",children:(0,t.jsx)(P.InfoCircleOutlined,{className:"text-gray-400 text-xs cursor-help"})})]}),size:160,enableSorting:!1,cell:({row:e})=>{let l=e.original,a=l.user?.user_alias??null,s=l.user?.user_email??l.user_email??null,i=l.user_id??null,n="default_user_id"===i,o=a||s||i,c=(0,t.jsx)("div",{className:"flex flex-col gap-2 text-xs min-w-[200px] max-w-[300px]",children:[{label:"User Alias",value:a},{label:"User Email",value:s},{label:"User ID",value:i}].map(({label:e,value:l})=>(0,t.jsxs)("div",{className:"flex flex-col min-w-0",children:[(0,t.jsx)("span",{className:"text-gray-400",children:e}),l?(0,t.jsx)(r.Typography.Text,{className:"font-mono text-xs",ellipsis:{tooltip:l},copyable:!0,children:l}):(0,t.jsx)("span",{className:"font-mono",children:"-"})]},e))});return!n||a||s?(0,t.jsx)(B.Popover,{content:c,trigger:"hover",placement:"bottomLeft",children:(0,t.jsx)("span",{className:"font-mono text-xs truncate block cursor-default",style:{maxWidth:160,overflow:"hidden"},children:o||"-"})}):(0,t.jsx)(B.Popover,{content:c,trigger:"hover",placement:"bottomLeft",children:(0,t.jsx)("span",{className:"cursor-default",children:(0,t.jsx)(q.default,{userId:i})})})}},{id:"created_at",accessorKey:"created_at",header:"Created At",size:120,enableSorting:!0,cell:e=>{let t=e.getValue();return t?new Date(t).toLocaleDateString():"-"}},{id:"created_by",accessorKey:"created_by",header:"Created By",size:160,enableSorting:!1,cell:e=>{let l=e.getValue();if(!l)return"-";let a=e.row.original.created_by_user,s=a?.user_alias??null,i=a?.user_email??null,n="default_user_id"===l,o=s||i||l,c=(0,t.jsx)("div",{className:"flex flex-col gap-2 text-xs min-w-[200px] max-w-[300px]",children:[{label:"User Alias",value:s},{label:"User Email",value:i},{label:"User ID",value:l}].map(({label:e,value:l})=>(0,t.jsxs)("div",{className:"flex flex-col min-w-0",children:[(0,t.jsx)("span",{className:"text-gray-400",children:e}),l?(0,t.jsx)(r.Typography.Text,{className:"font-mono text-xs",ellipsis:{tooltip:l},copyable:!0,children:l}):(0,t.jsx)("span",{className:"font-mono",children:"-"})]},e))});return!n||s||i?(0,t.jsx)(B.Popover,{content:c,trigger:"hover",placement:"bottomLeft",children:(0,t.jsx)("span",{className:"font-mono text-xs truncate block cursor-default",style:{maxWidth:160,overflow:"hidden"},children:o})}):(0,t.jsx)(B.Popover,{content:c,trigger:"hover",placement:"bottomLeft",children:(0,t.jsx)("span",{className:"cursor-default",children:(0,t.jsx)(q.default,{userId:l})})})}},{id:"updated_at",accessorKey:"updated_at",header:"Updated At",size:120,enableSorting:!0,cell:e=>{let t=e.getValue();return t?new Date(t).toLocaleDateString():"Never"}},{id:"last_active",accessorKey:"last_active",header:()=>(0,t.jsxs)("span",{className:"flex items-center gap-1",children:["Last Active",(0,t.jsx)(B.Popover,{content:"This is a new field and is not backfilled. Only new key usage will update this value.",trigger:"hover",children:(0,t.jsx)(P.InfoCircleOutlined,{className:"text-gray-400 text-xs cursor-help"})})]}),size:130,enableSorting:!1,cell:e=>{let l=e.getValue();if(!l)return"Unknown";let a=new Date(l);return(0,t.jsx)(F.Tooltip,{title:a.toLocaleString(void 0,{dateStyle:"medium",timeStyle:"long"}),children:(0,t.jsx)("span",{children:a.toLocaleDateString()})})}},{id:"expires",accessorKey:"expires",header:"Expires",size:120,enableSorting:!1,cell:e=>{let t=e.getValue();return t?new Date(t).toLocaleDateString():"Never"}},{id:"spend",accessorKey:"spend",header:"Spend (USD)",size:100,enableSorting:!0,cell:e=>(0,x.formatNumberWithCommas)(e.getValue(),4)},{id:"max_budget",accessorKey:"max_budget",header:"Budget (USD)",size:110,enableSorting:!0,cell:e=>{let t=e.getValue();return null===t?"Unlimited":`$${(0,x.formatNumberWithCommas)(t)}`}},{id:"budget_reset_at",accessorKey:"budget_reset_at",header:"Budget Reset",size:130,enableSorting:!1,cell:e=>{let t=e.getValue();return t?new Date(t).toLocaleString():"Never"}},{id:"models",accessorKey:"models",header:"Models",size:200,enableSorting:!1,cell:e=>{let l=e.getValue();return(0,t.jsx)("div",{className:"flex flex-col py-2",children:Array.isArray(l)?(0,t.jsx)("div",{className:"flex flex-col",children:0===l.length?(0,t.jsx)(w.Badge,{size:"xs",className:"mb-1",color:"red",children:(0,t.jsx)(A.Text,{children:"All Proxy Models"})}):(0,t.jsx)(t.Fragment,{children:(0,t.jsxs)("div",{className:"flex items-start",children:[l.length>3&&(0,t.jsx)("div",{children:(0,t.jsx)(N.Icon,{icon:ea[e.row.id]?p.ChevronDownIcon:f.ChevronRightIcon,className:"cursor-pointer",size:"xs",onClick:()=>{es(t=>({...t,[e.row.id]:!t[e.row.id]}))}})}),(0,t.jsxs)("div",{className:"flex flex-wrap gap-1",children:[l.slice(0,3).map((e,l)=>"all-proxy-models"===e?(0,t.jsx)(w.Badge,{size:"xs",color:"red",children:(0,t.jsx)(A.Text,{children:"All Proxy Models"})},l):(0,t.jsx)(w.Badge,{size:"xs",color:"blue",children:(0,t.jsx)(A.Text,{children:e.length>30?`${(0,R.getModelDisplayName)(e).slice(0,30)}...`:(0,R.getModelDisplayName)(e)})},l)),l.length>3&&!ea[e.row.id]&&(0,t.jsx)(w.Badge,{size:"xs",color:"gray",className:"cursor-pointer",children:(0,t.jsxs)(A.Text,{children:["+",l.length-3," ",l.length-3==1?"more model":"more models"]})}),ea[e.row.id]&&(0,t.jsx)("div",{className:"flex flex-wrap gap-1",children:l.slice(3).map((e,l)=>"all-proxy-models"===e?(0,t.jsx)(w.Badge,{size:"xs",color:"red",children:(0,t.jsx)(A.Text,{children:"All Proxy Models"})},l+3):(0,t.jsx)(w.Badge,{size:"xs",color:"blue",children:(0,t.jsx)(A.Text,{children:e.length>30?`${(0,R.getModelDisplayName)(e).slice(0,30)}...`:(0,R.getModelDisplayName)(e)})},l+3))})]})]})})}):null})}},{id:"rate_limits",header:"Rate Limits",size:140,enableSorting:!1,cell:({row:e})=>{let l=e.original;return(0,t.jsxs)("div",{children:[(0,t.jsxs)("div",{children:["TPM: ",null!==l.tpm_limit?l.tpm_limit:"Unlimited"]}),(0,t.jsxs)("div",{children:["RPM: ",null!==l.rpm_limit?l.rpm_limit:"Unlimited"]})]})}}],[e,n]),ep=[{name:"Team ID",label:"Team ID",isSearchable:!0,searchFn:async e=>eo&&0!==eo.length?eo.filter(t=>t.team_id.toLowerCase().includes(e.toLowerCase())||t.team_alias&&t.team_alias.toLowerCase().includes(e.toLowerCase())).map(e=>({label:`${e.team_alias||e.team_id} (${e.team_id})`,value:e.team_id})):[]},{name:"Organization ID",label:"Organization ID",isSearchable:!0,searchFn:async e=>ec&&0!==ec.length?ec.filter(t=>t.organization_id?.toLowerCase().includes(e.toLowerCase())??!1).filter(e=>null!==e.organization_id&&void 0!==e.organization_id).map(e=>({label:`${e.organization_id||"Unknown"} (${e.organization_id})`,value:e.organization_id})):[]},{name:"Key Alias",label:"Key Alias",customComponent:V.PaginatedKeyAliasSelect},{name:"User ID",label:"User ID",isSearchable:!1},{name:"Key Hash",label:"Key Hash",isSearchable:!1}],ef=(0,j.useReactTable)({data:ei,columns:ex.filter(e=>"expander"!==e.id),columnResizeMode:"onChange",columnResizeDirection:"ltr",state:{sorting:m,pagination:W},onSortingChange:e=>{let t="function"==typeof e?e(m):e;if(G(t),t&&t.length>0){let e=t[0],l=e.id,s=e.desc?"desc":"asc";ed({...er,"Sort By":l,"Sort Order":s},!0),a?.(l,s)}},onPaginationChange:J,getCoreRowModel:(0,v.getCoreRowModel)(),getSortedRowModel:(0,v.getSortedRowModel)(),getPaginationRowModel:(0,v.getPaginationRowModel)(),enableSorting:!0,manualSorting:!1,manualPagination:!0,pageCount:Math.ceil(eg/W.pageSize)});o.default.useEffect(()=>{s&&G([{id:s.sortBy,desc:"desc"===s.sortOrder}])},[s]);let{pageIndex:eb,pageSize:ey}=ef.getState().pagination,ej=Math.min((eb+1)*ey,eg),ev=`${eb*ey+1} - ${ej}`;return(0,t.jsx)("div",{className:"w-full h-full overflow-hidden",children:c?(0,t.jsx)(K.default,{keyId:c.token,onClose:()=>d(null),keyData:c,teams:eo,onDelete:el}):(0,t.jsxs)("div",{className:"border-b py-4 flex-1 overflow-hidden",children:[(0,t.jsx)("div",{className:"w-full mb-6",children:(0,t.jsx)($.default,{options:ep,onApplyFilters:ed,initialValues:er,onResetFilters:eu})}),(0,t.jsxs)("div",{className:"flex items-center justify-between w-full mb-4",children:[(0,t.jsxs)("div",{className:"inline-flex items-center gap-2",children:[Z?(0,t.jsx)(O.Skeleton.Node,{active:!0,style:{width:200,height:20}}):(0,t.jsxs)("span",{className:"inline-flex text-sm text-gray-700",children:["Showing ",ev," of ",eg," results"]}),(0,t.jsx)(M.Button,{type:"default",icon:(0,t.jsx)(D.SyncOutlined,{spin:eh}),onClick:()=>{el()},disabled:eh,title:"Fetch data",children:eh?"Fetching":"Fetch"})]}),(0,t.jsxs)("div",{className:"inline-flex items-center gap-2",children:[Z?(0,t.jsx)(O.Skeleton.Node,{active:!0,style:{width:74,height:20}}):(0,t.jsxs)("span",{className:"text-sm text-gray-700",children:["Page ",eb+1," of ",ef.getPageCount()]}),Z?(0,t.jsx)(O.Skeleton.Button,{active:!0,size:"small",style:{width:84,height:30}}):(0,t.jsx)("button",{onClick:()=>ef.previousPage(),disabled:Z||!ef.getCanPreviousPage(),className:"px-3 py-1 text-sm border rounded-md hover:bg-gray-50 disabled:opacity-50 disabled:cursor-not-allowed",children:"Previous"}),Z?(0,t.jsx)(O.Skeleton.Button,{active:!0,size:"small",style:{width:58,height:30}}):(0,t.jsx)("button",{onClick:()=>ef.nextPage(),disabled:Z||!ef.getCanNextPage(),className:"px-3 py-1 text-sm border rounded-md hover:bg-gray-50 disabled:opacity-50 disabled:cursor-not-allowed",children:"Next"})]})]}),(0,t.jsx)("div",{className:"h-[75vh] overflow-auto",children:(0,t.jsx)("div",{className:"rounded-lg custom-border relative",children:(0,t.jsx)("div",{className:"overflow-x-auto",children:(0,t.jsxs)(k.Table,{className:"[&_td]:py-0.5 [&_th]:py-1",style:{width:ef.getCenterTotalSize()},children:[(0,t.jsx)(T.TableHead,{children:ef.getHeaderGroups().map(e=>(0,t.jsx)(E.TableRow,{children:e.headers.map(e=>(0,t.jsx)(I.TableHeaderCell,{"data-header-id":e.id,className:`py-1 h-8 relative hover:bg-gray-50 ${"actions"===e.id?"sticky right-0 bg-white shadow-[-4px_0_8px_-6px_rgba(0,0,0,0.1)]":""}`,style:{width:e.getSize(),position:"relative",cursor:e.column.getCanSort()?"pointer":"default"},onMouseEnter:()=>{let t=document.querySelector(`[data-header-id="${e.id}"] .resizer`);t&&(t.style.opacity="0.5")},onMouseLeave:()=>{let t=document.querySelector(`[data-header-id="${e.id}"] .resizer`);t&&!e.column.getIsResizing()&&(t.style.opacity="0")},onClick:e.column.getCanSort()?e.column.getToggleSortingHandler():void 0,children:(0,t.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,t.jsx)("div",{className:"flex items-center",children:e.isPlaceholder?null:(0,j.flexRender)(e.column.columnDef.header,e.getContext())}),"actions"!==e.id&&e.column.getCanSort()&&(0,t.jsx)("div",{className:"w-4",children:e.column.getIsSorted()?({asc:(0,t.jsx)(b.ChevronUpIcon,{className:"h-4 w-4 text-blue-500"}),desc:(0,t.jsx)(p.ChevronDownIcon,{className:"h-4 w-4 text-blue-500"})})[e.column.getIsSorted()]:(0,t.jsx)(y.SwitchVerticalIcon,{className:"h-4 w-4 text-gray-400"})}),(0,t.jsx)("div",{onDoubleClick:()=>e.column.resetSize(),onMouseDown:e.getResizeHandler(),onTouchStart:e.getResizeHandler(),className:`resizer ${ef.options.columnResizeDirection} ${e.column.getIsResizing()?"isResizing":""}`,style:{position:"absolute",right:0,top:0,height:"100%",width:"5px",background:e.column.getIsResizing()?"#3b82f6":"transparent",cursor:"col-resize",userSelect:"none",touchAction:"none",opacity:+!!e.column.getIsResizing()}})]})},e.id))},e.id))}),(0,t.jsx)(C.TableBody,{children:Z?(0,t.jsx)(E.TableRow,{children:(0,t.jsx)(S.TableCell,{colSpan:ex.length,className:"h-8 text-center",children:(0,t.jsx)("div",{className:"text-center text-gray-500",children:(0,t.jsx)("p",{children:"🚅 Loading keys..."})})})}):ei.length>0?ef.getRowModel().rows.map(e=>(0,t.jsx)(E.TableRow,{className:"h-8",children:e.getVisibleCells().map(e=>(0,t.jsx)(S.TableCell,{style:{width:e.column.getSize(),maxWidth:"8-x",whiteSpace:"pre-wrap",overflow:"hidden"},className:`py-0.5 max-h-8 overflow-hidden text-ellipsis whitespace-nowrap ${"models"===e.column.id&&Array.isArray(e.getValue())&&e.getValue().length>3?"px-0":""}`,children:(0,j.flexRender)(e.column.columnDef.cell,e.getContext())},e.id))},e.id)):(0,t.jsx)(E.TableRow,{children:(0,t.jsx)(S.TableCell,{colSpan:ex.length,className:"h-8 text-center",children:(0,t.jsx)("div",{className:"text-center text-gray-500",children:(0,t.jsx)("p",{children:"No keys found"})})})})})]})})})})]})})}e.s(["default",0,({userID:e,userRole:h,teams:g,keys:x,setUserRole:p,userEmail:f,setUserEmail:b,setTeams:y,setKeys:j,premiumUser:v,organizations:w,addKey:_,createClicked:N,autoOpenCreate:k,prefillData:C})=>{let S,[T,I]=(0,o.useState)(null),[E,A]=(0,o.useState)(null),P=(0,n.useSearchParams)(),D=(console.log("COOKIES",document.cookie),(S=document.cookie.split("; ").find(e=>e.startsWith("token=")))?S.split("=")[1]:null),M=P.get("invitation_id"),[B,O]=(0,o.useState)(null),[F,R]=(0,o.useState)(null),[L,z]=(0,o.useState)([]),[U,H]=(0,o.useState)(null),[V,$]=(0,o.useState)(null);if((0,o.useEffect)(()=>{let e=()=>{sessionStorage.clear()};return window.addEventListener("beforeunload",e),()=>window.removeEventListener("beforeunload",e)},[]),(0,o.useEffect)(()=>{if(D){let e=(0,i.jwtDecode)(D);if(e){if(console.log("Decoded token:",e),console.log("Decoded key:",e.key),O(e.key),e.user_role){let t=function(e){if(!e)return"Undefined Role";switch(console.log(`Received user role: ${e}`),e.toLowerCase()){case"app_owner":case"demo_app_owner":return"App Owner";case"app_admin":case"proxy_admin":return"Admin";case"proxy_admin_viewer":return"Admin Viewer";case"app_user":return"App User";case"internal_user":return"Internal User";case"internal_user_viewer":return"Internal Viewer";default:return"Unknown Role"}}(e.user_role);console.log("Decoded user_role:",t),p(t)}else console.log("User role not defined");e.user_email?b(e.user_email):console.log(`User Email is not set ${e}`)}}if(e&&B&&h&&!T){let t=sessionStorage.getItem("userModels"+e);t?z(JSON.parse(t)):(console.log(`currentOrg: ${JSON.stringify(E)}`),(async()=>{try{let t=await (0,u.getProxyUISettings)(B);H(t);let l=await (0,u.userGetInfoV2)(B,e);I(l),sessionStorage.setItem("userSpendData"+e,JSON.stringify(l));let a=(await (0,u.modelAvailableCall)(B,e,h)).data.map(e=>e.id);console.log("available_model_names:",a),z(a),console.log("userModels:",L),sessionStorage.setItem("userModels"+e,JSON.stringify(a))}catch(e){console.error("There was an error fetching the data",e),e.message.includes("Invalid proxy server token passed")&&q()}})(),(0,d.fetchTeams)(B,e,h,E,y))}},[e,D,B,h]),(0,o.useEffect)(()=>{B&&(async()=>{try{let e=await (0,u.keyInfoCall)(B,[B]);console.log("keyInfo: ",e)}catch(e){e.message.includes("Invalid proxy server token passed")&&q()}})()},[B]),(0,o.useEffect)(()=>{console.log(`currentOrg: ${JSON.stringify(E)}, accessToken: ${B}, userID: ${e}, userRole: ${h}`),B&&(console.log("fetching teams"),(0,d.fetchTeams)(B,e,h,E,y))},[E]),(0,o.useEffect)(()=>{if(null!==x&&null!=V&&null!==V.team_id){let e=0;for(let t of(console.log(`keys: ${JSON.stringify(x)}`),x))V.hasOwnProperty("team_id")&&null!==t.team_id&&t.team_id===V.team_id&&(e+=t.spend);console.log(`sum: ${e}`),R(e)}else if(null!==x){let e=0;for(let t of x)e+=t.spend;R(e)}},[V]),null!=M)return(0,t.jsx)(c.default,{});function q(){(0,l.clearTokenCookies)();let e=(0,u.getProxyBaseUrl)();console.log("proxyBaseUrl:",e);let t=e?`${e}/sso/key/generate`:"/sso/key/generate";return console.log("Full URL:",t),window.location.href=t,null}if(null==D)return console.log("All cookies before redirect:",document.cookie),q(),null;try{let e=(0,i.jwtDecode)(D);console.log("Decoded token:",e);let t=e.exp,l=Math.floor(Date.now()/1e3);if(t&&l>=t)return console.log("Token expired, redirecting to login"),q(),null}catch(e){return console.error("Error decoding token:",e),(0,l.clearTokenCookies)(),q(),null}if(null==B)return null;if(null==e)return(0,t.jsx)("h1",{children:"User ID is not set"});if(null==h&&p("App Owner"),h&&"Admin Viewer"==h){let{Title:e,Paragraph:l}=r.Typography;return(0,t.jsxs)("div",{children:[(0,t.jsx)(e,{level:1,children:"Access Denied"}),(0,t.jsx)(l,{children:"Ask your proxy admin for access to create keys"})]})}return console.log("inside user dashboard, selected team",V),console.log("All cookies after redirect:",document.cookie),(0,t.jsx)("div",{className:"w-full mx-4 h-[75vh]",children:(0,t.jsx)(s.Grid,{numItems:1,className:"gap-2 p-8 w-full mt-2",children:(0,t.jsxs)(a.Col,{numColSpan:1,className:"flex flex-col gap-2",children:[(0,t.jsx)(m.default,{team:V,teams:g,data:x,addKey:_,autoOpenCreate:k,prefillData:C},V?V.team_id:null),(0,t.jsx)(G,{teams:g,organizations:w})]})})})}],693569)},559061,e=>{"use strict";var t=e.i(843476),l=e.i(584935),a=e.i(304967),s=e.i(309426),r=e.i(350967),i=e.i(752978),n=e.i(621642),o=e.i(25080),c=e.i(37091),d=e.i(197647),u=e.i(653824),m=e.i(881073),h=e.i(404206),g=e.i(723731),x=e.i(599724),p=e.i(271645),f=e.i(727749),b=e.i(144267),y=e.i(278587),j=e.i(764205),v=e.i(994388),w=e.i(220508),_=e.i(964306),N=e.i(551332);let k=({responseTimeMs:e})=>null==e?null:(0,t.jsxs)("div",{className:"flex items-center space-x-1 text-xs text-gray-500 font-mono",children:[(0,t.jsx)("svg",{className:"w-4 h-4",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:(0,t.jsx)("path",{d:"M12 6V12L16 14M12 2C6.47715 2 2 6.47715 2 12C2 17.5228 6.47715 22 12 22C17.5228 22 22 17.5228 22 12C22 6.47715 17.5228 2 12 2Z",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}),(0,t.jsxs)("span",{children:[e.toFixed(0),"ms"]})]}),C=e=>{let t=e;if("string"==typeof t)try{t=JSON.parse(t)}catch{}return t},S=({label:e,value:l})=>{let[a,s]=p.default.useState(!1),[r,i]=p.default.useState(!1),n=l?.toString()||"N/A",o=n.length>50?n.substring(0,50)+"...":n;return(0,t.jsx)("tr",{className:"hover:bg-gray-50",children:(0,t.jsx)("td",{className:"px-4 py-2 align-top",colSpan:2,children:(0,t.jsxs)("div",{className:"flex items-center justify-between group",children:[(0,t.jsxs)("div",{className:"flex items-center flex-1",children:[(0,t.jsx)("button",{onClick:()=>s(!a),className:"text-gray-400 hover:text-gray-600 mr-2",children:a?"▼":"▶"}),(0,t.jsxs)("div",{children:[(0,t.jsx)("div",{className:"text-sm text-gray-600",children:e}),(0,t.jsx)("pre",{className:"mt-1 text-sm font-mono text-gray-800 whitespace-pre-wrap",children:a?n:o})]})]}),(0,t.jsx)("button",{onClick:()=>{navigator.clipboard.writeText(n),i(!0),setTimeout(()=>i(!1),2e3)},className:"opacity-0 group-hover:opacity-100 text-gray-400 hover:text-gray-600",children:(0,t.jsx)(N.ClipboardCopyIcon,{className:"h-4 w-4"})})]})})})},T=({response:e})=>{let l=null,a={},s={};try{if(e?.error)try{let t="string"==typeof e.error.message?JSON.parse(e.error.message):e.error.message;l={message:t?.message||"Unknown error",traceback:t?.traceback||"No traceback available",litellm_params:t?.litellm_cache_params||{},health_check_cache_params:t?.health_check_cache_params||{}},a=C(l.litellm_params)||{},s=C(l.health_check_cache_params)||{}}catch(t){console.warn("Error parsing error details:",t),l={message:String(e.error.message||"Unknown error"),traceback:"Error parsing details",litellm_params:{},health_check_cache_params:{}}}else a=C(e?.litellm_cache_params)||{},s=C(e?.health_check_cache_params)||{}}catch(e){console.warn("Error in response parsing:",e),a={},s={}}let r={redis_host:s?.redis_client?.connection_pool?.connection_kwargs?.host||s?.redis_async_client?.connection_pool?.connection_kwargs?.host||s?.connection_kwargs?.host||s?.host||"N/A",redis_port:s?.redis_client?.connection_pool?.connection_kwargs?.port||s?.redis_async_client?.connection_pool?.connection_kwargs?.port||s?.connection_kwargs?.port||s?.port||"N/A",redis_version:s?.redis_version||"N/A",startup_nodes:(()=>{try{if(s?.redis_kwargs?.startup_nodes)return JSON.stringify(s.redis_kwargs.startup_nodes);let e=s?.redis_client?.connection_pool?.connection_kwargs?.host||s?.redis_async_client?.connection_pool?.connection_kwargs?.host,t=s?.redis_client?.connection_pool?.connection_kwargs?.port||s?.redis_async_client?.connection_pool?.connection_kwargs?.port;return e&&t?JSON.stringify([{host:e,port:t}]):"N/A"}catch(e){return"N/A"}})(),namespace:s?.namespace||"N/A"};return(0,t.jsx)("div",{className:"bg-white rounded-lg shadow",children:(0,t.jsxs)(u.TabGroup,{children:[(0,t.jsxs)(m.TabList,{className:"border-b border-gray-200 px-4",children:[(0,t.jsx)(d.Tab,{className:"px-4 py-2 text-sm font-medium text-gray-600 hover:text-gray-800",children:"Summary"}),(0,t.jsx)(d.Tab,{className:"px-4 py-2 text-sm font-medium text-gray-600 hover:text-gray-800",children:"Raw Response"})]}),(0,t.jsxs)(g.TabPanels,{children:[(0,t.jsx)(h.TabPanel,{className:"p-4",children:(0,t.jsxs)("div",{children:[(0,t.jsxs)("div",{className:"flex items-center mb-6",children:[e?.status==="healthy"?(0,t.jsx)(w.CheckCircleIcon,{className:"h-5 w-5 text-green-500 mr-2"}):(0,t.jsx)(_.XCircleIcon,{className:"h-5 w-5 text-red-500 mr-2"}),(0,t.jsxs)(x.Text,{className:`text-sm font-medium ${e?.status==="healthy"?"text-green-500":"text-red-500"}`,children:["Cache Status: ",e?.status||"unhealthy"]})]}),(0,t.jsx)("table",{className:"w-full border-collapse",children:(0,t.jsxs)("tbody",{children:[l&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("tr",{children:(0,t.jsx)("td",{colSpan:2,className:"pt-4 pb-2 font-semibold text-red-600",children:"Error Details"})}),(0,t.jsx)(S,{label:"Error Message",value:l.message}),(0,t.jsx)(S,{label:"Traceback",value:l.traceback})]}),(0,t.jsx)("tr",{children:(0,t.jsx)("td",{colSpan:2,className:"pt-4 pb-2 font-semibold",children:"Cache Details"})}),(0,t.jsx)(S,{label:"Cache Configuration",value:String(a?.type)}),(0,t.jsx)(S,{label:"Ping Response",value:String(e.ping_response)}),(0,t.jsx)(S,{label:"Set Cache Response",value:e.set_cache_response||"N/A"}),(0,t.jsx)(S,{label:"litellm_settings.cache_params",value:JSON.stringify(a,null,2)}),a?.type==="redis"&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("tr",{children:(0,t.jsx)("td",{colSpan:2,className:"pt-4 pb-2 font-semibold",children:"Redis Details"})}),(0,t.jsx)(S,{label:"Redis Host",value:r.redis_host||"N/A"}),(0,t.jsx)(S,{label:"Redis Port",value:r.redis_port||"N/A"}),(0,t.jsx)(S,{label:"Redis Version",value:r.redis_version||"N/A"}),(0,t.jsx)(S,{label:"Startup Nodes",value:r.startup_nodes||"N/A"}),(0,t.jsx)(S,{label:"Namespace",value:r.namespace||"N/A"})]})]})})]})}),(0,t.jsx)(h.TabPanel,{className:"p-4",children:(0,t.jsx)("div",{className:"bg-gray-50 rounded-md p-4 font-mono text-sm",children:(0,t.jsx)("pre",{className:"whitespace-pre-wrap break-words overflow-auto max-h-[500px]",children:(()=>{try{let t={...e,litellm_cache_params:a,health_check_cache_params:s},l=JSON.parse(JSON.stringify(t,(e,t)=>{if("string"==typeof t)try{return JSON.parse(t)}catch{}return t}));return JSON.stringify(l,null,2)}catch(e){return"Error formatting JSON: "+e.message}})()})})})]})]})})},I=({accessToken:e,healthCheckResponse:l,runCachingHealthCheck:a,responseTimeMs:s})=>{let[r,i]=p.default.useState(null),[n,o]=p.default.useState(!1),c=async()=>{o(!0);let e=performance.now();await a(),i(performance.now()-e),o(!1)};return(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[(0,t.jsx)(v.Button,{onClick:c,disabled:n,className:"bg-indigo-600 hover:bg-indigo-700 disabled:bg-indigo-400 text-white text-sm px-4 py-2 rounded-md",children:n?"Running Health Check...":"Run Health Check"}),(0,t.jsx)(k,{responseTimeMs:r})]}),l&&(0,t.jsx)(T,{response:l})]})};var E=e.i(677667),A=e.i(898667),P=e.i(130643),D=e.i(206929),M=e.i(35983);let B=({redisType:e,redisTypeDescriptions:l,onTypeChange:a})=>(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)("label",{className:"text-sm font-medium text-gray-700",children:"Redis Type"}),(0,t.jsxs)(D.Select,{value:e,onValueChange:a,children:[(0,t.jsx)(M.SelectItem,{value:"node",children:"Node (Single Instance)"}),(0,t.jsx)(M.SelectItem,{value:"cluster",children:"Cluster"}),(0,t.jsx)(M.SelectItem,{value:"sentinel",children:"Sentinel"}),(0,t.jsx)(M.SelectItem,{value:"semantic",children:"Semantic"})]}),(0,t.jsx)("p",{className:"text-xs text-gray-500",children:l[e]||"Select the type of Redis deployment you're using"})]});var O=e.i(135214),F=e.i(620250),R=e.i(779241),L=e.i(199133),z=e.i(689020),U=e.i(435451);let H=({field:e,currentValue:l})=>{let[a,s]=(0,p.useState)([]),[r,i]=(0,p.useState)(l||""),{accessToken:n}=(0,O.default)();if((0,p.useEffect)(()=>{n&&(async()=>{try{let e=await (0,z.fetchAvailableModels)(n);console.log("Fetched models for selector:",e),e.length>0&&s(e)}catch(e){console.error("Error fetching model info:",e)}})()},[n]),"Boolean"===e.field_type)return(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)("label",{className:"text-sm font-medium text-gray-700",children:e.ui_field_name}),(0,t.jsxs)("div",{className:"flex items-center",children:[(0,t.jsx)("input",{type:"checkbox",name:e.field_name,defaultChecked:!0===l||"true"===l,className:"h-4 w-4 text-indigo-600 focus:ring-indigo-500 border-gray-300 rounded"}),(0,t.jsx)("span",{className:"ml-2 text-sm text-gray-500",children:e.field_description})]})]});if("Integer"===e.field_type||"Float"===e.field_type)return(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)("label",{className:"text-sm font-medium text-gray-700",children:e.ui_field_name}),(0,t.jsx)(U.default,{name:e.field_name,type:"number",defaultValue:l,placeholder:e.field_description}),(0,t.jsx)("p",{className:"text-xs text-gray-500",children:e.field_description})]});if("List"===e.field_type)return(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)("label",{className:"text-sm font-medium text-gray-700",children:e.ui_field_name}),(0,t.jsx)("textarea",{name:e.field_name,defaultValue:"object"==typeof l?JSON.stringify(l,null,2):l,placeholder:e.field_description,className:"w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-indigo-500 focus:border-indigo-500",rows:4}),(0,t.jsx)("p",{className:"text-xs text-gray-500",children:e.field_description})]});if("Models_Select"===e.field_type){let l=a.filter(e=>"embedding"===e.mode).map(e=>({value:e.model_group,label:e.model_group}));return(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)("label",{className:"text-sm font-medium text-gray-700",children:e.ui_field_name}),(0,t.jsx)(L.Select,{value:r,onChange:i,showSearch:!0,placeholder:"Search and select a model...",options:l,style:{width:"100%"},className:"rounded-md",filterOption:(e,t)=>(t?.label??"").toLowerCase().includes(e.toLowerCase())}),(0,t.jsx)("input",{type:"hidden",name:e.field_name,value:r}),e.field_description&&(0,t.jsx)("p",{className:"text-xs text-gray-500",children:e.field_description})]})}if("Integer"===e.field_type||"Float"===e.field_type)return(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)("label",{className:"text-sm font-medium text-gray-700",children:e.ui_field_name}),(0,t.jsx)(F.NumberInput,{name:e.field_name,defaultValue:l,placeholder:e.field_description,step:"Float"===e.field_type?.01:1}),e.field_description&&(0,t.jsx)("p",{className:"text-xs text-gray-500",children:e.field_description})]});let o="password"===e.field_name||e.field_name.includes("password")?"password":"text";return(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)("label",{className:"text-sm font-medium text-gray-700",children:e.ui_field_name}),(0,t.jsx)(R.TextInput,{name:e.field_name,type:o,defaultValue:l,placeholder:e.field_description}),e.field_description&&(0,t.jsx)("p",{className:"text-xs text-gray-500",children:e.field_description})]})},V=(e,t)=>e.find(e=>e.field_name===t),$=(e,t)=>{let l={type:"redis"};return e.forEach(e=>{if("redis_type"===e.field_name||null!==e.redis_type&&void 0!==e.redis_type&&e.redis_type!==t)return;let a=e.field_name,s=null;if("Boolean"===e.field_type){let e=document.querySelector(`input[name="${a}"]`);e?.checked!==void 0&&(s=e.checked)}else if("List"===e.field_type){let e=document.querySelector(`textarea[name="${a}"]`);if(e?.value)try{s=JSON.parse(e.value)}catch(e){console.error(`Invalid JSON for ${a}:`,e)}}else{let t=document.querySelector(`input[name="${a}"]`);if(t?.value){let l=t.value.trim();if(""!==l)if("Integer"===e.field_type){let e=Number(l);isNaN(e)||(s=e)}else if("Float"===e.field_type){let e=Number(l);isNaN(e)||(s=e)}else s=l}}null!=s&&(l[a]=s)}),l},q=({accessToken:e,userRole:l,userID:a})=>{let s,r,i,n,o,[c,d]=(0,p.useState)({}),[u,m]=(0,p.useState)([]),[h,g]=(0,p.useState)({}),[x,b]=(0,p.useState)("node"),[y,w]=(0,p.useState)(!1),[_,N]=(0,p.useState)(!1),k=(0,p.useCallback)(async()=>{try{let t=await (0,j.getCacheSettingsCall)(e);console.log("cache settings from API",t),t.fields&&m(t.fields),t.current_values&&(d(t.current_values),t.current_values.redis_type&&b(t.current_values.redis_type)),t.redis_type_descriptions&&g(t.redis_type_descriptions)}catch(e){console.error("Failed to load cache settings:",e),f.default.fromBackend("Failed to load cache settings")}},[e]);(0,p.useEffect)(()=>{e&&k()},[e,k]);let C=async()=>{if(e){w(!0);try{let t=$(u,x),l=await (0,j.testCacheConnectionCall)(e,t);"success"===l.status?f.default.success("Cache connection test successful!"):f.default.fromBackend(`Connection test failed: ${l.message||l.error}`)}catch(e){console.error("Test connection error:",e),f.default.fromBackend(`Connection test failed: ${e.message||"Unknown error"}`)}finally{w(!1)}}},S=async()=>{if(e){N(!0);try{let t=$(u,x);"semantic"===x&&(t.type="redis-semantic"),await (0,j.updateCacheSettingsCall)(e,t),f.default.success("Cache settings updated successfully"),await k()}catch(e){console.error("Failed to save cache settings:",e),f.default.fromBackend("Failed to update cache settings")}finally{N(!1)}}};if(!e)return null;let{basicFields:T,sslFields:I,cacheManagementFields:D,gcpFields:M,clusterFields:O,sentinelFields:F,semanticFields:R}=(s=["host","port","password","username"].map(e=>V(u,e)).filter(Boolean),r=["ssl","ssl_cert_reqs","ssl_check_hostname"].map(e=>V(u,e)).filter(Boolean),i=["namespace","ttl","max_connections"].map(e=>V(u,e)).filter(Boolean),n=["gcp_service_account","gcp_ssl_ca_certs"].map(e=>V(u,e)).filter(Boolean),o=u.filter(e=>"cluster"===e.redis_type),{basicFields:s,sslFields:r,cacheManagementFields:i,gcpFields:n,clusterFields:o,sentinelFields:u.filter(e=>"sentinel"===e.redis_type),semanticFields:u.filter(e=>"semantic"===e.redis_type)});return(0,t.jsxs)("div",{className:"w-full space-y-8 py-2",children:[(0,t.jsxs)("div",{className:"space-y-6",children:[(0,t.jsxs)("div",{className:"max-w-3xl",children:[(0,t.jsx)("h3",{className:"text-sm font-medium text-gray-900",children:"Cache Settings"}),(0,t.jsx)("p",{className:"text-xs text-gray-500 mt-1",children:"Configure Redis cache for LiteLLM"})]}),(0,t.jsx)(B,{redisType:x,redisTypeDescriptions:h,onTypeChange:b}),(0,t.jsxs)("div",{className:"space-y-6 pt-4 border-t border-gray-200",children:[(0,t.jsx)("h4",{className:"text-sm font-medium text-gray-900",children:"Connection Settings"}),(0,t.jsx)("div",{className:"grid grid-cols-1 gap-6 sm:grid-cols-2",children:T.map(e=>{if(!e)return null;let l=c[e.field_name]??e.field_default??"";return(0,t.jsx)(H,{field:e,currentValue:l},e.field_name)})})]}),"cluster"===x&&O.length>0&&(0,t.jsxs)("div",{className:"space-y-6 pt-4 border-t border-gray-200",children:[(0,t.jsx)("h4",{className:"text-sm font-medium text-gray-900",children:"Cluster Configuration"}),(0,t.jsx)("div",{className:"grid grid-cols-1 gap-6",children:O.map(e=>{let l=c[e.field_name]??e.field_default??"";return(0,t.jsx)(H,{field:e,currentValue:l},e.field_name)})})]}),"sentinel"===x&&F.length>0&&(0,t.jsxs)("div",{className:"space-y-6 pt-4 border-t border-gray-200",children:[(0,t.jsx)("h4",{className:"text-sm font-medium text-gray-900",children:"Sentinel Configuration"}),(0,t.jsx)("div",{className:"grid grid-cols-1 gap-6 sm:grid-cols-2",children:F.map(e=>{let l=c[e.field_name]??e.field_default??"";return(0,t.jsx)(H,{field:e,currentValue:l},e.field_name)})})]}),"semantic"===x&&R.length>0&&(0,t.jsxs)("div",{className:"space-y-6 pt-4 border-t border-gray-200",children:[(0,t.jsx)("h4",{className:"text-sm font-medium text-gray-900",children:"Semantic Configuration"}),(0,t.jsx)("div",{className:"grid grid-cols-1 gap-6 sm:grid-cols-2",children:R.map(e=>{let l=c[e.field_name]??e.field_default??"";return(0,t.jsx)(H,{field:e,currentValue:l},e.field_name)})})]}),(0,t.jsxs)(E.Accordion,{className:"mt-4",children:[(0,t.jsx)(A.AccordionHeader,{children:(0,t.jsx)("span",{className:"text-sm font-medium text-gray-900",children:"Advanced Settings"})}),(0,t.jsx)(P.AccordionBody,{children:(0,t.jsxs)("div",{className:"space-y-6",children:[I.length>0&&(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsx)("h5",{className:"text-sm font-medium text-gray-700",children:"SSL Settings"}),(0,t.jsx)("div",{className:"grid grid-cols-1 gap-6 sm:grid-cols-2",children:I.map(e=>{if(!e)return null;let l=c[e.field_name]??e.field_default??"";return(0,t.jsx)(H,{field:e,currentValue:l},e.field_name)})})]}),D.length>0&&(0,t.jsxs)("div",{className:"space-y-4 pt-4 border-t border-gray-200",children:[(0,t.jsx)("h5",{className:"text-sm font-medium text-gray-700",children:"Cache Management"}),(0,t.jsx)("div",{className:"grid grid-cols-1 gap-6 sm:grid-cols-2",children:D.map(e=>{if(!e)return null;let l=c[e.field_name]??e.field_default??"";return(0,t.jsx)(H,{field:e,currentValue:l},e.field_name)})})]}),M.length>0&&(0,t.jsxs)("div",{className:"space-y-4 pt-4 border-t border-gray-200",children:[(0,t.jsx)("h5",{className:"text-sm font-medium text-gray-700",children:"GCP Authentication"}),(0,t.jsx)("div",{className:"grid grid-cols-1 gap-6 sm:grid-cols-2",children:M.map(e=>{if(!e)return null;let l=c[e.field_name]??e.field_default??"";return(0,t.jsx)(H,{field:e,currentValue:l},e.field_name)})})]})]})})]})]}),(0,t.jsxs)("div",{className:"border-t border-gray-200 pt-6 flex justify-end gap-3",children:[(0,t.jsx)(v.Button,{variant:"secondary",size:"sm",onClick:C,disabled:y,className:"text-sm",children:y?"Testing...":"Test Connection"}),(0,t.jsx)(v.Button,{size:"sm",onClick:S,disabled:_,className:"text-sm font-medium",children:_?"Saving...":"Save Changes"})]})]})},K=e=>{if(e)return e.toISOString().split("T")[0]};function G(e){return new Intl.NumberFormat("en-US",{maximumFractionDigits:0,notation:"compact",compactDisplay:"short"}).format(e)}e.s(["default",0,({accessToken:e,token:v,userRole:w,userID:_,premiumUser:N})=>{let[k,C]=(0,p.useState)([]),[S,T]=(0,p.useState)([]),[E,A]=(0,p.useState)([]),[P,D]=(0,p.useState)([]),[M,B]=(0,p.useState)("0"),[O,F]=(0,p.useState)("0"),[R,L]=(0,p.useState)("0"),[z,U]=(0,p.useState)({from:new Date(Date.now()-6048e5),to:new Date}),[H,V]=(0,p.useState)(""),[$,W]=(0,p.useState)("");(0,p.useEffect)(()=>{e&&z&&((async()=>{D(await (0,j.adminGlobalCacheActivity)(e,K(z.from),K(z.to)))})(),V(new Date().toLocaleString()))},[e]);let J=Array.from(new Set(P.map(e=>e?.api_key??""))),Y=Array.from(new Set(P.map(e=>e?.model??"")));Array.from(new Set(P.map(e=>e?.call_type??"")));let Q=async(t,l)=>{t&&l&&e&&D(await (0,j.adminGlobalCacheActivity)(e,K(t),K(l)))};(0,p.useEffect)(()=>{console.log("DATA IN CACHE DASHBOARD",P);let e=P;S.length>0&&(e=e.filter(e=>S.includes(e.api_key))),E.length>0&&(e=e.filter(e=>E.includes(e.model))),console.log("before processed data in cache dashboard",e);let t=0,l=0,a=0,s=e.reduce((e,s)=>{console.log("Processing item:",s),s.call_type||(console.log("Item has no call_type:",s),s.call_type="Unknown"),t+=(s.total_rows||0)-(s.cache_hit_true_rows||0),l+=s.cache_hit_true_rows||0,a+=s.cached_completion_tokens||0;let r=e.find(e=>e.name===s.call_type);return r?(r["LLM API requests"]+=(s.total_rows||0)-(s.cache_hit_true_rows||0),r["Cache hit"]+=s.cache_hit_true_rows||0,r["Cached Completion Tokens"]+=s.cached_completion_tokens||0,r["Generated Completion Tokens"]+=s.generated_completion_tokens||0):e.push({name:s.call_type,"LLM API requests":(s.total_rows||0)-(s.cache_hit_true_rows||0),"Cache hit":s.cache_hit_true_rows||0,"Cached Completion Tokens":s.cached_completion_tokens||0,"Generated Completion Tokens":s.generated_completion_tokens||0}),e},[]);B(G(l)),F(G(a));let r=l+t;r>0?L((l/r*100).toFixed(2)):L("0"),C(s),console.log("PROCESSED DATA IN CACHE DASHBOARD",s)},[S,E,z,P]);let X=async()=>{try{f.default.info("Running cache health check..."),W("");let t=await (0,j.cachingHealthCheckCall)(null!==e?e:"");console.log("CACHING HEALTH CHECK RESPONSE",t),W(t)}catch(t){let e;if(console.error("Error running health check:",t),t&&t.message)try{let l=JSON.parse(t.message);l.error&&(l=l.error),e=l}catch(l){e={message:t.message}}else e={message:"Unknown error occurred"};W({error:e})}};return(0,t.jsxs)(u.TabGroup,{className:"gap-2 p-8 h-full w-full mt-2 mb-8",children:[(0,t.jsxs)(m.TabList,{className:"flex justify-between mt-2 w-full items-center",children:[(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)(d.Tab,{children:"Cache Analytics"}),(0,t.jsx)(d.Tab,{children:"Cache Health"}),(0,t.jsx)(d.Tab,{children:"Cache Settings"})]}),(0,t.jsxs)("div",{className:"flex items-center space-x-2",children:[H&&(0,t.jsxs)(x.Text,{children:["Last Refreshed: ",H]}),(0,t.jsx)(i.Icon,{icon:y.RefreshIcon,variant:"shadow",size:"xs",className:"self-center",onClick:()=>{V(new Date().toLocaleString())}})]})]}),(0,t.jsxs)(g.TabPanels,{children:[(0,t.jsx)(h.TabPanel,{children:(0,t.jsxs)(a.Card,{children:[(0,t.jsxs)(r.Grid,{numItems:3,className:"gap-4 mt-4",children:[(0,t.jsx)(s.Col,{children:(0,t.jsx)(n.MultiSelect,{placeholder:"Select Virtual Keys",value:S,onValueChange:T,children:J.map(e=>(0,t.jsx)(o.MultiSelectItem,{value:e,children:e},e))})}),(0,t.jsx)(s.Col,{children:(0,t.jsx)(n.MultiSelect,{placeholder:"Select Models",value:E,onValueChange:A,children:Y.map(e=>(0,t.jsx)(o.MultiSelectItem,{value:e,children:e},e))})}),(0,t.jsx)(s.Col,{children:(0,t.jsx)(b.default,{value:z,onValueChange:e=>{U(e),Q(e.from,e.to)}})})]}),(0,t.jsxs)("div",{className:"grid grid-cols-1 gap-6 sm:grid-cols-2 lg:grid-cols-3 mt-4",children:[(0,t.jsxs)(a.Card,{children:[(0,t.jsx)("p",{className:"text-tremor-default font-medium text-tremor-content dark:text-dark-tremor-content",children:"Cache Hit Ratio"}),(0,t.jsx)("div",{className:"mt-2 flex items-baseline space-x-2.5",children:(0,t.jsxs)("p",{className:"text-tremor-metric font-semibold text-tremor-content-strong dark:text-dark-tremor-content-strong",children:[R,"%"]})})]}),(0,t.jsxs)(a.Card,{children:[(0,t.jsx)("p",{className:"text-tremor-default font-medium text-tremor-content dark:text-dark-tremor-content",children:"Cache Hits"}),(0,t.jsx)("div",{className:"mt-2 flex items-baseline space-x-2.5",children:(0,t.jsx)("p",{className:"text-tremor-metric font-semibold text-tremor-content-strong dark:text-dark-tremor-content-strong",children:M})})]}),(0,t.jsxs)(a.Card,{children:[(0,t.jsx)("p",{className:"text-tremor-default font-medium text-tremor-content dark:text-dark-tremor-content",children:"Cached Tokens"}),(0,t.jsx)("div",{className:"mt-2 flex items-baseline space-x-2.5",children:(0,t.jsx)("p",{className:"text-tremor-metric font-semibold text-tremor-content-strong dark:text-dark-tremor-content-strong",children:O})})]})]}),(0,t.jsx)(c.Subtitle,{className:"mt-4",children:"Cache Hits vs API Requests"}),(0,t.jsx)(l.BarChart,{title:"Cache Hits vs API Requests",data:k,stack:!0,index:"name",valueFormatter:G,categories:["LLM API requests","Cache hit"],colors:["sky","teal"],yAxisWidth:48}),(0,t.jsx)(c.Subtitle,{className:"mt-4",children:"Cached Completion Tokens vs Generated Completion Tokens"}),(0,t.jsx)(l.BarChart,{className:"mt-6",data:k,stack:!0,index:"name",valueFormatter:G,categories:["Generated Completion Tokens","Cached Completion Tokens"],colors:["sky","teal"],yAxisWidth:48})]})}),(0,t.jsx)(h.TabPanel,{children:(0,t.jsx)(I,{accessToken:e,healthCheckResponse:$,runCachingHealthCheck:X})}),(0,t.jsx)(h.TabPanel,{children:(0,t.jsx)(q,{accessToken:e,userRole:w,userID:_})})]})]})}],559061)}]); \ No newline at end of file diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/0d219667baa010f5.js b/litellm/proxy/_experimental/out/_next/static/chunks/0d219667baa010f5.js deleted file mode 100644 index c5a730b243..0000000000 --- a/litellm/proxy/_experimental/out/_next/static/chunks/0d219667baa010f5.js +++ /dev/null @@ -1,91 +0,0 @@ -(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,111790,758472,280881,e=>{"use strict";e.s([],111790);var s=e.i(843476),t=e.i(708347),r=e.i(750113),l=e.i(994388),a=e.i(197647),n=e.i(653824),i=e.i(881073),o=e.i(404206),c=e.i(723731),d=e.i(599724),m=e.i(629569),u=e.i(844444),x=e.i(869216),p=e.i(212931),h=e.i(199133),g=e.i(592968),f=e.i(898586),b=e.i(271645),j=e.i(500727),y=e.i(266027),v=e.i(912598),N=e.i(243652),_=e.i(764205),w=e.i(135214);let C=(0,N.createQueryKeys)("mcpServerHealth");var S=e.i(727749),T=e.i(988846),k=e.i(678784),A=e.i(995926),I=e.i(328196),P=e.i(302202),O=e.i(409797),M=e.i(54131),F=e.i(440987);let E=[{label:"Documentation",fields:[{key:"description",label:"Description",description:"Must have a non-empty description",check:e=>!!e.description?.trim()},{key:"alias",label:"Alias",description:"Must have a display alias",check:e=>!!e.alias?.trim()}]},{label:"Source",fields:[{key:"source_url",label:"GitHub / Source URL",description:"Must link to a source repository",check:e=>!!e.source_url?.trim()}]},{label:"Connection",fields:[{key:"url",label:"Server URL",description:"Must have a URL configured",check:e=>!!e.url?.trim()}]},{label:"Security",fields:[{key:"auth_type",label:"Auth configured",description:"Must use authentication (not 'none')",check:e=>!!e.auth_type&&"none"!==e.auth_type}]}],L=E.flatMap(e=>e.fields),R="mcp_required_fields",U={active:{label:"Active",bg:"bg-green-50",text:"text-green-700",dot:"bg-green-500"},pending_review:{label:"Pending Review",bg:"bg-yellow-50",text:"text-yellow-700",dot:"bg-yellow-500"},rejected:{label:"Rejected",bg:"bg-red-50",text:"text-red-700",dot:"bg-red-500"}};function z({label:e,value:t,color:r}){return(0,s.jsxs)("div",{className:"bg-white border border-gray-200 rounded-lg px-4 py-3",children:[(0,s.jsx)("div",{className:`text-2xl font-bold ${r}`,children:t}),(0,s.jsx)("div",{className:"text-xs text-gray-500 mt-0.5",children:e})]})}function B({action:e,serverName:t,isCurrentlyActive:r,onConfirm:l,onCancel:a}){let[n,i]=(0,b.useState)(""),o="approve"===e;return(0,s.jsx)("div",{className:"fixed inset-0 bg-black/30 flex items-center justify-center z-50",children:(0,s.jsxs)("div",{className:"bg-white rounded-xl shadow-xl p-6 max-w-sm w-full mx-4",children:[(0,s.jsx)("div",{className:`w-10 h-10 rounded-full flex items-center justify-center mb-4 ${o?"bg-green-100":"bg-red-100"}`,children:o?(0,s.jsx)(k.CheckIcon,{className:"h-5 w-5 text-green-600"}):(0,s.jsx)(I.AlertCircleIcon,{className:"h-5 w-5 text-red-600"})}),(0,s.jsx)("h3",{className:"text-base font-semibold text-gray-900 mb-1",children:o?"Approve MCP Server":"Reject MCP Server"}),(0,s.jsxs)("p",{className:"text-sm text-gray-500 mb-4",children:["Are you sure you want to ",e," ",(0,s.jsxs)("span",{className:"font-medium text-gray-700",children:['"',t,'"']}),"?"," ",o?"This will make it active and available for use.":r?"This server is currently live. Rejecting it will immediately remove it from the proxy runtime.":"This will mark the submission as rejected."]}),!o&&(0,s.jsx)("textarea",{placeholder:"Reason for rejection (optional)",value:n,onChange:e=>i(e.target.value),className:"w-full border border-gray-200 rounded-md px-3 py-2 text-sm text-gray-700 placeholder-gray-400 focus:outline-none focus:ring-1 focus:ring-blue-500 mb-4 resize-none",rows:3}),(0,s.jsxs)("div",{className:"flex gap-3",children:[(0,s.jsx)("button",{type:"button",onClick:a,className:"flex-1 border border-gray-300 text-gray-700 hover:bg-gray-50 text-sm font-medium py-2 rounded-md transition-colors",children:"Cancel"}),(0,s.jsx)("button",{type:"button",onClick:()=>l(o?void 0:n||void 0),className:`flex-1 text-white text-sm font-medium py-2 rounded-md transition-colors ${o?"bg-green-500 hover:bg-green-600":"bg-red-500 hover:bg-red-600"}`,children:o?"Approve":"Reject"})]})]})})}function q({requiredFields:e,onChange:t,onSave:r,isSaving:l}){let[a,n]=(0,b.useState)(!1),i=L.filter(s=>e.includes(s.key));return(0,s.jsxs)("div",{className:"mb-5 border border-gray-200 rounded-lg bg-white overflow-hidden",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between px-4 py-3 cursor-pointer select-none",onClick:()=>n(e=>!e),children:[(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)(F.SettingsIcon,{className:"h-4 w-4 text-gray-400"}),(0,s.jsx)("span",{className:"text-sm font-semibold text-gray-800",children:"Submission Rules"}),i.length>0?(0,s.jsxs)("span",{className:"text-xs text-gray-500",children:["(",i.length," required field",1!==i.length?"s":"",")"]}):(0,s.jsx)("span",{className:"text-xs text-gray-400 italic",children:"no rules set"})]}),(0,s.jsxs)("div",{className:"flex items-center gap-3",children:[!a&&i.length>0&&(0,s.jsx)("div",{className:"flex flex-wrap gap-1.5 max-w-md",children:i.map(e=>(0,s.jsxs)("span",{className:"inline-flex items-center gap-1 text-xs bg-blue-50 text-blue-700 border border-blue-200 px-2 py-0.5 rounded-full",children:[(0,s.jsx)(k.CheckIcon,{className:"h-3 w-3"}),e.label]},e.key))}),a?(0,s.jsx)(M.ChevronUpIcon,{className:"h-4 w-4 text-gray-400"}):(0,s.jsx)(O.ChevronDownIcon,{className:"h-4 w-4 text-gray-400"})]})]}),a&&(0,s.jsxs)("div",{className:"border-t border-gray-100 px-4 pt-4 pb-4",children:[(0,s.jsx)("p",{className:"text-xs text-gray-500 mb-4",children:"Select which fields must be filled in before a submission is considered compliant. LiteLLM will show ✓ / ✗ for each rule on every submission card below."}),(0,s.jsx)("div",{className:"grid grid-cols-2 gap-x-8 gap-y-5",children:E.map(r=>(0,s.jsxs)("div",{children:[(0,s.jsx)("div",{className:"text-xs font-semibold text-gray-500 uppercase tracking-wider mb-2",children:r.label}),(0,s.jsx)("div",{className:"space-y-2",children:r.fields.map(r=>{let l=e.includes(r.key);return(0,s.jsxs)("label",{className:"flex items-start gap-2.5 cursor-pointer group",children:[(0,s.jsx)("input",{type:"checkbox",checked:l,onChange:()=>{var s;return s=r.key,void t(e.includes(s)?e.filter(e=>e!==s):[...e,s])},className:"mt-0.5 h-4 w-4 rounded border-gray-300 text-blue-600 focus:ring-blue-500 cursor-pointer"}),(0,s.jsxs)("div",{children:[(0,s.jsx)("div",{className:"text-sm font-medium text-gray-800 group-hover:text-blue-700 transition-colors",children:r.label}),(0,s.jsx)("div",{className:"text-xs text-gray-400",children:r.description})]})]},r.key)})})]},r.label))}),(0,s.jsxs)("div",{className:"mt-5 flex items-center gap-3",children:[(0,s.jsx)("button",{type:"button",disabled:l,onClick:async()=>{await r(),n(!1)},className:"px-4 py-1.5 text-sm font-medium text-white bg-blue-600 hover:bg-blue-700 disabled:opacity-50 rounded-md transition-colors",children:l?"Saving…":"Save Rules"}),(0,s.jsx)("button",{type:"button",onClick:()=>n(!1),className:"px-4 py-1.5 text-sm font-medium text-gray-600 hover:text-gray-900 border border-gray-200 rounded-md hover:bg-gray-50 transition-colors",children:"Cancel"})]})]})]})}function V({server:e,onApprove:t,onReject:r,requiredFields:l}){let a=e.approval_status??"active",n=U[a]??U.active,i=L.filter(e=>l.includes(e.key)).map(s=>({key:s.key,label:s.label,description:s.description,passed:s.check(e)})),o=i.filter(e=>e.passed).length,c=i.length-o,d=i.length>0&&0===c;return(0,s.jsxs)("div",{className:"bg-white border border-gray-200 rounded-lg overflow-hidden",children:[(0,s.jsx)("div",{className:"px-4 pt-4 pb-3",children:(0,s.jsxs)("div",{className:"flex items-start justify-between gap-4",children:[(0,s.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,s.jsx)("div",{className:"flex items-center gap-2 mb-1.5",children:(0,s.jsxs)("span",{className:`inline-flex items-center gap-1.5 text-xs font-medium px-2 py-0.5 rounded-full ${n.bg} ${n.text}`,children:[(0,s.jsx)("span",{className:`w-1.5 h-1.5 rounded-full ${n.dot}`}),n.label]})}),(0,s.jsx)("h3",{className:"text-sm font-semibold text-gray-900",children:e.alias??e.server_name??e.server_id}),e.description&&(0,s.jsx)("p",{className:"text-xs text-gray-500 mt-0.5 line-clamp-1",children:e.description}),e.url&&(0,s.jsxs)("div",{className:"flex items-center gap-1.5 mt-1.5",children:[(0,s.jsx)(P.ServerIcon,{className:"h-3.5 w-3.5 text-gray-400 flex-shrink-0"}),(0,s.jsx)("code",{className:"text-xs text-gray-500 font-mono truncate",children:e.url})]}),(0,s.jsxs)("div",{className:"flex items-center gap-3 mt-1.5 text-xs text-gray-400",children:[(0,s.jsxs)("span",{children:["Transport: ",(0,s.jsx)("span",{className:"text-gray-600",children:e.transport??"sse"})]}),(0,s.jsx)("span",{children:"·"}),(0,s.jsxs)("span",{children:["Submitted by: ",(0,s.jsx)("span",{className:"text-gray-600",children:e.submitted_by??"—"})]}),(0,s.jsx)("span",{children:"·"}),(0,s.jsx)("span",{children:function(e){if(!e)return"—";try{let s=new Date(e);return isNaN(s.getTime())?e:s.toISOString().slice(0,10)}catch{return e}}(e.submitted_at)})]}),"rejected"===a&&e.review_notes&&(0,s.jsxs)("p",{className:"text-xs text-red-600 mt-1.5",children:["Rejection reason: ",e.review_notes]})]}),0===i.length&&"rejected"!==a&&(0,s.jsxs)("div",{className:"flex items-center gap-2 flex-shrink-0",children:["active"!==a&&(0,s.jsx)("button",{type:"button",onClick:t,className:"text-xs bg-green-500 hover:bg-green-600 text-white px-3 py-1.5 rounded-md transition-colors font-medium",children:"Approve"}),(0,s.jsx)("button",{type:"button",onClick:r,className:"text-xs border border-red-300 text-red-600 hover:bg-red-50 px-3 py-1.5 rounded-md transition-colors font-medium",children:"Reject"})]}),0===i.length&&"rejected"===a&&(0,s.jsx)("div",{className:"flex items-center gap-2 flex-shrink-0",children:(0,s.jsx)("button",{type:"button",onClick:t,className:"text-xs bg-green-500 hover:bg-green-600 text-white px-3 py-1.5 rounded-md transition-colors font-medium",children:"Re-approve"})})]})}),i.length>0&&(0,s.jsxs)("div",{className:"border-t border-gray-200",children:[(0,s.jsxs)("div",{className:`flex items-center gap-3 px-4 py-3 ${d?"bg-green-50 border-b border-green-100":"bg-red-50 border-b border-red-100"}`,children:[(0,s.jsx)("div",{className:`w-8 h-8 rounded-full flex items-center justify-center flex-shrink-0 ${d?"bg-green-500":"bg-red-500"}`,children:d?(0,s.jsx)(k.CheckIcon,{className:"h-4 w-4 text-white"}):(0,s.jsx)(A.XIcon,{className:"h-4 w-4 text-white"})}),(0,s.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,s.jsx)("div",{className:`text-sm font-semibold leading-tight ${d?"text-green-800":"text-red-800"}`,children:d?"All checks passed":`${c} check${1!==c?"s":""} failed`}),(0,s.jsxs)("div",{className:"text-xs text-gray-500 mt-0.5",children:[o," passing, ",c," failing"]})]}),(0,s.jsxs)("div",{className:"flex items-center gap-2 flex-shrink-0",children:["active"!==a&&"rejected"!==a&&(0,s.jsx)("button",{type:"button",onClick:t,className:"text-xs bg-green-600 hover:bg-green-700 text-white px-3 py-1.5 rounded-md transition-colors font-medium",children:"Approve"}),"rejected"===a&&(0,s.jsx)("button",{type:"button",onClick:t,className:"text-xs bg-green-600 hover:bg-green-700 text-white px-3 py-1.5 rounded-md transition-colors font-medium",children:"Re-approve"}),"rejected"!==a&&(0,s.jsx)("button",{type:"button",onClick:r,className:"text-xs border border-red-300 text-red-600 hover:bg-red-50 bg-white px-3 py-1.5 rounded-md transition-colors font-medium",children:"Reject"})]})]}),(0,s.jsx)("div",{className:"divide-y divide-gray-100",children:i.map(e=>(0,s.jsxs)("div",{className:"flex items-center gap-3 px-4 py-2.5",children:[(0,s.jsx)("div",{className:`w-5 h-5 rounded-full flex items-center justify-center flex-shrink-0 ${e.passed?"bg-green-100":"bg-red-100"}`,children:e.passed?(0,s.jsx)(k.CheckIcon,{className:"h-3 w-3 text-green-600"}):(0,s.jsx)(A.XIcon,{className:"h-3 w-3 text-red-600"})}),(0,s.jsx)("span",{className:`text-sm flex-1 ${e.passed?"text-gray-700":"text-gray-800"}`,children:e.label}),(0,s.jsx)("span",{className:`text-xs ${e.passed?"text-green-600":"text-red-500"}`,children:e.passed?"Passes":"Missing"})]},e.key))})]})]})}function $({accessToken:e}){let[t,r]=(0,b.useState)({total:0,pending_review:0,active:0,rejected:0,items:[]}),[l,a]=(0,b.useState)(""),[n,i]=(0,b.useState)("all"),[o,c]=(0,b.useState)(null),[d,m]=(0,b.useState)(!0),[u,x]=(0,b.useState)(null),[p,h]=(0,b.useState)([]),[g,f]=(0,b.useState)(!1),j=(0,b.useCallback)(async()=>{if(!e)return void m(!1);m(!0),x(null);try{let[s,t]=await Promise.all([(0,_.fetchMCPSubmissions)(e),(0,_.getGeneralSettingsCall)(e).catch(e=>(console.warn("MCPSubmissionsTab: failed to load general settings, compliance rules will be empty:",e),null))]);if(r(s),t?.data&&Array.isArray(t.data)){let e=t.data.find(e=>e.field_name===R);e&&Array.isArray(e.field_value)&&h(e.field_value)}}catch(e){x(e instanceof Error?e.message:"Failed to load submissions")}finally{m(!1)}},[e]);(0,b.useEffect)(()=>{j()},[j]);let y=async()=>{if(e){f(!0);try{await (0,_.updateConfigFieldSetting)(e,R,p),S.default.success("Submission rules saved")}catch{S.default.fromBackend("Failed to save submission rules")}finally{f(!1)}}},v=t.items.filter(e=>{if("all"!==n&&e.approval_status!==n)return!1;if(l.trim()){let s=l.toLowerCase(),t=(e.alias??e.server_name??e.server_id??"").toLowerCase(),r=(e.url??"").toLowerCase();return t.includes(s)||r.includes(s)}return!0});async function N(s,t){if(e)try{await (0,_.approveMCPServer)(e,s),await j(),S.default.success(`MCP server "${t}" approved`)}catch{S.default.fromBackend("Failed to approve MCP server")}finally{c(null)}}async function w(s,t,r){if(e)try{await (0,_.rejectMCPServer)(e,s,r),await j(),S.default.success(`MCP server "${t}" rejected`)}catch{S.default.fromBackend("Failed to reject MCP server")}finally{c(null)}}return(0,s.jsxs)("div",{className:"p-6",children:[(0,s.jsx)(q,{requiredFields:p,onChange:h,onSave:y,isSaving:g}),(0,s.jsxs)("div",{className:"grid grid-cols-4 gap-4 mb-6",children:[(0,s.jsx)(z,{label:"Total Submitted",value:t.total,color:"text-gray-900"}),(0,s.jsx)(z,{label:"Pending Review",value:t.pending_review,color:"text-yellow-600"}),(0,s.jsx)(z,{label:"Active",value:t.active,color:"text-green-600"}),(0,s.jsx)(z,{label:"Rejected",value:t.rejected,color:"text-red-600"})]}),(0,s.jsxs)("div",{className:"flex items-center gap-3 mb-5",children:[(0,s.jsxs)("div",{className:"relative flex-1 max-w-xs",children:[(0,s.jsx)(T.SearchIcon,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-gray-400"}),(0,s.jsx)("input",{type:"text",placeholder:"Search MCP servers...",value:l,onChange:e=>a(e.target.value),className:"w-full pl-9 pr-4 py-2 border border-gray-200 rounded-md text-sm text-gray-700 placeholder-gray-400 focus:outline-none focus:ring-1 focus:ring-blue-500 focus:border-blue-500"})]}),(0,s.jsxs)("select",{value:n,onChange:e=>i(e.target.value),className:"border border-gray-200 rounded-md px-3 py-2 text-sm text-gray-700 focus:outline-none focus:ring-1 focus:ring-blue-500 focus:border-blue-500 bg-white",children:[(0,s.jsx)("option",{value:"all",children:"All Status"}),(0,s.jsx)("option",{value:"pending_review",children:"Pending Review"}),(0,s.jsx)("option",{value:"active",children:"Active"}),(0,s.jsx)("option",{value:"rejected",children:"Rejected"})]})]}),(0,s.jsxs)("div",{className:"space-y-3",children:[d&&(0,s.jsx)("div",{className:"text-center py-12 text-gray-500 text-sm",children:"Loading submissions…"}),u&&(0,s.jsx)("div",{className:"text-center py-12 text-red-600 text-sm",children:u}),!d&&!u&&0===v.length&&(0,s.jsx)("div",{className:"text-center py-12 text-gray-400 text-sm",children:"No MCP server submissions match your filters."}),!d&&!u&&v.map(e=>(0,s.jsx)(V,{server:e,requiredFields:p,onApprove:()=>c({serverId:e.server_id,serverName:e.alias??e.server_name??e.server_id,action:"approve"}),onReject:()=>c({serverId:e.server_id,serverName:e.alias??e.server_name??e.server_id,action:"reject",isCurrentlyActive:"active"===e.approval_status})},e.server_id))]}),o&&(0,s.jsx)(B,{action:o.action,serverName:o.serverName,isCurrentlyActive:o.isCurrentlyActive,onConfirm:e=>"approve"===o.action?N(o.serverId,o.serverName):w(o.serverId,o.serverName,e),onCancel:()=>c(null)})]})}var D=e.i(808613),H=e.i(311451),K=e.i(998573),W=e.i(482725),Y=e.i(988297),J=e.i(797672),G=e.i(68155),Q=e.i(699857),Z=e.i(149121);let{Text:X}=f.Typography;function ee({serverId:e,serverName:t,accessToken:r,selectedTools:l,onToggle:a}){let[n,i]=(0,b.useState)([]),[o,c]=(0,b.useState)(!1),[d,m]=(0,b.useState)(!1),u=new Set(l.filter(s=>s.server_id===e).map(e=>e.tool_name)),x=(0,b.useCallback)(async()=>{if(r&&!(n.length>0)){c(!0);try{let s=await (0,_.listMCPTools)(r,e),t=Array.isArray(s)?s:s?.tools??[];i(t.map(e=>({name:e.name??e.tool_name??e,description:e.description??""})))}catch{i([])}finally{c(!1)}}},[r,e,n.length]);return(0,s.jsxs)("div",{className:"border border-gray-200 rounded-lg overflow-hidden",children:[(0,s.jsxs)("button",{type:"button",className:"w-full flex items-center justify-between px-4 py-3 bg-gray-50 hover:bg-gray-100 transition-colors",onClick:()=>{d||x(),m(!d)},children:[(0,s.jsxs)("span",{className:"text-sm font-medium text-gray-700 flex items-center gap-2",children:[(0,s.jsx)("span",{className:"inline-block w-2 h-2 rounded-full bg-blue-500 flex-shrink-0"}),t,u.size>0&&(0,s.jsxs)("span",{className:"ml-1 text-xs text-purple-600 font-semibold",children:[u.size," selected"]})]}),(0,s.jsx)("span",{className:"text-gray-400 text-xs",children:d?"▲":"▼"})]}),d&&(0,s.jsx)("div",{className:"p-2",children:o?(0,s.jsx)("div",{className:"flex justify-center py-3",children:(0,s.jsx)(W.Spin,{size:"small"})}):0===n.length?(0,s.jsx)("p",{className:"text-xs text-gray-400 px-2 py-2",children:"No tools found for this server."}):(0,s.jsx)("div",{className:"flex flex-col gap-1",children:n.map(t=>{let r=u.has(t.name);return(0,s.jsxs)("button",{type:"button",onClick:()=>a({server_id:e,tool_name:t.name}),className:`flex items-start justify-between px-3 py-2 rounded-lg text-left transition-colors ${r?"bg-purple-50 border border-purple-300":"bg-white border border-gray-100 hover:bg-gray-50"}`,children:[(0,s.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,s.jsx)("p",{className:`text-sm font-medium leading-tight ${r?"text-purple-800":"text-gray-800"}`,children:t.name}),t.description&&(0,s.jsx)("p",{className:"text-xs text-gray-400 mt-0.5 leading-tight line-clamp-2",children:t.description})]}),r&&(0,s.jsx)("span",{className:"text-purple-500 text-xs font-semibold ml-2 flex-shrink-0 mt-0.5",children:"✓"})]},t.name)})})})]})}function es({open:e,onClose:t,onSave:r,accessToken:a,initialToolset:n}){let[i]=D.Form.useForm(),[o,c]=(0,b.useState)(n?.tools||[]),[m,u]=(0,b.useState)(!1),[x,h]=(0,b.useState)(""),{data:g=[]}=(0,j.useMCPServers)();b.default.useEffect(()=>{e&&(i.setFieldsValue({toolset_name:n?.toolset_name||"",description:n?.description||""}),c(n?.tools||[]),h(""))},[e,n]);let f=e=>{c(s=>s.some(s=>s.server_id===e.server_id&&s.tool_name===e.tool_name)?s.filter(s=>s.server_id!==e.server_id||s.tool_name!==e.tool_name):[...s,e])},y=async()=>{let e=await i.validateFields();u(!0);try{await r(e.toolset_name,e.description,o),t()}finally{u(!1)}},v=g.filter(e=>{let s=x.toLowerCase();return!s||(e.alias||"").toLowerCase().includes(s)||(e.server_name||"").toLowerCase().includes(s)});return(0,s.jsxs)(p.Modal,{open:e,onCancel:t,title:n?"Edit Toolset":"New Toolset",width:960,footer:null,forceRender:!0,children:[(0,s.jsx)(D.Form,{form:i,layout:"vertical",className:"mt-2",children:(0,s.jsxs)("div",{className:"flex gap-4 mb-4",children:[(0,s.jsx)(D.Form.Item,{label:"Toolset Name",name:"toolset_name",rules:[{required:!0,message:"Please enter a toolset name"}],className:"flex-1 mb-0",children:(0,s.jsx)(H.Input,{placeholder:"e.g. github-linear-tools"})}),(0,s.jsx)(D.Form.Item,{label:"Description",name:"description",className:"flex-1 mb-0",children:(0,s.jsx)(H.Input,{placeholder:"Optional description"})})]})}),(0,s.jsxs)("div",{className:"flex gap-4 mt-2",style:{minHeight:360},children:[(0,s.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,s.jsx)("div",{className:"flex items-center justify-between mb-2",children:(0,s.jsx)(d.Text,{className:"text-sm font-semibold text-gray-700",children:"Available Tools"})}),(0,s.jsx)(H.Input,{placeholder:"Search MCP servers...",value:x,onChange:e=>h(e.target.value),className:"mb-2",allowClear:!0}),(0,s.jsx)("div",{className:"space-y-2 overflow-y-auto",style:{maxHeight:300},children:0===v.length?(0,s.jsx)(d.Text,{className:"text-gray-400 text-sm",children:0===g.length?"No MCP servers configured":"No servers match your search"}):v.map(e=>(0,s.jsx)(ee,{serverId:e.server_id,serverName:e.alias||e.server_name||e.server_id,accessToken:a,selectedTools:o,onToggle:f},e.server_id))})]}),(0,s.jsx)("div",{className:"w-px bg-gray-200 flex-shrink-0"}),(0,s.jsxs)("div",{className:"w-72 flex-shrink-0",children:[(0,s.jsxs)(d.Text,{className:"text-sm font-semibold text-gray-700 mb-2 block",children:["Your Toolset"," ",(0,s.jsxs)("span",{className:"text-xs font-normal text-gray-400",children:["(",o.length," tools)"]})]}),(0,s.jsx)("div",{className:"space-y-1 overflow-y-auto",style:{maxHeight:340},children:0===o.length?(0,s.jsx)(d.Text,{className:"text-gray-400 text-sm",children:"No tools added yet"}):o.map((e,t)=>(0,s.jsxs)("button",{type:"button",onClick:()=>f(e),className:"w-full flex items-center justify-between px-3 py-1.5 rounded-lg border border-purple-200 bg-purple-50 hover:bg-red-50 hover:border-red-200 group transition-colors",children:[(0,s.jsxs)("div",{className:"min-w-0 text-left",children:[(0,s.jsx)("span",{className:"text-xs font-medium text-purple-800 group-hover:text-red-600 truncate block",children:e.tool_name}),(0,s.jsxs)("span",{className:"text-[10px] text-purple-400 truncate block",children:[e.server_id.slice(0,8),"…"]})]}),(0,s.jsx)("span",{className:"ml-2 text-purple-300 group-hover:text-red-400 text-xs flex-shrink-0",children:"✕"})]},t))})]})]}),(0,s.jsxs)("div",{className:"flex justify-end gap-2 mt-4 pt-4 border-t border-gray-200",children:[(0,s.jsx)(l.Button,{variant:"secondary",onClick:t,children:"Cancel"}),(0,s.jsx)(l.Button,{onClick:y,loading:m,children:n?"Save Changes":"Create Toolset"})]})]})}function et(){let[e,t]=(0,b.useState)(!1),r=(0,_.getProxyBaseUrl)(),l=`{ - "mcpServers": { - "my-toolset": { - "url": "${r}/toolset//mcp", - "headers": { "x-litellm-api-key": "Bearer " } - } - } -}`,a=async()=>{try{await navigator.clipboard.writeText(l),t(!0),setTimeout(()=>t(!1),1500)}catch{}};return(0,s.jsxs)("div",{className:"mb-6 rounded-lg border border-gray-200 bg-gray-50 px-5 py-4",children:[(0,s.jsx)("p",{className:"text-sm font-medium text-gray-700 mb-1",children:"How toolsets work"}),(0,s.jsxs)("p",{className:"text-sm text-gray-500 mb-3",children:["Create a toolset, assign it to a key via ",(0,s.jsx)("span",{className:"font-medium text-gray-700",children:"API Keys → Edit Key → MCP Servers"}),", then point your MCP client at the toolset URL. The client only sees the tools you picked."]}),(0,s.jsx)("div",{className:"text-xs text-gray-400 mb-1",children:"Claude Code / Cursor config"}),(0,s.jsxs)("div",{className:"relative",children:[(0,s.jsx)("pre",{className:"bg-white border border-gray-200 rounded px-4 py-3 text-xs font-mono text-gray-700 overflow-x-auto leading-relaxed pr-14",children:l}),(0,s.jsx)("button",{type:"button",onClick:a,className:"absolute top-2 right-2 px-2 py-1 text-xs rounded border bg-white hover:bg-gray-50 text-gray-400 hover:text-gray-600 border-gray-200 transition-colors",children:e?"✓":"copy"})]})]})}function er({accessToken:e,userRole:t}){let r=(0,v.useQueryClient)(),{data:a=[],isLoading:n}=(0,Q.useMCPToolsets)(),[i,o]=(0,b.useState)(!1),[c,u]=(0,b.useState)(null),[x,h]=(0,b.useState)(null),[g,f]=(0,b.useState)(!1),j="Admin"===t||"proxy_admin"===t,y=async(s,t,l)=>{e&&(await (0,_.createMCPToolset)(e,{toolset_name:s,description:t,tools:l}),K.message.success("Toolset created"),r.invalidateQueries({queryKey:["mcpToolsets"]}))},N=async(s,t,l)=>{e&&c&&(await (0,_.updateMCPToolset)(e,{toolset_id:c.toolset_id,toolset_name:s,description:t,tools:l}),K.message.success("Toolset updated"),r.invalidateQueries({queryKey:["mcpToolsets"]}),u(null))},w=async()=>{if(e&&x){f(!0);try{await (0,_.deleteMCPToolset)(e,x),K.message.success("Toolset deleted"),r.invalidateQueries({queryKey:["mcpToolsets"]}),h(null)}finally{f(!1)}}},C=(0,_.getProxyBaseUrl)(),S=[{header:"Toolset ID",accessorKey:"toolset_id",cell:({row:e})=>(0,s.jsxs)("span",{className:"font-mono text-xs bg-gray-100 px-2 py-0.5 rounded text-gray-600",children:[e.original.toolset_id.slice(0,8),"…"]})},{header:"Name",accessorKey:"toolset_name",cell:({row:e})=>{let t=`${C}/toolset/${e.original.toolset_name}/mcp`;return(0,s.jsxs)("div",{className:"flex flex-col gap-0.5",children:[(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)("span",{className:"inline-block w-2 h-2 rounded-full bg-purple-500 flex-shrink-0"}),(0,s.jsx)("span",{className:"font-medium text-gray-900",children:e.original.toolset_name})]}),(0,s.jsx)("button",{type:"button",className:"text-xs text-gray-400 hover:text-purple-600 font-mono truncate max-w-xs text-left transition-colors",onClick:()=>navigator.clipboard.writeText(t),title:"Click to copy endpoint URL",children:t})]})}},{header:"Description",accessorKey:"description",cell:({row:e})=>(0,s.jsx)("span",{className:"text-sm text-gray-500",children:e.original.description||"—"})},{header:"Tools",accessorKey:"tools",cell:({row:e})=>{let t=e.original.tools;return(0,s.jsxs)("div",{className:"flex flex-wrap gap-1 max-w-xs",children:[t.slice(0,4).map((e,t)=>(0,s.jsx)("span",{className:"inline-flex items-center px-1.5 py-0.5 rounded bg-purple-50 border border-purple-200 text-purple-700 text-xs",children:e.tool_name},t)),t.length>4&&(0,s.jsxs)("span",{className:"text-xs text-gray-400 self-center",children:["+",t.length-4," more"]})]})}},{header:"Created",accessorKey:"created_at",cell:({row:e})=>(0,s.jsx)("span",{className:"text-xs text-gray-500",children:e.original.created_at?new Date(e.original.created_at).toLocaleDateString():"—"})},...j?[{header:"",id:"actions",cell:({row:e})=>(0,s.jsxs)("div",{className:"flex items-center gap-1 justify-end",children:[(0,s.jsx)("button",{type:"button",className:"p-1.5 rounded-lg hover:bg-gray-100 text-gray-400 hover:text-gray-700 transition-colors",onClick:()=>u(e.original),children:(0,s.jsx)(J.PencilIcon,{className:"h-4 w-4"})}),(0,s.jsx)("button",{type:"button",className:"p-1.5 rounded-lg hover:bg-red-50 text-gray-400 hover:text-red-500 transition-colors",onClick:()=>h(e.original.toolset_id),children:(0,s.jsx)(G.TrashIcon,{className:"h-4 w-4"})})]})}]:[]];return(0,s.jsxs)("div",{className:"mt-4",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)(m.Title,{children:"MCP Toolsets"}),(0,s.jsx)(d.Text,{className:"text-gray-500 text-sm",children:"Curated collections of tools from one or more MCP servers. Assign toolsets to keys and teams via the MCP permissions dropdown."})]}),j&&(0,s.jsx)(l.Button,{icon:Y.PlusIcon,onClick:()=>o(!0),children:"New Toolset"})]}),(0,s.jsx)(et,{}),(0,s.jsx)(Z.DataTable,{data:a,columns:S,renderSubComponent:()=>(0,s.jsx)("div",{}),getRowCanExpand:()=>!1,isLoading:n,noDataMessage:"No toolsets yet. Click 'New Toolset' to create one.",loadingMessage:"Loading toolsets...",enableSorting:!0}),(0,s.jsx)(es,{open:i,onClose:()=>o(!1),onSave:y,accessToken:e}),c&&(0,s.jsx)(es,{open:!!c,onClose:()=>u(null),onSave:N,accessToken:e,initialToolset:c}),(0,s.jsx)(p.Modal,{open:!!x,onCancel:()=>h(null),onOk:w,okText:"Delete",okButtonProps:{danger:!0,loading:g},title:"Delete Toolset",children:(0,s.jsx)("p",{children:"Are you sure you want to delete this toolset? Keys and teams using it will lose access to the scoped tools."})})]})}var el=e.i(790848),ea=e.i(362024),en=e.i(827252),ei=e.i(779241),eo=e.i(292335);let ec="rounded-lg border-gray-300 focus:border-blue-500 focus:ring-blue-500",ed=({label:e,tooltip:t})=>(0,s.jsxs)("span",{className:"text-sm font-medium text-gray-700 flex items-center",children:[e,(0,s.jsx)(g.Tooltip,{title:t,children:(0,s.jsx)(en.InfoCircleOutlined,{className:"ml-2 text-blue-400 hover:text-blue-600 cursor-help"})})]}),em=({isM2M:e,isEditing:t=!1,oauthFlow:r,initialFlowType:a,docsUrl:n})=>{let i=t?" (leave blank to keep existing)":"";return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(D.Form.Item,{label:(0,s.jsx)(ed,{label:"OAuth Flow Type",tooltip:"Choose how the proxy authenticates with this MCP server. M2M is for server-to-server communication using client credentials. Interactive (PKCE) is for user-facing flows that require browser-based authorization."}),name:"oauth_flow_type",...a?{initialValue:a}:{},children:(0,s.jsxs)(h.Select,{className:"rounded-lg",size:"large",children:[(0,s.jsx)(h.Select.Option,{value:eo.OAUTH_FLOW.M2M,children:(0,s.jsxs)("div",{children:[(0,s.jsx)("span",{className:"font-medium",children:"Machine-to-Machine (M2M)"}),(0,s.jsx)("span",{className:"text-gray-400 text-xs ml-2",children:"server-to-server, no user interaction"})]})}),(0,s.jsx)(h.Select.Option,{value:eo.OAUTH_FLOW.INTERACTIVE,children:(0,s.jsxs)("div",{children:[(0,s.jsx)("span",{className:"font-medium",children:"Interactive (PKCE)"}),(0,s.jsx)("span",{className:"text-gray-400 text-xs ml-2",children:"browser-based user authorization"})]})})]})}),e?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(D.Form.Item,{label:(0,s.jsx)(ed,{label:"Client ID",tooltip:"OAuth2 client ID for the client_credentials grant."}),name:["credentials","client_id"],rules:[{required:!0,message:"Client ID is required for M2M OAuth"}],children:(0,s.jsx)(ei.TextInput,{type:"password",placeholder:`Enter OAuth client ID${i}`,className:ec})}),(0,s.jsx)(D.Form.Item,{label:(0,s.jsx)(ed,{label:"Client Secret",tooltip:"OAuth2 client secret for the client_credentials grant."}),name:["credentials","client_secret"],rules:[{required:!0,message:"Client Secret is required for M2M OAuth"}],children:(0,s.jsx)(ei.TextInput,{type:"password",placeholder:`Enter OAuth client secret${i}`,className:ec})}),(0,s.jsx)(D.Form.Item,{label:(0,s.jsx)(ed,{label:"Token URL",tooltip:"Token endpoint URL for the client_credentials grant."}),name:"token_url",rules:[{required:!0,message:"Token URL is required for M2M OAuth"}],children:(0,s.jsx)(ei.TextInput,{placeholder:"https://auth.example.com/oauth/token",className:ec})}),(0,s.jsx)(D.Form.Item,{label:(0,s.jsx)(ed,{label:"Scopes (optional)",tooltip:"Optional scopes to request with the client_credentials grant."}),name:["credentials","scopes"],children:(0,s.jsx)(h.Select,{mode:"tags",tokenSeparators:[","],placeholder:"Add scopes",className:"rounded-lg",size:"large"})})]}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(D.Form.Item,{label:(0,s.jsxs)("span",{className:"flex items-center justify-between w-full",children:[(0,s.jsx)(ed,{label:"Client ID (optional)",tooltip:"Provide only if your MCP server cannot handle dynamic client registration."}),n&&(0,s.jsx)("a",{href:n,target:"_blank",rel:"noopener noreferrer",className:"text-xs text-blue-500 hover:text-blue-700 ml-2 font-normal",onClick:e=>e.stopPropagation(),children:"Create OAuth App →"})]}),name:["credentials","client_id"],children:(0,s.jsx)(ei.TextInput,{type:"password",placeholder:`Enter client ID${i}`,className:ec})}),(0,s.jsx)(D.Form.Item,{label:(0,s.jsx)(ed,{label:"Client Secret (optional)",tooltip:"Provide only if your MCP server cannot handle dynamic client registration."}),name:["credentials","client_secret"],children:(0,s.jsx)(ei.TextInput,{type:"password",placeholder:`Enter client secret${i}`,className:ec})}),(0,s.jsx)(D.Form.Item,{label:(0,s.jsx)(ed,{label:"Scopes (optional)",tooltip:"Optional scopes requested during token exchange. Separate multiple scopes with enter or commas."}),name:["credentials","scopes"],children:(0,s.jsx)(h.Select,{mode:"tags",tokenSeparators:[","],placeholder:"Add scopes",className:"rounded-lg",size:"large"})}),(0,s.jsx)(D.Form.Item,{label:(0,s.jsx)(ed,{label:"Authorization URL (optional)",tooltip:"Optional override for the authorization endpoint."}),name:"authorization_url",children:(0,s.jsx)(ei.TextInput,{placeholder:"https://example.com/oauth/authorize",className:ec})}),(0,s.jsx)(D.Form.Item,{label:(0,s.jsx)(ed,{label:"Token URL (optional)",tooltip:"Optional override for the token endpoint."}),name:"token_url",children:(0,s.jsx)(ei.TextInput,{placeholder:"https://example.com/oauth/token",className:ec})}),(0,s.jsx)(D.Form.Item,{label:(0,s.jsx)(ed,{label:"Registration URL (optional)",tooltip:"Optional override for the dynamic client registration endpoint."}),name:"registration_url",children:(0,s.jsx)(ei.TextInput,{placeholder:"https://example.com/oauth/register",className:ec})}),r&&(0,s.jsxs)("div",{className:"rounded-lg border border-dashed border-gray-300 p-4 space-y-2",children:[(0,s.jsx)("p",{className:"text-sm text-gray-600",children:"Use OAuth to fetch a fresh access token and temporarily save it in the session as the authentication value."}),(0,s.jsx)(l.Button,{variant:"secondary",onClick:r.startOAuthFlow,disabled:"authorizing"===r.status||"exchanging"===r.status,children:"authorizing"===r.status?"Waiting for authorization...":"exchanging"===r.status?"Exchanging authorization code...":"Authorize & Fetch Token"}),r.error&&(0,s.jsx)("p",{className:"text-sm text-red-500",children:r.error}),"success"===r.status&&r.tokenResponse?.access_token&&(0,s.jsxs)("p",{className:"text-sm text-green-600",children:["Token fetched. Expires in ",r.tokenResponse.expires_in??"?"," seconds."]})]})]})]})};var eu=e.i(28651),ex=e.i(906579),ep=e.i(458505),eh=e.i(366308),eg=e.i(304967);let ef=({value:e={},onChange:t,tools:r=[],disabled:l=!1})=>(0,s.jsx)(eg.Card,{children:(0,s.jsxs)("div",{className:"space-y-6",children:[(0,s.jsxs)("div",{className:"flex items-center gap-2 mb-4",children:[(0,s.jsx)(ep.DollarOutlined,{className:"text-green-600"}),(0,s.jsx)(m.Title,{children:"Cost Configuration"}),(0,s.jsx)(g.Tooltip,{title:"Configure costs for this MCP server's tool calls. Set a default rate and per-tool overrides.",children:(0,s.jsx)(en.InfoCircleOutlined,{className:"text-gray-400"})})]}),(0,s.jsxs)("div",{className:"space-y-4",children:[(0,s.jsxs)("div",{children:[(0,s.jsxs)("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:["Default Cost per Query ($)",(0,s.jsx)(g.Tooltip,{title:"Default cost charged for each tool call to this server.",children:(0,s.jsx)(en.InfoCircleOutlined,{className:"ml-1 text-gray-400"})})]}),(0,s.jsx)(eu.InputNumber,{min:0,step:1e-4,precision:4,placeholder:"0.0000",value:e.default_cost_per_query,onChange:s=>{let r={...e,default_cost_per_query:s};t?.(r)},disabled:l,style:{width:"200px"},addonBefore:"$"}),(0,s.jsx)(d.Text,{className:"block mt-1 text-gray-500 text-sm",children:"Set a default cost for all tool calls to this server"})]}),r.length>0&&(0,s.jsxs)("div",{className:"space-y-4",children:[(0,s.jsxs)("label",{className:"block text-sm font-medium text-gray-700",children:["Tool-Specific Costs ($)",(0,s.jsx)(g.Tooltip,{title:"Override the default cost for specific tools. Leave blank to use the default rate.",children:(0,s.jsx)(en.InfoCircleOutlined,{className:"ml-1 text-gray-400"})})]}),(0,s.jsx)(ea.Collapse,{items:[{key:"1",label:(0,s.jsxs)("div",{className:"flex items-center",children:[(0,s.jsx)(eh.ToolOutlined,{className:"mr-2 text-blue-500"}),(0,s.jsx)("span",{className:"font-medium",children:"Available Tools"}),(0,s.jsx)(ex.Badge,{count:r.length,style:{backgroundColor:"#52c41a",marginLeft:"8px"}})]}),children:(0,s.jsx)("div",{className:"space-y-3 max-h-64 overflow-y-auto",children:r.map((r,a)=>(0,s.jsxs)("div",{className:"flex items-center justify-between p-3 bg-gray-50 rounded-lg",children:[(0,s.jsxs)("div",{className:"flex-1",children:[(0,s.jsx)(d.Text,{className:"font-medium text-gray-900",children:r.name}),r.description&&(0,s.jsx)(d.Text,{className:"text-gray-500 text-sm block mt-1",children:r.description})]}),(0,s.jsx)("div",{className:"ml-4",children:(0,s.jsx)(eu.InputNumber,{min:0,step:1e-4,precision:4,placeholder:"Use default",value:e.tool_name_to_cost_per_query?.[r.name],onChange:s=>{var l;let a;return l=r.name,a={...e,tool_name_to_cost_per_query:{...e.tool_name_to_cost_per_query,[l]:s}},void t?.(a)},disabled:l,style:{width:"120px"},addonBefore:"$"})})]},a))})}]})]})]}),(e.default_cost_per_query||e.tool_name_to_cost_per_query&&Object.keys(e.tool_name_to_cost_per_query).length>0)&&(0,s.jsxs)("div",{className:"mt-6 p-4 bg-blue-50 border border-blue-200 rounded-lg",children:[(0,s.jsx)(d.Text,{className:"text-blue-800 font-medium",children:"Cost Summary:"}),(0,s.jsxs)("div",{className:"mt-2 space-y-1",children:[e.default_cost_per_query&&(0,s.jsxs)(d.Text,{className:"text-blue-700",children:["• Default cost: $",e.default_cost_per_query.toFixed(4)," per query"]}),e.tool_name_to_cost_per_query&&Object.entries(e.tool_name_to_cost_per_query).map(([e,t])=>null!=t&&(0,s.jsxs)(d.Text,{className:"text-blue-700",children:["• ",e,": $",t.toFixed(4)," per query"]},e))]})]})]})});var eb=e.i(464571),ej=e.i(560445),ey=e.i(245704),ev=e.i(270377),eN=e.i(91979);let e_=({formValues:e,tools:t,isLoadingTools:r,toolsError:l,toolsErrorStackTrace:a,canFetchTools:n,fetchTools:i})=>n||e.url||e.spec_path?(0,s.jsx)(eg.Card,{children:(0,s.jsxs)("div",{className:"space-y-4",children:[(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)(ey.CheckCircleOutlined,{className:"text-blue-600"}),(0,s.jsx)(m.Title,{children:"Connection Status"})]}),!n&&(e.url||e.spec_path)&&(0,s.jsxs)("div",{className:"text-center py-6 text-gray-400 border rounded-lg border-dashed",children:[(0,s.jsx)(eh.ToolOutlined,{className:"text-2xl mb-2"}),(0,s.jsx)(d.Text,{children:"Complete required fields to test connection"}),(0,s.jsx)("br",{}),(0,s.jsx)(d.Text,{className:"text-sm",children:"Fill in URL, Transport, and Authentication to test MCP server connection"})]}),n&&(0,s.jsxs)("div",{children:[(0,s.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)(d.Text,{className:"text-gray-700 font-medium",children:r?"Testing connection to MCP server...":t.length>0?"Connection successful":l?"Connection failed":"Ready to test connection"}),(0,s.jsx)("br",{}),(0,s.jsxs)(d.Text,{className:"text-gray-500 text-sm",children:["Server: ",e.url||e.spec_path]})]}),r&&(0,s.jsxs)("div",{className:"flex items-center text-blue-600",children:[(0,s.jsx)(W.Spin,{size:"small",className:"mr-2"}),(0,s.jsx)(d.Text,{className:"text-blue-600",children:"Connecting..."})]}),!r&&!l&&t.length>0&&(0,s.jsxs)("div",{className:"flex items-center text-green-600",children:[(0,s.jsx)(ey.CheckCircleOutlined,{className:"mr-1"}),(0,s.jsx)(d.Text,{className:"text-green-600 font-medium",children:"Connected"})]}),l&&(0,s.jsxs)("div",{className:"flex items-center text-red-600",children:[(0,s.jsx)(ev.ExclamationCircleOutlined,{className:"mr-1"}),(0,s.jsx)(d.Text,{className:"text-red-600 font-medium",children:"Failed"})]})]}),r&&(0,s.jsxs)("div",{className:"flex items-center justify-center py-6",children:[(0,s.jsx)(W.Spin,{size:"large"}),(0,s.jsx)(d.Text,{className:"ml-3",children:"Testing connection and loading tools..."})]}),l&&(0,s.jsx)(ej.Alert,{message:"Connection Failed",description:(0,s.jsxs)("div",{children:[(0,s.jsx)("div",{children:l}),a&&(0,s.jsx)(ea.Collapse,{items:[{key:"stack-trace",label:"Stack Trace",children:(0,s.jsx)("pre",{style:{whiteSpace:"pre-wrap",wordBreak:"break-word",fontSize:"12px",fontFamily:"monospace",margin:0,padding:"8px",backgroundColor:"#f5f5f5",borderRadius:"4px",maxHeight:"400px",overflow:"auto"},children:a})}],style:{marginTop:"12px"}})]}),type:"error",showIcon:!0,action:(0,s.jsx)(eb.Button,{icon:(0,s.jsx)(eN.ReloadOutlined,{}),onClick:i,size:"small",children:"Retry"})}),!r&&0===t.length&&!l&&(0,s.jsxs)("div",{className:"text-center py-6 text-gray-500 border rounded-lg border-dashed",children:[(0,s.jsx)(ey.CheckCircleOutlined,{className:"text-2xl mb-2 text-green-500"}),(0,s.jsx)(d.Text,{className:"text-green-600 font-medium",children:"Connection successful!"}),(0,s.jsx)("br",{}),(0,s.jsx)(d.Text,{className:"text-gray-500",children:"No tools found for this MCP server"})]})]})]})}):null;var ew=e.i(928685),eC=e.i(751904),eS=e.i(536916),eT=e.i(91739);let ek=({accessToken:e,oauthAccessToken:s,formValues:t,enabled:r=!0})=>{let[l,a]=(0,b.useState)([]),[n,i]=(0,b.useState)(!1),[o,c]=(0,b.useState)(null),[d,m]=(0,b.useState)(null),[u,x]=(0,b.useState)(!1),p=t.auth_type===eo.AUTH_TYPE.OAUTH2&&t.oauth_flow_type===eo.OAUTH_FLOW.M2M,h=t.auth_type===eo.AUTH_TYPE.OAUTH2&&!p,g=t.transport===eo.TRANSPORT.OPENAPI,f=g?!!t.spec_path:!!t.url,j=g?!!(f&&e):!!(f&&t.transport&&t.auth_type&&e&&(!h||s)),y=JSON.stringify(t.static_headers??{}),v=JSON.stringify(t.credentials??{}),N=async()=>{if(e&&(t.url||t.spec_path)&&(!h||s||g)){i(!0),c(null);try{let r=Array.isArray(t.static_headers)?t.static_headers.reduce((e,s)=>{let t=s?.header?.trim();return t&&(e[t]=s?.value!=null?String(s.value):""),e},{}):!Array.isArray(t.static_headers)&&t.static_headers&&"object"==typeof t.static_headers?Object.entries(t.static_headers).reduce((e,[s,t])=>(s&&(e[s]=null!=t?String(t):""),e),{}):{},l=t.credentials&&"object"==typeof t.credentials?Object.entries(t.credentials).reduce((e,[s,t])=>{if(null==t||""===t)return e;if("scopes"===s){if(Array.isArray(t)){let r=t.filter(e=>null!=e&&""!==e);r.length>0&&(e[s]=r)}}else e[s]=t;return e},{}):void 0,n=t.transport===eo.TRANSPORT.OPENAPI?"http":t.transport,i={server_id:t.server_id||"",server_name:t.server_name||"",url:t.url,spec_path:t.spec_path,transport:n,auth_type:t.auth_type,authorization_url:t.authorization_url,token_url:t.token_url,registration_url:t.registration_url,mcp_info:t.mcp_info,static_headers:r};l&&Object.keys(l).length>0&&(i.credentials=l);let o=await (0,_.testMCPToolsListRequest)(e,i,s);if(o.tools&&!o.error)a(o.tools),c(null),m(null),o.tools.length>0&&!u&&x(!0);else{let e=o.message||"Failed to retrieve tools list";c(e),m(o.stack_trace||null),a([]),x(!1)}}catch(e){console.error("Tools fetch error:",e),c(e instanceof Error?e.message:String(e)),m(null),a([]),x(!1)}finally{i(!1)}}},w=()=>{a([]),c(null),m(null),x(!1)};return(0,b.useEffect)(()=>{r&&(j?N():w())},[t.url,t.spec_path,t.transport,t.auth_type,e,r,s,j,y,v]),{tools:l,isLoadingTools:n,toolsError:o,toolsErrorStackTrace:d,hasShownSuccessMessage:u,canFetchTools:j,fetchTools:N,clearTools:w}};var eA=e.i(531516);let eI=({tool:e,isEnabled:t,isEditExpanded:r,toolNameToDisplayName:l,toolNameToDescription:a,onToggle:n,onToggleExpand:i,onDisplayNameChange:o,onDescriptionChange:c})=>(0,s.jsxs)("div",{className:`rounded-lg border transition-colors ${t?"bg-blue-50 border-blue-300 hover:border-blue-400":"bg-gray-50 border-gray-200 hover:border-gray-300"}`,children:[(0,s.jsx)("div",{className:"p-4 cursor-pointer",onClick:()=>n(e.name),children:(0,s.jsxs)("div",{className:"flex items-start gap-3",children:[(0,s.jsx)(eS.Checkbox,{checked:t,onChange:()=>n(e.name)}),(0,s.jsxs)("div",{className:"flex-1",children:[(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)(d.Text,{className:"font-medium text-gray-900",children:l[e.name]||e.name}),(0,s.jsx)("span",{className:`px-2 py-0.5 text-xs rounded-full font-medium ${t?"bg-green-100 text-green-800":"bg-red-100 text-red-800"}`,children:t?"Enabled":"Disabled"}),l[e.name]&&(0,s.jsx)("span",{className:"px-2 py-0.5 text-xs rounded-full font-medium bg-purple-100 text-purple-800",children:"Custom name"})]}),(a[e.name]||e.description)&&(0,s.jsx)(d.Text,{className:"text-gray-500 text-sm block mt-1",children:a[e.name]||e.description}),(0,s.jsx)(d.Text,{className:"text-gray-400 text-xs block mt-1",children:t?"✓ Users can call this tool":"✗ Users cannot call this tool"})]}),(0,s.jsx)("button",{type:"button",onClick:s=>i(e.name,s),className:`p-1.5 rounded-md transition-colors ${r?"bg-blue-100 text-blue-600":"text-gray-400 hover:text-gray-600 hover:bg-gray-100"}`,title:"Edit display name and description",children:(0,s.jsx)(eC.EditOutlined,{})})]})}),r&&(0,s.jsxs)("div",{className:"px-4 pb-4 pt-3 border-t border-gray-200 space-y-3 bg-gray-50 rounded-b-lg",onClick:e=>e.stopPropagation(),children:[(0,s.jsxs)("div",{children:[(0,s.jsx)(d.Text,{className:"text-xs font-medium text-gray-600 mb-1 block",children:"Display Name"}),(0,s.jsx)(H.Input,{placeholder:e.name,value:l[e.name]||"",onChange:s=>o(e.name,s.target.value)}),(0,s.jsx)(d.Text,{className:"text-xs text-gray-400 mt-1 block",children:"Override how this tool's name appears to users. Leave blank to use original."})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)(d.Text,{className:"text-xs font-medium text-gray-600 mb-1 block",children:"Description"}),(0,s.jsx)(H.Input.TextArea,{placeholder:e.description||"No description",value:a[e.name]||"",onChange:s=>c(e.name,s.target.value),rows:2}),(0,s.jsx)(d.Text,{className:"text-xs text-gray-400 mt-1 block",children:"Override the tool description shown to users. Leave blank to use original."})]})]})]}),eP=({accessToken:e,oauthAccessToken:t,formValues:r,allowedTools:l,existingAllowedTools:a,onAllowedToolsChange:n,toolNameToDisplayName:i,toolNameToDescription:o,onToolNameToDisplayNameChange:c,onToolNameToDescriptionChange:u,keyTools:x,externalTools:p,externalIsLoading:h,externalError:g,externalCanFetch:f})=>{let j=(0,b.useRef)([]),[y,v]=(0,b.useState)(""),[N,_]=(0,b.useState)("crud"),w=(0,b.useRef)(!1),C=(0,b.useRef)(""),[S,T]=(0,b.useState)(new Set),k=void 0!==p,A=ek({accessToken:e,oauthAccessToken:t,formValues:r,enabled:!k}),I=k?p:A.tools,P=k?h??!1:A.isLoadingTools,O=k?g??null:A.toolsError,M=k?f??!1:A.canFetchTools,F=(0,b.useMemo)(()=>{if(!x||0===x.length||0===I.length)return[];let e=new Set,s=[];for(let t of x){let r=t.name.split("_").map(e=>e.toLowerCase()).filter(e=>e.length>1);if(0===r.length)continue;let l=e=>e.toLowerCase().replace(/[-_/]/g," "),a=I.find(s=>{if(e.has(s.name))return!1;let t=l(s.name);return r.every(e=>t.includes(e))});if(!a){let s=r.find(e=>e.length>3)??r[r.length-1];a=I.find(t=>!e.has(t.name)&&l(t.name).includes(s))}a&&(s.push(a),e.add(a.name))}return s},[x,I]),E=(0,b.useMemo)(()=>new Set(F.map(e=>e.name)),[F]),L=(0,b.useMemo)(()=>I.filter(e=>{let s=y.toLowerCase();return e.name.toLowerCase().includes(s)||e.description&&e.description.toLowerCase().includes(s)}),[I,y]),R=(0,b.useMemo)(()=>L.filter(e=>E.has(e.name)),[L,E]),U=(0,b.useMemo)(()=>L.filter(e=>!E.has(e.name)),[L,E]);(0,b.useEffect)(()=>{let e=I.map(e=>e.name).sort().join(","),s=j.current.map(e=>e.name).sort().join(","),t=F.map(e=>e.name).sort().join(",");if(t!==C.current&&(C.current=t,""!==t&&(w.current=!1)),I.length>0&&e!==s){let e=I.map(e=>e.name);w.current?n(l.filter(s=>e.includes(s))):(w.current=!0,a&&a.length>0?n(a.filter(s=>e.includes(s))):F.length>0?n(F.map(e=>e.name).filter(s=>e.includes(s))):n(e))}j.current=I},[I,l,a,n,F]);let z=e=>{l.includes(e)?n(l.filter(s=>s!==e)):n([...l,e])},B=(e,s)=>{s.stopPropagation(),T(s=>{let t=new Set(s);return t.has(e)?t.delete(e):t.add(e),t})},q=(e,s)=>{let t={...i};s?t[e]=s:delete t[e],c(t)},V=(e,s)=>{let t={...o};s?t[e]=s:delete t[e],u(t)};return M||r.url||r.spec_path?(0,s.jsx)(eg.Card,{children:(0,s.jsxs)("div",{className:"space-y-4",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between",children:[(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)(eh.ToolOutlined,{className:"text-blue-600"}),(0,s.jsx)(m.Title,{children:"Tool Configuration"}),I.length>0&&(0,s.jsx)(ex.Badge,{count:I.length,style:{backgroundColor:"#52c41a"}})]}),I.length>0&&(0,s.jsx)(eT.Radio.Group,{value:N,onChange:e=>_(e.target.value),size:"small",optionType:"button",buttonStyle:"solid",options:[{label:"Risk Groups",value:"crud"},{label:"Flat List",value:"flat"}]})]}),(0,s.jsx)("div",{className:"bg-blue-50 border border-blue-200 rounded-lg p-3",children:(0,s.jsxs)(d.Text,{className:"text-blue-800 text-sm",children:[(0,s.jsx)("strong",{children:"Select which tools users can call:"})," Only checked tools will be available for users to invoke. Unchecked tools will be blocked from execution."]})}),P&&(0,s.jsxs)("div",{className:"flex items-center justify-center py-6",children:[(0,s.jsx)(W.Spin,{size:"large"}),(0,s.jsx)(d.Text,{className:"ml-3",children:"Loading tools from spec..."})]}),O&&!P&&(0,s.jsxs)("div",{className:"text-center py-6 text-red-500 border rounded-lg border-dashed border-red-300 bg-red-50",children:[(0,s.jsx)(eh.ToolOutlined,{className:"text-2xl mb-2"}),(0,s.jsx)(d.Text,{className:"text-red-600 font-medium",children:"Unable to load tools"}),(0,s.jsx)("br",{}),(0,s.jsx)(d.Text,{className:"text-sm text-red-500",children:O})]}),!P&&!O&&0===I.length&&M&&(x&&x.length>0?(0,s.jsxs)("div",{className:"text-center py-4 text-gray-400 border rounded-lg border-dashed",children:[(0,s.jsx)(eh.ToolOutlined,{className:"text-2xl mb-2"}),(0,s.jsx)(d.Text,{children:"No tools loaded from spec"}),(0,s.jsxs)(d.Text,{className:"text-sm block mt-1",children:["Expected tools: ",x.map(e=>e.name).join(", ")]})]}):(0,s.jsxs)("div",{className:"text-center py-6 text-gray-400 border rounded-lg border-dashed",children:[(0,s.jsx)(eh.ToolOutlined,{className:"text-2xl mb-2"}),(0,s.jsx)(d.Text,{children:"No tools available for configuration"}),(0,s.jsx)("br",{}),(0,s.jsx)(d.Text,{className:"text-sm",children:"Connect to an MCP server with tools to configure them"})]})),!M&&(r.url||r.spec_path)&&(0,s.jsxs)("div",{className:"text-center py-6 text-gray-400 border rounded-lg border-dashed",children:[(0,s.jsx)(eh.ToolOutlined,{className:"text-2xl mb-2"}),(0,s.jsx)(d.Text,{children:"Complete required fields to configure tools"}),(0,s.jsx)("br",{}),(0,s.jsx)(d.Text,{className:"text-sm",children:"Fill in URL, Transport, and Authentication to load available tools"})]}),!P&&!O&&I.length>0&&(0,s.jsxs)("div",{className:"space-y-3",children:[(0,s.jsxs)("div",{className:"flex items-center gap-2 p-3 bg-green-50 rounded-lg border border-green-200",children:[(0,s.jsx)(ey.CheckCircleOutlined,{className:"text-green-600"}),(0,s.jsxs)(d.Text,{className:"text-green-700 font-medium",children:[l.length," of ",I.length," ",1===I.length?"tool":"tools"," enabled for user access"]})]}),(0,s.jsx)(H.Input,{placeholder:"Search tools by name or description...",prefix:(0,s.jsx)(ew.SearchOutlined,{className:"text-gray-400"}),value:y,onChange:e=>v(e.target.value),allowClear:!0,className:"rounded-lg",size:"large"}),"crud"===N&&(0,s.jsx)(eA.default,{tools:I,searchFilter:y,value:0===l.length?void 0:l,onChange:e=>n(e)}),"flat"===N&&(0,s.jsx)(s.Fragment,{children:0===L.length?(0,s.jsxs)("div",{className:"text-center py-6 text-gray-400 border rounded-lg border-dashed",children:[(0,s.jsx)(ew.SearchOutlined,{className:"text-2xl mb-2"}),(0,s.jsxs)(d.Text,{children:['No tools found matching "',y,'"']})]}):(0,s.jsxs)("div",{className:"space-y-2",children:[R.length>0&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("div",{className:"flex items-center justify-between px-1",children:[(0,s.jsx)("p",{className:"text-xs font-semibold text-gray-500 uppercase tracking-wide",children:"Suggested tools"}),(0,s.jsxs)("div",{className:"flex gap-2",children:[(0,s.jsx)("button",{type:"button",onClick:()=>{let e=F.map(e=>e.name);n([...l.filter(e=>!E.has(e)),...e])},className:"text-xs text-blue-600 hover:text-blue-700",children:"Enable all"}),(0,s.jsx)("button",{type:"button",onClick:()=>{n(l.filter(e=>!E.has(e)))},className:"text-xs text-gray-500 hover:text-gray-700",children:"Disable all"})]})]}),R.map(e=>(0,s.jsx)(eI,{tool:e,isEnabled:l.includes(e.name),isEditExpanded:S.has(e.name),toolNameToDisplayName:i,toolNameToDescription:o,onToggle:z,onToggleExpand:B,onDisplayNameChange:q,onDescriptionChange:V},e.name))]}),U.length>0&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("div",{className:"flex items-center justify-between px-1 pt-2",children:[(0,s.jsx)("p",{className:"text-xs font-semibold text-gray-500 uppercase tracking-wide",children:R.length>0?"All tools":"Tools"}),(0,s.jsxs)("div",{className:"flex gap-2",children:[(0,s.jsx)("button",{type:"button",onClick:()=>{let e=I.filter(e=>!E.has(e.name)).map(e=>e.name),s=new Set(l);n([...l,...e.filter(e=>!s.has(e))])},className:"text-xs text-blue-600 hover:text-blue-700",children:"Enable all"}),(0,s.jsx)("button",{type:"button",onClick:()=>{n(l.filter(e=>E.has(e)))},className:"text-xs text-gray-500 hover:text-gray-700",children:"Disable all"})]})]}),U.map(e=>(0,s.jsx)(eI,{tool:e,isEnabled:l.includes(e.name),isEditExpanded:S.has(e.name),toolNameToDisplayName:i,toolNameToDescription:o,onToggle:z,onToggleExpand:B,onDisplayNameChange:q,onDescriptionChange:V},e.name))]})]})})]})]})}):null},eO=({isVisible:e,required:t=!0})=>e?(0,s.jsx)(D.Form.Item,{label:(0,s.jsxs)("span",{className:"text-sm font-medium text-gray-700 flex items-center",children:["Stdio Configuration (JSON)",(0,s.jsx)(g.Tooltip,{title:"Paste your stdio MCP server configuration in JSON format. You can use the full mcpServers structure from config.yaml or just the inner server configuration.",children:(0,s.jsx)(en.InfoCircleOutlined,{className:"ml-2 text-blue-400 hover:text-blue-600 cursor-help"})})]}),name:"stdio_config",rules:[...t?[{required:!0,message:"Please enter stdio configuration"}]:[],{validator:(e,s)=>{if(!s)return Promise.resolve();try{return JSON.parse(s),Promise.resolve()}catch{return Promise.reject("Please enter valid JSON")}}}],children:(0,s.jsx)(H.Input.TextArea,{placeholder:`{ - "mcpServers": { - "circleci-mcp-server": { - "command": "npx", - "args": ["-y", "@circleci/mcp-server-circleci"], - "env": { - "CIRCLECI_TOKEN": "your-circleci-token", - "CIRCLECI_BASE_URL": "https://circleci.com" - } - } - } -}`,rows:12,className:"rounded-lg border-gray-300 focus:border-blue-500 focus:ring-blue-500 font-mono text-sm"})}):null;var eM=e.i(770914),eF=e.i(564897),eE=e.i(646563);let{Panel:eL}=ea.Collapse,eR=({availableAccessGroups:e,mcpServer:t,searchValue:r,setSearchValue:l,getAccessGroupOptions:a})=>{let n=D.Form.useFormInstance();return(0,b.useEffect)(()=>{if(t){if(t.extra_headers&&n.setFieldValue("extra_headers",t.extra_headers),t.static_headers){let e=Object.entries(t.static_headers).map(([e,s])=>({header:e,value:null!=s?String(s):""}));n.setFieldValue("static_headers",e)}"boolean"==typeof t.allow_all_keys&&n.setFieldValue("allow_all_keys",t.allow_all_keys),"boolean"==typeof t.available_on_public_internet&&n.setFieldValue("available_on_public_internet",t.available_on_public_internet)}else n.setFieldValue("allow_all_keys",!1),n.setFieldValue("available_on_public_internet",!0)},[t,n]),(0,s.jsx)(ea.Collapse,{className:"bg-gray-50 border border-gray-200 rounded-lg",expandIconPosition:"end",ghost:!1,children:(0,s.jsx)(eL,{header:(0,s.jsxs)("div",{className:"flex items-center",children:[(0,s.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,s.jsx)("div",{className:"w-2 h-2 bg-blue-500 rounded-full"}),(0,s.jsx)("h3",{className:"text-lg font-semibold text-gray-900",children:"Permission Management / Access Control"})]}),(0,s.jsx)("p",{className:"text-sm text-gray-600 ml-4",children:"Configure access permissions and security settings (Optional)"})]}),className:"border-0",forceRender:!0,children:(0,s.jsxs)("div",{className:"space-y-6 pt-4",children:[(0,s.jsxs)("div",{className:"flex items-start justify-between gap-4",children:[(0,s.jsxs)("div",{children:[(0,s.jsxs)("span",{className:"text-sm font-medium text-gray-700 flex items-center",children:["Allow All LiteLLM Keys",(0,s.jsx)(g.Tooltip,{title:"When enabled, every API key can access this MCP server.",children:(0,s.jsx)(en.InfoCircleOutlined,{className:"ml-2 text-blue-400 hover:text-blue-600 cursor-help"})})]}),(0,s.jsx)("p",{className:"text-sm text-gray-600 mt-1",children:'Enable if this server should be "public" to all keys.'})]}),(0,s.jsx)(D.Form.Item,{name:"allow_all_keys",valuePropName:"checked",initialValue:t?.allow_all_keys??!1,className:"mb-0",children:(0,s.jsx)(el.Switch,{})})]}),(0,s.jsxs)("div",{className:"flex items-start justify-between gap-4",children:[(0,s.jsxs)("div",{children:[(0,s.jsxs)("span",{className:"text-sm font-medium text-gray-700 flex items-center",children:["Internal network only",(0,s.jsx)(g.Tooltip,{title:"When on, only requests from within your internal network are accepted. Turn off to allow external clients (other clusters, ChatGPT, etc). API key authentication is always required regardless of this setting.",children:(0,s.jsx)(en.InfoCircleOutlined,{className:"ml-2 text-blue-400 hover:text-blue-600 cursor-help"})})]}),(0,s.jsx)("p",{className:"text-sm text-gray-600 mt-1",children:"Turn on to restrict access to callers within your internal network only."})]}),(0,s.jsx)(D.Form.Item,{name:"available_on_public_internet",valuePropName:"checked",getValueProps:e=>({checked:!e}),getValueFromEvent:e=>!e,initialValue:!0,className:"mb-0",children:(0,s.jsx)(el.Switch,{})})]}),(0,s.jsx)(D.Form.Item,{label:(0,s.jsxs)("span",{className:"text-sm font-medium text-gray-700 flex items-center",children:["MCP Access Groups",(0,s.jsx)(g.Tooltip,{title:"Specify access groups for this MCP server. Users must be in at least one of these groups to access the server.",children:(0,s.jsx)(en.InfoCircleOutlined,{className:"ml-2 text-blue-400 hover:text-blue-600 cursor-help"})})]}),name:"mcp_access_groups",className:"mb-4",children:(0,s.jsx)(h.Select,{mode:"tags",showSearch:!0,placeholder:"Select existing groups or type to create new ones",optionFilterProp:"value",filterOption:(e,s)=>(s?.value??"").toLowerCase().includes(e.toLowerCase()),onSearch:e=>l(e),tokenSeparators:[","],options:a(),maxTagCount:"responsive",allowClear:!0})}),(0,s.jsx)(D.Form.Item,{label:(0,s.jsxs)("span",{className:"text-sm font-medium text-gray-700 flex items-center",children:["Extra Headers",(0,s.jsx)(g.Tooltip,{title:"Forward custom headers from incoming requests to this MCP server (e.g., Authorization, X-Custom-Header, User-Agent)",children:(0,s.jsx)(en.InfoCircleOutlined,{className:"ml-2 text-blue-400 hover:text-blue-600 cursor-help"})}),t?.extra_headers&&t.extra_headers.length>0&&(0,s.jsxs)("span",{className:"ml-2 text-xs bg-blue-100 text-blue-700 px-2 py-1 rounded-full",children:[t.extra_headers.length," configured"]})]}),name:"extra_headers",children:(0,s.jsx)(h.Select,{mode:"tags",placeholder:t?.extra_headers&&t.extra_headers.length>0?`Currently: ${t.extra_headers.join(", ")}`:"Enter header names (e.g., Authorization, X-Custom-Header)",className:"rounded-lg",size:"large",tokenSeparators:[","],allowClear:!0})}),(0,s.jsx)(D.Form.Item,{label:(0,s.jsxs)("span",{className:"text-sm font-medium text-gray-700 flex items-center",children:["Static Headers",(0,s.jsx)(g.Tooltip,{title:"Send these key-value headers with every request to this MCP server.",children:(0,s.jsx)(en.InfoCircleOutlined,{className:"ml-2 text-blue-400 hover:text-blue-600 cursor-help"})})]}),required:!1,children:(0,s.jsx)(D.Form.List,{name:"static_headers",children:(e,{add:t,remove:r})=>(0,s.jsxs)("div",{className:"space-y-3",children:[e.map(({key:e,name:t,...l})=>(0,s.jsxs)(eM.Space,{className:"flex w-full",align:"baseline",size:"middle",children:[(0,s.jsx)(D.Form.Item,{...l,name:[t,"header"],className:"flex-1",rules:[{required:!0,message:"Header name is required"}],children:(0,s.jsx)(H.Input,{size:"large",allowClear:!0,className:"rounded-lg",placeholder:"Header name (e.g., X-API-Key)"})}),(0,s.jsx)(D.Form.Item,{...l,name:[t,"value"],className:"flex-1",rules:[{required:!0,message:"Header value is required"}],children:(0,s.jsx)(H.Input,{size:"large",allowClear:!0,className:"rounded-lg",placeholder:"Header value"})}),(0,s.jsx)(eF.MinusCircleOutlined,{onClick:()=>r(t),className:"text-gray-500 hover:text-red-500 cursor-pointer"})]},e)),(0,s.jsx)(eb.Button,{type:"dashed",onClick:()=>t(),icon:(0,s.jsx)(eE.PlusOutlined,{}),block:!0,children:"Add Static Header"})]})})})]})},"permissions")})},eU=({accessToken:e,selectedName:t,onSelect:r})=>{let[l,a]=(0,b.useState)([]),[n,i]=(0,b.useState)(!1),[o,c]=(0,b.useState)(new Set);return((0,b.useEffect)(()=>{e&&(i(!0),(0,_.fetchOpenAPIRegistry)(e).then(e=>a(e.apis??[])).catch(()=>a([])).finally(()=>i(!1)))},[e]),n)?(0,s.jsxs)("div",{className:"mb-4",children:[(0,s.jsx)("span",{className:"text-sm font-medium text-gray-700",children:"Popular APIs"}),(0,s.jsx)("div",{className:"flex justify-center py-6",children:(0,s.jsx)(W.Spin,{size:"small"})})]}):0===l.length?null:(0,s.jsxs)("div",{className:"mb-4",children:[(0,s.jsx)("span",{className:"text-sm font-medium text-gray-700 block mb-2",children:"Popular APIs"}),(0,s.jsx)("div",{className:"grid grid-cols-5 gap-2",children:l.map(e=>{let l=t===e.name,a=o.has(e.name);return(0,s.jsxs)("button",{type:"button",title:e.description,onClick:()=>r(e),className:`flex flex-col items-center gap-1.5 p-3 rounded-lg border transition-all cursor-pointer - ${l?"border-blue-500 bg-blue-50 shadow-sm":"border-gray-200 hover:border-blue-300 hover:bg-gray-50"}`,children:[a?(0,s.jsx)("span",{className:"w-7 h-7 rounded-full bg-gray-200 flex items-center justify-center text-sm font-bold text-gray-600",children:e.title.charAt(0)}):(0,s.jsx)("img",{src:e.icon_url,alt:e.title,className:"w-7 h-7 object-contain",onError:()=>{var s;return s=e.name,void c(e=>new Set(e).add(s))}}),(0,s.jsx)("span",{className:"text-xs text-gray-600 text-center leading-tight font-medium",children:e.title})]},e.name)})}),(0,s.jsx)("p",{className:"text-xs text-gray-400 mt-2",children:"Select an API to pre-fill the spec URL and OAuth 2.0 settings, or enter your own spec URL below."})]})},ez=({form:e,accessToken:t,onValuesChange:r,onKeyToolsChange:l,onLogoUrlChange:a,onOAuthDocsUrlChange:n})=>{let[i,o]=(0,b.useState)(null);return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(eU,{accessToken:t,selectedName:i,onSelect:s=>{o(s.name),l?.(s.key_tools??[]),a?.(s.icon_url||void 0);let t={spec_path:s.spec_url};s.oauth?(t.auth_type=eo.AUTH_TYPE.OAUTH2,t.oauth_flow_type=eo.OAUTH_FLOW.INTERACTIVE,t.authorization_url=s.oauth.authorization_url,t.token_url=s.oauth.token_url,e.setFieldsValue(t),n?.(s.oauth.docs_url??null)):(e.resetFields(["auth_type","authorization_url","token_url"]),e.setFieldsValue(t),n?.(null)),r(t)}}),(0,s.jsx)(D.Form.Item,{label:(0,s.jsxs)("span",{className:"text-sm font-medium text-gray-700 flex items-center",children:["OpenAPI Spec URL",(0,s.jsx)(g.Tooltip,{title:"URL to an OpenAPI specification (JSON or YAML). MCP tools will be automatically generated from the API endpoints defined in the spec.",children:(0,s.jsx)(en.InfoCircleOutlined,{className:"ml-2 text-blue-400 hover:text-blue-600 cursor-help"})})]}),name:"spec_path",rules:[{required:!0,message:"Please enter an OpenAPI spec URL"}],children:(0,s.jsx)(H.Input,{placeholder:"https://petstore3.swagger.io/api/v3/openapi.json",className:"rounded-lg border-gray-300 focus:border-blue-500 focus:ring-blue-500",onChange:()=>{o(null),l?.([]),n?.(null)}})})]})};var eB=e.i(596239);let eq="/ui/assets/logos/",eV=[{name:"GitHub",url:`${eq}github.svg`},{name:"Slack",url:`${eq}slack.svg`},{name:"Notion",url:`${eq}notion.svg`},{name:"Linear",url:`${eq}linear.svg`},{name:"Jira",url:`${eq}jira.svg`},{name:"Figma",url:`${eq}figma.svg`},{name:"Gmail",url:`${eq}gmail.svg`},{name:"Google Drive",url:`${eq}google_drive.svg`},{name:"Stripe",url:`${eq}stripe.svg`},{name:"Shopify",url:`${eq}shopify.svg`},{name:"Salesforce",url:`${eq}salesforce.svg`},{name:"HubSpot",url:`${eq}hubspot.svg`},{name:"Twilio",url:`${eq}twilio.svg`},{name:"Cloudflare",url:`${eq}cloudflare.svg`},{name:"Sentry",url:`${eq}sentry.svg`},{name:"PostgreSQL",url:`${eq}postgresql.svg`},{name:"Snowflake",url:`${eq}snowflake.svg`},{name:"Zapier",url:`${eq}zapier.svg`},{name:"Google",url:`${eq}google.svg`},{name:"GitLab",url:`${eq}gitlab.svg`}],e$=({value:e,onChange:t})=>{let[r,l]=(0,b.useState)(new Set);return(0,s.jsxs)("div",{children:[(0,s.jsxs)("div",{className:"flex items-center gap-2 mb-2",children:[(0,s.jsx)("span",{className:"text-sm font-medium text-gray-700",children:"Logo"}),(0,s.jsx)(g.Tooltip,{title:"Select a well-known logo or paste a URL to any image. The logo is shown on the admin and chat pages.",children:(0,s.jsx)(en.InfoCircleOutlined,{className:"text-blue-400 hover:text-blue-600 cursor-help"})})]}),e&&(0,s.jsxs)("div",{className:"flex items-center gap-3 mb-3 p-3 bg-gray-50 rounded-lg border border-gray-200",children:[(0,s.jsx)("img",{src:e,alt:"Selected logo",className:"w-10 h-10 object-contain rounded",onError:e=>{e.target.style.display="none"}}),(0,s.jsx)("div",{className:"flex-1 min-w-0",children:(0,s.jsx)("div",{className:"text-xs text-gray-500 truncate",children:e})}),(0,s.jsx)("button",{type:"button",onClick:()=>t?.(void 0),className:"text-xs text-gray-400 hover:text-red-500 cursor-pointer bg-transparent border-none",children:"✕"})]}),(0,s.jsx)("div",{className:"grid grid-cols-10 gap-1.5 mb-3",children:eV.map(a=>{let n=e===a.url;return r.has(a.url)?null:(0,s.jsx)(g.Tooltip,{title:a.name,children:(0,s.jsx)("button",{type:"button",onClick:()=>{var s;return s=a.url,void t?.(e===s?void 0:s)},className:`flex items-center justify-center p-2 rounded-lg border transition-all cursor-pointer - ${n?"border-blue-500 bg-blue-50 shadow-sm":"border-gray-200 hover:border-blue-300 hover:bg-gray-50"}`,style:{width:40,height:40},children:(0,s.jsx)("img",{src:a.url,alt:a.name,className:"w-5 h-5 object-contain",onError:()=>{var e;return e=a.url,void l(s=>new Set(s).add(e))}})})},a.name)})}),(0,s.jsx)(H.Input,{prefix:(0,s.jsx)(eB.LinkOutlined,{className:"text-gray-400"}),placeholder:"Or paste a custom logo URL...",value:e&&!eV.some(s=>s.url===e)?e:"",onChange:e=>{let s=e.target.value.trim();t?.(s||void 0)},className:"rounded-lg",size:"small"})]})},eD=e=>{try{let s=e.indexOf("/mcp/");if(-1===s)return{token:null,baseUrl:e};let t=e.split("/mcp/");if(2!==t.length)return{token:null,baseUrl:e};let r=t[0]+"/mcp/",l=t[1];if(!l)return{token:null,baseUrl:e};return{token:l,baseUrl:r}}catch(s){return console.error("Error parsing MCP URL:",s),{token:null,baseUrl:e}}},eH=e=>{let{token:s}=eD(e);return{maskedUrl:(e=>{let{token:s,baseUrl:t}=eD(e);return s?t+"...":e})(e),hasToken:!!s}},eK=e=>e?/^https?:\/\/[^\s/$.?#].[^\s]*$/i.test(e)?Promise.resolve():Promise.reject("Please enter a valid URL (e.g., http://service-name.domain:1234/path or https://example.com)"):Promise.resolve(),eW=e=>e&&(e.includes("-")||e.includes(" "))?Promise.reject("Cannot contain '-' (hyphen) or spaces. Please use '_' (underscore) instead."):Promise.resolve();var eY=e.i(122520);let eJ=e=>{let s=new Uint8Array(e),t="";return s.forEach(e=>t+=String.fromCharCode(e)),btoa(t).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")},eG=async e=>{let s=new TextEncoder().encode(e);return eJ(await window.crypto.subtle.digest("SHA-256",s))},eQ=({accessToken:e,getCredentials:s,getTemporaryPayload:t,onTokenReceived:r,onBeforeRedirect:l})=>{let[a,n]=(0,b.useState)("idle"),[i,o]=(0,b.useState)(null),[c,d]=(0,b.useState)(null),m=(0,b.useRef)(!1),u="litellm-mcp-oauth-flow-state",x="litellm-mcp-oauth-result",p="litellm-mcp-oauth-return-url",h=(e,s)=>{try{window.sessionStorage.setItem(e,s)}catch(s){console.warn(`Failed to set storage item ${e}`,s)}},g=e=>{try{return window.sessionStorage.getItem(e)||window.localStorage.getItem(e)}catch(s){return console.warn(`Failed to get storage item ${e}`,s),null}},f=()=>{try{window.sessionStorage.removeItem(u),window.sessionStorage.removeItem(x),window.sessionStorage.removeItem(p),window.localStorage.removeItem(u),window.localStorage.removeItem(x),window.localStorage.removeItem(p)}catch(e){console.warn("Failed to clear OAuth storage",e)}},j=()=>{let e,s,t;return t=((s=(e=window.location.pathname||"").indexOf("/ui"))>=0?e.slice(0,s+3):"").replace(/\/+$/,""),`${window.location.origin}${t}/mcp/oauth/callback`},y=(0,b.useCallback)(async()=>{let r=s()||{};if(!e){o("Missing admin token"),S.default.error("Access token missing. Please re-authenticate and try again.");return}let a=t();if(!a||!a.url||!a.transport){let e="Please complete server URL and transport before starting OAuth.";o(e),S.default.error(e);return}try{let s;n("authorizing"),o(null);let t=await (0,_.cacheTemporaryMcpServer)(e,a),i=t?.server_id?.trim();if(!i)throw Error("Temporary MCP server identifier missing. Please retry.");let c={};if(!(a.credentials?.client_id&&a.credentials?.client_secret)){let s=await (0,_.registerMcpOAuthClient)(e,i,{client_name:a.alias||a.server_name||i,grant_types:["authorization_code","refresh_token"],response_types:["code"],token_endpoint_auth_method:a.credentials&&a.credentials.client_secret?"client_secret_post":"none"});c={clientId:s?.client_id,clientSecret:s?.client_secret}}let d=(s=new Uint8Array(32),window.crypto.getRandomValues(s),eJ(s.buffer)),m=await eG(d),x=crypto.randomUUID(),g=c.clientId||r.client_id,f=Array.isArray(r.scopes)?r.scopes.filter(e=>e&&e.trim().length>0).join(" "):void 0,b=(0,_.buildMcpOAuthAuthorizeUrl)({serverId:i,clientId:g,redirectUri:j(),state:x,codeChallenge:m,scope:f}),y={state:x,codeVerifier:d,clientId:g,clientSecret:c.clientSecret||r.client_secret,serverId:i,redirectUri:j()};if(l)try{l()}catch(e){console.error("Failed to prepare for OAuth redirect",e)}try{h(u,JSON.stringify(y)),h(p,window.location.href)}catch(e){throw Error("Unable to access browser storage for OAuth. Please enable storage and retry.")}window.location.href=b}catch(s){console.error("Failed to start OAuth flow",s),n("error");let e=(0,eY.extractErrorMessage)(s);o(e),S.default.error(e)}},[e,s,t,l]),v=(0,b.useCallback)(async()=>{if(m.current)return;let e=null,s=null;try{let t=g(x);if(!t)return;m.current=!0,e=JSON.parse(t);let r=g(u);s=r?JSON.parse(r):null}catch(e){f(),m.current=!1,o("Failed to resume OAuth flow. Please retry."),n("error"),S.default.error("Failed to resume OAuth flow. Please retry.");return}if(!e){m.current=!1;return}try{window.sessionStorage.removeItem(x),window.localStorage.removeItem(x)}catch(e){}try{if(!s||!s.state||!s.codeVerifier||!s.serverId)throw Error("OAuth session state was lost. This can happen if you have strict browser privacy settings. Please try again and ensure cookies/storage is enabled.");if(!e.state||e.state!==s.state)throw Error("OAuth state mismatch. Please retry.");if(e.error)throw Error(e.error_description||e.error);if(!e.code)throw Error("Authorization code missing in callback.");n("exchanging");let t=await (0,_.exchangeMcpOAuthToken)({serverId:s.serverId,code:e.code,clientId:s.clientId,clientSecret:s.clientSecret,codeVerifier:s.codeVerifier,redirectUri:s.redirectUri});r(t),d(t),n("success"),o(null),S.default.success("OAuth token retrieved successfully")}catch(s){let e=(0,eY.extractErrorMessage)(s);o(e),n("error"),S.default.error(e)}finally{f(),setTimeout(()=>{m.current=!1},1e3)}},[r]);return(0,b.useEffect)(()=>{v()},[v]),{startOAuthFlow:y,status:a,error:i,tokenResponse:c}},eZ="../ui/assets/logos/mcp_logo.png",eX=[eo.AUTH_TYPE.API_KEY,eo.AUTH_TYPE.BEARER_TOKEN,eo.AUTH_TYPE.TOKEN,eo.AUTH_TYPE.BASIC],e0=[...eX,eo.AUTH_TYPE.OAUTH2,eo.AUTH_TYPE.AWS_SIGV4],e2="litellm-mcp-oauth-create-state",e1=e=>Array.isArray(e)?e.reduce((e,s)=>{let t=s?.header?.trim();return t&&(e[t]=s?.value??""),e},{}):{},e5=({userRole:e,accessToken:r,onCreateSuccess:a,isModalVisible:n,setModalVisible:i,availableAccessGroups:o,prefillData:c,onBackToDiscovery:d})=>{let[m]=D.Form.useForm(),[u,x]=(0,b.useState)(!1),[f,j]=(0,b.useState)({}),[y,v]=(0,b.useState)({}),[N,w]=(0,b.useState)(null),[C,T]=(0,b.useState)(!1),[k,A]=(0,b.useState)([]),[I,P]=(0,b.useState)({}),[O,M]=(0,b.useState)({}),[F,E]=(0,b.useState)(""),[L,R]=(0,b.useState)([]),[U,z]=(0,b.useState)(""),[B,q]=(0,b.useState)(null),[V,$]=(0,b.useState)(void 0),[K,W]=(0,b.useState)(null),{tools:Y,isLoadingTools:J,toolsError:G,toolsErrorStackTrace:Q,canFetchTools:Z,fetchTools:X,clearTools:ee}=ek({accessToken:r,oauthAccessToken:B,formValues:y,enabled:!0}),es=y.auth_type,et=!!es&&eX.includes(es),er=es===eo.AUTH_TYPE.OAUTH2,ec=es===eo.AUTH_TYPE.AWS_SIGV4,ed=er&&y.oauth_flow_type===eo.OAUTH_FLOW.M2M,{startOAuthFlow:eu,status:ex,error:ep,tokenResponse:eh}=eQ({accessToken:r,getCredentials:()=>m.getFieldValue("credentials"),getTemporaryPayload:()=>{let e=m.getFieldsValue(!0),s=e.transport||F,t=e.url||(s===eo.TRANSPORT.OPENAPI?e.spec_path:void 0);if(!t||!s)return null;let r=e1(e.static_headers);return{server_id:void 0,server_name:e.server_name,alias:e.alias,description:e.description,url:t,transport:s===eo.TRANSPORT.OPENAPI?"http":s,auth_type:eo.AUTH_TYPE.OAUTH2,credentials:e.credentials,authorization_url:e.authorization_url,token_url:e.token_url,registration_url:e.registration_url,mcp_access_groups:e.mcp_access_groups,static_headers:r,command:e.command,args:e.args,env:e.env}},onTokenReceived:e=>{if(q(e?.access_token??null),e?.access_token){let s={access_token:e.access_token,...e.refresh_token&&{refresh_token:e.refresh_token},...e.expires_in&&{expires_in:e.expires_in},...e.scope&&{scope:e.scope}};m.setFieldsValue({credentials:s}),S.default.success("OAuth authorization successful! Please click 'Create MCP Server' to save the configuration.")}},onBeforeRedirect:()=>{try{let e=m.getFieldsValue(!0);window.sessionStorage.setItem(e2,JSON.stringify({modalVisible:n,formValues:e,transportType:F,costConfig:f,allowedTools:k,searchValue:U,aliasManuallyEdited:C,logoUrl:V}))}catch(e){console.warn("Failed to persist MCP create state",e)}}});b.default.useEffect(()=>{let e=window.sessionStorage.getItem(e2);if(e)try{let s=JSON.parse(e);s.modalVisible&&i(!0);let t=s.formValues?.transport||s.transportType||"";t&&E(t),s.formValues&&w({values:s.formValues,transport:t}),s.costConfig&&j(s.costConfig),s.allowedTools&&A(s.allowedTools),s.searchValue&&z(s.searchValue),"boolean"==typeof s.aliasManuallyEdited&&T(s.aliasManuallyEdited),s.logoUrl&&$(s.logoUrl)}catch(e){console.error("Failed to restore MCP create state",e)}finally{window.sessionStorage.removeItem(e2)}},[m,i]),b.default.useEffect(()=>{N&&(F||N.transport,(!N.transport||F)&&(m.setFieldsValue(N.values),v(N.values),w(null)))},[N,m,F]),b.default.useEffect(()=>{if(!n||!c)return;let e=(c.name||"").replace(/[^a-zA-Z0-9_]/g,"_").replace(/_+/g,"_").replace(/^_|_$/g,""),s=c.transport||"";E(s);let t={server_name:e,alias:e,description:c.description||"",transport:s};if("stdio"===s){let e={};if(c.command&&(e.command=c.command),c.args&&c.args.length>0&&(e.args=c.args),c.env_vars&&c.env_vars.length>0){let s={};for(let e of c.env_vars)s[e.name]=e.description?`<${e.description}>`:"";e.env=s}Object.keys(e).length>0&&(t.stdio_config=JSON.stringify(e,null,2))}else c.url&&(t.url=c.url);m.setFieldsValue(t),v(t),T(!1)},[n,c,m]);let eg=async e=>{x(!0);try{let{static_headers:s,stdio_config:t,credentials:l,allow_all_keys:n,available_on_public_internet:o,...c}=e,d=c.mcp_access_groups,u=e1(s),x=l&&"object"==typeof l?Object.entries(l).reduce((e,[s,t])=>{if(null==t||""===t)return e;if("scopes"===s){if(Array.isArray(t)){let r=t.filter(e=>null!=e&&""!==e);r.length>0&&(e[s]=r)}}else e[s]=t;return e},{}):void 0,p={};if(t&&"stdio"===F)try{let e=JSON.parse(t),s=e;if(e.mcpServers&&"object"==typeof e.mcpServers){let t=Object.keys(e.mcpServers);if(t.length>0){let r=t[0];s=e.mcpServers[r],c.server_name||(c.server_name=r.replace(/-/g,"_"))}}p={command:s.command,args:s.args,env:s.env},console.log("Parsed stdio config:",p)}catch(e){S.default.fromBackend("Invalid JSON in stdio configuration");return}c.transport===eo.TRANSPORT.OPENAPI&&(c.transport="http");let h={...c,...p,stdio_config:void 0,mcp_info:{server_name:c.server_name||c.url,description:c.description,logo_url:V||void 0,mcp_server_cost_info:Object.keys(f).length>0?f:null},mcp_access_groups:d,alias:c.alias,allowed_tools:k.length>0?k:null,tool_name_to_display_name:Object.keys(I).length>0?I:null,tool_name_to_description:Object.keys(O).length>0?O:null,allow_all_keys:!!n,available_on_public_internet:!!o,static_headers:u};if(h.static_headers=u,c.auth_type&&e0.includes(c.auth_type)&&x&&Object.keys(x).length>0&&(h.credentials=x),console.log(`Payload: ${JSON.stringify(h)}`),null!=r){let e=ej?await (0,_.createMCPServer)(r,h):await (0,_.registerMCPServer)(r,h);S.default.success(ej?"MCP Server created successfully":"MCP Server submitted for admin review"),m.resetFields(),j({}),ee(),A([]),T(!1),$(void 0),i(!1),a(e)}}catch(s){let e=s instanceof Error?s.message:String(s);S.default.fromBackend(ej?`Error creating MCP Server: ${e}`:`Error submitting MCP Server: ${e}`)}finally{x(!1)}},eb=()=>{m.resetFields(),j({}),ee(),A([]),T(!1),$(void 0),i(!1)};b.default.useEffect(()=>{if(!C&&y.server_name){let e=y.server_name.replace(/\s+/g,"_");m.setFieldsValue({alias:e}),v(s=>({...s,alias:e}))}},[y.server_name]),b.default.useEffect(()=>{n||v({})},[n]);let ej=(0,t.isAdminRole)(e);return(0,s.jsx)(p.Modal,{title:(0,s.jsxs)("div",{className:"flex items-center pb-4 border-b border-gray-100",style:{gap:12},children:[d&&(0,s.jsx)("button",{onClick:d,className:"text-sm text-blue-600 hover:text-blue-800 cursor-pointer bg-transparent border-none",style:{flexShrink:0},children:"←"}),(0,s.jsx)("img",{src:eZ,alt:"MCP Logo",className:"w-8 h-8 object-contain",style:{height:"20px",width:"20px",objectFit:"contain"}}),(0,s.jsx)("h2",{className:"text-xl font-semibold text-gray-900",children:ej?"Add New MCP Server":"Submit MCP Server for Review"})]}),open:n,width:1e3,onCancel:eb,footer:null,forceRender:!0,className:"top-8",styles:{body:{padding:"24px"},header:{padding:"24px 24px 0 24px",border:"none"}},children:(0,s.jsx)("div",{className:"mt-6",children:(0,s.jsxs)(D.Form,{form:m,onFinish:eg,onValuesChange:(e,s)=>v(s),layout:"vertical",className:"space-y-6",children:[!ej&&(0,s.jsxs)("div",{className:"rounded-md bg-blue-50 border border-blue-200 px-4 py-3 text-sm text-blue-800",children:["Your submission will be sent for admin review before it becomes active."," ","Note: the request must be made with a team-scoped API key."]}),(0,s.jsxs)("div",{className:"grid grid-cols-1 gap-6",children:[(0,s.jsx)(D.Form.Item,{label:(0,s.jsxs)("span",{className:"text-sm font-medium text-gray-700 flex items-center",children:["MCP Server Name",(0,s.jsx)(g.Tooltip,{title:"Best practice: Use a descriptive name that indicates the server's purpose (e.g., 'GitHub_MCP', 'Email_Service'). Cannot contain spaces or hyphens; use underscores instead. Names must comply with SEP-986 and will be rejected if invalid (https://modelcontextprotocol.io/specification/2025-11-25/server/tools#tool-names).",children:(0,s.jsx)(en.InfoCircleOutlined,{className:"ml-2 text-blue-400 hover:text-blue-600 cursor-help"})})]}),name:"server_name",rules:[{required:!1,message:"Please enter a server name"},{validator:(e,s)=>eW(s)}],children:(0,s.jsx)(ei.TextInput,{placeholder:"e.g., GitHub_MCP, Zapier_MCP, etc.",className:"rounded-lg border-gray-300 focus:border-blue-500 focus:ring-blue-500"})}),(0,s.jsx)(D.Form.Item,{label:(0,s.jsxs)("span",{className:"text-sm font-medium text-gray-700 flex items-center",children:["Alias",(0,s.jsx)(g.Tooltip,{title:"A short, unique identifier for this server. Defaults to the server name if not provided. Cannot contain spaces or hyphens; use underscores instead.",children:(0,s.jsx)(en.InfoCircleOutlined,{className:"ml-2 text-blue-400 hover:text-blue-600 cursor-help"})})]}),name:"alias",rules:[{required:!1},{validator:(e,s)=>eW(s)}],children:(0,s.jsx)(ei.TextInput,{placeholder:"e.g., GitHub_MCP, Zapier_MCP, etc.",className:"rounded-lg border-gray-300 focus:border-blue-500 focus:ring-blue-500",onChange:()=>T(!0)})}),(0,s.jsx)(D.Form.Item,{label:(0,s.jsx)("span",{className:"text-sm font-medium text-gray-700",children:"Description"}),name:"description",rules:[{required:!1,message:"Please enter a server description"}],children:(0,s.jsx)(ei.TextInput,{placeholder:"Brief description of what this server does",className:"rounded-lg border-gray-300 focus:border-blue-500 focus:ring-blue-500"})}),(0,s.jsx)(e$,{value:V,onChange:$}),(0,s.jsx)(D.Form.Item,{label:(0,s.jsx)("span",{className:"text-sm font-medium text-gray-700",children:"GitHub / Source URL"}),name:"source_url",children:(0,s.jsx)(ei.TextInput,{placeholder:"https://github.com/org/mcp-server",className:"rounded-lg border-gray-300 focus:border-blue-500 focus:ring-blue-500"})}),(0,s.jsx)(D.Form.Item,{label:(0,s.jsx)("span",{className:"text-sm font-medium text-gray-700",children:"Transport Type"}),name:"transport",rules:[{required:!0,message:"Please select a transport type"}],children:(0,s.jsxs)(h.Select,{placeholder:"Select transport",className:"rounded-lg",size:"large",onChange:e=>{E(e),"stdio"===e?m.setFieldsValue({url:void 0,spec_path:void 0,auth_type:void 0,credentials:void 0}):e===eo.TRANSPORT.OPENAPI?m.setFieldsValue({url:void 0,command:void 0,args:void 0,env:void 0}):m.setFieldsValue({spec_path:void 0,command:void 0,args:void 0,env:void 0})},value:F,children:[(0,s.jsx)(h.Select.Option,{value:"http",children:"Streamable HTTP (Recommended)"}),(0,s.jsx)(h.Select.Option,{value:"sse",children:"Server-Sent Events (SSE)"}),(0,s.jsx)(h.Select.Option,{value:"stdio",children:"Standard Input/Output (stdio)"}),(0,s.jsx)(h.Select.Option,{value:eo.TRANSPORT.OPENAPI,children:"OpenAPI Spec"})]})}),("http"===F||"sse"===F)&&(0,s.jsx)(D.Form.Item,{label:(0,s.jsx)("span",{className:"text-sm font-medium text-gray-700",children:"MCP Server URL"}),name:"url",rules:[{required:!0,message:"Please enter a server URL"},{validator:(e,s)=>eK(s)}],children:(0,s.jsx)(H.Input,{placeholder:"https://your-mcp-server.com",className:"rounded-lg border-gray-300 focus:border-blue-500 focus:ring-blue-500"})}),F===eo.TRANSPORT.OPENAPI&&(0,s.jsx)(ez,{form:m,accessToken:n?r:null,onValuesChange:e=>v(s=>({...s,...e})),onKeyToolsChange:R,onLogoUrlChange:$,onOAuthDocsUrlChange:W}),F===eo.TRANSPORT.OPENAPI&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(D.Form.Item,{label:(0,s.jsxs)("span",{className:"text-sm font-medium text-gray-700 flex items-center gap-2",children:["BYOK (Bring Your Own Key)",(0,s.jsx)(g.Tooltip,{title:"When enabled, each user provides their own API key for this service. Keys are stored per-user and never shared.",children:(0,s.jsx)(en.InfoCircleOutlined,{className:"text-blue-400 hover:text-blue-600 cursor-help"})})]}),name:"is_byok",valuePropName:"checked",children:(0,s.jsx)(el.Switch,{})}),(0,s.jsx)(D.Form.Item,{noStyle:!0,shouldUpdate:(e,s)=>e.is_byok!==s.is_byok||e.auth_type!==s.auth_type,children:({getFieldValue:e})=>e("is_byok")?(0,s.jsxs)(s.Fragment,{children:[e("auth_type")&&"none"!==e("auth_type")&&(0,s.jsxs)("div",{className:"mb-4 p-3 bg-blue-50 rounded-lg text-sm text-blue-700 flex items-start gap-2",children:[(0,s.jsx)(en.InfoCircleOutlined,{className:"mt-0.5 flex-shrink-0"}),(0,s.jsxs)("span",{children:["User keys will be sent as:"," ",(0,s.jsxs)("code",{className:"font-mono bg-blue-100 px-1 rounded",children:["bearer_token"===e("auth_type")&&"Authorization: Bearer {key}","token"===e("auth_type")&&"Authorization: token {key}","api_key"===e("auth_type")&&"x-api-key: {key}","basic"===e("auth_type")&&"Authorization: Basic {key}","authorization"===e("auth_type")&&"Authorization: {key}"]}),!e("auth_type")&&"Set Authentication Type below to specify the format."]})]}),!e("auth_type")&&(0,s.jsxs)("div",{className:"mb-4 p-3 bg-yellow-50 rounded-lg text-sm text-yellow-700 flex items-start gap-2",children:[(0,s.jsx)(en.InfoCircleOutlined,{className:"mt-0.5 flex-shrink-0"}),(0,s.jsxs)("span",{children:["Set the ",(0,s.jsx)("strong",{children:"Authentication Type"})," below to specify how user keys are sent (e.g., Bearer Token, API Key header)."]})]}),(0,s.jsx)(D.Form.Item,{label:(0,s.jsxs)("span",{className:"text-sm font-medium text-gray-700",children:["Access Description",(0,s.jsx)(g.Tooltip,{title:"List of permissions shown to users in the connection modal (e.g. 'Create and manage Jira issues')",children:(0,s.jsx)(en.InfoCircleOutlined,{className:"ml-2 text-blue-400 hover:text-blue-600 cursor-help"})})]}),name:"byok_description",children:(0,s.jsx)(h.Select,{mode:"tags",placeholder:"Add access description items (press Enter after each)",className:"w-full",tokenSeparators:[","]})}),(0,s.jsx)(D.Form.Item,{label:(0,s.jsxs)("span",{className:"text-sm font-medium text-gray-700",children:["API Key Help URL",(0,s.jsx)(g.Tooltip,{title:"Optional link shown to users to help them find their API key",children:(0,s.jsx)(en.InfoCircleOutlined,{className:"ml-2 text-blue-400 hover:text-blue-600 cursor-help"})})]}),name:"byok_api_key_help_url",children:(0,s.jsx)(H.Input,{placeholder:"https://docs.example.com/api-keys"})})]}):null})]}),"stdio"!==F&&""!==F&&(0,s.jsx)(ea.Collapse,{defaultActiveKey:["auth"],className:"mb-4",items:[{key:"auth",label:(0,s.jsx)("span",{className:"text-sm font-semibold text-gray-700",children:"Authentication"}),children:(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(D.Form.Item,{name:"auth_type",rules:[{required:!0,message:"Please select an auth type"}],children:(0,s.jsxs)(h.Select,{placeholder:"Select auth type",className:"rounded-lg",size:"large",children:[(0,s.jsx)(h.Select.Option,{value:"none",children:"None"}),(0,s.jsx)(h.Select.Option,{value:"api_key",children:"API Key"}),(0,s.jsx)(h.Select.Option,{value:"bearer_token",children:"Bearer Token"}),(0,s.jsx)(h.Select.Option,{value:"token",children:"Token"}),(0,s.jsx)(h.Select.Option,{value:"basic",children:"Basic Auth"}),(0,s.jsx)(h.Select.Option,{value:"oauth2",children:"OAuth"}),(0,s.jsx)(h.Select.Option,{value:"aws_sigv4",children:"AWS SigV4 (Bedrock AgentCore MCPs)"})]})}),et&&(0,s.jsx)(D.Form.Item,{label:(0,s.jsxs)("span",{className:"text-sm font-medium text-gray-700 flex items-center",children:["Authentication Value",(0,s.jsx)(g.Tooltip,{title:"Token, password, or header value to send with each request for the selected auth type.",children:(0,s.jsx)(en.InfoCircleOutlined,{className:"ml-2 text-blue-400 hover:text-blue-600 cursor-help"})})]}),name:["credentials","auth_value"],rules:[{validator:(e,s)=>s&&"string"==typeof s&&""===s.trim()?Promise.reject(Error("Authentication value cannot be empty whitespace")):Promise.resolve()}],children:(0,s.jsx)(ei.TextInput,{type:"password",placeholder:"Enter token or secret",className:"rounded-lg border-gray-300 focus:border-blue-500 focus:ring-blue-500"})}),er&&(0,s.jsx)(em,{isM2M:ed,initialFlowType:eo.OAUTH_FLOW.INTERACTIVE,docsUrl:K,oauthFlow:{startOAuthFlow:eu,status:ex,error:ep,tokenResponse:eh}})]})}]}),"stdio"!==F&&""!==F&&ec&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("p",{className:"text-sm text-gray-500 mb-2",children:["For MCP servers hosted on AWS Bedrock AgentCore."," ",(0,s.jsx)("a",{href:"https://docs.litellm.ai/docs/mcp_aws_sigv4",target:"_blank",rel:"noopener noreferrer",className:"text-blue-500 hover:text-blue-700",children:"View docs →"})]}),(0,s.jsx)(D.Form.Item,{label:(0,s.jsxs)("span",{className:"text-sm font-medium text-gray-700 flex items-center",children:["AWS Region",(0,s.jsx)(g.Tooltip,{title:"AWS region for SigV4 signing (e.g., us-east-1)",children:(0,s.jsx)(en.InfoCircleOutlined,{className:"ml-2 text-blue-400 hover:text-blue-600 cursor-help"})})]}),name:["credentials","aws_region_name"],rules:[{required:!0,message:"AWS region is required for SigV4 auth"}],children:(0,s.jsx)(H.Input,{placeholder:"us-east-1",className:"rounded-lg border-gray-300 focus:border-blue-500 focus:ring-blue-500"})}),(0,s.jsx)(D.Form.Item,{label:(0,s.jsxs)("span",{className:"text-sm font-medium text-gray-700 flex items-center",children:["AWS Service Name",(0,s.jsx)(g.Tooltip,{title:"AWS service name for SigV4 signing. Defaults to 'bedrock-agentcore'.",children:(0,s.jsx)(en.InfoCircleOutlined,{className:"ml-2 text-blue-400 hover:text-blue-600 cursor-help"})})]}),name:["credentials","aws_service_name"],children:(0,s.jsx)(H.Input,{placeholder:"bedrock-agentcore",className:"rounded-lg border-gray-300 focus:border-blue-500 focus:ring-blue-500"})}),(0,s.jsx)(D.Form.Item,{label:(0,s.jsxs)("span",{className:"text-sm font-medium text-gray-700 flex items-center",children:["AWS Access Key ID",(0,s.jsx)(g.Tooltip,{title:"Optional. If not provided, falls back to the boto3 credential chain (IAM role, env vars, etc.).",children:(0,s.jsx)(en.InfoCircleOutlined,{className:"ml-2 text-blue-400 hover:text-blue-600 cursor-help"})})]}),name:["credentials","aws_access_key_id"],dependencies:[["credentials","aws_secret_access_key"]],rules:[({getFieldValue:e})=>({validator:(s,t)=>e(["credentials","aws_secret_access_key"])&&!t?Promise.reject(Error("Access Key ID is required when Secret Access Key is provided")):Promise.resolve()})],children:(0,s.jsx)(H.Input.Password,{placeholder:"AKIA... (optional — uses IAM role if blank)",className:"rounded-lg border-gray-300 focus:border-blue-500 focus:ring-blue-500"})}),(0,s.jsx)(D.Form.Item,{label:(0,s.jsxs)("span",{className:"text-sm font-medium text-gray-700 flex items-center",children:["AWS Secret Access Key",(0,s.jsx)(g.Tooltip,{title:"Optional. Required if AWS Access Key ID is provided.",children:(0,s.jsx)(en.InfoCircleOutlined,{className:"ml-2 text-blue-400 hover:text-blue-600 cursor-help"})})]}),name:["credentials","aws_secret_access_key"],dependencies:[["credentials","aws_access_key_id"]],rules:[({getFieldValue:e})=>({validator:(s,t)=>e(["credentials","aws_access_key_id"])&&!t?Promise.reject(Error("Secret Access Key is required when Access Key ID is provided")):Promise.resolve()})],children:(0,s.jsx)(H.Input.Password,{placeholder:"Enter secret key (optional — uses IAM role if blank)",className:"rounded-lg border-gray-300 focus:border-blue-500 focus:ring-blue-500"})}),(0,s.jsx)(D.Form.Item,{label:(0,s.jsxs)("span",{className:"text-sm font-medium text-gray-700 flex items-center",children:["AWS Session Token",(0,s.jsx)(g.Tooltip,{title:"Optional. Only needed for temporary STS credentials.",children:(0,s.jsx)(en.InfoCircleOutlined,{className:"ml-2 text-blue-400 hover:text-blue-600 cursor-help"})})]}),name:["credentials","aws_session_token"],children:(0,s.jsx)(H.Input.Password,{placeholder:"Enter session token (optional)",className:"rounded-lg border-gray-300 focus:border-blue-500 focus:ring-blue-500"})}),(0,s.jsx)(D.Form.Item,{label:(0,s.jsxs)("span",{className:"text-sm font-medium text-gray-700 flex items-center",children:["AWS Role ARN",(0,s.jsx)(g.Tooltip,{title:"Optional. IAM role ARN to assume via STS before signing. If set, LiteLLM calls sts:AssumeRole to get temporary credentials. Uses ambient credentials (IAM role, env vars) as the source identity unless explicit keys are also provided.",children:(0,s.jsx)(en.InfoCircleOutlined,{className:"ml-2 text-blue-400 hover:text-blue-600 cursor-help"})})]}),name:["credentials","aws_role_name"],children:(0,s.jsx)(H.Input,{placeholder:"arn:aws:iam::123456789012:role/MyRole (optional)",className:"rounded-lg border-gray-300 focus:border-blue-500 focus:ring-blue-500"})}),(0,s.jsx)(D.Form.Item,{label:(0,s.jsxs)("span",{className:"text-sm font-medium text-gray-700 flex items-center",children:["AWS Session Name",(0,s.jsx)(g.Tooltip,{title:"Optional. Session name for the AssumeRole call — appears in CloudTrail logs. Auto-generated if omitted.",children:(0,s.jsx)(en.InfoCircleOutlined,{className:"ml-2 text-blue-400 hover:text-blue-600 cursor-help"})})]}),name:["credentials","aws_session_name"],children:(0,s.jsx)(H.Input,{placeholder:"litellm-prod (optional, auto-generated if blank)",className:"rounded-lg border-gray-300 focus:border-blue-500 focus:ring-blue-500"})})]}),(0,s.jsx)(eO,{isVisible:"stdio"===F})]}),(0,s.jsx)("div",{className:"mt-8",children:(0,s.jsx)(eR,{availableAccessGroups:o,mcpServer:null,searchValue:U,setSearchValue:z,getAccessGroupOptions:()=>{let e=o.map(e=>({value:e,label:(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)("div",{className:"w-2 h-2 bg-green-500 rounded-full"}),(0,s.jsx)("span",{className:"font-medium",children:e})]})}));return U&&!o.some(e=>e.toLowerCase().includes(U.toLowerCase()))&&e.push({value:U,label:(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)("div",{className:"w-2 h-2 bg-blue-500 rounded-full"}),(0,s.jsx)("span",{className:"font-medium",children:U}),(0,s.jsx)("span",{className:"text-gray-400 text-xs ml-1",children:"create new group"})]})}),e}})}),(0,s.jsx)("div",{className:"mt-8 pt-6 border-t border-gray-200",children:(0,s.jsx)(e_,{formValues:y,tools:Y,isLoadingTools:J,toolsError:G,toolsErrorStackTrace:Q,canFetchTools:Z,fetchTools:X})}),(0,s.jsx)("div",{className:"mt-6",children:(0,s.jsx)(eP,{accessToken:r,oauthAccessToken:B,formValues:y,allowedTools:k,existingAllowedTools:null,onAllowedToolsChange:A,toolNameToDisplayName:I,toolNameToDescription:O,onToolNameToDisplayNameChange:P,onToolNameToDescriptionChange:M,keyTools:L,externalTools:Y,externalIsLoading:J,externalError:G,externalCanFetch:Z})}),(0,s.jsx)("div",{className:"mt-6",children:(0,s.jsx)(ef,{value:f,onChange:j,tools:Y.filter(e=>k.includes(e.name)),disabled:!1})}),(0,s.jsxs)("div",{className:"flex items-center justify-end space-x-3 pt-6 border-t border-gray-100",children:[(0,s.jsx)(l.Button,{variant:"secondary",onClick:eb,children:"Cancel"}),(0,s.jsx)(l.Button,{variant:"primary",loading:u,children:u?"Creating...":"Add MCP Server"})]})]})})})};var e4=e.i(175712),e6=e.i(118366),e3=e.i(475254);let e7=(0,e3.default)("code",[["path",{d:"m16 18 6-6-6-6",key:"eg8j8"}],["path",{d:"m8 6-6 6 6 6",key:"ppft3o"}]]);e.s(["Code",()=>e7],758472);let e8=(0,e3.default)("terminal",[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]]),e9=(0,e3.default)("globe",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]]);var se=e.i(634831),ss=e.i(438100);let st=(0,e3.default)("zap",[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]]);var sr=e.i(500330);let{Title:sl,Text:sa}=f.Typography,{Panel:sn}=ea.Collapse,si=({icon:e,title:t,description:r,children:l,serverName:a,accessGroups:n=["dev-group"]})=>{let[i,o]=(0,b.useState)(!1);return(0,s.jsxs)(e4.Card,{className:"border border-gray-200",children:[(0,s.jsxs)("div",{className:"flex items-center gap-3 mb-3",children:[(0,s.jsx)("span",{className:"p-2 rounded-lg bg-gray-50",children:e}),(0,s.jsxs)("div",{children:[(0,s.jsx)(sl,{level:5,className:"mb-0",children:t}),(0,s.jsx)(sa,{className:"text-gray-600",children:r})]})]}),a&&("Implementation Example"===t||"Configuration"===t)&&(0,s.jsxs)(D.Form.Item,{className:"mb-4",children:[(0,s.jsxs)("div",{className:"flex items-center gap-2 mb-2",children:[(0,s.jsx)(el.Switch,{size:"small",checked:i,onChange:o}),(0,s.jsxs)(sa,{className:"text-sm",children:["Limit tools to specific MCP servers or MCP groups by passing the ",(0,s.jsx)("code",{children:"x-mcp-servers"})," header"]})]}),i&&(0,s.jsx)(ej.Alert,{className:"mt-2",type:"info",showIcon:!0,message:"Two Options",description:(0,s.jsxs)("div",{children:[(0,s.jsxs)("p",{children:[(0,s.jsx)("strong",{children:"Option 1:"})," Get a specific server: ",(0,s.jsxs)("code",{children:['"',a.replace(/\s+/g,"_"),'"']})]}),(0,s.jsxs)("p",{children:[(0,s.jsx)("strong",{children:"Option 2:"})," Get a group of MCPs: ",(0,s.jsx)("code",{children:'"dev-group"'})]}),(0,s.jsxs)("p",{className:"mt-2 text-sm text-gray-600",children:["You can also mix both: ",(0,s.jsx)("code",{children:'"Server1,dev-group"'})]})]})})]}),b.default.Children.map(l,e=>{if(b.default.isValidElement(e)&&e.props.hasOwnProperty("code")&&e.props.hasOwnProperty("copyKey")){let s=e.props.code;if(s&&s.includes('"headers":'))return b.default.cloneElement(e,{code:s.replace(/"headers":\s*{[^}]*}/,`"headers": ${JSON.stringify((()=>{let e={"x-litellm-api-key":"Bearer YOUR_LITELLM_API_KEY"};if(i&&a){let s=[a.replace(/\s+/g,"_"),...n].join(",");e["x-mcp-servers"]=s}return e})(),null,8)}`)})}return e})]})},so=({currentServerAccessGroups:e=[]})=>{let t=(0,_.getProxyBaseUrl)(),[r,l]=(0,b.useState)({}),[u,x]=(0,b.useState)({openai:[],litellm:[],cursor:[],http:[]}),[p]=(0,b.useState)("Zapier_MCP"),h=async(e,s)=>{await (0,sr.copyToClipboard)(e)&&(l(e=>({...e,[s]:!0})),setTimeout(()=>{l(e=>({...e,[s]:!1}))},2e3))},g=({code:e,copyKey:t,title:l,className:a=""})=>(0,s.jsxs)("div",{className:"relative group",children:[l&&(0,s.jsxs)("div",{className:"flex items-center gap-2 mb-2",children:[(0,s.jsx)(e7,{size:16,className:"text-blue-600"}),(0,s.jsx)(sa,{strong:!0,className:"text-gray-700",children:l})]}),(0,s.jsxs)(e4.Card,{className:`bg-gray-50 border border-gray-200 relative ${a}`,children:[(0,s.jsx)(eb.Button,{type:"text",size:"small",icon:r[t]?(0,s.jsx)(k.CheckIcon,{size:12}):(0,s.jsx)(e6.CopyIcon,{size:12}),onClick:()=>h(e,t),className:`absolute top-2 right-2 z-10 transition-all duration-200 ${r[t]?"text-green-600 bg-green-50 border-green-200":"text-gray-500 hover:text-gray-700 hover:bg-gray-100"}`}),(0,s.jsx)("pre",{className:"text-sm overflow-x-auto pr-10 text-gray-800 font-mono leading-relaxed",children:e})]})]}),f=({step:e,title:t,children:r})=>(0,s.jsxs)("div",{className:"flex gap-4",children:[(0,s.jsx)("div",{className:"flex-shrink-0",children:(0,s.jsx)("div",{className:"w-8 h-8 bg-blue-600 text-white rounded-full flex items-center justify-center text-sm font-semibold",children:e})}),(0,s.jsxs)("div",{className:"flex-1",children:[(0,s.jsx)(sa,{strong:!0,className:"text-gray-800 block mb-2",children:t}),r]})]});return(0,s.jsx)("div",{children:(0,s.jsxs)(eM.Space,{direction:"vertical",size:"large",className:"w-full",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)(m.Title,{className:"text-3xl font-bold text-gray-900 mb-3",children:"Connect to your MCP client"}),(0,s.jsx)(d.Text,{className:"text-lg text-gray-600",children:"Use tools directly from any MCP client with LiteLLM MCP. Enable your AI assistant to perform real-world tasks through a simple, secure connection."})]}),(0,s.jsxs)(n.TabGroup,{className:"w-full",children:[(0,s.jsx)(i.TabList,{className:"flex justify-start mt-8 mb-6",children:(0,s.jsxs)("div",{className:"flex bg-gray-100 p-1 rounded-lg",children:[(0,s.jsx)(a.Tab,{className:"px-6 py-3 rounded-md transition-all duration-200",children:(0,s.jsxs)("span",{className:"flex items-center gap-2 font-medium",children:[(0,s.jsx)(e7,{size:18}),"OpenAI API"]})}),(0,s.jsx)(a.Tab,{className:"px-6 py-3 rounded-md transition-all duration-200",children:(0,s.jsxs)("span",{className:"flex items-center gap-2 font-medium",children:[(0,s.jsx)(st,{size:18}),"LiteLLM Proxy"]})}),(0,s.jsx)(a.Tab,{className:"px-6 py-3 rounded-md transition-all duration-200",children:(0,s.jsxs)("span",{className:"flex items-center gap-2 font-medium",children:[(0,s.jsx)(e8,{size:18}),"Cursor"]})}),(0,s.jsx)(a.Tab,{className:"px-6 py-3 rounded-md transition-all duration-200",children:(0,s.jsxs)("span",{className:"flex items-center gap-2 font-medium",children:[(0,s.jsx)(e9,{size:18}),"Streamable HTTP"]})})]})}),(0,s.jsxs)(c.TabPanels,{children:[(0,s.jsx)(o.TabPanel,{className:"mt-6",children:(0,s.jsx)(()=>(0,s.jsxs)(eM.Space,{direction:"vertical",size:"large",className:"w-full",children:[(0,s.jsxs)("div",{className:"bg-gradient-to-r from-blue-50 to-indigo-50 p-6 rounded-lg border border-blue-100",children:[(0,s.jsxs)("div",{className:"flex items-center gap-3 mb-3",children:[(0,s.jsx)(e7,{className:"text-blue-600",size:24}),(0,s.jsx)(sl,{level:4,className:"mb-0 text-blue-900",children:"OpenAI Responses API Integration"})]}),(0,s.jsx)(sa,{className:"text-blue-700",children:"Connect OpenAI Responses API to your LiteLLM MCP server for seamless tool integration"})]}),(0,s.jsxs)(eM.Space,{direction:"vertical",size:"large",className:"w-full",children:[(0,s.jsx)(si,{icon:(0,s.jsx)(ss.KeyIcon,{className:"text-blue-600",size:16}),title:"API Key Setup",description:"Configure your OpenAI API key for authentication",children:(0,s.jsxs)(eM.Space,{direction:"vertical",size:"middle",className:"w-full",children:[(0,s.jsx)("div",{children:(0,s.jsxs)(sa,{children:["Get your API key from the"," ",(0,s.jsxs)("a",{href:"https://platform.openai.com/api-keys",target:"_blank",rel:"noopener noreferrer",className:"text-blue-600 hover:text-blue-700 inline-flex items-center gap-1",children:["OpenAI platform ",(0,s.jsx)(se.ExternalLinkIcon,{size:12})]})]})}),(0,s.jsx)(g,{title:"Environment Variable",code:'export OPENAI_API_KEY="sk-..."',copyKey:"openai-env"})]})}),(0,s.jsx)(si,{icon:(0,s.jsx)(P.ServerIcon,{className:"text-blue-600",size:16}),title:"MCP Server Information",description:"Connection details for your LiteLLM MCP server",children:(0,s.jsx)(g,{title:"Server URL",code:`${t}/mcp`,copyKey:"openai-server-url"})}),(0,s.jsx)(si,{icon:(0,s.jsx)(e7,{className:"text-blue-600",size:16}),title:"Implementation Example",description:"Complete cURL example for using the Responses API",serverName:"Zapier Gmail",accessGroups:["dev-group"],children:(0,s.jsx)(g,{code:`curl --location 'https://api.openai.com/v1/responses' \\ ---header 'Content-Type: application/json' \\ ---header "Authorization: Bearer $OPENAI_API_KEY" \\ ---data '{ - "model": "gpt-4.1", - "tools": [ - { - "type": "mcp", - "server_label": "litellm", - "server_url": "${t}/mcp", - "require_approval": "never", - "headers": { - "x-litellm-api-key": "Bearer YOUR_LITELLM_API_KEY", - "x-mcp-servers": "Zapier_MCP,dev-group" - } - } - ], - "input": "Run available tools", - "tool_choice": "required" -}'`,copyKey:"openai-curl",className:"text-xs"})})]})]}),{})}),(0,s.jsx)(o.TabPanel,{className:"mt-6",children:(0,s.jsx)(()=>(0,s.jsxs)(eM.Space,{direction:"vertical",size:"large",className:"w-full",children:[(0,s.jsxs)("div",{className:"bg-gradient-to-r from-emerald-50 to-green-50 p-6 rounded-lg border border-emerald-100",children:[(0,s.jsxs)("div",{className:"flex items-center gap-3 mb-3",children:[(0,s.jsx)(st,{className:"text-emerald-600",size:24}),(0,s.jsx)(sl,{level:4,className:"mb-0 text-emerald-900",children:"LiteLLM Proxy API Integration"})]}),(0,s.jsx)(sa,{className:"text-emerald-700",children:"Connect to LiteLLM Proxy Responses API for seamless tool integration with multiple model providers"})]}),(0,s.jsxs)(eM.Space,{direction:"vertical",size:"large",className:"w-full",children:[(0,s.jsx)(si,{icon:(0,s.jsx)(ss.KeyIcon,{className:"text-emerald-600",size:16}),title:"Virtual Key Setup",description:"Configure your LiteLLM Proxy Virtual Key for authentication",children:(0,s.jsxs)(eM.Space,{direction:"vertical",size:"middle",className:"w-full",children:[(0,s.jsx)("div",{children:(0,s.jsx)(sa,{children:"Get your Virtual Key from your LiteLLM Proxy dashboard or contact your administrator"})}),(0,s.jsx)(g,{title:"Environment Variable",code:'export LITELLM_API_KEY="sk-..."',copyKey:"litellm-env"})]})}),(0,s.jsx)(si,{icon:(0,s.jsx)(P.ServerIcon,{className:"text-emerald-600",size:16}),title:"MCP Server Information",description:"Connection details for your LiteLLM MCP server",children:(0,s.jsx)(g,{title:"Server URL",code:`${t}/mcp`,copyKey:"litellm-server-url"})}),(0,s.jsx)(si,{icon:(0,s.jsx)(e7,{className:"text-emerald-600",size:16}),title:"Implementation Example",description:"Complete cURL example for using the LiteLLM Proxy Responses API",serverName:p,accessGroups:["dev-group"],children:(0,s.jsx)(g,{code:`curl --location '${t}/v1/responses' \\ ---header 'Content-Type: application/json' \\ ---header "Authorization: Bearer $LITELLM_VIRTUAL_KEY" \\ ---data '{ - "model": "gpt-4", - "tools": [ - { - "type": "mcp", - "server_label": "litellm", - "server_url": "litellm_proxy", - "require_approval": "never", - "headers": { - "x-litellm-api-key": "Bearer YOUR_LITELLM_VIRTUAL_KEY", - "x-mcp-servers": "Zapier_MCP,dev-group" - } - } - ], - "input": "Run available tools", - "tool_choice": "required" -}'`,copyKey:"litellm-curl",className:"text-xs"})})]})]}),{})}),(0,s.jsx)(o.TabPanel,{className:"mt-6",children:(0,s.jsx)(()=>(0,s.jsxs)(eM.Space,{direction:"vertical",size:"large",className:"w-full",children:[(0,s.jsxs)("div",{className:"bg-gradient-to-r from-purple-50 to-blue-50 p-6 rounded-lg border border-purple-100",children:[(0,s.jsxs)("div",{className:"flex items-center gap-3 mb-3",children:[(0,s.jsx)(e8,{className:"text-purple-600",size:24}),(0,s.jsx)(sl,{level:4,className:"mb-0 text-purple-900",children:"Cursor IDE Integration"})]}),(0,s.jsx)(sa,{className:"text-purple-700",children:"Use tools directly from Cursor IDE with LiteLLM MCP. Enable your AI assistant to perform real-world tasks without leaving your coding environment."})]}),(0,s.jsxs)(e4.Card,{className:"border border-gray-200",children:[(0,s.jsx)(sl,{level:5,className:"mb-4 text-gray-800",children:"Setup Instructions"}),(0,s.jsxs)(eM.Space,{direction:"vertical",size:"large",className:"w-full",children:[(0,s.jsx)(f,{step:1,title:"Open Cursor Settings",children:(0,s.jsxs)(sa,{className:"text-gray-600",children:["Use the keyboard shortcut ",(0,s.jsx)("code",{className:"bg-gray-100 px-2 py-1 rounded",children:"⇧+⌘+J"})," (Mac) or"," ",(0,s.jsx)("code",{className:"bg-gray-100 px-2 py-1 rounded",children:"Ctrl+Shift+J"})," (Windows/Linux)"]})}),(0,s.jsx)(f,{step:2,title:"Navigate to MCP Tools",children:(0,s.jsx)(sa,{className:"text-gray-600",children:'Go to the "MCP Tools" tab and click "New MCP Server"'})}),(0,s.jsxs)(f,{step:3,title:"Add Configuration",children:[(0,s.jsxs)(sa,{className:"text-gray-600 mb-3",children:["Copy the JSON configuration below and paste it into Cursor, then save with"," ",(0,s.jsx)("code",{className:"bg-gray-100 px-2 py-1 rounded",children:"Cmd+S"})," or"," ",(0,s.jsx)("code",{className:"bg-gray-100 px-2 py-1 rounded",children:"Ctrl+S"})]}),(0,s.jsx)(si,{icon:(0,s.jsx)(e7,{className:"text-purple-600",size:16}),title:"Configuration",description:"Cursor MCP configuration",serverName:"Zapier Gmail",accessGroups:["dev-group"],children:(0,s.jsx)(g,{code:`{ - "mcpServers": { - "Zapier_MCP": { - "url": "${t}/mcp", - "headers": { - "x-litellm-api-key": "Bearer YOUR_LITELLM_API_KEY", - "x-mcp-servers": "Zapier_MCP,dev-group" - } - } - } -}`,copyKey:"cursor-config",className:"text-xs"})})]})]})]})]}),{})}),(0,s.jsx)(o.TabPanel,{className:"mt-6",children:(0,s.jsx)(()=>(0,s.jsxs)(eM.Space,{direction:"vertical",size:"large",className:"w-full",children:[(0,s.jsxs)("div",{className:"bg-gradient-to-r from-green-50 to-teal-50 p-6 rounded-lg border border-green-100",children:[(0,s.jsxs)("div",{className:"flex items-center gap-3 mb-3",children:[(0,s.jsx)(e9,{className:"text-green-600",size:24}),(0,s.jsx)(sl,{level:4,className:"mb-0 text-green-900",children:"Streamable HTTP Transport"})]}),(0,s.jsx)(sa,{className:"text-green-700",children:"Connect to LiteLLM MCP using HTTP transport. Compatible with any MCP client that supports HTTP streaming."})]}),(0,s.jsx)(si,{icon:(0,s.jsx)(e9,{className:"text-green-600",size:16}),title:"Universal MCP Connection",description:"Use this URL with any MCP client that supports HTTP transport",children:(0,s.jsxs)(eM.Space,{direction:"vertical",size:"middle",className:"w-full",children:[(0,s.jsx)("div",{children:(0,s.jsx)(sa,{children:"Each MCP client supports different transports. Refer to your client documentation to determine the appropriate transport method."})}),(0,s.jsx)(g,{title:"Server URL",code:`${t}/mcp`,copyKey:"http-server-url"}),(0,s.jsx)(g,{title:"Headers Configuration",code:JSON.stringify({"x-litellm-api-key":"Bearer YOUR_LITELLM_API_KEY"},null,2),copyKey:"http-headers"}),(0,s.jsx)("div",{className:"mt-4",children:(0,s.jsx)(eb.Button,{type:"link",className:"p-0 h-auto text-blue-600 hover:text-blue-700",href:"https://modelcontextprotocol.io/docs/concepts/transports",icon:(0,s.jsx)(se.ExternalLinkIcon,{size:14}),children:"Learn more about MCP transports"})})]})})]}),{})})]})]})]})})};var sc=e.i(752978),sd=e.i(591935),sm=e.i(492030);let su=({server:e,isLoadingHealth:t,isRechecking:r,onRecheck:l})=>{let[a,n]=(0,b.useState)(!1),i=e.status||"unknown",o=e.last_health_check,c=e.health_check_error;if(t||r)return(0,s.jsxs)("span",{className:"inline-flex items-center gap-1.5 text-xs text-gray-400 px-2 py-0.5 rounded-full bg-gray-50 border border-gray-100",children:[(0,s.jsx)("span",{className:"h-1.5 w-1.5 rounded-full bg-gray-300 animate-pulse"}),"Checking"]});let d=!!l,m=(0,s.jsxs)("div",{className:"max-w-xs",children:[(0,s.jsxs)("div",{className:"font-semibold mb-1",children:["Health Status: ",i]}),o&&(0,s.jsxs)("div",{className:"text-xs mb-1",children:["Last Check: ",new Date(o).toLocaleString()]}),c&&(0,s.jsxs)("div",{className:"text-xs",children:[(0,s.jsx)("div",{className:"font-medium text-red-400 mb-1",children:"Error:"}),(0,s.jsx)("div",{className:"break-words",children:c})]}),!o&&!c&&(0,s.jsx)("div",{className:"text-xs text-gray-400",children:"No health check data available"}),d&&(0,s.jsx)("div",{className:"text-xs text-gray-400 mt-1",children:"Click to recheck"})]});return(0,s.jsx)(g.Tooltip,{title:m,placement:"top",children:(0,s.jsxs)("span",{className:`inline-flex items-center gap-1 text-xs font-medium px-2 py-0.5 rounded-full ${(e=>{switch(e){case"healthy":return"text-green-700 bg-green-50 border border-green-200";case"unhealthy":return"text-red-700 bg-red-50 border border-red-200";default:return"text-gray-600 bg-gray-50 border border-gray-200"}})(i)} ${d?"cursor-pointer hover:opacity-80":"cursor-default"}`,onMouseEnter:()=>n(!0),onMouseLeave:()=>n(!1),onClick:d?()=>l(e.server_id):void 0,children:[(0,s.jsx)("span",{children:a&&d?"↻":(e=>{switch(e){case"healthy":return"✓";case"unhealthy":return"✗";default:return"?"}})(i)}),a&&d?"Recheck":i.charAt(0).toUpperCase()+i.slice(1)]})})};var sx=e.i(530212),sp=e.i(848725);let sh=b.forwardRef(function(e,s){return b.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:s},e),b.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M13.875 18.825A10.05 10.05 0 0112 19c-4.478 0-8.268-2.943-9.543-7a9.97 9.97 0 011.563-3.029m5.858.908a3 3 0 114.243 4.243M9.878 9.878l4.242 4.242M9.88 9.88l-3.29-3.29m7.532 7.532l3.29 3.29M3 3l3.59 3.59m0 0A9.953 9.953 0 0112 5c4.478 0 8.268 2.943 9.543 7a10.025 10.025 0 01-4.132 5.411m0 0L21 21"}))});var sg=e.i(350967),sf=e.i(954616);function sb(e){if(!e)return[];if(Array.isArray(e))return e.map(e=>sj(e)).filter(e=>void 0!==e);let s=sj(e);return void 0===s?[]:[s]}function sj(e,s){if(!e)return;let t=void 0!==s?s:e.default;if("object"===e.type){let s="object"!=typeof t||null===t||Array.isArray(t)?{}:{...t};return e.properties&&Object.entries(e.properties).forEach(([e,t])=>{s[e]=sj(t,s[e])}),s}if("array"===e.type){if(Array.isArray(t)){let s=e.items;if(!s)return t;if(0===t.length){let e=sb(s);return e.length?e:t}return Array.isArray(s)?t.map((e,t)=>sj(s[t]??s[s.length-1],e)):t.map(e=>sj(s,e))}return void 0!==t?t:sb(e.items)}if(void 0!==t)return t;switch(e.type){case"integer":case"number":return 0;case"boolean":return!1;default:return""}}let sy=e=>{let s=sj(e);if("object"===e.type||"array"===e.type){let t="array"===e.type?[]:{};return JSON.stringify(s??t,null,2)}return s};function sv({tool:e,onSubmit:t,isLoading:r,result:a,error:n,onClose:i}){let[o]=D.Form.useForm(),[c,d]=b.default.useState("formatted"),[m,u]=b.default.useState(null),[x,p]=b.default.useState(null),h=b.default.useMemo(()=>"string"==typeof e.inputSchema?{type:"object",properties:{input:{type:"string",description:"Input for this tool"}},required:["input"]}:e.inputSchema,[e.inputSchema]),f=b.default.useMemo(()=>h.properties&&h.properties.params&&"object"===h.properties.params.type&&h.properties.params.properties?{type:"object",properties:h.properties.params.properties,required:h.properties.params.required||[]}:h,[h]);b.default.useEffect(()=>{if(o.resetFields(),!f.properties)return;let e={};Object.entries(f.properties).forEach(([s,t])=>{e[s]=sy(t)}),o.setFieldsValue(e)},[o,f,e]),b.default.useEffect(()=>{m&&(a||n)&&p(Date.now()-m)},[a,n,m]);let j=async e=>{try{if(navigator.clipboard&&window.isSecureContext)return await navigator.clipboard.writeText(e),!0;{let s=document.createElement("textarea");s.value=e,s.style.position="fixed",s.style.opacity="0",document.body.appendChild(s),s.focus(),s.select();let t=document.execCommand("copy");if(document.body.removeChild(s),!t)throw Error("execCommand failed");return!0}}catch(e){return console.error("Copy failed:",e),!1}},y=async()=>{await j(JSON.stringify(a,null,2))?S.default.success("Result copied to clipboard"):S.default.fromBackend("Failed to copy result")},v=async()=>{await j(e.name)?S.default.success("Tool name copied to clipboard"):S.default.fromBackend("Failed to copy tool name")};return(0,s.jsxs)("div",{className:"space-y-4 h-full",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between pb-3 border-b border-gray-200",children:[(0,s.jsxs)("div",{className:"flex items-center space-x-3",children:[e.mcp_info.logo_url&&(0,s.jsx)("img",{src:e.mcp_info.logo_url,alt:`${e.mcp_info.server_name} logo`,className:"w-6 h-6 object-contain"}),(0,s.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,s.jsxs)("div",{className:"flex items-center space-x-2 mb-1",children:[(0,s.jsx)("h2",{className:"text-lg font-semibold text-gray-900",children:"Test Tool:"}),(0,s.jsxs)("div",{className:"group inline-flex items-center space-x-1 bg-slate-50 hover:bg-slate-100 px-3 py-1 rounded-md cursor-pointer transition-colors border border-slate-200",onClick:v,title:"Click to copy tool name",children:[(0,s.jsx)("span",{className:"font-mono text-slate-700 font-medium text-sm",children:e.name}),(0,s.jsx)("svg",{className:"w-3 h-3 text-slate-400 group-hover:text-slate-600 transition-colors",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,s.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z"})})]})]}),(0,s.jsx)("p",{className:"text-xs text-gray-600",children:e.description}),(0,s.jsxs)("p",{className:"text-xs text-gray-500",children:["Provider: ",e.mcp_info.server_name]})]})]}),(0,s.jsx)(l.Button,{onClick:i,variant:"light",size:"sm",className:"text-gray-500 hover:text-gray-700",children:(0,s.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,s.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),(0,s.jsxs)("div",{className:"grid grid-cols-2 gap-4 h-full",children:[(0,s.jsxs)("div",{className:"bg-white border border-gray-200 rounded-lg",children:[(0,s.jsx)("div",{className:"border-b border-gray-100 px-4 py-2",children:(0,s.jsxs)("div",{className:"flex items-center justify-between",children:[(0,s.jsx)("h3",{className:"text-sm font-semibold text-gray-900",children:"Input Parameters"}),(0,s.jsx)(g.Tooltip,{title:"Configure the input parameters for this tool call",children:(0,s.jsx)(en.InfoCircleOutlined,{className:"text-gray-400 hover:text-gray-600"})})]})}),(0,s.jsx)("div",{className:"p-4",children:(0,s.jsxs)(D.Form,{form:o,onFinish:e=>{u(Date.now()),p(null);let s={};Object.entries(e).forEach(([e,t])=>{let r=f.properties?.[e];if(r&&null!=t&&""!==t)switch(r.type){case"boolean":s[e]="true"===t||!0===t;break;case"number":case"integer":{let l=Number(t);s[e]=Number.isNaN(l)?t:"integer"===r.type?Math.trunc(l):l;break}case"object":case"array":try{let l="string"==typeof t?JSON.parse(t):t,a="object"===r.type&&null!==l&&"object"==typeof l&&!Array.isArray(l),n="array"===r.type&&Array.isArray(l);"object"===r.type&&a||"array"===r.type&&n?s[e]=l:s[e]=t}catch(r){s[e]=t}break;case"string":s[e]=String(t);break;default:s[e]=t}else null!=t&&""!==t&&(s[e]=t)}),t(h.properties&&h.properties.params&&"object"===h.properties.params.type&&h.properties.params.properties?{params:s}:s)},layout:"vertical",className:"space-y-3",children:["string"==typeof e.inputSchema?(0,s.jsx)("div",{className:"space-y-3",children:(0,s.jsx)(D.Form.Item,{label:(0,s.jsxs)("span",{className:"text-sm font-medium text-gray-700",children:["Input ",(0,s.jsx)("span",{className:"text-red-500",children:"*"})]}),name:"input",rules:[{required:!0,message:"Please enter input for this tool"}],className:"mb-3",children:(0,s.jsx)(ei.TextInput,{placeholder:"Enter input for this tool",className:"rounded-lg border-gray-300 focus:border-blue-500 focus:ring-blue-500"})})}):void 0===f.properties?(0,s.jsx)("div",{className:"text-center py-6 bg-gray-50 rounded-lg border border-gray-200",children:(0,s.jsxs)("div",{className:"max-w-sm mx-auto",children:[(0,s.jsx)("h4",{className:"text-sm font-medium text-gray-900 mb-1",children:"No Parameters Required"}),(0,s.jsx)("p",{className:"text-xs text-gray-500",children:"This tool can be called without any input parameters."})]})}):(0,s.jsx)("div",{className:"space-y-3",children:Object.entries(f.properties).map(([t,r])=>{let l=sy(r),a=`${e.name}-${t}`;return(0,s.jsxs)(D.Form.Item,{label:(0,s.jsxs)("span",{className:"text-sm font-medium text-gray-700 flex items-center",children:[t," ",f.required?.includes(t)&&(0,s.jsx)("span",{className:"text-red-500",children:"*"}),r.description&&(0,s.jsx)(g.Tooltip,{title:r.description,children:(0,s.jsx)(en.InfoCircleOutlined,{className:"ml-2 text-gray-400 hover:text-gray-600"})})]}),name:t,initialValue:l,rules:[{required:f.required?.includes(t),message:`Please enter ${t}`},..."object"===r.type||"array"===r.type?[{validator:(e,s)=>{if((null==s||""===s)&&!f.required?.includes(t))return Promise.resolve();try{let e="string"==typeof s?JSON.parse(s):s,t="object"===r.type&&null!==e&&"object"==typeof e&&!Array.isArray(e),l="array"===r.type&&Array.isArray(e);if("object"===r.type&&t||"array"===r.type&&l)return Promise.resolve();return Promise.reject(Error("object"===r.type?"Please enter a JSON object":"Please enter a JSON array"))}catch(e){return Promise.reject(Error("Invalid JSON"))}}}]:[]],className:"mb-3",children:["string"===r.type&&r.enum&&(0,s.jsxs)("select",{className:"w-full px-3 py-2 border border-gray-300 rounded-lg shadow-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500 text-sm transition-colors",defaultValue:l??"",children:[!f.required?.includes(t)&&(0,s.jsxs)("option",{value:"",children:["Select ",t]}),r.enum.map(e=>(0,s.jsx)("option",{value:e,children:e},e))]}),"string"===r.type&&!r.enum&&(0,s.jsx)(ei.TextInput,{placeholder:r.description||`Enter ${t}`,defaultValue:l??"",className:"rounded-lg border-gray-300 focus:border-blue-500 focus:ring-blue-500"}),("number"===r.type||"integer"===r.type)&&(0,s.jsx)("input",{type:"number",step:"integer"===r.type?1:"any",placeholder:r.description||`Enter ${t}`,defaultValue:l??0,className:"w-full px-3 py-2 border border-gray-300 rounded-lg shadow-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500 text-sm transition-colors"}),"boolean"===r.type&&(0,s.jsxs)("select",{className:"w-full px-3 py-2 border border-gray-300 rounded-lg shadow-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500 text-sm transition-colors",defaultValue:(l??!1).toString(),children:[!f.required?.includes(t)&&(0,s.jsxs)("option",{value:"",children:["Select ",t]}),(0,s.jsx)("option",{value:"true",children:"True"}),(0,s.jsx)("option",{value:"false",children:"False"})]}),("object"===r.type||"array"===r.type)&&(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)("textarea",{rows:"object"===r.type?6:4,placeholder:r.description||("object"===r.type?`Enter JSON object for ${t}`:`Enter JSON array for ${t}`),defaultValue:l??("object"===r.type?"{}":"[]"),spellCheck:!1,"data-testid":`textarea-${t}`,className:"w-full px-3 py-2 border border-gray-300 rounded-lg shadow-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500 text-sm font-mono"}),(0,s.jsx)("p",{className:"text-xs text-gray-500",children:"object"===r.type?"Provide a valid JSON object.":"Provide a valid JSON array."})]})]},a)})}),(0,s.jsx)("div",{className:"pt-3 border-t border-gray-100",children:(0,s.jsx)(l.Button,{onClick:()=>o.submit(),disabled:r,variant:"primary",className:"w-full",loading:r,children:r?"Calling Tool...":a||n?"Call Again":"Call Tool"})})]})})]}),(0,s.jsxs)("div",{className:"bg-white border border-gray-200 rounded-lg",children:[(0,s.jsx)("div",{className:"border-b border-gray-100 px-4 py-2",children:(0,s.jsx)("h3",{className:"text-sm font-semibold text-gray-900",children:"Tool Result"})}),(0,s.jsx)("div",{className:"p-4",children:a||n||r?(0,s.jsxs)("div",{className:"space-y-3",children:[a&&!r&&!n&&(0,s.jsx)("div",{className:"p-2 bg-green-50 border border-green-200 rounded-lg",children:(0,s.jsxs)("div",{className:"flex items-center justify-between",children:[(0,s.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,s.jsx)("svg",{className:"h-4 w-4 text-green-500",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:(0,s.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z"})}),(0,s.jsx)("h4",{className:"text-xs font-medium text-green-900",children:"Tool executed successfully"}),null!==x&&(0,s.jsxs)("span",{className:"text-xs text-green-600 ml-1",children:["• ",(x/1e3).toFixed(2),"s"]})]}),(0,s.jsxs)("div",{className:"flex items-center space-x-1",children:[(0,s.jsxs)("div",{className:"flex bg-white rounded border border-green-300 p-0.5",children:[(0,s.jsx)("button",{onClick:()=>d("formatted"),className:`px-2 py-1 text-xs font-medium rounded transition-colors ${"formatted"===c?"bg-green-100 text-green-800":"text-green-600 hover:text-green-800"}`,children:"Formatted"}),(0,s.jsx)("button",{onClick:()=>d("json"),className:`px-2 py-1 text-xs font-medium rounded transition-colors ${"json"===c?"bg-green-100 text-green-800":"text-green-600 hover:text-green-800"}`,children:"JSON"})]}),(0,s.jsx)("button",{onClick:y,className:"p-1 hover:bg-green-100 rounded text-green-700",title:"Copy response",children:(0,s.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,s.jsx)("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2"}),(0,s.jsx)("path",{d:"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"})]})})]})]})}),(0,s.jsxs)("div",{className:"max-h-96 overflow-y-auto",children:[r&&(0,s.jsxs)("div",{className:"flex flex-col justify-center items-center h-48 text-gray-500",children:[(0,s.jsxs)("div",{className:"relative",children:[(0,s.jsx)("div",{className:"animate-spin rounded-full h-8 w-8 border-2 border-gray-200"}),(0,s.jsx)("div",{className:"animate-spin rounded-full h-8 w-8 border-2 border-blue-600 border-t-transparent absolute top-0"})]}),(0,s.jsx)("p",{className:"text-sm font-medium mt-3",children:"Calling tool..."}),(0,s.jsx)("p",{className:"text-xs text-gray-400 mt-1",children:"Please wait while we process your request"})]}),n&&(0,s.jsx)("div",{className:"bg-red-50 border border-red-200 rounded-lg p-3",children:(0,s.jsxs)("div",{className:"flex items-start space-x-2",children:[(0,s.jsx)("div",{className:"flex-shrink-0",children:(0,s.jsx)("svg",{className:"h-4 w-4 text-red-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:(0,s.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 8v4m0 4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})})}),(0,s.jsxs)("div",{className:"flex-1",children:[(0,s.jsxs)("div",{className:"flex items-center space-x-2 mb-1",children:[(0,s.jsx)("h4",{className:"text-xs font-medium text-red-900",children:"Tool Call Failed"}),null!==x&&(0,s.jsxs)("span",{className:"text-xs text-red-600",children:["• ",(x/1e3).toFixed(2),"s"]})]}),(0,s.jsx)("div",{className:"bg-white border border-red-200 rounded p-2 max-h-48 overflow-y-auto",children:(0,s.jsx)("pre",{className:"text-xs whitespace-pre-wrap text-red-700 font-mono",children:n.message})})]})]})}),a&&!r&&!n&&(0,s.jsx)("div",{className:"space-y-3",children:"formatted"===c?a.map((e,t)=>(0,s.jsxs)("div",{className:"border border-gray-200 rounded-lg overflow-hidden",children:["text"===e.type&&(0,s.jsxs)("div",{children:[(0,s.jsx)("div",{className:"bg-gray-50 px-3 py-1 border-b border-gray-200",children:(0,s.jsx)("span",{className:"text-xs font-medium text-gray-700 uppercase tracking-wide",children:"Text Response"})}),(0,s.jsx)("div",{className:"p-3",children:(0,s.jsx)("div",{className:"bg-white rounded border border-gray-200 max-h-64 overflow-y-auto",children:(0,s.jsx)("div",{className:"p-3 space-y-2",children:e.text.split("\n\n").map((e,t)=>{if(""===e.trim())return null;if(e.startsWith("##")){let r=e.replace(/^#+\s/,"");return(0,s.jsx)("div",{className:"border-b border-gray-200 pb-1 mb-2",children:(0,s.jsx)("h3",{className:"text-sm font-semibold text-gray-900",children:r})},t)}let r=/(https?:\/\/[^\s\)]+)/g;if(r.test(e)){let l=e.split(r);return(0,s.jsx)("div",{className:"bg-blue-50 border border-blue-200 rounded p-2",children:(0,s.jsx)("div",{className:"text-xs text-gray-700 leading-relaxed whitespace-pre-wrap",children:l.map((e,t)=>r.test(e)?(0,s.jsx)("a",{href:e,target:"_blank",rel:"noopener noreferrer",className:"text-blue-600 hover:text-blue-800 underline break-all",children:e},t):e)})},t)}return e.includes("Score:")?(0,s.jsx)("div",{className:"bg-green-50 border-l-4 border-green-400 p-2 rounded-r",children:(0,s.jsx)("p",{className:"text-xs text-green-800 font-medium whitespace-pre-wrap",children:e})},t):(0,s.jsx)("div",{className:"bg-gray-50 rounded p-2 border border-gray-200",children:(0,s.jsx)("div",{className:"text-xs text-gray-700 leading-relaxed whitespace-pre-wrap font-mono",children:e})},t)}).filter(Boolean)})})})]}),"image"===e.type&&e.url&&(0,s.jsxs)("div",{children:[(0,s.jsx)("div",{className:"bg-gray-50 px-3 py-1 border-b border-gray-200",children:(0,s.jsx)("span",{className:"text-xs font-medium text-gray-700 uppercase tracking-wide",children:"Image Response"})}),(0,s.jsx)("div",{className:"p-3",children:(0,s.jsx)("div",{className:"bg-gray-50 rounded p-3 border border-gray-200",children:(0,s.jsx)("img",{src:e.url,alt:"Tool result",className:"max-w-full h-auto rounded shadow-sm"})})})]}),"embedded_resource"===e.type&&(0,s.jsxs)("div",{children:[(0,s.jsx)("div",{className:"bg-gray-50 px-3 py-1 border-b border-gray-200",children:(0,s.jsx)("span",{className:"text-xs font-medium text-gray-700 uppercase tracking-wide",children:"Embedded Resource"})}),(0,s.jsx)("div",{className:"p-3",children:(0,s.jsxs)("div",{className:"flex items-center space-x-2 p-3 bg-blue-50 border border-blue-200 rounded",children:[(0,s.jsx)("div",{className:"flex-shrink-0",children:(0,s.jsx)("svg",{className:"h-5 w-5 text-blue-500",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:(0,s.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"})})}),(0,s.jsxs)("div",{className:"flex-1",children:[(0,s.jsxs)("p",{className:"text-xs font-medium text-blue-900",children:["Resource Type: ",e.resource_type]}),e.url&&(0,s.jsxs)("a",{href:e.url,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center text-xs text-blue-600 hover:text-blue-800 hover:underline mt-1 transition-colors",children:["View Resource",(0,s.jsxs)("svg",{className:"ml-1 h-3 w-3",fill:"currentColor",viewBox:"0 0 20 20",children:[(0,s.jsx)("path",{d:"M11 3a1 1 0 100 2h2.586l-6.293 6.293a1 1 0 101.414 1.414L15 6.414V9a1 1 0 102 0V4a1 1 0 00-1-1h-5z"}),(0,s.jsx)("path",{d:"M5 5a2 2 0 00-2 2v8a2 2 0 002 2h8a2 2 0 002-2v-3a1 1 0 10-2 0v3H5V7h3a1 1 0 000-2H5z"})]})]})]})]})})]})]},t)):(0,s.jsx)("div",{className:"bg-white rounded border border-gray-200",children:(0,s.jsx)("div",{className:"p-3 overflow-auto max-h-80 bg-gray-50",children:(0,s.jsx)("pre",{className:"text-xs font-mono whitespace-pre-wrap break-all text-gray-800",children:JSON.stringify(a,null,2)})})})})]})]}):(0,s.jsx)("div",{className:"flex flex-col justify-center items-center h-48 text-gray-500",children:(0,s.jsxs)("div",{className:"text-center max-w-sm",children:[(0,s.jsx)("div",{className:"mb-3",children:(0,s.jsx)("svg",{className:"mx-auto h-12 w-12 text-gray-300",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:(0,s.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1,d:"M13 10V3L4 14h7v7l9-11h-7z"})})}),(0,s.jsx)("h4",{className:"text-sm font-medium text-gray-900 mb-1",children:"Ready to Call Tool"}),(0,s.jsx)("p",{className:"text-xs text-gray-500 leading-relaxed",children:'Configure the input parameters and click "Call Tool" to see the results here.'})]})})})]})]})]})}var sN=e.i(983561),s_=e.i(438957);let sw=({serverId:e,accessToken:t,auth_type:r,userRole:l,userID:a,serverAlias:n,extraHeaders:i})=>{let[o,c]=(0,b.useState)(null),[u,x]=(0,b.useState)(null),[p,h]=(0,b.useState)(null),[g,f]=(0,b.useState)(""),[j,v]=(0,b.useState)({}),[N,w]=(0,b.useState)(!1),C=i&&i.length>0,S=()=>{if(!n||!C)return;let e={};return Object.entries(j).forEach(([s,t])=>{t&&t.trim()&&(e[`x-mcp-${n}-${s.toLowerCase()}`]=t)}),Object.keys(e).length>0?e:void 0},{data:T,isLoading:k,error:A,refetch:I}=(0,y.useQuery)({queryKey:["mcpTools",e,j],queryFn:()=>{if(!t)throw Error("Access Token required");return(0,_.listMCPTools)(t,e,S())},enabled:!!t,staleTime:3e4}),{mutate:P,isPending:O}=(0,sf.useMutation)({mutationFn:async s=>{if(!t)throw Error("Access Token required");try{return await (0,_.callMCPTool)(t,e,s.tool.name,s.arguments,{customHeaders:S()})}catch(e){throw e}},onSuccess:e=>{x(e.content),h(null)},onError:e=>{h(e),x(null)}}),M=T?.tools||[],F=M.filter(e=>{let s=g.toLowerCase();return e.name.toLowerCase().includes(s)||e.description&&e.description.toLowerCase().includes(s)||e.mcp_info.server_name&&e.mcp_info.server_name.toLowerCase().includes(s)});return(0,s.jsx)("div",{className:"w-full h-screen p-4 bg-white",children:(0,s.jsx)(eg.Card,{className:"w-full rounded-xl shadow-md overflow-hidden",children:(0,s.jsxs)("div",{className:"flex h-auto w-full gap-4",children:[(0,s.jsxs)("div",{className:"w-1/4 p-4 bg-gray-50 flex flex-col",children:[(0,s.jsx)(m.Title,{className:"text-xl font-semibold mb-6 mt-2",children:"MCP Tools"}),(0,s.jsxs)("div",{className:"flex flex-col flex-1",children:[C&&(0,s.jsxs)("div",{className:"mb-4 p-3 bg-blue-50 border border-blue-200 rounded-lg",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between mb-2",children:[(0,s.jsxs)("div",{className:"flex items-center",children:[(0,s.jsx)(s_.KeyOutlined,{className:"text-blue-600 mr-2"}),(0,s.jsx)(d.Text,{className:"text-sm font-medium text-blue-800",children:"Additional Headers"})]}),(0,s.jsx)(eb.Button,{size:"small",type:"link",onClick:()=>w(!N),className:"text-blue-700 p-0 h-auto",children:N?"Hide":"Configure"})]}),!N&&0===Object.keys(j).length&&(0,s.jsx)(d.Text,{className:"text-xs text-blue-700",children:'This server requires additional headers. Click "Configure" to provide values.'}),N&&(0,s.jsxs)("div",{className:"mt-3 space-y-2",children:[i?.map(e=>(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"block text-xs font-medium text-gray-700 mb-1",children:e}),(0,s.jsx)(H.Input,{size:"small",placeholder:`Enter ${e}`,value:j[e]||"",onChange:s=>{v({...j,[e]:s.target.value})},prefix:(0,s.jsx)(s_.KeyOutlined,{className:"text-gray-400"}),className:"rounded"})]},e)),(0,s.jsx)(eb.Button,{size:"small",type:"primary",onClick:()=>{I(),w(!1)},disabled:Object.values(j).every(e=>!e||!e.trim()),className:"w-full mt-2",children:"Load Tools"})]}),!N&&Object.keys(j).length>0&&(0,s.jsx)("div",{className:"mt-2",children:(0,s.jsxs)(d.Text,{className:"text-xs text-green-700 flex items-center",children:[(0,s.jsx)("span",{className:"inline-block w-2 h-2 bg-green-500 rounded-full mr-2"}),Object.keys(j).length," header(s) configured"]})})]}),(0,s.jsxs)("div",{className:"flex flex-col flex-1 min-h-0",children:[(0,s.jsxs)(d.Text,{className:"font-medium block mb-3 text-gray-700 flex items-center",children:[(0,s.jsx)(eh.ToolOutlined,{className:"mr-2"})," Available Tools",M.length>0&&(0,s.jsx)("span",{className:"ml-2 bg-blue-100 text-blue-800 text-xs font-medium px-2 py-0.5 rounded-full",children:M.length})]}),M.length>0&&(0,s.jsx)("div",{className:"mb-3",children:(0,s.jsx)(H.Input,{placeholder:"Search tools...",prefix:(0,s.jsx)(ew.SearchOutlined,{className:"text-gray-400"}),value:g,onChange:e=>f(e.target.value),allowClear:!0,className:"rounded-lg",size:"middle"})}),k&&(0,s.jsxs)("div",{className:"flex flex-col items-center justify-center py-8 bg-white border border-gray-200 rounded-lg",children:[(0,s.jsxs)("div",{className:"relative mb-3",children:[(0,s.jsx)("div",{className:"animate-spin rounded-full h-6 w-6 border-2 border-gray-200"}),(0,s.jsx)("div",{className:"animate-spin rounded-full h-6 w-6 border-2 border-blue-600 border-t-transparent absolute top-0"})]}),(0,s.jsx)("p",{className:"text-xs font-medium text-gray-700",children:"Loading tools..."})]}),T?.error&&!k&&!M.length&&(0,s.jsx)("div",{className:"p-3 text-xs text-red-800 rounded-lg bg-red-50 border border-red-200",children:(0,s.jsxs)("p",{className:"font-medium",children:["Error: ",T.message]})}),!k&&!T?.error&&(!M||0===M.length)&&(0,s.jsxs)("div",{className:"p-4 text-center bg-white border border-gray-200 rounded-lg",children:[(0,s.jsx)("div",{className:"mx-auto w-8 h-8 bg-gray-200 rounded-full flex items-center justify-center mb-2",children:(0,s.jsx)("svg",{className:"w-4 h-4 text-gray-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,s.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19.428 15.428a2 2 0 00-1.022-.547l-2.387-.477a6 6 0 00-3.86.517l-.318.158a6 6 0 01-3.86.517L6.05 15.21a2 2 0 00-1.806.547M8 4h8l-1 1v5.172a2 2 0 00.586 1.414l5 5c1.26 1.26.367 3.414-1.415 3.414H4.828c-1.782 0-2.674-2.154-1.414-3.414l5-5A2 2 0 009 8.172V5L8 4z"})})}),(0,s.jsx)("p",{className:"text-xs font-medium text-gray-700 mb-1",children:"No tools available"}),(0,s.jsx)("p",{className:"text-xs text-gray-500",children:"No tools found for this server"})]}),!k&&!T?.error&&M.length>0&&(0,s.jsx)(s.Fragment,{children:0===F.length?(0,s.jsxs)("div",{className:"p-4 text-center bg-white border border-gray-200 rounded-lg",children:[(0,s.jsx)(ew.SearchOutlined,{className:"text-2xl text-gray-400 mb-2"}),(0,s.jsx)("p",{className:"text-xs font-medium text-gray-700 mb-1",children:"No tools found"}),(0,s.jsxs)("p",{className:"text-xs text-gray-500",children:['No tools match "',g,'"']})]}):(0,s.jsx)("div",{className:"space-y-2 flex-1 overflow-y-auto min-h-0 mcp-tools-scrollable",style:{maxHeight:"400px",scrollbarWidth:"auto",scrollbarColor:"#cbd5e0 #f7fafc"},children:F.map(e=>(0,s.jsxs)("div",{className:`border rounded-lg p-3 cursor-pointer transition-all hover:shadow-sm ${o?.name===e.name?"border-blue-500 bg-blue-50 ring-1 ring-blue-200":"border-gray-200 bg-white hover:border-gray-300"}`,onClick:()=>{c(e),x(null),h(null)},children:[(0,s.jsxs)("div",{className:"flex items-start space-x-2",children:[e.mcp_info.logo_url&&(0,s.jsx)("img",{src:e.mcp_info.logo_url,alt:`${e.mcp_info.server_name} logo`,className:"w-4 h-4 object-contain flex-shrink-0 mt-0.5"}),(0,s.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,s.jsx)("h4",{className:"font-mono text-xs font-medium text-gray-900 truncate",children:e.name}),(0,s.jsx)("p",{className:"text-xs text-gray-500 truncate",children:e.mcp_info.server_name}),(0,s.jsx)("p",{className:"text-xs text-gray-600 mt-1 line-clamp-2 leading-relaxed",children:e.description})]})]}),o?.name===e.name&&(0,s.jsx)("div",{className:"mt-2 pt-2 border-t border-blue-200",children:(0,s.jsxs)("div",{className:"flex items-center text-xs font-medium text-blue-700",children:[(0,s.jsx)("svg",{className:"w-3 h-3 mr-1",fill:"currentColor",viewBox:"0 0 20 20",children:(0,s.jsx)("path",{fillRule:"evenodd",d:"M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z",clipRule:"evenodd"})}),"Selected"]})})]},e.name))})})]})]})]}),(0,s.jsxs)("div",{className:"w-3/4 flex flex-col bg-white",children:[(0,s.jsx)("div",{className:"p-4 border-b border-gray-200 flex justify-between items-center",children:(0,s.jsx)(m.Title,{className:"text-xl font-semibold mb-0",children:"Tool Testing Playground"})}),(0,s.jsx)("div",{className:"flex-1 overflow-auto p-4",children:o?(0,s.jsx)("div",{className:"h-full",children:(0,s.jsx)(sv,{tool:o,onSubmit:e=>{P({tool:o,arguments:e})},result:u,error:p,isLoading:O,onClose:()=>c(null)})}):(0,s.jsxs)("div",{className:"h-full flex flex-col items-center justify-center text-gray-400",children:[(0,s.jsx)(sN.RobotOutlined,{style:{fontSize:"48px",marginBottom:"16px"}}),(0,s.jsx)(d.Text,{className:"text-lg font-medium text-gray-600 mb-2",children:"Select a Tool to Test"}),(0,s.jsx)(d.Text,{className:"text-center text-gray-500 max-w-md",children:"Choose a tool from the left sidebar to start testing its functionality with custom inputs."})]})})]})]})})})},sC=[eo.AUTH_TYPE.API_KEY,eo.AUTH_TYPE.BEARER_TOKEN,eo.AUTH_TYPE.TOKEN,eo.AUTH_TYPE.BASIC],sS=[...sC,eo.AUTH_TYPE.OAUTH2,eo.AUTH_TYPE.AWS_SIGV4],sT="litellm-mcp-oauth-edit-state",sk=({mcpServer:e,accessToken:t,onCancel:r,onSuccess:d,availableAccessGroups:m})=>{let[u]=D.Form.useForm(),[x,p]=(0,b.useState)({}),[f,j]=(0,b.useState)([]),[y,v]=(0,b.useState)(!1),[N,w]=(0,b.useState)(""),[C,T]=(0,b.useState)(!1),[k,A]=(0,b.useState)([]),[I,P]=(0,b.useState)({}),[O,M]=(0,b.useState)({}),[F,E]=(0,b.useState)(null),[L,R]=(0,b.useState)(e.mcp_info?.logo_url||void 0),U=D.Form.useWatch("auth_type",u),z=D.Form.useWatch("transport",u),B="stdio"===z,q=z===eo.TRANSPORT.OPENAPI,V=!!U&&sC.includes(U),$=U===eo.AUTH_TYPE.OAUTH2,K=U===eo.AUTH_TYPE.AWS_SIGV4;D.Form.useWatch("oauth_flow_type",u),$&&eo.OAUTH_FLOW.M2M;let[W,Y]=(0,b.useState)(null),J=D.Form.useWatch("url",u),G=D.Form.useWatch("spec_path",u),Q=D.Form.useWatch("server_name",u),Z=D.Form.useWatch("auth_type",u),X=D.Form.useWatch("static_headers",u),ee=D.Form.useWatch("credentials",u),es=D.Form.useWatch("authorization_url",u),et=D.Form.useWatch("token_url",u),er=D.Form.useWatch("registration_url",u),{startOAuthFlow:el,status:ea,error:ei,tokenResponse:ec}=eQ({accessToken:t,getCredentials:()=>u.getFieldValue("credentials"),getTemporaryPayload:()=>{let s=u.getFieldsValue(!0),t=s.url||e.url,r=s.transport||e.transport;if(!t||!r)return null;let l=Array.isArray(s.static_headers)?s.static_headers.reduce((e,s)=>{let t=s?.header?.trim();return t&&(e[t]=s?.value??""),e},{}):{};return{server_id:e.server_id,server_name:s.server_name||e.server_name||e.alias,alias:s.alias||e.alias,description:s.description||e.description,url:t,transport:r,auth_type:eo.AUTH_TYPE.OAUTH2,credentials:s.credentials,mcp_access_groups:s.mcp_access_groups||e.mcp_access_groups,static_headers:l,command:s.command,args:s.args,env:s.env}},onTokenReceived:e=>{if(Y(e?.access_token??null),e?.access_token){let s={access_token:e.access_token,...e.refresh_token&&{refresh_token:e.refresh_token},...e.expires_in&&{expires_in:e.expires_in},...e.scope&&{scope:e.scope}};u.setFieldsValue({credentials:s}),S.default.success("OAuth authorization successful! Please click 'Update MCP Server' to save the credentials.")}},onBeforeRedirect:()=>{try{let s=u.getFieldsValue(!0);window.sessionStorage.setItem(sT,JSON.stringify({serverId:e.server_id,formValues:s,costConfig:x,allowedTools:k,searchValue:N,aliasManuallyEdited:C}))}catch(e){console.warn("Failed to persist MCP edit state",e)}}}),ed=b.default.useMemo(()=>e.static_headers?Object.entries(e.static_headers).map(([e,s])=>({header:e,value:null!=s?String(s):""})):[],[e.static_headers]),em=b.default.useMemo(()=>{let s=e.env??void 0;if(!s||0===Object.keys(s).length)return"";try{return JSON.stringify(s,null,2)}catch{return""}},[e.env]),eu=b.default.useMemo(()=>e.spec_path&&"stdio"!==e.transport?eo.TRANSPORT.OPENAPI:e.transport,[e]),ex=b.default.useMemo(()=>({...e,transport:eu,static_headers:ed,oauth_flow_type:e.token_url?eo.OAUTH_FLOW.M2M:eo.OAUTH_FLOW.INTERACTIVE}),[e,eu,ed,em]);(0,b.useEffect)(()=>{e.mcp_info?.mcp_server_cost_info&&p(e.mcp_info.mcp_server_cost_info)},[e]),(0,b.useEffect)(()=>{e.allowed_tools&&A(e.allowed_tools),P(e.tool_name_to_display_name??{}),M(e.tool_name_to_description??{})},[e]),(0,b.useEffect)(()=>{let s=window.sessionStorage.getItem(sT);if(s)try{let t=JSON.parse(s);if(!t||t.serverId!==e.server_id)return;t.formValues&&E({...e,...t.formValues}),t.costConfig&&p(t.costConfig),t.allowedTools&&A(t.allowedTools),t.searchValue&&w(t.searchValue),"boolean"==typeof t.aliasManuallyEdited&&T(t.aliasManuallyEdited)}catch(e){console.error("Failed to restore MCP edit state",e)}finally{window.sessionStorage.removeItem(sT)}},[u,e]),(0,b.useEffect)(()=>{if(!F)return;let s=F.transport||e.transport;s&&s!==u.getFieldValue("transport")?u.setFieldsValue({transport:s}):(u.setFieldsValue(F),E(null))},[F,u,e.transport]),(0,b.useEffect)(()=>{if(e.mcp_access_groups){let s=e.mcp_access_groups.map(e=>"string"==typeof e?e:e.name||String(e));u.setFieldValue("mcp_access_groups",s)}},[e]),(0,b.useEffect)(()=>{e.server_id&&""!==e.server_id.trim()&&ep()},[e,t,W]);let ep=async()=>{if(!t||"stdio"!==e.transport&&!e.url&&!e.spec_path)return;let s=e.auth_type===eo.AUTH_TYPE.OAUTH2&&!!e.token_url;if(e.auth_type!==eo.AUTH_TYPE.OAUTH2||s||W){v(!0);try{let s={server_id:e.server_id,server_name:e.server_name,url:e.url,transport:e.transport,auth_type:e.auth_type,mcp_info:e.mcp_info,authorization_url:e.authorization_url,token_url:e.token_url,registration_url:e.registration_url,command:e.command,args:e.args,env:e.env},r=await (0,_.testMCPToolsListRequest)(t,s,W);r.tools&&!r.error?j(r.tools):(console.error("Failed to fetch tools:",r.message),j([]))}catch(e){console.error("Tools fetch error:",e),j([])}finally{v(!1)}}},eh=async s=>{if(t)try{let{static_headers:r,credentials:l,stdio_config:a,env_json:n,command:i,args:o,allow_all_keys:c,available_on_public_internet:m,...u}=s,p=(u.mcp_access_groups||[]).map(e=>"string"==typeof e?e:e.name||String(e)),h=Array.isArray(r)?r.reduce((e,s)=>{let t=s?.header?.trim();return t&&(e[t]=s?.value??""),e},{}):{},g=l&&"object"==typeof l?Object.entries(l).reduce((e,[s,t])=>{if(null==t||""===t)return e;if("scopes"===s){if(Array.isArray(t)){let r=t.filter(e=>null!=e&&""!==e);r.length>0&&(e[s]=r)}}else e[s]=t;return e},{}):void 0,f={};if("stdio"===u.transport)if(a)try{let e=JSON.parse(a),s=e;if(e?.mcpServers&&"object"==typeof e.mcpServers){let t=Object.keys(e.mcpServers);t.length>0&&(s=e.mcpServers[t[0]])}let t=Array.isArray(s?.args)?s.args.map(e=>String(e)).filter(e=>""!==e.trim()):[],r=s?.env&&"object"==typeof s.env&&!Array.isArray(s.env)?Object.entries(s.env).reduce((e,[s,t])=>(null==s||""===String(s).trim()||(e[String(s)]=null==t?"":String(t)),e),{}):{};if(!(f={command:s?.command?String(s.command):void 0,args:t,env:r}).command)return void S.default.fromBackend("Stdio configuration must include a command")}catch{S.default.fromBackend("Invalid JSON in stdio configuration");return}else{let e={};if(n)try{let s=JSON.parse(n);s&&"object"==typeof s&&!Array.isArray(s)&&(e=Object.entries(s).reduce((e,[s,t])=>(null==s||""===String(s).trim()||(e[String(s)]=null==t?"":String(t)),e),{}))}catch{S.default.fromBackend("Invalid JSON in stdio env configuration");return}let s=Array.isArray(o)?o.map(e=>String(e)).filter(e=>""!==e.trim()):[],t=i?String(i).trim():"";if(!t)return void S.default.fromBackend("Stdio transport requires a command");f={command:t,args:s,env:e}}u.transport===eo.TRANSPORT.OPENAPI&&(u.transport="http");let b=u.server_name||u.url||e.server_name||e.url||u.alias||e.alias||"unknown",j={...u,...f,stdio_config:void 0,env_json:void 0,server_id:e.server_id,mcp_info:{server_name:b,description:u.description,logo_url:L||void 0,mcp_server_cost_info:Object.keys(x).length>0?x:null},mcp_access_groups:p,alias:u.alias,extra_headers:u.extra_headers||[],allowed_tools:k.length>0?k:null,tool_name_to_display_name:Object.keys(I).length>0?I:null,tool_name_to_description:Object.keys(O).length>0?O:null,disallowed_tools:u.disallowed_tools||[],static_headers:h,allow_all_keys:!!(c??e.allow_all_keys),available_on_public_internet:!!(m??e.available_on_public_internet)};u.auth_type&&sS.includes(u.auth_type)&&g&&Object.keys(g).length>0&&(j.credentials=g);let y=await (0,_.updateMCPServer)(t,j);S.default.success("MCP Server updated successfully"),d(y)}catch(e){S.default.fromBackend("Failed to update MCP Server"+(e?.message?`: ${e.message}`:""))}};return(0,s.jsxs)(n.TabGroup,{children:[(0,s.jsxs)(i.TabList,{className:"grid w-full grid-cols-2",children:[(0,s.jsx)(a.Tab,{children:"Server Configuration"}),(0,s.jsx)(a.Tab,{children:"Cost Configuration"})]}),(0,s.jsxs)(c.TabPanels,{className:"mt-6",children:[(0,s.jsx)(o.TabPanel,{children:(0,s.jsxs)(D.Form,{form:u,onFinish:eh,initialValues:ex,layout:"vertical",children:[(0,s.jsx)(D.Form.Item,{label:"MCP Server Name",name:"server_name",rules:[{validator:(e,s)=>eW(s)}],children:(0,s.jsx)(H.Input,{className:"rounded-lg border-gray-300 focus:border-blue-500 focus:ring-blue-500"})}),(0,s.jsx)(D.Form.Item,{label:"Alias",name:"alias",rules:[{validator:(e,s)=>eW(s)}],children:(0,s.jsx)(H.Input,{onChange:()=>T(!0),className:"rounded-lg border-gray-300 focus:border-blue-500 focus:ring-blue-500"})}),(0,s.jsx)(D.Form.Item,{label:"Description",name:"description",children:(0,s.jsx)(H.Input,{className:"rounded-lg border-gray-300 focus:border-blue-500 focus:ring-blue-500"})}),(0,s.jsx)(e$,{value:L,onChange:R}),(0,s.jsx)(D.Form.Item,{label:"Transport Type",name:"transport",rules:[{required:!0}],children:(0,s.jsxs)(h.Select,{onChange:e=>{"stdio"===e?u.setFieldsValue({url:void 0,spec_path:void 0,auth_type:void 0,credentials:void 0,authorization_url:void 0,token_url:void 0,registration_url:void 0}):e===eo.TRANSPORT.OPENAPI?u.setFieldsValue({url:void 0,command:void 0,args:void 0,env_json:void 0,stdio_config:void 0}):u.setFieldsValue({spec_path:void 0,command:void 0,args:void 0,env_json:void 0,stdio_config:void 0})},children:[(0,s.jsx)(h.Select.Option,{value:"http",children:"Streamable HTTP (Recommended)"}),(0,s.jsx)(h.Select.Option,{value:"sse",children:"Server-Sent Events (SSE)"}),(0,s.jsx)(h.Select.Option,{value:"stdio",children:"Standard Input/Output (stdio)"}),(0,s.jsx)(h.Select.Option,{value:eo.TRANSPORT.OPENAPI,children:"OpenAPI Spec"})]})}),!B&&!q&&(0,s.jsx)(D.Form.Item,{label:"MCP Server URL",name:"url",rules:[{required:!0,message:"Please enter a server URL"},{validator:(e,s)=>eK(s)}],children:(0,s.jsx)(H.Input,{placeholder:"https://your-mcp-server.com",className:"rounded-lg border-gray-300 focus:border-blue-500 focus:ring-blue-500"})}),q&&(0,s.jsx)(D.Form.Item,{label:(0,s.jsxs)("span",{className:"text-sm font-medium text-gray-700 flex items-center",children:["OpenAPI Spec URL",(0,s.jsx)(g.Tooltip,{title:"URL to an OpenAPI specification (JSON or YAML). MCP tools will be automatically generated from the API endpoints defined in the spec.",children:(0,s.jsx)(en.InfoCircleOutlined,{className:"ml-2 text-blue-400 hover:text-blue-600 cursor-help"})})]}),name:"spec_path",rules:[{required:!0,message:"Please enter an OpenAPI spec URL"}],children:(0,s.jsx)(H.Input,{placeholder:"https://petstore3.swagger.io/api/v3/openapi.json",className:"rounded-lg border-gray-300 focus:border-blue-500 focus:ring-blue-500"})}),!B&&(0,s.jsx)(D.Form.Item,{label:"Authentication",name:"auth_type",rules:[{required:!0}],children:(0,s.jsxs)(h.Select,{children:[(0,s.jsx)(h.Select.Option,{value:"none",children:"None"}),(0,s.jsx)(h.Select.Option,{value:"api_key",children:"API Key"}),(0,s.jsx)(h.Select.Option,{value:"bearer_token",children:"Bearer Token"}),(0,s.jsx)(h.Select.Option,{value:"token",children:"Token"}),(0,s.jsx)(h.Select.Option,{value:"basic",children:"Basic Auth"}),(0,s.jsx)(h.Select.Option,{value:"oauth2",children:"OAuth"}),(0,s.jsx)(h.Select.Option,{value:"aws_sigv4",children:"AWS SigV4 (Bedrock AgentCore MCPs)"})]})}),B&&(0,s.jsxs)("div",{className:"rounded-lg border border-gray-200 p-4 space-y-4",children:[(0,s.jsx)("p",{className:"text-sm text-gray-600",children:"Configure the stdio transport used to launch the MCP server process. You can either fill in the fields below or paste a JSON configuration."}),(0,s.jsx)(D.Form.Item,{label:"Command",name:"command",rules:[{required:!0,message:"Please enter a command for stdio transport"}],children:(0,s.jsx)(H.Input,{placeholder:"e.g., npx",className:"rounded-lg border-gray-300 focus:border-blue-500 focus:ring-blue-500"})}),(0,s.jsx)(D.Form.Item,{label:"Args",name:"args",children:(0,s.jsx)(h.Select,{mode:"tags",size:"large",tokenSeparators:[","],placeholder:"Add args (press enter or comma)",className:"rounded-lg"})}),(0,s.jsx)(D.Form.Item,{label:"Environment (JSON object)",name:"env_json",rules:[{validator:(e,s)=>{if(!s)return Promise.resolve();try{let e=JSON.parse(s);if(e&&"object"==typeof e&&!Array.isArray(e))return Promise.resolve();return Promise.reject(Error("Env must be a JSON object"))}catch{return Promise.reject(Error("Please enter valid JSON"))}}}],children:(0,s.jsx)(H.Input.TextArea,{rows:6,className:"rounded-lg border-gray-300 focus:border-blue-500 focus:ring-blue-500 font-mono text-sm",placeholder:`{ - "KEY": "value" -}`})}),(0,s.jsx)(eO,{isVisible:!0,required:!1})]}),!B&&V&&(0,s.jsx)(D.Form.Item,{label:(0,s.jsxs)("span",{className:"text-sm font-medium text-gray-700 flex items-center",children:["Authentication Value",(0,s.jsx)(g.Tooltip,{title:"Token, password, or header value to send with each request for the selected auth type.",children:(0,s.jsx)(en.InfoCircleOutlined,{className:"ml-2 text-blue-400 hover:text-blue-600 cursor-help"})})]}),name:["credentials","auth_value"],rules:[{validator:(e,s)=>s&&"string"==typeof s&&""===s.trim()?Promise.reject(Error("Authentication value cannot be empty")):Promise.resolve()}],children:(0,s.jsx)(H.Input.Password,{placeholder:"Enter token or secret (leave blank to keep existing)",className:"rounded-lg border-gray-300 focus:border-blue-500 focus:ring-blue-500"})}),!B&&$&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(D.Form.Item,{label:(0,s.jsxs)("span",{className:"text-sm font-medium text-gray-700 flex items-center",children:["OAuth Client ID (optional)",(0,s.jsx)(g.Tooltip,{title:"Provide only if your MCP server cannot handle dynamic client registration.",children:(0,s.jsx)(en.InfoCircleOutlined,{className:"ml-2 text-blue-400 hover:text-blue-600 cursor-help"})})]}),name:["credentials","client_id"],children:(0,s.jsx)(H.Input.Password,{placeholder:"Enter OAuth client ID (leave blank to keep existing)",className:"rounded-lg border-gray-300 focus:border-blue-500 focus:ring-blue-500"})}),(0,s.jsx)(D.Form.Item,{label:(0,s.jsxs)("span",{className:"text-sm font-medium text-gray-700 flex items-center",children:["OAuth Client Secret (optional)",(0,s.jsx)(g.Tooltip,{title:"Provide only if your MCP server cannot handle dynamic client registration.",children:(0,s.jsx)(en.InfoCircleOutlined,{className:"ml-2 text-blue-400 hover:text-blue-600 cursor-help"})})]}),name:["credentials","client_secret"],children:(0,s.jsx)(H.Input.Password,{placeholder:"Enter OAuth client secret (leave blank to keep existing)",className:"rounded-lg border-gray-300 focus:border-blue-500 focus:ring-blue-500"})}),(0,s.jsx)(D.Form.Item,{label:(0,s.jsxs)("span",{className:"text-sm font-medium text-gray-700 flex items-center",children:["OAuth Scopes (optional)",(0,s.jsx)(g.Tooltip,{title:"Add scopes to override the default scope list used for this MCP server.",children:(0,s.jsx)(en.InfoCircleOutlined,{className:"ml-2 text-blue-400 hover:text-blue-600 cursor-help"})})]}),name:["credentials","scopes"],children:(0,s.jsx)(h.Select,{mode:"tags",tokenSeparators:[","],placeholder:"Add scopes",className:"rounded-lg",size:"large"})}),(0,s.jsx)(D.Form.Item,{label:(0,s.jsxs)("span",{className:"text-sm font-medium text-gray-700 flex items-center",children:["Authorization URL Override (optional)",(0,s.jsx)(g.Tooltip,{title:"Optional override for the authorization endpoint.",children:(0,s.jsx)(en.InfoCircleOutlined,{className:"ml-2 text-blue-400 hover:text-blue-600 cursor-help"})})]}),name:"authorization_url",children:(0,s.jsx)(H.Input,{placeholder:"https://example.com/oauth/authorize",className:"rounded-lg border-gray-300 focus:border-blue-500 focus:ring-blue-500"})}),(0,s.jsx)(D.Form.Item,{label:(0,s.jsxs)("span",{className:"text-sm font-medium text-gray-700 flex items-center",children:["Token URL Override (optional)",(0,s.jsx)(g.Tooltip,{title:"Optional override for the token endpoint.",children:(0,s.jsx)(en.InfoCircleOutlined,{className:"ml-2 text-blue-400 hover:text-blue-600 cursor-help"})})]}),name:"token_url",children:(0,s.jsx)(H.Input,{placeholder:"https://example.com/oauth/token",className:"rounded-lg border-gray-300 focus:border-blue-500 focus:ring-blue-500"})}),(0,s.jsx)(D.Form.Item,{label:(0,s.jsxs)("span",{className:"text-sm font-medium text-gray-700 flex items-center",children:["Registration URL Override (optional)",(0,s.jsx)(g.Tooltip,{title:"Optional override for the dynamic client registration endpoint.",children:(0,s.jsx)(en.InfoCircleOutlined,{className:"ml-2 text-blue-400 hover:text-blue-600 cursor-help"})})]}),name:"registration_url",children:(0,s.jsx)(H.Input,{placeholder:"https://example.com/oauth/register",className:"rounded-lg border-gray-300 focus:border-blue-500 focus:ring-blue-500"})}),(0,s.jsxs)("div",{className:"rounded-lg border border-dashed border-gray-300 p-4 space-y-2",children:[(0,s.jsx)("p",{className:"text-sm text-gray-600",children:"Use OAuth to fetch a fresh access token and temporarily save it in the session as the authentication value."}),(0,s.jsx)(l.Button,{variant:"secondary",onClick:el,disabled:"authorizing"===ea||"exchanging"===ea,children:"authorizing"===ea?"Waiting for authorization...":"exchanging"===ea?"Exchanging authorization code...":"Authorize & Fetch Token"}),ei&&(0,s.jsx)("p",{className:"text-sm text-red-500",children:ei}),"success"===ea&&ec?.access_token&&(0,s.jsxs)("p",{className:"text-sm text-green-600",children:["Token fetched. Expires in ",ec.expires_in??"?"," seconds."]})]})]}),!B&&K&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("p",{className:"text-sm text-gray-500 mb-2",children:["For MCP servers hosted on AWS Bedrock AgentCore."," ",(0,s.jsx)("a",{href:"https://docs.litellm.ai/docs/mcp_aws_sigv4",target:"_blank",rel:"noopener noreferrer",className:"text-blue-500 hover:text-blue-700",children:"View docs →"})]}),(0,s.jsx)(D.Form.Item,{label:(0,s.jsxs)("span",{className:"text-sm font-medium text-gray-700 flex items-center",children:["AWS Region",(0,s.jsx)(g.Tooltip,{title:"AWS region for SigV4 signing (e.g., us-east-1)",children:(0,s.jsx)(en.InfoCircleOutlined,{className:"ml-2 text-blue-400 hover:text-blue-600 cursor-help"})})]}),name:["credentials","aws_region_name"],rules:[],children:(0,s.jsx)(H.Input,{placeholder:"us-east-1 (leave blank to keep existing)",className:"rounded-lg border-gray-300 focus:border-blue-500 focus:ring-blue-500"})}),(0,s.jsx)(D.Form.Item,{label:(0,s.jsxs)("span",{className:"text-sm font-medium text-gray-700 flex items-center",children:["AWS Service Name",(0,s.jsx)(g.Tooltip,{title:"AWS service name for SigV4 signing. Defaults to 'bedrock-agentcore'.",children:(0,s.jsx)(en.InfoCircleOutlined,{className:"ml-2 text-blue-400 hover:text-blue-600 cursor-help"})})]}),name:["credentials","aws_service_name"],children:(0,s.jsx)(H.Input,{placeholder:"bedrock-agentcore (leave blank to keep existing)",className:"rounded-lg border-gray-300 focus:border-blue-500 focus:ring-blue-500"})}),(0,s.jsx)(D.Form.Item,{label:(0,s.jsxs)("span",{className:"text-sm font-medium text-gray-700 flex items-center",children:["AWS Access Key ID",(0,s.jsx)(g.Tooltip,{title:"Optional. If not provided, falls back to the boto3 credential chain (IAM role, env vars, etc.).",children:(0,s.jsx)(en.InfoCircleOutlined,{className:"ml-2 text-blue-400 hover:text-blue-600 cursor-help"})})]}),name:["credentials","aws_access_key_id"],rules:[],children:(0,s.jsx)(H.Input.Password,{placeholder:"Leave blank to keep existing",className:"rounded-lg border-gray-300 focus:border-blue-500 focus:ring-blue-500"})}),(0,s.jsx)(D.Form.Item,{label:(0,s.jsxs)("span",{className:"text-sm font-medium text-gray-700 flex items-center",children:["AWS Secret Access Key",(0,s.jsx)(g.Tooltip,{title:"Optional. Required if AWS Access Key ID is provided.",children:(0,s.jsx)(en.InfoCircleOutlined,{className:"ml-2 text-blue-400 hover:text-blue-600 cursor-help"})})]}),name:["credentials","aws_secret_access_key"],rules:[],children:(0,s.jsx)(H.Input.Password,{placeholder:"Leave blank to keep existing",className:"rounded-lg border-gray-300 focus:border-blue-500 focus:ring-blue-500"})}),(0,s.jsx)(D.Form.Item,{label:(0,s.jsxs)("span",{className:"text-sm font-medium text-gray-700 flex items-center",children:["AWS Session Token",(0,s.jsx)(g.Tooltip,{title:"Optional. Only needed for temporary STS credentials.",children:(0,s.jsx)(en.InfoCircleOutlined,{className:"ml-2 text-blue-400 hover:text-blue-600 cursor-help"})})]}),name:["credentials","aws_session_token"],children:(0,s.jsx)(H.Input.Password,{placeholder:"Leave blank to keep existing",className:"rounded-lg border-gray-300 focus:border-blue-500 focus:ring-blue-500"})}),(0,s.jsx)(D.Form.Item,{label:(0,s.jsxs)("span",{className:"text-sm font-medium text-gray-700 flex items-center",children:["AWS Role ARN",(0,s.jsx)(g.Tooltip,{title:"Optional. IAM role ARN to assume via STS before signing. If set, LiteLLM calls sts:AssumeRole to get temporary credentials.",children:(0,s.jsx)(en.InfoCircleOutlined,{className:"ml-2 text-blue-400 hover:text-blue-600 cursor-help"})})]}),name:["credentials","aws_role_name"],children:(0,s.jsx)(H.Input,{placeholder:"Leave blank to keep existing",className:"rounded-lg border-gray-300 focus:border-blue-500 focus:ring-blue-500"})}),(0,s.jsx)(D.Form.Item,{label:(0,s.jsxs)("span",{className:"text-sm font-medium text-gray-700 flex items-center",children:["AWS Session Name",(0,s.jsx)(g.Tooltip,{title:"Optional. Session name for the AssumeRole call — appears in CloudTrail logs. Auto-generated if omitted.",children:(0,s.jsx)(en.InfoCircleOutlined,{className:"ml-2 text-blue-400 hover:text-blue-600 cursor-help"})})]}),name:["credentials","aws_session_name"],children:(0,s.jsx)(H.Input,{placeholder:"Leave blank to keep existing",className:"rounded-lg border-gray-300 focus:border-blue-500 focus:ring-blue-500"})})]}),(0,s.jsx)("div",{className:"mt-6",children:(0,s.jsx)(eR,{availableAccessGroups:m,mcpServer:e,searchValue:N,setSearchValue:w,getAccessGroupOptions:()=>{let e=m.map(e=>({value:e,label:(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)("div",{className:"w-2 h-2 bg-green-500 rounded-full"}),(0,s.jsx)("span",{className:"font-medium",children:e})]})}));return N&&!m.some(e=>e.toLowerCase().includes(N.toLowerCase()))&&e.push({value:N,label:(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)("div",{className:"w-2 h-2 bg-blue-500 rounded-full"}),(0,s.jsx)("span",{className:"font-medium",children:N}),(0,s.jsx)("span",{className:"text-gray-400 text-xs ml-1",children:"create new group"})]})}),e}})}),(0,s.jsx)("div",{className:"mt-6",children:(0,s.jsx)(eP,{accessToken:t,oauthAccessToken:W,formValues:{server_id:e.server_id,server_name:Q??e.server_name,url:J??e.url,spec_path:G??e.spec_path,transport:z??e.transport,auth_type:Z??e.auth_type,mcp_info:e.mcp_info,oauth_flow_type:et??e.token_url?eo.OAUTH_FLOW.M2M:eo.OAUTH_FLOW.INTERACTIVE,static_headers:X??e.static_headers,credentials:ee,authorization_url:es??e.authorization_url,token_url:et??e.token_url,registration_url:er??e.registration_url},allowedTools:k,existingAllowedTools:e.allowed_tools||null,onAllowedToolsChange:A,toolNameToDisplayName:I,toolNameToDescription:O,onToolNameToDisplayNameChange:P,onToolNameToDescriptionChange:M})}),(0,s.jsxs)("div",{className:"flex justify-end gap-2",children:[(0,s.jsx)(eb.Button,{onClick:r,children:"Cancel"}),(0,s.jsx)(l.Button,{type:"submit",children:"Save Changes"})]})]})}),(0,s.jsx)(o.TabPanel,{children:(0,s.jsxs)("div",{className:"space-y-6",children:[(0,s.jsx)(ef,{value:x,onChange:p,tools:f,disabled:y}),(0,s.jsxs)("div",{className:"flex justify-end gap-2",children:[(0,s.jsx)(eb.Button,{onClick:r,children:"Cancel"}),(0,s.jsx)(l.Button,{onClick:()=>u.submit(),children:"Save Changes"})]})]})})]})]})},sA=({costConfig:e})=>{let t=e?.default_cost_per_query!==void 0&&e?.default_cost_per_query!==null,r=e?.tool_name_to_cost_per_query&&Object.keys(e.tool_name_to_cost_per_query).length>0;return t||r?(0,s.jsx)("div",{className:"mt-6 pt-6 border-t border-gray-200",children:(0,s.jsxs)("div",{className:"space-y-4",children:[t&&e?.default_cost_per_query!==void 0&&e?.default_cost_per_query!==null&&(0,s.jsxs)("div",{children:[(0,s.jsx)(d.Text,{className:"font-medium",children:"Default Cost per Query"}),(0,s.jsxs)("div",{className:"text-green-600 font-mono",children:["$",e.default_cost_per_query.toFixed(4)]})]}),r&&e?.tool_name_to_cost_per_query&&(0,s.jsxs)("div",{children:[(0,s.jsx)(d.Text,{className:"font-medium",children:"Tool-Specific Costs"}),(0,s.jsx)("div",{className:"mt-2 space-y-2",children:Object.entries(e.tool_name_to_cost_per_query).map(([e,t])=>null!=t&&(0,s.jsxs)("div",{className:"flex justify-between items-center p-3 bg-gray-50 rounded-lg",children:[(0,s.jsx)(d.Text,{className:"font-medium",children:e}),(0,s.jsxs)(d.Text,{className:"text-green-600 font-mono",children:["$",t.toFixed(4)," per query"]})]},e))})]}),(0,s.jsxs)("div",{className:"mt-4 p-4 bg-blue-50 border border-blue-200 rounded-lg",children:[(0,s.jsx)(d.Text,{className:"text-blue-800 font-medium",children:"Cost Summary:"}),(0,s.jsxs)("div",{className:"mt-2 space-y-1",children:[t&&e?.default_cost_per_query!==void 0&&e?.default_cost_per_query!==null&&(0,s.jsxs)(d.Text,{className:"text-blue-700",children:["• Default cost: $",e.default_cost_per_query.toFixed(4)," per query"]}),r&&e?.tool_name_to_cost_per_query&&(0,s.jsxs)(d.Text,{className:"text-blue-700",children:["• ",Object.keys(e.tool_name_to_cost_per_query).length," tool(s) with custom pricing"]})]})]})]})}):(0,s.jsx)("div",{className:"mt-6 pt-6 border-t border-gray-200",children:(0,s.jsx)("div",{className:"space-y-4",children:(0,s.jsx)("div",{className:"p-4 bg-gray-50 border border-gray-200 rounded-lg",children:(0,s.jsx)(d.Text,{className:"text-gray-600",children:"No cost configuration set for this server. Tool calls will be charged at $0.00 per tool call."})})})})},sI=({mcpServer:e,onBack:t,isEditing:r,isProxyAdmin:u,accessToken:x,userRole:p,userID:h,availableAccessGroups:g})=>{let[f,j]=(0,b.useState)(r),[y,v]=(0,b.useState)(!1),[N,_]=(0,b.useState)({}),[w,C]=(0,b.useState)(0),S=e.url??"",{maskedUrl:T,hasToken:A}=S?eH(S):{maskedUrl:"—",hasToken:!1},I=(e,s)=>e?A?s?e:T:e:"—",P=async(e,s)=>{await (0,sr.copyToClipboard)(e)&&(_(e=>({...e,[s]:!0})),setTimeout(()=>{_(e=>({...e,[s]:!1}))},2e3))},O=e=>{let t=e.toUpperCase();return(0,s.jsx)("span",{className:"inline-flex items-center text-sm font-medium px-2.5 py-0.5 rounded border bg-gray-50 text-gray-700 border-gray-200",children:t})},M=e=>(0,s.jsx)("span",{className:"inline-flex items-center text-sm font-medium px-2.5 py-0.5 rounded border bg-gray-50 text-gray-700 border-gray-200",children:e});return(0,s.jsxs)("div",{className:"p-4 max-w-full",children:[(0,s.jsxs)("div",{className:"mb-6",children:[(0,s.jsx)(l.Button,{icon:sx.ArrowLeftIcon,variant:"light",className:"mb-4",onClick:t,children:"Back to All Servers"}),(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)(m.Title,{className:"text-2xl",children:e.server_name||e.alias||"Unnamed Server"}),(0,s.jsx)(eb.Button,{type:"text",size:"small",icon:N["mcp-server_name"]?(0,s.jsx)(k.CheckIcon,{size:12}):(0,s.jsx)(e6.CopyIcon,{size:12}),onClick:()=>P(e.server_name||e.alias,"mcp-server_name"),className:`transition-all duration-200 ${N["mcp-server_name"]?"text-green-600 bg-green-50 border-green-200":"text-gray-400 hover:text-gray-600 hover:bg-gray-100"}`}),e.alias&&e.server_name&&e.alias!==e.server_name&&(0,s.jsx)("span",{className:"ml-2 inline-flex items-center text-xs font-medium px-2 py-0.5 rounded bg-gray-100 text-gray-600 border border-gray-200 font-mono",children:e.alias})]}),(0,s.jsxs)("div",{className:"flex items-center gap-1.5 mt-1",children:[(0,s.jsx)(d.Text,{className:"text-gray-400 font-mono text-xs",children:e.server_id}),(0,s.jsx)(eb.Button,{type:"text",size:"small",icon:N["mcp-server-id"]?(0,s.jsx)(k.CheckIcon,{size:10}):(0,s.jsx)(e6.CopyIcon,{size:10}),onClick:()=>P(e.server_id,"mcp-server-id"),className:`transition-all duration-200 ${N["mcp-server-id"]?"text-green-600 bg-green-50 border-green-200":"text-gray-300 hover:text-gray-500 hover:bg-gray-50"}`})]}),e.description&&(0,s.jsx)(d.Text,{className:"text-gray-500 mt-2",children:e.description})]}),(0,s.jsxs)(n.TabGroup,{index:w,onIndexChange:C,children:[(0,s.jsx)(i.TabList,{className:"mb-4",children:[(0,s.jsx)(a.Tab,{children:"Overview"},"overview"),(0,s.jsx)(a.Tab,{children:"MCP Tools"},"tools"),...u?[(0,s.jsx)(a.Tab,{children:"Settings"},"settings")]:[]]}),(0,s.jsxs)(c.TabPanels,{children:[(0,s.jsxs)(o.TabPanel,{children:[(0,s.jsxs)(sg.Grid,{numItems:1,numItemsSm:2,numItemsLg:3,className:"gap-4",children:[(0,s.jsxs)(eg.Card,{className:"p-4",children:[(0,s.jsx)(d.Text,{className:"text-xs font-medium text-gray-500 uppercase tracking-wide",children:"Transport"}),(0,s.jsx)("div",{className:"mt-3",children:O((0,eo.handleTransport)(e.transport??void 0,e.spec_path??void 0))})]}),(0,s.jsxs)(eg.Card,{className:"p-4",children:[(0,s.jsx)(d.Text,{className:"text-xs font-medium text-gray-500 uppercase tracking-wide",children:"Authentication"}),(0,s.jsx)("div",{className:"mt-3",children:M((0,eo.handleAuth)(e.auth_type??void 0))})]}),(0,s.jsxs)(eg.Card,{className:"p-4",children:[(0,s.jsx)(d.Text,{className:"text-xs font-medium text-gray-500 uppercase tracking-wide",children:"Host URL"}),(0,s.jsxs)("div",{className:"mt-3 flex items-center gap-2",children:[(0,s.jsx)(d.Text,{className:"break-all overflow-wrap-anywhere font-mono text-sm",children:I(e.url,y)}),A&&(0,s.jsx)("button",{onClick:()=>v(!y),className:"p-1 hover:bg-gray-100 rounded flex-shrink-0",children:(0,s.jsx)(sc.Icon,{icon:y?sh:sp.EyeIcon,size:"sm",className:"text-gray-500"})})]})]})]}),(0,s.jsxs)(eg.Card,{className:"mt-4 p-4",children:[(0,s.jsx)(d.Text,{className:"text-xs font-medium text-gray-500 uppercase tracking-wide",children:"Cost Configuration"}),(0,s.jsx)("div",{className:"mt-3",children:(0,s.jsx)(sA,{costConfig:e.mcp_info?.mcp_server_cost_info})})]})]}),(0,s.jsx)(o.TabPanel,{children:(0,s.jsx)(sw,{serverId:e.server_id,accessToken:x,auth_type:e.auth_type,userRole:p,userID:h,serverAlias:e.alias,extraHeaders:e.extra_headers})}),(0,s.jsx)(o.TabPanel,{children:(0,s.jsxs)(eg.Card,{children:[(0,s.jsxs)("div",{className:"flex justify-between items-center mb-4",children:[(0,s.jsx)(m.Title,{children:"MCP Server Settings"}),f?null:(0,s.jsx)(l.Button,{variant:"light",onClick:()=>j(!0),children:"Edit Settings"})]}),f?(0,s.jsx)(sk,{mcpServer:e,accessToken:x,onCancel:()=>j(!1),onSuccess:e=>{j(!1),t()},availableAccessGroups:g}):(0,s.jsxs)("div",{className:"divide-y divide-gray-100",children:[(0,s.jsxs)("div",{className:"py-3 grid grid-cols-3 gap-4",children:[(0,s.jsx)(d.Text,{className:"text-sm font-medium text-gray-500",children:"Server Name"}),(0,s.jsx)("div",{className:"col-span-2 text-sm text-gray-900",children:e.server_name||(0,s.jsx)("span",{className:"text-gray-400",children:"—"})})]}),(0,s.jsxs)("div",{className:"py-3 grid grid-cols-3 gap-4",children:[(0,s.jsx)(d.Text,{className:"text-sm font-medium text-gray-500",children:"Alias"}),(0,s.jsx)("div",{className:"col-span-2 text-sm font-mono text-gray-900",children:e.alias||(0,s.jsx)("span",{className:"text-gray-400",children:"—"})})]}),(0,s.jsxs)("div",{className:"py-3 grid grid-cols-3 gap-4",children:[(0,s.jsx)(d.Text,{className:"text-sm font-medium text-gray-500",children:"Description"}),(0,s.jsx)("div",{className:"col-span-2 text-sm text-gray-900",children:e.description||(0,s.jsx)("span",{className:"text-gray-400",children:"—"})})]}),(0,s.jsxs)("div",{className:"py-3 grid grid-cols-3 gap-4",children:[(0,s.jsx)(d.Text,{className:"text-sm font-medium text-gray-500",children:"URL"}),(0,s.jsxs)("div",{className:"col-span-2 text-sm font-mono text-gray-900 break-all flex items-center gap-2",children:[I(e.url,y),A&&(0,s.jsx)("button",{onClick:()=>v(!y),className:"p-1 hover:bg-gray-100 rounded flex-shrink-0",children:(0,s.jsx)(sc.Icon,{icon:y?sh:sp.EyeIcon,size:"sm",className:"text-gray-500"})})]})]}),(0,s.jsxs)("div",{className:"py-3 grid grid-cols-3 gap-4",children:[(0,s.jsx)(d.Text,{className:"text-sm font-medium text-gray-500",children:"Transport"}),(0,s.jsx)("div",{className:"col-span-2",children:O((0,eo.handleTransport)(e.transport,e.spec_path))})]}),(0,s.jsxs)("div",{className:"py-3 grid grid-cols-3 gap-4",children:[(0,s.jsx)(d.Text,{className:"text-sm font-medium text-gray-500",children:"Authentication"}),(0,s.jsx)("div",{className:"col-span-2",children:M((0,eo.handleAuth)(e.auth_type))})]}),(0,s.jsxs)("div",{className:"py-3 grid grid-cols-3 gap-4",children:[(0,s.jsx)(d.Text,{className:"text-sm font-medium text-gray-500",children:"Extra Headers"}),(0,s.jsx)("div",{className:"col-span-2 text-sm text-gray-900",children:e.extra_headers&&e.extra_headers.length>0?e.extra_headers.join(", "):(0,s.jsx)("span",{className:"text-gray-400",children:"—"})})]}),(0,s.jsxs)("div",{className:"py-3 grid grid-cols-3 gap-4",children:[(0,s.jsx)(d.Text,{className:"text-sm font-medium text-gray-500",children:"Allow All Keys"}),(0,s.jsx)("div",{className:"col-span-2",children:e.allow_all_keys?(0,s.jsxs)("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 bg-green-50 text-green-700 rounded-full border border-green-200 text-xs font-medium",children:[(0,s.jsx)("span",{className:"h-1.5 w-1.5 rounded-full bg-green-500"}),"Enabled"]}):(0,s.jsx)("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 bg-gray-50 text-gray-600 rounded-full border border-gray-200 text-xs font-medium",children:"Disabled"})})]}),(0,s.jsxs)("div",{className:"py-3 grid grid-cols-3 gap-4",children:[(0,s.jsx)(d.Text,{className:"text-sm font-medium text-gray-500",children:"Network Access"}),(0,s.jsx)("div",{className:"col-span-2",children:e.available_on_public_internet?(0,s.jsxs)("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 bg-green-50 text-green-700 rounded-full border border-green-200 text-xs font-medium",children:[(0,s.jsx)("span",{className:"h-1.5 w-1.5 rounded-full bg-green-500"}),"Public"]}):(0,s.jsxs)("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 bg-orange-50 text-orange-700 rounded-full border border-orange-200 text-xs font-medium",children:[(0,s.jsx)("span",{className:"h-1.5 w-1.5 rounded-full bg-orange-500"}),"Internal only"]})})]}),(0,s.jsxs)("div",{className:"py-3 grid grid-cols-3 gap-4",children:[(0,s.jsx)(d.Text,{className:"text-sm font-medium text-gray-500",children:"Access Groups"}),(0,s.jsx)("div",{className:"col-span-2",children:e.mcp_access_groups&&e.mcp_access_groups.length>0?(0,s.jsx)("div",{className:"flex flex-wrap gap-1.5",children:e.mcp_access_groups.map((e,t)=>(0,s.jsx)("span",{className:"inline-flex items-center text-xs font-medium px-2 py-0.5 rounded bg-gray-100 text-gray-700 border border-gray-200",children:"string"==typeof e?e:e?.name??""},t))}):(0,s.jsx)("span",{className:"text-sm text-gray-400",children:"—"})})]}),(0,s.jsxs)("div",{className:"py-3 grid grid-cols-3 gap-4",children:[(0,s.jsx)(d.Text,{className:"text-sm font-medium text-gray-500",children:"Allowed Tools"}),(0,s.jsx)("div",{className:"col-span-2",children:e.allowed_tools&&e.allowed_tools.length>0?(0,s.jsx)("div",{className:"flex flex-wrap gap-1.5",children:e.allowed_tools.map((e,t)=>(0,s.jsx)("span",{className:"inline-flex items-center text-xs font-mono font-medium px-2 py-0.5 rounded bg-blue-50 text-blue-700 border border-blue-200",children:e},t))}):(0,s.jsx)("span",{className:"inline-flex items-center text-xs font-medium px-2 py-0.5 rounded bg-green-50 text-green-700 border border-green-200",children:"All tools enabled"})})]}),(0,s.jsxs)("div",{className:"py-3 grid grid-cols-3 gap-4",children:[(0,s.jsx)(d.Text,{className:"text-sm font-medium text-gray-500",children:"Cost"}),(0,s.jsx)("div",{className:"col-span-2",children:(0,s.jsx)(sA,{costConfig:e.mcp_info?.mcp_server_cost_info})})]})]})]})})]})]})]})},sP=(0,N.createQueryKeys)("mcpSemanticFilterSettings"),sO=(0,N.createQueryKeys)("mcpSemanticFilterSettings");var sM=e.i(178654),sF=e.i(621192),sE=e.i(981339),sL=e.i(850627),sR=e.i(987432),sU=e.i(689020),sz=e.i(245094),sB=e.i(788191),sq=e.i(653496),sV=e.i(992619);function s$({accessToken:e,testQuery:t,setTestQuery:r,testModel:l,setTestModel:a,isTesting:n,onTest:i,filterEnabled:o,testResult:c,curlCommand:d}){return(0,s.jsx)(e4.Card,{title:"Test Configuration",style:{marginBottom:16},children:(0,s.jsx)(sq.Tabs,{defaultActiveKey:"test",items:[{key:"test",label:"Test",children:(0,s.jsxs)(eM.Space,{direction:"vertical",style:{width:"100%"},size:"large",children:[(0,s.jsxs)("div",{children:[(0,s.jsxs)(f.Typography.Text,{strong:!0,style:{display:"block",marginBottom:8},children:[(0,s.jsx)(sB.PlayCircleOutlined,{})," Test Query"]}),(0,s.jsx)(H.Input.TextArea,{placeholder:"Enter a test query to see which tools would be selected...",value:t,onChange:e=>r(e.target.value),rows:4,disabled:n})]}),(0,s.jsx)("div",{children:(0,s.jsx)(sV.default,{accessToken:e||"",value:l,onChange:a,disabled:n,showLabel:!0,labelText:"Select Model"})}),(0,s.jsx)(eb.Button,{type:"primary",icon:(0,s.jsx)(sB.PlayCircleOutlined,{}),onClick:i,loading:n,disabled:!t||!l||!o,block:!0,children:"Test Filter"}),!o&&(0,s.jsx)(ej.Alert,{type:"warning",message:"Semantic filtering is disabled",description:"Enable semantic filtering and save settings to test the filter.",showIcon:!0}),c&&(0,s.jsxs)("div",{children:[(0,s.jsx)(f.Typography.Title,{level:5,children:"Results"}),(0,s.jsx)(ej.Alert,{type:"success",message:`${c.selectedTools} tools selected`,description:`Filtered from ${c.totalTools} available tools`,showIcon:!0,style:{marginBottom:16}}),(0,s.jsxs)("div",{children:[(0,s.jsx)(f.Typography.Text,{strong:!0,style:{display:"block",marginBottom:8},children:"Selected Tools:"}),(0,s.jsx)("ul",{style:{paddingLeft:20,margin:0},children:c.tools.map((e,t)=>(0,s.jsx)("li",{style:{marginBottom:4},children:(0,s.jsx)(f.Typography.Text,{children:e})},t))})]})]})]})},{key:"api",label:"API Usage",children:(0,s.jsxs)("div",{children:[(0,s.jsxs)(eM.Space,{style:{marginBottom:8},children:[(0,s.jsx)(sz.CodeOutlined,{}),(0,s.jsx)(f.Typography.Text,{strong:!0,children:"API Usage"})]}),(0,s.jsx)(f.Typography.Text,{type:"secondary",style:{display:"block",marginBottom:8},children:"Use this curl command to test the semantic filter with your current configuration."}),(0,s.jsx)(f.Typography.Text,{strong:!0,style:{display:"block",marginBottom:8},children:"Response headers to check:"}),(0,s.jsxs)("ul",{style:{paddingLeft:20,margin:"0 0 12px 0"},children:[(0,s.jsxs)("li",{children:[(0,s.jsx)(f.Typography.Text,{children:"x-litellm-semantic-filter: shows total tools → selected tools"}),(0,s.jsx)(f.Typography.Text,{type:"secondary",style:{display:"block"},children:"Example: 10→3"})]}),(0,s.jsxs)("li",{children:[(0,s.jsx)(f.Typography.Text,{children:"x-litellm-semantic-filter-tools: CSV of selected tool names"}),(0,s.jsx)(f.Typography.Text,{type:"secondary",style:{display:"block"},children:"Example: wikipedia-fetch,github-search,slack-post"})]})]}),(0,s.jsx)("pre",{style:{background:"#f5f5f5",padding:12,borderRadius:4,overflow:"auto",fontSize:12,margin:0},children:d})]})}]})})}let sD=async({accessToken:e,testModel:s,testQuery:t,setIsTesting:r,setTestResult:l})=>{if(!t||!s||!e)return void S.default.error("Please enter a query and select a model");r(!0),l(null);try{let{headers:r}=await (0,_.testMCPSemanticFilter)(e,s,t),a=(e=>{if(!e.filter)return null;let[s,t]=e.filter.split("->").map(Number);return{totalTools:s,selectedTools:t,tools:e.tools?e.tools.split(",").map(e=>e.trim()):[]}})(r);if(!a)return void S.default.warning("Semantic filter is not enabled or no tools were filtered");l(a),S.default.success("Semantic filter test completed successfully")}catch(e){console.error("Test failed:",e),S.default.error("Failed to test semantic filter")}finally{r(!1)}};function sH({accessToken:e}){var t;let l,{data:a,isLoading:n,isError:i,error:o}=(()=>{let{accessToken:e}=(0,w.default)();return(0,y.useQuery)({queryKey:sP.list({}),queryFn:async()=>await (0,_.getMCPSemanticFilterSettings)(e),enabled:!!e,staleTime:36e5,gcTime:36e5})})(),{mutate:c,isPending:d,error:m}=(t=e||"",l=(0,v.useQueryClient)(),(0,sf.useMutation)({mutationFn:async e=>{if(!t)throw Error("Access token is required");return(0,_.updateMCPSemanticFilterSettings)(t,e)},onSuccess:()=>{l.invalidateQueries({queryKey:sO.all})}})),[u]=D.Form.useForm(),[x,p]=(0,b.useState)(!1),[j,N]=(0,b.useState)(!1),[C,T]=(0,b.useState)([]),[k,A]=(0,b.useState)(!0),[I,P]=(0,b.useState)(""),[O,M]=(0,b.useState)("gpt-4o"),[F,E]=(0,b.useState)(null),[L,R]=(0,b.useState)(!1),U=a?.field_schema,z=a?.values??{};(0,b.useEffect)(()=>{(async()=>{if(e)try{A(!0);let s=(await (0,sU.fetchAvailableModels)(e)).filter(e=>"embedding"===e.mode);T(s)}catch(e){console.error("Error fetching embedding models:",e)}finally{A(!1)}})()},[e]),(0,b.useEffect)(()=>{z&&(u.setFieldsValue({enabled:z.enabled??!1,embedding_model:z.embedding_model??"text-embedding-3-small",top_k:z.top_k??10,similarity_threshold:z.similarity_threshold??.3}),N(!1))},[z,u]);let B=async()=>{try{let e=await u.validateFields();c(e,{onSuccess:()=>{N(!1),p(!0),setTimeout(()=>p(!1),3e3),S.default.success("Settings updated successfully. Changes will be applied across all pods within 10 seconds.")},onError:e=>{S.default.fromBackend(e)}})}catch(e){console.error("Form validation failed:",e)}},q=async()=>{e&&await sD({accessToken:e,testModel:O,testQuery:I,setIsTesting:R,setTestResult:E})};return e?(0,s.jsx)("div",{style:{width:"100%"},children:n?(0,s.jsx)(sE.Skeleton,{active:!0}):i?(0,s.jsx)(ej.Alert,{type:"error",message:"Could not load MCP Semantic Filter settings",description:o instanceof Error?o.message:void 0,style:{marginBottom:24}}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(ej.Alert,{type:"info",message:"Semantic Tool Filtering",description:"Filter MCP tools semantically based on query relevance. This reduces context window size and improves tool selection accuracy. Click 'Save Settings' to apply changes across all pods (takes effect within 10 seconds).",showIcon:!0,style:{marginBottom:24}}),x&&(0,s.jsx)(ej.Alert,{type:"success",message:"Settings saved successfully",icon:(0,s.jsx)(ey.CheckCircleOutlined,{}),showIcon:!0,closable:!0,style:{marginBottom:16}}),m&&(0,s.jsx)(ej.Alert,{type:"error",message:"Could not update settings",description:m instanceof Error?m.message:void 0,style:{marginBottom:16}}),(0,s.jsxs)(sF.Row,{gutter:24,children:[(0,s.jsx)(sM.Col,{xs:24,lg:12,children:(0,s.jsxs)(D.Form,{form:u,layout:"vertical",disabled:d,onValuesChange:()=>{N(!0)},children:[(0,s.jsxs)(e4.Card,{style:{marginBottom:16},children:[(0,s.jsx)(D.Form.Item,{name:"enabled",label:(0,s.jsxs)(eM.Space,{children:[(0,s.jsx)(f.Typography.Text,{strong:!0,children:"Enable Semantic Filtering"}),(0,s.jsx)(g.Tooltip,{title:"When enabled, only the most relevant MCP tools will be included in requests based on semantic similarity",children:(0,s.jsx)(r.QuestionCircleOutlined,{style:{color:"#8c8c8c"}})})]}),valuePropName:"checked",children:(0,s.jsx)(el.Switch,{disabled:d})}),(0,s.jsx)(f.Typography.Text,{type:"secondary",style:{display:"block",marginTop:-16,marginBottom:16},children:U?.properties?.enabled?.description})]}),(0,s.jsxs)(e4.Card,{title:"Configuration",style:{marginBottom:16},children:[(0,s.jsx)(D.Form.Item,{name:"embedding_model",label:(0,s.jsxs)(eM.Space,{children:[(0,s.jsx)(f.Typography.Text,{strong:!0,children:"Embedding Model"}),(0,s.jsx)(g.Tooltip,{title:"The model used to generate embeddings for semantic matching",children:(0,s.jsx)(r.QuestionCircleOutlined,{style:{color:"#8c8c8c"}})})]}),children:(0,s.jsx)(h.Select,{options:C.map(e=>({label:e.model_group,value:e.model_group})),placeholder:k?"Loading models...":"Select embedding model",showSearch:!0,disabled:d||k,loading:k,notFoundContent:k?"Loading...":"No embedding models available"})}),(0,s.jsx)(D.Form.Item,{name:"top_k",label:(0,s.jsxs)(eM.Space,{children:[(0,s.jsx)(f.Typography.Text,{strong:!0,children:"Top K Results"}),(0,s.jsx)(g.Tooltip,{title:"Maximum number of tools to return after filtering",children:(0,s.jsx)(r.QuestionCircleOutlined,{style:{color:"#8c8c8c"}})})]}),children:(0,s.jsx)(eu.InputNumber,{min:1,max:100,style:{width:"100%"},disabled:d})}),(0,s.jsx)(D.Form.Item,{name:"similarity_threshold",label:(0,s.jsxs)(eM.Space,{children:[(0,s.jsx)(f.Typography.Text,{strong:!0,children:"Similarity Threshold"}),(0,s.jsx)(g.Tooltip,{title:"Minimum similarity score (0-1) for a tool to be included",children:(0,s.jsx)(r.QuestionCircleOutlined,{style:{color:"#8c8c8c"}})})]}),children:(0,s.jsx)(sL.Slider,{min:0,max:1,step:.05,marks:{0:"0.0",.3:"0.3",.5:"0.5",.7:"0.7",1:"1.0"},disabled:d})})]}),(0,s.jsx)("div",{style:{display:"flex",justifyContent:"flex-end",gap:8},children:(0,s.jsx)(eb.Button,{type:"primary",icon:(0,s.jsx)(sR.SaveOutlined,{}),onClick:B,loading:d,disabled:!j,children:"Save Settings"})})]})}),(0,s.jsx)(sM.Col,{xs:24,lg:12,children:(0,s.jsx)(s$,{accessToken:e,testQuery:I,setTestQuery:P,testModel:O,setTestModel:M,isTesting:L,onTest:q,filterEnabled:!!z.enabled,testResult:F,curlCommand:`curl --location 'http://localhost:4000/v1/responses' \\ ---header 'Content-Type: application/json' \\ ---header 'Authorization: Bearer sk-1234' \\ ---data '{ - "model": "${O}", - "input": [ - { - "role": "user", - "content": "${I||"Your query here"}", - "type": "message" - } - ], - "tools": [ - { - "type": "mcp", - "server_url": "litellm_proxy", - "require_approval": "never" - } - ], - "tool_choice": "required" -}'`})})]})]})}):(0,s.jsx)("div",{className:"p-6 text-center text-gray-500",children:"Please log in to configure semantic filter settings."})}var sK=e.i(262218);let{Text:sW}=f.Typography,sY=({accessToken:e})=>{let t,[r,l]=(0,b.useState)(!0),[a,n]=(0,b.useState)(!1),[i,o]=(0,b.useState)([]),[c,d]=(0,b.useState)(null);(0,b.useEffect)(()=>{m(),u()},[e]);let m=async()=>{if(e){l(!0);try{for(let s of(await (0,_.getGeneralSettingsCall)(e)))"mcp_internal_ip_ranges"===s.field_name&&s.field_value&&o(s.field_value)}catch(e){console.error("Failed to load MCP network settings:",e)}finally{l(!1)}}},u=async()=>{if(!e)return;let s=await (0,_.fetchMCPClientIp)(e);s&&d(s)},x=async()=>{if(e){n(!0);try{i.length>0?await (0,_.updateConfigFieldSetting)(e,"mcp_internal_ip_ranges",i):await (0,_.deleteConfigFieldSetting)(e,"mcp_internal_ip_ranges")}catch(e){console.error("Failed to save MCP network settings:",e)}finally{n(!1)}}};if(r)return(0,s.jsx)("div",{className:"flex justify-center py-12",children:(0,s.jsx)(W.Spin,{})});let p=c?4!==(t=c.split(".")).length?c+"/32":`${t[0]}.${t[1]}.${t[2]}.0/24`:null;return(0,s.jsxs)("div",{className:"space-y-6 p-4",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)(sW,{className:"text-lg font-semibold",children:"Private IP Ranges"}),(0,s.jsx)("p",{className:"text-sm text-gray-500 mt-1",children:'Define which IP ranges are part of your private network. Callers from these IPs can see all MCP servers. Callers from any other IP can only see servers marked "Available on Public Internet".'})]}),(0,s.jsxs)(e4.Card,{children:[c&&(0,s.jsxs)("div",{className:"mb-4 p-3 bg-blue-50 rounded-lg",children:[(0,s.jsxs)(sW,{className:"text-sm text-blue-700",children:["Your current IP: ",(0,s.jsx)("span",{className:"font-mono font-medium",children:c})]}),p&&!i.includes(p)&&(0,s.jsxs)("div",{className:"mt-1",children:[(0,s.jsx)(sW,{className:"text-sm text-blue-600",children:"Suggested range: "}),(0,s.jsx)(sK.Tag,{className:"cursor-pointer font-mono",color:"blue",icon:(0,s.jsx)(eE.PlusOutlined,{}),onClick:()=>{!i.includes(p)&&o([...i,p])},children:p})]})]}),(0,s.jsx)("div",{className:"flex items-center mb-2",children:(0,s.jsx)(sW,{className:"font-medium",children:"Your Private Network Ranges"})}),(0,s.jsx)(h.Select,{mode:"tags",value:i,onChange:o,placeholder:"Leave empty to use defaults: 10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16, 127.0.0.0/8",tokenSeparators:[","],className:"w-full",size:"large",allowClear:!0}),(0,s.jsx)("p",{className:"text-xs text-gray-400 mt-2",children:"Enter CIDR ranges (e.g., 10.0.0.0/8). When empty, standard private IP ranges are used."})]}),(0,s.jsx)("div",{className:"flex justify-end",children:(0,s.jsx)(eb.Button,{type:"primary",icon:(0,s.jsx)(sR.SaveOutlined,{}),onClick:x,loading:a,children:"Save"})})]})},{Search:sJ}=H.Input,{Text:sG}=f.Typography,sQ=["#3B82F6","#10B981","#F59E0B","#EF4444","#8B5CF6","#EC4899","#06B6D4","#84CC16"],sZ=({isVisible:e,onClose:t,onSelectServer:r,onCustomServer:l,accessToken:a})=>{let[n,i]=(0,b.useState)([]),[o,c]=(0,b.useState)([]),[d,m]=(0,b.useState)(!1),[u,x]=(0,b.useState)(null),[h,g]=(0,b.useState)(""),[f,j]=(0,b.useState)("All");(0,b.useEffect)(()=>{e&&a&&(m(!0),x(null),(0,_.fetchDiscoverableMCPServers)(a).then(e=>{i(e.servers||[]),c(e.categories||[])}).catch(e=>{x(e.message||"Failed to load MCP servers")}).finally(()=>{m(!1)}))},[e,a]),(0,b.useEffect)(()=>{e&&(g(""),j("All"))},[e]);let y=(0,b.useMemo)(()=>{let e=n;if("All"!==f&&(e=e.filter(e=>e.category===f)),h.trim()){let s=h.toLowerCase();e=e.filter(e=>e.name.toLowerCase().includes(s)||e.title.toLowerCase().includes(s)||e.description.toLowerCase().includes(s))}return e},[n,f,h]),v=(0,b.useMemo)(()=>{let e={};for(let s of y){let t=s.category||"Other";e[t]||(e[t]=[]),e[t].push(s)}return e},[y]);return(0,s.jsxs)(p.Modal,{title:(0,s.jsxs)("div",{className:"flex items-center justify-between pb-4 border-b border-gray-100",children:[(0,s.jsxs)("div",{className:"flex items-center space-x-3",children:[(0,s.jsx)("img",{src:eZ,alt:"MCP Logo",className:"w-8 h-8 object-contain",style:{height:"20px",width:"20px",marginRight:"8px",objectFit:"contain"}}),(0,s.jsx)("h2",{className:"text-xl font-semibold text-gray-900",children:"Add MCP Server"})]}),(0,s.jsx)("button",{onClick:l,className:"text-sm text-blue-600 hover:text-blue-800 cursor-pointer bg-transparent border-none font-medium",children:"+ Custom Server"})]}),open:e,onCancel:t,footer:null,width:1e3,className:"top-8",styles:{body:{padding:"24px",maxHeight:"70vh",overflowY:"auto"},header:{padding:"24px 24px 0 24px",border:"none"}},children:[(0,s.jsx)("div",{style:{display:"flex",gap:6,flexWrap:"wrap",marginBottom:12},children:["All",...o].map(e=>{let t=f===e;return(0,s.jsx)("button",{onClick:()=>j(e),style:{padding:"4px 12px",borderRadius:4,border:t?"1px solid #111827":"1px solid #e5e7eb",background:t?"#111827":"#fff",color:t?"#fff":"#4b5563",cursor:"pointer",fontSize:12,fontWeight:t?500:400,lineHeight:"20px"},children:e},e)})}),(0,s.jsx)(sJ,{placeholder:"Search servers...",value:h,onChange:e=>g(e.target.value),style:{marginBottom:16},allowClear:!0}),d&&(0,s.jsx)("div",{style:{display:"flex",flexDirection:"column",gap:4},children:Array.from({length:8}).map((e,t)=>(0,s.jsx)("div",{style:{height:36,borderRadius:6,background:"#f9fafb"}},t))}),u&&(0,s.jsx)("div",{style:{textAlign:"center",padding:"32px 0",color:"#9ca3af"},children:(0,s.jsxs)(sG,{children:["Failed to load servers: ",u]})}),!d&&!u&&0===y.length&&(0,s.jsx)("div",{style:{textAlign:"center",padding:"32px 0",color:"#9ca3af"},children:(0,s.jsxs)(sG,{children:["No servers found."," ",(0,s.jsx)("a",{onClick:l,style:{color:"#2563eb",cursor:"pointer"},children:"Add a custom server"})]})}),!d&&!u&&Object.entries(v).map(([e,t])=>(0,s.jsxs)("div",{style:{marginBottom:16},children:[(0,s.jsx)("div",{style:{fontSize:11,fontWeight:500,color:"#9ca3af",textTransform:"uppercase",letterSpacing:"0.05em",padding:"6px 0",borderBottom:"1px solid #f3f4f6",marginBottom:4},children:e}),(0,s.jsx)("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:"0 16px"},children:t.map(e=>{var t;let l,a,n=(l=(t=e.title||e.name).charAt(0).toUpperCase(),a=t.split("").reduce((e,s)=>e+s.charCodeAt(0),0)%sQ.length,{initial:l,backgroundColor:sQ[a]});return(0,s.jsxs)("div",{onClick:()=>r(e),style:{display:"flex",alignItems:"center",padding:"8px 10px",borderRadius:6,cursor:"pointer",transition:"background 0.1s ease"},onMouseEnter:e=>{e.currentTarget.style.background="#f9fafb"},onMouseLeave:e=>{e.currentTarget.style.background="transparent"},children:[e.icon_url?(0,s.jsx)("img",{src:e.icon_url,alt:e.title,style:{width:20,height:20,objectFit:"contain",flexShrink:0,marginRight:12},onError:e=>{let s=e.currentTarget;s.style.display="none";let t=s.nextElementSibling;t&&(t.style.display="flex")}}):null,(0,s.jsx)("div",{style:{width:20,height:20,borderRadius:4,backgroundColor:n.backgroundColor,color:"#fff",display:e.icon_url?"none":"flex",alignItems:"center",justifyContent:"center",fontWeight:600,fontSize:11,flexShrink:0,marginRight:12},children:n.initial}),(0,s.jsx)("span",{style:{fontSize:14,fontWeight:400,color:"#111827",flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e.title||e.name}),(0,s.jsx)("span",{style:{color:"#d1d5db",fontSize:14,flexShrink:0,marginLeft:8},children:"›"})]},e.name)})})]},e))]})};var sX=e.i(611052);let{Text:s0,Title:s2}=f.Typography,{Option:s1}=h.Select;e.s(["MCPServers",0,({accessToken:e,userRole:f,userID:N})=>{let{data:T,isLoading:k,refetch:A}=(0,j.useMCPServers)(),{data:I,isLoading:P,recheckServerHealth:O,recheckingServerIds:M}=(()=>{let{accessToken:e}=(0,w.default)(),s=(0,v.useQueryClient)(),[t,r]=(0,b.useState)(new Set),l=(0,y.useQuery)({queryKey:C.lists(),queryFn:async()=>await (0,_.fetchMCPServerHealth)(e),enabled:!!e,refetchInterval:3e4}),a=(0,b.useCallback)(async t=>{if(e){r(e=>new Set(e).add(t));try{let r=await (0,_.fetchMCPServerHealth)(e,[t]);s.setQueriesData({queryKey:C.lists()},e=>e?e.map(e=>r.find(s=>s.server_id===e.server_id)??e):r)}finally{r(e=>{let s=new Set(e);return s.delete(t),s})}}},[e,s]);return{...l,recheckServerHealth:a,recheckingServerIds:t}})(),F=(0,b.useMemo)(()=>{if(!T)return[];if(!I)return T;let e=new Map(I.map(e=>[e.server_id,e.status]));return T.map(s=>{let t=e.get(s.server_id);return{...s,status:t||s.status}})},[T,I]),[E,L]=(0,b.useState)(null),[R,U]=(0,b.useState)(!1),[z,B]=(0,b.useState)(null),[q,V]=(0,b.useState)(!1),[D,H]=(0,b.useState)("all"),[K,W]=(0,b.useState)("all"),[Y,J]=(0,b.useState)([]),[Q,X]=(0,b.useState)(!1),[ee,es]=(0,b.useState)(!1),[et,el]=(0,b.useState)(null),[ea,en]=(0,b.useState)(!1),[ei,eo]=(0,b.useState)(null),ec="Internal User"===f;(0,b.useEffect)(()=>{try{let e=window.sessionStorage.getItem("litellm-mcp-oauth-edit-state");if(!e)return;let s=JSON.parse(e);s?.serverId&&(B(s.serverId),V(!0))}catch(e){console.error("Failed to restore MCP edit view state",e)}},[]);let ed=b.default.useMemo(()=>{if(!F)return[];let e=new Set,s=[];return F.forEach(t=>{t.teams&&t.teams.forEach(t=>{let r=t.team_id;e.has(r)||(e.add(r),s.push(t))})}),s},[F]),em=b.default.useMemo(()=>F?Array.from(new Set(F.flatMap(e=>e.mcp_access_groups).filter(e=>null!=e))):[],[F]),eu=(0,b.useCallback)((e,s)=>{if(!F)return J([]);let t=F;"personal"===e?J([]):("all"!==e&&(t=t.filter(s=>s.teams?.some(s=>s.team_id===e))),"all"!==s&&(t=t.filter(e=>e.mcp_access_groups?.some(e=>"string"==typeof e?e===s:e&&e.name===s))),J([...t].sort((e,s)=>e.created_at||s.created_at?e.created_at?s.created_at?new Date(s.created_at).getTime()-new Date(e.created_at).getTime():-1:1:0)))},[F]);(0,b.useEffect)(()=>{eu(D,K)},[F,D,K,eu]);let ex=b.default.useMemo(()=>{let e,t,r,l;return e=e=>{B(e),V(!1)},t=e=>{B(e),V(!0)},r=ep,l=e=>eo(e),[{accessorKey:"server_id",header:"Server ID",enableSorting:!0,cell:({row:t})=>(0,s.jsxs)("button",{onClick:()=>e(t.original.server_id),className:"font-mono text-blue-600 bg-blue-50 hover:bg-blue-100 text-xs font-medium px-2 py-0.5 rounded-md border border-blue-200 text-left truncate whitespace-nowrap cursor-pointer max-w-[15ch] transition-colors",children:[t.original.server_id.slice(0,7),"..."]})},{accessorKey:"server_name",header:"Name",enableSorting:!0,cell:({row:e})=>{let t=e.original.mcp_info?.logo_url,r=e.original.server_name;return(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[t?(0,s.jsx)("img",{src:t,alt:`${r??"MCP"} logo`,className:"h-5 w-5 rounded object-contain flex-shrink-0",onError:e=>{e.target.style.display="none"}}):null,(0,s.jsx)("span",{children:r})]})}},{accessorKey:"alias",header:"Alias",enableSorting:!0},{id:"url",header:"URL",cell:({row:e})=>{let t=e.original.url;if(!t)return(0,s.jsx)("span",{className:"text-gray-400",children:"—"});let{maskedUrl:r}=eH(t);return(0,s.jsx)("span",{className:"font-mono text-sm",children:r})}},{accessorKey:"transport",header:"Transport",enableSorting:!0,cell:({row:e})=>{let t=e.original.transport||"http",r=(e.original.spec_path&&"stdio"!==t?"OPENAPI":t).toUpperCase();return(0,s.jsx)("span",{className:"inline-flex items-center text-xs font-medium px-2 py-0.5 rounded border bg-gray-50 text-gray-700 border-gray-200",children:r})}},{accessorKey:"auth_type",header:"Auth Type",enableSorting:!0,cell:({getValue:e})=>{let t=e()||"none";return(0,s.jsx)("span",{className:"inline-flex items-center text-xs font-medium px-2 py-0.5 rounded border bg-gray-50 text-gray-700 border-gray-200",children:t})}},{id:"health_status",header:"Health Status",cell:({row:e})=>(0,s.jsx)(su,{server:e.original,isLoadingHealth:P,isRechecking:M?.has(e.original.server_id),onRecheck:O})},{id:"mcp_access_groups",header:"Access Groups",cell:({row:e})=>{let t=e.original.mcp_access_groups;if(Array.isArray(t)&&t.length>0&&"string"==typeof t[0]){let e=t.join(", ");return(0,s.jsx)(g.Tooltip,{title:e,children:(0,s.jsxs)("div",{className:"flex items-center gap-1 max-w-[200px]",children:[(0,s.jsx)("span",{className:"inline-flex items-center text-xs font-medium px-1.5 py-0.5 rounded bg-gray-100 text-gray-700 border border-gray-200 truncate max-w-[140px]",children:t[0]}),t.length>1&&(0,s.jsxs)("span",{className:"text-xs text-gray-400 font-medium",children:["+",t.length-1]})]})})}return(0,s.jsx)("span",{className:"text-xs text-gray-400",children:"—"})}},{id:"available_on_public_internet",header:"Network Access",cell:({row:e})=>e.original.available_on_public_internet?(0,s.jsxs)("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 bg-green-50 text-green-700 rounded-full border border-green-200 text-xs font-medium",children:[(0,s.jsx)("span",{className:"h-1.5 w-1.5 rounded-full bg-green-500"}),"Public"]}):(0,s.jsxs)("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 bg-orange-50 text-orange-700 rounded-full border border-orange-200 text-xs font-medium",children:[(0,s.jsx)("span",{className:"h-1.5 w-1.5 rounded-full bg-orange-500"}),"Internal"]})},{header:"Created",accessorKey:"created_at",enableSorting:!0,sortingFn:"datetime",cell:({row:e})=>{let t=e.original;if(!t.created_at)return(0,s.jsx)("span",{className:"text-xs text-gray-400",children:"—"});let r=new Date(t.created_at);return(0,s.jsx)(g.Tooltip,{title:r.toLocaleString(),children:(0,s.jsx)("span",{className:"text-xs text-gray-600",children:r.toLocaleDateString()})})}},{header:"Updated",accessorKey:"updated_at",enableSorting:!0,sortingFn:"datetime",cell:({row:e})=>{let t=e.original;if(!t.updated_at)return(0,s.jsx)("span",{className:"text-xs text-gray-400",children:"—"});let r=new Date(t.updated_at);return(0,s.jsx)(g.Tooltip,{title:r.toLocaleString(),children:(0,s.jsx)("span",{className:"text-xs text-gray-600",children:r.toLocaleDateString()})})}},{id:"byok_credential",header:"Credential",cell:({row:e})=>{let t=e.original;return t.is_byok?t.has_user_credential?(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsxs)("span",{className:"inline-flex items-center gap-1 text-xs font-medium px-2 py-0.5 rounded-full bg-green-50 text-green-700 border border-green-200",children:[(0,s.jsx)(sm.CheckOutlined,{style:{fontSize:10}})," Connected"]}),l&&(0,s.jsx)("button",{className:"text-xs text-gray-400 hover:text-blue-600 transition-colors",onClick:()=>l(t),children:"Update"})]}):l?(0,s.jsx)("button",{className:"text-xs bg-blue-600 hover:bg-blue-700 text-white px-3 py-1 rounded-md font-medium transition-colors shadow-sm",onClick:()=>l(t),children:"Connect"}):null:(0,s.jsx)("span",{className:"text-gray-300 text-xs",children:"—"})}},{id:"actions",header:"Actions",cell:({row:e})=>(0,s.jsxs)("div",{className:"flex items-center gap-1",children:[(0,s.jsx)(g.Tooltip,{title:"Edit",children:(0,s.jsx)("button",{onClick:()=>t(e.original.server_id),className:"p-1.5 rounded-md text-gray-400 hover:text-blue-600 hover:bg-blue-50 transition-colors",children:(0,s.jsx)(sc.Icon,{icon:sd.PencilAltIcon,size:"sm"})})}),(0,s.jsx)(g.Tooltip,{title:"Delete",children:(0,s.jsx)("button",{onClick:()=>r(e.original.server_id),className:"p-1.5 rounded-md text-gray-400 hover:text-red-600 hover:bg-red-50 transition-colors",children:(0,s.jsx)(sc.Icon,{icon:G.TrashIcon,size:"sm"})})})]})}]},[f,P,O,M]);function ep(e){L(e),U(!0)}let eh=async()=>{if(null!=E&&null!=e)try{en(!0),await (0,_.deleteMCPServer)(e,E),S.default.success("Deleted MCP Server successfully"),A()}catch(e){console.error("Error deleting the mcp server:",e)}finally{en(!1),U(!1),L(null)}},eg=E?(T||[]).find(e=>e.server_id===E):null,ef=b.default.useMemo(()=>Y.find(e=>e.server_id===z)||{server_id:"",server_name:"",alias:"",url:"",transport:"",auth_type:"",created_at:"",created_by:"",updated_at:"",updated_by:""},[Y,z]),eb=b.default.useCallback(()=>{V(!1),B(null),A()},[A]);return e&&f&&N?(0,s.jsxs)("div",{className:"w-full h-full p-6",children:[(0,s.jsx)(p.Modal,{open:R,title:"Delete MCP Server?",onOk:eh,okText:ea?"Deleting...":"Delete",onCancel:()=>{U(!1),L(null)},cancelText:"Cancel",cancelButtonProps:{disabled:ea},okButtonProps:{danger:!0},confirmLoading:ea,children:(0,s.jsxs)("div",{className:"space-y-4",children:[(0,s.jsx)(s0,{className:"text-gray-600",children:"This action is permanent and cannot be undone. All associated configurations will be removed."}),eg&&(0,s.jsx)("div",{className:"mt-3 p-4 bg-gray-50 rounded-lg border border-gray-200",children:(0,s.jsxs)(x.Descriptions,{column:1,size:"small",colon:!1,children:[eg.server_name&&(0,s.jsx)(x.Descriptions.Item,{label:(0,s.jsx)("span",{className:"text-gray-500 text-sm",children:"Name"}),children:(0,s.jsx)(s0,{strong:!0,className:"text-sm",children:eg.server_name})}),(0,s.jsx)(x.Descriptions.Item,{label:(0,s.jsx)("span",{className:"text-gray-500 text-sm",children:"ID"}),children:(0,s.jsx)(s0,{code:!0,className:"text-xs",children:eg.server_id})}),eg.url&&(0,s.jsx)(x.Descriptions.Item,{label:(0,s.jsx)("span",{className:"text-gray-500 text-sm",children:"URL"}),children:(0,s.jsx)(s0,{code:!0,className:"text-xs break-all",children:eg.url})})]})})]})}),(0,s.jsx)(e5,{userRole:f,accessToken:e,onCreateSuccess:e=>{J(s=>[...s,e]),X(!1),A()},isModalVisible:Q,setModalVisible:X,availableAccessGroups:em,prefillData:et,onBackToDiscovery:()=>{X(!1),el(null),es(!0)}}),(0,s.jsxs)("div",{className:"flex items-center justify-between",children:[(0,s.jsxs)("div",{children:[(0,s.jsxs)("div",{className:"flex items-center gap-3",children:[(0,s.jsx)(m.Title,{children:"MCP Servers"}),Y.length>0&&(0,s.jsx)("span",{className:"inline-flex items-center text-xs font-medium px-2 py-0.5 rounded-full bg-gray-100 text-gray-600 border border-gray-200",children:Y.length})]}),(0,s.jsx)(d.Text,{className:"text-tremor-content mt-1",children:"Configure and manage your MCP servers"})]}),(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.isAdminRole)(f)&&(0,s.jsx)(l.Button,{className:"flex-shrink-0",onClick:()=>es(!0),children:"+ Add New MCP Server"}),!(0,t.isAdminRole)(f)&&(0,s.jsx)(l.Button,{className:"flex-shrink-0",onClick:()=>{el(null),X(!0)},variant:"secondary",children:"+ Submit MCP Server"})]})]}),(0,s.jsx)(sZ,{isVisible:ee,onClose:()=>es(!1),onSelectServer:e=>{el(e),es(!1),X(!0)},onCustomServer:()=>{el(null),es(!1),X(!0)},accessToken:e}),(0,s.jsxs)(n.TabGroup,{className:"w-full h-full",children:[(0,s.jsx)(i.TabList,{className:"flex justify-between mt-2 w-full items-center",children:(0,s.jsxs)("div",{className:"flex",children:[(0,s.jsx)(a.Tab,{children:"All Servers"}),(0,s.jsx)(a.Tab,{children:"Toolsets"}),(0,s.jsx)(a.Tab,{children:"Connect"}),(0,s.jsx)(a.Tab,{children:"Semantic Filter"}),(0,s.jsx)(a.Tab,{children:"Network Settings"}),(0,t.isAdminRole)(f)&&(0,s.jsx)(a.Tab,{children:(0,s.jsxs)("span",{className:"flex items-center gap-2",children:["Submitted MCPs ",(0,s.jsx)(u.default,{})]})})]})}),(0,s.jsxs)(c.TabPanels,{children:[(0,s.jsx)(o.TabPanel,{children:z?(0,s.jsx)(sI,{mcpServer:ef,onBack:eb,isProxyAdmin:(0,t.isAdminRole)(f),isEditing:q,accessToken:e,userID:N,userRole:f,availableAccessGroups:em},z):(0,s.jsxs)("div",{className:"w-full h-full",children:[(0,s.jsx)("div",{className:"w-full",children:(0,s.jsx)("div",{className:"flex flex-col space-y-4",children:(0,s.jsxs)("div",{className:"flex items-center gap-6 bg-white rounded-lg px-4 py-3 border border-gray-200",children:[(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)(d.Text,{className:"text-sm font-medium text-gray-600 whitespace-nowrap",children:"Team"}),(0,s.jsxs)(h.Select,{value:D,onChange:e=>{H(e),eu(e,K)},style:{width:220},size:"middle",children:[(0,s.jsx)(s1,{value:"all",children:(0,s.jsx)("span",{className:"font-medium",children:ec?"All Available Servers":"All Servers"})}),(0,s.jsx)(s1,{value:"personal",children:(0,s.jsx)("span",{className:"font-medium",children:"Personal"})}),ed.map(e=>(0,s.jsx)(s1,{value:e.team_id,children:(0,s.jsx)("span",{className:"font-medium",children:e.team_alias||e.team_id})},e.team_id))]})]}),(0,s.jsx)("div",{className:"h-6 w-px bg-gray-200"}),(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsxs)(d.Text,{className:"text-sm font-medium text-gray-600 whitespace-nowrap",children:["Access Group",(0,s.jsx)(g.Tooltip,{title:"An MCP Access Group is a set of users or teams that have permission to access specific MCP servers. Use access groups to control and organize who can connect to which servers.",children:(0,s.jsx)(r.QuestionCircleOutlined,{style:{marginLeft:4,color:"#9ca3af"}})})]}),(0,s.jsxs)(h.Select,{value:K,onChange:e=>{W(e),eu(D,e)},style:{width:220},size:"middle",children:[(0,s.jsx)(s1,{value:"all",children:(0,s.jsx)("span",{className:"font-medium",children:"All Access Groups"})}),em.map(e=>(0,s.jsx)(s1,{value:e,children:(0,s.jsx)("span",{className:"font-medium",children:e})},e))]})]})]})})}),(0,s.jsx)("div",{className:"w-full mt-6",children:(0,s.jsx)(Z.DataTable,{data:Y,columns:ex,renderSubComponent:()=>(0,s.jsx)("div",{}),getRowCanExpand:()=>!1,isLoading:k,noDataMessage:"No MCP servers configured. Click '+ Add New MCP Server' to get started.",loadingMessage:"Loading MCP servers...",enableSorting:!0})})]})}),(0,s.jsx)(o.TabPanel,{children:(0,s.jsx)(er,{accessToken:e,userRole:f})}),(0,s.jsx)(o.TabPanel,{children:(0,s.jsx)(so,{})}),(0,s.jsx)(o.TabPanel,{children:(0,s.jsx)(sH,{accessToken:e})}),(0,s.jsx)(o.TabPanel,{children:(0,s.jsx)(sY,{accessToken:e})}),(0,t.isAdminRole)(f)&&(0,s.jsx)(o.TabPanel,{children:(0,s.jsx)($,{accessToken:e})})]})]}),ei&&(0,s.jsx)(sX.ByokCredentialModal,{server:ei,open:!!ei,onClose:()=>eo(null),onSuccess:e=>{A(),eo(null)},accessToken:e||""})]}):(console.log("Missing required authentication parameters",{accessToken:e,userRole:f,userID:N}),(0,s.jsx)("div",{className:"p-6 text-center text-gray-500",children:"Missing required authentication parameters."}))}],280881)}]); \ No newline at end of file diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/11c5483d145114d0.js b/litellm/proxy/_experimental/out/_next/static/chunks/11c5483d145114d0.js new file mode 100644 index 0000000000..80f4c214d0 --- /dev/null +++ b/litellm/proxy/_experimental/out/_next/static/chunks/11c5483d145114d0.js @@ -0,0 +1 @@ +(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,349356,e=>{e.v({AElig:"Æ",AMP:"&",Aacute:"Á",Acirc:"Â",Agrave:"À",Aring:"Å",Atilde:"Ã",Auml:"Ä",COPY:"©",Ccedil:"Ç",ETH:"Ð",Eacute:"É",Ecirc:"Ê",Egrave:"È",Euml:"Ë",GT:">",Iacute:"Í",Icirc:"Î",Igrave:"Ì",Iuml:"Ï",LT:"<",Ntilde:"Ñ",Oacute:"Ó",Ocirc:"Ô",Ograve:"Ò",Oslash:"Ø",Otilde:"Õ",Ouml:"Ö",QUOT:'"',REG:"®",THORN:"Þ",Uacute:"Ú",Ucirc:"Û",Ugrave:"Ù",Uuml:"Ü",Yacute:"Ý",aacute:"á",acirc:"â",acute:"´",aelig:"æ",agrave:"à",amp:"&",aring:"å",atilde:"ã",auml:"ä",brvbar:"¦",ccedil:"ç",cedil:"¸",cent:"¢",copy:"©",curren:"¤",deg:"°",divide:"÷",eacute:"é",ecirc:"ê",egrave:"è",eth:"ð",euml:"ë",frac12:"½",frac14:"¼",frac34:"¾",gt:">",iacute:"í",icirc:"î",iexcl:"¡",igrave:"ì",iquest:"¿",iuml:"ï",laquo:"«",lt:"<",macr:"¯",micro:"µ",middot:"·",nbsp:" ",not:"¬",ntilde:"ñ",oacute:"ó",ocirc:"ô",ograve:"ò",ordf:"ª",ordm:"º",oslash:"ø",otilde:"õ",ouml:"ö",para:"¶",plusmn:"±",pound:"£",quot:'"',raquo:"»",reg:"®",sect:"§",shy:"­",sup1:"¹",sup2:"²",sup3:"³",szlig:"ß",thorn:"þ",times:"×",uacute:"ú",ucirc:"û",ugrave:"ù",uml:"¨",uuml:"ü",yacute:"ý",yen:"¥",yuml:"ÿ"})},137429,e=>{e.v({0:"�",128:"€",130:"‚",131:"ƒ",132:"„",133:"…",134:"†",135:"‡",136:"ˆ",137:"‰",138:"Š",139:"‹",140:"Œ",142:"Ž",145:"‘",146:"’",147:"“",148:"”",149:"•",150:"–",151:"—",152:"˜",153:"™",154:"š",155:"›",156:"œ",158:"ž",159:"Ÿ"})},246349,e=>{"use strict";let t=(0,e.i(475254).default)("chevron-right",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);e.s(["default",()=>t])},841947,e=>{"use strict";let t=(0,e.i(475254).default)("x",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);e.s(["default",()=>t])},603908,e=>{"use strict";let t=(0,e.i(475254).default)("plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);e.s(["default",()=>t])},107233,37727,e=>{"use strict";var t=e.i(603908);e.s(["Plus",()=>t.default],107233);var r=e.i(841947);e.s(["X",()=>r.default],37727)},689020,e=>{"use strict";var t=e.i(764205);let r=async e=>{try{let r=await (0,t.modelHubCall)(e);if(console.log("model_info:",r),r?.data.length>0){let e=r.data.map(e=>({model_group:e.model_group,mode:e?.mode}));return e.sort((e,t)=>e.model_group.localeCompare(t.model_group)),e}return[]}catch(e){throw console.error("Error fetching model info:",e),e}};e.s(["fetchAvailableModels",0,r])},737434,e=>{"use strict";var t=e.i(184163);e.s(["DownloadOutlined",()=>t.default])},916940,e=>{"use strict";var t=e.i(843476),r=e.i(271645),i=e.i(199133),o=e.i(764205);e.s(["default",0,({onChange:e,value:n,className:s,accessToken:a,placeholder:l="Select vector stores",disabled:c=!1})=>{let[d,h]=(0,r.useState)([]),[u,f]=(0,r.useState)(!1);return(0,r.useEffect)(()=>{(async()=>{if(a){f(!0);try{let e=await (0,o.vectorStoreListCall)(a);e.data&&h(e.data)}catch(e){console.error("Error fetching vector stores:",e)}finally{f(!1)}}})()},[a]),(0,t.jsx)("div",{children:(0,t.jsx)(i.Select,{mode:"multiple",placeholder:l,onChange:e,value:n,loading:u,className:s,allowClear:!0,options:d.map(e=>({label:`${e.vector_store_name||e.vector_store_id} (${e.vector_store_id})`,value:e.vector_store_id,title:e.vector_store_description||e.vector_store_id})),optionFilterProp:"label",showSearch:!0,style:{width:"100%"},disabled:c})})}])},59935,(e,t,r)=>{var i;let o;e.e,i=function e(){var t,r="u">typeof self?self:"u">typeof window?window:void 0!==r?r:{},i=!r.document&&!!r.postMessage,o=r.IS_PAPA_WORKER||!1,n={},s=0,a={};function l(e){this._handle=null,this._finished=!1,this._completed=!1,this._halted=!1,this._input=null,this._baseIndex=0,this._partialLine="",this._rowCount=0,this._start=0,this._nextChunk=null,this.isFirstChunk=!0,this._completeResults={data:[],errors:[],meta:{}},(function(e){var t=v(e);t.chunkSize=parseInt(t.chunkSize),e.step||e.chunk||(t.chunkSize=null),this._handle=new f(t),(this._handle.streamer=this)._config=t}).call(this,e),this.parseChunk=function(e,t){var i=parseInt(this._config.skipFirstNLines)||0;if(this.isFirstChunk&&0=this._config.preview,o)r.postMessage({results:n,workerId:a.WORKER_ID,finished:i});else if(x(this._config.chunk)&&!t){if(this._config.chunk(n,this._handle),this._handle.paused()||this._handle.aborted())return void(this._halted=!0);this._completeResults=n=void 0}return this._config.step||this._config.chunk||(this._completeResults.data=this._completeResults.data.concat(n.data),this._completeResults.errors=this._completeResults.errors.concat(n.errors),this._completeResults.meta=n.meta),this._completed||!i||!x(this._config.complete)||n&&n.meta.aborted||(this._config.complete(this._completeResults,this._input),this._completed=!0),i||n&&n.meta.paused||this._nextChunk(),n}this._halted=!0},this._sendError=function(e){x(this._config.error)?this._config.error(e):o&&this._config.error&&r.postMessage({workerId:a.WORKER_ID,error:e,finished:!1})}}function c(e){var t;(e=e||{}).chunkSize||(e.chunkSize=a.RemoteChunkSize),l.call(this,e),this._nextChunk=i?function(){this._readChunk(),this._chunkLoaded()}:function(){this._readChunk()},this.stream=function(e){this._input=e,this._nextChunk()},this._readChunk=function(){if(this._finished)this._chunkLoaded();else{if(t=new XMLHttpRequest,this._config.withCredentials&&(t.withCredentials=this._config.withCredentials),i||(t.onload=y(this._chunkLoaded,this),t.onerror=y(this._chunkError,this)),t.open(this._config.downloadRequestBody?"POST":"GET",this._input,!i),this._config.downloadRequestHeaders){var e,r,o=this._config.downloadRequestHeaders;for(r in o)t.setRequestHeader(r,o[r])}this._config.chunkSize&&(e=this._start+this._config.chunkSize-1,t.setRequestHeader("Range","bytes="+this._start+"-"+e));try{t.send(this._config.downloadRequestBody)}catch(e){this._chunkError(e.message)}i&&0===t.status&&this._chunkError()}},this._chunkLoaded=function(){let e;4===t.readyState&&(t.status<200||400<=t.status?this._chunkError():(this._start+=this._config.chunkSize||t.responseText.length,this._finished=!this._config.chunkSize||this._start>=(null!==(e=(e=t).getResponseHeader("Content-Range"))?parseInt(e.substring(e.lastIndexOf("/")+1)):-1),this.parseChunk(t.responseText)))},this._chunkError=function(e){e=t.statusText||e,this._sendError(Error(e))}}function d(e){(e=e||{}).chunkSize||(e.chunkSize=a.LocalChunkSize),l.call(this,e);var t,r,i="u">typeof FileReader;this.stream=function(e){this._input=e,r=e.slice||e.webkitSlice||e.mozSlice,i?((t=new FileReader).onload=y(this._chunkLoaded,this),t.onerror=y(this._chunkError,this)):t=new FileReaderSync,this._nextChunk()},this._nextChunk=function(){this._finished||this._config.preview&&!(this._rowCount=this._input.size,this.parseChunk(e.target.result)},this._chunkError=function(){this._sendError(t.error)}}function h(e){var t;l.call(this,e=e||{}),this.stream=function(e){return t=e,this._nextChunk()},this._nextChunk=function(){var e,r;if(!this._finished)return t=(e=this._config.chunkSize)?(r=t.substring(0,e),t.substring(e)):(r=t,""),this._finished=!t,this.parseChunk(r)}}function u(e){l.call(this,e=e||{});var t=[],r=!0,i=!1;this.pause=function(){l.prototype.pause.apply(this,arguments),this._input.pause()},this.resume=function(){l.prototype.resume.apply(this,arguments),this._input.resume()},this.stream=function(e){this._input=e,this._input.on("data",this._streamData),this._input.on("end",this._streamEnd),this._input.on("error",this._streamError)},this._checkIsFinished=function(){i&&1===t.length&&(this._finished=!0)},this._nextChunk=function(){this._checkIsFinished(),t.length?this.parseChunk(t.shift()):r=!0},this._streamData=y(function(e){try{t.push("string"==typeof e?e:e.toString(this._config.encoding)),r&&(r=!1,this._checkIsFinished(),this.parseChunk(t.shift()))}catch(e){this._streamError(e)}},this),this._streamError=y(function(e){this._streamCleanUp(),this._sendError(e)},this),this._streamEnd=y(function(){this._streamCleanUp(),i=!0,this._streamData("")},this),this._streamCleanUp=y(function(){this._input.removeListener("data",this._streamData),this._input.removeListener("end",this._streamEnd),this._input.removeListener("error",this._streamError)},this)}function f(e){var t,r,i,o,n=/^\s*-?(\d+\.?|\.\d+|\d+\.\d+)([eE][-+]?\d+)?\s*$/,s=/^((\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\.\d+([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z)))$/,l=this,c=0,d=0,h=!1,u=!1,f=[],m={data:[],errors:[],meta:{}};function b(t){return"greedy"===e.skipEmptyLines?""===t.join("").trim():1===t.length&&0===t[0].length}function k(){if(m&&i&&(_("Delimiter","UndetectableDelimiter","Unable to auto-detect delimiting character; defaulted to '"+a.DefaultDelimiter+"'"),i=!1),e.skipEmptyLines&&(m.data=m.data.filter(function(e){return!b(e)})),y()){if(m)if(Array.isArray(m.data[0])){for(var t,r=0;y()&&r(e.dynamicTypingFunction&&void 0===e.dynamicTyping[t]&&(e.dynamicTyping[t]=e.dynamicTypingFunction(t)),!0===(e.dynamicTyping[t]||e.dynamicTyping))?"true"===r||"TRUE"===r||"false"!==r&&"FALSE"!==r&&((e=>{if(n.test(e)&&-0x20000000000000<(e=parseFloat(e))&&e<0x20000000000000)return 1})(r)?parseFloat(r):s.test(r)?new Date(r):""===r?null:r):r)(a=e.header?o>=f.length?"__parsed_extra":f[o]:a,l=e.transform?e.transform(l,a):l);"__parsed_extra"===a?(i[a]=i[a]||[],i[a].push(l)):i[a]=l}return e.header&&(o>f.length?_("FieldMismatch","TooManyFields","Too many fields: expected "+f.length+" fields but parsed "+o,d+r):oe.preview?r.abort():(m.data=m.data[0],o(m,l))))}),this.parse=function(o,n,s){var l=e.quoteChar||'"',l=(e.newline||(e.newline=this.guessLineEndings(o,l)),i=!1,e.delimiter?x(e.delimiter)&&(e.delimiter=e.delimiter(o),m.meta.delimiter=e.delimiter):((l=((t,r,i,o,n)=>{var s,l,c,d;n=n||[","," ","|",";",a.RECORD_SEP,a.UNIT_SEP];for(var h=0;h=r.length/2?"\r\n":"\r"}}function p(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function g(e){var t=(e=e||{}).delimiter,r=e.newline,i=e.comments,o=e.step,n=e.preview,s=e.fastMode,l=null,c=!1,d=null==e.quoteChar?'"':e.quoteChar,h=d;if(void 0!==e.escapeChar&&(h=e.escapeChar),("string"!=typeof t||-1=n)return D(!0);break}C.push({type:"Quotes",code:"InvalidQuotes",message:"Trailing quote on quoted field is malformed",row:w.length,index:u}),A++}}else if(i&&0===S.length&&a.substring(u,u+y)===i){if(-1===z)return D();u=z+v,z=a.indexOf(r,u),O=a.indexOf(t,u)}else if(-1!==O&&(O=n)return D(!0)}return I();function L(e){w.push(e),j=u}function T(e){return -1!==e&&(e=a.substring(A+1,e))&&""===e.trim()?e.length:0}function I(e){return m||(void 0===e&&(e=a.substring(u)),S.push(e),u=b,L(S),_&&P()),D()}function F(e){u=e,L(S),S=[],z=a.indexOf(r,u)}function D(i){if(e.header&&!g&&w.length&&!c){var o=w[0],n=Object.create(null),s=new Set(o);let t=!1;for(let r=0;r{if("object"==typeof t){if("string"!=typeof t.delimiter||a.BAD_DELIMITERS.filter(function(e){return -1!==t.delimiter.indexOf(e)}).length||(o=t.delimiter),("boolean"==typeof t.quotes||"function"==typeof t.quotes||Array.isArray(t.quotes))&&(r=t.quotes),"boolean"!=typeof t.skipEmptyLines&&"string"!=typeof t.skipEmptyLines||(c=t.skipEmptyLines),"string"==typeof t.newline&&(n=t.newline),"string"==typeof t.quoteChar&&(s=t.quoteChar),"boolean"==typeof t.header&&(i=t.header),Array.isArray(t.columns)){if(0===t.columns.length)throw Error("Option columns is empty");d=t.columns}void 0!==t.escapeChar&&(l=t.escapeChar+s),t.escapeFormulae instanceof RegExp?h=t.escapeFormulae:"boolean"==typeof t.escapeFormulae&&t.escapeFormulae&&(h=/^[=+\-@\t\r].*$/)}})(),RegExp(p(s),"g"));if("string"==typeof e&&(e=JSON.parse(e)),Array.isArray(e)){if(!e.length||Array.isArray(e[0]))return f(null,e,c);if("object"==typeof e[0])return f(d||Object.keys(e[0]),e,c)}else if("object"==typeof e)return"string"==typeof e.data&&(e.data=JSON.parse(e.data)),Array.isArray(e.data)&&(e.fields||(e.fields=e.meta&&e.meta.fields||d),e.fields||(e.fields=Array.isArray(e.data[0])?e.fields:"object"==typeof e.data[0]?Object.keys(e.data[0]):[]),Array.isArray(e.data[0])||"object"==typeof e.data[0]||(e.data=[e.data])),f(e.fields||[],e.data||[],c);throw Error("Unable to serialize unrecognized input");function f(e,t,r){var s="",a=("string"==typeof e&&(e=JSON.parse(e)),"string"==typeof t&&(t=JSON.parse(t)),Array.isArray(e)&&0{for(var r=0;r{"use strict";var t=e.i(843476),r=e.i(271645),i=e.i(199133),o=e.i(764205);function n(e){return e.filter(e=>(e.version_status??"draft")!=="draft").map(e=>{var t;let r=e.version_number??1,i=e.version_status??"draft";return{label:`${e.policy_name} — v${r} (${i})${e.description?` — ${e.description}`:""}`,value:"production"===i?e.policy_name:e.policy_id?(t=e.policy_id,`policy_${t}`):e.policy_name}})}e.s(["default",0,({onChange:e,value:s,className:a,accessToken:l,disabled:c,onPoliciesLoaded:d})=>{let[h,u]=(0,r.useState)([]),[f,p]=(0,r.useState)(!1);return(0,r.useEffect)(()=>{(async()=>{if(l){p(!0);try{let e=await (0,o.getPoliciesList)(l);e.policies&&(u(e.policies),d?.(e.policies))}catch(e){console.error("Error fetching policies:",e)}finally{p(!1)}}})()},[l,d]),(0,t.jsx)("div",{children:(0,t.jsx)(i.Select,{mode:"multiple",disabled:c,placeholder:c?"Setting policies is a premium feature.":"Select policies (production or published versions)",onChange:t=>{e(t)},value:s,loading:f,className:a,allowClear:!0,options:n(h),optionFilterProp:"label",showSearch:!0,style:{width:"100%"}})})},"getPolicyOptionEntries",()=>n])},891547,e=>{"use strict";var t=e.i(843476),r=e.i(271645),i=e.i(199133),o=e.i(764205);e.s(["default",0,({onChange:e,value:n,className:s,accessToken:a,disabled:l})=>{let[c,d]=(0,r.useState)([]),[h,u]=(0,r.useState)(!1);return(0,r.useEffect)(()=>{(async()=>{if(a){u(!0);try{let e=await (0,o.getGuardrailsList)(a);console.log("Guardrails response:",e),e.guardrails&&(console.log("Guardrails data:",e.guardrails),d(e.guardrails))}catch(e){console.error("Error fetching guardrails:",e)}finally{u(!1)}}})()},[a]),(0,t.jsx)("div",{children:(0,t.jsx)(i.Select,{mode:"multiple",disabled:l,placeholder:l?"Setting guardrails is a premium feature.":"Select guardrails",onChange:t=>{console.log("Selected guardrails:",t),e(t)},value:n,loading:h,className:s,allowClear:!0,options:c.map(e=>(console.log("Mapping guardrail:",e),{label:`${e.guardrail_name}`,value:e.guardrail_name})),optionFilterProp:"label",showSearch:!0,style:{width:"100%"}})})}])},637235,e=>{"use strict";e.i(247167);var t=e.i(931067),r=e.i(271645);let i={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z"}},{tag:"path",attrs:{d:"M686.7 638.6L544.1 535.5V288c0-4.4-3.6-8-8-8H488c-4.4 0-8 3.6-8 8v275.4c0 2.6 1.2 5 3.3 6.5l165.4 120.6c3.6 2.6 8.6 1.8 11.2-1.7l28.6-39c2.6-3.7 1.8-8.7-1.8-11.2z"}}]},name:"clock-circle",theme:"outlined"};var o=e.i(9583),n=r.forwardRef(function(e,n){return r.createElement(o.default,(0,t.default)({},e,{ref:n,icon:i}))});e.s(["ClockCircleOutlined",0,n],637235)},646563,e=>{"use strict";var t=e.i(959013);e.s(["PlusOutlined",()=>t.default])},447566,e=>{"use strict";e.i(247167);var t=e.i(931067),r=e.i(271645);let i={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M872 474H286.9l350.2-304c5.6-4.9 2.2-14-5.2-14h-88.5c-3.9 0-7.6 1.4-10.5 3.9L155 487.8a31.96 31.96 0 000 48.3L535.1 866c1.5 1.3 3.3 2 5.2 2h91.5c7.4 0 10.8-9.2 5.2-14L286.9 550H872c4.4 0 8-3.6 8-8v-60c0-4.4-3.6-8-8-8z"}}]},name:"arrow-left",theme:"outlined"};var o=e.i(9583),n=r.forwardRef(function(e,n){return r.createElement(o.default,(0,t.default)({},e,{ref:n,icon:i}))});e.s(["ArrowLeftOutlined",0,n],447566)},367240,555436,e=>{"use strict";let t=(0,e.i(475254).default)("rotate-ccw",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]]);e.s(["RotateCcw",()=>t],367240);var r=e.i(54943);e.s(["Search",()=>r.default],555436)},431343,569074,e=>{"use strict";var t=e.i(475254);let r=(0,t.default)("play",[["polygon",{points:"6 3 20 12 6 21 6 3",key:"1oa8hb"}]]);e.s(["Play",()=>r],431343);let i=(0,t.default)("upload",[["path",{d:"M12 3v12",key:"1x0j5s"}],["path",{d:"m17 8-5-5-5 5",key:"7q97r8"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}]]);e.s(["Upload",()=>i],569074)},531245,657150,e=>{"use strict";let t=(0,e.i(475254).default)("bot",[["path",{d:"M12 8V4H8",key:"hb8ula"}],["rect",{width:"16",height:"12",x:"4",y:"8",rx:"2",key:"enze0r"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M15 13v2",key:"1xurst"}],["path",{d:"M9 13v2",key:"rq6x2g"}]]);e.s(["default",()=>t],657150),e.s(["Bot",()=>t],531245)},98919,e=>{"use strict";var t=e.i(918549);e.s(["Shield",()=>t.default])},918549,e=>{"use strict";let t=(0,e.i(475254).default)("shield",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}]]);e.s(["default",()=>t])},727612,e=>{"use strict";let t=(0,e.i(475254).default)("trash-2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]]);e.s(["Trash2",()=>t],727612)},673709,e=>{"use strict";var t=e.i(843476),r=e.i(271645),i=e.i(678784);let o=(0,e.i(475254).default)("clipboard",[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",key:"116196"}]]);var n=e.i(650056);let s={'code[class*="language-"]':{background:"hsl(230, 1%, 98%)",color:"hsl(230, 8%, 24%)",fontFamily:'"Fira Code", "Fira Mono", Menlo, Consolas, "DejaVu Sans Mono", monospace',direction:"ltr",textAlign:"left",whiteSpace:"pre",wordSpacing:"normal",wordBreak:"normal",lineHeight:"1.5",MozTabSize:"2",OTabSize:"2",tabSize:"2",WebkitHyphens:"none",MozHyphens:"none",msHyphens:"none",hyphens:"none"},'pre[class*="language-"]':{background:"hsl(230, 1%, 98%)",color:"hsl(230, 8%, 24%)",fontFamily:'"Fira Code", "Fira Mono", Menlo, Consolas, "DejaVu Sans Mono", monospace',direction:"ltr",textAlign:"left",whiteSpace:"pre",wordSpacing:"normal",wordBreak:"normal",lineHeight:"1.5",MozTabSize:"2",OTabSize:"2",tabSize:"2",WebkitHyphens:"none",MozHyphens:"none",msHyphens:"none",hyphens:"none",padding:"1em",margin:"0.5em 0",overflow:"auto",borderRadius:"0.3em"},'code[class*="language-"]::-moz-selection':{background:"hsl(230, 1%, 90%)",color:"inherit"},'code[class*="language-"] *::-moz-selection':{background:"hsl(230, 1%, 90%)",color:"inherit"},'pre[class*="language-"] *::-moz-selection':{background:"hsl(230, 1%, 90%)",color:"inherit"},'code[class*="language-"]::selection':{background:"hsl(230, 1%, 90%)",color:"inherit"},'code[class*="language-"] *::selection':{background:"hsl(230, 1%, 90%)",color:"inherit"},'pre[class*="language-"] *::selection':{background:"hsl(230, 1%, 90%)",color:"inherit"},':not(pre) > code[class*="language-"]':{padding:"0.2em 0.3em",borderRadius:"0.3em",whiteSpace:"normal"},comment:{color:"hsl(230, 4%, 64%)",fontStyle:"italic"},prolog:{color:"hsl(230, 4%, 64%)"},cdata:{color:"hsl(230, 4%, 64%)"},doctype:{color:"hsl(230, 8%, 24%)"},punctuation:{color:"hsl(230, 8%, 24%)"},entity:{color:"hsl(230, 8%, 24%)",cursor:"help"},"attr-name":{color:"hsl(35, 99%, 36%)"},"class-name":{color:"hsl(35, 99%, 36%)"},boolean:{color:"hsl(35, 99%, 36%)"},constant:{color:"hsl(35, 99%, 36%)"},number:{color:"hsl(35, 99%, 36%)"},atrule:{color:"hsl(35, 99%, 36%)"},keyword:{color:"hsl(301, 63%, 40%)"},property:{color:"hsl(5, 74%, 59%)"},tag:{color:"hsl(5, 74%, 59%)"},symbol:{color:"hsl(5, 74%, 59%)"},deleted:{color:"hsl(5, 74%, 59%)"},important:{color:"hsl(5, 74%, 59%)"},selector:{color:"hsl(119, 34%, 47%)"},string:{color:"hsl(119, 34%, 47%)"},char:{color:"hsl(119, 34%, 47%)"},builtin:{color:"hsl(119, 34%, 47%)"},inserted:{color:"hsl(119, 34%, 47%)"},regex:{color:"hsl(119, 34%, 47%)"},"attr-value":{color:"hsl(119, 34%, 47%)"},"attr-value > .token.punctuation":{color:"hsl(119, 34%, 47%)"},variable:{color:"hsl(221, 87%, 60%)"},operator:{color:"hsl(221, 87%, 60%)"},function:{color:"hsl(221, 87%, 60%)"},url:{color:"hsl(198, 99%, 37%)"},"attr-value > .token.punctuation.attr-equals":{color:"hsl(230, 8%, 24%)"},"special-attr > .token.attr-value > .token.value.css":{color:"hsl(230, 8%, 24%)"},".language-css .token.selector":{color:"hsl(5, 74%, 59%)"},".language-css .token.property":{color:"hsl(230, 8%, 24%)"},".language-css .token.function":{color:"hsl(198, 99%, 37%)"},".language-css .token.url > .token.function":{color:"hsl(198, 99%, 37%)"},".language-css .token.url > .token.string.url":{color:"hsl(119, 34%, 47%)"},".language-css .token.important":{color:"hsl(301, 63%, 40%)"},".language-css .token.atrule .token.rule":{color:"hsl(301, 63%, 40%)"},".language-javascript .token.operator":{color:"hsl(301, 63%, 40%)"},".language-javascript .token.template-string > .token.interpolation > .token.interpolation-punctuation.punctuation":{color:"hsl(344, 84%, 43%)"},".language-json .token.operator":{color:"hsl(230, 8%, 24%)"},".language-json .token.null.keyword":{color:"hsl(35, 99%, 36%)"},".language-markdown .token.url":{color:"hsl(230, 8%, 24%)"},".language-markdown .token.url > .token.operator":{color:"hsl(230, 8%, 24%)"},".language-markdown .token.url-reference.url > .token.string":{color:"hsl(230, 8%, 24%)"},".language-markdown .token.url > .token.content":{color:"hsl(221, 87%, 60%)"},".language-markdown .token.url > .token.url":{color:"hsl(198, 99%, 37%)"},".language-markdown .token.url-reference.url":{color:"hsl(198, 99%, 37%)"},".language-markdown .token.blockquote.punctuation":{color:"hsl(230, 4%, 64%)",fontStyle:"italic"},".language-markdown .token.hr.punctuation":{color:"hsl(230, 4%, 64%)",fontStyle:"italic"},".language-markdown .token.code-snippet":{color:"hsl(119, 34%, 47%)"},".language-markdown .token.bold .token.content":{color:"hsl(35, 99%, 36%)"},".language-markdown .token.italic .token.content":{color:"hsl(301, 63%, 40%)"},".language-markdown .token.strike .token.content":{color:"hsl(5, 74%, 59%)"},".language-markdown .token.strike .token.punctuation":{color:"hsl(5, 74%, 59%)"},".language-markdown .token.list.punctuation":{color:"hsl(5, 74%, 59%)"},".language-markdown .token.title.important > .token.punctuation":{color:"hsl(5, 74%, 59%)"},bold:{fontWeight:"bold"},italic:{fontStyle:"italic"},namespace:{Opacity:"0.8"},"token.tab:not(:empty):before":{color:"hsla(230, 8%, 24%, 0.2)"},"token.cr:before":{color:"hsla(230, 8%, 24%, 0.2)"},"token.lf:before":{color:"hsla(230, 8%, 24%, 0.2)"},"token.space:before":{color:"hsla(230, 8%, 24%, 0.2)"},"div.code-toolbar > .toolbar.toolbar > .toolbar-item":{marginRight:"0.4em"},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > button":{background:"hsl(230, 1%, 90%)",color:"hsl(230, 6%, 44%)",padding:"0.1em 0.4em",borderRadius:"0.3em"},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > a":{background:"hsl(230, 1%, 90%)",color:"hsl(230, 6%, 44%)",padding:"0.1em 0.4em",borderRadius:"0.3em"},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > span":{background:"hsl(230, 1%, 90%)",color:"hsl(230, 6%, 44%)",padding:"0.1em 0.4em",borderRadius:"0.3em"},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > button:hover":{background:"hsl(230, 1%, 78%)",color:"hsl(230, 8%, 24%)"},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > button:focus":{background:"hsl(230, 1%, 78%)",color:"hsl(230, 8%, 24%)"},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > a:hover":{background:"hsl(230, 1%, 78%)",color:"hsl(230, 8%, 24%)"},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > a:focus":{background:"hsl(230, 1%, 78%)",color:"hsl(230, 8%, 24%)"},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > span:hover":{background:"hsl(230, 1%, 78%)",color:"hsl(230, 8%, 24%)"},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > span:focus":{background:"hsl(230, 1%, 78%)",color:"hsl(230, 8%, 24%)"},".line-highlight.line-highlight":{background:"hsla(230, 8%, 24%, 0.05)"},".line-highlight.line-highlight:before":{background:"hsl(230, 1%, 90%)",color:"hsl(230, 8%, 24%)",padding:"0.1em 0.6em",borderRadius:"0.3em",boxShadow:"0 2px 0 0 rgba(0, 0, 0, 0.2)"},".line-highlight.line-highlight[data-end]:after":{background:"hsl(230, 1%, 90%)",color:"hsl(230, 8%, 24%)",padding:"0.1em 0.6em",borderRadius:"0.3em",boxShadow:"0 2px 0 0 rgba(0, 0, 0, 0.2)"},"pre[id].linkable-line-numbers.linkable-line-numbers span.line-numbers-rows > span:hover:before":{backgroundColor:"hsla(230, 8%, 24%, 0.05)"},".line-numbers.line-numbers .line-numbers-rows":{borderRightColor:"hsla(230, 8%, 24%, 0.2)"},".command-line .command-line-prompt":{borderRightColor:"hsla(230, 8%, 24%, 0.2)"},".line-numbers .line-numbers-rows > span:before":{color:"hsl(230, 1%, 62%)"},".command-line .command-line-prompt > span:before":{color:"hsl(230, 1%, 62%)"},".rainbow-braces .token.token.punctuation.brace-level-1":{color:"hsl(5, 74%, 59%)"},".rainbow-braces .token.token.punctuation.brace-level-5":{color:"hsl(5, 74%, 59%)"},".rainbow-braces .token.token.punctuation.brace-level-9":{color:"hsl(5, 74%, 59%)"},".rainbow-braces .token.token.punctuation.brace-level-2":{color:"hsl(119, 34%, 47%)"},".rainbow-braces .token.token.punctuation.brace-level-6":{color:"hsl(119, 34%, 47%)"},".rainbow-braces .token.token.punctuation.brace-level-10":{color:"hsl(119, 34%, 47%)"},".rainbow-braces .token.token.punctuation.brace-level-3":{color:"hsl(221, 87%, 60%)"},".rainbow-braces .token.token.punctuation.brace-level-7":{color:"hsl(221, 87%, 60%)"},".rainbow-braces .token.token.punctuation.brace-level-11":{color:"hsl(221, 87%, 60%)"},".rainbow-braces .token.token.punctuation.brace-level-4":{color:"hsl(301, 63%, 40%)"},".rainbow-braces .token.token.punctuation.brace-level-8":{color:"hsl(301, 63%, 40%)"},".rainbow-braces .token.token.punctuation.brace-level-12":{color:"hsl(301, 63%, 40%)"},"pre.diff-highlight > code .token.token.deleted:not(.prefix)":{backgroundColor:"hsla(353, 100%, 66%, 0.15)"},"pre > code.diff-highlight .token.token.deleted:not(.prefix)":{backgroundColor:"hsla(353, 100%, 66%, 0.15)"},"pre.diff-highlight > code .token.token.deleted:not(.prefix)::-moz-selection":{backgroundColor:"hsla(353, 95%, 66%, 0.25)"},"pre.diff-highlight > code .token.token.deleted:not(.prefix) *::-moz-selection":{backgroundColor:"hsla(353, 95%, 66%, 0.25)"},"pre > code.diff-highlight .token.token.deleted:not(.prefix)::-moz-selection":{backgroundColor:"hsla(353, 95%, 66%, 0.25)"},"pre > code.diff-highlight .token.token.deleted:not(.prefix) *::-moz-selection":{backgroundColor:"hsla(353, 95%, 66%, 0.25)"},"pre.diff-highlight > code .token.token.deleted:not(.prefix)::selection":{backgroundColor:"hsla(353, 95%, 66%, 0.25)"},"pre.diff-highlight > code .token.token.deleted:not(.prefix) *::selection":{backgroundColor:"hsla(353, 95%, 66%, 0.25)"},"pre > code.diff-highlight .token.token.deleted:not(.prefix)::selection":{backgroundColor:"hsla(353, 95%, 66%, 0.25)"},"pre > code.diff-highlight .token.token.deleted:not(.prefix) *::selection":{backgroundColor:"hsla(353, 95%, 66%, 0.25)"},"pre.diff-highlight > code .token.token.inserted:not(.prefix)":{backgroundColor:"hsla(137, 100%, 55%, 0.15)"},"pre > code.diff-highlight .token.token.inserted:not(.prefix)":{backgroundColor:"hsla(137, 100%, 55%, 0.15)"},"pre.diff-highlight > code .token.token.inserted:not(.prefix)::-moz-selection":{backgroundColor:"hsla(135, 73%, 55%, 0.25)"},"pre.diff-highlight > code .token.token.inserted:not(.prefix) *::-moz-selection":{backgroundColor:"hsla(135, 73%, 55%, 0.25)"},"pre > code.diff-highlight .token.token.inserted:not(.prefix)::-moz-selection":{backgroundColor:"hsla(135, 73%, 55%, 0.25)"},"pre > code.diff-highlight .token.token.inserted:not(.prefix) *::-moz-selection":{backgroundColor:"hsla(135, 73%, 55%, 0.25)"},"pre.diff-highlight > code .token.token.inserted:not(.prefix)::selection":{backgroundColor:"hsla(135, 73%, 55%, 0.25)"},"pre.diff-highlight > code .token.token.inserted:not(.prefix) *::selection":{backgroundColor:"hsla(135, 73%, 55%, 0.25)"},"pre > code.diff-highlight .token.token.inserted:not(.prefix)::selection":{backgroundColor:"hsla(135, 73%, 55%, 0.25)"},"pre > code.diff-highlight .token.token.inserted:not(.prefix) *::selection":{backgroundColor:"hsla(135, 73%, 55%, 0.25)"},".prism-previewer.prism-previewer:before":{borderColor:"hsl(0, 0, 95%)"},".prism-previewer-gradient.prism-previewer-gradient div":{borderColor:"hsl(0, 0, 95%)",borderRadius:"0.3em"},".prism-previewer-color.prism-previewer-color:before":{borderRadius:"0.3em"},".prism-previewer-easing.prism-previewer-easing:before":{borderRadius:"0.3em"},".prism-previewer.prism-previewer:after":{borderTopColor:"hsl(0, 0, 95%)"},".prism-previewer-flipped.prism-previewer-flipped.after":{borderBottomColor:"hsl(0, 0, 95%)"},".prism-previewer-angle.prism-previewer-angle:before":{background:"hsl(0, 0%, 100%)"},".prism-previewer-time.prism-previewer-time:before":{background:"hsl(0, 0%, 100%)"},".prism-previewer-easing.prism-previewer-easing":{background:"hsl(0, 0%, 100%)"},".prism-previewer-angle.prism-previewer-angle circle":{stroke:"hsl(230, 8%, 24%)",strokeOpacity:"1"},".prism-previewer-time.prism-previewer-time circle":{stroke:"hsl(230, 8%, 24%)",strokeOpacity:"1"},".prism-previewer-easing.prism-previewer-easing circle":{stroke:"hsl(230, 8%, 24%)",fill:"transparent"},".prism-previewer-easing.prism-previewer-easing path":{stroke:"hsl(230, 8%, 24%)"},".prism-previewer-easing.prism-previewer-easing line":{stroke:"hsl(230, 8%, 24%)"}};e.s(["default",0,({code:e,language:a})=>{let[l,c]=(0,r.useState)(!1);return(0,t.jsxs)("div",{className:"relative rounded-lg border border-gray-200 overflow-hidden",children:[(0,t.jsx)("button",{onClick:()=>{navigator.clipboard.writeText(e),c(!0),setTimeout(()=>c(!1),2e3)},className:"absolute top-3 right-3 p-2 rounded-md bg-gray-100 hover:bg-gray-200 text-gray-600 z-10","aria-label":"Copy code",children:l?(0,t.jsx)(i.CheckIcon,{size:16}):(0,t.jsx)(o,{size:16})}),(0,t.jsx)(n.Prism,{language:a,style:s,customStyle:{margin:0,padding:"1.5rem",borderRadius:"0.5rem",fontSize:"0.9rem",backgroundColor:"#fafafa"},showLineNumbers:!0,children:e})]})}],673709)},678784,678745,e=>{"use strict";let t=(0,e.i(475254).default)("check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);e.s(["default",()=>t],678745),e.s(["CheckIcon",()=>t],678784)},54943,e=>{"use strict";let t=(0,e.i(475254).default)("search",[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]]);e.s(["default",()=>t])},987432,e=>{"use strict";e.i(247167);var t=e.i(931067),r=e.i(271645);let i={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M893.3 293.3L730.7 130.7c-7.5-7.5-16.7-13-26.7-16V112H144c-17.7 0-32 14.3-32 32v736c0 17.7 14.3 32 32 32h736c17.7 0 32-14.3 32-32V338.5c0-17-6.7-33.2-18.7-45.2zM384 184h256v104H384V184zm456 656H184V184h136v136c0 17.7 14.3 32 32 32h320c17.7 0 32-14.3 32-32V205.8l136 136V840zM512 442c-79.5 0-144 64.5-144 144s64.5 144 144 144 144-64.5 144-144-64.5-144-144-144zm0 224c-44.2 0-80-35.8-80-80s35.8-80 80-80 80 35.8 80 80-35.8 80-80 80z"}}]},name:"save",theme:"outlined"};var o=e.i(9583),n=r.forwardRef(function(e,n){return r.createElement(o.default,(0,t.default)({},e,{ref:n,icon:i}))});e.s(["SaveOutlined",0,n],987432)},903446,e=>{"use strict";let t=(0,e.i(475254).default)("settings",[["path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z",key:"1qme2f"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);e.s(["default",()=>t])},149192,e=>{"use strict";var t=e.i(864517);e.s(["CloseOutlined",()=>t.default])},492030,e=>{"use strict";var t=e.i(121229);e.s(["CheckOutlined",()=>t.default])},458505,e=>{"use strict";e.i(247167);var t=e.i(931067),r=e.i(271645);let i={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372zm47.7-395.2l-25.4-5.9V348.6c38 5.2 61.5 29 65.5 58.2.5 4 3.9 6.9 7.9 6.9h44.9c4.7 0 8.4-4.1 8-8.8-6.1-62.3-57.4-102.3-125.9-109.2V263c0-4.4-3.6-8-8-8h-28.1c-4.4 0-8 3.6-8 8v33c-70.8 6.9-126.2 46-126.2 119 0 67.6 49.8 100.2 102.1 112.7l24.7 6.3v142.7c-44.2-5.9-69-29.5-74.1-61.3-.6-3.8-4-6.6-7.9-6.6H363c-4.7 0-8.4 4-8 8.7 4.5 55 46.2 105.6 135.2 112.1V761c0 4.4 3.6 8 8 8h28.4c4.4 0 8-3.6 8-8.1l-.2-31.7c78.3-6.9 134.3-48.8 134.3-124-.1-69.4-44.2-100.4-109-116.4zm-68.6-16.2c-5.6-1.6-10.3-3.1-15-5-33.8-12.2-49.5-31.9-49.5-57.3 0-36.3 27.5-57 64.5-61.7v124zM534.3 677V543.3c3.1.9 5.9 1.6 8.8 2.2 47.3 14.4 63.2 34.4 63.2 65.1 0 39.1-29.4 62.6-72 66.4z"}}]},name:"dollar",theme:"outlined"};var o=e.i(9583),n=r.forwardRef(function(e,n){return r.createElement(o.default,(0,t.default)({},e,{ref:n,icon:i}))});e.s(["DollarOutlined",0,n],458505)},611052,e=>{"use strict";var t=e.i(843476),r=e.i(271645),i=e.i(212931),o=e.i(311451),n=e.i(790848),s=e.i(888259),a=e.i(438957);e.i(247167);var l=e.i(931067);let c={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M832 464h-68V240c0-70.7-57.3-128-128-128H388c-70.7 0-128 57.3-128 128v224h-68c-17.7 0-32 14.3-32 32v384c0 17.7 14.3 32 32 32h640c17.7 0 32-14.3 32-32V496c0-17.7-14.3-32-32-32zM332 240c0-30.9 25.1-56 56-56h248c30.9 0 56 25.1 56 56v224H332V240zm460 600H232V536h560v304zM484 701v53c0 4.4 3.6 8 8 8h40c4.4 0 8-3.6 8-8v-53a48.01 48.01 0 10-56 0z"}}]},name:"lock",theme:"outlined"};var d=e.i(9583),h=r.forwardRef(function(e,t){return r.createElement(d.default,(0,l.default)({},e,{ref:t,icon:c}))}),u=e.i(492030),f=e.i(266537),p=e.i(447566),g=e.i(149192),m=e.i(596239);e.s(["ByokCredentialModal",0,({server:e,open:l,onClose:c,onSuccess:d,accessToken:b})=>{let[k,v]=(0,r.useState)(1),[y,x]=(0,r.useState)(""),[_,w]=(0,r.useState)(!0),[C,S]=(0,r.useState)(!1),j=e.alias||e.server_name||"Service",E=j.charAt(0).toUpperCase(),R=()=>{v(1),x(""),w(!0),S(!1),c()},O=async()=>{if(!y.trim())return void s.default.error("Please enter your API key");S(!0);try{let t=await fetch(`/v1/mcp/server/${e.server_id}/user-credential`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${b}`},body:JSON.stringify({credential:y.trim(),save:_})});if(!t.ok){let e=await t.json();throw Error(e?.detail?.error||"Failed to save credential")}s.default.success(`Connected to ${j}`),d(e.server_id),R()}catch(e){s.default.error(e.message||"Failed to connect")}finally{S(!1)}};return(0,t.jsx)(i.Modal,{open:l,onCancel:R,footer:null,width:480,closeIcon:null,className:"byok-modal",children:(0,t.jsxs)("div",{className:"relative p-2",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between mb-6",children:[2===k?(0,t.jsxs)("button",{onClick:()=>v(1),className:"flex items-center gap-1 text-gray-500 hover:text-gray-800 text-sm",children:[(0,t.jsx)(p.ArrowLeftOutlined,{})," Back"]}):(0,t.jsx)("div",{}),(0,t.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,t.jsx)("div",{className:`w-2 h-2 rounded-full ${1===k?"bg-blue-500":"bg-gray-300"}`}),(0,t.jsx)("div",{className:`w-2 h-2 rounded-full ${2===k?"bg-blue-500":"bg-gray-300"}`})]}),(0,t.jsx)("button",{onClick:R,className:"text-gray-400 hover:text-gray-600",children:(0,t.jsx)(g.CloseOutlined,{})})]}),1===k?(0,t.jsxs)("div",{className:"text-center",children:[(0,t.jsxs)("div",{className:"flex items-center justify-center gap-3 mb-6",children:[(0,t.jsx)("div",{className:"w-14 h-14 rounded-xl bg-gradient-to-br from-teal-400 to-cyan-600 flex items-center justify-center text-white font-bold text-xl shadow",children:"L"}),(0,t.jsx)(f.ArrowRightOutlined,{className:"text-gray-400 text-lg"}),(0,t.jsx)("div",{className:"w-14 h-14 rounded-xl bg-gradient-to-br from-blue-600 to-indigo-800 flex items-center justify-center text-white font-bold text-xl shadow",children:E})]}),(0,t.jsxs)("h2",{className:"text-2xl font-bold text-gray-900 mb-2",children:["Connect ",j]}),(0,t.jsxs)("p",{className:"text-gray-500 mb-6",children:["LiteLLM needs access to ",j," to complete your request."]}),(0,t.jsx)("div",{className:"bg-gray-50 rounded-xl p-4 text-left mb-4",children:(0,t.jsxs)("div",{className:"flex items-start gap-3",children:[(0,t.jsx)("div",{className:"mt-0.5",children:(0,t.jsxs)("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",className:"text-gray-500",children:[(0,t.jsx)("rect",{x:"2",y:"4",width:"20",height:"16",rx:"2",stroke:"currentColor",strokeWidth:"2"}),(0,t.jsx)("path",{d:"M8 4v16M16 4v16",stroke:"currentColor",strokeWidth:"2"})]})}),(0,t.jsxs)("div",{children:[(0,t.jsx)("p",{className:"font-semibold text-gray-800 mb-1",children:"How it works"}),(0,t.jsxs)("p",{className:"text-gray-500 text-sm",children:["LiteLLM acts as a secure bridge. Your requests are routed through our MCP client directly to"," ",j,"'s API."]})]})]})}),e.byok_description&&e.byok_description.length>0&&(0,t.jsxs)("div",{className:"bg-gray-50 rounded-xl p-4 text-left mb-6",children:[(0,t.jsxs)("p",{className:"text-xs font-semibold text-gray-500 uppercase tracking-widest mb-3 flex items-center gap-2",children:[(0,t.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",className:"text-green-500",children:[(0,t.jsx)("path",{d:"M12 2L12 22M2 12L22 12",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"}),(0,t.jsx)("circle",{cx:"12",cy:"12",r:"9",stroke:"currentColor",strokeWidth:"2"})]}),"Requested Access"]}),(0,t.jsx)("ul",{className:"space-y-2",children:e.byok_description.map((e,r)=>(0,t.jsxs)("li",{className:"flex items-center gap-2 text-sm text-gray-700",children:[(0,t.jsx)(u.CheckOutlined,{className:"text-green-500 flex-shrink-0"}),e]},r))})]}),(0,t.jsxs)("button",{onClick:()=>v(2),className:"w-full bg-gray-900 hover:bg-gray-700 text-white font-medium py-3 px-6 rounded-xl flex items-center justify-center gap-2 transition-colors",children:["Continue to Authentication ",(0,t.jsx)(f.ArrowRightOutlined,{})]}),(0,t.jsx)("button",{onClick:R,className:"mt-3 w-full text-gray-400 hover:text-gray-600 text-sm py-2",children:"Cancel"})]}):(0,t.jsxs)("div",{children:[(0,t.jsx)("div",{className:"w-12 h-12 rounded-full bg-blue-50 flex items-center justify-center mb-4",children:(0,t.jsx)(a.KeyOutlined,{className:"text-blue-400 text-xl"})}),(0,t.jsx)("h2",{className:"text-2xl font-bold text-gray-900 mb-2",children:"Provide API Key"}),(0,t.jsxs)("p",{className:"text-gray-500 mb-6",children:["Enter your ",j," API key to authorize this connection."]}),(0,t.jsxs)("div",{className:"mb-4",children:[(0,t.jsxs)("label",{className:"block text-sm font-semibold text-gray-800 mb-2",children:[j," API Key"]}),(0,t.jsx)(o.Input.Password,{placeholder:"Enter your API key",value:y,onChange:e=>x(e.target.value),size:"large",className:"rounded-lg"}),e.byok_api_key_help_url&&(0,t.jsxs)("a",{href:e.byok_api_key_help_url,target:"_blank",rel:"noopener noreferrer",className:"text-blue-500 hover:text-blue-700 text-sm mt-2 flex items-center gap-1",children:["Where do I find my API key? ",(0,t.jsx)(m.LinkOutlined,{})]})]}),(0,t.jsxs)("div",{className:"bg-gray-50 rounded-xl p-4 flex items-center justify-between mb-4",children:[(0,t.jsxs)("div",{className:"flex items-center gap-3",children:[(0,t.jsx)("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",className:"text-gray-500",children:(0,t.jsx)("path",{d:"M12 2C8.13 2 5 5.13 5 9c0 5.25 7 13 7 13s7-7.75 7-13c0-3.87-3.13-7-7-7zm0 9.5c-1.38 0-2.5-1.12-2.5-2.5s1.12-2.5 2.5-2.5 2.5 1.12 2.5 2.5-1.12 2.5-2.5 2.5z",fill:"currentColor"})}),(0,t.jsx)("span",{className:"text-sm font-medium text-gray-800",children:"Save key for future use"})]}),(0,t.jsx)(n.Switch,{checked:_,onChange:w})]}),(0,t.jsxs)("div",{className:"bg-blue-50 rounded-xl p-4 flex items-start gap-3 mb-6",children:[(0,t.jsx)(h,{className:"text-blue-400 mt-0.5 flex-shrink-0"}),(0,t.jsx)("p",{className:"text-sm text-blue-700",children:"Your key is stored securely and transmitted over HTTPS. It is never shared with third parties."})]}),(0,t.jsxs)("button",{onClick:O,disabled:C,className:"w-full bg-blue-500 hover:bg-blue-600 disabled:opacity-60 text-white font-medium py-3 px-6 rounded-xl flex items-center justify-center gap-2 transition-colors",children:[(0,t.jsx)(h,{})," Connect & Authorize"]})]})]})})}],611052)}]); \ No newline at end of file diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/161a2ab7f4e973ca.js b/litellm/proxy/_experimental/out/_next/static/chunks/130cfc006c4f7d77.js similarity index 71% rename from litellm/proxy/_experimental/out/_next/static/chunks/161a2ab7f4e973ca.js rename to litellm/proxy/_experimental/out/_next/static/chunks/130cfc006c4f7d77.js index dfd3951fdb..83fe9fee64 100644 --- a/litellm/proxy/_experimental/out/_next/static/chunks/161a2ab7f4e973ca.js +++ b/litellm/proxy/_experimental/out/_next/static/chunks/130cfc006c4f7d77.js @@ -1 +1 @@ -(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,9314,263147,e=>{"use strict";var t=e.i(843476),s=e.i(199133),a=e.i(981339),l=e.i(645526),r=e.i(599724),i=e.i(266027),n=e.i(243652),o=e.i(764205),c=e.i(708347),d=e.i(135214);let u=(0,n.createQueryKeys)("accessGroups"),m=async e=>{let t=(0,o.getProxyBaseUrl)(),s=`${t}/v1/access_group`,a=await fetch(s,{method:"GET",headers:{[(0,o.getGlobalLitellmHeaderName)()]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!a.ok){let e=await a.json(),t=(0,o.deriveErrorMessage)(e);throw(0,o.handleError)(t),Error(t)}return a.json()},p=()=>{let{accessToken:e,userRole:t}=(0,d.default)();return(0,i.useQuery)({queryKey:u.list({}),queryFn:async()=>m(e),enabled:!!e&&c.all_admin_roles.includes(t||"")})};e.s(["accessGroupKeys",0,u,"useAccessGroups",0,p],263147),e.s(["default",0,({value:e,onChange:i,placeholder:n="Select access groups",disabled:o=!1,style:c,className:d,showLabel:u=!1,labelText:m="Access Group",allowClear:g=!0})=>{let{data:h,isLoading:x,isError:y}=p();if(x)return(0,t.jsxs)("div",{children:[u&&(0,t.jsxs)(r.Text,{className:"font-medium block mb-2 text-gray-700 flex items-center",children:[(0,t.jsx)(l.TeamOutlined,{className:"mr-2"})," ",m]}),(0,t.jsx)(a.Skeleton.Input,{active:!0,block:!0,style:{height:32,...c}})]});let f=(h??[]).map(e=>({label:(0,t.jsxs)("span",{children:[(0,t.jsx)("span",{className:"font-medium",children:e.access_group_name})," ",(0,t.jsxs)("span",{className:"text-gray-400 text-xs",children:["(",e.access_group_id,")"]})]}),value:e.access_group_id,selectedLabel:e.access_group_name,searchText:`${e.access_group_name} ${e.access_group_id}`}));return(0,t.jsxs)("div",{children:[u&&(0,t.jsxs)(r.Text,{className:"font-medium block mb-2 text-gray-700 flex items-center",children:[(0,t.jsx)(l.TeamOutlined,{className:"mr-2"})," ",m]}),(0,t.jsx)(s.Select,{mode:"multiple",value:e,placeholder:n,onChange:i,disabled:o,allowClear:g,showSearch:!0,style:{width:"100%",...c},className:`rounded-md ${d??""}`,notFoundContent:y?(0,t.jsx)("span",{className:"text-red-500",children:"Failed to load access groups"}):"No access groups found",filterOption:(e,t)=>(f.find(e=>e.value===t?.value)?.searchText??"").toLowerCase().includes(e.toLowerCase()),optionLabelProp:"selectedLabel",options:f.map(e=>({label:e.label,value:e.value,selectedLabel:e.selectedLabel}))})]})}],9314)},552130,e=>{"use strict";var t=e.i(843476),s=e.i(271645),a=e.i(199133),l=e.i(764205);e.s(["default",0,({onChange:e,value:r,className:i,accessToken:n,placeholder:o="Select agents",disabled:c=!1})=>{let[d,u]=(0,s.useState)([]),[m,p]=(0,s.useState)([]),[g,h]=(0,s.useState)(!1);(0,s.useEffect)(()=>{(async()=>{if(n){h(!0);try{let e=await (0,l.getAgentsList)(n),t=e?.agents||[];u(t);let s=new Set;t.forEach(e=>{let t=e.agent_access_groups;t&&Array.isArray(t)&&t.forEach(e=>s.add(e))}),p(Array.from(s))}catch(e){console.error("Error fetching agents:",e)}finally{h(!1)}}})()},[n]);let x=[...m.map(e=>({label:e,value:`group:${e}`,isAccessGroup:!0,searchText:`${e} Access Group`})),...d.map(e=>({label:`${e.agent_name||e.agent_id}`,value:e.agent_id,isAccessGroup:!1,searchText:`${e.agent_name||e.agent_id} ${e.agent_id} Agent`}))],y=[...r?.agents||[],...(r?.accessGroups||[]).map(e=>`group:${e}`)];return(0,t.jsx)("div",{children:(0,t.jsx)(a.Select,{mode:"multiple",placeholder:o,onChange:t=>{e({agents:t.filter(e=>!e.startsWith("group:")),accessGroups:t.filter(e=>e.startsWith("group:")).map(e=>e.replace("group:",""))})},value:y,loading:g,className:i,allowClear:!0,showSearch:!0,style:{width:"100%"},disabled:c,filterOption:(e,t)=>(x.find(e=>e.value===t?.value)?.searchText||"").toLowerCase().includes(e.toLowerCase()),children:x.map(e=>(0,t.jsx)(a.Select.Option,{value:e.value,label:e.label,children:(0,t.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[(0,t.jsx)("span",{style:{display:"inline-block",width:8,height:8,borderRadius:"50%",background:e.isAccessGroup?"#52c41a":"#722ed1",flexShrink:0}}),(0,t.jsx)("span",{style:{flex:1},children:e.label}),(0,t.jsx)("span",{style:{color:e.isAccessGroup?"#52c41a":"#722ed1",fontSize:"12px",fontWeight:500,opacity:.8},children:e.isAccessGroup?"Access Group":"Agent"})]})},e.value))})})}])},844565,e=>{"use strict";var t=e.i(843476),s=e.i(271645),a=e.i(199133),l=e.i(764205);e.s(["default",0,({onChange:e,value:r,className:i,accessToken:n,placeholder:o="Select pass through routes",disabled:c=!1,teamId:d})=>{let[u,m]=(0,s.useState)([]),[p,g]=(0,s.useState)(!1);return(0,s.useEffect)(()=>{(async()=>{if(n){g(!0);try{let e=await (0,l.getPassThroughEndpointsCall)(n,d);if(e.endpoints){let t=e.endpoints.flatMap(e=>{let t=e.path,s=e.methods;return s&&s.length>0?s.map(e=>({label:`${e} ${t}`,value:t})):[{label:t,value:t}]});m(t)}}catch(e){console.error("Error fetching pass through routes:",e)}finally{g(!1)}}})()},[n,d]),(0,t.jsx)(a.Select,{mode:"tags",placeholder:o,onChange:e,value:r,loading:p,className:i,allowClear:!0,options:u,optionFilterProp:"label",showSearch:!0,style:{width:"100%"},disabled:c})}])},810757,477386,e=>{"use strict";var t=e.i(271645);let s=t.forwardRef(function(e,s){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:s},e),t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M10.325 4.317c.426-1.756 2.924-1.756 3.35 0a1.724 1.724 0 002.573 1.066c1.543-.94 3.31.826 2.37 2.37a1.724 1.724 0 001.065 2.572c1.756.426 1.756 2.924 0 3.35a1.724 1.724 0 00-1.066 2.573c.94 1.543-.826 3.31-2.37 2.37a1.724 1.724 0 00-2.572 1.065c-.426 1.756-2.924 1.756-3.35 0a1.724 1.724 0 00-2.573-1.066c-1.543.94-3.31-.826-2.37-2.37a1.724 1.724 0 00-1.065-2.572c-1.756-.426-1.756-2.924 0-3.35a1.724 1.724 0 001.066-2.573c-.94-1.543.826-3.31 2.37-2.37.996.608 2.296.07 2.572-1.065z"}),t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z"}))});e.s(["CogIcon",0,s],810757);let a=t.forwardRef(function(e,s){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:s},e),t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M18.364 18.364A9 9 0 005.636 5.636m12.728 12.728A9 9 0 015.636 5.636m12.728 12.728L5.636 5.636"}))});e.s(["BanIcon",0,a],477386)},557662,e=>{"use strict";let t="../ui/assets/logos/",s=[{id:"arize",displayName:"Arize",logo:`${t}arize.png`,supports_key_team_logging:!0,dynamic_params:{arize_api_key:"password",arize_space_id:"password"},description:"Arize Logging Integration"},{id:"braintrust",displayName:"Braintrust",logo:`${t}braintrust.png`,supports_key_team_logging:!1,dynamic_params:{braintrust_api_key:"password",braintrust_project_name:"text"},description:"Braintrust Logging Integration"},{id:"custom_callback_api",displayName:"Custom Callback API",logo:`${t}custom.svg`,supports_key_team_logging:!0,dynamic_params:{custom_callback_api_url:"text",custom_callback_api_headers:"text"},description:"Custom Callback API Logging Integration"},{id:"datadog",displayName:"Datadog",logo:`${t}datadog.png`,supports_key_team_logging:!1,dynamic_params:{dd_api_key:"password",dd_site:"text"},description:"Datadog Logging Integration"},{id:"lago",displayName:"Lago",logo:`${t}lago.svg`,supports_key_team_logging:!1,dynamic_params:{lago_api_url:"text",lago_api_key:"password"},description:"Lago Billing Logging Integration"},{id:"langfuse",displayName:"Langfuse",logo:`${t}langfuse.png`,supports_key_team_logging:!0,dynamic_params:{langfuse_public_key:"text",langfuse_secret_key:"password",langfuse_host:"text"},description:"Langfuse v2 Logging Integration"},{id:"langfuse_otel",displayName:"Langfuse OTEL",logo:`${t}langfuse.png`,supports_key_team_logging:!0,dynamic_params:{langfuse_public_key:"text",langfuse_secret_key:"password",langfuse_host:"text"},description:"Langfuse v3 OTEL Logging Integration"},{id:"langsmith",displayName:"LangSmith",logo:`${t}langsmith.png`,supports_key_team_logging:!0,dynamic_params:{langsmith_api_key:"password",langsmith_project:"text",langsmith_base_url:"text",langsmith_sampling_rate:"number"},description:"Langsmith Logging Integration"},{id:"openmeter",displayName:"OpenMeter",logo:`${t}openmeter.png`,supports_key_team_logging:!1,dynamic_params:{openmeter_api_key:"password",openmeter_base_url:"text"},description:"OpenMeter Logging Integration"},{id:"otel",displayName:"Open Telemetry",logo:`${t}otel.png`,supports_key_team_logging:!1,dynamic_params:{otel_endpoint:"text",otel_headers:"text"},description:"OpenTelemetry Logging Integration"},{id:"s3",displayName:"S3",logo:`${t}aws.svg`,supports_key_team_logging:!1,dynamic_params:{s3_bucket_name:"text",aws_access_key_id:"password",aws_secret_access_key:"password",aws_region:"text"},description:"S3 Bucket (AWS) Logging Integration"},{id:"SQS",displayName:"SQS",logo:`${t}aws.svg`,supports_key_team_logging:!1,dynamic_params:{sqs_queue_url:"text",aws_access_key_id:"password",aws_secret_access_key:"password",aws_region:"text"},description:"SQS Queue (AWS) Logging Integration"}],a=s.reduce((e,t)=>(e[t.displayName]=t,e),{}),l=s.reduce((e,t)=>(e[t.displayName]=t.id,e),{}),r=s.reduce((e,t)=>(e[t.id]=t.displayName,e),{});e.s(["callbackInfo",0,a,"callback_map",0,l,"mapDisplayToInternalNames",0,e=>e.map(e=>l[e]||e),"mapInternalToDisplayNames",0,e=>e.map(e=>r[e]||e),"reverse_callback_map",0,r])},75921,e=>{"use strict";var t=e.i(843476),s=e.i(266027),a=e.i(243652),l=e.i(764205),r=e.i(135214);let i=(0,a.createQueryKeys)("mcpAccessGroups");var n=e.i(500727),o=e.i(699857),c=e.i(199133);let d="toolset:";e.s(["default",0,({onChange:e,value:a,className:u,accessToken:m,placeholder:p="Select MCP servers",disabled:g=!1,teamId:h})=>{let{data:x=[],isLoading:y}=(0,n.useMCPServers)(h),{data:f=[],isLoading:_}=(()=>{let{accessToken:e}=(0,r.default)();return(0,s.useQuery)({queryKey:i.list({}),queryFn:async()=>await (0,l.fetchMCPAccessGroups)(e),enabled:!!e})})(),{data:j=[],isLoading:b}=(0,o.useMCPToolsets)(),v=new Set(f),w=[...f.map(e=>({label:e,value:e,type:"accessGroup",searchText:`${e} Access Group`})),...x.map(e=>({label:`${e.server_name||e.server_id} (${e.server_id})`,value:e.server_id,type:"server",searchText:`${e.server_name||e.server_id} ${e.server_id} MCP Server`})),...j.map(e=>({label:e.toolset_name,value:`${d}${e.toolset_id}`,type:"toolset",searchText:`${e.toolset_name} ${e.toolset_id} Toolset`}))],N={accessGroup:"#52c41a",server:"#1890ff",toolset:"#722ed1"},k={accessGroup:"Access Group",server:"MCP Server",toolset:"Toolset"},S=[...a?.servers||[],...a?.accessGroups||[],...(a?.toolsets||[]).map(e=>`${d}${e}`)];return(0,t.jsx)("div",{children:(0,t.jsx)(c.Select,{mode:"multiple",placeholder:p,onChange:t=>{let s=t.filter(e=>e.startsWith(d)).map(e=>e.slice(d.length)),a=t.filter(e=>!e.startsWith(d));e({servers:a.filter(e=>!v.has(e)),accessGroups:a.filter(e=>v.has(e)),toolsets:s})},value:S,loading:y||_||b,className:u,allowClear:!0,showSearch:!0,style:{width:"100%"},disabled:g,filterOption:(e,t)=>(w.find(e=>e.value===t?.value)?.searchText||"").toLowerCase().includes(e.toLowerCase()),children:w.map(e=>(0,t.jsx)(c.Select.Option,{value:e.value,label:e.label,children:(0,t.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[(0,t.jsx)("span",{style:{display:"inline-block",width:8,height:8,borderRadius:"50%",background:N[e.type],flexShrink:0}}),(0,t.jsx)("span",{style:{flex:1},children:e.label}),(0,t.jsx)("span",{style:{color:N[e.type],fontSize:"12px",fontWeight:500,opacity:.8},children:k[e.type]})]})},e.value))})})}],75921)},390605,e=>{"use strict";var t=e.i(843476),s=e.i(271645),a=e.i(764205),l=e.i(599724),r=e.i(482725),i=e.i(91739),n=e.i(500727),o=e.i(531516),c=e.i(696609);e.s(["default",0,({accessToken:e,selectedServers:d,toolPermissions:u,onChange:m,disabled:p=!1})=>{let{data:g=[]}=(0,n.useMCPServers)(),[h,x]=(0,s.useState)({}),[y,f]=(0,s.useState)({}),[_,j]=(0,s.useState)({}),[b,v]=(0,s.useState)({}),w=(0,s.useRef)(u);(0,s.useEffect)(()=>{w.current=u},[u]);let N=(0,s.useMemo)(()=>0===d.length?[]:g.filter(e=>d.includes(e.server_id)),[g,d]),k=async(e,t)=>{f(t=>({...t,[e]:!0})),j(t=>({...t,[e]:""}));try{let s=await (0,a.listMCPTools)(t,e);if(s.error)j(t=>({...t,[e]:s.message||"Failed to fetch tools"})),x(t=>({...t,[e]:[]}));else{let t=s.tools||[];x(s=>({...s,[e]:t}));let a=w.current;if(!a[e]&&t.length>0){let s=t.filter(e=>"delete"!==(0,c.classifyToolOp)(e.name,e.description||"")).map(e=>e.name);m({...a,[e]:s})}}}catch(t){console.error(`Error fetching tools for server ${e}:`,t),j(t=>({...t,[e]:"Failed to fetch tools"})),x(t=>({...t,[e]:[]}))}finally{f(t=>({...t,[e]:!1}))}};(0,s.useEffect)(()=>{N.forEach(t=>{h[t.server_id]||y[t.server_id]||k(t.server_id,e)})},[N,e]);let S=(e,t)=>{m({...u,[e]:t})};return 0===d.length?null:(0,t.jsx)("div",{className:"space-y-4",children:N.map(e=>{let s=e.server_name||e.alias||e.server_id,a=h[e.server_id]||[],n=u[e.server_id]||[],c=y[e.server_id],d=_[e.server_id],g=b[e.server_id]??"crud";return(0,t.jsxs)("div",{className:"border rounded-lg bg-gray-50",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between p-4 border-b bg-white rounded-t-lg",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)(l.Text,{className:"font-semibold text-gray-900",children:s}),e.description&&(0,t.jsx)(l.Text,{className:"text-sm text-gray-500",children:e.description})]}),(0,t.jsxs)("div",{className:"flex items-center gap-3",children:[!p&&a.length>0&&(0,t.jsx)(i.Radio.Group,{value:g,onChange:t=>v(s=>({...s,[e.server_id]:t.target.value})),size:"small",optionType:"button",buttonStyle:"solid",options:[{label:"Risk Groups",value:"crud"},{label:"Flat List",value:"flat"}]}),!p&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("button",{type:"button",className:"text-sm text-blue-600 hover:text-blue-700 font-medium",onClick:()=>{var t;let s;return s=h[t=e.server_id]||[],void m({...u,[t]:s.map(e=>e.name)})},disabled:c,children:"Select All"}),(0,t.jsx)("button",{type:"button",className:"text-sm text-blue-600 hover:text-blue-700 font-medium",onClick:()=>{var t;return t=e.server_id,void m({...u,[t]:[]})},disabled:c,children:"Deselect All"})]})]})]}),(0,t.jsxs)("div",{className:"p-4",children:[c&&(0,t.jsxs)("div",{className:"flex items-center justify-center py-8",children:[(0,t.jsx)(r.Spin,{size:"large"}),(0,t.jsx)(l.Text,{className:"ml-3 text-gray-500",children:"Loading tools..."})]}),d&&!c&&(0,t.jsxs)("div",{className:"p-4 bg-red-50 border border-red-200 rounded-lg text-center",children:[(0,t.jsx)(l.Text,{className:"text-red-600 font-medium",children:"Unable to load tools"}),(0,t.jsx)(l.Text,{className:"text-sm text-red-500 mt-1",children:d})]}),!c&&!d&&a.length>0&&"crud"===g&&(0,t.jsx)(o.default,{tools:a,value:u[e.server_id]?n:void 0,onChange:t=>S(e.server_id,t),readOnly:p}),!c&&!d&&a.length>0&&"flat"===g&&(0,t.jsx)("div",{className:"space-y-2",children:a.map(s=>{let a=n.includes(s.name);return(0,t.jsxs)("div",{className:"flex items-start gap-2",children:[(0,t.jsx)("input",{type:"checkbox",checked:a,onChange:()=>{if(p)return;let t=a?n.filter(e=>e!==s.name):[...n,s.name];S(e.server_id,t)},disabled:p,className:"mt-0.5"}),(0,t.jsx)("div",{className:"flex-1 min-w-0",children:(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(l.Text,{className:"font-medium text-gray-900",children:s.name}),(0,t.jsxs)(l.Text,{className:"text-sm text-gray-500",children:["- ",s.description||"No description"]})]})})]},s.name)})}),!c&&!d&&0===a.length&&(0,t.jsx)("div",{className:"text-center py-6",children:(0,t.jsx)(l.Text,{className:"text-gray-500",children:"No tools available"})})]})]},e.server_id)})})}])},266484,e=>{"use strict";var t=e.i(843476),s=e.i(199133),a=e.i(592968),l=e.i(312361),r=e.i(827252),i=e.i(994388),n=e.i(304967),o=e.i(779241),c=e.i(988297),d=e.i(68155),u=e.i(810757),m=e.i(477386),p=e.i(557662),g=e.i(435451);let{Option:h}=s.Select;e.s(["default",0,({value:e=[],onChange:x,disabledCallbacks:y=[],onDisabledCallbacksChange:f})=>{let _=Object.entries(p.callbackInfo).filter(([e,t])=>t.supports_key_team_logging).map(([e,t])=>e),j=Object.keys(p.callbackInfo),b=e=>{x?.(e)},v=(t,s,a)=>{let l=[...e];if("callback_name"===s){let e=p.callback_map[a]||a;l[t]={...l[t],[s]:e,callback_vars:{}}}else l[t]={...l[t],[s]:a};b(l)},w=(t,s,a)=>{let l=[...e];l[t]={...l[t],callback_vars:{...l[t].callback_vars,[s]:a}},b(l)};return(0,t.jsxs)("div",{className:"space-y-6",children:[(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,t.jsx)(m.BanIcon,{className:"w-5 h-5 text-red-500"}),(0,t.jsx)("span",{className:"text-base font-semibold text-gray-800",children:"Disabled Callbacks"}),(0,t.jsx)(a.Tooltip,{title:"Select callbacks to disable for this key. Disabled callbacks will not receive any logging data.",children:(0,t.jsx)(r.InfoCircleOutlined,{className:"text-gray-400 cursor-help"})})]}),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)("label",{className:"text-sm font-medium text-gray-700",children:"Disabled Callbacks"}),(0,t.jsx)(s.Select,{mode:"multiple",placeholder:"Select callbacks to disable",value:y,onChange:e=>{let t=(0,p.mapDisplayToInternalNames)(e);f?.(t)},style:{width:"100%"},optionLabelProp:"label",children:j.map(e=>{let s=p.callbackInfo[e]?.logo,l=p.callbackInfo[e]?.description;return(0,t.jsx)(h,{value:e,label:e,children:(0,t.jsx)(a.Tooltip,{title:l,placement:"right",children:(0,t.jsxs)("div",{className:"flex items-center space-x-2",children:[s&&(0,t.jsx)("img",{src:s,alt:e,className:"w-4 h-4 object-contain",onError:t=>{let s=t.target,a=s.parentElement;if(a){let t=document.createElement("div");t.className="w-4 h-4 rounded-full bg-gray-200 flex items-center justify-center text-xs",t.textContent=e.charAt(0),a.replaceChild(t,s)}}}),(0,t.jsx)("span",{children:e})]})})},e)})}),(0,t.jsx)("div",{className:"text-xs text-gray-500",children:"Select callbacks that should be disabled for this key. These callbacks will not receive any logging data."})]})]}),(0,t.jsx)(l.Divider,{}),(0,t.jsxs)("div",{className:"flex justify-between items-center",children:[(0,t.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,t.jsx)(u.CogIcon,{className:"w-5 h-5 text-blue-500"}),(0,t.jsx)("span",{className:"text-base font-semibold text-gray-800",children:"Logging Integrations"}),(0,t.jsx)(a.Tooltip,{title:"Configure callback logging integrations for this team.",children:(0,t.jsx)(r.InfoCircleOutlined,{className:"text-gray-400 cursor-help"})})]}),(0,t.jsx)(i.Button,{variant:"secondary",onClick:()=>{b([...e,{callback_name:"",callback_type:"success",callback_vars:{}}])},icon:c.PlusIcon,size:"sm",className:"hover:border-blue-400 hover:text-blue-500",type:"button",children:"Add Integration"})]}),(0,t.jsx)("div",{className:"space-y-4",children:e.map((l,c)=>{let u=l.callback_name?Object.entries(p.callback_map).find(([e,t])=>t===l.callback_name)?.[0]:void 0,m=u?p.callbackInfo[u]?.logo:null;return(0,t.jsxs)(n.Card,{className:"border border-gray-200 shadow-sm hover:shadow-md transition-shadow duration-200",decoration:"top",decorationColor:"blue",children:[(0,t.jsxs)("div",{className:"flex justify-between items-start mb-4",children:[(0,t.jsxs)("div",{className:"flex items-center space-x-2",children:[m&&(0,t.jsx)("img",{src:m,alt:u,className:"w-5 h-5 object-contain"}),(0,t.jsxs)("span",{className:"text-sm font-medium",children:[u||"New Integration"," Configuration"]})]}),(0,t.jsx)(i.Button,{variant:"light",onClick:()=>{b(e.filter((e,t)=>t!==c))},icon:d.TrashIcon,size:"xs",color:"red",className:"hover:bg-red-50",type:"button",children:"Remove"})]}),(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)("label",{className:"text-sm font-medium text-gray-700",children:"Integration Type"}),(0,t.jsx)(s.Select,{value:u,placeholder:"Select integration",onChange:e=>v(c,"callback_name",e),className:"w-full",optionLabelProp:"label",children:_.map(e=>{let s=p.callbackInfo[e]?.logo,l=p.callbackInfo[e]?.description;return(0,t.jsx)(h,{value:e,label:e,children:(0,t.jsx)(a.Tooltip,{title:l,placement:"right",children:(0,t.jsxs)("div",{className:"flex items-center space-x-2",children:[s&&(0,t.jsx)("img",{src:s,alt:e,className:"w-4 h-4 object-contain",onError:t=>{let s=t.target,a=s.parentElement;if(a){let t=document.createElement("div");t.className="w-4 h-4 rounded-full bg-gray-200 flex items-center justify-center text-xs",t.textContent=e.charAt(0),a.replaceChild(t,s)}}}),(0,t.jsx)("span",{children:e})]})})},e)})})]}),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)("label",{className:"text-sm font-medium text-gray-700",children:"Event Type"}),(0,t.jsxs)(s.Select,{value:l.callback_type,onChange:e=>v(c,"callback_type",e),className:"w-full",children:[(0,t.jsx)(h,{value:"success",children:(0,t.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,t.jsx)("div",{className:"w-2 h-2 bg-green-500 rounded-full"}),(0,t.jsx)("span",{children:"Success Only"})]})}),(0,t.jsx)(h,{value:"failure",children:(0,t.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,t.jsx)("div",{className:"w-2 h-2 bg-red-500 rounded-full"}),(0,t.jsx)("span",{children:"Failure Only"})]})}),(0,t.jsx)(h,{value:"success_and_failure",children:(0,t.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,t.jsx)("div",{className:"w-2 h-2 bg-blue-500 rounded-full"}),(0,t.jsx)("span",{children:"Success & Failure"})]})})]})]})]}),((e,s)=>{if(!e.callback_name)return null;let l=Object.entries(p.callback_map).find(([t,s])=>s===e.callback_name)?.[0];if(!l)return null;let i=p.callbackInfo[l]?.dynamic_params||{};return 0===Object.keys(i).length?null:(0,t.jsxs)("div",{className:"mt-6 pt-4 border-t border-gray-100",children:[(0,t.jsxs)("div",{className:"flex items-center space-x-2 mb-4",children:[(0,t.jsx)("div",{className:"w-3 h-3 bg-blue-100 rounded-full flex items-center justify-center",children:(0,t.jsx)("div",{className:"w-1.5 h-1.5 bg-blue-500 rounded-full"})}),(0,t.jsx)("span",{className:"text-sm font-medium text-gray-700",children:"Integration Parameters"})]}),(0,t.jsx)("div",{className:"grid grid-cols-1 gap-4",children:Object.entries(i).map(([l,i])=>(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsxs)("label",{className:"text-sm font-medium text-gray-700 capitalize flex items-center space-x-1",children:[(0,t.jsx)("span",{children:l.replace(/_/g," ")}),(0,t.jsx)(a.Tooltip,{title:`Environment variable reference recommended: os.environ/${l.toUpperCase()}`,children:(0,t.jsx)(r.InfoCircleOutlined,{className:"text-gray-400 cursor-help text-xs"})}),"password"===i&&(0,t.jsx)("span",{className:"inline-flex items-center px-2 py-0.5 rounded text-xs font-medium bg-yellow-100 text-yellow-800",children:"Sensitive"}),"number"===i&&(0,t.jsx)("span",{className:"inline-flex items-center px-2 py-0.5 rounded text-xs font-medium bg-yellow-100 text-yellow-800",children:"Number"})]}),"number"===i&&(0,t.jsx)("span",{className:"text-xs text-gray-500",children:"Value must be between 0 and 1"}),"number"===i?(0,t.jsx)(g.default,{step:.01,width:400,placeholder:`os.environ/${l.toUpperCase()}`,value:e.callback_vars[l]||"",onChange:e=>w(s,l,e.target.value)}):(0,t.jsx)(o.TextInput,{type:"password"===i?"password":"text",placeholder:`os.environ/${l.toUpperCase()}`,value:e.callback_vars[l]||"",onChange:e=>w(s,l,e.target.value)})]},l))})]})})(l,c)]})]},c)})}),0===e.length&&(0,t.jsxs)("div",{className:"text-center py-12 text-gray-500 border-2 border-dashed border-gray-200 rounded-lg bg-gray-50/50",children:[(0,t.jsx)(u.CogIcon,{className:"w-12 h-12 text-gray-300 mb-3 mx-auto"}),(0,t.jsx)("div",{className:"text-base font-medium mb-1",children:"No logging integrations configured"}),(0,t.jsx)("div",{className:"text-sm text-gray-400",children:'Click "Add Integration" to configure logging for this team'})]})]})}])},207082,e=>{"use strict";var t=e.i(619273),s=e.i(266027),a=e.i(243652),l=e.i(764205),r=e.i(135214);let i=(0,a.createQueryKeys)("keys"),n=async(e,t,s,a={})=>{try{let r=(0,l.getProxyBaseUrl)(),i=new URLSearchParams(Object.entries({team_id:a.teamID,project_id:a.projectID,organization_id:a.organizationID,key_alias:a.selectedKeyAlias,key_hash:a.keyHash,user_id:a.userID,page:t,size:s,sort_by:a.sortBy,sort_order:a.sortOrder,expand:a.expand,status:a.status,return_full_object:"true",include_team_keys:"true",include_created_by_keys:"true"}).filter(([,e])=>null!=e).map(([e,t])=>[e,String(t)])),n=`${r?`${r}/key/list`:"/key/list"}?${i}`,o=await fetch(n,{method:"GET",headers:{[(0,l.getGlobalLitellmHeaderName)()]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!o.ok){let e=await o.json(),t=(0,l.deriveErrorMessage)(e);throw(0,l.handleError)(t),Error(t)}let c=await o.json();return console.log("/key/list API Response:",c),c}catch(e){throw console.error("Failed to list keys:",e),e}},o=(0,a.createQueryKeys)("deletedKeys");e.s(["keyKeys",0,i,"useDeletedKeys",0,(e,a,l={})=>{let{accessToken:i}=(0,r.default)();return(0,s.useQuery)({queryKey:o.list({page:e,limit:a,...l}),queryFn:async()=>await n(i,e,a,{...l,status:"deleted"}),enabled:!!i,staleTime:3e4,placeholderData:t.keepPreviousData})},"useKeys",0,(e,a,l={})=>{let{accessToken:o}=(0,r.default)();return(0,s.useQuery)({queryKey:i.list({page:e,limit:a,...l}),queryFn:async()=>await n(o,e,a,l),enabled:!!o,staleTime:3e4,placeholderData:t.keepPreviousData})}])},510674,e=>{"use strict";var t=e.i(266027),s=e.i(243652),a=e.i(764205),l=e.i(708347),r=e.i(135214);let i=(0,s.createQueryKeys)("projects"),n=async e=>{let t=(0,a.getProxyBaseUrl)(),s=`${t}/project/list`,l=await fetch(s,{method:"GET",headers:{[(0,a.getGlobalLitellmHeaderName)()]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!l.ok){let e=await l.json(),t=(0,a.deriveErrorMessage)(e);throw(0,a.handleError)(t),Error(t)}return l.json()};e.s(["projectKeys",0,i,"useProjects",0,()=>{let{accessToken:e,userRole:s}=(0,r.default)();return(0,t.useQuery)({queryKey:i.list({}),queryFn:async()=>n(e),enabled:!!e&&l.all_admin_roles.includes(s||"")})}])},392110,e=>{"use strict";var t=e.i(843476),s=e.i(271645),a=e.i(199133),l=e.i(592968),r=e.i(312361),i=e.i(790848),n=e.i(536916),o=e.i(827252),c=e.i(779241);let{Option:d}=a.Select;e.s(["default",0,({form:e,autoRotationEnabled:u,onAutoRotationChange:m,rotationInterval:p,onRotationIntervalChange:g,isCreateMode:h=!1,neverExpire:x=!1,onNeverExpireChange:y})=>{let f=p&&!["7d","30d","90d","180d","365d"].includes(p),[_,j]=(0,s.useState)(f),[b,v]=(0,s.useState)(f?p:""),[w,N]=(0,s.useState)(e?.getFieldValue?.("duration")||"");return(0,t.jsxs)("div",{className:"space-y-6",children:[(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsx)("span",{className:"text-sm font-medium text-gray-700",children:"Key Expiry Settings"}),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsxs)("label",{className:"text-sm font-medium text-gray-700 flex items-center space-x-1",children:[(0,t.jsx)("span",{children:"Expire Key"}),(0,t.jsx)(l.Tooltip,{title:"Set when this key should expire. Format: 30s (seconds), 30m (minutes), 30h (hours), 30d (days). Leave empty to keep the current expiry unchanged.",children:(0,t.jsx)(o.InfoCircleOutlined,{className:"text-gray-400 cursor-help text-xs"})}),!h&&y&&(0,t.jsx)(n.Checkbox,{checked:x,onChange:t=>{let s=t.target.checked;y(s),s&&(N(""),e&&"function"==typeof e.setFieldValue?e.setFieldValue("duration",""):e&&"function"==typeof e.setFieldsValue&&e.setFieldsValue({duration:""}))},className:"ml-2 text-sm font-normal text-gray-600",children:"Never Expire"})]}),(0,t.jsx)(c.TextInput,{name:"duration",placeholder:h?"e.g., 30d or leave empty to never expire":"e.g., 30d",className:"w-full",value:w,onValueChange:t=>{N(t),e&&"function"==typeof e.setFieldValue?e.setFieldValue("duration",t):e&&"function"==typeof e.setFieldsValue&&e.setFieldsValue({duration:t})},disabled:!h&&x})]})]}),(0,t.jsx)(r.Divider,{}),(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsx)("span",{className:"text-sm font-medium text-gray-700",children:"Auto-Rotation Settings"}),(0,t.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsxs)("label",{className:"text-sm font-medium text-gray-700 flex items-center space-x-1",children:[(0,t.jsx)("span",{children:"Enable Auto-Rotation"}),(0,t.jsx)(l.Tooltip,{title:"Key will automatically regenerate at the specified interval for enhanced security.",children:(0,t.jsx)(o.InfoCircleOutlined,{className:"text-gray-400 cursor-help text-xs"})})]}),(0,t.jsx)(i.Switch,{checked:u,onChange:m,size:"default",className:u?"":"bg-gray-400"})]}),u&&(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsxs)("label",{className:"text-sm font-medium text-gray-700 flex items-center space-x-1",children:[(0,t.jsx)("span",{children:"Rotation Interval"}),(0,t.jsx)(l.Tooltip,{title:"How often the key should be automatically rotated. Choose the interval that best fits your security requirements.",children:(0,t.jsx)(o.InfoCircleOutlined,{className:"text-gray-400 cursor-help text-xs"})})]}),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsxs)(a.Select,{value:_?"custom":p,onChange:e=>{"custom"===e?j(!0):(j(!1),v(""),g(e))},className:"w-full",placeholder:"Select interval",children:[(0,t.jsx)(d,{value:"7d",children:"7 days"}),(0,t.jsx)(d,{value:"30d",children:"30 days"}),(0,t.jsx)(d,{value:"90d",children:"90 days"}),(0,t.jsx)(d,{value:"180d",children:"180 days"}),(0,t.jsx)(d,{value:"365d",children:"365 days"}),(0,t.jsx)(d,{value:"custom",children:"Custom interval"})]}),_&&(0,t.jsxs)("div",{className:"space-y-1",children:[(0,t.jsx)(c.TextInput,{value:b,onChange:e=>{let t=e.target.value;v(t),g(t)},placeholder:"e.g., 1s, 5m, 2h, 14d"}),(0,t.jsx)("div",{className:"text-xs text-gray-500",children:"Supported formats: seconds (s), minutes (m), hours (h), days (d)"})]})]})]})]}),u&&(0,t.jsx)("div",{className:"bg-blue-50 p-3 rounded-md text-sm text-blue-700",children:"When rotation occurs, you'll receive a notification with the new key. The old key will be deactivated after a brief grace period."})]})]})}])},939510,e=>{"use strict";var t=e.i(843476),s=e.i(808613),a=e.i(199133),l=e.i(592968),r=e.i(827252);let{Option:i}=a.Select;e.s(["default",0,({type:e,name:n,showDetailedDescriptions:o=!0,className:c="",initialValue:d=null,form:u,onChange:m})=>{let p=e.toUpperCase(),g=e.toLowerCase(),h=`Select 'guaranteed_throughput' to prevent overallocating ${p} limit when the key belongs to a Team with specific ${p} limits.`;return(0,t.jsx)(s.Form.Item,{label:(0,t.jsxs)("span",{children:[p," Rate Limit Type"," ",(0,t.jsx)(l.Tooltip,{title:h,children:(0,t.jsx)(r.InfoCircleOutlined,{style:{marginLeft:"4px"}})})]}),name:n,initialValue:d,className:c,children:(0,t.jsx)(a.Select,{defaultValue:o?"default":void 0,placeholder:"Select rate limit type",style:{width:"100%"},optionLabelProp:o?"label":void 0,onChange:e=>{u&&u.setFieldValue(n,e),m&&m(e)},children:o?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(i,{value:"best_effort_throughput",label:"Default",children:(0,t.jsxs)("div",{style:{padding:"4px 0"},children:[(0,t.jsx)("div",{style:{fontWeight:500},children:"Default"}),(0,t.jsxs)("div",{style:{fontSize:"11px",color:"#6b7280",marginTop:"2px"},children:["Best effort throughput - no error if we're overallocating ",g," (Team/Key Limits checked at runtime)."]})]})}),(0,t.jsx)(i,{value:"guaranteed_throughput",label:"Guaranteed throughput",children:(0,t.jsxs)("div",{style:{padding:"4px 0"},children:[(0,t.jsx)("div",{style:{fontWeight:500},children:"Guaranteed throughput"}),(0,t.jsxs)("div",{style:{fontSize:"11px",color:"#6b7280",marginTop:"2px"},children:["Guaranteed throughput - raise an error if we're overallocating ",g," (also checks model-specific limits)"]})]})}),(0,t.jsx)(i,{value:"dynamic",label:"Dynamic",children:(0,t.jsxs)("div",{style:{padding:"4px 0"},children:[(0,t.jsx)("div",{style:{fontWeight:500},children:"Dynamic"}),(0,t.jsxs)("div",{style:{fontSize:"11px",color:"#6b7280",marginTop:"2px"},children:["If the key has a set ",p," (e.g. 2 ",p,") and there are no 429 errors, it can dynamically exceed the limit when the model being called is not erroring."]})]})})]}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(i,{value:"best_effort_throughput",children:"Best effort throughput"}),(0,t.jsx)(i,{value:"guaranteed_throughput",children:"Guaranteed throughput"}),(0,t.jsx)(i,{value:"dynamic",children:"Dynamic"})]})})})}])},363256,e=>{"use strict";var t=e.i(843476),s=e.i(199133);let{Text:a}=e.i(898586).Typography;e.s(["default",0,({organizations:e,value:l,onChange:r,disabled:i,loading:n,style:o})=>(0,t.jsx)(s.Select,{showSearch:!0,placeholder:"All Organizations",value:l,onChange:r,disabled:i,loading:n,allowClear:!0,style:{minWidth:280,...o},filterOption:(t,s)=>{if(!s)return!1;let a=e?.find(e=>e.organization_id===s.key);if(!a)return!1;let l=t.toLowerCase().trim(),r=(a.organization_alias||"").toLowerCase(),i=(a.organization_id||"").toLowerCase();return r.includes(l)||i.includes(l)},children:e?.map(e=>(0,t.jsxs)(s.Select.Option,{value:e.organization_id,children:[(0,t.jsx)("span",{className:"font-medium",children:e.organization_alias})," ",(0,t.jsxs)(a,{type:"secondary",children:["(",e.organization_id,")"]})]},e.organization_id))})])},109034,e=>{"use strict";var t=e.i(266027),s=e.i(243652),a=e.i(764205),l=e.i(135214);let r=(0,s.createQueryKeys)("tags");e.s(["useTags",0,()=>{let{accessToken:e,userId:s,userRole:i}=(0,l.default)();return(0,t.useQuery)({queryKey:r.list({}),queryFn:async()=>await (0,a.tagListCall)(e),enabled:!!(e&&s&&i)})}])},533882,e=>{"use strict";var t=e.i(843476),s=e.i(271645),a=e.i(250980),l=e.i(797672),r=e.i(68155),i=e.i(304967),n=e.i(629569),o=e.i(599724),c=e.i(269200),d=e.i(427612),u=e.i(64848),m=e.i(942232),p=e.i(496020),g=e.i(977572),h=e.i(992619),x=e.i(727749);e.s(["default",0,({accessToken:e,initialModelAliases:y={},onAliasUpdate:f,showExampleConfig:_=!0})=>{let[j,b]=(0,s.useState)([]),[v,w]=(0,s.useState)({aliasName:"",targetModel:""}),[N,k]=(0,s.useState)(null);(0,s.useEffect)(()=>{b(Object.entries(y).map(([e,t],s)=>({id:`${s}-${e}`,aliasName:e,targetModel:t})))},[y]);let S=()=>{if(!N)return;if(!N.aliasName||!N.targetModel)return void x.default.fromBackend("Please provide both alias name and target model");if(j.some(e=>e.id!==N.id&&e.aliasName===N.aliasName))return void x.default.fromBackend("An alias with this name already exists");let e=j.map(e=>e.id===N.id?N:e);b(e),k(null);let t={};e.forEach(e=>{t[e.aliasName]=e.targetModel}),f&&f(t),x.default.success("Alias updated successfully")},C=()=>{k(null)},T=j.reduce((e,t)=>(e[t.aliasName]=t.targetModel,e),{});return(0,t.jsxs)("div",{className:"mt-4",children:[(0,t.jsxs)("div",{className:"mb-6",children:[(0,t.jsx)(o.Text,{className:"text-sm font-medium text-gray-700 mb-2",children:"Add New Alias"}),(0,t.jsxs)("div",{className:"grid grid-cols-3 gap-4",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"block text-xs text-gray-500 mb-1",children:"Alias Name"}),(0,t.jsx)("input",{type:"text",value:v.aliasName,onChange:e=>w({...v,aliasName:e.target.value}),placeholder:"e.g., gpt-4o",className:"w-full px-3 py-2 border border-gray-300 rounded-md text-sm"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"block text-xs text-gray-500 mb-1",children:"Target Model"}),(0,t.jsx)(h.default,{accessToken:e,value:v.targetModel,placeholder:"Select target model",onChange:e=>w({...v,targetModel:e}),showLabel:!1})]}),(0,t.jsx)("div",{className:"flex items-end",children:(0,t.jsxs)("button",{onClick:()=>{if(!v.aliasName||!v.targetModel)return void x.default.fromBackend("Please provide both alias name and target model");if(j.some(e=>e.aliasName===v.aliasName))return void x.default.fromBackend("An alias with this name already exists");let e=[...j,{id:`${Date.now()}-${v.aliasName}`,aliasName:v.aliasName,targetModel:v.targetModel}];b(e),w({aliasName:"",targetModel:""});let t={};e.forEach(e=>{t[e.aliasName]=e.targetModel}),f&&f(t),x.default.success("Alias added successfully")},disabled:!v.aliasName||!v.targetModel,className:`flex items-center px-4 py-2 rounded-md text-sm ${!v.aliasName||!v.targetModel?"bg-gray-300 text-gray-500 cursor-not-allowed":"bg-green-600 text-white hover:bg-green-700"}`,children:[(0,t.jsx)(a.PlusCircleIcon,{className:"w-4 h-4 mr-1"}),"Add Alias"]})})]})]}),(0,t.jsx)(o.Text,{className:"text-sm font-medium text-gray-700 mb-2",children:"Manage Existing Aliases"}),(0,t.jsx)("div",{className:"rounded-lg custom-border relative mb-6",children:(0,t.jsx)("div",{className:"overflow-x-auto",children:(0,t.jsxs)(c.Table,{className:"[&_td]:py-0.5 [&_th]:py-1",children:[(0,t.jsx)(d.TableHead,{children:(0,t.jsxs)(p.TableRow,{children:[(0,t.jsx)(u.TableHeaderCell,{className:"py-1 h-8",children:"Alias Name"}),(0,t.jsx)(u.TableHeaderCell,{className:"py-1 h-8",children:"Target Model"}),(0,t.jsx)(u.TableHeaderCell,{className:"py-1 h-8",children:"Actions"})]})}),(0,t.jsxs)(m.TableBody,{children:[j.map(s=>(0,t.jsx)(p.TableRow,{className:"h-8",children:N&&N.id===s.id?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(g.TableCell,{className:"py-0.5",children:(0,t.jsx)("input",{type:"text",value:N.aliasName,onChange:e=>k({...N,aliasName:e.target.value}),className:"w-full px-2 py-1 border border-gray-300 rounded-md text-sm"})}),(0,t.jsx)(g.TableCell,{className:"py-0.5",children:(0,t.jsx)(h.default,{accessToken:e,value:N.targetModel,onChange:e=>k({...N,targetModel:e}),showLabel:!1,style:{height:"32px"}})}),(0,t.jsx)(g.TableCell,{className:"py-0.5 whitespace-nowrap",children:(0,t.jsxs)("div",{className:"flex space-x-2",children:[(0,t.jsx)("button",{onClick:S,className:"text-xs bg-blue-50 text-blue-600 px-2 py-1 rounded hover:bg-blue-100",children:"Save"}),(0,t.jsx)("button",{onClick:C,className:"text-xs bg-gray-50 text-gray-600 px-2 py-1 rounded hover:bg-gray-100",children:"Cancel"})]})})]}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(g.TableCell,{className:"py-0.5 text-sm text-gray-900",children:s.aliasName}),(0,t.jsx)(g.TableCell,{className:"py-0.5 text-sm text-gray-500",children:s.targetModel}),(0,t.jsx)(g.TableCell,{className:"py-0.5 whitespace-nowrap",children:(0,t.jsxs)("div",{className:"flex space-x-2",children:[(0,t.jsx)("button",{onClick:()=>{k({...s})},className:"text-xs bg-blue-50 text-blue-600 px-2 py-1 rounded hover:bg-blue-100",children:(0,t.jsx)(l.PencilIcon,{className:"w-3 h-3"})}),(0,t.jsx)("button",{onClick:()=>{var e;let t,a;return e=s.id,b(t=j.filter(t=>t.id!==e)),a={},void(t.forEach(e=>{a[e.aliasName]=e.targetModel}),f&&f(a),x.default.success("Alias deleted successfully"))},className:"text-xs bg-red-50 text-red-600 px-2 py-1 rounded hover:bg-red-100",children:(0,t.jsx)(r.TrashIcon,{className:"w-3 h-3"})})]})})]})},s.id)),0===j.length&&(0,t.jsx)(p.TableRow,{children:(0,t.jsx)(g.TableCell,{colSpan:3,className:"py-0.5 text-sm text-gray-500 text-center",children:"No aliases added yet. Add a new alias above."})})]})]})})}),_&&(0,t.jsxs)(i.Card,{children:[(0,t.jsx)(n.Title,{className:"mb-4",children:"Configuration Example"}),(0,t.jsx)(o.Text,{className:"text-gray-600 mb-4",children:"Here's how your current aliases would look in the config:"}),(0,t.jsx)("div",{className:"bg-gray-100 rounded-lg p-4 font-mono text-sm",children:(0,t.jsxs)("div",{className:"text-gray-700",children:["model_aliases:",0===Object.keys(T).length?(0,t.jsxs)("span",{className:"text-gray-500",children:[(0,t.jsx)("br",{}),"  # No aliases configured yet"]}):Object.entries(T).map(([e,s])=>(0,t.jsxs)("span",{children:[(0,t.jsx)("br",{}),'  "',e,'": "',s,'"']},e))]})})]})]})}])},651904,e=>{"use strict";var t=e.i(843476),s=e.i(599724),a=e.i(266484);e.s(["default",0,function({value:e,onChange:l,premiumUser:r=!1,disabledCallbacks:i=[],onDisabledCallbacksChange:n}){return r?(0,t.jsx)(a.default,{value:e,onChange:l,disabledCallbacks:i,onDisabledCallbacksChange:n}):(0,t.jsxs)("div",{children:[(0,t.jsxs)("div",{className:"flex flex-wrap gap-2 mb-3",children:[(0,t.jsx)("div",{className:"inline-flex items-center px-3 py-1.5 rounded-lg bg-green-50 border border-green-200 text-green-800 text-sm font-medium opacity-50",children:"✨ langfuse-logging"}),(0,t.jsx)("div",{className:"inline-flex items-center px-3 py-1.5 rounded-lg bg-green-50 border border-green-200 text-green-800 text-sm font-medium opacity-50",children:"✨ datadog-logging"})]}),(0,t.jsx)("div",{className:"p-3 bg-yellow-50 border border-yellow-200 rounded-lg",children:(0,t.jsxs)(s.Text,{className:"text-sm text-yellow-800",children:["Setting Key/Team logging settings is a LiteLLM Enterprise feature. Global Logging Settings are available for all free users. Get a trial key"," ",(0,t.jsx)("a",{href:"https://www.litellm.ai/#pricing",target:"_blank",rel:"noopener noreferrer",className:"underline",children:"here"}),"."]})})]})}])},460285,e=>{"use strict";var t=e.i(843476),s=e.i(271645),a=e.i(404206),l=e.i(723731),r=e.i(653824),i=e.i(881073),n=e.i(197647),o=e.i(764205),c=e.i(158392),d=e.i(419470),u=e.i(689020);let m=(0,s.forwardRef)(({accessToken:e,value:m,onChange:p,modelData:g},h)=>{let[x,y]=(0,s.useState)({routerSettings:{},selectedStrategy:null,enableTagFiltering:!1}),[f,_]=(0,s.useState)([]),[j,b]=(0,s.useState)([]),[v,w]=(0,s.useState)([]),[N,k]=(0,s.useState)([]),[S,C]=(0,s.useState)({}),[T,I]=(0,s.useState)({}),A=(0,s.useRef)(!1),L=(0,s.useRef)(null);(0,s.useEffect)(()=>{let e=m?.router_settings?JSON.stringify({routing_strategy:m.router_settings.routing_strategy,fallbacks:m.router_settings.fallbacks,enable_tag_filtering:m.router_settings.enable_tag_filtering}):null;if(A.current&&e===L.current){A.current=!1;return}if(A.current&&e!==L.current&&(A.current=!1),e!==L.current)if(L.current=e,m?.router_settings){let e=m.router_settings,{fallbacks:t,...s}=e;y({routerSettings:s,selectedStrategy:e.routing_strategy||null,enableTagFiltering:e.enable_tag_filtering??!1});let a=e.fallbacks||[];_(a),b(a&&0!==a.length?a.map((e,t)=>{let[s,a]=Object.entries(e)[0];return{id:(t+1).toString(),primaryModel:s||null,fallbackModels:a||[]}}):[{id:"1",primaryModel:null,fallbackModels:[]}])}else y({routerSettings:{},selectedStrategy:null,enableTagFiltering:!1}),_([]),b([{id:"1",primaryModel:null,fallbackModels:[]}])},[m]),(0,s.useEffect)(()=>{e&&(0,o.getRouterSettingsCall)(e).then(e=>{if(e.fields){let t={};e.fields.forEach(e=>{t[e.field_name]={ui_field_name:e.ui_field_name,field_description:e.field_description,options:e.options,link:e.link}}),C(t);let s=e.fields.find(e=>"routing_strategy"===e.field_name);s?.options&&k(s.options),e.routing_strategy_descriptions&&I(e.routing_strategy_descriptions)}})},[e]),(0,s.useEffect)(()=>{e&&(async()=>{try{let t=await (0,u.fetchAvailableModels)(e);w(t)}catch(e){console.error("Error fetching model info for fallbacks:",e)}})()},[e]);let F=()=>{let e=new Set(["allowed_fails","cooldown_time","num_retries","timeout","retry_after"]),t=new Set(["model_group_alias","retry_policy"]),s=Object.fromEntries(Object.entries({...x.routerSettings,enable_tag_filtering:x.enableTagFiltering,routing_strategy:x.selectedStrategy,fallbacks:f.length>0?f:null}).map(([s,a])=>{if("routing_strategy_args"!==s&&"routing_strategy"!==s&&"enable_tag_filtering"!==s&&"fallbacks"!==s){let l=document.querySelector(`input[name="${s}"]`);if(l&&void 0!==l.value&&""!==l.value){let r=((s,a,l)=>{if(null==a)return l;let r=String(a).trim();if(""===r||"null"===r.toLowerCase())return null;if(e.has(s)){let e=Number(r);return Number.isNaN(e)?l:e}if(t.has(s)){if(""===r)return null;try{return JSON.parse(r)}catch{return l}}return"true"===r.toLowerCase()||"false"!==r.toLowerCase()&&r})(s,l.value,a);return[s,r]}}else if("routing_strategy"===s)return[s,x.selectedStrategy];else if("enable_tag_filtering"===s)return[s,x.enableTagFiltering];else if("fallbacks"===s)return[s,f.length>0?f:null];else if("routing_strategy_args"===s&&"latency-based-routing"===x.selectedStrategy){let e=document.querySelector('input[name="lowest_latency_buffer"]'),t=document.querySelector('input[name="ttl"]'),s={};return e?.value&&(s.lowest_latency_buffer=Number(e.value)),t?.value&&(s.ttl=Number(t.value)),["routing_strategy_args",Object.keys(s).length>0?s:null]}return[s,a]}).filter(e=>null!=e)),a=(e,t=!1)=>null==e||"object"==typeof e&&!Array.isArray(e)&&0===Object.keys(e).length||t&&("number"!=typeof e||Number.isNaN(e))?null:e;return{routing_strategy:a(s.routing_strategy),allowed_fails:a(s.allowed_fails,!0),cooldown_time:a(s.cooldown_time,!0),num_retries:a(s.num_retries,!0),timeout:a(s.timeout,!0),retry_after:a(s.retry_after,!0),fallbacks:f.length>0?f:null,context_window_fallbacks:a(s.context_window_fallbacks),retry_policy:a(s.retry_policy),model_group_alias:a(s.model_group_alias),enable_tag_filtering:x.enableTagFiltering,routing_strategy_args:a(s.routing_strategy_args)}};(0,s.useEffect)(()=>{if(!p)return;let e=setTimeout(()=>{A.current=!0,p({router_settings:F()})},100);return()=>clearTimeout(e)},[x,f]);let O=Array.from(new Set(v.map(e=>e.model_group))).sort();return((0,s.useImperativeHandle)(h,()=>({getValue:()=>({router_settings:F()})})),e)?(0,t.jsx)("div",{className:"w-full",children:(0,t.jsxs)(r.TabGroup,{className:"w-full",children:[(0,t.jsxs)(i.TabList,{variant:"line",defaultValue:"1",className:"px-8 pt-4",children:[(0,t.jsx)(n.Tab,{value:"1",children:"Loadbalancing"}),(0,t.jsx)(n.Tab,{value:"2",children:"Fallbacks"})]}),(0,t.jsxs)(l.TabPanels,{className:"px-8 py-6",children:[(0,t.jsx)(a.TabPanel,{children:(0,t.jsx)(c.default,{value:x,onChange:y,routerFieldsMetadata:S,availableRoutingStrategies:N,routingStrategyDescriptions:T})}),(0,t.jsx)(a.TabPanel,{children:(0,t.jsx)(d.FallbackSelectionForm,{groups:j,onGroupsChange:e=>{b(e),_(e.filter(e=>e.primaryModel&&e.fallbackModels.length>0).map(e=>({[e.primaryModel]:e.fallbackModels})))},availableModels:O,maxGroups:5})})]})]})}):null});m.displayName="RouterSettingsAccordion",e.s(["default",0,m])},575260,e=>{"use strict";var t=e.i(843476),s=e.i(199133),a=e.i(482725),l=e.i(56456);e.s(["default",0,({projects:e,value:r,onChange:i,disabled:n,loading:o,teamId:c})=>{let d=c?e?.filter(e=>e.team_id===c):e;return(0,t.jsx)(s.Select,{showSearch:!0,placeholder:"Search or select a project",value:r,onChange:i,disabled:n,loading:o,allowClear:!0,notFoundContent:o?(0,t.jsx)(a.Spin,{indicator:(0,t.jsx)(l.LoadingOutlined,{spin:!0}),size:"small"}):void 0,filterOption:(e,t)=>{if(!t)return!1;let s=d?.find(e=>e.project_id===t.key);if(!s)return!1;let a=e.toLowerCase().trim(),l=(s.project_alias||"").toLowerCase(),r=(s.project_id||"").toLowerCase();return l.includes(a)||r.includes(a)},optionFilterProp:"children",children:!o&&d?.map(e=>(0,t.jsxs)(s.Select.Option,{value:e.project_id,children:[(0,t.jsx)("span",{className:"font-medium",children:e.project_alias||e.project_id})," ",(0,t.jsxs)("span",{className:"text-gray-500",children:["(",e.project_id,")"]})]},e.project_id))})}])},702597,364769,e=>{"use strict";var t=e.i(843476),s=e.i(207082),a=e.i(109799),l=e.i(510674),r=e.i(109034),i=e.i(292639),n=e.i(135214),o=e.i(500330),c=e.i(827252),d=e.i(912598),u=e.i(677667),m=e.i(130643),p=e.i(898667),g=e.i(994388),h=e.i(309426),x=e.i(350967),y=e.i(599724),f=e.i(779241),_=e.i(629569),j=e.i(464571),b=e.i(808613),v=e.i(311451),w=e.i(212931),N=e.i(91739),k=e.i(199133),S=e.i(790848),C=e.i(262218),T=e.i(592968),I=e.i(374009),A=e.i(271645),L=e.i(708347),F=e.i(552130),O=e.i(557662),M=e.i(9314),P=e.i(860585),E=e.i(82946),$=e.i(392110),V=e.i(533882),B=e.i(844565),R=e.i(651904),G=e.i(939510),D=e.i(460285),K=e.i(663435),z=e.i(363256),U=e.i(575260),q=e.i(371455),W=e.i(355619),H=e.i(75921),Q=e.i(390605),J=e.i(727749),Y=e.i(764205),X=e.i(237016),Z=e.i(888259);let ee=({apiKey:e})=>{let[s,a]=(0,A.useState)(!1);return(0,t.jsxs)("div",{children:[(0,t.jsxs)("p",{className:"mb-2",children:["Please save this secret key somewhere safe and accessible. For security reasons,"," ",(0,t.jsx)("b",{children:"you will not be able to view it again"})," through your LiteLLM account. If you lose this secret key, you will need to generate a new one."]}),(0,t.jsx)("p",{className:"text-sm text-gray-600 mt-3 mb-1",children:"Virtual Key:"}),(0,t.jsx)("div",{style:{background:"#f8f8f8",padding:"10px",borderRadius:"5px",marginBottom:"10px"},children:(0,t.jsx)("pre",{style:{wordWrap:"break-word",whiteSpace:"normal",margin:0},children:e})}),(0,t.jsx)(X.CopyToClipboard,{text:e,onCopy:()=>{a(!0),Z.default.success("Key copied to clipboard"),setTimeout(()=>a(!1),2e3)},children:(0,t.jsx)(j.Button,{type:"primary",style:{marginTop:12},children:s?"Copied!":"Copy Virtual Key"})})]})};e.s(["default",0,ee],364769);var et=e.i(435451),es=e.i(916940);let{Option:ea}=k.Select,el=async(e,t,s,a)=>{try{if(null===e||null===t)return[];if(null!==s){let l=(await (0,Y.modelAvailableCall)(s,e,t,!0,a,!0)).data.map(e=>e.id);return console.log("available_model_names:",l),l}return[]}catch(e){return console.error("Error fetching user models:",e),[]}},er=async(e,t,s,a)=>{try{if(null===e||null===t)return;if(null!==s){let l=(await (0,Y.modelAvailableCall)(s,e,t)).data.map(e=>e.id);console.log("available_model_names:",l),a(l)}}catch(e){console.error("Error fetching user models:",e)}};e.s(["default",0,({team:e,teams:X,data:Z,addKey:ei,autoOpenCreate:en,prefillData:eo})=>{let{accessToken:ec,userId:ed,userRole:eu,premiumUser:em}=(0,n.default)(),ep=em||null!=eu&&L.rolesWithWriteAccess.includes(eu),{data:eg,isLoading:eh}=(0,a.useOrganizations)(),{data:ex,isLoading:ey}=(0,l.useProjects)(),{data:ef}=(0,i.useUISettings)(),{data:e_}=(0,r.useTags)(),ej=!!ef?.values?.enable_projects_ui,eb=!!ef?.values?.disable_custom_api_keys,ev=e_?Object.values(e_).map(e=>({value:e.name,label:e.name})):[],ew=(0,d.useQueryClient)(),[eN]=b.Form.useForm(),[ek,eS]=(0,A.useState)(!1),[eC,eT]=(0,A.useState)(null),[eI,eA]=(0,A.useState)(null),[eL,eF]=(0,A.useState)([]),[eO,eM]=(0,A.useState)([]),[eP,eE]=(0,A.useState)("you"),[e$,eV]=(0,A.useState)(!1),[eB,eR]=(0,A.useState)(null),[eG,eD]=(0,A.useState)([]),[eK,ez]=(0,A.useState)([]),[eU,eq]=(0,A.useState)([]),[eW,eH]=(0,A.useState)([]),[eQ,eJ]=(0,A.useState)(e),[eY,eX]=(0,A.useState)(null),[eZ,e0]=(0,A.useState)(null),[e1,e2]=(0,A.useState)(!1),[e4,e5]=(0,A.useState)(null),[e3,e6]=(0,A.useState)({}),[e7,e9]=(0,A.useState)([]),[e8,te]=(0,A.useState)(!1),[tt,ts]=(0,A.useState)([]),[ta,tl]=(0,A.useState)([]),[tr,ti]=(0,A.useState)("llm_api"),[tn,to]=(0,A.useState)({}),[tc,td]=(0,A.useState)(!1),[tu,tm]=(0,A.useState)("30d"),[tp,tg]=(0,A.useState)(null),[th,tx]=(0,A.useState)(0),[ty,tf]=(0,A.useState)([]),[t_,tj]=(0,A.useState)(null),tb=()=>{eS(!1),eN.resetFields(),eH([]),tl([]),ti("llm_api"),to({}),td(!1),tm("30d"),tg(null),tx(e=>e+1),tj(null),eX(null),e0(null)},tv=()=>{eS(!1),eT(null),eJ(null),eN.resetFields(),eH([]),tl([]),ti("llm_api"),to({}),td(!1),tm("30d"),tg(null),tx(e=>e+1),tj(null),eX(null),e0(null)};(0,A.useEffect)(()=>{ed&&eu&&ec&&er(ed,eu,ec,eF)},[ec,ed,eu]),(0,A.useEffect)(()=>{ec&&(0,Y.getAgentsList)(ec).then(e=>tf(e?.agents||[])).catch(()=>tf([]))},[ec]),(0,A.useEffect)(()=>{let e=async()=>{try{let e=(await (0,Y.getPoliciesList)(ec)).policies.map(e=>e.policy_name);ez(e)}catch(e){console.error("Failed to fetch policies:",e)}},t=async()=>{try{let e=await (0,Y.getPromptsList)(ec);eq(e.prompts.map(e=>e.prompt_id))}catch(e){console.error("Failed to fetch prompts:",e)}};(async()=>{try{let e=(await (0,Y.getGuardrailsList)(ec)).guardrails.map(e=>e.guardrail_name);eD(e)}catch(e){console.error("Failed to fetch guardrails:",e)}})(),e(),t()},[ec]),(0,A.useEffect)(()=>{(async()=>{try{if(ec){let e=sessionStorage.getItem("possibleUserRoles");if(e)e6(JSON.parse(e));else{let e=await (0,Y.getPossibleUserRoles)(ec);sessionStorage.setItem("possibleUserRoles",JSON.stringify(e)),e6(e)}}}catch(e){console.error("Error fetching possible user roles:",e)}})()},[ec]),(0,A.useEffect)(()=>{if(en&&!e$&&X&&eu&&L.rolesWithWriteAccess.includes(eu)&&(eS(!0),eV(!0),eo)){if(eo.owned_by&&("another_user"===eo.owned_by&&"Admin"!==eu?eE("you"):eE(eo.owned_by)),eo.team_id){let e=X?.find(e=>e.team_id===eo.team_id)||null;e&&(eJ(e),eN.setFieldsValue({team_id:eo.team_id}))}eo.key_alias&&eN.setFieldsValue({key_alias:eo.key_alias}),eo.models&&eo.models.length>0&&eR(eo.models),eo.key_type&&(ti(eo.key_type),eN.setFieldsValue({key_type:eo.key_type}))}},[en,eo,X,e$,eN,eu]);let tw=eO.includes("no-default-models")&&!eQ,tN=async e=>{try{let t,a=e?.key_alias??"",l=e?.team_id??null;if((Z?.filter(e=>e.team_id===l).map(e=>e.key_alias)??[]).includes(a))throw Error(`Key alias ${a} already exists for team with ID ${l}, please provide another key alias`);if(J.default.info("Making API Call"),eS(!0),"you"===eP)e.user_id=ed;else if("agent"===eP){if(!t_)return void J.default.fromBackend("Please select an agent");e.agent_id=t_}let r={};try{r=JSON.parse(e.metadata||"{}")}catch(e){console.error("Error parsing metadata:",e)}if("service_account"===eP&&(r.service_account_id=e.key_alias),eW.length>0&&(r={...r,logging:eW.filter(e=>e.callback_name)}),ta.length>0){let e=(0,O.mapDisplayToInternalNames)(ta);r={...r,litellm_disabled_callbacks:e}}if(tc&&(e.auto_rotate=!0,e.rotation_interval=tu),e.duration&&""!==e.duration.trim()||(e.duration=null),e.metadata=JSON.stringify(r),e.allowed_vector_store_ids&&e.allowed_vector_store_ids.length>0&&(e.object_permission={vector_stores:e.allowed_vector_store_ids},delete e.allowed_vector_store_ids),e.allowed_mcp_servers_and_groups&&(e.allowed_mcp_servers_and_groups.servers?.length>0||e.allowed_mcp_servers_and_groups.accessGroups?.length>0)){e.object_permission||(e.object_permission={});let{servers:t,accessGroups:s}=e.allowed_mcp_servers_and_groups;t&&t.length>0&&(e.object_permission.mcp_servers=t),s&&s.length>0&&(e.object_permission.mcp_access_groups=s),delete e.allowed_mcp_servers_and_groups}let i=e.mcp_tool_permissions||{};if(Object.keys(i).length>0&&(e.object_permission||(e.object_permission={}),e.object_permission.mcp_tool_permissions=i),delete e.mcp_tool_permissions,e.allowed_mcp_access_groups&&e.allowed_mcp_access_groups.length>0&&(e.object_permission||(e.object_permission={}),e.object_permission.mcp_access_groups=e.allowed_mcp_access_groups,delete e.allowed_mcp_access_groups),e.allowed_agents_and_groups&&(e.allowed_agents_and_groups.agents?.length>0||e.allowed_agents_and_groups.accessGroups?.length>0)){e.object_permission||(e.object_permission={});let{agents:t,accessGroups:s}=e.allowed_agents_and_groups;t&&t.length>0&&(e.object_permission.agents=t),s&&s.length>0&&(e.object_permission.agent_access_groups=s),delete e.allowed_agents_and_groups}Object.keys(tn).length>0&&(e.aliases=JSON.stringify(tn)),tp?.router_settings&&Object.values(tp.router_settings).some(e=>null!=e&&""!==e)&&(e.router_settings=tp.router_settings),t="service_account"===eP?await (0,Y.keyCreateServiceAccountCall)(ec,e):await (0,Y.keyCreateCall)(ec,ed,e),console.log("key create Response:",t),ei(t),ew.invalidateQueries({queryKey:s.keyKeys.lists()}),eT(t.key),eA(t.soft_budget),J.default.success("Virtual Key Created"),eN.resetFields(),localStorage.removeItem("userData"+ed)}catch(t){console.log("error in create key:",t);let e=(e=>{let t;if(!(t=!e||"object"!=typeof e||e instanceof Error?String(e):JSON.stringify(e)).includes("/key/generate")&&!t.includes("KeyManagementRoutes.KEY_GENERATE"))return`Error creating the key: ${e}`;let s=t;try{if(!e||"object"!=typeof e||e instanceof Error){let e=t.match(/\{[\s\S]*\}/);if(e){let t=JSON.parse(e[0]),a=t?.error||t;a?.message&&(s=a.message)}}else{let t=e?.error||e;t?.message&&(s=t.message)}}catch(e){}return t.includes("team_member_permission_error")||s.includes("Team member does not have permissions")?"Team member does not have permission to generate key for this team. Ask your proxy admin to configure the team member permission settings.":`Error creating the key: ${e}`})(t);J.default.fromBackend(e)}};(0,A.useEffect)(()=>{if(eZ){let e=ex?.find(e=>e.project_id===eZ);eM(e?.models??[]),eN.setFieldValue("models",[]);return}ed&&eu&&ec&&el(ed,eu,ec,eQ?.team_id??null).then(e=>{eM(Array.from(new Set([...eQ?.models??[],...e])))}),eB||eN.setFieldValue("models",[]),eN.setFieldValue("allowed_mcp_servers_and_groups",{servers:[],accessGroups:[]})},[eQ,eZ,ec,ed,eu,eN]),(0,A.useEffect)(()=>{if(!eB||0===eB.length||!eO||0===eO.length)return;let e=eB.filter(e=>eO.includes(e));e.length>0&&eN.setFieldsValue({models:e}),eR(null)},[eB,eO,eN]),(0,A.useEffect)(()=>{if(!eZ||!X)return;let e=ex?.find(e=>e.project_id===eZ);if(!e?.team_id||eQ?.team_id===e.team_id)return;let t=X.find(t=>t.team_id===e.team_id)||null;t&&(eJ(t),eN.setFieldValue("team_id",t.team_id))},[X,eZ,ex]);let tk=async e=>{if(!e)return void e9([]);te(!0);try{let t=new URLSearchParams;if(t.append("user_email",e),null==ec)return;let s=(await (0,Y.userFilterUICall)(ec,t)).map(e=>({label:`${e.user_email} (${e.user_id})`,value:e.user_id,user:e}));e9(s)}catch(e){console.error("Error fetching users:",e),J.default.fromBackend("Failed to search for users")}finally{te(!1)}},tS=(0,A.useCallback)((0,I.default)(e=>tk(e),300),[ec]);return(0,t.jsxs)("div",{children:[eu&&L.rolesWithWriteAccess.includes(eu)&&(0,t.jsx)(g.Button,{className:"mx-auto",onClick:()=>eS(!0),children:"+ Create New Key"}),(0,t.jsx)(w.Modal,{open:ek,width:1e3,footer:null,onOk:tb,onCancel:tv,children:(0,t.jsxs)(b.Form,{form:eN,onFinish:tN,labelCol:{span:8},wrapperCol:{span:16},labelAlign:"left",children:[(0,t.jsxs)("div",{className:"mb-8",children:[(0,t.jsx)(_.Title,{className:"mb-4",children:"Key Ownership"}),(0,t.jsx)(b.Form.Item,{label:(0,t.jsxs)("span",{children:["Owned By"," ",(0,t.jsx)(T.Tooltip,{title:"Select who will own this Virtual Key",children:(0,t.jsx)(c.InfoCircleOutlined,{style:{marginLeft:"4px"}})})]}),className:"mb-4",children:(0,t.jsxs)(N.Radio.Group,{onChange:e=>eE(e.target.value),value:eP,children:[(0,t.jsx)(N.Radio,{value:"you",children:"You"}),(0,t.jsx)(N.Radio,{value:"service_account",children:"Service Account"}),"Admin"===eu&&(0,t.jsx)(N.Radio,{value:"another_user",children:"Another User"}),(0,t.jsxs)(N.Radio,{value:"agent",children:["Agent ",(0,t.jsx)(C.Tag,{color:"purple",children:"New"})]})]})}),"another_user"===eP&&(0,t.jsx)(b.Form.Item,{label:(0,t.jsxs)("span",{children:["User ID"," ",(0,t.jsx)(T.Tooltip,{title:"The user who will own this key and be responsible for its usage",children:(0,t.jsx)(c.InfoCircleOutlined,{style:{marginLeft:"4px"}})})]}),name:"user_id",className:"mt-4",rules:[{required:"another_user"===eP,message:"Please input the user ID of the user you are assigning the key to"}],children:(0,t.jsxs)("div",{children:[(0,t.jsxs)("div",{style:{display:"flex",marginBottom:"8px"},children:[(0,t.jsx)(k.Select,{showSearch:!0,placeholder:"Type email to search for users",filterOption:!1,onSearch:e=>{tS(e)},onSelect:(e,t)=>{let s;return s=t.user,void eN.setFieldsValue({user_id:s.user_id})},options:e7,loading:e8,allowClear:!0,style:{width:"100%"},notFoundContent:e8?"Searching...":"No users found"}),(0,t.jsx)(j.Button,{onClick:()=>e2(!0),style:{marginLeft:"8px"},children:"Create User"})]}),(0,t.jsx)("div",{className:"text-xs text-gray-500",children:"Search by email to find users"})]})}),"agent"===eP&&(0,t.jsxs)("div",{className:"mt-4 p-4 bg-purple-50 border border-purple-200 rounded-md",children:[(0,t.jsx)("div",{className:"mb-3",children:(0,t.jsxs)("span",{className:"text-sm font-medium text-gray-700",children:["Select Agent ",(0,t.jsx)("span",{className:"text-red-500",children:"*"})]})}),(0,t.jsx)(k.Select,{showSearch:!0,placeholder:"Select an agent",style:{width:"100%"},value:t_,onChange:e=>tj(e),filterOption:(e,t)=>t?.label?.toLowerCase().includes(e.toLowerCase()),options:ty.map(e=>({label:e.agent_name||e.agent_id,value:e.agent_id}))}),(0,t.jsx)("div",{className:"text-xs text-gray-500 mt-2",children:"This key will be used by the selected agent to make requests to LiteLLM"})]}),(0,t.jsx)(b.Form.Item,{label:(0,t.jsxs)("span",{children:["Organization"," ",(0,t.jsx)(T.Tooltip,{title:"The organization this key belongs to. Selecting an organization filters the available teams.",children:(0,t.jsx)(c.InfoCircleOutlined,{style:{marginLeft:"4px"}})})]}),name:"organization_id",className:"mt-4",children:(0,t.jsx)(z.default,{organizations:eg,loading:eh,disabled:"Admin"!==eu,onChange:e=>{eX(e||null),eJ(null),e0(null),eN.setFieldValue("team_id",void 0),eN.setFieldValue("project_id",void 0)}})}),(0,t.jsx)(b.Form.Item,{label:(0,t.jsxs)("span",{children:["Team"," ",(0,t.jsx)(T.Tooltip,{title:"The team this key belongs to, which determines available models and budget limits",children:(0,t.jsx)(c.InfoCircleOutlined,{style:{marginLeft:"4px"}})})]}),name:"team_id",initialValue:e?e.team_id:null,className:"mt-4",rules:[{required:"service_account"===eP,message:"Please select a team for the service account"}],help:"service_account"===eP?"required":"",children:(0,t.jsx)(K.default,{disabled:null!==eZ,organizationId:eY,onTeamSelect:e=>{eJ(e),e0(null),eN.setFieldValue("project_id",void 0),e?.organization_id?(eX(e.organization_id),eN.setFieldValue("organization_id",e.organization_id)):e||(eX(null),eN.setFieldValue("organization_id",void 0))}})}),ej&&(0,t.jsx)(b.Form.Item,{label:(0,t.jsxs)("span",{children:["Project"," ",(0,t.jsx)(T.Tooltip,{title:"Assign this key to a project. Selecting a project will lock the team to the project's team.",children:(0,t.jsx)(c.InfoCircleOutlined,{style:{marginLeft:"4px"}})})]}),name:"project_id",className:"mt-4",children:(0,t.jsx)(U.default,{projects:ex,teamId:eQ?.team_id,loading:ey||!X,onChange:e=>{if(!e){e0(null),eJ(null),eN.setFieldValue("team_id",void 0);return}e0(e)}})})]}),tw&&(0,t.jsx)("div",{className:"mb-8 p-4 bg-blue-50 border border-blue-200 rounded-md",children:(0,t.jsx)(y.Text,{className:"text-blue-800 text-sm",children:"Please select a team to continue configuring your Virtual Key. If you do not see any teams, please contact your Proxy Admin to either provide you with access to models or to add you to a team."})}),!tw&&(0,t.jsxs)("div",{className:"mb-8",children:[(0,t.jsx)(_.Title,{className:"mb-4",children:"Key Details"}),(0,t.jsx)(b.Form.Item,{label:(0,t.jsxs)("span",{children:["you"===eP||"another_user"===eP?"Key Name":"Service Account ID"," ",(0,t.jsx)(T.Tooltip,{title:"you"===eP||"another_user"===eP?"A descriptive name to identify this key":"Unique identifier for this service account",children:(0,t.jsx)(c.InfoCircleOutlined,{style:{marginLeft:"4px"}})})]}),name:"key_alias",rules:[{required:!0,message:`Please input a ${"you"===eP?"key name":"service account ID"}`}],help:"required",children:(0,t.jsx)(f.TextInput,{placeholder:""})}),(0,t.jsx)(b.Form.Item,{label:(0,t.jsxs)("span",{children:["Models"," ",(0,t.jsx)(T.Tooltip,{title:"Select which models this key can access. Choose 'All Team Models' to grant access to all models available to the team. Leave empty to allow access to all models.",children:(0,t.jsx)(c.InfoCircleOutlined,{style:{marginLeft:"4px"}})})]}),name:"models",rules:[],help:"management"===tr||"read_only"===tr?"Models field is disabled for this key type":"optional - leave empty to allow access to all models",className:"mt-4",children:(0,t.jsxs)(k.Select,{mode:"multiple",placeholder:"Select models",style:{width:"100%"},disabled:"management"===tr||"read_only"===tr,onChange:e=>{e.includes("all-team-models")&&eN.setFieldsValue({models:["all-team-models"]})},children:[!eZ&&(0,t.jsx)(ea,{value:"all-team-models",children:"All Team Models"},"all-team-models"),eO.map(e=>(0,t.jsx)(ea,{value:e,children:(0,W.getModelDisplayName)(e)},e))]})}),(0,t.jsx)(b.Form.Item,{label:(0,t.jsxs)("span",{children:["Key Type"," ",(0,t.jsx)(T.Tooltip,{title:"Select the type of key to determine what routes and operations this key can access",children:(0,t.jsx)(c.InfoCircleOutlined,{style:{marginLeft:"4px"}})})]}),name:"key_type",initialValue:"llm_api",className:"mt-4",children:(0,t.jsxs)(k.Select,{defaultValue:"llm_api",placeholder:"Select key type",style:{width:"100%"},optionLabelProp:"label",onChange:e=>{ti(e),("management"===e||"read_only"===e)&&eN.setFieldsValue({models:[]})},children:[(0,t.jsx)(ea,{value:"default",label:"Default",children:(0,t.jsxs)("div",{style:{padding:"4px 0"},children:[(0,t.jsx)("div",{style:{fontWeight:500},children:"Default"}),(0,t.jsx)("div",{style:{fontSize:"11px",color:"#6b7280",marginTop:"2px"},children:"Can call AI APIs + Management routes"})]})}),(0,t.jsx)(ea,{value:"llm_api",label:"AI APIs",children:(0,t.jsxs)("div",{style:{padding:"4px 0"},children:[(0,t.jsx)("div",{style:{fontWeight:500},children:"AI APIs"}),(0,t.jsx)("div",{style:{fontSize:"11px",color:"#6b7280",marginTop:"2px"},children:"Can call only AI API routes (chat/completions, embeddings, etc.)"})]})}),(0,t.jsx)(ea,{value:"management",label:"Management",children:(0,t.jsxs)("div",{style:{padding:"4px 0"},children:[(0,t.jsx)("div",{style:{fontWeight:500},children:"Management"}),(0,t.jsx)("div",{style:{fontSize:"11px",color:"#6b7280",marginTop:"2px"},children:"Can call only management routes (user/team/key management)"})]})})]})})]}),!tw&&(0,t.jsx)("div",{className:"mb-8",children:(0,t.jsxs)(u.Accordion,{className:"mt-4 mb-4",children:[(0,t.jsx)(p.AccordionHeader,{children:(0,t.jsx)(_.Title,{className:"m-0",children:"Optional Settings"})}),(0,t.jsxs)(m.AccordionBody,{children:[(0,t.jsx)(b.Form.Item,{className:"mt-4",label:(0,t.jsxs)("span",{children:["Max Budget (USD)"," ",(0,t.jsx)(T.Tooltip,{title:"Maximum amount in USD this key can spend. When reached, the key will be blocked from making further requests",children:(0,t.jsx)(c.InfoCircleOutlined,{style:{marginLeft:"4px"}})})]}),name:"max_budget",help:`Budget cannot exceed team max budget: $${e?.max_budget!==null&&e?.max_budget!==void 0?e?.max_budget:"unlimited"}`,rules:[{validator:async(t,s)=>{if(s&&e&&null!==e.max_budget&&s>e.max_budget)throw Error(`Budget cannot exceed team max budget: $${(0,o.formatNumberWithCommas)(e.max_budget,4)}`)}}],children:(0,t.jsx)(et.default,{step:.01,precision:2,width:200})}),(0,t.jsx)(b.Form.Item,{className:"mt-4",label:(0,t.jsxs)("span",{children:["Reset Budget"," ",(0,t.jsx)(T.Tooltip,{title:"How often the budget should reset. For example, setting 'daily' will reset the budget every 24 hours",children:(0,t.jsx)(c.InfoCircleOutlined,{style:{marginLeft:"4px"}})})]}),name:"budget_duration",help:`Team Reset Budget: ${e?.budget_duration!==null&&e?.budget_duration!==void 0?e?.budget_duration:"None"}`,children:(0,t.jsx)(P.default,{onChange:e=>eN.setFieldValue("budget_duration",e)})}),(0,t.jsx)(b.Form.Item,{className:"mt-4",label:(0,t.jsxs)("span",{children:["Tokens per minute Limit (TPM)"," ",(0,t.jsx)(T.Tooltip,{title:"Maximum number of tokens this key can process per minute. Helps control usage and costs",children:(0,t.jsx)(c.InfoCircleOutlined,{style:{marginLeft:"4px"}})})]}),name:"tpm_limit",help:`TPM cannot exceed team TPM limit: ${e?.tpm_limit!==null&&e?.tpm_limit!==void 0?e?.tpm_limit:"unlimited"}`,rules:[{validator:async(t,s)=>{if(s&&e&&null!==e.tpm_limit&&s>e.tpm_limit)throw Error(`TPM limit cannot exceed team TPM limit: ${e.tpm_limit}`)}}],children:(0,t.jsx)(et.default,{step:1,width:400})}),(0,t.jsx)(G.default,{type:"tpm",name:"tpm_limit_type",className:"mt-4",initialValue:null,form:eN,showDetailedDescriptions:!0}),(0,t.jsx)(b.Form.Item,{className:"mt-4",label:(0,t.jsxs)("span",{children:["Requests per minute Limit (RPM)"," ",(0,t.jsx)(T.Tooltip,{title:"Maximum number of API requests this key can make per minute. Helps prevent abuse and manage load",children:(0,t.jsx)(c.InfoCircleOutlined,{style:{marginLeft:"4px"}})})]}),name:"rpm_limit",help:`RPM cannot exceed team RPM limit: ${e?.rpm_limit!==null&&e?.rpm_limit!==void 0?e?.rpm_limit:"unlimited"}`,rules:[{validator:async(t,s)=>{if(s&&e&&null!==e.rpm_limit&&s>e.rpm_limit)throw Error(`RPM limit cannot exceed team RPM limit: ${e.rpm_limit}`)}}],children:(0,t.jsx)(et.default,{step:1,width:400})}),(0,t.jsx)(G.default,{type:"rpm",name:"rpm_limit_type",className:"mt-4",initialValue:null,form:eN,showDetailedDescriptions:!0}),(0,t.jsx)(b.Form.Item,{label:(0,t.jsxs)("span",{children:["Guardrails"," ",(0,t.jsx)(T.Tooltip,{title:"Apply safety guardrails to this key to filter content or enforce policies",children:(0,t.jsx)("a",{href:"https://docs.litellm.ai/docs/proxy/guardrails/quick_start",target:"_blank",rel:"noopener noreferrer",onClick:e=>e.stopPropagation(),children:(0,t.jsx)(c.InfoCircleOutlined,{style:{marginLeft:"4px"}})})})]}),name:"guardrails",className:"mt-4",help:ep?"Select existing guardrails or enter new ones":"Premium feature - Upgrade to set guardrails by key",children:(0,t.jsx)(k.Select,{mode:"tags",style:{width:"100%"},disabled:!ep,placeholder:ep?"Select or enter guardrails":"Premium feature - Upgrade to set guardrails by key",options:eG.map(e=>({value:e,label:e}))})}),(0,t.jsx)(b.Form.Item,{label:(0,t.jsxs)("span",{children:["Disable Global Guardrails"," ",(0,t.jsx)(T.Tooltip,{title:"When enabled, this key will bypass any guardrails configured to run on every request (global guardrails)",children:(0,t.jsx)("a",{href:"https://docs.litellm.ai/docs/proxy/guardrails/quick_start",target:"_blank",rel:"noopener noreferrer",onClick:e=>e.stopPropagation(),children:(0,t.jsx)(c.InfoCircleOutlined,{style:{marginLeft:"4px"}})})})]}),name:"disable_global_guardrails",className:"mt-4",valuePropName:"checked",help:ep?"Bypass global guardrails for this key":"Premium feature - Upgrade to disable global guardrails by key",children:(0,t.jsx)(S.Switch,{disabled:!ep,checkedChildren:"Yes",unCheckedChildren:"No"})}),(0,t.jsx)(b.Form.Item,{label:(0,t.jsxs)("span",{children:["Policies"," ",(0,t.jsx)(T.Tooltip,{title:"Apply policies to this key to control guardrails and other settings",children:(0,t.jsx)("a",{href:"https://docs.litellm.ai/docs/proxy/guardrails/guardrail_policies",target:"_blank",rel:"noopener noreferrer",onClick:e=>e.stopPropagation(),children:(0,t.jsx)(c.InfoCircleOutlined,{style:{marginLeft:"4px"}})})})]}),name:"policies",className:"mt-4",help:em?"Select existing policies or enter new ones":"Premium feature - Upgrade to set policies by key",children:(0,t.jsx)(k.Select,{mode:"tags",style:{width:"100%"},disabled:!em,placeholder:em?"Select or enter policies":"Premium feature - Upgrade to set policies by key",options:eK.map(e=>({value:e,label:e}))})}),(0,t.jsx)(b.Form.Item,{label:(0,t.jsxs)("span",{children:["Prompts"," ",(0,t.jsx)(T.Tooltip,{title:"Allow this key to use specific prompt templates",children:(0,t.jsx)("a",{href:"https://docs.litellm.ai/docs/proxy/prompt_management",target:"_blank",rel:"noopener noreferrer",onClick:e=>e.stopPropagation(),children:(0,t.jsx)(c.InfoCircleOutlined,{style:{marginLeft:"4px"}})})})]}),name:"prompts",className:"mt-4",help:em?"Select existing prompts or enter new ones":"Premium feature - Upgrade to set prompts by key",children:(0,t.jsx)(k.Select,{mode:"tags",style:{width:"100%"},disabled:!em,placeholder:em?"Select or enter prompts":"Premium feature - Upgrade to set prompts by key",options:eU.map(e=>({value:e,label:e}))})}),(0,t.jsx)(b.Form.Item,{label:(0,t.jsxs)("span",{children:["Access Groups"," ",(0,t.jsx)(T.Tooltip,{title:"Assign access groups to this key. Access groups control which models, MCP servers, and agents this key can use",children:(0,t.jsx)(c.InfoCircleOutlined,{style:{marginLeft:"4px"}})})]}),name:"access_group_ids",className:"mt-4",help:"Select access groups to assign to this key",children:(0,t.jsx)(M.default,{placeholder:"Select access groups (optional)"})}),(0,t.jsx)(b.Form.Item,{label:(0,t.jsxs)("span",{children:["Allowed Pass Through Routes"," ",(0,t.jsx)(T.Tooltip,{title:"Allow this key to use specific pass through routes",children:(0,t.jsx)("a",{href:"https://docs.litellm.ai/docs/proxy/pass_through",target:"_blank",rel:"noopener noreferrer",onClick:e=>e.stopPropagation(),children:(0,t.jsx)(c.InfoCircleOutlined,{style:{marginLeft:"4px"}})})})]}),name:"allowed_passthrough_routes",className:"mt-4",help:em?"Select existing pass through routes or enter new ones":"Premium feature - Upgrade to set pass through routes by key",children:(0,t.jsx)(B.default,{onChange:e=>eN.setFieldValue("allowed_passthrough_routes",e),value:eN.getFieldValue("allowed_passthrough_routes"),accessToken:ec,placeholder:em?"Select or enter pass through routes":"Premium feature - Upgrade to set pass through routes by key",disabled:!em,teamId:eQ?eQ.team_id:null})}),(0,t.jsx)(b.Form.Item,{label:(0,t.jsxs)("span",{children:["Allowed Vector Stores"," ",(0,t.jsx)(T.Tooltip,{title:"Select which vector stores this key can access. If none selected, the key will have access to all available vector stores",children:(0,t.jsx)(c.InfoCircleOutlined,{style:{marginLeft:"4px"}})})]}),name:"allowed_vector_store_ids",className:"mt-4",help:"Select vector stores this key can access. Leave empty for access to all vector stores",children:(0,t.jsx)(es.default,{onChange:e=>eN.setFieldValue("allowed_vector_store_ids",e),value:eN.getFieldValue("allowed_vector_store_ids"),accessToken:ec,placeholder:"Select vector stores (optional)"})}),(0,t.jsx)(b.Form.Item,{label:(0,t.jsxs)("span",{children:["Metadata"," ",(0,t.jsx)(T.Tooltip,{title:"JSON object with additional information about this key. Used for tracking or custom logic",children:(0,t.jsx)(c.InfoCircleOutlined,{style:{marginLeft:"4px"}})})]}),name:"metadata",className:"mt-4",children:(0,t.jsx)(v.Input.TextArea,{rows:4,placeholder:"Enter metadata as JSON"})}),(0,t.jsx)(b.Form.Item,{label:(0,t.jsxs)("span",{children:["Tags"," ",(0,t.jsx)(T.Tooltip,{title:"Tags for tracking spend and/or doing tag-based routing. Used for analytics and filtering",children:(0,t.jsx)(c.InfoCircleOutlined,{style:{marginLeft:"4px"}})})]}),name:"tags",className:"mt-4",help:"Tags for tracking spend and/or doing tag-based routing.",children:(0,t.jsx)(k.Select,{mode:"tags",style:{width:"100%"},placeholder:"Select or enter tags",tokenSeparators:[","],options:ev})}),(0,t.jsxs)(u.Accordion,{className:"mt-4 mb-4",children:[(0,t.jsx)(p.AccordionHeader,{children:(0,t.jsx)("b",{children:"MCP Settings"})}),(0,t.jsxs)(m.AccordionBody,{children:[(0,t.jsx)(b.Form.Item,{label:(0,t.jsxs)("span",{children:["Allowed MCP Servers"," ",(0,t.jsx)(T.Tooltip,{title:"Select which MCP servers or access groups this key can access",children:(0,t.jsx)(c.InfoCircleOutlined,{style:{marginLeft:"4px"}})})]}),name:"allowed_mcp_servers_and_groups",help:"Select MCP servers or access groups this key can access",children:(0,t.jsx)(H.default,{onChange:e=>eN.setFieldValue("allowed_mcp_servers_and_groups",e),value:eN.getFieldValue("allowed_mcp_servers_and_groups"),accessToken:ec,teamId:eQ?.team_id??null,placeholder:"Select MCP servers or access groups (optional)"})}),(0,t.jsx)(b.Form.Item,{name:"mcp_tool_permissions",initialValue:{},hidden:!0,children:(0,t.jsx)(v.Input,{type:"hidden"})}),(0,t.jsx)(b.Form.Item,{noStyle:!0,shouldUpdate:(e,t)=>e.allowed_mcp_servers_and_groups!==t.allowed_mcp_servers_and_groups||e.mcp_tool_permissions!==t.mcp_tool_permissions,children:()=>(0,t.jsx)("div",{className:"mt-6",children:(0,t.jsx)(Q.default,{accessToken:ec,selectedServers:eN.getFieldValue("allowed_mcp_servers_and_groups")?.servers||[],toolPermissions:eN.getFieldValue("mcp_tool_permissions")||{},onChange:e=>eN.setFieldsValue({mcp_tool_permissions:e})})})})]})]}),(0,t.jsxs)(u.Accordion,{className:"mt-4 mb-4",children:[(0,t.jsx)(p.AccordionHeader,{children:(0,t.jsx)("b",{children:"Agent Settings"})}),(0,t.jsx)(m.AccordionBody,{children:(0,t.jsx)(b.Form.Item,{label:(0,t.jsxs)("span",{children:["Allowed Agents"," ",(0,t.jsx)(T.Tooltip,{title:"Select which agents or access groups this key can access",children:(0,t.jsx)(c.InfoCircleOutlined,{style:{marginLeft:"4px"}})})]}),name:"allowed_agents_and_groups",help:"Select agents or access groups this key can access",children:(0,t.jsx)(F.default,{onChange:e=>eN.setFieldValue("allowed_agents_and_groups",e),value:eN.getFieldValue("allowed_agents_and_groups"),accessToken:ec,placeholder:"Select agents or access groups (optional)"})})})]}),em?(0,t.jsxs)(u.Accordion,{className:"mt-4 mb-4",children:[(0,t.jsx)(p.AccordionHeader,{children:(0,t.jsx)("b",{children:"Logging Settings"})}),(0,t.jsx)(m.AccordionBody,{children:(0,t.jsx)("div",{className:"mt-4",children:(0,t.jsx)(R.default,{value:eW,onChange:eH,premiumUser:!0,disabledCallbacks:ta,onDisabledCallbacksChange:tl})})})]}):(0,t.jsx)(T.Tooltip,{title:(0,t.jsxs)("span",{children:["Key-level logging settings is an enterprise feature, get in touch -",(0,t.jsx)("a",{href:"https://www.litellm.ai/enterprise",target:"_blank",children:"https://www.litellm.ai/enterprise"})]}),placement:"top",children:(0,t.jsxs)("div",{style:{position:"relative"},children:[(0,t.jsx)("div",{style:{opacity:.5},children:(0,t.jsxs)(u.Accordion,{className:"mt-4 mb-4",children:[(0,t.jsx)(p.AccordionHeader,{children:(0,t.jsx)("b",{children:"Logging Settings"})}),(0,t.jsx)(m.AccordionBody,{children:(0,t.jsx)("div",{className:"mt-4",children:(0,t.jsx)(R.default,{value:eW,onChange:eH,premiumUser:!1,disabledCallbacks:ta,onDisabledCallbacksChange:tl})})})]})}),(0,t.jsx)("div",{style:{position:"absolute",inset:0,cursor:"not-allowed"}})]})}),(0,t.jsxs)(u.Accordion,{className:"mt-4 mb-4",children:[(0,t.jsx)(p.AccordionHeader,{children:(0,t.jsx)("b",{children:"Router Settings"})}),(0,t.jsx)(m.AccordionBody,{children:(0,t.jsx)("div",{className:"mt-4 w-full",children:(0,t.jsx)(D.default,{accessToken:ec||"",value:tp||void 0,onChange:tg,modelData:eL.length>0?{data:eL.map(e=>({model_name:e}))}:void 0},th)})})]},`router-settings-accordion-${th}`),(0,t.jsxs)(u.Accordion,{className:"mt-4 mb-4",children:[(0,t.jsx)(p.AccordionHeader,{children:(0,t.jsx)("b",{children:"Model Aliases"})}),(0,t.jsx)(m.AccordionBody,{children:(0,t.jsxs)("div",{className:"mt-4",children:[(0,t.jsx)(y.Text,{className:"text-sm text-gray-600 mb-4",children:"Create custom aliases for models that can be used in API calls. This allows you to create shortcuts for specific models."}),(0,t.jsx)(V.default,{accessToken:ec,initialModelAliases:tn,onAliasUpdate:to,showExampleConfig:!1})]})})]}),(0,t.jsxs)(u.Accordion,{className:"mt-4 mb-4",children:[(0,t.jsx)(p.AccordionHeader,{children:(0,t.jsx)("b",{children:"Key Lifecycle"})}),(0,t.jsx)(m.AccordionBody,{children:(0,t.jsx)("div",{className:"mt-4",children:(0,t.jsx)($.default,{form:eN,autoRotationEnabled:tc,onAutoRotationChange:td,rotationInterval:tu,onRotationIntervalChange:tm,isCreateMode:!0})})}),(0,t.jsx)(b.Form.Item,{name:"duration",hidden:!0,initialValue:null,children:(0,t.jsx)(v.Input,{})})]}),(0,t.jsxs)(u.Accordion,{className:"mt-4 mb-4",children:[(0,t.jsx)(p.AccordionHeader,{children:(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("b",{children:"Advanced Settings"}),(0,t.jsx)(T.Tooltip,{title:(0,t.jsxs)("span",{children:["Learn more about advanced settings in our"," ",(0,t.jsx)("a",{href:Y.proxyBaseUrl?`${Y.proxyBaseUrl}/#/key%20management/generate_key_fn_key_generate_post`:"/#/key%20management/generate_key_fn_key_generate_post",target:"_blank",rel:"noopener noreferrer",className:"text-blue-400 hover:text-blue-300",children:"documentation"})]}),children:(0,t.jsx)(c.InfoCircleOutlined,{className:"text-gray-400 hover:text-gray-300 cursor-help"})})]})}),(0,t.jsx)(m.AccordionBody,{children:(0,t.jsx)(E.default,{schemaComponent:"GenerateKeyRequest",form:eN,excludedFields:["key_alias","team_id","organization_id","models","duration","metadata","tags","guardrails","max_budget","budget_duration","tpm_limit","rpm_limit",...eb?["key"]:[]]})})]})]})]})}),(0,t.jsx)("div",{style:{textAlign:"right",marginTop:"10px"},children:(0,t.jsx)(j.Button,{htmlType:"submit",disabled:tw,style:{opacity:tw?.5:1},children:"Create Key"})})]})}),e1&&(0,t.jsx)(w.Modal,{title:"Create New User",open:e1,onCancel:()=>e2(!1),footer:null,width:800,children:(0,t.jsx)(q.CreateUserButton,{userID:ed,accessToken:ec,teams:X,possibleUIRoles:e3,onUserCreated:e=>{e5(e),eN.setFieldsValue({user_id:e}),e2(!1)},isEmbedded:!0})}),eC&&(0,t.jsx)(w.Modal,{open:ek,onOk:tb,onCancel:tv,footer:null,children:(0,t.jsxs)(x.Grid,{numItems:1,className:"gap-2 w-full",children:[(0,t.jsx)(_.Title,{children:"Save your Key"}),(0,t.jsx)(h.Col,{numColSpan:1,children:null!=eC?(0,t.jsx)(ee,{apiKey:eC}):(0,t.jsx)(y.Text,{children:"Key being created, this might take 30s"})})]})})]})},"fetchTeamModels",0,el,"fetchUserModels",0,er],702597)}]); \ No newline at end of file +(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,9314,263147,e=>{"use strict";var t=e.i(843476),s=e.i(199133),a=e.i(981339),l=e.i(645526),r=e.i(599724),i=e.i(266027),n=e.i(243652),o=e.i(764205),c=e.i(708347),d=e.i(135214);let u=(0,n.createQueryKeys)("accessGroups"),m=async e=>{let t=(0,o.getProxyBaseUrl)(),s=`${t}/v1/access_group`,a=await fetch(s,{method:"GET",headers:{[(0,o.getGlobalLitellmHeaderName)()]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!a.ok){let e=await a.json(),t=(0,o.deriveErrorMessage)(e);throw(0,o.handleError)(t),Error(t)}return a.json()},p=()=>{let{accessToken:e,userRole:t}=(0,d.default)();return(0,i.useQuery)({queryKey:u.list({}),queryFn:async()=>m(e),enabled:!!e&&c.all_admin_roles.includes(t||"")})};e.s(["accessGroupKeys",0,u,"useAccessGroups",0,p],263147),e.s(["default",0,({value:e,onChange:i,placeholder:n="Select access groups",disabled:o=!1,style:c,className:d,showLabel:u=!1,labelText:m="Access Group",allowClear:g=!0})=>{let{data:h,isLoading:x,isError:y}=p();if(x)return(0,t.jsxs)("div",{children:[u&&(0,t.jsxs)(r.Text,{className:"font-medium block mb-2 text-gray-700 flex items-center",children:[(0,t.jsx)(l.TeamOutlined,{className:"mr-2"})," ",m]}),(0,t.jsx)(a.Skeleton.Input,{active:!0,block:!0,style:{height:32,...c}})]});let f=(h??[]).map(e=>({label:(0,t.jsxs)("span",{children:[(0,t.jsx)("span",{className:"font-medium",children:e.access_group_name})," ",(0,t.jsxs)("span",{className:"text-gray-400 text-xs",children:["(",e.access_group_id,")"]})]}),value:e.access_group_id,selectedLabel:e.access_group_name,searchText:`${e.access_group_name} ${e.access_group_id}`}));return(0,t.jsxs)("div",{children:[u&&(0,t.jsxs)(r.Text,{className:"font-medium block mb-2 text-gray-700 flex items-center",children:[(0,t.jsx)(l.TeamOutlined,{className:"mr-2"})," ",m]}),(0,t.jsx)(s.Select,{mode:"multiple",value:e,placeholder:n,onChange:i,disabled:o,allowClear:g,showSearch:!0,style:{width:"100%",...c},className:`rounded-md ${d??""}`,notFoundContent:y?(0,t.jsx)("span",{className:"text-red-500",children:"Failed to load access groups"}):"No access groups found",filterOption:(e,t)=>(f.find(e=>e.value===t?.value)?.searchText??"").toLowerCase().includes(e.toLowerCase()),optionLabelProp:"selectedLabel",options:f.map(e=>({label:e.label,value:e.value,selectedLabel:e.selectedLabel}))})]})}],9314)},552130,e=>{"use strict";var t=e.i(843476),s=e.i(271645),a=e.i(199133),l=e.i(764205);e.s(["default",0,({onChange:e,value:r,className:i,accessToken:n,placeholder:o="Select agents",disabled:c=!1})=>{let[d,u]=(0,s.useState)([]),[m,p]=(0,s.useState)([]),[g,h]=(0,s.useState)(!1);(0,s.useEffect)(()=>{(async()=>{if(n){h(!0);try{let e=await (0,l.getAgentsList)(n),t=e?.agents||[];u(t);let s=new Set;t.forEach(e=>{let t=e.agent_access_groups;t&&Array.isArray(t)&&t.forEach(e=>s.add(e))}),p(Array.from(s))}catch(e){console.error("Error fetching agents:",e)}finally{h(!1)}}})()},[n]);let x=[...m.map(e=>({label:e,value:`group:${e}`,isAccessGroup:!0,searchText:`${e} Access Group`})),...d.map(e=>({label:`${e.agent_name||e.agent_id}`,value:e.agent_id,isAccessGroup:!1,searchText:`${e.agent_name||e.agent_id} ${e.agent_id} Agent`}))],y=[...r?.agents||[],...(r?.accessGroups||[]).map(e=>`group:${e}`)];return(0,t.jsx)("div",{children:(0,t.jsx)(a.Select,{mode:"multiple",placeholder:o,onChange:t=>{e({agents:t.filter(e=>!e.startsWith("group:")),accessGroups:t.filter(e=>e.startsWith("group:")).map(e=>e.replace("group:",""))})},value:y,loading:g,className:i,allowClear:!0,showSearch:!0,style:{width:"100%"},disabled:c,filterOption:(e,t)=>(x.find(e=>e.value===t?.value)?.searchText||"").toLowerCase().includes(e.toLowerCase()),children:x.map(e=>(0,t.jsx)(a.Select.Option,{value:e.value,label:e.label,children:(0,t.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[(0,t.jsx)("span",{style:{display:"inline-block",width:8,height:8,borderRadius:"50%",background:e.isAccessGroup?"#52c41a":"#722ed1",flexShrink:0}}),(0,t.jsx)("span",{style:{flex:1},children:e.label}),(0,t.jsx)("span",{style:{color:e.isAccessGroup?"#52c41a":"#722ed1",fontSize:"12px",fontWeight:500,opacity:.8},children:e.isAccessGroup?"Access Group":"Agent"})]})},e.value))})})}])},844565,e=>{"use strict";var t=e.i(843476),s=e.i(271645),a=e.i(199133),l=e.i(764205);e.s(["default",0,({onChange:e,value:r,className:i,accessToken:n,placeholder:o="Select pass through routes",disabled:c=!1,teamId:d})=>{let[u,m]=(0,s.useState)([]),[p,g]=(0,s.useState)(!1);return(0,s.useEffect)(()=>{(async()=>{if(n){g(!0);try{let e=await (0,l.getPassThroughEndpointsCall)(n,d);if(e.endpoints){let t=e.endpoints.flatMap(e=>{let t=e.path,s=e.methods;return s&&s.length>0?s.map(e=>({label:`${e} ${t}`,value:t})):[{label:t,value:t}]});m(t)}}catch(e){console.error("Error fetching pass through routes:",e)}finally{g(!1)}}})()},[n,d]),(0,t.jsx)(a.Select,{mode:"tags",placeholder:o,onChange:e,value:r,loading:p,className:i,allowClear:!0,options:u,optionFilterProp:"label",showSearch:!0,style:{width:"100%"},disabled:c})}])},810757,477386,e=>{"use strict";var t=e.i(271645);let s=t.forwardRef(function(e,s){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:s},e),t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M10.325 4.317c.426-1.756 2.924-1.756 3.35 0a1.724 1.724 0 002.573 1.066c1.543-.94 3.31.826 2.37 2.37a1.724 1.724 0 001.065 2.572c1.756.426 1.756 2.924 0 3.35a1.724 1.724 0 00-1.066 2.573c.94 1.543-.826 3.31-2.37 2.37a1.724 1.724 0 00-2.572 1.065c-.426 1.756-2.924 1.756-3.35 0a1.724 1.724 0 00-2.573-1.066c-1.543.94-3.31-.826-2.37-2.37a1.724 1.724 0 00-1.065-2.572c-1.756-.426-1.756-2.924 0-3.35a1.724 1.724 0 001.066-2.573c-.94-1.543.826-3.31 2.37-2.37.996.608 2.296.07 2.572-1.065z"}),t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z"}))});e.s(["CogIcon",0,s],810757);let a=t.forwardRef(function(e,s){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:s},e),t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M18.364 18.364A9 9 0 005.636 5.636m12.728 12.728A9 9 0 015.636 5.636m12.728 12.728L5.636 5.636"}))});e.s(["BanIcon",0,a],477386)},557662,e=>{"use strict";let t="../ui/assets/logos/",s=[{id:"arize",displayName:"Arize",logo:`${t}arize.png`,supports_key_team_logging:!0,dynamic_params:{arize_api_key:"password",arize_space_id:"password"},description:"Arize Logging Integration"},{id:"braintrust",displayName:"Braintrust",logo:`${t}braintrust.png`,supports_key_team_logging:!1,dynamic_params:{braintrust_api_key:"password",braintrust_project_name:"text"},description:"Braintrust Logging Integration"},{id:"custom_callback_api",displayName:"Custom Callback API",logo:`${t}custom.svg`,supports_key_team_logging:!0,dynamic_params:{custom_callback_api_url:"text",custom_callback_api_headers:"text"},description:"Custom Callback API Logging Integration"},{id:"datadog",displayName:"Datadog",logo:`${t}datadog.png`,supports_key_team_logging:!1,dynamic_params:{dd_api_key:"password",dd_site:"text"},description:"Datadog Logging Integration"},{id:"lago",displayName:"Lago",logo:`${t}lago.svg`,supports_key_team_logging:!1,dynamic_params:{lago_api_url:"text",lago_api_key:"password"},description:"Lago Billing Logging Integration"},{id:"langfuse",displayName:"Langfuse",logo:`${t}langfuse.png`,supports_key_team_logging:!0,dynamic_params:{langfuse_public_key:"text",langfuse_secret_key:"password",langfuse_host:"text"},description:"Langfuse v2 Logging Integration"},{id:"langfuse_otel",displayName:"Langfuse OTEL",logo:`${t}langfuse.png`,supports_key_team_logging:!0,dynamic_params:{langfuse_public_key:"text",langfuse_secret_key:"password",langfuse_host:"text"},description:"Langfuse v3 OTEL Logging Integration"},{id:"langsmith",displayName:"LangSmith",logo:`${t}langsmith.png`,supports_key_team_logging:!0,dynamic_params:{langsmith_api_key:"password",langsmith_project:"text",langsmith_base_url:"text",langsmith_sampling_rate:"number"},description:"Langsmith Logging Integration"},{id:"openmeter",displayName:"OpenMeter",logo:`${t}openmeter.png`,supports_key_team_logging:!1,dynamic_params:{openmeter_api_key:"password",openmeter_base_url:"text"},description:"OpenMeter Logging Integration"},{id:"otel",displayName:"Open Telemetry",logo:`${t}otel.png`,supports_key_team_logging:!1,dynamic_params:{otel_endpoint:"text",otel_headers:"text"},description:"OpenTelemetry Logging Integration"},{id:"s3",displayName:"S3",logo:`${t}aws.svg`,supports_key_team_logging:!1,dynamic_params:{s3_bucket_name:"text",aws_access_key_id:"password",aws_secret_access_key:"password",aws_region:"text"},description:"S3 Bucket (AWS) Logging Integration"},{id:"SQS",displayName:"SQS",logo:`${t}aws.svg`,supports_key_team_logging:!1,dynamic_params:{sqs_queue_url:"text",aws_access_key_id:"password",aws_secret_access_key:"password",aws_region:"text"},description:"SQS Queue (AWS) Logging Integration"}],a=s.reduce((e,t)=>(e[t.displayName]=t,e),{}),l=s.reduce((e,t)=>(e[t.displayName]=t.id,e),{}),r=s.reduce((e,t)=>(e[t.id]=t.displayName,e),{});e.s(["callbackInfo",0,a,"callback_map",0,l,"mapDisplayToInternalNames",0,e=>e.map(e=>l[e]||e),"mapInternalToDisplayNames",0,e=>e.map(e=>r[e]||e),"reverse_callback_map",0,r])},75921,e=>{"use strict";var t=e.i(843476),s=e.i(266027),a=e.i(243652),l=e.i(764205),r=e.i(135214);let i=(0,a.createQueryKeys)("mcpAccessGroups");var n=e.i(500727),o=e.i(699857),c=e.i(199133);let d="toolset:";e.s(["default",0,({onChange:e,value:a,className:u,accessToken:m,placeholder:p="Select MCP servers",disabled:g=!1,teamId:h})=>{let{data:x=[],isLoading:y}=(0,n.useMCPServers)(h),{data:f=[],isLoading:_}=(()=>{let{accessToken:e}=(0,r.default)();return(0,s.useQuery)({queryKey:i.list({}),queryFn:async()=>await (0,l.fetchMCPAccessGroups)(e),enabled:!!e})})(),{data:j=[],isLoading:b}=(0,o.useMCPToolsets)(),v=new Set(f),w=[...f.map(e=>({label:e,value:e,type:"accessGroup",searchText:`${e} Access Group`})),...x.map(e=>({label:`${e.server_name||e.server_id} (${e.server_id})`,value:e.server_id,type:"server",searchText:`${e.server_name||e.server_id} ${e.server_id} MCP Server`})),...j.map(e=>({label:e.toolset_name,value:`${d}${e.toolset_id}`,type:"toolset",searchText:`${e.toolset_name} ${e.toolset_id} Toolset`}))],N={accessGroup:"#52c41a",server:"#1890ff",toolset:"#722ed1"},k={accessGroup:"Access Group",server:"MCP Server",toolset:"Toolset"},S=[...a?.servers||[],...a?.accessGroups||[],...(a?.toolsets||[]).map(e=>`${d}${e}`)];return(0,t.jsx)("div",{children:(0,t.jsx)(c.Select,{mode:"multiple",placeholder:p,onChange:t=>{let s=t.filter(e=>e.startsWith(d)).map(e=>e.slice(d.length)),a=t.filter(e=>!e.startsWith(d));e({servers:a.filter(e=>!v.has(e)),accessGroups:a.filter(e=>v.has(e)),toolsets:s})},value:S,loading:y||_||b,className:u,allowClear:!0,showSearch:!0,style:{width:"100%"},disabled:g,filterOption:(e,t)=>(w.find(e=>e.value===t?.value)?.searchText||"").toLowerCase().includes(e.toLowerCase()),children:w.map(e=>(0,t.jsx)(c.Select.Option,{value:e.value,label:e.label,children:(0,t.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[(0,t.jsx)("span",{style:{display:"inline-block",width:8,height:8,borderRadius:"50%",background:N[e.type],flexShrink:0}}),(0,t.jsx)("span",{style:{flex:1},children:e.label}),(0,t.jsx)("span",{style:{color:N[e.type],fontSize:"12px",fontWeight:500,opacity:.8},children:k[e.type]})]})},e.value))})})}],75921)},390605,e=>{"use strict";var t=e.i(843476),s=e.i(271645),a=e.i(764205),l=e.i(599724),r=e.i(482725),i=e.i(91739),n=e.i(500727),o=e.i(531516),c=e.i(696609);e.s(["default",0,({accessToken:e,selectedServers:d,toolPermissions:u,onChange:m,disabled:p=!1})=>{let{data:g=[]}=(0,n.useMCPServers)(),[h,x]=(0,s.useState)({}),[y,f]=(0,s.useState)({}),[_,j]=(0,s.useState)({}),[b,v]=(0,s.useState)({}),w=(0,s.useRef)(u);(0,s.useEffect)(()=>{w.current=u},[u]);let N=(0,s.useMemo)(()=>0===d.length?[]:g.filter(e=>d.includes(e.server_id)),[g,d]),k=async(e,t)=>{f(t=>({...t,[e]:!0})),j(t=>({...t,[e]:""}));try{let s=await (0,a.listMCPTools)(t,e);if(s.error)j(t=>({...t,[e]:s.message||"Failed to fetch tools"})),x(t=>({...t,[e]:[]}));else{let t=s.tools||[];x(s=>({...s,[e]:t}));let a=w.current;if(!a[e]&&t.length>0){let s=t.filter(e=>"delete"!==(0,c.classifyToolOp)(e.name,e.description||"")).map(e=>e.name);m({...a,[e]:s})}}}catch(t){console.error(`Error fetching tools for server ${e}:`,t),j(t=>({...t,[e]:"Failed to fetch tools"})),x(t=>({...t,[e]:[]}))}finally{f(t=>({...t,[e]:!1}))}};(0,s.useEffect)(()=>{N.forEach(t=>{h[t.server_id]||y[t.server_id]||k(t.server_id,e)})},[N,e]);let S=(e,t)=>{m({...u,[e]:t})};return 0===d.length?null:(0,t.jsx)("div",{className:"space-y-4",children:N.map(e=>{let s=e.server_name||e.alias||e.server_id,a=h[e.server_id]||[],n=u[e.server_id]||[],c=y[e.server_id],d=_[e.server_id],g=b[e.server_id]??"crud";return(0,t.jsxs)("div",{className:"border rounded-lg bg-gray-50",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between p-4 border-b bg-white rounded-t-lg",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)(l.Text,{className:"font-semibold text-gray-900",children:s}),e.description&&(0,t.jsx)(l.Text,{className:"text-sm text-gray-500",children:e.description})]}),(0,t.jsxs)("div",{className:"flex items-center gap-3",children:[!p&&a.length>0&&(0,t.jsx)(i.Radio.Group,{value:g,onChange:t=>v(s=>({...s,[e.server_id]:t.target.value})),size:"small",optionType:"button",buttonStyle:"solid",options:[{label:"Risk Groups",value:"crud"},{label:"Flat List",value:"flat"}]}),!p&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("button",{type:"button",className:"text-sm text-blue-600 hover:text-blue-700 font-medium",onClick:()=>{var t;let s;return s=h[t=e.server_id]||[],void m({...u,[t]:s.map(e=>e.name)})},disabled:c,children:"Select All"}),(0,t.jsx)("button",{type:"button",className:"text-sm text-blue-600 hover:text-blue-700 font-medium",onClick:()=>{var t;return t=e.server_id,void m({...u,[t]:[]})},disabled:c,children:"Deselect All"})]})]})]}),(0,t.jsxs)("div",{className:"p-4",children:[c&&(0,t.jsxs)("div",{className:"flex items-center justify-center py-8",children:[(0,t.jsx)(r.Spin,{size:"large"}),(0,t.jsx)(l.Text,{className:"ml-3 text-gray-500",children:"Loading tools..."})]}),d&&!c&&(0,t.jsxs)("div",{className:"p-4 bg-red-50 border border-red-200 rounded-lg text-center",children:[(0,t.jsx)(l.Text,{className:"text-red-600 font-medium",children:"Unable to load tools"}),(0,t.jsx)(l.Text,{className:"text-sm text-red-500 mt-1",children:d})]}),!c&&!d&&a.length>0&&"crud"===g&&(0,t.jsx)(o.default,{tools:a,value:u[e.server_id]?n:void 0,onChange:t=>S(e.server_id,t),readOnly:p}),!c&&!d&&a.length>0&&"flat"===g&&(0,t.jsx)("div",{className:"space-y-2",children:a.map(s=>{let a=n.includes(s.name);return(0,t.jsxs)("div",{className:"flex items-start gap-2",children:[(0,t.jsx)("input",{type:"checkbox",checked:a,onChange:()=>{if(p)return;let t=a?n.filter(e=>e!==s.name):[...n,s.name];S(e.server_id,t)},disabled:p,className:"mt-0.5"}),(0,t.jsx)("div",{className:"flex-1 min-w-0",children:(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(l.Text,{className:"font-medium text-gray-900",children:s.name}),(0,t.jsxs)(l.Text,{className:"text-sm text-gray-500",children:["- ",s.description||"No description"]})]})})]},s.name)})}),!c&&!d&&0===a.length&&(0,t.jsx)("div",{className:"text-center py-6",children:(0,t.jsx)(l.Text,{className:"text-gray-500",children:"No tools available"})})]})]},e.server_id)})})}])},266484,e=>{"use strict";var t=e.i(843476),s=e.i(199133),a=e.i(592968),l=e.i(312361),r=e.i(827252),i=e.i(994388),n=e.i(304967),o=e.i(779241),c=e.i(988297),d=e.i(68155),u=e.i(810757),m=e.i(477386),p=e.i(557662),g=e.i(435451);let{Option:h}=s.Select;e.s(["default",0,({value:e=[],onChange:x,disabledCallbacks:y=[],onDisabledCallbacksChange:f})=>{let _=Object.entries(p.callbackInfo).filter(([e,t])=>t.supports_key_team_logging).map(([e,t])=>e),j=Object.keys(p.callbackInfo),b=e=>{x?.(e)},v=(t,s,a)=>{let l=[...e];if("callback_name"===s){let e=p.callback_map[a]||a;l[t]={...l[t],[s]:e,callback_vars:{}}}else l[t]={...l[t],[s]:a};b(l)},w=(t,s,a)=>{let l=[...e];l[t]={...l[t],callback_vars:{...l[t].callback_vars,[s]:a}},b(l)};return(0,t.jsxs)("div",{className:"space-y-6",children:[(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,t.jsx)(m.BanIcon,{className:"w-5 h-5 text-red-500"}),(0,t.jsx)("span",{className:"text-base font-semibold text-gray-800",children:"Disabled Callbacks"}),(0,t.jsx)(a.Tooltip,{title:"Select callbacks to disable for this key. Disabled callbacks will not receive any logging data.",children:(0,t.jsx)(r.InfoCircleOutlined,{className:"text-gray-400 cursor-help"})})]}),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)("label",{className:"text-sm font-medium text-gray-700",children:"Disabled Callbacks"}),(0,t.jsx)(s.Select,{mode:"multiple",placeholder:"Select callbacks to disable",value:y,onChange:e=>{let t=(0,p.mapDisplayToInternalNames)(e);f?.(t)},style:{width:"100%"},optionLabelProp:"label",children:j.map(e=>{let s=p.callbackInfo[e]?.logo,l=p.callbackInfo[e]?.description;return(0,t.jsx)(h,{value:e,label:e,children:(0,t.jsx)(a.Tooltip,{title:l,placement:"right",children:(0,t.jsxs)("div",{className:"flex items-center space-x-2",children:[s&&(0,t.jsx)("img",{src:s,alt:e,className:"w-4 h-4 object-contain",onError:t=>{let s=t.target,a=s.parentElement;if(a){let t=document.createElement("div");t.className="w-4 h-4 rounded-full bg-gray-200 flex items-center justify-center text-xs",t.textContent=e.charAt(0),a.replaceChild(t,s)}}}),(0,t.jsx)("span",{children:e})]})})},e)})}),(0,t.jsx)("div",{className:"text-xs text-gray-500",children:"Select callbacks that should be disabled for this key. These callbacks will not receive any logging data."})]})]}),(0,t.jsx)(l.Divider,{}),(0,t.jsxs)("div",{className:"flex justify-between items-center",children:[(0,t.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,t.jsx)(u.CogIcon,{className:"w-5 h-5 text-blue-500"}),(0,t.jsx)("span",{className:"text-base font-semibold text-gray-800",children:"Logging Integrations"}),(0,t.jsx)(a.Tooltip,{title:"Configure callback logging integrations for this team.",children:(0,t.jsx)(r.InfoCircleOutlined,{className:"text-gray-400 cursor-help"})})]}),(0,t.jsx)(i.Button,{variant:"secondary",onClick:()=>{b([...e,{callback_name:"",callback_type:"success",callback_vars:{}}])},icon:c.PlusIcon,size:"sm",className:"hover:border-blue-400 hover:text-blue-500",type:"button",children:"Add Integration"})]}),(0,t.jsx)("div",{className:"space-y-4",children:e.map((l,c)=>{let u=l.callback_name?Object.entries(p.callback_map).find(([e,t])=>t===l.callback_name)?.[0]:void 0,m=u?p.callbackInfo[u]?.logo:null;return(0,t.jsxs)(n.Card,{className:"border border-gray-200 shadow-sm hover:shadow-md transition-shadow duration-200",decoration:"top",decorationColor:"blue",children:[(0,t.jsxs)("div",{className:"flex justify-between items-start mb-4",children:[(0,t.jsxs)("div",{className:"flex items-center space-x-2",children:[m&&(0,t.jsx)("img",{src:m,alt:u,className:"w-5 h-5 object-contain"}),(0,t.jsxs)("span",{className:"text-sm font-medium",children:[u||"New Integration"," Configuration"]})]}),(0,t.jsx)(i.Button,{variant:"light",onClick:()=>{b(e.filter((e,t)=>t!==c))},icon:d.TrashIcon,size:"xs",color:"red",className:"hover:bg-red-50",type:"button",children:"Remove"})]}),(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)("label",{className:"text-sm font-medium text-gray-700",children:"Integration Type"}),(0,t.jsx)(s.Select,{value:u,placeholder:"Select integration",onChange:e=>v(c,"callback_name",e),className:"w-full",optionLabelProp:"label",children:_.map(e=>{let s=p.callbackInfo[e]?.logo,l=p.callbackInfo[e]?.description;return(0,t.jsx)(h,{value:e,label:e,children:(0,t.jsx)(a.Tooltip,{title:l,placement:"right",children:(0,t.jsxs)("div",{className:"flex items-center space-x-2",children:[s&&(0,t.jsx)("img",{src:s,alt:e,className:"w-4 h-4 object-contain",onError:t=>{let s=t.target,a=s.parentElement;if(a){let t=document.createElement("div");t.className="w-4 h-4 rounded-full bg-gray-200 flex items-center justify-center text-xs",t.textContent=e.charAt(0),a.replaceChild(t,s)}}}),(0,t.jsx)("span",{children:e})]})})},e)})})]}),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)("label",{className:"text-sm font-medium text-gray-700",children:"Event Type"}),(0,t.jsxs)(s.Select,{value:l.callback_type,onChange:e=>v(c,"callback_type",e),className:"w-full",children:[(0,t.jsx)(h,{value:"success",children:(0,t.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,t.jsx)("div",{className:"w-2 h-2 bg-green-500 rounded-full"}),(0,t.jsx)("span",{children:"Success Only"})]})}),(0,t.jsx)(h,{value:"failure",children:(0,t.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,t.jsx)("div",{className:"w-2 h-2 bg-red-500 rounded-full"}),(0,t.jsx)("span",{children:"Failure Only"})]})}),(0,t.jsx)(h,{value:"success_and_failure",children:(0,t.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,t.jsx)("div",{className:"w-2 h-2 bg-blue-500 rounded-full"}),(0,t.jsx)("span",{children:"Success & Failure"})]})})]})]})]}),((e,s)=>{if(!e.callback_name)return null;let l=Object.entries(p.callback_map).find(([t,s])=>s===e.callback_name)?.[0];if(!l)return null;let i=p.callbackInfo[l]?.dynamic_params||{};return 0===Object.keys(i).length?null:(0,t.jsxs)("div",{className:"mt-6 pt-4 border-t border-gray-100",children:[(0,t.jsxs)("div",{className:"flex items-center space-x-2 mb-4",children:[(0,t.jsx)("div",{className:"w-3 h-3 bg-blue-100 rounded-full flex items-center justify-center",children:(0,t.jsx)("div",{className:"w-1.5 h-1.5 bg-blue-500 rounded-full"})}),(0,t.jsx)("span",{className:"text-sm font-medium text-gray-700",children:"Integration Parameters"})]}),(0,t.jsx)("div",{className:"grid grid-cols-1 gap-4",children:Object.entries(i).map(([l,i])=>(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsxs)("label",{className:"text-sm font-medium text-gray-700 capitalize flex items-center space-x-1",children:[(0,t.jsx)("span",{children:l.replace(/_/g," ")}),(0,t.jsx)(a.Tooltip,{title:`Environment variable reference recommended: os.environ/${l.toUpperCase()}`,children:(0,t.jsx)(r.InfoCircleOutlined,{className:"text-gray-400 cursor-help text-xs"})}),"password"===i&&(0,t.jsx)("span",{className:"inline-flex items-center px-2 py-0.5 rounded text-xs font-medium bg-yellow-100 text-yellow-800",children:"Sensitive"}),"number"===i&&(0,t.jsx)("span",{className:"inline-flex items-center px-2 py-0.5 rounded text-xs font-medium bg-yellow-100 text-yellow-800",children:"Number"})]}),"number"===i&&(0,t.jsx)("span",{className:"text-xs text-gray-500",children:"Value must be between 0 and 1"}),"number"===i?(0,t.jsx)(g.default,{step:.01,width:400,placeholder:`os.environ/${l.toUpperCase()}`,value:e.callback_vars[l]||"",onChange:e=>w(s,l,e.target.value)}):(0,t.jsx)(o.TextInput,{type:"password"===i?"password":"text",placeholder:`os.environ/${l.toUpperCase()}`,value:e.callback_vars[l]||"",onChange:e=>w(s,l,e.target.value)})]},l))})]})})(l,c)]})]},c)})}),0===e.length&&(0,t.jsxs)("div",{className:"text-center py-12 text-gray-500 border-2 border-dashed border-gray-200 rounded-lg bg-gray-50/50",children:[(0,t.jsx)(u.CogIcon,{className:"w-12 h-12 text-gray-300 mb-3 mx-auto"}),(0,t.jsx)("div",{className:"text-base font-medium mb-1",children:"No logging integrations configured"}),(0,t.jsx)("div",{className:"text-sm text-gray-400",children:'Click "Add Integration" to configure logging for this team'})]})]})}])},207082,e=>{"use strict";var t=e.i(619273),s=e.i(266027),a=e.i(243652),l=e.i(764205),r=e.i(135214);let i=(0,a.createQueryKeys)("keys"),n=async(e,t,s,a={})=>{try{let r=(0,l.getProxyBaseUrl)(),i=new URLSearchParams(Object.entries({team_id:a.teamID,project_id:a.projectID,organization_id:a.organizationID,key_alias:a.selectedKeyAlias,key_hash:a.keyHash,user_id:a.userID,page:t,size:s,sort_by:a.sortBy,sort_order:a.sortOrder,expand:a.expand,status:a.status,return_full_object:"true",include_team_keys:"true",include_created_by_keys:"true"}).filter(([,e])=>null!=e).map(([e,t])=>[e,String(t)])),n=`${r?`${r}/key/list`:"/key/list"}?${i}`,o=await fetch(n,{method:"GET",headers:{[(0,l.getGlobalLitellmHeaderName)()]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!o.ok){let e=await o.json(),t=(0,l.deriveErrorMessage)(e);throw(0,l.handleError)(t),Error(t)}let c=await o.json();return console.log("/key/list API Response:",c),c}catch(e){throw console.error("Failed to list keys:",e),e}},o=(0,a.createQueryKeys)("deletedKeys");e.s(["keyKeys",0,i,"useDeletedKeys",0,(e,a,l={})=>{let{accessToken:i}=(0,r.default)();return(0,s.useQuery)({queryKey:o.list({page:e,limit:a,...l}),queryFn:async()=>await n(i,e,a,{...l,status:"deleted"}),enabled:!!i,staleTime:3e4,placeholderData:t.keepPreviousData})},"useKeys",0,(e,a,l={})=>{let{accessToken:o}=(0,r.default)();return(0,s.useQuery)({queryKey:i.list({page:e,limit:a,...l}),queryFn:async()=>await n(o,e,a,l),enabled:!!o,staleTime:3e4,placeholderData:t.keepPreviousData})}])},510674,e=>{"use strict";var t=e.i(266027),s=e.i(243652),a=e.i(764205),l=e.i(708347),r=e.i(135214);let i=(0,s.createQueryKeys)("projects"),n=async e=>{let t=(0,a.getProxyBaseUrl)(),s=`${t}/project/list`,l=await fetch(s,{method:"GET",headers:{[(0,a.getGlobalLitellmHeaderName)()]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!l.ok){let e=await l.json(),t=(0,a.deriveErrorMessage)(e);throw(0,a.handleError)(t),Error(t)}return l.json()};e.s(["projectKeys",0,i,"useProjects",0,()=>{let{accessToken:e,userRole:s}=(0,r.default)();return(0,t.useQuery)({queryKey:i.list({}),queryFn:async()=>n(e),enabled:!!e&&l.all_admin_roles.includes(s||"")})}])},392110,e=>{"use strict";var t=e.i(843476),s=e.i(271645),a=e.i(199133),l=e.i(592968),r=e.i(312361),i=e.i(790848),n=e.i(536916),o=e.i(827252),c=e.i(779241);let{Option:d}=a.Select;e.s(["default",0,({form:e,autoRotationEnabled:u,onAutoRotationChange:m,rotationInterval:p,onRotationIntervalChange:g,isCreateMode:h=!1,neverExpire:x=!1,onNeverExpireChange:y})=>{let f=p&&!["7d","30d","90d","180d","365d"].includes(p),[_,j]=(0,s.useState)(f),[b,v]=(0,s.useState)(f?p:""),[w,N]=(0,s.useState)(e?.getFieldValue?.("duration")||"");return(0,t.jsxs)("div",{className:"space-y-6",children:[(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsx)("span",{className:"text-sm font-medium text-gray-700",children:"Key Expiry Settings"}),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsxs)("label",{className:"text-sm font-medium text-gray-700 flex items-center space-x-1",children:[(0,t.jsx)("span",{children:"Expire Key"}),(0,t.jsx)(l.Tooltip,{title:"Set when this key should expire. Format: 30s (seconds), 30m (minutes), 30h (hours), 30d (days). Leave empty to keep the current expiry unchanged.",children:(0,t.jsx)(o.InfoCircleOutlined,{className:"text-gray-400 cursor-help text-xs"})}),!h&&y&&(0,t.jsx)(n.Checkbox,{checked:x,onChange:t=>{let s=t.target.checked;y(s),s&&(N(""),e&&"function"==typeof e.setFieldValue?e.setFieldValue("duration",""):e&&"function"==typeof e.setFieldsValue&&e.setFieldsValue({duration:""}))},className:"ml-2 text-sm font-normal text-gray-600",children:"Never Expire"})]}),(0,t.jsx)(c.TextInput,{name:"duration",placeholder:h?"e.g., 30d or leave empty to never expire":"e.g., 30d",className:"w-full",value:w,onValueChange:t=>{N(t),e&&"function"==typeof e.setFieldValue?e.setFieldValue("duration",t):e&&"function"==typeof e.setFieldsValue&&e.setFieldsValue({duration:t})},disabled:!h&&x})]})]}),(0,t.jsx)(r.Divider,{}),(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsx)("span",{className:"text-sm font-medium text-gray-700",children:"Auto-Rotation Settings"}),(0,t.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsxs)("label",{className:"text-sm font-medium text-gray-700 flex items-center space-x-1",children:[(0,t.jsx)("span",{children:"Enable Auto-Rotation"}),(0,t.jsx)(l.Tooltip,{title:"Key will automatically regenerate at the specified interval for enhanced security.",children:(0,t.jsx)(o.InfoCircleOutlined,{className:"text-gray-400 cursor-help text-xs"})})]}),(0,t.jsx)(i.Switch,{checked:u,onChange:m,size:"default",className:u?"":"bg-gray-400"})]}),u&&(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsxs)("label",{className:"text-sm font-medium text-gray-700 flex items-center space-x-1",children:[(0,t.jsx)("span",{children:"Rotation Interval"}),(0,t.jsx)(l.Tooltip,{title:"How often the key should be automatically rotated. Choose the interval that best fits your security requirements.",children:(0,t.jsx)(o.InfoCircleOutlined,{className:"text-gray-400 cursor-help text-xs"})})]}),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsxs)(a.Select,{value:_?"custom":p,onChange:e=>{"custom"===e?j(!0):(j(!1),v(""),g(e))},className:"w-full",placeholder:"Select interval",children:[(0,t.jsx)(d,{value:"7d",children:"7 days"}),(0,t.jsx)(d,{value:"30d",children:"30 days"}),(0,t.jsx)(d,{value:"90d",children:"90 days"}),(0,t.jsx)(d,{value:"180d",children:"180 days"}),(0,t.jsx)(d,{value:"365d",children:"365 days"}),(0,t.jsx)(d,{value:"custom",children:"Custom interval"})]}),_&&(0,t.jsxs)("div",{className:"space-y-1",children:[(0,t.jsx)(c.TextInput,{value:b,onChange:e=>{let t=e.target.value;v(t),g(t)},placeholder:"e.g., 1s, 5m, 2h, 14d"}),(0,t.jsx)("div",{className:"text-xs text-gray-500",children:"Supported formats: seconds (s), minutes (m), hours (h), days (d)"})]})]})]})]}),u&&(0,t.jsx)("div",{className:"bg-blue-50 p-3 rounded-md text-sm text-blue-700",children:"When rotation occurs, you'll receive a notification with the new key. The old key will be deactivated after a brief grace period."})]})]})}])},939510,e=>{"use strict";var t=e.i(843476),s=e.i(808613),a=e.i(199133),l=e.i(592968),r=e.i(827252);let{Option:i}=a.Select;e.s(["default",0,({type:e,name:n,showDetailedDescriptions:o=!0,className:c="",initialValue:d=null,form:u,onChange:m})=>{let p=e.toUpperCase(),g=e.toLowerCase(),h=`Select 'guaranteed_throughput' to prevent overallocating ${p} limit when the key belongs to a Team with specific ${p} limits.`;return(0,t.jsx)(s.Form.Item,{label:(0,t.jsxs)("span",{children:[p," Rate Limit Type"," ",(0,t.jsx)(l.Tooltip,{title:h,children:(0,t.jsx)(r.InfoCircleOutlined,{style:{marginLeft:"4px"}})})]}),name:n,initialValue:d,className:c,children:(0,t.jsx)(a.Select,{defaultValue:o?"default":void 0,placeholder:"Select rate limit type",style:{width:"100%"},optionLabelProp:o?"label":void 0,onChange:e=>{u&&u.setFieldValue(n,e),m&&m(e)},children:o?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(i,{value:"best_effort_throughput",label:"Default",children:(0,t.jsxs)("div",{style:{padding:"4px 0"},children:[(0,t.jsx)("div",{style:{fontWeight:500},children:"Default"}),(0,t.jsxs)("div",{style:{fontSize:"11px",color:"#6b7280",marginTop:"2px"},children:["Best effort throughput - no error if we're overallocating ",g," (Team/Key Limits checked at runtime)."]})]})}),(0,t.jsx)(i,{value:"guaranteed_throughput",label:"Guaranteed throughput",children:(0,t.jsxs)("div",{style:{padding:"4px 0"},children:[(0,t.jsx)("div",{style:{fontWeight:500},children:"Guaranteed throughput"}),(0,t.jsxs)("div",{style:{fontSize:"11px",color:"#6b7280",marginTop:"2px"},children:["Guaranteed throughput - raise an error if we're overallocating ",g," (also checks model-specific limits)"]})]})}),(0,t.jsx)(i,{value:"dynamic",label:"Dynamic",children:(0,t.jsxs)("div",{style:{padding:"4px 0"},children:[(0,t.jsx)("div",{style:{fontWeight:500},children:"Dynamic"}),(0,t.jsxs)("div",{style:{fontSize:"11px",color:"#6b7280",marginTop:"2px"},children:["If the key has a set ",p," (e.g. 2 ",p,") and there are no 429 errors, it can dynamically exceed the limit when the model being called is not erroring."]})]})})]}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(i,{value:"best_effort_throughput",children:"Best effort throughput"}),(0,t.jsx)(i,{value:"guaranteed_throughput",children:"Guaranteed throughput"}),(0,t.jsx)(i,{value:"dynamic",children:"Dynamic"})]})})})}])},363256,e=>{"use strict";var t=e.i(843476),s=e.i(199133);let{Text:a}=e.i(898586).Typography;e.s(["default",0,({organizations:e,value:l,onChange:r,disabled:i,loading:n,style:o})=>(0,t.jsx)(s.Select,{showSearch:!0,placeholder:"All Organizations",value:l,onChange:r,disabled:i,loading:n,allowClear:!0,style:{minWidth:280,...o},filterOption:(t,s)=>{if(!s)return!1;let a=e?.find(e=>e.organization_id===s.key);if(!a)return!1;let l=t.toLowerCase().trim(),r=(a.organization_alias||"").toLowerCase(),i=(a.organization_id||"").toLowerCase();return r.includes(l)||i.includes(l)},children:e?.map(e=>(0,t.jsxs)(s.Select.Option,{value:e.organization_id,children:[(0,t.jsx)("span",{className:"font-medium",children:e.organization_alias})," ",(0,t.jsxs)(a,{type:"secondary",children:["(",e.organization_id,")"]})]},e.organization_id))})])},109034,e=>{"use strict";var t=e.i(266027),s=e.i(243652),a=e.i(764205),l=e.i(135214);let r=(0,s.createQueryKeys)("tags");e.s(["useTags",0,()=>{let{accessToken:e,userId:s,userRole:i}=(0,l.default)();return(0,t.useQuery)({queryKey:r.list({}),queryFn:async()=>await (0,a.tagListCall)(e),enabled:!!(e&&s&&i)})}])},533882,e=>{"use strict";var t=e.i(843476),s=e.i(271645),a=e.i(250980),l=e.i(797672),r=e.i(68155),i=e.i(304967),n=e.i(629569),o=e.i(599724),c=e.i(269200),d=e.i(427612),u=e.i(64848),m=e.i(942232),p=e.i(496020),g=e.i(977572),h=e.i(992619),x=e.i(727749);e.s(["default",0,({accessToken:e,initialModelAliases:y={},onAliasUpdate:f,showExampleConfig:_=!0})=>{let[j,b]=(0,s.useState)([]),[v,w]=(0,s.useState)({aliasName:"",targetModel:""}),[N,k]=(0,s.useState)(null);(0,s.useEffect)(()=>{b(Object.entries(y).map(([e,t],s)=>({id:`${s}-${e}`,aliasName:e,targetModel:t})))},[y]);let S=()=>{if(!N)return;if(!N.aliasName||!N.targetModel)return void x.default.fromBackend("Please provide both alias name and target model");if(j.some(e=>e.id!==N.id&&e.aliasName===N.aliasName))return void x.default.fromBackend("An alias with this name already exists");let e=j.map(e=>e.id===N.id?N:e);b(e),k(null);let t={};e.forEach(e=>{t[e.aliasName]=e.targetModel}),f&&f(t),x.default.success("Alias updated successfully")},C=()=>{k(null)},T=j.reduce((e,t)=>(e[t.aliasName]=t.targetModel,e),{});return(0,t.jsxs)("div",{className:"mt-4",children:[(0,t.jsxs)("div",{className:"mb-6",children:[(0,t.jsx)(o.Text,{className:"text-sm font-medium text-gray-700 mb-2",children:"Add New Alias"}),(0,t.jsxs)("div",{className:"grid grid-cols-3 gap-4",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"block text-xs text-gray-500 mb-1",children:"Alias Name"}),(0,t.jsx)("input",{type:"text",value:v.aliasName,onChange:e=>w({...v,aliasName:e.target.value}),placeholder:"e.g., gpt-4o",className:"w-full px-3 py-2 border border-gray-300 rounded-md text-sm"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"block text-xs text-gray-500 mb-1",children:"Target Model"}),(0,t.jsx)(h.default,{accessToken:e,value:v.targetModel,placeholder:"Select target model",onChange:e=>w({...v,targetModel:e}),showLabel:!1})]}),(0,t.jsx)("div",{className:"flex items-end",children:(0,t.jsxs)("button",{onClick:()=>{if(!v.aliasName||!v.targetModel)return void x.default.fromBackend("Please provide both alias name and target model");if(j.some(e=>e.aliasName===v.aliasName))return void x.default.fromBackend("An alias with this name already exists");let e=[...j,{id:`${Date.now()}-${v.aliasName}`,aliasName:v.aliasName,targetModel:v.targetModel}];b(e),w({aliasName:"",targetModel:""});let t={};e.forEach(e=>{t[e.aliasName]=e.targetModel}),f&&f(t),x.default.success("Alias added successfully")},disabled:!v.aliasName||!v.targetModel,className:`flex items-center px-4 py-2 rounded-md text-sm ${!v.aliasName||!v.targetModel?"bg-gray-300 text-gray-500 cursor-not-allowed":"bg-green-600 text-white hover:bg-green-700"}`,children:[(0,t.jsx)(a.PlusCircleIcon,{className:"w-4 h-4 mr-1"}),"Add Alias"]})})]})]}),(0,t.jsx)(o.Text,{className:"text-sm font-medium text-gray-700 mb-2",children:"Manage Existing Aliases"}),(0,t.jsx)("div",{className:"rounded-lg custom-border relative mb-6",children:(0,t.jsx)("div",{className:"overflow-x-auto",children:(0,t.jsxs)(c.Table,{className:"[&_td]:py-0.5 [&_th]:py-1",children:[(0,t.jsx)(d.TableHead,{children:(0,t.jsxs)(p.TableRow,{children:[(0,t.jsx)(u.TableHeaderCell,{className:"py-1 h-8",children:"Alias Name"}),(0,t.jsx)(u.TableHeaderCell,{className:"py-1 h-8",children:"Target Model"}),(0,t.jsx)(u.TableHeaderCell,{className:"py-1 h-8",children:"Actions"})]})}),(0,t.jsxs)(m.TableBody,{children:[j.map(s=>(0,t.jsx)(p.TableRow,{className:"h-8",children:N&&N.id===s.id?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(g.TableCell,{className:"py-0.5",children:(0,t.jsx)("input",{type:"text",value:N.aliasName,onChange:e=>k({...N,aliasName:e.target.value}),className:"w-full px-2 py-1 border border-gray-300 rounded-md text-sm"})}),(0,t.jsx)(g.TableCell,{className:"py-0.5",children:(0,t.jsx)(h.default,{accessToken:e,value:N.targetModel,onChange:e=>k({...N,targetModel:e}),showLabel:!1,style:{height:"32px"}})}),(0,t.jsx)(g.TableCell,{className:"py-0.5 whitespace-nowrap",children:(0,t.jsxs)("div",{className:"flex space-x-2",children:[(0,t.jsx)("button",{onClick:S,className:"text-xs bg-blue-50 text-blue-600 px-2 py-1 rounded hover:bg-blue-100",children:"Save"}),(0,t.jsx)("button",{onClick:C,className:"text-xs bg-gray-50 text-gray-600 px-2 py-1 rounded hover:bg-gray-100",children:"Cancel"})]})})]}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(g.TableCell,{className:"py-0.5 text-sm text-gray-900",children:s.aliasName}),(0,t.jsx)(g.TableCell,{className:"py-0.5 text-sm text-gray-500",children:s.targetModel}),(0,t.jsx)(g.TableCell,{className:"py-0.5 whitespace-nowrap",children:(0,t.jsxs)("div",{className:"flex space-x-2",children:[(0,t.jsx)("button",{onClick:()=>{k({...s})},className:"text-xs bg-blue-50 text-blue-600 px-2 py-1 rounded hover:bg-blue-100",children:(0,t.jsx)(l.PencilIcon,{className:"w-3 h-3"})}),(0,t.jsx)("button",{onClick:()=>{var e;let t,a;return e=s.id,b(t=j.filter(t=>t.id!==e)),a={},void(t.forEach(e=>{a[e.aliasName]=e.targetModel}),f&&f(a),x.default.success("Alias deleted successfully"))},className:"text-xs bg-red-50 text-red-600 px-2 py-1 rounded hover:bg-red-100",children:(0,t.jsx)(r.TrashIcon,{className:"w-3 h-3"})})]})})]})},s.id)),0===j.length&&(0,t.jsx)(p.TableRow,{children:(0,t.jsx)(g.TableCell,{colSpan:3,className:"py-0.5 text-sm text-gray-500 text-center",children:"No aliases added yet. Add a new alias above."})})]})]})})}),_&&(0,t.jsxs)(i.Card,{children:[(0,t.jsx)(n.Title,{className:"mb-4",children:"Configuration Example"}),(0,t.jsx)(o.Text,{className:"text-gray-600 mb-4",children:"Here's how your current aliases would look in the config:"}),(0,t.jsx)("div",{className:"bg-gray-100 rounded-lg p-4 font-mono text-sm",children:(0,t.jsxs)("div",{className:"text-gray-700",children:["model_aliases:",0===Object.keys(T).length?(0,t.jsxs)("span",{className:"text-gray-500",children:[(0,t.jsx)("br",{}),"  # No aliases configured yet"]}):Object.entries(T).map(([e,s])=>(0,t.jsxs)("span",{children:[(0,t.jsx)("br",{}),'  "',e,'": "',s,'"']},e))]})})]})]})}])},651904,e=>{"use strict";var t=e.i(843476),s=e.i(599724),a=e.i(266484);e.s(["default",0,function({value:e,onChange:l,premiumUser:r=!1,disabledCallbacks:i=[],onDisabledCallbacksChange:n}){return r?(0,t.jsx)(a.default,{value:e,onChange:l,disabledCallbacks:i,onDisabledCallbacksChange:n}):(0,t.jsxs)("div",{children:[(0,t.jsxs)("div",{className:"flex flex-wrap gap-2 mb-3",children:[(0,t.jsx)("div",{className:"inline-flex items-center px-3 py-1.5 rounded-lg bg-green-50 border border-green-200 text-green-800 text-sm font-medium opacity-50",children:"✨ langfuse-logging"}),(0,t.jsx)("div",{className:"inline-flex items-center px-3 py-1.5 rounded-lg bg-green-50 border border-green-200 text-green-800 text-sm font-medium opacity-50",children:"✨ datadog-logging"})]}),(0,t.jsx)("div",{className:"p-3 bg-yellow-50 border border-yellow-200 rounded-lg",children:(0,t.jsxs)(s.Text,{className:"text-sm text-yellow-800",children:["Setting Key/Team logging settings is a LiteLLM Enterprise feature. Global Logging Settings are available for all free users. Get a trial key"," ",(0,t.jsx)("a",{href:"https://www.litellm.ai/#pricing",target:"_blank",rel:"noopener noreferrer",className:"underline",children:"here"}),"."]})})]})}])},460285,e=>{"use strict";var t=e.i(843476),s=e.i(271645),a=e.i(404206),l=e.i(723731),r=e.i(653824),i=e.i(881073),n=e.i(197647),o=e.i(764205),c=e.i(158392),d=e.i(419470),u=e.i(689020);let m=(0,s.forwardRef)(({accessToken:e,value:m,onChange:p,modelData:g},h)=>{let[x,y]=(0,s.useState)({routerSettings:{},selectedStrategy:null,enableTagFiltering:!1}),[f,_]=(0,s.useState)([]),[j,b]=(0,s.useState)([]),[v,w]=(0,s.useState)([]),[N,k]=(0,s.useState)([]),[S,C]=(0,s.useState)({}),[T,I]=(0,s.useState)({}),A=(0,s.useRef)(!1),L=(0,s.useRef)(null);(0,s.useEffect)(()=>{let e=m?.router_settings?JSON.stringify({routing_strategy:m.router_settings.routing_strategy,fallbacks:m.router_settings.fallbacks,enable_tag_filtering:m.router_settings.enable_tag_filtering}):null;if(A.current&&e===L.current){A.current=!1;return}if(A.current&&e!==L.current&&(A.current=!1),e!==L.current)if(L.current=e,m?.router_settings){let e=m.router_settings,{fallbacks:t,...s}=e;y({routerSettings:s,selectedStrategy:e.routing_strategy||null,enableTagFiltering:e.enable_tag_filtering??!1});let a=e.fallbacks||[];_(a),b(a&&0!==a.length?a.map((e,t)=>{let[s,a]=Object.entries(e)[0];return{id:(t+1).toString(),primaryModel:s||null,fallbackModels:a||[]}}):[{id:"1",primaryModel:null,fallbackModels:[]}])}else y({routerSettings:{},selectedStrategy:null,enableTagFiltering:!1}),_([]),b([{id:"1",primaryModel:null,fallbackModels:[]}])},[m]),(0,s.useEffect)(()=>{e&&(0,o.getRouterSettingsCall)(e).then(e=>{if(e.fields){let t={};e.fields.forEach(e=>{t[e.field_name]={ui_field_name:e.ui_field_name,field_description:e.field_description,options:e.options,link:e.link}}),C(t);let s=e.fields.find(e=>"routing_strategy"===e.field_name);s?.options&&k(s.options),e.routing_strategy_descriptions&&I(e.routing_strategy_descriptions)}})},[e]),(0,s.useEffect)(()=>{e&&(async()=>{try{let t=await (0,u.fetchAvailableModels)(e);w(t)}catch(e){console.error("Error fetching model info for fallbacks:",e)}})()},[e]);let F=()=>{let e=new Set(["allowed_fails","cooldown_time","num_retries","timeout","retry_after"]),t=new Set(["model_group_alias","retry_policy"]),s=Object.fromEntries(Object.entries({...x.routerSettings,enable_tag_filtering:x.enableTagFiltering,routing_strategy:x.selectedStrategy,fallbacks:f.length>0?f:null}).map(([s,a])=>{if("routing_strategy_args"!==s&&"routing_strategy"!==s&&"enable_tag_filtering"!==s&&"fallbacks"!==s){let l=document.querySelector(`input[name="${s}"]`);if(l&&void 0!==l.value&&""!==l.value){let r=((s,a,l)=>{if(null==a)return l;let r=String(a).trim();if(""===r||"null"===r.toLowerCase())return null;if(e.has(s)){let e=Number(r);return Number.isNaN(e)?l:e}if(t.has(s)){if(""===r)return null;try{return JSON.parse(r)}catch{return l}}return"true"===r.toLowerCase()||"false"!==r.toLowerCase()&&r})(s,l.value,a);return[s,r]}}else if("routing_strategy"===s)return[s,x.selectedStrategy];else if("enable_tag_filtering"===s)return[s,x.enableTagFiltering];else if("fallbacks"===s)return[s,f.length>0?f:null];else if("routing_strategy_args"===s&&"latency-based-routing"===x.selectedStrategy){let e=document.querySelector('input[name="lowest_latency_buffer"]'),t=document.querySelector('input[name="ttl"]'),s={};return e?.value&&(s.lowest_latency_buffer=Number(e.value)),t?.value&&(s.ttl=Number(t.value)),["routing_strategy_args",Object.keys(s).length>0?s:null]}return[s,a]}).filter(e=>null!=e)),a=(e,t=!1)=>null==e||"object"==typeof e&&!Array.isArray(e)&&0===Object.keys(e).length||t&&("number"!=typeof e||Number.isNaN(e))?null:e;return{routing_strategy:a(s.routing_strategy),allowed_fails:a(s.allowed_fails,!0),cooldown_time:a(s.cooldown_time,!0),num_retries:a(s.num_retries,!0),timeout:a(s.timeout,!0),retry_after:a(s.retry_after,!0),fallbacks:f.length>0?f:null,context_window_fallbacks:a(s.context_window_fallbacks),retry_policy:a(s.retry_policy),model_group_alias:a(s.model_group_alias),enable_tag_filtering:x.enableTagFiltering,routing_strategy_args:a(s.routing_strategy_args)}};(0,s.useEffect)(()=>{if(!p)return;let e=setTimeout(()=>{A.current=!0,p({router_settings:F()})},100);return()=>clearTimeout(e)},[x,f]);let O=Array.from(new Set(v.map(e=>e.model_group))).sort();return((0,s.useImperativeHandle)(h,()=>({getValue:()=>({router_settings:F()})})),e)?(0,t.jsx)("div",{className:"w-full",children:(0,t.jsxs)(r.TabGroup,{className:"w-full",children:[(0,t.jsxs)(i.TabList,{variant:"line",defaultValue:"1",className:"px-8 pt-4",children:[(0,t.jsx)(n.Tab,{value:"1",children:"Loadbalancing"}),(0,t.jsx)(n.Tab,{value:"2",children:"Fallbacks"})]}),(0,t.jsxs)(l.TabPanels,{className:"px-8 py-6",children:[(0,t.jsx)(a.TabPanel,{children:(0,t.jsx)(c.default,{value:x,onChange:y,routerFieldsMetadata:S,availableRoutingStrategies:N,routingStrategyDescriptions:T})}),(0,t.jsx)(a.TabPanel,{children:(0,t.jsx)(d.FallbackSelectionForm,{groups:j,onGroupsChange:e=>{b(e),_(e.filter(e=>e.primaryModel&&e.fallbackModels.length>0).map(e=>({[e.primaryModel]:e.fallbackModels})))},availableModels:O,maxGroups:5})})]})]})}):null});m.displayName="RouterSettingsAccordion",e.s(["default",0,m])},575260,e=>{"use strict";var t=e.i(843476),s=e.i(199133),a=e.i(482725),l=e.i(56456);e.s(["default",0,({projects:e,value:r,onChange:i,disabled:n,loading:o,teamId:c})=>{let d=c?e?.filter(e=>e.team_id===c):e;return(0,t.jsx)(s.Select,{showSearch:!0,placeholder:"Search or select a project",value:r,onChange:i,disabled:n,loading:o,allowClear:!0,notFoundContent:o?(0,t.jsx)(a.Spin,{indicator:(0,t.jsx)(l.LoadingOutlined,{spin:!0}),size:"small"}):void 0,filterOption:(e,t)=>{if(!t)return!1;let s=d?.find(e=>e.project_id===t.key);if(!s)return!1;let a=e.toLowerCase().trim(),l=(s.project_alias||"").toLowerCase(),r=(s.project_id||"").toLowerCase();return l.includes(a)||r.includes(a)},optionFilterProp:"children",children:!o&&d?.map(e=>(0,t.jsxs)(s.Select.Option,{value:e.project_id,children:[(0,t.jsx)("span",{className:"font-medium",children:e.project_alias||e.project_id})," ",(0,t.jsxs)("span",{className:"text-gray-500",children:["(",e.project_id,")"]})]},e.project_id))})}])},702597,364769,e=>{"use strict";var t=e.i(843476),s=e.i(207082),a=e.i(109799),l=e.i(510674),r=e.i(109034),i=e.i(292639),n=e.i(135214),o=e.i(500330),c=e.i(827252),d=e.i(912598),u=e.i(677667),m=e.i(130643),p=e.i(898667),g=e.i(994388),h=e.i(309426),x=e.i(350967),y=e.i(599724),f=e.i(779241),_=e.i(629569),j=e.i(464571),b=e.i(808613),v=e.i(311451),w=e.i(212931),N=e.i(91739),k=e.i(199133),S=e.i(790848),C=e.i(262218),T=e.i(592968),I=e.i(374009),A=e.i(271645),L=e.i(708347),F=e.i(552130),O=e.i(557662),M=e.i(9314),P=e.i(860585),E=e.i(82946),$=e.i(392110),V=e.i(533882),B=e.i(844565),R=e.i(651904),G=e.i(939510),D=e.i(460285),K=e.i(663435),z=e.i(363256),U=e.i(575260),q=e.i(371455),W=e.i(355619),H=e.i(75921),Q=e.i(390605),J=e.i(727749),Y=e.i(764205),X=e.i(237016),Z=e.i(888259);let ee=({apiKey:e})=>{let[s,a]=(0,A.useState)(!1);return(0,t.jsxs)("div",{children:[(0,t.jsxs)("p",{className:"mb-2",children:["Please save this secret key somewhere safe and accessible. For security reasons,"," ",(0,t.jsx)("b",{children:"you will not be able to view it again"})," through your LiteLLM account. If you lose this secret key, you will need to generate a new one."]}),(0,t.jsx)("p",{className:"text-sm text-gray-600 mt-3 mb-1",children:"Virtual Key:"}),(0,t.jsx)("div",{style:{background:"#f8f8f8",padding:"10px",borderRadius:"5px",marginBottom:"10px"},children:(0,t.jsx)("pre",{style:{wordWrap:"break-word",whiteSpace:"normal",margin:0},children:e})}),(0,t.jsx)(X.CopyToClipboard,{text:e,onCopy:()=>{a(!0),Z.default.success("Key copied to clipboard"),setTimeout(()=>a(!1),2e3)},children:(0,t.jsx)(j.Button,{type:"primary",style:{marginTop:12},children:s?"Copied!":"Copy Virtual Key"})})]})};e.s(["default",0,ee],364769);var et=e.i(435451),es=e.i(916940);let{Option:ea}=k.Select,el=async(e,t,s,a)=>{try{if(null===e||null===t)return[];if(null!==s){let l=(await (0,Y.modelAvailableCall)(s,e,t,!0,a,!0)).data.map(e=>e.id);return console.log("available_model_names:",l),l}return[]}catch(e){return console.error("Error fetching user models:",e),[]}},er=async(e,t,s,a)=>{try{if(null===e||null===t)return;if(null!==s){let l=(await (0,Y.modelAvailableCall)(s,e,t)).data.map(e=>e.id);console.log("available_model_names:",l),a(l)}}catch(e){console.error("Error fetching user models:",e)}};e.s(["default",0,({team:e,teams:X,data:Z,addKey:ei,autoOpenCreate:en,prefillData:eo})=>{let{accessToken:ec,userId:ed,userRole:eu,premiumUser:em}=(0,n.default)(),ep=em||null!=eu&&L.rolesWithWriteAccess.includes(eu),{data:eg,isLoading:eh}=(0,a.useOrganizations)(),{data:ex,isLoading:ey}=(0,l.useProjects)(),{data:ef}=(0,i.useUISettings)(),{data:e_}=(0,r.useTags)(),ej=!!ef?.values?.enable_projects_ui,eb=!!ef?.values?.disable_custom_api_keys,ev=e_?Object.values(e_).map(e=>({value:e.name,label:e.name})):[],ew=(0,d.useQueryClient)(),[eN]=b.Form.useForm(),[ek,eS]=(0,A.useState)(!1),[eC,eT]=(0,A.useState)(null),[eI,eA]=(0,A.useState)(null),[eL,eF]=(0,A.useState)([]),[eO,eM]=(0,A.useState)([]),[eP,eE]=(0,A.useState)("you"),[e$,eV]=(0,A.useState)(!1),[eB,eR]=(0,A.useState)(null),[eG,eD]=(0,A.useState)([]),[eK,ez]=(0,A.useState)([]),[eU,eq]=(0,A.useState)([]),[eW,eH]=(0,A.useState)([]),[eQ,eJ]=(0,A.useState)(e),[eY,eX]=(0,A.useState)(null),[eZ,e0]=(0,A.useState)(null),[e1,e2]=(0,A.useState)(!1),[e4,e5]=(0,A.useState)(null),[e3,e6]=(0,A.useState)({}),[e7,e9]=(0,A.useState)([]),[e8,te]=(0,A.useState)(!1),[tt,ts]=(0,A.useState)([]),[ta,tl]=(0,A.useState)([]),[tr,ti]=(0,A.useState)("llm_api"),[tn,to]=(0,A.useState)({}),[tc,td]=(0,A.useState)(!1),[tu,tm]=(0,A.useState)("30d"),[tp,tg]=(0,A.useState)(null),[th,tx]=(0,A.useState)(0),[ty,tf]=(0,A.useState)([]),[t_,tj]=(0,A.useState)(null),tb=()=>{eS(!1),eN.resetFields(),eH([]),tl([]),ti("llm_api"),to({}),td(!1),tm("30d"),tg(null),tx(e=>e+1),tj(null),eX(null),e0(null)},tv=()=>{eS(!1),eT(null),eJ(null),eN.resetFields(),eH([]),tl([]),ti("llm_api"),to({}),td(!1),tm("30d"),tg(null),tx(e=>e+1),tj(null),eX(null),e0(null)};(0,A.useEffect)(()=>{ed&&eu&&ec&&er(ed,eu,ec,eF)},[ec,ed,eu]),(0,A.useEffect)(()=>{ec&&(0,Y.getAgentsList)(ec).then(e=>tf(e?.agents||[])).catch(()=>tf([]))},[ec]),(0,A.useEffect)(()=>{let e=async()=>{try{let e=(await (0,Y.getPoliciesList)(ec)).policies.map(e=>e.policy_name);ez(e)}catch(e){console.error("Failed to fetch policies:",e)}},t=async()=>{try{let e=await (0,Y.getPromptsList)(ec);eq(e.prompts.map(e=>e.prompt_id))}catch(e){console.error("Failed to fetch prompts:",e)}};(async()=>{try{let e=(await (0,Y.getGuardrailsList)(ec)).guardrails.map(e=>e.guardrail_name);eD(e)}catch(e){console.error("Failed to fetch guardrails:",e)}})(),e(),t()},[ec]),(0,A.useEffect)(()=>{(async()=>{try{if(ec){let e=sessionStorage.getItem("possibleUserRoles");if(e)e6(JSON.parse(e));else{let e=await (0,Y.getPossibleUserRoles)(ec);sessionStorage.setItem("possibleUserRoles",JSON.stringify(e)),e6(e)}}}catch(e){console.error("Error fetching possible user roles:",e)}})()},[ec]),(0,A.useEffect)(()=>{if(en&&!e$&&X&&eu&&L.rolesWithWriteAccess.includes(eu)&&(eS(!0),eV(!0),eo)){if(eo.owned_by&&("another_user"===eo.owned_by&&"Admin"!==eu?eE("you"):eE(eo.owned_by)),eo.team_id){let e=X?.find(e=>e.team_id===eo.team_id)||null;e&&(eJ(e),eN.setFieldsValue({team_id:eo.team_id}))}eo.key_alias&&eN.setFieldsValue({key_alias:eo.key_alias}),eo.models&&eo.models.length>0&&eR(eo.models),eo.key_type&&(ti(eo.key_type),eN.setFieldsValue({key_type:eo.key_type}))}},[en,eo,X,e$,eN,eu]);let tw=eO.includes("no-default-models")&&!eQ,tN=async e=>{try{let t,a=e?.key_alias??"",l=e?.team_id??null;if((Z?.filter(e=>e.team_id===l).map(e=>e.key_alias)??[]).includes(a))throw Error(`Key alias ${a} already exists for team with ID ${l}, please provide another key alias`);if(J.default.info("Making API Call"),eS(!0),"you"===eP)e.user_id=ed;else if("agent"===eP){if(!t_)return void J.default.fromBackend("Please select an agent");e.agent_id=t_}let r={};try{r=JSON.parse(e.metadata||"{}")}catch(e){console.error("Error parsing metadata:",e)}if("service_account"===eP&&(r.service_account_id=e.key_alias),eW.length>0&&(r={...r,logging:eW.filter(e=>e.callback_name)}),ta.length>0){let e=(0,O.mapDisplayToInternalNames)(ta);r={...r,litellm_disabled_callbacks:e}}if(tc&&(e.auto_rotate=!0,e.rotation_interval=tu),e.duration&&""!==e.duration.trim()||(e.duration=null),e.metadata=JSON.stringify(r),e.allowed_vector_store_ids&&e.allowed_vector_store_ids.length>0&&(e.object_permission={vector_stores:e.allowed_vector_store_ids},delete e.allowed_vector_store_ids),e.allowed_mcp_servers_and_groups&&(e.allowed_mcp_servers_and_groups.servers?.length>0||e.allowed_mcp_servers_and_groups.accessGroups?.length>0)){e.object_permission||(e.object_permission={});let{servers:t,accessGroups:s}=e.allowed_mcp_servers_and_groups;t&&t.length>0&&(e.object_permission.mcp_servers=t),s&&s.length>0&&(e.object_permission.mcp_access_groups=s),delete e.allowed_mcp_servers_and_groups}let i=e.mcp_tool_permissions||{};if(Object.keys(i).length>0&&(e.object_permission||(e.object_permission={}),e.object_permission.mcp_tool_permissions=i),delete e.mcp_tool_permissions,e.allowed_mcp_access_groups&&e.allowed_mcp_access_groups.length>0&&(e.object_permission||(e.object_permission={}),e.object_permission.mcp_access_groups=e.allowed_mcp_access_groups,delete e.allowed_mcp_access_groups),e.allowed_agents_and_groups&&(e.allowed_agents_and_groups.agents?.length>0||e.allowed_agents_and_groups.accessGroups?.length>0)){e.object_permission||(e.object_permission={});let{agents:t,accessGroups:s}=e.allowed_agents_and_groups;t&&t.length>0&&(e.object_permission.agents=t),s&&s.length>0&&(e.object_permission.agent_access_groups=s),delete e.allowed_agents_and_groups}Object.keys(tn).length>0&&(e.aliases=JSON.stringify(tn)),tp?.router_settings&&Object.values(tp.router_settings).some(e=>null!=e&&""!==e)&&(e.router_settings=tp.router_settings),t="service_account"===eP?await (0,Y.keyCreateServiceAccountCall)(ec,e):await (0,Y.keyCreateCall)(ec,ed,e),console.log("key create Response:",t),ei(t),ew.invalidateQueries({queryKey:s.keyKeys.lists()}),eT(t.key),eA(t.soft_budget),J.default.success("Virtual Key Created"),eN.resetFields(),localStorage.removeItem("userData"+ed)}catch(t){console.log("error in create key:",t);let e=(e=>{let t;if(!(t=!e||"object"!=typeof e||e instanceof Error?String(e):JSON.stringify(e)).includes("/key/generate")&&!t.includes("KeyManagementRoutes.KEY_GENERATE"))return`Error creating the key: ${e}`;let s=t;try{if(!e||"object"!=typeof e||e instanceof Error){let e=t.match(/\{[\s\S]*\}/);if(e){let t=JSON.parse(e[0]),a=t?.error||t;a?.message&&(s=a.message)}}else{let t=e?.error||e;t?.message&&(s=t.message)}}catch(e){}return t.includes("team_member_permission_error")||s.includes("Team member does not have permissions")?"Team member does not have permission to generate key for this team. Ask your proxy admin to configure the team member permission settings.":`Error creating the key: ${e}`})(t);J.default.fromBackend(e)}};(0,A.useEffect)(()=>{if(eZ){let e=ex?.find(e=>e.project_id===eZ);eM(e?.models??[]),eN.setFieldValue("models",[]);return}ed&&eu&&ec&&el(ed,eu,ec,eQ?.team_id??null).then(e=>{eM(Array.from(new Set([...eQ?.models??[],...e])))}),eB||eN.setFieldValue("models",[]),eN.setFieldValue("allowed_mcp_servers_and_groups",{servers:[],accessGroups:[]})},[eQ,eZ,ec,ed,eu,eN]),(0,A.useEffect)(()=>{if(!eB||0===eB.length||!eO||0===eO.length)return;let e=eB.filter(e=>eO.includes(e));e.length>0&&eN.setFieldsValue({models:e}),eR(null)},[eB,eO,eN]),(0,A.useEffect)(()=>{if(!eZ||!X)return;let e=ex?.find(e=>e.project_id===eZ);if(!e?.team_id||eQ?.team_id===e.team_id)return;let t=X.find(t=>t.team_id===e.team_id)||null;t&&(eJ(t),eN.setFieldValue("team_id",t.team_id))},[X,eZ,ex]);let tk=async e=>{if(!e)return void e9([]);te(!0);try{let t=new URLSearchParams;if(t.append("user_email",e),null==ec)return;let s=(await (0,Y.userFilterUICall)(ec,t)).map(e=>({label:`${e.user_email} (${e.user_id})`,value:e.user_id,user:e}));e9(s)}catch(e){console.error("Error fetching users:",e),J.default.fromBackend("Failed to search for users")}finally{te(!1)}},tS=(0,A.useCallback)((0,I.default)(e=>tk(e),300),[ec]);return(0,t.jsxs)("div",{children:[eu&&L.rolesWithWriteAccess.includes(eu)&&(0,t.jsx)(g.Button,{className:"mx-auto",onClick:()=>eS(!0),"data-testid":"create-key-button",children:"+ Create New Key"}),(0,t.jsx)(w.Modal,{open:ek,width:1e3,footer:null,onOk:tb,onCancel:tv,children:(0,t.jsxs)(b.Form,{form:eN,onFinish:tN,labelCol:{span:8},wrapperCol:{span:16},labelAlign:"left",children:[(0,t.jsxs)("div",{className:"mb-8",children:[(0,t.jsx)(_.Title,{className:"mb-4",children:"Key Ownership"}),(0,t.jsx)(b.Form.Item,{label:(0,t.jsxs)("span",{children:["Owned By"," ",(0,t.jsx)(T.Tooltip,{title:"Select who will own this Virtual Key",children:(0,t.jsx)(c.InfoCircleOutlined,{style:{marginLeft:"4px"}})})]}),className:"mb-4",children:(0,t.jsxs)(N.Radio.Group,{onChange:e=>eE(e.target.value),value:eP,children:[(0,t.jsx)(N.Radio,{value:"you",children:"You"}),(0,t.jsx)(N.Radio,{value:"service_account",children:"Service Account"}),"Admin"===eu&&(0,t.jsx)(N.Radio,{value:"another_user",children:"Another User"}),(0,t.jsxs)(N.Radio,{value:"agent",children:["Agent ",(0,t.jsx)(C.Tag,{color:"purple",children:"New"})]})]})}),"another_user"===eP&&(0,t.jsx)(b.Form.Item,{label:(0,t.jsxs)("span",{children:["User ID"," ",(0,t.jsx)(T.Tooltip,{title:"The user who will own this key and be responsible for its usage",children:(0,t.jsx)(c.InfoCircleOutlined,{style:{marginLeft:"4px"}})})]}),name:"user_id",className:"mt-4",rules:[{required:"another_user"===eP,message:"Please input the user ID of the user you are assigning the key to"}],children:(0,t.jsxs)("div",{children:[(0,t.jsxs)("div",{style:{display:"flex",marginBottom:"8px"},children:[(0,t.jsx)(k.Select,{showSearch:!0,placeholder:"Type email to search for users",filterOption:!1,onSearch:e=>{tS(e)},onSelect:(e,t)=>{let s;return s=t.user,void eN.setFieldsValue({user_id:s.user_id})},options:e7,loading:e8,allowClear:!0,style:{width:"100%"},notFoundContent:e8?"Searching...":"No users found"}),(0,t.jsx)(j.Button,{onClick:()=>e2(!0),style:{marginLeft:"8px"},children:"Create User"})]}),(0,t.jsx)("div",{className:"text-xs text-gray-500",children:"Search by email to find users"})]})}),"agent"===eP&&(0,t.jsxs)("div",{className:"mt-4 p-4 bg-purple-50 border border-purple-200 rounded-md",children:[(0,t.jsx)("div",{className:"mb-3",children:(0,t.jsxs)("span",{className:"text-sm font-medium text-gray-700",children:["Select Agent ",(0,t.jsx)("span",{className:"text-red-500",children:"*"})]})}),(0,t.jsx)(k.Select,{showSearch:!0,placeholder:"Select an agent",style:{width:"100%"},value:t_,onChange:e=>tj(e),filterOption:(e,t)=>t?.label?.toLowerCase().includes(e.toLowerCase()),options:ty.map(e=>({label:e.agent_name||e.agent_id,value:e.agent_id}))}),(0,t.jsx)("div",{className:"text-xs text-gray-500 mt-2",children:"This key will be used by the selected agent to make requests to LiteLLM"})]}),(0,t.jsx)(b.Form.Item,{label:(0,t.jsxs)("span",{children:["Organization"," ",(0,t.jsx)(T.Tooltip,{title:"The organization this key belongs to. Selecting an organization filters the available teams.",children:(0,t.jsx)(c.InfoCircleOutlined,{style:{marginLeft:"4px"}})})]}),name:"organization_id",className:"mt-4",children:(0,t.jsx)(z.default,{organizations:eg,loading:eh,disabled:"Admin"!==eu,onChange:e=>{eX(e||null),eJ(null),e0(null),eN.setFieldValue("team_id",void 0),eN.setFieldValue("project_id",void 0)}})}),(0,t.jsx)(b.Form.Item,{label:(0,t.jsxs)("span",{children:["Team"," ",(0,t.jsx)(T.Tooltip,{title:"The team this key belongs to, which determines available models and budget limits",children:(0,t.jsx)(c.InfoCircleOutlined,{style:{marginLeft:"4px"}})})]}),name:"team_id",initialValue:e?e.team_id:null,className:"mt-4",rules:[{required:"service_account"===eP,message:"Please select a team for the service account"}],help:"service_account"===eP?"required":"",children:(0,t.jsx)(K.default,{disabled:null!==eZ,organizationId:eY,onTeamSelect:e=>{eJ(e),e0(null),eN.setFieldValue("project_id",void 0),e?.organization_id?(eX(e.organization_id),eN.setFieldValue("organization_id",e.organization_id)):e||(eX(null),eN.setFieldValue("organization_id",void 0))}})}),ej&&(0,t.jsx)(b.Form.Item,{label:(0,t.jsxs)("span",{children:["Project"," ",(0,t.jsx)(T.Tooltip,{title:"Assign this key to a project. Selecting a project will lock the team to the project's team.",children:(0,t.jsx)(c.InfoCircleOutlined,{style:{marginLeft:"4px"}})})]}),name:"project_id",className:"mt-4",children:(0,t.jsx)(U.default,{projects:ex,teamId:eQ?.team_id,loading:ey||!X,onChange:e=>{if(!e){e0(null),eJ(null),eN.setFieldValue("team_id",void 0);return}e0(e)}})})]}),tw&&(0,t.jsx)("div",{className:"mb-8 p-4 bg-blue-50 border border-blue-200 rounded-md",children:(0,t.jsx)(y.Text,{className:"text-blue-800 text-sm",children:"Please select a team to continue configuring your Virtual Key. If you do not see any teams, please contact your Proxy Admin to either provide you with access to models or to add you to a team."})}),!tw&&(0,t.jsxs)("div",{className:"mb-8",children:[(0,t.jsx)(_.Title,{className:"mb-4",children:"Key Details"}),(0,t.jsx)(b.Form.Item,{label:(0,t.jsxs)("span",{children:["you"===eP||"another_user"===eP?"Key Name":"Service Account ID"," ",(0,t.jsx)(T.Tooltip,{title:"you"===eP||"another_user"===eP?"A descriptive name to identify this key":"Unique identifier for this service account",children:(0,t.jsx)(c.InfoCircleOutlined,{style:{marginLeft:"4px"}})})]}),name:"key_alias",rules:[{required:!0,message:`Please input a ${"you"===eP?"key name":"service account ID"}`}],help:"required",children:(0,t.jsx)(f.TextInput,{placeholder:""})}),(0,t.jsx)(b.Form.Item,{label:(0,t.jsxs)("span",{children:["Models"," ",(0,t.jsx)(T.Tooltip,{title:"Select which models this key can access. Choose 'All Team Models' to grant access to all models available to the team. Leave empty to allow access to all models.",children:(0,t.jsx)(c.InfoCircleOutlined,{style:{marginLeft:"4px"}})})]}),name:"models",rules:[],help:"management"===tr||"read_only"===tr?"Models field is disabled for this key type":"optional - leave empty to allow access to all models",className:"mt-4",children:(0,t.jsxs)(k.Select,{mode:"multiple",placeholder:"Select models",style:{width:"100%"},disabled:"management"===tr||"read_only"===tr,onChange:e=>{e.includes("all-team-models")&&eN.setFieldsValue({models:["all-team-models"]})},children:[!eZ&&(0,t.jsx)(ea,{value:"all-team-models",children:"All Team Models"},"all-team-models"),eO.map(e=>(0,t.jsx)(ea,{value:e,children:(0,W.getModelDisplayName)(e)},e))]})}),(0,t.jsx)(b.Form.Item,{label:(0,t.jsxs)("span",{children:["Key Type"," ",(0,t.jsx)(T.Tooltip,{title:"Select the type of key to determine what routes and operations this key can access",children:(0,t.jsx)(c.InfoCircleOutlined,{style:{marginLeft:"4px"}})})]}),name:"key_type",initialValue:"llm_api",className:"mt-4",children:(0,t.jsxs)(k.Select,{defaultValue:"llm_api",placeholder:"Select key type",style:{width:"100%"},optionLabelProp:"label",onChange:e=>{ti(e),("management"===e||"read_only"===e)&&eN.setFieldsValue({models:[]})},children:[(0,t.jsx)(ea,{value:"default",label:"Default",children:(0,t.jsxs)("div",{style:{padding:"4px 0"},children:[(0,t.jsx)("div",{style:{fontWeight:500},children:"Default"}),(0,t.jsx)("div",{style:{fontSize:"11px",color:"#6b7280",marginTop:"2px"},children:"Can call AI APIs + Management routes"})]})}),(0,t.jsx)(ea,{value:"llm_api",label:"AI APIs",children:(0,t.jsxs)("div",{style:{padding:"4px 0"},children:[(0,t.jsx)("div",{style:{fontWeight:500},children:"AI APIs"}),(0,t.jsx)("div",{style:{fontSize:"11px",color:"#6b7280",marginTop:"2px"},children:"Can call only AI API routes (chat/completions, embeddings, etc.)"})]})}),(0,t.jsx)(ea,{value:"management",label:"Management",children:(0,t.jsxs)("div",{style:{padding:"4px 0"},children:[(0,t.jsx)("div",{style:{fontWeight:500},children:"Management"}),(0,t.jsx)("div",{style:{fontSize:"11px",color:"#6b7280",marginTop:"2px"},children:"Can call only management routes (user/team/key management)"})]})})]})})]}),!tw&&(0,t.jsx)("div",{className:"mb-8",children:(0,t.jsxs)(u.Accordion,{className:"mt-4 mb-4",children:[(0,t.jsx)(p.AccordionHeader,{children:(0,t.jsx)(_.Title,{className:"m-0",children:"Optional Settings"})}),(0,t.jsxs)(m.AccordionBody,{children:[(0,t.jsx)(b.Form.Item,{className:"mt-4",label:(0,t.jsxs)("span",{children:["Max Budget (USD)"," ",(0,t.jsx)(T.Tooltip,{title:"Maximum amount in USD this key can spend. When reached, the key will be blocked from making further requests",children:(0,t.jsx)(c.InfoCircleOutlined,{style:{marginLeft:"4px"}})})]}),name:"max_budget",help:`Budget cannot exceed team max budget: $${e?.max_budget!==null&&e?.max_budget!==void 0?e?.max_budget:"unlimited"}`,rules:[{validator:async(t,s)=>{if(s&&e&&null!==e.max_budget&&s>e.max_budget)throw Error(`Budget cannot exceed team max budget: $${(0,o.formatNumberWithCommas)(e.max_budget,4)}`)}}],children:(0,t.jsx)(et.default,{step:.01,precision:2,width:200})}),(0,t.jsx)(b.Form.Item,{className:"mt-4",label:(0,t.jsxs)("span",{children:["Reset Budget"," ",(0,t.jsx)(T.Tooltip,{title:"How often the budget should reset. For example, setting 'daily' will reset the budget every 24 hours",children:(0,t.jsx)(c.InfoCircleOutlined,{style:{marginLeft:"4px"}})})]}),name:"budget_duration",help:`Team Reset Budget: ${e?.budget_duration!==null&&e?.budget_duration!==void 0?e?.budget_duration:"None"}`,children:(0,t.jsx)(P.default,{onChange:e=>eN.setFieldValue("budget_duration",e)})}),(0,t.jsx)(b.Form.Item,{className:"mt-4",label:(0,t.jsxs)("span",{children:["Tokens per minute Limit (TPM)"," ",(0,t.jsx)(T.Tooltip,{title:"Maximum number of tokens this key can process per minute. Helps control usage and costs",children:(0,t.jsx)(c.InfoCircleOutlined,{style:{marginLeft:"4px"}})})]}),name:"tpm_limit",help:`TPM cannot exceed team TPM limit: ${e?.tpm_limit!==null&&e?.tpm_limit!==void 0?e?.tpm_limit:"unlimited"}`,rules:[{validator:async(t,s)=>{if(s&&e&&null!==e.tpm_limit&&s>e.tpm_limit)throw Error(`TPM limit cannot exceed team TPM limit: ${e.tpm_limit}`)}}],children:(0,t.jsx)(et.default,{step:1,width:400})}),(0,t.jsx)(G.default,{type:"tpm",name:"tpm_limit_type",className:"mt-4",initialValue:null,form:eN,showDetailedDescriptions:!0}),(0,t.jsx)(b.Form.Item,{className:"mt-4",label:(0,t.jsxs)("span",{children:["Requests per minute Limit (RPM)"," ",(0,t.jsx)(T.Tooltip,{title:"Maximum number of API requests this key can make per minute. Helps prevent abuse and manage load",children:(0,t.jsx)(c.InfoCircleOutlined,{style:{marginLeft:"4px"}})})]}),name:"rpm_limit",help:`RPM cannot exceed team RPM limit: ${e?.rpm_limit!==null&&e?.rpm_limit!==void 0?e?.rpm_limit:"unlimited"}`,rules:[{validator:async(t,s)=>{if(s&&e&&null!==e.rpm_limit&&s>e.rpm_limit)throw Error(`RPM limit cannot exceed team RPM limit: ${e.rpm_limit}`)}}],children:(0,t.jsx)(et.default,{step:1,width:400})}),(0,t.jsx)(G.default,{type:"rpm",name:"rpm_limit_type",className:"mt-4",initialValue:null,form:eN,showDetailedDescriptions:!0}),(0,t.jsx)(b.Form.Item,{label:(0,t.jsxs)("span",{children:["Guardrails"," ",(0,t.jsx)(T.Tooltip,{title:"Apply safety guardrails to this key to filter content or enforce policies",children:(0,t.jsx)("a",{href:"https://docs.litellm.ai/docs/proxy/guardrails/quick_start",target:"_blank",rel:"noopener noreferrer",onClick:e=>e.stopPropagation(),children:(0,t.jsx)(c.InfoCircleOutlined,{style:{marginLeft:"4px"}})})})]}),name:"guardrails",className:"mt-4",help:ep?"Select existing guardrails or enter new ones":"Premium feature - Upgrade to set guardrails by key",children:(0,t.jsx)(k.Select,{mode:"tags",style:{width:"100%"},disabled:!ep,placeholder:ep?"Select or enter guardrails":"Premium feature - Upgrade to set guardrails by key",options:eG.map(e=>({value:e,label:e}))})}),(0,t.jsx)(b.Form.Item,{label:(0,t.jsxs)("span",{children:["Disable Global Guardrails"," ",(0,t.jsx)(T.Tooltip,{title:"When enabled, this key will bypass any guardrails configured to run on every request (global guardrails)",children:(0,t.jsx)("a",{href:"https://docs.litellm.ai/docs/proxy/guardrails/quick_start",target:"_blank",rel:"noopener noreferrer",onClick:e=>e.stopPropagation(),children:(0,t.jsx)(c.InfoCircleOutlined,{style:{marginLeft:"4px"}})})})]}),name:"disable_global_guardrails",className:"mt-4",valuePropName:"checked",help:ep?"Bypass global guardrails for this key":"Premium feature - Upgrade to disable global guardrails by key",children:(0,t.jsx)(S.Switch,{disabled:!ep,checkedChildren:"Yes",unCheckedChildren:"No"})}),(0,t.jsx)(b.Form.Item,{label:(0,t.jsxs)("span",{children:["Policies"," ",(0,t.jsx)(T.Tooltip,{title:"Apply policies to this key to control guardrails and other settings",children:(0,t.jsx)("a",{href:"https://docs.litellm.ai/docs/proxy/guardrails/guardrail_policies",target:"_blank",rel:"noopener noreferrer",onClick:e=>e.stopPropagation(),children:(0,t.jsx)(c.InfoCircleOutlined,{style:{marginLeft:"4px"}})})})]}),name:"policies",className:"mt-4",help:em?"Select existing policies or enter new ones":"Premium feature - Upgrade to set policies by key",children:(0,t.jsx)(k.Select,{mode:"tags",style:{width:"100%"},disabled:!em,placeholder:em?"Select or enter policies":"Premium feature - Upgrade to set policies by key",options:eK.map(e=>({value:e,label:e}))})}),(0,t.jsx)(b.Form.Item,{label:(0,t.jsxs)("span",{children:["Prompts"," ",(0,t.jsx)(T.Tooltip,{title:"Allow this key to use specific prompt templates",children:(0,t.jsx)("a",{href:"https://docs.litellm.ai/docs/proxy/prompt_management",target:"_blank",rel:"noopener noreferrer",onClick:e=>e.stopPropagation(),children:(0,t.jsx)(c.InfoCircleOutlined,{style:{marginLeft:"4px"}})})})]}),name:"prompts",className:"mt-4",help:em?"Select existing prompts or enter new ones":"Premium feature - Upgrade to set prompts by key",children:(0,t.jsx)(k.Select,{mode:"tags",style:{width:"100%"},disabled:!em,placeholder:em?"Select or enter prompts":"Premium feature - Upgrade to set prompts by key",options:eU.map(e=>({value:e,label:e}))})}),(0,t.jsx)(b.Form.Item,{label:(0,t.jsxs)("span",{children:["Access Groups"," ",(0,t.jsx)(T.Tooltip,{title:"Assign access groups to this key. Access groups control which models, MCP servers, and agents this key can use",children:(0,t.jsx)(c.InfoCircleOutlined,{style:{marginLeft:"4px"}})})]}),name:"access_group_ids",className:"mt-4",help:"Select access groups to assign to this key",children:(0,t.jsx)(M.default,{placeholder:"Select access groups (optional)"})}),(0,t.jsx)(b.Form.Item,{label:(0,t.jsxs)("span",{children:["Allowed Pass Through Routes"," ",(0,t.jsx)(T.Tooltip,{title:"Allow this key to use specific pass through routes",children:(0,t.jsx)("a",{href:"https://docs.litellm.ai/docs/proxy/pass_through",target:"_blank",rel:"noopener noreferrer",onClick:e=>e.stopPropagation(),children:(0,t.jsx)(c.InfoCircleOutlined,{style:{marginLeft:"4px"}})})})]}),name:"allowed_passthrough_routes",className:"mt-4",help:em?"Select existing pass through routes or enter new ones":"Premium feature - Upgrade to set pass through routes by key",children:(0,t.jsx)(B.default,{onChange:e=>eN.setFieldValue("allowed_passthrough_routes",e),value:eN.getFieldValue("allowed_passthrough_routes"),accessToken:ec,placeholder:em?"Select or enter pass through routes":"Premium feature - Upgrade to set pass through routes by key",disabled:!em,teamId:eQ?eQ.team_id:null})}),(0,t.jsx)(b.Form.Item,{label:(0,t.jsxs)("span",{children:["Allowed Vector Stores"," ",(0,t.jsx)(T.Tooltip,{title:"Select which vector stores this key can access. If none selected, the key will have access to all available vector stores",children:(0,t.jsx)(c.InfoCircleOutlined,{style:{marginLeft:"4px"}})})]}),name:"allowed_vector_store_ids",className:"mt-4",help:"Select vector stores this key can access. Leave empty for access to all vector stores",children:(0,t.jsx)(es.default,{onChange:e=>eN.setFieldValue("allowed_vector_store_ids",e),value:eN.getFieldValue("allowed_vector_store_ids"),accessToken:ec,placeholder:"Select vector stores (optional)"})}),(0,t.jsx)(b.Form.Item,{label:(0,t.jsxs)("span",{children:["Metadata"," ",(0,t.jsx)(T.Tooltip,{title:"JSON object with additional information about this key. Used for tracking or custom logic",children:(0,t.jsx)(c.InfoCircleOutlined,{style:{marginLeft:"4px"}})})]}),name:"metadata",className:"mt-4",children:(0,t.jsx)(v.Input.TextArea,{rows:4,placeholder:"Enter metadata as JSON"})}),(0,t.jsx)(b.Form.Item,{label:(0,t.jsxs)("span",{children:["Tags"," ",(0,t.jsx)(T.Tooltip,{title:"Tags for tracking spend and/or doing tag-based routing. Used for analytics and filtering",children:(0,t.jsx)(c.InfoCircleOutlined,{style:{marginLeft:"4px"}})})]}),name:"tags",className:"mt-4",help:"Tags for tracking spend and/or doing tag-based routing.",children:(0,t.jsx)(k.Select,{mode:"tags",style:{width:"100%"},placeholder:"Select or enter tags",tokenSeparators:[","],options:ev})}),(0,t.jsxs)(u.Accordion,{className:"mt-4 mb-4",children:[(0,t.jsx)(p.AccordionHeader,{children:(0,t.jsx)("b",{children:"MCP Settings"})}),(0,t.jsxs)(m.AccordionBody,{children:[(0,t.jsx)(b.Form.Item,{label:(0,t.jsxs)("span",{children:["Allowed MCP Servers"," ",(0,t.jsx)(T.Tooltip,{title:"Select which MCP servers or access groups this key can access",children:(0,t.jsx)(c.InfoCircleOutlined,{style:{marginLeft:"4px"}})})]}),name:"allowed_mcp_servers_and_groups",help:"Select MCP servers or access groups this key can access",children:(0,t.jsx)(H.default,{onChange:e=>eN.setFieldValue("allowed_mcp_servers_and_groups",e),value:eN.getFieldValue("allowed_mcp_servers_and_groups"),accessToken:ec,teamId:eQ?.team_id??null,placeholder:"Select MCP servers or access groups (optional)"})}),(0,t.jsx)(b.Form.Item,{name:"mcp_tool_permissions",initialValue:{},hidden:!0,children:(0,t.jsx)(v.Input,{type:"hidden"})}),(0,t.jsx)(b.Form.Item,{noStyle:!0,shouldUpdate:(e,t)=>e.allowed_mcp_servers_and_groups!==t.allowed_mcp_servers_and_groups||e.mcp_tool_permissions!==t.mcp_tool_permissions,children:()=>(0,t.jsx)("div",{className:"mt-6",children:(0,t.jsx)(Q.default,{accessToken:ec,selectedServers:eN.getFieldValue("allowed_mcp_servers_and_groups")?.servers||[],toolPermissions:eN.getFieldValue("mcp_tool_permissions")||{},onChange:e=>eN.setFieldsValue({mcp_tool_permissions:e})})})})]})]}),(0,t.jsxs)(u.Accordion,{className:"mt-4 mb-4",children:[(0,t.jsx)(p.AccordionHeader,{children:(0,t.jsx)("b",{children:"Agent Settings"})}),(0,t.jsx)(m.AccordionBody,{children:(0,t.jsx)(b.Form.Item,{label:(0,t.jsxs)("span",{children:["Allowed Agents"," ",(0,t.jsx)(T.Tooltip,{title:"Select which agents or access groups this key can access",children:(0,t.jsx)(c.InfoCircleOutlined,{style:{marginLeft:"4px"}})})]}),name:"allowed_agents_and_groups",help:"Select agents or access groups this key can access",children:(0,t.jsx)(F.default,{onChange:e=>eN.setFieldValue("allowed_agents_and_groups",e),value:eN.getFieldValue("allowed_agents_and_groups"),accessToken:ec,placeholder:"Select agents or access groups (optional)"})})})]}),em?(0,t.jsxs)(u.Accordion,{className:"mt-4 mb-4",children:[(0,t.jsx)(p.AccordionHeader,{children:(0,t.jsx)("b",{children:"Logging Settings"})}),(0,t.jsx)(m.AccordionBody,{children:(0,t.jsx)("div",{className:"mt-4",children:(0,t.jsx)(R.default,{value:eW,onChange:eH,premiumUser:!0,disabledCallbacks:ta,onDisabledCallbacksChange:tl})})})]}):(0,t.jsx)(T.Tooltip,{title:(0,t.jsxs)("span",{children:["Key-level logging settings is an enterprise feature, get in touch -",(0,t.jsx)("a",{href:"https://www.litellm.ai/enterprise",target:"_blank",children:"https://www.litellm.ai/enterprise"})]}),placement:"top",children:(0,t.jsxs)("div",{style:{position:"relative"},children:[(0,t.jsx)("div",{style:{opacity:.5},children:(0,t.jsxs)(u.Accordion,{className:"mt-4 mb-4",children:[(0,t.jsx)(p.AccordionHeader,{children:(0,t.jsx)("b",{children:"Logging Settings"})}),(0,t.jsx)(m.AccordionBody,{children:(0,t.jsx)("div",{className:"mt-4",children:(0,t.jsx)(R.default,{value:eW,onChange:eH,premiumUser:!1,disabledCallbacks:ta,onDisabledCallbacksChange:tl})})})]})}),(0,t.jsx)("div",{style:{position:"absolute",inset:0,cursor:"not-allowed"}})]})}),(0,t.jsxs)(u.Accordion,{className:"mt-4 mb-4",children:[(0,t.jsx)(p.AccordionHeader,{children:(0,t.jsx)("b",{children:"Router Settings"})}),(0,t.jsx)(m.AccordionBody,{children:(0,t.jsx)("div",{className:"mt-4 w-full",children:(0,t.jsx)(D.default,{accessToken:ec||"",value:tp||void 0,onChange:tg,modelData:eL.length>0?{data:eL.map(e=>({model_name:e}))}:void 0},th)})})]},`router-settings-accordion-${th}`),(0,t.jsxs)(u.Accordion,{className:"mt-4 mb-4",children:[(0,t.jsx)(p.AccordionHeader,{children:(0,t.jsx)("b",{children:"Model Aliases"})}),(0,t.jsx)(m.AccordionBody,{children:(0,t.jsxs)("div",{className:"mt-4",children:[(0,t.jsx)(y.Text,{className:"text-sm text-gray-600 mb-4",children:"Create custom aliases for models that can be used in API calls. This allows you to create shortcuts for specific models."}),(0,t.jsx)(V.default,{accessToken:ec,initialModelAliases:tn,onAliasUpdate:to,showExampleConfig:!1})]})})]}),(0,t.jsxs)(u.Accordion,{className:"mt-4 mb-4",children:[(0,t.jsx)(p.AccordionHeader,{children:(0,t.jsx)("b",{children:"Key Lifecycle"})}),(0,t.jsx)(m.AccordionBody,{children:(0,t.jsx)("div",{className:"mt-4",children:(0,t.jsx)($.default,{form:eN,autoRotationEnabled:tc,onAutoRotationChange:td,rotationInterval:tu,onRotationIntervalChange:tm,isCreateMode:!0})})}),(0,t.jsx)(b.Form.Item,{name:"duration",hidden:!0,initialValue:null,children:(0,t.jsx)(v.Input,{})})]}),(0,t.jsxs)(u.Accordion,{className:"mt-4 mb-4",children:[(0,t.jsx)(p.AccordionHeader,{children:(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("b",{children:"Advanced Settings"}),(0,t.jsx)(T.Tooltip,{title:(0,t.jsxs)("span",{children:["Learn more about advanced settings in our"," ",(0,t.jsx)("a",{href:Y.proxyBaseUrl?`${Y.proxyBaseUrl}/#/key%20management/generate_key_fn_key_generate_post`:"/#/key%20management/generate_key_fn_key_generate_post",target:"_blank",rel:"noopener noreferrer",className:"text-blue-400 hover:text-blue-300",children:"documentation"})]}),children:(0,t.jsx)(c.InfoCircleOutlined,{className:"text-gray-400 hover:text-gray-300 cursor-help"})})]})}),(0,t.jsx)(m.AccordionBody,{children:(0,t.jsx)(E.default,{schemaComponent:"GenerateKeyRequest",form:eN,excludedFields:["key_alias","team_id","organization_id","models","duration","metadata","tags","guardrails","max_budget","budget_duration","tpm_limit","rpm_limit",...eb?["key"]:[]]})})]})]})]})}),(0,t.jsx)("div",{style:{textAlign:"right",marginTop:"10px"},children:(0,t.jsx)(j.Button,{htmlType:"submit",disabled:tw,style:{opacity:tw?.5:1},children:"Create Key"})})]})}),e1&&(0,t.jsx)(w.Modal,{title:"Create New User",open:e1,onCancel:()=>e2(!1),footer:null,width:800,children:(0,t.jsx)(q.CreateUserButton,{userID:ed,accessToken:ec,teams:X,possibleUIRoles:e3,onUserCreated:e=>{e5(e),eN.setFieldsValue({user_id:e}),e2(!1)},isEmbedded:!0})}),eC&&(0,t.jsx)(w.Modal,{open:ek,onOk:tb,onCancel:tv,footer:null,children:(0,t.jsxs)(x.Grid,{numItems:1,className:"gap-2 w-full",children:[(0,t.jsx)(_.Title,{children:"Save your Key"}),(0,t.jsx)(h.Col,{numColSpan:1,children:null!=eC?(0,t.jsx)(ee,{apiKey:eC}):(0,t.jsx)(y.Text,{children:"Key being created, this might take 30s"})})]})})]})},"fetchTeamModels",0,el,"fetchUserModels",0,er],702597)}]); \ No newline at end of file diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/13670846207c3e16.js b/litellm/proxy/_experimental/out/_next/static/chunks/13670846207c3e16.js deleted file mode 100644 index c0394521a6..0000000000 --- a/litellm/proxy/_experimental/out/_next/static/chunks/13670846207c3e16.js +++ /dev/null @@ -1 +0,0 @@ -(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,309426,e=>{"use strict";var t=e.i(290571),r=e.i(444755),n=e.i(673706),i=e.i(271645),s=e.i(46757);let a=(0,n.makeClassName)("Col"),o=i.default.forwardRef((e,n)=>{let o,l,d,c,{numColSpan:u=1,numColSpanSm:h,numColSpanMd:f,numColSpanLg:p,children:m,className:g}=e,y=(0,t.__rest)(e,["numColSpan","numColSpanSm","numColSpanMd","numColSpanLg","children","className"]),b=(e,t)=>e&&Object.keys(t).includes(String(e))?t[e]:"";return i.default.createElement("div",Object.assign({ref:n,className:(0,r.tremorTwMerge)(a("root"),(o=b(u,s.colSpan),l=b(h,s.colSpanSm),d=b(f,s.colSpanMd),c=b(p,s.colSpanLg),(0,r.tremorTwMerge)(o,l,d,c)),g)},y),m)});o.displayName="Col",e.s(["Col",()=>o],309426)},519756,e=>{"use strict";e.i(247167);var t=e.i(931067),r=e.i(271645);let n={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M400 317.7h73.9V656c0 4.4 3.6 8 8 8h60c4.4 0 8-3.6 8-8V317.7H624c6.7 0 10.4-7.7 6.3-12.9L518.3 163a8 8 0 00-12.6 0l-112 141.7c-4.1 5.3-.4 13 6.3 13zM878 626h-60c-4.4 0-8 3.6-8 8v154H214V634c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8v198c0 17.7 14.3 32 32 32h684c17.7 0 32-14.3 32-32V634c0-4.4-3.6-8-8-8z"}}]},name:"upload",theme:"outlined"};var i=e.i(9583),s=r.forwardRef(function(e,s){return r.createElement(i.default,(0,t.default)({},e,{ref:s,icon:n}))});e.s(["UploadOutlined",0,s],519756)},981339,e=>{"use strict";var t=e.i(185793);e.s(["Skeleton",()=>t.default])},500330,e=>{"use strict";var t=e.i(727749);function r(e,t){let r=structuredClone(e);for(let[e,n]of Object.entries(t))e in r&&(r[e]=n);return r}let n=(e,t=0,r=!1,n=!0)=>{if(null==e||!Number.isFinite(e)||0===e&&!n)return"-";let i={minimumFractionDigits:t,maximumFractionDigits:t};if(!r)return e.toLocaleString("en-US",i);let s=e<0?"-":"",a=Math.abs(e),o=a,l="";return a>=1e6?(o=a/1e6,l="M"):a>=1e3&&(o=a/1e3,l="K"),`${s}${o.toLocaleString("en-US",i)}${l}`},i=async(e,r="Copied to clipboard")=>{if(!e)return!1;if(!navigator||!navigator.clipboard||!navigator.clipboard.writeText)return s(e,r);try{return await navigator.clipboard.writeText(e),t.default.success(r),!0}catch(t){return console.error("Clipboard API failed: ",t),s(e,r)}},s=(e,r)=>{try{let n=document.createElement("textarea");n.value=e,n.style.position="fixed",n.style.left="-999999px",n.style.top="-999999px",n.setAttribute("readonly",""),document.body.appendChild(n),n.focus(),n.select();let i=document.execCommand("copy");if(document.body.removeChild(n),i)return t.default.success(r),!0;throw Error("execCommand failed")}catch(e){return t.default.fromBackend("Failed to copy to clipboard"),console.error("Failed to copy: ",e),!1}};e.s(["copyToClipboard",0,i,"formatNumberWithCommas",0,n,"getSpendString",0,(e,t=6)=>{if(null==e||!Number.isFinite(e)||0===e)return"-";let r=n(e,t,!1,!1);if(0===Number(r.replace(/,/g,""))){let e=(1/10**t).toFixed(t);return`< $${e}`}return`$${r}`},"updateExistingKeys",()=>r])},663435,152473,e=>{"use strict";var t=e.i(843476),r=e.i(271645),n=e.i(199133),i=e.i(898586),s=e.i(56456);let a={enabled:!0,leading:!1,trailing:!0,wait:0,onExecute:()=>{}};class o{constructor(e,t){this.fn=e,this._canLeadingExecute=!0,this._isPending=!1,this._executionCount=0,this._options={...a,...t}}setOptions(e){return this._options={...this._options,...e},this._options.enabled||(this._isPending=!1),this._options}getOptions(){return this._options}maybeExecute(...e){this._options.leading&&this._canLeadingExecute&&(this.executeFunction(...e),this._canLeadingExecute=!1),(this._options.leading||this._options.trailing)&&(this._isPending=!0),this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=setTimeout(()=>{this._canLeadingExecute=!0,this._isPending=!1,this._options.trailing&&this.executeFunction(...e)},this._options.wait)}executeFunction(...e){this._options.enabled&&(this.fn(...e),this._executionCount++,this._options.onExecute(this))}cancel(){this._timeoutId&&(clearTimeout(this._timeoutId),this._canLeadingExecute=!0,this._isPending=!1)}getExecutionCount(){return this._executionCount}getIsPending(){return this._options.enabled&&this._isPending}}function l(e,t){let[n,i]=(0,r.useState)(e),s=function(e,t){let[n]=(0,r.useState)(()=>{var r;return Object.getOwnPropertyNames(Object.getPrototypeOf(r=new o(e,t))).filter(e=>"function"==typeof r[e]).reduce((e,t)=>{let n=r[t];return"function"==typeof n&&(e[t]=n.bind(r)),e},{})});return n.setOptions(t),n}(i,t);return[n,s.maybeExecute,s]}e.s(["useDebouncedState",()=>l],152473);var d=e.i(785242);let{Text:c}=i.Typography;e.s(["default",0,({value:e,onChange:i,onTeamSelect:a,disabled:o,organizationId:u,pageSize:h=20})=>{let[f,p]=(0,r.useState)(""),[m,g]=l("",{wait:300}),{data:y,fetchNextPage:b,hasNextPage:x,isFetchingNextPage:v,isLoading:_}=(0,d.useInfiniteTeams)(h,m||void 0,u),k=(0,r.useMemo)(()=>{if(!y?.pages)return[];let e=new Set,t=[];for(let r of y.pages)for(let n of r.teams)e.has(n.team_id)||(e.add(n.team_id),t.push(n));return t},[y]);return(0,t.jsx)(n.Select,{showSearch:!0,placeholder:"Search or select a team",value:e||void 0,onChange:e=>{i?.(e??""),a&&a(e?k.find(t=>t.team_id===e)??null:null)},disabled:o,allowClear:!0,filterOption:!1,onSearch:e=>{p(e),g(e)},searchValue:f,onPopupScroll:e=>{let t=e.currentTarget;(t.scrollTop+t.clientHeight)/t.scrollHeight>=.8&&x&&!v&&b()},loading:_,notFoundContent:_?(0,t.jsx)(s.LoadingOutlined,{spin:!0}):"No teams found",popupRender:e=>(0,t.jsxs)(t.Fragment,{children:[e,v&&(0,t.jsx)("div",{style:{textAlign:"center",padding:8},children:(0,t.jsx)(s.LoadingOutlined,{spin:!0})})]}),children:k.map(e=>(0,t.jsxs)(n.Select.Option,{value:e.team_id,children:[(0,t.jsx)("span",{className:"font-medium",children:e.team_alias})," ",(0,t.jsxs)(c,{type:"secondary",children:["(",e.team_id,")"]})]},e.team_id))})}],663435)},743151,(e,t,r)=>{"use strict";function n(e){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}Object.defineProperty(r,"__esModule",{value:!0}),r.CopyToClipboard=void 0;var i=o(e.r(271645)),s=o(e.r(844343)),a=["text","onCopy","options","children"];function o(e){return e&&e.__esModule?e:{default:e}}function l(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function d(e){for(var t=1;t=0||(i[r]=e[r]);return i}(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(n=0;n=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(i[r]=e[r])}return i}(e,a),n=i.default.Children.only(t);return i.default.cloneElement(n,d(d({},r),{},{onClick:this.onClick}))}}],function(e,t){for(var r=0;r{"use strict";var n=e.r(743151).CopyToClipboard;n.CopyToClipboard=n,t.exports=n},59935,(e,t,r)=>{var n;let i;e.e,n=function e(){var t,r="u">typeof self?self:"u">typeof window?window:void 0!==r?r:{},n=!r.document&&!!r.postMessage,i=r.IS_PAPA_WORKER||!1,s={},a=0,o={};function l(e){this._handle=null,this._finished=!1,this._completed=!1,this._halted=!1,this._input=null,this._baseIndex=0,this._partialLine="",this._rowCount=0,this._start=0,this._nextChunk=null,this.isFirstChunk=!0,this._completeResults={data:[],errors:[],meta:{}},(function(e){var t=x(e);t.chunkSize=parseInt(t.chunkSize),e.step||e.chunk||(t.chunkSize=null),this._handle=new f(t),(this._handle.streamer=this)._config=t}).call(this,e),this.parseChunk=function(e,t){var n=parseInt(this._config.skipFirstNLines)||0;if(this.isFirstChunk&&0=this._config.preview,i)r.postMessage({results:s,workerId:o.WORKER_ID,finished:n});else if(_(this._config.chunk)&&!t){if(this._config.chunk(s,this._handle),this._handle.paused()||this._handle.aborted())return void(this._halted=!0);this._completeResults=s=void 0}return this._config.step||this._config.chunk||(this._completeResults.data=this._completeResults.data.concat(s.data),this._completeResults.errors=this._completeResults.errors.concat(s.errors),this._completeResults.meta=s.meta),this._completed||!n||!_(this._config.complete)||s&&s.meta.aborted||(this._config.complete(this._completeResults,this._input),this._completed=!0),n||s&&s.meta.paused||this._nextChunk(),s}this._halted=!0},this._sendError=function(e){_(this._config.error)?this._config.error(e):i&&this._config.error&&r.postMessage({workerId:o.WORKER_ID,error:e,finished:!1})}}function d(e){var t;(e=e||{}).chunkSize||(e.chunkSize=o.RemoteChunkSize),l.call(this,e),this._nextChunk=n?function(){this._readChunk(),this._chunkLoaded()}:function(){this._readChunk()},this.stream=function(e){this._input=e,this._nextChunk()},this._readChunk=function(){if(this._finished)this._chunkLoaded();else{if(t=new XMLHttpRequest,this._config.withCredentials&&(t.withCredentials=this._config.withCredentials),n||(t.onload=v(this._chunkLoaded,this),t.onerror=v(this._chunkError,this)),t.open(this._config.downloadRequestBody?"POST":"GET",this._input,!n),this._config.downloadRequestHeaders){var e,r,i=this._config.downloadRequestHeaders;for(r in i)t.setRequestHeader(r,i[r])}this._config.chunkSize&&(e=this._start+this._config.chunkSize-1,t.setRequestHeader("Range","bytes="+this._start+"-"+e));try{t.send(this._config.downloadRequestBody)}catch(e){this._chunkError(e.message)}n&&0===t.status&&this._chunkError()}},this._chunkLoaded=function(){let e;4===t.readyState&&(t.status<200||400<=t.status?this._chunkError():(this._start+=this._config.chunkSize||t.responseText.length,this._finished=!this._config.chunkSize||this._start>=(null!==(e=(e=t).getResponseHeader("Content-Range"))?parseInt(e.substring(e.lastIndexOf("/")+1)):-1),this.parseChunk(t.responseText)))},this._chunkError=function(e){e=t.statusText||e,this._sendError(Error(e))}}function c(e){(e=e||{}).chunkSize||(e.chunkSize=o.LocalChunkSize),l.call(this,e);var t,r,n="u">typeof FileReader;this.stream=function(e){this._input=e,r=e.slice||e.webkitSlice||e.mozSlice,n?((t=new FileReader).onload=v(this._chunkLoaded,this),t.onerror=v(this._chunkError,this)):t=new FileReaderSync,this._nextChunk()},this._nextChunk=function(){this._finished||this._config.preview&&!(this._rowCount=this._input.size,this.parseChunk(e.target.result)},this._chunkError=function(){this._sendError(t.error)}}function u(e){var t;l.call(this,e=e||{}),this.stream=function(e){return t=e,this._nextChunk()},this._nextChunk=function(){var e,r;if(!this._finished)return t=(e=this._config.chunkSize)?(r=t.substring(0,e),t.substring(e)):(r=t,""),this._finished=!t,this.parseChunk(r)}}function h(e){l.call(this,e=e||{});var t=[],r=!0,n=!1;this.pause=function(){l.prototype.pause.apply(this,arguments),this._input.pause()},this.resume=function(){l.prototype.resume.apply(this,arguments),this._input.resume()},this.stream=function(e){this._input=e,this._input.on("data",this._streamData),this._input.on("end",this._streamEnd),this._input.on("error",this._streamError)},this._checkIsFinished=function(){n&&1===t.length&&(this._finished=!0)},this._nextChunk=function(){this._checkIsFinished(),t.length?this.parseChunk(t.shift()):r=!0},this._streamData=v(function(e){try{t.push("string"==typeof e?e:e.toString(this._config.encoding)),r&&(r=!1,this._checkIsFinished(),this.parseChunk(t.shift()))}catch(e){this._streamError(e)}},this),this._streamError=v(function(e){this._streamCleanUp(),this._sendError(e)},this),this._streamEnd=v(function(){this._streamCleanUp(),n=!0,this._streamData("")},this),this._streamCleanUp=v(function(){this._input.removeListener("data",this._streamData),this._input.removeListener("end",this._streamEnd),this._input.removeListener("error",this._streamError)},this)}function f(e){var t,r,n,i,s=/^\s*-?(\d+\.?|\.\d+|\d+\.\d+)([eE][-+]?\d+)?\s*$/,a=/^((\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\.\d+([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z)))$/,l=this,d=0,c=0,u=!1,h=!1,f=[],g={data:[],errors:[],meta:{}};function y(t){return"greedy"===e.skipEmptyLines?""===t.join("").trim():1===t.length&&0===t[0].length}function b(){if(g&&n&&(k("Delimiter","UndetectableDelimiter","Unable to auto-detect delimiting character; defaulted to '"+o.DefaultDelimiter+"'"),n=!1),e.skipEmptyLines&&(g.data=g.data.filter(function(e){return!y(e)})),v()){if(g)if(Array.isArray(g.data[0])){for(var t,r=0;v()&&r(e.dynamicTypingFunction&&void 0===e.dynamicTyping[t]&&(e.dynamicTyping[t]=e.dynamicTypingFunction(t)),!0===(e.dynamicTyping[t]||e.dynamicTyping))?"true"===r||"TRUE"===r||"false"!==r&&"FALSE"!==r&&((e=>{if(s.test(e)&&-0x20000000000000<(e=parseFloat(e))&&e<0x20000000000000)return 1})(r)?parseFloat(r):a.test(r)?new Date(r):""===r?null:r):r)(o=e.header?i>=f.length?"__parsed_extra":f[i]:o,l=e.transform?e.transform(l,o):l);"__parsed_extra"===o?(n[o]=n[o]||[],n[o].push(l)):n[o]=l}return e.header&&(i>f.length?k("FieldMismatch","TooManyFields","Too many fields: expected "+f.length+" fields but parsed "+i,c+r):ie.preview?r.abort():(g.data=g.data[0],i(g,l))))}),this.parse=function(i,s,a){var l=e.quoteChar||'"',l=(e.newline||(e.newline=this.guessLineEndings(i,l)),n=!1,e.delimiter?_(e.delimiter)&&(e.delimiter=e.delimiter(i),g.meta.delimiter=e.delimiter):((l=((t,r,n,i,s)=>{var a,l,d,c;s=s||[","," ","|",";",o.RECORD_SEP,o.UNIT_SEP];for(var u=0;u=r.length/2?"\r\n":"\r"}}function p(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function m(e){var t=(e=e||{}).delimiter,r=e.newline,n=e.comments,i=e.step,s=e.preview,a=e.fastMode,l=null,d=!1,c=null==e.quoteChar?'"':e.quoteChar,u=c;if(void 0!==e.escapeChar&&(u=e.escapeChar),("string"!=typeof t||-1=s)return A(!0);break}j.push({type:"Quotes",code:"InvalidQuotes",message:"Trailing quote on quoted field is malformed",row:w.length,index:h}),M++}}else if(n&&0===C.length&&o.substring(h,h+v)===n){if(-1===R)return A();h=R+x,R=o.indexOf(r,h),O=o.indexOf(t,h)}else if(-1!==O&&(O=s)return A(!0)}return D();function L(e){w.push(e),S=h}function F(e){return -1!==e&&(e=o.substring(M+1,e))&&""===e.trim()?e.length:0}function D(e){return g||(void 0===e&&(e=o.substring(h)),C.push(e),h=y,L(C),k&&q()),A()}function I(e){h=e,L(C),C=[],R=o.indexOf(r,h)}function A(n){if(e.header&&!m&&w.length&&!d){var i=w[0],s=Object.create(null),a=new Set(i);let t=!1;for(let r=0;r{if("object"==typeof t){if("string"!=typeof t.delimiter||o.BAD_DELIMITERS.filter(function(e){return -1!==t.delimiter.indexOf(e)}).length||(i=t.delimiter),("boolean"==typeof t.quotes||"function"==typeof t.quotes||Array.isArray(t.quotes))&&(r=t.quotes),"boolean"!=typeof t.skipEmptyLines&&"string"!=typeof t.skipEmptyLines||(d=t.skipEmptyLines),"string"==typeof t.newline&&(s=t.newline),"string"==typeof t.quoteChar&&(a=t.quoteChar),"boolean"==typeof t.header&&(n=t.header),Array.isArray(t.columns)){if(0===t.columns.length)throw Error("Option columns is empty");c=t.columns}void 0!==t.escapeChar&&(l=t.escapeChar+a),t.escapeFormulae instanceof RegExp?u=t.escapeFormulae:"boolean"==typeof t.escapeFormulae&&t.escapeFormulae&&(u=/^[=+\-@\t\r].*$/)}})(),RegExp(p(a),"g"));if("string"==typeof e&&(e=JSON.parse(e)),Array.isArray(e)){if(!e.length||Array.isArray(e[0]))return f(null,e,d);if("object"==typeof e[0])return f(c||Object.keys(e[0]),e,d)}else if("object"==typeof e)return"string"==typeof e.data&&(e.data=JSON.parse(e.data)),Array.isArray(e.data)&&(e.fields||(e.fields=e.meta&&e.meta.fields||c),e.fields||(e.fields=Array.isArray(e.data[0])?e.fields:"object"==typeof e.data[0]?Object.keys(e.data[0]):[]),Array.isArray(e.data[0])||"object"==typeof e.data[0]||(e.data=[e.data])),f(e.fields||[],e.data||[],d);throw Error("Unable to serialize unrecognized input");function f(e,t,r){var a="",o=("string"==typeof e&&(e=JSON.parse(e)),"string"==typeof t&&(t=JSON.parse(t)),Array.isArray(e)&&0{for(var r=0;r{"use strict";var t=e.i(631171);e.s(["ChevronDownIcon",()=>t.default])},246349,e=>{"use strict";let t=(0,e.i(475254).default)("chevron-right",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);e.s(["default",()=>t])},91739,e=>{"use strict";var t=e.i(544195);e.s(["Radio",()=>t.default])},988297,e=>{"use strict";var t=e.i(271645);let r=t.forwardRef(function(e,r){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:r},e),t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 4v16m8-8H4"}))});e.s(["PlusIcon",0,r],988297)},797672,e=>{"use strict";var t=e.i(271645);let r=t.forwardRef(function(e,r){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:r},e),t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15.232 5.232l3.536 3.536m-2.036-5.036a2.5 2.5 0 113.536 3.536L6.5 21.036H3v-3.572L16.732 3.732z"}))});e.s(["PencilIcon",0,r],797672)},992619,e=>{"use strict";var t=e.i(843476),r=e.i(271645),n=e.i(779241),i=e.i(599724),s=e.i(199133),a=e.i(983561),o=e.i(689020);e.s(["default",0,({accessToken:e,value:l,placeholder:d="Select a Model",onChange:c,disabled:u=!1,style:h,className:f,showLabel:p=!0,labelText:m="Select Model"})=>{let[g,y]=(0,r.useState)(l),[b,x]=(0,r.useState)(!1),[v,_]=(0,r.useState)([]),k=(0,r.useRef)(null);return(0,r.useEffect)(()=>{y(l)},[l]),(0,r.useEffect)(()=>{e&&(async()=>{try{let t=await (0,o.fetchAvailableModels)(e);console.log("Fetched models for selector:",t),t.length>0&&_(t)}catch(e){console.error("Error fetching model info:",e)}})()},[e]),(0,t.jsxs)("div",{children:[p&&(0,t.jsxs)(i.Text,{className:"font-medium block mb-2 text-gray-700 flex items-center",children:[(0,t.jsx)(a.RobotOutlined,{className:"mr-2"})," ",m]}),(0,t.jsx)(s.Select,{value:g,placeholder:d,onChange:e=>{"custom"===e?(x(!0),y(void 0)):(x(!1),y(e),c&&c(e))},options:[...Array.from(new Set(v.map(e=>e.model_group))).map((e,t)=>({value:e,label:e,key:t})),{value:"custom",label:"Enter custom model",key:"custom"}],style:{width:"100%",...h},showSearch:!0,className:`rounded-md ${f||""}`,disabled:u}),b&&(0,t.jsx)(n.TextInput,{className:"mt-2",placeholder:"Enter custom model name",onValueChange:e=>{k.current&&clearTimeout(k.current),k.current=setTimeout(()=>{y(e),c&&c(e)},500)},disabled:u})]})}])},500727,699857,696609,531516,e=>{"use strict";var t=e.i(266027),r=e.i(243652),n=e.i(764205),i=e.i(135214);let s=(0,r.createQueryKeys)("mcpServers");e.s(["useMCPServers",0,e=>{let{accessToken:r}=(0,i.default)();return(0,t.useQuery)({queryKey:s.list(e?{filters:{teamId:e}}:void 0),queryFn:async()=>await (0,n.fetchMCPServers)(r,e),enabled:!!r})}],500727);let a=(0,r.createQueryKeys)("mcpToolsets");e.s(["useMCPToolsets",0,()=>{let{accessToken:e}=(0,i.default)();return(0,t.useQuery)({queryKey:a.list(),queryFn:async()=>await (0,n.fetchMCPToolsets)(e),enabled:!!e})}],699857);var o=e.i(843476),l=e.i(271645),d=e.i(536916),c=e.i(599724),u=e.i(409797),h=e.i(246349),h=h;let f=/\b(delete|remove|destroy|purge|drop|erase|unlink)\b/i,p=/\b(create|add|insert|new|post|submit|register|make|generate|write|upload)\b/i,m=/\b(update|edit|modify|change|patch|put|set|rename|move|transform)\b/i,g=/\b(get|read|list|fetch|search|find|query|retrieve|show|view|check|describe|info)\b/i;function y(e,t=""){let r=e.toLowerCase();if(g.test(r))return"read";if(f.test(r))return"delete";if(m.test(r))return"update";if(p.test(r))return"create";if(t){let e=t.toLowerCase();if(g.test(e))return"read";if(f.test(e))return"delete";if(m.test(e))return"update";if(p.test(e))return"create"}return"unknown"}function b(e){let t={read:[],create:[],update:[],delete:[],unknown:[]};for(let r of e)t[y(r.name,r.description)].push(r);return t}let x={read:{label:"Read",description:"Safe operations — fetch, list, search. No side effects.",risk:"low"},create:{label:"Create",description:"Add new resources — insert, upload, register.",risk:"medium"},update:{label:"Update",description:"Modify existing resources — edit, patch, rename.",risk:"medium"},delete:{label:"Delete",description:"Destructive operations — remove, purge, destroy.",risk:"high"},unknown:{label:"Other",description:"Operations that could not be automatically classified.",risk:"unknown"}};e.s(["CRUD_GROUP_META",0,x,"classifyToolOp",()=>y,"groupToolsByCrud",()=>b],696609);let v=["read","create","update","delete","unknown"],_={low:"bg-green-100 text-green-800",medium:"bg-yellow-100 text-yellow-800",high:"bg-red-100 text-red-800 font-semibold",unknown:"bg-gray-100 text-gray-700"},k={read:"border-green-200",create:"border-blue-200",update:"border-yellow-200",delete:"border-red-300",unknown:"border-gray-200"},w={read:"bg-green-50",create:"bg-blue-50",update:"bg-yellow-50",delete:"bg-red-50",unknown:"bg-gray-50"};e.s(["default",0,({tools:e,value:t,onChange:r,readOnly:n=!1,searchFilter:i=""})=>{let[s,a]=(0,l.useState)({read:!1,create:!1,update:!1,delete:!1,unknown:!0}),f=(0,l.useMemo)(()=>b(e),[e]),p=(0,l.useMemo)(()=>new Set(void 0===t?e.map(e=>e.name):t),[t,e]),m=e=>{if(n)return;let t=new Set(p);t.has(e)?t.delete(e):t.add(e),r(Array.from(t))};return 0===e.length?null:(0,o.jsx)("div",{className:"space-y-3",children:v.map(e=>{let t,l=f[e];if(0===l.length)return null;if(i){let e=i.toLowerCase();if(!l.some(t=>t.name.toLowerCase().includes(e)||(t.description??"").toLowerCase().includes(e)))return null}let g=x[e],y=(t=f[e]).length>0&&t.every(e=>p.has(e.name)),b=(e=>{let t=f[e];if(0===t.length)return!1;let r=t.filter(e=>p.has(e.name)).length;return r>0&&r{a(t=>({...t,[e]:!t[e]}))},children:[v?(0,o.jsx)(h.default,{className:"w-4 h-4 text-gray-500 flex-shrink-0"}):(0,o.jsx)(u.ChevronDownIcon,{className:"w-4 h-4 text-gray-500 flex-shrink-0"}),(0,o.jsx)("span",{className:"font-semibold text-gray-900 text-sm",children:g.label}),(0,o.jsx)("span",{className:`text-xs px-2 py-0.5 rounded-full ${_[g.risk]}`,children:"high"===g.risk?"High Risk":"medium"===g.risk?"Medium Risk":"low"===g.risk?"Safe":"Unclassified"}),(0,o.jsxs)("span",{className:"text-xs text-gray-500 ml-1",children:[l.filter(e=>p.has(e.name)).length,"/",l.length," allowed"]})]}),!n&&(0,o.jsxs)("div",{className:"flex items-center gap-2 ml-4",children:[(0,o.jsx)(c.Text,{className:"text-xs text-gray-500",children:y?"All on":b?"Partial":"All off"}),(0,o.jsx)(d.Checkbox,{checked:y,indeterminate:b,onChange:t=>((e,t)=>{if(n)return;let i=new Set(p);for(let r of f[e])t?i.add(r.name):i.delete(r.name);r(Array.from(i))})(e,t.target.checked),onClick:e=>e.stopPropagation()})]})]}),!v&&(0,o.jsx)("div",{className:"px-4 pt-2 pb-1 text-xs text-gray-500 bg-white border-b border-gray-100",children:g.description}),!v&&(0,o.jsx)("div",{className:"bg-white divide-y divide-gray-50",children:l.filter(e=>!i||e.name.toLowerCase().includes(i.toLowerCase())||(e.description??"").toLowerCase().includes(i.toLowerCase())).map(e=>{let t,r=(t=e.name,p.has(t));return(0,o.jsxs)("div",{className:`flex items-start gap-3 px-4 py-2.5 transition-colors hover:bg-gray-50 ${!n?"cursor-pointer":""} ${r?"":"opacity-60"}`,onClick:()=>m(e.name),children:[(0,o.jsx)(d.Checkbox,{checked:r,onChange:()=>m(e.name),disabled:n,onClick:e=>e.stopPropagation()}),(0,o.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,o.jsx)(c.Text,{className:"font-medium text-gray-900 text-sm",children:e.name}),e.description&&(0,o.jsx)(c.Text,{className:"text-xs text-gray-500 mt-0.5 leading-snug",children:e.description})]}),(0,o.jsx)("span",{className:`text-xs px-1.5 py-0.5 rounded flex-shrink-0 ${r?"bg-green-100 text-green-700":"bg-gray-100 text-gray-500"}`,children:r?"on":"off"})]},e.name)})})]},e)})})}],531516)},793130,e=>{"use strict";var t=e.i(290571),r=e.i(429427),n=e.i(371330),i=e.i(271645),s=e.i(394487),a=e.i(503269),o=e.i(214520),l=e.i(746725),d=e.i(914189),c=e.i(144279),u=e.i(294316),h=e.i(601893),f=e.i(140721),p=e.i(942803),m=e.i(233538),g=e.i(694421),y=e.i(700020),b=e.i(35889),x=e.i(998348),v=e.i(722678);let _=(0,i.createContext)(null);_.displayName="GroupContext";let k=i.Fragment,w=Object.assign((0,y.forwardRefWithAs)(function(e,t){var k;let w=(0,i.useId)(),j=(0,p.useProvidedId)(),C=(0,h.useDisabled)(),{id:S=j||`headlessui-switch-${w}`,disabled:E=C||!1,checked:N,defaultChecked:O,onChange:R,name:T,value:M,form:P,autoFocus:L=!1,...F}=e,D=(0,i.useContext)(_),[I,A]=(0,i.useState)(null),q=(0,i.useRef)(null),z=(0,u.useSyncRefs)(q,t,null===D?null:D.setSwitch,A),B=(0,o.useDefaultValue)(O),[U,$]=(0,a.useControllable)(N,R,null!=B&&B),K=(0,l.useDisposables)(),[H,W]=(0,i.useState)(!1),Q=(0,d.useEvent)(()=>{W(!0),null==$||$(!U),K.nextFrame(()=>{W(!1)})}),V=(0,d.useEvent)(e=>{if((0,m.isDisabledReactIssue7711)(e.currentTarget))return e.preventDefault();e.preventDefault(),Q()}),G=(0,d.useEvent)(e=>{e.key===x.Keys.Space?(e.preventDefault(),Q()):e.key===x.Keys.Enter&&(0,g.attemptSubmit)(e.currentTarget)}),J=(0,d.useEvent)(e=>e.preventDefault()),X=(0,v.useLabelledBy)(),Y=(0,b.useDescribedBy)(),{isFocusVisible:Z,focusProps:ee}=(0,r.useFocusRing)({autoFocus:L}),{isHovered:et,hoverProps:er}=(0,n.useHover)({isDisabled:E}),{pressed:en,pressProps:ei}=(0,s.useActivePress)({disabled:E}),es=(0,i.useMemo)(()=>({checked:U,disabled:E,hover:et,focus:Z,active:en,autofocus:L,changing:H}),[U,et,Z,en,E,H,L]),ea=(0,y.mergeProps)({id:S,ref:z,role:"switch",type:(0,c.useResolveButtonType)(e,I),tabIndex:-1===e.tabIndex?0:null!=(k=e.tabIndex)?k:0,"aria-checked":U,"aria-labelledby":X,"aria-describedby":Y,disabled:E||void 0,autoFocus:L,onClick:V,onKeyUp:G,onKeyPress:J},ee,er,ei),eo=(0,i.useCallback)(()=>{if(void 0!==B)return null==$?void 0:$(B)},[$,B]),el=(0,y.useRender)();return i.default.createElement(i.default.Fragment,null,null!=T&&i.default.createElement(f.FormFields,{disabled:E,data:{[T]:M||"on"},overrides:{type:"checkbox",checked:U},form:P,onReset:eo}),el({ourProps:ea,theirProps:F,slot:es,defaultTag:"button",name:"Switch"}))}),{Group:function(e){var t;let[r,n]=(0,i.useState)(null),[s,a]=(0,v.useLabels)(),[o,l]=(0,b.useDescriptions)(),d=(0,i.useMemo)(()=>({switch:r,setSwitch:n}),[r,n]),c=(0,y.useRender)();return i.default.createElement(l,{name:"Switch.Description",value:o},i.default.createElement(a,{name:"Switch.Label",value:s,props:{htmlFor:null==(t=d.switch)?void 0:t.id,onClick(e){r&&(e.currentTarget instanceof HTMLLabelElement&&e.preventDefault(),r.click(),r.focus({preventScroll:!0}))}}},i.default.createElement(_.Provider,{value:d},c({ourProps:{},theirProps:e,slot:{},defaultTag:k,name:"Switch.Group"}))))},Label:v.Label,Description:b.Description});var j=e.i(888288),C=e.i(95779),S=e.i(444755),E=e.i(673706),N=e.i(829087);let O=(0,E.makeClassName)("Switch"),R=i.default.forwardRef((e,r)=>{let{checked:n,defaultChecked:s=!1,onChange:a,color:o,name:l,error:d,errorMessage:c,disabled:u,required:h,tooltip:f,id:p}=e,m=(0,t.__rest)(e,["checked","defaultChecked","onChange","color","name","error","errorMessage","disabled","required","tooltip","id"]),g={bgColor:o?(0,E.getColorClassNames)(o,C.colorPalette.background).bgColor:"bg-tremor-brand dark:bg-dark-tremor-brand",ringColor:o?(0,E.getColorClassNames)(o,C.colorPalette.ring).ringColor:"ring-tremor-brand-muted dark:ring-dark-tremor-brand-muted"},[y,b]=(0,j.default)(s,n),[x,v]=(0,i.useState)(!1),{tooltipProps:_,getReferenceProps:k}=(0,N.useTooltip)(300);return i.default.createElement("div",{className:"flex flex-row items-center justify-start"},i.default.createElement(N.default,Object.assign({text:f},_)),i.default.createElement("div",Object.assign({ref:(0,E.mergeRefs)([r,_.refs.setReference]),className:(0,S.tremorTwMerge)(O("root"),"flex flex-row relative h-5")},m,k),i.default.createElement("input",{type:"checkbox",className:(0,S.tremorTwMerge)(O("input"),"absolute w-5 h-5 cursor-pointer left-0 top-0 opacity-0"),name:l,required:h,checked:y,onChange:e=>{e.preventDefault()}}),i.default.createElement(w,{checked:y,onChange:e=>{b(e),null==a||a(e)},disabled:u,className:(0,S.tremorTwMerge)(O("switch"),"w-10 h-5 group relative inline-flex shrink-0 cursor-pointer items-center justify-center rounded-tremor-full","focus:outline-none",u?"cursor-not-allowed":""),onFocus:()=>v(!0),onBlur:()=>v(!1),id:p},i.default.createElement("span",{className:(0,S.tremorTwMerge)(O("sr-only"),"sr-only")},"Switch ",y?"on":"off"),i.default.createElement("span",{"aria-hidden":"true",className:(0,S.tremorTwMerge)(O("background"),y?g.bgColor:"bg-tremor-border dark:bg-dark-tremor-border","pointer-events-none absolute mx-auto h-3 w-9 rounded-tremor-full transition-colors duration-100 ease-in-out")}),i.default.createElement("span",{"aria-hidden":"true",className:(0,S.tremorTwMerge)(O("round"),y?(0,S.tremorTwMerge)(g.bgColor,"translate-x-5 border-tremor-background dark:border-dark-tremor-background"):"translate-x-0 bg-tremor-border dark:bg-dark-tremor-border border-tremor-background dark:border-dark-tremor-background","pointer-events-none absolute left-0 inline-block h-5 w-5 transform rounded-tremor-full border-2 shadow-tremor-input duration-100 ease-in-out transition",x?(0,S.tremorTwMerge)("ring-2",g.ringColor):"")}))),d&&c?i.default.createElement("p",{className:(0,S.tremorTwMerge)(O("errorMessage"),"text-sm text-red-500 mt-1 ")},c):null)});R.displayName="Switch",e.s(["Switch",()=>R],793130)},107233,37727,e=>{"use strict";var t=e.i(603908);e.s(["Plus",()=>t.default],107233);var r=e.i(841947);e.s(["X",()=>r.default],37727)},361653,e=>{"use strict";let t=(0,e.i(475254).default)("circle-alert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]]);e.s(["default",()=>t])},841947,e=>{"use strict";let t=(0,e.i(475254).default)("x",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);e.s(["default",()=>t])},603908,e=>{"use strict";let t=(0,e.i(475254).default)("plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);e.s(["default",()=>t])},158392,419470,e=>{"use strict";var t=e.i(843476),r=e.i(779241);let n={ttl:3600,lowest_latency_buffer:0},i=({routingStrategyArgs:e})=>{let i={ttl:"Sliding window to look back over when calculating the average latency of a deployment. Default - 1 hour (in seconds).",lowest_latency_buffer:"Shuffle between deployments within this % of the lowest latency. Default - 0 (i.e. always pick lowest latency)."};return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:"space-y-6",children:[(0,t.jsxs)("div",{className:"max-w-3xl",children:[(0,t.jsx)("h3",{className:"text-sm font-medium text-gray-900",children:"Latency-Based Configuration"}),(0,t.jsx)("p",{className:"text-xs text-gray-500 mt-1",children:"Fine-tune latency-based routing behavior"})]}),(0,t.jsx)("div",{className:"grid grid-cols-1 gap-6 lg:grid-cols-2 xl:grid-cols-3",children:Object.entries(e||n).map(([e,n])=>(0,t.jsx)("div",{className:"space-y-2",children:(0,t.jsxs)("label",{className:"block",children:[(0,t.jsx)("span",{className:"text-xs font-medium text-gray-700 uppercase tracking-wide",children:e.replace(/_/g," ")}),(0,t.jsx)("p",{className:"text-xs text-gray-500 mt-0.5 mb-2",children:i[e]||""}),(0,t.jsx)(r.TextInput,{name:e,defaultValue:"object"==typeof n?JSON.stringify(n,null,2):n?.toString(),className:"font-mono text-sm w-full"})]})},e))})]}),(0,t.jsx)("div",{className:"border-t border-gray-200"})]})},s=({routerSettings:e,routerFieldsMetadata:n})=>(0,t.jsxs)("div",{className:"space-y-6",children:[(0,t.jsxs)("div",{className:"max-w-3xl",children:[(0,t.jsx)("h3",{className:"text-sm font-medium text-gray-900",children:"Reliability & Retries"}),(0,t.jsx)("p",{className:"text-xs text-gray-500 mt-1",children:"Configure retry logic and failure handling"})]}),(0,t.jsx)("div",{className:"grid grid-cols-1 gap-6 lg:grid-cols-2 xl:grid-cols-3",children:Object.entries(e).filter(([e,t])=>"fallbacks"!=e&&"context_window_fallbacks"!=e&&"routing_strategy_args"!=e&&"routing_strategy"!=e&&"enable_tag_filtering"!=e).map(([e,i])=>(0,t.jsx)("div",{className:"space-y-2",children:(0,t.jsxs)("label",{className:"block",children:[(0,t.jsx)("span",{className:"text-xs font-medium text-gray-700 uppercase tracking-wide",children:n[e]?.ui_field_name||e}),(0,t.jsx)("p",{className:"text-xs text-gray-500 mt-0.5 mb-2",children:n[e]?.field_description||""}),(0,t.jsx)(r.TextInput,{name:e,defaultValue:null==i||"null"===i?"":"object"==typeof i?JSON.stringify(i,null,2):i?.toString()||"",placeholder:"—",className:"font-mono text-sm w-full"})]})},e))})]});var a=e.i(199133);let o=({selectedStrategy:e,availableStrategies:r,routingStrategyDescriptions:n,routerFieldsMetadata:i,onStrategyChange:s})=>(0,t.jsxs)("div",{className:"space-y-2 max-w-3xl",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"text-xs font-medium text-gray-700 uppercase tracking-wide",children:i.routing_strategy?.ui_field_name||"Routing Strategy"}),(0,t.jsx)("p",{className:"text-xs text-gray-500 mt-0.5 mb-2",children:i.routing_strategy?.field_description||""})]}),(0,t.jsx)("div",{className:"routing-strategy-select max-w-3xl",children:(0,t.jsx)(a.Select,{value:e,onChange:s,style:{width:"100%"},size:"large",children:r.map(e=>(0,t.jsx)(a.Select.Option,{value:e,label:e,children:(0,t.jsxs)("div",{className:"flex flex-col gap-0.5 py-1",children:[(0,t.jsx)("span",{className:"font-mono text-sm font-medium",children:e}),n[e]&&(0,t.jsx)("span",{className:"text-xs text-gray-500 font-normal",children:n[e]})]})},e))})})]});var l=e.i(793130);let d=({enabled:e,routerFieldsMetadata:r,onToggle:n})=>(0,t.jsx)("div",{className:"space-y-3 max-w-3xl",children:(0,t.jsxs)("div",{className:"flex items-start justify-between",children:[(0,t.jsxs)("div",{className:"flex-1",children:[(0,t.jsx)("label",{className:"text-xs font-medium text-gray-700 uppercase tracking-wide",children:r.enable_tag_filtering?.ui_field_name||"Enable Tag Filtering"}),(0,t.jsxs)("p",{className:"text-xs text-gray-500 mt-0.5",children:[r.enable_tag_filtering?.field_description||"",r.enable_tag_filtering?.link&&(0,t.jsxs)(t.Fragment,{children:[" ",(0,t.jsx)("a",{href:r.enable_tag_filtering.link,target:"_blank",rel:"noopener noreferrer",className:"text-blue-600 hover:text-blue-800 underline",children:"Learn more"})]})]})]}),(0,t.jsx)(l.Switch,{checked:e,onChange:n,className:"ml-4"})]})});e.s(["default",0,({value:e,onChange:r,routerFieldsMetadata:n,availableRoutingStrategies:a,routingStrategyDescriptions:l})=>(0,t.jsxs)("div",{className:"w-full space-y-8 py-2",children:[(0,t.jsxs)("div",{className:"space-y-6",children:[(0,t.jsxs)("div",{className:"max-w-3xl",children:[(0,t.jsx)("h3",{className:"text-sm font-medium text-gray-900",children:"Routing Settings"}),(0,t.jsx)("p",{className:"text-xs text-gray-500 mt-1",children:"Configure how requests are routed to deployments"})]}),a.length>0&&(0,t.jsx)(o,{selectedStrategy:e.selectedStrategy||e.routerSettings.routing_strategy||null,availableStrategies:a,routingStrategyDescriptions:l,routerFieldsMetadata:n,onStrategyChange:t=>{r({...e,selectedStrategy:t})}}),(0,t.jsx)(d,{enabled:e.enableTagFiltering,routerFieldsMetadata:n,onToggle:t=>{r({...e,enableTagFiltering:t})}})]}),(0,t.jsx)("div",{className:"border-t border-gray-200"}),"latency-based-routing"===e.selectedStrategy&&(0,t.jsx)(i,{routingStrategyArgs:e.routerSettings.routing_strategy_args}),(0,t.jsx)(s,{routerSettings:e.routerSettings,routerFieldsMetadata:n})]})],158392);var c=e.i(994388),u=e.i(653496),h=e.i(107233),f=e.i(271645),p=e.i(888259),m=e.i(592968),g=e.i(361653),g=g;let y=(0,e.i(475254).default)("arrow-down",[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]]);var b=e.i(37727);function x({group:e,onChange:r,availableModels:n,maxFallbacks:i}){let s=n.filter(t=>t!==e.primaryModel),o=e.fallbackModels.length{let n=[...e.fallbackModels];n.includes(t)&&(n=n.filter(e=>e!==t)),r({...e,primaryModel:t,fallbackModels:n})},showSearch:!0,getPopupContainer:e=>e.parentElement||document.body,filterOption:(e,t)=>(t?.label??"").toLowerCase().includes(e.toLowerCase()),options:n.map(e=>({label:e,value:e}))}),!e.primaryModel&&(0,t.jsxs)("div",{className:"mt-2 flex items-center gap-2 text-amber-600 text-xs bg-amber-50 p-2 rounded",children:[(0,t.jsx)(g.default,{className:"w-4 h-4"}),(0,t.jsx)("span",{children:"Select a model to begin configuring fallbacks"})]})]}),(0,t.jsx)("div",{className:"flex items-center justify-center -my-4 z-10",children:(0,t.jsxs)("div",{className:"bg-indigo-50 text-indigo-500 px-4 py-1 rounded-full text-xs font-bold border border-indigo-100 flex items-center gap-2 shadow-sm",children:[(0,t.jsx)(y,{className:"w-4 h-4"}),"IF FAILS, TRY..."]})}),(0,t.jsxs)("div",{className:`transition-opacity duration-300 ${!e.primaryModel?"opacity-50 pointer-events-none":"opacity-100"}`,children:[(0,t.jsxs)("label",{className:"block text-sm font-semibold text-gray-700 mb-2",children:["Fallback Chain ",(0,t.jsx)("span",{className:"text-red-500",children:"*"}),(0,t.jsxs)("span",{className:"text-xs text-gray-500 font-normal ml-2",children:["(Max ",i," fallbacks at a time)"]})]}),(0,t.jsxs)("div",{className:"bg-gray-50 rounded-xl p-4 border border-gray-200",children:[(0,t.jsxs)("div",{className:"mb-4",children:[(0,t.jsx)(a.Select,{mode:"multiple",className:"w-full",size:"large",placeholder:o?"Select fallback models to add...":`Maximum ${i} fallbacks reached`,value:e.fallbackModels,onChange:t=>{let n=t.slice(0,i);r({...e,fallbackModels:n})},disabled:!e.primaryModel,getPopupContainer:e=>e.parentElement||document.body,options:s.map(e=>({label:e,value:e})),optionRender:(r,n)=>{let i=e.fallbackModels.includes(r.value),s=i?e.fallbackModels.indexOf(r.value)+1:null;return(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[i&&null!==s&&(0,t.jsx)("span",{className:"flex items-center justify-center w-5 h-5 rounded bg-indigo-100 text-indigo-600 text-xs font-bold",children:s}),(0,t.jsx)("span",{children:r.label})]})},maxTagCount:"responsive",maxTagPlaceholder:e=>(0,t.jsx)(m.Tooltip,{styles:{root:{pointerEvents:"none"}},title:e.map(({value:e})=>e).join(", "),children:(0,t.jsxs)("span",{children:["+",e.length," more"]})}),showSearch:!0,filterOption:(e,t)=>(t?.label??"").toLowerCase().includes(e.toLowerCase())}),(0,t.jsx)("p",{className:"text-xs text-gray-500 mt-1 ml-1",children:o?`Search and select multiple models. Selected models will appear below in order. (${e.fallbackModels.length}/${i} used)`:`Maximum ${i} fallbacks reached. Remove some to add more.`})]}),(0,t.jsx)("div",{className:"space-y-2 min-h-[100px]",children:0===e.fallbackModels.length?(0,t.jsxs)("div",{className:"h-32 border-2 border-dashed border-gray-300 rounded-lg flex flex-col items-center justify-center text-gray-400",children:[(0,t.jsx)("span",{className:"text-sm",children:"No fallback models selected"}),(0,t.jsx)("span",{className:"text-xs mt-1",children:"Add models from the dropdown above"})]}):e.fallbackModels.map((n,i)=>(0,t.jsxs)("div",{className:"group flex items-center justify-between p-3 bg-white rounded-lg border border-gray-200 hover:border-indigo-300 hover:shadow-sm transition-all",children:[(0,t.jsxs)("div",{className:"flex items-center gap-3",children:[(0,t.jsx)("div",{className:"flex items-center justify-center w-6 h-6 rounded bg-gray-100 text-gray-400 group-hover:text-indigo-500 group-hover:bg-indigo-50",children:(0,t.jsx)("span",{className:"text-xs font-bold",children:i+1})}),(0,t.jsx)("div",{children:(0,t.jsx)("span",{className:"font-medium text-gray-800",children:n})})]}),(0,t.jsx)("button",{type:"button",onClick:()=>{let t;return t=e.fallbackModels.filter((e,t)=>t!==i),void r({...e,fallbackModels:t})},className:"opacity-0 group-hover:opacity-100 transition-opacity text-gray-400 hover:text-red-500 p-1",children:(0,t.jsx)(b.X,{className:"w-4 h-4"})})]},`${n}-${i}`))})]})]})]})}function v({groups:e,onGroupsChange:r,availableModels:n,maxFallbacks:i=10,maxGroups:s=5}){let[a,o]=(0,f.useState)(e.length>0?e[0].id:"1");(0,f.useEffect)(()=>{e.length>0?e.some(e=>e.id===a)||o(e[0].id):o("1")},[e]);let l=()=>{if(e.length>=s)return;let t=Date.now().toString();r([...e,{id:t,primaryModel:null,fallbackModels:[]}]),o(t)},d=t=>{r(e.map(e=>e.id===t.id?t:e))},m=e.map((r,s)=>{let a=r.primaryModel?r.primaryModel:`Group ${s+1}`;return{key:r.id,label:a,closable:e.length>1,children:(0,t.jsx)(x,{group:r,onChange:d,availableModels:n,maxFallbacks:i})}});return 0===e.length?(0,t.jsxs)("div",{className:"text-center py-12 bg-gray-50 rounded-lg border border-dashed border-gray-300",children:[(0,t.jsx)("p",{className:"text-gray-500 mb-4",children:"No fallback groups configured"}),(0,t.jsx)(c.Button,{variant:"primary",onClick:l,icon:()=>(0,t.jsx)(h.Plus,{className:"w-4 h-4"}),children:"Create First Group"})]}):(0,t.jsx)(u.Tabs,{type:"editable-card",activeKey:a,onChange:o,onEdit:(t,n)=>{"add"===n?l():"remove"===n&&e.length>1&&(t=>{if(1===e.length)return p.default.warning("At least one group is required");let n=e.filter(e=>e.id!==t);r(n),a===t&&n.length>0&&o(n[n.length-1].id)})(t)},items:m,className:"fallback-tabs",tabBarStyle:{marginBottom:0},hideAdd:e.length>=s})}e.s(["FallbackSelectionForm",()=>v],419470)}]); \ No newline at end of file diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/1379bf26a33536ad.js b/litellm/proxy/_experimental/out/_next/static/chunks/1379bf26a33536ad.js new file mode 100644 index 0000000000..b380962243 --- /dev/null +++ b/litellm/proxy/_experimental/out/_next/static/chunks/1379bf26a33536ad.js @@ -0,0 +1 @@ +(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,966988,e=>{"use strict";var t=e.i(843476),o=e.i(271645),n=e.i(464571),s=e.i(918789),r=e.i(650056),i=e.i(219470),l=e.i(755151),a=e.i(240647),c=e.i(812618);e.s(["default",0,({reasoningContent:e})=>{let[p,d]=(0,o.useState)(!0);return e?(0,t.jsxs)("div",{className:"reasoning-content mt-1 mb-2",children:[(0,t.jsxs)(n.Button,{type:"text",className:"flex items-center text-xs text-gray-500 hover:text-gray-700",onClick:()=>d(!p),icon:(0,t.jsx)(c.BulbOutlined,{}),children:[p?"Hide reasoning":"Show reasoning",p?(0,t.jsx)(l.DownOutlined,{className:"ml-1"}):(0,t.jsx)(a.RightOutlined,{className:"ml-1"})]}),p&&(0,t.jsx)("div",{className:"mt-2 p-3 bg-gray-50 border border-gray-200 rounded-md text-sm text-gray-700",children:(0,t.jsx)(s.default,{components:{code({node:e,inline:o,className:n,children:s,...l}){let a=/language-(\w+)/.exec(n||"");return!o&&a?(0,t.jsx)(r.Prism,{style:i.coy,language:a[1],PreTag:"div",className:"rounded-md my-2",...l,children:String(s).replace(/\n$/,"")}):(0,t.jsx)("code",{className:`${n} px-1.5 py-0.5 rounded bg-gray-100 text-sm font-mono`,...l,children:s})}},children:e})})]}):null}])},355343,e=>{"use strict";var t=e.i(843476),o=e.i(437902),n=e.i(898586),s=e.i(362024);let{Text:r}=n.Typography,{Panel:i}=s.Collapse;e.s(["default",0,({events:e,className:n})=>{if(console.log("MCPEventsDisplay: Received events:",e),!e||0===e.length)return console.log("MCPEventsDisplay: No events, returning null"),null;let r=e.find(e=>"response.output_item.done"===e.type&&e.item?.type==="mcp_list_tools"&&e.item.tools&&e.item.tools.length>0),l=e.filter(e=>"response.output_item.done"===e.type&&e.item?.type==="mcp_call");return(console.log("MCPEventsDisplay: toolsEvent:",r),console.log("MCPEventsDisplay: mcpCallEvents:",l),r||0!==l.length)?(0,t.jsxs)("div",{className:`jsx-32b14b04f420f3ac mcp-events-display ${n||""}`,children:[(0,t.jsx)(o.default,{id:"32b14b04f420f3ac",children:".openai-mcp-tools.jsx-32b14b04f420f3ac{margin:0;padding:0;position:relative}.openai-mcp-tools.jsx-32b14b04f420f3ac .ant-collapse.jsx-32b14b04f420f3ac,.openai-mcp-tools.jsx-32b14b04f420f3ac .ant-collapse-item.jsx-32b14b04f420f3ac{background:0 0!important;border:none!important}.openai-mcp-tools.jsx-32b14b04f420f3ac .ant-collapse-header.jsx-32b14b04f420f3ac{color:#9ca3af!important;background:0 0!important;border:none!important;min-height:20px!important;padding:0 0 0 20px!important;font-size:14px!important;font-weight:400!important;line-height:20px!important}.openai-mcp-tools.jsx-32b14b04f420f3ac .ant-collapse-header.jsx-32b14b04f420f3ac:hover{color:#6b7280!important;background:0 0!important}.openai-mcp-tools.jsx-32b14b04f420f3ac .ant-collapse-content.jsx-32b14b04f420f3ac{background:0 0!important;border:none!important}.openai-mcp-tools.jsx-32b14b04f420f3ac .ant-collapse-content-box.jsx-32b14b04f420f3ac{padding:4px 0 0 20px!important}.openai-mcp-tools.jsx-32b14b04f420f3ac .ant-collapse-expand-icon.jsx-32b14b04f420f3ac{color:#9ca3af!important;justify-content:center!important;align-items:center!important;width:16px!important;height:16px!important;font-size:10px!important;display:flex!important;position:absolute!important;top:2px!important;left:2px!important}.openai-mcp-tools.jsx-32b14b04f420f3ac .ant-collapse-expand-icon.jsx-32b14b04f420f3ac:hover{color:#6b7280!important}.openai-vertical-line.jsx-32b14b04f420f3ac{opacity:.8;background-color:#f3f4f6;width:.5px;position:absolute;top:18px;bottom:0;left:9px}.tool-item.jsx-32b14b04f420f3ac{color:#4b5563;z-index:1;background:#fff;margin:0;padding:0;font-family:ui-monospace,SFMono-Regular,SF Mono,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-size:13px;line-height:18px;position:relative}.mcp-section.jsx-32b14b04f420f3ac{z-index:1;background:#fff;margin-bottom:12px;position:relative}.mcp-section.jsx-32b14b04f420f3ac:last-child{margin-bottom:0}.mcp-section-header.jsx-32b14b04f420f3ac{color:#6b7280;margin-bottom:4px;font-size:13px;font-weight:500}.mcp-code-block.jsx-32b14b04f420f3ac{background:#f9fafb;border:1px solid #f3f4f6;border-radius:6px;padding:8px;font-size:12px}.mcp-json.jsx-32b14b04f420f3ac{color:#374151;white-space:pre-wrap;word-wrap:break-word;margin:0;font-family:ui-monospace,SFMono-Regular,SF Mono,Monaco,Consolas,Liberation Mono,Courier New,monospace}.mcp-approved.jsx-32b14b04f420f3ac{color:#6b7280;align-items:center;font-size:13px;display:flex}.mcp-checkmark.jsx-32b14b04f420f3ac{color:#10b981;margin-right:6px;font-weight:700}.mcp-response-content.jsx-32b14b04f420f3ac{color:#374151;white-space:pre-wrap;font-family:ui-monospace,SFMono-Regular,SF Mono,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-size:13px;line-height:1.5}"}),(0,t.jsxs)("div",{className:"jsx-32b14b04f420f3ac openai-mcp-tools",children:[(0,t.jsx)("div",{className:"jsx-32b14b04f420f3ac openai-vertical-line"}),(0,t.jsxs)(s.Collapse,{ghost:!0,size:"small",expandIconPosition:"start",defaultActiveKey:r?["list-tools"]:l.map((e,t)=>`mcp-call-${t}`),children:[r&&(0,t.jsx)(i,{header:"List tools",children:(0,t.jsx)("div",{className:"jsx-32b14b04f420f3ac",children:r.item?.tools?.map((e,o)=>(0,t.jsx)("div",{className:"jsx-32b14b04f420f3ac tool-item",children:e.name},o))})},"list-tools"),l.map((e,o)=>(0,t.jsx)(i,{header:e.item?.name||"Tool call",children:(0,t.jsxs)("div",{className:"jsx-32b14b04f420f3ac",children:[(0,t.jsxs)("div",{className:"jsx-32b14b04f420f3ac mcp-section",children:[(0,t.jsx)("div",{className:"jsx-32b14b04f420f3ac mcp-section-header",children:"Request"}),(0,t.jsx)("div",{className:"jsx-32b14b04f420f3ac mcp-code-block",children:e.item?.arguments&&(0,t.jsx)("pre",{className:"jsx-32b14b04f420f3ac mcp-json",children:(()=>{try{return JSON.stringify(JSON.parse(e.item.arguments),null,2)}catch(t){return e.item.arguments}})()})})]}),(0,t.jsx)("div",{className:"jsx-32b14b04f420f3ac mcp-section",children:(0,t.jsxs)("div",{className:"jsx-32b14b04f420f3ac mcp-approved",children:[(0,t.jsx)("span",{className:"jsx-32b14b04f420f3ac mcp-checkmark",children:"✓"})," Approved"]})}),e.item?.output&&(0,t.jsxs)("div",{className:"jsx-32b14b04f420f3ac mcp-section",children:[(0,t.jsx)("div",{className:"jsx-32b14b04f420f3ac mcp-section-header",children:"Response"}),(0,t.jsx)("div",{className:"jsx-32b14b04f420f3ac mcp-response-content",children:e.item.output})]})]})},`mcp-call-${o}`))]})]})]}):(console.log("MCPEventsDisplay: No valid events found, returning null"),null)}])},254530,452598,e=>{"use strict";e.i(247167);var t=e.i(356449),o=e.i(764205);async function n(e,n,s,r,i,l,a,c,p,d,u,m,f,h,g,_,b,v,y,x,S,w,j,k,z){console.log=function(){},console.log("isLocal:",!1);let C=x||(0,o.getProxyBaseUrl)(),R={};i&&i.length>0&&(R["x-litellm-tags"]=i.join(","));let M=new t.default.OpenAI({apiKey:r,baseURL:C,dangerouslyAllowBrowser:!0,defaultHeaders:R});try{let t,o=Date.now(),r=!1,i={},x=!1,C=[];for await(let y of(h&&h.length>0&&(h.includes("__all__")?C.push({type:"mcp",server_label:"litellm",server_url:"litellm_proxy/mcp",require_approval:"never"}):h.forEach(e=>{if(e.startsWith("toolset:")){let t=e.slice(8),o=z?.find(e=>e.toolset_id===t),n=o?.toolset_name||t;C.push({type:"mcp",server_label:n,server_url:`litellm_proxy/mcp/${encodeURIComponent(n)}`,require_approval:"never"})}else{let t=S?.find(t=>t.server_id===e),o=t?.alias||t?.server_name||e,n=w?.[e]||[];C.push({type:"mcp",server_label:"litellm",server_url:`litellm_proxy/mcp/${o}`,require_approval:"never",...n.length>0?{allowed_tools:n}:{}})}})),await M.chat.completions.create({model:s,stream:!0,stream_options:{include_usage:!0},litellm_trace_id:d,messages:e,...u?{vector_store_ids:u}:{},...m?{guardrails:m}:{},...f?{policies:f}:{},...C.length>0?{tools:C,tool_choice:"auto"}:{},...void 0!==b?{temperature:b}:{},...void 0!==v?{max_tokens:v}:{},...k?{mock_testing_fallbacks:!0}:{}},{signal:l}))){console.log("Stream chunk:",y);let e=y.choices[0]?.delta;if(console.log("Delta content:",y.choices[0]?.delta?.content),console.log("Delta reasoning content:",e?.reasoning_content),!r&&(y.choices[0]?.delta?.content||e&&e.reasoning_content)&&(r=!0,t=Date.now()-o,console.log("First token received! Time:",t,"ms"),c?(console.log("Calling onTimingData with:",t),c(t)):console.log("onTimingData callback is not defined!")),y.choices[0]?.delta?.content){let e=y.choices[0].delta.content;n(e,y.model)}if(e&&e.image&&g&&(console.log("Image generated:",e.image),g(e.image.url,y.model)),e&&e.reasoning_content){let t=e.reasoning_content;a&&a(t)}if(e&&e.provider_specific_fields?.search_results&&_&&(console.log("Search results found:",e.provider_specific_fields.search_results),_(e.provider_specific_fields.search_results)),e&&e.provider_specific_fields){let t=e.provider_specific_fields;if(t.mcp_list_tools&&!i.mcp_list_tools&&(i.mcp_list_tools=t.mcp_list_tools,j&&!x)){x=!0;let e={type:"response.output_item.done",item_id:"mcp_list_tools",item:{type:"mcp_list_tools",tools:t.mcp_list_tools.map(e=>({name:e.function?.name||e.name||"",description:e.function?.description||e.description||"",input_schema:e.function?.parameters||e.input_schema||{}}))},timestamp:Date.now()};j(e),console.log("MCP list_tools event sent:",e)}t.mcp_tool_calls&&(i.mcp_tool_calls=t.mcp_tool_calls),t.mcp_call_results&&(i.mcp_call_results=t.mcp_call_results),(t.mcp_list_tools||t.mcp_tool_calls||t.mcp_call_results)&&console.log("MCP metadata found in chunk:",{mcp_list_tools:t.mcp_list_tools?"present":"absent",mcp_tool_calls:t.mcp_tool_calls?"present":"absent",mcp_call_results:t.mcp_call_results?"present":"absent"})}if(y.usage&&p){console.log("Usage data found:",y.usage);let e={completionTokens:y.usage.completion_tokens,promptTokens:y.usage.prompt_tokens,totalTokens:y.usage.total_tokens};y.usage.completion_tokens_details?.reasoning_tokens&&(e.reasoningTokens=y.usage.completion_tokens_details.reasoning_tokens),void 0!==y.usage.cost&&null!==y.usage.cost&&(e.cost=parseFloat(y.usage.cost)),p(e)}}j&&(i.mcp_tool_calls||i.mcp_call_results)&&i.mcp_tool_calls&&i.mcp_tool_calls.length>0&&i.mcp_tool_calls.forEach((e,t)=>{let o=e.function?.name||e.name||"",n=e.function?.arguments||e.arguments||"{}",s=i.mcp_call_results?.find(t=>t.tool_call_id===e.id||t.tool_call_id===e.call_id)||i.mcp_call_results?.[t],r={type:"response.output_item.done",item:{type:"mcp_call",name:o,arguments:"string"==typeof n?n:JSON.stringify(n),output:s?.result?"string"==typeof s.result?s.result:JSON.stringify(s.result):void 0},item_id:e.id||e.call_id,timestamp:Date.now()};j(r),console.log("MCP call event sent:",r)});let R=Date.now();y&&y(R-o)}catch(e){throw l?.aborted&&console.log("Chat completion request was cancelled"),e}}e.s(["makeOpenAIChatCompletionRequest",()=>n],254530);var s=e.i(727749);async function r(e,n,i,l,a=[],c,p,d,u,m,f,h,g,_,b,v,y,x,S,w,j,k,z){if(!l)throw Error("Virtual Key is required");if(!i||""===i.trim())throw Error("Model is required. Please select a model before sending a request.");console.log=function(){};let C=w||(0,o.getProxyBaseUrl)(),R={};a&&a.length>0&&(R["x-litellm-tags"]=a.join(","));let M=new t.default.OpenAI({apiKey:l,baseURL:C,dangerouslyAllowBrowser:!0,defaultHeaders:R});try{let t=Date.now(),o=!1,s=e.map(e=>(Array.isArray(e.content),{role:e.role,content:e.content,type:"message"})),r=[];_&&_.length>0&&(_.includes("__all__")?r.push({type:"mcp",server_label:"litellm",server_url:`${C}/mcp`,require_approval:"never"}):_.forEach(e=>{if(e.startsWith("toolset:")){let t=e.slice(8),o=z?.find(e=>e.toolset_id===t),n=o?.toolset_name||t;r.push({type:"mcp",server_label:n,server_url:`${C}/mcp/${encodeURIComponent(n)}`,require_approval:"never"})}else{let t=j?.find(t=>t.server_id===e),o=t?.server_name||e,n=k?.[e]||[];r.push({type:"mcp",server_label:o,server_url:`${C}/mcp/${encodeURIComponent(o)}`,require_approval:"never",...n.length>0?{allowed_tools:n}:{}})}})),x&&r.push({type:"code_interpreter",container:{type:"auto"}});let l=await M.responses.create({model:i,input:s,stream:!0,litellm_trace_id:m,...b?{previous_response_id:b}:{},...f?{vector_store_ids:f}:{},...h?{guardrails:h}:{},...g?{policies:g}:{},...r.length>0?{tools:r,tool_choice:"auto"}:{}},{signal:c}),a="",w={code:"",containerId:""};for await(let e of l)if(console.log("Response event:",e),"object"==typeof e&&null!==e){if((e.type?.startsWith("response.mcp_")||"response.output_item.done"===e.type&&(e.item?.type==="mcp_list_tools"||e.item?.type==="mcp_call"))&&(console.log("MCP event received:",e),y)){let t={type:e.type,sequence_number:e.sequence_number,output_index:e.output_index,item_id:e.item_id||e.item?.id,item:e.item,delta:e.delta,arguments:e.arguments,timestamp:Date.now()};y(t)}"response.output_item.done"===e.type&&e.item?.type==="mcp_call"&&e.item?.name&&(a=e.item.name,console.log("MCP tool used:",a)),T=w;var T,F=w="response.output_item.done"===e.type&&e.item?.type==="code_interpreter_call"?(console.log("Code interpreter call completed:",e.item),{code:e.item.code||"",containerId:e.item.container_id||""}):T;if("response.output_item.done"===e.type&&e.item?.type==="message"&&e.item?.content&&S){for(let t of e.item.content)if("output_text"===t.type&&t.annotations){let e=t.annotations.filter(e=>"container_file_citation"===e.type);(e.length>0||F.code)&&S({code:F.code,containerId:F.containerId,annotations:e})}}if("response.role.delta"===e.type)continue;if("response.output_text.delta"===e.type&&"string"==typeof e.delta){let s=e.delta;if(console.log("Text delta",s),s.length>0&&(n("assistant",s,i),!o)){o=!0;let e=Date.now()-t;console.log("First token received! Time:",e,"ms"),d&&d(e)}}if("response.reasoning.delta"===e.type&&"delta"in e){let t=e.delta;"string"==typeof t&&p&&p(t)}if("response.completed"===e.type&&"response"in e){let t=e.response,o=t.usage;if(console.log("Usage data:",o),console.log("Response completed event:",t),t.id&&v&&(console.log("Response ID for session management:",t.id),v(t.id)),o&&u){console.log("Usage data:",o);let e={completionTokens:o.output_tokens,promptTokens:o.input_tokens,totalTokens:o.total_tokens};o.completion_tokens_details?.reasoning_tokens&&(e.reasoningTokens=o.completion_tokens_details.reasoning_tokens),u(e,a)}}}return l}catch(e){throw c?.aborted?console.log("Responses API request was cancelled"):s.default.fromBackend(`Error occurred while generating model response. Please try again. Error: ${e}`),e}}e.s(["makeOpenAIResponsesRequest",()=>r],452598)},755151,e=>{"use strict";var t=e.i(247153);e.s(["DownOutlined",()=>t.default])},240647,e=>{"use strict";var t=e.i(286612);e.s(["RightOutlined",()=>t.default])},245704,e=>{"use strict";e.i(247167);var t=e.i(931067),o=e.i(271645);let n={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M699 353h-46.9c-10.2 0-19.9 4.9-25.9 13.3L469 584.3l-71.2-98.8c-6-8.3-15.6-13.3-25.9-13.3H325c-6.5 0-10.3 7.4-6.5 12.7l124.6 172.8a31.8 31.8 0 0051.7 0l210.6-292c3.9-5.3.1-12.7-6.4-12.7z"}},{tag:"path",attrs:{d:"M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z"}}]},name:"check-circle",theme:"outlined"};var s=e.i(9583),r=o.forwardRef(function(e,r){return o.createElement(s.default,(0,t.default)({},e,{ref:r,icon:n}))});e.s(["CheckCircleOutlined",0,r],245704)},492030,e=>{"use strict";var t=e.i(121229);e.s(["CheckOutlined",()=>t.default])},434166,e=>{"use strict";function t(e,t){window.sessionStorage.setItem(e,btoa(encodeURIComponent(t).replace(/%([0-9A-F]{2})/g,(e,t)=>String.fromCharCode(parseInt(t,16)))))}function o(e){try{let t=window.sessionStorage.getItem(e);if(null===t)return null;return decodeURIComponent(atob(t).split("").map(e=>"%"+e.charCodeAt(0).toString(16).padStart(2,"0")).join(""))}catch{return null}}e.s(["getSecureItem",()=>o,"setSecureItem",()=>t])},219470,812618,e=>{"use strict";e.s(["coy",0,{'code[class*="language-"]':{color:"black",background:"none",fontFamily:"Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace",fontSize:"1em",textAlign:"left",whiteSpace:"pre",wordSpacing:"normal",wordBreak:"normal",wordWrap:"normal",lineHeight:"1.5",MozTabSize:"4",OTabSize:"4",tabSize:"4",WebkitHyphens:"none",MozHyphens:"none",msHyphens:"none",hyphens:"none",maxHeight:"inherit",height:"inherit",padding:"0 1em",display:"block",overflow:"auto"},'pre[class*="language-"]':{color:"black",background:"none",fontFamily:"Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace",fontSize:"1em",textAlign:"left",whiteSpace:"pre",wordSpacing:"normal",wordBreak:"normal",wordWrap:"normal",lineHeight:"1.5",MozTabSize:"4",OTabSize:"4",tabSize:"4",WebkitHyphens:"none",MozHyphens:"none",msHyphens:"none",hyphens:"none",position:"relative",margin:".5em 0",overflow:"visible",padding:"1px",backgroundColor:"#fdfdfd",WebkitBoxSizing:"border-box",MozBoxSizing:"border-box",boxSizing:"border-box",marginBottom:"1em"},'pre[class*="language-"] > code':{position:"relative",zIndex:"1",borderLeft:"10px solid #358ccb",boxShadow:"-1px 0px 0px 0px #358ccb, 0px 0px 0px 1px #dfdfdf",backgroundColor:"#fdfdfd",backgroundImage:"linear-gradient(transparent 50%, rgba(69, 142, 209, 0.04) 50%)",backgroundSize:"3em 3em",backgroundOrigin:"content-box",backgroundAttachment:"local"},':not(pre) > code[class*="language-"]':{backgroundColor:"#fdfdfd",WebkitBoxSizing:"border-box",MozBoxSizing:"border-box",boxSizing:"border-box",marginBottom:"1em",position:"relative",padding:".2em",borderRadius:"0.3em",color:"#c92c2c",border:"1px solid rgba(0, 0, 0, 0.1)",display:"inline",whiteSpace:"normal"},'pre[class*="language-"]:before':{content:"''",display:"block",position:"absolute",bottom:"0.75em",left:"0.18em",width:"40%",height:"20%",maxHeight:"13em",boxShadow:"0px 13px 8px #979797",WebkitTransform:"rotate(-2deg)",MozTransform:"rotate(-2deg)",msTransform:"rotate(-2deg)",OTransform:"rotate(-2deg)",transform:"rotate(-2deg)"},'pre[class*="language-"]:after':{content:"''",display:"block",position:"absolute",bottom:"0.75em",left:"auto",width:"40%",height:"20%",maxHeight:"13em",boxShadow:"0px 13px 8px #979797",WebkitTransform:"rotate(2deg)",MozTransform:"rotate(2deg)",msTransform:"rotate(2deg)",OTransform:"rotate(2deg)",transform:"rotate(2deg)",right:"0.75em"},comment:{color:"#7D8B99"},"block-comment":{color:"#7D8B99"},prolog:{color:"#7D8B99"},doctype:{color:"#7D8B99"},cdata:{color:"#7D8B99"},punctuation:{color:"#5F6364"},property:{color:"#c92c2c"},tag:{color:"#c92c2c"},boolean:{color:"#c92c2c"},number:{color:"#c92c2c"},"function-name":{color:"#c92c2c"},constant:{color:"#c92c2c"},symbol:{color:"#c92c2c"},deleted:{color:"#c92c2c"},selector:{color:"#2f9c0a"},"attr-name":{color:"#2f9c0a"},string:{color:"#2f9c0a"},char:{color:"#2f9c0a"},function:{color:"#2f9c0a"},builtin:{color:"#2f9c0a"},inserted:{color:"#2f9c0a"},operator:{color:"#a67f59",background:"rgba(255, 255, 255, 0.5)"},entity:{color:"#a67f59",background:"rgba(255, 255, 255, 0.5)",cursor:"help"},url:{color:"#a67f59",background:"rgba(255, 255, 255, 0.5)"},variable:{color:"#a67f59",background:"rgba(255, 255, 255, 0.5)"},atrule:{color:"#1990b8"},"attr-value":{color:"#1990b8"},keyword:{color:"#1990b8"},"class-name":{color:"#1990b8"},regex:{color:"#e90"},important:{color:"#e90",fontWeight:"normal"},".language-css .token.string":{color:"#a67f59",background:"rgba(255, 255, 255, 0.5)"},".style .token.string":{color:"#a67f59",background:"rgba(255, 255, 255, 0.5)"},bold:{fontWeight:"bold"},italic:{fontStyle:"italic"},namespace:{Opacity:".7"},'pre[class*="language-"].line-numbers.line-numbers':{paddingLeft:"0"},'pre[class*="language-"].line-numbers.line-numbers code':{paddingLeft:"3.8em"},'pre[class*="language-"].line-numbers.line-numbers .line-numbers-rows':{left:"0"},'pre[class*="language-"][data-line]':{paddingTop:"0",paddingBottom:"0",paddingLeft:"0"},"pre[data-line] code":{position:"relative",paddingLeft:"4em"},"pre .line-highlight":{marginTop:"0"}}],219470),e.i(247167);var t=e.i(931067),o=e.i(271645);let n={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M632 888H392c-4.4 0-8 3.6-8 8v32c0 17.7 14.3 32 32 32h192c17.7 0 32-14.3 32-32v-32c0-4.4-3.6-8-8-8zM512 64c-181.1 0-328 146.9-328 328 0 121.4 66 227.4 164 284.1V792c0 17.7 14.3 32 32 32h264c17.7 0 32-14.3 32-32V676.1c98-56.7 164-162.7 164-284.1 0-181.1-146.9-328-328-328zm127.9 549.8L604 634.6V752H420V634.6l-35.9-20.8C305.4 568.3 256 484.5 256 392c0-141.4 114.6-256 256-256s256 114.6 256 256c0 92.5-49.4 176.3-128.1 221.8z"}}]},name:"bulb",theme:"outlined"};var s=e.i(9583),r=o.forwardRef(function(e,r){return o.createElement(s.default,(0,t.default)({},e,{ref:r,icon:n}))});e.s(["BulbOutlined",0,r],812618)},166406,e=>{"use strict";var t=e.i(190144);e.s(["CopyOutlined",()=>t.default])},362024,e=>{"use strict";var t=e.i(988122);e.s(["Collapse",()=>t.default])},313603,e=>{"use strict";e.i(247167);var t=e.i(931067),o=e.i(271645);let n={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M924.8 625.7l-65.5-56c3.1-19 4.7-38.4 4.7-57.8s-1.6-38.8-4.7-57.8l65.5-56a32.03 32.03 0 009.3-35.2l-.9-2.6a443.74 443.74 0 00-79.7-137.9l-1.8-2.1a32.12 32.12 0 00-35.1-9.5l-81.3 28.9c-30-24.6-63.5-44-99.7-57.6l-15.7-85a32.05 32.05 0 00-25.8-25.7l-2.7-.5c-52.1-9.4-106.9-9.4-159 0l-2.7.5a32.05 32.05 0 00-25.8 25.7l-15.8 85.4a351.86 351.86 0 00-99 57.4l-81.9-29.1a32 32 0 00-35.1 9.5l-1.8 2.1a446.02 446.02 0 00-79.7 137.9l-.9 2.6c-4.5 12.5-.8 26.5 9.3 35.2l66.3 56.6c-3.1 18.8-4.6 38-4.6 57.1 0 19.2 1.5 38.4 4.6 57.1L99 625.5a32.03 32.03 0 00-9.3 35.2l.9 2.6c18.1 50.4 44.9 96.9 79.7 137.9l1.8 2.1a32.12 32.12 0 0035.1 9.5l81.9-29.1c29.8 24.5 63.1 43.9 99 57.4l15.8 85.4a32.05 32.05 0 0025.8 25.7l2.7.5a449.4 449.4 0 00159 0l2.7-.5a32.05 32.05 0 0025.8-25.7l15.7-85a350 350 0 0099.7-57.6l81.3 28.9a32 32 0 0035.1-9.5l1.8-2.1c34.8-41.1 61.6-87.5 79.7-137.9l.9-2.6c4.5-12.3.8-26.3-9.3-35zM788.3 465.9c2.5 15.1 3.8 30.6 3.8 46.1s-1.3 31-3.8 46.1l-6.6 40.1 74.7 63.9a370.03 370.03 0 01-42.6 73.6L721 702.8l-31.4 25.8c-23.9 19.6-50.5 35-79.3 45.8l-38.1 14.3-17.9 97a377.5 377.5 0 01-85 0l-17.9-97.2-37.8-14.5c-28.5-10.8-55-26.2-78.7-45.7l-31.4-25.9-93.4 33.2c-17-22.9-31.2-47.6-42.6-73.6l75.5-64.5-6.5-40c-2.4-14.9-3.7-30.3-3.7-45.5 0-15.3 1.2-30.6 3.7-45.5l6.5-40-75.5-64.5c11.3-26.1 25.6-50.7 42.6-73.6l93.4 33.2 31.4-25.9c23.7-19.5 50.2-34.9 78.7-45.7l37.9-14.3 17.9-97.2c28.1-3.2 56.8-3.2 85 0l17.9 97 38.1 14.3c28.7 10.8 55.4 26.2 79.3 45.8l31.4 25.8 92.8-32.9c17 22.9 31.2 47.6 42.6 73.6L781.8 426l6.5 39.9zM512 326c-97.2 0-176 78.8-176 176s78.8 176 176 176 176-78.8 176-176-78.8-176-176-176zm79.2 255.2A111.6 111.6 0 01512 614c-29.9 0-58-11.7-79.2-32.8A111.6 111.6 0 01400 502c0-29.9 11.7-58 32.8-79.2C454 401.6 482.1 390 512 390c29.9 0 58 11.6 79.2 32.8A111.6 111.6 0 01624 502c0 29.9-11.7 58-32.8 79.2z"}}]},name:"setting",theme:"outlined"};var s=e.i(9583),r=o.forwardRef(function(e,r){return o.createElement(s.default,(0,t.default)({},e,{ref:r,icon:n}))});e.s(["SettingOutlined",0,r],313603)},366308,e=>{"use strict";e.i(247167);var t=e.i(931067),o=e.i(271645);let n={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M876.6 239.5c-.5-.9-1.2-1.8-2-2.5-5-5-13.1-5-18.1 0L684.2 409.3l-67.9-67.9L788.7 169c.8-.8 1.4-1.6 2-2.5 3.6-6.1 1.6-13.9-4.5-17.5-98.2-58-226.8-44.7-311.3 39.7-67 67-89.2 162-66.5 247.4l-293 293c-3 3-2.8 7.9.3 11l169.7 169.7c3.1 3.1 8.1 3.3 11 .3l292.9-292.9c85.5 22.8 180.5.7 247.6-66.4 84.4-84.5 97.7-213.1 39.7-311.3zM786 499.8c-58.1 58.1-145.3 69.3-214.6 33.6l-8.8 8.8-.1-.1-274 274.1-79.2-79.2 230.1-230.1s0 .1.1.1l52.8-52.8c-35.7-69.3-24.5-156.5 33.6-214.6a184.2 184.2 0 01144-53.5L537 318.9a32.05 32.05 0 000 45.3l124.5 124.5a32.05 32.05 0 0045.3 0l132.8-132.8c3.7 51.8-14.4 104.8-53.6 143.9z"}}]},name:"tool",theme:"outlined"};var s=e.i(9583),r=o.forwardRef(function(e,r){return o.createElement(s.default,(0,t.default)({},e,{ref:r,icon:n}))});e.s(["ToolOutlined",0,r],366308)},438957,e=>{"use strict";e.i(247167);var t=e.i(931067),o=e.i(271645);let n={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M608 112c-167.9 0-304 136.1-304 304 0 70.3 23.9 135 63.9 186.5l-41.1 41.1-62.3-62.3a8.15 8.15 0 00-11.4 0l-39.8 39.8a8.15 8.15 0 000 11.4l62.3 62.3-44.9 44.9-62.3-62.3a8.15 8.15 0 00-11.4 0l-39.8 39.8a8.15 8.15 0 000 11.4l62.3 62.3-65.3 65.3a8.03 8.03 0 000 11.3l42.3 42.3c3.1 3.1 8.2 3.1 11.3 0l253.6-253.6A304.06 304.06 0 00608 720c167.9 0 304-136.1 304-304S775.9 112 608 112zm161.2 465.2C726.2 620.3 668.9 644 608 644c-60.9 0-118.2-23.7-161.2-66.8-43.1-43-66.8-100.3-66.8-161.2 0-60.9 23.7-118.2 66.8-161.2 43-43.1 100.3-66.8 161.2-66.8 60.9 0 118.2 23.7 161.2 66.8 43.1 43 66.8 100.3 66.8 161.2 0 60.9-23.7 118.2-66.8 161.2z"}}]},name:"key",theme:"outlined"};var s=e.i(9583),r=o.forwardRef(function(e,r){return o.createElement(s.default,(0,t.default)({},e,{ref:r,icon:n}))});e.s(["KeyOutlined",0,r],438957)},596239,e=>{"use strict";e.i(247167);var t=e.i(931067),o=e.i(271645);let n={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M574 665.4a8.03 8.03 0 00-11.3 0L446.5 781.6c-53.8 53.8-144.6 59.5-204 0-59.5-59.5-53.8-150.2 0-204l116.2-116.2c3.1-3.1 3.1-8.2 0-11.3l-39.8-39.8a8.03 8.03 0 00-11.3 0L191.4 526.5c-84.6 84.6-84.6 221.5 0 306s221.5 84.6 306 0l116.2-116.2c3.1-3.1 3.1-8.2 0-11.3L574 665.4zm258.6-474c-84.6-84.6-221.5-84.6-306 0L410.3 307.6a8.03 8.03 0 000 11.3l39.7 39.7c3.1 3.1 8.2 3.1 11.3 0l116.2-116.2c53.8-53.8 144.6-59.5 204 0 59.5 59.5 53.8 150.2 0 204L665.3 562.6a8.03 8.03 0 000 11.3l39.8 39.8c3.1 3.1 8.2 3.1 11.3 0l116.2-116.2c84.5-84.6 84.5-221.5 0-306.1zM610.1 372.3a8.03 8.03 0 00-11.3 0L372.3 598.7a8.03 8.03 0 000 11.3l39.6 39.6c3.1 3.1 8.2 3.1 11.3 0l226.4-226.4c3.1-3.1 3.1-8.2 0-11.3l-39.5-39.6z"}}]},name:"link",theme:"outlined"};var s=e.i(9583),r=o.forwardRef(function(e,r){return o.createElement(s.default,(0,t.default)({},e,{ref:r,icon:n}))});e.s(["LinkOutlined",0,r],596239)},516015,(e,t,o)=>{},898547,(e,t,o)=>{var n=e.i(247167);e.r(516015);var s=e.r(271645),r=s&&"object"==typeof s&&"default"in s?s:{default:s},i=void 0!==n.default&&n.default.env&&!0,l=function(e){return"[object String]"===Object.prototype.toString.call(e)},a=function(){function e(e){var t=void 0===e?{}:e,o=t.name,n=void 0===o?"stylesheet":o,s=t.optimizeForSpeed,r=void 0===s?i:s;c(l(n),"`name` must be a string"),this._name=n,this._deletedRulePlaceholder="#"+n+"-deleted-rule____{}",c("boolean"==typeof r,"`optimizeForSpeed` must be a boolean"),this._optimizeForSpeed=r,this._serverSheet=void 0,this._tags=[],this._injected=!1,this._rulesCount=0;var a="u">typeof window&&document.querySelector('meta[property="csp-nonce"]');this._nonce=a?a.getAttribute("content"):null}var t,o=e.prototype;return o.setOptimizeForSpeed=function(e){c("boolean"==typeof e,"`setOptimizeForSpeed` accepts a boolean"),c(0===this._rulesCount,"optimizeForSpeed cannot be when rules have already been inserted"),this.flush(),this._optimizeForSpeed=e,this.inject()},o.isOptimizeForSpeed=function(){return this._optimizeForSpeed},o.inject=function(){var e=this;if(c(!this._injected,"sheet already injected"),this._injected=!0,"u">typeof window&&this._optimizeForSpeed){this._tags[0]=this.makeStyleTag(this._name),this._optimizeForSpeed="insertRule"in this.getSheet(),this._optimizeForSpeed||(i||console.warn("StyleSheet: optimizeForSpeed mode not supported falling back to standard mode."),this.flush(),this._injected=!0);return}this._serverSheet={cssRules:[],insertRule:function(t,o){return"number"==typeof o?e._serverSheet.cssRules[o]={cssText:t}:e._serverSheet.cssRules.push({cssText:t}),o},deleteRule:function(t){e._serverSheet.cssRules[t]=null}}},o.getSheetForTag=function(e){if(e.sheet)return e.sheet;for(var t=0;ttypeof window?this.getSheet():this._serverSheet;if(t.trim()||(t=this._deletedRulePlaceholder),!o.cssRules[e])return e;o.deleteRule(e);try{o.insertRule(t,e)}catch(n){i||console.warn("StyleSheet: illegal rule: \n\n"+t+"\n\nSee https://stackoverflow.com/q/20007992 for more info"),o.insertRule(this._deletedRulePlaceholder,e)}}else{var n=this._tags[e];c(n,"old rule at index `"+e+"` not found"),n.textContent=t}return e},o.deleteRule=function(e){if("u"typeof window?(this._tags.forEach(function(e){return e&&e.parentNode.removeChild(e)}),this._tags=[]):this._serverSheet.cssRules=[]},o.cssRules=function(){var e=this;return"u">>0},d={};function u(e,t){if(!t)return"jsx-"+e;var o=String(t),n=e+o;return d[n]||(d[n]="jsx-"+p(e+"-"+o)),d[n]}function m(e,t){"u"typeof window&&!this._fromServer&&(this._fromServer=this.selectFromServer(),this._instancesCounts=Object.keys(this._fromServer).reduce(function(e,t){return e[t]=0,e},{}));var o=this.getIdAndRules(e),n=o.styleId,s=o.rules;if(n in this._instancesCounts){this._instancesCounts[n]+=1;return}var r=s.map(function(e){return t._sheet.insertRule(e)}).filter(function(e){return -1!==e});this._indices[n]=r,this._instancesCounts[n]=1},t.remove=function(e){var t=this,o=this.getIdAndRules(e).styleId;if(function(e,t){if(!e)throw Error("StyleSheetRegistry: "+t+".")}(o in this._instancesCounts,"styleId: `"+o+"` not found"),this._instancesCounts[o]-=1,this._instancesCounts[o]<1){var n=this._fromServer&&this._fromServer[o];n?(n.parentNode.removeChild(n),delete this._fromServer[o]):(this._indices[o].forEach(function(e){return t._sheet.deleteRule(e)}),delete this._indices[o]),delete this._instancesCounts[o]}},t.update=function(e,t){this.add(t),this.remove(e)},t.flush=function(){this._sheet.flush(),this._sheet.inject(),this._fromServer=void 0,this._indices={},this._instancesCounts={}},t.cssRules=function(){var e=this,t=this._fromServer?Object.keys(this._fromServer).map(function(t){return[t,e._fromServer[t]]}):[],o=this._sheet.cssRules();return t.concat(Object.keys(this._indices).map(function(t){return[t,e._indices[t].map(function(e){return o[e].cssText}).join(e._optimizeForSpeed?"":"\n")]}).filter(function(e){return!!e[1]}))},t.styles=function(e){var t,o;return t=this.cssRules(),void 0===(o=e)&&(o={}),t.map(function(e){var t=e[0],n=e[1];return r.default.createElement("style",{id:"__"+t,key:"__"+t,nonce:o.nonce?o.nonce:void 0,dangerouslySetInnerHTML:{__html:n}})})},t.getIdAndRules=function(e){var t=e.children,o=e.dynamic,n=e.id;if(o){var s=u(n,o);return{styleId:s,rules:Array.isArray(t)?t.map(function(e){return m(s,e)}):[m(s,t)]}}return{styleId:u(n),rules:Array.isArray(t)?t:[t]}},t.selectFromServer=function(){return Array.prototype.slice.call(document.querySelectorAll('[id^="__jsx-"]')).reduce(function(e,t){return e[t.id.slice(2)]=t,e},{})},e}(),h=s.createContext(null);function g(){return new f}function _(){return s.useContext(h)}h.displayName="StyleSheetContext";var b=r.default.useInsertionEffect||r.default.useLayoutEffect,v="u">typeof window?g():void 0;function y(e){var t=v||_();return t&&("u"{t.exports=e.r(898547).style}]); \ No newline at end of file diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/b3b05b76472ce110.js b/litellm/proxy/_experimental/out/_next/static/chunks/1501e804b4d0f510.js similarity index 85% rename from litellm/proxy/_experimental/out/_next/static/chunks/b3b05b76472ce110.js rename to litellm/proxy/_experimental/out/_next/static/chunks/1501e804b4d0f510.js index 0baa18f3f1..9d00552d0e 100644 --- a/litellm/proxy/_experimental/out/_next/static/chunks/b3b05b76472ce110.js +++ b/litellm/proxy/_experimental/out/_next/static/chunks/1501e804b4d0f510.js @@ -1 +1 @@ -(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,743151,(e,t,r)=>{"use strict";function s(e){return(s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}Object.defineProperty(r,"__esModule",{value:!0}),r.CopyToClipboard=void 0;var a=n(e.r(271645)),l=n(e.r(844343)),i=["text","onCopy","options","children"];function n(e){return e&&e.__esModule?e:{default:e}}function o(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,s)}return r}function c(e){for(var t=1;t=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(s=0;s=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}(e,i),s=a.default.Children.only(t);return a.default.cloneElement(s,c(c({},r),{},{onClick:this.onClick}))}}],function(e,t){for(var r=0;r{"use strict";var s=e.r(743151).CopyToClipboard;s.CopyToClipboard=s,t.exports=s},645526,e=>{"use strict";e.i(247167);var t=e.i(931067),r=e.i(271645);let s={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M824.2 699.9a301.55 301.55 0 00-86.4-60.4C783.1 602.8 812 546.8 812 484c0-110.8-92.4-201.7-203.2-200-109.1 1.7-197 90.6-197 200 0 62.8 29 118.8 74.2 155.5a300.95 300.95 0 00-86.4 60.4C345 754.6 314 826.8 312 903.8a8 8 0 008 8.2h56c4.3 0 7.9-3.4 8-7.7 1.9-58 25.4-112.3 66.7-153.5A226.62 226.62 0 01612 684c60.9 0 118.2 23.7 161.3 66.8C814.5 792 838 846.3 840 904.3c.1 4.3 3.7 7.7 8 7.7h56a8 8 0 008-8.2c-2-77-33-149.2-87.8-203.9zM612 612c-34.2 0-66.4-13.3-90.5-37.5a126.86 126.86 0 01-37.5-91.8c.3-32.8 13.4-64.5 36.3-88 24-24.6 56.1-38.3 90.4-38.7 33.9-.3 66.8 12.9 91 36.6 24.8 24.3 38.4 56.8 38.4 91.4 0 34.2-13.3 66.3-37.5 90.5A127.3 127.3 0 01612 612zM361.5 510.4c-.9-8.7-1.4-17.5-1.4-26.4 0-15.9 1.5-31.4 4.3-46.5.7-3.6-1.2-7.3-4.5-8.8-13.6-6.1-26.1-14.5-36.9-25.1a127.54 127.54 0 01-38.7-95.4c.9-32.1 13.8-62.6 36.3-85.6 24.7-25.3 57.9-39.1 93.2-38.7 31.9.3 62.7 12.6 86 34.4 7.9 7.4 14.7 15.6 20.4 24.4 2 3.1 5.9 4.4 9.3 3.2 17.6-6.1 36.2-10.4 55.3-12.4 5.6-.6 8.8-6.6 6.3-11.6-32.5-64.3-98.9-108.7-175.7-109.9-110.9-1.7-203.3 89.2-203.3 199.9 0 62.8 28.9 118.8 74.2 155.5-31.8 14.7-61.1 35-86.5 60.4-54.8 54.7-85.8 126.9-87.8 204a8 8 0 008 8.2h56.1c4.3 0 7.9-3.4 8-7.7 1.9-58 25.4-112.3 66.7-153.5 29.4-29.4 65.4-49.8 104.7-59.7 3.9-1 6.5-4.7 6-8.7z"}}]},name:"team",theme:"outlined"};var a=e.i(9583),l=r.forwardRef(function(e,l){return r.createElement(a.default,(0,t.default)({},e,{ref:l,icon:s}))});e.s(["TeamOutlined",0,l],645526)},983561,e=>{"use strict";e.i(247167);var t=e.i(931067),r=e.i(271645);let s={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M300 328a60 60 0 10120 0 60 60 0 10-120 0zM852 64H172c-17.7 0-32 14.3-32 32v660c0 17.7 14.3 32 32 32h680c17.7 0 32-14.3 32-32V96c0-17.7-14.3-32-32-32zm-32 660H204V128h616v596zM604 328a60 60 0 10120 0 60 60 0 10-120 0zm250.2 556H169.8c-16.5 0-29.8 14.3-29.8 32v36c0 4.4 3.3 8 7.4 8h729.1c4.1 0 7.4-3.6 7.4-8v-36c.1-17.7-13.2-32-29.7-32zM664 508H360c-4.4 0-8 3.6-8 8v60c0 4.4 3.6 8 8 8h304c4.4 0 8-3.6 8-8v-60c0-4.4-3.6-8-8-8z"}}]},name:"robot",theme:"outlined"};var a=e.i(9583),l=r.forwardRef(function(e,l){return r.createElement(a.default,(0,t.default)({},e,{ref:l,icon:s}))});e.s(["RobotOutlined",0,l],983561)},631171,e=>{"use strict";let t=(0,e.i(475254).default)("chevron-down",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);e.s(["default",()=>t])},621482,e=>{"use strict";var t=e.i(869230),r=e.i(992571),s=class extends t.QueryObserver{constructor(e,t){super(e,t)}bindMethods(){super.bindMethods(),this.fetchNextPage=this.fetchNextPage.bind(this),this.fetchPreviousPage=this.fetchPreviousPage.bind(this)}setOptions(e){super.setOptions({...e,behavior:(0,r.infiniteQueryBehavior)()})}getOptimisticResult(e){return e.behavior=(0,r.infiniteQueryBehavior)(),super.getOptimisticResult(e)}fetchNextPage(e){return this.fetch({...e,meta:{fetchMore:{direction:"forward"}}})}fetchPreviousPage(e){return this.fetch({...e,meta:{fetchMore:{direction:"backward"}}})}createResult(e,t){let{state:s}=e,a=super.createResult(e,t),{isFetching:l,isRefetching:i,isError:n,isRefetchError:o}=a,c=s.fetchMeta?.fetchMore?.direction,d=n&&"forward"===c,u=l&&"forward"===c,m=n&&"backward"===c,p=l&&"backward"===c;return{...a,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:(0,r.hasNextPage)(t,s.data),hasPreviousPage:(0,r.hasPreviousPage)(t,s.data),isFetchNextPageError:d,isFetchingNextPage:u,isFetchPreviousPageError:m,isFetchingPreviousPage:p,isRefetchError:o&&!d&&!m,isRefetching:i&&!u&&!p}}},a=e.i(469637);function l(e,t){return(0,a.useBaseQuery)(e,s,t)}e.s(["useInfiniteQuery",()=>l],621482)},270345,e=>{"use strict";var t=e.i(764205);let r=async(e,r,s,a)=>"Admin"!=s&&"Admin Viewer"!=s?await (0,t.teamListCall)(e,a?.organization_id||null,r):await (0,t.teamListCall)(e,a?.organization_id||null);e.s(["fetchTeams",0,r])},785242,e=>{"use strict";var t=e.i(619273),r=e.i(621482),s=e.i(266027),a=e.i(912598),l=e.i(135214),i=e.i(270345),n=e.i(243652),o=e.i(764205);let c=async(e,t,r,s={})=>{try{let a=(0,o.getProxyBaseUrl)(),l=new URLSearchParams(Object.entries({team_id:s.teamID,organization_id:s.organizationID,team_alias:s.team_alias,user_id:s.userID,page:t,page_size:r,sort_by:s.sortBy,sort_order:s.sortOrder,status:s.status}).filter(([,e])=>null!=e).map(([e,t])=>[e,String(t)])),i=`${a?`${a}/v2/team/list`:"/v2/team/list"}?${l}`,n=await fetch(i,{method:"GET",headers:{[(0,o.getGlobalLitellmHeaderName)()]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!n.ok){let e=await n.json(),t=(0,o.deriveErrorMessage)(e);throw(0,o.handleError)(t),Error(t)}let c=await n.json();return console.log("/v2/team/list API Response:",c),c}catch(e){throw console.error("Failed to list teams:",e),e}},d=(0,n.createQueryKeys)("teams"),u=(0,n.createQueryKeys)("infiniteTeams"),m=async(e,t,r,s={})=>{try{let a=(0,o.getProxyBaseUrl)(),l=new URLSearchParams(Object.entries({team_id:s.teamID,organization_id:s.organizationID,team_alias:s.team_alias,user_id:s.userID,page:t,page_size:r,sort_by:s.sortBy,sort_order:s.sortOrder,status:"deleted"}).filter(([,e])=>null!=e).map(([e,t])=>[e,String(t)])),i=`${a?`${a}/v2/team/list`:"/v2/team/list"}?${l}`,n=await fetch(i,{method:"GET",headers:{[(0,o.getGlobalLitellmHeaderName)()]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!n.ok){let e=await n.json(),t=(0,o.deriveErrorMessage)(e);throw(0,o.handleError)(t),Error(t)}let c=await n.json();if(console.log("/team/list?status=deleted API Response:",c),c&&"object"==typeof c&&"teams"in c)return c.teams;return c}catch(e){throw console.error("Failed to list deleted teams:",e),e}},p=(0,n.createQueryKeys)("deletedTeams");e.s(["teamListCall",0,c,"useDeletedTeams",0,(e,r,a={})=>{let{accessToken:i}=(0,l.default)();return(0,s.useQuery)({queryKey:p.list({page:e,limit:r,...a}),queryFn:async()=>await m(i,e,r,a),enabled:!!i,staleTime:3e4,placeholderData:t.keepPreviousData})},"useInfiniteTeams",0,(e=50,t,s)=>{let{accessToken:a,userId:i,userRole:n}=(0,l.default)(),o="Admin"===n||"Admin Viewer"===n;return(0,r.useInfiniteQuery)({queryKey:u.list({filters:{pageSize:e,...t&&{search:t},...s&&{organizationId:s},...i&&{userId:i}}}),queryFn:async({pageParam:r})=>await c(a,r,e,{team_alias:t||void 0,organizationID:s,userID:o?void 0:i}),initialPageParam:1,getNextPageParam:e=>{if(e.page{let{accessToken:t}=(0,l.default)(),r=(0,a.useQueryClient)();return(0,s.useQuery)({queryKey:d.detail(e),enabled:!!(t&&e),queryFn:async()=>{if(!t||!e)throw Error("Missing auth or teamId");return(0,o.teamInfoCall)(t,e)},initialData:()=>{if(!e)return;let t=r.getQueryData(d.list({}));return t?.find(t=>t.team_id===e)}})},"useTeams",0,()=>{let{accessToken:e,userId:t,userRole:r}=(0,l.default)();return(0,s.useQuery)({queryKey:d.list({}),queryFn:async()=>await (0,i.fetchTeams)(e,t,r,null),enabled:!!e})}])},109799,e=>{"use strict";var t=e.i(135214),r=e.i(764205),s=e.i(266027),a=e.i(912598);let l=(0,e.i(243652).createQueryKeys)("organizations");e.s(["useOrganization",0,e=>{let i=(0,a.useQueryClient)(),{accessToken:n}=(0,t.default)();return(0,s.useQuery)({queryKey:l.detail(e),enabled:!!(n&&e),queryFn:async()=>{if(!n||!e)throw Error("Missing auth or teamId");return(0,r.organizationInfoCall)(n,e)},initialData:()=>{if(!e)return;let t=i.getQueryData(l.list({}));return t?.find(t=>t.organization_id===e)}})},"useOrganizations",0,()=>{let{accessToken:e,userId:a,userRole:i}=(0,t.default)();return(0,s.useQuery)({queryKey:l.list({}),queryFn:async()=>await (0,r.organizationListCall)(e),enabled:!!(e&&a&&i)})}])},793130,e=>{"use strict";var t=e.i(290571),r=e.i(429427),s=e.i(371330),a=e.i(271645),l=e.i(394487),i=e.i(503269),n=e.i(214520),o=e.i(746725),c=e.i(914189),d=e.i(144279),u=e.i(294316),m=e.i(601893),p=e.i(140721),h=e.i(942803),g=e.i(233538),f=e.i(694421),x=e.i(700020),y=e.i(35889),b=e.i(998348),v=e.i(722678);let _=(0,a.createContext)(null);_.displayName="GroupContext";let j=a.Fragment,w=Object.assign((0,x.forwardRefWithAs)(function(e,t){var j;let w=(0,a.useId)(),k=(0,h.useProvidedId)(),N=(0,m.useDisabled)(),{id:C=k||`headlessui-switch-${w}`,disabled:S=N||!1,checked:T,defaultChecked:E,onChange:O,name:I,value:M,form:P,autoFocus:A=!1,...L}=e,R=(0,a.useContext)(_),[F,D]=(0,a.useState)(null),B=(0,a.useRef)(null),$=(0,u.useSyncRefs)(B,t,null===R?null:R.setSwitch,D),z=(0,n.useDefaultValue)(E),[K,U]=(0,i.useControllable)(T,O,null!=z&&z),q=(0,o.useDisposables)(),[V,G]=(0,a.useState)(!1),H=(0,c.useEvent)(()=>{G(!0),null==U||U(!K),q.nextFrame(()=>{G(!1)})}),W=(0,c.useEvent)(e=>{if((0,g.isDisabledReactIssue7711)(e.currentTarget))return e.preventDefault();e.preventDefault(),H()}),Q=(0,c.useEvent)(e=>{e.key===b.Keys.Space?(e.preventDefault(),H()):e.key===b.Keys.Enter&&(0,f.attemptSubmit)(e.currentTarget)}),J=(0,c.useEvent)(e=>e.preventDefault()),Y=(0,v.useLabelledBy)(),X=(0,y.useDescribedBy)(),{isFocusVisible:Z,focusProps:ee}=(0,r.useFocusRing)({autoFocus:A}),{isHovered:et,hoverProps:er}=(0,s.useHover)({isDisabled:S}),{pressed:es,pressProps:ea}=(0,l.useActivePress)({disabled:S}),el=(0,a.useMemo)(()=>({checked:K,disabled:S,hover:et,focus:Z,active:es,autofocus:A,changing:V}),[K,et,Z,es,S,V,A]),ei=(0,x.mergeProps)({id:C,ref:$,role:"switch",type:(0,d.useResolveButtonType)(e,F),tabIndex:-1===e.tabIndex?0:null!=(j=e.tabIndex)?j:0,"aria-checked":K,"aria-labelledby":Y,"aria-describedby":X,disabled:S||void 0,autoFocus:A,onClick:W,onKeyUp:Q,onKeyPress:J},ee,er,ea),en=(0,a.useCallback)(()=>{if(void 0!==z)return null==U?void 0:U(z)},[U,z]),eo=(0,x.useRender)();return a.default.createElement(a.default.Fragment,null,null!=I&&a.default.createElement(p.FormFields,{disabled:S,data:{[I]:M||"on"},overrides:{type:"checkbox",checked:K},form:P,onReset:en}),eo({ourProps:ei,theirProps:L,slot:el,defaultTag:"button",name:"Switch"}))}),{Group:function(e){var t;let[r,s]=(0,a.useState)(null),[l,i]=(0,v.useLabels)(),[n,o]=(0,y.useDescriptions)(),c=(0,a.useMemo)(()=>({switch:r,setSwitch:s}),[r,s]),d=(0,x.useRender)();return a.default.createElement(o,{name:"Switch.Description",value:n},a.default.createElement(i,{name:"Switch.Label",value:l,props:{htmlFor:null==(t=c.switch)?void 0:t.id,onClick(e){r&&(e.currentTarget instanceof HTMLLabelElement&&e.preventDefault(),r.click(),r.focus({preventScroll:!0}))}}},a.default.createElement(_.Provider,{value:c},d({ourProps:{},theirProps:e,slot:{},defaultTag:j,name:"Switch.Group"}))))},Label:v.Label,Description:y.Description});var k=e.i(888288),N=e.i(95779),C=e.i(444755),S=e.i(673706),T=e.i(829087);let E=(0,S.makeClassName)("Switch"),O=a.default.forwardRef((e,r)=>{let{checked:s,defaultChecked:l=!1,onChange:i,color:n,name:o,error:c,errorMessage:d,disabled:u,required:m,tooltip:p,id:h}=e,g=(0,t.__rest)(e,["checked","defaultChecked","onChange","color","name","error","errorMessage","disabled","required","tooltip","id"]),f={bgColor:n?(0,S.getColorClassNames)(n,N.colorPalette.background).bgColor:"bg-tremor-brand dark:bg-dark-tremor-brand",ringColor:n?(0,S.getColorClassNames)(n,N.colorPalette.ring).ringColor:"ring-tremor-brand-muted dark:ring-dark-tremor-brand-muted"},[x,y]=(0,k.default)(l,s),[b,v]=(0,a.useState)(!1),{tooltipProps:_,getReferenceProps:j}=(0,T.useTooltip)(300);return a.default.createElement("div",{className:"flex flex-row items-center justify-start"},a.default.createElement(T.default,Object.assign({text:p},_)),a.default.createElement("div",Object.assign({ref:(0,S.mergeRefs)([r,_.refs.setReference]),className:(0,C.tremorTwMerge)(E("root"),"flex flex-row relative h-5")},g,j),a.default.createElement("input",{type:"checkbox",className:(0,C.tremorTwMerge)(E("input"),"absolute w-5 h-5 cursor-pointer left-0 top-0 opacity-0"),name:o,required:m,checked:x,onChange:e=>{e.preventDefault()}}),a.default.createElement(w,{checked:x,onChange:e=>{y(e),null==i||i(e)},disabled:u,className:(0,C.tremorTwMerge)(E("switch"),"w-10 h-5 group relative inline-flex shrink-0 cursor-pointer items-center justify-center rounded-tremor-full","focus:outline-none",u?"cursor-not-allowed":""),onFocus:()=>v(!0),onBlur:()=>v(!1),id:h},a.default.createElement("span",{className:(0,C.tremorTwMerge)(E("sr-only"),"sr-only")},"Switch ",x?"on":"off"),a.default.createElement("span",{"aria-hidden":"true",className:(0,C.tremorTwMerge)(E("background"),x?f.bgColor:"bg-tremor-border dark:bg-dark-tremor-border","pointer-events-none absolute mx-auto h-3 w-9 rounded-tremor-full transition-colors duration-100 ease-in-out")}),a.default.createElement("span",{"aria-hidden":"true",className:(0,C.tremorTwMerge)(E("round"),x?(0,C.tremorTwMerge)(f.bgColor,"translate-x-5 border-tremor-background dark:border-dark-tremor-background"):"translate-x-0 bg-tremor-border dark:bg-dark-tremor-border border-tremor-background dark:border-dark-tremor-background","pointer-events-none absolute left-0 inline-block h-5 w-5 transform rounded-tremor-full border-2 shadow-tremor-input duration-100 ease-in-out transition",b?(0,C.tremorTwMerge)("ring-2",f.ringColor):"")}))),c&&d?a.default.createElement("p",{className:(0,C.tremorTwMerge)(E("errorMessage"),"text-sm text-red-500 mt-1 ")},d):null)});O.displayName="Switch",e.s(["Switch",()=>O],793130)},107233,37727,e=>{"use strict";var t=e.i(603908);e.s(["Plus",()=>t.default],107233);var r=e.i(841947);e.s(["X",()=>r.default],37727)},361653,e=>{"use strict";let t=(0,e.i(475254).default)("circle-alert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]]);e.s(["default",()=>t])},841947,e=>{"use strict";let t=(0,e.i(475254).default)("x",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);e.s(["default",()=>t])},603908,e=>{"use strict";let t=(0,e.i(475254).default)("plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);e.s(["default",()=>t])},158392,419470,e=>{"use strict";var t=e.i(843476),r=e.i(779241);let s={ttl:3600,lowest_latency_buffer:0},a=({routingStrategyArgs:e})=>{let a={ttl:"Sliding window to look back over when calculating the average latency of a deployment. Default - 1 hour (in seconds).",lowest_latency_buffer:"Shuffle between deployments within this % of the lowest latency. Default - 0 (i.e. always pick lowest latency)."};return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:"space-y-6",children:[(0,t.jsxs)("div",{className:"max-w-3xl",children:[(0,t.jsx)("h3",{className:"text-sm font-medium text-gray-900",children:"Latency-Based Configuration"}),(0,t.jsx)("p",{className:"text-xs text-gray-500 mt-1",children:"Fine-tune latency-based routing behavior"})]}),(0,t.jsx)("div",{className:"grid grid-cols-1 gap-6 lg:grid-cols-2 xl:grid-cols-3",children:Object.entries(e||s).map(([e,s])=>(0,t.jsx)("div",{className:"space-y-2",children:(0,t.jsxs)("label",{className:"block",children:[(0,t.jsx)("span",{className:"text-xs font-medium text-gray-700 uppercase tracking-wide",children:e.replace(/_/g," ")}),(0,t.jsx)("p",{className:"text-xs text-gray-500 mt-0.5 mb-2",children:a[e]||""}),(0,t.jsx)(r.TextInput,{name:e,defaultValue:"object"==typeof s?JSON.stringify(s,null,2):s?.toString(),className:"font-mono text-sm w-full"})]})},e))})]}),(0,t.jsx)("div",{className:"border-t border-gray-200"})]})},l=({routerSettings:e,routerFieldsMetadata:s})=>(0,t.jsxs)("div",{className:"space-y-6",children:[(0,t.jsxs)("div",{className:"max-w-3xl",children:[(0,t.jsx)("h3",{className:"text-sm font-medium text-gray-900",children:"Reliability & Retries"}),(0,t.jsx)("p",{className:"text-xs text-gray-500 mt-1",children:"Configure retry logic and failure handling"})]}),(0,t.jsx)("div",{className:"grid grid-cols-1 gap-6 lg:grid-cols-2 xl:grid-cols-3",children:Object.entries(e).filter(([e,t])=>"fallbacks"!=e&&"context_window_fallbacks"!=e&&"routing_strategy_args"!=e&&"routing_strategy"!=e&&"enable_tag_filtering"!=e).map(([e,a])=>(0,t.jsx)("div",{className:"space-y-2",children:(0,t.jsxs)("label",{className:"block",children:[(0,t.jsx)("span",{className:"text-xs font-medium text-gray-700 uppercase tracking-wide",children:s[e]?.ui_field_name||e}),(0,t.jsx)("p",{className:"text-xs text-gray-500 mt-0.5 mb-2",children:s[e]?.field_description||""}),(0,t.jsx)(r.TextInput,{name:e,defaultValue:null==a||"null"===a?"":"object"==typeof a?JSON.stringify(a,null,2):a?.toString()||"",placeholder:"—",className:"font-mono text-sm w-full"})]})},e))})]});var i=e.i(199133);let n=({selectedStrategy:e,availableStrategies:r,routingStrategyDescriptions:s,routerFieldsMetadata:a,onStrategyChange:l})=>(0,t.jsxs)("div",{className:"space-y-2 max-w-3xl",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"text-xs font-medium text-gray-700 uppercase tracking-wide",children:a.routing_strategy?.ui_field_name||"Routing Strategy"}),(0,t.jsx)("p",{className:"text-xs text-gray-500 mt-0.5 mb-2",children:a.routing_strategy?.field_description||""})]}),(0,t.jsx)("div",{className:"routing-strategy-select max-w-3xl",children:(0,t.jsx)(i.Select,{value:e,onChange:l,style:{width:"100%"},size:"large",children:r.map(e=>(0,t.jsx)(i.Select.Option,{value:e,label:e,children:(0,t.jsxs)("div",{className:"flex flex-col gap-0.5 py-1",children:[(0,t.jsx)("span",{className:"font-mono text-sm font-medium",children:e}),s[e]&&(0,t.jsx)("span",{className:"text-xs text-gray-500 font-normal",children:s[e]})]})},e))})})]});var o=e.i(793130);let c=({enabled:e,routerFieldsMetadata:r,onToggle:s})=>(0,t.jsx)("div",{className:"space-y-3 max-w-3xl",children:(0,t.jsxs)("div",{className:"flex items-start justify-between",children:[(0,t.jsxs)("div",{className:"flex-1",children:[(0,t.jsx)("label",{className:"text-xs font-medium text-gray-700 uppercase tracking-wide",children:r.enable_tag_filtering?.ui_field_name||"Enable Tag Filtering"}),(0,t.jsxs)("p",{className:"text-xs text-gray-500 mt-0.5",children:[r.enable_tag_filtering?.field_description||"",r.enable_tag_filtering?.link&&(0,t.jsxs)(t.Fragment,{children:[" ",(0,t.jsx)("a",{href:r.enable_tag_filtering.link,target:"_blank",rel:"noopener noreferrer",className:"text-blue-600 hover:text-blue-800 underline",children:"Learn more"})]})]})]}),(0,t.jsx)(o.Switch,{checked:e,onChange:s,className:"ml-4"})]})});e.s(["default",0,({value:e,onChange:r,routerFieldsMetadata:s,availableRoutingStrategies:i,routingStrategyDescriptions:o})=>(0,t.jsxs)("div",{className:"w-full space-y-8 py-2",children:[(0,t.jsxs)("div",{className:"space-y-6",children:[(0,t.jsxs)("div",{className:"max-w-3xl",children:[(0,t.jsx)("h3",{className:"text-sm font-medium text-gray-900",children:"Routing Settings"}),(0,t.jsx)("p",{className:"text-xs text-gray-500 mt-1",children:"Configure how requests are routed to deployments"})]}),i.length>0&&(0,t.jsx)(n,{selectedStrategy:e.selectedStrategy||e.routerSettings.routing_strategy||null,availableStrategies:i,routingStrategyDescriptions:o,routerFieldsMetadata:s,onStrategyChange:t=>{r({...e,selectedStrategy:t})}}),(0,t.jsx)(c,{enabled:e.enableTagFiltering,routerFieldsMetadata:s,onToggle:t=>{r({...e,enableTagFiltering:t})}})]}),(0,t.jsx)("div",{className:"border-t border-gray-200"}),"latency-based-routing"===e.selectedStrategy&&(0,t.jsx)(a,{routingStrategyArgs:e.routerSettings.routing_strategy_args}),(0,t.jsx)(l,{routerSettings:e.routerSettings,routerFieldsMetadata:s})]})],158392);var d=e.i(994388),u=e.i(653496),m=e.i(107233),p=e.i(271645),h=e.i(888259),g=e.i(592968),f=e.i(361653),f=f;let x=(0,e.i(475254).default)("arrow-down",[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]]);var y=e.i(37727);function b({group:e,onChange:r,availableModels:s,maxFallbacks:a}){let l=s.filter(t=>t!==e.primaryModel),n=e.fallbackModels.length{let s=[...e.fallbackModels];s.includes(t)&&(s=s.filter(e=>e!==t)),r({...e,primaryModel:t,fallbackModels:s})},showSearch:!0,getPopupContainer:e=>e.parentElement||document.body,filterOption:(e,t)=>(t?.label??"").toLowerCase().includes(e.toLowerCase()),options:s.map(e=>({label:e,value:e}))}),!e.primaryModel&&(0,t.jsxs)("div",{className:"mt-2 flex items-center gap-2 text-amber-600 text-xs bg-amber-50 p-2 rounded",children:[(0,t.jsx)(f.default,{className:"w-4 h-4"}),(0,t.jsx)("span",{children:"Select a model to begin configuring fallbacks"})]})]}),(0,t.jsx)("div",{className:"flex items-center justify-center -my-4 z-10",children:(0,t.jsxs)("div",{className:"bg-indigo-50 text-indigo-500 px-4 py-1 rounded-full text-xs font-bold border border-indigo-100 flex items-center gap-2 shadow-sm",children:[(0,t.jsx)(x,{className:"w-4 h-4"}),"IF FAILS, TRY..."]})}),(0,t.jsxs)("div",{className:`transition-opacity duration-300 ${!e.primaryModel?"opacity-50 pointer-events-none":"opacity-100"}`,children:[(0,t.jsxs)("label",{className:"block text-sm font-semibold text-gray-700 mb-2",children:["Fallback Chain ",(0,t.jsx)("span",{className:"text-red-500",children:"*"}),(0,t.jsxs)("span",{className:"text-xs text-gray-500 font-normal ml-2",children:["(Max ",a," fallbacks at a time)"]})]}),(0,t.jsxs)("div",{className:"bg-gray-50 rounded-xl p-4 border border-gray-200",children:[(0,t.jsxs)("div",{className:"mb-4",children:[(0,t.jsx)(i.Select,{mode:"multiple",className:"w-full",size:"large",placeholder:n?"Select fallback models to add...":`Maximum ${a} fallbacks reached`,value:e.fallbackModels,onChange:t=>{let s=t.slice(0,a);r({...e,fallbackModels:s})},disabled:!e.primaryModel,getPopupContainer:e=>e.parentElement||document.body,options:l.map(e=>({label:e,value:e})),optionRender:(r,s)=>{let a=e.fallbackModels.includes(r.value),l=a?e.fallbackModels.indexOf(r.value)+1:null;return(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[a&&null!==l&&(0,t.jsx)("span",{className:"flex items-center justify-center w-5 h-5 rounded bg-indigo-100 text-indigo-600 text-xs font-bold",children:l}),(0,t.jsx)("span",{children:r.label})]})},maxTagCount:"responsive",maxTagPlaceholder:e=>(0,t.jsx)(g.Tooltip,{styles:{root:{pointerEvents:"none"}},title:e.map(({value:e})=>e).join(", "),children:(0,t.jsxs)("span",{children:["+",e.length," more"]})}),showSearch:!0,filterOption:(e,t)=>(t?.label??"").toLowerCase().includes(e.toLowerCase())}),(0,t.jsx)("p",{className:"text-xs text-gray-500 mt-1 ml-1",children:n?`Search and select multiple models. Selected models will appear below in order. (${e.fallbackModels.length}/${a} used)`:`Maximum ${a} fallbacks reached. Remove some to add more.`})]}),(0,t.jsx)("div",{className:"space-y-2 min-h-[100px]",children:0===e.fallbackModels.length?(0,t.jsxs)("div",{className:"h-32 border-2 border-dashed border-gray-300 rounded-lg flex flex-col items-center justify-center text-gray-400",children:[(0,t.jsx)("span",{className:"text-sm",children:"No fallback models selected"}),(0,t.jsx)("span",{className:"text-xs mt-1",children:"Add models from the dropdown above"})]}):e.fallbackModels.map((s,a)=>(0,t.jsxs)("div",{className:"group flex items-center justify-between p-3 bg-white rounded-lg border border-gray-200 hover:border-indigo-300 hover:shadow-sm transition-all",children:[(0,t.jsxs)("div",{className:"flex items-center gap-3",children:[(0,t.jsx)("div",{className:"flex items-center justify-center w-6 h-6 rounded bg-gray-100 text-gray-400 group-hover:text-indigo-500 group-hover:bg-indigo-50",children:(0,t.jsx)("span",{className:"text-xs font-bold",children:a+1})}),(0,t.jsx)("div",{children:(0,t.jsx)("span",{className:"font-medium text-gray-800",children:s})})]}),(0,t.jsx)("button",{type:"button",onClick:()=>{let t;return t=e.fallbackModels.filter((e,t)=>t!==a),void r({...e,fallbackModels:t})},className:"opacity-0 group-hover:opacity-100 transition-opacity text-gray-400 hover:text-red-500 p-1",children:(0,t.jsx)(y.X,{className:"w-4 h-4"})})]},`${s}-${a}`))})]})]})]})}function v({groups:e,onGroupsChange:r,availableModels:s,maxFallbacks:a=10,maxGroups:l=5}){let[i,n]=(0,p.useState)(e.length>0?e[0].id:"1");(0,p.useEffect)(()=>{e.length>0?e.some(e=>e.id===i)||n(e[0].id):n("1")},[e]);let o=()=>{if(e.length>=l)return;let t=Date.now().toString();r([...e,{id:t,primaryModel:null,fallbackModels:[]}]),n(t)},c=t=>{r(e.map(e=>e.id===t.id?t:e))},g=e.map((r,l)=>{let i=r.primaryModel?r.primaryModel:`Group ${l+1}`;return{key:r.id,label:i,closable:e.length>1,children:(0,t.jsx)(b,{group:r,onChange:c,availableModels:s,maxFallbacks:a})}});return 0===e.length?(0,t.jsxs)("div",{className:"text-center py-12 bg-gray-50 rounded-lg border border-dashed border-gray-300",children:[(0,t.jsx)("p",{className:"text-gray-500 mb-4",children:"No fallback groups configured"}),(0,t.jsx)(d.Button,{variant:"primary",onClick:o,icon:()=>(0,t.jsx)(m.Plus,{className:"w-4 h-4"}),children:"Create First Group"})]}):(0,t.jsx)(u.Tabs,{type:"editable-card",activeKey:i,onChange:n,onEdit:(t,s)=>{"add"===s?o():"remove"===s&&e.length>1&&(t=>{if(1===e.length)return h.default.warning("At least one group is required");let s=e.filter(e=>e.id!==t);r(s),i===t&&s.length>0&&n(s[s.length-1].id)})(t)},items:g,className:"fallback-tabs",tabBarStyle:{marginBottom:0},hideAdd:e.length>=l})}e.s(["FallbackSelectionForm",()=>v],419470)},309426,e=>{"use strict";var t=e.i(290571),r=e.i(444755),s=e.i(673706),a=e.i(271645),l=e.i(46757);let i=(0,s.makeClassName)("Col"),n=a.default.forwardRef((e,s)=>{let n,o,c,d,{numColSpan:u=1,numColSpanSm:m,numColSpanMd:p,numColSpanLg:h,children:g,className:f}=e,x=(0,t.__rest)(e,["numColSpan","numColSpanSm","numColSpanMd","numColSpanLg","children","className"]),y=(e,t)=>e&&Object.keys(t).includes(String(e))?t[e]:"";return a.default.createElement("div",Object.assign({ref:s,className:(0,r.tremorTwMerge)(i("root"),(n=y(u,l.colSpan),o=y(m,l.colSpanSm),c=y(p,l.colSpanMd),d=y(h,l.colSpanLg),(0,r.tremorTwMerge)(n,o,c,d)),f)},x),g)});n.displayName="Col",e.s(["Col",()=>n],309426)},950724,(e,t,r)=>{t.exports=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}},100236,(e,t,r)=>{t.exports=e.g&&e.g.Object===Object&&e.g},139088,(e,t,r)=>{var s=e.r(100236),a="object"==typeof self&&self&&self.Object===Object&&self;t.exports=s||a||Function("return this")()},631926,(e,t,r)=>{var s=e.r(139088);t.exports=function(){return s.Date.now()}},748891,(e,t,r)=>{var s=/\s/;t.exports=function(e){for(var t=e.length;t--&&s.test(e.charAt(t)););return t}},830364,(e,t,r)=>{var s=e.r(748891),a=/^\s+/;t.exports=function(e){return e?e.slice(0,s(e)+1).replace(a,""):e}},630353,(e,t,r)=>{t.exports=e.r(139088).Symbol},243436,(e,t,r)=>{var s=e.r(630353),a=Object.prototype,l=a.hasOwnProperty,i=a.toString,n=s?s.toStringTag:void 0;t.exports=function(e){var t=l.call(e,n),r=e[n];try{e[n]=void 0;var s=!0}catch(e){}var a=i.call(e);return s&&(t?e[n]=r:delete e[n]),a}},223243,(e,t,r)=>{var s=Object.prototype.toString;t.exports=function(e){return s.call(e)}},377684,(e,t,r)=>{var s=e.r(630353),a=e.r(243436),l=e.r(223243),i=s?s.toStringTag:void 0;t.exports=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":i&&i in Object(e)?a(e):l(e)}},877289,(e,t,r)=>{t.exports=function(e){return null!=e&&"object"==typeof e}},361884,(e,t,r)=>{var s=e.r(377684),a=e.r(877289);t.exports=function(e){return"symbol"==typeof e||a(e)&&"[object Symbol]"==s(e)}},773759,(e,t,r)=>{var s=e.r(830364),a=e.r(950724),l=e.r(361884),i=0/0,n=/^[-+]0x[0-9a-f]+$/i,o=/^0b[01]+$/i,c=/^0o[0-7]+$/i,d=parseInt;t.exports=function(e){if("number"==typeof e)return e;if(l(e))return i;if(a(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=a(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=s(e);var r=o.test(e);return r||c.test(e)?d(e.slice(2),r?2:8):n.test(e)?i:+e}},374009,(e,t,r)=>{var s=e.r(950724),a=e.r(631926),l=e.r(773759),i=Math.max,n=Math.min;t.exports=function(e,t,r){var o,c,d,u,m,p,h=0,g=!1,f=!1,x=!0;if("function"!=typeof e)throw TypeError("Expected a function");function y(t){var r=o,s=c;return o=c=void 0,h=t,u=e.apply(s,r)}function b(e){var r=e-p,s=e-h;return void 0===p||r>=t||r<0||f&&s>=d}function v(){var e,r,s,l=a();if(b(l))return _(l);m=setTimeout(v,(e=l-p,r=l-h,s=t-e,f?n(s,d-r):s))}function _(e){return(m=void 0,x&&o)?y(e):(o=c=void 0,u)}function j(){var e,r=a(),s=b(r);if(o=arguments,c=this,p=r,s){if(void 0===m)return h=e=p,m=setTimeout(v,t),g?y(e):u;if(f)return clearTimeout(m),m=setTimeout(v,t),y(p)}return void 0===m&&(m=setTimeout(v,t)),u}return t=l(t)||0,s(r)&&(g=!!r.leading,d=(f="maxWait"in r)?i(l(r.maxWait)||0,t):d,x="trailing"in r?!!r.trailing:x),j.cancel=function(){void 0!==m&&clearTimeout(m),h=0,o=p=c=m=void 0},j.flush=function(){return void 0===m?u:_(a())},j}},964306,e=>{"use strict";var t=e.i(271645);let r=t.forwardRef(function(e,r){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:r},e),t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M10 14l2-2m0 0l2-2m-2 2l-2-2m2 2l2 2m7-2a9 9 0 11-18 0 9 9 0 0118 0z"}))});e.s(["XCircleIcon",0,r],964306)},435451,620250,e=>{"use strict";var t=e.i(843476),r=e.i(290571),s=e.i(271645);let a=e=>{var t=(0,r.__rest)(e,[]);return s.default.createElement("svg",Object.assign({},t,{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:"2.5"}),s.default.createElement("path",{d:"M12 4v16m8-8H4"}))},l=e=>{var t=(0,r.__rest)(e,[]);return s.default.createElement("svg",Object.assign({},t,{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:"2.5"}),s.default.createElement("path",{d:"M20 12H4"}))};var i=e.i(444755),n=e.i(673706),o=e.i(677955);let c="flex mx-auto text-tremor-content-subtle dark:text-dark-tremor-content-subtle",d="cursor-pointer hover:text-tremor-content dark:hover:text-dark-tremor-content",u=s.default.forwardRef((e,t)=>{let{onSubmit:u,enableStepper:m=!0,disabled:p,onValueChange:h,onChange:g}=e,f=(0,r.__rest)(e,["onSubmit","enableStepper","disabled","onValueChange","onChange"]),x=(0,s.useRef)(null),[y,b]=s.default.useState(!1),v=s.default.useCallback(()=>{b(!0)},[]),_=s.default.useCallback(()=>{b(!1)},[]),[j,w]=s.default.useState(!1),k=s.default.useCallback(()=>{w(!0)},[]),N=s.default.useCallback(()=>{w(!1)},[]);return s.default.createElement(o.default,Object.assign({type:"number",ref:(0,n.mergeRefs)([x,t]),disabled:p,makeInputClassName:(0,n.makeClassName)("NumberInput"),onKeyDown:e=>{var t;if("Enter"===e.key&&!e.ctrlKey&&!e.altKey&&!e.shiftKey){let e=null==(t=x.current)?void 0:t.value;null==u||u(parseFloat(null!=e?e:""))}"ArrowDown"===e.key&&v(),"ArrowUp"===e.key&&k()},onKeyUp:e=>{"ArrowDown"===e.key&&_(),"ArrowUp"===e.key&&N()},onChange:e=>{p||(null==h||h(parseFloat(e.target.value)),null==g||g(e))},stepper:m?s.default.createElement("div",{className:(0,i.tremorTwMerge)("flex justify-center align-middle")},s.default.createElement("div",{tabIndex:-1,onClick:e=>e.preventDefault(),onMouseDown:e=>e.preventDefault(),onTouchStart:e=>{e.cancelable&&e.preventDefault()},onMouseUp:()=>{var e,t;p||(null==(e=x.current)||e.stepDown(),null==(t=x.current)||t.dispatchEvent(new Event("input",{bubbles:!0})))},className:(0,i.tremorTwMerge)(!p&&d,c,"group py-[10px] px-2.5 border-l border-tremor-border dark:border-dark-tremor-border")},s.default.createElement(l,{"data-testid":"step-down",className:(y?"scale-95":"")+" h-4 w-4 duration-75 transition group-active:scale-95"})),s.default.createElement("div",{tabIndex:-1,onClick:e=>e.preventDefault(),onMouseDown:e=>e.preventDefault(),onTouchStart:e=>{e.cancelable&&e.preventDefault()},onMouseUp:()=>{var e,t;p||(null==(e=x.current)||e.stepUp(),null==(t=x.current)||t.dispatchEvent(new Event("input",{bubbles:!0})))},className:(0,i.tremorTwMerge)(!p&&d,c,"group py-[10px] px-2.5 border-l border-tremor-border dark:border-dark-tremor-border")},s.default.createElement(a,{"data-testid":"step-up",className:(j?"scale-95":"")+" h-4 w-4 duration-75 transition group-active:scale-95"}))):null},f))});u.displayName="NumberInput",e.s(["NumberInput",()=>u],620250),e.s(["default",0,({step:e=.01,style:r={width:"100%"},placeholder:s="Enter a numerical value",min:a,max:l,onChange:i,...n})=>(0,t.jsx)(u,{onWheel:e=>e.currentTarget.blur(),step:e,style:r,placeholder:s,min:a,max:l,onChange:i,...n})],435451)},677667,674175,886148,543086,e=>{"use strict";let t,r;var s,a=e.i(290571),l=e.i(429427),i=e.i(371330),n=e.i(271645),o=e.i(394487),c=e.i(914189),d=e.i(144279),u=e.i(294316),m=e.i(83733);let p=(0,n.createContext)(()=>{});function h({value:e,children:t}){return n.default.createElement(p.Provider,{value:e},t)}e.s(["CloseProvider",()=>h],674175);var g=e.i(233137),f=e.i(233538),x=e.i(397701),y=e.i(402155),b=e.i(700020);let v=null!=(s=n.default.startTransition)?s:function(e){e()};var _=e.i(998348),j=((t=j||{})[t.Open=0]="Open",t[t.Closed=1]="Closed",t),w=((r=w||{})[r.ToggleDisclosure=0]="ToggleDisclosure",r[r.CloseDisclosure=1]="CloseDisclosure",r[r.SetButtonId=2]="SetButtonId",r[r.SetPanelId=3]="SetPanelId",r[r.SetButtonElement=4]="SetButtonElement",r[r.SetPanelElement=5]="SetPanelElement",r);let k={0:e=>({...e,disclosureState:(0,x.match)(e.disclosureState,{0:1,1:0})}),1:e=>1===e.disclosureState?e:{...e,disclosureState:1},2:(e,t)=>e.buttonId===t.buttonId?e:{...e,buttonId:t.buttonId},3:(e,t)=>e.panelId===t.panelId?e:{...e,panelId:t.panelId},4:(e,t)=>e.buttonElement===t.element?e:{...e,buttonElement:t.element},5:(e,t)=>e.panelElement===t.element?e:{...e,panelElement:t.element}},N=(0,n.createContext)(null);function C(e){let t=(0,n.useContext)(N);if(null===t){let t=Error(`<${e} /> is missing a parent component.`);throw Error.captureStackTrace&&Error.captureStackTrace(t,C),t}return t}N.displayName="DisclosureContext";let S=(0,n.createContext)(null);S.displayName="DisclosureAPIContext";let T=(0,n.createContext)(null);function E(e,t){return(0,x.match)(t.type,k,e,t)}T.displayName="DisclosurePanelContext";let O=n.Fragment,I=b.RenderFeatures.RenderStrategy|b.RenderFeatures.Static,M=Object.assign((0,b.forwardRefWithAs)(function(e,t){let{defaultOpen:r=!1,...s}=e,a=(0,n.useRef)(null),l=(0,u.useSyncRefs)(t,(0,u.optionalRef)(e=>{a.current=e},void 0===e.as||e.as===n.Fragment)),i=(0,n.useReducer)(E,{disclosureState:+!r,buttonElement:null,panelElement:null,buttonId:null,panelId:null}),[{disclosureState:o,buttonId:d},m]=i,p=(0,c.useEvent)(e=>{m({type:1});let t=(0,y.getOwnerDocument)(a);if(!t||!d)return;let r=e?e instanceof HTMLElement?e:e.current instanceof HTMLElement?e.current:t.getElementById(d):t.getElementById(d);null==r||r.focus()}),f=(0,n.useMemo)(()=>({close:p}),[p]),v=(0,n.useMemo)(()=>({open:0===o,close:p}),[o,p]),_=(0,b.useRender)();return n.default.createElement(N.Provider,{value:i},n.default.createElement(S.Provider,{value:f},n.default.createElement(h,{value:p},n.default.createElement(g.OpenClosedProvider,{value:(0,x.match)(o,{0:g.State.Open,1:g.State.Closed})},_({ourProps:{ref:l},theirProps:s,slot:v,defaultTag:O,name:"Disclosure"})))))}),{Button:(0,b.forwardRefWithAs)(function(e,t){let r=(0,n.useId)(),{id:s=`headlessui-disclosure-button-${r}`,disabled:a=!1,autoFocus:m=!1,...p}=e,[h,g]=C("Disclosure.Button"),x=(0,n.useContext)(T),y=null!==x&&x===h.panelId,v=(0,n.useRef)(null),j=(0,u.useSyncRefs)(v,t,(0,c.useEvent)(e=>{if(!y)return g({type:4,element:e})}));(0,n.useEffect)(()=>{if(!y)return g({type:2,buttonId:s}),()=>{g({type:2,buttonId:null})}},[s,g,y]);let w=(0,c.useEvent)(e=>{var t;if(y){if(1===h.disclosureState)return;switch(e.key){case _.Keys.Space:case _.Keys.Enter:e.preventDefault(),e.stopPropagation(),g({type:0}),null==(t=h.buttonElement)||t.focus()}}else switch(e.key){case _.Keys.Space:case _.Keys.Enter:e.preventDefault(),e.stopPropagation(),g({type:0})}}),k=(0,c.useEvent)(e=>{e.key===_.Keys.Space&&e.preventDefault()}),N=(0,c.useEvent)(e=>{var t;(0,f.isDisabledReactIssue7711)(e.currentTarget)||a||(y?(g({type:0}),null==(t=h.buttonElement)||t.focus()):g({type:0}))}),{isFocusVisible:S,focusProps:E}=(0,l.useFocusRing)({autoFocus:m}),{isHovered:O,hoverProps:I}=(0,i.useHover)({isDisabled:a}),{pressed:M,pressProps:P}=(0,o.useActivePress)({disabled:a}),A=(0,n.useMemo)(()=>({open:0===h.disclosureState,hover:O,active:M,disabled:a,focus:S,autofocus:m}),[h,O,M,S,a,m]),L=(0,d.useResolveButtonType)(e,h.buttonElement),R=y?(0,b.mergeProps)({ref:j,type:L,disabled:a||void 0,autoFocus:m,onKeyDown:w,onClick:N},E,I,P):(0,b.mergeProps)({ref:j,id:s,type:L,"aria-expanded":0===h.disclosureState,"aria-controls":h.panelElement?h.panelId:void 0,disabled:a||void 0,autoFocus:m,onKeyDown:w,onKeyUp:k,onClick:N},E,I,P);return(0,b.useRender)()({ourProps:R,theirProps:p,slot:A,defaultTag:"button",name:"Disclosure.Button"})}),Panel:(0,b.forwardRefWithAs)(function(e,t){let r=(0,n.useId)(),{id:s=`headlessui-disclosure-panel-${r}`,transition:a=!1,...l}=e,[i,o]=C("Disclosure.Panel"),{close:d}=function e(t){let r=(0,n.useContext)(S);if(null===r){let r=Error(`<${t} /> is missing a parent component.`);throw Error.captureStackTrace&&Error.captureStackTrace(r,e),r}return r}("Disclosure.Panel"),[p,h]=(0,n.useState)(null),f=(0,u.useSyncRefs)(t,(0,c.useEvent)(e=>{v(()=>o({type:5,element:e}))}),h);(0,n.useEffect)(()=>(o({type:3,panelId:s}),()=>{o({type:3,panelId:null})}),[s,o]);let x=(0,g.useOpenClosed)(),[y,_]=(0,m.useTransition)(a,p,null!==x?(x&g.State.Open)===g.State.Open:0===i.disclosureState),j=(0,n.useMemo)(()=>({open:0===i.disclosureState,close:d}),[i.disclosureState,d]),w={ref:f,id:s,...(0,m.transitionDataAttributes)(_)},k=(0,b.useRender)();return n.default.createElement(g.ResetOpenClosedProvider,null,n.default.createElement(T.Provider,{value:i.panelId},k({ourProps:w,theirProps:l,slot:j,defaultTag:"div",features:I,visible:y,name:"Disclosure.Panel"})))})});e.s(["Disclosure",()=>M],886148);let P=(0,n.createContext)(void 0);var A=e.i(444755);let L=(0,e.i(673706).makeClassName)("Accordion"),R=(0,n.createContext)({isOpen:!1}),F=n.default.forwardRef((e,t)=>{var r;let{defaultOpen:s=!1,children:l,className:i}=e,o=(0,a.__rest)(e,["defaultOpen","children","className"]),c=null!=(r=(0,n.useContext)(P))?r:(0,A.tremorTwMerge)("rounded-tremor-default border");return n.default.createElement(M,Object.assign({as:"div",ref:t,className:(0,A.tremorTwMerge)(L("root"),"overflow-hidden","bg-tremor-background border-tremor-border","dark:bg-dark-tremor-background dark:border-dark-tremor-border",c,i),defaultOpen:s},o),({open:e})=>n.default.createElement(R.Provider,{value:{isOpen:e}},l))});F.displayName="Accordion",e.s(["OpenContext",()=>R,"default",()=>F],543086),e.s(["Accordion",()=>F],677667)},898667,e=>{"use strict";var t=e.i(290571),r=e.i(271645),s=e.i(886148);let a=e=>{var s=(0,t.__rest)(e,[]);return r.default.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor"},s),r.default.createElement("path",{d:"M11.9999 10.8284L7.0502 15.7782L5.63599 14.364L11.9999 8L18.3639 14.364L16.9497 15.7782L11.9999 10.8284Z"}))};var l=e.i(543086),i=e.i(444755);let n=(0,e.i(673706).makeClassName)("AccordionHeader"),o=r.default.forwardRef((e,o)=>{let{children:c,className:d}=e,u=(0,t.__rest)(e,["children","className"]),{isOpen:m}=(0,r.useContext)(l.OpenContext);return r.default.createElement(s.Disclosure.Button,Object.assign({ref:o,className:(0,i.tremorTwMerge)(n("root"),"w-full flex items-center justify-between px-4 py-3","text-tremor-content-emphasis","dark:text-dark-tremor-content-emphasis",d)},u),r.default.createElement("div",{className:(0,i.tremorTwMerge)(n("children"),"flex flex-1 text-inherit mr-4")},c),r.default.createElement("div",null,r.default.createElement(a,{className:(0,i.tremorTwMerge)(n("arrowIcon"),"h-5 w-5 -mr-1","text-tremor-content-subtle","dark:text-dark-tremor-content-subtle",m?"transition-all":"transition-all -rotate-180")})))});o.displayName="AccordionHeader",e.s(["AccordionHeader",()=>o],898667)},130643,e=>{"use strict";var t=e.i(290571),r=e.i(271645),s=e.i(886148),a=e.i(444755);let l=(0,e.i(673706).makeClassName)("AccordionBody"),i=r.default.forwardRef((e,i)=>{let{children:n,className:o}=e,c=(0,t.__rest)(e,["children","className"]);return r.default.createElement(s.Disclosure.Panel,Object.assign({ref:i,className:(0,a.tremorTwMerge)(l("root"),"w-full text-tremor-default px-4 pb-3","text-tremor-content","dark:text-dark-tremor-content",o)},c),n)});i.displayName="AccordionBody",e.s(["AccordionBody",()=>i],130643)},409797,e=>{"use strict";var t=e.i(631171);e.s(["ChevronDownIcon",()=>t.default])},246349,e=>{"use strict";let t=(0,e.i(475254).default)("chevron-right",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);e.s(["default",()=>t])},91739,e=>{"use strict";var t=e.i(544195);e.s(["Radio",()=>t.default])},988297,e=>{"use strict";var t=e.i(271645);let r=t.forwardRef(function(e,r){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:r},e),t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 4v16m8-8H4"}))});e.s(["PlusIcon",0,r],988297)},797672,e=>{"use strict";var t=e.i(271645);let r=t.forwardRef(function(e,r){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:r},e),t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15.232 5.232l3.536 3.536m-2.036-5.036a2.5 2.5 0 113.536 3.536L6.5 21.036H3v-3.572L16.732 3.732z"}))});e.s(["PencilIcon",0,r],797672)},992619,e=>{"use strict";var t=e.i(843476),r=e.i(271645),s=e.i(779241),a=e.i(599724),l=e.i(199133),i=e.i(983561),n=e.i(689020);e.s(["default",0,({accessToken:e,value:o,placeholder:c="Select a Model",onChange:d,disabled:u=!1,style:m,className:p,showLabel:h=!0,labelText:g="Select Model"})=>{let[f,x]=(0,r.useState)(o),[y,b]=(0,r.useState)(!1),[v,_]=(0,r.useState)([]),j=(0,r.useRef)(null);return(0,r.useEffect)(()=>{x(o)},[o]),(0,r.useEffect)(()=>{e&&(async()=>{try{let t=await (0,n.fetchAvailableModels)(e);console.log("Fetched models for selector:",t),t.length>0&&_(t)}catch(e){console.error("Error fetching model info:",e)}})()},[e]),(0,t.jsxs)("div",{children:[h&&(0,t.jsxs)(a.Text,{className:"font-medium block mb-2 text-gray-700 flex items-center",children:[(0,t.jsx)(i.RobotOutlined,{className:"mr-2"})," ",g]}),(0,t.jsx)(l.Select,{value:f,placeholder:c,onChange:e=>{"custom"===e?(b(!0),x(void 0)):(b(!1),x(e),d&&d(e))},options:[...Array.from(new Set(v.map(e=>e.model_group))).map((e,t)=>({value:e,label:e,key:t})),{value:"custom",label:"Enter custom model",key:"custom"}],style:{width:"100%",...m},showSearch:!0,className:`rounded-md ${p||""}`,disabled:u}),y&&(0,t.jsx)(s.TextInput,{className:"mt-2",placeholder:"Enter custom model name",onValueChange:e=>{j.current&&clearTimeout(j.current),j.current=setTimeout(()=>{x(e),d&&d(e)},500)},disabled:u})]})}])},500727,699857,696609,531516,e=>{"use strict";var t=e.i(266027),r=e.i(243652),s=e.i(764205),a=e.i(135214);let l=(0,r.createQueryKeys)("mcpServers");e.s(["useMCPServers",0,e=>{let{accessToken:r}=(0,a.default)();return(0,t.useQuery)({queryKey:l.list(e?{filters:{teamId:e}}:void 0),queryFn:async()=>await (0,s.fetchMCPServers)(r,e),enabled:!!r})}],500727);let i=(0,r.createQueryKeys)("mcpToolsets");e.s(["useMCPToolsets",0,()=>{let{accessToken:e}=(0,a.default)();return(0,t.useQuery)({queryKey:i.list(),queryFn:async()=>await (0,s.fetchMCPToolsets)(e),enabled:!!e})}],699857);var n=e.i(843476),o=e.i(271645),c=e.i(536916),d=e.i(599724),u=e.i(409797),m=e.i(246349),m=m;let p=/\b(delete|remove|destroy|purge|drop|erase|unlink)\b/i,h=/\b(create|add|insert|new|post|submit|register|make|generate|write|upload)\b/i,g=/\b(update|edit|modify|change|patch|put|set|rename|move|transform)\b/i,f=/\b(get|read|list|fetch|search|find|query|retrieve|show|view|check|describe|info)\b/i;function x(e,t=""){let r=e.toLowerCase();if(f.test(r))return"read";if(p.test(r))return"delete";if(g.test(r))return"update";if(h.test(r))return"create";if(t){let e=t.toLowerCase();if(f.test(e))return"read";if(p.test(e))return"delete";if(g.test(e))return"update";if(h.test(e))return"create"}return"unknown"}function y(e){let t={read:[],create:[],update:[],delete:[],unknown:[]};for(let r of e)t[x(r.name,r.description)].push(r);return t}let b={read:{label:"Read",description:"Safe operations — fetch, list, search. No side effects.",risk:"low"},create:{label:"Create",description:"Add new resources — insert, upload, register.",risk:"medium"},update:{label:"Update",description:"Modify existing resources — edit, patch, rename.",risk:"medium"},delete:{label:"Delete",description:"Destructive operations — remove, purge, destroy.",risk:"high"},unknown:{label:"Other",description:"Operations that could not be automatically classified.",risk:"unknown"}};e.s(["CRUD_GROUP_META",0,b,"classifyToolOp",()=>x,"groupToolsByCrud",()=>y],696609);let v=["read","create","update","delete","unknown"],_={low:"bg-green-100 text-green-800",medium:"bg-yellow-100 text-yellow-800",high:"bg-red-100 text-red-800 font-semibold",unknown:"bg-gray-100 text-gray-700"},j={read:"border-green-200",create:"border-blue-200",update:"border-yellow-200",delete:"border-red-300",unknown:"border-gray-200"},w={read:"bg-green-50",create:"bg-blue-50",update:"bg-yellow-50",delete:"bg-red-50",unknown:"bg-gray-50"};e.s(["default",0,({tools:e,value:t,onChange:r,readOnly:s=!1,searchFilter:a=""})=>{let[l,i]=(0,o.useState)({read:!1,create:!1,update:!1,delete:!1,unknown:!0}),p=(0,o.useMemo)(()=>y(e),[e]),h=(0,o.useMemo)(()=>new Set(void 0===t?e.map(e=>e.name):t),[t,e]),g=e=>{if(s)return;let t=new Set(h);t.has(e)?t.delete(e):t.add(e),r(Array.from(t))};return 0===e.length?null:(0,n.jsx)("div",{className:"space-y-3",children:v.map(e=>{let t,o=p[e];if(0===o.length)return null;if(a){let e=a.toLowerCase();if(!o.some(t=>t.name.toLowerCase().includes(e)||(t.description??"").toLowerCase().includes(e)))return null}let f=b[e],x=(t=p[e]).length>0&&t.every(e=>h.has(e.name)),y=(e=>{let t=p[e];if(0===t.length)return!1;let r=t.filter(e=>h.has(e.name)).length;return r>0&&r{i(t=>({...t,[e]:!t[e]}))},children:[v?(0,n.jsx)(m.default,{className:"w-4 h-4 text-gray-500 flex-shrink-0"}):(0,n.jsx)(u.ChevronDownIcon,{className:"w-4 h-4 text-gray-500 flex-shrink-0"}),(0,n.jsx)("span",{className:"font-semibold text-gray-900 text-sm",children:f.label}),(0,n.jsx)("span",{className:`text-xs px-2 py-0.5 rounded-full ${_[f.risk]}`,children:"high"===f.risk?"High Risk":"medium"===f.risk?"Medium Risk":"low"===f.risk?"Safe":"Unclassified"}),(0,n.jsxs)("span",{className:"text-xs text-gray-500 ml-1",children:[o.filter(e=>h.has(e.name)).length,"/",o.length," allowed"]})]}),!s&&(0,n.jsxs)("div",{className:"flex items-center gap-2 ml-4",children:[(0,n.jsx)(d.Text,{className:"text-xs text-gray-500",children:x?"All on":y?"Partial":"All off"}),(0,n.jsx)(c.Checkbox,{checked:x,indeterminate:y,onChange:t=>((e,t)=>{if(s)return;let a=new Set(h);for(let r of p[e])t?a.add(r.name):a.delete(r.name);r(Array.from(a))})(e,t.target.checked),onClick:e=>e.stopPropagation()})]})]}),!v&&(0,n.jsx)("div",{className:"px-4 pt-2 pb-1 text-xs text-gray-500 bg-white border-b border-gray-100",children:f.description}),!v&&(0,n.jsx)("div",{className:"bg-white divide-y divide-gray-50",children:o.filter(e=>!a||e.name.toLowerCase().includes(a.toLowerCase())||(e.description??"").toLowerCase().includes(a.toLowerCase())).map(e=>{let t,r=(t=e.name,h.has(t));return(0,n.jsxs)("div",{className:`flex items-start gap-3 px-4 py-2.5 transition-colors hover:bg-gray-50 ${!s?"cursor-pointer":""} ${r?"":"opacity-60"}`,onClick:()=>g(e.name),children:[(0,n.jsx)(c.Checkbox,{checked:r,onChange:()=>g(e.name),disabled:s,onClick:e=>e.stopPropagation()}),(0,n.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,n.jsx)(d.Text,{className:"font-medium text-gray-900 text-sm",children:e.name}),e.description&&(0,n.jsx)(d.Text,{className:"text-xs text-gray-500 mt-0.5 leading-snug",children:e.description})]}),(0,n.jsx)("span",{className:`text-xs px-1.5 py-0.5 rounded flex-shrink-0 ${r?"bg-green-100 text-green-700":"bg-gray-100 text-gray-500"}`,children:r?"on":"off"})]},e.name)})})]},e)})})}],531516)},916940,e=>{"use strict";var t=e.i(843476),r=e.i(271645),s=e.i(199133),a=e.i(764205);e.s(["default",0,({onChange:e,value:l,className:i,accessToken:n,placeholder:o="Select vector stores",disabled:c=!1})=>{let[d,u]=(0,r.useState)([]),[m,p]=(0,r.useState)(!1);return(0,r.useEffect)(()=>{(async()=>{if(n){p(!0);try{let e=await (0,a.vectorStoreListCall)(n);e.data&&u(e.data)}catch(e){console.error("Error fetching vector stores:",e)}finally{p(!1)}}})()},[n]),(0,t.jsx)("div",{children:(0,t.jsx)(s.Select,{mode:"multiple",placeholder:o,onChange:e,value:l,loading:m,className:i,allowClear:!0,options:d.map(e=>({label:`${e.vector_store_name||e.vector_store_id} (${e.vector_store_id})`,value:e.vector_store_id,title:e.vector_store_description||e.vector_store_id})),optionFilterProp:"label",showSearch:!0,style:{width:"100%"},disabled:c})})}])},689020,e=>{"use strict";var t=e.i(764205);let r=async e=>{try{let r=await (0,t.modelHubCall)(e);if(console.log("model_info:",r),r?.data.length>0){let e=r.data.map(e=>({model_group:e.model_group,mode:e?.mode}));return e.sort((e,t)=>e.model_group.localeCompare(t.model_group)),e}return[]}catch(e){throw console.error("Error fetching model info:",e),e}};e.s(["fetchAvailableModels",0,r])},955135,e=>{"use strict";var t=e.i(597440);e.s(["DeleteOutlined",()=>t.default])},993914,e=>{"use strict";e.i(247167);var t=e.i(931067),r=e.i(271645);let s={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M854.6 288.6L639.4 73.4c-6-6-14.1-9.4-22.6-9.4H192c-17.7 0-32 14.3-32 32v832c0 17.7 14.3 32 32 32h640c17.7 0 32-14.3 32-32V311.3c0-8.5-3.4-16.7-9.4-22.7zM790.2 326H602V137.8L790.2 326zm1.8 562H232V136h302v216a42 42 0 0042 42h216v494zM504 618H320c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8h184c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8zM312 490v48c0 4.4 3.6 8 8 8h384c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8H320c-4.4 0-8 3.6-8 8z"}}]},name:"file-text",theme:"outlined"};var a=e.i(9583),l=r.forwardRef(function(e,l){return r.createElement(a.default,(0,t.default)({},e,{ref:l,icon:s}))});e.s(["FileTextOutlined",0,l],993914)},737434,e=>{"use strict";var t=e.i(184163);e.s(["DownloadOutlined",()=>t.default])},59935,(e,t,r)=>{var s;let a;e.e,s=function e(){var t,r="u">typeof self?self:"u">typeof window?window:void 0!==r?r:{},s=!r.document&&!!r.postMessage,a=r.IS_PAPA_WORKER||!1,l={},i=0,n={};function o(e){this._handle=null,this._finished=!1,this._completed=!1,this._halted=!1,this._input=null,this._baseIndex=0,this._partialLine="",this._rowCount=0,this._start=0,this._nextChunk=null,this.isFirstChunk=!0,this._completeResults={data:[],errors:[],meta:{}},(function(e){var t=b(e);t.chunkSize=parseInt(t.chunkSize),e.step||e.chunk||(t.chunkSize=null),this._handle=new p(t),(this._handle.streamer=this)._config=t}).call(this,e),this.parseChunk=function(e,t){var s=parseInt(this._config.skipFirstNLines)||0;if(this.isFirstChunk&&0=this._config.preview,a)r.postMessage({results:l,workerId:n.WORKER_ID,finished:s});else if(_(this._config.chunk)&&!t){if(this._config.chunk(l,this._handle),this._handle.paused()||this._handle.aborted())return void(this._halted=!0);this._completeResults=l=void 0}return this._config.step||this._config.chunk||(this._completeResults.data=this._completeResults.data.concat(l.data),this._completeResults.errors=this._completeResults.errors.concat(l.errors),this._completeResults.meta=l.meta),this._completed||!s||!_(this._config.complete)||l&&l.meta.aborted||(this._config.complete(this._completeResults,this._input),this._completed=!0),s||l&&l.meta.paused||this._nextChunk(),l}this._halted=!0},this._sendError=function(e){_(this._config.error)?this._config.error(e):a&&this._config.error&&r.postMessage({workerId:n.WORKER_ID,error:e,finished:!1})}}function c(e){var t;(e=e||{}).chunkSize||(e.chunkSize=n.RemoteChunkSize),o.call(this,e),this._nextChunk=s?function(){this._readChunk(),this._chunkLoaded()}:function(){this._readChunk()},this.stream=function(e){this._input=e,this._nextChunk()},this._readChunk=function(){if(this._finished)this._chunkLoaded();else{if(t=new XMLHttpRequest,this._config.withCredentials&&(t.withCredentials=this._config.withCredentials),s||(t.onload=v(this._chunkLoaded,this),t.onerror=v(this._chunkError,this)),t.open(this._config.downloadRequestBody?"POST":"GET",this._input,!s),this._config.downloadRequestHeaders){var e,r,a=this._config.downloadRequestHeaders;for(r in a)t.setRequestHeader(r,a[r])}this._config.chunkSize&&(e=this._start+this._config.chunkSize-1,t.setRequestHeader("Range","bytes="+this._start+"-"+e));try{t.send(this._config.downloadRequestBody)}catch(e){this._chunkError(e.message)}s&&0===t.status&&this._chunkError()}},this._chunkLoaded=function(){let e;4===t.readyState&&(t.status<200||400<=t.status?this._chunkError():(this._start+=this._config.chunkSize||t.responseText.length,this._finished=!this._config.chunkSize||this._start>=(null!==(e=(e=t).getResponseHeader("Content-Range"))?parseInt(e.substring(e.lastIndexOf("/")+1)):-1),this.parseChunk(t.responseText)))},this._chunkError=function(e){e=t.statusText||e,this._sendError(Error(e))}}function d(e){(e=e||{}).chunkSize||(e.chunkSize=n.LocalChunkSize),o.call(this,e);var t,r,s="u">typeof FileReader;this.stream=function(e){this._input=e,r=e.slice||e.webkitSlice||e.mozSlice,s?((t=new FileReader).onload=v(this._chunkLoaded,this),t.onerror=v(this._chunkError,this)):t=new FileReaderSync,this._nextChunk()},this._nextChunk=function(){this._finished||this._config.preview&&!(this._rowCount=this._input.size,this.parseChunk(e.target.result)},this._chunkError=function(){this._sendError(t.error)}}function u(e){var t;o.call(this,e=e||{}),this.stream=function(e){return t=e,this._nextChunk()},this._nextChunk=function(){var e,r;if(!this._finished)return t=(e=this._config.chunkSize)?(r=t.substring(0,e),t.substring(e)):(r=t,""),this._finished=!t,this.parseChunk(r)}}function m(e){o.call(this,e=e||{});var t=[],r=!0,s=!1;this.pause=function(){o.prototype.pause.apply(this,arguments),this._input.pause()},this.resume=function(){o.prototype.resume.apply(this,arguments),this._input.resume()},this.stream=function(e){this._input=e,this._input.on("data",this._streamData),this._input.on("end",this._streamEnd),this._input.on("error",this._streamError)},this._checkIsFinished=function(){s&&1===t.length&&(this._finished=!0)},this._nextChunk=function(){this._checkIsFinished(),t.length?this.parseChunk(t.shift()):r=!0},this._streamData=v(function(e){try{t.push("string"==typeof e?e:e.toString(this._config.encoding)),r&&(r=!1,this._checkIsFinished(),this.parseChunk(t.shift()))}catch(e){this._streamError(e)}},this),this._streamError=v(function(e){this._streamCleanUp(),this._sendError(e)},this),this._streamEnd=v(function(){this._streamCleanUp(),s=!0,this._streamData("")},this),this._streamCleanUp=v(function(){this._input.removeListener("data",this._streamData),this._input.removeListener("end",this._streamEnd),this._input.removeListener("error",this._streamError)},this)}function p(e){var t,r,s,a,l=/^\s*-?(\d+\.?|\.\d+|\d+\.\d+)([eE][-+]?\d+)?\s*$/,i=/^((\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\.\d+([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z)))$/,o=this,c=0,d=0,u=!1,m=!1,p=[],f={data:[],errors:[],meta:{}};function x(t){return"greedy"===e.skipEmptyLines?""===t.join("").trim():1===t.length&&0===t[0].length}function y(){if(f&&s&&(j("Delimiter","UndetectableDelimiter","Unable to auto-detect delimiting character; defaulted to '"+n.DefaultDelimiter+"'"),s=!1),e.skipEmptyLines&&(f.data=f.data.filter(function(e){return!x(e)})),v()){if(f)if(Array.isArray(f.data[0])){for(var t,r=0;v()&&r(e.dynamicTypingFunction&&void 0===e.dynamicTyping[t]&&(e.dynamicTyping[t]=e.dynamicTypingFunction(t)),!0===(e.dynamicTyping[t]||e.dynamicTyping))?"true"===r||"TRUE"===r||"false"!==r&&"FALSE"!==r&&((e=>{if(l.test(e)&&-0x20000000000000<(e=parseFloat(e))&&e<0x20000000000000)return 1})(r)?parseFloat(r):i.test(r)?new Date(r):""===r?null:r):r)(n=e.header?a>=p.length?"__parsed_extra":p[a]:n,o=e.transform?e.transform(o,n):o);"__parsed_extra"===n?(s[n]=s[n]||[],s[n].push(o)):s[n]=o}return e.header&&(a>p.length?j("FieldMismatch","TooManyFields","Too many fields: expected "+p.length+" fields but parsed "+a,d+r):ae.preview?r.abort():(f.data=f.data[0],a(f,o))))}),this.parse=function(a,l,i){var o=e.quoteChar||'"',o=(e.newline||(e.newline=this.guessLineEndings(a,o)),s=!1,e.delimiter?_(e.delimiter)&&(e.delimiter=e.delimiter(a),f.meta.delimiter=e.delimiter):((o=((t,r,s,a,l)=>{var i,o,c,d;l=l||[","," ","|",";",n.RECORD_SEP,n.UNIT_SEP];for(var u=0;u=r.length/2?"\r\n":"\r"}}function h(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function g(e){var t=(e=e||{}).delimiter,r=e.newline,s=e.comments,a=e.step,l=e.preview,i=e.fastMode,o=null,c=!1,d=null==e.quoteChar?'"':e.quoteChar,u=d;if(void 0!==e.escapeChar&&(u=e.escapeChar),("string"!=typeof t||-1=l)return D(!0);break}k.push({type:"Quotes",code:"InvalidQuotes",message:"Trailing quote on quoted field is malformed",row:w.length,index:m}),M++}}else if(s&&0===N.length&&n.substring(m,m+v)===s){if(-1===O)return D();m=O+b,O=n.indexOf(r,m),E=n.indexOf(t,m)}else if(-1!==E&&(E=l)return D(!0)}return R();function A(e){w.push(e),C=m}function L(e){return -1!==e&&(e=n.substring(M+1,e))&&""===e.trim()?e.length:0}function R(e){return f||(void 0===e&&(e=n.substring(m)),N.push(e),m=x,A(N),j&&B()),D()}function F(e){m=e,A(N),N=[],O=n.indexOf(r,m)}function D(s){if(e.header&&!g&&w.length&&!c){var a=w[0],l=Object.create(null),i=new Set(a);let t=!1;for(let r=0;r{if("object"==typeof t){if("string"!=typeof t.delimiter||n.BAD_DELIMITERS.filter(function(e){return -1!==t.delimiter.indexOf(e)}).length||(a=t.delimiter),("boolean"==typeof t.quotes||"function"==typeof t.quotes||Array.isArray(t.quotes))&&(r=t.quotes),"boolean"!=typeof t.skipEmptyLines&&"string"!=typeof t.skipEmptyLines||(c=t.skipEmptyLines),"string"==typeof t.newline&&(l=t.newline),"string"==typeof t.quoteChar&&(i=t.quoteChar),"boolean"==typeof t.header&&(s=t.header),Array.isArray(t.columns)){if(0===t.columns.length)throw Error("Option columns is empty");d=t.columns}void 0!==t.escapeChar&&(o=t.escapeChar+i),t.escapeFormulae instanceof RegExp?u=t.escapeFormulae:"boolean"==typeof t.escapeFormulae&&t.escapeFormulae&&(u=/^[=+\-@\t\r].*$/)}})(),RegExp(h(i),"g"));if("string"==typeof e&&(e=JSON.parse(e)),Array.isArray(e)){if(!e.length||Array.isArray(e[0]))return p(null,e,c);if("object"==typeof e[0])return p(d||Object.keys(e[0]),e,c)}else if("object"==typeof e)return"string"==typeof e.data&&(e.data=JSON.parse(e.data)),Array.isArray(e.data)&&(e.fields||(e.fields=e.meta&&e.meta.fields||d),e.fields||(e.fields=Array.isArray(e.data[0])?e.fields:"object"==typeof e.data[0]?Object.keys(e.data[0]):[]),Array.isArray(e.data[0])||"object"==typeof e.data[0]||(e.data=[e.data])),p(e.fields||[],e.data||[],c);throw Error("Unable to serialize unrecognized input");function p(e,t,r){var i="",n=("string"==typeof e&&(e=JSON.parse(e)),"string"==typeof t&&(t=JSON.parse(t)),Array.isArray(e)&&0{for(var r=0;r{"use strict";var t=e.i(266027),r=e.i(243652),s=e.i(764205),a=e.i(135214);let l=(0,r.createQueryKeys)("tags");e.s(["useTags",0,()=>{let{accessToken:e,userId:r,userRole:i}=(0,a.default)();return(0,t.useQuery)({queryKey:l.list({}),queryFn:async()=>await (0,s.tagListCall)(e),enabled:!!(e&&r&&i)})}])},9314,263147,e=>{"use strict";var t=e.i(843476),r=e.i(199133),s=e.i(981339),a=e.i(645526),l=e.i(599724),i=e.i(266027),n=e.i(243652),o=e.i(764205),c=e.i(708347),d=e.i(135214);let u=(0,n.createQueryKeys)("accessGroups"),m=async e=>{let t=(0,o.getProxyBaseUrl)(),r=`${t}/v1/access_group`,s=await fetch(r,{method:"GET",headers:{[(0,o.getGlobalLitellmHeaderName)()]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!s.ok){let e=await s.json(),t=(0,o.deriveErrorMessage)(e);throw(0,o.handleError)(t),Error(t)}return s.json()},p=()=>{let{accessToken:e,userRole:t}=(0,d.default)();return(0,i.useQuery)({queryKey:u.list({}),queryFn:async()=>m(e),enabled:!!e&&c.all_admin_roles.includes(t||"")})};e.s(["accessGroupKeys",0,u,"useAccessGroups",0,p],263147),e.s(["default",0,({value:e,onChange:i,placeholder:n="Select access groups",disabled:o=!1,style:c,className:d,showLabel:u=!1,labelText:m="Access Group",allowClear:h=!0})=>{let{data:g,isLoading:f,isError:x}=p();if(f)return(0,t.jsxs)("div",{children:[u&&(0,t.jsxs)(l.Text,{className:"font-medium block mb-2 text-gray-700 flex items-center",children:[(0,t.jsx)(a.TeamOutlined,{className:"mr-2"})," ",m]}),(0,t.jsx)(s.Skeleton.Input,{active:!0,block:!0,style:{height:32,...c}})]});let y=(g??[]).map(e=>({label:(0,t.jsxs)("span",{children:[(0,t.jsx)("span",{className:"font-medium",children:e.access_group_name})," ",(0,t.jsxs)("span",{className:"text-gray-400 text-xs",children:["(",e.access_group_id,")"]})]}),value:e.access_group_id,selectedLabel:e.access_group_name,searchText:`${e.access_group_name} ${e.access_group_id}`}));return(0,t.jsxs)("div",{children:[u&&(0,t.jsxs)(l.Text,{className:"font-medium block mb-2 text-gray-700 flex items-center",children:[(0,t.jsx)(a.TeamOutlined,{className:"mr-2"})," ",m]}),(0,t.jsx)(r.Select,{mode:"multiple",value:e,placeholder:n,onChange:i,disabled:o,allowClear:h,showSearch:!0,style:{width:"100%",...c},className:`rounded-md ${d??""}`,notFoundContent:x?(0,t.jsx)("span",{className:"text-red-500",children:"Failed to load access groups"}):"No access groups found",filterOption:(e,t)=>(y.find(e=>e.value===t?.value)?.searchText??"").toLowerCase().includes(e.toLowerCase()),optionLabelProp:"selectedLabel",options:y.map(e=>({label:e.label,value:e.value,selectedLabel:e.selectedLabel}))})]})}],9314)},552130,e=>{"use strict";var t=e.i(843476),r=e.i(271645),s=e.i(199133),a=e.i(764205);e.s(["default",0,({onChange:e,value:l,className:i,accessToken:n,placeholder:o="Select agents",disabled:c=!1})=>{let[d,u]=(0,r.useState)([]),[m,p]=(0,r.useState)([]),[h,g]=(0,r.useState)(!1);(0,r.useEffect)(()=>{(async()=>{if(n){g(!0);try{let e=await (0,a.getAgentsList)(n),t=e?.agents||[];u(t);let r=new Set;t.forEach(e=>{let t=e.agent_access_groups;t&&Array.isArray(t)&&t.forEach(e=>r.add(e))}),p(Array.from(r))}catch(e){console.error("Error fetching agents:",e)}finally{g(!1)}}})()},[n]);let f=[...m.map(e=>({label:e,value:`group:${e}`,isAccessGroup:!0,searchText:`${e} Access Group`})),...d.map(e=>({label:`${e.agent_name||e.agent_id}`,value:e.agent_id,isAccessGroup:!1,searchText:`${e.agent_name||e.agent_id} ${e.agent_id} Agent`}))],x=[...l?.agents||[],...(l?.accessGroups||[]).map(e=>`group:${e}`)];return(0,t.jsx)("div",{children:(0,t.jsx)(s.Select,{mode:"multiple",placeholder:o,onChange:t=>{e({agents:t.filter(e=>!e.startsWith("group:")),accessGroups:t.filter(e=>e.startsWith("group:")).map(e=>e.replace("group:",""))})},value:x,loading:h,className:i,allowClear:!0,showSearch:!0,style:{width:"100%"},disabled:c,filterOption:(e,t)=>(f.find(e=>e.value===t?.value)?.searchText||"").toLowerCase().includes(e.toLowerCase()),children:f.map(e=>(0,t.jsx)(s.Select.Option,{value:e.value,label:e.label,children:(0,t.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[(0,t.jsx)("span",{style:{display:"inline-block",width:8,height:8,borderRadius:"50%",background:e.isAccessGroup?"#52c41a":"#722ed1",flexShrink:0}}),(0,t.jsx)("span",{style:{flex:1},children:e.label}),(0,t.jsx)("span",{style:{color:e.isAccessGroup?"#52c41a":"#722ed1",fontSize:"12px",fontWeight:500,opacity:.8},children:e.isAccessGroup?"Access Group":"Agent"})]})},e.value))})})}])},844565,e=>{"use strict";var t=e.i(843476),r=e.i(271645),s=e.i(199133),a=e.i(764205);e.s(["default",0,({onChange:e,value:l,className:i,accessToken:n,placeholder:o="Select pass through routes",disabled:c=!1,teamId:d})=>{let[u,m]=(0,r.useState)([]),[p,h]=(0,r.useState)(!1);return(0,r.useEffect)(()=>{(async()=>{if(n){h(!0);try{let e=await (0,a.getPassThroughEndpointsCall)(n,d);if(e.endpoints){let t=e.endpoints.flatMap(e=>{let t=e.path,r=e.methods;return r&&r.length>0?r.map(e=>({label:`${e} ${t}`,value:t})):[{label:t,value:t}]});m(t)}}catch(e){console.error("Error fetching pass through routes:",e)}finally{h(!1)}}})()},[n,d]),(0,t.jsx)(s.Select,{mode:"tags",placeholder:o,onChange:e,value:l,loading:p,className:i,allowClear:!0,options:u,optionFilterProp:"label",showSearch:!0,style:{width:"100%"},disabled:c})}])},810757,477386,e=>{"use strict";var t=e.i(271645);let r=t.forwardRef(function(e,r){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:r},e),t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M10.325 4.317c.426-1.756 2.924-1.756 3.35 0a1.724 1.724 0 002.573 1.066c1.543-.94 3.31.826 2.37 2.37a1.724 1.724 0 001.065 2.572c1.756.426 1.756 2.924 0 3.35a1.724 1.724 0 00-1.066 2.573c.94 1.543-.826 3.31-2.37 2.37a1.724 1.724 0 00-2.572 1.065c-.426 1.756-2.924 1.756-3.35 0a1.724 1.724 0 00-2.573-1.066c-1.543.94-3.31-.826-2.37-2.37a1.724 1.724 0 00-1.065-2.572c-1.756-.426-1.756-2.924 0-3.35a1.724 1.724 0 001.066-2.573c-.94-1.543.826-3.31 2.37-2.37.996.608 2.296.07 2.572-1.065z"}),t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z"}))});e.s(["CogIcon",0,r],810757);let s=t.forwardRef(function(e,r){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:r},e),t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M18.364 18.364A9 9 0 005.636 5.636m12.728 12.728A9 9 0 015.636 5.636m12.728 12.728L5.636 5.636"}))});e.s(["BanIcon",0,s],477386)},557662,e=>{"use strict";let t="../ui/assets/logos/",r=[{id:"arize",displayName:"Arize",logo:`${t}arize.png`,supports_key_team_logging:!0,dynamic_params:{arize_api_key:"password",arize_space_id:"password"},description:"Arize Logging Integration"},{id:"braintrust",displayName:"Braintrust",logo:`${t}braintrust.png`,supports_key_team_logging:!1,dynamic_params:{braintrust_api_key:"password",braintrust_project_name:"text"},description:"Braintrust Logging Integration"},{id:"custom_callback_api",displayName:"Custom Callback API",logo:`${t}custom.svg`,supports_key_team_logging:!0,dynamic_params:{custom_callback_api_url:"text",custom_callback_api_headers:"text"},description:"Custom Callback API Logging Integration"},{id:"datadog",displayName:"Datadog",logo:`${t}datadog.png`,supports_key_team_logging:!1,dynamic_params:{dd_api_key:"password",dd_site:"text"},description:"Datadog Logging Integration"},{id:"lago",displayName:"Lago",logo:`${t}lago.svg`,supports_key_team_logging:!1,dynamic_params:{lago_api_url:"text",lago_api_key:"password"},description:"Lago Billing Logging Integration"},{id:"langfuse",displayName:"Langfuse",logo:`${t}langfuse.png`,supports_key_team_logging:!0,dynamic_params:{langfuse_public_key:"text",langfuse_secret_key:"password",langfuse_host:"text"},description:"Langfuse v2 Logging Integration"},{id:"langfuse_otel",displayName:"Langfuse OTEL",logo:`${t}langfuse.png`,supports_key_team_logging:!0,dynamic_params:{langfuse_public_key:"text",langfuse_secret_key:"password",langfuse_host:"text"},description:"Langfuse v3 OTEL Logging Integration"},{id:"langsmith",displayName:"LangSmith",logo:`${t}langsmith.png`,supports_key_team_logging:!0,dynamic_params:{langsmith_api_key:"password",langsmith_project:"text",langsmith_base_url:"text",langsmith_sampling_rate:"number"},description:"Langsmith Logging Integration"},{id:"openmeter",displayName:"OpenMeter",logo:`${t}openmeter.png`,supports_key_team_logging:!1,dynamic_params:{openmeter_api_key:"password",openmeter_base_url:"text"},description:"OpenMeter Logging Integration"},{id:"otel",displayName:"Open Telemetry",logo:`${t}otel.png`,supports_key_team_logging:!1,dynamic_params:{otel_endpoint:"text",otel_headers:"text"},description:"OpenTelemetry Logging Integration"},{id:"s3",displayName:"S3",logo:`${t}aws.svg`,supports_key_team_logging:!1,dynamic_params:{s3_bucket_name:"text",aws_access_key_id:"password",aws_secret_access_key:"password",aws_region:"text"},description:"S3 Bucket (AWS) Logging Integration"},{id:"SQS",displayName:"SQS",logo:`${t}aws.svg`,supports_key_team_logging:!1,dynamic_params:{sqs_queue_url:"text",aws_access_key_id:"password",aws_secret_access_key:"password",aws_region:"text"},description:"SQS Queue (AWS) Logging Integration"}],s=r.reduce((e,t)=>(e[t.displayName]=t,e),{}),a=r.reduce((e,t)=>(e[t.displayName]=t.id,e),{}),l=r.reduce((e,t)=>(e[t.id]=t.displayName,e),{});e.s(["callbackInfo",0,s,"callback_map",0,a,"mapDisplayToInternalNames",0,e=>e.map(e=>a[e]||e),"mapInternalToDisplayNames",0,e=>e.map(e=>l[e]||e),"reverse_callback_map",0,l])},75921,e=>{"use strict";var t=e.i(843476),r=e.i(266027),s=e.i(243652),a=e.i(764205),l=e.i(135214);let i=(0,s.createQueryKeys)("mcpAccessGroups");var n=e.i(500727),o=e.i(699857),c=e.i(199133);let d="toolset:";e.s(["default",0,({onChange:e,value:s,className:u,accessToken:m,placeholder:p="Select MCP servers",disabled:h=!1,teamId:g})=>{let{data:f=[],isLoading:x}=(0,n.useMCPServers)(g),{data:y=[],isLoading:b}=(()=>{let{accessToken:e}=(0,l.default)();return(0,r.useQuery)({queryKey:i.list({}),queryFn:async()=>await (0,a.fetchMCPAccessGroups)(e),enabled:!!e})})(),{data:v=[],isLoading:_}=(0,o.useMCPToolsets)(),j=new Set(y),w=[...y.map(e=>({label:e,value:e,type:"accessGroup",searchText:`${e} Access Group`})),...f.map(e=>({label:`${e.server_name||e.server_id} (${e.server_id})`,value:e.server_id,type:"server",searchText:`${e.server_name||e.server_id} ${e.server_id} MCP Server`})),...v.map(e=>({label:e.toolset_name,value:`${d}${e.toolset_id}`,type:"toolset",searchText:`${e.toolset_name} ${e.toolset_id} Toolset`}))],k={accessGroup:"#52c41a",server:"#1890ff",toolset:"#722ed1"},N={accessGroup:"Access Group",server:"MCP Server",toolset:"Toolset"},C=[...s?.servers||[],...s?.accessGroups||[],...(s?.toolsets||[]).map(e=>`${d}${e}`)];return(0,t.jsx)("div",{children:(0,t.jsx)(c.Select,{mode:"multiple",placeholder:p,onChange:t=>{let r=t.filter(e=>e.startsWith(d)).map(e=>e.slice(d.length)),s=t.filter(e=>!e.startsWith(d));e({servers:s.filter(e=>!j.has(e)),accessGroups:s.filter(e=>j.has(e)),toolsets:r})},value:C,loading:x||b||_,className:u,allowClear:!0,showSearch:!0,style:{width:"100%"},disabled:h,filterOption:(e,t)=>(w.find(e=>e.value===t?.value)?.searchText||"").toLowerCase().includes(e.toLowerCase()),children:w.map(e=>(0,t.jsx)(c.Select.Option,{value:e.value,label:e.label,children:(0,t.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[(0,t.jsx)("span",{style:{display:"inline-block",width:8,height:8,borderRadius:"50%",background:k[e.type],flexShrink:0}}),(0,t.jsx)("span",{style:{flex:1},children:e.label}),(0,t.jsx)("span",{style:{color:k[e.type],fontSize:"12px",fontWeight:500,opacity:.8},children:N[e.type]})]})},e.value))})})}],75921)},390605,e=>{"use strict";var t=e.i(843476),r=e.i(271645),s=e.i(764205),a=e.i(599724),l=e.i(482725),i=e.i(91739),n=e.i(500727),o=e.i(531516),c=e.i(696609);e.s(["default",0,({accessToken:e,selectedServers:d,toolPermissions:u,onChange:m,disabled:p=!1})=>{let{data:h=[]}=(0,n.useMCPServers)(),[g,f]=(0,r.useState)({}),[x,y]=(0,r.useState)({}),[b,v]=(0,r.useState)({}),[_,j]=(0,r.useState)({}),w=(0,r.useRef)(u);(0,r.useEffect)(()=>{w.current=u},[u]);let k=(0,r.useMemo)(()=>0===d.length?[]:h.filter(e=>d.includes(e.server_id)),[h,d]),N=async(e,t)=>{y(t=>({...t,[e]:!0})),v(t=>({...t,[e]:""}));try{let r=await (0,s.listMCPTools)(t,e);if(r.error)v(t=>({...t,[e]:r.message||"Failed to fetch tools"})),f(t=>({...t,[e]:[]}));else{let t=r.tools||[];f(r=>({...r,[e]:t}));let s=w.current;if(!s[e]&&t.length>0){let r=t.filter(e=>"delete"!==(0,c.classifyToolOp)(e.name,e.description||"")).map(e=>e.name);m({...s,[e]:r})}}}catch(t){console.error(`Error fetching tools for server ${e}:`,t),v(t=>({...t,[e]:"Failed to fetch tools"})),f(t=>({...t,[e]:[]}))}finally{y(t=>({...t,[e]:!1}))}};(0,r.useEffect)(()=>{k.forEach(t=>{g[t.server_id]||x[t.server_id]||N(t.server_id,e)})},[k,e]);let C=(e,t)=>{m({...u,[e]:t})};return 0===d.length?null:(0,t.jsx)("div",{className:"space-y-4",children:k.map(e=>{let r=e.server_name||e.alias||e.server_id,s=g[e.server_id]||[],n=u[e.server_id]||[],c=x[e.server_id],d=b[e.server_id],h=_[e.server_id]??"crud";return(0,t.jsxs)("div",{className:"border rounded-lg bg-gray-50",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between p-4 border-b bg-white rounded-t-lg",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)(a.Text,{className:"font-semibold text-gray-900",children:r}),e.description&&(0,t.jsx)(a.Text,{className:"text-sm text-gray-500",children:e.description})]}),(0,t.jsxs)("div",{className:"flex items-center gap-3",children:[!p&&s.length>0&&(0,t.jsx)(i.Radio.Group,{value:h,onChange:t=>j(r=>({...r,[e.server_id]:t.target.value})),size:"small",optionType:"button",buttonStyle:"solid",options:[{label:"Risk Groups",value:"crud"},{label:"Flat List",value:"flat"}]}),!p&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("button",{type:"button",className:"text-sm text-blue-600 hover:text-blue-700 font-medium",onClick:()=>{var t;let r;return r=g[t=e.server_id]||[],void m({...u,[t]:r.map(e=>e.name)})},disabled:c,children:"Select All"}),(0,t.jsx)("button",{type:"button",className:"text-sm text-blue-600 hover:text-blue-700 font-medium",onClick:()=>{var t;return t=e.server_id,void m({...u,[t]:[]})},disabled:c,children:"Deselect All"})]})]})]}),(0,t.jsxs)("div",{className:"p-4",children:[c&&(0,t.jsxs)("div",{className:"flex items-center justify-center py-8",children:[(0,t.jsx)(l.Spin,{size:"large"}),(0,t.jsx)(a.Text,{className:"ml-3 text-gray-500",children:"Loading tools..."})]}),d&&!c&&(0,t.jsxs)("div",{className:"p-4 bg-red-50 border border-red-200 rounded-lg text-center",children:[(0,t.jsx)(a.Text,{className:"text-red-600 font-medium",children:"Unable to load tools"}),(0,t.jsx)(a.Text,{className:"text-sm text-red-500 mt-1",children:d})]}),!c&&!d&&s.length>0&&"crud"===h&&(0,t.jsx)(o.default,{tools:s,value:u[e.server_id]?n:void 0,onChange:t=>C(e.server_id,t),readOnly:p}),!c&&!d&&s.length>0&&"flat"===h&&(0,t.jsx)("div",{className:"space-y-2",children:s.map(r=>{let s=n.includes(r.name);return(0,t.jsxs)("div",{className:"flex items-start gap-2",children:[(0,t.jsx)("input",{type:"checkbox",checked:s,onChange:()=>{if(p)return;let t=s?n.filter(e=>e!==r.name):[...n,r.name];C(e.server_id,t)},disabled:p,className:"mt-0.5"}),(0,t.jsx)("div",{className:"flex-1 min-w-0",children:(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(a.Text,{className:"font-medium text-gray-900",children:r.name}),(0,t.jsxs)(a.Text,{className:"text-sm text-gray-500",children:["- ",r.description||"No description"]})]})})]},r.name)})}),!c&&!d&&0===s.length&&(0,t.jsx)("div",{className:"text-center py-6",children:(0,t.jsx)(a.Text,{className:"text-gray-500",children:"No tools available"})})]})]},e.server_id)})})}])},266484,e=>{"use strict";var t=e.i(843476),r=e.i(199133),s=e.i(592968),a=e.i(312361),l=e.i(827252),i=e.i(994388),n=e.i(304967),o=e.i(779241),c=e.i(988297),d=e.i(68155),u=e.i(810757),m=e.i(477386),p=e.i(557662),h=e.i(435451);let{Option:g}=r.Select;e.s(["default",0,({value:e=[],onChange:f,disabledCallbacks:x=[],onDisabledCallbacksChange:y})=>{let b=Object.entries(p.callbackInfo).filter(([e,t])=>t.supports_key_team_logging).map(([e,t])=>e),v=Object.keys(p.callbackInfo),_=e=>{f?.(e)},j=(t,r,s)=>{let a=[...e];if("callback_name"===r){let e=p.callback_map[s]||s;a[t]={...a[t],[r]:e,callback_vars:{}}}else a[t]={...a[t],[r]:s};_(a)},w=(t,r,s)=>{let a=[...e];a[t]={...a[t],callback_vars:{...a[t].callback_vars,[r]:s}},_(a)};return(0,t.jsxs)("div",{className:"space-y-6",children:[(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,t.jsx)(m.BanIcon,{className:"w-5 h-5 text-red-500"}),(0,t.jsx)("span",{className:"text-base font-semibold text-gray-800",children:"Disabled Callbacks"}),(0,t.jsx)(s.Tooltip,{title:"Select callbacks to disable for this key. Disabled callbacks will not receive any logging data.",children:(0,t.jsx)(l.InfoCircleOutlined,{className:"text-gray-400 cursor-help"})})]}),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)("label",{className:"text-sm font-medium text-gray-700",children:"Disabled Callbacks"}),(0,t.jsx)(r.Select,{mode:"multiple",placeholder:"Select callbacks to disable",value:x,onChange:e=>{let t=(0,p.mapDisplayToInternalNames)(e);y?.(t)},style:{width:"100%"},optionLabelProp:"label",children:v.map(e=>{let r=p.callbackInfo[e]?.logo,a=p.callbackInfo[e]?.description;return(0,t.jsx)(g,{value:e,label:e,children:(0,t.jsx)(s.Tooltip,{title:a,placement:"right",children:(0,t.jsxs)("div",{className:"flex items-center space-x-2",children:[r&&(0,t.jsx)("img",{src:r,alt:e,className:"w-4 h-4 object-contain",onError:t=>{let r=t.target,s=r.parentElement;if(s){let t=document.createElement("div");t.className="w-4 h-4 rounded-full bg-gray-200 flex items-center justify-center text-xs",t.textContent=e.charAt(0),s.replaceChild(t,r)}}}),(0,t.jsx)("span",{children:e})]})})},e)})}),(0,t.jsx)("div",{className:"text-xs text-gray-500",children:"Select callbacks that should be disabled for this key. These callbacks will not receive any logging data."})]})]}),(0,t.jsx)(a.Divider,{}),(0,t.jsxs)("div",{className:"flex justify-between items-center",children:[(0,t.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,t.jsx)(u.CogIcon,{className:"w-5 h-5 text-blue-500"}),(0,t.jsx)("span",{className:"text-base font-semibold text-gray-800",children:"Logging Integrations"}),(0,t.jsx)(s.Tooltip,{title:"Configure callback logging integrations for this team.",children:(0,t.jsx)(l.InfoCircleOutlined,{className:"text-gray-400 cursor-help"})})]}),(0,t.jsx)(i.Button,{variant:"secondary",onClick:()=>{_([...e,{callback_name:"",callback_type:"success",callback_vars:{}}])},icon:c.PlusIcon,size:"sm",className:"hover:border-blue-400 hover:text-blue-500",type:"button",children:"Add Integration"})]}),(0,t.jsx)("div",{className:"space-y-4",children:e.map((a,c)=>{let u=a.callback_name?Object.entries(p.callback_map).find(([e,t])=>t===a.callback_name)?.[0]:void 0,m=u?p.callbackInfo[u]?.logo:null;return(0,t.jsxs)(n.Card,{className:"border border-gray-200 shadow-sm hover:shadow-md transition-shadow duration-200",decoration:"top",decorationColor:"blue",children:[(0,t.jsxs)("div",{className:"flex justify-between items-start mb-4",children:[(0,t.jsxs)("div",{className:"flex items-center space-x-2",children:[m&&(0,t.jsx)("img",{src:m,alt:u,className:"w-5 h-5 object-contain"}),(0,t.jsxs)("span",{className:"text-sm font-medium",children:[u||"New Integration"," Configuration"]})]}),(0,t.jsx)(i.Button,{variant:"light",onClick:()=>{_(e.filter((e,t)=>t!==c))},icon:d.TrashIcon,size:"xs",color:"red",className:"hover:bg-red-50",type:"button",children:"Remove"})]}),(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)("label",{className:"text-sm font-medium text-gray-700",children:"Integration Type"}),(0,t.jsx)(r.Select,{value:u,placeholder:"Select integration",onChange:e=>j(c,"callback_name",e),className:"w-full",optionLabelProp:"label",children:b.map(e=>{let r=p.callbackInfo[e]?.logo,a=p.callbackInfo[e]?.description;return(0,t.jsx)(g,{value:e,label:e,children:(0,t.jsx)(s.Tooltip,{title:a,placement:"right",children:(0,t.jsxs)("div",{className:"flex items-center space-x-2",children:[r&&(0,t.jsx)("img",{src:r,alt:e,className:"w-4 h-4 object-contain",onError:t=>{let r=t.target,s=r.parentElement;if(s){let t=document.createElement("div");t.className="w-4 h-4 rounded-full bg-gray-200 flex items-center justify-center text-xs",t.textContent=e.charAt(0),s.replaceChild(t,r)}}}),(0,t.jsx)("span",{children:e})]})})},e)})})]}),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)("label",{className:"text-sm font-medium text-gray-700",children:"Event Type"}),(0,t.jsxs)(r.Select,{value:a.callback_type,onChange:e=>j(c,"callback_type",e),className:"w-full",children:[(0,t.jsx)(g,{value:"success",children:(0,t.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,t.jsx)("div",{className:"w-2 h-2 bg-green-500 rounded-full"}),(0,t.jsx)("span",{children:"Success Only"})]})}),(0,t.jsx)(g,{value:"failure",children:(0,t.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,t.jsx)("div",{className:"w-2 h-2 bg-red-500 rounded-full"}),(0,t.jsx)("span",{children:"Failure Only"})]})}),(0,t.jsx)(g,{value:"success_and_failure",children:(0,t.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,t.jsx)("div",{className:"w-2 h-2 bg-blue-500 rounded-full"}),(0,t.jsx)("span",{children:"Success & Failure"})]})})]})]})]}),((e,r)=>{if(!e.callback_name)return null;let a=Object.entries(p.callback_map).find(([t,r])=>r===e.callback_name)?.[0];if(!a)return null;let i=p.callbackInfo[a]?.dynamic_params||{};return 0===Object.keys(i).length?null:(0,t.jsxs)("div",{className:"mt-6 pt-4 border-t border-gray-100",children:[(0,t.jsxs)("div",{className:"flex items-center space-x-2 mb-4",children:[(0,t.jsx)("div",{className:"w-3 h-3 bg-blue-100 rounded-full flex items-center justify-center",children:(0,t.jsx)("div",{className:"w-1.5 h-1.5 bg-blue-500 rounded-full"})}),(0,t.jsx)("span",{className:"text-sm font-medium text-gray-700",children:"Integration Parameters"})]}),(0,t.jsx)("div",{className:"grid grid-cols-1 gap-4",children:Object.entries(i).map(([a,i])=>(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsxs)("label",{className:"text-sm font-medium text-gray-700 capitalize flex items-center space-x-1",children:[(0,t.jsx)("span",{children:a.replace(/_/g," ")}),(0,t.jsx)(s.Tooltip,{title:`Environment variable reference recommended: os.environ/${a.toUpperCase()}`,children:(0,t.jsx)(l.InfoCircleOutlined,{className:"text-gray-400 cursor-help text-xs"})}),"password"===i&&(0,t.jsx)("span",{className:"inline-flex items-center px-2 py-0.5 rounded text-xs font-medium bg-yellow-100 text-yellow-800",children:"Sensitive"}),"number"===i&&(0,t.jsx)("span",{className:"inline-flex items-center px-2 py-0.5 rounded text-xs font-medium bg-yellow-100 text-yellow-800",children:"Number"})]}),"number"===i&&(0,t.jsx)("span",{className:"text-xs text-gray-500",children:"Value must be between 0 and 1"}),"number"===i?(0,t.jsx)(h.default,{step:.01,width:400,placeholder:`os.environ/${a.toUpperCase()}`,value:e.callback_vars[a]||"",onChange:e=>w(r,a,e.target.value)}):(0,t.jsx)(o.TextInput,{type:"password"===i?"password":"text",placeholder:`os.environ/${a.toUpperCase()}`,value:e.callback_vars[a]||"",onChange:e=>w(r,a,e.target.value)})]},a))})]})})(a,c)]})]},c)})}),0===e.length&&(0,t.jsxs)("div",{className:"text-center py-12 text-gray-500 border-2 border-dashed border-gray-200 rounded-lg bg-gray-50/50",children:[(0,t.jsx)(u.CogIcon,{className:"w-12 h-12 text-gray-300 mb-3 mx-auto"}),(0,t.jsx)("div",{className:"text-base font-medium mb-1",children:"No logging integrations configured"}),(0,t.jsx)("div",{className:"text-sm text-gray-400",children:'Click "Add Integration" to configure logging for this team'})]})]})}])},207082,e=>{"use strict";var t=e.i(619273),r=e.i(266027),s=e.i(243652),a=e.i(764205),l=e.i(135214);let i=(0,s.createQueryKeys)("keys"),n=async(e,t,r,s={})=>{try{let l=(0,a.getProxyBaseUrl)(),i=new URLSearchParams(Object.entries({team_id:s.teamID,project_id:s.projectID,organization_id:s.organizationID,key_alias:s.selectedKeyAlias,key_hash:s.keyHash,user_id:s.userID,page:t,size:r,sort_by:s.sortBy,sort_order:s.sortOrder,expand:s.expand,status:s.status,return_full_object:"true",include_team_keys:"true",include_created_by_keys:"true"}).filter(([,e])=>null!=e).map(([e,t])=>[e,String(t)])),n=`${l?`${l}/key/list`:"/key/list"}?${i}`,o=await fetch(n,{method:"GET",headers:{[(0,a.getGlobalLitellmHeaderName)()]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!o.ok){let e=await o.json(),t=(0,a.deriveErrorMessage)(e);throw(0,a.handleError)(t),Error(t)}let c=await o.json();return console.log("/key/list API Response:",c),c}catch(e){throw console.error("Failed to list keys:",e),e}},o=(0,s.createQueryKeys)("deletedKeys");e.s(["keyKeys",0,i,"useDeletedKeys",0,(e,s,a={})=>{let{accessToken:i}=(0,l.default)();return(0,r.useQuery)({queryKey:o.list({page:e,limit:s,...a}),queryFn:async()=>await n(i,e,s,{...a,status:"deleted"}),enabled:!!i,staleTime:3e4,placeholderData:t.keepPreviousData})},"useKeys",0,(e,s,a={})=>{let{accessToken:o}=(0,l.default)();return(0,r.useQuery)({queryKey:i.list({page:e,limit:s,...a}),queryFn:async()=>await n(o,e,s,a),enabled:!!o,staleTime:3e4,placeholderData:t.keepPreviousData})}])},510674,e=>{"use strict";var t=e.i(266027),r=e.i(243652),s=e.i(764205),a=e.i(708347),l=e.i(135214);let i=(0,r.createQueryKeys)("projects"),n=async e=>{let t=(0,s.getProxyBaseUrl)(),r=`${t}/project/list`,a=await fetch(r,{method:"GET",headers:{[(0,s.getGlobalLitellmHeaderName)()]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!a.ok){let e=await a.json(),t=(0,s.deriveErrorMessage)(e);throw(0,s.handleError)(t),Error(t)}return a.json()};e.s(["projectKeys",0,i,"useProjects",0,()=>{let{accessToken:e,userRole:r}=(0,l.default)();return(0,t.useQuery)({queryKey:i.list({}),queryFn:async()=>n(e),enabled:!!e&&a.all_admin_roles.includes(r||"")})}])},392110,e=>{"use strict";var t=e.i(843476),r=e.i(271645),s=e.i(199133),a=e.i(592968),l=e.i(312361),i=e.i(790848),n=e.i(536916),o=e.i(827252),c=e.i(779241);let{Option:d}=s.Select;e.s(["default",0,({form:e,autoRotationEnabled:u,onAutoRotationChange:m,rotationInterval:p,onRotationIntervalChange:h,isCreateMode:g=!1,neverExpire:f=!1,onNeverExpireChange:x})=>{let y=p&&!["7d","30d","90d","180d","365d"].includes(p),[b,v]=(0,r.useState)(y),[_,j]=(0,r.useState)(y?p:""),[w,k]=(0,r.useState)(e?.getFieldValue?.("duration")||"");return(0,t.jsxs)("div",{className:"space-y-6",children:[(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsx)("span",{className:"text-sm font-medium text-gray-700",children:"Key Expiry Settings"}),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsxs)("label",{className:"text-sm font-medium text-gray-700 flex items-center space-x-1",children:[(0,t.jsx)("span",{children:"Expire Key"}),(0,t.jsx)(a.Tooltip,{title:"Set when this key should expire. Format: 30s (seconds), 30m (minutes), 30h (hours), 30d (days). Leave empty to keep the current expiry unchanged.",children:(0,t.jsx)(o.InfoCircleOutlined,{className:"text-gray-400 cursor-help text-xs"})}),!g&&x&&(0,t.jsx)(n.Checkbox,{checked:f,onChange:t=>{let r=t.target.checked;x(r),r&&(k(""),e&&"function"==typeof e.setFieldValue?e.setFieldValue("duration",""):e&&"function"==typeof e.setFieldsValue&&e.setFieldsValue({duration:""}))},className:"ml-2 text-sm font-normal text-gray-600",children:"Never Expire"})]}),(0,t.jsx)(c.TextInput,{name:"duration",placeholder:g?"e.g., 30d or leave empty to never expire":"e.g., 30d",className:"w-full",value:w,onValueChange:t=>{k(t),e&&"function"==typeof e.setFieldValue?e.setFieldValue("duration",t):e&&"function"==typeof e.setFieldsValue&&e.setFieldsValue({duration:t})},disabled:!g&&f})]})]}),(0,t.jsx)(l.Divider,{}),(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsx)("span",{className:"text-sm font-medium text-gray-700",children:"Auto-Rotation Settings"}),(0,t.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsxs)("label",{className:"text-sm font-medium text-gray-700 flex items-center space-x-1",children:[(0,t.jsx)("span",{children:"Enable Auto-Rotation"}),(0,t.jsx)(a.Tooltip,{title:"Key will automatically regenerate at the specified interval for enhanced security.",children:(0,t.jsx)(o.InfoCircleOutlined,{className:"text-gray-400 cursor-help text-xs"})})]}),(0,t.jsx)(i.Switch,{checked:u,onChange:m,size:"default",className:u?"":"bg-gray-400"})]}),u&&(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsxs)("label",{className:"text-sm font-medium text-gray-700 flex items-center space-x-1",children:[(0,t.jsx)("span",{children:"Rotation Interval"}),(0,t.jsx)(a.Tooltip,{title:"How often the key should be automatically rotated. Choose the interval that best fits your security requirements.",children:(0,t.jsx)(o.InfoCircleOutlined,{className:"text-gray-400 cursor-help text-xs"})})]}),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsxs)(s.Select,{value:b?"custom":p,onChange:e=>{"custom"===e?v(!0):(v(!1),j(""),h(e))},className:"w-full",placeholder:"Select interval",children:[(0,t.jsx)(d,{value:"7d",children:"7 days"}),(0,t.jsx)(d,{value:"30d",children:"30 days"}),(0,t.jsx)(d,{value:"90d",children:"90 days"}),(0,t.jsx)(d,{value:"180d",children:"180 days"}),(0,t.jsx)(d,{value:"365d",children:"365 days"}),(0,t.jsx)(d,{value:"custom",children:"Custom interval"})]}),b&&(0,t.jsxs)("div",{className:"space-y-1",children:[(0,t.jsx)(c.TextInput,{value:_,onChange:e=>{let t=e.target.value;j(t),h(t)},placeholder:"e.g., 1s, 5m, 2h, 14d"}),(0,t.jsx)("div",{className:"text-xs text-gray-500",children:"Supported formats: seconds (s), minutes (m), hours (h), days (d)"})]})]})]})]}),u&&(0,t.jsx)("div",{className:"bg-blue-50 p-3 rounded-md text-sm text-blue-700",children:"When rotation occurs, you'll receive a notification with the new key. The old key will be deactivated after a brief grace period."})]})]})}])},939510,e=>{"use strict";var t=e.i(843476),r=e.i(808613),s=e.i(199133),a=e.i(592968),l=e.i(827252);let{Option:i}=s.Select;e.s(["default",0,({type:e,name:n,showDetailedDescriptions:o=!0,className:c="",initialValue:d=null,form:u,onChange:m})=>{let p=e.toUpperCase(),h=e.toLowerCase(),g=`Select 'guaranteed_throughput' to prevent overallocating ${p} limit when the key belongs to a Team with specific ${p} limits.`;return(0,t.jsx)(r.Form.Item,{label:(0,t.jsxs)("span",{children:[p," Rate Limit Type"," ",(0,t.jsx)(a.Tooltip,{title:g,children:(0,t.jsx)(l.InfoCircleOutlined,{style:{marginLeft:"4px"}})})]}),name:n,initialValue:d,className:c,children:(0,t.jsx)(s.Select,{defaultValue:o?"default":void 0,placeholder:"Select rate limit type",style:{width:"100%"},optionLabelProp:o?"label":void 0,onChange:e=>{u&&u.setFieldValue(n,e),m&&m(e)},children:o?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(i,{value:"best_effort_throughput",label:"Default",children:(0,t.jsxs)("div",{style:{padding:"4px 0"},children:[(0,t.jsx)("div",{style:{fontWeight:500},children:"Default"}),(0,t.jsxs)("div",{style:{fontSize:"11px",color:"#6b7280",marginTop:"2px"},children:["Best effort throughput - no error if we're overallocating ",h," (Team/Key Limits checked at runtime)."]})]})}),(0,t.jsx)(i,{value:"guaranteed_throughput",label:"Guaranteed throughput",children:(0,t.jsxs)("div",{style:{padding:"4px 0"},children:[(0,t.jsx)("div",{style:{fontWeight:500},children:"Guaranteed throughput"}),(0,t.jsxs)("div",{style:{fontSize:"11px",color:"#6b7280",marginTop:"2px"},children:["Guaranteed throughput - raise an error if we're overallocating ",h," (also checks model-specific limits)"]})]})}),(0,t.jsx)(i,{value:"dynamic",label:"Dynamic",children:(0,t.jsxs)("div",{style:{padding:"4px 0"},children:[(0,t.jsx)("div",{style:{fontWeight:500},children:"Dynamic"}),(0,t.jsxs)("div",{style:{fontSize:"11px",color:"#6b7280",marginTop:"2px"},children:["If the key has a set ",p," (e.g. 2 ",p,") and there are no 429 errors, it can dynamically exceed the limit when the model being called is not erroring."]})]})})]}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(i,{value:"best_effort_throughput",children:"Best effort throughput"}),(0,t.jsx)(i,{value:"guaranteed_throughput",children:"Guaranteed throughput"}),(0,t.jsx)(i,{value:"dynamic",children:"Dynamic"})]})})})}])},363256,e=>{"use strict";var t=e.i(843476),r=e.i(199133);let{Text:s}=e.i(898586).Typography;e.s(["default",0,({organizations:e,value:a,onChange:l,disabled:i,loading:n,style:o})=>(0,t.jsx)(r.Select,{showSearch:!0,placeholder:"All Organizations",value:a,onChange:l,disabled:i,loading:n,allowClear:!0,style:{minWidth:280,...o},filterOption:(t,r)=>{if(!r)return!1;let s=e?.find(e=>e.organization_id===r.key);if(!s)return!1;let a=t.toLowerCase().trim(),l=(s.organization_alias||"").toLowerCase(),i=(s.organization_id||"").toLowerCase();return l.includes(a)||i.includes(a)},children:e?.map(e=>(0,t.jsxs)(r.Select.Option,{value:e.organization_id,children:[(0,t.jsx)("span",{className:"font-medium",children:e.organization_alias})," ",(0,t.jsxs)(s,{type:"secondary",children:["(",e.organization_id,")"]})]},e.organization_id))})])},533882,e=>{"use strict";var t=e.i(843476),r=e.i(271645),s=e.i(250980),a=e.i(797672),l=e.i(68155),i=e.i(304967),n=e.i(629569),o=e.i(599724),c=e.i(269200),d=e.i(427612),u=e.i(64848),m=e.i(942232),p=e.i(496020),h=e.i(977572),g=e.i(992619),f=e.i(727749);e.s(["default",0,({accessToken:e,initialModelAliases:x={},onAliasUpdate:y,showExampleConfig:b=!0})=>{let[v,_]=(0,r.useState)([]),[j,w]=(0,r.useState)({aliasName:"",targetModel:""}),[k,N]=(0,r.useState)(null);(0,r.useEffect)(()=>{_(Object.entries(x).map(([e,t],r)=>({id:`${r}-${e}`,aliasName:e,targetModel:t})))},[x]);let C=()=>{if(!k)return;if(!k.aliasName||!k.targetModel)return void f.default.fromBackend("Please provide both alias name and target model");if(v.some(e=>e.id!==k.id&&e.aliasName===k.aliasName))return void f.default.fromBackend("An alias with this name already exists");let e=v.map(e=>e.id===k.id?k:e);_(e),N(null);let t={};e.forEach(e=>{t[e.aliasName]=e.targetModel}),y&&y(t),f.default.success("Alias updated successfully")},S=()=>{N(null)},T=v.reduce((e,t)=>(e[t.aliasName]=t.targetModel,e),{});return(0,t.jsxs)("div",{className:"mt-4",children:[(0,t.jsxs)("div",{className:"mb-6",children:[(0,t.jsx)(o.Text,{className:"text-sm font-medium text-gray-700 mb-2",children:"Add New Alias"}),(0,t.jsxs)("div",{className:"grid grid-cols-3 gap-4",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"block text-xs text-gray-500 mb-1",children:"Alias Name"}),(0,t.jsx)("input",{type:"text",value:j.aliasName,onChange:e=>w({...j,aliasName:e.target.value}),placeholder:"e.g., gpt-4o",className:"w-full px-3 py-2 border border-gray-300 rounded-md text-sm"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"block text-xs text-gray-500 mb-1",children:"Target Model"}),(0,t.jsx)(g.default,{accessToken:e,value:j.targetModel,placeholder:"Select target model",onChange:e=>w({...j,targetModel:e}),showLabel:!1})]}),(0,t.jsx)("div",{className:"flex items-end",children:(0,t.jsxs)("button",{onClick:()=>{if(!j.aliasName||!j.targetModel)return void f.default.fromBackend("Please provide both alias name and target model");if(v.some(e=>e.aliasName===j.aliasName))return void f.default.fromBackend("An alias with this name already exists");let e=[...v,{id:`${Date.now()}-${j.aliasName}`,aliasName:j.aliasName,targetModel:j.targetModel}];_(e),w({aliasName:"",targetModel:""});let t={};e.forEach(e=>{t[e.aliasName]=e.targetModel}),y&&y(t),f.default.success("Alias added successfully")},disabled:!j.aliasName||!j.targetModel,className:`flex items-center px-4 py-2 rounded-md text-sm ${!j.aliasName||!j.targetModel?"bg-gray-300 text-gray-500 cursor-not-allowed":"bg-green-600 text-white hover:bg-green-700"}`,children:[(0,t.jsx)(s.PlusCircleIcon,{className:"w-4 h-4 mr-1"}),"Add Alias"]})})]})]}),(0,t.jsx)(o.Text,{className:"text-sm font-medium text-gray-700 mb-2",children:"Manage Existing Aliases"}),(0,t.jsx)("div",{className:"rounded-lg custom-border relative mb-6",children:(0,t.jsx)("div",{className:"overflow-x-auto",children:(0,t.jsxs)(c.Table,{className:"[&_td]:py-0.5 [&_th]:py-1",children:[(0,t.jsx)(d.TableHead,{children:(0,t.jsxs)(p.TableRow,{children:[(0,t.jsx)(u.TableHeaderCell,{className:"py-1 h-8",children:"Alias Name"}),(0,t.jsx)(u.TableHeaderCell,{className:"py-1 h-8",children:"Target Model"}),(0,t.jsx)(u.TableHeaderCell,{className:"py-1 h-8",children:"Actions"})]})}),(0,t.jsxs)(m.TableBody,{children:[v.map(r=>(0,t.jsx)(p.TableRow,{className:"h-8",children:k&&k.id===r.id?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(h.TableCell,{className:"py-0.5",children:(0,t.jsx)("input",{type:"text",value:k.aliasName,onChange:e=>N({...k,aliasName:e.target.value}),className:"w-full px-2 py-1 border border-gray-300 rounded-md text-sm"})}),(0,t.jsx)(h.TableCell,{className:"py-0.5",children:(0,t.jsx)(g.default,{accessToken:e,value:k.targetModel,onChange:e=>N({...k,targetModel:e}),showLabel:!1,style:{height:"32px"}})}),(0,t.jsx)(h.TableCell,{className:"py-0.5 whitespace-nowrap",children:(0,t.jsxs)("div",{className:"flex space-x-2",children:[(0,t.jsx)("button",{onClick:C,className:"text-xs bg-blue-50 text-blue-600 px-2 py-1 rounded hover:bg-blue-100",children:"Save"}),(0,t.jsx)("button",{onClick:S,className:"text-xs bg-gray-50 text-gray-600 px-2 py-1 rounded hover:bg-gray-100",children:"Cancel"})]})})]}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(h.TableCell,{className:"py-0.5 text-sm text-gray-900",children:r.aliasName}),(0,t.jsx)(h.TableCell,{className:"py-0.5 text-sm text-gray-500",children:r.targetModel}),(0,t.jsx)(h.TableCell,{className:"py-0.5 whitespace-nowrap",children:(0,t.jsxs)("div",{className:"flex space-x-2",children:[(0,t.jsx)("button",{onClick:()=>{N({...r})},className:"text-xs bg-blue-50 text-blue-600 px-2 py-1 rounded hover:bg-blue-100",children:(0,t.jsx)(a.PencilIcon,{className:"w-3 h-3"})}),(0,t.jsx)("button",{onClick:()=>{var e;let t,s;return e=r.id,_(t=v.filter(t=>t.id!==e)),s={},void(t.forEach(e=>{s[e.aliasName]=e.targetModel}),y&&y(s),f.default.success("Alias deleted successfully"))},className:"text-xs bg-red-50 text-red-600 px-2 py-1 rounded hover:bg-red-100",children:(0,t.jsx)(l.TrashIcon,{className:"w-3 h-3"})})]})})]})},r.id)),0===v.length&&(0,t.jsx)(p.TableRow,{children:(0,t.jsx)(h.TableCell,{colSpan:3,className:"py-0.5 text-sm text-gray-500 text-center",children:"No aliases added yet. Add a new alias above."})})]})]})})}),b&&(0,t.jsxs)(i.Card,{children:[(0,t.jsx)(n.Title,{className:"mb-4",children:"Configuration Example"}),(0,t.jsx)(o.Text,{className:"text-gray-600 mb-4",children:"Here's how your current aliases would look in the config:"}),(0,t.jsx)("div",{className:"bg-gray-100 rounded-lg p-4 font-mono text-sm",children:(0,t.jsxs)("div",{className:"text-gray-700",children:["model_aliases:",0===Object.keys(T).length?(0,t.jsxs)("span",{className:"text-gray-500",children:[(0,t.jsx)("br",{}),"  # No aliases configured yet"]}):Object.entries(T).map(([e,r])=>(0,t.jsxs)("span",{children:[(0,t.jsx)("br",{}),'  "',e,'": "',r,'"']},e))]})})]})]})}])},651904,e=>{"use strict";var t=e.i(843476),r=e.i(599724),s=e.i(266484);e.s(["default",0,function({value:e,onChange:a,premiumUser:l=!1,disabledCallbacks:i=[],onDisabledCallbacksChange:n}){return l?(0,t.jsx)(s.default,{value:e,onChange:a,disabledCallbacks:i,onDisabledCallbacksChange:n}):(0,t.jsxs)("div",{children:[(0,t.jsxs)("div",{className:"flex flex-wrap gap-2 mb-3",children:[(0,t.jsx)("div",{className:"inline-flex items-center px-3 py-1.5 rounded-lg bg-green-50 border border-green-200 text-green-800 text-sm font-medium opacity-50",children:"✨ langfuse-logging"}),(0,t.jsx)("div",{className:"inline-flex items-center px-3 py-1.5 rounded-lg bg-green-50 border border-green-200 text-green-800 text-sm font-medium opacity-50",children:"✨ datadog-logging"})]}),(0,t.jsx)("div",{className:"p-3 bg-yellow-50 border border-yellow-200 rounded-lg",children:(0,t.jsxs)(r.Text,{className:"text-sm text-yellow-800",children:["Setting Key/Team logging settings is a LiteLLM Enterprise feature. Global Logging Settings are available for all free users. Get a trial key"," ",(0,t.jsx)("a",{href:"https://www.litellm.ai/#pricing",target:"_blank",rel:"noopener noreferrer",className:"underline",children:"here"}),"."]})})]})}])},460285,e=>{"use strict";var t=e.i(843476),r=e.i(271645),s=e.i(404206),a=e.i(723731),l=e.i(653824),i=e.i(881073),n=e.i(197647),o=e.i(764205),c=e.i(158392),d=e.i(419470),u=e.i(689020);let m=(0,r.forwardRef)(({accessToken:e,value:m,onChange:p,modelData:h},g)=>{let[f,x]=(0,r.useState)({routerSettings:{},selectedStrategy:null,enableTagFiltering:!1}),[y,b]=(0,r.useState)([]),[v,_]=(0,r.useState)([]),[j,w]=(0,r.useState)([]),[k,N]=(0,r.useState)([]),[C,S]=(0,r.useState)({}),[T,E]=(0,r.useState)({}),O=(0,r.useRef)(!1),I=(0,r.useRef)(null);(0,r.useEffect)(()=>{let e=m?.router_settings?JSON.stringify({routing_strategy:m.router_settings.routing_strategy,fallbacks:m.router_settings.fallbacks,enable_tag_filtering:m.router_settings.enable_tag_filtering}):null;if(O.current&&e===I.current){O.current=!1;return}if(O.current&&e!==I.current&&(O.current=!1),e!==I.current)if(I.current=e,m?.router_settings){let e=m.router_settings,{fallbacks:t,...r}=e;x({routerSettings:r,selectedStrategy:e.routing_strategy||null,enableTagFiltering:e.enable_tag_filtering??!1});let s=e.fallbacks||[];b(s),_(s&&0!==s.length?s.map((e,t)=>{let[r,s]=Object.entries(e)[0];return{id:(t+1).toString(),primaryModel:r||null,fallbackModels:s||[]}}):[{id:"1",primaryModel:null,fallbackModels:[]}])}else x({routerSettings:{},selectedStrategy:null,enableTagFiltering:!1}),b([]),_([{id:"1",primaryModel:null,fallbackModels:[]}])},[m]),(0,r.useEffect)(()=>{e&&(0,o.getRouterSettingsCall)(e).then(e=>{if(e.fields){let t={};e.fields.forEach(e=>{t[e.field_name]={ui_field_name:e.ui_field_name,field_description:e.field_description,options:e.options,link:e.link}}),S(t);let r=e.fields.find(e=>"routing_strategy"===e.field_name);r?.options&&N(r.options),e.routing_strategy_descriptions&&E(e.routing_strategy_descriptions)}})},[e]),(0,r.useEffect)(()=>{e&&(async()=>{try{let t=await (0,u.fetchAvailableModels)(e);w(t)}catch(e){console.error("Error fetching model info for fallbacks:",e)}})()},[e]);let M=()=>{let e=new Set(["allowed_fails","cooldown_time","num_retries","timeout","retry_after"]),t=new Set(["model_group_alias","retry_policy"]),r=Object.fromEntries(Object.entries({...f.routerSettings,enable_tag_filtering:f.enableTagFiltering,routing_strategy:f.selectedStrategy,fallbacks:y.length>0?y:null}).map(([r,s])=>{if("routing_strategy_args"!==r&&"routing_strategy"!==r&&"enable_tag_filtering"!==r&&"fallbacks"!==r){let a=document.querySelector(`input[name="${r}"]`);if(a&&void 0!==a.value&&""!==a.value){let l=((r,s,a)=>{if(null==s)return a;let l=String(s).trim();if(""===l||"null"===l.toLowerCase())return null;if(e.has(r)){let e=Number(l);return Number.isNaN(e)?a:e}if(t.has(r)){if(""===l)return null;try{return JSON.parse(l)}catch{return a}}return"true"===l.toLowerCase()||"false"!==l.toLowerCase()&&l})(r,a.value,s);return[r,l]}}else if("routing_strategy"===r)return[r,f.selectedStrategy];else if("enable_tag_filtering"===r)return[r,f.enableTagFiltering];else if("fallbacks"===r)return[r,y.length>0?y:null];else if("routing_strategy_args"===r&&"latency-based-routing"===f.selectedStrategy){let e=document.querySelector('input[name="lowest_latency_buffer"]'),t=document.querySelector('input[name="ttl"]'),r={};return e?.value&&(r.lowest_latency_buffer=Number(e.value)),t?.value&&(r.ttl=Number(t.value)),["routing_strategy_args",Object.keys(r).length>0?r:null]}return[r,s]}).filter(e=>null!=e)),s=(e,t=!1)=>null==e||"object"==typeof e&&!Array.isArray(e)&&0===Object.keys(e).length||t&&("number"!=typeof e||Number.isNaN(e))?null:e;return{routing_strategy:s(r.routing_strategy),allowed_fails:s(r.allowed_fails,!0),cooldown_time:s(r.cooldown_time,!0),num_retries:s(r.num_retries,!0),timeout:s(r.timeout,!0),retry_after:s(r.retry_after,!0),fallbacks:y.length>0?y:null,context_window_fallbacks:s(r.context_window_fallbacks),retry_policy:s(r.retry_policy),model_group_alias:s(r.model_group_alias),enable_tag_filtering:f.enableTagFiltering,routing_strategy_args:s(r.routing_strategy_args)}};(0,r.useEffect)(()=>{if(!p)return;let e=setTimeout(()=>{O.current=!0,p({router_settings:M()})},100);return()=>clearTimeout(e)},[f,y]);let P=Array.from(new Set(j.map(e=>e.model_group))).sort();return((0,r.useImperativeHandle)(g,()=>({getValue:()=>({router_settings:M()})})),e)?(0,t.jsx)("div",{className:"w-full",children:(0,t.jsxs)(l.TabGroup,{className:"w-full",children:[(0,t.jsxs)(i.TabList,{variant:"line",defaultValue:"1",className:"px-8 pt-4",children:[(0,t.jsx)(n.Tab,{value:"1",children:"Loadbalancing"}),(0,t.jsx)(n.Tab,{value:"2",children:"Fallbacks"})]}),(0,t.jsxs)(a.TabPanels,{className:"px-8 py-6",children:[(0,t.jsx)(s.TabPanel,{children:(0,t.jsx)(c.default,{value:f,onChange:x,routerFieldsMetadata:C,availableRoutingStrategies:k,routingStrategyDescriptions:T})}),(0,t.jsx)(s.TabPanel,{children:(0,t.jsx)(d.FallbackSelectionForm,{groups:v,onGroupsChange:e=>{_(e),b(e.filter(e=>e.primaryModel&&e.fallbackModels.length>0).map(e=>({[e.primaryModel]:e.fallbackModels})))},availableModels:P,maxGroups:5})})]})]})}):null});m.displayName="RouterSettingsAccordion",e.s(["default",0,m])},575260,e=>{"use strict";var t=e.i(843476),r=e.i(199133),s=e.i(482725),a=e.i(56456);e.s(["default",0,({projects:e,value:l,onChange:i,disabled:n,loading:o,teamId:c})=>{let d=c?e?.filter(e=>e.team_id===c):e;return(0,t.jsx)(r.Select,{showSearch:!0,placeholder:"Search or select a project",value:l,onChange:i,disabled:n,loading:o,allowClear:!0,notFoundContent:o?(0,t.jsx)(s.Spin,{indicator:(0,t.jsx)(a.LoadingOutlined,{spin:!0}),size:"small"}):void 0,filterOption:(e,t)=>{if(!t)return!1;let r=d?.find(e=>e.project_id===t.key);if(!r)return!1;let s=e.toLowerCase().trim(),a=(r.project_alias||"").toLowerCase(),l=(r.project_id||"").toLowerCase();return a.includes(s)||l.includes(s)},optionFilterProp:"children",children:!o&&d?.map(e=>(0,t.jsxs)(r.Select.Option,{value:e.project_id,children:[(0,t.jsx)("span",{className:"font-medium",children:e.project_alias||e.project_id})," ",(0,t.jsxs)("span",{className:"text-gray-500",children:["(",e.project_id,")"]})]},e.project_id))})}])},702597,364769,e=>{"use strict";var t=e.i(843476),r=e.i(207082),s=e.i(109799),a=e.i(510674),l=e.i(109034),i=e.i(292639),n=e.i(135214),o=e.i(500330),c=e.i(827252),d=e.i(912598),u=e.i(677667),m=e.i(130643),p=e.i(898667),h=e.i(994388),g=e.i(309426),f=e.i(350967),x=e.i(599724),y=e.i(779241),b=e.i(629569),v=e.i(464571),_=e.i(808613),j=e.i(311451),w=e.i(212931),k=e.i(91739),N=e.i(199133),C=e.i(790848),S=e.i(262218),T=e.i(592968),E=e.i(374009),O=e.i(271645),I=e.i(708347),M=e.i(552130),P=e.i(557662),A=e.i(9314),L=e.i(860585),R=e.i(82946),F=e.i(392110),D=e.i(533882),B=e.i(844565),$=e.i(651904),z=e.i(939510),K=e.i(460285),U=e.i(663435),q=e.i(363256),V=e.i(575260),G=e.i(371455),H=e.i(355619),W=e.i(75921),Q=e.i(390605),J=e.i(727749),Y=e.i(764205),X=e.i(237016),Z=e.i(888259);let ee=({apiKey:e})=>{let[r,s]=(0,O.useState)(!1);return(0,t.jsxs)("div",{children:[(0,t.jsxs)("p",{className:"mb-2",children:["Please save this secret key somewhere safe and accessible. For security reasons,"," ",(0,t.jsx)("b",{children:"you will not be able to view it again"})," through your LiteLLM account. If you lose this secret key, you will need to generate a new one."]}),(0,t.jsx)("p",{className:"text-sm text-gray-600 mt-3 mb-1",children:"Virtual Key:"}),(0,t.jsx)("div",{style:{background:"#f8f8f8",padding:"10px",borderRadius:"5px",marginBottom:"10px"},children:(0,t.jsx)("pre",{style:{wordWrap:"break-word",whiteSpace:"normal",margin:0},children:e})}),(0,t.jsx)(X.CopyToClipboard,{text:e,onCopy:()=>{s(!0),Z.default.success("Key copied to clipboard"),setTimeout(()=>s(!1),2e3)},children:(0,t.jsx)(v.Button,{type:"primary",style:{marginTop:12},children:r?"Copied!":"Copy Virtual Key"})})]})};e.s(["default",0,ee],364769);var et=e.i(435451),er=e.i(916940);let{Option:es}=N.Select,ea=async(e,t,r,s)=>{try{if(null===e||null===t)return[];if(null!==r){let a=(await (0,Y.modelAvailableCall)(r,e,t,!0,s,!0)).data.map(e=>e.id);return console.log("available_model_names:",a),a}return[]}catch(e){return console.error("Error fetching user models:",e),[]}},el=async(e,t,r,s)=>{try{if(null===e||null===t)return;if(null!==r){let a=(await (0,Y.modelAvailableCall)(r,e,t)).data.map(e=>e.id);console.log("available_model_names:",a),s(a)}}catch(e){console.error("Error fetching user models:",e)}};e.s(["default",0,({team:e,teams:X,data:Z,addKey:ei,autoOpenCreate:en,prefillData:eo})=>{let{accessToken:ec,userId:ed,userRole:eu,premiumUser:em}=(0,n.default)(),ep=em||null!=eu&&I.rolesWithWriteAccess.includes(eu),{data:eh,isLoading:eg}=(0,s.useOrganizations)(),{data:ef,isLoading:ex}=(0,a.useProjects)(),{data:ey}=(0,i.useUISettings)(),{data:eb}=(0,l.useTags)(),ev=!!ey?.values?.enable_projects_ui,e_=!!ey?.values?.disable_custom_api_keys,ej=eb?Object.values(eb).map(e=>({value:e.name,label:e.name})):[],ew=(0,d.useQueryClient)(),[ek]=_.Form.useForm(),[eN,eC]=(0,O.useState)(!1),[eS,eT]=(0,O.useState)(null),[eE,eO]=(0,O.useState)(null),[eI,eM]=(0,O.useState)([]),[eP,eA]=(0,O.useState)([]),[eL,eR]=(0,O.useState)("you"),[eF,eD]=(0,O.useState)(!1),[eB,e$]=(0,O.useState)(null),[ez,eK]=(0,O.useState)([]),[eU,eq]=(0,O.useState)([]),[eV,eG]=(0,O.useState)([]),[eH,eW]=(0,O.useState)([]),[eQ,eJ]=(0,O.useState)(e),[eY,eX]=(0,O.useState)(null),[eZ,e0]=(0,O.useState)(null),[e1,e2]=(0,O.useState)(!1),[e4,e3]=(0,O.useState)(null),[e6,e5]=(0,O.useState)({}),[e7,e8]=(0,O.useState)([]),[e9,te]=(0,O.useState)(!1),[tt,tr]=(0,O.useState)([]),[ts,ta]=(0,O.useState)([]),[tl,ti]=(0,O.useState)("llm_api"),[tn,to]=(0,O.useState)({}),[tc,td]=(0,O.useState)(!1),[tu,tm]=(0,O.useState)("30d"),[tp,th]=(0,O.useState)(null),[tg,tf]=(0,O.useState)(0),[tx,ty]=(0,O.useState)([]),[tb,tv]=(0,O.useState)(null),t_=()=>{eC(!1),ek.resetFields(),eW([]),ta([]),ti("llm_api"),to({}),td(!1),tm("30d"),th(null),tf(e=>e+1),tv(null),eX(null),e0(null)},tj=()=>{eC(!1),eT(null),eJ(null),ek.resetFields(),eW([]),ta([]),ti("llm_api"),to({}),td(!1),tm("30d"),th(null),tf(e=>e+1),tv(null),eX(null),e0(null)};(0,O.useEffect)(()=>{ed&&eu&&ec&&el(ed,eu,ec,eM)},[ec,ed,eu]),(0,O.useEffect)(()=>{ec&&(0,Y.getAgentsList)(ec).then(e=>ty(e?.agents||[])).catch(()=>ty([]))},[ec]),(0,O.useEffect)(()=>{let e=async()=>{try{let e=(await (0,Y.getPoliciesList)(ec)).policies.map(e=>e.policy_name);eq(e)}catch(e){console.error("Failed to fetch policies:",e)}},t=async()=>{try{let e=await (0,Y.getPromptsList)(ec);eG(e.prompts.map(e=>e.prompt_id))}catch(e){console.error("Failed to fetch prompts:",e)}};(async()=>{try{let e=(await (0,Y.getGuardrailsList)(ec)).guardrails.map(e=>e.guardrail_name);eK(e)}catch(e){console.error("Failed to fetch guardrails:",e)}})(),e(),t()},[ec]),(0,O.useEffect)(()=>{(async()=>{try{if(ec){let e=sessionStorage.getItem("possibleUserRoles");if(e)e5(JSON.parse(e));else{let e=await (0,Y.getPossibleUserRoles)(ec);sessionStorage.setItem("possibleUserRoles",JSON.stringify(e)),e5(e)}}}catch(e){console.error("Error fetching possible user roles:",e)}})()},[ec]),(0,O.useEffect)(()=>{if(en&&!eF&&X&&eu&&I.rolesWithWriteAccess.includes(eu)&&(eC(!0),eD(!0),eo)){if(eo.owned_by&&("another_user"===eo.owned_by&&"Admin"!==eu?eR("you"):eR(eo.owned_by)),eo.team_id){let e=X?.find(e=>e.team_id===eo.team_id)||null;e&&(eJ(e),ek.setFieldsValue({team_id:eo.team_id}))}eo.key_alias&&ek.setFieldsValue({key_alias:eo.key_alias}),eo.models&&eo.models.length>0&&e$(eo.models),eo.key_type&&(ti(eo.key_type),ek.setFieldsValue({key_type:eo.key_type}))}},[en,eo,X,eF,ek,eu]);let tw=eP.includes("no-default-models")&&!eQ,tk=async e=>{try{let t,s=e?.key_alias??"",a=e?.team_id??null;if((Z?.filter(e=>e.team_id===a).map(e=>e.key_alias)??[]).includes(s))throw Error(`Key alias ${s} already exists for team with ID ${a}, please provide another key alias`);if(J.default.info("Making API Call"),eC(!0),"you"===eL)e.user_id=ed;else if("agent"===eL){if(!tb)return void J.default.fromBackend("Please select an agent");e.agent_id=tb}let l={};try{l=JSON.parse(e.metadata||"{}")}catch(e){console.error("Error parsing metadata:",e)}if("service_account"===eL&&(l.service_account_id=e.key_alias),eH.length>0&&(l={...l,logging:eH.filter(e=>e.callback_name)}),ts.length>0){let e=(0,P.mapDisplayToInternalNames)(ts);l={...l,litellm_disabled_callbacks:e}}if(tc&&(e.auto_rotate=!0,e.rotation_interval=tu),e.duration&&""!==e.duration.trim()||(e.duration=null),e.metadata=JSON.stringify(l),e.allowed_vector_store_ids&&e.allowed_vector_store_ids.length>0&&(e.object_permission={vector_stores:e.allowed_vector_store_ids},delete e.allowed_vector_store_ids),e.allowed_mcp_servers_and_groups&&(e.allowed_mcp_servers_and_groups.servers?.length>0||e.allowed_mcp_servers_and_groups.accessGroups?.length>0)){e.object_permission||(e.object_permission={});let{servers:t,accessGroups:r}=e.allowed_mcp_servers_and_groups;t&&t.length>0&&(e.object_permission.mcp_servers=t),r&&r.length>0&&(e.object_permission.mcp_access_groups=r),delete e.allowed_mcp_servers_and_groups}let i=e.mcp_tool_permissions||{};if(Object.keys(i).length>0&&(e.object_permission||(e.object_permission={}),e.object_permission.mcp_tool_permissions=i),delete e.mcp_tool_permissions,e.allowed_mcp_access_groups&&e.allowed_mcp_access_groups.length>0&&(e.object_permission||(e.object_permission={}),e.object_permission.mcp_access_groups=e.allowed_mcp_access_groups,delete e.allowed_mcp_access_groups),e.allowed_agents_and_groups&&(e.allowed_agents_and_groups.agents?.length>0||e.allowed_agents_and_groups.accessGroups?.length>0)){e.object_permission||(e.object_permission={});let{agents:t,accessGroups:r}=e.allowed_agents_and_groups;t&&t.length>0&&(e.object_permission.agents=t),r&&r.length>0&&(e.object_permission.agent_access_groups=r),delete e.allowed_agents_and_groups}Object.keys(tn).length>0&&(e.aliases=JSON.stringify(tn)),tp?.router_settings&&Object.values(tp.router_settings).some(e=>null!=e&&""!==e)&&(e.router_settings=tp.router_settings),t="service_account"===eL?await (0,Y.keyCreateServiceAccountCall)(ec,e):await (0,Y.keyCreateCall)(ec,ed,e),console.log("key create Response:",t),ei(t),ew.invalidateQueries({queryKey:r.keyKeys.lists()}),eT(t.key),eO(t.soft_budget),J.default.success("Virtual Key Created"),ek.resetFields(),localStorage.removeItem("userData"+ed)}catch(t){console.log("error in create key:",t);let e=(e=>{let t;if(!(t=!e||"object"!=typeof e||e instanceof Error?String(e):JSON.stringify(e)).includes("/key/generate")&&!t.includes("KeyManagementRoutes.KEY_GENERATE"))return`Error creating the key: ${e}`;let r=t;try{if(!e||"object"!=typeof e||e instanceof Error){let e=t.match(/\{[\s\S]*\}/);if(e){let t=JSON.parse(e[0]),s=t?.error||t;s?.message&&(r=s.message)}}else{let t=e?.error||e;t?.message&&(r=t.message)}}catch(e){}return t.includes("team_member_permission_error")||r.includes("Team member does not have permissions")?"Team member does not have permission to generate key for this team. Ask your proxy admin to configure the team member permission settings.":`Error creating the key: ${e}`})(t);J.default.fromBackend(e)}};(0,O.useEffect)(()=>{if(eZ){let e=ef?.find(e=>e.project_id===eZ);eA(e?.models??[]),ek.setFieldValue("models",[]);return}ed&&eu&&ec&&ea(ed,eu,ec,eQ?.team_id??null).then(e=>{eA(Array.from(new Set([...eQ?.models??[],...e])))}),eB||ek.setFieldValue("models",[]),ek.setFieldValue("allowed_mcp_servers_and_groups",{servers:[],accessGroups:[]})},[eQ,eZ,ec,ed,eu,ek]),(0,O.useEffect)(()=>{if(!eB||0===eB.length||!eP||0===eP.length)return;let e=eB.filter(e=>eP.includes(e));e.length>0&&ek.setFieldsValue({models:e}),e$(null)},[eB,eP,ek]),(0,O.useEffect)(()=>{if(!eZ||!X)return;let e=ef?.find(e=>e.project_id===eZ);if(!e?.team_id||eQ?.team_id===e.team_id)return;let t=X.find(t=>t.team_id===e.team_id)||null;t&&(eJ(t),ek.setFieldValue("team_id",t.team_id))},[X,eZ,ef]);let tN=async e=>{if(!e)return void e8([]);te(!0);try{let t=new URLSearchParams;if(t.append("user_email",e),null==ec)return;let r=(await (0,Y.userFilterUICall)(ec,t)).map(e=>({label:`${e.user_email} (${e.user_id})`,value:e.user_id,user:e}));e8(r)}catch(e){console.error("Error fetching users:",e),J.default.fromBackend("Failed to search for users")}finally{te(!1)}},tC=(0,O.useCallback)((0,E.default)(e=>tN(e),300),[ec]);return(0,t.jsxs)("div",{children:[eu&&I.rolesWithWriteAccess.includes(eu)&&(0,t.jsx)(h.Button,{className:"mx-auto",onClick:()=>eC(!0),children:"+ Create New Key"}),(0,t.jsx)(w.Modal,{open:eN,width:1e3,footer:null,onOk:t_,onCancel:tj,children:(0,t.jsxs)(_.Form,{form:ek,onFinish:tk,labelCol:{span:8},wrapperCol:{span:16},labelAlign:"left",children:[(0,t.jsxs)("div",{className:"mb-8",children:[(0,t.jsx)(b.Title,{className:"mb-4",children:"Key Ownership"}),(0,t.jsx)(_.Form.Item,{label:(0,t.jsxs)("span",{children:["Owned By"," ",(0,t.jsx)(T.Tooltip,{title:"Select who will own this Virtual Key",children:(0,t.jsx)(c.InfoCircleOutlined,{style:{marginLeft:"4px"}})})]}),className:"mb-4",children:(0,t.jsxs)(k.Radio.Group,{onChange:e=>eR(e.target.value),value:eL,children:[(0,t.jsx)(k.Radio,{value:"you",children:"You"}),(0,t.jsx)(k.Radio,{value:"service_account",children:"Service Account"}),"Admin"===eu&&(0,t.jsx)(k.Radio,{value:"another_user",children:"Another User"}),(0,t.jsxs)(k.Radio,{value:"agent",children:["Agent ",(0,t.jsx)(S.Tag,{color:"purple",children:"New"})]})]})}),"another_user"===eL&&(0,t.jsx)(_.Form.Item,{label:(0,t.jsxs)("span",{children:["User ID"," ",(0,t.jsx)(T.Tooltip,{title:"The user who will own this key and be responsible for its usage",children:(0,t.jsx)(c.InfoCircleOutlined,{style:{marginLeft:"4px"}})})]}),name:"user_id",className:"mt-4",rules:[{required:"another_user"===eL,message:"Please input the user ID of the user you are assigning the key to"}],children:(0,t.jsxs)("div",{children:[(0,t.jsxs)("div",{style:{display:"flex",marginBottom:"8px"},children:[(0,t.jsx)(N.Select,{showSearch:!0,placeholder:"Type email to search for users",filterOption:!1,onSearch:e=>{tC(e)},onSelect:(e,t)=>{let r;return r=t.user,void ek.setFieldsValue({user_id:r.user_id})},options:e7,loading:e9,allowClear:!0,style:{width:"100%"},notFoundContent:e9?"Searching...":"No users found"}),(0,t.jsx)(v.Button,{onClick:()=>e2(!0),style:{marginLeft:"8px"},children:"Create User"})]}),(0,t.jsx)("div",{className:"text-xs text-gray-500",children:"Search by email to find users"})]})}),"agent"===eL&&(0,t.jsxs)("div",{className:"mt-4 p-4 bg-purple-50 border border-purple-200 rounded-md",children:[(0,t.jsx)("div",{className:"mb-3",children:(0,t.jsxs)("span",{className:"text-sm font-medium text-gray-700",children:["Select Agent ",(0,t.jsx)("span",{className:"text-red-500",children:"*"})]})}),(0,t.jsx)(N.Select,{showSearch:!0,placeholder:"Select an agent",style:{width:"100%"},value:tb,onChange:e=>tv(e),filterOption:(e,t)=>t?.label?.toLowerCase().includes(e.toLowerCase()),options:tx.map(e=>({label:e.agent_name||e.agent_id,value:e.agent_id}))}),(0,t.jsx)("div",{className:"text-xs text-gray-500 mt-2",children:"This key will be used by the selected agent to make requests to LiteLLM"})]}),(0,t.jsx)(_.Form.Item,{label:(0,t.jsxs)("span",{children:["Organization"," ",(0,t.jsx)(T.Tooltip,{title:"The organization this key belongs to. Selecting an organization filters the available teams.",children:(0,t.jsx)(c.InfoCircleOutlined,{style:{marginLeft:"4px"}})})]}),name:"organization_id",className:"mt-4",children:(0,t.jsx)(q.default,{organizations:eh,loading:eg,disabled:"Admin"!==eu,onChange:e=>{eX(e||null),eJ(null),e0(null),ek.setFieldValue("team_id",void 0),ek.setFieldValue("project_id",void 0)}})}),(0,t.jsx)(_.Form.Item,{label:(0,t.jsxs)("span",{children:["Team"," ",(0,t.jsx)(T.Tooltip,{title:"The team this key belongs to, which determines available models and budget limits",children:(0,t.jsx)(c.InfoCircleOutlined,{style:{marginLeft:"4px"}})})]}),name:"team_id",initialValue:e?e.team_id:null,className:"mt-4",rules:[{required:"service_account"===eL,message:"Please select a team for the service account"}],help:"service_account"===eL?"required":"",children:(0,t.jsx)(U.default,{disabled:null!==eZ,organizationId:eY,onTeamSelect:e=>{eJ(e),e0(null),ek.setFieldValue("project_id",void 0),e?.organization_id?(eX(e.organization_id),ek.setFieldValue("organization_id",e.organization_id)):e||(eX(null),ek.setFieldValue("organization_id",void 0))}})}),ev&&(0,t.jsx)(_.Form.Item,{label:(0,t.jsxs)("span",{children:["Project"," ",(0,t.jsx)(T.Tooltip,{title:"Assign this key to a project. Selecting a project will lock the team to the project's team.",children:(0,t.jsx)(c.InfoCircleOutlined,{style:{marginLeft:"4px"}})})]}),name:"project_id",className:"mt-4",children:(0,t.jsx)(V.default,{projects:ef,teamId:eQ?.team_id,loading:ex||!X,onChange:e=>{if(!e){e0(null),eJ(null),ek.setFieldValue("team_id",void 0);return}e0(e)}})})]}),tw&&(0,t.jsx)("div",{className:"mb-8 p-4 bg-blue-50 border border-blue-200 rounded-md",children:(0,t.jsx)(x.Text,{className:"text-blue-800 text-sm",children:"Please select a team to continue configuring your Virtual Key. If you do not see any teams, please contact your Proxy Admin to either provide you with access to models or to add you to a team."})}),!tw&&(0,t.jsxs)("div",{className:"mb-8",children:[(0,t.jsx)(b.Title,{className:"mb-4",children:"Key Details"}),(0,t.jsx)(_.Form.Item,{label:(0,t.jsxs)("span",{children:["you"===eL||"another_user"===eL?"Key Name":"Service Account ID"," ",(0,t.jsx)(T.Tooltip,{title:"you"===eL||"another_user"===eL?"A descriptive name to identify this key":"Unique identifier for this service account",children:(0,t.jsx)(c.InfoCircleOutlined,{style:{marginLeft:"4px"}})})]}),name:"key_alias",rules:[{required:!0,message:`Please input a ${"you"===eL?"key name":"service account ID"}`}],help:"required",children:(0,t.jsx)(y.TextInput,{placeholder:""})}),(0,t.jsx)(_.Form.Item,{label:(0,t.jsxs)("span",{children:["Models"," ",(0,t.jsx)(T.Tooltip,{title:"Select which models this key can access. Choose 'All Team Models' to grant access to all models available to the team. Leave empty to allow access to all models.",children:(0,t.jsx)(c.InfoCircleOutlined,{style:{marginLeft:"4px"}})})]}),name:"models",rules:[],help:"management"===tl||"read_only"===tl?"Models field is disabled for this key type":"optional - leave empty to allow access to all models",className:"mt-4",children:(0,t.jsxs)(N.Select,{mode:"multiple",placeholder:"Select models",style:{width:"100%"},disabled:"management"===tl||"read_only"===tl,onChange:e=>{e.includes("all-team-models")&&ek.setFieldsValue({models:["all-team-models"]})},children:[!eZ&&(0,t.jsx)(es,{value:"all-team-models",children:"All Team Models"},"all-team-models"),eP.map(e=>(0,t.jsx)(es,{value:e,children:(0,H.getModelDisplayName)(e)},e))]})}),(0,t.jsx)(_.Form.Item,{label:(0,t.jsxs)("span",{children:["Key Type"," ",(0,t.jsx)(T.Tooltip,{title:"Select the type of key to determine what routes and operations this key can access",children:(0,t.jsx)(c.InfoCircleOutlined,{style:{marginLeft:"4px"}})})]}),name:"key_type",initialValue:"llm_api",className:"mt-4",children:(0,t.jsxs)(N.Select,{defaultValue:"llm_api",placeholder:"Select key type",style:{width:"100%"},optionLabelProp:"label",onChange:e=>{ti(e),("management"===e||"read_only"===e)&&ek.setFieldsValue({models:[]})},children:[(0,t.jsx)(es,{value:"default",label:"Default",children:(0,t.jsxs)("div",{style:{padding:"4px 0"},children:[(0,t.jsx)("div",{style:{fontWeight:500},children:"Default"}),(0,t.jsx)("div",{style:{fontSize:"11px",color:"#6b7280",marginTop:"2px"},children:"Can call AI APIs + Management routes"})]})}),(0,t.jsx)(es,{value:"llm_api",label:"AI APIs",children:(0,t.jsxs)("div",{style:{padding:"4px 0"},children:[(0,t.jsx)("div",{style:{fontWeight:500},children:"AI APIs"}),(0,t.jsx)("div",{style:{fontSize:"11px",color:"#6b7280",marginTop:"2px"},children:"Can call only AI API routes (chat/completions, embeddings, etc.)"})]})}),(0,t.jsx)(es,{value:"management",label:"Management",children:(0,t.jsxs)("div",{style:{padding:"4px 0"},children:[(0,t.jsx)("div",{style:{fontWeight:500},children:"Management"}),(0,t.jsx)("div",{style:{fontSize:"11px",color:"#6b7280",marginTop:"2px"},children:"Can call only management routes (user/team/key management)"})]})})]})})]}),!tw&&(0,t.jsx)("div",{className:"mb-8",children:(0,t.jsxs)(u.Accordion,{className:"mt-4 mb-4",children:[(0,t.jsx)(p.AccordionHeader,{children:(0,t.jsx)(b.Title,{className:"m-0",children:"Optional Settings"})}),(0,t.jsxs)(m.AccordionBody,{children:[(0,t.jsx)(_.Form.Item,{className:"mt-4",label:(0,t.jsxs)("span",{children:["Max Budget (USD)"," ",(0,t.jsx)(T.Tooltip,{title:"Maximum amount in USD this key can spend. When reached, the key will be blocked from making further requests",children:(0,t.jsx)(c.InfoCircleOutlined,{style:{marginLeft:"4px"}})})]}),name:"max_budget",help:`Budget cannot exceed team max budget: $${e?.max_budget!==null&&e?.max_budget!==void 0?e?.max_budget:"unlimited"}`,rules:[{validator:async(t,r)=>{if(r&&e&&null!==e.max_budget&&r>e.max_budget)throw Error(`Budget cannot exceed team max budget: $${(0,o.formatNumberWithCommas)(e.max_budget,4)}`)}}],children:(0,t.jsx)(et.default,{step:.01,precision:2,width:200})}),(0,t.jsx)(_.Form.Item,{className:"mt-4",label:(0,t.jsxs)("span",{children:["Reset Budget"," ",(0,t.jsx)(T.Tooltip,{title:"How often the budget should reset. For example, setting 'daily' will reset the budget every 24 hours",children:(0,t.jsx)(c.InfoCircleOutlined,{style:{marginLeft:"4px"}})})]}),name:"budget_duration",help:`Team Reset Budget: ${e?.budget_duration!==null&&e?.budget_duration!==void 0?e?.budget_duration:"None"}`,children:(0,t.jsx)(L.default,{onChange:e=>ek.setFieldValue("budget_duration",e)})}),(0,t.jsx)(_.Form.Item,{className:"mt-4",label:(0,t.jsxs)("span",{children:["Tokens per minute Limit (TPM)"," ",(0,t.jsx)(T.Tooltip,{title:"Maximum number of tokens this key can process per minute. Helps control usage and costs",children:(0,t.jsx)(c.InfoCircleOutlined,{style:{marginLeft:"4px"}})})]}),name:"tpm_limit",help:`TPM cannot exceed team TPM limit: ${e?.tpm_limit!==null&&e?.tpm_limit!==void 0?e?.tpm_limit:"unlimited"}`,rules:[{validator:async(t,r)=>{if(r&&e&&null!==e.tpm_limit&&r>e.tpm_limit)throw Error(`TPM limit cannot exceed team TPM limit: ${e.tpm_limit}`)}}],children:(0,t.jsx)(et.default,{step:1,width:400})}),(0,t.jsx)(z.default,{type:"tpm",name:"tpm_limit_type",className:"mt-4",initialValue:null,form:ek,showDetailedDescriptions:!0}),(0,t.jsx)(_.Form.Item,{className:"mt-4",label:(0,t.jsxs)("span",{children:["Requests per minute Limit (RPM)"," ",(0,t.jsx)(T.Tooltip,{title:"Maximum number of API requests this key can make per minute. Helps prevent abuse and manage load",children:(0,t.jsx)(c.InfoCircleOutlined,{style:{marginLeft:"4px"}})})]}),name:"rpm_limit",help:`RPM cannot exceed team RPM limit: ${e?.rpm_limit!==null&&e?.rpm_limit!==void 0?e?.rpm_limit:"unlimited"}`,rules:[{validator:async(t,r)=>{if(r&&e&&null!==e.rpm_limit&&r>e.rpm_limit)throw Error(`RPM limit cannot exceed team RPM limit: ${e.rpm_limit}`)}}],children:(0,t.jsx)(et.default,{step:1,width:400})}),(0,t.jsx)(z.default,{type:"rpm",name:"rpm_limit_type",className:"mt-4",initialValue:null,form:ek,showDetailedDescriptions:!0}),(0,t.jsx)(_.Form.Item,{label:(0,t.jsxs)("span",{children:["Guardrails"," ",(0,t.jsx)(T.Tooltip,{title:"Apply safety guardrails to this key to filter content or enforce policies",children:(0,t.jsx)("a",{href:"https://docs.litellm.ai/docs/proxy/guardrails/quick_start",target:"_blank",rel:"noopener noreferrer",onClick:e=>e.stopPropagation(),children:(0,t.jsx)(c.InfoCircleOutlined,{style:{marginLeft:"4px"}})})})]}),name:"guardrails",className:"mt-4",help:ep?"Select existing guardrails or enter new ones":"Premium feature - Upgrade to set guardrails by key",children:(0,t.jsx)(N.Select,{mode:"tags",style:{width:"100%"},disabled:!ep,placeholder:ep?"Select or enter guardrails":"Premium feature - Upgrade to set guardrails by key",options:ez.map(e=>({value:e,label:e}))})}),(0,t.jsx)(_.Form.Item,{label:(0,t.jsxs)("span",{children:["Disable Global Guardrails"," ",(0,t.jsx)(T.Tooltip,{title:"When enabled, this key will bypass any guardrails configured to run on every request (global guardrails)",children:(0,t.jsx)("a",{href:"https://docs.litellm.ai/docs/proxy/guardrails/quick_start",target:"_blank",rel:"noopener noreferrer",onClick:e=>e.stopPropagation(),children:(0,t.jsx)(c.InfoCircleOutlined,{style:{marginLeft:"4px"}})})})]}),name:"disable_global_guardrails",className:"mt-4",valuePropName:"checked",help:ep?"Bypass global guardrails for this key":"Premium feature - Upgrade to disable global guardrails by key",children:(0,t.jsx)(C.Switch,{disabled:!ep,checkedChildren:"Yes",unCheckedChildren:"No"})}),(0,t.jsx)(_.Form.Item,{label:(0,t.jsxs)("span",{children:["Policies"," ",(0,t.jsx)(T.Tooltip,{title:"Apply policies to this key to control guardrails and other settings",children:(0,t.jsx)("a",{href:"https://docs.litellm.ai/docs/proxy/guardrails/guardrail_policies",target:"_blank",rel:"noopener noreferrer",onClick:e=>e.stopPropagation(),children:(0,t.jsx)(c.InfoCircleOutlined,{style:{marginLeft:"4px"}})})})]}),name:"policies",className:"mt-4",help:em?"Select existing policies or enter new ones":"Premium feature - Upgrade to set policies by key",children:(0,t.jsx)(N.Select,{mode:"tags",style:{width:"100%"},disabled:!em,placeholder:em?"Select or enter policies":"Premium feature - Upgrade to set policies by key",options:eU.map(e=>({value:e,label:e}))})}),(0,t.jsx)(_.Form.Item,{label:(0,t.jsxs)("span",{children:["Prompts"," ",(0,t.jsx)(T.Tooltip,{title:"Allow this key to use specific prompt templates",children:(0,t.jsx)("a",{href:"https://docs.litellm.ai/docs/proxy/prompt_management",target:"_blank",rel:"noopener noreferrer",onClick:e=>e.stopPropagation(),children:(0,t.jsx)(c.InfoCircleOutlined,{style:{marginLeft:"4px"}})})})]}),name:"prompts",className:"mt-4",help:em?"Select existing prompts or enter new ones":"Premium feature - Upgrade to set prompts by key",children:(0,t.jsx)(N.Select,{mode:"tags",style:{width:"100%"},disabled:!em,placeholder:em?"Select or enter prompts":"Premium feature - Upgrade to set prompts by key",options:eV.map(e=>({value:e,label:e}))})}),(0,t.jsx)(_.Form.Item,{label:(0,t.jsxs)("span",{children:["Access Groups"," ",(0,t.jsx)(T.Tooltip,{title:"Assign access groups to this key. Access groups control which models, MCP servers, and agents this key can use",children:(0,t.jsx)(c.InfoCircleOutlined,{style:{marginLeft:"4px"}})})]}),name:"access_group_ids",className:"mt-4",help:"Select access groups to assign to this key",children:(0,t.jsx)(A.default,{placeholder:"Select access groups (optional)"})}),(0,t.jsx)(_.Form.Item,{label:(0,t.jsxs)("span",{children:["Allowed Pass Through Routes"," ",(0,t.jsx)(T.Tooltip,{title:"Allow this key to use specific pass through routes",children:(0,t.jsx)("a",{href:"https://docs.litellm.ai/docs/proxy/pass_through",target:"_blank",rel:"noopener noreferrer",onClick:e=>e.stopPropagation(),children:(0,t.jsx)(c.InfoCircleOutlined,{style:{marginLeft:"4px"}})})})]}),name:"allowed_passthrough_routes",className:"mt-4",help:em?"Select existing pass through routes or enter new ones":"Premium feature - Upgrade to set pass through routes by key",children:(0,t.jsx)(B.default,{onChange:e=>ek.setFieldValue("allowed_passthrough_routes",e),value:ek.getFieldValue("allowed_passthrough_routes"),accessToken:ec,placeholder:em?"Select or enter pass through routes":"Premium feature - Upgrade to set pass through routes by key",disabled:!em,teamId:eQ?eQ.team_id:null})}),(0,t.jsx)(_.Form.Item,{label:(0,t.jsxs)("span",{children:["Allowed Vector Stores"," ",(0,t.jsx)(T.Tooltip,{title:"Select which vector stores this key can access. If none selected, the key will have access to all available vector stores",children:(0,t.jsx)(c.InfoCircleOutlined,{style:{marginLeft:"4px"}})})]}),name:"allowed_vector_store_ids",className:"mt-4",help:"Select vector stores this key can access. Leave empty for access to all vector stores",children:(0,t.jsx)(er.default,{onChange:e=>ek.setFieldValue("allowed_vector_store_ids",e),value:ek.getFieldValue("allowed_vector_store_ids"),accessToken:ec,placeholder:"Select vector stores (optional)"})}),(0,t.jsx)(_.Form.Item,{label:(0,t.jsxs)("span",{children:["Metadata"," ",(0,t.jsx)(T.Tooltip,{title:"JSON object with additional information about this key. Used for tracking or custom logic",children:(0,t.jsx)(c.InfoCircleOutlined,{style:{marginLeft:"4px"}})})]}),name:"metadata",className:"mt-4",children:(0,t.jsx)(j.Input.TextArea,{rows:4,placeholder:"Enter metadata as JSON"})}),(0,t.jsx)(_.Form.Item,{label:(0,t.jsxs)("span",{children:["Tags"," ",(0,t.jsx)(T.Tooltip,{title:"Tags for tracking spend and/or doing tag-based routing. Used for analytics and filtering",children:(0,t.jsx)(c.InfoCircleOutlined,{style:{marginLeft:"4px"}})})]}),name:"tags",className:"mt-4",help:"Tags for tracking spend and/or doing tag-based routing.",children:(0,t.jsx)(N.Select,{mode:"tags",style:{width:"100%"},placeholder:"Select or enter tags",tokenSeparators:[","],options:ej})}),(0,t.jsxs)(u.Accordion,{className:"mt-4 mb-4",children:[(0,t.jsx)(p.AccordionHeader,{children:(0,t.jsx)("b",{children:"MCP Settings"})}),(0,t.jsxs)(m.AccordionBody,{children:[(0,t.jsx)(_.Form.Item,{label:(0,t.jsxs)("span",{children:["Allowed MCP Servers"," ",(0,t.jsx)(T.Tooltip,{title:"Select which MCP servers or access groups this key can access",children:(0,t.jsx)(c.InfoCircleOutlined,{style:{marginLeft:"4px"}})})]}),name:"allowed_mcp_servers_and_groups",help:"Select MCP servers or access groups this key can access",children:(0,t.jsx)(W.default,{onChange:e=>ek.setFieldValue("allowed_mcp_servers_and_groups",e),value:ek.getFieldValue("allowed_mcp_servers_and_groups"),accessToken:ec,teamId:eQ?.team_id??null,placeholder:"Select MCP servers or access groups (optional)"})}),(0,t.jsx)(_.Form.Item,{name:"mcp_tool_permissions",initialValue:{},hidden:!0,children:(0,t.jsx)(j.Input,{type:"hidden"})}),(0,t.jsx)(_.Form.Item,{noStyle:!0,shouldUpdate:(e,t)=>e.allowed_mcp_servers_and_groups!==t.allowed_mcp_servers_and_groups||e.mcp_tool_permissions!==t.mcp_tool_permissions,children:()=>(0,t.jsx)("div",{className:"mt-6",children:(0,t.jsx)(Q.default,{accessToken:ec,selectedServers:ek.getFieldValue("allowed_mcp_servers_and_groups")?.servers||[],toolPermissions:ek.getFieldValue("mcp_tool_permissions")||{},onChange:e=>ek.setFieldsValue({mcp_tool_permissions:e})})})})]})]}),(0,t.jsxs)(u.Accordion,{className:"mt-4 mb-4",children:[(0,t.jsx)(p.AccordionHeader,{children:(0,t.jsx)("b",{children:"Agent Settings"})}),(0,t.jsx)(m.AccordionBody,{children:(0,t.jsx)(_.Form.Item,{label:(0,t.jsxs)("span",{children:["Allowed Agents"," ",(0,t.jsx)(T.Tooltip,{title:"Select which agents or access groups this key can access",children:(0,t.jsx)(c.InfoCircleOutlined,{style:{marginLeft:"4px"}})})]}),name:"allowed_agents_and_groups",help:"Select agents or access groups this key can access",children:(0,t.jsx)(M.default,{onChange:e=>ek.setFieldValue("allowed_agents_and_groups",e),value:ek.getFieldValue("allowed_agents_and_groups"),accessToken:ec,placeholder:"Select agents or access groups (optional)"})})})]}),em?(0,t.jsxs)(u.Accordion,{className:"mt-4 mb-4",children:[(0,t.jsx)(p.AccordionHeader,{children:(0,t.jsx)("b",{children:"Logging Settings"})}),(0,t.jsx)(m.AccordionBody,{children:(0,t.jsx)("div",{className:"mt-4",children:(0,t.jsx)($.default,{value:eH,onChange:eW,premiumUser:!0,disabledCallbacks:ts,onDisabledCallbacksChange:ta})})})]}):(0,t.jsx)(T.Tooltip,{title:(0,t.jsxs)("span",{children:["Key-level logging settings is an enterprise feature, get in touch -",(0,t.jsx)("a",{href:"https://www.litellm.ai/enterprise",target:"_blank",children:"https://www.litellm.ai/enterprise"})]}),placement:"top",children:(0,t.jsxs)("div",{style:{position:"relative"},children:[(0,t.jsx)("div",{style:{opacity:.5},children:(0,t.jsxs)(u.Accordion,{className:"mt-4 mb-4",children:[(0,t.jsx)(p.AccordionHeader,{children:(0,t.jsx)("b",{children:"Logging Settings"})}),(0,t.jsx)(m.AccordionBody,{children:(0,t.jsx)("div",{className:"mt-4",children:(0,t.jsx)($.default,{value:eH,onChange:eW,premiumUser:!1,disabledCallbacks:ts,onDisabledCallbacksChange:ta})})})]})}),(0,t.jsx)("div",{style:{position:"absolute",inset:0,cursor:"not-allowed"}})]})}),(0,t.jsxs)(u.Accordion,{className:"mt-4 mb-4",children:[(0,t.jsx)(p.AccordionHeader,{children:(0,t.jsx)("b",{children:"Router Settings"})}),(0,t.jsx)(m.AccordionBody,{children:(0,t.jsx)("div",{className:"mt-4 w-full",children:(0,t.jsx)(K.default,{accessToken:ec||"",value:tp||void 0,onChange:th,modelData:eI.length>0?{data:eI.map(e=>({model_name:e}))}:void 0},tg)})})]},`router-settings-accordion-${tg}`),(0,t.jsxs)(u.Accordion,{className:"mt-4 mb-4",children:[(0,t.jsx)(p.AccordionHeader,{children:(0,t.jsx)("b",{children:"Model Aliases"})}),(0,t.jsx)(m.AccordionBody,{children:(0,t.jsxs)("div",{className:"mt-4",children:[(0,t.jsx)(x.Text,{className:"text-sm text-gray-600 mb-4",children:"Create custom aliases for models that can be used in API calls. This allows you to create shortcuts for specific models."}),(0,t.jsx)(D.default,{accessToken:ec,initialModelAliases:tn,onAliasUpdate:to,showExampleConfig:!1})]})})]}),(0,t.jsxs)(u.Accordion,{className:"mt-4 mb-4",children:[(0,t.jsx)(p.AccordionHeader,{children:(0,t.jsx)("b",{children:"Key Lifecycle"})}),(0,t.jsx)(m.AccordionBody,{children:(0,t.jsx)("div",{className:"mt-4",children:(0,t.jsx)(F.default,{form:ek,autoRotationEnabled:tc,onAutoRotationChange:td,rotationInterval:tu,onRotationIntervalChange:tm,isCreateMode:!0})})}),(0,t.jsx)(_.Form.Item,{name:"duration",hidden:!0,initialValue:null,children:(0,t.jsx)(j.Input,{})})]}),(0,t.jsxs)(u.Accordion,{className:"mt-4 mb-4",children:[(0,t.jsx)(p.AccordionHeader,{children:(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("b",{children:"Advanced Settings"}),(0,t.jsx)(T.Tooltip,{title:(0,t.jsxs)("span",{children:["Learn more about advanced settings in our"," ",(0,t.jsx)("a",{href:Y.proxyBaseUrl?`${Y.proxyBaseUrl}/#/key%20management/generate_key_fn_key_generate_post`:"/#/key%20management/generate_key_fn_key_generate_post",target:"_blank",rel:"noopener noreferrer",className:"text-blue-400 hover:text-blue-300",children:"documentation"})]}),children:(0,t.jsx)(c.InfoCircleOutlined,{className:"text-gray-400 hover:text-gray-300 cursor-help"})})]})}),(0,t.jsx)(m.AccordionBody,{children:(0,t.jsx)(R.default,{schemaComponent:"GenerateKeyRequest",form:ek,excludedFields:["key_alias","team_id","organization_id","models","duration","metadata","tags","guardrails","max_budget","budget_duration","tpm_limit","rpm_limit",...e_?["key"]:[]]})})]})]})]})}),(0,t.jsx)("div",{style:{textAlign:"right",marginTop:"10px"},children:(0,t.jsx)(v.Button,{htmlType:"submit",disabled:tw,style:{opacity:tw?.5:1},children:"Create Key"})})]})}),e1&&(0,t.jsx)(w.Modal,{title:"Create New User",open:e1,onCancel:()=>e2(!1),footer:null,width:800,children:(0,t.jsx)(G.CreateUserButton,{userID:ed,accessToken:ec,teams:X,possibleUIRoles:e6,onUserCreated:e=>{e3(e),ek.setFieldsValue({user_id:e}),e2(!1)},isEmbedded:!0})}),eS&&(0,t.jsx)(w.Modal,{open:eN,onOk:t_,onCancel:tj,footer:null,children:(0,t.jsxs)(f.Grid,{numItems:1,className:"gap-2 w-full",children:[(0,t.jsx)(b.Title,{children:"Save your Key"}),(0,t.jsx)(g.Col,{numColSpan:1,children:null!=eS?(0,t.jsx)(ee,{apiKey:eS}):(0,t.jsx)(x.Text,{children:"Key being created, this might take 30s"})})]})})]})},"fetchTeamModels",0,ea,"fetchUserModels",0,el],702597)}]); \ No newline at end of file +(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,743151,(e,t,r)=>{"use strict";function s(e){return(s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}Object.defineProperty(r,"__esModule",{value:!0}),r.CopyToClipboard=void 0;var a=n(e.r(271645)),l=n(e.r(844343)),i=["text","onCopy","options","children"];function n(e){return e&&e.__esModule?e:{default:e}}function o(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,s)}return r}function c(e){for(var t=1;t=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(s=0;s=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}(e,i),s=a.default.Children.only(t);return a.default.cloneElement(s,c(c({},r),{},{onClick:this.onClick}))}}],function(e,t){for(var r=0;r{"use strict";var s=e.r(743151).CopyToClipboard;s.CopyToClipboard=s,t.exports=s},645526,e=>{"use strict";e.i(247167);var t=e.i(931067),r=e.i(271645);let s={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M824.2 699.9a301.55 301.55 0 00-86.4-60.4C783.1 602.8 812 546.8 812 484c0-110.8-92.4-201.7-203.2-200-109.1 1.7-197 90.6-197 200 0 62.8 29 118.8 74.2 155.5a300.95 300.95 0 00-86.4 60.4C345 754.6 314 826.8 312 903.8a8 8 0 008 8.2h56c4.3 0 7.9-3.4 8-7.7 1.9-58 25.4-112.3 66.7-153.5A226.62 226.62 0 01612 684c60.9 0 118.2 23.7 161.3 66.8C814.5 792 838 846.3 840 904.3c.1 4.3 3.7 7.7 8 7.7h56a8 8 0 008-8.2c-2-77-33-149.2-87.8-203.9zM612 612c-34.2 0-66.4-13.3-90.5-37.5a126.86 126.86 0 01-37.5-91.8c.3-32.8 13.4-64.5 36.3-88 24-24.6 56.1-38.3 90.4-38.7 33.9-.3 66.8 12.9 91 36.6 24.8 24.3 38.4 56.8 38.4 91.4 0 34.2-13.3 66.3-37.5 90.5A127.3 127.3 0 01612 612zM361.5 510.4c-.9-8.7-1.4-17.5-1.4-26.4 0-15.9 1.5-31.4 4.3-46.5.7-3.6-1.2-7.3-4.5-8.8-13.6-6.1-26.1-14.5-36.9-25.1a127.54 127.54 0 01-38.7-95.4c.9-32.1 13.8-62.6 36.3-85.6 24.7-25.3 57.9-39.1 93.2-38.7 31.9.3 62.7 12.6 86 34.4 7.9 7.4 14.7 15.6 20.4 24.4 2 3.1 5.9 4.4 9.3 3.2 17.6-6.1 36.2-10.4 55.3-12.4 5.6-.6 8.8-6.6 6.3-11.6-32.5-64.3-98.9-108.7-175.7-109.9-110.9-1.7-203.3 89.2-203.3 199.9 0 62.8 28.9 118.8 74.2 155.5-31.8 14.7-61.1 35-86.5 60.4-54.8 54.7-85.8 126.9-87.8 204a8 8 0 008 8.2h56.1c4.3 0 7.9-3.4 8-7.7 1.9-58 25.4-112.3 66.7-153.5 29.4-29.4 65.4-49.8 104.7-59.7 3.9-1 6.5-4.7 6-8.7z"}}]},name:"team",theme:"outlined"};var a=e.i(9583),l=r.forwardRef(function(e,l){return r.createElement(a.default,(0,t.default)({},e,{ref:l,icon:s}))});e.s(["TeamOutlined",0,l],645526)},983561,e=>{"use strict";e.i(247167);var t=e.i(931067),r=e.i(271645);let s={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M300 328a60 60 0 10120 0 60 60 0 10-120 0zM852 64H172c-17.7 0-32 14.3-32 32v660c0 17.7 14.3 32 32 32h680c17.7 0 32-14.3 32-32V96c0-17.7-14.3-32-32-32zm-32 660H204V128h616v596zM604 328a60 60 0 10120 0 60 60 0 10-120 0zm250.2 556H169.8c-16.5 0-29.8 14.3-29.8 32v36c0 4.4 3.3 8 7.4 8h729.1c4.1 0 7.4-3.6 7.4-8v-36c.1-17.7-13.2-32-29.7-32zM664 508H360c-4.4 0-8 3.6-8 8v60c0 4.4 3.6 8 8 8h304c4.4 0 8-3.6 8-8v-60c0-4.4-3.6-8-8-8z"}}]},name:"robot",theme:"outlined"};var a=e.i(9583),l=r.forwardRef(function(e,l){return r.createElement(a.default,(0,t.default)({},e,{ref:l,icon:s}))});e.s(["RobotOutlined",0,l],983561)},631171,e=>{"use strict";let t=(0,e.i(475254).default)("chevron-down",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);e.s(["default",()=>t])},621482,e=>{"use strict";var t=e.i(869230),r=e.i(992571),s=class extends t.QueryObserver{constructor(e,t){super(e,t)}bindMethods(){super.bindMethods(),this.fetchNextPage=this.fetchNextPage.bind(this),this.fetchPreviousPage=this.fetchPreviousPage.bind(this)}setOptions(e){super.setOptions({...e,behavior:(0,r.infiniteQueryBehavior)()})}getOptimisticResult(e){return e.behavior=(0,r.infiniteQueryBehavior)(),super.getOptimisticResult(e)}fetchNextPage(e){return this.fetch({...e,meta:{fetchMore:{direction:"forward"}}})}fetchPreviousPage(e){return this.fetch({...e,meta:{fetchMore:{direction:"backward"}}})}createResult(e,t){let{state:s}=e,a=super.createResult(e,t),{isFetching:l,isRefetching:i,isError:n,isRefetchError:o}=a,c=s.fetchMeta?.fetchMore?.direction,d=n&&"forward"===c,u=l&&"forward"===c,m=n&&"backward"===c,p=l&&"backward"===c;return{...a,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:(0,r.hasNextPage)(t,s.data),hasPreviousPage:(0,r.hasPreviousPage)(t,s.data),isFetchNextPageError:d,isFetchingNextPage:u,isFetchPreviousPageError:m,isFetchingPreviousPage:p,isRefetchError:o&&!d&&!m,isRefetching:i&&!u&&!p}}},a=e.i(469637);function l(e,t){return(0,a.useBaseQuery)(e,s,t)}e.s(["useInfiniteQuery",()=>l],621482)},270345,e=>{"use strict";var t=e.i(764205);let r=async(e,r,s,a)=>"Admin"!=s&&"Admin Viewer"!=s?await (0,t.teamListCall)(e,a?.organization_id||null,r):await (0,t.teamListCall)(e,a?.organization_id||null);e.s(["fetchTeams",0,r])},785242,e=>{"use strict";var t=e.i(619273),r=e.i(621482),s=e.i(266027),a=e.i(912598),l=e.i(135214),i=e.i(270345),n=e.i(243652),o=e.i(764205);let c=async(e,t,r,s={})=>{try{let a=(0,o.getProxyBaseUrl)(),l=new URLSearchParams(Object.entries({team_id:s.teamID,organization_id:s.organizationID,team_alias:s.team_alias,user_id:s.userID,page:t,page_size:r,sort_by:s.sortBy,sort_order:s.sortOrder,status:s.status}).filter(([,e])=>null!=e).map(([e,t])=>[e,String(t)])),i=`${a?`${a}/v2/team/list`:"/v2/team/list"}?${l}`,n=await fetch(i,{method:"GET",headers:{[(0,o.getGlobalLitellmHeaderName)()]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!n.ok){let e=await n.json(),t=(0,o.deriveErrorMessage)(e);throw(0,o.handleError)(t),Error(t)}let c=await n.json();return console.log("/v2/team/list API Response:",c),c}catch(e){throw console.error("Failed to list teams:",e),e}},d=(0,n.createQueryKeys)("teams"),u=(0,n.createQueryKeys)("infiniteTeams"),m=async(e,t,r,s={})=>{try{let a=(0,o.getProxyBaseUrl)(),l=new URLSearchParams(Object.entries({team_id:s.teamID,organization_id:s.organizationID,team_alias:s.team_alias,user_id:s.userID,page:t,page_size:r,sort_by:s.sortBy,sort_order:s.sortOrder,status:"deleted"}).filter(([,e])=>null!=e).map(([e,t])=>[e,String(t)])),i=`${a?`${a}/v2/team/list`:"/v2/team/list"}?${l}`,n=await fetch(i,{method:"GET",headers:{[(0,o.getGlobalLitellmHeaderName)()]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!n.ok){let e=await n.json(),t=(0,o.deriveErrorMessage)(e);throw(0,o.handleError)(t),Error(t)}let c=await n.json();if(console.log("/team/list?status=deleted API Response:",c),c&&"object"==typeof c&&"teams"in c)return c.teams;return c}catch(e){throw console.error("Failed to list deleted teams:",e),e}},p=(0,n.createQueryKeys)("deletedTeams");e.s(["teamListCall",0,c,"useDeletedTeams",0,(e,r,a={})=>{let{accessToken:i}=(0,l.default)();return(0,s.useQuery)({queryKey:p.list({page:e,limit:r,...a}),queryFn:async()=>await m(i,e,r,a),enabled:!!i,staleTime:3e4,placeholderData:t.keepPreviousData})},"useInfiniteTeams",0,(e=50,t,s)=>{let{accessToken:a,userId:i,userRole:n}=(0,l.default)(),o="Admin"===n||"Admin Viewer"===n;return(0,r.useInfiniteQuery)({queryKey:u.list({filters:{pageSize:e,...t&&{search:t},...s&&{organizationId:s},...i&&{userId:i}}}),queryFn:async({pageParam:r})=>await c(a,r,e,{team_alias:t||void 0,organizationID:s,userID:o?void 0:i}),initialPageParam:1,getNextPageParam:e=>{if(e.page{let{accessToken:t}=(0,l.default)(),r=(0,a.useQueryClient)();return(0,s.useQuery)({queryKey:d.detail(e),enabled:!!(t&&e),queryFn:async()=>{if(!t||!e)throw Error("Missing auth or teamId");return(0,o.teamInfoCall)(t,e)},initialData:()=>{if(!e)return;let t=r.getQueryData(d.list({}));return t?.find(t=>t.team_id===e)}})},"useTeams",0,()=>{let{accessToken:e,userId:t,userRole:r}=(0,l.default)();return(0,s.useQuery)({queryKey:d.list({}),queryFn:async()=>await (0,i.fetchTeams)(e,t,r,null),enabled:!!e})}])},109799,e=>{"use strict";var t=e.i(135214),r=e.i(764205),s=e.i(266027),a=e.i(912598);let l=(0,e.i(243652).createQueryKeys)("organizations");e.s(["useOrganization",0,e=>{let i=(0,a.useQueryClient)(),{accessToken:n}=(0,t.default)();return(0,s.useQuery)({queryKey:l.detail(e),enabled:!!(n&&e),queryFn:async()=>{if(!n||!e)throw Error("Missing auth or teamId");return(0,r.organizationInfoCall)(n,e)},initialData:()=>{if(!e)return;let t=i.getQueryData(l.list({}));return t?.find(t=>t.organization_id===e)}})},"useOrganizations",0,()=>{let{accessToken:e,userId:a,userRole:i}=(0,t.default)();return(0,s.useQuery)({queryKey:l.list({}),queryFn:async()=>await (0,r.organizationListCall)(e),enabled:!!(e&&a&&i)})}])},793130,e=>{"use strict";var t=e.i(290571),r=e.i(429427),s=e.i(371330),a=e.i(271645),l=e.i(394487),i=e.i(503269),n=e.i(214520),o=e.i(746725),c=e.i(914189),d=e.i(144279),u=e.i(294316),m=e.i(601893),p=e.i(140721),h=e.i(942803),g=e.i(233538),f=e.i(694421),x=e.i(700020),y=e.i(35889),b=e.i(998348),v=e.i(722678);let _=(0,a.createContext)(null);_.displayName="GroupContext";let j=a.Fragment,w=Object.assign((0,x.forwardRefWithAs)(function(e,t){var j;let w=(0,a.useId)(),k=(0,h.useProvidedId)(),N=(0,m.useDisabled)(),{id:C=k||`headlessui-switch-${w}`,disabled:S=N||!1,checked:T,defaultChecked:E,onChange:O,name:I,value:M,form:P,autoFocus:A=!1,...L}=e,R=(0,a.useContext)(_),[F,D]=(0,a.useState)(null),B=(0,a.useRef)(null),$=(0,u.useSyncRefs)(B,t,null===R?null:R.setSwitch,D),z=(0,n.useDefaultValue)(E),[K,U]=(0,i.useControllable)(T,O,null!=z&&z),q=(0,o.useDisposables)(),[V,G]=(0,a.useState)(!1),H=(0,c.useEvent)(()=>{G(!0),null==U||U(!K),q.nextFrame(()=>{G(!1)})}),W=(0,c.useEvent)(e=>{if((0,g.isDisabledReactIssue7711)(e.currentTarget))return e.preventDefault();e.preventDefault(),H()}),Q=(0,c.useEvent)(e=>{e.key===b.Keys.Space?(e.preventDefault(),H()):e.key===b.Keys.Enter&&(0,f.attemptSubmit)(e.currentTarget)}),J=(0,c.useEvent)(e=>e.preventDefault()),Y=(0,v.useLabelledBy)(),X=(0,y.useDescribedBy)(),{isFocusVisible:Z,focusProps:ee}=(0,r.useFocusRing)({autoFocus:A}),{isHovered:et,hoverProps:er}=(0,s.useHover)({isDisabled:S}),{pressed:es,pressProps:ea}=(0,l.useActivePress)({disabled:S}),el=(0,a.useMemo)(()=>({checked:K,disabled:S,hover:et,focus:Z,active:es,autofocus:A,changing:V}),[K,et,Z,es,S,V,A]),ei=(0,x.mergeProps)({id:C,ref:$,role:"switch",type:(0,d.useResolveButtonType)(e,F),tabIndex:-1===e.tabIndex?0:null!=(j=e.tabIndex)?j:0,"aria-checked":K,"aria-labelledby":Y,"aria-describedby":X,disabled:S||void 0,autoFocus:A,onClick:W,onKeyUp:Q,onKeyPress:J},ee,er,ea),en=(0,a.useCallback)(()=>{if(void 0!==z)return null==U?void 0:U(z)},[U,z]),eo=(0,x.useRender)();return a.default.createElement(a.default.Fragment,null,null!=I&&a.default.createElement(p.FormFields,{disabled:S,data:{[I]:M||"on"},overrides:{type:"checkbox",checked:K},form:P,onReset:en}),eo({ourProps:ei,theirProps:L,slot:el,defaultTag:"button",name:"Switch"}))}),{Group:function(e){var t;let[r,s]=(0,a.useState)(null),[l,i]=(0,v.useLabels)(),[n,o]=(0,y.useDescriptions)(),c=(0,a.useMemo)(()=>({switch:r,setSwitch:s}),[r,s]),d=(0,x.useRender)();return a.default.createElement(o,{name:"Switch.Description",value:n},a.default.createElement(i,{name:"Switch.Label",value:l,props:{htmlFor:null==(t=c.switch)?void 0:t.id,onClick(e){r&&(e.currentTarget instanceof HTMLLabelElement&&e.preventDefault(),r.click(),r.focus({preventScroll:!0}))}}},a.default.createElement(_.Provider,{value:c},d({ourProps:{},theirProps:e,slot:{},defaultTag:j,name:"Switch.Group"}))))},Label:v.Label,Description:y.Description});var k=e.i(888288),N=e.i(95779),C=e.i(444755),S=e.i(673706),T=e.i(829087);let E=(0,S.makeClassName)("Switch"),O=a.default.forwardRef((e,r)=>{let{checked:s,defaultChecked:l=!1,onChange:i,color:n,name:o,error:c,errorMessage:d,disabled:u,required:m,tooltip:p,id:h}=e,g=(0,t.__rest)(e,["checked","defaultChecked","onChange","color","name","error","errorMessage","disabled","required","tooltip","id"]),f={bgColor:n?(0,S.getColorClassNames)(n,N.colorPalette.background).bgColor:"bg-tremor-brand dark:bg-dark-tremor-brand",ringColor:n?(0,S.getColorClassNames)(n,N.colorPalette.ring).ringColor:"ring-tremor-brand-muted dark:ring-dark-tremor-brand-muted"},[x,y]=(0,k.default)(l,s),[b,v]=(0,a.useState)(!1),{tooltipProps:_,getReferenceProps:j}=(0,T.useTooltip)(300);return a.default.createElement("div",{className:"flex flex-row items-center justify-start"},a.default.createElement(T.default,Object.assign({text:p},_)),a.default.createElement("div",Object.assign({ref:(0,S.mergeRefs)([r,_.refs.setReference]),className:(0,C.tremorTwMerge)(E("root"),"flex flex-row relative h-5")},g,j),a.default.createElement("input",{type:"checkbox",className:(0,C.tremorTwMerge)(E("input"),"absolute w-5 h-5 cursor-pointer left-0 top-0 opacity-0"),name:o,required:m,checked:x,onChange:e=>{e.preventDefault()}}),a.default.createElement(w,{checked:x,onChange:e=>{y(e),null==i||i(e)},disabled:u,className:(0,C.tremorTwMerge)(E("switch"),"w-10 h-5 group relative inline-flex shrink-0 cursor-pointer items-center justify-center rounded-tremor-full","focus:outline-none",u?"cursor-not-allowed":""),onFocus:()=>v(!0),onBlur:()=>v(!1),id:h},a.default.createElement("span",{className:(0,C.tremorTwMerge)(E("sr-only"),"sr-only")},"Switch ",x?"on":"off"),a.default.createElement("span",{"aria-hidden":"true",className:(0,C.tremorTwMerge)(E("background"),x?f.bgColor:"bg-tremor-border dark:bg-dark-tremor-border","pointer-events-none absolute mx-auto h-3 w-9 rounded-tremor-full transition-colors duration-100 ease-in-out")}),a.default.createElement("span",{"aria-hidden":"true",className:(0,C.tremorTwMerge)(E("round"),x?(0,C.tremorTwMerge)(f.bgColor,"translate-x-5 border-tremor-background dark:border-dark-tremor-background"):"translate-x-0 bg-tremor-border dark:bg-dark-tremor-border border-tremor-background dark:border-dark-tremor-background","pointer-events-none absolute left-0 inline-block h-5 w-5 transform rounded-tremor-full border-2 shadow-tremor-input duration-100 ease-in-out transition",b?(0,C.tremorTwMerge)("ring-2",f.ringColor):"")}))),c&&d?a.default.createElement("p",{className:(0,C.tremorTwMerge)(E("errorMessage"),"text-sm text-red-500 mt-1 ")},d):null)});O.displayName="Switch",e.s(["Switch",()=>O],793130)},107233,37727,e=>{"use strict";var t=e.i(603908);e.s(["Plus",()=>t.default],107233);var r=e.i(841947);e.s(["X",()=>r.default],37727)},361653,e=>{"use strict";let t=(0,e.i(475254).default)("circle-alert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]]);e.s(["default",()=>t])},841947,e=>{"use strict";let t=(0,e.i(475254).default)("x",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);e.s(["default",()=>t])},603908,e=>{"use strict";let t=(0,e.i(475254).default)("plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);e.s(["default",()=>t])},158392,419470,e=>{"use strict";var t=e.i(843476),r=e.i(779241);let s={ttl:3600,lowest_latency_buffer:0},a=({routingStrategyArgs:e})=>{let a={ttl:"Sliding window to look back over when calculating the average latency of a deployment. Default - 1 hour (in seconds).",lowest_latency_buffer:"Shuffle between deployments within this % of the lowest latency. Default - 0 (i.e. always pick lowest latency)."};return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:"space-y-6",children:[(0,t.jsxs)("div",{className:"max-w-3xl",children:[(0,t.jsx)("h3",{className:"text-sm font-medium text-gray-900",children:"Latency-Based Configuration"}),(0,t.jsx)("p",{className:"text-xs text-gray-500 mt-1",children:"Fine-tune latency-based routing behavior"})]}),(0,t.jsx)("div",{className:"grid grid-cols-1 gap-6 lg:grid-cols-2 xl:grid-cols-3",children:Object.entries(e||s).map(([e,s])=>(0,t.jsx)("div",{className:"space-y-2",children:(0,t.jsxs)("label",{className:"block",children:[(0,t.jsx)("span",{className:"text-xs font-medium text-gray-700 uppercase tracking-wide",children:e.replace(/_/g," ")}),(0,t.jsx)("p",{className:"text-xs text-gray-500 mt-0.5 mb-2",children:a[e]||""}),(0,t.jsx)(r.TextInput,{name:e,defaultValue:"object"==typeof s?JSON.stringify(s,null,2):s?.toString(),className:"font-mono text-sm w-full"})]})},e))})]}),(0,t.jsx)("div",{className:"border-t border-gray-200"})]})},l=({routerSettings:e,routerFieldsMetadata:s})=>(0,t.jsxs)("div",{className:"space-y-6",children:[(0,t.jsxs)("div",{className:"max-w-3xl",children:[(0,t.jsx)("h3",{className:"text-sm font-medium text-gray-900",children:"Reliability & Retries"}),(0,t.jsx)("p",{className:"text-xs text-gray-500 mt-1",children:"Configure retry logic and failure handling"})]}),(0,t.jsx)("div",{className:"grid grid-cols-1 gap-6 lg:grid-cols-2 xl:grid-cols-3",children:Object.entries(e).filter(([e,t])=>"fallbacks"!=e&&"context_window_fallbacks"!=e&&"routing_strategy_args"!=e&&"routing_strategy"!=e&&"enable_tag_filtering"!=e).map(([e,a])=>(0,t.jsx)("div",{className:"space-y-2",children:(0,t.jsxs)("label",{className:"block",children:[(0,t.jsx)("span",{className:"text-xs font-medium text-gray-700 uppercase tracking-wide",children:s[e]?.ui_field_name||e}),(0,t.jsx)("p",{className:"text-xs text-gray-500 mt-0.5 mb-2",children:s[e]?.field_description||""}),(0,t.jsx)(r.TextInput,{name:e,defaultValue:null==a||"null"===a?"":"object"==typeof a?JSON.stringify(a,null,2):a?.toString()||"",placeholder:"—",className:"font-mono text-sm w-full"})]})},e))})]});var i=e.i(199133);let n=({selectedStrategy:e,availableStrategies:r,routingStrategyDescriptions:s,routerFieldsMetadata:a,onStrategyChange:l})=>(0,t.jsxs)("div",{className:"space-y-2 max-w-3xl",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"text-xs font-medium text-gray-700 uppercase tracking-wide",children:a.routing_strategy?.ui_field_name||"Routing Strategy"}),(0,t.jsx)("p",{className:"text-xs text-gray-500 mt-0.5 mb-2",children:a.routing_strategy?.field_description||""})]}),(0,t.jsx)("div",{className:"routing-strategy-select max-w-3xl",children:(0,t.jsx)(i.Select,{value:e,onChange:l,style:{width:"100%"},size:"large",children:r.map(e=>(0,t.jsx)(i.Select.Option,{value:e,label:e,children:(0,t.jsxs)("div",{className:"flex flex-col gap-0.5 py-1",children:[(0,t.jsx)("span",{className:"font-mono text-sm font-medium",children:e}),s[e]&&(0,t.jsx)("span",{className:"text-xs text-gray-500 font-normal",children:s[e]})]})},e))})})]});var o=e.i(793130);let c=({enabled:e,routerFieldsMetadata:r,onToggle:s})=>(0,t.jsx)("div",{className:"space-y-3 max-w-3xl",children:(0,t.jsxs)("div",{className:"flex items-start justify-between",children:[(0,t.jsxs)("div",{className:"flex-1",children:[(0,t.jsx)("label",{className:"text-xs font-medium text-gray-700 uppercase tracking-wide",children:r.enable_tag_filtering?.ui_field_name||"Enable Tag Filtering"}),(0,t.jsxs)("p",{className:"text-xs text-gray-500 mt-0.5",children:[r.enable_tag_filtering?.field_description||"",r.enable_tag_filtering?.link&&(0,t.jsxs)(t.Fragment,{children:[" ",(0,t.jsx)("a",{href:r.enable_tag_filtering.link,target:"_blank",rel:"noopener noreferrer",className:"text-blue-600 hover:text-blue-800 underline",children:"Learn more"})]})]})]}),(0,t.jsx)(o.Switch,{checked:e,onChange:s,className:"ml-4"})]})});e.s(["default",0,({value:e,onChange:r,routerFieldsMetadata:s,availableRoutingStrategies:i,routingStrategyDescriptions:o})=>(0,t.jsxs)("div",{className:"w-full space-y-8 py-2",children:[(0,t.jsxs)("div",{className:"space-y-6",children:[(0,t.jsxs)("div",{className:"max-w-3xl",children:[(0,t.jsx)("h3",{className:"text-sm font-medium text-gray-900",children:"Routing Settings"}),(0,t.jsx)("p",{className:"text-xs text-gray-500 mt-1",children:"Configure how requests are routed to deployments"})]}),i.length>0&&(0,t.jsx)(n,{selectedStrategy:e.selectedStrategy||e.routerSettings.routing_strategy||null,availableStrategies:i,routingStrategyDescriptions:o,routerFieldsMetadata:s,onStrategyChange:t=>{r({...e,selectedStrategy:t})}}),(0,t.jsx)(c,{enabled:e.enableTagFiltering,routerFieldsMetadata:s,onToggle:t=>{r({...e,enableTagFiltering:t})}})]}),(0,t.jsx)("div",{className:"border-t border-gray-200"}),"latency-based-routing"===e.selectedStrategy&&(0,t.jsx)(a,{routingStrategyArgs:e.routerSettings.routing_strategy_args}),(0,t.jsx)(l,{routerSettings:e.routerSettings,routerFieldsMetadata:s})]})],158392);var d=e.i(994388),u=e.i(653496),m=e.i(107233),p=e.i(271645),h=e.i(888259),g=e.i(592968),f=e.i(361653),f=f;let x=(0,e.i(475254).default)("arrow-down",[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]]);var y=e.i(37727);function b({group:e,onChange:r,availableModels:s,maxFallbacks:a}){let l=s.filter(t=>t!==e.primaryModel),n=e.fallbackModels.length{let s=[...e.fallbackModels];s.includes(t)&&(s=s.filter(e=>e!==t)),r({...e,primaryModel:t,fallbackModels:s})},showSearch:!0,getPopupContainer:e=>e.parentElement||document.body,filterOption:(e,t)=>(t?.label??"").toLowerCase().includes(e.toLowerCase()),options:s.map(e=>({label:e,value:e}))}),!e.primaryModel&&(0,t.jsxs)("div",{className:"mt-2 flex items-center gap-2 text-amber-600 text-xs bg-amber-50 p-2 rounded",children:[(0,t.jsx)(f.default,{className:"w-4 h-4"}),(0,t.jsx)("span",{children:"Select a model to begin configuring fallbacks"})]})]}),(0,t.jsx)("div",{className:"flex items-center justify-center -my-4 z-10",children:(0,t.jsxs)("div",{className:"bg-indigo-50 text-indigo-500 px-4 py-1 rounded-full text-xs font-bold border border-indigo-100 flex items-center gap-2 shadow-sm",children:[(0,t.jsx)(x,{className:"w-4 h-4"}),"IF FAILS, TRY..."]})}),(0,t.jsxs)("div",{className:`transition-opacity duration-300 ${!e.primaryModel?"opacity-50 pointer-events-none":"opacity-100"}`,children:[(0,t.jsxs)("label",{className:"block text-sm font-semibold text-gray-700 mb-2",children:["Fallback Chain ",(0,t.jsx)("span",{className:"text-red-500",children:"*"}),(0,t.jsxs)("span",{className:"text-xs text-gray-500 font-normal ml-2",children:["(Max ",a," fallbacks at a time)"]})]}),(0,t.jsxs)("div",{className:"bg-gray-50 rounded-xl p-4 border border-gray-200",children:[(0,t.jsxs)("div",{className:"mb-4",children:[(0,t.jsx)(i.Select,{mode:"multiple",className:"w-full",size:"large",placeholder:n?"Select fallback models to add...":`Maximum ${a} fallbacks reached`,value:e.fallbackModels,onChange:t=>{let s=t.slice(0,a);r({...e,fallbackModels:s})},disabled:!e.primaryModel,getPopupContainer:e=>e.parentElement||document.body,options:l.map(e=>({label:e,value:e})),optionRender:(r,s)=>{let a=e.fallbackModels.includes(r.value),l=a?e.fallbackModels.indexOf(r.value)+1:null;return(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[a&&null!==l&&(0,t.jsx)("span",{className:"flex items-center justify-center w-5 h-5 rounded bg-indigo-100 text-indigo-600 text-xs font-bold",children:l}),(0,t.jsx)("span",{children:r.label})]})},maxTagCount:"responsive",maxTagPlaceholder:e=>(0,t.jsx)(g.Tooltip,{styles:{root:{pointerEvents:"none"}},title:e.map(({value:e})=>e).join(", "),children:(0,t.jsxs)("span",{children:["+",e.length," more"]})}),showSearch:!0,filterOption:(e,t)=>(t?.label??"").toLowerCase().includes(e.toLowerCase())}),(0,t.jsx)("p",{className:"text-xs text-gray-500 mt-1 ml-1",children:n?`Search and select multiple models. Selected models will appear below in order. (${e.fallbackModels.length}/${a} used)`:`Maximum ${a} fallbacks reached. Remove some to add more.`})]}),(0,t.jsx)("div",{className:"space-y-2 min-h-[100px]",children:0===e.fallbackModels.length?(0,t.jsxs)("div",{className:"h-32 border-2 border-dashed border-gray-300 rounded-lg flex flex-col items-center justify-center text-gray-400",children:[(0,t.jsx)("span",{className:"text-sm",children:"No fallback models selected"}),(0,t.jsx)("span",{className:"text-xs mt-1",children:"Add models from the dropdown above"})]}):e.fallbackModels.map((s,a)=>(0,t.jsxs)("div",{className:"group flex items-center justify-between p-3 bg-white rounded-lg border border-gray-200 hover:border-indigo-300 hover:shadow-sm transition-all",children:[(0,t.jsxs)("div",{className:"flex items-center gap-3",children:[(0,t.jsx)("div",{className:"flex items-center justify-center w-6 h-6 rounded bg-gray-100 text-gray-400 group-hover:text-indigo-500 group-hover:bg-indigo-50",children:(0,t.jsx)("span",{className:"text-xs font-bold",children:a+1})}),(0,t.jsx)("div",{children:(0,t.jsx)("span",{className:"font-medium text-gray-800",children:s})})]}),(0,t.jsx)("button",{type:"button",onClick:()=>{let t;return t=e.fallbackModels.filter((e,t)=>t!==a),void r({...e,fallbackModels:t})},className:"opacity-0 group-hover:opacity-100 transition-opacity text-gray-400 hover:text-red-500 p-1",children:(0,t.jsx)(y.X,{className:"w-4 h-4"})})]},`${s}-${a}`))})]})]})]})}function v({groups:e,onGroupsChange:r,availableModels:s,maxFallbacks:a=10,maxGroups:l=5}){let[i,n]=(0,p.useState)(e.length>0?e[0].id:"1");(0,p.useEffect)(()=>{e.length>0?e.some(e=>e.id===i)||n(e[0].id):n("1")},[e]);let o=()=>{if(e.length>=l)return;let t=Date.now().toString();r([...e,{id:t,primaryModel:null,fallbackModels:[]}]),n(t)},c=t=>{r(e.map(e=>e.id===t.id?t:e))},g=e.map((r,l)=>{let i=r.primaryModel?r.primaryModel:`Group ${l+1}`;return{key:r.id,label:i,closable:e.length>1,children:(0,t.jsx)(b,{group:r,onChange:c,availableModels:s,maxFallbacks:a})}});return 0===e.length?(0,t.jsxs)("div",{className:"text-center py-12 bg-gray-50 rounded-lg border border-dashed border-gray-300",children:[(0,t.jsx)("p",{className:"text-gray-500 mb-4",children:"No fallback groups configured"}),(0,t.jsx)(d.Button,{variant:"primary",onClick:o,icon:()=>(0,t.jsx)(m.Plus,{className:"w-4 h-4"}),children:"Create First Group"})]}):(0,t.jsx)(u.Tabs,{type:"editable-card",activeKey:i,onChange:n,onEdit:(t,s)=>{"add"===s?o():"remove"===s&&e.length>1&&(t=>{if(1===e.length)return h.default.warning("At least one group is required");let s=e.filter(e=>e.id!==t);r(s),i===t&&s.length>0&&n(s[s.length-1].id)})(t)},items:g,className:"fallback-tabs",tabBarStyle:{marginBottom:0},hideAdd:e.length>=l})}e.s(["FallbackSelectionForm",()=>v],419470)},309426,e=>{"use strict";var t=e.i(290571),r=e.i(444755),s=e.i(673706),a=e.i(271645),l=e.i(46757);let i=(0,s.makeClassName)("Col"),n=a.default.forwardRef((e,s)=>{let n,o,c,d,{numColSpan:u=1,numColSpanSm:m,numColSpanMd:p,numColSpanLg:h,children:g,className:f}=e,x=(0,t.__rest)(e,["numColSpan","numColSpanSm","numColSpanMd","numColSpanLg","children","className"]),y=(e,t)=>e&&Object.keys(t).includes(String(e))?t[e]:"";return a.default.createElement("div",Object.assign({ref:s,className:(0,r.tremorTwMerge)(i("root"),(n=y(u,l.colSpan),o=y(m,l.colSpanSm),c=y(p,l.colSpanMd),d=y(h,l.colSpanLg),(0,r.tremorTwMerge)(n,o,c,d)),f)},x),g)});n.displayName="Col",e.s(["Col",()=>n],309426)},950724,(e,t,r)=>{t.exports=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}},100236,(e,t,r)=>{t.exports=e.g&&e.g.Object===Object&&e.g},139088,(e,t,r)=>{var s=e.r(100236),a="object"==typeof self&&self&&self.Object===Object&&self;t.exports=s||a||Function("return this")()},631926,(e,t,r)=>{var s=e.r(139088);t.exports=function(){return s.Date.now()}},748891,(e,t,r)=>{var s=/\s/;t.exports=function(e){for(var t=e.length;t--&&s.test(e.charAt(t)););return t}},830364,(e,t,r)=>{var s=e.r(748891),a=/^\s+/;t.exports=function(e){return e?e.slice(0,s(e)+1).replace(a,""):e}},630353,(e,t,r)=>{t.exports=e.r(139088).Symbol},243436,(e,t,r)=>{var s=e.r(630353),a=Object.prototype,l=a.hasOwnProperty,i=a.toString,n=s?s.toStringTag:void 0;t.exports=function(e){var t=l.call(e,n),r=e[n];try{e[n]=void 0;var s=!0}catch(e){}var a=i.call(e);return s&&(t?e[n]=r:delete e[n]),a}},223243,(e,t,r)=>{var s=Object.prototype.toString;t.exports=function(e){return s.call(e)}},377684,(e,t,r)=>{var s=e.r(630353),a=e.r(243436),l=e.r(223243),i=s?s.toStringTag:void 0;t.exports=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":i&&i in Object(e)?a(e):l(e)}},877289,(e,t,r)=>{t.exports=function(e){return null!=e&&"object"==typeof e}},361884,(e,t,r)=>{var s=e.r(377684),a=e.r(877289);t.exports=function(e){return"symbol"==typeof e||a(e)&&"[object Symbol]"==s(e)}},773759,(e,t,r)=>{var s=e.r(830364),a=e.r(950724),l=e.r(361884),i=0/0,n=/^[-+]0x[0-9a-f]+$/i,o=/^0b[01]+$/i,c=/^0o[0-7]+$/i,d=parseInt;t.exports=function(e){if("number"==typeof e)return e;if(l(e))return i;if(a(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=a(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=s(e);var r=o.test(e);return r||c.test(e)?d(e.slice(2),r?2:8):n.test(e)?i:+e}},374009,(e,t,r)=>{var s=e.r(950724),a=e.r(631926),l=e.r(773759),i=Math.max,n=Math.min;t.exports=function(e,t,r){var o,c,d,u,m,p,h=0,g=!1,f=!1,x=!0;if("function"!=typeof e)throw TypeError("Expected a function");function y(t){var r=o,s=c;return o=c=void 0,h=t,u=e.apply(s,r)}function b(e){var r=e-p,s=e-h;return void 0===p||r>=t||r<0||f&&s>=d}function v(){var e,r,s,l=a();if(b(l))return _(l);m=setTimeout(v,(e=l-p,r=l-h,s=t-e,f?n(s,d-r):s))}function _(e){return(m=void 0,x&&o)?y(e):(o=c=void 0,u)}function j(){var e,r=a(),s=b(r);if(o=arguments,c=this,p=r,s){if(void 0===m)return h=e=p,m=setTimeout(v,t),g?y(e):u;if(f)return clearTimeout(m),m=setTimeout(v,t),y(p)}return void 0===m&&(m=setTimeout(v,t)),u}return t=l(t)||0,s(r)&&(g=!!r.leading,d=(f="maxWait"in r)?i(l(r.maxWait)||0,t):d,x="trailing"in r?!!r.trailing:x),j.cancel=function(){void 0!==m&&clearTimeout(m),h=0,o=p=c=m=void 0},j.flush=function(){return void 0===m?u:_(a())},j}},964306,e=>{"use strict";var t=e.i(271645);let r=t.forwardRef(function(e,r){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:r},e),t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M10 14l2-2m0 0l2-2m-2 2l-2-2m2 2l2 2m7-2a9 9 0 11-18 0 9 9 0 0118 0z"}))});e.s(["XCircleIcon",0,r],964306)},435451,620250,e=>{"use strict";var t=e.i(843476),r=e.i(290571),s=e.i(271645);let a=e=>{var t=(0,r.__rest)(e,[]);return s.default.createElement("svg",Object.assign({},t,{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:"2.5"}),s.default.createElement("path",{d:"M12 4v16m8-8H4"}))},l=e=>{var t=(0,r.__rest)(e,[]);return s.default.createElement("svg",Object.assign({},t,{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:"2.5"}),s.default.createElement("path",{d:"M20 12H4"}))};var i=e.i(444755),n=e.i(673706),o=e.i(677955);let c="flex mx-auto text-tremor-content-subtle dark:text-dark-tremor-content-subtle",d="cursor-pointer hover:text-tremor-content dark:hover:text-dark-tremor-content",u=s.default.forwardRef((e,t)=>{let{onSubmit:u,enableStepper:m=!0,disabled:p,onValueChange:h,onChange:g}=e,f=(0,r.__rest)(e,["onSubmit","enableStepper","disabled","onValueChange","onChange"]),x=(0,s.useRef)(null),[y,b]=s.default.useState(!1),v=s.default.useCallback(()=>{b(!0)},[]),_=s.default.useCallback(()=>{b(!1)},[]),[j,w]=s.default.useState(!1),k=s.default.useCallback(()=>{w(!0)},[]),N=s.default.useCallback(()=>{w(!1)},[]);return s.default.createElement(o.default,Object.assign({type:"number",ref:(0,n.mergeRefs)([x,t]),disabled:p,makeInputClassName:(0,n.makeClassName)("NumberInput"),onKeyDown:e=>{var t;if("Enter"===e.key&&!e.ctrlKey&&!e.altKey&&!e.shiftKey){let e=null==(t=x.current)?void 0:t.value;null==u||u(parseFloat(null!=e?e:""))}"ArrowDown"===e.key&&v(),"ArrowUp"===e.key&&k()},onKeyUp:e=>{"ArrowDown"===e.key&&_(),"ArrowUp"===e.key&&N()},onChange:e=>{p||(null==h||h(parseFloat(e.target.value)),null==g||g(e))},stepper:m?s.default.createElement("div",{className:(0,i.tremorTwMerge)("flex justify-center align-middle")},s.default.createElement("div",{tabIndex:-1,onClick:e=>e.preventDefault(),onMouseDown:e=>e.preventDefault(),onTouchStart:e=>{e.cancelable&&e.preventDefault()},onMouseUp:()=>{var e,t;p||(null==(e=x.current)||e.stepDown(),null==(t=x.current)||t.dispatchEvent(new Event("input",{bubbles:!0})))},className:(0,i.tremorTwMerge)(!p&&d,c,"group py-[10px] px-2.5 border-l border-tremor-border dark:border-dark-tremor-border")},s.default.createElement(l,{"data-testid":"step-down",className:(y?"scale-95":"")+" h-4 w-4 duration-75 transition group-active:scale-95"})),s.default.createElement("div",{tabIndex:-1,onClick:e=>e.preventDefault(),onMouseDown:e=>e.preventDefault(),onTouchStart:e=>{e.cancelable&&e.preventDefault()},onMouseUp:()=>{var e,t;p||(null==(e=x.current)||e.stepUp(),null==(t=x.current)||t.dispatchEvent(new Event("input",{bubbles:!0})))},className:(0,i.tremorTwMerge)(!p&&d,c,"group py-[10px] px-2.5 border-l border-tremor-border dark:border-dark-tremor-border")},s.default.createElement(a,{"data-testid":"step-up",className:(j?"scale-95":"")+" h-4 w-4 duration-75 transition group-active:scale-95"}))):null},f))});u.displayName="NumberInput",e.s(["NumberInput",()=>u],620250),e.s(["default",0,({step:e=.01,style:r={width:"100%"},placeholder:s="Enter a numerical value",min:a,max:l,onChange:i,...n})=>(0,t.jsx)(u,{onWheel:e=>e.currentTarget.blur(),step:e,style:r,placeholder:s,min:a,max:l,onChange:i,...n})],435451)},677667,674175,886148,543086,e=>{"use strict";let t,r;var s,a=e.i(290571),l=e.i(429427),i=e.i(371330),n=e.i(271645),o=e.i(394487),c=e.i(914189),d=e.i(144279),u=e.i(294316),m=e.i(83733);let p=(0,n.createContext)(()=>{});function h({value:e,children:t}){return n.default.createElement(p.Provider,{value:e},t)}e.s(["CloseProvider",()=>h],674175);var g=e.i(233137),f=e.i(233538),x=e.i(397701),y=e.i(402155),b=e.i(700020);let v=null!=(s=n.default.startTransition)?s:function(e){e()};var _=e.i(998348),j=((t=j||{})[t.Open=0]="Open",t[t.Closed=1]="Closed",t),w=((r=w||{})[r.ToggleDisclosure=0]="ToggleDisclosure",r[r.CloseDisclosure=1]="CloseDisclosure",r[r.SetButtonId=2]="SetButtonId",r[r.SetPanelId=3]="SetPanelId",r[r.SetButtonElement=4]="SetButtonElement",r[r.SetPanelElement=5]="SetPanelElement",r);let k={0:e=>({...e,disclosureState:(0,x.match)(e.disclosureState,{0:1,1:0})}),1:e=>1===e.disclosureState?e:{...e,disclosureState:1},2:(e,t)=>e.buttonId===t.buttonId?e:{...e,buttonId:t.buttonId},3:(e,t)=>e.panelId===t.panelId?e:{...e,panelId:t.panelId},4:(e,t)=>e.buttonElement===t.element?e:{...e,buttonElement:t.element},5:(e,t)=>e.panelElement===t.element?e:{...e,panelElement:t.element}},N=(0,n.createContext)(null);function C(e){let t=(0,n.useContext)(N);if(null===t){let t=Error(`<${e} /> is missing a parent component.`);throw Error.captureStackTrace&&Error.captureStackTrace(t,C),t}return t}N.displayName="DisclosureContext";let S=(0,n.createContext)(null);S.displayName="DisclosureAPIContext";let T=(0,n.createContext)(null);function E(e,t){return(0,x.match)(t.type,k,e,t)}T.displayName="DisclosurePanelContext";let O=n.Fragment,I=b.RenderFeatures.RenderStrategy|b.RenderFeatures.Static,M=Object.assign((0,b.forwardRefWithAs)(function(e,t){let{defaultOpen:r=!1,...s}=e,a=(0,n.useRef)(null),l=(0,u.useSyncRefs)(t,(0,u.optionalRef)(e=>{a.current=e},void 0===e.as||e.as===n.Fragment)),i=(0,n.useReducer)(E,{disclosureState:+!r,buttonElement:null,panelElement:null,buttonId:null,panelId:null}),[{disclosureState:o,buttonId:d},m]=i,p=(0,c.useEvent)(e=>{m({type:1});let t=(0,y.getOwnerDocument)(a);if(!t||!d)return;let r=e?e instanceof HTMLElement?e:e.current instanceof HTMLElement?e.current:t.getElementById(d):t.getElementById(d);null==r||r.focus()}),f=(0,n.useMemo)(()=>({close:p}),[p]),v=(0,n.useMemo)(()=>({open:0===o,close:p}),[o,p]),_=(0,b.useRender)();return n.default.createElement(N.Provider,{value:i},n.default.createElement(S.Provider,{value:f},n.default.createElement(h,{value:p},n.default.createElement(g.OpenClosedProvider,{value:(0,x.match)(o,{0:g.State.Open,1:g.State.Closed})},_({ourProps:{ref:l},theirProps:s,slot:v,defaultTag:O,name:"Disclosure"})))))}),{Button:(0,b.forwardRefWithAs)(function(e,t){let r=(0,n.useId)(),{id:s=`headlessui-disclosure-button-${r}`,disabled:a=!1,autoFocus:m=!1,...p}=e,[h,g]=C("Disclosure.Button"),x=(0,n.useContext)(T),y=null!==x&&x===h.panelId,v=(0,n.useRef)(null),j=(0,u.useSyncRefs)(v,t,(0,c.useEvent)(e=>{if(!y)return g({type:4,element:e})}));(0,n.useEffect)(()=>{if(!y)return g({type:2,buttonId:s}),()=>{g({type:2,buttonId:null})}},[s,g,y]);let w=(0,c.useEvent)(e=>{var t;if(y){if(1===h.disclosureState)return;switch(e.key){case _.Keys.Space:case _.Keys.Enter:e.preventDefault(),e.stopPropagation(),g({type:0}),null==(t=h.buttonElement)||t.focus()}}else switch(e.key){case _.Keys.Space:case _.Keys.Enter:e.preventDefault(),e.stopPropagation(),g({type:0})}}),k=(0,c.useEvent)(e=>{e.key===_.Keys.Space&&e.preventDefault()}),N=(0,c.useEvent)(e=>{var t;(0,f.isDisabledReactIssue7711)(e.currentTarget)||a||(y?(g({type:0}),null==(t=h.buttonElement)||t.focus()):g({type:0}))}),{isFocusVisible:S,focusProps:E}=(0,l.useFocusRing)({autoFocus:m}),{isHovered:O,hoverProps:I}=(0,i.useHover)({isDisabled:a}),{pressed:M,pressProps:P}=(0,o.useActivePress)({disabled:a}),A=(0,n.useMemo)(()=>({open:0===h.disclosureState,hover:O,active:M,disabled:a,focus:S,autofocus:m}),[h,O,M,S,a,m]),L=(0,d.useResolveButtonType)(e,h.buttonElement),R=y?(0,b.mergeProps)({ref:j,type:L,disabled:a||void 0,autoFocus:m,onKeyDown:w,onClick:N},E,I,P):(0,b.mergeProps)({ref:j,id:s,type:L,"aria-expanded":0===h.disclosureState,"aria-controls":h.panelElement?h.panelId:void 0,disabled:a||void 0,autoFocus:m,onKeyDown:w,onKeyUp:k,onClick:N},E,I,P);return(0,b.useRender)()({ourProps:R,theirProps:p,slot:A,defaultTag:"button",name:"Disclosure.Button"})}),Panel:(0,b.forwardRefWithAs)(function(e,t){let r=(0,n.useId)(),{id:s=`headlessui-disclosure-panel-${r}`,transition:a=!1,...l}=e,[i,o]=C("Disclosure.Panel"),{close:d}=function e(t){let r=(0,n.useContext)(S);if(null===r){let r=Error(`<${t} /> is missing a parent component.`);throw Error.captureStackTrace&&Error.captureStackTrace(r,e),r}return r}("Disclosure.Panel"),[p,h]=(0,n.useState)(null),f=(0,u.useSyncRefs)(t,(0,c.useEvent)(e=>{v(()=>o({type:5,element:e}))}),h);(0,n.useEffect)(()=>(o({type:3,panelId:s}),()=>{o({type:3,panelId:null})}),[s,o]);let x=(0,g.useOpenClosed)(),[y,_]=(0,m.useTransition)(a,p,null!==x?(x&g.State.Open)===g.State.Open:0===i.disclosureState),j=(0,n.useMemo)(()=>({open:0===i.disclosureState,close:d}),[i.disclosureState,d]),w={ref:f,id:s,...(0,m.transitionDataAttributes)(_)},k=(0,b.useRender)();return n.default.createElement(g.ResetOpenClosedProvider,null,n.default.createElement(T.Provider,{value:i.panelId},k({ourProps:w,theirProps:l,slot:j,defaultTag:"div",features:I,visible:y,name:"Disclosure.Panel"})))})});e.s(["Disclosure",()=>M],886148);let P=(0,n.createContext)(void 0);var A=e.i(444755);let L=(0,e.i(673706).makeClassName)("Accordion"),R=(0,n.createContext)({isOpen:!1}),F=n.default.forwardRef((e,t)=>{var r;let{defaultOpen:s=!1,children:l,className:i}=e,o=(0,a.__rest)(e,["defaultOpen","children","className"]),c=null!=(r=(0,n.useContext)(P))?r:(0,A.tremorTwMerge)("rounded-tremor-default border");return n.default.createElement(M,Object.assign({as:"div",ref:t,className:(0,A.tremorTwMerge)(L("root"),"overflow-hidden","bg-tremor-background border-tremor-border","dark:bg-dark-tremor-background dark:border-dark-tremor-border",c,i),defaultOpen:s},o),({open:e})=>n.default.createElement(R.Provider,{value:{isOpen:e}},l))});F.displayName="Accordion",e.s(["OpenContext",()=>R,"default",()=>F],543086),e.s(["Accordion",()=>F],677667)},898667,e=>{"use strict";var t=e.i(290571),r=e.i(271645),s=e.i(886148);let a=e=>{var s=(0,t.__rest)(e,[]);return r.default.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor"},s),r.default.createElement("path",{d:"M11.9999 10.8284L7.0502 15.7782L5.63599 14.364L11.9999 8L18.3639 14.364L16.9497 15.7782L11.9999 10.8284Z"}))};var l=e.i(543086),i=e.i(444755);let n=(0,e.i(673706).makeClassName)("AccordionHeader"),o=r.default.forwardRef((e,o)=>{let{children:c,className:d}=e,u=(0,t.__rest)(e,["children","className"]),{isOpen:m}=(0,r.useContext)(l.OpenContext);return r.default.createElement(s.Disclosure.Button,Object.assign({ref:o,className:(0,i.tremorTwMerge)(n("root"),"w-full flex items-center justify-between px-4 py-3","text-tremor-content-emphasis","dark:text-dark-tremor-content-emphasis",d)},u),r.default.createElement("div",{className:(0,i.tremorTwMerge)(n("children"),"flex flex-1 text-inherit mr-4")},c),r.default.createElement("div",null,r.default.createElement(a,{className:(0,i.tremorTwMerge)(n("arrowIcon"),"h-5 w-5 -mr-1","text-tremor-content-subtle","dark:text-dark-tremor-content-subtle",m?"transition-all":"transition-all -rotate-180")})))});o.displayName="AccordionHeader",e.s(["AccordionHeader",()=>o],898667)},130643,e=>{"use strict";var t=e.i(290571),r=e.i(271645),s=e.i(886148),a=e.i(444755);let l=(0,e.i(673706).makeClassName)("AccordionBody"),i=r.default.forwardRef((e,i)=>{let{children:n,className:o}=e,c=(0,t.__rest)(e,["children","className"]);return r.default.createElement(s.Disclosure.Panel,Object.assign({ref:i,className:(0,a.tremorTwMerge)(l("root"),"w-full text-tremor-default px-4 pb-3","text-tremor-content","dark:text-dark-tremor-content",o)},c),n)});i.displayName="AccordionBody",e.s(["AccordionBody",()=>i],130643)},409797,e=>{"use strict";var t=e.i(631171);e.s(["ChevronDownIcon",()=>t.default])},246349,e=>{"use strict";let t=(0,e.i(475254).default)("chevron-right",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);e.s(["default",()=>t])},91739,e=>{"use strict";var t=e.i(544195);e.s(["Radio",()=>t.default])},988297,e=>{"use strict";var t=e.i(271645);let r=t.forwardRef(function(e,r){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:r},e),t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 4v16m8-8H4"}))});e.s(["PlusIcon",0,r],988297)},797672,e=>{"use strict";var t=e.i(271645);let r=t.forwardRef(function(e,r){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:r},e),t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15.232 5.232l3.536 3.536m-2.036-5.036a2.5 2.5 0 113.536 3.536L6.5 21.036H3v-3.572L16.732 3.732z"}))});e.s(["PencilIcon",0,r],797672)},992619,e=>{"use strict";var t=e.i(843476),r=e.i(271645),s=e.i(779241),a=e.i(599724),l=e.i(199133),i=e.i(983561),n=e.i(689020);e.s(["default",0,({accessToken:e,value:o,placeholder:c="Select a Model",onChange:d,disabled:u=!1,style:m,className:p,showLabel:h=!0,labelText:g="Select Model"})=>{let[f,x]=(0,r.useState)(o),[y,b]=(0,r.useState)(!1),[v,_]=(0,r.useState)([]),j=(0,r.useRef)(null);return(0,r.useEffect)(()=>{x(o)},[o]),(0,r.useEffect)(()=>{e&&(async()=>{try{let t=await (0,n.fetchAvailableModels)(e);console.log("Fetched models for selector:",t),t.length>0&&_(t)}catch(e){console.error("Error fetching model info:",e)}})()},[e]),(0,t.jsxs)("div",{children:[h&&(0,t.jsxs)(a.Text,{className:"font-medium block mb-2 text-gray-700 flex items-center",children:[(0,t.jsx)(i.RobotOutlined,{className:"mr-2"})," ",g]}),(0,t.jsx)(l.Select,{value:f,placeholder:c,onChange:e=>{"custom"===e?(b(!0),x(void 0)):(b(!1),x(e),d&&d(e))},options:[...Array.from(new Set(v.map(e=>e.model_group))).map((e,t)=>({value:e,label:e,key:t})),{value:"custom",label:"Enter custom model",key:"custom"}],style:{width:"100%",...m},showSearch:!0,className:`rounded-md ${p||""}`,disabled:u}),y&&(0,t.jsx)(s.TextInput,{className:"mt-2",placeholder:"Enter custom model name",onValueChange:e=>{j.current&&clearTimeout(j.current),j.current=setTimeout(()=>{x(e),d&&d(e)},500)},disabled:u})]})}])},500727,699857,696609,531516,e=>{"use strict";var t=e.i(266027),r=e.i(243652),s=e.i(764205),a=e.i(135214);let l=(0,r.createQueryKeys)("mcpServers");e.s(["useMCPServers",0,e=>{let{accessToken:r}=(0,a.default)();return(0,t.useQuery)({queryKey:l.list(e?{filters:{teamId:e}}:void 0),queryFn:async()=>await (0,s.fetchMCPServers)(r,e),enabled:!!r})}],500727);let i=(0,r.createQueryKeys)("mcpToolsets");e.s(["useMCPToolsets",0,()=>{let{accessToken:e}=(0,a.default)();return(0,t.useQuery)({queryKey:i.list(),queryFn:async()=>await (0,s.fetchMCPToolsets)(e),enabled:!!e})}],699857);var n=e.i(843476),o=e.i(271645),c=e.i(536916),d=e.i(599724),u=e.i(409797),m=e.i(246349),m=m;let p=/\b(delete|remove|destroy|purge|drop|erase|unlink)\b/i,h=/\b(create|add|insert|new|post|submit|register|make|generate|write|upload)\b/i,g=/\b(update|edit|modify|change|patch|put|set|rename|move|transform)\b/i,f=/\b(get|read|list|fetch|search|find|query|retrieve|show|view|check|describe|info)\b/i;function x(e,t=""){let r=e.toLowerCase();if(f.test(r))return"read";if(p.test(r))return"delete";if(g.test(r))return"update";if(h.test(r))return"create";if(t){let e=t.toLowerCase();if(f.test(e))return"read";if(p.test(e))return"delete";if(g.test(e))return"update";if(h.test(e))return"create"}return"unknown"}function y(e){let t={read:[],create:[],update:[],delete:[],unknown:[]};for(let r of e)t[x(r.name,r.description)].push(r);return t}let b={read:{label:"Read",description:"Safe operations — fetch, list, search. No side effects.",risk:"low"},create:{label:"Create",description:"Add new resources — insert, upload, register.",risk:"medium"},update:{label:"Update",description:"Modify existing resources — edit, patch, rename.",risk:"medium"},delete:{label:"Delete",description:"Destructive operations — remove, purge, destroy.",risk:"high"},unknown:{label:"Other",description:"Operations that could not be automatically classified.",risk:"unknown"}};e.s(["CRUD_GROUP_META",0,b,"classifyToolOp",()=>x,"groupToolsByCrud",()=>y],696609);let v=["read","create","update","delete","unknown"],_={low:"bg-green-100 text-green-800",medium:"bg-yellow-100 text-yellow-800",high:"bg-red-100 text-red-800 font-semibold",unknown:"bg-gray-100 text-gray-700"},j={read:"border-green-200",create:"border-blue-200",update:"border-yellow-200",delete:"border-red-300",unknown:"border-gray-200"},w={read:"bg-green-50",create:"bg-blue-50",update:"bg-yellow-50",delete:"bg-red-50",unknown:"bg-gray-50"};e.s(["default",0,({tools:e,value:t,onChange:r,readOnly:s=!1,searchFilter:a=""})=>{let[l,i]=(0,o.useState)({read:!1,create:!1,update:!1,delete:!1,unknown:!0}),p=(0,o.useMemo)(()=>y(e),[e]),h=(0,o.useMemo)(()=>new Set(void 0===t?e.map(e=>e.name):t),[t,e]),g=e=>{if(s)return;let t=new Set(h);t.has(e)?t.delete(e):t.add(e),r(Array.from(t))};return 0===e.length?null:(0,n.jsx)("div",{className:"space-y-3",children:v.map(e=>{let t,o=p[e];if(0===o.length)return null;if(a){let e=a.toLowerCase();if(!o.some(t=>t.name.toLowerCase().includes(e)||(t.description??"").toLowerCase().includes(e)))return null}let f=b[e],x=(t=p[e]).length>0&&t.every(e=>h.has(e.name)),y=(e=>{let t=p[e];if(0===t.length)return!1;let r=t.filter(e=>h.has(e.name)).length;return r>0&&r{i(t=>({...t,[e]:!t[e]}))},children:[v?(0,n.jsx)(m.default,{className:"w-4 h-4 text-gray-500 flex-shrink-0"}):(0,n.jsx)(u.ChevronDownIcon,{className:"w-4 h-4 text-gray-500 flex-shrink-0"}),(0,n.jsx)("span",{className:"font-semibold text-gray-900 text-sm",children:f.label}),(0,n.jsx)("span",{className:`text-xs px-2 py-0.5 rounded-full ${_[f.risk]}`,children:"high"===f.risk?"High Risk":"medium"===f.risk?"Medium Risk":"low"===f.risk?"Safe":"Unclassified"}),(0,n.jsxs)("span",{className:"text-xs text-gray-500 ml-1",children:[o.filter(e=>h.has(e.name)).length,"/",o.length," allowed"]})]}),!s&&(0,n.jsxs)("div",{className:"flex items-center gap-2 ml-4",children:[(0,n.jsx)(d.Text,{className:"text-xs text-gray-500",children:x?"All on":y?"Partial":"All off"}),(0,n.jsx)(c.Checkbox,{checked:x,indeterminate:y,onChange:t=>((e,t)=>{if(s)return;let a=new Set(h);for(let r of p[e])t?a.add(r.name):a.delete(r.name);r(Array.from(a))})(e,t.target.checked),onClick:e=>e.stopPropagation()})]})]}),!v&&(0,n.jsx)("div",{className:"px-4 pt-2 pb-1 text-xs text-gray-500 bg-white border-b border-gray-100",children:f.description}),!v&&(0,n.jsx)("div",{className:"bg-white divide-y divide-gray-50",children:o.filter(e=>!a||e.name.toLowerCase().includes(a.toLowerCase())||(e.description??"").toLowerCase().includes(a.toLowerCase())).map(e=>{let t,r=(t=e.name,h.has(t));return(0,n.jsxs)("div",{className:`flex items-start gap-3 px-4 py-2.5 transition-colors hover:bg-gray-50 ${!s?"cursor-pointer":""} ${r?"":"opacity-60"}`,onClick:()=>g(e.name),children:[(0,n.jsx)(c.Checkbox,{checked:r,onChange:()=>g(e.name),disabled:s,onClick:e=>e.stopPropagation()}),(0,n.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,n.jsx)(d.Text,{className:"font-medium text-gray-900 text-sm",children:e.name}),e.description&&(0,n.jsx)(d.Text,{className:"text-xs text-gray-500 mt-0.5 leading-snug",children:e.description})]}),(0,n.jsx)("span",{className:`text-xs px-1.5 py-0.5 rounded flex-shrink-0 ${r?"bg-green-100 text-green-700":"bg-gray-100 text-gray-500"}`,children:r?"on":"off"})]},e.name)})})]},e)})})}],531516)},916940,e=>{"use strict";var t=e.i(843476),r=e.i(271645),s=e.i(199133),a=e.i(764205);e.s(["default",0,({onChange:e,value:l,className:i,accessToken:n,placeholder:o="Select vector stores",disabled:c=!1})=>{let[d,u]=(0,r.useState)([]),[m,p]=(0,r.useState)(!1);return(0,r.useEffect)(()=>{(async()=>{if(n){p(!0);try{let e=await (0,a.vectorStoreListCall)(n);e.data&&u(e.data)}catch(e){console.error("Error fetching vector stores:",e)}finally{p(!1)}}})()},[n]),(0,t.jsx)("div",{children:(0,t.jsx)(s.Select,{mode:"multiple",placeholder:o,onChange:e,value:l,loading:m,className:i,allowClear:!0,options:d.map(e=>({label:`${e.vector_store_name||e.vector_store_id} (${e.vector_store_id})`,value:e.vector_store_id,title:e.vector_store_description||e.vector_store_id})),optionFilterProp:"label",showSearch:!0,style:{width:"100%"},disabled:c})})}])},689020,e=>{"use strict";var t=e.i(764205);let r=async e=>{try{let r=await (0,t.modelHubCall)(e);if(console.log("model_info:",r),r?.data.length>0){let e=r.data.map(e=>({model_group:e.model_group,mode:e?.mode}));return e.sort((e,t)=>e.model_group.localeCompare(t.model_group)),e}return[]}catch(e){throw console.error("Error fetching model info:",e),e}};e.s(["fetchAvailableModels",0,r])},955135,e=>{"use strict";var t=e.i(597440);e.s(["DeleteOutlined",()=>t.default])},993914,e=>{"use strict";e.i(247167);var t=e.i(931067),r=e.i(271645);let s={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M854.6 288.6L639.4 73.4c-6-6-14.1-9.4-22.6-9.4H192c-17.7 0-32 14.3-32 32v832c0 17.7 14.3 32 32 32h640c17.7 0 32-14.3 32-32V311.3c0-8.5-3.4-16.7-9.4-22.7zM790.2 326H602V137.8L790.2 326zm1.8 562H232V136h302v216a42 42 0 0042 42h216v494zM504 618H320c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8h184c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8zM312 490v48c0 4.4 3.6 8 8 8h384c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8H320c-4.4 0-8 3.6-8 8z"}}]},name:"file-text",theme:"outlined"};var a=e.i(9583),l=r.forwardRef(function(e,l){return r.createElement(a.default,(0,t.default)({},e,{ref:l,icon:s}))});e.s(["FileTextOutlined",0,l],993914)},737434,e=>{"use strict";var t=e.i(184163);e.s(["DownloadOutlined",()=>t.default])},59935,(e,t,r)=>{var s;let a;e.e,s=function e(){var t,r="u">typeof self?self:"u">typeof window?window:void 0!==r?r:{},s=!r.document&&!!r.postMessage,a=r.IS_PAPA_WORKER||!1,l={},i=0,n={};function o(e){this._handle=null,this._finished=!1,this._completed=!1,this._halted=!1,this._input=null,this._baseIndex=0,this._partialLine="",this._rowCount=0,this._start=0,this._nextChunk=null,this.isFirstChunk=!0,this._completeResults={data:[],errors:[],meta:{}},(function(e){var t=b(e);t.chunkSize=parseInt(t.chunkSize),e.step||e.chunk||(t.chunkSize=null),this._handle=new p(t),(this._handle.streamer=this)._config=t}).call(this,e),this.parseChunk=function(e,t){var s=parseInt(this._config.skipFirstNLines)||0;if(this.isFirstChunk&&0=this._config.preview,a)r.postMessage({results:l,workerId:n.WORKER_ID,finished:s});else if(_(this._config.chunk)&&!t){if(this._config.chunk(l,this._handle),this._handle.paused()||this._handle.aborted())return void(this._halted=!0);this._completeResults=l=void 0}return this._config.step||this._config.chunk||(this._completeResults.data=this._completeResults.data.concat(l.data),this._completeResults.errors=this._completeResults.errors.concat(l.errors),this._completeResults.meta=l.meta),this._completed||!s||!_(this._config.complete)||l&&l.meta.aborted||(this._config.complete(this._completeResults,this._input),this._completed=!0),s||l&&l.meta.paused||this._nextChunk(),l}this._halted=!0},this._sendError=function(e){_(this._config.error)?this._config.error(e):a&&this._config.error&&r.postMessage({workerId:n.WORKER_ID,error:e,finished:!1})}}function c(e){var t;(e=e||{}).chunkSize||(e.chunkSize=n.RemoteChunkSize),o.call(this,e),this._nextChunk=s?function(){this._readChunk(),this._chunkLoaded()}:function(){this._readChunk()},this.stream=function(e){this._input=e,this._nextChunk()},this._readChunk=function(){if(this._finished)this._chunkLoaded();else{if(t=new XMLHttpRequest,this._config.withCredentials&&(t.withCredentials=this._config.withCredentials),s||(t.onload=v(this._chunkLoaded,this),t.onerror=v(this._chunkError,this)),t.open(this._config.downloadRequestBody?"POST":"GET",this._input,!s),this._config.downloadRequestHeaders){var e,r,a=this._config.downloadRequestHeaders;for(r in a)t.setRequestHeader(r,a[r])}this._config.chunkSize&&(e=this._start+this._config.chunkSize-1,t.setRequestHeader("Range","bytes="+this._start+"-"+e));try{t.send(this._config.downloadRequestBody)}catch(e){this._chunkError(e.message)}s&&0===t.status&&this._chunkError()}},this._chunkLoaded=function(){let e;4===t.readyState&&(t.status<200||400<=t.status?this._chunkError():(this._start+=this._config.chunkSize||t.responseText.length,this._finished=!this._config.chunkSize||this._start>=(null!==(e=(e=t).getResponseHeader("Content-Range"))?parseInt(e.substring(e.lastIndexOf("/")+1)):-1),this.parseChunk(t.responseText)))},this._chunkError=function(e){e=t.statusText||e,this._sendError(Error(e))}}function d(e){(e=e||{}).chunkSize||(e.chunkSize=n.LocalChunkSize),o.call(this,e);var t,r,s="u">typeof FileReader;this.stream=function(e){this._input=e,r=e.slice||e.webkitSlice||e.mozSlice,s?((t=new FileReader).onload=v(this._chunkLoaded,this),t.onerror=v(this._chunkError,this)):t=new FileReaderSync,this._nextChunk()},this._nextChunk=function(){this._finished||this._config.preview&&!(this._rowCount=this._input.size,this.parseChunk(e.target.result)},this._chunkError=function(){this._sendError(t.error)}}function u(e){var t;o.call(this,e=e||{}),this.stream=function(e){return t=e,this._nextChunk()},this._nextChunk=function(){var e,r;if(!this._finished)return t=(e=this._config.chunkSize)?(r=t.substring(0,e),t.substring(e)):(r=t,""),this._finished=!t,this.parseChunk(r)}}function m(e){o.call(this,e=e||{});var t=[],r=!0,s=!1;this.pause=function(){o.prototype.pause.apply(this,arguments),this._input.pause()},this.resume=function(){o.prototype.resume.apply(this,arguments),this._input.resume()},this.stream=function(e){this._input=e,this._input.on("data",this._streamData),this._input.on("end",this._streamEnd),this._input.on("error",this._streamError)},this._checkIsFinished=function(){s&&1===t.length&&(this._finished=!0)},this._nextChunk=function(){this._checkIsFinished(),t.length?this.parseChunk(t.shift()):r=!0},this._streamData=v(function(e){try{t.push("string"==typeof e?e:e.toString(this._config.encoding)),r&&(r=!1,this._checkIsFinished(),this.parseChunk(t.shift()))}catch(e){this._streamError(e)}},this),this._streamError=v(function(e){this._streamCleanUp(),this._sendError(e)},this),this._streamEnd=v(function(){this._streamCleanUp(),s=!0,this._streamData("")},this),this._streamCleanUp=v(function(){this._input.removeListener("data",this._streamData),this._input.removeListener("end",this._streamEnd),this._input.removeListener("error",this._streamError)},this)}function p(e){var t,r,s,a,l=/^\s*-?(\d+\.?|\.\d+|\d+\.\d+)([eE][-+]?\d+)?\s*$/,i=/^((\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\.\d+([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z)))$/,o=this,c=0,d=0,u=!1,m=!1,p=[],f={data:[],errors:[],meta:{}};function x(t){return"greedy"===e.skipEmptyLines?""===t.join("").trim():1===t.length&&0===t[0].length}function y(){if(f&&s&&(j("Delimiter","UndetectableDelimiter","Unable to auto-detect delimiting character; defaulted to '"+n.DefaultDelimiter+"'"),s=!1),e.skipEmptyLines&&(f.data=f.data.filter(function(e){return!x(e)})),v()){if(f)if(Array.isArray(f.data[0])){for(var t,r=0;v()&&r(e.dynamicTypingFunction&&void 0===e.dynamicTyping[t]&&(e.dynamicTyping[t]=e.dynamicTypingFunction(t)),!0===(e.dynamicTyping[t]||e.dynamicTyping))?"true"===r||"TRUE"===r||"false"!==r&&"FALSE"!==r&&((e=>{if(l.test(e)&&-0x20000000000000<(e=parseFloat(e))&&e<0x20000000000000)return 1})(r)?parseFloat(r):i.test(r)?new Date(r):""===r?null:r):r)(n=e.header?a>=p.length?"__parsed_extra":p[a]:n,o=e.transform?e.transform(o,n):o);"__parsed_extra"===n?(s[n]=s[n]||[],s[n].push(o)):s[n]=o}return e.header&&(a>p.length?j("FieldMismatch","TooManyFields","Too many fields: expected "+p.length+" fields but parsed "+a,d+r):ae.preview?r.abort():(f.data=f.data[0],a(f,o))))}),this.parse=function(a,l,i){var o=e.quoteChar||'"',o=(e.newline||(e.newline=this.guessLineEndings(a,o)),s=!1,e.delimiter?_(e.delimiter)&&(e.delimiter=e.delimiter(a),f.meta.delimiter=e.delimiter):((o=((t,r,s,a,l)=>{var i,o,c,d;l=l||[","," ","|",";",n.RECORD_SEP,n.UNIT_SEP];for(var u=0;u=r.length/2?"\r\n":"\r"}}function h(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function g(e){var t=(e=e||{}).delimiter,r=e.newline,s=e.comments,a=e.step,l=e.preview,i=e.fastMode,o=null,c=!1,d=null==e.quoteChar?'"':e.quoteChar,u=d;if(void 0!==e.escapeChar&&(u=e.escapeChar),("string"!=typeof t||-1=l)return D(!0);break}k.push({type:"Quotes",code:"InvalidQuotes",message:"Trailing quote on quoted field is malformed",row:w.length,index:m}),M++}}else if(s&&0===N.length&&n.substring(m,m+v)===s){if(-1===O)return D();m=O+b,O=n.indexOf(r,m),E=n.indexOf(t,m)}else if(-1!==E&&(E=l)return D(!0)}return R();function A(e){w.push(e),C=m}function L(e){return -1!==e&&(e=n.substring(M+1,e))&&""===e.trim()?e.length:0}function R(e){return f||(void 0===e&&(e=n.substring(m)),N.push(e),m=x,A(N),j&&B()),D()}function F(e){m=e,A(N),N=[],O=n.indexOf(r,m)}function D(s){if(e.header&&!g&&w.length&&!c){var a=w[0],l=Object.create(null),i=new Set(a);let t=!1;for(let r=0;r{if("object"==typeof t){if("string"!=typeof t.delimiter||n.BAD_DELIMITERS.filter(function(e){return -1!==t.delimiter.indexOf(e)}).length||(a=t.delimiter),("boolean"==typeof t.quotes||"function"==typeof t.quotes||Array.isArray(t.quotes))&&(r=t.quotes),"boolean"!=typeof t.skipEmptyLines&&"string"!=typeof t.skipEmptyLines||(c=t.skipEmptyLines),"string"==typeof t.newline&&(l=t.newline),"string"==typeof t.quoteChar&&(i=t.quoteChar),"boolean"==typeof t.header&&(s=t.header),Array.isArray(t.columns)){if(0===t.columns.length)throw Error("Option columns is empty");d=t.columns}void 0!==t.escapeChar&&(o=t.escapeChar+i),t.escapeFormulae instanceof RegExp?u=t.escapeFormulae:"boolean"==typeof t.escapeFormulae&&t.escapeFormulae&&(u=/^[=+\-@\t\r].*$/)}})(),RegExp(h(i),"g"));if("string"==typeof e&&(e=JSON.parse(e)),Array.isArray(e)){if(!e.length||Array.isArray(e[0]))return p(null,e,c);if("object"==typeof e[0])return p(d||Object.keys(e[0]),e,c)}else if("object"==typeof e)return"string"==typeof e.data&&(e.data=JSON.parse(e.data)),Array.isArray(e.data)&&(e.fields||(e.fields=e.meta&&e.meta.fields||d),e.fields||(e.fields=Array.isArray(e.data[0])?e.fields:"object"==typeof e.data[0]?Object.keys(e.data[0]):[]),Array.isArray(e.data[0])||"object"==typeof e.data[0]||(e.data=[e.data])),p(e.fields||[],e.data||[],c);throw Error("Unable to serialize unrecognized input");function p(e,t,r){var i="",n=("string"==typeof e&&(e=JSON.parse(e)),"string"==typeof t&&(t=JSON.parse(t)),Array.isArray(e)&&0{for(var r=0;r{"use strict";var t=e.i(266027),r=e.i(243652),s=e.i(764205),a=e.i(135214);let l=(0,r.createQueryKeys)("tags");e.s(["useTags",0,()=>{let{accessToken:e,userId:r,userRole:i}=(0,a.default)();return(0,t.useQuery)({queryKey:l.list({}),queryFn:async()=>await (0,s.tagListCall)(e),enabled:!!(e&&r&&i)})}])},9314,263147,e=>{"use strict";var t=e.i(843476),r=e.i(199133),s=e.i(981339),a=e.i(645526),l=e.i(599724),i=e.i(266027),n=e.i(243652),o=e.i(764205),c=e.i(708347),d=e.i(135214);let u=(0,n.createQueryKeys)("accessGroups"),m=async e=>{let t=(0,o.getProxyBaseUrl)(),r=`${t}/v1/access_group`,s=await fetch(r,{method:"GET",headers:{[(0,o.getGlobalLitellmHeaderName)()]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!s.ok){let e=await s.json(),t=(0,o.deriveErrorMessage)(e);throw(0,o.handleError)(t),Error(t)}return s.json()},p=()=>{let{accessToken:e,userRole:t}=(0,d.default)();return(0,i.useQuery)({queryKey:u.list({}),queryFn:async()=>m(e),enabled:!!e&&c.all_admin_roles.includes(t||"")})};e.s(["accessGroupKeys",0,u,"useAccessGroups",0,p],263147),e.s(["default",0,({value:e,onChange:i,placeholder:n="Select access groups",disabled:o=!1,style:c,className:d,showLabel:u=!1,labelText:m="Access Group",allowClear:h=!0})=>{let{data:g,isLoading:f,isError:x}=p();if(f)return(0,t.jsxs)("div",{children:[u&&(0,t.jsxs)(l.Text,{className:"font-medium block mb-2 text-gray-700 flex items-center",children:[(0,t.jsx)(a.TeamOutlined,{className:"mr-2"})," ",m]}),(0,t.jsx)(s.Skeleton.Input,{active:!0,block:!0,style:{height:32,...c}})]});let y=(g??[]).map(e=>({label:(0,t.jsxs)("span",{children:[(0,t.jsx)("span",{className:"font-medium",children:e.access_group_name})," ",(0,t.jsxs)("span",{className:"text-gray-400 text-xs",children:["(",e.access_group_id,")"]})]}),value:e.access_group_id,selectedLabel:e.access_group_name,searchText:`${e.access_group_name} ${e.access_group_id}`}));return(0,t.jsxs)("div",{children:[u&&(0,t.jsxs)(l.Text,{className:"font-medium block mb-2 text-gray-700 flex items-center",children:[(0,t.jsx)(a.TeamOutlined,{className:"mr-2"})," ",m]}),(0,t.jsx)(r.Select,{mode:"multiple",value:e,placeholder:n,onChange:i,disabled:o,allowClear:h,showSearch:!0,style:{width:"100%",...c},className:`rounded-md ${d??""}`,notFoundContent:x?(0,t.jsx)("span",{className:"text-red-500",children:"Failed to load access groups"}):"No access groups found",filterOption:(e,t)=>(y.find(e=>e.value===t?.value)?.searchText??"").toLowerCase().includes(e.toLowerCase()),optionLabelProp:"selectedLabel",options:y.map(e=>({label:e.label,value:e.value,selectedLabel:e.selectedLabel}))})]})}],9314)},552130,e=>{"use strict";var t=e.i(843476),r=e.i(271645),s=e.i(199133),a=e.i(764205);e.s(["default",0,({onChange:e,value:l,className:i,accessToken:n,placeholder:o="Select agents",disabled:c=!1})=>{let[d,u]=(0,r.useState)([]),[m,p]=(0,r.useState)([]),[h,g]=(0,r.useState)(!1);(0,r.useEffect)(()=>{(async()=>{if(n){g(!0);try{let e=await (0,a.getAgentsList)(n),t=e?.agents||[];u(t);let r=new Set;t.forEach(e=>{let t=e.agent_access_groups;t&&Array.isArray(t)&&t.forEach(e=>r.add(e))}),p(Array.from(r))}catch(e){console.error("Error fetching agents:",e)}finally{g(!1)}}})()},[n]);let f=[...m.map(e=>({label:e,value:`group:${e}`,isAccessGroup:!0,searchText:`${e} Access Group`})),...d.map(e=>({label:`${e.agent_name||e.agent_id}`,value:e.agent_id,isAccessGroup:!1,searchText:`${e.agent_name||e.agent_id} ${e.agent_id} Agent`}))],x=[...l?.agents||[],...(l?.accessGroups||[]).map(e=>`group:${e}`)];return(0,t.jsx)("div",{children:(0,t.jsx)(s.Select,{mode:"multiple",placeholder:o,onChange:t=>{e({agents:t.filter(e=>!e.startsWith("group:")),accessGroups:t.filter(e=>e.startsWith("group:")).map(e=>e.replace("group:",""))})},value:x,loading:h,className:i,allowClear:!0,showSearch:!0,style:{width:"100%"},disabled:c,filterOption:(e,t)=>(f.find(e=>e.value===t?.value)?.searchText||"").toLowerCase().includes(e.toLowerCase()),children:f.map(e=>(0,t.jsx)(s.Select.Option,{value:e.value,label:e.label,children:(0,t.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[(0,t.jsx)("span",{style:{display:"inline-block",width:8,height:8,borderRadius:"50%",background:e.isAccessGroup?"#52c41a":"#722ed1",flexShrink:0}}),(0,t.jsx)("span",{style:{flex:1},children:e.label}),(0,t.jsx)("span",{style:{color:e.isAccessGroup?"#52c41a":"#722ed1",fontSize:"12px",fontWeight:500,opacity:.8},children:e.isAccessGroup?"Access Group":"Agent"})]})},e.value))})})}])},844565,e=>{"use strict";var t=e.i(843476),r=e.i(271645),s=e.i(199133),a=e.i(764205);e.s(["default",0,({onChange:e,value:l,className:i,accessToken:n,placeholder:o="Select pass through routes",disabled:c=!1,teamId:d})=>{let[u,m]=(0,r.useState)([]),[p,h]=(0,r.useState)(!1);return(0,r.useEffect)(()=>{(async()=>{if(n){h(!0);try{let e=await (0,a.getPassThroughEndpointsCall)(n,d);if(e.endpoints){let t=e.endpoints.flatMap(e=>{let t=e.path,r=e.methods;return r&&r.length>0?r.map(e=>({label:`${e} ${t}`,value:t})):[{label:t,value:t}]});m(t)}}catch(e){console.error("Error fetching pass through routes:",e)}finally{h(!1)}}})()},[n,d]),(0,t.jsx)(s.Select,{mode:"tags",placeholder:o,onChange:e,value:l,loading:p,className:i,allowClear:!0,options:u,optionFilterProp:"label",showSearch:!0,style:{width:"100%"},disabled:c})}])},810757,477386,e=>{"use strict";var t=e.i(271645);let r=t.forwardRef(function(e,r){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:r},e),t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M10.325 4.317c.426-1.756 2.924-1.756 3.35 0a1.724 1.724 0 002.573 1.066c1.543-.94 3.31.826 2.37 2.37a1.724 1.724 0 001.065 2.572c1.756.426 1.756 2.924 0 3.35a1.724 1.724 0 00-1.066 2.573c.94 1.543-.826 3.31-2.37 2.37a1.724 1.724 0 00-2.572 1.065c-.426 1.756-2.924 1.756-3.35 0a1.724 1.724 0 00-2.573-1.066c-1.543.94-3.31-.826-2.37-2.37a1.724 1.724 0 00-1.065-2.572c-1.756-.426-1.756-2.924 0-3.35a1.724 1.724 0 001.066-2.573c-.94-1.543.826-3.31 2.37-2.37.996.608 2.296.07 2.572-1.065z"}),t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z"}))});e.s(["CogIcon",0,r],810757);let s=t.forwardRef(function(e,r){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:r},e),t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M18.364 18.364A9 9 0 005.636 5.636m12.728 12.728A9 9 0 015.636 5.636m12.728 12.728L5.636 5.636"}))});e.s(["BanIcon",0,s],477386)},557662,e=>{"use strict";let t="../ui/assets/logos/",r=[{id:"arize",displayName:"Arize",logo:`${t}arize.png`,supports_key_team_logging:!0,dynamic_params:{arize_api_key:"password",arize_space_id:"password"},description:"Arize Logging Integration"},{id:"braintrust",displayName:"Braintrust",logo:`${t}braintrust.png`,supports_key_team_logging:!1,dynamic_params:{braintrust_api_key:"password",braintrust_project_name:"text"},description:"Braintrust Logging Integration"},{id:"custom_callback_api",displayName:"Custom Callback API",logo:`${t}custom.svg`,supports_key_team_logging:!0,dynamic_params:{custom_callback_api_url:"text",custom_callback_api_headers:"text"},description:"Custom Callback API Logging Integration"},{id:"datadog",displayName:"Datadog",logo:`${t}datadog.png`,supports_key_team_logging:!1,dynamic_params:{dd_api_key:"password",dd_site:"text"},description:"Datadog Logging Integration"},{id:"lago",displayName:"Lago",logo:`${t}lago.svg`,supports_key_team_logging:!1,dynamic_params:{lago_api_url:"text",lago_api_key:"password"},description:"Lago Billing Logging Integration"},{id:"langfuse",displayName:"Langfuse",logo:`${t}langfuse.png`,supports_key_team_logging:!0,dynamic_params:{langfuse_public_key:"text",langfuse_secret_key:"password",langfuse_host:"text"},description:"Langfuse v2 Logging Integration"},{id:"langfuse_otel",displayName:"Langfuse OTEL",logo:`${t}langfuse.png`,supports_key_team_logging:!0,dynamic_params:{langfuse_public_key:"text",langfuse_secret_key:"password",langfuse_host:"text"},description:"Langfuse v3 OTEL Logging Integration"},{id:"langsmith",displayName:"LangSmith",logo:`${t}langsmith.png`,supports_key_team_logging:!0,dynamic_params:{langsmith_api_key:"password",langsmith_project:"text",langsmith_base_url:"text",langsmith_sampling_rate:"number"},description:"Langsmith Logging Integration"},{id:"openmeter",displayName:"OpenMeter",logo:`${t}openmeter.png`,supports_key_team_logging:!1,dynamic_params:{openmeter_api_key:"password",openmeter_base_url:"text"},description:"OpenMeter Logging Integration"},{id:"otel",displayName:"Open Telemetry",logo:`${t}otel.png`,supports_key_team_logging:!1,dynamic_params:{otel_endpoint:"text",otel_headers:"text"},description:"OpenTelemetry Logging Integration"},{id:"s3",displayName:"S3",logo:`${t}aws.svg`,supports_key_team_logging:!1,dynamic_params:{s3_bucket_name:"text",aws_access_key_id:"password",aws_secret_access_key:"password",aws_region:"text"},description:"S3 Bucket (AWS) Logging Integration"},{id:"SQS",displayName:"SQS",logo:`${t}aws.svg`,supports_key_team_logging:!1,dynamic_params:{sqs_queue_url:"text",aws_access_key_id:"password",aws_secret_access_key:"password",aws_region:"text"},description:"SQS Queue (AWS) Logging Integration"}],s=r.reduce((e,t)=>(e[t.displayName]=t,e),{}),a=r.reduce((e,t)=>(e[t.displayName]=t.id,e),{}),l=r.reduce((e,t)=>(e[t.id]=t.displayName,e),{});e.s(["callbackInfo",0,s,"callback_map",0,a,"mapDisplayToInternalNames",0,e=>e.map(e=>a[e]||e),"mapInternalToDisplayNames",0,e=>e.map(e=>l[e]||e),"reverse_callback_map",0,l])},75921,e=>{"use strict";var t=e.i(843476),r=e.i(266027),s=e.i(243652),a=e.i(764205),l=e.i(135214);let i=(0,s.createQueryKeys)("mcpAccessGroups");var n=e.i(500727),o=e.i(699857),c=e.i(199133);let d="toolset:";e.s(["default",0,({onChange:e,value:s,className:u,accessToken:m,placeholder:p="Select MCP servers",disabled:h=!1,teamId:g})=>{let{data:f=[],isLoading:x}=(0,n.useMCPServers)(g),{data:y=[],isLoading:b}=(()=>{let{accessToken:e}=(0,l.default)();return(0,r.useQuery)({queryKey:i.list({}),queryFn:async()=>await (0,a.fetchMCPAccessGroups)(e),enabled:!!e})})(),{data:v=[],isLoading:_}=(0,o.useMCPToolsets)(),j=new Set(y),w=[...y.map(e=>({label:e,value:e,type:"accessGroup",searchText:`${e} Access Group`})),...f.map(e=>({label:`${e.server_name||e.server_id} (${e.server_id})`,value:e.server_id,type:"server",searchText:`${e.server_name||e.server_id} ${e.server_id} MCP Server`})),...v.map(e=>({label:e.toolset_name,value:`${d}${e.toolset_id}`,type:"toolset",searchText:`${e.toolset_name} ${e.toolset_id} Toolset`}))],k={accessGroup:"#52c41a",server:"#1890ff",toolset:"#722ed1"},N={accessGroup:"Access Group",server:"MCP Server",toolset:"Toolset"},C=[...s?.servers||[],...s?.accessGroups||[],...(s?.toolsets||[]).map(e=>`${d}${e}`)];return(0,t.jsx)("div",{children:(0,t.jsx)(c.Select,{mode:"multiple",placeholder:p,onChange:t=>{let r=t.filter(e=>e.startsWith(d)).map(e=>e.slice(d.length)),s=t.filter(e=>!e.startsWith(d));e({servers:s.filter(e=>!j.has(e)),accessGroups:s.filter(e=>j.has(e)),toolsets:r})},value:C,loading:x||b||_,className:u,allowClear:!0,showSearch:!0,style:{width:"100%"},disabled:h,filterOption:(e,t)=>(w.find(e=>e.value===t?.value)?.searchText||"").toLowerCase().includes(e.toLowerCase()),children:w.map(e=>(0,t.jsx)(c.Select.Option,{value:e.value,label:e.label,children:(0,t.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[(0,t.jsx)("span",{style:{display:"inline-block",width:8,height:8,borderRadius:"50%",background:k[e.type],flexShrink:0}}),(0,t.jsx)("span",{style:{flex:1},children:e.label}),(0,t.jsx)("span",{style:{color:k[e.type],fontSize:"12px",fontWeight:500,opacity:.8},children:N[e.type]})]})},e.value))})})}],75921)},390605,e=>{"use strict";var t=e.i(843476),r=e.i(271645),s=e.i(764205),a=e.i(599724),l=e.i(482725),i=e.i(91739),n=e.i(500727),o=e.i(531516),c=e.i(696609);e.s(["default",0,({accessToken:e,selectedServers:d,toolPermissions:u,onChange:m,disabled:p=!1})=>{let{data:h=[]}=(0,n.useMCPServers)(),[g,f]=(0,r.useState)({}),[x,y]=(0,r.useState)({}),[b,v]=(0,r.useState)({}),[_,j]=(0,r.useState)({}),w=(0,r.useRef)(u);(0,r.useEffect)(()=>{w.current=u},[u]);let k=(0,r.useMemo)(()=>0===d.length?[]:h.filter(e=>d.includes(e.server_id)),[h,d]),N=async(e,t)=>{y(t=>({...t,[e]:!0})),v(t=>({...t,[e]:""}));try{let r=await (0,s.listMCPTools)(t,e);if(r.error)v(t=>({...t,[e]:r.message||"Failed to fetch tools"})),f(t=>({...t,[e]:[]}));else{let t=r.tools||[];f(r=>({...r,[e]:t}));let s=w.current;if(!s[e]&&t.length>0){let r=t.filter(e=>"delete"!==(0,c.classifyToolOp)(e.name,e.description||"")).map(e=>e.name);m({...s,[e]:r})}}}catch(t){console.error(`Error fetching tools for server ${e}:`,t),v(t=>({...t,[e]:"Failed to fetch tools"})),f(t=>({...t,[e]:[]}))}finally{y(t=>({...t,[e]:!1}))}};(0,r.useEffect)(()=>{k.forEach(t=>{g[t.server_id]||x[t.server_id]||N(t.server_id,e)})},[k,e]);let C=(e,t)=>{m({...u,[e]:t})};return 0===d.length?null:(0,t.jsx)("div",{className:"space-y-4",children:k.map(e=>{let r=e.server_name||e.alias||e.server_id,s=g[e.server_id]||[],n=u[e.server_id]||[],c=x[e.server_id],d=b[e.server_id],h=_[e.server_id]??"crud";return(0,t.jsxs)("div",{className:"border rounded-lg bg-gray-50",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between p-4 border-b bg-white rounded-t-lg",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)(a.Text,{className:"font-semibold text-gray-900",children:r}),e.description&&(0,t.jsx)(a.Text,{className:"text-sm text-gray-500",children:e.description})]}),(0,t.jsxs)("div",{className:"flex items-center gap-3",children:[!p&&s.length>0&&(0,t.jsx)(i.Radio.Group,{value:h,onChange:t=>j(r=>({...r,[e.server_id]:t.target.value})),size:"small",optionType:"button",buttonStyle:"solid",options:[{label:"Risk Groups",value:"crud"},{label:"Flat List",value:"flat"}]}),!p&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("button",{type:"button",className:"text-sm text-blue-600 hover:text-blue-700 font-medium",onClick:()=>{var t;let r;return r=g[t=e.server_id]||[],void m({...u,[t]:r.map(e=>e.name)})},disabled:c,children:"Select All"}),(0,t.jsx)("button",{type:"button",className:"text-sm text-blue-600 hover:text-blue-700 font-medium",onClick:()=>{var t;return t=e.server_id,void m({...u,[t]:[]})},disabled:c,children:"Deselect All"})]})]})]}),(0,t.jsxs)("div",{className:"p-4",children:[c&&(0,t.jsxs)("div",{className:"flex items-center justify-center py-8",children:[(0,t.jsx)(l.Spin,{size:"large"}),(0,t.jsx)(a.Text,{className:"ml-3 text-gray-500",children:"Loading tools..."})]}),d&&!c&&(0,t.jsxs)("div",{className:"p-4 bg-red-50 border border-red-200 rounded-lg text-center",children:[(0,t.jsx)(a.Text,{className:"text-red-600 font-medium",children:"Unable to load tools"}),(0,t.jsx)(a.Text,{className:"text-sm text-red-500 mt-1",children:d})]}),!c&&!d&&s.length>0&&"crud"===h&&(0,t.jsx)(o.default,{tools:s,value:u[e.server_id]?n:void 0,onChange:t=>C(e.server_id,t),readOnly:p}),!c&&!d&&s.length>0&&"flat"===h&&(0,t.jsx)("div",{className:"space-y-2",children:s.map(r=>{let s=n.includes(r.name);return(0,t.jsxs)("div",{className:"flex items-start gap-2",children:[(0,t.jsx)("input",{type:"checkbox",checked:s,onChange:()=>{if(p)return;let t=s?n.filter(e=>e!==r.name):[...n,r.name];C(e.server_id,t)},disabled:p,className:"mt-0.5"}),(0,t.jsx)("div",{className:"flex-1 min-w-0",children:(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(a.Text,{className:"font-medium text-gray-900",children:r.name}),(0,t.jsxs)(a.Text,{className:"text-sm text-gray-500",children:["- ",r.description||"No description"]})]})})]},r.name)})}),!c&&!d&&0===s.length&&(0,t.jsx)("div",{className:"text-center py-6",children:(0,t.jsx)(a.Text,{className:"text-gray-500",children:"No tools available"})})]})]},e.server_id)})})}])},266484,e=>{"use strict";var t=e.i(843476),r=e.i(199133),s=e.i(592968),a=e.i(312361),l=e.i(827252),i=e.i(994388),n=e.i(304967),o=e.i(779241),c=e.i(988297),d=e.i(68155),u=e.i(810757),m=e.i(477386),p=e.i(557662),h=e.i(435451);let{Option:g}=r.Select;e.s(["default",0,({value:e=[],onChange:f,disabledCallbacks:x=[],onDisabledCallbacksChange:y})=>{let b=Object.entries(p.callbackInfo).filter(([e,t])=>t.supports_key_team_logging).map(([e,t])=>e),v=Object.keys(p.callbackInfo),_=e=>{f?.(e)},j=(t,r,s)=>{let a=[...e];if("callback_name"===r){let e=p.callback_map[s]||s;a[t]={...a[t],[r]:e,callback_vars:{}}}else a[t]={...a[t],[r]:s};_(a)},w=(t,r,s)=>{let a=[...e];a[t]={...a[t],callback_vars:{...a[t].callback_vars,[r]:s}},_(a)};return(0,t.jsxs)("div",{className:"space-y-6",children:[(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,t.jsx)(m.BanIcon,{className:"w-5 h-5 text-red-500"}),(0,t.jsx)("span",{className:"text-base font-semibold text-gray-800",children:"Disabled Callbacks"}),(0,t.jsx)(s.Tooltip,{title:"Select callbacks to disable for this key. Disabled callbacks will not receive any logging data.",children:(0,t.jsx)(l.InfoCircleOutlined,{className:"text-gray-400 cursor-help"})})]}),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)("label",{className:"text-sm font-medium text-gray-700",children:"Disabled Callbacks"}),(0,t.jsx)(r.Select,{mode:"multiple",placeholder:"Select callbacks to disable",value:x,onChange:e=>{let t=(0,p.mapDisplayToInternalNames)(e);y?.(t)},style:{width:"100%"},optionLabelProp:"label",children:v.map(e=>{let r=p.callbackInfo[e]?.logo,a=p.callbackInfo[e]?.description;return(0,t.jsx)(g,{value:e,label:e,children:(0,t.jsx)(s.Tooltip,{title:a,placement:"right",children:(0,t.jsxs)("div",{className:"flex items-center space-x-2",children:[r&&(0,t.jsx)("img",{src:r,alt:e,className:"w-4 h-4 object-contain",onError:t=>{let r=t.target,s=r.parentElement;if(s){let t=document.createElement("div");t.className="w-4 h-4 rounded-full bg-gray-200 flex items-center justify-center text-xs",t.textContent=e.charAt(0),s.replaceChild(t,r)}}}),(0,t.jsx)("span",{children:e})]})})},e)})}),(0,t.jsx)("div",{className:"text-xs text-gray-500",children:"Select callbacks that should be disabled for this key. These callbacks will not receive any logging data."})]})]}),(0,t.jsx)(a.Divider,{}),(0,t.jsxs)("div",{className:"flex justify-between items-center",children:[(0,t.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,t.jsx)(u.CogIcon,{className:"w-5 h-5 text-blue-500"}),(0,t.jsx)("span",{className:"text-base font-semibold text-gray-800",children:"Logging Integrations"}),(0,t.jsx)(s.Tooltip,{title:"Configure callback logging integrations for this team.",children:(0,t.jsx)(l.InfoCircleOutlined,{className:"text-gray-400 cursor-help"})})]}),(0,t.jsx)(i.Button,{variant:"secondary",onClick:()=>{_([...e,{callback_name:"",callback_type:"success",callback_vars:{}}])},icon:c.PlusIcon,size:"sm",className:"hover:border-blue-400 hover:text-blue-500",type:"button",children:"Add Integration"})]}),(0,t.jsx)("div",{className:"space-y-4",children:e.map((a,c)=>{let u=a.callback_name?Object.entries(p.callback_map).find(([e,t])=>t===a.callback_name)?.[0]:void 0,m=u?p.callbackInfo[u]?.logo:null;return(0,t.jsxs)(n.Card,{className:"border border-gray-200 shadow-sm hover:shadow-md transition-shadow duration-200",decoration:"top",decorationColor:"blue",children:[(0,t.jsxs)("div",{className:"flex justify-between items-start mb-4",children:[(0,t.jsxs)("div",{className:"flex items-center space-x-2",children:[m&&(0,t.jsx)("img",{src:m,alt:u,className:"w-5 h-5 object-contain"}),(0,t.jsxs)("span",{className:"text-sm font-medium",children:[u||"New Integration"," Configuration"]})]}),(0,t.jsx)(i.Button,{variant:"light",onClick:()=>{_(e.filter((e,t)=>t!==c))},icon:d.TrashIcon,size:"xs",color:"red",className:"hover:bg-red-50",type:"button",children:"Remove"})]}),(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)("label",{className:"text-sm font-medium text-gray-700",children:"Integration Type"}),(0,t.jsx)(r.Select,{value:u,placeholder:"Select integration",onChange:e=>j(c,"callback_name",e),className:"w-full",optionLabelProp:"label",children:b.map(e=>{let r=p.callbackInfo[e]?.logo,a=p.callbackInfo[e]?.description;return(0,t.jsx)(g,{value:e,label:e,children:(0,t.jsx)(s.Tooltip,{title:a,placement:"right",children:(0,t.jsxs)("div",{className:"flex items-center space-x-2",children:[r&&(0,t.jsx)("img",{src:r,alt:e,className:"w-4 h-4 object-contain",onError:t=>{let r=t.target,s=r.parentElement;if(s){let t=document.createElement("div");t.className="w-4 h-4 rounded-full bg-gray-200 flex items-center justify-center text-xs",t.textContent=e.charAt(0),s.replaceChild(t,r)}}}),(0,t.jsx)("span",{children:e})]})})},e)})})]}),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)("label",{className:"text-sm font-medium text-gray-700",children:"Event Type"}),(0,t.jsxs)(r.Select,{value:a.callback_type,onChange:e=>j(c,"callback_type",e),className:"w-full",children:[(0,t.jsx)(g,{value:"success",children:(0,t.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,t.jsx)("div",{className:"w-2 h-2 bg-green-500 rounded-full"}),(0,t.jsx)("span",{children:"Success Only"})]})}),(0,t.jsx)(g,{value:"failure",children:(0,t.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,t.jsx)("div",{className:"w-2 h-2 bg-red-500 rounded-full"}),(0,t.jsx)("span",{children:"Failure Only"})]})}),(0,t.jsx)(g,{value:"success_and_failure",children:(0,t.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,t.jsx)("div",{className:"w-2 h-2 bg-blue-500 rounded-full"}),(0,t.jsx)("span",{children:"Success & Failure"})]})})]})]})]}),((e,r)=>{if(!e.callback_name)return null;let a=Object.entries(p.callback_map).find(([t,r])=>r===e.callback_name)?.[0];if(!a)return null;let i=p.callbackInfo[a]?.dynamic_params||{};return 0===Object.keys(i).length?null:(0,t.jsxs)("div",{className:"mt-6 pt-4 border-t border-gray-100",children:[(0,t.jsxs)("div",{className:"flex items-center space-x-2 mb-4",children:[(0,t.jsx)("div",{className:"w-3 h-3 bg-blue-100 rounded-full flex items-center justify-center",children:(0,t.jsx)("div",{className:"w-1.5 h-1.5 bg-blue-500 rounded-full"})}),(0,t.jsx)("span",{className:"text-sm font-medium text-gray-700",children:"Integration Parameters"})]}),(0,t.jsx)("div",{className:"grid grid-cols-1 gap-4",children:Object.entries(i).map(([a,i])=>(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsxs)("label",{className:"text-sm font-medium text-gray-700 capitalize flex items-center space-x-1",children:[(0,t.jsx)("span",{children:a.replace(/_/g," ")}),(0,t.jsx)(s.Tooltip,{title:`Environment variable reference recommended: os.environ/${a.toUpperCase()}`,children:(0,t.jsx)(l.InfoCircleOutlined,{className:"text-gray-400 cursor-help text-xs"})}),"password"===i&&(0,t.jsx)("span",{className:"inline-flex items-center px-2 py-0.5 rounded text-xs font-medium bg-yellow-100 text-yellow-800",children:"Sensitive"}),"number"===i&&(0,t.jsx)("span",{className:"inline-flex items-center px-2 py-0.5 rounded text-xs font-medium bg-yellow-100 text-yellow-800",children:"Number"})]}),"number"===i&&(0,t.jsx)("span",{className:"text-xs text-gray-500",children:"Value must be between 0 and 1"}),"number"===i?(0,t.jsx)(h.default,{step:.01,width:400,placeholder:`os.environ/${a.toUpperCase()}`,value:e.callback_vars[a]||"",onChange:e=>w(r,a,e.target.value)}):(0,t.jsx)(o.TextInput,{type:"password"===i?"password":"text",placeholder:`os.environ/${a.toUpperCase()}`,value:e.callback_vars[a]||"",onChange:e=>w(r,a,e.target.value)})]},a))})]})})(a,c)]})]},c)})}),0===e.length&&(0,t.jsxs)("div",{className:"text-center py-12 text-gray-500 border-2 border-dashed border-gray-200 rounded-lg bg-gray-50/50",children:[(0,t.jsx)(u.CogIcon,{className:"w-12 h-12 text-gray-300 mb-3 mx-auto"}),(0,t.jsx)("div",{className:"text-base font-medium mb-1",children:"No logging integrations configured"}),(0,t.jsx)("div",{className:"text-sm text-gray-400",children:'Click "Add Integration" to configure logging for this team'})]})]})}])},207082,e=>{"use strict";var t=e.i(619273),r=e.i(266027),s=e.i(243652),a=e.i(764205),l=e.i(135214);let i=(0,s.createQueryKeys)("keys"),n=async(e,t,r,s={})=>{try{let l=(0,a.getProxyBaseUrl)(),i=new URLSearchParams(Object.entries({team_id:s.teamID,project_id:s.projectID,organization_id:s.organizationID,key_alias:s.selectedKeyAlias,key_hash:s.keyHash,user_id:s.userID,page:t,size:r,sort_by:s.sortBy,sort_order:s.sortOrder,expand:s.expand,status:s.status,return_full_object:"true",include_team_keys:"true",include_created_by_keys:"true"}).filter(([,e])=>null!=e).map(([e,t])=>[e,String(t)])),n=`${l?`${l}/key/list`:"/key/list"}?${i}`,o=await fetch(n,{method:"GET",headers:{[(0,a.getGlobalLitellmHeaderName)()]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!o.ok){let e=await o.json(),t=(0,a.deriveErrorMessage)(e);throw(0,a.handleError)(t),Error(t)}let c=await o.json();return console.log("/key/list API Response:",c),c}catch(e){throw console.error("Failed to list keys:",e),e}},o=(0,s.createQueryKeys)("deletedKeys");e.s(["keyKeys",0,i,"useDeletedKeys",0,(e,s,a={})=>{let{accessToken:i}=(0,l.default)();return(0,r.useQuery)({queryKey:o.list({page:e,limit:s,...a}),queryFn:async()=>await n(i,e,s,{...a,status:"deleted"}),enabled:!!i,staleTime:3e4,placeholderData:t.keepPreviousData})},"useKeys",0,(e,s,a={})=>{let{accessToken:o}=(0,l.default)();return(0,r.useQuery)({queryKey:i.list({page:e,limit:s,...a}),queryFn:async()=>await n(o,e,s,a),enabled:!!o,staleTime:3e4,placeholderData:t.keepPreviousData})}])},510674,e=>{"use strict";var t=e.i(266027),r=e.i(243652),s=e.i(764205),a=e.i(708347),l=e.i(135214);let i=(0,r.createQueryKeys)("projects"),n=async e=>{let t=(0,s.getProxyBaseUrl)(),r=`${t}/project/list`,a=await fetch(r,{method:"GET",headers:{[(0,s.getGlobalLitellmHeaderName)()]:`Bearer ${e}`,"Content-Type":"application/json"}});if(!a.ok){let e=await a.json(),t=(0,s.deriveErrorMessage)(e);throw(0,s.handleError)(t),Error(t)}return a.json()};e.s(["projectKeys",0,i,"useProjects",0,()=>{let{accessToken:e,userRole:r}=(0,l.default)();return(0,t.useQuery)({queryKey:i.list({}),queryFn:async()=>n(e),enabled:!!e&&a.all_admin_roles.includes(r||"")})}])},392110,e=>{"use strict";var t=e.i(843476),r=e.i(271645),s=e.i(199133),a=e.i(592968),l=e.i(312361),i=e.i(790848),n=e.i(536916),o=e.i(827252),c=e.i(779241);let{Option:d}=s.Select;e.s(["default",0,({form:e,autoRotationEnabled:u,onAutoRotationChange:m,rotationInterval:p,onRotationIntervalChange:h,isCreateMode:g=!1,neverExpire:f=!1,onNeverExpireChange:x})=>{let y=p&&!["7d","30d","90d","180d","365d"].includes(p),[b,v]=(0,r.useState)(y),[_,j]=(0,r.useState)(y?p:""),[w,k]=(0,r.useState)(e?.getFieldValue?.("duration")||"");return(0,t.jsxs)("div",{className:"space-y-6",children:[(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsx)("span",{className:"text-sm font-medium text-gray-700",children:"Key Expiry Settings"}),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsxs)("label",{className:"text-sm font-medium text-gray-700 flex items-center space-x-1",children:[(0,t.jsx)("span",{children:"Expire Key"}),(0,t.jsx)(a.Tooltip,{title:"Set when this key should expire. Format: 30s (seconds), 30m (minutes), 30h (hours), 30d (days). Leave empty to keep the current expiry unchanged.",children:(0,t.jsx)(o.InfoCircleOutlined,{className:"text-gray-400 cursor-help text-xs"})}),!g&&x&&(0,t.jsx)(n.Checkbox,{checked:f,onChange:t=>{let r=t.target.checked;x(r),r&&(k(""),e&&"function"==typeof e.setFieldValue?e.setFieldValue("duration",""):e&&"function"==typeof e.setFieldsValue&&e.setFieldsValue({duration:""}))},className:"ml-2 text-sm font-normal text-gray-600",children:"Never Expire"})]}),(0,t.jsx)(c.TextInput,{name:"duration",placeholder:g?"e.g., 30d or leave empty to never expire":"e.g., 30d",className:"w-full",value:w,onValueChange:t=>{k(t),e&&"function"==typeof e.setFieldValue?e.setFieldValue("duration",t):e&&"function"==typeof e.setFieldsValue&&e.setFieldsValue({duration:t})},disabled:!g&&f})]})]}),(0,t.jsx)(l.Divider,{}),(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsx)("span",{className:"text-sm font-medium text-gray-700",children:"Auto-Rotation Settings"}),(0,t.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsxs)("label",{className:"text-sm font-medium text-gray-700 flex items-center space-x-1",children:[(0,t.jsx)("span",{children:"Enable Auto-Rotation"}),(0,t.jsx)(a.Tooltip,{title:"Key will automatically regenerate at the specified interval for enhanced security.",children:(0,t.jsx)(o.InfoCircleOutlined,{className:"text-gray-400 cursor-help text-xs"})})]}),(0,t.jsx)(i.Switch,{checked:u,onChange:m,size:"default",className:u?"":"bg-gray-400"})]}),u&&(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsxs)("label",{className:"text-sm font-medium text-gray-700 flex items-center space-x-1",children:[(0,t.jsx)("span",{children:"Rotation Interval"}),(0,t.jsx)(a.Tooltip,{title:"How often the key should be automatically rotated. Choose the interval that best fits your security requirements.",children:(0,t.jsx)(o.InfoCircleOutlined,{className:"text-gray-400 cursor-help text-xs"})})]}),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsxs)(s.Select,{value:b?"custom":p,onChange:e=>{"custom"===e?v(!0):(v(!1),j(""),h(e))},className:"w-full",placeholder:"Select interval",children:[(0,t.jsx)(d,{value:"7d",children:"7 days"}),(0,t.jsx)(d,{value:"30d",children:"30 days"}),(0,t.jsx)(d,{value:"90d",children:"90 days"}),(0,t.jsx)(d,{value:"180d",children:"180 days"}),(0,t.jsx)(d,{value:"365d",children:"365 days"}),(0,t.jsx)(d,{value:"custom",children:"Custom interval"})]}),b&&(0,t.jsxs)("div",{className:"space-y-1",children:[(0,t.jsx)(c.TextInput,{value:_,onChange:e=>{let t=e.target.value;j(t),h(t)},placeholder:"e.g., 1s, 5m, 2h, 14d"}),(0,t.jsx)("div",{className:"text-xs text-gray-500",children:"Supported formats: seconds (s), minutes (m), hours (h), days (d)"})]})]})]})]}),u&&(0,t.jsx)("div",{className:"bg-blue-50 p-3 rounded-md text-sm text-blue-700",children:"When rotation occurs, you'll receive a notification with the new key. The old key will be deactivated after a brief grace period."})]})]})}])},939510,e=>{"use strict";var t=e.i(843476),r=e.i(808613),s=e.i(199133),a=e.i(592968),l=e.i(827252);let{Option:i}=s.Select;e.s(["default",0,({type:e,name:n,showDetailedDescriptions:o=!0,className:c="",initialValue:d=null,form:u,onChange:m})=>{let p=e.toUpperCase(),h=e.toLowerCase(),g=`Select 'guaranteed_throughput' to prevent overallocating ${p} limit when the key belongs to a Team with specific ${p} limits.`;return(0,t.jsx)(r.Form.Item,{label:(0,t.jsxs)("span",{children:[p," Rate Limit Type"," ",(0,t.jsx)(a.Tooltip,{title:g,children:(0,t.jsx)(l.InfoCircleOutlined,{style:{marginLeft:"4px"}})})]}),name:n,initialValue:d,className:c,children:(0,t.jsx)(s.Select,{defaultValue:o?"default":void 0,placeholder:"Select rate limit type",style:{width:"100%"},optionLabelProp:o?"label":void 0,onChange:e=>{u&&u.setFieldValue(n,e),m&&m(e)},children:o?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(i,{value:"best_effort_throughput",label:"Default",children:(0,t.jsxs)("div",{style:{padding:"4px 0"},children:[(0,t.jsx)("div",{style:{fontWeight:500},children:"Default"}),(0,t.jsxs)("div",{style:{fontSize:"11px",color:"#6b7280",marginTop:"2px"},children:["Best effort throughput - no error if we're overallocating ",h," (Team/Key Limits checked at runtime)."]})]})}),(0,t.jsx)(i,{value:"guaranteed_throughput",label:"Guaranteed throughput",children:(0,t.jsxs)("div",{style:{padding:"4px 0"},children:[(0,t.jsx)("div",{style:{fontWeight:500},children:"Guaranteed throughput"}),(0,t.jsxs)("div",{style:{fontSize:"11px",color:"#6b7280",marginTop:"2px"},children:["Guaranteed throughput - raise an error if we're overallocating ",h," (also checks model-specific limits)"]})]})}),(0,t.jsx)(i,{value:"dynamic",label:"Dynamic",children:(0,t.jsxs)("div",{style:{padding:"4px 0"},children:[(0,t.jsx)("div",{style:{fontWeight:500},children:"Dynamic"}),(0,t.jsxs)("div",{style:{fontSize:"11px",color:"#6b7280",marginTop:"2px"},children:["If the key has a set ",p," (e.g. 2 ",p,") and there are no 429 errors, it can dynamically exceed the limit when the model being called is not erroring."]})]})})]}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(i,{value:"best_effort_throughput",children:"Best effort throughput"}),(0,t.jsx)(i,{value:"guaranteed_throughput",children:"Guaranteed throughput"}),(0,t.jsx)(i,{value:"dynamic",children:"Dynamic"})]})})})}])},363256,e=>{"use strict";var t=e.i(843476),r=e.i(199133);let{Text:s}=e.i(898586).Typography;e.s(["default",0,({organizations:e,value:a,onChange:l,disabled:i,loading:n,style:o})=>(0,t.jsx)(r.Select,{showSearch:!0,placeholder:"All Organizations",value:a,onChange:l,disabled:i,loading:n,allowClear:!0,style:{minWidth:280,...o},filterOption:(t,r)=>{if(!r)return!1;let s=e?.find(e=>e.organization_id===r.key);if(!s)return!1;let a=t.toLowerCase().trim(),l=(s.organization_alias||"").toLowerCase(),i=(s.organization_id||"").toLowerCase();return l.includes(a)||i.includes(a)},children:e?.map(e=>(0,t.jsxs)(r.Select.Option,{value:e.organization_id,children:[(0,t.jsx)("span",{className:"font-medium",children:e.organization_alias})," ",(0,t.jsxs)(s,{type:"secondary",children:["(",e.organization_id,")"]})]},e.organization_id))})])},533882,e=>{"use strict";var t=e.i(843476),r=e.i(271645),s=e.i(250980),a=e.i(797672),l=e.i(68155),i=e.i(304967),n=e.i(629569),o=e.i(599724),c=e.i(269200),d=e.i(427612),u=e.i(64848),m=e.i(942232),p=e.i(496020),h=e.i(977572),g=e.i(992619),f=e.i(727749);e.s(["default",0,({accessToken:e,initialModelAliases:x={},onAliasUpdate:y,showExampleConfig:b=!0})=>{let[v,_]=(0,r.useState)([]),[j,w]=(0,r.useState)({aliasName:"",targetModel:""}),[k,N]=(0,r.useState)(null);(0,r.useEffect)(()=>{_(Object.entries(x).map(([e,t],r)=>({id:`${r}-${e}`,aliasName:e,targetModel:t})))},[x]);let C=()=>{if(!k)return;if(!k.aliasName||!k.targetModel)return void f.default.fromBackend("Please provide both alias name and target model");if(v.some(e=>e.id!==k.id&&e.aliasName===k.aliasName))return void f.default.fromBackend("An alias with this name already exists");let e=v.map(e=>e.id===k.id?k:e);_(e),N(null);let t={};e.forEach(e=>{t[e.aliasName]=e.targetModel}),y&&y(t),f.default.success("Alias updated successfully")},S=()=>{N(null)},T=v.reduce((e,t)=>(e[t.aliasName]=t.targetModel,e),{});return(0,t.jsxs)("div",{className:"mt-4",children:[(0,t.jsxs)("div",{className:"mb-6",children:[(0,t.jsx)(o.Text,{className:"text-sm font-medium text-gray-700 mb-2",children:"Add New Alias"}),(0,t.jsxs)("div",{className:"grid grid-cols-3 gap-4",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"block text-xs text-gray-500 mb-1",children:"Alias Name"}),(0,t.jsx)("input",{type:"text",value:j.aliasName,onChange:e=>w({...j,aliasName:e.target.value}),placeholder:"e.g., gpt-4o",className:"w-full px-3 py-2 border border-gray-300 rounded-md text-sm"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"block text-xs text-gray-500 mb-1",children:"Target Model"}),(0,t.jsx)(g.default,{accessToken:e,value:j.targetModel,placeholder:"Select target model",onChange:e=>w({...j,targetModel:e}),showLabel:!1})]}),(0,t.jsx)("div",{className:"flex items-end",children:(0,t.jsxs)("button",{onClick:()=>{if(!j.aliasName||!j.targetModel)return void f.default.fromBackend("Please provide both alias name and target model");if(v.some(e=>e.aliasName===j.aliasName))return void f.default.fromBackend("An alias with this name already exists");let e=[...v,{id:`${Date.now()}-${j.aliasName}`,aliasName:j.aliasName,targetModel:j.targetModel}];_(e),w({aliasName:"",targetModel:""});let t={};e.forEach(e=>{t[e.aliasName]=e.targetModel}),y&&y(t),f.default.success("Alias added successfully")},disabled:!j.aliasName||!j.targetModel,className:`flex items-center px-4 py-2 rounded-md text-sm ${!j.aliasName||!j.targetModel?"bg-gray-300 text-gray-500 cursor-not-allowed":"bg-green-600 text-white hover:bg-green-700"}`,children:[(0,t.jsx)(s.PlusCircleIcon,{className:"w-4 h-4 mr-1"}),"Add Alias"]})})]})]}),(0,t.jsx)(o.Text,{className:"text-sm font-medium text-gray-700 mb-2",children:"Manage Existing Aliases"}),(0,t.jsx)("div",{className:"rounded-lg custom-border relative mb-6",children:(0,t.jsx)("div",{className:"overflow-x-auto",children:(0,t.jsxs)(c.Table,{className:"[&_td]:py-0.5 [&_th]:py-1",children:[(0,t.jsx)(d.TableHead,{children:(0,t.jsxs)(p.TableRow,{children:[(0,t.jsx)(u.TableHeaderCell,{className:"py-1 h-8",children:"Alias Name"}),(0,t.jsx)(u.TableHeaderCell,{className:"py-1 h-8",children:"Target Model"}),(0,t.jsx)(u.TableHeaderCell,{className:"py-1 h-8",children:"Actions"})]})}),(0,t.jsxs)(m.TableBody,{children:[v.map(r=>(0,t.jsx)(p.TableRow,{className:"h-8",children:k&&k.id===r.id?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(h.TableCell,{className:"py-0.5",children:(0,t.jsx)("input",{type:"text",value:k.aliasName,onChange:e=>N({...k,aliasName:e.target.value}),className:"w-full px-2 py-1 border border-gray-300 rounded-md text-sm"})}),(0,t.jsx)(h.TableCell,{className:"py-0.5",children:(0,t.jsx)(g.default,{accessToken:e,value:k.targetModel,onChange:e=>N({...k,targetModel:e}),showLabel:!1,style:{height:"32px"}})}),(0,t.jsx)(h.TableCell,{className:"py-0.5 whitespace-nowrap",children:(0,t.jsxs)("div",{className:"flex space-x-2",children:[(0,t.jsx)("button",{onClick:C,className:"text-xs bg-blue-50 text-blue-600 px-2 py-1 rounded hover:bg-blue-100",children:"Save"}),(0,t.jsx)("button",{onClick:S,className:"text-xs bg-gray-50 text-gray-600 px-2 py-1 rounded hover:bg-gray-100",children:"Cancel"})]})})]}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(h.TableCell,{className:"py-0.5 text-sm text-gray-900",children:r.aliasName}),(0,t.jsx)(h.TableCell,{className:"py-0.5 text-sm text-gray-500",children:r.targetModel}),(0,t.jsx)(h.TableCell,{className:"py-0.5 whitespace-nowrap",children:(0,t.jsxs)("div",{className:"flex space-x-2",children:[(0,t.jsx)("button",{onClick:()=>{N({...r})},className:"text-xs bg-blue-50 text-blue-600 px-2 py-1 rounded hover:bg-blue-100",children:(0,t.jsx)(a.PencilIcon,{className:"w-3 h-3"})}),(0,t.jsx)("button",{onClick:()=>{var e;let t,s;return e=r.id,_(t=v.filter(t=>t.id!==e)),s={},void(t.forEach(e=>{s[e.aliasName]=e.targetModel}),y&&y(s),f.default.success("Alias deleted successfully"))},className:"text-xs bg-red-50 text-red-600 px-2 py-1 rounded hover:bg-red-100",children:(0,t.jsx)(l.TrashIcon,{className:"w-3 h-3"})})]})})]})},r.id)),0===v.length&&(0,t.jsx)(p.TableRow,{children:(0,t.jsx)(h.TableCell,{colSpan:3,className:"py-0.5 text-sm text-gray-500 text-center",children:"No aliases added yet. Add a new alias above."})})]})]})})}),b&&(0,t.jsxs)(i.Card,{children:[(0,t.jsx)(n.Title,{className:"mb-4",children:"Configuration Example"}),(0,t.jsx)(o.Text,{className:"text-gray-600 mb-4",children:"Here's how your current aliases would look in the config:"}),(0,t.jsx)("div",{className:"bg-gray-100 rounded-lg p-4 font-mono text-sm",children:(0,t.jsxs)("div",{className:"text-gray-700",children:["model_aliases:",0===Object.keys(T).length?(0,t.jsxs)("span",{className:"text-gray-500",children:[(0,t.jsx)("br",{}),"  # No aliases configured yet"]}):Object.entries(T).map(([e,r])=>(0,t.jsxs)("span",{children:[(0,t.jsx)("br",{}),'  "',e,'": "',r,'"']},e))]})})]})]})}])},651904,e=>{"use strict";var t=e.i(843476),r=e.i(599724),s=e.i(266484);e.s(["default",0,function({value:e,onChange:a,premiumUser:l=!1,disabledCallbacks:i=[],onDisabledCallbacksChange:n}){return l?(0,t.jsx)(s.default,{value:e,onChange:a,disabledCallbacks:i,onDisabledCallbacksChange:n}):(0,t.jsxs)("div",{children:[(0,t.jsxs)("div",{className:"flex flex-wrap gap-2 mb-3",children:[(0,t.jsx)("div",{className:"inline-flex items-center px-3 py-1.5 rounded-lg bg-green-50 border border-green-200 text-green-800 text-sm font-medium opacity-50",children:"✨ langfuse-logging"}),(0,t.jsx)("div",{className:"inline-flex items-center px-3 py-1.5 rounded-lg bg-green-50 border border-green-200 text-green-800 text-sm font-medium opacity-50",children:"✨ datadog-logging"})]}),(0,t.jsx)("div",{className:"p-3 bg-yellow-50 border border-yellow-200 rounded-lg",children:(0,t.jsxs)(r.Text,{className:"text-sm text-yellow-800",children:["Setting Key/Team logging settings is a LiteLLM Enterprise feature. Global Logging Settings are available for all free users. Get a trial key"," ",(0,t.jsx)("a",{href:"https://www.litellm.ai/#pricing",target:"_blank",rel:"noopener noreferrer",className:"underline",children:"here"}),"."]})})]})}])},460285,e=>{"use strict";var t=e.i(843476),r=e.i(271645),s=e.i(404206),a=e.i(723731),l=e.i(653824),i=e.i(881073),n=e.i(197647),o=e.i(764205),c=e.i(158392),d=e.i(419470),u=e.i(689020);let m=(0,r.forwardRef)(({accessToken:e,value:m,onChange:p,modelData:h},g)=>{let[f,x]=(0,r.useState)({routerSettings:{},selectedStrategy:null,enableTagFiltering:!1}),[y,b]=(0,r.useState)([]),[v,_]=(0,r.useState)([]),[j,w]=(0,r.useState)([]),[k,N]=(0,r.useState)([]),[C,S]=(0,r.useState)({}),[T,E]=(0,r.useState)({}),O=(0,r.useRef)(!1),I=(0,r.useRef)(null);(0,r.useEffect)(()=>{let e=m?.router_settings?JSON.stringify({routing_strategy:m.router_settings.routing_strategy,fallbacks:m.router_settings.fallbacks,enable_tag_filtering:m.router_settings.enable_tag_filtering}):null;if(O.current&&e===I.current){O.current=!1;return}if(O.current&&e!==I.current&&(O.current=!1),e!==I.current)if(I.current=e,m?.router_settings){let e=m.router_settings,{fallbacks:t,...r}=e;x({routerSettings:r,selectedStrategy:e.routing_strategy||null,enableTagFiltering:e.enable_tag_filtering??!1});let s=e.fallbacks||[];b(s),_(s&&0!==s.length?s.map((e,t)=>{let[r,s]=Object.entries(e)[0];return{id:(t+1).toString(),primaryModel:r||null,fallbackModels:s||[]}}):[{id:"1",primaryModel:null,fallbackModels:[]}])}else x({routerSettings:{},selectedStrategy:null,enableTagFiltering:!1}),b([]),_([{id:"1",primaryModel:null,fallbackModels:[]}])},[m]),(0,r.useEffect)(()=>{e&&(0,o.getRouterSettingsCall)(e).then(e=>{if(e.fields){let t={};e.fields.forEach(e=>{t[e.field_name]={ui_field_name:e.ui_field_name,field_description:e.field_description,options:e.options,link:e.link}}),S(t);let r=e.fields.find(e=>"routing_strategy"===e.field_name);r?.options&&N(r.options),e.routing_strategy_descriptions&&E(e.routing_strategy_descriptions)}})},[e]),(0,r.useEffect)(()=>{e&&(async()=>{try{let t=await (0,u.fetchAvailableModels)(e);w(t)}catch(e){console.error("Error fetching model info for fallbacks:",e)}})()},[e]);let M=()=>{let e=new Set(["allowed_fails","cooldown_time","num_retries","timeout","retry_after"]),t=new Set(["model_group_alias","retry_policy"]),r=Object.fromEntries(Object.entries({...f.routerSettings,enable_tag_filtering:f.enableTagFiltering,routing_strategy:f.selectedStrategy,fallbacks:y.length>0?y:null}).map(([r,s])=>{if("routing_strategy_args"!==r&&"routing_strategy"!==r&&"enable_tag_filtering"!==r&&"fallbacks"!==r){let a=document.querySelector(`input[name="${r}"]`);if(a&&void 0!==a.value&&""!==a.value){let l=((r,s,a)=>{if(null==s)return a;let l=String(s).trim();if(""===l||"null"===l.toLowerCase())return null;if(e.has(r)){let e=Number(l);return Number.isNaN(e)?a:e}if(t.has(r)){if(""===l)return null;try{return JSON.parse(l)}catch{return a}}return"true"===l.toLowerCase()||"false"!==l.toLowerCase()&&l})(r,a.value,s);return[r,l]}}else if("routing_strategy"===r)return[r,f.selectedStrategy];else if("enable_tag_filtering"===r)return[r,f.enableTagFiltering];else if("fallbacks"===r)return[r,y.length>0?y:null];else if("routing_strategy_args"===r&&"latency-based-routing"===f.selectedStrategy){let e=document.querySelector('input[name="lowest_latency_buffer"]'),t=document.querySelector('input[name="ttl"]'),r={};return e?.value&&(r.lowest_latency_buffer=Number(e.value)),t?.value&&(r.ttl=Number(t.value)),["routing_strategy_args",Object.keys(r).length>0?r:null]}return[r,s]}).filter(e=>null!=e)),s=(e,t=!1)=>null==e||"object"==typeof e&&!Array.isArray(e)&&0===Object.keys(e).length||t&&("number"!=typeof e||Number.isNaN(e))?null:e;return{routing_strategy:s(r.routing_strategy),allowed_fails:s(r.allowed_fails,!0),cooldown_time:s(r.cooldown_time,!0),num_retries:s(r.num_retries,!0),timeout:s(r.timeout,!0),retry_after:s(r.retry_after,!0),fallbacks:y.length>0?y:null,context_window_fallbacks:s(r.context_window_fallbacks),retry_policy:s(r.retry_policy),model_group_alias:s(r.model_group_alias),enable_tag_filtering:f.enableTagFiltering,routing_strategy_args:s(r.routing_strategy_args)}};(0,r.useEffect)(()=>{if(!p)return;let e=setTimeout(()=>{O.current=!0,p({router_settings:M()})},100);return()=>clearTimeout(e)},[f,y]);let P=Array.from(new Set(j.map(e=>e.model_group))).sort();return((0,r.useImperativeHandle)(g,()=>({getValue:()=>({router_settings:M()})})),e)?(0,t.jsx)("div",{className:"w-full",children:(0,t.jsxs)(l.TabGroup,{className:"w-full",children:[(0,t.jsxs)(i.TabList,{variant:"line",defaultValue:"1",className:"px-8 pt-4",children:[(0,t.jsx)(n.Tab,{value:"1",children:"Loadbalancing"}),(0,t.jsx)(n.Tab,{value:"2",children:"Fallbacks"})]}),(0,t.jsxs)(a.TabPanels,{className:"px-8 py-6",children:[(0,t.jsx)(s.TabPanel,{children:(0,t.jsx)(c.default,{value:f,onChange:x,routerFieldsMetadata:C,availableRoutingStrategies:k,routingStrategyDescriptions:T})}),(0,t.jsx)(s.TabPanel,{children:(0,t.jsx)(d.FallbackSelectionForm,{groups:v,onGroupsChange:e=>{_(e),b(e.filter(e=>e.primaryModel&&e.fallbackModels.length>0).map(e=>({[e.primaryModel]:e.fallbackModels})))},availableModels:P,maxGroups:5})})]})]})}):null});m.displayName="RouterSettingsAccordion",e.s(["default",0,m])},575260,e=>{"use strict";var t=e.i(843476),r=e.i(199133),s=e.i(482725),a=e.i(56456);e.s(["default",0,({projects:e,value:l,onChange:i,disabled:n,loading:o,teamId:c})=>{let d=c?e?.filter(e=>e.team_id===c):e;return(0,t.jsx)(r.Select,{showSearch:!0,placeholder:"Search or select a project",value:l,onChange:i,disabled:n,loading:o,allowClear:!0,notFoundContent:o?(0,t.jsx)(s.Spin,{indicator:(0,t.jsx)(a.LoadingOutlined,{spin:!0}),size:"small"}):void 0,filterOption:(e,t)=>{if(!t)return!1;let r=d?.find(e=>e.project_id===t.key);if(!r)return!1;let s=e.toLowerCase().trim(),a=(r.project_alias||"").toLowerCase(),l=(r.project_id||"").toLowerCase();return a.includes(s)||l.includes(s)},optionFilterProp:"children",children:!o&&d?.map(e=>(0,t.jsxs)(r.Select.Option,{value:e.project_id,children:[(0,t.jsx)("span",{className:"font-medium",children:e.project_alias||e.project_id})," ",(0,t.jsxs)("span",{className:"text-gray-500",children:["(",e.project_id,")"]})]},e.project_id))})}])},702597,364769,e=>{"use strict";var t=e.i(843476),r=e.i(207082),s=e.i(109799),a=e.i(510674),l=e.i(109034),i=e.i(292639),n=e.i(135214),o=e.i(500330),c=e.i(827252),d=e.i(912598),u=e.i(677667),m=e.i(130643),p=e.i(898667),h=e.i(994388),g=e.i(309426),f=e.i(350967),x=e.i(599724),y=e.i(779241),b=e.i(629569),v=e.i(464571),_=e.i(808613),j=e.i(311451),w=e.i(212931),k=e.i(91739),N=e.i(199133),C=e.i(790848),S=e.i(262218),T=e.i(592968),E=e.i(374009),O=e.i(271645),I=e.i(708347),M=e.i(552130),P=e.i(557662),A=e.i(9314),L=e.i(860585),R=e.i(82946),F=e.i(392110),D=e.i(533882),B=e.i(844565),$=e.i(651904),z=e.i(939510),K=e.i(460285),U=e.i(663435),q=e.i(363256),V=e.i(575260),G=e.i(371455),H=e.i(355619),W=e.i(75921),Q=e.i(390605),J=e.i(727749),Y=e.i(764205),X=e.i(237016),Z=e.i(888259);let ee=({apiKey:e})=>{let[r,s]=(0,O.useState)(!1);return(0,t.jsxs)("div",{children:[(0,t.jsxs)("p",{className:"mb-2",children:["Please save this secret key somewhere safe and accessible. For security reasons,"," ",(0,t.jsx)("b",{children:"you will not be able to view it again"})," through your LiteLLM account. If you lose this secret key, you will need to generate a new one."]}),(0,t.jsx)("p",{className:"text-sm text-gray-600 mt-3 mb-1",children:"Virtual Key:"}),(0,t.jsx)("div",{style:{background:"#f8f8f8",padding:"10px",borderRadius:"5px",marginBottom:"10px"},children:(0,t.jsx)("pre",{style:{wordWrap:"break-word",whiteSpace:"normal",margin:0},children:e})}),(0,t.jsx)(X.CopyToClipboard,{text:e,onCopy:()=>{s(!0),Z.default.success("Key copied to clipboard"),setTimeout(()=>s(!1),2e3)},children:(0,t.jsx)(v.Button,{type:"primary",style:{marginTop:12},children:r?"Copied!":"Copy Virtual Key"})})]})};e.s(["default",0,ee],364769);var et=e.i(435451),er=e.i(916940);let{Option:es}=N.Select,ea=async(e,t,r,s)=>{try{if(null===e||null===t)return[];if(null!==r){let a=(await (0,Y.modelAvailableCall)(r,e,t,!0,s,!0)).data.map(e=>e.id);return console.log("available_model_names:",a),a}return[]}catch(e){return console.error("Error fetching user models:",e),[]}},el=async(e,t,r,s)=>{try{if(null===e||null===t)return;if(null!==r){let a=(await (0,Y.modelAvailableCall)(r,e,t)).data.map(e=>e.id);console.log("available_model_names:",a),s(a)}}catch(e){console.error("Error fetching user models:",e)}};e.s(["default",0,({team:e,teams:X,data:Z,addKey:ei,autoOpenCreate:en,prefillData:eo})=>{let{accessToken:ec,userId:ed,userRole:eu,premiumUser:em}=(0,n.default)(),ep=em||null!=eu&&I.rolesWithWriteAccess.includes(eu),{data:eh,isLoading:eg}=(0,s.useOrganizations)(),{data:ef,isLoading:ex}=(0,a.useProjects)(),{data:ey}=(0,i.useUISettings)(),{data:eb}=(0,l.useTags)(),ev=!!ey?.values?.enable_projects_ui,e_=!!ey?.values?.disable_custom_api_keys,ej=eb?Object.values(eb).map(e=>({value:e.name,label:e.name})):[],ew=(0,d.useQueryClient)(),[ek]=_.Form.useForm(),[eN,eC]=(0,O.useState)(!1),[eS,eT]=(0,O.useState)(null),[eE,eO]=(0,O.useState)(null),[eI,eM]=(0,O.useState)([]),[eP,eA]=(0,O.useState)([]),[eL,eR]=(0,O.useState)("you"),[eF,eD]=(0,O.useState)(!1),[eB,e$]=(0,O.useState)(null),[ez,eK]=(0,O.useState)([]),[eU,eq]=(0,O.useState)([]),[eV,eG]=(0,O.useState)([]),[eH,eW]=(0,O.useState)([]),[eQ,eJ]=(0,O.useState)(e),[eY,eX]=(0,O.useState)(null),[eZ,e0]=(0,O.useState)(null),[e1,e2]=(0,O.useState)(!1),[e4,e3]=(0,O.useState)(null),[e6,e5]=(0,O.useState)({}),[e7,e8]=(0,O.useState)([]),[e9,te]=(0,O.useState)(!1),[tt,tr]=(0,O.useState)([]),[ts,ta]=(0,O.useState)([]),[tl,ti]=(0,O.useState)("llm_api"),[tn,to]=(0,O.useState)({}),[tc,td]=(0,O.useState)(!1),[tu,tm]=(0,O.useState)("30d"),[tp,th]=(0,O.useState)(null),[tg,tf]=(0,O.useState)(0),[tx,ty]=(0,O.useState)([]),[tb,tv]=(0,O.useState)(null),t_=()=>{eC(!1),ek.resetFields(),eW([]),ta([]),ti("llm_api"),to({}),td(!1),tm("30d"),th(null),tf(e=>e+1),tv(null),eX(null),e0(null)},tj=()=>{eC(!1),eT(null),eJ(null),ek.resetFields(),eW([]),ta([]),ti("llm_api"),to({}),td(!1),tm("30d"),th(null),tf(e=>e+1),tv(null),eX(null),e0(null)};(0,O.useEffect)(()=>{ed&&eu&&ec&&el(ed,eu,ec,eM)},[ec,ed,eu]),(0,O.useEffect)(()=>{ec&&(0,Y.getAgentsList)(ec).then(e=>ty(e?.agents||[])).catch(()=>ty([]))},[ec]),(0,O.useEffect)(()=>{let e=async()=>{try{let e=(await (0,Y.getPoliciesList)(ec)).policies.map(e=>e.policy_name);eq(e)}catch(e){console.error("Failed to fetch policies:",e)}},t=async()=>{try{let e=await (0,Y.getPromptsList)(ec);eG(e.prompts.map(e=>e.prompt_id))}catch(e){console.error("Failed to fetch prompts:",e)}};(async()=>{try{let e=(await (0,Y.getGuardrailsList)(ec)).guardrails.map(e=>e.guardrail_name);eK(e)}catch(e){console.error("Failed to fetch guardrails:",e)}})(),e(),t()},[ec]),(0,O.useEffect)(()=>{(async()=>{try{if(ec){let e=sessionStorage.getItem("possibleUserRoles");if(e)e5(JSON.parse(e));else{let e=await (0,Y.getPossibleUserRoles)(ec);sessionStorage.setItem("possibleUserRoles",JSON.stringify(e)),e5(e)}}}catch(e){console.error("Error fetching possible user roles:",e)}})()},[ec]),(0,O.useEffect)(()=>{if(en&&!eF&&X&&eu&&I.rolesWithWriteAccess.includes(eu)&&(eC(!0),eD(!0),eo)){if(eo.owned_by&&("another_user"===eo.owned_by&&"Admin"!==eu?eR("you"):eR(eo.owned_by)),eo.team_id){let e=X?.find(e=>e.team_id===eo.team_id)||null;e&&(eJ(e),ek.setFieldsValue({team_id:eo.team_id}))}eo.key_alias&&ek.setFieldsValue({key_alias:eo.key_alias}),eo.models&&eo.models.length>0&&e$(eo.models),eo.key_type&&(ti(eo.key_type),ek.setFieldsValue({key_type:eo.key_type}))}},[en,eo,X,eF,ek,eu]);let tw=eP.includes("no-default-models")&&!eQ,tk=async e=>{try{let t,s=e?.key_alias??"",a=e?.team_id??null;if((Z?.filter(e=>e.team_id===a).map(e=>e.key_alias)??[]).includes(s))throw Error(`Key alias ${s} already exists for team with ID ${a}, please provide another key alias`);if(J.default.info("Making API Call"),eC(!0),"you"===eL)e.user_id=ed;else if("agent"===eL){if(!tb)return void J.default.fromBackend("Please select an agent");e.agent_id=tb}let l={};try{l=JSON.parse(e.metadata||"{}")}catch(e){console.error("Error parsing metadata:",e)}if("service_account"===eL&&(l.service_account_id=e.key_alias),eH.length>0&&(l={...l,logging:eH.filter(e=>e.callback_name)}),ts.length>0){let e=(0,P.mapDisplayToInternalNames)(ts);l={...l,litellm_disabled_callbacks:e}}if(tc&&(e.auto_rotate=!0,e.rotation_interval=tu),e.duration&&""!==e.duration.trim()||(e.duration=null),e.metadata=JSON.stringify(l),e.allowed_vector_store_ids&&e.allowed_vector_store_ids.length>0&&(e.object_permission={vector_stores:e.allowed_vector_store_ids},delete e.allowed_vector_store_ids),e.allowed_mcp_servers_and_groups&&(e.allowed_mcp_servers_and_groups.servers?.length>0||e.allowed_mcp_servers_and_groups.accessGroups?.length>0)){e.object_permission||(e.object_permission={});let{servers:t,accessGroups:r}=e.allowed_mcp_servers_and_groups;t&&t.length>0&&(e.object_permission.mcp_servers=t),r&&r.length>0&&(e.object_permission.mcp_access_groups=r),delete e.allowed_mcp_servers_and_groups}let i=e.mcp_tool_permissions||{};if(Object.keys(i).length>0&&(e.object_permission||(e.object_permission={}),e.object_permission.mcp_tool_permissions=i),delete e.mcp_tool_permissions,e.allowed_mcp_access_groups&&e.allowed_mcp_access_groups.length>0&&(e.object_permission||(e.object_permission={}),e.object_permission.mcp_access_groups=e.allowed_mcp_access_groups,delete e.allowed_mcp_access_groups),e.allowed_agents_and_groups&&(e.allowed_agents_and_groups.agents?.length>0||e.allowed_agents_and_groups.accessGroups?.length>0)){e.object_permission||(e.object_permission={});let{agents:t,accessGroups:r}=e.allowed_agents_and_groups;t&&t.length>0&&(e.object_permission.agents=t),r&&r.length>0&&(e.object_permission.agent_access_groups=r),delete e.allowed_agents_and_groups}Object.keys(tn).length>0&&(e.aliases=JSON.stringify(tn)),tp?.router_settings&&Object.values(tp.router_settings).some(e=>null!=e&&""!==e)&&(e.router_settings=tp.router_settings),t="service_account"===eL?await (0,Y.keyCreateServiceAccountCall)(ec,e):await (0,Y.keyCreateCall)(ec,ed,e),console.log("key create Response:",t),ei(t),ew.invalidateQueries({queryKey:r.keyKeys.lists()}),eT(t.key),eO(t.soft_budget),J.default.success("Virtual Key Created"),ek.resetFields(),localStorage.removeItem("userData"+ed)}catch(t){console.log("error in create key:",t);let e=(e=>{let t;if(!(t=!e||"object"!=typeof e||e instanceof Error?String(e):JSON.stringify(e)).includes("/key/generate")&&!t.includes("KeyManagementRoutes.KEY_GENERATE"))return`Error creating the key: ${e}`;let r=t;try{if(!e||"object"!=typeof e||e instanceof Error){let e=t.match(/\{[\s\S]*\}/);if(e){let t=JSON.parse(e[0]),s=t?.error||t;s?.message&&(r=s.message)}}else{let t=e?.error||e;t?.message&&(r=t.message)}}catch(e){}return t.includes("team_member_permission_error")||r.includes("Team member does not have permissions")?"Team member does not have permission to generate key for this team. Ask your proxy admin to configure the team member permission settings.":`Error creating the key: ${e}`})(t);J.default.fromBackend(e)}};(0,O.useEffect)(()=>{if(eZ){let e=ef?.find(e=>e.project_id===eZ);eA(e?.models??[]),ek.setFieldValue("models",[]);return}ed&&eu&&ec&&ea(ed,eu,ec,eQ?.team_id??null).then(e=>{eA(Array.from(new Set([...eQ?.models??[],...e])))}),eB||ek.setFieldValue("models",[]),ek.setFieldValue("allowed_mcp_servers_and_groups",{servers:[],accessGroups:[]})},[eQ,eZ,ec,ed,eu,ek]),(0,O.useEffect)(()=>{if(!eB||0===eB.length||!eP||0===eP.length)return;let e=eB.filter(e=>eP.includes(e));e.length>0&&ek.setFieldsValue({models:e}),e$(null)},[eB,eP,ek]),(0,O.useEffect)(()=>{if(!eZ||!X)return;let e=ef?.find(e=>e.project_id===eZ);if(!e?.team_id||eQ?.team_id===e.team_id)return;let t=X.find(t=>t.team_id===e.team_id)||null;t&&(eJ(t),ek.setFieldValue("team_id",t.team_id))},[X,eZ,ef]);let tN=async e=>{if(!e)return void e8([]);te(!0);try{let t=new URLSearchParams;if(t.append("user_email",e),null==ec)return;let r=(await (0,Y.userFilterUICall)(ec,t)).map(e=>({label:`${e.user_email} (${e.user_id})`,value:e.user_id,user:e}));e8(r)}catch(e){console.error("Error fetching users:",e),J.default.fromBackend("Failed to search for users")}finally{te(!1)}},tC=(0,O.useCallback)((0,E.default)(e=>tN(e),300),[ec]);return(0,t.jsxs)("div",{children:[eu&&I.rolesWithWriteAccess.includes(eu)&&(0,t.jsx)(h.Button,{className:"mx-auto",onClick:()=>eC(!0),"data-testid":"create-key-button",children:"+ Create New Key"}),(0,t.jsx)(w.Modal,{open:eN,width:1e3,footer:null,onOk:t_,onCancel:tj,children:(0,t.jsxs)(_.Form,{form:ek,onFinish:tk,labelCol:{span:8},wrapperCol:{span:16},labelAlign:"left",children:[(0,t.jsxs)("div",{className:"mb-8",children:[(0,t.jsx)(b.Title,{className:"mb-4",children:"Key Ownership"}),(0,t.jsx)(_.Form.Item,{label:(0,t.jsxs)("span",{children:["Owned By"," ",(0,t.jsx)(T.Tooltip,{title:"Select who will own this Virtual Key",children:(0,t.jsx)(c.InfoCircleOutlined,{style:{marginLeft:"4px"}})})]}),className:"mb-4",children:(0,t.jsxs)(k.Radio.Group,{onChange:e=>eR(e.target.value),value:eL,children:[(0,t.jsx)(k.Radio,{value:"you",children:"You"}),(0,t.jsx)(k.Radio,{value:"service_account",children:"Service Account"}),"Admin"===eu&&(0,t.jsx)(k.Radio,{value:"another_user",children:"Another User"}),(0,t.jsxs)(k.Radio,{value:"agent",children:["Agent ",(0,t.jsx)(S.Tag,{color:"purple",children:"New"})]})]})}),"another_user"===eL&&(0,t.jsx)(_.Form.Item,{label:(0,t.jsxs)("span",{children:["User ID"," ",(0,t.jsx)(T.Tooltip,{title:"The user who will own this key and be responsible for its usage",children:(0,t.jsx)(c.InfoCircleOutlined,{style:{marginLeft:"4px"}})})]}),name:"user_id",className:"mt-4",rules:[{required:"another_user"===eL,message:"Please input the user ID of the user you are assigning the key to"}],children:(0,t.jsxs)("div",{children:[(0,t.jsxs)("div",{style:{display:"flex",marginBottom:"8px"},children:[(0,t.jsx)(N.Select,{showSearch:!0,placeholder:"Type email to search for users",filterOption:!1,onSearch:e=>{tC(e)},onSelect:(e,t)=>{let r;return r=t.user,void ek.setFieldsValue({user_id:r.user_id})},options:e7,loading:e9,allowClear:!0,style:{width:"100%"},notFoundContent:e9?"Searching...":"No users found"}),(0,t.jsx)(v.Button,{onClick:()=>e2(!0),style:{marginLeft:"8px"},children:"Create User"})]}),(0,t.jsx)("div",{className:"text-xs text-gray-500",children:"Search by email to find users"})]})}),"agent"===eL&&(0,t.jsxs)("div",{className:"mt-4 p-4 bg-purple-50 border border-purple-200 rounded-md",children:[(0,t.jsx)("div",{className:"mb-3",children:(0,t.jsxs)("span",{className:"text-sm font-medium text-gray-700",children:["Select Agent ",(0,t.jsx)("span",{className:"text-red-500",children:"*"})]})}),(0,t.jsx)(N.Select,{showSearch:!0,placeholder:"Select an agent",style:{width:"100%"},value:tb,onChange:e=>tv(e),filterOption:(e,t)=>t?.label?.toLowerCase().includes(e.toLowerCase()),options:tx.map(e=>({label:e.agent_name||e.agent_id,value:e.agent_id}))}),(0,t.jsx)("div",{className:"text-xs text-gray-500 mt-2",children:"This key will be used by the selected agent to make requests to LiteLLM"})]}),(0,t.jsx)(_.Form.Item,{label:(0,t.jsxs)("span",{children:["Organization"," ",(0,t.jsx)(T.Tooltip,{title:"The organization this key belongs to. Selecting an organization filters the available teams.",children:(0,t.jsx)(c.InfoCircleOutlined,{style:{marginLeft:"4px"}})})]}),name:"organization_id",className:"mt-4",children:(0,t.jsx)(q.default,{organizations:eh,loading:eg,disabled:"Admin"!==eu,onChange:e=>{eX(e||null),eJ(null),e0(null),ek.setFieldValue("team_id",void 0),ek.setFieldValue("project_id",void 0)}})}),(0,t.jsx)(_.Form.Item,{label:(0,t.jsxs)("span",{children:["Team"," ",(0,t.jsx)(T.Tooltip,{title:"The team this key belongs to, which determines available models and budget limits",children:(0,t.jsx)(c.InfoCircleOutlined,{style:{marginLeft:"4px"}})})]}),name:"team_id",initialValue:e?e.team_id:null,className:"mt-4",rules:[{required:"service_account"===eL,message:"Please select a team for the service account"}],help:"service_account"===eL?"required":"",children:(0,t.jsx)(U.default,{disabled:null!==eZ,organizationId:eY,onTeamSelect:e=>{eJ(e),e0(null),ek.setFieldValue("project_id",void 0),e?.organization_id?(eX(e.organization_id),ek.setFieldValue("organization_id",e.organization_id)):e||(eX(null),ek.setFieldValue("organization_id",void 0))}})}),ev&&(0,t.jsx)(_.Form.Item,{label:(0,t.jsxs)("span",{children:["Project"," ",(0,t.jsx)(T.Tooltip,{title:"Assign this key to a project. Selecting a project will lock the team to the project's team.",children:(0,t.jsx)(c.InfoCircleOutlined,{style:{marginLeft:"4px"}})})]}),name:"project_id",className:"mt-4",children:(0,t.jsx)(V.default,{projects:ef,teamId:eQ?.team_id,loading:ex||!X,onChange:e=>{if(!e){e0(null),eJ(null),ek.setFieldValue("team_id",void 0);return}e0(e)}})})]}),tw&&(0,t.jsx)("div",{className:"mb-8 p-4 bg-blue-50 border border-blue-200 rounded-md",children:(0,t.jsx)(x.Text,{className:"text-blue-800 text-sm",children:"Please select a team to continue configuring your Virtual Key. If you do not see any teams, please contact your Proxy Admin to either provide you with access to models or to add you to a team."})}),!tw&&(0,t.jsxs)("div",{className:"mb-8",children:[(0,t.jsx)(b.Title,{className:"mb-4",children:"Key Details"}),(0,t.jsx)(_.Form.Item,{label:(0,t.jsxs)("span",{children:["you"===eL||"another_user"===eL?"Key Name":"Service Account ID"," ",(0,t.jsx)(T.Tooltip,{title:"you"===eL||"another_user"===eL?"A descriptive name to identify this key":"Unique identifier for this service account",children:(0,t.jsx)(c.InfoCircleOutlined,{style:{marginLeft:"4px"}})})]}),name:"key_alias",rules:[{required:!0,message:`Please input a ${"you"===eL?"key name":"service account ID"}`}],help:"required",children:(0,t.jsx)(y.TextInput,{placeholder:""})}),(0,t.jsx)(_.Form.Item,{label:(0,t.jsxs)("span",{children:["Models"," ",(0,t.jsx)(T.Tooltip,{title:"Select which models this key can access. Choose 'All Team Models' to grant access to all models available to the team. Leave empty to allow access to all models.",children:(0,t.jsx)(c.InfoCircleOutlined,{style:{marginLeft:"4px"}})})]}),name:"models",rules:[],help:"management"===tl||"read_only"===tl?"Models field is disabled for this key type":"optional - leave empty to allow access to all models",className:"mt-4",children:(0,t.jsxs)(N.Select,{mode:"multiple",placeholder:"Select models",style:{width:"100%"},disabled:"management"===tl||"read_only"===tl,onChange:e=>{e.includes("all-team-models")&&ek.setFieldsValue({models:["all-team-models"]})},children:[!eZ&&(0,t.jsx)(es,{value:"all-team-models",children:"All Team Models"},"all-team-models"),eP.map(e=>(0,t.jsx)(es,{value:e,children:(0,H.getModelDisplayName)(e)},e))]})}),(0,t.jsx)(_.Form.Item,{label:(0,t.jsxs)("span",{children:["Key Type"," ",(0,t.jsx)(T.Tooltip,{title:"Select the type of key to determine what routes and operations this key can access",children:(0,t.jsx)(c.InfoCircleOutlined,{style:{marginLeft:"4px"}})})]}),name:"key_type",initialValue:"llm_api",className:"mt-4",children:(0,t.jsxs)(N.Select,{defaultValue:"llm_api",placeholder:"Select key type",style:{width:"100%"},optionLabelProp:"label",onChange:e=>{ti(e),("management"===e||"read_only"===e)&&ek.setFieldsValue({models:[]})},children:[(0,t.jsx)(es,{value:"default",label:"Default",children:(0,t.jsxs)("div",{style:{padding:"4px 0"},children:[(0,t.jsx)("div",{style:{fontWeight:500},children:"Default"}),(0,t.jsx)("div",{style:{fontSize:"11px",color:"#6b7280",marginTop:"2px"},children:"Can call AI APIs + Management routes"})]})}),(0,t.jsx)(es,{value:"llm_api",label:"AI APIs",children:(0,t.jsxs)("div",{style:{padding:"4px 0"},children:[(0,t.jsx)("div",{style:{fontWeight:500},children:"AI APIs"}),(0,t.jsx)("div",{style:{fontSize:"11px",color:"#6b7280",marginTop:"2px"},children:"Can call only AI API routes (chat/completions, embeddings, etc.)"})]})}),(0,t.jsx)(es,{value:"management",label:"Management",children:(0,t.jsxs)("div",{style:{padding:"4px 0"},children:[(0,t.jsx)("div",{style:{fontWeight:500},children:"Management"}),(0,t.jsx)("div",{style:{fontSize:"11px",color:"#6b7280",marginTop:"2px"},children:"Can call only management routes (user/team/key management)"})]})})]})})]}),!tw&&(0,t.jsx)("div",{className:"mb-8",children:(0,t.jsxs)(u.Accordion,{className:"mt-4 mb-4",children:[(0,t.jsx)(p.AccordionHeader,{children:(0,t.jsx)(b.Title,{className:"m-0",children:"Optional Settings"})}),(0,t.jsxs)(m.AccordionBody,{children:[(0,t.jsx)(_.Form.Item,{className:"mt-4",label:(0,t.jsxs)("span",{children:["Max Budget (USD)"," ",(0,t.jsx)(T.Tooltip,{title:"Maximum amount in USD this key can spend. When reached, the key will be blocked from making further requests",children:(0,t.jsx)(c.InfoCircleOutlined,{style:{marginLeft:"4px"}})})]}),name:"max_budget",help:`Budget cannot exceed team max budget: $${e?.max_budget!==null&&e?.max_budget!==void 0?e?.max_budget:"unlimited"}`,rules:[{validator:async(t,r)=>{if(r&&e&&null!==e.max_budget&&r>e.max_budget)throw Error(`Budget cannot exceed team max budget: $${(0,o.formatNumberWithCommas)(e.max_budget,4)}`)}}],children:(0,t.jsx)(et.default,{step:.01,precision:2,width:200})}),(0,t.jsx)(_.Form.Item,{className:"mt-4",label:(0,t.jsxs)("span",{children:["Reset Budget"," ",(0,t.jsx)(T.Tooltip,{title:"How often the budget should reset. For example, setting 'daily' will reset the budget every 24 hours",children:(0,t.jsx)(c.InfoCircleOutlined,{style:{marginLeft:"4px"}})})]}),name:"budget_duration",help:`Team Reset Budget: ${e?.budget_duration!==null&&e?.budget_duration!==void 0?e?.budget_duration:"None"}`,children:(0,t.jsx)(L.default,{onChange:e=>ek.setFieldValue("budget_duration",e)})}),(0,t.jsx)(_.Form.Item,{className:"mt-4",label:(0,t.jsxs)("span",{children:["Tokens per minute Limit (TPM)"," ",(0,t.jsx)(T.Tooltip,{title:"Maximum number of tokens this key can process per minute. Helps control usage and costs",children:(0,t.jsx)(c.InfoCircleOutlined,{style:{marginLeft:"4px"}})})]}),name:"tpm_limit",help:`TPM cannot exceed team TPM limit: ${e?.tpm_limit!==null&&e?.tpm_limit!==void 0?e?.tpm_limit:"unlimited"}`,rules:[{validator:async(t,r)=>{if(r&&e&&null!==e.tpm_limit&&r>e.tpm_limit)throw Error(`TPM limit cannot exceed team TPM limit: ${e.tpm_limit}`)}}],children:(0,t.jsx)(et.default,{step:1,width:400})}),(0,t.jsx)(z.default,{type:"tpm",name:"tpm_limit_type",className:"mt-4",initialValue:null,form:ek,showDetailedDescriptions:!0}),(0,t.jsx)(_.Form.Item,{className:"mt-4",label:(0,t.jsxs)("span",{children:["Requests per minute Limit (RPM)"," ",(0,t.jsx)(T.Tooltip,{title:"Maximum number of API requests this key can make per minute. Helps prevent abuse and manage load",children:(0,t.jsx)(c.InfoCircleOutlined,{style:{marginLeft:"4px"}})})]}),name:"rpm_limit",help:`RPM cannot exceed team RPM limit: ${e?.rpm_limit!==null&&e?.rpm_limit!==void 0?e?.rpm_limit:"unlimited"}`,rules:[{validator:async(t,r)=>{if(r&&e&&null!==e.rpm_limit&&r>e.rpm_limit)throw Error(`RPM limit cannot exceed team RPM limit: ${e.rpm_limit}`)}}],children:(0,t.jsx)(et.default,{step:1,width:400})}),(0,t.jsx)(z.default,{type:"rpm",name:"rpm_limit_type",className:"mt-4",initialValue:null,form:ek,showDetailedDescriptions:!0}),(0,t.jsx)(_.Form.Item,{label:(0,t.jsxs)("span",{children:["Guardrails"," ",(0,t.jsx)(T.Tooltip,{title:"Apply safety guardrails to this key to filter content or enforce policies",children:(0,t.jsx)("a",{href:"https://docs.litellm.ai/docs/proxy/guardrails/quick_start",target:"_blank",rel:"noopener noreferrer",onClick:e=>e.stopPropagation(),children:(0,t.jsx)(c.InfoCircleOutlined,{style:{marginLeft:"4px"}})})})]}),name:"guardrails",className:"mt-4",help:ep?"Select existing guardrails or enter new ones":"Premium feature - Upgrade to set guardrails by key",children:(0,t.jsx)(N.Select,{mode:"tags",style:{width:"100%"},disabled:!ep,placeholder:ep?"Select or enter guardrails":"Premium feature - Upgrade to set guardrails by key",options:ez.map(e=>({value:e,label:e}))})}),(0,t.jsx)(_.Form.Item,{label:(0,t.jsxs)("span",{children:["Disable Global Guardrails"," ",(0,t.jsx)(T.Tooltip,{title:"When enabled, this key will bypass any guardrails configured to run on every request (global guardrails)",children:(0,t.jsx)("a",{href:"https://docs.litellm.ai/docs/proxy/guardrails/quick_start",target:"_blank",rel:"noopener noreferrer",onClick:e=>e.stopPropagation(),children:(0,t.jsx)(c.InfoCircleOutlined,{style:{marginLeft:"4px"}})})})]}),name:"disable_global_guardrails",className:"mt-4",valuePropName:"checked",help:ep?"Bypass global guardrails for this key":"Premium feature - Upgrade to disable global guardrails by key",children:(0,t.jsx)(C.Switch,{disabled:!ep,checkedChildren:"Yes",unCheckedChildren:"No"})}),(0,t.jsx)(_.Form.Item,{label:(0,t.jsxs)("span",{children:["Policies"," ",(0,t.jsx)(T.Tooltip,{title:"Apply policies to this key to control guardrails and other settings",children:(0,t.jsx)("a",{href:"https://docs.litellm.ai/docs/proxy/guardrails/guardrail_policies",target:"_blank",rel:"noopener noreferrer",onClick:e=>e.stopPropagation(),children:(0,t.jsx)(c.InfoCircleOutlined,{style:{marginLeft:"4px"}})})})]}),name:"policies",className:"mt-4",help:em?"Select existing policies or enter new ones":"Premium feature - Upgrade to set policies by key",children:(0,t.jsx)(N.Select,{mode:"tags",style:{width:"100%"},disabled:!em,placeholder:em?"Select or enter policies":"Premium feature - Upgrade to set policies by key",options:eU.map(e=>({value:e,label:e}))})}),(0,t.jsx)(_.Form.Item,{label:(0,t.jsxs)("span",{children:["Prompts"," ",(0,t.jsx)(T.Tooltip,{title:"Allow this key to use specific prompt templates",children:(0,t.jsx)("a",{href:"https://docs.litellm.ai/docs/proxy/prompt_management",target:"_blank",rel:"noopener noreferrer",onClick:e=>e.stopPropagation(),children:(0,t.jsx)(c.InfoCircleOutlined,{style:{marginLeft:"4px"}})})})]}),name:"prompts",className:"mt-4",help:em?"Select existing prompts or enter new ones":"Premium feature - Upgrade to set prompts by key",children:(0,t.jsx)(N.Select,{mode:"tags",style:{width:"100%"},disabled:!em,placeholder:em?"Select or enter prompts":"Premium feature - Upgrade to set prompts by key",options:eV.map(e=>({value:e,label:e}))})}),(0,t.jsx)(_.Form.Item,{label:(0,t.jsxs)("span",{children:["Access Groups"," ",(0,t.jsx)(T.Tooltip,{title:"Assign access groups to this key. Access groups control which models, MCP servers, and agents this key can use",children:(0,t.jsx)(c.InfoCircleOutlined,{style:{marginLeft:"4px"}})})]}),name:"access_group_ids",className:"mt-4",help:"Select access groups to assign to this key",children:(0,t.jsx)(A.default,{placeholder:"Select access groups (optional)"})}),(0,t.jsx)(_.Form.Item,{label:(0,t.jsxs)("span",{children:["Allowed Pass Through Routes"," ",(0,t.jsx)(T.Tooltip,{title:"Allow this key to use specific pass through routes",children:(0,t.jsx)("a",{href:"https://docs.litellm.ai/docs/proxy/pass_through",target:"_blank",rel:"noopener noreferrer",onClick:e=>e.stopPropagation(),children:(0,t.jsx)(c.InfoCircleOutlined,{style:{marginLeft:"4px"}})})})]}),name:"allowed_passthrough_routes",className:"mt-4",help:em?"Select existing pass through routes or enter new ones":"Premium feature - Upgrade to set pass through routes by key",children:(0,t.jsx)(B.default,{onChange:e=>ek.setFieldValue("allowed_passthrough_routes",e),value:ek.getFieldValue("allowed_passthrough_routes"),accessToken:ec,placeholder:em?"Select or enter pass through routes":"Premium feature - Upgrade to set pass through routes by key",disabled:!em,teamId:eQ?eQ.team_id:null})}),(0,t.jsx)(_.Form.Item,{label:(0,t.jsxs)("span",{children:["Allowed Vector Stores"," ",(0,t.jsx)(T.Tooltip,{title:"Select which vector stores this key can access. If none selected, the key will have access to all available vector stores",children:(0,t.jsx)(c.InfoCircleOutlined,{style:{marginLeft:"4px"}})})]}),name:"allowed_vector_store_ids",className:"mt-4",help:"Select vector stores this key can access. Leave empty for access to all vector stores",children:(0,t.jsx)(er.default,{onChange:e=>ek.setFieldValue("allowed_vector_store_ids",e),value:ek.getFieldValue("allowed_vector_store_ids"),accessToken:ec,placeholder:"Select vector stores (optional)"})}),(0,t.jsx)(_.Form.Item,{label:(0,t.jsxs)("span",{children:["Metadata"," ",(0,t.jsx)(T.Tooltip,{title:"JSON object with additional information about this key. Used for tracking or custom logic",children:(0,t.jsx)(c.InfoCircleOutlined,{style:{marginLeft:"4px"}})})]}),name:"metadata",className:"mt-4",children:(0,t.jsx)(j.Input.TextArea,{rows:4,placeholder:"Enter metadata as JSON"})}),(0,t.jsx)(_.Form.Item,{label:(0,t.jsxs)("span",{children:["Tags"," ",(0,t.jsx)(T.Tooltip,{title:"Tags for tracking spend and/or doing tag-based routing. Used for analytics and filtering",children:(0,t.jsx)(c.InfoCircleOutlined,{style:{marginLeft:"4px"}})})]}),name:"tags",className:"mt-4",help:"Tags for tracking spend and/or doing tag-based routing.",children:(0,t.jsx)(N.Select,{mode:"tags",style:{width:"100%"},placeholder:"Select or enter tags",tokenSeparators:[","],options:ej})}),(0,t.jsxs)(u.Accordion,{className:"mt-4 mb-4",children:[(0,t.jsx)(p.AccordionHeader,{children:(0,t.jsx)("b",{children:"MCP Settings"})}),(0,t.jsxs)(m.AccordionBody,{children:[(0,t.jsx)(_.Form.Item,{label:(0,t.jsxs)("span",{children:["Allowed MCP Servers"," ",(0,t.jsx)(T.Tooltip,{title:"Select which MCP servers or access groups this key can access",children:(0,t.jsx)(c.InfoCircleOutlined,{style:{marginLeft:"4px"}})})]}),name:"allowed_mcp_servers_and_groups",help:"Select MCP servers or access groups this key can access",children:(0,t.jsx)(W.default,{onChange:e=>ek.setFieldValue("allowed_mcp_servers_and_groups",e),value:ek.getFieldValue("allowed_mcp_servers_and_groups"),accessToken:ec,teamId:eQ?.team_id??null,placeholder:"Select MCP servers or access groups (optional)"})}),(0,t.jsx)(_.Form.Item,{name:"mcp_tool_permissions",initialValue:{},hidden:!0,children:(0,t.jsx)(j.Input,{type:"hidden"})}),(0,t.jsx)(_.Form.Item,{noStyle:!0,shouldUpdate:(e,t)=>e.allowed_mcp_servers_and_groups!==t.allowed_mcp_servers_and_groups||e.mcp_tool_permissions!==t.mcp_tool_permissions,children:()=>(0,t.jsx)("div",{className:"mt-6",children:(0,t.jsx)(Q.default,{accessToken:ec,selectedServers:ek.getFieldValue("allowed_mcp_servers_and_groups")?.servers||[],toolPermissions:ek.getFieldValue("mcp_tool_permissions")||{},onChange:e=>ek.setFieldsValue({mcp_tool_permissions:e})})})})]})]}),(0,t.jsxs)(u.Accordion,{className:"mt-4 mb-4",children:[(0,t.jsx)(p.AccordionHeader,{children:(0,t.jsx)("b",{children:"Agent Settings"})}),(0,t.jsx)(m.AccordionBody,{children:(0,t.jsx)(_.Form.Item,{label:(0,t.jsxs)("span",{children:["Allowed Agents"," ",(0,t.jsx)(T.Tooltip,{title:"Select which agents or access groups this key can access",children:(0,t.jsx)(c.InfoCircleOutlined,{style:{marginLeft:"4px"}})})]}),name:"allowed_agents_and_groups",help:"Select agents or access groups this key can access",children:(0,t.jsx)(M.default,{onChange:e=>ek.setFieldValue("allowed_agents_and_groups",e),value:ek.getFieldValue("allowed_agents_and_groups"),accessToken:ec,placeholder:"Select agents or access groups (optional)"})})})]}),em?(0,t.jsxs)(u.Accordion,{className:"mt-4 mb-4",children:[(0,t.jsx)(p.AccordionHeader,{children:(0,t.jsx)("b",{children:"Logging Settings"})}),(0,t.jsx)(m.AccordionBody,{children:(0,t.jsx)("div",{className:"mt-4",children:(0,t.jsx)($.default,{value:eH,onChange:eW,premiumUser:!0,disabledCallbacks:ts,onDisabledCallbacksChange:ta})})})]}):(0,t.jsx)(T.Tooltip,{title:(0,t.jsxs)("span",{children:["Key-level logging settings is an enterprise feature, get in touch -",(0,t.jsx)("a",{href:"https://www.litellm.ai/enterprise",target:"_blank",children:"https://www.litellm.ai/enterprise"})]}),placement:"top",children:(0,t.jsxs)("div",{style:{position:"relative"},children:[(0,t.jsx)("div",{style:{opacity:.5},children:(0,t.jsxs)(u.Accordion,{className:"mt-4 mb-4",children:[(0,t.jsx)(p.AccordionHeader,{children:(0,t.jsx)("b",{children:"Logging Settings"})}),(0,t.jsx)(m.AccordionBody,{children:(0,t.jsx)("div",{className:"mt-4",children:(0,t.jsx)($.default,{value:eH,onChange:eW,premiumUser:!1,disabledCallbacks:ts,onDisabledCallbacksChange:ta})})})]})}),(0,t.jsx)("div",{style:{position:"absolute",inset:0,cursor:"not-allowed"}})]})}),(0,t.jsxs)(u.Accordion,{className:"mt-4 mb-4",children:[(0,t.jsx)(p.AccordionHeader,{children:(0,t.jsx)("b",{children:"Router Settings"})}),(0,t.jsx)(m.AccordionBody,{children:(0,t.jsx)("div",{className:"mt-4 w-full",children:(0,t.jsx)(K.default,{accessToken:ec||"",value:tp||void 0,onChange:th,modelData:eI.length>0?{data:eI.map(e=>({model_name:e}))}:void 0},tg)})})]},`router-settings-accordion-${tg}`),(0,t.jsxs)(u.Accordion,{className:"mt-4 mb-4",children:[(0,t.jsx)(p.AccordionHeader,{children:(0,t.jsx)("b",{children:"Model Aliases"})}),(0,t.jsx)(m.AccordionBody,{children:(0,t.jsxs)("div",{className:"mt-4",children:[(0,t.jsx)(x.Text,{className:"text-sm text-gray-600 mb-4",children:"Create custom aliases for models that can be used in API calls. This allows you to create shortcuts for specific models."}),(0,t.jsx)(D.default,{accessToken:ec,initialModelAliases:tn,onAliasUpdate:to,showExampleConfig:!1})]})})]}),(0,t.jsxs)(u.Accordion,{className:"mt-4 mb-4",children:[(0,t.jsx)(p.AccordionHeader,{children:(0,t.jsx)("b",{children:"Key Lifecycle"})}),(0,t.jsx)(m.AccordionBody,{children:(0,t.jsx)("div",{className:"mt-4",children:(0,t.jsx)(F.default,{form:ek,autoRotationEnabled:tc,onAutoRotationChange:td,rotationInterval:tu,onRotationIntervalChange:tm,isCreateMode:!0})})}),(0,t.jsx)(_.Form.Item,{name:"duration",hidden:!0,initialValue:null,children:(0,t.jsx)(j.Input,{})})]}),(0,t.jsxs)(u.Accordion,{className:"mt-4 mb-4",children:[(0,t.jsx)(p.AccordionHeader,{children:(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("b",{children:"Advanced Settings"}),(0,t.jsx)(T.Tooltip,{title:(0,t.jsxs)("span",{children:["Learn more about advanced settings in our"," ",(0,t.jsx)("a",{href:Y.proxyBaseUrl?`${Y.proxyBaseUrl}/#/key%20management/generate_key_fn_key_generate_post`:"/#/key%20management/generate_key_fn_key_generate_post",target:"_blank",rel:"noopener noreferrer",className:"text-blue-400 hover:text-blue-300",children:"documentation"})]}),children:(0,t.jsx)(c.InfoCircleOutlined,{className:"text-gray-400 hover:text-gray-300 cursor-help"})})]})}),(0,t.jsx)(m.AccordionBody,{children:(0,t.jsx)(R.default,{schemaComponent:"GenerateKeyRequest",form:ek,excludedFields:["key_alias","team_id","organization_id","models","duration","metadata","tags","guardrails","max_budget","budget_duration","tpm_limit","rpm_limit",...e_?["key"]:[]]})})]})]})]})}),(0,t.jsx)("div",{style:{textAlign:"right",marginTop:"10px"},children:(0,t.jsx)(v.Button,{htmlType:"submit",disabled:tw,style:{opacity:tw?.5:1},children:"Create Key"})})]})}),e1&&(0,t.jsx)(w.Modal,{title:"Create New User",open:e1,onCancel:()=>e2(!1),footer:null,width:800,children:(0,t.jsx)(G.CreateUserButton,{userID:ed,accessToken:ec,teams:X,possibleUIRoles:e6,onUserCreated:e=>{e3(e),ek.setFieldsValue({user_id:e}),e2(!1)},isEmbedded:!0})}),eS&&(0,t.jsx)(w.Modal,{open:eN,onOk:t_,onCancel:tj,footer:null,children:(0,t.jsxs)(f.Grid,{numItems:1,className:"gap-2 w-full",children:[(0,t.jsx)(b.Title,{children:"Save your Key"}),(0,t.jsx)(g.Col,{numColSpan:1,children:null!=eS?(0,t.jsx)(ee,{apiKey:eS}):(0,t.jsx)(x.Text,{children:"Key being created, this might take 30s"})})]})})]})},"fetchTeamModels",0,ea,"fetchUserModels",0,el],702597)}]); \ No newline at end of file diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/1973a4cee645cb66.js b/litellm/proxy/_experimental/out/_next/static/chunks/1973a4cee645cb66.js new file mode 100644 index 0000000000..0ea6d7014d --- /dev/null +++ b/litellm/proxy/_experimental/out/_next/static/chunks/1973a4cee645cb66.js @@ -0,0 +1 @@ +(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,309426,e=>{"use strict";var t=e.i(290571),r=e.i(444755),n=e.i(673706),i=e.i(271645),s=e.i(46757);let a=(0,n.makeClassName)("Col"),o=i.default.forwardRef((e,n)=>{let o,l,d,c,{numColSpan:u=1,numColSpanSm:h,numColSpanMd:f,numColSpanLg:p,children:m,className:g}=e,y=(0,t.__rest)(e,["numColSpan","numColSpanSm","numColSpanMd","numColSpanLg","children","className"]),b=(e,t)=>e&&Object.keys(t).includes(String(e))?t[e]:"";return i.default.createElement("div",Object.assign({ref:n,className:(0,r.tremorTwMerge)(a("root"),(o=b(u,s.colSpan),l=b(h,s.colSpanSm),d=b(f,s.colSpanMd),c=b(p,s.colSpanLg),(0,r.tremorTwMerge)(o,l,d,c)),g)},y),m)});o.displayName="Col",e.s(["Col",()=>o],309426)},519756,e=>{"use strict";e.i(247167);var t=e.i(931067),r=e.i(271645);let n={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M400 317.7h73.9V656c0 4.4 3.6 8 8 8h60c4.4 0 8-3.6 8-8V317.7H624c6.7 0 10.4-7.7 6.3-12.9L518.3 163a8 8 0 00-12.6 0l-112 141.7c-4.1 5.3-.4 13 6.3 13zM878 626h-60c-4.4 0-8 3.6-8 8v154H214V634c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8v198c0 17.7 14.3 32 32 32h684c17.7 0 32-14.3 32-32V634c0-4.4-3.6-8-8-8z"}}]},name:"upload",theme:"outlined"};var i=e.i(9583),s=r.forwardRef(function(e,s){return r.createElement(i.default,(0,t.default)({},e,{ref:s,icon:n}))});e.s(["UploadOutlined",0,s],519756)},981339,e=>{"use strict";var t=e.i(185793);e.s(["Skeleton",()=>t.default])},500330,e=>{"use strict";var t=e.i(727749);function r(e,t){let r=structuredClone(e);for(let[e,n]of Object.entries(t))e in r&&(r[e]=n);return r}let n=(e,t=0,r=!1,n=!0)=>{if(null==e||!Number.isFinite(e)||0===e&&!n)return"-";let i={minimumFractionDigits:t,maximumFractionDigits:t};if(!r)return e.toLocaleString("en-US",i);let s=e<0?"-":"",a=Math.abs(e),o=a,l="";return a>=1e6?(o=a/1e6,l="M"):a>=1e3&&(o=a/1e3,l="K"),`${s}${o.toLocaleString("en-US",i)}${l}`},i=async(e,r="Copied to clipboard")=>{if(!e)return!1;if(!navigator||!navigator.clipboard||!navigator.clipboard.writeText)return s(e,r);try{return await navigator.clipboard.writeText(e),t.default.success(r),!0}catch(t){return console.error("Clipboard API failed: ",t),s(e,r)}},s=(e,r)=>{try{let n=document.createElement("textarea");n.value=e,n.style.position="fixed",n.style.left="-999999px",n.style.top="-999999px",n.setAttribute("readonly",""),document.body.appendChild(n),n.focus(),n.select();let i=document.execCommand("copy");if(document.body.removeChild(n),i)return t.default.success(r),!0;throw Error("execCommand failed")}catch(e){return t.default.fromBackend("Failed to copy to clipboard"),console.error("Failed to copy: ",e),!1}};e.s(["copyToClipboard",0,i,"formatNumberWithCommas",0,n,"getSpendString",0,(e,t=6)=>{if(null==e||!Number.isFinite(e)||0===e)return"-";let r=n(e,t,!1,!1);if(0===Number(r.replace(/,/g,""))){let e=(1/10**t).toFixed(t);return`< $${e}`}return`$${r}`},"updateExistingKeys",()=>r])},663435,152473,e=>{"use strict";var t=e.i(843476),r=e.i(271645),n=e.i(199133),i=e.i(898586),s=e.i(56456);let a={enabled:!0,leading:!1,trailing:!0,wait:0,onExecute:()=>{}};class o{constructor(e,t){this.fn=e,this._canLeadingExecute=!0,this._isPending=!1,this._executionCount=0,this._options={...a,...t}}setOptions(e){return this._options={...this._options,...e},this._options.enabled||(this._isPending=!1),this._options}getOptions(){return this._options}maybeExecute(...e){this._options.leading&&this._canLeadingExecute&&(this.executeFunction(...e),this._canLeadingExecute=!1),(this._options.leading||this._options.trailing)&&(this._isPending=!0),this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=setTimeout(()=>{this._canLeadingExecute=!0,this._isPending=!1,this._options.trailing&&this.executeFunction(...e)},this._options.wait)}executeFunction(...e){this._options.enabled&&(this.fn(...e),this._executionCount++,this._options.onExecute(this))}cancel(){this._timeoutId&&(clearTimeout(this._timeoutId),this._canLeadingExecute=!0,this._isPending=!1)}getExecutionCount(){return this._executionCount}getIsPending(){return this._options.enabled&&this._isPending}}function l(e,t){let[n,i]=(0,r.useState)(e),s=function(e,t){let[n]=(0,r.useState)(()=>{var r;return Object.getOwnPropertyNames(Object.getPrototypeOf(r=new o(e,t))).filter(e=>"function"==typeof r[e]).reduce((e,t)=>{let n=r[t];return"function"==typeof n&&(e[t]=n.bind(r)),e},{})});return n.setOptions(t),n}(i,t);return[n,s.maybeExecute,s]}e.s(["useDebouncedState",()=>l],152473);var d=e.i(785242);let{Text:c}=i.Typography;e.s(["default",0,({value:e,onChange:i,onTeamSelect:a,disabled:o,organizationId:u,pageSize:h=20})=>{let[f,p]=(0,r.useState)(""),[m,g]=l("",{wait:300}),{data:y,fetchNextPage:b,hasNextPage:x,isFetchingNextPage:v,isLoading:_}=(0,d.useInfiniteTeams)(h,m||void 0,u),k=(0,r.useMemo)(()=>{if(!y?.pages)return[];let e=new Set,t=[];for(let r of y.pages)for(let n of r.teams)e.has(n.team_id)||(e.add(n.team_id),t.push(n));return t},[y]);return(0,t.jsx)(n.Select,{showSearch:!0,placeholder:"Search or select a team",value:e||void 0,onChange:e=>{i?.(e??""),a&&a(e?k.find(t=>t.team_id===e)??null:null)},disabled:o,allowClear:!0,filterOption:!1,onSearch:e=>{p(e),g(e)},searchValue:f,onPopupScroll:e=>{let t=e.currentTarget;(t.scrollTop+t.clientHeight)/t.scrollHeight>=.8&&x&&!v&&b()},loading:_,notFoundContent:_?(0,t.jsx)(s.LoadingOutlined,{spin:!0}):"No teams found","data-testid":"team-dropdown",popupRender:e=>(0,t.jsxs)(t.Fragment,{children:[e,v&&(0,t.jsx)("div",{style:{textAlign:"center",padding:8},children:(0,t.jsx)(s.LoadingOutlined,{spin:!0})})]}),children:k.map(e=>(0,t.jsxs)(n.Select.Option,{value:e.team_id,children:[(0,t.jsx)("span",{className:"font-medium",children:e.team_alias})," ",(0,t.jsxs)(c,{type:"secondary",children:["(",e.team_id,")"]})]},e.team_id))})}],663435)},743151,(e,t,r)=>{"use strict";function n(e){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}Object.defineProperty(r,"__esModule",{value:!0}),r.CopyToClipboard=void 0;var i=o(e.r(271645)),s=o(e.r(844343)),a=["text","onCopy","options","children"];function o(e){return e&&e.__esModule?e:{default:e}}function l(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function d(e){for(var t=1;t=0||(i[r]=e[r]);return i}(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(n=0;n=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(i[r]=e[r])}return i}(e,a),n=i.default.Children.only(t);return i.default.cloneElement(n,d(d({},r),{},{onClick:this.onClick}))}}],function(e,t){for(var r=0;r{"use strict";var n=e.r(743151).CopyToClipboard;n.CopyToClipboard=n,t.exports=n},59935,(e,t,r)=>{var n;let i;e.e,n=function e(){var t,r="u">typeof self?self:"u">typeof window?window:void 0!==r?r:{},n=!r.document&&!!r.postMessage,i=r.IS_PAPA_WORKER||!1,s={},a=0,o={};function l(e){this._handle=null,this._finished=!1,this._completed=!1,this._halted=!1,this._input=null,this._baseIndex=0,this._partialLine="",this._rowCount=0,this._start=0,this._nextChunk=null,this.isFirstChunk=!0,this._completeResults={data:[],errors:[],meta:{}},(function(e){var t=x(e);t.chunkSize=parseInt(t.chunkSize),e.step||e.chunk||(t.chunkSize=null),this._handle=new f(t),(this._handle.streamer=this)._config=t}).call(this,e),this.parseChunk=function(e,t){var n=parseInt(this._config.skipFirstNLines)||0;if(this.isFirstChunk&&0=this._config.preview,i)r.postMessage({results:s,workerId:o.WORKER_ID,finished:n});else if(_(this._config.chunk)&&!t){if(this._config.chunk(s,this._handle),this._handle.paused()||this._handle.aborted())return void(this._halted=!0);this._completeResults=s=void 0}return this._config.step||this._config.chunk||(this._completeResults.data=this._completeResults.data.concat(s.data),this._completeResults.errors=this._completeResults.errors.concat(s.errors),this._completeResults.meta=s.meta),this._completed||!n||!_(this._config.complete)||s&&s.meta.aborted||(this._config.complete(this._completeResults,this._input),this._completed=!0),n||s&&s.meta.paused||this._nextChunk(),s}this._halted=!0},this._sendError=function(e){_(this._config.error)?this._config.error(e):i&&this._config.error&&r.postMessage({workerId:o.WORKER_ID,error:e,finished:!1})}}function d(e){var t;(e=e||{}).chunkSize||(e.chunkSize=o.RemoteChunkSize),l.call(this,e),this._nextChunk=n?function(){this._readChunk(),this._chunkLoaded()}:function(){this._readChunk()},this.stream=function(e){this._input=e,this._nextChunk()},this._readChunk=function(){if(this._finished)this._chunkLoaded();else{if(t=new XMLHttpRequest,this._config.withCredentials&&(t.withCredentials=this._config.withCredentials),n||(t.onload=v(this._chunkLoaded,this),t.onerror=v(this._chunkError,this)),t.open(this._config.downloadRequestBody?"POST":"GET",this._input,!n),this._config.downloadRequestHeaders){var e,r,i=this._config.downloadRequestHeaders;for(r in i)t.setRequestHeader(r,i[r])}this._config.chunkSize&&(e=this._start+this._config.chunkSize-1,t.setRequestHeader("Range","bytes="+this._start+"-"+e));try{t.send(this._config.downloadRequestBody)}catch(e){this._chunkError(e.message)}n&&0===t.status&&this._chunkError()}},this._chunkLoaded=function(){let e;4===t.readyState&&(t.status<200||400<=t.status?this._chunkError():(this._start+=this._config.chunkSize||t.responseText.length,this._finished=!this._config.chunkSize||this._start>=(null!==(e=(e=t).getResponseHeader("Content-Range"))?parseInt(e.substring(e.lastIndexOf("/")+1)):-1),this.parseChunk(t.responseText)))},this._chunkError=function(e){e=t.statusText||e,this._sendError(Error(e))}}function c(e){(e=e||{}).chunkSize||(e.chunkSize=o.LocalChunkSize),l.call(this,e);var t,r,n="u">typeof FileReader;this.stream=function(e){this._input=e,r=e.slice||e.webkitSlice||e.mozSlice,n?((t=new FileReader).onload=v(this._chunkLoaded,this),t.onerror=v(this._chunkError,this)):t=new FileReaderSync,this._nextChunk()},this._nextChunk=function(){this._finished||this._config.preview&&!(this._rowCount=this._input.size,this.parseChunk(e.target.result)},this._chunkError=function(){this._sendError(t.error)}}function u(e){var t;l.call(this,e=e||{}),this.stream=function(e){return t=e,this._nextChunk()},this._nextChunk=function(){var e,r;if(!this._finished)return t=(e=this._config.chunkSize)?(r=t.substring(0,e),t.substring(e)):(r=t,""),this._finished=!t,this.parseChunk(r)}}function h(e){l.call(this,e=e||{});var t=[],r=!0,n=!1;this.pause=function(){l.prototype.pause.apply(this,arguments),this._input.pause()},this.resume=function(){l.prototype.resume.apply(this,arguments),this._input.resume()},this.stream=function(e){this._input=e,this._input.on("data",this._streamData),this._input.on("end",this._streamEnd),this._input.on("error",this._streamError)},this._checkIsFinished=function(){n&&1===t.length&&(this._finished=!0)},this._nextChunk=function(){this._checkIsFinished(),t.length?this.parseChunk(t.shift()):r=!0},this._streamData=v(function(e){try{t.push("string"==typeof e?e:e.toString(this._config.encoding)),r&&(r=!1,this._checkIsFinished(),this.parseChunk(t.shift()))}catch(e){this._streamError(e)}},this),this._streamError=v(function(e){this._streamCleanUp(),this._sendError(e)},this),this._streamEnd=v(function(){this._streamCleanUp(),n=!0,this._streamData("")},this),this._streamCleanUp=v(function(){this._input.removeListener("data",this._streamData),this._input.removeListener("end",this._streamEnd),this._input.removeListener("error",this._streamError)},this)}function f(e){var t,r,n,i,s=/^\s*-?(\d+\.?|\.\d+|\d+\.\d+)([eE][-+]?\d+)?\s*$/,a=/^((\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\.\d+([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z)))$/,l=this,d=0,c=0,u=!1,h=!1,f=[],g={data:[],errors:[],meta:{}};function y(t){return"greedy"===e.skipEmptyLines?""===t.join("").trim():1===t.length&&0===t[0].length}function b(){if(g&&n&&(k("Delimiter","UndetectableDelimiter","Unable to auto-detect delimiting character; defaulted to '"+o.DefaultDelimiter+"'"),n=!1),e.skipEmptyLines&&(g.data=g.data.filter(function(e){return!y(e)})),v()){if(g)if(Array.isArray(g.data[0])){for(var t,r=0;v()&&r(e.dynamicTypingFunction&&void 0===e.dynamicTyping[t]&&(e.dynamicTyping[t]=e.dynamicTypingFunction(t)),!0===(e.dynamicTyping[t]||e.dynamicTyping))?"true"===r||"TRUE"===r||"false"!==r&&"FALSE"!==r&&((e=>{if(s.test(e)&&-0x20000000000000<(e=parseFloat(e))&&e<0x20000000000000)return 1})(r)?parseFloat(r):a.test(r)?new Date(r):""===r?null:r):r)(o=e.header?i>=f.length?"__parsed_extra":f[i]:o,l=e.transform?e.transform(l,o):l);"__parsed_extra"===o?(n[o]=n[o]||[],n[o].push(l)):n[o]=l}return e.header&&(i>f.length?k("FieldMismatch","TooManyFields","Too many fields: expected "+f.length+" fields but parsed "+i,c+r):ie.preview?r.abort():(g.data=g.data[0],i(g,l))))}),this.parse=function(i,s,a){var l=e.quoteChar||'"',l=(e.newline||(e.newline=this.guessLineEndings(i,l)),n=!1,e.delimiter?_(e.delimiter)&&(e.delimiter=e.delimiter(i),g.meta.delimiter=e.delimiter):((l=((t,r,n,i,s)=>{var a,l,d,c;s=s||[","," ","|",";",o.RECORD_SEP,o.UNIT_SEP];for(var u=0;u=r.length/2?"\r\n":"\r"}}function p(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function m(e){var t=(e=e||{}).delimiter,r=e.newline,n=e.comments,i=e.step,s=e.preview,a=e.fastMode,l=null,d=!1,c=null==e.quoteChar?'"':e.quoteChar,u=c;if(void 0!==e.escapeChar&&(u=e.escapeChar),("string"!=typeof t||-1=s)return A(!0);break}j.push({type:"Quotes",code:"InvalidQuotes",message:"Trailing quote on quoted field is malformed",row:w.length,index:h}),M++}}else if(n&&0===C.length&&o.substring(h,h+v)===n){if(-1===R)return A();h=R+x,R=o.indexOf(r,h),O=o.indexOf(t,h)}else if(-1!==O&&(O=s)return A(!0)}return D();function L(e){w.push(e),S=h}function F(e){return -1!==e&&(e=o.substring(M+1,e))&&""===e.trim()?e.length:0}function D(e){return g||(void 0===e&&(e=o.substring(h)),C.push(e),h=y,L(C),k&&q()),A()}function I(e){h=e,L(C),C=[],R=o.indexOf(r,h)}function A(n){if(e.header&&!m&&w.length&&!d){var i=w[0],s=Object.create(null),a=new Set(i);let t=!1;for(let r=0;r{if("object"==typeof t){if("string"!=typeof t.delimiter||o.BAD_DELIMITERS.filter(function(e){return -1!==t.delimiter.indexOf(e)}).length||(i=t.delimiter),("boolean"==typeof t.quotes||"function"==typeof t.quotes||Array.isArray(t.quotes))&&(r=t.quotes),"boolean"!=typeof t.skipEmptyLines&&"string"!=typeof t.skipEmptyLines||(d=t.skipEmptyLines),"string"==typeof t.newline&&(s=t.newline),"string"==typeof t.quoteChar&&(a=t.quoteChar),"boolean"==typeof t.header&&(n=t.header),Array.isArray(t.columns)){if(0===t.columns.length)throw Error("Option columns is empty");c=t.columns}void 0!==t.escapeChar&&(l=t.escapeChar+a),t.escapeFormulae instanceof RegExp?u=t.escapeFormulae:"boolean"==typeof t.escapeFormulae&&t.escapeFormulae&&(u=/^[=+\-@\t\r].*$/)}})(),RegExp(p(a),"g"));if("string"==typeof e&&(e=JSON.parse(e)),Array.isArray(e)){if(!e.length||Array.isArray(e[0]))return f(null,e,d);if("object"==typeof e[0])return f(c||Object.keys(e[0]),e,d)}else if("object"==typeof e)return"string"==typeof e.data&&(e.data=JSON.parse(e.data)),Array.isArray(e.data)&&(e.fields||(e.fields=e.meta&&e.meta.fields||c),e.fields||(e.fields=Array.isArray(e.data[0])?e.fields:"object"==typeof e.data[0]?Object.keys(e.data[0]):[]),Array.isArray(e.data[0])||"object"==typeof e.data[0]||(e.data=[e.data])),f(e.fields||[],e.data||[],d);throw Error("Unable to serialize unrecognized input");function f(e,t,r){var a="",o=("string"==typeof e&&(e=JSON.parse(e)),"string"==typeof t&&(t=JSON.parse(t)),Array.isArray(e)&&0{for(var r=0;r{"use strict";var t=e.i(631171);e.s(["ChevronDownIcon",()=>t.default])},246349,e=>{"use strict";let t=(0,e.i(475254).default)("chevron-right",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);e.s(["default",()=>t])},91739,e=>{"use strict";var t=e.i(544195);e.s(["Radio",()=>t.default])},988297,e=>{"use strict";var t=e.i(271645);let r=t.forwardRef(function(e,r){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:r},e),t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 4v16m8-8H4"}))});e.s(["PlusIcon",0,r],988297)},797672,e=>{"use strict";var t=e.i(271645);let r=t.forwardRef(function(e,r){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:r},e),t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15.232 5.232l3.536 3.536m-2.036-5.036a2.5 2.5 0 113.536 3.536L6.5 21.036H3v-3.572L16.732 3.732z"}))});e.s(["PencilIcon",0,r],797672)},992619,e=>{"use strict";var t=e.i(843476),r=e.i(271645),n=e.i(779241),i=e.i(599724),s=e.i(199133),a=e.i(983561),o=e.i(689020);e.s(["default",0,({accessToken:e,value:l,placeholder:d="Select a Model",onChange:c,disabled:u=!1,style:h,className:f,showLabel:p=!0,labelText:m="Select Model"})=>{let[g,y]=(0,r.useState)(l),[b,x]=(0,r.useState)(!1),[v,_]=(0,r.useState)([]),k=(0,r.useRef)(null);return(0,r.useEffect)(()=>{y(l)},[l]),(0,r.useEffect)(()=>{e&&(async()=>{try{let t=await (0,o.fetchAvailableModels)(e);console.log("Fetched models for selector:",t),t.length>0&&_(t)}catch(e){console.error("Error fetching model info:",e)}})()},[e]),(0,t.jsxs)("div",{children:[p&&(0,t.jsxs)(i.Text,{className:"font-medium block mb-2 text-gray-700 flex items-center",children:[(0,t.jsx)(a.RobotOutlined,{className:"mr-2"})," ",m]}),(0,t.jsx)(s.Select,{value:g,placeholder:d,onChange:e=>{"custom"===e?(x(!0),y(void 0)):(x(!1),y(e),c&&c(e))},options:[...Array.from(new Set(v.map(e=>e.model_group))).map((e,t)=>({value:e,label:e,key:t})),{value:"custom",label:"Enter custom model",key:"custom"}],style:{width:"100%",...h},showSearch:!0,className:`rounded-md ${f||""}`,disabled:u}),b&&(0,t.jsx)(n.TextInput,{className:"mt-2",placeholder:"Enter custom model name",onValueChange:e=>{k.current&&clearTimeout(k.current),k.current=setTimeout(()=>{y(e),c&&c(e)},500)},disabled:u})]})}])},500727,699857,696609,531516,e=>{"use strict";var t=e.i(266027),r=e.i(243652),n=e.i(764205),i=e.i(135214);let s=(0,r.createQueryKeys)("mcpServers");e.s(["useMCPServers",0,e=>{let{accessToken:r}=(0,i.default)();return(0,t.useQuery)({queryKey:s.list(e?{filters:{teamId:e}}:void 0),queryFn:async()=>await (0,n.fetchMCPServers)(r,e),enabled:!!r})}],500727);let a=(0,r.createQueryKeys)("mcpToolsets");e.s(["useMCPToolsets",0,()=>{let{accessToken:e}=(0,i.default)();return(0,t.useQuery)({queryKey:a.list(),queryFn:async()=>await (0,n.fetchMCPToolsets)(e),enabled:!!e})}],699857);var o=e.i(843476),l=e.i(271645),d=e.i(536916),c=e.i(599724),u=e.i(409797),h=e.i(246349),h=h;let f=/\b(delete|remove|destroy|purge|drop|erase|unlink)\b/i,p=/\b(create|add|insert|new|post|submit|register|make|generate|write|upload)\b/i,m=/\b(update|edit|modify|change|patch|put|set|rename|move|transform)\b/i,g=/\b(get|read|list|fetch|search|find|query|retrieve|show|view|check|describe|info)\b/i;function y(e,t=""){let r=e.toLowerCase();if(g.test(r))return"read";if(f.test(r))return"delete";if(m.test(r))return"update";if(p.test(r))return"create";if(t){let e=t.toLowerCase();if(g.test(e))return"read";if(f.test(e))return"delete";if(m.test(e))return"update";if(p.test(e))return"create"}return"unknown"}function b(e){let t={read:[],create:[],update:[],delete:[],unknown:[]};for(let r of e)t[y(r.name,r.description)].push(r);return t}let x={read:{label:"Read",description:"Safe operations — fetch, list, search. No side effects.",risk:"low"},create:{label:"Create",description:"Add new resources — insert, upload, register.",risk:"medium"},update:{label:"Update",description:"Modify existing resources — edit, patch, rename.",risk:"medium"},delete:{label:"Delete",description:"Destructive operations — remove, purge, destroy.",risk:"high"},unknown:{label:"Other",description:"Operations that could not be automatically classified.",risk:"unknown"}};e.s(["CRUD_GROUP_META",0,x,"classifyToolOp",()=>y,"groupToolsByCrud",()=>b],696609);let v=["read","create","update","delete","unknown"],_={low:"bg-green-100 text-green-800",medium:"bg-yellow-100 text-yellow-800",high:"bg-red-100 text-red-800 font-semibold",unknown:"bg-gray-100 text-gray-700"},k={read:"border-green-200",create:"border-blue-200",update:"border-yellow-200",delete:"border-red-300",unknown:"border-gray-200"},w={read:"bg-green-50",create:"bg-blue-50",update:"bg-yellow-50",delete:"bg-red-50",unknown:"bg-gray-50"};e.s(["default",0,({tools:e,value:t,onChange:r,readOnly:n=!1,searchFilter:i=""})=>{let[s,a]=(0,l.useState)({read:!1,create:!1,update:!1,delete:!1,unknown:!0}),f=(0,l.useMemo)(()=>b(e),[e]),p=(0,l.useMemo)(()=>new Set(void 0===t?e.map(e=>e.name):t),[t,e]),m=e=>{if(n)return;let t=new Set(p);t.has(e)?t.delete(e):t.add(e),r(Array.from(t))};return 0===e.length?null:(0,o.jsx)("div",{className:"space-y-3",children:v.map(e=>{let t,l=f[e];if(0===l.length)return null;if(i){let e=i.toLowerCase();if(!l.some(t=>t.name.toLowerCase().includes(e)||(t.description??"").toLowerCase().includes(e)))return null}let g=x[e],y=(t=f[e]).length>0&&t.every(e=>p.has(e.name)),b=(e=>{let t=f[e];if(0===t.length)return!1;let r=t.filter(e=>p.has(e.name)).length;return r>0&&r{a(t=>({...t,[e]:!t[e]}))},children:[v?(0,o.jsx)(h.default,{className:"w-4 h-4 text-gray-500 flex-shrink-0"}):(0,o.jsx)(u.ChevronDownIcon,{className:"w-4 h-4 text-gray-500 flex-shrink-0"}),(0,o.jsx)("span",{className:"font-semibold text-gray-900 text-sm",children:g.label}),(0,o.jsx)("span",{className:`text-xs px-2 py-0.5 rounded-full ${_[g.risk]}`,children:"high"===g.risk?"High Risk":"medium"===g.risk?"Medium Risk":"low"===g.risk?"Safe":"Unclassified"}),(0,o.jsxs)("span",{className:"text-xs text-gray-500 ml-1",children:[l.filter(e=>p.has(e.name)).length,"/",l.length," allowed"]})]}),!n&&(0,o.jsxs)("div",{className:"flex items-center gap-2 ml-4",children:[(0,o.jsx)(c.Text,{className:"text-xs text-gray-500",children:y?"All on":b?"Partial":"All off"}),(0,o.jsx)(d.Checkbox,{checked:y,indeterminate:b,onChange:t=>((e,t)=>{if(n)return;let i=new Set(p);for(let r of f[e])t?i.add(r.name):i.delete(r.name);r(Array.from(i))})(e,t.target.checked),onClick:e=>e.stopPropagation()})]})]}),!v&&(0,o.jsx)("div",{className:"px-4 pt-2 pb-1 text-xs text-gray-500 bg-white border-b border-gray-100",children:g.description}),!v&&(0,o.jsx)("div",{className:"bg-white divide-y divide-gray-50",children:l.filter(e=>!i||e.name.toLowerCase().includes(i.toLowerCase())||(e.description??"").toLowerCase().includes(i.toLowerCase())).map(e=>{let t,r=(t=e.name,p.has(t));return(0,o.jsxs)("div",{className:`flex items-start gap-3 px-4 py-2.5 transition-colors hover:bg-gray-50 ${!n?"cursor-pointer":""} ${r?"":"opacity-60"}`,onClick:()=>m(e.name),children:[(0,o.jsx)(d.Checkbox,{checked:r,onChange:()=>m(e.name),disabled:n,onClick:e=>e.stopPropagation()}),(0,o.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,o.jsx)(c.Text,{className:"font-medium text-gray-900 text-sm",children:e.name}),e.description&&(0,o.jsx)(c.Text,{className:"text-xs text-gray-500 mt-0.5 leading-snug",children:e.description})]}),(0,o.jsx)("span",{className:`text-xs px-1.5 py-0.5 rounded flex-shrink-0 ${r?"bg-green-100 text-green-700":"bg-gray-100 text-gray-500"}`,children:r?"on":"off"})]},e.name)})})]},e)})})}],531516)},793130,e=>{"use strict";var t=e.i(290571),r=e.i(429427),n=e.i(371330),i=e.i(271645),s=e.i(394487),a=e.i(503269),o=e.i(214520),l=e.i(746725),d=e.i(914189),c=e.i(144279),u=e.i(294316),h=e.i(601893),f=e.i(140721),p=e.i(942803),m=e.i(233538),g=e.i(694421),y=e.i(700020),b=e.i(35889),x=e.i(998348),v=e.i(722678);let _=(0,i.createContext)(null);_.displayName="GroupContext";let k=i.Fragment,w=Object.assign((0,y.forwardRefWithAs)(function(e,t){var k;let w=(0,i.useId)(),j=(0,p.useProvidedId)(),C=(0,h.useDisabled)(),{id:S=j||`headlessui-switch-${w}`,disabled:E=C||!1,checked:N,defaultChecked:O,onChange:R,name:T,value:M,form:P,autoFocus:L=!1,...F}=e,D=(0,i.useContext)(_),[I,A]=(0,i.useState)(null),q=(0,i.useRef)(null),z=(0,u.useSyncRefs)(q,t,null===D?null:D.setSwitch,A),B=(0,o.useDefaultValue)(O),[U,$]=(0,a.useControllable)(N,R,null!=B&&B),K=(0,l.useDisposables)(),[H,W]=(0,i.useState)(!1),Q=(0,d.useEvent)(()=>{W(!0),null==$||$(!U),K.nextFrame(()=>{W(!1)})}),V=(0,d.useEvent)(e=>{if((0,m.isDisabledReactIssue7711)(e.currentTarget))return e.preventDefault();e.preventDefault(),Q()}),G=(0,d.useEvent)(e=>{e.key===x.Keys.Space?(e.preventDefault(),Q()):e.key===x.Keys.Enter&&(0,g.attemptSubmit)(e.currentTarget)}),J=(0,d.useEvent)(e=>e.preventDefault()),X=(0,v.useLabelledBy)(),Y=(0,b.useDescribedBy)(),{isFocusVisible:Z,focusProps:ee}=(0,r.useFocusRing)({autoFocus:L}),{isHovered:et,hoverProps:er}=(0,n.useHover)({isDisabled:E}),{pressed:en,pressProps:ei}=(0,s.useActivePress)({disabled:E}),es=(0,i.useMemo)(()=>({checked:U,disabled:E,hover:et,focus:Z,active:en,autofocus:L,changing:H}),[U,et,Z,en,E,H,L]),ea=(0,y.mergeProps)({id:S,ref:z,role:"switch",type:(0,c.useResolveButtonType)(e,I),tabIndex:-1===e.tabIndex?0:null!=(k=e.tabIndex)?k:0,"aria-checked":U,"aria-labelledby":X,"aria-describedby":Y,disabled:E||void 0,autoFocus:L,onClick:V,onKeyUp:G,onKeyPress:J},ee,er,ei),eo=(0,i.useCallback)(()=>{if(void 0!==B)return null==$?void 0:$(B)},[$,B]),el=(0,y.useRender)();return i.default.createElement(i.default.Fragment,null,null!=T&&i.default.createElement(f.FormFields,{disabled:E,data:{[T]:M||"on"},overrides:{type:"checkbox",checked:U},form:P,onReset:eo}),el({ourProps:ea,theirProps:F,slot:es,defaultTag:"button",name:"Switch"}))}),{Group:function(e){var t;let[r,n]=(0,i.useState)(null),[s,a]=(0,v.useLabels)(),[o,l]=(0,b.useDescriptions)(),d=(0,i.useMemo)(()=>({switch:r,setSwitch:n}),[r,n]),c=(0,y.useRender)();return i.default.createElement(l,{name:"Switch.Description",value:o},i.default.createElement(a,{name:"Switch.Label",value:s,props:{htmlFor:null==(t=d.switch)?void 0:t.id,onClick(e){r&&(e.currentTarget instanceof HTMLLabelElement&&e.preventDefault(),r.click(),r.focus({preventScroll:!0}))}}},i.default.createElement(_.Provider,{value:d},c({ourProps:{},theirProps:e,slot:{},defaultTag:k,name:"Switch.Group"}))))},Label:v.Label,Description:b.Description});var j=e.i(888288),C=e.i(95779),S=e.i(444755),E=e.i(673706),N=e.i(829087);let O=(0,E.makeClassName)("Switch"),R=i.default.forwardRef((e,r)=>{let{checked:n,defaultChecked:s=!1,onChange:a,color:o,name:l,error:d,errorMessage:c,disabled:u,required:h,tooltip:f,id:p}=e,m=(0,t.__rest)(e,["checked","defaultChecked","onChange","color","name","error","errorMessage","disabled","required","tooltip","id"]),g={bgColor:o?(0,E.getColorClassNames)(o,C.colorPalette.background).bgColor:"bg-tremor-brand dark:bg-dark-tremor-brand",ringColor:o?(0,E.getColorClassNames)(o,C.colorPalette.ring).ringColor:"ring-tremor-brand-muted dark:ring-dark-tremor-brand-muted"},[y,b]=(0,j.default)(s,n),[x,v]=(0,i.useState)(!1),{tooltipProps:_,getReferenceProps:k}=(0,N.useTooltip)(300);return i.default.createElement("div",{className:"flex flex-row items-center justify-start"},i.default.createElement(N.default,Object.assign({text:f},_)),i.default.createElement("div",Object.assign({ref:(0,E.mergeRefs)([r,_.refs.setReference]),className:(0,S.tremorTwMerge)(O("root"),"flex flex-row relative h-5")},m,k),i.default.createElement("input",{type:"checkbox",className:(0,S.tremorTwMerge)(O("input"),"absolute w-5 h-5 cursor-pointer left-0 top-0 opacity-0"),name:l,required:h,checked:y,onChange:e=>{e.preventDefault()}}),i.default.createElement(w,{checked:y,onChange:e=>{b(e),null==a||a(e)},disabled:u,className:(0,S.tremorTwMerge)(O("switch"),"w-10 h-5 group relative inline-flex shrink-0 cursor-pointer items-center justify-center rounded-tremor-full","focus:outline-none",u?"cursor-not-allowed":""),onFocus:()=>v(!0),onBlur:()=>v(!1),id:p},i.default.createElement("span",{className:(0,S.tremorTwMerge)(O("sr-only"),"sr-only")},"Switch ",y?"on":"off"),i.default.createElement("span",{"aria-hidden":"true",className:(0,S.tremorTwMerge)(O("background"),y?g.bgColor:"bg-tremor-border dark:bg-dark-tremor-border","pointer-events-none absolute mx-auto h-3 w-9 rounded-tremor-full transition-colors duration-100 ease-in-out")}),i.default.createElement("span",{"aria-hidden":"true",className:(0,S.tremorTwMerge)(O("round"),y?(0,S.tremorTwMerge)(g.bgColor,"translate-x-5 border-tremor-background dark:border-dark-tremor-background"):"translate-x-0 bg-tremor-border dark:bg-dark-tremor-border border-tremor-background dark:border-dark-tremor-background","pointer-events-none absolute left-0 inline-block h-5 w-5 transform rounded-tremor-full border-2 shadow-tremor-input duration-100 ease-in-out transition",x?(0,S.tremorTwMerge)("ring-2",g.ringColor):"")}))),d&&c?i.default.createElement("p",{className:(0,S.tremorTwMerge)(O("errorMessage"),"text-sm text-red-500 mt-1 ")},c):null)});R.displayName="Switch",e.s(["Switch",()=>R],793130)},107233,37727,e=>{"use strict";var t=e.i(603908);e.s(["Plus",()=>t.default],107233);var r=e.i(841947);e.s(["X",()=>r.default],37727)},361653,e=>{"use strict";let t=(0,e.i(475254).default)("circle-alert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]]);e.s(["default",()=>t])},841947,e=>{"use strict";let t=(0,e.i(475254).default)("x",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);e.s(["default",()=>t])},603908,e=>{"use strict";let t=(0,e.i(475254).default)("plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);e.s(["default",()=>t])},158392,419470,e=>{"use strict";var t=e.i(843476),r=e.i(779241);let n={ttl:3600,lowest_latency_buffer:0},i=({routingStrategyArgs:e})=>{let i={ttl:"Sliding window to look back over when calculating the average latency of a deployment. Default - 1 hour (in seconds).",lowest_latency_buffer:"Shuffle between deployments within this % of the lowest latency. Default - 0 (i.e. always pick lowest latency)."};return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:"space-y-6",children:[(0,t.jsxs)("div",{className:"max-w-3xl",children:[(0,t.jsx)("h3",{className:"text-sm font-medium text-gray-900",children:"Latency-Based Configuration"}),(0,t.jsx)("p",{className:"text-xs text-gray-500 mt-1",children:"Fine-tune latency-based routing behavior"})]}),(0,t.jsx)("div",{className:"grid grid-cols-1 gap-6 lg:grid-cols-2 xl:grid-cols-3",children:Object.entries(e||n).map(([e,n])=>(0,t.jsx)("div",{className:"space-y-2",children:(0,t.jsxs)("label",{className:"block",children:[(0,t.jsx)("span",{className:"text-xs font-medium text-gray-700 uppercase tracking-wide",children:e.replace(/_/g," ")}),(0,t.jsx)("p",{className:"text-xs text-gray-500 mt-0.5 mb-2",children:i[e]||""}),(0,t.jsx)(r.TextInput,{name:e,defaultValue:"object"==typeof n?JSON.stringify(n,null,2):n?.toString(),className:"font-mono text-sm w-full"})]})},e))})]}),(0,t.jsx)("div",{className:"border-t border-gray-200"})]})},s=({routerSettings:e,routerFieldsMetadata:n})=>(0,t.jsxs)("div",{className:"space-y-6",children:[(0,t.jsxs)("div",{className:"max-w-3xl",children:[(0,t.jsx)("h3",{className:"text-sm font-medium text-gray-900",children:"Reliability & Retries"}),(0,t.jsx)("p",{className:"text-xs text-gray-500 mt-1",children:"Configure retry logic and failure handling"})]}),(0,t.jsx)("div",{className:"grid grid-cols-1 gap-6 lg:grid-cols-2 xl:grid-cols-3",children:Object.entries(e).filter(([e,t])=>"fallbacks"!=e&&"context_window_fallbacks"!=e&&"routing_strategy_args"!=e&&"routing_strategy"!=e&&"enable_tag_filtering"!=e).map(([e,i])=>(0,t.jsx)("div",{className:"space-y-2",children:(0,t.jsxs)("label",{className:"block",children:[(0,t.jsx)("span",{className:"text-xs font-medium text-gray-700 uppercase tracking-wide",children:n[e]?.ui_field_name||e}),(0,t.jsx)("p",{className:"text-xs text-gray-500 mt-0.5 mb-2",children:n[e]?.field_description||""}),(0,t.jsx)(r.TextInput,{name:e,defaultValue:null==i||"null"===i?"":"object"==typeof i?JSON.stringify(i,null,2):i?.toString()||"",placeholder:"—",className:"font-mono text-sm w-full"})]})},e))})]});var a=e.i(199133);let o=({selectedStrategy:e,availableStrategies:r,routingStrategyDescriptions:n,routerFieldsMetadata:i,onStrategyChange:s})=>(0,t.jsxs)("div",{className:"space-y-2 max-w-3xl",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"text-xs font-medium text-gray-700 uppercase tracking-wide",children:i.routing_strategy?.ui_field_name||"Routing Strategy"}),(0,t.jsx)("p",{className:"text-xs text-gray-500 mt-0.5 mb-2",children:i.routing_strategy?.field_description||""})]}),(0,t.jsx)("div",{className:"routing-strategy-select max-w-3xl",children:(0,t.jsx)(a.Select,{value:e,onChange:s,style:{width:"100%"},size:"large",children:r.map(e=>(0,t.jsx)(a.Select.Option,{value:e,label:e,children:(0,t.jsxs)("div",{className:"flex flex-col gap-0.5 py-1",children:[(0,t.jsx)("span",{className:"font-mono text-sm font-medium",children:e}),n[e]&&(0,t.jsx)("span",{className:"text-xs text-gray-500 font-normal",children:n[e]})]})},e))})})]});var l=e.i(793130);let d=({enabled:e,routerFieldsMetadata:r,onToggle:n})=>(0,t.jsx)("div",{className:"space-y-3 max-w-3xl",children:(0,t.jsxs)("div",{className:"flex items-start justify-between",children:[(0,t.jsxs)("div",{className:"flex-1",children:[(0,t.jsx)("label",{className:"text-xs font-medium text-gray-700 uppercase tracking-wide",children:r.enable_tag_filtering?.ui_field_name||"Enable Tag Filtering"}),(0,t.jsxs)("p",{className:"text-xs text-gray-500 mt-0.5",children:[r.enable_tag_filtering?.field_description||"",r.enable_tag_filtering?.link&&(0,t.jsxs)(t.Fragment,{children:[" ",(0,t.jsx)("a",{href:r.enable_tag_filtering.link,target:"_blank",rel:"noopener noreferrer",className:"text-blue-600 hover:text-blue-800 underline",children:"Learn more"})]})]})]}),(0,t.jsx)(l.Switch,{checked:e,onChange:n,className:"ml-4"})]})});e.s(["default",0,({value:e,onChange:r,routerFieldsMetadata:n,availableRoutingStrategies:a,routingStrategyDescriptions:l})=>(0,t.jsxs)("div",{className:"w-full space-y-8 py-2",children:[(0,t.jsxs)("div",{className:"space-y-6",children:[(0,t.jsxs)("div",{className:"max-w-3xl",children:[(0,t.jsx)("h3",{className:"text-sm font-medium text-gray-900",children:"Routing Settings"}),(0,t.jsx)("p",{className:"text-xs text-gray-500 mt-1",children:"Configure how requests are routed to deployments"})]}),a.length>0&&(0,t.jsx)(o,{selectedStrategy:e.selectedStrategy||e.routerSettings.routing_strategy||null,availableStrategies:a,routingStrategyDescriptions:l,routerFieldsMetadata:n,onStrategyChange:t=>{r({...e,selectedStrategy:t})}}),(0,t.jsx)(d,{enabled:e.enableTagFiltering,routerFieldsMetadata:n,onToggle:t=>{r({...e,enableTagFiltering:t})}})]}),(0,t.jsx)("div",{className:"border-t border-gray-200"}),"latency-based-routing"===e.selectedStrategy&&(0,t.jsx)(i,{routingStrategyArgs:e.routerSettings.routing_strategy_args}),(0,t.jsx)(s,{routerSettings:e.routerSettings,routerFieldsMetadata:n})]})],158392);var c=e.i(994388),u=e.i(653496),h=e.i(107233),f=e.i(271645),p=e.i(888259),m=e.i(592968),g=e.i(361653),g=g;let y=(0,e.i(475254).default)("arrow-down",[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]]);var b=e.i(37727);function x({group:e,onChange:r,availableModels:n,maxFallbacks:i}){let s=n.filter(t=>t!==e.primaryModel),o=e.fallbackModels.length{let n=[...e.fallbackModels];n.includes(t)&&(n=n.filter(e=>e!==t)),r({...e,primaryModel:t,fallbackModels:n})},showSearch:!0,getPopupContainer:e=>e.parentElement||document.body,filterOption:(e,t)=>(t?.label??"").toLowerCase().includes(e.toLowerCase()),options:n.map(e=>({label:e,value:e}))}),!e.primaryModel&&(0,t.jsxs)("div",{className:"mt-2 flex items-center gap-2 text-amber-600 text-xs bg-amber-50 p-2 rounded",children:[(0,t.jsx)(g.default,{className:"w-4 h-4"}),(0,t.jsx)("span",{children:"Select a model to begin configuring fallbacks"})]})]}),(0,t.jsx)("div",{className:"flex items-center justify-center -my-4 z-10",children:(0,t.jsxs)("div",{className:"bg-indigo-50 text-indigo-500 px-4 py-1 rounded-full text-xs font-bold border border-indigo-100 flex items-center gap-2 shadow-sm",children:[(0,t.jsx)(y,{className:"w-4 h-4"}),"IF FAILS, TRY..."]})}),(0,t.jsxs)("div",{className:`transition-opacity duration-300 ${!e.primaryModel?"opacity-50 pointer-events-none":"opacity-100"}`,children:[(0,t.jsxs)("label",{className:"block text-sm font-semibold text-gray-700 mb-2",children:["Fallback Chain ",(0,t.jsx)("span",{className:"text-red-500",children:"*"}),(0,t.jsxs)("span",{className:"text-xs text-gray-500 font-normal ml-2",children:["(Max ",i," fallbacks at a time)"]})]}),(0,t.jsxs)("div",{className:"bg-gray-50 rounded-xl p-4 border border-gray-200",children:[(0,t.jsxs)("div",{className:"mb-4",children:[(0,t.jsx)(a.Select,{mode:"multiple",className:"w-full",size:"large",placeholder:o?"Select fallback models to add...":`Maximum ${i} fallbacks reached`,value:e.fallbackModels,onChange:t=>{let n=t.slice(0,i);r({...e,fallbackModels:n})},disabled:!e.primaryModel,getPopupContainer:e=>e.parentElement||document.body,options:s.map(e=>({label:e,value:e})),optionRender:(r,n)=>{let i=e.fallbackModels.includes(r.value),s=i?e.fallbackModels.indexOf(r.value)+1:null;return(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[i&&null!==s&&(0,t.jsx)("span",{className:"flex items-center justify-center w-5 h-5 rounded bg-indigo-100 text-indigo-600 text-xs font-bold",children:s}),(0,t.jsx)("span",{children:r.label})]})},maxTagCount:"responsive",maxTagPlaceholder:e=>(0,t.jsx)(m.Tooltip,{styles:{root:{pointerEvents:"none"}},title:e.map(({value:e})=>e).join(", "),children:(0,t.jsxs)("span",{children:["+",e.length," more"]})}),showSearch:!0,filterOption:(e,t)=>(t?.label??"").toLowerCase().includes(e.toLowerCase())}),(0,t.jsx)("p",{className:"text-xs text-gray-500 mt-1 ml-1",children:o?`Search and select multiple models. Selected models will appear below in order. (${e.fallbackModels.length}/${i} used)`:`Maximum ${i} fallbacks reached. Remove some to add more.`})]}),(0,t.jsx)("div",{className:"space-y-2 min-h-[100px]",children:0===e.fallbackModels.length?(0,t.jsxs)("div",{className:"h-32 border-2 border-dashed border-gray-300 rounded-lg flex flex-col items-center justify-center text-gray-400",children:[(0,t.jsx)("span",{className:"text-sm",children:"No fallback models selected"}),(0,t.jsx)("span",{className:"text-xs mt-1",children:"Add models from the dropdown above"})]}):e.fallbackModels.map((n,i)=>(0,t.jsxs)("div",{className:"group flex items-center justify-between p-3 bg-white rounded-lg border border-gray-200 hover:border-indigo-300 hover:shadow-sm transition-all",children:[(0,t.jsxs)("div",{className:"flex items-center gap-3",children:[(0,t.jsx)("div",{className:"flex items-center justify-center w-6 h-6 rounded bg-gray-100 text-gray-400 group-hover:text-indigo-500 group-hover:bg-indigo-50",children:(0,t.jsx)("span",{className:"text-xs font-bold",children:i+1})}),(0,t.jsx)("div",{children:(0,t.jsx)("span",{className:"font-medium text-gray-800",children:n})})]}),(0,t.jsx)("button",{type:"button",onClick:()=>{let t;return t=e.fallbackModels.filter((e,t)=>t!==i),void r({...e,fallbackModels:t})},className:"opacity-0 group-hover:opacity-100 transition-opacity text-gray-400 hover:text-red-500 p-1",children:(0,t.jsx)(b.X,{className:"w-4 h-4"})})]},`${n}-${i}`))})]})]})]})}function v({groups:e,onGroupsChange:r,availableModels:n,maxFallbacks:i=10,maxGroups:s=5}){let[a,o]=(0,f.useState)(e.length>0?e[0].id:"1");(0,f.useEffect)(()=>{e.length>0?e.some(e=>e.id===a)||o(e[0].id):o("1")},[e]);let l=()=>{if(e.length>=s)return;let t=Date.now().toString();r([...e,{id:t,primaryModel:null,fallbackModels:[]}]),o(t)},d=t=>{r(e.map(e=>e.id===t.id?t:e))},m=e.map((r,s)=>{let a=r.primaryModel?r.primaryModel:`Group ${s+1}`;return{key:r.id,label:a,closable:e.length>1,children:(0,t.jsx)(x,{group:r,onChange:d,availableModels:n,maxFallbacks:i})}});return 0===e.length?(0,t.jsxs)("div",{className:"text-center py-12 bg-gray-50 rounded-lg border border-dashed border-gray-300",children:[(0,t.jsx)("p",{className:"text-gray-500 mb-4",children:"No fallback groups configured"}),(0,t.jsx)(c.Button,{variant:"primary",onClick:l,icon:()=>(0,t.jsx)(h.Plus,{className:"w-4 h-4"}),children:"Create First Group"})]}):(0,t.jsx)(u.Tabs,{type:"editable-card",activeKey:a,onChange:o,onEdit:(t,n)=>{"add"===n?l():"remove"===n&&e.length>1&&(t=>{if(1===e.length)return p.default.warning("At least one group is required");let n=e.filter(e=>e.id!==t);r(n),a===t&&n.length>0&&o(n[n.length-1].id)})(t)},items:m,className:"fallback-tabs",tabBarStyle:{marginBottom:0},hideAdd:e.length>=s})}e.s(["FallbackSelectionForm",()=>v],419470)}]); \ No newline at end of file diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/ae31df62c48a7fb3.js b/litellm/proxy/_experimental/out/_next/static/chunks/27289c624996260b.js similarity index 76% rename from litellm/proxy/_experimental/out/_next/static/chunks/ae31df62c48a7fb3.js rename to litellm/proxy/_experimental/out/_next/static/chunks/27289c624996260b.js index 521a9db07e..0909a74f69 100644 --- a/litellm/proxy/_experimental/out/_next/static/chunks/ae31df62c48a7fb3.js +++ b/litellm/proxy/_experimental/out/_next/static/chunks/27289c624996260b.js @@ -1,8 +1,8 @@ -(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,625901,e=>{"use strict";var t=e.i(266027),r=e.i(621482),a=e.i(243652),l=e.i(764205),s=e.i(135214);let n=(0,a.createQueryKeys)("models"),i=(0,a.createQueryKeys)("modelHub"),o=(0,a.createQueryKeys)("allProxyModels");(0,a.createQueryKeys)("selectedTeamModels");let d=(0,a.createQueryKeys)("infiniteModels");e.s(["useAllProxyModels",0,()=>{let{accessToken:e,userId:r,userRole:a}=(0,s.default)();return(0,t.useQuery)({queryKey:o.list({}),queryFn:async()=>await (0,l.modelAvailableCall)(e,r,a,!0,null,!0,!1,"expand"),enabled:!!(e&&r&&a)})},"useInfiniteModelInfo",0,(e=50,t)=>{let{accessToken:a,userId:n,userRole:i}=(0,s.default)();return(0,r.useInfiniteQuery)({queryKey:d.list({filters:{...n&&{userId:n},...i&&{userRole:i},size:e,...t&&{search:t}}}),queryFn:async({pageParam:r})=>await (0,l.modelInfoCall)(a,n,i,r,e,t),initialPageParam:1,getNextPageParam:e=>{if(e.current_page{let{accessToken:e}=(0,s.default)();return(0,t.useQuery)({queryKey:i.list({}),queryFn:async()=>await (0,l.modelHubCall)(e),enabled:!!e})},"useModelsInfo",0,(e=1,r=50,a,i,o,d,c)=>{let{accessToken:m,userId:u,userRole:g}=(0,s.default)();return(0,t.useQuery)({queryKey:n.list({filters:{...u&&{userId:u},...g&&{userRole:g},page:e,size:r,...a&&{search:a},...i&&{modelId:i},...o&&{teamId:o},...d&&{sortBy:d},...c&&{sortOrder:c}}}),queryFn:async()=>await (0,l.modelInfoCall)(m,u,g,e,r,a,i,o,d,c),enabled:!!(m&&u&&g)})}])},599724,936325,e=>{"use strict";var t=e.i(95779),r=e.i(444755),a=e.i(673706),l=e.i(271645);let s=l.default.forwardRef((e,s)=>{let{color:n,className:i,children:o}=e;return l.default.createElement("p",{ref:s,className:(0,r.tremorTwMerge)("text-tremor-default",n?(0,a.getColorClassNames)(n,t.colorPalette.text).textColor:(0,r.tremorTwMerge)("text-tremor-content","dark:text-dark-tremor-content"),i)},o)});s.displayName="Text",e.s(["default",()=>s],936325),e.s(["Text",()=>s],599724)},994388,e=>{"use strict";var t=e.i(290571),r=e.i(829087),a=e.i(271645);let l=["preEnter","entering","entered","preExit","exiting","exited","unmounted"],s=e=>({_s:e,status:l[e],isEnter:e<3,isMounted:6!==e,isResolved:2===e||e>4}),n=e=>e?6:5,i=(e,t,r,a,l)=>{clearTimeout(a.current);let n=s(e);t(n),r.current=n,l&&l({current:n})};var o=e.i(480731),d=e.i(444755),c=e.i(673706);let m=e=>{var r=(0,t.__rest)(e,[]);return a.default.createElement("svg",Object.assign({},r,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor"}),a.default.createElement("path",{fill:"none",d:"M0 0h24v24H0z"}),a.default.createElement("path",{d:"M18.364 5.636L16.95 7.05A7 7 0 1 0 19 12h2a9 9 0 1 1-2.636-6.364z"}))};var u=e.i(95779);let g={xs:{height:"h-4",width:"w-4"},sm:{height:"h-5",width:"w-5"},md:{height:"h-5",width:"w-5"},lg:{height:"h-6",width:"w-6"},xl:{height:"h-6",width:"w-6"}},h=(e,t)=>{switch(e){case"primary":return{textColor:t?(0,c.getColorClassNames)("white").textColor:"text-tremor-brand-inverted dark:text-dark-tremor-brand-inverted",hoverTextColor:t?(0,c.getColorClassNames)("white").textColor:"text-tremor-brand-inverted dark:text-dark-tremor-brand-inverted",bgColor:t?(0,c.getColorClassNames)(t,u.colorPalette.background).bgColor:"bg-tremor-brand dark:bg-dark-tremor-brand",hoverBgColor:t?(0,c.getColorClassNames)(t,u.colorPalette.darkBackground).hoverBgColor:"hover:bg-tremor-brand-emphasis dark:hover:bg-dark-tremor-brand-emphasis",borderColor:t?(0,c.getColorClassNames)(t,u.colorPalette.border).borderColor:"border-tremor-brand dark:border-dark-tremor-brand",hoverBorderColor:t?(0,c.getColorClassNames)(t,u.colorPalette.darkBorder).hoverBorderColor:"hover:border-tremor-brand-emphasis dark:hover:border-dark-tremor-brand-emphasis"};case"secondary":return{textColor:t?(0,c.getColorClassNames)(t,u.colorPalette.text).textColor:"text-tremor-brand dark:text-dark-tremor-brand",hoverTextColor:t?(0,c.getColorClassNames)(t,u.colorPalette.text).textColor:"hover:text-tremor-brand-emphasis dark:hover:text-dark-tremor-brand-emphasis",bgColor:(0,c.getColorClassNames)("transparent").bgColor,hoverBgColor:t?(0,d.tremorTwMerge)((0,c.getColorClassNames)(t,u.colorPalette.background).hoverBgColor,"hover:bg-opacity-20 dark:hover:bg-opacity-20"):"hover:bg-tremor-brand-faint dark:hover:bg-dark-tremor-brand-faint",borderColor:t?(0,c.getColorClassNames)(t,u.colorPalette.border).borderColor:"border-tremor-brand dark:border-dark-tremor-brand"};case"light":return{textColor:t?(0,c.getColorClassNames)(t,u.colorPalette.text).textColor:"text-tremor-brand dark:text-dark-tremor-brand",hoverTextColor:t?(0,c.getColorClassNames)(t,u.colorPalette.darkText).hoverTextColor:"hover:text-tremor-brand-emphasis dark:hover:text-dark-tremor-brand-emphasis",bgColor:(0,c.getColorClassNames)("transparent").bgColor,borderColor:"",hoverBorderColor:""}}},p=(0,c.makeClassName)("Button"),x=({loading:e,iconSize:t,iconPosition:r,Icon:l,needMargin:s,transitionStatus:n})=>{let i=s?r===o.HorizontalPositions.Left?(0,d.tremorTwMerge)("-ml-1","mr-1.5"):(0,d.tremorTwMerge)("-mr-1","ml-1.5"):"",c=(0,d.tremorTwMerge)("w-0 h-0"),u={default:c,entering:c,entered:t,exiting:t,exited:c};return e?a.default.createElement(m,{className:(0,d.tremorTwMerge)(p("icon"),"animate-spin shrink-0",i,u.default,u[n]),style:{transition:"width 150ms"}}):a.default.createElement(l,{className:(0,d.tremorTwMerge)(p("icon"),"shrink-0",t,i)})},f=a.default.forwardRef((e,l)=>{let{icon:m,iconPosition:u=o.HorizontalPositions.Left,size:f=o.Sizes.SM,color:b,variant:v="primary",disabled:w,loading:j=!1,loadingText:y,children:C,tooltip:k,className:N}=e,T=(0,t.__rest)(e,["icon","iconPosition","size","color","variant","disabled","loading","loadingText","children","tooltip","className"]),$=j||w,E=void 0!==m||j,M=j&&y,O=!(!C&&!M),_=(0,d.tremorTwMerge)(g[f].height,g[f].width),S="light"!==v?(0,d.tremorTwMerge)("rounded-tremor-default border","shadow-tremor-input","dark:shadow-dark-tremor-input"):"",I=h(v,b),R=("light"!==v?{xs:{paddingX:"px-2.5",paddingY:"py-1.5",fontSize:"text-xs"},sm:{paddingX:"px-4",paddingY:"py-2",fontSize:"text-sm"},md:{paddingX:"px-4",paddingY:"py-2",fontSize:"text-md"},lg:{paddingX:"px-4",paddingY:"py-2.5",fontSize:"text-lg"},xl:{paddingX:"px-4",paddingY:"py-3",fontSize:"text-xl"}}:{xs:{paddingX:"",paddingY:"",fontSize:"text-xs"},sm:{paddingX:"",paddingY:"",fontSize:"text-sm"},md:{paddingX:"",paddingY:"",fontSize:"text-md"},lg:{paddingX:"",paddingY:"",fontSize:"text-lg"},xl:{paddingX:"",paddingY:"",fontSize:"text-xl"}})[f],{tooltipProps:P,getReferenceProps:A}=(0,r.useTooltip)(300),[z,B]=(({enter:e=!0,exit:t=!0,preEnter:r,preExit:l,timeout:o,initialEntered:d,mountOnEnter:c,unmountOnExit:m,onStateChange:u}={})=>{let[g,h]=(0,a.useState)(()=>s(d?2:n(c))),p=(0,a.useRef)(g),x=(0,a.useRef)(0),[f,b]="object"==typeof o?[o.enter,o.exit]:[o,o],v=(0,a.useCallback)(()=>{let e=((e,t)=>{switch(e){case 1:case 0:return 2;case 4:case 3:return n(t)}})(p.current._s,m);e&&i(e,h,p,x,u)},[u,m]);return[g,(0,a.useCallback)(a=>{let s=e=>{switch(i(e,h,p,x,u),e){case 1:f>=0&&(x.current=((...e)=>setTimeout(...e))(v,f));break;case 4:b>=0&&(x.current=((...e)=>setTimeout(...e))(v,b));break;case 0:case 3:x.current=((...e)=>setTimeout(...e))(()=>{isNaN(document.body.offsetTop)||s(e+1)},0)}},o=p.current.isEnter;"boolean"!=typeof a&&(a=!o),a?o||s(e?+!r:2):o&&s(t?l?3:4:n(m))},[v,u,e,t,r,l,f,b,m]),v]})({timeout:50});return(0,a.useEffect)(()=>{B(j)},[j]),a.default.createElement("button",Object.assign({ref:(0,c.mergeRefs)([l,P.refs.setReference]),className:(0,d.tremorTwMerge)(p("root"),"shrink-0 inline-flex justify-center items-center group font-medium outline-none",S,R.paddingX,R.paddingY,R.fontSize,I.textColor,I.bgColor,I.borderColor,I.hoverBorderColor,$?"opacity-50 cursor-not-allowed":(0,d.tremorTwMerge)(h(v,b).hoverTextColor,h(v,b).hoverBgColor,h(v,b).hoverBorderColor),N),disabled:$},A,T),a.default.createElement(r.default,Object.assign({text:k},P)),E&&u!==o.HorizontalPositions.Right?a.default.createElement(x,{loading:j,iconSize:_,iconPosition:u,Icon:m,transitionStatus:z.status,needMargin:O}):null,M||C?a.default.createElement("span",{className:(0,d.tremorTwMerge)(p("text"),"text-tremor-default whitespace-nowrap")},M?y:C):null,E&&u===o.HorizontalPositions.Right?a.default.createElement(x,{loading:j,iconSize:_,iconPosition:u,Icon:m,transitionStatus:z.status,needMargin:O}):null)});f.displayName="Button",e.s(["Button",()=>f],994388)},304967,e=>{"use strict";var t=e.i(290571),r=e.i(271645),a=e.i(480731),l=e.i(95779),s=e.i(444755),n=e.i(673706);let i=(0,n.makeClassName)("Card"),o=r.default.forwardRef((e,o)=>{let{decoration:d="",decorationColor:c,children:m,className:u}=e,g=(0,t.__rest)(e,["decoration","decorationColor","children","className"]);return r.default.createElement("div",Object.assign({ref:o,className:(0,s.tremorTwMerge)(i("root"),"relative w-full text-left ring-1 rounded-tremor-default p-6","bg-tremor-background ring-tremor-ring shadow-tremor-card","dark:bg-dark-tremor-background dark:ring-dark-tremor-ring dark:shadow-dark-tremor-card",c?(0,n.getColorClassNames)(c,l.colorPalette.border).borderColor:"border-tremor-brand dark:border-dark-tremor-brand",(e=>{if(!e)return"";switch(e){case a.HorizontalPositions.Left:return"border-l-4";case a.VerticalPositions.Top:return"border-t-4";case a.HorizontalPositions.Right:return"border-r-4";case a.VerticalPositions.Bottom:return"border-b-4";default:return""}})(d),u)},g),m)});o.displayName="Card",e.s(["Card",()=>o],304967)},629569,e=>{"use strict";var t=e.i(290571),r=e.i(95779),a=e.i(444755),l=e.i(673706),s=e.i(271645);let n=s.default.forwardRef((e,n)=>{let{color:i,children:o,className:d}=e,c=(0,t.__rest)(e,["color","children","className"]);return s.default.createElement("p",Object.assign({ref:n,className:(0,a.tremorTwMerge)("font-medium text-tremor-title",i?(0,l.getColorClassNames)(i,r.colorPalette.darkText).textColor:"text-tremor-content-strong dark:text-dark-tremor-content-strong",d)},c),o)});n.displayName="Title",e.s(["Title",()=>n],629569)},653496,e=>{"use strict";var t=e.i(721369);e.s(["Tabs",()=>t.default])},292639,e=>{"use strict";var t=e.i(764205),r=e.i(266027);let a=(0,e.i(243652).createQueryKeys)("uiSettings");e.s(["useUISettings",0,()=>(0,r.useQuery)({queryKey:a.list({}),queryFn:async()=>await (0,t.getUiSettings)(),staleTime:36e5,gcTime:36e5})])},250980,e=>{"use strict";var t=e.i(271645);let r=t.forwardRef(function(e,r){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:r},e),t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 9v3m0 0v3m0-3h3m-3 0H9m12 0a9 9 0 11-18 0 9 9 0 0118 0z"}))});e.s(["PlusCircleIcon",0,r],250980)},502547,e=>{"use strict";var t=e.i(271645);let r=t.forwardRef(function(e,r){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:r},e),t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 5l7 7-7 7"}))});e.s(["ChevronRightIcon",0,r],502547)},384767,e=>{"use strict";var t=e.i(843476),r=e.i(599724),a=e.i(271645),l=e.i(389083);let s=a.forwardRef(function(e,t){return a.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:t},e),a.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 7v10c0 2.21 3.582 4 8 4s8-1.79 8-4V7M4 7c0 2.21 3.582 4 8 4s8-1.79 8-4M4 7c0-2.21 3.582-4 8-4s8 1.79 8 4m0 5c0 2.21-3.582 4-8 4s-8-1.79-8-4"}))});var n=e.i(764205);let i=function({vectorStores:e,accessToken:i}){let[o,d]=(0,a.useState)([]);return(0,a.useEffect)(()=>{(async()=>{if(i&&0!==e.length)try{let e=await (0,n.vectorStoreListCall)(i);e.data&&d(e.data.map(e=>({vector_store_id:e.vector_store_id,vector_store_name:e.vector_store_name})))}catch(e){console.error("Error fetching vector stores:",e)}})()},[i,e.length]),(0,t.jsxs)("div",{className:"space-y-3",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(s,{className:"h-4 w-4 text-blue-600"}),(0,t.jsx)(r.Text,{className:"font-semibold text-gray-900",children:"Vector Stores"}),(0,t.jsx)(l.Badge,{color:"blue",size:"xs",children:e.length})]}),e.length>0?(0,t.jsx)("div",{className:"flex flex-wrap gap-2",children:e.map((e,r)=>{let a;return(0,t.jsx)("div",{className:"inline-flex items-center px-3 py-1.5 rounded-lg bg-blue-50 border border-blue-200 text-blue-800 text-sm font-medium",children:(a=o.find(t=>t.vector_store_id===e))?`${a.vector_store_name||a.vector_store_id} (${a.vector_store_id})`:e},r)})}):(0,t.jsxs)("div",{className:"flex items-center gap-2 px-3 py-2 rounded-lg bg-gray-50 border border-gray-200",children:[(0,t.jsx)(s,{className:"h-4 w-4 text-gray-400"}),(0,t.jsx)(r.Text,{className:"text-gray-500 text-sm",children:"No vector stores configured"})]})]})},o=a.forwardRef(function(e,t){return a.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:t},e),a.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 12h14M5 12a2 2 0 01-2-2V6a2 2 0 012-2h14a2 2 0 012 2v4a2 2 0 01-2 2M5 12a2 2 0 00-2 2v4a2 2 0 002 2h14a2 2 0 002-2v-4a2 2 0 00-2-2m-2-4h.01M17 16h.01"}))});var d=e.i(871943),c=e.i(502547),m=e.i(592968);let u=function({mcpServers:e,mcpAccessGroups:s=[],mcpToolPermissions:i={},mcpToolsets:u=[],accessToken:g}){let[h,p]=(0,a.useState)([]),[x,f]=(0,a.useState)([]),[b,v]=(0,a.useState)(new Set),[w,j]=(0,a.useState)(new Set);(0,a.useEffect)(()=>{(async()=>{if(g&&e.length>0)try{let e=await (0,n.fetchMCPServers)(g);e&&Array.isArray(e)?p(e):e.data&&Array.isArray(e.data)&&p(e.data)}catch(e){console.error("Error fetching MCP servers:",e)}})()},[g,e.length]),(0,a.useEffect)(()=>{(async()=>{if(g&&u.length>0)try{let e=await (0,n.fetchMCPToolsets)(g),t=Array.isArray(e)?e.filter(e=>u.includes(e.toolset_id)):[];f(t)}catch(e){console.error("Error fetching toolsets:",e)}})()},[g,u.length]);let y=[...e.map(e=>({type:"server",value:e})),...s.map(e=>({type:"accessGroup",value:e}))],C=y.length+u.length;return(0,t.jsxs)("div",{className:"space-y-3",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(o,{className:"h-4 w-4 text-blue-600"}),(0,t.jsx)(r.Text,{className:"font-semibold text-gray-900",children:"MCP Servers"}),(0,t.jsx)(l.Badge,{color:"blue",size:"xs",children:C})]}),C>0?(0,t.jsxs)("div",{className:"max-h-[400px] overflow-y-auto space-y-2 pr-1",children:[y.map((e,r)=>{let a="server"===e.type?i[e.value]:void 0,l=a&&a.length>0,s=b.has(e.value);return(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsxs)("div",{onClick:()=>{var t;return l&&(t=e.value,void v(e=>{let r=new Set(e);return r.has(t)?r.delete(t):r.add(t),r}))},className:`flex items-center gap-3 py-2 px-3 rounded-lg border border-gray-200 transition-all ${l?"cursor-pointer hover:bg-gray-50 hover:border-gray-300":"bg-white"}`,children:[(0,t.jsx)("div",{className:"flex items-center gap-2 flex-1 min-w-0",children:"server"===e.type?(0,t.jsx)(m.Tooltip,{title:`Full ID: ${e.value}`,placement:"top",children:(0,t.jsxs)("div",{className:"inline-flex items-center gap-2 min-w-0",children:[(0,t.jsx)("span",{className:"inline-block w-1.5 h-1.5 bg-blue-500 rounded-full flex-shrink-0"}),(0,t.jsx)("span",{className:"text-sm font-medium text-gray-900 truncate",children:(e=>{let t=h.find(t=>t.server_id===e);if(t){let r=e.length>7?`${e.slice(0,3)}...${e.slice(-4)}`:e;return`${t.alias} (${r})`}return e})(e.value)})]})}):(0,t.jsxs)("div",{className:"inline-flex items-center gap-2 min-w-0",children:[(0,t.jsx)("span",{className:"inline-block w-1.5 h-1.5 bg-green-500 rounded-full flex-shrink-0"}),(0,t.jsx)("span",{className:"text-sm font-medium text-gray-900 truncate",children:e.value}),(0,t.jsx)("span",{className:"ml-1 px-1.5 py-0.5 text-[9px] font-semibold text-green-600 bg-green-50 border border-green-200 rounded uppercase tracking-wide flex-shrink-0",children:"Group"})]})}),l&&(0,t.jsxs)("div",{className:"flex items-center gap-1 flex-shrink-0 whitespace-nowrap",children:[(0,t.jsx)("span",{className:"text-xs font-medium text-gray-600",children:a.length}),(0,t.jsx)("span",{className:"text-xs text-gray-500",children:1===a.length?"tool":"tools"}),s?(0,t.jsx)(d.ChevronDownIcon,{className:"h-3.5 w-3.5 text-gray-400 ml-0.5"}):(0,t.jsx)(c.ChevronRightIcon,{className:"h-3.5 w-3.5 text-gray-400 ml-0.5"})]})]}),l&&s&&(0,t.jsx)("div",{className:"ml-4 pl-4 border-l-2 border-blue-200 pb-1",children:(0,t.jsx)("div",{className:"flex flex-wrap gap-1.5",children:a.map((e,r)=>(0,t.jsx)("span",{className:"inline-flex items-center px-2.5 py-1 rounded-lg bg-blue-50 border border-blue-200 text-blue-800 text-xs font-medium",children:e},r))})})]},r)}),u.length>0&&u.map((e,r)=>{let a=x.find(t=>t.toolset_id===e),l=w.has(e),s=a?.tools.length??0;return(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsxs)("div",{onClick:()=>s>0&&void j(t=>{let r=new Set(t);return r.has(e)?r.delete(e):r.add(e),r}),className:`flex items-center gap-3 py-2 px-3 rounded-lg border border-purple-200 transition-all ${s>0?"cursor-pointer hover:bg-purple-50 hover:border-purple-300":"bg-white"}`,children:[(0,t.jsxs)("div",{className:"flex items-center gap-2 flex-1 min-w-0",children:[(0,t.jsx)("span",{className:"inline-block w-1.5 h-1.5 bg-purple-500 rounded-full flex-shrink-0"}),(0,t.jsx)("span",{className:"text-sm font-medium text-gray-900 truncate",children:a?.toolset_name??e}),(0,t.jsx)("span",{className:"ml-1 px-1.5 py-0.5 text-[9px] font-semibold text-purple-600 bg-purple-50 border border-purple-200 rounded uppercase tracking-wide flex-shrink-0",children:"Toolset"})]}),s>0&&(0,t.jsxs)("div",{className:"flex items-center gap-1 flex-shrink-0 whitespace-nowrap",children:[(0,t.jsx)("span",{className:"text-xs font-medium text-gray-600",children:s}),(0,t.jsx)("span",{className:"text-xs text-gray-500",children:1===s?"tool":"tools"}),l?(0,t.jsx)(d.ChevronDownIcon,{className:"h-3.5 w-3.5 text-gray-400 ml-0.5"}):(0,t.jsx)(c.ChevronRightIcon,{className:"h-3.5 w-3.5 text-gray-400 ml-0.5"})]})]}),s>0&&l&&a&&(0,t.jsx)("div",{className:"ml-4 pl-4 border-l-2 border-purple-200 pb-1",children:(0,t.jsx)("div",{className:"flex flex-wrap gap-1.5",children:a.tools.map((e,r)=>(0,t.jsxs)("span",{className:"inline-flex items-center px-2.5 py-1 rounded-lg bg-purple-50 border border-purple-200 text-purple-800 text-xs font-medium",children:[(0,t.jsxs)("span",{className:"text-purple-400 mr-1 text-[10px]",children:[e.server_id.slice(0,6),"…"]}),e.tool_name]},r))})})]},`toolset-${r}`)})]}):(0,t.jsxs)("div",{className:"flex items-center gap-2 px-3 py-2 rounded-lg bg-gray-50 border border-gray-200",children:[(0,t.jsx)(o,{className:"h-4 w-4 text-gray-400"}),(0,t.jsx)(r.Text,{className:"text-gray-500 text-sm",children:"No MCP servers, access groups, or toolsets configured"})]})]})},g=a.forwardRef(function(e,t){return a.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:t},e),a.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M17 20h5v-2a3 3 0 00-5.356-1.857M17 20H7m10 0v-2c0-.656-.126-1.283-.356-1.857M7 20H2v-2a3 3 0 015.356-1.857M7 20v-2c0-.656.126-1.283.356-1.857m0 0a5.002 5.002 0 019.288 0M15 7a3 3 0 11-6 0 3 3 0 016 0zm6 3a2 2 0 11-4 0 2 2 0 014 0zM7 10a2 2 0 11-4 0 2 2 0 014 0z"}))}),h=function({agents:e,agentAccessGroups:s=[],accessToken:i}){let[o,d]=(0,a.useState)([]);(0,a.useEffect)(()=>{(async()=>{if(i&&e.length>0)try{let e=await (0,n.getAgentsList)(i);e&&e.agents&&Array.isArray(e.agents)&&d(e.agents)}catch(e){console.error("Error fetching agents:",e)}})()},[i,e.length]);let c=[...e.map(e=>({type:"agent",value:e})),...s.map(e=>({type:"accessGroup",value:e}))],u=c.length;return(0,t.jsxs)("div",{className:"space-y-3",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(g,{className:"h-4 w-4 text-purple-600"}),(0,t.jsx)(r.Text,{className:"font-semibold text-gray-900",children:"Agents"}),(0,t.jsx)(l.Badge,{color:"purple",size:"xs",children:u})]}),u>0?(0,t.jsx)("div",{className:"max-h-[400px] overflow-y-auto space-y-2 pr-1",children:c.map((e,r)=>(0,t.jsx)("div",{className:"space-y-2",children:(0,t.jsx)("div",{className:"flex items-center gap-3 py-2 px-3 rounded-lg border border-gray-200 bg-white",children:(0,t.jsx)("div",{className:"flex items-center gap-2 flex-1 min-w-0",children:"agent"===e.type?(0,t.jsx)(m.Tooltip,{title:`Full ID: ${e.value}`,placement:"top",children:(0,t.jsxs)("div",{className:"inline-flex items-center gap-2 min-w-0",children:[(0,t.jsx)("span",{className:"inline-block w-1.5 h-1.5 bg-purple-500 rounded-full flex-shrink-0"}),(0,t.jsx)("span",{className:"text-sm font-medium text-gray-900 truncate",children:(e=>{let t=o.find(t=>t.agent_id===e);if(t){let r=e.length>7?`${e.slice(0,3)}...${e.slice(-4)}`:e;return`${t.agent_name} (${r})`}return e})(e.value)})]})}):(0,t.jsxs)("div",{className:"inline-flex items-center gap-2 min-w-0",children:[(0,t.jsx)("span",{className:"inline-block w-1.5 h-1.5 bg-green-500 rounded-full flex-shrink-0"}),(0,t.jsx)("span",{className:"text-sm font-medium text-gray-900 truncate",children:e.value}),(0,t.jsx)("span",{className:"ml-1 px-1.5 py-0.5 text-[9px] font-semibold text-green-600 bg-green-50 border border-green-200 rounded uppercase tracking-wide flex-shrink-0",children:"Group"})]})})})},r))}):(0,t.jsxs)("div",{className:"flex items-center gap-2 px-3 py-2 rounded-lg bg-gray-50 border border-gray-200",children:[(0,t.jsx)(g,{className:"h-4 w-4 text-gray-400"}),(0,t.jsx)(r.Text,{className:"text-gray-500 text-sm",children:"No agents or access groups configured"})]})]})};e.s(["default",0,function({objectPermission:e,variant:a="card",className:l="",accessToken:s}){let n=e?.vector_stores||[],o=e?.mcp_servers||[],d=e?.mcp_access_groups||[],c=e?.mcp_tool_permissions||{},m=e?.mcp_toolsets||[],g=e?.agents||[],p=e?.agent_access_groups||[],x=(0,t.jsxs)("div",{className:"card"===a?"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6":"space-y-4",children:[(0,t.jsx)(i,{vectorStores:n,accessToken:s}),(0,t.jsx)(u,{mcpServers:o,mcpAccessGroups:d,mcpToolPermissions:c,mcpToolsets:m,accessToken:s}),(0,t.jsx)(h,{agents:g,agentAccessGroups:p,accessToken:s})]});return"card"===a?(0,t.jsxs)("div",{className:`bg-white border border-gray-200 rounded-lg p-6 ${l}`,children:[(0,t.jsx)("div",{className:"flex items-center gap-2 mb-6",children:(0,t.jsxs)("div",{children:[(0,t.jsx)(r.Text,{className:"font-semibold text-gray-900",children:"Object Permissions"}),(0,t.jsx)(r.Text,{className:"text-xs text-gray-500",children:"Access control for Vector Stores and MCP Servers"})]})}),x]}):(0,t.jsxs)("div",{className:`${l}`,children:[(0,t.jsx)(r.Text,{className:"font-medium text-gray-900 mb-3",children:"Object Permissions"}),x]})}],384767)},738014,e=>{"use strict";var t=e.i(135214),r=e.i(764205),a=e.i(266027);let l=(0,e.i(243652).createQueryKeys)("users");e.s(["useCurrentUser",0,()=>{let{accessToken:e,userId:s}=(0,t.default)();return(0,a.useQuery)({queryKey:l.detail(s),queryFn:async()=>await (0,r.userGetInfoV2)(e),enabled:!!(e&&s)})}])},551332,e=>{"use strict";var t=e.i(271645);let r=t.forwardRef(function(e,r){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:r},e),t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8 5H6a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2v-1M8 5a2 2 0 002 2h2a2 2 0 002-2M8 5a2 2 0 012-2h2a2 2 0 012 2m0 0h2a2 2 0 012 2v3m2 4H10m0 0l3-3m-3 3l3 3"}))});e.s(["ClipboardCopyIcon",0,r],551332)},122577,e=>{"use strict";var t=e.i(271645);let r=t.forwardRef(function(e,r){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:r},e),t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M14.752 11.168l-3.197-2.132A1 1 0 0010 9.87v4.263a1 1 0 001.555.832l3.197-2.132a1 1 0 000-1.664z"}),t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M21 12a9 9 0 11-18 0 9 9 0 0118 0z"}))});e.s(["PlayIcon",0,r],122577)},902555,e=>{"use strict";var t=e.i(843476),r=e.i(591935),a=e.i(122577),l=e.i(278587),s=e.i(68155),n=e.i(360820),i=e.i(871943),o=e.i(434626),d=e.i(551332),c=e.i(592968),m=e.i(115504),u=e.i(752978);function g({icon:e,onClick:r,className:a,disabled:l,dataTestId:s}){return l?(0,t.jsx)(u.Icon,{icon:e,size:"sm",className:"opacity-50 cursor-not-allowed","data-testid":s}):(0,t.jsx)(u.Icon,{icon:e,size:"sm",onClick:r,className:(0,m.cx)("cursor-pointer",a),"data-testid":s})}let h={Edit:{icon:r.PencilAltIcon,className:"hover:text-blue-600"},Delete:{icon:s.TrashIcon,className:"hover:text-red-600"},Test:{icon:a.PlayIcon,className:"hover:text-blue-600"},Regenerate:{icon:l.RefreshIcon,className:"hover:text-green-600"},Up:{icon:n.ChevronUpIcon,className:"hover:text-blue-600"},Down:{icon:i.ChevronDownIcon,className:"hover:text-blue-600"},Open:{icon:o.ExternalLinkIcon,className:"hover:text-green-600"},Copy:{icon:d.ClipboardCopyIcon,className:"hover:text-blue-600"}};function p({onClick:e,tooltipText:r,disabled:a=!1,disabledTooltipText:l,dataTestId:s,variant:n}){let{icon:i,className:o}=h[n];return(0,t.jsx)(c.Tooltip,{title:a?l:r,children:(0,t.jsx)("span",{children:(0,t.jsx)(g,{icon:i,onClick:e,className:o,disabled:a,dataTestId:s})})})}e.s(["default",()=>p],902555)},434626,e=>{"use strict";var t=e.i(271645);let r=t.forwardRef(function(e,r){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:r},e),t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14"}))});e.s(["ExternalLinkIcon",0,r],434626)},591935,e=>{"use strict";var t=e.i(271645);let r=t.forwardRef(function(e,r){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:r},e),t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M11 5H6a2 2 0 00-2 2v11a2 2 0 002 2h11a2 2 0 002-2v-5m-1.414-9.414a2 2 0 112.828 2.828L11.828 15H9v-2.828l8.586-8.586z"}))});e.s(["PencilAltIcon",0,r],591935)},871943,e=>{"use strict";var t=e.i(271645);let r=t.forwardRef(function(e,r){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:r},e),t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 9l-7 7-7-7"}))});e.s(["ChevronDownIcon",0,r],871943)},360820,e=>{"use strict";var t=e.i(271645);let r=t.forwardRef(function(e,r){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:r},e),t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 15l7-7 7 7"}))});e.s(["ChevronUpIcon",0,r],360820)},185793,e=>{"use strict";e.i(247167);var t=e.i(271645),r=e.i(343794),a=e.i(242064),l=e.i(529681);let s=e=>{let{prefixCls:a,className:l,style:s,size:n,shape:i}=e,o=(0,r.default)({[`${a}-lg`]:"large"===n,[`${a}-sm`]:"small"===n}),d=(0,r.default)({[`${a}-circle`]:"circle"===i,[`${a}-square`]:"square"===i,[`${a}-round`]:"round"===i}),c=t.useMemo(()=>"number"==typeof n?{width:n,height:n,lineHeight:`${n}px`}:{},[n]);return t.createElement("span",{className:(0,r.default)(a,o,d,l),style:Object.assign(Object.assign({},c),s)})};e.i(296059);var n=e.i(694758),i=e.i(915654),o=e.i(246422),d=e.i(838378);let c=new n.Keyframes("ant-skeleton-loading",{"0%":{backgroundPosition:"100% 50%"},"100%":{backgroundPosition:"0 50%"}}),m=e=>({height:e,lineHeight:(0,i.unit)(e)}),u=e=>Object.assign({width:e},m(e)),g=(e,t)=>Object.assign({width:t(e).mul(5).equal(),minWidth:t(e).mul(5).equal()},m(e)),h=e=>Object.assign({width:e},m(e)),p=(e,t,r)=>{let{skeletonButtonCls:a}=e;return{[`${r}${a}-circle`]:{width:t,minWidth:t,borderRadius:"50%"},[`${r}${a}-round`]:{borderRadius:t}}},x=(e,t)=>Object.assign({width:t(e).mul(2).equal(),minWidth:t(e).mul(2).equal()},m(e)),f=(0,o.genStyleHooks)("Skeleton",e=>{let{componentCls:t,calc:r}=e;return(e=>{let{componentCls:t,skeletonAvatarCls:r,skeletonTitleCls:a,skeletonParagraphCls:l,skeletonButtonCls:s,skeletonInputCls:n,skeletonImageCls:i,controlHeight:o,controlHeightLG:d,controlHeightSM:m,gradientFromColor:f,padding:b,marginSM:v,borderRadius:w,titleHeight:j,blockRadius:y,paragraphLiHeight:C,controlHeightXS:k,paragraphMarginTop:N}=e;return{[t]:{display:"table",width:"100%",[`${t}-header`]:{display:"table-cell",paddingInlineEnd:b,verticalAlign:"top",[r]:Object.assign({display:"inline-block",verticalAlign:"top",background:f},u(o)),[`${r}-circle`]:{borderRadius:"50%"},[`${r}-lg`]:Object.assign({},u(d)),[`${r}-sm`]:Object.assign({},u(m))},[`${t}-content`]:{display:"table-cell",width:"100%",verticalAlign:"top",[a]:{width:"100%",height:j,background:f,borderRadius:y,[`+ ${l}`]:{marginBlockStart:m}},[l]:{padding:0,"> li":{width:"100%",height:C,listStyle:"none",background:f,borderRadius:y,"+ li":{marginBlockStart:k}}},[`${l}> li:last-child:not(:first-child):not(:nth-child(2))`]:{width:"61%"}},[`&-round ${t}-content`]:{[`${a}, ${l} > li`]:{borderRadius:w}}},[`${t}-with-avatar ${t}-content`]:{[a]:{marginBlockStart:v,[`+ ${l}`]:{marginBlockStart:N}}},[`${t}${t}-element`]:Object.assign(Object.assign(Object.assign(Object.assign({display:"inline-block",width:"auto"},(e=>{let{borderRadiusSM:t,skeletonButtonCls:r,controlHeight:a,controlHeightLG:l,controlHeightSM:s,gradientFromColor:n,calc:i}=e;return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({[r]:Object.assign({display:"inline-block",verticalAlign:"top",background:n,borderRadius:t,width:i(a).mul(2).equal(),minWidth:i(a).mul(2).equal()},x(a,i))},p(e,a,r)),{[`${r}-lg`]:Object.assign({},x(l,i))}),p(e,l,`${r}-lg`)),{[`${r}-sm`]:Object.assign({},x(s,i))}),p(e,s,`${r}-sm`))})(e)),(e=>{let{skeletonAvatarCls:t,gradientFromColor:r,controlHeight:a,controlHeightLG:l,controlHeightSM:s}=e;return{[t]:Object.assign({display:"inline-block",verticalAlign:"top",background:r},u(a)),[`${t}${t}-circle`]:{borderRadius:"50%"},[`${t}${t}-lg`]:Object.assign({},u(l)),[`${t}${t}-sm`]:Object.assign({},u(s))}})(e)),(e=>{let{controlHeight:t,borderRadiusSM:r,skeletonInputCls:a,controlHeightLG:l,controlHeightSM:s,gradientFromColor:n,calc:i}=e;return{[a]:Object.assign({display:"inline-block",verticalAlign:"top",background:n,borderRadius:r},g(t,i)),[`${a}-lg`]:Object.assign({},g(l,i)),[`${a}-sm`]:Object.assign({},g(s,i))}})(e)),(e=>{let{skeletonImageCls:t,imageSizeBase:r,gradientFromColor:a,borderRadiusSM:l,calc:s}=e;return{[t]:Object.assign(Object.assign({display:"inline-flex",alignItems:"center",justifyContent:"center",verticalAlign:"middle",background:a,borderRadius:l},h(s(r).mul(2).equal())),{[`${t}-path`]:{fill:"#bfbfbf"},[`${t}-svg`]:Object.assign(Object.assign({},h(r)),{maxWidth:s(r).mul(4).equal(),maxHeight:s(r).mul(4).equal()}),[`${t}-svg${t}-svg-circle`]:{borderRadius:"50%"}}),[`${t}${t}-circle`]:{borderRadius:"50%"}}})(e)),[`${t}${t}-block`]:{width:"100%",[s]:{width:"100%"},[n]:{width:"100%"}},[`${t}${t}-active`]:{[` +(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,625901,e=>{"use strict";var t=e.i(266027),r=e.i(621482),a=e.i(243652),l=e.i(764205),s=e.i(135214);let i=(0,a.createQueryKeys)("models"),n=(0,a.createQueryKeys)("modelHub"),o=(0,a.createQueryKeys)("allProxyModels");(0,a.createQueryKeys)("selectedTeamModels");let d=(0,a.createQueryKeys)("infiniteModels");e.s(["useAllProxyModels",0,()=>{let{accessToken:e,userId:r,userRole:a}=(0,s.default)();return(0,t.useQuery)({queryKey:o.list({}),queryFn:async()=>await (0,l.modelAvailableCall)(e,r,a,!0,null,!0,!1,"expand"),enabled:!!(e&&r&&a)})},"useInfiniteModelInfo",0,(e=50,t)=>{let{accessToken:a,userId:i,userRole:n}=(0,s.default)();return(0,r.useInfiniteQuery)({queryKey:d.list({filters:{...i&&{userId:i},...n&&{userRole:n},size:e,...t&&{search:t}}}),queryFn:async({pageParam:r})=>await (0,l.modelInfoCall)(a,i,n,r,e,t),initialPageParam:1,getNextPageParam:e=>{if(e.current_page{let{accessToken:e}=(0,s.default)();return(0,t.useQuery)({queryKey:n.list({}),queryFn:async()=>await (0,l.modelHubCall)(e),enabled:!!e})},"useModelsInfo",0,(e=1,r=50,a,n,o,d,c)=>{let{accessToken:m,userId:u,userRole:g}=(0,s.default)();return(0,t.useQuery)({queryKey:i.list({filters:{...u&&{userId:u},...g&&{userRole:g},page:e,size:r,...a&&{search:a},...n&&{modelId:n},...o&&{teamId:o},...d&&{sortBy:d},...c&&{sortOrder:c}}}),queryFn:async()=>await (0,l.modelInfoCall)(m,u,g,e,r,a,n,o,d,c),enabled:!!(m&&u&&g)})}])},599724,936325,e=>{"use strict";var t=e.i(95779),r=e.i(444755),a=e.i(673706),l=e.i(271645);let s=l.default.forwardRef((e,s)=>{let{color:i,className:n,children:o}=e;return l.default.createElement("p",{ref:s,className:(0,r.tremorTwMerge)("text-tremor-default",i?(0,a.getColorClassNames)(i,t.colorPalette.text).textColor:(0,r.tremorTwMerge)("text-tremor-content","dark:text-dark-tremor-content"),n)},o)});s.displayName="Text",e.s(["default",()=>s],936325),e.s(["Text",()=>s],599724)},994388,e=>{"use strict";var t=e.i(290571),r=e.i(829087),a=e.i(271645);let l=["preEnter","entering","entered","preExit","exiting","exited","unmounted"],s=e=>({_s:e,status:l[e],isEnter:e<3,isMounted:6!==e,isResolved:2===e||e>4}),i=e=>e?6:5,n=(e,t,r,a,l)=>{clearTimeout(a.current);let i=s(e);t(i),r.current=i,l&&l({current:i})};var o=e.i(480731),d=e.i(444755),c=e.i(673706);let m=e=>{var r=(0,t.__rest)(e,[]);return a.default.createElement("svg",Object.assign({},r,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor"}),a.default.createElement("path",{fill:"none",d:"M0 0h24v24H0z"}),a.default.createElement("path",{d:"M18.364 5.636L16.95 7.05A7 7 0 1 0 19 12h2a9 9 0 1 1-2.636-6.364z"}))};var u=e.i(95779);let g={xs:{height:"h-4",width:"w-4"},sm:{height:"h-5",width:"w-5"},md:{height:"h-5",width:"w-5"},lg:{height:"h-6",width:"w-6"},xl:{height:"h-6",width:"w-6"}},h=(e,t)=>{switch(e){case"primary":return{textColor:t?(0,c.getColorClassNames)("white").textColor:"text-tremor-brand-inverted dark:text-dark-tremor-brand-inverted",hoverTextColor:t?(0,c.getColorClassNames)("white").textColor:"text-tremor-brand-inverted dark:text-dark-tremor-brand-inverted",bgColor:t?(0,c.getColorClassNames)(t,u.colorPalette.background).bgColor:"bg-tremor-brand dark:bg-dark-tremor-brand",hoverBgColor:t?(0,c.getColorClassNames)(t,u.colorPalette.darkBackground).hoverBgColor:"hover:bg-tremor-brand-emphasis dark:hover:bg-dark-tremor-brand-emphasis",borderColor:t?(0,c.getColorClassNames)(t,u.colorPalette.border).borderColor:"border-tremor-brand dark:border-dark-tremor-brand",hoverBorderColor:t?(0,c.getColorClassNames)(t,u.colorPalette.darkBorder).hoverBorderColor:"hover:border-tremor-brand-emphasis dark:hover:border-dark-tremor-brand-emphasis"};case"secondary":return{textColor:t?(0,c.getColorClassNames)(t,u.colorPalette.text).textColor:"text-tremor-brand dark:text-dark-tremor-brand",hoverTextColor:t?(0,c.getColorClassNames)(t,u.colorPalette.text).textColor:"hover:text-tremor-brand-emphasis dark:hover:text-dark-tremor-brand-emphasis",bgColor:(0,c.getColorClassNames)("transparent").bgColor,hoverBgColor:t?(0,d.tremorTwMerge)((0,c.getColorClassNames)(t,u.colorPalette.background).hoverBgColor,"hover:bg-opacity-20 dark:hover:bg-opacity-20"):"hover:bg-tremor-brand-faint dark:hover:bg-dark-tremor-brand-faint",borderColor:t?(0,c.getColorClassNames)(t,u.colorPalette.border).borderColor:"border-tremor-brand dark:border-dark-tremor-brand"};case"light":return{textColor:t?(0,c.getColorClassNames)(t,u.colorPalette.text).textColor:"text-tremor-brand dark:text-dark-tremor-brand",hoverTextColor:t?(0,c.getColorClassNames)(t,u.colorPalette.darkText).hoverTextColor:"hover:text-tremor-brand-emphasis dark:hover:text-dark-tremor-brand-emphasis",bgColor:(0,c.getColorClassNames)("transparent").bgColor,borderColor:"",hoverBorderColor:""}}},p=(0,c.makeClassName)("Button"),x=({loading:e,iconSize:t,iconPosition:r,Icon:l,needMargin:s,transitionStatus:i})=>{let n=s?r===o.HorizontalPositions.Left?(0,d.tremorTwMerge)("-ml-1","mr-1.5"):(0,d.tremorTwMerge)("-mr-1","ml-1.5"):"",c=(0,d.tremorTwMerge)("w-0 h-0"),u={default:c,entering:c,entered:t,exiting:t,exited:c};return e?a.default.createElement(m,{className:(0,d.tremorTwMerge)(p("icon"),"animate-spin shrink-0",n,u.default,u[i]),style:{transition:"width 150ms"}}):a.default.createElement(l,{className:(0,d.tremorTwMerge)(p("icon"),"shrink-0",t,n)})},f=a.default.forwardRef((e,l)=>{let{icon:m,iconPosition:u=o.HorizontalPositions.Left,size:f=o.Sizes.SM,color:b,variant:v="primary",disabled:w,loading:j=!1,loadingText:y,children:C,tooltip:k,className:N}=e,T=(0,t.__rest)(e,["icon","iconPosition","size","color","variant","disabled","loading","loadingText","children","tooltip","className"]),$=j||w,E=void 0!==m||j,M=j&&y,O=!(!C&&!M),_=(0,d.tremorTwMerge)(g[f].height,g[f].width),S="light"!==v?(0,d.tremorTwMerge)("rounded-tremor-default border","shadow-tremor-input","dark:shadow-dark-tremor-input"):"",I=h(v,b),R=("light"!==v?{xs:{paddingX:"px-2.5",paddingY:"py-1.5",fontSize:"text-xs"},sm:{paddingX:"px-4",paddingY:"py-2",fontSize:"text-sm"},md:{paddingX:"px-4",paddingY:"py-2",fontSize:"text-md"},lg:{paddingX:"px-4",paddingY:"py-2.5",fontSize:"text-lg"},xl:{paddingX:"px-4",paddingY:"py-3",fontSize:"text-xl"}}:{xs:{paddingX:"",paddingY:"",fontSize:"text-xs"},sm:{paddingX:"",paddingY:"",fontSize:"text-sm"},md:{paddingX:"",paddingY:"",fontSize:"text-md"},lg:{paddingX:"",paddingY:"",fontSize:"text-lg"},xl:{paddingX:"",paddingY:"",fontSize:"text-xl"}})[f],{tooltipProps:P,getReferenceProps:A}=(0,r.useTooltip)(300),[z,B]=(({enter:e=!0,exit:t=!0,preEnter:r,preExit:l,timeout:o,initialEntered:d,mountOnEnter:c,unmountOnExit:m,onStateChange:u}={})=>{let[g,h]=(0,a.useState)(()=>s(d?2:i(c))),p=(0,a.useRef)(g),x=(0,a.useRef)(0),[f,b]="object"==typeof o?[o.enter,o.exit]:[o,o],v=(0,a.useCallback)(()=>{let e=((e,t)=>{switch(e){case 1:case 0:return 2;case 4:case 3:return i(t)}})(p.current._s,m);e&&n(e,h,p,x,u)},[u,m]);return[g,(0,a.useCallback)(a=>{let s=e=>{switch(n(e,h,p,x,u),e){case 1:f>=0&&(x.current=((...e)=>setTimeout(...e))(v,f));break;case 4:b>=0&&(x.current=((...e)=>setTimeout(...e))(v,b));break;case 0:case 3:x.current=((...e)=>setTimeout(...e))(()=>{isNaN(document.body.offsetTop)||s(e+1)},0)}},o=p.current.isEnter;"boolean"!=typeof a&&(a=!o),a?o||s(e?+!r:2):o&&s(t?l?3:4:i(m))},[v,u,e,t,r,l,f,b,m]),v]})({timeout:50});return(0,a.useEffect)(()=>{B(j)},[j]),a.default.createElement("button",Object.assign({ref:(0,c.mergeRefs)([l,P.refs.setReference]),className:(0,d.tremorTwMerge)(p("root"),"shrink-0 inline-flex justify-center items-center group font-medium outline-none",S,R.paddingX,R.paddingY,R.fontSize,I.textColor,I.bgColor,I.borderColor,I.hoverBorderColor,$?"opacity-50 cursor-not-allowed":(0,d.tremorTwMerge)(h(v,b).hoverTextColor,h(v,b).hoverBgColor,h(v,b).hoverBorderColor),N),disabled:$},A,T),a.default.createElement(r.default,Object.assign({text:k},P)),E&&u!==o.HorizontalPositions.Right?a.default.createElement(x,{loading:j,iconSize:_,iconPosition:u,Icon:m,transitionStatus:z.status,needMargin:O}):null,M||C?a.default.createElement("span",{className:(0,d.tremorTwMerge)(p("text"),"text-tremor-default whitespace-nowrap")},M?y:C):null,E&&u===o.HorizontalPositions.Right?a.default.createElement(x,{loading:j,iconSize:_,iconPosition:u,Icon:m,transitionStatus:z.status,needMargin:O}):null)});f.displayName="Button",e.s(["Button",()=>f],994388)},304967,e=>{"use strict";var t=e.i(290571),r=e.i(271645),a=e.i(480731),l=e.i(95779),s=e.i(444755),i=e.i(673706);let n=(0,i.makeClassName)("Card"),o=r.default.forwardRef((e,o)=>{let{decoration:d="",decorationColor:c,children:m,className:u}=e,g=(0,t.__rest)(e,["decoration","decorationColor","children","className"]);return r.default.createElement("div",Object.assign({ref:o,className:(0,s.tremorTwMerge)(n("root"),"relative w-full text-left ring-1 rounded-tremor-default p-6","bg-tremor-background ring-tremor-ring shadow-tremor-card","dark:bg-dark-tremor-background dark:ring-dark-tremor-ring dark:shadow-dark-tremor-card",c?(0,i.getColorClassNames)(c,l.colorPalette.border).borderColor:"border-tremor-brand dark:border-dark-tremor-brand",(e=>{if(!e)return"";switch(e){case a.HorizontalPositions.Left:return"border-l-4";case a.VerticalPositions.Top:return"border-t-4";case a.HorizontalPositions.Right:return"border-r-4";case a.VerticalPositions.Bottom:return"border-b-4";default:return""}})(d),u)},g),m)});o.displayName="Card",e.s(["Card",()=>o],304967)},629569,e=>{"use strict";var t=e.i(290571),r=e.i(95779),a=e.i(444755),l=e.i(673706),s=e.i(271645);let i=s.default.forwardRef((e,i)=>{let{color:n,children:o,className:d}=e,c=(0,t.__rest)(e,["color","children","className"]);return s.default.createElement("p",Object.assign({ref:i,className:(0,a.tremorTwMerge)("font-medium text-tremor-title",n?(0,l.getColorClassNames)(n,r.colorPalette.darkText).textColor:"text-tremor-content-strong dark:text-dark-tremor-content-strong",d)},c),o)});i.displayName="Title",e.s(["Title",()=>i],629569)},653496,e=>{"use strict";var t=e.i(721369);e.s(["Tabs",()=>t.default])},292639,e=>{"use strict";var t=e.i(764205),r=e.i(266027);let a=(0,e.i(243652).createQueryKeys)("uiSettings");e.s(["useUISettings",0,()=>(0,r.useQuery)({queryKey:a.list({}),queryFn:async()=>await (0,t.getUiSettings)(),staleTime:36e5,gcTime:36e5})])},250980,e=>{"use strict";var t=e.i(271645);let r=t.forwardRef(function(e,r){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:r},e),t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 9v3m0 0v3m0-3h3m-3 0H9m12 0a9 9 0 11-18 0 9 9 0 0118 0z"}))});e.s(["PlusCircleIcon",0,r],250980)},502547,e=>{"use strict";var t=e.i(271645);let r=t.forwardRef(function(e,r){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:r},e),t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 5l7 7-7 7"}))});e.s(["ChevronRightIcon",0,r],502547)},384767,e=>{"use strict";var t=e.i(843476),r=e.i(599724),a=e.i(271645),l=e.i(389083);let s=a.forwardRef(function(e,t){return a.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:t},e),a.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 7v10c0 2.21 3.582 4 8 4s8-1.79 8-4V7M4 7c0 2.21 3.582 4 8 4s8-1.79 8-4M4 7c0-2.21 3.582-4 8-4s8 1.79 8 4m0 5c0 2.21-3.582 4-8 4s-8-1.79-8-4"}))});var i=e.i(764205);let n=function({vectorStores:e,accessToken:n}){let[o,d]=(0,a.useState)([]);return(0,a.useEffect)(()=>{(async()=>{if(n&&0!==e.length)try{let e=await (0,i.vectorStoreListCall)(n);e.data&&d(e.data.map(e=>({vector_store_id:e.vector_store_id,vector_store_name:e.vector_store_name})))}catch(e){console.error("Error fetching vector stores:",e)}})()},[n,e.length]),(0,t.jsxs)("div",{className:"space-y-3",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(s,{className:"h-4 w-4 text-blue-600"}),(0,t.jsx)(r.Text,{className:"font-semibold text-gray-900",children:"Vector Stores"}),(0,t.jsx)(l.Badge,{color:"blue",size:"xs",children:e.length})]}),e.length>0?(0,t.jsx)("div",{className:"flex flex-wrap gap-2",children:e.map((e,r)=>{let a;return(0,t.jsx)("div",{className:"inline-flex items-center px-3 py-1.5 rounded-lg bg-blue-50 border border-blue-200 text-blue-800 text-sm font-medium",children:(a=o.find(t=>t.vector_store_id===e))?`${a.vector_store_name||a.vector_store_id} (${a.vector_store_id})`:e},r)})}):(0,t.jsxs)("div",{className:"flex items-center gap-2 px-3 py-2 rounded-lg bg-gray-50 border border-gray-200",children:[(0,t.jsx)(s,{className:"h-4 w-4 text-gray-400"}),(0,t.jsx)(r.Text,{className:"text-gray-500 text-sm",children:"No vector stores configured"})]})]})},o=a.forwardRef(function(e,t){return a.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:t},e),a.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 12h14M5 12a2 2 0 01-2-2V6a2 2 0 012-2h14a2 2 0 012 2v4a2 2 0 01-2 2M5 12a2 2 0 00-2 2v4a2 2 0 002 2h14a2 2 0 002-2v-4a2 2 0 00-2-2m-2-4h.01M17 16h.01"}))});var d=e.i(871943),c=e.i(502547),m=e.i(592968);let u=function({mcpServers:e,mcpAccessGroups:s=[],mcpToolPermissions:n={},mcpToolsets:u=[],accessToken:g}){let[h,p]=(0,a.useState)([]),[x,f]=(0,a.useState)([]),[b,v]=(0,a.useState)(new Set),[w,j]=(0,a.useState)(new Set);(0,a.useEffect)(()=>{(async()=>{if(g&&e.length>0)try{let e=await (0,i.fetchMCPServers)(g);e&&Array.isArray(e)?p(e):e.data&&Array.isArray(e.data)&&p(e.data)}catch(e){console.error("Error fetching MCP servers:",e)}})()},[g,e.length]),(0,a.useEffect)(()=>{(async()=>{if(g&&u.length>0)try{let e=await (0,i.fetchMCPToolsets)(g),t=Array.isArray(e)?e.filter(e=>u.includes(e.toolset_id)):[];f(t)}catch(e){console.error("Error fetching toolsets:",e)}})()},[g,u.length]);let y=[...e.map(e=>({type:"server",value:e})),...s.map(e=>({type:"accessGroup",value:e}))],C=y.length+u.length;return(0,t.jsxs)("div",{className:"space-y-3",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(o,{className:"h-4 w-4 text-blue-600"}),(0,t.jsx)(r.Text,{className:"font-semibold text-gray-900",children:"MCP Servers"}),(0,t.jsx)(l.Badge,{color:"blue",size:"xs",children:C})]}),C>0?(0,t.jsxs)("div",{className:"max-h-[400px] overflow-y-auto space-y-2 pr-1",children:[y.map((e,r)=>{let a="server"===e.type?n[e.value]:void 0,l=a&&a.length>0,s=b.has(e.value);return(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsxs)("div",{onClick:()=>{var t;return l&&(t=e.value,void v(e=>{let r=new Set(e);return r.has(t)?r.delete(t):r.add(t),r}))},className:`flex items-center gap-3 py-2 px-3 rounded-lg border border-gray-200 transition-all ${l?"cursor-pointer hover:bg-gray-50 hover:border-gray-300":"bg-white"}`,children:[(0,t.jsx)("div",{className:"flex items-center gap-2 flex-1 min-w-0",children:"server"===e.type?(0,t.jsx)(m.Tooltip,{title:`Full ID: ${e.value}`,placement:"top",children:(0,t.jsxs)("div",{className:"inline-flex items-center gap-2 min-w-0",children:[(0,t.jsx)("span",{className:"inline-block w-1.5 h-1.5 bg-blue-500 rounded-full flex-shrink-0"}),(0,t.jsx)("span",{className:"text-sm font-medium text-gray-900 truncate",children:(e=>{let t=h.find(t=>t.server_id===e);if(t){let r=e.length>7?`${e.slice(0,3)}...${e.slice(-4)}`:e;return`${t.alias} (${r})`}return e})(e.value)})]})}):(0,t.jsxs)("div",{className:"inline-flex items-center gap-2 min-w-0",children:[(0,t.jsx)("span",{className:"inline-block w-1.5 h-1.5 bg-green-500 rounded-full flex-shrink-0"}),(0,t.jsx)("span",{className:"text-sm font-medium text-gray-900 truncate",children:e.value}),(0,t.jsx)("span",{className:"ml-1 px-1.5 py-0.5 text-[9px] font-semibold text-green-600 bg-green-50 border border-green-200 rounded uppercase tracking-wide flex-shrink-0",children:"Group"})]})}),l&&(0,t.jsxs)("div",{className:"flex items-center gap-1 flex-shrink-0 whitespace-nowrap",children:[(0,t.jsx)("span",{className:"text-xs font-medium text-gray-600",children:a.length}),(0,t.jsx)("span",{className:"text-xs text-gray-500",children:1===a.length?"tool":"tools"}),s?(0,t.jsx)(d.ChevronDownIcon,{className:"h-3.5 w-3.5 text-gray-400 ml-0.5"}):(0,t.jsx)(c.ChevronRightIcon,{className:"h-3.5 w-3.5 text-gray-400 ml-0.5"})]})]}),l&&s&&(0,t.jsx)("div",{className:"ml-4 pl-4 border-l-2 border-blue-200 pb-1",children:(0,t.jsx)("div",{className:"flex flex-wrap gap-1.5",children:a.map((e,r)=>(0,t.jsx)("span",{className:"inline-flex items-center px-2.5 py-1 rounded-lg bg-blue-50 border border-blue-200 text-blue-800 text-xs font-medium",children:e},r))})})]},r)}),u.length>0&&u.map((e,r)=>{let a=x.find(t=>t.toolset_id===e),l=w.has(e),s=a?.tools.length??0;return(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsxs)("div",{onClick:()=>s>0&&void j(t=>{let r=new Set(t);return r.has(e)?r.delete(e):r.add(e),r}),className:`flex items-center gap-3 py-2 px-3 rounded-lg border border-purple-200 transition-all ${s>0?"cursor-pointer hover:bg-purple-50 hover:border-purple-300":"bg-white"}`,children:[(0,t.jsxs)("div",{className:"flex items-center gap-2 flex-1 min-w-0",children:[(0,t.jsx)("span",{className:"inline-block w-1.5 h-1.5 bg-purple-500 rounded-full flex-shrink-0"}),(0,t.jsx)("span",{className:"text-sm font-medium text-gray-900 truncate",children:a?.toolset_name??e}),(0,t.jsx)("span",{className:"ml-1 px-1.5 py-0.5 text-[9px] font-semibold text-purple-600 bg-purple-50 border border-purple-200 rounded uppercase tracking-wide flex-shrink-0",children:"Toolset"})]}),s>0&&(0,t.jsxs)("div",{className:"flex items-center gap-1 flex-shrink-0 whitespace-nowrap",children:[(0,t.jsx)("span",{className:"text-xs font-medium text-gray-600",children:s}),(0,t.jsx)("span",{className:"text-xs text-gray-500",children:1===s?"tool":"tools"}),l?(0,t.jsx)(d.ChevronDownIcon,{className:"h-3.5 w-3.5 text-gray-400 ml-0.5"}):(0,t.jsx)(c.ChevronRightIcon,{className:"h-3.5 w-3.5 text-gray-400 ml-0.5"})]})]}),s>0&&l&&a&&(0,t.jsx)("div",{className:"ml-4 pl-4 border-l-2 border-purple-200 pb-1",children:(0,t.jsx)("div",{className:"flex flex-wrap gap-1.5",children:a.tools.map((e,r)=>(0,t.jsxs)("span",{className:"inline-flex items-center px-2.5 py-1 rounded-lg bg-purple-50 border border-purple-200 text-purple-800 text-xs font-medium",children:[(0,t.jsxs)("span",{className:"text-purple-400 mr-1 text-[10px]",children:[e.server_id.slice(0,6),"…"]}),e.tool_name]},r))})})]},`toolset-${r}`)})]}):(0,t.jsxs)("div",{className:"flex items-center gap-2 px-3 py-2 rounded-lg bg-gray-50 border border-gray-200",children:[(0,t.jsx)(o,{className:"h-4 w-4 text-gray-400"}),(0,t.jsx)(r.Text,{className:"text-gray-500 text-sm",children:"No MCP servers, access groups, or toolsets configured"})]})]})},g=a.forwardRef(function(e,t){return a.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:t},e),a.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M17 20h5v-2a3 3 0 00-5.356-1.857M17 20H7m10 0v-2c0-.656-.126-1.283-.356-1.857M7 20H2v-2a3 3 0 015.356-1.857M7 20v-2c0-.656.126-1.283.356-1.857m0 0a5.002 5.002 0 019.288 0M15 7a3 3 0 11-6 0 3 3 0 016 0zm6 3a2 2 0 11-4 0 2 2 0 014 0zM7 10a2 2 0 11-4 0 2 2 0 014 0z"}))}),h=function({agents:e,agentAccessGroups:s=[],accessToken:n}){let[o,d]=(0,a.useState)([]);(0,a.useEffect)(()=>{(async()=>{if(n&&e.length>0)try{let e=await (0,i.getAgentsList)(n);e&&e.agents&&Array.isArray(e.agents)&&d(e.agents)}catch(e){console.error("Error fetching agents:",e)}})()},[n,e.length]);let c=[...e.map(e=>({type:"agent",value:e})),...s.map(e=>({type:"accessGroup",value:e}))],u=c.length;return(0,t.jsxs)("div",{className:"space-y-3",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(g,{className:"h-4 w-4 text-purple-600"}),(0,t.jsx)(r.Text,{className:"font-semibold text-gray-900",children:"Agents"}),(0,t.jsx)(l.Badge,{color:"purple",size:"xs",children:u})]}),u>0?(0,t.jsx)("div",{className:"max-h-[400px] overflow-y-auto space-y-2 pr-1",children:c.map((e,r)=>(0,t.jsx)("div",{className:"space-y-2",children:(0,t.jsx)("div",{className:"flex items-center gap-3 py-2 px-3 rounded-lg border border-gray-200 bg-white",children:(0,t.jsx)("div",{className:"flex items-center gap-2 flex-1 min-w-0",children:"agent"===e.type?(0,t.jsx)(m.Tooltip,{title:`Full ID: ${e.value}`,placement:"top",children:(0,t.jsxs)("div",{className:"inline-flex items-center gap-2 min-w-0",children:[(0,t.jsx)("span",{className:"inline-block w-1.5 h-1.5 bg-purple-500 rounded-full flex-shrink-0"}),(0,t.jsx)("span",{className:"text-sm font-medium text-gray-900 truncate",children:(e=>{let t=o.find(t=>t.agent_id===e);if(t){let r=e.length>7?`${e.slice(0,3)}...${e.slice(-4)}`:e;return`${t.agent_name} (${r})`}return e})(e.value)})]})}):(0,t.jsxs)("div",{className:"inline-flex items-center gap-2 min-w-0",children:[(0,t.jsx)("span",{className:"inline-block w-1.5 h-1.5 bg-green-500 rounded-full flex-shrink-0"}),(0,t.jsx)("span",{className:"text-sm font-medium text-gray-900 truncate",children:e.value}),(0,t.jsx)("span",{className:"ml-1 px-1.5 py-0.5 text-[9px] font-semibold text-green-600 bg-green-50 border border-green-200 rounded uppercase tracking-wide flex-shrink-0",children:"Group"})]})})})},r))}):(0,t.jsxs)("div",{className:"flex items-center gap-2 px-3 py-2 rounded-lg bg-gray-50 border border-gray-200",children:[(0,t.jsx)(g,{className:"h-4 w-4 text-gray-400"}),(0,t.jsx)(r.Text,{className:"text-gray-500 text-sm",children:"No agents or access groups configured"})]})]})};e.s(["default",0,function({objectPermission:e,variant:a="card",className:l="",accessToken:s}){let i=e?.vector_stores||[],o=e?.mcp_servers||[],d=e?.mcp_access_groups||[],c=e?.mcp_tool_permissions||{},m=e?.mcp_toolsets||[],g=e?.agents||[],p=e?.agent_access_groups||[],x=(0,t.jsxs)("div",{className:"card"===a?"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6":"space-y-4",children:[(0,t.jsx)(n,{vectorStores:i,accessToken:s}),(0,t.jsx)(u,{mcpServers:o,mcpAccessGroups:d,mcpToolPermissions:c,mcpToolsets:m,accessToken:s}),(0,t.jsx)(h,{agents:g,agentAccessGroups:p,accessToken:s})]});return"card"===a?(0,t.jsxs)("div",{className:`bg-white border border-gray-200 rounded-lg p-6 ${l}`,children:[(0,t.jsx)("div",{className:"flex items-center gap-2 mb-6",children:(0,t.jsxs)("div",{children:[(0,t.jsx)(r.Text,{className:"font-semibold text-gray-900",children:"Object Permissions"}),(0,t.jsx)(r.Text,{className:"text-xs text-gray-500",children:"Access control for Vector Stores and MCP Servers"})]})}),x]}):(0,t.jsxs)("div",{className:`${l}`,children:[(0,t.jsx)(r.Text,{className:"font-medium text-gray-900 mb-3",children:"Object Permissions"}),x]})}],384767)},738014,e=>{"use strict";var t=e.i(135214),r=e.i(764205),a=e.i(266027);let l=(0,e.i(243652).createQueryKeys)("users");e.s(["useCurrentUser",0,()=>{let{accessToken:e,userId:s}=(0,t.default)();return(0,a.useQuery)({queryKey:l.detail(s),queryFn:async()=>await (0,r.userGetInfoV2)(e),enabled:!!(e&&s)})}])},551332,e=>{"use strict";var t=e.i(271645);let r=t.forwardRef(function(e,r){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:r},e),t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8 5H6a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2v-1M8 5a2 2 0 002 2h2a2 2 0 002-2M8 5a2 2 0 012-2h2a2 2 0 012 2m0 0h2a2 2 0 012 2v3m2 4H10m0 0l3-3m-3 3l3 3"}))});e.s(["ClipboardCopyIcon",0,r],551332)},122577,e=>{"use strict";var t=e.i(271645);let r=t.forwardRef(function(e,r){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:r},e),t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M14.752 11.168l-3.197-2.132A1 1 0 0010 9.87v4.263a1 1 0 001.555.832l3.197-2.132a1 1 0 000-1.664z"}),t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M21 12a9 9 0 11-18 0 9 9 0 0118 0z"}))});e.s(["PlayIcon",0,r],122577)},902555,e=>{"use strict";var t=e.i(843476),r=e.i(591935),a=e.i(122577),l=e.i(278587),s=e.i(68155),i=e.i(360820),n=e.i(871943),o=e.i(434626),d=e.i(551332),c=e.i(592968),m=e.i(115504),u=e.i(752978);function g({icon:e,onClick:r,className:a,disabled:l,dataTestId:s}){return l?(0,t.jsx)(u.Icon,{icon:e,size:"sm",className:"opacity-50 cursor-not-allowed","data-testid":s}):(0,t.jsx)(u.Icon,{icon:e,size:"sm",onClick:r,className:(0,m.cx)("cursor-pointer",a),"data-testid":s})}let h={Edit:{icon:r.PencilAltIcon,className:"hover:text-blue-600"},Delete:{icon:s.TrashIcon,className:"hover:text-red-600"},Test:{icon:a.PlayIcon,className:"hover:text-blue-600"},Regenerate:{icon:l.RefreshIcon,className:"hover:text-green-600"},Up:{icon:i.ChevronUpIcon,className:"hover:text-blue-600"},Down:{icon:n.ChevronDownIcon,className:"hover:text-blue-600"},Open:{icon:o.ExternalLinkIcon,className:"hover:text-green-600"},Copy:{icon:d.ClipboardCopyIcon,className:"hover:text-blue-600"}};function p({onClick:e,tooltipText:r,disabled:a=!1,disabledTooltipText:l,dataTestId:s,variant:i}){let{icon:n,className:o}=h[i];return(0,t.jsx)(c.Tooltip,{title:a?l:r,children:(0,t.jsx)("span",{children:(0,t.jsx)(g,{icon:n,onClick:e,className:o,disabled:a,dataTestId:s})})})}e.s(["default",()=>p],902555)},434626,e=>{"use strict";var t=e.i(271645);let r=t.forwardRef(function(e,r){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:r},e),t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14"}))});e.s(["ExternalLinkIcon",0,r],434626)},591935,e=>{"use strict";var t=e.i(271645);let r=t.forwardRef(function(e,r){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:r},e),t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M11 5H6a2 2 0 00-2 2v11a2 2 0 002 2h11a2 2 0 002-2v-5m-1.414-9.414a2 2 0 112.828 2.828L11.828 15H9v-2.828l8.586-8.586z"}))});e.s(["PencilAltIcon",0,r],591935)},871943,e=>{"use strict";var t=e.i(271645);let r=t.forwardRef(function(e,r){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:r},e),t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 9l-7 7-7-7"}))});e.s(["ChevronDownIcon",0,r],871943)},360820,e=>{"use strict";var t=e.i(271645);let r=t.forwardRef(function(e,r){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:r},e),t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 15l7-7 7 7"}))});e.s(["ChevronUpIcon",0,r],360820)},185793,e=>{"use strict";e.i(247167);var t=e.i(271645),r=e.i(343794),a=e.i(242064),l=e.i(529681);let s=e=>{let{prefixCls:a,className:l,style:s,size:i,shape:n}=e,o=(0,r.default)({[`${a}-lg`]:"large"===i,[`${a}-sm`]:"small"===i}),d=(0,r.default)({[`${a}-circle`]:"circle"===n,[`${a}-square`]:"square"===n,[`${a}-round`]:"round"===n}),c=t.useMemo(()=>"number"==typeof i?{width:i,height:i,lineHeight:`${i}px`}:{},[i]);return t.createElement("span",{className:(0,r.default)(a,o,d,l),style:Object.assign(Object.assign({},c),s)})};e.i(296059);var i=e.i(694758),n=e.i(915654),o=e.i(246422),d=e.i(838378);let c=new i.Keyframes("ant-skeleton-loading",{"0%":{backgroundPosition:"100% 50%"},"100%":{backgroundPosition:"0 50%"}}),m=e=>({height:e,lineHeight:(0,n.unit)(e)}),u=e=>Object.assign({width:e},m(e)),g=(e,t)=>Object.assign({width:t(e).mul(5).equal(),minWidth:t(e).mul(5).equal()},m(e)),h=e=>Object.assign({width:e},m(e)),p=(e,t,r)=>{let{skeletonButtonCls:a}=e;return{[`${r}${a}-circle`]:{width:t,minWidth:t,borderRadius:"50%"},[`${r}${a}-round`]:{borderRadius:t}}},x=(e,t)=>Object.assign({width:t(e).mul(2).equal(),minWidth:t(e).mul(2).equal()},m(e)),f=(0,o.genStyleHooks)("Skeleton",e=>{let{componentCls:t,calc:r}=e;return(e=>{let{componentCls:t,skeletonAvatarCls:r,skeletonTitleCls:a,skeletonParagraphCls:l,skeletonButtonCls:s,skeletonInputCls:i,skeletonImageCls:n,controlHeight:o,controlHeightLG:d,controlHeightSM:m,gradientFromColor:f,padding:b,marginSM:v,borderRadius:w,titleHeight:j,blockRadius:y,paragraphLiHeight:C,controlHeightXS:k,paragraphMarginTop:N}=e;return{[t]:{display:"table",width:"100%",[`${t}-header`]:{display:"table-cell",paddingInlineEnd:b,verticalAlign:"top",[r]:Object.assign({display:"inline-block",verticalAlign:"top",background:f},u(o)),[`${r}-circle`]:{borderRadius:"50%"},[`${r}-lg`]:Object.assign({},u(d)),[`${r}-sm`]:Object.assign({},u(m))},[`${t}-content`]:{display:"table-cell",width:"100%",verticalAlign:"top",[a]:{width:"100%",height:j,background:f,borderRadius:y,[`+ ${l}`]:{marginBlockStart:m}},[l]:{padding:0,"> li":{width:"100%",height:C,listStyle:"none",background:f,borderRadius:y,"+ li":{marginBlockStart:k}}},[`${l}> li:last-child:not(:first-child):not(:nth-child(2))`]:{width:"61%"}},[`&-round ${t}-content`]:{[`${a}, ${l} > li`]:{borderRadius:w}}},[`${t}-with-avatar ${t}-content`]:{[a]:{marginBlockStart:v,[`+ ${l}`]:{marginBlockStart:N}}},[`${t}${t}-element`]:Object.assign(Object.assign(Object.assign(Object.assign({display:"inline-block",width:"auto"},(e=>{let{borderRadiusSM:t,skeletonButtonCls:r,controlHeight:a,controlHeightLG:l,controlHeightSM:s,gradientFromColor:i,calc:n}=e;return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({[r]:Object.assign({display:"inline-block",verticalAlign:"top",background:i,borderRadius:t,width:n(a).mul(2).equal(),minWidth:n(a).mul(2).equal()},x(a,n))},p(e,a,r)),{[`${r}-lg`]:Object.assign({},x(l,n))}),p(e,l,`${r}-lg`)),{[`${r}-sm`]:Object.assign({},x(s,n))}),p(e,s,`${r}-sm`))})(e)),(e=>{let{skeletonAvatarCls:t,gradientFromColor:r,controlHeight:a,controlHeightLG:l,controlHeightSM:s}=e;return{[t]:Object.assign({display:"inline-block",verticalAlign:"top",background:r},u(a)),[`${t}${t}-circle`]:{borderRadius:"50%"},[`${t}${t}-lg`]:Object.assign({},u(l)),[`${t}${t}-sm`]:Object.assign({},u(s))}})(e)),(e=>{let{controlHeight:t,borderRadiusSM:r,skeletonInputCls:a,controlHeightLG:l,controlHeightSM:s,gradientFromColor:i,calc:n}=e;return{[a]:Object.assign({display:"inline-block",verticalAlign:"top",background:i,borderRadius:r},g(t,n)),[`${a}-lg`]:Object.assign({},g(l,n)),[`${a}-sm`]:Object.assign({},g(s,n))}})(e)),(e=>{let{skeletonImageCls:t,imageSizeBase:r,gradientFromColor:a,borderRadiusSM:l,calc:s}=e;return{[t]:Object.assign(Object.assign({display:"inline-flex",alignItems:"center",justifyContent:"center",verticalAlign:"middle",background:a,borderRadius:l},h(s(r).mul(2).equal())),{[`${t}-path`]:{fill:"#bfbfbf"},[`${t}-svg`]:Object.assign(Object.assign({},h(r)),{maxWidth:s(r).mul(4).equal(),maxHeight:s(r).mul(4).equal()}),[`${t}-svg${t}-svg-circle`]:{borderRadius:"50%"}}),[`${t}${t}-circle`]:{borderRadius:"50%"}}})(e)),[`${t}${t}-block`]:{width:"100%",[s]:{width:"100%"},[i]:{width:"100%"}},[`${t}${t}-active`]:{[` ${a}, ${l} > li, ${r}, ${s}, - ${n}, - ${i} - `]:Object.assign({},{background:e.skeletonLoadingBackground,backgroundSize:"400% 100%",animationName:c,animationDuration:e.skeletonLoadingMotionDuration,animationTimingFunction:"ease",animationIterationCount:"infinite"})}}})((0,d.mergeToken)(e,{skeletonAvatarCls:`${t}-avatar`,skeletonTitleCls:`${t}-title`,skeletonParagraphCls:`${t}-paragraph`,skeletonButtonCls:`${t}-button`,skeletonInputCls:`${t}-input`,skeletonImageCls:`${t}-image`,imageSizeBase:r(e.controlHeight).mul(1.5).equal(),borderRadius:100,skeletonLoadingBackground:`linear-gradient(90deg, ${e.gradientFromColor} 25%, ${e.gradientToColor} 37%, ${e.gradientFromColor} 63%)`,skeletonLoadingMotionDuration:"1.4s"}))},e=>{let{colorFillContent:t,colorFill:r}=e;return{color:t,colorGradientEnd:r,gradientFromColor:t,gradientToColor:r,titleHeight:e.controlHeight/2,blockRadius:e.borderRadiusSM,paragraphMarginTop:e.marginLG+e.marginXXS,paragraphLiHeight:e.controlHeight/2}},{deprecatedTokens:[["color","gradientFromColor"],["colorGradientEnd","gradientToColor"]]}),b=e=>{let{prefixCls:a,className:l,style:s,rows:n=0}=e,i=Array.from({length:n}).map((r,a)=>t.createElement("li",{key:a,style:{width:((e,t)=>{let{width:r,rows:a=2}=t;return Array.isArray(r)?r[e]:a-1===e?r:void 0})(a,e)}}));return t.createElement("ul",{className:(0,r.default)(a,l),style:s},i)},v=({prefixCls:e,className:a,width:l,style:s})=>t.createElement("h3",{className:(0,r.default)(e,a),style:Object.assign({width:l},s)});function w(e){return e&&"object"==typeof e?e:{}}let j=e=>{let{prefixCls:l,loading:n,className:i,rootClassName:o,style:d,children:c,avatar:m=!1,title:u=!0,paragraph:g=!0,active:h,round:p}=e,{getPrefixCls:x,direction:j,className:y,style:C}=(0,a.useComponentConfig)("skeleton"),k=x("skeleton",l),[N,T,$]=f(k);if(n||!("loading"in e)){let e,a,l=!!m,n=!!u,c=!!g;if(l){let r=Object.assign(Object.assign({prefixCls:`${k}-avatar`},n&&!c?{size:"large",shape:"square"}:{size:"large",shape:"circle"}),w(m));e=t.createElement("div",{className:`${k}-header`},t.createElement(s,Object.assign({},r)))}if(n||c){let e,r;if(n){let r=Object.assign(Object.assign({prefixCls:`${k}-title`},!l&&c?{width:"38%"}:l&&c?{width:"50%"}:{}),w(u));e=t.createElement(v,Object.assign({},r))}if(c){let e,a=Object.assign(Object.assign({prefixCls:`${k}-paragraph`},(e={},l&&n||(e.width="61%"),!l&&n?e.rows=3:e.rows=2,e)),w(g));r=t.createElement(b,Object.assign({},a))}a=t.createElement("div",{className:`${k}-content`},e,r)}let x=(0,r.default)(k,{[`${k}-with-avatar`]:l,[`${k}-active`]:h,[`${k}-rtl`]:"rtl"===j,[`${k}-round`]:p},y,i,o,T,$);return N(t.createElement("div",{className:x,style:Object.assign(Object.assign({},C),d)},e,a))}return null!=c?c:null};j.Button=e=>{let{prefixCls:n,className:i,rootClassName:o,active:d,block:c=!1,size:m="default"}=e,{getPrefixCls:u}=t.useContext(a.ConfigContext),g=u("skeleton",n),[h,p,x]=f(g),b=(0,l.default)(e,["prefixCls"]),v=(0,r.default)(g,`${g}-element`,{[`${g}-active`]:d,[`${g}-block`]:c},i,o,p,x);return h(t.createElement("div",{className:v},t.createElement(s,Object.assign({prefixCls:`${g}-button`,size:m},b))))},j.Avatar=e=>{let{prefixCls:n,className:i,rootClassName:o,active:d,shape:c="circle",size:m="default"}=e,{getPrefixCls:u}=t.useContext(a.ConfigContext),g=u("skeleton",n),[h,p,x]=f(g),b=(0,l.default)(e,["prefixCls","className"]),v=(0,r.default)(g,`${g}-element`,{[`${g}-active`]:d},i,o,p,x);return h(t.createElement("div",{className:v},t.createElement(s,Object.assign({prefixCls:`${g}-avatar`,shape:c,size:m},b))))},j.Input=e=>{let{prefixCls:n,className:i,rootClassName:o,active:d,block:c,size:m="default"}=e,{getPrefixCls:u}=t.useContext(a.ConfigContext),g=u("skeleton",n),[h,p,x]=f(g),b=(0,l.default)(e,["prefixCls"]),v=(0,r.default)(g,`${g}-element`,{[`${g}-active`]:d,[`${g}-block`]:c},i,o,p,x);return h(t.createElement("div",{className:v},t.createElement(s,Object.assign({prefixCls:`${g}-input`,size:m},b))))},j.Image=e=>{let{prefixCls:l,className:s,rootClassName:n,style:i,active:o}=e,{getPrefixCls:d}=t.useContext(a.ConfigContext),c=d("skeleton",l),[m,u,g]=f(c),h=(0,r.default)(c,`${c}-element`,{[`${c}-active`]:o},s,n,u,g);return m(t.createElement("div",{className:h},t.createElement("div",{className:(0,r.default)(`${c}-image`,s),style:i},t.createElement("svg",{viewBox:"0 0 1098 1024",xmlns:"http://www.w3.org/2000/svg",className:`${c}-image-svg`},t.createElement("title",null,"Image placeholder"),t.createElement("path",{d:"M365.714286 329.142857q0 45.714286-32.036571 77.677714t-77.677714 32.036571-77.677714-32.036571-32.036571-77.677714 32.036571-77.677714 77.677714-32.036571 77.677714 32.036571 32.036571 77.677714zM950.857143 548.571429l0 256-804.571429 0 0-109.714286 182.857143-182.857143 91.428571 91.428571 292.571429-292.571429zM1005.714286 146.285714l-914.285714 0q-7.460571 0-12.873143 5.412571t-5.412571 12.873143l0 694.857143q0 7.460571 5.412571 12.873143t12.873143 5.412571l914.285714 0q7.460571 0 12.873143-5.412571t5.412571-12.873143l0-694.857143q0-7.460571-5.412571-12.873143t-12.873143-5.412571zM1097.142857 164.571429l0 694.857143q0 37.741714-26.843429 64.585143t-64.585143 26.843429l-914.285714 0q-37.741714 0-64.585143-26.843429t-26.843429-64.585143l0-694.857143q0-37.741714 26.843429-64.585143t64.585143-26.843429l914.285714 0q37.741714 0 64.585143 26.843429t26.843429 64.585143z",className:`${c}-image-path`})))))},j.Node=e=>{let{prefixCls:l,className:s,rootClassName:n,style:i,active:o,children:d}=e,{getPrefixCls:c}=t.useContext(a.ConfigContext),m=c("skeleton",l),[u,g,h]=f(m),p=(0,r.default)(m,`${m}-element`,{[`${m}-active`]:o},g,s,n,h);return u(t.createElement("div",{className:p},t.createElement("div",{className:(0,r.default)(`${m}-image`,s),style:i},d)))},e.s(["default",0,j],185793)},959013,e=>{"use strict";e.i(247167);var t=e.i(931067),r=e.i(271645);let a={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M482 152h60q8 0 8 8v704q0 8-8 8h-60q-8 0-8-8V160q0-8 8-8z"}},{tag:"path",attrs:{d:"M192 474h672q8 0 8 8v60q0 8-8 8H160q-8 0-8-8v-60q0-8 8-8z"}}]},name:"plus",theme:"outlined"};var l=e.i(9583),s=r.forwardRef(function(e,s){return r.createElement(l.default,(0,t.default)({},e,{ref:s,icon:a}))});e.s(["default",0,s],959013)},269200,e=>{"use strict";var t=e.i(290571),r=e.i(271645),a=e.i(444755);let l=(0,e.i(673706).makeClassName)("Table"),s=r.default.forwardRef((e,s)=>{let{children:n,className:i}=e,o=(0,t.__rest)(e,["children","className"]);return r.default.createElement("div",{className:(0,a.tremorTwMerge)(l("root"),"overflow-auto",i)},r.default.createElement("table",Object.assign({ref:s,className:(0,a.tremorTwMerge)(l("table"),"w-full text-tremor-default","text-tremor-content","dark:text-dark-tremor-content")},o),n))});s.displayName="Table",e.s(["Table",()=>s],269200)},942232,e=>{"use strict";var t=e.i(290571),r=e.i(271645),a=e.i(444755);let l=(0,e.i(673706).makeClassName)("TableBody"),s=r.default.forwardRef((e,s)=>{let{children:n,className:i}=e,o=(0,t.__rest)(e,["children","className"]);return r.default.createElement(r.default.Fragment,null,r.default.createElement("tbody",Object.assign({ref:s,className:(0,a.tremorTwMerge)(l("root"),"align-top divide-y","divide-tremor-border","dark:divide-dark-tremor-border",i)},o),n))});s.displayName="TableBody",e.s(["TableBody",()=>s],942232)},977572,e=>{"use strict";var t=e.i(290571),r=e.i(271645),a=e.i(444755);let l=(0,e.i(673706).makeClassName)("TableCell"),s=r.default.forwardRef((e,s)=>{let{children:n,className:i}=e,o=(0,t.__rest)(e,["children","className"]);return r.default.createElement(r.default.Fragment,null,r.default.createElement("td",Object.assign({ref:s,className:(0,a.tremorTwMerge)(l("root"),"align-middle whitespace-nowrap text-left p-4",i)},o),n))});s.displayName="TableCell",e.s(["TableCell",()=>s],977572)},427612,e=>{"use strict";var t=e.i(290571),r=e.i(271645),a=e.i(444755);let l=(0,e.i(673706).makeClassName)("TableHead"),s=r.default.forwardRef((e,s)=>{let{children:n,className:i}=e,o=(0,t.__rest)(e,["children","className"]);return r.default.createElement(r.default.Fragment,null,r.default.createElement("thead",Object.assign({ref:s,className:(0,a.tremorTwMerge)(l("root"),"text-left","text-tremor-content","dark:text-dark-tremor-content",i)},o),n))});s.displayName="TableHead",e.s(["TableHead",()=>s],427612)},64848,e=>{"use strict";var t=e.i(290571),r=e.i(271645),a=e.i(444755);let l=(0,e.i(673706).makeClassName)("TableHeaderCell"),s=r.default.forwardRef((e,s)=>{let{children:n,className:i}=e,o=(0,t.__rest)(e,["children","className"]);return r.default.createElement(r.default.Fragment,null,r.default.createElement("th",Object.assign({ref:s,className:(0,a.tremorTwMerge)(l("root"),"whitespace-nowrap text-left font-semibold top-0 px-4 py-3.5","text-tremor-content-strong","dark:text-dark-tremor-content-strong",i)},o),n))});s.displayName="TableHeaderCell",e.s(["TableHeaderCell",()=>s],64848)},496020,e=>{"use strict";var t=e.i(290571),r=e.i(271645),a=e.i(444755);let l=(0,e.i(673706).makeClassName)("TableRow"),s=r.default.forwardRef((e,s)=>{let{children:n,className:i}=e,o=(0,t.__rest)(e,["children","className"]);return r.default.createElement(r.default.Fragment,null,r.default.createElement("tr",Object.assign({ref:s,className:(0,a.tremorTwMerge)(l("row"),i)},o),n))});s.displayName="TableRow",e.s(["TableRow",()=>s],496020)},68155,e=>{"use strict";var t=e.i(271645);let r=t.forwardRef(function(e,r){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:r},e),t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"}))});e.s(["TrashIcon",0,r],68155)},278587,e=>{"use strict";var t=e.i(271645);let r=t.forwardRef(function(e,r){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:r},e),t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"}))});e.s(["RefreshIcon",0,r],278587)},207670,e=>{"use strict";function t(){for(var e,t,r=0,a="",l=arguments.length;rt,"default",0,t])},162386,e=>{"use strict";var t=e.i(843476),r=e.i(625901),a=e.i(109799),l=e.i(785242),s=e.i(738014),n=e.i(199133),i=e.i(981339),o=e.i(592968);let d={label:"All Proxy Models",value:"all-proxy-models"},c={label:"No Default Models",value:"no-default-models"},m=[d,c],u={user:({allProxyModels:e,userModels:t,options:r})=>t&&r?.includeUserModels?t:[],team:({allProxyModels:e,selectedOrganization:t,userModels:r})=>t?t.models.includes(d.value)||0===t.models.length?e:e.filter(e=>t.models.includes(e)):e??[],organization:({allProxyModels:e})=>e,global:({allProxyModels:e})=>e};e.s(["ModelSelect",0,e=>{let{teamID:g,organizationID:h,options:p,context:x,dataTestId:f,value:b=[],onChange:v,style:w}=e,{includeUserModels:j,showAllTeamModelsOption:y,showAllProxyModelsOverride:C,includeSpecialOptions:k}=p||{},{data:N,isLoading:T}=(0,r.useAllProxyModels)(),{data:$,isLoading:E}=(0,l.useTeam)(g),{data:M,isLoading:O}=(0,a.useOrganization)(h),{data:_,isLoading:S}=(0,s.useCurrentUser)(),I=e=>m.some(t=>t.value===e),R=b.some(I),P=M?.models.includes(d.value)||M?.models.length===0;if(T||E||O||S)return(0,t.jsx)(i.Skeleton.Input,{active:!0,block:!0});let{wildcard:A,regular:z}=(e=>{let t=[],r=[];for(let a of e)a.endsWith("/*")?t.push(a):r.push(a);return{wildcard:t,regular:r}})(((e,t,r)=>{let a=Array.from(new Map(e.map(e=>[e.id,e])).values()).map(e=>e.id);if(t.options?.showAllProxyModelsOverride)return a;let l=u[t.context];return l?l({allProxyModels:a,...r,options:t.options}):[]})(N?.data??[],e,{selectedTeam:$,selectedOrganization:M,userModels:_?.models}));return(0,t.jsx)(n.Select,{"data-testid":f,value:b,onChange:e=>{let t=e.filter(I);v(t.length>0?[t[t.length-1]]:e)},style:w,options:[k?{label:(0,t.jsx)("span",{children:"Special Options"}),title:"Special Options",options:[...C||P&&k||"global"===x?[{label:(0,t.jsx)("span",{children:"All Proxy Models"}),value:d.value,disabled:b.length>0&&b.some(e=>I(e)&&e!==d.value),key:d.value}]:[],{label:(0,t.jsx)("span",{children:"No Default Models"}),value:c.value,disabled:b.length>0&&b.some(e=>I(e)&&e!==c.value),key:c.value}]}:[],...A.length>0?[{label:(0,t.jsx)("span",{children:"Wildcard Options"}),title:"Wildcard Options",options:A.map(e=>{let r=e.replace("/*",""),a=r.charAt(0).toUpperCase()+r.slice(1);return{label:(0,t.jsx)("span",{children:`All ${a} models`}),value:e,disabled:R}})}]:[],{label:(0,t.jsx)("span",{children:"Models"}),title:"Models",options:z.map(e=>({label:(0,t.jsx)("span",{children:e}),value:e,disabled:R}))}],mode:"multiple",placeholder:"Select Models",allowClear:!0,maxTagCount:"responsive",maxTagPlaceholder:e=>(0,t.jsx)(o.Tooltip,{styles:{root:{pointerEvents:"none"}},title:e.map(({value:e})=>e).join(", "),children:(0,t.jsxs)("span",{children:["+",e.length," more"]})})})}],162386)},294612,e=>{"use strict";var t=e.i(843476),r=e.i(100486),a=e.i(827252),l=e.i(213205),s=e.i(771674),n=e.i(464571),i=e.i(770914),o=e.i(291542),d=e.i(262218),c=e.i(592968),m=e.i(898586),u=e.i(902555);let{Text:g}=m.Typography;function h({members:e,canEdit:m,onEdit:h,onDelete:p,onAddMember:x,roleColumnTitle:f="Role",roleTooltip:b,extraColumns:v=[],showDeleteForMember:w,emptyText:j}){let y=[{title:"User Email",dataIndex:"user_email",key:"user_email",render:e=>(0,t.jsx)(g,{children:e||"-"})},{title:"User ID",dataIndex:"user_id",key:"user_id",render:e=>"default_user_id"===e?(0,t.jsx)(d.Tag,{color:"blue",children:"Default Proxy Admin"}):(0,t.jsx)(g,{children:e||"-"})},{title:b?(0,t.jsxs)(i.Space,{direction:"horizontal",children:[f,(0,t.jsx)(c.Tooltip,{title:b,children:(0,t.jsx)(a.InfoCircleOutlined,{})})]}):f,dataIndex:"role",key:"role",render:e=>(0,t.jsxs)(i.Space,{children:[e?.toLowerCase()==="admin"||e?.toLowerCase()==="org_admin"?(0,t.jsx)(r.CrownOutlined,{}):(0,t.jsx)(s.UserOutlined,{}),(0,t.jsx)(g,{style:{textTransform:"capitalize"},children:e||"-"})]})},...v,{title:"Actions",key:"actions",fixed:"right",width:120,render:(e,r)=>m?(0,t.jsxs)(i.Space,{children:[(0,t.jsx)(u.default,{variant:"Edit",tooltipText:"Edit member",dataTestId:"edit-member",onClick:()=>h(r)}),(!w||w(r))&&(0,t.jsx)(u.default,{variant:"Delete",tooltipText:"Delete member",dataTestId:"delete-member",onClick:()=>p(r)})]}):null}];return(0,t.jsxs)(i.Space,{direction:"vertical",style:{width:"100%"},children:[(0,t.jsxs)("span",{className:"inline-flex text-sm text-gray-700",children:[e.length," Member",1!==e.length?"s":""]}),(0,t.jsx)(o.Table,{columns:y,dataSource:e,rowKey:e=>e.user_id??e.user_email??JSON.stringify(e),pagination:!1,size:"small",scroll:{x:"max-content"},locale:j?{emptyText:j}:void 0}),x&&m&&(0,t.jsx)(n.Button,{icon:(0,t.jsx)(l.UserAddOutlined,{}),type:"primary",onClick:x,children:"Add Member"})]})}e.s(["default",()=>h])},907308,e=>{"use strict";var t=e.i(843476),r=e.i(271645),a=e.i(212931),l=e.i(808613),s=e.i(464571),n=e.i(199133),i=e.i(592968),o=e.i(213205),d=e.i(374009),c=e.i(764205);e.s(["default",0,({isVisible:e,onCancel:m,onSubmit:u,accessToken:g,title:h="Add Team Member",roles:p=[{label:"admin",value:"admin",description:"Admin role. Can create team keys, add members, and manage settings."},{label:"user",value:"user",description:"User role. Can view team info, but not manage it."}],defaultRole:x="user",teamId:f})=>{let[b]=l.Form.useForm(),[v,w]=(0,r.useState)([]),[j,y]=(0,r.useState)(!1),[C,k]=(0,r.useState)("user_email"),[N,T]=(0,r.useState)(!1),$=async(e,t)=>{if(!e)return void w([]);y(!0);try{let r=new URLSearchParams;if(r.append(t,e),f&&r.append("team_id",f),null==g)return;let a=(await (0,c.userFilterUICall)(g,r)).map(e=>({label:"user_email"===t?`${e.user_email}`:`${e.user_id}`,value:"user_email"===t?e.user_email:e.user_id,user:e}));w(a)}catch(e){console.error("Error fetching users:",e)}finally{y(!1)}},E=(0,r.useCallback)((0,d.default)((e,t)=>$(e,t),300),[]),M=(e,t)=>{k(t),E(e,t)},O=(e,t)=>{let r=t.user;b.setFieldsValue({user_email:r.user_email,user_id:r.user_id,role:b.getFieldValue("role")})},_=async e=>{T(!0);try{await u(e)}finally{T(!1)}};return(0,t.jsx)(a.Modal,{title:h,open:e,onCancel:()=>{b.resetFields(),w([]),m()},footer:null,width:800,maskClosable:!N,children:(0,t.jsxs)(l.Form,{form:b,onFinish:_,labelCol:{span:8},wrapperCol:{span:16},labelAlign:"left",initialValues:{role:x},children:[(0,t.jsx)(l.Form.Item,{label:"Email",name:"user_email",className:"mb-4",children:(0,t.jsx)(n.Select,{showSearch:!0,className:"w-full",placeholder:"Search by email",filterOption:!1,onSearch:e=>M(e,"user_email"),onSelect:(e,t)=>O(e,t),options:"user_email"===C?v:[],loading:j,allowClear:!0})}),(0,t.jsx)("div",{className:"text-center mb-4",children:"OR"}),(0,t.jsx)(l.Form.Item,{label:"User ID",name:"user_id",className:"mb-4",children:(0,t.jsx)(n.Select,{showSearch:!0,className:"w-full",placeholder:"Search by user ID",filterOption:!1,onSearch:e=>M(e,"user_id"),onSelect:(e,t)=>O(e,t),options:"user_id"===C?v:[],loading:j,allowClear:!0})}),(0,t.jsx)(l.Form.Item,{label:"Member Role",name:"role",className:"mb-4",children:(0,t.jsx)(n.Select,{defaultValue:x,children:p.map(e=>(0,t.jsx)(n.Select.Option,{value:e.value,children:(0,t.jsxs)(i.Tooltip,{title:e.description,children:[(0,t.jsx)("span",{className:"font-medium",children:e.label}),(0,t.jsxs)("span",{className:"ml-2 text-gray-500 text-sm",children:["- ",e.description]})]})},e.value))})}),(0,t.jsx)("div",{className:"text-right mt-4",children:(0,t.jsx)(s.Button,{type:"primary",htmlType:"submit",icon:(0,t.jsx)(o.UserAddOutlined,{}),loading:N,children:N?"Adding...":"Add Member"})})]})})}])},276173,e=>{"use strict";var t=e.i(843476),r=e.i(599724),a=e.i(779241),l=e.i(464571),s=e.i(808613),n=e.i(212931),i=e.i(199133),o=e.i(271645),d=e.i(435451);e.s(["default",0,({visible:e,onCancel:c,onSubmit:m,initialData:u,mode:g,config:h})=>{let p,[x]=s.Form.useForm(),[f,b]=(0,o.useState)(!1);console.log("Initial Data:",u),(0,o.useEffect)(()=>{if(e)if("edit"===g&&u){let e={...u,role:u.role||h.defaultRole,max_budget_in_team:u.max_budget_in_team||null,tpm_limit:u.tpm_limit||null,rpm_limit:u.rpm_limit||null};console.log("Setting form values:",e),x.setFieldsValue(e)}else x.resetFields(),x.setFieldsValue({role:h.defaultRole||h.roleOptions[0]?.value})},[e,u,g,x,h.defaultRole,h.roleOptions]);let v=async e=>{try{b(!0);let t=Object.entries(e).reduce((e,[t,r])=>{if("string"==typeof r){let a=r.trim();return""===a&&("max_budget_in_team"===t||"tpm_limit"===t||"rpm_limit"===t)?{...e,[t]:null}:{...e,[t]:a}}return{...e,[t]:r}},{});console.log("Submitting form data:",t),await Promise.resolve(m(t)),x.resetFields()}catch(e){console.error("Form submission error:",e)}finally{b(!1)}};return(0,t.jsx)(n.Modal,{title:h.title||("add"===g?"Add Member":"Edit Member"),open:e,width:1e3,footer:null,onCancel:c,children:(0,t.jsxs)(s.Form,{form:x,onFinish:v,labelCol:{span:8},wrapperCol:{span:16},labelAlign:"left",children:[h.showEmail&&(0,t.jsx)(s.Form.Item,{label:"Email",name:"user_email",className:"mb-4",rules:[{type:"email",message:"Please enter a valid email!"}],children:(0,t.jsx)(a.TextInput,{placeholder:"user@example.com"})}),h.showEmail&&h.showUserId&&(0,t.jsx)("div",{className:"text-center mb-4",children:(0,t.jsx)(r.Text,{children:"OR"})}),h.showUserId&&(0,t.jsx)(s.Form.Item,{label:"User ID",name:"user_id",className:"mb-4",children:(0,t.jsx)(a.TextInput,{placeholder:"user_123"})}),(0,t.jsx)(s.Form.Item,{label:(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("span",{children:"Role"}),"edit"===g&&u&&(0,t.jsxs)("span",{className:"text-gray-500 text-sm",children:["(Current: ",(p=u.role,h.roleOptions.find(e=>e.value===p)?.label||p),")"]})]}),name:"role",className:"mb-4",rules:[{required:!0,message:"Please select a role!"}],children:(0,t.jsx)(i.Select,{children:"edit"===g&&u?[...h.roleOptions.filter(e=>e.value===u.role),...h.roleOptions.filter(e=>e.value!==u.role)].map(e=>(0,t.jsx)(i.Select.Option,{value:e.value,children:e.label},e.value)):h.roleOptions.map(e=>(0,t.jsx)(i.Select.Option,{value:e.value,children:e.label},e.value))})}),h.additionalFields?.map(e=>(0,t.jsx)(s.Form.Item,{label:e.label,name:e.name,className:"mb-4",rules:e.rules,children:(e=>{switch(e.type){case"input":return(0,t.jsx)(a.TextInput,{placeholder:e.placeholder});case"numerical":return(0,t.jsx)(d.default,{step:e.step||1,min:e.min||0,style:{width:"100%"},placeholder:e.placeholder||"Enter a numerical value"});case"select":return(0,t.jsx)(i.Select,{children:e.options?.map(e=>(0,t.jsx)(i.Select.Option,{value:e.value,children:e.label},e.value))});default:return null}})(e)},e.name)),(0,t.jsxs)("div",{className:"text-right mt-6",children:[(0,t.jsx)(l.Button,{onClick:c,className:"mr-2",disabled:f,children:"Cancel"}),(0,t.jsx)(l.Button,{type:"default",htmlType:"submit",loading:f,children:"add"===g?f?"Adding...":"Add Member":f?"Saving...":"Save Changes"})]})]})})}])}]); \ No newline at end of file + ${i}, + ${n} + `]:Object.assign({},{background:e.skeletonLoadingBackground,backgroundSize:"400% 100%",animationName:c,animationDuration:e.skeletonLoadingMotionDuration,animationTimingFunction:"ease",animationIterationCount:"infinite"})}}})((0,d.mergeToken)(e,{skeletonAvatarCls:`${t}-avatar`,skeletonTitleCls:`${t}-title`,skeletonParagraphCls:`${t}-paragraph`,skeletonButtonCls:`${t}-button`,skeletonInputCls:`${t}-input`,skeletonImageCls:`${t}-image`,imageSizeBase:r(e.controlHeight).mul(1.5).equal(),borderRadius:100,skeletonLoadingBackground:`linear-gradient(90deg, ${e.gradientFromColor} 25%, ${e.gradientToColor} 37%, ${e.gradientFromColor} 63%)`,skeletonLoadingMotionDuration:"1.4s"}))},e=>{let{colorFillContent:t,colorFill:r}=e;return{color:t,colorGradientEnd:r,gradientFromColor:t,gradientToColor:r,titleHeight:e.controlHeight/2,blockRadius:e.borderRadiusSM,paragraphMarginTop:e.marginLG+e.marginXXS,paragraphLiHeight:e.controlHeight/2}},{deprecatedTokens:[["color","gradientFromColor"],["colorGradientEnd","gradientToColor"]]}),b=e=>{let{prefixCls:a,className:l,style:s,rows:i=0}=e,n=Array.from({length:i}).map((r,a)=>t.createElement("li",{key:a,style:{width:((e,t)=>{let{width:r,rows:a=2}=t;return Array.isArray(r)?r[e]:a-1===e?r:void 0})(a,e)}}));return t.createElement("ul",{className:(0,r.default)(a,l),style:s},n)},v=({prefixCls:e,className:a,width:l,style:s})=>t.createElement("h3",{className:(0,r.default)(e,a),style:Object.assign({width:l},s)});function w(e){return e&&"object"==typeof e?e:{}}let j=e=>{let{prefixCls:l,loading:i,className:n,rootClassName:o,style:d,children:c,avatar:m=!1,title:u=!0,paragraph:g=!0,active:h,round:p}=e,{getPrefixCls:x,direction:j,className:y,style:C}=(0,a.useComponentConfig)("skeleton"),k=x("skeleton",l),[N,T,$]=f(k);if(i||!("loading"in e)){let e,a,l=!!m,i=!!u,c=!!g;if(l){let r=Object.assign(Object.assign({prefixCls:`${k}-avatar`},i&&!c?{size:"large",shape:"square"}:{size:"large",shape:"circle"}),w(m));e=t.createElement("div",{className:`${k}-header`},t.createElement(s,Object.assign({},r)))}if(i||c){let e,r;if(i){let r=Object.assign(Object.assign({prefixCls:`${k}-title`},!l&&c?{width:"38%"}:l&&c?{width:"50%"}:{}),w(u));e=t.createElement(v,Object.assign({},r))}if(c){let e,a=Object.assign(Object.assign({prefixCls:`${k}-paragraph`},(e={},l&&i||(e.width="61%"),!l&&i?e.rows=3:e.rows=2,e)),w(g));r=t.createElement(b,Object.assign({},a))}a=t.createElement("div",{className:`${k}-content`},e,r)}let x=(0,r.default)(k,{[`${k}-with-avatar`]:l,[`${k}-active`]:h,[`${k}-rtl`]:"rtl"===j,[`${k}-round`]:p},y,n,o,T,$);return N(t.createElement("div",{className:x,style:Object.assign(Object.assign({},C),d)},e,a))}return null!=c?c:null};j.Button=e=>{let{prefixCls:i,className:n,rootClassName:o,active:d,block:c=!1,size:m="default"}=e,{getPrefixCls:u}=t.useContext(a.ConfigContext),g=u("skeleton",i),[h,p,x]=f(g),b=(0,l.default)(e,["prefixCls"]),v=(0,r.default)(g,`${g}-element`,{[`${g}-active`]:d,[`${g}-block`]:c},n,o,p,x);return h(t.createElement("div",{className:v},t.createElement(s,Object.assign({prefixCls:`${g}-button`,size:m},b))))},j.Avatar=e=>{let{prefixCls:i,className:n,rootClassName:o,active:d,shape:c="circle",size:m="default"}=e,{getPrefixCls:u}=t.useContext(a.ConfigContext),g=u("skeleton",i),[h,p,x]=f(g),b=(0,l.default)(e,["prefixCls","className"]),v=(0,r.default)(g,`${g}-element`,{[`${g}-active`]:d},n,o,p,x);return h(t.createElement("div",{className:v},t.createElement(s,Object.assign({prefixCls:`${g}-avatar`,shape:c,size:m},b))))},j.Input=e=>{let{prefixCls:i,className:n,rootClassName:o,active:d,block:c,size:m="default"}=e,{getPrefixCls:u}=t.useContext(a.ConfigContext),g=u("skeleton",i),[h,p,x]=f(g),b=(0,l.default)(e,["prefixCls"]),v=(0,r.default)(g,`${g}-element`,{[`${g}-active`]:d,[`${g}-block`]:c},n,o,p,x);return h(t.createElement("div",{className:v},t.createElement(s,Object.assign({prefixCls:`${g}-input`,size:m},b))))},j.Image=e=>{let{prefixCls:l,className:s,rootClassName:i,style:n,active:o}=e,{getPrefixCls:d}=t.useContext(a.ConfigContext),c=d("skeleton",l),[m,u,g]=f(c),h=(0,r.default)(c,`${c}-element`,{[`${c}-active`]:o},s,i,u,g);return m(t.createElement("div",{className:h},t.createElement("div",{className:(0,r.default)(`${c}-image`,s),style:n},t.createElement("svg",{viewBox:"0 0 1098 1024",xmlns:"http://www.w3.org/2000/svg",className:`${c}-image-svg`},t.createElement("title",null,"Image placeholder"),t.createElement("path",{d:"M365.714286 329.142857q0 45.714286-32.036571 77.677714t-77.677714 32.036571-77.677714-32.036571-32.036571-77.677714 32.036571-77.677714 77.677714-32.036571 77.677714 32.036571 32.036571 77.677714zM950.857143 548.571429l0 256-804.571429 0 0-109.714286 182.857143-182.857143 91.428571 91.428571 292.571429-292.571429zM1005.714286 146.285714l-914.285714 0q-7.460571 0-12.873143 5.412571t-5.412571 12.873143l0 694.857143q0 7.460571 5.412571 12.873143t12.873143 5.412571l914.285714 0q7.460571 0 12.873143-5.412571t5.412571-12.873143l0-694.857143q0-7.460571-5.412571-12.873143t-12.873143-5.412571zM1097.142857 164.571429l0 694.857143q0 37.741714-26.843429 64.585143t-64.585143 26.843429l-914.285714 0q-37.741714 0-64.585143-26.843429t-26.843429-64.585143l0-694.857143q0-37.741714 26.843429-64.585143t64.585143-26.843429l914.285714 0q37.741714 0 64.585143 26.843429t26.843429 64.585143z",className:`${c}-image-path`})))))},j.Node=e=>{let{prefixCls:l,className:s,rootClassName:i,style:n,active:o,children:d}=e,{getPrefixCls:c}=t.useContext(a.ConfigContext),m=c("skeleton",l),[u,g,h]=f(m),p=(0,r.default)(m,`${m}-element`,{[`${m}-active`]:o},g,s,i,h);return u(t.createElement("div",{className:p},t.createElement("div",{className:(0,r.default)(`${m}-image`,s),style:n},d)))},e.s(["default",0,j],185793)},959013,e=>{"use strict";e.i(247167);var t=e.i(931067),r=e.i(271645);let a={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M482 152h60q8 0 8 8v704q0 8-8 8h-60q-8 0-8-8V160q0-8 8-8z"}},{tag:"path",attrs:{d:"M192 474h672q8 0 8 8v60q0 8-8 8H160q-8 0-8-8v-60q0-8 8-8z"}}]},name:"plus",theme:"outlined"};var l=e.i(9583),s=r.forwardRef(function(e,s){return r.createElement(l.default,(0,t.default)({},e,{ref:s,icon:a}))});e.s(["default",0,s],959013)},269200,e=>{"use strict";var t=e.i(290571),r=e.i(271645),a=e.i(444755);let l=(0,e.i(673706).makeClassName)("Table"),s=r.default.forwardRef((e,s)=>{let{children:i,className:n}=e,o=(0,t.__rest)(e,["children","className"]);return r.default.createElement("div",{className:(0,a.tremorTwMerge)(l("root"),"overflow-auto",n)},r.default.createElement("table",Object.assign({ref:s,className:(0,a.tremorTwMerge)(l("table"),"w-full text-tremor-default","text-tremor-content","dark:text-dark-tremor-content")},o),i))});s.displayName="Table",e.s(["Table",()=>s],269200)},942232,e=>{"use strict";var t=e.i(290571),r=e.i(271645),a=e.i(444755);let l=(0,e.i(673706).makeClassName)("TableBody"),s=r.default.forwardRef((e,s)=>{let{children:i,className:n}=e,o=(0,t.__rest)(e,["children","className"]);return r.default.createElement(r.default.Fragment,null,r.default.createElement("tbody",Object.assign({ref:s,className:(0,a.tremorTwMerge)(l("root"),"align-top divide-y","divide-tremor-border","dark:divide-dark-tremor-border",n)},o),i))});s.displayName="TableBody",e.s(["TableBody",()=>s],942232)},977572,e=>{"use strict";var t=e.i(290571),r=e.i(271645),a=e.i(444755);let l=(0,e.i(673706).makeClassName)("TableCell"),s=r.default.forwardRef((e,s)=>{let{children:i,className:n}=e,o=(0,t.__rest)(e,["children","className"]);return r.default.createElement(r.default.Fragment,null,r.default.createElement("td",Object.assign({ref:s,className:(0,a.tremorTwMerge)(l("root"),"align-middle whitespace-nowrap text-left p-4",n)},o),i))});s.displayName="TableCell",e.s(["TableCell",()=>s],977572)},427612,e=>{"use strict";var t=e.i(290571),r=e.i(271645),a=e.i(444755);let l=(0,e.i(673706).makeClassName)("TableHead"),s=r.default.forwardRef((e,s)=>{let{children:i,className:n}=e,o=(0,t.__rest)(e,["children","className"]);return r.default.createElement(r.default.Fragment,null,r.default.createElement("thead",Object.assign({ref:s,className:(0,a.tremorTwMerge)(l("root"),"text-left","text-tremor-content","dark:text-dark-tremor-content",n)},o),i))});s.displayName="TableHead",e.s(["TableHead",()=>s],427612)},64848,e=>{"use strict";var t=e.i(290571),r=e.i(271645),a=e.i(444755);let l=(0,e.i(673706).makeClassName)("TableHeaderCell"),s=r.default.forwardRef((e,s)=>{let{children:i,className:n}=e,o=(0,t.__rest)(e,["children","className"]);return r.default.createElement(r.default.Fragment,null,r.default.createElement("th",Object.assign({ref:s,className:(0,a.tremorTwMerge)(l("root"),"whitespace-nowrap text-left font-semibold top-0 px-4 py-3.5","text-tremor-content-strong","dark:text-dark-tremor-content-strong",n)},o),i))});s.displayName="TableHeaderCell",e.s(["TableHeaderCell",()=>s],64848)},496020,e=>{"use strict";var t=e.i(290571),r=e.i(271645),a=e.i(444755);let l=(0,e.i(673706).makeClassName)("TableRow"),s=r.default.forwardRef((e,s)=>{let{children:i,className:n}=e,o=(0,t.__rest)(e,["children","className"]);return r.default.createElement(r.default.Fragment,null,r.default.createElement("tr",Object.assign({ref:s,className:(0,a.tremorTwMerge)(l("row"),n)},o),i))});s.displayName="TableRow",e.s(["TableRow",()=>s],496020)},68155,e=>{"use strict";var t=e.i(271645);let r=t.forwardRef(function(e,r){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:r},e),t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"}))});e.s(["TrashIcon",0,r],68155)},278587,e=>{"use strict";var t=e.i(271645);let r=t.forwardRef(function(e,r){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:r},e),t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"}))});e.s(["RefreshIcon",0,r],278587)},207670,e=>{"use strict";function t(){for(var e,t,r=0,a="",l=arguments.length;rt,"default",0,t])},162386,e=>{"use strict";var t=e.i(843476),r=e.i(625901),a=e.i(109799),l=e.i(785242),s=e.i(738014),i=e.i(199133),n=e.i(981339),o=e.i(592968);let d={label:"All Proxy Models",value:"all-proxy-models"},c={label:"No Default Models",value:"no-default-models"},m=[d,c],u={user:({allProxyModels:e,userModels:t,options:r})=>t&&r?.includeUserModels?t:[],team:({allProxyModels:e,selectedOrganization:t,userModels:r})=>t?t.models.includes(d.value)||0===t.models.length?e:e.filter(e=>t.models.includes(e)):e??[],organization:({allProxyModels:e})=>e,global:({allProxyModels:e})=>e};e.s(["ModelSelect",0,e=>{let{teamID:g,organizationID:h,options:p,context:x,dataTestId:f,value:b=[],onChange:v,style:w}=e,{includeUserModels:j,showAllTeamModelsOption:y,showAllProxyModelsOverride:C,includeSpecialOptions:k}=p||{},{data:N,isLoading:T}=(0,r.useAllProxyModels)(),{data:$,isLoading:E}=(0,l.useTeam)(g),{data:M,isLoading:O}=(0,a.useOrganization)(h),{data:_,isLoading:S}=(0,s.useCurrentUser)(),I=e=>m.some(t=>t.value===e),R=b.some(I),P=M?.models.includes(d.value)||M?.models.length===0;if(T||E||O||S)return(0,t.jsx)(n.Skeleton.Input,{active:!0,block:!0});let{wildcard:A,regular:z}=(e=>{let t=[],r=[];for(let a of e)a.endsWith("/*")?t.push(a):r.push(a);return{wildcard:t,regular:r}})(((e,t,r)=>{let a=Array.from(new Map(e.map(e=>[e.id,e])).values()).map(e=>e.id);if(t.options?.showAllProxyModelsOverride)return a;let l=u[t.context];return l?l({allProxyModels:a,...r,options:t.options}):[]})(N?.data??[],e,{selectedTeam:$,selectedOrganization:M,userModels:_?.models}));return(0,t.jsx)(i.Select,{"data-testid":f,value:b,onChange:e=>{let t=e.filter(I);v(t.length>0?[t[t.length-1]]:e)},style:w,options:[k?{label:(0,t.jsx)("span",{children:"Special Options"}),title:"Special Options",options:[...C||P&&k||"global"===x?[{label:(0,t.jsx)("span",{children:"All Proxy Models"}),value:d.value,disabled:b.length>0&&b.some(e=>I(e)&&e!==d.value),key:d.value}]:[],{label:(0,t.jsx)("span",{children:"No Default Models"}),value:c.value,disabled:b.length>0&&b.some(e=>I(e)&&e!==c.value),key:c.value}]}:[],...A.length>0?[{label:(0,t.jsx)("span",{children:"Wildcard Options"}),title:"Wildcard Options",options:A.map(e=>{let r=e.replace("/*",""),a=r.charAt(0).toUpperCase()+r.slice(1);return{label:(0,t.jsx)("span",{children:`All ${a} models`}),value:e,disabled:R}})}]:[],{label:(0,t.jsx)("span",{children:"Models"}),title:"Models",options:z.map(e=>({label:(0,t.jsx)("span",{children:e}),value:e,disabled:R}))}],mode:"multiple",placeholder:"Select Models",allowClear:!0,maxTagCount:"responsive",maxTagPlaceholder:e=>(0,t.jsx)(o.Tooltip,{styles:{root:{pointerEvents:"none"}},title:e.map(({value:e})=>e).join(", "),children:(0,t.jsxs)("span",{children:["+",e.length," more"]})})})}],162386)},294612,e=>{"use strict";var t=e.i(843476),r=e.i(100486),a=e.i(827252),l=e.i(213205),s=e.i(771674),i=e.i(464571),n=e.i(770914),o=e.i(291542),d=e.i(262218),c=e.i(592968),m=e.i(898586),u=e.i(902555);let{Text:g}=m.Typography;function h({members:e,canEdit:m,onEdit:h,onDelete:p,onAddMember:x,roleColumnTitle:f="Role",roleTooltip:b,extraColumns:v=[],showDeleteForMember:w,emptyText:j}){let y=[{title:"User Email",dataIndex:"user_email",key:"user_email",render:e=>(0,t.jsx)(g,{children:e||"-"})},{title:"User ID",dataIndex:"user_id",key:"user_id",render:e=>"default_user_id"===e?(0,t.jsx)(d.Tag,{color:"blue",children:"Default Proxy Admin"}):(0,t.jsx)(g,{children:e||"-"})},{title:b?(0,t.jsxs)(n.Space,{direction:"horizontal",children:[f,(0,t.jsx)(c.Tooltip,{title:b,children:(0,t.jsx)(a.InfoCircleOutlined,{})})]}):f,dataIndex:"role",key:"role",render:e=>(0,t.jsxs)(n.Space,{children:[e?.toLowerCase()==="admin"||e?.toLowerCase()==="org_admin"?(0,t.jsx)(r.CrownOutlined,{}):(0,t.jsx)(s.UserOutlined,{}),(0,t.jsx)(g,{style:{textTransform:"capitalize"},children:e||"-"})]})},...v,{title:"Actions",key:"actions",fixed:"right",width:120,render:(e,r)=>m?(0,t.jsxs)(n.Space,{children:[(0,t.jsx)(u.default,{variant:"Edit",tooltipText:"Edit member",dataTestId:"edit-member",onClick:()=>h(r)}),(!w||w(r))&&(0,t.jsx)(u.default,{variant:"Delete",tooltipText:"Delete member",dataTestId:"delete-member",onClick:()=>p(r)})]}):null}];return(0,t.jsxs)(n.Space,{direction:"vertical",style:{width:"100%"},children:[(0,t.jsxs)("span",{className:"inline-flex text-sm text-gray-700",children:[e.length," Member",1!==e.length?"s":""]}),(0,t.jsx)(o.Table,{columns:y,dataSource:e,rowKey:e=>e.user_id??e.user_email??JSON.stringify(e),pagination:!1,size:"small",scroll:{x:"max-content"},locale:j?{emptyText:j}:void 0}),x&&m&&(0,t.jsx)(i.Button,{icon:(0,t.jsx)(l.UserAddOutlined,{}),type:"primary",onClick:x,children:"Add Member"})]})}e.s(["default",()=>h])},907308,e=>{"use strict";var t=e.i(843476),r=e.i(271645),a=e.i(212931),l=e.i(808613),s=e.i(464571),i=e.i(199133),n=e.i(592968),o=e.i(213205),d=e.i(374009),c=e.i(764205);e.s(["default",0,({isVisible:e,onCancel:m,onSubmit:u,accessToken:g,title:h="Add Team Member",roles:p=[{label:"admin",value:"admin",description:"Admin role. Can create team keys, add members, and manage settings."},{label:"user",value:"user",description:"User role. Can view team info, but not manage it."}],defaultRole:x="user",teamId:f})=>{let[b]=l.Form.useForm(),[v,w]=(0,r.useState)([]),[j,y]=(0,r.useState)(!1),[C,k]=(0,r.useState)("user_email"),[N,T]=(0,r.useState)(!1),$=async(e,t)=>{if(!e)return void w([]);y(!0);try{let r=new URLSearchParams;if(r.append(t,e),f&&r.append("team_id",f),null==g)return;let a=(await (0,c.userFilterUICall)(g,r)).map(e=>({label:"user_email"===t?`${e.user_email}`:`${e.user_id}`,value:"user_email"===t?e.user_email:e.user_id,user:e}));w(a)}catch(e){console.error("Error fetching users:",e)}finally{y(!1)}},E=(0,r.useCallback)((0,d.default)((e,t)=>$(e,t),300),[]),M=(e,t)=>{k(t),E(e,t)},O=(e,t)=>{let r=t.user;b.setFieldsValue({user_email:r.user_email,user_id:r.user_id,role:b.getFieldValue("role")})},_=async e=>{T(!0);try{await u(e)}finally{T(!1)}};return(0,t.jsx)(a.Modal,{title:h,open:e,onCancel:()=>{b.resetFields(),w([]),m()},footer:null,width:800,maskClosable:!N,children:(0,t.jsxs)(l.Form,{form:b,onFinish:_,labelCol:{span:8},wrapperCol:{span:16},labelAlign:"left",initialValues:{role:x},children:[(0,t.jsx)(l.Form.Item,{label:"Email",name:"user_email",className:"mb-4",children:(0,t.jsx)(i.Select,{showSearch:!0,className:"w-full",placeholder:"Search by email",filterOption:!1,onSearch:e=>M(e,"user_email"),onSelect:(e,t)=>O(e,t),options:"user_email"===C?v:[],loading:j,allowClear:!0,"data-testid":"member-email-search"})}),(0,t.jsx)("div",{className:"text-center mb-4",children:"OR"}),(0,t.jsx)(l.Form.Item,{label:"User ID",name:"user_id",className:"mb-4",children:(0,t.jsx)(i.Select,{showSearch:!0,className:"w-full",placeholder:"Search by user ID",filterOption:!1,onSearch:e=>M(e,"user_id"),onSelect:(e,t)=>O(e,t),options:"user_id"===C?v:[],loading:j,allowClear:!0})}),(0,t.jsx)(l.Form.Item,{label:"Member Role",name:"role",className:"mb-4",children:(0,t.jsx)(i.Select,{defaultValue:x,children:p.map(e=>(0,t.jsx)(i.Select.Option,{value:e.value,children:(0,t.jsxs)(n.Tooltip,{title:e.description,children:[(0,t.jsx)("span",{className:"font-medium",children:e.label}),(0,t.jsxs)("span",{className:"ml-2 text-gray-500 text-sm",children:["- ",e.description]})]})},e.value))})}),(0,t.jsx)("div",{className:"text-right mt-4",children:(0,t.jsx)(s.Button,{type:"primary",htmlType:"submit",icon:(0,t.jsx)(o.UserAddOutlined,{}),loading:N,children:N?"Adding...":"Add Member"})})]})})}])},276173,e=>{"use strict";var t=e.i(843476),r=e.i(599724),a=e.i(779241),l=e.i(464571),s=e.i(808613),i=e.i(212931),n=e.i(199133),o=e.i(271645),d=e.i(435451);e.s(["default",0,({visible:e,onCancel:c,onSubmit:m,initialData:u,mode:g,config:h})=>{let p,[x]=s.Form.useForm(),[f,b]=(0,o.useState)(!1);console.log("Initial Data:",u),(0,o.useEffect)(()=>{if(e)if("edit"===g&&u){let e={...u,role:u.role||h.defaultRole,max_budget_in_team:u.max_budget_in_team||null,tpm_limit:u.tpm_limit||null,rpm_limit:u.rpm_limit||null};console.log("Setting form values:",e),x.setFieldsValue(e)}else x.resetFields(),x.setFieldsValue({role:h.defaultRole||h.roleOptions[0]?.value})},[e,u,g,x,h.defaultRole,h.roleOptions]);let v=async e=>{try{b(!0);let t=Object.entries(e).reduce((e,[t,r])=>{if("string"==typeof r){let a=r.trim();return""===a&&("max_budget_in_team"===t||"tpm_limit"===t||"rpm_limit"===t)?{...e,[t]:null}:{...e,[t]:a}}return{...e,[t]:r}},{});console.log("Submitting form data:",t),await Promise.resolve(m(t)),x.resetFields()}catch(e){console.error("Form submission error:",e)}finally{b(!1)}};return(0,t.jsx)(i.Modal,{title:h.title||("add"===g?"Add Member":"Edit Member"),open:e,width:1e3,footer:null,onCancel:c,children:(0,t.jsxs)(s.Form,{form:x,onFinish:v,labelCol:{span:8},wrapperCol:{span:16},labelAlign:"left",children:[h.showEmail&&(0,t.jsx)(s.Form.Item,{label:"Email",name:"user_email",className:"mb-4",rules:[{type:"email",message:"Please enter a valid email!"}],children:(0,t.jsx)(a.TextInput,{placeholder:"user@example.com"})}),h.showEmail&&h.showUserId&&(0,t.jsx)("div",{className:"text-center mb-4",children:(0,t.jsx)(r.Text,{children:"OR"})}),h.showUserId&&(0,t.jsx)(s.Form.Item,{label:"User ID",name:"user_id",className:"mb-4",children:(0,t.jsx)(a.TextInput,{placeholder:"user_123"})}),(0,t.jsx)(s.Form.Item,{label:(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("span",{children:"Role"}),"edit"===g&&u&&(0,t.jsxs)("span",{className:"text-gray-500 text-sm",children:["(Current: ",(p=u.role,h.roleOptions.find(e=>e.value===p)?.label||p),")"]})]}),name:"role",className:"mb-4",rules:[{required:!0,message:"Please select a role!"}],children:(0,t.jsx)(n.Select,{children:"edit"===g&&u?[...h.roleOptions.filter(e=>e.value===u.role),...h.roleOptions.filter(e=>e.value!==u.role)].map(e=>(0,t.jsx)(n.Select.Option,{value:e.value,children:e.label},e.value)):h.roleOptions.map(e=>(0,t.jsx)(n.Select.Option,{value:e.value,children:e.label},e.value))})}),h.additionalFields?.map(e=>(0,t.jsx)(s.Form.Item,{label:e.label,name:e.name,className:"mb-4",rules:e.rules,children:(e=>{switch(e.type){case"input":return(0,t.jsx)(a.TextInput,{placeholder:e.placeholder});case"numerical":return(0,t.jsx)(d.default,{step:e.step||1,min:e.min||0,style:{width:"100%"},placeholder:e.placeholder||"Enter a numerical value"});case"select":return(0,t.jsx)(n.Select,{children:e.options?.map(e=>(0,t.jsx)(n.Select.Option,{value:e.value,children:e.label},e.value))});default:return null}})(e)},e.name)),(0,t.jsxs)("div",{className:"text-right mt-6",children:[(0,t.jsx)(l.Button,{onClick:c,className:"mr-2",disabled:f,children:"Cancel"}),(0,t.jsx)(l.Button,{type:"default",htmlType:"submit",loading:f,children:"add"===g?f?"Adding...":"Add Member":f?"Saving...":"Save Changes"})]})]})})}])}]); \ No newline at end of file diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/316d3919d0bb4207.js b/litellm/proxy/_experimental/out/_next/static/chunks/316d3919d0bb4207.js new file mode 100644 index 0000000000..e2d2fe7a1b --- /dev/null +++ b/litellm/proxy/_experimental/out/_next/static/chunks/316d3919d0bb4207.js @@ -0,0 +1 @@ +(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,440987,e=>{"use strict";var t=e.i(903446);e.s(["SettingsIcon",()=>t.default])},848725,e=>{"use strict";var t=e.i(271645);let r=t.forwardRef(function(e,r){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:r},e),t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z"}),t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M2.458 12C3.732 7.943 7.523 5 12 5c4.478 0 8.268 2.943 9.542 7-1.274 4.057-5.064 7-9.542 7-4.477 0-8.268-2.943-9.542-7z"}))});e.s(["EyeIcon",0,r],848725)},292335,122520,e=>{"use strict";let t={NONE:"none",API_KEY:"api_key",BEARER_TOKEN:"bearer_token",TOKEN:"token",BASIC:"basic",OAUTH2:"oauth2",AWS_SIGV4:"aws_sigv4"},r={SSE:"sse",HTTP:"http",STDIO:"stdio",OPENAPI:"openapi"};function s(e){if(e instanceof Error)return e.message;if(e&&"object"==typeof e){let t=e.detail;return"string"==typeof t?t:Array.isArray(t)?t.map(e=>e&&"object"==typeof e?"string"==typeof e.msg?e.msg:JSON.stringify(e):String(e)).join("; "):t&&"object"==typeof t&&"string"==typeof t.error?t.error:"string"==typeof e.message?e.message:JSON.stringify(e)}return String(e)}e.s(["AUTH_TYPE",0,t,"OAUTH_FLOW",0,{INTERACTIVE:"interactive",M2M:"m2m"},"TRANSPORT",0,r,"handleAuth",0,e=>null==e?t.NONE:e,"handleTransport",0,(e,t)=>null==e?r.SSE:t&&e!==r.STDIO?r.OPENAPI:e],292335),e.s(["extractErrorMessage",()=>s],122520)},988846,e=>{"use strict";var t=e.i(54943);e.s(["SearchIcon",()=>t.default])},328196,e=>{"use strict";var t=e.i(361653);e.s(["AlertCircleIcon",()=>t.default])},302202,e=>{"use strict";let t=(0,e.i(475254).default)("server",[["rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2",key:"ngkwjq"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2",key:"iecqi9"}],["line",{x1:"6",x2:"6.01",y1:"6",y2:"6",key:"16zg32"}],["line",{x1:"6",x2:"6.01",y1:"18",y2:"18",key:"nzw8ys"}]]);e.s(["ServerIcon",()=>t],302202)},54131,634831,438100,e=>{"use strict";var t=e.i(399219);e.s(["ChevronUpIcon",()=>t.default],54131);var r=e.i(546467);e.s(["ExternalLinkIcon",()=>r.default],634831);let s=(0,e.i(475254).default)("key",[["path",{d:"m15.5 7.5 2.3 2.3a1 1 0 0 0 1.4 0l2.1-2.1a1 1 0 0 0 0-1.4L19 4",key:"g0fldk"}],["path",{d:"m21 2-9.6 9.6",key:"1j0ho8"}],["circle",{cx:"7.5",cy:"15.5",r:"5.5",key:"yqb3hr"}]]);e.s(["KeyIcon",()=>s],438100)},546467,e=>{"use strict";let t=(0,e.i(475254).default)("external-link",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]]);e.s(["default",()=>t])},54943,e=>{"use strict";let t=(0,e.i(475254).default)("search",[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]]);e.s(["default",()=>t])},987432,e=>{"use strict";e.i(247167);var t=e.i(931067),r=e.i(271645);let s={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M893.3 293.3L730.7 130.7c-7.5-7.5-16.7-13-26.7-16V112H144c-17.7 0-32 14.3-32 32v736c0 17.7 14.3 32 32 32h736c17.7 0 32-14.3 32-32V338.5c0-17-6.7-33.2-18.7-45.2zM384 184h256v104H384V184zm456 656H184V184h136v136c0 17.7 14.3 32 32 32h320c17.7 0 32-14.3 32-32V205.8l136 136V840zM512 442c-79.5 0-144 64.5-144 144s64.5 144 144 144 144-64.5 144-144-64.5-144-144-144zm0 224c-44.2 0-80-35.8-80-80s35.8-80 80-80 80 35.8 80 80-35.8 80-80 80z"}}]},name:"save",theme:"outlined"};var a=e.i(9583),l=r.forwardRef(function(e,l){return r.createElement(a.default,(0,t.default)({},e,{ref:l,icon:s}))});e.s(["SaveOutlined",0,l],987432)},995926,e=>{"use strict";var t=e.i(841947);e.s(["XIcon",()=>t.default])},903446,e=>{"use strict";let t=(0,e.i(475254).default)("settings",[["path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z",key:"1qme2f"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);e.s(["default",()=>t])},596239,e=>{"use strict";e.i(247167);var t=e.i(931067),r=e.i(271645);let s={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M574 665.4a8.03 8.03 0 00-11.3 0L446.5 781.6c-53.8 53.8-144.6 59.5-204 0-59.5-59.5-53.8-150.2 0-204l116.2-116.2c3.1-3.1 3.1-8.2 0-11.3l-39.8-39.8a8.03 8.03 0 00-11.3 0L191.4 526.5c-84.6 84.6-84.6 221.5 0 306s221.5 84.6 306 0l116.2-116.2c3.1-3.1 3.1-8.2 0-11.3L574 665.4zm258.6-474c-84.6-84.6-221.5-84.6-306 0L410.3 307.6a8.03 8.03 0 000 11.3l39.7 39.7c3.1 3.1 8.2 3.1 11.3 0l116.2-116.2c53.8-53.8 144.6-59.5 204 0 59.5 59.5 53.8 150.2 0 204L665.3 562.6a8.03 8.03 0 000 11.3l39.8 39.8c3.1 3.1 8.2 3.1 11.3 0l116.2-116.2c84.5-84.6 84.5-221.5 0-306.1zM610.1 372.3a8.03 8.03 0 00-11.3 0L372.3 598.7a8.03 8.03 0 000 11.3l39.6 39.6c3.1 3.1 8.2 3.1 11.3 0l226.4-226.4c3.1-3.1 3.1-8.2 0-11.3l-39.5-39.6z"}}]},name:"link",theme:"outlined"};var a=e.i(9583),l=r.forwardRef(function(e,l){return r.createElement(a.default,(0,t.default)({},e,{ref:l,icon:s}))});e.s(["LinkOutlined",0,l],596239)},434166,e=>{"use strict";function t(e,t){window.sessionStorage.setItem(e,btoa(encodeURIComponent(t).replace(/%([0-9A-F]{2})/g,(e,t)=>String.fromCharCode(parseInt(t,16)))))}function r(e){try{let t=window.sessionStorage.getItem(e);if(null===t)return null;return decodeURIComponent(atob(t).split("").map(e=>"%"+e.charCodeAt(0).toString(16).padStart(2,"0")).join(""))}catch{return null}}e.s(["getSecureItem",()=>r,"setSecureItem",()=>t])},362024,e=>{"use strict";var t=e.i(988122);e.s(["Collapse",()=>t.default])},245704,e=>{"use strict";e.i(247167);var t=e.i(931067),r=e.i(271645);let s={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M699 353h-46.9c-10.2 0-19.9 4.9-25.9 13.3L469 584.3l-71.2-98.8c-6-8.3-15.6-13.3-25.9-13.3H325c-6.5 0-10.3 7.4-6.5 12.7l124.6 172.8a31.8 31.8 0 0051.7 0l210.6-292c3.9-5.3.1-12.7-6.4-12.7z"}},{tag:"path",attrs:{d:"M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z"}}]},name:"check-circle",theme:"outlined"};var a=e.i(9583),l=r.forwardRef(function(e,l){return r.createElement(a.default,(0,t.default)({},e,{ref:l,icon:s}))});e.s(["CheckCircleOutlined",0,l],245704)},492030,e=>{"use strict";var t=e.i(121229);e.s(["CheckOutlined",()=>t.default])},149192,e=>{"use strict";var t=e.i(864517);e.s(["CloseOutlined",()=>t.default])},245094,e=>{"use strict";e.i(247167);var t=e.i(931067),r=e.i(271645);let s={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M516 673c0 4.4 3.4 8 7.5 8h185c4.1 0 7.5-3.6 7.5-8v-48c0-4.4-3.4-8-7.5-8h-185c-4.1 0-7.5 3.6-7.5 8v48zm-194.9 6.1l192-161c3.8-3.2 3.8-9.1 0-12.3l-192-160.9A7.95 7.95 0 00308 351v62.7c0 2.4 1 4.6 2.9 6.1L420.7 512l-109.8 92.2a8.1 8.1 0 00-2.9 6.1V673c0 6.8 7.9 10.5 13.1 6.1zM880 112H144c-17.7 0-32 14.3-32 32v736c0 17.7 14.3 32 32 32h736c17.7 0 32-14.3 32-32V144c0-17.7-14.3-32-32-32zm-40 728H184V184h656v656z"}}]},name:"code",theme:"outlined"};var a=e.i(9583),l=r.forwardRef(function(e,l){return r.createElement(a.default,(0,t.default)({},e,{ref:l,icon:s}))});e.s(["CodeOutlined",0,l],245094)},458505,e=>{"use strict";e.i(247167);var t=e.i(931067),r=e.i(271645);let s={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372zm47.7-395.2l-25.4-5.9V348.6c38 5.2 61.5 29 65.5 58.2.5 4 3.9 6.9 7.9 6.9h44.9c4.7 0 8.4-4.1 8-8.8-6.1-62.3-57.4-102.3-125.9-109.2V263c0-4.4-3.6-8-8-8h-28.1c-4.4 0-8 3.6-8 8v33c-70.8 6.9-126.2 46-126.2 119 0 67.6 49.8 100.2 102.1 112.7l24.7 6.3v142.7c-44.2-5.9-69-29.5-74.1-61.3-.6-3.8-4-6.6-7.9-6.6H363c-4.7 0-8.4 4-8 8.7 4.5 55 46.2 105.6 135.2 112.1V761c0 4.4 3.6 8 8 8h28.4c4.4 0 8-3.6 8-8.1l-.2-31.7c78.3-6.9 134.3-48.8 134.3-124-.1-69.4-44.2-100.4-109-116.4zm-68.6-16.2c-5.6-1.6-10.3-3.1-15-5-33.8-12.2-49.5-31.9-49.5-57.3 0-36.3 27.5-57 64.5-61.7v124zM534.3 677V543.3c3.1.9 5.9 1.6 8.8 2.2 47.3 14.4 63.2 34.4 63.2 65.1 0 39.1-29.4 62.6-72 66.4z"}}]},name:"dollar",theme:"outlined"};var a=e.i(9583),l=r.forwardRef(function(e,l){return r.createElement(a.default,(0,t.default)({},e,{ref:l,icon:s}))});e.s(["DollarOutlined",0,l],458505)},611052,e=>{"use strict";var t=e.i(843476),r=e.i(271645),s=e.i(212931),a=e.i(311451),l=e.i(790848),i=e.i(888259),c=e.i(438957);e.i(247167);var n=e.i(931067);let o={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M832 464h-68V240c0-70.7-57.3-128-128-128H388c-70.7 0-128 57.3-128 128v224h-68c-17.7 0-32 14.3-32 32v384c0 17.7 14.3 32 32 32h640c17.7 0 32-14.3 32-32V496c0-17.7-14.3-32-32-32zM332 240c0-30.9 25.1-56 56-56h248c30.9 0 56 25.1 56 56v224H332V240zm460 600H232V536h560v304zM484 701v53c0 4.4 3.6 8 8 8h40c4.4 0 8-3.6 8-8v-53a48.01 48.01 0 10-56 0z"}}]},name:"lock",theme:"outlined"};var d=e.i(9583),u=r.forwardRef(function(e,t){return r.createElement(d.default,(0,n.default)({},e,{ref:t,icon:o}))}),h=e.i(492030),x=e.i(266537),m=e.i(447566),f=e.i(149192),g=e.i(596239);e.s(["ByokCredentialModal",0,({server:e,open:n,onClose:o,onSuccess:d,accessToken:v})=>{let[y,p]=(0,r.useState)(1),[b,j]=(0,r.useState)(""),[k,w]=(0,r.useState)(!0),[N,C]=(0,r.useState)(!1),S=e.alias||e.server_name||"Service",I=S.charAt(0).toUpperCase(),z=()=>{p(1),j(""),w(!0),C(!1),o()},A=async()=>{if(!b.trim())return void i.default.error("Please enter your API key");C(!0);try{let t=await fetch(`/v1/mcp/server/${e.server_id}/user-credential`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${v}`},body:JSON.stringify({credential:b.trim(),save:k})});if(!t.ok){let e=await t.json();throw Error(e?.detail?.error||"Failed to save credential")}i.default.success(`Connected to ${S}`),d(e.server_id),z()}catch(e){i.default.error(e.message||"Failed to connect")}finally{C(!1)}};return(0,t.jsx)(s.Modal,{open:n,onCancel:z,footer:null,width:480,closeIcon:null,className:"byok-modal",children:(0,t.jsxs)("div",{className:"relative p-2",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between mb-6",children:[2===y?(0,t.jsxs)("button",{onClick:()=>p(1),className:"flex items-center gap-1 text-gray-500 hover:text-gray-800 text-sm",children:[(0,t.jsx)(m.ArrowLeftOutlined,{})," Back"]}):(0,t.jsx)("div",{}),(0,t.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,t.jsx)("div",{className:`w-2 h-2 rounded-full ${1===y?"bg-blue-500":"bg-gray-300"}`}),(0,t.jsx)("div",{className:`w-2 h-2 rounded-full ${2===y?"bg-blue-500":"bg-gray-300"}`})]}),(0,t.jsx)("button",{onClick:z,className:"text-gray-400 hover:text-gray-600",children:(0,t.jsx)(f.CloseOutlined,{})})]}),1===y?(0,t.jsxs)("div",{className:"text-center",children:[(0,t.jsxs)("div",{className:"flex items-center justify-center gap-3 mb-6",children:[(0,t.jsx)("div",{className:"w-14 h-14 rounded-xl bg-gradient-to-br from-teal-400 to-cyan-600 flex items-center justify-center text-white font-bold text-xl shadow",children:"L"}),(0,t.jsx)(x.ArrowRightOutlined,{className:"text-gray-400 text-lg"}),(0,t.jsx)("div",{className:"w-14 h-14 rounded-xl bg-gradient-to-br from-blue-600 to-indigo-800 flex items-center justify-center text-white font-bold text-xl shadow",children:I})]}),(0,t.jsxs)("h2",{className:"text-2xl font-bold text-gray-900 mb-2",children:["Connect ",S]}),(0,t.jsxs)("p",{className:"text-gray-500 mb-6",children:["LiteLLM needs access to ",S," to complete your request."]}),(0,t.jsx)("div",{className:"bg-gray-50 rounded-xl p-4 text-left mb-4",children:(0,t.jsxs)("div",{className:"flex items-start gap-3",children:[(0,t.jsx)("div",{className:"mt-0.5",children:(0,t.jsxs)("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",className:"text-gray-500",children:[(0,t.jsx)("rect",{x:"2",y:"4",width:"20",height:"16",rx:"2",stroke:"currentColor",strokeWidth:"2"}),(0,t.jsx)("path",{d:"M8 4v16M16 4v16",stroke:"currentColor",strokeWidth:"2"})]})}),(0,t.jsxs)("div",{children:[(0,t.jsx)("p",{className:"font-semibold text-gray-800 mb-1",children:"How it works"}),(0,t.jsxs)("p",{className:"text-gray-500 text-sm",children:["LiteLLM acts as a secure bridge. Your requests are routed through our MCP client directly to"," ",S,"'s API."]})]})]})}),e.byok_description&&e.byok_description.length>0&&(0,t.jsxs)("div",{className:"bg-gray-50 rounded-xl p-4 text-left mb-6",children:[(0,t.jsxs)("p",{className:"text-xs font-semibold text-gray-500 uppercase tracking-widest mb-3 flex items-center gap-2",children:[(0,t.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",className:"text-green-500",children:[(0,t.jsx)("path",{d:"M12 2L12 22M2 12L22 12",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"}),(0,t.jsx)("circle",{cx:"12",cy:"12",r:"9",stroke:"currentColor",strokeWidth:"2"})]}),"Requested Access"]}),(0,t.jsx)("ul",{className:"space-y-2",children:e.byok_description.map((e,r)=>(0,t.jsxs)("li",{className:"flex items-center gap-2 text-sm text-gray-700",children:[(0,t.jsx)(h.CheckOutlined,{className:"text-green-500 flex-shrink-0"}),e]},r))})]}),(0,t.jsxs)("button",{onClick:()=>p(2),className:"w-full bg-gray-900 hover:bg-gray-700 text-white font-medium py-3 px-6 rounded-xl flex items-center justify-center gap-2 transition-colors",children:["Continue to Authentication ",(0,t.jsx)(x.ArrowRightOutlined,{})]}),(0,t.jsx)("button",{onClick:z,className:"mt-3 w-full text-gray-400 hover:text-gray-600 text-sm py-2",children:"Cancel"})]}):(0,t.jsxs)("div",{children:[(0,t.jsx)("div",{className:"w-12 h-12 rounded-full bg-blue-50 flex items-center justify-center mb-4",children:(0,t.jsx)(c.KeyOutlined,{className:"text-blue-400 text-xl"})}),(0,t.jsx)("h2",{className:"text-2xl font-bold text-gray-900 mb-2",children:"Provide API Key"}),(0,t.jsxs)("p",{className:"text-gray-500 mb-6",children:["Enter your ",S," API key to authorize this connection."]}),(0,t.jsxs)("div",{className:"mb-4",children:[(0,t.jsxs)("label",{className:"block text-sm font-semibold text-gray-800 mb-2",children:[S," API Key"]}),(0,t.jsx)(a.Input.Password,{placeholder:"Enter your API key",value:b,onChange:e=>j(e.target.value),size:"large",className:"rounded-lg"}),e.byok_api_key_help_url&&(0,t.jsxs)("a",{href:e.byok_api_key_help_url,target:"_blank",rel:"noopener noreferrer",className:"text-blue-500 hover:text-blue-700 text-sm mt-2 flex items-center gap-1",children:["Where do I find my API key? ",(0,t.jsx)(g.LinkOutlined,{})]})]}),(0,t.jsxs)("div",{className:"bg-gray-50 rounded-xl p-4 flex items-center justify-between mb-4",children:[(0,t.jsxs)("div",{className:"flex items-center gap-3",children:[(0,t.jsx)("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",className:"text-gray-500",children:(0,t.jsx)("path",{d:"M12 2C8.13 2 5 5.13 5 9c0 5.25 7 13 7 13s7-7.75 7-13c0-3.87-3.13-7-7-7zm0 9.5c-1.38 0-2.5-1.12-2.5-2.5s1.12-2.5 2.5-2.5 2.5 1.12 2.5 2.5-1.12 2.5-2.5 2.5z",fill:"currentColor"})}),(0,t.jsx)("span",{className:"text-sm font-medium text-gray-800",children:"Save key for future use"})]}),(0,t.jsx)(l.Switch,{checked:k,onChange:w})]}),(0,t.jsxs)("div",{className:"bg-blue-50 rounded-xl p-4 flex items-start gap-3 mb-6",children:[(0,t.jsx)(u,{className:"text-blue-400 mt-0.5 flex-shrink-0"}),(0,t.jsx)("p",{className:"text-sm text-blue-700",children:"Your key is stored securely and transmitted over HTTPS. It is never shared with third parties."})]}),(0,t.jsxs)("button",{onClick:A,disabled:N,className:"w-full bg-blue-500 hover:bg-blue-600 disabled:opacity-60 text-white font-medium py-3 px-6 rounded-xl flex items-center justify-center gap-2 transition-colors",children:[(0,t.jsx)(u,{})," Connect & Authorize"]})]})]})})}],611052)},338468,e=>{"use strict";var t=e.i(843476);e.i(111790);var r=e.i(280881),s=e.i(135214);e.s(["default",0,()=>{let{accessToken:e,userRole:a,userId:l}=(0,s.default)();return(0,t.jsx)(r.MCPServers,{accessToken:e,userRole:a,userID:l})}])}]); \ No newline at end of file diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/354ca537c6c0601c.js b/litellm/proxy/_experimental/out/_next/static/chunks/354ca537c6c0601c.js deleted file mode 100644 index d4c3a656df..0000000000 --- a/litellm/proxy/_experimental/out/_next/static/chunks/354ca537c6c0601c.js +++ /dev/null @@ -1,8 +0,0 @@ -(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,907308,e=>{"use strict";var t=e.i(843476),l=e.i(271645),a=e.i(212931),r=e.i(808613),i=e.i(464571),s=e.i(199133),n=e.i(592968),o=e.i(213205),d=e.i(374009),c=e.i(764205);e.s(["default",0,({isVisible:e,onCancel:u,onSubmit:m,accessToken:g,title:h="Add Team Member",roles:p=[{label:"admin",value:"admin",description:"Admin role. Can create team keys, add members, and manage settings."},{label:"user",value:"user",description:"User role. Can view team info, but not manage it."}],defaultRole:f="user",teamId:b})=>{let[v]=r.Form.useForm(),[x,j]=(0,l.useState)([]),[w,y]=(0,l.useState)(!1),[k,C]=(0,l.useState)("user_email"),[$,O]=(0,l.useState)(!1),N=async(e,t)=>{if(!e)return void j([]);y(!0);try{let l=new URLSearchParams;if(l.append(t,e),b&&l.append("team_id",b),null==g)return;let a=(await (0,c.userFilterUICall)(g,l)).map(e=>({label:"user_email"===t?`${e.user_email}`:`${e.user_id}`,value:"user_email"===t?e.user_email:e.user_id,user:e}));j(a)}catch(e){console.error("Error fetching users:",e)}finally{y(!1)}},E=(0,l.useCallback)((0,d.default)((e,t)=>N(e,t),300),[]),T=(e,t)=>{C(t),E(e,t)},M=(e,t)=>{let l=t.user;v.setFieldsValue({user_email:l.user_email,user_id:l.user_id,role:v.getFieldValue("role")})},_=async e=>{O(!0);try{await m(e)}finally{O(!1)}};return(0,t.jsx)(a.Modal,{title:h,open:e,onCancel:()=>{v.resetFields(),j([]),u()},footer:null,width:800,maskClosable:!$,children:(0,t.jsxs)(r.Form,{form:v,onFinish:_,labelCol:{span:8},wrapperCol:{span:16},labelAlign:"left",initialValues:{role:f},children:[(0,t.jsx)(r.Form.Item,{label:"Email",name:"user_email",className:"mb-4",children:(0,t.jsx)(s.Select,{showSearch:!0,className:"w-full",placeholder:"Search by email",filterOption:!1,onSearch:e=>T(e,"user_email"),onSelect:(e,t)=>M(e,t),options:"user_email"===k?x:[],loading:w,allowClear:!0})}),(0,t.jsx)("div",{className:"text-center mb-4",children:"OR"}),(0,t.jsx)(r.Form.Item,{label:"User ID",name:"user_id",className:"mb-4",children:(0,t.jsx)(s.Select,{showSearch:!0,className:"w-full",placeholder:"Search by user ID",filterOption:!1,onSearch:e=>T(e,"user_id"),onSelect:(e,t)=>M(e,t),options:"user_id"===k?x:[],loading:w,allowClear:!0})}),(0,t.jsx)(r.Form.Item,{label:"Member Role",name:"role",className:"mb-4",children:(0,t.jsx)(s.Select,{defaultValue:f,children:p.map(e=>(0,t.jsx)(s.Select.Option,{value:e.value,children:(0,t.jsxs)(n.Tooltip,{title:e.description,children:[(0,t.jsx)("span",{className:"font-medium",children:e.label}),(0,t.jsxs)("span",{className:"ml-2 text-gray-500 text-sm",children:["- ",e.description]})]})},e.value))})}),(0,t.jsx)("div",{className:"text-right mt-4",children:(0,t.jsx)(i.Button,{type:"primary",htmlType:"submit",icon:(0,t.jsx)(o.UserAddOutlined,{}),loading:$,children:$?"Adding...":"Add Member"})})]})})}])},162386,e=>{"use strict";var t=e.i(843476),l=e.i(625901),a=e.i(109799),r=e.i(785242),i=e.i(738014),s=e.i(199133),n=e.i(981339),o=e.i(592968);let d={label:"All Proxy Models",value:"all-proxy-models"},c={label:"No Default Models",value:"no-default-models"},u=[d,c],m={user:({allProxyModels:e,userModels:t,options:l})=>t&&l?.includeUserModels?t:[],team:({allProxyModels:e,selectedOrganization:t,userModels:l})=>t?t.models.includes(d.value)||0===t.models.length?e:e.filter(e=>t.models.includes(e)):e??[],organization:({allProxyModels:e})=>e,global:({allProxyModels:e})=>e};e.s(["ModelSelect",0,e=>{let{teamID:g,organizationID:h,options:p,context:f,dataTestId:b,value:v=[],onChange:x,style:j}=e,{includeUserModels:w,showAllTeamModelsOption:y,showAllProxyModelsOverride:k,includeSpecialOptions:C}=p||{},{data:$,isLoading:O}=(0,l.useAllProxyModels)(),{data:N,isLoading:E}=(0,r.useTeam)(g),{data:T,isLoading:M}=(0,a.useOrganization)(h),{data:_,isLoading:I}=(0,i.useCurrentUser)(),S=e=>u.some(t=>t.value===e),R=v.some(S),A=T?.models.includes(d.value)||T?.models.length===0;if(O||E||M||I)return(0,t.jsx)(n.Skeleton.Input,{active:!0,block:!0});let{wildcard:q,regular:F}=(e=>{let t=[],l=[];for(let a of e)a.endsWith("/*")?t.push(a):l.push(a);return{wildcard:t,regular:l}})(((e,t,l)=>{let a=Array.from(new Map(e.map(e=>[e.id,e])).values()).map(e=>e.id);if(t.options?.showAllProxyModelsOverride)return a;let r=m[t.context];return r?r({allProxyModels:a,...l,options:t.options}):[]})($?.data??[],e,{selectedTeam:N,selectedOrganization:T,userModels:_?.models}));return(0,t.jsx)(s.Select,{"data-testid":b,value:v,onChange:e=>{let t=e.filter(S);x(t.length>0?[t[t.length-1]]:e)},style:j,options:[C?{label:(0,t.jsx)("span",{children:"Special Options"}),title:"Special Options",options:[...k||A&&C||"global"===f?[{label:(0,t.jsx)("span",{children:"All Proxy Models"}),value:d.value,disabled:v.length>0&&v.some(e=>S(e)&&e!==d.value),key:d.value}]:[],{label:(0,t.jsx)("span",{children:"No Default Models"}),value:c.value,disabled:v.length>0&&v.some(e=>S(e)&&e!==c.value),key:c.value}]}:[],...q.length>0?[{label:(0,t.jsx)("span",{children:"Wildcard Options"}),title:"Wildcard Options",options:q.map(e=>{let l=e.replace("/*",""),a=l.charAt(0).toUpperCase()+l.slice(1);return{label:(0,t.jsx)("span",{children:`All ${a} models`}),value:e,disabled:R}})}]:[],{label:(0,t.jsx)("span",{children:"Models"}),title:"Models",options:F.map(e=>({label:(0,t.jsx)("span",{children:e}),value:e,disabled:R}))}],mode:"multiple",placeholder:"Select Models",allowClear:!0,maxTagCount:"responsive",maxTagPlaceholder:e=>(0,t.jsx)(o.Tooltip,{styles:{root:{pointerEvents:"none"}},title:e.map(({value:e})=>e).join(", "),children:(0,t.jsxs)("span",{children:["+",e.length," more"]})})})}],162386)},276173,e=>{"use strict";var t=e.i(843476),l=e.i(599724),a=e.i(779241),r=e.i(464571),i=e.i(808613),s=e.i(212931),n=e.i(199133),o=e.i(271645),d=e.i(435451);e.s(["default",0,({visible:e,onCancel:c,onSubmit:u,initialData:m,mode:g,config:h})=>{let p,[f]=i.Form.useForm(),[b,v]=(0,o.useState)(!1);console.log("Initial Data:",m),(0,o.useEffect)(()=>{if(e)if("edit"===g&&m){let e={...m,role:m.role||h.defaultRole,max_budget_in_team:m.max_budget_in_team||null,tpm_limit:m.tpm_limit||null,rpm_limit:m.rpm_limit||null};console.log("Setting form values:",e),f.setFieldsValue(e)}else f.resetFields(),f.setFieldsValue({role:h.defaultRole||h.roleOptions[0]?.value})},[e,m,g,f,h.defaultRole,h.roleOptions]);let x=async e=>{try{v(!0);let t=Object.entries(e).reduce((e,[t,l])=>{if("string"==typeof l){let a=l.trim();return""===a&&("max_budget_in_team"===t||"tpm_limit"===t||"rpm_limit"===t)?{...e,[t]:null}:{...e,[t]:a}}return{...e,[t]:l}},{});console.log("Submitting form data:",t),await Promise.resolve(u(t)),f.resetFields()}catch(e){console.error("Form submission error:",e)}finally{v(!1)}};return(0,t.jsx)(s.Modal,{title:h.title||("add"===g?"Add Member":"Edit Member"),open:e,width:1e3,footer:null,onCancel:c,children:(0,t.jsxs)(i.Form,{form:f,onFinish:x,labelCol:{span:8},wrapperCol:{span:16},labelAlign:"left",children:[h.showEmail&&(0,t.jsx)(i.Form.Item,{label:"Email",name:"user_email",className:"mb-4",rules:[{type:"email",message:"Please enter a valid email!"}],children:(0,t.jsx)(a.TextInput,{placeholder:"user@example.com"})}),h.showEmail&&h.showUserId&&(0,t.jsx)("div",{className:"text-center mb-4",children:(0,t.jsx)(l.Text,{children:"OR"})}),h.showUserId&&(0,t.jsx)(i.Form.Item,{label:"User ID",name:"user_id",className:"mb-4",children:(0,t.jsx)(a.TextInput,{placeholder:"user_123"})}),(0,t.jsx)(i.Form.Item,{label:(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("span",{children:"Role"}),"edit"===g&&m&&(0,t.jsxs)("span",{className:"text-gray-500 text-sm",children:["(Current: ",(p=m.role,h.roleOptions.find(e=>e.value===p)?.label||p),")"]})]}),name:"role",className:"mb-4",rules:[{required:!0,message:"Please select a role!"}],children:(0,t.jsx)(n.Select,{children:"edit"===g&&m?[...h.roleOptions.filter(e=>e.value===m.role),...h.roleOptions.filter(e=>e.value!==m.role)].map(e=>(0,t.jsx)(n.Select.Option,{value:e.value,children:e.label},e.value)):h.roleOptions.map(e=>(0,t.jsx)(n.Select.Option,{value:e.value,children:e.label},e.value))})}),h.additionalFields?.map(e=>(0,t.jsx)(i.Form.Item,{label:e.label,name:e.name,className:"mb-4",rules:e.rules,children:(e=>{switch(e.type){case"input":return(0,t.jsx)(a.TextInput,{placeholder:e.placeholder});case"numerical":return(0,t.jsx)(d.default,{step:e.step||1,min:e.min||0,style:{width:"100%"},placeholder:e.placeholder||"Enter a numerical value"});case"select":return(0,t.jsx)(n.Select,{children:e.options?.map(e=>(0,t.jsx)(n.Select.Option,{value:e.value,children:e.label},e.value))});default:return null}})(e)},e.name)),(0,t.jsxs)("div",{className:"text-right mt-6",children:[(0,t.jsx)(r.Button,{onClick:c,className:"mr-2",disabled:b,children:"Cancel"}),(0,t.jsx)(r.Button,{type:"default",htmlType:"submit",loading:b,children:"add"===g?b?"Adding...":"Add Member":b?"Saving...":"Save Changes"})]})]})})}])},294612,e=>{"use strict";var t=e.i(843476),l=e.i(100486),a=e.i(827252),r=e.i(213205),i=e.i(771674),s=e.i(464571),n=e.i(770914),o=e.i(291542),d=e.i(262218),c=e.i(592968),u=e.i(898586),m=e.i(902555);let{Text:g}=u.Typography;function h({members:e,canEdit:u,onEdit:h,onDelete:p,onAddMember:f,roleColumnTitle:b="Role",roleTooltip:v,extraColumns:x=[],showDeleteForMember:j,emptyText:w}){let y=[{title:"User Email",dataIndex:"user_email",key:"user_email",render:e=>(0,t.jsx)(g,{children:e||"-"})},{title:"User ID",dataIndex:"user_id",key:"user_id",render:e=>"default_user_id"===e?(0,t.jsx)(d.Tag,{color:"blue",children:"Default Proxy Admin"}):(0,t.jsx)(g,{children:e||"-"})},{title:v?(0,t.jsxs)(n.Space,{direction:"horizontal",children:[b,(0,t.jsx)(c.Tooltip,{title:v,children:(0,t.jsx)(a.InfoCircleOutlined,{})})]}):b,dataIndex:"role",key:"role",render:e=>(0,t.jsxs)(n.Space,{children:[e?.toLowerCase()==="admin"||e?.toLowerCase()==="org_admin"?(0,t.jsx)(l.CrownOutlined,{}):(0,t.jsx)(i.UserOutlined,{}),(0,t.jsx)(g,{style:{textTransform:"capitalize"},children:e||"-"})]})},...x,{title:"Actions",key:"actions",fixed:"right",width:120,render:(e,l)=>u?(0,t.jsxs)(n.Space,{children:[(0,t.jsx)(m.default,{variant:"Edit",tooltipText:"Edit member",dataTestId:"edit-member",onClick:()=>h(l)}),(!j||j(l))&&(0,t.jsx)(m.default,{variant:"Delete",tooltipText:"Delete member",dataTestId:"delete-member",onClick:()=>p(l)})]}):null}];return(0,t.jsxs)(n.Space,{direction:"vertical",style:{width:"100%"},children:[(0,t.jsxs)("span",{className:"inline-flex text-sm text-gray-700",children:[e.length," Member",1!==e.length?"s":""]}),(0,t.jsx)(o.Table,{columns:y,dataSource:e,rowKey:e=>e.user_id??e.user_email??JSON.stringify(e),pagination:!1,size:"small",scroll:{x:"max-content"},locale:w?{emptyText:w}:void 0}),f&&u&&(0,t.jsx)(s.Button,{icon:(0,t.jsx)(r.UserAddOutlined,{}),type:"primary",onClick:f,children:"Add Member"})]})}e.s(["default",()=>h])},551332,e=>{"use strict";var t=e.i(271645);let l=t.forwardRef(function(e,l){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:l},e),t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8 5H6a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2v-1M8 5a2 2 0 002 2h2a2 2 0 002-2M8 5a2 2 0 012-2h2a2 2 0 012 2m0 0h2a2 2 0 012 2v3m2 4H10m0 0l3-3m-3 3l3 3"}))});e.s(["ClipboardCopyIcon",0,l],551332)},122577,e=>{"use strict";var t=e.i(271645);let l=t.forwardRef(function(e,l){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:l},e),t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M14.752 11.168l-3.197-2.132A1 1 0 0010 9.87v4.263a1 1 0 001.555.832l3.197-2.132a1 1 0 000-1.664z"}),t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M21 12a9 9 0 11-18 0 9 9 0 0118 0z"}))});e.s(["PlayIcon",0,l],122577)},902555,e=>{"use strict";var t=e.i(843476),l=e.i(591935),a=e.i(122577),r=e.i(278587),i=e.i(68155),s=e.i(360820),n=e.i(871943),o=e.i(434626),d=e.i(551332),c=e.i(592968),u=e.i(115504),m=e.i(752978);function g({icon:e,onClick:l,className:a,disabled:r,dataTestId:i}){return r?(0,t.jsx)(m.Icon,{icon:e,size:"sm",className:"opacity-50 cursor-not-allowed","data-testid":i}):(0,t.jsx)(m.Icon,{icon:e,size:"sm",onClick:l,className:(0,u.cx)("cursor-pointer",a),"data-testid":i})}let h={Edit:{icon:l.PencilAltIcon,className:"hover:text-blue-600"},Delete:{icon:i.TrashIcon,className:"hover:text-red-600"},Test:{icon:a.PlayIcon,className:"hover:text-blue-600"},Regenerate:{icon:r.RefreshIcon,className:"hover:text-green-600"},Up:{icon:s.ChevronUpIcon,className:"hover:text-blue-600"},Down:{icon:n.ChevronDownIcon,className:"hover:text-blue-600"},Open:{icon:o.ExternalLinkIcon,className:"hover:text-green-600"},Copy:{icon:d.ClipboardCopyIcon,className:"hover:text-blue-600"}};function p({onClick:e,tooltipText:l,disabled:a=!1,disabledTooltipText:r,dataTestId:i,variant:s}){let{icon:n,className:o}=h[s];return(0,t.jsx)(c.Tooltip,{title:a?r:l,children:(0,t.jsx)("span",{children:(0,t.jsx)(g,{icon:n,onClick:e,className:o,disabled:a,dataTestId:i})})})}e.s(["default",()=>p],902555)},434626,e=>{"use strict";var t=e.i(271645);let l=t.forwardRef(function(e,l){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:l},e),t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14"}))});e.s(["ExternalLinkIcon",0,l],434626)},591935,e=>{"use strict";var t=e.i(271645);let l=t.forwardRef(function(e,l){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:l},e),t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M11 5H6a2 2 0 00-2 2v11a2 2 0 002 2h11a2 2 0 002-2v-5m-1.414-9.414a2 2 0 112.828 2.828L11.828 15H9v-2.828l8.586-8.586z"}))});e.s(["PencilAltIcon",0,l],591935)},360820,e=>{"use strict";var t=e.i(271645);let l=t.forwardRef(function(e,l){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:l},e),t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 15l7-7 7 7"}))});e.s(["ChevronUpIcon",0,l],360820)},871943,e=>{"use strict";var t=e.i(271645);let l=t.forwardRef(function(e,l){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:l},e),t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 9l-7 7-7-7"}))});e.s(["ChevronDownIcon",0,l],871943)},185793,e=>{"use strict";e.i(247167);var t=e.i(271645),l=e.i(343794),a=e.i(242064),r=e.i(529681);let i=e=>{let{prefixCls:a,className:r,style:i,size:s,shape:n}=e,o=(0,l.default)({[`${a}-lg`]:"large"===s,[`${a}-sm`]:"small"===s}),d=(0,l.default)({[`${a}-circle`]:"circle"===n,[`${a}-square`]:"square"===n,[`${a}-round`]:"round"===n}),c=t.useMemo(()=>"number"==typeof s?{width:s,height:s,lineHeight:`${s}px`}:{},[s]);return t.createElement("span",{className:(0,l.default)(a,o,d,r),style:Object.assign(Object.assign({},c),i)})};e.i(296059);var s=e.i(694758),n=e.i(915654),o=e.i(246422),d=e.i(838378);let c=new s.Keyframes("ant-skeleton-loading",{"0%":{backgroundPosition:"100% 50%"},"100%":{backgroundPosition:"0 50%"}}),u=e=>({height:e,lineHeight:(0,n.unit)(e)}),m=e=>Object.assign({width:e},u(e)),g=(e,t)=>Object.assign({width:t(e).mul(5).equal(),minWidth:t(e).mul(5).equal()},u(e)),h=e=>Object.assign({width:e},u(e)),p=(e,t,l)=>{let{skeletonButtonCls:a}=e;return{[`${l}${a}-circle`]:{width:t,minWidth:t,borderRadius:"50%"},[`${l}${a}-round`]:{borderRadius:t}}},f=(e,t)=>Object.assign({width:t(e).mul(2).equal(),minWidth:t(e).mul(2).equal()},u(e)),b=(0,o.genStyleHooks)("Skeleton",e=>{let{componentCls:t,calc:l}=e;return(e=>{let{componentCls:t,skeletonAvatarCls:l,skeletonTitleCls:a,skeletonParagraphCls:r,skeletonButtonCls:i,skeletonInputCls:s,skeletonImageCls:n,controlHeight:o,controlHeightLG:d,controlHeightSM:u,gradientFromColor:b,padding:v,marginSM:x,borderRadius:j,titleHeight:w,blockRadius:y,paragraphLiHeight:k,controlHeightXS:C,paragraphMarginTop:$}=e;return{[t]:{display:"table",width:"100%",[`${t}-header`]:{display:"table-cell",paddingInlineEnd:v,verticalAlign:"top",[l]:Object.assign({display:"inline-block",verticalAlign:"top",background:b},m(o)),[`${l}-circle`]:{borderRadius:"50%"},[`${l}-lg`]:Object.assign({},m(d)),[`${l}-sm`]:Object.assign({},m(u))},[`${t}-content`]:{display:"table-cell",width:"100%",verticalAlign:"top",[a]:{width:"100%",height:w,background:b,borderRadius:y,[`+ ${r}`]:{marginBlockStart:u}},[r]:{padding:0,"> li":{width:"100%",height:k,listStyle:"none",background:b,borderRadius:y,"+ li":{marginBlockStart:C}}},[`${r}> li:last-child:not(:first-child):not(:nth-child(2))`]:{width:"61%"}},[`&-round ${t}-content`]:{[`${a}, ${r} > li`]:{borderRadius:j}}},[`${t}-with-avatar ${t}-content`]:{[a]:{marginBlockStart:x,[`+ ${r}`]:{marginBlockStart:$}}},[`${t}${t}-element`]:Object.assign(Object.assign(Object.assign(Object.assign({display:"inline-block",width:"auto"},(e=>{let{borderRadiusSM:t,skeletonButtonCls:l,controlHeight:a,controlHeightLG:r,controlHeightSM:i,gradientFromColor:s,calc:n}=e;return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({[l]:Object.assign({display:"inline-block",verticalAlign:"top",background:s,borderRadius:t,width:n(a).mul(2).equal(),minWidth:n(a).mul(2).equal()},f(a,n))},p(e,a,l)),{[`${l}-lg`]:Object.assign({},f(r,n))}),p(e,r,`${l}-lg`)),{[`${l}-sm`]:Object.assign({},f(i,n))}),p(e,i,`${l}-sm`))})(e)),(e=>{let{skeletonAvatarCls:t,gradientFromColor:l,controlHeight:a,controlHeightLG:r,controlHeightSM:i}=e;return{[t]:Object.assign({display:"inline-block",verticalAlign:"top",background:l},m(a)),[`${t}${t}-circle`]:{borderRadius:"50%"},[`${t}${t}-lg`]:Object.assign({},m(r)),[`${t}${t}-sm`]:Object.assign({},m(i))}})(e)),(e=>{let{controlHeight:t,borderRadiusSM:l,skeletonInputCls:a,controlHeightLG:r,controlHeightSM:i,gradientFromColor:s,calc:n}=e;return{[a]:Object.assign({display:"inline-block",verticalAlign:"top",background:s,borderRadius:l},g(t,n)),[`${a}-lg`]:Object.assign({},g(r,n)),[`${a}-sm`]:Object.assign({},g(i,n))}})(e)),(e=>{let{skeletonImageCls:t,imageSizeBase:l,gradientFromColor:a,borderRadiusSM:r,calc:i}=e;return{[t]:Object.assign(Object.assign({display:"inline-flex",alignItems:"center",justifyContent:"center",verticalAlign:"middle",background:a,borderRadius:r},h(i(l).mul(2).equal())),{[`${t}-path`]:{fill:"#bfbfbf"},[`${t}-svg`]:Object.assign(Object.assign({},h(l)),{maxWidth:i(l).mul(4).equal(),maxHeight:i(l).mul(4).equal()}),[`${t}-svg${t}-svg-circle`]:{borderRadius:"50%"}}),[`${t}${t}-circle`]:{borderRadius:"50%"}}})(e)),[`${t}${t}-block`]:{width:"100%",[i]:{width:"100%"},[s]:{width:"100%"}},[`${t}${t}-active`]:{[` - ${a}, - ${r} > li, - ${l}, - ${i}, - ${s}, - ${n} - `]:Object.assign({},{background:e.skeletonLoadingBackground,backgroundSize:"400% 100%",animationName:c,animationDuration:e.skeletonLoadingMotionDuration,animationTimingFunction:"ease",animationIterationCount:"infinite"})}}})((0,d.mergeToken)(e,{skeletonAvatarCls:`${t}-avatar`,skeletonTitleCls:`${t}-title`,skeletonParagraphCls:`${t}-paragraph`,skeletonButtonCls:`${t}-button`,skeletonInputCls:`${t}-input`,skeletonImageCls:`${t}-image`,imageSizeBase:l(e.controlHeight).mul(1.5).equal(),borderRadius:100,skeletonLoadingBackground:`linear-gradient(90deg, ${e.gradientFromColor} 25%, ${e.gradientToColor} 37%, ${e.gradientFromColor} 63%)`,skeletonLoadingMotionDuration:"1.4s"}))},e=>{let{colorFillContent:t,colorFill:l}=e;return{color:t,colorGradientEnd:l,gradientFromColor:t,gradientToColor:l,titleHeight:e.controlHeight/2,blockRadius:e.borderRadiusSM,paragraphMarginTop:e.marginLG+e.marginXXS,paragraphLiHeight:e.controlHeight/2}},{deprecatedTokens:[["color","gradientFromColor"],["colorGradientEnd","gradientToColor"]]}),v=e=>{let{prefixCls:a,className:r,style:i,rows:s=0}=e,n=Array.from({length:s}).map((l,a)=>t.createElement("li",{key:a,style:{width:((e,t)=>{let{width:l,rows:a=2}=t;return Array.isArray(l)?l[e]:a-1===e?l:void 0})(a,e)}}));return t.createElement("ul",{className:(0,l.default)(a,r),style:i},n)},x=({prefixCls:e,className:a,width:r,style:i})=>t.createElement("h3",{className:(0,l.default)(e,a),style:Object.assign({width:r},i)});function j(e){return e&&"object"==typeof e?e:{}}let w=e=>{let{prefixCls:r,loading:s,className:n,rootClassName:o,style:d,children:c,avatar:u=!1,title:m=!0,paragraph:g=!0,active:h,round:p}=e,{getPrefixCls:f,direction:w,className:y,style:k}=(0,a.useComponentConfig)("skeleton"),C=f("skeleton",r),[$,O,N]=b(C);if(s||!("loading"in e)){let e,a,r=!!u,s=!!m,c=!!g;if(r){let l=Object.assign(Object.assign({prefixCls:`${C}-avatar`},s&&!c?{size:"large",shape:"square"}:{size:"large",shape:"circle"}),j(u));e=t.createElement("div",{className:`${C}-header`},t.createElement(i,Object.assign({},l)))}if(s||c){let e,l;if(s){let l=Object.assign(Object.assign({prefixCls:`${C}-title`},!r&&c?{width:"38%"}:r&&c?{width:"50%"}:{}),j(m));e=t.createElement(x,Object.assign({},l))}if(c){let e,a=Object.assign(Object.assign({prefixCls:`${C}-paragraph`},(e={},r&&s||(e.width="61%"),!r&&s?e.rows=3:e.rows=2,e)),j(g));l=t.createElement(v,Object.assign({},a))}a=t.createElement("div",{className:`${C}-content`},e,l)}let f=(0,l.default)(C,{[`${C}-with-avatar`]:r,[`${C}-active`]:h,[`${C}-rtl`]:"rtl"===w,[`${C}-round`]:p},y,n,o,O,N);return $(t.createElement("div",{className:f,style:Object.assign(Object.assign({},k),d)},e,a))}return null!=c?c:null};w.Button=e=>{let{prefixCls:s,className:n,rootClassName:o,active:d,block:c=!1,size:u="default"}=e,{getPrefixCls:m}=t.useContext(a.ConfigContext),g=m("skeleton",s),[h,p,f]=b(g),v=(0,r.default)(e,["prefixCls"]),x=(0,l.default)(g,`${g}-element`,{[`${g}-active`]:d,[`${g}-block`]:c},n,o,p,f);return h(t.createElement("div",{className:x},t.createElement(i,Object.assign({prefixCls:`${g}-button`,size:u},v))))},w.Avatar=e=>{let{prefixCls:s,className:n,rootClassName:o,active:d,shape:c="circle",size:u="default"}=e,{getPrefixCls:m}=t.useContext(a.ConfigContext),g=m("skeleton",s),[h,p,f]=b(g),v=(0,r.default)(e,["prefixCls","className"]),x=(0,l.default)(g,`${g}-element`,{[`${g}-active`]:d},n,o,p,f);return h(t.createElement("div",{className:x},t.createElement(i,Object.assign({prefixCls:`${g}-avatar`,shape:c,size:u},v))))},w.Input=e=>{let{prefixCls:s,className:n,rootClassName:o,active:d,block:c,size:u="default"}=e,{getPrefixCls:m}=t.useContext(a.ConfigContext),g=m("skeleton",s),[h,p,f]=b(g),v=(0,r.default)(e,["prefixCls"]),x=(0,l.default)(g,`${g}-element`,{[`${g}-active`]:d,[`${g}-block`]:c},n,o,p,f);return h(t.createElement("div",{className:x},t.createElement(i,Object.assign({prefixCls:`${g}-input`,size:u},v))))},w.Image=e=>{let{prefixCls:r,className:i,rootClassName:s,style:n,active:o}=e,{getPrefixCls:d}=t.useContext(a.ConfigContext),c=d("skeleton",r),[u,m,g]=b(c),h=(0,l.default)(c,`${c}-element`,{[`${c}-active`]:o},i,s,m,g);return u(t.createElement("div",{className:h},t.createElement("div",{className:(0,l.default)(`${c}-image`,i),style:n},t.createElement("svg",{viewBox:"0 0 1098 1024",xmlns:"http://www.w3.org/2000/svg",className:`${c}-image-svg`},t.createElement("title",null,"Image placeholder"),t.createElement("path",{d:"M365.714286 329.142857q0 45.714286-32.036571 77.677714t-77.677714 32.036571-77.677714-32.036571-32.036571-77.677714 32.036571-77.677714 77.677714-32.036571 77.677714 32.036571 32.036571 77.677714zM950.857143 548.571429l0 256-804.571429 0 0-109.714286 182.857143-182.857143 91.428571 91.428571 292.571429-292.571429zM1005.714286 146.285714l-914.285714 0q-7.460571 0-12.873143 5.412571t-5.412571 12.873143l0 694.857143q0 7.460571 5.412571 12.873143t12.873143 5.412571l914.285714 0q7.460571 0 12.873143-5.412571t5.412571-12.873143l0-694.857143q0-7.460571-5.412571-12.873143t-12.873143-5.412571zM1097.142857 164.571429l0 694.857143q0 37.741714-26.843429 64.585143t-64.585143 26.843429l-914.285714 0q-37.741714 0-64.585143-26.843429t-26.843429-64.585143l0-694.857143q0-37.741714 26.843429-64.585143t64.585143-26.843429l914.285714 0q37.741714 0 64.585143 26.843429t26.843429 64.585143z",className:`${c}-image-path`})))))},w.Node=e=>{let{prefixCls:r,className:i,rootClassName:s,style:n,active:o,children:d}=e,{getPrefixCls:c}=t.useContext(a.ConfigContext),u=c("skeleton",r),[m,g,h]=b(u),p=(0,l.default)(u,`${u}-element`,{[`${u}-active`]:o},g,i,s,h);return m(t.createElement("div",{className:p},t.createElement("div",{className:(0,l.default)(`${u}-image`,i),style:n},d)))},e.s(["default",0,w],185793)},959013,e=>{"use strict";e.i(247167);var t=e.i(931067),l=e.i(271645);let a={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M482 152h60q8 0 8 8v704q0 8-8 8h-60q-8 0-8-8V160q0-8 8-8z"}},{tag:"path",attrs:{d:"M192 474h672q8 0 8 8v60q0 8-8 8H160q-8 0-8-8v-60q0-8 8-8z"}}]},name:"plus",theme:"outlined"};var r=e.i(9583),i=l.forwardRef(function(e,i){return l.createElement(r.default,(0,t.default)({},e,{ref:i,icon:a}))});e.s(["default",0,i],959013)},269200,e=>{"use strict";var t=e.i(290571),l=e.i(271645),a=e.i(444755);let r=(0,e.i(673706).makeClassName)("Table"),i=l.default.forwardRef((e,i)=>{let{children:s,className:n}=e,o=(0,t.__rest)(e,["children","className"]);return l.default.createElement("div",{className:(0,a.tremorTwMerge)(r("root"),"overflow-auto",n)},l.default.createElement("table",Object.assign({ref:i,className:(0,a.tremorTwMerge)(r("table"),"w-full text-tremor-default","text-tremor-content","dark:text-dark-tremor-content")},o),s))});i.displayName="Table",e.s(["Table",()=>i],269200)},427612,e=>{"use strict";var t=e.i(290571),l=e.i(271645),a=e.i(444755);let r=(0,e.i(673706).makeClassName)("TableHead"),i=l.default.forwardRef((e,i)=>{let{children:s,className:n}=e,o=(0,t.__rest)(e,["children","className"]);return l.default.createElement(l.default.Fragment,null,l.default.createElement("thead",Object.assign({ref:i,className:(0,a.tremorTwMerge)(r("root"),"text-left","text-tremor-content","dark:text-dark-tremor-content",n)},o),s))});i.displayName="TableHead",e.s(["TableHead",()=>i],427612)},64848,e=>{"use strict";var t=e.i(290571),l=e.i(271645),a=e.i(444755);let r=(0,e.i(673706).makeClassName)("TableHeaderCell"),i=l.default.forwardRef((e,i)=>{let{children:s,className:n}=e,o=(0,t.__rest)(e,["children","className"]);return l.default.createElement(l.default.Fragment,null,l.default.createElement("th",Object.assign({ref:i,className:(0,a.tremorTwMerge)(r("root"),"whitespace-nowrap text-left font-semibold top-0 px-4 py-3.5","text-tremor-content-strong","dark:text-dark-tremor-content-strong",n)},o),s))});i.displayName="TableHeaderCell",e.s(["TableHeaderCell",()=>i],64848)},942232,e=>{"use strict";var t=e.i(290571),l=e.i(271645),a=e.i(444755);let r=(0,e.i(673706).makeClassName)("TableBody"),i=l.default.forwardRef((e,i)=>{let{children:s,className:n}=e,o=(0,t.__rest)(e,["children","className"]);return l.default.createElement(l.default.Fragment,null,l.default.createElement("tbody",Object.assign({ref:i,className:(0,a.tremorTwMerge)(r("root"),"align-top divide-y","divide-tremor-border","dark:divide-dark-tremor-border",n)},o),s))});i.displayName="TableBody",e.s(["TableBody",()=>i],942232)},496020,e=>{"use strict";var t=e.i(290571),l=e.i(271645),a=e.i(444755);let r=(0,e.i(673706).makeClassName)("TableRow"),i=l.default.forwardRef((e,i)=>{let{children:s,className:n}=e,o=(0,t.__rest)(e,["children","className"]);return l.default.createElement(l.default.Fragment,null,l.default.createElement("tr",Object.assign({ref:i,className:(0,a.tremorTwMerge)(r("row"),n)},o),s))});i.displayName="TableRow",e.s(["TableRow",()=>i],496020)},977572,e=>{"use strict";var t=e.i(290571),l=e.i(271645),a=e.i(444755);let r=(0,e.i(673706).makeClassName)("TableCell"),i=l.default.forwardRef((e,i)=>{let{children:s,className:n}=e,o=(0,t.__rest)(e,["children","className"]);return l.default.createElement(l.default.Fragment,null,l.default.createElement("td",Object.assign({ref:i,className:(0,a.tremorTwMerge)(r("root"),"align-middle whitespace-nowrap text-left p-4",n)},o),s))});i.displayName="TableCell",e.s(["TableCell",()=>i],977572)},68155,e=>{"use strict";var t=e.i(271645);let l=t.forwardRef(function(e,l){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:l},e),t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"}))});e.s(["TrashIcon",0,l],68155)},278587,e=>{"use strict";var t=e.i(271645);let l=t.forwardRef(function(e,l){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:l},e),t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"}))});e.s(["RefreshIcon",0,l],278587)},207670,e=>{"use strict";function t(){for(var e,t,l=0,a="",r=arguments.length;lt,"default",0,t])},738014,e=>{"use strict";var t=e.i(135214),l=e.i(764205),a=e.i(266027);let r=(0,e.i(243652).createQueryKeys)("users");e.s(["useCurrentUser",0,()=>{let{accessToken:e,userId:i}=(0,t.default)();return(0,a.useQuery)({queryKey:r.detail(i),queryFn:async()=>await (0,l.userGetInfoV2)(e),enabled:!!(e&&i)})}])},625901,e=>{"use strict";var t=e.i(266027),l=e.i(621482),a=e.i(243652),r=e.i(764205),i=e.i(135214);let s=(0,a.createQueryKeys)("models"),n=(0,a.createQueryKeys)("modelHub"),o=(0,a.createQueryKeys)("allProxyModels");(0,a.createQueryKeys)("selectedTeamModels");let d=(0,a.createQueryKeys)("infiniteModels");e.s(["useAllProxyModels",0,()=>{let{accessToken:e,userId:l,userRole:a}=(0,i.default)();return(0,t.useQuery)({queryKey:o.list({}),queryFn:async()=>await (0,r.modelAvailableCall)(e,l,a,!0,null,!0,!1,"expand"),enabled:!!(e&&l&&a)})},"useInfiniteModelInfo",0,(e=50,t)=>{let{accessToken:a,userId:s,userRole:n}=(0,i.default)();return(0,l.useInfiniteQuery)({queryKey:d.list({filters:{...s&&{userId:s},...n&&{userRole:n},size:e,...t&&{search:t}}}),queryFn:async({pageParam:l})=>await (0,r.modelInfoCall)(a,s,n,l,e,t),initialPageParam:1,getNextPageParam:e=>{if(e.current_page{let{accessToken:e}=(0,i.default)();return(0,t.useQuery)({queryKey:n.list({}),queryFn:async()=>await (0,r.modelHubCall)(e),enabled:!!e})},"useModelsInfo",0,(e=1,l=50,a,n,o,d,c)=>{let{accessToken:u,userId:m,userRole:g}=(0,i.default)();return(0,t.useQuery)({queryKey:s.list({filters:{...m&&{userId:m},...g&&{userRole:g},page:e,size:l,...a&&{search:a},...n&&{modelId:n},...o&&{teamId:o},...d&&{sortBy:d},...c&&{sortOrder:c}}}),queryFn:async()=>await (0,r.modelInfoCall)(u,m,g,e,l,a,n,o,d,c),enabled:!!(u&&m&&g)})}])}]); \ No newline at end of file diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/360f35fe2e0a4945.js b/litellm/proxy/_experimental/out/_next/static/chunks/360f35fe2e0a4945.js deleted file mode 100644 index a612003a9c..0000000000 --- a/litellm/proxy/_experimental/out/_next/static/chunks/360f35fe2e0a4945.js +++ /dev/null @@ -1 +0,0 @@ -(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,178654,e=>{"use strict";let t=e.i(211576).Col;e.s(["Col",0,t],178654)},621192,e=>{"use strict";let t=e.i(264042).Row;e.s(["Row",0,t],621192)},564897,e=>{"use strict";e.i(247167);var t=e.i(931067),l=e.i(271645);let a={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M696 480H328c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8h368c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8z"}},{tag:"path",attrs:{d:"M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z"}}]},name:"minus-circle",theme:"outlined"};var r=e.i(9583),i=l.forwardRef(function(e,i){return l.createElement(r.default,(0,t.default)({},e,{ref:i,icon:a}))});e.s(["MinusCircleOutlined",0,i],564897)},751904,e=>{"use strict";var t=e.i(401361);e.s(["EditOutlined",()=>t.default])},211576,e=>{"use strict";var t=e.i(131757);e.s(["Col",()=>t.default])},91979,e=>{"use strict";e.i(247167);var t=e.i(931067),l=e.i(271645);let a={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M909.1 209.3l-56.4 44.1C775.8 155.1 656.2 92 521.9 92 290 92 102.3 279.5 102 511.5 101.7 743.7 289.8 932 521.9 932c181.3 0 335.8-115 394.6-276.1 1.5-4.2-.7-8.9-4.9-10.3l-56.7-19.5a8 8 0 00-10.1 4.8c-1.8 5-3.8 10-5.9 14.9-17.3 41-42.1 77.8-73.7 109.4A344.77 344.77 0 01655.9 829c-42.3 17.9-87.4 27-133.8 27-46.5 0-91.5-9.1-133.8-27A341.5 341.5 0 01279 755.2a342.16 342.16 0 01-73.7-109.4c-17.9-42.4-27-87.4-27-133.9s9.1-91.5 27-133.9c17.3-41 42.1-77.8 73.7-109.4 31.6-31.6 68.4-56.4 109.3-73.8 42.3-17.9 87.4-27 133.8-27 46.5 0 91.5 9.1 133.8 27a341.5 341.5 0 01109.3 73.8c9.9 9.9 19.2 20.4 27.8 31.4l-60.2 47a8 8 0 003 14.1l175.6 43c5 1.2 9.9-2.6 9.9-7.7l.8-180.9c-.1-6.6-7.8-10.3-13-6.2z"}}]},name:"reload",theme:"outlined"};var r=e.i(9583),i=l.forwardRef(function(e,i){return l.createElement(r.default,(0,t.default)({},e,{ref:i,icon:a}))});e.s(["ReloadOutlined",0,i],91979)},122577,e=>{"use strict";var t=e.i(271645);let l=t.forwardRef(function(e,l){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:l},e),t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M14.752 11.168l-3.197-2.132A1 1 0 0010 9.87v4.263a1 1 0 001.555.832l3.197-2.132a1 1 0 000-1.664z"}),t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M21 12a9 9 0 11-18 0 9 9 0 0118 0z"}))});e.s(["PlayIcon",0,l],122577)},551332,e=>{"use strict";var t=e.i(271645);let l=t.forwardRef(function(e,l){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:l},e),t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8 5H6a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2v-1M8 5a2 2 0 002 2h2a2 2 0 002-2M8 5a2 2 0 012-2h2a2 2 0 012 2m0 0h2a2 2 0 012 2v3m2 4H10m0 0l3-3m-3 3l3 3"}))});e.s(["ClipboardCopyIcon",0,l],551332)},902555,e=>{"use strict";var t=e.i(843476),l=e.i(591935),a=e.i(122577),r=e.i(278587),i=e.i(68155),s=e.i(360820),o=e.i(871943),n=e.i(434626),d=e.i(551332),m=e.i(592968),c=e.i(115504),u=e.i(752978);function g({icon:e,onClick:l,className:a,disabled:r,dataTestId:i}){return r?(0,t.jsx)(u.Icon,{icon:e,size:"sm",className:"opacity-50 cursor-not-allowed","data-testid":i}):(0,t.jsx)(u.Icon,{icon:e,size:"sm",onClick:l,className:(0,c.cx)("cursor-pointer",a),"data-testid":i})}let h={Edit:{icon:l.PencilAltIcon,className:"hover:text-blue-600"},Delete:{icon:i.TrashIcon,className:"hover:text-red-600"},Test:{icon:a.PlayIcon,className:"hover:text-blue-600"},Regenerate:{icon:r.RefreshIcon,className:"hover:text-green-600"},Up:{icon:s.ChevronUpIcon,className:"hover:text-blue-600"},Down:{icon:o.ChevronDownIcon,className:"hover:text-blue-600"},Open:{icon:n.ExternalLinkIcon,className:"hover:text-green-600"},Copy:{icon:d.ClipboardCopyIcon,className:"hover:text-blue-600"}};function p({onClick:e,tooltipText:l,disabled:a=!1,disabledTooltipText:r,dataTestId:i,variant:s}){let{icon:o,className:n}=h[s];return(0,t.jsx)(m.Tooltip,{title:a?r:l,children:(0,t.jsx)("span",{children:(0,t.jsx)(g,{icon:o,onClick:e,className:n,disabled:a,dataTestId:i})})})}e.s(["default",()=>p],902555)},434626,e=>{"use strict";var t=e.i(271645);let l=t.forwardRef(function(e,l){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:l},e),t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14"}))});e.s(["ExternalLinkIcon",0,l],434626)},278587,e=>{"use strict";var t=e.i(271645);let l=t.forwardRef(function(e,l){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:l},e),t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"}))});e.s(["RefreshIcon",0,l],278587)},207670,e=>{"use strict";function t(){for(var e,t,l=0,a="",r=arguments.length;lt,"default",0,t])},728889,e=>{"use strict";var t=e.i(290571),l=e.i(271645),a=e.i(829087),r=e.i(480731),i=e.i(444755),s=e.i(673706),o=e.i(95779);let n={xs:{paddingX:"px-1.5",paddingY:"py-1.5"},sm:{paddingX:"px-1.5",paddingY:"py-1.5"},md:{paddingX:"px-2",paddingY:"py-2"},lg:{paddingX:"px-2",paddingY:"py-2"},xl:{paddingX:"px-2.5",paddingY:"py-2.5"}},d={xs:{height:"h-3",width:"w-3"},sm:{height:"h-5",width:"w-5"},md:{height:"h-5",width:"w-5"},lg:{height:"h-7",width:"w-7"},xl:{height:"h-9",width:"w-9"}},m={simple:{rounded:"",border:"",ring:"",shadow:""},light:{rounded:"rounded-tremor-default",border:"",ring:"",shadow:""},shadow:{rounded:"rounded-tremor-default",border:"border",ring:"",shadow:"shadow-tremor-card dark:shadow-dark-tremor-card"},solid:{rounded:"rounded-tremor-default",border:"border-2",ring:"ring-1",shadow:""},outlined:{rounded:"rounded-tremor-default",border:"border",ring:"ring-2",shadow:""}},c=(0,s.makeClassName)("Icon"),u=l.default.forwardRef((e,u)=>{let{icon:g,variant:h="simple",tooltip:p,size:x=r.Sizes.SM,color:b,className:_}=e,f=(0,t.__rest)(e,["icon","variant","tooltip","size","color","className"]),j=((e,t)=>{switch(e){case"simple":return{textColor:t?(0,s.getColorClassNames)(t,o.colorPalette.text).textColor:"text-tremor-brand dark:text-dark-tremor-brand",bgColor:"",borderColor:"",ringColor:""};case"light":return{textColor:t?(0,s.getColorClassNames)(t,o.colorPalette.text).textColor:"text-tremor-brand dark:text-dark-tremor-brand",bgColor:t?(0,i.tremorTwMerge)((0,s.getColorClassNames)(t,o.colorPalette.background).bgColor,"bg-opacity-20"):"bg-tremor-brand-muted dark:bg-dark-tremor-brand-muted",borderColor:"",ringColor:""};case"shadow":return{textColor:t?(0,s.getColorClassNames)(t,o.colorPalette.text).textColor:"text-tremor-brand dark:text-dark-tremor-brand",bgColor:t?(0,i.tremorTwMerge)((0,s.getColorClassNames)(t,o.colorPalette.background).bgColor,"bg-opacity-20"):"bg-tremor-background dark:bg-dark-tremor-background",borderColor:"border-tremor-border dark:border-dark-tremor-border",ringColor:""};case"solid":return{textColor:t?(0,s.getColorClassNames)(t,o.colorPalette.text).textColor:"text-tremor-brand-inverted dark:text-dark-tremor-brand-inverted",bgColor:t?(0,i.tremorTwMerge)((0,s.getColorClassNames)(t,o.colorPalette.background).bgColor,"bg-opacity-20"):"bg-tremor-brand dark:bg-dark-tremor-brand",borderColor:"border-tremor-brand-inverted dark:border-dark-tremor-brand-inverted",ringColor:"ring-tremor-ring dark:ring-dark-tremor-ring"};case"outlined":return{textColor:t?(0,s.getColorClassNames)(t,o.colorPalette.text).textColor:"text-tremor-brand dark:text-dark-tremor-brand",bgColor:t?(0,i.tremorTwMerge)((0,s.getColorClassNames)(t,o.colorPalette.background).bgColor,"bg-opacity-20"):"bg-tremor-background dark:bg-dark-tremor-background",borderColor:t?(0,s.getColorClassNames)(t,o.colorPalette.ring).borderColor:"border-tremor-brand-subtle dark:border-dark-tremor-brand-subtle",ringColor:t?(0,i.tremorTwMerge)((0,s.getColorClassNames)(t,o.colorPalette.ring).ringColor,"ring-opacity-40"):"ring-tremor-brand-muted dark:ring-dark-tremor-brand-muted"}}})(h,b),{tooltipProps:y,getReferenceProps:v}=(0,a.useTooltip)();return l.default.createElement("span",Object.assign({ref:(0,s.mergeRefs)([u,y.refs.setReference]),className:(0,i.tremorTwMerge)(c("root"),"inline-flex shrink-0 items-center justify-center",j.bgColor,j.textColor,j.borderColor,j.ringColor,m[h].rounded,m[h].border,m[h].shadow,m[h].ring,n[x].paddingX,n[x].paddingY,_)},v,f),l.default.createElement(a.default,Object.assign({text:p},y)),l.default.createElement(g,{className:(0,i.tremorTwMerge)(c("icon"),"shrink-0",d[x].height,d[x].width)}))});u.displayName="Icon",e.s(["default",()=>u],728889)},752978,e=>{"use strict";var t=e.i(728889);e.s(["Icon",()=>t.default])},591935,e=>{"use strict";var t=e.i(271645);let l=t.forwardRef(function(e,l){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:l},e),t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M11 5H6a2 2 0 00-2 2v11a2 2 0 002 2h11a2 2 0 002-2v-5m-1.414-9.414a2 2 0 112.828 2.828L11.828 15H9v-2.828l8.586-8.586z"}))});e.s(["PencilAltIcon",0,l],591935)},738014,e=>{"use strict";var t=e.i(135214),l=e.i(764205),a=e.i(266027);let r=(0,e.i(243652).createQueryKeys)("users");e.s(["useCurrentUser",0,()=>{let{accessToken:e,userId:i}=(0,t.default)();return(0,a.useQuery)({queryKey:r.detail(i),queryFn:async()=>await (0,l.userGetInfoV2)(e),enabled:!!(e&&i)})}])},625901,e=>{"use strict";var t=e.i(266027),l=e.i(621482),a=e.i(243652),r=e.i(764205),i=e.i(135214);let s=(0,a.createQueryKeys)("models"),o=(0,a.createQueryKeys)("modelHub"),n=(0,a.createQueryKeys)("allProxyModels");(0,a.createQueryKeys)("selectedTeamModels");let d=(0,a.createQueryKeys)("infiniteModels");e.s(["useAllProxyModels",0,()=>{let{accessToken:e,userId:l,userRole:a}=(0,i.default)();return(0,t.useQuery)({queryKey:n.list({}),queryFn:async()=>await (0,r.modelAvailableCall)(e,l,a,!0,null,!0,!1,"expand"),enabled:!!(e&&l&&a)})},"useInfiniteModelInfo",0,(e=50,t)=>{let{accessToken:a,userId:s,userRole:o}=(0,i.default)();return(0,l.useInfiniteQuery)({queryKey:d.list({filters:{...s&&{userId:s},...o&&{userRole:o},size:e,...t&&{search:t}}}),queryFn:async({pageParam:l})=>await (0,r.modelInfoCall)(a,s,o,l,e,t),initialPageParam:1,getNextPageParam:e=>{if(e.current_page{let{accessToken:e}=(0,i.default)();return(0,t.useQuery)({queryKey:o.list({}),queryFn:async()=>await (0,r.modelHubCall)(e),enabled:!!e})},"useModelsInfo",0,(e=1,l=50,a,o,n,d,m)=>{let{accessToken:c,userId:u,userRole:g}=(0,i.default)();return(0,t.useQuery)({queryKey:s.list({filters:{...u&&{userId:u},...g&&{userRole:g},page:e,size:l,...a&&{search:a},...o&&{modelId:o},...n&&{teamId:n},...d&&{sortBy:d},...m&&{sortOrder:m}}}),queryFn:async()=>await (0,r.modelInfoCall)(c,u,g,e,l,a,o,n,d,m),enabled:!!(c&&u&&g)})}])},907308,e=>{"use strict";var t=e.i(843476),l=e.i(271645),a=e.i(212931),r=e.i(808613),i=e.i(464571),s=e.i(199133),o=e.i(592968),n=e.i(213205),d=e.i(374009),m=e.i(764205);e.s(["default",0,({isVisible:e,onCancel:c,onSubmit:u,accessToken:g,title:h="Add Team Member",roles:p=[{label:"admin",value:"admin",description:"Admin role. Can create team keys, add members, and manage settings."},{label:"user",value:"user",description:"User role. Can view team info, but not manage it."}],defaultRole:x="user",teamId:b})=>{let[_]=r.Form.useForm(),[f,j]=(0,l.useState)([]),[y,v]=(0,l.useState)(!1),[w,C]=(0,l.useState)("user_email"),[S,N]=(0,l.useState)(!1),k=async(e,t)=>{if(!e)return void j([]);v(!0);try{let l=new URLSearchParams;if(l.append(t,e),b&&l.append("team_id",b),null==g)return;let a=(await (0,m.userFilterUICall)(g,l)).map(e=>({label:"user_email"===t?`${e.user_email}`:`${e.user_id}`,value:"user_email"===t?e.user_email:e.user_id,user:e}));j(a)}catch(e){console.error("Error fetching users:",e)}finally{v(!1)}},T=(0,l.useCallback)((0,d.default)((e,t)=>k(e,t),300),[]),M=(e,t)=>{C(t),T(e,t)},I=(e,t)=>{let l=t.user;_.setFieldsValue({user_email:l.user_email,user_id:l.user_id,role:_.getFieldValue("role")})},P=async e=>{N(!0);try{await u(e)}finally{N(!1)}};return(0,t.jsx)(a.Modal,{title:h,open:e,onCancel:()=>{_.resetFields(),j([]),c()},footer:null,width:800,maskClosable:!S,children:(0,t.jsxs)(r.Form,{form:_,onFinish:P,labelCol:{span:8},wrapperCol:{span:16},labelAlign:"left",initialValues:{role:x},children:[(0,t.jsx)(r.Form.Item,{label:"Email",name:"user_email",className:"mb-4",children:(0,t.jsx)(s.Select,{showSearch:!0,className:"w-full",placeholder:"Search by email",filterOption:!1,onSearch:e=>M(e,"user_email"),onSelect:(e,t)=>I(e,t),options:"user_email"===w?f:[],loading:y,allowClear:!0})}),(0,t.jsx)("div",{className:"text-center mb-4",children:"OR"}),(0,t.jsx)(r.Form.Item,{label:"User ID",name:"user_id",className:"mb-4",children:(0,t.jsx)(s.Select,{showSearch:!0,className:"w-full",placeholder:"Search by user ID",filterOption:!1,onSearch:e=>M(e,"user_id"),onSelect:(e,t)=>I(e,t),options:"user_id"===w?f:[],loading:y,allowClear:!0})}),(0,t.jsx)(r.Form.Item,{label:"Member Role",name:"role",className:"mb-4",children:(0,t.jsx)(s.Select,{defaultValue:x,children:p.map(e=>(0,t.jsx)(s.Select.Option,{value:e.value,children:(0,t.jsxs)(o.Tooltip,{title:e.description,children:[(0,t.jsx)("span",{className:"font-medium",children:e.label}),(0,t.jsxs)("span",{className:"ml-2 text-gray-500 text-sm",children:["- ",e.description]})]})},e.value))})}),(0,t.jsx)("div",{className:"text-right mt-4",children:(0,t.jsx)(i.Button,{type:"primary",htmlType:"submit",icon:(0,t.jsx)(n.UserAddOutlined,{}),loading:S,children:S?"Adding...":"Add Member"})})]})})}])},162386,e=>{"use strict";var t=e.i(843476),l=e.i(625901),a=e.i(109799),r=e.i(785242),i=e.i(738014),s=e.i(199133),o=e.i(981339),n=e.i(592968);let d={label:"All Proxy Models",value:"all-proxy-models"},m={label:"No Default Models",value:"no-default-models"},c=[d,m],u={user:({allProxyModels:e,userModels:t,options:l})=>t&&l?.includeUserModels?t:[],team:({allProxyModels:e,selectedOrganization:t,userModels:l})=>t?t.models.includes(d.value)||0===t.models.length?e:e.filter(e=>t.models.includes(e)):e??[],organization:({allProxyModels:e})=>e,global:({allProxyModels:e})=>e};e.s(["ModelSelect",0,e=>{let{teamID:g,organizationID:h,options:p,context:x,dataTestId:b,value:_=[],onChange:f,style:j}=e,{includeUserModels:y,showAllTeamModelsOption:v,showAllProxyModelsOverride:w,includeSpecialOptions:C}=p||{},{data:S,isLoading:N}=(0,l.useAllProxyModels)(),{data:k,isLoading:T}=(0,r.useTeam)(g),{data:M,isLoading:I}=(0,a.useOrganization)(h),{data:P,isLoading:z}=(0,i.useCurrentUser)(),F=e=>c.some(t=>t.value===e),O=_.some(F),A=M?.models.includes(d.value)||M?.models.length===0;if(N||T||I||z)return(0,t.jsx)(o.Skeleton.Input,{active:!0,block:!0});let{wildcard:L,regular:D}=(e=>{let t=[],l=[];for(let a of e)a.endsWith("/*")?t.push(a):l.push(a);return{wildcard:t,regular:l}})(((e,t,l)=>{let a=Array.from(new Map(e.map(e=>[e.id,e])).values()).map(e=>e.id);if(t.options?.showAllProxyModelsOverride)return a;let r=u[t.context];return r?r({allProxyModels:a,...l,options:t.options}):[]})(S?.data??[],e,{selectedTeam:k,selectedOrganization:M,userModels:P?.models}));return(0,t.jsx)(s.Select,{"data-testid":b,value:_,onChange:e=>{let t=e.filter(F);f(t.length>0?[t[t.length-1]]:e)},style:j,options:[C?{label:(0,t.jsx)("span",{children:"Special Options"}),title:"Special Options",options:[...w||A&&C||"global"===x?[{label:(0,t.jsx)("span",{children:"All Proxy Models"}),value:d.value,disabled:_.length>0&&_.some(e=>F(e)&&e!==d.value),key:d.value}]:[],{label:(0,t.jsx)("span",{children:"No Default Models"}),value:m.value,disabled:_.length>0&&_.some(e=>F(e)&&e!==m.value),key:m.value}]}:[],...L.length>0?[{label:(0,t.jsx)("span",{children:"Wildcard Options"}),title:"Wildcard Options",options:L.map(e=>{let l=e.replace("/*",""),a=l.charAt(0).toUpperCase()+l.slice(1);return{label:(0,t.jsx)("span",{children:`All ${a} models`}),value:e,disabled:O}})}]:[],{label:(0,t.jsx)("span",{children:"Models"}),title:"Models",options:D.map(e=>({label:(0,t.jsx)("span",{children:e}),value:e,disabled:O}))}],mode:"multiple",placeholder:"Select Models",allowClear:!0,maxTagCount:"responsive",maxTagPlaceholder:e=>(0,t.jsx)(n.Tooltip,{styles:{root:{pointerEvents:"none"}},title:e.map(({value:e})=>e).join(", "),children:(0,t.jsxs)("span",{children:["+",e.length," more"]})})})}],162386)},276173,e=>{"use strict";var t=e.i(843476),l=e.i(599724),a=e.i(779241),r=e.i(464571),i=e.i(808613),s=e.i(212931),o=e.i(199133),n=e.i(271645),d=e.i(435451);e.s(["default",0,({visible:e,onCancel:m,onSubmit:c,initialData:u,mode:g,config:h})=>{let p,[x]=i.Form.useForm(),[b,_]=(0,n.useState)(!1);console.log("Initial Data:",u),(0,n.useEffect)(()=>{if(e)if("edit"===g&&u){let e={...u,role:u.role||h.defaultRole,max_budget_in_team:u.max_budget_in_team||null,tpm_limit:u.tpm_limit||null,rpm_limit:u.rpm_limit||null};console.log("Setting form values:",e),x.setFieldsValue(e)}else x.resetFields(),x.setFieldsValue({role:h.defaultRole||h.roleOptions[0]?.value})},[e,u,g,x,h.defaultRole,h.roleOptions]);let f=async e=>{try{_(!0);let t=Object.entries(e).reduce((e,[t,l])=>{if("string"==typeof l){let a=l.trim();return""===a&&("max_budget_in_team"===t||"tpm_limit"===t||"rpm_limit"===t)?{...e,[t]:null}:{...e,[t]:a}}return{...e,[t]:l}},{});console.log("Submitting form data:",t),await Promise.resolve(c(t)),x.resetFields()}catch(e){console.error("Form submission error:",e)}finally{_(!1)}};return(0,t.jsx)(s.Modal,{title:h.title||("add"===g?"Add Member":"Edit Member"),open:e,width:1e3,footer:null,onCancel:m,children:(0,t.jsxs)(i.Form,{form:x,onFinish:f,labelCol:{span:8},wrapperCol:{span:16},labelAlign:"left",children:[h.showEmail&&(0,t.jsx)(i.Form.Item,{label:"Email",name:"user_email",className:"mb-4",rules:[{type:"email",message:"Please enter a valid email!"}],children:(0,t.jsx)(a.TextInput,{placeholder:"user@example.com"})}),h.showEmail&&h.showUserId&&(0,t.jsx)("div",{className:"text-center mb-4",children:(0,t.jsx)(l.Text,{children:"OR"})}),h.showUserId&&(0,t.jsx)(i.Form.Item,{label:"User ID",name:"user_id",className:"mb-4",children:(0,t.jsx)(a.TextInput,{placeholder:"user_123"})}),(0,t.jsx)(i.Form.Item,{label:(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("span",{children:"Role"}),"edit"===g&&u&&(0,t.jsxs)("span",{className:"text-gray-500 text-sm",children:["(Current: ",(p=u.role,h.roleOptions.find(e=>e.value===p)?.label||p),")"]})]}),name:"role",className:"mb-4",rules:[{required:!0,message:"Please select a role!"}],children:(0,t.jsx)(o.Select,{children:"edit"===g&&u?[...h.roleOptions.filter(e=>e.value===u.role),...h.roleOptions.filter(e=>e.value!==u.role)].map(e=>(0,t.jsx)(o.Select.Option,{value:e.value,children:e.label},e.value)):h.roleOptions.map(e=>(0,t.jsx)(o.Select.Option,{value:e.value,children:e.label},e.value))})}),h.additionalFields?.map(e=>(0,t.jsx)(i.Form.Item,{label:e.label,name:e.name,className:"mb-4",rules:e.rules,children:(e=>{switch(e.type){case"input":return(0,t.jsx)(a.TextInput,{placeholder:e.placeholder});case"numerical":return(0,t.jsx)(d.default,{step:e.step||1,min:e.min||0,style:{width:"100%"},placeholder:e.placeholder||"Enter a numerical value"});case"select":return(0,t.jsx)(o.Select,{children:e.options?.map(e=>(0,t.jsx)(o.Select.Option,{value:e.value,children:e.label},e.value))});default:return null}})(e)},e.name)),(0,t.jsxs)("div",{className:"text-right mt-6",children:[(0,t.jsx)(r.Button,{onClick:m,className:"mr-2",disabled:b,children:"Cancel"}),(0,t.jsx)(r.Button,{type:"default",htmlType:"submit",loading:b,children:"add"===g?b?"Adding...":"Add Member":b?"Saving...":"Save Changes"})]})]})})}])},294612,e=>{"use strict";var t=e.i(843476),l=e.i(100486),a=e.i(827252),r=e.i(213205),i=e.i(771674),s=e.i(464571),o=e.i(770914),n=e.i(291542),d=e.i(262218),m=e.i(592968),c=e.i(898586),u=e.i(902555);let{Text:g}=c.Typography;function h({members:e,canEdit:c,onEdit:h,onDelete:p,onAddMember:x,roleColumnTitle:b="Role",roleTooltip:_,extraColumns:f=[],showDeleteForMember:j,emptyText:y}){let v=[{title:"User Email",dataIndex:"user_email",key:"user_email",render:e=>(0,t.jsx)(g,{children:e||"-"})},{title:"User ID",dataIndex:"user_id",key:"user_id",render:e=>"default_user_id"===e?(0,t.jsx)(d.Tag,{color:"blue",children:"Default Proxy Admin"}):(0,t.jsx)(g,{children:e||"-"})},{title:_?(0,t.jsxs)(o.Space,{direction:"horizontal",children:[b,(0,t.jsx)(m.Tooltip,{title:_,children:(0,t.jsx)(a.InfoCircleOutlined,{})})]}):b,dataIndex:"role",key:"role",render:e=>(0,t.jsxs)(o.Space,{children:[e?.toLowerCase()==="admin"||e?.toLowerCase()==="org_admin"?(0,t.jsx)(l.CrownOutlined,{}):(0,t.jsx)(i.UserOutlined,{}),(0,t.jsx)(g,{style:{textTransform:"capitalize"},children:e||"-"})]})},...f,{title:"Actions",key:"actions",fixed:"right",width:120,render:(e,l)=>c?(0,t.jsxs)(o.Space,{children:[(0,t.jsx)(u.default,{variant:"Edit",tooltipText:"Edit member",dataTestId:"edit-member",onClick:()=>h(l)}),(!j||j(l))&&(0,t.jsx)(u.default,{variant:"Delete",tooltipText:"Delete member",dataTestId:"delete-member",onClick:()=>p(l)})]}):null}];return(0,t.jsxs)(o.Space,{direction:"vertical",style:{width:"100%"},children:[(0,t.jsxs)("span",{className:"inline-flex text-sm text-gray-700",children:[e.length," Member",1!==e.length?"s":""]}),(0,t.jsx)(n.Table,{columns:v,dataSource:e,rowKey:e=>e.user_id??e.user_email??JSON.stringify(e),pagination:!1,size:"small",scroll:{x:"max-content"},locale:y?{emptyText:y}:void 0}),x&&c&&(0,t.jsx)(s.Button,{icon:(0,t.jsx)(r.UserAddOutlined,{}),type:"primary",onClick:x,children:"Add Member"})]})}e.s(["default",()=>h])},56567,e=>{"use strict";var t=e.i(843476),l=e.i(135214),a=e.i(109799),r=e.i(907308),i=e.i(764205),s=e.i(500330),o=e.i(11751),n=e.i(708347),d=e.i(751904),m=e.i(827252),c=e.i(564897),u=e.i(646563),g=e.i(987432),h=e.i(530212),p=e.i(389083),x=e.i(304967),b=e.i(350967),_=e.i(599724),f=e.i(779241),j=e.i(629569),y=e.i(464571),v=e.i(808613),w=e.i(311451),C=e.i(28651),S=e.i(199133),N=e.i(770914),k=e.i(790848),T=e.i(653496),M=e.i(592968),I=e.i(888259),P=e.i(678784),z=e.i(118366),F=e.i(271645),O=e.i(9314),A=e.i(552130),L=e.i(127952);function D({className:e,value:l,onChange:a}){return(0,t.jsxs)(S.Select,{className:e,value:l,onChange:a,children:[(0,t.jsx)(S.Select.Option,{value:"24h",children:"Daily"}),(0,t.jsx)(S.Select.Option,{value:"7d",children:"Weekly"}),(0,t.jsx)(S.Select.Option,{value:"30d",children:"Monthly"})]})}var R=e.i(844565),B=e.i(355619),E=e.i(643449),U=e.i(75921),V=e.i(390605),K=e.i(162386),$=e.i(727749),W=e.i(384767),q=e.i(435451),G=e.i(916940),H=e.i(183588),Q=e.i(276173),J=e.i(91979),Y=e.i(269200),X=e.i(942232),Z=e.i(977572),ee=e.i(427612),et=e.i(64848),el=e.i(496020),ea=e.i(536916),er=e.i(21548);let ei={"/key/generate":"Member can generate a virtual key for this team","/key/service-account/generate":"Member can generate a service account key (not belonging to any user) for this team","/key/update":"Member can update a virtual key belonging to this team","/key/delete":"Member can delete a virtual key belonging to this team","/key/info":"Member can get info about a virtual key belonging to this team","/key/regenerate":"Member can regenerate a virtual key belonging to this team","/key/{key_id}/regenerate":"Member can regenerate a virtual key belonging to this team","/key/list":"Member can list virtual keys belonging to this team","/key/block":"Member can block a virtual key belonging to this team","/key/unblock":"Member can unblock a virtual key belonging to this team","/team/daily/activity":"Member can view all team usage data (not just their own)"},es=({teamId:e,accessToken:l,canEditTeam:a})=>{let[r,s]=(0,F.useState)([]),[o,n]=(0,F.useState)([]),[d,m]=(0,F.useState)(!0),[c,u]=(0,F.useState)(!1),[h,p]=(0,F.useState)(!1),b=async()=>{try{if(m(!0),!l)return;let t=await (0,i.getTeamPermissionsCall)(l,e),a=t.all_available_permissions||[];s(a);let r=t.team_member_permissions||[];n(r),p(!1)}catch(e){$.default.fromBackend("Failed to load permissions"),console.error("Error fetching permissions:",e)}finally{m(!1)}};(0,F.useEffect)(()=>{b()},[e,l]);let f=async()=>{try{if(!l)return;u(!0),await (0,i.teamPermissionsUpdateCall)(l,e,o),$.default.success("Permissions updated successfully"),p(!1)}catch(e){$.default.fromBackend("Failed to update permissions"),console.error("Error updating permissions:",e)}finally{u(!1)}};if(d)return(0,t.jsx)("div",{className:"p-6 text-center",children:"Loading permissions..."});let v=r.length>0;return(0,t.jsxs)(x.Card,{className:"bg-white shadow-md rounded-md p-6",children:[(0,t.jsxs)("div",{className:"flex flex-col sm:flex-row justify-between items-start sm:items-center border-b pb-4 mb-6",children:[(0,t.jsx)(j.Title,{className:"mb-2 sm:mb-0",children:"Member Permissions"}),a&&h&&(0,t.jsxs)("div",{className:"flex gap-3",children:[(0,t.jsx)(y.Button,{icon:(0,t.jsx)(J.ReloadOutlined,{}),onClick:()=>{b()},children:"Reset"}),(0,t.jsx)(y.Button,{onClick:f,loading:c,type:"primary",icon:(0,t.jsx)(g.SaveOutlined,{}),children:"Save Changes"})]})]}),(0,t.jsx)(_.Text,{className:"mb-6 text-gray-600",children:"Control what team members can do when they are not team admins."}),v?(0,t.jsx)("div",{className:"overflow-x-auto",children:(0,t.jsxs)(Y.Table,{className:" min-w-full",children:[(0,t.jsx)(ee.TableHead,{children:(0,t.jsxs)(el.TableRow,{children:[(0,t.jsx)(et.TableHeaderCell,{children:"Method"}),(0,t.jsx)(et.TableHeaderCell,{children:"Endpoint"}),(0,t.jsx)(et.TableHeaderCell,{children:"Description"}),(0,t.jsx)(et.TableHeaderCell,{className:"sticky right-0 bg-white shadow-[-4px_0_4px_-4px_rgba(0,0,0,0.1)] text-center",children:"Allow Access"})]})}),(0,t.jsx)(X.TableBody,{children:r.map(e=>{let l=(e=>{let t=e.includes("/info")||e.includes("/list")||e.includes("/activity")?"GET":"POST",l=ei[e];if(!l){for(let[t,a]of Object.entries(ei))if(e.includes(t)){l=a;break}}return l||(l=`Access ${e}`),{method:t,endpoint:e,description:l,route:e}})(e);return(0,t.jsxs)(el.TableRow,{className:"hover:bg-gray-50 transition-colors",children:[(0,t.jsx)(Z.TableCell,{children:(0,t.jsx)("span",{className:`px-2 py-1 rounded text-xs font-medium ${"GET"===l.method?"bg-blue-100 text-blue-800":"bg-green-100 text-green-800"}`,children:l.method})}),(0,t.jsx)(Z.TableCell,{children:(0,t.jsx)("span",{className:"font-mono text-sm text-gray-800",children:l.endpoint})}),(0,t.jsx)(Z.TableCell,{className:"text-gray-700",children:l.description}),(0,t.jsx)(Z.TableCell,{className:"sticky right-0 bg-white shadow-[-4px_0_4px_-4px_rgba(0,0,0,0.1)] text-center",children:(0,t.jsx)(ea.Checkbox,{checked:o.includes(e),onChange:t=>{n(t.target.checked?[...o,e]:o.filter(t=>t!==e)),p(!0)},disabled:!a})})]},e)})})]})}):(0,t.jsx)("div",{className:"py-12",children:(0,t.jsx)(er.Empty,{description:"No permissions available"})})]})},eo="overview",en="virtual-keys",ed="members",em="member-permissions",ec="settings",eu={[eo]:"Overview",[en]:"Virtual Keys",[ed]:"Members",[em]:"Member Permissions",[ec]:"Settings"};var eg=e.i(292639),eh=e.i(898586),ep=e.i(294612);function ex({teamData:e,canEditTeam:a,handleMemberDelete:r,setSelectedEditMember:i,setIsEditMemberModalVisible:o,setIsAddMemberModalVisible:d}){let c=e=>{if(null==e)return"0";if("number"==typeof e){let t=Number(e);return t===Math.floor(t)?t.toString():(0,s.formatNumberWithCommas)(t,8).replace(/\.?0+$/,"")}return"0"},{data:u}=(0,eg.useUISettings)(),{userId:g,userRole:h}=(0,l.default)(),p=!!u?.values?.disable_team_admin_delete_team_user,x=(0,n.isUserTeamAdminForSingleTeam)(e.team_info.members_with_roles,g||""),b=(0,n.isProxyAdminRole)(h||""),_=[{title:(0,t.jsxs)(N.Space,{direction:"horizontal",children:["Team Member Spend (USD)",(0,t.jsx)(M.Tooltip,{title:"This is the amount spent by a user in the team.",children:(0,t.jsx)(m.InfoCircleOutlined,{})})]}),key:"spend",render:(l,a)=>(0,t.jsxs)(eh.Typography.Text,{children:["$",(0,s.formatNumberWithCommas)((t=>{if(!t)return 0;let l=e.team_memberships.find(e=>e.user_id===t);return l?.spend||0})(a.user_id),4)]})},{title:"Team Member Budget (USD)",key:"budget",render:(l,a)=>{let r=(t=>{if(!t)return null;let l=e.team_memberships.find(e=>e.user_id===t),a=l?.litellm_budget_table?.max_budget;return null==a?null:c(a)})(a.user_id);return(0,t.jsx)(eh.Typography.Text,{children:r?`$${(0,s.formatNumberWithCommas)(Number(r),4)}`:"No Limit"})}},{title:(0,t.jsxs)(N.Space,{direction:"horizontal",children:["Team Member Rate Limits",(0,t.jsx)(M.Tooltip,{title:"Rate limits for this member's usage within this team.",children:(0,t.jsx)(m.InfoCircleOutlined,{})})]}),key:"rate_limits",render:(l,a)=>(0,t.jsx)(eh.Typography.Text,{children:(t=>{if(!t)return"No Limits";let l=e.team_memberships.find(e=>e.user_id===t),a=l?.litellm_budget_table?.rpm_limit,r=l?.litellm_budget_table?.tpm_limit,i=[a?`${c(a)} RPM`:null,r?`${c(r)} TPM`:null].filter(Boolean);return i.length>0?i.join(" / "):"No Limits"})(a.user_id)})}];return(0,t.jsx)(ep.default,{members:e.team_info.members_with_roles,canEdit:a,onEdit:t=>{let l=e.team_memberships.find(e=>e.user_id===t.user_id);i({...t,max_budget_in_team:l?.litellm_budget_table?.max_budget||null,tpm_limit:l?.litellm_budget_table?.tpm_limit||null,rpm_limit:l?.litellm_budget_table?.rpm_limit||null}),o(!0)},onDelete:r,onAddMember:()=>d(!0),roleColumnTitle:"Team Role",roleTooltip:"This role applies only to this team and is independent from the user's proxy-level role.",extraColumns:_,showDeleteForMember:()=>b||a&&!x||x&&!p})}var eb=e.i(207082),e_=e.i(871943),ef=e.i(502547),ej=e.i(360820),ey=e.i(94629),ev=e.i(152990),ew=e.i(682830),eC=e.i(994388),eS=e.i(752978),eN=e.i(282786),ek=e.i(981339),eT=e.i(969550),eM=e.i(20147),eI=e.i(266027),eP=e.i(633627);function ez({teamId:e,teamAlias:a,organization:r}){let{accessToken:i}=(0,l.default)(),[o,n]=(0,F.useState)(null),[d,c]=(0,F.useState)([{id:"created_at",desc:!0}]),[u,g]=(0,F.useState)({pageIndex:0,pageSize:50}),[h,x]=(0,F.useState)({"Organization ID":"","Key Alias":"","User ID":"","Sort By":"created_at","Sort Order":"desc"}),b=d.length>0?d[0].id:"created_at",f=d.length>0?d[0].desc?"desc":"asc":"desc",j=u.pageIndex,y=u.pageSize,{data:v,isPending:w,isFetching:C,refetch:S}=(0,eb.useKeys)(j+1,y,{teamID:e,organizationID:h["Organization ID"]?.trim()||void 0,selectedKeyAlias:h["Key Alias"]?.trim()||void 0,userID:h["User ID"]?.trim()||void 0,sortBy:b||void 0,sortOrder:f||void 0,expand:"user"}),N=(0,F.useMemo)(()=>{let e=v?.keys||[],t=r?.organization_id;return t?e.map(e=>({...e,organization_id:(e.organization_id??e.org_id)||t})):e},[v?.keys,r?.organization_id]),k=v?.total_pages??0,[T,I]=(0,F.useState)({}),P=(0,F.useMemo)(()=>({team_id:e,team_alias:a||e,models:[],max_budget:null,budget_duration:null,tpm_limit:null,rpm_limit:null,organization_id:r?.organization_id||"",created_at:"",keys:[],members_with_roles:[],spend:0}),[e,a,r]),z=(0,eI.useQuery)({queryKey:["teamFilterOptions",e,i],queryFn:async()=>(0,eP.fetchTeamFilterOptions)(i,e),enabled:!!i&&!!e,staleTime:3e4}).data||{keyAliases:[],organizationIds:[],userIds:[]},O=(0,F.useCallback)(()=>{S?.()},[S]);(0,F.useEffect)(()=>(window.addEventListener("storage",O),()=>window.removeEventListener("storage",O)),[O]);let A=(0,F.useCallback)((e,t=!1)=>{x(t=>({...t,"Organization ID":e["Organization ID"]??t["Organization ID"],"Key Alias":e["Key Alias"]??t["Key Alias"],"User ID":e["User ID"]??t["User ID"],"Sort By":e["Sort By"]??t["Sort By"]??"created_at","Sort Order":e["Sort Order"]??t["Sort Order"]??"desc"})),t||g(e=>({...e,pageIndex:0}))},[]),L=(0,F.useCallback)(()=>{x({"Organization ID":"","Key Alias":"","User ID":"","Sort By":"created_at","Sort Order":"desc"}),g(e=>({...e,pageIndex:0}))},[]),D=(0,F.useMemo)(()=>[{name:"Organization ID",label:"Organization ID",isSearchable:!0,searchFn:async e=>{let{organizationIds:t}=z;if(!t.length)return[];let l=e.toLowerCase();return(l?t.filter(e=>e.toLowerCase().includes(l)):t).map(e=>({label:e,value:e}))}},{name:"Key Alias",label:"Key Alias",isSearchable:!0,searchFn:async e=>{let{keyAliases:t}=z,l=e.toLowerCase();return(l?t.filter(e=>e.toLowerCase().includes(l)):t).map(e=>({label:e,value:e}))}},{name:"User ID",label:"User ID",isSearchable:!0,searchFn:async e=>{let{userIds:t}=z,l=e.toLowerCase();return(l?t.filter(e=>e.id.toLowerCase().includes(l)||e.email.toLowerCase().includes(l)):t).map(e=>({label:e.email?`${e.id} (${e.email})`:e.id,value:e.id}))}}],[z]),R=(0,F.useMemo)(()=>[{id:"token",accessorKey:"token",header:"Key ID",size:100,enableSorting:!0,cell:e=>{let l=e.getValue(),a=e.cell.column.getSize();return(0,t.jsx)(M.Tooltip,{title:l,children:(0,t.jsx)(eC.Button,{size:"xs",variant:"light",className:"font-mono text-blue-500 bg-blue-50 hover:bg-blue-100 text-xs font-normal px-2 py-0.5 text-left overflow-hidden truncate block",style:{maxWidth:a,overflow:"hidden"},onClick:()=>n(e.row.original),children:l??"-"})})}},{id:"key_alias",accessorKey:"key_alias",header:"Key Alias",size:150,enableSorting:!0,cell:e=>{let l=e.getValue(),a=e.cell.column.getSize();return(0,t.jsx)(M.Tooltip,{title:l,children:(0,t.jsx)("span",{className:"font-mono text-xs truncate block",style:{maxWidth:a,overflow:"hidden"},children:l??"-"})})}},{id:"key_name",accessorKey:"key_name",header:"Secret Key",size:120,enableSorting:!1,cell:e=>(0,t.jsx)("span",{className:"font-mono text-xs",children:e.getValue()})},{id:"organization_id",accessorKey:"organization_id",header:"Organization ID",size:140,enableSorting:!1,cell:e=>e.getValue()?e.renderValue():"-"},{id:"user_email",accessorKey:"user",header:"User Email",size:160,enableSorting:!1,cell:e=>{let l=e.getValue(),a=l?.user_email,r=e.cell.column.getSize();return(0,t.jsx)(M.Tooltip,{title:a,children:(0,t.jsx)("span",{className:"font-mono text-xs truncate block",style:{maxWidth:r,overflow:"hidden"},children:a??"-"})})}},{id:"user_id",accessorKey:"user_id",header:"User ID",size:70,enableSorting:!1,cell:e=>{let l=e.getValue(),a="default_user_id"===l?"Default Proxy Admin":l,r=e.cell.column.getSize();return(0,t.jsx)(M.Tooltip,{title:a,children:(0,t.jsx)("span",{className:"font-mono text-xs truncate block",style:{maxWidth:r,overflow:"hidden"},children:a??"-"})})}},{id:"created_at",accessorKey:"created_at",header:"Created At",size:120,enableSorting:!0,cell:e=>{let t=e.getValue();return t?new Date(t).toLocaleDateString():"-"}},{id:"created_by",accessorKey:"created_by",header:"Created By",size:70,enableSorting:!1,cell:e=>{let l=e.getValue(),a="default_user_id"===l?"Default Proxy Admin":l,r=e.cell.column.getSize();return(0,t.jsx)(M.Tooltip,{title:a,children:(0,t.jsx)("span",{className:"font-mono text-xs truncate block",style:{maxWidth:r,overflow:"hidden"},children:a??"-"})})}},{id:"updated_at",accessorKey:"updated_at",header:"Updated At",size:120,enableSorting:!0,cell:e=>{let t=e.getValue();return t?new Date(t).toLocaleDateString():"Never"}},{id:"last_active",accessorKey:"last_active",header:()=>(0,t.jsxs)("span",{className:"flex items-center gap-1",children:["Last Active",(0,t.jsx)(eN.Popover,{content:"This is a new field and is not backfilled. Only new key usage will update this value.",trigger:"hover",children:(0,t.jsx)(m.InfoCircleOutlined,{className:"text-gray-400 text-xs cursor-help"})})]}),size:130,enableSorting:!1,cell:e=>{let l=e.getValue();if(!l)return"Unknown";let a=new Date(l);return(0,t.jsx)(M.Tooltip,{title:a.toLocaleString(void 0,{dateStyle:"medium",timeStyle:"long"}),children:(0,t.jsx)("span",{children:a.toLocaleDateString()})})}},{id:"expires",accessorKey:"expires",header:"Expires",size:120,enableSorting:!1,cell:e=>{let t=e.getValue();return t?new Date(t).toLocaleDateString():"Never"}},{id:"spend",accessorKey:"spend",header:"Spend (USD)",size:100,enableSorting:!0,cell:e=>(0,s.formatNumberWithCommas)(e.getValue(),4)},{id:"max_budget",accessorKey:"max_budget",header:"Budget (USD)",size:110,enableSorting:!0,cell:e=>{let t=e.getValue();return null===t?"Unlimited":`$${(0,s.formatNumberWithCommas)(t)}`}},{id:"budget_reset_at",accessorKey:"budget_reset_at",header:"Budget Reset",size:130,enableSorting:!1,cell:e=>{let t=e.getValue();return t?new Date(t).toLocaleString():"Never"}},{id:"models",accessorKey:"models",header:"Models",size:200,enableSorting:!1,cell:e=>{let l=e.getValue();return(0,t.jsx)("div",{className:"flex flex-col py-2",children:Array.isArray(l)?(0,t.jsx)("div",{className:"flex flex-col",children:0===l.length?(0,t.jsx)(p.Badge,{size:"xs",className:"mb-1",color:"red",children:(0,t.jsx)(_.Text,{children:"All Proxy Models"})}):(0,t.jsx)(t.Fragment,{children:(0,t.jsxs)("div",{className:"flex items-start",children:[l.length>3&&(0,t.jsx)("div",{children:(0,t.jsx)(eS.Icon,{icon:T[e.row.id]?e_.ChevronDownIcon:ef.ChevronRightIcon,className:"cursor-pointer",size:"xs",onClick:()=>I(t=>({...t,[e.row.id]:!t[e.row.id]}))})}),(0,t.jsxs)("div",{className:"flex flex-wrap gap-1",children:[l.slice(0,3).map((e,l)=>"all-proxy-models"===e?(0,t.jsx)(p.Badge,{size:"xs",color:"red",children:(0,t.jsx)(_.Text,{children:"All Proxy Models"})},l):(0,t.jsx)(p.Badge,{size:"xs",color:"blue",children:(0,t.jsx)(_.Text,{children:e.length>30?`${(0,B.getModelDisplayName)(e).slice(0,30)}...`:(0,B.getModelDisplayName)(e)})},l)),l.length>3&&!T[e.row.id]&&(0,t.jsx)(p.Badge,{size:"xs",color:"gray",className:"cursor-pointer",children:(0,t.jsxs)(_.Text,{children:["+",l.length-3," ",l.length-3==1?"more model":"more models"]})}),T[e.row.id]&&(0,t.jsx)("div",{className:"flex flex-wrap gap-1",children:l.slice(3).map((e,l)=>"all-proxy-models"===e?(0,t.jsx)(p.Badge,{size:"xs",color:"red",children:(0,t.jsx)(_.Text,{children:"All Proxy Models"})},l+3):(0,t.jsx)(p.Badge,{size:"xs",color:"blue",children:(0,t.jsx)(_.Text,{children:e.length>30?`${(0,B.getModelDisplayName)(e).slice(0,30)}...`:(0,B.getModelDisplayName)(e)})},l+3))})]})]})})}):null})}},{id:"rate_limits",header:"Rate Limits",size:140,enableSorting:!1,cell:({row:e})=>{let l=e.original;return(0,t.jsxs)("div",{children:[(0,t.jsxs)("div",{children:["TPM: ",null!==l.tpm_limit?l.tpm_limit:"Unlimited"]}),(0,t.jsxs)("div",{children:["RPM: ",null!==l.rpm_limit?l.rpm_limit:"Unlimited"]})]})}}],[T]),E=(0,F.useCallback)(e=>{let t="function"==typeof e?e(d):e;if(c(t),t?.length>0){let e=t[0];A({"Sort By":e.id,"Sort Order":e.desc?"desc":"asc"},!0)}},[d,A]),U=(0,ev.useReactTable)({data:N,columns:R,columnResizeMode:"onChange",columnResizeDirection:"ltr",state:{sorting:d,pagination:u},onSortingChange:E,onPaginationChange:g,getCoreRowModel:(0,ew.getCoreRowModel)(),enableSorting:!0,manualSorting:!0,manualPagination:!0,pageCount:k});return(0,t.jsx)("div",{className:"w-full h-full overflow-hidden",children:o?(0,t.jsx)(eM.default,{keyId:o.token,onClose:()=>n(null),keyData:o,teams:[P],onDelete:S}):(0,t.jsxs)("div",{className:"border-b py-4 flex-1 overflow-hidden",children:[(0,t.jsx)("div",{className:"w-full mb-6",children:(0,t.jsx)(eT.default,{options:D,onApplyFilters:A,initialValues:h,onResetFilters:L})}),(0,t.jsx)("div",{className:"flex items-center justify-end w-full mb-4",children:(0,t.jsxs)("div",{className:"inline-flex items-center gap-2",children:[w||C?(0,t.jsx)(ek.Skeleton.Node,{active:!0,style:{width:74,height:20}}):(0,t.jsxs)("span",{className:"text-sm text-gray-700",children:["Page ",j+1," of ",U.getPageCount()]}),w||C?(0,t.jsx)(ek.Skeleton.Button,{active:!0,size:"small",style:{width:84,height:30}}):(0,t.jsx)("button",{onClick:()=>U.previousPage(),disabled:w||C||!U.getCanPreviousPage(),className:"px-3 py-1 text-sm border rounded-md hover:bg-gray-50 disabled:opacity-50 disabled:cursor-not-allowed",children:"Previous"}),w||C?(0,t.jsx)(ek.Skeleton.Button,{active:!0,size:"small",style:{width:58,height:30}}):(0,t.jsx)("button",{onClick:()=>U.nextPage(),disabled:w||C||!U.getCanNextPage(),className:"px-3 py-1 text-sm border rounded-md hover:bg-gray-50 disabled:opacity-50 disabled:cursor-not-allowed",children:"Next"})]})}),(0,t.jsx)("div",{className:"h-[75vh] overflow-auto",children:(0,t.jsx)("div",{className:"rounded-lg custom-border relative",children:(0,t.jsx)("div",{className:"overflow-x-auto",children:(0,t.jsxs)(Y.Table,{className:"[&_td]:py-0.5 [&_th]:py-1",style:{width:U.getCenterTotalSize()},children:[(0,t.jsx)(ee.TableHead,{children:U.getHeaderGroups().map(e=>(0,t.jsx)(el.TableRow,{children:e.headers.map(e=>(0,t.jsx)(et.TableHeaderCell,{"data-header-id":e.id,className:`py-1 h-8 relative hover:bg-gray-50 ${"actions"===e.id?"sticky right-0 bg-white shadow-[-4px_0_8px_-6px_rgba(0,0,0,0.1)]":""}`,style:{width:e.getSize(),position:"relative",cursor:e.column.getCanSort()?"pointer":"default"},onMouseEnter:()=>{let t=document.querySelector(`[data-header-id="${e.id}"] .resizer`);t&&(t.style.opacity="0.5")},onMouseLeave:()=>{let t=document.querySelector(`[data-header-id="${e.id}"] .resizer`);t&&!e.column.getIsResizing()&&(t.style.opacity="0")},onClick:e.column.getCanSort()?e.column.getToggleSortingHandler():void 0,children:(0,t.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,t.jsx)("div",{className:"flex items-center",children:e.isPlaceholder?null:(0,ev.flexRender)(e.column.columnDef.header,e.getContext())}),"actions"!==e.id&&e.column.getCanSort()&&(0,t.jsx)("div",{className:"w-4",children:e.column.getIsSorted()?({asc:(0,t.jsx)(ej.ChevronUpIcon,{className:"h-4 w-4 text-blue-500"}),desc:(0,t.jsx)(e_.ChevronDownIcon,{className:"h-4 w-4 text-blue-500"})})[e.column.getIsSorted()]:(0,t.jsx)(ey.SwitchVerticalIcon,{className:"h-4 w-4 text-gray-400"})}),(0,t.jsx)("div",{onDoubleClick:()=>e.column.resetSize(),onMouseDown:e.getResizeHandler(),onTouchStart:e.getResizeHandler(),className:`resizer ${U.options.columnResizeDirection} ${e.column.getIsResizing()?"isResizing":""}`,style:{position:"absolute",right:0,top:0,height:"100%",width:"5px",background:e.column.getIsResizing()?"#3b82f6":"transparent",cursor:"col-resize",userSelect:"none",touchAction:"none",opacity:+!!e.column.getIsResizing()}})]})},e.id))},e.id))}),(0,t.jsx)(X.TableBody,{children:w||C?(0,t.jsx)(el.TableRow,{children:(0,t.jsx)(Z.TableCell,{colSpan:R.length,className:"h-8 text-center",children:(0,t.jsx)("div",{className:"text-center text-gray-500",children:(0,t.jsx)("p",{children:"Loading keys..."})})})}):N.length>0?U.getRowModel().rows.map(e=>(0,t.jsx)(el.TableRow,{className:"h-8",children:e.getVisibleCells().map(e=>(0,t.jsx)(Z.TableCell,{style:{width:e.column.getSize(),maxWidth:"8-x",whiteSpace:"pre-wrap",overflow:"hidden"},className:`py-0.5 max-h-8 overflow-hidden text-ellipsis whitespace-nowrap ${"models"===e.column.id&&Array.isArray(e.getValue())&&e.getValue().length>3?"px-0":""}`,children:(0,ev.flexRender)(e.column.columnDef.cell,e.getContext())},e.id))},e.id)):(0,t.jsx)(el.TableRow,{children:(0,t.jsx)(Z.TableCell,{colSpan:R.length,className:"h-8 text-center",children:(0,t.jsx)("div",{className:"text-center text-gray-500",children:(0,t.jsx)("p",{children:"No keys found"})})})})})]})})})})]})})}e.s(["default",0,({teamId:e,onClose:J,accessToken:Y,is_team_admin:X,is_proxy_admin:Z,is_org_admin:ee=!1,userModels:et,editTeam:el,premiumUser:ea=!1,onUpdate:er})=>{let ei,eg,eh,ep,eb,e_,[ef,ej]=(0,F.useState)(null),[ey,ev]=(0,F.useState)(!0),[ew,eC]=(0,F.useState)(!1),[eS]=v.Form.useForm(),[eN,ek]=(0,F.useState)(!1),[eT,eM]=(0,F.useState)(null),[eI,eP]=(0,F.useState)(!1),[eF,eO]=(0,F.useState)([]),[eA,eL]=(0,F.useState)(!1),[eD,eR]=(0,F.useState)({}),[eB,eE]=(0,F.useState)([]),[eU,eV]=(0,F.useState)([]),[eK,e$]=(0,F.useState)({}),[eW,eq]=(0,F.useState)(!1),[eG,eH]=(0,F.useState)(null),[eQ,eJ]=(0,F.useState)(!1),[eY,eX]=(0,F.useState)(!1),[eZ,e0]=(0,F.useState)(!1),[e1,e2]=(0,F.useState)(null),{userRole:e4,userId:e5}=(0,l.default)(),{data:e3=[]}=(0,a.useOrganizations)(),e6=(0,F.useMemo)(()=>{let e=ef?.team_info?.organization_id;if(!e||!e5)return!1;let t=e3.find(t=>t.organization_id===e);return t?.members?.some(e=>e.user_id===e5&&"org_admin"===e.user_role)??!1},[ef,e3,e5]),e7=v.Form.useWatch("models",eS),e8=(0,F.useMemo)(()=>{let e=e7??ef?.team_info?.models??[];return e.includes("all-proxy-models")||e.includes("all-team-models")?et:(0,B.unfurlWildcardModelsInList)(e,et)},[e7,ef,et]),e9=X||Z||ee||e6,te=(0,F.useMemo)(()=>{let e;return e=[eo,en],e9?[...e,ed,em,ec]:e},[e9]),tt=(0,F.useMemo)(()=>el&&e9?ec:eo,[el,e9]),tl=async()=>{try{if(ev(!0),!Y)return;let t=await (0,i.teamInfoCall)(Y,e);ej(t)}catch(e){$.default.fromBackend("Failed to load team information"),console.error("Error fetching team info:",e)}finally{ev(!1)}};(0,F.useEffect)(()=>{tl()},[e,Y]),(0,F.useEffect)(()=>{(async()=>{if(!Y||!ef?.team_info?.organization_id)return e2(null);try{let e=await (0,i.organizationInfoCall)(Y,ef.team_info.organization_id);e2(e)}catch(e){console.error("Error fetching organization info:",e),e2(null)}})()},[Y,ef?.team_info?.organization_id]),(0,F.useMemo)(()=>{let e;return e=[],e=e1?e1.models.includes("all-proxy-models")?et:e1.models.length>0?e1.models:et:et,(0,B.unfurlWildcardModelsInList)(e,et)},[e1,et]),(0,F.useEffect)(()=>{let e=async()=>{try{if(!Y)return;let e=(await (0,i.getPoliciesList)(Y)).policies.map(e=>e.policy_name);eV(e)}catch(e){console.error("Failed to fetch policies:",e)}};(async()=>{try{if(!Y)return;let e=(await (0,i.getGuardrailsList)(Y)).guardrails.map(e=>e.guardrail_name);eE(e)}catch(e){console.error("Failed to fetch guardrails:",e)}})(),e()},[Y]),(0,F.useEffect)(()=>{(async()=>{if(!Y||!ef?.team_info?.policies||0===ef.team_info.policies.length)return;eq(!0);let e={};try{await Promise.all(ef.team_info.policies.map(async t=>{try{let l=await (0,i.getPolicyInfoWithGuardrails)(Y,t);e[t]=l.resolved_guardrails||[]}catch(l){console.error(`Failed to fetch guardrails for policy ${t}:`,l),e[t]=[]}})),e$(e)}catch(e){console.error("Failed to fetch policy guardrails:",e)}finally{eq(!1)}})()},[Y,ef?.team_info?.policies]);let ta=async t=>{try{if(null==Y)return;let l={user_email:t.user_email,user_id:t.user_id,role:t.role};await (0,i.teamMemberAddCall)(Y,e,l),$.default.success("Team member added successfully"),eC(!1),eS.resetFields();let a=await (0,i.teamInfoCall)(Y,e);ej(a),er(a)}catch(t){let e="Failed to add team member";t?.raw?.detail?.error?.includes("Assigning team admins is a premium feature")?e="Assigning admins is an enterprise-only feature. Please upgrade your LiteLLM plan to enable this.":t?.message&&(e=t.message),$.default.fromBackend(e),console.error("Error adding team member:",t)}},tr=async t=>{try{if(null==Y)return;let l={user_email:t.user_email,user_id:t.user_id,role:t.role,max_budget_in_team:t.max_budget_in_team,tpm_limit:t.tpm_limit,rpm_limit:t.rpm_limit};I.default.destroy(),await (0,i.teamMemberUpdateCall)(Y,e,l),$.default.success("Team member updated successfully"),ek(!1);let a=await (0,i.teamInfoCall)(Y,e);ej(a),er(a)}catch(t){let e="Failed to update team member";t?.raw?.detail?.includes("Assigning team admins is a premium feature")?e="Assigning admins is an enterprise-only feature. Please upgrade your LiteLLM plan to enable this.":t?.message&&(e=t.message),ek(!1),I.default.destroy(),$.default.fromBackend(e),console.error("Error updating team member:",t)}},ti=async()=>{if(eG&&Y){eX(!0);try{await (0,i.teamMemberDeleteCall)(Y,e,eG),$.default.success("Team member removed successfully");let t=await (0,i.teamInfoCall)(Y,e);ej(t),er(t)}catch(e){$.default.fromBackend("Failed to remove team member"),console.error("Error removing team member:",e)}finally{eX(!1),eJ(!1),eH(null)}}},ts=async t=>{try{let l;if(!Y)return;e0(!0);let a={};try{let{soft_budget_alerting_emails:e,...l}=t.metadata?JSON.parse(t.metadata):{};a=l}catch(e){$.default.fromBackend("Invalid JSON in metadata field");return}if("string"==typeof t.secret_manager_settings&&t.secret_manager_settings.trim().length>0)try{l=JSON.parse(t.secret_manager_settings)}catch(e){$.default.fromBackend("Invalid JSON in secret manager settings");return}let r=e=>null==e||"string"==typeof e&&""===e.trim()||"number"==typeof e&&Number.isNaN(e)?null:e,s={},n={};for(let e of t.modelLimits??[])e?.model&&(null!=e.tpm&&(s[e.model]=e.tpm),null!=e.rpm&&(n[e.model]=e.rpm));let d={team_id:e,team_alias:t.team_alias,models:t.models,tpm_limit:r(t.tpm_limit),rpm_limit:r(t.rpm_limit),model_tpm_limit:s,model_rpm_limit:n,max_budget:t.max_budget,soft_budget:r(t.soft_budget),budget_duration:t.budget_duration,metadata:{...a,...t.guardrails?.length>0?{guardrails:t.guardrails}:{},...t.logging_settings?.length>0?{logging:t.logging_settings}:{},disable_global_guardrails:t.disable_global_guardrails||!1,soft_budget_alerting_emails:"string"==typeof t.soft_budget_alerting_emails?t.soft_budget_alerting_emails.split(",").map(e=>e.trim()).filter(e=>e.length>0):t.soft_budget_alerting_emails||[],...void 0!==l?{secret_manager_settings:l}:{}},...t.policies?.length>0?{policies:t.policies}:{},...t.organization_id!==to.organization_id?{organization_id:t.organization_id??null}:{}};d.max_budget=(0,o.mapEmptyStringToNull)(d.max_budget),d.team_member_budget_duration=t.team_member_budget_duration,void 0!==t.team_member_budget&&(d.team_member_budget=Number(t.team_member_budget)),void 0!==t.team_member_key_duration&&(d.team_member_key_duration=t.team_member_key_duration),(void 0!==t.team_member_tpm_limit||void 0!==t.team_member_rpm_limit)&&(d.team_member_tpm_limit=r(t.team_member_tpm_limit),d.team_member_rpm_limit=r(t.team_member_rpm_limit));let{servers:m,accessGroups:c,toolsets:u}=t.mcp_servers_and_groups||{servers:[],accessGroups:[],toolsets:[]},g=new Set(m||[]),h=Object.fromEntries(Object.entries(t.mcp_tool_permissions||{}).filter(([e])=>g.has(e)));d.object_permission={},m&&(d.object_permission.mcp_servers=m),c&&(d.object_permission.mcp_access_groups=c),h&&(d.object_permission.mcp_tool_permissions=h),u&&(d.object_permission.mcp_toolsets=u),delete t.mcp_servers_and_groups,delete t.mcp_tool_permissions;let{agents:p,accessGroups:x}=t.agents_and_groups||{agents:[],accessGroups:[]};p&&p.length>0&&(d.object_permission.agents=p),x&&x.length>0&&(d.object_permission.agent_access_groups=x),delete t.agents_and_groups,t.vector_stores&&t.vector_stores.length>0&&(d.object_permission.vector_stores=t.vector_stores),void 0!==t.access_group_ids&&(d.access_group_ids=t.access_group_ids),await (0,i.teamUpdateCall)(Y,d),$.default.success("Team settings updated successfully"),eP(!1),tl()}catch(e){console.error("Error updating team:",e)}finally{e0(!1)}};if(ey)return(0,t.jsx)("div",{className:"p-4",children:"Loading..."});if(!ef?.team_info)return(0,t.jsx)("div",{className:"p-4",children:"Team not found"});let{team_info:to}=ef,tn=async(e,t)=>{await (0,s.copyToClipboard)(e)&&(eR(e=>({...e,[t]:!0})),setTimeout(()=>{eR(e=>({...e,[t]:!1}))},2e3))};return(0,t.jsxs)("div",{className:"p-4",children:[(0,t.jsx)("div",{className:"flex justify-between items-center mb-6",children:(0,t.jsxs)("div",{children:[(0,t.jsx)(y.Button,{type:"text",icon:(0,t.jsx)(h.ArrowLeftIcon,{className:"h-4 w-4"}),onClick:J,className:"mb-4",children:"Back to Teams"}),(0,t.jsx)(j.Title,{children:to.team_alias}),(0,t.jsxs)("div",{className:"flex items-center",children:[(0,t.jsx)(_.Text,{className:"text-gray-500 font-mono",children:to.team_id}),(0,t.jsx)(y.Button,{type:"text",size:"small",icon:eD["team-id"]?(0,t.jsx)(P.CheckIcon,{size:12}):(0,t.jsx)(z.CopyIcon,{size:12}),onClick:()=>tn(to.team_id,"team-id"),className:`left-2 z-10 transition-all duration-200 ${eD["team-id"]?"text-green-600 bg-green-50 border-green-200":"text-gray-500 hover:text-gray-700 hover:bg-gray-100"}`})]})]})}),(0,t.jsx)(T.Tabs,{defaultActiveKey:tt,className:"mb-4",items:[{key:eo,label:eu[eo],children:(0,t.jsxs)(b.Grid,{numItems:1,numItemsSm:2,numItemsLg:3,className:"gap-6",children:[(0,t.jsxs)(x.Card,{children:[(0,t.jsx)(_.Text,{children:"Budget Status"}),(0,t.jsxs)("div",{className:"mt-2",children:[(0,t.jsxs)(j.Title,{children:["$",(0,s.formatNumberWithCommas)(to.spend,4)]}),(0,t.jsxs)(_.Text,{children:["of ",null===to.max_budget?"Unlimited":`$${(0,s.formatNumberWithCommas)(to.max_budget,4)}`]}),to.budget_duration&&(0,t.jsxs)(_.Text,{className:"text-gray-500",children:["Reset: ",to.budget_duration]}),(0,t.jsx)("br",{}),to.team_member_budget_table&&(0,t.jsxs)(_.Text,{className:"text-gray-500",children:["Team Member Budget: $",(0,s.formatNumberWithCommas)(to.team_member_budget_table.max_budget,4)]})]})]}),(0,t.jsxs)(x.Card,{children:[(0,t.jsx)(_.Text,{children:"Rate Limits"}),(0,t.jsxs)("div",{className:"mt-2",children:[(0,t.jsxs)(_.Text,{children:["TPM: ",to.tpm_limit||"Unlimited"]}),(0,t.jsxs)(_.Text,{children:["RPM: ",to.rpm_limit||"Unlimited"]}),to.max_parallel_requests&&(0,t.jsxs)(_.Text,{children:["Max Parallel Requests: ",to.max_parallel_requests]}),(ei=to.metadata?.model_tpm_limit??{},eg=to.metadata?.model_rpm_limit??{},0===(eh=Array.from(new Set([...Object.keys(ei),...Object.keys(eg)]))).length?null:(0,t.jsxs)("div",{className:"mt-3",children:[(0,t.jsx)(_.Text,{className:"text-gray-500",children:"Per-model limits:"}),eh.map(e=>(0,t.jsxs)(_.Text,{className:"text-xs",children:[e,": TPM ",ei[e]??"—",", RPM ",eg[e]??"—"]},e))]}))]})]}),(0,t.jsxs)(x.Card,{children:[(0,t.jsx)(_.Text,{children:"Models"}),(0,t.jsx)("div",{className:"mt-2 flex flex-wrap gap-2",children:0===to.models.length||to.models.includes("all-proxy-models")?(0,t.jsx)(p.Badge,{color:"red",children:"All proxy models"}):(0,t.jsxs)(t.Fragment,{children:[to.models.map((e,l)=>(0,t.jsx)(p.Badge,{color:"blue",children:e},`direct-${l}`)),(to.access_group_models||[]).map((e,l)=>(0,t.jsx)(p.Badge,{color:"green",title:"From access group",children:e},`ag-${l}`))]})})]}),(0,t.jsxs)(x.Card,{children:[(0,t.jsx)(_.Text,{className:"font-semibold text-gray-900",children:"Virtual Keys"}),(0,t.jsxs)("div",{className:"mt-2",children:[(0,t.jsxs)(_.Text,{children:["User Keys: ",ef.keys.filter(e=>e.user_id).length]}),(0,t.jsxs)(_.Text,{children:["Service Account Keys: ",ef.keys.filter(e=>!e.user_id).length]}),(0,t.jsxs)(_.Text,{className:"text-gray-500",children:["Total: ",ef.keys.length]})]})]}),(0,t.jsx)(W.default,{objectPermission:to.object_permission,variant:"card",accessToken:Y}),(0,t.jsxs)(x.Card,{children:[(0,t.jsx)(_.Text,{className:"font-semibold text-gray-900 mb-3",children:"Guardrails"}),to.guardrails&&to.guardrails.length>0?(0,t.jsx)("div",{className:"flex flex-wrap gap-2",children:to.guardrails.map((e,l)=>(0,t.jsx)(p.Badge,{color:"blue",children:e},l))}):(0,t.jsx)(_.Text,{className:"text-gray-500",children:"No guardrails configured"}),to.metadata?.disable_global_guardrails&&(0,t.jsx)("div",{className:"mt-3 pt-3 border-t border-gray-200",children:(0,t.jsx)(p.Badge,{color:"yellow",children:"Global Guardrails Disabled"})})]}),(0,t.jsxs)(x.Card,{children:[(0,t.jsx)(_.Text,{className:"font-semibold text-gray-900 mb-3",children:"Policies"}),to.policies&&to.policies.length>0?(0,t.jsx)("div",{className:"space-y-4",children:to.policies.map((e,l)=>(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(p.Badge,{color:"purple",children:e}),eW&&(0,t.jsx)(_.Text,{className:"text-xs text-gray-400",children:"Loading guardrails..."})]}),!eW&&eK[e]&&eK[e].length>0&&(0,t.jsxs)("div",{className:"ml-4 pl-3 border-l-2 border-gray-200",children:[(0,t.jsx)(_.Text,{className:"text-xs text-gray-500 mb-1",children:"Resolved Guardrails:"}),(0,t.jsx)("div",{className:"flex flex-wrap gap-1",children:eK[e].map((e,l)=>(0,t.jsx)(p.Badge,{color:"blue",size:"xs",children:e},l))})]})]},l))}):(0,t.jsx)(_.Text,{className:"text-gray-500",children:"No policies configured"})]}),(0,t.jsx)(E.default,{loggingConfigs:to.metadata?.logging||[],disabledCallbacks:[],variant:"card"})]})},{key:en,label:eu[en],children:(0,t.jsx)(ez,{teamId:e,teamAlias:to.team_alias,organization:e1})},{key:ed,label:eu[ed],children:(0,t.jsx)(ex,{teamData:ef,canEditTeam:e9,handleMemberDelete:e=>{eH(e),eJ(!0)},setSelectedEditMember:eM,setIsEditMemberModalVisible:ek,setIsAddMemberModalVisible:eC})},{key:em,label:eu[em],children:(0,t.jsx)(es,{teamId:e,accessToken:Y,canEditTeam:e9})},{key:ec,label:eu[ec],children:(0,t.jsxs)(x.Card,{className:"overflow-y-auto max-h-[65vh]",children:[(0,t.jsxs)("div",{className:"flex justify-between items-center mb-4",children:[(0,t.jsx)(j.Title,{children:"Team Settings"}),e9&&!eI&&(0,t.jsx)(y.Button,{icon:(0,t.jsx)(d.EditOutlined,{className:"h-4 w-4"}),onClick:()=>eP(!0),children:"Edit Settings"})]}),eI?(0,t.jsxs)(v.Form,{form:eS,onFinish:ts,initialValues:{...to,team_alias:to.team_alias,models:to.models,tpm_limit:to.tpm_limit,rpm_limit:to.rpm_limit,modelLimits:Array.from(new Set([...Object.keys(to.metadata?.model_tpm_limit??{}),...Object.keys(to.metadata?.model_rpm_limit??{})])).map(e=>({model:e,tpm:to.metadata?.model_tpm_limit?.[e],rpm:to.metadata?.model_rpm_limit?.[e]})),max_budget:to.max_budget,soft_budget:to.soft_budget,budget_duration:to.budget_duration,team_member_tpm_limit:to.team_member_budget_table?.tpm_limit,team_member_rpm_limit:to.team_member_budget_table?.rpm_limit,team_member_budget:to.team_member_budget_table?.max_budget,team_member_budget_duration:to.team_member_budget_table?.budget_duration,guardrails:to.metadata?.guardrails||[],policies:to.policies||[],disable_global_guardrails:to.metadata?.disable_global_guardrails||!1,soft_budget_alerting_emails:Array.isArray(to.metadata?.soft_budget_alerting_emails)?to.metadata.soft_budget_alerting_emails.join(", "):"",metadata:to.metadata?JSON.stringify((({logging:e,secret_manager_settings:t,soft_budget_alerting_emails:l,model_tpm_limit:a,model_rpm_limit:r,...i})=>i)(to.metadata),null,2):"",logging_settings:to.metadata?.logging||[],secret_manager_settings:to.metadata?.secret_manager_settings?JSON.stringify(to.metadata.secret_manager_settings,null,2):"",organization_id:to.organization_id,vector_stores:to.object_permission?.vector_stores||[],mcp_servers:to.object_permission?.mcp_servers||[],mcp_access_groups:to.object_permission?.mcp_access_groups||[],mcp_servers_and_groups:{servers:to.object_permission?.mcp_servers||[],accessGroups:to.object_permission?.mcp_access_groups||[],toolsets:to.object_permission?.mcp_toolsets||[]},mcp_tool_permissions:to.object_permission?.mcp_tool_permissions||{},agents_and_groups:{agents:to.object_permission?.agents||[],accessGroups:to.object_permission?.agent_access_groups||[]},access_group_ids:to.access_group_ids||[]},layout:"vertical",children:[(0,t.jsx)(v.Form.Item,{label:"Team Name",name:"team_alias",rules:[{required:!0,message:"Please input a team name"}],children:(0,t.jsx)(w.Input,{type:""})}),(0,t.jsx)(v.Form.Item,{label:"Models",name:"models",rules:[{required:!0,message:"Please select at least one model"}],children:(0,t.jsx)(K.ModelSelect,{value:eS.getFieldValue("models")||[],onChange:e=>eS.setFieldValue("models",e),teamID:e,organizationID:ef?.team_info?.organization_id||void 0,options:{includeSpecialOptions:!0,includeUserModels:!ef?.team_info?.organization_id,showAllProxyModelsOverride:(0,n.isProxyAdminRole)(e4)&&!ef?.team_info?.organization_id},context:"team",dataTestId:"models-select"})}),(0,t.jsx)(v.Form.Item,{label:"Max Budget (USD)",name:"max_budget",children:(0,t.jsx)(q.default,{step:.01,precision:2,style:{width:"100%"}})}),(0,t.jsx)(v.Form.Item,{label:"Soft Budget (USD)",name:"soft_budget",children:(0,t.jsx)(q.default,{step:.01,precision:2,style:{width:"100%"}})}),(0,t.jsx)(v.Form.Item,{label:"Soft Budget Alerting Emails",name:"soft_budget_alerting_emails",tooltip:"Comma-separated email addresses to receive alerts when the soft budget is reached",children:(0,t.jsx)(w.Input,{placeholder:"example1@test.com, example2@test.com"})}),(0,t.jsx)(v.Form.Item,{label:"Team Member Budget (USD)",name:"team_member_budget",tooltip:"This is the individual budget for a user in the team.",children:(0,t.jsx)(q.default,{step:.01,precision:2,style:{width:"100%"}})}),(0,t.jsx)(v.Form.Item,{label:"Team Member Budget Duration",name:"team_member_budget_duration",children:(0,t.jsx)(D,{onChange:e=>eS.setFieldValue("team_member_budget_duration",e),value:eS.getFieldValue("team_member_budget_duration")})}),(0,t.jsx)(v.Form.Item,{label:"Team Member Key Duration (eg: 1d, 1mo)",name:"team_member_key_duration",tooltip:"Set a limit to the duration of a team member's key. Format: 30s (seconds), 30m (minutes), 30h (hours), 30d (days), 1mo (month)",children:(0,t.jsx)(f.TextInput,{placeholder:"e.g., 30d"})}),(0,t.jsx)(v.Form.Item,{label:"Team Member TPM Limit",name:"team_member_tpm_limit",tooltip:"Default tokens per minute limit for an individual team member. This limit applies to all requests the user makes within this team. Can be overridden per member.",children:(0,t.jsx)(q.default,{step:1,style:{width:"100%"},placeholder:"e.g., 1000"})}),(0,t.jsx)(v.Form.Item,{label:"Team Member RPM Limit",name:"team_member_rpm_limit",tooltip:"Default requests per minute limit for an individual team member. This limit applies to all requests the user makes within this team. Can be overridden per member.",children:(0,t.jsx)(q.default,{step:1,style:{width:"100%"},placeholder:"e.g., 100"})}),(0,t.jsx)(v.Form.Item,{label:"Reset Budget",name:"budget_duration",children:(0,t.jsxs)(S.Select,{placeholder:"n/a",children:[(0,t.jsx)(S.Select.Option,{value:"24h",children:"daily"}),(0,t.jsx)(S.Select.Option,{value:"7d",children:"weekly"}),(0,t.jsx)(S.Select.Option,{value:"30d",children:"monthly"})]})}),(0,t.jsx)(v.Form.Item,{label:"Tokens per minute Limit (TPM)",name:"tpm_limit",children:(0,t.jsx)(q.default,{step:1,style:{width:"100%"}})}),(0,t.jsx)(v.Form.Item,{label:"Requests per minute Limit (RPM)",name:"rpm_limit",children:(0,t.jsx)(q.default,{step:1,style:{width:"100%"}})}),(0,t.jsx)(v.Form.Item,{label:"Model-Specific Rate Limits",tooltip:"Set per-model TPM/RPM limits that apply across the whole team.",children:(0,t.jsx)(v.Form.List,{name:"modelLimits",children:(e,{add:l,remove:a})=>(0,t.jsxs)(t.Fragment,{children:[e.map(({key:e,name:l,...r})=>(0,t.jsxs)(N.Space,{style:{display:"flex",marginBottom:8},align:"baseline",children:[(0,t.jsx)(v.Form.Item,{...r,name:[l,"model"],rules:[{required:!0,message:"Missing model"},{validator:(e,t)=>t&&(eS.getFieldValue("modelLimits")??[]).filter(e=>e?.model===t).length>1?Promise.reject(Error("Duplicate model")):Promise.resolve()}],style:{minWidth:240},children:(0,t.jsx)(S.Select,{showSearch:!0,placeholder:"Select model",allowClear:!0,options:e8.map(e=>({value:e,label:e}))})}),(0,t.jsx)(v.Form.Item,{...r,name:[l,"tpm"],rules:[{validator:async(e,t)=>{let a=(eS.getFieldValue("modelLimits")??[])[l]??{};return a.model&&null==t&&null==a.rpm?Promise.reject(Error("Set at least one of TPM or RPM")):Promise.resolve()}}],children:(0,t.jsx)(C.InputNumber,{placeholder:"TPM Limit",min:0})}),(0,t.jsx)(v.Form.Item,{...r,name:[l,"rpm"],children:(0,t.jsx)(C.InputNumber,{placeholder:"RPM Limit",min:0})}),(0,t.jsx)(c.MinusCircleOutlined,{onClick:()=>a(l),style:{color:"#ef4444"}})]},e)),(0,t.jsx)(v.Form.Item,{children:(0,t.jsx)(y.Button,{type:"dashed",onClick:()=>l(),block:!0,icon:(0,t.jsx)(u.PlusOutlined,{}),children:"Add Model Limit"})})]})})}),(0,t.jsx)(v.Form.Item,{label:(0,t.jsxs)("span",{children:["Guardrails"," ",(0,t.jsx)(M.Tooltip,{title:"Setup your first guardrail",children:(0,t.jsx)("a",{href:"https://docs.litellm.ai/docs/proxy/guardrails/quick_start",target:"_blank",rel:"noopener noreferrer",onClick:e=>e.stopPropagation(),children:(0,t.jsx)(m.InfoCircleOutlined,{style:{marginLeft:"4px"}})})})]}),name:"guardrails",help:"Select existing guardrails or enter new ones",children:(0,t.jsx)(S.Select,{mode:"tags",placeholder:"Select or enter guardrails",options:eB.map(e=>({value:e,label:e}))})}),(0,t.jsx)(v.Form.Item,{label:(0,t.jsxs)("span",{children:["Disable Global Guardrails",(0,t.jsx)(M.Tooltip,{title:"When enabled, this team will bypass any guardrails configured to run on every request (global guardrails)",children:(0,t.jsx)(m.InfoCircleOutlined,{style:{marginLeft:"4px"}})})]}),name:"disable_global_guardrails",valuePropName:"checked",help:"Bypass global guardrails for this team",children:(0,t.jsx)(k.Switch,{checkedChildren:"Yes",unCheckedChildren:"No"})}),(0,t.jsx)(v.Form.Item,{label:(0,t.jsxs)("span",{children:["Policies"," ",(0,t.jsx)(M.Tooltip,{title:"Apply policies to this team to control guardrails and other settings",children:(0,t.jsx)("a",{href:"https://docs.litellm.ai/docs/proxy/guardrails/guardrail_policies",target:"_blank",rel:"noopener noreferrer",onClick:e=>e.stopPropagation(),children:(0,t.jsx)(m.InfoCircleOutlined,{style:{marginLeft:"4px"}})})})]}),name:"policies",help:"Select existing policies or enter new ones",children:(0,t.jsx)(S.Select,{mode:"tags",placeholder:"Select or enter policies",options:eU.map(e=>({value:e,label:e}))})}),(0,t.jsx)(v.Form.Item,{label:(0,t.jsxs)("span",{children:["Access Groups"," ",(0,t.jsx)(M.Tooltip,{title:"Assign access groups to this team. Access groups control which models, MCP servers, and agents this team can use",children:(0,t.jsx)(m.InfoCircleOutlined,{style:{marginLeft:"4px"}})})]}),name:"access_group_ids",children:(0,t.jsx)(O.default,{placeholder:"Select access groups (optional)"})}),(0,t.jsx)(v.Form.Item,{label:"Vector Stores",name:"vector_stores","aria-label":"Vector Stores",children:(0,t.jsx)(G.default,{onChange:e=>eS.setFieldValue("vector_stores",e),value:eS.getFieldValue("vector_stores"),accessToken:Y||"",placeholder:"Select vector stores"})}),(0,t.jsx)(v.Form.Item,{label:"Allowed Pass Through Routes",name:"allowed_passthrough_routes",children:(0,t.jsx)(R.default,{onChange:e=>eS.setFieldValue("allowed_passthrough_routes",e),value:eS.getFieldValue("allowed_passthrough_routes"),accessToken:Y||"",placeholder:"Select pass through routes"})}),(0,t.jsx)(v.Form.Item,{label:"MCP Servers / Access Groups",name:"mcp_servers_and_groups",children:(0,t.jsx)(U.default,{onChange:e=>eS.setFieldValue("mcp_servers_and_groups",e),value:eS.getFieldValue("mcp_servers_and_groups"),accessToken:Y||"",placeholder:"Select MCP servers or access groups (optional)"})}),(0,t.jsx)(v.Form.Item,{name:"mcp_tool_permissions",initialValue:{},hidden:!0,children:(0,t.jsx)(w.Input,{type:"hidden"})}),(0,t.jsx)(v.Form.Item,{noStyle:!0,shouldUpdate:(e,t)=>e.mcp_servers_and_groups!==t.mcp_servers_and_groups||e.mcp_tool_permissions!==t.mcp_tool_permissions,children:()=>(0,t.jsx)("div",{className:"mb-6",children:(0,t.jsx)(V.default,{accessToken:Y||"",selectedServers:eS.getFieldValue("mcp_servers_and_groups")?.servers||[],toolPermissions:eS.getFieldValue("mcp_tool_permissions")||{},onChange:e=>eS.setFieldsValue({mcp_tool_permissions:e})})})}),(0,t.jsx)(v.Form.Item,{label:"Agents / Access Groups",name:"agents_and_groups",children:(0,t.jsx)(A.default,{onChange:e=>eS.setFieldValue("agents_and_groups",e),value:eS.getFieldValue("agents_and_groups"),accessToken:Y||"",placeholder:"Select agents or access groups (optional)"})}),(0,t.jsx)(v.Form.Item,{label:"Organization",name:"organization_id",children:(0,t.jsx)(S.Select,{allowClear:!0,placeholder:"Select an organization",showSearch:!0,optionFilterProp:"label",options:e3.map(e=>({value:e.organization_id,label:e.organization_alias||e.organization_id}))})}),(0,t.jsx)(v.Form.Item,{label:"Logging Settings",name:"logging_settings",children:(0,t.jsx)(H.default,{value:eS.getFieldValue("logging_settings"),onChange:e=>eS.setFieldValue("logging_settings",e)})}),(0,t.jsx)(v.Form.Item,{label:"Secret Manager Settings",name:"secret_manager_settings",help:ea?"Enter secret manager configuration as a JSON object.":"Premium feature - Upgrade to manage secret manager settings.",rules:[{validator:async(e,t)=>{if(!t)return Promise.resolve();try{return JSON.parse(t),Promise.resolve()}catch(e){return Promise.reject(Error("Please enter valid JSON"))}}}],children:(0,t.jsx)(w.Input.TextArea,{rows:6,placeholder:'{"namespace": "admin", "mount": "secret", "path_prefix": "litellm"}',disabled:!ea})}),(0,t.jsx)(v.Form.Item,{label:"Metadata",name:"metadata",children:(0,t.jsx)(w.Input.TextArea,{rows:10})}),(0,t.jsx)("div",{className:"sticky z-10 bg-white p-4 pr-0 border-t border-gray-200 bottom-[-1.5rem] inset-x-[-1.5rem]",children:(0,t.jsxs)("div",{className:"flex justify-end items-center gap-2",children:[(0,t.jsx)(y.Button,{onClick:()=>eP(!1),disabled:eZ,children:"Cancel"}),(0,t.jsx)(y.Button,{icon:(0,t.jsx)(g.SaveOutlined,{className:"h-4 w-4"}),type:"primary",htmlType:"submit",loading:eZ,children:"Save Changes"})]})})]}):(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)(_.Text,{className:"font-medium",children:"Team Name"}),(0,t.jsx)("div",{children:to.team_alias})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(_.Text,{className:"font-medium",children:"Team ID"}),(0,t.jsx)("div",{className:"font-mono",children:to.team_id})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(_.Text,{className:"font-medium",children:"Created At"}),(0,t.jsx)("div",{children:new Date(to.created_at).toLocaleString()})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(_.Text,{className:"font-medium",children:"Models"}),(0,t.jsx)("div",{className:"flex flex-wrap gap-2 mt-1",children:to.models.map((e,l)=>(0,t.jsx)(p.Badge,{color:"red",children:e},l))})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(_.Text,{className:"font-medium",children:"Rate Limits"}),(0,t.jsxs)("div",{children:["TPM: ",to.tpm_limit||"Unlimited"]}),(0,t.jsxs)("div",{children:["RPM: ",to.rpm_limit||"Unlimited"]}),(ep=to.metadata?.model_tpm_limit??{},eb=to.metadata?.model_rpm_limit??{},0===(e_=Array.from(new Set([...Object.keys(ep),...Object.keys(eb)]))).length?null:(0,t.jsxs)("div",{className:"mt-2",children:[(0,t.jsx)(_.Text,{className:"text-gray-500",children:"Per-model limits:"}),e_.map(e=>(0,t.jsxs)("div",{className:"text-xs ml-2",children:[e,": TPM ",ep[e]??"—",", RPM ",eb[e]??"—"]},e))]}))]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(_.Text,{className:"font-medium",children:"Team Budget"}),(0,t.jsxs)("div",{children:["Max Budget:"," ",null!==to.max_budget?`$${(0,s.formatNumberWithCommas)(to.max_budget,4)}`:"No Limit"]}),(0,t.jsxs)("div",{children:["Soft Budget:"," ",null!==to.soft_budget&&void 0!==to.soft_budget?`$${(0,s.formatNumberWithCommas)(to.soft_budget,4)}`:"No Limit"]}),(0,t.jsxs)("div",{children:["Budget Reset: ",to.budget_duration||"Never"]}),to.metadata?.soft_budget_alerting_emails&&Array.isArray(to.metadata.soft_budget_alerting_emails)&&to.metadata.soft_budget_alerting_emails.length>0&&(0,t.jsxs)("div",{children:["Soft Budget Alerting Emails: ",to.metadata.soft_budget_alerting_emails.join(", ")]})]}),(0,t.jsxs)("div",{children:[(0,t.jsxs)(_.Text,{className:"font-medium",children:["Team Member Settings"," ",(0,t.jsx)(M.Tooltip,{title:"These are limits on individual team members",children:(0,t.jsx)(m.InfoCircleOutlined,{style:{marginLeft:"4px"}})})]}),(0,t.jsxs)("div",{children:["Max Budget: ",to.team_member_budget_table?.max_budget||"No Limit"]}),(0,t.jsxs)("div",{children:["Budget Duration: ",to.team_member_budget_table?.budget_duration||"No Limit"]}),(0,t.jsxs)("div",{children:["Key Duration: ",to.metadata?.team_member_key_duration||"No Limit"]}),(0,t.jsxs)("div",{children:["TPM Limit: ",to.team_member_budget_table?.tpm_limit||"No Limit"]}),(0,t.jsxs)("div",{children:["RPM Limit: ",to.team_member_budget_table?.rpm_limit||"No Limit"]})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(_.Text,{className:"font-medium",children:"Organization ID"}),(0,t.jsx)("div",{children:to.organization_id})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(_.Text,{className:"font-medium",children:"Status"}),(0,t.jsx)(p.Badge,{color:to.blocked?"red":"green",children:to.blocked?"Blocked":"Active"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(_.Text,{className:"font-medium",children:"Disable Global Guardrails"}),(0,t.jsx)("div",{children:to.metadata?.disable_global_guardrails===!0?(0,t.jsx)(p.Badge,{color:"yellow",children:"Enabled - Global guardrails bypassed"}):(0,t.jsx)(p.Badge,{color:"green",children:"Disabled - Global guardrails active"})})]}),(0,t.jsx)(W.default,{objectPermission:to.object_permission,variant:"inline",className:"pt-4 border-t border-gray-200",accessToken:Y}),(0,t.jsx)(E.default,{loggingConfigs:to.metadata?.logging||[],disabledCallbacks:[],variant:"inline",className:"pt-4 border-t border-gray-200"}),to.metadata?.secret_manager_settings&&(0,t.jsxs)("div",{className:"pt-4 border-t border-gray-200",children:[(0,t.jsx)(_.Text,{className:"font-medium",children:"Secret Manager Settings"}),(0,t.jsx)("pre",{className:"mt-2 bg-gray-50 p-3 rounded text-xs overflow-x-auto",children:JSON.stringify(to.metadata.secret_manager_settings,null,2)})]})]})]})}].filter(e=>te.includes(e.key))}),(0,t.jsx)(Q.default,{visible:eN,onCancel:()=>ek(!1),onSubmit:tr,initialData:eT,mode:"edit",config:{title:"Edit Member",showEmail:!0,showUserId:!0,roleOptions:[{label:"Admin",value:"admin"},{label:"User",value:"user"}],additionalFields:[{name:"max_budget_in_team",label:(0,t.jsxs)("span",{children:["Team Member Budget (USD)"," ",(0,t.jsx)(M.Tooltip,{title:"Maximum amount in USD this member can spend within this team. This is separate from any global user budget limits",children:(0,t.jsx)(m.InfoCircleOutlined,{style:{marginLeft:"4px"}})})]}),type:"numerical",step:.01,min:0,placeholder:"Budget limit for this member within this team"},{name:"tpm_limit",label:(0,t.jsxs)("span",{children:["Team Member TPM Limit"," ",(0,t.jsx)(M.Tooltip,{title:"Maximum tokens per minute this member can use within this team. This is separate from any global user TPM limit",children:(0,t.jsx)(m.InfoCircleOutlined,{style:{marginLeft:"4px"}})})]}),type:"numerical",step:1,min:0,placeholder:"Tokens per minute limit for this member in this team"},{name:"rpm_limit",label:(0,t.jsxs)("span",{children:["Team Member RPM Limit"," ",(0,t.jsx)(M.Tooltip,{title:"Maximum requests per minute this member can make within this team. This is separate from any global user RPM limit",children:(0,t.jsx)(m.InfoCircleOutlined,{style:{marginLeft:"4px"}})})]}),type:"numerical",step:1,min:0,placeholder:"Requests per minute limit for this member in this team"}]}}),(0,t.jsx)(r.default,{isVisible:ew,onCancel:()=>eC(!1),onSubmit:ta,accessToken:Y,teamId:e}),(0,t.jsx)(L.default,{isOpen:eQ,title:"Delete Team Member",alertMessage:"Removing team members will also delete any keys created by or created for this member.",message:"Are you sure you want to remove this member from the team? This action cannot be undone.",resourceInformationTitle:"Team Member Information",resourceInformation:[{label:"User ID",value:eG?.user_id,code:!0},{label:"Email",value:eG?.user_email},{label:"Role",value:eG?.role}],onCancel:()=>{eJ(!1),eH(null)},onOk:ti,confirmLoading:eY})]})}],56567)}]); \ No newline at end of file diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/3e3213d578d771d6.js b/litellm/proxy/_experimental/out/_next/static/chunks/3e3213d578d771d6.js new file mode 100644 index 0000000000..bb673fa326 --- /dev/null +++ b/litellm/proxy/_experimental/out/_next/static/chunks/3e3213d578d771d6.js @@ -0,0 +1,420 @@ +(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,190272,785913,e=>{"use strict";var t,o,i=((t={}).AUDIO_SPEECH="audio_speech",t.AUDIO_TRANSCRIPTION="audio_transcription",t.IMAGE_GENERATION="image_generation",t.VIDEO_GENERATION="video_generation",t.CHAT="chat",t.RESPONSES="responses",t.IMAGE_EDITS="image_edits",t.ANTHROPIC_MESSAGES="anthropic_messages",t.EMBEDDING="embedding",t),a=((o={}).IMAGE="image",o.VIDEO="video",o.CHAT="chat",o.RESPONSES="responses",o.IMAGE_EDITS="image_edits",o.ANTHROPIC_MESSAGES="anthropic_messages",o.EMBEDDINGS="embeddings",o.SPEECH="speech",o.TRANSCRIPTION="transcription",o.A2A_AGENTS="a2a_agents",o.MCP="mcp",o.REALTIME="realtime",o);let n={image_generation:"image",video_generation:"video",chat:"chat",responses:"responses",image_edits:"image_edits",anthropic_messages:"anthropic_messages",audio_speech:"speech",audio_transcription:"transcription",embedding:"embeddings"};e.s(["EndpointType",()=>a,"getEndpointType",0,e=>{if(console.log("getEndpointType:",e),Object.values(i).includes(e)){let t=n[e];return console.log("endpointType:",t),t}return"chat"}],785913),e.s(["generateCodeSnippet",0,e=>{let t,{apiKeySource:o,accessToken:i,apiKey:n,inputMessage:r,chatHistory:s,selectedTags:l,selectedVectorStores:c,selectedGuardrails:d,selectedPolicies:p,selectedMCPServers:m,mcpServers:u,mcpServerToolRestrictions:f,selectedVoice:g,endpointType:h,selectedModel:_,selectedSdk:b,proxySettings:x}=e,v="session"===o?i:n,y=window.location.origin,j=x?.LITELLM_UI_API_DOC_BASE_URL;j&&j.trim()?y=j:x?.PROXY_BASE_URL&&(y=x.PROXY_BASE_URL);let w=r||"Your prompt here",S=w.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\n/g,"\\n"),k=s.filter(e=>!e.isImage).map(({role:e,content:t})=>({role:e,content:t})),C={};l.length>0&&(C.tags=l),c.length>0&&(C.vector_stores=c),d.length>0&&(C.guardrails=d),p.length>0&&(C.policies=p);let N=_||"your-model-name",O="azure"===b?`import openai + +client = openai.AzureOpenAI( + api_key="${v||"YOUR_LITELLM_API_KEY"}", + azure_endpoint="${y}", + api_version="2024-02-01" +)`:`import openai + +client = openai.OpenAI( + api_key="${v||"YOUR_LITELLM_API_KEY"}", + base_url="${y}" +)`;switch(h){case a.CHAT:{let e=Object.keys(C).length>0,o="";if(e){let e=JSON.stringify({metadata:C},null,2).split("\n").map(e=>" ".repeat(4)+e).join("\n").trim();o=`, + extra_body=${e}`}let i=k.length>0?k:[{role:"user",content:w}];t=` +import base64 + +# Helper function to encode images to base64 +def encode_image(image_path): + with open(image_path, "rb") as image_file: + return base64.b64encode(image_file.read()).decode('utf-8') + +# Example with text only +response = client.chat.completions.create( + model="${N}", + messages=${JSON.stringify(i,null,4)}${o} +) + +print(response) + +# Example with image or PDF (uncomment and provide file path to use) +# base64_file = encode_image("path/to/your/file.jpg") # or .pdf +# response_with_file = client.chat.completions.create( +# model="${N}", +# messages=[ +# { +# "role": "user", +# "content": [ +# { +# "type": "text", +# "text": "${S}" +# }, +# { +# "type": "image_url", +# "image_url": { +# "url": f"data:image/jpeg;base64,{base64_file}" # or data:application/pdf;base64,{base64_file} +# } +# } +# ] +# } +# ]${o} +# ) +# print(response_with_file) +`;break}case a.RESPONSES:{let e=Object.keys(C).length>0,o="";if(e){let e=JSON.stringify({metadata:C},null,2).split("\n").map(e=>" ".repeat(4)+e).join("\n").trim();o=`, + extra_body=${e}`}let i=k.length>0?k:[{role:"user",content:w}];t=` +import base64 + +# Helper function to encode images to base64 +def encode_image(image_path): + with open(image_path, "rb") as image_file: + return base64.b64encode(image_file.read()).decode('utf-8') + +# Example with text only +response = client.responses.create( + model="${N}", + input=${JSON.stringify(i,null,4)}${o} +) + +print(response.output_text) + +# Example with image or PDF (uncomment and provide file path to use) +# base64_file = encode_image("path/to/your/file.jpg") # or .pdf +# response_with_file = client.responses.create( +# model="${N}", +# input=[ +# { +# "role": "user", +# "content": [ +# {"type": "input_text", "text": "${S}"}, +# { +# "type": "input_image", +# "image_url": f"data:image/jpeg;base64,{base64_file}", # or data:application/pdf;base64,{base64_file} +# }, +# ], +# } +# ]${o} +# ) +# print(response_with_file.output_text) +`;break}case a.IMAGE:t="azure"===b?` +# NOTE: The Azure SDK does not have a direct equivalent to the multi-modal 'responses.create' method shown for OpenAI. +# This snippet uses 'client.images.generate' and will create a new image based on your prompt. +# It does not use the uploaded image, as 'client.images.generate' does not support image inputs in this context. +import os +import requests +import json +import time +from PIL import Image + +result = client.images.generate( + model="${N}", + prompt="${r}", + n=1 +) + +json_response = json.loads(result.model_dump_json()) + +# Set the directory for the stored image +image_dir = os.path.join(os.curdir, 'images') + +# If the directory doesn't exist, create it +if not os.path.isdir(image_dir): + os.mkdir(image_dir) + +# Initialize the image path +image_filename = f"generated_image_{int(time.time())}.png" +image_path = os.path.join(image_dir, image_filename) + +try: + # Retrieve the generated image + if json_response.get("data") && len(json_response["data"]) > 0 && json_response["data"][0].get("url"): + image_url = json_response["data"][0]["url"] + generated_image = requests.get(image_url).content + with open(image_path, "wb") as image_file: + image_file.write(generated_image) + + print(f"Image saved to {image_path}") + # Display the image + image = Image.open(image_path) + image.show() + else: + print("Could not find image URL in response.") + print("Full response:", json_response) +except Exception as e: + print(f"An error occurred: {e}") + print("Full response:", json_response) +`:` +import base64 +import os +import time +import json +from PIL import Image +import requests + +# Helper function to encode images to base64 +def encode_image(image_path): + with open(image_path, "rb") as image_file: + return base64.b64encode(image_file.read()).decode('utf-8') + +# Helper function to create a file (simplified for this example) +def create_file(image_path): + # In a real implementation, this would upload the file to OpenAI + # For this example, we'll just return a placeholder ID + return f"file_{os.path.basename(image_path).replace('.', '_')}" + +# The prompt entered by the user +prompt = "${S}" + +# Encode images to base64 +base64_image1 = encode_image("body-lotion.png") +base64_image2 = encode_image("soap.png") + +# Create file IDs +file_id1 = create_file("body-lotion.png") +file_id2 = create_file("incense-kit.png") + +response = client.responses.create( + model="${N}", + input=[ + { + "role": "user", + "content": [ + {"type": "input_text", "text": prompt}, + { + "type": "input_image", + "image_url": f"data:image/jpeg;base64,{base64_image1}", + }, + { + "type": "input_image", + "image_url": f"data:image/jpeg;base64,{base64_image2}", + }, + { + "type": "input_image", + "file_id": file_id1, + }, + { + "type": "input_image", + "file_id": file_id2, + } + ], + } + ], + tools=[{"type": "image_generation"}], +) + +# Process the response +image_generation_calls = [ + output + for output in response.output + if output.type == "image_generation_call" +] + +image_data = [output.result for output in image_generation_calls] + +if image_data: + image_base64 = image_data[0] + image_filename = f"edited_image_{int(time.time())}.png" + with open(image_filename, "wb") as f: + f.write(base64.b64decode(image_base64)) + print(f"Image saved to {image_filename}") +else: + # If no image is generated, there might be a text response with an explanation + text_response = [output.text for output in response.output if hasattr(output, 'text')] + if text_response: + print("No image generated. Model response:") + print("\\n".join(text_response)) + else: + print("No image data found in response.") + print("Full response for debugging:") + print(response) +`;break;case a.IMAGE_EDITS:t="azure"===b?` +import base64 +import os +import time +import json +from PIL import Image +import requests + +# Helper function to encode images to base64 +def encode_image(image_path): + with open(image_path, "rb") as image_file: + return base64.b64encode(image_file.read()).decode('utf-8') + +# The prompt entered by the user +prompt = "${S}" + +# Encode images to base64 +base64_image1 = encode_image("body-lotion.png") +base64_image2 = encode_image("soap.png") + +# Create file IDs +file_id1 = create_file("body-lotion.png") +file_id2 = create_file("incense-kit.png") + +response = client.responses.create( + model="${N}", + input=[ + { + "role": "user", + "content": [ + {"type": "input_text", "text": prompt}, + { + "type": "input_image", + "image_url": f"data:image/jpeg;base64,{base64_image1}", + }, + { + "type": "input_image", + "image_url": f"data:image/jpeg;base64,{base64_image2}", + }, + { + "type": "input_image", + "file_id": file_id1, + }, + { + "type": "input_image", + "file_id": file_id2, + } + ], + } + ], + tools=[{"type": "image_generation"}], +) + +# Process the response +image_generation_calls = [ + output + for output in response.output + if output.type == "image_generation_call" +] + +image_data = [output.result for output in image_generation_calls] + +if image_data: + image_base64 = image_data[0] + image_filename = f"edited_image_{int(time.time())}.png" + with open(image_filename, "wb") as f: + f.write(base64.b64decode(image_base64)) + print(f"Image saved to {image_filename}") +else: + # If no image is generated, there might be a text response with an explanation + text_response = [output.text for output in response.output if hasattr(output, 'text')] + if text_response: + print("No image generated. Model response:") + print("\\n".join(text_response)) + else: + print("No image data found in response.") + print("Full response for debugging:") + print(response) +`:` +import base64 +import os +import time + +# Helper function to encode images to base64 +def encode_image(image_path): + with open(image_path, "rb") as image_file: + return base64.b64encode(image_file.read()).decode('utf-8') + +# Helper function to create a file (simplified for this example) +def create_file(image_path): + # In a real implementation, this would upload the file to OpenAI + # For this example, we'll just return a placeholder ID + return f"file_{os.path.basename(image_path).replace('.', '_')}" + +# The prompt entered by the user +prompt = "${S}" + +# Encode images to base64 +base64_image1 = encode_image("body-lotion.png") +base64_image2 = encode_image("soap.png") + +# Create file IDs +file_id1 = create_file("body-lotion.png") +file_id2 = create_file("incense-kit.png") + +response = client.responses.create( + model="${N}", + input=[ + { + "role": "user", + "content": [ + {"type": "input_text", "text": prompt}, + { + "type": "input_image", + "image_url": f"data:image/jpeg;base64,{base64_image1}", + }, + { + "type": "input_image", + "image_url": f"data:image/jpeg;base64,{base64_image2}", + }, + { + "type": "input_image", + "file_id": file_id1, + }, + { + "type": "input_image", + "file_id": file_id2, + } + ], + } + ], + tools=[{"type": "image_generation"}], +) + +# Process the response +image_generation_calls = [ + output + for output in response.output + if output.type == "image_generation_call" +] + +image_data = [output.result for output in image_generation_calls] + +if image_data: + image_base64 = image_data[0] + image_filename = f"edited_image_{int(time.time())}.png" + with open(image_filename, "wb") as f: + f.write(base64.b64decode(image_base64)) + print(f"Image saved to {image_filename}") +else: + # If no image is generated, there might be a text response with an explanation + text_response = [output.text for output in response.output if hasattr(output, 'text')] + if text_response: + print("No image generated. Model response:") + print("\\n".join(text_response)) + else: + print("No image data found in response.") + print("Full response for debugging:") + print(response) +`;break;case a.EMBEDDINGS:t=` +response = client.embeddings.create( + input="${r||"Your string here"}", + model="${N}", + encoding_format="base64" # or "float" +) + +print(response.data[0].embedding) +`;break;case a.TRANSCRIPTION:t=` +# Open the audio file +audio_file = open("path/to/your/audio/file.mp3", "rb") + +# Make the transcription request +response = client.audio.transcriptions.create( + model="${N}", + file=audio_file${r?`, + prompt="${r.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`:""} +) + +print(response.text) +`;break;case a.SPEECH:t=` +# Make the text-to-speech request +response = client.audio.speech.create( + model="${N}", + input="${r||"Your text to convert to speech here"}", + voice="${g}" # Options: alloy, ash, ballad, coral, echo, fable, nova, onyx, sage, shimmer +) + +# Save the audio to a file +output_filename = "output_speech.mp3" +response.stream_to_file(output_filename) +print(f"Audio saved to {output_filename}") + +# Optional: Customize response format and speed +# response = client.audio.speech.create( +# model="${N}", +# input="${r||"Your text to convert to speech here"}", +# voice="alloy", +# response_format="mp3", # Options: mp3, opus, aac, flac, wav, pcm +# speed=1.0 # Range: 0.25 to 4.0 +# ) +# response.stream_to_file("output_speech.mp3") +`;break;default:t="\n# Code generation for this endpoint is not implemented yet."}return`${O} +${t}`}],190272)},84899,e=>{"use strict";e.i(247167);var t=e.i(931067),o=e.i(271645),i={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"defs",attrs:{},children:[{tag:"style",attrs:{}}]},{tag:"path",attrs:{d:"M931.4 498.9L94.9 79.5c-3.4-1.7-7.3-2.1-11-1.2a15.99 15.99 0 00-11.7 19.3l86.2 352.2c1.3 5.3 5.2 9.6 10.4 11.3l147.7 50.7-147.6 50.7c-5.2 1.8-9.1 6-10.3 11.3L72.2 926.5c-.9 3.7-.5 7.6 1.2 10.9 3.9 7.9 13.5 11.1 21.5 7.2l836.5-417c3.1-1.5 5.6-4.1 7.2-7.1 3.9-8 .7-17.6-7.2-21.6zM170.8 826.3l50.3-205.6 295.2-101.3c2.3-.8 4.2-2.6 5-5 1.4-4.2-.8-8.7-5-10.2L221.1 403 171 198.2l628 314.9-628.2 313.2z"}}]},name:"send",theme:"outlined"},a=e.i(9583),n=o.forwardRef(function(e,n){return o.createElement(a.default,(0,t.default)({},e,{ref:n,icon:i}))});e.s(["SendOutlined",0,n],84899)},518617,e=>{"use strict";e.i(247167);var t=e.i(931067),o=e.i(271645);let i={icon:{tag:"svg",attrs:{"fill-rule":"evenodd",viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M512 64c247.4 0 448 200.6 448 448S759.4 960 512 960 64 759.4 64 512 264.6 64 512 64zm0 76c-205.4 0-372 166.6-372 372s166.6 372 372 372 372-166.6 372-372-166.6-372-372-372zm128.01 198.83c.03 0 .05.01.09.06l45.02 45.01a.2.2 0 01.05.09.12.12 0 010 .07c0 .02-.01.04-.05.08L557.25 512l127.87 127.86a.27.27 0 01.05.06v.02a.12.12 0 010 .07c0 .03-.01.05-.05.09l-45.02 45.02a.2.2 0 01-.09.05.12.12 0 01-.07 0c-.02 0-.04-.01-.08-.05L512 557.25 384.14 685.12c-.04.04-.06.05-.08.05a.12.12 0 01-.07 0c-.03 0-.05-.01-.09-.05l-45.02-45.02a.2.2 0 01-.05-.09.12.12 0 010-.07c0-.02.01-.04.06-.08L466.75 512 338.88 384.14a.27.27 0 01-.05-.06l-.01-.02a.12.12 0 010-.07c0-.03.01-.05.05-.09l45.02-45.02a.2.2 0 01.09-.05.12.12 0 01.07 0c.02 0 .04.01.08.06L512 466.75l127.86-127.86c.04-.05.06-.06.08-.06a.12.12 0 01.07 0z"}}]},name:"close-circle",theme:"outlined"};var a=e.i(9583),n=o.forwardRef(function(e,n){return o.createElement(a.default,(0,t.default)({},e,{ref:n,icon:i}))});e.s(["CloseCircleOutlined",0,n],518617)},245704,e=>{"use strict";e.i(247167);var t=e.i(931067),o=e.i(271645);let i={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M699 353h-46.9c-10.2 0-19.9 4.9-25.9 13.3L469 584.3l-71.2-98.8c-6-8.3-15.6-13.3-25.9-13.3H325c-6.5 0-10.3 7.4-6.5 12.7l124.6 172.8a31.8 31.8 0 0051.7 0l210.6-292c3.9-5.3.1-12.7-6.4-12.7z"}},{tag:"path",attrs:{d:"M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z"}}]},name:"check-circle",theme:"outlined"};var a=e.i(9583),n=o.forwardRef(function(e,n){return o.createElement(a.default,(0,t.default)({},e,{ref:n,icon:i}))});e.s(["CheckCircleOutlined",0,n],245704)},245094,e=>{"use strict";e.i(247167);var t=e.i(931067),o=e.i(271645);let i={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M516 673c0 4.4 3.4 8 7.5 8h185c4.1 0 7.5-3.6 7.5-8v-48c0-4.4-3.4-8-7.5-8h-185c-4.1 0-7.5 3.6-7.5 8v48zm-194.9 6.1l192-161c3.8-3.2 3.8-9.1 0-12.3l-192-160.9A7.95 7.95 0 00308 351v62.7c0 2.4 1 4.6 2.9 6.1L420.7 512l-109.8 92.2a8.1 8.1 0 00-2.9 6.1V673c0 6.8 7.9 10.5 13.1 6.1zM880 112H144c-17.7 0-32 14.3-32 32v736c0 17.7 14.3 32 32 32h736c17.7 0 32-14.3 32-32V144c0-17.7-14.3-32-32-32zm-40 728H184V184h656v656z"}}]},name:"code",theme:"outlined"};var a=e.i(9583),n=o.forwardRef(function(e,n){return o.createElement(a.default,(0,t.default)({},e,{ref:n,icon:i}))});e.s(["CodeOutlined",0,n],245094)},891547,e=>{"use strict";var t=e.i(843476),o=e.i(271645),i=e.i(199133),a=e.i(764205);e.s(["default",0,({onChange:e,value:n,className:r,accessToken:s,disabled:l})=>{let[c,d]=(0,o.useState)([]),[p,m]=(0,o.useState)(!1);return(0,o.useEffect)(()=>{(async()=>{if(s){m(!0);try{let e=await (0,a.getGuardrailsList)(s);console.log("Guardrails response:",e),e.guardrails&&(console.log("Guardrails data:",e.guardrails),d(e.guardrails))}catch(e){console.error("Error fetching guardrails:",e)}finally{m(!1)}}})()},[s]),(0,t.jsx)("div",{children:(0,t.jsx)(i.Select,{mode:"multiple",disabled:l,placeholder:l?"Setting guardrails is a premium feature.":"Select guardrails",onChange:t=>{console.log("Selected guardrails:",t),e(t)},value:n,loading:p,className:r,allowClear:!0,options:c.map(e=>(console.log("Mapping guardrail:",e),{label:`${e.guardrail_name}`,value:e.guardrail_name})),optionFilterProp:"label",showSearch:!0,style:{width:"100%"}})})}])},921511,e=>{"use strict";var t=e.i(843476),o=e.i(271645),i=e.i(199133),a=e.i(764205);function n(e){return e.filter(e=>(e.version_status??"draft")!=="draft").map(e=>{var t;let o=e.version_number??1,i=e.version_status??"draft";return{label:`${e.policy_name} — v${o} (${i})${e.description?` — ${e.description}`:""}`,value:"production"===i?e.policy_name:e.policy_id?(t=e.policy_id,`policy_${t}`):e.policy_name}})}e.s(["default",0,({onChange:e,value:r,className:s,accessToken:l,disabled:c,onPoliciesLoaded:d})=>{let[p,m]=(0,o.useState)([]),[u,f]=(0,o.useState)(!1);return(0,o.useEffect)(()=>{(async()=>{if(l){f(!0);try{let e=await (0,a.getPoliciesList)(l);e.policies&&(m(e.policies),d?.(e.policies))}catch(e){console.error("Error fetching policies:",e)}finally{f(!1)}}})()},[l,d]),(0,t.jsx)("div",{children:(0,t.jsx)(i.Select,{mode:"multiple",disabled:c,placeholder:c?"Setting policies is a premium feature.":"Select policies (production or published versions)",onChange:t=>{e(t)},value:r,loading:u,className:s,allowClear:!0,options:n(p),optionFilterProp:"label",showSearch:!0,style:{width:"100%"}})})},"getPolicyOptionEntries",()=>n])},689020,e=>{"use strict";var t=e.i(764205);let o=async e=>{try{let o=await (0,t.modelHubCall)(e);if(console.log("model_info:",o),o?.data.length>0){let e=o.data.map(e=>({model_group:e.model_group,mode:e?.mode}));return e.sort((e,t)=>e.model_group.localeCompare(t.model_group)),e}return[]}catch(e){throw console.error("Error fetching model info:",e),e}};e.s(["fetchAvailableModels",0,o])},737434,e=>{"use strict";var t=e.i(184163);e.s(["DownloadOutlined",()=>t.default])},916940,e=>{"use strict";var t=e.i(843476),o=e.i(271645),i=e.i(199133),a=e.i(764205);e.s(["default",0,({onChange:e,value:n,className:r,accessToken:s,placeholder:l="Select vector stores",disabled:c=!1})=>{let[d,p]=(0,o.useState)([]),[m,u]=(0,o.useState)(!1);return(0,o.useEffect)(()=>{(async()=>{if(s){u(!0);try{let e=await (0,a.vectorStoreListCall)(s);e.data&&p(e.data)}catch(e){console.error("Error fetching vector stores:",e)}finally{u(!1)}}})()},[s]),(0,t.jsx)("div",{children:(0,t.jsx)(i.Select,{mode:"multiple",placeholder:l,onChange:e,value:n,loading:m,className:r,allowClear:!0,options:d.map(e=>({label:`${e.vector_store_name||e.vector_store_id} (${e.vector_store_id})`,value:e.vector_store_id,title:e.vector_store_description||e.vector_store_id})),optionFilterProp:"label",showSearch:!0,style:{width:"100%"},disabled:c})})}])},447566,e=>{"use strict";e.i(247167);var t=e.i(931067),o=e.i(271645);let i={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M872 474H286.9l350.2-304c5.6-4.9 2.2-14-5.2-14h-88.5c-3.9 0-7.6 1.4-10.5 3.9L155 487.8a31.96 31.96 0 000 48.3L535.1 866c1.5 1.3 3.3 2 5.2 2h91.5c7.4 0 10.8-9.2 5.2-14L286.9 550H872c4.4 0 8-3.6 8-8v-60c0-4.4-3.6-8-8-8z"}}]},name:"arrow-left",theme:"outlined"};var a=e.i(9583),n=o.forwardRef(function(e,n){return o.createElement(a.default,(0,t.default)({},e,{ref:n,icon:i}))});e.s(["ArrowLeftOutlined",0,n],447566)},637235,e=>{"use strict";e.i(247167);var t=e.i(931067),o=e.i(271645);let i={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z"}},{tag:"path",attrs:{d:"M686.7 638.6L544.1 535.5V288c0-4.4-3.6-8-8-8H488c-4.4 0-8 3.6-8 8v275.4c0 2.6 1.2 5 3.3 6.5l165.4 120.6c3.6 2.6 8.6 1.8 11.2-1.7l28.6-39c2.6-3.7 1.8-8.7-1.8-11.2z"}}]},name:"clock-circle",theme:"outlined"};var a=e.i(9583),n=o.forwardRef(function(e,n){return o.createElement(a.default,(0,t.default)({},e,{ref:n,icon:i}))});e.s(["ClockCircleOutlined",0,n],637235)},782273,793916,e=>{"use strict";e.i(247167);var t=e.i(931067),o=e.i(271645);let i={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M625.9 115c-5.9 0-11.9 1.6-17.4 5.3L254 352H90c-8.8 0-16 7.2-16 16v288c0 8.8 7.2 16 16 16h164l354.5 231.7c5.5 3.6 11.6 5.3 17.4 5.3 16.7 0 32.1-13.3 32.1-32.1V147.1c0-18.8-15.4-32.1-32.1-32.1zM586 803L293.4 611.7l-18-11.7H146V424h129.4l17.9-11.7L586 221v582zm348-327H806c-8.8 0-16 7.2-16 16v40c0 8.8 7.2 16 16 16h128c8.8 0 16-7.2 16-16v-40c0-8.8-7.2-16-16-16zm-41.9 261.8l-110.3-63.7a15.9 15.9 0 00-21.7 5.9l-19.9 34.5c-4.4 7.6-1.8 17.4 5.8 21.8L856.3 800a15.9 15.9 0 0021.7-5.9l19.9-34.5c4.4-7.6 1.7-17.4-5.8-21.8zM760 344a15.9 15.9 0 0021.7 5.9L892 286.2c7.6-4.4 10.2-14.2 5.8-21.8L878 230a15.9 15.9 0 00-21.7-5.9L746 287.8a15.99 15.99 0 00-5.8 21.8L760 344z"}}]},name:"sound",theme:"outlined"};var a=e.i(9583),n=o.forwardRef(function(e,n){return o.createElement(a.default,(0,t.default)({},e,{ref:n,icon:i}))});e.s(["SoundOutlined",0,n],782273);let r={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M842 454c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8 0 140.3-113.7 254-254 254S258 594.3 258 454c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8 0 168.7 126.6 307.9 290 327.6V884H326.7c-13.7 0-24.7 14.3-24.7 32v36c0 4.4 2.8 8 6.2 8h407.6c3.4 0 6.2-3.6 6.2-8v-36c0-17.7-11-32-24.7-32H548V782.1c165.3-18 294-158 294-328.1zM512 624c93.9 0 170-75.2 170-168V232c0-92.8-76.1-168-170-168s-170 75.2-170 168v224c0 92.8 76.1 168 170 168zm-94-392c0-50.6 41.9-92 94-92s94 41.4 94 92v224c0 50.6-41.9 92-94 92s-94-41.4-94-92V232z"}}]},name:"audio",theme:"outlined"};var s=o.forwardRef(function(e,i){return o.createElement(a.default,(0,t.default)({},e,{ref:i,icon:r}))});e.s(["AudioOutlined",0,s],793916)},149192,e=>{"use strict";var t=e.i(864517);e.s(["CloseOutlined",()=>t.default])},492030,e=>{"use strict";var t=e.i(121229);e.s(["CheckOutlined",()=>t.default])},458505,e=>{"use strict";e.i(247167);var t=e.i(931067),o=e.i(271645);let i={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372zm47.7-395.2l-25.4-5.9V348.6c38 5.2 61.5 29 65.5 58.2.5 4 3.9 6.9 7.9 6.9h44.9c4.7 0 8.4-4.1 8-8.8-6.1-62.3-57.4-102.3-125.9-109.2V263c0-4.4-3.6-8-8-8h-28.1c-4.4 0-8 3.6-8 8v33c-70.8 6.9-126.2 46-126.2 119 0 67.6 49.8 100.2 102.1 112.7l24.7 6.3v142.7c-44.2-5.9-69-29.5-74.1-61.3-.6-3.8-4-6.6-7.9-6.6H363c-4.7 0-8.4 4-8 8.7 4.5 55 46.2 105.6 135.2 112.1V761c0 4.4 3.6 8 8 8h28.4c4.4 0 8-3.6 8-8.1l-.2-31.7c78.3-6.9 134.3-48.8 134.3-124-.1-69.4-44.2-100.4-109-116.4zm-68.6-16.2c-5.6-1.6-10.3-3.1-15-5-33.8-12.2-49.5-31.9-49.5-57.3 0-36.3 27.5-57 64.5-61.7v124zM534.3 677V543.3c3.1.9 5.9 1.6 8.8 2.2 47.3 14.4 63.2 34.4 63.2 65.1 0 39.1-29.4 62.6-72 66.4z"}}]},name:"dollar",theme:"outlined"};var a=e.i(9583),n=o.forwardRef(function(e,n){return o.createElement(a.default,(0,t.default)({},e,{ref:n,icon:i}))});e.s(["DollarOutlined",0,n],458505)},611052,e=>{"use strict";var t=e.i(843476),o=e.i(271645),i=e.i(212931),a=e.i(311451),n=e.i(790848),r=e.i(888259),s=e.i(438957);e.i(247167);var l=e.i(931067);let c={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M832 464h-68V240c0-70.7-57.3-128-128-128H388c-70.7 0-128 57.3-128 128v224h-68c-17.7 0-32 14.3-32 32v384c0 17.7 14.3 32 32 32h640c17.7 0 32-14.3 32-32V496c0-17.7-14.3-32-32-32zM332 240c0-30.9 25.1-56 56-56h248c30.9 0 56 25.1 56 56v224H332V240zm460 600H232V536h560v304zM484 701v53c0 4.4 3.6 8 8 8h40c4.4 0 8-3.6 8-8v-53a48.01 48.01 0 10-56 0z"}}]},name:"lock",theme:"outlined"};var d=e.i(9583),p=o.forwardRef(function(e,t){return o.createElement(d.default,(0,l.default)({},e,{ref:t,icon:c}))}),m=e.i(492030),u=e.i(266537),f=e.i(447566),g=e.i(149192),h=e.i(596239);e.s(["ByokCredentialModal",0,({server:e,open:l,onClose:c,onSuccess:d,accessToken:_})=>{let[b,x]=(0,o.useState)(1),[v,y]=(0,o.useState)(""),[j,w]=(0,o.useState)(!0),[S,k]=(0,o.useState)(!1),C=e.alias||e.server_name||"Service",N=C.charAt(0).toUpperCase(),O=()=>{x(1),y(""),w(!0),k(!1),c()},z=async()=>{if(!v.trim())return void r.default.error("Please enter your API key");k(!0);try{let t=await fetch(`/v1/mcp/server/${e.server_id}/user-credential`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${_}`},body:JSON.stringify({credential:v.trim(),save:j})});if(!t.ok){let e=await t.json();throw Error(e?.detail?.error||"Failed to save credential")}r.default.success(`Connected to ${C}`),d(e.server_id),O()}catch(e){r.default.error(e.message||"Failed to connect")}finally{k(!1)}};return(0,t.jsx)(i.Modal,{open:l,onCancel:O,footer:null,width:480,closeIcon:null,className:"byok-modal",children:(0,t.jsxs)("div",{className:"relative p-2",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between mb-6",children:[2===b?(0,t.jsxs)("button",{onClick:()=>x(1),className:"flex items-center gap-1 text-gray-500 hover:text-gray-800 text-sm",children:[(0,t.jsx)(f.ArrowLeftOutlined,{})," Back"]}):(0,t.jsx)("div",{}),(0,t.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,t.jsx)("div",{className:`w-2 h-2 rounded-full ${1===b?"bg-blue-500":"bg-gray-300"}`}),(0,t.jsx)("div",{className:`w-2 h-2 rounded-full ${2===b?"bg-blue-500":"bg-gray-300"}`})]}),(0,t.jsx)("button",{onClick:O,className:"text-gray-400 hover:text-gray-600",children:(0,t.jsx)(g.CloseOutlined,{})})]}),1===b?(0,t.jsxs)("div",{className:"text-center",children:[(0,t.jsxs)("div",{className:"flex items-center justify-center gap-3 mb-6",children:[(0,t.jsx)("div",{className:"w-14 h-14 rounded-xl bg-gradient-to-br from-teal-400 to-cyan-600 flex items-center justify-center text-white font-bold text-xl shadow",children:"L"}),(0,t.jsx)(u.ArrowRightOutlined,{className:"text-gray-400 text-lg"}),(0,t.jsx)("div",{className:"w-14 h-14 rounded-xl bg-gradient-to-br from-blue-600 to-indigo-800 flex items-center justify-center text-white font-bold text-xl shadow",children:N})]}),(0,t.jsxs)("h2",{className:"text-2xl font-bold text-gray-900 mb-2",children:["Connect ",C]}),(0,t.jsxs)("p",{className:"text-gray-500 mb-6",children:["LiteLLM needs access to ",C," to complete your request."]}),(0,t.jsx)("div",{className:"bg-gray-50 rounded-xl p-4 text-left mb-4",children:(0,t.jsxs)("div",{className:"flex items-start gap-3",children:[(0,t.jsx)("div",{className:"mt-0.5",children:(0,t.jsxs)("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",className:"text-gray-500",children:[(0,t.jsx)("rect",{x:"2",y:"4",width:"20",height:"16",rx:"2",stroke:"currentColor",strokeWidth:"2"}),(0,t.jsx)("path",{d:"M8 4v16M16 4v16",stroke:"currentColor",strokeWidth:"2"})]})}),(0,t.jsxs)("div",{children:[(0,t.jsx)("p",{className:"font-semibold text-gray-800 mb-1",children:"How it works"}),(0,t.jsxs)("p",{className:"text-gray-500 text-sm",children:["LiteLLM acts as a secure bridge. Your requests are routed through our MCP client directly to"," ",C,"'s API."]})]})]})}),e.byok_description&&e.byok_description.length>0&&(0,t.jsxs)("div",{className:"bg-gray-50 rounded-xl p-4 text-left mb-6",children:[(0,t.jsxs)("p",{className:"text-xs font-semibold text-gray-500 uppercase tracking-widest mb-3 flex items-center gap-2",children:[(0,t.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",className:"text-green-500",children:[(0,t.jsx)("path",{d:"M12 2L12 22M2 12L22 12",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"}),(0,t.jsx)("circle",{cx:"12",cy:"12",r:"9",stroke:"currentColor",strokeWidth:"2"})]}),"Requested Access"]}),(0,t.jsx)("ul",{className:"space-y-2",children:e.byok_description.map((e,o)=>(0,t.jsxs)("li",{className:"flex items-center gap-2 text-sm text-gray-700",children:[(0,t.jsx)(m.CheckOutlined,{className:"text-green-500 flex-shrink-0"}),e]},o))})]}),(0,t.jsxs)("button",{onClick:()=>x(2),className:"w-full bg-gray-900 hover:bg-gray-700 text-white font-medium py-3 px-6 rounded-xl flex items-center justify-center gap-2 transition-colors",children:["Continue to Authentication ",(0,t.jsx)(u.ArrowRightOutlined,{})]}),(0,t.jsx)("button",{onClick:O,className:"mt-3 w-full text-gray-400 hover:text-gray-600 text-sm py-2",children:"Cancel"})]}):(0,t.jsxs)("div",{children:[(0,t.jsx)("div",{className:"w-12 h-12 rounded-full bg-blue-50 flex items-center justify-center mb-4",children:(0,t.jsx)(s.KeyOutlined,{className:"text-blue-400 text-xl"})}),(0,t.jsx)("h2",{className:"text-2xl font-bold text-gray-900 mb-2",children:"Provide API Key"}),(0,t.jsxs)("p",{className:"text-gray-500 mb-6",children:["Enter your ",C," API key to authorize this connection."]}),(0,t.jsxs)("div",{className:"mb-4",children:[(0,t.jsxs)("label",{className:"block text-sm font-semibold text-gray-800 mb-2",children:[C," API Key"]}),(0,t.jsx)(a.Input.Password,{placeholder:"Enter your API key",value:v,onChange:e=>y(e.target.value),size:"large",className:"rounded-lg"}),e.byok_api_key_help_url&&(0,t.jsxs)("a",{href:e.byok_api_key_help_url,target:"_blank",rel:"noopener noreferrer",className:"text-blue-500 hover:text-blue-700 text-sm mt-2 flex items-center gap-1",children:["Where do I find my API key? ",(0,t.jsx)(h.LinkOutlined,{})]})]}),(0,t.jsxs)("div",{className:"bg-gray-50 rounded-xl p-4 flex items-center justify-between mb-4",children:[(0,t.jsxs)("div",{className:"flex items-center gap-3",children:[(0,t.jsx)("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",className:"text-gray-500",children:(0,t.jsx)("path",{d:"M12 2C8.13 2 5 5.13 5 9c0 5.25 7 13 7 13s7-7.75 7-13c0-3.87-3.13-7-7-7zm0 9.5c-1.38 0-2.5-1.12-2.5-2.5s1.12-2.5 2.5-2.5 2.5 1.12 2.5 2.5-1.12 2.5-2.5 2.5z",fill:"currentColor"})}),(0,t.jsx)("span",{className:"text-sm font-medium text-gray-800",children:"Save key for future use"})]}),(0,t.jsx)(n.Switch,{checked:j,onChange:w})]}),(0,t.jsxs)("div",{className:"bg-blue-50 rounded-xl p-4 flex items-start gap-3 mb-6",children:[(0,t.jsx)(p,{className:"text-blue-400 mt-0.5 flex-shrink-0"}),(0,t.jsx)("p",{className:"text-sm text-blue-700",children:"Your key is stored securely and transmitted over HTTPS. It is never shared with third parties."})]}),(0,t.jsxs)("button",{onClick:z,disabled:S,className:"w-full bg-blue-500 hover:bg-blue-600 disabled:opacity-60 text-white font-medium py-3 px-6 rounded-xl flex items-center justify-center gap-2 transition-colors",children:[(0,t.jsx)(p,{})," Connect & Authorize"]})]})]})})}],611052)},829672,836938,310730,e=>{"use strict";e.i(247167);var t=e.i(271645),o=e.i(343794),i=e.i(914949),a=e.i(404948);let n=e=>e?"function"==typeof e?e():e:null;e.s(["getRenderPropValue",0,n],836938);var r=e.i(613541),s=e.i(763731),l=e.i(242064),c=e.i(491816);e.i(793154);var d=e.i(880476),p=e.i(183293),m=e.i(717356),u=e.i(320560),f=e.i(307358),g=e.i(246422),h=e.i(838378),_=e.i(617933);let b=(0,g.genStyleHooks)("Popover",e=>{let{colorBgElevated:t,colorText:o}=e,i=(0,h.mergeToken)(e,{popoverBg:t,popoverColor:o});return[(e=>{let{componentCls:t,popoverColor:o,titleMinWidth:i,fontWeightStrong:a,innerPadding:n,boxShadowSecondary:r,colorTextHeading:s,borderRadiusLG:l,zIndexPopup:c,titleMarginBottom:d,colorBgElevated:m,popoverBg:f,titleBorderBottom:g,innerContentPadding:h,titlePadding:_}=e;return[{[t]:Object.assign(Object.assign({},(0,p.resetComponent)(e)),{position:"absolute",top:0,left:{_skip_check_:!0,value:0},zIndex:c,fontWeight:"normal",whiteSpace:"normal",textAlign:"start",cursor:"auto",userSelect:"text","--valid-offset-x":"var(--arrow-offset-horizontal, var(--arrow-x))",transformOrigin:"var(--valid-offset-x, 50%) var(--arrow-y, 50%)","--antd-arrow-background-color":m,width:"max-content",maxWidth:"100vw","&-rtl":{direction:"rtl"},"&-hidden":{display:"none"},[`${t}-content`]:{position:"relative"},[`${t}-inner`]:{backgroundColor:f,backgroundClip:"padding-box",borderRadius:l,boxShadow:r,padding:n},[`${t}-title`]:{minWidth:i,marginBottom:d,color:s,fontWeight:a,borderBottom:g,padding:_},[`${t}-inner-content`]:{color:o,padding:h}})},(0,u.default)(e,"var(--antd-arrow-background-color)"),{[`${t}-pure`]:{position:"relative",maxWidth:"none",margin:e.sizePopupArrow,display:"inline-block",[`${t}-content`]:{display:"inline-block"}}}]})(i),(e=>{let{componentCls:t}=e;return{[t]:_.PresetColors.map(o=>{let i=e[`${o}6`];return{[`&${t}-${o}`]:{"--antd-arrow-background-color":i,[`${t}-inner`]:{backgroundColor:i},[`${t}-arrow`]:{background:"transparent"}}}})}})(i),(0,m.initZoomMotion)(i,"zoom-big")]},e=>{let{lineWidth:t,controlHeight:o,fontHeight:i,padding:a,wireframe:n,zIndexPopupBase:r,borderRadiusLG:s,marginXS:l,lineType:c,colorSplit:d,paddingSM:p}=e,m=o-i;return Object.assign(Object.assign(Object.assign({titleMinWidth:177,zIndexPopup:r+30},(0,f.getArrowToken)(e)),(0,u.getArrowOffsetToken)({contentRadius:s,limitVerticalRadius:!0})),{innerPadding:12*!n,titleMarginBottom:n?0:l,titlePadding:n?`${m/2}px ${a}px ${m/2-t}px`:0,titleBorderBottom:n?`${t}px ${c} ${d}`:"none",innerContentPadding:n?`${p}px ${a}px`:0})},{resetStyle:!1,deprecatedTokens:[["width","titleMinWidth"],["minWidth","titleMinWidth"]]});var x=function(e,t){var o={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&0>t.indexOf(i)&&(o[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var a=0,i=Object.getOwnPropertySymbols(e);at.indexOf(i[a])&&Object.prototype.propertyIsEnumerable.call(e,i[a])&&(o[i[a]]=e[i[a]]);return o};let v=({title:e,content:o,prefixCls:i})=>e||o?t.createElement(t.Fragment,null,e&&t.createElement("div",{className:`${i}-title`},e),o&&t.createElement("div",{className:`${i}-inner-content`},o)):null,y=e=>{let{hashId:i,prefixCls:a,className:r,style:s,placement:l="top",title:c,content:p,children:m}=e,u=n(c),f=n(p),g=(0,o.default)(i,a,`${a}-pure`,`${a}-placement-${l}`,r);return t.createElement("div",{className:g,style:s},t.createElement("div",{className:`${a}-arrow`}),t.createElement(d.Popup,Object.assign({},e,{className:i,prefixCls:a}),m||t.createElement(v,{prefixCls:a,title:u,content:f})))},j=e=>{let{prefixCls:i,className:a}=e,n=x(e,["prefixCls","className"]),{getPrefixCls:r}=t.useContext(l.ConfigContext),s=r("popover",i),[c,d,p]=b(s);return c(t.createElement(y,Object.assign({},n,{prefixCls:s,hashId:d,className:(0,o.default)(a,p)})))};e.s(["Overlay",0,v,"default",0,j],310730);var w=function(e,t){var o={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&0>t.indexOf(i)&&(o[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var a=0,i=Object.getOwnPropertySymbols(e);at.indexOf(i[a])&&Object.prototype.propertyIsEnumerable.call(e,i[a])&&(o[i[a]]=e[i[a]]);return o};let S=t.forwardRef((e,d)=>{var p,m;let{prefixCls:u,title:f,content:g,overlayClassName:h,placement:_="top",trigger:x="hover",children:y,mouseEnterDelay:j=.1,mouseLeaveDelay:S=.1,onOpenChange:k,overlayStyle:C={},styles:N,classNames:O}=e,z=w(e,["prefixCls","title","content","overlayClassName","placement","trigger","children","mouseEnterDelay","mouseLeaveDelay","onOpenChange","overlayStyle","styles","classNames"]),{getPrefixCls:E,className:I,style:R,classNames:T,styles:M}=(0,l.useComponentConfig)("popover"),A=E("popover",u),[$,P,L]=b(A),H=E(),F=(0,o.default)(h,P,L,I,T.root,null==O?void 0:O.root),B=(0,o.default)(T.body,null==O?void 0:O.body),[D,V]=(0,i.default)(!1,{value:null!=(p=e.open)?p:e.visible,defaultValue:null!=(m=e.defaultOpen)?m:e.defaultVisible}),q=(e,t)=>{V(e,!0),null==k||k(e,t)},U=n(f),W=n(g);return $(t.createElement(c.default,Object.assign({placement:_,trigger:x,mouseEnterDelay:j,mouseLeaveDelay:S},z,{prefixCls:A,classNames:{root:F,body:B},styles:{root:Object.assign(Object.assign(Object.assign(Object.assign({},M.root),R),C),null==N?void 0:N.root),body:Object.assign(Object.assign({},M.body),null==N?void 0:N.body)},ref:d,open:D,onOpenChange:e=>{q(e)},overlay:U||W?t.createElement(v,{prefixCls:A,title:U,content:W}):null,transitionName:(0,r.getTransitionName)(H,"zoom-big",z.transitionName),"data-popover-inject":!0}),(0,s.cloneElement)(y,{onKeyDown:e=>{var o,i;(0,t.isValidElement)(y)&&(null==(i=null==y?void 0:(o=y.props).onKeyDown)||i.call(o,e)),e.keyCode===a.default.ESC&&q(!1,e)}})))});S._InternalPanelDoNotUseOrYouWillBeFired=j,e.s(["default",0,S],829672)},282786,e=>{"use strict";var t=e.i(829672);e.s(["Popover",()=>t.default])},219470,812618,e=>{"use strict";e.s(["coy",0,{'code[class*="language-"]':{color:"black",background:"none",fontFamily:"Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace",fontSize:"1em",textAlign:"left",whiteSpace:"pre",wordSpacing:"normal",wordBreak:"normal",wordWrap:"normal",lineHeight:"1.5",MozTabSize:"4",OTabSize:"4",tabSize:"4",WebkitHyphens:"none",MozHyphens:"none",msHyphens:"none",hyphens:"none",maxHeight:"inherit",height:"inherit",padding:"0 1em",display:"block",overflow:"auto"},'pre[class*="language-"]':{color:"black",background:"none",fontFamily:"Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace",fontSize:"1em",textAlign:"left",whiteSpace:"pre",wordSpacing:"normal",wordBreak:"normal",wordWrap:"normal",lineHeight:"1.5",MozTabSize:"4",OTabSize:"4",tabSize:"4",WebkitHyphens:"none",MozHyphens:"none",msHyphens:"none",hyphens:"none",position:"relative",margin:".5em 0",overflow:"visible",padding:"1px",backgroundColor:"#fdfdfd",WebkitBoxSizing:"border-box",MozBoxSizing:"border-box",boxSizing:"border-box",marginBottom:"1em"},'pre[class*="language-"] > code':{position:"relative",zIndex:"1",borderLeft:"10px solid #358ccb",boxShadow:"-1px 0px 0px 0px #358ccb, 0px 0px 0px 1px #dfdfdf",backgroundColor:"#fdfdfd",backgroundImage:"linear-gradient(transparent 50%, rgba(69, 142, 209, 0.04) 50%)",backgroundSize:"3em 3em",backgroundOrigin:"content-box",backgroundAttachment:"local"},':not(pre) > code[class*="language-"]':{backgroundColor:"#fdfdfd",WebkitBoxSizing:"border-box",MozBoxSizing:"border-box",boxSizing:"border-box",marginBottom:"1em",position:"relative",padding:".2em",borderRadius:"0.3em",color:"#c92c2c",border:"1px solid rgba(0, 0, 0, 0.1)",display:"inline",whiteSpace:"normal"},'pre[class*="language-"]:before':{content:"''",display:"block",position:"absolute",bottom:"0.75em",left:"0.18em",width:"40%",height:"20%",maxHeight:"13em",boxShadow:"0px 13px 8px #979797",WebkitTransform:"rotate(-2deg)",MozTransform:"rotate(-2deg)",msTransform:"rotate(-2deg)",OTransform:"rotate(-2deg)",transform:"rotate(-2deg)"},'pre[class*="language-"]:after':{content:"''",display:"block",position:"absolute",bottom:"0.75em",left:"auto",width:"40%",height:"20%",maxHeight:"13em",boxShadow:"0px 13px 8px #979797",WebkitTransform:"rotate(2deg)",MozTransform:"rotate(2deg)",msTransform:"rotate(2deg)",OTransform:"rotate(2deg)",transform:"rotate(2deg)",right:"0.75em"},comment:{color:"#7D8B99"},"block-comment":{color:"#7D8B99"},prolog:{color:"#7D8B99"},doctype:{color:"#7D8B99"},cdata:{color:"#7D8B99"},punctuation:{color:"#5F6364"},property:{color:"#c92c2c"},tag:{color:"#c92c2c"},boolean:{color:"#c92c2c"},number:{color:"#c92c2c"},"function-name":{color:"#c92c2c"},constant:{color:"#c92c2c"},symbol:{color:"#c92c2c"},deleted:{color:"#c92c2c"},selector:{color:"#2f9c0a"},"attr-name":{color:"#2f9c0a"},string:{color:"#2f9c0a"},char:{color:"#2f9c0a"},function:{color:"#2f9c0a"},builtin:{color:"#2f9c0a"},inserted:{color:"#2f9c0a"},operator:{color:"#a67f59",background:"rgba(255, 255, 255, 0.5)"},entity:{color:"#a67f59",background:"rgba(255, 255, 255, 0.5)",cursor:"help"},url:{color:"#a67f59",background:"rgba(255, 255, 255, 0.5)"},variable:{color:"#a67f59",background:"rgba(255, 255, 255, 0.5)"},atrule:{color:"#1990b8"},"attr-value":{color:"#1990b8"},keyword:{color:"#1990b8"},"class-name":{color:"#1990b8"},regex:{color:"#e90"},important:{color:"#e90",fontWeight:"normal"},".language-css .token.string":{color:"#a67f59",background:"rgba(255, 255, 255, 0.5)"},".style .token.string":{color:"#a67f59",background:"rgba(255, 255, 255, 0.5)"},bold:{fontWeight:"bold"},italic:{fontStyle:"italic"},namespace:{Opacity:".7"},'pre[class*="language-"].line-numbers.line-numbers':{paddingLeft:"0"},'pre[class*="language-"].line-numbers.line-numbers code':{paddingLeft:"3.8em"},'pre[class*="language-"].line-numbers.line-numbers .line-numbers-rows':{left:"0"},'pre[class*="language-"][data-line]':{paddingTop:"0",paddingBottom:"0",paddingLeft:"0"},"pre[data-line] code":{position:"relative",paddingLeft:"4em"},"pre .line-highlight":{marginTop:"0"}}],219470),e.i(247167);var t=e.i(931067),o=e.i(271645);let i={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M632 888H392c-4.4 0-8 3.6-8 8v32c0 17.7 14.3 32 32 32h192c17.7 0 32-14.3 32-32v-32c0-4.4-3.6-8-8-8zM512 64c-181.1 0-328 146.9-328 328 0 121.4 66 227.4 164 284.1V792c0 17.7 14.3 32 32 32h264c17.7 0 32-14.3 32-32V676.1c98-56.7 164-162.7 164-284.1 0-181.1-146.9-328-328-328zm127.9 549.8L604 634.6V752H420V634.6l-35.9-20.8C305.4 568.3 256 484.5 256 392c0-141.4 114.6-256 256-256s256 114.6 256 256c0 92.5-49.4 176.3-128.1 221.8z"}}]},name:"bulb",theme:"outlined"};var a=e.i(9583),n=o.forwardRef(function(e,n){return o.createElement(a.default,(0,t.default)({},e,{ref:n,icon:i}))});e.s(["BulbOutlined",0,n],812618)},132104,e=>{"use strict";e.i(247167);var t=e.i(931067),o=e.i(271645);let i={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M868 545.5L536.1 163a31.96 31.96 0 00-48.3 0L156 545.5a7.97 7.97 0 006 13.2h81c4.6 0 9-2 12.1-5.5L474 300.9V864c0 4.4 3.6 8 8 8h60c4.4 0 8-3.6 8-8V300.9l218.9 252.3c3 3.5 7.4 5.5 12.1 5.5h81c6.8 0 10.5-8 6-13.2z"}}]},name:"arrow-up",theme:"outlined"};var a=e.i(9583),n=o.forwardRef(function(e,n){return o.createElement(a.default,(0,t.default)({},e,{ref:n,icon:i}))});e.s(["ArrowUpOutlined",0,n],132104)},447593,989022,e=>{"use strict";e.i(247167);var t=e.i(931067),o=e.i(271645),i={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"defs",attrs:{},children:[{tag:"style",attrs:{}}]},{tag:"path",attrs:{d:"M899.1 869.6l-53-305.6H864c14.4 0 26-11.6 26-26V346c0-14.4-11.6-26-26-26H618V138c0-14.4-11.6-26-26-26H432c-14.4 0-26 11.6-26 26v182H160c-14.4 0-26 11.6-26 26v192c0 14.4 11.6 26 26 26h17.9l-53 305.6a25.95 25.95 0 0025.6 30.4h723c1.5 0 3-.1 4.4-.4a25.88 25.88 0 0021.2-30zM204 390h272V182h72v208h272v104H204V390zm468 440V674c0-4.4-3.6-8-8-8h-48c-4.4 0-8 3.6-8 8v156H416V674c0-4.4-3.6-8-8-8h-48c-4.4 0-8 3.6-8 8v156H202.8l45.1-260H776l45.1 260H672z"}}]},name:"clear",theme:"outlined"},a=e.i(9583),n=o.forwardRef(function(e,n){return o.createElement(a.default,(0,t.default)({},e,{ref:n,icon:i}))});e.s(["ClearOutlined",0,n],447593);var r=e.i(843476),s=e.i(592968),l=e.i(637235);let c={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M872 394c4.4 0 8-3.6 8-8v-60c0-4.4-3.6-8-8-8H708V152c0-4.4-3.6-8-8-8h-64c-4.4 0-8 3.6-8 8v166H400V152c0-4.4-3.6-8-8-8h-64c-4.4 0-8 3.6-8 8v166H152c-4.4 0-8 3.6-8 8v60c0 4.4 3.6 8 8 8h168v236H152c-4.4 0-8 3.6-8 8v60c0 4.4 3.6 8 8 8h168v166c0 4.4 3.6 8 8 8h64c4.4 0 8-3.6 8-8V706h228v166c0 4.4 3.6 8 8 8h64c4.4 0 8-3.6 8-8V706h164c4.4 0 8-3.6 8-8v-60c0-4.4-3.6-8-8-8H708V394h164zM628 630H400V394h228v236z"}}]},name:"number",theme:"outlined"};var d=o.forwardRef(function(e,i){return o.createElement(a.default,(0,t.default)({},e,{ref:i,icon:c}))});let p={icon:{tag:"svg",attrs:{"fill-rule":"evenodd",viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M880 912H144c-17.7 0-32-14.3-32-32V144c0-17.7 14.3-32 32-32h360c4.4 0 8 3.6 8 8v56c0 4.4-3.6 8-8 8H184v656h656V520c0-4.4 3.6-8 8-8h56c4.4 0 8 3.6 8 8v360c0 17.7-14.3 32-32 32zM653.3 424.6l52.2 52.2a8.01 8.01 0 01-4.7 13.6l-179.4 21c-5.1.6-9.5-3.7-8.9-8.9l21-179.4c.8-6.6 8.9-9.4 13.6-4.7l52.4 52.4 256.2-256.2c3.1-3.1 8.2-3.1 11.3 0l42.4 42.4c3.1 3.1 3.1 8.2 0 11.3L653.3 424.6z"}}]},name:"import",theme:"outlined"};var m=o.forwardRef(function(e,i){return o.createElement(a.default,(0,t.default)({},e,{ref:i,icon:p}))}),u=e.i(872934),f=e.i(812618),g=e.i(366308),h=e.i(458505);e.s(["default",0,({timeToFirstToken:e,totalLatency:t,usage:o,toolName:i})=>e||t||o?(0,r.jsxs)("div",{className:"response-metrics mt-2 pt-2 border-t border-gray-100 text-xs text-gray-500 flex flex-wrap gap-3",children:[void 0!==e&&(0,r.jsx)(s.Tooltip,{title:"Time to first token",children:(0,r.jsxs)("div",{className:"flex items-center",children:[(0,r.jsx)(l.ClockCircleOutlined,{className:"mr-1"}),(0,r.jsxs)("span",{children:["TTFT: ",(e/1e3).toFixed(2),"s"]})]})}),void 0!==t&&(0,r.jsx)(s.Tooltip,{title:"Total latency",children:(0,r.jsxs)("div",{className:"flex items-center",children:[(0,r.jsx)(l.ClockCircleOutlined,{className:"mr-1"}),(0,r.jsxs)("span",{children:["Total Latency: ",(t/1e3).toFixed(2),"s"]})]})}),o?.promptTokens!==void 0&&(0,r.jsx)(s.Tooltip,{title:"Prompt tokens",children:(0,r.jsxs)("div",{className:"flex items-center",children:[(0,r.jsx)(m,{className:"mr-1"}),(0,r.jsxs)("span",{children:["In: ",o.promptTokens]})]})}),o?.completionTokens!==void 0&&(0,r.jsx)(s.Tooltip,{title:"Completion tokens",children:(0,r.jsxs)("div",{className:"flex items-center",children:[(0,r.jsx)(u.ExportOutlined,{className:"mr-1"}),(0,r.jsxs)("span",{children:["Out: ",o.completionTokens]})]})}),o?.reasoningTokens!==void 0&&(0,r.jsx)(s.Tooltip,{title:"Reasoning tokens",children:(0,r.jsxs)("div",{className:"flex items-center",children:[(0,r.jsx)(f.BulbOutlined,{className:"mr-1"}),(0,r.jsxs)("span",{children:["Reasoning: ",o.reasoningTokens]})]})}),o?.totalTokens!==void 0&&(0,r.jsx)(s.Tooltip,{title:"Total tokens",children:(0,r.jsxs)("div",{className:"flex items-center",children:[(0,r.jsx)(d,{className:"mr-1"}),(0,r.jsxs)("span",{children:["Total: ",o.totalTokens]})]})}),o?.cost!==void 0&&(0,r.jsx)(s.Tooltip,{title:"Cost",children:(0,r.jsxs)("div",{className:"flex items-center",children:[(0,r.jsx)(h.DollarOutlined,{className:"mr-1"}),(0,r.jsxs)("span",{children:["$",o.cost.toFixed(6)]})]})}),i&&(0,r.jsx)(s.Tooltip,{title:"Tool used",children:(0,r.jsxs)("div",{className:"flex items-center",children:[(0,r.jsx)(g.ToolOutlined,{className:"mr-1"}),(0,r.jsxs)("span",{children:["Tool: ",i]})]})})]}):null],989022)},434166,e=>{"use strict";function t(e,t){window.sessionStorage.setItem(e,btoa(encodeURIComponent(t).replace(/%([0-9A-F]{2})/g,(e,t)=>String.fromCharCode(parseInt(t,16)))))}function o(e){try{let t=window.sessionStorage.getItem(e);if(null===t)return null;return decodeURIComponent(atob(t).split("").map(e=>"%"+e.charCodeAt(0).toString(16).padStart(2,"0")).join(""))}catch{return null}}e.s(["getSecureItem",()=>o,"setSecureItem",()=>t])},596239,e=>{"use strict";e.i(247167);var t=e.i(931067),o=e.i(271645);let i={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M574 665.4a8.03 8.03 0 00-11.3 0L446.5 781.6c-53.8 53.8-144.6 59.5-204 0-59.5-59.5-53.8-150.2 0-204l116.2-116.2c3.1-3.1 3.1-8.2 0-11.3l-39.8-39.8a8.03 8.03 0 00-11.3 0L191.4 526.5c-84.6 84.6-84.6 221.5 0 306s221.5 84.6 306 0l116.2-116.2c3.1-3.1 3.1-8.2 0-11.3L574 665.4zm258.6-474c-84.6-84.6-221.5-84.6-306 0L410.3 307.6a8.03 8.03 0 000 11.3l39.7 39.7c3.1 3.1 8.2 3.1 11.3 0l116.2-116.2c53.8-53.8 144.6-59.5 204 0 59.5 59.5 53.8 150.2 0 204L665.3 562.6a8.03 8.03 0 000 11.3l39.8 39.8c3.1 3.1 8.2 3.1 11.3 0l116.2-116.2c84.5-84.6 84.5-221.5 0-306.1zM610.1 372.3a8.03 8.03 0 00-11.3 0L372.3 598.7a8.03 8.03 0 000 11.3l39.6 39.6c3.1 3.1 8.2 3.1 11.3 0l226.4-226.4c3.1-3.1 3.1-8.2 0-11.3l-39.5-39.6z"}}]},name:"link",theme:"outlined"};var a=e.i(9583),n=o.forwardRef(function(e,n){return o.createElement(a.default,(0,t.default)({},e,{ref:n,icon:i}))});e.s(["LinkOutlined",0,n],596239)},166406,e=>{"use strict";var t=e.i(190144);e.s(["CopyOutlined",()=>t.default])},240647,e=>{"use strict";var t=e.i(286612);e.s(["RightOutlined",()=>t.default])},362024,e=>{"use strict";var t=e.i(988122);e.s(["Collapse",()=>t.default])},516015,(e,t,o)=>{},898547,(e,t,o)=>{var i=e.i(247167);e.r(516015);var a=e.r(271645),n=a&&"object"==typeof a&&"default"in a?a:{default:a},r=void 0!==i.default&&i.default.env&&!0,s=function(e){return"[object String]"===Object.prototype.toString.call(e)},l=function(){function e(e){var t=void 0===e?{}:e,o=t.name,i=void 0===o?"stylesheet":o,a=t.optimizeForSpeed,n=void 0===a?r:a;c(s(i),"`name` must be a string"),this._name=i,this._deletedRulePlaceholder="#"+i+"-deleted-rule____{}",c("boolean"==typeof n,"`optimizeForSpeed` must be a boolean"),this._optimizeForSpeed=n,this._serverSheet=void 0,this._tags=[],this._injected=!1,this._rulesCount=0;var l="u">typeof window&&document.querySelector('meta[property="csp-nonce"]');this._nonce=l?l.getAttribute("content"):null}var t,o=e.prototype;return o.setOptimizeForSpeed=function(e){c("boolean"==typeof e,"`setOptimizeForSpeed` accepts a boolean"),c(0===this._rulesCount,"optimizeForSpeed cannot be when rules have already been inserted"),this.flush(),this._optimizeForSpeed=e,this.inject()},o.isOptimizeForSpeed=function(){return this._optimizeForSpeed},o.inject=function(){var e=this;if(c(!this._injected,"sheet already injected"),this._injected=!0,"u">typeof window&&this._optimizeForSpeed){this._tags[0]=this.makeStyleTag(this._name),this._optimizeForSpeed="insertRule"in this.getSheet(),this._optimizeForSpeed||(r||console.warn("StyleSheet: optimizeForSpeed mode not supported falling back to standard mode."),this.flush(),this._injected=!0);return}this._serverSheet={cssRules:[],insertRule:function(t,o){return"number"==typeof o?e._serverSheet.cssRules[o]={cssText:t}:e._serverSheet.cssRules.push({cssText:t}),o},deleteRule:function(t){e._serverSheet.cssRules[t]=null}}},o.getSheetForTag=function(e){if(e.sheet)return e.sheet;for(var t=0;ttypeof window?this.getSheet():this._serverSheet;if(t.trim()||(t=this._deletedRulePlaceholder),!o.cssRules[e])return e;o.deleteRule(e);try{o.insertRule(t,e)}catch(i){r||console.warn("StyleSheet: illegal rule: \n\n"+t+"\n\nSee https://stackoverflow.com/q/20007992 for more info"),o.insertRule(this._deletedRulePlaceholder,e)}}else{var i=this._tags[e];c(i,"old rule at index `"+e+"` not found"),i.textContent=t}return e},o.deleteRule=function(e){if("u"typeof window?(this._tags.forEach(function(e){return e&&e.parentNode.removeChild(e)}),this._tags=[]):this._serverSheet.cssRules=[]},o.cssRules=function(){var e=this;return"u">>0},p={};function m(e,t){if(!t)return"jsx-"+e;var o=String(t),i=e+o;return p[i]||(p[i]="jsx-"+d(e+"-"+o)),p[i]}function u(e,t){"u"typeof window&&!this._fromServer&&(this._fromServer=this.selectFromServer(),this._instancesCounts=Object.keys(this._fromServer).reduce(function(e,t){return e[t]=0,e},{}));var o=this.getIdAndRules(e),i=o.styleId,a=o.rules;if(i in this._instancesCounts){this._instancesCounts[i]+=1;return}var n=a.map(function(e){return t._sheet.insertRule(e)}).filter(function(e){return -1!==e});this._indices[i]=n,this._instancesCounts[i]=1},t.remove=function(e){var t=this,o=this.getIdAndRules(e).styleId;if(function(e,t){if(!e)throw Error("StyleSheetRegistry: "+t+".")}(o in this._instancesCounts,"styleId: `"+o+"` not found"),this._instancesCounts[o]-=1,this._instancesCounts[o]<1){var i=this._fromServer&&this._fromServer[o];i?(i.parentNode.removeChild(i),delete this._fromServer[o]):(this._indices[o].forEach(function(e){return t._sheet.deleteRule(e)}),delete this._indices[o]),delete this._instancesCounts[o]}},t.update=function(e,t){this.add(t),this.remove(e)},t.flush=function(){this._sheet.flush(),this._sheet.inject(),this._fromServer=void 0,this._indices={},this._instancesCounts={}},t.cssRules=function(){var e=this,t=this._fromServer?Object.keys(this._fromServer).map(function(t){return[t,e._fromServer[t]]}):[],o=this._sheet.cssRules();return t.concat(Object.keys(this._indices).map(function(t){return[t,e._indices[t].map(function(e){return o[e].cssText}).join(e._optimizeForSpeed?"":"\n")]}).filter(function(e){return!!e[1]}))},t.styles=function(e){var t,o;return t=this.cssRules(),void 0===(o=e)&&(o={}),t.map(function(e){var t=e[0],i=e[1];return n.default.createElement("style",{id:"__"+t,key:"__"+t,nonce:o.nonce?o.nonce:void 0,dangerouslySetInnerHTML:{__html:i}})})},t.getIdAndRules=function(e){var t=e.children,o=e.dynamic,i=e.id;if(o){var a=m(i,o);return{styleId:a,rules:Array.isArray(t)?t.map(function(e){return u(a,e)}):[u(a,t)]}}return{styleId:m(i),rules:Array.isArray(t)?t:[t]}},t.selectFromServer=function(){return Array.prototype.slice.call(document.querySelectorAll('[id^="__jsx-"]')).reduce(function(e,t){return e[t.id.slice(2)]=t,e},{})},e}(),g=a.createContext(null);function h(){return new f}function _(){return a.useContext(g)}g.displayName="StyleSheetContext";var b=n.default.useInsertionEffect||n.default.useLayoutEffect,x="u">typeof window?h():void 0;function v(e){var t=x||_();return t&&("u"{t.exports=e.r(898547).style},254530,452598,e=>{"use strict";e.i(247167);var t=e.i(356449),o=e.i(764205);async function i(e,i,a,n,r,s,l,c,d,p,m,u,f,g,h,_,b,x,v,y,j,w,S,k,C){console.log=function(){},console.log("isLocal:",!1);let N=y||(0,o.getProxyBaseUrl)(),O={};r&&r.length>0&&(O["x-litellm-tags"]=r.join(","));let z=new t.default.OpenAI({apiKey:n,baseURL:N,dangerouslyAllowBrowser:!0,defaultHeaders:O});try{let t,o=Date.now(),n=!1,r={},y=!1,N=[];for await(let v of(g&&g.length>0&&(g.includes("__all__")?N.push({type:"mcp",server_label:"litellm",server_url:"litellm_proxy/mcp",require_approval:"never"}):g.forEach(e=>{if(e.startsWith("toolset:")){let t=e.slice(8),o=C?.find(e=>e.toolset_id===t),i=o?.toolset_name||t;N.push({type:"mcp",server_label:i,server_url:`litellm_proxy/mcp/${encodeURIComponent(i)}`,require_approval:"never"})}else{let t=j?.find(t=>t.server_id===e),o=t?.alias||t?.server_name||e,i=w?.[e]||[];N.push({type:"mcp",server_label:"litellm",server_url:`litellm_proxy/mcp/${o}`,require_approval:"never",...i.length>0?{allowed_tools:i}:{}})}})),await z.chat.completions.create({model:a,stream:!0,stream_options:{include_usage:!0},litellm_trace_id:p,messages:e,...m?{vector_store_ids:m}:{},...u?{guardrails:u}:{},...f?{policies:f}:{},...N.length>0?{tools:N,tool_choice:"auto"}:{},...void 0!==b?{temperature:b}:{},...void 0!==x?{max_tokens:x}:{},...k?{mock_testing_fallbacks:!0}:{}},{signal:s}))){console.log("Stream chunk:",v);let e=v.choices[0]?.delta;if(console.log("Delta content:",v.choices[0]?.delta?.content),console.log("Delta reasoning content:",e?.reasoning_content),!n&&(v.choices[0]?.delta?.content||e&&e.reasoning_content)&&(n=!0,t=Date.now()-o,console.log("First token received! Time:",t,"ms"),c?(console.log("Calling onTimingData with:",t),c(t)):console.log("onTimingData callback is not defined!")),v.choices[0]?.delta?.content){let e=v.choices[0].delta.content;i(e,v.model)}if(e&&e.image&&h&&(console.log("Image generated:",e.image),h(e.image.url,v.model)),e&&e.reasoning_content){let t=e.reasoning_content;l&&l(t)}if(e&&e.provider_specific_fields?.search_results&&_&&(console.log("Search results found:",e.provider_specific_fields.search_results),_(e.provider_specific_fields.search_results)),e&&e.provider_specific_fields){let t=e.provider_specific_fields;if(t.mcp_list_tools&&!r.mcp_list_tools&&(r.mcp_list_tools=t.mcp_list_tools,S&&!y)){y=!0;let e={type:"response.output_item.done",item_id:"mcp_list_tools",item:{type:"mcp_list_tools",tools:t.mcp_list_tools.map(e=>({name:e.function?.name||e.name||"",description:e.function?.description||e.description||"",input_schema:e.function?.parameters||e.input_schema||{}}))},timestamp:Date.now()};S(e),console.log("MCP list_tools event sent:",e)}t.mcp_tool_calls&&(r.mcp_tool_calls=t.mcp_tool_calls),t.mcp_call_results&&(r.mcp_call_results=t.mcp_call_results),(t.mcp_list_tools||t.mcp_tool_calls||t.mcp_call_results)&&console.log("MCP metadata found in chunk:",{mcp_list_tools:t.mcp_list_tools?"present":"absent",mcp_tool_calls:t.mcp_tool_calls?"present":"absent",mcp_call_results:t.mcp_call_results?"present":"absent"})}if(v.usage&&d){console.log("Usage data found:",v.usage);let e={completionTokens:v.usage.completion_tokens,promptTokens:v.usage.prompt_tokens,totalTokens:v.usage.total_tokens};v.usage.completion_tokens_details?.reasoning_tokens&&(e.reasoningTokens=v.usage.completion_tokens_details.reasoning_tokens),void 0!==v.usage.cost&&null!==v.usage.cost&&(e.cost=parseFloat(v.usage.cost)),d(e)}}S&&(r.mcp_tool_calls||r.mcp_call_results)&&r.mcp_tool_calls&&r.mcp_tool_calls.length>0&&r.mcp_tool_calls.forEach((e,t)=>{let o=e.function?.name||e.name||"",i=e.function?.arguments||e.arguments||"{}",a=r.mcp_call_results?.find(t=>t.tool_call_id===e.id||t.tool_call_id===e.call_id)||r.mcp_call_results?.[t],n={type:"response.output_item.done",item:{type:"mcp_call",name:o,arguments:"string"==typeof i?i:JSON.stringify(i),output:a?.result?"string"==typeof a.result?a.result:JSON.stringify(a.result):void 0},item_id:e.id||e.call_id,timestamp:Date.now()};S(n),console.log("MCP call event sent:",n)});let O=Date.now();v&&v(O-o)}catch(e){throw s?.aborted&&console.log("Chat completion request was cancelled"),e}}e.s(["makeOpenAIChatCompletionRequest",()=>i],254530);var a=e.i(727749);async function n(e,i,r,s,l=[],c,d,p,m,u,f,g,h,_,b,x,v,y,j,w,S,k,C){if(!s)throw Error("Virtual Key is required");if(!r||""===r.trim())throw Error("Model is required. Please select a model before sending a request.");console.log=function(){};let N=w||(0,o.getProxyBaseUrl)(),O={};l&&l.length>0&&(O["x-litellm-tags"]=l.join(","));let z=new t.default.OpenAI({apiKey:s,baseURL:N,dangerouslyAllowBrowser:!0,defaultHeaders:O});try{let t=Date.now(),o=!1,a=e.map(e=>(Array.isArray(e.content),{role:e.role,content:e.content,type:"message"})),n=[];_&&_.length>0&&(_.includes("__all__")?n.push({type:"mcp",server_label:"litellm",server_url:`${N}/mcp`,require_approval:"never"}):_.forEach(e=>{if(e.startsWith("toolset:")){let t=e.slice(8),o=C?.find(e=>e.toolset_id===t),i=o?.toolset_name||t;n.push({type:"mcp",server_label:i,server_url:`${N}/mcp/${encodeURIComponent(i)}`,require_approval:"never"})}else{let t=S?.find(t=>t.server_id===e),o=t?.server_name||e,i=k?.[e]||[];n.push({type:"mcp",server_label:o,server_url:`${N}/mcp/${encodeURIComponent(o)}`,require_approval:"never",...i.length>0?{allowed_tools:i}:{}})}})),y&&n.push({type:"code_interpreter",container:{type:"auto"}});let s=await z.responses.create({model:r,input:a,stream:!0,litellm_trace_id:u,...b?{previous_response_id:b}:{},...f?{vector_store_ids:f}:{},...g?{guardrails:g}:{},...h?{policies:h}:{},...n.length>0?{tools:n,tool_choice:"auto"}:{}},{signal:c}),l="",w={code:"",containerId:""};for await(let e of s)if(console.log("Response event:",e),"object"==typeof e&&null!==e){if((e.type?.startsWith("response.mcp_")||"response.output_item.done"===e.type&&(e.item?.type==="mcp_list_tools"||e.item?.type==="mcp_call"))&&(console.log("MCP event received:",e),v)){let t={type:e.type,sequence_number:e.sequence_number,output_index:e.output_index,item_id:e.item_id||e.item?.id,item:e.item,delta:e.delta,arguments:e.arguments,timestamp:Date.now()};v(t)}"response.output_item.done"===e.type&&e.item?.type==="mcp_call"&&e.item?.name&&(l=e.item.name,console.log("MCP tool used:",l)),E=w;var E,I=w="response.output_item.done"===e.type&&e.item?.type==="code_interpreter_call"?(console.log("Code interpreter call completed:",e.item),{code:e.item.code||"",containerId:e.item.container_id||""}):E;if("response.output_item.done"===e.type&&e.item?.type==="message"&&e.item?.content&&j){for(let t of e.item.content)if("output_text"===t.type&&t.annotations){let e=t.annotations.filter(e=>"container_file_citation"===e.type);(e.length>0||I.code)&&j({code:I.code,containerId:I.containerId,annotations:e})}}if("response.role.delta"===e.type)continue;if("response.output_text.delta"===e.type&&"string"==typeof e.delta){let a=e.delta;if(console.log("Text delta",a),a.length>0&&(i("assistant",a,r),!o)){o=!0;let e=Date.now()-t;console.log("First token received! Time:",e,"ms"),p&&p(e)}}if("response.reasoning.delta"===e.type&&"delta"in e){let t=e.delta;"string"==typeof t&&d&&d(t)}if("response.completed"===e.type&&"response"in e){let t=e.response,o=t.usage;if(console.log("Usage data:",o),console.log("Response completed event:",t),t.id&&x&&(console.log("Response ID for session management:",t.id),x(t.id)),o&&m){console.log("Usage data:",o);let e={completionTokens:o.output_tokens,promptTokens:o.input_tokens,totalTokens:o.total_tokens};o.completion_tokens_details?.reasoning_tokens&&(e.reasoningTokens=o.completion_tokens_details.reasoning_tokens),m(e,l)}}}return s}catch(e){throw c?.aborted?console.log("Responses API request was cancelled"):a.default.fromBackend(`Error occurred while generating model response. Please try again. Error: ${e}`),e}}e.s(["makeOpenAIResponsesRequest",()=>n],452598)},355343,e=>{"use strict";var t=e.i(843476),o=e.i(437902),i=e.i(898586),a=e.i(362024);let{Text:n}=i.Typography,{Panel:r}=a.Collapse;e.s(["default",0,({events:e,className:i})=>{if(console.log("MCPEventsDisplay: Received events:",e),!e||0===e.length)return console.log("MCPEventsDisplay: No events, returning null"),null;let n=e.find(e=>"response.output_item.done"===e.type&&e.item?.type==="mcp_list_tools"&&e.item.tools&&e.item.tools.length>0),s=e.filter(e=>"response.output_item.done"===e.type&&e.item?.type==="mcp_call");return(console.log("MCPEventsDisplay: toolsEvent:",n),console.log("MCPEventsDisplay: mcpCallEvents:",s),n||0!==s.length)?(0,t.jsxs)("div",{className:`jsx-32b14b04f420f3ac mcp-events-display ${i||""}`,children:[(0,t.jsx)(o.default,{id:"32b14b04f420f3ac",children:".openai-mcp-tools.jsx-32b14b04f420f3ac{margin:0;padding:0;position:relative}.openai-mcp-tools.jsx-32b14b04f420f3ac .ant-collapse.jsx-32b14b04f420f3ac,.openai-mcp-tools.jsx-32b14b04f420f3ac .ant-collapse-item.jsx-32b14b04f420f3ac{background:0 0!important;border:none!important}.openai-mcp-tools.jsx-32b14b04f420f3ac .ant-collapse-header.jsx-32b14b04f420f3ac{color:#9ca3af!important;background:0 0!important;border:none!important;min-height:20px!important;padding:0 0 0 20px!important;font-size:14px!important;font-weight:400!important;line-height:20px!important}.openai-mcp-tools.jsx-32b14b04f420f3ac .ant-collapse-header.jsx-32b14b04f420f3ac:hover{color:#6b7280!important;background:0 0!important}.openai-mcp-tools.jsx-32b14b04f420f3ac .ant-collapse-content.jsx-32b14b04f420f3ac{background:0 0!important;border:none!important}.openai-mcp-tools.jsx-32b14b04f420f3ac .ant-collapse-content-box.jsx-32b14b04f420f3ac{padding:4px 0 0 20px!important}.openai-mcp-tools.jsx-32b14b04f420f3ac .ant-collapse-expand-icon.jsx-32b14b04f420f3ac{color:#9ca3af!important;justify-content:center!important;align-items:center!important;width:16px!important;height:16px!important;font-size:10px!important;display:flex!important;position:absolute!important;top:2px!important;left:2px!important}.openai-mcp-tools.jsx-32b14b04f420f3ac .ant-collapse-expand-icon.jsx-32b14b04f420f3ac:hover{color:#6b7280!important}.openai-vertical-line.jsx-32b14b04f420f3ac{opacity:.8;background-color:#f3f4f6;width:.5px;position:absolute;top:18px;bottom:0;left:9px}.tool-item.jsx-32b14b04f420f3ac{color:#4b5563;z-index:1;background:#fff;margin:0;padding:0;font-family:ui-monospace,SFMono-Regular,SF Mono,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-size:13px;line-height:18px;position:relative}.mcp-section.jsx-32b14b04f420f3ac{z-index:1;background:#fff;margin-bottom:12px;position:relative}.mcp-section.jsx-32b14b04f420f3ac:last-child{margin-bottom:0}.mcp-section-header.jsx-32b14b04f420f3ac{color:#6b7280;margin-bottom:4px;font-size:13px;font-weight:500}.mcp-code-block.jsx-32b14b04f420f3ac{background:#f9fafb;border:1px solid #f3f4f6;border-radius:6px;padding:8px;font-size:12px}.mcp-json.jsx-32b14b04f420f3ac{color:#374151;white-space:pre-wrap;word-wrap:break-word;margin:0;font-family:ui-monospace,SFMono-Regular,SF Mono,Monaco,Consolas,Liberation Mono,Courier New,monospace}.mcp-approved.jsx-32b14b04f420f3ac{color:#6b7280;align-items:center;font-size:13px;display:flex}.mcp-checkmark.jsx-32b14b04f420f3ac{color:#10b981;margin-right:6px;font-weight:700}.mcp-response-content.jsx-32b14b04f420f3ac{color:#374151;white-space:pre-wrap;font-family:ui-monospace,SFMono-Regular,SF Mono,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-size:13px;line-height:1.5}"}),(0,t.jsxs)("div",{className:"jsx-32b14b04f420f3ac openai-mcp-tools",children:[(0,t.jsx)("div",{className:"jsx-32b14b04f420f3ac openai-vertical-line"}),(0,t.jsxs)(a.Collapse,{ghost:!0,size:"small",expandIconPosition:"start",defaultActiveKey:n?["list-tools"]:s.map((e,t)=>`mcp-call-${t}`),children:[n&&(0,t.jsx)(r,{header:"List tools",children:(0,t.jsx)("div",{className:"jsx-32b14b04f420f3ac",children:n.item?.tools?.map((e,o)=>(0,t.jsx)("div",{className:"jsx-32b14b04f420f3ac tool-item",children:e.name},o))})},"list-tools"),s.map((e,o)=>(0,t.jsx)(r,{header:e.item?.name||"Tool call",children:(0,t.jsxs)("div",{className:"jsx-32b14b04f420f3ac",children:[(0,t.jsxs)("div",{className:"jsx-32b14b04f420f3ac mcp-section",children:[(0,t.jsx)("div",{className:"jsx-32b14b04f420f3ac mcp-section-header",children:"Request"}),(0,t.jsx)("div",{className:"jsx-32b14b04f420f3ac mcp-code-block",children:e.item?.arguments&&(0,t.jsx)("pre",{className:"jsx-32b14b04f420f3ac mcp-json",children:(()=>{try{return JSON.stringify(JSON.parse(e.item.arguments),null,2)}catch(t){return e.item.arguments}})()})})]}),(0,t.jsx)("div",{className:"jsx-32b14b04f420f3ac mcp-section",children:(0,t.jsxs)("div",{className:"jsx-32b14b04f420f3ac mcp-approved",children:[(0,t.jsx)("span",{className:"jsx-32b14b04f420f3ac mcp-checkmark",children:"✓"})," Approved"]})}),e.item?.output&&(0,t.jsxs)("div",{className:"jsx-32b14b04f420f3ac mcp-section",children:[(0,t.jsx)("div",{className:"jsx-32b14b04f420f3ac mcp-section-header",children:"Response"}),(0,t.jsx)("div",{className:"jsx-32b14b04f420f3ac mcp-response-content",children:e.item.output})]})]})},`mcp-call-${o}`))]})]})]}):(console.log("MCPEventsDisplay: No valid events found, returning null"),null)}])},966988,e=>{"use strict";var t=e.i(843476),o=e.i(271645),i=e.i(464571),a=e.i(918789),n=e.i(650056),r=e.i(219470),s=e.i(755151),l=e.i(240647),c=e.i(812618);e.s(["default",0,({reasoningContent:e})=>{let[d,p]=(0,o.useState)(!0);return e?(0,t.jsxs)("div",{className:"reasoning-content mt-1 mb-2",children:[(0,t.jsxs)(i.Button,{type:"text",className:"flex items-center text-xs text-gray-500 hover:text-gray-700",onClick:()=>p(!d),icon:(0,t.jsx)(c.BulbOutlined,{}),children:[d?"Hide reasoning":"Show reasoning",d?(0,t.jsx)(s.DownOutlined,{className:"ml-1"}):(0,t.jsx)(l.RightOutlined,{className:"ml-1"})]}),d&&(0,t.jsx)("div",{className:"mt-2 p-3 bg-gray-50 border border-gray-200 rounded-md text-sm text-gray-700",children:(0,t.jsx)(a.default,{components:{code({node:e,inline:o,className:i,children:a,...s}){let l=/language-(\w+)/.exec(i||"");return!o&&l?(0,t.jsx)(n.Prism,{style:r.coy,language:l[1],PreTag:"div",className:"rounded-md my-2",...s,children:String(a).replace(/\n$/,"")}):(0,t.jsx)("code",{className:`${i} px-1.5 py-0.5 rounded bg-gray-100 text-sm font-mono`,...s,children:a})}},children:e})})]}):null}])}]); \ No newline at end of file diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/44b9dfbbfb0955a2.js b/litellm/proxy/_experimental/out/_next/static/chunks/44b9dfbbfb0955a2.js deleted file mode 100644 index 4347d85c95..0000000000 --- a/litellm/proxy/_experimental/out/_next/static/chunks/44b9dfbbfb0955a2.js +++ /dev/null @@ -1 +0,0 @@ -(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,309426,e=>{"use strict";var t=e.i(290571),r=e.i(444755),n=e.i(673706),i=e.i(271645),s=e.i(46757);let a=(0,n.makeClassName)("Col"),o=i.default.forwardRef((e,n)=>{let o,l,d,c,{numColSpan:u=1,numColSpanSm:h,numColSpanMd:f,numColSpanLg:p,children:m,className:g}=e,y=(0,t.__rest)(e,["numColSpan","numColSpanSm","numColSpanMd","numColSpanLg","children","className"]),b=(e,t)=>e&&Object.keys(t).includes(String(e))?t[e]:"";return i.default.createElement("div",Object.assign({ref:n,className:(0,r.tremorTwMerge)(a("root"),(o=b(u,s.colSpan),l=b(h,s.colSpanSm),d=b(f,s.colSpanMd),c=b(p,s.colSpanLg),(0,r.tremorTwMerge)(o,l,d,c)),g)},y),m)});o.displayName="Col",e.s(["Col",()=>o],309426)},519756,e=>{"use strict";e.i(247167);var t=e.i(931067),r=e.i(271645);let n={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M400 317.7h73.9V656c0 4.4 3.6 8 8 8h60c4.4 0 8-3.6 8-8V317.7H624c6.7 0 10.4-7.7 6.3-12.9L518.3 163a8 8 0 00-12.6 0l-112 141.7c-4.1 5.3-.4 13 6.3 13zM878 626h-60c-4.4 0-8 3.6-8 8v154H214V634c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8v198c0 17.7 14.3 32 32 32h684c17.7 0 32-14.3 32-32V634c0-4.4-3.6-8-8-8z"}}]},name:"upload",theme:"outlined"};var i=e.i(9583),s=r.forwardRef(function(e,s){return r.createElement(i.default,(0,t.default)({},e,{ref:s,icon:n}))});e.s(["UploadOutlined",0,s],519756)},981339,e=>{"use strict";var t=e.i(185793);e.s(["Skeleton",()=>t.default])},500330,e=>{"use strict";var t=e.i(727749);function r(e,t){let r=structuredClone(e);for(let[e,n]of Object.entries(t))e in r&&(r[e]=n);return r}let n=(e,t=0,r=!1,n=!0)=>{if(null==e||!Number.isFinite(e)||0===e&&!n)return"-";let i={minimumFractionDigits:t,maximumFractionDigits:t};if(!r)return e.toLocaleString("en-US",i);let s=e<0?"-":"",a=Math.abs(e),o=a,l="";return a>=1e6?(o=a/1e6,l="M"):a>=1e3&&(o=a/1e3,l="K"),`${s}${o.toLocaleString("en-US",i)}${l}`},i=async(e,r="Copied to clipboard")=>{if(!e)return!1;if(!navigator||!navigator.clipboard||!navigator.clipboard.writeText)return s(e,r);try{return await navigator.clipboard.writeText(e),t.default.success(r),!0}catch(t){return console.error("Clipboard API failed: ",t),s(e,r)}},s=(e,r)=>{try{let n=document.createElement("textarea");n.value=e,n.style.position="fixed",n.style.left="-999999px",n.style.top="-999999px",n.setAttribute("readonly",""),document.body.appendChild(n),n.focus(),n.select();let i=document.execCommand("copy");if(document.body.removeChild(n),i)return t.default.success(r),!0;throw Error("execCommand failed")}catch(e){return t.default.fromBackend("Failed to copy to clipboard"),console.error("Failed to copy: ",e),!1}};e.s(["copyToClipboard",0,i,"formatNumberWithCommas",0,n,"getSpendString",0,(e,t=6)=>{if(null==e||!Number.isFinite(e)||0===e)return"-";let r=n(e,t,!1,!1);if(0===Number(r.replace(/,/g,""))){let e=(1/10**t).toFixed(t);return`< $${e}`}return`$${r}`},"updateExistingKeys",()=>r])},663435,152473,e=>{"use strict";var t=e.i(843476),r=e.i(271645),n=e.i(199133),i=e.i(898586),s=e.i(56456);let a={enabled:!0,leading:!1,trailing:!0,wait:0,onExecute:()=>{}};class o{constructor(e,t){this.fn=e,this._canLeadingExecute=!0,this._isPending=!1,this._executionCount=0,this._options={...a,...t}}setOptions(e){return this._options={...this._options,...e},this._options.enabled||(this._isPending=!1),this._options}getOptions(){return this._options}maybeExecute(...e){this._options.leading&&this._canLeadingExecute&&(this.executeFunction(...e),this._canLeadingExecute=!1),(this._options.leading||this._options.trailing)&&(this._isPending=!0),this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=setTimeout(()=>{this._canLeadingExecute=!0,this._isPending=!1,this._options.trailing&&this.executeFunction(...e)},this._options.wait)}executeFunction(...e){this._options.enabled&&(this.fn(...e),this._executionCount++,this._options.onExecute(this))}cancel(){this._timeoutId&&(clearTimeout(this._timeoutId),this._canLeadingExecute=!0,this._isPending=!1)}getExecutionCount(){return this._executionCount}getIsPending(){return this._options.enabled&&this._isPending}}function l(e,t){let[n,i]=(0,r.useState)(e),s=function(e,t){let[n]=(0,r.useState)(()=>{var r;return Object.getOwnPropertyNames(Object.getPrototypeOf(r=new o(e,t))).filter(e=>"function"==typeof r[e]).reduce((e,t)=>{let n=r[t];return"function"==typeof n&&(e[t]=n.bind(r)),e},{})});return n.setOptions(t),n}(i,t);return[n,s.maybeExecute,s]}e.s(["useDebouncedState",()=>l],152473);var d=e.i(785242);let{Text:c}=i.Typography;e.s(["default",0,({value:e,onChange:i,onTeamSelect:a,disabled:o,organizationId:u,pageSize:h=20})=>{let[f,p]=(0,r.useState)(""),[m,g]=l("",{wait:300}),{data:y,fetchNextPage:b,hasNextPage:x,isFetchingNextPage:v,isLoading:_}=(0,d.useInfiniteTeams)(h,m||void 0,u),k=(0,r.useMemo)(()=>{if(!y?.pages)return[];let e=new Set,t=[];for(let r of y.pages)for(let n of r.teams)e.has(n.team_id)||(e.add(n.team_id),t.push(n));return t},[y]);return(0,t.jsx)(n.Select,{showSearch:!0,placeholder:"Search or select a team",value:e||void 0,onChange:e=>{i?.(e??""),a&&a(e?k.find(t=>t.team_id===e)??null:null)},disabled:o,allowClear:!0,filterOption:!1,onSearch:e=>{p(e),g(e)},searchValue:f,onPopupScroll:e=>{let t=e.currentTarget;(t.scrollTop+t.clientHeight)/t.scrollHeight>=.8&&x&&!v&&b()},loading:_,notFoundContent:_?(0,t.jsx)(s.LoadingOutlined,{spin:!0}):"No teams found",popupRender:e=>(0,t.jsxs)(t.Fragment,{children:[e,v&&(0,t.jsx)("div",{style:{textAlign:"center",padding:8},children:(0,t.jsx)(s.LoadingOutlined,{spin:!0})})]}),children:k.map(e=>(0,t.jsxs)(n.Select.Option,{value:e.team_id,children:[(0,t.jsx)("span",{className:"font-medium",children:e.team_alias})," ",(0,t.jsxs)(c,{type:"secondary",children:["(",e.team_id,")"]})]},e.team_id))})}],663435)},743151,(e,t,r)=>{"use strict";function n(e){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}Object.defineProperty(r,"__esModule",{value:!0}),r.CopyToClipboard=void 0;var i=o(e.r(271645)),s=o(e.r(844343)),a=["text","onCopy","options","children"];function o(e){return e&&e.__esModule?e:{default:e}}function l(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function d(e){for(var t=1;t=0||(i[r]=e[r]);return i}(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(n=0;n=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(i[r]=e[r])}return i}(e,a),n=i.default.Children.only(t);return i.default.cloneElement(n,d(d({},r),{},{onClick:this.onClick}))}}],function(e,t){for(var r=0;r{"use strict";var n=e.r(743151).CopyToClipboard;n.CopyToClipboard=n,t.exports=n},59935,(e,t,r)=>{var n;let i;e.e,n=function e(){var t,r="u">typeof self?self:"u">typeof window?window:void 0!==r?r:{},n=!r.document&&!!r.postMessage,i=r.IS_PAPA_WORKER||!1,s={},a=0,o={};function l(e){this._handle=null,this._finished=!1,this._completed=!1,this._halted=!1,this._input=null,this._baseIndex=0,this._partialLine="",this._rowCount=0,this._start=0,this._nextChunk=null,this.isFirstChunk=!0,this._completeResults={data:[],errors:[],meta:{}},(function(e){var t=x(e);t.chunkSize=parseInt(t.chunkSize),e.step||e.chunk||(t.chunkSize=null),this._handle=new f(t),(this._handle.streamer=this)._config=t}).call(this,e),this.parseChunk=function(e,t){var n=parseInt(this._config.skipFirstNLines)||0;if(this.isFirstChunk&&0=this._config.preview,i)r.postMessage({results:s,workerId:o.WORKER_ID,finished:n});else if(_(this._config.chunk)&&!t){if(this._config.chunk(s,this._handle),this._handle.paused()||this._handle.aborted())return void(this._halted=!0);this._completeResults=s=void 0}return this._config.step||this._config.chunk||(this._completeResults.data=this._completeResults.data.concat(s.data),this._completeResults.errors=this._completeResults.errors.concat(s.errors),this._completeResults.meta=s.meta),this._completed||!n||!_(this._config.complete)||s&&s.meta.aborted||(this._config.complete(this._completeResults,this._input),this._completed=!0),n||s&&s.meta.paused||this._nextChunk(),s}this._halted=!0},this._sendError=function(e){_(this._config.error)?this._config.error(e):i&&this._config.error&&r.postMessage({workerId:o.WORKER_ID,error:e,finished:!1})}}function d(e){var t;(e=e||{}).chunkSize||(e.chunkSize=o.RemoteChunkSize),l.call(this,e),this._nextChunk=n?function(){this._readChunk(),this._chunkLoaded()}:function(){this._readChunk()},this.stream=function(e){this._input=e,this._nextChunk()},this._readChunk=function(){if(this._finished)this._chunkLoaded();else{if(t=new XMLHttpRequest,this._config.withCredentials&&(t.withCredentials=this._config.withCredentials),n||(t.onload=v(this._chunkLoaded,this),t.onerror=v(this._chunkError,this)),t.open(this._config.downloadRequestBody?"POST":"GET",this._input,!n),this._config.downloadRequestHeaders){var e,r,i=this._config.downloadRequestHeaders;for(r in i)t.setRequestHeader(r,i[r])}this._config.chunkSize&&(e=this._start+this._config.chunkSize-1,t.setRequestHeader("Range","bytes="+this._start+"-"+e));try{t.send(this._config.downloadRequestBody)}catch(e){this._chunkError(e.message)}n&&0===t.status&&this._chunkError()}},this._chunkLoaded=function(){let e;4===t.readyState&&(t.status<200||400<=t.status?this._chunkError():(this._start+=this._config.chunkSize||t.responseText.length,this._finished=!this._config.chunkSize||this._start>=(null!==(e=(e=t).getResponseHeader("Content-Range"))?parseInt(e.substring(e.lastIndexOf("/")+1)):-1),this.parseChunk(t.responseText)))},this._chunkError=function(e){e=t.statusText||e,this._sendError(Error(e))}}function c(e){(e=e||{}).chunkSize||(e.chunkSize=o.LocalChunkSize),l.call(this,e);var t,r,n="u">typeof FileReader;this.stream=function(e){this._input=e,r=e.slice||e.webkitSlice||e.mozSlice,n?((t=new FileReader).onload=v(this._chunkLoaded,this),t.onerror=v(this._chunkError,this)):t=new FileReaderSync,this._nextChunk()},this._nextChunk=function(){this._finished||this._config.preview&&!(this._rowCount=this._input.size,this.parseChunk(e.target.result)},this._chunkError=function(){this._sendError(t.error)}}function u(e){var t;l.call(this,e=e||{}),this.stream=function(e){return t=e,this._nextChunk()},this._nextChunk=function(){var e,r;if(!this._finished)return t=(e=this._config.chunkSize)?(r=t.substring(0,e),t.substring(e)):(r=t,""),this._finished=!t,this.parseChunk(r)}}function h(e){l.call(this,e=e||{});var t=[],r=!0,n=!1;this.pause=function(){l.prototype.pause.apply(this,arguments),this._input.pause()},this.resume=function(){l.prototype.resume.apply(this,arguments),this._input.resume()},this.stream=function(e){this._input=e,this._input.on("data",this._streamData),this._input.on("end",this._streamEnd),this._input.on("error",this._streamError)},this._checkIsFinished=function(){n&&1===t.length&&(this._finished=!0)},this._nextChunk=function(){this._checkIsFinished(),t.length?this.parseChunk(t.shift()):r=!0},this._streamData=v(function(e){try{t.push("string"==typeof e?e:e.toString(this._config.encoding)),r&&(r=!1,this._checkIsFinished(),this.parseChunk(t.shift()))}catch(e){this._streamError(e)}},this),this._streamError=v(function(e){this._streamCleanUp(),this._sendError(e)},this),this._streamEnd=v(function(){this._streamCleanUp(),n=!0,this._streamData("")},this),this._streamCleanUp=v(function(){this._input.removeListener("data",this._streamData),this._input.removeListener("end",this._streamEnd),this._input.removeListener("error",this._streamError)},this)}function f(e){var t,r,n,i,s=/^\s*-?(\d+\.?|\.\d+|\d+\.\d+)([eE][-+]?\d+)?\s*$/,a=/^((\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\.\d+([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z)))$/,l=this,d=0,c=0,u=!1,h=!1,f=[],g={data:[],errors:[],meta:{}};function y(t){return"greedy"===e.skipEmptyLines?""===t.join("").trim():1===t.length&&0===t[0].length}function b(){if(g&&n&&(k("Delimiter","UndetectableDelimiter","Unable to auto-detect delimiting character; defaulted to '"+o.DefaultDelimiter+"'"),n=!1),e.skipEmptyLines&&(g.data=g.data.filter(function(e){return!y(e)})),v()){if(g)if(Array.isArray(g.data[0])){for(var t,r=0;v()&&r(e.dynamicTypingFunction&&void 0===e.dynamicTyping[t]&&(e.dynamicTyping[t]=e.dynamicTypingFunction(t)),!0===(e.dynamicTyping[t]||e.dynamicTyping))?"true"===r||"TRUE"===r||"false"!==r&&"FALSE"!==r&&((e=>{if(s.test(e)&&-0x20000000000000<(e=parseFloat(e))&&e<0x20000000000000)return 1})(r)?parseFloat(r):a.test(r)?new Date(r):""===r?null:r):r)(o=e.header?i>=f.length?"__parsed_extra":f[i]:o,l=e.transform?e.transform(l,o):l);"__parsed_extra"===o?(n[o]=n[o]||[],n[o].push(l)):n[o]=l}return e.header&&(i>f.length?k("FieldMismatch","TooManyFields","Too many fields: expected "+f.length+" fields but parsed "+i,c+r):ie.preview?r.abort():(g.data=g.data[0],i(g,l))))}),this.parse=function(i,s,a){var l=e.quoteChar||'"',l=(e.newline||(e.newline=this.guessLineEndings(i,l)),n=!1,e.delimiter?_(e.delimiter)&&(e.delimiter=e.delimiter(i),g.meta.delimiter=e.delimiter):((l=((t,r,n,i,s)=>{var a,l,d,c;s=s||[","," ","|",";",o.RECORD_SEP,o.UNIT_SEP];for(var u=0;u=r.length/2?"\r\n":"\r"}}function p(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function m(e){var t=(e=e||{}).delimiter,r=e.newline,n=e.comments,i=e.step,s=e.preview,a=e.fastMode,l=null,d=!1,c=null==e.quoteChar?'"':e.quoteChar,u=c;if(void 0!==e.escapeChar&&(u=e.escapeChar),("string"!=typeof t||-1=s)return A(!0);break}j.push({type:"Quotes",code:"InvalidQuotes",message:"Trailing quote on quoted field is malformed",row:w.length,index:h}),M++}}else if(n&&0===C.length&&o.substring(h,h+v)===n){if(-1===R)return A();h=R+x,R=o.indexOf(r,h),O=o.indexOf(t,h)}else if(-1!==O&&(O=s)return A(!0)}return D();function L(e){w.push(e),S=h}function F(e){return -1!==e&&(e=o.substring(M+1,e))&&""===e.trim()?e.length:0}function D(e){return g||(void 0===e&&(e=o.substring(h)),C.push(e),h=y,L(C),k&&q()),A()}function I(e){h=e,L(C),C=[],R=o.indexOf(r,h)}function A(n){if(e.header&&!m&&w.length&&!d){var i=w[0],s=Object.create(null),a=new Set(i);let t=!1;for(let r=0;r{if("object"==typeof t){if("string"!=typeof t.delimiter||o.BAD_DELIMITERS.filter(function(e){return -1!==t.delimiter.indexOf(e)}).length||(i=t.delimiter),("boolean"==typeof t.quotes||"function"==typeof t.quotes||Array.isArray(t.quotes))&&(r=t.quotes),"boolean"!=typeof t.skipEmptyLines&&"string"!=typeof t.skipEmptyLines||(d=t.skipEmptyLines),"string"==typeof t.newline&&(s=t.newline),"string"==typeof t.quoteChar&&(a=t.quoteChar),"boolean"==typeof t.header&&(n=t.header),Array.isArray(t.columns)){if(0===t.columns.length)throw Error("Option columns is empty");c=t.columns}void 0!==t.escapeChar&&(l=t.escapeChar+a),t.escapeFormulae instanceof RegExp?u=t.escapeFormulae:"boolean"==typeof t.escapeFormulae&&t.escapeFormulae&&(u=/^[=+\-@\t\r].*$/)}})(),RegExp(p(a),"g"));if("string"==typeof e&&(e=JSON.parse(e)),Array.isArray(e)){if(!e.length||Array.isArray(e[0]))return f(null,e,d);if("object"==typeof e[0])return f(c||Object.keys(e[0]),e,d)}else if("object"==typeof e)return"string"==typeof e.data&&(e.data=JSON.parse(e.data)),Array.isArray(e.data)&&(e.fields||(e.fields=e.meta&&e.meta.fields||c),e.fields||(e.fields=Array.isArray(e.data[0])?e.fields:"object"==typeof e.data[0]?Object.keys(e.data[0]):[]),Array.isArray(e.data[0])||"object"==typeof e.data[0]||(e.data=[e.data])),f(e.fields||[],e.data||[],d);throw Error("Unable to serialize unrecognized input");function f(e,t,r){var a="",o=("string"==typeof e&&(e=JSON.parse(e)),"string"==typeof t&&(t=JSON.parse(t)),Array.isArray(e)&&0{for(var r=0;r{"use strict";var t=e.i(631171);e.s(["ChevronDownIcon",()=>t.default])},246349,e=>{"use strict";let t=(0,e.i(475254).default)("chevron-right",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);e.s(["default",()=>t])},91739,e=>{"use strict";var t=e.i(544195);e.s(["Radio",()=>t.default])},988297,e=>{"use strict";var t=e.i(271645);let r=t.forwardRef(function(e,r){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:r},e),t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 4v16m8-8H4"}))});e.s(["PlusIcon",0,r],988297)},797672,e=>{"use strict";var t=e.i(271645);let r=t.forwardRef(function(e,r){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:r},e),t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15.232 5.232l3.536 3.536m-2.036-5.036a2.5 2.5 0 113.536 3.536L6.5 21.036H3v-3.572L16.732 3.732z"}))});e.s(["PencilIcon",0,r],797672)},992619,e=>{"use strict";var t=e.i(843476),r=e.i(271645),n=e.i(779241),i=e.i(599724),s=e.i(199133),a=e.i(983561),o=e.i(689020);e.s(["default",0,({accessToken:e,value:l,placeholder:d="Select a Model",onChange:c,disabled:u=!1,style:h,className:f,showLabel:p=!0,labelText:m="Select Model"})=>{let[g,y]=(0,r.useState)(l),[b,x]=(0,r.useState)(!1),[v,_]=(0,r.useState)([]),k=(0,r.useRef)(null);return(0,r.useEffect)(()=>{y(l)},[l]),(0,r.useEffect)(()=>{e&&(async()=>{try{let t=await (0,o.fetchAvailableModels)(e);console.log("Fetched models for selector:",t),t.length>0&&_(t)}catch(e){console.error("Error fetching model info:",e)}})()},[e]),(0,t.jsxs)("div",{children:[p&&(0,t.jsxs)(i.Text,{className:"font-medium block mb-2 text-gray-700 flex items-center",children:[(0,t.jsx)(a.RobotOutlined,{className:"mr-2"})," ",m]}),(0,t.jsx)(s.Select,{value:g,placeholder:d,onChange:e=>{"custom"===e?(x(!0),y(void 0)):(x(!1),y(e),c&&c(e))},options:[...Array.from(new Set(v.map(e=>e.model_group))).map((e,t)=>({value:e,label:e,key:t})),{value:"custom",label:"Enter custom model",key:"custom"}],style:{width:"100%",...h},showSearch:!0,className:`rounded-md ${f||""}`,disabled:u}),b&&(0,t.jsx)(n.TextInput,{className:"mt-2",placeholder:"Enter custom model name",onValueChange:e=>{k.current&&clearTimeout(k.current),k.current=setTimeout(()=>{y(e),c&&c(e)},500)},disabled:u})]})}])},500727,699857,696609,531516,e=>{"use strict";var t=e.i(266027),r=e.i(243652),n=e.i(764205),i=e.i(135214);let s=(0,r.createQueryKeys)("mcpServers");e.s(["useMCPServers",0,e=>{let{accessToken:r}=(0,i.default)();return(0,t.useQuery)({queryKey:s.list(e?{filters:{teamId:e}}:void 0),queryFn:async()=>await (0,n.fetchMCPServers)(r,e),enabled:!!r})}],500727);let a=(0,r.createQueryKeys)("mcpToolsets");e.s(["useMCPToolsets",0,()=>{let{accessToken:e}=(0,i.default)();return(0,t.useQuery)({queryKey:a.list(),queryFn:async()=>await (0,n.fetchMCPToolsets)(e),enabled:!!e})}],699857);var o=e.i(843476),l=e.i(271645),d=e.i(536916),c=e.i(599724),u=e.i(409797),h=e.i(246349),h=h;let f=/\b(delete|remove|destroy|purge|drop|erase|unlink)\b/i,p=/\b(create|add|insert|new|post|submit|register|make|generate|write|upload)\b/i,m=/\b(update|edit|modify|change|patch|put|set|rename|move|transform)\b/i,g=/\b(get|read|list|fetch|search|find|query|retrieve|show|view|check|describe|info)\b/i;function y(e,t=""){let r=e.toLowerCase();if(g.test(r))return"read";if(f.test(r))return"delete";if(m.test(r))return"update";if(p.test(r))return"create";if(t){let e=t.toLowerCase();if(g.test(e))return"read";if(f.test(e))return"delete";if(m.test(e))return"update";if(p.test(e))return"create"}return"unknown"}function b(e){let t={read:[],create:[],update:[],delete:[],unknown:[]};for(let r of e)t[y(r.name,r.description)].push(r);return t}let x={read:{label:"Read",description:"Safe operations — fetch, list, search. No side effects.",risk:"low"},create:{label:"Create",description:"Add new resources — insert, upload, register.",risk:"medium"},update:{label:"Update",description:"Modify existing resources — edit, patch, rename.",risk:"medium"},delete:{label:"Delete",description:"Destructive operations — remove, purge, destroy.",risk:"high"},unknown:{label:"Other",description:"Operations that could not be automatically classified.",risk:"unknown"}};e.s(["CRUD_GROUP_META",0,x,"classifyToolOp",()=>y,"groupToolsByCrud",()=>b],696609);let v=["read","create","update","delete","unknown"],_={low:"bg-green-100 text-green-800",medium:"bg-yellow-100 text-yellow-800",high:"bg-red-100 text-red-800 font-semibold",unknown:"bg-gray-100 text-gray-700"},k={read:"border-green-200",create:"border-blue-200",update:"border-yellow-200",delete:"border-red-300",unknown:"border-gray-200"},w={read:"bg-green-50",create:"bg-blue-50",update:"bg-yellow-50",delete:"bg-red-50",unknown:"bg-gray-50"};e.s(["default",0,({tools:e,value:t,onChange:r,readOnly:n=!1,searchFilter:i=""})=>{let[s,a]=(0,l.useState)({read:!1,create:!1,update:!1,delete:!1,unknown:!0}),f=(0,l.useMemo)(()=>b(e),[e]),p=(0,l.useMemo)(()=>new Set(void 0===t?e.map(e=>e.name):t),[t,e]),m=e=>{if(n)return;let t=new Set(p);t.has(e)?t.delete(e):t.add(e),r(Array.from(t))};return 0===e.length?null:(0,o.jsx)("div",{className:"space-y-3",children:v.map(e=>{let t,l=f[e];if(0===l.length)return null;if(i){let e=i.toLowerCase();if(!l.some(t=>t.name.toLowerCase().includes(e)||(t.description??"").toLowerCase().includes(e)))return null}let g=x[e],y=(t=f[e]).length>0&&t.every(e=>p.has(e.name)),b=(e=>{let t=f[e];if(0===t.length)return!1;let r=t.filter(e=>p.has(e.name)).length;return r>0&&r{a(t=>({...t,[e]:!t[e]}))},children:[v?(0,o.jsx)(h.default,{className:"w-4 h-4 text-gray-500 flex-shrink-0"}):(0,o.jsx)(u.ChevronDownIcon,{className:"w-4 h-4 text-gray-500 flex-shrink-0"}),(0,o.jsx)("span",{className:"font-semibold text-gray-900 text-sm",children:g.label}),(0,o.jsx)("span",{className:`text-xs px-2 py-0.5 rounded-full ${_[g.risk]}`,children:"high"===g.risk?"High Risk":"medium"===g.risk?"Medium Risk":"low"===g.risk?"Safe":"Unclassified"}),(0,o.jsxs)("span",{className:"text-xs text-gray-500 ml-1",children:[l.filter(e=>p.has(e.name)).length,"/",l.length," allowed"]})]}),!n&&(0,o.jsxs)("div",{className:"flex items-center gap-2 ml-4",children:[(0,o.jsx)(c.Text,{className:"text-xs text-gray-500",children:y?"All on":b?"Partial":"All off"}),(0,o.jsx)(d.Checkbox,{checked:y,indeterminate:b,onChange:t=>((e,t)=>{if(n)return;let i=new Set(p);for(let r of f[e])t?i.add(r.name):i.delete(r.name);r(Array.from(i))})(e,t.target.checked),onClick:e=>e.stopPropagation()})]})]}),!v&&(0,o.jsx)("div",{className:"px-4 pt-2 pb-1 text-xs text-gray-500 bg-white border-b border-gray-100",children:g.description}),!v&&(0,o.jsx)("div",{className:"bg-white divide-y divide-gray-50",children:l.filter(e=>!i||e.name.toLowerCase().includes(i.toLowerCase())||(e.description??"").toLowerCase().includes(i.toLowerCase())).map(e=>{let t,r=(t=e.name,p.has(t));return(0,o.jsxs)("div",{className:`flex items-start gap-3 px-4 py-2.5 transition-colors hover:bg-gray-50 ${!n?"cursor-pointer":""} ${r?"":"opacity-60"}`,onClick:()=>m(e.name),children:[(0,o.jsx)(d.Checkbox,{checked:r,onChange:()=>m(e.name),disabled:n,onClick:e=>e.stopPropagation()}),(0,o.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,o.jsx)(c.Text,{className:"font-medium text-gray-900 text-sm",children:e.name}),e.description&&(0,o.jsx)(c.Text,{className:"text-xs text-gray-500 mt-0.5 leading-snug",children:e.description})]}),(0,o.jsx)("span",{className:`text-xs px-1.5 py-0.5 rounded flex-shrink-0 ${r?"bg-green-100 text-green-700":"bg-gray-100 text-gray-500"}`,children:r?"on":"off"})]},e.name)})})]},e)})})}],531516)},793130,e=>{"use strict";var t=e.i(290571),r=e.i(429427),n=e.i(371330),i=e.i(271645),s=e.i(394487),a=e.i(503269),o=e.i(214520),l=e.i(746725),d=e.i(914189),c=e.i(144279),u=e.i(294316),h=e.i(601893),f=e.i(140721),p=e.i(942803),m=e.i(233538),g=e.i(694421),y=e.i(700020),b=e.i(35889),x=e.i(998348),v=e.i(722678);let _=(0,i.createContext)(null);_.displayName="GroupContext";let k=i.Fragment,w=Object.assign((0,y.forwardRefWithAs)(function(e,t){var k;let w=(0,i.useId)(),j=(0,p.useProvidedId)(),C=(0,h.useDisabled)(),{id:S=j||`headlessui-switch-${w}`,disabled:E=C||!1,checked:N,defaultChecked:O,onChange:R,name:T,value:M,form:P,autoFocus:L=!1,...F}=e,D=(0,i.useContext)(_),[I,A]=(0,i.useState)(null),q=(0,i.useRef)(null),z=(0,u.useSyncRefs)(q,t,null===D?null:D.setSwitch,A),B=(0,o.useDefaultValue)(O),[U,$]=(0,a.useControllable)(N,R,null!=B&&B),K=(0,l.useDisposables)(),[H,W]=(0,i.useState)(!1),Q=(0,d.useEvent)(()=>{W(!0),null==$||$(!U),K.nextFrame(()=>{W(!1)})}),V=(0,d.useEvent)(e=>{if((0,m.isDisabledReactIssue7711)(e.currentTarget))return e.preventDefault();e.preventDefault(),Q()}),G=(0,d.useEvent)(e=>{e.key===x.Keys.Space?(e.preventDefault(),Q()):e.key===x.Keys.Enter&&(0,g.attemptSubmit)(e.currentTarget)}),J=(0,d.useEvent)(e=>e.preventDefault()),X=(0,v.useLabelledBy)(),Y=(0,b.useDescribedBy)(),{isFocusVisible:Z,focusProps:ee}=(0,r.useFocusRing)({autoFocus:L}),{isHovered:et,hoverProps:er}=(0,n.useHover)({isDisabled:E}),{pressed:en,pressProps:ei}=(0,s.useActivePress)({disabled:E}),es=(0,i.useMemo)(()=>({checked:U,disabled:E,hover:et,focus:Z,active:en,autofocus:L,changing:H}),[U,et,Z,en,E,H,L]),ea=(0,y.mergeProps)({id:S,ref:z,role:"switch",type:(0,c.useResolveButtonType)(e,I),tabIndex:-1===e.tabIndex?0:null!=(k=e.tabIndex)?k:0,"aria-checked":U,"aria-labelledby":X,"aria-describedby":Y,disabled:E||void 0,autoFocus:L,onClick:V,onKeyUp:G,onKeyPress:J},ee,er,ei),eo=(0,i.useCallback)(()=>{if(void 0!==B)return null==$?void 0:$(B)},[$,B]),el=(0,y.useRender)();return i.default.createElement(i.default.Fragment,null,null!=T&&i.default.createElement(f.FormFields,{disabled:E,data:{[T]:M||"on"},overrides:{type:"checkbox",checked:U},form:P,onReset:eo}),el({ourProps:ea,theirProps:F,slot:es,defaultTag:"button",name:"Switch"}))}),{Group:function(e){var t;let[r,n]=(0,i.useState)(null),[s,a]=(0,v.useLabels)(),[o,l]=(0,b.useDescriptions)(),d=(0,i.useMemo)(()=>({switch:r,setSwitch:n}),[r,n]),c=(0,y.useRender)();return i.default.createElement(l,{name:"Switch.Description",value:o},i.default.createElement(a,{name:"Switch.Label",value:s,props:{htmlFor:null==(t=d.switch)?void 0:t.id,onClick(e){r&&(e.currentTarget instanceof HTMLLabelElement&&e.preventDefault(),r.click(),r.focus({preventScroll:!0}))}}},i.default.createElement(_.Provider,{value:d},c({ourProps:{},theirProps:e,slot:{},defaultTag:k,name:"Switch.Group"}))))},Label:v.Label,Description:b.Description});var j=e.i(888288),C=e.i(95779),S=e.i(444755),E=e.i(673706),N=e.i(829087);let O=(0,E.makeClassName)("Switch"),R=i.default.forwardRef((e,r)=>{let{checked:n,defaultChecked:s=!1,onChange:a,color:o,name:l,error:d,errorMessage:c,disabled:u,required:h,tooltip:f,id:p}=e,m=(0,t.__rest)(e,["checked","defaultChecked","onChange","color","name","error","errorMessage","disabled","required","tooltip","id"]),g={bgColor:o?(0,E.getColorClassNames)(o,C.colorPalette.background).bgColor:"bg-tremor-brand dark:bg-dark-tremor-brand",ringColor:o?(0,E.getColorClassNames)(o,C.colorPalette.ring).ringColor:"ring-tremor-brand-muted dark:ring-dark-tremor-brand-muted"},[y,b]=(0,j.default)(s,n),[x,v]=(0,i.useState)(!1),{tooltipProps:_,getReferenceProps:k}=(0,N.useTooltip)(300);return i.default.createElement("div",{className:"flex flex-row items-center justify-start"},i.default.createElement(N.default,Object.assign({text:f},_)),i.default.createElement("div",Object.assign({ref:(0,E.mergeRefs)([r,_.refs.setReference]),className:(0,S.tremorTwMerge)(O("root"),"flex flex-row relative h-5")},m,k),i.default.createElement("input",{type:"checkbox",className:(0,S.tremorTwMerge)(O("input"),"absolute w-5 h-5 cursor-pointer left-0 top-0 opacity-0"),name:l,required:h,checked:y,onChange:e=>{e.preventDefault()}}),i.default.createElement(w,{checked:y,onChange:e=>{b(e),null==a||a(e)},disabled:u,className:(0,S.tremorTwMerge)(O("switch"),"w-10 h-5 group relative inline-flex shrink-0 cursor-pointer items-center justify-center rounded-tremor-full","focus:outline-none",u?"cursor-not-allowed":""),onFocus:()=>v(!0),onBlur:()=>v(!1),id:p},i.default.createElement("span",{className:(0,S.tremorTwMerge)(O("sr-only"),"sr-only")},"Switch ",y?"on":"off"),i.default.createElement("span",{"aria-hidden":"true",className:(0,S.tremorTwMerge)(O("background"),y?g.bgColor:"bg-tremor-border dark:bg-dark-tremor-border","pointer-events-none absolute mx-auto h-3 w-9 rounded-tremor-full transition-colors duration-100 ease-in-out")}),i.default.createElement("span",{"aria-hidden":"true",className:(0,S.tremorTwMerge)(O("round"),y?(0,S.tremorTwMerge)(g.bgColor,"translate-x-5 border-tremor-background dark:border-dark-tremor-background"):"translate-x-0 bg-tremor-border dark:bg-dark-tremor-border border-tremor-background dark:border-dark-tremor-background","pointer-events-none absolute left-0 inline-block h-5 w-5 transform rounded-tremor-full border-2 shadow-tremor-input duration-100 ease-in-out transition",x?(0,S.tremorTwMerge)("ring-2",g.ringColor):"")}))),d&&c?i.default.createElement("p",{className:(0,S.tremorTwMerge)(O("errorMessage"),"text-sm text-red-500 mt-1 ")},c):null)});R.displayName="Switch",e.s(["Switch",()=>R],793130)},107233,37727,e=>{"use strict";var t=e.i(603908);e.s(["Plus",()=>t.default],107233);var r=e.i(841947);e.s(["X",()=>r.default],37727)},361653,e=>{"use strict";let t=(0,e.i(475254).default)("circle-alert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]]);e.s(["default",()=>t])},603908,e=>{"use strict";let t=(0,e.i(475254).default)("plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);e.s(["default",()=>t])},841947,e=>{"use strict";let t=(0,e.i(475254).default)("x",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);e.s(["default",()=>t])},158392,419470,e=>{"use strict";var t=e.i(843476),r=e.i(779241);let n={ttl:3600,lowest_latency_buffer:0},i=({routingStrategyArgs:e})=>{let i={ttl:"Sliding window to look back over when calculating the average latency of a deployment. Default - 1 hour (in seconds).",lowest_latency_buffer:"Shuffle between deployments within this % of the lowest latency. Default - 0 (i.e. always pick lowest latency)."};return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:"space-y-6",children:[(0,t.jsxs)("div",{className:"max-w-3xl",children:[(0,t.jsx)("h3",{className:"text-sm font-medium text-gray-900",children:"Latency-Based Configuration"}),(0,t.jsx)("p",{className:"text-xs text-gray-500 mt-1",children:"Fine-tune latency-based routing behavior"})]}),(0,t.jsx)("div",{className:"grid grid-cols-1 gap-6 lg:grid-cols-2 xl:grid-cols-3",children:Object.entries(e||n).map(([e,n])=>(0,t.jsx)("div",{className:"space-y-2",children:(0,t.jsxs)("label",{className:"block",children:[(0,t.jsx)("span",{className:"text-xs font-medium text-gray-700 uppercase tracking-wide",children:e.replace(/_/g," ")}),(0,t.jsx)("p",{className:"text-xs text-gray-500 mt-0.5 mb-2",children:i[e]||""}),(0,t.jsx)(r.TextInput,{name:e,defaultValue:"object"==typeof n?JSON.stringify(n,null,2):n?.toString(),className:"font-mono text-sm w-full"})]})},e))})]}),(0,t.jsx)("div",{className:"border-t border-gray-200"})]})},s=({routerSettings:e,routerFieldsMetadata:n})=>(0,t.jsxs)("div",{className:"space-y-6",children:[(0,t.jsxs)("div",{className:"max-w-3xl",children:[(0,t.jsx)("h3",{className:"text-sm font-medium text-gray-900",children:"Reliability & Retries"}),(0,t.jsx)("p",{className:"text-xs text-gray-500 mt-1",children:"Configure retry logic and failure handling"})]}),(0,t.jsx)("div",{className:"grid grid-cols-1 gap-6 lg:grid-cols-2 xl:grid-cols-3",children:Object.entries(e).filter(([e,t])=>"fallbacks"!=e&&"context_window_fallbacks"!=e&&"routing_strategy_args"!=e&&"routing_strategy"!=e&&"enable_tag_filtering"!=e).map(([e,i])=>(0,t.jsx)("div",{className:"space-y-2",children:(0,t.jsxs)("label",{className:"block",children:[(0,t.jsx)("span",{className:"text-xs font-medium text-gray-700 uppercase tracking-wide",children:n[e]?.ui_field_name||e}),(0,t.jsx)("p",{className:"text-xs text-gray-500 mt-0.5 mb-2",children:n[e]?.field_description||""}),(0,t.jsx)(r.TextInput,{name:e,defaultValue:null==i||"null"===i?"":"object"==typeof i?JSON.stringify(i,null,2):i?.toString()||"",placeholder:"—",className:"font-mono text-sm w-full"})]})},e))})]});var a=e.i(199133);let o=({selectedStrategy:e,availableStrategies:r,routingStrategyDescriptions:n,routerFieldsMetadata:i,onStrategyChange:s})=>(0,t.jsxs)("div",{className:"space-y-2 max-w-3xl",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"text-xs font-medium text-gray-700 uppercase tracking-wide",children:i.routing_strategy?.ui_field_name||"Routing Strategy"}),(0,t.jsx)("p",{className:"text-xs text-gray-500 mt-0.5 mb-2",children:i.routing_strategy?.field_description||""})]}),(0,t.jsx)("div",{className:"routing-strategy-select max-w-3xl",children:(0,t.jsx)(a.Select,{value:e,onChange:s,style:{width:"100%"},size:"large",children:r.map(e=>(0,t.jsx)(a.Select.Option,{value:e,label:e,children:(0,t.jsxs)("div",{className:"flex flex-col gap-0.5 py-1",children:[(0,t.jsx)("span",{className:"font-mono text-sm font-medium",children:e}),n[e]&&(0,t.jsx)("span",{className:"text-xs text-gray-500 font-normal",children:n[e]})]})},e))})})]});var l=e.i(793130);let d=({enabled:e,routerFieldsMetadata:r,onToggle:n})=>(0,t.jsx)("div",{className:"space-y-3 max-w-3xl",children:(0,t.jsxs)("div",{className:"flex items-start justify-between",children:[(0,t.jsxs)("div",{className:"flex-1",children:[(0,t.jsx)("label",{className:"text-xs font-medium text-gray-700 uppercase tracking-wide",children:r.enable_tag_filtering?.ui_field_name||"Enable Tag Filtering"}),(0,t.jsxs)("p",{className:"text-xs text-gray-500 mt-0.5",children:[r.enable_tag_filtering?.field_description||"",r.enable_tag_filtering?.link&&(0,t.jsxs)(t.Fragment,{children:[" ",(0,t.jsx)("a",{href:r.enable_tag_filtering.link,target:"_blank",rel:"noopener noreferrer",className:"text-blue-600 hover:text-blue-800 underline",children:"Learn more"})]})]})]}),(0,t.jsx)(l.Switch,{checked:e,onChange:n,className:"ml-4"})]})});e.s(["default",0,({value:e,onChange:r,routerFieldsMetadata:n,availableRoutingStrategies:a,routingStrategyDescriptions:l})=>(0,t.jsxs)("div",{className:"w-full space-y-8 py-2",children:[(0,t.jsxs)("div",{className:"space-y-6",children:[(0,t.jsxs)("div",{className:"max-w-3xl",children:[(0,t.jsx)("h3",{className:"text-sm font-medium text-gray-900",children:"Routing Settings"}),(0,t.jsx)("p",{className:"text-xs text-gray-500 mt-1",children:"Configure how requests are routed to deployments"})]}),a.length>0&&(0,t.jsx)(o,{selectedStrategy:e.selectedStrategy||e.routerSettings.routing_strategy||null,availableStrategies:a,routingStrategyDescriptions:l,routerFieldsMetadata:n,onStrategyChange:t=>{r({...e,selectedStrategy:t})}}),(0,t.jsx)(d,{enabled:e.enableTagFiltering,routerFieldsMetadata:n,onToggle:t=>{r({...e,enableTagFiltering:t})}})]}),(0,t.jsx)("div",{className:"border-t border-gray-200"}),"latency-based-routing"===e.selectedStrategy&&(0,t.jsx)(i,{routingStrategyArgs:e.routerSettings.routing_strategy_args}),(0,t.jsx)(s,{routerSettings:e.routerSettings,routerFieldsMetadata:n})]})],158392);var c=e.i(994388),u=e.i(653496),h=e.i(107233),f=e.i(271645),p=e.i(888259),m=e.i(592968),g=e.i(361653),g=g;let y=(0,e.i(475254).default)("arrow-down",[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]]);var b=e.i(37727);function x({group:e,onChange:r,availableModels:n,maxFallbacks:i}){let s=n.filter(t=>t!==e.primaryModel),o=e.fallbackModels.length{let n=[...e.fallbackModels];n.includes(t)&&(n=n.filter(e=>e!==t)),r({...e,primaryModel:t,fallbackModels:n})},showSearch:!0,getPopupContainer:e=>e.parentElement||document.body,filterOption:(e,t)=>(t?.label??"").toLowerCase().includes(e.toLowerCase()),options:n.map(e=>({label:e,value:e}))}),!e.primaryModel&&(0,t.jsxs)("div",{className:"mt-2 flex items-center gap-2 text-amber-600 text-xs bg-amber-50 p-2 rounded",children:[(0,t.jsx)(g.default,{className:"w-4 h-4"}),(0,t.jsx)("span",{children:"Select a model to begin configuring fallbacks"})]})]}),(0,t.jsx)("div",{className:"flex items-center justify-center -my-4 z-10",children:(0,t.jsxs)("div",{className:"bg-indigo-50 text-indigo-500 px-4 py-1 rounded-full text-xs font-bold border border-indigo-100 flex items-center gap-2 shadow-sm",children:[(0,t.jsx)(y,{className:"w-4 h-4"}),"IF FAILS, TRY..."]})}),(0,t.jsxs)("div",{className:`transition-opacity duration-300 ${!e.primaryModel?"opacity-50 pointer-events-none":"opacity-100"}`,children:[(0,t.jsxs)("label",{className:"block text-sm font-semibold text-gray-700 mb-2",children:["Fallback Chain ",(0,t.jsx)("span",{className:"text-red-500",children:"*"}),(0,t.jsxs)("span",{className:"text-xs text-gray-500 font-normal ml-2",children:["(Max ",i," fallbacks at a time)"]})]}),(0,t.jsxs)("div",{className:"bg-gray-50 rounded-xl p-4 border border-gray-200",children:[(0,t.jsxs)("div",{className:"mb-4",children:[(0,t.jsx)(a.Select,{mode:"multiple",className:"w-full",size:"large",placeholder:o?"Select fallback models to add...":`Maximum ${i} fallbacks reached`,value:e.fallbackModels,onChange:t=>{let n=t.slice(0,i);r({...e,fallbackModels:n})},disabled:!e.primaryModel,getPopupContainer:e=>e.parentElement||document.body,options:s.map(e=>({label:e,value:e})),optionRender:(r,n)=>{let i=e.fallbackModels.includes(r.value),s=i?e.fallbackModels.indexOf(r.value)+1:null;return(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[i&&null!==s&&(0,t.jsx)("span",{className:"flex items-center justify-center w-5 h-5 rounded bg-indigo-100 text-indigo-600 text-xs font-bold",children:s}),(0,t.jsx)("span",{children:r.label})]})},maxTagCount:"responsive",maxTagPlaceholder:e=>(0,t.jsx)(m.Tooltip,{styles:{root:{pointerEvents:"none"}},title:e.map(({value:e})=>e).join(", "),children:(0,t.jsxs)("span",{children:["+",e.length," more"]})}),showSearch:!0,filterOption:(e,t)=>(t?.label??"").toLowerCase().includes(e.toLowerCase())}),(0,t.jsx)("p",{className:"text-xs text-gray-500 mt-1 ml-1",children:o?`Search and select multiple models. Selected models will appear below in order. (${e.fallbackModels.length}/${i} used)`:`Maximum ${i} fallbacks reached. Remove some to add more.`})]}),(0,t.jsx)("div",{className:"space-y-2 min-h-[100px]",children:0===e.fallbackModels.length?(0,t.jsxs)("div",{className:"h-32 border-2 border-dashed border-gray-300 rounded-lg flex flex-col items-center justify-center text-gray-400",children:[(0,t.jsx)("span",{className:"text-sm",children:"No fallback models selected"}),(0,t.jsx)("span",{className:"text-xs mt-1",children:"Add models from the dropdown above"})]}):e.fallbackModels.map((n,i)=>(0,t.jsxs)("div",{className:"group flex items-center justify-between p-3 bg-white rounded-lg border border-gray-200 hover:border-indigo-300 hover:shadow-sm transition-all",children:[(0,t.jsxs)("div",{className:"flex items-center gap-3",children:[(0,t.jsx)("div",{className:"flex items-center justify-center w-6 h-6 rounded bg-gray-100 text-gray-400 group-hover:text-indigo-500 group-hover:bg-indigo-50",children:(0,t.jsx)("span",{className:"text-xs font-bold",children:i+1})}),(0,t.jsx)("div",{children:(0,t.jsx)("span",{className:"font-medium text-gray-800",children:n})})]}),(0,t.jsx)("button",{type:"button",onClick:()=>{let t;return t=e.fallbackModels.filter((e,t)=>t!==i),void r({...e,fallbackModels:t})},className:"opacity-0 group-hover:opacity-100 transition-opacity text-gray-400 hover:text-red-500 p-1",children:(0,t.jsx)(b.X,{className:"w-4 h-4"})})]},`${n}-${i}`))})]})]})]})}function v({groups:e,onGroupsChange:r,availableModels:n,maxFallbacks:i=10,maxGroups:s=5}){let[a,o]=(0,f.useState)(e.length>0?e[0].id:"1");(0,f.useEffect)(()=>{e.length>0?e.some(e=>e.id===a)||o(e[0].id):o("1")},[e]);let l=()=>{if(e.length>=s)return;let t=Date.now().toString();r([...e,{id:t,primaryModel:null,fallbackModels:[]}]),o(t)},d=t=>{r(e.map(e=>e.id===t.id?t:e))},m=e.map((r,s)=>{let a=r.primaryModel?r.primaryModel:`Group ${s+1}`;return{key:r.id,label:a,closable:e.length>1,children:(0,t.jsx)(x,{group:r,onChange:d,availableModels:n,maxFallbacks:i})}});return 0===e.length?(0,t.jsxs)("div",{className:"text-center py-12 bg-gray-50 rounded-lg border border-dashed border-gray-300",children:[(0,t.jsx)("p",{className:"text-gray-500 mb-4",children:"No fallback groups configured"}),(0,t.jsx)(c.Button,{variant:"primary",onClick:l,icon:()=>(0,t.jsx)(h.Plus,{className:"w-4 h-4"}),children:"Create First Group"})]}):(0,t.jsx)(u.Tabs,{type:"editable-card",activeKey:a,onChange:o,onEdit:(t,n)=>{"add"===n?l():"remove"===n&&e.length>1&&(t=>{if(1===e.length)return p.default.warning("At least one group is required");let n=e.filter(e=>e.id!==t);r(n),a===t&&n.length>0&&o(n[n.length-1].id)})(t)},items:m,className:"fallback-tabs",tabBarStyle:{marginBottom:0},hideAdd:e.length>=s})}e.s(["FallbackSelectionForm",()=>v],419470)}]); \ No newline at end of file diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/4da28073ebe41531.js b/litellm/proxy/_experimental/out/_next/static/chunks/4da28073ebe41531.js new file mode 100644 index 0000000000..80eaf2ebc8 --- /dev/null +++ b/litellm/proxy/_experimental/out/_next/static/chunks/4da28073ebe41531.js @@ -0,0 +1 @@ +(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,409797,e=>{"use strict";var t=e.i(631171);e.s(["ChevronDownIcon",()=>t.default])},246349,e=>{"use strict";let t=(0,e.i(475254).default)("chevron-right",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);e.s(["default",()=>t])},91739,e=>{"use strict";var t=e.i(544195);e.s(["Radio",()=>t.default])},988297,e=>{"use strict";var t=e.i(271645);let r=t.forwardRef(function(e,r){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:r},e),t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 4v16m8-8H4"}))});e.s(["PlusIcon",0,r],988297)},797672,e=>{"use strict";var t=e.i(271645);let r=t.forwardRef(function(e,r){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:r},e),t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15.232 5.232l3.536 3.536m-2.036-5.036a2.5 2.5 0 113.536 3.536L6.5 21.036H3v-3.572L16.732 3.732z"}))});e.s(["PencilIcon",0,r],797672)},992619,e=>{"use strict";var t=e.i(843476),r=e.i(271645),n=e.i(779241),i=e.i(599724),s=e.i(199133),a=e.i(983561),o=e.i(689020);e.s(["default",0,({accessToken:e,value:l,placeholder:c="Select a Model",onChange:d,disabled:u=!1,style:f,className:h,showLabel:p=!0,labelText:m="Select Model"})=>{let[g,y]=(0,r.useState)(l),[b,x]=(0,r.useState)(!1),[v,k]=(0,r.useState)([]),w=(0,r.useRef)(null);return(0,r.useEffect)(()=>{y(l)},[l]),(0,r.useEffect)(()=>{e&&(async()=>{try{let t=await (0,o.fetchAvailableModels)(e);console.log("Fetched models for selector:",t),t.length>0&&k(t)}catch(e){console.error("Error fetching model info:",e)}})()},[e]),(0,t.jsxs)("div",{children:[p&&(0,t.jsxs)(i.Text,{className:"font-medium block mb-2 text-gray-700 flex items-center",children:[(0,t.jsx)(a.RobotOutlined,{className:"mr-2"})," ",m]}),(0,t.jsx)(s.Select,{value:g,placeholder:c,onChange:e=>{"custom"===e?(x(!0),y(void 0)):(x(!1),y(e),d&&d(e))},options:[...Array.from(new Set(v.map(e=>e.model_group))).map((e,t)=>({value:e,label:e,key:t})),{value:"custom",label:"Enter custom model",key:"custom"}],style:{width:"100%",...f},showSearch:!0,className:`rounded-md ${h||""}`,disabled:u}),b&&(0,t.jsx)(n.TextInput,{className:"mt-2",placeholder:"Enter custom model name",onValueChange:e=>{w.current&&clearTimeout(w.current),w.current=setTimeout(()=>{y(e),d&&d(e)},500)},disabled:u})]})}])},500727,699857,696609,531516,e=>{"use strict";var t=e.i(266027),r=e.i(243652),n=e.i(764205),i=e.i(135214);let s=(0,r.createQueryKeys)("mcpServers");e.s(["useMCPServers",0,e=>{let{accessToken:r}=(0,i.default)();return(0,t.useQuery)({queryKey:s.list(e?{filters:{teamId:e}}:void 0),queryFn:async()=>await (0,n.fetchMCPServers)(r,e),enabled:!!r})}],500727);let a=(0,r.createQueryKeys)("mcpToolsets");e.s(["useMCPToolsets",0,()=>{let{accessToken:e}=(0,i.default)();return(0,t.useQuery)({queryKey:a.list(),queryFn:async()=>await (0,n.fetchMCPToolsets)(e),enabled:!!e})}],699857);var o=e.i(843476),l=e.i(271645),c=e.i(536916),d=e.i(599724),u=e.i(409797),f=e.i(246349),f=f;let h=/\b(delete|remove|destroy|purge|drop|erase|unlink)\b/i,p=/\b(create|add|insert|new|post|submit|register|make|generate|write|upload)\b/i,m=/\b(update|edit|modify|change|patch|put|set|rename|move|transform)\b/i,g=/\b(get|read|list|fetch|search|find|query|retrieve|show|view|check|describe|info)\b/i;function y(e,t=""){let r=e.toLowerCase();if(g.test(r))return"read";if(h.test(r))return"delete";if(m.test(r))return"update";if(p.test(r))return"create";if(t){let e=t.toLowerCase();if(g.test(e))return"read";if(h.test(e))return"delete";if(m.test(e))return"update";if(p.test(e))return"create"}return"unknown"}function b(e){let t={read:[],create:[],update:[],delete:[],unknown:[]};for(let r of e)t[y(r.name,r.description)].push(r);return t}let x={read:{label:"Read",description:"Safe operations — fetch, list, search. No side effects.",risk:"low"},create:{label:"Create",description:"Add new resources — insert, upload, register.",risk:"medium"},update:{label:"Update",description:"Modify existing resources — edit, patch, rename.",risk:"medium"},delete:{label:"Delete",description:"Destructive operations — remove, purge, destroy.",risk:"high"},unknown:{label:"Other",description:"Operations that could not be automatically classified.",risk:"unknown"}};e.s(["CRUD_GROUP_META",0,x,"classifyToolOp",()=>y,"groupToolsByCrud",()=>b],696609);let v=["read","create","update","delete","unknown"],k={low:"bg-green-100 text-green-800",medium:"bg-yellow-100 text-yellow-800",high:"bg-red-100 text-red-800 font-semibold",unknown:"bg-gray-100 text-gray-700"},w={read:"border-green-200",create:"border-blue-200",update:"border-yellow-200",delete:"border-red-300",unknown:"border-gray-200"},_={read:"bg-green-50",create:"bg-blue-50",update:"bg-yellow-50",delete:"bg-red-50",unknown:"bg-gray-50"};e.s(["default",0,({tools:e,value:t,onChange:r,readOnly:n=!1,searchFilter:i=""})=>{let[s,a]=(0,l.useState)({read:!1,create:!1,update:!1,delete:!1,unknown:!0}),h=(0,l.useMemo)(()=>b(e),[e]),p=(0,l.useMemo)(()=>new Set(void 0===t?e.map(e=>e.name):t),[t,e]),m=e=>{if(n)return;let t=new Set(p);t.has(e)?t.delete(e):t.add(e),r(Array.from(t))};return 0===e.length?null:(0,o.jsx)("div",{className:"space-y-3",children:v.map(e=>{let t,l=h[e];if(0===l.length)return null;if(i){let e=i.toLowerCase();if(!l.some(t=>t.name.toLowerCase().includes(e)||(t.description??"").toLowerCase().includes(e)))return null}let g=x[e],y=(t=h[e]).length>0&&t.every(e=>p.has(e.name)),b=(e=>{let t=h[e];if(0===t.length)return!1;let r=t.filter(e=>p.has(e.name)).length;return r>0&&r{a(t=>({...t,[e]:!t[e]}))},children:[v?(0,o.jsx)(f.default,{className:"w-4 h-4 text-gray-500 flex-shrink-0"}):(0,o.jsx)(u.ChevronDownIcon,{className:"w-4 h-4 text-gray-500 flex-shrink-0"}),(0,o.jsx)("span",{className:"font-semibold text-gray-900 text-sm",children:g.label}),(0,o.jsx)("span",{className:`text-xs px-2 py-0.5 rounded-full ${k[g.risk]}`,children:"high"===g.risk?"High Risk":"medium"===g.risk?"Medium Risk":"low"===g.risk?"Safe":"Unclassified"}),(0,o.jsxs)("span",{className:"text-xs text-gray-500 ml-1",children:[l.filter(e=>p.has(e.name)).length,"/",l.length," allowed"]})]}),!n&&(0,o.jsxs)("div",{className:"flex items-center gap-2 ml-4",children:[(0,o.jsx)(d.Text,{className:"text-xs text-gray-500",children:y?"All on":b?"Partial":"All off"}),(0,o.jsx)(c.Checkbox,{checked:y,indeterminate:b,onChange:t=>((e,t)=>{if(n)return;let i=new Set(p);for(let r of h[e])t?i.add(r.name):i.delete(r.name);r(Array.from(i))})(e,t.target.checked),onClick:e=>e.stopPropagation()})]})]}),!v&&(0,o.jsx)("div",{className:"px-4 pt-2 pb-1 text-xs text-gray-500 bg-white border-b border-gray-100",children:g.description}),!v&&(0,o.jsx)("div",{className:"bg-white divide-y divide-gray-50",children:l.filter(e=>!i||e.name.toLowerCase().includes(i.toLowerCase())||(e.description??"").toLowerCase().includes(i.toLowerCase())).map(e=>{let t,r=(t=e.name,p.has(t));return(0,o.jsxs)("div",{className:`flex items-start gap-3 px-4 py-2.5 transition-colors hover:bg-gray-50 ${!n?"cursor-pointer":""} ${r?"":"opacity-60"}`,onClick:()=>m(e.name),children:[(0,o.jsx)(c.Checkbox,{checked:r,onChange:()=>m(e.name),disabled:n,onClick:e=>e.stopPropagation()}),(0,o.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,o.jsx)(d.Text,{className:"font-medium text-gray-900 text-sm",children:e.name}),e.description&&(0,o.jsx)(d.Text,{className:"text-xs text-gray-500 mt-0.5 leading-snug",children:e.description})]}),(0,o.jsx)("span",{className:`text-xs px-1.5 py-0.5 rounded flex-shrink-0 ${r?"bg-green-100 text-green-700":"bg-gray-100 text-gray-500"}`,children:r?"on":"off"})]},e.name)})})]},e)})})}],531516)},793130,e=>{"use strict";var t=e.i(290571),r=e.i(429427),n=e.i(371330),i=e.i(271645),s=e.i(394487),a=e.i(503269),o=e.i(214520),l=e.i(746725),c=e.i(914189),d=e.i(144279),u=e.i(294316),f=e.i(601893),h=e.i(140721),p=e.i(942803),m=e.i(233538),g=e.i(694421),y=e.i(700020),b=e.i(35889),x=e.i(998348),v=e.i(722678);let k=(0,i.createContext)(null);k.displayName="GroupContext";let w=i.Fragment,_=Object.assign((0,y.forwardRefWithAs)(function(e,t){var w;let _=(0,i.useId)(),C=(0,p.useProvidedId)(),j=(0,f.useDisabled)(),{id:S=C||`headlessui-switch-${_}`,disabled:E=j||!1,checked:O,defaultChecked:N,onChange:$,name:R,value:T,form:M,autoFocus:P=!1,...D}=e,I=(0,i.useContext)(k),[L,F]=(0,i.useState)(null),A=(0,i.useRef)(null),z=(0,u.useSyncRefs)(A,t,null===I?null:I.setSwitch,F),B=(0,o.useDefaultValue)(N),[W,q]=(0,a.useControllable)(O,$,null!=B&&B),H=(0,l.useDisposables)(),[U,K]=(0,i.useState)(!1),X=(0,c.useEvent)(()=>{K(!0),null==q||q(!W),H.nextFrame(()=>{K(!1)})}),Q=(0,c.useEvent)(e=>{if((0,m.isDisabledReactIssue7711)(e.currentTarget))return e.preventDefault();e.preventDefault(),X()}),V=(0,c.useEvent)(e=>{e.key===x.Keys.Space?(e.preventDefault(),X()):e.key===x.Keys.Enter&&(0,g.attemptSubmit)(e.currentTarget)}),G=(0,c.useEvent)(e=>e.preventDefault()),J=(0,v.useLabelledBy)(),Y=(0,b.useDescribedBy)(),{isFocusVisible:Z,focusProps:ee}=(0,r.useFocusRing)({autoFocus:P}),{isHovered:et,hoverProps:er}=(0,n.useHover)({isDisabled:E}),{pressed:en,pressProps:ei}=(0,s.useActivePress)({disabled:E}),es=(0,i.useMemo)(()=>({checked:W,disabled:E,hover:et,focus:Z,active:en,autofocus:P,changing:U}),[W,et,Z,en,E,U,P]),ea=(0,y.mergeProps)({id:S,ref:z,role:"switch",type:(0,d.useResolveButtonType)(e,L),tabIndex:-1===e.tabIndex?0:null!=(w=e.tabIndex)?w:0,"aria-checked":W,"aria-labelledby":J,"aria-describedby":Y,disabled:E||void 0,autoFocus:P,onClick:Q,onKeyUp:V,onKeyPress:G},ee,er,ei),eo=(0,i.useCallback)(()=>{if(void 0!==B)return null==q?void 0:q(B)},[q,B]),el=(0,y.useRender)();return i.default.createElement(i.default.Fragment,null,null!=R&&i.default.createElement(h.FormFields,{disabled:E,data:{[R]:T||"on"},overrides:{type:"checkbox",checked:W},form:M,onReset:eo}),el({ourProps:ea,theirProps:D,slot:es,defaultTag:"button",name:"Switch"}))}),{Group:function(e){var t;let[r,n]=(0,i.useState)(null),[s,a]=(0,v.useLabels)(),[o,l]=(0,b.useDescriptions)(),c=(0,i.useMemo)(()=>({switch:r,setSwitch:n}),[r,n]),d=(0,y.useRender)();return i.default.createElement(l,{name:"Switch.Description",value:o},i.default.createElement(a,{name:"Switch.Label",value:s,props:{htmlFor:null==(t=c.switch)?void 0:t.id,onClick(e){r&&(e.currentTarget instanceof HTMLLabelElement&&e.preventDefault(),r.click(),r.focus({preventScroll:!0}))}}},i.default.createElement(k.Provider,{value:c},d({ourProps:{},theirProps:e,slot:{},defaultTag:w,name:"Switch.Group"}))))},Label:v.Label,Description:b.Description});var C=e.i(888288),j=e.i(95779),S=e.i(444755),E=e.i(673706),O=e.i(829087);let N=(0,E.makeClassName)("Switch"),$=i.default.forwardRef((e,r)=>{let{checked:n,defaultChecked:s=!1,onChange:a,color:o,name:l,error:c,errorMessage:d,disabled:u,required:f,tooltip:h,id:p}=e,m=(0,t.__rest)(e,["checked","defaultChecked","onChange","color","name","error","errorMessage","disabled","required","tooltip","id"]),g={bgColor:o?(0,E.getColorClassNames)(o,j.colorPalette.background).bgColor:"bg-tremor-brand dark:bg-dark-tremor-brand",ringColor:o?(0,E.getColorClassNames)(o,j.colorPalette.ring).ringColor:"ring-tremor-brand-muted dark:ring-dark-tremor-brand-muted"},[y,b]=(0,C.default)(s,n),[x,v]=(0,i.useState)(!1),{tooltipProps:k,getReferenceProps:w}=(0,O.useTooltip)(300);return i.default.createElement("div",{className:"flex flex-row items-center justify-start"},i.default.createElement(O.default,Object.assign({text:h},k)),i.default.createElement("div",Object.assign({ref:(0,E.mergeRefs)([r,k.refs.setReference]),className:(0,S.tremorTwMerge)(N("root"),"flex flex-row relative h-5")},m,w),i.default.createElement("input",{type:"checkbox",className:(0,S.tremorTwMerge)(N("input"),"absolute w-5 h-5 cursor-pointer left-0 top-0 opacity-0"),name:l,required:f,checked:y,onChange:e=>{e.preventDefault()}}),i.default.createElement(_,{checked:y,onChange:e=>{b(e),null==a||a(e)},disabled:u,className:(0,S.tremorTwMerge)(N("switch"),"w-10 h-5 group relative inline-flex shrink-0 cursor-pointer items-center justify-center rounded-tremor-full","focus:outline-none",u?"cursor-not-allowed":""),onFocus:()=>v(!0),onBlur:()=>v(!1),id:p},i.default.createElement("span",{className:(0,S.tremorTwMerge)(N("sr-only"),"sr-only")},"Switch ",y?"on":"off"),i.default.createElement("span",{"aria-hidden":"true",className:(0,S.tremorTwMerge)(N("background"),y?g.bgColor:"bg-tremor-border dark:bg-dark-tremor-border","pointer-events-none absolute mx-auto h-3 w-9 rounded-tremor-full transition-colors duration-100 ease-in-out")}),i.default.createElement("span",{"aria-hidden":"true",className:(0,S.tremorTwMerge)(N("round"),y?(0,S.tremorTwMerge)(g.bgColor,"translate-x-5 border-tremor-background dark:border-dark-tremor-background"):"translate-x-0 bg-tremor-border dark:bg-dark-tremor-border border-tremor-background dark:border-dark-tremor-background","pointer-events-none absolute left-0 inline-block h-5 w-5 transform rounded-tremor-full border-2 shadow-tremor-input duration-100 ease-in-out transition",x?(0,S.tremorTwMerge)("ring-2",g.ringColor):"")}))),c&&d?i.default.createElement("p",{className:(0,S.tremorTwMerge)(N("errorMessage"),"text-sm text-red-500 mt-1 ")},d):null)});$.displayName="Switch",e.s(["Switch",()=>$],793130)},107233,37727,e=>{"use strict";var t=e.i(603908);e.s(["Plus",()=>t.default],107233);var r=e.i(841947);e.s(["X",()=>r.default],37727)},361653,e=>{"use strict";let t=(0,e.i(475254).default)("circle-alert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]]);e.s(["default",()=>t])},603908,e=>{"use strict";let t=(0,e.i(475254).default)("plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);e.s(["default",()=>t])},841947,e=>{"use strict";let t=(0,e.i(475254).default)("x",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);e.s(["default",()=>t])},158392,419470,e=>{"use strict";var t=e.i(843476),r=e.i(779241);let n={ttl:3600,lowest_latency_buffer:0},i=({routingStrategyArgs:e})=>{let i={ttl:"Sliding window to look back over when calculating the average latency of a deployment. Default - 1 hour (in seconds).",lowest_latency_buffer:"Shuffle between deployments within this % of the lowest latency. Default - 0 (i.e. always pick lowest latency)."};return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:"space-y-6",children:[(0,t.jsxs)("div",{className:"max-w-3xl",children:[(0,t.jsx)("h3",{className:"text-sm font-medium text-gray-900",children:"Latency-Based Configuration"}),(0,t.jsx)("p",{className:"text-xs text-gray-500 mt-1",children:"Fine-tune latency-based routing behavior"})]}),(0,t.jsx)("div",{className:"grid grid-cols-1 gap-6 lg:grid-cols-2 xl:grid-cols-3",children:Object.entries(e||n).map(([e,n])=>(0,t.jsx)("div",{className:"space-y-2",children:(0,t.jsxs)("label",{className:"block",children:[(0,t.jsx)("span",{className:"text-xs font-medium text-gray-700 uppercase tracking-wide",children:e.replace(/_/g," ")}),(0,t.jsx)("p",{className:"text-xs text-gray-500 mt-0.5 mb-2",children:i[e]||""}),(0,t.jsx)(r.TextInput,{name:e,defaultValue:"object"==typeof n?JSON.stringify(n,null,2):n?.toString(),className:"font-mono text-sm w-full"})]})},e))})]}),(0,t.jsx)("div",{className:"border-t border-gray-200"})]})},s=({routerSettings:e,routerFieldsMetadata:n})=>(0,t.jsxs)("div",{className:"space-y-6",children:[(0,t.jsxs)("div",{className:"max-w-3xl",children:[(0,t.jsx)("h3",{className:"text-sm font-medium text-gray-900",children:"Reliability & Retries"}),(0,t.jsx)("p",{className:"text-xs text-gray-500 mt-1",children:"Configure retry logic and failure handling"})]}),(0,t.jsx)("div",{className:"grid grid-cols-1 gap-6 lg:grid-cols-2 xl:grid-cols-3",children:Object.entries(e).filter(([e,t])=>"fallbacks"!=e&&"context_window_fallbacks"!=e&&"routing_strategy_args"!=e&&"routing_strategy"!=e&&"enable_tag_filtering"!=e).map(([e,i])=>(0,t.jsx)("div",{className:"space-y-2",children:(0,t.jsxs)("label",{className:"block",children:[(0,t.jsx)("span",{className:"text-xs font-medium text-gray-700 uppercase tracking-wide",children:n[e]?.ui_field_name||e}),(0,t.jsx)("p",{className:"text-xs text-gray-500 mt-0.5 mb-2",children:n[e]?.field_description||""}),(0,t.jsx)(r.TextInput,{name:e,defaultValue:null==i||"null"===i?"":"object"==typeof i?JSON.stringify(i,null,2):i?.toString()||"",placeholder:"—",className:"font-mono text-sm w-full"})]})},e))})]});var a=e.i(199133);let o=({selectedStrategy:e,availableStrategies:r,routingStrategyDescriptions:n,routerFieldsMetadata:i,onStrategyChange:s})=>(0,t.jsxs)("div",{className:"space-y-2 max-w-3xl",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"text-xs font-medium text-gray-700 uppercase tracking-wide",children:i.routing_strategy?.ui_field_name||"Routing Strategy"}),(0,t.jsx)("p",{className:"text-xs text-gray-500 mt-0.5 mb-2",children:i.routing_strategy?.field_description||""})]}),(0,t.jsx)("div",{className:"routing-strategy-select max-w-3xl",children:(0,t.jsx)(a.Select,{value:e,onChange:s,style:{width:"100%"},size:"large",children:r.map(e=>(0,t.jsx)(a.Select.Option,{value:e,label:e,children:(0,t.jsxs)("div",{className:"flex flex-col gap-0.5 py-1",children:[(0,t.jsx)("span",{className:"font-mono text-sm font-medium",children:e}),n[e]&&(0,t.jsx)("span",{className:"text-xs text-gray-500 font-normal",children:n[e]})]})},e))})})]});var l=e.i(793130);let c=({enabled:e,routerFieldsMetadata:r,onToggle:n})=>(0,t.jsx)("div",{className:"space-y-3 max-w-3xl",children:(0,t.jsxs)("div",{className:"flex items-start justify-between",children:[(0,t.jsxs)("div",{className:"flex-1",children:[(0,t.jsx)("label",{className:"text-xs font-medium text-gray-700 uppercase tracking-wide",children:r.enable_tag_filtering?.ui_field_name||"Enable Tag Filtering"}),(0,t.jsxs)("p",{className:"text-xs text-gray-500 mt-0.5",children:[r.enable_tag_filtering?.field_description||"",r.enable_tag_filtering?.link&&(0,t.jsxs)(t.Fragment,{children:[" ",(0,t.jsx)("a",{href:r.enable_tag_filtering.link,target:"_blank",rel:"noopener noreferrer",className:"text-blue-600 hover:text-blue-800 underline",children:"Learn more"})]})]})]}),(0,t.jsx)(l.Switch,{checked:e,onChange:n,className:"ml-4"})]})});e.s(["default",0,({value:e,onChange:r,routerFieldsMetadata:n,availableRoutingStrategies:a,routingStrategyDescriptions:l})=>(0,t.jsxs)("div",{className:"w-full space-y-8 py-2",children:[(0,t.jsxs)("div",{className:"space-y-6",children:[(0,t.jsxs)("div",{className:"max-w-3xl",children:[(0,t.jsx)("h3",{className:"text-sm font-medium text-gray-900",children:"Routing Settings"}),(0,t.jsx)("p",{className:"text-xs text-gray-500 mt-1",children:"Configure how requests are routed to deployments"})]}),a.length>0&&(0,t.jsx)(o,{selectedStrategy:e.selectedStrategy||e.routerSettings.routing_strategy||null,availableStrategies:a,routingStrategyDescriptions:l,routerFieldsMetadata:n,onStrategyChange:t=>{r({...e,selectedStrategy:t})}}),(0,t.jsx)(c,{enabled:e.enableTagFiltering,routerFieldsMetadata:n,onToggle:t=>{r({...e,enableTagFiltering:t})}})]}),(0,t.jsx)("div",{className:"border-t border-gray-200"}),"latency-based-routing"===e.selectedStrategy&&(0,t.jsx)(i,{routingStrategyArgs:e.routerSettings.routing_strategy_args}),(0,t.jsx)(s,{routerSettings:e.routerSettings,routerFieldsMetadata:n})]})],158392);var d=e.i(994388),u=e.i(653496),f=e.i(107233),h=e.i(271645),p=e.i(888259),m=e.i(592968),g=e.i(361653),g=g;let y=(0,e.i(475254).default)("arrow-down",[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]]);var b=e.i(37727);function x({group:e,onChange:r,availableModels:n,maxFallbacks:i}){let s=n.filter(t=>t!==e.primaryModel),o=e.fallbackModels.length{let n=[...e.fallbackModels];n.includes(t)&&(n=n.filter(e=>e!==t)),r({...e,primaryModel:t,fallbackModels:n})},showSearch:!0,getPopupContainer:e=>e.parentElement||document.body,filterOption:(e,t)=>(t?.label??"").toLowerCase().includes(e.toLowerCase()),options:n.map(e=>({label:e,value:e}))}),!e.primaryModel&&(0,t.jsxs)("div",{className:"mt-2 flex items-center gap-2 text-amber-600 text-xs bg-amber-50 p-2 rounded",children:[(0,t.jsx)(g.default,{className:"w-4 h-4"}),(0,t.jsx)("span",{children:"Select a model to begin configuring fallbacks"})]})]}),(0,t.jsx)("div",{className:"flex items-center justify-center -my-4 z-10",children:(0,t.jsxs)("div",{className:"bg-indigo-50 text-indigo-500 px-4 py-1 rounded-full text-xs font-bold border border-indigo-100 flex items-center gap-2 shadow-sm",children:[(0,t.jsx)(y,{className:"w-4 h-4"}),"IF FAILS, TRY..."]})}),(0,t.jsxs)("div",{className:`transition-opacity duration-300 ${!e.primaryModel?"opacity-50 pointer-events-none":"opacity-100"}`,children:[(0,t.jsxs)("label",{className:"block text-sm font-semibold text-gray-700 mb-2",children:["Fallback Chain ",(0,t.jsx)("span",{className:"text-red-500",children:"*"}),(0,t.jsxs)("span",{className:"text-xs text-gray-500 font-normal ml-2",children:["(Max ",i," fallbacks at a time)"]})]}),(0,t.jsxs)("div",{className:"bg-gray-50 rounded-xl p-4 border border-gray-200",children:[(0,t.jsxs)("div",{className:"mb-4",children:[(0,t.jsx)(a.Select,{mode:"multiple",className:"w-full",size:"large",placeholder:o?"Select fallback models to add...":`Maximum ${i} fallbacks reached`,value:e.fallbackModels,onChange:t=>{let n=t.slice(0,i);r({...e,fallbackModels:n})},disabled:!e.primaryModel,getPopupContainer:e=>e.parentElement||document.body,options:s.map(e=>({label:e,value:e})),optionRender:(r,n)=>{let i=e.fallbackModels.includes(r.value),s=i?e.fallbackModels.indexOf(r.value)+1:null;return(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[i&&null!==s&&(0,t.jsx)("span",{className:"flex items-center justify-center w-5 h-5 rounded bg-indigo-100 text-indigo-600 text-xs font-bold",children:s}),(0,t.jsx)("span",{children:r.label})]})},maxTagCount:"responsive",maxTagPlaceholder:e=>(0,t.jsx)(m.Tooltip,{styles:{root:{pointerEvents:"none"}},title:e.map(({value:e})=>e).join(", "),children:(0,t.jsxs)("span",{children:["+",e.length," more"]})}),showSearch:!0,filterOption:(e,t)=>(t?.label??"").toLowerCase().includes(e.toLowerCase())}),(0,t.jsx)("p",{className:"text-xs text-gray-500 mt-1 ml-1",children:o?`Search and select multiple models. Selected models will appear below in order. (${e.fallbackModels.length}/${i} used)`:`Maximum ${i} fallbacks reached. Remove some to add more.`})]}),(0,t.jsx)("div",{className:"space-y-2 min-h-[100px]",children:0===e.fallbackModels.length?(0,t.jsxs)("div",{className:"h-32 border-2 border-dashed border-gray-300 rounded-lg flex flex-col items-center justify-center text-gray-400",children:[(0,t.jsx)("span",{className:"text-sm",children:"No fallback models selected"}),(0,t.jsx)("span",{className:"text-xs mt-1",children:"Add models from the dropdown above"})]}):e.fallbackModels.map((n,i)=>(0,t.jsxs)("div",{className:"group flex items-center justify-between p-3 bg-white rounded-lg border border-gray-200 hover:border-indigo-300 hover:shadow-sm transition-all",children:[(0,t.jsxs)("div",{className:"flex items-center gap-3",children:[(0,t.jsx)("div",{className:"flex items-center justify-center w-6 h-6 rounded bg-gray-100 text-gray-400 group-hover:text-indigo-500 group-hover:bg-indigo-50",children:(0,t.jsx)("span",{className:"text-xs font-bold",children:i+1})}),(0,t.jsx)("div",{children:(0,t.jsx)("span",{className:"font-medium text-gray-800",children:n})})]}),(0,t.jsx)("button",{type:"button",onClick:()=>{let t;return t=e.fallbackModels.filter((e,t)=>t!==i),void r({...e,fallbackModels:t})},className:"opacity-0 group-hover:opacity-100 transition-opacity text-gray-400 hover:text-red-500 p-1",children:(0,t.jsx)(b.X,{className:"w-4 h-4"})})]},`${n}-${i}`))})]})]})]})}function v({groups:e,onGroupsChange:r,availableModels:n,maxFallbacks:i=10,maxGroups:s=5}){let[a,o]=(0,h.useState)(e.length>0?e[0].id:"1");(0,h.useEffect)(()=>{e.length>0?e.some(e=>e.id===a)||o(e[0].id):o("1")},[e]);let l=()=>{if(e.length>=s)return;let t=Date.now().toString();r([...e,{id:t,primaryModel:null,fallbackModels:[]}]),o(t)},c=t=>{r(e.map(e=>e.id===t.id?t:e))},m=e.map((r,s)=>{let a=r.primaryModel?r.primaryModel:`Group ${s+1}`;return{key:r.id,label:a,closable:e.length>1,children:(0,t.jsx)(x,{group:r,onChange:c,availableModels:n,maxFallbacks:i})}});return 0===e.length?(0,t.jsxs)("div",{className:"text-center py-12 bg-gray-50 rounded-lg border border-dashed border-gray-300",children:[(0,t.jsx)("p",{className:"text-gray-500 mb-4",children:"No fallback groups configured"}),(0,t.jsx)(d.Button,{variant:"primary",onClick:l,icon:()=>(0,t.jsx)(f.Plus,{className:"w-4 h-4"}),children:"Create First Group"})]}):(0,t.jsx)(u.Tabs,{type:"editable-card",activeKey:a,onChange:o,onEdit:(t,n)=>{"add"===n?l():"remove"===n&&e.length>1&&(t=>{if(1===e.length)return p.default.warning("At least one group is required");let n=e.filter(e=>e.id!==t);r(n),a===t&&n.length>0&&o(n[n.length-1].id)})(t)},items:m,className:"fallback-tabs",tabBarStyle:{marginBottom:0},hideAdd:e.length>=s})}e.s(["FallbackSelectionForm",()=>v],419470)},309426,e=>{"use strict";var t=e.i(290571),r=e.i(444755),n=e.i(673706),i=e.i(271645),s=e.i(46757);let a=(0,n.makeClassName)("Col"),o=i.default.forwardRef((e,n)=>{let o,l,c,d,{numColSpan:u=1,numColSpanSm:f,numColSpanMd:h,numColSpanLg:p,children:m,className:g}=e,y=(0,t.__rest)(e,["numColSpan","numColSpanSm","numColSpanMd","numColSpanLg","children","className"]),b=(e,t)=>e&&Object.keys(t).includes(String(e))?t[e]:"";return i.default.createElement("div",Object.assign({ref:n,className:(0,r.tremorTwMerge)(a("root"),(o=b(u,s.colSpan),l=b(f,s.colSpanSm),c=b(h,s.colSpanMd),d=b(p,s.colSpanLg),(0,r.tremorTwMerge)(o,l,c,d)),g)},y),m)});o.displayName="Col",e.s(["Col",()=>o],309426)},519756,e=>{"use strict";e.i(247167);var t=e.i(931067),r=e.i(271645);let n={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M400 317.7h73.9V656c0 4.4 3.6 8 8 8h60c4.4 0 8-3.6 8-8V317.7H624c6.7 0 10.4-7.7 6.3-12.9L518.3 163a8 8 0 00-12.6 0l-112 141.7c-4.1 5.3-.4 13 6.3 13zM878 626h-60c-4.4 0-8 3.6-8 8v154H214V634c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8v198c0 17.7 14.3 32 32 32h684c17.7 0 32-14.3 32-32V634c0-4.4-3.6-8-8-8z"}}]},name:"upload",theme:"outlined"};var i=e.i(9583),s=r.forwardRef(function(e,s){return r.createElement(i.default,(0,t.default)({},e,{ref:s,icon:n}))});e.s(["UploadOutlined",0,s],519756)},981339,e=>{"use strict";var t=e.i(185793);e.s(["Skeleton",()=>t.default])},500330,e=>{"use strict";var t=e.i(727749);function r(e,t){let r=structuredClone(e);for(let[e,n]of Object.entries(t))e in r&&(r[e]=n);return r}let n=(e,t=0,r=!1,n=!0)=>{if(null==e||!Number.isFinite(e)||0===e&&!n)return"-";let i={minimumFractionDigits:t,maximumFractionDigits:t};if(!r)return e.toLocaleString("en-US",i);let s=e<0?"-":"",a=Math.abs(e),o=a,l="";return a>=1e6?(o=a/1e6,l="M"):a>=1e3&&(o=a/1e3,l="K"),`${s}${o.toLocaleString("en-US",i)}${l}`},i=async(e,r="Copied to clipboard")=>{if(!e)return!1;if(!navigator||!navigator.clipboard||!navigator.clipboard.writeText)return s(e,r);try{return await navigator.clipboard.writeText(e),t.default.success(r),!0}catch(t){return console.error("Clipboard API failed: ",t),s(e,r)}},s=(e,r)=>{try{let n=document.createElement("textarea");n.value=e,n.style.position="fixed",n.style.left="-999999px",n.style.top="-999999px",n.setAttribute("readonly",""),document.body.appendChild(n),n.focus(),n.select();let i=document.execCommand("copy");if(document.body.removeChild(n),i)return t.default.success(r),!0;throw Error("execCommand failed")}catch(e){return t.default.fromBackend("Failed to copy to clipboard"),console.error("Failed to copy: ",e),!1}};e.s(["copyToClipboard",0,i,"formatNumberWithCommas",0,n,"getSpendString",0,(e,t=6)=>{if(null==e||!Number.isFinite(e)||0===e)return"-";let r=n(e,t,!1,!1);if(0===Number(r.replace(/,/g,""))){let e=(1/10**t).toFixed(t);return`< $${e}`}return`$${r}`},"updateExistingKeys",()=>r])},663435,152473,e=>{"use strict";var t=e.i(843476),r=e.i(271645),n=e.i(199133),i=e.i(898586),s=e.i(56456);let a={enabled:!0,leading:!1,trailing:!0,wait:0,onExecute:()=>{}};class o{constructor(e,t){this.fn=e,this._canLeadingExecute=!0,this._isPending=!1,this._executionCount=0,this._options={...a,...t}}setOptions(e){return this._options={...this._options,...e},this._options.enabled||(this._isPending=!1),this._options}getOptions(){return this._options}maybeExecute(...e){this._options.leading&&this._canLeadingExecute&&(this.executeFunction(...e),this._canLeadingExecute=!1),(this._options.leading||this._options.trailing)&&(this._isPending=!0),this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=setTimeout(()=>{this._canLeadingExecute=!0,this._isPending=!1,this._options.trailing&&this.executeFunction(...e)},this._options.wait)}executeFunction(...e){this._options.enabled&&(this.fn(...e),this._executionCount++,this._options.onExecute(this))}cancel(){this._timeoutId&&(clearTimeout(this._timeoutId),this._canLeadingExecute=!0,this._isPending=!1)}getExecutionCount(){return this._executionCount}getIsPending(){return this._options.enabled&&this._isPending}}function l(e,t){let[n,i]=(0,r.useState)(e),s=function(e,t){let[n]=(0,r.useState)(()=>{var r;return Object.getOwnPropertyNames(Object.getPrototypeOf(r=new o(e,t))).filter(e=>"function"==typeof r[e]).reduce((e,t)=>{let n=r[t];return"function"==typeof n&&(e[t]=n.bind(r)),e},{})});return n.setOptions(t),n}(i,t);return[n,s.maybeExecute,s]}e.s(["useDebouncedState",()=>l],152473);var c=e.i(785242);let{Text:d}=i.Typography;e.s(["default",0,({value:e,onChange:i,onTeamSelect:a,disabled:o,organizationId:u,pageSize:f=20})=>{let[h,p]=(0,r.useState)(""),[m,g]=l("",{wait:300}),{data:y,fetchNextPage:b,hasNextPage:x,isFetchingNextPage:v,isLoading:k}=(0,c.useInfiniteTeams)(f,m||void 0,u),w=(0,r.useMemo)(()=>{if(!y?.pages)return[];let e=new Set,t=[];for(let r of y.pages)for(let n of r.teams)e.has(n.team_id)||(e.add(n.team_id),t.push(n));return t},[y]);return(0,t.jsx)(n.Select,{showSearch:!0,placeholder:"Search or select a team",value:e||void 0,onChange:e=>{i?.(e??""),a&&a(e?w.find(t=>t.team_id===e)??null:null)},disabled:o,allowClear:!0,filterOption:!1,onSearch:e=>{p(e),g(e)},searchValue:h,onPopupScroll:e=>{let t=e.currentTarget;(t.scrollTop+t.clientHeight)/t.scrollHeight>=.8&&x&&!v&&b()},loading:k,notFoundContent:k?(0,t.jsx)(s.LoadingOutlined,{spin:!0}):"No teams found","data-testid":"team-dropdown",popupRender:e=>(0,t.jsxs)(t.Fragment,{children:[e,v&&(0,t.jsx)("div",{style:{textAlign:"center",padding:8},children:(0,t.jsx)(s.LoadingOutlined,{spin:!0})})]}),children:w.map(e=>(0,t.jsxs)(n.Select.Option,{value:e.team_id,children:[(0,t.jsx)("span",{className:"font-medium",children:e.team_alias})," ",(0,t.jsxs)(d,{type:"secondary",children:["(",e.team_id,")"]})]},e.team_id))})}],663435)},743151,(e,t,r)=>{"use strict";function n(e){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}Object.defineProperty(r,"__esModule",{value:!0}),r.CopyToClipboard=void 0;var i=o(e.r(271645)),s=o(e.r(844343)),a=["text","onCopy","options","children"];function o(e){return e&&e.__esModule?e:{default:e}}function l(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function c(e){for(var t=1;t=0||(i[r]=e[r]);return i}(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(n=0;n=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(i[r]=e[r])}return i}(e,a),n=i.default.Children.only(t);return i.default.cloneElement(n,c(c({},r),{},{onClick:this.onClick}))}}],function(e,t){for(var r=0;r{"use strict";var n=e.r(743151).CopyToClipboard;n.CopyToClipboard=n,t.exports=n},59935,(e,t,r)=>{var n;let i;e.e,n=function e(){var t,r="u">typeof self?self:"u">typeof window?window:void 0!==r?r:{},n=!r.document&&!!r.postMessage,i=r.IS_PAPA_WORKER||!1,s={},a=0,o={};function l(e){this._handle=null,this._finished=!1,this._completed=!1,this._halted=!1,this._input=null,this._baseIndex=0,this._partialLine="",this._rowCount=0,this._start=0,this._nextChunk=null,this.isFirstChunk=!0,this._completeResults={data:[],errors:[],meta:{}},(function(e){var t=x(e);t.chunkSize=parseInt(t.chunkSize),e.step||e.chunk||(t.chunkSize=null),this._handle=new h(t),(this._handle.streamer=this)._config=t}).call(this,e),this.parseChunk=function(e,t){var n=parseInt(this._config.skipFirstNLines)||0;if(this.isFirstChunk&&0=this._config.preview,i)r.postMessage({results:s,workerId:o.WORKER_ID,finished:n});else if(k(this._config.chunk)&&!t){if(this._config.chunk(s,this._handle),this._handle.paused()||this._handle.aborted())return void(this._halted=!0);this._completeResults=s=void 0}return this._config.step||this._config.chunk||(this._completeResults.data=this._completeResults.data.concat(s.data),this._completeResults.errors=this._completeResults.errors.concat(s.errors),this._completeResults.meta=s.meta),this._completed||!n||!k(this._config.complete)||s&&s.meta.aborted||(this._config.complete(this._completeResults,this._input),this._completed=!0),n||s&&s.meta.paused||this._nextChunk(),s}this._halted=!0},this._sendError=function(e){k(this._config.error)?this._config.error(e):i&&this._config.error&&r.postMessage({workerId:o.WORKER_ID,error:e,finished:!1})}}function c(e){var t;(e=e||{}).chunkSize||(e.chunkSize=o.RemoteChunkSize),l.call(this,e),this._nextChunk=n?function(){this._readChunk(),this._chunkLoaded()}:function(){this._readChunk()},this.stream=function(e){this._input=e,this._nextChunk()},this._readChunk=function(){if(this._finished)this._chunkLoaded();else{if(t=new XMLHttpRequest,this._config.withCredentials&&(t.withCredentials=this._config.withCredentials),n||(t.onload=v(this._chunkLoaded,this),t.onerror=v(this._chunkError,this)),t.open(this._config.downloadRequestBody?"POST":"GET",this._input,!n),this._config.downloadRequestHeaders){var e,r,i=this._config.downloadRequestHeaders;for(r in i)t.setRequestHeader(r,i[r])}this._config.chunkSize&&(e=this._start+this._config.chunkSize-1,t.setRequestHeader("Range","bytes="+this._start+"-"+e));try{t.send(this._config.downloadRequestBody)}catch(e){this._chunkError(e.message)}n&&0===t.status&&this._chunkError()}},this._chunkLoaded=function(){let e;4===t.readyState&&(t.status<200||400<=t.status?this._chunkError():(this._start+=this._config.chunkSize||t.responseText.length,this._finished=!this._config.chunkSize||this._start>=(null!==(e=(e=t).getResponseHeader("Content-Range"))?parseInt(e.substring(e.lastIndexOf("/")+1)):-1),this.parseChunk(t.responseText)))},this._chunkError=function(e){e=t.statusText||e,this._sendError(Error(e))}}function d(e){(e=e||{}).chunkSize||(e.chunkSize=o.LocalChunkSize),l.call(this,e);var t,r,n="u">typeof FileReader;this.stream=function(e){this._input=e,r=e.slice||e.webkitSlice||e.mozSlice,n?((t=new FileReader).onload=v(this._chunkLoaded,this),t.onerror=v(this._chunkError,this)):t=new FileReaderSync,this._nextChunk()},this._nextChunk=function(){this._finished||this._config.preview&&!(this._rowCount=this._input.size,this.parseChunk(e.target.result)},this._chunkError=function(){this._sendError(t.error)}}function u(e){var t;l.call(this,e=e||{}),this.stream=function(e){return t=e,this._nextChunk()},this._nextChunk=function(){var e,r;if(!this._finished)return t=(e=this._config.chunkSize)?(r=t.substring(0,e),t.substring(e)):(r=t,""),this._finished=!t,this.parseChunk(r)}}function f(e){l.call(this,e=e||{});var t=[],r=!0,n=!1;this.pause=function(){l.prototype.pause.apply(this,arguments),this._input.pause()},this.resume=function(){l.prototype.resume.apply(this,arguments),this._input.resume()},this.stream=function(e){this._input=e,this._input.on("data",this._streamData),this._input.on("end",this._streamEnd),this._input.on("error",this._streamError)},this._checkIsFinished=function(){n&&1===t.length&&(this._finished=!0)},this._nextChunk=function(){this._checkIsFinished(),t.length?this.parseChunk(t.shift()):r=!0},this._streamData=v(function(e){try{t.push("string"==typeof e?e:e.toString(this._config.encoding)),r&&(r=!1,this._checkIsFinished(),this.parseChunk(t.shift()))}catch(e){this._streamError(e)}},this),this._streamError=v(function(e){this._streamCleanUp(),this._sendError(e)},this),this._streamEnd=v(function(){this._streamCleanUp(),n=!0,this._streamData("")},this),this._streamCleanUp=v(function(){this._input.removeListener("data",this._streamData),this._input.removeListener("end",this._streamEnd),this._input.removeListener("error",this._streamError)},this)}function h(e){var t,r,n,i,s=/^\s*-?(\d+\.?|\.\d+|\d+\.\d+)([eE][-+]?\d+)?\s*$/,a=/^((\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\.\d+([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z)))$/,l=this,c=0,d=0,u=!1,f=!1,h=[],g={data:[],errors:[],meta:{}};function y(t){return"greedy"===e.skipEmptyLines?""===t.join("").trim():1===t.length&&0===t[0].length}function b(){if(g&&n&&(w("Delimiter","UndetectableDelimiter","Unable to auto-detect delimiting character; defaulted to '"+o.DefaultDelimiter+"'"),n=!1),e.skipEmptyLines&&(g.data=g.data.filter(function(e){return!y(e)})),v()){if(g)if(Array.isArray(g.data[0])){for(var t,r=0;v()&&r(e.dynamicTypingFunction&&void 0===e.dynamicTyping[t]&&(e.dynamicTyping[t]=e.dynamicTypingFunction(t)),!0===(e.dynamicTyping[t]||e.dynamicTyping))?"true"===r||"TRUE"===r||"false"!==r&&"FALSE"!==r&&((e=>{if(s.test(e)&&-0x20000000000000<(e=parseFloat(e))&&e<0x20000000000000)return 1})(r)?parseFloat(r):a.test(r)?new Date(r):""===r?null:r):r)(o=e.header?i>=h.length?"__parsed_extra":h[i]:o,l=e.transform?e.transform(l,o):l);"__parsed_extra"===o?(n[o]=n[o]||[],n[o].push(l)):n[o]=l}return e.header&&(i>h.length?w("FieldMismatch","TooManyFields","Too many fields: expected "+h.length+" fields but parsed "+i,d+r):ie.preview?r.abort():(g.data=g.data[0],i(g,l))))}),this.parse=function(i,s,a){var l=e.quoteChar||'"',l=(e.newline||(e.newline=this.guessLineEndings(i,l)),n=!1,e.delimiter?k(e.delimiter)&&(e.delimiter=e.delimiter(i),g.meta.delimiter=e.delimiter):((l=((t,r,n,i,s)=>{var a,l,c,d;s=s||[","," ","|",";",o.RECORD_SEP,o.UNIT_SEP];for(var u=0;u=r.length/2?"\r\n":"\r"}}function p(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function m(e){var t=(e=e||{}).delimiter,r=e.newline,n=e.comments,i=e.step,s=e.preview,a=e.fastMode,l=null,c=!1,d=null==e.quoteChar?'"':e.quoteChar,u=d;if(void 0!==e.escapeChar&&(u=e.escapeChar),("string"!=typeof t||-1=s)return F(!0);break}C.push({type:"Quotes",code:"InvalidQuotes",message:"Trailing quote on quoted field is malformed",row:_.length,index:f}),T++}}else if(n&&0===j.length&&o.substring(f,f+v)===n){if(-1===$)return F();f=$+x,$=o.indexOf(r,f),N=o.indexOf(t,f)}else if(-1!==N&&(N<$||-1===$))j.push(o.substring(f,N)),f=N+b,N=o.indexOf(t,f);else{if(-1===$)break;if(j.push(o.substring(f,$)),L($+x),w&&(A(),h))return F();if(s&&_.length>=s)return F(!0)}return I();function P(e){_.push(e),S=f}function D(e){return -1!==e&&(e=o.substring(T+1,e))&&""===e.trim()?e.length:0}function I(e){return g||(void 0===e&&(e=o.substring(f)),j.push(e),f=y,P(j),w&&A()),F()}function L(e){f=e,P(j),j=[],$=o.indexOf(r,f)}function F(n){if(e.header&&!m&&_.length&&!c){var i=_[0],s=Object.create(null),a=new Set(i);let t=!1;for(let r=0;r{if("object"==typeof t){if("string"!=typeof t.delimiter||o.BAD_DELIMITERS.filter(function(e){return -1!==t.delimiter.indexOf(e)}).length||(i=t.delimiter),("boolean"==typeof t.quotes||"function"==typeof t.quotes||Array.isArray(t.quotes))&&(r=t.quotes),"boolean"!=typeof t.skipEmptyLines&&"string"!=typeof t.skipEmptyLines||(c=t.skipEmptyLines),"string"==typeof t.newline&&(s=t.newline),"string"==typeof t.quoteChar&&(a=t.quoteChar),"boolean"==typeof t.header&&(n=t.header),Array.isArray(t.columns)){if(0===t.columns.length)throw Error("Option columns is empty");d=t.columns}void 0!==t.escapeChar&&(l=t.escapeChar+a),t.escapeFormulae instanceof RegExp?u=t.escapeFormulae:"boolean"==typeof t.escapeFormulae&&t.escapeFormulae&&(u=/^[=+\-@\t\r].*$/)}})(),RegExp(p(a),"g"));if("string"==typeof e&&(e=JSON.parse(e)),Array.isArray(e)){if(!e.length||Array.isArray(e[0]))return h(null,e,c);if("object"==typeof e[0])return h(d||Object.keys(e[0]),e,c)}else if("object"==typeof e)return"string"==typeof e.data&&(e.data=JSON.parse(e.data)),Array.isArray(e.data)&&(e.fields||(e.fields=e.meta&&e.meta.fields||d),e.fields||(e.fields=Array.isArray(e.data[0])?e.fields:"object"==typeof e.data[0]?Object.keys(e.data[0]):[]),Array.isArray(e.data[0])||"object"==typeof e.data[0]||(e.data=[e.data])),h(e.fields||[],e.data||[],c);throw Error("Unable to serialize unrecognized input");function h(e,t,r){var a="",o=("string"==typeof e&&(e=JSON.parse(e)),"string"==typeof t&&(t=JSON.parse(t)),Array.isArray(e)&&0{for(var r=0;r{"use strict";var t=e.i(764205),r=e.i(266027);let n=(0,e.i(243652).createQueryKeys)("uiSettings");e.s(["useUISettings",0,()=>(0,r.useQuery)({queryKey:n.list({}),queryFn:async()=>await (0,t.getUiSettings)(),staleTime:36e5,gcTime:36e5})])},250980,e=>{"use strict";var t=e.i(271645);let r=t.forwardRef(function(e,r){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:r},e),t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 9v3m0 0v3m0-3h3m-3 0H9m12 0a9 9 0 11-18 0 9 9 0 0118 0z"}))});e.s(["PlusCircleIcon",0,r],250980)},916940,e=>{"use strict";var t=e.i(843476),r=e.i(271645),n=e.i(199133),i=e.i(764205);e.s(["default",0,({onChange:e,value:s,className:a,accessToken:o,placeholder:l="Select vector stores",disabled:c=!1})=>{let[d,u]=(0,r.useState)([]),[f,h]=(0,r.useState)(!1);return(0,r.useEffect)(()=>{(async()=>{if(o){h(!0);try{let e=await (0,i.vectorStoreListCall)(o);e.data&&u(e.data)}catch(e){console.error("Error fetching vector stores:",e)}finally{h(!1)}}})()},[o]),(0,t.jsx)("div",{children:(0,t.jsx)(n.Select,{mode:"multiple",placeholder:l,onChange:e,value:s,loading:f,className:a,allowClear:!0,options:d.map(e=>({label:`${e.vector_store_name||e.vector_store_id} (${e.vector_store_id})`,value:e.vector_store_id,title:e.vector_store_description||e.vector_store_id})),optionFilterProp:"label",showSearch:!0,style:{width:"100%"},disabled:c})})}])},737434,e=>{"use strict";var t=e.i(184163);e.s(["DownloadOutlined",()=>t.default])},689020,e=>{"use strict";var t=e.i(764205);let r=async e=>{try{let r=await (0,t.modelHubCall)(e);if(console.log("model_info:",r),r?.data.length>0){let e=r.data.map(e=>({model_group:e.model_group,mode:e?.mode}));return e.sort((e,t)=>e.model_group.localeCompare(t.model_group)),e}return[]}catch(e){throw console.error("Error fetching model info:",e),e}};e.s(["fetchAvailableModels",0,r])},955135,e=>{"use strict";var t=e.i(597440);e.s(["DeleteOutlined",()=>t.default])},309821,e=>{"use strict";e.i(247167);var t=e.i(271645);e.i(262370);var r=e.i(135551),n=e.i(201072),i=e.i(121229),s=e.i(726289),a=e.i(864517),o=e.i(343794),l=e.i(529681),c=e.i(242064),d=e.i(931067),u=e.i(209428),f=e.i(703923),h={percent:0,prefixCls:"rc-progress",strokeColor:"#2db7f5",strokeLinecap:"round",strokeWidth:1,trailColor:"#D9D9D9",trailWidth:1,gapPosition:"bottom"},p=function(){var e=(0,t.useRef)([]),r=(0,t.useRef)(null);return(0,t.useEffect)(function(){var t=Date.now(),n=!1;e.current.forEach(function(e){if(e){n=!0;var i=e.style;i.transitionDuration=".3s, .3s, .3s, .06s",r.current&&t-r.current<100&&(i.transitionDuration="0s, 0s")}}),n&&(r.current=Date.now())}),e.current},m=e.i(410160),g=e.i(392221),y=e.i(654310),b=0,x=(0,y.default)();let v=function(e){var r=t.useState(),n=(0,g.default)(r,2),i=n[0],s=n[1];return t.useEffect(function(){var e;s("rc_progress_".concat((x?(e=b,b+=1):e="TEST_OR_SSR",e)))},[]),e||i};var k=function(e){var r=e.bg,n=e.children;return t.createElement("div",{style:{width:"100%",height:"100%",background:r}},n)};function w(e,t){return Object.keys(e).map(function(r){var n=parseFloat(r),i="".concat(Math.floor(n*t),"%");return"".concat(e[r]," ").concat(i)})}var _=t.forwardRef(function(e,r){var n=e.prefixCls,i=e.color,s=e.gradientId,a=e.radius,o=e.style,l=e.ptg,c=e.strokeLinecap,d=e.strokeWidth,u=e.size,f=e.gapDegree,h=i&&"object"===(0,m.default)(i),p=u/2,g=t.createElement("circle",{className:"".concat(n,"-circle-path"),r:a,cx:p,cy:p,stroke:h?"#FFF":void 0,strokeLinecap:c,strokeWidth:d,opacity:+(0!==l),style:o,ref:r});if(!h)return g;var y="".concat(s,"-conic"),b=w(i,(360-f)/360),x=w(i,1),v="conic-gradient(from ".concat(f?"".concat(180+f/2,"deg"):"0deg",", ").concat(b.join(", "),")"),_="linear-gradient(to ".concat(f?"bottom":"top",", ").concat(x.join(", "),")");return t.createElement(t.Fragment,null,t.createElement("mask",{id:y},g),t.createElement("foreignObject",{x:0,y:0,width:u,height:u,mask:"url(#".concat(y,")")},t.createElement(k,{bg:_},t.createElement(k,{bg:v}))))}),C=function(e,t,r,n,i,s,a,o,l,c){var d=arguments.length>10&&void 0!==arguments[10]?arguments[10]:0,u=(100-n)/100*t;return"round"===l&&100!==n&&(u+=c/2)>=t&&(u=t-.01),{stroke:"string"==typeof o?o:void 0,strokeDasharray:"".concat(t,"px ").concat(e),strokeDashoffset:u+d,transform:"rotate(".concat(i+r/100*360*((360-s)/360)+(0===s?0:({bottom:0,top:180,left:90,right:-90})[a]),"deg)"),transformOrigin:"".concat(50,"px ").concat(50,"px"),transition:"stroke-dashoffset .3s ease 0s, stroke-dasharray .3s ease 0s, stroke .3s, stroke-width .06s ease .3s, opacity .3s ease 0s",fillOpacity:0}},j=["id","prefixCls","steps","strokeWidth","trailWidth","gapDegree","gapPosition","trailColor","strokeLinecap","style","className","strokeColor","percent"];function S(e){var t=null!=e?e:[];return Array.isArray(t)?t:[t]}let E=function(e){var r,n,i,s,a=(0,u.default)((0,u.default)({},h),e),l=a.id,c=a.prefixCls,g=a.steps,y=a.strokeWidth,b=a.trailWidth,x=a.gapDegree,k=void 0===x?0:x,w=a.gapPosition,E=a.trailColor,O=a.strokeLinecap,N=a.style,$=a.className,R=a.strokeColor,T=a.percent,M=(0,f.default)(a,j),P=v(l),D="".concat(P,"-gradient"),I=50-y/2,L=2*Math.PI*I,F=k>0?90+k/2:-90,A=(360-k)/360*L,z="object"===(0,m.default)(g)?g:{count:g,gap:2},B=z.count,W=z.gap,q=S(T),H=S(R),U=H.find(function(e){return e&&"object"===(0,m.default)(e)}),K=U&&"object"===(0,m.default)(U)?"butt":O,X=C(L,A,0,100,F,k,w,E,K,y),Q=p();return t.createElement("svg",(0,d.default)({className:(0,o.default)("".concat(c,"-circle"),$),viewBox:"0 0 ".concat(100," ").concat(100),style:N,id:l,role:"presentation"},M),!B&&t.createElement("circle",{className:"".concat(c,"-circle-trail"),r:I,cx:50,cy:50,stroke:E,strokeLinecap:K,strokeWidth:b||y,style:X}),B?(r=Math.round(B*(q[0]/100)),n=100/B,i=0,Array(B).fill(null).map(function(e,s){var a=s<=r-1?H[0]:E,o=a&&"object"===(0,m.default)(a)?"url(#".concat(D,")"):void 0,l=C(L,A,i,n,F,k,w,a,"butt",y,W);return i+=(A-l.strokeDashoffset+W)*100/A,t.createElement("circle",{key:s,className:"".concat(c,"-circle-path"),r:I,cx:50,cy:50,stroke:o,strokeWidth:y,opacity:1,style:l,ref:function(e){Q[s]=e}})})):(s=0,q.map(function(e,r){var n=H[r]||H[H.length-1],i=C(L,A,s,e,F,k,w,n,K,y);return s+=e,t.createElement(_,{key:r,color:n,ptg:e,radius:I,prefixCls:c,gradientId:D,style:i,strokeLinecap:K,strokeWidth:y,gapDegree:k,ref:function(e){Q[r]=e},size:100})}).reverse()))};var O=e.i(491816);e.i(765846);var N=e.i(896091);function $(e){return!e||e<0?0:e>100?100:e}function R({success:e,successPercent:t}){let r=t;return e&&"progress"in e&&(r=e.progress),e&&"percent"in e&&(r=e.percent),r}let T=(e,t,r)=>{var n,i,s,a;let o=-1,l=-1;if("step"===t){let t=r.steps,n=r.strokeWidth;"string"==typeof e||void 0===e?(o="small"===e?2:14,l=null!=n?n:8):"number"==typeof e?[o,l]=[e,e]:[o=14,l=8]=Array.isArray(e)?e:[e.width,e.height],o*=t}else if("line"===t){let t=null==r?void 0:r.strokeWidth;"string"==typeof e||void 0===e?l=t||("small"===e?6:8):"number"==typeof e?[o,l]=[e,e]:[o=-1,l=8]=Array.isArray(e)?e:[e.width,e.height]}else("circle"===t||"dashboard"===t)&&("string"==typeof e||void 0===e?[o,l]="small"===e?[60,60]:[120,120]:"number"==typeof e?[o,l]=[e,e]:Array.isArray(e)&&(o=null!=(i=null!=(n=e[0])?n:e[1])?i:120,l=null!=(a=null!=(s=e[0])?s:e[1])?a:120));return[o,l]},M=e=>{let{prefixCls:r,trailColor:n=null,strokeLinecap:i="round",gapPosition:s,gapDegree:a,width:l=120,type:c,children:d,success:u,size:f=l,steps:h}=e,[p,m]=T(f,"circle"),{strokeWidth:g}=e;void 0===g&&(g=Math.max(3/p*100,6));let y=t.useMemo(()=>a||0===a?a:"dashboard"===c?75:void 0,[a,c]),b=(({percent:e,success:t,successPercent:r})=>{let n=$(R({success:t,successPercent:r}));return[n,$($(e)-n)]})(e),x="[object Object]"===Object.prototype.toString.call(e.strokeColor),v=(({success:e={},strokeColor:t})=>{let{strokeColor:r}=e;return[r||N.presetPrimaryColors.green,t||null]})({success:u,strokeColor:e.strokeColor}),k=(0,o.default)(`${r}-inner`,{[`${r}-circle-gradient`]:x}),w=t.createElement(E,{steps:h,percent:h?b[1]:b,strokeWidth:g,trailWidth:g,strokeColor:h?v[1]:v,strokeLinecap:i,trailColor:n,prefixCls:r,gapDegree:y,gapPosition:s||"dashboard"===c&&"bottom"||void 0}),_=p<=20,C=t.createElement("div",{className:k,style:{width:p,height:m,fontSize:.15*p+6}},w,!_&&d);return _?t.createElement(O.default,{title:d},C):C};e.i(296059);var P=e.i(694758),D=e.i(915654),I=e.i(183293),L=e.i(246422),F=e.i(838378);let A="--progress-line-stroke-color",z="--progress-percent",B=e=>{let t=e?"100%":"-100%";return new P.Keyframes(`antProgress${e?"RTL":"LTR"}Active`,{"0%":{transform:`translateX(${t}) scaleX(0)`,opacity:.1},"20%":{transform:`translateX(${t}) scaleX(0)`,opacity:.5},to:{transform:"translateX(0) scaleX(1)",opacity:0}})},W=(0,L.genStyleHooks)("Progress",e=>{let t=e.calc(e.marginXXS).div(2).equal(),r=(0,F.mergeToken)(e,{progressStepMarginInlineEnd:t,progressStepMinWidth:t,progressActiveMotionDuration:"2.4s"});return[(e=>{let{componentCls:t,iconCls:r}=e;return{[t]:Object.assign(Object.assign({},(0,I.resetComponent)(e)),{display:"inline-block","&-rtl":{direction:"rtl"},"&-line":{position:"relative",width:"100%",fontSize:e.fontSize},[`${t}-outer`]:{display:"inline-flex",alignItems:"center",width:"100%"},[`${t}-inner`]:{position:"relative",display:"inline-block",width:"100%",flex:1,overflow:"hidden",verticalAlign:"middle",backgroundColor:e.remainingColor,borderRadius:e.lineBorderRadius},[`${t}-inner:not(${t}-circle-gradient)`]:{[`${t}-circle-path`]:{stroke:e.defaultColor}},[`${t}-success-bg, ${t}-bg`]:{position:"relative",background:e.defaultColor,borderRadius:e.lineBorderRadius,transition:`all ${e.motionDurationSlow} ${e.motionEaseInOutCirc}`},[`${t}-layout-bottom`]:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",[`${t}-text`]:{width:"max-content",marginInlineStart:0,marginTop:e.marginXXS}},[`${t}-bg`]:{overflow:"hidden","&::after":{content:'""',background:{_multi_value_:!0,value:["inherit",`var(${A})`]},height:"100%",width:`calc(1 / var(${z}) * 100%)`,display:"block"},[`&${t}-bg-inner`]:{minWidth:"max-content","&::after":{content:"none"},[`${t}-text-inner`]:{color:e.colorWhite,[`&${t}-text-bright`]:{color:"rgba(0, 0, 0, 0.45)"}}}},[`${t}-success-bg`]:{position:"absolute",insetBlockStart:0,insetInlineStart:0,backgroundColor:e.colorSuccess},[`${t}-text`]:{display:"inline-block",marginInlineStart:e.marginXS,color:e.colorText,lineHeight:1,width:"2em",whiteSpace:"nowrap",textAlign:"start",verticalAlign:"middle",wordBreak:"normal",[r]:{fontSize:e.fontSize},[`&${t}-text-outer`]:{width:"max-content"},[`&${t}-text-outer${t}-text-start`]:{width:"max-content",marginInlineStart:0,marginInlineEnd:e.marginXS}},[`${t}-text-inner`]:{display:"flex",justifyContent:"center",alignItems:"center",width:"100%",height:"100%",marginInlineStart:0,padding:`0 ${(0,D.unit)(e.paddingXXS)}`,[`&${t}-text-start`]:{justifyContent:"start"},[`&${t}-text-end`]:{justifyContent:"end"}},[`&${t}-status-active`]:{[`${t}-bg::before`]:{position:"absolute",inset:0,backgroundColor:e.colorBgContainer,borderRadius:e.lineBorderRadius,opacity:0,animationName:B(),animationDuration:e.progressActiveMotionDuration,animationTimingFunction:e.motionEaseOutQuint,animationIterationCount:"infinite",content:'""'}},[`&${t}-rtl${t}-status-active`]:{[`${t}-bg::before`]:{animationName:B(!0)}},[`&${t}-status-exception`]:{[`${t}-bg`]:{backgroundColor:e.colorError},[`${t}-text`]:{color:e.colorError}},[`&${t}-status-exception ${t}-inner:not(${t}-circle-gradient)`]:{[`${t}-circle-path`]:{stroke:e.colorError}},[`&${t}-status-success`]:{[`${t}-bg`]:{backgroundColor:e.colorSuccess},[`${t}-text`]:{color:e.colorSuccess}},[`&${t}-status-success ${t}-inner:not(${t}-circle-gradient)`]:{[`${t}-circle-path`]:{stroke:e.colorSuccess}}})}})(r),(e=>{let{componentCls:t,iconCls:r}=e;return{[t]:{[`${t}-circle-trail`]:{stroke:e.remainingColor},[`&${t}-circle ${t}-inner`]:{position:"relative",lineHeight:1,backgroundColor:"transparent"},[`&${t}-circle ${t}-text`]:{position:"absolute",insetBlockStart:"50%",insetInlineStart:0,width:"100%",margin:0,padding:0,color:e.circleTextColor,fontSize:e.circleTextFontSize,lineHeight:1,whiteSpace:"normal",textAlign:"center",transform:"translateY(-50%)",[r]:{fontSize:e.circleIconFontSize}},[`${t}-circle&-status-exception`]:{[`${t}-text`]:{color:e.colorError}},[`${t}-circle&-status-success`]:{[`${t}-text`]:{color:e.colorSuccess}}},[`${t}-inline-circle`]:{lineHeight:1,[`${t}-inner`]:{verticalAlign:"bottom"}}}})(r),(e=>{let{componentCls:t}=e;return{[t]:{[`${t}-steps`]:{display:"inline-block","&-outer":{display:"flex",flexDirection:"row",alignItems:"center"},"&-item":{flexShrink:0,minWidth:e.progressStepMinWidth,marginInlineEnd:e.progressStepMarginInlineEnd,backgroundColor:e.remainingColor,transition:`all ${e.motionDurationSlow}`,"&-active":{backgroundColor:e.defaultColor}}}}}})(r),(e=>{let{componentCls:t,iconCls:r}=e;return{[t]:{[`${t}-small&-line, ${t}-small&-line ${t}-text ${r}`]:{fontSize:e.fontSizeSM}}}})(r)]},e=>({circleTextColor:e.colorText,defaultColor:e.colorInfo,remainingColor:e.colorFillSecondary,lineBorderRadius:100,circleTextFontSize:"1em",circleIconFontSize:`${e.fontSize/e.fontSizeSM}em`}));var q=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&0>t.indexOf(n)&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var i=0,n=Object.getOwnPropertySymbols(e);it.indexOf(n[i])&&Object.prototype.propertyIsEnumerable.call(e,n[i])&&(r[n[i]]=e[n[i]]);return r};let H=e=>{let{prefixCls:r,direction:n,percent:i,size:s,strokeWidth:a,strokeColor:l,strokeLinecap:c="round",children:d,trailColor:u=null,percentPosition:f,success:h}=e,{align:p,type:m}=f,g=l&&"string"!=typeof l?((e,t)=>{let{from:r=N.presetPrimaryColors.blue,to:n=N.presetPrimaryColors.blue,direction:i="rtl"===t?"to left":"to right"}=e,s=q(e,["from","to","direction"]);if(0!==Object.keys(s).length){let e,t=(e=[],Object.keys(s).forEach(t=>{let r=Number.parseFloat(t.replace(/%/g,""));Number.isNaN(r)||e.push({key:r,value:s[t]})}),(e=e.sort((e,t)=>e.key-t.key)).map(({key:e,value:t})=>`${t} ${e}%`).join(", ")),r=`linear-gradient(${i}, ${t})`;return{background:r,[A]:r}}let a=`linear-gradient(${i}, ${r}, ${n})`;return{background:a,[A]:a}})(l,n):{[A]:l,background:l},y="square"===c||"butt"===c?0:void 0,[b,x]=T(null!=s?s:[-1,a||("small"===s?6:8)],"line",{strokeWidth:a}),v=Object.assign(Object.assign({width:`${$(i)}%`,height:x,borderRadius:y},g),{[z]:$(i)/100}),k=R(e),w={width:`${$(k)}%`,height:x,borderRadius:y,backgroundColor:null==h?void 0:h.strokeColor},_=t.createElement("div",{className:`${r}-inner`,style:{backgroundColor:u||void 0,borderRadius:y}},t.createElement("div",{className:(0,o.default)(`${r}-bg`,`${r}-bg-${m}`),style:v},"inner"===m&&d),void 0!==k&&t.createElement("div",{className:`${r}-success-bg`,style:w})),C="outer"===m&&"start"===p,j="outer"===m&&"end"===p;return"outer"===m&&"center"===p?t.createElement("div",{className:`${r}-layout-bottom`},_,d):t.createElement("div",{className:`${r}-outer`,style:{width:b<0?"100%":b}},C&&d,_,j&&d)},U=e=>{let{size:r,steps:n,rounding:i=Math.round,percent:s=0,strokeWidth:a=8,strokeColor:l,trailColor:c=null,prefixCls:d,children:u}=e,f=i(s/100*n),[h,p]=T(null!=r?r:["small"===r?2:14,a],"step",{steps:n,strokeWidth:a}),m=h/n,g=Array.from({length:n});for(let e=0;et.indexOf(n)&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var i=0,n=Object.getOwnPropertySymbols(e);it.indexOf(n[i])&&Object.prototype.propertyIsEnumerable.call(e,n[i])&&(r[n[i]]=e[n[i]]);return r};let X=["normal","exception","active","success"],Q=t.forwardRef((e,d)=>{let u,{prefixCls:f,className:h,rootClassName:p,steps:m,strokeColor:g,percent:y=0,size:b="default",showInfo:x=!0,type:v="line",status:k,format:w,style:_,percentPosition:C={}}=e,j=K(e,["prefixCls","className","rootClassName","steps","strokeColor","percent","size","showInfo","type","status","format","style","percentPosition"]),{align:S="end",type:E="outer"}=C,O=Array.isArray(g)?g[0]:g,N="string"==typeof g||Array.isArray(g)?g:void 0,P=t.useMemo(()=>{if(O){let e="string"==typeof O?O:Object.values(O)[0];return new r.FastColor(e).isLight()}return!1},[g]),D=t.useMemo(()=>{var t,r;let n=R(e);return Number.parseInt(void 0!==n?null==(t=null!=n?n:0)?void 0:t.toString():null==(r=null!=y?y:0)?void 0:r.toString(),10)},[y,e.success,e.successPercent]),I=t.useMemo(()=>!X.includes(k)&&D>=100?"success":k||"normal",[k,D]),{getPrefixCls:L,direction:F,progress:A}=t.useContext(c.ConfigContext),z=L("progress",f),[B,q,Q]=W(z),V="line"===v,G=V&&!m,J=t.useMemo(()=>{let r;if(!x)return null;let l=R(e),c=w||(e=>`${e}%`),d=V&&P&&"inner"===E;return"inner"===E||w||"exception"!==I&&"success"!==I?r=c($(y),$(l)):"exception"===I?r=V?t.createElement(s.default,null):t.createElement(a.default,null):"success"===I&&(r=V?t.createElement(n.default,null):t.createElement(i.default,null)),t.createElement("span",{className:(0,o.default)(`${z}-text`,{[`${z}-text-bright`]:d,[`${z}-text-${S}`]:G,[`${z}-text-${E}`]:G}),title:"string"==typeof r?r:void 0},r)},[x,y,D,I,v,z,w]);"line"===v?u=m?t.createElement(U,Object.assign({},e,{strokeColor:N,prefixCls:z,steps:"object"==typeof m?m.count:m}),J):t.createElement(H,Object.assign({},e,{strokeColor:O,prefixCls:z,direction:F,percentPosition:{align:S,type:E}}),J):("circle"===v||"dashboard"===v)&&(u=t.createElement(M,Object.assign({},e,{strokeColor:O,prefixCls:z,progressStatus:I}),J));let Y=(0,o.default)(z,`${z}-status-${I}`,{[`${z}-${"dashboard"===v&&"circle"||v}`]:"line"!==v,[`${z}-inline-circle`]:"circle"===v&&T(b,"circle")[0]<=20,[`${z}-line`]:G,[`${z}-line-align-${S}`]:G,[`${z}-line-position-${E}`]:G,[`${z}-steps`]:m,[`${z}-show-info`]:x,[`${z}-${b}`]:"string"==typeof b,[`${z}-rtl`]:"rtl"===F},null==A?void 0:A.className,h,p,q,Q);return B(t.createElement("div",Object.assign({ref:d,style:Object.assign(Object.assign({},null==A?void 0:A.style),_),className:Y,role:"progressbar","aria-valuenow":D,"aria-valuemin":0,"aria-valuemax":100},(0,l.default)(j,["trailColor","strokeWidth","width","gapDegree","gapPosition","strokeLinecap","success","successPercent"])),u))});e.s(["default",0,Q],309821)},597440,e=>{"use strict";e.i(247167);var t=e.i(931067),r=e.i(271645);let n={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M360 184h-8c4.4 0 8-3.6 8-8v8h304v-8c0 4.4 3.6 8 8 8h-8v72h72v-80c0-35.3-28.7-64-64-64H352c-35.3 0-64 28.7-64 64v80h72v-72zm504 72H160c-17.7 0-32 14.3-32 32v32c0 4.4 3.6 8 8 8h60.4l24.7 523c1.6 34.1 29.8 61 63.9 61h454c34.2 0 62.3-26.8 63.9-61l24.7-523H888c4.4 0 8-3.6 8-8v-32c0-17.7-14.3-32-32-32zM731.3 840H292.7l-24.2-512h487l-24.2 512z"}}]},name:"delete",theme:"outlined"};var i=e.i(9583),s=r.forwardRef(function(e,s){return r.createElement(i.default,(0,t.default)({},e,{ref:s,icon:n}))});e.s(["default",0,s],597440)}]); \ No newline at end of file diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/4e5da3c236abd875.js b/litellm/proxy/_experimental/out/_next/static/chunks/4e5da3c236abd875.js deleted file mode 100644 index 28e3bc2b5f..0000000000 --- a/litellm/proxy/_experimental/out/_next/static/chunks/4e5da3c236abd875.js +++ /dev/null @@ -1,8 +0,0 @@ -(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,907308,e=>{"use strict";var t=e.i(843476),l=e.i(271645),a=e.i(212931),r=e.i(808613),i=e.i(464571),s=e.i(199133),n=e.i(592968),o=e.i(213205),d=e.i(374009),c=e.i(764205);e.s(["default",0,({isVisible:e,onCancel:u,onSubmit:m,accessToken:g,title:h="Add Team Member",roles:p=[{label:"admin",value:"admin",description:"Admin role. Can create team keys, add members, and manage settings."},{label:"user",value:"user",description:"User role. Can view team info, but not manage it."}],defaultRole:f="user",teamId:b})=>{let[v]=r.Form.useForm(),[x,j]=(0,l.useState)([]),[w,y]=(0,l.useState)(!1),[k,C]=(0,l.useState)("user_email"),[$,O]=(0,l.useState)(!1),N=async(e,t)=>{if(!e)return void j([]);y(!0);try{let l=new URLSearchParams;if(l.append(t,e),b&&l.append("team_id",b),null==g)return;let a=(await (0,c.userFilterUICall)(g,l)).map(e=>({label:"user_email"===t?`${e.user_email}`:`${e.user_id}`,value:"user_email"===t?e.user_email:e.user_id,user:e}));j(a)}catch(e){console.error("Error fetching users:",e)}finally{y(!1)}},E=(0,l.useCallback)((0,d.default)((e,t)=>N(e,t),300),[]),T=(e,t)=>{C(t),E(e,t)},M=(e,t)=>{let l=t.user;v.setFieldsValue({user_email:l.user_email,user_id:l.user_id,role:v.getFieldValue("role")})},_=async e=>{O(!0);try{await m(e)}finally{O(!1)}};return(0,t.jsx)(a.Modal,{title:h,open:e,onCancel:()=>{v.resetFields(),j([]),u()},footer:null,width:800,maskClosable:!$,children:(0,t.jsxs)(r.Form,{form:v,onFinish:_,labelCol:{span:8},wrapperCol:{span:16},labelAlign:"left",initialValues:{role:f},children:[(0,t.jsx)(r.Form.Item,{label:"Email",name:"user_email",className:"mb-4",children:(0,t.jsx)(s.Select,{showSearch:!0,className:"w-full",placeholder:"Search by email",filterOption:!1,onSearch:e=>T(e,"user_email"),onSelect:(e,t)=>M(e,t),options:"user_email"===k?x:[],loading:w,allowClear:!0})}),(0,t.jsx)("div",{className:"text-center mb-4",children:"OR"}),(0,t.jsx)(r.Form.Item,{label:"User ID",name:"user_id",className:"mb-4",children:(0,t.jsx)(s.Select,{showSearch:!0,className:"w-full",placeholder:"Search by user ID",filterOption:!1,onSearch:e=>T(e,"user_id"),onSelect:(e,t)=>M(e,t),options:"user_id"===k?x:[],loading:w,allowClear:!0})}),(0,t.jsx)(r.Form.Item,{label:"Member Role",name:"role",className:"mb-4",children:(0,t.jsx)(s.Select,{defaultValue:f,children:p.map(e=>(0,t.jsx)(s.Select.Option,{value:e.value,children:(0,t.jsxs)(n.Tooltip,{title:e.description,children:[(0,t.jsx)("span",{className:"font-medium",children:e.label}),(0,t.jsxs)("span",{className:"ml-2 text-gray-500 text-sm",children:["- ",e.description]})]})},e.value))})}),(0,t.jsx)("div",{className:"text-right mt-4",children:(0,t.jsx)(i.Button,{type:"primary",htmlType:"submit",icon:(0,t.jsx)(o.UserAddOutlined,{}),loading:$,children:$?"Adding...":"Add Member"})})]})})}])},162386,e=>{"use strict";var t=e.i(843476),l=e.i(625901),a=e.i(109799),r=e.i(785242),i=e.i(738014),s=e.i(199133),n=e.i(981339),o=e.i(592968);let d={label:"All Proxy Models",value:"all-proxy-models"},c={label:"No Default Models",value:"no-default-models"},u=[d,c],m={user:({allProxyModels:e,userModels:t,options:l})=>t&&l?.includeUserModels?t:[],team:({allProxyModels:e,selectedOrganization:t,userModels:l})=>t?t.models.includes(d.value)||0===t.models.length?e:e.filter(e=>t.models.includes(e)):e??[],organization:({allProxyModels:e})=>e,global:({allProxyModels:e})=>e};e.s(["ModelSelect",0,e=>{let{teamID:g,organizationID:h,options:p,context:f,dataTestId:b,value:v=[],onChange:x,style:j}=e,{includeUserModels:w,showAllTeamModelsOption:y,showAllProxyModelsOverride:k,includeSpecialOptions:C}=p||{},{data:$,isLoading:O}=(0,l.useAllProxyModels)(),{data:N,isLoading:E}=(0,r.useTeam)(g),{data:T,isLoading:M}=(0,a.useOrganization)(h),{data:_,isLoading:I}=(0,i.useCurrentUser)(),S=e=>u.some(t=>t.value===e),R=v.some(S),A=T?.models.includes(d.value)||T?.models.length===0;if(O||E||M||I)return(0,t.jsx)(n.Skeleton.Input,{active:!0,block:!0});let{wildcard:q,regular:F}=(e=>{let t=[],l=[];for(let a of e)a.endsWith("/*")?t.push(a):l.push(a);return{wildcard:t,regular:l}})(((e,t,l)=>{let a=Array.from(new Map(e.map(e=>[e.id,e])).values()).map(e=>e.id);if(t.options?.showAllProxyModelsOverride)return a;let r=m[t.context];return r?r({allProxyModels:a,...l,options:t.options}):[]})($?.data??[],e,{selectedTeam:N,selectedOrganization:T,userModels:_?.models}));return(0,t.jsx)(s.Select,{"data-testid":b,value:v,onChange:e=>{let t=e.filter(S);x(t.length>0?[t[t.length-1]]:e)},style:j,options:[C?{label:(0,t.jsx)("span",{children:"Special Options"}),title:"Special Options",options:[...k||A&&C||"global"===f?[{label:(0,t.jsx)("span",{children:"All Proxy Models"}),value:d.value,disabled:v.length>0&&v.some(e=>S(e)&&e!==d.value),key:d.value}]:[],{label:(0,t.jsx)("span",{children:"No Default Models"}),value:c.value,disabled:v.length>0&&v.some(e=>S(e)&&e!==c.value),key:c.value}]}:[],...q.length>0?[{label:(0,t.jsx)("span",{children:"Wildcard Options"}),title:"Wildcard Options",options:q.map(e=>{let l=e.replace("/*",""),a=l.charAt(0).toUpperCase()+l.slice(1);return{label:(0,t.jsx)("span",{children:`All ${a} models`}),value:e,disabled:R}})}]:[],{label:(0,t.jsx)("span",{children:"Models"}),title:"Models",options:F.map(e=>({label:(0,t.jsx)("span",{children:e}),value:e,disabled:R}))}],mode:"multiple",placeholder:"Select Models",allowClear:!0,maxTagCount:"responsive",maxTagPlaceholder:e=>(0,t.jsx)(o.Tooltip,{styles:{root:{pointerEvents:"none"}},title:e.map(({value:e})=>e).join(", "),children:(0,t.jsxs)("span",{children:["+",e.length," more"]})})})}],162386)},276173,e=>{"use strict";var t=e.i(843476),l=e.i(599724),a=e.i(779241),r=e.i(464571),i=e.i(808613),s=e.i(212931),n=e.i(199133),o=e.i(271645),d=e.i(435451);e.s(["default",0,({visible:e,onCancel:c,onSubmit:u,initialData:m,mode:g,config:h})=>{let p,[f]=i.Form.useForm(),[b,v]=(0,o.useState)(!1);console.log("Initial Data:",m),(0,o.useEffect)(()=>{if(e)if("edit"===g&&m){let e={...m,role:m.role||h.defaultRole,max_budget_in_team:m.max_budget_in_team||null,tpm_limit:m.tpm_limit||null,rpm_limit:m.rpm_limit||null};console.log("Setting form values:",e),f.setFieldsValue(e)}else f.resetFields(),f.setFieldsValue({role:h.defaultRole||h.roleOptions[0]?.value})},[e,m,g,f,h.defaultRole,h.roleOptions]);let x=async e=>{try{v(!0);let t=Object.entries(e).reduce((e,[t,l])=>{if("string"==typeof l){let a=l.trim();return""===a&&("max_budget_in_team"===t||"tpm_limit"===t||"rpm_limit"===t)?{...e,[t]:null}:{...e,[t]:a}}return{...e,[t]:l}},{});console.log("Submitting form data:",t),await Promise.resolve(u(t)),f.resetFields()}catch(e){console.error("Form submission error:",e)}finally{v(!1)}};return(0,t.jsx)(s.Modal,{title:h.title||("add"===g?"Add Member":"Edit Member"),open:e,width:1e3,footer:null,onCancel:c,children:(0,t.jsxs)(i.Form,{form:f,onFinish:x,labelCol:{span:8},wrapperCol:{span:16},labelAlign:"left",children:[h.showEmail&&(0,t.jsx)(i.Form.Item,{label:"Email",name:"user_email",className:"mb-4",rules:[{type:"email",message:"Please enter a valid email!"}],children:(0,t.jsx)(a.TextInput,{placeholder:"user@example.com"})}),h.showEmail&&h.showUserId&&(0,t.jsx)("div",{className:"text-center mb-4",children:(0,t.jsx)(l.Text,{children:"OR"})}),h.showUserId&&(0,t.jsx)(i.Form.Item,{label:"User ID",name:"user_id",className:"mb-4",children:(0,t.jsx)(a.TextInput,{placeholder:"user_123"})}),(0,t.jsx)(i.Form.Item,{label:(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("span",{children:"Role"}),"edit"===g&&m&&(0,t.jsxs)("span",{className:"text-gray-500 text-sm",children:["(Current: ",(p=m.role,h.roleOptions.find(e=>e.value===p)?.label||p),")"]})]}),name:"role",className:"mb-4",rules:[{required:!0,message:"Please select a role!"}],children:(0,t.jsx)(n.Select,{children:"edit"===g&&m?[...h.roleOptions.filter(e=>e.value===m.role),...h.roleOptions.filter(e=>e.value!==m.role)].map(e=>(0,t.jsx)(n.Select.Option,{value:e.value,children:e.label},e.value)):h.roleOptions.map(e=>(0,t.jsx)(n.Select.Option,{value:e.value,children:e.label},e.value))})}),h.additionalFields?.map(e=>(0,t.jsx)(i.Form.Item,{label:e.label,name:e.name,className:"mb-4",rules:e.rules,children:(e=>{switch(e.type){case"input":return(0,t.jsx)(a.TextInput,{placeholder:e.placeholder});case"numerical":return(0,t.jsx)(d.default,{step:e.step||1,min:e.min||0,style:{width:"100%"},placeholder:e.placeholder||"Enter a numerical value"});case"select":return(0,t.jsx)(n.Select,{children:e.options?.map(e=>(0,t.jsx)(n.Select.Option,{value:e.value,children:e.label},e.value))});default:return null}})(e)},e.name)),(0,t.jsxs)("div",{className:"text-right mt-6",children:[(0,t.jsx)(r.Button,{onClick:c,className:"mr-2",disabled:b,children:"Cancel"}),(0,t.jsx)(r.Button,{type:"default",htmlType:"submit",loading:b,children:"add"===g?b?"Adding...":"Add Member":b?"Saving...":"Save Changes"})]})]})})}])},294612,e=>{"use strict";var t=e.i(843476),l=e.i(100486),a=e.i(827252),r=e.i(213205),i=e.i(771674),s=e.i(464571),n=e.i(770914),o=e.i(291542),d=e.i(262218),c=e.i(592968),u=e.i(898586),m=e.i(902555);let{Text:g}=u.Typography;function h({members:e,canEdit:u,onEdit:h,onDelete:p,onAddMember:f,roleColumnTitle:b="Role",roleTooltip:v,extraColumns:x=[],showDeleteForMember:j,emptyText:w}){let y=[{title:"User Email",dataIndex:"user_email",key:"user_email",render:e=>(0,t.jsx)(g,{children:e||"-"})},{title:"User ID",dataIndex:"user_id",key:"user_id",render:e=>"default_user_id"===e?(0,t.jsx)(d.Tag,{color:"blue",children:"Default Proxy Admin"}):(0,t.jsx)(g,{children:e||"-"})},{title:v?(0,t.jsxs)(n.Space,{direction:"horizontal",children:[b,(0,t.jsx)(c.Tooltip,{title:v,children:(0,t.jsx)(a.InfoCircleOutlined,{})})]}):b,dataIndex:"role",key:"role",render:e=>(0,t.jsxs)(n.Space,{children:[e?.toLowerCase()==="admin"||e?.toLowerCase()==="org_admin"?(0,t.jsx)(l.CrownOutlined,{}):(0,t.jsx)(i.UserOutlined,{}),(0,t.jsx)(g,{style:{textTransform:"capitalize"},children:e||"-"})]})},...x,{title:"Actions",key:"actions",fixed:"right",width:120,render:(e,l)=>u?(0,t.jsxs)(n.Space,{children:[(0,t.jsx)(m.default,{variant:"Edit",tooltipText:"Edit member",dataTestId:"edit-member",onClick:()=>h(l)}),(!j||j(l))&&(0,t.jsx)(m.default,{variant:"Delete",tooltipText:"Delete member",dataTestId:"delete-member",onClick:()=>p(l)})]}):null}];return(0,t.jsxs)(n.Space,{direction:"vertical",style:{width:"100%"},children:[(0,t.jsxs)("span",{className:"inline-flex text-sm text-gray-700",children:[e.length," Member",1!==e.length?"s":""]}),(0,t.jsx)(o.Table,{columns:y,dataSource:e,rowKey:e=>e.user_id??e.user_email??JSON.stringify(e),pagination:!1,size:"small",scroll:{x:"max-content"},locale:w?{emptyText:w}:void 0}),f&&u&&(0,t.jsx)(s.Button,{icon:(0,t.jsx)(r.UserAddOutlined,{}),type:"primary",onClick:f,children:"Add Member"})]})}e.s(["default",()=>h])},551332,e=>{"use strict";var t=e.i(271645);let l=t.forwardRef(function(e,l){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:l},e),t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8 5H6a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2v-1M8 5a2 2 0 002 2h2a2 2 0 002-2M8 5a2 2 0 012-2h2a2 2 0 012 2m0 0h2a2 2 0 012 2v3m2 4H10m0 0l3-3m-3 3l3 3"}))});e.s(["ClipboardCopyIcon",0,l],551332)},122577,e=>{"use strict";var t=e.i(271645);let l=t.forwardRef(function(e,l){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:l},e),t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M14.752 11.168l-3.197-2.132A1 1 0 0010 9.87v4.263a1 1 0 001.555.832l3.197-2.132a1 1 0 000-1.664z"}),t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M21 12a9 9 0 11-18 0 9 9 0 0118 0z"}))});e.s(["PlayIcon",0,l],122577)},902555,e=>{"use strict";var t=e.i(843476),l=e.i(591935),a=e.i(122577),r=e.i(278587),i=e.i(68155),s=e.i(360820),n=e.i(871943),o=e.i(434626),d=e.i(551332),c=e.i(592968),u=e.i(115504),m=e.i(752978);function g({icon:e,onClick:l,className:a,disabled:r,dataTestId:i}){return r?(0,t.jsx)(m.Icon,{icon:e,size:"sm",className:"opacity-50 cursor-not-allowed","data-testid":i}):(0,t.jsx)(m.Icon,{icon:e,size:"sm",onClick:l,className:(0,u.cx)("cursor-pointer",a),"data-testid":i})}let h={Edit:{icon:l.PencilAltIcon,className:"hover:text-blue-600"},Delete:{icon:i.TrashIcon,className:"hover:text-red-600"},Test:{icon:a.PlayIcon,className:"hover:text-blue-600"},Regenerate:{icon:r.RefreshIcon,className:"hover:text-green-600"},Up:{icon:s.ChevronUpIcon,className:"hover:text-blue-600"},Down:{icon:n.ChevronDownIcon,className:"hover:text-blue-600"},Open:{icon:o.ExternalLinkIcon,className:"hover:text-green-600"},Copy:{icon:d.ClipboardCopyIcon,className:"hover:text-blue-600"}};function p({onClick:e,tooltipText:l,disabled:a=!1,disabledTooltipText:r,dataTestId:i,variant:s}){let{icon:n,className:o}=h[s];return(0,t.jsx)(c.Tooltip,{title:a?r:l,children:(0,t.jsx)("span",{children:(0,t.jsx)(g,{icon:n,onClick:e,className:o,disabled:a,dataTestId:i})})})}e.s(["default",()=>p],902555)},434626,e=>{"use strict";var t=e.i(271645);let l=t.forwardRef(function(e,l){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:l},e),t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14"}))});e.s(["ExternalLinkIcon",0,l],434626)},591935,e=>{"use strict";var t=e.i(271645);let l=t.forwardRef(function(e,l){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:l},e),t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M11 5H6a2 2 0 00-2 2v11a2 2 0 002 2h11a2 2 0 002-2v-5m-1.414-9.414a2 2 0 112.828 2.828L11.828 15H9v-2.828l8.586-8.586z"}))});e.s(["PencilAltIcon",0,l],591935)},871943,e=>{"use strict";var t=e.i(271645);let l=t.forwardRef(function(e,l){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:l},e),t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 9l-7 7-7-7"}))});e.s(["ChevronDownIcon",0,l],871943)},360820,e=>{"use strict";var t=e.i(271645);let l=t.forwardRef(function(e,l){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:l},e),t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 15l7-7 7 7"}))});e.s(["ChevronUpIcon",0,l],360820)},185793,e=>{"use strict";e.i(247167);var t=e.i(271645),l=e.i(343794),a=e.i(242064),r=e.i(529681);let i=e=>{let{prefixCls:a,className:r,style:i,size:s,shape:n}=e,o=(0,l.default)({[`${a}-lg`]:"large"===s,[`${a}-sm`]:"small"===s}),d=(0,l.default)({[`${a}-circle`]:"circle"===n,[`${a}-square`]:"square"===n,[`${a}-round`]:"round"===n}),c=t.useMemo(()=>"number"==typeof s?{width:s,height:s,lineHeight:`${s}px`}:{},[s]);return t.createElement("span",{className:(0,l.default)(a,o,d,r),style:Object.assign(Object.assign({},c),i)})};e.i(296059);var s=e.i(694758),n=e.i(915654),o=e.i(246422),d=e.i(838378);let c=new s.Keyframes("ant-skeleton-loading",{"0%":{backgroundPosition:"100% 50%"},"100%":{backgroundPosition:"0 50%"}}),u=e=>({height:e,lineHeight:(0,n.unit)(e)}),m=e=>Object.assign({width:e},u(e)),g=(e,t)=>Object.assign({width:t(e).mul(5).equal(),minWidth:t(e).mul(5).equal()},u(e)),h=e=>Object.assign({width:e},u(e)),p=(e,t,l)=>{let{skeletonButtonCls:a}=e;return{[`${l}${a}-circle`]:{width:t,minWidth:t,borderRadius:"50%"},[`${l}${a}-round`]:{borderRadius:t}}},f=(e,t)=>Object.assign({width:t(e).mul(2).equal(),minWidth:t(e).mul(2).equal()},u(e)),b=(0,o.genStyleHooks)("Skeleton",e=>{let{componentCls:t,calc:l}=e;return(e=>{let{componentCls:t,skeletonAvatarCls:l,skeletonTitleCls:a,skeletonParagraphCls:r,skeletonButtonCls:i,skeletonInputCls:s,skeletonImageCls:n,controlHeight:o,controlHeightLG:d,controlHeightSM:u,gradientFromColor:b,padding:v,marginSM:x,borderRadius:j,titleHeight:w,blockRadius:y,paragraphLiHeight:k,controlHeightXS:C,paragraphMarginTop:$}=e;return{[t]:{display:"table",width:"100%",[`${t}-header`]:{display:"table-cell",paddingInlineEnd:v,verticalAlign:"top",[l]:Object.assign({display:"inline-block",verticalAlign:"top",background:b},m(o)),[`${l}-circle`]:{borderRadius:"50%"},[`${l}-lg`]:Object.assign({},m(d)),[`${l}-sm`]:Object.assign({},m(u))},[`${t}-content`]:{display:"table-cell",width:"100%",verticalAlign:"top",[a]:{width:"100%",height:w,background:b,borderRadius:y,[`+ ${r}`]:{marginBlockStart:u}},[r]:{padding:0,"> li":{width:"100%",height:k,listStyle:"none",background:b,borderRadius:y,"+ li":{marginBlockStart:C}}},[`${r}> li:last-child:not(:first-child):not(:nth-child(2))`]:{width:"61%"}},[`&-round ${t}-content`]:{[`${a}, ${r} > li`]:{borderRadius:j}}},[`${t}-with-avatar ${t}-content`]:{[a]:{marginBlockStart:x,[`+ ${r}`]:{marginBlockStart:$}}},[`${t}${t}-element`]:Object.assign(Object.assign(Object.assign(Object.assign({display:"inline-block",width:"auto"},(e=>{let{borderRadiusSM:t,skeletonButtonCls:l,controlHeight:a,controlHeightLG:r,controlHeightSM:i,gradientFromColor:s,calc:n}=e;return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({[l]:Object.assign({display:"inline-block",verticalAlign:"top",background:s,borderRadius:t,width:n(a).mul(2).equal(),minWidth:n(a).mul(2).equal()},f(a,n))},p(e,a,l)),{[`${l}-lg`]:Object.assign({},f(r,n))}),p(e,r,`${l}-lg`)),{[`${l}-sm`]:Object.assign({},f(i,n))}),p(e,i,`${l}-sm`))})(e)),(e=>{let{skeletonAvatarCls:t,gradientFromColor:l,controlHeight:a,controlHeightLG:r,controlHeightSM:i}=e;return{[t]:Object.assign({display:"inline-block",verticalAlign:"top",background:l},m(a)),[`${t}${t}-circle`]:{borderRadius:"50%"},[`${t}${t}-lg`]:Object.assign({},m(r)),[`${t}${t}-sm`]:Object.assign({},m(i))}})(e)),(e=>{let{controlHeight:t,borderRadiusSM:l,skeletonInputCls:a,controlHeightLG:r,controlHeightSM:i,gradientFromColor:s,calc:n}=e;return{[a]:Object.assign({display:"inline-block",verticalAlign:"top",background:s,borderRadius:l},g(t,n)),[`${a}-lg`]:Object.assign({},g(r,n)),[`${a}-sm`]:Object.assign({},g(i,n))}})(e)),(e=>{let{skeletonImageCls:t,imageSizeBase:l,gradientFromColor:a,borderRadiusSM:r,calc:i}=e;return{[t]:Object.assign(Object.assign({display:"inline-flex",alignItems:"center",justifyContent:"center",verticalAlign:"middle",background:a,borderRadius:r},h(i(l).mul(2).equal())),{[`${t}-path`]:{fill:"#bfbfbf"},[`${t}-svg`]:Object.assign(Object.assign({},h(l)),{maxWidth:i(l).mul(4).equal(),maxHeight:i(l).mul(4).equal()}),[`${t}-svg${t}-svg-circle`]:{borderRadius:"50%"}}),[`${t}${t}-circle`]:{borderRadius:"50%"}}})(e)),[`${t}${t}-block`]:{width:"100%",[i]:{width:"100%"},[s]:{width:"100%"}},[`${t}${t}-active`]:{[` - ${a}, - ${r} > li, - ${l}, - ${i}, - ${s}, - ${n} - `]:Object.assign({},{background:e.skeletonLoadingBackground,backgroundSize:"400% 100%",animationName:c,animationDuration:e.skeletonLoadingMotionDuration,animationTimingFunction:"ease",animationIterationCount:"infinite"})}}})((0,d.mergeToken)(e,{skeletonAvatarCls:`${t}-avatar`,skeletonTitleCls:`${t}-title`,skeletonParagraphCls:`${t}-paragraph`,skeletonButtonCls:`${t}-button`,skeletonInputCls:`${t}-input`,skeletonImageCls:`${t}-image`,imageSizeBase:l(e.controlHeight).mul(1.5).equal(),borderRadius:100,skeletonLoadingBackground:`linear-gradient(90deg, ${e.gradientFromColor} 25%, ${e.gradientToColor} 37%, ${e.gradientFromColor} 63%)`,skeletonLoadingMotionDuration:"1.4s"}))},e=>{let{colorFillContent:t,colorFill:l}=e;return{color:t,colorGradientEnd:l,gradientFromColor:t,gradientToColor:l,titleHeight:e.controlHeight/2,blockRadius:e.borderRadiusSM,paragraphMarginTop:e.marginLG+e.marginXXS,paragraphLiHeight:e.controlHeight/2}},{deprecatedTokens:[["color","gradientFromColor"],["colorGradientEnd","gradientToColor"]]}),v=e=>{let{prefixCls:a,className:r,style:i,rows:s=0}=e,n=Array.from({length:s}).map((l,a)=>t.createElement("li",{key:a,style:{width:((e,t)=>{let{width:l,rows:a=2}=t;return Array.isArray(l)?l[e]:a-1===e?l:void 0})(a,e)}}));return t.createElement("ul",{className:(0,l.default)(a,r),style:i},n)},x=({prefixCls:e,className:a,width:r,style:i})=>t.createElement("h3",{className:(0,l.default)(e,a),style:Object.assign({width:r},i)});function j(e){return e&&"object"==typeof e?e:{}}let w=e=>{let{prefixCls:r,loading:s,className:n,rootClassName:o,style:d,children:c,avatar:u=!1,title:m=!0,paragraph:g=!0,active:h,round:p}=e,{getPrefixCls:f,direction:w,className:y,style:k}=(0,a.useComponentConfig)("skeleton"),C=f("skeleton",r),[$,O,N]=b(C);if(s||!("loading"in e)){let e,a,r=!!u,s=!!m,c=!!g;if(r){let l=Object.assign(Object.assign({prefixCls:`${C}-avatar`},s&&!c?{size:"large",shape:"square"}:{size:"large",shape:"circle"}),j(u));e=t.createElement("div",{className:`${C}-header`},t.createElement(i,Object.assign({},l)))}if(s||c){let e,l;if(s){let l=Object.assign(Object.assign({prefixCls:`${C}-title`},!r&&c?{width:"38%"}:r&&c?{width:"50%"}:{}),j(m));e=t.createElement(x,Object.assign({},l))}if(c){let e,a=Object.assign(Object.assign({prefixCls:`${C}-paragraph`},(e={},r&&s||(e.width="61%"),!r&&s?e.rows=3:e.rows=2,e)),j(g));l=t.createElement(v,Object.assign({},a))}a=t.createElement("div",{className:`${C}-content`},e,l)}let f=(0,l.default)(C,{[`${C}-with-avatar`]:r,[`${C}-active`]:h,[`${C}-rtl`]:"rtl"===w,[`${C}-round`]:p},y,n,o,O,N);return $(t.createElement("div",{className:f,style:Object.assign(Object.assign({},k),d)},e,a))}return null!=c?c:null};w.Button=e=>{let{prefixCls:s,className:n,rootClassName:o,active:d,block:c=!1,size:u="default"}=e,{getPrefixCls:m}=t.useContext(a.ConfigContext),g=m("skeleton",s),[h,p,f]=b(g),v=(0,r.default)(e,["prefixCls"]),x=(0,l.default)(g,`${g}-element`,{[`${g}-active`]:d,[`${g}-block`]:c},n,o,p,f);return h(t.createElement("div",{className:x},t.createElement(i,Object.assign({prefixCls:`${g}-button`,size:u},v))))},w.Avatar=e=>{let{prefixCls:s,className:n,rootClassName:o,active:d,shape:c="circle",size:u="default"}=e,{getPrefixCls:m}=t.useContext(a.ConfigContext),g=m("skeleton",s),[h,p,f]=b(g),v=(0,r.default)(e,["prefixCls","className"]),x=(0,l.default)(g,`${g}-element`,{[`${g}-active`]:d},n,o,p,f);return h(t.createElement("div",{className:x},t.createElement(i,Object.assign({prefixCls:`${g}-avatar`,shape:c,size:u},v))))},w.Input=e=>{let{prefixCls:s,className:n,rootClassName:o,active:d,block:c,size:u="default"}=e,{getPrefixCls:m}=t.useContext(a.ConfigContext),g=m("skeleton",s),[h,p,f]=b(g),v=(0,r.default)(e,["prefixCls"]),x=(0,l.default)(g,`${g}-element`,{[`${g}-active`]:d,[`${g}-block`]:c},n,o,p,f);return h(t.createElement("div",{className:x},t.createElement(i,Object.assign({prefixCls:`${g}-input`,size:u},v))))},w.Image=e=>{let{prefixCls:r,className:i,rootClassName:s,style:n,active:o}=e,{getPrefixCls:d}=t.useContext(a.ConfigContext),c=d("skeleton",r),[u,m,g]=b(c),h=(0,l.default)(c,`${c}-element`,{[`${c}-active`]:o},i,s,m,g);return u(t.createElement("div",{className:h},t.createElement("div",{className:(0,l.default)(`${c}-image`,i),style:n},t.createElement("svg",{viewBox:"0 0 1098 1024",xmlns:"http://www.w3.org/2000/svg",className:`${c}-image-svg`},t.createElement("title",null,"Image placeholder"),t.createElement("path",{d:"M365.714286 329.142857q0 45.714286-32.036571 77.677714t-77.677714 32.036571-77.677714-32.036571-32.036571-77.677714 32.036571-77.677714 77.677714-32.036571 77.677714 32.036571 32.036571 77.677714zM950.857143 548.571429l0 256-804.571429 0 0-109.714286 182.857143-182.857143 91.428571 91.428571 292.571429-292.571429zM1005.714286 146.285714l-914.285714 0q-7.460571 0-12.873143 5.412571t-5.412571 12.873143l0 694.857143q0 7.460571 5.412571 12.873143t12.873143 5.412571l914.285714 0q7.460571 0 12.873143-5.412571t5.412571-12.873143l0-694.857143q0-7.460571-5.412571-12.873143t-12.873143-5.412571zM1097.142857 164.571429l0 694.857143q0 37.741714-26.843429 64.585143t-64.585143 26.843429l-914.285714 0q-37.741714 0-64.585143-26.843429t-26.843429-64.585143l0-694.857143q0-37.741714 26.843429-64.585143t64.585143-26.843429l914.285714 0q37.741714 0 64.585143 26.843429t26.843429 64.585143z",className:`${c}-image-path`})))))},w.Node=e=>{let{prefixCls:r,className:i,rootClassName:s,style:n,active:o,children:d}=e,{getPrefixCls:c}=t.useContext(a.ConfigContext),u=c("skeleton",r),[m,g,h]=b(u),p=(0,l.default)(u,`${u}-element`,{[`${u}-active`]:o},g,i,s,h);return m(t.createElement("div",{className:p},t.createElement("div",{className:(0,l.default)(`${u}-image`,i),style:n},d)))},e.s(["default",0,w],185793)},959013,e=>{"use strict";e.i(247167);var t=e.i(931067),l=e.i(271645);let a={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M482 152h60q8 0 8 8v704q0 8-8 8h-60q-8 0-8-8V160q0-8 8-8z"}},{tag:"path",attrs:{d:"M192 474h672q8 0 8 8v60q0 8-8 8H160q-8 0-8-8v-60q0-8 8-8z"}}]},name:"plus",theme:"outlined"};var r=e.i(9583),i=l.forwardRef(function(e,i){return l.createElement(r.default,(0,t.default)({},e,{ref:i,icon:a}))});e.s(["default",0,i],959013)},269200,e=>{"use strict";var t=e.i(290571),l=e.i(271645),a=e.i(444755);let r=(0,e.i(673706).makeClassName)("Table"),i=l.default.forwardRef((e,i)=>{let{children:s,className:n}=e,o=(0,t.__rest)(e,["children","className"]);return l.default.createElement("div",{className:(0,a.tremorTwMerge)(r("root"),"overflow-auto",n)},l.default.createElement("table",Object.assign({ref:i,className:(0,a.tremorTwMerge)(r("table"),"w-full text-tremor-default","text-tremor-content","dark:text-dark-tremor-content")},o),s))});i.displayName="Table",e.s(["Table",()=>i],269200)},942232,e=>{"use strict";var t=e.i(290571),l=e.i(271645),a=e.i(444755);let r=(0,e.i(673706).makeClassName)("TableBody"),i=l.default.forwardRef((e,i)=>{let{children:s,className:n}=e,o=(0,t.__rest)(e,["children","className"]);return l.default.createElement(l.default.Fragment,null,l.default.createElement("tbody",Object.assign({ref:i,className:(0,a.tremorTwMerge)(r("root"),"align-top divide-y","divide-tremor-border","dark:divide-dark-tremor-border",n)},o),s))});i.displayName="TableBody",e.s(["TableBody",()=>i],942232)},977572,e=>{"use strict";var t=e.i(290571),l=e.i(271645),a=e.i(444755);let r=(0,e.i(673706).makeClassName)("TableCell"),i=l.default.forwardRef((e,i)=>{let{children:s,className:n}=e,o=(0,t.__rest)(e,["children","className"]);return l.default.createElement(l.default.Fragment,null,l.default.createElement("td",Object.assign({ref:i,className:(0,a.tremorTwMerge)(r("root"),"align-middle whitespace-nowrap text-left p-4",n)},o),s))});i.displayName="TableCell",e.s(["TableCell",()=>i],977572)},427612,e=>{"use strict";var t=e.i(290571),l=e.i(271645),a=e.i(444755);let r=(0,e.i(673706).makeClassName)("TableHead"),i=l.default.forwardRef((e,i)=>{let{children:s,className:n}=e,o=(0,t.__rest)(e,["children","className"]);return l.default.createElement(l.default.Fragment,null,l.default.createElement("thead",Object.assign({ref:i,className:(0,a.tremorTwMerge)(r("root"),"text-left","text-tremor-content","dark:text-dark-tremor-content",n)},o),s))});i.displayName="TableHead",e.s(["TableHead",()=>i],427612)},64848,e=>{"use strict";var t=e.i(290571),l=e.i(271645),a=e.i(444755);let r=(0,e.i(673706).makeClassName)("TableHeaderCell"),i=l.default.forwardRef((e,i)=>{let{children:s,className:n}=e,o=(0,t.__rest)(e,["children","className"]);return l.default.createElement(l.default.Fragment,null,l.default.createElement("th",Object.assign({ref:i,className:(0,a.tremorTwMerge)(r("root"),"whitespace-nowrap text-left font-semibold top-0 px-4 py-3.5","text-tremor-content-strong","dark:text-dark-tremor-content-strong",n)},o),s))});i.displayName="TableHeaderCell",e.s(["TableHeaderCell",()=>i],64848)},496020,e=>{"use strict";var t=e.i(290571),l=e.i(271645),a=e.i(444755);let r=(0,e.i(673706).makeClassName)("TableRow"),i=l.default.forwardRef((e,i)=>{let{children:s,className:n}=e,o=(0,t.__rest)(e,["children","className"]);return l.default.createElement(l.default.Fragment,null,l.default.createElement("tr",Object.assign({ref:i,className:(0,a.tremorTwMerge)(r("row"),n)},o),s))});i.displayName="TableRow",e.s(["TableRow",()=>i],496020)},68155,e=>{"use strict";var t=e.i(271645);let l=t.forwardRef(function(e,l){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:l},e),t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"}))});e.s(["TrashIcon",0,l],68155)},278587,e=>{"use strict";var t=e.i(271645);let l=t.forwardRef(function(e,l){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:l},e),t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"}))});e.s(["RefreshIcon",0,l],278587)},207670,e=>{"use strict";function t(){for(var e,t,l=0,a="",r=arguments.length;lt,"default",0,t])},738014,e=>{"use strict";var t=e.i(135214),l=e.i(764205),a=e.i(266027);let r=(0,e.i(243652).createQueryKeys)("users");e.s(["useCurrentUser",0,()=>{let{accessToken:e,userId:i}=(0,t.default)();return(0,a.useQuery)({queryKey:r.detail(i),queryFn:async()=>await (0,l.userGetInfoV2)(e),enabled:!!(e&&i)})}])},625901,e=>{"use strict";var t=e.i(266027),l=e.i(621482),a=e.i(243652),r=e.i(764205),i=e.i(135214);let s=(0,a.createQueryKeys)("models"),n=(0,a.createQueryKeys)("modelHub"),o=(0,a.createQueryKeys)("allProxyModels");(0,a.createQueryKeys)("selectedTeamModels");let d=(0,a.createQueryKeys)("infiniteModels");e.s(["useAllProxyModels",0,()=>{let{accessToken:e,userId:l,userRole:a}=(0,i.default)();return(0,t.useQuery)({queryKey:o.list({}),queryFn:async()=>await (0,r.modelAvailableCall)(e,l,a,!0,null,!0,!1,"expand"),enabled:!!(e&&l&&a)})},"useInfiniteModelInfo",0,(e=50,t)=>{let{accessToken:a,userId:s,userRole:n}=(0,i.default)();return(0,l.useInfiniteQuery)({queryKey:d.list({filters:{...s&&{userId:s},...n&&{userRole:n},size:e,...t&&{search:t}}}),queryFn:async({pageParam:l})=>await (0,r.modelInfoCall)(a,s,n,l,e,t),initialPageParam:1,getNextPageParam:e=>{if(e.current_page{let{accessToken:e}=(0,i.default)();return(0,t.useQuery)({queryKey:n.list({}),queryFn:async()=>await (0,r.modelHubCall)(e),enabled:!!e})},"useModelsInfo",0,(e=1,l=50,a,n,o,d,c)=>{let{accessToken:u,userId:m,userRole:g}=(0,i.default)();return(0,t.useQuery)({queryKey:s.list({filters:{...m&&{userId:m},...g&&{userRole:g},page:e,size:l,...a&&{search:a},...n&&{modelId:n},...o&&{teamId:o},...d&&{sortBy:d},...c&&{sortOrder:c}}}),queryFn:async()=>await (0,r.modelInfoCall)(u,m,g,e,l,a,n,o,d,c),enabled:!!(u&&m&&g)})}])}]); \ No newline at end of file diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/60b0cadba57cd7f7.js b/litellm/proxy/_experimental/out/_next/static/chunks/60b0cadba57cd7f7.js new file mode 100644 index 0000000000..f736e340d4 --- /dev/null +++ b/litellm/proxy/_experimental/out/_next/static/chunks/60b0cadba57cd7f7.js @@ -0,0 +1 @@ +(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,519756,e=>{"use strict";e.i(247167);var t=e.i(931067),s=e.i(271645);let l={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M400 317.7h73.9V656c0 4.4 3.6 8 8 8h60c4.4 0 8-3.6 8-8V317.7H624c6.7 0 10.4-7.7 6.3-12.9L518.3 163a8 8 0 00-12.6 0l-112 141.7c-4.1 5.3-.4 13 6.3 13zM878 626h-60c-4.4 0-8 3.6-8 8v154H214V634c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8v198c0 17.7 14.3 32 32 32h684c17.7 0 32-14.3 32-32V634c0-4.4-3.6-8-8-8z"}}]},name:"upload",theme:"outlined"};var i=e.i(9583),a=s.forwardRef(function(e,a){return s.createElement(i.default,(0,t.default)({},e,{ref:a,icon:l}))});e.s(["UploadOutlined",0,a],519756)},981339,e=>{"use strict";var t=e.i(185793);e.s(["Skeleton",()=>t.default])},500330,e=>{"use strict";var t=e.i(727749);function s(e,t){let s=structuredClone(e);for(let[e,l]of Object.entries(t))e in s&&(s[e]=l);return s}let l=(e,t=0,s=!1,l=!0)=>{if(null==e||!Number.isFinite(e)||0===e&&!l)return"-";let i={minimumFractionDigits:t,maximumFractionDigits:t};if(!s)return e.toLocaleString("en-US",i);let a=e<0?"-":"",r=Math.abs(e),n=r,d="";return r>=1e6?(n=r/1e6,d="M"):r>=1e3&&(n=r/1e3,d="K"),`${a}${n.toLocaleString("en-US",i)}${d}`},i=async(e,s="Copied to clipboard")=>{if(!e)return!1;if(!navigator||!navigator.clipboard||!navigator.clipboard.writeText)return a(e,s);try{return await navigator.clipboard.writeText(e),t.default.success(s),!0}catch(t){return console.error("Clipboard API failed: ",t),a(e,s)}},a=(e,s)=>{try{let l=document.createElement("textarea");l.value=e,l.style.position="fixed",l.style.left="-999999px",l.style.top="-999999px",l.setAttribute("readonly",""),document.body.appendChild(l),l.focus(),l.select();let i=document.execCommand("copy");if(document.body.removeChild(l),i)return t.default.success(s),!0;throw Error("execCommand failed")}catch(e){return t.default.fromBackend("Failed to copy to clipboard"),console.error("Failed to copy: ",e),!1}};e.s(["copyToClipboard",0,i,"formatNumberWithCommas",0,l,"getSpendString",0,(e,t=6)=>{if(null==e||!Number.isFinite(e)||0===e)return"-";let s=l(e,t,!1,!1);if(0===Number(s.replace(/,/g,""))){let e=(1/10**t).toFixed(t);return`< $${e}`}return`$${s}`},"updateExistingKeys",()=>s])},663435,152473,e=>{"use strict";var t=e.i(843476),s=e.i(271645),l=e.i(199133),i=e.i(898586),a=e.i(56456);let r={enabled:!0,leading:!1,trailing:!0,wait:0,onExecute:()=>{}};class n{constructor(e,t){this.fn=e,this._canLeadingExecute=!0,this._isPending=!1,this._executionCount=0,this._options={...r,...t}}setOptions(e){return this._options={...this._options,...e},this._options.enabled||(this._isPending=!1),this._options}getOptions(){return this._options}maybeExecute(...e){this._options.leading&&this._canLeadingExecute&&(this.executeFunction(...e),this._canLeadingExecute=!1),(this._options.leading||this._options.trailing)&&(this._isPending=!0),this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=setTimeout(()=>{this._canLeadingExecute=!0,this._isPending=!1,this._options.trailing&&this.executeFunction(...e)},this._options.wait)}executeFunction(...e){this._options.enabled&&(this.fn(...e),this._executionCount++,this._options.onExecute(this))}cancel(){this._timeoutId&&(clearTimeout(this._timeoutId),this._canLeadingExecute=!0,this._isPending=!1)}getExecutionCount(){return this._executionCount}getIsPending(){return this._options.enabled&&this._isPending}}function d(e,t){let[l,i]=(0,s.useState)(e),a=function(e,t){let[l]=(0,s.useState)(()=>{var s;return Object.getOwnPropertyNames(Object.getPrototypeOf(s=new n(e,t))).filter(e=>"function"==typeof s[e]).reduce((e,t)=>{let l=s[t];return"function"==typeof l&&(e[t]=l.bind(s)),e},{})});return l.setOptions(t),l}(i,t);return[l,a.maybeExecute,a]}e.s(["useDebouncedState",()=>d],152473);var o=e.i(785242);let{Text:c}=i.Typography;e.s(["default",0,({value:e,onChange:i,onTeamSelect:r,disabled:n,organizationId:m,pageSize:u=20})=>{let[h,x]=(0,s.useState)(""),[p,f]=d("",{wait:300}),{data:g,fetchNextPage:j,hasNextPage:y,isFetchingNextPage:b,isLoading:v}=(0,o.useInfiniteTeams)(u,p||void 0,m),w=(0,s.useMemo)(()=>{if(!g?.pages)return[];let e=new Set,t=[];for(let s of g.pages)for(let l of s.teams)e.has(l.team_id)||(e.add(l.team_id),t.push(l));return t},[g]);return(0,t.jsx)(l.Select,{showSearch:!0,placeholder:"Search or select a team",value:e||void 0,onChange:e=>{i?.(e??""),r&&r(e?w.find(t=>t.team_id===e)??null:null)},disabled:n,allowClear:!0,filterOption:!1,onSearch:e=>{x(e),f(e)},searchValue:h,onPopupScroll:e=>{let t=e.currentTarget;(t.scrollTop+t.clientHeight)/t.scrollHeight>=.8&&y&&!b&&j()},loading:v,notFoundContent:v?(0,t.jsx)(a.LoadingOutlined,{spin:!0}):"No teams found","data-testid":"team-dropdown",popupRender:e=>(0,t.jsxs)(t.Fragment,{children:[e,b&&(0,t.jsx)("div",{style:{textAlign:"center",padding:8},children:(0,t.jsx)(a.LoadingOutlined,{spin:!0})})]}),children:w.map(e=>(0,t.jsxs)(l.Select.Option,{value:e.team_id,children:[(0,t.jsx)("span",{className:"font-medium",children:e.team_alias})," ",(0,t.jsxs)(c,{type:"secondary",children:["(",e.team_id,")"]})]},e.team_id))})}],663435)},285027,e=>{"use strict";e.i(247167);var t=e.i(931067),s=e.i(271645);let l={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M464 720a48 48 0 1096 0 48 48 0 10-96 0zm16-304v184c0 4.4 3.6 8 8 8h48c4.4 0 8-3.6 8-8V416c0-4.4-3.6-8-8-8h-48c-4.4 0-8 3.6-8 8zm475.7 440l-416-720c-6.2-10.7-16.9-16-27.7-16s-21.6 5.3-27.7 16l-416 720C56 877.4 71.4 904 96 904h832c24.6 0 40-26.6 27.7-48zm-783.5-27.9L512 239.9l339.8 588.2H172.2z"}}]},name:"warning",theme:"outlined"};var i=e.i(9583),a=s.forwardRef(function(e,a){return s.createElement(i.default,(0,t.default)({},e,{ref:a,icon:l}))});e.s(["WarningOutlined",0,a],285027)},213205,e=>{"use strict";e.i(247167);var t=e.i(931067),s=e.i(271645);let l={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M678.3 642.4c24.2-13 51.9-20.4 81.4-20.4h.1c3 0 4.4-3.6 2.2-5.6a371.67 371.67 0 00-103.7-65.8c-.4-.2-.8-.3-1.2-.5C719.2 505 759.6 431.7 759.6 349c0-137-110.8-248-247.5-248S264.7 212 264.7 349c0 82.7 40.4 156 102.6 201.1-.4.2-.8.3-1.2.5-44.7 18.9-84.8 46-119.3 80.6a373.42 373.42 0 00-80.4 119.5A373.6 373.6 0 00137 888.8a8 8 0 008 8.2h59.9c4.3 0 7.9-3.5 8-7.8 2-77.2 32.9-149.5 87.6-204.3C357 628.2 432.2 597 512.2 597c56.7 0 111.1 15.7 158 45.1a8.1 8.1 0 008.1.3zM512.2 521c-45.8 0-88.9-17.9-121.4-50.4A171.2 171.2 0 01340.5 349c0-45.9 17.9-89.1 50.3-121.6S466.3 177 512.2 177s88.9 17.9 121.4 50.4A171.2 171.2 0 01683.9 349c0 45.9-17.9 89.1-50.3 121.6C601.1 503.1 558 521 512.2 521zM880 759h-84v-84c0-4.4-3.6-8-8-8h-56c-4.4 0-8 3.6-8 8v84h-84c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h84v84c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8v-84h84c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8z"}}]},name:"user-add",theme:"outlined"};var i=e.i(9583),a=s.forwardRef(function(e,a){return s.createElement(i.default,(0,t.default)({},e,{ref:a,icon:l}))});e.s(["UserAddOutlined",0,a],213205)},355619,e=>{"use strict";var t=e.i(764205);let s=async(e,s,l)=>{try{if(null===e||null===s)return;if(null!==l){let i=(await (0,t.modelAvailableCall)(l,e,s,!0,null,!0)).data.map(e=>e.id),a=[],r=[];return i.forEach(e=>{e.endsWith("/*")?a.push(e):r.push(e)}),[...a,...r]}}catch(e){console.error("Error fetching user models:",e)}};e.s(["fetchAvailableModelsForTeamOrKey",0,s,"getModelDisplayName",0,e=>{if("all-proxy-models"===e)return"All Proxy Models";if(e.endsWith("/*")){let t=e.replace("/*","");return`All ${t} models`}return e},"unfurlWildcardModelsInList",0,(e,t)=>{let s=[],l=[];return console.log("teamModels",e),console.log("allModels",t),e.forEach(e=>{if(e.endsWith("/*")){let i=e.replace("/*",""),a=t.filter(e=>e.startsWith(i+"/"));l.push(...a),s.push(e)}else l.push(e)}),[...s,...l].filter((e,t,s)=>s.indexOf(e)===t)}])},860585,e=>{"use strict";var t=e.i(843476),s=e.i(199133);let{Option:l}=s.Select;e.s(["default",0,({value:e,onChange:i,className:a="",style:r={}})=>(0,t.jsxs)(s.Select,{style:{width:"100%",...r},value:e||void 0,onChange:i,className:a,placeholder:"n/a",allowClear:!0,children:[(0,t.jsx)(l,{value:"24h",children:"daily"}),(0,t.jsx)(l,{value:"7d",children:"weekly"}),(0,t.jsx)(l,{value:"30d",children:"monthly"})]}),"getBudgetDurationLabel",0,e=>e?({"24h":"daily","7d":"weekly","30d":"monthly"})[e]||e:"Not set"])},447082,e=>{"use strict";var t=e.i(843476),s=e.i(271645),l=e.i(599724),i=e.i(464571),a=e.i(212931),r=e.i(291542),n=e.i(515831),d=e.i(898586),o=e.i(519756),c=e.i(737434),m=e.i(285027),u=e.i(993914),h=e.i(955135);e.i(247167);var x=e.i(931067);let p={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M854.6 288.6L639.4 73.4c-6-6-14.1-9.4-22.6-9.4H192c-17.7 0-32 14.3-32 32v832c0 17.7 14.3 32 32 32h640c17.7 0 32-14.3 32-32V311.3c0-8.5-3.4-16.7-9.4-22.7zM790.2 326H602V137.8L790.2 326zm1.8 562H232V136h302v216a42 42 0 0042 42h216v494zM472 744a40 40 0 1080 0 40 40 0 10-80 0zm16-104h48c4.4 0 8-3.6 8-8V448c0-4.4-3.6-8-8-8h-48c-4.4 0-8 3.6-8 8v184c0 4.4 3.6 8 8 8z"}}]},name:"file-exclamation",theme:"outlined"};var f=e.i(9583),g=s.forwardRef(function(e,t){return s.createElement(f.default,(0,x.default)({},e,{ref:t,icon:p}))}),j=e.i(764205),y=e.i(59935),b=e.i(220508),v=e.i(964306);let w=s.forwardRef(function(e,t){return s.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:t},e),s.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"}))});var _=e.i(237016),N=e.i(727749);e.s(["default",0,({accessToken:e,teams:x,possibleUIRoles:p,onUsersCreated:f})=>{let[C,S]=(0,s.useState)(!1),[k,I]=(0,s.useState)([]),[T,U]=(0,s.useState)(!1),[O,F]=(0,s.useState)(null),[V,L]=(0,s.useState)(null),[E,M]=(0,s.useState)(null),[B,P]=(0,s.useState)(null),[z,A]=(0,s.useState)(null),[R,$]=(0,s.useState)("http://localhost:4000");(0,s.useEffect)(()=>{(async()=>{try{let t=await (0,j.getProxyUISettings)(e);A(t)}catch(e){console.error("Error fetching UI settings:",e)}})(),$(new URL("/",window.location.href).toString())},[e]);let D=async()=>{U(!0);let t=k.map(e=>({...e,status:"pending"}));I(t);let s=!1;for(let l=0;le.trim()).filter(Boolean),0===t.teams.length&&delete t.teams),i.models&&"string"==typeof i.models&&""!==i.models.trim()&&(t.models=i.models.split(",").map(e=>e.trim()).filter(Boolean),0===t.models.length&&delete t.models),i.max_budget&&""!==i.max_budget.toString().trim()){let e=parseFloat(i.max_budget.toString());!isNaN(e)&&e>0&&(t.max_budget=e)}i.budget_duration&&""!==i.budget_duration.trim()&&(t.budget_duration=i.budget_duration.trim()),i.metadata&&"string"==typeof i.metadata&&""!==i.metadata.trim()&&(t.metadata=i.metadata.trim()),console.log("Sending user data:",t);let a=await (0,j.userCreateCall)(e,null,t);if(console.log("Full response:",a),a&&(a.key||a.user_id)){s=!0,console.log("Success case triggered");let t=a.data?.user_id||a.user_id;try{if(z?.SSO_ENABLED){let e=new URL("/ui",R).toString();I(t=>t.map((t,s)=>s===l?{...t,status:"success",key:a.key||a.user_id,invitation_link:e}:t))}else{let s=await (0,j.invitationCreateCall)(e,t),i=new URL(`/ui?invitation_id=${s.id}`,R).toString();I(e=>e.map((e,t)=>t===l?{...e,status:"success",key:a.key||a.user_id,invitation_link:i}:e))}}catch(e){console.error("Error creating invitation:",e),I(e=>e.map((e,t)=>t===l?{...e,status:"success",key:a.key||a.user_id,error:"User created but failed to generate invitation link"}:e))}}else{console.log("Error case triggered");let e=a?.error||"Failed to create user";console.log("Error message:",e),I(t=>t.map((t,s)=>s===l?{...t,status:"failed",error:e}:t))}}catch(t){console.error("Caught error:",t);let e=t?.response?.data?.error||t?.message||String(t);I(t=>t.map((t,s)=>s===l?{...t,status:"failed",error:e}:t))}}U(!1),s&&f&&f()},K=[{title:"Row",dataIndex:"rowNumber",key:"rowNumber",width:80},{title:"Email",dataIndex:"user_email",key:"user_email"},{title:"Role",dataIndex:"user_role",key:"user_role"},{title:"Teams",dataIndex:"teams",key:"teams"},{title:"Budget",dataIndex:"max_budget",key:"max_budget"},{title:"Status",key:"status",render:(e,s)=>s.isValid?s.status&&"pending"!==s.status?"success"===s.status?(0,t.jsxs)("div",{children:[(0,t.jsxs)("div",{className:"flex items-center",children:[(0,t.jsx)(b.CheckCircleIcon,{className:"h-5 w-5 text-green-500 mr-2"}),(0,t.jsx)("span",{className:"text-green-500",children:"Success"})]}),s.invitation_link&&(0,t.jsx)("div",{className:"mt-1",children:(0,t.jsxs)("div",{className:"flex items-center",children:[(0,t.jsx)("span",{className:"text-xs text-gray-500 truncate max-w-[150px]",children:s.invitation_link}),(0,t.jsx)(_.CopyToClipboard,{text:s.invitation_link,onCopy:()=>N.default.success("Invitation link copied!"),children:(0,t.jsx)("button",{className:"ml-1 text-blue-500 text-xs hover:text-blue-700",children:"Copy"})})]})})]}):(0,t.jsxs)("div",{children:[(0,t.jsxs)("div",{className:"flex items-center",children:[(0,t.jsx)(v.XCircleIcon,{className:"h-5 w-5 text-red-500 mr-2"}),(0,t.jsx)("span",{className:"text-red-500",children:"Failed"})]}),s.error&&(0,t.jsx)("span",{className:"text-sm text-red-500 ml-7",children:JSON.stringify(s.error)})]}):(0,t.jsx)("span",{className:"text-gray-500",children:"Pending"}):(0,t.jsxs)("div",{children:[(0,t.jsxs)("div",{className:"flex items-center",children:[(0,t.jsx)(v.XCircleIcon,{className:"h-5 w-5 text-red-500 mr-2"}),(0,t.jsx)("span",{className:"text-red-500",children:"Invalid"})]}),s.error&&(0,t.jsx)("span",{className:"text-sm text-red-500 ml-7",children:s.error})]})}];return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(i.Button,{type:"primary",className:"mb-0",onClick:()=>S(!0),children:"+ Bulk Invite Users"}),(0,t.jsx)(a.Modal,{title:"Bulk Invite Users",open:C,width:800,onCancel:()=>S(!1),bodyStyle:{maxHeight:"70vh",overflow:"auto"},footer:null,children:(0,t.jsx)("div",{className:"flex flex-col",children:0===k.length?(0,t.jsxs)("div",{className:"mb-6",children:[(0,t.jsxs)("div",{className:"flex items-center mb-4",children:[(0,t.jsx)("div",{className:"w-8 h-8 rounded-full bg-blue-500 text-white flex items-center justify-center mr-3",children:"1"}),(0,t.jsx)("h3",{className:"text-lg font-medium",children:"Download and fill the template"})]}),(0,t.jsxs)("div",{className:"ml-11 mb-6",children:[(0,t.jsx)("p",{className:"mb-4",children:"Add multiple users at once by following these steps:"}),(0,t.jsxs)("ol",{className:"list-decimal list-inside space-y-2 ml-2 mb-4",children:[(0,t.jsx)("li",{children:"Download our CSV template"}),(0,t.jsx)("li",{children:"Add your users' information to the spreadsheet"}),(0,t.jsx)("li",{children:"Save the file and upload it here"}),(0,t.jsx)("li",{children:"After creation, download the results file containing the Virtual Keys for each user"})]}),(0,t.jsxs)("div",{className:"bg-gray-50 p-4 rounded-md border border-gray-200 mb-4",children:[(0,t.jsx)("h4",{className:"font-medium mb-2",children:"Template Column Names"}),(0,t.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:[(0,t.jsxs)("div",{className:"flex items-start",children:[(0,t.jsx)("div",{className:"w-3 h-3 rounded-full bg-red-500 mt-1.5 mr-2 flex-shrink-0"}),(0,t.jsxs)("div",{children:[(0,t.jsx)("p",{className:"font-medium",children:"user_email"}),(0,t.jsx)("p",{className:"text-sm text-gray-600",children:"User's email address (required)"})]})]}),(0,t.jsxs)("div",{className:"flex items-start",children:[(0,t.jsx)("div",{className:"w-3 h-3 rounded-full bg-red-500 mt-1.5 mr-2 flex-shrink-0"}),(0,t.jsxs)("div",{children:[(0,t.jsx)("p",{className:"font-medium",children:"user_role"}),(0,t.jsx)("p",{className:"text-sm text-gray-600",children:'User\'s role (one of: "proxy_admin", "proxy_admin_viewer", "internal_user", "internal_user_viewer")'})]})]}),(0,t.jsxs)("div",{className:"flex items-start",children:[(0,t.jsx)("div",{className:"w-3 h-3 rounded-full bg-gray-300 mt-1.5 mr-2 flex-shrink-0"}),(0,t.jsxs)("div",{children:[(0,t.jsx)("p",{className:"font-medium",children:"teams"}),(0,t.jsx)("p",{className:"text-sm text-gray-600",children:'Comma-separated team IDs (e.g., "team-1,team-2")'})]})]}),(0,t.jsxs)("div",{className:"flex items-start",children:[(0,t.jsx)("div",{className:"w-3 h-3 rounded-full bg-gray-300 mt-1.5 mr-2 flex-shrink-0"}),(0,t.jsxs)("div",{children:[(0,t.jsx)("p",{className:"font-medium",children:"max_budget"}),(0,t.jsx)("p",{className:"text-sm text-gray-600",children:'Maximum budget as a number (e.g., "100")'})]})]}),(0,t.jsxs)("div",{className:"flex items-start",children:[(0,t.jsx)("div",{className:"w-3 h-3 rounded-full bg-gray-300 mt-1.5 mr-2 flex-shrink-0"}),(0,t.jsxs)("div",{children:[(0,t.jsx)("p",{className:"font-medium",children:"budget_duration"}),(0,t.jsx)("p",{className:"text-sm text-gray-600",children:'Budget reset period (e.g., "30d", "1mo")'})]})]}),(0,t.jsxs)("div",{className:"flex items-start",children:[(0,t.jsx)("div",{className:"w-3 h-3 rounded-full bg-gray-300 mt-1.5 mr-2 flex-shrink-0"}),(0,t.jsxs)("div",{children:[(0,t.jsx)("p",{className:"font-medium",children:"models"}),(0,t.jsx)("p",{className:"text-sm text-gray-600",children:'Comma-separated allowed models (e.g., "gpt-3.5-turbo,gpt-4")'})]})]})]})]}),(0,t.jsx)(i.Button,{type:"primary",size:"large",className:"w-full md:w-auto",icon:(0,t.jsx)(c.DownloadOutlined,{}),children:"Download CSV Template"})]}),(0,t.jsxs)("div",{className:"flex items-center mb-4",children:[(0,t.jsx)("div",{className:"w-8 h-8 rounded-full bg-blue-500 text-white flex items-center justify-center mr-3",children:"2"}),(0,t.jsx)("h3",{className:"text-lg font-medium",children:"Upload your completed CSV"})]}),(0,t.jsxs)("div",{className:"ml-11",children:[B?(0,t.jsxs)("div",{className:`mb-4 p-4 rounded-md border ${E?"bg-red-50 border-red-200":"bg-blue-50 border-blue-200"}`,children:[(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[(0,t.jsxs)("div",{className:"flex items-center",children:[E?(0,t.jsx)(g,{className:"text-red-500 text-xl mr-3"}):(0,t.jsx)(u.FileTextOutlined,{className:"text-blue-500 text-xl mr-3"}),(0,t.jsxs)("div",{children:[(0,t.jsx)(d.Typography.Text,{strong:!0,className:E?"text-red-800":"text-blue-800",children:B.name}),(0,t.jsxs)(d.Typography.Text,{className:`block text-xs ${E?"text-red-600":"text-blue-600"}`,children:[(B.size/1024).toFixed(1)," KB • ",new Date().toLocaleDateString()]})]})]}),(0,t.jsx)(i.Button,{size:"small",onClick:()=>{P(null),I([]),F(null),L(null),M(null)},className:"flex items-center",icon:(0,t.jsx)(h.DeleteOutlined,{}),children:"Remove"})]}),E?(0,t.jsxs)("div",{className:"mt-3 text-red-600 text-sm flex items-start",children:[(0,t.jsx)(m.WarningOutlined,{className:"mr-2 mt-0.5"}),(0,t.jsx)("span",{children:E})]}):!V&&(0,t.jsxs)("div",{className:"mt-3 flex items-center",children:[(0,t.jsx)("div",{className:"w-full bg-gray-200 rounded-full h-1.5",children:(0,t.jsx)("div",{className:"bg-blue-500 h-1.5 rounded-full w-full animate-pulse"})}),(0,t.jsx)("span",{className:"ml-2 text-xs text-blue-600",children:"Processing..."})]})]}):(0,t.jsx)(n.Upload,{beforeUpload:e=>((F(null),L(null),M(null),P(e),"text/csv"===e.type||e.name.endsWith(".csv"))?e.size>5242880?M(`File is too large (${(e.size/1048576).toFixed(1)} MB). Please upload a CSV file smaller than 5MB.`):y.default.parse(e,{complete:e=>{if(!e.data||0===e.data.length){L("The CSV file appears to be empty. Please upload a file with data."),I([]);return}if(1===e.data.length){L("The CSV file only contains headers but no user data. Please add user data to your CSV."),I([]);return}let t=e.data[0];if(0===t.length||1===t.length&&""===t[0]){L("The CSV file doesn't contain any column headers. Please make sure your CSV has headers."),I([]);return}let s=["user_email","user_role"].filter(e=>!t.includes(e));if(s.length>0){L(`Your CSV is missing these required columns: ${s.join(", ")}. Please add these columns to your CSV file.`),I([]);return}try{let s=e.data.slice(1).map((e,s)=>{if(0===e.length||1===e.length&&""===e[0])return null;if(e.length=parseFloat(l.max_budget.toString())&&i.push("Max budget must be greater than 0")),l.budget_duration&&!l.budget_duration.match(/^\d+[dhmwy]$|^\d+mo$/)&&i.push(`Invalid budget duration format "${l.budget_duration}". Use format like "30d", "1mo", "2w", "6h"`),l.teams&&"string"==typeof l.teams&&x&&x.length>0){let e=x.map(e=>e.team_id),t=l.teams.split(",").map(e=>e.trim()).filter(t=>!e.includes(t));t.length>0&&i.push(`Unknown team(s): ${t.join(", ")}`)}return i.length>0&&(l.isValid=!1,l.error=i.join(", ")),l}).filter(Boolean),l=s.filter(e=>e.isValid);I(s),0===s.length?L("No valid data rows found in the CSV file. Please check your file format."):0===l.length?F("No valid users found in the CSV. Please check the errors below and fix your CSV file."):l.length{F(`Failed to parse CSV file: ${e.message}`),I([])},header:!1}):(M(`Invalid file type: ${e.name}. Please upload a CSV file (.csv extension).`),N.default.fromBackend("Invalid file type. Please upload a CSV file.")),!1),accept:".csv",maxCount:1,showUploadList:!1,children:(0,t.jsxs)("div",{className:"border-2 border-dashed border-gray-300 rounded-lg p-8 text-center hover:border-blue-500 transition-colors cursor-pointer",children:[(0,t.jsx)(o.UploadOutlined,{className:"text-3xl text-gray-400 mb-2"}),(0,t.jsx)("p",{className:"mb-1",children:"Drag and drop your CSV file here"}),(0,t.jsx)("p",{className:"text-sm text-gray-500 mb-3",children:"or"}),(0,t.jsx)(i.Button,{size:"small",children:"Browse files"}),(0,t.jsx)("p",{className:"text-xs text-gray-500 mt-4",children:"Only CSV files (.csv) are supported"})]})}),V&&(0,t.jsx)("div",{className:"mb-4 p-4 bg-yellow-50 border border-yellow-200 rounded-md",children:(0,t.jsxs)("div",{className:"flex items-start",children:[(0,t.jsx)(w,{className:"h-5 w-5 text-yellow-500 mr-2 mt-0.5"}),(0,t.jsxs)("div",{children:[(0,t.jsx)(d.Typography.Text,{strong:!0,className:"text-yellow-800",children:"CSV Structure Error"}),(0,t.jsx)(d.Typography.Paragraph,{className:"text-yellow-700 mt-1 mb-0",children:V}),(0,t.jsx)(d.Typography.Paragraph,{className:"text-yellow-700 mt-2 mb-0",children:"Please download our template and ensure your CSV follows the required format."})]})]})})]})]}):(0,t.jsxs)("div",{className:"mb-6",children:[(0,t.jsxs)("div",{className:"flex items-center mb-4",children:[(0,t.jsx)("div",{className:"w-8 h-8 rounded-full bg-blue-500 text-white flex items-center justify-center mr-3",children:"3"}),(0,t.jsx)("h3",{className:"text-lg font-medium",children:k.some(e=>"success"===e.status||"failed"===e.status)?"User Creation Results":"Review and create users"})]}),O&&(0,t.jsx)("div",{className:"ml-11 mb-4 p-4 bg-red-50 border border-red-200 rounded-md",children:(0,t.jsxs)("div",{className:"flex items-start",children:[(0,t.jsx)(m.WarningOutlined,{className:"text-red-500 mr-2 mt-1"}),(0,t.jsxs)("div",{children:[(0,t.jsx)(l.Text,{className:"text-red-600 font-medium",children:O}),k.some(e=>!e.isValid)&&(0,t.jsxs)("ul",{className:"mt-2 list-disc list-inside text-red-600 text-sm",children:[(0,t.jsx)("li",{children:"Check the table below for specific errors in each row"}),(0,t.jsx)("li",{children:"Common issues include invalid email formats, missing required fields, or incorrect role values"}),(0,t.jsx)("li",{children:"Fix these issues in your CSV file and upload again"})]})]})]})}),(0,t.jsxs)("div",{className:"ml-11",children:[(0,t.jsxs)("div",{className:"flex justify-between items-center mb-3",children:[(0,t.jsx)("div",{className:"flex items-center",children:k.some(e=>"success"===e.status||"failed"===e.status)?(0,t.jsxs)("div",{className:"flex items-center",children:[(0,t.jsx)(l.Text,{className:"text-lg font-medium mr-3",children:"Creation Summary"}),(0,t.jsxs)(l.Text,{className:"text-sm bg-green-100 text-green-800 px-2 py-1 rounded mr-2",children:[k.filter(e=>"success"===e.status).length," Successful"]}),k.some(e=>"failed"===e.status)&&(0,t.jsxs)(l.Text,{className:"text-sm bg-red-100 text-red-800 px-2 py-1 rounded",children:[k.filter(e=>"failed"===e.status).length," Failed"]})]}):(0,t.jsxs)("div",{className:"flex items-center",children:[(0,t.jsx)(l.Text,{className:"text-lg font-medium mr-3",children:"User Preview"}),(0,t.jsxs)(l.Text,{className:"text-sm bg-blue-100 text-blue-800 px-2 py-1 rounded",children:[k.filter(e=>e.isValid).length," of ",k.length," users valid"]})]})}),!k.some(e=>"success"===e.status||"failed"===e.status)&&(0,t.jsxs)("div",{className:"flex space-x-3",children:[(0,t.jsx)(i.Button,{onClick:()=>{I([]),F(null)},children:"Back"}),(0,t.jsx)(i.Button,{type:"primary",onClick:D,disabled:0===k.filter(e=>e.isValid).length||T,children:T?"Creating...":`Create ${k.filter(e=>e.isValid).length} Users`})]})]}),k.some(e=>"success"===e.status)&&(0,t.jsx)("div",{className:"mb-4 p-4 bg-blue-50 border border-blue-200 rounded-md",children:(0,t.jsxs)("div",{className:"flex items-start",children:[(0,t.jsx)("div",{className:"mr-3 mt-1",children:(0,t.jsx)(b.CheckCircleIcon,{className:"h-5 w-5 text-blue-500"})}),(0,t.jsxs)("div",{children:[(0,t.jsx)(l.Text,{className:"font-medium text-blue-800",children:"User creation complete"}),(0,t.jsxs)(l.Text,{className:"block text-sm text-blue-700 mt-1",children:[(0,t.jsx)("span",{className:"font-medium",children:"Next step:"})," Download the credentials file containing Virtual Keys and invitation links. Users will need these Virtual Keys to make LLM requests through LiteLLM."]})]})]})}),(0,t.jsx)(r.Table,{dataSource:k,columns:K,size:"small",pagination:{pageSize:5},scroll:{y:300},rowClassName:e=>e.isValid?"":"bg-red-50"}),!k.some(e=>"success"===e.status||"failed"===e.status)&&(0,t.jsxs)("div",{className:"flex justify-end mt-4",children:[(0,t.jsx)(i.Button,{onClick:()=>{I([]),F(null)},className:"mr-3",children:"Back"}),(0,t.jsx)(i.Button,{type:"primary",onClick:D,disabled:0===k.filter(e=>e.isValid).length||T,children:T?"Creating...":`Create ${k.filter(e=>e.isValid).length} Users`})]}),k.some(e=>"success"===e.status||"failed"===e.status)&&(0,t.jsxs)("div",{className:"flex justify-end mt-4",children:[(0,t.jsx)(i.Button,{onClick:()=>{I([]),F(null)},className:"mr-3",children:"Start New Bulk Import"}),(0,t.jsx)(i.Button,{type:"primary",onClick:()=>{let e=k.map(e=>({user_email:e.user_email,user_role:e.user_role,status:e.status,key:e.key||"",invitation_link:e.invitation_link||"",error:e.error||""})),t=new Blob([y.default.unparse(e)],{type:"text/csv"}),s=window.URL.createObjectURL(t),l=document.createElement("a");l.href=s,l.download="bulk_users_results.csv",document.body.appendChild(l),l.click(),document.body.removeChild(l),window.URL.revokeObjectURL(s)},icon:(0,t.jsx)(c.DownloadOutlined,{}),children:"Download User Credentials"})]})]})]})})})]})}],447082)},371455,172372,e=>{"use strict";var t=e.i(843476),s=e.i(827252),l=e.i(213205),i=e.i(912598),a=e.i(109799),r=e.i(677667),n=e.i(130643),d=e.i(898667),o=e.i(35983),c=e.i(779241),m=e.i(560445),u=e.i(464571),h=e.i(808613),x=e.i(311451),p=e.i(212931),f=e.i(199133),g=e.i(770914),j=e.i(592968),y=e.i(898586),b=e.i(271645),v=e.i(447082),w=e.i(663435),_=e.i(355619),N=e.i(727749),C=e.i(764205),S=e.i(237016),k=e.i(599724);function I({isInvitationLinkModalVisible:e,setIsInvitationLinkModalVisible:s,baseUrl:l,invitationLinkData:i,modalType:a="invitation"}){let{Title:r,Paragraph:n}=y.Typography,d=()=>{if(!l)return"";let e=new URL(l).pathname,t=e&&"/"!==e?`${e}/ui`:"ui";if(i?.has_user_setup_sso)return new URL(t,l).toString();let s=`${t}?invitation_id=${i?.id}`;return"resetPassword"===a&&(s+="&action=reset_password"),new URL(s,l).toString()};return(0,t.jsxs)(p.Modal,{title:"invitation"===a?"Invitation Link":"Reset Password Link",open:e,width:800,footer:null,onOk:()=>{s(!1)},onCancel:()=>{s(!1)},children:[(0,t.jsx)(n,{children:"invitation"===a?"Copy and send the generated link to onboard this user to the proxy.":"Copy and send the generated link to the user to reset their password."}),(0,t.jsxs)("div",{className:"flex justify-between pt-5 pb-2",children:[(0,t.jsx)(k.Text,{className:"text-base",children:"User ID"}),(0,t.jsx)(k.Text,{children:i?.user_id})]}),(0,t.jsxs)("div",{className:"flex justify-between pt-5 pb-2",children:[(0,t.jsx)(k.Text,{children:"invitation"===a?"Invitation Link":"Reset Password Link"}),(0,t.jsx)(k.Text,{children:(0,t.jsx)(k.Text,{children:d()})})]}),(0,t.jsx)("div",{className:"flex justify-end mt-5",children:(0,t.jsx)(S.CopyToClipboard,{text:d(),onCopy:()=>N.default.success("Copied!"),children:(0,t.jsx)(u.Button,{type:"primary",children:"invitation"===a?"Copy invitation link":"Copy password reset link"})})})]})}e.s(["default",()=>I],172372);let{Option:T}=f.Select,{Text:U,Link:O,Title:F}=y.Typography;e.s(["CreateUserButton",0,({userID:e,accessToken:y,teams:S,possibleUIRoles:k,onUserCreated:F,isEmbedded:V=!1})=>{let L=(0,i.useQueryClient)(),[E,M]=(0,b.useState)(null),[B]=h.Form.useForm(),[P,z]=(0,b.useState)(!1),[A,R]=(0,b.useState)(!1),[$,D]=(0,b.useState)([]),[K,W]=(0,b.useState)(!1),[H,q]=(0,b.useState)(null),[G,J]=(0,b.useState)(null),{data:Q=[]}=(0,a.useOrganizations)();(0,b.useMemo)(()=>{let e=Q.flatMap(e=>e.teams||[]);return e.length>0?e:S||[]},[Q,S]),(0,b.useEffect)(()=>{let t=async()=>{try{let t=await (0,C.modelAvailableCall)(y,e,"any"),s=[];for(let e=0;e{try{N.default.info("Making API Call"),V||z(!0),t.models&&0!==t.models.length||"proxy_admin"===t.user_role||(t.models=["no-default-models"]),t.organization_ids&&(t.organizations=t.organization_ids,delete t.organization_ids);let s=await (0,C.userCreateCall)(y,null,t);await L.invalidateQueries({queryKey:["userList"]}),R(!0);let l=s.data?.user_id||s.user_id;if(F&&V){F(l),B.resetFields();return}if(E?.SSO_ENABLED){let t={id:"u">typeof crypto&&crypto.randomUUID?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){let t=16*Math.random()|0;return("x"==e?t:3&t|8).toString(16)}),user_id:l,is_accepted:!1,accepted_at:null,expires_at:new Date(Date.now()+6048e5),created_at:new Date,created_by:e,updated_at:new Date,updated_by:e,has_user_setup_sso:!0};q(t),W(!0)}else(0,C.invitationCreateCall)(y,l).then(e=>{e.has_user_setup_sso=!1,q(e),W(!0)});N.default.success("API user Created"),B.resetFields(),localStorage.removeItem("userData"+e)}catch(t){let e=t.response?.data?.detail||t?.message||"Error creating the user";N.default.fromBackend(e),console.error("Error creating the user:",t)}};return V?(0,t.jsxs)(h.Form,{form:B,onFinish:X,labelCol:{span:8},wrapperCol:{span:16},labelAlign:"left",children:[(0,t.jsx)(m.Alert,{message:"Email invitations",description:(0,t.jsxs)(t.Fragment,{children:["New users receive an email invite only when an email integration (SMTP, Resend, or SendGrid) is configured."," ",(0,t.jsx)(O,{href:"https://docs.litellm.ai/docs/proxy/email",target:"_blank",children:"Learn how to set up email notifications"})]}),type:"info",showIcon:!0,className:"mb-4"}),(0,t.jsx)(h.Form.Item,{label:"User Email",name:"user_email",children:(0,t.jsx)(c.TextInput,{placeholder:""})}),(0,t.jsx)(h.Form.Item,{label:"User Role",name:"user_role",children:(0,t.jsx)(f.Select,{children:k&&Object.entries(k).map(([e,{ui_label:s,description:l}])=>(0,t.jsx)(o.SelectItem,{value:e,title:s,children:(0,t.jsxs)("div",{className:"flex",children:[s," ",(0,t.jsx)(U,{className:"ml-2",style:{color:"gray",fontSize:"12px"},children:l})]})},e))})}),(0,t.jsx)(h.Form.Item,{label:"Team",name:"team_id",children:(0,t.jsx)(w.default,{})}),(0,t.jsx)(h.Form.Item,{label:"Metadata",name:"metadata",children:(0,t.jsx)(x.Input.TextArea,{rows:4,placeholder:"Enter metadata as JSON"})}),(0,t.jsx)("div",{style:{textAlign:"right",marginTop:"10px"},children:(0,t.jsx)(u.Button,{htmlType:"submit",children:"Create User"})})]}):(0,t.jsxs)("div",{className:"flex gap-2",children:[(0,t.jsx)(u.Button,{type:"primary",className:"mb-0",onClick:()=>z(!0),children:"+ Invite User"}),(0,t.jsx)(v.default,{accessToken:y,teams:S,possibleUIRoles:k}),(0,t.jsxs)(p.Modal,{title:"Invite User",open:P,width:800,footer:null,onOk:()=>{z(!1),B.resetFields()},onCancel:()=>{z(!1),R(!1),B.resetFields()},children:[(0,t.jsxs)(g.Space,{direction:"vertical",size:"middle",children:[(0,t.jsx)(U,{className:"mb-1",children:"Create a User who can own keys"}),(0,t.jsx)(m.Alert,{message:"Email invitations",description:(0,t.jsxs)(t.Fragment,{children:["New users receive an email invite only when an email integration (SMTP, Resend, or SendGrid) is configured."," ",(0,t.jsx)(O,{href:"https://docs.litellm.ai/docs/proxy/email",target:"_blank",children:"Learn how to set up email notifications"})]}),type:"info",showIcon:!0,className:"mb-4"})]}),(0,t.jsxs)(h.Form,{form:B,onFinish:X,labelCol:{span:8},wrapperCol:{span:16},labelAlign:"left",children:[(0,t.jsx)(h.Form.Item,{label:"User Email",name:"user_email",children:(0,t.jsx)(x.Input,{})}),(0,t.jsx)(h.Form.Item,{label:(0,t.jsxs)("span",{children:["Global Proxy Role"," ",(0,t.jsx)(j.Tooltip,{title:"This role is independent of any team/org specific roles. Configure Team / Organization Admins in the Settings",children:(0,t.jsx)(s.InfoCircleOutlined,{})})]}),name:"user_role",children:(0,t.jsx)(f.Select,{children:k&&Object.entries(k).map(([e,{ui_label:s,description:l}])=>(0,t.jsxs)(o.SelectItem,{value:e,title:s,children:[(0,t.jsx)(U,{children:s}),(0,t.jsxs)(U,{type:"secondary",children:[" - ",l]})]},e))})}),(0,t.jsx)(h.Form.Item,{label:"Team",className:"gap-2",name:"team_id",help:"If selected, user will be added as a 'user' role to the team.",children:(0,t.jsx)(w.default,{})}),(0,t.jsx)(h.Form.Item,{label:"Organization",name:"organization_ids",help:"The user will be added to the selected organization(s).",children:(0,t.jsx)(f.Select,{mode:"multiple",placeholder:"Select Organization",style:{width:"100%"},children:Q.map(e=>(0,t.jsxs)(T,{value:e.organization_id,children:[e.organization_alias," (",e.organization_id,")"]},e.organization_id))})}),(0,t.jsx)(h.Form.Item,{label:"Metadata",name:"metadata",children:(0,t.jsx)(x.Input.TextArea,{rows:4,placeholder:"Enter metadata as JSON"})}),(0,t.jsxs)(r.Accordion,{children:[(0,t.jsx)(d.AccordionHeader,{children:(0,t.jsx)(U,{strong:!0,children:"Personal Key Creation"})}),(0,t.jsx)(n.AccordionBody,{children:(0,t.jsx)(h.Form.Item,{className:"gap-2",label:(0,t.jsxs)("span",{children:["Models"," ",(0,t.jsx)(j.Tooltip,{title:"Models user has access to, outside of team scope.",children:(0,t.jsx)(s.InfoCircleOutlined,{style:{marginLeft:"4px"}})})]}),name:"models",help:"Models user has access to, outside of team scope.",children:(0,t.jsxs)(f.Select,{mode:"multiple",placeholder:"Select models",style:{width:"100%"},children:[(0,t.jsx)(f.Select.Option,{value:"all-proxy-models",children:"All Proxy Models"},"all-proxy-models"),(0,t.jsx)(f.Select.Option,{value:"no-default-models",children:"No Default Models"},"no-default-models"),$.map(e=>(0,t.jsx)(f.Select.Option,{value:e,children:(0,_.getModelDisplayName)(e)},e))]})})})]}),(0,t.jsx)("div",{style:{textAlign:"right",marginTop:"10px"},children:(0,t.jsx)(u.Button,{type:"primary",icon:(0,t.jsx)(l.UserAddOutlined,{}),htmlType:"submit",children:"Invite User"})})]})]}),A&&(0,t.jsx)(I,{isInvitationLinkModalVisible:K,setIsInvitationLinkModalVisible:W,baseUrl:G||"",invitationLinkData:H})]})}],371455)}]); \ No newline at end of file diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/b59aefcfdd5715be.js b/litellm/proxy/_experimental/out/_next/static/chunks/61d8ae4ec4f309fe.js similarity index 64% rename from litellm/proxy/_experimental/out/_next/static/chunks/b59aefcfdd5715be.js rename to litellm/proxy/_experimental/out/_next/static/chunks/61d8ae4ec4f309fe.js index 6fbdb54c04..1acfcff512 100644 --- a/litellm/proxy/_experimental/out/_next/static/chunks/b59aefcfdd5715be.js +++ b/litellm/proxy/_experimental/out/_next/static/chunks/61d8ae4ec4f309fe.js @@ -1 +1 @@ -(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,409797,e=>{"use strict";var t=e.i(631171);e.s(["ChevronDownIcon",()=>t.default])},246349,e=>{"use strict";let t=(0,e.i(475254).default)("chevron-right",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);e.s(["default",()=>t])},91739,e=>{"use strict";var t=e.i(544195);e.s(["Radio",()=>t.default])},988297,e=>{"use strict";var t=e.i(271645);let r=t.forwardRef(function(e,r){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:r},e),t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 4v16m8-8H4"}))});e.s(["PlusIcon",0,r],988297)},797672,e=>{"use strict";var t=e.i(271645);let r=t.forwardRef(function(e,r){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:r},e),t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15.232 5.232l3.536 3.536m-2.036-5.036a2.5 2.5 0 113.536 3.536L6.5 21.036H3v-3.572L16.732 3.732z"}))});e.s(["PencilIcon",0,r],797672)},992619,e=>{"use strict";var t=e.i(843476),r=e.i(271645),n=e.i(779241),i=e.i(599724),s=e.i(199133),a=e.i(983561),o=e.i(689020);e.s(["default",0,({accessToken:e,value:l,placeholder:c="Select a Model",onChange:d,disabled:u=!1,style:f,className:h,showLabel:p=!0,labelText:m="Select Model"})=>{let[g,y]=(0,r.useState)(l),[b,x]=(0,r.useState)(!1),[v,k]=(0,r.useState)([]),_=(0,r.useRef)(null);return(0,r.useEffect)(()=>{y(l)},[l]),(0,r.useEffect)(()=>{e&&(async()=>{try{let t=await (0,o.fetchAvailableModels)(e);console.log("Fetched models for selector:",t),t.length>0&&k(t)}catch(e){console.error("Error fetching model info:",e)}})()},[e]),(0,t.jsxs)("div",{children:[p&&(0,t.jsxs)(i.Text,{className:"font-medium block mb-2 text-gray-700 flex items-center",children:[(0,t.jsx)(a.RobotOutlined,{className:"mr-2"})," ",m]}),(0,t.jsx)(s.Select,{value:g,placeholder:c,onChange:e=>{"custom"===e?(x(!0),y(void 0)):(x(!1),y(e),d&&d(e))},options:[...Array.from(new Set(v.map(e=>e.model_group))).map((e,t)=>({value:e,label:e,key:t})),{value:"custom",label:"Enter custom model",key:"custom"}],style:{width:"100%",...f},showSearch:!0,className:`rounded-md ${h||""}`,disabled:u}),b&&(0,t.jsx)(n.TextInput,{className:"mt-2",placeholder:"Enter custom model name",onValueChange:e=>{_.current&&clearTimeout(_.current),_.current=setTimeout(()=>{y(e),d&&d(e)},500)},disabled:u})]})}])},500727,699857,696609,531516,e=>{"use strict";var t=e.i(266027),r=e.i(243652),n=e.i(764205),i=e.i(135214);let s=(0,r.createQueryKeys)("mcpServers");e.s(["useMCPServers",0,e=>{let{accessToken:r}=(0,i.default)();return(0,t.useQuery)({queryKey:s.list(e?{filters:{teamId:e}}:void 0),queryFn:async()=>await (0,n.fetchMCPServers)(r,e),enabled:!!r})}],500727);let a=(0,r.createQueryKeys)("mcpToolsets");e.s(["useMCPToolsets",0,()=>{let{accessToken:e}=(0,i.default)();return(0,t.useQuery)({queryKey:a.list(),queryFn:async()=>await (0,n.fetchMCPToolsets)(e),enabled:!!e})}],699857);var o=e.i(843476),l=e.i(271645),c=e.i(536916),d=e.i(599724),u=e.i(409797),f=e.i(246349),f=f;let h=/\b(delete|remove|destroy|purge|drop|erase|unlink)\b/i,p=/\b(create|add|insert|new|post|submit|register|make|generate|write|upload)\b/i,m=/\b(update|edit|modify|change|patch|put|set|rename|move|transform)\b/i,g=/\b(get|read|list|fetch|search|find|query|retrieve|show|view|check|describe|info)\b/i;function y(e,t=""){let r=e.toLowerCase();if(g.test(r))return"read";if(h.test(r))return"delete";if(m.test(r))return"update";if(p.test(r))return"create";if(t){let e=t.toLowerCase();if(g.test(e))return"read";if(h.test(e))return"delete";if(m.test(e))return"update";if(p.test(e))return"create"}return"unknown"}function b(e){let t={read:[],create:[],update:[],delete:[],unknown:[]};for(let r of e)t[y(r.name,r.description)].push(r);return t}let x={read:{label:"Read",description:"Safe operations — fetch, list, search. No side effects.",risk:"low"},create:{label:"Create",description:"Add new resources — insert, upload, register.",risk:"medium"},update:{label:"Update",description:"Modify existing resources — edit, patch, rename.",risk:"medium"},delete:{label:"Delete",description:"Destructive operations — remove, purge, destroy.",risk:"high"},unknown:{label:"Other",description:"Operations that could not be automatically classified.",risk:"unknown"}};e.s(["CRUD_GROUP_META",0,x,"classifyToolOp",()=>y,"groupToolsByCrud",()=>b],696609);let v=["read","create","update","delete","unknown"],k={low:"bg-green-100 text-green-800",medium:"bg-yellow-100 text-yellow-800",high:"bg-red-100 text-red-800 font-semibold",unknown:"bg-gray-100 text-gray-700"},_={read:"border-green-200",create:"border-blue-200",update:"border-yellow-200",delete:"border-red-300",unknown:"border-gray-200"},w={read:"bg-green-50",create:"bg-blue-50",update:"bg-yellow-50",delete:"bg-red-50",unknown:"bg-gray-50"};e.s(["default",0,({tools:e,value:t,onChange:r,readOnly:n=!1,searchFilter:i=""})=>{let[s,a]=(0,l.useState)({read:!1,create:!1,update:!1,delete:!1,unknown:!0}),h=(0,l.useMemo)(()=>b(e),[e]),p=(0,l.useMemo)(()=>new Set(void 0===t?e.map(e=>e.name):t),[t,e]),m=e=>{if(n)return;let t=new Set(p);t.has(e)?t.delete(e):t.add(e),r(Array.from(t))};return 0===e.length?null:(0,o.jsx)("div",{className:"space-y-3",children:v.map(e=>{let t,l=h[e];if(0===l.length)return null;if(i){let e=i.toLowerCase();if(!l.some(t=>t.name.toLowerCase().includes(e)||(t.description??"").toLowerCase().includes(e)))return null}let g=x[e],y=(t=h[e]).length>0&&t.every(e=>p.has(e.name)),b=(e=>{let t=h[e];if(0===t.length)return!1;let r=t.filter(e=>p.has(e.name)).length;return r>0&&r{a(t=>({...t,[e]:!t[e]}))},children:[v?(0,o.jsx)(f.default,{className:"w-4 h-4 text-gray-500 flex-shrink-0"}):(0,o.jsx)(u.ChevronDownIcon,{className:"w-4 h-4 text-gray-500 flex-shrink-0"}),(0,o.jsx)("span",{className:"font-semibold text-gray-900 text-sm",children:g.label}),(0,o.jsx)("span",{className:`text-xs px-2 py-0.5 rounded-full ${k[g.risk]}`,children:"high"===g.risk?"High Risk":"medium"===g.risk?"Medium Risk":"low"===g.risk?"Safe":"Unclassified"}),(0,o.jsxs)("span",{className:"text-xs text-gray-500 ml-1",children:[l.filter(e=>p.has(e.name)).length,"/",l.length," allowed"]})]}),!n&&(0,o.jsxs)("div",{className:"flex items-center gap-2 ml-4",children:[(0,o.jsx)(d.Text,{className:"text-xs text-gray-500",children:y?"All on":b?"Partial":"All off"}),(0,o.jsx)(c.Checkbox,{checked:y,indeterminate:b,onChange:t=>((e,t)=>{if(n)return;let i=new Set(p);for(let r of h[e])t?i.add(r.name):i.delete(r.name);r(Array.from(i))})(e,t.target.checked),onClick:e=>e.stopPropagation()})]})]}),!v&&(0,o.jsx)("div",{className:"px-4 pt-2 pb-1 text-xs text-gray-500 bg-white border-b border-gray-100",children:g.description}),!v&&(0,o.jsx)("div",{className:"bg-white divide-y divide-gray-50",children:l.filter(e=>!i||e.name.toLowerCase().includes(i.toLowerCase())||(e.description??"").toLowerCase().includes(i.toLowerCase())).map(e=>{let t,r=(t=e.name,p.has(t));return(0,o.jsxs)("div",{className:`flex items-start gap-3 px-4 py-2.5 transition-colors hover:bg-gray-50 ${!n?"cursor-pointer":""} ${r?"":"opacity-60"}`,onClick:()=>m(e.name),children:[(0,o.jsx)(c.Checkbox,{checked:r,onChange:()=>m(e.name),disabled:n,onClick:e=>e.stopPropagation()}),(0,o.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,o.jsx)(d.Text,{className:"font-medium text-gray-900 text-sm",children:e.name}),e.description&&(0,o.jsx)(d.Text,{className:"text-xs text-gray-500 mt-0.5 leading-snug",children:e.description})]}),(0,o.jsx)("span",{className:`text-xs px-1.5 py-0.5 rounded flex-shrink-0 ${r?"bg-green-100 text-green-700":"bg-gray-100 text-gray-500"}`,children:r?"on":"off"})]},e.name)})})]},e)})})}],531516)},793130,e=>{"use strict";var t=e.i(290571),r=e.i(429427),n=e.i(371330),i=e.i(271645),s=e.i(394487),a=e.i(503269),o=e.i(214520),l=e.i(746725),c=e.i(914189),d=e.i(144279),u=e.i(294316),f=e.i(601893),h=e.i(140721),p=e.i(942803),m=e.i(233538),g=e.i(694421),y=e.i(700020),b=e.i(35889),x=e.i(998348),v=e.i(722678);let k=(0,i.createContext)(null);k.displayName="GroupContext";let _=i.Fragment,w=Object.assign((0,y.forwardRefWithAs)(function(e,t){var _;let w=(0,i.useId)(),C=(0,p.useProvidedId)(),j=(0,f.useDisabled)(),{id:S=C||`headlessui-switch-${w}`,disabled:E=j||!1,checked:O,defaultChecked:N,onChange:$,name:R,value:T,form:M,autoFocus:P=!1,...D}=e,I=(0,i.useContext)(k),[L,F]=(0,i.useState)(null),A=(0,i.useRef)(null),z=(0,u.useSyncRefs)(A,t,null===I?null:I.setSwitch,F),B=(0,o.useDefaultValue)(N),[W,q]=(0,a.useControllable)(O,$,null!=B&&B),H=(0,l.useDisposables)(),[U,K]=(0,i.useState)(!1),X=(0,c.useEvent)(()=>{K(!0),null==q||q(!W),H.nextFrame(()=>{K(!1)})}),Q=(0,c.useEvent)(e=>{if((0,m.isDisabledReactIssue7711)(e.currentTarget))return e.preventDefault();e.preventDefault(),X()}),V=(0,c.useEvent)(e=>{e.key===x.Keys.Space?(e.preventDefault(),X()):e.key===x.Keys.Enter&&(0,g.attemptSubmit)(e.currentTarget)}),G=(0,c.useEvent)(e=>e.preventDefault()),J=(0,v.useLabelledBy)(),Y=(0,b.useDescribedBy)(),{isFocusVisible:Z,focusProps:ee}=(0,r.useFocusRing)({autoFocus:P}),{isHovered:et,hoverProps:er}=(0,n.useHover)({isDisabled:E}),{pressed:en,pressProps:ei}=(0,s.useActivePress)({disabled:E}),es=(0,i.useMemo)(()=>({checked:W,disabled:E,hover:et,focus:Z,active:en,autofocus:P,changing:U}),[W,et,Z,en,E,U,P]),ea=(0,y.mergeProps)({id:S,ref:z,role:"switch",type:(0,d.useResolveButtonType)(e,L),tabIndex:-1===e.tabIndex?0:null!=(_=e.tabIndex)?_:0,"aria-checked":W,"aria-labelledby":J,"aria-describedby":Y,disabled:E||void 0,autoFocus:P,onClick:Q,onKeyUp:V,onKeyPress:G},ee,er,ei),eo=(0,i.useCallback)(()=>{if(void 0!==B)return null==q?void 0:q(B)},[q,B]),el=(0,y.useRender)();return i.default.createElement(i.default.Fragment,null,null!=R&&i.default.createElement(h.FormFields,{disabled:E,data:{[R]:T||"on"},overrides:{type:"checkbox",checked:W},form:M,onReset:eo}),el({ourProps:ea,theirProps:D,slot:es,defaultTag:"button",name:"Switch"}))}),{Group:function(e){var t;let[r,n]=(0,i.useState)(null),[s,a]=(0,v.useLabels)(),[o,l]=(0,b.useDescriptions)(),c=(0,i.useMemo)(()=>({switch:r,setSwitch:n}),[r,n]),d=(0,y.useRender)();return i.default.createElement(l,{name:"Switch.Description",value:o},i.default.createElement(a,{name:"Switch.Label",value:s,props:{htmlFor:null==(t=c.switch)?void 0:t.id,onClick(e){r&&(e.currentTarget instanceof HTMLLabelElement&&e.preventDefault(),r.click(),r.focus({preventScroll:!0}))}}},i.default.createElement(k.Provider,{value:c},d({ourProps:{},theirProps:e,slot:{},defaultTag:_,name:"Switch.Group"}))))},Label:v.Label,Description:b.Description});var C=e.i(888288),j=e.i(95779),S=e.i(444755),E=e.i(673706),O=e.i(829087);let N=(0,E.makeClassName)("Switch"),$=i.default.forwardRef((e,r)=>{let{checked:n,defaultChecked:s=!1,onChange:a,color:o,name:l,error:c,errorMessage:d,disabled:u,required:f,tooltip:h,id:p}=e,m=(0,t.__rest)(e,["checked","defaultChecked","onChange","color","name","error","errorMessage","disabled","required","tooltip","id"]),g={bgColor:o?(0,E.getColorClassNames)(o,j.colorPalette.background).bgColor:"bg-tremor-brand dark:bg-dark-tremor-brand",ringColor:o?(0,E.getColorClassNames)(o,j.colorPalette.ring).ringColor:"ring-tremor-brand-muted dark:ring-dark-tremor-brand-muted"},[y,b]=(0,C.default)(s,n),[x,v]=(0,i.useState)(!1),{tooltipProps:k,getReferenceProps:_}=(0,O.useTooltip)(300);return i.default.createElement("div",{className:"flex flex-row items-center justify-start"},i.default.createElement(O.default,Object.assign({text:h},k)),i.default.createElement("div",Object.assign({ref:(0,E.mergeRefs)([r,k.refs.setReference]),className:(0,S.tremorTwMerge)(N("root"),"flex flex-row relative h-5")},m,_),i.default.createElement("input",{type:"checkbox",className:(0,S.tremorTwMerge)(N("input"),"absolute w-5 h-5 cursor-pointer left-0 top-0 opacity-0"),name:l,required:f,checked:y,onChange:e=>{e.preventDefault()}}),i.default.createElement(w,{checked:y,onChange:e=>{b(e),null==a||a(e)},disabled:u,className:(0,S.tremorTwMerge)(N("switch"),"w-10 h-5 group relative inline-flex shrink-0 cursor-pointer items-center justify-center rounded-tremor-full","focus:outline-none",u?"cursor-not-allowed":""),onFocus:()=>v(!0),onBlur:()=>v(!1),id:p},i.default.createElement("span",{className:(0,S.tremorTwMerge)(N("sr-only"),"sr-only")},"Switch ",y?"on":"off"),i.default.createElement("span",{"aria-hidden":"true",className:(0,S.tremorTwMerge)(N("background"),y?g.bgColor:"bg-tremor-border dark:bg-dark-tremor-border","pointer-events-none absolute mx-auto h-3 w-9 rounded-tremor-full transition-colors duration-100 ease-in-out")}),i.default.createElement("span",{"aria-hidden":"true",className:(0,S.tremorTwMerge)(N("round"),y?(0,S.tremorTwMerge)(g.bgColor,"translate-x-5 border-tremor-background dark:border-dark-tremor-background"):"translate-x-0 bg-tremor-border dark:bg-dark-tremor-border border-tremor-background dark:border-dark-tremor-background","pointer-events-none absolute left-0 inline-block h-5 w-5 transform rounded-tremor-full border-2 shadow-tremor-input duration-100 ease-in-out transition",x?(0,S.tremorTwMerge)("ring-2",g.ringColor):"")}))),c&&d?i.default.createElement("p",{className:(0,S.tremorTwMerge)(N("errorMessage"),"text-sm text-red-500 mt-1 ")},d):null)});$.displayName="Switch",e.s(["Switch",()=>$],793130)},107233,37727,e=>{"use strict";var t=e.i(603908);e.s(["Plus",()=>t.default],107233);var r=e.i(841947);e.s(["X",()=>r.default],37727)},361653,e=>{"use strict";let t=(0,e.i(475254).default)("circle-alert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]]);e.s(["default",()=>t])},603908,e=>{"use strict";let t=(0,e.i(475254).default)("plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);e.s(["default",()=>t])},841947,e=>{"use strict";let t=(0,e.i(475254).default)("x",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);e.s(["default",()=>t])},158392,419470,e=>{"use strict";var t=e.i(843476),r=e.i(779241);let n={ttl:3600,lowest_latency_buffer:0},i=({routingStrategyArgs:e})=>{let i={ttl:"Sliding window to look back over when calculating the average latency of a deployment. Default - 1 hour (in seconds).",lowest_latency_buffer:"Shuffle between deployments within this % of the lowest latency. Default - 0 (i.e. always pick lowest latency)."};return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:"space-y-6",children:[(0,t.jsxs)("div",{className:"max-w-3xl",children:[(0,t.jsx)("h3",{className:"text-sm font-medium text-gray-900",children:"Latency-Based Configuration"}),(0,t.jsx)("p",{className:"text-xs text-gray-500 mt-1",children:"Fine-tune latency-based routing behavior"})]}),(0,t.jsx)("div",{className:"grid grid-cols-1 gap-6 lg:grid-cols-2 xl:grid-cols-3",children:Object.entries(e||n).map(([e,n])=>(0,t.jsx)("div",{className:"space-y-2",children:(0,t.jsxs)("label",{className:"block",children:[(0,t.jsx)("span",{className:"text-xs font-medium text-gray-700 uppercase tracking-wide",children:e.replace(/_/g," ")}),(0,t.jsx)("p",{className:"text-xs text-gray-500 mt-0.5 mb-2",children:i[e]||""}),(0,t.jsx)(r.TextInput,{name:e,defaultValue:"object"==typeof n?JSON.stringify(n,null,2):n?.toString(),className:"font-mono text-sm w-full"})]})},e))})]}),(0,t.jsx)("div",{className:"border-t border-gray-200"})]})},s=({routerSettings:e,routerFieldsMetadata:n})=>(0,t.jsxs)("div",{className:"space-y-6",children:[(0,t.jsxs)("div",{className:"max-w-3xl",children:[(0,t.jsx)("h3",{className:"text-sm font-medium text-gray-900",children:"Reliability & Retries"}),(0,t.jsx)("p",{className:"text-xs text-gray-500 mt-1",children:"Configure retry logic and failure handling"})]}),(0,t.jsx)("div",{className:"grid grid-cols-1 gap-6 lg:grid-cols-2 xl:grid-cols-3",children:Object.entries(e).filter(([e,t])=>"fallbacks"!=e&&"context_window_fallbacks"!=e&&"routing_strategy_args"!=e&&"routing_strategy"!=e&&"enable_tag_filtering"!=e).map(([e,i])=>(0,t.jsx)("div",{className:"space-y-2",children:(0,t.jsxs)("label",{className:"block",children:[(0,t.jsx)("span",{className:"text-xs font-medium text-gray-700 uppercase tracking-wide",children:n[e]?.ui_field_name||e}),(0,t.jsx)("p",{className:"text-xs text-gray-500 mt-0.5 mb-2",children:n[e]?.field_description||""}),(0,t.jsx)(r.TextInput,{name:e,defaultValue:null==i||"null"===i?"":"object"==typeof i?JSON.stringify(i,null,2):i?.toString()||"",placeholder:"—",className:"font-mono text-sm w-full"})]})},e))})]});var a=e.i(199133);let o=({selectedStrategy:e,availableStrategies:r,routingStrategyDescriptions:n,routerFieldsMetadata:i,onStrategyChange:s})=>(0,t.jsxs)("div",{className:"space-y-2 max-w-3xl",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"text-xs font-medium text-gray-700 uppercase tracking-wide",children:i.routing_strategy?.ui_field_name||"Routing Strategy"}),(0,t.jsx)("p",{className:"text-xs text-gray-500 mt-0.5 mb-2",children:i.routing_strategy?.field_description||""})]}),(0,t.jsx)("div",{className:"routing-strategy-select max-w-3xl",children:(0,t.jsx)(a.Select,{value:e,onChange:s,style:{width:"100%"},size:"large",children:r.map(e=>(0,t.jsx)(a.Select.Option,{value:e,label:e,children:(0,t.jsxs)("div",{className:"flex flex-col gap-0.5 py-1",children:[(0,t.jsx)("span",{className:"font-mono text-sm font-medium",children:e}),n[e]&&(0,t.jsx)("span",{className:"text-xs text-gray-500 font-normal",children:n[e]})]})},e))})})]});var l=e.i(793130);let c=({enabled:e,routerFieldsMetadata:r,onToggle:n})=>(0,t.jsx)("div",{className:"space-y-3 max-w-3xl",children:(0,t.jsxs)("div",{className:"flex items-start justify-between",children:[(0,t.jsxs)("div",{className:"flex-1",children:[(0,t.jsx)("label",{className:"text-xs font-medium text-gray-700 uppercase tracking-wide",children:r.enable_tag_filtering?.ui_field_name||"Enable Tag Filtering"}),(0,t.jsxs)("p",{className:"text-xs text-gray-500 mt-0.5",children:[r.enable_tag_filtering?.field_description||"",r.enable_tag_filtering?.link&&(0,t.jsxs)(t.Fragment,{children:[" ",(0,t.jsx)("a",{href:r.enable_tag_filtering.link,target:"_blank",rel:"noopener noreferrer",className:"text-blue-600 hover:text-blue-800 underline",children:"Learn more"})]})]})]}),(0,t.jsx)(l.Switch,{checked:e,onChange:n,className:"ml-4"})]})});e.s(["default",0,({value:e,onChange:r,routerFieldsMetadata:n,availableRoutingStrategies:a,routingStrategyDescriptions:l})=>(0,t.jsxs)("div",{className:"w-full space-y-8 py-2",children:[(0,t.jsxs)("div",{className:"space-y-6",children:[(0,t.jsxs)("div",{className:"max-w-3xl",children:[(0,t.jsx)("h3",{className:"text-sm font-medium text-gray-900",children:"Routing Settings"}),(0,t.jsx)("p",{className:"text-xs text-gray-500 mt-1",children:"Configure how requests are routed to deployments"})]}),a.length>0&&(0,t.jsx)(o,{selectedStrategy:e.selectedStrategy||e.routerSettings.routing_strategy||null,availableStrategies:a,routingStrategyDescriptions:l,routerFieldsMetadata:n,onStrategyChange:t=>{r({...e,selectedStrategy:t})}}),(0,t.jsx)(c,{enabled:e.enableTagFiltering,routerFieldsMetadata:n,onToggle:t=>{r({...e,enableTagFiltering:t})}})]}),(0,t.jsx)("div",{className:"border-t border-gray-200"}),"latency-based-routing"===e.selectedStrategy&&(0,t.jsx)(i,{routingStrategyArgs:e.routerSettings.routing_strategy_args}),(0,t.jsx)(s,{routerSettings:e.routerSettings,routerFieldsMetadata:n})]})],158392);var d=e.i(994388),u=e.i(653496),f=e.i(107233),h=e.i(271645),p=e.i(888259),m=e.i(592968),g=e.i(361653),g=g;let y=(0,e.i(475254).default)("arrow-down",[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]]);var b=e.i(37727);function x({group:e,onChange:r,availableModels:n,maxFallbacks:i}){let s=n.filter(t=>t!==e.primaryModel),o=e.fallbackModels.length{let n=[...e.fallbackModels];n.includes(t)&&(n=n.filter(e=>e!==t)),r({...e,primaryModel:t,fallbackModels:n})},showSearch:!0,getPopupContainer:e=>e.parentElement||document.body,filterOption:(e,t)=>(t?.label??"").toLowerCase().includes(e.toLowerCase()),options:n.map(e=>({label:e,value:e}))}),!e.primaryModel&&(0,t.jsxs)("div",{className:"mt-2 flex items-center gap-2 text-amber-600 text-xs bg-amber-50 p-2 rounded",children:[(0,t.jsx)(g.default,{className:"w-4 h-4"}),(0,t.jsx)("span",{children:"Select a model to begin configuring fallbacks"})]})]}),(0,t.jsx)("div",{className:"flex items-center justify-center -my-4 z-10",children:(0,t.jsxs)("div",{className:"bg-indigo-50 text-indigo-500 px-4 py-1 rounded-full text-xs font-bold border border-indigo-100 flex items-center gap-2 shadow-sm",children:[(0,t.jsx)(y,{className:"w-4 h-4"}),"IF FAILS, TRY..."]})}),(0,t.jsxs)("div",{className:`transition-opacity duration-300 ${!e.primaryModel?"opacity-50 pointer-events-none":"opacity-100"}`,children:[(0,t.jsxs)("label",{className:"block text-sm font-semibold text-gray-700 mb-2",children:["Fallback Chain ",(0,t.jsx)("span",{className:"text-red-500",children:"*"}),(0,t.jsxs)("span",{className:"text-xs text-gray-500 font-normal ml-2",children:["(Max ",i," fallbacks at a time)"]})]}),(0,t.jsxs)("div",{className:"bg-gray-50 rounded-xl p-4 border border-gray-200",children:[(0,t.jsxs)("div",{className:"mb-4",children:[(0,t.jsx)(a.Select,{mode:"multiple",className:"w-full",size:"large",placeholder:o?"Select fallback models to add...":`Maximum ${i} fallbacks reached`,value:e.fallbackModels,onChange:t=>{let n=t.slice(0,i);r({...e,fallbackModels:n})},disabled:!e.primaryModel,getPopupContainer:e=>e.parentElement||document.body,options:s.map(e=>({label:e,value:e})),optionRender:(r,n)=>{let i=e.fallbackModels.includes(r.value),s=i?e.fallbackModels.indexOf(r.value)+1:null;return(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[i&&null!==s&&(0,t.jsx)("span",{className:"flex items-center justify-center w-5 h-5 rounded bg-indigo-100 text-indigo-600 text-xs font-bold",children:s}),(0,t.jsx)("span",{children:r.label})]})},maxTagCount:"responsive",maxTagPlaceholder:e=>(0,t.jsx)(m.Tooltip,{styles:{root:{pointerEvents:"none"}},title:e.map(({value:e})=>e).join(", "),children:(0,t.jsxs)("span",{children:["+",e.length," more"]})}),showSearch:!0,filterOption:(e,t)=>(t?.label??"").toLowerCase().includes(e.toLowerCase())}),(0,t.jsx)("p",{className:"text-xs text-gray-500 mt-1 ml-1",children:o?`Search and select multiple models. Selected models will appear below in order. (${e.fallbackModels.length}/${i} used)`:`Maximum ${i} fallbacks reached. Remove some to add more.`})]}),(0,t.jsx)("div",{className:"space-y-2 min-h-[100px]",children:0===e.fallbackModels.length?(0,t.jsxs)("div",{className:"h-32 border-2 border-dashed border-gray-300 rounded-lg flex flex-col items-center justify-center text-gray-400",children:[(0,t.jsx)("span",{className:"text-sm",children:"No fallback models selected"}),(0,t.jsx)("span",{className:"text-xs mt-1",children:"Add models from the dropdown above"})]}):e.fallbackModels.map((n,i)=>(0,t.jsxs)("div",{className:"group flex items-center justify-between p-3 bg-white rounded-lg border border-gray-200 hover:border-indigo-300 hover:shadow-sm transition-all",children:[(0,t.jsxs)("div",{className:"flex items-center gap-3",children:[(0,t.jsx)("div",{className:"flex items-center justify-center w-6 h-6 rounded bg-gray-100 text-gray-400 group-hover:text-indigo-500 group-hover:bg-indigo-50",children:(0,t.jsx)("span",{className:"text-xs font-bold",children:i+1})}),(0,t.jsx)("div",{children:(0,t.jsx)("span",{className:"font-medium text-gray-800",children:n})})]}),(0,t.jsx)("button",{type:"button",onClick:()=>{let t;return t=e.fallbackModels.filter((e,t)=>t!==i),void r({...e,fallbackModels:t})},className:"opacity-0 group-hover:opacity-100 transition-opacity text-gray-400 hover:text-red-500 p-1",children:(0,t.jsx)(b.X,{className:"w-4 h-4"})})]},`${n}-${i}`))})]})]})]})}function v({groups:e,onGroupsChange:r,availableModels:n,maxFallbacks:i=10,maxGroups:s=5}){let[a,o]=(0,h.useState)(e.length>0?e[0].id:"1");(0,h.useEffect)(()=>{e.length>0?e.some(e=>e.id===a)||o(e[0].id):o("1")},[e]);let l=()=>{if(e.length>=s)return;let t=Date.now().toString();r([...e,{id:t,primaryModel:null,fallbackModels:[]}]),o(t)},c=t=>{r(e.map(e=>e.id===t.id?t:e))},m=e.map((r,s)=>{let a=r.primaryModel?r.primaryModel:`Group ${s+1}`;return{key:r.id,label:a,closable:e.length>1,children:(0,t.jsx)(x,{group:r,onChange:c,availableModels:n,maxFallbacks:i})}});return 0===e.length?(0,t.jsxs)("div",{className:"text-center py-12 bg-gray-50 rounded-lg border border-dashed border-gray-300",children:[(0,t.jsx)("p",{className:"text-gray-500 mb-4",children:"No fallback groups configured"}),(0,t.jsx)(d.Button,{variant:"primary",onClick:l,icon:()=>(0,t.jsx)(f.Plus,{className:"w-4 h-4"}),children:"Create First Group"})]}):(0,t.jsx)(u.Tabs,{type:"editable-card",activeKey:a,onChange:o,onEdit:(t,n)=>{"add"===n?l():"remove"===n&&e.length>1&&(t=>{if(1===e.length)return p.default.warning("At least one group is required");let n=e.filter(e=>e.id!==t);r(n),a===t&&n.length>0&&o(n[n.length-1].id)})(t)},items:m,className:"fallback-tabs",tabBarStyle:{marginBottom:0},hideAdd:e.length>=s})}e.s(["FallbackSelectionForm",()=>v],419470)},916940,e=>{"use strict";var t=e.i(843476),r=e.i(271645),n=e.i(199133),i=e.i(764205);e.s(["default",0,({onChange:e,value:s,className:a,accessToken:o,placeholder:l="Select vector stores",disabled:c=!1})=>{let[d,u]=(0,r.useState)([]),[f,h]=(0,r.useState)(!1);return(0,r.useEffect)(()=>{(async()=>{if(o){h(!0);try{let e=await (0,i.vectorStoreListCall)(o);e.data&&u(e.data)}catch(e){console.error("Error fetching vector stores:",e)}finally{h(!1)}}})()},[o]),(0,t.jsx)("div",{children:(0,t.jsx)(n.Select,{mode:"multiple",placeholder:l,onChange:e,value:s,loading:f,className:a,allowClear:!0,options:d.map(e=>({label:`${e.vector_store_name||e.vector_store_id} (${e.vector_store_id})`,value:e.vector_store_id,title:e.vector_store_description||e.vector_store_id})),optionFilterProp:"label",showSearch:!0,style:{width:"100%"},disabled:c})})}])},737434,e=>{"use strict";var t=e.i(184163);e.s(["DownloadOutlined",()=>t.default])},689020,e=>{"use strict";var t=e.i(764205);let r=async e=>{try{let r=await (0,t.modelHubCall)(e);if(console.log("model_info:",r),r?.data.length>0){let e=r.data.map(e=>({model_group:e.model_group,mode:e?.mode}));return e.sort((e,t)=>e.model_group.localeCompare(t.model_group)),e}return[]}catch(e){throw console.error("Error fetching model info:",e),e}};e.s(["fetchAvailableModels",0,r])},955135,e=>{"use strict";var t=e.i(597440);e.s(["DeleteOutlined",()=>t.default])},309821,e=>{"use strict";e.i(247167);var t=e.i(271645);e.i(262370);var r=e.i(135551),n=e.i(201072),i=e.i(121229),s=e.i(726289),a=e.i(864517),o=e.i(343794),l=e.i(529681),c=e.i(242064),d=e.i(931067),u=e.i(209428),f=e.i(703923),h={percent:0,prefixCls:"rc-progress",strokeColor:"#2db7f5",strokeLinecap:"round",strokeWidth:1,trailColor:"#D9D9D9",trailWidth:1,gapPosition:"bottom"},p=function(){var e=(0,t.useRef)([]),r=(0,t.useRef)(null);return(0,t.useEffect)(function(){var t=Date.now(),n=!1;e.current.forEach(function(e){if(e){n=!0;var i=e.style;i.transitionDuration=".3s, .3s, .3s, .06s",r.current&&t-r.current<100&&(i.transitionDuration="0s, 0s")}}),n&&(r.current=Date.now())}),e.current},m=e.i(410160),g=e.i(392221),y=e.i(654310),b=0,x=(0,y.default)();let v=function(e){var r=t.useState(),n=(0,g.default)(r,2),i=n[0],s=n[1];return t.useEffect(function(){var e;s("rc_progress_".concat((x?(e=b,b+=1):e="TEST_OR_SSR",e)))},[]),e||i};var k=function(e){var r=e.bg,n=e.children;return t.createElement("div",{style:{width:"100%",height:"100%",background:r}},n)};function _(e,t){return Object.keys(e).map(function(r){var n=parseFloat(r),i="".concat(Math.floor(n*t),"%");return"".concat(e[r]," ").concat(i)})}var w=t.forwardRef(function(e,r){var n=e.prefixCls,i=e.color,s=e.gradientId,a=e.radius,o=e.style,l=e.ptg,c=e.strokeLinecap,d=e.strokeWidth,u=e.size,f=e.gapDegree,h=i&&"object"===(0,m.default)(i),p=u/2,g=t.createElement("circle",{className:"".concat(n,"-circle-path"),r:a,cx:p,cy:p,stroke:h?"#FFF":void 0,strokeLinecap:c,strokeWidth:d,opacity:+(0!==l),style:o,ref:r});if(!h)return g;var y="".concat(s,"-conic"),b=_(i,(360-f)/360),x=_(i,1),v="conic-gradient(from ".concat(f?"".concat(180+f/2,"deg"):"0deg",", ").concat(b.join(", "),")"),w="linear-gradient(to ".concat(f?"bottom":"top",", ").concat(x.join(", "),")");return t.createElement(t.Fragment,null,t.createElement("mask",{id:y},g),t.createElement("foreignObject",{x:0,y:0,width:u,height:u,mask:"url(#".concat(y,")")},t.createElement(k,{bg:w},t.createElement(k,{bg:v}))))}),C=function(e,t,r,n,i,s,a,o,l,c){var d=arguments.length>10&&void 0!==arguments[10]?arguments[10]:0,u=(100-n)/100*t;return"round"===l&&100!==n&&(u+=c/2)>=t&&(u=t-.01),{stroke:"string"==typeof o?o:void 0,strokeDasharray:"".concat(t,"px ").concat(e),strokeDashoffset:u+d,transform:"rotate(".concat(i+r/100*360*((360-s)/360)+(0===s?0:({bottom:0,top:180,left:90,right:-90})[a]),"deg)"),transformOrigin:"".concat(50,"px ").concat(50,"px"),transition:"stroke-dashoffset .3s ease 0s, stroke-dasharray .3s ease 0s, stroke .3s, stroke-width .06s ease .3s, opacity .3s ease 0s",fillOpacity:0}},j=["id","prefixCls","steps","strokeWidth","trailWidth","gapDegree","gapPosition","trailColor","strokeLinecap","style","className","strokeColor","percent"];function S(e){var t=null!=e?e:[];return Array.isArray(t)?t:[t]}let E=function(e){var r,n,i,s,a=(0,u.default)((0,u.default)({},h),e),l=a.id,c=a.prefixCls,g=a.steps,y=a.strokeWidth,b=a.trailWidth,x=a.gapDegree,k=void 0===x?0:x,_=a.gapPosition,E=a.trailColor,O=a.strokeLinecap,N=a.style,$=a.className,R=a.strokeColor,T=a.percent,M=(0,f.default)(a,j),P=v(l),D="".concat(P,"-gradient"),I=50-y/2,L=2*Math.PI*I,F=k>0?90+k/2:-90,A=(360-k)/360*L,z="object"===(0,m.default)(g)?g:{count:g,gap:2},B=z.count,W=z.gap,q=S(T),H=S(R),U=H.find(function(e){return e&&"object"===(0,m.default)(e)}),K=U&&"object"===(0,m.default)(U)?"butt":O,X=C(L,A,0,100,F,k,_,E,K,y),Q=p();return t.createElement("svg",(0,d.default)({className:(0,o.default)("".concat(c,"-circle"),$),viewBox:"0 0 ".concat(100," ").concat(100),style:N,id:l,role:"presentation"},M),!B&&t.createElement("circle",{className:"".concat(c,"-circle-trail"),r:I,cx:50,cy:50,stroke:E,strokeLinecap:K,strokeWidth:b||y,style:X}),B?(r=Math.round(B*(q[0]/100)),n=100/B,i=0,Array(B).fill(null).map(function(e,s){var a=s<=r-1?H[0]:E,o=a&&"object"===(0,m.default)(a)?"url(#".concat(D,")"):void 0,l=C(L,A,i,n,F,k,_,a,"butt",y,W);return i+=(A-l.strokeDashoffset+W)*100/A,t.createElement("circle",{key:s,className:"".concat(c,"-circle-path"),r:I,cx:50,cy:50,stroke:o,strokeWidth:y,opacity:1,style:l,ref:function(e){Q[s]=e}})})):(s=0,q.map(function(e,r){var n=H[r]||H[H.length-1],i=C(L,A,s,e,F,k,_,n,K,y);return s+=e,t.createElement(w,{key:r,color:n,ptg:e,radius:I,prefixCls:c,gradientId:D,style:i,strokeLinecap:K,strokeWidth:y,gapDegree:k,ref:function(e){Q[r]=e},size:100})}).reverse()))};var O=e.i(491816);e.i(765846);var N=e.i(896091);function $(e){return!e||e<0?0:e>100?100:e}function R({success:e,successPercent:t}){let r=t;return e&&"progress"in e&&(r=e.progress),e&&"percent"in e&&(r=e.percent),r}let T=(e,t,r)=>{var n,i,s,a;let o=-1,l=-1;if("step"===t){let t=r.steps,n=r.strokeWidth;"string"==typeof e||void 0===e?(o="small"===e?2:14,l=null!=n?n:8):"number"==typeof e?[o,l]=[e,e]:[o=14,l=8]=Array.isArray(e)?e:[e.width,e.height],o*=t}else if("line"===t){let t=null==r?void 0:r.strokeWidth;"string"==typeof e||void 0===e?l=t||("small"===e?6:8):"number"==typeof e?[o,l]=[e,e]:[o=-1,l=8]=Array.isArray(e)?e:[e.width,e.height]}else("circle"===t||"dashboard"===t)&&("string"==typeof e||void 0===e?[o,l]="small"===e?[60,60]:[120,120]:"number"==typeof e?[o,l]=[e,e]:Array.isArray(e)&&(o=null!=(i=null!=(n=e[0])?n:e[1])?i:120,l=null!=(a=null!=(s=e[0])?s:e[1])?a:120));return[o,l]},M=e=>{let{prefixCls:r,trailColor:n=null,strokeLinecap:i="round",gapPosition:s,gapDegree:a,width:l=120,type:c,children:d,success:u,size:f=l,steps:h}=e,[p,m]=T(f,"circle"),{strokeWidth:g}=e;void 0===g&&(g=Math.max(3/p*100,6));let y=t.useMemo(()=>a||0===a?a:"dashboard"===c?75:void 0,[a,c]),b=(({percent:e,success:t,successPercent:r})=>{let n=$(R({success:t,successPercent:r}));return[n,$($(e)-n)]})(e),x="[object Object]"===Object.prototype.toString.call(e.strokeColor),v=(({success:e={},strokeColor:t})=>{let{strokeColor:r}=e;return[r||N.presetPrimaryColors.green,t||null]})({success:u,strokeColor:e.strokeColor}),k=(0,o.default)(`${r}-inner`,{[`${r}-circle-gradient`]:x}),_=t.createElement(E,{steps:h,percent:h?b[1]:b,strokeWidth:g,trailWidth:g,strokeColor:h?v[1]:v,strokeLinecap:i,trailColor:n,prefixCls:r,gapDegree:y,gapPosition:s||"dashboard"===c&&"bottom"||void 0}),w=p<=20,C=t.createElement("div",{className:k,style:{width:p,height:m,fontSize:.15*p+6}},_,!w&&d);return w?t.createElement(O.default,{title:d},C):C};e.i(296059);var P=e.i(694758),D=e.i(915654),I=e.i(183293),L=e.i(246422),F=e.i(838378);let A="--progress-line-stroke-color",z="--progress-percent",B=e=>{let t=e?"100%":"-100%";return new P.Keyframes(`antProgress${e?"RTL":"LTR"}Active`,{"0%":{transform:`translateX(${t}) scaleX(0)`,opacity:.1},"20%":{transform:`translateX(${t}) scaleX(0)`,opacity:.5},to:{transform:"translateX(0) scaleX(1)",opacity:0}})},W=(0,L.genStyleHooks)("Progress",e=>{let t=e.calc(e.marginXXS).div(2).equal(),r=(0,F.mergeToken)(e,{progressStepMarginInlineEnd:t,progressStepMinWidth:t,progressActiveMotionDuration:"2.4s"});return[(e=>{let{componentCls:t,iconCls:r}=e;return{[t]:Object.assign(Object.assign({},(0,I.resetComponent)(e)),{display:"inline-block","&-rtl":{direction:"rtl"},"&-line":{position:"relative",width:"100%",fontSize:e.fontSize},[`${t}-outer`]:{display:"inline-flex",alignItems:"center",width:"100%"},[`${t}-inner`]:{position:"relative",display:"inline-block",width:"100%",flex:1,overflow:"hidden",verticalAlign:"middle",backgroundColor:e.remainingColor,borderRadius:e.lineBorderRadius},[`${t}-inner:not(${t}-circle-gradient)`]:{[`${t}-circle-path`]:{stroke:e.defaultColor}},[`${t}-success-bg, ${t}-bg`]:{position:"relative",background:e.defaultColor,borderRadius:e.lineBorderRadius,transition:`all ${e.motionDurationSlow} ${e.motionEaseInOutCirc}`},[`${t}-layout-bottom`]:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",[`${t}-text`]:{width:"max-content",marginInlineStart:0,marginTop:e.marginXXS}},[`${t}-bg`]:{overflow:"hidden","&::after":{content:'""',background:{_multi_value_:!0,value:["inherit",`var(${A})`]},height:"100%",width:`calc(1 / var(${z}) * 100%)`,display:"block"},[`&${t}-bg-inner`]:{minWidth:"max-content","&::after":{content:"none"},[`${t}-text-inner`]:{color:e.colorWhite,[`&${t}-text-bright`]:{color:"rgba(0, 0, 0, 0.45)"}}}},[`${t}-success-bg`]:{position:"absolute",insetBlockStart:0,insetInlineStart:0,backgroundColor:e.colorSuccess},[`${t}-text`]:{display:"inline-block",marginInlineStart:e.marginXS,color:e.colorText,lineHeight:1,width:"2em",whiteSpace:"nowrap",textAlign:"start",verticalAlign:"middle",wordBreak:"normal",[r]:{fontSize:e.fontSize},[`&${t}-text-outer`]:{width:"max-content"},[`&${t}-text-outer${t}-text-start`]:{width:"max-content",marginInlineStart:0,marginInlineEnd:e.marginXS}},[`${t}-text-inner`]:{display:"flex",justifyContent:"center",alignItems:"center",width:"100%",height:"100%",marginInlineStart:0,padding:`0 ${(0,D.unit)(e.paddingXXS)}`,[`&${t}-text-start`]:{justifyContent:"start"},[`&${t}-text-end`]:{justifyContent:"end"}},[`&${t}-status-active`]:{[`${t}-bg::before`]:{position:"absolute",inset:0,backgroundColor:e.colorBgContainer,borderRadius:e.lineBorderRadius,opacity:0,animationName:B(),animationDuration:e.progressActiveMotionDuration,animationTimingFunction:e.motionEaseOutQuint,animationIterationCount:"infinite",content:'""'}},[`&${t}-rtl${t}-status-active`]:{[`${t}-bg::before`]:{animationName:B(!0)}},[`&${t}-status-exception`]:{[`${t}-bg`]:{backgroundColor:e.colorError},[`${t}-text`]:{color:e.colorError}},[`&${t}-status-exception ${t}-inner:not(${t}-circle-gradient)`]:{[`${t}-circle-path`]:{stroke:e.colorError}},[`&${t}-status-success`]:{[`${t}-bg`]:{backgroundColor:e.colorSuccess},[`${t}-text`]:{color:e.colorSuccess}},[`&${t}-status-success ${t}-inner:not(${t}-circle-gradient)`]:{[`${t}-circle-path`]:{stroke:e.colorSuccess}}})}})(r),(e=>{let{componentCls:t,iconCls:r}=e;return{[t]:{[`${t}-circle-trail`]:{stroke:e.remainingColor},[`&${t}-circle ${t}-inner`]:{position:"relative",lineHeight:1,backgroundColor:"transparent"},[`&${t}-circle ${t}-text`]:{position:"absolute",insetBlockStart:"50%",insetInlineStart:0,width:"100%",margin:0,padding:0,color:e.circleTextColor,fontSize:e.circleTextFontSize,lineHeight:1,whiteSpace:"normal",textAlign:"center",transform:"translateY(-50%)",[r]:{fontSize:e.circleIconFontSize}},[`${t}-circle&-status-exception`]:{[`${t}-text`]:{color:e.colorError}},[`${t}-circle&-status-success`]:{[`${t}-text`]:{color:e.colorSuccess}}},[`${t}-inline-circle`]:{lineHeight:1,[`${t}-inner`]:{verticalAlign:"bottom"}}}})(r),(e=>{let{componentCls:t}=e;return{[t]:{[`${t}-steps`]:{display:"inline-block","&-outer":{display:"flex",flexDirection:"row",alignItems:"center"},"&-item":{flexShrink:0,minWidth:e.progressStepMinWidth,marginInlineEnd:e.progressStepMarginInlineEnd,backgroundColor:e.remainingColor,transition:`all ${e.motionDurationSlow}`,"&-active":{backgroundColor:e.defaultColor}}}}}})(r),(e=>{let{componentCls:t,iconCls:r}=e;return{[t]:{[`${t}-small&-line, ${t}-small&-line ${t}-text ${r}`]:{fontSize:e.fontSizeSM}}}})(r)]},e=>({circleTextColor:e.colorText,defaultColor:e.colorInfo,remainingColor:e.colorFillSecondary,lineBorderRadius:100,circleTextFontSize:"1em",circleIconFontSize:`${e.fontSize/e.fontSizeSM}em`}));var q=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&0>t.indexOf(n)&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var i=0,n=Object.getOwnPropertySymbols(e);it.indexOf(n[i])&&Object.prototype.propertyIsEnumerable.call(e,n[i])&&(r[n[i]]=e[n[i]]);return r};let H=e=>{let{prefixCls:r,direction:n,percent:i,size:s,strokeWidth:a,strokeColor:l,strokeLinecap:c="round",children:d,trailColor:u=null,percentPosition:f,success:h}=e,{align:p,type:m}=f,g=l&&"string"!=typeof l?((e,t)=>{let{from:r=N.presetPrimaryColors.blue,to:n=N.presetPrimaryColors.blue,direction:i="rtl"===t?"to left":"to right"}=e,s=q(e,["from","to","direction"]);if(0!==Object.keys(s).length){let e,t=(e=[],Object.keys(s).forEach(t=>{let r=Number.parseFloat(t.replace(/%/g,""));Number.isNaN(r)||e.push({key:r,value:s[t]})}),(e=e.sort((e,t)=>e.key-t.key)).map(({key:e,value:t})=>`${t} ${e}%`).join(", ")),r=`linear-gradient(${i}, ${t})`;return{background:r,[A]:r}}let a=`linear-gradient(${i}, ${r}, ${n})`;return{background:a,[A]:a}})(l,n):{[A]:l,background:l},y="square"===c||"butt"===c?0:void 0,[b,x]=T(null!=s?s:[-1,a||("small"===s?6:8)],"line",{strokeWidth:a}),v=Object.assign(Object.assign({width:`${$(i)}%`,height:x,borderRadius:y},g),{[z]:$(i)/100}),k=R(e),_={width:`${$(k)}%`,height:x,borderRadius:y,backgroundColor:null==h?void 0:h.strokeColor},w=t.createElement("div",{className:`${r}-inner`,style:{backgroundColor:u||void 0,borderRadius:y}},t.createElement("div",{className:(0,o.default)(`${r}-bg`,`${r}-bg-${m}`),style:v},"inner"===m&&d),void 0!==k&&t.createElement("div",{className:`${r}-success-bg`,style:_})),C="outer"===m&&"start"===p,j="outer"===m&&"end"===p;return"outer"===m&&"center"===p?t.createElement("div",{className:`${r}-layout-bottom`},w,d):t.createElement("div",{className:`${r}-outer`,style:{width:b<0?"100%":b}},C&&d,w,j&&d)},U=e=>{let{size:r,steps:n,rounding:i=Math.round,percent:s=0,strokeWidth:a=8,strokeColor:l,trailColor:c=null,prefixCls:d,children:u}=e,f=i(s/100*n),[h,p]=T(null!=r?r:["small"===r?2:14,a],"step",{steps:n,strokeWidth:a}),m=h/n,g=Array.from({length:n});for(let e=0;et.indexOf(n)&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var i=0,n=Object.getOwnPropertySymbols(e);it.indexOf(n[i])&&Object.prototype.propertyIsEnumerable.call(e,n[i])&&(r[n[i]]=e[n[i]]);return r};let X=["normal","exception","active","success"],Q=t.forwardRef((e,d)=>{let u,{prefixCls:f,className:h,rootClassName:p,steps:m,strokeColor:g,percent:y=0,size:b="default",showInfo:x=!0,type:v="line",status:k,format:_,style:w,percentPosition:C={}}=e,j=K(e,["prefixCls","className","rootClassName","steps","strokeColor","percent","size","showInfo","type","status","format","style","percentPosition"]),{align:S="end",type:E="outer"}=C,O=Array.isArray(g)?g[0]:g,N="string"==typeof g||Array.isArray(g)?g:void 0,P=t.useMemo(()=>{if(O){let e="string"==typeof O?O:Object.values(O)[0];return new r.FastColor(e).isLight()}return!1},[g]),D=t.useMemo(()=>{var t,r;let n=R(e);return Number.parseInt(void 0!==n?null==(t=null!=n?n:0)?void 0:t.toString():null==(r=null!=y?y:0)?void 0:r.toString(),10)},[y,e.success,e.successPercent]),I=t.useMemo(()=>!X.includes(k)&&D>=100?"success":k||"normal",[k,D]),{getPrefixCls:L,direction:F,progress:A}=t.useContext(c.ConfigContext),z=L("progress",f),[B,q,Q]=W(z),V="line"===v,G=V&&!m,J=t.useMemo(()=>{let r;if(!x)return null;let l=R(e),c=_||(e=>`${e}%`),d=V&&P&&"inner"===E;return"inner"===E||_||"exception"!==I&&"success"!==I?r=c($(y),$(l)):"exception"===I?r=V?t.createElement(s.default,null):t.createElement(a.default,null):"success"===I&&(r=V?t.createElement(n.default,null):t.createElement(i.default,null)),t.createElement("span",{className:(0,o.default)(`${z}-text`,{[`${z}-text-bright`]:d,[`${z}-text-${S}`]:G,[`${z}-text-${E}`]:G}),title:"string"==typeof r?r:void 0},r)},[x,y,D,I,v,z,_]);"line"===v?u=m?t.createElement(U,Object.assign({},e,{strokeColor:N,prefixCls:z,steps:"object"==typeof m?m.count:m}),J):t.createElement(H,Object.assign({},e,{strokeColor:O,prefixCls:z,direction:F,percentPosition:{align:S,type:E}}),J):("circle"===v||"dashboard"===v)&&(u=t.createElement(M,Object.assign({},e,{strokeColor:O,prefixCls:z,progressStatus:I}),J));let Y=(0,o.default)(z,`${z}-status-${I}`,{[`${z}-${"dashboard"===v&&"circle"||v}`]:"line"!==v,[`${z}-inline-circle`]:"circle"===v&&T(b,"circle")[0]<=20,[`${z}-line`]:G,[`${z}-line-align-${S}`]:G,[`${z}-line-position-${E}`]:G,[`${z}-steps`]:m,[`${z}-show-info`]:x,[`${z}-${b}`]:"string"==typeof b,[`${z}-rtl`]:"rtl"===F},null==A?void 0:A.className,h,p,q,Q);return B(t.createElement("div",Object.assign({ref:d,style:Object.assign(Object.assign({},null==A?void 0:A.style),w),className:Y,role:"progressbar","aria-valuenow":D,"aria-valuemin":0,"aria-valuemax":100},(0,l.default)(j,["trailColor","strokeWidth","width","gapDegree","gapPosition","strokeLinecap","success","successPercent"])),u))});e.s(["default",0,Q],309821)},597440,e=>{"use strict";e.i(247167);var t=e.i(931067),r=e.i(271645);let n={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M360 184h-8c4.4 0 8-3.6 8-8v8h304v-8c0 4.4 3.6 8 8 8h-8v72h72v-80c0-35.3-28.7-64-64-64H352c-35.3 0-64 28.7-64 64v80h72v-72zm504 72H160c-17.7 0-32 14.3-32 32v32c0 4.4 3.6 8 8 8h60.4l24.7 523c1.6 34.1 29.8 61 63.9 61h454c34.2 0 62.3-26.8 63.9-61l24.7-523H888c4.4 0 8-3.6 8-8v-32c0-17.7-14.3-32-32-32zM731.3 840H292.7l-24.2-512h487l-24.2 512z"}}]},name:"delete",theme:"outlined"};var i=e.i(9583),s=r.forwardRef(function(e,s){return r.createElement(i.default,(0,t.default)({},e,{ref:s,icon:n}))});e.s(["default",0,s],597440)},309426,e=>{"use strict";var t=e.i(290571),r=e.i(444755),n=e.i(673706),i=e.i(271645),s=e.i(46757);let a=(0,n.makeClassName)("Col"),o=i.default.forwardRef((e,n)=>{let o,l,c,d,{numColSpan:u=1,numColSpanSm:f,numColSpanMd:h,numColSpanLg:p,children:m,className:g}=e,y=(0,t.__rest)(e,["numColSpan","numColSpanSm","numColSpanMd","numColSpanLg","children","className"]),b=(e,t)=>e&&Object.keys(t).includes(String(e))?t[e]:"";return i.default.createElement("div",Object.assign({ref:n,className:(0,r.tremorTwMerge)(a("root"),(o=b(u,s.colSpan),l=b(f,s.colSpanSm),c=b(h,s.colSpanMd),d=b(p,s.colSpanLg),(0,r.tremorTwMerge)(o,l,c,d)),g)},y),m)});o.displayName="Col",e.s(["Col",()=>o],309426)},519756,e=>{"use strict";e.i(247167);var t=e.i(931067),r=e.i(271645);let n={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M400 317.7h73.9V656c0 4.4 3.6 8 8 8h60c4.4 0 8-3.6 8-8V317.7H624c6.7 0 10.4-7.7 6.3-12.9L518.3 163a8 8 0 00-12.6 0l-112 141.7c-4.1 5.3-.4 13 6.3 13zM878 626h-60c-4.4 0-8 3.6-8 8v154H214V634c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8v198c0 17.7 14.3 32 32 32h684c17.7 0 32-14.3 32-32V634c0-4.4-3.6-8-8-8z"}}]},name:"upload",theme:"outlined"};var i=e.i(9583),s=r.forwardRef(function(e,s){return r.createElement(i.default,(0,t.default)({},e,{ref:s,icon:n}))});e.s(["UploadOutlined",0,s],519756)},981339,e=>{"use strict";var t=e.i(185793);e.s(["Skeleton",()=>t.default])},500330,e=>{"use strict";var t=e.i(727749);function r(e,t){let r=structuredClone(e);for(let[e,n]of Object.entries(t))e in r&&(r[e]=n);return r}let n=(e,t=0,r=!1,n=!0)=>{if(null==e||!Number.isFinite(e)||0===e&&!n)return"-";let i={minimumFractionDigits:t,maximumFractionDigits:t};if(!r)return e.toLocaleString("en-US",i);let s=e<0?"-":"",a=Math.abs(e),o=a,l="";return a>=1e6?(o=a/1e6,l="M"):a>=1e3&&(o=a/1e3,l="K"),`${s}${o.toLocaleString("en-US",i)}${l}`},i=async(e,r="Copied to clipboard")=>{if(!e)return!1;if(!navigator||!navigator.clipboard||!navigator.clipboard.writeText)return s(e,r);try{return await navigator.clipboard.writeText(e),t.default.success(r),!0}catch(t){return console.error("Clipboard API failed: ",t),s(e,r)}},s=(e,r)=>{try{let n=document.createElement("textarea");n.value=e,n.style.position="fixed",n.style.left="-999999px",n.style.top="-999999px",n.setAttribute("readonly",""),document.body.appendChild(n),n.focus(),n.select();let i=document.execCommand("copy");if(document.body.removeChild(n),i)return t.default.success(r),!0;throw Error("execCommand failed")}catch(e){return t.default.fromBackend("Failed to copy to clipboard"),console.error("Failed to copy: ",e),!1}};e.s(["copyToClipboard",0,i,"formatNumberWithCommas",0,n,"getSpendString",0,(e,t=6)=>{if(null==e||!Number.isFinite(e)||0===e)return"-";let r=n(e,t,!1,!1);if(0===Number(r.replace(/,/g,""))){let e=(1/10**t).toFixed(t);return`< $${e}`}return`$${r}`},"updateExistingKeys",()=>r])},663435,152473,e=>{"use strict";var t=e.i(843476),r=e.i(271645),n=e.i(199133),i=e.i(898586),s=e.i(56456);let a={enabled:!0,leading:!1,trailing:!0,wait:0,onExecute:()=>{}};class o{constructor(e,t){this.fn=e,this._canLeadingExecute=!0,this._isPending=!1,this._executionCount=0,this._options={...a,...t}}setOptions(e){return this._options={...this._options,...e},this._options.enabled||(this._isPending=!1),this._options}getOptions(){return this._options}maybeExecute(...e){this._options.leading&&this._canLeadingExecute&&(this.executeFunction(...e),this._canLeadingExecute=!1),(this._options.leading||this._options.trailing)&&(this._isPending=!0),this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=setTimeout(()=>{this._canLeadingExecute=!0,this._isPending=!1,this._options.trailing&&this.executeFunction(...e)},this._options.wait)}executeFunction(...e){this._options.enabled&&(this.fn(...e),this._executionCount++,this._options.onExecute(this))}cancel(){this._timeoutId&&(clearTimeout(this._timeoutId),this._canLeadingExecute=!0,this._isPending=!1)}getExecutionCount(){return this._executionCount}getIsPending(){return this._options.enabled&&this._isPending}}function l(e,t){let[n,i]=(0,r.useState)(e),s=function(e,t){let[n]=(0,r.useState)(()=>{var r;return Object.getOwnPropertyNames(Object.getPrototypeOf(r=new o(e,t))).filter(e=>"function"==typeof r[e]).reduce((e,t)=>{let n=r[t];return"function"==typeof n&&(e[t]=n.bind(r)),e},{})});return n.setOptions(t),n}(i,t);return[n,s.maybeExecute,s]}e.s(["useDebouncedState",()=>l],152473);var c=e.i(785242);let{Text:d}=i.Typography;e.s(["default",0,({value:e,onChange:i,onTeamSelect:a,disabled:o,organizationId:u,pageSize:f=20})=>{let[h,p]=(0,r.useState)(""),[m,g]=l("",{wait:300}),{data:y,fetchNextPage:b,hasNextPage:x,isFetchingNextPage:v,isLoading:k}=(0,c.useInfiniteTeams)(f,m||void 0,u),_=(0,r.useMemo)(()=>{if(!y?.pages)return[];let e=new Set,t=[];for(let r of y.pages)for(let n of r.teams)e.has(n.team_id)||(e.add(n.team_id),t.push(n));return t},[y]);return(0,t.jsx)(n.Select,{showSearch:!0,placeholder:"Search or select a team",value:e||void 0,onChange:e=>{i?.(e??""),a&&a(e?_.find(t=>t.team_id===e)??null:null)},disabled:o,allowClear:!0,filterOption:!1,onSearch:e=>{p(e),g(e)},searchValue:h,onPopupScroll:e=>{let t=e.currentTarget;(t.scrollTop+t.clientHeight)/t.scrollHeight>=.8&&x&&!v&&b()},loading:k,notFoundContent:k?(0,t.jsx)(s.LoadingOutlined,{spin:!0}):"No teams found",popupRender:e=>(0,t.jsxs)(t.Fragment,{children:[e,v&&(0,t.jsx)("div",{style:{textAlign:"center",padding:8},children:(0,t.jsx)(s.LoadingOutlined,{spin:!0})})]}),children:_.map(e=>(0,t.jsxs)(n.Select.Option,{value:e.team_id,children:[(0,t.jsx)("span",{className:"font-medium",children:e.team_alias})," ",(0,t.jsxs)(d,{type:"secondary",children:["(",e.team_id,")"]})]},e.team_id))})}],663435)},743151,(e,t,r)=>{"use strict";function n(e){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}Object.defineProperty(r,"__esModule",{value:!0}),r.CopyToClipboard=void 0;var i=o(e.r(271645)),s=o(e.r(844343)),a=["text","onCopy","options","children"];function o(e){return e&&e.__esModule?e:{default:e}}function l(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function c(e){for(var t=1;t=0||(i[r]=e[r]);return i}(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(n=0;n=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(i[r]=e[r])}return i}(e,a),n=i.default.Children.only(t);return i.default.cloneElement(n,c(c({},r),{},{onClick:this.onClick}))}}],function(e,t){for(var r=0;r{"use strict";var n=e.r(743151).CopyToClipboard;n.CopyToClipboard=n,t.exports=n},59935,(e,t,r)=>{var n;let i;e.e,n=function e(){var t,r="u">typeof self?self:"u">typeof window?window:void 0!==r?r:{},n=!r.document&&!!r.postMessage,i=r.IS_PAPA_WORKER||!1,s={},a=0,o={};function l(e){this._handle=null,this._finished=!1,this._completed=!1,this._halted=!1,this._input=null,this._baseIndex=0,this._partialLine="",this._rowCount=0,this._start=0,this._nextChunk=null,this.isFirstChunk=!0,this._completeResults={data:[],errors:[],meta:{}},(function(e){var t=x(e);t.chunkSize=parseInt(t.chunkSize),e.step||e.chunk||(t.chunkSize=null),this._handle=new h(t),(this._handle.streamer=this)._config=t}).call(this,e),this.parseChunk=function(e,t){var n=parseInt(this._config.skipFirstNLines)||0;if(this.isFirstChunk&&0=this._config.preview,i)r.postMessage({results:s,workerId:o.WORKER_ID,finished:n});else if(k(this._config.chunk)&&!t){if(this._config.chunk(s,this._handle),this._handle.paused()||this._handle.aborted())return void(this._halted=!0);this._completeResults=s=void 0}return this._config.step||this._config.chunk||(this._completeResults.data=this._completeResults.data.concat(s.data),this._completeResults.errors=this._completeResults.errors.concat(s.errors),this._completeResults.meta=s.meta),this._completed||!n||!k(this._config.complete)||s&&s.meta.aborted||(this._config.complete(this._completeResults,this._input),this._completed=!0),n||s&&s.meta.paused||this._nextChunk(),s}this._halted=!0},this._sendError=function(e){k(this._config.error)?this._config.error(e):i&&this._config.error&&r.postMessage({workerId:o.WORKER_ID,error:e,finished:!1})}}function c(e){var t;(e=e||{}).chunkSize||(e.chunkSize=o.RemoteChunkSize),l.call(this,e),this._nextChunk=n?function(){this._readChunk(),this._chunkLoaded()}:function(){this._readChunk()},this.stream=function(e){this._input=e,this._nextChunk()},this._readChunk=function(){if(this._finished)this._chunkLoaded();else{if(t=new XMLHttpRequest,this._config.withCredentials&&(t.withCredentials=this._config.withCredentials),n||(t.onload=v(this._chunkLoaded,this),t.onerror=v(this._chunkError,this)),t.open(this._config.downloadRequestBody?"POST":"GET",this._input,!n),this._config.downloadRequestHeaders){var e,r,i=this._config.downloadRequestHeaders;for(r in i)t.setRequestHeader(r,i[r])}this._config.chunkSize&&(e=this._start+this._config.chunkSize-1,t.setRequestHeader("Range","bytes="+this._start+"-"+e));try{t.send(this._config.downloadRequestBody)}catch(e){this._chunkError(e.message)}n&&0===t.status&&this._chunkError()}},this._chunkLoaded=function(){let e;4===t.readyState&&(t.status<200||400<=t.status?this._chunkError():(this._start+=this._config.chunkSize||t.responseText.length,this._finished=!this._config.chunkSize||this._start>=(null!==(e=(e=t).getResponseHeader("Content-Range"))?parseInt(e.substring(e.lastIndexOf("/")+1)):-1),this.parseChunk(t.responseText)))},this._chunkError=function(e){e=t.statusText||e,this._sendError(Error(e))}}function d(e){(e=e||{}).chunkSize||(e.chunkSize=o.LocalChunkSize),l.call(this,e);var t,r,n="u">typeof FileReader;this.stream=function(e){this._input=e,r=e.slice||e.webkitSlice||e.mozSlice,n?((t=new FileReader).onload=v(this._chunkLoaded,this),t.onerror=v(this._chunkError,this)):t=new FileReaderSync,this._nextChunk()},this._nextChunk=function(){this._finished||this._config.preview&&!(this._rowCount=this._input.size,this.parseChunk(e.target.result)},this._chunkError=function(){this._sendError(t.error)}}function u(e){var t;l.call(this,e=e||{}),this.stream=function(e){return t=e,this._nextChunk()},this._nextChunk=function(){var e,r;if(!this._finished)return t=(e=this._config.chunkSize)?(r=t.substring(0,e),t.substring(e)):(r=t,""),this._finished=!t,this.parseChunk(r)}}function f(e){l.call(this,e=e||{});var t=[],r=!0,n=!1;this.pause=function(){l.prototype.pause.apply(this,arguments),this._input.pause()},this.resume=function(){l.prototype.resume.apply(this,arguments),this._input.resume()},this.stream=function(e){this._input=e,this._input.on("data",this._streamData),this._input.on("end",this._streamEnd),this._input.on("error",this._streamError)},this._checkIsFinished=function(){n&&1===t.length&&(this._finished=!0)},this._nextChunk=function(){this._checkIsFinished(),t.length?this.parseChunk(t.shift()):r=!0},this._streamData=v(function(e){try{t.push("string"==typeof e?e:e.toString(this._config.encoding)),r&&(r=!1,this._checkIsFinished(),this.parseChunk(t.shift()))}catch(e){this._streamError(e)}},this),this._streamError=v(function(e){this._streamCleanUp(),this._sendError(e)},this),this._streamEnd=v(function(){this._streamCleanUp(),n=!0,this._streamData("")},this),this._streamCleanUp=v(function(){this._input.removeListener("data",this._streamData),this._input.removeListener("end",this._streamEnd),this._input.removeListener("error",this._streamError)},this)}function h(e){var t,r,n,i,s=/^\s*-?(\d+\.?|\.\d+|\d+\.\d+)([eE][-+]?\d+)?\s*$/,a=/^((\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\.\d+([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z)))$/,l=this,c=0,d=0,u=!1,f=!1,h=[],g={data:[],errors:[],meta:{}};function y(t){return"greedy"===e.skipEmptyLines?""===t.join("").trim():1===t.length&&0===t[0].length}function b(){if(g&&n&&(_("Delimiter","UndetectableDelimiter","Unable to auto-detect delimiting character; defaulted to '"+o.DefaultDelimiter+"'"),n=!1),e.skipEmptyLines&&(g.data=g.data.filter(function(e){return!y(e)})),v()){if(g)if(Array.isArray(g.data[0])){for(var t,r=0;v()&&r(e.dynamicTypingFunction&&void 0===e.dynamicTyping[t]&&(e.dynamicTyping[t]=e.dynamicTypingFunction(t)),!0===(e.dynamicTyping[t]||e.dynamicTyping))?"true"===r||"TRUE"===r||"false"!==r&&"FALSE"!==r&&((e=>{if(s.test(e)&&-0x20000000000000<(e=parseFloat(e))&&e<0x20000000000000)return 1})(r)?parseFloat(r):a.test(r)?new Date(r):""===r?null:r):r)(o=e.header?i>=h.length?"__parsed_extra":h[i]:o,l=e.transform?e.transform(l,o):l);"__parsed_extra"===o?(n[o]=n[o]||[],n[o].push(l)):n[o]=l}return e.header&&(i>h.length?_("FieldMismatch","TooManyFields","Too many fields: expected "+h.length+" fields but parsed "+i,d+r):ie.preview?r.abort():(g.data=g.data[0],i(g,l))))}),this.parse=function(i,s,a){var l=e.quoteChar||'"',l=(e.newline||(e.newline=this.guessLineEndings(i,l)),n=!1,e.delimiter?k(e.delimiter)&&(e.delimiter=e.delimiter(i),g.meta.delimiter=e.delimiter):((l=((t,r,n,i,s)=>{var a,l,c,d;s=s||[","," ","|",";",o.RECORD_SEP,o.UNIT_SEP];for(var u=0;u=r.length/2?"\r\n":"\r"}}function p(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function m(e){var t=(e=e||{}).delimiter,r=e.newline,n=e.comments,i=e.step,s=e.preview,a=e.fastMode,l=null,c=!1,d=null==e.quoteChar?'"':e.quoteChar,u=d;if(void 0!==e.escapeChar&&(u=e.escapeChar),("string"!=typeof t||-1=s)return F(!0);break}C.push({type:"Quotes",code:"InvalidQuotes",message:"Trailing quote on quoted field is malformed",row:w.length,index:f}),T++}}else if(n&&0===j.length&&o.substring(f,f+v)===n){if(-1===$)return F();f=$+x,$=o.indexOf(r,f),N=o.indexOf(t,f)}else if(-1!==N&&(N<$||-1===$))j.push(o.substring(f,N)),f=N+b,N=o.indexOf(t,f);else{if(-1===$)break;if(j.push(o.substring(f,$)),L($+x),_&&(A(),h))return F();if(s&&w.length>=s)return F(!0)}return I();function P(e){w.push(e),S=f}function D(e){return -1!==e&&(e=o.substring(T+1,e))&&""===e.trim()?e.length:0}function I(e){return g||(void 0===e&&(e=o.substring(f)),j.push(e),f=y,P(j),_&&A()),F()}function L(e){f=e,P(j),j=[],$=o.indexOf(r,f)}function F(n){if(e.header&&!m&&w.length&&!c){var i=w[0],s=Object.create(null),a=new Set(i);let t=!1;for(let r=0;r{if("object"==typeof t){if("string"!=typeof t.delimiter||o.BAD_DELIMITERS.filter(function(e){return -1!==t.delimiter.indexOf(e)}).length||(i=t.delimiter),("boolean"==typeof t.quotes||"function"==typeof t.quotes||Array.isArray(t.quotes))&&(r=t.quotes),"boolean"!=typeof t.skipEmptyLines&&"string"!=typeof t.skipEmptyLines||(c=t.skipEmptyLines),"string"==typeof t.newline&&(s=t.newline),"string"==typeof t.quoteChar&&(a=t.quoteChar),"boolean"==typeof t.header&&(n=t.header),Array.isArray(t.columns)){if(0===t.columns.length)throw Error("Option columns is empty");d=t.columns}void 0!==t.escapeChar&&(l=t.escapeChar+a),t.escapeFormulae instanceof RegExp?u=t.escapeFormulae:"boolean"==typeof t.escapeFormulae&&t.escapeFormulae&&(u=/^[=+\-@\t\r].*$/)}})(),RegExp(p(a),"g"));if("string"==typeof e&&(e=JSON.parse(e)),Array.isArray(e)){if(!e.length||Array.isArray(e[0]))return h(null,e,c);if("object"==typeof e[0])return h(d||Object.keys(e[0]),e,c)}else if("object"==typeof e)return"string"==typeof e.data&&(e.data=JSON.parse(e.data)),Array.isArray(e.data)&&(e.fields||(e.fields=e.meta&&e.meta.fields||d),e.fields||(e.fields=Array.isArray(e.data[0])?e.fields:"object"==typeof e.data[0]?Object.keys(e.data[0]):[]),Array.isArray(e.data[0])||"object"==typeof e.data[0]||(e.data=[e.data])),h(e.fields||[],e.data||[],c);throw Error("Unable to serialize unrecognized input");function h(e,t,r){var a="",o=("string"==typeof e&&(e=JSON.parse(e)),"string"==typeof t&&(t=JSON.parse(t)),Array.isArray(e)&&0{for(var r=0;r{"use strict";var t=e.i(631171);e.s(["ChevronDownIcon",()=>t.default])},246349,e=>{"use strict";let t=(0,e.i(475254).default)("chevron-right",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);e.s(["default",()=>t])},91739,e=>{"use strict";var t=e.i(544195);e.s(["Radio",()=>t.default])},988297,e=>{"use strict";var t=e.i(271645);let r=t.forwardRef(function(e,r){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:r},e),t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 4v16m8-8H4"}))});e.s(["PlusIcon",0,r],988297)},797672,e=>{"use strict";var t=e.i(271645);let r=t.forwardRef(function(e,r){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:r},e),t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15.232 5.232l3.536 3.536m-2.036-5.036a2.5 2.5 0 113.536 3.536L6.5 21.036H3v-3.572L16.732 3.732z"}))});e.s(["PencilIcon",0,r],797672)},992619,e=>{"use strict";var t=e.i(843476),r=e.i(271645),n=e.i(779241),i=e.i(599724),s=e.i(199133),a=e.i(983561),o=e.i(689020);e.s(["default",0,({accessToken:e,value:l,placeholder:c="Select a Model",onChange:d,disabled:u=!1,style:f,className:h,showLabel:p=!0,labelText:m="Select Model"})=>{let[g,y]=(0,r.useState)(l),[b,x]=(0,r.useState)(!1),[v,k]=(0,r.useState)([]),w=(0,r.useRef)(null);return(0,r.useEffect)(()=>{y(l)},[l]),(0,r.useEffect)(()=>{e&&(async()=>{try{let t=await (0,o.fetchAvailableModels)(e);console.log("Fetched models for selector:",t),t.length>0&&k(t)}catch(e){console.error("Error fetching model info:",e)}})()},[e]),(0,t.jsxs)("div",{children:[p&&(0,t.jsxs)(i.Text,{className:"font-medium block mb-2 text-gray-700 flex items-center",children:[(0,t.jsx)(a.RobotOutlined,{className:"mr-2"})," ",m]}),(0,t.jsx)(s.Select,{value:g,placeholder:c,onChange:e=>{"custom"===e?(x(!0),y(void 0)):(x(!1),y(e),d&&d(e))},options:[...Array.from(new Set(v.map(e=>e.model_group))).map((e,t)=>({value:e,label:e,key:t})),{value:"custom",label:"Enter custom model",key:"custom"}],style:{width:"100%",...f},showSearch:!0,className:`rounded-md ${h||""}`,disabled:u}),b&&(0,t.jsx)(n.TextInput,{className:"mt-2",placeholder:"Enter custom model name",onValueChange:e=>{w.current&&clearTimeout(w.current),w.current=setTimeout(()=>{y(e),d&&d(e)},500)},disabled:u})]})}])},500727,699857,696609,531516,e=>{"use strict";var t=e.i(266027),r=e.i(243652),n=e.i(764205),i=e.i(135214);let s=(0,r.createQueryKeys)("mcpServers");e.s(["useMCPServers",0,e=>{let{accessToken:r}=(0,i.default)();return(0,t.useQuery)({queryKey:s.list(e?{filters:{teamId:e}}:void 0),queryFn:async()=>await (0,n.fetchMCPServers)(r,e),enabled:!!r})}],500727);let a=(0,r.createQueryKeys)("mcpToolsets");e.s(["useMCPToolsets",0,()=>{let{accessToken:e}=(0,i.default)();return(0,t.useQuery)({queryKey:a.list(),queryFn:async()=>await (0,n.fetchMCPToolsets)(e),enabled:!!e})}],699857);var o=e.i(843476),l=e.i(271645),c=e.i(536916),d=e.i(599724),u=e.i(409797),f=e.i(246349),f=f;let h=/\b(delete|remove|destroy|purge|drop|erase|unlink)\b/i,p=/\b(create|add|insert|new|post|submit|register|make|generate|write|upload)\b/i,m=/\b(update|edit|modify|change|patch|put|set|rename|move|transform)\b/i,g=/\b(get|read|list|fetch|search|find|query|retrieve|show|view|check|describe|info)\b/i;function y(e,t=""){let r=e.toLowerCase();if(g.test(r))return"read";if(h.test(r))return"delete";if(m.test(r))return"update";if(p.test(r))return"create";if(t){let e=t.toLowerCase();if(g.test(e))return"read";if(h.test(e))return"delete";if(m.test(e))return"update";if(p.test(e))return"create"}return"unknown"}function b(e){let t={read:[],create:[],update:[],delete:[],unknown:[]};for(let r of e)t[y(r.name,r.description)].push(r);return t}let x={read:{label:"Read",description:"Safe operations — fetch, list, search. No side effects.",risk:"low"},create:{label:"Create",description:"Add new resources — insert, upload, register.",risk:"medium"},update:{label:"Update",description:"Modify existing resources — edit, patch, rename.",risk:"medium"},delete:{label:"Delete",description:"Destructive operations — remove, purge, destroy.",risk:"high"},unknown:{label:"Other",description:"Operations that could not be automatically classified.",risk:"unknown"}};e.s(["CRUD_GROUP_META",0,x,"classifyToolOp",()=>y,"groupToolsByCrud",()=>b],696609);let v=["read","create","update","delete","unknown"],k={low:"bg-green-100 text-green-800",medium:"bg-yellow-100 text-yellow-800",high:"bg-red-100 text-red-800 font-semibold",unknown:"bg-gray-100 text-gray-700"},w={read:"border-green-200",create:"border-blue-200",update:"border-yellow-200",delete:"border-red-300",unknown:"border-gray-200"},_={read:"bg-green-50",create:"bg-blue-50",update:"bg-yellow-50",delete:"bg-red-50",unknown:"bg-gray-50"};e.s(["default",0,({tools:e,value:t,onChange:r,readOnly:n=!1,searchFilter:i=""})=>{let[s,a]=(0,l.useState)({read:!1,create:!1,update:!1,delete:!1,unknown:!0}),h=(0,l.useMemo)(()=>b(e),[e]),p=(0,l.useMemo)(()=>new Set(void 0===t?e.map(e=>e.name):t),[t,e]),m=e=>{if(n)return;let t=new Set(p);t.has(e)?t.delete(e):t.add(e),r(Array.from(t))};return 0===e.length?null:(0,o.jsx)("div",{className:"space-y-3",children:v.map(e=>{let t,l=h[e];if(0===l.length)return null;if(i){let e=i.toLowerCase();if(!l.some(t=>t.name.toLowerCase().includes(e)||(t.description??"").toLowerCase().includes(e)))return null}let g=x[e],y=(t=h[e]).length>0&&t.every(e=>p.has(e.name)),b=(e=>{let t=h[e];if(0===t.length)return!1;let r=t.filter(e=>p.has(e.name)).length;return r>0&&r{a(t=>({...t,[e]:!t[e]}))},children:[v?(0,o.jsx)(f.default,{className:"w-4 h-4 text-gray-500 flex-shrink-0"}):(0,o.jsx)(u.ChevronDownIcon,{className:"w-4 h-4 text-gray-500 flex-shrink-0"}),(0,o.jsx)("span",{className:"font-semibold text-gray-900 text-sm",children:g.label}),(0,o.jsx)("span",{className:`text-xs px-2 py-0.5 rounded-full ${k[g.risk]}`,children:"high"===g.risk?"High Risk":"medium"===g.risk?"Medium Risk":"low"===g.risk?"Safe":"Unclassified"}),(0,o.jsxs)("span",{className:"text-xs text-gray-500 ml-1",children:[l.filter(e=>p.has(e.name)).length,"/",l.length," allowed"]})]}),!n&&(0,o.jsxs)("div",{className:"flex items-center gap-2 ml-4",children:[(0,o.jsx)(d.Text,{className:"text-xs text-gray-500",children:y?"All on":b?"Partial":"All off"}),(0,o.jsx)(c.Checkbox,{checked:y,indeterminate:b,onChange:t=>((e,t)=>{if(n)return;let i=new Set(p);for(let r of h[e])t?i.add(r.name):i.delete(r.name);r(Array.from(i))})(e,t.target.checked),onClick:e=>e.stopPropagation()})]})]}),!v&&(0,o.jsx)("div",{className:"px-4 pt-2 pb-1 text-xs text-gray-500 bg-white border-b border-gray-100",children:g.description}),!v&&(0,o.jsx)("div",{className:"bg-white divide-y divide-gray-50",children:l.filter(e=>!i||e.name.toLowerCase().includes(i.toLowerCase())||(e.description??"").toLowerCase().includes(i.toLowerCase())).map(e=>{let t,r=(t=e.name,p.has(t));return(0,o.jsxs)("div",{className:`flex items-start gap-3 px-4 py-2.5 transition-colors hover:bg-gray-50 ${!n?"cursor-pointer":""} ${r?"":"opacity-60"}`,onClick:()=>m(e.name),children:[(0,o.jsx)(c.Checkbox,{checked:r,onChange:()=>m(e.name),disabled:n,onClick:e=>e.stopPropagation()}),(0,o.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,o.jsx)(d.Text,{className:"font-medium text-gray-900 text-sm",children:e.name}),e.description&&(0,o.jsx)(d.Text,{className:"text-xs text-gray-500 mt-0.5 leading-snug",children:e.description})]}),(0,o.jsx)("span",{className:`text-xs px-1.5 py-0.5 rounded flex-shrink-0 ${r?"bg-green-100 text-green-700":"bg-gray-100 text-gray-500"}`,children:r?"on":"off"})]},e.name)})})]},e)})})}],531516)},793130,e=>{"use strict";var t=e.i(290571),r=e.i(429427),n=e.i(371330),i=e.i(271645),s=e.i(394487),a=e.i(503269),o=e.i(214520),l=e.i(746725),c=e.i(914189),d=e.i(144279),u=e.i(294316),f=e.i(601893),h=e.i(140721),p=e.i(942803),m=e.i(233538),g=e.i(694421),y=e.i(700020),b=e.i(35889),x=e.i(998348),v=e.i(722678);let k=(0,i.createContext)(null);k.displayName="GroupContext";let w=i.Fragment,_=Object.assign((0,y.forwardRefWithAs)(function(e,t){var w;let _=(0,i.useId)(),C=(0,p.useProvidedId)(),j=(0,f.useDisabled)(),{id:S=C||`headlessui-switch-${_}`,disabled:E=j||!1,checked:O,defaultChecked:N,onChange:$,name:R,value:T,form:M,autoFocus:P=!1,...D}=e,I=(0,i.useContext)(k),[L,F]=(0,i.useState)(null),A=(0,i.useRef)(null),z=(0,u.useSyncRefs)(A,t,null===I?null:I.setSwitch,F),B=(0,o.useDefaultValue)(N),[W,q]=(0,a.useControllable)(O,$,null!=B&&B),H=(0,l.useDisposables)(),[U,K]=(0,i.useState)(!1),X=(0,c.useEvent)(()=>{K(!0),null==q||q(!W),H.nextFrame(()=>{K(!1)})}),Q=(0,c.useEvent)(e=>{if((0,m.isDisabledReactIssue7711)(e.currentTarget))return e.preventDefault();e.preventDefault(),X()}),V=(0,c.useEvent)(e=>{e.key===x.Keys.Space?(e.preventDefault(),X()):e.key===x.Keys.Enter&&(0,g.attemptSubmit)(e.currentTarget)}),G=(0,c.useEvent)(e=>e.preventDefault()),J=(0,v.useLabelledBy)(),Y=(0,b.useDescribedBy)(),{isFocusVisible:Z,focusProps:ee}=(0,r.useFocusRing)({autoFocus:P}),{isHovered:et,hoverProps:er}=(0,n.useHover)({isDisabled:E}),{pressed:en,pressProps:ei}=(0,s.useActivePress)({disabled:E}),es=(0,i.useMemo)(()=>({checked:W,disabled:E,hover:et,focus:Z,active:en,autofocus:P,changing:U}),[W,et,Z,en,E,U,P]),ea=(0,y.mergeProps)({id:S,ref:z,role:"switch",type:(0,d.useResolveButtonType)(e,L),tabIndex:-1===e.tabIndex?0:null!=(w=e.tabIndex)?w:0,"aria-checked":W,"aria-labelledby":J,"aria-describedby":Y,disabled:E||void 0,autoFocus:P,onClick:Q,onKeyUp:V,onKeyPress:G},ee,er,ei),eo=(0,i.useCallback)(()=>{if(void 0!==B)return null==q?void 0:q(B)},[q,B]),el=(0,y.useRender)();return i.default.createElement(i.default.Fragment,null,null!=R&&i.default.createElement(h.FormFields,{disabled:E,data:{[R]:T||"on"},overrides:{type:"checkbox",checked:W},form:M,onReset:eo}),el({ourProps:ea,theirProps:D,slot:es,defaultTag:"button",name:"Switch"}))}),{Group:function(e){var t;let[r,n]=(0,i.useState)(null),[s,a]=(0,v.useLabels)(),[o,l]=(0,b.useDescriptions)(),c=(0,i.useMemo)(()=>({switch:r,setSwitch:n}),[r,n]),d=(0,y.useRender)();return i.default.createElement(l,{name:"Switch.Description",value:o},i.default.createElement(a,{name:"Switch.Label",value:s,props:{htmlFor:null==(t=c.switch)?void 0:t.id,onClick(e){r&&(e.currentTarget instanceof HTMLLabelElement&&e.preventDefault(),r.click(),r.focus({preventScroll:!0}))}}},i.default.createElement(k.Provider,{value:c},d({ourProps:{},theirProps:e,slot:{},defaultTag:w,name:"Switch.Group"}))))},Label:v.Label,Description:b.Description});var C=e.i(888288),j=e.i(95779),S=e.i(444755),E=e.i(673706),O=e.i(829087);let N=(0,E.makeClassName)("Switch"),$=i.default.forwardRef((e,r)=>{let{checked:n,defaultChecked:s=!1,onChange:a,color:o,name:l,error:c,errorMessage:d,disabled:u,required:f,tooltip:h,id:p}=e,m=(0,t.__rest)(e,["checked","defaultChecked","onChange","color","name","error","errorMessage","disabled","required","tooltip","id"]),g={bgColor:o?(0,E.getColorClassNames)(o,j.colorPalette.background).bgColor:"bg-tremor-brand dark:bg-dark-tremor-brand",ringColor:o?(0,E.getColorClassNames)(o,j.colorPalette.ring).ringColor:"ring-tremor-brand-muted dark:ring-dark-tremor-brand-muted"},[y,b]=(0,C.default)(s,n),[x,v]=(0,i.useState)(!1),{tooltipProps:k,getReferenceProps:w}=(0,O.useTooltip)(300);return i.default.createElement("div",{className:"flex flex-row items-center justify-start"},i.default.createElement(O.default,Object.assign({text:h},k)),i.default.createElement("div",Object.assign({ref:(0,E.mergeRefs)([r,k.refs.setReference]),className:(0,S.tremorTwMerge)(N("root"),"flex flex-row relative h-5")},m,w),i.default.createElement("input",{type:"checkbox",className:(0,S.tremorTwMerge)(N("input"),"absolute w-5 h-5 cursor-pointer left-0 top-0 opacity-0"),name:l,required:f,checked:y,onChange:e=>{e.preventDefault()}}),i.default.createElement(_,{checked:y,onChange:e=>{b(e),null==a||a(e)},disabled:u,className:(0,S.tremorTwMerge)(N("switch"),"w-10 h-5 group relative inline-flex shrink-0 cursor-pointer items-center justify-center rounded-tremor-full","focus:outline-none",u?"cursor-not-allowed":""),onFocus:()=>v(!0),onBlur:()=>v(!1),id:p},i.default.createElement("span",{className:(0,S.tremorTwMerge)(N("sr-only"),"sr-only")},"Switch ",y?"on":"off"),i.default.createElement("span",{"aria-hidden":"true",className:(0,S.tremorTwMerge)(N("background"),y?g.bgColor:"bg-tremor-border dark:bg-dark-tremor-border","pointer-events-none absolute mx-auto h-3 w-9 rounded-tremor-full transition-colors duration-100 ease-in-out")}),i.default.createElement("span",{"aria-hidden":"true",className:(0,S.tremorTwMerge)(N("round"),y?(0,S.tremorTwMerge)(g.bgColor,"translate-x-5 border-tremor-background dark:border-dark-tremor-background"):"translate-x-0 bg-tremor-border dark:bg-dark-tremor-border border-tremor-background dark:border-dark-tremor-background","pointer-events-none absolute left-0 inline-block h-5 w-5 transform rounded-tremor-full border-2 shadow-tremor-input duration-100 ease-in-out transition",x?(0,S.tremorTwMerge)("ring-2",g.ringColor):"")}))),c&&d?i.default.createElement("p",{className:(0,S.tremorTwMerge)(N("errorMessage"),"text-sm text-red-500 mt-1 ")},d):null)});$.displayName="Switch",e.s(["Switch",()=>$],793130)},107233,37727,e=>{"use strict";var t=e.i(603908);e.s(["Plus",()=>t.default],107233);var r=e.i(841947);e.s(["X",()=>r.default],37727)},361653,e=>{"use strict";let t=(0,e.i(475254).default)("circle-alert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]]);e.s(["default",()=>t])},603908,e=>{"use strict";let t=(0,e.i(475254).default)("plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);e.s(["default",()=>t])},841947,e=>{"use strict";let t=(0,e.i(475254).default)("x",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);e.s(["default",()=>t])},158392,419470,e=>{"use strict";var t=e.i(843476),r=e.i(779241);let n={ttl:3600,lowest_latency_buffer:0},i=({routingStrategyArgs:e})=>{let i={ttl:"Sliding window to look back over when calculating the average latency of a deployment. Default - 1 hour (in seconds).",lowest_latency_buffer:"Shuffle between deployments within this % of the lowest latency. Default - 0 (i.e. always pick lowest latency)."};return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:"space-y-6",children:[(0,t.jsxs)("div",{className:"max-w-3xl",children:[(0,t.jsx)("h3",{className:"text-sm font-medium text-gray-900",children:"Latency-Based Configuration"}),(0,t.jsx)("p",{className:"text-xs text-gray-500 mt-1",children:"Fine-tune latency-based routing behavior"})]}),(0,t.jsx)("div",{className:"grid grid-cols-1 gap-6 lg:grid-cols-2 xl:grid-cols-3",children:Object.entries(e||n).map(([e,n])=>(0,t.jsx)("div",{className:"space-y-2",children:(0,t.jsxs)("label",{className:"block",children:[(0,t.jsx)("span",{className:"text-xs font-medium text-gray-700 uppercase tracking-wide",children:e.replace(/_/g," ")}),(0,t.jsx)("p",{className:"text-xs text-gray-500 mt-0.5 mb-2",children:i[e]||""}),(0,t.jsx)(r.TextInput,{name:e,defaultValue:"object"==typeof n?JSON.stringify(n,null,2):n?.toString(),className:"font-mono text-sm w-full"})]})},e))})]}),(0,t.jsx)("div",{className:"border-t border-gray-200"})]})},s=({routerSettings:e,routerFieldsMetadata:n})=>(0,t.jsxs)("div",{className:"space-y-6",children:[(0,t.jsxs)("div",{className:"max-w-3xl",children:[(0,t.jsx)("h3",{className:"text-sm font-medium text-gray-900",children:"Reliability & Retries"}),(0,t.jsx)("p",{className:"text-xs text-gray-500 mt-1",children:"Configure retry logic and failure handling"})]}),(0,t.jsx)("div",{className:"grid grid-cols-1 gap-6 lg:grid-cols-2 xl:grid-cols-3",children:Object.entries(e).filter(([e,t])=>"fallbacks"!=e&&"context_window_fallbacks"!=e&&"routing_strategy_args"!=e&&"routing_strategy"!=e&&"enable_tag_filtering"!=e).map(([e,i])=>(0,t.jsx)("div",{className:"space-y-2",children:(0,t.jsxs)("label",{className:"block",children:[(0,t.jsx)("span",{className:"text-xs font-medium text-gray-700 uppercase tracking-wide",children:n[e]?.ui_field_name||e}),(0,t.jsx)("p",{className:"text-xs text-gray-500 mt-0.5 mb-2",children:n[e]?.field_description||""}),(0,t.jsx)(r.TextInput,{name:e,defaultValue:null==i||"null"===i?"":"object"==typeof i?JSON.stringify(i,null,2):i?.toString()||"",placeholder:"—",className:"font-mono text-sm w-full"})]})},e))})]});var a=e.i(199133);let o=({selectedStrategy:e,availableStrategies:r,routingStrategyDescriptions:n,routerFieldsMetadata:i,onStrategyChange:s})=>(0,t.jsxs)("div",{className:"space-y-2 max-w-3xl",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"text-xs font-medium text-gray-700 uppercase tracking-wide",children:i.routing_strategy?.ui_field_name||"Routing Strategy"}),(0,t.jsx)("p",{className:"text-xs text-gray-500 mt-0.5 mb-2",children:i.routing_strategy?.field_description||""})]}),(0,t.jsx)("div",{className:"routing-strategy-select max-w-3xl",children:(0,t.jsx)(a.Select,{value:e,onChange:s,style:{width:"100%"},size:"large",children:r.map(e=>(0,t.jsx)(a.Select.Option,{value:e,label:e,children:(0,t.jsxs)("div",{className:"flex flex-col gap-0.5 py-1",children:[(0,t.jsx)("span",{className:"font-mono text-sm font-medium",children:e}),n[e]&&(0,t.jsx)("span",{className:"text-xs text-gray-500 font-normal",children:n[e]})]})},e))})})]});var l=e.i(793130);let c=({enabled:e,routerFieldsMetadata:r,onToggle:n})=>(0,t.jsx)("div",{className:"space-y-3 max-w-3xl",children:(0,t.jsxs)("div",{className:"flex items-start justify-between",children:[(0,t.jsxs)("div",{className:"flex-1",children:[(0,t.jsx)("label",{className:"text-xs font-medium text-gray-700 uppercase tracking-wide",children:r.enable_tag_filtering?.ui_field_name||"Enable Tag Filtering"}),(0,t.jsxs)("p",{className:"text-xs text-gray-500 mt-0.5",children:[r.enable_tag_filtering?.field_description||"",r.enable_tag_filtering?.link&&(0,t.jsxs)(t.Fragment,{children:[" ",(0,t.jsx)("a",{href:r.enable_tag_filtering.link,target:"_blank",rel:"noopener noreferrer",className:"text-blue-600 hover:text-blue-800 underline",children:"Learn more"})]})]})]}),(0,t.jsx)(l.Switch,{checked:e,onChange:n,className:"ml-4"})]})});e.s(["default",0,({value:e,onChange:r,routerFieldsMetadata:n,availableRoutingStrategies:a,routingStrategyDescriptions:l})=>(0,t.jsxs)("div",{className:"w-full space-y-8 py-2",children:[(0,t.jsxs)("div",{className:"space-y-6",children:[(0,t.jsxs)("div",{className:"max-w-3xl",children:[(0,t.jsx)("h3",{className:"text-sm font-medium text-gray-900",children:"Routing Settings"}),(0,t.jsx)("p",{className:"text-xs text-gray-500 mt-1",children:"Configure how requests are routed to deployments"})]}),a.length>0&&(0,t.jsx)(o,{selectedStrategy:e.selectedStrategy||e.routerSettings.routing_strategy||null,availableStrategies:a,routingStrategyDescriptions:l,routerFieldsMetadata:n,onStrategyChange:t=>{r({...e,selectedStrategy:t})}}),(0,t.jsx)(c,{enabled:e.enableTagFiltering,routerFieldsMetadata:n,onToggle:t=>{r({...e,enableTagFiltering:t})}})]}),(0,t.jsx)("div",{className:"border-t border-gray-200"}),"latency-based-routing"===e.selectedStrategy&&(0,t.jsx)(i,{routingStrategyArgs:e.routerSettings.routing_strategy_args}),(0,t.jsx)(s,{routerSettings:e.routerSettings,routerFieldsMetadata:n})]})],158392);var d=e.i(994388),u=e.i(653496),f=e.i(107233),h=e.i(271645),p=e.i(888259),m=e.i(592968),g=e.i(361653),g=g;let y=(0,e.i(475254).default)("arrow-down",[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]]);var b=e.i(37727);function x({group:e,onChange:r,availableModels:n,maxFallbacks:i}){let s=n.filter(t=>t!==e.primaryModel),o=e.fallbackModels.length{let n=[...e.fallbackModels];n.includes(t)&&(n=n.filter(e=>e!==t)),r({...e,primaryModel:t,fallbackModels:n})},showSearch:!0,getPopupContainer:e=>e.parentElement||document.body,filterOption:(e,t)=>(t?.label??"").toLowerCase().includes(e.toLowerCase()),options:n.map(e=>({label:e,value:e}))}),!e.primaryModel&&(0,t.jsxs)("div",{className:"mt-2 flex items-center gap-2 text-amber-600 text-xs bg-amber-50 p-2 rounded",children:[(0,t.jsx)(g.default,{className:"w-4 h-4"}),(0,t.jsx)("span",{children:"Select a model to begin configuring fallbacks"})]})]}),(0,t.jsx)("div",{className:"flex items-center justify-center -my-4 z-10",children:(0,t.jsxs)("div",{className:"bg-indigo-50 text-indigo-500 px-4 py-1 rounded-full text-xs font-bold border border-indigo-100 flex items-center gap-2 shadow-sm",children:[(0,t.jsx)(y,{className:"w-4 h-4"}),"IF FAILS, TRY..."]})}),(0,t.jsxs)("div",{className:`transition-opacity duration-300 ${!e.primaryModel?"opacity-50 pointer-events-none":"opacity-100"}`,children:[(0,t.jsxs)("label",{className:"block text-sm font-semibold text-gray-700 mb-2",children:["Fallback Chain ",(0,t.jsx)("span",{className:"text-red-500",children:"*"}),(0,t.jsxs)("span",{className:"text-xs text-gray-500 font-normal ml-2",children:["(Max ",i," fallbacks at a time)"]})]}),(0,t.jsxs)("div",{className:"bg-gray-50 rounded-xl p-4 border border-gray-200",children:[(0,t.jsxs)("div",{className:"mb-4",children:[(0,t.jsx)(a.Select,{mode:"multiple",className:"w-full",size:"large",placeholder:o?"Select fallback models to add...":`Maximum ${i} fallbacks reached`,value:e.fallbackModels,onChange:t=>{let n=t.slice(0,i);r({...e,fallbackModels:n})},disabled:!e.primaryModel,getPopupContainer:e=>e.parentElement||document.body,options:s.map(e=>({label:e,value:e})),optionRender:(r,n)=>{let i=e.fallbackModels.includes(r.value),s=i?e.fallbackModels.indexOf(r.value)+1:null;return(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[i&&null!==s&&(0,t.jsx)("span",{className:"flex items-center justify-center w-5 h-5 rounded bg-indigo-100 text-indigo-600 text-xs font-bold",children:s}),(0,t.jsx)("span",{children:r.label})]})},maxTagCount:"responsive",maxTagPlaceholder:e=>(0,t.jsx)(m.Tooltip,{styles:{root:{pointerEvents:"none"}},title:e.map(({value:e})=>e).join(", "),children:(0,t.jsxs)("span",{children:["+",e.length," more"]})}),showSearch:!0,filterOption:(e,t)=>(t?.label??"").toLowerCase().includes(e.toLowerCase())}),(0,t.jsx)("p",{className:"text-xs text-gray-500 mt-1 ml-1",children:o?`Search and select multiple models. Selected models will appear below in order. (${e.fallbackModels.length}/${i} used)`:`Maximum ${i} fallbacks reached. Remove some to add more.`})]}),(0,t.jsx)("div",{className:"space-y-2 min-h-[100px]",children:0===e.fallbackModels.length?(0,t.jsxs)("div",{className:"h-32 border-2 border-dashed border-gray-300 rounded-lg flex flex-col items-center justify-center text-gray-400",children:[(0,t.jsx)("span",{className:"text-sm",children:"No fallback models selected"}),(0,t.jsx)("span",{className:"text-xs mt-1",children:"Add models from the dropdown above"})]}):e.fallbackModels.map((n,i)=>(0,t.jsxs)("div",{className:"group flex items-center justify-between p-3 bg-white rounded-lg border border-gray-200 hover:border-indigo-300 hover:shadow-sm transition-all",children:[(0,t.jsxs)("div",{className:"flex items-center gap-3",children:[(0,t.jsx)("div",{className:"flex items-center justify-center w-6 h-6 rounded bg-gray-100 text-gray-400 group-hover:text-indigo-500 group-hover:bg-indigo-50",children:(0,t.jsx)("span",{className:"text-xs font-bold",children:i+1})}),(0,t.jsx)("div",{children:(0,t.jsx)("span",{className:"font-medium text-gray-800",children:n})})]}),(0,t.jsx)("button",{type:"button",onClick:()=>{let t;return t=e.fallbackModels.filter((e,t)=>t!==i),void r({...e,fallbackModels:t})},className:"opacity-0 group-hover:opacity-100 transition-opacity text-gray-400 hover:text-red-500 p-1",children:(0,t.jsx)(b.X,{className:"w-4 h-4"})})]},`${n}-${i}`))})]})]})]})}function v({groups:e,onGroupsChange:r,availableModels:n,maxFallbacks:i=10,maxGroups:s=5}){let[a,o]=(0,h.useState)(e.length>0?e[0].id:"1");(0,h.useEffect)(()=>{e.length>0?e.some(e=>e.id===a)||o(e[0].id):o("1")},[e]);let l=()=>{if(e.length>=s)return;let t=Date.now().toString();r([...e,{id:t,primaryModel:null,fallbackModels:[]}]),o(t)},c=t=>{r(e.map(e=>e.id===t.id?t:e))},m=e.map((r,s)=>{let a=r.primaryModel?r.primaryModel:`Group ${s+1}`;return{key:r.id,label:a,closable:e.length>1,children:(0,t.jsx)(x,{group:r,onChange:c,availableModels:n,maxFallbacks:i})}});return 0===e.length?(0,t.jsxs)("div",{className:"text-center py-12 bg-gray-50 rounded-lg border border-dashed border-gray-300",children:[(0,t.jsx)("p",{className:"text-gray-500 mb-4",children:"No fallback groups configured"}),(0,t.jsx)(d.Button,{variant:"primary",onClick:l,icon:()=>(0,t.jsx)(f.Plus,{className:"w-4 h-4"}),children:"Create First Group"})]}):(0,t.jsx)(u.Tabs,{type:"editable-card",activeKey:a,onChange:o,onEdit:(t,n)=>{"add"===n?l():"remove"===n&&e.length>1&&(t=>{if(1===e.length)return p.default.warning("At least one group is required");let n=e.filter(e=>e.id!==t);r(n),a===t&&n.length>0&&o(n[n.length-1].id)})(t)},items:m,className:"fallback-tabs",tabBarStyle:{marginBottom:0},hideAdd:e.length>=s})}e.s(["FallbackSelectionForm",()=>v],419470)},916940,e=>{"use strict";var t=e.i(843476),r=e.i(271645),n=e.i(199133),i=e.i(764205);e.s(["default",0,({onChange:e,value:s,className:a,accessToken:o,placeholder:l="Select vector stores",disabled:c=!1})=>{let[d,u]=(0,r.useState)([]),[f,h]=(0,r.useState)(!1);return(0,r.useEffect)(()=>{(async()=>{if(o){h(!0);try{let e=await (0,i.vectorStoreListCall)(o);e.data&&u(e.data)}catch(e){console.error("Error fetching vector stores:",e)}finally{h(!1)}}})()},[o]),(0,t.jsx)("div",{children:(0,t.jsx)(n.Select,{mode:"multiple",placeholder:l,onChange:e,value:s,loading:f,className:a,allowClear:!0,options:d.map(e=>({label:`${e.vector_store_name||e.vector_store_id} (${e.vector_store_id})`,value:e.vector_store_id,title:e.vector_store_description||e.vector_store_id})),optionFilterProp:"label",showSearch:!0,style:{width:"100%"},disabled:c})})}])},737434,e=>{"use strict";var t=e.i(184163);e.s(["DownloadOutlined",()=>t.default])},689020,e=>{"use strict";var t=e.i(764205);let r=async e=>{try{let r=await (0,t.modelHubCall)(e);if(console.log("model_info:",r),r?.data.length>0){let e=r.data.map(e=>({model_group:e.model_group,mode:e?.mode}));return e.sort((e,t)=>e.model_group.localeCompare(t.model_group)),e}return[]}catch(e){throw console.error("Error fetching model info:",e),e}};e.s(["fetchAvailableModels",0,r])},955135,e=>{"use strict";var t=e.i(597440);e.s(["DeleteOutlined",()=>t.default])},309821,e=>{"use strict";e.i(247167);var t=e.i(271645);e.i(262370);var r=e.i(135551),n=e.i(201072),i=e.i(121229),s=e.i(726289),a=e.i(864517),o=e.i(343794),l=e.i(529681),c=e.i(242064),d=e.i(931067),u=e.i(209428),f=e.i(703923),h={percent:0,prefixCls:"rc-progress",strokeColor:"#2db7f5",strokeLinecap:"round",strokeWidth:1,trailColor:"#D9D9D9",trailWidth:1,gapPosition:"bottom"},p=function(){var e=(0,t.useRef)([]),r=(0,t.useRef)(null);return(0,t.useEffect)(function(){var t=Date.now(),n=!1;e.current.forEach(function(e){if(e){n=!0;var i=e.style;i.transitionDuration=".3s, .3s, .3s, .06s",r.current&&t-r.current<100&&(i.transitionDuration="0s, 0s")}}),n&&(r.current=Date.now())}),e.current},m=e.i(410160),g=e.i(392221),y=e.i(654310),b=0,x=(0,y.default)();let v=function(e){var r=t.useState(),n=(0,g.default)(r,2),i=n[0],s=n[1];return t.useEffect(function(){var e;s("rc_progress_".concat((x?(e=b,b+=1):e="TEST_OR_SSR",e)))},[]),e||i};var k=function(e){var r=e.bg,n=e.children;return t.createElement("div",{style:{width:"100%",height:"100%",background:r}},n)};function w(e,t){return Object.keys(e).map(function(r){var n=parseFloat(r),i="".concat(Math.floor(n*t),"%");return"".concat(e[r]," ").concat(i)})}var _=t.forwardRef(function(e,r){var n=e.prefixCls,i=e.color,s=e.gradientId,a=e.radius,o=e.style,l=e.ptg,c=e.strokeLinecap,d=e.strokeWidth,u=e.size,f=e.gapDegree,h=i&&"object"===(0,m.default)(i),p=u/2,g=t.createElement("circle",{className:"".concat(n,"-circle-path"),r:a,cx:p,cy:p,stroke:h?"#FFF":void 0,strokeLinecap:c,strokeWidth:d,opacity:+(0!==l),style:o,ref:r});if(!h)return g;var y="".concat(s,"-conic"),b=w(i,(360-f)/360),x=w(i,1),v="conic-gradient(from ".concat(f?"".concat(180+f/2,"deg"):"0deg",", ").concat(b.join(", "),")"),_="linear-gradient(to ".concat(f?"bottom":"top",", ").concat(x.join(", "),")");return t.createElement(t.Fragment,null,t.createElement("mask",{id:y},g),t.createElement("foreignObject",{x:0,y:0,width:u,height:u,mask:"url(#".concat(y,")")},t.createElement(k,{bg:_},t.createElement(k,{bg:v}))))}),C=function(e,t,r,n,i,s,a,o,l,c){var d=arguments.length>10&&void 0!==arguments[10]?arguments[10]:0,u=(100-n)/100*t;return"round"===l&&100!==n&&(u+=c/2)>=t&&(u=t-.01),{stroke:"string"==typeof o?o:void 0,strokeDasharray:"".concat(t,"px ").concat(e),strokeDashoffset:u+d,transform:"rotate(".concat(i+r/100*360*((360-s)/360)+(0===s?0:({bottom:0,top:180,left:90,right:-90})[a]),"deg)"),transformOrigin:"".concat(50,"px ").concat(50,"px"),transition:"stroke-dashoffset .3s ease 0s, stroke-dasharray .3s ease 0s, stroke .3s, stroke-width .06s ease .3s, opacity .3s ease 0s",fillOpacity:0}},j=["id","prefixCls","steps","strokeWidth","trailWidth","gapDegree","gapPosition","trailColor","strokeLinecap","style","className","strokeColor","percent"];function S(e){var t=null!=e?e:[];return Array.isArray(t)?t:[t]}let E=function(e){var r,n,i,s,a=(0,u.default)((0,u.default)({},h),e),l=a.id,c=a.prefixCls,g=a.steps,y=a.strokeWidth,b=a.trailWidth,x=a.gapDegree,k=void 0===x?0:x,w=a.gapPosition,E=a.trailColor,O=a.strokeLinecap,N=a.style,$=a.className,R=a.strokeColor,T=a.percent,M=(0,f.default)(a,j),P=v(l),D="".concat(P,"-gradient"),I=50-y/2,L=2*Math.PI*I,F=k>0?90+k/2:-90,A=(360-k)/360*L,z="object"===(0,m.default)(g)?g:{count:g,gap:2},B=z.count,W=z.gap,q=S(T),H=S(R),U=H.find(function(e){return e&&"object"===(0,m.default)(e)}),K=U&&"object"===(0,m.default)(U)?"butt":O,X=C(L,A,0,100,F,k,w,E,K,y),Q=p();return t.createElement("svg",(0,d.default)({className:(0,o.default)("".concat(c,"-circle"),$),viewBox:"0 0 ".concat(100," ").concat(100),style:N,id:l,role:"presentation"},M),!B&&t.createElement("circle",{className:"".concat(c,"-circle-trail"),r:I,cx:50,cy:50,stroke:E,strokeLinecap:K,strokeWidth:b||y,style:X}),B?(r=Math.round(B*(q[0]/100)),n=100/B,i=0,Array(B).fill(null).map(function(e,s){var a=s<=r-1?H[0]:E,o=a&&"object"===(0,m.default)(a)?"url(#".concat(D,")"):void 0,l=C(L,A,i,n,F,k,w,a,"butt",y,W);return i+=(A-l.strokeDashoffset+W)*100/A,t.createElement("circle",{key:s,className:"".concat(c,"-circle-path"),r:I,cx:50,cy:50,stroke:o,strokeWidth:y,opacity:1,style:l,ref:function(e){Q[s]=e}})})):(s=0,q.map(function(e,r){var n=H[r]||H[H.length-1],i=C(L,A,s,e,F,k,w,n,K,y);return s+=e,t.createElement(_,{key:r,color:n,ptg:e,radius:I,prefixCls:c,gradientId:D,style:i,strokeLinecap:K,strokeWidth:y,gapDegree:k,ref:function(e){Q[r]=e},size:100})}).reverse()))};var O=e.i(491816);e.i(765846);var N=e.i(896091);function $(e){return!e||e<0?0:e>100?100:e}function R({success:e,successPercent:t}){let r=t;return e&&"progress"in e&&(r=e.progress),e&&"percent"in e&&(r=e.percent),r}let T=(e,t,r)=>{var n,i,s,a;let o=-1,l=-1;if("step"===t){let t=r.steps,n=r.strokeWidth;"string"==typeof e||void 0===e?(o="small"===e?2:14,l=null!=n?n:8):"number"==typeof e?[o,l]=[e,e]:[o=14,l=8]=Array.isArray(e)?e:[e.width,e.height],o*=t}else if("line"===t){let t=null==r?void 0:r.strokeWidth;"string"==typeof e||void 0===e?l=t||("small"===e?6:8):"number"==typeof e?[o,l]=[e,e]:[o=-1,l=8]=Array.isArray(e)?e:[e.width,e.height]}else("circle"===t||"dashboard"===t)&&("string"==typeof e||void 0===e?[o,l]="small"===e?[60,60]:[120,120]:"number"==typeof e?[o,l]=[e,e]:Array.isArray(e)&&(o=null!=(i=null!=(n=e[0])?n:e[1])?i:120,l=null!=(a=null!=(s=e[0])?s:e[1])?a:120));return[o,l]},M=e=>{let{prefixCls:r,trailColor:n=null,strokeLinecap:i="round",gapPosition:s,gapDegree:a,width:l=120,type:c,children:d,success:u,size:f=l,steps:h}=e,[p,m]=T(f,"circle"),{strokeWidth:g}=e;void 0===g&&(g=Math.max(3/p*100,6));let y=t.useMemo(()=>a||0===a?a:"dashboard"===c?75:void 0,[a,c]),b=(({percent:e,success:t,successPercent:r})=>{let n=$(R({success:t,successPercent:r}));return[n,$($(e)-n)]})(e),x="[object Object]"===Object.prototype.toString.call(e.strokeColor),v=(({success:e={},strokeColor:t})=>{let{strokeColor:r}=e;return[r||N.presetPrimaryColors.green,t||null]})({success:u,strokeColor:e.strokeColor}),k=(0,o.default)(`${r}-inner`,{[`${r}-circle-gradient`]:x}),w=t.createElement(E,{steps:h,percent:h?b[1]:b,strokeWidth:g,trailWidth:g,strokeColor:h?v[1]:v,strokeLinecap:i,trailColor:n,prefixCls:r,gapDegree:y,gapPosition:s||"dashboard"===c&&"bottom"||void 0}),_=p<=20,C=t.createElement("div",{className:k,style:{width:p,height:m,fontSize:.15*p+6}},w,!_&&d);return _?t.createElement(O.default,{title:d},C):C};e.i(296059);var P=e.i(694758),D=e.i(915654),I=e.i(183293),L=e.i(246422),F=e.i(838378);let A="--progress-line-stroke-color",z="--progress-percent",B=e=>{let t=e?"100%":"-100%";return new P.Keyframes(`antProgress${e?"RTL":"LTR"}Active`,{"0%":{transform:`translateX(${t}) scaleX(0)`,opacity:.1},"20%":{transform:`translateX(${t}) scaleX(0)`,opacity:.5},to:{transform:"translateX(0) scaleX(1)",opacity:0}})},W=(0,L.genStyleHooks)("Progress",e=>{let t=e.calc(e.marginXXS).div(2).equal(),r=(0,F.mergeToken)(e,{progressStepMarginInlineEnd:t,progressStepMinWidth:t,progressActiveMotionDuration:"2.4s"});return[(e=>{let{componentCls:t,iconCls:r}=e;return{[t]:Object.assign(Object.assign({},(0,I.resetComponent)(e)),{display:"inline-block","&-rtl":{direction:"rtl"},"&-line":{position:"relative",width:"100%",fontSize:e.fontSize},[`${t}-outer`]:{display:"inline-flex",alignItems:"center",width:"100%"},[`${t}-inner`]:{position:"relative",display:"inline-block",width:"100%",flex:1,overflow:"hidden",verticalAlign:"middle",backgroundColor:e.remainingColor,borderRadius:e.lineBorderRadius},[`${t}-inner:not(${t}-circle-gradient)`]:{[`${t}-circle-path`]:{stroke:e.defaultColor}},[`${t}-success-bg, ${t}-bg`]:{position:"relative",background:e.defaultColor,borderRadius:e.lineBorderRadius,transition:`all ${e.motionDurationSlow} ${e.motionEaseInOutCirc}`},[`${t}-layout-bottom`]:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",[`${t}-text`]:{width:"max-content",marginInlineStart:0,marginTop:e.marginXXS}},[`${t}-bg`]:{overflow:"hidden","&::after":{content:'""',background:{_multi_value_:!0,value:["inherit",`var(${A})`]},height:"100%",width:`calc(1 / var(${z}) * 100%)`,display:"block"},[`&${t}-bg-inner`]:{minWidth:"max-content","&::after":{content:"none"},[`${t}-text-inner`]:{color:e.colorWhite,[`&${t}-text-bright`]:{color:"rgba(0, 0, 0, 0.45)"}}}},[`${t}-success-bg`]:{position:"absolute",insetBlockStart:0,insetInlineStart:0,backgroundColor:e.colorSuccess},[`${t}-text`]:{display:"inline-block",marginInlineStart:e.marginXS,color:e.colorText,lineHeight:1,width:"2em",whiteSpace:"nowrap",textAlign:"start",verticalAlign:"middle",wordBreak:"normal",[r]:{fontSize:e.fontSize},[`&${t}-text-outer`]:{width:"max-content"},[`&${t}-text-outer${t}-text-start`]:{width:"max-content",marginInlineStart:0,marginInlineEnd:e.marginXS}},[`${t}-text-inner`]:{display:"flex",justifyContent:"center",alignItems:"center",width:"100%",height:"100%",marginInlineStart:0,padding:`0 ${(0,D.unit)(e.paddingXXS)}`,[`&${t}-text-start`]:{justifyContent:"start"},[`&${t}-text-end`]:{justifyContent:"end"}},[`&${t}-status-active`]:{[`${t}-bg::before`]:{position:"absolute",inset:0,backgroundColor:e.colorBgContainer,borderRadius:e.lineBorderRadius,opacity:0,animationName:B(),animationDuration:e.progressActiveMotionDuration,animationTimingFunction:e.motionEaseOutQuint,animationIterationCount:"infinite",content:'""'}},[`&${t}-rtl${t}-status-active`]:{[`${t}-bg::before`]:{animationName:B(!0)}},[`&${t}-status-exception`]:{[`${t}-bg`]:{backgroundColor:e.colorError},[`${t}-text`]:{color:e.colorError}},[`&${t}-status-exception ${t}-inner:not(${t}-circle-gradient)`]:{[`${t}-circle-path`]:{stroke:e.colorError}},[`&${t}-status-success`]:{[`${t}-bg`]:{backgroundColor:e.colorSuccess},[`${t}-text`]:{color:e.colorSuccess}},[`&${t}-status-success ${t}-inner:not(${t}-circle-gradient)`]:{[`${t}-circle-path`]:{stroke:e.colorSuccess}}})}})(r),(e=>{let{componentCls:t,iconCls:r}=e;return{[t]:{[`${t}-circle-trail`]:{stroke:e.remainingColor},[`&${t}-circle ${t}-inner`]:{position:"relative",lineHeight:1,backgroundColor:"transparent"},[`&${t}-circle ${t}-text`]:{position:"absolute",insetBlockStart:"50%",insetInlineStart:0,width:"100%",margin:0,padding:0,color:e.circleTextColor,fontSize:e.circleTextFontSize,lineHeight:1,whiteSpace:"normal",textAlign:"center",transform:"translateY(-50%)",[r]:{fontSize:e.circleIconFontSize}},[`${t}-circle&-status-exception`]:{[`${t}-text`]:{color:e.colorError}},[`${t}-circle&-status-success`]:{[`${t}-text`]:{color:e.colorSuccess}}},[`${t}-inline-circle`]:{lineHeight:1,[`${t}-inner`]:{verticalAlign:"bottom"}}}})(r),(e=>{let{componentCls:t}=e;return{[t]:{[`${t}-steps`]:{display:"inline-block","&-outer":{display:"flex",flexDirection:"row",alignItems:"center"},"&-item":{flexShrink:0,minWidth:e.progressStepMinWidth,marginInlineEnd:e.progressStepMarginInlineEnd,backgroundColor:e.remainingColor,transition:`all ${e.motionDurationSlow}`,"&-active":{backgroundColor:e.defaultColor}}}}}})(r),(e=>{let{componentCls:t,iconCls:r}=e;return{[t]:{[`${t}-small&-line, ${t}-small&-line ${t}-text ${r}`]:{fontSize:e.fontSizeSM}}}})(r)]},e=>({circleTextColor:e.colorText,defaultColor:e.colorInfo,remainingColor:e.colorFillSecondary,lineBorderRadius:100,circleTextFontSize:"1em",circleIconFontSize:`${e.fontSize/e.fontSizeSM}em`}));var q=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&0>t.indexOf(n)&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var i=0,n=Object.getOwnPropertySymbols(e);it.indexOf(n[i])&&Object.prototype.propertyIsEnumerable.call(e,n[i])&&(r[n[i]]=e[n[i]]);return r};let H=e=>{let{prefixCls:r,direction:n,percent:i,size:s,strokeWidth:a,strokeColor:l,strokeLinecap:c="round",children:d,trailColor:u=null,percentPosition:f,success:h}=e,{align:p,type:m}=f,g=l&&"string"!=typeof l?((e,t)=>{let{from:r=N.presetPrimaryColors.blue,to:n=N.presetPrimaryColors.blue,direction:i="rtl"===t?"to left":"to right"}=e,s=q(e,["from","to","direction"]);if(0!==Object.keys(s).length){let e,t=(e=[],Object.keys(s).forEach(t=>{let r=Number.parseFloat(t.replace(/%/g,""));Number.isNaN(r)||e.push({key:r,value:s[t]})}),(e=e.sort((e,t)=>e.key-t.key)).map(({key:e,value:t})=>`${t} ${e}%`).join(", ")),r=`linear-gradient(${i}, ${t})`;return{background:r,[A]:r}}let a=`linear-gradient(${i}, ${r}, ${n})`;return{background:a,[A]:a}})(l,n):{[A]:l,background:l},y="square"===c||"butt"===c?0:void 0,[b,x]=T(null!=s?s:[-1,a||("small"===s?6:8)],"line",{strokeWidth:a}),v=Object.assign(Object.assign({width:`${$(i)}%`,height:x,borderRadius:y},g),{[z]:$(i)/100}),k=R(e),w={width:`${$(k)}%`,height:x,borderRadius:y,backgroundColor:null==h?void 0:h.strokeColor},_=t.createElement("div",{className:`${r}-inner`,style:{backgroundColor:u||void 0,borderRadius:y}},t.createElement("div",{className:(0,o.default)(`${r}-bg`,`${r}-bg-${m}`),style:v},"inner"===m&&d),void 0!==k&&t.createElement("div",{className:`${r}-success-bg`,style:w})),C="outer"===m&&"start"===p,j="outer"===m&&"end"===p;return"outer"===m&&"center"===p?t.createElement("div",{className:`${r}-layout-bottom`},_,d):t.createElement("div",{className:`${r}-outer`,style:{width:b<0?"100%":b}},C&&d,_,j&&d)},U=e=>{let{size:r,steps:n,rounding:i=Math.round,percent:s=0,strokeWidth:a=8,strokeColor:l,trailColor:c=null,prefixCls:d,children:u}=e,f=i(s/100*n),[h,p]=T(null!=r?r:["small"===r?2:14,a],"step",{steps:n,strokeWidth:a}),m=h/n,g=Array.from({length:n});for(let e=0;et.indexOf(n)&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var i=0,n=Object.getOwnPropertySymbols(e);it.indexOf(n[i])&&Object.prototype.propertyIsEnumerable.call(e,n[i])&&(r[n[i]]=e[n[i]]);return r};let X=["normal","exception","active","success"],Q=t.forwardRef((e,d)=>{let u,{prefixCls:f,className:h,rootClassName:p,steps:m,strokeColor:g,percent:y=0,size:b="default",showInfo:x=!0,type:v="line",status:k,format:w,style:_,percentPosition:C={}}=e,j=K(e,["prefixCls","className","rootClassName","steps","strokeColor","percent","size","showInfo","type","status","format","style","percentPosition"]),{align:S="end",type:E="outer"}=C,O=Array.isArray(g)?g[0]:g,N="string"==typeof g||Array.isArray(g)?g:void 0,P=t.useMemo(()=>{if(O){let e="string"==typeof O?O:Object.values(O)[0];return new r.FastColor(e).isLight()}return!1},[g]),D=t.useMemo(()=>{var t,r;let n=R(e);return Number.parseInt(void 0!==n?null==(t=null!=n?n:0)?void 0:t.toString():null==(r=null!=y?y:0)?void 0:r.toString(),10)},[y,e.success,e.successPercent]),I=t.useMemo(()=>!X.includes(k)&&D>=100?"success":k||"normal",[k,D]),{getPrefixCls:L,direction:F,progress:A}=t.useContext(c.ConfigContext),z=L("progress",f),[B,q,Q]=W(z),V="line"===v,G=V&&!m,J=t.useMemo(()=>{let r;if(!x)return null;let l=R(e),c=w||(e=>`${e}%`),d=V&&P&&"inner"===E;return"inner"===E||w||"exception"!==I&&"success"!==I?r=c($(y),$(l)):"exception"===I?r=V?t.createElement(s.default,null):t.createElement(a.default,null):"success"===I&&(r=V?t.createElement(n.default,null):t.createElement(i.default,null)),t.createElement("span",{className:(0,o.default)(`${z}-text`,{[`${z}-text-bright`]:d,[`${z}-text-${S}`]:G,[`${z}-text-${E}`]:G}),title:"string"==typeof r?r:void 0},r)},[x,y,D,I,v,z,w]);"line"===v?u=m?t.createElement(U,Object.assign({},e,{strokeColor:N,prefixCls:z,steps:"object"==typeof m?m.count:m}),J):t.createElement(H,Object.assign({},e,{strokeColor:O,prefixCls:z,direction:F,percentPosition:{align:S,type:E}}),J):("circle"===v||"dashboard"===v)&&(u=t.createElement(M,Object.assign({},e,{strokeColor:O,prefixCls:z,progressStatus:I}),J));let Y=(0,o.default)(z,`${z}-status-${I}`,{[`${z}-${"dashboard"===v&&"circle"||v}`]:"line"!==v,[`${z}-inline-circle`]:"circle"===v&&T(b,"circle")[0]<=20,[`${z}-line`]:G,[`${z}-line-align-${S}`]:G,[`${z}-line-position-${E}`]:G,[`${z}-steps`]:m,[`${z}-show-info`]:x,[`${z}-${b}`]:"string"==typeof b,[`${z}-rtl`]:"rtl"===F},null==A?void 0:A.className,h,p,q,Q);return B(t.createElement("div",Object.assign({ref:d,style:Object.assign(Object.assign({},null==A?void 0:A.style),_),className:Y,role:"progressbar","aria-valuenow":D,"aria-valuemin":0,"aria-valuemax":100},(0,l.default)(j,["trailColor","strokeWidth","width","gapDegree","gapPosition","strokeLinecap","success","successPercent"])),u))});e.s(["default",0,Q],309821)},597440,e=>{"use strict";e.i(247167);var t=e.i(931067),r=e.i(271645);let n={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M360 184h-8c4.4 0 8-3.6 8-8v8h304v-8c0 4.4 3.6 8 8 8h-8v72h72v-80c0-35.3-28.7-64-64-64H352c-35.3 0-64 28.7-64 64v80h72v-72zm504 72H160c-17.7 0-32 14.3-32 32v32c0 4.4 3.6 8 8 8h60.4l24.7 523c1.6 34.1 29.8 61 63.9 61h454c34.2 0 62.3-26.8 63.9-61l24.7-523H888c4.4 0 8-3.6 8-8v-32c0-17.7-14.3-32-32-32zM731.3 840H292.7l-24.2-512h487l-24.2 512z"}}]},name:"delete",theme:"outlined"};var i=e.i(9583),s=r.forwardRef(function(e,s){return r.createElement(i.default,(0,t.default)({},e,{ref:s,icon:n}))});e.s(["default",0,s],597440)},309426,e=>{"use strict";var t=e.i(290571),r=e.i(444755),n=e.i(673706),i=e.i(271645),s=e.i(46757);let a=(0,n.makeClassName)("Col"),o=i.default.forwardRef((e,n)=>{let o,l,c,d,{numColSpan:u=1,numColSpanSm:f,numColSpanMd:h,numColSpanLg:p,children:m,className:g}=e,y=(0,t.__rest)(e,["numColSpan","numColSpanSm","numColSpanMd","numColSpanLg","children","className"]),b=(e,t)=>e&&Object.keys(t).includes(String(e))?t[e]:"";return i.default.createElement("div",Object.assign({ref:n,className:(0,r.tremorTwMerge)(a("root"),(o=b(u,s.colSpan),l=b(f,s.colSpanSm),c=b(h,s.colSpanMd),d=b(p,s.colSpanLg),(0,r.tremorTwMerge)(o,l,c,d)),g)},y),m)});o.displayName="Col",e.s(["Col",()=>o],309426)},519756,e=>{"use strict";e.i(247167);var t=e.i(931067),r=e.i(271645);let n={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M400 317.7h73.9V656c0 4.4 3.6 8 8 8h60c4.4 0 8-3.6 8-8V317.7H624c6.7 0 10.4-7.7 6.3-12.9L518.3 163a8 8 0 00-12.6 0l-112 141.7c-4.1 5.3-.4 13 6.3 13zM878 626h-60c-4.4 0-8 3.6-8 8v154H214V634c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8v198c0 17.7 14.3 32 32 32h684c17.7 0 32-14.3 32-32V634c0-4.4-3.6-8-8-8z"}}]},name:"upload",theme:"outlined"};var i=e.i(9583),s=r.forwardRef(function(e,s){return r.createElement(i.default,(0,t.default)({},e,{ref:s,icon:n}))});e.s(["UploadOutlined",0,s],519756)},981339,e=>{"use strict";var t=e.i(185793);e.s(["Skeleton",()=>t.default])},500330,e=>{"use strict";var t=e.i(727749);function r(e,t){let r=structuredClone(e);for(let[e,n]of Object.entries(t))e in r&&(r[e]=n);return r}let n=(e,t=0,r=!1,n=!0)=>{if(null==e||!Number.isFinite(e)||0===e&&!n)return"-";let i={minimumFractionDigits:t,maximumFractionDigits:t};if(!r)return e.toLocaleString("en-US",i);let s=e<0?"-":"",a=Math.abs(e),o=a,l="";return a>=1e6?(o=a/1e6,l="M"):a>=1e3&&(o=a/1e3,l="K"),`${s}${o.toLocaleString("en-US",i)}${l}`},i=async(e,r="Copied to clipboard")=>{if(!e)return!1;if(!navigator||!navigator.clipboard||!navigator.clipboard.writeText)return s(e,r);try{return await navigator.clipboard.writeText(e),t.default.success(r),!0}catch(t){return console.error("Clipboard API failed: ",t),s(e,r)}},s=(e,r)=>{try{let n=document.createElement("textarea");n.value=e,n.style.position="fixed",n.style.left="-999999px",n.style.top="-999999px",n.setAttribute("readonly",""),document.body.appendChild(n),n.focus(),n.select();let i=document.execCommand("copy");if(document.body.removeChild(n),i)return t.default.success(r),!0;throw Error("execCommand failed")}catch(e){return t.default.fromBackend("Failed to copy to clipboard"),console.error("Failed to copy: ",e),!1}};e.s(["copyToClipboard",0,i,"formatNumberWithCommas",0,n,"getSpendString",0,(e,t=6)=>{if(null==e||!Number.isFinite(e)||0===e)return"-";let r=n(e,t,!1,!1);if(0===Number(r.replace(/,/g,""))){let e=(1/10**t).toFixed(t);return`< $${e}`}return`$${r}`},"updateExistingKeys",()=>r])},663435,152473,e=>{"use strict";var t=e.i(843476),r=e.i(271645),n=e.i(199133),i=e.i(898586),s=e.i(56456);let a={enabled:!0,leading:!1,trailing:!0,wait:0,onExecute:()=>{}};class o{constructor(e,t){this.fn=e,this._canLeadingExecute=!0,this._isPending=!1,this._executionCount=0,this._options={...a,...t}}setOptions(e){return this._options={...this._options,...e},this._options.enabled||(this._isPending=!1),this._options}getOptions(){return this._options}maybeExecute(...e){this._options.leading&&this._canLeadingExecute&&(this.executeFunction(...e),this._canLeadingExecute=!1),(this._options.leading||this._options.trailing)&&(this._isPending=!0),this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=setTimeout(()=>{this._canLeadingExecute=!0,this._isPending=!1,this._options.trailing&&this.executeFunction(...e)},this._options.wait)}executeFunction(...e){this._options.enabled&&(this.fn(...e),this._executionCount++,this._options.onExecute(this))}cancel(){this._timeoutId&&(clearTimeout(this._timeoutId),this._canLeadingExecute=!0,this._isPending=!1)}getExecutionCount(){return this._executionCount}getIsPending(){return this._options.enabled&&this._isPending}}function l(e,t){let[n,i]=(0,r.useState)(e),s=function(e,t){let[n]=(0,r.useState)(()=>{var r;return Object.getOwnPropertyNames(Object.getPrototypeOf(r=new o(e,t))).filter(e=>"function"==typeof r[e]).reduce((e,t)=>{let n=r[t];return"function"==typeof n&&(e[t]=n.bind(r)),e},{})});return n.setOptions(t),n}(i,t);return[n,s.maybeExecute,s]}e.s(["useDebouncedState",()=>l],152473);var c=e.i(785242);let{Text:d}=i.Typography;e.s(["default",0,({value:e,onChange:i,onTeamSelect:a,disabled:o,organizationId:u,pageSize:f=20})=>{let[h,p]=(0,r.useState)(""),[m,g]=l("",{wait:300}),{data:y,fetchNextPage:b,hasNextPage:x,isFetchingNextPage:v,isLoading:k}=(0,c.useInfiniteTeams)(f,m||void 0,u),w=(0,r.useMemo)(()=>{if(!y?.pages)return[];let e=new Set,t=[];for(let r of y.pages)for(let n of r.teams)e.has(n.team_id)||(e.add(n.team_id),t.push(n));return t},[y]);return(0,t.jsx)(n.Select,{showSearch:!0,placeholder:"Search or select a team",value:e||void 0,onChange:e=>{i?.(e??""),a&&a(e?w.find(t=>t.team_id===e)??null:null)},disabled:o,allowClear:!0,filterOption:!1,onSearch:e=>{p(e),g(e)},searchValue:h,onPopupScroll:e=>{let t=e.currentTarget;(t.scrollTop+t.clientHeight)/t.scrollHeight>=.8&&x&&!v&&b()},loading:k,notFoundContent:k?(0,t.jsx)(s.LoadingOutlined,{spin:!0}):"No teams found","data-testid":"team-dropdown",popupRender:e=>(0,t.jsxs)(t.Fragment,{children:[e,v&&(0,t.jsx)("div",{style:{textAlign:"center",padding:8},children:(0,t.jsx)(s.LoadingOutlined,{spin:!0})})]}),children:w.map(e=>(0,t.jsxs)(n.Select.Option,{value:e.team_id,children:[(0,t.jsx)("span",{className:"font-medium",children:e.team_alias})," ",(0,t.jsxs)(d,{type:"secondary",children:["(",e.team_id,")"]})]},e.team_id))})}],663435)},743151,(e,t,r)=>{"use strict";function n(e){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}Object.defineProperty(r,"__esModule",{value:!0}),r.CopyToClipboard=void 0;var i=o(e.r(271645)),s=o(e.r(844343)),a=["text","onCopy","options","children"];function o(e){return e&&e.__esModule?e:{default:e}}function l(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function c(e){for(var t=1;t=0||(i[r]=e[r]);return i}(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(n=0;n=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(i[r]=e[r])}return i}(e,a),n=i.default.Children.only(t);return i.default.cloneElement(n,c(c({},r),{},{onClick:this.onClick}))}}],function(e,t){for(var r=0;r{"use strict";var n=e.r(743151).CopyToClipboard;n.CopyToClipboard=n,t.exports=n},59935,(e,t,r)=>{var n;let i;e.e,n=function e(){var t,r="u">typeof self?self:"u">typeof window?window:void 0!==r?r:{},n=!r.document&&!!r.postMessage,i=r.IS_PAPA_WORKER||!1,s={},a=0,o={};function l(e){this._handle=null,this._finished=!1,this._completed=!1,this._halted=!1,this._input=null,this._baseIndex=0,this._partialLine="",this._rowCount=0,this._start=0,this._nextChunk=null,this.isFirstChunk=!0,this._completeResults={data:[],errors:[],meta:{}},(function(e){var t=x(e);t.chunkSize=parseInt(t.chunkSize),e.step||e.chunk||(t.chunkSize=null),this._handle=new h(t),(this._handle.streamer=this)._config=t}).call(this,e),this.parseChunk=function(e,t){var n=parseInt(this._config.skipFirstNLines)||0;if(this.isFirstChunk&&0=this._config.preview,i)r.postMessage({results:s,workerId:o.WORKER_ID,finished:n});else if(k(this._config.chunk)&&!t){if(this._config.chunk(s,this._handle),this._handle.paused()||this._handle.aborted())return void(this._halted=!0);this._completeResults=s=void 0}return this._config.step||this._config.chunk||(this._completeResults.data=this._completeResults.data.concat(s.data),this._completeResults.errors=this._completeResults.errors.concat(s.errors),this._completeResults.meta=s.meta),this._completed||!n||!k(this._config.complete)||s&&s.meta.aborted||(this._config.complete(this._completeResults,this._input),this._completed=!0),n||s&&s.meta.paused||this._nextChunk(),s}this._halted=!0},this._sendError=function(e){k(this._config.error)?this._config.error(e):i&&this._config.error&&r.postMessage({workerId:o.WORKER_ID,error:e,finished:!1})}}function c(e){var t;(e=e||{}).chunkSize||(e.chunkSize=o.RemoteChunkSize),l.call(this,e),this._nextChunk=n?function(){this._readChunk(),this._chunkLoaded()}:function(){this._readChunk()},this.stream=function(e){this._input=e,this._nextChunk()},this._readChunk=function(){if(this._finished)this._chunkLoaded();else{if(t=new XMLHttpRequest,this._config.withCredentials&&(t.withCredentials=this._config.withCredentials),n||(t.onload=v(this._chunkLoaded,this),t.onerror=v(this._chunkError,this)),t.open(this._config.downloadRequestBody?"POST":"GET",this._input,!n),this._config.downloadRequestHeaders){var e,r,i=this._config.downloadRequestHeaders;for(r in i)t.setRequestHeader(r,i[r])}this._config.chunkSize&&(e=this._start+this._config.chunkSize-1,t.setRequestHeader("Range","bytes="+this._start+"-"+e));try{t.send(this._config.downloadRequestBody)}catch(e){this._chunkError(e.message)}n&&0===t.status&&this._chunkError()}},this._chunkLoaded=function(){let e;4===t.readyState&&(t.status<200||400<=t.status?this._chunkError():(this._start+=this._config.chunkSize||t.responseText.length,this._finished=!this._config.chunkSize||this._start>=(null!==(e=(e=t).getResponseHeader("Content-Range"))?parseInt(e.substring(e.lastIndexOf("/")+1)):-1),this.parseChunk(t.responseText)))},this._chunkError=function(e){e=t.statusText||e,this._sendError(Error(e))}}function d(e){(e=e||{}).chunkSize||(e.chunkSize=o.LocalChunkSize),l.call(this,e);var t,r,n="u">typeof FileReader;this.stream=function(e){this._input=e,r=e.slice||e.webkitSlice||e.mozSlice,n?((t=new FileReader).onload=v(this._chunkLoaded,this),t.onerror=v(this._chunkError,this)):t=new FileReaderSync,this._nextChunk()},this._nextChunk=function(){this._finished||this._config.preview&&!(this._rowCount=this._input.size,this.parseChunk(e.target.result)},this._chunkError=function(){this._sendError(t.error)}}function u(e){var t;l.call(this,e=e||{}),this.stream=function(e){return t=e,this._nextChunk()},this._nextChunk=function(){var e,r;if(!this._finished)return t=(e=this._config.chunkSize)?(r=t.substring(0,e),t.substring(e)):(r=t,""),this._finished=!t,this.parseChunk(r)}}function f(e){l.call(this,e=e||{});var t=[],r=!0,n=!1;this.pause=function(){l.prototype.pause.apply(this,arguments),this._input.pause()},this.resume=function(){l.prototype.resume.apply(this,arguments),this._input.resume()},this.stream=function(e){this._input=e,this._input.on("data",this._streamData),this._input.on("end",this._streamEnd),this._input.on("error",this._streamError)},this._checkIsFinished=function(){n&&1===t.length&&(this._finished=!0)},this._nextChunk=function(){this._checkIsFinished(),t.length?this.parseChunk(t.shift()):r=!0},this._streamData=v(function(e){try{t.push("string"==typeof e?e:e.toString(this._config.encoding)),r&&(r=!1,this._checkIsFinished(),this.parseChunk(t.shift()))}catch(e){this._streamError(e)}},this),this._streamError=v(function(e){this._streamCleanUp(),this._sendError(e)},this),this._streamEnd=v(function(){this._streamCleanUp(),n=!0,this._streamData("")},this),this._streamCleanUp=v(function(){this._input.removeListener("data",this._streamData),this._input.removeListener("end",this._streamEnd),this._input.removeListener("error",this._streamError)},this)}function h(e){var t,r,n,i,s=/^\s*-?(\d+\.?|\.\d+|\d+\.\d+)([eE][-+]?\d+)?\s*$/,a=/^((\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\.\d+([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z)))$/,l=this,c=0,d=0,u=!1,f=!1,h=[],g={data:[],errors:[],meta:{}};function y(t){return"greedy"===e.skipEmptyLines?""===t.join("").trim():1===t.length&&0===t[0].length}function b(){if(g&&n&&(w("Delimiter","UndetectableDelimiter","Unable to auto-detect delimiting character; defaulted to '"+o.DefaultDelimiter+"'"),n=!1),e.skipEmptyLines&&(g.data=g.data.filter(function(e){return!y(e)})),v()){if(g)if(Array.isArray(g.data[0])){for(var t,r=0;v()&&r(e.dynamicTypingFunction&&void 0===e.dynamicTyping[t]&&(e.dynamicTyping[t]=e.dynamicTypingFunction(t)),!0===(e.dynamicTyping[t]||e.dynamicTyping))?"true"===r||"TRUE"===r||"false"!==r&&"FALSE"!==r&&((e=>{if(s.test(e)&&-0x20000000000000<(e=parseFloat(e))&&e<0x20000000000000)return 1})(r)?parseFloat(r):a.test(r)?new Date(r):""===r?null:r):r)(o=e.header?i>=h.length?"__parsed_extra":h[i]:o,l=e.transform?e.transform(l,o):l);"__parsed_extra"===o?(n[o]=n[o]||[],n[o].push(l)):n[o]=l}return e.header&&(i>h.length?w("FieldMismatch","TooManyFields","Too many fields: expected "+h.length+" fields but parsed "+i,d+r):ie.preview?r.abort():(g.data=g.data[0],i(g,l))))}),this.parse=function(i,s,a){var l=e.quoteChar||'"',l=(e.newline||(e.newline=this.guessLineEndings(i,l)),n=!1,e.delimiter?k(e.delimiter)&&(e.delimiter=e.delimiter(i),g.meta.delimiter=e.delimiter):((l=((t,r,n,i,s)=>{var a,l,c,d;s=s||[","," ","|",";",o.RECORD_SEP,o.UNIT_SEP];for(var u=0;u=r.length/2?"\r\n":"\r"}}function p(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function m(e){var t=(e=e||{}).delimiter,r=e.newline,n=e.comments,i=e.step,s=e.preview,a=e.fastMode,l=null,c=!1,d=null==e.quoteChar?'"':e.quoteChar,u=d;if(void 0!==e.escapeChar&&(u=e.escapeChar),("string"!=typeof t||-1=s)return F(!0);break}C.push({type:"Quotes",code:"InvalidQuotes",message:"Trailing quote on quoted field is malformed",row:_.length,index:f}),T++}}else if(n&&0===j.length&&o.substring(f,f+v)===n){if(-1===$)return F();f=$+x,$=o.indexOf(r,f),N=o.indexOf(t,f)}else if(-1!==N&&(N<$||-1===$))j.push(o.substring(f,N)),f=N+b,N=o.indexOf(t,f);else{if(-1===$)break;if(j.push(o.substring(f,$)),L($+x),w&&(A(),h))return F();if(s&&_.length>=s)return F(!0)}return I();function P(e){_.push(e),S=f}function D(e){return -1!==e&&(e=o.substring(T+1,e))&&""===e.trim()?e.length:0}function I(e){return g||(void 0===e&&(e=o.substring(f)),j.push(e),f=y,P(j),w&&A()),F()}function L(e){f=e,P(j),j=[],$=o.indexOf(r,f)}function F(n){if(e.header&&!m&&_.length&&!c){var i=_[0],s=Object.create(null),a=new Set(i);let t=!1;for(let r=0;r{if("object"==typeof t){if("string"!=typeof t.delimiter||o.BAD_DELIMITERS.filter(function(e){return -1!==t.delimiter.indexOf(e)}).length||(i=t.delimiter),("boolean"==typeof t.quotes||"function"==typeof t.quotes||Array.isArray(t.quotes))&&(r=t.quotes),"boolean"!=typeof t.skipEmptyLines&&"string"!=typeof t.skipEmptyLines||(c=t.skipEmptyLines),"string"==typeof t.newline&&(s=t.newline),"string"==typeof t.quoteChar&&(a=t.quoteChar),"boolean"==typeof t.header&&(n=t.header),Array.isArray(t.columns)){if(0===t.columns.length)throw Error("Option columns is empty");d=t.columns}void 0!==t.escapeChar&&(l=t.escapeChar+a),t.escapeFormulae instanceof RegExp?u=t.escapeFormulae:"boolean"==typeof t.escapeFormulae&&t.escapeFormulae&&(u=/^[=+\-@\t\r].*$/)}})(),RegExp(p(a),"g"));if("string"==typeof e&&(e=JSON.parse(e)),Array.isArray(e)){if(!e.length||Array.isArray(e[0]))return h(null,e,c);if("object"==typeof e[0])return h(d||Object.keys(e[0]),e,c)}else if("object"==typeof e)return"string"==typeof e.data&&(e.data=JSON.parse(e.data)),Array.isArray(e.data)&&(e.fields||(e.fields=e.meta&&e.meta.fields||d),e.fields||(e.fields=Array.isArray(e.data[0])?e.fields:"object"==typeof e.data[0]?Object.keys(e.data[0]):[]),Array.isArray(e.data[0])||"object"==typeof e.data[0]||(e.data=[e.data])),h(e.fields||[],e.data||[],c);throw Error("Unable to serialize unrecognized input");function h(e,t,r){var a="",o=("string"==typeof e&&(e=JSON.parse(e)),"string"==typeof t&&(t=JSON.parse(t)),Array.isArray(e)&&0{for(var r=0;r{"use strict";function t(){for(var e,t,r=0,n="",i=arguments.length;rt,"default",0,t])},829672,836938,310730,e=>{"use strict";e.i(247167);var t=e.i(271645),r=e.i(343794),n=e.i(914949),i=e.i(404948);let o=e=>e?"function"==typeof e?e():e:null;e.s(["getRenderPropValue",0,o],836938);var l=e.i(613541),a=e.i(763731),s=e.i(242064),c=e.i(491816);e.i(793154);var d=e.i(880476),u=e.i(183293),m=e.i(717356),p=e.i(320560),g=e.i(307358),f=e.i(246422),h=e.i(838378),x=e.i(617933);let y=(0,f.genStyleHooks)("Popover",e=>{let{colorBgElevated:t,colorText:r}=e,n=(0,h.mergeToken)(e,{popoverBg:t,popoverColor:r});return[(e=>{let{componentCls:t,popoverColor:r,titleMinWidth:n,fontWeightStrong:i,innerPadding:o,boxShadowSecondary:l,colorTextHeading:a,borderRadiusLG:s,zIndexPopup:c,titleMarginBottom:d,colorBgElevated:m,popoverBg:g,titleBorderBottom:f,innerContentPadding:h,titlePadding:x}=e;return[{[t]:Object.assign(Object.assign({},(0,u.resetComponent)(e)),{position:"absolute",top:0,left:{_skip_check_:!0,value:0},zIndex:c,fontWeight:"normal",whiteSpace:"normal",textAlign:"start",cursor:"auto",userSelect:"text","--valid-offset-x":"var(--arrow-offset-horizontal, var(--arrow-x))",transformOrigin:"var(--valid-offset-x, 50%) var(--arrow-y, 50%)","--antd-arrow-background-color":m,width:"max-content",maxWidth:"100vw","&-rtl":{direction:"rtl"},"&-hidden":{display:"none"},[`${t}-content`]:{position:"relative"},[`${t}-inner`]:{backgroundColor:g,backgroundClip:"padding-box",borderRadius:s,boxShadow:l,padding:o},[`${t}-title`]:{minWidth:n,marginBottom:d,color:a,fontWeight:i,borderBottom:f,padding:x},[`${t}-inner-content`]:{color:r,padding:h}})},(0,p.default)(e,"var(--antd-arrow-background-color)"),{[`${t}-pure`]:{position:"relative",maxWidth:"none",margin:e.sizePopupArrow,display:"inline-block",[`${t}-content`]:{display:"inline-block"}}}]})(n),(e=>{let{componentCls:t}=e;return{[t]:x.PresetColors.map(r=>{let n=e[`${r}6`];return{[`&${t}-${r}`]:{"--antd-arrow-background-color":n,[`${t}-inner`]:{backgroundColor:n},[`${t}-arrow`]:{background:"transparent"}}}})}})(n),(0,m.initZoomMotion)(n,"zoom-big")]},e=>{let{lineWidth:t,controlHeight:r,fontHeight:n,padding:i,wireframe:o,zIndexPopupBase:l,borderRadiusLG:a,marginXS:s,lineType:c,colorSplit:d,paddingSM:u}=e,m=r-n;return Object.assign(Object.assign(Object.assign({titleMinWidth:177,zIndexPopup:l+30},(0,g.getArrowToken)(e)),(0,p.getArrowOffsetToken)({contentRadius:a,limitVerticalRadius:!0})),{innerPadding:12*!o,titleMarginBottom:o?0:s,titlePadding:o?`${m/2}px ${i}px ${m/2-t}px`:0,titleBorderBottom:o?`${t}px ${c} ${d}`:"none",innerContentPadding:o?`${u}px ${i}px`:0})},{resetStyle:!1,deprecatedTokens:[["width","titleMinWidth"],["minWidth","titleMinWidth"]]});var v=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&0>t.indexOf(n)&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var i=0,n=Object.getOwnPropertySymbols(e);it.indexOf(n[i])&&Object.prototype.propertyIsEnumerable.call(e,n[i])&&(r[n[i]]=e[n[i]]);return r};let b=({title:e,content:r,prefixCls:n})=>e||r?t.createElement(t.Fragment,null,e&&t.createElement("div",{className:`${n}-title`},e),r&&t.createElement("div",{className:`${n}-inner-content`},r)):null,w=e=>{let{hashId:n,prefixCls:i,className:l,style:a,placement:s="top",title:c,content:u,children:m}=e,p=o(c),g=o(u),f=(0,r.default)(n,i,`${i}-pure`,`${i}-placement-${s}`,l);return t.createElement("div",{className:f,style:a},t.createElement("div",{className:`${i}-arrow`}),t.createElement(d.Popup,Object.assign({},e,{className:n,prefixCls:i}),m||t.createElement(b,{prefixCls:i,title:p,content:g})))},j=e=>{let{prefixCls:n,className:i}=e,o=v(e,["prefixCls","className"]),{getPrefixCls:l}=t.useContext(s.ConfigContext),a=l("popover",n),[c,d,u]=y(a);return c(t.createElement(w,Object.assign({},o,{prefixCls:a,hashId:d,className:(0,r.default)(i,u)})))};e.s(["Overlay",0,b,"default",0,j],310730);var S=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&0>t.indexOf(n)&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var i=0,n=Object.getOwnPropertySymbols(e);it.indexOf(n[i])&&Object.prototype.propertyIsEnumerable.call(e,n[i])&&(r[n[i]]=e[n[i]]);return r};let k=t.forwardRef((e,d)=>{var u,m;let{prefixCls:p,title:g,content:f,overlayClassName:h,placement:x="top",trigger:v="hover",children:w,mouseEnterDelay:j=.1,mouseLeaveDelay:k=.1,onOpenChange:C,overlayStyle:O={},styles:N,classNames:_}=e,I=S(e,["prefixCls","title","content","overlayClassName","placement","trigger","children","mouseEnterDelay","mouseLeaveDelay","onOpenChange","overlayStyle","styles","classNames"]),{getPrefixCls:L,className:E,style:P,classNames:U,styles:$}=(0,s.useComponentConfig)("popover"),T=L("popover",p),[A,z,W]=y(T),R=L(),B=(0,r.default)(h,z,W,E,U.root,null==_?void 0:_.root),M=(0,r.default)(U.body,null==_?void 0:_.body),[F,D]=(0,n.default)(!1,{value:null!=(u=e.open)?u:e.visible,defaultValue:null!=(m=e.defaultOpen)?m:e.defaultVisible}),V=(e,t)=>{D(e,!0),null==C||C(e,t)},K=o(g),H=o(f);return A(t.createElement(c.default,Object.assign({placement:x,trigger:v,mouseEnterDelay:j,mouseLeaveDelay:k},I,{prefixCls:T,classNames:{root:B,body:M},styles:{root:Object.assign(Object.assign(Object.assign(Object.assign({},$.root),P),O),null==N?void 0:N.root),body:Object.assign(Object.assign({},$.body),null==N?void 0:N.body)},ref:d,open:F,onOpenChange:e=>{V(e)},overlay:K||H?t.createElement(b,{prefixCls:T,title:K,content:H}):null,transitionName:(0,l.getTransitionName)(R,"zoom-big",I.transitionName),"data-popover-inject":!0}),(0,a.cloneElement)(w,{onKeyDown:e=>{var r,n;(0,t.isValidElement)(w)&&(null==(n=null==w?void 0:(r=w.props).onKeyDown)||n.call(r,e)),e.keyCode===i.default.ESC&&V(!1,e)}})))});k._InternalPanelDoNotUseOrYouWillBeFired=j,e.s(["default",0,k],829672)},282786,e=>{"use strict";var t=e.i(829672);e.s(["Popover",()=>t.default])},295320,283713,e=>{"use strict";e.i(247167);var t=e.i(931067),r=e.i(271645);let n={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M704 446H320c-4.4 0-8 3.6-8 8v402c0 4.4 3.6 8 8 8h384c4.4 0 8-3.6 8-8V454c0-4.4-3.6-8-8-8zm-328 64h272v117H376V510zm272 290H376V683h272v117z"}},{tag:"path",attrs:{d:"M424 748a32 32 0 1064 0 32 32 0 10-64 0zm0-178a32 32 0 1064 0 32 32 0 10-64 0z"}},{tag:"path",attrs:{d:"M811.4 368.9C765.6 248 648.9 162 512.2 162S258.8 247.9 213 368.8C126.9 391.5 63.5 470.2 64 563.6 64.6 668 145.6 752.9 247.6 762c4.7.4 8.7-3.3 8.7-8v-60.4c0-4-3-7.4-7-7.9-27-3.4-52.5-15.2-72.1-34.5-24-23.5-37.2-55.1-37.2-88.6 0-28 9.1-54.4 26.2-76.4 16.7-21.4 40.2-36.9 66.1-43.7l37.9-10 13.9-36.7c8.6-22.8 20.6-44.2 35.7-63.5 14.9-19.2 32.6-36 52.4-50 41.1-28.9 89.5-44.2 140-44.2s98.9 15.3 140 44.3c19.9 14 37.5 30.8 52.4 50 15.1 19.3 27.1 40.7 35.7 63.5l13.8 36.6 37.8 10c54.2 14.4 92.1 63.7 92.1 120 0 33.6-13.2 65.1-37.2 88.6-19.5 19.2-44.9 31.1-71.9 34.5-4 .5-6.9 3.9-6.9 7.9V754c0 4.7 4.1 8.4 8.8 8 101.7-9.2 182.5-94 183.2-198.2.6-93.4-62.7-172.1-148.6-194.9z"}}]},name:"cloud-server",theme:"outlined"};var i=e.i(9583),o=r.forwardRef(function(e,o){return r.createElement(i.default,(0,t.default)({},e,{ref:o,icon:n}))});e.s(["CloudServerOutlined",0,o],295320);var l=e.i(764205),a=e.i(612256);let s="litellm_selected_worker_id";e.s(["useWorker",0,()=>{let{data:e}=(0,a.useUIConfig)(),t=e?.is_control_plane??!1,n=e?.workers??[],[i,o]=(0,r.useState)(()=>localStorage.getItem(s));(0,r.useEffect)(()=>{if(!i||0===n.length)return;let e=n.find(e=>e.worker_id===i);e&&(0,l.switchToWorkerUrl)(e.url)},[i,n]);let c=n.find(e=>e.worker_id===i)??null,d=(0,r.useCallback)(e=>{let t=n.find(t=>t.worker_id===e);t&&(o(e),localStorage.setItem(s,e),(0,l.switchToWorkerUrl)(t.url))},[n]);return{isControlPlane:t,workers:n,selectedWorkerId:i,selectedWorker:c,selectWorker:d,disconnectFromWorker:(0,r.useCallback)(()=>{o(null),localStorage.removeItem(s),(0,l.switchToWorkerUrl)(null)},[])}}],283713)},571303,e=>{"use strict";var t=e.i(843476),r=e.i(271645),n=e.i(115504);function i({className:e="",...i}){var o,l;let a=(0,r.useId)();return o=()=>{let e=document.getAnimations().filter(e=>e instanceof CSSAnimation&&"spin"===e.animationName),t=e.find(e=>e.effect.target?.getAttribute("data-spinner-id")===a),r=e.find(e=>e.effect instanceof KeyframeEffect&&e.effect.target?.getAttribute("data-spinner-id")!==a);t&&r&&(t.currentTime=r.currentTime)},l=[a],(0,r.useLayoutEffect)(o,l),(0,t.jsxs)("svg",{"data-spinner-id":a,className:(0,n.cx)("pointer-events-none size-12 animate-spin text-current",e),fill:"none",viewBox:"0 0 24 24",...i,children:[(0,t.jsx)("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),(0,t.jsx)("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]})}e.s(["UiLoadingSpinner",()=>i],571303)},936578,e=>{"use strict";var t=e.i(843476),r=e.i(115504),n=e.i(571303);function i(){return(0,t.jsxs)("div",{className:(0,r.cx)("h-screen","flex items-center justify-center gap-4"),children:[(0,t.jsx)("div",{className:"text-lg font-medium py-2 pr-4 border-r border-r-gray-200",children:"🚅 LiteLLM"}),(0,t.jsxs)("div",{className:"flex items-center justify-center gap-2",children:[(0,t.jsx)(n.UiLoadingSpinner,{className:"size-4"}),(0,t.jsx)("span",{className:"text-gray-600 text-sm",children:"Loading..."})]})]})}e.s(["default",()=>i])},594542,e=>{"use strict";var t=e.i(843476),r=e.i(954616),n=e.i(764205),i=e.i(612256),o=e.i(936578),l=e.i(268004),a=e.i(161281),s=e.i(321836),c=e.i(827252),d=e.i(295320),u=e.i(560445),m=e.i(464571),p=e.i(175712),g=e.i(808613),f=e.i(311451),h=e.i(282786),x=e.i(199133),y=e.i(770914),v=e.i(898586),b=e.i(618566),w=e.i(271645),j=e.i(283713);function S(){let[e,S]=(0,w.useState)(""),[k,C]=(0,w.useState)(""),[O,N]=(0,w.useState)(!0),{data:_,isLoading:I}=(0,i.useUIConfig)(),L=(0,r.useMutation)({mutationFn:async({username:e,password:t,useV3:r})=>await (0,n.loginCall)(e,t,r)}),E=(0,b.useRouter)(),{workers:P,selectWorker:U}=(0,j.useWorker)(),[$,T]=(0,w.useState)(null);(0,w.useEffect)(()=>{let e=new URLSearchParams(window.location.search).get("worker");e&&T(e)},[]),(0,w.useEffect)(()=>{if(I)return;if(_&&_.admin_ui_disabled)return void N(!1);let e=new URLSearchParams(window.location.search),t=e.get("code");if(t){let r=localStorage.getItem("litellm_worker_url");(0,n.exchangeLoginCode)(t,r).then(()=>{e.delete("code");let t=e.toString();window.history.replaceState(null,"",window.location.pathname+(t?`?${t}`:"")),E.replace("/ui/?login=success")});return}let r=e.get("token");if(r&&!(0,a.isJwtExpired)(r)){document.cookie=`token=${r}; path=/; SameSite=Lax`,e.delete("token");let t=e.toString();window.history.replaceState(null,"",window.location.pathname+(t?`?${t}`:"")),E.replace("/ui/?login=success");return}if(e.has("worker")&&_?.is_control_plane){(0,l.clearTokenCookies)(),N(!1);return}let i=(0,l.getCookie)("token");if(i&&!(0,a.isJwtExpired)(i)){let e=(0,s.consumeReturnUrl)();e?E.replace(e):E.replace("/ui");return}if(_&&_.auto_redirect_to_sso){let e=(0,s.getReturnUrl)(),t=`${(0,n.getProxyBaseUrl)()}/sso/key/generate`;e&&(0,s.isValidReturnUrl)(e)&&(t+=`?redirect_to=${encodeURIComponent(e)}`),E.push(t);return}N(!1)},[I,E,_]);let A=L.error instanceof Error?L.error.message:null,z=L.isPending,{Title:W,Text:R,Paragraph:B}=v.Typography;return I||O?(0,t.jsx)(o.default,{}):_&&_.admin_ui_disabled?(0,t.jsx)("div",{className:"min-h-screen flex items-center justify-center bg-gray-50",children:(0,t.jsx)(p.Card,{className:"w-full max-w-lg shadow-md",children:(0,t.jsxs)(y.Space,{direction:"vertical",size:"middle",className:"w-full",children:[(0,t.jsx)("div",{className:"text-center",children:(0,t.jsx)(W,{level:2,children:"🚅 LiteLLM"})}),(0,t.jsx)(u.Alert,{message:"Admin UI Disabled",description:(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(B,{className:"text-sm",children:"The Admin UI has been disabled by the administrator. To re-enable it, please update the following environment variable:"}),(0,t.jsx)(B,{className:"text-sm",children:(0,t.jsx)("code",{className:"bg-gray-100 px-1 py-0.5 rounded text-xs",children:"DISABLE_ADMIN_UI=False"})})]}),type:"warning",showIcon:!0})]})})}):(0,t.jsx)("div",{className:"min-h-screen flex items-center justify-center bg-gray-50",children:(0,t.jsxs)(p.Card,{className:"w-full max-w-lg shadow-md",children:[(0,t.jsxs)(y.Space,{direction:"vertical",size:"middle",className:"w-full",children:[(0,t.jsx)("div",{className:"text-center",children:(0,t.jsx)(W,{level:2,children:"🚅 LiteLLM"})}),(0,t.jsxs)("div",{className:"text-center",children:[(0,t.jsx)(W,{level:3,children:"Login"}),(0,t.jsx)(R,{type:"secondary",children:"Access your LiteLLM Admin UI."})]}),(0,t.jsx)(u.Alert,{message:"Default Credentials",description:(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(B,{className:"text-sm",children:["By default, Username is ",(0,t.jsx)("code",{className:"bg-gray-100 px-1 py-0.5 rounded text-xs",children:"admin"})," and Password is your set LiteLLM Proxy",(0,t.jsx)("code",{className:"bg-gray-100 px-1 py-0.5 rounded text-xs",children:"MASTER_KEY"}),"."]}),(0,t.jsxs)(B,{className:"text-sm",children:["Need to set UI credentials or SSO?"," ",(0,t.jsx)("a",{href:"https://docs.litellm.ai/docs/proxy/ui",target:"_blank",rel:"noopener noreferrer",children:"Check the documentation"}),"."]})]}),type:"info",icon:(0,t.jsx)(c.InfoCircleOutlined,{}),showIcon:!0}),A&&(0,t.jsx)(u.Alert,{message:A,type:"error",showIcon:!0}),(0,t.jsxs)(g.Form,{onFinish:()=>{let t=P.find(e=>e.worker_id===$);t&&(0,n.switchToWorkerUrl)(t.url),L.mutate({username:e,password:k,useV3:!!t},{onSuccess:e=>{if(t)U(t.worker_id),E.push("/ui/?login=success");else{let t=(0,s.consumeReturnUrl)();t?E.push(t):E.push(e.redirect_url)}},onError:()=>{t&&(0,n.switchToWorkerUrl)(null)}})},layout:"vertical",requiredMark:!1,children:[_?.is_control_plane&&P.length>0&&(0,t.jsx)(g.Form.Item,{label:"Worker",style:{marginBottom:16},children:(0,t.jsx)(x.Select,{value:$||void 0,onChange:e=>T(e),placeholder:"Choose a worker to connect to",size:"large",suffixIcon:(0,t.jsx)(d.CloudServerOutlined,{}),options:P.map(e=>({label:e.name,value:e.worker_id}))})}),(0,t.jsx)(g.Form.Item,{label:"Username",name:"username",rules:[{required:!0,message:"Please enter your username"}],children:(0,t.jsx)(f.Input,{placeholder:"Enter your username",autoComplete:"username",value:e,onChange:e=>S(e.target.value),disabled:z,size:"large",className:"rounded-md border-gray-300"})}),(0,t.jsx)(g.Form.Item,{label:"Password",name:"password",rules:[{required:!0,message:"Please enter your password"}],children:(0,t.jsx)(f.Input.Password,{placeholder:"Enter your password",autoComplete:"current-password",value:k,onChange:e=>C(e.target.value),disabled:z,size:"large"})}),(0,t.jsx)(g.Form.Item,{children:(0,t.jsx)(m.Button,{type:"primary",htmlType:"submit",loading:z,disabled:z,block:!0,size:"large",children:z?"Logging in...":"Login"})}),(0,t.jsx)(g.Form.Item,{children:_?.sso_configured?(0,t.jsx)(m.Button,{disabled:z||!!$&&0===P.length,onClick:()=>{let e=P.find(e=>e.worker_id===$);e&&(localStorage.setItem("litellm_selected_worker_id",$),(0,n.switchToWorkerUrl)(e.url));let t=e?.url??(0,n.getProxyBaseUrl)(),r=encodeURIComponent(window.location.origin+"/ui/login");E.push(`${t}/sso/key/generate?return_to=${r}`)},block:!0,size:"large",children:"Login with SSO"}):(0,t.jsx)(h.Popover,{content:"Please configure SSO to log in with SSO.",trigger:"hover",children:(0,t.jsx)(m.Button,{disabled:!0,block:!0,size:"large",children:"Login with SSO"})})})]})]}),_?.sso_configured&&(0,t.jsx)(u.Alert,{type:"info",showIcon:!0,closable:!0,message:(0,t.jsxs)(R,{children:["Single Sign-On (SSO) is enabled. LiteLLM no longer automatically redirects to the SSO login flow upon loading this page. To re-enable auto-redirect-to-SSO, set ",(0,t.jsx)(R,{code:!0,children:"AUTO_REDIRECT_UI_LOGIN_TO_SSO=true"})," in your environment configuration."]})})]})})}e.s(["default",0,function(){return(0,t.jsx)(S,{})}],594542)}]); \ No newline at end of file +(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,207670,e=>{"use strict";function t(){for(var e,t,r=0,n="",i=arguments.length;rt,"default",0,t])},829672,836938,310730,e=>{"use strict";e.i(247167);var t=e.i(271645),r=e.i(343794),n=e.i(914949),i=e.i(404948);let o=e=>e?"function"==typeof e?e():e:null;e.s(["getRenderPropValue",0,o],836938);var l=e.i(613541),a=e.i(763731),s=e.i(242064),c=e.i(491816);e.i(793154);var d=e.i(880476),u=e.i(183293),m=e.i(717356),p=e.i(320560),g=e.i(307358),f=e.i(246422),h=e.i(838378),x=e.i(617933);let y=(0,f.genStyleHooks)("Popover",e=>{let{colorBgElevated:t,colorText:r}=e,n=(0,h.mergeToken)(e,{popoverBg:t,popoverColor:r});return[(e=>{let{componentCls:t,popoverColor:r,titleMinWidth:n,fontWeightStrong:i,innerPadding:o,boxShadowSecondary:l,colorTextHeading:a,borderRadiusLG:s,zIndexPopup:c,titleMarginBottom:d,colorBgElevated:m,popoverBg:g,titleBorderBottom:f,innerContentPadding:h,titlePadding:x}=e;return[{[t]:Object.assign(Object.assign({},(0,u.resetComponent)(e)),{position:"absolute",top:0,left:{_skip_check_:!0,value:0},zIndex:c,fontWeight:"normal",whiteSpace:"normal",textAlign:"start",cursor:"auto",userSelect:"text","--valid-offset-x":"var(--arrow-offset-horizontal, var(--arrow-x))",transformOrigin:"var(--valid-offset-x, 50%) var(--arrow-y, 50%)","--antd-arrow-background-color":m,width:"max-content",maxWidth:"100vw","&-rtl":{direction:"rtl"},"&-hidden":{display:"none"},[`${t}-content`]:{position:"relative"},[`${t}-inner`]:{backgroundColor:g,backgroundClip:"padding-box",borderRadius:s,boxShadow:l,padding:o},[`${t}-title`]:{minWidth:n,marginBottom:d,color:a,fontWeight:i,borderBottom:f,padding:x},[`${t}-inner-content`]:{color:r,padding:h}})},(0,p.default)(e,"var(--antd-arrow-background-color)"),{[`${t}-pure`]:{position:"relative",maxWidth:"none",margin:e.sizePopupArrow,display:"inline-block",[`${t}-content`]:{display:"inline-block"}}}]})(n),(e=>{let{componentCls:t}=e;return{[t]:x.PresetColors.map(r=>{let n=e[`${r}6`];return{[`&${t}-${r}`]:{"--antd-arrow-background-color":n,[`${t}-inner`]:{backgroundColor:n},[`${t}-arrow`]:{background:"transparent"}}}})}})(n),(0,m.initZoomMotion)(n,"zoom-big")]},e=>{let{lineWidth:t,controlHeight:r,fontHeight:n,padding:i,wireframe:o,zIndexPopupBase:l,borderRadiusLG:a,marginXS:s,lineType:c,colorSplit:d,paddingSM:u}=e,m=r-n;return Object.assign(Object.assign(Object.assign({titleMinWidth:177,zIndexPopup:l+30},(0,g.getArrowToken)(e)),(0,p.getArrowOffsetToken)({contentRadius:a,limitVerticalRadius:!0})),{innerPadding:12*!o,titleMarginBottom:o?0:s,titlePadding:o?`${m/2}px ${i}px ${m/2-t}px`:0,titleBorderBottom:o?`${t}px ${c} ${d}`:"none",innerContentPadding:o?`${u}px ${i}px`:0})},{resetStyle:!1,deprecatedTokens:[["width","titleMinWidth"],["minWidth","titleMinWidth"]]});var v=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&0>t.indexOf(n)&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var i=0,n=Object.getOwnPropertySymbols(e);it.indexOf(n[i])&&Object.prototype.propertyIsEnumerable.call(e,n[i])&&(r[n[i]]=e[n[i]]);return r};let b=({title:e,content:r,prefixCls:n})=>e||r?t.createElement(t.Fragment,null,e&&t.createElement("div",{className:`${n}-title`},e),r&&t.createElement("div",{className:`${n}-inner-content`},r)):null,w=e=>{let{hashId:n,prefixCls:i,className:l,style:a,placement:s="top",title:c,content:u,children:m}=e,p=o(c),g=o(u),f=(0,r.default)(n,i,`${i}-pure`,`${i}-placement-${s}`,l);return t.createElement("div",{className:f,style:a},t.createElement("div",{className:`${i}-arrow`}),t.createElement(d.Popup,Object.assign({},e,{className:n,prefixCls:i}),m||t.createElement(b,{prefixCls:i,title:p,content:g})))},j=e=>{let{prefixCls:n,className:i}=e,o=v(e,["prefixCls","className"]),{getPrefixCls:l}=t.useContext(s.ConfigContext),a=l("popover",n),[c,d,u]=y(a);return c(t.createElement(w,Object.assign({},o,{prefixCls:a,hashId:d,className:(0,r.default)(i,u)})))};e.s(["Overlay",0,b,"default",0,j],310730);var S=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&0>t.indexOf(n)&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var i=0,n=Object.getOwnPropertySymbols(e);it.indexOf(n[i])&&Object.prototype.propertyIsEnumerable.call(e,n[i])&&(r[n[i]]=e[n[i]]);return r};let k=t.forwardRef((e,d)=>{var u,m;let{prefixCls:p,title:g,content:f,overlayClassName:h,placement:x="top",trigger:v="hover",children:w,mouseEnterDelay:j=.1,mouseLeaveDelay:k=.1,onOpenChange:C,overlayStyle:O={},styles:_,classNames:N}=e,I=S(e,["prefixCls","title","content","overlayClassName","placement","trigger","children","mouseEnterDelay","mouseLeaveDelay","onOpenChange","overlayStyle","styles","classNames"]),{getPrefixCls:L,className:E,style:$,classNames:P,styles:U}=(0,s.useComponentConfig)("popover"),T=L("popover",p),[A,z,W]=y(T),R=L(),B=(0,r.default)(h,z,W,E,P.root,null==N?void 0:N.root),M=(0,r.default)(P.body,null==N?void 0:N.body),[F,D]=(0,n.default)(!1,{value:null!=(u=e.open)?u:e.visible,defaultValue:null!=(m=e.defaultOpen)?m:e.defaultVisible}),V=(e,t)=>{D(e,!0),null==C||C(e,t)},K=o(g),H=o(f);return A(t.createElement(c.default,Object.assign({placement:x,trigger:v,mouseEnterDelay:j,mouseLeaveDelay:k},I,{prefixCls:T,classNames:{root:B,body:M},styles:{root:Object.assign(Object.assign(Object.assign(Object.assign({},U.root),$),O),null==_?void 0:_.root),body:Object.assign(Object.assign({},U.body),null==_?void 0:_.body)},ref:d,open:F,onOpenChange:e=>{V(e)},overlay:K||H?t.createElement(b,{prefixCls:T,title:K,content:H}):null,transitionName:(0,l.getTransitionName)(R,"zoom-big",I.transitionName),"data-popover-inject":!0}),(0,a.cloneElement)(w,{onKeyDown:e=>{var r,n;(0,t.isValidElement)(w)&&(null==(n=null==w?void 0:(r=w.props).onKeyDown)||n.call(r,e)),e.keyCode===i.default.ESC&&V(!1,e)}})))});k._InternalPanelDoNotUseOrYouWillBeFired=j,e.s(["default",0,k],829672)},282786,e=>{"use strict";var t=e.i(829672);e.s(["Popover",()=>t.default])},295320,283713,e=>{"use strict";e.i(247167);var t=e.i(931067),r=e.i(271645);let n={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M704 446H320c-4.4 0-8 3.6-8 8v402c0 4.4 3.6 8 8 8h384c4.4 0 8-3.6 8-8V454c0-4.4-3.6-8-8-8zm-328 64h272v117H376V510zm272 290H376V683h272v117z"}},{tag:"path",attrs:{d:"M424 748a32 32 0 1064 0 32 32 0 10-64 0zm0-178a32 32 0 1064 0 32 32 0 10-64 0z"}},{tag:"path",attrs:{d:"M811.4 368.9C765.6 248 648.9 162 512.2 162S258.8 247.9 213 368.8C126.9 391.5 63.5 470.2 64 563.6 64.6 668 145.6 752.9 247.6 762c4.7.4 8.7-3.3 8.7-8v-60.4c0-4-3-7.4-7-7.9-27-3.4-52.5-15.2-72.1-34.5-24-23.5-37.2-55.1-37.2-88.6 0-28 9.1-54.4 26.2-76.4 16.7-21.4 40.2-36.9 66.1-43.7l37.9-10 13.9-36.7c8.6-22.8 20.6-44.2 35.7-63.5 14.9-19.2 32.6-36 52.4-50 41.1-28.9 89.5-44.2 140-44.2s98.9 15.3 140 44.3c19.9 14 37.5 30.8 52.4 50 15.1 19.3 27.1 40.7 35.7 63.5l13.8 36.6 37.8 10c54.2 14.4 92.1 63.7 92.1 120 0 33.6-13.2 65.1-37.2 88.6-19.5 19.2-44.9 31.1-71.9 34.5-4 .5-6.9 3.9-6.9 7.9V754c0 4.7 4.1 8.4 8.8 8 101.7-9.2 182.5-94 183.2-198.2.6-93.4-62.7-172.1-148.6-194.9z"}}]},name:"cloud-server",theme:"outlined"};var i=e.i(9583),o=r.forwardRef(function(e,o){return r.createElement(i.default,(0,t.default)({},e,{ref:o,icon:n}))});e.s(["CloudServerOutlined",0,o],295320);var l=e.i(764205),a=e.i(612256);let s="litellm_selected_worker_id";e.s(["useWorker",0,()=>{let{data:e}=(0,a.useUIConfig)(),t=e?.is_control_plane??!1,n=e?.workers??[],[i,o]=(0,r.useState)(()=>localStorage.getItem(s));(0,r.useEffect)(()=>{if(!i||0===n.length)return;let e=n.find(e=>e.worker_id===i);e&&(0,l.switchToWorkerUrl)(e.url)},[i,n]);let c=n.find(e=>e.worker_id===i)??null,d=(0,r.useCallback)(e=>{let t=n.find(t=>t.worker_id===e);t&&(o(e),localStorage.setItem(s,e),(0,l.switchToWorkerUrl)(t.url))},[n]);return{isControlPlane:t,workers:n,selectedWorkerId:i,selectedWorker:c,selectWorker:d,disconnectFromWorker:(0,r.useCallback)(()=>{o(null),localStorage.removeItem(s),(0,l.switchToWorkerUrl)(null)},[])}}],283713)},571303,e=>{"use strict";var t=e.i(843476),r=e.i(271645),n=e.i(115504);function i({className:e="",...i}){var o,l;let a=(0,r.useId)();return o=()=>{let e=document.getAnimations().filter(e=>e instanceof CSSAnimation&&"spin"===e.animationName),t=e.find(e=>e.effect.target?.getAttribute("data-spinner-id")===a),r=e.find(e=>e.effect instanceof KeyframeEffect&&e.effect.target?.getAttribute("data-spinner-id")!==a);t&&r&&(t.currentTime=r.currentTime)},l=[a],(0,r.useLayoutEffect)(o,l),(0,t.jsxs)("svg",{"data-spinner-id":a,className:(0,n.cx)("pointer-events-none size-12 animate-spin text-current",e),fill:"none",viewBox:"0 0 24 24",...i,children:[(0,t.jsx)("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),(0,t.jsx)("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]})}e.s(["UiLoadingSpinner",()=>i],571303)},936578,e=>{"use strict";var t=e.i(843476),r=e.i(115504),n=e.i(571303);function i(){return(0,t.jsxs)("div",{className:(0,r.cx)("h-screen","flex items-center justify-center gap-4"),children:[(0,t.jsx)("div",{className:"text-lg font-medium py-2 pr-4 border-r border-r-gray-200",children:"🚅 LiteLLM"}),(0,t.jsxs)("div",{className:"flex items-center justify-center gap-2",children:[(0,t.jsx)(n.UiLoadingSpinner,{className:"size-4"}),(0,t.jsx)("span",{className:"text-gray-600 text-sm",children:"Loading..."})]})]})}e.s(["default",()=>i])},594542,e=>{"use strict";var t=e.i(843476),r=e.i(954616),n=e.i(764205),i=e.i(612256),o=e.i(936578),l=e.i(268004),a=e.i(161281),s=e.i(321836),c=e.i(827252),d=e.i(295320),u=e.i(560445),m=e.i(464571),p=e.i(175712),g=e.i(808613),f=e.i(311451),h=e.i(282786),x=e.i(199133),y=e.i(770914),v=e.i(898586),b=e.i(618566),w=e.i(271645),j=e.i(283713);function S(){let[e,S]=(0,w.useState)(""),[k,C]=(0,w.useState)(""),[O,_]=(0,w.useState)(!0),{data:N,isLoading:I}=(0,i.useUIConfig)(),L=(0,r.useMutation)({mutationFn:async({username:e,password:t,useV3:r})=>await (0,n.loginCall)(e,t,r)}),E=(0,b.useRouter)(),{workers:$,selectWorker:P}=(0,j.useWorker)(),[U,T]=(0,w.useState)(null);(0,w.useEffect)(()=>{let e=new URLSearchParams(window.location.search).get("worker");e&&T(e)},[]),(0,w.useEffect)(()=>{if(I)return;if(N&&N.admin_ui_disabled)return void _(!1);let e=new URLSearchParams(window.location.search),t=e.get("code"),r=t&&/^[a-zA-Z0-9._~+/=-]+$/.test(t)?t:null;if(r){let t=localStorage.getItem("litellm_worker_url"),i=t&&/^https?:\/\/.+/.test(t)?t:null;(0,n.exchangeLoginCode)(r,i).then(()=>{e.delete("code");let t=e.toString();window.history.replaceState(null,"",window.location.pathname+(t?`?${t}`:"")),E.replace("/ui/?login=success")});return}let i=e.get("token");if(i&&!(0,a.isJwtExpired)(i)){document.cookie=`token=${i}; path=/; SameSite=Lax`,e.delete("token");let t=e.toString();window.history.replaceState(null,"",window.location.pathname+(t?`?${t}`:"")),E.replace("/ui/?login=success");return}if(e.has("worker")&&N?.is_control_plane){(0,l.clearTokenCookies)(),_(!1);return}let o=(0,l.getCookie)("token");if(o&&!(0,a.isJwtExpired)(o)){let e=(0,s.consumeReturnUrl)();e?E.replace(e):E.replace("/ui");return}if(N&&N.auto_redirect_to_sso){let e=(0,s.getReturnUrl)(),t=`${(0,n.getProxyBaseUrl)()}/sso/key/generate`;e&&(0,s.isValidReturnUrl)(e)&&(t+=`?redirect_to=${encodeURIComponent(e)}`),E.push(t);return}_(!1)},[I,E,N]);let A=L.error instanceof Error?L.error.message:null,z=L.isPending,{Title:W,Text:R,Paragraph:B}=v.Typography;return I||O?(0,t.jsx)(o.default,{}):N&&N.admin_ui_disabled?(0,t.jsx)("div",{className:"min-h-screen flex items-center justify-center bg-gray-50",children:(0,t.jsx)(p.Card,{className:"w-full max-w-lg shadow-md",children:(0,t.jsxs)(y.Space,{direction:"vertical",size:"middle",className:"w-full",children:[(0,t.jsx)("div",{className:"text-center",children:(0,t.jsx)(W,{level:2,children:"🚅 LiteLLM"})}),(0,t.jsx)(u.Alert,{message:"Admin UI Disabled",description:(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(B,{className:"text-sm",children:"The Admin UI has been disabled by the administrator. To re-enable it, please update the following environment variable:"}),(0,t.jsx)(B,{className:"text-sm",children:(0,t.jsx)("code",{className:"bg-gray-100 px-1 py-0.5 rounded text-xs",children:"DISABLE_ADMIN_UI=False"})})]}),type:"warning",showIcon:!0})]})})}):(0,t.jsx)("div",{className:"min-h-screen flex items-center justify-center bg-gray-50",children:(0,t.jsxs)(p.Card,{className:"w-full max-w-lg shadow-md",children:[(0,t.jsxs)(y.Space,{direction:"vertical",size:"middle",className:"w-full",children:[(0,t.jsx)("div",{className:"text-center",children:(0,t.jsx)(W,{level:2,children:"🚅 LiteLLM"})}),(0,t.jsxs)("div",{className:"text-center",children:[(0,t.jsx)(W,{level:3,children:"Login"}),(0,t.jsx)(R,{type:"secondary",children:"Access your LiteLLM Admin UI."})]}),(0,t.jsx)(u.Alert,{message:"Default Credentials",description:(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(B,{className:"text-sm",children:["By default, Username is ",(0,t.jsx)("code",{className:"bg-gray-100 px-1 py-0.5 rounded text-xs",children:"admin"})," and Password is your set LiteLLM Proxy",(0,t.jsx)("code",{className:"bg-gray-100 px-1 py-0.5 rounded text-xs",children:"MASTER_KEY"}),"."]}),(0,t.jsxs)(B,{className:"text-sm",children:["Need to set UI credentials or SSO?"," ",(0,t.jsx)("a",{href:"https://docs.litellm.ai/docs/proxy/ui",target:"_blank",rel:"noopener noreferrer",children:"Check the documentation"}),"."]})]}),type:"info",icon:(0,t.jsx)(c.InfoCircleOutlined,{}),showIcon:!0}),A&&(0,t.jsx)(u.Alert,{message:A,type:"error",showIcon:!0}),(0,t.jsxs)(g.Form,{onFinish:()=>{let t=$.find(e=>e.worker_id===U);t&&(0,n.switchToWorkerUrl)(t.url),L.mutate({username:e,password:k,useV3:!!t},{onSuccess:e=>{if(t)P(t.worker_id),E.push("/ui/?login=success");else{let t=(0,s.consumeReturnUrl)();t?E.push(t):E.push(e.redirect_url)}},onError:()=>{t&&(0,n.switchToWorkerUrl)(null)}})},layout:"vertical",requiredMark:!1,children:[N?.is_control_plane&&$.length>0&&(0,t.jsx)(g.Form.Item,{label:"Worker",style:{marginBottom:16},children:(0,t.jsx)(x.Select,{value:U||void 0,onChange:e=>T(e),placeholder:"Choose a worker to connect to",size:"large",suffixIcon:(0,t.jsx)(d.CloudServerOutlined,{}),options:$.map(e=>({label:e.name,value:e.worker_id}))})}),(0,t.jsx)(g.Form.Item,{label:"Username",name:"username",rules:[{required:!0,message:"Please enter your username"}],children:(0,t.jsx)(f.Input,{placeholder:"Enter your username",autoComplete:"username",value:e,onChange:e=>S(e.target.value),disabled:z,size:"large",className:"rounded-md border-gray-300"})}),(0,t.jsx)(g.Form.Item,{label:"Password",name:"password",rules:[{required:!0,message:"Please enter your password"}],children:(0,t.jsx)(f.Input.Password,{placeholder:"Enter your password",autoComplete:"current-password",value:k,onChange:e=>C(e.target.value),disabled:z,size:"large"})}),(0,t.jsx)(g.Form.Item,{children:(0,t.jsx)(m.Button,{type:"primary",htmlType:"submit",loading:z,disabled:z,block:!0,size:"large",children:z?"Logging in...":"Login"})}),(0,t.jsx)(g.Form.Item,{children:N?.sso_configured?(0,t.jsx)(m.Button,{disabled:z||!!U&&0===$.length,onClick:()=>{let e=$.find(e=>e.worker_id===U);e&&(localStorage.setItem("litellm_selected_worker_id",U),(0,n.switchToWorkerUrl)(e.url));let t=e?.url??(0,n.getProxyBaseUrl)(),r=encodeURIComponent(window.location.origin+"/ui/login");E.push(`${t}/sso/key/generate?return_to=${r}`)},block:!0,size:"large",children:"Login with SSO"}):(0,t.jsx)(h.Popover,{content:"Please configure SSO to log in with SSO.",trigger:"hover",children:(0,t.jsx)(m.Button,{disabled:!0,block:!0,size:"large",children:"Login with SSO"})})})]})]}),N?.sso_configured&&(0,t.jsx)(u.Alert,{type:"info",showIcon:!0,closable:!0,message:(0,t.jsxs)(R,{children:["Single Sign-On (SSO) is enabled. LiteLLM no longer automatically redirects to the SSO login flow upon loading this page. To re-enable auto-redirect-to-SSO, set ",(0,t.jsx)(R,{code:!0,children:"AUTO_REDIRECT_UI_LOGIN_TO_SSO=true"})," in your environment configuration."]})})]})})}e.s(["default",0,function(){return(0,t.jsx)(S,{})}],594542)}]); \ No newline at end of file diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/6af2d8fb8cb64938.js b/litellm/proxy/_experimental/out/_next/static/chunks/6af2d8fb8cb64938.js deleted file mode 100644 index f55e535f50..0000000000 --- a/litellm/proxy/_experimental/out/_next/static/chunks/6af2d8fb8cb64938.js +++ /dev/null @@ -1,2 +0,0 @@ -(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,663435,152473,e=>{"use strict";var t=e.i(843476),r=e.i(271645),n=e.i(199133),i=e.i(898586),o=e.i(56456);let s={enabled:!0,leading:!1,trailing:!0,wait:0,onExecute:()=>{}};class a{constructor(e,t){this.fn=e,this._canLeadingExecute=!0,this._isPending=!1,this._executionCount=0,this._options={...s,...t}}setOptions(e){return this._options={...this._options,...e},this._options.enabled||(this._isPending=!1),this._options}getOptions(){return this._options}maybeExecute(...e){this._options.leading&&this._canLeadingExecute&&(this.executeFunction(...e),this._canLeadingExecute=!1),(this._options.leading||this._options.trailing)&&(this._isPending=!0),this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=setTimeout(()=>{this._canLeadingExecute=!0,this._isPending=!1,this._options.trailing&&this.executeFunction(...e)},this._options.wait)}executeFunction(...e){this._options.enabled&&(this.fn(...e),this._executionCount++,this._options.onExecute(this))}cancel(){this._timeoutId&&(clearTimeout(this._timeoutId),this._canLeadingExecute=!0,this._isPending=!1)}getExecutionCount(){return this._executionCount}getIsPending(){return this._options.enabled&&this._isPending}}function l(e,t){let[n,i]=(0,r.useState)(e),o=function(e,t){let[n]=(0,r.useState)(()=>{var r;return Object.getOwnPropertyNames(Object.getPrototypeOf(r=new a(e,t))).filter(e=>"function"==typeof r[e]).reduce((e,t)=>{let n=r[t];return"function"==typeof n&&(e[t]=n.bind(r)),e},{})});return n.setOptions(t),n}(i,t);return[n,o.maybeExecute,o]}e.s(["useDebouncedState",()=>l],152473);var u=e.i(785242);let{Text:c}=i.Typography;e.s(["default",0,({value:e,onChange:i,onTeamSelect:s,disabled:a,organizationId:d,pageSize:f=20})=>{let[p,h]=(0,r.useState)(""),[m,g]=l("",{wait:300}),{data:v,fetchNextPage:y,hasNextPage:b,isFetchingNextPage:_,isLoading:E}=(0,u.useInfiniteTeams)(f,m||void 0,d),k=(0,r.useMemo)(()=>{if(!v?.pages)return[];let e=new Set,t=[];for(let r of v.pages)for(let n of r.teams)e.has(n.team_id)||(e.add(n.team_id),t.push(n));return t},[v]);return(0,t.jsx)(n.Select,{showSearch:!0,placeholder:"Search or select a team",value:e||void 0,onChange:e=>{i?.(e??""),s&&s(e?k.find(t=>t.team_id===e)??null:null)},disabled:a,allowClear:!0,filterOption:!1,onSearch:e=>{h(e),g(e)},searchValue:p,onPopupScroll:e=>{let t=e.currentTarget;(t.scrollTop+t.clientHeight)/t.scrollHeight>=.8&&b&&!_&&y()},loading:E,notFoundContent:E?(0,t.jsx)(o.LoadingOutlined,{spin:!0}):"No teams found",popupRender:e=>(0,t.jsxs)(t.Fragment,{children:[e,_&&(0,t.jsx)("div",{style:{textAlign:"center",padding:8},children:(0,t.jsx)(o.LoadingOutlined,{spin:!0})})]}),children:k.map(e=>(0,t.jsxs)(n.Select.Option,{value:e.team_id,children:[(0,t.jsx)("span",{className:"font-medium",children:e.team_alias})," ",(0,t.jsxs)(c,{type:"secondary",children:["(",e.team_id,")"]})]},e.team_id))})}],663435)},519756,e=>{"use strict";e.i(247167);var t=e.i(931067),r=e.i(271645);let n={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M400 317.7h73.9V656c0 4.4 3.6 8 8 8h60c4.4 0 8-3.6 8-8V317.7H624c6.7 0 10.4-7.7 6.3-12.9L518.3 163a8 8 0 00-12.6 0l-112 141.7c-4.1 5.3-.4 13 6.3 13zM878 626h-60c-4.4 0-8 3.6-8 8v154H214V634c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8v198c0 17.7 14.3 32 32 32h684c17.7 0 32-14.3 32-32V634c0-4.4-3.6-8-8-8z"}}]},name:"upload",theme:"outlined"};var i=e.i(9583),o=r.forwardRef(function(e,o){return r.createElement(i.default,(0,t.default)({},e,{ref:o,icon:n}))});e.s(["UploadOutlined",0,o],519756)},435451,620250,e=>{"use strict";var t=e.i(843476),r=e.i(290571),n=e.i(271645);let i=e=>{var t=(0,r.__rest)(e,[]);return n.default.createElement("svg",Object.assign({},t,{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:"2.5"}),n.default.createElement("path",{d:"M12 4v16m8-8H4"}))},o=e=>{var t=(0,r.__rest)(e,[]);return n.default.createElement("svg",Object.assign({},t,{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:"2.5"}),n.default.createElement("path",{d:"M20 12H4"}))};var s=e.i(444755),a=e.i(673706),l=e.i(677955);let u="flex mx-auto text-tremor-content-subtle dark:text-dark-tremor-content-subtle",c="cursor-pointer hover:text-tremor-content dark:hover:text-dark-tremor-content",d=n.default.forwardRef((e,t)=>{let{onSubmit:d,enableStepper:f=!0,disabled:p,onValueChange:h,onChange:m}=e,g=(0,r.__rest)(e,["onSubmit","enableStepper","disabled","onValueChange","onChange"]),v=(0,n.useRef)(null),[y,b]=n.default.useState(!1),_=n.default.useCallback(()=>{b(!0)},[]),E=n.default.useCallback(()=>{b(!1)},[]),[k,C]=n.default.useState(!1),x=n.default.useCallback(()=>{C(!0)},[]),w=n.default.useCallback(()=>{C(!1)},[]);return n.default.createElement(l.default,Object.assign({type:"number",ref:(0,a.mergeRefs)([v,t]),disabled:p,makeInputClassName:(0,a.makeClassName)("NumberInput"),onKeyDown:e=>{var t;if("Enter"===e.key&&!e.ctrlKey&&!e.altKey&&!e.shiftKey){let e=null==(t=v.current)?void 0:t.value;null==d||d(parseFloat(null!=e?e:""))}"ArrowDown"===e.key&&_(),"ArrowUp"===e.key&&x()},onKeyUp:e=>{"ArrowDown"===e.key&&E(),"ArrowUp"===e.key&&w()},onChange:e=>{p||(null==h||h(parseFloat(e.target.value)),null==m||m(e))},stepper:f?n.default.createElement("div",{className:(0,s.tremorTwMerge)("flex justify-center align-middle")},n.default.createElement("div",{tabIndex:-1,onClick:e=>e.preventDefault(),onMouseDown:e=>e.preventDefault(),onTouchStart:e=>{e.cancelable&&e.preventDefault()},onMouseUp:()=>{var e,t;p||(null==(e=v.current)||e.stepDown(),null==(t=v.current)||t.dispatchEvent(new Event("input",{bubbles:!0})))},className:(0,s.tremorTwMerge)(!p&&c,u,"group py-[10px] px-2.5 border-l border-tremor-border dark:border-dark-tremor-border")},n.default.createElement(o,{"data-testid":"step-down",className:(y?"scale-95":"")+" h-4 w-4 duration-75 transition group-active:scale-95"})),n.default.createElement("div",{tabIndex:-1,onClick:e=>e.preventDefault(),onMouseDown:e=>e.preventDefault(),onTouchStart:e=>{e.cancelable&&e.preventDefault()},onMouseUp:()=>{var e,t;p||(null==(e=v.current)||e.stepUp(),null==(t=v.current)||t.dispatchEvent(new Event("input",{bubbles:!0})))},className:(0,s.tremorTwMerge)(!p&&c,u,"group py-[10px] px-2.5 border-l border-tremor-border dark:border-dark-tremor-border")},n.default.createElement(i,{"data-testid":"step-up",className:(k?"scale-95":"")+" h-4 w-4 duration-75 transition group-active:scale-95"}))):null},g))});d.displayName="NumberInput",e.s(["NumberInput",()=>d],620250),e.s(["default",0,({step:e=.01,style:r={width:"100%"},placeholder:n="Enter a numerical value",min:i,max:o,onChange:s,...a})=>(0,t.jsx)(d,{onWheel:e=>e.currentTarget.blur(),step:e,style:r,placeholder:n,min:i,max:o,onChange:s,...a})],435451)},737434,e=>{"use strict";var t=e.i(184163);e.s(["DownloadOutlined",()=>t.default])},59935,(e,t,r)=>{var n;let i;e.e,n=function e(){var t,r="u">typeof self?self:"u">typeof window?window:void 0!==r?r:{},n=!r.document&&!!r.postMessage,i=r.IS_PAPA_WORKER||!1,o={},s=0,a={};function l(e){this._handle=null,this._finished=!1,this._completed=!1,this._halted=!1,this._input=null,this._baseIndex=0,this._partialLine="",this._rowCount=0,this._start=0,this._nextChunk=null,this.isFirstChunk=!0,this._completeResults={data:[],errors:[],meta:{}},(function(e){var t=b(e);t.chunkSize=parseInt(t.chunkSize),e.step||e.chunk||(t.chunkSize=null),this._handle=new p(t),(this._handle.streamer=this)._config=t}).call(this,e),this.parseChunk=function(e,t){var n=parseInt(this._config.skipFirstNLines)||0;if(this.isFirstChunk&&0=this._config.preview,i)r.postMessage({results:o,workerId:a.WORKER_ID,finished:n});else if(E(this._config.chunk)&&!t){if(this._config.chunk(o,this._handle),this._handle.paused()||this._handle.aborted())return void(this._halted=!0);this._completeResults=o=void 0}return this._config.step||this._config.chunk||(this._completeResults.data=this._completeResults.data.concat(o.data),this._completeResults.errors=this._completeResults.errors.concat(o.errors),this._completeResults.meta=o.meta),this._completed||!n||!E(this._config.complete)||o&&o.meta.aborted||(this._config.complete(this._completeResults,this._input),this._completed=!0),n||o&&o.meta.paused||this._nextChunk(),o}this._halted=!0},this._sendError=function(e){E(this._config.error)?this._config.error(e):i&&this._config.error&&r.postMessage({workerId:a.WORKER_ID,error:e,finished:!1})}}function u(e){var t;(e=e||{}).chunkSize||(e.chunkSize=a.RemoteChunkSize),l.call(this,e),this._nextChunk=n?function(){this._readChunk(),this._chunkLoaded()}:function(){this._readChunk()},this.stream=function(e){this._input=e,this._nextChunk()},this._readChunk=function(){if(this._finished)this._chunkLoaded();else{if(t=new XMLHttpRequest,this._config.withCredentials&&(t.withCredentials=this._config.withCredentials),n||(t.onload=_(this._chunkLoaded,this),t.onerror=_(this._chunkError,this)),t.open(this._config.downloadRequestBody?"POST":"GET",this._input,!n),this._config.downloadRequestHeaders){var e,r,i=this._config.downloadRequestHeaders;for(r in i)t.setRequestHeader(r,i[r])}this._config.chunkSize&&(e=this._start+this._config.chunkSize-1,t.setRequestHeader("Range","bytes="+this._start+"-"+e));try{t.send(this._config.downloadRequestBody)}catch(e){this._chunkError(e.message)}n&&0===t.status&&this._chunkError()}},this._chunkLoaded=function(){let e;4===t.readyState&&(t.status<200||400<=t.status?this._chunkError():(this._start+=this._config.chunkSize||t.responseText.length,this._finished=!this._config.chunkSize||this._start>=(null!==(e=(e=t).getResponseHeader("Content-Range"))?parseInt(e.substring(e.lastIndexOf("/")+1)):-1),this.parseChunk(t.responseText)))},this._chunkError=function(e){e=t.statusText||e,this._sendError(Error(e))}}function c(e){(e=e||{}).chunkSize||(e.chunkSize=a.LocalChunkSize),l.call(this,e);var t,r,n="u">typeof FileReader;this.stream=function(e){this._input=e,r=e.slice||e.webkitSlice||e.mozSlice,n?((t=new FileReader).onload=_(this._chunkLoaded,this),t.onerror=_(this._chunkError,this)):t=new FileReaderSync,this._nextChunk()},this._nextChunk=function(){this._finished||this._config.preview&&!(this._rowCount=this._input.size,this.parseChunk(e.target.result)},this._chunkError=function(){this._sendError(t.error)}}function d(e){var t;l.call(this,e=e||{}),this.stream=function(e){return t=e,this._nextChunk()},this._nextChunk=function(){var e,r;if(!this._finished)return t=(e=this._config.chunkSize)?(r=t.substring(0,e),t.substring(e)):(r=t,""),this._finished=!t,this.parseChunk(r)}}function f(e){l.call(this,e=e||{});var t=[],r=!0,n=!1;this.pause=function(){l.prototype.pause.apply(this,arguments),this._input.pause()},this.resume=function(){l.prototype.resume.apply(this,arguments),this._input.resume()},this.stream=function(e){this._input=e,this._input.on("data",this._streamData),this._input.on("end",this._streamEnd),this._input.on("error",this._streamError)},this._checkIsFinished=function(){n&&1===t.length&&(this._finished=!0)},this._nextChunk=function(){this._checkIsFinished(),t.length?this.parseChunk(t.shift()):r=!0},this._streamData=_(function(e){try{t.push("string"==typeof e?e:e.toString(this._config.encoding)),r&&(r=!1,this._checkIsFinished(),this.parseChunk(t.shift()))}catch(e){this._streamError(e)}},this),this._streamError=_(function(e){this._streamCleanUp(),this._sendError(e)},this),this._streamEnd=_(function(){this._streamCleanUp(),n=!0,this._streamData("")},this),this._streamCleanUp=_(function(){this._input.removeListener("data",this._streamData),this._input.removeListener("end",this._streamEnd),this._input.removeListener("error",this._streamError)},this)}function p(e){var t,r,n,i,o=/^\s*-?(\d+\.?|\.\d+|\d+\.\d+)([eE][-+]?\d+)?\s*$/,s=/^((\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\.\d+([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z)))$/,l=this,u=0,c=0,d=!1,f=!1,p=[],g={data:[],errors:[],meta:{}};function v(t){return"greedy"===e.skipEmptyLines?""===t.join("").trim():1===t.length&&0===t[0].length}function y(){if(g&&n&&(k("Delimiter","UndetectableDelimiter","Unable to auto-detect delimiting character; defaulted to '"+a.DefaultDelimiter+"'"),n=!1),e.skipEmptyLines&&(g.data=g.data.filter(function(e){return!v(e)})),_()){if(g)if(Array.isArray(g.data[0])){for(var t,r=0;_()&&r(e.dynamicTypingFunction&&void 0===e.dynamicTyping[t]&&(e.dynamicTyping[t]=e.dynamicTypingFunction(t)),!0===(e.dynamicTyping[t]||e.dynamicTyping))?"true"===r||"TRUE"===r||"false"!==r&&"FALSE"!==r&&((e=>{if(o.test(e)&&-0x20000000000000<(e=parseFloat(e))&&e<0x20000000000000)return 1})(r)?parseFloat(r):s.test(r)?new Date(r):""===r?null:r):r)(a=e.header?i>=p.length?"__parsed_extra":p[i]:a,l=e.transform?e.transform(l,a):l);"__parsed_extra"===a?(n[a]=n[a]||[],n[a].push(l)):n[a]=l}return e.header&&(i>p.length?k("FieldMismatch","TooManyFields","Too many fields: expected "+p.length+" fields but parsed "+i,c+r):ie.preview?r.abort():(g.data=g.data[0],i(g,l))))}),this.parse=function(i,o,s){var l=e.quoteChar||'"',l=(e.newline||(e.newline=this.guessLineEndings(i,l)),n=!1,e.delimiter?E(e.delimiter)&&(e.delimiter=e.delimiter(i),g.meta.delimiter=e.delimiter):((l=((t,r,n,i,o)=>{var s,l,u,c;o=o||[","," ","|",";",a.RECORD_SEP,a.UNIT_SEP];for(var d=0;d=r.length/2?"\r\n":"\r"}}function h(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function m(e){var t=(e=e||{}).delimiter,r=e.newline,n=e.comments,i=e.step,o=e.preview,s=e.fastMode,l=null,u=!1,c=null==e.quoteChar?'"':e.quoteChar,d=c;if(void 0!==e.escapeChar&&(d=e.escapeChar),("string"!=typeof t||-1=o)return N(!0);break}x.push({type:"Quotes",code:"InvalidQuotes",message:"Trailing quote on quoted field is malformed",row:C.length,index:f}),D++}}else if(n&&0===w.length&&a.substring(f,f+_)===n){if(-1===I)return N();f=I+b,I=a.indexOf(r,f),T=a.indexOf(t,f)}else if(-1!==T&&(T=o)return N(!0)}return L();function A(e){C.push(e),O=f}function F(e){return -1!==e&&(e=a.substring(D+1,e))&&""===e.trim()?e.length:0}function L(e){return g||(void 0===e&&(e=a.substring(f)),w.push(e),f=v,A(w),k&&B()),N()}function M(e){f=e,A(w),w=[],I=a.indexOf(r,f)}function N(n){if(e.header&&!m&&C.length&&!u){var i=C[0],o=Object.create(null),s=new Set(i);let t=!1;for(let r=0;r{if("object"==typeof t){if("string"!=typeof t.delimiter||a.BAD_DELIMITERS.filter(function(e){return -1!==t.delimiter.indexOf(e)}).length||(i=t.delimiter),("boolean"==typeof t.quotes||"function"==typeof t.quotes||Array.isArray(t.quotes))&&(r=t.quotes),"boolean"!=typeof t.skipEmptyLines&&"string"!=typeof t.skipEmptyLines||(u=t.skipEmptyLines),"string"==typeof t.newline&&(o=t.newline),"string"==typeof t.quoteChar&&(s=t.quoteChar),"boolean"==typeof t.header&&(n=t.header),Array.isArray(t.columns)){if(0===t.columns.length)throw Error("Option columns is empty");c=t.columns}void 0!==t.escapeChar&&(l=t.escapeChar+s),t.escapeFormulae instanceof RegExp?d=t.escapeFormulae:"boolean"==typeof t.escapeFormulae&&t.escapeFormulae&&(d=/^[=+\-@\t\r].*$/)}})(),RegExp(h(s),"g"));if("string"==typeof e&&(e=JSON.parse(e)),Array.isArray(e)){if(!e.length||Array.isArray(e[0]))return p(null,e,u);if("object"==typeof e[0])return p(c||Object.keys(e[0]),e,u)}else if("object"==typeof e)return"string"==typeof e.data&&(e.data=JSON.parse(e.data)),Array.isArray(e.data)&&(e.fields||(e.fields=e.meta&&e.meta.fields||c),e.fields||(e.fields=Array.isArray(e.data[0])?e.fields:"object"==typeof e.data[0]?Object.keys(e.data[0]):[]),Array.isArray(e.data[0])||"object"==typeof e.data[0]||(e.data=[e.data])),p(e.fields||[],e.data||[],u);throw Error("Unable to serialize unrecognized input");function p(e,t,r){var s="",a=("string"==typeof e&&(e=JSON.parse(e)),"string"==typeof t&&(t=JSON.parse(t)),Array.isArray(e)&&0{for(var r=0;r{"use strict";var t=e.i(271645);let r=t.forwardRef(function(e,r){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:r},e),t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M10 14l2-2m0 0l2-2m-2 2l-2-2m2 2l2 2m7-2a9 9 0 11-18 0 9 9 0 0118 0z"}))});e.s(["XCircleIcon",0,r],964306)},950724,(e,t,r)=>{t.exports=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}},100236,(e,t,r)=>{t.exports=e.g&&e.g.Object===Object&&e.g},139088,(e,t,r)=>{var n=e.r(100236),i="object"==typeof self&&self&&self.Object===Object&&self;t.exports=n||i||Function("return this")()},631926,(e,t,r)=>{var n=e.r(139088);t.exports=function(){return n.Date.now()}},748891,(e,t,r)=>{var n=/\s/;t.exports=function(e){for(var t=e.length;t--&&n.test(e.charAt(t)););return t}},830364,(e,t,r)=>{var n=e.r(748891),i=/^\s+/;t.exports=function(e){return e?e.slice(0,n(e)+1).replace(i,""):e}},630353,(e,t,r)=>{t.exports=e.r(139088).Symbol},243436,(e,t,r)=>{var n=e.r(630353),i=Object.prototype,o=i.hasOwnProperty,s=i.toString,a=n?n.toStringTag:void 0;t.exports=function(e){var t=o.call(e,a),r=e[a];try{e[a]=void 0;var n=!0}catch(e){}var i=s.call(e);return n&&(t?e[a]=r:delete e[a]),i}},223243,(e,t,r)=>{var n=Object.prototype.toString;t.exports=function(e){return n.call(e)}},377684,(e,t,r)=>{var n=e.r(630353),i=e.r(243436),o=e.r(223243),s=n?n.toStringTag:void 0;t.exports=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":s&&s in Object(e)?i(e):o(e)}},877289,(e,t,r)=>{t.exports=function(e){return null!=e&&"object"==typeof e}},361884,(e,t,r)=>{var n=e.r(377684),i=e.r(877289);t.exports=function(e){return"symbol"==typeof e||i(e)&&"[object Symbol]"==n(e)}},773759,(e,t,r)=>{var n=e.r(830364),i=e.r(950724),o=e.r(361884),s=0/0,a=/^[-+]0x[0-9a-f]+$/i,l=/^0b[01]+$/i,u=/^0o[0-7]+$/i,c=parseInt;t.exports=function(e){if("number"==typeof e)return e;if(o(e))return s;if(i(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=i(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=n(e);var r=l.test(e);return r||u.test(e)?c(e.slice(2),r?2:8):a.test(e)?s:+e}},374009,(e,t,r)=>{var n=e.r(950724),i=e.r(631926),o=e.r(773759),s=Math.max,a=Math.min;t.exports=function(e,t,r){var l,u,c,d,f,p,h=0,m=!1,g=!1,v=!0;if("function"!=typeof e)throw TypeError("Expected a function");function y(t){var r=l,n=u;return l=u=void 0,h=t,d=e.apply(n,r)}function b(e){var r=e-p,n=e-h;return void 0===p||r>=t||r<0||g&&n>=c}function _(){var e,r,n,o=i();if(b(o))return E(o);f=setTimeout(_,(e=o-p,r=o-h,n=t-e,g?a(n,c-r):n))}function E(e){return(f=void 0,v&&l)?y(e):(l=u=void 0,d)}function k(){var e,r=i(),n=b(r);if(l=arguments,u=this,p=r,n){if(void 0===f)return h=e=p,f=setTimeout(_,t),m?y(e):d;if(g)return clearTimeout(f),f=setTimeout(_,t),y(p)}return void 0===f&&(f=setTimeout(_,t)),d}return t=o(t)||0,n(r)&&(m=!!r.leading,c=(g="maxWait"in r)?s(o(r.maxWait)||0,t):c,v="trailing"in r?!!r.trailing:v),k.cancel=function(){void 0!==f&&clearTimeout(f),h=0,l=p=u=f=void 0},k.flush=function(){return void 0===f?d:E(i())},k}},677667,674175,886148,543086,e=>{"use strict";let t,r;var n,i=e.i(290571),o=e.i(429427),s=e.i(371330),a=e.i(271645),l=e.i(394487),u=e.i(914189),c=e.i(144279),d=e.i(294316),f=e.i(83733);let p=(0,a.createContext)(()=>{});function h({value:e,children:t}){return a.default.createElement(p.Provider,{value:e},t)}e.s(["CloseProvider",()=>h],674175);var m=e.i(233137),g=e.i(233538),v=e.i(397701),y=e.i(402155),b=e.i(700020);let _=null!=(n=a.default.startTransition)?n:function(e){e()};var E=e.i(998348),k=((t=k||{})[t.Open=0]="Open",t[t.Closed=1]="Closed",t),C=((r=C||{})[r.ToggleDisclosure=0]="ToggleDisclosure",r[r.CloseDisclosure=1]="CloseDisclosure",r[r.SetButtonId=2]="SetButtonId",r[r.SetPanelId=3]="SetPanelId",r[r.SetButtonElement=4]="SetButtonElement",r[r.SetPanelElement=5]="SetPanelElement",r);let x={0:e=>({...e,disclosureState:(0,v.match)(e.disclosureState,{0:1,1:0})}),1:e=>1===e.disclosureState?e:{...e,disclosureState:1},2:(e,t)=>e.buttonId===t.buttonId?e:{...e,buttonId:t.buttonId},3:(e,t)=>e.panelId===t.panelId?e:{...e,panelId:t.panelId},4:(e,t)=>e.buttonElement===t.element?e:{...e,buttonElement:t.element},5:(e,t)=>e.panelElement===t.element?e:{...e,panelElement:t.element}},w=(0,a.createContext)(null);function O(e){let t=(0,a.useContext)(w);if(null===t){let t=Error(`<${e} /> is missing a parent component.`);throw Error.captureStackTrace&&Error.captureStackTrace(t,O),t}return t}w.displayName="DisclosureContext";let S=(0,a.createContext)(null);S.displayName="DisclosureAPIContext";let R=(0,a.createContext)(null);function T(e,t){return(0,v.match)(t.type,x,e,t)}R.displayName="DisclosurePanelContext";let I=a.Fragment,j=b.RenderFeatures.RenderStrategy|b.RenderFeatures.Static,D=Object.assign((0,b.forwardRefWithAs)(function(e,t){let{defaultOpen:r=!1,...n}=e,i=(0,a.useRef)(null),o=(0,d.useSyncRefs)(t,(0,d.optionalRef)(e=>{i.current=e},void 0===e.as||e.as===a.Fragment)),s=(0,a.useReducer)(T,{disclosureState:+!r,buttonElement:null,panelElement:null,buttonId:null,panelId:null}),[{disclosureState:l,buttonId:c},f]=s,p=(0,u.useEvent)(e=>{f({type:1});let t=(0,y.getOwnerDocument)(i);if(!t||!c)return;let r=e?e instanceof HTMLElement?e:e.current instanceof HTMLElement?e.current:t.getElementById(c):t.getElementById(c);null==r||r.focus()}),g=(0,a.useMemo)(()=>({close:p}),[p]),_=(0,a.useMemo)(()=>({open:0===l,close:p}),[l,p]),E=(0,b.useRender)();return a.default.createElement(w.Provider,{value:s},a.default.createElement(S.Provider,{value:g},a.default.createElement(h,{value:p},a.default.createElement(m.OpenClosedProvider,{value:(0,v.match)(l,{0:m.State.Open,1:m.State.Closed})},E({ourProps:{ref:o},theirProps:n,slot:_,defaultTag:I,name:"Disclosure"})))))}),{Button:(0,b.forwardRefWithAs)(function(e,t){let r=(0,a.useId)(),{id:n=`headlessui-disclosure-button-${r}`,disabled:i=!1,autoFocus:f=!1,...p}=e,[h,m]=O("Disclosure.Button"),v=(0,a.useContext)(R),y=null!==v&&v===h.panelId,_=(0,a.useRef)(null),k=(0,d.useSyncRefs)(_,t,(0,u.useEvent)(e=>{if(!y)return m({type:4,element:e})}));(0,a.useEffect)(()=>{if(!y)return m({type:2,buttonId:n}),()=>{m({type:2,buttonId:null})}},[n,m,y]);let C=(0,u.useEvent)(e=>{var t;if(y){if(1===h.disclosureState)return;switch(e.key){case E.Keys.Space:case E.Keys.Enter:e.preventDefault(),e.stopPropagation(),m({type:0}),null==(t=h.buttonElement)||t.focus()}}else switch(e.key){case E.Keys.Space:case E.Keys.Enter:e.preventDefault(),e.stopPropagation(),m({type:0})}}),x=(0,u.useEvent)(e=>{e.key===E.Keys.Space&&e.preventDefault()}),w=(0,u.useEvent)(e=>{var t;(0,g.isDisabledReactIssue7711)(e.currentTarget)||i||(y?(m({type:0}),null==(t=h.buttonElement)||t.focus()):m({type:0}))}),{isFocusVisible:S,focusProps:T}=(0,o.useFocusRing)({autoFocus:f}),{isHovered:I,hoverProps:j}=(0,s.useHover)({isDisabled:i}),{pressed:D,pressProps:P}=(0,l.useActivePress)({disabled:i}),A=(0,a.useMemo)(()=>({open:0===h.disclosureState,hover:I,active:D,disabled:i,focus:S,autofocus:f}),[h,I,D,S,i,f]),F=(0,c.useResolveButtonType)(e,h.buttonElement),L=y?(0,b.mergeProps)({ref:k,type:F,disabled:i||void 0,autoFocus:f,onKeyDown:C,onClick:w},T,j,P):(0,b.mergeProps)({ref:k,id:n,type:F,"aria-expanded":0===h.disclosureState,"aria-controls":h.panelElement?h.panelId:void 0,disabled:i||void 0,autoFocus:f,onKeyDown:C,onKeyUp:x,onClick:w},T,j,P);return(0,b.useRender)()({ourProps:L,theirProps:p,slot:A,defaultTag:"button",name:"Disclosure.Button"})}),Panel:(0,b.forwardRefWithAs)(function(e,t){let r=(0,a.useId)(),{id:n=`headlessui-disclosure-panel-${r}`,transition:i=!1,...o}=e,[s,l]=O("Disclosure.Panel"),{close:c}=function e(t){let r=(0,a.useContext)(S);if(null===r){let r=Error(`<${t} /> is missing a parent component.`);throw Error.captureStackTrace&&Error.captureStackTrace(r,e),r}return r}("Disclosure.Panel"),[p,h]=(0,a.useState)(null),g=(0,d.useSyncRefs)(t,(0,u.useEvent)(e=>{_(()=>l({type:5,element:e}))}),h);(0,a.useEffect)(()=>(l({type:3,panelId:n}),()=>{l({type:3,panelId:null})}),[n,l]);let v=(0,m.useOpenClosed)(),[y,E]=(0,f.useTransition)(i,p,null!==v?(v&m.State.Open)===m.State.Open:0===s.disclosureState),k=(0,a.useMemo)(()=>({open:0===s.disclosureState,close:c}),[s.disclosureState,c]),C={ref:g,id:n,...(0,f.transitionDataAttributes)(E)},x=(0,b.useRender)();return a.default.createElement(m.ResetOpenClosedProvider,null,a.default.createElement(R.Provider,{value:s.panelId},x({ourProps:C,theirProps:o,slot:k,defaultTag:"div",features:j,visible:y,name:"Disclosure.Panel"})))})});e.s(["Disclosure",()=>D],886148);let P=(0,a.createContext)(void 0);var A=e.i(444755);let F=(0,e.i(673706).makeClassName)("Accordion"),L=(0,a.createContext)({isOpen:!1}),M=a.default.forwardRef((e,t)=>{var r;let{defaultOpen:n=!1,children:o,className:s}=e,l=(0,i.__rest)(e,["defaultOpen","children","className"]),u=null!=(r=(0,a.useContext)(P))?r:(0,A.tremorTwMerge)("rounded-tremor-default border");return a.default.createElement(D,Object.assign({as:"div",ref:t,className:(0,A.tremorTwMerge)(F("root"),"overflow-hidden","bg-tremor-background border-tremor-border","dark:bg-dark-tremor-background dark:border-dark-tremor-border",u,s),defaultOpen:n},l),({open:e})=>a.default.createElement(L.Provider,{value:{isOpen:e}},o))});M.displayName="Accordion",e.s(["OpenContext",()=>L,"default",()=>M],543086),e.s(["Accordion",()=>M],677667)},130643,e=>{"use strict";var t=e.i(290571),r=e.i(271645),n=e.i(886148),i=e.i(444755);let o=(0,e.i(673706).makeClassName)("AccordionBody"),s=r.default.forwardRef((e,s)=>{let{children:a,className:l}=e,u=(0,t.__rest)(e,["children","className"]);return r.default.createElement(n.Disclosure.Panel,Object.assign({ref:s,className:(0,i.tremorTwMerge)(o("root"),"w-full text-tremor-default px-4 pb-3","text-tremor-content","dark:text-dark-tremor-content",l)},u),a)});s.displayName="AccordionBody",e.s(["AccordionBody",()=>s],130643)},898667,e=>{"use strict";var t=e.i(290571),r=e.i(271645),n=e.i(886148);let i=e=>{var n=(0,t.__rest)(e,[]);return r.default.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor"},n),r.default.createElement("path",{d:"M11.9999 10.8284L7.0502 15.7782L5.63599 14.364L11.9999 8L18.3639 14.364L16.9497 15.7782L11.9999 10.8284Z"}))};var o=e.i(543086),s=e.i(444755);let a=(0,e.i(673706).makeClassName)("AccordionHeader"),l=r.default.forwardRef((e,l)=>{let{children:u,className:c}=e,d=(0,t.__rest)(e,["children","className"]),{isOpen:f}=(0,r.useContext)(o.OpenContext);return r.default.createElement(n.Disclosure.Button,Object.assign({ref:l,className:(0,s.tremorTwMerge)(a("root"),"w-full flex items-center justify-between px-4 py-3","text-tremor-content-emphasis","dark:text-dark-tremor-content-emphasis",c)},d),r.default.createElement("div",{className:(0,s.tremorTwMerge)(a("children"),"flex flex-1 text-inherit mr-4")},u),r.default.createElement("div",null,r.default.createElement(i,{className:(0,s.tremorTwMerge)(a("arrowIcon"),"h-5 w-5 -mr-1","text-tremor-content-subtle","dark:text-dark-tremor-content-subtle",f?"transition-all":"transition-all -rotate-180")})))});l.displayName="AccordionHeader",e.s(["AccordionHeader",()=>l],898667)},83733,233137,e=>{"use strict";let t,r;var n,i,o=e.i(247167),s=e.i(271645),a=e.i(544508),l=e.i(746725),u=e.i(835696);void 0!==o.default&&"u">typeof globalThis&&"u">typeof Element&&(null==(n=null==o.default?void 0:o.default.env)?void 0:n.NODE_ENV)==="test"&&void 0===(null==(i=null==Element?void 0:Element.prototype)?void 0:i.getAnimations)&&(Element.prototype.getAnimations=function(){return console.warn(["Headless UI has polyfilled `Element.prototype.getAnimations` for your tests.","Please install a proper polyfill e.g. `jsdom-testing-mocks`, to silence these warnings.","","Example usage:","```js","import { mockAnimationsApi } from 'jsdom-testing-mocks'","mockAnimationsApi()","```"].join(` -`)),[]});var c=((t=c||{})[t.None=0]="None",t[t.Closed=1]="Closed",t[t.Enter=2]="Enter",t[t.Leave=4]="Leave",t);function d(e){let t={};for(let r in e)!0===e[r]&&(t[`data-${r}`]="");return t}function f(e,t,r,n){let[i,o]=(0,s.useState)(r),{hasFlag:c,addFlag:d,removeFlag:f}=function(e=0){let[t,r]=(0,s.useState)(e),n=(0,s.useCallback)(e=>r(e),[t]),i=(0,s.useCallback)(e=>r(t=>t|e),[t]),o=(0,s.useCallback)(e=>(t&e)===e,[t]);return{flags:t,setFlag:n,addFlag:i,hasFlag:o,removeFlag:(0,s.useCallback)(e=>r(t=>t&~e),[r]),toggleFlag:(0,s.useCallback)(e=>r(t=>t^e),[r])}}(e&&i?3:0),p=(0,s.useRef)(!1),h=(0,s.useRef)(!1),m=(0,l.useDisposables)();return(0,u.useIsoMorphicEffect)(()=>{var i;if(e){if(r&&o(!0),!t){r&&d(3);return}return null==(i=null==n?void 0:n.start)||i.call(n,r),function(e,{prepare:t,run:r,done:n,inFlight:i}){let o=(0,a.disposables)();return function(e,{inFlight:t,prepare:r}){if(null!=t&&t.current)return r();let n=e.style.transition;e.style.transition="none",r(),e.offsetHeight,e.style.transition=n}(e,{prepare:t,inFlight:i}),o.nextFrame(()=>{r(),o.requestAnimationFrame(()=>{o.add(function(e,t){var r,n;let i=(0,a.disposables)();if(!e)return i.dispose;let o=!1;i.add(()=>{o=!0});let s=null!=(n=null==(r=e.getAnimations)?void 0:r.call(e).filter(e=>e instanceof CSSTransition))?n:[];return 0===s.length?t():Promise.allSettled(s.map(e=>e.finished)).then(()=>{o||t()}),i.dispose}(e,n))})}),o.dispose}(t,{inFlight:p,prepare(){h.current?h.current=!1:h.current=p.current,p.current=!0,h.current||(r?(d(3),f(4)):(d(4),f(2)))},run(){h.current?r?(f(3),d(4)):(f(4),d(3)):r?f(1):d(1)},done(){var e;h.current&&"function"==typeof t.getAnimations&&t.getAnimations().length>0||(p.current=!1,f(7),r||o(!1),null==(e=null==n?void 0:n.end)||e.call(n,r))}})}},[e,r,t,m]),e?[i,{closed:c(1),enter:c(2),leave:c(4),transition:c(2)||c(4)}]:[r,{closed:void 0,enter:void 0,leave:void 0,transition:void 0}]}e.s(["transitionDataAttributes",()=>d,"useTransition",()=>f],83733);let p=(0,s.createContext)(null);p.displayName="OpenClosedContext";var h=((r=h||{})[r.Open=1]="Open",r[r.Closed=2]="Closed",r[r.Closing=4]="Closing",r[r.Opening=8]="Opening",r);function m(){return(0,s.useContext)(p)}function g({value:e,children:t}){return s.default.createElement(p.Provider,{value:e},t)}function v({children:e}){return s.default.createElement(p.Provider,{value:null},e)}e.s(["OpenClosedProvider",()=>g,"ResetOpenClosedProvider",()=>v,"State",()=>h,"useOpenClosed",()=>m],233137)},233538,e=>{"use strict";function t(e){let t=e.parentElement,r=null;for(;t&&!(t instanceof HTMLFieldSetElement);)t instanceof HTMLLegendElement&&(r=t),t=t.parentElement;let n=(null==t?void 0:t.getAttribute("disabled"))==="";return!(n&&function(e){if(!e)return!1;let t=e.previousElementSibling;for(;null!==t;){if(t instanceof HTMLLegendElement)return!1;t=t.previousElementSibling}return!0}(r))&&n}e.s(["isDisabledReactIssue7711",()=>t])},888288,220508,e=>{"use strict";var t=e.i(271645);let r=(e,r)=>{let n=void 0!==r,[i,o]=(0,t.useState)(e);return[n?r:i,e=>{n||o(e)}]};e.s(["default",()=>r],888288);let n=t.forwardRef(function(e,r){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:r},e),t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z"}))});e.s(["CheckCircleIcon",0,n],220508)},503269,214520,601893,694421,140721,942803,35889,722678,e=>{"use strict";var t=e.i(271645),r=e.i(914189);function n(e,n,i){let[o,s]=(0,t.useState)(i),a=void 0!==e,l=(0,t.useRef)(a),u=(0,t.useRef)(!1),c=(0,t.useRef)(!1);return!a||l.current||u.current?a||!l.current||c.current||(c.current=!0,l.current=a,console.error("A component is changing from controlled to uncontrolled. This may be caused by the value changing from a defined value to undefined, which should not happen.")):(u.current=!0,l.current=a,console.error("A component is changing from uncontrolled to controlled. This may be caused by the value changing from undefined to a defined value, which should not happen.")),[a?e:o,(0,r.useEvent)(e=>(a||s(e),null==n?void 0:n(e)))]}function i(e){let[r]=(0,t.useState)(e);return r}e.s(["useControllable",()=>n],503269),e.s(["useDefaultValue",()=>i],214520);let o=(0,t.createContext)(void 0);function s(){return(0,t.useContext)(o)}e.s(["useDisabled",()=>s],601893);var a=e.i(174080),l=e.i(746725);function u(e={},t=null,r=[]){for(let[n,i]of Object.entries(e))!function e(t,r,n){if(Array.isArray(n))for(let[i,o]of n.entries())e(t,c(r,i.toString()),o);else n instanceof Date?t.push([r,n.toISOString()]):"boolean"==typeof n?t.push([r,n?"1":"0"]):"string"==typeof n?t.push([r,n]):"number"==typeof n?t.push([r,`${n}`]):null==n?t.push([r,""]):u(n,r,t)}(r,c(t,n),i);return r}function c(e,t){return e?e+"["+t+"]":t}function d(e){var t,r;let n=null!=(t=null==e?void 0:e.form)?t:e.closest("form");if(n){for(let t of n.elements)if(t!==e&&("INPUT"===t.tagName&&"submit"===t.type||"BUTTON"===t.tagName&&"submit"===t.type||"INPUT"===t.nodeName&&"image"===t.type))return void t.click();null==(r=n.requestSubmit)||r.call(n)}}e.s(["attemptSubmit",()=>d,"objectToFormEntries",()=>u],694421);var f=e.i(700020),p=e.i(2788);let h=(0,t.createContext)(null);function m({children:e}){let r=(0,t.useContext)(h);if(!r)return t.default.createElement(t.default.Fragment,null,e);let{target:n}=r;return n?(0,a.createPortal)(t.default.createElement(t.default.Fragment,null,e),n):null}function g({data:e,form:r,disabled:n,onReset:i,overrides:o}){let[s,a]=(0,t.useState)(null),c=(0,l.useDisposables)();return(0,t.useEffect)(()=>{if(i&&s)return c.addEventListener(s,"reset",i)},[s,r,i]),t.default.createElement(m,null,t.default.createElement(v,{setForm:a,formId:r}),u(e).map(([e,i])=>t.default.createElement(p.Hidden,{features:p.HiddenFeatures.Hidden,...(0,f.compact)({key:e,as:"input",type:"hidden",hidden:!0,readOnly:!0,form:r,disabled:n,name:e,value:i,...o})})))}function v({setForm:e,formId:r}){return(0,t.useEffect)(()=>{if(r){let t=document.getElementById(r);t&&e(t)}},[e,r]),r?null:t.default.createElement(p.Hidden,{features:p.HiddenFeatures.Hidden,as:"input",type:"hidden",hidden:!0,readOnly:!0,ref:t=>{if(!t)return;let r=t.closest("form");r&&e(r)}})}e.s(["FormFields",()=>g],140721);let y=(0,t.createContext)(void 0);function b(){return(0,t.useContext)(y)}e.s(["useProvidedId",()=>b],942803);var _=e.i(835696),E=e.i(294316);let k=(0,t.createContext)(null);function C(){var e,r;return null!=(r=null==(e=(0,t.useContext)(k))?void 0:e.value)?r:void 0}function x(){let[e,n]=(0,t.useState)([]);return[e.length>0?e.join(" "):void 0,(0,t.useMemo)(()=>function(e){let i=(0,r.useEvent)(e=>(n(t=>[...t,e]),()=>n(t=>{let r=t.slice(),n=r.indexOf(e);return -1!==n&&r.splice(n,1),r}))),o=(0,t.useMemo)(()=>({register:i,slot:e.slot,name:e.name,props:e.props,value:e.value}),[i,e.slot,e.name,e.props,e.value]);return t.default.createElement(k.Provider,{value:o},e.children)},[n])]}k.displayName="DescriptionContext";let w=Object.assign((0,f.forwardRefWithAs)(function(e,r){let n=(0,t.useId)(),i=s(),{id:o=`headlessui-description-${n}`,...a}=e,l=function e(){let r=(0,t.useContext)(k);if(null===r){let t=Error("You used a component, but it is not inside a relevant parent.");throw Error.captureStackTrace&&Error.captureStackTrace(t,e),t}return r}(),u=(0,E.useSyncRefs)(r);(0,_.useIsoMorphicEffect)(()=>l.register(o),[o,l.register]);let c=i||!1,d=(0,t.useMemo)(()=>({...l.slot,disabled:c}),[l.slot,c]),p={ref:u,...l.props,id:o};return(0,f.useRender)()({ourProps:p,theirProps:a,slot:d,defaultTag:"p",name:l.name||"Description"})}),{});e.s(["Description",()=>w,"useDescribedBy",()=>C,"useDescriptions",()=>x],35889);let O=(0,t.createContext)(null);function S(e){var r,n,i;let o=null!=(n=null==(r=(0,t.useContext)(O))?void 0:r.value)?n:void 0;return(null!=(i=null==e?void 0:e.length)?i:0)>0?[o,...e].filter(Boolean).join(" "):o}function R({inherit:e=!1}={}){let n=S(),[i,o]=(0,t.useState)([]),s=e?[n,...i].filter(Boolean):i;return[s.length>0?s.join(" "):void 0,(0,t.useMemo)(()=>function(e){let n=(0,r.useEvent)(e=>(o(t=>[...t,e]),()=>o(t=>{let r=t.slice(),n=r.indexOf(e);return -1!==n&&r.splice(n,1),r}))),i=(0,t.useMemo)(()=>({register:n,slot:e.slot,name:e.name,props:e.props,value:e.value}),[n,e.slot,e.name,e.props,e.value]);return t.default.createElement(O.Provider,{value:i},e.children)},[o])]}O.displayName="LabelContext";let T=Object.assign((0,f.forwardRefWithAs)(function(e,n){var i;let o=(0,t.useId)(),a=function e(){let r=(0,t.useContext)(O);if(null===r){let t=Error("You used a